mirror of
https://inf.pirckheimer-gymnasium.de/kebab/kebab
synced 2026-08-26 16:31:23 +00:00
Rename startscene to gamescene, Improve stats display
This commit is contained in:
+3
-2
@@ -4,13 +4,14 @@ import pi.Scene;
|
|||||||
import project.utils.StatsCollection;
|
import project.utils.StatsCollection;
|
||||||
import pi.Text;
|
import pi.Text;
|
||||||
|
|
||||||
public class StartScene extends Scene
|
public class GameScene extends Scene
|
||||||
{
|
{
|
||||||
|
|
||||||
public StartScene() {
|
public GameScene() {
|
||||||
StatsCollection.addStatsCollectionOutline(this);
|
StatsCollection.addStatsCollectionOutline(this);
|
||||||
Text[] texts = StatsCollection.createTexts(this);
|
Text[] texts = StatsCollection.createTexts(this);
|
||||||
|
|
||||||
|
|
||||||
camera().meter(10);
|
camera().meter(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ public class LoadingScene extends Scene
|
|||||||
subtitle.font(font);
|
subtitle.font(font);
|
||||||
add(subtitle);
|
add(subtitle);
|
||||||
}, (int i)->{
|
}, (int i)->{
|
||||||
Controller.transitionToScene(new StartScene());
|
Controller.transitionToScene(new GameScene());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import pi.Scene;
|
|||||||
import pi.actor.Image;
|
import pi.actor.Image;
|
||||||
import pi.Text;
|
import pi.Text;
|
||||||
import static pi.Controller.fonts;
|
import static pi.Controller.fonts;
|
||||||
|
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
public class StatsCollection {
|
public class StatsCollection {
|
||||||
public static void addStatsCollectionOutline(Scene scene) {
|
public static void addStatsCollectionOutline(Scene scene) {
|
||||||
|
|
||||||
Image moneyButton = new Image("images/pixui-pack/Buttons/Button_White_Outline (9).png");
|
Image moneyButton = new Image("images/pixui-pack/Buttons/Button_White_Outline (9).png");
|
||||||
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");
|
||||||
@@ -38,18 +38,21 @@ public class StatsCollection {
|
|||||||
Text money = new Text("0");
|
Text money = new Text("0");
|
||||||
money.color("#000000");
|
money.color("#000000");
|
||||||
money.font(font);
|
money.font(font);
|
||||||
money.size(1.2,2.5);
|
money.height(2.5);
|
||||||
money.center(1, 25);
|
money.center(-9, 25);
|
||||||
|
texts[0] = money;
|
||||||
Text kebabSold = new Text("0");
|
Text kebabSold = new Text("0");
|
||||||
kebabSold.color("#000000");
|
kebabSold.color("#000000");
|
||||||
kebabSold.font(font);
|
kebabSold.font(font);
|
||||||
kebabSold.size(1.2,2.5);
|
kebabSold.height(2.5);
|
||||||
kebabSold.center(-9, 25);
|
kebabSold.center(1, 25);
|
||||||
|
texts[1] = kebabSold;
|
||||||
Text waitingCustomers = new Text("0");
|
Text waitingCustomers = new Text("0");
|
||||||
waitingCustomers.color("#000000");
|
waitingCustomers.color("#000000");
|
||||||
waitingCustomers.font(font);
|
waitingCustomers.font(font);
|
||||||
waitingCustomers.size(1.2,2.5);
|
waitingCustomers.height(2.5);
|
||||||
waitingCustomers.center(11, 25);
|
waitingCustomers.center(11, 25);
|
||||||
|
texts[2] = waitingCustomers;
|
||||||
|
|
||||||
scene.add(money);
|
scene.add(money);
|
||||||
scene.add(kebabSold);
|
scene.add(kebabSold);
|
||||||
@@ -57,4 +60,30 @@ public class StatsCollection {
|
|||||||
|
|
||||||
return texts;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user