@vpmedia/phaser 1.14.0 → 1.16.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 (306) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -5
  3. package/src/index.js +15 -18
  4. package/src/phaser/core/animation.js +102 -6
  5. package/src/phaser/core/animation_manager.js +88 -10
  6. package/src/phaser/core/animation_parser.js +5 -20
  7. package/src/phaser/core/array_set.js +51 -5
  8. package/src/phaser/core/cache.js +291 -6
  9. package/src/phaser/core/const.js +107 -4
  10. package/src/phaser/core/device.js +5 -6
  11. package/src/phaser/core/device_util.js +3 -25
  12. package/src/phaser/core/dom.js +127 -29
  13. package/src/phaser/core/event_manager.js +128 -6
  14. package/src/phaser/core/factory.js +69 -34
  15. package/src/phaser/core/frame.js +43 -6
  16. package/src/phaser/core/frame_data.js +55 -5
  17. package/src/phaser/core/frame_util.js +7 -14
  18. package/src/phaser/core/game.js +35 -7
  19. package/src/phaser/core/input.js +116 -17
  20. package/src/phaser/core/input_handler.js +242 -42
  21. package/src/phaser/core/input_mouse.js +68 -7
  22. package/src/phaser/core/input_mspointer.js +40 -9
  23. package/src/phaser/core/input_pointer.js +79 -17
  24. package/src/phaser/core/input_touch.js +42 -5
  25. package/src/phaser/core/loader.js +274 -101
  26. package/src/phaser/core/loader_parser.js +2 -14
  27. package/src/phaser/core/raf.js +16 -5
  28. package/src/phaser/core/scale_manager.js +204 -39
  29. package/src/phaser/core/scene.js +24 -5
  30. package/src/phaser/core/scene_manager.js +81 -11
  31. package/src/phaser/core/signal.js +88 -11
  32. package/src/phaser/core/signal_binding.js +35 -15
  33. package/src/phaser/core/sound.js +99 -10
  34. package/src/phaser/core/sound_manager.js +89 -13
  35. package/src/phaser/core/sound_sprite.js +20 -5
  36. package/src/phaser/core/stage.js +43 -7
  37. package/src/phaser/core/time.js +67 -5
  38. package/src/phaser/core/timer.js +107 -30
  39. package/src/phaser/core/timer_event.js +11 -6
  40. package/src/phaser/core/tween.js +124 -30
  41. package/src/phaser/core/tween_data.js +42 -18
  42. package/src/phaser/core/tween_easing.js +1 -39
  43. package/src/phaser/core/tween_manager.js +47 -5
  44. package/src/phaser/core/world.js +9 -6
  45. package/src/phaser/display/bitmap_text.js +92 -11
  46. package/src/phaser/display/button.js +64 -13
  47. package/src/phaser/display/canvas/buffer.js +16 -6
  48. package/src/phaser/display/canvas/graphics.js +1 -16
  49. package/src/phaser/display/canvas/masker.js +0 -8
  50. package/src/phaser/display/canvas/pool.js +0 -14
  51. package/src/phaser/display/canvas/renderer.js +28 -8
  52. package/src/phaser/display/canvas/tinter.js +4 -48
  53. package/src/phaser/display/canvas/util.js +0 -15
  54. package/src/phaser/display/display_object.js +192 -20
  55. package/src/phaser/display/graphics.js +162 -27
  56. package/src/phaser/display/graphics_data.js +14 -6
  57. package/src/phaser/display/graphics_data_util.js +2 -9
  58. package/src/phaser/display/group.js +75 -10
  59. package/src/phaser/display/image.js +86 -10
  60. package/src/phaser/display/sprite_batch.js +3 -9
  61. package/src/phaser/display/sprite_util.js +3 -28
  62. package/src/phaser/display/text.js +332 -32
  63. package/src/phaser/display/webgl/abstract_filter.js +8 -7
  64. package/src/phaser/display/webgl/base_texture.js +20 -12
  65. package/src/phaser/display/webgl/blend_manager.js +14 -7
  66. package/src/phaser/display/webgl/earcut.js +4 -50
  67. package/src/phaser/display/webgl/earcut_node.js +6 -7
  68. package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
  69. package/src/phaser/display/webgl/filter_manager.js +25 -7
  70. package/src/phaser/display/webgl/filter_texture.js +21 -22
  71. package/src/phaser/display/webgl/graphics.js +5 -40
  72. package/src/phaser/display/webgl/graphics_data.js +10 -7
  73. package/src/phaser/display/webgl/mask_manager.js +0 -8
  74. package/src/phaser/display/webgl/render_texture.js +33 -21
  75. package/src/phaser/display/webgl/renderer.js +38 -11
  76. package/src/phaser/display/webgl/shader/complex.js +10 -6
  77. package/src/phaser/display/webgl/shader/fast.js +10 -6
  78. package/src/phaser/display/webgl/shader/normal.js +23 -32
  79. package/src/phaser/display/webgl/shader/primitive.js +10 -6
  80. package/src/phaser/display/webgl/shader/strip.js +10 -6
  81. package/src/phaser/display/webgl/shader_manager.js +18 -6
  82. package/src/phaser/display/webgl/sprite_batch.js +41 -8
  83. package/src/phaser/display/webgl/stencil_manager.js +28 -6
  84. package/src/phaser/display/webgl/texture.js +28 -15
  85. package/src/phaser/display/webgl/texture_util.js +0 -8
  86. package/src/phaser/display/webgl/util.js +0 -11
  87. package/src/phaser/geom/circle.js +123 -19
  88. package/src/phaser/geom/ellipse.js +39 -19
  89. package/src/phaser/geom/line.js +148 -17
  90. package/src/phaser/geom/matrix.js +73 -7
  91. package/src/phaser/geom/point.js +152 -7
  92. package/src/phaser/geom/polygon.js +42 -14
  93. package/src/phaser/geom/rectangle.js +233 -7
  94. package/src/phaser/geom/rounded_rectangle.js +10 -7
  95. package/src/phaser/geom/util/circle.js +3 -16
  96. package/src/phaser/geom/util/ellipse.js +0 -8
  97. package/src/phaser/geom/util/line.js +5 -19
  98. package/src/phaser/geom/util/matrix.js +1 -10
  99. package/src/phaser/geom/util/point.js +0 -26
  100. package/src/phaser/geom/util/polygon.js +1 -8
  101. package/src/phaser/geom/util/rectangle.js +1 -23
  102. package/src/phaser/geom/util/rounded_rectangle.js +1 -8
  103. package/src/phaser/util/math.js +3 -43
  104. package/{types → typedefs}/global.d.ts +1 -1
  105. package/types/index.d.ts +2 -1
  106. package/types/index.d.ts.map +1 -1
  107. package/types/phaser/core/animation.d.ts +106 -5
  108. package/types/phaser/core/animation.d.ts.map +1 -1
  109. package/types/phaser/core/animation_manager.d.ts +88 -1
  110. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  111. package/types/phaser/core/animation_parser.d.ts +5 -6
  112. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  113. package/types/phaser/core/array_set.d.ts +53 -7
  114. package/types/phaser/core/array_set.d.ts.map +1 -1
  115. package/types/phaser/core/cache.d.ts +348 -58
  116. package/types/phaser/core/cache.d.ts.map +1 -1
  117. package/types/phaser/core/const.d.ts +143 -40
  118. package/types/phaser/core/const.d.ts.map +1 -1
  119. package/types/phaser/core/device.d.ts +2 -5
  120. package/types/phaser/core/device.d.ts.map +1 -1
  121. package/types/phaser/core/device_util.d.ts +1 -10
  122. package/types/phaser/core/device_util.d.ts.map +1 -1
  123. package/types/phaser/core/dom.d.ts +122 -3
  124. package/types/phaser/core/dom.d.ts.map +1 -1
  125. package/types/phaser/core/event_manager.d.ts +142 -15
  126. package/types/phaser/core/event_manager.d.ts.map +1 -1
  127. package/types/phaser/core/factory.d.ts +74 -7
  128. package/types/phaser/core/factory.d.ts.map +1 -1
  129. package/types/phaser/core/frame.d.ts +68 -26
  130. package/types/phaser/core/frame.d.ts.map +1 -1
  131. package/types/phaser/core/frame_data.d.ts +61 -9
  132. package/types/phaser/core/frame_data.d.ts.map +1 -1
  133. package/types/phaser/core/frame_util.d.ts +10 -10
  134. package/types/phaser/core/frame_util.d.ts.map +1 -1
  135. package/types/phaser/core/game.d.ts +54 -20
  136. package/types/phaser/core/game.d.ts.map +1 -1
  137. package/types/phaser/core/input.d.ts +132 -21
  138. package/types/phaser/core/input.d.ts.map +1 -1
  139. package/types/phaser/core/input_handler.d.ts +258 -25
  140. package/types/phaser/core/input_handler.d.ts.map +1 -1
  141. package/types/phaser/core/input_mouse.d.ts +59 -12
  142. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  143. package/types/phaser/core/input_mspointer.d.ts +49 -15
  144. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  145. package/types/phaser/core/input_pointer.d.ts +80 -4
  146. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  147. package/types/phaser/core/input_touch.d.ts +52 -15
  148. package/types/phaser/core/input_touch.d.ts.map +1 -1
  149. package/types/phaser/core/loader.d.ts +268 -23
  150. package/types/phaser/core/loader.d.ts.map +1 -1
  151. package/types/phaser/core/loader_parser.d.ts +0 -4
  152. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  153. package/types/phaser/core/raf.d.ts +17 -7
  154. package/types/phaser/core/raf.d.ts.map +1 -1
  155. package/types/phaser/core/scale_manager.d.ts +210 -15
  156. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  157. package/types/phaser/core/scene.d.ts +21 -5
  158. package/types/phaser/core/scene.d.ts.map +1 -1
  159. package/types/phaser/core/scene_manager.d.ts +90 -10
  160. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  161. package/types/phaser/core/signal.d.ts +95 -11
  162. package/types/phaser/core/signal.d.ts.map +1 -1
  163. package/types/phaser/core/signal_binding.d.ts +35 -6
  164. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  165. package/types/phaser/core/sound.d.ts +111 -14
  166. package/types/phaser/core/sound.d.ts.map +1 -1
  167. package/types/phaser/core/sound_manager.d.ts +94 -8
  168. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  169. package/types/phaser/core/sound_sprite.d.ts +22 -8
  170. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  171. package/types/phaser/core/stage.d.ts +32 -3
  172. package/types/phaser/core/stage.d.ts.map +1 -1
  173. package/types/phaser/core/time.d.ts +73 -6
  174. package/types/phaser/core/time.d.ts.map +1 -1
  175. package/types/phaser/core/timer.d.ts +103 -2
  176. package/types/phaser/core/timer.d.ts.map +1 -1
  177. package/types/phaser/core/timer_event.d.ts +11 -5
  178. package/types/phaser/core/timer_event.d.ts.map +1 -1
  179. package/types/phaser/core/tween.d.ts +123 -3
  180. package/types/phaser/core/tween.d.ts.map +1 -1
  181. package/types/phaser/core/tween_data.d.ts +42 -3
  182. package/types/phaser/core/tween_data.d.ts.map +1 -1
  183. package/types/phaser/core/tween_easing.d.ts +0 -36
  184. package/types/phaser/core/tween_easing.d.ts.map +1 -1
  185. package/types/phaser/core/tween_manager.d.ts +49 -2
  186. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  187. package/types/phaser/core/world.d.ts +9 -1
  188. package/types/phaser/core/world.d.ts.map +1 -1
  189. package/types/phaser/display/bitmap_text.d.ts +89 -12
  190. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  191. package/types/phaser/display/button.d.ts +68 -11
  192. package/types/phaser/display/button.d.ts.map +1 -1
  193. package/types/phaser/display/canvas/buffer.d.ts +21 -5
  194. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  195. package/types/phaser/display/canvas/graphics.d.ts +0 -3
  196. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  197. package/types/phaser/display/canvas/masker.d.ts +0 -2
  198. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  199. package/types/phaser/display/canvas/pool.d.ts +0 -13
  200. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  201. package/types/phaser/display/canvas/renderer.d.ts +30 -3
  202. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  203. package/types/phaser/display/canvas/tinter.d.ts +0 -5
  204. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  205. package/types/phaser/display/canvas/util.d.ts +0 -9
  206. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  207. package/types/phaser/display/display_object.d.ts +196 -9
  208. package/types/phaser/display/display_object.d.ts.map +1 -1
  209. package/types/phaser/display/graphics.d.ts +142 -16
  210. package/types/phaser/display/graphics.d.ts.map +1 -1
  211. package/types/phaser/display/graphics_data.d.ts +15 -1
  212. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  213. package/types/phaser/display/graphics_data_util.d.ts +3 -3
  214. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  215. package/types/phaser/display/group.d.ts +68 -6
  216. package/types/phaser/display/group.d.ts.map +1 -1
  217. package/types/phaser/display/image.d.ts +77 -15
  218. package/types/phaser/display/image.d.ts.map +1 -1
  219. package/types/phaser/display/sprite_batch.d.ts +4 -4
  220. package/types/phaser/display/sprite_batch.d.ts.map +1 -1
  221. package/types/phaser/display/sprite_util.d.ts +0 -5
  222. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  223. package/types/phaser/display/text.d.ts +373 -53
  224. package/types/phaser/display/text.d.ts.map +1 -1
  225. package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
  226. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  227. package/types/phaser/display/webgl/base_texture.d.ts +20 -1
  228. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  229. package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
  230. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  231. package/types/phaser/display/webgl/earcut.d.ts +0 -27
  232. package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
  233. package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
  234. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  235. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
  236. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  237. package/types/phaser/display/webgl/filter_manager.d.ts +23 -7
  238. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  239. package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
  240. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  241. package/types/phaser/display/webgl/graphics.d.ts +0 -12
  242. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  243. package/types/phaser/display/webgl/graphics_data.d.ts +12 -8
  244. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  245. package/types/phaser/display/webgl/mask_manager.d.ts +0 -2
  246. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  247. package/types/phaser/display/webgl/render_texture.d.ts +31 -4
  248. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  249. package/types/phaser/display/webgl/renderer.d.ts +42 -5
  250. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  251. package/types/phaser/display/webgl/shader/complex.d.ts +12 -2
  252. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  253. package/types/phaser/display/webgl/shader/fast.d.ts +12 -2
  254. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  255. package/types/phaser/display/webgl/shader/normal.d.ts +21 -1
  256. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  257. package/types/phaser/display/webgl/shader/primitive.d.ts +12 -2
  258. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  259. package/types/phaser/display/webgl/shader/strip.d.ts +12 -2
  260. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  261. package/types/phaser/display/webgl/shader_manager.d.ts +20 -5
  262. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  263. package/types/phaser/display/webgl/sprite_batch.d.ts +38 -1
  264. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  265. package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
  266. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  267. package/types/phaser/display/webgl/texture.d.ts +22 -1
  268. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
  269. package/types/phaser/display/webgl/texture_util.d.ts +0 -2
  270. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  271. package/types/phaser/display/webgl/util.d.ts +0 -10
  272. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  273. package/types/phaser/geom/circle.d.ts +130 -10
  274. package/types/phaser/geom/circle.d.ts.map +1 -1
  275. package/types/phaser/geom/ellipse.d.ts +42 -6
  276. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  277. package/types/phaser/geom/line.d.ts +159 -14
  278. package/types/phaser/geom/line.d.ts.map +1 -1
  279. package/types/phaser/geom/matrix.d.ts +84 -12
  280. package/types/phaser/geom/matrix.d.ts.map +1 -1
  281. package/types/phaser/geom/point.d.ts +170 -19
  282. package/types/phaser/geom/point.d.ts.map +1 -1
  283. package/types/phaser/geom/polygon.d.ts +45 -5
  284. package/types/phaser/geom/polygon.d.ts.map +1 -1
  285. package/types/phaser/geom/rectangle.d.ts +253 -21
  286. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  287. package/types/phaser/geom/rounded_rectangle.d.ts +11 -2
  288. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  289. package/types/phaser/geom/util/circle.d.ts +3 -10
  290. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  291. package/types/phaser/geom/util/ellipse.d.ts +0 -7
  292. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  293. package/types/phaser/geom/util/line.d.ts +5 -10
  294. package/types/phaser/geom/util/line.d.ts.map +1 -1
  295. package/types/phaser/geom/util/matrix.d.ts +0 -3
  296. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  297. package/types/phaser/geom/util/point.d.ts +0 -20
  298. package/types/phaser/geom/util/point.d.ts.map +1 -1
  299. package/types/phaser/geom/util/polygon.d.ts +0 -1
  300. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  301. package/types/phaser/geom/util/rectangle.d.ts +0 -16
  302. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  303. package/types/phaser/geom/util/rounded_rectangle.d.ts +0 -1
  304. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  305. package/types/phaser/util/math.d.ts +0 -27
  306. package/types/phaser/util/math.d.ts.map +1 -1
