OnUserVariablesUpdate

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Bax, Lapo

OnUserVariablesUpdate

Postby matrix211v1 » 19 Dec 2010, 19:11

The ONLY issue I am currently having is "OnUserVariablesUpdate". I am calling "SetUserVariables" and that is being populated, verified using the SFS Admin utility and I am subscribed to the Event:

Code: Select all
   private void SubscribeEvents() {
        Debug.Log("****************=========================******************** SubscribeEvents to Events");
      SFSEvent.onJoinRoom += OnJoinRoom;
      SFSEvent.onUserEnterRoom += OnUserEnterRoom;
      SFSEvent.onUserLeaveRoom += OnUserLeaveRoom;
      SFSEvent.onObjectReceived += OnObjectReceived;
      SFSEvent.onPublicMessage += OnPublicMessage;
        SFSEvent.onPrivateMessage += OnPrivateMessage;
        SFSEvent.onConnectionLost += OnConnectionLost;
        SFSEvent.onRoomListUpdate += OnRoomList;
        SFSEvent.onDebugMessage += OnDebugMessage;
        SFSEvent.onExtensionResponse += OnExtensionResponse;
        SFSEvent.onUserVariablesUpdate += OnUserVariablesUpdate;
    }
   
   public void UnsubscribeEvents() {
        Debug.Log("****************=========================******************** UnsubscribeEvents to Events");
      SFSEvent.onJoinRoom -= OnJoinRoom;
      SFSEvent.onUserEnterRoom -= OnUserEnterRoom;
      SFSEvent.onUserLeaveRoom -= OnUserLeaveRoom;
      SFSEvent.onObjectReceived -= OnObjectReceived;
      SFSEvent.onPublicMessage -= OnPublicMessage;
        SFSEvent.onPrivateMessage -= OnPrivateMessage;
        SFSEvent.onConnectionLost -= OnConnectionLost;
        SFSEvent.onRoomListUpdate -= OnRoomList;
        SFSEvent.onDebugMessage -= OnDebugMessage;
        SFSEvent.onExtensionResponse -= OnExtensionResponse;
        SFSEvent.onUserVariablesUpdate -= OnUserVariablesUpdate;
   }


But the event doesn't seem to get fired.

Code: Select all
    public void OnUserVariablesUpdate(User user, Hashtable changedVars)
    {
        // We assume that each user has px and py variables representing the users's avatar coordinates in a 2D environment

        Debug.Log("---------------==================== Some Clothes Changed for user " + user.GetId());
    }


And here is the call that I am populating the User variables with:
Code: Select all
            try
            {
                smartFoxClient.SetUserVariables(myHashtable);
            }
            catch ( Exception e )
            {
                Debug.Log("*****&&&&&&&&&&$#@$#$@$#@$@$#@$#  Error" + e.Message);
                Disconnect("unknown");
            }


Any suggestions? I am using Unity 3.1 with 1.2.7 RC1
matrix211v1
 
Posts: 61
Joined: 16 Jan 2009, 14:48

Postby ThomasLund » 19 Dec 2010, 19:38

I'm not 100% certain - but I think you dont get the callback on the calling client.

Did you try to do this with 2 clients and see if the other gets the update?

There is a handful of callbacks that are never called on the calling client, and I *think* this is one of them (server controlled - so nothing I can do in the API)

Its been a while since I last looked, so cant remember all the details. Will poke Marco to make sure, because otherwise its a bug.

/Thomas
ThomasLund
 
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby matrix211v1 » 19 Dec 2010, 19:48

Thomas:

You are correct. That was the problem. I actually tried to delete the post but you replied to it too fast. Now I need to figure out how to open the hashtable that was sent.

Thanks!
James
matrix211v1
 
Posts: 61
Joined: 16 Jan 2009, 14:48


Return to .Net / Unity3D API

Who is online

Users browsing this forum: No registered users and 1 guest