Added tick services to EZGame.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@82 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -89,6 +89,19 @@ public interface EZGame
|
||||
function sendMessage (
|
||||
messageName :String, value :Object, playerIndex :int = -1) :void;
|
||||
|
||||
/**
|
||||
* Start the ticker with the specified name. It will deliver
|
||||
* messages to the game object at the specified delay,
|
||||
* the value of each message being a single integer, starting with 0
|
||||
* and increasing by one with each messsage.
|
||||
*/
|
||||
function startTicker (tickerName :String, msOfDelay :int) :void;
|
||||
|
||||
/**
|
||||
* Stop the specified ticker.
|
||||
*/
|
||||
function stopTicker (tickerName :String) :void;
|
||||
|
||||
/**
|
||||
* Send a message that will be heard by everyone in the game room,
|
||||
* even observers.
|
||||
|
||||
@@ -74,5 +74,16 @@ public interface EZGameService extends InvocationService
|
||||
client :Client, collName :String, consume :Boolean, count :int,
|
||||
msgOrPropName :String, playerIndex :int,
|
||||
listener :InvocationService_ConfirmListener) :void;
|
||||
|
||||
/**
|
||||
* Start a ticker that will send out timestamp information at
|
||||
* the interval specified.
|
||||
*
|
||||
* @param msOfDelay must be at least 50, or 0 may be set to halt
|
||||
* and clear a previously started ticker.
|
||||
*/
|
||||
function setTicker (
|
||||
client :Client, tickerName :String, msOfDelay :int,
|
||||
listener :InvocationService_InvocationListener) :void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +184,20 @@ public class GameObjectImpl extends EventDispatcher
|
||||
createLoggingListener("sendMessage"));
|
||||
}
|
||||
|
||||
// from EZGame
|
||||
public function startTicker (tickerName :String, msOfDelay :int) :void
|
||||
{
|
||||
validateName(tickerName);
|
||||
_ezObj.ezGameService.setTicker(_ctx.getClient(),
|
||||
tickerName, msOfDelay, createLoggingListener("setTicker"));
|
||||
}
|
||||
|
||||
// from EZGame
|
||||
public function stopTicker (tickerName :String) :void
|
||||
{
|
||||
startTicker(tickerName, 0);
|
||||
}
|
||||
|
||||
// from EZGame
|
||||
public function sendChat (msg :String) :void
|
||||
{
|
||||
|
||||
@@ -121,5 +121,18 @@ public class EZGameMarshaller extends InvocationMarshaller
|
||||
]);
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #setTicker} requests. */
|
||||
public static const SET_TICKER :int = 8;
|
||||
|
||||
// documentation inherited from interface
|
||||
public function setTicker (arg1 :Client, arg2 :String, arg3 :int, arg4 :InvocationService_InvocationListener) :void
|
||||
{
|
||||
var listener4 :InvocationMarshaller_ListenerMarshaller = new InvocationMarshaller_ListenerMarshaller();
|
||||
listener4.listener = arg4;
|
||||
sendRequest(arg1, SET_TICKER, [
|
||||
arg2, Integer.valueOf(arg3), listener4
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user