/// <summary> /// Update the text and the label by grabbing it from the iOS/Android keyboard. /// </summary> void Update() { if (mKeyboard != null) { //by ZZH //string text = mKeyboard.text; bool editThis = this.selected || UICamera.selectedObject == null || UICamera.selectedObject.GetComponent <UIInput>() == null; if (editThis) { string text = mKeyboard.text.Replace(new string((char)8198, 1), ""); text = SystemFunction.ReplaceEmoji(text); if (mText != text) { mText = ""; for (int i = 0; i < text.Length; ++i) { char ch = text[i]; if (validator != null) { ch = validator(mText, ch); } if (ch != 0) { mText += ch; } } if (maxChars > 0 && mText.Length > maxChars) { mText = mText.Substring(0, maxChars); } UpdateLabel(); if (mText != text) { mKeyboard.text = mText; } SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver); } } if (mKeyboard.done) { mKeyboard = null; current = this; if (onSubmit != null) { onSubmit(mText); } if (this.selected) { if (eventReceiver == null) { eventReceiver = gameObject; } eventReceiver.SendMessage(functionName, mText, SendMessageOptions.DontRequireReceiver); } current = null; selected = false; } if (!editThis) { this.UpdateLabel(); this.mKeyboard = null; this.OnSelect(false); } } }