public void OpenKeyboard(string text, bool autocorrection, bool multiline, bool secure, bool alert, string textPlaceholder)
        {
            if (_keyboard != null)
                return;

            _keyboard = TouchScreenKeyboard.Open(text, (TouchScreenKeyboardType)keyboardType, autocorrection, multiline, secure, alert, textPlaceholder);
        }
 public void CloseKeyboard()
 {
     if (_keyboard != null)
     {
         _keyboard.active = false;
         _keyboard = null;
     }
 }
        public string GetInput()
        {
            if (_keyboard != null)
            {
                string s = _keyboard.text;

                if (_keyboard.done)
                    _keyboard = null;

                return s;
            }
            else
                return null;
        }
    /// <summary>
    /// Actually do the Area Description save.
    /// </summary>
    /// <returns>Coroutine IEnumerator.</returns>
    private IEnumerator _DoSaveCurrentAreaDescription()
    {
#if UNITY_EDITOR
        // Work around lack of on-screen keyboard in editor:
        if (m_displayGuiTextInput || m_saveThread != null)
        {
            yield break;
        }

        m_displayGuiTextInput  = true;
        m_guiTextInputContents = "Unnamed";
        while (m_displayGuiTextInput)
        {
            yield return(null);
        }
#else
        if (TouchScreenKeyboard.visible || m_saveThread != null)
        {
            yield break;
        }

        TouchScreenKeyboard kb = TouchScreenKeyboard.Open("Unnamed");
        while (!kb.done && !kb.wasCanceled)
        {
            yield return(null);
        }
#endif

        // Save the text in a background thread.
        m_savingTextParent.gameObject.SetActive(true);
        m_saveThread = new Thread(delegate()
        {
            // Save the name put in with the Area Description.
            AreaDescription areaDescription   = AreaDescription.SaveCurrent();
            AreaDescription.Metadata metadata = areaDescription.GetMetadata();
#if UNITY_EDITOR
            metadata.m_name = m_guiTextInputContents;
#else
            metadata.m_name = kb.text;
#endif
            areaDescription.SaveMetadata(metadata);
        });
        m_saveThread.Start();
    }
Пример #5
0
    /// <summary>
    /// Notification of the input field losing selection.
    /// </summary>

    protected void OnDeselectEvent()
    {
        if (mDoInit)
        {
            Init();
        }

        if (label != null && NGUITools.GetActive(this))
        {
            mValue = value;

            if (current == null)
            {
                current = this;
                EventDelegate.Execute(onDeSelected);
                current = null;
            }

#if MOBILE
            if (mKeyboard != null)
            {
                mWaitForKeyboard = false;
                mKeyboard.active = false;
                mKeyboard        = null;
            }
#endif
            if (string.IsNullOrEmpty(mValue))
            {
                label.text  = mDefaultText;
                label.color = mDefaultColor;
            }
            else
            {
                label.text = mValue;
            }

            Input.imeCompositionMode = IMECompositionMode.Auto;
            RestoreLabelPivot();
        }

        selection = null;
        UpdateLabel();
    }
Пример #6
0
    void CreateKeyboard()
    {
        if (keyboard_ != null)
        {
            return;
        }
        if (!IsInteractable())
        {
            return;
        }

        if (!inputField.textComponent || inputField.textComponent.font == null)
        {
            return;
        }

        originalText_ = inputField.text;
        keyboard_     = TouchScreenKeyboard.Open(inputField.text, TouchScreenKeyboardType.Default, true);
    }
 private void Update()
 {
     if (keyboard != null)
     {
         keyboardText = keyboard.text;
         if (!TouchScreenKeyboard.visible)
         {
             TextTyped.Invoke(keyboardText);
             keyboard = null;
         }
         else
         {
             if (TextOutPut != null)
             {
                 TextOutPut.text = "Anweisung:" + Environment.NewLine + keyboardText;
             }
         }
     }
 }
