corrected the server based validation in 'WaitState' and 'ServerGameLogic' and 'battleship.properties' and 'battleship_de.properties' and reformatted 'SeaSynchronizer'
corrected the 'ServerGameLogic' so it will send new GameLogic and will be still in EditorState, when presented with an invalid map and added in the properties the keys writen in 'WaitState' and added the 'ReceivedGameLogic', to receive new GameDetails
This commit is contained in:
@@ -122,6 +122,7 @@ private Spatial handleHit(Shot shot) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* this method attach fire to the ship, if it is hit
|
* this method attach fire to the ship, if it is hit
|
||||||
|
*
|
||||||
* @param shot the shot, that hit the ship
|
* @param shot the shot, that hit the ship
|
||||||
* @return the Fire
|
* @return the Fire
|
||||||
*/
|
*/
|
||||||
@@ -280,12 +281,6 @@ private Spatial createDestroyer(Battleship ship) {
|
|||||||
model.scale(0.0001f);
|
model.scale(0.0001f);
|
||||||
model.move(0, 0.3f, 0);
|
model.move(0, 0.3f, 0);
|
||||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||||
//model.setMaterial(app.getAssetManager().loadMaterial("Models/Destroyer/10619_Battleship.mtl"));
|
|
||||||
//TODO
|
|
||||||
//Material m = new Material();
|
|
||||||
|
|
||||||
//m.setTexture("textureDestroyer",app.getAssetManager().loadTexture("Models/Destroyer/10619_Battleship.mtl"));
|
|
||||||
//model.setMaterial(m);
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
package pp.battleship.game.client;
|
package pp.battleship.game.client;
|
||||||
|
|
||||||
|
import pp.battleship.message.server.GameDetails;
|
||||||
import pp.battleship.message.server.StartBattleMessage;
|
import pp.battleship.message.server.StartBattleMessage;
|
||||||
|
|
||||||
import java.lang.System.Logger.Level;
|
import java.lang.System.Logger.Level;
|
||||||
@@ -38,4 +39,18 @@ public void receivedStartBattle(StartBattleMessage msg) {
|
|||||||
logic.setInfoText(msg.getInfoTextKey());
|
logic.setInfoText(msg.getInfoTextKey());
|
||||||
logic.setState(new BattleState(logic, msg.isMyTurn()));
|
logic.setState(new BattleState(logic, msg.isMyTurn()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the GameDetails message received from the server.
|
||||||
|
* If the map is invalid, the editor state is set.
|
||||||
|
*
|
||||||
|
* @param msg the GameDetails message received
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void receivedGameDetails(GameDetails msg) {
|
||||||
|
ClientGameLogic.LOGGER.log(Level.WARNING, "Invalid Map"); //NON-NLS
|
||||||
|
logic.setInfoText("map.invalid");
|
||||||
|
logic.setState(new EditorState(logic));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ public void received(MapMessage msg, int from) {
|
|||||||
LOGGER.log(Level.ERROR, "playerReady not allowed in {0}", state); //NON-NLS
|
LOGGER.log(Level.ERROR, "playerReady not allowed in {0}", state); //NON-NLS
|
||||||
else if (!verifyMap(msg, from)) {
|
else if (!verifyMap(msg, from)) {
|
||||||
LOGGER.log(Level.ERROR, "player submitted invalid map", state);
|
LOGGER.log(Level.ERROR, "player submitted invalid map", state);
|
||||||
|
send(getPlayerById(from), new GameDetails(config));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
playerReady(getPlayerById(from), msg.getShips());
|
playerReady(getPlayerById(from), msg.getShips());
|
||||||
|
|||||||
@@ -41,3 +41,4 @@ background.music.checkbox= Background music on/off
|
|||||||
background.music.volume= Background volume
|
background.music.volume= Background volume
|
||||||
player.submitted.invalid.map= invalid map submitted
|
player.submitted.invalid.map= invalid map submitted
|
||||||
local.server= instantiate local server
|
local.server= instantiate local server
|
||||||
|
map.invalid=The map is invalid
|
||||||
|
|||||||
@@ -41,4 +41,5 @@ background.music.checkbox= Musik an/aus
|
|||||||
background.music.volume= Musiklautstärke
|
background.music.volume= Musiklautstärke
|
||||||
player.submitted.invalid.map= Invalide karte gegeben
|
player.submitted.invalid.map= Invalide karte gegeben
|
||||||
local.server=Lokalen Server erstellen
|
local.server=Lokalen Server erstellen
|
||||||
|
map.invalid=Die Karte ist ungültig
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user