Commit 300cd316 authored by Jo's avatar Jo
Browse files

Merge branch 'bugfin' into 'develop'

Bugfin

See merge request !178
parents 2eb37cee be8c5cfe
......@@ -225,13 +225,19 @@ public class IHMTableFacade implements IIHMTableToIHMMain, IIHMTableToData {
public void finishGame(StatGame stGame) {
String sMessage;
// Game lost.
if(!stGame.getWinner().getPlayerName().equals(facadeData.getMyPublicUserProfile().getPlayerName()))
String winner = stGame.getWinner().getPlayerName();
if(!winner.equals(facadeData.getMyPublicUserProfile().getPlayerName()))
{
sMessage = "Defeat! You should train against AI! Hahahah!";
} else {
// Game won.
sMessage = "Victory! I'm proud of you General!";
// Check if the player is a spectator
if(controller.isSpectator)
{
sMessage = winner.concat(" won the game!");
}else{
// Game won.
sMessage = "Victory! I'm proud of you General!";
}
}
// Display popup.
controller.displayFinishPopup(sMessage);
......@@ -242,6 +248,8 @@ public class IHMTableFacade implements IIHMTableToIHMMain, IIHMTableToData {
*/
@Override
public void opponentHasLeftGame() {
if(controller.isSpectator)
return;
// Display popup.
controller.displayFinishPopup("Your opponent has left this game!");
}
......@@ -260,6 +268,8 @@ public class IHMTableFacade implements IIHMTableToIHMMain, IIHMTableToData {
*/
@Override
public void connectionLostWithOpponent() {
if(controller.isSpectator)
return;
controller.displayFinishPopup("Connection has been lost with your opponent");
}
......
......@@ -288,7 +288,7 @@ public class InGameGUIController {
@FXML
private Pane paneChat;
private boolean isSpectator = false;
public boolean isSpectator = false;
/**
* Set the IHM Table facade.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment