Exemplo n.º 1
0
 void M_Input_OnKeyUp(object sender, KeyArgs e)
 {
     if (e.Key == Microsoft.Xna.Framework.Input.Keys.Escape)
     {
         Pause();
     }
 }
Exemplo n.º 2
0
 public void HandleKey(KeyArgs key)
 {
     if (m_bEnabled && key.Key == Keys.Space)
     {
         m_bChecked = !m_bChecked;
     }
 }
Exemplo n.º 3
0
 public void HandleKey(KeyArgs key)
 {
     if (m_bEnabled && key.Key == Microsoft.Xna.Framework.Input.Keys.Space)
     {
         m_bChecked = !m_bChecked;
     }
 }
Exemplo n.º 4
0
 private void IC_OnKeyUp(object sender, KeyArgs e)
 {
     if (m_SignInDialog != null)
     {
         m_SignInDialog.HandleKeyUp(e);
     }
 }
Exemplo n.º 5
0
 public void HandleKey(KeyArgs key)
 {
     if (m_Input.Focused)
     {
         m_Input.HandleKey(key);
     }
 }
Exemplo n.º 6
0
 public bool OnKeyUp(KeyArgs e)
 {
     if (e.Key == Keys.Escape)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 7
0
 public bool OnKeyDown(KeyArgs key)
 {
     if (key.Key == Keys.Escape)
     {
         SoundManager.Inst.PlaySound(SoundManager.SEInst.MenuCancel);
         return(false);
     }
     return(true);
 }
Exemplo n.º 8
0
        public void HandleKeyUp(KeyArgs key)
        {
            UIInputField focused = null;

            if (m_Email.Focused)
            {
                focused = m_Email;
            }
            else if (m_Password.Focused)
            {
                focused = m_Password;
            }
            else if (m_Password2.Focused)
            {
                focused = m_Password2;
            }
            if (focused != null)
            {
                if (key.Key == Keys.Enter)
                {
                    if (focused != m_Password2)
                    {
                        NextFocus();
                    }
                    else
                    {
                        VirtualKeyboard.Hide();
                        if (OnSignIn != null)
                        {
                            OnSignIn(this, null);
                        }
                    }
                }
                else if (key.Key == Keys.Tab)
                {
                    NextFocus();
                    Happiness.Game.SoundManager.PlaySound(SoundManager.SEInst.MenuNavigate);
                }
                else
                {
                    focused.HandleKey(key);
                }
            }
        }
Exemplo n.º 9
0
 public void HandleKey(KeyArgs key)
 {
     if (key.Key == Keys.Back)
     {
         if (m_szInputText.Length > 0)
         {
             m_szInputText  = m_szInputText.Substring(0, m_szInputText.Length - 1);
             m_szMaskedText = m_szMaskedText.Substring(0, m_szInputText.Length);
         }
     }
     else
     {
         char c = KeyToAscii(key);
         if (c != 0)
         {
             m_szInputText  += c;
             m_szMaskedText += "*";
         }
     }
 }
Exemplo n.º 10
0
 void M_Input_OnKeyUp(object sender, KeyArgs e)
 {
     if (m_MessageBox != null)
     {
     }
     else if (m_CoinsDialog != null)
     {
         if (!m_CoinsDialog.OnKeyDown(e))
         {
             m_CoinsDialog = null;
         }
     }
     else if (m_EndScreen != null)
     {
     }
     else if (m_PauseMenu != null)
     {
         if (e.Key == Keys.Escape)
         {
             SoundManager.Inst.PlaySound(SoundManager.SEInst.MenuCancel);
             UnPause();
         }
     }
     else if (m_GamePanel.CellDialog != null)
     {
         if (!m_GamePanel.CellDialog.OnKeyUp(e))
         {
             m_GamePanel.CloseCellDialog();
             SoundManager.Inst.PlaySound(SoundManager.SEInst.MenuCancel);
         }
     }
     else
     {
         if (e.Key == Keys.Escape)
         {
             SoundManager.Inst.PlaySound(SoundManager.SEInst.MenuAccept);
             Pause();
         }
     }
 }
Exemplo n.º 11
0
 private void IC_OnKeyDown(object sender, KeyArgs e)
 {
     if (m_FloorSelect != null)
     {
         if (!m_FloorSelect.OnKeyDown(e))
         {
             m_FloorSelect = null;
         }
     }
     else if (m_CoinsDialog != null)
     {
         if (!m_CoinsDialog.OnKeyDown(e))
         {
             m_CoinsDialog = null;
         }
     }
     else
     {
         if (e.Key == Keys.Escape)
         {
             DoExit();
         }
     }
 }
Exemplo n.º 12
0
 protected void Invoke_OnKeyRepeat(object sender, KeyArgs args)
 {
     OnKeyRepeat?.Invoke(sender, args);
 }
Exemplo n.º 13
0
        public void HandleKeyUp(KeyArgs key)
        {
            UIInputField focused = null;

            if (m_Email.Focused)
            {
                focused = m_Email;
            }
            else if (m_Password.Focused)
            {
                focused = m_Password;
            }
            else if (m_Password2.Focused)
            {
                focused = m_Password2;
            }
            if (focused != null)
            {
                if (key.Key == Keys.Enter)
                {
                    if (OnSignIn != null)
                    {
                        OnSignIn(this, null);
                    }
                }
                else if (key.Key == Keys.Tab)
                {
                    if (m_Email.Focused)
                    {
                        m_Email.Focused     = false;
                        m_Password.Focused  = true;
                        m_Password2.Focused = false;
                    }
                    else if (m_Password.Focused)
                    {
                        if (m_bEmailCreate)
                        {
                            m_Email.Focused     = false;
                            m_Password.Focused  = false;
                            m_Password2.Focused = true;
                        }
                        else
                        {
                            m_Email.Focused     = true;
                            m_Password.Focused  = false;
                            m_Password2.Focused = false;
                        }
                    }
                    else if (m_Password2.Focused)
                    {
                        m_Email.Focused     = true;
                        m_Password.Focused  = false;
                        m_Password2.Focused = false;
                    }
                    Happiness.Game.SoundManager.PlaySound(SoundManager.SEInst.MenuNavigate);
                }
                else
                {
                    focused.HandleKey(key);
                }
            }
        }
Exemplo n.º 14
0
 protected void Invoke_OnKeyUp(object sender, KeyArgs args)
 {
     OnKeyUp?.Invoke(sender, args);
 }
Exemplo n.º 15
0
        char KeyToAscii(KeyArgs key)
        {
            int keyInt = (int)key.Key;

            if (keyInt >= '0' && keyInt <= '9')
            {
                if (key.Shift)
                {
                    return(Constants.Ascii0to9Shift[keyInt - '0']);
                }
                else
                {
                    return((char)keyInt);
                }
            }
            else if (keyInt >= 'A' && keyInt <= 'Z')
            {
                if (!key.Shift)
                {
                    keyInt -= 'A';
                    keyInt += 'a';
                    return((char)keyInt);
                }
                else
                {
                    return((char)keyInt);
                }
            }
            else if (key.Key == Keys.OemPeriod)
            {
                return((key.Shift) ? '>' : '.');
            }
            else if (key.Key == Keys.OemQuestion)
            {
                return((key.Shift) ? '?' : '/');
            }
            else if (key.Key == Keys.OemComma)
            {
                return((key.Shift) ? '<' : ',');
            }
            else if (key.Key == Keys.OemPipe)
            {
                return(key.Shift ? '|' : '\\');
            }
            else if (key.Key == Keys.OemCloseBrackets)
            {
                return(key.Shift ? '}' : ']');
            }
            else if (key.Key == Keys.OemOpenBrackets)
            {
                return(key.Shift ? '{' : '[');
            }
            else if (key.Key == Keys.OemPlus)
            {
                return(key.Shift ? '+' : '=');
            }
            else if (key.Key == Keys.OemMinus)
            {
                return(key.Shift ? '_' : '-');
            }
            else if (key.Key == Keys.OemMinus)
            {
                return(key.Shift ? '~' : '`');
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("KeyToAscii: " + key.Key.ToString());
            }

            return((char)0);
        }
Exemplo n.º 16
0
 public void HandleKeyUp(KeyArgs key)
 {
     UIInputField focused = null;
     if( m_Email.Focused  )
         focused = m_Email;
     else if( m_Password.Focused )
         focused = m_Password;
     if (focused != null)
     {
         if (key.Key == Keys.Enter)
         {
             if( OnSignIn != null )
                 OnSignIn(this, null);
         }
         else if (key.Key == Keys.Tab)
         {
             if (m_Email.Focused)
             {
                 m_Email.Focused = false;
                 m_Password.Focused = true;
             }
         }
         else
         {
             focused.HandleKey(key);
         }
     }
 }
Exemplo n.º 17
0
 public void HandleKey(KeyArgs key)
 {
     if( m_bEnabled && key.Key == Microsoft.Xna.Framework.Input.Keys.Space )
         m_bChecked = !m_bChecked;
 }
Exemplo n.º 18
0
 public abstract void ProcessExternalKey(KeyArgs key, InputType type);
Exemplo n.º 19
0
        char KeyToAscii(KeyArgs key)
        {
            int keyInt = (int)key.Key;

            if (key.Key >= Keys.Num0 && key.Key <= Keys.Num9)
            {
                keyInt -= (int)Keys.Num0;
                if (key.Shift)
                {
                    return(Constants.Ascii0to9Shift[keyInt]);
                }
                else
                {
                    keyInt += '0';
                    return((char)keyInt);
                }
            }
            else if (key.Key >= Keys.A && key.Key <= Keys.Z)
            {
                keyInt -= (int)Keys.A;
                keyInt += key.Shift ? 'A' : 'a';
                return((char)keyInt);
            }
            else if (key.Key == Keys.OemPeriod)
            {
                return((key.Shift) ? '>' : '.');
            }
            else if (key.Key == Keys.OemQuestion)
            {
                return((key.Shift) ? '?' : '/');
            }
            else if (key.Key == Keys.OemComma)
            {
                return((key.Shift) ? '<' : ',');
            }
            else if (key.Key == Keys.OemPipe)
            {
                return(key.Shift ? '|' : '\\');
            }
            else if (key.Key == Keys.OemCloseBrackets)
            {
                return(key.Shift ? '}' : ']');
            }
            else if (key.Key == Keys.OemOpenBrackets)
            {
                return(key.Shift ? '{' : '[');
            }
            else if (key.Key == Keys.OemPlus)
            {
                return(key.Shift ? '+' : '=');
            }
            else if (key.Key == Keys.OemMinus)
            {
                return(key.Shift ? '_' : '-');
            }
            else if (key.Key == Keys.OemTilde)
            {
                return(key.Shift ? '~' : '`');
            }
            else if (key.Key == Keys.Slash)
            {
                return(key.Shift ? '?' : '/');
            }
            else if (key.Key == Keys.Backslash)
            {
                return('\\');
            }
            else if (key.Key == Keys.Equals)
            {
                return(key.Shift ? '+' : '=');
            }
            else if (key.Key == Keys.Apostrophe)
            {
                return(key.Shift ? '\"' : '\'');
            }
            else if (key.Key == Keys.Semicolon)
            {
                return(key.Shift ? ':' : ';');
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("KeyToAscii: " + key.Key.ToString());
            }

            return((char)0);
        }
Exemplo n.º 20
0
 public void HandleKey(KeyArgs key)
 {
     if( m_Input.Focused )
         m_Input.HandleKey(key);
 }