summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/network/NetworkTurnControl.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/jrummikub/control/network/NetworkTurnControl.java b/src/jrummikub/control/network/NetworkTurnControl.java
index 07d46ba..0f9c478 100644
--- a/src/jrummikub/control/network/NetworkTurnControl.java
+++ b/src/jrummikub/control/network/NetworkTurnControl.java
@@ -10,14 +10,28 @@ import jrummikub.util.IListener;
import jrummikub.util.IListener1;
import jrummikub.util.IListener2;
+/**
+ * Turn control for network games
+ */
public class NetworkTurnControl extends AbstractTurnControl {
private IConnectionControl connectionControl;
private Event1<IRoundState> stateUpdateEvent = new Event1<IRoundState>();
+ /**
+ * Creates new network turn control
+ *
+ * @param connectionControl
+ * the current connection control
+ */
public NetworkTurnControl(IConnectionControl connectionControl) {
this.connectionControl = connectionControl;
}
+ /**
+ * The state update event is emitted when the state is sent into the network
+ *
+ * @return the event
+ */
public IEvent1<IRoundState> getStateUpdateEvent() {
return stateUpdateEvent;
}
@@ -34,7 +48,8 @@ public class NetworkTurnControl extends AbstractTurnControl {
connections.add(connectionControl.getTurnEndEvent().add(
new IListener2<IRoundState, InvalidTurnInfo>() {
@Override
- public void handle(IRoundState state, InvalidTurnInfo invalidTurnInfo) {
+ public void handle(IRoundState state,
+ InvalidTurnInfo invalidTurnInfo) {
endOfTurn(state, invalidTurnInfo);
}
}));
@@ -48,7 +63,8 @@ public class NetworkTurnControl extends AbstractTurnControl {
timer.startTimer();
}
- private void endOfTurn(IRoundState roundState, InvalidTurnInfo invalidTurnInfo) {
+ private void endOfTurn(IRoundState roundState,
+ InvalidTurnInfo invalidTurnInfo) {
cleanUp();
endOfTurnEvent.emit(roundState, invalidTurnInfo);