From 17b30696680de2ab5487acce872e6d11e3cea470 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 5 Sep 2019 21:50:33 +0300 Subject: [PATCH] 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