94 lines
3.0 KiB
C#
94 lines
3.0 KiB
C#
using System.Collections;
|
||
using TMPro;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class UI_SessionPanel : BasePanel
|
||
{
|
||
private int triggerID;
|
||
public float TypeTime = 0.1f;
|
||
public int state;
|
||
/// <summary>
|
||
/// 初始化,state 0 先打开客户,1 先打开本人
|
||
/// </summary>
|
||
public void Init(int triggerID, int state, string playTalk, string clientTalk)
|
||
{
|
||
this.triggerID = triggerID;
|
||
this.state = state;
|
||
GetControl<TextMeshProUGUI>("PlayerText_DialogBox").text = playTalk /*"我是xxx供电所人员,到xxx地方开展经互感器接入式低压电能计量装置安装作业。"*/;
|
||
GetControl<TextMeshProUGUI>("ClientText_DialogBox").text = clientTalk /*"好的"*/;
|
||
GetControl<Image>("PlayerSessionPanel").gameObject.SetActive(state != 0);
|
||
GetControl<Image>("ClientSessionPanel").gameObject.SetActive(state == 0);
|
||
//StartCoroutine(Typing("好的"));
|
||
}
|
||
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":
|
||
if (state == 1)
|
||
{
|
||
GetControl<Image>("PlayerSessionPanel").gameObject.SetActive(false);
|
||
GetControl<Image>("ClientSessionPanel").gameObject.SetActive(true);
|
||
state = -1;
|
||
}
|
||
else
|
||
{
|
||
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerID, true) == 0)
|
||
{
|
||
GameManager.UIMgr.HidePanel<UI_SessionPanel>();
|
||
}
|
||
|
||
}
|
||
break;
|
||
case "ClientContinueBtn":
|
||
if (state == 0)
|
||
{
|
||
GetControl<Image>("PlayerSessionPanel").gameObject.SetActive(true);
|
||
GetControl<Image>("ClientSessionPanel").gameObject.SetActive(false);
|
||
state = -1;
|
||
}
|
||
else
|
||
{
|
||
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerID, true) == 0)
|
||
{
|
||
GameManager.UIMgr.HidePanel<UI_SessionPanel>();
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
}
|