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();
  }
};node

相關文章
相關標籤/搜索