示例#1
0
        private void UpdateList()
        {
            var images = new List <object>();

            foreach (var item in _spells)
            {
                images.Add(new { Image = DataDragon.GetSpellImage(item).Load(), Name = item.name, Data = item });
            }
            SpellGrid.ItemsSource = images;
        }
示例#2
0
        public MatchDetails(RiotACS.Game game, RiotACS.Delta delta, Action back = null)
        {
            InitializeComponent();

            this.back = back;
            if (back == null)
            {
                BackButton.Visibility = Visibility.Collapsed;
            }

            var blue = new List <object>();
            var red  = new List <object>();

            foreach (var player in game.Participants)
            {
                var champ  = DataDragon.GetChampData(player.ChampionId);
                var spell1 = DataDragon.GetSpellData(player.Spell1Id);
                var spell2 = DataDragon.GetSpellData(player.Spell2Id);

                var items = new[] { player.Stats.Item0, player.Stats.Item1, player.Stats.Item2, player.Stats.Item3, player.Stats.Item4, player.Stats.Item5, player.Stats.Item6 };

                var item = new {
                    ChampImage  = DataDragon.GetChampIconImage(champ),
                    Spell1Image = DataDragon.GetSpellImage(spell1),
                    Spell2Image = DataDragon.GetSpellImage(spell2),
                    Name        = champ.name,
                    Score       = $"{player.Stats.Kills} / {player.Stats.Deaths} / {player.Stats.Assists}",
                    Item0Image  = DataDragon.GetItemImage(items[0]),
                    Item1Image  = DataDragon.GetItemImage(items[1]),
                    Item2Image  = DataDragon.GetItemImage(items[2]),
                    Item3Image  = DataDragon.GetItemImage(items[3]),
                    Item4Image  = DataDragon.GetItemImage(items[4]),
                    Item5Image  = DataDragon.GetItemImage(items[5]),
                    Item6Image  = DataDragon.GetItemImage(items[6]),
                    CS          = player.Stats.TotalMinionsKilled,
                    Gold        = (player.Stats.GoldEarned / 1000.0).ToString("#.#k")
                };

                if (player.TeamId == 100)
                {
                    blue.Add(item);
                }
                else
                {
                    red.Add(item);
                }
            }
            BlueTeam.ItemsSource = blue;
            RedTeam.ItemsSource  = red;
        }
示例#3
0
 private void SpellSelector_SpellSelected(object sender, SpellDto e)
 {
     Popup.BeginStoryboard(App.FadeOut);
     if (doSpell1)
     {
         spell1             = e;
         Spell1Image.Source = DataDragon.GetSpellImage(e).Load();
     }
     else
     {
         spell2             = e;
         Spell2Image.Source = DataDragon.GetSpellImage(e).Load();
     }
     game.SelectSpells(spell1.key, spell2.key);
 }
示例#4
0
        public MatchHistoryItem()
        {
            InitializeComponent();

            Loaded += (src, e) => {
                var game     = DataContext as RiotACS.Game;
                var identity = game.ParticipantIdentities.FirstOrDefault(i => i.Player.AccountId == Session.Current.Account.AccountID);
                var me       = game.Participants.FirstOrDefault(p => p.ParticipantId == identity.ParticipantId);

                var champ  = DataDragon.GetChampData(me.ChampionId);
                var spell1 = DataDragon.GetSpellData(me.Spell1Id);
                var spell2 = DataDragon.GetSpellData(me.Spell2Id);

                ChampImage.Source  = DataDragon.GetChampIconImage(champ).Load();
                Spell1Image.Source = DataDragon.GetSpellImage(spell1).Load();
                Spell2Image.Source = DataDragon.GetSpellImage(spell2).Load();

                MapLabel.Content = DataDragon.GameMaps[game.MapId];
                if (game.GameType.Equals("CUSTOM_GAME"))
                {
                    ModeLabel.Content = "Custom";
                }
                else if (game.GameType.Equals("TUTORIAL_GAME"))
                {
                    ModeLabel.Content = "Tutorial";
                }
                else
                {
                    ModeLabel.Content = GameMode.Values[game.GameMode].Value;
                }

                var items  = new[] { me.Stats.Item0, me.Stats.Item1, me.Stats.Item2, me.Stats.Item3, me.Stats.Item4, me.Stats.Item5, me.Stats.Item6 };
                var images = new[] { Item0Image, Item1Image, Item2Image, Item3Image, Item4Image, Item5Image, Item6Image };
                for (int i = 0; i < items.Length; i++)
                {
                    images[i].Source = DataDragon.GetItemImage(items[i]).Load();
                }

                ScoreLabel.Content = $"{me.Stats.Kills} / {me.Stats.Deaths} / {me.Stats.Assists}";
                var date = Session.Epoch.AddMilliseconds(game.GameCreation);

                DateLabel.Content = date.ToString("M / d / yyyy");
                TimeLabel.Content = date.ToString("h:mm tt");
            };
        }
 private void DisplaySelection(PlayerChampionSelectionDTO selection)
 {
     if (selection?.Spell1Id > 0 && selection?.Spell2Id > 0 && selection?.ChampionId > 0)
     {
         ChampImage.Source  = DataDragon.GetChampIconImage(DataDragon.GetChampData(selection.ChampionId)).Load();
         Spell1Image.Source = DataDragon.GetSpellImage(DataDragon.GetSpellData(selection.Spell1Id)).Load();
         Spell2Image.Source = DataDragon.GetSpellImage(DataDragon.GetSpellData(selection.Spell2Id)).Load();
         Unknown.Visibility = Obscure.Visibility = Visibility.Collapsed;
     }
     else if (selection?.Spell1Id > 0 && selection?.Spell2Id > 0)
     {
         Spell1Image.Source = DataDragon.GetSpellImage(DataDragon.GetSpellData(selection.Spell1Id)).Load();
         Spell2Image.Source = DataDragon.GetSpellImage(DataDragon.GetSpellData(selection.Spell2Id)).Load();
         Grid.SetColumnSpan(Unknown, 1);
         Grid.SetColumnSpan(Obscure, 1);
         Unknown.Visibility = Obscure.Visibility = Visibility.Visible;
     }
     else
     {
         Unknown.Visibility = Obscure.Visibility = Visibility.Visible;
     }
 }
示例#6
0
        private async void Update()
        {
            var game   = this.game.Data;
            var config = Session.Current.Account.LoginPacket.GameTypeConfigs.FirstOrDefault(q => q.Id == game.GameTypeConfigId);

            LockInButt.IsEnabled = false;
            var myChamp = game.PlayerChampionSelections
                          .FirstOrDefault(p => p.SummonerInternalName == Session.Current.Account.LoginPacket.AllSummonerData.Summoner.InternalName);
            var me = (PlayerParticipant)game.TeamOne.Concat(game.TeamTwo)
                     .FirstOrDefault(p => (p as PlayerParticipant)?.AccountId == Session.Current.Account.AccountID);

            if (game.GameState.Equals("CHAMP_SELECT") || game.GameState.Equals("PRE_CHAMP_SELECT"))
            {
                var turn = Dispatcher.MyInvoke(RenderPlayers, game);
                Popup.ChampSelector.IsReadOnly = !turn.IsMyTurn;

                spell1 = DataDragon.GetSpellData(myChamp.Spell1Id);
                spell2 = DataDragon.GetSpellData(myChamp.Spell2Id);
                Dispatcher.Invoke(() => {
                    Spell1Image.Source = DataDragon.GetSpellImage(spell1).Load();
                    Spell2Image.Source = DataDragon.GetSpellImage(spell2).Load();
                });

                LockInButt.IsEnabled = turn.IsMyTurn;

                if (game.GameState.Equals("PRE_CHAMP_SELECT"))
                {
                    if (last?.PickTurn != game.PickTurn)
                    {
                        SetTimer(config.BanTimerDuration - 2);
                    }
                    if (turn.IsMyTurn)
                    {
                        state = State.Banning;
                    }
                    else
                    {
                        state = State.Watching;
                    }
                    var champs = await this.game.GetChampionsForBan();

                    if (turn.IsOurTurn)
                    {
                        Popup.ChampSelector.SetChampList(champs.Where(c => c.EnemyOwned).Select(c => DataDragon.GetChampData(c.ChampionId)));
                    }
                    else
                    {
                        Popup.ChampSelector.SetChampList(champs.Where(c => c.Owned).Select(c => DataDragon.GetChampData(c.ChampionId)));
                    }

                    if (turn.IsMyTurn)
                    {
                        header = YouBanString;
                    }
                    else if (turn.IsOurTurn)
                    {
                        header = YourTeamBanString;
                    }
                    else
                    {
                        header = OtherTeamBanString;
                    }
                }
                else
                {
                    if (last?.PickTurn != game.PickTurn)
                    {
                        SetTimer(config.MainPickTimerDuration - 2);
                    }
                    if (turn.IsMyTurn)
                    {
                        state = State.Picking;
                    }
                    else
                    {
                        state = State.Watching;
                    }
                    Popup.ChampSelector.UpdateChampList();

                    if (turn.IsMyTurn)
                    {
                        header = YouPickString;
                    }
                    else
                    {
                        header = NotPickingString;
                    }
                }
            }
            else if (game.GameState.Equals("POST_CHAMP_SELECT"))
            {
                if (last?.PickTurn != game.PickTurn)
                {
                    SetTimer(config.PostPickTimerDuration - 2);
                }
                var turn = Dispatcher.MyInvoke(RenderPlayers, game);
                state = State.Watching;
                Popup.ChampSelector.IsReadOnly = true;
                header = PostString;
            }
            else
            {
            }

            if (game.GameType == GameConfig.AllRandom.Value)
            {
                LockInButt.Content   = $"{me.PointSummary.NumberOfRolls} / {me.PointSummary.MaxRolls}";
                LockInButt.IsEnabled = me.PointSummary.NumberOfRolls > 0;
            }

            MyTeam.Columns = OtherTeam.Columns = game.MaxNumPlayers / 2;
            UpdateHeader();
            last = game;
        }