ISAP/Assets/Scripts/UI/UIHint.cs

60 lines
971 B
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class UIHint : UIBase
{
public TextMeshProUGUI hintText;
public TextMeshProUGUI timedown;
public GameObject all;
float time;
float timer = 1.0f;
void Start()
{
}
private void Awake()
{
this.isTools = 1;
}
public void open()
{
all.gameObject.SetActive(true);
}
public void close()
{
all.gameObject.SetActive(false);
}
public void Init(string str)
{
hintText.text = str;
time = 3;
timedown.text = time + "秒后自动关闭";
}
void Update()
{
timer -= Time.deltaTime;
if (timer <= 0)
{
time--;
timedown.text = time + "秒后自动关闭";
if (time <= 0)
{
UIManager.Instance.HideHint();
}
timer = 1.0f;
}
}
}