123456789101112131415161718192021222324252627282930 |
- using UnityEngine;
- using System.Collections;
- public class GenericUINotification : MonoBehaviour
- {
- ScreenBase screen;
- UILabel label;
- void Awake()
- {
- label = GetComponentInChildren<UILabel>();
- screen = GetComponent<ScreenBase>();
- //Debug.Log("AddListener");
- NotificationCenter.AddListener(OnShowGenericNotification, NotificationType.ShowGenericNotification);
- }
- void OnDestroy()
- {
- NotificationCenter.RemoveListener(OnShowGenericNotification, NotificationType.ShowGenericNotification);
- }
- public void OnShowGenericNotification(Notification note)
- {
- Debug.Log("OnShowGenericNotification");
- label.text = (string)note.data;
- screen.Show();
- screen.Invoke("Hide", 3);
- }
- }
|