Forums » Union Coders »
Attributes of "unjoined" rooms
Added by Egon Verbakel 800 days ago
Hi,
For a educational game i'm developing at the moment i need to read the room attributes of a room which i did not join,
this does not seem to be possible, or maybe i'm doing something wrong?
the basic idea is that a users receives a list of rooms ( which works perfectly ), these rooms have different math exercise, 1 room for adding, 1 room for multiplication etc.
Which exercise the room contains is put into a room Attribute (_GAME_TYPE)
what i would like to achieve is to have a list of rooms with their specific game_type in a list so the user can choose which exercises he would like to do.
The game prototype is allmost done, when it's online i'll drop a line here so you can check it out.
Egon.
Replies
RE: Attributes of "unjoined" rooms - Added by colin moock 800 days ago
no problem. just call synchronize() on the room:
http://unionplatform.com/docs/reactor/api/net/user1/reactor/Room.html#synchronize()
or, if you don't yet have a reference to the Room object, call synchronizeRoom() via the RoomManager:
http://unionplatform.com/docs/reactor/api/net/user1/reactor/RoomManager.html#synchronizeRoom()
if you are building a lobby, you might find this example useful:
http://www.unionplatform.com/?page_id=801
please do send over the link when your project is ready!
colin
RE: Attributes of "unjoined" rooms - Added by colin moock 800 days ago
i should also mention that if you expect the attribute's value to change, and you want to be notified of changes, you can observe ("spectate") the room without joining it. see Room's observe() method:
http://unionplatform.com/docs/reactor/api/net/user1/reactor/Room.html#observe()
or, once again, if you don't have a reference to the Room object already, use RoomManager's observeRoom():
http://unionplatform.com/docs/reactor/api/net/user1/reactor/RoomManager.html#observeRoom()
colin
RE: Attributes of "unjoined" rooms - Added by Egon Verbakel 799 days ago
Brilliant!!
thank you very much, I used,
unionClient.getRoomManager().synchronizeRoomList();
changed it to calling synchronize on all rooms, and that did the trick!
Union is great to work with, keep up the good work!
Super!
Egon
RE: Attributes of "unjoined" rooms - Added by colin moock 799 days ago
yup, that would do the trick. note that synchronizeRoomList() gives you a one-time snapshot of the current rooms on the server (for the specified qualifier). if you want to be automatically synchronized, use RoomManager's watchForRooms() method instead:
http://unionplatform.com/docs/reactor/api/net/user1/reactor/RoomManager.html#watchForRooms()
colin