add
This commit is contained in:
parent
a635cdf650
commit
71a9d3292f
@ -10,14 +10,15 @@ public class EventPopUp : MonoBehaviour
|
|||||||
public string text = "";
|
public string text = "";
|
||||||
public Image Image;
|
public Image Image;
|
||||||
public Text textobg;
|
public Text textobg;
|
||||||
|
public float time = 5f;
|
||||||
async void Start()
|
async void Start()
|
||||||
{
|
{
|
||||||
Canvas canvas = GetComponentInParent<Canvas>();
|
Canvas canvas = GetComponentInParent<Canvas>();
|
||||||
float canvasHeight = canvas.GetComponent<RectTransform>().rect.height;
|
float canvasHeight = canvas.GetComponent<RectTransform>().rect.height;
|
||||||
transform.DOMoveY(canvasHeight - (canvasHeight*0.3f), 1.5f);
|
transform.DOMoveY(canvasHeight - (canvasHeight*0.3f), 1.5f);
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
Image.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), 5f);
|
textobg.DOColor(new Color(1f, 1f, 1f, 0f), time);
|
||||||
await Task.Delay(5100);
|
await Task.Delay(5100);
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,10 @@ public class Base : MonoBehaviour
|
|||||||
await tcs.Task;
|
await tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEventPopUp(string Details)//Ìí¼Óµ¯´°
|
public void addEventPopUp(string Details,float time = 5f)//Ìí¼Óµ¯´°
|
||||||
{
|
{
|
||||||
GameObject prefab = Resources.Load<GameObject>("base/EventPopUp");
|
GameObject prefab = Resources.Load<GameObject>("base/EventPopUp");
|
||||||
|
prefab.GetComponent<EventPopUp>().time = time;
|
||||||
Canvas canvas = GetComponentInParent<Canvas>();
|
Canvas canvas = GetComponentInParent<Canvas>();
|
||||||
prefab.GetComponent<EventPopUp>().text = Details;
|
prefab.GetComponent<EventPopUp>().text = Details;
|
||||||
Instantiate(prefab, canvas.transform);
|
Instantiate(prefab, canvas.transform);
|
||||||
|
Loading…
Reference in New Issue
Block a user