unity client doesnt get uservar of type sfsobject

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

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

Postby ThomasLund » 16 Aug 2011, 10:03

Sorry - cant reproduce.

Server code:

Code: Select all

   @Override
   public void handleClientRequest(User u, ISFSObject data) {
      ISFSObject res = new SFSObject();

      ISFSArray arr = new SFSArray();

      for (int i = 0; i < 3; i++) {
         ISFSObject randomObj = new SFSObject();
         randomObj.putBool("meh", true);
         randomObj.putInt("i", i);
         randomObj.putUtfString("txt", "meh meh " + i);
         randomObj.putInt("x", i);
         randomObj.putUtfString("txt2", "mah mah " + i);
         randomObj.putInt("y", i);
         randomObj.putUtfString("txt3", "muh muh " + i);

         arr.addSFSObject(randomObj);
      }
      res.putSFSArray("an array", arr);

      res.putUtfString("msg", "this is an object");
//      this.send("sfsTestResponse", res, u);

      List<UserVariable> vars = new ArrayList<UserVariable>();
      UserVariable uvar1 = new SFSUserVariable("var1", "test string variable");
      UserVariable uvar2 = new SFSUserVariable("var2", res);
      vars.add(uvar2);
      vars.add(uvar1);
      getApi().setUserVariables(u, vars);
   }


Client code:

Code: Select all

      public void OnUserVarUpdate(BaseEvent e) {
         Console.WriteLine("User var update");

         ArrayList changedVars = (ArrayList)e.Params["changedVars"];
         Console.WriteLine("Changed vars:" + changedVars.Count);
         Console.WriteLine("User var:" + sfs.MySelf.GetVariable("var2").ToSFSArray().GetDump());


Client response:

Code: Select all

User var update
Changed vars:2
User var:
   (utf_string) var2
   (byte) 5
   (sfs_object)
      (utf_string) msg: this is an object
      (sfs_array) an array:
         (sfs_object)
            (utf_string) txt: meh meh 0
            (utf_string) txt2: mah mah 0
            (int) x: 0
            (bool) meh: True
            (int) y: 0
            (int) i: 0
            (utf_string) txt3: muh muh 0
         
         (sfs_object)
            (utf_string) txt: meh meh 1
            (utf_string) txt2: mah mah 1
            (int) x: 1
            (bool) meh: True
            (int) y: 1
            (int) i: 1
            (utf_string) txt3: muh muh 1
         
         (sfs_object)
            (utf_string) txt: meh meh 2
            (utf_string) txt2: mah mah 2
            (int) x: 2
            (bool) meh: True
            (int) y: 2
            (int) i: 2
            (utf_string) txt3: muh muh 2
         
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany
Contact:

Postby Robbilie » 06 Sep 2011, 12:29

i still have the error and cant find uout how to change it...

but there is somehing else very strange:

in the sfsobject, i put classes...

i changed the namespace when i renamed my extension and changed other stuff...

but on the client i still get an error telling me that it cant find the serialisation even when i changed all namespaces on the client:


Code: Select all


[SFS - ERROR] Error handling data: Cannot find type: dk.fullcontrol.fps.simulation.contentmanager.TransferItem   at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.Sfs2Cs (ISFSObject sfsObj) [0x00000] in <filename unknown>:0

  at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0

  at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0



strange heh?
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany
Contact:

Postby Robbilie » 06 Sep 2011, 12:35

im getting something similair on the serverside:

i commented out a method and even completly deleted it but the server is executing it?! xD
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany
Contact:

Postby Robbilie » 06 Sep 2011, 13:05

guys i think its fixxed xDDDD
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany
Contact:

Postby Robbilie » 06 Sep 2011, 15:02

ok so i fixxed annother bug that didnt let me test some things out, then i set the uservar of type sfsobject and just put in an int and all worked :)

But when i reset it now and put classes in the sfsobject i get thr error i posted about an hour ago with vessonline.rpg instead of dk.fullcontrol.fps

I think its something with serialisation...?

Thomas? Help me pls :P
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 06 Sep 2011, 20:57

I'm still on the last DLL and it works just fine.

Client debug:

Code: Select all

User var:
   (utf_string) var2
   (byte) 5
   (sfs_object)
      (utf_string) msg: this is an object
      (sfs_array) an array:
         (sfs_object)
            (utf_string) txt: meh meh 0
            (utf_string) txt2: mah mah 0
            (int) x: 0
            (bool) meh: True
            (int) y: 0
            (int) i: 0
            (utf_string) txt3: muh muh 0
         
         (sfs_object)
            (utf_string) txt: meh meh 1
            (utf_string) txt2: mah mah 1
            (int) x: 1
            (bool) meh: True
            (int) y: 1
            (int) i: 1
            (utf_string) txt3: muh muh 1
         
         (sfs_object)
            (utf_string) txt: meh meh 2
            (utf_string) txt2: mah mah 2
            (int) x: 2
            (bool) meh: True
            (int) y: 2
            (int) i: 2
            (utf_string) txt3: muh muh 2


This isn't a bug.
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany
Contact:

Postby Robbilie » 07 Sep 2011, 03:56

appels u dont understand xD

Your code doesnt look like you put any classes into the sfsobject hm?
I put in 24 "transferitems" and 1 int for the transferitem count...

And the classes cause the error...
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 07 Sep 2011, 10:14

How do expect people to help you if you don't give the faulty code ?
If you can give a clear example of what's not working i could help you.
Even a dummy example of what your trying to achieve, it doesn't have to be the actual code. The clearer your example the more help you could get.
And assuming that i don't understand if a misjudgement on your part.
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany
Contact:

Postby Robbilie » 07 Sep 2011, 13:15

im sry but i clearly said that im putting classes into the sfsobject xD

i dont realy think theres any buggy code but just a mistake i did with the serialisation...

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 6 guests