diff --git a/src/main/java/project/Main.java b/src/main/java/project/Main.java index 288e120..98a9409 100644 --- a/src/main/java/project/Main.java +++ b/src/main/java/project/Main.java @@ -1,6 +1,7 @@ package project; import project.scenes.LoadingScene; +import project.utils.Statistics; import pi.Controller; import java.awt.Cursor; @@ -24,5 +25,8 @@ public class Main } catch (Exception e) { e.printStackTrace(); } + + Controller.config.add(new Statistics()); + Controller.config.getGroup(Statistics.class); } } diff --git a/src/main/java/project/utils/Ordersystem.java b/src/main/java/project/utils/Ordersystem.java deleted file mode 100644 index 714a5b3..0000000 --- a/src/main/java/project/utils/Ordersystem.java +++ /dev/null @@ -1,100 +0,0 @@ -package project.utils; - -public class Ordersystem { - private int money = 0; - private int kebabPrice = 5; - private int upgradeLevel = 0; - private int kebabSold = 0; - private int workers = 0; - private int waitingCustomers = 0; - private int totalEarned = 0; - - public int getMoney(){ - return money; - } - - public int getKebabSold(){ - return kebabSold; - } - - public void setKebabPrice(int price){ - kebabPrice = price; - } - - public boolean buyUpgrade() { - int cost = (upgradeLevel + 1) * 50; - - if(money >= cost) { - money -= cost; - upgradeLevel++; - kebabPrice += 2; - return true; - } - - return false; - } - - public int getUpgradeLevel() { - return upgradeLevel; - } - - public boolean buyWorker() { - int cost = getWorkerCost(); - - if(money >= cost) { - money -= cost; - workers++; - return true; - } - - return false; - } - - public int getWorkers() { - return workers; - } - - public void addCustomer() { - waitingCustomers++; - } - - public boolean sellKebab() { - if(waitingCustomers > 0) { - waitingCustomers--; - money += kebabPrice; - totalEarned += kebabPrice; - kebabSold++; - return true; - } - - return false; - } - - public int getTotalIncome() { - return totalEarned; - } - - public int getWaitingCustomers() { - return waitingCustomers; - } - - public int getKebabPrice() { - return kebabPrice; - } - - public int getUpgradeCost() { - return (upgradeLevel + 1) * 50; - } - - public int getWorkerCost() { - return 100 + workers * 50; - } - - public void workerSellKebabs() { - for(int i = 0; i < workers; i++) { - if (waitingCustomers > 0) { - sellKebab(); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/project/utils/Statistics.java b/src/main/java/project/utils/Statistics.java new file mode 100644 index 0000000..f34df77 --- /dev/null +++ b/src/main/java/project/utils/Statistics.java @@ -0,0 +1,92 @@ +package project.utils; + +import pi.config.ConfigGroup; + +public class Statistics extends ConfigGroup { + private int money; + private int kebabPrice = 5; + private int upgradeLevel = 0; + private int kebabSold = 0; + private int workers = 0; + private int waitingCustomers = 0; + private int totalEarned = 0; + + public Statistics() { + money(0); + kebabPrice(5); + upgradeLevel(0); + kebabSold(0); + workers(0); + waitingCustomers(0); + totalEarned(0); + } + + // --- money --- + public int money(){ + return money; + } + public Statistics money(int money) { + set("money", money); + return this; + } + + // --- kebabPrice --- + public int kebabPrice() { + return kebabPrice; + } + + public Statistics kebabPrice(int kebabPrice) { + set("kebabPrice", kebabPrice); + return this; + } + + // --- upgradeLevel --- + public int upgradeLevel() { + return upgradeLevel; + } + + public Statistics upgradeLevel(int upgradeLevel) { + set("upgradeLevel", upgradeLevel); + return this; + } + + // --- kebabSold --- + public int kebabSold() { + return kebabSold; + } + + public Statistics kebabSold(int kebabSold) { + set("kebabSold", kebabSold); + return this; + } + + // --- workers --- + public int workers() { + return workers; + } + + public Statistics workers(int workers) { + set("workers", workers); + return this; + } + + // --- waitingCustomers --- + public int waitingCustomers() { + return waitingCustomers; + } + + public Statistics waitingCustomers(int waitingCustomers) { + set("waitingCustomers", waitingCustomers); + return this; + } + + // --- totalEarned --- + public int totalEarned() { + return totalEarned; + } + + public Statistics totalEarned(int totalEarned) { + set("totalEarned", totalEarned); + return this; + } +} \ No newline at end of file