using UnityEngine; using System.Collections; public class GenericUINotification : MonoBehaviour { ScreenBase screen; UILabel label; public GameObject SectionDialogButton; public GameObject SectionErrorButton; void Awake() { label = GetComponentInChildren(); screen = GetComponent(); Debug.Log("AddListener"); NotificationCenter.AddListener(OnShowGenericNotification, NotificationType.ShowGenericNotification); NotificationCenter.AddListener(OnShowGenericNotification, NotificationType.ShowDialogNotification); NotificationCenter.AddListener(OnShowGenericNotification, NotificationType.ShowDialogNotificationError); } void OnDestroy() { NotificationCenter.RemoveListener(OnShowGenericNotification, NotificationType.ShowGenericNotification); NotificationCenter.RemoveListener(OnShowGenericNotification, NotificationType.ShowDialogNotification); NotificationCenter.RemoveListener(OnShowGenericNotification, NotificationType.ShowDialogNotificationError); } public void OnShowGenericNotification(Notification note) { //Debug.Log("OnShowGenericNotification"); label.text = (string)note.data; screen.Show(); screen.Invoke("Hide", 3); } public void ShowDialogNotification(Notification note) { //Debug.Log("OnShowGenericNotification"); label.text = (string)note.data; screen.Show(); SectionDialogButton.SetActive(true); SectionErrorButton.SetActive(false); } public void CloseDialogNotification() { SectionDialogButton.SetActive(false); screen.Hide(); } public void CloseAccessDialogNotificationWithYes() { SectionDialogButton.SetActive(false); SectionErrorButton.SetActive(false); screen.Hide(); } public void ShowDialogNotificationError(Notification note) { label.text = (string)note.data; screen.Show(); SectionDialogButton.SetActive(false); SectionErrorButton.SetActive(true); } }