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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM