List all rooms and let the user pick one.
This is a very important Fsm, being the main mechanism to let the user pick an existing room and join it.
Displaying the list of rooms gui
Managing room selection
The state "list rooms gui" displays the list of rooms, we monitor this live, so as rooms are created and deleted, this state will adjust properly what it shows to the user. For this ,a convenient action (Photon GuiLayout toolBar With Rooms) is available to list all available room. So we simply store the selected room name in a string "selected room name" and trigger a GO event we created for this purpose. We transit to the "join room" state and simply call join room with the name of the room the user picked.
As a result of joining the room, the Photon system will send to us a PHOTON / JOINED ROOM when the player will actually technically be in the room ( it takes time on the server side to process the join room call and proceed, this is an asynchronous process). We watch for this PHOTON / JOINED ROOM in the Connection Fsm
Photon Actions used:
- Photon Network Get Rooms count ( in state "do we have rooms")
- Photon GUILayout Toolbar With Rooms ( in state "list rooms gui")
- Photon Network Join Room ( in state "join room")
Photon Events used