移除了功能重复的ComponentTypeManager

This commit is contained in:
YHH
2025-10-14 18:19:08 +08:00
parent 96e0a9126f
commit 62e8ebe926
8 changed files with 19 additions and 129 deletions

View File

@@ -3,7 +3,7 @@ import { Entity } from '../../../src/ECS/Entity';
import { Component } from '../../../src/ECS/Component';
import { EntitySystem } from '../../../src/ECS/Systems/EntitySystem';
import { Matcher } from '../../../src/ECS/Utils/Matcher';
import { ComponentTypeManager } from '../../../src/ECS/Utils/ComponentTypeManager';
import { ComponentRegistry } from '../../../src/ECS/Core/ComponentStorage';
// 简单的测试组件
class HealthComponent extends Component {
@@ -34,7 +34,7 @@ describe('MinimalSystemInit - 最小化系统初始化测试', () => {
let scene: Scene;
beforeEach(() => {
ComponentTypeManager.instance.reset();
ComponentRegistry.reset();
scene = new Scene();
});
@@ -52,7 +52,7 @@ describe('MinimalSystemInit - 最小化系统初始化测试', () => {
entity.addComponent(new HealthComponent(100));
console.log('[Test] Entity created with HealthComponent');
console.log('[Test] ComponentTypeManager registered types:', ComponentTypeManager.instance.registeredTypeCount);
console.log('[Test] ComponentRegistry registered types:', ComponentRegistry.getRegisteredCount());
// 2. 验证QuerySystem能查询到实体
const queryResult = scene.querySystem.queryAll(HealthComponent);

View File

@@ -3,7 +3,7 @@ import { Entity } from '../../../src/ECS/Entity';
import { Component } from '../../../src/ECS/Component';
import { EntitySystem } from '../../../src/ECS/Systems/EntitySystem';
import { Matcher } from '../../../src/ECS/Utils/Matcher';
import { ComponentTypeManager } from '../../../src/ECS/Utils/ComponentTypeManager';
import { ComponentRegistry } from '../../../src/ECS/Core/ComponentStorage';
// 测试组件
class PositionComponent extends Component {
@@ -71,7 +71,7 @@ describe('MultiSystemInit - 多系统初始化测试', () => {
let scene: Scene;
beforeEach(() => {
ComponentTypeManager.instance.reset();
ComponentRegistry.reset();
scene = new Scene();
});
@@ -91,7 +91,7 @@ describe('MultiSystemInit - 多系统初始化测试', () => {
entity.addComponent(new HealthComponent(100));
console.log('[Test] Entity created with Position, Velocity, Health');
console.log('[Test] ComponentTypeManager registered types:', ComponentTypeManager.instance.registeredTypeCount);
console.log('[Test] ComponentRegistry registered types:', ComponentRegistry.getRegisteredCount());
// 2. 验证QuerySystem能查询到实体
const movementQuery = scene.querySystem.queryAll(PositionComponent, VelocityComponent);

View File

@@ -3,7 +3,6 @@ import { Entity } from '../../../src/ECS/Entity';
import { Component } from '../../../src/ECS/Component';
import { EntitySystem } from '../../../src/ECS/Systems/EntitySystem';
import { Matcher } from '../../../src/ECS/Utils/Matcher';
import { ComponentTypeManager } from '../../../src/ECS/Utils/ComponentTypeManager';
/**
* System初始化测试套件