Пример #1
0
        private void OnAbilityAdd(object sender, AbilityEventArgs abilityEventArgs)
        {
            if (!abilityEventArgs.IsMine)
            {
                return;
            }

            var ability = abilityEventArgs.Ability;

            var usableAbility = manager.MyHero.UsableAbilities.OfType <IOffensiveAbility>().FirstOrDefault(x => x.Handle == ability.Handle);

            if (usableAbility == null)
            {
                return;
            }

            var forcedName = forcedNames.FirstOrDefault(x => x.Key == ability.Id).Value;

            if (!string.IsNullOrEmpty(forcedName))
            {
                usableAbility.ChangeName(forcedName);
            }

            var menuName = offensiveAbilityNames.FirstOrDefault(x => x.Key == ability.Id).Value;

            menu.CreateMenu(usableAbility, menuName);
            offensiveAbilities.Add(usableAbility);
            updateHandler.IsEnabled = true;
        }
Пример #2
0
        private void OnAbilityRemove(object sender, AbilityEventArgs abilityEventArgs)
        {
            if (!abilityEventArgs.IsMine)
            {
                return;
            }

            defensiveAbilities.RemoveAll(x => x.Handle == abilityEventArgs.Ability.Handle);

            if (!defensiveAbilities.Any())
            {
                updateHandler.IsEnabled = false;
            }
        }
Пример #3
0
        private void OnAbilityAdd(object sender, AbilityEventArgs abilityEventArgs)
        {
            if (!abilityEventArgs.IsMine)
            {
                return;
            }

            var ability = abilityEventArgs.Ability;

            var usableAbility = manager.MyHero.UsableAbilities.OfType <IDefensiveAbility>().FirstOrDefault(x => x.Handle == ability.Handle);

            if (usableAbility == null)
            {
                return;
            }

            var name = defensiveAbilityNames.FirstOrDefault(x => x.Key == ability.Id).Value;

            menu.CreateMenu(usableAbility, name);
            defensiveAbilities.Add(usableAbility);
            updateHandler.IsEnabled = true;
        }