summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBennet Gerlach <bennet_gerlach@web.de>2011-05-05 21:46:58 +0200
committerBennet Gerlach <bennet_gerlach@web.de>2011-05-05 21:46:58 +0200
commit511b1139eae65e7eaae24596d76c2835346b3884 (patch)
treeeebe5fa576eaf779803348321d605f06c026296c
parent776db0e4f7ba3ca6f53b5fbc06c4429dc2e1ff90 (diff)
downloadJRummikub-511b1139eae65e7eaae24596d76c2835346b3884.tar
JRummikub-511b1139eae65e7eaae24596d76c2835346b3884.zip
Added collection stone click
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@159 72836036-5685-4462-b002-a69064685172
-rw-r--r--src/jrummikub/control/TurnControl.java19
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();