mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 16:49:15 +07:00
Nicer menu table
This commit is contained in:
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 306
|
versionCode 307
|
||||||
versionName "3.1.4"
|
versionName "3.1.4-patch1"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.ui.worldscreen.optionstable
|
package com.unciv.ui.worldscreen.optionstable
|
||||||
|
|
||||||
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.Cell
|
import com.badlogic.gdx.scenes.scene2d.ui.Cell
|
||||||
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
|
||||||
@ -39,6 +40,14 @@ open class PopupTable(val screen: CameraStageBaseScreen): Table(CameraStageBaseS
|
|||||||
return add(button).apply { row() }
|
return add(button).apply { row() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addSquareButton(text:String, action:()->Unit): Cell<Table> {
|
||||||
|
val button = Table()
|
||||||
|
button.add(text.toLabel())
|
||||||
|
button.onClick(action)
|
||||||
|
button.touchable=Touchable.enabled
|
||||||
|
return add(button).apply { row() }
|
||||||
|
}
|
||||||
|
|
||||||
fun addCloseButton() = addButton("Close"){close()}
|
fun addCloseButton() = addButton("Close"){close()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import com.unciv.ui.mapeditor.MapEditorScreen
|
|||||||
import com.unciv.ui.newgamescreen.NewGameScreen
|
import com.unciv.ui.newgamescreen.NewGameScreen
|
||||||
import com.unciv.ui.saves.LoadGameScreen
|
import com.unciv.ui.saves.LoadGameScreen
|
||||||
import com.unciv.ui.saves.SaveGameScreen
|
import com.unciv.ui.saves.SaveGameScreen
|
||||||
|
import com.unciv.ui.utils.addSeparator
|
||||||
import com.unciv.ui.utils.disable
|
import com.unciv.ui.utils.disable
|
||||||
import com.unciv.ui.utils.setFontColor
|
import com.unciv.ui.utils.setFontColor
|
||||||
import com.unciv.ui.utils.toLabel
|
import com.unciv.ui.utils.toLabel
|
||||||
@ -21,7 +22,9 @@ import kotlin.collections.ArrayList
|
|||||||
class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScreen) {
|
class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScreen) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
addButton("Map editor".tr()){
|
val width = 200f
|
||||||
|
val height = 30f
|
||||||
|
addSquareButton("Map editor".tr()){
|
||||||
val tileMapClone = worldScreen.gameInfo.tileMap.clone()
|
val tileMapClone = worldScreen.gameInfo.tileMap.clone()
|
||||||
for(tile in tileMapClone.values){
|
for(tile in tileMapClone.values){
|
||||||
tile.militaryUnit=null
|
tile.militaryUnit=null
|
||||||
@ -34,46 +37,58 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree
|
|||||||
}
|
}
|
||||||
UnCivGame.Current.screen = MapEditorScreen(tileMapClone)
|
UnCivGame.Current.screen = MapEditorScreen(tileMapClone)
|
||||||
remove()
|
remove()
|
||||||
}
|
}.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addButton("Civilopedia".tr()){
|
addSquareButton("Civilopedia".tr()){
|
||||||
UnCivGame.Current.screen = CivilopediaScreen()
|
UnCivGame.Current.screen = CivilopediaScreen()
|
||||||
remove()
|
remove()
|
||||||
}
|
}.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addButton("Load game".tr()){
|
addSquareButton("Load game".tr()){
|
||||||
UnCivGame.Current.screen = LoadGameScreen()
|
UnCivGame.Current.screen = LoadGameScreen()
|
||||||
remove()
|
remove()
|
||||||
}
|
}.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addButton("Save game".tr()) {
|
addSquareButton("Save game".tr()) {
|
||||||
UnCivGame.Current.screen = SaveGameScreen()
|
UnCivGame.Current.screen = SaveGameScreen()
|
||||||
remove()
|
remove()
|
||||||
}
|
}.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addButton("Start new game".tr()){ UnCivGame.Current.screen = NewGameScreen() }
|
addSquareButton("Start new game".tr()){ UnCivGame.Current.screen = NewGameScreen() }.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
|
|
||||||
addButton("Multiplayer".tr()) { openMultiplayerPopup() }
|
addSquareButton("Multiplayer".tr()) { openMultiplayerPopup() }.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addButton("Victory status".tr()) { UnCivGame.Current.screen = VictoryScreen() }
|
addSquareButton("Victory status".tr()) { UnCivGame.Current.screen = VictoryScreen() }.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addButton("Options".tr()){
|
addSquareButton("Options".tr()){
|
||||||
UnCivGame.Current.worldScreen.stage.addActor(WorldScreenOptionsTable(worldScreen))
|
UnCivGame.Current.worldScreen.stage.addActor(WorldScreenOptionsTable(worldScreen))
|
||||||
remove()
|
remove()
|
||||||
}
|
}.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addButton("Community"){
|
addSquareButton("Community"){
|
||||||
WorldScreenCommunityTable(worldScreen)
|
WorldScreenCommunityTable(worldScreen)
|
||||||
remove()
|
remove()
|
||||||
}
|
}.size(width,height)
|
||||||
|
addSeparator()
|
||||||
|
|
||||||
addCloseButton()
|
addSquareButton("Close"){
|
||||||
|
close()
|
||||||
|
}.size(width,height)
|
||||||
|
|
||||||
open()
|
open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun openMultiplayerPopup(){
|
fun openMultiplayerPopup(){
|
||||||
|
|
||||||
close()
|
close()
|
||||||
|
Reference in New Issue
Block a user