コード例 #1
0
ファイル: RecoveryMenu.cs プロジェクト: senzdota/Ensage
        public RecoveryMenu(Menu mainMenu)
        {
            var menu = new Menu("Recovery abuse", "recoveryAbuse");

            var enabled = new MenuItem("abuseEnabled", "Enabled").SetValue(true);

            menu.AddItem(enabled);
            enabled.ValueChanged += (sender, args) =>
            {
                IsEnabled = args.GetNewValue <bool>();
                OnEnabledChange?.Invoke(null, new BoolEventArgs(IsEnabled));
            };
            IsEnabled = enabled.IsActive();

            var key = new MenuItem("recoveryKey", "Hotkey").SetValue(new KeyBind('-', KeyBindType.Press));

            menu.AddItem(key);
            key.ValueChanged += (sender, args) =>
            {
                if (skipNextEvent)
                {
                    skipNextEvent = false;
                    return;
                }

                IsActive = args.GetNewValue <KeyBind>().Active;
                OnAbuseChange?.Invoke(null, new BoolEventArgs(IsActive));
            };

            menu.AddItem(
                new MenuItem("recoveryItemsToggler", "Enabled:").SetValue(
                    abilityToggler = new AbilityToggler(ItemsToUse.ToDictionary(x => x.ToString(), x => true))));

            menu.AddItem(
                new MenuItem("recoveryItemsPriority", "Order:").SetValue(
                    priorityChanger = new PriorityChanger(ItemsToUse.Select(x => x.ToString()).ToList())));

            var toBackpack = new MenuItem("recoveryToBackpack", "Move items to backpack").SetValue(false);

            toBackpack.SetTooltip("Move items to backpack to \"disable\" them instead of dropping on the ground");
            menu.AddItem(toBackpack);
            toBackpack.ValueChanged += (sender, args) => ItemsToBackpack = args.GetNewValue <bool>();
            ItemsToBackpack          = toBackpack.IsActive();

            ItemSettingsMenu = new SettingsMenu(menu);

            mainMenu.AddSubMenu(menu);
        }
コード例 #2
0
ファイル: DewardingMenu.cs プロジェクト: senzdota/Ensage
        public DewardingMenu(Menu mainMenu)
        {
            var menu = new Menu("Dewarding", "dewardMenu");

            var enabled = new MenuItem("dewardEnabled", "Enabled").SetValue(true);

            enabled.SetTooltip("Auto use quelling blade, tangos, iron talon etc. enemy on wards");
            menu.AddItem(enabled);
            enabled.ValueChanged += (sender, args) =>
            {
                IsEnabled = args.GetNewValue <bool>();
                OnEnabledChange?.Invoke(null, new BoolEventArgs(IsEnabled));
            };
            IsEnabled = enabled.IsActive();

            var tangoHpThreshold =
                new MenuItem("dewardTangoHp", "Tango HP threshold").SetValue(new Slider(150, 0, 250));

            tangoHpThreshold.SetTooltip("Use tango only if you are missing more hp");
            menu.AddItem(tangoHpThreshold);
            tangoHpThreshold.ValueChanged += (sender, args) => TangoHpThreshold = args.GetNewValue <Slider>().Value;
            TangoHpThreshold = tangoHpThreshold.GetValue <Slider>().Value;

            var updateRate = new MenuItem("dewardUpdateRate", "Update rate").SetValue(new Slider(200, 1, 500));

            updateRate.SetTooltip("Lower value => faster reaction, but requires more resources");
            menu.AddItem(updateRate);
            updateRate.ValueChanged += (sender, args) =>
            {
                UpdateRate = args.GetNewValue <Slider>().Value;
                OnUpdateRateChange?.Invoke(null, new IntEventArgs(UpdateRate));
            };
            UpdateRate = updateRate.GetValue <Slider>().Value;

            menu.AddItem(
                new MenuItem("dewardItemsToggler", "Items:").SetValue(
                    abilityToggler = new AbilityToggler(ItemsToUse.ToDictionary(x => x.ToString(), x => true))));

            menu.AddItem(
                new MenuItem("dewardPriority", "Order:").SetValue(
                    priorityChanger = new PriorityChanger(ItemsToUse.Select(x => x.ToString()).ToList())));

            mainMenu.AddSubMenu(menu);
        }