// *********************************************************************** // Assembly : Unity // Author : Kimch // Created : 2018-03-28 // // Last Modified By : Kimch // Last Modified On : // *********************************************************************** // // // *********************************************************************** namespace G { using F.Events; /// /// 全局事件(不要使用匿名函数) /// public class GlobalEvent : EventBase { /// /// 发送事件 投放到队列 /// /// /// /// public static void Send(object sender, int id, object args) { new GlobalEvent(id, args).Send(sender); } /// /// 发送事件 立即执行 /// /// /// /// public static void SendImmediate(object sender, int id, object args) { new GlobalEvent(id, args).SendImmediate(sender); } /// /// 订阅事件 /// /// /// public static void Subscribe(int id, System.EventHandler handler) { KFramework.EventManager.Subscribe(id, handler); } /// /// 取消订阅事件 /// /// /// public static void Unsubscribe(int id, System.EventHandler handler) { KFramework.EventManager.Unsubscribe(id, handler); } public static void Unsubscribe(int id) { KFramework.EventManager.Unsubscribe(id); } private readonly int _eventId; private readonly object _eventArgs; private GlobalEvent(int id, object args) { _eventId = id; _eventArgs = args; } public override int eventId { get { return _eventId; } } public override object eventArgs { get { return _eventArgs; } } } }