mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 07:17: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)
|
||||
// todo - add notification for attacking civ
|
||||
destroy()
|
||||
} else {
|
||||
civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, Color.RED)
|
||||
}
|
||||
} else civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, Color.RED)
|
||||
}
|
||||
}
|
||||
|
||||
fun matchesCategory(category:String): Boolean {
|
||||
if (category == type.name)
|
||||
return true
|
||||
if (category == name)
|
||||
return true
|
||||
|
||||
if ((category == "Wounded" || category == "wounded units") && health < 100)
|
||||
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
|
||||
if (category == type.name) return true
|
||||
if (category == name) return true
|
||||
if ((category == "Wounded" || category == "wounded units") && health < 100) 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
|
||||
}
|
||||
|
@ -51,24 +51,27 @@ class MapEditorMenuPopup(var mapEditorScreen: MapEditorScreen): Popup(mapEditorS
|
||||
|
||||
private fun Popup.addClearCurrentMapButton() {
|
||||
val clearCurrentMapButton = "Clear current map".toTextButton()
|
||||
|
||||
clearCurrentMapButton.onClick {
|
||||
for (tileGroup in mapEditorScreen.mapHolder.tileGroups.values) {
|
||||
val tile = tileGroup.tileInfo
|
||||
tile.baseTerrain = Constants.ocean
|
||||
tile.terrainFeature = null
|
||||
tile.naturalWonder = null
|
||||
tile.hasBottomRiver=false
|
||||
tile.hasBottomLeftRiver=false
|
||||
tile.hasBottomRightRiver=false
|
||||
tile.resource = null
|
||||
tile.improvement = null
|
||||
tile.improvementInProgress = null
|
||||
tile.roadStatus = RoadStatus.None
|
||||
YesNoPopup("Are you sure you want to clear the entire map?", {
|
||||
for (tileGroup in mapEditorScreen.mapHolder.tileGroups.values) {
|
||||
val tile = tileGroup.tileInfo
|
||||
tile.baseTerrain = Constants.ocean
|
||||
tile.terrainFeature = null
|
||||
tile.naturalWonder = null
|
||||
tile.hasBottomRiver = false
|
||||
tile.hasBottomLeftRiver = false
|
||||
tile.hasBottomRightRiver = false
|
||||
tile.resource = null
|
||||
tile.improvement = null
|
||||
tile.improvementInProgress = null
|
||||
tile.roadStatus = RoadStatus.None
|
||||
|
||||
tile.setTransients()
|
||||
tile.setTransients()
|
||||
|
||||
tileGroup.update()
|
||||
}
|
||||
tileGroup.update()
|
||||
}
|
||||
}, mapEditorScreen).open()
|
||||
}
|
||||
add(clearCurrentMapButton).row()
|
||||
}
|
||||
|
Reference in New Issue
Block a user