mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-07 19:07:30 +08:00
优化GameComponent的全局消息事件
This commit is contained in:
@@ -39,11 +39,11 @@ export class EventDispatcher {
|
||||
* @param event 事件名
|
||||
* @param args 事件参数
|
||||
*/
|
||||
dispatchEvent(event: string, args: any = null) {
|
||||
dispatchEvent(event: string, ...args: any) {
|
||||
if (this._msg == null) {
|
||||
this._msg = new MessageEventData();
|
||||
}
|
||||
this._msg.dispatchEvent(event, args);
|
||||
this._msg.dispatchEvent(event, ...args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ export class MessageEventData {
|
||||
* @param args(any) 事件参数
|
||||
*/
|
||||
dispatchEvent(event: string, ...args: any) {
|
||||
MessageManager.Instance.dispatchEvent(event, args);
|
||||
MessageManager.Instance.dispatchEvent(event, ...args);
|
||||
}
|
||||
|
||||
/** 清除所有的全局事件监听 */
|
||||
|
||||
@@ -52,8 +52,8 @@ export class GameComponent extends Component {
|
||||
* @param event 事件名
|
||||
* @param args 事件参数
|
||||
*/
|
||||
dispatchEvent(event: string, args: any = null) {
|
||||
this.event.dispatchEvent(event, args);
|
||||
dispatchEvent(event: string, ...args: any) {
|
||||
this.event.dispatchEvent(event, ...args);
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user