jumptopkscene.js 948 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. toast: cc.Label,
  11. },
  12. // LIFE-CYCLE CALLBACKS:
  13. onLoad() {
  14. this.node.on('click',this.loadpk,this);
  15. },
  16. loadpk() {
  17. MyAudio.PlayEffect_button();
  18. if (!Global.endinit) {
  19. Global.toast("请等待汽车加载完成!")
  20. return;
  21. }
  22. if (Global.MaxCarLevel == 0) {
  23. //提示先创建车辆
  24. Global.toast('请先购买至少一辆车');
  25. return
  26. }
  27. // Global.CocosAnalysticCustomEvent('PK', 'Jump')
  28. cc.director.loadScene("pk")
  29. }
  30. // update (dt) {},
  31. });