UIButton.js
574 Bytes
var AudioSettings = require("simba-cc-audio-manager");
cc.Class({
editor: CC_EDITOR && {
menu: '自定义UI组件/Button',
},
extends: cc.Button,
properties: {
clip:cc.AudioClip,
},
start () {
},
_onTouchEnded(event){
this._super(event);
if (!this.clip) {
console.log("current clip is null.");
} else if (this.interactable) {
if (AudioSettings.soundVolume != 0)
cc.audioEngine.playEffect(this.clip, false)
}
},
// update (dt) {},
});