From b62babba458c703c4a7597bf4640a936227d734a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jun 2011 03:52:25 +0200 Subject: Disable pause function in network mode git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@536 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/RoundControl.java | 11 +++++++++-- src/jrummikub/control/network/NetworkRoundControl.java | 2 +- src/jrummikub/control/network/NetworkTurnControl.java | 4 ---- src/jrummikub/control/turn/AbstractTurnControl.java | 6 ++++++ src/jrummikub/control/turn/ITurnControl.java | 10 +++++++++- 5 files changed, 25 insertions(+), 8 deletions(-) (limited to 'src/jrummikub/control') diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java index 71980e1..62a57cf 100644 --- a/src/jrummikub/control/RoundControl.java +++ b/src/jrummikub/control/RoundControl.java @@ -76,6 +76,11 @@ public class RoundControl { private Event1 endOfRoundEvent = new Event1(); protected List connections = new ArrayList(); private boolean roundFinished; + private boolean mayPause; + + public RoundControl(IRoundState roundState, IView view) { + this(roundState, view, true); + } /** * Create a new RoundControl using the given gameState and view @@ -85,9 +90,10 @@ public class RoundControl { * @param view * view used for user interaction */ - public RoundControl(IRoundState roundState, IView view) { + protected RoundControl(IRoundState roundState, IView view, boolean mayPause) { this.roundState = roundState; this.view = view; + this.mayPause = mayPause; } /** @@ -221,7 +227,8 @@ public class RoundControl { view.getPlayerPanel().setEndTurnMode(turnMode); } - turnControl.setup(new ITurnControl.TurnInfo(roundState, turnMode), + turnControl.setup( + new ITurnControl.TurnInfo(roundState, turnMode, mayPause), roundState.getGameSettings(), view); turnControl.getEndOfTurnEvent().add( new IListener2() { diff --git a/src/jrummikub/control/network/NetworkRoundControl.java b/src/jrummikub/control/network/NetworkRoundControl.java index afe6a6e..95b5885 100644 --- a/src/jrummikub/control/network/NetworkRoundControl.java +++ b/src/jrummikub/control/network/NetworkRoundControl.java @@ -15,7 +15,7 @@ public class NetworkRoundControl extends RoundControl { public NetworkRoundControl(IRoundState roundState, IView view, final IConnectionControl connectionControl, boolean startActive) { - super(roundState, view); + super(roundState, view, false); this.connectionControl = connectionControl; currentlyActive = startActive; diff --git a/src/jrummikub/control/network/NetworkTurnControl.java b/src/jrummikub/control/network/NetworkTurnControl.java index 35002f7..a884fda 100644 --- a/src/jrummikub/control/network/NetworkTurnControl.java +++ b/src/jrummikub/control/network/NetworkTurnControl.java @@ -53,8 +53,4 @@ public class NetworkTurnControl extends AbstractTurnControl { @Override protected void timeOut() { } - - @Override - protected void pauseTurn() { - } } diff --git a/src/jrummikub/control/turn/AbstractTurnControl.java b/src/jrummikub/control/turn/AbstractTurnControl.java index d64ee62..9bdd6e2 100644 --- a/src/jrummikub/control/turn/AbstractTurnControl.java +++ b/src/jrummikub/control/turn/AbstractTurnControl.java @@ -59,6 +59,10 @@ public abstract class AbstractTurnControl implements ITurnControl { } protected void pauseTurn() { + if (!turnInfo.isMayPause()) { + return; + } + timer.stopTimer(); view.enablePauseMode(true); } @@ -108,6 +112,8 @@ public abstract class AbstractTurnControl implements ITurnControl { resumeTurn(); } })); + + view.setMayPause(info.isMayPause()); } protected void cleanUp() { diff --git a/src/jrummikub/control/turn/ITurnControl.java b/src/jrummikub/control/turn/ITurnControl.java index 6994466..ab4d6ae 100644 --- a/src/jrummikub/control/turn/ITurnControl.java +++ b/src/jrummikub/control/turn/ITurnControl.java @@ -73,6 +73,8 @@ public interface ITurnControl { private TurnMode turnMode; + private boolean mayPause; + /** * Creates a new TurnInfo instance * @@ -81,7 +83,7 @@ public interface ITurnControl { * @param turnMode * the turn mode */ - public TurnInfo(IRoundState roundState, TurnMode turnMode) { + public TurnInfo(IRoundState roundState, TurnMode turnMode, boolean mayPause) { this.roundState = roundState; oldTable = roundState.getTable(); @@ -91,6 +93,8 @@ public interface ITurnControl { this.hand = (IHand) oldHand.clone(); this.turnMode = turnMode; + + this.mayPause = mayPause; } public IRoundState getRoundState() { @@ -150,5 +154,9 @@ public interface ITurnControl { public TurnMode getTurnMode() { return turnMode; } + + public boolean isMayPause() { + return mayPause; + } } } \ No newline at end of file -- cgit v1.2.3