Exemple #1
0
 string CheckRichStyleTags(string str)
 {
     if (!m_AllowRichStyleTag)
     {
         return(EmojiText.RemoveRichTextStyleTags(str));
     }
     return(str);
 }
Exemple #2
0
        public void DeactivateInputField()
        {
            // Not activated do nothing.
            if (!m_AllowInput)
            {
                return;
            }

            m_AllowInput = false;


            if (m_TextComponent != null && IsInteractable())
            {
                if (m_WasCanceled)
                {
                    text = m_OriginalText;
                }
                else
                {
                    string keyboardText = string.Empty;
                    if (m_Keyboard != null)
                    {
                        keyboardText = m_Keyboard.text;
                    }
                    else
                    {
                        keyboardText = m_FakeKeyboard.text;
                    }

                    keyboardText = ClampText(keyboardText);
                    keyboardText = CheckRichStyleTags(keyboardText);

                    if (excludeEmojiCharacters)
                    {
                        var sb = new System.Text.StringBuilder();
                        EmojiText.UpdateEmojiReplacements(
                            keyboardText, m_Config,
                            (emojiChar, emojiIndex) =>
                        {
                            if (emojiIndex != -1)
                            {
                                sb.Append(m_EmojiReplaceChar);
                            }
                            else
                            {
                                sb.Append(emojiChar);
                            }
                        });
                        text = sb.ToString();
                    }
                    else
                    {
                        text = keyboardText;
                    }
                }

                if (m_Keyboard != null)
                {
                    m_Keyboard.active = false;
                    m_Keyboard        = null;
                }
                else
                {
                    Debug.Assert(m_FakeKeyboard != null);
                    m_FakeKeyboard.Destroy();
                    m_FakeKeyboard = null;
                }

                SendOnSubmit();

                Input.imeCompositionMode = IMECompositionMode.Auto;
            }

            if (m_Placeholder != null)
            {
                m_Placeholder.enabled = string.IsNullOrEmpty(m_Text);
            }
        }