summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/network
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-20 04:39:54 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-20 04:39:54 +0200
commit74d8205f30732a8afd6aa45f859188b0a3d447e5 (patch)
treeee84072fa43cf0342c4d5eb59e232d8c5b4b1802 /src/jrummikub/control/network
parent477e8e9b82d6bcbec006914a22e05a2c18492869 (diff)
downloadJRummikub-74d8205f30732a8afd6aa45f859188b0a3d447e5.tar
JRummikub-74d8205f30732a8afd6aa45f859188b0a3d447e5.zip
Kommentare, Kommentare
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@509 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control/network')
-rw-r--r--src/jrummikub/control/network/GameOfferControl.java36
-rw-r--r--src/jrummikub/control/network/NetworkControl.java17
2 files changed, 33 insertions, 20 deletions
diff --git a/src/jrummikub/control/network/GameOfferControl.java b/src/jrummikub/control/network/GameOfferControl.java
index 42e3b8b..b513170 100644
--- a/src/jrummikub/control/network/GameOfferControl.java
+++ b/src/jrummikub/control/network/GameOfferControl.java
@@ -36,6 +36,27 @@ public class GameOfferControl extends AbstractGameBeginControl {
super(connectionControl, view, new GameData(UUID.randomUUID(), settings),
SettingsMode.NETWORK_OFFER);
+ addConnectionControlListeners(connectionControl, settings);
+
+ connections.add(view.getSettingsPanel().getStartGameEvent()
+ .add(new IListener() {
+ @Override
+ public void handle() {
+ List<PlayerSettings> players = gameData.getGameSettings()
+ .getPlayerList();
+ for (PlayerSettings s : players) {
+ if (s.getType() == Type.NETWORK) {
+ startGame();
+ return;
+ }
+ }
+ }
+ }));
+ }
+
+ private void addConnectionControlListeners(
+ final IConnectionControl connectionControl,
+ final GameSettings settings) {
connections.add(connectionControl.getGameJoinEvent().add(
new IListener1<String>() {
@Override
@@ -71,21 +92,6 @@ public class GameOfferControl extends AbstractGameBeginControl {
connectionControl.offerGame(gameData);
}
}));
-
- connections.add(view.getSettingsPanel().getStartGameEvent()
- .add(new IListener() {
- @Override
- public void handle() {
- List<PlayerSettings> players = gameData.getGameSettings()
- .getPlayerList();
- for (PlayerSettings s : players) {
- if (s.getType() == Type.NETWORK) {
- startGame();
- return;
- }
- }
- }
- }));
}
/**
diff --git a/src/jrummikub/control/network/NetworkControl.java b/src/jrummikub/control/network/NetworkControl.java
index 0d0fbe9..4c03923 100644
--- a/src/jrummikub/control/network/NetworkControl.java
+++ b/src/jrummikub/control/network/NetworkControl.java
@@ -57,11 +57,11 @@ public class NetworkControl {
* Creates a new network control
*
* @param loginData
- * user's login data
+ * user's login data
* @param connectionControl
- * current connection for events and messages
+ * current connection for events and messages
* @param view
- * for events and handlers
+ * for events and handlers
*/
public NetworkControl(final LoginData loginData,
IConnectionControl connectionControl, SaveControl saveControl,
@@ -108,7 +108,7 @@ public class NetworkControl {
* Adds the listeners for connection control events
*
* @param view
- * view for events
+ * view for events
*/
public void addConnectionControlListeners(final IView view) {
connections.add(connectionControl.getGameOfferEvent().add(
@@ -260,6 +260,12 @@ public class NetworkControl {
return stopNetworkEvent;
}
+ /**
+ * The back to login event is emitted when the player aborted the connecting
+ * process or when a connection error has occured and been acknowledged
+ *
+ * @return the event
+ */
public IEvent getBackToLoginEvent() {
return backToLoginEvent;
}
@@ -293,7 +299,8 @@ public class NetworkControl {
if (gameOfferControl != null) {
return;
}
- gameOfferControl = new GameOfferControl(connectionControl, settings, view);
+ gameOfferControl = new GameOfferControl(connectionControl, settings,
+ view);
gameOfferControl.getBackEvent().add(new IListener() {
@Override
public void handle() {