pk_back_game.js 942 B

12345678910111213141516171819202122232425262728293031323334
  1. // Learn cc.Class:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/class.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. cc.Class({
  8. extends: cc.Component,
  9. properties: {
  10. },
  11. // LIFE-CYCLE CALLBACKS:
  12. //定义PK比赛的奖金,赢了就是当前购买单价的10倍的奖金,输了就奖励当前产量的钱
  13. onLoad() {
  14. this.node.on('click',this.backgame,this);
  15. },
  16. backgame() {
  17. MyAudio.PlayEffect_button();
  18. MyAudio.StopEffect_pkbgm();
  19. cc.director.loadScene("Main")
  20. Global.bannerAd.hide();
  21. Global.EndRecode();
  22. let interstitialAd = Global.interstitialAd;
  23. if (interstitialAd) {
  24. interstitialAd.hide().catch((err) => {
  25. console.error(err)
  26. })
  27. }
  28. }
  29. // update (dt) {},
  30. });