예제 #1
0
        protected void CheckButtons(ModMachineEntity e)
        {
            var actions = buttonActions.Where(a => Input.GetButtonDown(a.Item1));

            if (actions.Count() == 0)
            {
                return;
            }

            int keymask = 0;

            if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
                keymask |= MOD_SHIFT;
            }
            if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
            {
                keymask |= MOD_ALT;
            }
            if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
            {
                keymask |= MOD_CTRL;
            }

            foreach (var v in actions.Where(a => a.Item2 == keymask))
            {
                ModLoader.log("Invoking button action for {0} with mods {1}", v.Item1, v.Item2);
                v.Item3();
            }
        }
예제 #2
0
 public HotKeyBehavior(ModMachineEntity e)
 {
     e.HoverEvent += CheckButtons;
 }
예제 #3
0
 public HoverBehavior(ModMachineEntity e, long lingerTimeInMS)
 {
     e.HoverEvent       += SetActive;
     this.lingerTimeInMS = lingerTimeInMS;
 }
예제 #4
0
 public void SetActive(ModMachineEntity sender)
 {
     viewUntil = ModMachineEntity.Now + lingerTimeInMS;
 }
예제 #5
0
 public HoverBehavior(ModMachineEntity e) : this(e, 100)
 {
 }