Example #1
0
 private void CreateSaveButton()
 {
     _saveButtonPanel = _saveMixPanel.AddUIComponent <ButtonPanel>();
     _saveButtonPanel.Setup("Save Button", 340.0f, 30.0f);
     _saveButtonPanel.SetAnchor(UIAnchorStyle.Left | UIAnchorStyle.CenterVertical);
     _saveButtonPanel.SetText(Translation.Instance.GetTranslation(TranslationID.BUTTON_SAVE));
     _saveButtonPanel.AlignRight();
     _saveButtonPanel.DisableButton();
     _saveButtonPanel.EventButtonClicked += OnSaveClicked;
 }
Example #2
0
        private void OnTextFieldTextChanged(UIComponent component, string value)
        {
            var textfield = component as UITextField;

            if (textfield == null)
            {
                return;
            }
            if (textfield.text.Length > 0 && !int.TryParse(textfield.text[0].ToString(), out int _))
            {
                _saveButtonPanel.EnableButton(Translation.Instance.GetTranslation(TranslationID.BUTTON_SAVE));
                textfield.textColor = Color.black;
            }
            else
            {
                textfield.textColor = Color.red;
                _saveButtonPanel.DisableButton();
            }
        }