We need to send the tick out with a different message identifier

because otherwise the EZGameController will try to unmarshall the value.
The marshalling/unmarshalling is purely clientside, the server doesn't
understand how to do it, so it must dispatch a different event that just
contains a nice normal integer.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@85 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2006-10-02 21:11:10 +00:00
parent f48a48436d
commit 1459306393
5 changed files with 19 additions and 1 deletions
@@ -4,6 +4,7 @@ import flash.events.Event;
import flash.utils.ByteArray; import flash.utils.ByteArray;
import com.threerings.util.Integer;
import com.threerings.util.Name; import com.threerings.util.Name;
import com.threerings.presents.dobj.MessageAdapter; import com.threerings.presents.dobj.MessageAdapter;
@@ -91,6 +92,12 @@ public class EZGameController extends GameController
// this is chat send by the game, let's route it like // this is chat send by the game, let's route it like
// localChat, which is also sent by the game // localChat, which is also sent by the game
gameObjImpl.localChat(String(event.getArgs()[0])); gameObjImpl.localChat(String(event.getArgs()[0]));
} else if (EZGameObject.TICKER == name) {
var args :Array = event.getArgs();
dispatchUserEvent(new MessageReceivedEvent(
gameObjImpl, (args[0] as String),
(args[1] as Integer).value));
} }
} }
@@ -24,6 +24,9 @@ public class EZGameObject extends GameObject
/** The identifier for a MessageEvent containing game-system chat. */ /** The identifier for a MessageEvent containing game-system chat. */
public static const GAME_CHAT :String = "Uchat"; public static const GAME_CHAT :String = "Uchat";
/** The identifier for a MessageEvent containing ticker notifications. */
public static const TICKER :String = "Utick";
// AUTO-GENERATED: FIELDS START // AUTO-GENERATED: FIELDS START
/** The field name of the <code>turnHolder</code> field. */ /** The field name of the <code>turnHolder</code> field. */
public static const TURN_HOLDER :String = "turnHolder"; public static const TURN_HOLDER :String = "turnHolder";
@@ -89,6 +89,11 @@ public class EZGameController extends GameController
// this is chat send by the game, let's route it like // this is chat send by the game, let's route it like
// localChat, which is also sent by the game // localChat, which is also sent by the game
gameObjImpl.localChat((String) event.getArgs()[0]); gameObjImpl.localChat((String) event.getArgs()[0]);
} else if (EZGameObject.TICKER.equals(name)) {
Object[] args = event.getArgs();
dispatchUserEvent(new MessageReceivedEvent(
gameObjImpl, (String) args[0], (Integer) args[1]));
} }
} }
@@ -31,6 +31,9 @@ public class EZGameObject extends GameObject
/** The identifier for a MessageEvent containing game-system chat. */ /** The identifier for a MessageEvent containing game-system chat. */
public static final String GAME_CHAT = "Uchat"; public static final String GAME_CHAT = "Uchat";
/** The identifier for a MessageEvent containing ticker notifications. */
public static final String TICKER = "Utick";
// AUTO-GENERATED: FIELDS START // AUTO-GENERATED: FIELDS START
/** The field name of the <code>turnHolder</code> field. */ /** The field name of the <code>turnHolder</code> field. */
public static final String TURN_HOLDER = "turnHolder"; public static final String TURN_HOLDER = "turnHolder";
@@ -394,7 +394,7 @@ public class EZGameManager extends GameManager
public void expired () public void expired ()
{ {
_omgr.postEvent( _omgr.postEvent(
new MessageEvent(_oid, EZGameObject.USER_MESSAGE, new MessageEvent(_oid, EZGameObject.TICKER,
new Object[] { _name, _value++ })); new Object[] { _name, _value++ }));
} }
}; };