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:
@@ -596,6 +596,16 @@ public class EZGameControl extends BaseControl
|
||||
callEZCode("endGame_v2", winnerIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests to start the game again in the specified number of seconds. This should only be
|
||||
* used for party games. Seated table games should have each player report that they are ready
|
||||
* again and the game will automatically start.
|
||||
*/
|
||||
public function restartGameIn (seconds :int) :void
|
||||
{
|
||||
callEZCode("restartGameIn_v1", seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate any properties or functions we want to expose to the other side of the ezgame
|
||||
* security boundary.
|
||||
|
||||
@@ -64,6 +64,9 @@ public interface EZGameService extends InvocationService
|
||||
// from Java interface EZGameService
|
||||
function mergeCollection (arg1 :Client, arg2 :String, arg3 :String, arg4 :InvocationService_InvocationListener) :void;
|
||||
|
||||
// from Java interface EZGameService
|
||||
function restartGameIn (arg1 :Client, arg2 :int, arg3 :InvocationService_InvocationListener) :void;
|
||||
|
||||
// from Java interface EZGameService
|
||||
function sendMessage (arg1 :Client, arg2 :String, arg3 :Object, arg4 :int, arg5 :InvocationService_InvocationListener) :void;
|
||||
|
||||
|
||||
@@ -504,6 +504,7 @@ public class GameControlBackend
|
||||
o["endTurn_v2"] = endTurn_v2;
|
||||
o["endRound_v1"] = endRound_v1;
|
||||
o["endGame_v2"] = endGame_v2;
|
||||
o["restartGameIn_v1"] = restartGameIn_v1;
|
||||
o["getTurnHolder_v1"] = getTurnHolder_v1;
|
||||
o["getRound_v1"] = getRound_v1;
|
||||
o["getOccupantName_v1"] = getOccupantName_v1;
|
||||
@@ -762,6 +763,13 @@ public class GameControlBackend
|
||||
_ctx.getClient(), toTypedIntArray(winnerIds), createLoggingConfirmListener("endGame"));
|
||||
}
|
||||
|
||||
protected function restartGameIn_v1 (seconds :int) :void
|
||||
{
|
||||
validateConnected();
|
||||
_ezObj.ezGameService.restartGameIn(
|
||||
_ctx.getClient(), seconds, createLoggingConfirmListener("restartGameIn"));
|
||||
}
|
||||
|
||||
protected function getDictionaryLetterSet_v1 (
|
||||
locale :String, count :int, callback :Function) :void
|
||||
{
|
||||
|
||||
@@ -162,8 +162,21 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
]);
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #restartGameIn} requests. */
|
||||
public static const RESTART_GAME_IN :int = 10;
|
||||
|
||||
// from interface EZGameService
|
||||
public function restartGameIn (arg1 :Client, arg2 :int, arg3 :InvocationService_InvocationListener) :void
|
||||
{
|
||||
var listener3 :InvocationMarshaller_ListenerMarshaller = new InvocationMarshaller_ListenerMarshaller();
|
||||
listener3.listener = arg3;
|
||||
sendRequest(arg1, RESTART_GAME_IN, [
|
||||
Integer.valueOf(arg2), listener3
|
||||
]);
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #sendMessage} requests. */
|
||||
public static const SEND_MESSAGE :int = 10;
|
||||
public static const SEND_MESSAGE :int = 11;
|
||||
|
||||
// from interface EZGameService
|
||||
public function sendMessage (arg1 :Client, arg2 :String, arg3 :Object, arg4 :int, arg5 :InvocationService_InvocationListener) :void
|
||||
@@ -176,7 +189,7 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #setCookie} requests. */
|
||||
public static const SET_COOKIE :int = 11;
|
||||
public static const SET_COOKIE :int = 12;
|
||||
|
||||
// from interface EZGameService
|
||||
public function setCookie (arg1 :Client, arg2 :ByteArray, arg3 :InvocationService_InvocationListener) :void
|
||||
@@ -189,7 +202,7 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #setProperty} requests. */
|
||||
public static const SET_PROPERTY :int = 12;
|
||||
public static const SET_PROPERTY :int = 13;
|
||||
|
||||
// from interface EZGameService
|
||||
public function setProperty (arg1 :Client, arg2 :String, arg3 :Object, arg4 :int, arg5 :Boolean, arg6 :Object, arg7 :InvocationService_InvocationListener) :void
|
||||
@@ -202,7 +215,7 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #setTicker} requests. */
|
||||
public static const SET_TICKER :int = 13;
|
||||
public static const SET_TICKER :int = 14;
|
||||
|
||||
// from interface EZGameService
|
||||
public function setTicker (arg1 :Client, arg2 :String, arg3 :int, arg4 :InvocationService_InvocationListener) :void
|
||||
|
||||
@@ -55,6 +55,13 @@ public interface EZGameService extends InvocationService
|
||||
*/
|
||||
public void endGame (Client client, int[] winnerOids, InvocationListener listener);
|
||||
|
||||
/**
|
||||
* Requests to start the game again in the specified number of seconds. This should only be
|
||||
* used for party games. Seated table games should have each player report that they are ready
|
||||
* again and the game will automatically start.
|
||||
*/
|
||||
public void restartGameIn (Client client, int seconds, InvocationListener listener);
|
||||
|
||||
/**
|
||||
* Request to send a private message to one other player in the game.
|
||||
*
|
||||
|
||||
@@ -154,8 +154,21 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
});
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #restartGameIn} requests. */
|
||||
public static final int RESTART_GAME_IN = 10;
|
||||
|
||||
// from interface EZGameService
|
||||
public void restartGameIn (Client arg1, int arg2, InvocationService.InvocationListener arg3)
|
||||
{
|
||||
ListenerMarshaller listener3 = new ListenerMarshaller();
|
||||
listener3.listener = arg3;
|
||||
sendRequest(arg1, RESTART_GAME_IN, new Object[] {
|
||||
Integer.valueOf(arg2), listener3
|
||||
});
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #sendMessage} requests. */
|
||||
public static final int SEND_MESSAGE = 10;
|
||||
public static final int SEND_MESSAGE = 11;
|
||||
|
||||
// from interface EZGameService
|
||||
public void sendMessage (Client arg1, String arg2, Object arg3, int arg4, InvocationService.InvocationListener arg5)
|
||||
@@ -168,7 +181,7 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #setCookie} requests. */
|
||||
public static final int SET_COOKIE = 11;
|
||||
public static final int SET_COOKIE = 12;
|
||||
|
||||
// from interface EZGameService
|
||||
public void setCookie (Client arg1, byte[] arg2, InvocationService.InvocationListener arg3)
|
||||
@@ -181,7 +194,7 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #setProperty} requests. */
|
||||
public static final int SET_PROPERTY = 12;
|
||||
public static final int SET_PROPERTY = 13;
|
||||
|
||||
// from interface EZGameService
|
||||
public void setProperty (Client arg1, String arg2, Object arg3, int arg4, boolean arg5, Object arg6, InvocationService.InvocationListener arg7)
|
||||
@@ -194,7 +207,7 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #setTicker} requests. */
|
||||
public static final int SET_TICKER = 13;
|
||||
public static final int SET_TICKER = 14;
|
||||
|
||||
// from interface EZGameService
|
||||
public void setTicker (Client arg1, String arg2, int arg3, InvocationService.InvocationListener arg4)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user