Case Status
Log In


Home ยป Add-ons»Photon Networking»Photon DemoWorker Sample»Photon DemoWork Room Listing G…
Community Wiki

Photon DemoWork Room Listing Gui Fsm

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

For this, we need to watch for two built in events, PHOTON / RECEIVED ROOM LIST UPDATE and PHOTON / RECEIVED ROOM LIST. These two events simply tell us that we should check again the number of rooms available and if so present the user with the ability to join one of them randomly. This technic is also used in the join random room Fsm
Following on of this event, we enter the "do we have rooms?" state, clearly querying for the number of rooms, and dispatching a YES event , created for the occasion. Note that we could make a NO event as well, but that would lead to a state doing nothing, so for the sake of efficiency, we simply do not move any further if we have no rooms available. This is perfectly fine, but can be more visually obvious if you want a more exhaustive process.

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 Events used



Last modified on 5/28/2012 4:45 AM by User.

  • RSS Feed