Пример #8
0
    void endPosition()
    {
        _numberControl[_viewNumverControl].ViewNumberCount(_scoreList[_viewNumverControl]._playerScore, 0.3f);
        _viewNumverControl++;
#if UNITY_IPHONE || UNITY_ANDROID
        if (_viewNumverControl >= 8 && _selectLabe != null)
        {
            this.enabled = true;
            _pressButton.SetActive(true);
            _KeyBoard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, false);
            //TouchScreenKeyboard.hideInput = true;
        }
#else
        if (_viewNumverControl >= 8)
        {
            _pressButton.SetActive(true);
        }
#endif
    }
Пример #9
0
    /// <summary>
    /// Actually do the Area description export.
    ///
    /// This runs over multiple frames, so a Unity coroutine is used.
    /// </summary>
    /// <returns>Coroutine IEnumerator.</returns>
    /// <param name="areaDescription">Area Description to export.</param>
    private IEnumerator _DoExportAreaDescription(AreaDescription areaDescription)
    {
        if (TouchScreenKeyboard.visible)
        {
            yield break;
        }

        TouchScreenKeyboard kb = TouchScreenKeyboard.Open("/sdcard/", TouchScreenKeyboardType.Default, false);

        while (!kb.done && !kb.wasCanceled)
        {
            yield return(null);
        }

        if (kb.done)
        {
            areaDescription.ExportToFile(kb.text);
        }
    }
Пример #10
0
    private void Update()
    {
        if (TouchScreenKeyboard.visible == false && keyboard != null)
        {
            updateIpAddressText(keyboard.text);
            if (keyboard.status == TouchScreenKeyboard.Status.Done)
            {
                if (keyboard.text != "")
                {
                    storageData.ipAddress = keyboard.text;
                    updateIpAddressText(storageData.ipAddress);
                }

                keyboard = null;
                updateStoredData();
                CheckUpdateModelOnStart();
            }
        }
    }
Пример #11
0
 public void EnableChat()
 {
     if (android)
     {
         print("Adnroid Chat");
         var t = TouchScreenKeyboard.Open("");
         StartCoroutine(AddMethod(() => t.done || t.wasCanceled, delegate
         {
             if (t.done && t.text.Length > 0)
             {
                 CallRPC(Chat, _Player.pv.playerName + ": " + t.text);
             }
         }));
     }
     else
     {
         enabled = true;
     }
 }
Пример #12
0
        /// <summary>Handles if the mobile keyboard should get displayed/hidden.</summary>
        /// <param name="mode">The state that defines how the keyboard should open.</param>
        public static bool HandleKeyboard(KeyboardMode mode)
        {
            if (MobileKeyboard != null)
            {
                MobileKeyboard.active = false;
                MobileKeyboard        = null;
            }

            if (mode == null)
            {
                return(false);
            }
            else
            {
                MobileKeyboard = TouchScreenKeyboard.Open(mode.StartText, mode.Type, Autocorrect, mode.Multiline, mode.Secret);
                KeyboardText   = null;
                return(true);
            }
        }
Пример #13
0
        void IKeyboardInput.OnGotFocus()
        {
            this.State = TextBoxState.Active;
            _blink     = Transition.New(_opts.CaretBlinkRate, 0f, 1f,
                                        (from, to, value) => value,
                                        (value) => _caret.SetActive(value < 0.5f && this.Visual.gameObject.active)).Uses(this).Repeat();
#if PLATFORM_IOS
            if (_keyboard != null)
            {
                _keyboard.active = true;
                this.CaretIndex  = this.Text.Length;
            }
            else
            {
                TouchScreenKeyboard.hideInput = true;
                _keyboard = TouchScreenKeyboard.Open(this.Text, TouchScreenKeyboardType.ASCIICapable);
            }
#endif
        }
