上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

51 lines
1.4 KiB

using UnityEngine;
using UnityEngine.UI;
using UniRx;
public class HydrantCreationPanel : UIView
{
public Toggle PostToggle;
public Toggle FlushToggle;
public Button SaveButton;
public Button ClearButton;
public override void Awake()
{
base.Awake();
//地上消火栓
PostToggle.OnValueChangedAsObservable()
.Subscribe(value =>
{
EquipmentManager.Instance.Clone("DSXHS", value, 0f);
});
//地下消火栓
FlushToggle.OnValueChangedAsObservable()
.Subscribe(value =>
{
EquipmentManager.Instance.Clone("DXXHS", value, 0f);
});
//清空
ClearButton.OnClickAsObservable()
.Subscribe(_ => EquipmentManager.Instance.OnCleraButtonClicked());
//保存
SaveButton.OnClickAsObservable()
.Subscribe(_ => EquipmentManager.Instance.SaveData());
transform.Find("TitleBar/CloseButton").GetComponent<Button>().OnClickAsObservable()
.Subscribe(_ => Hide());
Observable.EveryLateUpdate()
.Where(_ => Input.GetMouseButtonDown(1))
.Subscribe(_ =>
{
PostToggle.isOn = false;
FlushToggle.isOn = false;
});
}
public override void Hide()
{
base.Hide();
PostToggle.isOn = false;
FlushToggle.isOn = false;
}
}