Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.Subsystems.Scoreboard.ScoreboardServer Class Reference
Inheritance diagram for essentials.Subsystems.Scoreboard.ScoreboardServer:
pluginbase.Objects.Game.IServerSubsystem pluginbase.Objects.Game.ISubsystem

Public Member Functions

 ScoreboardServer ()
 
void OnStart ()
 
void OnStop ()
 
void Simulate (IFrameTimeState frameTime)
 

Public Attributes

readonly List< ScoreboardColumnColumns = new List<ScoreboardColumn>()
 

Protected Member Functions

Scoreboard GetScoreboard ()
 

Properties

IUserManager UserManager [get]
 
IRpcManager RpcManager [get]
 
int OrderByColumn [get, set]
 
bool OrderByDescending [get, set]
 

Constructor & Destructor Documentation

essentials.Subsystems.Scoreboard.ScoreboardServer.ScoreboardServer ( )
25  {
26  this.InjectDependencies();
27  this.RpcManager.RegisterClass(this);
28 
29  Columns.Add(new ScoreboardColumn("Name", 150, x => x.Username));
30  Columns.Add(new ScoreboardColumn("Online", 50, x => string.Format("{0:0}h {1:00}m", (int)x.ConnectedLength.TotalHours, (int)x.ConnectedLength.Minutes) ));
31  Columns.Add(new ScoreboardColumn("Group", 100, x => x.UserAuthenticationLevel.ToString()));
32  Columns.Add(new ScoreboardColumn("Ping", 32, x => x.NetLatency.TotalMilliseconds.ToString("N0") + "ms" ));
33  }
IRpcManager RpcManager
Definition: ScoreboardServer.cs:18
readonly List< ScoreboardColumn > Columns
Definition: ScoreboardServer.cs:12

Member Function Documentation

Scoreboard essentials.Subsystems.Scoreboard.ScoreboardServer.GetScoreboard ( )
protected

Attribute: Remote

Attribute: OrderByColumn

).ToList();

Attribute: OrderByColumn

).ToList();

47  {
48  var scoreboard = Scoreboard.Create();
49 
50  //Columns
51  foreach(var col in this.Columns)
52  {
53  scoreboard.Columns.Add(new Scoreboard.Column{
54  Name = col.Name,
55  Width = col.Width
56  });
57  }
58 
59  //Add user entries
60  foreach(var user in this.UserManager.Users)
61  {
62  scoreboard.Entries.Add(new Scoreboard.Entry{
63  Values = this.Columns.Select(x => x.GetValue(user)).ToList()
64  });
65  }
66 
67  //Order
69  {
70  scoreboard.Entries = scoreboard.Entries.OrderByDescending(x => x.Values[OrderByColumn]).ToList();
71  }
72  else
73  {
74  scoreboard.Entries = scoreboard.Entries.OrderBy(x => x.Values[OrderByColumn]).ToList();
75  }
76  return scoreboard;
77  }
IUserManager UserManager
Definition: ScoreboardServer.cs:15
bool OrderByDescending
Definition: ScoreboardServer.cs:22
int OrderByColumn
Definition: ScoreboardServer.cs:20
IEnumerable< IUser > Users
Definition: IUserManager.cs:15
readonly List< ScoreboardColumn > Columns
Definition: ScoreboardServer.cs:12
void essentials.Subsystems.Scoreboard.ScoreboardServer.OnStart ( )
void essentials.Subsystems.Scoreboard.ScoreboardServer.OnStop ( )
void essentials.Subsystems.Scoreboard.ScoreboardServer.Simulate ( IFrameTimeState  frameTime)

Implements pluginbase.Objects.Game.ISubsystem.

42  {
43  }

Member Data Documentation

readonly List<ScoreboardColumn> essentials.Subsystems.Scoreboard.ScoreboardServer.Columns = new List<ScoreboardColumn>()

Property Documentation

int essentials.Subsystems.Scoreboard.ScoreboardServer.OrderByColumn
getset
bool essentials.Subsystems.Scoreboard.ScoreboardServer.OrderByDescending
getset
IRpcManager essentials.Subsystems.Scoreboard.ScoreboardServer.RpcManager
getprotected

Attribute: Dependency

IUserManager essentials.Subsystems.Scoreboard.ScoreboardServer.UserManager
getprotected

Attribute: Dependency


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