From 6cbbc06998b744e3feee5f92ab8e62b4a26b5ca7 Mon Sep 17 00:00:00 2001 From: YHH <359807859@qq.com> Date: Wed, 24 Sep 2025 10:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83jsdoc=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/ECS/Systems/EntitySystem.ts | 6 ++--- .../src/Utils/Debug/ComponentDataCollector.ts | 3 +++ packages/core/src/Utils/Debug/DebugManager.ts | 5 ++++ .../src/Utils/Debug/EntityDataCollector.ts | 24 +++++++++++++++++++ .../src/Utils/Debug/SceneDataCollector.ts | 1 + .../src/Utils/Debug/SystemDataCollector.ts | 2 ++ 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/packages/core/src/ECS/Systems/EntitySystem.ts b/packages/core/src/ECS/Systems/EntitySystem.ts index 80b55b0b..ad836a61 100644 --- a/packages/core/src/ECS/Systems/EntitySystem.ts +++ b/packages/core/src/ECS/Systems/EntitySystem.ts @@ -425,7 +425,7 @@ export abstract class EntitySystem implements ISystemBase { * * @param entities 要处理的实体列表 */ - protected process(_entities: Entity[]): void { + protected process(entities: Entity[]): void { // 子类必须实现此方法 } @@ -529,7 +529,7 @@ export abstract class EntitySystem implements ISystemBase { * * @param entity 被添加的实体 */ - protected onAdded(_entity: Entity): void { + protected onAdded(entity: Entity): void { // 子类可以重写此方法 } @@ -540,7 +540,7 @@ export abstract class EntitySystem implements ISystemBase { * * @param entity 被移除的实体 */ - protected onRemoved(_entity: Entity): void { + protected onRemoved(entity: Entity): void { // 子类可以重写此方法 } } \ No newline at end of file diff --git a/packages/core/src/Utils/Debug/ComponentDataCollector.ts b/packages/core/src/Utils/Debug/ComponentDataCollector.ts index 605df925..855ccc2f 100644 --- a/packages/core/src/Utils/Debug/ComponentDataCollector.ts +++ b/packages/core/src/Utils/Debug/ComponentDataCollector.ts @@ -11,6 +11,7 @@ export class ComponentDataCollector { /** * 收集组件数据(轻量版,不计算实际内存大小) + * @param scene 场景实例 */ public collectComponentData(scene?: IScene | null): IComponentDebugData { if (!scene) { @@ -167,6 +168,8 @@ export class ComponentDataCollector { /** * 为内存快照功能提供的详细内存计算 * 只在用户主动请求内存快照时调用 + * @param typeName 组件类型名称 + * @param scene 场景实例 */ public calculateDetailedComponentMemory(typeName: string, scene?: IScene | null): number { if (!scene) return this.getEstimatedComponentSize(typeName, scene); diff --git a/packages/core/src/Utils/Debug/DebugManager.ts b/packages/core/src/Utils/Debug/DebugManager.ts index f08613bd..71f49f9d 100644 --- a/packages/core/src/Utils/Debug/DebugManager.ts +++ b/packages/core/src/Utils/Debug/DebugManager.ts @@ -31,6 +31,11 @@ export class DebugManager { private sendInterval: number; private isRunning: boolean = false; + /** + * 构造调试管理器 + * @param core Core实例 + * @param config 调试配置 + */ constructor(core: any, config: IECSDebugConfig) { this.config = config; diff --git a/packages/core/src/Utils/Debug/EntityDataCollector.ts b/packages/core/src/Utils/Debug/EntityDataCollector.ts index 88f82ebc..d6116ed2 100644 --- a/packages/core/src/Utils/Debug/EntityDataCollector.ts +++ b/packages/core/src/Utils/Debug/EntityDataCollector.ts @@ -9,6 +9,10 @@ import { IScene } from '../../ECS/IScene'; * 实体数据收集器 */ export class EntityDataCollector { + /** + * 收集实体数据 + * @param scene 场景实例 + */ public collectEntityData(scene?: IScene | null): IEntityDebugData { if (!scene) { return this.getEmptyEntityDebugData(); @@ -50,6 +54,10 @@ export class EntityDataCollector { } + /** + * 获取原始实体列表 + * @param scene 场景实例 + */ public getRawEntityList(scene?: IScene | null): Array<{ id: number; name: string; @@ -86,6 +94,11 @@ export class EntityDataCollector { } + /** + * 获取实体详细信息 + * @param entityId 实体ID + * @param scene 场景实例 + */ public getEntityDetails(entityId: number, scene?: IScene | null): any { try { if (!scene) return null; @@ -152,6 +165,10 @@ export class EntityDataCollector { } + /** + * 收集实体数据(包含内存信息) + * @param scene 场景实例 + */ public collectEntityDataWithMemory(scene?: IScene | null): IEntityDebugData { if (!scene) { return this.getEmptyEntityDebugData(); @@ -751,6 +768,9 @@ export class EntityDataCollector { /** * 获取组件的完整属性信息(仅在需要时调用) + * @param entityId 实体ID + * @param componentIndex 组件索引 + * @param scene 场景实例 */ public getComponentProperties(entityId: number, componentIndex: number, scene?: IScene | null): Record { try { @@ -943,6 +963,10 @@ export class EntityDataCollector { /** * 展开懒加载对象(供调试面板调用) + * @param entityId 实体ID + * @param componentIndex 组件索引 + * @param propertyPath 属性路径 + * @param scene 场景实例 */ public expandLazyObject(entityId: number, componentIndex: number, propertyPath: string, scene?: IScene | null): any { try { diff --git a/packages/core/src/Utils/Debug/SceneDataCollector.ts b/packages/core/src/Utils/Debug/SceneDataCollector.ts index de41360b..d31fd314 100644 --- a/packages/core/src/Utils/Debug/SceneDataCollector.ts +++ b/packages/core/src/Utils/Debug/SceneDataCollector.ts @@ -9,6 +9,7 @@ export class SceneDataCollector { /** * 收集场景数据 + * @param scene 场景实例 */ public collectSceneData(scene?: IScene | null): ISceneDebugData { if (!scene) { diff --git a/packages/core/src/Utils/Debug/SystemDataCollector.ts b/packages/core/src/Utils/Debug/SystemDataCollector.ts index 22edea32..a7abdc53 100644 --- a/packages/core/src/Utils/Debug/SystemDataCollector.ts +++ b/packages/core/src/Utils/Debug/SystemDataCollector.ts @@ -8,6 +8,8 @@ import { IScene } from '../../ECS/IScene'; export class SystemDataCollector { /** * 收集系统数据 + * @param performanceMonitor 性能监视器实例 + * @param scene 场景实例 */ public collectSystemData(performanceMonitor: any, scene?: IScene | null): ISystemDebugData { if (!scene) {