using System; using TMPro; using UnityEngine; using UnityEngine.Events; namespace AibisDream { /// /// 表单项父类 /// public abstract class AbsFormItem : MonoBehaviour { #region 数据部分 public string prop; public string label; public abstract FieldType FieldType { get; } #endregion #region 索引部分 private TMP_Text _labelRef; public UnityEvent OnValueChanged; #endregion private void Awake() { InitItem(); } /// /// 初始化FormItem /// private void InitItem() { // label设置 _labelRef = transform.Find("Label").GetComponent(); _labelRef.text = label; // field设置 InitField(); } protected abstract void InitField(); public abstract void SetValue(string value); } public enum FieldType { Input, Slider, Select, Radio } }