75 lines
2.4 KiB
C#

using CG.Framework;
using CG.UTility;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace ZXK.GYJQR
{
public class AZBSExamPanel : UIBase
{
private Transform _erroTipTran = null;
private Text _tipText = null;
protected override void Awake()
{
base.Awake();
_tipText = GetWedage("TipText_N").GetComponent<Text>();
_erroTipTran = GetWedage("ErroTip_N").transform;
//顶部设置
UI_Manage.Instance.ShowPanel("OperationTopPanel", Type.GetType("ZXK.GYJQR.OperationTopPanel"), UIGroup.Top);
StartCoroutine("LoadFirst");
}
private void OnEnable()
{
GameManager.Instance._DataAZBSHandler.CurAZBShandler.OnValueChanged+= OnDismountStepChanged;
}
private void OnDisable()
{
GameManager.Instance._DataAZBSHandler.CurAZBShandler.OnValueChanged -= OnDismountStepChanged;
}
private IEnumerator LoadFirst()
{
yield return new WaitForSeconds(0.02f);
OnSwitchStep();
}
private void OnDismountStepChanged(AZBS obj)
{
string curShowGeo = GameManager.Instance._DataAZBSHandler.CurAZBShandler.Value.stepName;
_tipText.text = obj.stepName;
}
/// <summary>
/// 切换下一个步骤
/// </summary>
public void OnSwitchStep()
{
foreach (AZBS item in GameManager.Instance._DataAZBSHandler.AZBSDataArray)
{
if (item.stepName.Equals("连接驱动电缆"))
{
GameManager.Instance._DataAZBSHandler.CurAZBShandler.Value = item;
StepManager.Instance.OnExcuteAZBS(ExcuteState.Excute);
}
}
}
/// <summary>
/// 考核模式操作错误提示
/// </summary>
/// <param name="tipTxt">提示内容</param>
/// <param name="showTime">停留时间</param>
public void ErroTipShow(string tipTxt)
{
_erroTipTran.Find("ErroTipText").GetComponent<Text>().text = tipTxt;
_erroTipTran.gameObject.SetActive(true);
StartCoroutine("HideTip", 1);
}
private IEnumerator HideTip(float time)
{
yield return new WaitForSeconds(time);
_erroTipTran.gameObject.SetActive(false);
}
}
}