connected-spaces-platform.web 5.17.0 → 5.17.2

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.
@@ -342,6 +342,14 @@ function csp_common_VariantTypeFactory(
342
342
  }
343
343
  ProxyClassFactories["csp_common_VariantType"] = csp_common_VariantTypeFactory;
344
344
 
345
+ function csp_common_RealtimeEngineTypeFactory(
346
+ nativePointer: NativePointer,
347
+ ): Common.RealtimeEngineType {
348
+ return nativePointer.pointer as Common.RealtimeEngineType;
349
+ }
350
+ ProxyClassFactories["csp_common_RealtimeEngineType"] =
351
+ csp_common_RealtimeEngineTypeFactory;
352
+
345
353
  function csp_multiplayer_ComponentTypeFactory(
346
354
  nativePointer: NativePointer,
347
355
  ): Multiplayer.ComponentType {
@@ -1035,6 +1043,14 @@ function csp_common_Vector4Factory(
1035
1043
  }
1036
1044
  ProxyClassFactories["csp_common_Vector4"] = csp_common_Vector4Factory;
1037
1045
 
1046
+ function csp_common_IRealtimeEngineFactory(
1047
+ nativePointer: NativePointer,
1048
+ ): NativeClassWrapper {
1049
+ return new Common.IRealtimeEngine(nativePointer);
1050
+ }
1051
+ ProxyClassFactories["csp_common_IRealtimeEngine"] =
1052
+ csp_common_IRealtimeEngineFactory;
1053
+
1038
1054
  function csp_multiplayer_ComponentBaseFactory(
1039
1055
  nativePointer: NativePointer,
1040
1056
  ): NativeClassWrapper {
@@ -3102,6 +3118,16 @@ export namespace Common {
3102
3118
  }
3103
3119
  }
3104
3120
 
3121
+ export namespace Common {
3122
+ /**
3123
+ * @description Enum of concrete types of RealtimeEngines.
3124
+ */
3125
+ export enum RealtimeEngineType {
3126
+ OnlineMultiUser = 0,
3127
+ OnlineSingleUser,
3128
+ }
3129
+ }
3130
+
3105
3131
  export namespace Multiplayer {
3106
3132
  /**
3107
3133
  * @description Represents the type of component.
@@ -21475,6 +21501,505 @@ export namespace Common {
21475
21501
  }
21476
21502
  }
21477
21503
 
21504
+ export namespace Common {
21505
+ export class IRealtimeEngine
21506
+ extends NativeClassWrapper
21507
+ implements INativeResource
21508
+ {
21509
+ /** @internal */
21510
+ constructor(pointer: NativePointer) {
21511
+ super(pointer);
21512
+ }
21513
+
21514
+ /**
21515
+ * @description Virtual destructor.
21516
+ */
21517
+ delete(): void {
21518
+ if (this.ownsPointer && !this.disposed) {
21519
+ Module.ccall(
21520
+ "csp_common_IRealtimeEngine_Dtor",
21521
+ "void",
21522
+ ["number"],
21523
+ [this.pointer],
21524
+ );
21525
+
21526
+ this.disposed = true;
21527
+ }
21528
+ }
21529
+
21530
+ /**
21531
+ * @description Returns the concrete type of the instantiation of the abstract IRealtimeEngine.
21532
+ */
21533
+
21534
+ getRealtimeEngineType(): Common.RealtimeEngineType {
21535
+ let _result = Module.ccall(
21536
+ "csp_common_IRealtimeEngine_GetRealtimeEngineTypeC_RealtimeEngineType",
21537
+ "number",
21538
+ ["number"],
21539
+ [this.pointer],
21540
+ );
21541
+
21542
+ return _result;
21543
+ }
21544
+
21545
+ /**
21546
+ * @description Create and add a SpaceEntity with type Avatar, and relevant components and default states as specified.
21547
+ * @param name - The entity name of the newly created avatar entity.
21548
+ * @param spaceTransform - The initial transform to set the SpaceEntity to.
21549
+ * @param state - The initial Avatar State to set.
21550
+ * @param avatarId - The ID to be set on the AvatarSpaceComponent
21551
+ * @param avatarPlayMode - The Initial AvatarPlayMode to set.
21552
+ * @param callback - Csp::multiplayer::entitycreatedcallback a callback that executes when the creation is complete,
21553
+ * which will provide a non-owning pointer to the new SpaceEntity so that it can be used on the local client.
21554
+ */
21555
+
21556
+ async createAvatar(
21557
+ name: string,
21558
+ spaceTransform: Multiplayer.SpaceTransform,
21559
+ state: Multiplayer.AvatarState,
21560
+ avatarId: string,
21561
+ avatarPlayMode: Multiplayer.AvatarPlayMode,
21562
+ ): Promise<Multiplayer.SpaceEntity> {
21563
+ var _resolve;
21564
+
21565
+ var _promise = new Promise<Multiplayer.SpaceEntity>((_r) => {
21566
+ _resolve = _r;
21567
+ });
21568
+
21569
+ var _callbackPtr: number;
21570
+ var _callback = (_stateObject__: number, arg1) => {
21571
+ var _arg1Ptr = getNativePointer(arg1);
21572
+ var _arg1Instance = new Multiplayer.SpaceEntity(_arg1Ptr);
21573
+
21574
+ _resolve(_arg1Instance);
21575
+
21576
+ Module.removeFunction(_callbackPtr);
21577
+ };
21578
+
21579
+ _callbackPtr = Module.addFunction(_callback, "vii");
21580
+
21581
+ Module.ccall(
21582
+ "csp_common_IRealtimeEngine_CreateAvatar_void_StringRC_SpaceTransformRC_AvatarStateRC_StringRC_AvatarPlayModeRC_EntityCreatedCallback",
21583
+ "void",
21584
+ [
21585
+ "number",
21586
+ "string",
21587
+ "number",
21588
+ "number",
21589
+ "string",
21590
+ "number",
21591
+ "number",
21592
+ "number",
21593
+ ],
21594
+ [
21595
+ this.pointer,
21596
+ name,
21597
+ spaceTransform.pointer,
21598
+ state,
21599
+ avatarId,
21600
+ avatarPlayMode,
21601
+ _callbackPtr,
21602
+ 0,
21603
+ ],
21604
+ );
21605
+
21606
+ return _promise;
21607
+ }
21608
+
21609
+ /**
21610
+ * @description Create and add a SpaceEntity, with relevant default values.
21611
+ * @param name - The name of the newly created SpaceEntity.
21612
+ * @param spaceTransform - The initial transform to set the SpaceEntity to.
21613
+ * @param callback - A callback that executes when the creation is complete,
21614
+ * which will provide a non-owning pointer to the new SpaceEntity so that it can be used on the local client.
21615
+ */
21616
+
21617
+ async createEntity(
21618
+ name: string,
21619
+ spaceTransform: Multiplayer.SpaceTransform,
21620
+ ): Promise<Multiplayer.SpaceEntity> {
21621
+ var _resolve;
21622
+
21623
+ var _promise = new Promise<Multiplayer.SpaceEntity>((_r) => {
21624
+ _resolve = _r;
21625
+ });
21626
+
21627
+ var _callbackPtr: number;
21628
+ var _callback = (_stateObject__: number, arg1) => {
21629
+ var _arg1Ptr = getNativePointer(arg1);
21630
+ var _arg1Instance = new Multiplayer.SpaceEntity(_arg1Ptr);
21631
+
21632
+ _resolve(_arg1Instance);
21633
+
21634
+ Module.removeFunction(_callbackPtr);
21635
+ };
21636
+
21637
+ _callbackPtr = Module.addFunction(_callback, "vii");
21638
+
21639
+ Module.ccall(
21640
+ "csp_common_IRealtimeEngine_CreateEntity_void_StringRC_SpaceTransformRC_EntityCreatedCallback",
21641
+ "void",
21642
+ ["number", "string", "number", "number", "number"],
21643
+ [this.pointer, name, spaceTransform.pointer, _callbackPtr, 0],
21644
+ );
21645
+
21646
+ return _promise;
21647
+ }
21648
+
21649
+ /**
21650
+ * @description Destroy the specified entity.
21651
+ * @param entity - A non-owning pointer to the entity to be destroyed.
21652
+ * @param callback - A callback that executes when the entity destruction is complete.
21653
+ */
21654
+
21655
+ async destroyEntity(entity: Multiplayer.SpaceEntity): Promise<boolean> {
21656
+ var _resolve;
21657
+
21658
+ var _promise = new Promise<boolean>((_r) => {
21659
+ _resolve = _r;
21660
+ });
21661
+
21662
+ var _callbackPtr: number;
21663
+ var _callback = (_stateObject__: number, arg1) => {
21664
+ _resolve(!!arg1);
21665
+
21666
+ Module.removeFunction(_callbackPtr);
21667
+ };
21668
+
21669
+ _callbackPtr = Module.addFunction(_callback, "vii");
21670
+
21671
+ Module.ccall(
21672
+ "csp_common_IRealtimeEngine_DestroyEntity_void_SpaceEntityP_CallbackHandler",
21673
+ "void",
21674
+ ["number", "number", "number", "number"],
21675
+ [this.pointer, entity.pointer, _callbackPtr, 0],
21676
+ );
21677
+
21678
+ return _promise;
21679
+ }
21680
+
21681
+ /**
21682
+ * @description Sets a callback to be executed when an entity is fully created.
21683
+ * /// Only one EntityCreatedCallback may be registered, calling this function again will override whatever was previously set.
21684
+ * /// @param Callback csp::multiplayer::EntityCreatedCallback : the callback to execute.
21685
+ */
21686
+ setEntityCreatedCallback(
21687
+ callback: (arg1: Multiplayer.SpaceEntity) => void,
21688
+ ) {
21689
+ var _callback = (_stateObject__: number, arg1) => {
21690
+ var _arg1 = new Multiplayer.SpaceEntity(getNativePointer(arg1));
21691
+
21692
+ callback(_arg1);
21693
+ };
21694
+
21695
+ var _callbackPtr = Module.addFunction(_callback, "vii");
21696
+
21697
+ Module.ccall(
21698
+ "csp_common_IRealtimeEngine_SetEntityCreatedCallback_void_EntityCreatedCallback",
21699
+ "void",
21700
+ ["number", "number", "number"],
21701
+ [this.pointer, _callbackPtr, 0],
21702
+ );
21703
+ }
21704
+
21705
+ /**
21706
+ * @description Finds the first found SpaceEntity of a matching Name.
21707
+ * @param name - The name to search.
21708
+ * @return A non-owning pointer to the first found matching SpaceEntity.
21709
+ */
21710
+
21711
+ findSpaceEntity(name: string): Multiplayer.SpaceEntity {
21712
+ var _ret = Module._malloc(8);
21713
+
21714
+ Module.ccall(
21715
+ "csp_common_IRealtimeEngine_FindSpaceEntity_SpaceEntityP_StringRC",
21716
+ "void",
21717
+ ["number", "number", "string"],
21718
+ [_ret, this.pointer, name],
21719
+ );
21720
+ var _nPtr = new Multiplayer.SpaceEntity(getNativePointer(_ret));
21721
+ Module._free(_ret);
21722
+
21723
+ return _nPtr;
21724
+ }
21725
+
21726
+ /**
21727
+ * @description Finds the first found SpaceEntity that has the ID EntityId.
21728
+ * @param entityId - The Id to look for.
21729
+ * @return A non-owning pointer to the first found matching SpaceEntity.
21730
+ */
21731
+
21732
+ findSpaceEntityById(entityId: bigint): Multiplayer.SpaceEntity {
21733
+ assert(entityId >= Limits.UINT64_MIN);
21734
+ assert(entityId <= Limits.UINT64_MAX);
21735
+
21736
+ var _ret = Module._malloc(8);
21737
+
21738
+ Module.ccall(
21739
+ "csp_common_IRealtimeEngine_FindSpaceEntityById_SpaceEntityP_uint64_t",
21740
+ "void",
21741
+ ["number", "number", "bigint"],
21742
+ [_ret, this.pointer, entityId],
21743
+ );
21744
+ var _nPtr = new Multiplayer.SpaceEntity(getNativePointer(_ret));
21745
+ Module._free(_ret);
21746
+
21747
+ return _nPtr;
21748
+ }
21749
+
21750
+ /**
21751
+ * @description Finds the first found SpaceEntity of a matching Name. The found SpaceEntity will contain an AvatarSpaceComponent.
21752
+ * @param name - The name to search for.
21753
+ * @return A pointer to the first found matching SpaceEntity.
21754
+ */
21755
+
21756
+ findSpaceAvatar(name: string): Multiplayer.SpaceEntity {
21757
+ var _ret = Module._malloc(8);
21758
+
21759
+ Module.ccall(
21760
+ "csp_common_IRealtimeEngine_FindSpaceAvatar_SpaceEntityP_StringRC",
21761
+ "void",
21762
+ ["number", "number", "string"],
21763
+ [_ret, this.pointer, name],
21764
+ );
21765
+ var _nPtr = new Multiplayer.SpaceEntity(getNativePointer(_ret));
21766
+ Module._free(_ret);
21767
+
21768
+ return _nPtr;
21769
+ }
21770
+
21771
+ /**
21772
+ * @description Finds the first found SpaceEntity of a matching Name. The found SpaceEntity will not contain an AvatarSpaceComponent.
21773
+ * @param name - The name to search for.
21774
+ * @return A pointer to the first found matching SpaceEntity.
21775
+ */
21776
+
21777
+ findSpaceObject(name: string): Multiplayer.SpaceEntity {
21778
+ var _ret = Module._malloc(8);
21779
+
21780
+ Module.ccall(
21781
+ "csp_common_IRealtimeEngine_FindSpaceObject_SpaceEntityP_StringRC",
21782
+ "void",
21783
+ ["number", "number", "string"],
21784
+ [_ret, this.pointer, name],
21785
+ );
21786
+ var _nPtr = new Multiplayer.SpaceEntity(getNativePointer(_ret));
21787
+ Module._free(_ret);
21788
+
21789
+ return _nPtr;
21790
+ }
21791
+
21792
+ /**
21793
+ * @description Get an Entity by its index.
21794
+ * /// @param EntityIndex size_t : The index of the entity to get.
21795
+ * @return A non-owning pointer to the entity at the given index.
21796
+ */
21797
+
21798
+ getEntityByIndex(entityIndex: number): Multiplayer.SpaceEntity {
21799
+ assert(Number.isInteger(entityIndex));
21800
+ assert(entityIndex >= Limits.UINT32_MIN);
21801
+ assert(entityIndex <= Limits.UINT32_MAX);
21802
+
21803
+ var _ret = Module._malloc(8);
21804
+
21805
+ Module.ccall(
21806
+ "csp_common_IRealtimeEngine_GetEntityByIndex_SpaceEntityP_size_t",
21807
+ "void",
21808
+ ["number", "number", "number"],
21809
+ [_ret, this.pointer, entityIndex],
21810
+ );
21811
+ var _nPtr = new Multiplayer.SpaceEntity(getNativePointer(_ret));
21812
+ Module._free(_ret);
21813
+
21814
+ return _nPtr;
21815
+ }
21816
+
21817
+ /**
21818
+ * @description Get an Avatar by its index. The returned pointer will be an entity that contains an AvatarSpaceComponent.
21819
+ * /// @param AvatarIndex size_t : The index of the avatar entity to get.
21820
+ * @return A non-owning pointer to the avatar entity with the given index.
21821
+ */
21822
+
21823
+ getAvatarByIndex(avatarIndex: number): Multiplayer.SpaceEntity {
21824
+ assert(Number.isInteger(avatarIndex));
21825
+ assert(avatarIndex >= Limits.UINT32_MIN);
21826
+ assert(avatarIndex <= Limits.UINT32_MAX);
21827
+
21828
+ var _ret = Module._malloc(8);
21829
+
21830
+ Module.ccall(
21831
+ "csp_common_IRealtimeEngine_GetAvatarByIndex_SpaceEntityP_size_t",
21832
+ "void",
21833
+ ["number", "number", "number"],
21834
+ [_ret, this.pointer, avatarIndex],
21835
+ );
21836
+ var _nPtr = new Multiplayer.SpaceEntity(getNativePointer(_ret));
21837
+ Module._free(_ret);
21838
+
21839
+ return _nPtr;
21840
+ }
21841
+
21842
+ /**
21843
+ * @description Get an Object by its index. The returned pointer will be an entity that does not contain an AvatarSpaceComponent.
21844
+ * /// @param ObjectIndex size_t : The index of the object entity to get.
21845
+ * @return A non-owning pointer to the object entity with the given index.
21846
+ */
21847
+
21848
+ getObjectByIndex(objectIndex: number): Multiplayer.SpaceEntity {
21849
+ assert(Number.isInteger(objectIndex));
21850
+ assert(objectIndex >= Limits.UINT32_MIN);
21851
+ assert(objectIndex <= Limits.UINT32_MAX);
21852
+
21853
+ var _ret = Module._malloc(8);
21854
+
21855
+ Module.ccall(
21856
+ "csp_common_IRealtimeEngine_GetObjectByIndex_SpaceEntityP_size_t",
21857
+ "void",
21858
+ ["number", "number", "number"],
21859
+ [_ret, this.pointer, objectIndex],
21860
+ );
21861
+ var _nPtr = new Multiplayer.SpaceEntity(getNativePointer(_ret));
21862
+ Module._free(_ret);
21863
+
21864
+ return _nPtr;
21865
+ }
21866
+
21867
+ /**
21868
+ * @description Get the number of total entities in the system.
21869
+ * @return The total number of entities.
21870
+ */
21871
+
21872
+ getNumEntities(): number {
21873
+ let _result = Module.ccall(
21874
+ "csp_common_IRealtimeEngine_GetNumEntitiesC_size_t",
21875
+ "number",
21876
+ ["number"],
21877
+ [this.pointer],
21878
+ );
21879
+
21880
+ const _unfixedValue = _result;
21881
+ let _fixedValue =
21882
+ _unfixedValue < 0 ? _unfixedValue + 2 ** 32 : _unfixedValue;
21883
+ _result = _fixedValue;
21884
+
21885
+ return _result;
21886
+ }
21887
+
21888
+ /**
21889
+ * @description Get the number of total Avatars in the system. Avatars are entities that contain AvatarSpaceComponents.
21890
+ * @return The total number of Avatar entities.
21891
+ */
21892
+
21893
+ getNumAvatars(): number {
21894
+ let _result = Module.ccall(
21895
+ "csp_common_IRealtimeEngine_GetNumAvatarsC_size_t",
21896
+ "number",
21897
+ ["number"],
21898
+ [this.pointer],
21899
+ );
21900
+
21901
+ const _unfixedValue = _result;
21902
+ let _fixedValue =
21903
+ _unfixedValue < 0 ? _unfixedValue + 2 ** 32 : _unfixedValue;
21904
+ _result = _fixedValue;
21905
+
21906
+ return _result;
21907
+ }
21908
+
21909
+ /**
21910
+ * @description Get the number of total Objects in the system. Objects are entities that do not contain AvatarSpaceComponents.
21911
+ * @return The total number of object entities.
21912
+ */
21913
+
21914
+ getNumObjects(): number {
21915
+ let _result = Module.ccall(
21916
+ "csp_common_IRealtimeEngine_GetNumObjectsC_size_t",
21917
+ "number",
21918
+ ["number"],
21919
+ [this.pointer],
21920
+ );
21921
+
21922
+ const _unfixedValue = _result;
21923
+ let _fixedValue =
21924
+ _unfixedValue < 0 ? _unfixedValue + 2 ** 32 : _unfixedValue;
21925
+ _result = _fixedValue;
21926
+
21927
+ return _result;
21928
+ }
21929
+
21930
+ /**
21931
+ * @description Retrieves all entities that exist at the root level (do not have a parent entity).
21932
+ * @return A list of root entities containing non-owning pointers to entities.
21933
+ */
21934
+
21935
+ getRootHierarchyEntities(): Common.List<Multiplayer.SpaceEntity> {
21936
+ var _ret = Module._malloc(8);
21937
+
21938
+ Module.ccall(
21939
+ "csp_common_IRealtimeEngine_GetRootHierarchyEntitiesC_ListPC",
21940
+ "void",
21941
+ ["number", "number"],
21942
+ [_ret, this.pointer],
21943
+ );
21944
+ var _nPtr = new Common.List<Multiplayer.SpaceEntity>(
21945
+ getNativePointer(_ret),
21946
+ csp_multiplayer_SpaceEntityFactory,
21947
+ "csp_multiplayer_SpaceEntity",
21948
+ );
21949
+ Module._free(_ret);
21950
+
21951
+ return _nPtr;
21952
+ }
21953
+
21954
+ /**
21955
+ * @description Sets a callback to be executed when all existing entities have been retrieved after entering a space.
21956
+ * @param callback - A callback that executes when all existing entities have been retrieved.
21957
+ */
21958
+ setInitialEntitiesRetrievedCallback(callback: (arg1: boolean) => void) {
21959
+ var _callback = (_stateObject__: number, arg1) => {
21960
+ callback(arg1);
21961
+ };
21962
+
21963
+ var _callbackPtr = Module.addFunction(_callback, "vii");
21964
+
21965
+ Module.ccall(
21966
+ "csp_common_IRealtimeEngine_SetInitialEntitiesRetrievedCallback_void_CallbackHandler",
21967
+ "void",
21968
+ ["number", "number", "number"],
21969
+ [this.pointer, _callbackPtr, 0],
21970
+ );
21971
+ }
21972
+
21973
+ /**
21974
+ * @description Adds an entity to a list of entities to be updated when ProcessPendingEntityOperations is called.
21975
+ * From a client perspective, ProcessPendingEntityOperations is normally called via the CSPFoundation::Tick method.
21976
+ * @param entity - A non-owning pointer to the entity to be marked.
21977
+ */
21978
+
21979
+ markEntityForUpdate(entity: Multiplayer.SpaceEntity): void {
21980
+ Module.ccall(
21981
+ "csp_common_IRealtimeEngine_MarkEntityForUpdate_void_SpaceEntityP",
21982
+ "void",
21983
+ ["number", "number"],
21984
+ [this.pointer, entity.pointer],
21985
+ );
21986
+ }
21987
+
21988
+ /**
21989
+ * @description Applies any pending changes to entities that have been marked for update.
21990
+ */
21991
+
21992
+ processPendingEntityOperations(): void {
21993
+ Module.ccall(
21994
+ "csp_common_IRealtimeEngine_ProcessPendingEntityOperations_void",
21995
+ "void",
21996
+ ["number"],
21997
+ [this.pointer],
21998
+ );
21999
+ }
22000
+ }
22001
+ }
22002
+
21478
22003
  export namespace Multiplayer {
21479
22004
  /**
21480
22005
  * @description The base class for all components, provides mechanisms for dirtying properties and subscribing to events on property changes.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "connected-spaces-platform.web",
3
3
  "displayName": "connected-spaces-platform.web",
4
- "version": "5.17.0+593",
4
+ "version": "5.17.2+595",
5
5
  "description": "This package provides the binaries required to interface with the Connected Spaces Platform API.",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {