C# Class UIInput, TheUnseen

Inheritance: MonoBehaviour
显示文件 Open project: henryj41043/TheUnseen Class Usage Examples

Public Properties

Property Type Description
activeTextColor Color
caretColor Color
characterLimit int
current UIInput,
inputType InputType,
keyboardType KeyboardType
label UILabel,
onChange List
onSubmit List
onValidate OnValidate
savedAs string
selectOnTab GameObject
selection UIInput
selectionColor Color
validation Validation

Protected Properties

Property Type Description
mBlankTex UnityEngine.Texture2D
mCaret UITexture,
mDefaultColor Color
mDefaultText string
mDoInit bool
mDrawStart int
mHighlight UITexture,
mKeyboard UnityEngine.TouchScreenKeyboard
mLastIME string
mNextBlink float
mPivot UIWidget.Pivot
mPosition float
mSelectionEnd int
mSelectionStart int

Private Properties

Property Type Description
ProcessEvent bool

Public Methods

Method Description
OnDisable ( ) : void

Ensure we've released the dynamically created resources.

OnGUI ( ) : void

Unfortunately Unity 4.3 and earlier doesn't offer a way to properly process events outside of OnGUI.

Start ( ) : void

Automatically set the value by loading it from player prefs if possible.

Submit ( ) : void

Submit the input field's text.

Update ( ) : void
UpdateLabel ( ) : void

Update the visual text label.

Validate ( string val ) : string

Validate the specified text, returning the validated version.

Protected Methods

Method Description
Cleanup ( ) : void

Cleanup.

ExecuteOnChange ( ) : void

Execute the OnChange callback.

GetCharUnderMouse ( ) : int

Helper function that retrieves the index of the character under the mouse.

GetLeftText ( ) : string

Get the text to the left of the selection.

GetRightText ( ) : string

Get the text to the right of the selection.

GetSelection ( ) : string

Get currently selected text.

Init ( ) : void

Labels used for input shouldn't support rich text.

Insert ( string text ) : void

Insert the specified text string into the current input value, respecting selection and validation.

OnDeselectEvent ( ) : void

Notification of the input field losing selection.

OnDrag ( Vector2 delta ) : void

Drag selection.

OnPress ( bool isPressed ) : void

Move the caret on press.

OnSelect ( bool isSelected ) : void

Selection event, sent by the EventSystem.

OnSelectEvent ( ) : void

Notification of the input field gaining selection.

RestoreLabelPivot ( ) : void

Restore the input label's pivot point.

SaveToPlayerPrefs ( string val ) : void

Save the specified value to player prefs.

SetPivotToLeft ( ) : void

Set the label's pivot to the left.

SetPivotToRight ( ) : void

Set the label's pivot to the right.

Validate ( string text, int pos, char ch ) : char

Validate the specified input.

Private Methods

Method Description
ProcessEvent ( Event ev ) : bool

Handle the specified event.

Method Details

Cleanup() protected method

Cleanup.
protected Cleanup ( ) : void
return void

ExecuteOnChange() protected method

Execute the OnChange callback.
protected ExecuteOnChange ( ) : void
return void

GetCharUnderMouse() protected method

Helper function that retrieves the index of the character under the mouse.
protected GetCharUnderMouse ( ) : int
return int

GetLeftText() protected method

Get the text to the left of the selection.
protected GetLeftText ( ) : string
return string

GetRightText() protected method

Get the text to the right of the selection.
protected GetRightText ( ) : string
return string

GetSelection() protected method

Get currently selected text.
protected GetSelection ( ) : string
return string

Init() protected method

Labels used for input shouldn't support rich text.
protected Init ( ) : void
return void

Insert() protected method

Insert the specified text string into the current input value, respecting selection and validation.
protected Insert ( string text ) : void
text string
return void

OnDeselectEvent() protected method

Notification of the input field losing selection.
protected OnDeselectEvent ( ) : void
return void

OnDisable() public method

Ensure we've released the dynamically created resources.
public OnDisable ( ) : void
return void

OnDrag() protected method

Drag selection.
protected OnDrag ( Vector2 delta ) : void
delta Vector2
return void

OnGUI() public method

