@momo2555/koppeliajs 0.0.170 → 0.0.172
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/dist/scripts/koppelia.d.ts +12 -0
- package/dist/scripts/koppelia.js +38 -0
- package/package.json +1 -1
|
@@ -123,6 +123,18 @@ export declare class Koppelia {
|
|
|
123
123
|
* @returns A promise resolving to the active Play.
|
|
124
124
|
*/
|
|
125
125
|
getCurrentPlay(): Promise<Play>;
|
|
126
|
+
/**
|
|
127
|
+
* Asynchronously retrieves all currently selected Play instances set on the server.
|
|
128
|
+
* @returns A promise resolving to an array of active Play instances.
|
|
129
|
+
*/
|
|
130
|
+
getCurrentPlays(): Promise<Play[]>;
|
|
131
|
+
/**
|
|
132
|
+
* Asynchronously executes a named API function on the master peer with the given arguments.
|
|
133
|
+
* @param functionName The name of the API function to invoke.
|
|
134
|
+
* @param args A dictionary of string arguments to pass to the function.
|
|
135
|
+
* @returns A promise resolving to the result returned by the API function.
|
|
136
|
+
*/
|
|
137
|
+
runApiFunction(functionName: string, args: Record<string, string>): Promise<unknown>;
|
|
126
138
|
/**
|
|
127
139
|
* Enables a live difficulty cursor, allowing difficulty changes during gameplay.
|
|
128
140
|
* @param callback Function to execute when the difficulty changes.
|
package/dist/scripts/koppelia.js
CHANGED
|
@@ -293,6 +293,44 @@ export class Koppelia {
|
|
|
293
293
|
});
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Asynchronously retrieves all currently selected Play instances set on the server.
|
|
298
|
+
* @returns A promise resolving to an array of active Play instances.
|
|
299
|
+
*/
|
|
300
|
+
async getCurrentPlays() {
|
|
301
|
+
return new Promise((resolve, reject) => {
|
|
302
|
+
let getCurrentPlaysRequest = new Message();
|
|
303
|
+
getCurrentPlaysRequest.setRequest("getCurrentPlays");
|
|
304
|
+
getCurrentPlaysRequest.setDestination(PeerType.MASTER, "");
|
|
305
|
+
this._console.sendMessage(getCurrentPlaysRequest, (response) => {
|
|
306
|
+
let playsRawList = response.getParam("plays", {});
|
|
307
|
+
let plays = [];
|
|
308
|
+
for (let playId in playsRawList) {
|
|
309
|
+
plays.push(new Play(this._console, playId, playsRawList[playId]));
|
|
310
|
+
}
|
|
311
|
+
resolve(plays);
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Asynchronously executes a named API function on the master peer with the given arguments.
|
|
317
|
+
* @param functionName The name of the API function to invoke.
|
|
318
|
+
* @param args A dictionary of string arguments to pass to the function.
|
|
319
|
+
* @returns A promise resolving to the result returned by the API function.
|
|
320
|
+
*/
|
|
321
|
+
async runApiFunction(functionName, args) {
|
|
322
|
+
return new Promise((resolve, reject) => {
|
|
323
|
+
let request = new Message();
|
|
324
|
+
request.setRequest("runApiFunction");
|
|
325
|
+
request.addParam("functionName", functionName);
|
|
326
|
+
request.addParam("args", args);
|
|
327
|
+
request.setDestination(PeerType.MASTER, "");
|
|
328
|
+
this._console.sendMessage(request, (response) => {
|
|
329
|
+
let result = response.getParam("result", null);
|
|
330
|
+
resolve(result);
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
}
|
|
296
334
|
/**
|
|
297
335
|
* Enables a live difficulty cursor, allowing difficulty changes during gameplay.
|
|
298
336
|
* @param callback Function to execute when the difficulty changes.
|