connected-spaces-platform.web 6.14.0 → 6.16.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.
@@ -3479,11 +3479,10 @@ export namespace Common {
3479
3479
 
3480
3480
  export namespace Common {
3481
3481
  export enum ESequenceUpdateType {
3482
- Create,
3483
- Update,
3484
- Rename,
3485
- Delete,
3486
- Invalid,
3482
+ Create = 0,
3483
+ Update = 1,
3484
+ Delete = 3,
3485
+ Invalid = 4,
3487
3486
  }
3488
3487
  }
3489
3488
 
@@ -3816,6 +3815,10 @@ export namespace Multiplayer {
3816
3815
  ON_OBJECT_PATCH,
3817
3816
  ON_REQUEST_TO_SEND_OBJECT,
3818
3817
  ON_REQUEST_TO_DISCONNECT,
3818
+ SEND_SCOPE_LEADER_HEARTBEAT,
3819
+ ASSUME_SCOPE_LEADERSHIP,
3820
+ ON_ELECTED_SCOPE_LEADER,
3821
+ ON_VACATED_AS_SCOPE_LEADER,
3819
3822
  }
3820
3823
  }
3821
3824
 
@@ -32588,6 +32591,32 @@ export namespace Systems {
32588
32591
  );
32589
32592
  }
32590
32593
 
32594
+ get scopeClientId(): bigint {
32595
+ let _result = Module.ccall(
32596
+ "csp_systems_ScopeLeader__Get_ScopeClientId",
32597
+ "bigint",
32598
+ ["number"],
32599
+ [this.pointer],
32600
+ );
32601
+
32602
+ const _unfixedValue = _result;
32603
+ let _fixedValue =
32604
+ _unfixedValue < 0 ? _unfixedValue + 2n ** 64n : _unfixedValue;
32605
+
32606
+ _result = _fixedValue;
32607
+
32608
+ return _result;
32609
+ }
32610
+
32611
+ set scopeClientId(value: bigint) {
32612
+ Module.ccall(
32613
+ "csp_systems_ScopeLeader__Set_ScopeClientId",
32614
+ "void",
32615
+ ["number", "bigint"],
32616
+ [this.pointer, value],
32617
+ );
32618
+ }
32619
+
32591
32620
  get electionInProgress(): boolean {
32592
32621
  let _result = Module.ccall(
32593
32622
  "csp_systems_ScopeLeader__Get_ElectionInProgress",
@@ -37206,6 +37235,74 @@ export namespace Multiplayer {
37206
37235
  );
37207
37236
  }
37208
37237
 
37238
+ /**
37239
+ * @description Binds the provided callback to receive events when a new scope leader has been elected.
37240
+ * @param callback - Fired when a new scope leader is elected.
37241
+ */
37242
+ setOnElectedScopeLeaderCallback(
37243
+ callback: (scopeId: string, userId: string) => void,
37244
+ ) {
37245
+ var _callback = (_stateObject__: number, scopeId, userId) => {
37246
+ {
37247
+ const _stringValue = Module.UTF8ToString(scopeId);
37248
+ free(scopeId);
37249
+
37250
+ scopeId = _stringValue;
37251
+ }
37252
+ {
37253
+ const _stringValue = Module.UTF8ToString(userId);
37254
+ free(userId);
37255
+
37256
+ userId = _stringValue;
37257
+ }
37258
+
37259
+ callback(scopeId, userId);
37260
+ };
37261
+
37262
+ var _callbackPtr = Module.addFunction(_callback, "viii");
37263
+
37264
+ Module.ccall(
37265
+ "csp_multiplayer_OnlineRealtimeEngine_SetOnElectedScopeLeaderCallback_void_ScopeLeaderCallback",
37266
+ "void",
37267
+ ["number", "number", "number"],
37268
+ [this.pointer, _callbackPtr, 0],
37269
+ );
37270
+ }
37271
+
37272
+ /**
37273
+ * @description Binds the provided callback to receive events when a scope leader has been vacated.
37274
+ * @param callback - Fired when a scope leader is vacated.
37275
+ */
37276
+ setOnVacatedAsScopeLeaderCallback(
37277
+ callback: (scopeId: string, userId: string) => void,
37278
+ ) {
37279
+ var _callback = (_stateObject__: number, scopeId, userId) => {
37280
+ {
37281
+ const _stringValue = Module.UTF8ToString(scopeId);
37282
+ free(scopeId);
37283
+
37284
+ scopeId = _stringValue;
37285
+ }
37286
+ {
37287
+ const _stringValue = Module.UTF8ToString(userId);
37288
+ free(userId);
37289
+
37290
+ userId = _stringValue;
37291
+ }
37292
+
37293
+ callback(scopeId, userId);
37294
+ };
37295
+
37296
+ var _callbackPtr = Module.addFunction(_callback, "viii");
37297
+
37298
+ Module.ccall(
37299
+ "csp_multiplayer_OnlineRealtimeEngine_SetOnVacatedAsScopeLeaderCallback_void_ScopeLeaderCallback",
37300
+ "void",
37301
+ ["number", "number", "number"],
37302
+ [this.pointer, _callbackPtr, 0],
37303
+ );
37304
+ }
37305
+
37209
37306
  /**
37210
37307
  * @description Sets the script owner for the given entity to the current client
37211
37308
  * @param entity - A pointer to the entity
@@ -37234,7 +37331,8 @@ export namespace Multiplayer {
37234
37331
  }
37235
37332
 
37236
37333
  /**
37237
- * @description Disable Leader Election feature.
37334
+ * @description Disable Leader Election feature.
37335
+ @pre SpaceSystem::EnterSpace should be called first for this to take affect.
37238
37336
  */
37239
37337
 
37240
37338
  disableLeaderElection(): void {
@@ -37264,6 +37362,7 @@ export namespace Multiplayer {
37264
37362
 
37265
37363
  /**
37266
37364
  * @description Debug helper to get the id of the currently elected script leader.
37365
+ * This should be updated when we fully support scopes. We will need to pass in the scopeId we want the leader for.
37267
37366
  * @return The id of the leader.
37268
37367
  */
37269
37368
 
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": "6.14.0",
4
+ "version": "6.16.0",
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": {