调试实体和组件属性

This commit is contained in:
YHH
2025-10-16 11:55:41 +08:00
parent fcf3def284
commit c876edca0c
7 changed files with 525 additions and 50 deletions

View File

@@ -206,7 +206,8 @@ export class DebugManager implements IService, IUpdatable {
return;
}
const expandedData = this.entityCollector.expandLazyObject(entityId, componentIndex, propertyPath);
const scene = this.sceneManager.currentScene;
const expandedData = this.entityCollector.expandLazyObject(entityId, componentIndex, propertyPath, scene);
this.webSocketManager.send({
type: 'expand_lazy_object_response',
@@ -238,7 +239,8 @@ export class DebugManager implements IService, IUpdatable {
return;
}
const properties = this.entityCollector.getComponentProperties(entityId, componentIndex);
const scene = this.sceneManager.currentScene;
const properties = this.entityCollector.getComponentProperties(entityId, componentIndex, scene);
this.webSocketManager.send({
type: 'get_component_properties_response',
@@ -261,7 +263,8 @@ export class DebugManager implements IService, IUpdatable {
try {
const { requestId } = message;
const rawEntityList = this.entityCollector.getRawEntityList();
const scene = this.sceneManager.currentScene;
const rawEntityList = this.entityCollector.getRawEntityList(scene);
this.webSocketManager.send({
type: 'get_raw_entity_list_response',
@@ -293,7 +296,8 @@ export class DebugManager implements IService, IUpdatable {
return;
}
const entityDetails = this.entityCollector.getEntityDetails(entityId);
const scene = this.sceneManager.currentScene;
const entityDetails = this.entityCollector.getEntityDetails(entityId, scene);
this.webSocketManager.send({
type: 'get_entity_details_response',

View File

@@ -263,8 +263,7 @@ export class EntityDataCollector {
componentCount: entity.components?.length || 0,
memory: 0
}))
.sort((a: any, b: any) => b.componentCount - a.componentCount)
.slice(0, 10);
.sort((a: any, b: any) => b.componentCount - a.componentCount);
}
@@ -303,7 +302,7 @@ export class EntityDataCollector {
});
if (archetype.entities) {
archetype.entities.slice(0, 5).forEach((entity: any) => {
archetype.entities.forEach((entity: any) => {
topEntities.push({
id: entity.id.toString(),
name: entity.name || `Entity_${entity.id}`,
@@ -352,7 +351,7 @@ export class EntityDataCollector {
});
if (archetype.entities) {
archetype.entities.slice(0, 5).forEach((entity: any) => {
archetype.entities.forEach((entity: any) => {
topEntities.push({
id: entity.id.toString(),
name: entity.name || `Entity_${entity.id}`,