@awayjs/scene 0.13.252 → 0.13.254
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 +67 -73
- 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/MovieClip.d.ts +6 -7
- package/dist/lib/display/MovieClip.d.ts.map +1 -1
- package/dist/lib/display/MovieClip.js +56 -61
- package/index.ts +1 -1
- package/lib/base/Timeline.ts +8 -8
- package/lib/display/MovieClip.ts +59 -63
- 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
|
|
@@ -6848,7 +6849,6 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6848
6849
|
*/
|
|
6849
6850
|
_this.constructedKeyFrameIndex = -1;
|
|
6850
6851
|
_this._soundVolume = 1;
|
|
6851
|
-
_this._parentSoundVolume = 1;
|
|
6852
6852
|
_this._isButton = false;
|
|
6853
6853
|
_this._buttonMode = false;
|
|
6854
6854
|
_this._useHandCursor = true;
|
|
@@ -6880,10 +6880,11 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6880
6880
|
if (spriteMode) {
|
|
6881
6881
|
_this.transformToSprite();
|
|
6882
6882
|
}
|
|
6883
|
+
_this.onSoundCompleteInternal = _this.onSoundCompleteInternal.bind(_this);
|
|
6883
6884
|
return _this;
|
|
6884
6885
|
}
|
|
6885
6886
|
MovieClip.stopAllSounds = function () {
|
|
6886
|
-
MovieClip._activeSoundsOwners.forEach(function (e) { return e && e.
|
|
6887
|
+
MovieClip._activeSoundsOwners.forEach(function (e) { return e && e.stopSounds(); });
|
|
6887
6888
|
MovieClip._activeSoundsOwners.clear();
|
|
6888
6889
|
};
|
|
6889
6890
|
MovieClip.getNewMovieClip = function (timeline) {
|
|
@@ -6956,46 +6957,29 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
6956
6957
|
timeline.keyframe_firstframes = [timeline.keyframe_firstframes[0]];
|
|
6957
6958
|
timeline.keyframe_indices = [timeline.keyframe_indices[0]];
|
|
6958
6959
|
};
|
|
6959
|
-
MovieClip.prototype.startSound = function (
|
|
6960
|
+
MovieClip.prototype.startSound = function (sound, loopsToPlay, onSoundComplete) {
|
|
6960
6961
|
var channel = sound.play(0, loopsToPlay);
|
|
6961
|
-
channel.
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6962
|
+
channel.volume = this._soundVolume;
|
|
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
|
|
@@ -7097,8 +7079,13 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7097
7079
|
return;
|
|
7098
7080
|
}
|
|
7099
7081
|
this._soundVolume = value;
|
|
7100
|
-
for (var key in this.
|
|
7101
|
-
this.
|
|
7082
|
+
for (var key in this._activeSounds) {
|
|
7083
|
+
var channels = this._activeSounds[key];
|
|
7084
|
+
if (channels)
|
|
7085
|
+
for (var _i = 0, channels_1 = channels; _i < channels_1.length; _i++) {
|
|
7086
|
+
var c = channels_1[_i];
|
|
7087
|
+
c.volume = value;
|
|
7088
|
+
}
|
|
7102
7089
|
}
|
|
7103
7090
|
var len = this._children.length;
|
|
7104
7091
|
var child;
|
|
@@ -7111,26 +7098,21 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7111
7098
|
enumerable: true,
|
|
7112
7099
|
configurable: true
|
|
7113
7100
|
});
|
|
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
|
-
|
|
7101
|
+
MovieClip.prototype.stopSound = function (sound) {
|
|
7102
|
+
if (this._sounds[sound.id]) {
|
|
7103
|
+
this._sounds[sound.id].stop();
|
|
7104
|
+
delete this._sounds[sound.id];
|
|
7105
|
+
if (Object.getOwnPropertyNames(this._sounds).length === 0) {
|
|
7106
|
+
MovieClip._activeSoundsOwners.delete(this);
|
|
7107
|
+
}
|
|
7108
|
+
var channels = this._activeSounds[sound.id];
|
|
7109
|
+
if (channels) {
|
|
7110
|
+
for (var _i = 0, channels_2 = channels; _i < channels_2.length; _i++) {
|
|
7111
|
+
var c = channels_2[_i];
|
|
7112
|
+
c.stop();
|
|
7113
|
+
}
|
|
7114
|
+
delete this._activeSounds[sound.id];
|
|
7125
7115
|
}
|
|
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
7116
|
}
|
|
7135
7117
|
};
|
|
7136
7118
|
MovieClip.prototype.buttonReset = function () {
|
|
@@ -7536,13 +7518,25 @@ var MovieClip = /** @class */ (function (_super) {
|
|
|
7536
7518
|
*/
|
|
7537
7519
|
_super.prototype.clear.call(this);
|
|
7538
7520
|
};
|
|
7521
|
+
MovieClip.prototype.onSoundCompleteInternal = function (event) {
|
|
7522
|
+
var channel = event.target;
|
|
7523
|
+
var sound = channel.owner;
|
|
7524
|
+
var channels = this._activeSounds[sound.id];
|
|
7525
|
+
var index = channels.indexOf(channel);
|
|
7526
|
+
if (index != -1) {
|
|
7527
|
+
channels.splice(index, 1);
|
|
7528
|
+
}
|
|
7529
|
+
if (channels.length === 0)
|
|
7530
|
+
delete this._sounds[sound.id];
|
|
7531
|
+
if (Object.getOwnPropertyNames(this._sounds).length === 0)
|
|
7532
|
+
MovieClip._activeSoundsOwners.delete(this);
|
|
7533
|
+
};
|
|
7539
7534
|
//todo: this 3 are no longer used (?)
|
|
7540
7535
|
MovieClip.avm1ScriptQueue = [];
|
|
7541
7536
|
MovieClip.avm1ScriptQueueScripts = [];
|
|
7542
7537
|
MovieClip.avm1LoadedActions = [];
|
|
7543
7538
|
MovieClip.movieClipSoundsManagerClass = null;
|
|
7544
7539
|
MovieClip._movieClips = new Array();
|
|
7545
|
-
MovieClip._activeSounds = {};
|
|
7546
7540
|
MovieClip._activeSoundsOwners = new Set();
|
|
7547
7541
|
MovieClip.assetType = '[asset MovieClip]';
|
|
7548
7542
|
return MovieClip;
|
|
@@ -18184,7 +18178,7 @@ var Scene = /** @class */ (function () {
|
|
|
18184
18178
|
_awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
|
|
18185
18179
|
_awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
|
|
18186
18180
|
|
|
18187
|
-
console.debug('AwayJS - Scene - 0.13.
|
|
18181
|
+
console.debug('AwayJS - Scene - 0.13.254');
|
|
18188
18182
|
|
|
18189
18183
|
exports.Timeline = Timeline;
|
|
18190
18184
|
exports.ControllerBase = ControllerBase;
|