How to hold character selection pref in SFS2X

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

Moderators: Lapo, Bax

Mauldraine
Posts: 5
Joined: 29 Mar 2011, 06:26
Location: California
Contact:

How to hold character selection pref in SFS2X

Postby Mauldraine » 23 Jul 2011, 23:24

Hello all,

I have put together a few scripts in a test scene with Unity3d. These scripts will be used to implement a simple 3d themed based chat scene, and already maintain each users location within the room. I am still very green with the SFS2X API and C# coding so my apologies if there is an obvious answer to this question ...

When a user loads the scene in their browser, they have two options prior to the login script, the first is the name they wish to use, and the second is a choice of either a male or female character.

What is the best way to make other users aware of the new users gender selection, so their copy of the web player can instantiate the correct character model?

I have a feeling that it's going to have to be done either as part of an ObjectMessageRequest that is also already sending their transform information ... or can/should I use an SFSObject as the forth element of a LoginRequest?

Can you add that fourth element to the LoginRequest without the need for a server extension? Will SFS2X hold that data as long as they are connected, and how do I get at that information?

Any help/thoughts would be greatly appreciated. Many thanks everyone!!!

Martin
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 23 Jul 2011, 23:46

hi. Well, i was going to suggest you to use an user variable to store the selected gender. As user variables can only be set after login, i suggest you to use the following procedure:

LoginRequest > setUserVariablesRequest (after the successful login) > join the chat room.

This way, when you enter the chat room, all the other users can check your gender by doing user.getVariable("variable name").getValue().

Regarding your second question, that object is only used for sending extra data to an extension.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
COB
Posts: 68
Joined: 28 Dec 2010, 08:54

Postby COB » 24 Jul 2011, 15:10

Of course you can use SFS user variables if you want to share these settings between users, but probably you are looking for something like this:
http://unity3d.com/support/documentatio ... Prefs.html
I use this for the same thing as you and it works great.

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 6 guests