diff --git a/android/assets/game.png b/android/assets/game.png index b5d3372c..2f1cf240 100644 Binary files a/android/assets/game.png and b/android/assets/game.png differ diff --git a/core/src/com/unciv/UnCivGame.kt b/core/src/com/unciv/UnCivGame.kt index 92605146..971f3f36 100644 --- a/core/src/com/unciv/UnCivGame.kt +++ b/core/src/com/unciv/UnCivGame.kt @@ -17,7 +17,7 @@ class UnCivGame(val version: String) : Game() { * This exists so that when debugging we can see the entire map. * Remember to turn this to false before commit and upload! */ - val viewEntireMapForDebug = true + val viewEntireMapForDebug = false // For when you need to test something in an advanced game and don't have time to faff around val superchargedForDebug = false diff --git a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt index 724f61db..06abeef4 100644 --- a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt @@ -28,7 +28,7 @@ class NextTurnAutomation{ automateUnits(civInfo) reassignWorkedTiles(civInfo) trainSettler(civInfo) - civInfo.diplomaticIncidents.clear() + civInfo.popupAlerts.clear() } private fun buyBuildingOrUnit(civInfo: CivilizationInfo) { diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 53efe5bb..f222bd96 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -4,8 +4,8 @@ import com.badlogic.gdx.graphics.Color import com.unciv.logic.GameInfo import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.city.CityInfo -import com.unciv.logic.civilization.diplomacy.DiplomaticIncident -import com.unciv.logic.civilization.diplomacy.DiplomaticIncidentType +import com.unciv.logic.civilization.AlertType +import com.unciv.logic.civilization.PopupAlert import com.unciv.logic.map.TileInfo import com.unciv.models.gamebasics.unit.UnitType import java.util.* @@ -194,7 +194,7 @@ class Battle(val gameInfo:GameInfo) { for(civ in gameInfo.civilizations) civ.addNotification("The civilization of [${enemyCiv.civName}] has been destroyed!", null, Color.RED) enemyCiv.getCivUnits().forEach { it.destroy() } - attacker.getCivInfo().diplomaticIncidents.add(DiplomaticIncident(enemyCiv.civName,DiplomaticIncidentType.Defeated)) + attacker.getCivInfo().popupAlerts.add(PopupAlert(AlertType.Defeated,enemyCiv.civName)) } else if(enemyCiv.cities.isNotEmpty()){ enemyCiv.cities.first().cityConstructions.addBuilding("Palace") // relocate palace diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 3c144015..27d522db 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -7,8 +7,6 @@ import com.unciv.UnCivGame import com.unciv.logic.GameInfo import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.diplomacy.DiplomacyManager -import com.unciv.logic.civilization.diplomacy.DiplomaticIncident -import com.unciv.logic.civilization.diplomacy.DiplomaticIncidentType import com.unciv.logic.civilization.diplomacy.DiplomaticStatus import com.unciv.logic.map.BFS import com.unciv.logic.map.MapUnit @@ -63,7 +61,7 @@ class CivilizationInfo { var victoryManager=VictoryManager() var diplomacy = HashMap() var notifications = ArrayList() - val diplomaticIncidents = ArrayList() + val popupAlerts = ArrayList() // if we only use lists, and change the list each time the cities are changed, // we won't get concurrent modification exceptions. @@ -296,12 +294,13 @@ class CivilizationInfo { fun meetCivilization(otherCiv: CivilizationInfo) { diplomacy[otherCiv.civName] = DiplomacyManager(this, otherCiv.civName) .apply { diplomaticStatus = DiplomaticStatus.Peace } - otherCiv.diplomaticIncidents.add(DiplomaticIncident(civName, DiplomaticIncidentType.FirstContact)) + + otherCiv.popupAlerts.add(PopupAlert(AlertType.FirstContact,civName)) otherCiv.diplomacy[civName] = DiplomacyManager(otherCiv, civName) .apply { diplomaticStatus = DiplomaticStatus.Peace } - diplomaticIncidents.add(DiplomaticIncident(otherCiv.civName, DiplomaticIncidentType.FirstContact)) + popupAlerts.add(PopupAlert(AlertType.FirstContact,otherCiv.civName)) } override fun toString(): String {return civName} // for debug diff --git a/core/src/com/unciv/logic/civilization/PopupAlert.kt b/core/src/com/unciv/logic/civilization/PopupAlert.kt new file mode 100644 index 00000000..014efc05 --- /dev/null +++ b/core/src/com/unciv/logic/civilization/PopupAlert.kt @@ -0,0 +1,9 @@ +package com.unciv.logic.civilization + +enum class AlertType{ + WarDeclaration, + Defeated, + FirstContact +} + +class PopupAlert (val type:AlertType, val value:String) diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index 042d8ad0..51761c6f 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -1,7 +1,9 @@ package com.unciv.logic.civilization.diplomacy import com.badlogic.gdx.graphics.Color +import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.CivilizationInfo +import com.unciv.logic.civilization.PopupAlert import com.unciv.logic.trade.Trade import com.unciv.logic.trade.TradeType import com.unciv.models.Counter @@ -97,9 +99,11 @@ class DiplomacyManager() { fun declareWar(){ diplomaticStatus = DiplomaticStatus.War - otherCiv().diplomacy[civInfo.civName]!!.diplomaticStatus = DiplomaticStatus.War - otherCiv().addNotification("[${civInfo.civName}] has declared war on us!",null, Color.RED) - otherCiv().diplomaticIncidents.add(DiplomaticIncident(civInfo.civName,DiplomaticIncidentType.WarDeclaration)) + val otherCiv = otherCiv() + + otherCiv.diplomacy[civInfo.civName]!!.diplomaticStatus = DiplomaticStatus.War + otherCiv.addNotification("[${civInfo.civName}] has declared war on us!",null, Color.RED) + otherCiv.popupAlerts.add(PopupAlert(AlertType.WarDeclaration,civInfo.civName)) } //endregion } \ No newline at end of file diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomaticIncident.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomaticIncident.kt deleted file mode 100644 index 23954f17..00000000 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomaticIncident.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.unciv.logic.civilization.diplomacy - -import com.unciv.logic.trade.Trade - -class DiplomaticIncident(val civName:String, val type: DiplomaticIncidentType, val trade: Trade?=null) \ No newline at end of file diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomaticIncidentType.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomaticIncidentType.kt deleted file mode 100644 index e1a0f60f..00000000 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomaticIncidentType.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.unciv.logic.civilization.diplomacy - -enum class DiplomaticIncidentType{ - WarDeclaration, - Defeated, - FirstContact -} \ No newline at end of file diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index e5fe495e..4f437cc4 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -8,9 +8,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.unciv.UnCivGame import com.unciv.logic.GameSaver +import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.CivilizationInfo -import com.unciv.logic.civilization.diplomacy.DiplomaticIncident -import com.unciv.logic.civilization.diplomacy.DiplomaticIncidentType +import com.unciv.logic.civilization.PopupAlert import com.unciv.logic.civilization.diplomacy.DiplomaticStatus import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tile.ResourceType @@ -171,8 +171,8 @@ class WorldScreen : CameraStageBaseScreen() { else if(currentPlayerCiv.greatPeople.freeGreatPeople>0) game.screen = GreatPersonPickerScreen() if(game.screen==this && !tutorials.isTutorialShowing - && currentPlayerCiv.diplomaticIncidents.any() && !DiplomaticIncidentPopup.isOpen){ - DiplomaticIncidentPopup(this,currentPlayerCiv.diplomaticIncidents.first()) + && currentPlayerCiv.popupAlerts.any() && !AlertPopup.isOpen){ + AlertPopup(this,currentPlayerCiv.popupAlerts.first()) } } @@ -329,7 +329,7 @@ class WorldScreen : CameraStageBaseScreen() { } -class DiplomaticIncidentPopup(val worldScreen: WorldScreen, val diplomaticIncident: DiplomaticIncident):PopupTable(worldScreen){ +class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert):PopupTable(worldScreen){ fun getCloseButton(text:String): TextButton { val button = TextButton(text.tr(), skin) button.onClick { close() } @@ -337,25 +337,25 @@ class DiplomaticIncidentPopup(val worldScreen: WorldScreen, val diplomaticIncide } init { - val otherCiv = worldScreen.gameInfo.getCivilization(diplomaticIncident.civName) + val otherCiv = worldScreen.gameInfo.getCivilization(popupAlert.value) val translatedNation = otherCiv.getTranslatedNation() val otherCivLeaderName = "[${translatedNation.leaderName}] of [${translatedNation.getNameTranslation()}]".tr() add(otherCivLeaderName.toLabel()) addSeparator() - when(diplomaticIncident.type){ - DiplomaticIncidentType.WarDeclaration -> { + when(popupAlert.type){ + AlertType.WarDeclaration -> { addGoodSizedLabel(translatedNation.declaringWar).row() val responseTable = Table() responseTable.add(getCloseButton("You'll pay for this!")) responseTable.add(getCloseButton("Very well.")) add(responseTable) } - DiplomaticIncidentType.Defeated -> { + AlertType.Defeated -> { addGoodSizedLabel(translatedNation.defeated).row() add(getCloseButton("Farewell.")) } - DiplomaticIncidentType.FirstContact -> { + AlertType.FirstContact -> { addGoodSizedLabel(translatedNation.introduction).row() add(getCloseButton("A pleasure to meet you.")) } @@ -365,7 +365,7 @@ class DiplomaticIncidentPopup(val worldScreen: WorldScreen, val diplomaticIncide } fun close(){ - worldScreen.currentPlayerCiv.diplomaticIncidents.remove(diplomaticIncident) + worldScreen.currentPlayerCiv.popupAlerts.remove(popupAlert) isOpen = false remove() }