| Package | com.smartfoxserver.v2.entities |
| Class | public class SFSUser |
| Inheritance | SFSUser Object |
| Implements | User |
The SmartFoxServer 2X client API are not aware of all the clients (users) connected to the server, but only of those that are in the same Rooms joined by the current client; this reduces the traffic between the client and the server considerably. In order to interact with other users the client should join other Rooms or use the Buddy List system to keep track of and interact with friends.
See also
| Property | Defined By | ||
|---|---|---|---|
| aoiEntryPoint : Vec3D
Returns the entry point of this user in the current user's AoI. | SFSUser | ||
| id : int [read-only]
Indicates the id of this user. | SFSUser | ||
| isItMe : Boolean [read-only]
Indicates if this User object represents the current client. | SFSUser | ||
| isPlayer : Boolean [read-only]
Indicates whether this user is a player (playerId greater than 0) in the last joined Room or not. | SFSUser | ||
| isSpectator : Boolean [read-only]
Indicates whether this user is a spectator (playerId lower than 0) in the last joined Room or not. | SFSUser | ||
| name : String [read-only]
Indicates the name of this user. | SFSUser | ||
| playerId : int [read-only]
Returns the id of this user as a player in a Game Room. | SFSUser | ||
| privilegeId : int
Returns the id which identifies the privilege level of this user. | SFSUser | ||
| properties : Object
Defines a generic utility object that can be used to store custom user data. | SFSUser | ||
| userManager : IUserManager
Returns a reference to the User Manager which manages this user. | SFSUser | ||
| Method | Defined By | ||
|---|---|---|---|
SFSUser(id:int, name:String, isItMe:Boolean = false)
Creates a new SFSUser instance. | SFSUser | ||
containsVariable(name:String):Boolean
Indicates whether this user has the specified User Variable set or not. | SFSUser | ||
getPlayerId(room:Room):int
Returns the playerId value of this user in the passed Room. | SFSUser | ||
getVariable(name:String):UserVariable
Retrieves a User Variable from its name. | SFSUser | ||
getVariables():Array
Retrieves all the User Variables of this user. | SFSUser | ||
isAdmin():Boolean
Indicates whether this user logged in as an administrator or not. | SFSUser | ||
isGuest():Boolean
Indicates whether this user logged in as a guest or not. | SFSUser | ||
isJoinedInRoom(room:Room):Boolean
Indicates whether this user joined the passed Room or not. | SFSUser | ||
isModerator():Boolean
Indicates whether this user logged in as a moderator or not. | SFSUser | ||
isPlayerInRoom(room:Room):Boolean
Indicates whether this user is a player (playerId greater than 0) in the passed Room or not. | SFSUser | ||
isSpectatorInRoom(room:Room):Boolean
Indicates whether this user is a spectator (playerId lower than 0) in the passed Room or not. | SFSUser | ||
isStandardUser():Boolean
Indicates whether this user logged in as a standard user or not. | SFSUser | ||
toString():String
Returns a string that contains the user id, name and a boolean indicating if the SFSUser object represents the current client. | SFSUser | ||
| aoiEntryPoint | property |
aoiEntryPoint:Vec3DReturns the entry point of this user in the current user's AoI.
The returned coordinates are those that the user had when his presence in the current user's Area of Interest was last notified by a SFSEvent.PROXIMITY_LIST_UPDATE event. This field is populated only if the user joined a Room of type MMORoom and this is configured to receive such data from the server.
public function get aoiEntryPoint():Vec3D public function set aoiEntryPoint(value:Vec3D):void| id | property |
id:int [read-only] Indicates the id of this user. It is unique and it is generated by the server when the user is created.
public function get id():int| isItMe | property |
isItMe:Boolean [read-only] Indicates if this User object represents the current client.
public function get isItMe():Boolean| isPlayer | property |
isPlayer:Boolean [read-only]
Indicates whether this user is a player (playerId greater than 0) in the last joined Room or not.
Non-Game Rooms always return false.
If the user is inside multiple Game Rooms at the same time, use the isPlayerInRoom() method.
public function get isPlayer():Boolean| isSpectator | property |
isSpectator:Boolean [read-only]
Indicates whether this user is a spectator (playerId lower than 0) in the last joined Room or not.
Non-Game Rooms always return false.
If the user is inside multiple Game Rooms at the same time, use the isSpectatorInRoom() method.
public function get isSpectator():Boolean| name | property |
name:String [read-only] Indicates the name of this user. Two users in the same Zone can't have the same name.
public function get name():String| playerId | property |
playerId:int [read-only] Returns the id of this user as a player in a Game Room.
This property differs from id property and it used to indicate which player number is assigned to a user inside a Game Room.
For example, in a Game Room for 5 players the first client joining it will have playerId equal to 1, the second will have it equal to 2 and so forth.
When a user leaves the Room the player slot is freed up and the next user joining the Room will take it.
The playerId property applies to Game Rooms only; in standard Rooms it is always 0.
Also, in Game Rooms a playerId value lower than 0 indicates that the user is a spectator.
If the user is inside multiple Game Rooms at the same time, a different playerId value will be assigned to him in each Room. In this case this property returns the value corresponding to the last joined Room; in order to obtain the playerId value in a specific Room, use the getPlayerId() method.
public function get playerId():int| privilegeId | property |
privilegeId:intReturns the id which identifies the privilege level of this user.
NOTE: setting the privilegeId property manually has no effect on the server and can disrupt the API functioning. Privileges are assigned to the user by the server when the user logs in.
public function get privilegeId():int public function set privilegeId(value:int):void| properties | property |
properties:ObjectDefines a generic utility object that can be used to store custom user data. The values added to this object are for client-side use only and are never transmitted to the server or to the other clients.
public function get properties():Object public function set properties(value:Object):void| userManager | property |
userManager:IUserManagerReturns a reference to the User Manager which manages this user.
NOTE: setting the userManager property manually has no effect on the server and can disrupt the API functioning.
public function get userManager():IUserManager public function set userManager(value:IUserManager):void| SFSUser | () | Constructor |
public function SFSUser(id:int, name:String, isItMe:Boolean = false)Creates a new SFSUser instance.
NOTE: developers never istantiate a SFSUser manually: this is done by the SmartFoxServer 2X API internally.
Parametersid:int — The user id.
| |
name:String — The user name.
| |
isItMe:Boolean (default = false) — If true, the user being created corresponds to the current client.
|
| containsVariable | () | method |
public function containsVariable(name:String):BooleanIndicates whether this user has the specified User Variable set or not.
Parameters
name:String — The name of the User Variable whose existance must be checked.
|
Boolean — true if a User Variable with the passed name is set for this user.
|
| getPlayerId | () | method |
public function getPlayerId(room:Room):intReturns the playerId value of this user in the passed Room. See the playerId property description for more informations.
Parameters
room:Room — The Room object representing the Room to retrieve the player id from.
|
int — The playerId of this user in the passed Room.
|
| getVariable | () | method |
public function getVariable(name:String):UserVariableRetrieves a User Variable from its name.
Parameters
name:String — The name of the User Variable to be retrieved.
|
UserVariable — The UserVariable object representing the User Variable, or null if no User Variable with the passed name is associated with this user.
|
| getVariables | () | method |
public function getVariables():ArrayRetrieves all the User Variables of this user.
ReturnsArray — The list of UserVariable objects associated with the user.
|
| isAdmin | () | method |
public function isAdmin():BooleanIndicates whether this user logged in as an administrator or not. Administrator users have the privilegeId property set to UserPrivileges.ADMINISTRATOR.
ReturnsBoolean — true if this user is an administrator.
|
| isGuest | () | method |
public function isGuest():BooleanIndicates whether this user logged in as a guest or not. Guest users have the privilegeId property set to UserPrivileges.GUEST.
ReturnsBoolean — true if this user is a guest.
|
| isJoinedInRoom | () | method |
public function isJoinedInRoom(room:Room):BooleanIndicates whether this user joined the passed Room or not.
Parameters
room:Room — The Room object representing the Room where to check the user presence.
|
Boolean — true if this user is inside the passed Room.
|
| isModerator | () | method |
public function isModerator():BooleanIndicates whether this user logged in as a moderator or not. Moderator users have the privilegeId property set to UserPrivileges.MODERATOR.
ReturnsBoolean — true if this user is a moderator.
|
| isPlayerInRoom | () | method |
public function isPlayerInRoom(room:Room):Boolean
Indicates whether this user is a player (playerId greater than 0) in the passed Room or not.
Non-Game Rooms always return false.
If a user can join one Game Room at a time only, use the isPlayer property.
Parameters
room:Room — The Room object representing the Room where to check if this user is a player.
|
Boolean — true if this user is a player in the passed Room.
|
| isSpectatorInRoom | () | method |
public function isSpectatorInRoom(room:Room):Boolean
Indicates whether this user is a spectator (playerId lower than 0) in the passed Room or not.
Non-Game Rooms always return false.
If a user can join one Game Room at a time only, use the isSpectator property.
Parameters
room:Room — The Room object representing the Room where to check if this user is a spectator.
|
Boolean — true if this user is a spectator in the passed Room.
|
| isStandardUser | () | method |
public function isStandardUser():BooleanIndicates whether this user logged in as a standard user or not. Standard users have the privilegeId property set to UserPrivileges.STANDARD.
ReturnsBoolean — true if this user is a standard user.
|
| toString | () | method |
public function toString():StringReturns a string that contains the user id, name and a boolean indicating if the SFSUser object represents the current client.
ReturnsString — The string representation of the SFSUser object.
|