@esengine/ecs-framework 2.2.20 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/Core/DI/Decorators.d.ts +206 -0
- package/bin/Core/DI/Decorators.d.ts.map +1 -0
- package/bin/Core/DI/Decorators.js +253 -0
- package/bin/Core/DI/Decorators.js.map +1 -0
- package/bin/Core/DI/index.d.ts +8 -0
- package/bin/Core/DI/index.d.ts.map +1 -0
- package/bin/Core/DI/index.js +7 -0
- package/bin/Core/DI/index.js.map +1 -0
- package/bin/Core/Plugin.d.ts +112 -0
- package/bin/Core/Plugin.d.ts.map +1 -0
- package/bin/Core/Plugin.js +19 -0
- package/bin/Core/Plugin.js.map +1 -0
- package/bin/Core/PluginManager.d.ts +118 -0
- package/bin/Core/PluginManager.d.ts.map +1 -0
- package/bin/Core/PluginManager.js +229 -0
- package/bin/Core/PluginManager.js.map +1 -0
- package/bin/Core/ServiceContainer.d.ts +221 -0
- package/bin/Core/ServiceContainer.d.ts.map +1 -0
- package/bin/Core/ServiceContainer.js +352 -0
- package/bin/Core/ServiceContainer.js.map +1 -0
- package/bin/Core.d.ts +379 -0
- package/bin/Core.d.ts.map +1 -0
- package/bin/Core.js +553 -0
- package/bin/Core.js.map +1 -0
- package/bin/ECS/Component.d.ts +104 -0
- package/bin/ECS/Component.d.ts.map +1 -0
- package/bin/ECS/Component.js +105 -0
- package/bin/ECS/Component.js.map +1 -0
- package/bin/ECS/Components/HierarchyComponent.d.ts +46 -0
- package/bin/ECS/Components/HierarchyComponent.d.ts.map +1 -0
- package/bin/ECS/Components/HierarchyComponent.js +65 -0
- package/bin/ECS/Components/HierarchyComponent.js.map +1 -0
- package/bin/ECS/Components/index.d.ts +2 -0
- package/bin/ECS/Components/index.d.ts.map +1 -0
- package/bin/ECS/Components/index.js +2 -0
- package/bin/ECS/Components/index.js.map +1 -0
- package/bin/ECS/Core/ArchetypeSystem.d.ts +103 -0
- package/bin/ECS/Core/ArchetypeSystem.d.ts.map +1 -0
- package/bin/ECS/Core/ArchetypeSystem.js +244 -0
- package/bin/ECS/Core/ArchetypeSystem.js.map +1 -0
- package/bin/ECS/Core/CommandBuffer.d.ts +154 -0
- package/bin/ECS/Core/CommandBuffer.d.ts.map +1 -0
- package/bin/ECS/Core/CommandBuffer.js +244 -0
- package/bin/ECS/Core/CommandBuffer.js.map +1 -0
- package/bin/ECS/Core/ComponentPool.d.ts +139 -0
- package/bin/ECS/Core/ComponentPool.d.ts.map +1 -0
- package/bin/ECS/Core/ComponentPool.js +276 -0
- package/bin/ECS/Core/ComponentPool.js.map +1 -0
- package/bin/ECS/Core/ComponentStorage/ComponentRegistry.d.ts +127 -0
- package/bin/ECS/Core/ComponentStorage/ComponentRegistry.d.ts.map +1 -0
- package/bin/ECS/Core/ComponentStorage/ComponentRegistry.js +235 -0
- package/bin/ECS/Core/ComponentStorage/ComponentRegistry.js.map +1 -0
- package/bin/ECS/Core/ComponentStorage.d.ts +185 -0
- package/bin/ECS/Core/ComponentStorage.d.ts.map +1 -0
- package/bin/ECS/Core/ComponentStorage.js +321 -0
- package/bin/ECS/Core/ComponentStorage.js.map +1 -0
- package/bin/ECS/Core/EntityLifecyclePolicy.d.ts +26 -0
- package/bin/ECS/Core/EntityLifecyclePolicy.d.ts.map +1 -0
- package/bin/ECS/Core/EntityLifecyclePolicy.js +2 -0
- package/bin/ECS/Core/EntityLifecyclePolicy.js.map +1 -0
- package/bin/ECS/Core/EventBus.d.ts +210 -0
- package/bin/ECS/Core/EventBus.d.ts.map +1 -0
- package/bin/ECS/Core/EventBus.js +370 -0
- package/bin/ECS/Core/EventBus.js.map +1 -0
- package/bin/ECS/Core/EventSystem.d.ts +225 -0
- package/bin/ECS/Core/EventSystem.d.ts.map +1 -0
- package/bin/ECS/Core/EventSystem.js +448 -0
- package/bin/ECS/Core/EventSystem.js.map +1 -0
- package/bin/ECS/Core/Events/index.d.ts +3 -0
- package/bin/ECS/Core/Events/index.d.ts.map +1 -0
- package/bin/ECS/Core/Events/index.js +3 -0
- package/bin/ECS/Core/Events/index.js.map +1 -0
- package/bin/ECS/Core/FluentAPI/ComponentBuilder.d.ts +35 -0
- package/bin/ECS/Core/FluentAPI/ComponentBuilder.d.ts.map +1 -0
- package/bin/ECS/Core/FluentAPI/ComponentBuilder.js +48 -0
- package/bin/ECS/Core/FluentAPI/ComponentBuilder.js.map +1 -0
- package/bin/ECS/Core/FluentAPI/ECSFluentAPI.d.ts +135 -0
- package/bin/ECS/Core/FluentAPI/ECSFluentAPI.d.ts.map +1 -0
- package/bin/ECS/Core/FluentAPI/ECSFluentAPI.js +166 -0
- package/bin/ECS/Core/FluentAPI/ECSFluentAPI.js.map +1 -0
- package/bin/ECS/Core/FluentAPI/EntityBatchOperator.d.ts +58 -0
- package/bin/ECS/Core/FluentAPI/EntityBatchOperator.d.ts.map +1 -0
- package/bin/ECS/Core/FluentAPI/EntityBatchOperator.js +85 -0
- package/bin/ECS/Core/FluentAPI/EntityBatchOperator.js.map +1 -0
- package/bin/ECS/Core/FluentAPI/EntityBuilder.d.ts +110 -0
- package/bin/ECS/Core/FluentAPI/EntityBuilder.d.ts.map +1 -0
- package/bin/ECS/Core/FluentAPI/EntityBuilder.js +181 -0
- package/bin/ECS/Core/FluentAPI/EntityBuilder.js.map +1 -0
- package/bin/ECS/Core/FluentAPI/SceneBuilder.d.ts +53 -0
- package/bin/ECS/Core/FluentAPI/SceneBuilder.d.ts.map +1 -0
- package/bin/ECS/Core/FluentAPI/SceneBuilder.js +79 -0
- package/bin/ECS/Core/FluentAPI/SceneBuilder.js.map +1 -0
- package/bin/ECS/Core/FluentAPI/index.d.ts +6 -0
- package/bin/ECS/Core/FluentAPI/index.d.ts.map +1 -0
- package/bin/ECS/Core/FluentAPI/index.js +6 -0
- package/bin/ECS/Core/FluentAPI/index.js.map +1 -0
- package/bin/ECS/Core/FluentAPI.d.ts +2 -0
- package/bin/ECS/Core/FluentAPI.d.ts.map +1 -0
- package/bin/ECS/Core/FluentAPI.js +3 -0
- package/bin/ECS/Core/FluentAPI.js.map +1 -0
- package/bin/ECS/Core/Query/TypedQuery.d.ts +214 -0
- package/bin/ECS/Core/Query/TypedQuery.d.ts.map +1 -0
- package/bin/ECS/Core/Query/TypedQuery.js +294 -0
- package/bin/ECS/Core/Query/TypedQuery.js.map +1 -0
- package/bin/ECS/Core/Query/index.d.ts +3 -0
- package/bin/ECS/Core/Query/index.d.ts.map +1 -0
- package/bin/ECS/Core/Query/index.js +3 -0
- package/bin/ECS/Core/Query/index.js.map +1 -0
- package/bin/ECS/Core/QuerySystem.d.ts +458 -0
- package/bin/ECS/Core/QuerySystem.d.ts.map +1 -0
- package/bin/ECS/Core/QuerySystem.js +1069 -0
- package/bin/ECS/Core/QuerySystem.js.map +1 -0
- package/bin/ECS/Core/QueryTypes.d.ts +34 -0
- package/bin/ECS/Core/QueryTypes.d.ts.map +1 -0
- package/bin/ECS/Core/QueryTypes.js +13 -0
- package/bin/ECS/Core/QueryTypes.js.map +1 -0
- package/bin/ECS/Core/ReactiveQuery.d.ts +211 -0
- package/bin/ECS/Core/ReactiveQuery.d.ts.map +1 -0
- package/bin/ECS/Core/ReactiveQuery.js +401 -0
- package/bin/ECS/Core/ReactiveQuery.js.map +1 -0
- package/bin/ECS/Core/ReferenceTracker.d.ts +111 -0
- package/bin/ECS/Core/ReferenceTracker.d.ts.map +1 -0
- package/bin/ECS/Core/ReferenceTracker.js +254 -0
- package/bin/ECS/Core/ReferenceTracker.js.map +1 -0
- package/bin/ECS/Core/SoASerializer.d.ts +28 -0
- package/bin/ECS/Core/SoASerializer.d.ts.map +1 -0
- package/bin/ECS/Core/SoASerializer.js +85 -0
- package/bin/ECS/Core/SoASerializer.js.map +1 -0
- package/bin/ECS/Core/SoAStorage.d.ts +129 -0
- package/bin/ECS/Core/SoAStorage.d.ts.map +1 -0
- package/bin/ECS/Core/SoAStorage.js +685 -0
- package/bin/ECS/Core/SoAStorage.js.map +1 -0
- package/bin/ECS/Core/SoATypeRegistry.d.ts +50 -0
- package/bin/ECS/Core/SoATypeRegistry.d.ts.map +1 -0
- package/bin/ECS/Core/SoATypeRegistry.js +135 -0
- package/bin/ECS/Core/SoATypeRegistry.js.map +1 -0
- package/bin/ECS/Core/Storage/index.d.ts +4 -0
- package/bin/ECS/Core/Storage/index.d.ts.map +1 -0
- package/bin/ECS/Core/Storage/index.js +4 -0
- package/bin/ECS/Core/Storage/index.js.map +1 -0
- package/bin/ECS/Core/StorageDecorators.d.ts +20 -0
- package/bin/ECS/Core/StorageDecorators.d.ts.map +1 -0
- package/bin/ECS/Core/StorageDecorators.js +27 -0
- package/bin/ECS/Core/StorageDecorators.js.map +1 -0
- package/bin/ECS/CoreEvents.d.ts +131 -0
- package/bin/ECS/CoreEvents.d.ts.map +1 -0
- package/bin/ECS/CoreEvents.js +163 -0
- package/bin/ECS/CoreEvents.js.map +1 -0
- package/bin/ECS/Decorators/EntityRefDecorator.d.ts +46 -0
- package/bin/ECS/Decorators/EntityRefDecorator.d.ts.map +1 -0
- package/bin/ECS/Decorators/EntityRefDecorator.js +118 -0
- package/bin/ECS/Decorators/EntityRefDecorator.js.map +1 -0
- package/bin/ECS/Decorators/PropertyDecorator.d.ts +168 -0
- package/bin/ECS/Decorators/PropertyDecorator.d.ts.map +1 -0
- package/bin/ECS/Decorators/PropertyDecorator.js +40 -0
- package/bin/ECS/Decorators/PropertyDecorator.js.map +1 -0
- package/bin/ECS/Decorators/TypeDecorators.d.ts +124 -0
- package/bin/ECS/Decorators/TypeDecorators.d.ts.map +1 -0
- package/bin/ECS/Decorators/TypeDecorators.js +151 -0
- package/bin/ECS/Decorators/TypeDecorators.js.map +1 -0
- package/bin/ECS/Decorators/index.d.ts +7 -0
- package/bin/ECS/Decorators/index.d.ts.map +1 -0
- package/bin/ECS/Decorators/index.js +4 -0
- package/bin/ECS/Decorators/index.js.map +1 -0
- package/bin/ECS/Entity.d.ts +415 -0
- package/bin/ECS/Entity.d.ts.map +1 -0
- package/bin/ECS/Entity.js +683 -0
- package/bin/ECS/Entity.js.map +1 -0
- package/bin/ECS/EntityTags.d.ts +71 -0
- package/bin/ECS/EntityTags.d.ts.map +1 -0
- package/bin/ECS/EntityTags.js +82 -0
- package/bin/ECS/EntityTags.js.map +1 -0
- package/bin/ECS/IScene.d.ts +308 -0
- package/bin/ECS/IScene.d.ts.map +1 -0
- package/bin/ECS/IScene.js +2 -0
- package/bin/ECS/IScene.js.map +1 -0
- package/bin/ECS/Scene.d.ts +799 -0
- package/bin/ECS/Scene.d.ts.map +1 -0
- package/bin/ECS/Scene.js +1203 -0
- package/bin/ECS/Scene.js.map +1 -0
- package/bin/ECS/SceneManager.d.ts +197 -0
- package/bin/ECS/SceneManager.d.ts.map +1 -0
- package/bin/ECS/SceneManager.js +264 -0
- package/bin/ECS/SceneManager.js.map +1 -0
- package/bin/ECS/Serialization/ComponentSerializer.d.ts +106 -0
- package/bin/ECS/Serialization/ComponentSerializer.d.ts.map +1 -0
- package/bin/ECS/Serialization/ComponentSerializer.js +251 -0
- package/bin/ECS/Serialization/ComponentSerializer.js.map +1 -0
- package/bin/ECS/Serialization/EntitySerializer.d.ts +111 -0
- package/bin/ECS/Serialization/EntitySerializer.d.ts.map +1 -0
- package/bin/ECS/Serialization/EntitySerializer.js +155 -0
- package/bin/ECS/Serialization/EntitySerializer.js.map +1 -0
- package/bin/ECS/Serialization/IncrementalSerializer.d.ts +259 -0
- package/bin/ECS/Serialization/IncrementalSerializer.d.ts.map +1 -0
- package/bin/ECS/Serialization/IncrementalSerializer.js +500 -0
- package/bin/ECS/Serialization/IncrementalSerializer.js.map +1 -0
- package/bin/ECS/Serialization/SceneSerializer.d.ts +213 -0
- package/bin/ECS/Serialization/SceneSerializer.d.ts.map +1 -0
- package/bin/ECS/Serialization/SceneSerializer.js +387 -0
- package/bin/ECS/Serialization/SceneSerializer.js.map +1 -0
- package/bin/ECS/Serialization/SerializationDecorators.d.ts +136 -0
- package/bin/ECS/Serialization/SerializationDecorators.d.ts.map +1 -0
- package/bin/ECS/Serialization/SerializationDecorators.js +216 -0
- package/bin/ECS/Serialization/SerializationDecorators.js.map +1 -0
- package/bin/ECS/Serialization/VersionMigration.d.ts +156 -0
- package/bin/ECS/Serialization/VersionMigration.d.ts.map +1 -0
- package/bin/ECS/Serialization/VersionMigration.js +279 -0
- package/bin/ECS/Serialization/VersionMigration.js.map +1 -0
- package/bin/ECS/Serialization/index.d.ts +18 -0
- package/bin/ECS/Serialization/index.d.ts.map +1 -0
- package/bin/ECS/Serialization/index.js +18 -0
- package/bin/ECS/Serialization/index.js.map +1 -0
- package/bin/ECS/Systems/EntityCache.d.ts +114 -0
- package/bin/ECS/Systems/EntityCache.d.ts.map +1 -0
- package/bin/ECS/Systems/EntityCache.js +145 -0
- package/bin/ECS/Systems/EntityCache.js.map +1 -0
- package/bin/ECS/Systems/EntitySystem.d.ts +591 -0
- package/bin/ECS/Systems/EntitySystem.d.ts.map +1 -0
- package/bin/ECS/Systems/EntitySystem.js +1102 -0
- package/bin/ECS/Systems/EntitySystem.js.map +1 -0
- package/bin/ECS/Systems/HierarchySystem.d.ts +155 -0
- package/bin/ECS/Systems/HierarchySystem.d.ts.map +1 -0
- package/bin/ECS/Systems/HierarchySystem.js +498 -0
- package/bin/ECS/Systems/HierarchySystem.js.map +1 -0
- package/bin/ECS/Systems/IntervalSystem.d.ts +33 -0
- package/bin/ECS/Systems/IntervalSystem.d.ts.map +1 -0
- package/bin/ECS/Systems/IntervalSystem.js +50 -0
- package/bin/ECS/Systems/IntervalSystem.js.map +1 -0
- package/bin/ECS/Systems/PassiveSystem.d.ts +17 -0
- package/bin/ECS/Systems/PassiveSystem.d.ts.map +1 -0
- package/bin/ECS/Systems/PassiveSystem.js +19 -0
- package/bin/ECS/Systems/PassiveSystem.js.map +1 -0
- package/bin/ECS/Systems/ProcessingSystem.d.ts +21 -0
- package/bin/ECS/Systems/ProcessingSystem.d.ts.map +1 -0
- package/bin/ECS/Systems/ProcessingSystem.js +20 -0
- package/bin/ECS/Systems/ProcessingSystem.js.map +1 -0
- package/bin/ECS/Systems/WorkerEntitySystem.d.ts +313 -0
- package/bin/ECS/Systems/WorkerEntitySystem.d.ts.map +1 -0
- package/bin/ECS/Systems/WorkerEntitySystem.js +792 -0
- package/bin/ECS/Systems/WorkerEntitySystem.js.map +1 -0
- package/bin/ECS/Systems/index.d.ts +8 -0
- package/bin/ECS/Systems/index.d.ts.map +1 -0
- package/bin/ECS/Systems/index.js +8 -0
- package/bin/ECS/Systems/index.js.map +1 -0
- package/bin/ECS/TypedEntity.d.ts +192 -0
- package/bin/ECS/TypedEntity.d.ts.map +1 -0
- package/bin/ECS/TypedEntity.js +254 -0
- package/bin/ECS/TypedEntity.js.map +1 -0
- package/bin/ECS/Utils/BigIntCompatibility.d.ts +151 -0
- package/bin/ECS/Utils/BigIntCompatibility.d.ts.map +1 -0
- package/bin/ECS/Utils/BigIntCompatibility.js +476 -0
- package/bin/ECS/Utils/BigIntCompatibility.js.map +1 -0
- package/bin/ECS/Utils/BitMaskHashMap.d.ts +28 -0
- package/bin/ECS/Utils/BitMaskHashMap.d.ts.map +1 -0
- package/bin/ECS/Utils/BitMaskHashMap.js +127 -0
- package/bin/ECS/Utils/BitMaskHashMap.js.map +1 -0
- package/bin/ECS/Utils/Bits.d.ts +154 -0
- package/bin/ECS/Utils/Bits.d.ts.map +1 -0
- package/bin/ECS/Utils/Bits.js +331 -0
- package/bin/ECS/Utils/Bits.js.map +1 -0
- package/bin/ECS/Utils/ComponentSparseSet.d.ts +143 -0
- package/bin/ECS/Utils/ComponentSparseSet.d.ts.map +1 -0
- package/bin/ECS/Utils/ComponentSparseSet.js +347 -0
- package/bin/ECS/Utils/ComponentSparseSet.js.map +1 -0
- package/bin/ECS/Utils/EntityList.d.ts +115 -0
- package/bin/ECS/Utils/EntityList.d.ts.map +1 -0
- package/bin/ECS/Utils/EntityList.js +258 -0
- package/bin/ECS/Utils/EntityList.js.map +1 -0
- package/bin/ECS/Utils/EntityProcessorList.d.ts +56 -0
- package/bin/ECS/Utils/EntityProcessorList.d.ts.map +1 -0
- package/bin/ECS/Utils/EntityProcessorList.js +113 -0
- package/bin/ECS/Utils/EntityProcessorList.js.map +1 -0
- package/bin/ECS/Utils/IdentifierPool.d.ts +203 -0
- package/bin/ECS/Utils/IdentifierPool.d.ts.map +1 -0
- package/bin/ECS/Utils/IdentifierPool.js +325 -0
- package/bin/ECS/Utils/IdentifierPool.js.map +1 -0
- package/bin/ECS/Utils/Matcher.d.ts +171 -0
- package/bin/ECS/Utils/Matcher.d.ts.map +1 -0
- package/bin/ECS/Utils/Matcher.js +293 -0
- package/bin/ECS/Utils/Matcher.js.map +1 -0
- package/bin/ECS/Utils/SparseSet.d.ts +170 -0
- package/bin/ECS/Utils/SparseSet.d.ts.map +1 -0
- package/bin/ECS/Utils/SparseSet.js +280 -0
- package/bin/ECS/Utils/SparseSet.js.map +1 -0
- package/bin/ECS/Utils/index.d.ts +9 -0
- package/bin/ECS/Utils/index.d.ts.map +1 -0
- package/bin/ECS/Utils/index.js +10 -0
- package/bin/ECS/Utils/index.js.map +1 -0
- package/bin/ECS/World.d.ts +238 -0
- package/bin/ECS/World.d.ts.map +1 -0
- package/bin/ECS/World.js +416 -0
- package/bin/ECS/World.js.map +1 -0
- package/bin/ECS/WorldManager.d.ts +224 -0
- package/bin/ECS/WorldManager.d.ts.map +1 -0
- package/bin/ECS/WorldManager.js +365 -0
- package/bin/ECS/WorldManager.js.map +1 -0
- package/bin/ECS/index.d.ts +26 -0
- package/bin/ECS/index.d.ts.map +1 -0
- package/bin/ECS/index.js +21 -0
- package/bin/ECS/index.js.map +1 -0
- package/bin/Platform/IPlatformAdapter.d.ts +169 -0
- package/bin/Platform/IPlatformAdapter.d.ts.map +1 -0
- package/bin/Platform/IPlatformAdapter.js +2 -0
- package/bin/Platform/IPlatformAdapter.js.map +1 -0
- package/bin/Platform/PlatformDetector.d.ts +56 -0
- package/bin/Platform/PlatformDetector.d.ts.map +1 -0
- package/bin/Platform/PlatformDetector.js +247 -0
- package/bin/Platform/PlatformDetector.js.map +1 -0
- package/bin/Platform/PlatformManager.d.ts +50 -0
- package/bin/Platform/PlatformManager.d.ts.map +1 -0
- package/bin/Platform/PlatformManager.js +114 -0
- package/bin/Platform/PlatformManager.js.map +1 -0
- package/bin/Platform/index.d.ts +19 -0
- package/bin/Platform/index.d.ts.map +1 -0
- package/bin/Platform/index.js +29 -0
- package/bin/Platform/index.js.map +1 -0
- package/bin/Plugins/DebugPlugin.d.ts +156 -0
- package/bin/Plugins/DebugPlugin.d.ts.map +1 -0
- package/bin/Plugins/DebugPlugin.js +248 -0
- package/bin/Plugins/DebugPlugin.js.map +1 -0
- package/bin/Plugins/index.d.ts +2 -0
- package/bin/Plugins/index.d.ts.map +1 -0
- package/bin/Plugins/index.js +2 -0
- package/bin/Plugins/index.js.map +1 -0
- package/bin/Types/IUpdatable.d.ts +18 -0
- package/bin/Types/IUpdatable.d.ts.map +1 -0
- package/bin/Types/IUpdatable.js +7 -0
- package/bin/Types/IUpdatable.js.map +1 -0
- package/bin/Types/TypeHelpers.d.ts +238 -0
- package/bin/Types/TypeHelpers.d.ts.map +1 -0
- package/bin/Types/TypeHelpers.js +19 -0
- package/bin/Types/TypeHelpers.js.map +1 -0
- package/bin/Types/index.d.ts +466 -0
- package/bin/Types/index.d.ts.map +1 -0
- package/bin/Types/index.js +7 -0
- package/bin/Types/index.js.map +1 -0
- package/bin/Utils/BinarySerializer.d.ts +23 -0
- package/bin/Utils/BinarySerializer.d.ts.map +1 -0
- package/bin/Utils/BinarySerializer.js +100 -0
- package/bin/Utils/BinarySerializer.js.map +1 -0
- package/bin/Utils/Debug/AdvancedProfilerCollector.d.ts +153 -0
- package/bin/Utils/Debug/AdvancedProfilerCollector.d.ts.map +1 -0
- package/bin/Utils/Debug/AdvancedProfilerCollector.js +406 -0
- package/bin/Utils/Debug/AdvancedProfilerCollector.js.map +1 -0
- package/bin/Utils/Debug/ComponentDataCollector.d.ts +32 -0
- package/bin/Utils/Debug/ComponentDataCollector.d.ts.map +1 -0
- package/bin/Utils/Debug/ComponentDataCollector.js +250 -0
- package/bin/Utils/Debug/ComponentDataCollector.js.map +1 -0
- package/bin/Utils/Debug/DebugConfigService.d.ts +16 -0
- package/bin/Utils/Debug/DebugConfigService.d.ts.map +1 -0
- package/bin/Utils/Debug/DebugConfigService.js +42 -0
- package/bin/Utils/Debug/DebugConfigService.js.map +1 -0
- package/bin/Utils/Debug/DebugManager.d.ts +131 -0
- package/bin/Utils/Debug/DebugManager.d.ts.map +1 -0
- package/bin/Utils/Debug/DebugManager.js +848 -0
- package/bin/Utils/Debug/DebugManager.js.map +1 -0
- package/bin/Utils/Debug/EntityDataCollector.d.ts +115 -0
- package/bin/Utils/Debug/EntityDataCollector.d.ts.map +1 -0
- package/bin/Utils/Debug/EntityDataCollector.js +870 -0
- package/bin/Utils/Debug/EntityDataCollector.js.map +1 -0
- package/bin/Utils/Debug/PerformanceDataCollector.d.ts +31 -0
- package/bin/Utils/Debug/PerformanceDataCollector.d.ts.map +1 -0
- package/bin/Utils/Debug/PerformanceDataCollector.js +203 -0
- package/bin/Utils/Debug/PerformanceDataCollector.js.map +1 -0
- package/bin/Utils/Debug/SceneDataCollector.d.ts +18 -0
- package/bin/Utils/Debug/SceneDataCollector.d.ts.map +1 -0
- package/bin/Utils/Debug/SceneDataCollector.js +43 -0
- package/bin/Utils/Debug/SceneDataCollector.js.map +1 -0
- package/bin/Utils/Debug/SystemDataCollector.d.ts +14 -0
- package/bin/Utils/Debug/SystemDataCollector.d.ts.map +1 -0
- package/bin/Utils/Debug/SystemDataCollector.js +60 -0
- package/bin/Utils/Debug/SystemDataCollector.js.map +1 -0
- package/bin/Utils/Debug/WebSocketManager.d.ts +54 -0
- package/bin/Utils/Debug/WebSocketManager.d.ts.map +1 -0
- package/bin/Utils/Debug/WebSocketManager.js +141 -0
- package/bin/Utils/Debug/WebSocketManager.js.map +1 -0
- package/bin/Utils/Debug/index.d.ts +11 -0
- package/bin/Utils/Debug/index.d.ts.map +1 -0
- package/bin/Utils/Debug/index.js +10 -0
- package/bin/Utils/Debug/index.js.map +1 -0
- package/bin/Utils/Emitter.d.ts +61 -0
- package/bin/Utils/Emitter.d.ts.map +1 -0
- package/bin/Utils/Emitter.js +101 -0
- package/bin/Utils/Emitter.js.map +1 -0
- package/bin/Utils/Extensions/NumberExtension.d.ts +13 -0
- package/bin/Utils/Extensions/NumberExtension.d.ts.map +1 -0
- package/bin/Utils/Extensions/NumberExtension.js +17 -0
- package/bin/Utils/Extensions/NumberExtension.js.map +1 -0
- package/bin/Utils/Extensions/TypeUtils.d.ts +13 -0
- package/bin/Utils/Extensions/TypeUtils.d.ts.map +1 -0
- package/bin/Utils/Extensions/TypeUtils.js +15 -0
- package/bin/Utils/Extensions/TypeUtils.js.map +1 -0
- package/bin/Utils/Extensions/index.d.ts +3 -0
- package/bin/Utils/Extensions/index.d.ts.map +1 -0
- package/bin/Utils/Extensions/index.js +4 -0
- package/bin/Utils/Extensions/index.js.map +1 -0
- package/bin/Utils/GlobalManager.d.ts +29 -0
- package/bin/Utils/GlobalManager.d.ts.map +1 -0
- package/bin/Utils/GlobalManager.js +50 -0
- package/bin/Utils/GlobalManager.js.map +1 -0
- package/bin/Utils/Logger/ConsoleLogger.d.ts +74 -0
- package/bin/Utils/Logger/ConsoleLogger.d.ts.map +1 -0
- package/bin/Utils/Logger/ConsoleLogger.js +187 -0
- package/bin/Utils/Logger/ConsoleLogger.js.map +1 -0
- package/bin/Utils/Logger/Constants.d.ts +36 -0
- package/bin/Utils/Logger/Constants.d.ts.map +1 -0
- package/bin/Utils/Logger/Constants.js +40 -0
- package/bin/Utils/Logger/Constants.js.map +1 -0
- package/bin/Utils/Logger/LoggerManager.d.ts +91 -0
- package/bin/Utils/Logger/LoggerManager.d.ts.map +1 -0
- package/bin/Utils/Logger/LoggerManager.js +167 -0
- package/bin/Utils/Logger/LoggerManager.js.map +1 -0
- package/bin/Utils/Logger/Types.d.ts +40 -0
- package/bin/Utils/Logger/Types.d.ts.map +1 -0
- package/bin/Utils/Logger/Types.js +2 -0
- package/bin/Utils/Logger/Types.js.map +1 -0
- package/bin/Utils/Logger/index.d.ts +5 -0
- package/bin/Utils/Logger/index.d.ts.map +1 -0
- package/bin/Utils/Logger/index.js +5 -0
- package/bin/Utils/Logger/index.js.map +1 -0
- package/bin/Utils/PerformanceMonitor.d.ts +196 -0
- package/bin/Utils/PerformanceMonitor.d.ts.map +1 -0
- package/bin/Utils/PerformanceMonitor.js +244 -0
- package/bin/Utils/PerformanceMonitor.js.map +1 -0
- package/bin/Utils/Pool/IPoolable.d.ts +29 -0
- package/bin/Utils/Pool/IPoolable.d.ts.map +1 -0
- package/bin/Utils/Pool/IPoolable.js +2 -0
- package/bin/Utils/Pool/IPoolable.js.map +1 -0
- package/bin/Utils/Pool/Pool.d.ts +109 -0
- package/bin/Utils/Pool/Pool.d.ts.map +1 -0
- package/bin/Utils/Pool/Pool.js +238 -0
- package/bin/Utils/Pool/Pool.js.map +1 -0
- package/bin/Utils/Pool/PoolManager.d.ts +96 -0
- package/bin/Utils/Pool/PoolManager.d.ts.map +1 -0
- package/bin/Utils/Pool/PoolManager.js +199 -0
- package/bin/Utils/Pool/PoolManager.js.map +1 -0
- package/bin/Utils/Pool/index.d.ts +4 -0
- package/bin/Utils/Pool/index.d.ts.map +1 -0
- package/bin/Utils/Pool/index.js +4 -0
- package/bin/Utils/Pool/index.js.map +1 -0
- package/bin/Utils/Profiler/AutoProfiler.d.ts +160 -0
- package/bin/Utils/Profiler/AutoProfiler.d.ts.map +1 -0
- package/bin/Utils/Profiler/AutoProfiler.js +503 -0
- package/bin/Utils/Profiler/AutoProfiler.js.map +1 -0
- package/bin/Utils/Profiler/ProfilerSDK.d.ts +175 -0
- package/bin/Utils/Profiler/ProfilerSDK.d.ts.map +1 -0
- package/bin/Utils/Profiler/ProfilerSDK.js +727 -0
- package/bin/Utils/Profiler/ProfilerSDK.js.map +1 -0
- package/bin/Utils/Profiler/ProfilerTypes.d.ts +218 -0
- package/bin/Utils/Profiler/ProfilerTypes.d.ts.map +1 -0
- package/bin/Utils/Profiler/ProfilerTypes.js +47 -0
- package/bin/Utils/Profiler/ProfilerTypes.js.map +1 -0
- package/bin/Utils/Profiler/index.d.ts +8 -0
- package/bin/Utils/Profiler/index.d.ts.map +1 -0
- package/bin/Utils/Profiler/index.js +7 -0
- package/bin/Utils/Profiler/index.js.map +1 -0
- package/bin/Utils/Time.d.ts +47 -0
- package/bin/Utils/Time.d.ts.map +1 -0
- package/bin/Utils/Time.js +64 -0
- package/bin/Utils/Time.js.map +1 -0
- package/bin/Utils/Timers/ITimer.d.ts +16 -0
- package/bin/Utils/Timers/ITimer.d.ts.map +1 -0
- package/bin/Utils/Timers/ITimer.js +2 -0
- package/bin/Utils/Timers/ITimer.js.map +1 -0
- package/bin/Utils/Timers/Timer.d.ts +30 -0
- package/bin/Utils/Timers/Timer.d.ts.map +1 -0
- package/bin/Utils/Timers/Timer.js +58 -0
- package/bin/Utils/Timers/Timer.js.map +1 -0
- package/bin/Utils/Timers/TimerManager.d.ts +26 -0
- package/bin/Utils/Timers/TimerManager.d.ts.map +1 -0
- package/bin/Utils/Timers/TimerManager.js +48 -0
- package/bin/Utils/Timers/TimerManager.js.map +1 -0
- package/bin/Utils/index.d.ts +11 -0
- package/bin/Utils/index.d.ts.map +1 -0
- package/bin/Utils/index.js +11 -0
- package/bin/Utils/index.js.map +1 -0
- package/bin/index.d.ts +29 -0
- package/bin/index.d.ts.map +1 -0
- package/bin/index.js +36 -0
- package/bin/index.js.map +1 -0
- package/package.json +84 -47
- package/LICENSE +0 -21
- package/index.cjs +0 -2
- package/index.cjs.map +0 -1
- package/index.d.ts +0 -13021
- package/index.es5.js +0 -4
- package/index.es5.js.map +0 -1
- package/index.mjs +0 -2
- package/index.mjs.map +0 -1
- package/index.umd.js +0 -4
- package/index.umd.js.map +0 -1
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { EntityDataCollector } from './EntityDataCollector';
|
|
3
|
+
import { SystemDataCollector } from './SystemDataCollector';
|
|
4
|
+
import { PerformanceDataCollector } from './PerformanceDataCollector';
|
|
5
|
+
import { ComponentDataCollector } from './ComponentDataCollector';
|
|
6
|
+
import { SceneDataCollector } from './SceneDataCollector';
|
|
7
|
+
import { AdvancedProfilerCollector } from './AdvancedProfilerCollector';
|
|
8
|
+
import { WebSocketManager } from './WebSocketManager';
|
|
9
|
+
import { ComponentPoolManager } from '../../ECS/Core/ComponentPool';
|
|
10
|
+
import { Pool } from '../../Utils/Pool';
|
|
11
|
+
import { getComponentInstanceTypeName, getSystemInstanceTypeName } from '../../ECS/Decorators';
|
|
12
|
+
import { SceneManager } from '../../ECS/SceneManager';
|
|
13
|
+
import { PerformanceMonitor } from '../PerformanceMonitor';
|
|
14
|
+
import { Injectable, InjectProperty, Updatable } from '../../Core/DI/Decorators';
|
|
15
|
+
import { DebugConfigService } from './DebugConfigService';
|
|
16
|
+
import { ProfilerSDK } from '../Profiler/ProfilerSDK';
|
|
17
|
+
/**
|
|
18
|
+
* 调试管理器
|
|
19
|
+
*
|
|
20
|
+
* 整合所有调试数据收集器,负责收集和发送调试数据
|
|
21
|
+
*/
|
|
22
|
+
let DebugManager = class DebugManager {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.frameCounter = 0;
|
|
25
|
+
this.lastSendTime = 0;
|
|
26
|
+
this.sendInterval = 0;
|
|
27
|
+
this.isRunning = false;
|
|
28
|
+
this.originalConsole = {
|
|
29
|
+
log: console.log.bind(console),
|
|
30
|
+
debug: console.debug.bind(console),
|
|
31
|
+
info: console.info.bind(console),
|
|
32
|
+
warn: console.warn.bind(console),
|
|
33
|
+
error: console.error.bind(console)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
onInitialize() {
|
|
37
|
+
this.config = this.configService.getConfig();
|
|
38
|
+
// 初始化数据收集器
|
|
39
|
+
this.entityCollector = new EntityDataCollector();
|
|
40
|
+
this.systemCollector = new SystemDataCollector();
|
|
41
|
+
this.performanceCollector = new PerformanceDataCollector();
|
|
42
|
+
this.componentCollector = new ComponentDataCollector();
|
|
43
|
+
this.sceneCollector = new SceneDataCollector();
|
|
44
|
+
this.advancedProfilerCollector = new AdvancedProfilerCollector();
|
|
45
|
+
// 启用高级性能分析器
|
|
46
|
+
ProfilerSDK.setEnabled(true);
|
|
47
|
+
// 初始化WebSocket管理器
|
|
48
|
+
this.webSocketManager = new WebSocketManager(this.config.websocketUrl, this.config.autoReconnect !== false);
|
|
49
|
+
// 设置消息处理回调
|
|
50
|
+
this.webSocketManager.setMessageHandler(this.handleMessage.bind(this));
|
|
51
|
+
// 计算发送间隔(基于帧率)
|
|
52
|
+
const debugFrameRate = this.config.debugFrameRate || 30;
|
|
53
|
+
this.sendInterval = 1000 / debugFrameRate;
|
|
54
|
+
// 拦截 console 日志
|
|
55
|
+
this.interceptConsole();
|
|
56
|
+
this.start();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 启动调试管理器
|
|
60
|
+
*/
|
|
61
|
+
start() {
|
|
62
|
+
if (this.isRunning)
|
|
63
|
+
return;
|
|
64
|
+
this.isRunning = true;
|
|
65
|
+
this.connectWebSocket();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 停止调试管理器
|
|
69
|
+
*/
|
|
70
|
+
stop() {
|
|
71
|
+
if (!this.isRunning)
|
|
72
|
+
return;
|
|
73
|
+
this.isRunning = false;
|
|
74
|
+
this.webSocketManager.disconnect();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 拦截 console 日志并转发到编辑器
|
|
78
|
+
*/
|
|
79
|
+
interceptConsole() {
|
|
80
|
+
console.log = (...args) => {
|
|
81
|
+
this.sendLog('info', this.formatLogMessage(args));
|
|
82
|
+
this.originalConsole.log(...args);
|
|
83
|
+
};
|
|
84
|
+
console.debug = (...args) => {
|
|
85
|
+
this.sendLog('debug', this.formatLogMessage(args));
|
|
86
|
+
this.originalConsole.debug(...args);
|
|
87
|
+
};
|
|
88
|
+
console.info = (...args) => {
|
|
89
|
+
this.sendLog('info', this.formatLogMessage(args));
|
|
90
|
+
this.originalConsole.info(...args);
|
|
91
|
+
};
|
|
92
|
+
console.warn = (...args) => {
|
|
93
|
+
this.sendLog('warn', this.formatLogMessage(args));
|
|
94
|
+
this.originalConsole.warn(...args);
|
|
95
|
+
};
|
|
96
|
+
console.error = (...args) => {
|
|
97
|
+
this.sendLog('error', this.formatLogMessage(args));
|
|
98
|
+
this.originalConsole.error(...args);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 格式化日志消息
|
|
103
|
+
*/
|
|
104
|
+
formatLogMessage(args) {
|
|
105
|
+
return args.map((arg) => {
|
|
106
|
+
if (typeof arg === 'string')
|
|
107
|
+
return arg;
|
|
108
|
+
if (arg instanceof Error)
|
|
109
|
+
return `${arg.name}: ${arg.message}`;
|
|
110
|
+
if (arg === null)
|
|
111
|
+
return 'null';
|
|
112
|
+
if (arg === undefined)
|
|
113
|
+
return 'undefined';
|
|
114
|
+
if (typeof arg === 'object') {
|
|
115
|
+
try {
|
|
116
|
+
return this.safeStringify(arg, 6);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return Object.prototype.toString.call(arg);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return String(arg);
|
|
123
|
+
}).join(' ');
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 安全的 JSON 序列化,支持循环引用和深度限制
|
|
127
|
+
*/
|
|
128
|
+
safeStringify(obj, maxDepth = 6) {
|
|
129
|
+
const seen = new WeakSet();
|
|
130
|
+
const stringify = (value, depth) => {
|
|
131
|
+
if (value === null)
|
|
132
|
+
return null;
|
|
133
|
+
if (value === undefined)
|
|
134
|
+
return undefined;
|
|
135
|
+
if (typeof value !== 'object')
|
|
136
|
+
return value;
|
|
137
|
+
if (depth >= maxDepth) {
|
|
138
|
+
return '[Max Depth Reached]';
|
|
139
|
+
}
|
|
140
|
+
if (seen.has(value)) {
|
|
141
|
+
return '[Circular]';
|
|
142
|
+
}
|
|
143
|
+
seen.add(value);
|
|
144
|
+
if (Array.isArray(value)) {
|
|
145
|
+
const result = value.map((item) => stringify(item, depth + 1));
|
|
146
|
+
seen.delete(value);
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
const result = {};
|
|
150
|
+
for (const key in value) {
|
|
151
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
152
|
+
result[key] = stringify(value[key], depth + 1);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
seen.delete(value);
|
|
156
|
+
return result;
|
|
157
|
+
};
|
|
158
|
+
return JSON.stringify(stringify(obj, 0));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 发送日志到编辑器
|
|
162
|
+
*/
|
|
163
|
+
sendLog(level, message) {
|
|
164
|
+
if (!this.webSocketManager.getConnectionStatus()) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
this.webSocketManager.send({
|
|
169
|
+
type: 'log',
|
|
170
|
+
data: {
|
|
171
|
+
level,
|
|
172
|
+
message,
|
|
173
|
+
timestamp: new Date().toISOString()
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
// 静默失败,避免递归日志
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 更新配置
|
|
183
|
+
*/
|
|
184
|
+
updateConfig(config) {
|
|
185
|
+
this.config = config;
|
|
186
|
+
// 更新发送间隔
|
|
187
|
+
const debugFrameRate = config.debugFrameRate || 30;
|
|
188
|
+
this.sendInterval = 1000 / debugFrameRate;
|
|
189
|
+
// 重新连接WebSocket(如果URL变化)
|
|
190
|
+
if (this.webSocketManager && config.websocketUrl) {
|
|
191
|
+
this.webSocketManager.disconnect();
|
|
192
|
+
this.webSocketManager = new WebSocketManager(config.websocketUrl, config.autoReconnect !== false);
|
|
193
|
+
this.webSocketManager.setMessageHandler(this.handleMessage.bind(this));
|
|
194
|
+
this.connectWebSocket();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
update(_deltaTime) {
|
|
198
|
+
if (!this.isRunning || !this.config.enabled)
|
|
199
|
+
return;
|
|
200
|
+
this.frameCounter++;
|
|
201
|
+
const currentTime = Date.now();
|
|
202
|
+
if (currentTime - this.lastSendTime >= this.sendInterval) {
|
|
203
|
+
this.sendDebugData();
|
|
204
|
+
this.lastSendTime = currentTime;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* 场景变更回调
|
|
209
|
+
*/
|
|
210
|
+
onSceneChanged() {
|
|
211
|
+
// 场景变更时立即发送一次数据
|
|
212
|
+
if (this.isRunning && this.config.enabled) {
|
|
213
|
+
this.sendDebugData();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 处理来自调试面板的消息
|
|
218
|
+
*/
|
|
219
|
+
handleMessage(message) {
|
|
220
|
+
try {
|
|
221
|
+
switch (message.type) {
|
|
222
|
+
case 'capture_memory_snapshot':
|
|
223
|
+
this.handleMemorySnapshotRequest();
|
|
224
|
+
break;
|
|
225
|
+
case 'config_update':
|
|
226
|
+
if (message.config) {
|
|
227
|
+
this.updateConfig({ ...this.config, ...message.config });
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
case 'expand_lazy_object':
|
|
231
|
+
this.handleExpandLazyObjectRequest(message);
|
|
232
|
+
break;
|
|
233
|
+
case 'get_component_properties':
|
|
234
|
+
this.handleGetComponentPropertiesRequest(message);
|
|
235
|
+
break;
|
|
236
|
+
case 'get_raw_entity_list':
|
|
237
|
+
this.handleGetRawEntityListRequest(message);
|
|
238
|
+
break;
|
|
239
|
+
case 'get_entity_details':
|
|
240
|
+
this.handleGetEntityDetailsRequest(message);
|
|
241
|
+
break;
|
|
242
|
+
case 'get_advanced_profiler_data':
|
|
243
|
+
this.handleGetAdvancedProfilerDataRequest(message);
|
|
244
|
+
break;
|
|
245
|
+
case 'set_profiler_selected_function':
|
|
246
|
+
this.handleSetProfilerSelectedFunction(message);
|
|
247
|
+
break;
|
|
248
|
+
case 'ping':
|
|
249
|
+
this.webSocketManager.send({
|
|
250
|
+
type: 'pong',
|
|
251
|
+
timestamp: Date.now()
|
|
252
|
+
});
|
|
253
|
+
break;
|
|
254
|
+
default:
|
|
255
|
+
// 未知消息类型,忽略
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
// console.error('[ECS Debug] 处理消息失败:', error);
|
|
261
|
+
if (message.requestId) {
|
|
262
|
+
this.webSocketManager.send({
|
|
263
|
+
type: 'error_response',
|
|
264
|
+
requestId: message.requestId,
|
|
265
|
+
error: error instanceof Error ? error.message : String(error)
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* 处理展开懒加载对象请求
|
|
272
|
+
*/
|
|
273
|
+
handleExpandLazyObjectRequest(message) {
|
|
274
|
+
try {
|
|
275
|
+
const { entityId, componentIndex, propertyPath, requestId } = message;
|
|
276
|
+
if (entityId === undefined || componentIndex === undefined || !propertyPath) {
|
|
277
|
+
this.webSocketManager.send({
|
|
278
|
+
type: 'expand_lazy_object_response',
|
|
279
|
+
requestId,
|
|
280
|
+
error: '缺少必要参数'
|
|
281
|
+
});
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const scene = this.sceneManager.currentScene;
|
|
285
|
+
const expandedData = this.entityCollector.expandLazyObject(entityId, componentIndex, propertyPath, scene);
|
|
286
|
+
this.webSocketManager.send({
|
|
287
|
+
type: 'expand_lazy_object_response',
|
|
288
|
+
requestId,
|
|
289
|
+
data: expandedData
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
this.webSocketManager.send({
|
|
294
|
+
type: 'expand_lazy_object_response',
|
|
295
|
+
requestId: message.requestId,
|
|
296
|
+
error: error instanceof Error ? error.message : String(error)
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* 处理获取组件属性请求
|
|
302
|
+
*/
|
|
303
|
+
handleGetComponentPropertiesRequest(message) {
|
|
304
|
+
try {
|
|
305
|
+
const { entityId, componentIndex, requestId } = message;
|
|
306
|
+
if (entityId === undefined || componentIndex === undefined) {
|
|
307
|
+
this.webSocketManager.send({
|
|
308
|
+
type: 'get_component_properties_response',
|
|
309
|
+
requestId,
|
|
310
|
+
error: '缺少必要参数'
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const scene = this.sceneManager.currentScene;
|
|
315
|
+
const properties = this.entityCollector.getComponentProperties(entityId, componentIndex, scene);
|
|
316
|
+
this.webSocketManager.send({
|
|
317
|
+
type: 'get_component_properties_response',
|
|
318
|
+
requestId,
|
|
319
|
+
data: properties
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
this.webSocketManager.send({
|
|
324
|
+
type: 'get_component_properties_response',
|
|
325
|
+
requestId: message.requestId,
|
|
326
|
+
error: error instanceof Error ? error.message : String(error)
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* 处理获取原始实体列表请求
|
|
332
|
+
*/
|
|
333
|
+
handleGetRawEntityListRequest(message) {
|
|
334
|
+
try {
|
|
335
|
+
const { requestId } = message;
|
|
336
|
+
const scene = this.sceneManager.currentScene;
|
|
337
|
+
const rawEntityList = this.entityCollector.getRawEntityList(scene);
|
|
338
|
+
this.webSocketManager.send({
|
|
339
|
+
type: 'get_raw_entity_list_response',
|
|
340
|
+
requestId,
|
|
341
|
+
data: rawEntityList
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
this.webSocketManager.send({
|
|
346
|
+
type: 'get_raw_entity_list_response',
|
|
347
|
+
requestId: message.requestId,
|
|
348
|
+
error: error instanceof Error ? error.message : String(error)
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* 处理获取实体详情请求
|
|
354
|
+
*/
|
|
355
|
+
handleGetEntityDetailsRequest(message) {
|
|
356
|
+
try {
|
|
357
|
+
const { entityId, requestId } = message;
|
|
358
|
+
if (entityId === undefined) {
|
|
359
|
+
this.webSocketManager.send({
|
|
360
|
+
type: 'get_entity_details_response',
|
|
361
|
+
requestId,
|
|
362
|
+
error: '缺少实体ID参数'
|
|
363
|
+
});
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const scene = this.sceneManager.currentScene;
|
|
367
|
+
const entityDetails = this.entityCollector.getEntityDetails(entityId, scene);
|
|
368
|
+
this.webSocketManager.send({
|
|
369
|
+
type: 'get_entity_details_response',
|
|
370
|
+
requestId,
|
|
371
|
+
data: entityDetails
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
catch (error) {
|
|
375
|
+
this.webSocketManager.send({
|
|
376
|
+
type: 'get_entity_details_response',
|
|
377
|
+
requestId: message.requestId,
|
|
378
|
+
error: error instanceof Error ? error.message : String(error)
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* 处理获取高级性能分析数据请求
|
|
384
|
+
*/
|
|
385
|
+
handleGetAdvancedProfilerDataRequest(message) {
|
|
386
|
+
try {
|
|
387
|
+
const { requestId } = message;
|
|
388
|
+
// 收集高级性能数据
|
|
389
|
+
const advancedData = ProfilerSDK.isEnabled()
|
|
390
|
+
? this.advancedProfilerCollector.collectAdvancedData(this.performanceMonitor)
|
|
391
|
+
: this.advancedProfilerCollector.collectFromLegacyMonitor(this.performanceMonitor);
|
|
392
|
+
this.webSocketManager.send({
|
|
393
|
+
type: 'get_advanced_profiler_data_response',
|
|
394
|
+
requestId,
|
|
395
|
+
data: advancedData
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
this.webSocketManager.send({
|
|
400
|
+
type: 'get_advanced_profiler_data_response',
|
|
401
|
+
requestId: message.requestId,
|
|
402
|
+
error: error instanceof Error ? error.message : String(error)
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* 处理设置性能分析器选中函数请求
|
|
408
|
+
*/
|
|
409
|
+
handleSetProfilerSelectedFunction(message) {
|
|
410
|
+
try {
|
|
411
|
+
const { functionName, requestId } = message;
|
|
412
|
+
this.advancedProfilerCollector.setSelectedFunction(functionName || null);
|
|
413
|
+
// 立即发送更新的数据,无需等待下一帧
|
|
414
|
+
this.sendDebugData();
|
|
415
|
+
this.webSocketManager.send({
|
|
416
|
+
type: 'set_profiler_selected_function_response',
|
|
417
|
+
requestId,
|
|
418
|
+
success: true
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
catch (error) {
|
|
422
|
+
this.webSocketManager.send({
|
|
423
|
+
type: 'set_profiler_selected_function_response',
|
|
424
|
+
requestId: message.requestId,
|
|
425
|
+
error: error instanceof Error ? error.message : String(error)
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* 处理内存快照请求
|
|
431
|
+
*/
|
|
432
|
+
handleMemorySnapshotRequest() {
|
|
433
|
+
try {
|
|
434
|
+
const memorySnapshot = this.captureMemorySnapshot();
|
|
435
|
+
this.webSocketManager.send({
|
|
436
|
+
type: 'memory_snapshot_response',
|
|
437
|
+
data: memorySnapshot
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
this.webSocketManager.send({
|
|
442
|
+
type: 'memory_snapshot_error',
|
|
443
|
+
error: error instanceof Error ? error.message : '内存快照捕获失败'
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* 捕获内存快照
|
|
449
|
+
*/
|
|
450
|
+
captureMemorySnapshot() {
|
|
451
|
+
const timestamp = Date.now();
|
|
452
|
+
// 收集其他内存统计
|
|
453
|
+
const baseMemoryInfo = this.collectBaseMemoryInfo();
|
|
454
|
+
const scene = this.sceneManager.currentScene;
|
|
455
|
+
// 使用专门的内存计算方法收集实体数据
|
|
456
|
+
const entityData = this.entityCollector.collectEntityDataWithMemory(scene);
|
|
457
|
+
const componentMemoryStats = scene?.entities ? this.collectComponentMemoryStats(scene.entities) : { totalMemory: 0, componentTypes: 0, totalInstances: 0, breakdown: [] };
|
|
458
|
+
const systemMemoryStats = this.collectSystemMemoryStats();
|
|
459
|
+
const poolMemoryStats = this.collectPoolMemoryStats();
|
|
460
|
+
const performanceStats = this.collectPerformanceStats();
|
|
461
|
+
// 计算总内存使用量
|
|
462
|
+
const totalEntityMemory = entityData.entitiesPerArchetype.reduce((sum, arch) => sum + arch.memory, 0);
|
|
463
|
+
return {
|
|
464
|
+
timestamp,
|
|
465
|
+
version: '2.0',
|
|
466
|
+
summary: {
|
|
467
|
+
totalEntities: entityData.totalEntities,
|
|
468
|
+
totalMemoryUsage: baseMemoryInfo.usedMemory,
|
|
469
|
+
totalMemoryLimit: baseMemoryInfo.totalMemory,
|
|
470
|
+
memoryUtilization: (baseMemoryInfo.usedMemory / baseMemoryInfo.totalMemory * 100),
|
|
471
|
+
gcCollections: baseMemoryInfo.gcCollections,
|
|
472
|
+
entityMemory: totalEntityMemory,
|
|
473
|
+
componentMemory: componentMemoryStats.totalMemory,
|
|
474
|
+
systemMemory: systemMemoryStats.totalMemory,
|
|
475
|
+
poolMemory: poolMemoryStats.totalMemory
|
|
476
|
+
},
|
|
477
|
+
baseMemory: baseMemoryInfo,
|
|
478
|
+
entities: {
|
|
479
|
+
totalMemory: totalEntityMemory,
|
|
480
|
+
entityCount: entityData.totalEntities,
|
|
481
|
+
archetypes: entityData.entitiesPerArchetype,
|
|
482
|
+
largestEntities: entityData.topEntitiesByComponents
|
|
483
|
+
},
|
|
484
|
+
components: componentMemoryStats,
|
|
485
|
+
systems: systemMemoryStats,
|
|
486
|
+
pools: poolMemoryStats,
|
|
487
|
+
performance: performanceStats
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* 收集基础内存信息
|
|
492
|
+
*/
|
|
493
|
+
collectBaseMemoryInfo() {
|
|
494
|
+
const memoryInfo = {
|
|
495
|
+
totalMemory: 0,
|
|
496
|
+
usedMemory: 0,
|
|
497
|
+
freeMemory: 0,
|
|
498
|
+
gcCollections: 0,
|
|
499
|
+
heapInfo: null,
|
|
500
|
+
detailedMemory: undefined
|
|
501
|
+
};
|
|
502
|
+
try {
|
|
503
|
+
// 类型安全的performance memory访问
|
|
504
|
+
const performanceWithMemory = performance;
|
|
505
|
+
if (performanceWithMemory.memory) {
|
|
506
|
+
const perfMemory = performanceWithMemory.memory;
|
|
507
|
+
memoryInfo.totalMemory = perfMemory.jsHeapSizeLimit || 512 * 1024 * 1024;
|
|
508
|
+
memoryInfo.usedMemory = perfMemory.usedJSHeapSize || 0;
|
|
509
|
+
memoryInfo.freeMemory = memoryInfo.totalMemory - memoryInfo.usedMemory;
|
|
510
|
+
memoryInfo.heapInfo = {
|
|
511
|
+
totalJSHeapSize: perfMemory.totalJSHeapSize || 0,
|
|
512
|
+
usedJSHeapSize: perfMemory.usedJSHeapSize || 0,
|
|
513
|
+
jsHeapSizeLimit: perfMemory.jsHeapSizeLimit || 0
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
memoryInfo.totalMemory = 512 * 1024 * 1024;
|
|
518
|
+
memoryInfo.freeMemory = 512 * 1024 * 1024;
|
|
519
|
+
}
|
|
520
|
+
// 尝试获取GC信息
|
|
521
|
+
if (performanceWithMemory.measureUserAgentSpecificMemory) {
|
|
522
|
+
performanceWithMemory.measureUserAgentSpecificMemory().then((result) => {
|
|
523
|
+
memoryInfo.detailedMemory = result;
|
|
524
|
+
}).catch(() => {
|
|
525
|
+
// 忽略错误
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
catch (error) {
|
|
530
|
+
// 使用默认值
|
|
531
|
+
}
|
|
532
|
+
return memoryInfo;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* 收集组件内存统计(仅用于内存快照)
|
|
536
|
+
*/
|
|
537
|
+
collectComponentMemoryStats(entityList) {
|
|
538
|
+
const componentStats = new Map();
|
|
539
|
+
let totalComponentMemory = 0;
|
|
540
|
+
// 首先统计组件类型和数量
|
|
541
|
+
const componentTypeCounts = new Map();
|
|
542
|
+
for (const entity of entityList.buffer) {
|
|
543
|
+
if (!entity || entity.destroyed || !entity.components)
|
|
544
|
+
continue;
|
|
545
|
+
for (const component of entity.components) {
|
|
546
|
+
const typeName = getComponentInstanceTypeName(component);
|
|
547
|
+
componentTypeCounts.set(typeName, (componentTypeCounts.get(typeName) || 0) + 1);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
// 为每种组件类型计算详细内存(只计算一次,然后乘以数量)
|
|
551
|
+
for (const [typeName, count] of componentTypeCounts.entries()) {
|
|
552
|
+
const detailedMemoryPerInstance = this.componentCollector.calculateDetailedComponentMemory(typeName);
|
|
553
|
+
const totalMemoryForType = detailedMemoryPerInstance * count;
|
|
554
|
+
totalComponentMemory += totalMemoryForType;
|
|
555
|
+
// 收集该类型组件的实例信息(用于显示最大的几个实例)
|
|
556
|
+
const instances = [];
|
|
557
|
+
let instanceCount = 0;
|
|
558
|
+
for (const entity of entityList.buffer) {
|
|
559
|
+
if (!entity || entity.destroyed || !entity.components)
|
|
560
|
+
continue;
|
|
561
|
+
for (const component of entity.components) {
|
|
562
|
+
if (getComponentInstanceTypeName(component) === typeName) {
|
|
563
|
+
instances.push({
|
|
564
|
+
entityId: entity.id,
|
|
565
|
+
entityName: entity.name || `Entity_${entity.id}`,
|
|
566
|
+
memory: detailedMemoryPerInstance // 使用统一的详细计算结果
|
|
567
|
+
});
|
|
568
|
+
instanceCount++;
|
|
569
|
+
// 限制收集的实例数量,避免过多数据
|
|
570
|
+
if (instanceCount >= 100)
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (instanceCount >= 100)
|
|
575
|
+
break;
|
|
576
|
+
}
|
|
577
|
+
componentStats.set(typeName, {
|
|
578
|
+
count: count,
|
|
579
|
+
totalMemory: totalMemoryForType,
|
|
580
|
+
instances: instances.slice(0, 10) // 只保留前10个实例用于显示
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
const componentBreakdown = Array.from(componentStats.entries()).map(([typeName, stats]) => ({
|
|
584
|
+
typeName,
|
|
585
|
+
instanceCount: stats.count,
|
|
586
|
+
totalMemory: stats.totalMemory,
|
|
587
|
+
averageMemory: stats.totalMemory / stats.count,
|
|
588
|
+
percentage: totalComponentMemory > 0 ? (stats.totalMemory / totalComponentMemory * 100) : 0,
|
|
589
|
+
largestInstances: stats.instances.sort((a, b) => b.memory - a.memory).slice(0, 3)
|
|
590
|
+
})).sort((a, b) => b.totalMemory - a.totalMemory);
|
|
591
|
+
return {
|
|
592
|
+
totalMemory: totalComponentMemory,
|
|
593
|
+
componentTypes: componentStats.size,
|
|
594
|
+
totalInstances: Array.from(componentStats.values()).reduce((sum, stats) => sum + stats.count, 0),
|
|
595
|
+
breakdown: componentBreakdown
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
collectSystemMemoryStats() {
|
|
599
|
+
const scene = this.sceneManager.currentScene;
|
|
600
|
+
let totalSystemMemory = 0;
|
|
601
|
+
const systemBreakdown = [];
|
|
602
|
+
try {
|
|
603
|
+
const systems = scene?.systems;
|
|
604
|
+
if (systems) {
|
|
605
|
+
const systemTypeMemoryCache = new Map();
|
|
606
|
+
for (const system of systems) {
|
|
607
|
+
const systemTypeName = getSystemInstanceTypeName(system);
|
|
608
|
+
let systemMemory;
|
|
609
|
+
if (systemTypeMemoryCache.has(systemTypeName)) {
|
|
610
|
+
systemMemory = systemTypeMemoryCache.get(systemTypeName);
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
systemMemory = this.calculateQuickSystemSize(system);
|
|
614
|
+
systemTypeMemoryCache.set(systemTypeName, systemMemory);
|
|
615
|
+
}
|
|
616
|
+
totalSystemMemory += systemMemory;
|
|
617
|
+
systemBreakdown.push({
|
|
618
|
+
name: systemTypeName,
|
|
619
|
+
memory: systemMemory,
|
|
620
|
+
enabled: system.enabled !== false,
|
|
621
|
+
updateOrder: system.updateOrder || 0
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
catch (error) {
|
|
627
|
+
// 忽略错误
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
totalMemory: totalSystemMemory,
|
|
631
|
+
systemCount: systemBreakdown.length,
|
|
632
|
+
breakdown: systemBreakdown.sort((a, b) => b.memory - a.memory)
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
calculateQuickSystemSize(system) {
|
|
636
|
+
if (!system || typeof system !== 'object')
|
|
637
|
+
return 64;
|
|
638
|
+
let size = 128;
|
|
639
|
+
try {
|
|
640
|
+
const keys = Object.keys(system);
|
|
641
|
+
for (let i = 0; i < Math.min(keys.length, 15); i++) {
|
|
642
|
+
const key = keys[i];
|
|
643
|
+
if (!key || key === 'entities' || key === 'scene' || key === 'constructor')
|
|
644
|
+
continue;
|
|
645
|
+
const value = system[key];
|
|
646
|
+
size += key.length * 2;
|
|
647
|
+
if (typeof value === 'string') {
|
|
648
|
+
size += Math.min(value.length * 2, 100);
|
|
649
|
+
}
|
|
650
|
+
else if (typeof value === 'number') {
|
|
651
|
+
size += 8;
|
|
652
|
+
}
|
|
653
|
+
else if (typeof value === 'boolean') {
|
|
654
|
+
size += 4;
|
|
655
|
+
}
|
|
656
|
+
else if (Array.isArray(value)) {
|
|
657
|
+
size += 40 + Math.min(value.length * 8, 200);
|
|
658
|
+
}
|
|
659
|
+
else if (typeof value === 'object' && value !== null) {
|
|
660
|
+
size += 64;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
return 128;
|
|
666
|
+
}
|
|
667
|
+
return Math.max(size, 64);
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* 收集对象池内存统计
|
|
671
|
+
*/
|
|
672
|
+
collectPoolMemoryStats() {
|
|
673
|
+
let totalPoolMemory = 0;
|
|
674
|
+
const poolBreakdown = [];
|
|
675
|
+
try {
|
|
676
|
+
// 尝试获取组件池统计
|
|
677
|
+
const poolManager = ComponentPoolManager.getInstance();
|
|
678
|
+
const poolStats = poolManager.getPoolStats();
|
|
679
|
+
for (const [typeName, stats] of poolStats.entries()) {
|
|
680
|
+
const poolData = stats;
|
|
681
|
+
const poolMemory = poolData.maxSize * 32; // 估算每个对象32字节
|
|
682
|
+
totalPoolMemory += poolMemory;
|
|
683
|
+
poolBreakdown.push({
|
|
684
|
+
typeName,
|
|
685
|
+
maxSize: poolData.maxSize,
|
|
686
|
+
currentSize: poolData.currentSize || 0,
|
|
687
|
+
estimatedMemory: poolMemory,
|
|
688
|
+
utilization: poolData.currentSize ? (poolData.currentSize / poolData.maxSize * 100) : 0
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
catch (error) {
|
|
693
|
+
// 如果无法获取池信息,使用默认值
|
|
694
|
+
}
|
|
695
|
+
try {
|
|
696
|
+
// 尝试获取通用对象池统计
|
|
697
|
+
const poolStats = Pool.getAllPoolStats();
|
|
698
|
+
for (const [typeName, stats] of Object.entries(poolStats)) {
|
|
699
|
+
const poolData = stats;
|
|
700
|
+
totalPoolMemory += poolData.estimatedMemoryUsage;
|
|
701
|
+
poolBreakdown.push({
|
|
702
|
+
typeName: `Pool_${typeName}`,
|
|
703
|
+
maxSize: poolData.maxSize,
|
|
704
|
+
currentSize: poolData.size,
|
|
705
|
+
estimatedMemory: poolData.estimatedMemoryUsage,
|
|
706
|
+
utilization: poolData.size / poolData.maxSize * 100,
|
|
707
|
+
hitRate: poolData.hitRate * 100
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
catch (error) {
|
|
712
|
+
// 忽略错误
|
|
713
|
+
}
|
|
714
|
+
return {
|
|
715
|
+
totalMemory: totalPoolMemory,
|
|
716
|
+
poolCount: poolBreakdown.length,
|
|
717
|
+
breakdown: poolBreakdown.sort((a, b) => b.estimatedMemory - a.estimatedMemory)
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* 收集性能统计信息
|
|
722
|
+
*/
|
|
723
|
+
collectPerformanceStats() {
|
|
724
|
+
try {
|
|
725
|
+
if (!this.performanceMonitor) {
|
|
726
|
+
return { enabled: false };
|
|
727
|
+
}
|
|
728
|
+
const stats = this.performanceMonitor.getAllSystemStats();
|
|
729
|
+
const warnings = this.performanceMonitor.getPerformanceWarnings();
|
|
730
|
+
return {
|
|
731
|
+
enabled: this.performanceMonitor.enabled ?? false,
|
|
732
|
+
systemCount: stats.size,
|
|
733
|
+
warnings: warnings.slice(0, 10), // 最多10个警告
|
|
734
|
+
topSystems: Array.from(stats.entries()).map((entry) => {
|
|
735
|
+
const [name, stat] = entry;
|
|
736
|
+
return {
|
|
737
|
+
name,
|
|
738
|
+
averageTime: stat.averageTime,
|
|
739
|
+
maxTime: stat.maxTime,
|
|
740
|
+
samples: stat.executionCount
|
|
741
|
+
};
|
|
742
|
+
}).sort((a, b) => b.averageTime - a.averageTime).slice(0, 5)
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
catch (error) {
|
|
746
|
+
return { enabled: false, error: error instanceof Error ? error.message : String(error) };
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* 获取调试数据
|
|
751
|
+
*/
|
|
752
|
+
getDebugData() {
|
|
753
|
+
const currentTime = Date.now();
|
|
754
|
+
const scene = this.sceneManager.currentScene;
|
|
755
|
+
const debugData = {
|
|
756
|
+
timestamp: currentTime,
|
|
757
|
+
frameworkVersion: '1.0.0', // 可以从package.json读取
|
|
758
|
+
isRunning: this.isRunning,
|
|
759
|
+
frameworkLoaded: true,
|
|
760
|
+
currentScene: scene?.name || 'Unknown'
|
|
761
|
+
};
|
|
762
|
+
// 根据配置收集各种数据
|
|
763
|
+
if (this.config.channels.entities) {
|
|
764
|
+
debugData.entities = this.entityCollector.collectEntityData(scene);
|
|
765
|
+
}
|
|
766
|
+
if (this.config.channels.systems) {
|
|
767
|
+
debugData.systems = this.systemCollector.collectSystemData(this.performanceMonitor, scene);
|
|
768
|
+
}
|
|
769
|
+
if (this.config.channels.performance) {
|
|
770
|
+
debugData.performance = this.performanceCollector.collectPerformanceData(this.performanceMonitor);
|
|
771
|
+
}
|
|
772
|
+
if (this.config.channels.components) {
|
|
773
|
+
debugData.components = this.componentCollector.collectComponentData(scene);
|
|
774
|
+
}
|
|
775
|
+
if (this.config.channels.scenes) {
|
|
776
|
+
debugData.scenes = this.sceneCollector.collectSceneData(scene);
|
|
777
|
+
}
|
|
778
|
+
return debugData;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* 连接WebSocket
|
|
782
|
+
*/
|
|
783
|
+
async connectWebSocket() {
|
|
784
|
+
try {
|
|
785
|
+
await this.webSocketManager.connect();
|
|
786
|
+
// console.log('[ECS Debug] 调试管理器已连接到调试服务器');
|
|
787
|
+
}
|
|
788
|
+
catch (error) {
|
|
789
|
+
// console.warn('[ECS Debug] 无法连接到调试服务器:', error);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* 发送调试数据
|
|
794
|
+
*/
|
|
795
|
+
sendDebugData() {
|
|
796
|
+
if (!this.webSocketManager.getConnectionStatus()) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
try {
|
|
800
|
+
const debugData = this.getDebugData();
|
|
801
|
+
// 收集高级性能数据(包含 callGraph)
|
|
802
|
+
const isProfilerEnabled = ProfilerSDK.isEnabled();
|
|
803
|
+
const advancedProfilerData = isProfilerEnabled
|
|
804
|
+
? this.advancedProfilerCollector.collectAdvancedData(this.performanceMonitor)
|
|
805
|
+
: null;
|
|
806
|
+
// 包装成调试面板期望的消息格式
|
|
807
|
+
const message = {
|
|
808
|
+
type: 'debug_data',
|
|
809
|
+
data: debugData,
|
|
810
|
+
advancedProfiler: advancedProfilerData
|
|
811
|
+
};
|
|
812
|
+
this.webSocketManager.send(message);
|
|
813
|
+
}
|
|
814
|
+
catch (error) {
|
|
815
|
+
// console.error('[ECS Debug] 发送调试数据失败:', error);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* 释放资源
|
|
820
|
+
*/
|
|
821
|
+
dispose() {
|
|
822
|
+
this.stop();
|
|
823
|
+
// 恢复原始 console 方法
|
|
824
|
+
console.log = this.originalConsole.log;
|
|
825
|
+
console.debug = this.originalConsole.debug;
|
|
826
|
+
console.info = this.originalConsole.info;
|
|
827
|
+
console.warn = this.originalConsole.warn;
|
|
828
|
+
console.error = this.originalConsole.error;
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
__decorate([
|
|
832
|
+
InjectProperty(SceneManager),
|
|
833
|
+
__metadata("design:type", SceneManager)
|
|
834
|
+
], DebugManager.prototype, "sceneManager", void 0);
|
|
835
|
+
__decorate([
|
|
836
|
+
InjectProperty(PerformanceMonitor),
|
|
837
|
+
__metadata("design:type", PerformanceMonitor)
|
|
838
|
+
], DebugManager.prototype, "performanceMonitor", void 0);
|
|
839
|
+
__decorate([
|
|
840
|
+
InjectProperty(DebugConfigService),
|
|
841
|
+
__metadata("design:type", DebugConfigService)
|
|
842
|
+
], DebugManager.prototype, "configService", void 0);
|
|
843
|
+
DebugManager = __decorate([
|
|
844
|
+
Injectable(),
|
|
845
|
+
Updatable()
|
|
846
|
+
], DebugManager);
|
|
847
|
+
export { DebugManager };
|
|
848
|
+
//# sourceMappingURL=DebugManager.js.map
|