SoundBg.js 749 B

12345678910111213141516171819202122232425262728
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", {value: !0});
  5. t = t("BaseSound");
  6. i.default = class extends t.default {
  7. constructor() {
  8. super(), (this._currBg = ""), (this._currBg = "");
  9. }
  10. stop() {
  11. cc.audioEngine.stopMusic(), (this._currBg = "");
  12. }
  13. play(t) {
  14. this._currBg != t && (this.stop(), (this._currBg = t), (t = this.getSound(t)) && this.playSound(t));
  15. }
  16. playSound(t) {
  17. cc.audioEngine.playMusic(t, !0);
  18. }
  19. setVolume(t) {
  20. (this._volume = t), cc.audioEngine.setMusicVolume(t);
  21. }
  22. loadedPlay(t) {
  23. this._currBg == t.name && this.playSound(t);
  24. }
  25. checkCanClear(t) {
  26. return this._currBg != t;
  27. }
  28. };