@awayjs/scene 0.13.251 → 0.13.253
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/bundle/awayjs-scene.umd.js +59 -70
- package/bundle/awayjs-scene.umd.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/base/Timeline.js +7 -7
- package/dist/lib/display/DisplayObjectContainer.d.ts.map +1 -1
- package/dist/lib/display/MorphSprite.d.ts.map +1 -1
- package/dist/lib/display/MovieClip.d.ts +6 -6
- package/dist/lib/display/MovieClip.d.ts.map +1 -1
- package/dist/lib/display/MovieClip.js +48 -58
- package/dist/lib/display/Sprite.d.ts.map +1 -1
- package/dist/lib/display/TextField.d.ts.map +1 -1
- package/index.ts +1 -1
- package/lib/base/Timeline.ts +8 -8
- package/lib/display/DisplayObjectContainer.ts +1 -1
- package/lib/display/MorphSprite.ts +1 -3
- package/lib/display/MovieClip.ts +53 -59
- package/lib/display/Sprite.ts +2 -2
- package/lib/display/TextField.ts +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@awayjs/core'), require('@awayjs/stage'), require('@awayjs/view'), require('@awayjs/graphics'), require('@awayjs/renderer'), require('@awayjs/materials'), require('node-html-parser')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@awayjs/core', '@awayjs/stage', '@awayjs/view', '@awayjs/graphics', '@awayjs/renderer', '@awayjs/materials', 'node-html-parser'], factory) :
|
|
4
|
-
(factory((global.AwayjsScene = global.AwayjsScene || {}),global.AwayjsCore,global.AwayjsStage,global.AwayjsView,global.AwayjsGraphics,global.AwayjsRenderer,global.AwayjsMaterials,global.nodeHtmlParser));
|
|
5
|
-
}(this, (function (exports,_awayjs_core,_awayjs_stage,_awayjs_view,_awayjs_graphics,_awayjs_renderer,_awayjs_materials,nodeHtmlParser) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@awayjs/core'), require('@awayjs/stage'), require('@awayjs/view'), require('@awayjs/graphics'), require('@awayjs/renderer'), require('@awayjs/core/dist/lib/managers/BaseAudioChannel'), require('@awayjs/materials'), require('node-html-parser')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@awayjs/core', '@awayjs/stage', '@awayjs/view', '@awayjs/graphics', '@awayjs/renderer', '@awayjs/core/dist/lib/managers/BaseAudioChannel', '@awayjs/materials', 'node-html-parser'], factory) :
|
|
4
|
+
(factory((global.AwayjsScene = global.AwayjsScene || {}),global.AwayjsCore,global.AwayjsStage,global.AwayjsView,global.AwayjsGraphics,global.AwayjsRenderer,global._awayjs_core_dist_lib_managers_BaseAudioChannel,global.AwayjsMaterials,global.nodeHtmlParser));
|
|
5
|
+
}(this, (function (exports,_awayjs_core,_awayjs_stage,_awayjs_view,_awayjs_graphics,_awayjs_renderer,_awayjs_core_dist_lib_managers_BaseAudioChannel,_awayjs_materials,nodeHtmlParser) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3983,16 +3983,16 @@ var Timeline = /** @class */ (function () {
|
|
|
3983
3983
|
for (var i = start_index; i < end_index; i++) {
|
|
3984
3984
|
var audioProps = this.audioPool[this.add_sounds_stream[i]];
|
|
3985
3985
|
if (audioProps) {
|
|
3986
|
+
var sound = audioProps.sound;
|
|
3987
|
+
if (!sound) {
|
|
3988
|
+
console.warn('[Timeline] Missing sound in audioProps!', audioProps);
|
|
3989
|
+
return;
|
|
3990
|
+
}
|
|
3986
3991
|
if (audioProps.cmd == 15) { // start sound
|
|
3987
|
-
|
|
3988
|
-
if (!child) {
|
|
3989
|
-
console.warn('[Timeline] Missed sound to start!', audioProps);
|
|
3990
|
-
return;
|
|
3991
|
-
}
|
|
3992
|
-
target_mc.startSound(audioProps.id, child, audioProps.props.loopCount || 0);
|
|
3992
|
+
target_mc.startSound(sound, audioProps.props.loopCount || 0);
|
|
3993
3993
|
}
|
|
3994
3994
|
else if (audioProps.cmd == 16) { // stop sound
|
|
3995
|
-
target_mc.stopSound(
|
|
3995
|
+
target_mc.stopSound(sound);
|
|
3996
3996
|
}
|
|
3997
3997
|
//console.log("start sound:", child);
|
|
3998
3998
|
}
|
|
@@ -6826,6 +6826,7 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6826
6826
|
_this._isInit = true;
|
|
6827
6827
|
_this._sessionID_childs = {};
|
|
6828
6828
|
_this._sounds = {};
|
|
6829
|
+
_this._activeSounds = {};
|
|
6829
6830
|
_this._skipFramesForStream = 0;
|
|
6830
6831
|
/**
|
|
6831
6832
|
* Mark that operation provided by timeline except a script, some operation not allowed from script
|
|
@@ -6880,10 +6881,11 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6880
6881
|
if (spriteMode) {
|
|
6881
6882
|
_this.transformToSprite();
|
|
6882
6883
|
}
|
|
6884
|
+
_this.onSoundCompleteInternal = _this.onSoundCompleteInternal.bind(_this);
|
|
6883
6885
|
return _this;
|
|
6884
6886
|
}
|
|
6885
6887
|
MovieClip.stopAllSounds = function () {
|
|
6886
|
-
MovieClip._activeSoundsOwners.forEach(function (e) { return e && e.
|
|
6888
|
+
MovieClip._activeSoundsOwners.forEach(function (e) { return e && e.stopSounds(); });
|
|
6887
6889
|
MovieClip._activeSoundsOwners.clear();
|
|
6888
6890
|
};
|
|
6889
6891
|
MovieClip.getNewMovieClip = function (timeline) {
|
|
@@ -6956,46 +6958,28 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6956
6958
|
timeline.keyframe_firstframes = [timeline.keyframe_firstframes[0]];
|
|
6957
6959
|
timeline.keyframe_indices = [timeline.keyframe_indices[0]];
|
|
6958
6960
|
};
|
|
6959
|
-
MovieClip.prototype.startSound = function (
|
|
6961
|
+
MovieClip.prototype.startSound = function (sound, loopsToPlay, onSoundComplete) {
|
|
6960
6962
|
var channel = sound.play(0, loopsToPlay);
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6963
|
+
if (onSoundComplete)
|
|
6964
|
+
channel.addEventListener(_awayjs_core_dist_lib_managers_BaseAudioChannel.BaseAudioChannel.COMPLETE, onSoundComplete);
|
|
6965
|
+
//internal listener to clear
|
|
6966
|
+
channel.addEventListener(_awayjs_core_dist_lib_managers_BaseAudioChannel.BaseAudioChannel.COMPLETE, this.onSoundCompleteInternal);
|
|
6967
|
+
this._sounds[sound.id] = sound;
|
|
6968
|
+
if (!this._activeSounds[sound.id]) {
|
|
6969
|
+
this._activeSounds[sound.id] = [];
|
|
6965
6970
|
}
|
|
6966
6971
|
// store channels, stop it instead of sounds
|
|
6967
|
-
|
|
6972
|
+
this._activeSounds[sound.id].push(channel);
|
|
6968
6973
|
MovieClip._activeSoundsOwners.add(this);
|
|
6969
6974
|
};
|
|
6970
|
-
MovieClip.prototype.stopSounds = function (
|
|
6971
|
-
if (
|
|
6972
|
-
if (
|
|
6973
|
-
|
|
6974
|
-
this._sounds[soundID].stop();
|
|
6975
|
-
delete this._sounds[soundID];
|
|
6976
|
-
var channels = MovieClip._activeSounds[soundID];
|
|
6977
|
-
if (channels) {
|
|
6978
|
-
for (var _i = 0, channels_1 = channels; _i < channels_1.length; _i++) {
|
|
6979
|
-
var c = channels_1[_i];
|
|
6980
|
-
c.stop();
|
|
6981
|
-
}
|
|
6982
|
-
}
|
|
6983
|
-
delete MovieClip._activeSounds[soundID];
|
|
6984
|
-
}
|
|
6975
|
+
MovieClip.prototype.stopSounds = function (sound) {
|
|
6976
|
+
if (sound === void 0) { sound = null; }
|
|
6977
|
+
if (sound) {
|
|
6978
|
+
this.stopSound(sound);
|
|
6985
6979
|
}
|
|
6986
6980
|
else {
|
|
6987
|
-
for (var key in this._sounds)
|
|
6988
|
-
this._sounds[key]
|
|
6989
|
-
var channels = MovieClip._activeSounds[soundID];
|
|
6990
|
-
if (channels) {
|
|
6991
|
-
for (var _a = 0, channels_2 = channels; _a < channels_2.length; _a++) {
|
|
6992
|
-
var c = channels_2[_a];
|
|
6993
|
-
c.stop();
|
|
6994
|
-
}
|
|
6995
|
-
}
|
|
6996
|
-
delete MovieClip._activeSounds[key];
|
|
6997
|
-
}
|
|
6998
|
-
this._sounds = {};
|
|
6981
|
+
for (var key in this._sounds)
|
|
6982
|
+
this.stopSound(this._sounds[key]);
|
|
6999
6983
|
}
|
|
7000
6984
|
if (Object.getOwnPropertyNames(this._sounds).length === 0) {
|
|
7001
6985
|
MovieClip._activeSoundsOwners.delete(this);
|
|
@@ -7005,13 +6989,11 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7005
6989
|
for (var i = 0; i < len; ++i) {
|
|
7006
6990
|
child = this._children[i];
|
|
7007
6991
|
if (child.isAsset(MovieClip))
|
|
7008
|
-
child.stopSounds(
|
|
6992
|
+
child.stopSounds(sound);
|
|
7009
6993
|
}
|
|
7010
6994
|
this.stopCurrentStream(this._currentFrameIndex);
|
|
7011
|
-
|
|
7012
|
-
if (this._soundStreams) {
|
|
6995
|
+
if (this._soundStreams)
|
|
7013
6996
|
this._soundStreams.syncSounds(0, false, this.parent);
|
|
7014
|
-
}
|
|
7015
6997
|
};
|
|
7016
6998
|
/**
|
|
7017
6999
|
* Compute scene index by global frame index
|
|
@@ -7111,26 +7093,21 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7111
7093
|
enumerable: true,
|
|
7112
7094
|
configurable: true
|
|
7113
7095
|
});
|
|
7114
|
-
MovieClip.prototype.stopSound = function (
|
|
7115
|
-
if (this._sounds[id]) {
|
|
7116
|
-
this._sounds[id].stop();
|
|
7117
|
-
delete this._sounds[id];
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7096
|
+
MovieClip.prototype.stopSound = function (sound) {
|
|
7097
|
+
if (this._sounds[sound.id]) {
|
|
7098
|
+
this._sounds[sound.id].stop();
|
|
7099
|
+
delete this._sounds[sound.id];
|
|
7100
|
+
if (Object.getOwnPropertyNames(this._sounds).length === 0) {
|
|
7101
|
+
MovieClip._activeSoundsOwners.delete(this);
|
|
7102
|
+
}
|
|
7103
|
+
var channels = this._activeSounds[sound.id];
|
|
7104
|
+
if (channels) {
|
|
7105
|
+
for (var _i = 0, channels_1 = channels; _i < channels_1.length; _i++) {
|
|
7106
|
+
var c = channels_1[_i];
|
|
7107
|
+
c.stop();
|
|
7108
|
+
}
|
|
7109
|
+
delete this._activeSounds[sound.id];
|
|
7125
7110
|
}
|
|
7126
|
-
delete MovieClip._activeSounds[id];
|
|
7127
|
-
}
|
|
7128
|
-
};
|
|
7129
|
-
MovieClip.prototype.stopAllSounds = function () {
|
|
7130
|
-
var keys = Object.keys(this._sounds);
|
|
7131
|
-
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
7132
|
-
var k = keys_1[_i];
|
|
7133
|
-
this.stopSounds(k);
|
|
7134
7111
|
}
|
|
7135
7112
|
};
|
|
7136
7113
|
MovieClip.prototype.buttonReset = function () {
|
|
@@ -7536,13 +7513,25 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7536
7513
|
*/
|
|
7537
7514
|
_super.prototype.clear.call(this);
|
|
7538
7515
|
};
|
|
7516
|
+
MovieClip.prototype.onSoundCompleteInternal = function (event) {
|
|
7517
|
+
var channel = event.target;
|
|
7518
|
+
var sound = channel.owner;
|
|
7519
|
+
var channels = this._activeSounds[sound.id];
|
|
7520
|
+
var index = channels.indexOf(channel);
|
|
7521
|
+
if (index != -1) {
|
|
7522
|
+
channels.splice(index, 1);
|
|
7523
|
+
}
|
|
7524
|
+
if (channels.length === 0)
|
|
7525
|
+
delete this._sounds[sound.id];
|
|
7526
|
+
if (Object.getOwnPropertyNames(this._sounds).length === 0)
|
|
7527
|
+
MovieClip._activeSoundsOwners.delete(this);
|
|
7528
|
+
};
|
|
7539
7529
|
//todo: this 3 are no longer used (?)
|
|
7540
7530
|
MovieClip.avm1ScriptQueue = [];
|
|
7541
7531
|
MovieClip.avm1ScriptQueueScripts = [];
|
|
7542
7532
|
MovieClip.avm1LoadedActions = [];
|
|
7543
7533
|
MovieClip.movieClipSoundsManagerClass = null;
|
|
7544
7534
|
MovieClip._movieClips = new Array();
|
|
7545
|
-
MovieClip._activeSounds = {};
|
|
7546
7535
|
MovieClip._activeSoundsOwners = new Set();
|
|
7547
7536
|
MovieClip.assetType = '[asset MovieClip]';
|
|
7548
7537
|
return MovieClip;
|
|
@@ -18184,7 +18173,7 @@ var Scene = /** @class */ (function () {
|
|
|
18184
18173
|
_awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
|
|
18185
18174
|
_awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
|
|
18186
18175
|
|
|
18187
|
-
console.debug('AwayJS - Scene - 0.13.
|
|
18176
|
+
console.debug('AwayJS - Scene - 0.13.253');
|
|
18188
18177
|
|
|
18189
18178
|
exports.Timeline = Timeline;
|
|
18190
18179
|
exports.ControllerBase = ControllerBase;
|