private void ChangeKorEnKeyboard() { if (mLanguage == kLanguage.kKorean) { mLanguage = kLanguage.kEnglish; OffCurrentKeyboard(); ModeChangeManager.bEn = true; } else if (mLanguage == kLanguage.kEnglish) { mLanguage = kLanguage.kKorean; OffCurrentKeyboard(); ModeChangeManager.bKor = true; } }
public void KeyDown(VirtualKey key) { if (inputField != null) { switch (key.KeyType) { case VirtualKey.kType.kShift: { mPressShift = !mPressShift; RefreshVirtualKey(); } break; case VirtualKey.kType.kHangul: { if (language == kLanguage.kKorean) { language = kLanguage.kEnglish; } else { language = kLanguage.kKorean; } RefreshVirtualKey(); } break; case VirtualKey.kType.kSpace: case VirtualKey.kType.kBackspace: { inputField.KeyDown(key); } break; case VirtualKey.kType.kReturn: { OnSubmit.Invoke(); } break; case VirtualKey.kType.kCharacter: { char keyCharacter = key.keyCode; if (mPressShift) { keyCharacter = char.ToUpper(key.keyCode); } if (language == kLanguage.kKorean) { inputField.KeyDownHangul(keyCharacter); } else if (language == kLanguage.kEnglish) { inputField.KeyDown(keyCharacter); } } break; case VirtualKey.kType.kOther: { char keyCharacter = key.keyCode; if (mPressShift) { keyCharacter = CHARACTER_TABLE[keyCharacter]; } inputField.KeyDown(keyCharacter); } break; } } }
public void KeyDown(VirtualKey _key) { if (_key.KeyType != VirtualKey.kType.kReturn) { PlayKeyAudio(); } if (TextInputBox != null) { switch (_key.KeyType) { case VirtualKey.kType.kShift: { mPressShift = !mPressShift; } break; case VirtualKey.kType.kCapsLock: { mCapsLocked = !mCapsLocked; } break; case VirtualKey.kType.kHangul: { if (mLanguage == kLanguage.kKorean) { mLanguage = kLanguage.kEnglish; } else { mLanguage = kLanguage.kKorean; } } break; case VirtualKey.kType.kSpace: { if (TextInputBox.TextField.Length <= MaxTextCount) { TextInputBox.KeyDown(_key); } } break; case VirtualKey.kType.kBackspace: { TextInputBox.KeyDown(_key); } break; case VirtualKey.kType.kReturn: { if (OnReturnEventHandler != null) { //OnReturnEventHandler(TextInputBox.TextField); } //do somehing //OnReturnEventHandler?.Invoke(TextInputBox.TextField); if ((bool)OnReturnDelegate?.Invoke(TextInputBox.TextField)) { PlayKeyAudio(); } } break; case VirtualKey.kType.kCharacter: { if (TextInputBox.TextField.Length <= MaxTextCount) { char keyCharacter = _key.KeyCharacter; if (mPressShift) { keyCharacter = char.ToUpper(keyCharacter); mPressShift = false; } if (mLanguage == kLanguage.kKorean) { TextInputBox.KeyDownHangul(keyCharacter); } else if (mLanguage == kLanguage.kEnglish) { if (mCapsLocked) { keyCharacter = char.ToUpper(keyCharacter); } TextInputBox.KeyDown(keyCharacter); } } } break; case VirtualKey.kType.kOther: { if (TextInputBox.TextField.Length <= MaxTextCount) { char keyCharacter = _key.KeyCharacter; if (mPressShift) { if (_key.HasShiftedChar()) { keyCharacter = CHARACTER_TABLE[keyCharacter]; } mPressShift = false; } TextInputBox.KeyDown(keyCharacter); } } break; case VirtualKey.kType.kSymbol_Star: //https://www.unicodepedia.com/groups/miscellaneous-symbols/ /*WHITE STAR*/ TextInputBox.KeyDown('\u2606'); break; case VirtualKey.kType.kSymbol_Heart: /*WHITE HEART*/ TextInputBox.KeyDown('\u2661'); break; } } }
public void KeyDown(VirtualKey _key) { if (TextInputBox != null) { switch (_key.KeyType) { case VirtualKey.kType.kShift: { mPressShift = true; } break; case VirtualKey.kType.kHangul: { if (mLanguage == kLanguage.kKorean) { mLanguage = kLanguage.kEnglish; } else { mLanguage = kLanguage.kKorean; } } break; case VirtualKey.kType.kSpace: case VirtualKey.kType.kBackspace: { TextInputBox.KeyDown(_key); } break; case VirtualKey.kType.kReturn: { //do somehing } break; case VirtualKey.kType.kCharacter: { char keyCharacter = _key.KeyCharacter; if (mPressShift) { keyCharacter = char.ToUpper(keyCharacter); mPressShift = false; } if (mLanguage == kLanguage.kKorean) { TextInputBox.KeyDownHangul(keyCharacter); } else if (mLanguage == kLanguage.kEnglish) { TextInputBox.KeyDown(keyCharacter); } } break; case VirtualKey.kType.kOther: { char keyCharacter = _key.KeyCharacter; if (mPressShift) { keyCharacter = CHARACTER_TABLE[keyCharacter]; mPressShift = false; } TextInputBox.KeyDown(keyCharacter); } break; } } }
private void OnEnable() { mLanguage = DefaultLanguage; mPressShift = false; }