EventMng.ts 701 B

123456789101112131415161718192021
  1. // // 偷懒,直接用EventTarget
  2. // export default new cc.EventTarget();
  3. export type EventHanlder = { target?: any } & ((...args: any[]) => void)
  4. export default class EventMng {
  5. static on(type: string, callBack: Function, target: any) {
  6. cc.game.on(type, callBack, target)
  7. }
  8. static emit(type: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) {
  9. cc.game.emit(type, arg1, arg2, arg3, arg4, arg5)
  10. }
  11. static off(type: string, callBack: Function, target: any): void {
  12. cc.game.off(type, callBack, target)
  13. }
  14. static clear(type: string): void {
  15. cc.game.off(type)
  16. }
  17. static clearAll(): void {
  18. cc.game.clear()
  19. }
  20. }