Skip to content

Commit 08cf0fb

Browse files
authored
Merge pull request #101 from aclonegeek/gui
GUI
2 parents 682ea5a + 5730ed0 commit 08cf0fb

31 files changed

+1102
-301
lines changed

src/main/java/core/GameController.java

+276-192
Large diffs are not rendered by default.

src/main/java/core/GameModel.java

+411-30
Large diffs are not rendered by default.

src/main/java/core/GameScreen.fxml

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<?import javafx.scene.control.Button?>
4+
<?import javafx.scene.control.ChoiceBox?>
45
<?import javafx.scene.control.Label?>
56
<?import javafx.scene.control.ListView?>
7+
<?import javafx.scene.control.TextArea?>
68
<?import javafx.scene.layout.AnchorPane?>
79

810
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="720.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="core.GameController">
@@ -11,37 +13,44 @@
1113
<children>
1214
<Label fx:id="p1NameLabel" layoutX="126.0" layoutY="14.0" />
1315
<Label fx:id="p1StrategyLabel" layoutX="126.0" layoutY="36.0" />
14-
<Label fx:id="p1HandCountLabel" layoutX="126.0" layoutY="71.0" />
15-
<Button fx:id="drawButton" layoutX="1216.0" layoutY="9.0" mnemonicParsing="false" text="Draw" />
16-
<Button layoutX="1216.0" layoutY="38.0" mnemonicParsing="false" text="Hint" />
17-
<Button fx:id="finishButton" layoutX="1209.0" layoutY="66.0" mnemonicParsing="false" text="Finish" />
16+
<Label fx:id="p1HandCountLabel" layoutX="260.0" layoutY="15.0" />
17+
<Button fx:id="drawButton" layoutX="1159.0" layoutY="9.0" mnemonicParsing="false" text="Draw" />
18+
<Button fx:id="finishButton" layoutX="1212.0" layoutY="9.0" mnemonicParsing="false" text="Finish" />
19+
<Button fx:id="nextAIMoveButton" layoutX="1167.0" layoutY="38.0" mnemonicParsing="false" text="Play Next AI" />
1820
<ListView fx:id="p1HandListView" layoutX="289.0" orientation="HORIZONTAL" prefHeight="100.0" prefWidth="864.0" />
21+
<Label layoutX="14.0" layoutY="55.0" text="Current Player" />
22+
<Label fx:id="currentPlayerLabel" layoutX="14.0" layoutY="75.0" />
23+
<Label fx:id="timerTextLabel" layoutX="1184.0" layoutY="71.0" text="Timer:" visible="false" />
24+
<Label fx:id="timerLabel" layoutX="1235.0" layoutY="71.0" prefHeight="14.0" prefWidth="20.0" />
25+
<ChoiceBox fx:id="stockChoiceBox" layoutX="15.0" layoutY="2.0" prefHeight="24.0" prefWidth="76.0" />
26+
<Button fx:id="rigDrawButton" layoutX="14.0" layoutY="29.0" mnemonicParsing="false" text="Rig Draw" />
1927
</children>
2028
</AnchorPane>
2129
<AnchorPane layoutY="100.0" prefHeight="520.0" prefWidth="126.0">
2230
<children>
23-
<Label fx:id="p2NameLabel" layoutX="52.0" layoutY="486.0" rotate="270.0" />
24-
<Label fx:id="p2StrategyLabel" layoutX="74.0" layoutY="486.0" rotate="270.0" />
25-
<Label fx:id="p2HandCountLabel" layoutX="14.0" layoutY="486.0" />
31+
<Label fx:id="p2NameLabel" layoutX="6.0" layoutY="400.0" />
32+
<Label fx:id="p2StrategyLabel" layoutX="6.0" layoutY="422.0" />
33+
<Label fx:id="p2HandCountLabel" layoutX="96.0" layoutY="400.0" />
2634
<ListView fx:id="p2HandListView" prefHeight="393.0" prefWidth="126.0" />
2735
</children>
2836
</AnchorPane>
2937
<AnchorPane prefHeight="100.0" prefWidth="1280.0">
3038
<children>
3139
<Label fx:id="p3NameLabel" layoutX="126.0" layoutY="50.0" />
3240
<Label fx:id="p3StrategyLabel" layoutX="126.0" layoutY="72.0" />
33-
<Label fx:id="p3HandCountLabel" layoutX="126.0" layoutY="14.0" />
41+
<Label fx:id="p3HandCountLabel" layoutX="250.0" layoutY="75.0" />
3442
<ListView fx:id="p3HandListView" layoutX="276.0" orientation="HORIZONTAL" prefHeight="100.0" prefWidth="878.0" />
3543
</children>
3644
</AnchorPane>
3745
<AnchorPane layoutX="1154.0" layoutY="100.0" prefHeight="520.0" prefWidth="126.0">
3846
<children>
39-
<Label fx:id="p4NameLabel" layoutX="24.0" layoutY="23.0" rotate="90.0" />
40-
<Label fx:id="p4StrategyLabel" layoutX="2.0" layoutY="27.0" rotate="90.0" />
41-
<Label fx:id="p4HandCountLabel" layoutX="73.0" layoutY="106.0" />
47+
<Label fx:id="p4NameLabel" layoutX="4.0" layoutY="84.0" />
48+
<Label fx:id="p4StrategyLabel" layoutX="4.0" layoutY="106.0" />
49+
<Label fx:id="p4HandCountLabel" layoutX="96.0" layoutY="106.0" />
4250
<ListView fx:id="p4HandListView" layoutY="127.0" prefHeight="393.0" prefWidth="126.0" />
4351
</children>
4452
</AnchorPane>
45-
<ListView fx:id="tableListView" layoutX="126.0" layoutY="100.0" prefHeight="520.0" prefWidth="1028.0" />
53+
<ListView fx:id="tableListView" layoutX="126.0" layoutY="100.0" prefHeight="520.0" prefWidth="580.0" />
54+
<TextArea fx:id="outputArea" editable="false" layoutX="706.0" layoutY="100.0" prefHeight="520.0" prefWidth="448.0" />
4655
</children>
4756
</AnchorPane>

src/main/java/core/Main.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
public class Main {
44
public static void main(String[] args) {
5-
Game game = new Game();
6-
game.start();
5+
View.main(args);
76
}
87
}

src/main/java/core/PlayBehaviour.java

+1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ protected ArrayList<Meld> playUsingHandAndTable_AddToPotentialMeldsInHand(Hand h
237237
splitMeld.removeTile(0);
238238
workspace.add(splitMeld);
239239
workspace.add(potentialMeld);
240+
hand.remove(potentialMeld);
240241
}
241242
}
242243
}

src/main/java/core/Player.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public Player() {
2828
abstract ArrayList<Meld> play(ArrayList<Meld> tableState);
2929

3030
public void add(Tile tile) {
31-
System.out.println(this.name + " drew " + tile.toString());
31+
// System.out.println(this.name + " drew " + tile.toString());
3232
this.hand.add(tile);
3333
}
3434

src/main/java/core/Player1.java

-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ protected ArrayList<Meld> play(ArrayList<Meld> tableState) {
3030
if (workspace != null) {
3131
this.initialMove = false;
3232
this.drawing = false;
33-
System.out.println(this.name + " played tiles");
3433
} else {
3534
this.drawing = true;
3635
}
3736
this.notifyObservers();
38-
System.out.println(this.toString());
3937
return workspace;
4038
}
4139
}

src/main/java/core/Player2.java

-3
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,15 @@ protected ArrayList<Meld> play(ArrayList<Meld> tableState) {
3131
} else {
3232
this.drawing = true;
3333
this.notifyObservers();
34-
System.out.println(this.toString());
3534
return null;
3635
}
3736
if (workspace != null) {
3837
this.initialMove = false;
3938
this.drawing = false;
40-
System.out.println(this.name + " played tiles");
4139
} else {
4240
this.drawing = true;
4341
}
4442
this.notifyObservers();
45-
System.out.println(this.toString());
4643
return workspace;
4744
}
4845
}

src/main/java/core/Player3.java

-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ protected ArrayList<Meld> play(ArrayList<Meld> tableState) {
4040
}
4141
if (workspace != null) {
4242
this.initialMove = false;
43-
System.out.println(this.name + " played tiles");
4443
}
4544
this.lowestHandCount = 100;
46-
System.out.println(this.toString());
4745
return workspace;
4846
}
4947
}

src/main/java/core/Player4.java

-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ protected ArrayList<Meld> play(ArrayList<Meld> tableState) {
3030
if (workspace != null) {
3131
this.initialMove = false;
3232
this.notifyObservers();
33-
System.out.println(this.name + " played tiles");
3433
}
3534
this.lowestHandCount = 100;
36-
System.out.println(this.toString());
3735
return workspace;
3836
}
3937
}

0 commit comments

Comments
 (0)