protected void triggerForwardAnimation(ResourceUrn screenUri) { // create and initialize now, open when the animation has finished triggerForwardAnimation(getManager().createScreen(screenUri)); }
private void openModuleDetailsScreen() { final ModuleDetailsScreen moduleDetailsScreen = getManager().createScreen(ModuleDetailsScreen.ASSET_URI, ModuleDetailsScreen.class); final Collection<Module> modules = gameModules.getList().stream() .map(ModuleSelectionInfo::getModule) .filter(Objects::nonNull) .collect(Collectors.toSet()); moduleDetailsScreen.setModules(modules); moduleDetailsScreen.setSelectedModule( modules.stream() .filter(module -> module.getId().equals(moduleInfoBinding.get().getModule().getId())) .findFirst() .orElse(null) ); getManager().pushScreen(moduleDetailsScreen); }
@Override public void onOpened() { super.onOpened(); if (!isScreenValid()) { final MessagePopup popup = getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class); popup.setMessage(translationSystem.translate("${engine:menu#game-details-errors-message-title}"), translationSystem.translate("${engine:menu#game-details-errors-message-body}")); popup.subscribeButton(e -> triggerBackAnimation()); getManager().pushScreen(popup); // disable child widgets setEnabled(false); } }
@Override public void onOpened() { super.onOpened(); if (isScreenValid()) { errors = new ArrayList<>(); loadGeneralInfo(); loadGameModules(); loadBiomes(); loadBlocks(); loadGameWorlds(); if (!errors.isEmpty()) { showErrors(); } tabs.select(0); showErrors.setEnabled(!errors.isEmpty()); } else { final MessagePopup popup = getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class); popup.setMessage(translationSystem.translate("${engine:menu#game-details-errors-message-title}"), translationSystem.translate("${engine:menu#game-details-errors-message-body}")); popup.subscribeButton(e -> triggerBackAnimation()); getManager().pushScreen(popup); // disable child widgets setEnabled(false); } }
@Override public void onOpened() { if (isValidScreen()) { refreshGameInfoList(GameProvider.getSavedRecordings()); } else { final MessagePopup popup = getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class); popup.setMessage(translationSystem.translate("${engine:menu#game-details-errors-message-title}"), translationSystem.translate("${engine:menu#game-details-errors-message-body}")); popup.subscribeButton(e -> triggerBackAnimation()); getManager().pushScreen(popup); // disable child widgets setEnabled(false); } }
@Override public void onOpened() { if (isValidScreen()) { refreshGameInfoList(GameProvider.getSavedGames()); } else { final MessagePopup popup = getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class); popup.setMessage(translationSystem.translate("${engine:menu#game-details-errors-message-title}"), translationSystem.translate("${engine:menu#game-details-errors-message-body}")); popup.subscribeButton(e -> triggerBackAnimation()); getManager().pushScreen(popup); // disable child widgets setEnabled(false); } }
@Override public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); RecordScreen recordScreen = getManager().createScreen(RecordScreen.ASSET_URI, RecordScreen.class); ReplayScreen replayScreen = getManager().createScreen(ReplayScreen.ASSET_URI, ReplayScreen.class); WidgetUtil.trySubscribe(this, "record", button -> { recordAndReplayCurrentStatus.setStatus(RecordAndReplayStatus.PREPARING_RECORD); RecordAndReplayUtils recordAndReplayUtils = engine.createChildContext().get(RecordAndReplayUtils.class); recordScreen.setRecordAndReplayUtils(recordAndReplayUtils); triggerForwardAnimation(recordScreen); }); WidgetUtil.trySubscribe(this, "replay", button -> { RecordAndReplayUtils recordAndReplayUtils = engine.createChildContext().get(RecordAndReplayUtils.class); replayScreen.setRecordAndReplayUtils(recordAndReplayUtils); recordAndReplayCurrentStatus.setStatus(RecordAndReplayStatus.PREPARING_REPLAY); triggerForwardAnimation(replayScreen); }); WidgetUtil.trySubscribe(this, "credits", button -> triggerForwardAnimation(CreditsScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "telemetry", button -> triggerForwardAnimation(TelemetryScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "crashReporter", widget -> CrashReporter.report(new Throwable("There is no error."), LoggingContext.getLoggingPath(), CrashReporter.MODE.ISSUE_REPORTER)); WidgetUtil.trySubscribe(this, "close", button -> triggerBackAnimation()); }
@Override public void onOpened() { super.onOpened(); if (isValidScreen()) { if (GameProvider.isSavesFolderEmpty()) { final NewGameScreen newGameScreen = getManager().createScreen(NewGameScreen.ASSET_URI, NewGameScreen.class); newGameScreen.setUniverseWrapper(universeWrapper); getManager().pushScreen(newGameScreen); } if (isLoadingAsServer() && !super.config.getPlayer().hasEnteredUsername()) { getManager().pushScreen(EnterUsernamePopup.ASSET_URI, EnterUsernamePopup.class); } refreshGameInfoList(GameProvider.getSavedGames()); } else { final MessagePopup popup = getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class); popup.setMessage(translationSystem.translate("${engine:menu#game-details-errors-message-title}"), translationSystem.translate("${engine:menu#game-details-errors-message-body}")); popup.subscribeButton(e -> triggerBackAnimation()); getManager().pushScreen(popup); // disable child widgets setEnabled(false); } }
}); StartPlayingScreen startPlayingScreen = getManager().createScreen(StartPlayingScreen.ASSET_URI, StartPlayingScreen.class); WidgetUtil.trySubscribe(this, "continue", button -> { startPlayingScreen.setTargetWorld(worldList, findWorldByName(selectedWorld), texture, context); }); WorldSetupScreen worldSetupScreen = getManager().createScreen(WorldSetupScreen.ASSET_URI, WorldSetupScreen.class); WidgetUtil.trySubscribe(this, "config", button -> { try {
final WorldSetupScreen worldSetupScreen = getManager().createScreen(WorldSetupScreen.ASSET_URI, WorldSetupScreen.class); try { if (!worlds.isEmpty() || !selectedWorld.isEmpty()) { final WorldPreGenerationScreen worldPreGenerationScreen = getManager().createScreen(WorldPreGenerationScreen.ASSET_URI, WorldPreGenerationScreen.class); if (!worlds.isEmpty()) { final WaitPopup<Boolean> loadPopup = getManager().pushScreen(WaitPopup.ASSET_URI, WaitPopup.class);
gameEngine.changeState(new StateLoading(gameManifest, (universeWrapper.getLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE)); } else { getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error", "Can't create new game!");
@Override public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); initWidgets(); if (isValidScreen()) { initSaveGamePathWidget(PathManager.getInstance().getSavesPath()); NameRecordingScreen nameRecordingScreen = getManager().createScreen(NameRecordingScreen.ASSET_URI, NameRecordingScreen.class); getGameInfos().subscribeSelection((widget, item) -> { load.setEnabled(item != null); updateDescription(item); }); getGameInfos().subscribe((widget, item) -> launchNamingScreen(nameRecordingScreen, item)); load.subscribe(button -> { final GameInfo gameInfo = getGameInfos().getSelection(); if (gameInfo != null) { launchNamingScreen(nameRecordingScreen, gameInfo); } }); close.subscribe(button -> { recordAndReplayCurrentStatus.setStatus(RecordAndReplayStatus.NOT_ACTIVATED); triggerBackAnimation(); }); } }
final ModuleDetailsScreen moduleDetailsScreen = getManager().createScreen(ModuleDetailsScreen.ASSET_URI, ModuleDetailsScreen.class); final Collection<Module> modules = sortedModules.stream() .map(ModuleSelectionInfo::getMetadata) final UniverseSetupScreen universeSetupScreen = getManager().createScreen(UniverseSetupScreen.ASSET_URI, UniverseSetupScreen.class); universeWrapper.setSeed(seed.getText()); saveConfiguration(); getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error", "Game seed cannot be empty!"); } else { universeWrapper.setSeed(seed.getText()); gameEngine.changeState(new StateLoading(gameManifest, (universeWrapper.getLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE)); } else { getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error", "Can't create new game!");
AdvancedGameSetupScreen advancedSetupGameScreen = getManager().createScreen(AdvancedGameSetupScreen.ASSET_URI, AdvancedGameSetupScreen.class); WidgetUtil.trySubscribe(this, "advancedSetup", button -> { universeWrapper.setGameName(gameName.getText()); gameEngine.changeState(new StateLoading(gameManifest, (isLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE)); } else { MessagePopup errorPopup = getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class); errorPopup.setMessage("Error", "Can't create new game!");
}); final NewGameScreen newGameScreen = getManager().createScreen(NewGameScreen.ASSET_URI, NewGameScreen.class); create.subscribe(e -> { newGameScreen.setUniverseWrapper(universeWrapper); final GameInfo gameInfo = getGameInfos().getSelection(); if (gameInfo != null) { final GameDetailsScreen detailsScreen = getManager().createScreen(GameDetailsScreen.ASSET_URI, GameDetailsScreen.class); detailsScreen.setGameInfo(gameInfo); detailsScreen.setPreviews(previewSlideshow.getImages());
jvmWarningLabel.setVisible(NonNativeJVMDetector.JVM_ARCH_IS_NONNATIVE); SelectGameScreen selectScreen = getManager().createScreen(SelectGameScreen.ASSET_URI, SelectGameScreen.class);