Actor Properties in Flash
Options
Hello,
I have a question about the Actor Properties.
When I join a room From Lobby in LiteLobby, I pass the ActorProperties as a parameter as follows:
Then when I get the JoinResponse, I can see me back the data of the actors who were already inside the room. I JoinResponse extended to capture this data as follows:
The problem is that I can only get properties from actors that joined the room before me.
How I can do to uptade the properties, if a new player joins the room?
When in "client side" i get 'JoinEvent' from photon , to update the Actors ... It only returns an Array with ActorNums ... but not ActorProperties ... and I didn't seen anything that can help me... or maybe i'm wrong...
Does anyone know how to do this?
What I need is to keep the information of Actors (Nick, Score, etc ...) in a "DataGrid" (I'm using Flex) and I think I the only way is by the ActorProperties ....
Do I have to implement somethingin LiteLobby (Server side) for it?
I have a question about the Actor Properties.
When I join a room From Lobby in LiteLobby, I pass the ActorProperties as a parameter as follows:
public function JoinRoomFromLobby(roomName:String):void { var params:Object= new Object(); params[CoreKeys.LOBBY_ID] = mDefaultLobby; params[CoreKeys.GAME_ID] = roomName; params[CoreKeys.ACTOR_PROPERTIES] = myActorProperties; // nuestra infiormación, para informar a los demás clientes Photon.getInstance().raiseCustomEventWithCode(Constants.EV_CUSTOM_JOIN_ROOM,params); setState(STATE_JOINROOM_REQUESTING); }
Then when I get the JoinResponse, I can see me back the data of the actors who were already inside the room. I JoinResponse extended to capture this data as follows:
public class CustomJoinResponse extends BasicResponse { public static const TYPE:String = "onCustomJoinResponse";//JoinResponse.TYPE; public var mPlayerProps:Array; public function getPlayerProperties() : Array {return mPlayerProps} private function setPlayerProperties( v : Array ) : void { mPlayerProps = v; } public var mActorNum:int; public function getPlayerNum():int {return mActorNum} private function setPlayerNum(v:int):void{mActorNum = v;} public function CustomJoinResponse(type:String, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, bubbles, cancelable); } public static function create (responseCode:int,returnCode:int, params:Object, debugMessage:String) : CustomJoinResponse { var ev:CustomJoinResponse = new CustomJoinResponse(TYPE); ev.setBasicValues(responseCode,returnCode, params, debugMessage); if(params[CoreKeys.ACTOR_PROPERTIES] != null) { ev.setPlayerProperties(params[CoreKeys.ACTOR_PROPERTIES]); } if(params[CoreKeys.ACTOR_NO] != null) { ev.setPlayerNum(params[CoreKeys.ACTOR_NO]); } return ev; } }
The problem is that I can only get properties from actors that joined the room before me.
How I can do to uptade the properties, if a new player joins the room?
When in "client side" i get 'JoinEvent' from photon , to update the Actors ... It only returns an Array with ActorNums ... but not ActorProperties ... and I didn't seen anything that can help me... or maybe i'm wrong...
Does anyone know how to do this?
What I need is to keep the information of Actors (Nick, Score, etc ...) in a "DataGrid" (I'm using Flex) and I think I the only way is by the ActorProperties ....
Do I have to implement somethingin LiteLobby (Server side) for it?
0
Comments
-
By default, the actorProperties are not copied into the join event.
Enable this by adding the "broadcast" parameter to the join operation:
params[CoreKeys.BROADCAST] = true;0