Code: Select all
...
crs.setAutoRemoveMode(SFSRoomRemoveMode.NEVER_REMOVE);
String lobbyName = LOBBY_NAME_PREFIX + serverId.toString();
crs.setName(lobbyName);
crs.setGroupId("conquestLobby");
crs.setMaxUsers(100);
crs.setDynamic(true);
crs.setExtension(res);
// This variable have the status of all the checkpoints, 0 is okay, 1 is hacked.
SFSObject checkpoints = new SFSObject();
checkpoints.putInt("lost", 0);
checkpoints.putInt("total", 6);
RoomVariable checkpointsVariable = new SFSRoomVariable("checkpoints", checkpoints);
checkpointsVariable.setPrivate(true);
checkpointsVariable.setGlobal(false);
checkpointsVariable.setHidden(false);
RoomVariable defendersAllowed = new SFSRoomVariable("defendersAllowed", new SFSArray());
defendersAllowed.setPrivate(false);
defendersAllowed.setGlobal(false);
defendersAllowed.setHidden(false);
// We also put in the lobby the server id to retrieve the battle room reference on init.
crs.setRoomVariables(Arrays.asList(serverIdVariable, checkpointsVariable, defendersAllowed));
try {
Room lobbyRoom = getApi().createRoom(user.getZone(), crs, user);
...
The variables are setted to the room in the config, even before the room is created. Now when I receive the OnRoomJoin event or OnUserEnterRoom in the client, I try to access those variables but sometimes I can't because the room does not contains the variable yet, I do receive the update of those variables (if they change) and then I can access them. Aren't those variables supposed to be available already if they were setted in the config class? Do I have to do it on the init method of the extension? Also this doesn't happens all the time, but very often. Thanks.
Server side version: 2.11.1.
C# Api version 1.7.3.