コード例 #1
0
        public void Attach(Menu menu, ComboProvider provider)
        {
            _provider = provider;
            _items    = new Dictionary <IActivateableItem, bool>();
            var items = new IActivateableItem[] { new BilgewaterCutlass(), new Botrk(), new YoumusBlade() };

            foreach (var activateableItem in items)
            {
                IActivateableItem item = activateableItem;
                if (item.GetRange() != int.MaxValue && item.GetRange() != 0 && item.GetRange() + 100 < ObjectManager.Player.AttackRange)
                {
                    continue;
                }

                var itemMenu = new Menu(item.GetDisplayName(), item.GetDisplayName());
                item.Initialize(itemMenu, this);
                _items.Add(item, true);
                itemMenu.AddMItem("Enabled", true, (sender, agrs) => _items[item] = agrs.GetNewValue <bool>()).ProcStoredValueChanged <bool>();
                menu.AddSubMenu(itemMenu);
            }
            menu.AddMItem("Only in combo", true, (sender, args) => _combo = args.GetNewValue <bool>());
            menu.AddMItem("Enabled", true, (sender, args) => Enabled      = args.GetNewValue <bool>());
            menu.ProcStoredValueChanged <bool>();
            Game.OnUpdate += _ => Update();
        }
コード例 #2
0
ファイル: ItemManager.cs プロジェクト: wade1990/PortAIO
        public static void Initialize(Menu menu, ComboProvider combo)
        {
            _items = new Dictionary <IActivateableItem, bool>();
            var items = new IActivateableItem[] { new BilgewaterCutlass(), new Botrk(), new YoumusBlade(), new RavenousHydra() };

            foreach (var activateableItem in items)
            {
                IActivateableItem item = activateableItem;

                var itemMenu = new Menu(item.GetDisplayName(), item.GetDisplayName());
                item.Initialize(itemMenu);
                _items.Add(item, true);
                itemMenu.AddMItem("Enabled", true, (sender, agrs) => _items[item] = agrs.GetNewValue <bool>()).ProcStoredValueChanged <bool>();
                menu.AddSubMenu(itemMenu);
            }
            menu.AddMItem("Use in combo", true, (sender, args) => _combo    = args.GetNewValue <bool>());
            menu.AddMItem("Use in harass", false, (sender, args) => _harass = args.GetNewValue <bool>());
            menu.ProcStoredValueChanged <bool>();
            Game.OnUpdate += _ => Update(combo);
        }