protected virtual void FireKeyReleased(int playerIndex, KeyCode key, int index)
        {
            KeyEventArg eventArg = new KeyEventArg(key, playerIndex);

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

            return this;
        }
 private void ClearKeyRepeat(ref KeyEventArg eventArg, int index)
 {
     if (KeyEventArg.Equals(ref eventArg, ref keyRepeats[index].eventArg))
     {
         keyRepeats[index] = KeyRepeatInfo.None;
     }
 }
        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;
        }
        public override bool OnKeyPressed(KeyEventArg e)
        {
            if (base.OnKeyPressed(e))
            {
                return true;
            }

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

            return false;
        }
 public void FireKeyRepeated(KeyEventArg arg)
 {
     NotifyKeyRepeated(ref arg);
 }
 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);
     }
 }
 private void SetKeyRepeat(ref KeyEventArg eventArg, int index)
 {
     keyRepeats[index] = new KeyRepeatInfo(eventArg, Application.CurrentTime + 0.5f);
 }
 public void FireKeyPressed(KeyEventArg arg)
 {
     NotifyKeyPressed(ref arg);
 }
        protected virtual bool OnConfirmPressed(KeyEventArg arg)
        {
            if (confirmButton != null)
            {
                OnConfirmButtonPress(confirmButton);
                return true;
            }

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

            return false;
        }
Esempio n. 22
0
 public static bool Equals(ref KeyRepeatInfo a, ref KeyRepeatInfo b)
 {
     return(KeyEventArg.Equals(ref a.eventArg, ref b.eventArg));
 }
 public bool OnKeyRepeated(KeyEventArg arg)
 {
     KeyEntry entry = new KeyEntry(arg, KeyState.Repeated);
     AddKeyEntry(ref entry);
     return false;
 }
        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;
        }
 protected virtual bool OnCancelPressed(KeyEventArg arg)
 {
     if (cancelButton != null)
     {
         OnCancelButtonPress(cancelButton);
     }
     else
     {
         Finish();
     }
     return true;
 }
Esempio n. 26
0
 public static bool Equals(ref KeyEventArg a, ref KeyEventArg b)
 {
     return(a.key == b.key && a.playerIndex == b.playerIndex);
 }
 private bool OnKeyReleased(ref KeyEventArg e)
 {
     return false;
 }
 public bool OnKeyRepeated(KeyEventArg arg)
 {
     KeyCode code = arg.key;
     return FindCmd(code) != null;
 }
        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;
        }
        public bool OnKeyReleased(KeyEventArg arg)
        {
            if (m_frameSkipLookup.ContainsKey(arg.key))
            {
                m_frameSkip = 0;
                return true;
            }

            return false;
        }
 public bool OnKeyRepeated(KeyEventArg arg)
 {
     return false;
 }
 public KeyEntry(KeyEventArg arg, KeyState state)
 {
     this.arg = arg;
     this.state = state;
 }
 protected virtual void FireKeyReleased(int playerIndex, KeyCode key, int index)
 {
     KeyEventArg eventArg = new KeyEventArg(key, playerIndex);
     NotifyKeyReleased(ref eventArg);
     ClearKeyRepeat(ref eventArg, index);
 }