10006_YanCheng_Metrology/Assets/Scripts/ComputerSystem/UI_ComputerSystemJLZXJCPane...

151 lines
5.2 KiB
C#

using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UI_ComputerSystemJLZXJCPanel : UI_ComputerSystemBasePanel
{
public string triggerName = "";
public GameObject TransResultPanel;//结果面板
public GameObject InterrogationPanel;//召测面板
public GameObject ResultPanel;//结果面板
public GameObject transcribeBtn;//透抄按钮
public GameObject interrogationBtn;//召测按钮
bool IsTranscribed = false;//已经透抄
bool IsInterrogation = false;//已经召测
Tween tween3;
Tween tween4;
/// <summary>
/// 查询结果选中后出发
/// </summary>
/// <param name="b"></param>
public void ActiveBtn(bool b)
{
transcribeBtn.SetActive(b);
interrogationBtn.SetActive(b);
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
GameObject tip3 = ToolFuncManager.GetChild(this.transform, "ImageTips_3").gameObject;
ActiveEmbededTip(tip3, tween3);
GameObject tip4 = ToolFuncManager.GetChild(this.transform, "ImageTips_4").gameObject;
ActiveEmbededTip(tip4, tween4);
}
}
public override void ShowMe()
{
base.ShowMe();
TransResultPanel.SetActive(false);//透抄结果面板关闭
InterrogationPanel.SetActive(false);//召测面板关闭
ResultPanel.SetActive(false);//结果面板关闭
transcribeBtn.SetActive(false);//透抄按钮关闭
interrogationBtn.SetActive(false);//召测按钮关闭
IsTranscribed = false;//透抄结果为false
IsInterrogation = false;//召测结果为false
GetControl<Button>("closeBtn").gameObject.SetActive(true);
}
/// <summary>
/// 按钮点击
/// </summary>
/// <param name="btnName"></param>
protected override void OnClick(string btnName)
{
switch (btnName)
{
case "backBtn":
GameManager.UIMgr.HidePanel<UI_ComputerSystemJLZXJCPanel>();
GameManager.UIMgr.ShowPanel<UI_ComputerSystemHomePagePanel>();
break;
case "searchBtn":
ResultPanel.SetActive(true);//显示结果面板
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
ToolFuncManager.GetChild(this.transform, "ImageTips_1").gameObject.SetActive(false);//隐藏提示
GameObject tip2 = ToolFuncManager.GetChild(this.transform, "ImageTips_2").gameObject;
ActiveEmbededTip(tip2);
}
break;
case "transcribeBtn":
if (!IsTranscribed)
{
StartCoroutine(Transcribe());
}
break;
case "interrogationBtn":
if (!IsInterrogation)
{
StartCoroutine(Interrogation());
}
break;
case "closeBtn":
GameManager.UIMgr.HidePanel<UI_ComputerSystemJLZXJCPanel>();
if (IsTranscribed && IsInterrogation)
{
GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true);
ScoreManager.instance.Check(triggerName, "透抄检查完成");
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
if (tween != null)
tween.Kill(true);
GameObject tip5 = ToolFuncManager.GetChild(this.transform, "ImageTips_5").gameObject;
tip5.SetActive(false);
}
}
break;
}
}
/// <summary>
/// 透抄
/// </summary>
/// <returns></returns>
protected IEnumerator Transcribe()
{
TransResultPanel.SetActive(true);//显示透抄结果面板
yield return new WaitForSeconds(3);
TransResultPanel.SetActive(false);//隐藏透抄结果面板
IsTranscribed = true;//透抄结果为true
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
if (tween3 != null)
tween3.Kill(true);
GameObject tip3 = ToolFuncManager.GetChild(this.transform, "ImageTips_3").gameObject;
tip3.SetActive(false);
if (IsInterrogation)
{
GameObject tip5 = ToolFuncManager.GetChild(this.transform, "ImageTips_5").gameObject;
ActiveEmbededTip(tip5);
}
}
}
protected IEnumerator Interrogation()
{
InterrogationPanel.SetActive(true);//显示召测面板
yield return new WaitForSeconds(3);
InterrogationPanel.SetActive(false);//隐藏召测面板
IsInterrogation = true;//召测结果为true
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
if (tween4 != null)
tween4.Kill(true);
GameObject tip4 = ToolFuncManager.GetChild(this.transform, "ImageTips_4").gameObject;
tip4.SetActive(false);
if (IsTranscribed)
{
GameObject tip5 = ToolFuncManager.GetChild(this.transform, "ImageTips_5").gameObject;
ActiveEmbededTip(tip5);
}
}
}
}