/// <summary> /// 抛出事件(抛出事件时,请使用引用池生成事件处理者实例) /// </summary> /// <param name="sender">事件发送者</param> /// <param name="handler">事件处理类实例</param> public void Throw(object sender, EventHandlerBase handler) { Type type = handler.GetType(); if (_eventHandlerList.ContainsKey(type)) { if (_eventHandlerList[type] != null) { _eventHandlerList[type](sender, handler); Main.m_ReferencePool.Despawn(handler); } } else { throw new HTFrameworkException(HTFrameworkModule.Event, "抛出事件失败:不存在可以抛出的事件类型 " + type.Name + " !"); } }
/// <summary> /// 抛出三型事件(抛出事件时,请使用引用池生成事件处理者实例) /// </summary> /// <param name="handler">事件处理类实例</param> public void Throw(EventHandlerBase handler) { if (handler == null) { return; } Type type = handler.GetType(); if (EventHandlerList3.ContainsKey(type)) { if (EventHandlerList3[type] != null) { EventHandlerList3[type](handler); Main.m_ReferencePool.Despawn(handler); } } else { throw new HTFrameworkException(HTFrameworkModule.Event, "抛出III型事件失败:不存在可以抛出的事件类型 " + type.Name + " !"); } }
/// <summary> /// 抛出III型事件(抛出事件时,请使用引用池生成事件处理者实例) /// </summary> /// <param name="handler">事件处理类实例</param> public void Throw(EventHandlerBase handler) { _helper.Throw(handler); }
/// <summary> /// 抛出I型事件(抛出事件时,请使用引用池生成事件处理者实例) /// </summary> /// <param name="sender">事件发送者</param> /// <param name="handler">事件处理类实例</param> public void Throw(object sender, EventHandlerBase handler) { _helper.Throw(sender, handler); }