import GameModel from "../Model/GameModel"; cc.Class({ extends: cc.Component, properties: { grid:{ default:null, type:cc.Node } }, //关闭按钮 closeBtn(){ let resultMask = cc.find("Canvas/Result"); // cc.director.loadScene("Game"); resultMask.active = false; cc.find("Canvas/TopResult").active = true; this.grid.children.forEach(item => { if (item.name != "bg"){ item.destroy(); } }) this.gameModel = new GameModel(); this.gameModel.init(this.initTypeNum); this.gridScript = this.grid.getComponent("GridView"); this.gridScript.setController(this); this.gridScript.initWithCellModels(this.gameModel.getCells()); }, //继续游戏按钮 continueXCBtn(){ let resultMask = cc.find("Canvas/Result"); // cc.director.loadScene("Game"); resultMask.active = false; cc.find("Canvas/TopResult").active = true; // this.grid.children.forEach(item => { // if (item.name != "bg"){ // item.destroy(); // } // }) // this.gameModel = new GameModel(); // this.gameModel.init(this.initTypeNum); // this.gridScript = this.grid.getComponent("GridView"); // this.gridScript.setController(this); // this.gridScript.initWithCellModels(this.gameModel.getCells()); }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { }, // update (dt) {}, });