using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using AX.MessageSystem;

public class NodeDetailShow : MonoBehaviour, IPointerClickHandler
{
    public Text detail;
    public ReplayManager replayManager;
    public bool control = false;
    private float time;
    public TagShow TagShow;
    // Use this for initialization
    void Start()
    {
        TagShow = transform.GetComponentInParent<TagManager>().transform.Find("TagShow").GetComponent<TagShow>();
    }

    // Update is called once per frame
    void Update()
    {
        if (control)
        {
            time -= Time.deltaTime;
            if (time < 0)
            {             
                gameObject.SetActive(false);
                control = false;
                if (replayManager.playOrPause.isOn)//增加判断,防止在显示提示信息的时候点击了暂停播放
                {
                    replayManager.Play();
                }          
            }
        }
    }
    public void SetUI(string text)
    {
        detail.text = text;
        time = 5;
        control = true;      
    }

    public void OnPointerClick(PointerEventData eventData)
    {
        TagShow.tagDetail.SetActive(false);
        TagShow.tagMessage.SetActive(false);
        TagShow.gameObject.SetActive(false);

        //gameObject.SetActive(false);
        control = false;
        replayManager.Play();
    }
}