@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,685 @@
|
|
|
1
|
+
import { SoATypeRegistry } from './SoATypeRegistry';
|
|
2
|
+
import { SoASerializer } from './SoASerializer';
|
|
3
|
+
export { SoATypeRegistry } from './SoATypeRegistry';
|
|
4
|
+
export { SoASerializer } from './SoASerializer';
|
|
5
|
+
/**
|
|
6
|
+
* 启用SoA优化装饰器
|
|
7
|
+
* 默认关闭SoA,只有在大规模批量操作场景下才建议开启
|
|
8
|
+
*/
|
|
9
|
+
export function EnableSoA(target) {
|
|
10
|
+
target.__enableSoA = true;
|
|
11
|
+
return target;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 64位浮点数装饰器
|
|
15
|
+
* 标记字段使用Float64Array存储(更高精度但更多内存)
|
|
16
|
+
*/
|
|
17
|
+
export function Float64(target, propertyKey) {
|
|
18
|
+
const key = String(propertyKey);
|
|
19
|
+
if (!target.constructor.__float64Fields) {
|
|
20
|
+
target.constructor.__float64Fields = new Set();
|
|
21
|
+
}
|
|
22
|
+
target.constructor.__float64Fields.add(key);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 32位浮点数装饰器
|
|
26
|
+
* 标记字段使用Float32Array存储(默认类型,平衡性能和精度)
|
|
27
|
+
*/
|
|
28
|
+
export function Float32(target, propertyKey) {
|
|
29
|
+
const key = String(propertyKey);
|
|
30
|
+
if (!target.constructor.__float32Fields) {
|
|
31
|
+
target.constructor.__float32Fields = new Set();
|
|
32
|
+
}
|
|
33
|
+
target.constructor.__float32Fields.add(key);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 32位整数装饰器
|
|
37
|
+
* 标记字段使用Int32Array存储(适用于整数值)
|
|
38
|
+
*/
|
|
39
|
+
export function Int32(target, propertyKey) {
|
|
40
|
+
const key = String(propertyKey);
|
|
41
|
+
if (!target.constructor.__int32Fields) {
|
|
42
|
+
target.constructor.__int32Fields = new Set();
|
|
43
|
+
}
|
|
44
|
+
target.constructor.__int32Fields.add(key);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 32位无符号整数装饰器
|
|
48
|
+
* 标记字段使用Uint32Array存储(适用于无符号整数,如ID、标志位等)
|
|
49
|
+
*/
|
|
50
|
+
export function Uint32(target, propertyKey) {
|
|
51
|
+
const key = String(propertyKey);
|
|
52
|
+
if (!target.constructor.__uint32Fields) {
|
|
53
|
+
target.constructor.__uint32Fields = new Set();
|
|
54
|
+
}
|
|
55
|
+
target.constructor.__uint32Fields.add(key);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 16位整数装饰器
|
|
59
|
+
* 标记字段使用Int16Array存储(适用于小范围整数)
|
|
60
|
+
*/
|
|
61
|
+
export function Int16(target, propertyKey) {
|
|
62
|
+
const key = String(propertyKey);
|
|
63
|
+
if (!target.constructor.__int16Fields) {
|
|
64
|
+
target.constructor.__int16Fields = new Set();
|
|
65
|
+
}
|
|
66
|
+
target.constructor.__int16Fields.add(key);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 16位无符号整数装饰器
|
|
70
|
+
* 标记字段使用Uint16Array存储(适用于小范围无符号整数)
|
|
71
|
+
*/
|
|
72
|
+
export function Uint16(target, propertyKey) {
|
|
73
|
+
const key = String(propertyKey);
|
|
74
|
+
if (!target.constructor.__uint16Fields) {
|
|
75
|
+
target.constructor.__uint16Fields = new Set();
|
|
76
|
+
}
|
|
77
|
+
target.constructor.__uint16Fields.add(key);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 8位整数装饰器
|
|
81
|
+
* 标记字段使用Int8Array存储(适用于很小的整数值)
|
|
82
|
+
*/
|
|
83
|
+
export function Int8(target, propertyKey) {
|
|
84
|
+
const key = String(propertyKey);
|
|
85
|
+
if (!target.constructor.__int8Fields) {
|
|
86
|
+
target.constructor.__int8Fields = new Set();
|
|
87
|
+
}
|
|
88
|
+
target.constructor.__int8Fields.add(key);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 8位无符号整数装饰器
|
|
92
|
+
* 标记字段使用Uint8Array存储(适用于字节值、布尔标志等)
|
|
93
|
+
*/
|
|
94
|
+
export function Uint8(target, propertyKey) {
|
|
95
|
+
const key = String(propertyKey);
|
|
96
|
+
if (!target.constructor.__uint8Fields) {
|
|
97
|
+
target.constructor.__uint8Fields = new Set();
|
|
98
|
+
}
|
|
99
|
+
target.constructor.__uint8Fields.add(key);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 8位夹紧整数装饰器
|
|
103
|
+
* 标记字段使用Uint8ClampedArray存储(适用于颜色值等需要夹紧的数据)
|
|
104
|
+
*/
|
|
105
|
+
export function Uint8Clamped(target, propertyKey) {
|
|
106
|
+
const key = String(propertyKey);
|
|
107
|
+
if (!target.constructor.__uint8ClampedFields) {
|
|
108
|
+
target.constructor.__uint8ClampedFields = new Set();
|
|
109
|
+
}
|
|
110
|
+
target.constructor.__uint8ClampedFields.add(key);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 序列化Map装饰器
|
|
114
|
+
* 标记Map字段需要序列化/反序列化存储
|
|
115
|
+
*/
|
|
116
|
+
export function SerializeMap(target, propertyKey) {
|
|
117
|
+
const key = String(propertyKey);
|
|
118
|
+
if (!target.constructor.__serializeMapFields) {
|
|
119
|
+
target.constructor.__serializeMapFields = new Set();
|
|
120
|
+
}
|
|
121
|
+
target.constructor.__serializeMapFields.add(key);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 序列化Set装饰器
|
|
125
|
+
* 标记Set字段需要序列化/反序列化存储
|
|
126
|
+
*/
|
|
127
|
+
export function SerializeSet(target, propertyKey) {
|
|
128
|
+
const key = String(propertyKey);
|
|
129
|
+
if (!target.constructor.__serializeSetFields) {
|
|
130
|
+
target.constructor.__serializeSetFields = new Set();
|
|
131
|
+
}
|
|
132
|
+
target.constructor.__serializeSetFields.add(key);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 序列化Array装饰器
|
|
136
|
+
* 标记Array字段需要序列化/反序列化存储
|
|
137
|
+
*/
|
|
138
|
+
export function SerializeArray(target, propertyKey) {
|
|
139
|
+
const key = String(propertyKey);
|
|
140
|
+
if (!target.constructor.__serializeArrayFields) {
|
|
141
|
+
target.constructor.__serializeArrayFields = new Set();
|
|
142
|
+
}
|
|
143
|
+
target.constructor.__serializeArrayFields.add(key);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 深拷贝装饰器
|
|
147
|
+
* 标记字段需要深拷贝处理(适用于嵌套对象)
|
|
148
|
+
*/
|
|
149
|
+
export function DeepCopy(target, propertyKey) {
|
|
150
|
+
const key = String(propertyKey);
|
|
151
|
+
if (!target.constructor.__deepCopyFields) {
|
|
152
|
+
target.constructor.__deepCopyFields = new Set();
|
|
153
|
+
}
|
|
154
|
+
target.constructor.__deepCopyFields.add(key);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* SoA存储器(需要装饰器启用)
|
|
158
|
+
* 使用Structure of Arrays存储模式,在大规模批量操作时提供优异性能
|
|
159
|
+
*/
|
|
160
|
+
export class SoAStorage {
|
|
161
|
+
constructor(componentType) {
|
|
162
|
+
this.fields = new Map();
|
|
163
|
+
this.stringFields = new Map();
|
|
164
|
+
this.serializedFields = new Map();
|
|
165
|
+
this.complexFields = new Map();
|
|
166
|
+
this.entityToIndex = new Map();
|
|
167
|
+
this.indexToEntity = [];
|
|
168
|
+
this.freeIndices = [];
|
|
169
|
+
this._size = 0;
|
|
170
|
+
this._capacity = 1000;
|
|
171
|
+
// 缓存字段类型信息,避免重复创建实例
|
|
172
|
+
this.fieldTypes = new Map();
|
|
173
|
+
// 缓存装饰器元数据
|
|
174
|
+
this.serializeMapFields = new Set();
|
|
175
|
+
this.serializeSetFields = new Set();
|
|
176
|
+
this.serializeArrayFields = new Set();
|
|
177
|
+
this.type = componentType;
|
|
178
|
+
this.initializeFields(componentType);
|
|
179
|
+
}
|
|
180
|
+
initializeFields(componentType) {
|
|
181
|
+
const instance = new componentType();
|
|
182
|
+
const typeWithMeta = componentType;
|
|
183
|
+
const float64Fields = typeWithMeta.__float64Fields || new Set();
|
|
184
|
+
const float32Fields = typeWithMeta.__float32Fields || new Set();
|
|
185
|
+
const int32Fields = typeWithMeta.__int32Fields || new Set();
|
|
186
|
+
const uint32Fields = typeWithMeta.__uint32Fields || new Set();
|
|
187
|
+
const int16Fields = typeWithMeta.__int16Fields || new Set();
|
|
188
|
+
const uint16Fields = typeWithMeta.__uint16Fields || new Set();
|
|
189
|
+
const int8Fields = typeWithMeta.__int8Fields || new Set();
|
|
190
|
+
const uint8Fields = typeWithMeta.__uint8Fields || new Set();
|
|
191
|
+
const uint8ClampedFields = typeWithMeta.__uint8ClampedFields || new Set();
|
|
192
|
+
// 缓存装饰器元数据
|
|
193
|
+
this.serializeMapFields = typeWithMeta.__serializeMapFields || new Set();
|
|
194
|
+
this.serializeSetFields = typeWithMeta.__serializeSetFields || new Set();
|
|
195
|
+
this.serializeArrayFields = typeWithMeta.__serializeArrayFields || new Set();
|
|
196
|
+
// 先收集所有有装饰器的字段,避免重复遍历
|
|
197
|
+
const decoratedFields = new Map(); // fieldName -> arrayType
|
|
198
|
+
// 处理各类型装饰器标记的字段
|
|
199
|
+
for (const key of float64Fields)
|
|
200
|
+
decoratedFields.set(key, 'float64');
|
|
201
|
+
for (const key of float32Fields)
|
|
202
|
+
decoratedFields.set(key, 'float32');
|
|
203
|
+
for (const key of int32Fields)
|
|
204
|
+
decoratedFields.set(key, 'int32');
|
|
205
|
+
for (const key of uint32Fields)
|
|
206
|
+
decoratedFields.set(key, 'uint32');
|
|
207
|
+
for (const key of int16Fields)
|
|
208
|
+
decoratedFields.set(key, 'int16');
|
|
209
|
+
for (const key of uint16Fields)
|
|
210
|
+
decoratedFields.set(key, 'uint16');
|
|
211
|
+
for (const key of int8Fields)
|
|
212
|
+
decoratedFields.set(key, 'int8');
|
|
213
|
+
for (const key of uint8Fields)
|
|
214
|
+
decoratedFields.set(key, 'uint8');
|
|
215
|
+
for (const key of uint8ClampedFields)
|
|
216
|
+
decoratedFields.set(key, 'uint8clamped');
|
|
217
|
+
// 只遍历实例自身的属性(不包括原型链),跳过 id
|
|
218
|
+
const instanceKeys = Object.keys(instance).filter((key) => key !== 'id');
|
|
219
|
+
for (const key of instanceKeys) {
|
|
220
|
+
const value = instance[key];
|
|
221
|
+
const type = typeof value;
|
|
222
|
+
// 跳过函数(通常不会出现在 Object.keys 中,但以防万一)
|
|
223
|
+
if (type === 'function')
|
|
224
|
+
continue;
|
|
225
|
+
// 检查装饰器类型
|
|
226
|
+
const decoratorType = decoratedFields.get(key);
|
|
227
|
+
const effectiveType = decoratorType ? 'number' : type;
|
|
228
|
+
this.fieldTypes.set(key, effectiveType);
|
|
229
|
+
if (decoratorType) {
|
|
230
|
+
// 有装饰器标记的数字字段
|
|
231
|
+
const ArrayConstructor = SoATypeRegistry.getConstructor(decoratorType);
|
|
232
|
+
this.fields.set(key, new ArrayConstructor(this._capacity));
|
|
233
|
+
}
|
|
234
|
+
else if (type === 'number') {
|
|
235
|
+
// 无装饰器的数字字段,默认使用 Float32Array
|
|
236
|
+
this.fields.set(key, new Float32Array(this._capacity));
|
|
237
|
+
}
|
|
238
|
+
else if (type === 'boolean') {
|
|
239
|
+
// 布尔值使用 Uint8Array 存储为 0/1
|
|
240
|
+
this.fields.set(key, new Uint8Array(this._capacity));
|
|
241
|
+
}
|
|
242
|
+
else if (type === 'string') {
|
|
243
|
+
// 字符串专门处理
|
|
244
|
+
this.stringFields.set(key, new Array(this._capacity));
|
|
245
|
+
}
|
|
246
|
+
else if (type === 'object' && value !== null) {
|
|
247
|
+
// 处理集合类型
|
|
248
|
+
if (this.serializeMapFields.has(key) || this.serializeSetFields.has(key) || this.serializeArrayFields.has(key)) {
|
|
249
|
+
// 序列化存储
|
|
250
|
+
this.serializedFields.set(key, new Array(this._capacity));
|
|
251
|
+
}
|
|
252
|
+
// 其他对象类型会在updateComponentAtIndex中作为复杂对象处理
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
addComponent(entityId, component) {
|
|
257
|
+
if (this.entityToIndex.has(entityId)) {
|
|
258
|
+
const index = this.entityToIndex.get(entityId);
|
|
259
|
+
this.updateComponentAtIndex(index, component);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
let index;
|
|
263
|
+
if (this.freeIndices.length > 0) {
|
|
264
|
+
index = this.freeIndices.pop();
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
index = this._size;
|
|
268
|
+
if (index >= this._capacity) {
|
|
269
|
+
this.resize(this._capacity * 2);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
this.entityToIndex.set(entityId, index);
|
|
273
|
+
this.indexToEntity[index] = entityId;
|
|
274
|
+
this.updateComponentAtIndex(index, component);
|
|
275
|
+
this._size++;
|
|
276
|
+
}
|
|
277
|
+
updateComponentAtIndex(index, component) {
|
|
278
|
+
const entityId = this.indexToEntity[index];
|
|
279
|
+
const complexFieldMap = new Map();
|
|
280
|
+
const highPrecisionFields = this.type.__highPrecisionFields || new Set();
|
|
281
|
+
const serializeMapFields = this.type.__serializeMapFields || new Set();
|
|
282
|
+
const serializeSetFields = this.type.__serializeSetFields || new Set();
|
|
283
|
+
const serializeArrayFields = this.type.__serializeArrayFields || new Set();
|
|
284
|
+
const deepCopyFields = this.type.__deepCopyFields || new Set();
|
|
285
|
+
// 处理所有字段
|
|
286
|
+
for (const key in component) {
|
|
287
|
+
if (component.hasOwnProperty(key) && key !== 'id') {
|
|
288
|
+
const value = component[key];
|
|
289
|
+
const type = typeof value;
|
|
290
|
+
if (type === 'number') {
|
|
291
|
+
if (highPrecisionFields.has(key) || !this.fields.has(key)) {
|
|
292
|
+
// 标记为高精度或未在TypedArray中的数值作为复杂对象存储
|
|
293
|
+
complexFieldMap.set(key, value);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
// 存储到TypedArray
|
|
297
|
+
const array = this.fields.get(key);
|
|
298
|
+
array[index] = value;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else if (type === 'boolean' && this.fields.has(key)) {
|
|
302
|
+
// 布尔值存储到TypedArray
|
|
303
|
+
const array = this.fields.get(key);
|
|
304
|
+
array[index] = value ? 1 : 0;
|
|
305
|
+
}
|
|
306
|
+
else if (this.stringFields.has(key)) {
|
|
307
|
+
// 字符串字段专门处理
|
|
308
|
+
const stringArray = this.stringFields.get(key);
|
|
309
|
+
stringArray[index] = String(value);
|
|
310
|
+
}
|
|
311
|
+
else if (this.serializedFields.has(key)) {
|
|
312
|
+
// 序列化字段处理
|
|
313
|
+
const serializedArray = this.serializedFields.get(key);
|
|
314
|
+
serializedArray[index] = SoASerializer.serialize(value, key, {
|
|
315
|
+
isMap: serializeMapFields.has(key),
|
|
316
|
+
isSet: serializeSetFields.has(key),
|
|
317
|
+
isArray: serializeArrayFields.has(key)
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
// 复杂字段单独存储
|
|
322
|
+
if (deepCopyFields.has(key)) {
|
|
323
|
+
// 深拷贝处理
|
|
324
|
+
complexFieldMap.set(key, SoASerializer.deepClone(value));
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
complexFieldMap.set(key, value);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// 存储复杂字段
|
|
333
|
+
if (complexFieldMap.size > 0) {
|
|
334
|
+
this.complexFields.set(entityId, complexFieldMap);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
getComponent(entityId) {
|
|
338
|
+
const index = this.entityToIndex.get(entityId);
|
|
339
|
+
if (index === undefined) {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
// 返回 Proxy,直接操作底层 TypedArray
|
|
343
|
+
return this.createProxyView(entityId, index);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* 创建组件的 Proxy 视图
|
|
347
|
+
* 读写操作直接映射到底层 TypedArray,无数据复制
|
|
348
|
+
*/
|
|
349
|
+
createProxyView(entityId, index) {
|
|
350
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
351
|
+
const self = this;
|
|
352
|
+
// Proxy handler 类型定义
|
|
353
|
+
const handler = {
|
|
354
|
+
get(_, prop) {
|
|
355
|
+
const propStr = String(prop);
|
|
356
|
+
// TypedArray 字段
|
|
357
|
+
const array = self.fields.get(propStr);
|
|
358
|
+
if (array) {
|
|
359
|
+
const fieldType = self.getFieldType(propStr);
|
|
360
|
+
if (fieldType === 'boolean') {
|
|
361
|
+
return array[index] === 1;
|
|
362
|
+
}
|
|
363
|
+
return array[index];
|
|
364
|
+
}
|
|
365
|
+
// 字符串字段
|
|
366
|
+
const stringArray = self.stringFields.get(propStr);
|
|
367
|
+
if (stringArray) {
|
|
368
|
+
return stringArray[index];
|
|
369
|
+
}
|
|
370
|
+
// 序列化字段
|
|
371
|
+
const serializedArray = self.serializedFields.get(propStr);
|
|
372
|
+
if (serializedArray) {
|
|
373
|
+
const serialized = serializedArray[index];
|
|
374
|
+
if (serialized) {
|
|
375
|
+
return SoASerializer.deserialize(serialized, propStr, {
|
|
376
|
+
isMap: self.serializeMapFields.has(propStr),
|
|
377
|
+
isSet: self.serializeSetFields.has(propStr),
|
|
378
|
+
isArray: self.serializeArrayFields.has(propStr)
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
// 复杂字段
|
|
384
|
+
const complexFieldMap = self.complexFields.get(entityId);
|
|
385
|
+
if (complexFieldMap?.has(propStr)) {
|
|
386
|
+
return complexFieldMap.get(propStr);
|
|
387
|
+
}
|
|
388
|
+
return undefined;
|
|
389
|
+
},
|
|
390
|
+
set(_, prop, value) {
|
|
391
|
+
const propStr = String(prop);
|
|
392
|
+
// entityId 是只读的
|
|
393
|
+
if (propStr === 'entityId') {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
// TypedArray 字段
|
|
397
|
+
const array = self.fields.get(propStr);
|
|
398
|
+
if (array) {
|
|
399
|
+
const fieldType = self.getFieldType(propStr);
|
|
400
|
+
if (fieldType === 'boolean') {
|
|
401
|
+
array[index] = value ? 1 : 0;
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
array[index] = value;
|
|
405
|
+
}
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
// 字符串字段
|
|
409
|
+
const stringArray = self.stringFields.get(propStr);
|
|
410
|
+
if (stringArray) {
|
|
411
|
+
stringArray[index] = String(value);
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
// 序列化字段
|
|
415
|
+
if (self.serializedFields.has(propStr)) {
|
|
416
|
+
const serializedArray = self.serializedFields.get(propStr);
|
|
417
|
+
serializedArray[index] = SoASerializer.serialize(value, propStr, {
|
|
418
|
+
isMap: self.serializeMapFields.has(propStr),
|
|
419
|
+
isSet: self.serializeSetFields.has(propStr),
|
|
420
|
+
isArray: self.serializeArrayFields.has(propStr)
|
|
421
|
+
});
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
// 复杂字段
|
|
425
|
+
let complexFieldMap = self.complexFields.get(entityId);
|
|
426
|
+
if (!complexFieldMap) {
|
|
427
|
+
complexFieldMap = new Map();
|
|
428
|
+
self.complexFields.set(entityId, complexFieldMap);
|
|
429
|
+
}
|
|
430
|
+
complexFieldMap.set(propStr, value);
|
|
431
|
+
return true;
|
|
432
|
+
},
|
|
433
|
+
has(_, prop) {
|
|
434
|
+
const propStr = String(prop);
|
|
435
|
+
return self.fields.has(propStr) ||
|
|
436
|
+
self.stringFields.has(propStr) ||
|
|
437
|
+
self.serializedFields.has(propStr) ||
|
|
438
|
+
self.complexFields.get(entityId)?.has(propStr) || false;
|
|
439
|
+
},
|
|
440
|
+
ownKeys() {
|
|
441
|
+
const keys = [];
|
|
442
|
+
for (const key of self.fields.keys())
|
|
443
|
+
keys.push(key);
|
|
444
|
+
for (const key of self.stringFields.keys())
|
|
445
|
+
keys.push(key);
|
|
446
|
+
for (const key of self.serializedFields.keys())
|
|
447
|
+
keys.push(key);
|
|
448
|
+
const complexFieldMap = self.complexFields.get(entityId);
|
|
449
|
+
if (complexFieldMap) {
|
|
450
|
+
for (const key of complexFieldMap.keys())
|
|
451
|
+
keys.push(key);
|
|
452
|
+
}
|
|
453
|
+
return keys;
|
|
454
|
+
},
|
|
455
|
+
getOwnPropertyDescriptor(_, prop) {
|
|
456
|
+
const propStr = String(prop);
|
|
457
|
+
if (self.fields.has(propStr) ||
|
|
458
|
+
self.stringFields.has(propStr) ||
|
|
459
|
+
self.serializedFields.has(propStr) ||
|
|
460
|
+
self.complexFields.get(entityId)?.has(propStr)) {
|
|
461
|
+
return {
|
|
462
|
+
enumerable: true,
|
|
463
|
+
configurable: true,
|
|
464
|
+
// entityId 是只读的
|
|
465
|
+
writable: propStr !== 'entityId'
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
return undefined;
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
return new Proxy({}, handler);
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* 获取组件的快照副本(用于序列化等需要独立副本的场景)
|
|
475
|
+
*/
|
|
476
|
+
getComponentSnapshot(entityId) {
|
|
477
|
+
const index = this.entityToIndex.get(entityId);
|
|
478
|
+
if (index === undefined) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
// 需要 any 因为要动态写入泛型 T 的属性
|
|
482
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
483
|
+
const component = new this.type();
|
|
484
|
+
// 恢复数值字段
|
|
485
|
+
for (const [fieldName, array] of this.fields.entries()) {
|
|
486
|
+
const value = array[index];
|
|
487
|
+
const fieldType = this.getFieldType(fieldName);
|
|
488
|
+
if (fieldType === 'boolean') {
|
|
489
|
+
component[fieldName] = value === 1;
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
component[fieldName] = value;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
// 恢复字符串字段
|
|
496
|
+
for (const [fieldName, stringArray] of this.stringFields.entries()) {
|
|
497
|
+
component[fieldName] = stringArray[index];
|
|
498
|
+
}
|
|
499
|
+
// 恢复序列化字段
|
|
500
|
+
for (const [fieldName, serializedArray] of this.serializedFields.entries()) {
|
|
501
|
+
const serialized = serializedArray[index];
|
|
502
|
+
if (serialized) {
|
|
503
|
+
component[fieldName] = SoASerializer.deserialize(serialized, fieldName, {
|
|
504
|
+
isMap: this.serializeMapFields.has(fieldName),
|
|
505
|
+
isSet: this.serializeSetFields.has(fieldName),
|
|
506
|
+
isArray: this.serializeArrayFields.has(fieldName)
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
// 恢复复杂字段
|
|
511
|
+
const complexFieldMap = this.complexFields.get(entityId);
|
|
512
|
+
if (complexFieldMap) {
|
|
513
|
+
for (const [fieldName, value] of complexFieldMap.entries()) {
|
|
514
|
+
component[fieldName] = value;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return component;
|
|
518
|
+
}
|
|
519
|
+
getFieldType(fieldName) {
|
|
520
|
+
// 使用缓存的字段类型
|
|
521
|
+
return this.fieldTypes.get(fieldName) || 'unknown';
|
|
522
|
+
}
|
|
523
|
+
hasComponent(entityId) {
|
|
524
|
+
return this.entityToIndex.has(entityId);
|
|
525
|
+
}
|
|
526
|
+
removeComponent(entityId) {
|
|
527
|
+
const index = this.entityToIndex.get(entityId);
|
|
528
|
+
if (index === undefined) {
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
// 获取组件副本以便返回
|
|
532
|
+
const component = this.getComponent(entityId);
|
|
533
|
+
// 清理复杂字段
|
|
534
|
+
this.complexFields.delete(entityId);
|
|
535
|
+
this.entityToIndex.delete(entityId);
|
|
536
|
+
this.freeIndices.push(index);
|
|
537
|
+
this._size--;
|
|
538
|
+
return component;
|
|
539
|
+
}
|
|
540
|
+
resize(newCapacity) {
|
|
541
|
+
// 调整数值字段的TypedArray
|
|
542
|
+
for (const [fieldName, oldArray] of this.fields.entries()) {
|
|
543
|
+
const newArray = SoATypeRegistry.createSameType(oldArray, newCapacity);
|
|
544
|
+
newArray.set(oldArray);
|
|
545
|
+
this.fields.set(fieldName, newArray);
|
|
546
|
+
}
|
|
547
|
+
// 调整字符串字段的数组
|
|
548
|
+
for (const [fieldName, oldArray] of this.stringFields.entries()) {
|
|
549
|
+
const newArray = new Array(newCapacity);
|
|
550
|
+
for (let i = 0; i < oldArray.length; i++) {
|
|
551
|
+
newArray[i] = oldArray[i];
|
|
552
|
+
}
|
|
553
|
+
this.stringFields.set(fieldName, newArray);
|
|
554
|
+
}
|
|
555
|
+
// 调整序列化字段的数组
|
|
556
|
+
for (const [fieldName, oldArray] of this.serializedFields.entries()) {
|
|
557
|
+
const newArray = new Array(newCapacity);
|
|
558
|
+
for (let i = 0; i < oldArray.length; i++) {
|
|
559
|
+
newArray[i] = oldArray[i];
|
|
560
|
+
}
|
|
561
|
+
this.serializedFields.set(fieldName, newArray);
|
|
562
|
+
}
|
|
563
|
+
this._capacity = newCapacity;
|
|
564
|
+
}
|
|
565
|
+
getActiveIndices() {
|
|
566
|
+
return Array.from(this.entityToIndex.values());
|
|
567
|
+
}
|
|
568
|
+
getFieldArray(fieldName) {
|
|
569
|
+
return this.fields.get(fieldName) || null;
|
|
570
|
+
}
|
|
571
|
+
getTypedFieldArray(fieldName) {
|
|
572
|
+
return this.fields.get(String(fieldName)) || null;
|
|
573
|
+
}
|
|
574
|
+
getEntityIndex(entityId) {
|
|
575
|
+
return this.entityToIndex.get(entityId);
|
|
576
|
+
}
|
|
577
|
+
getEntityIdByIndex(index) {
|
|
578
|
+
return this.indexToEntity[index];
|
|
579
|
+
}
|
|
580
|
+
size() {
|
|
581
|
+
return this._size;
|
|
582
|
+
}
|
|
583
|
+
clear() {
|
|
584
|
+
this.entityToIndex.clear();
|
|
585
|
+
this.indexToEntity = [];
|
|
586
|
+
this.freeIndices = [];
|
|
587
|
+
this.complexFields.clear();
|
|
588
|
+
this._size = 0;
|
|
589
|
+
// 重置数值字段数组
|
|
590
|
+
for (const array of this.fields.values()) {
|
|
591
|
+
array.fill(0);
|
|
592
|
+
}
|
|
593
|
+
// 重置字符串字段数组
|
|
594
|
+
for (const stringArray of this.stringFields.values()) {
|
|
595
|
+
for (let i = 0; i < stringArray.length; i++) {
|
|
596
|
+
stringArray[i] = undefined;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
// 重置序列化字段数组
|
|
600
|
+
for (const serializedArray of this.serializedFields.values()) {
|
|
601
|
+
for (let i = 0; i < serializedArray.length; i++) {
|
|
602
|
+
serializedArray[i] = undefined;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
compact() {
|
|
607
|
+
if (this.freeIndices.length === 0) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
const activeEntries = Array.from(this.entityToIndex.entries())
|
|
611
|
+
.sort((a, b) => a[1] - b[1]);
|
|
612
|
+
// 重新映射索引
|
|
613
|
+
const newEntityToIndex = new Map();
|
|
614
|
+
const newIndexToEntity = [];
|
|
615
|
+
for (let newIndex = 0; newIndex < activeEntries.length; newIndex++) {
|
|
616
|
+
const entry = activeEntries[newIndex];
|
|
617
|
+
if (!entry)
|
|
618
|
+
continue;
|
|
619
|
+
const [entityId, oldIndex] = entry;
|
|
620
|
+
newEntityToIndex.set(entityId, newIndex);
|
|
621
|
+
newIndexToEntity[newIndex] = entityId;
|
|
622
|
+
// 移动字段数据
|
|
623
|
+
if (newIndex !== oldIndex) {
|
|
624
|
+
// 移动数值字段
|
|
625
|
+
for (const [, array] of this.fields.entries()) {
|
|
626
|
+
const value = array[oldIndex];
|
|
627
|
+
if (value !== undefined) {
|
|
628
|
+
array[newIndex] = value;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
// 移动字符串字段
|
|
632
|
+
for (const [, stringArray] of this.stringFields.entries()) {
|
|
633
|
+
const value = stringArray[oldIndex];
|
|
634
|
+
if (value !== undefined) {
|
|
635
|
+
stringArray[newIndex] = value;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
// 移动序列化字段
|
|
639
|
+
for (const [, serializedArray] of this.serializedFields.entries()) {
|
|
640
|
+
const value = serializedArray[oldIndex];
|
|
641
|
+
if (value !== undefined) {
|
|
642
|
+
serializedArray[newIndex] = value;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
this.entityToIndex = newEntityToIndex;
|
|
648
|
+
this.indexToEntity = newIndexToEntity;
|
|
649
|
+
this.freeIndices = [];
|
|
650
|
+
this._size = activeEntries.length;
|
|
651
|
+
}
|
|
652
|
+
getStats() {
|
|
653
|
+
let totalMemory = 0;
|
|
654
|
+
const fieldStats = new Map();
|
|
655
|
+
for (const [fieldName, array] of this.fields.entries()) {
|
|
656
|
+
const typeName = SoATypeRegistry.getTypeName(array);
|
|
657
|
+
const bytesPerElement = SoATypeRegistry.getBytesPerElement(typeName);
|
|
658
|
+
const memory = array.length * bytesPerElement;
|
|
659
|
+
totalMemory += memory;
|
|
660
|
+
fieldStats.set(fieldName, {
|
|
661
|
+
size: this._size,
|
|
662
|
+
capacity: array.length,
|
|
663
|
+
type: typeName,
|
|
664
|
+
memory: memory
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
return {
|
|
668
|
+
size: this._size,
|
|
669
|
+
capacity: this._capacity,
|
|
670
|
+
usedSlots: this._size, // 兼容原测试
|
|
671
|
+
fragmentation: this.freeIndices.length / this._capacity,
|
|
672
|
+
memoryUsage: totalMemory,
|
|
673
|
+
fieldStats: fieldStats
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* 执行向量化批量操作
|
|
678
|
+
* @param operation 操作函数,接收字段数组和活跃索引
|
|
679
|
+
*/
|
|
680
|
+
performVectorizedOperation(operation) {
|
|
681
|
+
const activeIndices = this.getActiveIndices();
|
|
682
|
+
operation(this.fields, activeIndices);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
//# sourceMappingURL=SoAStorage.js.map
|