@rpgjs/client 4.0.2 → 4.0.4
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/CHANGELOG.md +16 -0
- package/browser/React-ab9e74c2.js +127 -0
- package/browser/manifest.json +5 -0
- package/browser/rpg.client.js +435 -362
- package/browser/rpg.client.umd.cjs +573 -375
- package/lib/Components/Component.js +6 -0
- package/lib/Components/Component.js.map +1 -1
- package/lib/GameEngine.d.ts +1 -0
- package/lib/GameEngine.js +6 -2
- package/lib/GameEngine.js.map +1 -1
- package/lib/{RpgGui.d.ts → Gui/Gui.d.ts} +27 -20
- package/lib/Gui/Gui.js +497 -0
- package/lib/Gui/Gui.js.map +1 -0
- package/lib/Gui/React.d.ts +14 -0
- package/lib/Gui/React.js +89 -0
- package/lib/Gui/React.js.map +1 -0
- package/lib/Gui/Vue.d.ts +13 -0
- package/lib/{RpgGuiCompiled.js → Gui/Vue.js} +64 -11
- package/lib/Gui/Vue.js.map +1 -0
- package/lib/Renderer.js +6 -4
- package/lib/Renderer.js.map +1 -1
- package/lib/RpgClientEngine.js +1 -1
- package/lib/RpgClientEngine.js.map +1 -1
- package/lib/Scene/Scene.d.ts +26 -1
- package/lib/Scene/Scene.js +32 -3
- package/lib/Scene/Scene.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/package.json +21 -6
- package/rpg.toml +1 -1
- package/src/Components/Component.ts +6 -0
- package/src/GameEngine.ts +7 -3
- package/src/Gui/Gui.ts +556 -0
- package/src/Gui/React.ts +116 -0
- package/src/Gui/Vue.ts +137 -0
- package/src/Renderer.ts +8 -4
- package/src/RpgClientEngine.ts +1 -1
- package/src/Scene/Scene.ts +35 -4
- package/src/index.ts +2 -1
- package/lib/RpgGui.js +0 -499
- package/lib/RpgGui.js.map +0 -1
- package/lib/RpgGuiCompiled.d.ts +0 -3
- package/lib/RpgGuiCompiled.js.map +0 -1
- package/src/RpgGui.ts +0 -553
- package/src/RpgGuiCompiled.ts +0 -43
package/lib/RpgGui.js
DELETED
|
@@ -1,499 +0,0 @@
|
|
|
1
|
-
import RpgGuiCompiled from './RpgGuiCompiled.js';
|
|
2
|
-
import { createApp } from 'vue';
|
|
3
|
-
import { map } from 'rxjs';
|
|
4
|
-
import { RpgSound } from './Sound/RpgSound.js';
|
|
5
|
-
import { RpgResource } from './index.js';
|
|
6
|
-
class Gui {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.gui = {};
|
|
9
|
-
}
|
|
10
|
-
/** @internal */
|
|
11
|
-
_initalize(clientEngine) {
|
|
12
|
-
this.clientEngine = clientEngine;
|
|
13
|
-
this.renderer = clientEngine.renderer;
|
|
14
|
-
this.gameEngine = clientEngine.gameEngine;
|
|
15
|
-
const self = this;
|
|
16
|
-
const { gui } = this.renderer.options;
|
|
17
|
-
const selectorGui = this.renderer.guiEl;
|
|
18
|
-
const obj = {
|
|
19
|
-
/* template: `
|
|
20
|
-
<div
|
|
21
|
-
@pointerdown="propagate('pointerdown', $event)"
|
|
22
|
-
@pointermove="propagate('pointermove', $event)"
|
|
23
|
-
@pointerleave="propagate('pointerleave', $event)"
|
|
24
|
-
@pointerover="propagate('pointerover', $event)"
|
|
25
|
-
@pointercancel="propagate('pointercancel', $event)"
|
|
26
|
-
@pointerup="propagate('pointerup', $event)"
|
|
27
|
-
>
|
|
28
|
-
<template v-for="ui in fixedGui">
|
|
29
|
-
<component :is="ui.name" v-bind="ui.data" v-if="ui.display"></component>
|
|
30
|
-
</template>
|
|
31
|
-
<div id="tooltips" style="position: absolute; top: 0; left: 0;">
|
|
32
|
-
<template v-for="ui in attachedGui">
|
|
33
|
-
<template v-if="ui.display">
|
|
34
|
-
<div v-for="tooltip of tooltipFilter(tooltips, ui)" :style="tooltipPosition(tooltip.position)">
|
|
35
|
-
<component :is="ui.name" v-bind="{ ...ui.data, spriteData: tooltip }" :ref="ui.name"></component>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
</template>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
`,*/
|
|
42
|
-
render: RpgGuiCompiled,
|
|
43
|
-
data() {
|
|
44
|
-
return {
|
|
45
|
-
gui,
|
|
46
|
-
tooltips: []
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
provide: () => {
|
|
50
|
-
return {
|
|
51
|
-
/**
|
|
52
|
-
* Recovery of the current scene
|
|
53
|
-
*
|
|
54
|
-
* ```js
|
|
55
|
-
* export default {
|
|
56
|
-
* inject: ['rpgScene'],
|
|
57
|
-
* mounted() {
|
|
58
|
-
* const scene = this.rpgScene()
|
|
59
|
-
* scene.stopInputs()
|
|
60
|
-
* }
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @prop {Function returns RpgScene} [rpgScene]
|
|
65
|
-
* @memberof VueInject
|
|
66
|
-
* */
|
|
67
|
-
rpgScene: this.renderer.getScene.bind(this.renderer),
|
|
68
|
-
/**
|
|
69
|
-
* Retrieve the main container of the game
|
|
70
|
-
*
|
|
71
|
-
* ```js
|
|
72
|
-
* export default {
|
|
73
|
-
* inject: ['rpgStage'],
|
|
74
|
-
* mounted() {
|
|
75
|
-
* const blur = new PIXI.BlurFilter()
|
|
76
|
-
this.rpgStage.filters = [blur]
|
|
77
|
-
* }
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* @prop {PIXI.Container} [rpgStage]
|
|
82
|
-
* @memberof VueInject
|
|
83
|
-
* */
|
|
84
|
-
rpgStage: this.renderer.stage,
|
|
85
|
-
/**
|
|
86
|
-
* Listen to all the objects present in the room (events and players)
|
|
87
|
-
*
|
|
88
|
-
* ```js
|
|
89
|
-
* export default {
|
|
90
|
-
* inject: ['rpgObjects'],
|
|
91
|
-
* mounted() {
|
|
92
|
-
* this.obs = this.rpgObjects.subscribe((objects) => {
|
|
93
|
-
* for (let id in objects) {
|
|
94
|
-
* const obj = objects[id]
|
|
95
|
-
* console.log(obj.object, obj.paramsChanged)
|
|
96
|
-
* }
|
|
97
|
-
* })
|
|
98
|
-
* },
|
|
99
|
-
* unmounted() {
|
|
100
|
-
* this.obs.unsubscribe()
|
|
101
|
-
* }
|
|
102
|
-
* }
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* > remember to unsubscribe for memory leaks
|
|
106
|
-
*
|
|
107
|
-
* It is an observable that returns an object:
|
|
108
|
-
*
|
|
109
|
-
* * the key is the object identifier
|
|
110
|
-
* * The value is an object comprising:
|
|
111
|
-
* * `object`: The entire object
|
|
112
|
-
* * `paramsChanged`: Only the representation of the properties that have been changed on this object
|
|
113
|
-
*
|
|
114
|
-
* @prop {Observable<{ [objectId]: { object: object, paramsChanged: object } }>} [rpgObjects]
|
|
115
|
-
* @memberof VueInject
|
|
116
|
-
* */
|
|
117
|
-
rpgObjects: this.clientEngine.objects,
|
|
118
|
-
/**
|
|
119
|
-
* Recovers and listens to the current player
|
|
120
|
-
*
|
|
121
|
-
* ```js
|
|
122
|
-
* export default {
|
|
123
|
-
* inject: ['rpgCurrentPlayer'],
|
|
124
|
-
* mounted() {
|
|
125
|
-
* this.obs = this.rpgCurrentPlayer.subscribe((obj) => {
|
|
126
|
-
* console.log(obj.object, obj.paramsChanged)
|
|
127
|
-
* })
|
|
128
|
-
* },
|
|
129
|
-
* unmounted() {
|
|
130
|
-
* this.obs.unsubscribe()
|
|
131
|
-
* }
|
|
132
|
-
* }
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
* * `object`: The whole player
|
|
136
|
-
* * `paramsChanged`: Only the representation of the properties that have been changed on this player
|
|
137
|
-
*
|
|
138
|
-
* @prop {Observable<{ object: object, paramsChanged: object }>} [rpgCurrentPlayer]
|
|
139
|
-
* @memberof VueInject
|
|
140
|
-
* */
|
|
141
|
-
rpgCurrentPlayer: this.clientEngine.objects
|
|
142
|
-
.pipe(map((objects) => objects[this.gameEngine.playerId])),
|
|
143
|
-
rpgGameEngine: this.gameEngine,
|
|
144
|
-
/**
|
|
145
|
-
* Tell the server to close the GUI.
|
|
146
|
-
*
|
|
147
|
-
* It is a function with 2 parameters:
|
|
148
|
-
* * `name`: The name of the component
|
|
149
|
-
* * `data`: The data you want to pass to the server
|
|
150
|
-
*
|
|
151
|
-
* ```js
|
|
152
|
-
* export default {
|
|
153
|
-
* inject: ['rpgGuiClose'],
|
|
154
|
-
* methods: {
|
|
155
|
-
* close() {
|
|
156
|
-
* this.rpgGuiClose('gui-name', {
|
|
157
|
-
* amount: 1000
|
|
158
|
-
* })
|
|
159
|
-
* }
|
|
160
|
-
* }
|
|
161
|
-
* }
|
|
162
|
-
* ```
|
|
163
|
-
*
|
|
164
|
-
* @prop {Function(name, data)} [rpgGuiClose]
|
|
165
|
-
* @memberof VueInject
|
|
166
|
-
* */
|
|
167
|
-
rpgGuiClose(name, data) {
|
|
168
|
-
const guiId = name || this.$options.name;
|
|
169
|
-
self.socket.emit('gui.exit', {
|
|
170
|
-
guiId,
|
|
171
|
-
data
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* Perform an interaction with the open GUI
|
|
176
|
-
*
|
|
177
|
-
* It is a function with 2 parameters:
|
|
178
|
-
* * `guiId`: The name of the component/Gui
|
|
179
|
-
* * `name`: The name of the interaction (defined on the server side)
|
|
180
|
-
* * `data`: Data to be sent
|
|
181
|
-
*
|
|
182
|
-
* ```js
|
|
183
|
-
* export default {
|
|
184
|
-
* inject: ['rpgGuiInteraction'],
|
|
185
|
-
* methods: {
|
|
186
|
-
* changeGold() {
|
|
187
|
-
* this.rpgGuiInteraction('gui-name', 'change-gold', {
|
|
188
|
-
* amount: 100
|
|
189
|
-
* })
|
|
190
|
-
* }
|
|
191
|
-
* }
|
|
192
|
-
* }
|
|
193
|
-
* ```
|
|
194
|
-
*
|
|
195
|
-
* @prop {Function(guiId, name, data = {})} [rpgGuiInteraction]
|
|
196
|
-
* @memberof VueInject
|
|
197
|
-
* */
|
|
198
|
-
rpgGuiInteraction: (guiId, name, data = {}) => {
|
|
199
|
-
this.socket.emit('gui.interaction', {
|
|
200
|
-
guiId,
|
|
201
|
-
name,
|
|
202
|
-
data
|
|
203
|
-
});
|
|
204
|
-
},
|
|
205
|
-
/**
|
|
206
|
-
* Listen to the keys that are pressed on the keyboard
|
|
207
|
-
*
|
|
208
|
-
* ```js
|
|
209
|
-
* export default {
|
|
210
|
-
* inject: ['rpgKeypress'],
|
|
211
|
-
* mounted() {
|
|
212
|
-
* this.obs = this.rpgKeypress.subscribe(({ inputName, control }) => {
|
|
213
|
-
* console.log(inputName) // "escape"
|
|
214
|
-
* console.log(control.actionName) // "back"
|
|
215
|
-
* })
|
|
216
|
-
* },
|
|
217
|
-
* unmounted() {
|
|
218
|
-
* this.obs.unsubscribe()
|
|
219
|
-
* }
|
|
220
|
-
* }
|
|
221
|
-
* ```
|
|
222
|
-
*
|
|
223
|
-
* @prop {Observable<{ inputName: string, control: { actionName: string, options: any } }>} [rpgKeypress]
|
|
224
|
-
* @memberof VueInject
|
|
225
|
-
* */
|
|
226
|
-
rpgKeypress: this.clientEngine.keyChange
|
|
227
|
-
.pipe(map(name => {
|
|
228
|
-
const control = this.clientEngine.controls.getControl(name);
|
|
229
|
-
return {
|
|
230
|
-
inputName: name,
|
|
231
|
-
control
|
|
232
|
-
};
|
|
233
|
-
})),
|
|
234
|
-
/**
|
|
235
|
-
* Recovers the socket.
|
|
236
|
-
*
|
|
237
|
-
* ```js
|
|
238
|
-
* export default {
|
|
239
|
-
* inject: ['rpgSocket'],
|
|
240
|
-
* mounted() {
|
|
241
|
-
* const socket = this.rpgSocket()
|
|
242
|
-
* socket.emit('foo', 'bar')
|
|
243
|
-
* }
|
|
244
|
-
* }
|
|
245
|
-
* ```
|
|
246
|
-
*
|
|
247
|
-
* @prop {Function returns RpgScene} [rpgSocket]
|
|
248
|
-
* @memberof VueInject
|
|
249
|
-
* */
|
|
250
|
-
rpgSocket: () => this.socket,
|
|
251
|
-
/**
|
|
252
|
-
* The RpgGui object to control GUIs
|
|
253
|
-
*
|
|
254
|
-
* ```js
|
|
255
|
-
* export default {
|
|
256
|
-
* inject: ['rpgGui'],
|
|
257
|
-
* mounted() {
|
|
258
|
-
* const guis = this.rpgGui.getAll()
|
|
259
|
-
* }
|
|
260
|
-
* }
|
|
261
|
-
* ```
|
|
262
|
-
*
|
|
263
|
-
* @prop {RpgGui} [rpgGui]
|
|
264
|
-
* @memberof VueInject
|
|
265
|
-
* */
|
|
266
|
-
rpgGui: this,
|
|
267
|
-
/**
|
|
268
|
-
* Equivalent to RpgSound
|
|
269
|
-
*
|
|
270
|
-
* ```js
|
|
271
|
-
* export default {
|
|
272
|
-
* inject: ['rpgSound'],
|
|
273
|
-
* mounted() {
|
|
274
|
-
* this.rpgSound.get('my-sound-id').play()
|
|
275
|
-
* }
|
|
276
|
-
* }
|
|
277
|
-
* ```
|
|
278
|
-
*
|
|
279
|
-
* @prop {RpgSound} [rpgSound]
|
|
280
|
-
* @memberof VueInject
|
|
281
|
-
* */
|
|
282
|
-
rpgSound: RpgSound,
|
|
283
|
-
/**
|
|
284
|
-
* Find the game's image and sound library
|
|
285
|
-
*
|
|
286
|
-
* ```js
|
|
287
|
-
* export default {
|
|
288
|
-
* inject: ['rpgResource'],
|
|
289
|
-
* mounted() {
|
|
290
|
-
* const resourceImage = this.rpgResource.spritesheets.get('image_id')
|
|
291
|
-
* const resourceSound = this.rpgResource.sounds.get('sound_id')
|
|
292
|
-
* }
|
|
293
|
-
* }
|
|
294
|
-
* ```
|
|
295
|
-
*
|
|
296
|
-
* @prop { { spritesheets: Map, sounds: Map } } [rpgResource]
|
|
297
|
-
* @memberof VueInject
|
|
298
|
-
* */
|
|
299
|
-
rpgResource: RpgResource,
|
|
300
|
-
/**
|
|
301
|
-
* Get RpgClientEngine instance
|
|
302
|
-
*
|
|
303
|
-
* ```js
|
|
304
|
-
* export default {
|
|
305
|
-
* inject: ['rpgEngine'],
|
|
306
|
-
* mounted() {
|
|
307
|
-
* const vueInstance = this.rpgEngine.vueInstance
|
|
308
|
-
* }
|
|
309
|
-
* }
|
|
310
|
-
* ```
|
|
311
|
-
*
|
|
312
|
-
* @prop {RpgClientEngine} [rpgEngine]
|
|
313
|
-
* @memberof VueInject
|
|
314
|
-
* */
|
|
315
|
-
rpgEngine: this.clientEngine
|
|
316
|
-
};
|
|
317
|
-
},
|
|
318
|
-
computed: {
|
|
319
|
-
fixedGui() {
|
|
320
|
-
return Object.values(this.gui).filter((gui) => !gui.attachToSprite);
|
|
321
|
-
},
|
|
322
|
-
attachedGui() {
|
|
323
|
-
return Object.values(this.gui).filter((gui) => gui.attachToSprite);
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
methods: {
|
|
327
|
-
propagate: (type, event) => {
|
|
328
|
-
this.renderer.canvas.dispatchEvent(new MouseEvent(type, event));
|
|
329
|
-
},
|
|
330
|
-
tooltipPosition: (position) => {
|
|
331
|
-
const scene = this.renderer.getScene();
|
|
332
|
-
const viewport = scene?.viewport;
|
|
333
|
-
if (viewport) {
|
|
334
|
-
const left = position.x - viewport.left;
|
|
335
|
-
const top = position.y - viewport.top;
|
|
336
|
-
return {
|
|
337
|
-
transform: `translate(${left}px,${top}px)`
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
tooltipFilter(sprites, ui) {
|
|
342
|
-
return sprites.filter(tooltip => tooltip.guiDisplay);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
this.app = createApp(obj);
|
|
347
|
-
for (let ui of gui) {
|
|
348
|
-
this.app.component(ui.name, ui);
|
|
349
|
-
this.gui[ui.name] = {
|
|
350
|
-
data: ui.data,
|
|
351
|
-
attachToSprite: ui.rpgAttachToSprite,
|
|
352
|
-
display: false,
|
|
353
|
-
name: ui.name
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
this.vm = this.app.mount(selectorGui);
|
|
357
|
-
this.vm.gui = this.gui;
|
|
358
|
-
this.renderer.app = this.app;
|
|
359
|
-
this.renderer.vm = this.vm;
|
|
360
|
-
}
|
|
361
|
-
/** @internal */
|
|
362
|
-
update(logicObjects) {
|
|
363
|
-
this.vm.tooltips = Object.values(logicObjects).map((object) => object.object);
|
|
364
|
-
}
|
|
365
|
-
/** @internal */
|
|
366
|
-
_setSocket(socket) {
|
|
367
|
-
this.socket = socket;
|
|
368
|
-
this.socket.on('gui.open', ({ guiId, data }) => {
|
|
369
|
-
this.display(guiId, data);
|
|
370
|
-
});
|
|
371
|
-
this.socket.on('gui.tooltip', ({ players, display }) => {
|
|
372
|
-
for (let playerId of players) {
|
|
373
|
-
const sprite = this.renderer.getScene()?.getSprite(playerId);
|
|
374
|
-
if (sprite)
|
|
375
|
-
sprite.guiDisplay = display;
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
this.socket.on('gui.exit', (guiId) => {
|
|
379
|
-
this.hide(guiId);
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
/** @internal */
|
|
383
|
-
_setGui(id, obj) {
|
|
384
|
-
const guiObj = this.get(id);
|
|
385
|
-
if (!guiObj) {
|
|
386
|
-
throw `The GUI named ${id} is non-existent. Please add the component in the gui property of the decorator @RpgClient`;
|
|
387
|
-
}
|
|
388
|
-
for (let key in obj) {
|
|
389
|
-
guiObj[key] = obj[key];
|
|
390
|
-
}
|
|
391
|
-
this.vm.gui = Object.assign({}, this.vm.gui);
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Get a GUI. You retrieve GUI data and information whether it is displayed or not
|
|
395
|
-
*
|
|
396
|
-
* ```ts
|
|
397
|
-
* import { RpgGui } from '@rpgjs/client'
|
|
398
|
-
*
|
|
399
|
-
* const gui = RpgGui.get('my-gui')
|
|
400
|
-
* console.log(gui.display) // false
|
|
401
|
-
* ```
|
|
402
|
-
*
|
|
403
|
-
* @title Get a GUI
|
|
404
|
-
* @method RpgGui.get(id)
|
|
405
|
-
* @param {string} id
|
|
406
|
-
* @returns { { data: any, display: boolean } }
|
|
407
|
-
* @memberof RpgGui
|
|
408
|
-
*/
|
|
409
|
-
get(id) {
|
|
410
|
-
if (typeof id != 'string') {
|
|
411
|
-
id = id.name;
|
|
412
|
-
}
|
|
413
|
-
return this.gui[id];
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* Get all GUI. You retrieve GUI data and information whether it is displayed or not
|
|
417
|
-
*
|
|
418
|
-
* ```ts
|
|
419
|
-
* import { RpgGui } from '@rpgjs/client'
|
|
420
|
-
*
|
|
421
|
-
* const gui = RpgGui.getAll()
|
|
422
|
-
* console.log(gui) // { 'rpg-dialog': { data: {}, display: true } }
|
|
423
|
-
* ```
|
|
424
|
-
*
|
|
425
|
-
* @title Get all GUI
|
|
426
|
-
* @method RpgGui.getAll()
|
|
427
|
-
* @returns { { [guiName]: { data: any, display: boolean } }}
|
|
428
|
-
* @memberof RpgGui
|
|
429
|
-
*/
|
|
430
|
-
getAll() {
|
|
431
|
-
return this.gui;
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Checks if the GUI exists RpgClient's gui array
|
|
435
|
-
*
|
|
436
|
-
* ```ts
|
|
437
|
-
* import { RpgGui } from '@rpgjs/client'
|
|
438
|
-
*
|
|
439
|
-
* RpgGui.exists('my-gui') // true
|
|
440
|
-
* ```
|
|
441
|
-
*
|
|
442
|
-
* @title GUI Exists ?
|
|
443
|
-
* @method RpgGui.exists(id)
|
|
444
|
-
* @param {string} id
|
|
445
|
-
* @returns {boolean}
|
|
446
|
-
* @memberof RpgGui
|
|
447
|
-
*/
|
|
448
|
-
exists(id) {
|
|
449
|
-
return !!this.get(id);
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Calls a GUI according to identifier. You can send retrievable data in the component
|
|
453
|
-
*
|
|
454
|
-
* ```ts
|
|
455
|
-
* import { RpgGui } from '@rpgjs/client'
|
|
456
|
-
*
|
|
457
|
-
* RpgGui.display('my-gui')
|
|
458
|
-
* ```
|
|
459
|
-
*
|
|
460
|
-
* @title Display GUI
|
|
461
|
-
* @method RpgGui.display(id,data)
|
|
462
|
-
* @param {string} id
|
|
463
|
-
* @param {object} [data]
|
|
464
|
-
* @returns {void}
|
|
465
|
-
* @memberof RpgGui
|
|
466
|
-
*/
|
|
467
|
-
display(id, data = {}) {
|
|
468
|
-
this._setGui(id, {
|
|
469
|
-
display: true,
|
|
470
|
-
data
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Hide a GUI according to its identifier
|
|
475
|
-
*
|
|
476
|
-
* ```ts
|
|
477
|
-
* import { RpgGui } from '@rpgjs/client'
|
|
478
|
-
*
|
|
479
|
-
* RpgGui.hide('my-gui')
|
|
480
|
-
* ```
|
|
481
|
-
*
|
|
482
|
-
* @title Hide GUI
|
|
483
|
-
* @method RpgGui.hide(id)
|
|
484
|
-
* @param {string} id
|
|
485
|
-
* @returns {void}
|
|
486
|
-
* @memberof RpgGui
|
|
487
|
-
*/
|
|
488
|
-
hide(id) {
|
|
489
|
-
this._setGui(id, {
|
|
490
|
-
display: false
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
/** @internal */
|
|
494
|
-
clear() {
|
|
495
|
-
this.gui = {};
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
export const RpgGui = new Gui();
|
|
499
|
-
//# sourceMappingURL=RpgGui.js.map
|
package/lib/RpgGui.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RpgGui.js","sourceRoot":"","sources":["../src/RpgGui.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAgC,SAAS,EAAE,MAAM,KAAK,CAAA;AAE7D,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAmB,WAAW,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