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