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);