Esempio n. 1
0
        public void RefreshInfoGroups(Replay replay)
        {
            var killEvents = replay.Events().FindAll(re => re.GetType().Name == "ReplayKillEvent");

            lengthInMins.Text   = FormatGameLength(replay.Info.LengthInMs);
            networkVerison.Text = replay.Info.NetworkVersion.ToString();
            matchType.Text      = replay.Info.ServerType.ToString();

            if (replay.Info.ServerType == ServerType.Official)
            {
                // TODO Fix game version detection
                gameVerison.Visible = false;
                host.Visible        = false;
            }
            else
            {
                gameverisonLabel.Text = "Host:";
                gameVerison.Visible   = false;
                host.Visible          = true;
                host.Text             = replay.Info.CustomHost;
            }

            serverRegion.Text         = replay.Summary.Region.ToUpper();
            serverId.Text             = replay.Info.ServerId;
            recordingSize.Text        = FormatReplaySize(replay.Info.DemoFileLastOffset);
            timeRecorded.Text         = replay.Info.CreatedAt.ToLocalTime().ToString();
            isLive.Checked            = replay.Info.IsLive;
            isIncomplete.Checked      = replay.Info.IsIncomplete;
            IsServerRecording.Checked = replay.Info.IsServerRecording;
            fileLocked.Checked        = replay.Info.ShouldKeep;
            teamInfo.Text             = replay.Info.Mode.ToString();
            profile_id          = replay.Info.RecordUserId;
            recordingUser.Text  = replay.Info.RecordUserNickName;
            mapName.Text        = replay.Info.MapName.ToString();
            diedorwon.Checked   = replay.Info.AllDeadOrWin;
            fileSize.Text       = FormatReplaySize(replay.Size());
            weatherType.Text    = FormatWeather(replay.Summary.Weather);
            totalPlayers.Text   = replay.Summary.PlayersCount.ToString();
            totalTeams.Text     = replay.Summary.TeamsCount.ToString();
            rankNum.Text        = replay.Recorder.Ranking.ToString();
            headShots.Text      = replay.Recorder.HeadShots.ToString();
            kills.Text          = replay.Recorder.Kills.ToString();
            dmgHandedOut.Text   = FormatFloat(replay.Recorder.TotalGivenDamages);
            longestKill.Text    = FormatKillDistance(replay.Recorder.LongestDistanceKill);
            distanceWalked.Text = FormatMovedDistance(replay.Recorder.TotalMovedDistance);

            for (int i = 0; i < 8; i++)
            {
                bool playerHasData = replay.Summary.Players.Length > i;

                tmBlocks[i].Group.Visible               = playerHasData;
                tmBlocks[i].Headshots.Visible           = playerHasData;
                tmBlocks[i].Headshotslabel.Visible      = playerHasData;
                tmBlocks[i].KillerPubgName.Visible      = playerHasData;
                tmBlocks[i].KillerPubgNameLabel.Visible = playerHasData;
                tmBlocks[i].KillerSteamId.Visible       = playerHasData;
                tmBlocks[i].KillerSteamIdLabel.Visible  = playerHasData;
                tmBlocks[i].Kills.Visible               = playerHasData;
                tmBlocks[i].KillsLabel.Visible          = playerHasData;
                tmBlocks[i].PubgName.Visible            = playerHasData;
                tmBlocks[i].PubgNameLabel.Visible       = playerHasData;
                tmBlocks[i].SteamId.Visible             = playerHasData;
                tmBlocks[i].SteamIdLabel.Visible        = playerHasData;

                if (playerHasData)
                {
                    tmBlocks[i].PubgName.Text  = replay.Summary.Players[i].PlayerName;
                    tmBlocks[i].SteamId.Text   = replay.Summary.Players[i].PlayerId.ToString();
                    tmBlocks[i].Headshots.Text = replay.Summary.Players[i].HeadShots.ToString();
                    tmBlocks[i].Kills.Text     = replay.Summary.Players[i].Kills.ToString();

                    try
                    {
                        ReplayKillEvent killEvent = (ReplayKillEvent)killEvents.First(kill =>
                                                                                      ((ReplayKillEvent)kill).VictimId == replay.Summary.Players[i].PlayerId.ToString());
                        tmBlocks[i].KillerPubgName.Text = killEvent.KillerName;
                        tmBlocks[i].KillerSteamId.Text  = killEvent.KillerId;
                    }
                    catch (InvalidOperationException e)
                    {
                        tmBlocks[i].KillerPubgName.Text = "[unknown]";
                        tmBlocks[i].KillerSteamId.Text  = "[unknown]";
                    }
                }
            }
        }