using LitJson; using System.Collections.Generic; using UnityEngine; namespace SC.XR.Unity.Module_Keyboard { public class SCKeyboard2DPrompt : SCKeyboardBasePrompt { public int PROMPT_PER_PAGE = 15; public RectTransform promptInput; public RectTransform open; public RectTransform close; public RectTransform maskRect; private List m_URLWords; public List URLWords { get { if (m_URLWords == null) { m_URLWords = new List(); m_URLWords.Add("https://"); m_URLWords.Add("http://"); m_URLWords.Add("www."); m_URLWords.Add(".cn"); } return m_URLWords; } } public bool isOpen { get { return close.gameObject.activeSelf; } set { open.gameObject.SetActive(!value); close.gameObject.SetActive(value); } } public override int GetChinese(string englishWords) { wordCount = ChineseIMEManager.Instance.GetWordCount(englishWords); return wordCount; } public override string GetChinese(int index) { return ChineseIMEManager.Instance.GetWord(index); } public override void SetEnteredText(string textStr) { maskRect.gameObject.SetActive(textStr == "" ? false : true); alreadyInput.alignment = TextAnchor.MiddleCenter; alreadyInput.text = textStr; if ((KeyboardUtils.CaculateTextLength(textStr, alreadyInput) * 0.1) > maskRect.sizeDelta.x) { alreadyInput.alignment = TextAnchor.MiddleRight; } } } }