cc.Class({
    extends: cc.Component,

    properties: {
        nodDoneBg:cc.Node,
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.nodDoneBg.on('touchstart',this.onTouchStart,this)
    },

    onTouchStart () {
        this.playAudio();
    },

    playAudio(){
		let url = GameData.scene.data.questionList[GameData.questionIndex].audio;
		cc.assetManager.loadRemote(url, null, (err, clip) => {
			if (err) {
				console.log(err)
				return;
			}
            if (this.audioId) {
                cc.audioEngine.stop(this.audioId);
                this.audioId = null;
            }
			this.audioId = cc.audioEngine.play(clip, false, 1);
			cc.audioEngine.setFinishCallback(id, () => {
                this.audioId = null;
			})
		});
    },
    // update (dt) {},
});
