Photon C++ Client API
5.0.7.3
|
Public Member Functions | |
virtual | ~Player (void) |
Player (const Player &toCopy) | |
virtual Player & | operator= (const Player &toCopy) |
int | getNumber (void) const |
const Common::JString & | getName () const |
const Common::JString & | getUserID () const |
const Common::Hashtable & | getCustomProperties () const |
bool | getIsInactive (void) const |
bool | getIsMasterClient (void) const |
bool | operator== (const Player &player) const |
virtual Common::JString & | toString (Common::JString &retStr, bool withTypes=false) const |
virtual Common::JString | toString (bool withTypes, bool withCustomProperties) const |
virtual JString & | toString (JString &retStr, bool withTypes=false) const=0 |
JString | toString (bool withTypes=false) const |
Public Member Functions inherited from ToString | |
virtual | ~ToString (void) |
virtual JString | typeToString (void) const |
JString | toString (bool withTypes=false) const |
Each client inside a MutableRoom is represented by an instance of this class.
Player instances are only valid in the context of the MutableRoom() instance from which they have been retrieved.
|
virtual |
Destructor.
Copy-Constructor: Creates a new instance that is a deep copy of the argument instance.
toCopy | The instance to copy. |
operator=.
Makes a deep copy of its right operand into its left operand.
This overwrites old data in the left operand.
Reimplemented in MutablePlayer.
int getNumber | ( | void | ) | const |
The player number serves as a the unique identifier of a player inside the current room.
It is assigned per room and only valid in the context of that room. A player number is never re-used for another player inside the same room.
If a player leaves a room entirely (either explicitly through a call to Client::opLeaveRoom() without passing 'true' for parameter 'willComeBack' or implicitly because his playerTtl runs out (see RoomOptions::setPlayerTtl())) and joins it again afterwards, then he is treated as an entirely new player and gets assigned a new player number.
If a player becomes inactive (either explicitly through a call to Client::opLeaveRoom() with passing 'true' for parameter 'willComeBack' or implicitly by by getting disconnected) and then rejoins the same room before his playerTtl runs out, then he is treated as the same player an keeps his previously assigned player number.
const JString & getName | ( | ) | const |
A player might change his own name.
Such a change is synced automatically with the server and other clients in the same room.
const JString & getUserID | ( | ) | const |
This value is only available when the room got created with RoomOptions::setPublishUserID(true). Otherwise it will be an empty string.
Useful for Client::opFindFriends() and and for blocking slots in a room for expected users (see MutableRoom::getExpectedUsers()).
const Hashtable & getCustomProperties | ( | ) | const |
Read-only cache for the custom properties of a player. A client can change the custom properties of his local player instance through class MutablePlayer. The Custom Properties of remote players are automatically updated when they change.
bool getIsInactive | ( | void | ) | const |
Inactive players keep their spot in a room but otherwise behave as if offline (no matter what their actual connection status is).
The room needs a PlayerTtl != 0 (see RoomOptions::setPlayerTtl()) for players to be able to become inactive. If a player is inactive for longer than the PlayerTtl, then the server will remove this player from the room.
bool getIsMasterClient | ( | void | ) | const |
There is always exactly one master client. The creator of a room gets assigned the role of master client on room creation.
When the current master client leaves the room or becomes inactive and there is at least one active player inside the room, then the role of master client gets reassigned by the server to an active client. As soon as one client becomes active again in a room with only inactive clients, the role of master client will be assigned to this active client.
Whenever the role of master client gets assigned to a different client, all active clients inside the same room get informed about it by a call to Listener::onMasterClientChanged().
You can use the master client when you want one client to be an authoritative instance.
bool operator== | ( | const Player & | player | ) | const |
operator==.
Two Player instances are considered equal, if getNumber() returns equal values for both of them.
|
virtual |
retStr | reference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string |
withTypes | set to true, to include type information in the generated string |
Implements ToString.
|
virtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
withTypes | set to true, to include type information in the generated string |
withCustomProperties | set to true, to include the custom properties in the generated string |
toString |
retStr | reference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string |
withTypes | set to true, to include type information in the generated string |
JString toString |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
withTypes | set to true, to include type information in the generated string |