else if (c == '\r' || c == '\n')
{
if (UICamera.current.submitKey0 == KeyCode.Return || UICamera.current.submitKey1 == KeyCode.Return)
{
// Not multi-line input, or control isn't held
if (!label.multiLine)// || (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl)))
{
/*mText += "\n";
UpdateLabel();
return;*/
// Enter
current = this;
if (onSubmit != null) onSubmit(mText);
if (eventReceiver == null) eventReceiver = gameObject;
eventReceiver.SendMessage(functionName, mText, SendMessageOptions.DontRequireReceiver);
current = null;
selected = false;
return;
}
}
// If we have an input validator, validate the input first
if (validator != null) c = validator(mText, c);
// If the input is invalid, skip it
if (c == 0) continue;
// Append the character
if (c == '\n' || c == '\r')
{
if (label.multiLine) mText += "\n";
}
else mText += c;
// Notify the listeners
SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
}