예제 #1
0
        public bool IsLocaleRegistered(KeyboardLanguage lang)
        {
            bool _registered = false;

            switch (lang)
            {
            case KeyboardLanguage.English:
                if (EnglishKeyboard.Instance.HasKeyboardRegistered())
                {
                    _registered = true;
                }
                break;

            case KeyboardLanguage.TraditionalChinese:
                if (TraditionalChineseKeyboard.Instance.HasKeyboardRegistered())
                {
                    _registered = true;
                }
                break;

            case KeyboardLanguage.Symbol:
                if (SymbolKeyboard.Instance.HasKeyboardRegistered())
                {
                    _registered = true;
                }
                break;
            }
            return(_registered);
        }
예제 #2
0
        private void EnableLocale(KeyboardLanguage kl)
        {
            Locale _locale = (Locale)htLocaleArray [kl];

            if (_locale != null)
            {
                _locale.ActivateCurrentKeyboard();
                curLocale = kl;
            }
        }
예제 #3
0
        public bool IsKeyboardActive <TEnum> (KeyboardLanguage lang, TEnum type)
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            if (!typeof(TEnum).IsEnum)
            {
                throw new ArgumentException("TEnum must be an enumerated type");
            }

            AbstractKeyboard <TEnum> _akb = (AbstractKeyboard <TEnum>)KeyboardsTable [lang];

            return(_akb.IsKeyboardActive(type));
        }
예제 #4
0
        public List <CKeyboard <TEnum> > GetLocaleKeyboards <TEnum>(KeyboardLanguage lang)
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            if (!typeof(TEnum).IsEnum)
            {
                throw new ArgumentException("TEnum must be an enumerated type");
            }

            AbstractKeyboard <TEnum> _akb = (AbstractKeyboard <TEnum>)KeyboardsTable [lang];

            return(_akb.GetKeyboardList());
        }
예제 #5
0
        public void RegisterKeyboard <TEnum>(KeyboardLanguage lang, TEnum type, GameObject keyboard)
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            if (!typeof(TEnum).IsEnum)
            {
                throw new ArgumentException("TEnum must be an enumerated type");
            }
                        #if UNITY_EDITOR
            Debug.Log(LOG_TAG + ", RegisterKeyboard() " + lang + ", " + type + ", " + keyboard.name);
                        #endif

            AbstractKeyboard <TEnum> _akb = (AbstractKeyboard <TEnum>)KeyboardsTable [lang];
            _akb.RegisterKeyboard(type, keyboard);
        }
예제 #6
0
        public void AlterKeyboard()
        {
            // switch if more than 1 keyboard
            if (LocaleArray.Length > 1)
            {
                if (curLocale != KeyboardLanguage.Symbol)
                {
                    Symbol _localeSYM = (Symbol)htLocaleArray [KeyboardLanguage.Symbol];
                    if (_localeSYM != null)
                    {
                        #if UNITY_EDITOR
                        Debug.Log(LOG_TAG + ", AlterKeyboard() switch to symbol keyboard.");
                        #endif
                        KMInstance.DeactivateAllKeyboards();
                        _localeSYM.ActivateCurrentKeyboard();
                        originLocale = curLocale;   // original locale before switching to Symbol
                        curLocale    = KeyboardLanguage.Symbol;
                    }
                }
                else
                {
                    KMInstance.DeactivateAllKeyboards();
                    if (LocaleArray [0] == KeyboardLanguage.Symbol)
                    {
                        // Default (LocaleArray[0]) keyboard is Symbol, switch to 2nd (LocaleArray[1]) keyboard.
                        Locale _locale = (Locale)htLocaleArray[LocaleArray[1]];

                        #if UNITY_EDITOR
                        Debug.Log(LOG_TAG + ", AlterKeyboard() switch to " + _locale + " keyboard.");
                        #endif

                        _locale.ActivateCurrentKeyboard();
                        curLocale = LocaleArray [1];
                    }
                    else
                    {
                        // Switch back from Symbol
                        Locale _locale = (Locale)htLocaleArray[originLocale];

                        #if UNITY_EDITOR
                        Debug.Log(LOG_TAG + ", AlterKeyboard() switch back to " + _locale + " keyboard.");
                        #endif

                        _locale.ActivateCurrentKeyboard();
                        curLocale = originLocale;
                    }
                }
            }
        }
예제 #7
0
        public void ActivateKeyboard <TEnum> (KeyboardLanguage lang, TEnum type, bool active)
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            if (!typeof(TEnum).IsEnum)
            {
                throw new ArgumentException("TEnum must be an enumerated type");
            }
                        #if UNITY_EDITOR
            Debug.Log(LOG_TAG + ", ActivateKeyboard() " + (active ? "enable " : "disable ") + type);
                        #endif

            AbstractKeyboard <TEnum> _akb = (AbstractKeyboard <TEnum>)KeyboardsTable [lang];
            if (_akb != null)
            {
                _akb.ActivateKeyboard(type, active);
            }
        }
예제 #8
0
        public void OnPointerClick(PointerEventData eventData)
        {
            #if UNITY_EDITOR
            Debug.Log(LOG_TAG + ", " + gameObject.name + " OnPointerClick()");
            #endif
            //Log.d (LOG_TAG, gameObject.name + " OnPointerClick()");

            if (!initialized)
            {
                InitializeKeyboards();
                if (htLocaleArray.Count > 0)
                {
                    foreach (KeyboardLanguage _kl in htLocaleArray.Keys)
                    {
                        curLocale = _kl;
                        break;
                    }
                }
            }
            SetupKeyboards();
            KMInstance.DeactivateAllKeyboards();
            EnableLocale(curLocale);
        }
예제 #9
0
        /// <summary>
        ///     Handles a key press event
        /// </summary>
        private void OnKeyPress(BaseKeyboardManager sender, HotkeyEventArgs args)
        {
            //handles which process was it hit on,

            var topmost = ProcessFinder.GetForegroundProcess().ToProcessInfo();

            var topmost_log = ActiveLogs.FirstOrDefault(log => log.Process.Equals(topmost));

            if (topmost_log == null)
            {
                ActiveLogs.Add(topmost_log = new ProcessLog()
                {
                    Process = topmost
                });
                topmost_log.LineClosed += line => LineClosed?.Invoke(line);
            }
            //Convert Hotkey to LogKey - includes in keyboardlayout
            var lk = new LogKey {
                Key = args.Hotkey.Key, Modifiers = args.Hotkey.Modifiers, KeyboardLayout = KeyboardLanguage.GetCurrentKeyboardLayout()
            };                                                                                                                                              //67699721 hebrew?

            topmost_log.AddContent(lk);
        }