/// Modded by JCxYIS /// 20220328 using Pvr_UnitySDKAPI; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class TextHandler : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler { public ImeManager mManager; public SGImeInputType mInputType; public SGImeTextType mTextType; private bool isSelect; ImeDelegateImpl.TextComponent inputComponent = null; // Start is called before the first frame update void Start() { if (GetComponent()) inputComponent = (ImeDelegateImpl.TextComponent)GetComponent(); else if(GetComponent()) inputComponent = (ImeDelegateImpl.TextComponent)GetComponent(); } // Update is called once per frame void Update() { if (isSelect) { if (Input.GetKeyDown(KeyCode.JoystickButton0) || Input.GetMouseButtonDown(0) || Controller.UPvr_GetKeyClick(0, Pvr_KeyCode.TOUCHPAD) || Controller.UPvr_GetKeyClick(0, Pvr_KeyCode.TRIGGER) || Controller.UPvr_GetKeyClick(0, Pvr_KeyCode.X) || Controller.UPvr_GetKeyClick(1, Pvr_KeyCode.TOUCHPAD) || Controller.UPvr_GetKeyClick(1, Pvr_KeyCode.TRIGGER) || Controller.UPvr_GetKeyClick(1, Pvr_KeyCode.A)) { mManager.Show(mInputType, mTextType); if(inputComponent == null) Debug.LogError("[TextHandler] 此物件沒有可輸入的文字組件"); else FindObjectOfType().mText = inputComponent; // inputComponent.text = "Test48763"; } } } public void OnPointerEnter(PointerEventData eventData) { // Debug.Log("TextHandler OnPointerEnter"); isSelect = true; } public void OnPointerExit(PointerEventData eventData) { // Debug.Log("TextHandler OnPointerExit"); isSelect = false; } }