mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-05 15:59:50 +07:00
Confirmation popup when clearing the map in the map editor
This commit is contained in:
@ -690,26 +690,17 @@ class MapUnit {
|
|||||||
civInfo.addNotification("An enemy [Citadel] has destroyed our [$name]", currentTile.position, Color.RED)
|
civInfo.addNotification("An enemy [Citadel] has destroyed our [$name]", currentTile.position, Color.RED)
|
||||||
// todo - add notification for attacking civ
|
// todo - add notification for attacking civ
|
||||||
destroy()
|
destroy()
|
||||||
} else {
|
} else civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, Color.RED)
|
||||||
civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, Color.RED)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun matchesCategory(category:String): Boolean {
|
fun matchesCategory(category:String): Boolean {
|
||||||
if (category == type.name)
|
if (category == type.name) return true
|
||||||
return true
|
if (category == name) return true
|
||||||
if (category == name)
|
if ((category == "Wounded" || category == "wounded units") && health < 100) return true
|
||||||
return true
|
if ((category == "Land" || category == "land units") && type.isLandUnit()) return true
|
||||||
|
if ((category == "Water" || category == "water units") && type.isWaterUnit()) return true
|
||||||
if ((category == "Wounded" || category == "wounded units") && health < 100)
|
if ((category == "Air" || category == "air units") && type.isAirUnit()) return true
|
||||||
return true
|
|
||||||
if ((category == "Land" || category == "land units") && type.isLandUnit())
|
|
||||||
return true
|
|
||||||
if ((category == "Water" || category == "water units") && type.isWaterUnit())
|
|
||||||
return true
|
|
||||||
if ((category == "Air" || category == "air units") && type.isAirUnit())
|
|
||||||
return true
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -51,15 +51,17 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS
|
|||||||
|
|
||||||
private fun Popup.addClearCurrentMapButton() {
|
private fun Popup.addClearCurrentMapButton() {
|
||||||
val clearCurrentMapButton = "Clear current map".toTextButton()
|
val clearCurrentMapButton = "Clear current map".toTextButton()
|
||||||
|
|
||||||
clearCurrentMapButton.onClick {
|
clearCurrentMapButton.onClick {
|
||||||
|
YesNoPopup("Are you sure you want to clear the entire map?", {
|
||||||
for (tileGroup in mapEditorScreen.mapHolder.tileGroups.values) {
|
for (tileGroup in mapEditorScreen.mapHolder.tileGroups.values) {
|
||||||
val tile = tileGroup.tileInfo
|
val tile = tileGroup.tileInfo
|
||||||
tile.baseTerrain = Constants.ocean
|
tile.baseTerrain = Constants.ocean
|
||||||
tile.terrainFeature = null
|
tile.terrainFeature = null
|
||||||
tile.naturalWonder = null
|
tile.naturalWonder = null
|
||||||
tile.hasBottomRiver=false
|
tile.hasBottomRiver = false
|
||||||
tile.hasBottomLeftRiver=false
|
tile.hasBottomLeftRiver = false
|
||||||
tile.hasBottomRightRiver=false
|
tile.hasBottomRightRiver = false
|
||||||
tile.resource = null
|
tile.resource = null
|
||||||
tile.improvement = null
|
tile.improvement = null
|
||||||
tile.improvementInProgress = null
|
tile.improvementInProgress = null
|
||||||
@ -69,6 +71,7 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS
|
|||||||
|
|
||||||
tileGroup.update()
|
tileGroup.update()
|
||||||
}
|
}
|
||||||
|
}, mapEditorScreen).open()
|
||||||
}
|
}
|
||||||
add(clearCurrentMapButton).row()
|
add(clearCurrentMapButton).row()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user