Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.Subsystems.SimpleUserController< T > Class Template Reference
Inheritance diagram for essentials.Subsystems.SimpleUserController< T >:
pluginbase.Objects.Game.UserControllerBase pluginbase.Objects.Game.IUserController

Public Member Functions

 SimpleUserController (IEntityManager entityManager, IUserManager userManager, Action< T, IUser > setupEntity)
 
 SimpleUserController (IEntityManager entityManager, IUserManager userManager)
 
sealed override IPlayableEntity CreateEntityFor (IUser user)
 Creates the entity for a user More...
 
sealed override void UnloadEntityFor (IUser user, IPlayableEntity entity)
 
- Public Member Functions inherited from pluginbase.Objects.Game.UserControllerBase
 UserControllerBase (IEntityManager entityManager, IUserManager userManager)
 

Additional Inherited Members

- Protected Attributes inherited from pluginbase.Objects.Game.UserControllerBase
readonly IEntityManager EntityManager
 
readonly IUserManager UserManager
 

Constructor & Destructor Documentation

essentials.Subsystems.SimpleUserController< T >.SimpleUserController ( IEntityManager  entityManager,
IUserManager  userManager,
Action< T, IUser setupEntity 
)
14  :base(entityManager, userManager)
15  {
16  _setupEntity = setupEntity;
17  }
essentials.Subsystems.SimpleUserController< T >.SimpleUserController ( IEntityManager  entityManager,
IUserManager  userManager 
)
20  :this(entityManager, userManager, null)
21  { }

Member Function Documentation

sealed override IPlayableEntity essentials.Subsystems.SimpleUserController< T >.CreateEntityFor ( IUser  user)
virtual

Creates the entity for a user

Returns
The entity for.
Parameters
userUser.

Implements pluginbase.Objects.Game.UserControllerBase.

26  {
27  T entity = this.EntityManager.Load(user.Username) as T;
28 
29  if (entity == null)
30  {
31  entity = new T();
32  entity.SetPosition(0f, 0f, 15f);
33  if (_setupEntity != null)
34  _setupEntity(entity, user);
35  }
36 
37  return entity;
38  }
readonly IEntityManager EntityManager
Definition: UserControllerBase.cs:9
string Username
The username of the user
Definition: IUser.cs:14
sealed override void essentials.Subsystems.SimpleUserController< T >.UnloadEntityFor ( IUser  user,
IPlayableEntity  entity 
)
virtual

Reimplemented from pluginbase.Objects.Game.UserControllerBase.

41  {
42  this.EntityManager.Persist(user.Username, entity);
43  }
readonly IEntityManager EntityManager
Definition: UserControllerBase.cs:9
string Username
The username of the user
Definition: IUser.cs:14

The documentation for this class was generated from the following file: