ResultJudge.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import GameModel from "../Model/GameModel";
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. grid:{
  6. default:null,
  7. type:cc.Node
  8. }
  9. },
  10. //关闭按钮
  11. closeBtn(){
  12. let resultMask = cc.find("Canvas/Result");
  13. // cc.director.loadScene("Game");
  14. resultMask.active = false;
  15. cc.find("Canvas/TopResult").active = true;
  16. this.grid.children.forEach(item => {
  17. if (item.name != "bg"){
  18. item.destroy();
  19. }
  20. })
  21. this.gameModel = new GameModel();
  22. this.gameModel.init(this.initTypeNum);
  23. this.gridScript = this.grid.getComponent("GridView");
  24. this.gridScript.setController(this);
  25. this.gridScript.initWithCellModels(this.gameModel.getCells());
  26. },
  27. //继续游戏按钮
  28. continueXCBtn(){
  29. let resultMask = cc.find("Canvas/Result");
  30. // cc.director.loadScene("Game");
  31. resultMask.active = false;
  32. cc.find("Canvas/TopResult").active = true;
  33. // this.grid.children.forEach(item => {
  34. // if (item.name != "bg"){
  35. // item.destroy();
  36. // }
  37. // })
  38. // this.gameModel = new GameModel();
  39. // this.gameModel.init(this.initTypeNum);
  40. // this.gridScript = this.grid.getComponent("GridView");
  41. // this.gridScript.setController(this);
  42. // this.gridScript.initWithCellModels(this.gameModel.getCells());
  43. },
  44. // LIFE-CYCLE CALLBACKS:
  45. // onLoad () {},
  46. start () {
  47. },
  48. // update (dt) {},
  49. });