import CellModel from "./CellModel"; import {mergePointArray,exclusivePoint} from "../Utils/ModelUtils"; import {ANITIME, CELL_BASENUM, CELL_STATUS, CELL_TYPE, GRID_HEIGHT, GRID_WIDTH} from "./ConstValue"; export default class GameModel { constructor() { this.cells = null; this.cellBgs = null; this.lastPos = cc.v2(-1,-1); this.cellTypeNum = 5; this.cellCreateType = []; //生成种类只在这个数组里面查找 this.crushNums = 0; //消除的块数 // this.curGridPos = {}; } init(cellTypeNum){ this.cells = []; this.setCellTypeNum(cellTypeNum || this.cellTypeNum); for (let i = 1; i <= GRID_WIDTH; i++){ this.cells[i] = []; for (let j = 1; j <= GRID_HEIGHT; j++){ this.cells[i][j] = new CellModel() } } //this.mock() for (let i = 1; i <= GRID_WIDTH; i++){ for (let j = 1; j <= GRID_HEIGHT; j++){ //已经被mock数据生成了 if (this.cells[i][j].type != null){ continue; } let flag = true; while (flag){ flag = false; this.cells[i][j].init(this.getRandomCellType()); let result = this.checkPoint(j, i)[0]; if (result.length > 2){ flag = true; } this.cells[i][j].setXY(j, i); this.cells[i][j].setStartXY(j, i); } } } } mock(){ // this.mockInit(5,1,CELL_TYPE.A); // this.mockInit(5,3,CELL_TYPE.A); // this.mockInit(4,2,CELL_TYPE.A); // this.mockInit(3,2,CELL_TYPE.A); // this.mockInit(5,2,CELL_TYPE.B); // this.mockInit(6,2,CELL_TYPE.B); // this.mockInit(7,3,CELL_TYPE.B); // this.mockInit(8,2,CELL_TYPE.A); this.mockInit(1, 1, CELL_TYPE.A); this.mockInit(1, 2, CELL_TYPE.A); this.mockInit(1, 3, CELL_TYPE.A); this.mockInit(1, 5, CELL_TYPE.A); this.mockInit(2, 1, CELL_TYPE.B); this.mockInit(2, 2, CELL_TYPE.B); this.mockInit(2, 3, CELL_TYPE.B); this.mockInit(2, 5, CELL_TYPE.B); this.mockInit(3, 4, CELL_TYPE.A); this.mockInit(4, 4, CELL_TYPE.A); console.log("mock") } mockInit(x, y, type){ this.cells[x][y].init(type); this.cells[x][y].setXY(y, x); this.cells[x][y].setStartXY(y, x); } /** * * @param x * @param y * @param recursive 是否递归查找 * @returns {([]|string|*)[]} */ checkPoint(x, y, recursive){ // console.log("递归了x",x) // console.log("递归了y",y) let rowResult = this.checkWithDirection(x, y, [cc.v2(1,0),cc.v2(-1,0)]); let colResult = this.checkWithDirection(x, y, [cc.v2(0,-1),cc.v2(0,1)]); let samePoints = []; let newCellStatus = ""; if (rowResult.length >= 5 || colResult.length >= 5){ //任意五个'同行'或'同列'且相同的动物可以合成一个'魔力鸟'特效 newCellStatus = CELL_STATUS.BIRD; }else if (rowResult.length >= 3 && colResult.length >= 3){ //五个相同的'不同行'动物可以合成一个'爆炸特效' newCellStatus = CELL_STATUS.WRAP; }else if (rowResult.length >= 4){ //四个相同的动物一行可以合成一个行直线特效 newCellStatus = CELL_STATUS.LINE; }else if (colResult.length >= 4){ //四个相同的动物一列可以合成一个列直线特效 newCellStatus = CELL_STATUS.COLUMN; } if (rowResult.length >= 3){ samePoints = rowResult; } if (colResult.length >= 3){ samePoints = mergePointArray(samePoints, colResult); } let result = [samePoints, newCellStatus, this.cells[y][x].type, cc.v2(x, y)]; //检查一下消除的其他节点, 能不能生成更大范围的消除 if (recursive && result.length >= 3){ let subCheckPoints = exclusivePoint(samePoints, cc.v2(x, y)); for (let point of subCheckPoints){ let subResult = this.checkPoint(point.x, point.y, false); if (subResult[1] > result[1] || (subResult[1] === result[1] && subResult[0].length > result[0].length)){ result = subResult; } } } return result; } checkWithDirection(x, y, direction){ // console.log("direction:",direction) // console.log("x:",x) // console.log("y:",y) let queue = []; let vis = []; vis[x + y * 9] = true; queue.push(cc.v2(x, y)); let front = 0; while (front < queue.length){ let point = queue[front]; let cellModel = this.cells[point.y][point.x]; front++; if (!cellModel){ continue; } for (let i = 0; i < direction.length; i++){ let tmpX = point.x + direction[i].x; let tmpY = point.y + direction[i].y; if (tmpX < 1 || tmpX > 9 || tmpY < 1 || tmpY > 9 || vis[tmpX + tmpY * 9] || !this.cells[tmpY][tmpX]){ continue; } if (cellModel.type === this.cells[tmpY][tmpX].type){ vis[tmpX + tmpY * 9] = true; queue.push(cc.v2(tmpX, tmpY)); } } } return queue; } printInfo(){ for (let i = 1; i <= 9; i++){ let printStr = ""; for (let j = 1; j <= 9; j++){ printStr += this.cells[i][j].type + " "; } console.log("printStr:",printStr); } } getCells(){ // console.log(this.cells.length) // console.log("getCells:",this.cells) return this.cells; } //controller调用的主要入口 //点击某个格子 selectCell(pos){ this.crushNums = 0; // console.log("当前点击的位置:",pos); // this.curGridPos = pos; // console.log("当前点击对象:",this.curGridPos) this.changeModels = []; //发生改变的model,将作为返回值,给View播动作 this.effectsQueue = []; //动物消失、爆炸等特效 let lastPos = this.lastPos; let delta = Math.abs(pos.x - lastPos.x) + Math.abs(pos.y - lastPos.y); // console.log("x轴:",Math.abs(pos.x - lastPos.x)) // console.log("y轴:",Math.abs(pos.y - lastPos.y)) // console.log("delta:",delta) if (delta != 1){ //非相邻格子,直接返回 this.lastPos = pos; return [[], []]; } let curClickCell = this.cells[pos.y][pos.x]; //当前点击的格子 let lastClickCell = this.cells[lastPos.y][lastPos.x]; //上一次点击的格子 // console.log("当前点击的格子:",curClickCell) // console.log("上一次点击的格子:",lastClickCell) this.exchangeCell(lastPos, pos); let result1 = this.checkPoint(pos.x, pos.y)[0]; let result2 = this.checkPoint(lastPos.x, lastPos.y)[0]; // console.log("result1:",result1) // console.log("result2:",result2) this.curTime = 0; //动画播放的当前时间 this.pushToChangeModels(curClickCell); this.pushToChangeModels(lastClickCell); let isCanBomb = (curClickCell.status != CELL_STATUS.COMMON && //判断两个是否是特殊的动物 lastClickCell.status != CELL_STATUS.COMMON) || curClickCell.status == CELL_STATUS.BIRD || lastClickCell.status == CELL_STATUS.BIRD; isCanBomb = curClickCell.status == CELL_STATUS.BIRD || lastClickCell.status == CELL_STATUS.BIRD; if (result1.length < 3 && result2.length < 3 && !isCanBomb){ //不会发生消除的情况 this.exchangeCell(lastPos, pos); curClickCell.moveToAndBack(lastPos); lastClickCell.moveToAndBack(pos); this.lastPos = cc.v2(-1,-1); return [this.changeModels]; }else { // console.log("消除了") this.lastPos = cc.v2(-1,-1); curClickCell.moveTo(lastPos, this.curTime); lastClickCell.moveTo(pos, this.curTime); let checkPoint = [pos, lastPos]; // console.log("select的checkpoint:",checkPoint) this.curTime += ANITIME.TOUCH_MOVE; this.processCrush(checkPoint); return [this.changeModels,this.effectsQueue]; } } //消除 processCrush(checkPoint){ // console.log("消除checkpoint:",checkPoint) let cycleCount = 0; while (checkPoint.length > 0){ let bombModels = []; if (cycleCount == 0 && checkPoint.length == 2){ //特殊消除 let pos1 = checkPoint[0]; let pos2 = checkPoint[1]; let model1 = this.cells[pos1.y][pos1.x]; let model2 = this.cells[pos2.y][pos2.x]; if (model1.status == CELL_STATUS.BIRD || model2.status == CELL_STATUS.BIRD){ let bombModel = null; if (model1.status == CELL_STATUS.BIRD){ model1.type = model2.type; bombModels.push(model1); }else { model2.type = model1.type; bombModels.push(model2); } } } for (let i in checkPoint){ let pos = checkPoint[i]; // console.log("消除中的pos:",pos) if (!this.cells[pos.y][pos.x]){ continue; } let [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(pos.x,pos.y,true); if (result.length < 3){ continue; } for (let j in result){ let model = this.cells[result[j].y][result[j].x]; this.crushCell(result[j].x, result[j].y,false, cycleCount); if (model.status != CELL_STATUS.COMMON){ bombModels.push(model); } } this.createNewCell(crushPoint, newCellStatus, newCellType); } this.processBomb(bombModels,cycleCount); this.curTime += ANITIME.DIE; checkPoint = this.down(); // console.log("cccheckPoint:",checkPoint) // console.log("this.down:",this.down()) cycleCount++; } // console.log("消除块数:",this.crushNums) const playTime = this.effectsQueue[this.effectsQueue.length - 1]["playTime"] // console.log("playTime:",playTime) this.addCrushNums(playTime,cc.v2(0,0),this.crushNums) } //道具消除一个块 processCrushOne(pos){ // console.log("gmpos:",pos) this.changeModels = []; this.effectsQueue = []; this.curTime = 0; this.crushNums = 0; //移除脚本信息 this.crushCell(pos.x,pos.y,false,0); //时间和计分 const playTime = this.effectsQueue[this.effectsQueue.length - 1]["playTime"] this.addCrushNums(playTime,cc.v2(0,0),this.crushNums) // console.log("playTime:",playTime) //下落 this.down(); // let [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(pos.x,pos.y,true); // console.log("oneResult:",result) // this.processCrush(result) // this.processCrush(this.checkPoint(pos.x,pos.y,true)) let onceArray = []; for (let i = 1;i <= GRID_WIDTH; i++){ // console.log(i) for (let j = 1;j <= GRID_HEIGHT; j++){ var [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(i,j,true); // console.log("oneResult["+i+"]["+j+"]:",result) if (result.length > 0){ // console.log("if的result:",result) // this.processCrush(result) onceArray = mergePointArray(onceArray,result) } } } this.processCrush(onceArray) //渲染 return [this.changeModels,this.effectsQueue]; } // 道具消除整行 processCrushRow(pos){ console.log("pcr:",pos) // console.log("pcr:",pos.y) this.changeModels = []; this.effectsQueue = []; this.curTime = 0; this.crushNums = 0; //循环点击的行的每个格子 for (let i = 1; i <= GRID_WIDTH; i++){ // this.crushCell(i,pos.y,false,0) this.crushRow(i,pos.y,false,0) // this.addRowCrush(this.curTime,cc.v2(i,pos.y)) // this.down(); } // this.addRowCrush(this.curTime,pos) // let chModel = []; // console.log("gameModel里的changeModel:",chModel) // console.log("this.effectsQueue:",this.effectsQueue) // this.changeModels = chModel // console.log("重新赋值的changeModels:",this.changeModels) //时间和计分 const playTime = this.effectsQueue[this.effectsQueue.length - 1]["playTime"] this.addCrushNums(playTime,cc.v2(0,0),this.crushNums) // console.log("palyTime:",playTime) //下落 this.down(); // let [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(pos.x,pos.y,true); // // console.log("rresult:",result) // this.processCrush(result) let onceArray = []; for (let i = 1;i <= GRID_WIDTH; i++){ // console.log(i) for (let j = 1;j <= GRID_HEIGHT; j++){ var [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(i,j,true); // console.log("oneResult["+i+"]["+j+"]:",result) if (result.length > 0){ // console.log("if的result:",result) // this.processCrush(result) onceArray = mergePointArray(onceArray,result) } } } this.processCrush(onceArray) //渲染 return [this.changeModels,this.effectsQueue]; } //道具消除整列 processCrushCol(pos){ // console.log("消除列的pos:",pos) this.changeModels = []; this.effectsQueue = []; this.curTime = 0; this.crushNums = 0; //循环点击的列的每个格子 for (let i = 1; i <= GRID_WIDTH; i++){ this.crushCol(pos.x,i,false,0) } //时间和计分 const playTime = this.effectsQueue[this.effectsQueue.length - 1]["playTime"] this.addCrushNums(playTime,cc.v2(0,0),this.crushNums) // console.log("palyTime:",playTime) //下落 this.down(); // let [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(pos.x,pos.y,true); // this.processCrush(result) let onceArray = []; for (let i = 1;i <= GRID_WIDTH; i++){ // console.log(i) for (let j = 1;j <= GRID_HEIGHT; j++){ var [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(i,j,true); // console.log("oneResult["+i+"]["+j+"]:",result) if (result.length > 0){ // console.log("if的result:",result) // this.processCrush(result) onceArray = mergePointArray(onceArray,result) } } } this.processCrush(onceArray) //渲染 return [this.changeModels,this.effectsQueue]; } //道具消除一种类型的格子 processCrushOneType(pos){ let nowAllCells = this.getCells(); // console.log("nowAllCells:",nowAllCells) // console.log("长度:",nowAllCells.length) // console.log("消除一类的pos:",pos) this.changeModels = []; this.effectsQueue = []; this.curTime = 0; this.crushNums = 0; let tempModel = []; let curType = null; //两层循环,找出当前点击格子的类型 for (let i = 1; i < nowAllCells.length; i++){ // let newArray = nowAllCells[i] // console.log("newArray:",newArray) if ( i == pos.y){ // console.log("ii:",i) for (let j = 1; j < nowAllCells[i].length; j++){ // console.log("nowAllCell["+i+"]"+"["+j+"]:",nowAllCells[i][j]) // console.log("jj:",j) if (j == pos.x){ // console.log("点击的单元格:",nowAllCells[i][j]) curType = nowAllCells[i][j].type break; } } break; } } // console.log("curType:",curType) //再次两层循环,找出与点击格子类型相同的所有格子 for (let i = 1; i < nowAllCells.length; i++){ for (let j = 1; j < nowAllCells[i].length; j++){ // console.log("nowAllCell["+i+"]"+"["+j+"]:",nowAllCells[i][j]) // console.log("类型:",nowAllCells[i][j].type) if (nowAllCells[i][j].type == curType){ tempModel.push(nowAllCells[i][j]) // console.log("ok") this.crushOneType(j,i,false,0) } } } //时间和计分 this.crushNums const playTime = this.effectsQueue[this.effectsQueue.length - 1]["playTime"] this.addCrushNums(playTime,cc.v2(0,0),this.crushNums) // console.log("palyTime:",playTime) this.changeModels = tempModel; // console.log("重新赋值的changeModels:",this.changeModels) //下落 this.down(); // let [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(pos.x,pos.y,true); // // console.log("消除一类的result:",result) // this.processCrush(result) let onceArray = []; for (let i = 1;i <= GRID_WIDTH; i++){ // console.log(i) for (let j = 1;j <= GRID_HEIGHT; j++){ var [result, newCellStatus, newCellType, crushPoint] = this.checkPoint(i,j,true); // console.log("oneResult["+i+"]["+j+"]:",result) if (result.length > 0){ // console.log("if的result:",result) onceArray = mergePointArray(onceArray,result) } } } this.processCrush(onceArray) //渲染 return [this.changeModels,this.effectsQueue]; } //生成新cell createNewCell(pos, status, type){ if (status == ""){ return; } if (status == CELL_STATUS.BIRD){ type = CELL_TYPE.BIRD; } let model = new CellModel(); this.cells[pos.y][pos.x] = model; model.init(type); model.setStartXY(pos.x, pos.y); model.setXY(pos.x, pos.y); model.setStatus(status); model.setVisible(0, false); model.setVisible(this.curTime, true); this.changeModels.push(model); } //下落 down(){ let newCheckPoint = []; for (let i = 1; i <= GRID_WIDTH; i++){ for (let j = 1; j <= GRID_HEIGHT; j++){ //找到空位 if (this.cells[i][j] == null){ let curRow = i; //往上找方块 for (let k = curRow; k <= GRID_HEIGHT; k++){ //找到可用的方块 if (this.cells[k][j]){ // console.log("下落:",this.cells[k][j]) this.pushToChangeModels(this.cells[k][j]); newCheckPoint.push(this.cells[k][j]); this.cells[curRow][j] = this.cells[k][j]; this.cells[k][j] = null; this.cells[curRow][j].setXY(j, curRow); this.cells[curRow][j].moveTo(cc.v2(j, curRow), this.curTime); curRow++; } } let count = 1; for (let k = curRow; k <= GRID_HEIGHT; k++){ this.cells[k][j] = new CellModel(); this.cells[k][j].init(this.getRandomCellType()); this.cells[k][j].setStartXY(j, count + GRID_HEIGHT); this.cells[k][j].setXY(j, count + GRID_HEIGHT); this.cells[k][j].moveTo(cc.v2(j, k), this.curTime); count++; this.changeModels.push(this.cells[k][j]); newCheckPoint.push(this.cells[k][j]); // console.log("xialuo") } // console.log("下落的newCheckPoint:",newCheckPoint) } } } this.curTime += ANITIME.TOUCH_MOVE + 0.3; return newCheckPoint; } pushToChangeModels(model){ if (this.changeModels.indexOf(model) != -1){ return; } this.changeModels.push(model); } cleanCmd(){ for (let i = 1; i <= GRID_WIDTH; i++){ for (let j = 1; j <= GRID_HEIGHT; j++){ if (this.cells[i][j]){ this.cells[i][j].cmd = []; } } } } exchangeCell(pos1, pos2){ let tmpModel = this.cells[pos1.y][pos1.x]; this.cells[pos1.y][pos1.x] = this.cells[pos2.y][pos2.x]; this.cells[pos1.y][pos1.x].x = pos1.x; this.cells[pos1.y][pos1.x].y = pos1.y; this.cells[pos2.y][pos2.x] = tmpModel; this.cells[pos2.y][pos2.x].x = pos2.x; this.cells[pos2.y][pos2.x].y = pos2.y; } //设置种类 //改成乱序算法 setCellTypeNum(num){ // console.log("num = ",num); this.cellTypeNum = num; this.cellCreateType = []; let createTypeList = this.cellCreateType; for (let i = 1; i <= CELL_BASENUM; i++){ createTypeList.push(i); } for (let i = 0; i < createTypeList.length; i++){ let index = Math.floor(Math.random() * (CELL_BASENUM - i)) + i; createTypeList[i],createTypeList[index] = createTypeList[index],createTypeList[i]; } } //随机生成一个类型 getRandomCellType(){ let index = Math.floor(Math.random() * this.cellTypeNum); // console.log(index) return this.cellCreateType[index]; } //bombModels去重 processBomb(bombModels, cycleCount){ // console.log("去重") // console.log("bombModels:",bombModels) while (bombModels.length > 0){ let newBombModel = []; let bombTime = ANITIME.BOMB_DELAY; bombModels.forEach(function (model) { if (model.status == CELL_STATUS.LINE){ for (let i = 1; i <= GRID_WIDTH; i++){ if (this.cells[model.y][i]){ if (this.cells[model.y][i].status != CELL_STATUS.COMMON){ newBombModel.push(this.cells[model.y][i]); } this.crushCell(i, model.y, false, cycleCount); } } this.addRowBomb(this.curTime, cc.v2(model.x, model.y)); }else if (model.status == CELL_STATUS.COLUMN){ for (let i = 1; i <= GRID_HEIGHT; i++){ if (this.cells[i][model.x]){ if (this.cells[i][model.x].status != CELL_STATUS.COMMON){ newBombModel.push(this.cells[i][model.x]); } this.crushCell(model.x, i, false, cycleCount); } } this.addColBomb(this.curTime, cc.v2(model.x, model.y)); }else if (model.status == CELL_STATUS.WRAP){ let x = model.x; let y = model.y; for (let i = 1; i <= GRID_HEIGHT; i++){ for (let j = 1; j <= GRID_WIDTH; j++){ let delta = Math.abs(x - j) + Math.abs(y - i); if (this.cells[i][j] && delta <= 2){ if (this.cells[i][j].status != CELL_STATUS.COMMON){ newBombModel.push(this.cells[i][j]); } this.crushCell(j, i, false, cycleCount); } } } }else if (model.status == CELL_STATUS.BIRD){ let crushType = model.type; if (bombTime < ANITIME.BOMB_BIRD_DELAY){ bombTime = ANITIME.BOMB_BIRD_DELAY; } if (crushType == CELL_STATUS.BIRD){ crushType = this.getRandomCellType(); } for (let i = 1; i <= GRID_HEIGHT; i++){ for (let j = 1; j <= GRID_WIDTH; j++){ if (this.cells[i][j] && this.cells[i][j].type == crushType){ if (this.cells[i][j].status != CELL_STATUS.COMMON){ newBombModel.push(this.cells[i][j]); } this.crushCell(j, i, true, cycleCount); } } } } },this) if (bombModels.length > 0){ this.curTime += bombTime; } bombModels = newBombModel; } } /** * * @param {*开始播放的时间} playTime * @param {*cell位置} pos * @param {*第几次消除,用于播放音效} step */ //普通消除 addCrushEffect(playTime, pos, step){ this.effectsQueue.push({ playTime, pos, action:"crush", step }); } //正常消除整行 addRowBomb(playTime, pos){ this.effectsQueue.push({ playTime, pos, action:"rowBomb" }); } //道具消除整行 addRowCrush(playTime, pos){ this.effectsQueue.push({ playTime, pos, action:"crushRow" }); } //道具消除整列 addColCrush(playTime, pos){ this.effectsQueue.push({ playTime, pos, action:"crushCol" }); } //正常消除整列 addColBomb(playTime, pos){ this.effectsQueue.push({ playTime, pos, action:"colBomb" }); } addOneTypeCrush(playTime, pos){ this.effectsQueue.push({ playTime, pos, action:"typeBomb" }); } //分数动画加入队列 addCrushNums(playTime,pos,nums){ this.effectsQueue.push({ playTime, pos, action:"crushNums", nums }); } //cell消除逻辑 crushCell(x, y, needShake, step){ let model = this.cells[y][x]; // console.log("crushCellModel:",model) this.pushToChangeModels(model); if (needShake){ model.toShake(this.curTime); } let shakeTime = needShake ? ANITIME.DIE_SHAKE : 0; model.toDie(this.curTime + shakeTime); this.addCrushEffect(this.curTime + shakeTime, cc.v2(model.x,model.y), step); this.cells[y][x] = null; this.crushNums++; // console.log("this.crushNums:",this.crushNums) } // 道具消除整行 crushRow(x, y, needShake, step){ let model = this.cells[y][x]; // console.log("crushCellModel:",model) this.pushToChangeModels(model); if (needShake){ model.toShake(this.curTime); } let shakeTime = needShake ? ANITIME.DIE_SHAKE : 0; model.toDie(this.curTime + shakeTime); this.addRowCrush(this.curTime + shakeTime, cc.v2(model.x,model.y), step); this.cells[y][x] = null; this.crushNums++; // console.log("this.crushNums:",this.crushNums) } // 道具消除整列 crushCol(x, y, needShake, step){ let model = this.cells[y][x]; // console.log("crushCellModel:",model) this.pushToChangeModels(model); if (needShake){ model.toShake(this.curTime); } let shakeTime = needShake ? ANITIME.DIE_SHAKE : 0; model.toDie(this.curTime + shakeTime); this.addColCrush(this.curTime + shakeTime, cc.v2(model.x,model.y), step); this.cells[y][x] = null; this.crushNums++; // console.log("this.crushNums:",this.crushNums) } // 道具消除一种类型 crushOneType(x, y, needShake, step){ let model = this.cells[y][x]; // console.log("crushOneType:",model) this.pushToChangeModels(model); if (needShake){ model.toShake(this.curTime); } let shakeTime = needShake ? ANITIME.DIE_SHAKE : 0; model.toDie(this.curTime + shakeTime); this.addOneTypeCrush(this.curTime + shakeTime, cc.v2(model.x,model.y), step); this.cells[y][x] = null; this.crushNums++; // console.log("this.crushNums:",this.crushNums) } }