User Protocol Reference
Conforms to | NSObject |
Declared in | User.h |
Tasks
-
– id
Get the unique User Id
required method -
– name
The user name
required method -
– playerId
Get the playerId of the User.
required method -
– isPlayer
Return true if the User is a Player (playerId > 0) in the last joined Room (non game Rooms will always return false)
required method -
– isSpectator
Return true if the User is a Spectator (playerId < 0) in the last joined Room (non game Rooms will always return false)
required method -
– getPlayerId:
Return the playerId for the specific Room. If you don’t use multi-room you can use playerId
required method -
– privilegeId
Get the privilegeId of the User
required method -
– userManager
Get the UserManager of this User
required method -
– isGuest
Return true if the User is logged in as guest user
required method -
– isStandardUser
Return true if the User is logged in as standard user
required method -
– isModerator
Return true if the User is logged in as moderator user
required method -
– isAdmin
Return true if the User is logged in as administrator user
required method -
– isPlayerInRoom:
Return true if the User is a Player in the specified Room
required method -
– isSpectatorInRoom:
Return true if the User is a Spectator in the specified Room
required method -
– isJoinedInRoom:
Return true if the User is joined in the specified Room
required method -
– isItMe
Return true if the User object is the client’s User object, also known as SmartFox2XClient.mySelf
required method -
– getVariables
Get all the User Variables
required method -
– getVariable:
Get a UserVariable
required method -
– containsVariable:
Check if a UserVariable exists
required method -
– properties
A generic object that can be used to store any User custom data needed at runtime. The values added/removed in this object are for client side use only an are never transmitted to the Server.
required method
Instance Methods
containsVariable:
Check if a UserVariable exists
- (BOOL)containsVariable:(NSString *)name
Parameters
- name
: the name of the variable
Return Value
true if the UserVariable exists
Discussion
Check if a UserVariable exists
See Also
Declared In
User.h
getPlayerId:
Return the playerId for the specific Room. If you don’t use multi-room you can use playerId
- (NSInteger)getPlayerId:(id<Room>)room
Discussion
Return the playerId for the specific Room. If you don’t use multi-room you can use playerId
See Also
Declared In
User.h
getVariable:
Get a UserVariable
- (id<UserVariable>)getVariable:(NSString *)varName
Parameters
- varName
: the name of the variable
Return Value
the UserVariable or null if the variable doesn’t exist
Discussion
Get a UserVariable
See Also
Declared In
User.h
getVariables
Get all the User Variables
- (NSArray *)getVariables
Discussion
Get all the User Variables
See Also
Declared In
User.h
isAdmin
Return true if the User is logged in as administrator user
- (BOOL)isAdmin
Discussion
Return true if the User is logged in as administrator user
Declared In
User.h
isGuest
Return true if the User is logged in as guest user
- (BOOL)isGuest
Discussion
Return true if the User is logged in as guest user
Declared In
User.h
isItMe
Return true if the User object is the client’s User object, also known as SmartFox2XClient.mySelf
- (BOOL)isItMe
Discussion
Return true if the User object is the client’s User object, also known as SmartFox2XClient.mySelf
Declared In
User.h
isJoinedInRoom:
Return true if the User is joined in the specified Room
- (BOOL)isJoinedInRoom:(id<Room>)room
Discussion
Return true if the User is joined in the specified Room
Declared In
User.h
isModerator
Return true if the User is logged in as moderator user
- (BOOL)isModerator
Discussion
Return true if the User is logged in as moderator user
Declared In
User.h
isPlayer
Return true if the User is a Player (playerId > 0) in the last joined Room (non game Rooms will always return false)
- (BOOL)isPlayer
Discussion
Return true if the User is a Player (playerId > 0) in the last joined Room (non game Rooms will always return false)
See Also
lastJoinedRoom
Declared In
User.h
isPlayerInRoom:
Return true if the User is a Player in the specified Room
- (BOOL)isPlayerInRoom:(id<Room>)room
Discussion
Return true if the User is a Player in the specified Room
Declared In
User.h
isSpectator
Return true if the User is a Spectator (playerId < 0) in the last joined Room (non game Rooms will always return false)
- (BOOL)isSpectator
Discussion
Return true if the User is a Spectator (playerId < 0) in the last joined Room (non game Rooms will always return false)
See Also
lastJoinedRoom
Declared In
User.h
isSpectatorInRoom:
Return true if the User is a Spectator in the specified Room
- (BOOL)isSpectatorInRoom:(id<Room>)room
Discussion
Return true if the User is a Spectator in the specified Room
Declared In
User.h
isStandardUser
Return true if the User is logged in as standard user
- (BOOL)isStandardUser
Discussion
Return true if the User is logged in as standard user
Declared In
User.h
playerId
Get the playerId of the User.
- (NSInteger)playerId
Discussion
Get the playerId of the User.
The playerId is different from the User ID and it used to indicate which player number is the user inside a Game Room. Example: in a Game Room for 5 players the first client joining will have playerId = 1, the 2nd will have playerId = 2 and so forth. When a User leaves the Room its player slot is freed up and the next User joining the Room will take it.
The playerId is only applicable for Game Rooms, in the other Rooms it is always == 0 A playerId < 0 indicates that the User is a spectator.
If the User is joined in multiple game Rooms at the same time he will be assigned one playerId per Room. In order to obtain a specific playerId you can use the [id User getPlayerId:room] method.
Declared In
User.h
privilegeId
Get the privilegeId of the User
- (NSInteger)privilegeId
Discussion
Get the privilegeId of the User
See Also
Declared In
User.h
properties
A generic object that can be used to store any User custom data needed at runtime. The values added/removed in this object are for client side use only an are never transmitted to the Server.
- (NSMutableDictionary *)properties
Discussion
A generic object that can be used to store any User custom data needed at runtime. The values added/removed in this object are for client side use only an are never transmitted to the Server.
Declared In
User.h