30 lines
693 B
C#
30 lines
693 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Cryville.Common.Unity {
|
|
public class Popup : MonoBehaviour {
|
|
|
|
public string Message = "";
|
|
|
|
LayoutElement layout;
|
|
|
|
float timer = 0;
|
|
|
|
#pragma warning disable IDE0051
|
|
void Start() {
|
|
layout = GetComponent<LayoutElement>();
|
|
GetComponentInChildren<Text>().text = Message;
|
|
transform.SetParent(GameObject.Find("PopupList").transform);
|
|
layout.minHeight = 0;
|
|
}
|
|
|
|
void Update() {
|
|
if (timer <= 0.8f) layout.minHeight = timer * 50;
|
|
else if (timer >= 5f) GameObject.Destroy(gameObject);
|
|
else if (timer >= 4.2f) layout.minHeight = (300 - timer) * 50;
|
|
timer += Time.deltaTime;
|
|
}
|
|
#pragma warning restore IDE0051
|
|
}
|
|
}
|