* refactor(arch): 移除全局变量,使用 ServiceToken 模式 - 创建 PluginServiceRegistry 类,提供类型安全的服务注册/获取 - 添加 ProfilerServiceToken 和 CollisionLayerConfigToken - 重构所有 __PROFILER_SERVICE__ 全局变量访问为 getProfilerService() - 重构 __PHYSICS_RAPIER2D__ 全局变量访问为 CollisionLayerConfigToken - 在 Core 类添加 pluginServices 静态属性 - 添加 getService.ts 辅助模块简化服务获取 这是 ServiceToken 模式重构的第一阶段,移除了最常用的两个全局变量。 后续可继续应用到其他模块(Camera/Audio 等)。 * refactor(arch): 改进 ServiceToken 设计,移除重复常量 - tokens.ts: 从 engine-core 导入 createServiceToken(符合规范) - tokens.ts: Token 使用接口 IProfilerService 而非具体类 - 移除 AssetPickerDialog 和 ContentBrowser 中重复的 MANAGED_ASSET_DIRECTORIES - 统一从 editor-core 导入 MANAGED_ASSET_DIRECTORIES * fix(type): 修复 IProfilerService 接口与实现类型不匹配 - 将 ProfilerData 等数据类型移到 tokens.ts 以避免循环依赖 - ProfilerService 显式实现 IProfilerService 接口 - 更新使用方使用 IProfilerService 接口类型而非具体类 * refactor(type): 移除类型重导出,改进类型安全 - 删除 ProfilerService.ts 中的类型重导出,消费方直接从 tokens.ts 导入 - PanelDescriptor 接口添加 titleZh 属性,移除 App.tsx 中的 as any - 改进 useDynamicIcon.ts 的类型安全,使用正确的 Record 类型 * refactor(arch): 为模块添加 ServiceToken 支持 - Material System: 创建 tokens.ts,定义 IMaterialManager 接口和 MaterialManagerToken - Audio: 创建预留 tokens.ts 文件,为未来 AudioManager 服务扩展做准备 - Camera: 创建预留 tokens.ts 文件,为未来 CameraManager 服务扩展做准备 遵循"谁定义接口,谁导出 Token"原则,统一服务访问模式
75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
/**
|
||
* ECS Framework - 轻量级实体组件系统框架
|
||
* 适用于Laya、Cocos Creator等JavaScript游戏引擎和H5小游戏开发
|
||
*/
|
||
|
||
// 核心模块
|
||
export { Core } from './Core';
|
||
export { ServiceContainer, ServiceLifetime } from './Core/ServiceContainer';
|
||
export type { IService, ServiceType, ServiceIdentifier } from './Core/ServiceContainer';
|
||
|
||
// 插件服务注册表(基于 ServiceToken 的类型安全服务管理)
|
||
// Plugin Service Registry (type-safe service management based on ServiceToken)
|
||
export { PluginServiceRegistry, createServiceToken } from './Core/PluginServiceRegistry';
|
||
export type { ServiceToken } from './Core/PluginServiceRegistry';
|
||
|
||
// 插件系统
|
||
export { PluginManager } from './Core/PluginManager';
|
||
export { PluginState } from './Core/Plugin';
|
||
export type { IPlugin, IPluginMetadata } from './Core/Plugin';
|
||
|
||
// 内置插件
|
||
export * from './Plugins';
|
||
|
||
// 依赖注入
|
||
export {
|
||
Injectable,
|
||
InjectProperty,
|
||
Updatable,
|
||
registerInjectable,
|
||
createInstance,
|
||
injectProperties,
|
||
isUpdatable,
|
||
getUpdatableMetadata,
|
||
getPropertyInjectMetadata
|
||
} from './Core/DI';
|
||
export type { InjectableMetadata, UpdatableMetadata } from './Core/DI';
|
||
|
||
// 核心管理器
|
||
export { Emitter, FuncPack } from './Utils/Emitter';
|
||
export { GlobalManager } from './Utils/GlobalManager';
|
||
export { TimerManager } from './Utils/Timers/TimerManager';
|
||
export { ITimer } from './Utils/Timers/ITimer';
|
||
export { Timer } from './Utils/Timers/Timer';
|
||
|
||
// 日志系统
|
||
export {
|
||
LoggerManager,
|
||
ConsoleLogger,
|
||
Logger,
|
||
createLogger,
|
||
setGlobalLogLevel,
|
||
LogLevel
|
||
} from './Utils/Logger';
|
||
export type { ILogger, LoggerConfig } from './Utils/Logger';
|
||
|
||
// ECS核心组件
|
||
export * from './ECS';
|
||
|
||
// TypeScript类型增强API
|
||
export * from './ECS/TypedEntity';
|
||
export * from './ECS/Core/Query/TypedQuery';
|
||
|
||
// 事件系统
|
||
export { ECSEventType, EventPriority, EVENT_TYPES, EventTypeValidator } from './ECS/CoreEvents';
|
||
|
||
// 工具类和类型定义
|
||
export * from './Utils';
|
||
export * from './Types';
|
||
|
||
// 显式导出ComponentPool类(解决与Types中ComponentPool接口的命名冲突)
|
||
export { ComponentPool, ComponentPoolManager } from './ECS/Core/Storage';
|
||
|
||
// 平台适配
|
||
export * from './Platform';
|