First options menu and a lot of fixes
This commit is contained in:
@@ -11,6 +11,7 @@ import de.siphalor.was.content.quest.QuestGenerator;
|
|||||||
import de.siphalor.was.content.quest.QuestManager;
|
import de.siphalor.was.content.quest.QuestManager;
|
||||||
import de.siphalor.was.content.quest.RandomQuestGenerator;
|
import de.siphalor.was.content.quest.RandomQuestGenerator;
|
||||||
import de.siphalor.was.game.Balance;
|
import de.siphalor.was.game.Balance;
|
||||||
|
import de.siphalor.was.game.Options;
|
||||||
import de.siphalor.was.game.Storage;
|
import de.siphalor.was.game.Storage;
|
||||||
import de.siphalor.was.util.Util;
|
import de.siphalor.was.util.Util;
|
||||||
import de.siphalor.was.visual.JFXVisual;
|
import de.siphalor.was.visual.JFXVisual;
|
||||||
@@ -39,6 +40,8 @@ public class WhatAStorage {
|
|||||||
private final ProductManager productManager;
|
private final ProductManager productManager;
|
||||||
private final QuestManager questManager;
|
private final QuestManager questManager;
|
||||||
|
|
||||||
|
private final Options options;
|
||||||
|
|
||||||
private Visual visual;
|
private Visual visual;
|
||||||
|
|
||||||
private boolean stopScheduled;
|
private boolean stopScheduled;
|
||||||
@@ -54,6 +57,7 @@ public class WhatAStorage {
|
|||||||
contentManager.addPack(mainPack);
|
contentManager.addPack(mainPack);
|
||||||
productManager = new ProductManager();
|
productManager = new ProductManager();
|
||||||
questManager = new QuestManager();
|
questManager = new QuestManager();
|
||||||
|
options = new Options();
|
||||||
|
|
||||||
visual = new JFXVisual();
|
visual = new JFXVisual();
|
||||||
}
|
}
|
||||||
@@ -70,6 +74,10 @@ public class WhatAStorage {
|
|||||||
return questManager;
|
return questManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Options getOptions() {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
public void reload() {
|
public void reload() {
|
||||||
contentManager.clear();
|
contentManager.clear();
|
||||||
|
|
||||||
@@ -102,8 +110,8 @@ public class WhatAStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadGame() {
|
public void loadGame() {
|
||||||
//questGenerator = questManager.get("test");
|
questGenerator = questManager.get("example.test");
|
||||||
questGenerator = new RandomQuestGenerator();
|
//questGenerator = new RandomQuestGenerator();
|
||||||
quests.clear();
|
quests.clear();
|
||||||
storage = new Storage(GRID_SIZE, GRID_SIZE, GRID_SIZE);
|
storage = new Storage(GRID_SIZE, GRID_SIZE, GRID_SIZE);
|
||||||
balance = new Balance();
|
balance = new Balance();
|
||||||
@@ -122,6 +130,13 @@ public class WhatAStorage {
|
|||||||
return balance;
|
return balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String[] getLangs() {
|
||||||
|
return contentManager.getResources("lang", "properties").map(resource -> {
|
||||||
|
int index = resource.getId().lastIndexOf('.');
|
||||||
|
return resource.getId().substring(Math.max(index, 0));
|
||||||
|
}).toArray(String[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
private void addTransaction(Balance.Transaction transaction, int change) {
|
private void addTransaction(Balance.Transaction transaction, int change) {
|
||||||
balance.add(transaction, change);
|
balance.add(transaction, change);
|
||||||
visual.onBalanceChanged(balance.getBudget(), transaction, change, balance.getTotalIncome(), balance.getTotalLoss());
|
visual.onBalanceChanged(balance.getBudget(), transaction, change, balance.getTotalIncome(), balance.getTotalLoss());
|
||||||
@@ -213,6 +228,7 @@ public class WhatAStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean resolveQuests(int in, int out) {
|
public boolean resolveQuests(int in, int out) {
|
||||||
|
if (options.getAllowQuestResolving()) {
|
||||||
int s = quests.size();
|
int s = quests.size();
|
||||||
if (in < s && in >= 0 && out < s && out >= 0) {
|
if (in < s && in >= 0 && out < s && out >= 0) {
|
||||||
if (quests.get(in).getType() == Quest.Type.IN && quests.get(out).getType() == Quest.Type.OUT) {
|
if (quests.get(in).getType() == Quest.Type.IN && quests.get(out).getType() == Quest.Type.OUT) {
|
||||||
@@ -231,6 +247,7 @@ public class WhatAStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ public class I18n extends ResourceBundle {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private Lang lang;
|
private Lang lang;
|
||||||
|
|
||||||
|
public Lang getLang() {
|
||||||
|
if (lang != null)
|
||||||
|
return lang;
|
||||||
|
return DEFAULT_LANG;
|
||||||
|
}
|
||||||
|
|
||||||
public void setLang(@NotNull String code, @NotNull ContentManager contentManager) {
|
public void setLang(@NotNull String code, @NotNull ContentManager contentManager) {
|
||||||
if (lang == null || !lang.getCode().equals(code)) {
|
if (lang == null || !lang.getCode().equals(code)) {
|
||||||
lang = new Lang(code);
|
lang = new Lang(code);
|
||||||
|
|||||||
@@ -19,13 +19,14 @@ public class Lang {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(@NotNull ContentManager contentManager) {
|
public void load(@NotNull ContentManager contentManager) {
|
||||||
properties.clear();
|
properties.clear();
|
||||||
contentManager.getAllOfResource("lang/" + code + ".lang").forEachOrdered(resource -> {
|
contentManager.getAllOfResource("lang/" + code + ".properties").forEachOrdered(resource -> {
|
||||||
InputStream inputStream = resource.getInputStream();
|
InputStream inputStream = resource.getInputStream();
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ public class FileContentPack implements ContentPack {
|
|||||||
Path dir = base.resolve(Path.of(location));
|
Path dir = base.resolve(Path.of(location));
|
||||||
if (dir.toFile().isDirectory()) {
|
if (dir.toFile().isDirectory()) {
|
||||||
try {
|
try {
|
||||||
return Files.find(dir, Integer.MAX_VALUE, (fPath, fileAttributes) -> fileAttributes.isRegularFile() && fPath.endsWith(extension)).map(path ->
|
return Files.find(dir, Integer.MAX_VALUE, (path, attributes) -> attributes.isRegularFile() && path.getFileName().getName(0).toString().endsWith(extension)).map(path ->
|
||||||
new FileResource(Util.pathToId(id, path.relativize(base).toString()), path.toFile())
|
new FileResource(Util.pathToId(id, dir.relativize(path).toString()), path.toFile())
|
||||||
);
|
);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
22
src/main/java/de/siphalor/was/game/Options.java
Normal file
22
src/main/java/de/siphalor/was/game/Options.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package de.siphalor.was.game;
|
||||||
|
|
||||||
|
public class Options {
|
||||||
|
private boolean autoRefillQuests;
|
||||||
|
private boolean allowQuestResolving;
|
||||||
|
|
||||||
|
public boolean getAllowQuestResolving() {
|
||||||
|
return allowQuestResolving;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowQuestResolving(boolean allowQuestResolving) {
|
||||||
|
this.allowQuestResolving = allowQuestResolving;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getAutoRefillQuests() {
|
||||||
|
return autoRefillQuests;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoRefillQuests(boolean autoRefillQuests) {
|
||||||
|
this.autoRefillQuests = autoRefillQuests;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import de.siphalor.was.game.Balance;
|
|||||||
import de.siphalor.was.util.Util;
|
import de.siphalor.was.util.Util;
|
||||||
import de.siphalor.was.visual.jfx.controller.BalanceController;
|
import de.siphalor.was.visual.jfx.controller.BalanceController;
|
||||||
import de.siphalor.was.visual.jfx.controller.MainController;
|
import de.siphalor.was.visual.jfx.controller.MainController;
|
||||||
|
import de.siphalor.was.visual.jfx.controller.OptionsController;
|
||||||
import de.siphalor.was.visual.jfx.controller.QuestController;
|
import de.siphalor.was.visual.jfx.controller.QuestController;
|
||||||
import de.siphalor.was.visual.jfx.util.JFXUtil;
|
import de.siphalor.was.visual.jfx.util.JFXUtil;
|
||||||
import de.siphalor.was.visual.jfx.util.StorageSlot;
|
import de.siphalor.was.visual.jfx.util.StorageSlot;
|
||||||
@@ -37,14 +38,15 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class JFXVisual extends Application implements Visual {
|
public class JFXVisual extends Application implements Visual {
|
||||||
private static Stage primaryStage;
|
private static Stage primaryStage;
|
||||||
private static final FXMLLoader loader = new FXMLLoader();
|
|
||||||
|
|
||||||
private static Scene mainScene;
|
private static Scene mainScene;
|
||||||
|
|
||||||
private static MainController mainController;
|
private static MainController mainController;
|
||||||
private static GridPane storageGrid;
|
private static GridPane storageGrid;
|
||||||
private static StorageSlot[][] storageSlots;
|
private static StorageSlot[][] storageSlots;
|
||||||
|
|
||||||
|
private static Scene optionsScene;
|
||||||
|
private static OptionsController optionsController;
|
||||||
|
|
||||||
private static Stage balanceStage;
|
private static Stage balanceStage;
|
||||||
private static BalanceController balanceController;
|
private static BalanceController balanceController;
|
||||||
|
|
||||||
@@ -115,60 +117,23 @@ public class JFXVisual extends Application implements Visual {
|
|||||||
primaryStage.setMinHeight(500);
|
primaryStage.setMinHeight(500);
|
||||||
primaryStage.setTitle(WhatAStorage.TITLE);
|
primaryStage.setTitle(WhatAStorage.TITLE);
|
||||||
|
|
||||||
loader.setResources(I18n.getInstance());
|
|
||||||
mainController = new MainController(WhatAStorage.getInstance());
|
|
||||||
loader.setController(mainController);
|
|
||||||
|
|
||||||
Pane pane = loader.load(AssetsManager.getStream("jfx/game.fxml").get());
|
|
||||||
mainScene = new Scene(pane);
|
|
||||||
mainScene.getStylesheets().add("assets/jfx/main.css");
|
|
||||||
|
|
||||||
loadMainScene();
|
loadMainScene();
|
||||||
|
loadOptionsScene();
|
||||||
mainController.balanceButton.setOnAction(event -> {
|
|
||||||
if (balanceStage != null && balanceStage.isShowing()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
balanceStage = new Stage();
|
|
||||||
FXMLLoader balanceLoader = new FXMLLoader();
|
|
||||||
balanceLoader.setResources(I18n.getInstance());
|
|
||||||
|
|
||||||
try {
|
|
||||||
balanceController = new BalanceController();
|
|
||||||
balanceLoader.setController(balanceController);
|
|
||||||
|
|
||||||
Parent parent = balanceLoader.load(AssetsManager.getStream("jfx/balance.fxml").orElseThrow());
|
|
||||||
|
|
||||||
balanceController.init();
|
|
||||||
|
|
||||||
Scene balanceScene = new Scene(parent);
|
|
||||||
balanceScene.getStylesheets().add("assets/jfx/main.css");
|
|
||||||
|
|
||||||
balanceStage.setOnCloseRequest(e -> {
|
|
||||||
balanceStage = null;
|
|
||||||
balanceController = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
balanceStage.setAlwaysOnTop(true);
|
|
||||||
balanceStage.setScene(balanceScene);
|
|
||||||
balanceStage.setTitle(I18n.getInstance().getString("game.balance"));
|
|
||||||
balanceStage.show();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
primaryStage.setOnCloseRequest(event -> {
|
primaryStage.setOnCloseRequest(event -> {
|
||||||
if (balanceStage != null)
|
if (balanceStage != null)
|
||||||
balanceStage.hide();
|
balanceStage.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
primaryStage.setScene(mainScene);
|
||||||
|
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadMainScene() {
|
public void loadMainScene() {
|
||||||
primaryStage.setScene(mainScene);
|
mainController = new MainController(WhatAStorage.getInstance());
|
||||||
|
|
||||||
|
mainScene = JFXUtil.loadScene("game", mainController, I18n.getInstance());
|
||||||
|
|
||||||
prepareStorageGrid(3, 3, 3);
|
prepareStorageGrid(3, 3, 3);
|
||||||
|
|
||||||
@@ -177,6 +142,41 @@ public class JFXVisual extends Application implements Visual {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onBalanceChanged(0, Balance.Transaction.NOOP, 0, 0, 0);
|
onBalanceChanged(0, Balance.Transaction.NOOP, 0, 0, 0);
|
||||||
|
|
||||||
|
mainController.balanceButton.setOnAction(event -> {
|
||||||
|
if (balanceStage != null && balanceStage.isShowing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
balanceStage = new Stage();
|
||||||
|
|
||||||
|
balanceController = new BalanceController();
|
||||||
|
Scene scene = JFXUtil.loadScene("balance", balanceController, I18n.getInstance());
|
||||||
|
|
||||||
|
balanceController.init();
|
||||||
|
|
||||||
|
balanceStage.setOnCloseRequest(e -> {
|
||||||
|
balanceStage = null;
|
||||||
|
balanceController = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
balanceStage.setAlwaysOnTop(true);
|
||||||
|
balanceStage.setScene(scene);
|
||||||
|
balanceStage.setTitle(I18n.getInstance().getString("game.balance"));
|
||||||
|
balanceStage.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
mainController.optionsButton.setOnAction(event -> openOptionsScene());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadOptionsScene() {
|
||||||
|
optionsController = new OptionsController();
|
||||||
|
optionsScene = JFXUtil.loadScene("options", optionsController, I18n.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openOptionsScene() {
|
||||||
|
optionsController.beforeOpen(() -> primaryStage.setScene(mainScene));
|
||||||
|
primaryStage.setScene(optionsScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addQuest(Quest quest) {
|
private void addQuest(Quest quest) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class MainController {
|
|||||||
|
|
||||||
public Label budgetLabel;
|
public Label budgetLabel;
|
||||||
public Button balanceButton;
|
public Button balanceButton;
|
||||||
|
public Button optionsButton;
|
||||||
|
|
||||||
public Pane storagePane;
|
public Pane storagePane;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package de.siphalor.was.visual.jfx.controller;
|
||||||
|
|
||||||
|
import de.siphalor.was.WhatAStorage;
|
||||||
|
import de.siphalor.was.content.lang.I18n;
|
||||||
|
import de.siphalor.was.game.Options;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.ChoiceBox;
|
||||||
|
import javafx.scene.control.ToggleButton;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class OptionsController {
|
||||||
|
private Runnable exitRunnable;
|
||||||
|
|
||||||
|
public ChoiceBox<LangEntry> languageChoice;
|
||||||
|
public ToggleButton allowQuestResolvingToggle;
|
||||||
|
public ToggleButton autoQuestRefillToggle;
|
||||||
|
|
||||||
|
public void beforeOpen(@NotNull Runnable exitRunnable) {
|
||||||
|
Options options = WhatAStorage.getInstance().getOptions();
|
||||||
|
this.exitRunnable = exitRunnable;
|
||||||
|
|
||||||
|
I18n i18n = I18n.getInstance();
|
||||||
|
String curLang = i18n.getLang().getCode();
|
||||||
|
|
||||||
|
languageChoice.getItems().clear();
|
||||||
|
String[] langs = WhatAStorage.getInstance().getLangs();
|
||||||
|
Arrays.sort(langs);
|
||||||
|
for (String lang : langs) {
|
||||||
|
LangEntry langEntry = new LangEntry(lang, i18n.getString("langs." + lang));
|
||||||
|
languageChoice.getItems().add(langEntry);
|
||||||
|
if (curLang.equals(lang)) {
|
||||||
|
languageChoice.setValue(langEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allowQuestResolvingToggle.setSelected(options.getAllowQuestResolving());
|
||||||
|
autoQuestRefillToggle.setSelected(options.getAutoRefillQuests());
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void onLeaveClicked() {
|
||||||
|
Options options = WhatAStorage.getInstance().getOptions();
|
||||||
|
|
||||||
|
I18n.getInstance().setLang(languageChoice.getValue().getCode(), WhatAStorage.getInstance().getContentManager());
|
||||||
|
options.setAllowQuestResolving(allowQuestResolvingToggle.isSelected());
|
||||||
|
options.setAutoRefillQuests(autoQuestRefillToggle.isSelected());
|
||||||
|
|
||||||
|
exitRunnable.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class LangEntry {
|
||||||
|
private final String code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
private LangEntry(String code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,8 +39,10 @@ public class QuestController {
|
|||||||
if (dragEvent.getDragboard().hasContent(DraggedProduct.FORMAT)) {
|
if (dragEvent.getDragboard().hasContent(DraggedProduct.FORMAT)) {
|
||||||
DraggedProduct product = (DraggedProduct) dragEvent.getDragboard().getContent(DraggedProduct.FORMAT);
|
DraggedProduct product = (DraggedProduct) dragEvent.getDragboard().getContent(DraggedProduct.FORMAT);
|
||||||
if (product instanceof DraggedProduct.Quest) {
|
if (product instanceof DraggedProduct.Quest) {
|
||||||
|
if (WhatAStorage.getInstance().getOptions().getAllowQuestResolving()) {
|
||||||
DraggedProduct.Quest quest = (DraggedProduct.Quest) product;
|
DraggedProduct.Quest quest = (DraggedProduct.Quest) product;
|
||||||
return WhatAStorage.getInstance().canQuestsResolve(quest.index, getIndex());
|
return WhatAStorage.getInstance().canQuestsResolve(quest.index, getIndex());
|
||||||
|
}
|
||||||
} else if (product instanceof DraggedProduct.Slot) {
|
} else if (product instanceof DraggedProduct.Slot) {
|
||||||
DraggedProduct.Slot slot = (DraggedProduct.Slot) product;
|
DraggedProduct.Slot slot = (DraggedProduct.Slot) product;
|
||||||
return WhatAStorage.getInstance().canDeliverProduct(getIndex(), slot.x, slot.y);
|
return WhatAStorage.getInstance().canDeliverProduct(getIndex(), slot.x, slot.y);
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
package de.siphalor.was.visual.jfx.util;
|
package de.siphalor.was.visual.jfx.util;
|
||||||
|
|
||||||
|
import de.siphalor.was.assets.AssetsManager;
|
||||||
|
import de.siphalor.was.content.lang.I18n;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.PixelReader;
|
import javafx.scene.image.PixelReader;
|
||||||
import javafx.scene.image.PixelWriter;
|
import javafx.scene.image.PixelWriter;
|
||||||
import javafx.scene.image.WritableImage;
|
import javafx.scene.image.WritableImage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class JFXUtil {
|
public class JFXUtil {
|
||||||
public static Image scaleTo(Image image, int width) {
|
public static Image scaleTo(Image image, int width) {
|
||||||
double scale = image.getWidth() / (double) width;
|
double scale = image.getWidth() / (double) width;
|
||||||
@@ -33,4 +40,19 @@ public class JFXUtil {
|
|||||||
node.getStyleClass().remove(clazz);
|
node.getStyleClass().remove(clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Scene loadScene(String fxml, Object controller, I18n i18n) {
|
||||||
|
FXMLLoader loader = new FXMLLoader();
|
||||||
|
loader.setResources(i18n);
|
||||||
|
loader.setController(controller);
|
||||||
|
Parent parent = null;
|
||||||
|
try {
|
||||||
|
parent = loader.load(AssetsManager.getStream("jfx/" + fxml + ".fxml").orElseThrow());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Scene scene = new Scene(parent);
|
||||||
|
scene.getStylesheets().add("assets/jfx/main.css");
|
||||||
|
return scene;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,16 @@
|
|||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.chart.LineChart?>
|
<?import javafx.scene.chart.LineChart?>
|
||||||
<?import javafx.scene.chart.NumberAxis?>
|
<?import javafx.scene.chart.NumberAxis?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.Tab?>
|
||||||
|
<?import javafx.scene.control.TabPane?>
|
||||||
|
<?import javafx.scene.control.TableColumn?>
|
||||||
|
<?import javafx.scene.control.TableView?>
|
||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<TabPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/9.0.1">
|
|
||||||
|
<TabPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<tabs>
|
<tabs>
|
||||||
<Tab text="%game.balance.history">
|
<Tab text="%game.balance.history">
|
||||||
<content>
|
<content>
|
||||||
@@ -15,7 +20,8 @@
|
|||||||
<columns>
|
<columns>
|
||||||
<TableColumn prefWidth="50.666626400416135" styleClass="align-right" text="%game.balance.history.index" />
|
<TableColumn prefWidth="50.666626400416135" styleClass="align-right" text="%game.balance.history.index" />
|
||||||
<TableColumn editable="false" maxWidth="500.0" prefWidth="100.0" styleClass="align-right" text="%game.balance.history.change" />
|
<TableColumn editable="false" maxWidth="500.0" prefWidth="100.0" styleClass="align-right" text="%game.balance.history.change" />
|
||||||
<TableColumn maxWidth="1.7976931348623157E308" prefWidth="300.0" text="%game.balance.history.type" />
|
<TableColumn maxWidth="1.7976931348623157E308" prefWidth="207.0" text="%game.balance.history.type" />
|
||||||
|
<TableColumn prefWidth="161.0" text="%game.balance.history.product" />
|
||||||
</columns>
|
</columns>
|
||||||
<placeholder>
|
<placeholder>
|
||||||
<Label text="%game.balance.history.no-data" />
|
<Label text="%game.balance.history.no-data" />
|
||||||
|
|||||||
@@ -1,10 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.*?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.ScrollPane?>
|
||||||
|
<?import javafx.scene.control.SplitPane?>
|
||||||
|
<?import javafx.scene.control.ToolBar?>
|
||||||
<?import javafx.scene.image.ImageView?>
|
<?import javafx.scene.image.ImageView?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<VBox maxHeight="1.7976931348623157E308" minHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
<VBox maxHeight="1.7976931348623157E308" minHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<children>
|
<children>
|
||||||
<AnchorPane>
|
<AnchorPane>
|
||||||
@@ -22,7 +32,16 @@
|
|||||||
</Label>
|
</Label>
|
||||||
</items>
|
</items>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<Button alignment="CENTER" mnemonicParsing="false" onMouseClicked="#scheduleStop" styleClass="red" text="%game.quit" textFill="WHITE" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="7.0" />
|
<HBox layoutX="710.5" layoutY="7.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="7.0">
|
||||||
|
<children>
|
||||||
|
<Button fx:id="optionsButton" mnemonicParsing="false" text="%menu.options">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets right="10.0" />
|
||||||
|
</HBox.margin>
|
||||||
|
</Button>
|
||||||
|
<Button alignment="CENTER" mnemonicParsing="false" onMouseClicked="#scheduleStop" styleClass="red" text="%game.quit" textFill="WHITE" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<SplitPane dividerPositions="0.3140277777777778" maxHeight="1.7976931348623157E308" VBox.vgrow="ALWAYS">
|
<SplitPane dividerPositions="0.3140277777777778" maxHeight="1.7976931348623157E308" VBox.vgrow="ALWAYS">
|
||||||
|
|||||||
@@ -11,6 +11,20 @@ Button.red:pressed {
|
|||||||
-fx-background-color: #9c2121;
|
-fx-background-color: #9c2121;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toggle-button {
|
||||||
|
-fx-min-width: 50;
|
||||||
|
-fx-max-width: 50;
|
||||||
|
-fx-min-height: 20;
|
||||||
|
-fx-border-color: #aaaaaa;
|
||||||
|
-fx-border-radius: 5;
|
||||||
|
-fx-background-radius: 5;
|
||||||
|
-fx-background-color: linear-gradient(to right, white 40%, #999999 40%, #dddddd);
|
||||||
|
-fx-background-insets: 0;
|
||||||
|
}
|
||||||
|
.toggle-button:selected {
|
||||||
|
-fx-background-color: linear-gradient(to right, #1695e8, #1279bb 60%, white 60%);
|
||||||
|
}
|
||||||
|
|
||||||
ScrollPane {
|
ScrollPane {
|
||||||
-fx-background-insets: 0;
|
-fx-background-insets: 0;
|
||||||
-fx-border-insets: 0;
|
-fx-border-insets: 0;
|
||||||
@@ -34,6 +48,14 @@ Label.red {
|
|||||||
Label.green {
|
Label.green {
|
||||||
-fx-text-fill: #457229;
|
-fx-text-fill: #457229;
|
||||||
}
|
}
|
||||||
|
.options-menu > Label {
|
||||||
|
-fx-font-size: 16;
|
||||||
|
}
|
||||||
|
.options-menu .heading {
|
||||||
|
-fx-padding: 10 0 0 0;
|
||||||
|
-fx-font-size: 20;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.align-right {
|
.align-right {
|
||||||
-fx-alignment: center-right;
|
-fx-alignment: center-right;
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
test.hello-world = Hallo Welt!
|
test.hello-world = Hallo Welt!
|
||||||
|
|
||||||
|
menu.back = Zur\u00fcck
|
||||||
|
menu.options = Optionen
|
||||||
|
menu.options.general = Allgemein
|
||||||
|
menu.options.gameplay = Spielmechanik
|
||||||
|
menu.options.gameplay.quest-resolving = Erlauben Auftr\u00e4ge gegeneinander aufzul\u00f6sen
|
||||||
|
menu.options.gameplay.auto-quest-refill = Automatisch neue Auftr\u00e4ge akzeptieren
|
||||||
|
|
||||||
game.budget = Budget: %d\u20ac
|
game.budget = Budget: %d\u20ac
|
||||||
game.quit = Spiel beenden
|
game.quit = Spiel beenden
|
||||||
game.quests = Auftr\u00e4ge
|
game.quests = Auftr\u00e4ge
|
||||||
@@ -21,6 +28,7 @@ game.balance.history.type.move = Produkt bewegt
|
|||||||
game.balance.history.type.noop = NOOP
|
game.balance.history.type.noop = NOOP
|
||||||
game.balance.history.type.deliver = Produkt ausgelagert
|
game.balance.history.type.deliver = Produkt ausgelagert
|
||||||
game.balance.history.type.store = Produkt eingelagert
|
game.balance.history.type.store = Produkt eingelagert
|
||||||
|
game.balance.history.product = Produkt
|
||||||
game.balance.chart = Bilanz
|
game.balance.chart = Bilanz
|
||||||
game.balance.chart.line = Budget
|
game.balance.chart.line = Budget
|
||||||
game.balance.total-income = Gesamteinahmen: %d\u20ac
|
game.balance.total-income = Gesamteinahmen: %d\u20ac
|
||||||
@@ -1,5 +1,15 @@
|
|||||||
test.hello-world = Hello World!
|
test.hello-world = Hello World!
|
||||||
|
|
||||||
|
langs.en_us = English (America)
|
||||||
|
langs.de_de = Deutsch
|
||||||
|
|
||||||
|
menu.options = Options
|
||||||
|
menu.options.back = Apply & Leave
|
||||||
|
menu.options.general = General
|
||||||
|
menu.options.gameplay = Gameplay
|
||||||
|
menu.options.gameplay.quest-resolving = Allow quest resolving
|
||||||
|
menu.options.gameplay.auto-quest-refill = Automatically refill quests
|
||||||
|
|
||||||
game.budget = Budget: %d$
|
game.budget = Budget: %d$
|
||||||
game.quit = Quit Game
|
game.quit = Quit Game
|
||||||
game.quests = Quests
|
game.quests = Quests
|
||||||
@@ -21,6 +31,7 @@ game.balance.history.type.move = Product moved
|
|||||||
game.balance.history.type.noop = NOOP
|
game.balance.history.type.noop = NOOP
|
||||||
game.balance.history.type.deliver = Product delivered
|
game.balance.history.type.deliver = Product delivered
|
||||||
game.balance.history.type.store = Product stored
|
game.balance.history.type.store = Product stored
|
||||||
|
game.balance.history.product = Product
|
||||||
game.balance.chart = Balance
|
game.balance.chart = Balance
|
||||||
game.balance.chart.line = Budget
|
game.balance.chart.line = Budget
|
||||||
game.balance.total-income = Total Income: %d$
|
game.balance.total-income = Total Income: %d$
|
||||||
@@ -35,18 +35,21 @@ public class ContentTests {
|
|||||||
@Test
|
@Test
|
||||||
public void areLangsUpToDate() throws IOException {
|
public void areLangsUpToDate() throws IOException {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
InputStream inputStream = contentManager.getResource("lang/en_us.lang").orElseThrow().getInputStream();
|
InputStream inputStream = contentManager.getResource("lang/en_us.properties").orElseThrow().getInputStream();
|
||||||
properties.load(inputStream);
|
properties.load(inputStream);
|
||||||
|
|
||||||
Assertions.assertAll(contentManager.getResources("lang", "lang").flatMap(resource -> {
|
Assertions.assertAll(contentManager.getResources("lang", "lang").flatMap(resource -> {
|
||||||
if (resource.getId().equals("lang/en_us.lang")) {
|
if (resource.getId().equals("lang/en_us.properties")) {
|
||||||
return Stream.empty();
|
return Stream.empty();
|
||||||
}
|
}
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
return Stream.of(() -> {
|
return Stream.of(() -> {
|
||||||
Assertions.assertDoesNotThrow(() -> props.load(resource.getInputStream()));
|
Assertions.assertDoesNotThrow(() -> props.load(resource.getInputStream()));
|
||||||
Assertions.assertAll(properties.keySet().stream().map(key -> () ->
|
Assertions.assertAll(properties.keySet().stream().map(key -> () -> {
|
||||||
Assertions.assertTrue(props.containsKey(key), "Missing lang key " + key + " for file " + resource.getId())
|
if (!key.toString().startsWith("langs.")) {
|
||||||
|
Assertions.assertTrue(props.containsKey(key), "Missing lang key " + key + " for file " + resource.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user