merge dev into test #33
@@ -1,9 +1,9 @@
|
|||||||
package pp.mdga.client;
|
package pp.mdga.client;
|
||||||
|
|
||||||
import com.jme3.app.SimpleApplication;
|
import com.jme3.app.SimpleApplication;
|
||||||
|
import com.jme3.system.AppSettings;
|
||||||
import com.simsilica.lemur.GuiGlobals;
|
import com.simsilica.lemur.GuiGlobals;
|
||||||
import pp.mdga.client.acoustic.AcousticHandler;
|
import pp.mdga.client.acoustic.AcousticHandler;
|
||||||
import com.jme3.system.AppSettings;
|
|
||||||
import pp.mdga.client.dialog.JoinDialog;
|
import pp.mdga.client.dialog.JoinDialog;
|
||||||
import pp.mdga.client.view.*;
|
import pp.mdga.client.view.*;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public void exit() {
|
|||||||
* This method will be used to initialize the game and all necessary objects.
|
* This method will be used to initialize the game and all necessary objects.
|
||||||
*/
|
*/
|
||||||
public void initializeGame() {
|
public void initializeGame() {
|
||||||
for (Map.Entry<Integer, Player> entry: this.logic.getGame().getPlayers().entrySet()) {
|
for (Map.Entry<Integer, Player> entry : this.logic.getGame().getPlayers().entrySet()) {
|
||||||
this.logic.getGame().getBoard().addPlayerData(entry.getValue().getColor(), new PlayerData(entry.getValue().getColor()));
|
this.logic.getGame().getBoard().addPlayerData(entry.getValue().getColor(), new PlayerData(entry.getValue().getColor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ public void received(SelectTSKMessage msg, int from) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.logic.getGame().getPlayerById(from).getColor() != Color.NONE) {
|
if (this.logic.getGame().getPlayerById(from).getColor() != Color.NONE) {
|
||||||
this.logic.getServerSender().broadcast(new UpdateTSKMessage(from, this.logic.getGame().getPlayerById(from).getColor(), false));
|
this.logic.getServerSender().broadcast(new UpdateTSKMessage(from, this.logic.getGame().getPlayerById(from).getColor(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public void received(DeselectTSKMessage msg, int from) {
|
|||||||
@Override
|
@Override
|
||||||
public void received(LobbyReadyMessage msg, int from) {
|
public void received(LobbyReadyMessage msg, int from) {
|
||||||
//assign a free color
|
//assign a free color
|
||||||
if(this.logic.getGame().getPlayerById(from).getColor() == Color.NONE) {
|
if (this.logic.getGame().getPlayerById(from).getColor() == Color.NONE) {
|
||||||
ArrayList<Color> colors = new ArrayList<>();
|
ArrayList<Color> colors = new ArrayList<>();
|
||||||
colors.add(Color.ARMY);
|
colors.add(Color.ARMY);
|
||||||
colors.add(Color.AIRFORCE);
|
colors.add(Color.AIRFORCE);
|
||||||
@@ -125,12 +125,12 @@ public void received(LobbyReadyMessage msg, int from) {
|
|||||||
colors.add(Color.CYBER);
|
colors.add(Color.CYBER);
|
||||||
|
|
||||||
for (Map.Entry<Integer, Player> entry : this.logic.getGame().getPlayers().entrySet()) {
|
for (Map.Entry<Integer, Player> entry : this.logic.getGame().getPlayers().entrySet()) {
|
||||||
if(colors.contains(entry.getValue().getColor())) {
|
if (colors.contains(entry.getValue().getColor())) {
|
||||||
colors.remove(entry.getValue().getColor());
|
colors.remove(entry.getValue().getColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(colors.size() < 1) {
|
if (colors.size() < 1) {
|
||||||
throw new RuntimeException("can not assign a color");
|
throw new RuntimeException("can not assign a color");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user