觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.5 KiB

1 week ago
/*
* @Descripttion:
* @version: 1.0.0
* @Author: YeeChan
* @Date: 2020-07-09 18:54:41
*/
import { ryw_Event } from "../Event/EventEnum";
import { LogUtils } from "../Util/LogUtils";
/**
*
*/
export default class EventMgr {
private static eventTarget_custom: cc.EventTarget = new cc.EventTarget();
/**
* 广
* @param name
* @param arg1
* @param arg2
* @param arg3
* @param arg4
* @param arg5
*/
public static emitEvent_custom(name: ryw_Event, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) {
// LogUtils.info_custom("广播事件:" + name);
this.eventTarget_custom.emit(name + "", arg1, arg2, arg3, arg4, arg5);
}
/**
*
* `emit`
* @param name
* @param callback
* @param target
*/
public static onEvent_custom(name: ryw_Event, callback: Function, target: any): void {
this.eventTarget_custom.on(name + "", callback, target);
}
/**
*
*
* @param name
* @param callback
* @param target
*/
public static onceEvent_custom(name: ryw_Event, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void {
this.eventTarget_custom.once(name + "", callback, target);
}
/**
*
* useCapture name name
* @param name
* @param callback
* @param target
*/
public static offEvent_custom(name: ryw_Event, callback?: Function, target?: any): void {
this.eventTarget_custom.off(name + "", callback, target);
}
/**
* EventTarget指定目标target
EventTarget target
target EventTarget
* @param target
*/
public static offTargetEvent_custom(target: any): void {
this.eventTarget_custom.targetOff(target);
}
}