Megacity demo game for UOS
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

41 行
886 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Unity.MegaCity.UI
{
public class UIMessage : MonoBehaviour
{
public Text messageText;
public GameObject background;
public static UIMessage Instance
{
get;
private set;
}
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
else
{
Destroy(gameObject);
}
}
public void Show(string msg)
{
messageText.text = msg;
background.SetActive(true);
Invoke("Hide", 1.5f);
}
private void Hide()
{
background.SetActive(false);
}
}
}