refactor(core): 调整资源注册时机

- 将资源注册逻辑移至架构初始化事件监听器内部
- 确保资源在系统完全初始化后再进行注册
- 优化资源预加载流程的执行顺序
This commit is contained in:
GwWuYou 2025-12-17 21:25:03 +08:00
parent a444581ec7
commit 77065b6c17

View File

@ -26,11 +26,11 @@ public abstract class AbstractResourceFactorySystem : AbstractSystem, IResourceF
_registry = new ResourceFactory.Registry();
_resourceLoadSystem = this.GetSystem<IResourceLoadSystem>();
_assetCatalogSystem = this.GetSystem<IAssetCatalogSystem>();
// 注册资源
RegisterResources();
// 监听架构初始化事件
this.RegisterEvent<ArchitectureEvents.ArchitectureInitializedEvent>(_ =>
{
// 注册资源
RegisterResources();
// 预加载所有资源
_registry.PreloadAll();
});