Added confirmation popup when deleting maps
This commit is contained in:
parent
d3a6417996
commit
17b3069668
2 changed files with 21 additions and 4 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue