当前位置: 首页>>代码示例>>C#>>正文


C# Hero.StoredName方法代码示例

本文整理汇总了C#中Hero.StoredName方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.StoredName方法的具体用法?C# Hero.StoredName怎么用?C# Hero.StoredName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hero的用法示例。


在下文中一共展示了Hero.StoredName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTopPanelPosition

 public static Vector2 GetTopPanelPosition(Hero v)
 {
     Vector2 pos;
     if (Members.TopPanelPostiion.TryGetValue(v.StoredName(), out pos))
     {
         return pos;
     }
     Members.TopPanelPostiion.Add(v.StoredName(), HUDInfo.GetTopPanelPosition(v));
     return HUDInfo.GetTopPanelPosition(v);
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:10,代码来源:Helper.cs

示例2: GetProjectileSpeed

        /// <summary>
        ///     Returns units projectile speed
        /// </summary>
        /// <param name="unit"></param>
        /// <returns></returns>
        public static double GetProjectileSpeed(Hero unit)
        {
            if (unit == null || !unit.IsRanged)
            {
                return double.MaxValue;
            }

            var name = unit.StoredName();
            try
            {
                double projSpeed;
                if (!projSpeedDictionary.TryGetValue(unit.Handle, out projSpeed))
                {
                    projSpeed = Game.FindKeyValues(name + "/ProjectileSpeed", KeyValueSource.Hero).FloatValue;
                }

                return projSpeed;
            }
            catch (KeyValuesNotFoundException)
            {
                if (!Utils.SleepCheck("Ensage.Common.DemoModeWarning"))
                {
                    return double.MaxValue;
                }

                Utils.Sleep(10000, "Ensage.Common.DemoModeWarning");
                Console.WriteLine(@"[[Please do not use demo mode for testing assemblies]]");
                return double.MaxValue;
            }
        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:35,代码来源:UnitDatabase.cs

示例3: GetAttackPoint

        /// <summary>
        ///     Gets the attack point.
        /// </summary>
        /// <param name="unit">
        ///     The unit.
        /// </param>
        /// <returns>
        ///     The <see cref="double" />.
        /// </returns>
        public static double GetAttackPoint(Hero unit)
        {
            if (unit == null)
            {
                return 0;
            }

            try
            {
                var name = unit.StoredName();
                double attackAnimationPoint;
                if (!AttackPointDictionary.TryGetValue(unit.Handle, out attackAnimationPoint))
                {
                    attackAnimationPoint =
                        Game.FindKeyValues(name + "/AttackAnimationPoint", KeyValueSource.Hero).FloatValue;
                    AttackPointDictionary.Add(unit.Handle, attackAnimationPoint);
                }

                var attackSpeed = GetAttackSpeed(unit);
                return attackAnimationPoint / (1 + (attackSpeed - 100) / 100);
            }
            catch (KeyValuesNotFoundException)
            {
                if (!Utils.SleepCheck("Ensage.Common.DemoModeWarning"))
                {
                    return 0;
                }

                Utils.Sleep(10000, "Ensage.Common.DemoModeWarning");
                Console.WriteLine(@"[[Please do not use demo mode for testing assemblies]]");
                return 0;
            }
        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:42,代码来源:UnitDatabase.cs

示例4: GetAttackRate

        /// <summary>
        ///     Gets the attack rate.
        /// </summary>
        /// <param name="unit">
        ///     The unit.
        /// </param>
        /// <returns>
        ///     The <see cref="double" />.
        /// </returns>
        public static double GetAttackRate(Hero unit)
        {
            try
            {
                var attackSpeed = GetAttackSpeed(unit);
                double attackBaseTime;
                if (!AttackRateDictionary.TryGetValue(unit.Handle, out attackBaseTime))
                {
                    attackBaseTime =
                        Game.FindKeyValues(unit.StoredName() + "/AttackRate", KeyValueSource.Hero).FloatValue;
                    AttackRateDictionary.Add(unit.Handle, attackBaseTime);
                }

                Ability spell = null;
                if (
                    !unit.HasModifiers(
                        new[]
                            {
                                "modifier_alchemist_chemical_rage", "modifier_terrorblade_metamorphosis", 
                                "modifier_lone_druid_true_form", "modifier_troll_warlord_berserkers_rage"
                            }, 
                        false))
                {
                    return attackBaseTime / (1 + ((attackSpeed - 100) / 100));
                }

                switch (unit.ClassID)
                {
                    case ClassID.CDOTA_Unit_Hero_Alchemist:
                        spell = unit.Spellbook.Spells.First(x => x.StoredName() == "alchemist_chemical_rage");
                        break;
                    case ClassID.CDOTA_Unit_Hero_Terrorblade:
                        spell = unit.Spellbook.Spells.First(x => x.StoredName() == "terrorblade_metamorphosis");
                        break;
                    case ClassID.CDOTA_Unit_Hero_LoneDruid:
                        spell = unit.Spellbook.Spells.First(x => x.StoredName() == "lone_druid_true_form");
                        break;
                    case ClassID.CDOTA_Unit_Hero_TrollWarlord:
                        spell = unit.Spellbook.Spells.First(x => x.StoredName() == "troll_warlord_berserkers_rage");
                        break;
                }

                if (spell == null)
                {
                    return attackBaseTime / (1 + (attackSpeed - 100) / 100);
                }

                attackBaseTime = spell.GetAbilityData("base_attack_time");

                return attackBaseTime / (1 + (attackSpeed - 100) / 100);
            }
            catch (KeyValuesNotFoundException)
            {
                if (!Utils.SleepCheck("Ensage.Common.DemoModeWarning"))
                {
                    return 0;
                }

                Utils.Sleep(10000, "Ensage.Common.DemoModeWarning");
                Console.WriteLine(@"[[Please do not use demo mode for testing assemblies]]");
                return 0;
            }
        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:72,代码来源:UnitDatabase.cs

示例5: GetAttackSpeed

        /// <summary>
        ///     Gets the attack speed.
        /// </summary>
        /// <param name="unit">
        ///     The unit.
        /// </param>
        /// <returns>
        ///     The <see cref="float" />.
        /// </returns>
        public static float GetAttackSpeed(Hero unit)
        {
            // Console.WriteLine(unit.AttacksPerSecond * Game.FindKeyValues(unit.Name + "/AttackRate", KeyValueSource.Hero).FloatValue / 0.01);
            try
            {
                double attackBaseTime;
                if (!AttackRateDictionary.TryGetValue(unit.Handle, out attackBaseTime))
                {
                    attackBaseTime =
                        Game.FindKeyValues(unit.StoredName() + "/AttackRate", KeyValueSource.Hero).FloatValue;
                    AttackRateDictionary.Add(unit.Handle, attackBaseTime);
                }

                var attackSpeed = Math.Min(unit.AttacksPerSecond * attackBaseTime / 0.01, 600);

                if (unit.HasModifier("modifier_ursa_overpower"))
                {
                    attackSpeed = 600;
                }

                return (float)attackSpeed;
            }
            catch (KeyValuesNotFoundException)
            {
                if (!Utils.SleepCheck("Ensage.Common.DemoModeWarning"))
                {
                    return 0;
                }

                Utils.Sleep(10000, "Ensage.Common.DemoModeWarning");
                Console.WriteLine(@"[[Please do not use demo mode for testing assemblies]]");
                return 0;
            }
        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:43,代码来源:UnitDatabase.cs

示例6: Execute

        /// <summary>
        ///     The execute.
        /// </summary>
        /// <param name="hero">
        ///     The hero.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public bool Execute(Hero hero)
        {
            if ((Variables.Instance.Techies.EnabledHeroes.ContainsKey(hero.ClassID)
                 && !Variables.Instance.Techies.EnabledHeroes[hero.ClassID]) || hero.IsInvul() || hero.IsMagicImmune()
                || hero.HasModifiers(
                    new[]
                        {
                            "modifier_juggernaut_blade_fury",
                            "modifier_ember_spirit_sleight_of_fist_caster_invulnerability"
                        },
                    false) || !hero.CanDie())
            {
                return false;
            }

            if (!Utils.SleepCheck(hero.ClassID + "Techies.AutoDetonate"))
            {
                return false;
            }

            var tempDamage = hero.GetStackDamage();
            if (!(tempDamage.Item1 >= hero.Health))
            {
                return false;
            }

            if (tempDamage.Item3 != null && tempDamage.Item3.AutoDetonate)
            {
                Detonate(tempDamage.Item2);
                Utils.Sleep(500, hero.ClassID + "Techies.AutoDetonate");
                return true;
            }

            if (tempDamage.Item3 == null || tempDamage.Item3.AutoDetonate
                || !Variables.Menu.DrawingsMenu.Item("Techies.ShowNotification").GetValue<bool>())
            {
                return false;
            }

            if (!Utils.SleepCheck("Techies.Notification." + hero.StoredName()))
            {
                return false;
            }

            Utils.Sleep(15000, "Techies.Notification." + hero.StoredName());
            if (this.notification == null)
            {
                this.notification = new Notification(
                    5000,
                    new Vector2(HUDInfo.ScreenSizeX(), (float)(HUDInfo.ScreenSizeY() / 2.3)),
                    new Vector2(HUDInfo.ScreenSizeX() / 8, HUDInfo.ScreenSizeX() / 30));
            }

            this.notification.RemoteMines = tempDamage.Item2;
            this.notification.PopUp(hero);
            return false;
        }
开发者ID:spyware293,项目名称:Ensage,代码行数:66,代码来源:AutoDetonateHeroes.cs

示例7: DrawItems

        private static void DrawItems(Hero v, bool forEnemy)
        {
            var pos = HUDInfo.GetHPbarPosition(v);
            if (pos.IsZero)
                return;
            List<Item> items;
            try
            {
                if (!Members.ItemDictionary.TryGetValue(v.Handle, out items))
                {
                    return;
                }
            }
            catch (Exception)
            {
                Printer.Print("[ItemOverlay][DrawItems]: " + v.StoredName());
                return;
            }

            var count = 0;
            var itemBoxSizeY = (float)(_defSize / 1.24);
            var newSize = new Vector2(_defSize, itemBoxSizeY);
            var halfSize = HUDInfo.GetHPBarSizeX()/2;
            var maxSizeX = Math.Max((float)items.Count/2*newSize.X + _defSize/(float) 2.6, halfSize);
            pos -= new Vector2(-halfSize + maxSizeX, _defSize + _defSize/Extra);
            if (DangeItems && forEnemy)
            {
                items = items.Where(Check).ToList();
                if (DangOldMethod)
                {
                    DrawOldMethod(v,items);
                    return;
                }
            }
            foreach (var item in items)
            {
                try
                {
                    var tex = Textures.GetItemTexture(item.StoredName());
                    if (item is Bottle)
                    {
                        var bottletype = item as Bottle;
                        if (bottletype.StoredRune != RuneType.None)
                        {
                            tex =
                                Textures.GetTexture(
                                    $"materials/ensage_ui/items/{item.Name.Replace("item_", "") + "_" + bottletype.StoredRune}.vmat");
                        }
                    }
                    var extraPos = new Vector2(_defSize * count, 0);
                    var itemPos = pos + extraPos;
                    var normalSize = newSize + new Vector2(4, _defSize / (float)2.6 + 4);
                    var normalPos = itemPos - new Vector2(2, 2);
                    Drawing.DrawRect(normalPos, newSize + new Vector2(4, _defSize / (float)2.6 + 4), Color.Black);
                    Drawing.DrawRect(itemPos, newSize + _defSize / (float)2.6, tex);
                    DrawState(item, normalPos, normalSize, v.Mana);
                    count++;
                }
                catch (Exception)
                {
                    // ignored
                }
            }
        }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:64,代码来源:ItemOverlay.cs

示例8: DrawForMirana

 private static void DrawForMirana(Hero mirana,List<Unit> Base)
 {
     if (_arrowUnit == null)
     {
         _arrowUnit =
             Base.Find(x => x.DayVision == 650 && x.Team == Members.MyHero.GetEnemyTeam());
     }
     if (_arrowUnit != null)
     {
         if (!_arrowUnit.IsValid)
         {
             foreach (var effect in ArrowParticalEffects.Where(effect => effect != null))
             {
                 effect.Dispose();
             }
             _letsDraw = true;
             _arrowUnit =
                 Manager.BaseManager.GetBaseList()
                     .Find(x => x.DayVision == 650 && x.Team == Members.MyHero.GetEnemyTeam());
             return;
         }
         if (!InSys.Contains(_arrowUnit))
         {
             _arrowS = _arrowUnit.Position;
             InSys.Add(_arrowUnit);
             Utils.Sleep(100, "kek");
             Helper.GenerateSideMessage(mirana.StoredName().Replace("npc_dota_hero_", ""), "mirana_arrow");
         }
         else if (_letsDraw && Utils.SleepCheck("kek") && _arrowUnit.IsVisible)
         {
             _letsDraw = false;
             var ret = Helper.FindRet(_arrowS, _arrowUnit.Position);
             for (var z = 1; z <= 147; z++)
             {
                 var p = Helper.FindVector(_arrowS, ret, 20 * z + 60);
                 ArrowParticalEffects[z] = new ParticleEffect(
                     @"particles\ui_mouseactions\draw_commentator.vpcf", p);
                 ArrowParticalEffects[z].SetControlPoint(1,
                     new Vector3(Members.Menu.Item("mirana.Red").GetValue<Slider>().Value,
                         Members.Menu.Item("mirana.Green").GetValue<Slider>().Value,
                         Members.Menu.Item("mirana.Blue").GetValue<Slider>().Value));
                 ArrowParticalEffects[z].SetControlPoint(0, p);
             }
         }
     }
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:46,代码来源:ShowMeMore.cs

示例9: GetItemList

 public static List<Item> GetItemList(Hero h)
 {
     List<Item> list;
     return Members.ItemDictionary.TryGetValue(h.StoredName(), out list) ? list : null;
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:5,代码来源:Manager.cs

示例10: GetAbilityList

 public static List<Ability> GetAbilityList(Hero h)
 {
     List<Ability> list;
     return Members.AbilityDictionary.TryGetValue(h.StoredName(), out list) ? list : null;
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:5,代码来源:Manager.cs

示例11: AddHeroMenu

        public async Task AddHeroMenu(Hero hero)
        {
            var heroName = hero.StoredName();
            var heroMenu = new Menu(hero.GetRealName(), heroName, false, heroName, true);

            menu.AddSubMenu(heroMenu);
            heroMenus.Add(hero, heroMenu);

            var key = hero.StoredName();
            if (hero.Equals(myHero))
            {
                key += "myHero";
            }

            var settings = new Menu("Settings", key + "settings");
            heroMenus.First(x => x.Key.Equals(hero)).Value.AddSubMenu(settings);
            await Task.Delay(200);

            var abilities = new MenuItem(key + "generateAbilities", "Generate ability ranges").SetValue(false);
            settings.AddItem(abilities);
            await Task.Delay(200);

            abilities.ValueChanged += async (sender, args) => {
                if (!args.GetNewValue<bool>())
                {
                    args.Process = false;
                    return;
                }
                await AddAbilities(hero);
            };

            if (abilities.IsActive())
            {
                await AddAbilities(hero);
            }

            var items = new MenuItem(key + "generateItems", "Generate item ranges").SetValue(false);
            enabledItemsMenu.Add(hero, items);
            settings.AddItem(items);
            await Task.Delay(200);

            items.ValueChanged += async (sender, args) => {
                if (!args.GetNewValue<bool>())
                {
                    args.Process = false;
                    return;
                }
                await AddAItems(hero);
            };

            if (items.IsActive())
            {
                await AddAItems(hero);
            }

            var attack = new MenuItem(key + "generateAttack", "Generate attack range").SetValue(false);
            settings.AddItem(attack);
            await Task.Delay(200);

            attack.ValueChanged += async (sender, args) => {
                if (!args.GetNewValue<bool>())
                {
                    args.Process = false;
                    return;
                }
                await AddMenuItem(hero, null, Ranges.CustomRange.Attack);
            };

            if (attack.IsActive())
            {
                await AddMenuItem(hero, null, Ranges.CustomRange.Attack);
            }

            var expirience = new MenuItem(key + "generateExpirience", "Generate expirience range").SetValue(false);
            settings.AddItem(expirience);
            await Task.Delay(200);

            expirience.ValueChanged += async (sender, args) => {
                if (!args.GetNewValue<bool>())
                {
                    args.Process = false;
                    return;
                }
                await AddMenuItem(hero, null, Ranges.CustomRange.Expiriece);
            };

            if (expirience.IsActive())
            {
                await AddMenuItem(hero, null, Ranges.CustomRange.Expiriece);
            }
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:91,代码来源:MenuManager.cs

示例12: AddAItems

        private async Task AddAItems(Hero hero)
        {
            foreach (var item in hero.Inventory.Items)
            {
                var itemName = item.GetDefaultName();

                if (string.IsNullOrEmpty(itemName) || addedItems.ContainsKey(hero.StoredName() + itemName))
                {
                    continue;
                }

                addedItems.Add(hero.StoredName() + itemName, item);

                if (item.GetRealCastRange() > 500)
                {
                    await AddMenuItem(hero, item);
                }
            }
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:19,代码来源:MenuManager.cs

示例13: AddMenuItem

        public async Task AddMenuItem(
            Hero hero,
            Ability ability,
            Ranges.CustomRange customRange = Ranges.CustomRange.None)
        {
            var isItem = ability is Item;
            var abilityName = isItem ? ability.GetDefaultName() : ability?.StoredName();
            var texture = abilityName;
            var menuName = string.Empty;

            switch (customRange)
            {
                case Ranges.CustomRange.Attack:
                    abilityName = "attackRange";
                    menuName = "Attack range";
                    texture = null;
                    break;
                case Ranges.CustomRange.Expiriece:
                    abilityName = "expRange";
                    menuName = "Exp range";
                    texture = null;
                    break;
            }

            if (string.IsNullOrEmpty(abilityName))
            {
                return;
            }

            var key = hero.StoredName() + abilityName;
            if (hero.Equals(myHero))
            {
                key += "myHero";
            }

            var abilityMenu = new Menu(texture == null ? menuName : " ", key, false, texture, true);

            var enable = new MenuItem(key + "enabled", "Enabled").SetValue(false);
            await Task.Delay(100);

            var radiusOnly = new MenuItem(key + "radius", "Damage radius only").SetValue(false);
            await Task.Delay(100);

            var red = new MenuItem(key + "red", "Red").SetValue(new Slider(255, 0, 255));
            await Task.Delay(100);

            var green = new MenuItem(key + "green", "Green").SetValue(new Slider(0, 0, 255));
            await Task.Delay(100);

            var blue = new MenuItem(key + "blue", "Blue").SetValue(new Slider(0, 0, 255));
            await Task.Delay(100);

            enable.ValueChanged += (sender, arg) => {
                var enabled = arg.GetNewValue<bool>();
                abilityMenu.DisplayName = enabled
                                              ? abilityMenu.DisplayName + "*"
                                              : abilityMenu.DisplayName.Replace("*", "");
                OnChange?.Invoke(
                    this,
                    new AbilityEventArgs
                    {
                        Hero = hero,
                        Name = abilityName,
                        Enabled = enabled,
                        Redraw = true
                    });
            };

            radiusOnly.ValueChanged += (sender, args) => {
                OnChange?.Invoke(
                    this,
                    new AbilityEventArgs
                    {
                        Hero = hero,
                        Name = abilityName,
                        Enabled = enable.IsActive(),
                        RadiusOnly = args.GetNewValue<bool>(),
                        Redraw = true
                    });
            };

            red.ValueChanged += (sender, arg) => {
                OnChange?.Invoke(
                    this,
                    new AbilityEventArgs
                    {
                        Hero = hero,
                        Name = abilityName,
                        Red = arg.GetNewValue<Slider>().Value
                    });
            };

            green.ValueChanged += (sender, arg) => {
                OnChange?.Invoke(
                    this,
                    new AbilityEventArgs
                    {
                        Hero = hero,
                        Name = abilityName,
                        Green = arg.GetNewValue<Slider>().Value
//.........这里部分代码省略.........
开发者ID:IdcNoob,项目名称:Ensage,代码行数:101,代码来源:MenuManager.cs


注:本文中的Hero.StoredName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。