@rpgjs/client 4.2.2 → 5.0.0-alpha.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.
Files changed (321) hide show
  1. package/dist/Game/EffectManager.d.ts +5 -0
  2. package/dist/Game/Event.d.ts +4 -0
  3. package/dist/Game/Map.d.ts +7 -0
  4. package/dist/Game/Player.d.ts +4 -0
  5. package/dist/Gui/Gui.d.ts +23 -0
  6. package/{lib → dist}/RpgClient.d.ts +9 -6
  7. package/dist/RpgClientEngine.d.ts +43 -0
  8. package/dist/components/effects/index.d.ts +4 -0
  9. package/dist/components/gui/index.d.ts +3 -0
  10. package/dist/components/index.d.ts +2 -0
  11. package/dist/core/inject.d.ts +5 -0
  12. package/dist/core/setup.d.ts +6 -0
  13. package/dist/index.d.ts +13 -0
  14. package/dist/index.js +13 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/index10.js +8 -0
  17. package/dist/index10.js.map +1 -0
  18. package/dist/index11.js +10 -0
  19. package/dist/index11.js.map +1 -0
  20. package/dist/index12.js +8 -0
  21. package/dist/index12.js.map +1 -0
  22. package/dist/index13.js +17 -0
  23. package/dist/index13.js.map +1 -0
  24. package/dist/index14.js +50 -0
  25. package/dist/index14.js.map +1 -0
  26. package/dist/index15.js +191 -0
  27. package/dist/index15.js.map +1 -0
  28. package/dist/index16.js +9 -0
  29. package/dist/index16.js.map +1 -0
  30. package/dist/index17.js +387 -0
  31. package/dist/index17.js.map +1 -0
  32. package/dist/index18.js +31 -0
  33. package/dist/index18.js.map +1 -0
  34. package/dist/index19.js +24 -0
  35. package/dist/index19.js.map +1 -0
  36. package/dist/index2.js +112 -0
  37. package/dist/index2.js.map +1 -0
  38. package/dist/index20.js +2421 -0
  39. package/dist/index20.js.map +1 -0
  40. package/dist/index21.js +114 -0
  41. package/dist/index21.js.map +1 -0
  42. package/dist/index22.js +109 -0
  43. package/dist/index22.js.map +1 -0
  44. package/dist/index23.js +71 -0
  45. package/dist/index23.js.map +1 -0
  46. package/dist/index24.js +21 -0
  47. package/dist/index24.js.map +1 -0
  48. package/dist/index25.js +41 -0
  49. package/dist/index25.js.map +1 -0
  50. package/dist/index26.js +5 -0
  51. package/dist/index26.js.map +1 -0
  52. package/dist/index27.js +322 -0
  53. package/dist/index27.js.map +1 -0
  54. package/dist/index28.js +25 -0
  55. package/dist/index28.js.map +1 -0
  56. package/dist/index29.js +11 -0
  57. package/dist/index29.js.map +1 -0
  58. package/dist/index3.js +87 -0
  59. package/dist/index3.js.map +1 -0
  60. package/dist/index30.js +11 -0
  61. package/dist/index30.js.map +1 -0
  62. package/dist/index31.js +174 -0
  63. package/dist/index31.js.map +1 -0
  64. package/dist/index32.js +501 -0
  65. package/dist/index32.js.map +1 -0
  66. package/dist/index33.js +12 -0
  67. package/dist/index33.js.map +1 -0
  68. package/dist/index34.js +4403 -0
  69. package/dist/index34.js.map +1 -0
  70. package/dist/index35.js +91 -0
  71. package/dist/index35.js.map +1 -0
  72. package/dist/index36.js +61 -0
  73. package/dist/index36.js.map +1 -0
  74. package/dist/index37.js +20 -0
  75. package/dist/index37.js.map +1 -0
  76. package/dist/index38.js +20 -0
  77. package/dist/index38.js.map +1 -0
  78. package/dist/index4.js +54 -0
  79. package/dist/index4.js.map +1 -0
  80. package/dist/index5.js +15 -0
  81. package/dist/index5.js.map +1 -0
  82. package/dist/index6.js +17 -0
  83. package/dist/index6.js.map +1 -0
  84. package/dist/index7.js +31 -0
  85. package/dist/index7.js.map +1 -0
  86. package/dist/index8.js +90 -0
  87. package/dist/index8.js.map +1 -0
  88. package/dist/index9.js +76 -0
  89. package/dist/index9.js.map +1 -0
  90. package/dist/module.d.ts +14 -0
  91. package/dist/presets/index.d.ts +22 -0
  92. package/{lib/Presets/AnimationSpritesheet.d.ts → dist/presets/rmspritesheet.d.ts} +6 -2
  93. package/dist/services/AbstractSocket.d.ts +15 -0
  94. package/dist/services/loadMap.d.ts +14 -0
  95. package/dist/services/mmorpg.d.ts +32 -0
  96. package/dist/services/standalone.d.ts +34 -0
  97. package/package.json +25 -42
  98. package/src/Game/EffectManager.ts +20 -0
  99. package/src/Game/Event.ts +5 -0
  100. package/src/Game/Map.ts +10 -0
  101. package/src/Game/Object.ts +16 -0
  102. package/src/Game/Player.ts +5 -0
  103. package/src/Gui/Gui.ts +80 -534
  104. package/src/RpgClient.ts +9 -5
  105. package/src/RpgClientEngine.ts +135 -815
  106. package/src/components/character.ce +104 -0
  107. package/src/components/effects/animation.ce +19 -0
  108. package/src/components/effects/hit.ce +87 -0
  109. package/src/components/effects/index.ts +7 -0
  110. package/src/components/gui/dialogbox/index.ce +194 -0
  111. package/src/components/gui/dialogbox/itemMenu.ce +23 -0
  112. package/src/components/gui/dialogbox/selection.ce +67 -0
  113. package/src/components/gui/index.ts +5 -0
  114. package/src/components/index.ts +3 -0
  115. package/src/components/scenes/canvas.ce +51 -0
  116. package/src/components/scenes/draw-map.ce +56 -0
  117. package/src/components/scenes/element-map.ce +23 -0
  118. package/src/components/scenes/event-layer.ce +20 -0
  119. package/src/core/inject.ts +17 -0
  120. package/src/core/setup.ts +18 -0
  121. package/src/index.ts +13 -29
  122. package/src/module.ts +93 -0
  123. package/src/presets/index.ts +5 -0
  124. package/src/{Presets/AnimationSpritesheet.ts → presets/rmspritesheet.ts} +4 -5
  125. package/src/services/AbstractSocket.ts +14 -0
  126. package/src/services/loadMap.ts +33 -0
  127. package/src/services/mmorpg.ts +64 -0
  128. package/src/services/standalone.ts +101 -0
  129. package/src/types/canvas-engine.d.ts +26 -0
  130. package/tsconfig.json +8 -3
  131. package/vite.config.ts +34 -0
  132. package/CHANGELOG.md +0 -177
  133. package/LICENSE +0 -19
  134. package/browser/React-f6f9b1de.js +0 -157
  135. package/browser/index-e74a289f.js +0 -44225
  136. package/browser/manifest.json +0 -21
  137. package/browser/rpg.client.js +0 -40
  138. package/browser/rpg.client.umd.cjs +0 -44414
  139. package/lib/Components/AbstractComponent.d.ts +0 -32
  140. package/lib/Components/AbstractComponent.js +0 -93
  141. package/lib/Components/AbstractComponent.js.map +0 -1
  142. package/lib/Components/BarComponent.d.ts +0 -21
  143. package/lib/Components/BarComponent.js +0 -169
  144. package/lib/Components/BarComponent.js.map +0 -1
  145. package/lib/Components/Component.d.ts +0 -124
  146. package/lib/Components/Component.js +0 -425
  147. package/lib/Components/Component.js.map +0 -1
  148. package/lib/Components/DebugComponent.d.ts +0 -11
  149. package/lib/Components/DebugComponent.js +0 -32
  150. package/lib/Components/DebugComponent.js.map +0 -1
  151. package/lib/Components/ImageComponent.d.ts +0 -11
  152. package/lib/Components/ImageComponent.js +0 -30
  153. package/lib/Components/ImageComponent.js.map +0 -1
  154. package/lib/Components/ShapeComponent.d.ts +0 -11
  155. package/lib/Components/ShapeComponent.js +0 -57
  156. package/lib/Components/ShapeComponent.js.map +0 -1
  157. package/lib/Components/TextComponent.d.ts +0 -11
  158. package/lib/Components/TextComponent.js +0 -35
  159. package/lib/Components/TextComponent.js.map +0 -1
  160. package/lib/Components/TileComponent.d.ts +0 -10
  161. package/lib/Components/TileComponent.js +0 -40
  162. package/lib/Components/TileComponent.js.map +0 -1
  163. package/lib/Effects/Animation.d.ts +0 -55
  164. package/lib/Effects/Animation.js +0 -233
  165. package/lib/Effects/Animation.js.map +0 -1
  166. package/lib/Effects/AnimationCharacter.d.ts +0 -7
  167. package/lib/Effects/AnimationCharacter.js +0 -9
  168. package/lib/Effects/AnimationCharacter.js.map +0 -1
  169. package/lib/Effects/Spinner.d.ts +0 -7
  170. package/lib/Effects/Spinner.js +0 -18
  171. package/lib/Effects/Spinner.js.map +0 -1
  172. package/lib/Effects/Timeline.d.ts +0 -151
  173. package/lib/Effects/Timeline.js +0 -369
  174. package/lib/Effects/Timeline.js.map +0 -1
  175. package/lib/Effects/TransitionScene.d.ts +0 -18
  176. package/lib/Effects/TransitionScene.js +0 -50
  177. package/lib/Effects/TransitionScene.js.map +0 -1
  178. package/lib/GameEngine.d.ts +0 -68
  179. package/lib/GameEngine.js +0 -254
  180. package/lib/GameEngine.js.map +0 -1
  181. package/lib/Gui/Gui.d.ts +0 -110
  182. package/lib/Gui/Gui.js +0 -490
  183. package/lib/Gui/Gui.js.map +0 -1
  184. package/lib/Gui/React.d.ts +0 -15
  185. package/lib/Gui/React.js +0 -113
  186. package/lib/Gui/React.js.map +0 -1
  187. package/lib/Gui/Vue.d.ts +0 -13
  188. package/lib/Gui/Vue.js +0 -114
  189. package/lib/Gui/Vue.js.map +0 -1
  190. package/lib/Interfaces/Character.d.ts +0 -6
  191. package/lib/Interfaces/Character.js +0 -2
  192. package/lib/Interfaces/Character.js.map +0 -1
  193. package/lib/Interfaces/Scene.d.ts +0 -10
  194. package/lib/Interfaces/Scene.js +0 -2
  195. package/lib/Interfaces/Scene.js.map +0 -1
  196. package/lib/KeyboardControls.d.ts +0 -367
  197. package/lib/KeyboardControls.js +0 -714
  198. package/lib/KeyboardControls.js.map +0 -1
  199. package/lib/Logger.d.ts +0 -1
  200. package/lib/Logger.js +0 -4
  201. package/lib/Logger.js.map +0 -1
  202. package/lib/Presets/AnimationSpritesheet.js +0 -39
  203. package/lib/Presets/AnimationSpritesheet.js.map +0 -1
  204. package/lib/Presets/Scene.d.ts +0 -3
  205. package/lib/Presets/Scene.js +0 -5
  206. package/lib/Presets/Scene.js.map +0 -1
  207. package/lib/Renderer.d.ts +0 -62
  208. package/lib/Renderer.js +0 -300
  209. package/lib/Renderer.js.map +0 -1
  210. package/lib/Resources.d.ts +0 -22
  211. package/lib/Resources.js +0 -38
  212. package/lib/Resources.js.map +0 -1
  213. package/lib/RpgClient.js +0 -2
  214. package/lib/RpgClient.js.map +0 -1
  215. package/lib/RpgClientEngine.d.ts +0 -257
  216. package/lib/RpgClientEngine.js +0 -674
  217. package/lib/RpgClientEngine.js.map +0 -1
  218. package/lib/Scene/EventLayer.d.ts +0 -4
  219. package/lib/Scene/EventLayer.js +0 -8
  220. package/lib/Scene/EventLayer.js.map +0 -1
  221. package/lib/Scene/Map.d.ts +0 -109
  222. package/lib/Scene/Map.js +0 -319
  223. package/lib/Scene/Map.js.map +0 -1
  224. package/lib/Scene/Scene.d.ts +0 -184
  225. package/lib/Scene/Scene.js +0 -250
  226. package/lib/Scene/Scene.js.map +0 -1
  227. package/lib/Scene/SceneData.d.ts +0 -4
  228. package/lib/Scene/SceneData.js +0 -8
  229. package/lib/Scene/SceneData.js.map +0 -1
  230. package/lib/Sound/RpgSound.d.ts +0 -11
  231. package/lib/Sound/RpgSound.js +0 -46
  232. package/lib/Sound/RpgSound.js.map +0 -1
  233. package/lib/Sound/Sound.d.ts +0 -78
  234. package/lib/Sound/Sound.js +0 -12
  235. package/lib/Sound/Sound.js.map +0 -1
  236. package/lib/Sound/Sounds.d.ts +0 -2
  237. package/lib/Sound/Sounds.js +0 -6
  238. package/lib/Sound/Sounds.js.map +0 -1
  239. package/lib/Sprite/Character.d.ts +0 -18
  240. package/lib/Sprite/Character.js +0 -131
  241. package/lib/Sprite/Character.js.map +0 -1
  242. package/lib/Sprite/Player.d.ts +0 -3
  243. package/lib/Sprite/Player.js +0 -4
  244. package/lib/Sprite/Player.js.map +0 -1
  245. package/lib/Sprite/Spritesheet.d.ts +0 -365
  246. package/lib/Sprite/Spritesheet.js +0 -13
  247. package/lib/Sprite/Spritesheet.js.map +0 -1
  248. package/lib/Sprite/Spritesheets.d.ts +0 -3
  249. package/lib/Sprite/Spritesheets.js +0 -6
  250. package/lib/Sprite/Spritesheets.js.map +0 -1
  251. package/lib/Tilemap/CommonLayer.d.ts +0 -10
  252. package/lib/Tilemap/CommonLayer.js +0 -17
  253. package/lib/Tilemap/CommonLayer.js.map +0 -1
  254. package/lib/Tilemap/ImageLayer.d.ts +0 -4
  255. package/lib/Tilemap/ImageLayer.js +0 -16
  256. package/lib/Tilemap/ImageLayer.js.map +0 -1
  257. package/lib/Tilemap/Tile.d.ts +0 -21
  258. package/lib/Tilemap/Tile.js +0 -67
  259. package/lib/Tilemap/Tile.js.map +0 -1
  260. package/lib/Tilemap/TileLayer.d.ts +0 -13
  261. package/lib/Tilemap/TileLayer.js +0 -122
  262. package/lib/Tilemap/TileLayer.js.map +0 -1
  263. package/lib/Tilemap/TileSet.d.ts +0 -7
  264. package/lib/Tilemap/TileSet.js +0 -24
  265. package/lib/Tilemap/TileSet.js.map +0 -1
  266. package/lib/Tilemap/index.d.ts +0 -28
  267. package/lib/Tilemap/index.js +0 -151
  268. package/lib/Tilemap/index.js.map +0 -1
  269. package/lib/clientEntryPoint.d.ts +0 -89
  270. package/lib/clientEntryPoint.js +0 -48
  271. package/lib/clientEntryPoint.js.map +0 -1
  272. package/lib/index.d.ts +0 -26
  273. package/lib/index.js +0 -27
  274. package/lib/index.js.map +0 -1
  275. package/lib/inject.d.ts +0 -23
  276. package/lib/inject.js +0 -30
  277. package/lib/inject.js.map +0 -1
  278. package/rpg.toml +0 -14
  279. package/src/Components/AbstractComponent.ts +0 -120
  280. package/src/Components/BarComponent.ts +0 -181
  281. package/src/Components/Component.ts +0 -515
  282. package/src/Components/DebugComponent.ts +0 -36
  283. package/src/Components/ImageComponent.ts +0 -30
  284. package/src/Components/ShapeComponent.ts +0 -64
  285. package/src/Components/TextComponent.ts +0 -33
  286. package/src/Components/TileComponent.ts +0 -43
  287. package/src/Effects/Animation.ts +0 -310
  288. package/src/Effects/AnimationCharacter.ts +0 -7
  289. package/src/Effects/Spinner.ts +0 -19
  290. package/src/Effects/Timeline.ts +0 -378
  291. package/src/Effects/TransitionScene.ts +0 -59
  292. package/src/GameEngine.ts +0 -289
  293. package/src/Gui/React.ts +0 -145
  294. package/src/Gui/Vue.ts +0 -154
  295. package/src/Interfaces/Character.ts +0 -7
  296. package/src/Interfaces/Scene.ts +0 -9
  297. package/src/KeyboardControls.ts +0 -748
  298. package/src/Logger.ts +0 -3
  299. package/src/Presets/Scene.ts +0 -3
  300. package/src/Renderer.ts +0 -334
  301. package/src/Resources.ts +0 -39
  302. package/src/Scene/EventLayer.ts +0 -9
  303. package/src/Scene/Map.ts +0 -402
  304. package/src/Scene/Scene.ts +0 -305
  305. package/src/Scene/SceneData.ts +0 -13
  306. package/src/Sound/RpgSound.ts +0 -50
  307. package/src/Sound/Sound.ts +0 -91
  308. package/src/Sound/Sounds.ts +0 -7
  309. package/src/Sprite/Character.ts +0 -157
  310. package/src/Sprite/Player.ts +0 -3
  311. package/src/Sprite/Spritesheet.ts +0 -392
  312. package/src/Sprite/Spritesheets.ts +0 -8
  313. package/src/Tilemap/CommonLayer.ts +0 -20
  314. package/src/Tilemap/ImageLayer.ts +0 -20
  315. package/src/Tilemap/Tile.ts +0 -80
  316. package/src/Tilemap/TileLayer.ts +0 -142
  317. package/src/Tilemap/TileSet.ts +0 -40
  318. package/src/Tilemap/index.ts +0 -175
  319. package/src/clientEntryPoint.ts +0 -150
  320. package/src/inject.ts +0 -34
  321. package/src/types/howler.d.ts +0 -73
