Esempio n. 1
0
 public ReplayFileData(Replay replay, IHeroesIconsService heroesIcons)
 {
     ReplaysContext = new ReplaysContext();
     Replay         = replay;
     HeroesIcons    = heroesIcons;
     HeroesIcons.LoadHeroesBuild(99999); // needed for auto translations
     ReplaysDb = new ReplaysDb();
 }
        private void SetMatch()
        {
            var playersList          = ReplayMatch.ReplayMatchPlayers.ToList();
            var matchAwardDictionary = ReplayMatch.ReplayMatchAward.ToDictionary(x => x.PlayerId, x => x.Award);

            // load up correct build information
            HeroesIcons.LoadHeroesBuild(ReplayMatch.ReplayBuild);

            var playerParties = PlayerParties.FindPlayerParties(playersList);

            foreach (var player in playersList)
            {
                if (player.Team == 4)
                {
                    continue;
                }

                MatchPlayerBase matchPlayerBase = new MatchPlayerBase(InternalService, Website, player);
                matchPlayerBase.SetPlayerInfo(player.IsAutoSelect, playerParties, matchAwardDictionary);

                // add to collection
                if (player.Team == 0)
                {
                    MatchOverviewTeam1List.Add(matchPlayerBase);
                }
                else if (player.Team == 1)
                {
                    MatchOverviewTeam2List.Add(matchPlayerBase);
                }

                if (player.PlayerId == UserProfile.PlayerId)
                {
                    UserHero      = player.Character;
                    UserHeroImage = HeroesIcons.HeroBuilds().GetHeroInfo(player.Character).GetHeroPortrait();
                    WinnerResult  = player.IsWinner ? "Win" : "Loss";
                }
            }

            GameMode   = ReplayMatch.GameMode.GetFriendlyName();
            MapName    = ReplayMatch.MapName;
            TimeStamp  = ReplayMatch.TimeStamp.Value;
            GameLength = ReplayMatch.ReplayLength;
            Build      = ReplayMatch.ReplayBuild;
            ReplayId   = ReplayMatch.ReplayId;
        }