Пример #14
0
    /// <summary>
    /// Notification of the input field gaining selection.
    /// </summary>

    protected void OnSelectEvent()
    {
        selection = this;

        if (mDoInit)
        {
            Init();
        }

        if (label != null && NGUITools.GetActive(this))
        {
            label.color = activeTextColor;
#if MOBILE
            if (Application.platform == RuntimePlatform.IPhonePlayer ||
                Application.platform == RuntimePlatform.Android
#if UNITY_WP8
                || Application.platform == RuntimePlatform.WP8Player
#endif
#if UNITY_BLACKBERRY
                || Application.platform == RuntimePlatform.BB10Player
#endif
                )
            {
                mKeyboard = (inputType == InputType.Password) ?
                            TouchScreenKeyboard.Open(mValue, TouchScreenKeyboardType.Default, false, false, true) :
                            TouchScreenKeyboard.Open(mValue, (TouchScreenKeyboardType)((int)keyboardType), inputType == InputType.AutoCorrect, label.multiLine, false, false, defaultText);
            }
            else
#endif
            {
                Input.imeCompositionMode   = IMECompositionMode.On;
                Input.compositionCursorPos = (UICamera.current != null && UICamera.current.cachedCamera != null) ?
                                             UICamera.current.cachedCamera.WorldToScreenPoint(label.worldCorners[0]) :
                                             label.worldCorners[0];
#if !MOBILE
                mSelectionStart = 0;
                mSelectionEnd   = string.IsNullOrEmpty(mValue) ? 0 : mValue.Length;
#endif
                mDrawStart = 0;
            }
            UpdateLabel();
        }
    }
Пример #15
0
    public void StopWork()
    {
        this.m_isStartWork = false;
        if (keyboard != null)
        {
            inEditMode      = false;
            keyboard.active = false;
            keyboard        = null;
            if (textComponent.text.ToCharArray().Length == 0)
            {
                textComponent.text = "Click And Edit Text";
            }
            fitCollider();
        }
#if UNITY_WEBPLAYER
        inEditMode = false;
        fitCollider();
#endif
    }
Пример #16
0
 // Token: 0x060000E9 RID: 233 RVA: 0x0000B43C File Offset: 0x0000963C
 public void setText(string text)
 {
     if (text == null)
     {
         return;
     }
     TField.lastKey         = -1984;
     this.keyInActiveState  = 0;
     this.indexOfActiveChar = 0;
     this.text        = text;
     this.paintedText = text;
     if (text == string.Empty)
     {
         TouchScreenKeyboard.Clear();
     }
     this.setPasswordTest();
     this.caretPos = text.Length;
     this.setOffset();
 }
Пример #17
0
    private void InputSelected()

    {
        if (text.Length == 0)

        {
            HideDisplayText();
        }

        isSelected = true;

        if (!useTouchScreenKeyboard && !listenForKeyboardText)

        {
            tk2dUIManager.Instance.OnInputUpdate += ListenForKeyboardTextUpdate;
        }

        listenForKeyboardText = true;

        SetState();

        SetCursorPosition();



#if TOUCH_SCREEN_KEYBOARD
        if (Application.platform != RuntimePlatform.WindowsEditor &&

            Application.platform != RuntimePlatform.OSXEditor)
        {
#if UNITY_ANDROID //due to a delete key bug in Unity Android
            TouchScreenKeyboard.hideInput = false;
#else
            TouchScreenKeyboard.hideInput = true;
#endif

            keyboard = TouchScreenKeyboard.Open(text, TouchScreenKeyboardType.Default, false, false, isPasswordField, false);

            StartCoroutine(TouchScreenKeyboardLoop());
        }
#endif
    }
Пример #18
0
    void DestroyKeyboard()
    {
        if (!inputField.textComponent || !inputField.IsInteractable())
        {
            return;
        }

        if (wasCanceled_)
        {
            inputField.text = originalText_;
            wasCanceled_    = false;
        }

        if (keyboard_ != null)
        {
            keyboard_.active = false;
            keyboard_        = null;
            originalText_    = "";
        }
    }
Пример #19
0
    void Update()
    {
        if (TouchScreenKeyboard.visible == false && touchScreenKeyboard != null)
        {
            // Debug.Log(touchScreenKeyboard.status.GetType());
            if (touchScreenKeyboard.done)
            {
                ;
            }
            {
                nameDisplay.text    = touchScreenKeyboard.text.Trim();
                touchScreenKeyboard = null;
            }
        }

        if (Input.GetKeyDown(KeyCode.Return) && saveNameButton.activeSelf)
        {
            SaveName();
        }
    }
