Commit 0cb7766d authored by wjf's avatar wjf

l

parent eac2d9e6
...@@ -514,7 +514,7 @@ export default class MainScene extends Scene { ...@@ -514,7 +514,7 @@ export default class MainScene extends Scene {
//位置 //位置
var p = Tool.getPositionByIndex(i); var p = Tool.getPositionByIndex(i);
//石门 //石门
var dooreData = [5, 6, 51, 61] var dooreData = [4, 5, 6, 51, 61]
if (dooreData.indexOf(latticesD[i]) >= 0) { if (dooreData.indexOf(latticesD[i]) >= 0) {
let door: Door = Pool.takeOut(RecoverName.DOOR); let door: Door = Pool.takeOut(RecoverName.DOOR);
var closed: boolean = (latticesD[i] + "").length == 2 ? false : true var closed: boolean = (latticesD[i] + "").length == 2 ? false : true
...@@ -603,7 +603,7 @@ export default class MainScene extends Scene { ...@@ -603,7 +603,7 @@ export default class MainScene extends Scene {
for (var i = 0; i < elements.length; i++) { for (var i = 0; i < elements.length; i++) {
//如果对应格子为空,直接跳过, //如果对应格子为空,直接跳过,
if (!this.lattices[i]) continue; if (!this.lattices[i]) continue;
var p = Tool.getPositionByIndex(i); let ele: Element;
switch (elements[i]) { switch (elements[i]) {
//如果为0记录空格 //如果为0记录空格
case 0: case 0:
...@@ -617,16 +617,7 @@ export default class MainScene extends Scene { ...@@ -617,16 +617,7 @@ export default class MainScene extends Scene {
case 9: case 9:
case 10: case 10:
var type = Tool.returnType(i, this.lattices, this.chapterData.baseElementTypes); var type = Tool.returnType(i, this.lattices, this.chapterData.baseElementTypes);
let ele: Element = Pool.takeOut(RecoverName.ELEMENT); ele = Tool.getElement(type)
if (!ele) {
ele = new Element(type)
} else {
ele.reset(type)
}
ele.x = p[0];
ele.y = p[1];
this.elementContainer.addChild(ele);
this.lattices[i].element = ele;
if (elements[i] == 4) { if (elements[i] == 4) {
ele.setState(StateType.LOCK, true) ele.setState(StateType.LOCK, true)
} }
...@@ -647,56 +638,37 @@ export default class MainScene extends Scene { ...@@ -647,56 +638,37 @@ export default class MainScene extends Scene {
else if (elements[i] == 10) { else if (elements[i] == 10) {
ele.setState(StateType.HAIRBALLBLACK, true) ele.setState(StateType.HAIRBALLBLACK, true)
} }
break; break;
//棒棒糖 //棒棒糖
case 3: case 3:
this.lollipopCount++; this.lollipopCount++;
let lol: Element = Pool.takeOut(RecoverName.ELEMENT); ele = Tool.getElement(ElementType.LOLLIPOP)
if (!lol) {
lol = new Element(ElementType.LOLLIPOP)
} else {
lol.reset(ElementType.LOLLIPOP)
}
lol.x = p[0];
lol.y = p[1];
this.elementContainer.addChild(lol);
this.lattices[i].element = lol;
break; break;
//石头 //石头
case 2: case 2:
let rock: Element = Pool.takeOut(RecoverName.ELEMENT); ele = Tool.getElement(ElementType.ROCK)
if (!rock) {
rock = new Element(ElementType.ROCK)
} else {
rock.reset(ElementType.ROCK)
}
rock.x = p[0];
rock.y = p[1];
this.elementContainer.addChild(rock);
this.lattices[i].element = rock;
break; break;
//果冻 //果冻
case 5: case 5:
let jelly: Element = Tool.getElement(ElementType.JELLY) ele = Tool.getElement(ElementType.JELLY)
jelly.x = p[0];
jelly.y = p[1];
this.elementContainer.addChild(jelly);
this.lattices[i].element = jelly;
break; break;
//鸡蛋 //鸡蛋
case 6: case 6:
let egg: Element = Tool.getElement(ElementType.CHICKEN_EGG) ele = Tool.getElement(ElementType.CHICKEN_EGG)
egg.x = p[0];
egg.y = p[1];
this.elementContainer.addChild(egg);
this.lattices[i].element = egg;
break; break;
default: default:
//其他标识按空元素记 //其他标识按空元素记
this.emptys.push(i); this.emptys.push(i);
break break
} }
//有元素操作
if (ele) {
var p = Tool.getPositionByIndex(i);
ele.x = p[0];
ele.y = p[1];
this.elementContainer.addChild(ele);
this.lattices[i].element = ele;
}
//针对石门修改 //针对石门修改
if (this.lattices[i].doorClosed) { if (this.lattices[i].doorClosed) {
if (this.lattices[i].element) { if (this.lattices[i].element) {
...@@ -1614,10 +1586,7 @@ export default class MainScene extends Scene { ...@@ -1614,10 +1586,7 @@ export default class MainScene extends Scene {
this.lollipopMark = true this.lollipopMark = true
} }
} }
count++; if (++count == countAll) callback();
if (count == countAll) {
callback()
}
}) })
} }
...@@ -2607,8 +2576,7 @@ export default class MainScene extends Scene { ...@@ -2607,8 +2576,7 @@ export default class MainScene extends Scene {
egret.Tween.get(ele) egret.Tween.get(ele)
.to({ x: p[0], y: p[1] }, 500) .to({ x: p[0], y: p[1] }, 500)
.call(() => { .call(() => {
count++; if (++count == countAll) {
if (count == countAll) {
//交换结束后,判断是否有三消 //交换结束后,判断是否有三消
if (this.threeMatch()) { if (this.threeMatch()) {
this.eliminate() this.eliminate()
......
...@@ -495,10 +495,7 @@ export class AiControl { ...@@ -495,10 +495,7 @@ export class AiControl {
bubbleAni.play(fromType, type, () => { bubbleAni.play(fromType, type, () => {
//显示 //显示
ele.visible = true; ele.visible = true;
count++; if (++count == countAll) callback();
if (count == countAll) {
callback();
}
}) })
} }
} }
......
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