コード例 #1
0
        protected virtual void FireKeyReleased(int playerIndex, KeyCode key, int index)
        {
            KeyEventArg eventArg = new KeyEventArg(key, playerIndex);

            NotifyKeyReleased(ref eventArg);
            ClearKeyRepeat(ref eventArg, index);
        }
コード例 #2
0
 protected void NotifyKeyPressed(ref KeyEventArg eventArg)
 {
     for (int i = 0; i < keyListeners.Count; ++i)
     {
         keyListeners[i].OnKeyPressed(eventArg);
     }
 }
コード例 #3
0
        public KeyEvent Init(KeyEventArg arg, KeyState state)
        {
            this.arg = arg;
            this.state = state;

            return this;
        }
コード例 #4
0
 private void ClearKeyRepeat(ref KeyEventArg eventArg, int index)
 {
     if (KeyEventArg.Equals(ref eventArg, ref keyRepeats[index].eventArg))
     {
         keyRepeats[index] = KeyRepeatInfo.None;
     }
 }
コード例 #5
0
        public bool OnKeyPressed(KeyEventArg arg)
        {
            KeyCode key = arg.key;
            if (key == KeyCode.Space)
            {
                m_stepByStep = !m_stepByStep;
            }
            else if (key == KeyCode.Right)
            {
                if (m_stepByStep)
                {
                    m_shouldRunStep = true;
                }
                else
                {
                    bool shiftPressed = m_inputManager.IsShiftPressed();
                    bool ctrlPressed = m_inputManager.IsControlPressed();
                    bool altPressed = m_inputManager.IsAltPressed();

                    if (shiftPressed && ctrlPressed && altPressed)
                    {
                        m_skipTime = 60.0f;
                    }
                    else if (shiftPressed && ctrlPressed)
                    {
                        m_skipTime = 30.0f;
                    }
                    else if (shiftPressed)
                    {
                        m_skipTime = 10.0f;
                    }
                    else if (ctrlPressed)
                    {
                        m_skipTime = 5.0f;
                    }
                    else
                    {
                        m_skipTime = 1.0f;
                    }
                }
            }
            else
            {
                int skip;
                if (m_frameSkipLookup.TryGetValue(key, out skip))
                {
                    m_frameSkip = skip;
                }
            }

            return false;
        }
コード例 #6
0
        public override bool OnKeyPressed(KeyEventArg e)
        {
            if (base.OnKeyPressed(e))
            {
                return true;
            }

            if (e.key == KeyCode.Oem8)
            {
                ToggleConsole();
                return true;
            }

            return false;
        }
コード例 #7
0
 public void FireKeyRepeated(KeyEventArg arg)
 {
     NotifyKeyRepeated(ref arg);
 }
コード例 #8
0
 public void SetKeyPressed(KeyEventArg arg, bool flag)
 {
     if (arg.playerIndex != -1)
     {
         m_gamePads[arg.playerIndex].SetButtonPressed(arg.key, flag);
     }
     else
     {
         m_keyboard.SetKeyPressed(arg.key, flag);
     }
 }
コード例 #9
0
 private void SetKeyRepeat(ref KeyEventArg eventArg, int index)
 {
     keyRepeats[index] = new KeyRepeatInfo(eventArg, Application.CurrentTime + 0.5f);
 }
コード例 #10
0
 public void FireKeyPressed(KeyEventArg arg)
 {
     NotifyKeyPressed(ref arg);
 }
コード例 #11
0
        protected virtual bool OnConfirmPressed(KeyEventArg arg)
        {
            if (confirmButton != null)
            {
                OnConfirmButtonPress(confirmButton);
                return true;
            }

            return false;
        }
コード例 #12
0
 private void ClearKeyRepeat(ref KeyEventArg eventArg, int index)
 {
     if (KeyEventArg.Equals(ref eventArg, ref keyRepeats[index].eventArg))
     {
         keyRepeats[index] = KeyRepeatInfo.None;
     }
 }
コード例 #13
0
 public KeyRepeatInfo(KeyEventArg eventArg, float timestamp)
 {
     this.eventArg = eventArg;
     this.timestamp = timestamp;
 }
コード例 #14
0
 private void SetKeyRepeat(ref KeyEventArg eventArg, int index)
 {
     keyRepeats[index] = new KeyRepeatInfo(eventArg, Application.CurrentTime + 0.5f);
 }
コード例 #15
0
 protected void NotifyKeyRepeated(ref KeyEventArg eventArg)
 {
     for (int i = 0; i < keyListeners.Count; ++i)
     {
         keyListeners[i].OnKeyRepeated(eventArg);
     }
 }
コード例 #16
0
 public static bool Equals(ref KeyEventArg a, ref KeyEventArg b)
 {
     return a.key == b.key && a.playerIndex == b.playerIndex;
 }
コード例 #17
0
 public virtual bool OnKeyReleased(KeyEventArg arg)
 {
     if (!m_console.IsVisible)
     {
         m_keyBindings.OnKeyReleased(arg);
     }
     
     return HandleEvent(keyEvent.Init(arg, KeyState.Released));
 }
コード例 #18
0
 public virtual bool OnKeyRepeated(KeyEventArg arg)
 {
     return HandleEvent(keyEvent.Init(arg, KeyState.Repeated));
 }
コード例 #19
0
 protected override bool OnCancelPressed(KeyEventArg arg)
 {
     GameController gc = CurrentController as GameController;
     gc.ShowPauseScreen();
     return true;
 }
コード例 #20
0
 public KeyRepeatInfo(KeyEventArg eventArg, float timestamp)
 {
     this.eventArg  = eventArg;
     this.timestamp = timestamp;
 }
