cocos creator 重写源码按钮Button点击音频封装

(function(){
var Super = function(){};
Super.prototype = cc.Button.prototype;
//实例化原型
Super.prototype._onTouchEnded = function (t) {
if (this.interactable && this.enabledInHierarchy) {

cc.hb.audioMgr.playEffect("click", false);//播放按钮Button音频

if (this._pressed) {
cc.Component.EventHandler.emitEvents(this.clickEvents, t);
this.node.emit("click", this);
}
this._pressed = !1;
this._updateState();
t.stopPropagation();
}
};
})();
原文地址:https://www.cnblogs.com/luorende/p/9687178.html