X-Git-Url: https://troll.desast.re/troll.git/blobdiff_plain/00ef746e66b9aa761ca570cffea2a695f007fd9e..2e02ad69d3b3c4e270682b31969f6662f2aaa101:/src/main/java/com/codingame/game/Referee.java?ds=sidebyside diff --git a/src/main/java/com/codingame/game/Referee.java b/src/main/java/com/codingame/game/Referee.java index 5b6ec3a..7efe7b3 100644 --- a/src/main/java/com/codingame/game/Referee.java +++ b/src/main/java/com/codingame/game/Referee.java @@ -134,6 +134,16 @@ public class Referee extends AbstractReferee { .setFillColor(0x7f3f00) .setAnchor(0.5); + player.message = graphicEntityModule.createText() + .setX(p0 ? 15 : 1920-15) + .setY(680) + .setZIndex(1) + .setFontSize(40) + .setStrokeColor(0x000000) + .setFillColor(0xffbf7f) + .setAnchorX(p0 ? 0 : 1) + .setAnchorY(1); + player.castle = graphicEntityModule.createSprite() .setImage("castle.png") .setTint(player.getColorToken()) @@ -150,7 +160,6 @@ public class Referee extends AbstractReferee { .setFillColor(0x12322a) .setAnchor(0.5) .setAlpha(0); - } } @@ -266,6 +275,11 @@ public class Referee extends AbstractReferee { player.setScore(-1); endGame(); } + + player.message + .setText(player.getMessageString()); + // .setAnchorX(/*player == p0 ? 0 : */ 1); + graphicEntityModule.commitEntityState(0, player.message); } if (delta > 0) { @@ -304,23 +318,25 @@ public class Referee extends AbstractReferee { } private void endGame() { - gameManager.endGame(); + if (! gameManager.isGameEnd()) { + gameManager.endGame(); - if (p0.getScore() > p1.getScore()) { - gameManager.addToGameSummary(GameManager.formatSuccessMessage(p0.getNicknameToken() + " wins")); - destroyPlayer(p1); - } - else if (p0.getScore() < p1.getScore()) { - gameManager.addToGameSummary(GameManager.formatSuccessMessage(p1.getNicknameToken() + " wins")); - destroyPlayer(p0); - } - else if (p0.getScore() < 0) { - gameManager.addToGameSummary(GameManager.formatErrorMessage("Everybody loses!")); - destroyPlayer(p0); - destroyPlayer(p1); - } - else { - gameManager.addToGameSummary("Draw."); + if (p0.getScore() > p1.getScore()) { + gameManager.addToGameSummary(GameManager.formatSuccessMessage(p0.getNicknameToken() + " wins")); + destroyPlayer(p1); + } + else if (p0.getScore() < p1.getScore()) { + gameManager.addToGameSummary(GameManager.formatSuccessMessage(p1.getNicknameToken() + " wins")); + destroyPlayer(p0); + } + else if (p0.getScore() < 0) { + gameManager.addToGameSummary(GameManager.formatErrorMessage("Everybody loses!")); + destroyPlayer(p0); + destroyPlayer(p1); + } + else { + gameManager.addToGameSummary("Draw."); + } } } }