@flashist/flibs 0.0.231 → 0.0.233
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 +1 -1
- package/sounds/abstract/AbstractSoundsManager.d.ts +11 -3
- package/sounds/abstract/AbstractSoundsManager.js +41 -21
- package/sounds/abstract/AbstractSoundsManager.js.map +1 -1
- package/sounds/abstract/SoundsManagerEvent.js +1 -1
- package/sounds/abstract/SoundsManagerEvent.js.map +1 -1
package/package.json
CHANGED
|
@@ -3,20 +3,28 @@ import { Sound } from "../../index";
|
|
|
3
3
|
export declare abstract class AbstractSoundsManager extends BaseObject {
|
|
4
4
|
protected soundsToIdMap: AssociativeArray<Sound>;
|
|
5
5
|
protected disableLock: Lock;
|
|
6
|
-
private _isMuted;
|
|
7
6
|
private _enabled;
|
|
7
|
+
private _isActivated;
|
|
8
|
+
private _isMuted;
|
|
8
9
|
private _tweenVolumeValue;
|
|
9
10
|
defaultTweenTime: number;
|
|
10
11
|
protected volume: number;
|
|
11
12
|
protected construction(...args: any[]): void;
|
|
12
13
|
registerSound(id: string, sound: Sound): void;
|
|
13
14
|
getSound(id: string): Sound;
|
|
15
|
+
/**
|
|
16
|
+
* Used to disable (aka mute) Sounds Manager (e.g. when focus is lost / tab is switched).
|
|
17
|
+
* It's different from the mute value, because the mute value will be controlled by the sound control buttons
|
|
18
|
+
* and saved / restored from the local storage (aka save system)
|
|
19
|
+
*/
|
|
20
|
+
get enabled(): boolean;
|
|
21
|
+
protected calculateEnabled(): void;
|
|
14
22
|
addDisableLock(locker: any): void;
|
|
15
23
|
removeDisableLock(locker: any): void;
|
|
24
|
+
get isActivated(): boolean;
|
|
25
|
+
activate(): void;
|
|
16
26
|
get isMuted(): boolean;
|
|
17
27
|
set isMuted(value: boolean);
|
|
18
|
-
get enabled(): boolean;
|
|
19
|
-
protected calculateEnabled(): void;
|
|
20
28
|
protected commitData(): void;
|
|
21
29
|
getVolume(): number;
|
|
22
30
|
setVolume(value: number): void;
|
|
@@ -22,8 +22,7 @@ var AbstractSoundsManager = /** @class */ (function (_super) {
|
|
|
22
22
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
23
23
|
_this.soundsToIdMap = new AssociativeArray();
|
|
24
24
|
_this.disableLock = new Lock();
|
|
25
|
-
_this.
|
|
26
|
-
_this._enabled = true;
|
|
25
|
+
_this._enabled = false;
|
|
27
26
|
_this.defaultTweenTime = 0.5;
|
|
28
27
|
_this.volume = 1;
|
|
29
28
|
return _this;
|
|
@@ -43,6 +42,28 @@ var AbstractSoundsManager = /** @class */ (function (_super) {
|
|
|
43
42
|
AbstractSoundsManager.prototype.getSound = function (id) {
|
|
44
43
|
return this.soundsToIdMap.getItem(id);
|
|
45
44
|
};
|
|
45
|
+
Object.defineProperty(AbstractSoundsManager.prototype, "enabled", {
|
|
46
|
+
// ENABLED: START
|
|
47
|
+
/**
|
|
48
|
+
* Used to disable (aka mute) Sounds Manager (e.g. when focus is lost / tab is switched).
|
|
49
|
+
* It's different from the mute value, because the mute value will be controlled by the sound control buttons
|
|
50
|
+
* and saved / restored from the local storage (aka save system)
|
|
51
|
+
*/
|
|
52
|
+
get: function () {
|
|
53
|
+
return this._enabled;
|
|
54
|
+
},
|
|
55
|
+
enumerable: false,
|
|
56
|
+
configurable: true
|
|
57
|
+
});
|
|
58
|
+
AbstractSoundsManager.prototype.calculateEnabled = function () {
|
|
59
|
+
var prevIsMuted = this.enabled;
|
|
60
|
+
var newIsMuted = !this.disableLock.enabled;
|
|
61
|
+
this._enabled = newIsMuted;
|
|
62
|
+
if (newIsMuted !== prevIsMuted) {
|
|
63
|
+
this.dispatchEvent(SoundsManagerEvent.ENABLED_CHANGE);
|
|
64
|
+
}
|
|
65
|
+
this.commitData();
|
|
66
|
+
};
|
|
46
67
|
AbstractSoundsManager.prototype.addDisableLock = function (locker) {
|
|
47
68
|
this.disableLock.add(locker);
|
|
48
69
|
this.calculateEnabled();
|
|
@@ -51,50 +72,49 @@ var AbstractSoundsManager = /** @class */ (function (_super) {
|
|
|
51
72
|
this.disableLock.remove(locker);
|
|
52
73
|
this.calculateEnabled();
|
|
53
74
|
};
|
|
75
|
+
Object.defineProperty(AbstractSoundsManager.prototype, "isActivated", {
|
|
76
|
+
// ENABLED: END
|
|
77
|
+
get: function () {
|
|
78
|
+
return this._isActivated;
|
|
79
|
+
},
|
|
80
|
+
enumerable: false,
|
|
81
|
+
configurable: true
|
|
82
|
+
});
|
|
83
|
+
AbstractSoundsManager.prototype.activate = function () {
|
|
84
|
+
this._isActivated = true;
|
|
85
|
+
this.commitData();
|
|
86
|
+
};
|
|
54
87
|
Object.defineProperty(AbstractSoundsManager.prototype, "isMuted", {
|
|
55
88
|
get: function () {
|
|
56
89
|
return this._isMuted;
|
|
57
90
|
},
|
|
58
91
|
set: function (value) {
|
|
59
|
-
if (value === this.
|
|
92
|
+
if (value === this.isMuted) {
|
|
60
93
|
return;
|
|
61
94
|
}
|
|
62
95
|
this._isMuted = value;
|
|
63
96
|
this.dispatchEvent(SoundsManagerEvent.IS_MUTED_CHANGE);
|
|
64
|
-
// this.calculateEnabled();
|
|
65
97
|
this.commitData();
|
|
66
98
|
},
|
|
67
99
|
enumerable: false,
|
|
68
100
|
configurable: true
|
|
69
101
|
});
|
|
70
|
-
Object.defineProperty(AbstractSoundsManager.prototype, "enabled", {
|
|
71
|
-
get: function () {
|
|
72
|
-
return this._enabled;
|
|
73
|
-
},
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true
|
|
76
|
-
});
|
|
77
|
-
AbstractSoundsManager.prototype.calculateEnabled = function () {
|
|
78
|
-
var prevEnabled = this.enabled;
|
|
79
|
-
var newEnabled = !this.disableLock.enabled;
|
|
80
|
-
this._enabled = newEnabled;
|
|
81
|
-
if (this.enabled !== prevEnabled) {
|
|
82
|
-
this.dispatchEvent(SoundsManagerEvent.ENABLED_CHANGE);
|
|
83
|
-
}
|
|
84
|
-
this.commitData();
|
|
85
|
-
};
|
|
86
102
|
AbstractSoundsManager.prototype.commitData = function () {
|
|
87
103
|
_super.prototype.commitData.call(this);
|
|
88
|
-
if (!this.
|
|
104
|
+
if (!this.isActivated) {
|
|
89
105
|
return;
|
|
90
106
|
}
|
|
91
107
|
var newVolume = this.getVolume();
|
|
92
108
|
if (this.isMuted) {
|
|
93
109
|
newVolume = 0;
|
|
94
110
|
}
|
|
111
|
+
if (!this.enabled) {
|
|
112
|
+
newVolume = 0;
|
|
113
|
+
}
|
|
95
114
|
// this.internalSetVolume(newVolume);
|
|
96
115
|
this.internalSetVolume(newVolume);
|
|
97
116
|
};
|
|
117
|
+
// VOLUME: START
|
|
98
118
|
AbstractSoundsManager.prototype.getVolume = function () {
|
|
99
119
|
return this.volume;
|
|
100
120
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractSoundsManager.js","sourceRoot":"","sources":["../../../src/sounds/abstract/AbstractSoundsManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD;IAAoD,yCAAU;IAA9D;QAAA,
|
|
1
|
+
{"version":3,"file":"AbstractSoundsManager.js","sourceRoot":"","sources":["../../../src/sounds/abstract/AbstractSoundsManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD;IAAoD,yCAAU;IAA9D;QAAA,qEAoKC;QAlKa,mBAAa,GAA4B,IAAI,gBAAgB,EAAS,CAAC;QAEvE,iBAAW,GAAS,IA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
|
6
6
|
//# sourceMappingURL=SoundsManagerEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SoundsManagerEvent.js","sourceRoot":"","sources":["../../../src/sounds/abstract/SoundsManagerEvent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAC9B,aAAa,EAAE,kCAAkC;IACjD,cAAc,EAAE,mCAAmC;IACnD,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"SoundsManagerEvent.js","sourceRoot":"","sources":["../../../src/sounds/abstract/SoundsManagerEvent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAC9B,aAAa,EAAE,kCAAkC;IACjD,cAAc,EAAE,mCAAmC;IACnD,eAAe,EAAE,iCAAiC;CACrD,CAAC"}
|