namespace GFramework.Core.Abstractions.events; /// /// 事件总线接口,提供事件的发送、注册和注销功能 /// public interface IEventBus { /// /// 发送事件,自动创建事件实例 /// /// 事件类型,必须具有无参构造函数 void Send() where T : new(); /// /// 发送指定的事件实例 /// /// 事件类型 /// 事件实例 void Send(T e); /// /// 注册事件监听器 /// /// 事件类型 /// 事件处理回调函数 /// 反注册接口,用于注销事件监听 IUnRegister Register(Action onEvent); /// /// 注销事件监听器 /// /// 事件类型 /// 要注销的事件处理回调函数 void UnRegister(Action onEvent); }