public virtual void update(GameConnection clientId, string name, bool isSuperAdmin, bool isAdmin, bool isAI, int score, int kills, int deaths) { // Build the row to display. The name can have ML control tags, including // color and font. Since we're not using an ML control here, we need to // strip them off. string tag = isSuperAdmin ? "[Super]" : (isAdmin ? "[Admin]" : (isAI ? "[Bot]" : "")); string text = string.Format("{0} {1}\t{2}\t{3}\t{4}", Util.StripMLControlChars(name), tag, score, kills, deaths); // Update or add the player to the control GuiTextListCtrl PlayerListGuiList = "PlayerListGuiList"; if (clientId == -1) { PlayerListGuiList.addRow(clientId, text, -1); } else { PlayerListGuiList.setRowById(clientId, text); } // Sorts by score PlayerListGuiList.sortNumerical(1, false); PlayerListGuiList.clearSelection(); }
public virtual void zeroScores() { GuiTextListCtrl PlayerListGuiList = "PlayerListGuiList"; for (int i = 0; i < PlayerListGuiList.rowCount(); i++) { string text = PlayerListGuiList.getRowText(i); text = Util.setField(text, 1, "0"); text = Util.setField(text, 2, "0"); text = Util.setField(text, 3, "0"); PlayerListGuiList.setRowById(PlayerListGuiList.getRowId(i), text); } PlayerListGuiList.clearSelection(); }
public virtual void updateScore(GameConnection clientId, int score, int kills, int deaths) { GuiTextListCtrl PlayerListGuiList = "PlayerListGuiList"; string text = PlayerListGuiList.getRowTextById(clientId); //Since I'm lazy and I don't feel like writing a csharp function... text = Util.setField(text, 1, score.AsString()); text = Util.setField(text, 2, kills.AsString()); text = Util.setField(text, 3, deaths.AsString()); PlayerListGuiList.setRowById(clientId, text); // Sorts by score PlayerListGuiList.sortNumerical(1, false); PlayerListGuiList.clearSelection(); }