i have tried using the RoomVariable class and the SFSRoomvariable and still somewhat confuse like how i it knows what type of object i'm using where it will be a string, int etc and so on.
i already know how to make it so in unity i'm able to get the room variables like reading what their values are, now in this case i only want to set the values by the server. i tried something like SetRoomVariable(RoomVariable, bool); i don't know what 's the bool for lol.
in here i have a half way code about setting a room vairbale which i called game started, in here i made a countdown timer and once it's finish set the room variable to true, i have other variables such as the name of the level and so on so forth, i know there could be other aproaches but
still this seemes a better aproach of doing it.
here's the snipet which i'm still trying to work on so far:
Code: Select all
String Name = data.getUtfString("name");
users = this.getParentExtension().getParentRoom().getUserList();
room = this.getParentExtension().getParentRoom();
try
{
SmartFoxServer sfs = SmartFoxServer.getInstance();
RoomVariable rv;
rv = room.getVariable("gameStarted");
if(started)
{
if(rv.getBoolValue() == false)
{
room.setVariable(rv);
}
}