mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Added icon toggles to the world screen
This commit is contained in:
parent
68b64ca66f
commit
c4838f5fde
@ -1,7 +1,10 @@
|
|||||||
package com.unciv.ui.worldscreen.bottombar
|
package com.unciv.ui.worldscreen.bottombar
|
||||||
|
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
|
||||||
import com.badlogic.gdx.utils.Align
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.UnCivGame
|
import com.unciv.UnCivGame
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
@ -19,6 +22,7 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table() {
|
|||||||
val civInfo = worldScreen.civInfo
|
val civInfo = worldScreen.civInfo
|
||||||
columnDefaults(0).padRight(10f)
|
columnDefaults(0).padRight(10f)
|
||||||
|
|
||||||
|
add(getCheckboxTable())
|
||||||
if (civInfo.exploredTiles.contains(tile.position) || UnCivGame.Current.viewEntireMapForDebug) {
|
if (civInfo.exploredTiles.contains(tile.position) || UnCivGame.Current.viewEntireMapForDebug) {
|
||||||
add(getStatsTable(tile)).pad(10f)
|
add(getStatsTable(tile)).pad(10f)
|
||||||
add(Label(tile.toString(), skin)).colspan(2)
|
add(Label(tile.toString(), skin)).colspan(2)
|
||||||
@ -29,6 +33,35 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table() {
|
|||||||
setPosition(worldScreen.stage.width - 10f - width, 10f)
|
setPosition(worldScreen.stage.width - 10f - width, 10f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getCheckboxTable(): Table {
|
||||||
|
val settings = UnCivGame.Current.settings
|
||||||
|
val table=Table()
|
||||||
|
|
||||||
|
val populationCheckbox = CheckBox("",CameraStageBaseScreen.skin)
|
||||||
|
populationCheckbox.add(ImageGetter.getStatIcon("Population")).size(20f)
|
||||||
|
populationCheckbox.isChecked = settings.showWorkedTiles
|
||||||
|
populationCheckbox.addListener(object : ChangeListener(){
|
||||||
|
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||||
|
settings.showWorkedTiles = populationCheckbox.isChecked
|
||||||
|
worldScreen.update()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
table.add(populationCheckbox).row()
|
||||||
|
|
||||||
|
val resourceCheckbox = CheckBox("",CameraStageBaseScreen.skin)
|
||||||
|
resourceCheckbox.add(ImageGetter.getResourceImage("Cattle",20f))
|
||||||
|
resourceCheckbox.isChecked = settings.showResourcesAndImprovements
|
||||||
|
resourceCheckbox.addListener(object : ChangeListener(){
|
||||||
|
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||||
|
settings.showResourcesAndImprovements = resourceCheckbox.isChecked
|
||||||
|
worldScreen.update()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
table.add(resourceCheckbox).row()
|
||||||
|
|
||||||
|
return table
|
||||||
|
}
|
||||||
|
|
||||||
fun getStatsTable(tile: TileInfo):Table{
|
fun getStatsTable(tile: TileInfo):Table{
|
||||||
val table=Table()
|
val table=Table()
|
||||||
table.pad(10f)
|
table.pad(10f)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.ui.worldscreen.bottombar
|
package com.unciv.ui.worldscreen.bottombar
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
import com.unciv.ui.utils.ImageGetter
|
import com.unciv.ui.utils.ImageGetter
|
||||||
@ -13,7 +14,7 @@ class WorldScreenBottomBar(val worldScreen: WorldScreen) : Table(){
|
|||||||
val tileInfoTable = TileInfoTable(worldScreen)
|
val tileInfoTable = TileInfoTable(worldScreen)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
touchable= Touchable.enabled
|
||||||
add(unitTable).width(worldScreen.stage.width/3)
|
add(unitTable).width(worldScreen.stage.width/3)
|
||||||
add(battleTable).width(worldScreen.stage.width/3).fill() // so that background fills entire middle third
|
add(battleTable).width(worldScreen.stage.width/3).fill() // so that background fills entire middle third
|
||||||
add(tileInfoTable).width(worldScreen.stage.width/3).fill()
|
add(tileInfoTable).width(worldScreen.stage.width/3).fill()
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.unciv.ui.worldscreen.optionstable
|
package com.unciv.ui.worldscreen.optionstable
|
||||||
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener
|
||||||
import com.unciv.UnCivGame
|
import com.unciv.UnCivGame
|
||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||||
|
import com.unciv.ui.utils.ImageGetter
|
||||||
import com.unciv.ui.utils.center
|
import com.unciv.ui.utils.center
|
||||||
import com.unciv.ui.worldscreen.WorldScreen
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ class WorldScreenDisplayOptionsTable() : PopupTable(){
|
|||||||
addButton("{Hide} {resources and improvements}") { settings.showResourcesAndImprovements = false; update() }
|
addButton("{Hide} {resources and improvements}") { settings.showResourcesAndImprovements = false; update() }
|
||||||
else addButton("{Show} {resources and improvements}") { settings.showResourcesAndImprovements = true; update() }
|
else addButton("{Show} {resources and improvements}") { settings.showResourcesAndImprovements = true; update() }
|
||||||
|
|
||||||
|
|
||||||
val languageSelectBox = SelectBox<String>(CameraStageBaseScreen.skin)
|
val languageSelectBox = SelectBox<String>(CameraStageBaseScreen.skin)
|
||||||
val languageArray = com.badlogic.gdx.utils.Array<String>()
|
val languageArray = com.badlogic.gdx.utils.Array<String>()
|
||||||
GameBasics.Translations.getLanguages().forEach { languageArray.add(it) }
|
GameBasics.Translations.getLanguages().forEach { languageArray.add(it) }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user