Photon .NET Client API
Public Types | Public Member Functions | Public Attributes | Properties | List of all members
ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient Class Reference

This class implements the Photon LoadBalancing workflow by using a LoadBalancingPeer. It keeps a state and will automatically execute transitions between the Master and Game Servers. More...

Inheritance diagram for ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient:
ExitGames.Client.Photon.IPhotonPeerListener

Public Types

enum  ServerConnection { ServerConnection.MasterServer, ServerConnection.GameServer, ServerConnection.NameServer }
 Available server (types) for internally used field: server. More...
 

Public Member Functions

 LoadBalancingClient (ConnectionProtocol protocol=ConnectionProtocol.Udp)
 
 LoadBalancingClient (string masterAddress, string appId, string gameVersion, ConnectionProtocol protocol=ConnectionProtocol.Udp)
 
bool Connect (string masterServerAddress, string appId, string appVersion, string nickName, AuthenticationValues authValues)
 Starts the "process" to connect to the master server. Relevant connection-values parameters can be set via parameters. More...
 
virtual bool Connect ()
 Starts the "process" to connect to a Master Server, using MasterServerAddress and AppId properties. More...
 
bool ConnectToNameServer ()
 Connects to the NameServer for Photon Cloud, where a region and server list can be obtained. More...
 
bool ConnectToRegionMaster (string region)
 Connects you to a specific region's Master Server, using the Name Server to find the IP. More...
 
void Disconnect ()
 Disconnects this client from any server and sets this.State if the connection is successfuly closed. More...
 
void Service ()
 This method excutes dispatches all incoming commands and sends anything in the outgoing queues via DispatchIncomingCommands and SendOutgoingCommands. More...
 
bool OpGetRegions ()
 While on the NameServer, this gets you the list of regional servers (short names and their IPs to ping them). More...
 
bool OpJoinLobby (TypedLobby lobby)
 Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms. This is an async request which triggers a OnOperationResponse() call. More...
 
bool OpLeaveLobby ()
 Opposite of joining a lobby. You don't have to explicitly leave a lobby to join another (client can be in one max, at any time). More...
 
bool OpJoinRandomRoom (Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers)
 Operation to join a random room if available. You can use room properties to filter accepted rooms. More...
 
bool OpJoinRandomRoom (Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers, MatchmakingMode matchmakingMode)
 Operation to join a random room if available. You can use room properties to filter accepted rooms. More...
 
bool OpJoinRandomRoom (Hashtable expectedCustomRoomProperties, byte expectedMaxPlayers, MatchmakingMode matchmakingMode, TypedLobby lobby, string sqlLobbyFilter)
 Operation to join a random room if available. You can use room properties to filter accepted rooms. More...
 
bool OpJoinRoom (string roomName)
 Joins a room by roomName. Useful when using room lists in lobbies or when you know the name otherwise. More...
 
bool OpJoinRoom (string roomName, int actorNumber)
 Joins a room by roomName. If this client returns to the room, set the previously used Player.ID as actorNumber. More...
 
bool OpJoinOrCreateRoom (string roomName, RoomOptions roomOptions, TypedLobby lobby)
 Joins a specific room by name. If the room does not exist (yet), it will be created implicitly. More...
 
bool OpCreateRoom (string roomName, RoomOptions roomOptions, TypedLobby lobby)
 Creates a new room on the server (or fails if the name is already in use). More...
 
bool OpLeaveRoom ()
 Leaves the CurrentRoom and returns to the Master server (back to the lobby). OpLeaveRoom skips execution when the room is null or the server is not GameServer or the client is disconnecting from GS already. OpLeaveRoom returns false in those cases and won't change the state, so check return of this method. More...
 
bool OpLeaveRoom (bool becomeInactive)
 Leaves the current room, optionally telling the server that the user is just becoming inactive. More...
 
bool OpFindFriends (string[] friendsToFind)
 Request the rooms and online status for a list of friends. All clients should set a unique UserId before connecting. The result is available in this.FriendList. More...
 
bool OpSetCustomPropertiesOfActor (int actorNr, Hashtable propertiesToSet, Hashtable expectedProperties=null)
 Updates and synchronizes a Player's Custom Properties. Optionally, expectedProperties can be provided as condition. More...
 
bool OpSetCustomPropertiesOfRoom (Hashtable propertiesToSet, bool webForward=false, Hashtable expectedProperties=null)
 Updates and synchronizes this Room's Custom Properties. Optionally, expectedProperties can be provided as condition. More...
 
virtual bool OpRaiseEvent (byte eventCode, object customEventContent, bool sendReliable, RaiseEventOptions raiseEventOptions)
 Send an event with custom code/type and any content to the other players in the same room. More...
 
bool OpWebRpc (string uriPath, object parameters)
 This operation makes Photon call your custom web-service by path/name with the given parameters (converted into JSon). More...
 
virtual void DebugReturn (DebugLevel level, string message)
 Debug output of low level api (and this client). More...
 
virtual void OnOperationResponse (OperationResponse operationResponse)
 Uses the OperationResponses provided by the server to advance the internal state and call ops as needed. More...
 
virtual void OnStatusChanged (StatusCode statusCode)
 Uses the connection's statusCodes to advance the internal state and call operations as needed. More...
 
virtual void OnEvent (EventData photonEvent)
 Uses the photonEvent's provided by the server to advance the internal state and call ops as needed. More...
 
virtual void OnMessage (object message)
 In Photon 4, "raw messages" will get their own callback method in the interface. Not used yet. More...
 

Public Attributes

LoadBalancingPeer loadBalancingPeer
 The client uses a LoadBalancingPeer as API to communicate with the server. This is public for ease-of-use: Some methods like OpRaiseEvent are not relevant for the connection state and don't need a override. More...
 
string NameServerHost = "ns.exitgames.com"
 Name Server Host Name for Photon Cloud. Without port and without any prefix. More...
 
string NameServerHttp = "http://ns.exitgames.com:80/photon/n"
 Name Server for HTTP connections to the Photon Cloud. Includes prefix and port. More...
 
bool EnableLobbyStatistics
 If set to true, the Master Server will report the list of used lobbies to the client. This sets and updates LobbyStatistics. More...
 
Dictionary< string, RoomInfoRoomInfoList = new Dictionary<string, RoomInfo>()
 This "list" is populated while being in the lobby of the Master. It contains RoomInfo per roomName (keys). More...
 
Room CurrentRoom
 The current room this client is connected to (null if none available). More...
 

Properties

string AppVersion [get, set]
 The version of your client. A new version also creates a new "virtual app" to separate players from older client versions. More...
 
string AppId [get, set]
 The AppID as assigned from the Photon Cloud. If you host yourself, this is the "regular" Photon Server Application Name (most likely: "LoadBalancing"). More...
 
AuthenticationValues AuthValues [get, set]
 A user's authentication values for authentication in Photon. More...
 
bool IsUsingNameServer [get, set]
 True if this client uses a NameServer to get the Master Server address. More...
 
string NameServerAddress [get]
 Name Server Address for Photon Cloud (based on current protocol). You can use the default values and usually won't have to set this value. More...
 
string CurrentServerAddress [get]
 The currently used server address (if any). The type of server is define by Server property. More...
 
string MasterServerAddress [get, set]
 Your Master Server address. In PhotonCloud, call ConnectToRegionMaster() to find your Master Server. More...
 
ServerConnection Server [get, set]
 The server this client is currently connected or connecting to. More...
 
ClientState State [get, set]
 Current state this client is in. Careful: several states are "transitions" that lead to other states. More...
 
bool IsConnected [get]
 Returns if this client is currently connected or connecting to some type of server. More...
 
bool IsConnectedAndReady [get]
 A refined version of IsConnected which is true only if your connection to the server is ready to accept operations. More...
 
Action< ClientStateOnStateChangeAction [get, set]
 Register a method to be called when this client's ClientState gets set. More...
 
Action< EventDataOnEventAction [get, set]
 Register a method to be called when an event got dispatched. Gets called at the end of OnEvent(). More...
 
Action< OperationResponseOnOpResponseAction [get, set]
 Register a method to be called when this client's ClientState gets set. More...
 
DisconnectCause DisconnectedCause [get, set]
 Summarizes (aggregates) the different causes for disconnects of a client. More...
 
TypedLobby CurrentLobby [get, set]
 The lobby this client currently uses. More...
 
string CurrentLobbyName [get]
 The name of the lobby this client currently uses. More...
 
LobbyType CurrentLobbyType [get]
 The type of the lobby this client currently uses. There are "default" and "SQL" typed lobbies. See: LobbyType. More...
 
bool AutoJoinLobby [get, set]
 If your client should join random games, you can skip joining the lobby. Call OpJoinRandomRoom and create a room if that fails. More...
 
List< TypedLobbyInfoLobbyStatistics [get, set]
 If RequestLobbyStatistics is true, this provides a list of used lobbies (their name, type, room- and player-count) of this application, while on the Master Server. More...
 
string PlayerName [get, set]
 Same as NickName. More...
 
string NickName [get, set]
 The nickname of the player (synced with others). Same as client.LocalPlayer.NickName. More...
 
string UserId [get, set]
 An ID for this user. Sent in OpAuthenticate when you connect. If not set, the PlayerName is applied during connect. More...
 
Player LocalPlayer [get, set]
 The local player is never null but not valid unless the client is in a room, too. The ID will be -1 outside of rooms. More...
 
int PlayersOnMasterCount [get, set]
 Statistic value available on master server: Players on master (looking for games). More...
 
int PlayersInRoomsCount [get, set]
 Statistic value available on master server: Players in rooms (playing). More...
 
int RoomsCount [get, set]
 Statistic value available on master server: Rooms currently created. More...
 
List< FriendInfoFriendList [get, set]
 List of friends, their online status and the room they are in. Null until initialized by OpFindFriends response. More...
 
int FriendListAge [get]
 Age of friend list info (in milliseconds). It's 0 until a friend list is fetched. More...
 
bool IsAuthorizeSecretAvailable [get]
 Internally used to check if a "Secret" is available to use. Sent by Photon Cloud servers, it simplifies authentication when switching servers. More...
 
string[] AvailableRegions [get, set]
 A list of region names for the Photon Cloud. Set by the result of OpGetRegions(). More...
 
string[] AvailableRegionsServers [get, set]
 A list of region server (IP addresses with port) for the Photon Cloud. Set by the result of OpGetRegions(). More...
 
string CloudRegion [get, set]
 The cloud region this client connects to. Set by ConnectToRegionMaster(). Not set if you don't use a NameServer! More...
 

Detailed Description

This class implements the Photon LoadBalancing workflow by using a LoadBalancingPeer. It keeps a state and will automatically execute transitions between the Master and Game Servers.

This class (and the Player class) should be extended to implement your own game logic. You can override CreatePlayer as "factory" method for Players and return your own Player instances. The State of this class is essential to know when a client is in a lobby (or just on the master) and when in a game where the actual gameplay should take place. Extension notes: An extension of this class should override the methods of the IPhotonPeerListener, as they are called when the state changes. Call base.method first, then pick the operation or state you want to react to and put it in a switch-case. We try to provide demo to each platform where this api can be used, so lookout for those.

Member Enumeration Documentation

Available server (types) for internally used field: server.

Enumerator
MasterServer 
GameServer 
NameServer 

Constructor & Destructor Documentation

ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.LoadBalancingClient ( ConnectionProtocol  protocol = ConnectionProtocol.Udp)
inline
ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.LoadBalancingClient ( string  masterAddress,
string  appId,
string  gameVersion,
ConnectionProtocol  protocol = ConnectionProtocol.Udp 
)
inline

Member Function Documentation

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.Connect ( string  masterServerAddress,
string  appId,
string  appVersion,
string  nickName,
AuthenticationValues  authValues 
)
inline

Starts the "process" to connect to the master server. Relevant connection-values parameters can be set via parameters.

The process to connect includes several steps: the actual connecting, establishing encryption, authentification (of app and optionally the user) and joining a lobby (if AutoJoinLobby is true).

Instead of providing all these parameters, you can also set the individual properties of a client before calling Connect().

Users can connect either anonymously or use "Custom Authentication" to verify each individual player's login. Custom Authentication in Photon uses external services and communities to verify users. While the client provides a user's info, the service setup is done in the Photon Cloud Dashboard. The parameter authValues will set this.AuthValues and use them in the connect process.

To connect to the Photon Cloud, a valid AppId must be provided. This is shown in the Photon Cloud Dashboard. https://cloud.photonengine.com/dashboard Connecting to the Photon Cloud might fail due to:

Parameters
masterServerAddressSet a master server address instead of using the default. Uses default if null or empty.
appIdYour application's name or the AppID assigned by Photon Cloud (as listed in Dashboard). Uses default if null or empty.
appVersionCan be used to separate users by their client's version (useful to add features without breaking older clients). Uses default if null or empty.
nickNameOptional name for this player.
authValuesAuthentication values for this user. Optional. If you provide a unique userID it is used for FindFriends.
Returns
If the operation could be send (can be false for bad server urls).
virtual bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.Connect ( )
inlinevirtual

Starts the "process" to connect to a Master Server, using MasterServerAddress and AppId properties.

To connect to the Photon Cloud, use ConnectToRegionMaster().

The process to connect includes several steps: the actual connecting, establishing encryption, authentification (of app and optionally the user) and joining a lobby (if AutoJoinLobby is true).

Users can connect either anonymously or use "Custom Authentication" to verify each individual player's login. Custom Authentication in Photon uses external services and communities to verify users. While the client provides a user's info, the service setup is done in the Photon Cloud Dashboard. The parameter authValues will set this.AuthValues and use them in the connect process.

Connecting to the Photon Cloud might fail due to:

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.ConnectToNameServer ( )
inline

Connects to the NameServer for Photon Cloud, where a region and server list can be obtained.

OpGetRegions

Returns
If the workflow was started or failed right away.
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.ConnectToRegionMaster ( string  region)
inline

Connects you to a specific region's Master Server, using the Name Server to find the IP.

Returns
If the operation could be sent. If false, no operation was sent.
virtual void ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.DebugReturn ( DebugLevel  level,
string  message 
)
inlinevirtual

Debug output of low level api (and this client).

This method is not responsible to keep up the state of a LoadBalancingClient. Calling base.DebugReturn on overrides is optional.

Implements ExitGames.Client.Photon.IPhotonPeerListener.

void ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.Disconnect ( )
inline

Disconnects this client from any server and sets this.State if the connection is successfuly closed.

virtual void ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnEvent ( EventData  photonEvent)
inlinevirtual

Uses the photonEvent's provided by the server to advance the internal state and call ops as needed.

This method is essential to update the internal state of a LoadBalancingClient. Overriding methods must call base.OnEvent.

Implements ExitGames.Client.Photon.IPhotonPeerListener.

virtual void ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnMessage ( object  message)
inlinevirtual

In Photon 4, "raw messages" will get their own callback method in the interface. Not used yet.

virtual void ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnOperationResponse ( OperationResponse  operationResponse)
inlinevirtual

Uses the OperationResponses provided by the server to advance the internal state and call ops as needed.

When this method finishes, it will call your OnOpResponseAction (if any). This way, you can get any operation response without overriding this class.

To implement a more complex game/app logic, you should implement your own class that inherits the LoadBalancingClient. Override this method to use your own operation-responses easily.

This method is essential to update the internal state of a LoadBalancingClient, so overriding methods must call base.OnOperationResponse().

Parameters
operationResponseContains the server's response for an operation called by this peer.

Implements ExitGames.Client.Photon.IPhotonPeerListener.

virtual void ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnStatusChanged ( StatusCode  statusCode)
inlinevirtual

Uses the connection's statusCodes to advance the internal state and call operations as needed.

This method is essential to update the internal state of a LoadBalancingClient. Overriding methods must call base.OnStatusChanged.

Implements ExitGames.Client.Photon.IPhotonPeerListener.

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpCreateRoom ( string  roomName,
RoomOptions  roomOptions,
TypedLobby  lobby 
)
inline

Creates a new room on the server (or fails if the name is already in use).

If you don't want to create a unique room-name, pass null or "" as name and the server will assign a roomName (a GUID as string). Room names are unique.

A room will be attached to the specified lobby. Use null as lobby to attach the room to the lobby you are now in. If you are in no lobby, the default lobby is used.

Multiple lobbies can help separate players by map or skill or game type. Each room can only be found in one lobby (no matter if defined by name and type or as default).

This method can only be called while the client is connected to a Master Server. You should check LoadBalancingClient.Server and LoadBalancingClient.IsConnectedAndReady before calling this method. Alternatively, check the returned bool value.

Even when sent, the Operation will fail (on the server) if the roomName is in use. Override this class and implement OnOperationResponse(OperationResponse operationResponse) to get the errors.

While the server is creating the game, the State will be ClientState.Joining. The state Joining is used because the client is on the way to enter a room (no matter if joining or creating). It's set immediately when this method sends the Operation.

If successful, the LoadBalancingClient will get a Game Server Address and use it automatically to switch servers and enter the room. When you're in the room, this client's State will become ClientState.Joined (both, for joining or creating it). Set a OnStateChangeAction method to check for states.

When entering the room, this client's Player Custom Properties will be sent to the room. Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room. Note that the player properties will be cached locally and sent to any next room you would join, too.

Parameters
roomNameThe name to create a room with. Must be unique and not in use or can't be created. If null, the server will assign a GUID as name.
roomOptionsContains the parameters and properties of the new room. See RoomOptions class for a description of each.
lobbyThe lobby (name and type) in which to create the room. Null uses the current lobby or the default lobby (if not in a lobby).
Returns
If the operation could be sent currently (requires connection to Master Server).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpFindFriends ( string[]  friendsToFind)
inline

Request the rooms and online status for a list of friends. All clients should set a unique UserId before connecting. The result is available in this.FriendList.

Used on Master Server to find the rooms played by a selected list of users. The result will be stored in LoadBalancingClient.FriendList, which is null before the first server response.

Users identify themselves by setting a UserId in the LoadBalancingClient instance. This will send the ID in OpAuthenticate during connect (to master and game servers). Note: Changing a player's name doesn't make sense when using a friend list.

The list of usernames must be fetched from some other source (not provided by Photon).

Internal: The server response includes 2 arrays of info (each index matching a friend from the request): ParameterCode.FindFriendsResponseOnlineList = bool[] of online states ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)

Parameters
friendsToFindArray of friend's names (make sure they are unique).
Returns
If the operation could be sent (requires connection).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpGetRegions ( )
inline

While on the NameServer, this gets you the list of regional servers (short names and their IPs to ping them).

Returns
If the operation could be sent. If false, no operation was sent (e.g. while not connected to the NameServer).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpJoinLobby ( TypedLobby  lobby)
inline

Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms. This is an async request which triggers a OnOperationResponse() call.

Parameters
lobbyThe lobby join to. Use null for default lobby.
Returns
If the operation could be sent (has to be connected).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpJoinOrCreateRoom ( string  roomName,
RoomOptions  roomOptions,
TypedLobby  lobby 
)
inline

Joins a specific room by name. If the room does not exist (yet), it will be created implicitly.

Unlike OpJoinRoom, this operation does not fail if the room does not exist. This can be useful when you send invitations to a room before actually creating it: Any invited player (whoever is first) can call this and on demand, the room gets created implicitly.

This operation does not allow you to re-join a game. To return to a room, use OpJoinRoom with the actorNumber which was assigned previously.

If you set room properties in RoomOptions, they get ignored when the room is existing already. This avoids changing the room properties by late joining players. Only when the room gets created, the RoomOptions are set in this case.

If the room is full or closed, this will fail. Override this class and implement OnOperationResponse(OperationResponse operationResponse) to get the errors.

This method can only be called while the client is connected to a Master Server. You should check LoadBalancingClient.Server and LoadBalancingClient.IsConnectedAndReady before calling this method. Alternatively, check the returned bool value.

While the server is joining the game, the State will be ClientState.Joining. It's set immediately when this method sends the Operation.

If successful, the LoadBalancingClient will get a Game Server Address and use it automatically to switch servers and join the room. When you're in the room, this client's State will become ClientState.Joined (both, for joining or creating it). Set a OnStateChangeAction method to check for states.

When entering the room, this client's Player Custom Properties will be sent to the room. Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room. Note that the player properties will be cached locally and sent to any next room you would join, too.

Parameters
roomNameThe name of the room to join (might be created implicitly).
roomOptionsContains the parameters and properties of the new room. See RoomOptions class for a description of each.
lobbyTyped lobby to be used if the roomname is not in use (and room gets created). If != null, it will also set CurrentLobby.
Returns
If the operation could be sent currently (requires connection to Master Server).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpJoinRandomRoom ( Hashtable  expectedCustomRoomProperties,
byte  expectedMaxPlayers 
)
inline

Operation to join a random room if available. You can use room properties to filter accepted rooms.

You can use expectedCustomRoomProperties and expectedMaxPlayers as filters for accepting rooms. If you set expectedCustomRoomProperties, a room must have the exact same key values set at Custom Properties. You need to define which Custom Room Properties will be available for matchmaking when you create a room. See: OpCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby)

This operation fails if no rooms are fitting or available (all full, closed or not visible). Override this class and implement OnOperationResponse(OperationResponse operationResponse).

OpJoinRandomRoom can only be called while the client is connected to a Master Server. You should check LoadBalancingClient.Server and LoadBalancingClient.IsConnectedAndReady before calling this method. Alternatively, check the returned bool value.

While the server is looking for a game, the State will be Joining. It's set immediately when this method sent the Operation.

If successful, the LoadBalancingClient will get a Game Server Address and use it automatically to switch servers and join the room. When you're in the room, this client's State will become ClientState.Joined (both, for joining or creating it). Set a OnStateChangeAction method to check for states.

When joining a room, this client's Player Custom Properties will be sent to the room. Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room. Note that the player properties will be cached locally and sent to any next room you would join, too.

More about matchmaking: http://doc.photonengine.com/en/realtime/current/reference/matchmaking-and-lobby

Parameters
expectedCustomRoomPropertiesOptional. A room will only be joined, if it matches these custom properties (with string keys).
expectedMaxPlayersFilters for a particular maxplayer setting. Use 0 to accept any maxPlayer value.
Returns
If the operation could be sent currently (requires connection to Master Server).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpJoinRandomRoom ( Hashtable  expectedCustomRoomProperties,
byte  expectedMaxPlayers,
MatchmakingMode  matchmakingMode 
)
inline

Operation to join a random room if available. You can use room properties to filter accepted rooms.

You can use expectedCustomRoomProperties and expectedMaxPlayers as filters for accepting rooms. If you set expectedCustomRoomProperties, a room must have the exact same key values set at Custom Properties. You need to define which Custom Room Properties will be available for matchmaking when you create a room. See: OpCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby)

This operation fails if no rooms are fitting or available (all full, closed or not visible). Override this class and implement OnOperationResponse(OperationResponse operationResponse).

OpJoinRandomRoom can only be called while the client is connected to a Master Server. You should check LoadBalancingClient.Server and LoadBalancingClient.IsConnectedAndReady before calling this method. Alternatively, check the returned bool value.

While the server is looking for a game, the State will be Joining. It's set immediately when this method sent the Operation.

If successful, the LoadBalancingClient will get a Game Server Address and use it automatically to switch servers and join the room. When you're in the room, this client's State will become ClientState.Joined (both, for joining or creating it). Set a OnStateChangeAction method to check for states.

When joining a room, this client's Player Custom Properties will be sent to the room. Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room. Note that the player properties will be cached locally and sent to any next room you would join, too.

More about matchmaking: http://doc.photonengine.com/en/realtime/current/reference/matchmaking-and-lobby

Parameters
expectedCustomRoomPropertiesOptional. A room will only be joined, if it matches these custom properties (with string keys).
expectedMaxPlayersFilters for a particular maxplayer setting. Use 0 to accept any maxPlayer value.
matchmakingModeSelects one of the available matchmaking algorithms. See MatchmakingMode enum for options.
Returns
If the operation could be sent currently (requires connection to Master Server).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpJoinRandomRoom ( Hashtable  expectedCustomRoomProperties,
byte  expectedMaxPlayers,
MatchmakingMode  matchmakingMode,
TypedLobby  lobby,
string  sqlLobbyFilter 
)
inline

Operation to join a random room if available. You can use room properties to filter accepted rooms.

You can use expectedCustomRoomProperties and expectedMaxPlayers as filters for accepting rooms. If you set expectedCustomRoomProperties, a room must have the exact same key values set at Custom Properties. You need to define which Custom Room Properties will be available for matchmaking when you create a room. See: OpCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby)

This operation fails if no rooms are fitting or available (all full, closed or not visible). Override this class and implement OnOperationResponse(OperationResponse operationResponse).

OpJoinRandomRoom can only be called while the client is connected to a Master Server. You should check LoadBalancingClient.Server and LoadBalancingClient.IsConnectedAndReady before calling this method. Alternatively, check the returned bool value.

While the server is looking for a game, the State will be Joining. It's set immediately when this method sent the Operation.

If successful, the LoadBalancingClient will get a Game Server Address and use it automatically to switch servers and join the room. When you're in the room, this client's State will become ClientState.Joined (both, for joining or creating it). Set a OnStateChangeAction method to check for states.

When joining a room, this client's Player Custom Properties will be sent to the room. Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room. Note that the player properties will be cached locally and sent to any next room you would join, too.

The parameter lobby can be null (using the defaul lobby) or a typed lobby you make up. Lobbies are created on the fly, as required by the clients. If you organize matchmaking with lobbies, keep in mind that they also fragment your matchmaking. Using more lobbies will put less rooms in each.

The parameter sqlLobbyFilter can only be combined with the LobbyType.SqlLobby. In that case, it's used to define a sql-like "WHERE" clause for filtering rooms. This is useful for skill-based matchmaking e.g..

More about matchmaking: http://doc.photonengine.com/en/realtime/current/reference/matchmaking-and-lobby

Parameters
expectedCustomRoomPropertiesOptional. A room will only be joined, if it matches these custom properties (with string keys).
expectedMaxPlayersFilters for a particular maxplayer setting. Use 0 to accept any maxPlayer value.
matchmakingModeSelects one of the available matchmaking algorithms. See MatchmakingMode enum for options.
lobbyThe lobby in which to find a room. Use null for default lobby.
sqlLobbyFilterCan be used with LobbyType.SqlLobby only. This is a "where" clause of a sql statement. Use null for random game.
Returns
If the operation could be sent currently (requires connection to Master Server).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpJoinRoom ( string  roomName)
inline

Joins a room by roomName. Useful when using room lists in lobbies or when you know the name otherwise.

This method is useful when you are using a lobby to list rooms and know their names. A room's name has to be unique (per region and game version), so it does not matter which lobby it's in.

If the room is full, closed or not existing, this will fail. Override this class and implement OnOperationResponse(OperationResponse operationResponse) to get the errors.

OpJoinRoom can only be called while the client is connected to a Master Server. You should check LoadBalancingClient.Server and LoadBalancingClient.IsConnectedAndReady before calling this method. Alternatively, check the returned bool value.

While the server is joining the game, the State will be ClientState.Joining. It's set immediately when this method sends the Operation.

If successful, the LoadBalancingClient will get a Game Server Address and use it automatically to switch servers and join the room. When you're in the room, this client's State will become ClientState.Joined (both, for joining or creating it). Set a OnStateChangeAction method to check for states.

When joining a room, this client's Player Custom Properties will be sent to the room. Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room. Note that the player properties will be cached locally and sent to any next room you would join, too.

It's usually better to use OpJoinOrCreateRoom for invitations. Then it does not matter if the room is already setup.

Parameters
roomNameThe name of the room to join. Must be existing already, open and non-full or can't be joined.
Returns
If the operation could be sent currently (requires connection to Master Server).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpJoinRoom ( string  roomName,
int  actorNumber 
)
inline

Joins a room by roomName. If this client returns to the room, set the previously used Player.ID as actorNumber.

This method is useful when you are using a lobby to list rooms and know their names. A room's name has to be unique (per region and game version), so it does not matter which lobby it's in.

If this client returns to the room, set the previously used Player.ID as actorNumber. When you are using Custom Authentication with unique user IDs, the server will use the userID to find the previously assigned actorNumber in the room.

For turnbased games, this is especially useful as rooms can be continued after hours or days. To return to a room, set the actorNumber to anything but 0. It's best practice to use -1 with Custom Authentication and unique user accounts.

If the room is full, closed or not existing, this will fail. Override this class and implement OnOperationResponse(OperationResponse operationResponse) to get the errors.

OpJoinRoom can only be called while the client is connected to a Master Server. You should check LoadBalancingClient.Server and LoadBalancingClient.IsConnectedAndReady before calling this method. Alternatively, check the returned bool value.

While the server is joining the game, the State will be ClientState.Joining. It's set immediately when this method sends the Operation.

If successful, the LoadBalancingClient will get a Game Server Address and use it automatically to switch servers and join the room. When you're in the room, this client's State will become ClientState.Joined (both, for joining or creating it). Set a OnStateChangeAction method to check for states.

When joining a room, this client's Player Custom Properties will be sent to the room. Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room. Note that the player properties will be cached locally and sent to any next room you would join, too.

It's usually better to use OpJoinOrCreateRoom for invitations. Then it does not matter if the room is already setup.

Parameters
roomNameThe name of the room to join. Must be existing already, open and non-full or can't be joined.
actorNumberWhen returning to a room, use a non-0 value. For Turnbased games, set the previously assigned Player.ID or -1 when using Custom Authentication.
Returns
If the operation could be sent currently (requires connection to Master Server).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpLeaveLobby ( )
inline

Opposite of joining a lobby. You don't have to explicitly leave a lobby to join another (client can be in one max, at any time).

Returns
If the operation could be sent (has to be connected).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpLeaveRoom ( )
inline

Leaves the CurrentRoom and returns to the Master server (back to the lobby). OpLeaveRoom skips execution when the room is null or the server is not GameServer or the client is disconnecting from GS already. OpLeaveRoom returns false in those cases and won't change the state, so check return of this method.

This method actually is not an operation per se. It sets a state and calls Disconnect(). This is is quicker than calling OpLeave and then disconnect (which also triggers a leave).

Returns
If the current room could be left (impossible while not in a room).
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpLeaveRoom ( bool  becomeInactive)
inline

Leaves the current room, optionally telling the server that the user is just becoming inactive.

Parameters
becomeInactiveIf true, this player becomes inactive in the game and can return later (if PlayerTTL of the room is > 0).

OpLeaveRoom skips execution when the room is null or the server is not GameServer or the client is disconnecting from GS already. OpLeaveRoom returns false in those cases and won't change the state, so check return of this method.

In some cases, this method will skip the OpLeave call and just call Disconnect(), which not only leaves the room but also the server. Disconnect also triggers a leave and so that workflow is is quicker.

Returns
If the current room could be left (impossible while not in a room).
virtual bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpRaiseEvent ( byte  eventCode,
object  customEventContent,
bool  sendReliable,
RaiseEventOptions  raiseEventOptions 
)
inlinevirtual

Send an event with custom code/type and any content to the other players in the same room.

This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.

Parameters
eventCodeIdentifies this type of event (and the content). Your game's event codes can start with 0.
customEventContentAny serializable datatype (including Hashtable like the other OpRaiseEvent overloads).
sendReliableIf this event has to arrive reliably (potentially repeated if it's lost).
raiseEventOptionsContains (slightly) less often used options. If you pass null, the default options will be used.
Returns
If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpSetCustomPropertiesOfActor ( int  actorNr,
Hashtable  propertiesToSet,
Hashtable  expectedProperties = null 
)
inline

Updates and synchronizes a Player's Custom Properties. Optionally, expectedProperties can be provided as condition.

Custom Properties are a set of string keys and arbitrary values which is synchronized for the players in a Room. They are available when the client enters the room, as they are in the response of OpJoin and OpCreate.

Custom Properties either relate to the (current) Room or a Player (in that Room).

Both classes locally cache the current key/values and make them available as property: CustomProperties. This is provided only to read them. You must use the method SetCustomProperties to set/modify them.

Any client can set any Custom Properties anytime. It's up to the game logic to organize how they are best used.

You should call SetCustomProperties only with key/values that are new or changed. This reduces traffic and performance.

Unless you define some expectedProperties, setting key/values is always permitted. In this case, the property-setting client will not receive the new values from the server but instead update its local cache in SetCustomProperties.

If you define expectedProperties, the server will skip updates if the server property-cache does not contain all expectedProperties with the same values. In this case, the property-setting client will get an update from the server and update it's cached key/values at about the same time as everyone else.

The benefit of using expectedProperties can be only one client successfully sets a key from one known value to another. As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally. When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to take the item will have it (and the others fail to set the ownership).

Properties get saved with the game state for Turnbased games (which use IsPersistent = true).

Parameters
actorNrDefines which player the Custom Properties belong to. ActorID of a player.
propertiesToSetHashtable of Custom Properties that changes.
expectedPropertiesProvide some keys/values to use as condition for setting the new values.
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpSetCustomPropertiesOfRoom ( Hashtable  propertiesToSet,
bool  webForward = false,
Hashtable  expectedProperties = null 
)
inline

Updates and synchronizes this Room's Custom Properties. Optionally, expectedProperties can be provided as condition.

Custom Properties are a set of string keys and arbitrary values which is synchronized for the players in a Room. They are available when the client enters the room, as they are in the response of OpJoin and OpCreate.

Custom Properties either relate to the (current) Room or a Player (in that Room).

Both classes locally cache the current key/values and make them available as property: CustomProperties. This is provided only to read them. You must use the method SetCustomProperties to set/modify them.

Any client can set any Custom Properties anytime. It's up to the game logic to organize how they are best used.

You should call SetCustomProperties only with key/values that are new or changed. This reduces traffic and performance.

Unless you define some expectedProperties, setting key/values is always permitted. In this case, the property-setting client will not receive the new values from the server but instead update its local cache in SetCustomProperties.

If you define expectedProperties, the server will skip updates if the server property-cache does not contain all expectedProperties with the same values. In this case, the property-setting client will get an update from the server and update it's cached key/values at about the same time as everyone else.

The benefit of using expectedProperties can be only one client successfully sets a key from one known value to another. As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally. When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to take the item will have it (and the others fail to set the ownership).

Properties get saved with the game state for Turnbased games (which use IsPersistent = true).

Parameters
propertiesToSetHashtable of Custom Properties that changes.
webForwardDefines if the set properties should be forwarded to a WebHook.
expectedPropertiesProvide some keys/values to use as condition for setting the new values.
bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OpWebRpc ( string  uriPath,
object  parameters 
)
inline

This operation makes Photon call your custom web-service by path/name with the given parameters (converted into JSon).

This is a "Photon Turnbased" feature and you have to setup your Photon Cloud Application prior to use.

The response by Photon will call OnOperationResponse() with Code: OperationCode.WebRpc. It's important to understand that the OperationResponse tells you if the WebRPC could be called or not but the content of the response will contain the values the web-service sent (if any). If the web-service could not execute the request, it might return another error and a message. This is inside of the (wrapping) OperationResponse. The class WebRpcResponse is a helper-class that extracts the most valuable content from the WebRPC response.

See the Turnbased Feature Overview for a short intro. http://doc.photonengine.com/en/turnbased/current/getting-started/feature-overview

It's best to inherit a LoadBalancingClient into your own. Implement something like:

public override void OnOperationResponse(OperationResponse operationResponse)
{
    base.OnOperationResponse(operationResponse);  // important to call, to keep state up to date

    switch (operationResponse.OperationCode) {
    case OperationCode.WebRpc:

        if (operationResponse.ReturnCode != 0)
        {
            DebugReturn(DebugLevel.ERROR, "WebRpc failed. Response: " + operationResponse.ToStringFull());
        }
        else
        {
            WebRpcResponse webResponse = new WebRpcResponse(operationResponse);
            this.OnWebRpcResponse(webResponse);
        }
        break;

    // more code [...]
void ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.Service ( )
inline

This method excutes dispatches all incoming commands and sends anything in the outgoing queues via DispatchIncomingCommands and SendOutgoingCommands.

The Photon client libraries are designed to fit easily into a game or application. The application is in control of the context (thread) in which incoming events and responses are executed and has full control of the creation of UDP/TCP packages.

Sending packages and dispatching received messages are two separate tasks. Service combines them into one method at the cost of control. It calls DispatchIncomingCommands and SendOutgoingCommands.

Call this method regularly (2..20 times a second).

This will Dispatch ANY received commands (unless a reliable command in-order is still missing) and events AND will send queued outgoing commands. Fewer calls might be more effective if a device cannot send many packets per second, as multiple operations might be combined into one package.

You could replace Service by:

while (DispatchIncomingCommands()); //Dispatch until everything is Dispatched...
SendOutgoingCommands(); //Send a UDP/TCP package with outgoing messages
See Also
PhotonPeer.DispatchIncomingCommands, PhotonPeer.SendOutgoingCommands

Member Data Documentation

Room ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.CurrentRoom

The current room this client is connected to (null if none available).

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.EnableLobbyStatistics

If set to true, the Master Server will report the list of used lobbies to the client. This sets and updates LobbyStatistics.

Lobby Statistics can be useful if a game uses multiple lobbies and you want to show activity of each to players.

LobbyStatistics are updated when you connect to the Master Server.

LoadBalancingPeer ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.loadBalancingPeer

The client uses a LoadBalancingPeer as API to communicate with the server. This is public for ease-of-use: Some methods like OpRaiseEvent are not relevant for the connection state and don't need a override.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.NameServerHost = "ns.exitgames.com"

Name Server Host Name for Photon Cloud. Without port and without any prefix.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.NameServerHttp = "http://ns.exitgames.com:80/photon/n"

Name Server for HTTP connections to the Photon Cloud. Includes prefix and port.

Dictionary<string, RoomInfo> ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.RoomInfoList = new Dictionary<string, RoomInfo>()

This "list" is populated while being in the lobby of the Master. It contains RoomInfo per roomName (keys).

Property Documentation

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.AppId
getset

The AppID as assigned from the Photon Cloud. If you host yourself, this is the "regular" Photon Server Application Name (most likely: "LoadBalancing").

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.AppVersion
getset

The version of your client. A new version also creates a new "virtual app" to separate players from older client versions.

AuthenticationValues ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.AuthValues
getset

A user's authentication values for authentication in Photon.

Set this property or pass AuthenticationValues by Connect(..., authValues).

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.AutoJoinLobby
getset

If your client should join random games, you can skip joining the lobby. Call OpJoinRandomRoom and create a room if that fails.

string [] ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.AvailableRegions
getset

A list of region names for the Photon Cloud. Set by the result of OpGetRegions().

Put a "case OperationCode.GetRegions:" into your OnOperationResponse method to notice when the result is available.

string [] ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.AvailableRegionsServers
getset

A list of region server (IP addresses with port) for the Photon Cloud. Set by the result of OpGetRegions().

Put a "case OperationCode.GetRegions:" into your OnOperationResponse method to notice when the result is available.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.CloudRegion
getset

The cloud region this client connects to. Set by ConnectToRegionMaster(). Not set if you don't use a NameServer!

TypedLobby ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.CurrentLobby
getset

The lobby this client currently uses.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.CurrentLobbyName
get

The name of the lobby this client currently uses.

Deprecated:
Use CurrentLobby.Name
LobbyType ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.CurrentLobbyType
get

The type of the lobby this client currently uses. There are "default" and "SQL" typed lobbies. See: LobbyType.

Deprecated:
Use CurrentLobby.Type
string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.CurrentServerAddress
get

The currently used server address (if any). The type of server is define by Server property.

DisconnectCause ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.DisconnectedCause
getset

Summarizes (aggregates) the different causes for disconnects of a client.

A disconnect can be caused by: errors in the network connection or some vital operation failing (which is considered "high level"). While operations always trigger a call to OnOperationResponse, connection related changes are treated in OnStatusChanged. The DisconnectCause is set in either case and summarizes the causes for any disconnect in a single state value which can be used to display (or debug) the cause for disconnection.

List<FriendInfo> ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.FriendList
getset

List of friends, their online status and the room they are in. Null until initialized by OpFindFriends response.

Do not modify this list! It's internally handled by OpFindFriends and meant as read-only. The value of FriendListAge gives you a hint how old the data is. Don't get this list more often than useful (> 10 seconds). In best case, keep the list you fetch really short. You could (e.g.) get the full list only once, then request a few updates only for friends who are online. After a while (e.g. 1 minute), you can get the full list again.

int ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.FriendListAge
get

Age of friend list info (in milliseconds). It's 0 until a friend list is fetched.

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.IsAuthorizeSecretAvailable
getprotected

Internally used to check if a "Secret" is available to use. Sent by Photon Cloud servers, it simplifies authentication when switching servers.

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.IsConnected
get

Returns if this client is currently connected or connecting to some type of server.

This is even true while switching servers. Use IsConnectedAndReady to check only for those states that enable you to send Operations.

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.IsConnectedAndReady
get

A refined version of IsConnected which is true only if your connection to the server is ready to accept operations.

Which operations are available, depends on the Server. For example, the NameServer allows OpGetRegions which is not available anywhere else. The MasterServer does not allow you to send events (OpRaiseEvent) and on the GameServer you are unable to join a lobby (OpJoinLobby). Check which server you are on with PhotonNetwork.Server.

bool ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.IsUsingNameServer
getset

True if this client uses a NameServer to get the Master Server address.

List<TypedLobbyInfo> ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.LobbyStatistics
getset

If RequestLobbyStatistics is true, this provides a list of used lobbies (their name, type, room- and player-count) of this application, while on the Master Server.

If turned on, the Master Server will provide information about active lobbies for this application.

Lobby Statistics can be useful if a game uses multiple lobbies and you want to show activity of each to players. Per lobby, you get: name, type, room- and player-count.

Lobby Statistics are not turned on by default. Enable them by setting RequestLobbyStatistics to true before you connect.

LobbyStatistics are updated when you connect to the Master Server. You can check in OnEvent if EventCode.LobbyStats arrived. This the updates.

Player ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.LocalPlayer
getset

The local player is never null but not valid unless the client is in a room, too. The ID will be -1 outside of rooms.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.MasterServerAddress
getset

Your Master Server address. In PhotonCloud, call ConnectToRegionMaster() to find your Master Server.

In the Photon Cloud, explicit definition of a Master Server Address is not best practice. The Photon Cloud has a "Name Server" which redirects clients to a specific Master Server (per Region and AppId).

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.NameServerAddress
get

Name Server Address for Photon Cloud (based on current protocol). You can use the default values and usually won't have to set this value.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.NickName
getset

The nickname of the player (synced with others). Same as client.LocalPlayer.NickName.

Action<EventData> ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnEventAction
getset

Register a method to be called when an event got dispatched. Gets called at the end of OnEvent().

This is an alternative to extending LoadBalancingClient to override OnEvent().

Note that OnEvent is executing before your Action is called. That means for example: Joining players will already be in the player list but leaving players will already be removed from the room.

Action<OperationResponse> ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnOpResponseAction
getset

Register a method to be called when this client's ClientState gets set.

This is an alternative to extending LoadBalancingClient to override OnOperationResponse().

Note that OnOperationResponse gets executed before your Action is called. That means for example: The OpJoinLobby response already set the state to "JoinedLobby" and the response to OpLeave already triggered the Disconnect before this is called.

Action<ClientState> ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.OnStateChangeAction
getset

Register a method to be called when this client's ClientState gets set.

This can be useful to react to being connected, joined into a room, etc.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.PlayerName
getset

Same as NickName.

int ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.PlayersInRoomsCount
getset

Statistic value available on master server: Players in rooms (playing).

int ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.PlayersOnMasterCount
getset

Statistic value available on master server: Players on master (looking for games).

int ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.RoomsCount
getset

Statistic value available on master server: Rooms currently created.

ServerConnection ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.Server
getset

The server this client is currently connected or connecting to.

Each server (NameServer, MasterServer, GameServer) allow some operations and reject others.

ClientState ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.State
getset

Current state this client is in. Careful: several states are "transitions" that lead to other states.

string ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.UserId
getset

An ID for this user. Sent in OpAuthenticate when you connect. If not set, the PlayerName is applied during connect.

On connect, if the UserId is null or empty, the client will copy the PlayName to UserId. If PlayerName is not set either (before connect), the server applies a temporary ID which stays unknown to this client and other clients.

The UserId is what's used in FindFriends and for fetching data for your account (with WebHooks e.g.).

By convention, set this ID before you connect, not while being connected. There is no error but the ID won't change while being connected.


The documentation for this class was generated from the following file: