SFSUser Class Reference
| Inherits from | NSObject |
| Conforms to | User |
| Declared in | SFSUser.h SFSUser.m |
Overview
The SFSUser object represents a client logged in to the Server.
The client API doesn’t know about all Users connected to the server side but only about those that are in the same Rooms where the client is joined.
In order to interact with other Users the client can join different Rooms or use a
Tasks
-
idGet the unique User Id
property -
playerIdGet 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.
property -
privilegeIdGet the privilegeId of the User
property -
nameThe user name
property -
isItMeReturn true if the User object is the client’s User object, also known as SmartFox2XClient#mySelf
property -
propertiesA 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.
property -
isPlayerReturn true if the User is a Player (playerId > 0) in the last joined Room (non game Rooms will always return false)
property -
isSpectatorReturn true if the User is a Spectator (playerId < 0) in the last joined Room (non game Rooms will always return false)
property -
userManagerGet the UserManager of this User
property -
– getPlayerId:Return the playerId for the specific Room. If you don’t use multi-room you can use playerId
-
– isGuestReturn true if the User is logged in as guest user
-
– isStandardUserReturn true if the User is logged in as standard user
-
– isModeratorReturn true if the User is logged in as moderator user
-
– isAdminReturn true if the User is logged in as administrator user
-
– isPlayerInRoom:Return true if the User is a Player in the specified Room
-
– isSpectatorInRoom:Return true if the User is a Spectator in the specified Room
-
– isJoinedInRoom:Return true if the User is joined in the specified Room
-
– getVariablesGet all the User Variables
-
– getVariable:Get a UserVariable
-
– containsVariable:Check if a UserVariable exists
Properties
id
Get the unique User Id
@property (nonatomic, assign) NSInteger idDiscussion
Get the unique User Id
Declared In
SFSUser.hisItMe
Return true if the User object is the client’s User object, also known as SmartFox2XClient#mySelf
@property (nonatomic, readonly) BOOL isItMeDiscussion
Return true if the User object is the client’s User object, also known as SmartFox2XClient#mySelf
Declared In
SFSUser.hisPlayer
Return true if the User is a Player (playerId > 0) in the last joined Room (non game Rooms will always return false)
@property (nonatomic, readonly) BOOL isPlayerDiscussion
Return true if the User is a Player (playerId > 0) in the last joined Room (non game Rooms will always return false)
See Also
SmartFox2XClient#lastJoinedRoom
Declared In
SFSUser.hisSpectator
Return true if the User is a Spectator (playerId < 0) in the last joined Room (non game Rooms will always return false)
@property (nonatomic, readonly) BOOL isSpectatorDiscussion
Return true if the User is a Spectator (playerId < 0) in the last joined Room (non game Rooms will always return false)
See Also
SmartFox2XClient#lastJoinedRoom
Declared In
SFSUser.hname
The user name
@property (nonatomic, readonly) NSString *nameDiscussion
The user name
Declared In
SFSUser.hplayerId
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.
@property (nonatomic, readonly) NSInteger playerIdDiscussion
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.
Declared In
SFSUser.hprivilegeId
Get the privilegeId of the User
@property (nonatomic, assign) NSInteger privilegeIdDiscussion
Get the privilegeId of the User
See Also
Declared In
SFSUser.hproperties
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.
@property (nonatomic, retain) NSMutableDictionary *propertiesDiscussion
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
SFSUser.hInstance Methods
containsVariable:
Check if a UserVariable exists
- (BOOL)containsVariable:(NSString *)nameParameters
- name
the name of the variable
Return Value
true if the UserVariable exists
Discussion
Check if a UserVariable exists
See Also
Declared In
SFSUser.hgetPlayerId:
Return the playerId for the specific Room. If you don’t use multi-room you can use playerId
- (NSInteger)getPlayerId:(id<Room>)roomDiscussion
Return the playerId for the specific Room. If you don’t use multi-room you can use playerId
Declared In
SFSUser.hgetVariable:
Get a UserVariable
- (id<UserVariable>)getVariable:(NSString *)varNameParameters
- varName
the name of the variable
Return Value
the UserVariable or nil if the variable doesn’t exist
Discussion
Get a UserVariable
See Also
Declared In
SFSUser.hgetVariables
Get all the User Variables
- (NSArray *)getVariablesDiscussion
Get all the User Variables
See Also
Declared In
SFSUser.hisAdmin
Return true if the User is logged in as administrator user
- (BOOL)isAdminDiscussion
Return true if the User is logged in as administrator user
Declared In
SFSUser.hisGuest
Return true if the User is logged in as guest user
- (BOOL)isGuestDiscussion
Return true if the User is logged in as guest user
Declared In
SFSUser.hisJoinedInRoom:
Return true if the User is joined in the specified Room
- (BOOL)isJoinedInRoom:(id<Room>)roomDiscussion
Return true if the User is joined in the specified Room
Declared In
SFSUser.hisModerator
Return true if the User is logged in as moderator user
- (BOOL)isModeratorDiscussion
Return true if the User is logged in as moderator user
Declared In
SFSUser.hisPlayerInRoom:
Return true if the User is a Player in the specified Room
- (BOOL)isPlayerInRoom:(id<Room>)roomDiscussion
Return true if the User is a Player in the specified Room
Declared In
SFSUser.h