void InpuFiledPressCheck() { if (KeyBoardIsVisible && string.IsNullOrEmpty(inputF.text)) { return; } Touch[] touches = Input.touches; Touch touch; if (touches.Length != 0) { touch = touches[0]; } else { return; } if (touch.phase == TouchPhase.Began) { Vector2 position = touch.position; if (RectTransformUtility.RectangleContainsScreenPoint(inputFieldRect, position)) { MobileDebug.Log("inputFtext :" + inputF.text, "InputField", LogType.Log, 1); TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default); } } }
private static void Init() { if (instance == null) { GameObject obj = Instantiate(new GameObject()); obj.AddComponent <MobileDebug>(); instance = obj.GetComponent <MobileDebug>(); obj.name = "MobileDebug"; Application.logMessageReceived += HandleLog; } }
// Update is called once per frame void Update() { chatClient.Service(); TouchScreenKeyboard.hideInput = true; /* InpuFiledPressCheck();*/ /*temp = inputF.text;*/ // MobileDebug.Log("TouchScreenKeyboard "+ keyboard + " status " + keyboard?.status + " ratio " +MobileUtilities.GetKeyboardHeightRatio(true), "Chat",LogType.Log,1); MobileDebug.Log("TouchScreenKeyboard.visible " + TouchScreenKeyboard.visible, "Chat", LogType.Log, 1); MobileDebug.Log("KeyBoardIsVisible" + KeyBoardIsVisible, "Chat", LogType.Log, 2); /* MobileDebug.Log("TouchScreenKeyboard.hideInput " + TouchScreenKeyboard.hideInput, "Chat", LogType.Log, 2); * MobileDebug.Log("TouchScreenKeyboard.isInPlaceEditingAllowed " + TouchScreenKeyboard.isInPlaceEditingAllowed, "Chat", LogType.Log, 3); * MobileDebug.Log("TouchScreenKeyboard.area " + TouchScreenKeyboard.area, "Chat", LogType.Log, 4); * MobileDebug.Log("TouchScreenKeyboard.isSupported " + TouchScreenKeyboard.isSupported, "Chat", LogType.Log, 5); * MobileDebug.Log("MobileUtilities.GetKeyboardHeightRatio(true) " + MobileUtilities.GetKeyboardHeightRatio(true), "Chat", LogType.Log, 6); * MobileDebug.Log("MobileUtilities.GetKeyboardHeightRatio(false) " + MobileUtilities.GetKeyboardHeightRatio(false), "Chat", LogType.Log, 7); * MobileDebug.Log("MobileUtilities.GetKeyboardHeight(true) " + MobileUtilities.GetKeyboardHeight(true), "Chat", LogType.Log, 8); * MobileDebug.Log("MobileUtilities.GetKeyboardHeight(false) " + MobileUtilities.GetKeyboardHeight(false), "Chat", LogType.Log, 9); * MobileDebug.Log("Screen.width " + Screen.width, "Chat", LogType.Log, 10); * MobileDebug.Log("Screen.height " + Screen.height, "Chat", LogType.Log, 11);*/ /*if (keyboard?.status == TouchScreenKeyboard.Status.Visible)*/ if (KeyBoardIsVisible) { //make chat text area fix keyboard size #if !UNITY_EDITOR float KBheight = MobileUtilities.GetKeyboardHeight(false); float CanvasToScreenRatio = (float)Screen.height / canvas.rect.height; float chatSize = canvas.rect.height - (KBheight / CanvasToScreenRatio); chatBoxToResize.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, chatSize); chatBoxToResize.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, canvas.rect.width); chatBoxToResize.anchoredPosition = new Vector2(0, 0); #else chatBoxToResize.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, canvas.rect.width); chatBoxToResize.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, canvas.rect.height); #endif } else { chatBoxToResize.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, canvas.rect.width); chatBoxToResize.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, canvas.rect.height); } }
void OnApplicationFocus(bool hasFocus) { if (hasFocus == true) { /* temp = inputF.text;*/ inputF.interactable = false; /* isPaused = !hasFocus;*/ MobileDebug.Log("has focus :" + hasFocus.ToString(), "InputField", LogType.Log, 5); inputF.interactable = true; /* inputF.text = temp;*/ } }
// Use this for initialization void Awake() { #if TEST_VERSION isDebugBuild = true; #else isDebugBuild = false; #endif if (instance != null) { GameObject.Destroy(this); } else { #if !UNITY_EDITOR Application.logMessageReceived += HandleLog; #endif instance = this; } /* DontDestroyOnLoad(this);*/ if (instance.lineDictionary == null) { instance.lineDictionary = new Dictionary <string, List <DebugMessageLine> >(); } instance.lineStyle = new GUIStyle(); enableWorning = true; enableAssert = true; enableException = true; enableError = true; enableLog = true; //maximize = false; }