mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 17:28:57 +07:00
Fixed "units deselect after next turn" problem
Popup alerts now come before trade request popups
This commit is contained in:
@ -579,8 +579,8 @@
|
||||
"Orange", "Port Macquarie", "Port Pirie", "Boomahnoomoonah", "Tweed Heads"]
|
||||
///Unique unit: Digger (replaces Infantry, and has +10% Strenght against anti-cavalry units, +10% Strenght on coastal tiles)
|
||||
///Unique building: Outback Station (replaces Windmill, adds +1 Food)
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
name:"Nubia",
|
||||
leaderName:"Amanitore",
|
||||
adjective:["Nubian"],
|
||||
@ -995,7 +995,7 @@
|
||||
"Hillerod","Sonderborg","Skien","Svendborg","Holbaek","Hjorring","Fladstrand","Haderslev","Ringsted","Skrive"]
|
||||
},
|
||||
{
|
||||
name:"Philippines",
|
||||
name:"Philippines",
|
||||
leaderName:"Jose Rizal",
|
||||
adjective:["Filipinos"],
|
||||
startBias:["Coastal"],
|
||||
@ -1026,6 +1026,8 @@
|
||||
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",
|
||||
"Bataan","Angeles","Marikina"]
|
||||
},
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -1241,5 +1243,6 @@
|
||||
name:"Barbarians",
|
||||
outerColor:[0,0,0],
|
||||
innerColor:[182,0,0]
|
||||
}
|
||||
|
||||
]
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.unciv.logic.civilization
|
||||
|
||||
enum class AlertType{
|
||||
WarDeclaration,
|
||||
Defeated,
|
||||
WonderBuilt,
|
||||
WarDeclaration,
|
||||
FirstContact,
|
||||
CityConquered,
|
||||
BorderConflict,
|
||||
@ -10,7 +11,6 @@ enum class AlertType{
|
||||
CitiesSettledNearOtherCiv,
|
||||
DemandToStopSettlingCitiesNear,
|
||||
CitySettledNearOtherCivDespiteOurPromise,
|
||||
WonderBuilt
|
||||
}
|
||||
|
||||
class PopupAlert {
|
||||
|
@ -36,6 +36,7 @@ import kotlin.concurrent.thread
|
||||
class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
val gameInfo = game.gameInfo
|
||||
var isPlayersTurn = viewingCiv == gameInfo.currentPlayerCiv // todo this should be updated when passing turns
|
||||
var waitingForAutosave = false
|
||||
|
||||
val tileMapHolder: TileMapHolder = TileMapHolder(this, gameInfo.tileMap)
|
||||
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()
|
||||
viewingCiv.policies.freePolicies > 0 -> game.screen = PolicyPickerScreen(this)
|
||||
viewingCiv.greatPeople.freeGreatPeople > 0 -> game.screen = GreatPersonPickerScreen()
|
||||
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
|
||||
viewingCiv.popupAlerts.any() -> AlertPopup(this, viewingCiv.popupAlerts.first())
|
||||
viewingCiv.tradeRequests.isNotEmpty() -> TradePopup(this)
|
||||
}
|
||||
}
|
||||
updateNextTurnButton()
|
||||
@ -366,9 +367,13 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
}
|
||||
|
||||
if(shouldAutoSave) {
|
||||
game.worldScreen.nextTurnButton.disable()
|
||||
val newWorldScreen = game.worldScreen
|
||||
newWorldScreen.waitingForAutosave = true
|
||||
newWorldScreen.shouldUpdate = true
|
||||
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.color = if (text == "Next turn") Color.WHITE else Color.GRAY
|
||||
nextTurnButton.pack()
|
||||
if (alertPopupIsOpen || !isPlayersTurn) nextTurnButton.disable()
|
||||
if (alertPopupIsOpen || !isPlayersTurn || waitingForAutosave) nextTurnButton.disable()
|
||||
else nextTurnButton.enable()
|
||||
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f, topBar.y - nextTurnButton.height - 10f)
|
||||
}
|
||||
|
Reference in New Issue
Block a user