コード例 #21
0
        public bool OnKeyPressed(KeyEventArg arg)
        {
            KeyCode code = arg.key;
            String cmd = FindCmd(code);
            if (cmd != null)
            {
                TryExecuteCommand(cmd);
                return true;
            }

            return false;
        }
コード例 #22
0
 public static bool Equals(ref KeyRepeatInfo a, ref KeyRepeatInfo b)
 {
     return(KeyEventArg.Equals(ref a.eventArg, ref b.eventArg));
 }
コード例 #23
0
 public bool OnKeyRepeated(KeyEventArg arg)
 {
     KeyEntry entry = new KeyEntry(arg, KeyState.Repeated);
     AddKeyEntry(ref entry);
     return false;
 }
コード例 #24
0
        private bool OnKeyPressed(ref KeyEventArg e)
        {
            KeyCode key = e.key;

            if (e.IsCtrlPressed())
            {
                if (key == KeyCode.Left)
                {
                    MoveCursorWordLeft();
                    return true;
                }

                if (key == KeyCode.Right)
                {
                    MoveCursorWordRight();
                    return true;
                }

                if (key == KeyCode.Up)
                {
                    ScrollUp();
                    return true;
                }

                if (key == KeyCode.Down)
                {
                    ScrollDown();
                    return true;
                }

                if (key == KeyCode.A)
                {
                    MoveCursorHome();
                    return true;
                }

                if (key == KeyCode.E)
                {
                    MoveCursorEnd();
                    return true;
                }
            }

            if (e.IsShiftPressed())
            {
                char bindShiftChr;
                if (keyShiftBindings.TryGetValue(key, out bindShiftChr))
                {
                    EnterChar(bindShiftChr);
                    return true;
                }
            }

            if (key >= KeyCode.A && key <= KeyCode.Z)
            {
                char chr = (char)key;
                if (!e.IsShiftPressed())
                {
                    chr = char.ToLower(chr);
                }

                EnterChar(chr);
                return true;
            }

            if (key >= KeyCode.D0 && key <= KeyCode.D9 || key == KeyCode.Space)
            {
                EnterChar((char)key);
                return true;
            }

            if (key == KeyCode.Left)
            {
                MoveCursorLeft();
                return true;
            }

            if (key == KeyCode.Right)
            {
                MoveCursorRight();
                return true;
            }

            if (key == KeyCode.Up)
            {
                PrevHistory();
                return true;
            }

            if (key == KeyCode.Down)
            {
                NextHistory();
                return true;
            }

            if (key == KeyCode.Back)
            {
                DeletePrevChar();
                return true;
            }

            if (key == KeyCode.Delete)
            {
                DeleteNextChar();
                return true;
            }

            if (key == KeyCode.Enter)
            {
                TryExecuteCommand();
                return true;
            }

            if (key == KeyCode.Tab)
            {
                DoAutoComplete();
                return true;
            }

            if (key == KeyCode.Home)
            {
                MoveCursorHome();
                return true;
            }

            if (key == KeyCode.End)
            {
                MoveCursorEnd();
                return true;
            }

            if (key == KeyCode.Escape)
            {
                Clear();
                return true;
            }

            char bindChr;
            if (keyBindings.TryGetValue(key, out bindChr))
            {
                EnterChar(bindChr);
                return true;
            }

            return false;
        }
コード例 #25
0
 protected virtual bool OnCancelPressed(KeyEventArg arg)
 {
     if (cancelButton != null)
     {
         OnCancelButtonPress(cancelButton);
     }
     else
     {
         Finish();
     }
     return true;
 }
コード例 #26
0
 public static bool Equals(ref KeyEventArg a, ref KeyEventArg b)
 {
     return(a.key == b.key && a.playerIndex == b.playerIndex);
 }
コード例 #27
0
 private bool OnKeyReleased(ref KeyEventArg e)
 {
     return false;
 }
コード例 #28
0
 public bool OnKeyRepeated(KeyEventArg arg)
 {
     KeyCode code = arg.key;
     return FindCmd(code) != null;
 }
コード例 #29
0
        private bool OnKeyRepeat(ref KeyEventArg e)
        {
            KeyCode key = e.key;

            if (key >= KeyCode.A && key <= KeyCode.Z ||
                key >= KeyCode.D0 && key <= KeyCode.D9)
            {
                return OnKeyPressed(ref e);
            }

            if (key == KeyCode.Left ||
                key == KeyCode.Right ||
                key == KeyCode.Back ||
                key == KeyCode.Delete)
            {
                return OnKeyPressed(ref e);
            }

            if (e.IsCtrlPressed())
            {
                if (key == KeyCode.Up || key == KeyCode.Down)
                {
                    return OnKeyPressed(ref e);
                }
            }

            if (keyBindings.ContainsKey(key))
            {
                return OnKeyPressed(ref e);
            }

            return false;
        }
コード例 #30
0
        public bool OnKeyReleased(KeyEventArg arg)
        {
            if (m_frameSkipLookup.ContainsKey(arg.key))
            {
                m_frameSkip = 0;
                return true;
            }

            return false;
        }
コード例 #31
0
 public bool OnKeyRepeated(KeyEventArg arg)
 {
     return false;
 }
コード例 #32
0
 public KeyEntry(KeyEventArg arg, KeyState state)
 {
     this.arg = arg;
     this.state = state;
 }
コード例 #33
0
 protected virtual void FireKeyReleased(int playerIndex, KeyCode key, int index)
 {
     KeyEventArg eventArg = new KeyEventArg(key, playerIndex);
     NotifyKeyReleased(ref eventArg);
     ClearKeyRepeat(ref eventArg, index);
 }