summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 23:15:21 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 23:15:21 +0200
commit6df3d5fe32be5493560cd4995ab91c2a4cef42fc (patch)
treeb8b88731ecb9572e966871d9944e5604ec45c62e /src/jrummikub/control
parent79bffeba5d42a5b228c52f69b9e0b4e88f2e60e8 (diff)
downloadJRummikub-6df3d5fe32be5493560cd4995ab91c2a4cef42fc.tar
JRummikub-6df3d5fe32be5493560cd4995ab91c2a4cef42fc.zip
Moved displaying of win panel in game control
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@270 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/GameControl.java24
-rw-r--r--src/jrummikub/control/RoundControl.java1
2 files changed, 17 insertions, 8 deletions
diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java
index 1d50bc6..9690bb4 100644
--- a/src/jrummikub/control/GameControl.java
+++ b/src/jrummikub/control/GameControl.java
@@ -1,9 +1,13 @@
package jrummikub.control;
+import java.util.ArrayList;
+import java.util.List;
+
import jrummikub.model.GameSettings;
import jrummikub.model.GameState;
import jrummikub.model.IRoundState;
import jrummikub.model.RoundState;
+import jrummikub.util.Connection;
import jrummikub.util.IListener;
import jrummikub.view.IView;
@@ -15,6 +19,7 @@ public class GameControl {
private IView view;
private RoundControl roundControl;
private GameState gameState;
+ private List<Connection> connections = new ArrayList<Connection>();
/**
* Constructor
@@ -31,18 +36,18 @@ public class GameControl {
gameState = new GameState();
gameState.setFirstRoundFirstPlayer((int)(Math.random() * gameSettings.getPlayerList().size()));
- view.getNewGameEvent().add(new IListener() {
+ connections.add(view.getNewRoundEvent().add(new IListener() {
@Override
public void handle() {
startRound();
}
- });
- view.getQuitEvent().add(new IListener() {
+ }));
+ connections.add(view.getFinalScoreEvent().add(new IListener() {
@Override
public void handle() {
- quitProgram();
+ finalScore();
}
- });
+ }));
}
/**
@@ -67,14 +72,19 @@ public class GameControl {
@Override
public void handle() {
- roundControl = null;
+ endOfRound();
}
});
roundControl.startRound();
}
+
+ private void endOfRound() {
+ roundControl = null;
+ view.enableWinPanel(true);
+ }
- private void quitProgram() {
+ private void finalScore() {
System.exit(0);
}
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index 440e581..1829725 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -242,7 +242,6 @@ public class RoundControl {
c.remove();
}
endOfRoundEvent.emit();
- view.enableWinPanel(true);
roundFinished = true;
}
}