优化CCEntity语法

This commit is contained in:
dgflash
2026-01-10 13:04:00 +08:00
parent f2fe9d47b6
commit cddf9e142c
2 changed files with 2 additions and 5 deletions

View File

@@ -187,8 +187,6 @@ export namespace ecs {
entity.isValid = true;
entity.init();
}
else
console.error(`${ctor.name} 实体缺少 init 方法初始化默认组件`);
ECSModel.eid2Entity.set(entity.eid, entity);
return entity as T;

View File

@@ -17,7 +17,7 @@ type ECSCtor<T extends ecs.Comp> =
| __private.__types_globals__AbstractedConstructor<T>;
type ECSView = CCView<CCEntity>;
type EntityCtor<T extends CCEntity = CCEntity> = new (...args: any[]) => T;
type BusinessCtor<T extends CCBusiness<CCEntity> = CCBusiness<CCEntity>> = new () => T;
type BusinessCtor<T extends CCBusiness<CCEntity> = CCBusiness<CCEntity>> = new (...args: any[]) => T;
/** ECS 游戏模块实体 */
export abstract class CCEntity extends ecs.Entity {
@@ -135,8 +135,7 @@ export abstract class CCEntity extends ecs.Entity {
if (params == null) {
params = { preload: true };
}
else {
} else {
params.preload = true;
}