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 static void ClientCmdGameEnd(string endgamepause) { audio.sfxStopAll(""); if (GuiCanvas.EditorIsActive() || GuiCanvas.GuiEditorIsActive()) { return; } // Copy the current scores from the player list into the // end game gui (bit of a hack for now). GuiTextListCtrl EndGameGuiList = "EndGameGuiList"; EndGameGuiList.clear(); GuiTextListCtrl PlayerListGuiList = "PlayerListGuiList"; for (int i = 0; i < PlayerListGuiList.rowCount(); i++) { string text = PlayerListGuiList.getRowText(i); string id = PlayerListGuiList.getRowId(i).AsString(); EndGameGuiList.addRow(id.AsInt(), text, -1); } EndGameGuiList.sortNumerical(1, false); ((GuiCanvas)"Canvas").setContent("EndGameGui"); if (endgamepause.AsInt() > 0) { omni.Util._schedule((endgamepause.AsInt() * 1000).AsString(), "0", "ShowLoading"); } }
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(); }