Unfortunately Unity 4.3 and earlier doesn't offer a way to properly process events outside of OnGUI.
public OnGUI ( ) : void
return void

OnPress() protected method

Move the caret on press.
protected OnPress ( bool isPressed ) : void
isPressed bool
return void

OnSelect() protected method

Selection event, sent by the EventSystem.
protected OnSelect ( bool isSelected ) : void
isSelected bool
return void

OnSelectEvent() protected method

Notification of the input field gaining selection.
protected OnSelectEvent ( ) : void
return void

RestoreLabelPivot() protected method

Restore the input label's pivot point.
protected RestoreLabelPivot ( ) : void
return void

SaveToPlayerPrefs() protected method

Save the specified value to player prefs.
protected SaveToPlayerPrefs ( string val ) : void
val string
return void

SetPivotToLeft() protected method

Set the label's pivot to the left.
protected SetPivotToLeft ( ) : void
return void

SetPivotToRight() protected method

Set the label's pivot to the right.
protected SetPivotToRight ( ) : void
return void

Start() public method

Automatically set the value by loading it from player prefs if possible.
public Start ( ) : void
return void

Submit() public method

Submit the input field's text.
public Submit ( ) : void
return void

Update() public method

public Update ( ) : void
return void

UpdateLabel() public method

Update the visual text label.
public UpdateLabel ( ) : void
return void

Validate() protected method

Validate the specified input.
protected Validate ( string text, int pos, char ch ) : char
text string
pos int
ch char
return char

Validate() public method

Validate the specified text, returning the validated version.
public Validate ( string val ) : string
val string
return string

Property Details

activeTextColor public_oe property

Color of the label when the input field has focus.
public Color activeTextColor
return Color

caretColor public_oe property

Color used by the caret symbol.
public Color caretColor
return Color

characterLimit public_oe property

Maximum number of characters allowed before input no longer works.
public int characterLimit
return int

current static_oe public_oe property

Currently active input field. Only valid during callbacks.
static public UIInput, current
return UIInput,

inputType public_oe property

Type of data expected by the input field.
public InputType, inputType
return InputType,

keyboardType public_oe property

Keyboard type applies to mobile keyboards that get shown.
public KeyboardType keyboardType
return KeyboardType

label public_oe property

Text label used to display the input's value.
public UILabel, label
return UILabel,

mBlankTex protected_oe property

protected Texture2D,UnityEngine mBlankTex
return UnityEngine.Texture2D

mCaret protected_oe property

protected UITexture, mCaret
return UITexture,

mDefaultColor protected_oe property

protected Color mDefaultColor
return Color

mDefaultText protected_oe property

protected string mDefaultText
return string

mDoInit protected_oe property

protected bool mDoInit
return bool

mDrawStart static_oe protected_oe property

static protected int mDrawStart
return int

mHighlight protected_oe property

protected UITexture, mHighlight
return UITexture,

mKeyboard static_oe protected_oe property

static protected TouchScreenKeyboard,UnityEngine mKeyboard
return UnityEngine.TouchScreenKeyboard

mLastIME static_oe protected_oe property

static protected string mLastIME
return string

mNextBlink protected_oe property

protected float mNextBlink
return float

mPivot protected_oe property

protected UIWidget.Pivot mPivot
return UIWidget.Pivot

mPosition protected_oe property

protected float mPosition
return float

mSelectionEnd protected_oe property

protected int mSelectionEnd
return int

mSelectionStart protected_oe property

protected int mSelectionStart
return int

onChange public_oe property

Event delegates triggered when the input field's text changes for any reason.
public List onChange
return List

onSubmit public_oe property

Event delegates triggered when the input field submits its data.
public List onSubmit
return List

onValidate public_oe property

Custom validation callback.
public OnValidate onValidate
return OnValidate

savedAs public_oe property

Field in player prefs used to automatically save the value.
public string savedAs
return string

selectOnTab public_oe property

Object to select when Tab key gets pressed.
public GameObject selectOnTab
return GameObject

selection static_oe public_oe property

Currently selected input field, if any.
static public UIInput selection
return UIInput

selectionColor public_oe property

Color used by the selection rectangle.
public Color selectionColor
return Color

validation public_oe property

What kind of validation to use with the input field's data.
public Validation validation
return Validation