@esengine/ecs-framework 2.1.25 → 2.1.26
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/index.cjs +2 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +353 -3
- package/{index.js → index.mjs} +2 -2
- package/index.mjs.map +1 -0
- package/package.json +9 -9
- package/index.js.map +0 -1
- package/index.umd.js +0 -2
- package/index.umd.js.map +0 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @esengine/ecs-framework v2.1.
|
|
2
|
+
* @esengine/ecs-framework v2.1.26
|
|
3
3
|
* TypeScript definitions
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -5748,5 +5748,355 @@ declare class Time {
|
|
|
5748
5748
|
static checkEvery(interval: number, lastTime: number): boolean;
|
|
5749
5749
|
}
|
|
5750
5750
|
|
|
5751
|
-
|
|
5752
|
-
|
|
5751
|
+
/**
|
|
5752
|
+
* 可序列化接口
|
|
5753
|
+
*
|
|
5754
|
+
* 实现此接口的类可以被快照系统序列化和反序列化
|
|
5755
|
+
*/
|
|
5756
|
+
interface ISnapshotable {
|
|
5757
|
+
/**
|
|
5758
|
+
* 序列化对象到可传输的数据格式
|
|
5759
|
+
*
|
|
5760
|
+
* @returns 序列化后的数据
|
|
5761
|
+
*/
|
|
5762
|
+
serialize(): any;
|
|
5763
|
+
/**
|
|
5764
|
+
* 从序列化数据恢复对象状态
|
|
5765
|
+
*
|
|
5766
|
+
* @param data - 序列化数据
|
|
5767
|
+
*/
|
|
5768
|
+
deserialize(data: any): void;
|
|
5769
|
+
}
|
|
5770
|
+
/**
|
|
5771
|
+
* 快照配置接口
|
|
5772
|
+
*/
|
|
5773
|
+
interface SnapshotConfig {
|
|
5774
|
+
/** 是否包含在快照中 */
|
|
5775
|
+
includeInSnapshot: boolean;
|
|
5776
|
+
/** 压缩级别 (0-9) */
|
|
5777
|
+
compressionLevel: number;
|
|
5778
|
+
/** 同步优先级 (数字越大优先级越高) */
|
|
5779
|
+
syncPriority: number;
|
|
5780
|
+
/** 是否启用增量快照 */
|
|
5781
|
+
enableIncremental: boolean;
|
|
5782
|
+
}
|
|
5783
|
+
/**
|
|
5784
|
+
* 组件快照数据
|
|
5785
|
+
*/
|
|
5786
|
+
interface ComponentSnapshot {
|
|
5787
|
+
/** 组件类型名称 */
|
|
5788
|
+
type: string;
|
|
5789
|
+
/** 组件ID */
|
|
5790
|
+
id: number;
|
|
5791
|
+
/** 序列化数据 */
|
|
5792
|
+
data: any;
|
|
5793
|
+
/** 是否启用 */
|
|
5794
|
+
enabled: boolean;
|
|
5795
|
+
/** 快照配置 */
|
|
5796
|
+
config?: SnapshotConfig;
|
|
5797
|
+
}
|
|
5798
|
+
/**
|
|
5799
|
+
* 实体快照数据
|
|
5800
|
+
*/
|
|
5801
|
+
interface EntitySnapshot {
|
|
5802
|
+
/** 实体ID */
|
|
5803
|
+
id: number;
|
|
5804
|
+
/** 实体名称 */
|
|
5805
|
+
name: string;
|
|
5806
|
+
/** 是否启用 */
|
|
5807
|
+
enabled: boolean;
|
|
5808
|
+
/** 是否激活 */
|
|
5809
|
+
active: boolean;
|
|
5810
|
+
/** 标签 */
|
|
5811
|
+
tag: number;
|
|
5812
|
+
/** 更新顺序 */
|
|
5813
|
+
updateOrder: number;
|
|
5814
|
+
/** 组件快照列表 */
|
|
5815
|
+
components: ComponentSnapshot[];
|
|
5816
|
+
/** 子实体ID列表 */
|
|
5817
|
+
children: number[];
|
|
5818
|
+
/** 父实体ID */
|
|
5819
|
+
parent?: number;
|
|
5820
|
+
/** 快照时间戳 */
|
|
5821
|
+
timestamp: number;
|
|
5822
|
+
}
|
|
5823
|
+
/**
|
|
5824
|
+
* 场景快照数据
|
|
5825
|
+
*/
|
|
5826
|
+
interface SceneSnapshot {
|
|
5827
|
+
/** 实体快照列表 */
|
|
5828
|
+
entities: EntitySnapshot[];
|
|
5829
|
+
/** 快照时间戳 */
|
|
5830
|
+
timestamp: number;
|
|
5831
|
+
/** 框架版本 */
|
|
5832
|
+
version: string;
|
|
5833
|
+
/** 快照类型 */
|
|
5834
|
+
type: 'full' | 'incremental';
|
|
5835
|
+
/** 基础快照ID(增量快照使用) */
|
|
5836
|
+
baseSnapshotId?: string;
|
|
5837
|
+
}
|
|
5838
|
+
|
|
5839
|
+
/**
|
|
5840
|
+
* 快照管理器
|
|
5841
|
+
*
|
|
5842
|
+
* 负责创建和管理ECS系统的快照,支持完整快照和增量快照
|
|
5843
|
+
*/
|
|
5844
|
+
declare class SnapshotManager {
|
|
5845
|
+
/** 默认快照配置 */
|
|
5846
|
+
private static readonly DEFAULT_CONFIG;
|
|
5847
|
+
/** 框架版本 */
|
|
5848
|
+
private readonly version;
|
|
5849
|
+
/** 最后快照时间戳 */
|
|
5850
|
+
private lastSnapshotTime;
|
|
5851
|
+
/** 快照缓存 */
|
|
5852
|
+
private snapshotCache;
|
|
5853
|
+
/** 最大缓存数量 */
|
|
5854
|
+
private maxCacheSize;
|
|
5855
|
+
/**
|
|
5856
|
+
* 创建场景快照
|
|
5857
|
+
*
|
|
5858
|
+
* @param entities - 实体列表
|
|
5859
|
+
* @param type - 快照类型
|
|
5860
|
+
* @returns 场景快照
|
|
5861
|
+
*/
|
|
5862
|
+
createSceneSnapshot(entities: Entity[], type?: 'full' | 'incremental'): SceneSnapshot;
|
|
5863
|
+
/**
|
|
5864
|
+
* 从快照恢复场景
|
|
5865
|
+
*
|
|
5866
|
+
* @param snapshot - 场景快照
|
|
5867
|
+
* @param targetEntities - 目标实体列表(用于增量恢复)
|
|
5868
|
+
* @param createMissingEntities - 是否创建缺失的实体
|
|
5869
|
+
*/
|
|
5870
|
+
restoreFromSnapshot(snapshot: SceneSnapshot, targetEntities?: Entity[], createMissingEntities?: boolean): Entity[];
|
|
5871
|
+
/**
|
|
5872
|
+
* 从快照恢复实体列表
|
|
5873
|
+
*
|
|
5874
|
+
* @param snapshot - 场景快照
|
|
5875
|
+
* @param targetEntities - 目标实体列表
|
|
5876
|
+
* @param createMissingEntities - 是否创建缺失的实体
|
|
5877
|
+
*/
|
|
5878
|
+
restoreEntitiesFromSnapshot(snapshot: SceneSnapshot, targetEntities: Entity[], createMissingEntities?: boolean): Entity[];
|
|
5879
|
+
/**
|
|
5880
|
+
* 从快照创建实体
|
|
5881
|
+
*/
|
|
5882
|
+
private createEntityFromSnapshot;
|
|
5883
|
+
/**
|
|
5884
|
+
* 从快照创建组件
|
|
5885
|
+
*/
|
|
5886
|
+
private createComponentFromSnapshot;
|
|
5887
|
+
/**
|
|
5888
|
+
* 获取组件类型
|
|
5889
|
+
*/
|
|
5890
|
+
private getComponentType;
|
|
5891
|
+
/**
|
|
5892
|
+
* 创建快速快照(跳过变化检测)
|
|
5893
|
+
*
|
|
5894
|
+
* @param entities - 实体列表
|
|
5895
|
+
* @returns 场景快照
|
|
5896
|
+
*/
|
|
5897
|
+
createQuickSnapshot(entities: Entity[]): SceneSnapshot;
|
|
5898
|
+
/**
|
|
5899
|
+
* 创建增量快照
|
|
5900
|
+
*
|
|
5901
|
+
* @param entities - 实体列表
|
|
5902
|
+
* @param baseSnapshot - 基础快照
|
|
5903
|
+
* @param enableChangeDetection - 是否启用变化检测
|
|
5904
|
+
* @returns 增量快照
|
|
5905
|
+
*/
|
|
5906
|
+
createIncrementalSnapshot(entities: Entity[], baseSnapshot: SceneSnapshot, enableChangeDetection?: boolean): SceneSnapshot;
|
|
5907
|
+
/**
|
|
5908
|
+
* 缓存快照
|
|
5909
|
+
*
|
|
5910
|
+
* @param id - 快照ID
|
|
5911
|
+
* @param snapshot - 快照数据
|
|
5912
|
+
*/
|
|
5913
|
+
cacheSnapshot(id: string, snapshot: SceneSnapshot): void;
|
|
5914
|
+
/**
|
|
5915
|
+
* 获取缓存的快照
|
|
5916
|
+
*
|
|
5917
|
+
* @param id - 快照ID
|
|
5918
|
+
* @returns 快照数据或undefined
|
|
5919
|
+
*/
|
|
5920
|
+
getCachedSnapshot(id: string): SceneSnapshot | undefined;
|
|
5921
|
+
/**
|
|
5922
|
+
* 清空快照缓存
|
|
5923
|
+
*/
|
|
5924
|
+
clearCache(): void;
|
|
5925
|
+
/**
|
|
5926
|
+
* 清空所有缓存
|
|
5927
|
+
*/
|
|
5928
|
+
clearAllCaches(): void;
|
|
5929
|
+
/**
|
|
5930
|
+
* 获取缓存统计信息
|
|
5931
|
+
*/
|
|
5932
|
+
getCacheStats(): {
|
|
5933
|
+
snapshotCacheSize: number;
|
|
5934
|
+
};
|
|
5935
|
+
/**
|
|
5936
|
+
* 创建实体快照
|
|
5937
|
+
*/
|
|
5938
|
+
private createEntitySnapshot;
|
|
5939
|
+
/**
|
|
5940
|
+
* 创建组件快照
|
|
5941
|
+
*/
|
|
5942
|
+
private createComponentSnapshot;
|
|
5943
|
+
/**
|
|
5944
|
+
* 默认组件序列化
|
|
5945
|
+
*/
|
|
5946
|
+
private defaultSerializeComponent;
|
|
5947
|
+
/**
|
|
5948
|
+
* 检查值是否可序列化
|
|
5949
|
+
*/
|
|
5950
|
+
private isSerializableValue;
|
|
5951
|
+
/**
|
|
5952
|
+
* 检查组件是否支持快照
|
|
5953
|
+
*/
|
|
5954
|
+
private isComponentSnapshotable;
|
|
5955
|
+
/**
|
|
5956
|
+
* 获取组件快照配置
|
|
5957
|
+
*/
|
|
5958
|
+
private getComponentSnapshotConfig;
|
|
5959
|
+
/**
|
|
5960
|
+
* 检查组件是否有序列化方法
|
|
5961
|
+
*/
|
|
5962
|
+
private hasSerializeMethod;
|
|
5963
|
+
/**
|
|
5964
|
+
* 恢复完整快照
|
|
5965
|
+
*/
|
|
5966
|
+
private restoreFullSnapshot;
|
|
5967
|
+
/**
|
|
5968
|
+
* 恢复增量快照
|
|
5969
|
+
*/
|
|
5970
|
+
private restoreIncrementalSnapshot;
|
|
5971
|
+
/**
|
|
5972
|
+
* 从快照恢复实体
|
|
5973
|
+
*/
|
|
5974
|
+
private restoreEntityFromSnapshot;
|
|
5975
|
+
/**
|
|
5976
|
+
* 从快照恢复组件
|
|
5977
|
+
*/
|
|
5978
|
+
private restoreComponentFromSnapshot;
|
|
5979
|
+
/**
|
|
5980
|
+
* 默认组件反序列化
|
|
5981
|
+
*/
|
|
5982
|
+
private defaultDeserializeComponent;
|
|
5983
|
+
/**
|
|
5984
|
+
* 检查实体结构是否发生变化(组件数量、类型等)
|
|
5985
|
+
*/
|
|
5986
|
+
private hasEntityStructureChanged;
|
|
5987
|
+
/**
|
|
5988
|
+
* 获取发生变化的组件列表
|
|
5989
|
+
*/
|
|
5990
|
+
private getChangedComponents;
|
|
5991
|
+
/**
|
|
5992
|
+
* 检查组件数据是否发生变化
|
|
5993
|
+
*/
|
|
5994
|
+
private hasComponentDataChanged;
|
|
5995
|
+
/**
|
|
5996
|
+
* 检查组件是否有变化检测方法
|
|
5997
|
+
*/
|
|
5998
|
+
private hasChangeDetectionMethod;
|
|
5999
|
+
/**
|
|
6000
|
+
* 创建增量实体快照(只包含变化的组件)
|
|
6001
|
+
*/
|
|
6002
|
+
private createIncrementalEntitySnapshot;
|
|
6003
|
+
/**
|
|
6004
|
+
* 生成快照ID
|
|
6005
|
+
*/
|
|
6006
|
+
private generateSnapshotId;
|
|
6007
|
+
}
|
|
6008
|
+
|
|
6009
|
+
/**
|
|
6010
|
+
* 快照扩展接口
|
|
6011
|
+
*
|
|
6012
|
+
* 为Component基类提供快照功能的扩展接口
|
|
6013
|
+
*/
|
|
6014
|
+
interface ISnapshotExtension {
|
|
6015
|
+
/** 快照配置 */
|
|
6016
|
+
snapshotConfig?: SnapshotConfig;
|
|
6017
|
+
/** 序列化方法 */
|
|
6018
|
+
serialize?(): any;
|
|
6019
|
+
/** 反序列化方法 */
|
|
6020
|
+
deserialize?(data: any): void;
|
|
6021
|
+
/** 变化检测方法 */
|
|
6022
|
+
hasChanged?(baseData: any): boolean;
|
|
6023
|
+
}
|
|
6024
|
+
/**
|
|
6025
|
+
* 快照装饰器
|
|
6026
|
+
*
|
|
6027
|
+
* 用于标记组件属性为可序列化
|
|
6028
|
+
*/
|
|
6029
|
+
declare function Serializable(config?: Partial<SnapshotConfig>): (target: any, propertyKey: string) => void;
|
|
6030
|
+
/**
|
|
6031
|
+
* 快照配置装饰器
|
|
6032
|
+
*
|
|
6033
|
+
* 用于配置组件的快照行为
|
|
6034
|
+
*/
|
|
6035
|
+
declare function SnapshotConfigDecorator(config: SnapshotConfig): (target: any) => void;
|
|
6036
|
+
/**
|
|
6037
|
+
* 快照扩展工具类
|
|
6038
|
+
*/
|
|
6039
|
+
declare class SnapshotExtension {
|
|
6040
|
+
/**
|
|
6041
|
+
* 为组件添加快照支持
|
|
6042
|
+
*
|
|
6043
|
+
* @param component - 目标组件
|
|
6044
|
+
* @param config - 快照配置
|
|
6045
|
+
*/
|
|
6046
|
+
static enableSnapshot(component: Component, config?: Partial<SnapshotConfig>): void;
|
|
6047
|
+
/**
|
|
6048
|
+
* 禁用组件的快照功能
|
|
6049
|
+
*
|
|
6050
|
+
* @param component - 目标组件
|
|
6051
|
+
*/
|
|
6052
|
+
static disableSnapshot(component: Component): void;
|
|
6053
|
+
/**
|
|
6054
|
+
* 检查组件是否支持快照
|
|
6055
|
+
*
|
|
6056
|
+
* @param component - 目标组件
|
|
6057
|
+
* @returns 是否支持快照
|
|
6058
|
+
*/
|
|
6059
|
+
static isSnapshotable(component: Component): boolean;
|
|
6060
|
+
/**
|
|
6061
|
+
* 获取组件的可序列化属性
|
|
6062
|
+
*
|
|
6063
|
+
* @param component - 目标组件
|
|
6064
|
+
* @returns 可序列化属性列表
|
|
6065
|
+
*/
|
|
6066
|
+
static getSerializableProperties(component: Component): string[];
|
|
6067
|
+
/**
|
|
6068
|
+
* 创建组件的默认序列化方法
|
|
6069
|
+
*
|
|
6070
|
+
* @param component - 目标组件
|
|
6071
|
+
* @returns 序列化数据
|
|
6072
|
+
*/
|
|
6073
|
+
static createDefaultSerializer(component: Component): () => any;
|
|
6074
|
+
/**
|
|
6075
|
+
* 创建组件的默认反序列化方法
|
|
6076
|
+
*
|
|
6077
|
+
* @param component - 目标组件
|
|
6078
|
+
* @returns 反序列化函数
|
|
6079
|
+
*/
|
|
6080
|
+
static createDefaultDeserializer(component: Component): (data: any) => void;
|
|
6081
|
+
/**
|
|
6082
|
+
* 创建简单的变化检测方法
|
|
6083
|
+
*
|
|
6084
|
+
* @param component - 目标组件
|
|
6085
|
+
* @returns 变化检测函数
|
|
6086
|
+
*/
|
|
6087
|
+
static createSimpleChangeDetector(component: Component): (baseData: any) => boolean;
|
|
6088
|
+
/**
|
|
6089
|
+
* 创建深度变化检测方法
|
|
6090
|
+
*
|
|
6091
|
+
* @param component - 目标组件
|
|
6092
|
+
* @returns 变化检测函数
|
|
6093
|
+
*/
|
|
6094
|
+
static createDeepChangeDetector(component: Component): (baseData: any) => boolean;
|
|
6095
|
+
/**
|
|
6096
|
+
* 深度比较两个值
|
|
6097
|
+
*/
|
|
6098
|
+
private static deepCompare;
|
|
6099
|
+
}
|
|
6100
|
+
|
|
6101
|
+
export { ArchetypeSystem, AsyncEventHandler$1 as AsyncEventHandler, BitMaskOptimizer, BitmapComponentIndex, Bits, Component, ComponentDataCollector, ComponentIndexManager, ComponentPool, ComponentPoolManager, ComponentStorage, ComponentTypeManager, Core, DebugManager, DirtyFlag, DirtyTrackingSystem, ECSEventType, ECSFluentAPI, EVENT_TYPES, Emitter, Entity, EntityDataCollector, EntityList, EntityManager, EntityProcessorList, EntityQueryBuilder, EntitySystem, EventBus, EventHandler$1 as EventHandler, EventPriority, EventTypeValidator, FuncPack, GlobalEventBus, GlobalManager, HashComponentIndex, IdentifierPool, IndexType, IndexUpdateBatcher, IntervalSystem, Matcher, NumberExtension, PassiveSystem, PerformanceDataCollector, PerformanceMonitor, PerformanceWarningType, Pool, PoolManager, ProcessingSystem, QuerySystem, Scene, SceneDataCollector, Serializable, SnapshotConfigDecorator, SnapshotExtension, SnapshotManager, SystemDataCollector, TieredObjectPool, Time, Timer, TimerManager, TypeSafeEventSystem, TypeUtils, WebSocketManager, createECSAPI };
|
|
6102
|
+
export type { Archetype, ArchetypeQueryResult, ComponentSnapshot, ComponentType$1 as ComponentType, DirtyData, DirtyListener, EntitySnapshot, EventListenerConfig, EventStats, IComponent, IComponentDebugData, IComponentEventData, ICoreConfig, IECSDebugConfig, IECSDebugData, IEntityDebugData, IEntityEventData, IEventBus, IEventData, IEventListenerConfig, IEventStats, IPerformanceDebugData, IPerformanceEventData, IPoolable, ISceneDebugData, ISceneEventData, ISnapshotExtension, ISnapshotable, ISystemBase, ISystemDebugData, ISystemEventData, ITimer, PerformanceData, PerformanceStats, PerformanceThresholds, PerformanceWarning, PoolStats, SceneSnapshot, SnapshotConfig };
|