Memory-saving tweak

This commit is contained in:
Yair Morgenstern 2019-03-10 23:04:04 +02:00
parent 115aef50ad
commit 881f532bf7
8 changed files with 8 additions and 7 deletions

View file

@ -58,6 +58,7 @@ class UnCivGame : Game() {
}
fun setWorldScreen() {
if(screen != null && screen != worldScreen) screen.dispose()
setScreen(worldScreen)
Gdx.input.inputProcessor = worldScreen.stage
worldScreen.shouldUpdate=true // This can set the screen to the policy picker or tech picker screen, so the input processor must come before

View file

@ -17,7 +17,7 @@ import java.util.*
class CivilopediaScreen : CameraStageBaseScreen() {
init {
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
val buttonTable = Table()
buttonTable.pad(15f)
val entryTable = Table()

View file

@ -22,7 +22,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
val currentPlayerCivInfo = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
init {
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
val topTable = Table().apply { defaults().pad(10f) }
val centerTable=Table().apply { defaults().pad(20f) }

View file

@ -42,7 +42,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
private var tileGroups = ArrayList<CityTileGroup>()
init {
onBackButtonClicked { game.setWorldScreen(); dispose() }
onBackButtonClicked { game.setWorldScreen() }
addTiles()
val tableBackgroundColor = ImageGetter.getBlue().lerp(Color.BLACK,0.5f)

View file

@ -27,7 +27,7 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
rightSideButton.setText("Adopt free policy".tr())
closeButton.disable()
}
else onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
else onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
rightSideButton.onClick("policy") {
civInfo.policies.adopt(pickedPolicy!!)

View file

@ -16,7 +16,7 @@ class PromotionPickerScreen(mapUnit: MapUnit) : PickerScreen() {
init {
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
setDefaultCloseAction()
rightSideButton.setText("Pick promotion".tr())
rightSideButton.onClick("promote") {

View file

@ -40,7 +40,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
init {
setDefaultCloseAction()
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
tempTechsToResearch = ArrayList(civTech.techsToResearch)

View file

@ -14,7 +14,7 @@ class DiplomacyScreen:CameraStageBaseScreen(){
val rightSideTable = Table()
init{
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
onBackButtonClicked { UnCivGame.Current.setWorldScreen() }
val splitPane = SplitPane(ScrollPane(leftSideTable),rightSideTable,false, skin)
splitPane.splitAmount = 0.2f