-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChickenAttackerPlayersUITest.java
48 lines (37 loc) · 1.51 KB
/
ChickenAttackerPlayersUITest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ch.epfl.chacun;
import ch.epfl.chacun.gui.PlayersUI;
import javafx.application.Application;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.util.Map;
import java.util.stream.Collectors;
public final class ChickenAttackerPlayersUITest extends Application {
public static void main(String[] args) { launch(args); }
@Override
public void start(Stage primaryStage) {
var playerNames = Map.of(PlayerColor.RED, "Rose",
PlayerColor.BLUE, "Bernard");
var playerColors = playerNames.keySet().stream()
.sorted()
.toList();
var tilesByKind = Tiles.TILES.stream()
.collect(Collectors.groupingBy(Tile::kind));
var tileDecks =
new TileDecks(tilesByKind.get(Tile.Kind.START),
tilesByKind.get(Tile.Kind.NORMAL),
tilesByKind.get(Tile.Kind.MENHIR));
var textMaker = new TextMakerFr(playerNames);
var gameState =
GameState.initial(playerColors,
tileDecks,
textMaker);
var gameStateO = new SimpleObjectProperty<>(gameState);
var playersNode = PlayersUI.create(gameStateO, textMaker);
var rootNode = new BorderPane(playersNode);
primaryStage.setScene(new Scene(rootNode));
primaryStage.setTitle("ChaCuN test");
primaryStage.show();
}
}