var t = require; var e = module; var i = exports; Object.defineProperty(i, "__esModule", {value: !0}), (i.AUDIO_DIR = void 0); t = t("BaseSound"); (i.AUDIO_DIR = "audio/"), (i.default = class extends t.default { constructor() { super(), (this._loopSound = new Map()); } play(t) { t = this.getSound(t); return t ? this.playSound(t) : null; } stopLoopEffect(t) { let e = this._loopSound.get(t); e && (e.cnt--, e.cnt <= 0 && (e.channel && (cc.audioEngine.stopEffect(e.channel), (e.channel = null)), this._loopSound.delete(t))); } loopPlay(t) { var e; return ( this._loopSound.has(t) || ((e = this.getLoopSound(t)) ? ((e = cc.audioEngine.playEffect(e, !0)), this._loopSound.set(t, {cnt: 1, channel: e})) : this._loopSound.set(t, {cnt: 1, channel: null})), t ); } getLoopSound(t) { var e = i.AUDIO_DIR + t, t = cc.resources.get(e, cc.AudioClip); return t || cc.resources.load(e, cc.AudioClip, this.onLoopResourceLoadComplete.bind(this)), t; } onLoopResourceLoadComplete(t, e) { let i = this._loopSound.get(e.name); i && !isNaN(i.channel) && (i.channel = cc.audioEngine.playEffect(e, !0)); } playSound(t) { if (t) return cc.audioEngine.playEffect(t, !1); } setVolume(t) { (this._volume = t), cc.audioEngine.setEffectsVolume(t); } loadedPlay(t) { this.playSound(t); } pauseEffect() { cc.audioEngine.pauseAllEffects(); } resumeEffect() { cc.audioEngine.resumeAllEffects(); } });