mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-07 00:41:39 +07:00
Construction table: ordering change (Civ 5) + add/remove on double-click (#8163)
Co-authored-by: tunerzinc@gmail.com <vfylfhby>
This commit is contained in:
@ -264,9 +264,9 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
|
|||||||
clear()
|
clear()
|
||||||
defaults().left().bottom()
|
defaults().left().bottom()
|
||||||
addCategory("Units", units, maxButtonWidth)
|
addCategory("Units", units, maxButtonWidth)
|
||||||
|
addCategory("Buildings", buildableBuildings, maxButtonWidth)
|
||||||
addCategory("Wonders", buildableWonders, maxButtonWidth)
|
addCategory("Wonders", buildableWonders, maxButtonWidth)
|
||||||
addCategory("National Wonders", buildableNationalWonders, maxButtonWidth)
|
addCategory("National Wonders", buildableNationalWonders, maxButtonWidth)
|
||||||
addCategory("Buildings", buildableBuildings, maxButtonWidth)
|
|
||||||
addCategory("Other", specialConstructions, maxButtonWidth)
|
addCategory("Other", specialConstructions, maxButtonWidth)
|
||||||
pack()
|
pack()
|
||||||
}
|
}
|
||||||
@ -322,8 +322,14 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
|
|||||||
|
|
||||||
table.touchable = Touchable.enabled
|
table.touchable = Touchable.enabled
|
||||||
table.onClick {
|
table.onClick {
|
||||||
cityScreen.selectConstruction(constructionName)
|
if (selectedQueueEntry == constructionQueueIndex) {
|
||||||
selectedQueueEntry = constructionQueueIndex
|
city.cityConstructions.removeFromQueue(constructionQueueIndex, false)
|
||||||
|
selectedQueueEntry = -1
|
||||||
|
cityScreen.clearSelection()
|
||||||
|
} else {
|
||||||
|
cityScreen.selectConstruction(constructionName)
|
||||||
|
selectedQueueEntry = constructionQueueIndex
|
||||||
|
}
|
||||||
cityScreen.update()
|
cityScreen.update()
|
||||||
}
|
}
|
||||||
return table
|
return table
|
||||||
@ -381,7 +387,11 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
|
|||||||
.colspan(pickConstructionButton.columns).fillX().left().padTop(2f)
|
.colspan(pickConstructionButton.columns).fillX().left().padTop(2f)
|
||||||
}
|
}
|
||||||
pickConstructionButton.onClick {
|
pickConstructionButton.onClick {
|
||||||
cityScreen.selectConstruction(construction)
|
if (cityScreen.selectedConstruction == construction) {
|
||||||
|
addConstructionToQueue(construction, cityScreen.city.cityConstructions)
|
||||||
|
} else {
|
||||||
|
cityScreen.selectConstruction(construction)
|
||||||
|
}
|
||||||
selectedQueueEntry = -1
|
selectedQueueEntry = -1
|
||||||
cityScreen.update()
|
cityScreen.update()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user