123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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) {},
- });
|