static void HookStats() { if (TopStat.Stats.Contains(statMostInfected)) { return; // don't duplicate } statMostInfected = new TopStat("Infected", "ZombieStats", "TotalInfected", () => "Most players infected", TopStat.FormatInteger); statMaxInfected = new TopStat("Survived", "ZombieStats", "TotalRounds", () => "Most rounds survived", TopStat.FormatInteger); statMostSurvived = new TopStat("ConsecutiveInfected", "ZombieStats", "MaxInfected", () => "Most consecutive infections", TopStat.FormatInteger); statMaxSurvived = new TopStat("ConsecutiveSurvived", "ZombieStats", "MaxRounds", () => "Most consecutive rounds survived", TopStat.FormatInteger); infectedToken = new ChatToken("$infected", "Total number of players infected", p => Get(p).TotalInfected.ToString()); survivedToken = new ChatToken("$survived", "Total number of rounds survived", p => Get(p).TotalRoundsSurvived.ToString()); offlineZSStats = PrintOfflineZSStats; onlineZSStats = PrintOnlineZSStats; OfflineStat.Stats.Add(offlineZSStats); OnlineStat.Stats.Add(onlineZSStats); ChatTokens.Standard.Add(infectedToken); ChatTokens.Standard.Add(survivedToken); TopStat.Stats.Add(statMostInfected); TopStat.Stats.Add(statMostSurvived); TopStat.Stats.Add(statMaxInfected); TopStat.Stats.Add(statMaxSurvived); }
void MakeButton(ChatToken token) { int row = index / btnsPerCol, col = index % btnsPerCol; index++; Button btn = new Button(); btn.Location = new Point(9 + row * btnWidth, 7 + col * btnHeight); btn.Size = new Size(btnWidth, btnHeight); btn.Name = "b" + index; btn.TabIndex = index; toolTip.SetToolTip(btn, token.Description); btn.Text = token.Trigger; btn.Click += delegate { Token = token.Trigger; DialogResult = DialogResult.OK; Close(); }; btn.Margin = new Padding(0); btn.UseVisualStyleBackColor = false; btn.Font = new Font("Microsoft Sans Serif", 9.5F, FontStyle.Regular, GraphicsUnit.Point, 0); Controls.Add(btn); }