Collection of "in room" callbacks for the Realtime Api to cover: Players entering or leaving, property updates and Master Client switching. More...
Inherited by MonoBehaviourPunCallbacks, PhotonHandler, PhotonTeamsManager, InRoomCallbacksContainer, and SupportLogger.
Public Member Functions | |
void | OnPlayerEnteredRoom (Player newPlayer) |
Called when a remote player entered the room. This Player is already added to the playerlist. More... | |
void | OnPlayerLeftRoom (Player otherPlayer) |
Called when a remote player left the room or became inactive. Check otherPlayer.IsInactive. More... | |
void | OnRoomPropertiesUpdate (Hashtable propertiesThatChanged) |
Called when room properties changed. The propertiesThatChanged contain only the keys that changed. More... | |
void | OnPlayerPropertiesUpdate (Player targetPlayer, Hashtable changedProps) |
Called when custom player-properties are changed. More... | |
void | OnMasterClientSwitched (Player newMasterClient) |
Called after switching to a new MasterClient when the current one leaves. More... | |
Collection of "in room" callbacks for the Realtime Api to cover: Players entering or leaving, property updates and Master Client switching.
Classes that implement this interface must be registered to get callbacks for various situations.
To register for callbacks, call LoadBalancingClient.AddCallbackTarget and pass the class implementing this interface To stop getting callbacks, call LoadBalancingClient.RemoveCallbackTarget and pass the class implementing this interface
void OnMasterClientSwitched | ( | Player | newMasterClient | ) |
Called after switching to a new MasterClient when the current one leaves.
This is not called when this client enters a room. The former MasterClient is still in the player list when this method get called.
Implemented in SupportLogger, PhotonHandler, and MonoBehaviourPunCallbacks.
void OnPlayerEnteredRoom | ( | Player | newPlayer | ) |
Called when a remote player entered the room. This Player is already added to the playerlist.
If your game starts with a certain number of players, this callback can be useful to check the Room.playerCount and find out if you can start.
Implemented in SupportLogger, PhotonHandler, MonoBehaviourPunCallbacks, PlayerNumbering, and PunTeams.
void OnPlayerLeftRoom | ( | Player | otherPlayer | ) |
Called when a remote player left the room or became inactive. Check otherPlayer.IsInactive.
If another player leaves the room or if the server detects a lost connection, this callback will be used to notify your game logic.
Depending on the room's setup, players may become inactive, which means they may return and retake their spot in the room. In such cases, the Player stays in the Room.Players dictionary.
If the player is not just inactive, it gets removed from the Room.Players dictionary, before the callback is called.
Implemented in SupportLogger, PhotonHandler, MonoBehaviourPunCallbacks, PlayerNumbering, and PunTeams.
void OnPlayerPropertiesUpdate | ( | Player | targetPlayer, |
Hashtable | changedProps | ||
) |
Called when custom player-properties are changed.
Changing properties must be done by Player.SetCustomProperties, which causes this callback locally, too.
targetPlayer | Contains Player that changed. |
changedProps | Contains the properties that changed. |
Implemented in SupportLogger, MonoBehaviourPunCallbacks, PhotonHandler, PlayerNumbering, and PunTeams.
void OnRoomPropertiesUpdate | ( | Hashtable | propertiesThatChanged | ) |
Called when room properties changed. The propertiesThatChanged contain only the keys that changed.
In most cases, this method gets called when some player changes the Room Properties. However, there are also "Well Known Properties" (which use byte keys) and this callback may include them. Especially when entering a room, the server will also send the required Well Known Properties and they are not filtered out for the OnRoomPropertiesUpdate callback.
You can safely ignore the byte typed keys in propertiesThatChanged.
Changing properties is usually done by Room.SetCustomProperties.
propertiesThatChanged |
Implemented in SupportLogger, MonoBehaviourPunCallbacks, PunTurnManager, PhotonHandler, and CountdownTimer.