@esengine/ecs-framework 2.2.21 → 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/index.cjs +0 -2
- package/index.cjs.map +0 -1
- package/index.d.ts +0 -13129
- 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,870 @@
|
|
|
1
|
+
import { getComponentInstanceTypeName } from '../../ECS/Decorators';
|
|
2
|
+
import { HierarchyComponent } from '../../ECS/Components/HierarchyComponent';
|
|
3
|
+
import { HierarchySystem } from '../../ECS/Systems/HierarchySystem';
|
|
4
|
+
/**
|
|
5
|
+
* 实体数据收集器
|
|
6
|
+
*/
|
|
7
|
+
export class EntityDataCollector {
|
|
8
|
+
/**
|
|
9
|
+
* 收集实体数据
|
|
10
|
+
* @param scene 场景实例
|
|
11
|
+
*/
|
|
12
|
+
collectEntityData(scene) {
|
|
13
|
+
if (!scene) {
|
|
14
|
+
return this.getEmptyEntityDebugData();
|
|
15
|
+
}
|
|
16
|
+
const entityList = scene.entities;
|
|
17
|
+
if (!entityList) {
|
|
18
|
+
return this.getEmptyEntityDebugData();
|
|
19
|
+
}
|
|
20
|
+
let stats;
|
|
21
|
+
try {
|
|
22
|
+
stats = entityList.getStats ? entityList.getStats() : this.calculateFallbackEntityStats(entityList);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
totalEntities: 0,
|
|
27
|
+
activeEntities: 0,
|
|
28
|
+
pendingAdd: 0,
|
|
29
|
+
pendingRemove: 0,
|
|
30
|
+
entitiesPerArchetype: [],
|
|
31
|
+
topEntitiesByComponents: [],
|
|
32
|
+
entityHierarchy: [],
|
|
33
|
+
entityDetailsMap: {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const archetypeData = this.collectArchetypeData(scene);
|
|
37
|
+
return {
|
|
38
|
+
totalEntities: stats.totalEntities,
|
|
39
|
+
activeEntities: stats.activeEntities,
|
|
40
|
+
pendingAdd: stats.pendingAdd || 0,
|
|
41
|
+
pendingRemove: stats.pendingRemove || 0,
|
|
42
|
+
entitiesPerArchetype: archetypeData.distribution,
|
|
43
|
+
topEntitiesByComponents: archetypeData.topEntities,
|
|
44
|
+
entityHierarchy: [],
|
|
45
|
+
entityDetailsMap: {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 获取原始实体列表
|
|
50
|
+
* @param scene 场景实例
|
|
51
|
+
*/
|
|
52
|
+
getRawEntityList(scene) {
|
|
53
|
+
if (!scene)
|
|
54
|
+
return [];
|
|
55
|
+
const entityList = scene.entities;
|
|
56
|
+
if (!entityList?.buffer)
|
|
57
|
+
return [];
|
|
58
|
+
const hierarchySystem = scene.getSystem(HierarchySystem);
|
|
59
|
+
return entityList.buffer.map((entity) => {
|
|
60
|
+
const hierarchy = entity.getComponent(HierarchyComponent);
|
|
61
|
+
const bActiveInHierarchy = hierarchySystem?.isActiveInHierarchy(entity) ?? entity.active;
|
|
62
|
+
const depth = hierarchySystem?.getDepth(entity) ?? 0;
|
|
63
|
+
return {
|
|
64
|
+
id: entity.id,
|
|
65
|
+
name: entity.name || `Entity_${entity.id}`,
|
|
66
|
+
active: entity.active !== false,
|
|
67
|
+
enabled: entity.enabled !== false,
|
|
68
|
+
activeInHierarchy: bActiveInHierarchy,
|
|
69
|
+
componentCount: entity.components.length,
|
|
70
|
+
componentTypes: entity.components.map((component) => getComponentInstanceTypeName(component)),
|
|
71
|
+
parentId: hierarchy?.parentId ?? null,
|
|
72
|
+
childIds: hierarchy?.childIds ?? [],
|
|
73
|
+
depth,
|
|
74
|
+
tag: entity.tag || 0,
|
|
75
|
+
updateOrder: entity.updateOrder || 0
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 获取实体详细信息
|
|
81
|
+
* @param entityId 实体ID
|
|
82
|
+
* @param scene 场景实例
|
|
83
|
+
*/
|
|
84
|
+
getEntityDetails(entityId, scene) {
|
|
85
|
+
try {
|
|
86
|
+
if (!scene)
|
|
87
|
+
return null;
|
|
88
|
+
const entityList = scene.entities;
|
|
89
|
+
if (!entityList?.buffer)
|
|
90
|
+
return null;
|
|
91
|
+
const entity = entityList.buffer.find((e) => e.id === entityId);
|
|
92
|
+
if (!entity)
|
|
93
|
+
return null;
|
|
94
|
+
const baseDebugInfo = entity.getDebugInfo
|
|
95
|
+
? entity.getDebugInfo()
|
|
96
|
+
: this.buildFallbackEntityInfo(entity, scene);
|
|
97
|
+
const componentDetails = this.extractComponentDetails(entity.components);
|
|
98
|
+
const sceneInfo = this.getSceneInfo(scene);
|
|
99
|
+
return {
|
|
100
|
+
...baseDebugInfo,
|
|
101
|
+
scene: sceneInfo.name,
|
|
102
|
+
sceneName: sceneInfo.name,
|
|
103
|
+
sceneType: sceneInfo.type,
|
|
104
|
+
parentName: entity.parent?.name || null,
|
|
105
|
+
components: componentDetails || [],
|
|
106
|
+
componentCount: entity.components?.length || 0,
|
|
107
|
+
componentTypes: entity.components?.map((comp) => getComponentInstanceTypeName(comp)) || []
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return {
|
|
112
|
+
error: `获取实体详情失败: ${error instanceof Error ? error.message : String(error)}`,
|
|
113
|
+
scene: '获取失败',
|
|
114
|
+
components: [],
|
|
115
|
+
componentCount: 0,
|
|
116
|
+
componentTypes: []
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
getSceneInfo(scene) {
|
|
121
|
+
let sceneName = '当前场景';
|
|
122
|
+
let sceneType = 'Scene';
|
|
123
|
+
try {
|
|
124
|
+
if (scene.name && typeof scene.name === 'string' && scene.name.trim()) {
|
|
125
|
+
sceneName = scene.name.trim();
|
|
126
|
+
}
|
|
127
|
+
else if (scene.constructor && scene.constructor.name) {
|
|
128
|
+
sceneName = scene.constructor.name;
|
|
129
|
+
sceneType = scene.constructor.name;
|
|
130
|
+
}
|
|
131
|
+
else if (scene._name && typeof scene._name === 'string' && scene._name.trim()) {
|
|
132
|
+
sceneName = scene._name.trim();
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const sceneClassName = Object.getPrototypeOf(scene)?.constructor?.name;
|
|
136
|
+
if (sceneClassName && sceneClassName !== 'Object') {
|
|
137
|
+
sceneName = sceneClassName;
|
|
138
|
+
sceneType = sceneClassName;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
sceneName = '场景名获取失败';
|
|
144
|
+
}
|
|
145
|
+
return { name: sceneName, type: sceneType };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* 收集实体数据(包含内存信息)
|
|
149
|
+
* @param scene 场景实例
|
|
150
|
+
*/
|
|
151
|
+
collectEntityDataWithMemory(scene) {
|
|
152
|
+
if (!scene) {
|
|
153
|
+
return this.getEmptyEntityDebugData();
|
|
154
|
+
}
|
|
155
|
+
const entityList = scene.entities;
|
|
156
|
+
if (!entityList) {
|
|
157
|
+
return this.getEmptyEntityDebugData();
|
|
158
|
+
}
|
|
159
|
+
let stats;
|
|
160
|
+
try {
|
|
161
|
+
stats = entityList.getStats ? entityList.getStats() : this.calculateFallbackEntityStats(entityList);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
return {
|
|
165
|
+
totalEntities: 0,
|
|
166
|
+
activeEntities: 0,
|
|
167
|
+
pendingAdd: 0,
|
|
168
|
+
pendingRemove: 0,
|
|
169
|
+
entitiesPerArchetype: [],
|
|
170
|
+
topEntitiesByComponents: [],
|
|
171
|
+
entityHierarchy: [],
|
|
172
|
+
entityDetailsMap: {}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const archetypeData = this.collectArchetypeDataWithMemory(scene);
|
|
176
|
+
return {
|
|
177
|
+
totalEntities: stats.totalEntities,
|
|
178
|
+
activeEntities: stats.activeEntities,
|
|
179
|
+
pendingAdd: stats.pendingAdd || 0,
|
|
180
|
+
pendingRemove: stats.pendingRemove || 0,
|
|
181
|
+
entitiesPerArchetype: archetypeData.distribution,
|
|
182
|
+
topEntitiesByComponents: archetypeData.topEntities,
|
|
183
|
+
entityHierarchy: this.buildEntityHierarchyTree(entityList, scene),
|
|
184
|
+
entityDetailsMap: this.buildEntityDetailsMap(entityList, scene)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
collectArchetypeData(scene) {
|
|
188
|
+
if (scene && scene.archetypeSystem && typeof scene.archetypeSystem.getAllArchetypes === 'function') {
|
|
189
|
+
return this.extractArchetypeStatistics(scene.archetypeSystem);
|
|
190
|
+
}
|
|
191
|
+
const entityContainer = { entities: scene.entities?.buffer || [] };
|
|
192
|
+
return {
|
|
193
|
+
distribution: this.getArchetypeDistributionFast(entityContainer),
|
|
194
|
+
topEntities: this.getTopEntitiesByComponentsFast(entityContainer)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
getArchetypeDistributionFast(entityContainer) {
|
|
198
|
+
const distribution = new Map();
|
|
199
|
+
if (entityContainer && entityContainer.entities) {
|
|
200
|
+
entityContainer.entities.forEach((entity) => {
|
|
201
|
+
const componentTypes = entity.components?.map((comp) => getComponentInstanceTypeName(comp)) || [];
|
|
202
|
+
const signature = componentTypes.length > 0 ? componentTypes.sort().join(', ') : '无组件';
|
|
203
|
+
const existing = distribution.get(signature);
|
|
204
|
+
if (existing) {
|
|
205
|
+
existing.count++;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
distribution.set(signature, { count: 1, componentTypes });
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return Array.from(distribution.entries())
|
|
213
|
+
.map(([signature, data]) => ({
|
|
214
|
+
signature,
|
|
215
|
+
count: data.count,
|
|
216
|
+
memory: 0
|
|
217
|
+
}))
|
|
218
|
+
.sort((a, b) => b.count - a.count)
|
|
219
|
+
.slice(0, 20);
|
|
220
|
+
}
|
|
221
|
+
getTopEntitiesByComponentsFast(entityContainer) {
|
|
222
|
+
if (!entityContainer || !entityContainer.entities) {
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
225
|
+
return entityContainer.entities
|
|
226
|
+
.map((entity) => ({
|
|
227
|
+
id: entity.id.toString(),
|
|
228
|
+
name: entity.name || `Entity_${entity.id}`,
|
|
229
|
+
componentCount: entity.components?.length || 0,
|
|
230
|
+
memory: 0
|
|
231
|
+
}))
|
|
232
|
+
.sort((a, b) => b.componentCount - a.componentCount);
|
|
233
|
+
}
|
|
234
|
+
collectArchetypeDataWithMemory(scene) {
|
|
235
|
+
if (scene && scene.archetypeSystem && typeof scene.archetypeSystem.getAllArchetypes === 'function') {
|
|
236
|
+
return this.extractArchetypeStatisticsWithMemory(scene.archetypeSystem);
|
|
237
|
+
}
|
|
238
|
+
const entityContainer = { entities: scene.entities?.buffer || [] };
|
|
239
|
+
return {
|
|
240
|
+
distribution: this.getArchetypeDistributionWithMemory(entityContainer),
|
|
241
|
+
topEntities: this.getTopEntitiesByComponentsWithMemory(entityContainer)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
extractArchetypeStatistics(archetypeSystem) {
|
|
245
|
+
const archetypes = archetypeSystem.getAllArchetypes();
|
|
246
|
+
const distribution = [];
|
|
247
|
+
const topEntities = [];
|
|
248
|
+
archetypes.forEach((archetype) => {
|
|
249
|
+
const signature = archetype.componentTypes?.map((type) => type.name).join(',') || 'Unknown';
|
|
250
|
+
const entityCount = archetype.entities?.length || 0;
|
|
251
|
+
distribution.push({
|
|
252
|
+
signature,
|
|
253
|
+
count: entityCount,
|
|
254
|
+
memory: 0
|
|
255
|
+
});
|
|
256
|
+
if (archetype.entities) {
|
|
257
|
+
archetype.entities.forEach((entity) => {
|
|
258
|
+
topEntities.push({
|
|
259
|
+
id: entity.id.toString(),
|
|
260
|
+
name: entity.name || `Entity_${entity.id}`,
|
|
261
|
+
componentCount: entity.components?.length || 0,
|
|
262
|
+
memory: 0
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
distribution.sort((a, b) => b.count - a.count);
|
|
268
|
+
topEntities.sort((a, b) => b.componentCount - a.componentCount);
|
|
269
|
+
return { distribution, topEntities };
|
|
270
|
+
}
|
|
271
|
+
extractArchetypeStatisticsWithMemory(archetypeSystem) {
|
|
272
|
+
const archetypes = archetypeSystem.getAllArchetypes();
|
|
273
|
+
const distribution = [];
|
|
274
|
+
const topEntities = [];
|
|
275
|
+
archetypes.forEach((archetype) => {
|
|
276
|
+
const signature = archetype.componentTypes?.map((type) => type.name).join(',') || 'Unknown';
|
|
277
|
+
const entityCount = archetype.entities?.length || 0;
|
|
278
|
+
let actualMemory = 0;
|
|
279
|
+
if (archetype.entities && archetype.entities.length > 0) {
|
|
280
|
+
const sampleSize = Math.min(5, archetype.entities.length);
|
|
281
|
+
let sampleMemory = 0;
|
|
282
|
+
for (let i = 0; i < sampleSize; i++) {
|
|
283
|
+
sampleMemory += this.estimateEntityMemoryUsage(archetype.entities[i]);
|
|
284
|
+
}
|
|
285
|
+
actualMemory = (sampleMemory / sampleSize) * entityCount;
|
|
286
|
+
}
|
|
287
|
+
distribution.push({
|
|
288
|
+
signature,
|
|
289
|
+
count: entityCount,
|
|
290
|
+
memory: actualMemory
|
|
291
|
+
});
|
|
292
|
+
if (archetype.entities) {
|
|
293
|
+
archetype.entities.forEach((entity) => {
|
|
294
|
+
topEntities.push({
|
|
295
|
+
id: entity.id.toString(),
|
|
296
|
+
name: entity.name || `Entity_${entity.id}`,
|
|
297
|
+
componentCount: entity.components?.length || 0,
|
|
298
|
+
memory: this.estimateEntityMemoryUsage(entity)
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
distribution.sort((a, b) => b.count - a.count);
|
|
304
|
+
topEntities.sort((a, b) => b.componentCount - a.componentCount);
|
|
305
|
+
return { distribution, topEntities };
|
|
306
|
+
}
|
|
307
|
+
getArchetypeDistributionWithMemory(entityContainer) {
|
|
308
|
+
const distribution = new Map();
|
|
309
|
+
if (entityContainer && entityContainer.entities) {
|
|
310
|
+
entityContainer.entities.forEach((entity) => {
|
|
311
|
+
const componentTypes = entity.components?.map((comp) => getComponentInstanceTypeName(comp)) || [];
|
|
312
|
+
const signature = componentTypes.length > 0 ? componentTypes.sort().join(', ') : '无组件';
|
|
313
|
+
const existing = distribution.get(signature);
|
|
314
|
+
let memory = this.estimateEntityMemoryUsage(entity);
|
|
315
|
+
if (isNaN(memory) || memory < 0) {
|
|
316
|
+
memory = 0;
|
|
317
|
+
}
|
|
318
|
+
if (existing) {
|
|
319
|
+
existing.count++;
|
|
320
|
+
existing.memory += memory;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
distribution.set(signature, { count: 1, memory, componentTypes });
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return Array.from(distribution.entries())
|
|
328
|
+
.map(([signature, data]) => ({
|
|
329
|
+
signature,
|
|
330
|
+
count: data.count,
|
|
331
|
+
memory: isNaN(data.memory) ? 0 : data.memory
|
|
332
|
+
}))
|
|
333
|
+
.sort((a, b) => b.count - a.count);
|
|
334
|
+
}
|
|
335
|
+
getTopEntitiesByComponentsWithMemory(entityContainer) {
|
|
336
|
+
if (!entityContainer || !entityContainer.entities) {
|
|
337
|
+
return [];
|
|
338
|
+
}
|
|
339
|
+
return entityContainer.entities
|
|
340
|
+
.map((entity) => ({
|
|
341
|
+
id: entity.id.toString(),
|
|
342
|
+
name: entity.name || `Entity_${entity.id}`,
|
|
343
|
+
componentCount: entity.components?.length || 0,
|
|
344
|
+
memory: this.estimateEntityMemoryUsage(entity)
|
|
345
|
+
}))
|
|
346
|
+
.sort((a, b) => b.componentCount - a.componentCount);
|
|
347
|
+
}
|
|
348
|
+
getEmptyEntityDebugData() {
|
|
349
|
+
return {
|
|
350
|
+
totalEntities: 0,
|
|
351
|
+
activeEntities: 0,
|
|
352
|
+
pendingAdd: 0,
|
|
353
|
+
pendingRemove: 0,
|
|
354
|
+
entitiesPerArchetype: [],
|
|
355
|
+
topEntitiesByComponents: [],
|
|
356
|
+
entityHierarchy: [],
|
|
357
|
+
entityDetailsMap: {}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
calculateFallbackEntityStats(entityList) {
|
|
361
|
+
const allEntities = entityList.buffer || [];
|
|
362
|
+
const activeEntities = allEntities.filter((entity) => entity.enabled && !entity.isDestroyed);
|
|
363
|
+
return {
|
|
364
|
+
totalEntities: allEntities.length,
|
|
365
|
+
activeEntities: activeEntities.length,
|
|
366
|
+
pendingAdd: 0,
|
|
367
|
+
pendingRemove: 0,
|
|
368
|
+
averageComponentsPerEntity: activeEntities.length > 0
|
|
369
|
+
? allEntities.reduce((sum, e) => sum + (e.components?.length || 0), 0) /
|
|
370
|
+
activeEntities.length
|
|
371
|
+
: 0
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
estimateEntityMemoryUsage(entity) {
|
|
375
|
+
try {
|
|
376
|
+
let totalSize = 0;
|
|
377
|
+
const entitySize = this.calculateObjectSize(entity, ['components', 'children', 'parent']);
|
|
378
|
+
if (!isNaN(entitySize) && entitySize > 0) {
|
|
379
|
+
totalSize += entitySize;
|
|
380
|
+
}
|
|
381
|
+
if (entity.components && Array.isArray(entity.components)) {
|
|
382
|
+
entity.components.forEach((component) => {
|
|
383
|
+
const componentSize = this.calculateObjectSize(component, ['entity']);
|
|
384
|
+
if (!isNaN(componentSize) && componentSize > 0) {
|
|
385
|
+
totalSize += componentSize;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
return isNaN(totalSize) || totalSize < 0 ? 0 : totalSize;
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
return 0;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
calculateObjectSize(obj, excludeKeys = []) {
|
|
396
|
+
if (!obj || typeof obj !== 'object')
|
|
397
|
+
return 0;
|
|
398
|
+
const visited = new WeakSet();
|
|
399
|
+
const maxDepth = 2;
|
|
400
|
+
const calculate = (item, depth = 0) => {
|
|
401
|
+
if (!item || typeof item !== 'object' || depth >= maxDepth) {
|
|
402
|
+
return 0;
|
|
403
|
+
}
|
|
404
|
+
if (visited.has(item))
|
|
405
|
+
return 0;
|
|
406
|
+
visited.add(item);
|
|
407
|
+
let itemSize = 32;
|
|
408
|
+
try {
|
|
409
|
+
const keys = Object.keys(item);
|
|
410
|
+
const maxKeys = Math.min(keys.length, 20);
|
|
411
|
+
for (let i = 0; i < maxKeys; i++) {
|
|
412
|
+
const key = keys[i];
|
|
413
|
+
if (!key ||
|
|
414
|
+
excludeKeys.includes(key) ||
|
|
415
|
+
key === 'constructor' ||
|
|
416
|
+
key === '__proto__' ||
|
|
417
|
+
key.startsWith('_cc_') ||
|
|
418
|
+
key.startsWith('__')) {
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
const value = item[key];
|
|
422
|
+
itemSize += key.length * 2;
|
|
423
|
+
if (typeof value === 'string') {
|
|
424
|
+
itemSize += Math.min(value.length * 2, 200);
|
|
425
|
+
}
|
|
426
|
+
else if (typeof value === 'number') {
|
|
427
|
+
itemSize += 8;
|
|
428
|
+
}
|
|
429
|
+
else if (typeof value === 'boolean') {
|
|
430
|
+
itemSize += 4;
|
|
431
|
+
}
|
|
432
|
+
else if (Array.isArray(value)) {
|
|
433
|
+
itemSize += 40 + Math.min(value.length * 8, 160);
|
|
434
|
+
}
|
|
435
|
+
else if (typeof value === 'object' && value !== null) {
|
|
436
|
+
itemSize += calculate(value, depth + 1);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
return 64;
|
|
442
|
+
}
|
|
443
|
+
return itemSize;
|
|
444
|
+
};
|
|
445
|
+
try {
|
|
446
|
+
const size = calculate(obj);
|
|
447
|
+
return Math.max(size, 32);
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
return 64;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
buildEntityHierarchyTree(entityList, scene) {
|
|
454
|
+
if (!entityList?.buffer)
|
|
455
|
+
return [];
|
|
456
|
+
const hierarchySystem = scene?.getSystem(HierarchySystem);
|
|
457
|
+
const rootEntities = [];
|
|
458
|
+
entityList.buffer.forEach((entity) => {
|
|
459
|
+
const hierarchy = entity.getComponent(HierarchyComponent);
|
|
460
|
+
const bHasNoParent = hierarchy?.parentId === null || hierarchy?.parentId === undefined;
|
|
461
|
+
if (bHasNoParent) {
|
|
462
|
+
const hierarchyNode = this.buildEntityHierarchyNode(entity, hierarchySystem);
|
|
463
|
+
rootEntities.push(hierarchyNode);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
// 按实体名称排序,提供一致的显示顺序
|
|
467
|
+
rootEntities.sort((nodeA, nodeB) => {
|
|
468
|
+
if (nodeA.name < nodeB.name)
|
|
469
|
+
return -1;
|
|
470
|
+
if (nodeA.name > nodeB.name)
|
|
471
|
+
return 1;
|
|
472
|
+
return nodeA.id - nodeB.id;
|
|
473
|
+
});
|
|
474
|
+
return rootEntities;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* 构建实体层次结构节点
|
|
478
|
+
*/
|
|
479
|
+
buildEntityHierarchyNode(entity, hierarchySystem) {
|
|
480
|
+
const hierarchy = entity.getComponent(HierarchyComponent);
|
|
481
|
+
const bActiveInHierarchy = hierarchySystem?.isActiveInHierarchy(entity) ?? entity.active;
|
|
482
|
+
const depth = hierarchySystem?.getDepth(entity) ?? 0;
|
|
483
|
+
let node = {
|
|
484
|
+
id: entity.id,
|
|
485
|
+
name: entity.name || `Entity_${entity.id}`,
|
|
486
|
+
active: entity.active !== false,
|
|
487
|
+
enabled: entity.enabled !== false,
|
|
488
|
+
activeInHierarchy: bActiveInHierarchy,
|
|
489
|
+
componentCount: entity.components.length,
|
|
490
|
+
componentTypes: entity.components.map((component) => getComponentInstanceTypeName(component)),
|
|
491
|
+
parentId: hierarchy?.parentId ?? null,
|
|
492
|
+
children: [],
|
|
493
|
+
depth,
|
|
494
|
+
tag: entity.tag || 0,
|
|
495
|
+
updateOrder: entity.updateOrder || 0
|
|
496
|
+
};
|
|
497
|
+
// 递归构建子实体节点
|
|
498
|
+
if (hierarchySystem) {
|
|
499
|
+
const children = hierarchySystem.getChildren(entity);
|
|
500
|
+
if (children.length > 0) {
|
|
501
|
+
node.children = children.map((child) => this.buildEntityHierarchyNode(child, hierarchySystem));
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
// 优先使用Entity的getDebugInfo方法
|
|
505
|
+
if (typeof entity.getDebugInfo === 'function') {
|
|
506
|
+
const debugInfo = entity.getDebugInfo();
|
|
507
|
+
node = {
|
|
508
|
+
...node,
|
|
509
|
+
...debugInfo
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
// 收集所有组件详细属性信息
|
|
513
|
+
if (entity.components && entity.components.length > 0) {
|
|
514
|
+
node.componentDetails = this.extractComponentDetails(entity.components);
|
|
515
|
+
}
|
|
516
|
+
return node;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* 构建实体详情映射
|
|
520
|
+
*/
|
|
521
|
+
buildEntityDetailsMap(entityList, scene) {
|
|
522
|
+
if (!entityList?.buffer)
|
|
523
|
+
return {};
|
|
524
|
+
const hierarchySystem = scene?.getSystem(HierarchySystem);
|
|
525
|
+
const entityDetailsMap = {};
|
|
526
|
+
const entities = entityList.buffer;
|
|
527
|
+
const batchSize = 100;
|
|
528
|
+
for (let i = 0; i < entities.length; i += batchSize) {
|
|
529
|
+
const batch = entities.slice(i, i + batchSize);
|
|
530
|
+
batch.forEach((entity) => {
|
|
531
|
+
const baseDebugInfo = entity.getDebugInfo
|
|
532
|
+
? entity.getDebugInfo()
|
|
533
|
+
: this.buildFallbackEntityInfo(entity, scene, hierarchySystem);
|
|
534
|
+
const componentCacheStats = entity.getComponentCacheStats
|
|
535
|
+
? entity.getComponentCacheStats()
|
|
536
|
+
: null;
|
|
537
|
+
const componentDetails = this.extractComponentDetails(entity.components);
|
|
538
|
+
// 获取父实体名称
|
|
539
|
+
const parent = hierarchySystem?.getParent(entity);
|
|
540
|
+
const parentName = parent?.name ?? null;
|
|
541
|
+
entityDetailsMap[entity.id] = {
|
|
542
|
+
...baseDebugInfo,
|
|
543
|
+
parentName,
|
|
544
|
+
components: componentDetails,
|
|
545
|
+
componentTypes: baseDebugInfo.componentTypes || componentDetails.map((comp) => comp.typeName),
|
|
546
|
+
cachePerformance: componentCacheStats
|
|
547
|
+
? {
|
|
548
|
+
hitRate: componentCacheStats.cacheStats.hitRate,
|
|
549
|
+
size: componentCacheStats.cacheStats.size,
|
|
550
|
+
maxSize: componentCacheStats.cacheStats.maxSize
|
|
551
|
+
}
|
|
552
|
+
: null
|
|
553
|
+
};
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
return entityDetailsMap;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* 构建实体基础信息
|
|
560
|
+
*/
|
|
561
|
+
buildFallbackEntityInfo(entity, scene, hierarchySystem) {
|
|
562
|
+
const sceneInfo = this.getSceneInfo(scene);
|
|
563
|
+
const hierarchy = entity.getComponent(HierarchyComponent);
|
|
564
|
+
const bActiveInHierarchy = hierarchySystem?.isActiveInHierarchy(entity) ?? entity.active;
|
|
565
|
+
const depth = hierarchySystem?.getDepth(entity) ?? 0;
|
|
566
|
+
return {
|
|
567
|
+
name: entity.name || `Entity_${entity.id}`,
|
|
568
|
+
id: entity.id,
|
|
569
|
+
enabled: entity.enabled !== false,
|
|
570
|
+
active: entity.active !== false,
|
|
571
|
+
activeInHierarchy: bActiveInHierarchy,
|
|
572
|
+
destroyed: entity.isDestroyed || false,
|
|
573
|
+
scene: sceneInfo.name,
|
|
574
|
+
sceneName: sceneInfo.name,
|
|
575
|
+
sceneType: sceneInfo.type,
|
|
576
|
+
componentCount: entity.components.length,
|
|
577
|
+
componentTypes: entity.components.map((component) => getComponentInstanceTypeName(component)),
|
|
578
|
+
componentMask: entity.componentMask?.toString() || '0',
|
|
579
|
+
parentId: hierarchy?.parentId ?? null,
|
|
580
|
+
childCount: hierarchy?.childIds?.length ?? 0,
|
|
581
|
+
childIds: hierarchy?.childIds ?? [],
|
|
582
|
+
depth,
|
|
583
|
+
tag: entity.tag || 0,
|
|
584
|
+
updateOrder: entity.updateOrder || 0
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* 提取组件详细信息
|
|
589
|
+
*/
|
|
590
|
+
extractComponentDetails(components) {
|
|
591
|
+
return components.map((component) => {
|
|
592
|
+
const typeName = getComponentInstanceTypeName(component);
|
|
593
|
+
const properties = {};
|
|
594
|
+
try {
|
|
595
|
+
const propertyKeys = Object.keys(component);
|
|
596
|
+
propertyKeys.forEach((propertyKey) => {
|
|
597
|
+
if (!propertyKey.startsWith('_') && propertyKey !== 'entity' && propertyKey !== 'constructor') {
|
|
598
|
+
const propertyValue = component[propertyKey];
|
|
599
|
+
if (propertyValue !== undefined && propertyValue !== null) {
|
|
600
|
+
properties[propertyKey] = this.formatPropertyValue(propertyValue);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
// 如果没有找到任何属性,添加一些调试信息
|
|
605
|
+
if (Object.keys(properties).length === 0) {
|
|
606
|
+
properties['_info'] = '该组件没有公开属性';
|
|
607
|
+
properties['_componentId'] = getComponentInstanceTypeName(component);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
catch (error) {
|
|
611
|
+
properties['_error'] = '属性提取失败';
|
|
612
|
+
properties['_componentId'] = getComponentInstanceTypeName(component);
|
|
613
|
+
}
|
|
614
|
+
return {
|
|
615
|
+
typeName: typeName,
|
|
616
|
+
properties: properties
|
|
617
|
+
};
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* 获取组件的完整属性信息(仅在需要时调用)
|
|
622
|
+
* @param entityId 实体ID
|
|
623
|
+
* @param componentIndex 组件索引
|
|
624
|
+
* @param scene 场景实例
|
|
625
|
+
*/
|
|
626
|
+
getComponentProperties(entityId, componentIndex, scene) {
|
|
627
|
+
try {
|
|
628
|
+
if (!scene)
|
|
629
|
+
return {};
|
|
630
|
+
const entityList = scene.entities;
|
|
631
|
+
if (!entityList?.buffer)
|
|
632
|
+
return {};
|
|
633
|
+
const entity = entityList.buffer.find((e) => e.id === entityId);
|
|
634
|
+
if (!entity || componentIndex >= entity.components.length)
|
|
635
|
+
return {};
|
|
636
|
+
const component = entity.components[componentIndex];
|
|
637
|
+
const properties = {};
|
|
638
|
+
const propertyKeys = Object.keys(component);
|
|
639
|
+
propertyKeys.forEach((propertyKey) => {
|
|
640
|
+
if (!propertyKey.startsWith('_') && propertyKey !== 'entity') {
|
|
641
|
+
const propertyValue = component[propertyKey];
|
|
642
|
+
if (propertyValue !== undefined && propertyValue !== null) {
|
|
643
|
+
properties[propertyKey] = this.formatPropertyValue(propertyValue);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
return properties;
|
|
648
|
+
}
|
|
649
|
+
catch (error) {
|
|
650
|
+
return { _error: '属性提取失败' };
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* 格式化属性值
|
|
655
|
+
*/
|
|
656
|
+
formatPropertyValue(value, depth = 0) {
|
|
657
|
+
if (value === null || value === undefined) {
|
|
658
|
+
return value;
|
|
659
|
+
}
|
|
660
|
+
if (typeof value !== 'object') {
|
|
661
|
+
if (typeof value === 'string' && value.length > 200) {
|
|
662
|
+
return `[长字符串: ${value.length}字符] ${value.substring(0, 100)}...`;
|
|
663
|
+
}
|
|
664
|
+
return value;
|
|
665
|
+
}
|
|
666
|
+
if (depth === 0) {
|
|
667
|
+
return this.formatObjectFirstLevel(value);
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
return this.createLazyLoadPlaceholder(value);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* 格式化对象第一层
|
|
675
|
+
*/
|
|
676
|
+
formatObjectFirstLevel(obj) {
|
|
677
|
+
try {
|
|
678
|
+
if (Array.isArray(obj)) {
|
|
679
|
+
if (obj.length === 0)
|
|
680
|
+
return [];
|
|
681
|
+
if (obj.length > 10) {
|
|
682
|
+
const sample = obj.slice(0, 3).map((item) => this.formatPropertyValue(item, 1));
|
|
683
|
+
return {
|
|
684
|
+
_isLazyArray: true,
|
|
685
|
+
_arrayLength: obj.length,
|
|
686
|
+
_sample: sample,
|
|
687
|
+
_summary: `数组[${obj.length}个元素]`
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
return obj.map((item) => this.formatPropertyValue(item, 1));
|
|
691
|
+
}
|
|
692
|
+
const keys = Object.keys(obj);
|
|
693
|
+
if (keys.length === 0)
|
|
694
|
+
return {};
|
|
695
|
+
const result = {};
|
|
696
|
+
let processedCount = 0;
|
|
697
|
+
const maxProperties = 15;
|
|
698
|
+
for (const key of keys) {
|
|
699
|
+
if (processedCount >= maxProperties) {
|
|
700
|
+
result._hasMoreProperties = true;
|
|
701
|
+
result._totalProperties = keys.length;
|
|
702
|
+
result._hiddenCount = keys.length - processedCount;
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
if (key.startsWith('_') || key.startsWith('$') || typeof obj[key] === 'function') {
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
try {
|
|
709
|
+
const value = obj[key];
|
|
710
|
+
if (value !== null && value !== undefined) {
|
|
711
|
+
result[key] = this.formatPropertyValue(value, 1);
|
|
712
|
+
processedCount++;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
catch (error) {
|
|
716
|
+
result[key] = `[访问失败: ${error instanceof Error ? error.message : String(error)}]`;
|
|
717
|
+
processedCount++;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return result;
|
|
721
|
+
}
|
|
722
|
+
catch (error) {
|
|
723
|
+
return `[对象解析失败: ${error instanceof Error ? error.message : String(error)}]`;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* 创建懒加载占位符
|
|
728
|
+
*/
|
|
729
|
+
createLazyLoadPlaceholder(obj) {
|
|
730
|
+
try {
|
|
731
|
+
const typeName = obj.constructor?.name || 'Object';
|
|
732
|
+
const summary = this.getObjectSummary(obj, typeName);
|
|
733
|
+
return {
|
|
734
|
+
_isLazyObject: true,
|
|
735
|
+
_typeName: typeName,
|
|
736
|
+
_summary: summary,
|
|
737
|
+
_objectId: this.generateObjectId(obj)
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
catch (error) {
|
|
741
|
+
return {
|
|
742
|
+
_isLazyObject: true,
|
|
743
|
+
_typeName: 'Unknown',
|
|
744
|
+
_summary: `无法分析的对象: ${error instanceof Error ? error.message : String(error)}`,
|
|
745
|
+
_objectId: Math.random().toString(36).substr(2, 9)
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* 获取对象摘要信息
|
|
751
|
+
*/
|
|
752
|
+
getObjectSummary(obj, typeName) {
|
|
753
|
+
try {
|
|
754
|
+
if (typeName.toLowerCase().includes('vec') || typeName.toLowerCase().includes('vector')) {
|
|
755
|
+
if (obj.x !== undefined && obj.y !== undefined) {
|
|
756
|
+
const z = obj.z !== undefined ? obj.z : '';
|
|
757
|
+
return `${typeName}(${obj.x}, ${obj.y}${z ? ', ' + z : ''})`;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
if (typeName.toLowerCase().includes('color')) {
|
|
761
|
+
if (obj.r !== undefined && obj.g !== undefined && obj.b !== undefined) {
|
|
762
|
+
const a = obj.a !== undefined ? obj.a : 1;
|
|
763
|
+
return `${typeName}(${obj.r}, ${obj.g}, ${obj.b}, ${a})`;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (typeName.toLowerCase().includes('node')) {
|
|
767
|
+
const name = obj.name || obj._name || '未命名';
|
|
768
|
+
return `${typeName}: ${name}`;
|
|
769
|
+
}
|
|
770
|
+
if (typeName.toLowerCase().includes('component')) {
|
|
771
|
+
const nodeName = obj.node?.name || obj.node?._name || '';
|
|
772
|
+
return `${typeName}${nodeName ? ` on ${nodeName}` : ''}`;
|
|
773
|
+
}
|
|
774
|
+
const keys = Object.keys(obj);
|
|
775
|
+
if (keys.length === 0) {
|
|
776
|
+
return `${typeName} (空对象)`;
|
|
777
|
+
}
|
|
778
|
+
return `${typeName} (${keys.length}个属性)`;
|
|
779
|
+
}
|
|
780
|
+
catch (error) {
|
|
781
|
+
return `${typeName} (无法分析)`;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* 生成对象ID
|
|
786
|
+
*/
|
|
787
|
+
generateObjectId(obj) {
|
|
788
|
+
try {
|
|
789
|
+
if (obj.id !== undefined)
|
|
790
|
+
return `obj_${obj.id}`;
|
|
791
|
+
if (obj._id !== undefined)
|
|
792
|
+
return `obj_${obj._id}`;
|
|
793
|
+
if (obj.uuid !== undefined)
|
|
794
|
+
return `obj_${obj.uuid}`;
|
|
795
|
+
if (obj._uuid !== undefined)
|
|
796
|
+
return `obj_${obj._uuid}`;
|
|
797
|
+
return `obj_${Math.random().toString(36).substr(2, 9)}`;
|
|
798
|
+
}
|
|
799
|
+
catch {
|
|
800
|
+
return `obj_${Math.random().toString(36).substr(2, 9)}`;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* 展开懒加载对象(供调试面板调用)
|
|
805
|
+
* @param entityId 实体ID
|
|
806
|
+
* @param componentIndex 组件索引
|
|
807
|
+
* @param propertyPath 属性路径
|
|
808
|
+
* @param scene 场景实例
|
|
809
|
+
*/
|
|
810
|
+
expandLazyObject(entityId, componentIndex, propertyPath, scene) {
|
|
811
|
+
try {
|
|
812
|
+
if (!scene)
|
|
813
|
+
return null;
|
|
814
|
+
const entityList = scene.entities;
|
|
815
|
+
if (!entityList?.buffer)
|
|
816
|
+
return null;
|
|
817
|
+
// 找到对应的实体
|
|
818
|
+
const entity = entityList.buffer.find((e) => e.id === entityId);
|
|
819
|
+
if (!entity)
|
|
820
|
+
return null;
|
|
821
|
+
// 找到对应的组件
|
|
822
|
+
if (componentIndex >= entity.components.length)
|
|
823
|
+
return null;
|
|
824
|
+
const component = entity.components[componentIndex];
|
|
825
|
+
// 根据属性路径找到对象
|
|
826
|
+
const targetObject = this.getObjectByPath(component, propertyPath);
|
|
827
|
+
if (!targetObject)
|
|
828
|
+
return null;
|
|
829
|
+
// 展开这个对象的第一层属性
|
|
830
|
+
return this.formatObjectFirstLevel(targetObject);
|
|
831
|
+
}
|
|
832
|
+
catch (error) {
|
|
833
|
+
return {
|
|
834
|
+
error: `展开失败: ${error instanceof Error ? error.message : String(error)}`
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* 根据路径获取对象
|
|
840
|
+
*/
|
|
841
|
+
getObjectByPath(root, path) {
|
|
842
|
+
if (!path)
|
|
843
|
+
return root;
|
|
844
|
+
const parts = path.split('.');
|
|
845
|
+
let current = root;
|
|
846
|
+
for (const part of parts) {
|
|
847
|
+
if (current === null || current === undefined)
|
|
848
|
+
return null;
|
|
849
|
+
// 处理数组索引
|
|
850
|
+
if (part.includes('[') && part.includes(']')) {
|
|
851
|
+
const arrayName = part.substring(0, part.indexOf('['));
|
|
852
|
+
const index = parseInt(part.substring(part.indexOf('[') + 1, part.indexOf(']')));
|
|
853
|
+
if (arrayName) {
|
|
854
|
+
current = current[arrayName];
|
|
855
|
+
}
|
|
856
|
+
if (Array.isArray(current) && index >= 0 && index < current.length) {
|
|
857
|
+
current = current[index];
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
return null;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else {
|
|
864
|
+
current = current[part];
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return current;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
//# sourceMappingURL=EntityDataCollector.js.map
|