12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- var t = require;
- var e = module;
- var i = exports;
- var s =
- (this && this.__decorate) ||
- function(t, e, i, s) {
- var o,
- a = arguments.length,
- n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
- else
- for (var r = t.length - 1; 0 <= r; r--)
- (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
- return 3 < a && n && Object.defineProperty(e, i, n), n;
- };
- Object.defineProperty(i, "__esModule", { value: !0 });
- const { ccclass: o, property: a, menu: n } = cc._decorator;
- e = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this._volnumber = 1),
- (this._curChannel = -1),
- (this._audio = null),
- (this._play = !1),
- (this._loop = !1);
- }
- set audio(t) {
- t != this._audio &&
- (this._audio = t) &&
- this._play &&
- (this._curChannel = cc.audioEngine.play(t, this._loop, this._volnumber));
- }
- get audio() {
- return this._audio;
- }
- set play(t) {
- this._play != t &&
- ((this._play = t) ?
- (0 <= this._curChannel && cc.audioEngine.stop(this._curChannel),
- this._audio && (this._curChannel = cc.audioEngine.play(this._audio, this._loop, this._volnumber))) :
- 0 <= this._curChannel && (cc.audioEngine.stop(this._curChannel), (this._curChannel = -1)));
- }
- get play() {
- return this._play;
- }
- set loop(t) {
- this._loop != t &&
- ((this._loop = t),
- this._play && this._audio && (this._curChannel = cc.audioEngine.play(this._audio, t, this._volnumber)));
- }
- get loop() {
- return this._loop;
- }
- onLoad() {}
- };
- s([a({})], e.prototype, "_volnumber", void 0),
- s([a({ type: cc.AudioClip })], e.prototype, "_audio", void 0),
- s([a({ type: cc.AudioClip })], e.prototype, "audio", null),
- s([a], e.prototype, "_play", void 0),
- s([a({})], e.prototype, "play", null),
- s([a], e.prototype, "_loop", void 0),
- s([a({})], e.prototype, "loop", null),
- (e = s([o], e)),
- (i.default = e);
|