public PlayerInfo(TabListEntry p, byte id) { ListName = Utils.StripColours(p.ListName); PlayerName = Utils.StripColours(p.PlayerName); NameId = id; GroupName = p.GroupName; GroupRank = p.GroupRank; }
protected override void CreateInitialPlayerInfo() { TabListEntry[] entries = game.TabList.Entries; for (int i = 0; i < entries.Length; i++) { TabListEntry e = entries[i]; if (e != null) { AddPlayerInfo(new PlayerInfo(e), -1); } } }
public override void Init() { TabListEntry[] entries = TabList.Entries; for (int id = 0; id < entries.Length; id++) { TabListEntry e = entries[id]; if (e != null) { AddName((byte)id, -1); } } SortAndReposition(); overview = TextWidget.Create(game, "Connected players:", font) .SetLocation(Anchor.Centre, Anchor.LeftOrTop, 0, 0); game.EntityEvents.TabListEntryAdded += TabEntryAdded; game.EntityEvents.TabListEntryRemoved += TabEntryRemoved; game.EntityEvents.TabListEntryChanged += TabEntryChanged; }
void AddPlayerInfo(TabListEntry player, byte id, int index) { DrawTextArgs args = new DrawTextArgs(player.ListName, font, true); Texture tex = game.Drawer2D.MakeTextTexture(ref args, 0, 0); game.Drawer2D.ReducePadding(ref tex, Utils.Floor(font.Size), 3); if (index < 0) { info[namesCount] = new PlayerInfo(player, id); textures[namesCount] = tex; namesCount++; } else { info[index] = new PlayerInfo(player, id); textures[index] = tex; } }
void AddTablistEntry(byte id, string playerName, string listName, string groupName, byte groupRank) { TabListEntry oldInfo = game.TabList.Entries[id]; TabListEntry info = new TabListEntry((byte)id, playerName, listName, groupName, groupRank); game.TabList.Entries[id] = info; if (oldInfo != null) { // Only redraw the tab list if something changed. if (info.PlayerName != oldInfo.PlayerName || info.ListName != oldInfo.ListName || info.GroupName != oldInfo.GroupName || info.GroupRank != oldInfo.GroupRank) { game.EntityEvents.RaiseTabListEntryChanged(id); } } else { game.EntityEvents.RaiseTabEntryAdded(id); } }
public PlayerInfo(TabListEntry p) { ColouredName = p.PlayerName; Name = Utils.StripColours(p.PlayerName); Id = p.NameId; }
public PlayerInfo(TabListEntry p, byte id) { ColouredName = p.PlayerName; Name = Utils.StripColours(p.PlayerName); Id = id; }