Skip to content

Commit 07d5c0a

Browse files
committed
re-set jsonconfs
1 parent e5450ea commit 07d5c0a

File tree

8 files changed

+60
-30
lines changed

8 files changed

+60
-30
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ buildNumber.properties
103103

104104
### Client and Server settings ###
105105
#JSONconf folder
106-
JSONconf/ClientSettings.json
107-
JSONconf/ServerSettings.json
106+
#JSONconf/ClientSettings.json
107+
#JSONconf/ServerSettings.json
108108

109109
# End of https://www.gitignore.io/api/maven,intellij,sonarqube

JSONconf/ClientSettings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"serverAddress" : "127.0.0.1",
3+
"clientAddress" : "127.0.0.1",
4+
"port" : 4242
5+
}

JSONconf/ServerSettings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"serverAddress" : "127.0.0.1",
3+
"port" : 4242
4+
}

src/main/java/it/polimi/ingsw/view/cards/VPrivateObjectiveCard.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import it.polimi.ingsw.view.exceptions.ColorIncompatibleException;
44
import it.polimi.ingsw.view.other_elements.VColor;
55
import javafx.scene.image.ImageView;
6+
import javafx.scene.layout.Pane;
67

78
import static it.polimi.ingsw.inputoutput.IOManager.*;
89

@@ -24,14 +25,14 @@ public String toString() {
2425
return newline + this.color + this.getDescription() + VColor.RESET + newline ;
2526
}
2627

27-
public ImageView toGUI() {
28+
public Pane toGUI() {
2829
String number = null;
2930
try {
3031
number = "" + getPrivateObjectiveNumber(this.color);
3132
} catch (ColorIncompatibleException e) {
3233
println("Colore carta obiettivo privato non valido.");
3334
errorExit();
3435
}
35-
return getImage(private_obj_path + "pri" + number + ".jpg");
36+
return new Pane(getImage(private_obj_path + "pri" + number + ".jpg"));
3637
}
3738
}

src/main/java/it/polimi/ingsw/view/cards/VPublicObjectiveCard.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import it.polimi.ingsw.view.exceptions.NameIncompatibleException;
44
import javafx.scene.image.ImageView;
5+
import javafx.scene.layout.Pane;
56

67
import static it.polimi.ingsw.inputoutput.IOManager.*;
78

@@ -23,16 +24,14 @@ public String toString() {
2324
return newline + super.getName() + " " + "Punti: " + points + newline + this.getDescription() + newline;
2425
}
2526

26-
public ImageView toGUI() {
27+
public Pane toGUI() {
2728
String number = null;
28-
2929
try {
3030
number = "" + getPublicObjectiveNumber(this.getName());
3131
} catch (NameIncompatibleException e) {
3232
println("Nome della carta non valido.");
3333
errorExit();
3434
}
35-
36-
return getImage(public_obj_path + "pub" + number + ".jpg");
35+
return new Pane(getImage(public_obj_path + "pub" + number + ".jpg"));
3736
}
3837
}

src/main/java/it/polimi/ingsw/view/game_elements/VCurrentDice.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public FlowPane toGUI() {
4747
for(VDice vd : this.dice)
4848
if (vd != null)
4949
currentDice.getChildren().add(vd.toGUI());
50+
else currentDice.getChildren().add(VDice.slotDice());
5051

5152
return currentDice;
5253
}

src/main/java/it/polimi/ingsw/view/game_elements/VGame.java

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
import it.polimi.ingsw.view.cards.*;
44
import it.polimi.ingsw.view.exceptions.TooManyPlayersException;
5+
import javafx.geometry.Insets;
6+
import javafx.geometry.Pos;
57
import javafx.scene.Group;
6-
import javafx.scene.layout.FlowPane;
7-
import javafx.scene.layout.GridPane;
8+
import javafx.scene.layout.*;
89

910
import java.util.ArrayList;
1011

