mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 14:57:58 +07:00
Add remove button for construction queue items (#2654)
This commit is contained in:
@ -206,6 +206,8 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
||||
table.add(getLowerPriorityButton(constructionQueueIndex, name, city)).right()
|
||||
else table.add().right()
|
||||
|
||||
table.add(getRemoveFromQueueButton(constructionQueueIndex, city)).right()
|
||||
|
||||
table.touchable = Touchable.enabled
|
||||
table.onClick {
|
||||
cityScreen.selectedConstruction = cityConstructions.getConstruction(name)
|
||||
@ -391,6 +393,21 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
||||
return tab
|
||||
}
|
||||
|
||||
private fun getRemoveFromQueueButton(constructionQueueIndex: Int, city: CityInfo): Table {
|
||||
val tab = Table()
|
||||
tab.add(ImageGetter.getImage("OtherIcons/Stop").surroundWithCircle(40f))
|
||||
if (UncivGame.Current.worldScreen.isPlayersTurn && !city.isPuppet) {
|
||||
tab.touchable = Touchable.enabled
|
||||
tab.onClick {
|
||||
tab.touchable = Touchable.disabled
|
||||
city.cityConstructions.removeFromQueue(constructionQueueIndex,false)
|
||||
cityScreen.selectedConstruction = null
|
||||
cityScreen.update()
|
||||
}
|
||||
}
|
||||
return tab
|
||||
}
|
||||
|
||||
private fun getHeader(title: String): Table {
|
||||
val headerTable = Table()
|
||||
headerTable.background = ImageGetter.getBackground(ImageGetter.getBlue())
|
||||
|
@ -149,7 +149,7 @@ object ImageGetter {
|
||||
fun getConstructionImage(construction: String): Image {
|
||||
if(ruleset.buildings.containsKey(construction)) return getImage("BuildingIcons/$construction")
|
||||
if(ruleset.units.containsKey(construction)) return getUnitIcon(construction)
|
||||
if(construction=="Nothing") return getImage("OtherIcons/Stop")
|
||||
if(construction=="Nothing") return getImage("OtherIcons/Sleep")
|
||||
return getStatIcon(construction)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user