mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
CityButton: render units in front (#784)
* CityButton: render units in front * First click on single button: move down. Second click: open city screen.
This commit is contained in:
parent
4a97d3ea18
commit
db6e2faff8
@ -41,17 +41,16 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
|
|||||||
touchable = Touchable.enabled
|
touchable = Touchable.enabled
|
||||||
label.touchable = Touchable.enabled
|
label.touchable = Touchable.enabled
|
||||||
|
|
||||||
// clicking on the button swings the button a little down to allow selection of units there.
|
// clicking swings the button a little down to allow selection of units there.
|
||||||
// this also allows to target selected units to move to the city tile from elsewhere.
|
// this also allows to target selected units to move to the city tile from elsewhere.
|
||||||
// second tap on the button will go to the city screen
|
// second tap on the button will go to the city screen
|
||||||
onClick {
|
onClick {
|
||||||
if (!isButtonMoved) {
|
if (isButtonMoved) {
|
||||||
moveButtonDown()
|
|
||||||
if (unitTable.selectedUnit == null || unitTable.selectedUnit!!.currentMovement == 0f)
|
|
||||||
tileGroup.selectCity(city)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
UnCivGame.Current.screen = CityScreen(city)
|
UnCivGame.Current.screen = CityScreen(city)
|
||||||
|
} else {
|
||||||
|
moveButtonDown()
|
||||||
|
if (unitTable.selectedUnit == null || unitTable.selectedUnit!!.currentMovement==0f)
|
||||||
|
tileGroup.selectCity(city)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ class TileGroupMap<T: TileGroup>(val tileGroups:Collection<T>, padding:Float): G
|
|||||||
for(group in miscLayers) addActor(group)
|
for(group in miscLayers) addActor(group)
|
||||||
for(group in circleCrosshairFogLayers) addActor(group)
|
for(group in circleCrosshairFogLayers) addActor(group)
|
||||||
for(group in tileGroups) addActor(group) // The above layers are for the visual layers, this is for the clickability
|
for(group in tileGroups) addActor(group) // The above layers are for the visual layers, this is for the clickability
|
||||||
for(group in unitLayers) addActor(group) // Aaand units above everything else.
|
|
||||||
for(group in cityButtonLayers) addActor(group) // city buttons clickability
|
for(group in cityButtonLayers) addActor(group) // city buttons clickability
|
||||||
|
for(group in unitLayers) addActor(group) // Aaand units above everything else.
|
||||||
|
|
||||||
|
|
||||||
// there are tiles "below the zero",
|
// there are tiles "below the zero",
|
||||||
|
@ -181,18 +181,14 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
|
|||||||
|
|
||||||
fun citySelected(cityInfo: CityInfo) : Boolean {
|
fun citySelected(cityInfo: CityInfo) : Boolean {
|
||||||
if (cityInfo == selectedCity) return false
|
if (cityInfo == selectedCity) return false
|
||||||
lastSelectedCityButton = true
|
|
||||||
selectedCity = cityInfo
|
selectedCity = cityInfo
|
||||||
selectedUnit = null
|
selectedUnit = null
|
||||||
selectedUnitHasChanged = true
|
selectedUnitHasChanged = true
|
||||||
|
worldScreen.shouldUpdate = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun tileSelected(selectedTile: TileInfo) {
|
fun tileSelected(selectedTile: TileInfo) {
|
||||||
if (lastSelectedCityButton) {
|
|
||||||
lastSelectedCityButton = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val previouslySelectedUnit = selectedUnit
|
val previouslySelectedUnit = selectedUnit
|
||||||
if(currentlyExecutingAction=="moveTo"){
|
if(currentlyExecutingAction=="moveTo"){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user