TestForJumpingToNextRound.js 865 B

1234567891011121314151617181920212223242526272829
  1. let gameConfig = require("GameConfig");
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. gameStates: {
  6. default: null,
  7. type: cc.Node,
  8. serializable: true,
  9. },
  10. title: {
  11. default: null,
  12. type: cc.Label,
  13. serializable: true,
  14. },
  15. },
  16. onLoad() {
  17. this.gameStatesScp = this.gameStates.getComponent('GameStates');
  18. let name = gameConfig.round[this.gameStatesScp.currentRound].name;
  19. this.title.string = (this.gameStatesScp.currentRound+1) + ',' + name;
  20. },
  21. next() {
  22. if (this.gameStatesScp.currentRound == 23) return;
  23. this.gameStatesScp.currentRound++;
  24. let name = gameConfig.round[this.gameStatesScp.currentRound].name;
  25. this.title.string = (this.gameStatesScp.currentRound+1) + ',' + name;
  26. }
  27. });