Пример #20
0
    private void Update()
    {
        _pwField.interactable = _pwCheckToggle.isOn;

        if (_nameField.isFocused)
        {
            if (TouchScreenKeyboard.isSupported && !TouchScreenKeyboard.visible)
            {
                TouchScreenKeyboard.Open("", TouchScreenKeyboardType.ASCIICapable);
            }
        }

        if (_pwField.isFocused)
        {
            if (TouchScreenKeyboard.isSupported && !TouchScreenKeyboard.visible)
            {
                TouchScreenKeyboard.Open("", TouchScreenKeyboardType.ASCIICapable);
            }
        }
    }
Пример #21
0
    void Update()
    {
        if (TouchScreenKeyboard.visible == false && touchScreenKeyboard != null)
        {
            // Debug.Log(touchScreenKeyboard.status.GetType());
            if (touchScreenKeyboard.done)
            {
                ;
            }
            {
                User.name           = touchScreenKeyboard.text.Trim();
                touchScreenKeyboard = null;
            }
        }

        if (Input.GetKeyDown(KeyCode.Return) && nameInputField.gameObject.activeSelf)
        {
            SubmitNameButton();
        }
    }
Пример #22
0
        private void Update()
        {
#if WINDOWS_UWP
            // Windows mixed reality keyboard update goes here
            KeyboardText = wmrKeyboard.Text;
            if (wmrKeyboard.Visible)
            {
                debugMessage.text = KeyboardText;
            }
            else
            {
                if (KeyboardText == null || KeyboardText.Length == 0)
                {
                    debugMessage.text = "open keyboard to determine reciever adress";
                }
                else
                {
                    debugMessage.text = KeyboardText;
                }
            }
#elif UNITY_IOS || UNITY_ANDROID
            // non-Windows mixed reality keyboard initialization goes here
            // for non-Windows mixed reality keyboards just use Unity's default
            // touchscreenkeyboard.
            // We will use touchscreenkeyboard once Unity bug is fixed
            // Unity bug tracking the issue https://fogbugz.unity3d.com/default.asp?1137074_rttdnt8t1lccmtd3
            if (touchscreenKeyboard != null)
            {
                KeyboardText = touchscreenKeyboard.text;
                if (TouchScreenKeyboard.visible)
                {
                    debugMessage.text = KeyboardText;
                }
                else
                {
                    debugMessage.text   = KeyboardText;
                    touchscreenKeyboard = null;
                }
            }
#endif
        }
Пример #23
0
        private void Update()
        {
#if !UNITY_EDITOR && UNITY_WSA
            // Windows mixed reality keyboard update goes here
            keyboardText = wmrKeyboard.Text;
            if (wmrKeyboard.Visible)
            {
                debugMessage.text = "typing... " + keyboardText;
            }
            else
            {
                if (keyboardText == null || keyboardText.Length == 0)
                {
                    debugMessage.text = "open keyboard to type text";
                }
                else
                {
                    debugMessage.text = "typed " + keyboardText;
                }
            }
#elif UNITY_IOS || UNITY_ANDROID
            // non-Windows mixed reality keyboard initialization goes here
            // for non-Windows mixed reality keyboards just use Unity's default
            // touchscreenkeyboard.
            // We will use touchscreenkeyboard once Unity bug is fixed
            // Unity bug tracking the issue https://fogbugz.unity3d.com/default.asp?1137074_rttdnt8t1lccmtd3
            if (touchscreenKeyboard != null)
            {
                keyboardText = touchscreenKeyboard.text;
                if (TouchScreenKeyboard.visible)
                {
                    debugMessage.text = "typing... " + keyboardText;
                }
                else
                {
                    debugMessage.text   = "typed " + keyboardText;
                    touchscreenKeyboard = null;
                }
            }
#endif
        }
        public void HideKeyboard(bool throwDoneEvent, bool throwCanceledEvent)
        {
            if (_currentKeyboard == null)
            {
                return;
            }

            _currentKeyboard.active = false;

            _currentKeyboard = null;

            if (throwDoneEvent)
            {
                KeyboardDoneEvent();
            }

            if (throwCanceledEvent)
            {
                KeyboardCanceledEvent();
            }
        }
