YanCheng_Metrology/Assets/Scripts/Project/UI/UI_Panel/UI_SessionPanel.cs

78 lines
2.2 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 TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UI_SessionPanel : BasePanel
{
private int triggerID;
public float TypeTime =0.1f;
private void Start()
{
Debug.Log("1111111");
}
/// <summary>
/// 初始化
/// </summary>
public void Init(int triggerID)
{
this.triggerID = triggerID;
GetControl<TextMeshProUGUI>("PlayerText_DialogBox").text = "我是xxx供电所人员到xxx地方开展经互感器接入式低压电能计量装置安装作业。";
}
public override void ShowMe()
{
}
public override void HideMe()
{
}
/// <summary>
/// 打字机
/// </summary>
/// <param name="content">需要显示文字</param>
/// <returns></returns>
IEnumerator Typing(string content)
{
GetControl<TextMeshProUGUI>(content).text = string.Empty;
string strTemp = string.Empty;
for (int i = 0; i < GetControl<TextMeshProUGUI>(content).text.Length; i++)
{
yield return new WaitForSeconds(TypeTime);
strTemp += GetControl<TextMeshProUGUI>(content).text[i];
GetControl<TextMeshProUGUI>(content).text = strTemp;
}
}
/// <summary>
/// 按钮点击
/// </summary>
/// <param name="btnName"></param>
protected override void OnClick(string btnName)
{
switch (btnName)
{
case "PlayerContinueBtn":
Debug.Log("点击继续按钮");
GetControl<Image>("PlayerSessionPanel").gameObject.SetActive(false);
GetControl<Image>("ClientSessionPanel").gameObject.SetActive(true);
//StartCoroutine(Typing("好的"));
GetControl<TextMeshProUGUI>("ClientText_DialogBox").text = "好的";
break;
case "ClientContinueBtn":
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerID, true) == 0)
{
GameManager.UIMgr.HidePanel<UI_SessionPanel>();
}
break;
//case "CloseBtn":
// this.gameObject.SetActive(false);
// break;
}
}
}