示例#1
0
 public void SetLineType(InputField.LineType lineType)
 {
     if (this.inputField != null)
     {
         this.inputField.lineType = lineType;
     }
 }
 public void SetInputPropertiesToDefault()
 {
     InputPlaceHolder         = defaultPlaceHolder;
     InputCharacterLimit      = defaultCharacterLimit;
     InputCharacterValidation = defaultCharacterValidation;
     InputContentType         = defaultContentType;
     InputInputType           = defaultInputType;
     InputLineType            = defaultLineType;
 }
        private TMP_InputField.LineType GetTMPLineType(InputField.LineType lineType)
        {
            switch (lineType)
            {
            case InputField.LineType.MultiLineNewline: return(TMP_InputField.LineType.MultiLineNewline);

            case InputField.LineType.MultiLineSubmit: return(TMP_InputField.LineType.MultiLineSubmit);

            case InputField.LineType.SingleLine: return(TMP_InputField.LineType.SingleLine);

            default: return(TMP_InputField.LineType.SingleLine);
            }
        }
示例#4
0
    private static int get_lineType(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            InputField          inputField = (InputField)obj;
            InputField.LineType lineType   = inputField.lineType;
            ToLua.Push(L, lineType);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index lineType on a nil value");
        }
        return(result);
    }
示例#5
0
    private static int set_lineType(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            InputField          inputField = (InputField)obj;
            InputField.LineType lineType   = (InputField.LineType)((int)ToLua.CheckObject(L, 2, typeof(InputField.LineType)));
            inputField.lineType = lineType;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index lineType on a nil value");
        }
        return(result);
    }
示例#6
0
 public void SetLineType(InputField.LineType lineType)
 {
     _input.lineType = lineType;
 }
示例#7
0
    /// <summary>
    /// Displays this screen.
    /// </summary>
    /// <param name="infoText">The text that should be displayed in the screen.</param>
    /// <param name="minTextLength">The lowest acceptable letter-count in input.</param>
    /// <param name="maxTextLength">The maximum acceptable letter-count in input.</param>
    /// <param name="allowCancel">Whether to allow cancelling or not.</param>
    /// <param name="callbackConfirm">Callback for what happens when confirming.</param>
    /// <param name="keyboardType">The type of keyboard to be displayed when inputting. Should preferably match the content type.</param>
    /// <param name="startValue">Start text value.</param>
    /// <param name="inputType">The input type.</param>
    /// <param name="lineType">The line type.</param>
    public virtual void Set(string infoText, int minTextLength, int maxTextLength, bool allowCancel, System.Action <string> callbackConfirm = null, TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default, string startValue = "", InputField.LineType lineType = InputField.LineType.MultiLineSubmit, InputField.ContentType contentType = InputField.ContentType.Standard, string promptText = "Enter Text")
    {
        this.displayText.text        = infoText;
        this.startValue              = startValue;
        this.minTextLength           = minTextLength;
        this.maxTextLength           = maxTextLength;
        this.defaultErrorDisplayText = "Must be between " + minTextLength.ToString() + " and " + maxTextLength.ToString() + " characters long";

        this.input.onValueChanged.AddListener(delegate { OnInputChange(); });
        this.input.keyboardType   = keyboardType;
        this.input.colors         = GetColorBlock();
        this.input.contentType    = contentType;
        this.input.lineType       = lineType;
        this.input.characterLimit = maxTextLength;
        this.input.SetTextWithoutNotify(startValue);
        this.input.placeholder.GetComponent <Text>().text = promptText;
        this.input.Select();
        OnInputChange(); // Makes sure buttons and requirements text is properly enabled/disabled.

        this.cancelButton.gameObject.SetActive(allowCancel);

        this.callbackConfirm = callbackConfirm;
    }
示例#8
0
        protected void EnforceContentType()
        {
            switch (contentType)
            {
            case InputField.ContentType.Standard:
            {
                // Don't enforce line type for this content type.
                m_InputType           = InputField.InputType.Standard;
                m_KeyboardType        = TouchScreenKeyboardType.Default;
                m_CharacterValidation = InputField.CharacterValidation.None;
                return;
            }

            case InputField.ContentType.Autocorrected:
            {
                // Don't enforce line type for this content type.
                m_InputType           = InputField.InputType.AutoCorrect;
                m_KeyboardType        = TouchScreenKeyboardType.Default;
                m_CharacterValidation = InputField.CharacterValidation.None;
                return;
            }

            case InputField.ContentType.IntegerNumber:
            {
                m_LineType = InputField.LineType.SingleLine;
                SetTextComponentWrapMode(false);
                m_InputType           = InputField.InputType.Standard;
                m_KeyboardType        = TouchScreenKeyboardType.NumberPad;
                m_CharacterValidation = InputField.CharacterValidation.Integer;
                return;
            }

            case InputField.ContentType.DecimalNumber:
            {
                m_LineType = InputField.LineType.SingleLine;
                SetTextComponentWrapMode(false);
                m_InputType           = InputField.InputType.Standard;
                m_KeyboardType        = TouchScreenKeyboardType.NumbersAndPunctuation;
                m_CharacterValidation = InputField.CharacterValidation.Decimal;
                return;
            }

            case InputField.ContentType.Alphanumeric:
            {
                m_LineType = InputField.LineType.SingleLine;
                SetTextComponentWrapMode(false);
                m_InputType           = InputField.InputType.Standard;
                m_KeyboardType        = TouchScreenKeyboardType.ASCIICapable;
                m_CharacterValidation = InputField.CharacterValidation.Alphanumeric;
                return;
            }

            case InputField.ContentType.Name:
            {
                m_LineType = InputField.LineType.SingleLine;
                SetTextComponentWrapMode(false);
                m_InputType           = InputField.InputType.Standard;
                m_KeyboardType        = TouchScreenKeyboardType.Default;
                m_CharacterValidation = InputField.CharacterValidation.Name;
                return;
            }

            case InputField.ContentType.EmailAddress:
            {
                m_LineType = InputField.LineType.SingleLine;
                SetTextComponentWrapMode(false);
                m_InputType           = InputField.InputType.Standard;
                m_KeyboardType        = TouchScreenKeyboardType.EmailAddress;
                m_CharacterValidation = InputField.CharacterValidation.EmailAddress;
                return;
            }

            case InputField.ContentType.Password:
            {
                m_LineType = InputField.LineType.SingleLine;
                SetTextComponentWrapMode(false);
                m_InputType           = InputField.InputType.Password;
                m_KeyboardType        = TouchScreenKeyboardType.Default;
                m_CharacterValidation = InputField.CharacterValidation.None;
                return;
            }

            case InputField.ContentType.Pin:
            {
                m_LineType = InputField.LineType.SingleLine;
                SetTextComponentWrapMode(false);
                m_InputType           = InputField.InputType.Password;
                m_KeyboardType        = TouchScreenKeyboardType.NumberPad;
                m_CharacterValidation = InputField.CharacterValidation.Integer;
                return;
            }

            default:
            {
                // Includes Custom type. Nothing should be enforced.
                return;
            }
            }
        }