Пример #25
0
 // Update is called once per frame
 void Update()
 {
     if (Application.isEditor)
     {
     }
     else
     {
         if (keyboard != null)
         {
             if (keyboard.status == TouchScreenKeyboard.Status.Visible)
             {
                 text.text = keyboard.text;
             }
             if (keyboard.status == TouchScreenKeyboard.Status.Done)
             {
                 text.text = keyboard.text;
                 keyboard  = null;
             }
         }
     }
 }
    void kBoard0()
    {
        // keyboard = iPhoneKeyboard.Open( tempName : String, iPhoneKeyboardType.Default, Auto-Correct, Multi-Line, Secure, Alert, "Text Placeholder" );

        if (!iskBoardOpen)
        {
            keyboard     = TouchScreenKeyboard.Open(tempString, TouchScreenKeyboardType.PhonePad, false, false, false, false, "Default Keyboard");
            iskBoardOpen = true;
        }

        if (keyboard.done)
        {
            kBoardString = keyboard.text;
            tempString   = "";
            iskBoardOpen = false;
        }
        else
        {
            kBoardString = keyboard.text;
        }
    }
    private void InputDeselected()
    {
        if (text.Length == 0)
        {
            ShowDisplayText();
        }
        isSelected = false;
        if (listenForKeyboardText)
        {
            tk2dUIManager.Instance.OnInputUpdate -= ListenForKeyboardTextUpdate;
        }
        listenForKeyboardText = false;
        SetState();
#if TOUCH_SCREEN_KEYBOARD
        if (keyboard != null && !keyboard.done)
        {
            keyboard.active = false;
        }
        keyboard = null;
#endif
    }
Пример #28
0
        public override void ExecuteDefaultActionAtTarget(EventBase evt)
        {
            base.ExecuteDefaultActionAtTarget(evt);
            long num = EventBase <MouseDownEvent> .TypeId();

            bool flag = !base.textInputField.isReadOnly && evt.eventTypeId == num && base.editorEngine.keyboardOnScreen == null;

            if (flag)
            {
                base.textInputField.SyncTextEngine();
                base.textInputField.UpdateText(base.editorEngine.text);
                base.editorEngine.keyboardOnScreen = TouchScreenKeyboard.Open(base.textInputField.text, TouchScreenKeyboardType.Default, true, base.editorEngine.multiline, base.textInputField.isPasswordField);
                bool flag2 = base.editorEngine.keyboardOnScreen != null;
                if (flag2)
                {
                    this.PollTouchScreenKeyboard();
                }
                base.editorEngine.UpdateScrollOffset();
                evt.StopPropagation();
            }
        }
Пример #29
0
    // Update is called once per frame
    void Update()
    {
        do_entry();
        this.guiText.text = pm.ToPersian1("نام شما : " + kBoardString);


        if (kBoardString.Length >= 3 && kBoardString.Length <= 20)
        {
            login.SetActive(true);
        }
        else
        {
            login.SetActive(false);
        }

        if (Input.GetMouseButtonDown(0))
        {
            hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
            if (hit.collider != null)
            {
                if (hit.transform.tag == "name")
                {
                    iskBoardOpen = false;
                    keyboard     = TouchScreenKeyboard.Open(kBoardString, TouchScreenKeyboardType.NamePhonePad, false, false, false, false, ("نام خود را وارد کنید"));
                }
                else if (hit.transform.tag == "enterbtn")
                {
                    entry.username        = pm.ToPersian1(kBoardString);
                    entry.buffer_username = (kBoardString);

                    //entry.buffer_username =("جواد عرشیان");
                    //entry.username =pm.ToPersian1("جواد عرشیان");

                    PlayerPrefs.SetString("Player name", pm.ToPersian1(kBoardString));
                    PlayerPrefs.SetString("Player name buffer", (kBoardString));
                    Application.LoadLevel(1);
                }
            }
        }
    }
