mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 07:17:50 +07:00
Separated battle table height from the height of the tile and unit tables
This commit is contained in:
@ -21,8 +21,8 @@ android {
|
||||
applicationId "com.unciv.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 203
|
||||
versionName "2.13.3"
|
||||
versionCode 204
|
||||
versionName "2.13.4"
|
||||
}
|
||||
|
||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||
|
@ -22,6 +22,7 @@ import com.unciv.ui.pickerscreens.TechButton
|
||||
import com.unciv.ui.pickerscreens.TechPickerScreen
|
||||
import com.unciv.ui.trade.DiplomacyScreen
|
||||
import com.unciv.ui.utils.*
|
||||
import com.unciv.ui.worldscreen.bottombar.BattleTable
|
||||
import com.unciv.ui.worldscreen.bottombar.WorldScreenBottomBar
|
||||
import com.unciv.ui.worldscreen.optionstable.PopupTable
|
||||
import com.unciv.ui.worldscreen.unit.UnitActionsTable
|
||||
@ -35,6 +36,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
|
||||
private val topBar = WorldScreenTopBar(this)
|
||||
val bottomBar = WorldScreenBottomBar(this)
|
||||
val battleTable = BattleTable(this)
|
||||
val unitActionsTable = UnitActionsTable(this)
|
||||
|
||||
private val techButton = Table()
|
||||
@ -74,6 +76,11 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
|
||||
bottomBar.width = stage.width
|
||||
stage.addActor(bottomBar)
|
||||
|
||||
battleTable.width = stage.width/3
|
||||
battleTable.x = stage.width/3
|
||||
stage.addActor(battleTable)
|
||||
|
||||
stage.addActor(unitActionsTable)
|
||||
|
||||
displayTutorials("NewGame")
|
||||
@ -139,6 +146,8 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
updateDiplomacyButton(cloneCivilization)
|
||||
|
||||
bottomBar.update(tileMapHolder.selectedTile) // has to come before tilemapholder update because the tilemapholder actions depend on the selected unit!
|
||||
battleTable.update()
|
||||
|
||||
minimapWrapper.update(cloneCivilization)
|
||||
minimapWrapper.y = bottomBar.height // couldn't be bothered to create a separate val for minimap wrapper
|
||||
|
||||
|
@ -24,6 +24,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
||||
|
||||
fun hide(){
|
||||
clear()
|
||||
pack()
|
||||
}
|
||||
|
||||
fun update() {
|
||||
@ -35,6 +36,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
||||
} else if (unitTable.selectedCity != null) {
|
||||
attacker = CityCombatant(unitTable.selectedCity!!)
|
||||
} else {
|
||||
hide()
|
||||
return // no attacker
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.unciv.ui.worldscreen.bottombar
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.utils.Align
|
||||
@ -10,9 +11,9 @@ import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.toLabel
|
||||
import com.unciv.ui.worldscreen.WorldScreen
|
||||
|
||||
class TileInfoTable(private val worldScreen: WorldScreen) : Table() {
|
||||
class TileInfoTable(private val worldScreen: WorldScreen) : Table(CameraStageBaseScreen.skin) {
|
||||
init{
|
||||
skin = CameraStageBaseScreen.skin
|
||||
background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
||||
}
|
||||
|
||||
internal fun updateTileTable(tile: TileInfo) {
|
||||
@ -42,5 +43,4 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table() {
|
||||
}
|
||||
return table
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +1,26 @@
|
||||
package com.unciv.ui.worldscreen.bottombar
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.worldscreen.WorldScreen
|
||||
import com.unciv.ui.worldscreen.unit.UnitTable
|
||||
|
||||
class WorldScreenBottomBar(val worldScreen: WorldScreen) : Table(){
|
||||
val unitTable = UnitTable(worldScreen)
|
||||
val battleTable = BattleTable(worldScreen)
|
||||
val tileInfoTable = TileInfoTable(worldScreen)
|
||||
|
||||
init {
|
||||
touchable= Touchable.enabled
|
||||
add(unitTable).width(worldScreen.stage.width/3).fill()
|
||||
add(battleTable).width(worldScreen.stage.width/3).fill() // so that background fills entire middle third
|
||||
add().width(worldScreen.stage.width/3) // empty space for the battle table
|
||||
add(tileInfoTable).width(worldScreen.stage.width/3).fill()
|
||||
|
||||
val tileTableBackground = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
||||
tileTableBackground.minHeight = 0f
|
||||
tileTableBackground.minWidth = 0f
|
||||
background = tileTableBackground
|
||||
|
||||
pack()
|
||||
}
|
||||
|
||||
fun update(selectedTile: TileInfo?){
|
||||
unitTable.update()
|
||||
battleTable.update()
|
||||
if(selectedTile!=null) tileInfoTable.updateTileTable(selectedTile)
|
||||
pack()
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
|
||||
|
||||
init {
|
||||
pad(5f)
|
||||
background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
||||
|
||||
add(Table().apply {
|
||||
add(prevIdleUnitButton)
|
||||
|
Reference in New Issue
Block a user