Esempio n. 1
0
        private void UnselectHero(object sender, MouseButtonEventArgs e)
        {
            Image  heroImage = (Image)sender;
            string hero      = (string)heroImage.Tag;

            if (hero != "") // "" is for avatars
            {
                if (allies.Contains(hero))
                {
                    allies.Remove(hero);
                    redrawAllies();
                }
                else
                {
                    int index = enemies.IndexOf(hero);
                    enemies.Remove(hero);

                    LaneToggle laneToggle = enemyLaneToggles[index];
                    enemyLaneToggles.Remove(laneToggle);
                    SelectedHeroesGrid.Children.Remove(laneToggle);

                    redrawEnemies();
                }
                controlIcons[hero].Source = images[hero];
            }
        }
Esempio n. 2
0
        private void addHeroToEnemies(object sender, MouseButtonEventArgs e)
        {
            Image  heroImage = (Image)sender;
            string hero      = (string)heroImage.Tag;

            if (enemies.Count >= 5 || allies.Contains(hero) || enemies.Contains(hero) || banned.Contains(hero))
            {
                return;
            }

            controlIcons[hero].Source = grayImages[hero];

            int column = enemies.Count;

            enemies.Add(hero);

            Image selectedHeroIcon = enemyIcons[column];

            selectedHeroIcon.Source = images[hero];
            selectedHeroIcon.Tag    = heroImage.Tag;

            LaneToggle laneToggle = new LaneToggle();

            SelectedHeroesGrid.Children.Add(laneToggle);
            Grid.SetRow(laneToggle, 1);
            Grid.SetColumn(laneToggle, column + 6);
            laneToggle.Margin = new Thickness(0, 5, 0, 0);
            enemyLaneToggles.Add(laneToggle);
        }