SFS2X Objective-C API
1.7.13
iOS / macOS / tvOS
|
#import <SFSUser.h>
Inherits NSObject, and <User>.
Instance Methods | |
(id) | - initWithId:name:isItMe: |
(NSInteger) | - getPlayerId: |
(BOOL) | - isGuest |
(BOOL) | - isStandardUser |
(BOOL) | - isModerator |
(BOOL) | - isAdmin |
(BOOL) | - isPlayerInRoom: |
(BOOL) | - isSpectatorInRoom: |
(BOOL) | - isJoinedInRoom: |
(NSArray *) | - getVariables |
(id< UserVariable >) | - getVariable: |
(BOOL) | - containsVariable: |
Class Methods | |
(id< User >) | + fromSFSArray:room: |
Protected Attributes | |
NSInteger | _id |
NSInteger | _privilegeId |
NSString * | _name |
BOOL | _isItMe |
NSMutableDictionary * | _variables |
NSMutableDictionary * | _properties |
BOOL | _isModerator |
NSMutableDictionary * | _playerIdByRoomId |
__weak id< IUserManager > | _userManager |
Properties | |
NSInteger | id |
NSInteger | playerId |
NSInteger | privilegeId |
NSString * | name |
BOOL | isItMe |
NSMutableDictionary * | properties |
BOOL | isPlayer |
BOOL | isSpectator |
id< IUserManager > | userManager |
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 BuddyList to keep track of and interact with his/her friends.
- (BOOL) containsVariable: | (NSString *) | name |
Check if a UserVariable exists
name | the name of the variable |
- (NSInteger) getPlayerId: | (id<Room>) | room |
Return the playerId for the specific Room. If you don't use multi-room you can use playerId
- (id< UserVariable >) getVariable: | (NSString *) | varName |
Get a UserVariable
varName | the name of the variable |
- (NSArray *) getVariables |
Get all the User Variables
- (BOOL) isAdmin |
Return true if the User is logged in as administrator user
- (BOOL) isGuest |
Return true if the User is logged in as guest user
- (BOOL) isModerator |
Return true if the User is logged in as moderator user
- (BOOL) isSpectatorInRoom: | (id<Room>) | room |
- (BOOL) isStandardUser |
Return true if the User is logged in as standard user
|
readwritenonatomicassign |
Get the unique User Id
|
readnonatomicassign |
Return true if the User object is the client's User object, also known as SmartFox2XClient::mySelf
|
readnonatomicassign |
Return true if the User is a Player (playerId > 0) in the last joined Room (non game Rooms will always return false)
|
readnonatomicassign |
Return true if the User is a Spectator (playerId < 0) in the last joined Room (non game Rooms will always return false)
|
readnonatomicweak |
The user name
|
readnonatomicassign |
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.
|
readwritenonatomicassign |
Get the privilegeId of the User
|
readwritenonatomicstrong |
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.
|
readwritenonatomicweak |
Get the UserManager of this User