From 71a9d3292fe8b2a43213feeb467e034d2c80e2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=88=92=E8=8D=A3=E6=A3=AE?= <7716842+shurongsen@user.noreply.gitee.com> Date: Tue, 26 Nov 2024 18:19:49 +0800 Subject: [PATCH] add --- TheStrongestSnail/Assets/common/base/EventPopUp.cs | 5 +++-- TheStrongestSnail/Assets/common/base/base.cs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TheStrongestSnail/Assets/common/base/EventPopUp.cs b/TheStrongestSnail/Assets/common/base/EventPopUp.cs index 85c34f9..3c6f8a5 100644 --- a/TheStrongestSnail/Assets/common/base/EventPopUp.cs +++ b/TheStrongestSnail/Assets/common/base/EventPopUp.cs @@ -10,14 +10,15 @@ public class EventPopUp : MonoBehaviour public string text = ""; public Image Image; public Text textobg; + public float time = 5f; async void Start() { Canvas canvas = GetComponentInParent(); float canvasHeight = canvas.GetComponent().rect.height; transform.DOMoveY(canvasHeight - (canvasHeight*0.3f), 1.5f); await Task.Delay(500); - Image.DOColor(new Color(1f, 1f, 1f, 0f), 5f); - textobg.DOColor(new Color(1f, 1f, 1f, 0f), 5f); + Image.DOColor(new Color(1f, 1f, 1f, 0f), time); + textobg.DOColor(new Color(1f, 1f, 1f, 0f), time); await Task.Delay(5100); Destroy(gameObject); } diff --git a/TheStrongestSnail/Assets/common/base/base.cs b/TheStrongestSnail/Assets/common/base/base.cs index c539582..b62ae1f 100644 --- a/TheStrongestSnail/Assets/common/base/base.cs +++ b/TheStrongestSnail/Assets/common/base/base.cs @@ -31,9 +31,10 @@ public class Base : MonoBehaviour await tcs.Task; } - public void addEventPopUp(string Details)//Ìí¼Óµ¯´° + public void addEventPopUp(string Details,float time = 5f)//Ìí¼Óµ¯´° { GameObject prefab = Resources.Load("base/EventPopUp"); + prefab.GetComponent().time = time; Canvas canvas = GetComponentInParent(); prefab.GetComponent().text = Details; Instantiate(prefab, canvas.transform);