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