using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public delegate void NotificationDelegate(Notification notification);
public class NotificationManager
{
//单例
private static NotificationManager _Instance = null;
private NotificationManager() { }
public static NotificationManager GetInstance()
{
if (_Instance == null)
{
_Instance = new NotificationManager();
}
return _Instance;
}
//委托字典
private Dictionary<MessageType, NotificationDelegate> eventListeners = new Dictionary<MessageType, NotificationDelegate>();
/// <summary>
/// 添加,枚举为int类型并且作为键,说明会根据消息的类型在字典中分类。
/// </summary>
/// <param name="msgType">消息类型</param>