mirror of
https://inf.pirckheimer-gymnasium.de/kebab/kebab
synced 2026-08-26 16:31:23 +00:00
Refactor: rename waitingCustomers to lostCustomers
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package project;
|
||||
|
||||
import project.scenes.LoadingScene;
|
||||
import project.scenes.VictoryScene;
|
||||
import project.utils.Statistics;
|
||||
import pi.Controller;
|
||||
import pi.config.ConfigLoader;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class GameScene extends Scene implements FrameListener, MouseClickListene
|
||||
if(fed_customers[i]) {
|
||||
fed_customers[i] = false;
|
||||
} else {
|
||||
incrementWaitingCustomers(1);
|
||||
incrementLostCustomers(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,22 +164,22 @@ public class GameScene extends Scene implements FrameListener, MouseClickListene
|
||||
moneyButton.center(-10, 25);
|
||||
Image kebabSoldButton = new Image("images/pixui-pack/Buttons/Button_White_Outline (9).png");
|
||||
kebabSoldButton.center(0, 25);
|
||||
Image waitingCustomersButton = new Image("images/pixui-pack/Buttons/Button_White_Outline (9).png");
|
||||
waitingCustomersButton.center(10, 25);
|
||||
Image lostCustomersButton = new Image("images/pixui-pack/Buttons/Button_White_Outline (9).png");
|
||||
lostCustomersButton.center(10, 25);
|
||||
|
||||
Image moneyIcon = new Image("images/kebab-pack/money-128x128.png").size(2, 2);
|
||||
moneyIcon.center(-12, 25);
|
||||
Image kebabSoldIcon = new Image("images/kebab-pack/kebab-128x128.png").size(2, 2);
|
||||
kebabSoldIcon.center(-2, 25);
|
||||
Image waitingCustomersIcon = new Image("images/kebab-pack/customer.png").size(2, 2);
|
||||
waitingCustomersIcon.center(8, 25);
|
||||
Image lostCustomersIcon = new Image("images/kebab-pack/customer.png").size(2, 2);
|
||||
lostCustomersIcon.center(8, 25);
|
||||
|
||||
scene.add(moneyButton);
|
||||
scene.add(moneyIcon);
|
||||
scene.add(kebabSoldButton);
|
||||
scene.add(kebabSoldIcon);
|
||||
scene.add(waitingCustomersButton);
|
||||
scene.add(waitingCustomersIcon);
|
||||
scene.add(lostCustomersButton);
|
||||
scene.add(lostCustomersIcon);
|
||||
}
|
||||
|
||||
public static Text[] createTexts(Scene scene) {
|
||||
@@ -200,24 +200,24 @@ public class GameScene extends Scene implements FrameListener, MouseClickListene
|
||||
kebabSold.height(2.5);
|
||||
kebabSold.center(1, 25);
|
||||
texts[1] = kebabSold;
|
||||
Text waitingCustomers = new Text(s.waitingCustomers());
|
||||
waitingCustomers.color("#000000");
|
||||
waitingCustomers.font(font);
|
||||
waitingCustomers.height(2.5);
|
||||
waitingCustomers.center(11, 25);
|
||||
texts[2] = waitingCustomers;
|
||||
Text lostCustomers = new Text(s.lostCustomers());
|
||||
lostCustomers.color("#000000");
|
||||
lostCustomers.font(font);
|
||||
lostCustomers.height(2.5);
|
||||
lostCustomers.center(11, 25);
|
||||
texts[2] = lostCustomers;
|
||||
|
||||
scene.add(money);
|
||||
scene.add(kebabSold);
|
||||
scene.add(waitingCustomers);
|
||||
scene.add(lostCustomers);
|
||||
|
||||
return texts;
|
||||
}
|
||||
|
||||
public static void setTexts(Text[] texts, int money, int kebabSold, int waitingCustomers) {
|
||||
public static void setTexts(Text[] texts, int money, int kebabSold, int lostCustomers) {
|
||||
texts[0].content(String.valueOf(money));
|
||||
texts[1].content(String.valueOf(kebabSold));
|
||||
texts[2].content(String.valueOf(waitingCustomers));
|
||||
texts[2].content(String.valueOf(lostCustomers));
|
||||
}
|
||||
|
||||
public static void setMoney(Text[] texts, int money) {
|
||||
@@ -226,8 +226,8 @@ public class GameScene extends Scene implements FrameListener, MouseClickListene
|
||||
public static void setKebabSold(Text[] texts, int kebabSold) {
|
||||
texts[1].content(String.valueOf(kebabSold));
|
||||
}
|
||||
public static void setWaitingCustomers(Text[] texts, int waitingCustomers) {
|
||||
texts[2].content(String.valueOf(waitingCustomers));
|
||||
public static void setLostCustomers(Text[] texts, int lostCustomers) {
|
||||
texts[2].content(String.valueOf(lostCustomers));
|
||||
}
|
||||
public void sellKebabStatistics(int amount) {
|
||||
s.kebabSold(s.kebabSold()+amount);
|
||||
@@ -241,26 +241,26 @@ public class GameScene extends Scene implements FrameListener, MouseClickListene
|
||||
Controller.transitionToScene(new VictoryScene());
|
||||
}
|
||||
}
|
||||
public void incrementWaitingCustomers(int amount) {
|
||||
s.waitingCustomers(s.waitingCustomers()+amount);
|
||||
public void incrementLostCustomers(int amount) {
|
||||
s.lostCustomers(s.lostCustomers()+amount);
|
||||
Main.CONFIG.save();
|
||||
setWaitingCustomers(texts, s.waitingCustomers());
|
||||
setLostCustomers(texts, s.lostCustomers());
|
||||
}
|
||||
|
||||
public static void saveStats(Text[] texts) {
|
||||
int money = Integer.parseInt(texts[0].content());
|
||||
int kebabSold = Integer.parseInt(texts[1].content());
|
||||
int waitingCustomers = Integer.parseInt(texts[2].content());
|
||||
int lostCustomers = Integer.parseInt(texts[2].content());
|
||||
|
||||
System.out.println(money);
|
||||
System.out.println(kebabSold);
|
||||
System.out.println(waitingCustomers);
|
||||
System.out.println(lostCustomers);
|
||||
}
|
||||
public void resetStats() {
|
||||
s.money(2);
|
||||
s.kebabPrice(5);
|
||||
s.kebabSold(0);
|
||||
s.waitingCustomers(0);
|
||||
s.lostCustomers(0);
|
||||
Main.CONFIG.save();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import pi.actor.Image;
|
||||
import static pi.Controller.fonts;
|
||||
import java.awt.Font;
|
||||
|
||||
|
||||
public class LoadingScene extends Scene
|
||||
{
|
||||
private Text title;
|
||||
|
||||
@@ -8,7 +8,7 @@ public class Statistics extends ConfigGroup {
|
||||
private int upgradeLevel = 0;
|
||||
private int kebabSold = 0;
|
||||
private int workers = 0;
|
||||
private int waitingCustomers = 0;
|
||||
private int lostCustomers = 0;
|
||||
private int totalEarned = 0;
|
||||
|
||||
public Statistics() {
|
||||
@@ -17,7 +17,7 @@ public class Statistics extends ConfigGroup {
|
||||
upgradeLevel(0);
|
||||
kebabSold(0);
|
||||
workers(0);
|
||||
waitingCustomers(0);
|
||||
lostCustomers(0);
|
||||
totalEarned(0);
|
||||
}
|
||||
|
||||
@@ -70,13 +70,13 @@ public class Statistics extends ConfigGroup {
|
||||
return this;
|
||||
}
|
||||
|
||||
// --- waitingCustomers ---
|
||||
public int waitingCustomers() {
|
||||
return waitingCustomers;
|
||||
// --- lostCustomers ---
|
||||
public int lostCustomers() {
|
||||
return lostCustomers;
|
||||
}
|
||||
|
||||
public Statistics waitingCustomers(int waitingCustomers) {
|
||||
set("waitingCustomers", waitingCustomers);
|
||||
public Statistics lostCustomers(int lostCustomers) {
|
||||
set("lostCustomers", lostCustomers);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user