Packagecom.electrotank.electroserver4.user
Classpublic class UserManager

This class is used to manage all users that the client knows about. If a client is in 3 rooms and can see flamer_311 in each room, then there is only one User instance that represents that use. That single user instance is referred to from the three Room instances. A user being in your buddy list works this way too. When it is detected that a user in the User Manager has no references to it, it is removed to clean up.

This class can be used to find any user by name, get a full list of all users that you can see, or just run a check to see if a user exists from your perspective.



Public Methods
 MethodDefined by
  
Creates a new instance of the UserManager class.
UserManager
  
Adds a reference to a User.
UserManager
  
addUser(u:User):void
Adds a user.
UserManager
  
doesUserExist(id:String):Boolean
Useful method that allows you to check to see if a specific user is currently being managed by your instnace of the UserManager.
UserManager
  
Gets User that represents you.
UserManager
  
getUserById(id:String):User
Gets a User based on id.
UserManager
  
getUserByName(name:String):User
Gets a User based on the name.
UserManager
  
getUsers():Array
Gets the full list of managed users.
UserManager
  
Removes a refence to a User.
UserManager
  
setMe(u:User):void
Sets the reference to yourself.
UserManager
Constructor detail
UserManager()constructor
public function UserManager()

Creates a new instance of the UserManager class.

Method detail
addReference()method
public function addReference(u:User):void

Adds a reference to a User.

Parameters
u:User — The User for which to add a reference.
addUser()method 
public function addUser(u:User):void

Adds a user.

Parameters
u:User — The User to add.
doesUserExist()method 
public function doesUserExist(id:String):Boolean

Useful method that allows you to check to see if a specific user is currently being managed by your instnace of the UserManager. This doesn't mean that user is logged into the server or not, it just checks to see if that user is managed here.

Parameters
id:String — Id of the User.

Returns
Boolean — True or false.
getMe()method 
public function getMe():User

Gets User that represents you.

Returns
User — User that represents you.
getUserById()method 
public function getUserById(id:String):User

Gets a User based on id.

Parameters
id:String — The id of the User.

Returns
User — The User whose id was passed in.
getUserByName()method 
public function getUserByName(name:String):User

Gets a User based on the name.

Parameters
name:String — Name of the User to find.

Returns
User — The User with the name passed in.
getUsers()method 
public function getUsers():Array

Gets the full list of managed users.

Returns
Array — The full list of managed users.
removeReference()method 
public function removeReference(u:User):void

Removes a refence to a User.

Parameters
u:User — User for whom a reference is removed.
setMe()method 
public function setMe(u:User):void

Sets the reference to yourself. This is a permanent reference so that your own User class intance won't be removed.

Parameters
u:User — User that represents you.