refactor: 类型安全与接口清理 (#311)
* refactor: 分解 IEngineBridge 为单一职责接口 - 新增 ITextureService, IDynamicAtlasService, ICoordinateService, IRenderConfigService - 移除 EngineBridgeToken,改用具体服务 Token - 更新 camera, ui, particle 等模块使用新接口 - 优化装饰器类型安全,使用 Symbol-based metadata 访问模式 * refactor: 删除 plugin-types 包,统一 createServiceToken 实现 - 移动 IEditorModuleBase 接口到 engine-core - 移除 engine-core 和 editor-core 对 plugin-types 的依赖 - 删除冗余的 plugin-types 包 - 统一使用 core 中基于 Symbol.for() 的 createServiceToken * refactor: 统一 IPlugin 接口,移除 deprecated 别名 - 移除 engine-core、editor-core、runtime-core 中的 IPlugin 别名 - 模块插件统一使用 IRuntimePlugin(运行时)或 IEditorPlugin(编辑器) - 保留 core 包中的 IPlugin 作为 ECS 核心插件接口(不同概念) - 更新所有消费方使用正确的类型 * refactor: 重命名 editor-core ComponentRegistry 为 EditorComponentRegistry - 消除与 core 包 ComponentRegistry(ECS 位掩码管理)的命名歧义 - editor-core 的 EditorComponentRegistry 专用于编辑器组件元数据 - 更新所有编辑器包使用新名称
This commit is contained in:
@@ -2,7 +2,7 @@ import type { IComponentRegistry, IScene } from '@esengine/ecs-framework';
|
||||
import type { IRuntimeModule, IRuntimePlugin, ModuleManifest, SystemContext } from '@esengine/engine-core';
|
||||
import { TransformTypeToken, CanvasElementToken } from '@esengine/engine-core';
|
||||
import { AssetManagerToken } from '@esengine/asset-system';
|
||||
import { RenderSystemToken, EngineBridgeToken, EngineIntegrationToken } from '@esengine/ecs-engine-bindgen';
|
||||
import { RenderSystemToken, EngineIntegrationToken, TextureServiceToken, CoordinateServiceToken } from '@esengine/ecs-engine-bindgen';
|
||||
import { Physics2DQueryToken } from '@esengine/physics-rapier2d';
|
||||
import { ParticleSystemComponent } from './ParticleSystemComponent';
|
||||
import { ClickFxComponent } from './ClickFxComponent';
|
||||
@@ -30,7 +30,8 @@ class ParticleRuntimeModule implements IRuntimeModule {
|
||||
const assetManager = context.services.get(AssetManagerToken);
|
||||
const transformType = context.services.get(TransformTypeToken);
|
||||
const engineIntegration = context.services.get(EngineIntegrationToken);
|
||||
const engineBridge = context.services.get(EngineBridgeToken);
|
||||
const textureService = context.services.get(TextureServiceToken);
|
||||
const coordinateService = context.services.get(CoordinateServiceToken);
|
||||
const physics2DQuery = context.services.get(Physics2DQueryToken);
|
||||
const renderSystem = context.services.get(RenderSystemToken);
|
||||
|
||||
@@ -60,9 +61,9 @@ class ParticleRuntimeModule implements IRuntimeModule {
|
||||
this._updateSystem.setEngineIntegration(engineIntegration);
|
||||
}
|
||||
|
||||
// 设置引擎桥接(用于加载默认纹理)| Set engine bridge (for loading default texture)
|
||||
if (engineBridge) {
|
||||
this._updateSystem.setEngineBridge(engineBridge);
|
||||
// 设置纹理服务(用于加载默认纹理)| Set texture service (for loading default texture)
|
||||
if (textureService) {
|
||||
this._updateSystem.setTextureService(textureService);
|
||||
}
|
||||
|
||||
// 设置 2D 物理查询(用于粒子与场景碰撞)| Set 2D physics query (for particle-scene collision)
|
||||
@@ -77,10 +78,10 @@ class ParticleRuntimeModule implements IRuntimeModule {
|
||||
// ClickFxSystem no longer needs AssetManager, assets are loaded by ParticleUpdateSystem
|
||||
const clickFxSystem = new ClickFxSystem();
|
||||
|
||||
// 设置 EngineBridge(用于屏幕坐标转世界坐标)
|
||||
// Set EngineBridge (for screen to world coordinate conversion)
|
||||
if (engineBridge) {
|
||||
clickFxSystem.setEngineBridge(engineBridge);
|
||||
// 设置坐标服务(用于屏幕坐标转世界坐标)
|
||||
// Set coordinate service (for screen to world coordinate conversion)
|
||||
if (coordinateService) {
|
||||
clickFxSystem.setCoordinateService(coordinateService);
|
||||
}
|
||||
|
||||
// 从服务注册表获取 Canvas 元素(用于计算相对坐标)
|
||||
|
||||
Reference in New Issue
Block a user