新增组件/系统装饰器避免混淆

更改Set兼容web/小游戏
This commit is contained in:
YHH
2025-08-14 18:35:03 +08:00
parent 62f250b43c
commit 0b7e623748
19 changed files with 434 additions and 90 deletions

View File

@@ -9,6 +9,7 @@ import { Core } from '../../Core';
import { Component } from '../../ECS/Component';
import { ComponentPoolManager } from '../../ECS/Core/ComponentPool';
import { Pool } from '../../Utils/Pool';
import { getComponentInstanceTypeName, getSystemInstanceTypeName } from '../../ECS/Decorators';
/**
* 调试管理器
@@ -467,7 +468,7 @@ export class DebugManager {
if (!entity || entity.destroyed || !entity.components) continue;
for (const component of entity.components) {
const typeName = component.constructor.name;
const typeName = getComponentInstanceTypeName(component);
componentTypeCounts.set(typeName, (componentTypeCounts.get(typeName) || 0) + 1);
}
}
@@ -486,7 +487,7 @@ export class DebugManager {
if (!entity || entity.destroyed || !entity.components) continue;
for (const component of entity.components) {
if (component.constructor.name === typeName) {
if (getComponentInstanceTypeName(component) === typeName) {
instances.push({
entityId: entity.id,
entityName: entity.name || `Entity_${entity.id}`,
@@ -550,7 +551,7 @@ export class DebugManager {
const systemTypeMemoryCache = new Map<string, number>();
for (const system of entityProcessors.processors) {
const systemTypeName = system.constructor.name;
const systemTypeName = getSystemInstanceTypeName(system);
let systemMemory: number;
if (systemTypeMemoryCache.has(systemTypeName)) {