This class represents the Game data found in a Battlefield 2 Snapshot
Пример #1
0
        public GameResultForm(GameResult Game, bool isProcessed)
        {
            InitializeComponent();

            // Build Team Grid 1
            foreach (Player P in Game.GetPlayersByTeam(1).OrderByDescending(p => p.RoundScore))
            {
                DataGridViewRow Row = new DataGridViewRow();
                Row.CreateCells(Team1Grid);
                Row.SetValues(new object[] {
                    Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.rank_" + P.Rank + "icon.gif")),
                    P.Name, P.RoundScore, P.Stats.Kills, P.Stats.Deaths
                });
                Row.Tag = P.Pid;
                Team1Grid.Rows.Add(Row);
            }

            // Build Team Grid 2
            foreach (Player P in Game.GetPlayersByTeam(2).OrderByDescending(p => p.RoundScore))
            {
                DataGridViewRow Row = new DataGridViewRow();
                Row.CreateCells(Team2Grid);
                Row.SetValues(new object[] {
                    Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.rank_" + P.Rank + "icon.gif")),
                    P.Name, P.RoundScore, P.Stats.Kills, P.Stats.Deaths
                });
                Row.Tag = P.Pid;
                Team2Grid.Rows.Add(Row);
            }

            // Set flag images
            ArmyFlag1.Image = Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.armyflag_" + GetArmyCode(Game.Team1ArmyId) + ".png"));
            ArmyFlag2.Image = Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.armyflag_" + GetArmyCode(Game.Team2ArmyId) + ".png"));

            // Set team names
            TeamName1.Text = ArmyNames[Game.Team1ArmyId];
            TeamName2.Text = ArmyNames[Game.Team2ArmyId];

            // Set secondary team text
            if (Game.WinningTeam == 1)
            {
                TicketsLabel1.Text = "Has won the Round!";
            }
            else if (Game.WinningTeam == 2)
            {
                TicketsLabel2.Text = "Has won the Round!";
            }
            else
            {
                TicketsLabel1.Text = "Remaining Tickets: " + Game.Team1Tickets;
                TicketsLabel2.Text = "Remaining Tickets: " + Game.Team2Tickets;
            }

            // Set window title text
            this.Text = String.Format("Game Result: {0} [{1}] - {2} UTC", Game.MapName, Game.Mod, Game.RoundEndDate.ToString());
            this.MapNameLabel.Text = Game.MapName + " (ID: " + Game.MapId + ")";
            this.ModLabel.Text = Game.Mod;
            this.KillsLabel.Text = Game.MapKills.ToString();
            this.DeathsLabel.Text = Game.MapDeaths.ToString();
            this.StartTimeLabel.Text = DateTime.UtcNow.FromUnixTimestamp(Game.RoundStartTime).ToLocalTime().ToString();
            this.EndTimeLabel.Text = DateTime.UtcNow.FromUnixTimestamp(Game.RoundEndTime).ToLocalTime().ToString();
            this.RoundTimeLabel.Text = Game.RoundTime.ToString();
            this.ServerNameLabel.Text = Game.ServerName;
            this.ServerPortLabel.Text = Game.ServerPort.ToString();
            this.TotalPlayersLabel.Text = Game.PlayersConnected.ToString();
            this.Team1PlayersLabel.Text = Game.Team1Players.ToString();
            this.Team2PlayersLabel.Text = Game.Team2Players.ToString();
            this.EorPlayers1Label.Text = Game.Team1PlayersEnd.ToString();
            this.EorPlayers2Label.Text = Game.Team2PlayersEnd.ToString();
            this.RoundProcLabel.Text = isProcessed ? "True" : "False";

            // Set Gamemode
            this.GameModeLabel.Text = GetGameModeText(Game.GameMode);
        }