mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
fix loading Arena, update remaining dialog
This commit is contained in:
@@ -100,10 +100,13 @@ public class ArenaScene extends UIScene implements IAfterMatch {
|
|||||||
|
|
||||||
private void showAreYouSure() {
|
private void showAreYouSure() {
|
||||||
if (concedeDialog == null) {
|
if (concedeDialog == null) {
|
||||||
concedeDialog = createGenericDialog(Forge.getLocalizer().getMessage("lblConcedeTitle"), "\n" + Forge.getLocalizer().getMessage("lblConcedeCurrentGame"), () -> {
|
concedeDialog = createGenericDialog(Forge.getLocalizer().getMessage("lblConcedeTitle"),
|
||||||
loose();
|
"\n" + Forge.getLocalizer().getMessage("lblConcedeCurrentGame"),
|
||||||
removeDialog();
|
Forge.getLocalizer().getMessage("lblYes"),
|
||||||
}, this::removeDialog);
|
Forge.getLocalizer().getMessage("lblNo"), () -> {
|
||||||
|
this.loose();
|
||||||
|
removeDialog();
|
||||||
|
}, this::removeDialog);
|
||||||
}
|
}
|
||||||
showDialog(concedeDialog);
|
showDialog(concedeDialog);
|
||||||
}
|
}
|
||||||
@@ -117,10 +120,12 @@ public class ArenaScene extends UIScene implements IAfterMatch {
|
|||||||
|
|
||||||
private void startDialog() {
|
private void startDialog() {
|
||||||
if (startDialog == null) {
|
if (startDialog == null) {
|
||||||
startDialog = createGenericDialog(Forge.getLocalizer().getMessage("lblStart"), Forge.getLocalizer().getMessage("lblStartArena"), () -> {
|
startDialog = createGenericDialog(Forge.getLocalizer().getMessage("lblStart"),
|
||||||
startArena();
|
Forge.getLocalizer().getMessage("lblStartArena"), Forge.getLocalizer().getMessage("lblYes"),
|
||||||
removeDialog();
|
Forge.getLocalizer().getMessage("lblNo"), () -> {
|
||||||
}, this::removeDialog);
|
this.startArena();
|
||||||
|
removeDialog();
|
||||||
|
}, this::removeDialog);
|
||||||
}
|
}
|
||||||
showDialog(startDialog);
|
showDialog(startDialog);
|
||||||
}
|
}
|
||||||
@@ -287,7 +292,9 @@ public class ArenaScene extends UIScene implements IAfterMatch {
|
|||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < numberOfEnemies; i++) {
|
for (int i = 0; i < numberOfEnemies; i++) {
|
||||||
EnemyData enemyData = WorldData.getEnemy(data.enemyPool[rand.nextInt(data.enemyPool.length)]);
|
EnemyData enemyData = null;
|
||||||
|
while (enemyData == null)
|
||||||
|
enemyData = WorldData.getEnemy(data.enemyPool[rand.nextInt(data.enemyPool.length)]);
|
||||||
EnemySprite enemy = new EnemySprite(enemyData);
|
EnemySprite enemy = new EnemySprite(enemyData);
|
||||||
enemies.add(enemy);
|
enemies.add(enemy);
|
||||||
fighters.add(new ArenaRecord(new Image(enemy.getAvatar()), enemyData.name));
|
fighters.add(new ArenaRecord(new Image(enemy.getAvatar()), enemyData.name));
|
||||||
@@ -295,7 +302,6 @@ public class ArenaScene extends UIScene implements IAfterMatch {
|
|||||||
fighters.add(new ArenaRecord(new Image(Current.player().avatar()), Current.player().getName()));
|
fighters.add(new ArenaRecord(new Image(Current.player().avatar()), Current.player().getName()));
|
||||||
player = fighters.get(fighters.size - 1).actor;
|
player = fighters.get(fighters.size - 1).actor;
|
||||||
|
|
||||||
|
|
||||||
goldLabel.setText(data.entryFee + " [+Gold]");
|
goldLabel.setText(data.entryFee + " [+Gold]");
|
||||||
goldLabel.layout();
|
goldLabel.layout();
|
||||||
goldLabel.setVisible(true);
|
goldLabel.setVisible(true);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class DeckSelectScene extends UIScene {
|
|||||||
TextraButton back, edit, rename;
|
TextraButton back, edit, rename;
|
||||||
int currentSlot = 0;
|
int currentSlot = 0;
|
||||||
ScrollPane scrollPane;
|
ScrollPane scrollPane;
|
||||||
|
Dialog renameDialog;
|
||||||
|
|
||||||
private static DeckSelectScene object;
|
private static DeckSelectScene object;
|
||||||
|
|
||||||
@@ -65,14 +66,20 @@ public class DeckSelectScene extends UIScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showRenameDialog() {
|
private void showRenameDialog() {
|
||||||
|
if (renameDialog == null) {
|
||||||
Dialog dialog = prepareDialog(Forge.getLocalizer().getMessage("lblRenameDeck"), ButtonOk | ButtonAbort, () -> DeckSelectScene.this.rename());
|
renameDialog = createGenericDialog(Forge.getLocalizer().getMessage("lblRenameDeck"), null,
|
||||||
dialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblNameYourSaveFile"))).colspan(2);
|
Forge.getLocalizer().getMessage("lblOk"),
|
||||||
dialog.getContentTable().row();
|
Forge.getLocalizer().getMessage("lblAbort"), () -> {
|
||||||
dialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblName") + ": ")).align(Align.left);
|
this.rename();
|
||||||
dialog.getContentTable().add(textInput).fillX().expandX();
|
removeDialog();
|
||||||
dialog.getContentTable().row();
|
}, this::removeDialog);
|
||||||
showDialog(dialog);
|
renameDialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblNewNameDeck"))).colspan(2);
|
||||||
|
renameDialog.getContentTable().row();
|
||||||
|
renameDialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblName") + ": ")).align(Align.left);
|
||||||
|
renameDialog.getContentTable().add(textInput).fillX().expandX();
|
||||||
|
renameDialog.getContentTable().row();
|
||||||
|
}
|
||||||
|
showDialog(renameDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextraButton addDeckSlot(String name, int i) {
|
private TextraButton addDeckSlot(String name, int i) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class InventoryScene extends UIScene {
|
|||||||
Button selected;
|
Button selected;
|
||||||
Button deleteButton;
|
Button deleteButton;
|
||||||
Texture equipOverlay;
|
Texture equipOverlay;
|
||||||
|
Dialog useDialog, deleteDialog;
|
||||||
int columns = 0;
|
int columns = 0;
|
||||||
|
|
||||||
public InventoryScene() {
|
public InventoryScene() {
|
||||||
@@ -102,9 +103,15 @@ public class InventoryScene extends UIScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showConfirm() {
|
private void showConfirm() {
|
||||||
Dialog confirm = prepareDialog("", ButtonYes | ButtonNo, () -> delete());
|
if (deleteDialog == null) {
|
||||||
confirm.text(Controls.newLabel(Forge.getLocalizer().getMessage("lblDelete")));
|
deleteDialog = createGenericDialog("", Forge.getLocalizer().getMessage("lblDelete"),
|
||||||
showDialog(confirm);
|
Forge.getLocalizer().getMessage("lblYes"),
|
||||||
|
Forge.getLocalizer().getMessage("lblNo"), () -> {
|
||||||
|
this.delete();
|
||||||
|
removeDialog();
|
||||||
|
}, this::removeDialog);
|
||||||
|
}
|
||||||
|
showDialog(deleteDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InventoryScene object;
|
private static InventoryScene object;
|
||||||
@@ -122,7 +129,6 @@ public class InventoryScene extends UIScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
|
|
||||||
ItemData data = ItemData.getItem(itemLocation.get(selected));
|
ItemData data = ItemData.getItem(itemLocation.get(selected));
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
Current.player().removeItem(data.name);
|
Current.player().removeItem(data.name);
|
||||||
@@ -156,9 +162,16 @@ public class InventoryScene extends UIScene {
|
|||||||
|
|
||||||
private void use() {
|
private void use() {
|
||||||
ItemData data = ItemData.getItem(itemLocation.get(selected));
|
ItemData data = ItemData.getItem(itemLocation.get(selected));
|
||||||
if (data == null) return;
|
if (data == null)
|
||||||
Dialog useDialog = prepareDialog("", ButtonYes | ButtonNo, () -> triggerUse());
|
return;
|
||||||
useDialog.getContentTable().add(Controls.newTextraLabel("Use " + data.name + "?\n" + data.getDescription()));
|
if (useDialog == null) {
|
||||||
|
useDialog = createGenericDialog("", null, Forge.getLocalizer().getMessage("lblYes"),
|
||||||
|
Forge.getLocalizer().getMessage("lblNo"), () -> {
|
||||||
|
this.triggerUse();
|
||||||
|
removeDialog();
|
||||||
|
}, this::removeDialog);
|
||||||
|
useDialog.getContentTable().add(Controls.newTextraLabel("Use " + data.name + "?\n" + data.getDescription()));
|
||||||
|
}
|
||||||
showDialog(useDialog);
|
showDialog(useDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package forge.adventure.scene;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.*;
|
import com.badlogic.gdx.scenes.scene2d.ui.*;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
@@ -45,14 +44,13 @@ public class SaveLoadScene extends UIScene {
|
|||||||
int currentSlot = 0, lastSelectedSlot = 0;
|
int currentSlot = 0, lastSelectedSlot = 0;
|
||||||
Image previewImage;
|
Image previewImage;
|
||||||
TextraLabel previewDate, playerLocation;
|
TextraLabel previewDate, playerLocation;
|
||||||
Image previewBorder;
|
|
||||||
TextraButton saveLoadButton, back;
|
TextraButton saveLoadButton, back;
|
||||||
Selectable<TextraButton> quickSave;
|
Selectable<TextraButton> quickSave;
|
||||||
Selectable<TextraButton> autoSave;
|
Selectable<TextraButton> autoSave;
|
||||||
Actor lastHighlightedSave;
|
|
||||||
SelectBox difficulty;
|
SelectBox difficulty;
|
||||||
ScrollPane scrollPane;
|
ScrollPane scrollPane;
|
||||||
char ASCII_179 = '│';
|
char ASCII_179 = '│';
|
||||||
|
Dialog saveDialog;
|
||||||
|
|
||||||
private SaveLoadScene() {
|
private SaveLoadScene() {
|
||||||
super(Forge.isLandscapeMode() ? "ui/save_load.json" : "ui/save_load_portrait.json");
|
super(Forge.isLandscapeMode() ? "ui/save_load.json" : "ui/save_load_portrait.json");
|
||||||
@@ -94,9 +92,9 @@ public class SaveLoadScene extends UIScene {
|
|||||||
|
|
||||||
saveLoadButton = ui.findActor("save");
|
saveLoadButton = ui.findActor("save");
|
||||||
saveLoadButton.setText(Forge.getLocalizer().getMessage("lblSave"));
|
saveLoadButton.setText(Forge.getLocalizer().getMessage("lblSave"));
|
||||||
ui.onButtonPress("save", () -> SaveLoadScene.this.loadSave());
|
ui.onButtonPress("save", SaveLoadScene.this::loadSave);
|
||||||
back = ui.findActor("return");
|
back = ui.findActor("return");
|
||||||
ui.onButtonPress("return", () -> SaveLoadScene.this.back());
|
ui.onButtonPress("return", SaveLoadScene.this::back);
|
||||||
difficulty.setSelectedIndex(1);
|
difficulty.setSelectedIndex(1);
|
||||||
difficulty.setAlignment(Align.center);
|
difficulty.setAlignment(Align.center);
|
||||||
difficulty.getStyle().fontColor = Color.GOLD;
|
difficulty.getStyle().fontColor = Color.GOLD;
|
||||||
@@ -201,16 +199,21 @@ public class SaveLoadScene extends UIScene {
|
|||||||
case Save:
|
case Save:
|
||||||
if (currentSlot > 0) {
|
if (currentSlot > 0) {
|
||||||
//prevent NPE, allowed saveslot is 1 to 10..
|
//prevent NPE, allowed saveslot is 1 to 10..
|
||||||
textInput.setText(buttons.get(currentSlot).actor.getText().toString());
|
textInput.setText(buttons.get(currentSlot).actor.getText());
|
||||||
|
if (saveDialog == null) {
|
||||||
Dialog dialog = prepareDialog(Forge.getLocalizer().getMessage("lblSave"), ButtonOk | ButtonAbort, () -> SaveLoadScene.this.save());
|
saveDialog = createGenericDialog(Forge.getLocalizer().getMessage("lblSave"), null,
|
||||||
|
Forge.getLocalizer().getMessage("lblOk"),
|
||||||
dialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblNameYourSaveFile"))).colspan(2).pad(2, 15, 2, 15);
|
Forge.getLocalizer().getMessage("lblAbort"), () -> {
|
||||||
dialog.getContentTable().row();
|
this.save();
|
||||||
dialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblName") + ": ")).align(Align.left).pad(2, 15, 2, 2);
|
removeDialog();
|
||||||
dialog.getContentTable().add(textInput).fillX().expandX().padRight(15);
|
}, this::removeDialog);
|
||||||
dialog.getContentTable().row();
|
saveDialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblNameYourSaveFile"))).colspan(2).pad(2, 15, 2, 15);
|
||||||
showDialog(dialog);
|
saveDialog.getContentTable().row();
|
||||||
|
saveDialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblName") + ": ")).align(Align.left).pad(2, 15, 2, 2);
|
||||||
|
saveDialog.getContentTable().add(textInput).fillX().expandX().padRight(15);
|
||||||
|
saveDialog.getContentTable().row();
|
||||||
|
}
|
||||||
|
showDialog(saveDialog);
|
||||||
stage.setKeyboardFocus(textInput);
|
stage.setKeyboardFocus(textInput);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
package forge.adventure.scene;
|
package forge.adventure.scene;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.*;
|
import com.badlogic.gdx.scenes.scene2d.ui.*;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.github.tommyettinger.textra.TextraButton;
|
import com.github.tommyettinger.textra.TextraButton;
|
||||||
import com.github.tommyettinger.textra.TextraLabel;
|
import com.github.tommyettinger.textra.TextraLabel;
|
||||||
@@ -31,17 +28,17 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
|||||||
*/
|
*/
|
||||||
public class SettingsScene extends UIScene {
|
public class SettingsScene extends UIScene {
|
||||||
static public ForgePreferences Preference;
|
static public ForgePreferences Preference;
|
||||||
Texture Background;
|
|
||||||
private final Table settingGroup;
|
private final Table settingGroup;
|
||||||
TextraButton backButton;
|
TextraButton backButton;
|
||||||
TextraButton newPlane;
|
//TextraButton newPlane;
|
||||||
ScrollPane scrollPane;
|
ScrollPane scrollPane;
|
||||||
|
|
||||||
SelectBox selectSourcePlane;
|
SelectBox<String> selectSourcePlane;
|
||||||
TextField newPlaneName;
|
TextField newPlaneName;
|
||||||
|
Dialog createNewPlane, copyPlane, errorDialog;
|
||||||
|
|
||||||
private void copyNewPlane() {
|
private void copyNewPlane() {
|
||||||
String plane = (String) selectSourcePlane.getSelected();
|
String plane = selectSourcePlane.getSelected();
|
||||||
Path source = Paths.get(Config.instance().getPlanePath(plane));
|
Path source = Paths.get(Config.instance().getPlanePath(plane));
|
||||||
Path destination = Paths.get(Config.instance().getPlanePath("<user>" + newPlaneName.getText()));
|
Path destination = Paths.get(Config.instance().getPlanePath("<user>" + newPlaneName.getText()));
|
||||||
AtomicBoolean somethingWentWrong = new AtomicBoolean(false);
|
AtomicBoolean somethingWentWrong = new AtomicBoolean(false);
|
||||||
@@ -58,43 +55,54 @@ public class SettingsScene extends UIScene {
|
|||||||
somethingWentWrong.set(true);
|
somethingWentWrong.set(true);
|
||||||
}
|
}
|
||||||
if (somethingWentWrong.get()) {
|
if (somethingWentWrong.get()) {
|
||||||
Dialog dialog = prepareDialog("Something went wrong", ButtonOk | ButtonAbort, null);
|
if (errorDialog == null) {
|
||||||
dialog.text("Copy was not successful check your access right\n and if the folder is in use");
|
errorDialog = createGenericDialog("Something went wrong", "Copy was not successful check your access right\n and if the folder is in use",
|
||||||
showDialog(dialog);
|
Forge.getLocalizer().getMessage("lblOk"), Forge.getLocalizer().getMessage("lblAbort"), this::removeDialog, this::removeDialog);
|
||||||
|
}
|
||||||
|
showDialog(errorDialog);
|
||||||
} else {
|
} else {
|
||||||
Dialog dialog = prepareDialog("Copied plane", ButtonOk | ButtonAbort, null);
|
if (copyPlane == null) {
|
||||||
dialog.text("New plane " + newPlaneName.getText() + " was created\nYou can now start the editor to change the plane\n" +
|
copyPlane = createGenericDialog("Copied plane", "New plane " + newPlaneName.getText() +
|
||||||
"or edit it manually from the folder\n" +
|
" was created\nYou can now start the editor to change the plane\n" +
|
||||||
Config.instance().getPlanePath("<user>" + newPlaneName.getText()));
|
"or edit it manually from the folder\n" + Config.instance().getPlanePath("<user>" + newPlaneName.getText()),
|
||||||
|
Forge.getLocalizer().getMessage("lblOk"), Forge.getLocalizer().getMessage("lblAbort"), this::removeDialog, this::removeDialog);
|
||||||
|
}
|
||||||
Config.instance().getSettingData().plane = "<user>" + newPlaneName.getText();
|
Config.instance().getSettingData().plane = "<user>" + newPlaneName.getText();
|
||||||
Config.instance().saveSettings();
|
Config.instance().saveSettings();
|
||||||
showDialog(dialog);
|
showDialog(copyPlane);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewPlane() {
|
private void createNewPlane() {
|
||||||
Dialog dialog = prepareDialog("Create your own Plane", ButtonOk | ButtonAbort, () -> copyNewPlane());
|
if (createNewPlane == null) {
|
||||||
dialog.text("Select a plane to copy");
|
createNewPlane = createGenericDialog("Create your own Plane", "Select a plane to copy",
|
||||||
dialog.getContentTable().row();
|
Forge.getLocalizer().getMessage("lblOk"),
|
||||||
dialog.getContentTable().add(selectSourcePlane);
|
Forge.getLocalizer().getMessage("lblAbort"), () -> {
|
||||||
dialog.getContentTable().row();
|
this.copyNewPlane();
|
||||||
dialog.text("Set new plane name");
|
removeDialog();
|
||||||
dialog.getContentTable().row();
|
}, this::removeDialog);
|
||||||
dialog.getContentTable().add(newPlaneName);
|
createNewPlane.getContentTable().row();
|
||||||
newPlaneName.setText(selectSourcePlane.getSelected().toString() + "_copy");
|
createNewPlane.getContentTable().add(selectSourcePlane);
|
||||||
dialog.show(stage);
|
createNewPlane.getContentTable().row();
|
||||||
|
createNewPlane.text("Set new plane name");
|
||||||
|
createNewPlane.getContentTable().row();
|
||||||
|
createNewPlane.getContentTable().add(newPlaneName);
|
||||||
|
newPlaneName.setText(selectSourcePlane.getSelected() + "_copy");
|
||||||
|
}
|
||||||
|
showDialog(createNewPlane);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SettingsScene() {
|
private SettingsScene() {
|
||||||
super(Forge.isLandscapeMode() ? "ui/settings.json" : "ui/settings_portrait.json");
|
super(Forge.isLandscapeMode() ? "ui/settings.json" : "ui/settings_portrait.json");
|
||||||
|
|
||||||
selectSourcePlane = Controls.newComboBox();
|
|
||||||
newPlaneName = Controls.newTextField("");
|
|
||||||
settingGroup = new Table();
|
settingGroup = new Table();
|
||||||
if (Preference == null) {
|
if (Preference == null) {
|
||||||
Preference = new ForgePreferences();
|
Preference = new ForgePreferences();
|
||||||
}
|
}
|
||||||
|
//temporary disable custom world until it works correctly on each update
|
||||||
|
/*selectSourcePlane = Controls.newComboBox();
|
||||||
|
newPlaneName = Controls.newTextField("");
|
||||||
|
|
||||||
selectSourcePlane.setItems(Config.instance().getAllAdventures());
|
selectSourcePlane.setItems(Config.instance().getAllAdventures());
|
||||||
SelectBox plane = Controls.newComboBox(Config.instance().getAllAdventures(), Config.instance().getSettingData().plane, o -> {
|
SelectBox plane = Controls.newComboBox(Config.instance().getAllAdventures(), Config.instance().getSettingData().plane, o -> {
|
||||||
Config.instance().getSettingData().plane = (String) o;
|
Config.instance().getSettingData().plane = (String) o;
|
||||||
@@ -111,10 +119,10 @@ public class SettingsScene extends UIScene {
|
|||||||
addLabel(Forge.getLocalizer().getMessage("lblWorld"));
|
addLabel(Forge.getLocalizer().getMessage("lblWorld"));
|
||||||
settingGroup.add(plane).align(Align.right).pad(2);
|
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);
|
settingGroup.add(newPlane).align(Align.right).pad(2);*/
|
||||||
|
|
||||||
if (!GuiBase.isAndroid()) {
|
if (!GuiBase.isAndroid()) {
|
||||||
SelectBox videomode = Controls.newComboBox(new String[]{"720p", "768p", "900p", "1080p"}, Config.instance().getSettingData().videomode, o -> {
|
SelectBox<String> videomode = Controls.newComboBox(new String[]{"720p", "768p", "900p", "1080p"}, Config.instance().getSettingData().videomode, o -> {
|
||||||
String mode = (String) o;
|
String mode = (String) o;
|
||||||
if (mode == null)
|
if (mode == null)
|
||||||
mode = "720p";
|
mode = "720p";
|
||||||
@@ -145,7 +153,7 @@ public class SettingsScene extends UIScene {
|
|||||||
}
|
}
|
||||||
if (Forge.isLandscapeMode()) {
|
if (Forge.isLandscapeMode()) {
|
||||||
//different adjustment to landscape
|
//different adjustment to landscape
|
||||||
SelectBox rewardCardAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 0.95f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().rewardCardAdjLandscape, o -> {
|
SelectBox<Float> rewardCardAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 0.95f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().rewardCardAdjLandscape, o -> {
|
||||||
Float val = (Float) o;
|
Float val = (Float) o;
|
||||||
if (val == null || val == 0f)
|
if (val == null || val == 0f)
|
||||||
val = 1f;
|
val = 1f;
|
||||||
@@ -155,7 +163,7 @@ public class SettingsScene extends UIScene {
|
|||||||
});
|
});
|
||||||
addLabel("Reward/Shop Card Display Ratio");
|
addLabel("Reward/Shop Card Display Ratio");
|
||||||
settingGroup.add(rewardCardAdjLandscape).align(Align.right).pad(2);
|
settingGroup.add(rewardCardAdjLandscape).align(Align.right).pad(2);
|
||||||
SelectBox tooltipAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 0.95f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().cardTooltipAdjLandscape, o -> {
|
SelectBox<Float> tooltipAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 0.95f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().cardTooltipAdjLandscape, o -> {
|
||||||
Float val = (Float) o;
|
Float val = (Float) o;
|
||||||
if (val == null || val == 0f)
|
if (val == null || val == 0f)
|
||||||
val = 1f;
|
val = 1f;
|
||||||
@@ -167,7 +175,7 @@ public class SettingsScene extends UIScene {
|
|||||||
settingGroup.add(tooltipAdjLandscape).align(Align.right).pad(2);
|
settingGroup.add(tooltipAdjLandscape).align(Align.right).pad(2);
|
||||||
} else {
|
} else {
|
||||||
//portrait adjustment
|
//portrait adjustment
|
||||||
SelectBox rewardCardAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().rewardCardAdj, o -> {
|
SelectBox<Float> rewardCardAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().rewardCardAdj, o -> {
|
||||||
Float val = (Float) o;
|
Float val = (Float) o;
|
||||||
if (val == null || val == 0f)
|
if (val == null || val == 0f)
|
||||||
val = 1f;
|
val = 1f;
|
||||||
@@ -177,7 +185,7 @@ public class SettingsScene extends UIScene {
|
|||||||
});
|
});
|
||||||
addLabel("Reward/Shop Card Display Ratio");
|
addLabel("Reward/Shop Card Display Ratio");
|
||||||
settingGroup.add(rewardCardAdj).align(Align.right).pad(2);
|
settingGroup.add(rewardCardAdj).align(Align.right).pad(2);
|
||||||
SelectBox tooltipAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().cardTooltipAdj, o -> {
|
SelectBox<Float> tooltipAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().cardTooltipAdj, o -> {
|
||||||
Float val = (Float) o;
|
Float val = (Float) o;
|
||||||
if (val == null || val == 0f)
|
if (val == null || val == 0f)
|
||||||
val = 1f;
|
val = 1f;
|
||||||
|
|||||||
@@ -101,9 +101,15 @@ public class StartScene extends UIScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean Exit() {
|
public boolean Exit() {
|
||||||
Dialog dialog = prepareDialog(Forge.getLocalizer().getMessage("lblExitForge"), ButtonOk | ButtonAbort, () -> Forge.exit(true));
|
if (exitDialog == null) {
|
||||||
dialog.text(Controls.newLabel(Forge.getLocalizer().getMessage("lblAreYouSureYouWishExitForge")));
|
exitDialog = createGenericDialog(Forge.getLocalizer().getMessage("lblExitForge"),
|
||||||
showDialog(dialog);
|
Forge.getLocalizer().getMessage("lblAreYouSureYouWishExitForge"), Forge.getLocalizer().getMessage("lblOk"),
|
||||||
|
Forge.getLocalizer().getMessage("lblAbort"), () -> {
|
||||||
|
Forge.exit(true);
|
||||||
|
removeDialog();
|
||||||
|
}, this::removeDialog);
|
||||||
|
}
|
||||||
|
showDialog(exitDialog);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import com.github.tommyettinger.textra.TextraLabel;
|
|||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.adventure.stage.GameHUD;
|
import forge.adventure.stage.GameHUD;
|
||||||
import forge.adventure.util.*;
|
import forge.adventure.util.*;
|
||||||
import forge.sound.SoundEffectType;
|
|
||||||
import forge.sound.SoundSystem;
|
|
||||||
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
|
||||||
@@ -87,36 +85,6 @@ public class UIScene extends Scene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final public int ButtonYes = 0x1;
|
|
||||||
static final public int ButtonNo = 0x2;
|
|
||||||
static final public int ButtonOk = 0x4;
|
|
||||||
static final public int ButtonAbort = 0x8;
|
|
||||||
|
|
||||||
public Dialog prepareDialog(String header, int buttons, Runnable onOkOrYes) {
|
|
||||||
Dialog dialog = new Dialog(header, Controls.getSkin()) {
|
|
||||||
protected void result(Object object) {
|
|
||||||
SoundSystem.instance.play(SoundEffectType.ButtonPress, false);
|
|
||||||
if (onOkOrYes != null && object != null && object.equals(true))
|
|
||||||
onOkOrYes.run();
|
|
||||||
this.hide();
|
|
||||||
removeDialog();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if ((buttons & ButtonYes) != 0)
|
|
||||||
dialog.button(Forge.getLocalizer().getMessage("lblYes"), true);
|
|
||||||
if ((buttons & ButtonNo) != 0)
|
|
||||||
dialog.button(Forge.getLocalizer().getMessage("lblNo"), false);
|
|
||||||
if ((buttons & ButtonOk) != 0)
|
|
||||||
dialog.button(Forge.getLocalizer().getMessage("lblOk"), true);
|
|
||||||
if ((buttons & ButtonAbort) != 0)
|
|
||||||
dialog.button(Forge.getLocalizer().getMessage("lblAbort"), false);
|
|
||||||
|
|
||||||
dialog.setMovable(false);
|
|
||||||
dialog.setKeepWithinStage(true);
|
|
||||||
dialog.setResizable(false);
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showDialog(Dialog dialog) {
|
public void showDialog(Dialog dialog) {
|
||||||
stage.addActor(dialog);
|
stage.addActor(dialog);
|
||||||
possibleSelectionStack.add(new Array<>());
|
possibleSelectionStack.add(new Array<>());
|
||||||
@@ -271,11 +239,12 @@ public class UIScene extends Scene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dialog createGenericDialog(String title, String label, Runnable runnableYes, Runnable runnableNo) {
|
public Dialog createGenericDialog(String title, String label, String stringYes, String stringNo, Runnable runnableYes, Runnable runnableNo) {
|
||||||
Dialog dialog = new Dialog(title, Controls.getSkin());
|
Dialog dialog = new Dialog(title == null ? "" : title, Controls.getSkin());
|
||||||
dialog.text(label);
|
if (label != null)
|
||||||
TextraButton yes = Controls.newTextButton(Forge.getLocalizer().getMessage("lblYes"), runnableYes);
|
dialog.text(label);
|
||||||
TextraButton no = Controls.newTextButton(Forge.getLocalizer().getMessage("lblNo"), runnableNo);
|
TextraButton yes = Controls.newTextButton(stringYes, runnableYes);
|
||||||
|
TextraButton no = Controls.newTextButton(stringNo, runnableNo);
|
||||||
dialog.button(yes).button(no);
|
dialog.button(yes).button(no);
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,8 @@ public class Controls {
|
|||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
try {
|
try {
|
||||||
func.run();
|
if (func != null)
|
||||||
|
func.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,9 @@
|
|||||||
"Boar",
|
"Boar",
|
||||||
"Boggart",
|
"Boggart",
|
||||||
"Bull",
|
"Bull",
|
||||||
"Challenger 1",
|
"Challenger 20",
|
||||||
"Challenger 2",
|
"Challenger 21",
|
||||||
"Challenger 3",
|
"Challenger 22",
|
||||||
"Challenger 4",
|
|
||||||
"Cyclops",
|
"Cyclops",
|
||||||
"Devil",
|
"Devil",
|
||||||
"Dinosaur",
|
"Dinosaur",
|
||||||
|
|||||||
Reference in New Issue
Block a user