@momo2555/koppeliajs 0.0.143 → 0.0.145
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.
|
@@ -83,6 +83,12 @@ export declare class Koppelia {
|
|
|
83
83
|
* text update notification form koppelia application
|
|
84
84
|
*/
|
|
85
85
|
registerNewResizableText(id: string, defaultSize: number, onTextResized: (newSize: number) => void): Promise<void>;
|
|
86
|
+
writeGameConfig(config_id: string, config_value: {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}, current_play?: boolean): Promise<void>;
|
|
89
|
+
getGameConfig(config_id: string, current_play: boolean): Promise<{
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}>;
|
|
86
92
|
/**
|
|
87
93
|
* @param sentence
|
|
88
94
|
*/
|
package/dist/scripts/koppelia.js
CHANGED
|
@@ -269,6 +269,28 @@ export class Koppelia {
|
|
|
269
269
|
resolve();
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
+
async writeGameConfig(config_id, config_value, current_play = true) {
|
|
273
|
+
let setGameConfigRequest = new Message();
|
|
274
|
+
setGameConfigRequest.setRequest("setGameData");
|
|
275
|
+
setGameConfigRequest.addParam("playId", current_play ? "current" : null);
|
|
276
|
+
setGameConfigRequest.addParam("content", config_value);
|
|
277
|
+
setGameConfigRequest.addParam("dataId", config_id);
|
|
278
|
+
setGameConfigRequest.setDestination(PeerType.MASTER, "");
|
|
279
|
+
this._console.sendMessage(setGameConfigRequest);
|
|
280
|
+
}
|
|
281
|
+
async getGameConfig(config_id, current_play) {
|
|
282
|
+
return new Promise((resolve, reject) => {
|
|
283
|
+
let getGameConfigRequest = new Message();
|
|
284
|
+
getGameConfigRequest.setRequest("getGameData");
|
|
285
|
+
getGameConfigRequest.addParam("playId", current_play ? "current" : null);
|
|
286
|
+
getGameConfigRequest.addParam("dataId", config_id);
|
|
287
|
+
getGameConfigRequest.setDestination(PeerType.MASTER, "");
|
|
288
|
+
this._console.sendMessage(getGameConfigRequest, (response) => {
|
|
289
|
+
let gameConfigContent = response.getParam("content", {});
|
|
290
|
+
resolve(gameConfigContent);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
272
294
|
/**
|
|
273
295
|
* @param sentence
|
|
274
296
|
*/
|
|
@@ -305,7 +327,7 @@ export class Koppelia {
|
|
|
305
327
|
createChoicesOption(name, label, value, choices) {
|
|
306
328
|
this._option.setOption(name, value, "choices", {
|
|
307
329
|
"choices": choices,
|
|
308
|
-
"label": label
|
|
330
|
+
"label": label,
|
|
309
331
|
});
|
|
310
332
|
}
|
|
311
333
|
onOptionChanged(name, callback) {
|
package/dist/scripts/state.js
CHANGED
|
@@ -84,7 +84,7 @@ export class State {
|
|
|
84
84
|
this._console.onReady(() => {
|
|
85
85
|
let req = new Message();
|
|
86
86
|
req.setRequest("changeState");
|
|
87
|
-
req.addParam("state", update);
|
|
87
|
+
req.addParam("state", this._forceState ? newState : update);
|
|
88
88
|
req.addParam("update", !this._forceState);
|
|
89
89
|
this._forceState = false;
|
|
90
90
|
this._console.sendMessage(req);
|