上海虹口龙之梦项目
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.
 
 
 
 

72 lines
3.0 KiB

using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class SafeguardConfigPanel : UIView
{
public GameObject Item;
public Button DelButton;
public Button SetButton;
public Button CloseButton;
public InputField DWMCInput;
public InputField DWDZInput;
public InputField FRInput;
public InputField DHInput;
public InputField JSRYInput;
public InputField YSCLInput;
public InputField BZInput;
public InputField BZPInput;
public InputField BZNLInput;
public InputField KCLInput;
public override void Awake()
{
base.Awake();
DelButton = Find<Button>("Bottom Variant/DefaultPanel/DeleteButton");
SetButton = Find<Button>("Bottom Variant/DefaultPanel/SetButton");
CloseButton = Find<Button>("TitleBar/CloseButton");
DWMCInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/MCInput");
DWDZInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/DZInput");
FRInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/FRInput");
DHInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/DHInput");
JSRYInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/JSRYInput");
YSCLInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/YSCLInput");
BZInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/BZInput");
BZPInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/BZPInput");
BZNLInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/BZNLInput");
KCLInput = Find<InputField>("Background/InfoBackground/EditInfoPanel/KCLInput");
CloseButton.OnClickAsObservable()
.Subscribe(_ => Hide());
DelButton.OnClickAsObservable()
.Subscribe(_ =>
{
var data = UIManager.Instance.GetView<SafeguardTablePanel>().Data;
data.Safeguards.Remove(data.Safeguards.Find(a => a.Id == Item.name));
Destroy(Item);
Hide();
});
SetButton.OnClickAsObservable()
.Subscribe(_ => SetData());
}
private void SetData()
{
Item.GetComponent<SafeguardItemController>().DWMCText.text = DWMCInput.text;
Item.GetComponent<SafeguardItemController>().DWDZText.text = DWDZInput.text;
Item.GetComponent<SafeguardItemController>().FRText.text = FRInput.text;
Item.GetComponent<SafeguardItemController>().DHText.text = DHInput.text;
Item.GetComponent<SafeguardItemController>().JSRYText.text = JSRYInput.text;
Item.GetComponent<SafeguardItemController>().YSCLText.text = YSCLInput.text;
Item.GetComponent<SafeguardItemController>().BZText.text = BZInput.text;
Item.GetComponent<SafeguardItemController>().BZPText.text = BZPInput.text;
Item.GetComponent<SafeguardItemController>().BZNLText.text = BZNLInput.text;
Item.GetComponent<SafeguardItemController>().KCLText.text = KCLInput.text;
Hide();
}
}