Changed main menu buttons to the default color scheme, renamed MenuScreen to MainMenuScreen

This commit is contained in:
Yair Morgenstern 2020-04-23 20:16:14 +03:00
parent c890895f39
commit c0b1788d96
6 changed files with 14 additions and 29 deletions

View file

@ -4,11 +4,8 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.actions.Actions
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable
import com.badlogic.gdx.utils.Align
import com.unciv.logic.GameSaver
import com.unciv.logic.GameStarter
import com.unciv.logic.map.MapGenerator
@ -17,9 +14,7 @@ import com.unciv.logic.map.MapSize
import com.unciv.logic.map.MapType
import com.unciv.models.metadata.GameParameters
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.translations.tr
import com.unciv.ui.MultiplayerScreen
import com.unciv.ui.map.TileGroupMap
import com.unciv.ui.mapeditor.EditorMapHolder
import com.unciv.ui.mapeditor.LoadMapScreen
import com.unciv.ui.mapeditor.MapEditorScreen
@ -27,17 +22,15 @@ import com.unciv.ui.mapeditor.NewMapScreen
import com.unciv.ui.newgamescreen.NewGameScreen
import com.unciv.ui.saves.LoadGameScreen
import com.unciv.ui.utils.*
import com.unciv.ui.worldscreen.WorldMapHolder
import kotlin.concurrent.thread
import kotlin.concurrent.timer
class MenuScreen: CameraStageBaseScreen() {
class MainMenuScreen: CameraStageBaseScreen() {
val autosave = "Autosave"
val backgroundTable = Table().apply { background=ImageGetter.getBackground(Color.WHITE) }
private fun getTableBlock(text: String, icon: String, function: () -> Unit): Table {
val table = Table().pad(30f)
table.background = ImageGetter.getBackground(colorFromRGB(11, 135, 133))
table.background = ImageGetter.getBackground(ImageGetter.getBlue())
table.add(ImageGetter.getImage(icon)).size(50f).padRight(30f)
table.add(text.toLabel().setFontSize(30).apply { /* setAlignment(Align.center) */ }).width(200f)
table.touchable= Touchable.enabled
@ -62,7 +55,7 @@ class MenuScreen: CameraStageBaseScreen() {
addTiles(30f)
touchable = Touchable.disabled
setScale(1f)
center(this@MenuScreen.stage)
center(this@MainMenuScreen.stage)
layout()
}
backgroundTable.add(mapHolder).size(stage.width, stage.height)
@ -126,7 +119,7 @@ class MenuScreen: CameraStageBaseScreen() {
val loadMapScreen = LoadMapScreen(null)
loadMapScreen.closeButton.isVisible = true
loadMapScreen.closeButton.onClick {
game.setScreen(MenuScreen())
game.setScreen(MainMenuScreen())
loadMapScreen.dispose()
}
game.setScreen(loadMapScreen)

View file

@ -90,7 +90,7 @@ class UncivGame(
if (settings.isFreshlyCreated) {
setScreen(LanguagePickerScreen())
} else { setScreen(MenuScreen()) }
} else { setScreen(MainMenuScreen()) }
isInitialized = true
}
}
@ -147,7 +147,7 @@ class UncivGame(
if (!isInitialized) return // The stuff from Create() is still happening, so the main screen will load eventually
ImageGetter.refreshAtlas()
setScreen(MenuScreen())
setScreen(MainMenuScreen())
}
// Maybe this will solve the resume error on chrome OS, issue 322? Worth a shot

View file

@ -3,7 +3,7 @@ package com.unciv.ui
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.MenuScreen
import com.unciv.MainMenuScreen
import com.unciv.UncivGame
import com.unciv.models.translations.tr
import com.unciv.ui.pickerscreens.PickerScreen
@ -81,7 +81,7 @@ class LanguagePickerScreen(): PickerScreen(){
game.translations.tryReadTranslationForCurrentLanguage()
resetFonts()
game.setScreen(MenuScreen())
game.setScreen(MainMenuScreen())
dispose()
}
}

View file

@ -1,16 +1,14 @@
package com.unciv.ui.mapeditor
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.badlogic.gdx.scenes.scene2d.ui.TextField
import com.badlogic.gdx.utils.Json
import com.unciv.Constants
import com.unciv.MenuScreen
import com.unciv.MainMenuScreen
import com.unciv.UncivGame
import com.unciv.logic.MapSaver
import com.unciv.logic.map.MapType
import com.unciv.logic.map.RoadStatus
import com.unciv.models.translations.tr
import com.unciv.ui.saves.Gzip
import com.unciv.ui.utils.*
import com.unciv.ui.worldscreen.mainmenu.DropBox
@ -116,7 +114,7 @@ class MapEditorMenuPopup(mapEditorScreen: MapEditorScreen): Popup(mapEditorScree
val exitMapEditorButton = "Exit map editor".toTextButton()
add(exitMapEditorButton ).row()
exitMapEditorButton.onClick { mapEditorScreen.game.setScreen(MenuScreen()); mapEditorScreen.dispose() }
exitMapEditorButton.onClick { mapEditorScreen.game.setScreen(MainMenuScreen()); mapEditorScreen.dispose() }
val closeOptionsButton = Constants.close.toTextButton()
closeOptionsButton.onClick { close() }

View file

@ -3,7 +3,7 @@ package com.unciv.ui.mapeditor
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.MenuScreen
import com.unciv.MainMenuScreen
import com.unciv.UncivGame
import com.unciv.logic.map.MapGenerator
import com.unciv.logic.map.MapParameters
@ -22,7 +22,7 @@ class NewMapScreen : PickerScreen() {
private var generatedMap: TileMap? = null
init {
setDefaultCloseAction(MenuScreen())
setDefaultCloseAction(MainMenuScreen())
val newMapScreenOptionsTable = Table(skin).apply {
pad(10f)

View file

@ -2,19 +2,13 @@ package com.unciv.ui.worldscreen.mainmenu
import com.badlogic.gdx.Gdx
import com.unciv.Constants
import com.unciv.MenuScreen
import com.unciv.UncivGame
import com.unciv.MainMenuScreen
import com.unciv.models.translations.tr
import com.unciv.ui.CivilopediaScreen
import com.unciv.ui.MultiplayerScreen
import com.unciv.ui.mapeditor.LoadMapScreen
import com.unciv.ui.mapeditor.NewMapScreen
import com.unciv.ui.newgamescreen.NewGameScreen
import com.unciv.ui.saves.LoadGameScreen
import com.unciv.ui.saves.SaveGameScreen
import com.unciv.ui.utils.Popup
import com.unciv.ui.utils.addSeparator
import com.unciv.ui.utils.onClick
import com.unciv.ui.victoryscreen.VictoryScreen
import com.unciv.ui.worldscreen.WorldScreen
@ -24,7 +18,7 @@ class WorldScreenMenuPopup(val worldScreen: WorldScreen) : Popup(worldScreen) {
val width = 200f
val height = 30f
addSquareButton("Main menu".tr()){
worldScreen.game.setScreen(MenuScreen())
worldScreen.game.setScreen(MainMenuScreen())
close()
}.size(width,height)
addSeparator()