@@ -1,184 +0,0 @@
1
- import { InjectContext } from '@rpgjs/common';
2
- import RpgSprite from '../Sprite/Character.js';
3
- import { Animation } from '../Effects/Animation.js';
4
- import { Observable, Subject } from 'rxjs';
5
- import { GameEngineClient } from '../GameEngine.js';
6
- import { RpgComponent } from '../Components/Component.js';
7
- import { Controls } from '@rpgjs/types';
8
- import { Container } from 'pixi.js';
9
- export type SceneObservableData = {
10
- data: {
11
- [key: string]: any;
12
- };
13
- partial: {
14
- [key: string]: any;
15
- };
16
- };
17
- export interface SceneSpriteLogic {
18
- paramsChanged: {
19
- [key: string]: any;
20
- } | null;
21
- prevParamsChanged: object;
22
- }
23
- export declare abstract class Scene {
24
- protected context: InjectContext;
25
- protected objects: Map<string, RpgComponent>;
26
- protected animationLayer: Container;
27
- private controls;
28
- private animations;
29
- private _data;
30
- /**
31
- * @deprecated Use `inject(GameEngineClient)` instead. Will be removed in v5
32
- */
33
- game: GameEngineClient;
34
- /**
35
- * Listen to the movement of objects on stage
36
- *
37
- * @prop {Observable<{ [key: string]: object }>} [objectsMoving]
38
- * @readonly
39
- * @memberof RpgScene
40
- * @since v4.1.0
41
- *
42
- * In <module>/scene-map.ts
43
- *
44
- * ```ts
45
- * import { RpgSceneMap } from '@rpgjs/client'
46
- *
47
- * export default {
48
- * onAfterLoading(scene: RpgSceneMap) {
49
- * scene.objectsMoving.subscribe((objects) => {
50
- * console.log(objects)
51
- * })
52
- * }
53
- * }
54
- * ```
55
- */
56
- readonly objectsMoving: Subject<{
57
- [key: string]: any;
58
- }>;
59
- constructor(context: InjectContext);
60
- /**
61
- * Listen to all the synchronized values of the scene with the server
62
- *
63
- * ```ts
64
- * import { RpgClient, RpgModule, RpgSceneMap } from '@rpgjs/client'
65
- *
66
- * @RpgModule<RpgClient>({
67
- scenes: {
68
- map: {
69
- onAfterLoading(scene: RpgSceneMap) {
70
- scene.valuesChange.subscribe((obj) => {
71
- console.log(obj.data, obj.partial)
72
- })
73
- }
74
- }
75
- }
76
- })
77
- export default class RpgClientModuleEngine {}
78
- * ```
79
- *
80
- * - `data` represents all the current data of the scene (`users`, `events` and others)
81
- * - `partial` represents only the data that has changed on the scene
82
- *
83
- * > In the class, you can also use the onChanges hook
84
- *
85
- *
86
- * @prop {Observable<{ data: object, partial: object }>} [valuesChange]
87
- * @readonly
88
- * @memberof RpgScene
89
- */
90
- get valuesChange(): Observable<SceneObservableData>;
91
- private triggerSpriteChanges;
92
- abstract onUpdateObject(logic: SceneSpriteLogic, sprite: RpgComponent, moving: boolean): void;
93
- abstract addObject(obj: any, id: string): RpgComponent;
94
- abstract removeObject(id: string): any;
95
- /**
96
- * Display an animation on the scene
97
- *
98
- * The object is the following:
99
- * * `graphic`: Spritesheet id
100
- * * `animationName`: The name of the animation
101
- * * `attachTo`: Define a sprite. The animation will follow this sprite (optional)
102
- * * `x`: Position X (0 by default)
103
- * * `y`: Position Y (0 by default)
104
- * * `loop`: Display the animation in a loop (false by default)
105
- *
106
- * ```ts
107
- * import { RpgClient, RpgModule, RpgSceneMap } from '@rpgjs/client'
108
- *
109
-
110
- * @RpgModule<RpgClient>({
111
- scenes: {
112
- map: {
113
- onAfterLoading(scene: RpgSceneMap) {
114
- const animation = scene.showAnimation({
115
- graphic: 'my-spritesheet',
116
- animationName: 'my-anim'
117
- })
118
- }
119
- }
120
- }
121
- })
122
- export default class RpgClientModuleEngine {}
123
- * ```
124
- *
125
- * The return is an animation containing two methods:
126
- * * `play()`: Play the animation (Already the case when calling the method)
127
- * * `stop()`: Stop the animation
128
- *
129
- * They have a hook:
130
- *
131
- * `onFinish`: Triggered when the animation is finished
132
- *
133
- * ```ts
134
- * animation.onFinish = () => {
135
- * console.log('finish !')
136
- * }
137
- * ```
138
- *
139
- * @title Show Animation
140
- * @method scene.showAnimation(object)
141
- * @param {object} object
142
- * @returns {Animation}
143
- * @memberof RpgScene
144
- */
145
- showAnimation({ graphic, animationName, attachTo, x, y, loop, replaceGraphic }: {
146
- graphic: string;
147
- animationName: string;
148
- attachTo?: RpgComponent;
149
- x?: number;
150
- y?: number;
151
- loop?: boolean;
152
- replaceGraphic?: boolean;
153
- }): Animation | undefined;
154
- /**
155
- * Retrieve a sprite according to its identifier
156
- *
157
- * @title Get Sprite
158
- * @method scene.getSprite(id)
159
- * @param {string} id
160
- * @returns {RpgSprite | undefined}
161
- * @memberof RpgScene
162
- */
163
- getSprite(id: string): RpgComponent<any> | undefined;
164
- getPlayer(id: string): RpgComponent | undefined;
165
- /**
166
- * Retrieve a sprite that the player controls
167
- *
168
- * @title Get Current Player
169
- * @method scene.getCurrentPlayer()
170
- * @returns {RpgSprite | undefined}
171
- * @memberof RpgScene
172
- */
173
- getCurrentPlayer(): RpgSprite | RpgComponent | undefined;
174
- onInit(): void;
175
- onLoad(): void;
176
- onChanges(obj: any): void;
177
- onDraw(t: number): void;
178
- onAddSprite(sprite: RpgSprite): void;
179
- onRemoveSprite(sprite: RpgSprite): void;
180
- }
181
- export interface Scene {
182
- inputs: Controls;
183
- updateScene(obj: SceneObservableData): any;
184
- }
@@ -1,250 +0,0 @@
1
- import { RpgPlugin, HookClient, DefaultInput } from '@rpgjs/common';
2
- import { KeyboardControls } from '../KeyboardControls.js';
3
- import { Animation } from '../Effects/Animation.js';
4
- import { BehaviorSubject, Subject } from 'rxjs';
5
- import { GameEngineClient } from '../GameEngine.js';
6
- import { Container } from 'pixi.js';
7
- import { RpgGui } from '../Gui/Gui.js';
8
- export class Scene {
9
- constructor(context) {
10
- this.context = context;
11
- this.objects = new Map();
12
- this.animationLayer = new Container();
13
- this.controls = this.context.inject(KeyboardControls);
14
- this.animations = [];
15
- this._data = new BehaviorSubject({
16
- data: {},
17
- partial: {}
18
- });
19
- /**
20
- * @deprecated Use `inject(GameEngineClient)` instead. Will be removed in v5
21
- */
22
- this.game = this.context.inject(GameEngineClient);
23
- /**
24
- * Listen to the movement of objects on stage
25
- *
26
- * @prop {Observable<{ [key: string]: object }>} [objectsMoving]
27
- * @readonly
28
- * @memberof RpgScene
29
- * @since v4.1.0
30
- *
31
- * In <module>/scene-map.ts
32
- *
33
- * ```ts
34
- * import { RpgSceneMap } from '@rpgjs/client'
35
- *
36
- * export default {
37
- * onAfterLoading(scene: RpgSceneMap) {
38
- * scene.objectsMoving.subscribe((objects) => {
39
- * console.log(objects)
40
- * })
41
- * }
42
- * }
43
- * ```
44
- */
45
- this.objectsMoving = new Subject();
46
- const { globalConfig } = this.game.clientEngine;
47
- const mergeInputs = {
48
- ...DefaultInput,
49
- ...(globalConfig.inputs || {})
50
- };
51
- this.controls.setInputs(this.inputs || mergeInputs);
52
- RpgGui._setSceneReady(this);
53
- }
54
- /**
55
- * Listen to all the synchronized values of the scene with the server
56
- *
57
- * ```ts
58
- * import { RpgClient, RpgModule, RpgSceneMap } from '@rpgjs/client'
59
- *
60
- * @RpgModule<RpgClient>({
61
- scenes: {
62
- map: {
63
- onAfterLoading(scene: RpgSceneMap) {
64
- scene.valuesChange.subscribe((obj) => {
65
- console.log(obj.data, obj.partial)
66
- })
67
- }
68
- }
69
- }
70
- })
71
- export default class RpgClientModuleEngine {}
72
- * ```
73
- *
74
- * - `data` represents all the current data of the scene (`users`, `events` and others)
75
- * - `partial` represents only the data that has changed on the scene
76
- *
77
- * > In the class, you can also use the onChanges hook
78
- *
79
- *
80
- * @prop {Observable<{ data: object, partial: object }>} [valuesChange]
81
- * @readonly
82
- * @memberof RpgScene
83
- */
84
- get valuesChange() {
85
- return this._data.asObservable();
86
- }
87
- triggerSpriteChanges(logic, sprite, moving) {
88
- if (this.onUpdateObject)
89
- this.onUpdateObject(logic, sprite, moving);
90
- RpgPlugin.emit(HookClient.UpdateSprite, [sprite, logic], true);
91
- }
92
- /** @internal */
93
- update(obj) {
94
- if (!obj) {
95
- this.updateScene(this._data.value);
96
- return;
97
- }
98
- this.updateScene(obj);
99
- RpgPlugin.emit(HookClient.SceneOnChanges, [this, obj], true);
100
- this._data.next(obj);
101
- }
102
- /** @internal */
103
- draw(time, deltaTime, deltaRatio, frame) {
104
- const logicObjects = {
105
- ...this.game.world.getObjects(),
106
- ...this.game.events,
107
- ...this.game.getShapes()
108
- };
109
- const renderObjects = this.objects;
110
- const sizeLogic = Object.values(logicObjects).length;
111
- const objectMoving = {};
112
- for (let key in logicObjects) {
113
- const val = logicObjects[key].object;
114
- const valueChanged = logicObjects[key].paramsChanged;
115
- if (!renderObjects.has(key)) {
116
- const sprite = this.addObject(val, key);
117
- this.triggerSpriteChanges(val, sprite, true);
118
- }
119
- else {
120
- const object = renderObjects.get(key);
121
- if (!object?.update)
122
- return;
123
- const ret = object.update(val, valueChanged, time, deltaRatio);
124
- this.triggerSpriteChanges(val, object, ret.moving);
125
- if (ret.moving)
126
- objectMoving[val.id] = val;
127
- }
128
- }
129
- if (sizeLogic < renderObjects.size) {
130
- renderObjects.forEach((val, key) => {
131
- if (!logicObjects[key]) {
132
- this.removeObject(key);
133
- }
134
- });
135
- }
136
- for (let animation of this.animations) {
137
- animation.update(deltaRatio);
138
- }
139
- this.onDraw(time);
140
- if (Object.values(objectMoving).length) {
141
- this.objectsMoving.next(objectMoving);
142
- }
143
- RpgPlugin.emit(HookClient.SceneDraw, this);
144
- }
145
- /**
146
- * Display an animation on the scene
147
- *
148
- * The object is the following:
149
- * * `graphic`: Spritesheet id
150
- * * `animationName`: The name of the animation
151
- * * `attachTo`: Define a sprite. The animation will follow this sprite (optional)
152
- * * `x`: Position X (0 by default)
153
- * * `y`: Position Y (0 by default)
154
- * * `loop`: Display the animation in a loop (false by default)
155
- *
156
- * ```ts
157
- * import { RpgClient, RpgModule, RpgSceneMap } from '@rpgjs/client'
158
- *
159
-
160
- * @RpgModule<RpgClient>({
161
- scenes: {
162
- map: {
163
- onAfterLoading(scene: RpgSceneMap) {
164
- const animation = scene.showAnimation({
165
- graphic: 'my-spritesheet',
166
- animationName: 'my-anim'
167
- })
168
- }
169
- }
170
- }
171
- })
172
- export default class RpgClientModuleEngine {}
173
- * ```
174
- *
175
- * The return is an animation containing two methods:
176
- * * `play()`: Play the animation (Already the case when calling the method)
177
- * * `stop()`: Stop the animation
178
- *
179
- * They have a hook:
180
- *
181
- * `onFinish`: Triggered when the animation is finished
182
- *
183
- * ```ts
184
- * animation.onFinish = () => {
185
- * console.log('finish !')
186
- * }
187
- * ```
188
- *
189
- * @title Show Animation
190
- * @method scene.showAnimation(object)
191
- * @param {object} object
192
- * @returns {Animation}
193
- * @memberof RpgScene
194
- */
195
- showAnimation({ graphic, animationName, attachTo, x = 0, y = 0, loop = false, replaceGraphic = false }) {
196
- if (replaceGraphic && attachTo) {
197
- attachTo.showAnimation(graphic, animationName);
198
- return;
199
- }
200
- const animation = new Animation(graphic);
201
- this.animationLayer.addChild(animation);
202
- if (!loop) {
203
- animation.onFinish = () => {
204
- animation.stop();
205
- };
206
- }
207
- if (attachTo) {
208
- animation.attachTo = attachTo;
209
- }
210
- else {
211
- animation.x = x;
212
- animation.y = y;
213
- }
214
- animation.play(animationName);
215
- this.animations.push(animation);
216
- return animation;
217
- }
218
- /**
219
- * Retrieve a sprite according to its identifier
220
- *
221
- * @title Get Sprite
222
- * @method scene.getSprite(id)
223
- * @param {string} id
224
- * @returns {RpgSprite | undefined}
225
- * @memberof RpgScene
226
- */
227
- getSprite(id) { return this.getPlayer(id); }
228
- getPlayer(id) {
229
- return this.objects.get(id);
230
- }
231
- /**
232
- * Retrieve a sprite that the player controls
233
- *
234
- * @title Get Current Player
235
- * @method scene.getCurrentPlayer()
236
- * @returns {RpgSprite | undefined}
237
- * @memberof RpgScene
238
- */
239
- getCurrentPlayer() {
240
- return this.objects.get(this.game.playerId);
241
- }
242
- // Hooks
243
- onInit() { }
244
- onLoad() { }
245
- onChanges(obj) { }
246
- onDraw(t) { }
247
- onAddSprite(sprite) { }
248
- onRemoveSprite(sprite) { }
249
- }
250
- //# sourceMappingURL=Scene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Scene.js","sourceRoot":"","sources":["../../src/Scene/Scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAc,OAAO,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAkBnC,MAAM,OAAgB,KAAK;IA2CvB,YAAsB,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QA1ClC,YAAO,GAA8B,IAAI,GAAG,EAAE,CAAA;QAC9C,mBAAc,GAAc,IAAI,SAAS,EAAE,CAAA;QAE7C,aAAQ,GAAqB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;QAClE,eAAU,GAAgB,EAAE,CAAA;QAE5B,UAAK,GAAyC,IAAI,eAAe,CAAC;YACtE,IAAI,EAAE,EAAE;YACR,OAAO,E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G,GAAG,EAAE;gBACtB,SAAS,CAAC,IAAI,EAAE,CAAA;YACpB,CAAC,CAAA;SACJ;QACD,IAAI,QAAQ,EAAE;YACV,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAA;SAChC;aACI;YACD,SAAS,CAAC,CAAC,GAAG,CAAC,CAAA;YACf,SAAS,CAAC,CAAC,GAAG,CAAC,CAAA;SAClB;QACD,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAC7B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC/B,OAAO,SAAS,CAAA;IACpB,CAAC;IAEA;;;;;;;;MAQE;IACH,SAAS,CAAC,EAAU,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC;IACnD,SAAS,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC/B,CAAC;IAEA;;;;;;;MAOE;IACH,gBAAgB;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC/C,CAAC;IAED,QAAQ;IACR,MAAM,KAAI,CAAC;IACX,MAAM,KAAI,CAAC;IACX,SAAS,CAAC,GAAG,IAAG,CAAC;IACjB,MAAM,CAAC,CAAS,IAAG,CAAC;IACpB,WAAW,CAAC,MAAiB,IAAG,CAAC;IACjC,cAAc,CAAC,MAAiB,IAAG,CAAC;CACvC"}
@@ -1,4 +0,0 @@
1
- export interface SceneDataOptions {
2
- inputs?: {};
3
- }
4
- export declare function SceneData(options: any): (target: any) => void;
@@ -1,8 +0,0 @@
1
- export function SceneData(options) {
2
- return (target) => {
3
- for (let key in options) {
4
- target.prototype[key] = options[key];
5
- }
6
- };
7
- }
8
- //# sourceMappingURL=SceneData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SceneData.js","sourceRoot":"","sources":["../../src/Scene/SceneData.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,SAAS,CAAC,OAAO;IAC7B,OAAO,CAAC,MAAM,EAAE,EAAE;QACd,KAAK,IAAI,GAAG,IAAI,OAAO,EAAE;YACrB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;SACvC;IACL,CAAC,CAAA;AACL,CAAC"}
@@ -1,11 +0,0 @@
1
- import { Howl, Howler } from 'howler';
2
- declare class RpgSoundClass {
3
- private sounds;
4
- get(id: string): Howl;
5
- stop(id: string): void;
6
- play(id: string): boolean;
7
- clear(): void;
8
- get global(): typeof Howler;
9
- }
10
- export declare const RpgSound: RpgSoundClass;
11
- export {};
@@ -1,46 +0,0 @@
1
- import { Howl, Howler } from 'howler';
2
- import { log } from '../Logger.js';
3
- import { sounds } from './Sounds.js';
4
- class RpgSoundClass {
5
- constructor() {
6
- this.sounds = new Map();
7
- }
8
- get(id) {
9
- if (this.sounds.has(id)) {
10
- return this.sounds.get(id);
11
- }
12
- const resource = sounds.get(id);
13
- if (!resource) {
14
- throw log(`Impossible to find the ${id} sound. Did you put the right name or create the sound?`);
15
- }
16
- const howl = new Howl({
17
- src: [resource.sound],
18
- loop: resource.loop,
19
- autoplay: resource.autoplay,
20
- volume: resource.volume,
21
- sprite: resource.sprite
22
- });
23
- this.sounds.set(id, howl);
24
- return howl;
25
- }
26
- stop(id) {
27
- this.get(id).stop();
28
- }
29
- play(id) {
30
- const sound = this.get(id);
31
- if (!sound.playing()) {
32
- sound.play();
33
- return true;
34
- }
35
- return false;
36
- }
37
- clear() {
38
- this.sounds.clear();
39
- this.global.stop();
40
- }
41
- get global() {
42
- return Howler;
43
- }
44
- }
45
- export const RpgSound = new RpgSoundClass();
46
- //# sourceMappingURL=RpgSound.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RpgSound.js","sourceRoot":"","sources":["../../src/Sound/RpgSound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IA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,CAAA;IAChB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;IAED,IAAI,MAAM;QACN,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA"}
@@ -1,78 +0,0 @@
1
- interface SoundOptions {
2
- /**
3
- * The link to the sound
4
- *
5
- * > Do not use the `images` property
6
- * > Remember to wrap the link to the image with the `require` function.
7
- *
8
- * ```ts
9
- * sound: require('./assets/sound.ogg')
10
- * ```
11
- *
12
- * @prop {string} [sound]
13
- * @memberof Sound
14
- * */
15
- sound?: string;
16
- /**
17
- * The sound will restart at the beginning when it is finished.
18
- *
19
- * @prop {boolean} [loop]
20
- * @memberof Sound
21
- * */
22
- loop?: boolean;
23
- /**
24
- * Volume
25
- *
26
- * @prop {number} [volume]
27
- * @memberof Sound
28
- * */
29
- volume?: number;
30
- }
31
- type SoundIdOptions = SoundOptions & {
32
- /**
33
- * Sound identifier.
34
- *
35
- * > Do not use the `sounds` property
36
- *
37
- * @prop {string} [id]
38
- * @memberof Sound
39
- * */
40
- id: string;
41
- /**
42
- * The link to the sound
43
- *
44
- * > Do not use the `images` property
45
- * > Remember to wrap the link to the image with the `require` function.
46
- *
47
- * ```ts
48
- * sound: require('./assets/sound.ogg')
49
- * ```
50
- *
51
- * @prop {string} [sound]
52
- * @memberof Sound
53
- * */
54
- sound: string;
55
- };
56
- type SoundIdsOptions = SoundOptions & {
57
- /**
58
- * Put the different sounds that are concerned by the properties below.
59
- * The key of the object is the identifier of the sound and the value and the link to the sound.
60
- *
61
- * > Remember to wrap the link to the sound with the `require` function.
62
- *
63
- * ```ts
64
- * sounds: {
65
- * hero: require('./assets/sound.ogg')
66
- * }
67
- * ```
68
- *
69
- * @prop { { [id: string]: string } } [sounds]
70
- * @memberof Sound
71
- * */
72
- sounds?: {
73
- [id: string]: string;
74
- };
75
- };
76
- export declare function Sound(options: SoundIdOptions): any;
77
- export declare function Sound(options: SoundIdsOptions): any;
78
- export {};
@@ -1,12 +0,0 @@
1
- export function Sound(options) {
2
- return (target) => {
3
- if ('sounds' in options)
4
- target['sounds'] = options.sounds;
5
- if ('id' in options)
6
- target['id'] = options.id;
7
- for (let key in options) {
8
- target.prototype[key] = options[key];
9
- }
10
- };
11
- }
12
- //# sourceMappingURL=Sound.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sound.js","sourceRoot":"","sources":["../../src/Sound/Sound.ts"],"names":[],"mappings":"AAkFA,MAAM,UAAU,KAAK,CAAC,OAAyC;IAC3D,OAAO,CAAC,MAAgB,EAAE,EAAE;QACxB,IAAI,QAAQ,IAAI,OAAO;YAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,CAAA;QAC3D,IAAI,IAAI,IAAI,OAAO;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,EAAE,CAAA;QAC9C,KAAK,IAAI,GAAG,IAAI,OAAO,EAAE;YACrB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;SACvC;IACL,CAAC,CAAA;AACL,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const sounds: Map<any, any>;
2
- export declare function _initSound(_sounds: any, engine: any): void;
@@ -1,6 +0,0 @@
1
- import { _initResource } from '../Resources.js';
2
- export const sounds = new Map();
3
- export function _initSound(_sounds, engine) {
4
- return _initResource(sounds, _sounds, 'sound', engine);
5
- }
6
- //# sourceMappingURL=Sounds.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sounds.js","sourceRoot":"","sources":["../../src/Sound/Sounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAA;AAE/B,MAAM,UAAU,UAAU,CAAC,OAAO,EAAE,MAAM;IACtC,OAAO,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AAC1D,CAAC"}
@@ -1,18 +0,0 @@
1
- import { Animation } from '../Effects/Animation.js';
2
- import { RpgComponent } from '../Components/Component.js';
3
- import { Sprite } from 'pixi.js';
4
- export default class Character extends Sprite {
5
- private component;
6
- private graphic;
7
- static readonly id: string;
8
- private spritesheet;
9
- private playStandardAnimation;
10
- animation: Animation;
11
- private objSaved;
12
- private data;
13
- constructor(component: RpgComponent, graphic: string);
14
- getGraphicHeight(): number;
15
- getGraphicWidth(): number;
16
- animationSprite(): import("rxjs").Observable<Sprite | null>;
17
- private setAnimationAnchor;
18
- }