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

172 lines
6.6 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)
{
base.OnClick(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()
{
RectTransform ResTip_Up = ToolFuncManager.GetChild(TransResultPanel.transform, "ResTip_Up").GetComponent<RectTransform>();
RectTransform ResTip_Down = ToolFuncManager.GetChild(TransResultPanel.transform, "ResTip_Down").GetComponent<RectTransform>();
Vector3 upPos = ResTip_Up.localPosition;
Vector3 downPos = ResTip_Down.localPosition;
ResTip_Up.localPosition = new Vector3(upPos.x, upPos.y + 60, upPos.z);
ResTip_Down.localPosition = new Vector3(downPos.x, downPos.y + 60, downPos.z);
TransResultPanel.SetActive(true);//显示透抄结果面板
ResTip_Up.DOLocalMove(upPos, 0.4f);
ResTip_Down.DOLocalMove(downPos, 0.4f);
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()
{
RectTransform ResTip_Up = ToolFuncManager.GetChild(InterrogationPanel.transform, "ResTip_Up").GetComponent<RectTransform>();
RectTransform ResTip_Down = ToolFuncManager.GetChild(InterrogationPanel.transform, "ResTip_Down").GetComponent<RectTransform>();
Vector3 upPos = ResTip_Up.localPosition;
Vector3 downPos = ResTip_Down.localPosition;
ResTip_Up.localPosition = new Vector3(upPos.x, upPos.y + 60, upPos.z);
ResTip_Down.localPosition = new Vector3(downPos.x, downPos.y + 60, downPos.z);
InterrogationPanel.SetActive(true);//显示召测面板
ResTip_Up.DOLocalMove(upPos, 0.4f);
ResTip_Down.DOLocalMove(downPos, 0.4f);
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);
}
}
}
}