diff --git a/assets/module/common/CCEntity.ts b/assets/module/common/CCEntity.ts index 241a587..3f4dc74 100644 --- a/assets/module/common/CCEntity.ts +++ b/assets/module/common/CCEntity.ts @@ -12,6 +12,7 @@ import { CCView } from "./CCView"; import { CCViewVM } from "./CCViewVM"; export type ECSCtor = __private.__types_globals__Constructor | __private.__types_globals__AbstractedConstructor; +export type ECSView = CCViewVM | CCView; /** ECS 游戏模块实体 */ export abstract class CCEntity extends ecs.Entity { @@ -55,7 +56,7 @@ export abstract class CCEntity extends ecs.Entity { * @param path 显示资源地址 * @param bundleName 资源包名称 */ - addPrefab(ctor: ECSCtor, parent: Node, path: string, bundleName: string = resLoader.defaultBundleName) { + addPrefab(ctor: ECSCtor, parent: Node, path: string, bundleName: string = resLoader.defaultBundleName) { const node = ViewUtil.createPrefabNode(path, bundleName); const comp = node.getComponent(ctor)!; this.add(comp); @@ -68,7 +69,7 @@ export abstract class CCEntity extends ecs.Entity { * @param params 界面参数 * @returns 界面节点 */ - addUi(ctor: ECSCtor, params?: UIParam): Promise { + addUi(ctor: ECSCtor, params?: UIParam): Promise { return new Promise(async (resolve, reject) => { const key = gui.internal.getKey(ctor); if (key) { diff --git a/assets/module/common/CCView.ts b/assets/module/common/CCView.ts index 7d93c31..01ccbe5 100644 --- a/assets/module/common/CCView.ts +++ b/assets/module/common/CCView.ts @@ -24,7 +24,7 @@ import { GameComponent } from './GameComponent'; * @example @ccclass('RoleViewComp') @ecs.register('RoleView', false) -export class RoleViewComp extends CCView { +export class RoleViewComp extends CCView { @property({ type: sp.Skeleton, tooltip: '角色动画' }) spine: sp.Skeleton = null!; @@ -33,12 +33,12 @@ export class RoleViewComp extends CCView { } } */ -export abstract class CCView extends GameComponent implements ecs.IComp { +export abstract class CCView extends GameComponent implements ecs.IComp { static tid: number = -1; static compName: string; canRecycle!: boolean; - ent!: CCEntity; + ent!: T; tid: number = -1; /** 从父节点移除自己 */ diff --git a/assets/module/common/CCViewVM.ts b/assets/module/common/CCViewVM.ts index c394e14..6f1219c 100644 --- a/assets/module/common/CCViewVM.ts +++ b/assets/module/common/CCViewVM.ts @@ -25,7 +25,7 @@ import { CCEntity } from './CCEntity'; * @example @ccclass('LoadingViewComp') @ecs.register('LoadingView', false) -export class LoadingViewComp extends CCViewVM { +export class LoadingViewComp extends CCViewVM { // VM 组件绑定数据 data: any = { // 加载资源当前进度 @@ -45,12 +45,12 @@ export class LoadingViewComp extends CCViewVM { } } */ -export abstract class CCViewVM extends VMParent implements ecs.IComp { +export abstract class CCViewVM extends VMParent implements ecs.IComp { static tid: number = -1; static compName: string; canRecycle!: boolean; - ent!: CCEntity; + ent!: T; tid: number = -1; /** 从父节点移除自己 */