using UnityEngine; using UnityEngine.UI; using UniRx; using AX.ImageViewer; /// /// 供水关系图 /// public class WaterDiagramPanel : UIView { //详情 public Text DetailsText; public InputField DetailsInput; //图片类型 public OriginalImageType ImageType; //图片面板 public Image ImagePanel; //全景开关 public Toggle ImageTypeToggle; //查看原图 public Button ViewButton; public OpenImage OpenImageFile; //保存按钮 public Button SaveButton; /// /// 初始化 /// public override void Awake() { base.Awake(); #region DataSource Bind DataSource.Details.SubscribeToText(DetailsText).AddTo(gameObject); DataSource.Details.SubscribeToText(DetailsInput).AddTo(gameObject); DataSource.ImageType.Subscribe(data => { switch (data) { case OriginalImageType.Normal: ImageTypeToggle.isOn = false; break; case OriginalImageType.Panorama: ImageTypeToggle.isOn = true; break; } }).AddTo(gameObject); DetailsInput.OnValueChangedAsObservable().Subscribe(s => DataSource.Details.Value = s); ImageTypeToggle.OnValueChangedAsObservable().Subscribe(b => { DataSource.ImageType.Value = b ? OriginalImageType.Panorama : OriginalImageType.Normal; }).AddTo(gameObject); #endregion #region Button Click //保存 SaveButton.onClick.AsObservable().Subscribe(onClick => { SaveData(); }).AddTo(gameObject); //查看原图 ViewButton.onClick.AsObservable().Subscribe(onClick => { ViewImage(); }); //关闭 transform.Find("TitleBar/CloseButton").GetComponent