NGUI: Next-Gen UI kit
3.7.2
|
Input field makes it possible to enter custom information within the UI. More...
Public Types | |
enum | InputType { InputType.Standard, InputType.AutoCorrect, InputType.Password } |
enum | Validation { Validation.None, Validation.Integer, Validation.Float, Validation.Alphanumeric, Validation.Username, Validation.Name } |
enum | KeyboardType { KeyboardType.Default = 0, KeyboardType.ASCIICapable = 1, KeyboardType.NumbersAndPunctuation = 2, KeyboardType.URL = 3, KeyboardType.NumberPad = 4, KeyboardType.PhonePad = 5, KeyboardType.NamePhonePad = 6, KeyboardType.EmailAddress = 7 } |
enum | OnReturnKey { OnReturnKey.Default, OnReturnKey.Submit, OnReturnKey.NewLine } |
Public Member Functions | |
delegate char | OnValidate (string text, int charIndex, char addedChar) |
string | Validate (string val) |
Validate the specified text, returning the validated version. More... | |
void | Submit () |
Submit the input field's text. More... | |
void | UpdateLabel () |
Update the visual text label. More... | |
void | RemoveFocus () |
Convenience function to be used as a callback that will clear the input field's focus. More... | |
void | SaveValue () |
Convenience function that can be used as a callback for On Change notification. More... | |
void | LoadValue () |
Convenience function that can forcefully reset the input field's value to what was saved earlier. More... | |
Public Attributes | |
UILabel | label |
Text label used to display the input's value. More... | |
InputType | inputType = InputType.Standard |
Type of data expected by the input field. More... | |
OnReturnKey | onReturnKey = OnReturnKey.Default |
What to do when the Return key is pressed on the keyboard. More... | |
KeyboardType | keyboardType = KeyboardType.Default |
Keyboard type applies to mobile keyboards that get shown. More... | |
bool | hideInput = false |
Whether the input will be hidden on mobile platforms. More... | |
Validation | validation = Validation.None |
What kind of validation to use with the input field's data. More... | |
int | characterLimit = 0 |
Maximum number of characters allowed before input no longer works. More... | |
string | savedAs |
Field in player prefs used to automatically save the value. More... | |
GameObject | selectOnTab |
Object to select when Tab key gets pressed. More... | |
Color | activeTextColor = Color.white |
Color of the label when the input field has focus. More... | |
Color | caretColor = new Color(1f, 1f, 1f, 0.8f) |
Color used by the caret symbol. More... | |
Color | selectionColor = new Color(1f, 223f / 255f, 141f / 255f, 0.5f) |
Color used by the selection rectangle. More... | |
List< EventDelegate > | onSubmit = new List<EventDelegate>() |
Event delegates triggered when the input field submits its data. More... | |
List< EventDelegate > | onChange = new List<EventDelegate>() |
Event delegates triggered when the input field's text changes for any reason. More... | |
OnValidate | onValidate |
Custom validation callback. More... | |
Static Public Attributes | |
static UIInput | current |
Currently active input field. Only valid during callbacks. More... | |
static UIInput | selection |
Currently selected input field, if any. More... | |
Protected Member Functions | |
void | Init () |
Labels used for input shouldn't support rich text. More... | |
void | SaveToPlayerPrefs (string val) |
Save the specified value to player prefs. More... | |
virtual void | OnSelect (bool isSelected) |
Selection event, sent by the EventSystem. More... | |
void | OnSelectEvent () |
Notification of the input field gaining selection. More... | |
void | OnDeselectEvent () |
Notification of the input field losing selection. More... | |
void | DoBackspace () |
Perform a backspace operation. More... | |
virtual bool | ProcessEvent (Event ev) |
Handle the specified event. More... | |
virtual void | Insert (string text) |
Insert the specified text string into the current input value, respecting selection and validation. More... | |
string | GetLeftText () |
Get the text to the left of the selection. More... | |
string | GetRightText () |
Get the text to the right of the selection. More... | |
string | GetSelection () |
Get currently selected text. More... | |
int | GetCharUnderMouse () |
Helper function that retrieves the index of the character under the mouse. More... | |
virtual void | OnPress (bool isPressed) |
Move the caret on press. More... | |
virtual void | OnDrag (Vector2 delta) |
Drag selection. More... | |
virtual void | Cleanup () |
Cleanup. More... | |
void | SetPivotToLeft () |
Set the label's pivot to the left. More... | |
void | SetPivotToRight () |
Set the label's pivot to the right. More... | |
void | RestoreLabelPivot () |
Restore the input label's pivot point. More... | |
char | Validate (string text, int pos, char ch) |
Validate the specified input. More... | |
void | ExecuteOnChange () |
Execute the OnChange callback. More... | |
Protected Attributes | |
string | mValue |
Input field's value. More... | |
string | mDefaultText = "" |
Color | mDefaultColor = Color.white |
float | mPosition = 0f |
bool | mDoInit = true |
UIWidget.Pivot | mPivot = UIWidget.Pivot.TopLeft |
bool | mLoadSavedValue = true |
int | mSelectionStart = 0 |
int | mSelectionEnd = 0 |
UITexture | mHighlight = null |
UITexture | mCaret = null |
Texture2D | mBlankTex = null |
float | mNextBlink = 0f |
float | mLastAlpha = 0f |
string | mCached = "" |
int | mSelectMe = -1 |
Static Protected Attributes | |
static int | mDrawStart = 0 |
static string | mLastIME = "" |
Properties | |
string | defaultText [get, set] |
Default text used by the input's label. More... | |
bool | inputShouldBeHidden [get] |
Should the input be hidden? More... | |
string | text [get, set] |
string | value [get, set] |
Input field's current text value. More... | |
bool | selected [get, set] |
bool | isSelected [get, set] |
Whether the input is currently selected. More... | |
int | cursorPosition [get, set] |
Current position of the cursor. More... | |
int | selectionStart [get, set] |
Index of the character where selection begins. More... | |
int | selectionEnd [get, set] |
Index of the character where selection ends. More... | |
UITexture | caret [get] |
Caret, in case it's needed. More... | |
Input field makes it possible to enter custom information within the UI.
enum UIInput.InputType |
enum UIInput.KeyboardType |
enum UIInput.OnReturnKey |
enum UIInput.Validation |
|
protectedvirtual |
Cleanup.
|
protected |
Perform a backspace operation.
|
protected |
Execute the OnChange callback.
|
protected |
Helper function that retrieves the index of the character under the mouse.
|
protected |
Get the text to the left of the selection.
|
protected |
Get the text to the right of the selection.
|
protected |
Get currently selected text.
|
protected |
Labels used for input shouldn't support rich text.
|
protectedvirtual |
Insert the specified text string into the current input value, respecting selection and validation.
void UIInput.LoadValue | ( | ) |
Convenience function that can forcefully reset the input field's value to what was saved earlier.
|
protected |
Notification of the input field losing selection.
|
protectedvirtual |
Drag selection.
|
protectedvirtual |
Move the caret on press.
|
protectedvirtual |
Selection event, sent by the EventSystem.
|
protected |
Notification of the input field gaining selection.
delegate char UIInput.OnValidate | ( | string | text, |
int | charIndex, | ||
char | addedChar | ||
) |
|
protectedvirtual |
Handle the specified event.
void UIInput.RemoveFocus | ( | ) |
Convenience function to be used as a callback that will clear the input field's focus.
|
protected |
Restore the input label's pivot point.
|
protected |
Save the specified value to player prefs.
void UIInput.SaveValue | ( | ) |
Convenience function that can be used as a callback for On Change notification.
|
protected |
Set the label's pivot to the left.
|
protected |
Set the label's pivot to the right.
void UIInput.Submit | ( | ) |
Submit the input field's text.
void UIInput.UpdateLabel | ( | ) |
Update the visual text label.
string UIInput.Validate | ( | string | val | ) |
Validate the specified text, returning the validated version.
|
protected |
Validate the specified input.
Color UIInput.activeTextColor = Color.white |
Color of the label when the input field has focus.
Color UIInput.caretColor = new Color(1f, 1f, 1f, 0.8f) |
Color used by the caret symbol.
int UIInput.characterLimit = 0 |
Maximum number of characters allowed before input no longer works.
|
static |
Currently active input field. Only valid during callbacks.
bool UIInput.hideInput = false |
Whether the input will be hidden on mobile platforms.
InputType UIInput.inputType = InputType.Standard |
Type of data expected by the input field.
KeyboardType UIInput.keyboardType = KeyboardType.Default |
Keyboard type applies to mobile keyboards that get shown.
UILabel UIInput.label |
Text label used to display the input's value.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Input field's value.
List<EventDelegate> UIInput.onChange = new List<EventDelegate>() |
Event delegates triggered when the input field's text changes for any reason.
OnReturnKey UIInput.onReturnKey = OnReturnKey.Default |
What to do when the Return key is pressed on the keyboard.
List<EventDelegate> UIInput.onSubmit = new List<EventDelegate>() |
Event delegates triggered when the input field submits its data.
OnValidate UIInput.onValidate |
Custom validation callback.
string UIInput.savedAs |
Field in player prefs used to automatically save the value.
|
static |
Currently selected input field, if any.
Color UIInput.selectionColor = new Color(1f, 223f / 255f, 141f / 255f, 0.5f) |
Color used by the selection rectangle.
GameObject UIInput.selectOnTab |
Object to select when Tab key gets pressed.
Validation UIInput.validation = Validation.None |
What kind of validation to use with the input field's data.
|
get |
Caret, in case it's needed.
|
getset |
Current position of the cursor.
|
getset |
Default text used by the input's label.
|
get |
Should the input be hidden?
|
getset |
Whether the input is currently selected.
|
getset |
|
getset |
Index of the character where selection ends.
|
getset |
Index of the character where selection begins.
|
getset |
|
getset |
Input field's current text value.