void OnGUI() { Event e = Event.current; if (e.keyCode == KeyCode.Return) { IsKeyboardShow = false; CheckPageGlobal.CheckProduct(); } else if (IsKeyboardShow) { stringToEdit = GUI.TextField(new Rect(0, 0, 100, 50), stringToEdit, 25); setText(stringToEdit); } }
// Update is called once per frame void Update() { if (box == null) { return; } bool touchDown = TouchInterface.GetTouchDown(); Vector2 pos = TouchInterface.GetTouchPosition(); if (touchDown) { if (box.OverlapPoint(pos)) { if (SoundClick != null) { SoundClick.Play(); } //show keyboard #if UNITY_EDITOR IsKeyboardShow = true; #else #if !UNITY_WEBGL && !DISABLE_WEBVIEW if (!TouchScreenKeyboard.visible) { keyboard = TouchScreenKeyboard.Open(currentText, type, false, multiline, false, false); } #endif #endif } } if (keyboard == null || keyboard.wasCanceled) { return; } if (keyboard.done) { // keyboard = null; CheckPageGlobal.CheckProduct(); } // if (keyboard.wasCanceled) { // keyboard = null; // } if (keyboard.active) { setText(keyboard.text); } }