using AX.ImageViewer; using UniRx; using UnityEngine; using UnityEngine.UI; public class EquipmentAttributePanel : UIView { //标题 public Text TitleText; //位置 public Text LocationText; public InputField LocationInput; //详情 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 GameObject ControllerPanel; public Toggle ControlTogle; public Slider ControlSizeSlider; private string url; public override void Awake() { base.Awake(); #region DataSource Bind DataSource.Address.SubscribeToText(LocationText).AddTo(gameObject); DataSource.Address.SubscribeToText(LocationInput).AddTo(gameObject); DataSource.Discription.SubscribeToText(DetailsText).AddTo(gameObject); DataSource.Discription.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); DataSource.ImageUrl.Subscribe(url => { GetImage(); }).AddTo(gameObject); DetailsInput.OnValueChangedAsObservable().Subscribe(s => DataSource.Discription.Value = s); LocationInput.OnValueChangedAsObservable().Subscribe(s => DataSource.Address.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