Code: Select all
public class ClientCount : MonoBehaviour {
private Room myRoom;
private SmartFoxClient smartFox = null;
public static int ClientCount = 0; //decremented when disconnected
public GUIStyle s;
// Use this for initialization
private void Start ()
{
myRoom = new Room(ClientCount++, "Lobby", 100, 100, false, false, false, false, 10, 10);
myRoom.SetUserCount(ClientCount++);
smartFox = SmartFox.Connection;
Debug.Log("ActiveRoom: " + smartFox.GetActiveRoom() + " name: " + smartFox.myUserName);
Debug.Log("id: " + smartFox.myUserId);
Debug.Log("userCount: " + myRoom.GetUserCount());
}
private void OnGUI()
{
if (myRoom.GetUserCount() == 1)
{
GUI.Label(new Rect(5, 100, 100, 100), smartFox.myUserName, s);
}
if (myRoom.GetUserCount() == 2)
{
GUI.Label(new Rect(5, 130, 100, 100), smartFox.myUserName, s);
}
}
}
I'd also like to know how to store multiple strings of information into an object for the client, for example:
smartFox.GetName("lampshade");
smartFox.GetLevel(1);
smartFox.GetProfession("programmer");
I have all of these set, but in playerprefs...I think I could just store it all in:
smartFox.myUserName;
and just parse the string? But is there an easier way? Thanks in advance.