12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- 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<string> m_URLWords;
- public List<string> URLWords
- {
- get
- {
- if (m_URLWords == null)
- {
- m_URLWords = new List<string>();
- 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; }
- }
- }
- }
|