11-
import static it.polimi.ingsw.inputoutput.IOManager.getInt;
12-
import static it.polimi.ingsw.inputoutput.IOManager.newline;
13-
import static it.polimi.ingsw.inputoutput.IOManager.println;
12+
import static it.polimi.ingsw.inputoutput.IOManager.*;
1413

1514
public class VGame {
1615
private final static int maxPlayer = 4;
@@ -62,7 +61,7 @@ public void addVPlayer(VPlayer player) throws TooManyPlayersException { // add a
6261

6362
public void setScore(String playerName, int score) {
6463
for(VPlayer vp : this.players)
65-
if (vp.getName() == playerName)
64+
if (vp.getName().equals(playerName))
6665
vp.setScore(score);
6766
}
6867

@@ -124,31 +123,52 @@ public String toString() {
124123
}
125124

126125
public Group toGUI() {
127-
GridPane grid = new GridPane();
126+
BorderPane organizer = new BorderPane();
128127
Group game = new Group();
129128
VPlayer clientPlayer = null;
130129

130+
HBox diceChain = new HBox();
131+
HBox playersChain = new HBox();
132+
HBox objCardsChain = new HBox();
133+
134+
diceChain.setMaxWidth(1000);
135+
//diceChain.set
136+
//diceChain.getChildren().add(this.roundTrack.toGUI());
137+
diceChain.getChildren().add(this.dice.toGUI());
138+
131139
for (VPlayer p : this.players)
132140
if (this.clientPlayer.equals(p.getName())) {
133141
clientPlayer = p;
134-
grid.add(clientPlayer.toGUI(), 0, 0);
135-
grid.add(clientPlayer.getvPrivateObjectives().toGUI(), 0, 1);
142+
playersChain.getChildren().add(clientPlayer.toGUI());
143+
objCardsChain.getChildren().add(clientPlayer.getvPrivateObjectives().toGUI());
136144
}
137145

138-
for (int i = 0; i < this.players.size(); i++)
139-
if (this.players.get(i) != clientPlayer) {
140-
grid.add(this.players.get(i).toGUI(), i + 1, 0);
146+
147+
for (VPublicObjectiveCard card : publicObjectives) {
148+
objCardsChain.getChildren().add(card.toGUI());
149+
150+
}
151+
152+
153+
int i = 1;
154+
for (VPlayer p : this.players)
155+
if (p != clientPlayer) {
156+
playersChain.getChildren().add(p.toGUI());
157+
i++;
141158
}
142159

143-
grid.add(this.dice.toGUI(), 1, 1);
160+
organizer.setTop(playersChain);
161+
organizer.setCenter(objCardsChain);
162+
organizer.setBottom(diceChain);
163+
164+
playersChain.setAlignment(Pos.CENTER);
165+
objCardsChain.setAlignment(Pos.CENTER);
166+
objCardsChain.setSpacing(thinPadding);
167+
diceChain.setAlignment(Pos.CENTER);
144168

145-
FlowPane publicObjs = new FlowPane();
146-
for (VPublicObjectiveCard card : publicObjectives)
147-
publicObjs.getChildren().add(card.toGUI());
169+
organizer.setPadding(new Insets(thinPadding));
148170

149-
grid.add(publicObjs, 2, 1);
150171

151-
game.getChildren().add(grid);
152-
return game;
172+
return new Group(organizer);
153173
}
154174
}

src/main/java/it/polimi/ingsw/view/game_elements/VRoundTrack.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public String toString() {
4040

4141
public FlowPane toGUI() {
4242
FlowPane roundTrack = new FlowPane();
43-
for (int i = 0; i < this.track.length; i++)
44-
if (this.track[i] != null)
45-
roundTrack.getChildren().add(this.track[i].toGUI());
43+
for (VDice dice : this.track)
44+
if (dice != null)
45+
roundTrack.getChildren().add(dice.toGUI());
4646
else roundTrack.getChildren().add(VDice.slotDice());
4747

4848
return roundTrack;

0 commit comments

Comments
 (0)