U3d 3.3,with the updated client API,here is the problem:
1.when using send new joinroomrequest,the server side console shows Join Room(success),but the client side won't call the SFSEvent.RoomJoin callback function,tried many times!
2.The RoomVariableUpdate(BaseEvent evt) function's parameter doesn't pass correctly,here is what i do:
...
smartfox.AddEventListener(SFSEvent.ROOM_VARIABLES_UPDATE, OnRoomVariablesUpdate);
.....
private void OnRoomVariablesUpdate(BaseEvent evt)
{
Room room=(Room)evt.params["room"];//yes,the room param is correct
//but the next line failed,you can't convert the evt.Params["changedVars"] to List<RoomVariable>,I debugged the var,it said that it's a string variable
List<RoomVariable> changedVars = (List<RoomVariable>)evt.Params["changedVars"];
}
Right now i have to use server custom event handler to fix those two problem,but they should be 2 bugs?
Bugs?JoinRoom and RoomVariableUpdate Callback failed?
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Hey hey,
1)
Weird - very sure it works. Using it myself. Got more info?
2)
What you get back in the changedVars are the names of the changed variables. So a List<String> and not List<RoomVariable>
/Thomas
1)
Weird - very sure it works. Using it myself. Got more info?
2)
What you get back in the changedVars are the names of the changed variables. So a List<String> and not List<RoomVariable>
/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
ThomasLund wrote:Hey hey,
2)
What you get back in the changedVars are the names of the changed variables. So a List<String> and not List<RoomVariable>
/Thomas
what?do you mean we just get the variables name?....I just check the api doc and you write:
void OnRoomVarsUpdate(BaseEvent evt) {
List<RoomVariable> changedVars = (List<RoomVariable>)evt.Params["changedVars"];
Room room = (Room)evt.Params["room"];
// Check if the gameStarted variable was changed
SFSRoomVariable startVar = changedVars[0];
if (startVar != null && startVar.Name == "gameStarted" && startVar.GetBoolValue() == true) {
Console.WriteLine("Game Starts!");
} else {
Console.WriteLine("Game was Stopped!");
}
}
That means we can get the changedVars as List<SFSRoomVaiable>...
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
The code for setting room and user variables in the API definitely returns the names and not the variables
The example in the documentation is buggy. Thanks for finding and reporting!! Will be fixed asap
/Thomas
Code: Select all
for (int j = 0; j < varListData.Size(); j++) {
RoomVariable roomVar = SFSRoomVariable.FromSFSArray(varListData.GetSFSArray(j));
targetRoom.SetVariable(roomVar);
changedVarNames.Add(roomVar.Name);
}
evtParams["changedVars"] = changedVarNames;
evtParams["room"] = targetRoom;
sfs.DispatchEvent( new SFSEvent(SFSEvent.ROOM_VARIABLES_UPDATE, evtParam
The example in the documentation is buggy. Thanks for finding and reporting!! Will be fixed asap
/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
Who is online
Users browsing this forum: No registered users and 21 guests