コード例 #1
0
    private void CheckKey(KeyCode code, KeyAction action, ZMInput.State state, EventHandler <ZMInputEventArgs> eventHandler)
    {
        if (action(code))
        {
            var input = GetInputForKeyCode(code, state);
            var args  = new ZMInputEventArgs(input);

            Notifier.SendEventNotification(eventHandler, args);
            Notifier.SendEventNotification(OnAnyKeyPressed, args);
        }
    }
コード例 #2
0
    private void BroadcastKeyboardEvents(KeyAction action, ZMInput.State state)
    {
        CheckKey(KeyCode.LeftArrow, action, state, OnLeftArrowKey);
        CheckKey(KeyCode.RightArrow, action, state, OnRightArrowKey);
        CheckKey(KeyCode.UpArrow, action, state, OnUpArrowKey);
        CheckKey(KeyCode.DownArrow, action, state, OnDownArrowKey);

        CheckKey(KeyCode.W, action, state, OnWKey);
        CheckKey(KeyCode.A, action, state, OnAKey);
        CheckKey(KeyCode.S, action, state, OnSKey);
        CheckKey(KeyCode.D, action, state, OnDKey);
        CheckKey(KeyCode.E, action, state, OnEKey);
        CheckKey(KeyCode.Q, action, state, OnQKey);
        CheckKey(KeyCode.R, action, state, OnRKey);

        CheckKey(KeyCode.Space, action, state, OnSpacebarKey);
        CheckKey(KeyCode.RightShift, action, state, OnRightShiftKey);
        CheckKey(KeyCode.Return, action, state, OnReturnKey);
        CheckKey(KeyCode.Escape, action, state, OnEscapeKey);

        CheckKey(KeyCode.Slash, action, state, OnSlashKey);
    }
コード例 #3
0
 private ZMInput GetInputForKeyCode(KeyCode code, ZMInput.State state)
 {
     return(new ZMInput(state, GetIDForKeyCode(code)));
 }