using UnityEngine; using UnityEngine.UI; using UniRx; using AX.ImageViewer; public class FireElevatorAttributePanel : UIView { //编号 public Text NumberText; public InputField NumberInput; //载重 public Text LoadText; public InputField LoadInput; //通往层数 public Text LayerText; public InputField LayerInput; //保存按钮 public Button SaveButton; public override void Awake() { base.Awake(); #region DataSource Bind //编号 DataSource.Number.SubscribeToText(NumberText).AddTo(gameObject); DataSource.Number.SubscribeToText(NumberInput).AddTo(gameObject); NumberInput.OnValueChangedAsObservable().Subscribe(s => DataSource.Number.Value = s); //载重 DataSource.Load.SubscribeToText(LoadText).AddTo(gameObject); DataSource.Load.SubscribeToText(LoadInput).AddTo(gameObject); LoadInput.OnValueChangedAsObservable().Subscribe(s => DataSource.Load.Value = s); //通往层数 DataSource.Layer.SubscribeToText(LayerText).AddTo(gameObject); DataSource.Layer.SubscribeToText(LayerInput).AddTo(gameObject); LayerInput.OnValueChangedAsObservable().Subscribe(s => DataSource.Layer.Value = s); #endregion #region Button Click //保存 SaveButton.onClick.AsObservable().Subscribe(onClick => { SaveData(); }).AddTo(gameObject); transform.Find("TitleBar/CloseButton").GetComponent