refactor(modules): 适配新的组件注册接口

更新各模块 RuntimeModule 使用 IComponentRegistry 接口:
- audio, behavior-tree, camera
- sprite, tilemap, world-streaming
This commit is contained in:
yhh
2025-12-16 11:12:17 +08:00
parent 03229ffb59
commit 39fa797299
6 changed files with 12 additions and 15 deletions

View File

@@ -1,9 +1,9 @@
import type { ComponentRegistry as ComponentRegistryType } from '@esengine/ecs-framework';
import type { IComponentRegistry } from '@esengine/ecs-framework';
import type { IRuntimeModule, IRuntimePlugin, ModuleManifest } from '@esengine/engine-core';
import { AudioSourceComponent } from './AudioSourceComponent';
class AudioRuntimeModule implements IRuntimeModule {
registerComponents(registry: typeof ComponentRegistryType): void {
registerComponents(registry: IComponentRegistry): void {
registry.register(AudioSourceComponent);
}
}

View File

@@ -1,5 +1,4 @@
import type { IScene, ServiceContainer } from '@esengine/ecs-framework';
import { ComponentRegistry } from '@esengine/ecs-framework';
import type { IScene, ServiceContainer, IComponentRegistry } from '@esengine/ecs-framework';
import type { IRuntimeModule, IRuntimePlugin, ModuleManifest, SystemContext } from '@esengine/engine-core';
import { AssetManagerToken } from '@esengine/asset-system';
@@ -17,7 +16,7 @@ export { BehaviorTreeSystemToken } from './tokens';
class BehaviorTreeRuntimeModule implements IRuntimeModule {
private _loaderRegistered = false;
registerComponents(registry: typeof ComponentRegistry): void {
registerComponents(registry: IComponentRegistry): void {
registry.register(BehaviorTreeRuntimeComponent);
}

View File

@@ -1,11 +1,11 @@
import type { ComponentRegistry as ComponentRegistryType, IScene } from '@esengine/ecs-framework';
import type { IComponentRegistry, IScene } from '@esengine/ecs-framework';
import type { IRuntimeModule, IRuntimePlugin, ModuleManifest, SystemContext } from '@esengine/engine-core';
import { EngineBridgeToken } from '@esengine/engine-core';
import { CameraComponent } from './CameraComponent';
import { CameraSystem } from './CameraSystem';
class CameraRuntimeModule implements IRuntimeModule {
registerComponents(registry: typeof ComponentRegistryType): void {
registerComponents(registry: IComponentRegistry): void {
registry.register(CameraComponent);
}

View File

@@ -1,4 +1,4 @@
import type { ComponentRegistry as ComponentRegistryType, IScene } from '@esengine/ecs-framework';
import type { IComponentRegistry, IScene } from '@esengine/ecs-framework';
import type { IRuntimeModule, IRuntimePlugin, ModuleManifest, SystemContext } from '@esengine/engine-core';
import { SpriteComponent } from './SpriteComponent';
import { SpriteAnimatorComponent } from './SpriteAnimatorComponent';
@@ -11,7 +11,7 @@ export type { SystemContext, ModuleManifest, IRuntimeModule, IRuntimePlugin };
export { SpriteAnimatorSystemToken } from './tokens';
class SpriteRuntimeModule implements IRuntimeModule {
registerComponents(registry: typeof ComponentRegistryType): void {
registerComponents(registry: IComponentRegistry): void {
registry.register(SpriteComponent);
registry.register(SpriteAnimatorComponent);
}

View File

@@ -1,5 +1,4 @@
import type { IScene } from '@esengine/ecs-framework';
import { ComponentRegistry } from '@esengine/ecs-framework';
import type { IScene, IComponentRegistry } from '@esengine/ecs-framework';
import type { IRuntimeModule, IRuntimePlugin, ModuleManifest, SystemContext } from '@esengine/engine-core';
import { AssetManagerToken } from '@esengine/asset-system';
import { RenderSystemToken } from '@esengine/ecs-engine-bindgen';
@@ -26,7 +25,7 @@ class TilemapRuntimeModule implements IRuntimeModule {
private _tilemapPhysicsSystem: TilemapPhysicsSystem | null = null;
private _loaderRegistered = false;
registerComponents(registry: typeof ComponentRegistry): void {
registerComponents(registry: IComponentRegistry): void {
registry.register(TilemapComponent);
registry.register(TilemapCollider2DComponent);
}

View File

@@ -1,5 +1,4 @@
import type { IScene, ServiceContainer } from '@esengine/ecs-framework';
import { ComponentRegistry } from '@esengine/ecs-framework';
import type { IScene, ServiceContainer, IComponentRegistry } from '@esengine/ecs-framework';
import type { IRuntimeModule, SystemContext } from '@esengine/engine-core';
import { ChunkComponent } from './components/ChunkComponent';
import { StreamingAnchorComponent } from './components/StreamingAnchorComponent';
@@ -22,7 +21,7 @@ export class WorldStreamingModule implements IRuntimeModule {
return this._chunkManager;
}
registerComponents(registry: typeof ComponentRegistry): void {
registerComponents(registry: IComponentRegistry): void {
registry.register(ChunkComponent);
registry.register(StreamingAnchorComponent);
registry.register(ChunkLoaderComponent);