From d3a6417996905701cb49eac28a1e8b69f4e70619 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 5 Sep 2019 21:45:04 +0300 Subject: [PATCH 1/6] Can no longer pick policies in multiplayer when it's someone elses turn --- .../Translations/Diplomacy,Trade,Nations.json | 2 +- android/build.gradle | 4 ++-- .../ui/pickerscreens/PolicyPickerScreen.kt | 22 ++++++++++--------- .../com/unciv/ui/worldscreen/WorldScreen.kt | 6 ++--- .../optionstable/WorldScreenMenuTable.kt | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json b/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json index ad973b2419..e5c0641f9a 100644 --- a/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json +++ b/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json @@ -1111,7 +1111,7 @@ Italian:"67% di probabilità di ottenere 25 Oro e reclutare un'unità barbara da un accampamento catturato. -25% mantenimento delle unità terrestri." French:"67% de chance de gagner 25 or et d'enroler une unité barbare lors de la prise d'un campement barbare. -25% de coût de maintenance pour les unités terrestres." Simplified_Chinese:"击败蛮族营地中的蛮族单位有67%几率得到25金钱并使其加入,陆上单位维护费-25%" - Russian:"Шанс 67% получить 25 Золото и варварский юнит из захваченного лагеря. -25% к стоимости содержания наземных юнитов. + Russian:"Шанс 67% получить 25 Золото и варварский юнит из захваченного лагеря. -25% к стоимости содержания наземных юнитов." } "India":{ diff --git a/android/build.gradle b/android/build.gradle index 9796b8b98f..873d6946ca 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 29 - versionCode 294 - versionName "3.0.1" + versionCode 295 + versionName "3.0.2" } // Had to add this crap for Travis to build, it wanted to sign the app diff --git a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt index 2acba0a31a..57a119a52b 100644 --- a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt @@ -10,14 +10,15 @@ import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.Policy import com.unciv.models.gamebasics.tr import com.unciv.ui.utils.* +import com.unciv.ui.worldscreen.WorldScreen -class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() { - +class PolicyPickerScreen(val worldScreen: WorldScreen) : PickerScreen() { + internal val viewingCiv: CivilizationInfo = worldScreen.viewingCiv private var pickedPolicy: Policy? = null init { - val policies = civInfo.policies + val policies = viewingCiv.policies displayTutorials("PolicyPickerScreen") rightSideButton.setText("{Adopt policy}\r\n(".tr() + policies.storedCulture + "/" + policies.getCultureNeededForNextPolicy() + ")") @@ -30,14 +31,14 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen( else onBackButtonClicked { UnCivGame.Current.setWorldScreen() } rightSideButton.onClick("policy") { - civInfo.policies.adopt(pickedPolicy!!) + viewingCiv.policies.adopt(pickedPolicy!!) // If we've moved to another screen in the meantime (great person pick, victory screen) ignore this if(game.screen !is PolicyPickerScreen || !policies.canAdoptPolicy()){ game.setWorldScreen() dispose() } - else game.screen = PolicyPickerScreen(civInfo) // update policies + else game.screen = PolicyPickerScreen(worldScreen) // update policies } if(!UnCivGame.Current.worldScreen.isPlayersTurn) rightSideButton.disable() @@ -78,10 +79,11 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen( } private fun pickPolicy(policy: Policy) { - if (civInfo.policies.isAdopted(policy.name) + if (!worldScreen.isPlayersTurn + || viewingCiv.policies.isAdopted(policy.name) || policy.name.endsWith("Complete") - || !civInfo.policies.isAdoptable(policy) - || !civInfo.policies.canAdoptPolicy()) { + || !viewingCiv.policies.isAdoptable(policy) + || !viewingCiv.policies.canAdoptPolicy()) { rightSideButton.disable() } else { rightSideButton.enable() @@ -106,9 +108,9 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen( policyButton = TextButton(policy.name.tr(), skin) } - if (civInfo.policies.isAdopted(policy.name)) { // existing + if (viewingCiv.policies.isAdopted(policy.name)) { // existing policyButton.color = Color.GREEN - } else if (!civInfo.policies.isAdoptable(policy)) + } else if (!viewingCiv.policies.isAdoptable(policy)) // non-available { policyButton.color = Color.GRAY diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index e0978de4e3..f1c976b633 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -75,7 +75,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { if(viewingCiv.policies.adoptedPolicies.isNotEmpty() || viewingCiv.policies.canAdoptPolicy()) { val policyScreenButton = Button(skin) policyScreenButton.add(ImageGetter.getImage("PolicyIcons/Constitution")).size(30f).pad(15f) - policyScreenButton.onClick { game.screen = PolicyPickerScreen(viewingCiv) } + policyScreenButton.onClick { game.screen = PolicyPickerScreen(this) } techPolicyandVictoryHolder.add(policyScreenButton).pad(10f) } @@ -186,7 +186,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { if(!isSomethingOpen) { when { !gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.screen = VictoryScreen() - viewingCiv.policies.freePolicies > 0 -> game.screen = PolicyPickerScreen(viewingCiv) + 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()) @@ -298,7 +298,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { game.screen = TechPickerScreen(viewingCiv.tech.freeTechs != 0, viewingCiv) return@onClick } else if (viewingCiv.policies.shouldOpenPolicyPicker) { - game.screen = PolicyPickerScreen(viewingCiv) + game.screen = PolicyPickerScreen(this) viewingCiv.policies.shouldOpenPolicyPicker = false return@onClick } diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt index c840f95f66..10a60bbf2c 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenMenuTable.kt @@ -105,7 +105,7 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree return@addButton } try { - val game = OnlineMultiplayer().tryDownloadGame(gameId) + val game = OnlineMultiplayer().tryDownloadGame(gameId.trim()) UnCivGame.Current.loadGame(game) } catch (ex: Exception) { badGameIdLabel.setText("Could not download game!".tr()) From 17b30696680de2ab5487acce872e6d11e3cea470 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 5 Sep 2019 21:50:33 +0300 Subject: [PATCH 2/6] Added confirmation popup when deleting maps --- .../NewGame,SaveGame,LoadGame,Options.json | 16 +++++++++++++++- core/src/com/unciv/ui/saves/LoadMapScreen.kt | 9 ++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json index a7b8cf90ba..27f11f8654 100644 --- a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json +++ b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json @@ -458,7 +458,21 @@ Portuguese:"Salvo em" } - // Options + ////////////// Load map + + "Load map":{ + } + + "Are you sure you want to delete this map?":{ + } + + "Upload":{ + } + + "Could not upload map!":{ + } + + ////////////// Options "Options":{ Italian:"Opzioni" diff --git a/core/src/com/unciv/ui/saves/LoadMapScreen.kt b/core/src/com/unciv/ui/saves/LoadMapScreen.kt index b95c91bf28..43cc48c77b 100644 --- a/core/src/com/unciv/ui/saves/LoadMapScreen.kt +++ b/core/src/com/unciv/ui/saves/LoadMapScreen.kt @@ -14,13 +14,14 @@ import com.unciv.ui.pickerscreens.PickerScreen import com.unciv.ui.utils.disable import com.unciv.ui.utils.enable import com.unciv.ui.utils.onClick +import com.unciv.ui.worldscreen.optionstable.YesNoPopupTable class LoadMapScreen(previousMap: TileMap) : PickerScreen(){ var chosenMap = "" val deleteMapButton = TextButton("Delete map",skin) init { - rightSideButton.setText("Load map") + rightSideButton.setText("Load map".tr()) rightSideButton.onClick { UnCivGame.Current.screen = MapEditorScreen(chosenMap) dispose() @@ -50,8 +51,10 @@ class LoadMapScreen(previousMap: TileMap) : PickerScreen(){ rightSideTable.add(loadFromClipboardButton).row() deleteMapButton.onClick { - MapSaver().deleteMap(chosenMap) - UnCivGame.Current.screen = LoadMapScreen(previousMap) + YesNoPopupTable("Are you sure you want to delete this map?", { + MapSaver().deleteMap(chosenMap) + UnCivGame.Current.screen = LoadMapScreen(previousMap) + }, this) } deleteMapButton.disable() deleteMapButton.color = Color.RED From 587c76b1f802d6b0847b154294eb89d7d484c6d0 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 5 Sep 2019 23:20:16 +0300 Subject: [PATCH 3/6] Added Show Minimap setting option --- core/src/com/unciv/models/metadata/GameSettings.kt | 1 + core/src/com/unciv/ui/worldscreen/Minimap.kt | 5 ++++- .../ui/worldscreen/optionstable/WorldScreenOptionsTable.kt | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/models/metadata/GameSettings.kt b/core/src/com/unciv/models/metadata/GameSettings.kt index f85393ac7f..16cefafd5c 100644 --- a/core/src/com/unciv/models/metadata/GameSettings.kt +++ b/core/src/com/unciv/models/metadata/GameSettings.kt @@ -17,6 +17,7 @@ class GameSettings { var tileSet:String = "FantasyHex" var showTutorials: Boolean = true var autoAssignCityProduction: Boolean = true + var showMinimap: Boolean = true var userName:String="" var userId = "" diff --git a/core/src/com/unciv/ui/worldscreen/Minimap.kt b/core/src/com/unciv/ui/worldscreen/Minimap.kt index 8166e37099..d3e0825a14 100644 --- a/core/src/com/unciv/ui/worldscreen/Minimap.kt +++ b/core/src/com/unciv/ui/worldscreen/Minimap.kt @@ -137,5 +137,8 @@ class MinimapHolder(tileMapHolder: TileMapHolder): Table(){ return toggleIconTable } - fun update(civInfo:CivilizationInfo){minimap.update(civInfo)} + fun update(civInfo:CivilizationInfo){ + isVisible = UnCivGame.Current.settings.showMinimap + minimap.update(civInfo) + } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt index 8c9f51fc16..c5bc155c8b 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt @@ -80,6 +80,12 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr update() } + innerTable.add("Show minimap".toLabel()) + innerTable.addButton(if(settings.showMinimap) "Yes".tr() else "No".tr()) { + settings.showMinimap= !settings.showMinimap + update() + } + addLanguageSelectBox(innerTable) addFontSelectBox(innerTable) From b945b49248c3f352ca7fa72f9ce58451b28a4d07 Mon Sep 17 00:00:00 2001 From: Smashfanful <41149920+Smashfanful@users.noreply.github.com> Date: Fri, 6 Sep 2019 14:08:50 +0200 Subject: [PATCH 4/6] Update Units,Promotions.json (#1021) * Update Units,Promotions.json * Update Units,Promotions.json Correction for Hwacha to Hwach'a --- android/assets/jsons/Translations/Units,Promotions.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/assets/jsons/Translations/Units,Promotions.json b/android/assets/jsons/Translations/Units,Promotions.json index 886c1ac90e..5132018bde 100644 --- a/android/assets/jsons/Translations/Units,Promotions.json +++ b/android/assets/jsons/Translations/Units,Promotions.json @@ -560,7 +560,8 @@ German:"Tribock" } - "Hwach'a":{ + "Hwach'a":{ + Italian:"Hwach'a" Simplified_Chinese:"火厢车" } @@ -668,6 +669,10 @@ Russian:"+1 Диапазон видимости" } + "Turtle Ship":{ + Spanish:"Nave tartaruga" + } + "Cannon":{ Italian:"Cannone" Russian:"Пушка" From c8c9daf8201ac88c13b053d57a719742b0a18335 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 6 Sep 2019 15:56:28 +0300 Subject: [PATCH 5/6] Added Icon source legal considerations --- docs/NewCivs.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/NewCivs.md b/docs/NewCivs.md index b210c265b4..788b95fe19 100644 --- a/docs/NewCivs.md +++ b/docs/NewCivs.md @@ -2,7 +2,7 @@ So you want to add your favorite civilization? -There are a few steps requires, so we'll walk you through them! +There are a few steps required, so we'll walk you through them! ## Fill in your Nation info @@ -19,7 +19,7 @@ will notify translators that they should translate them =) Each civ has an icon, like the wreath for Rome, for instant identification. -All of these icons are white on a transparent background, and are 100x100 pixels. +All of these icons are white on a transparent background, and are 100x100 pixels - see [icon considerations](#icon-considerations) for details You'll need to put your icon in the [NationIcons folder](/android/Images/NationIcons). @@ -35,7 +35,7 @@ But apart from the flavor, they are boring gameplay-wise, so now we need to add Units in general are added in the [Units.json](/android/assets/jsons/Units.json) file, with an icon in the [UnitIcons](/android/Images/UnitIcons) folder. -The icon must be 200x200 pixels, white on transparent background. +The icon must be 200x200 pixels, white on transparent background - see [icon considerations](#icon-considerations) for details Remember that these are unique units, so search for an existing unique unit to see how they replace their regular counterparts! @@ -45,7 +45,7 @@ Again, [translation file](/android/assets/jsons/Translations/Units%2CPromotions. Same as the units - info is in the [Buildings.json](/android/assets/jsons/Buildings.json) file and icons in the [BuildingIcons](/android/Images/BuildingIcons) folder, -same rules for the icons apply. +same rules for the icons apply (200x200 pixels, icon considerations) Again, [translation file](/android/assets/jsons/Translations/Buildings.json) for bonus points! @@ -53,3 +53,13 @@ Again, [translation file](/android/assets/jsons/Translations/Buildings.json) for All Civ uniques require touching actual code - you can try it if ou feel you're up to it, but if not, send me an email to yairm210@hotmail.com (if you've finished all of the above) and I'll be happy to lend you a hand! + +## Icon considerations + +ALL icons must be legally acceptable, meaning they either come from from open sources or you act according to their licence (for Creative Commons, for instance, you have to specify the source and the creator). + +Icons directly from the base game belong to Firaxis, so I'm not sure we're legally allowed to use them - please use other sources! + +One source I use constantly is [The Noun Project](https://thenounproject.com) - everything there is Creative Commons or open, so they can all be used! + +Credits for icons should go in the [Credits](Credits.md) page From df2be377855f1dd78c9aa6998cc955b70d97b29a Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 6 Sep 2019 16:20:45 +0300 Subject: [PATCH 6/6] Added show/hide button for tile panel in map editor Fixed unit unique translations in Civilopedia --- .../unciv/models/gamebasics/unit/BaseUnit.kt | 2 +- core/src/com/unciv/ui/EmpireOverviewScreen.kt | 2 +- .../com/unciv/ui/mapeditor/MapEditorScreen.kt | 22 ++++++++++++++++--- .../ui/mapeditor/TileEditorOptionsTable.kt | 2 -- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt index 39e1b8556f..928ce3bff5 100644 --- a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt @@ -75,7 +75,7 @@ class BaseUnit : INamed, IConstruction, ICivilopedia { } for(unique in uniques) - sb.appendln(unique.tr()) + sb.appendln(Translations.translateBonusOrPenalty(unique)) for(promotion in promotions) sb.appendln(promotion.tr()) diff --git a/core/src/com/unciv/ui/EmpireOverviewScreen.kt b/core/src/com/unciv/ui/EmpireOverviewScreen.kt index c7672ea31b..759e05c262 100644 --- a/core/src/com/unciv/ui/EmpireOverviewScreen.kt +++ b/core/src/com/unciv/ui/EmpireOverviewScreen.kt @@ -414,7 +414,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){ civGroup.add(ImageGetter.getImage("OtherIcons/DisbandUnit")).size(30f) civGroup.background = civGroupBackground.tint(Color.LIGHT_GRAY) label.setFontColor(Color.BLACK) - } else if (currentPlayer==civ || currentPlayer.knows(civ)) { + } else if (currentPlayer==civ || UnCivGame.Current.viewEntireMapForDebug || currentPlayer.knows(civ)) { civGroup.add(ImageGetter.getNationIndicator(civ.nation, 30f)) civGroup.background = civGroupBackground.tint(civ.nation.getColor()) label.setFontColor(civ.nation.getSecondaryColor()) diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt index 9a1e1e0ccd..6069a1f8af 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt @@ -1,11 +1,12 @@ package com.unciv.ui.mapeditor +import com.badlogic.gdx.scenes.scene2d.actions.Actions import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.ui.TextButton -import com.unciv.models.metadata.GameParameters import com.unciv.logic.MapSaver import com.unciv.logic.map.TileMap import com.unciv.models.gamebasics.tr +import com.unciv.models.metadata.GameParameters import com.unciv.ui.tilegroups.TileGroup import com.unciv.ui.tilegroups.TileSetStrings import com.unciv.ui.utils.CameraStageBaseScreen @@ -18,7 +19,7 @@ class MapEditorScreen(): CameraStageBaseScreen(){ var mapName = "My first map" lateinit var mapHolder: TileGroupMap val tileEditorOptions = TileEditorOptionsTable(this) - + val showHideEditorOptionsButton = TextButton(">",skin) constructor(mapNameToLoad:String?):this(){ var mapToLoad = mapNameToLoad @@ -44,8 +45,23 @@ class MapEditorScreen(): CameraStageBaseScreen(){ val mapHolder = getMapHolder(tileMap) stage.addActor(mapHolder) - stage.addActor(tileEditorOptions) + tileEditorOptions.setPosition(stage.width - tileEditorOptions.width, 0f) + + showHideEditorOptionsButton.labelCell.pad(10f) + showHideEditorOptionsButton.pack() + showHideEditorOptionsButton.onClick { + if (showHideEditorOptionsButton.text.toString() == ">") { + tileEditorOptions.addAction(Actions.moveTo(stage.width, 0f, 0.5f)) + showHideEditorOptionsButton.setText("<") + } else { + tileEditorOptions.addAction(Actions.moveTo(stage.width - tileEditorOptions.width, 0f, 0.5f)) + showHideEditorOptionsButton.setText(">") + } + } + showHideEditorOptionsButton.setPosition(stage.width - showHideEditorOptionsButton.width - 10f, + stage.height - showHideEditorOptionsButton.height - 10f) + stage.addActor(showHideEditorOptionsButton) val optionsMenuButton = TextButton("Options".tr(), skin) diff --git a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt index 29e709859a..a47029bcc5 100644 --- a/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt +++ b/core/src/com/unciv/ui/mapeditor/TileEditorOptionsTable.kt @@ -56,8 +56,6 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera add(ScrollPane(tabPickerTable).apply { this.width= mapEditorScreen.stage.width/3}).row() add(editorPickTable).row() - - setPosition(mapEditorScreen.stage.width - width, 0f) } private fun setImprovements() {