First scene after the splash screen
| 26 | * First scene after the splash screen |
| 27 | */ |
| 28 | public class StartScene extends UIScene { |
| 29 | private static StartScene object; |
| 30 | Dialog exitDialog, backupDialog, zipDialog, unzipDialog; |
| 31 | TextraButton saveButton, resumeButton, continueButton; |
| 32 | TypingLabel version = Controls.newTypingLabel("{GRADIENT}[%80]v." + Forge.getDeviceAdapter().getVersionString() + "{ENDGRADIENT}"); |
| 33 | |
| 34 | |
| 35 | public StartScene() { |
| 36 | super(Forge.isLandscapeMode() ? "ui/start_menu.json" : "ui/start_menu_portrait.json"); |
| 37 | ui.onButtonPress("Start", StartScene.this::NewGame); |
| 38 | ui.onButtonPress("Start+", this::NewGamePlus); |
| 39 | ui.onButtonPress("Load", StartScene.this::Load); |
| 40 | ui.onButtonPress("Save", StartScene.this::Save); |
| 41 | ui.onButtonPress("Resume", StartScene.this::Resume); |
| 42 | ui.onButtonPress("Continue", StartScene.this::Continue); |
| 43 | ui.onButtonPress("Settings", StartScene.this::settings); |
| 44 | ui.onButtonPress("Backup", StartScene.this::backup); |
| 45 | ui.onButtonPress("Exit", StartScene.this::Exit); |
| 46 | ui.onButtonPress("Switch", StartScene.this::switchToClassic); |
| 47 | |
| 48 | |
| 49 | saveButton = ui.findActor("Save"); |
| 50 | resumeButton = ui.findActor("Resume"); |
| 51 | continueButton = ui.findActor("Continue"); |
| 52 | |
| 53 | saveButton.setVisible(false); |
| 54 | resumeButton.setVisible(false); |
| 55 | version.setHeight(5); |
| 56 | version.skipToTheEnd(); |
| 57 | ui.addActor(version); |
| 58 | } |
| 59 | |
| 60 | public static StartScene instance() { |
| 61 | if (object == null) |
| 62 | object = new StartScene(); |
| 63 | return object; |
| 64 | } |
| 65 | |
| 66 | public boolean NewGame() { |
| 67 | Forge.switchScene(NewGameScene.instance()); |
| 68 | return true; |
| 69 | } |
| 70 | |
| 71 | public boolean Save() { |
| 72 | if (TileMapScene.instance().currentMap().isInMap()) { |
| 73 | Dialog noSave = createGenericDialog("", Forge.getLocalizer().getMessage("lblGameNotSaved"), Forge.getLocalizer().getMessage("lblOK"),null, null, null); |
| 74 | showDialog(noSave); |
| 75 | } else { |
| 76 | SaveLoadScene.instance().setMode(SaveLoadScene.Modes.Save); |
| 77 | Forge.switchScene(SaveLoadScene.instance()); |
| 78 | } |
| 79 | return true; |
| 80 | } |
| 81 | |
| 82 | public boolean Load() { |
| 83 | SaveLoadScene.instance().setMode(SaveLoadScene.Modes.Load); |
| 84 | Forge.switchScene(SaveLoadScene.instance()); |
| 85 | return true; |
nothing calls this directly
no test coverage detected