Rename startscene to gamescene, Improve stats display

This commit is contained in:
2026-07-13 08:16:06 +02:00
parent efcbe71ecd
commit aa18578a39
3 changed files with 39 additions and 9 deletions
@@ -4,11 +4,11 @@ import pi.Scene;
import pi.actor.Image;
import pi.Text;
import static pi.Controller.fonts;
import java.awt.Font;
public class StatsCollection {
public static void addStatsCollectionOutline(Scene scene) {
Image moneyButton = new Image("images/pixui-pack/Buttons/Button_White_Outline (9).png");
moneyButton.center(-10, 25);
Image kebabSoldButton = new Image("images/pixui-pack/Buttons/Button_White_Outline (9).png");
@@ -38,18 +38,21 @@ public class StatsCollection {
Text money = new Text("0");
money.color("#000000");
money.font(font);
money.size(1.2,2.5);
money.center(1, 25);
money.height(2.5);
money.center(-9, 25);
texts[0] = money;
Text kebabSold = new Text("0");
kebabSold.color("#000000");
kebabSold.font(font);
kebabSold.size(1.2,2.5);
kebabSold.center(-9, 25);
kebabSold.height(2.5);
kebabSold.center(1, 25);
texts[1] = kebabSold;
Text waitingCustomers = new Text("0");
waitingCustomers.color("#000000");
waitingCustomers.font(font);
waitingCustomers.size(1.2,2.5);
waitingCustomers.height(2.5);
waitingCustomers.center(11, 25);
texts[2] = waitingCustomers;
scene.add(money);
scene.add(kebabSold);
@@ -57,4 +60,30 @@ public class StatsCollection {
return texts;
}
public static void setTexts(Text[] texts, int money, int kebabSold, int waitingCustomers) {
texts[0].content(String.valueOf(money));
texts[1].content(String.valueOf(kebabSold));
texts[2].content(String.valueOf(waitingCustomers));
}
public static void setMoney(Text[] texts, int money) {
texts[0].content(String.valueOf(money));
}
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 saveStats(Text[] texts) {
int money = Integer.parseInt(texts[0].content());
int kebabSold = Integer.parseInt(texts[1].content());
int waitingCustomers = Integer.parseInt(texts[2].content());
System.out.println(money);
System.out.println(kebabSold);
System.out.println(waitingCustomers);
}
}