Ejemplo n.º 1
0
        private void KeyUpdate()
        {
            foreach (object obj in this.codes)
            {
                KeyCode keyCode = (KeyCode)obj;
                bool    key     = Input.GetKey(keyCode);
                if (key)
                {
                    bool flag = !this.keyDown.Contains(keyCode);
                    if (flag)
                    {
                        MyKeyDownHook myKeyDownHook = MyHookSystem.executeHook <MyKeyDownHook>(new MyKeyDownHook(keyCode));
                        bool          flag2         = myKeyDownHook.isCanceled();
                        if (flag2)
                        {
                            bool register = myKeyDownHook.register;
                            if (register)
                            {
                                this.keyDown.Add(keyCode);
                            }
                            return;
                        }
                        this.keyDown.Add(keyCode);
                    }
                }
            }
            List <KeyCode> list = new List <KeyCode>(this.keyDown);

            foreach (KeyCode keyCode2 in list)
            {
                bool flag3 = !Input.GetKey(keyCode2);
                if (flag3)
                {
                    MyKeyUpHook baseHook    = new MyKeyUpHook(keyCode2);
                    MyKeyUpHook myKeyUpHook = MyHookSystem.executeHook <MyKeyUpHook>(baseHook);
                    bool        flag4       = myKeyUpHook.isCanceled();
                    if (flag4)
                    {
                        bool register2 = myKeyUpHook.register;
                        if (register2)
                        {
                            this.keyDown.Remove(keyCode2);
                        }
                        break;
                    }
                    this.keyDown.Remove(keyCode2);
                }
            }
        }
Ejemplo n.º 2
0
        private void KeyUpdate()
        {
            foreach (KeyCode code in codes)
            {
                if (Input.GetKey(code))
                {
                    if (!keyDown.Contains(code))
                    {
                        MyKeyDownHook result = MyHookSystem.executeHook <MyKeyDownHook>(new MyKeyDownHook(code));
                        if (result.isCanceled())
                        {
                            if (result.register)
                            {
                                keyDown.Add(code);
                            }
                            return;
                        }
                        keyDown.Add(code);
                    }
                }
            }
            List <KeyCode> nList = new List <KeyCode>(keyDown);

            foreach (KeyCode down in nList)
            {
                if (!Input.GetKey(down))
                {
                    MyKeyUpHook hook   = new MyKeyUpHook(down);
                    MyKeyUpHook result = MyHookSystem.executeHook <MyKeyUpHook>(hook);
                    if (result.isCanceled())
                    {
                        if (result.register)
                        {
                            keyDown.Remove(down);
                        }
                        return;
                    }
                    keyDown.Remove(down);
                }
            }
        }