Commit bc52922b authored by zjz1994's avatar zjz1994

猩猩消除暂存

parent 570f1d68
...@@ -312,6 +312,7 @@ export default class MainBase extends eui.UILayer { ...@@ -312,6 +312,7 @@ export default class MainBase extends eui.UILayer {
RES.getResAsync("ele38_png"); RES.getResAsync("ele38_png");
RES.getResAsync("ele39_png"); RES.getResAsync("ele39_png");
RES.getResAsync("ele40_png"); RES.getResAsync("ele40_png");
RES.getResAsync("kuang_png");
for (var i = 1; i <= 27; i++) { for (var i = 1; i <= 27; i++) {
RES.getResAsync("bonusFra" + i + "_png") RES.getResAsync("bonusFra" + i + "_png")
} }
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
}, },
{ {
"name": "preload", "name": "preload",
"keys": "ele40_png" "keys": "ele40_png,kuang_png"
} }
], ],
"resources": [ "resources": [
...@@ -5376,6 +5376,11 @@ ...@@ -5376,6 +5376,11 @@
"name": "ele40_png", "name": "ele40_png",
"type": "image", "type": "image",
"url": "assets/mainScene/ele40.png" "url": "assets/mainScene/ele40.png"
},
{
"name": "kuang_png",
"type": "image",
"url": "assets/mainScene/kuang.png"
} }
] ]
} }
\ No newline at end of file
...@@ -2441,6 +2441,9 @@ export default class MainScene extends Scene { ...@@ -2441,6 +2441,9 @@ export default class MainScene extends Scene {
* 掉落完后的操作 * 掉落完后的操作
*/ */
async fallCallback() { async fallCallback() {
//掉落后先走猩猩的消除
//掉落后有消除,执行消除 //掉落后有消除,执行消除
if(this.threeMatch()) { if(this.threeMatch()) {
this.eliminate(); this.eliminate();
...@@ -3952,13 +3955,14 @@ export default class MainScene extends Scene { ...@@ -3952,13 +3955,14 @@ export default class MainScene extends Scene {
var pglockstat = StateType.PongoLockState; var pglockstat = StateType.PongoLockState;
//本次参与的消除的猩猩 //本次参与的消除的猩猩
//有几只猩猩自由了
var freepongoArr:Array<number> = new Array();
for(var p=0;p<alockPongo.length;p++){ for(var p=0;p<alockPongo.length;p++){
var tlpongoidx = alockPongo[p]; var tlpongoidx = alockPongo[p];
var trpongoidx = tlpongoidx+1; var trpongoidx = tlpongoidx+1;
var blpongoidx = tlpongoidx+Tool.colNum; var blpongoidx = tlpongoidx+Tool.colNum;
var brpongoidx = blpongoidx+1; var brpongoidx = blpongoidx+1;
var tlpartstat = this.lattices[tlpongoidx].element.hasState(pglockstat); var tlpartstat = this.lattices[tlpongoidx].element.hasState(pglockstat);
var trpartstat = this.lattices[trpongoidx].element.hasState(pglockstat); var trpartstat = this.lattices[trpongoidx].element.hasState(pglockstat);
var blpartstat = this.lattices[blpongoidx].element.hasState(pglockstat); var blpartstat = this.lattices[blpongoidx].element.hasState(pglockstat);
...@@ -3966,7 +3970,142 @@ export default class MainScene extends Scene { ...@@ -3966,7 +3970,142 @@ export default class MainScene extends Scene {
//猩猩自由了 //猩猩自由了
if(!tlpartstat&&!trpartstat&&!blpartstat&&!brpartstat){ if(!tlpartstat&&!trpartstat&&!blpartstat&&!brpartstat){
console.log(tlpongoidx,"猩猩自由了"); console.log(tlpongoidx,"这个猩猩自由了");
freepongoArr.push(tlpongoidx);
}
}
}
kuangimgarr:Array<eui.Image> = [];
/**
* 猩猩拍框,
* @param tlidx 拍框猩猩的左上
*/
pongoPaiKuang(tlidx:number){
for(var c1=this.kuangimgarr.length-1;c1>=0;c1++){
var c1img = this.kuangimgarr[c1];
if(c1img&&c1img.parent){
c1img.parent.removeChild(c1img);
}
this.kuangimgarr.splice(c1,1);
}
console.log("猩猩拍框");
//随机发框
var kuangarr:Array<number> = new Array();
var canusearr:Array<number> = new Array();//可以作为左上角的
var allusearr:Array<number> = new Array();//所有的位置
var tridx = tlidx+1;
var blidx = tlidx+Tool.colNum;
var bridx = blidx+1;
var pongoarr1 = [tlidx,tridx,blidx,bridx];
for(var k1row=0;k1row<Tool.rowNum;k1row++){
for(var k1col=0;k1col<Tool.colNum;k1col++){
var k1index = Tool.rcToIndex(k1row,k1col);
var isinpongo = pongoarr1.indexOf(k1index);
if(isinpongo==-1){//粗略的去除拍的猩猩
if(k1row<=7&&k1col<=6){//全部可用左上
//需要去除会占到该猩猩的
canusearr.push(k1index);
}
allusearr.push(k1index);
}
}
}
// console.log("所有可作为左上角的",canusearr,"\n所有位置",allusearr);
//原来9*9
while(kuangarr.length<4){
var randkidx = Math.floor(Math.random()*canusearr.length);
var randk = canusearr[randkidx];
var randkrc = Tool.indexToRc(randk);
var klatrow = randkrc[0];
var klatcol = randkrc[1];
//把框占位的都加进去
var k1idx = randk;
var k2idx = randk+1;
var k3idx = randk+2;
var k4idx = randk+Tool.colNum;
var k5idx = randk+Tool.colNum+1;
var k6idx = randk+Tool.colNum+2;
var kuangidxarr = [k1idx,k2idx,k3idx,k4idx,k5idx,k6idx];
var allhave:boolean = true;
var haveele:boolean = false;
for(var k2=0;k2<kuangidxarr.length;k2++){
var k2kuangidx = kuangidxarr[k2];
var lat = this.lattices[k2kuangidx];
if(lat){
haveele = true;
}
var k2kuanginuse = allusearr.indexOf(k2kuangidx);
if(k2kuanginuse==-1){
allhave = false;
break;
}
var incanuseidx = canusearr.indexOf(k2kuangidx);
if(incanuseidx==-1){
}
}
if(allhave&&haveele){//所占框都可用
for(var k3=0;k3<kuangidxarr.length;k3++){
var k3kuangidx = kuangidxarr[k3];
var k3allinuse = allusearr.indexOf(k3kuangidx);
if(k3allinuse==-1){
console.error("出现了问题,检查");
}else{
allusearr.splice(k3allinuse,1);
}
var k3caninuse = canusearr.indexOf(k3kuangidx);
if(k3caninuse!=-1){
}else{
canusearr.splice(k3caninuse,1);
}
}
kuangarr.push(k1idx);
}
}
console.log("四个框",kuangarr);
for(var i=0;i<kuangarr.length;i++){
var ikuang = kuangarr[i];
var pos = Tool.getPositionByIndex(ikuang);
var kuangpos = this.elementContainer.localToGlobal(pos[0],pos[1]);
var ikuangimg = new eui.Image("kuang_png");
this.addChild(ikuangimg);
ikuangimg.x = kuangpos.x-40;
ikuangimg.y = kuangpos.y-40;
this.kuangimgarr.push(ikuangimg);
}
}
/**
* 多猩猩清场
*/
pongoClearScene(){
for(var i = 0; i < this.lattices.length; i++) {
var lat = this.lattices[i];
if(Tool.judgeEliminate(lat)) {
//本来没必要判断特效组合时是否有重复的消除元素,但是recoverEle里会有判断石头或果冻的加入,造成重复
if(this.eliminatedElements.indexOf(i) == -1) this.eliminatedElements.push(i);
if(this.lattices[i].element.type == ElementType.FISH) {
this.lattices[i].element.nextFishState();
}
//两个魔力鸟分数MM
if(Tool.judgeHasScore(lat.element)) {
this.pushScoreAni(baseScore * this.effectContinuityTimes * effectBaseTimes.MM, Tool.getPositionByIndex(i))
}
} }
} }
} }
......
...@@ -5,7 +5,7 @@ import { ElementType } from "../enum/ElementType"; ...@@ -5,7 +5,7 @@ import { ElementType } from "../enum/ElementType";
export const Chapters23: ChapterData[] = [ export const Chapters23: ChapterData[] = [
//测试576 //测试576
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 1, 2, 3,4],
bubbleProbability: 0, bubbleProbability: 0,
stepCount: 25, stepCount: 25,
passTarget: { passTarget: {
......
...@@ -218,13 +218,14 @@ export class Element extends eui.Component { ...@@ -218,13 +218,14 @@ export class Element extends eui.Component {
} }
//猩猩的哪个部分 //猩猩的哪个部分
inPongoPart:string; inPongoPart:string;
//暂给猩猩两种状态,normal正常,readyelm准备消除
/** /**
* 设置为猩猩的一部分 * 设置为猩猩的一部分
* @param part * @param part
*/ */
setPongoPart(part:string){ setPongoPart(part:string){
this.inPongoPart = part; this.inPongoPart = part;
console.log("我是猩猩的"+part); // console.log("我是猩猩的"+part);
if(part=="tl"){ if(part=="tl"){
var source = "ele40_png"; var source = "ele40_png";
var texture: egret.Texture = RES.getRes(source); var texture: egret.Texture = RES.getRes(source);
......
...@@ -15,7 +15,6 @@ export class PongoLockState extends State{ ...@@ -15,7 +15,6 @@ export class PongoLockState extends State{
* @param inPongoPart * @param inPongoPart
*/ */
reset(inPongoPart:string) { reset(inPongoPart:string) {
console.log("设置状态--猩猩的部位",inPongoPart);
var texture: egret.Texture = RES.getRes("lockVine_png"); var texture: egret.Texture = RES.getRes("lockVine_png");
if(this.showImage&&this.showImage.parent){ if(this.showImage&&this.showImage.parent){
......
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