10006_YanCheng_Metrology/Assets/Scripts/UI_ConnectStation.cs

103 lines
3.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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_6001 dc = null;
public override void ShowMe()
{
base.ShowMe();
//GameManager.EventMgr.AddEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools_1);
//GameObject seal_2 = GameObject.Find("电能表封印2");
//ds = seal_2.GetComponent<Device_Seal>();
//ds.cutAction += HighlightBtn;
dc = FindObjectOfType<Device_Control_6001>();
dc.collector.plug.onPlugToClose += HighlightBtn;
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
GetControl<Button>("connectBtn").interactable = false;
}
}
public override void HideMe()
{
base.HideMe();
dc.collector.plug.onPlugToClose -= HighlightBtn;
//GameManager.EventMgr.RemoveEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, TakeOutAndRetrievingTheTools_1);
//GameObject seal_2 = GameObject.Find("电能表封印2");
//ds.cutAction -= HighlightBtn;
}
/// <summary>
/// 学习模式下,高亮按钮
/// </summary>
void HighlightBtn()
{
GetControl<Button>("connectBtn").interactable = true;
//if (reinstalled)
//{
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
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":
GameManager.UIMgr.ShowPanel<UI_PlayerSessionPanel>(E_UI_Layer.Mid, (panel) =>
{
GameManager.EventMgr.EventTrigger<bool>(Enum_EventType.PlayerCanMove, false);
panel.Init(triggerName, "您好xxx客户采集器更换完毕请主站人员看下有没有抄录数据。", StationLeadTalk, 0);
});
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, "采集故障处理完成");
}
Device_Control_6001 ds = (Device_Control_6001)FindObjectOfType<Device_Control>();
ds.sundries.gameObject.SetActive(true);
}, 0);
});
}
}