113 lines
3.8 KiB
C#
113 lines
3.8 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class UI_ConnectStation : BasePanel
|
||
{
|
||
public string triggerName;
|
||
|
||
//bool reinstalled = false;
|
||
Device_Control dc = null;
|
||
public Device_Collector collector;
|
||
public Device_Sundries sundries;
|
||
|
||
public override void ShowMe()
|
||
{
|
||
base.ShowMe();
|
||
//dc = FindObjectOfType<Device_Control_4001>();
|
||
dc = FindObjectOfType<Device_Control>();
|
||
collector = dc.GetComponentInChildren<Device_Collector>(true);
|
||
sundries = dc.GetComponentInChildren<Device_Sundries>(true);
|
||
|
||
collector.plug.onPlugToClose += HighlightBtn;
|
||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
|
||
{
|
||
GetControl<Button>("connectBtn").interactable = false;
|
||
}
|
||
}
|
||
|
||
public override void HideMe()
|
||
{
|
||
base.HideMe();
|
||
collector.plug.onPlugToClose -= HighlightBtn;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 学习模式下,高亮按钮
|
||
/// </summary>
|
||
void HighlightBtn()
|
||
{
|
||
GetControl<Button>("connectBtn").interactable = true;
|
||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
|
||
{
|
||
if (collector != null && !collector.gameObject.name.Contains("原"))
|
||
{
|
||
collector.plug.transform.GetComponent<BoxCollider>().enabled = false;
|
||
}
|
||
RectTransform rect = GameObject.Find("connectBtn").GetComponent<RectTransform>();
|
||
GameManager.UIMgr.imageTips.ShowTips(rect);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 按钮点击
|
||
/// </summary>
|
||
/// <param name="btnName"></param>
|
||
protected override void OnClick(string btnName)
|
||
{
|
||
switch (btnName)
|
||
{
|
||
case "connectBtn":
|
||
if (collector != null && !collector.gameObject.name.Contains("原"))
|
||
{
|
||
GameManager.UIMgr.ShowPanel<UI_PlayerSessionPanel>(E_UI_Layer.Mid, (panel) =>
|
||
{
|
||
GameManager.EventMgr.EventTrigger<bool>(Enum_EventType.PlayerCanMove, false);
|
||
panel.Init(triggerName, "您好,xxx客户采集器更换完毕,请主站人员看下有没有抄录数据。", StationLeadTalk, 0);
|
||
});
|
||
}
|
||
else
|
||
{
|
||
TipPanel.ShowTip("召测失败");
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
private void StationLeadTalk(string triggerName)
|
||
{
|
||
//if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, false) == 0)
|
||
//{
|
||
GameManager.UIMgr.ShowPanel<UI_CustomSessionPanel>(E_UI_Layer.Mid, (panel) =>
|
||
{
|
||
|
||
panel.Init(triggerName, "您好,数据抄录正常。", "台区责任人", 1, WorkerReply);
|
||
});
|
||
//}
|
||
}
|
||
|
||
private void WorkerReply(string triggerName)
|
||
{
|
||
GameManager.UIMgr.HidePanel<UI_CustomSessionPanel>();
|
||
GameManager.UIMgr.ShowPanel<UI_PlayerSessionPanel>(E_UI_Layer.Mid, (panel) =>
|
||
{
|
||
panel.Init(triggerName, "好的", (str) => {
|
||
//GameManager.EventMgr.RemoveEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools_1);
|
||
GameManager.UIMgr.HidePanel<UI_PlayerSessionPanel>();
|
||
GameManager.EventMgr.EventTrigger<bool>(Enum_EventType.PlayerCanMove, true);
|
||
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true) == 0);
|
||
{
|
||
ScoreManager.instance.Check(triggerName, "采集故障处理完成");
|
||
}
|
||
sundries.gameObject.SetActive(true);
|
||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
|
||
{
|
||
GetControl<Button>("connectBtn").interactable = false;
|
||
}
|
||
}, 0);
|
||
});
|
||
}
|
||
}
|
||
|