コード例 #1
0
        public void Attach(Menu menu, ComboProvider provider)
        {
            _summs = new Dictionary <ISummonerSpell, bool>();
            var summs = new ISummonerSpell[] { new Heal(), new Cleanse() };

            foreach (var activateableItem in summs)
            {
                ISummonerSpell item = activateableItem;

                if (!activateableItem.IsAvailable())
                {
                    continue;
                }

                var itemMenu = new Menu(item.GetDisplayName(), item.GetDisplayName());
                item.Initialize(itemMenu);
                _summs.Add(item, true);
                itemMenu.AddMItem("Enabled", true, (sender, agrs) => _summs[item] = agrs.GetNewValue <bool>()).ProcStoredValueChanged <bool>();
                menu.AddSubMenu(itemMenu);
            }

            if (summs.All(sum => !sum.IsAvailable()))
            {
                menu.AddMItem("No Supported Summoner Spell Available");
                menu.AddMItem("Supported Spells:");
                foreach (var summonerSpell in summs)
                {
                    menu.AddMItem("* " + summonerSpell.GetDisplayName());
                }
            }
            else
            {
                menu.AddMItem("Only in Combo", true, (sender, args) => _combo = args.GetNewValue <bool>());
                menu.AddMItem("Enabled", false, (sender, args) => Enabled     = args.GetNewValue <bool>());
            }
            menu.ProcStoredValueChanged <bool>();
            Game.OnUpdate += _ => Update(provider);
        }
コード例 #2
0
        public void Attach(Menu menu, ComboProvider provider, params ISummonerSpell[] summs)
        {
            _summs = new Dictionary <ISummonerSpell, bool>();

            foreach (var activateableItem in summs)
            {
                ISummonerSpell item = activateableItem;

                if (!activateableItem.IsAvailable())
                {
                    continue;
                }

                var itemMenu = new Menu(item.GetDisplayName(), item.GetDisplayName());
                item.Initialize(itemMenu);
                _summs.Add(item, true);
                itemMenu.AddMItem("Enabled", true, (sender, agrs) => _summs[item] = agrs.GetNewValue <bool>());
                menu.AddSubMenu(itemMenu);
            }

            if (summs.All(sum => !sum.IsAvailable()))
            {
                menu.AddMItem("- No supported summoner spell available -");
                menu.AddMItem("Supported spells:");
                foreach (var summonerSpell in summs)
                {
                    menu.AddMItem("* " + summonerSpell.GetDisplayName());
                }
            }
            else
            {
                menu.AddMItem("Only in combo", true, (sender, args) => _combo = args.GetNewValue <bool>());
                menu.AddMItem("Enabled", false, (sender, args) => _enabled    = args.GetNewValue <bool>());
            }
            Game.OnUpdate += _ => Update(provider);
        }