titlescreen continue/load wont appear if there are no savegames available

This commit is contained in:
minjaesong
2021-09-14 20:07:27 +09:00
parent 6c1df609a9
commit 0683561d88
3 changed files with 32 additions and 33 deletions

View File

@@ -366,6 +366,7 @@ public class App implements ApplicationListener {
CommonResourcePool.INSTANCE.addToLoadingList("blockmarkings_common", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16, 0, 0, 0, 0, false));
CommonResourcePool.INSTANCE.addToLoadingList("blockmarking_actor", () -> new BlockMarkerActor());
CommonResourcePool.INSTANCE.addToLoadingList("loading_circle_64", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/loading_circle_64.tga"), 64, 64, 0, 0, 0, 0, false));
newTempFile("wenquanyi.tga"); // temp file required by the font

View File

@@ -189,7 +189,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
uiContainer.add(uiFakeBlurOverlay)
uiMenu = UIRemoCon(this, UITitleRemoConYaml())//UITitleRemoConRoot()
uiMenu = UIRemoCon(this, UITitleRemoConYaml(App.savegames.isNotEmpty()))
uiMenu.setPosition(0, 0)
uiMenu.setAsOpen()

View File

@@ -1,6 +1,5 @@
package net.torvald.terrarum.modulebasegame.ui
import net.torvald.terrarum.App
import net.torvald.terrarum.Yaml
@@ -12,38 +11,37 @@ object UITitleRemoConYaml {
*
* The class must be the UICanvas
*/
val menus = """
- MENU_LABEL_CONTINUE : net.torvald.terrarum.modulebasegame.ui.UIProxyLoadLatestSave
- MENU_LABEL_NEW_GAME : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
- MENU_IO_LOAD : net.torvald.terrarum.modulebasegame.ui.UILoadDemoSavefiles
- MENU_LABEL_RETURN
- MENU_OPTIONS
- MENU_OPTIONS_GRAPHICS
- MENU_OPTIONS_CONTROLS
- MENU_CONTROLS_KEYBOARD
- MENU_CONTROLS_GAMEPAD
- MENU_LABEL_RETURN
- MENU_OPTIONS_SOUND
- MENU_LABEL_LANGUAGE : net.torvald.terrarum.modulebasegame.ui.UITitleLanguage
- MENU_MODULES : net.torvald.terrarum.ModOptionsHost
- MENU_LABEL_RETURN
- MENU_LABEL_CREDITS : net.torvald.terrarum.modulebasegame.ui.UITitleCredits
- MENU_LABEL_CREDITS : net.torvald.terrarum.modulebasegame.ui.UITitleCredits
- MENU_CREDIT_GPL_DNT : net.torvald.terrarum.modulebasegame.ui.UITitleGPL3
- MENU_LABEL_RETURN
- MENU_LABEL_QUIT
""".trimIndent()
private val menuBase = """
- MENU_OPTIONS
- MENU_OPTIONS_GRAPHICS
- MENU_OPTIONS_CONTROLS
- MENU_CONTROLS_KEYBOARD
- MENU_CONTROLS_GAMEPAD
- MENU_LABEL_RETURN
- MENU_OPTIONS_SOUND
- MENU_LABEL_LANGUAGE : net.torvald.terrarum.modulebasegame.ui.UITitleLanguage
- MENU_MODULES : net.torvald.terrarum.ModOptionsHost
- MENU_LABEL_RETURN
- MENU_LABEL_CREDITS : net.torvald.terrarum.modulebasegame.ui.UITitleCredits
- MENU_LABEL_CREDITS : net.torvald.terrarum.modulebasegame.ui.UITitleCredits
- MENU_CREDIT_GPL_DNT : net.torvald.terrarum.modulebasegame.ui.UITitleGPL3
- MENU_LABEL_RETURN
- MENU_LABEL_QUIT
"""
val debugTools = "" /*"""
- Development Tools $
- Building Maker : net.torvald.terrarum.modulebasegame.ui.UIProxyNewBuildingMaker
- Start New Random Game : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
- MENU_LABEL_RETURN
""".trimIndent()*/
private val menuWithSavefile = """
- MENU_LABEL_CONTINUE : net.torvald.terrarum.modulebasegame.ui.UIProxyLoadLatestSave
- MENU_LABEL_NEW_GAME : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
- MENU_IO_LOAD : net.torvald.terrarum.modulebasegame.ui.UILoadDemoSavefiles
- MENU_LABEL_RETURN
"""
operator fun invoke() = if (App.IS_DEVELOPMENT_BUILD)
Yaml(menus + "\n" + debugTools).parse()
else
Yaml(menus).parse()
private val menuNewGame = """
- MENU_LABEL_NEW_GAME : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
"""
operator fun invoke(hasSave: Boolean) =
Yaml((if (hasSave) menuWithSavefile else menuNewGame) + menuBase).parse()
}