@@ -1,15 +1,11 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
1
  import { Texture } from '../display/webgl/texture';
7
2
  import { BaseTexture } from '../display/webgl/base_texture';
8
- import { Signal } from './signal';
3
+ import { Signal } from './signal';
9
4
  import { Frame } from './frame';
10
5
  import { FrameData } from './frame_data';
11
6
  import { JSONDataHash } from './animation_parser';
12
7
  import { jsonBitmapFont, xmlBitmapFont } from './loader_parser';
8
+ import { Game } from './game';
13
9
 
14
10
  export const CANVAS = 0;
15
11
  export const IMAGE = 1;
@@ -23,6 +19,10 @@ export const XML = 8;
23
19
  export const RENDER_TEXTURE = 9;
24
20
 
25
21
  export class Cache {
22
+ /**
23
+ * TBD.
24
+ * @param {Game} game - TBD.
25
+ */
26
26
  constructor(game) {
27
27
  this.game = game;
28
28
  this.autoResolveURL = false;
@@ -57,6 +57,9 @@ export class Cache {
57
57
  this.addMissingImage();
58
58
  }
59
59
 
60
+ /**
61
+ * TBD.
62
+ */
60
63
  addDefaultImage() {
61
64
  const img = new Image();
62
65
  img.src =
@@ -66,6 +69,9 @@ export class Cache {
66
69
  window.PhaserRegistry.CACHE_DEFAULT_IMAGE = new Texture(obj.base);
67
70
  }
68
71
 
72
+ /**
73
+ * TBD.
74
+ */
69
75
  addMissingImage() {
70
76
  const img = new Image();
71
77
  img.src =
@@ -74,6 +80,12 @@ export class Cache {
74
80
  window.PhaserRegistry.CACHE_MISSING_IMAGE = new Texture(obj.base);
75
81
  }
76
82
 
83
+ /**
84
+ * TBD.
85
+ * @param {string} key - TBD.
86
+ * @param url
87
+ * @param data
88
+ */
77
89
  addImage(key, url, data) {
78
90
  if (this.checkImageKey(key)) {
79
91
  this.removeImage(key);
@@ -95,6 +107,13 @@ export class Cache {
95
107
  return img;
96
108
  }
97
109
 
110
+ /**
111
+ * TBD.
112
+ * @param {string} key - TBD.
113
+ * @param url
114
+ * @param data
115
+ * @param atlasData
116
+ */
98
117
  addTextureAtlas(key, url, data, atlasData) {
99
118
  const obj = {
100
119
  key,
@@ -107,6 +126,12 @@ export class Cache {
107
126
  this._resolveURL(url, obj);
108
127
  }
109
128
 
129
+ /**
130
+ * TBD.
131
+ * @param {string} key - TBD.
132
+ * @param url
133
+ * @param data
134
+ */
110
135
  addSound(key, url, data) {
111
136
  this._cache.sound[key] = {
112
137
  url,
@@ -118,11 +143,27 @@ export class Cache {
118
143
  this._resolveURL(url, this._cache.sound[key]);
119
144
  }
120
145
 
146
+ /**
147
+ * TBD.
148
+ * @param {string} key - TBD.
149
+ * @param url
150
+ * @param data
151
+ */
121
152
  addText(key, url, data) {
122
153
  this._cache.text[key] = { url, data };
123
154
  this._resolveURL(url, this._cache.text[key]);
124
155
  }
125
156
 
157
+ /**
158
+ * TBD.
159
+ * @param {string} key - TBD.
160
+ * @param url
161
+ * @param data
162
+ * @param atlasData
163
+ * @param atlasType
164
+ * @param xSpacing
165
+ * @param ySpacing
166
+ */
126
167
  addBitmapFont(key, url, data, atlasData, atlasType, xSpacing = 0, ySpacing = 0) {
127
168
  const obj = {
128
169
  url,
@@ -139,11 +180,23 @@ export class Cache {
139
180
  this._resolveURL(url, obj);
140
181
  }
141
182
 
183
+ /**
184
+ * TBD.
185
+ * @param {string} key - TBD.
186
+ * @param url
187
+ * @param data
188
+ */
142
189
  addJSON(key, url, data) {
143
190
  this._cache.json[key] = { url, data };
144
191
  this._resolveURL(url, this._cache.json[key]);
145
192
  }
146
193
 
194
+ /**
195
+ * TBD.
196
+ * @param {string} key - TBD.
197
+ * @param url
198
+ * @param data
199
+ */
147
200
  addXML(key, url, data) {
148
201
  this._cache.xml[key] = { url, data };
149
202
  this._resolveURL(url, this._cache.xml[key]);
@@ -151,6 +204,10 @@ export class Cache {
151
204
 
152
205
  // SOUND
153
206
 
207
+ /**
208
+ * TBD.
209
+ * @param {string} key - TBD.
210
+ */
154
211
  reloadSound(key) {
155
212
  const scope = this;
156
213
  const sound = this.getSound(key);
@@ -161,6 +218,10 @@ export class Cache {
161
218
  }
162
219
  }
163
220
 
221
+ /**
222
+ * TBD.
223
+ * @param {string} key - TBD.
224
+ */
164
225
  reloadSoundComplete(key) {
165
226
  const sound = this.getSound(key);
166
227
  if (sound) {
@@ -169,6 +230,12 @@ export class Cache {
169
230
  }
170
231
  }
171
232
 
233
+ /**
234
+ * TBD.
235
+ * @param {string} key - TBD.
236
+ * @param property
237
+ * @param value
238
+ */
172
239
  updateSound(key, property, value) {
173
240
  const sound = this.getSound(key);
174
241
  if (sound) {
@@ -176,6 +243,11 @@ export class Cache {
176
243
  }
177
244
  }
178
245
 
246
+ /**
247
+ * TBD.
248
+ * @param {string} key - TBD.
249
+ * @param data
250
+ */
179
251
  decodedSound(key, data) {
180
252
  const sound = this.getSound(key);
181
253
  sound.data = data;
@@ -183,6 +255,10 @@ export class Cache {
183
255
  sound.isDecoding = false;
184
256
  }
185
257
 
258
+ /**
259
+ * TBD.
260
+ * @param {string} key - TBD.
261
+ */
186
262
  isSoundDecoded(key) {
187
263
  const sound = this.getItem(key, SOUND, 'isSoundDecoded');
188
264
  if (sound) {
@@ -191,6 +267,10 @@ export class Cache {
191
267
  return null;
192
268
  }
193
269
 
270
+ /**
271
+ * TBD.
272
+ * @param {string} key - TBD.
273
+ */
194
274
  isSoundReady(key) {
195
275
  const sound = this.getItem(key, SOUND, 'isSoundDecoded');
196
276
  if (sound) {
@@ -201,6 +281,11 @@ export class Cache {
201
281
 
202
282
  // CHECK
203
283
 
284
+ /**
285
+ * TBD.
286
+ * @param cache
287
+ * @param {string} key - TBD.
288
+ */
204
289
  checkKey(cache, key) {
205
290
  if (this._cacheMap[cache][key]) {
206
291
  return true;
@@ -208,6 +293,10 @@ export class Cache {
208
293
  return false;
209
294
  }
210
295
 
296
+ /**
297
+ * TBD.
298
+ * @param url
299
+ */
211
300
  checkURL(url) {
212
301
  if (this._urlMap[this._resolveURL(url)]) {
213
302
  return true;
@@ -215,44 +304,87 @@ export class Cache {
215
304
  return false;
216
305
  }
217
306
 
307
+ /**
308
+ * TBD.
309
+ * @param {string} key - TBD.
310
+ */
218
311
  checkCanvasKey(key) {
219
312
  return this.checkKey(CANVAS, key);
220
313
  }
221
314
 
315
+ /**
316
+ * TBD.
317
+ * @param {string} key - TBD.
318
+ */
222
319
  checkImageKey(key) {
223
320
  return this.checkKey(IMAGE, key);
224
321
  }
225
322
 
323
+ /**
324
+ * TBD.
325
+ * @param {string} key - TBD.
326
+ */
226
327
  checkTextureKey(key) {
227
328
  return this.checkKey(TEXTURE, key);
228
329
  }
229
330
 
331
+ /**
332
+ * TBD.
333
+ * @param {string} key - TBD.
334
+ */
230
335
  checkSoundKey(key) {
231
336
  return this.checkKey(SOUND, key);
232
337
  }
233
338
 
339
+ /**
340
+ * TBD.
341
+ * @param {string} key - TBD.
342
+ */
234
343
  checkTextKey(key) {
235
344
  return this.checkKey(TEXT, key);
236
345
  }
237
346
 
347
+ /**
348
+ * TBD.
349
+ * @param {string} key - TBD.
350
+ */
238
351
  checkBitmapDataKey(key) {
239
352
  return this.checkKey(BITMAPDATA, key);
240
353
  }
241
354
 
355
+ /**
356
+ * TBD.
357
+ * @param {string} key - TBD.
358
+ */
242
359
  checkBitmapFontKey(key) {
243
360
  return this.checkKey(BITMAPFONT, key);
244
361
  }
245
362
 
363
+ /**
364
+ * TBD.
365
+ * @param {string} key - TBD.
366
+ */
246
367
  checkJSONKey(key) {
247
368
  return this.checkKey(JSON, key);
248
369
  }
249
370
 
371
+ /**
372
+ * TBD.
373
+ * @param {string} key - TBD.
374
+ */
250
375
  checkXMLKey(key) {
251
376
  return this.checkKey(XML, key);
252
377
  }
253
378
 
254
379
  // GET
255
380
 
381
+ /**
382
+ * TBD.
383
+ * @param {string} key - TBD.
384
+ * @param cache
385
+ * @param method
386
+ * @param property
387
+ */
256
388
  getItem(key, cache, method, property = null) {
257
389
  if (this.checkKey(cache, key)) {
258
390
  if (!property) {
@@ -263,10 +395,19 @@ export class Cache {
263
395
  return null;
264
396
  }
265
397
 
398
+ /**
399
+ * TBD.
400
+ * @param {string} key - TBD.
401
+ */
266
402
  getCanvas(key) {
267
403
  return this.getItem(key, CANVAS, 'getCanvas', 'canvas');
268
404
  }
269
405
 
406
+ /**
407
+ * TBD.
408
+ * @param {string} key - TBD.
409
+ * @param full
410
+ */
270
411
  getImage(key = '__default', full = false) {
271
412
  let img = this.getItem(key, IMAGE, 'getImage');
272
413
  if (img === null) {
@@ -278,53 +419,105 @@ export class Cache {
278
419
  return img.data;
279
420
  }
280
421
 
422
+ /**
423
+ * TBD.
424
+ * @param {string} key - TBD.
425
+ */
281
426
  getTextureFrame(key) {
282
427
  return this.getItem(key, TEXTURE, 'getTextureFrame', 'frame');
283
428
  }
284
429
 
430
+ /**
431
+ * TBD.
432
+ * @param {string} key - TBD.
433
+ */
285
434
  getSound(key) {
286
435
  return this.getItem(key, SOUND, 'getSound');
287
436
  }
288
437
 
438
+ /**
439
+ * TBD.
440
+ * @param {string} key - TBD.
441
+ */
289
442
  getSoundData(key) {
290
443
  return this.getItem(key, SOUND, 'getSoundData', 'data');
291
444
  }
292
445
 
446
+ /**
447
+ * TBD.
448
+ * @param {string} key - TBD.
449
+ */
293
450
  getText(key) {
294
451
  return this.getItem(key, TEXT, 'getText', 'data');
295
452
  }
296
453
 
454
+ /**
455
+ * TBD.
456
+ * @param {string} key - TBD.
457
+ */
297
458
  getBitmapData(key) {
298
459
  return this.getItem(key, BITMAPDATA, 'getBitmapData', 'data');
299
460
  }
300
461
 
462
+ /**
463
+ * TBD.
464
+ * @param {string} key - TBD.
465
+ */
301
466
  getBitmapFont(key) {
302
467
  return this.getItem(key, BITMAPFONT, 'getBitmapFont');
303
468
  }
304
469
 
470
+ /**
471
+ * TBD.
472
+ * @param {string} key - TBD.
473
+ * @param isClone
474
+ */
305
475
  getJSON(key, isClone = false) {
306
476
  const data = this.getItem(key, JSON, 'getJSON', 'data');
307
477
  return isClone ? JSON.parse(JSON.stringify(data)) : data;
308
478
  }
309
479
 
480
+ /**
481
+ * TBD.
482
+ * @param {string} key - TBD.
483
+ */
310
484
  getXML(key) {
311
485
  return this.getItem(key, XML, 'getXML', 'data');
312
486
  }
313
487
 
488
+ /**
489
+ * TBD.
490
+ * @param {string} key - TBD.
491
+ */
314
492
  getRenderTexture(key) {
315
493
  return this.getItem(key, RENDER_TEXTURE, 'getRenderTexture');
316
494
  }
317
495
 
318
496
  // FRAME
319
497
 
498
+ /**
499
+ * TBD.
500
+ * @param {string} key - TBD.
501
+ * @param cache
502
+ */
320
503
  getBaseTexture(key, cache = IMAGE) {
321
504
  return this.getItem(key, cache, 'getBaseTexture', 'base');
322
505
  }
323
506
 
507
+ /**
508
+ * TBD.
509
+ * @param {string} key - TBD.
510
+ * @param cache
511
+ */
324
512
  getFrame(key, cache = IMAGE) {
325
513
  return this.getItem(key, cache, 'getFrame', 'frame');
326
514
  }
327
515
 
516
+ /**
517
+ * TBD.
518
+ * @param {string} key - TBD.
519
+ * @param cache
520
+ */
328
521
  getFrameCount(key, cache = IMAGE) {
329
522
  const data = this.getFrameData(key, cache);
330
523
  if (data) {
@@ -333,20 +526,42 @@ export class Cache {
333
526
  return 0;
334
527
  }
335
528
 
529
+ /**
530
+ * TBD.
531
+ * @param {string} key - TBD.
532
+ * @param cache
533
+ */
336
534
  getFrameData(key, cache = IMAGE) {
337
535
  return this.getItem(key, cache, 'getFrameData', 'frameData');
338
536
  }
339
537
 
538
+ /**
539
+ * TBD.
540
+ * @param {string} key - TBD.
541
+ * @param cache
542
+ */
340
543
  hasFrameData(key, cache = IMAGE) {
341
544
  return this.getItem(key, cache, '', 'frameData') !== null;
342
545
  }
343
546
 
547
+ /**
548
+ * TBD.
549
+ * @param {string} key - TBD.
550
+ * @param frameData
551
+ * @param cache
552
+ */
344
553
  updateFrameData(key, frameData, cache = IMAGE) {
345
554
  if (this._cacheMap[cache][key]) {
346
555
  this._cacheMap[cache][key].frameData = frameData;
347
556
  }
348
557
  }
349
558
 
559
+ /**
560
+ * TBD.
561
+ * @param {string} key - TBD.
562
+ * @param index - TBD.
563
+ * @param cache
564
+ */
350
565
  getFrameByIndex(key, index, cache = IMAGE) {
351
566
  const data = this.getFrameData(key, cache);
352
567
  if (data) {
@@ -355,6 +570,12 @@ export class Cache {
355
570
  return null;
356
571
  }
357
572
 
573
+ /**
574
+ * TBD.
575
+ * @param {string} key - TBD.
576
+ * @param name
577
+ * @param cache
578
+ */
358
579
  getFrameByName(key, name, cache = IMAGE) {
359
580
  const data = this.getFrameData(key, cache);
360
581
  if (data) {
@@ -363,6 +584,10 @@ export class Cache {
363
584
  return null;
364
585
  }
365
586
 
587
+ /**
588
+ * TBD.
589
+ * @param url
590
+ */
366
591
  getURL(url) {
367
592
  const resolvedURL = this._resolveURL(url);
368
593
  if (resolvedURL) {
@@ -372,6 +597,10 @@ export class Cache {
372
597
  return null;
373
598
  }
374
599
 
600
+ /**
601
+ * TBD.
602
+ * @param cache
603
+ */
375
604
  getKeys(cache = IMAGE) {
376
605
  const result = [];
377
606
  if (this._cacheMap[cache]) {
@@ -388,10 +617,19 @@ export class Cache {
388
617
 
389
618
  // REMOVE
390
619
 
620
+ /**
621
+ * TBD.
622
+ * @param {string} key - TBD.
623
+ */
391
624
  removeCanvas(key) {
392
625
  delete this._cache.canvas[key];
393
626
  }
394
627
 
628
+ /**
629
+ * TBD.
630
+ * @param {string} key - TBD.
631
+ * @param destroyBaseTexture
632
+ */
395
633
  removeImage(key, destroyBaseTexture = true) {
396
634
  const img = this.getImage(key, true);
397
635
  if (destroyBaseTexture && img.base) {
@@ -400,42 +638,81 @@ export class Cache {
400
638
  delete this._cache.image[key];
401
639
  }
402
640
 
641
+ /**
642
+ * TBD.
643
+ * @param {string} key - TBD.
644
+ */
403
645
  removeSound(key) {
404
646
  delete this._cache.sound[key];
405
647
  }
406
648
 
649
+ /**
650
+ * TBD.
651
+ * @param {string} key - TBD.
652
+ */
407
653
  removeText(key) {
408
654
  delete this._cache.text[key];
409
655
  }
410
656
 
657
+ /**
658
+ * TBD.
659
+ * @param {string} key - TBD.
660
+ */
411
661
  removeBitmapData(key) {
412
662
  delete this._cache.bitmapData[key];
413
663
  }
414
664
 
665
+ /**
666
+ * TBD.
667
+ * @param {string} key - TBD.
668
+ */
415
669
  removeBitmapFont(key) {
416
670
  delete this._cache.bitmapFont[key];
417
671
  }
418
672
 
673
+ /**
674
+ * TBD.
675
+ * @param {string} key - TBD.
676
+ */
419
677
  removeJSON(key) {
420
678
  delete this._cache.json[key];
421
679
  }
422
680
 
681
+ /**
682
+ * TBD.
683
+ * @param {string} key - TBD.
684
+ */
423
685
  removeXML(key) {
424
686
  delete this._cache.xml[key];
425
687
  }
426
688
 
689
+ /**
690
+ * TBD.
691
+ * @param {string} key - TBD.
692
+ */
427
693
  removeRenderTexture(key) {
428
694
  delete this._cache.renderTexture[key];
429
695
  }
430
696
 
697
+ /**
698
+ * TBD.
699
+ * @param {string} key - TBD.
700
+ */
431
701
  removeSpriteSheet(key) {
432
702
  delete this._cache.spriteSheet[key];
433
703
  }
434
704
 
705
+ /**
706
+ * TBD.
707
+ * @param {string} key - TBD.
708
+ */
435
709
  removeTextureAtlas(key) {
436
710
  delete this._cache.atlas[key];
437
711
  }
438
712
 
713
+ /**
714
+ * TBD.
715
+ */
439
716
  clearGLTextures() {
440
717
  const keys = Object.keys(this._cache.image);
441
718
  for (let i = 0; i < keys.length; i += 1) {
@@ -444,6 +721,11 @@ export class Cache {
444
721
  }
445
722
  }
446
723
 
724
+ /**
725
+ * TBD.
726
+ * @param url
727
+ * @param data
728
+ */
447
729
  _resolveURL(url, data) {
448
730
  if (!this.autoResolveURL) {
449
731
  return null;
@@ -459,6 +741,9 @@ export class Cache {
459
741
  return this._urlTemp;
460
742
  }
461
743
 
744
+ /**
745
+ * TBD.
746
+ */
462
747
  destroy() {
463
748
  for (let i = 0; i < this._cacheMap.length; i += 1) {
464
749
  const cache = this._cacheMap[i];