Пример #1
0
 private void initKey()
 {
     keyAction[17] = keyAction[112] = key => {
         if (keyState[17] && keyState[112])
         {
             window.isEditMode = !window.isEditMode;
             Shortcut.clearSwapping();
         }
     };
     keyAction[37] = keyAction[38] = keyAction[39] = keyAction[40] = key => {
         if (!window.isKeyboardMode && !Shortcut.anyHovering())
         {
             window.isKeyboardMode = true;
             Shortcut.focusLeftTop();
         }
         else if (window.isKeyboardMode)
         {
             Shortcut.keyboardMove((key - 37 + 3) % 4);
         }
     };
 }
Пример #2
0
        private void changeKeyState(int keyCode, bool state)
        {
            if (keyCode >= 256 || keyCode < 0)
            {
                return;
            }
            bool previousState = keyState[keyCode];

            keyState[keyCode] = state;
            if (state && !previousState && keyAction[keyCode] != null)
            {
                keyAction[keyCode].Invoke(keyCode);
            }
            if (keyCode == 32 && window.isKeyboardMode)
            {
                Shortcut.isKeydown = state;
                if (!state)
                {
                    Shortcut.spacebarPressed();
                }
            }
        }