summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Tools/Notification/NotificationExtensions.cs
blob: 3055484778d9625b21bdc4dd4dd7a1c08812c608 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;

namespace WK
{

    /// <summary>
    /// 作为消息发布者实现这个接口
    /// </summary>
    public interface INotification
    {
    }

    public static class NotificationExtensions
    {
        public static void AddObserver(this INotification _this, string msg, NotificationCenter.NotificatonHandler handler) { NotificationCenter.Instance.AddObserver(_this, msg, handler); }
        public static void RemoveObserver(this INotification _this, string msg, NotificationCenter.NotificatonHandler handler) { NotificationCenter.Instance.RemoveObserver(_this, msg, handler); }
        public static void PostNotification(this INotification _this, string msg, params object[] p) { NotificationCenter.Instance.PostNotification(_this, msg, p); }
    }
}