Added EZGameControl.restartGameIn(seconds).

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@416 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2007-08-23 23:19:51 +00:00
parent 71f2a1442c
commit 74665f1663
9 changed files with 97 additions and 8 deletions
@@ -119,6 +119,13 @@ public class EZGameDispatcher extends InvocationDispatcher
);
return;
case EZGameMarshaller.RESTART_GAME_IN:
((EZGameProvider)provider).restartGameIn(
source,
((Integer)args[0]).intValue(), (InvocationService.InvocationListener)args[1]
);
return;
case EZGameMarshaller.SEND_MESSAGE:
((EZGameProvider)provider).sendMessage(
source,
@@ -159,6 +159,28 @@ public class EZGameManager extends GameManager
endGame();
}
// from EZGameProvider
public void restartGameIn (ClientObject caller, int seconds,
InvocationService.InvocationListener listener)
throws InvocationException
{
if (_gameObj.isInPlay()) {
throw new InvocationException("e.game_in_play");
}
validateStateModification(caller, false);
// queue up the start of the next game
if (seconds > 0) {
new Interval(CrowdServer.omgr) {
public void expired () {
if (_gameObj.isActive() && !_gameObj.isInPlay()) {
startGame();
}
}
}.schedule(seconds * 1000L);
}
}
// from EZGameProvider
public void sendMessage (ClientObject caller, String msg, Object data, int playerId,
InvocationService.InvocationListener listener)
@@ -87,6 +87,12 @@ public interface EZGameProvider extends InvocationProvider
public void mergeCollection (ClientObject caller, String arg1, String arg2, InvocationService.InvocationListener arg3)
throws InvocationException;
/**
* Handles a {@link EZGameService#restartGameIn} request.
*/
public void restartGameIn (ClientObject caller, int arg1, InvocationService.InvocationListener arg2)
throws InvocationException;
/**
* Handles a {@link EZGameService#sendMessage} request.
*/