mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Fixed "units deselect after next turn" problem
Popup alerts now come before trade request popups
This commit is contained in:
parent
ed807551eb
commit
05a77a9a68
@ -1026,6 +1026,8 @@
|
|||||||
unique:"Upon signingOpen Borders, both Civilizations receive a Cargo Ship. Foreign Units within your borders provide Culture."
|
unique:"Upon signingOpen Borders, both Civilizations receive a Cargo Ship. Foreign Units within your borders provide Culture."
|
||||||
cities:["Manila","Quezon","Cebu",Pasig","Makati","Cagayan de Oro","Baguio","Davao City","Bacolod","Taguig","Pasay",
|
cities:["Manila","Quezon","Cebu",Pasig","Makati","Cagayan de Oro","Baguio","Davao City","Bacolod","Taguig","Pasay",
|
||||||
"Bataan","Angeles","Marikina"]
|
"Bataan","Angeles","Marikina"]
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1241,5 +1243,6 @@
|
|||||||
name:"Barbarians",
|
name:"Barbarians",
|
||||||
outerColor:[0,0,0],
|
outerColor:[0,0,0],
|
||||||
innerColor:[182,0,0]
|
innerColor:[182,0,0]
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.unciv.logic.civilization
|
package com.unciv.logic.civilization
|
||||||
|
|
||||||
enum class AlertType{
|
enum class AlertType{
|
||||||
WarDeclaration,
|
|
||||||
Defeated,
|
Defeated,
|
||||||
|
WonderBuilt,
|
||||||
|
WarDeclaration,
|
||||||
FirstContact,
|
FirstContact,
|
||||||
CityConquered,
|
CityConquered,
|
||||||
BorderConflict,
|
BorderConflict,
|
||||||
@ -10,7 +11,6 @@ enum class AlertType{
|
|||||||
CitiesSettledNearOtherCiv,
|
CitiesSettledNearOtherCiv,
|
||||||
DemandToStopSettlingCitiesNear,
|
DemandToStopSettlingCitiesNear,
|
||||||
CitySettledNearOtherCivDespiteOurPromise,
|
CitySettledNearOtherCivDespiteOurPromise,
|
||||||
WonderBuilt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PopupAlert {
|
class PopupAlert {
|
||||||
|
@ -36,6 +36,7 @@ import kotlin.concurrent.thread
|
|||||||
class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||||
val gameInfo = game.gameInfo
|
val gameInfo = game.gameInfo
|
||||||
var isPlayersTurn = viewingCiv == gameInfo.currentPlayerCiv // todo this should be updated when passing turns
|
var isPlayersTurn = viewingCiv == gameInfo.currentPlayerCiv // todo this should be updated when passing turns
|
||||||
|
var waitingForAutosave = false
|
||||||
|
|
||||||
val tileMapHolder: TileMapHolder = TileMapHolder(this, gameInfo.tileMap)
|
val tileMapHolder: TileMapHolder = TileMapHolder(this, gameInfo.tileMap)
|
||||||
val minimapWrapper = MinimapHolder(tileMapHolder)
|
val minimapWrapper = MinimapHolder(tileMapHolder)
|
||||||
@ -188,8 +189,8 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.screen = VictoryScreen()
|
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.screen = VictoryScreen()
|
||||||
viewingCiv.policies.freePolicies > 0 -> game.screen = PolicyPickerScreen(this)
|
viewingCiv.policies.freePolicies > 0 -> game.screen = PolicyPickerScreen(this)
|
||||||
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.screen = GreatPersonPickerScreen()
|
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.screen = GreatPersonPickerScreen()
|
||||||
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
|
|
||||||
viewingCiv.popupAlerts.any() -> AlertPopup(this, viewingCiv.popupAlerts.first())
|
viewingCiv.popupAlerts.any() -> AlertPopup(this, viewingCiv.popupAlerts.first())
|
||||||
|
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateNextTurnButton()
|
updateNextTurnButton()
|
||||||
@ -366,9 +367,13 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(shouldAutoSave) {
|
if(shouldAutoSave) {
|
||||||
game.worldScreen.nextTurnButton.disable()
|
val newWorldScreen = game.worldScreen
|
||||||
|
newWorldScreen.waitingForAutosave = true
|
||||||
|
newWorldScreen.shouldUpdate = true
|
||||||
GameSaver().autoSave(gameInfoClone) {
|
GameSaver().autoSave(gameInfoClone) {
|
||||||
createNewWorldScreen() // only enable the user to next turn once we've saved the current one
|
// only enable the user to next turn once we've saved the current one
|
||||||
|
newWorldScreen.waitingForAutosave = false
|
||||||
|
newWorldScreen.shouldUpdate = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,7 +392,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
|||||||
nextTurnButton.setText(text.tr())
|
nextTurnButton.setText(text.tr())
|
||||||
nextTurnButton.color = if (text == "Next turn") Color.WHITE else Color.GRAY
|
nextTurnButton.color = if (text == "Next turn") Color.WHITE else Color.GRAY
|
||||||
nextTurnButton.pack()
|
nextTurnButton.pack()
|
||||||
if (alertPopupIsOpen || !isPlayersTurn) nextTurnButton.disable()
|
if (alertPopupIsOpen || !isPlayersTurn || waitingForAutosave) nextTurnButton.disable()
|
||||||
else nextTurnButton.enable()
|
else nextTurnButton.enable()
|
||||||
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f, topBar.y - nextTurnButton.height - 10f)
|
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f, topBar.y - nextTurnButton.height - 10f)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user