@vpmedia/phaser 1.0.36 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -8,15 +8,11 @@ import Rectangle from '../geom/rectangle';
8
8
  import { canPlayAudio } from './device_util';
9
9
  import { TEXTURE_ATLAS_JSON_HASH } from './const';
10
10
 
11
- export const TILED_JSON = 6;
12
- export const TILEMAP_CSV = 7;
13
-
14
11
  export default class {
15
12
 
16
13
  constructor(game) {
17
14
  this.game = game;
18
15
  this.cache = game.cache;
19
- this.resetLocked = false;
20
16
  this.isLoading = false;
21
17
  this.hasLoaded = false;
22
18
  this.preloadSprite = null;
@@ -100,9 +96,6 @@ export default class {
100
96
  }
101
97
 
102
98
  reset(hard, clearEvents = false) {
103
- if (this.resetLocked) {
104
- return;
105
- }
106
99
  if (hard) {
107
100
  this.preloadSprite = null;
108
101
  }
@@ -232,22 +225,10 @@ export default class {
232
225
  return this.addToFileList('json', key, url, undefined, overwrite, '.json');
233
226
  }
234
227
 
235
- shader(key, url, overwrite) {
236
- return this.addToFileList('shader', key, url, undefined, overwrite, '.frag');
237
- }
238
-
239
228
  xml(key, url, overwrite) {
240
229
  return this.addToFileList('xml', key, url, undefined, overwrite, '.xml');
241
230
  }
242
231
 
243
- script(key, url, callback = false, callbackContext = this) {
244
- return this.addToFileList('script', key, url, { syncPoint: true, callback, callbackContext }, false, '.js');
245
- }
246
-
247
- binary(key, url, callback = false, callbackContext = this) {
248
- return this.addToFileList('binary', key, url, { callback, callbackContext }, false, '.bin');
249
- }
250
-
251
232
  spritesheet(key, url, frameWidth, frameHeight, frameMax = -1, margin = 0, spacing = 0) {
252
233
  return this.addToFileList('spritesheet', key, url, { frameWidth, frameHeight, frameMax, margin, spacing }, false, '.png');
253
234
  }
@@ -278,12 +259,6 @@ export default class {
278
259
  return this;
279
260
  }
280
261
 
281
- tilemap() {
282
- // TODO
283
- console.warn('loader.tilemap() is not implemented');
284
- return this;
285
- }
286
-
287
262
  bitmapFont(key, textureURL = null, atlasURL = null, atlasData = null, xSpacing = 0, ySpacing = 0) {
288
263
  if (textureURL === undefined || textureURL === null) {
289
264
  textureURL = key + '.png';
@@ -509,12 +484,6 @@ export default class {
509
484
  case "xml":
510
485
  this.xml(file.key, file.url, file.overwrite);
511
486
  break;
512
- case "script":
513
- this.script(file.key, file.url, file.callback, pack.callbackContext || this);
514
- break;
515
- case "binary":
516
- this.binary(file.key, file.url, file.callback, pack.callbackContext || this);
517
- break;
518
487
  case "spritesheet":
519
488
  this.spritesheet(file.key, file.url, file.frameWidth, file.frameHeight, file.frameMax, file.margin, file.spacing);
520
489
  break;
@@ -527,23 +496,12 @@ export default class {
527
496
  case "audioSprite":
528
497
  this.audioSprite(file.key, file.audioURL, file.jsonURL, file.jsonData);
529
498
  break;
530
- case "tilemap":
531
- // TODO
532
- // this.tilemap(file.key, file.url, file.data, Phaser.Tilemap[file.format]);
533
- break;
534
- case "physics":
535
- // TODO
536
- // this.physics(file.key, file.url, file.data, Phaser.Loader[file.format]);
537
- break;
538
499
  case "bitmapFont":
539
500
  this.bitmapFont(file.key, file.textureURL, file.atlasURL, file.atlasData, file.xSpacing, file.ySpacing);
540
501
  break;
541
502
  case "atlas":
542
503
  this.atlas(file.key, file.textureURL, file.atlasURL, file.atlasData, TEXTURE_ATLAS_JSON_HASH);
543
504
  break;
544
- case "shader":
545
- this.shader(file.key, file.url, file.overwrite);
546
- break;
547
505
  }
548
506
  }
549
507
  }
@@ -583,24 +541,9 @@ export default class {
583
541
  case 'xml':
584
542
  this.xhrLoad(file, this.transformUrl(file.url, file), 'text', this.xmlLoadComplete);
585
543
  break;
586
- case 'tilemap':
587
- if (file.format === TILED_JSON) {
588
- this.xhrLoad(file, this.transformUrl(file.url, file), 'text', this.jsonLoadComplete);
589
- } else if (file.format === TILEMAP_CSV) {
590
- this.xhrLoad(file, this.transformUrl(file.url, file), 'text', this.csvLoadComplete);
591
- } else {
592
- this.asyncComplete(file, 'invalid Tilemap format: ' + file.format);
593
- }
594
- break;
595
544
  case 'text':
596
- case 'script':
597
- case 'shader':
598
- case 'physics':
599
545
  this.xhrLoad(file, this.transformUrl(file.url, file), 'text', this.fileComplete);
600
546
  break;
601
- case 'binary':
602
- this.xhrLoad(file, this.transformUrl(file.url, file), 'arraybuffer', this.fileComplete);
603
- break;
604
547
  default:
605
548
  // pass
606
549
  break;
@@ -788,32 +731,6 @@ export default class {
788
731
  file.data = xhr.responseText;
789
732
  this.cache.addText(file.key, file.url, file.data);
790
733
  break;
791
- case 'shader':
792
- file.data = xhr.responseText;
793
- this.cache.addShader(file.key, file.url, file.data);
794
- break;
795
- case 'physics':
796
- this.cache.addPhysicsData(file.key, file.url, JSON.parse(xhr.responseText), file.format);
797
- break;
798
- case 'script':
799
- file.data = document.createElement('script');
800
- file.data.language = 'javascript';
801
- file.data.type = 'text/javascript';
802
- file.data.defer = false;
803
- file.data.text = xhr.responseText;
804
- document.head.appendChild(file.data);
805
- if (file.callback) {
806
- file.data = file.callback.call(file.callbackContext, file.key, xhr.responseText);
807
- }
808
- break;
809
- case 'binary':
810
- if (file.callback) {
811
- file.data = file.callback.call(file.callbackContext, file.key, xhr.response);
812
- } else {
813
- file.data = xhr.response;
814
- }
815
- this.cache.addBinary(file.key, file.data);
816
- break;
817
734
  default:
818
735
  // pass
819
736
  break;
@@ -825,9 +742,7 @@ export default class {
825
742
 
826
743
  jsonLoadComplete(file, xhr) {
827
744
  const data = JSON.parse(xhr.responseText);
828
- if (file.type === 'tilemap') {
829
- this.cache.addTilemap(file.key, file.url, data, file.format);
830
- } else if (file.type === 'bitmapfont') {
745
+ if (file.type === 'bitmapfont') {
831
746
  this.cache.addBitmapFont(file.key, file.url, file.data, data, file.atlasType, file.xSpacing, file.ySpacing);
832
747
  } else if (file.type === 'json') {
833
748
  this.cache.addJSON(file.key, file.url, data);