Quantum 3 3.1.0

Public Member Functions | List of all members
Photon.Realtime.IInRoomCallbacks Interface Reference

Collection of "in room" callbacks for the Realtime Api to cover: Players entering or leaving, property updates and Master Client switching. More...

Public Member Functions

void OnMasterClientSwitched (Player newMasterClient)
 Called after switching to a new MasterClient when the current one leaves. More...
 
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 OnPlayerPropertiesUpdate (Player targetPlayer, PhotonHashtable changedProps)
 Called when custom player-properties are changed. More...
 
void OnRoomPropertiesUpdate (PhotonHashtable propertiesThatChanged)
 Called when room properties changed. The propertiesThatChanged contain only the keys that changed. More...
 

Detailed Description

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 RealtimeClient.AddCallbackTarget and pass the class implementing this interface To stop getting callbacks, call RealtimeClient.RemoveCallbackTarget and pass the class implementing this interface

Member Function Documentation

◆ OnPlayerEnteredRoom()

void Photon.Realtime.IInRoomCallbacks.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.

◆ OnPlayerLeftRoom()

void Photon.Realtime.IInRoomCallbacks.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.

◆ OnRoomPropertiesUpdate()

void Photon.Realtime.IInRoomCallbacks.OnRoomPropertiesUpdate ( PhotonHashtable  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.

Parameters
propertiesThatChanged

◆ OnPlayerPropertiesUpdate()

void Photon.Realtime.IInRoomCallbacks.OnPlayerPropertiesUpdate ( Player  targetPlayer,
PhotonHashtable  changedProps 
)

Called when custom player-properties are changed.

Changing properties must be done by Player.SetCustomProperties, which causes this callback locally, too.

Parameters
targetPlayerContains Player that changed.
changedPropsContains the properties that changed.

◆ OnMasterClientSwitched()

void Photon.Realtime.IInRoomCallbacks.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.