Page 1 of 1

Creating and Joining a Game Room

Posted: 20 Sep 2009, 20:39
by Polyclef
So I've implemented the Advanced Chat tutorial (Pts. 1 & 2) in Android. I've got everything working...joining public and private rooms, sending private messages, creating new rooms, etc.).

I'm confused about what events are supposed to fire upon creating a new room, though.

The app is working fine if the user clicks on a room that they're not currently in. The event onUserCountChange is fired for both the room that was exited and the new room that was entered. So the number of users in each room is appropriately updated.

However, when the user creates a new game room, the only events that are fired are onRoomAdded and onJoinRoom. I added a listener for onRoomAdded, and updated the game room list and user count for that room. The user automatically joins the newly created room, yes?

So are they now in two rooms? The room they started in AND the newly created room? Why isn't onUserCountChange fired when you create a new room? How do I go about making sure the user is only in one room at a time, so that when they create a game room, they move to it and leave their old room? Or is this the way it is actually supposed to work by default?

I tried to call leaveRoom with the id of the current room, both before and after creating the new room, and neither way worked.

Could someone either explain how this is supposed to work or point me to the documentation that explains it?