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