From: JBM Date: Fri, 22 May 2020 21:30:55 +0000 (+0200) Subject: Repair gauges X-Git-Url: https://troll.desast.re/troll.git/commitdiff_plain/7a79f5dd9d36c100b9ec5dc7f3f76e1dd9a6731f?hp=9b7567a9665ab65123d5463c8a288eda917b1117 Repair gauges --- diff --git a/src/main/java/com/codingame/game/Referee.java b/src/main/java/com/codingame/game/Referee.java index b56cade..e6c941f 100644 --- a/src/main/java/com/codingame/game/Referee.java +++ b/src/main/java/com/codingame/game/Referee.java @@ -35,6 +35,7 @@ public class Referee extends AbstractReferee { } view.init(model); + gameManager.getPlayer(0).view = view.p0; gameManager.getPlayer(1).view = view.p1; @@ -61,6 +62,8 @@ public class Referee extends AbstractReferee { player.execute(); } + // SDK @#%^&! arbitrary sequence point: last input < first output + for (Player player : gameManager.getActivePlayers()) { Model.Player p = player.model; @@ -87,6 +90,7 @@ public class Referee extends AbstractReferee { } else if (stones > 0) { player.view.animateStones(stones); + player.view.updateStoneCounter(); } } catch (InvalidAction e) { diff --git a/src/main/java/com/codingame/game/View.java b/src/main/java/com/codingame/game/View.java index dd350fe..7f883aa 100644 --- a/src/main/java/com/codingame/game/View.java +++ b/src/main/java/com/codingame/game/View.java @@ -38,8 +38,6 @@ class View { int y = 220; Sprite border1 = graphicEntityModule.createSprite() - // .setX(x) - // .setY(y) .setImage("frame.png") .setAnchor(0.5) .setScale(p0 ? -1 : 1) @@ -47,15 +45,11 @@ class View { .setTint(colorToken); Sprite border2 = graphicEntityModule.createSprite() - // .setX(x) - // .setY(y) .setImage("frame_bg.png") .setAnchor(0.5) .setZIndex(20); Sprite avatarSprite = graphicEntityModule.createSprite() - // .setX(x) - // .setY(y) .setZIndex(21) .setImage(avatarToken) .setAnchor(0.5) @@ -74,13 +68,14 @@ class View { .setFillColor(0x7f3f00) .setAnchor(0.5); - stoneCounter = graphicEntityModule.createText("S") + stoneCounter = graphicEntityModule.createText() .setX(x) .setY(y+200) .setZIndex(20) .setFontSize(40) .setFillColor(0x7f3f00) .setAnchor(0.5); + updateStoneCounter(); message = graphicEntityModule.createText() .setX(p0 ? 15 : 1920-15) @@ -110,7 +105,7 @@ class View { .setAlpha(0); } - void setStone() { + void updateStoneCounter() { int stones = model.getStones(); if (stones <= 0) { stoneCounter.setText("Out of stones!"); @@ -197,6 +192,8 @@ class View { .setX(1980/2) .setY(980) .setFillColor(0xffffff); + + moveTroll(); } void moveTroll() {