登录页一些效果,接路线列表页

This commit is contained in:
Caiyanpeng committed 2021-03-30 14:14:24 +08:00
1 parent d1d9c92f1c
commit f45711f39f
78 files changed
+9990 -5830

No files matched your search

+15 -9
View File
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using DG.Tweening;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -16,16 +17,21 @@ namespace Assets.Scripts
/*显示简略提示,需要拖Toast的预制件,且保证其他组件名字不是Toast,ToastContainer*/
public static void showToast(GameObject game,string text,int duration = 1)
{
var toast = Utils.FindUpParent(game.transform).Find("ToastContainer");
if (toast!=null)
var parent = Utils.FindUpParent(game.transform);
var toast = parent.Find("ToastContainer");
if (toast == null)
{
toast.GetComponent<Toast>().showToast(JsonConvert.SerializeObject(new
{
text,
duration
}));
//toast.SendMessage("showToast", );
var newToast = MonoBehaviour.Instantiate(Resources.Load<GameObject>("UI/Prefab/ToastContainer"));
newToast.name = "ToastContainer";
newToast.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
newToast.transform.parent = parent;
toast = newToast.transform;
}
toast.GetComponent<Toast>().showToast(JsonConvert.SerializeObject(new
{
text,
duration
}));
}
/*显示简略提示,需要拖Toast的预制件,且保证其他组件名字不是Toast,ToastContainer*/