diff options
-rw-r--r-- | src/jrummikub/control/TurnControl.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/jrummikub/control/TurnControl.java b/src/jrummikub/control/TurnControl.java index 5a12d27..7616e14 100644 --- a/src/jrummikub/control/TurnControl.java +++ b/src/jrummikub/control/TurnControl.java @@ -62,6 +62,15 @@ public class TurnControl { } })); + connections.add(view.getTablePanel().getStoneCollectionPanel() + .getStoneClickEvent().add(new IListener2<Stone, Boolean>() { + + @Override + public void handle(Stone stone, Boolean collect) { + collectionStoneClick(stone, collect); + } + })); + view.getPlayerPanel().getHandPanel().setStones(hand.clone()); view.enableStartTurnPanel(false); @@ -89,6 +98,16 @@ public class TurnControl { view.setSelectedStones(selectedStones); } + private void collectionStoneClick(Stone stone, boolean collect) { + selectedStones.remove(stone); + + if (collect) { + selectedStones.add(stone); + } + + view.setSelectedStones(selectedStones); + } + private void endOfTurn() { timer.stopTimer(); endOfTurnEvent.emit(); |