コード例 #1
0
            public HeroMenu(MenuFactory factory, string heroName)
            {
                var lang = SandboxConfig.Language;

                if (lang == "zh-Hans" || lang == "zh-Hant")
                {
                    Translations = JsonConvert.DeserializeObject <Dictionary <int, string> >(Resource1.cn);
                }
                else if (lang == "bg")
                {
                    Translations = JsonConvert.DeserializeObject <Dictionary <int, string> >(Resource1.ru);
                }
                else
                {
                    Translations = JsonConvert.DeserializeObject <Dictionary <int, string> >(Resource1.en);
                }

                this.Factory                   = factory.MenuWithTexture(Game.Localize(heroName), heroName);
                this.ItemMenu                  = Factory.Menu("Items", "items");
                this.LinkenBreakerMenu         = ItemMenu.Menu("Linken Breakers", "linkenbreakers");
                this.LinkenBreakerPriorityMenu = LinkenBreakerMenu.Item("Priority", new PriorityChanger(LinkenAbilityPriorityList));
                this.LinkenBreakerTogglerMenu  = LinkenBreakerMenu.Item("Toggler", new AbilityToggler(LinkenAbilityTogglerDic));

                this.UnitController = Factory.MenuWithTexture(Translations[2], "npc_dota_neutral_centaur_khan");
                this.Bodyblocker    = this.UnitController.MenuWithTexture(Translations[3], "earthshaker_fissure");
                var ucMenu = this.UnitController;
                var bb     = this.Bodyblocker;

                this.ControlUnits     = ucMenu.Item(Translations[4], true);
                this.Enabled          = bb.Item(Translations[5], true);
                this.UseUnitAbilities = ucMenu.Item(Translations[6], true);
                this.BlockSensitivity = bb.Item(Translations[7], new Slider(150, 50, 300));
                this.BlockSensitivity.Item.Tooltip = Translations[8];
            }