12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using UnityEngine;
- using System.Collections;
- public class GenericUINotification : MonoBehaviour
- {
- ScreenBase screen;
- UILabel label;
- public GameObject SectionDialogButton;
- public GameObject SectionErrorButton;
- void Awake()
- {
- label = GetComponentInChildren<UILabel>();
- screen = GetComponent<ScreenBase>();
- 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);
- }
- }
|