Wried error about user and room variables

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Wei
Posts: 50
Joined: 13 Jun 2017, 08:16

Wried error about user and room variables

Postby Wei » 10 Aug 2017, 23:34

Below is how I initialize sfs

Code: Select all

void InitSfs ()
   {
      sfs = SmartFoxConnection.Connection;

      sfs.AddEventListener (SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse);
      sfs.AddEventListener (SFSEvent.ADMIN_MESSAGE, OnAdminMsg);
      sfs.AddEventListener (SFSEvent.CONNECTION_LOST, OnConnectionLost);
      sfs.AddEventListener (SFSEvent.ROOM_VARIABLES_UPDATE, OnRoomVar);
      sfs.AddEventListener (SFSEvent.USER_VARIABLES_UPDATE, OnUserVar);
      sfs.AddEventListener (SFSEvent.PUBLIC_MESSAGE, OnPublicMessage);
      sfs.AddEventListener (SFSEvent.USER_ENTER_ROOM, OnUserEnterRoom);
      sfs.AddEventListener (SFSEvent.USER_EXIT_ROOM, OnUserExitRoom);

      myself = sfs.MySelf;
      theRoom = sfs.LastJoinedRoom;

      roomVars = theRoom.GetVariables ();
      userVars = myself.GetVariables ();
      Turn.text = Convert.ToString (theRoom.GetVariable ("turn").GetIntValue ());
      Status.text = Convert.ToString (theRoom.GetVariable ("status").GetIntValue ());
   }


if I ever add the 2 lines below in my OnUserVar()

Code: Select all

User user = (User)evt.Params ["user"];
userVars = (List<UserVariable>)evt.Params ["changedVars"];


or add this line in my OnRoomVar()

Code: Select all

roomVars = (List<UserVariable>)evt.Params["changedVars"];


OnUserVar() and OnRoomVar() won't work anymore. Do you know what I did wrong?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Wried error about user and room variables

Postby Lapo » 11 Aug 2017, 06:57

No,
but I think you're missing some error. Check the debug console in Unity and see what's going on there...

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 72 guests