Пример #1
0
    public void InitInputElement()
    {
        inputElement = transform.Find("InputElement").GetComponent <InputElement>();
        inputElement.Init(1);

        RectTransform inputRect = inputElement.GetComponent <RectTransform>();

        inputRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, UIConstants.InputSpacing * 2, inputRect.sizeDelta.x);
        RectTransform boardRect = GetComponent <RectTransform>();

        boardRect.sizeDelta = new Vector2(UIConstants.InputSpacing * 4 + inputElement.PreferredWidth(), boardRect.sizeDelta.y);

        inputElement.OnInputChanged += (strings) =>
        {
            sign = strings[0];
            if (OnInputChanged != null)
            {
                OnInputChanged(sign);
            }
            Validate();
        };

        inputElement.SetFocus(true);
    }