diff --git a/assets/module/common/CCBusiness.ts b/assets/module/common/CCBusiness.ts index d62e1e8..e8a6836 100644 --- a/assets/module/common/CCBusiness.ts +++ b/assets/module/common/CCBusiness.ts @@ -10,8 +10,8 @@ import { ListenerFunc } from "../../core/common/event/EventMessage"; import { CCEntity } from "./CCEntity"; /** 业务逻辑 */ -export class CCBusiness { - ent!: CCEntity; +export class CCBusiness { + ent!: T; /** 业务逻辑初始化 */ protected init() { diff --git a/assets/module/common/CCEntity.ts b/assets/module/common/CCEntity.ts index 0efd3b8..f33161e 100644 --- a/assets/module/common/CCEntity.ts +++ b/assets/module/common/CCEntity.ts @@ -119,14 +119,14 @@ export abstract class CCEntity extends ecs.Entity { //#region 游戏业务层管理 /** 模块业务逻辑组件 */ - private businesss: Map = null!; + private businesss: Map> = null!; /** * 批量添加组件 * @param ctors 组件类 * @returns */ - addBusinesss(...clss: any[]) { + addBusinesss>(...clss: any[]) { for (let ctor of clss) { this.addBusiness(ctor); } @@ -137,7 +137,7 @@ export abstract class CCEntity extends ecs.Entity { * @param cls 业务逻辑组件类 * @returns 业务逻辑组件实例 */ - addBusiness(cls: any): T { + addBusiness>(cls: any): T { if (this.businesss == null) this.businesss = new Map(); if (this.businesss.has(cls)) { console.error(`${cls.name} 业务逻辑组件已存在`); @@ -155,7 +155,7 @@ export abstract class CCEntity extends ecs.Entity { * @param cls 业务逻辑组件类 * @returns 业务逻辑组件实例 */ - getBusiness(cls: any): T { + getBusiness>(cls: any): T { return this.businesss.get(cls) as T; }