using UnityEngine; using UnityEngine.UI; namespace UIWidgets { /// /// InputFieldProxy. /// public class InputFieldProxy : IInputFieldProxy { /// /// The InputField. /// InputField inputField; /// /// Initializes a new instance of the class. /// /// Input. public InputFieldProxy(InputField input) { inputField = input; } #region IInputFieldProxy implementation /// /// The current value of the input field. /// /// The text. public string text { get { return inputField.text; } set { inputField.text = value; } } /// /// Accessor to the OnChangeEvent. /// /// The OnValueChange. public InputField.OnChangeEvent onValueChange { get { #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 return inputField.onValueChange; #else return inputField.onValueChanged; #endif } set { #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 inputField.onValueChange = value; #else inputField.onValueChanged = value; #endif } } /// /// Accessor to the OnChangeEvent. /// /// The OnValueChange. public InputField.OnChangeEvent onValueChanged { get { #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 return inputField.onValueChange; #else return inputField.onValueChanged; #endif } set { #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 inputField.onValueChange = value; #else inputField.onValueChanged = value; #endif } } /// /// The Unity Event to call when editing has ended. /// /// The OnEndEdit. public InputField.SubmitEvent onEndEdit { get { return inputField.onEndEdit; } set { inputField.onEndEdit = value; } } /// /// Current InputField caret position (also selection tail). /// /// The caret position. public int caretPosition { get { #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 return inputField.text.Length; #else return inputField.caretPosition; #endif } set { #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 //inputField.ActivateInputField(); #else inputField.caretPosition = value; #endif } } public bool interactable { get { return inputField.interactable; } set { inputField.interactable = value; } } #endregion } }