コード例 #1
0
        public virtual void ConnectToMenu(AbilityMenu menu, bool addAutoRun, bool addTakeBounty)
        {
            this.Menu.AddToMenu(menu);
            var enableItem = new AbilityMenuItem <bool>("Enable", true, "Enable automatic rune taking when in range");

            enableItem.AddToMenu(this.Menu);
            enableItem.NewValueProvider.Subscribe(new DataObserver <bool>(b => this.Enabled = b));
            this.Enabled = enableItem.Value;

            if (addAutoRun)
            {
                var autoRunForRune = new AbilityMenuItem <bool>(
                    "AutoRunForBounty",
                    false,
                    "Run to closest bounty rune spot when its the time");
                autoRunForRune.AddToMenu(this.Menu);
                autoRunForRune.NewValueProvider.Subscribe(new DataObserver <bool>(b => this.AutoRunToTake = b));
                this.AutoRunToTake = autoRunForRune.Value;
            }

            if (addTakeBounty)
            {
                var takeBountyOnStart = new AbilityMenuItem <bool>(
                    "TakeBountyOnStart",
                    false,
                    "Run to bounty rune spot on game start");
                takeBountyOnStart.AddToMenu(this.Menu);
                takeBountyOnStart.NewValueProvider.Subscribe(new DataObserver <bool>(b => this.TakeBountyOnStart = b));
                this.TakeBountyOnStart = takeBountyOnStart.Value;
            }
        }
コード例 #2
0
        public void NewKey(
            string name,
            uint key,
            Action keyActivated,
            Action keyDeactivated,
            bool toggle        = false,
            string description = null)
        {
            var item = new AbilityMenuItem <KeyBind>(
                name,
                new KeyBind(key, toggle ? KeyBindType.Toggle : KeyBindType.Press),
                description);

            item.NewValueProvider.Subscribe(
                new DataObserver <KeyBind>(
                    bind =>
            {
                if (bind.Active)
                {
                    keyActivated();
                }
                else
                {
                    keyDeactivated();
                }
            }));

            item.AddToMenu(this.Menu);
        }
コード例 #3
0
 public void AddKeyBind(AbilityMenuItem <KeyBind> keyBind)
 {
     this.keyBinds.Add(keyBind, keyBind.NewValueProvider.Subscribe(this.keyBindObserver));
     if (keyBind.Value.Active)
     {
         this.Activate();
     }
 }
コード例 #4
0
 public void RemoveKeyBind(AbilityMenuItem <KeyBind> keyBind)
 {
     this.keyBinds[keyBind].Dispose();
     this.keyBinds.Remove(keyBind);
     if (keyBind.Value.Active)
     {
         this.Deactivate();
     }
 }