private void Device_KeyPress(object sender, KeyPressEventArgs e)
        {
            #region GameState 1
            if (EngineCore.GameState == 1)
            {
                if (e.KeyChar == Convert.ToChar(Keys.Enter))
                {
                    WindowLogin.Login();
                }

                if (e.KeyChar == Convert.ToChar(Keys.Tab))
                {
                    if (WindowLogin.textbox[0].CursorEnabled == true)
                    {
                        if (WindowLogin.textbox[0].Enabled == false)
                        {
                            return;
                        }
                        WindowLogin.textbox[0].CursorEnabled = false;
                        WindowLogin.textbox[1].CursorEnabled = true;
                        WindowLogin.textbox[1].CursorState   = 0;
                    }
                    else
                    {
                        if (WindowLogin.textbox[1].Enabled == false)
                        {
                            return;
                        }
                        WindowLogin.textbox[0].CursorEnabled = true;
                        WindowLogin.textbox[1].CursorEnabled = false;
                        WindowLogin.textbox[0].CursorState   = 0;
                    }

                    return;
                }


                if (WindowLogin.textbox[0].CursorEnabled == true)
                {
                    if (WindowLogin.textbox[0].Enabled == false)
                    {
                        return;
                    }

                    //if (char.IsLetterOrDigit(e.KeyChar) || char.(e.KeyChar))

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (WindowLogin.textbox[0].Text.Length > 0)
                        {
                            WindowLogin.textbox[0].RemoveText();
                        }
                    }


                    if (char.IsLetterOrDigit(e.KeyChar))
                    {
                        if (WindowLogin.textbox[0].Text.Length <= 27)
                        {
                            //retorna se o ime estiver ativado

                            if (ImeModeOn)
                            {
                                return;
                            }
                            WindowLogin.textbox[0].AddText(e.KeyChar);
                        }
                    }
                }


                if (WindowLogin.textbox[1].CursorEnabled == true)
                {
                    if (WindowLogin.textbox[1].Enabled == false)
                    {
                        return;
                    }

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (WindowLogin.textbox[1].Text.Length > 0)
                        {
                            WindowLogin.textbox[1].RemoveText();
                        }
                    }

                    if (char.IsLetterOrDigit(e.KeyChar))
                    {
                        if (WindowLogin.textbox[1].Text.Length <= 27)
                        {
                            if (ImeModeOn)
                            {
                                return;
                            }
                            WindowLogin.textbox[1].AddText(e.KeyChar);
                        }
                    }
                }

                return;
            }
            #endregion

            #region GameState 3
            if (EngineCore.GameState == 3)
            {
                if (!EngineInputBox.Visible)
                {
                    return;
                }

                if (WindowPin.Visible)
                {
                    if (e.KeyChar == Convert.ToChar(Keys.Tab))
                    {
                        WindowPin.SelectTextbox();
                    }
                }

                if (EngineInputBox.TextBox.CursorEnabled == true)
                {
                    if (EngineInputBox.TextBox.Enabled == false)
                    {
                        return;
                    }

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (EngineInputBox.TextBox.Text.Length > 0)
                        {
                            EngineInputBox.TextBox.RemoveText();
                        }
                    }

                    if (ImeModeOn)
                    {
                        return;
                    }
                    if (char.IsDigit(e.KeyChar) || char.IsLetter(e.KeyChar))
                    {
                        if (EngineInputBox.TextBox.Text.Length <= 12)
                        {
                            EngineInputBox.TextBox.AddText(e.KeyChar);
                        }
                    }
                }

                return;
            }
            #endregion

            #region GameState 4
            if (EngineCore.GameState == 4)
            {
                if (WindowNewCharacter.textbox.CursorEnabled == true)
                {
                    if (WindowNewCharacter.textbox.Enabled == false)
                    {
                        return;
                    }

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (WindowNewCharacter.textbox.Text.Length > 0)
                        {
                            WindowNewCharacter.textbox.RemoveText();
                        }
                    }

                    if (ImeModeOn)
                    {
                        return;
                    }
                    if (char.IsDigit(e.KeyChar) || char.IsLetter(e.KeyChar))
                    {
                        if (WindowNewCharacter.textbox.Text.Length <= 12)
                        {
                            WindowNewCharacter.textbox.AddText(e.KeyChar);
                        }
                    }
                }

                return;
            }
            #endregion

            #region GameState 6
            if (EngineCore.GameState == 6)
            {
                if (WindowCash.BuyItemVisible)
                {
                    if (WindowCash.textbox.CursorEnabled == true)
                    {
                        if (Convert.ToInt32(e.KeyChar) == 8)
                        {
                            if (WindowCash.textbox.Text.Length > 0)
                            {
                                WindowCash.textbox.RemoveText();
                            }
                            return;
                        }

                        if (ImeModeOn)
                        {
                            return;
                        }
                        if (WindowCash.textbox.Text.Length <= 20)
                        {
                            WindowCash.textbox.AddText(e.KeyChar);
                        }
                    }

                    return;
                }

                if (e.KeyChar == 13)
                {
                    if (WindowChat.textbox.CursorEnabled)
                    {
                        //envia o texto
                        if (WindowChat.textbox.Text.Length > 0)
                        {
                            WindowChat.SendChat();
                        }

                        //limpa o texto e fecha
                        WindowChat.textbox.Clear();
                        WindowChat.textbox.CursorEnabled = false;
                        WindowChat.Transparency          = 120;
                    }
                    else
                    {
                        WindowChat.textbox.Clear();
                        WindowChat.textbox.CursorEnabled = true;
                        WindowChat.Transparency          = 255;
                    }
                }

                if (WindowChat.textbox.CursorEnabled == true)
                {
                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (WindowChat.textbox.Text.Length > 0)
                        {
                            WindowChat.textbox.RemoveText();
                        }
                        return;
                    }

                    if (ImeModeOn)
                    {
                        return;
                    }
                    if (WindowChat.textbox.Text.Length <= 30)
                    {
                        WindowChat.textbox.AddText(e.KeyChar);
                    }
                }
            }
            #endregion
        }
        private void CreateDevice_KeyPress(object sender, KeyPressEventArgs e)
        {
            #region GameState 1
            if (EngineCore.GameState == 1)
            {
                if (e.KeyChar == Convert.ToChar(Keys.Enter))
                {
                    WindowLogin.Login();
                }

                if (e.KeyChar == Convert.ToChar(Keys.Tab))
                {
                    if (WindowLogin.textbox[0].CursorEnabled == true)
                    {
                        if (WindowLogin.textbox[0].Enabled == false)
                        {
                            return;
                        }
                        WindowLogin.textbox[0].CursorEnabled = false;
                        WindowLogin.textbox[1].CursorEnabled = true;
                        WindowLogin.textbox[1].CursorState   = 0;
                    }
                    else
                    {
                        if (WindowLogin.textbox[1].Enabled == false)
                        {
                            return;
                        }
                        WindowLogin.textbox[0].CursorEnabled = true;
                        WindowLogin.textbox[1].CursorEnabled = false;
                        WindowLogin.textbox[0].CursorState   = 0;
                    }

                    return;
                }


                if (ImeModeOn)
                {
                    return;
                }


                if (WindowLogin.textbox[0].CursorEnabled == true)
                {
                    if (WindowLogin.textbox[0].Enabled == false)
                    {
                        return;
                    }

                    //if (char.IsLetterOrDigit(e.KeyChar) || char.(e.KeyChar))

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (WindowLogin.textbox[0].Text.Length > 0)
                        {
                            WindowLogin.textbox[0].RemoveText();
                        }
                    }

                    if (char.IsLetterOrDigit(e.KeyChar))
                    {
                        if (WindowLogin.textbox[0].Text.Length <= 27)
                        {
                            //retorna se o ime estiver ativado
                            WindowLogin.textbox[0].AddText(e.KeyChar);
                        }
                    }
                }


                if (WindowLogin.textbox[1].CursorEnabled == true)
                {
                    if (WindowLogin.textbox[1].Enabled == false)
                    {
                        return;
                    }

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (WindowLogin.textbox[1].Text.Length > 0)
                        {
                            WindowLogin.textbox[1].RemoveText();
                        }
                    }

                    if (char.IsLetterOrDigit(e.KeyChar))
                    {
                        if (WindowLogin.textbox[1].Text.Length <= 27)
                        {
                            WindowLogin.textbox[1].AddText(e.KeyChar);
                        }
                    }
                }

                return;
            }
            #endregion

            #region GameState 3
            if (EngineCore.GameState == 3)
            {
                if (!EngineInputBox.Visible)
                {
                    return;
                }

                if (EngineInputBox.TextBox.CursorEnabled == true)
                {
                    if (EngineInputBox.TextBox.Enabled == false)
                    {
                        return;
                    }

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (EngineInputBox.TextBox.Text.Length > 0)
                        {
                            EngineInputBox.TextBox.RemoveText();
                        }
                    }

                    if (ImeModeOn)
                    {
                        return;
                    }
                    if (char.IsDigit(e.KeyChar) || char.IsLetter(e.KeyChar))
                    {
                        if (EngineInputBox.TextBox.Text.Length <= 12)
                        {
                            EngineInputBox.TextBox.AddText(e.KeyChar);
                        }
                    }
                }

                return;
            }
            #endregion

            #region GameState 4
            if (EngineCore.GameState == 4)
            {
                if (WindowNewCharacter.textbox.CursorEnabled == true)
                {
                    if (WindowNewCharacter.textbox.Enabled == false)
                    {
                        return;
                    }

                    if (Convert.ToInt32(e.KeyChar) == 8)
                    {
                        if (WindowNewCharacter.textbox.Text.Length > 0)
                        {
                            WindowNewCharacter.textbox.RemoveText();
                        }
                    }

                    if (ImeModeOn)
                    {
                        return;
                    }
                    if (char.IsDigit(e.KeyChar) || char.IsLetter(e.KeyChar))
                    {
                        if (WindowNewCharacter.textbox.Text.Length <= 12)
                        {
                            WindowNewCharacter.textbox.AddText(e.KeyChar);
                        }
                    }
                }

                return;
            }
            #endregion
        }