先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
using System.Threading.Tasks;
|
|
using DG.Tweening;
|
|
using GameCore;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class ToastPanel : MonoBehaviour
|
|
{
|
|
private TMP_Text text_toast;
|
|
private CanvasGroup canvasGroup;
|
|
static ToastPanel _instance;
|
|
static bool isShowing = false;
|
|
public static async void Show(string text)
|
|
{
|
|
await ShowInit();
|
|
if (_instance == null)
|
|
{
|
|
return;
|
|
}
|
|
_instance.gameObject.SetActive(false);
|
|
_instance.transform.SetAsLastSibling();
|
|
_instance.SetToast(text);
|
|
_instance.gameObject.SetActive(true);
|
|
}
|
|
|
|
private static async Task ShowInit()
|
|
{
|
|
if (!isShowing)
|
|
{
|
|
isShowing = true;
|
|
GameObject loading = await UIManager.Instance.GetUIAsync(UITypes.ToastPanel);
|
|
|
|
if (loading != null)
|
|
{
|
|
_instance = loading.GetComponent<ToastPanel>();
|
|
}
|
|
}
|
|
}
|
|
private void OnDestroy()
|
|
{
|
|
isShowing = false;
|
|
}
|
|
private void Awake()
|
|
{
|
|
text_toast = transform.Find("resource/p_text").GetComponent<TMP_Text>();
|
|
canvasGroup = GetComponent<CanvasGroup>();
|
|
}
|
|
|
|
void SetToast(string text)
|
|
{
|
|
text_toast.text = text;
|
|
}
|
|
}
|