I have a room list in our lobby up and running. The rooms are created server side. We create a unique room name for each and I set a global variable on them with the name of the scenario that is used for each.
I want to display this scenario instead of the room name in the lobby room list. So I've created a setCustomRoomLabel() function that I call to write out the scenario name instead of the room name.
This all works fine, except that if a user is in the lobby when a new room is created, the room name gets added to the list when it is created and then not updated when the variable is set. I need to listen for the variable being set with the scenario name and then update the room list. But I can't see any way of refreshing the list (the user list has such a function).
Is there a way to do this? Or should I be approaching the problem differently?
This is the server side code that creates the room and sets the variable:
Code: Select all
room = SmartFoxServer.getInstance().getAPIManager().getGameApi().createGame(zone, settings, user);
SFSRoomVariable scenarioVar = new SFSRoomVariable("scenario", scenarioName);
scenarioVar.setGlobal(true); // make scenario name visible to all so lobby can see it