mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
add restart dialog on World selectbox
This commit is contained in:
@@ -37,7 +37,7 @@ public class SettingsScene extends UIScene {
|
||||
|
||||
SelectBox<String> selectSourcePlane;
|
||||
TextField newPlaneName;
|
||||
Dialog createNewPlane, copyPlane, errorDialog;
|
||||
Dialog createNewPlane, copyPlane, errorDialog, restartDialog;
|
||||
|
||||
private void copyNewPlane() {
|
||||
String plane = selectSourcePlane.getSelected();
|
||||
@@ -98,16 +98,20 @@ public class SettingsScene extends UIScene {
|
||||
super(Forge.isLandscapeMode() ? "ui/settings.json" : "ui/settings_portrait.json");
|
||||
|
||||
settingGroup = new Table();
|
||||
//temporary disable custom world until it works correctly on each update
|
||||
selectSourcePlane = Controls.newComboBox();
|
||||
newPlaneName = Controls.newTextField("");
|
||||
|
||||
selectSourcePlane.setItems(Config.instance().getAllAdventures());
|
||||
SelectBox plane = Controls.newComboBox(Config.instance().getAllAdventures(), Config.instance().getSettingData().plane, o -> {
|
||||
Config.instance().getSettingData().plane = (String) o;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
});
|
||||
plane.addListener(new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent changeEvent, Actor actor) {
|
||||
restartForge();
|
||||
}
|
||||
});
|
||||
/*newPlane = Controls.newTextButton("Create own plane");
|
||||
newPlane.addListener(new ClickListener() {
|
||||
@Override
|
||||
@@ -115,9 +119,9 @@ public class SettingsScene extends UIScene {
|
||||
createNewPlane();
|
||||
}
|
||||
});*/
|
||||
addLabel(Forge.getLocalizer().getMessage("lblWorld"));
|
||||
addLabel(Forge.getLocalizer().getMessage("lblWorld") + " (" + Forge.getLocalizer().getMessage("lblRestartRequired") + ")");
|
||||
settingGroup.add(plane).align(Align.right).pad(2);
|
||||
addLabel(Forge.getLocalizer().getMessage("lblCreate") + Forge.getLocalizer().getMessage("lblWorld"));
|
||||
//addLabel(Forge.getLocalizer().getMessage("lblCreate") + Forge.getLocalizer().getMessage("lblWorld"));
|
||||
settingGroup.add(newPlane).align(Align.right).pad(2);
|
||||
|
||||
if (!GuiBase.isAndroid()) {
|
||||
@@ -370,6 +374,18 @@ public class SettingsScene extends UIScene {
|
||||
settingGroup.add(label).align(Align.left).pad(2, 2, 2, 5).width(w).expand();
|
||||
}
|
||||
|
||||
private void restartForge() {
|
||||
if (restartDialog == null) {
|
||||
restartDialog = createGenericDialog("",
|
||||
Forge.getLocalizer().getMessage("lblAreYouSureYouWishRestartForge"),
|
||||
Forge.getLocalizer().getMessage("lblOK"),
|
||||
Forge.getLocalizer().getMessage("lblAbort"), () -> {
|
||||
Forge.restart(true);
|
||||
removeDialog();
|
||||
}, this::removeDialog);
|
||||
}
|
||||
showDialog(restartDialog);
|
||||
}
|
||||
|
||||
private static SettingsScene object;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user