@vpmedia/phaser 1.0.24 → 1.0.26
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/README.md +1 -1
- package/dist/phaser.cjs +1 -1
- package/dist/phaser.cjs.LICENSE.txt +1 -1
- package/dist/phaser.cjs.map +1 -1
- package/dist/phaser.js +1 -1
- package/dist/phaser.js.LICENSE.txt +1 -1
- package/dist/phaser.js.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/loader.js +0 -8
- package/src/phaser/core/sound.js +0 -8
- package/src/phaser/core/sound_manager.js +12 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
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",
|
|
@@ -696,14 +696,6 @@ export default class {
|
|
|
696
696
|
}
|
|
697
697
|
};
|
|
698
698
|
file.data.src = this.transformUrl(file.url, file);
|
|
699
|
-
// Image is immediately-available/cached
|
|
700
|
-
// Special Firefox magic, exclude from cached reload
|
|
701
|
-
// More info here: https://github.com/photonstorm/phaser/issues/2534
|
|
702
|
-
if (!this.game.device.firefox && file.data.complete && file.data.width && file.data.height) {
|
|
703
|
-
file.data.onload = null;
|
|
704
|
-
file.data.onerror = null;
|
|
705
|
-
this.fileComplete(file);
|
|
706
|
-
}
|
|
707
699
|
}
|
|
708
700
|
|
|
709
701
|
loadVideoTag() {
|
package/src/phaser/core/sound.js
CHANGED
|
@@ -53,7 +53,6 @@ export default class {
|
|
|
53
53
|
this.gainNode.connect(this.masterGainNode);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
this.onDecoded = new Signal();
|
|
57
56
|
this.onPlay = new Signal();
|
|
58
57
|
this.onPause = new Signal();
|
|
59
58
|
this.onResume = new Signal();
|
|
@@ -72,7 +71,6 @@ export default class {
|
|
|
72
71
|
this._muteVolume = 0;
|
|
73
72
|
this._tempLoop = 0;
|
|
74
73
|
this._paused = false;
|
|
75
|
-
this._onDecodedEventDispatched = false;
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
soundHasUnlocked(key) {
|
|
@@ -116,7 +114,6 @@ export default class {
|
|
|
116
114
|
this.context = null;
|
|
117
115
|
this._buffer = null;
|
|
118
116
|
this.externalNode = null;
|
|
119
|
-
this.onDecoded.dispose();
|
|
120
117
|
this.onPlay.dispose();
|
|
121
118
|
this.onPause.dispose();
|
|
122
119
|
this.onResume.dispose();
|
|
@@ -133,10 +130,6 @@ export default class {
|
|
|
133
130
|
this.destroy();
|
|
134
131
|
return;
|
|
135
132
|
}
|
|
136
|
-
if (this.isDecoded && !this._onDecodedEventDispatched) {
|
|
137
|
-
this.onDecoded.dispatch(this);
|
|
138
|
-
this._onDecodedEventDispatched = true;
|
|
139
|
-
}
|
|
140
133
|
if (this.pendingPlayback && this.game.cache.isSoundReady(this.key)) {
|
|
141
134
|
this.pendingPlayback = false;
|
|
142
135
|
this.play(this._tempMarker, this._tempPosition, this._tempVolume, this._tempLoop);
|
|
@@ -435,7 +428,6 @@ export default class {
|
|
|
435
428
|
this.context = null;
|
|
436
429
|
this._buffer = null;
|
|
437
430
|
this.externalNode = null;
|
|
438
|
-
this.onDecoded.dispose();
|
|
439
431
|
this.onPlay.dispose();
|
|
440
432
|
this.onPause.dispose();
|
|
441
433
|
this.onResume.dispose();
|
|
@@ -11,11 +11,7 @@ export default class {
|
|
|
11
11
|
|
|
12
12
|
constructor(game) {
|
|
13
13
|
this.game = game;
|
|
14
|
-
this.
|
|
15
|
-
this.onVolumeChange = new Signal();
|
|
16
|
-
this.onLockChange = new Signal();
|
|
17
|
-
this.onMute = new Signal();
|
|
18
|
-
this.onUnMute = new Signal();
|
|
14
|
+
this.onChange = new Signal();
|
|
19
15
|
this.context = null;
|
|
20
16
|
this.baseLatency = 0; // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/baseLatency
|
|
21
17
|
this.noAudio = false;
|
|
@@ -78,7 +74,7 @@ export default class {
|
|
|
78
74
|
this.addUnlockHandlers();
|
|
79
75
|
}
|
|
80
76
|
this.context.addEventListener('statechange', () => {
|
|
81
|
-
this.
|
|
77
|
+
this.onChange.dispatch('onContextStateChange', { state: this.context.state, isLocked: this.isLocked });
|
|
82
78
|
if (!this.isLocked && (this.context.state === 'suspended' || this.context.state === 'interrupted')) {
|
|
83
79
|
this.addUnlockHandlers();
|
|
84
80
|
} else if (this.isLocked && this.context.state === 'running') {
|
|
@@ -89,7 +85,7 @@ export default class {
|
|
|
89
85
|
|
|
90
86
|
addUnlockHandlers() {
|
|
91
87
|
this.isLocked = true;
|
|
92
|
-
this.
|
|
88
|
+
this.onChange.dispatch('addUnlockHandlers', { state: this.context.state, isLocked: this.isLocked });
|
|
93
89
|
document.body.addEventListener('touchstart', this.onUnlockEventBinded, false);
|
|
94
90
|
document.body.addEventListener('touchend', this.onUnlockEventBinded, false);
|
|
95
91
|
document.body.addEventListener('click', this.onUnlockEventBinded, false);
|
|
@@ -98,7 +94,7 @@ export default class {
|
|
|
98
94
|
|
|
99
95
|
removeUnlockHandlers() {
|
|
100
96
|
this.isLocked = false;
|
|
101
|
-
this.
|
|
97
|
+
this.onChange.dispatch('removeUnlockHandlers', { state: this.context.state, isLocked: this.isLocked });
|
|
102
98
|
document.body.removeEventListener('touchstart', this.onUnlockEventBinded);
|
|
103
99
|
document.body.removeEventListener('touchend', this.onUnlockEventBinded);
|
|
104
100
|
document.body.removeEventListener('click', this.onUnlockEventBinded);
|
|
@@ -108,16 +104,16 @@ export default class {
|
|
|
108
104
|
onUnlockEvent(event) {
|
|
109
105
|
const initialState = this.context.state;
|
|
110
106
|
if (initialState !== 'suspended' && initialState !== 'interrupted') {
|
|
111
|
-
this.
|
|
107
|
+
this.onChange.dispatch('onUnlockResumeDenied', { state: initialState, isLocked: this.isLocked, event });
|
|
112
108
|
this.removeUnlockHandlers();
|
|
113
109
|
return;
|
|
114
110
|
}
|
|
115
|
-
this.
|
|
111
|
+
this.onChange.dispatch('onContextResumeStart', { state: initialState, isLocked: this.isLocked, event });
|
|
116
112
|
this.context.resume().then(() => {
|
|
117
|
-
this.
|
|
113
|
+
this.onChange.dispatch('onContextResumeResult', { initialState, state: this.context.state, isLocked: this.isLocked });
|
|
118
114
|
this.removeUnlockHandlers();
|
|
119
115
|
}).catch((e) => {
|
|
120
|
-
this.
|
|
116
|
+
this.onChange.dispatch('onContextResumeReject', { initialState, state: this.context.state, isLocked: this.isLocked, error: e });
|
|
121
117
|
this.removeUnlockHandlers();
|
|
122
118
|
this.game.exceptionHandler(e, { initialState, state: this.context.state });
|
|
123
119
|
});
|
|
@@ -156,7 +152,7 @@ export default class {
|
|
|
156
152
|
}
|
|
157
153
|
}
|
|
158
154
|
|
|
159
|
-
decode(key
|
|
155
|
+
decode(key) {
|
|
160
156
|
const soundData = this.game.cache.getSoundData(key);
|
|
161
157
|
if (soundData) {
|
|
162
158
|
if (this.game.cache.isSoundDecoded(key) === false) {
|
|
@@ -164,7 +160,6 @@ export default class {
|
|
|
164
160
|
this.context.decodeAudioData(soundData)
|
|
165
161
|
.then((buffer) => {
|
|
166
162
|
this.game.cache.decodedSound(key, buffer);
|
|
167
|
-
this.onSoundDecode.dispatch(key, sound);
|
|
168
163
|
})
|
|
169
164
|
.catch((e) => {
|
|
170
165
|
this.game.exceptionHandler(e, { key });
|
|
@@ -271,7 +266,7 @@ export default class {
|
|
|
271
266
|
this._muteVolume = this.masterGain.gain.value;
|
|
272
267
|
this.masterGain.gain.value = 0;
|
|
273
268
|
}
|
|
274
|
-
this.
|
|
269
|
+
this.onChange.dispatch('muted');
|
|
275
270
|
}
|
|
276
271
|
|
|
277
272
|
unsetMute() {
|
|
@@ -282,7 +277,7 @@ export default class {
|
|
|
282
277
|
if (!this.noAudio) {
|
|
283
278
|
this.masterGain.gain.value = this._muteVolume;
|
|
284
279
|
}
|
|
285
|
-
this.
|
|
280
|
+
this.onChange.dispatch('unmuted');
|
|
286
281
|
}
|
|
287
282
|
|
|
288
283
|
destroy() {
|
|
@@ -293,7 +288,7 @@ export default class {
|
|
|
293
288
|
}
|
|
294
289
|
}
|
|
295
290
|
this._sounds = [];
|
|
296
|
-
this.
|
|
291
|
+
this.onChange.dispose();
|
|
297
292
|
if (this.context) {
|
|
298
293
|
if (window.PhaserRegistry) {
|
|
299
294
|
window.PhaserRegistry.audioContext = this.context;
|
|
@@ -338,7 +333,6 @@ export default class {
|
|
|
338
333
|
if (!this.noAudio) {
|
|
339
334
|
this.masterGain.gain.value = value;
|
|
340
335
|
}
|
|
341
|
-
this.onVolumeChange.dispatch(value);
|
|
342
336
|
}
|
|
343
337
|
}
|
|
344
338
|
|