@rpgjs/client 5.0.0-alpha.0 → 5.0.0-alpha.10
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/Game/AnimationManager.d.ts +8 -0
- package/dist/RpgClient.d.ts +99 -68
- package/dist/RpgClientEngine.d.ts +86 -4
- package/dist/components/animations/index.d.ts +4 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.js +4 -4
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +6 -2
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +2 -2
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +95 -35
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +45 -186
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +187 -5
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +5 -383
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +384 -28
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +24 -17
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +147 -25
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +16 -2413
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +2395 -88
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +108 -103
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +95 -57
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +62 -12
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +18 -37
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +25 -3
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +87 -314
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +37 -21
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +3 -9
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +317 -6
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +24 -171
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +7 -497
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +8 -9
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +9 -4400
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +4397 -85
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +310 -55
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +169 -15
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +496 -15
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +61 -0
- package/dist/index39.js.map +1 -0
- package/dist/index4.js +18 -5
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +20 -0
- package/dist/index40.js.map +1 -0
- package/dist/index41.js +82 -0
- package/dist/index41.js.map +1 -0
- package/dist/index5.js +2 -1
- package/dist/index5.js.map +1 -1
- package/dist/index6.js +1 -1
- package/dist/index7.js +10 -2
- package/dist/index7.js.map +1 -1
- package/dist/index8.js +24 -6
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +2 -2
- package/dist/presets/animation.d.ts +31 -0
- package/dist/presets/index.d.ts +102 -0
- package/dist/presets/lpc.d.ts +89 -0
- package/dist/services/loadMap.d.ts +123 -2
- package/dist/services/mmorpg.d.ts +7 -3
- package/package.json +14 -12
- package/src/Game/{EffectManager.ts → AnimationManager.ts} +2 -2
- package/src/Game/Object.ts +69 -0
- package/src/RpgClient.ts +101 -67
- package/src/RpgClientEngine.ts +159 -24
- package/src/components/{effects → animations}/animation.ce +3 -5
- package/src/components/{effects → animations}/index.ts +1 -1
- package/src/components/character.ce +74 -33
- package/src/components/index.ts +2 -1
- package/src/components/scenes/draw-map.ce +6 -23
- package/src/components/scenes/event-layer.ce +3 -3
- package/src/core/setup.ts +2 -0
- package/src/index.ts +1 -1
- package/src/module.ts +23 -5
- package/src/presets/animation.ts +46 -0
- package/src/presets/index.ts +5 -1
- package/src/presets/lpc.ts +108 -0
- package/src/services/loadMap.ts +131 -2
- package/src/services/mmorpg.ts +20 -4
- package/tsconfig.json +1 -1
- package/vite.config.ts +1 -1
- package/dist/Game/EffectManager.d.ts +0 -5
- package/dist/components/effects/index.d.ts +0 -4
- package/src/components/scenes/element-map.ce +0 -23
- /package/src/components/{effects → animations}/hit.ce +0 -0
package/dist/RpgClient.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { ComponentFunction } from 'canvasengine';
|
|
1
2
|
import { RpgClientEngine } from './RpgClientEngine';
|
|
2
|
-
import { Loader } from 'pixi.js';
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
type SceneMap = any;
|
|
3
|
+
import { Loader, Container } from 'pixi.js';
|
|
4
|
+
type RpgComponent = Container;
|
|
5
|
+
type SceneMap = Container;
|
|
6
6
|
export interface RpgClientEngineHooks {
|
|
7
7
|
/**
|
|
8
8
|
* When the engine is started. If you send false, you prevent the client from connecting to the server
|
|
@@ -10,7 +10,7 @@ export interface RpgClientEngineHooks {
|
|
|
10
10
|
* @prop { (engine: RpgClientEngine) => boolean | any } [onStart]
|
|
11
11
|
* @memberof RpgEngineHooks
|
|
12
12
|
*/
|
|
13
|
-
onStart?: (engine: RpgClientEngine) => boolean | void
|
|
13
|
+
onStart?: (engine: RpgClientEngine) => boolean | void | Promise<boolean | void>;
|
|
14
14
|
/**
|
|
15
15
|
* Each frame
|
|
16
16
|
*
|
|
@@ -59,6 +59,34 @@ export interface RpgClientEngineHooks {
|
|
|
59
59
|
onWindowResize?: () => any;
|
|
60
60
|
}
|
|
61
61
|
export interface RpgSpriteHooks {
|
|
62
|
+
/**
|
|
63
|
+
* Array of components to render behind the sprite
|
|
64
|
+
* These components will be displayed with a lower z-index than the sprite itself
|
|
65
|
+
*
|
|
66
|
+
* @prop { ComponentFunction[] } [componentsBehind]
|
|
67
|
+
* @memberof RpgSpriteHooks
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const sprite: RpgSpriteHooks = {
|
|
71
|
+
* componentsBehind: [ShadowComponent, AuraComponent]
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
componentsBehind?: ComponentFunction[];
|
|
76
|
+
/**
|
|
77
|
+
* Array of components to render in front of the sprite
|
|
78
|
+
* These components will be displayed with a higher z-index than the sprite itself
|
|
79
|
+
*
|
|
80
|
+
* @prop { ComponentFunction[] } [componentsInFront]
|
|
81
|
+
* @memberof RpgSpriteHooks
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const sprite: RpgSpriteHooks = {
|
|
85
|
+
* componentsInFront: [HealthBarComponent, StatusEffectComponent]
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
componentsInFront?: ComponentFunction[];
|
|
62
90
|
/**
|
|
63
91
|
* As soon as the sprite is initialized
|
|
64
92
|
*
|
|
@@ -163,14 +191,13 @@ export interface RpgClient {
|
|
|
163
191
|
* @example
|
|
164
192
|
*
|
|
165
193
|
* ```ts
|
|
166
|
-
* import { RpgClient,
|
|
194
|
+
* import { RpgClient, defineModule } from '@rpgjs/client'
|
|
167
195
|
*
|
|
168
|
-
*
|
|
196
|
+
* defineModule<RpgClient>({
|
|
169
197
|
* hooks: {
|
|
170
198
|
* player: ['onAuth']
|
|
171
199
|
* }
|
|
172
200
|
* })
|
|
173
|
-
* class RpgClientEngine { }
|
|
174
201
|
* ```
|
|
175
202
|
*
|
|
176
203
|
* Emit the hook:
|
|
@@ -207,7 +234,7 @@ export interface RpgClient {
|
|
|
207
234
|
* Object containing the hooks concerning the engine
|
|
208
235
|
*
|
|
209
236
|
* ```ts
|
|
210
|
-
* import { RpgClientEngine, RpgClientEngineHooks,
|
|
237
|
+
* import { RpgClientEngine, RpgClientEngineHooks, defineModule, RpgClient } from '@rpgjs/client'
|
|
211
238
|
*
|
|
212
239
|
* const engine: RpgClientEngineHooks = {
|
|
213
240
|
* onConnected(engine: RpgClientEngine) {
|
|
@@ -215,10 +242,9 @@ export interface RpgClient {
|
|
|
215
242
|
* }
|
|
216
243
|
* }
|
|
217
244
|
*
|
|
218
|
-
*
|
|
245
|
+
* defineModule<RpgClient>({
|
|
219
246
|
* engine
|
|
220
247
|
* })
|
|
221
|
-
* class RpgClientModule {}
|
|
222
248
|
* ```
|
|
223
249
|
*
|
|
224
250
|
* @prop {RpgClientEngineHooks} [engine]
|
|
@@ -227,99 +253,79 @@ export interface RpgClient {
|
|
|
227
253
|
engine?: RpgClientEngineHooks;
|
|
228
254
|
/**
|
|
229
255
|
* Array containing the list of spritesheets
|
|
230
|
-
*
|
|
256
|
+
* Each element is a simple object containing spritesheet definitions
|
|
231
257
|
*
|
|
232
258
|
* ```ts
|
|
233
|
-
* import {
|
|
234
|
-
*
|
|
235
|
-
* @Spritesheet({
|
|
236
|
-
* id: 'chest',
|
|
237
|
-
* image: require('./assets/chest.png'),
|
|
238
|
-
* // other options
|
|
239
|
-
* })
|
|
240
|
-
* class Chest { }
|
|
259
|
+
* import { defineModule, RpgClient } from '@rpgjs/client'
|
|
241
260
|
*
|
|
242
|
-
*
|
|
261
|
+
* defineModule<RpgClient>({
|
|
243
262
|
* spritesheets: [
|
|
244
|
-
*
|
|
263
|
+
* {
|
|
264
|
+
* id: 'chest',
|
|
265
|
+
* image: require('./assets/chest.png'),
|
|
266
|
+
* framesWidth: 32,
|
|
267
|
+
* framesHeight: 32,
|
|
268
|
+
* animations: {
|
|
269
|
+
* default: {
|
|
270
|
+
* frames: [0, 1, 2],
|
|
271
|
+
* duration: 1000
|
|
272
|
+
* }
|
|
273
|
+
* }
|
|
274
|
+
* }
|
|
245
275
|
* ]
|
|
246
276
|
* })
|
|
247
|
-
* class RpgClientEngine {}
|
|
248
277
|
* ```
|
|
249
278
|
*
|
|
250
279
|
* [Guide: Create Sprite](/guide/create-sprite.html)
|
|
251
280
|
*
|
|
252
|
-
* @prop {Array<
|
|
281
|
+
* @prop {Array<Object>} [spritesheets]
|
|
253
282
|
* @memberof RpgClient
|
|
254
283
|
* */
|
|
255
284
|
spritesheets?: any[];
|
|
256
285
|
/**
|
|
257
286
|
* Array containing the list of VueJS components
|
|
258
287
|
*
|
|
259
|
-
* ```ts
|
|
260
|
-
* import { RpgClient, RpgModule } from '@rpgjs/client'
|
|
261
|
-
*
|
|
262
|
-
* const component = {
|
|
263
|
-
* name: 'my-gui',
|
|
264
|
-
* template: `
|
|
265
|
-
* <div>
|
|
266
|
-
* Component
|
|
267
|
-
* </div>
|
|
268
|
-
* `
|
|
269
|
-
* }
|
|
270
|
-
*
|
|
271
|
-
* @RpgModule<RpgClient>({
|
|
272
|
-
* gui: [
|
|
273
|
-
* component
|
|
274
|
-
* ]
|
|
275
|
-
* })
|
|
276
|
-
* class RpgClientEngine {}
|
|
277
|
-
* ```
|
|
278
288
|
*
|
|
279
289
|
* [Guide: Create GUI](/guide/create-gui.html)
|
|
280
290
|
*
|
|
281
|
-
* @prop {Array<Component of
|
|
291
|
+
* @prop {Array<Component of CanvasEngine>} [gui]
|
|
282
292
|
* @memberof RpgClient
|
|
283
293
|
* */
|
|
284
|
-
gui?:
|
|
294
|
+
gui?: ComponentFunction[];
|
|
285
295
|
/**
|
|
286
296
|
* Array containing the list of sounds
|
|
287
|
-
*
|
|
297
|
+
* Each element is a simple object containing sound definitions
|
|
288
298
|
*
|
|
289
299
|
* ```ts
|
|
290
|
-
* import {
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* sounds:
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* @RpgModule<RpgClient>({
|
|
300
|
-
* sounds: [ Sounds ]
|
|
300
|
+
* import { defineModule, RpgClient } from '@rpgjs/client'
|
|
301
|
+
*
|
|
302
|
+
* defineModule<RpgClient>({
|
|
303
|
+
* sounds: [
|
|
304
|
+
* {
|
|
305
|
+
* town: require('./assets/Town_Theme.ogg'),
|
|
306
|
+
* battle: require('./assets/Battle_Theme.ogg')
|
|
307
|
+
* }
|
|
308
|
+
* ]
|
|
301
309
|
* })
|
|
302
|
-
* class RpgClientEngine {}
|
|
303
310
|
* ```
|
|
304
311
|
*
|
|
305
|
-
* @prop {Array<
|
|
312
|
+
* @prop {Array<Object>} [sounds]
|
|
306
313
|
* @memberof RpgClient
|
|
307
314
|
* */
|
|
308
|
-
sounds?:
|
|
315
|
+
sounds?: any[];
|
|
309
316
|
/**
|
|
310
317
|
* Give the `RpgSprite` class. A Sprite represents a player or an event
|
|
311
318
|
*
|
|
312
319
|
* ```ts
|
|
313
|
-
* import { RpgSprite, RpgSpriteHooks, RpgClient,
|
|
320
|
+
* import { RpgSprite, RpgSpriteHooks, RpgClient, defineModule } from '@rpgjs/client'
|
|
314
321
|
*
|
|
315
322
|
* export const sprite: RpgSpriteHooks = {
|
|
316
323
|
* onInit(sprite: RpgSprite) {}
|
|
317
324
|
* }
|
|
318
325
|
*
|
|
319
|
-
*
|
|
326
|
+
* defineModule<RpgClient>({
|
|
320
327
|
* sprite
|
|
321
328
|
* })
|
|
322
|
-
* class RpgClientEngine {}
|
|
323
329
|
* ```
|
|
324
330
|
*
|
|
325
331
|
* @prop {RpgSpriteHooks} [sprite]
|
|
@@ -330,19 +336,18 @@ export interface RpgClient {
|
|
|
330
336
|
* Reference the scenes of the game. Here you can put your own class that inherits RpgSceneMap
|
|
331
337
|
*
|
|
332
338
|
* ```ts
|
|
333
|
-
* import { RpgSceneMapHooks, RpgClient,
|
|
339
|
+
* import { RpgSceneMapHooks, RpgClient, defineModule } from '@rpgjs/client'
|
|
334
340
|
*
|
|
335
341
|
* export const sceneMap: RpgSceneMapHooks = {
|
|
336
342
|
*
|
|
337
343
|
* }
|
|
338
344
|
*
|
|
339
|
-
*
|
|
345
|
+
* defineModule<RpgClient>({
|
|
340
346
|
* scenes: {
|
|
341
347
|
* // If you put the RpgSceneMap scene, Thhe key is called mandatory `map`
|
|
342
348
|
* map: sceneMap
|
|
343
349
|
* }
|
|
344
350
|
* })
|
|
345
|
-
* class RpgClientEngine {}
|
|
346
351
|
* ```
|
|
347
352
|
*
|
|
348
353
|
* @prop { [sceneName: string]: RpgSceneMapHooks } [scenes]
|
|
@@ -351,9 +356,35 @@ export interface RpgClient {
|
|
|
351
356
|
scenes?: {
|
|
352
357
|
map: RpgSceneMapHooks;
|
|
353
358
|
};
|
|
354
|
-
|
|
359
|
+
/**
|
|
360
|
+
* Array containing the list of component animations
|
|
361
|
+
* Each element defines a temporary component to display for animations like hits, effects, etc.
|
|
362
|
+
*
|
|
363
|
+
* ```ts
|
|
364
|
+
* import { defineModule, RpgClient } from '@rpgjs/client'
|
|
365
|
+
* import HitComponent from './hit.ce'
|
|
366
|
+
* import ExplosionComponent from './explosion.ce'
|
|
367
|
+
*
|
|
368
|
+
* defineModule<RpgClient>({
|
|
369
|
+
* componentAnimations: [
|
|
370
|
+
* {
|
|
371
|
+
* id: 'hit',
|
|
372
|
+
* component: HitComponent
|
|
373
|
+
* },
|
|
374
|
+
* {
|
|
375
|
+
* id: 'explosion',
|
|
376
|
+
* component: ExplosionComponent
|
|
377
|
+
* }
|
|
378
|
+
* ]
|
|
379
|
+
* })
|
|
380
|
+
* ```
|
|
381
|
+
*
|
|
382
|
+
* @prop {Array<{id: string, component: ComponentFunction}>} [componentAnimations]
|
|
383
|
+
* @memberof RpgClient
|
|
384
|
+
* */
|
|
385
|
+
componentAnimations?: {
|
|
355
386
|
id: string;
|
|
356
|
-
component:
|
|
387
|
+
component: ComponentFunction;
|
|
357
388
|
}[];
|
|
358
389
|
}
|
|
359
390
|
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Context } from '@signe/di';
|
|
2
|
-
import {
|
|
2
|
+
import { AbstractWebsocket } from './services/AbstractSocket';
|
|
3
|
+
import { AnimationManager } from './Game/AnimationManager';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import * as PIXI from "pixi.js";
|
|
3
6
|
export declare class RpgClientEngine<T = any> {
|
|
4
7
|
context: Context;
|
|
5
8
|
private guiService;
|
|
@@ -15,10 +18,15 @@ export declare class RpgClientEngine<T = any> {
|
|
|
15
18
|
height: import('canvasengine').WritableSignal<string>;
|
|
16
19
|
spritesheets: Map<string, any>;
|
|
17
20
|
sounds: Map<string, any>;
|
|
18
|
-
|
|
21
|
+
componentAnimations: any[];
|
|
19
22
|
particleSettings: {
|
|
20
23
|
emitters: any[];
|
|
21
24
|
};
|
|
25
|
+
renderer: PIXI.Renderer;
|
|
26
|
+
tick: Observable<number>;
|
|
27
|
+
playerIdSignal: import('canvasengine').WritableSignal<string | null>;
|
|
28
|
+
spriteComponentsBehind: import('canvasengine').WritableArraySignal<any[]>;
|
|
29
|
+
spriteComponentsInFront: import('canvasengine').WritableArraySignal<any[]>;
|
|
22
30
|
constructor(context: Context);
|
|
23
31
|
start(): Promise<void>;
|
|
24
32
|
private initListeners;
|
|
@@ -26,18 +34,92 @@ export declare class RpgClientEngine<T = any> {
|
|
|
26
34
|
addSpriteSheet<T = any>(spritesheetClass: any, id?: string): any;
|
|
27
35
|
addSound(sound: any, id?: string): any;
|
|
28
36
|
addParticle(particle: any): any;
|
|
29
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Add a component to render behind sprites
|
|
39
|
+
* Components added with this method will be displayed with a lower z-index than the sprite
|
|
40
|
+
*
|
|
41
|
+
* @param component - The component to add behind sprites
|
|
42
|
+
* @returns The added component
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* // Add a shadow component behind all sprites
|
|
47
|
+
* engine.addSpriteComponentBehind(ShadowComponent);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
addSpriteComponentBehind(component: any): any;
|
|
51
|
+
/**
|
|
52
|
+
* Add a component to render in front of sprites
|
|
53
|
+
* Components added with this method will be displayed with a higher z-index than the sprite
|
|
54
|
+
*
|
|
55
|
+
* @param component - The component to add in front of sprites
|
|
56
|
+
* @returns The added component
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* // Add a health bar component in front of all sprites
|
|
61
|
+
* engine.addSpriteComponentInFront(HealthBarComponent);
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
addSpriteComponentInFront(component: any): any;
|
|
65
|
+
/**
|
|
66
|
+
* Add a component animation to the engine
|
|
67
|
+
*
|
|
68
|
+
* Component animations are temporary visual effects that can be displayed
|
|
69
|
+
* on sprites or objects, such as hit indicators, spell effects, or status animations.
|
|
70
|
+
*
|
|
71
|
+
* @param componentAnimation - The component animation configuration
|
|
72
|
+
* @param componentAnimation.id - Unique identifier for the animation
|
|
73
|
+
* @param componentAnimation.component - The component function to render
|
|
74
|
+
* @returns The added component animation configuration
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* // Add a hit animation component
|
|
79
|
+
* engine.addComponentAnimation({
|
|
80
|
+
* id: 'hit',
|
|
81
|
+
* component: HitComponent
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* // Add an explosion effect component
|
|
85
|
+
* engine.addComponentAnimation({
|
|
86
|
+
* id: 'explosion',
|
|
87
|
+
* component: ExplosionComponent
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
addComponentAnimation(componentAnimation: {
|
|
30
92
|
component: any;
|
|
31
93
|
id: string;
|
|
32
94
|
}): {
|
|
33
95
|
component: any;
|
|
34
96
|
id: string;
|
|
35
97
|
};
|
|
36
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Get a component animation by its ID
|
|
100
|
+
*
|
|
101
|
+
* Retrieves the EffectManager instance for a specific component animation,
|
|
102
|
+
* which can be used to display the animation on sprites or objects.
|
|
103
|
+
*
|
|
104
|
+
* @param id - The unique identifier of the component animation
|
|
105
|
+
* @returns The EffectManager instance for the animation
|
|
106
|
+
* @throws Error if the component animation is not found
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* // Get the hit animation and display it
|
|
111
|
+
* const hitAnimation = engine.getComponentAnimation('hit');
|
|
112
|
+
* hitAnimation.displayEffect({ text: "Critical!" }, player);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
getComponentAnimation(id: string): AnimationManager;
|
|
37
116
|
processInput({ input }: {
|
|
38
117
|
input: number;
|
|
39
118
|
}): void;
|
|
40
119
|
processAction({ action }: {
|
|
41
120
|
action: number;
|
|
42
121
|
}): void;
|
|
122
|
+
get PIXI(): typeof PIXI;
|
|
123
|
+
get socket(): AbstractWebsocket;
|
|
124
|
+
get playerId(): string | null;
|
|
43
125
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export * from './services/loadMap';
|
|
|
8
8
|
export * from './module';
|
|
9
9
|
export * from './Gui/Gui';
|
|
10
10
|
export * from './components/gui';
|
|
11
|
-
export * from './components/
|
|
11
|
+
export * from './components/animations';
|
|
12
12
|
export * from './presets';
|
|
13
13
|
export * from './components';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,8 @@ export { LoadMapService, LoadMapToken, provideLoadMap } from './index7.js';
|
|
|
7
7
|
export { GlobalConfigToken, provideClientGlobalConfig, provideClientModules, provideGlobalConfig } from './index8.js';
|
|
8
8
|
export { RpgGui } from './index9.js';
|
|
9
9
|
export { PrebuiltGui } from './index10.js';
|
|
10
|
-
export {
|
|
10
|
+
export { PrebuiltComponentAnimations } from './index11.js';
|
|
11
11
|
export { Presets } from './index12.js';
|
|
12
12
|
export { default as EventLayerComponent } from './index13.js';
|
|
13
|
+
export { default as CharacterComponent } from './index14.js';
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/index10.js
CHANGED
package/dist/index11.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import component$1 from './
|
|
2
|
-
import component from './
|
|
1
|
+
import component$1 from './index24.js';
|
|
2
|
+
import component from './index25.js';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const PrebuiltComponentAnimations = {
|
|
5
5
|
Hit: component$1,
|
|
6
6
|
Animation: component
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { PrebuiltComponentAnimations };
|
|
10
10
|
//# sourceMappingURL=index11.js.map
|
package/dist/index11.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index11.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index11.js","sources":["../src/components/animations/index.ts"],"sourcesContent":["import Hit from \"./hit.ce\";\nimport Animation from \"./animation.ce\";\n\nexport const PrebuiltComponentAnimations = {\n Hit,\n Animation\n}"],"names":["Hit","Animation"],"mappings":";;;AAGO,MAAM,2BAA8B,GAAA;AAAA,OACvCA,WAAA;AAAA,aACAC;AACJ;;;;"}
|
package/dist/index12.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnimationSpritesheetPreset } from './index26.js';
|
|
2
|
+
import { LPCSpritesheetPreset } from './index27.js';
|
|
3
|
+
import { RMSpritesheet } from './index28.js';
|
|
2
4
|
|
|
3
5
|
const Presets = {
|
|
4
|
-
RMSpritesheet
|
|
6
|
+
RMSpritesheet,
|
|
7
|
+
LPCSpritesheetPreset,
|
|
8
|
+
AnimationSpritesheetPreset
|
|
5
9
|
};
|
|
6
10
|
|
|
7
11
|
export { Presets };
|
package/dist/index12.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index12.js","sources":["../src/presets/index.ts"],"sourcesContent":["import { RMSpritesheet } from \"./rmspritesheet\";\n\nexport const Presets = {\n RMSpritesheet\n}"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index12.js","sources":["../src/presets/index.ts"],"sourcesContent":["import { AnimationSpritesheetPreset } from \"./animation\";\nimport { LPCSpritesheetPreset } from \"./lpc\";\nimport { RMSpritesheet } from \"./rmspritesheet\";\n\nexport const Presets = {\n RMSpritesheet,\n LPCSpritesheetPreset,\n AnimationSpritesheetPreset\n}"],"names":[],"mappings":";;;;AAIO,MAAM,OAAU,GAAA;AAAA,EACnB,aAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACJ;;;;"}
|
package/dist/index13.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useProps, useDefineProps, h, Container, loop } from 'canvasengine';
|
|
2
2
|
import { inject } from './index6.js';
|
|
3
3
|
import { RpgClientEngine } from './index2.js';
|
|
4
|
-
import component$1 from './
|
|
4
|
+
import component$1 from './index14.js';
|
|
5
5
|
|
|
6
6
|
function component($$props) {
|
|
7
7
|
useProps($$props);
|
|
@@ -9,7 +9,7 @@ function component($$props) {
|
|
|
9
9
|
var engine = inject(RpgClientEngine);
|
|
10
10
|
var players = engine.sceneMap.players;
|
|
11
11
|
var events = engine.sceneMap.events;
|
|
12
|
-
let $this = h(Container, { sortableChildren: true }, [loop(events, (event, id) => h(component$1, { id: id, object: event
|
|
12
|
+
let $this = h(Container, { sortableChildren: true }, [loop(events, (event, id) => h(component$1, { id: id, object: event })), loop(players, (player, id) => h(component$1, { id: id, object: player }))]);
|
|
13
13
|
return $this
|
|
14
14
|
}
|
|
15
15
|
|
package/dist/index13.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index13.js","sources":["../src/components/scenes/event-layer.ce"],"sourcesContent":["<Container sortableChildren={true}>\n @for ((event,id) of events) {\n <Character id={id} object={event}
|
|
1
|
+
{"version":3,"file":"index13.js","sources":["../src/components/scenes/event-layer.ce"],"sourcesContent":["<Container sortableChildren={true}>\n @for ((event,id) of events) {\n <Character id={id} object={event} />\n }\n\n @for ((player,id) of players) {\n <Character id={id} object={player} />\n }\n</Container>\n\n<script>\n import { effect, signal } from 'canvasengine'\n import { inject } from \"../../core/inject\";\n import { RpgClientEngine } from \"../../RpgClientEngine\";\n import Character from \"../character.ce\";\n \n const engine = inject(RpgClientEngine);\n const players = engine.sceneMap.players\n const events = engine.sceneMap.events\n</script>"],"names":["Character"],"mappings":";;;;;AAQqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAA4B,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AAC5C,IAAI,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO;AACrC,IAAI,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC7B,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAACA,WAAS,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,CAACA,WAAS,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAC5M,QAAQ,OAAO;AACf;;;;"}
|