Commit b2f18b6e authored by zjz1994's avatar zjz1994

代码暂存

parent cde65615
......@@ -2669,21 +2669,65 @@ export default class MainScene extends Scene {
indexFall = indexMy - Tool.colNum;
}
}
//找左上
//找左上,左上联通不是本列
let findLeft = () => {
if(!latFall && Tool.indexToRc(indexMy)[1] != 0) {
var latLeftUp = this.lattices[indexMy - Tool.colNum - 1];
if(Tool.judgeFall(latLeftUp)) {
// console.log("左上掉落需过滤");
// let latfina = Tool.getLatColIdx(lat.row,lat.column,this.lattices);
// let latlfirst = Tool.getFirstColIdx(latLeftUp.row,latLeftUp.column,this.lattices);
// let latfinalat = this.lattices[latfina];
// let latlflat = this.lattices[latlfirst];
// let latfinadown = latfinalat.down;
// let latlfup = latlflat.up;
// if(latfinadown==latlfirst){
// }else{
// latFall = latLeftUp;
// indexFall = indexMy - Tool.colNum - 1;
// }
//原
latFall = latLeftUp;
indexFall = indexMy - Tool.colNum - 1;
}
}
}
//找右上
//找右上,右上联通不是本列
let findRight = () => {
if(!latFall && Tool.indexToRc(indexMy)[1] != Tool.colNum - 1) {
var latRightUp = this.lattices[indexMy - Tool.colNum + 1];
if(Tool.judgeFall(latRightUp)) {
// let latfina = Tool.getLatColIdx(lat.row,lat.column,this.lattices);
// let latrightfirst = Tool.getFirstColIdx(latRightUp.row,latRightUp.column,this.lattices);
// let latfinalat = this.lattices[latfina];
// let latrflat = this.lattices[latrightfirst];
// let latfinadown = latfinalat.down;
// let latrfup = latrflat.up;
// // console.log("斜落检测",latfina,latrightfirst,latfinadown,latrfup);
// if(latfinadown==latrightfirst){
// }else{
// // console.log("可以斜落");
// latFall = latRightUp;
// indexFall = indexMy - Tool.colNum + 1;
// }
// console.log("右上掉落需过滤",lat.up,lat.down,lat.column,lat.row);
// console.log("==续",latRightUp.up,latRightUp.down,latRightUp.column,latRightUp.row);
//原来直接掉落
latFall = latRightUp;
indexFall = indexMy - Tool.colNum + 1;
}
......
......@@ -1397,4 +1397,22 @@ export class Tool {
}
return false;
}
//获取本列最上的格子
public static getFirstColIdx(row:number,col:number,lattices:Array<Lattice>){
for(let r=0;r<Tool.rowNum;r++){
let idxe = r*Tool.rowNum+col;
if(lattices[idxe]){
return idxe
}
}
}
//获取本列最下的格子
public static getLatColIdx(row:number,col:number,lattices:Array<Lattice>){
for(let r=Tool.rowNum-1;r>=0;r--){
let idxe = r*Tool.rowNum+col;
if(lattices[idxe]){
return idxe;
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment