Summarizes a "player" within a room, identified (in that room) by actorID. More...
Inherits IComparable< PhotonPlayer >, IComparable< int >, IEquatable< PhotonPlayer >, and IEquatable< int >.
|PhotonPlayer (bool isLocal, int actorID, string name)|
|Creates a PhotonPlayer instance. More...|
|override bool||Equals (object p)|
|Makes PhotonPlayer comparable More...|
|override int||GetHashCode ()|
|void||SetCustomProperties (Hashtable propertiesToSet, Hashtable expectedValues=null, bool webForward=false)|
|Updates the this player's Custom Properties with new/updated key-values. More...|
|PhotonPlayer||Get (int id)|
|PhotonPlayer||GetNextFor (PhotonPlayer currentPlayer)|
|PhotonPlayer||GetNextFor (int currentPlayerId)|
|int||CompareTo (PhotonPlayer other)|
|int||CompareTo (int other)|
|bool||Equals (PhotonPlayer other)|
|bool||Equals (int other)|
|override string||ToString ()|
|Brief summary string of the PhotonPlayer. Includes name or player.ID and if it's the Master Client. More...|
|String summary of the PhotonPlayer: player.ID, name and all custom properties of this user. More...|
|static PhotonPlayer||Find (int ID)|
|Try to get a specific player by id. More...|
|readonly bool||IsLocal = false|
|Only one player is controlled by each client. Others are not local. More...|
|Can be used to store a reference that's useful to know "by player". More...|
|This player's actorID More...|
|Nickname of this player. More...|
|UserId of the player, available when the room got created with RoomOptions.PublishUserId = true. More...|
|True if this player is the Master Client of the current room. More...|
|Players might be inactive in a room when PlayerTTL for a room is > 0. If true, the player is not getting events from this room (now) but can return later. More...|
|Read-only cache for custom properties of player. Set via PhotonPlayer.SetCustomProperties. More...|
|Creates a Hashtable with all properties (custom and "well known" ones). More...|
Summarizes a "player" within a room, identified (in that room) by actorID.
Each player has an actorId (or ID), valid for that room. It's -1 until it's assigned by server. Each client can set it's player's custom properties with SetCustomProperties, even before being in a room. They are synced when joining a room.
Creates a PhotonPlayer instance.
|isLocal||If this is the local peer's player (or a remote one).|
|actorID||ID or ActorNumber of this player in the current room (a shortcut to identify each player in room)|
|name||Name of the player (a "well known property").|
|override bool PhotonPlayer.Equals||(||object||p||)|
Makes PhotonPlayer comparable
Try to get a specific player by id.
|override int PhotonPlayer.GetHashCode||(||)|
Updates the this player's Custom Properties with new/updated key-values.
Custom Properties are a key-value set (Hashtable) which is available to all players in a room. They can relate to the room or individual players and are useful when only the current value of something is of interest. For example: The map of a room. All keys must be strings.
Always use SetCustomProperties to change values. To reduce network traffic, set only values that actually changed. New properties are added, existing values are updated. Other values will not be changed, so only provide values that changed or are new.
To delete a named (custom) property of this room, use null as value.
Locally, SetCustomProperties will update it's cache without delay. Other clients are updated through Photon (the server) with a fitting operation.
Check and Swap
SetCustomProperties have the option to do a server-side Check-And-Swap (CAS): Values only get updated if the expected values are correct. The expectedValues can be different key/values than the propertiesToSet. So you can check some key and set another key's value (if the check succeeds).
If the client's knowledge of properties is wrong or outdated, it can't set values with CAS. This can be useful to keep players from concurrently setting values. For example: If all players try to pickup some card or item, only one should get it. With CAS, only the first SetProperties gets executed server-side and any other (sent at the same time) fails.
The server will broadcast successfully changed values and the local "cache" of customProperties only gets updated after a roundtrip (if anything changed).
You can do a "webForward": Photon will send the changed properties to a WebHook defined for your application.
While PhotonNetwork.offlineMode is true, the expectedValues and webForward parameters are ignored. In OfflineMode, the local customProperties values are immediately updated (without the roundtrip).
|propertiesToSet||The new properties to be set.|
|expectedValues||At least one property key/value set to check server-side. Key and value must be correct. Ignored in OfflineMode.|
|webForward||Set to true, to forward the set properties to a WebHook, defined for this app (in Dashboard). Ignored in OfflineMode.|
|override string PhotonPlayer.ToString||(||)|
Brief summary string of the PhotonPlayer. Includes name or player.ID and if it's the Master Client.
String summary of the PhotonPlayer: player.ID, name and all custom properties of this user.
Use with care and not every frame! Converts the customProperties to a String on every single call.
|readonly bool PhotonPlayer.IsLocal = false|
Only one player is controlled by each client. Others are not local.
Can be used to store a reference that's useful to know "by player".
Example: Set a player's character as Tag by assigning the GameObject on Instantiate.
Creates a Hashtable with all properties (custom and "well known" ones).
If used more often, this should be cached.
This player's actorID
Players might be inactive in a room when PlayerTTL for a room is > 0. If true, the player is not getting events from this room (now) but can return later.
True if this player is the Master Client of the current room.
See also: PhotonNetwork.masterClient.
Nickname of this player.
Set the PhotonNetwork.playerName to make the name synchronized in a room.