Cocos Creator 按钮音效封装重写

cc.Button.prototype._onTouchEnded = function (t) {
  cc.hb.audioMgr.playMusic("click", false);//播放音频
  if (this.interactable && this.enabledInHierarchy) {
    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/9472009.html