Пример #30
0
    /// <summary>
    /// Actually do the Area Description save.
    /// </summary>
    /// <returns>Coroutine IEnumerator.</returns>
    private IEnumerator _DoSaveCurrentAreaDescription()
    {
        if (TouchScreenKeyboard.visible || m_saveThread != null)
        {
            yield break;
        }

        TouchScreenKeyboard kb = TouchScreenKeyboard.Open("Unnamed");

        while (!kb.done && !kb.wasCanceled)
        {
            yield return(null);
        }

        if (kb.done)
        {
            // Disable interaction before saving.
            m_initialized = false;
            m_savingText.gameObject.SetActive(true);
            if (m_tangoApplication.m_areaDescriptionLearningMode)
            {
                m_saveThread = new Thread(delegate()
                {
                    // Start saving process in another thread.
                    m_curAreaDescription = AreaDescription.SaveCurrent();
                    AreaDescription.Metadata metadata = m_curAreaDescription.GetMetadata();
                    metadata.m_name = kb.text;
                    m_curAreaDescription.SaveMetadata(metadata);
                });
                m_saveThread.Start();
            }
            else
            {
                _SaveMarkerToDisk();
                #pragma warning disable 618
                Application.LoadLevel(Application.loadedLevel);
                #pragma warning restore 618
            }
        }
    }
Пример #31
0
    public static void Float(Property property)
    {
        float  fValue = (float)property.value;
        string sValue = fValue.ToString();

        GUILayout.BeginHorizontal();
        AlignedLabel(property);
        if (TouchScreenKeyboard.isSupported)
        {
            if (numberKeyboard != null && numberKeyboard.status != TouchScreenKeyboard.Status.Visible)
            {
                keyboardHandler(numberKeyboard.text);
                numberKeyboard  = null;
                keyboardHandler = null;
            }
            if (GUILayout.Button(sValue, GUI.skin.textField) && numberKeyboard == null)
            {
                numberKeyboard = TouchScreenKeyboard.Open(sValue,
                                                          TouchScreenKeyboardType.NumbersAndPunctuation);
                keyboardHandler = text =>
                {
                    try
                    {
                        property.value = float.Parse(text);
                    }
                    catch (FormatException) { }
                };
            }
        }
        else // TouchScreenKeyboard not supported
        {
            sValue = GUILayout.TextField(sValue);
            try
            {
                property.value = float.Parse(sValue);
            }
            catch (FormatException) { }
        }
        GUILayout.EndHorizontal();
    }
Пример #32
0
    private void OnTextEditEnd(string text)
    {
        bool hasText = !string.IsNullOrWhiteSpace(GeneralOpinion.text) ||
                       !string.IsNullOrWhiteSpace(Errors.text) ||
                       !string.IsNullOrWhiteSpace(Suggestions.text);

        keyboard = null;

        SendButton.interactable = hasText;

        //if (!string.IsNullOrWhiteSpace(text))
        //{
        //    TotalTextFields++;
        //}
        //else
        //{
        //    if (TotalTextFields > 0)
        //        TotalTextFields--;
        //}

        //SendButton.interactable = TotalTextFields > 0;
    }
    /// <summary>
    /// Actually do the Area Description import.
    ///
    /// This runs over multiple frames, so a Unity coroutine is used.
    /// </summary>
    /// <returns>Coroutine IEnumerator.</returns>
    private IEnumerator _DoImportAreaDescription()
    {
#if UNITY_ANDROID
        if (TouchScreenKeyboard.visible)
        {
            yield break;
        }

        TouchScreenKeyboard kb = TouchScreenKeyboard.Open("/sdcard/", TouchScreenKeyboardType.Default, false);
        while (!kb.done && !kb.wasCanceled)
        {
            yield return(null);
        }

        if (kb.done)
        {
            AreaDescription.ImportFromFile(kb.text);
        }
#else
        yield return(null);
#endif
    }