1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0}), (i.AUDIO_DIR = void 0);
- const s = t("App"),
- o = t("SoundBg"),
- a = t("SoundEffects");
- i.AUDIO_DIR = "audio/";
- var {} = cc._decorator;
- class n {
- constructor() {
- (this.saveKey = "SoundManager"),
- (this.bgOn = !0),
- (this.effectOn = !0),
- (this.bgVolume = 0.3),
- (this.effectVolume = 0.5),
- (this.bg = new o.default()),
- (this.effect = new a.default());
- }
- playEffect(t) {
- return this.effectOn ? this.effect.play(t) : null;
- }
- playLoopEffect(t) {
- if (this.effectOn) return this.effect.loopPlay(t);
- }
- stopLoopEffect(t) {
- this.effect.stopLoopEffect(t);
- }
- playBg(t) {
- (this.currBg = t), this.bgOn && (this.bg.play(t), (this.isPlaying = !0));
- }
- stopBg() {
- this.bg.stop(), (this.isPlaying = !1);
- }
- setEffectOn(t) {
- (this.effectOn = t), this.saveData();
- }
- getEffectStatus() {
- return this.effectOn;
- }
- setBgOn(t) {
- (this.bgOn = t), this.bgOn ? this.currBg && this.playBg(this.currBg) : this.stopBg(), this.saveData();
- }
- getBgStatus() {
- return this.bgOn;
- }
- setBgVolume(t) {
- (t = Math.min(t, 1)), (t = Math.max(t, 0)), (this.bgVolume = t), this.bg.setVolume(this.bgVolume);
- }
- getBgVolume() {
- return this.bgVolume;
- }
- setEffectVolume(t) {
- (t = Math.min(t, 1)), (t = Math.max(t, 0)), (this.effectVolume = t), this.effect.setVolume(this.effectVolume);
- }
- getEffectVolume() {
- return this.effectVolume;
- }
- createMemento() {
- return {effectOn: this.effectOn, bgOn: this.bgOn};
- }
- setMemento(t) {
- t ? ((this.bgOn = t.bgOn), (this.effectOn = t.effectOn)) : ((this.bgOn = !0), (this.effectOn = !0)),
- this.bg.setVolume(this.bgVolume),
- this.effect.setVolume(this.effectVolume);
- }
- pauseMusic() {
- this.bg.stop();
- }
- resumeMusic() {
- this.bg && this.currBg && (this.stopBg(), this.playBg(this.currBg));
- }
- pauseEffect() {
- this.effect.pauseEffect();
- }
- resumeEffect() {
- this.effect.resumeEffect();
- }
- getBgPlayingStatus() {
- return this.isPlaying;
- }
- saveData() {
- s.default.SaveManage.save(this.saveKey);
- }
- }
- (i.default = n).CLEAR_TIME = 18e4;
|