From 511b1139eae65e7eaae24596d76c2835346b3884 Mon Sep 17 00:00:00 2001 From: Bennet Gerlach Date: Thu, 5 May 2011 21:46:58 +0200 Subject: Added collection stone click git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@159 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/TurnControl.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') 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() { + + @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(); -- cgit v1.2.3