Commit 4e4f00de authored by wildfirecode's avatar wildfirecode

1

parent 727383da
...@@ -133,8 +133,8 @@ ...@@ -133,8 +133,8 @@
]; ];
// localStorage.clear(); // localStorage.clear();
window['imgver'] = '11112' window['imgver'] = '11112'
window['total_level'] = 18 + 13 * 16; window['total_level'] = 18 + 13 * 18;
window['last_level'] = 225;//必须大于等于total_level window['last_level'] = 250;//必须大于等于total_level
// localStorage.clear(); // localStorage.clear();
......
...@@ -935,6 +935,7 @@ export default class MainScene extends Scene { ...@@ -935,6 +935,7 @@ export default class MainScene extends Scene {
var ele = e.target.parent var ele = e.target.parent
if (ele instanceof Element && if (ele instanceof Element &&
// ele.type != ElementType.ROCK && // ele.type != ElementType.ROCK &&
!ele.hasState(StateType.BLOCK_LOCK) && //石门无法消除
ele.type != ElementType.LOLLIPOP) { ele.type != ElementType.LOLLIPOP) {
this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, fun, this); this.elementContainer.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, fun, this);
var index = ele.index; var index = ele.index;
...@@ -1799,14 +1800,14 @@ export default class MainScene extends Scene { ...@@ -1799,14 +1800,14 @@ export default class MainScene extends Scene {
/** /**
* 掉落完后的操作 * 掉落完后的操作
*/ */
fallCallback() { async fallCallback() {
//掉落后有消除,执行消除 //掉落后有消除,执行消除
if (this.threeMatch()) { if (this.threeMatch()) {
this.eliminate() this.eliminate()
return return
} }
//消除结束之后检查石门 //消除结束之后检查石门
this.checkAllBlock(); await this.checkAllBlock();
//鸡蛋的ai操作,存在判断三消,毛球的ai,也一样,所以放前面,存在三消时都直接执行eliminate了。不执行后续的回调 //鸡蛋的ai操作,存在判断三消,毛球的ai,也一样,所以放前面,存在三消时都直接执行eliminate了。不执行后续的回调
AiControl.ins.eggMotion(this, () => { AiControl.ins.eggMotion(this, () => {
//后执行毛球跳动 //后执行毛球跳动
...@@ -1886,9 +1887,14 @@ export default class MainScene extends Scene { ...@@ -1886,9 +1887,14 @@ export default class MainScene extends Scene {
} }
checkAllBlock() { checkAllBlock() {
this.lattices.filter(item => item.block).forEach((item) => { // this.lattices.filter(item => item.block).forEach((item) => {
item.block.nextState(); // item.block.nextState();
}); // });
return Promise.all(
this.lattices.filter(item => item.block).map((item) => {
return item.block.nextState();
})
)
} }
/** /**
* 果冻蔓延和气泡变色需要重新检查死图 * 果冻蔓延和气泡变色需要重新检查死图
...@@ -2132,7 +2138,7 @@ export default class MainScene extends Scene { ...@@ -2132,7 +2138,7 @@ export default class MainScene extends Scene {
//暂时笼子不算个数,算的话,改图片名称,列入ElementType的状态下 //暂时笼子不算个数,算的话,改图片名称,列入ElementType的状态下
} }
else if (ele.hasState(StateType.BLOCK_LOCK)) { else if (ele.hasState(StateType.BLOCK_LOCK)) {
ele.setState(StateType.BLOCK_LOCK, false); //这里不需要消除石门上的元素的状态,石门上的元素状态只由石门来修改
} }
//有褐色毛球的,记录分裂激活 //有褐色毛球的,记录分裂激活
else if (ele.hasState(StateType.HAIRBALLBROWN)) { else if (ele.hasState(StateType.HAIRBALLBROWN)) {
......
...@@ -3,8 +3,9 @@ import { Element } from "../class/Element"; ...@@ -3,8 +3,9 @@ import { Element } from "../class/Element";
import { StateType } from "../enum/StateType"; import { StateType } from "../enum/StateType";
export default class BaseBlock extends egret.DisplayObjectContainer { export default class BaseBlock extends egret.DisplayObjectContainer {
constructor() { constructor(state) {
super(); super();
this._state = state;
this.initUI(); this.initUI();
} }
...@@ -35,11 +36,13 @@ export default class BaseBlock extends egret.DisplayObjectContainer { ...@@ -35,11 +36,13 @@ export default class BaseBlock extends egret.DisplayObjectContainer {
private _element: Element; private _element: Element;
set element(val: Element) { set element(val: Element) {
if (this._element) {
this._element.setState(StateType.BLOCK_LOCK, false);
this._element = null;
}
if (val) { if (val) {
this._element = val; this._element = val;
this.updateElementState(); //刚刚设置元素的时候 this.updateElementState(); //刚刚设置元素的时候
} else {
} }
}; };
...@@ -52,24 +55,29 @@ export default class BaseBlock extends egret.DisplayObjectContainer { ...@@ -52,24 +55,29 @@ export default class BaseBlock extends egret.DisplayObjectContainer {
return this._state >= 3; return this._state >= 3;
} }
isLock() {
return this._state <= 2;
}
//状态0红门 1蓝门 2黄门 3红 4黄 5蓝 //状态0红门 1蓝门 2黄门 3红 4黄 5蓝
private _state = -1; private _state = -1;
private _changing = false; private _changing = false;
nextState(first = false) { async nextState(first = false) {
//先改数据再改视图 //先改数据再改视图
this._state++; this._state++;
if (this._state > 5) if (this._state > 5)
this._state = 0; this._state = 0;
this.changeState(first); await this.changeState(first);
} }
private updateElementState() { private updateElementState() {
if (!this._element) return;
if (this._state <= 2) { if (this._state <= 2) {
this._element.scaleX = 0; this._element.scaleX = 0;
this._element.setState(StateType.BLOCK_LOCK,true); this._element.setState(StateType.BLOCK_LOCK, true);
}else { } else {
this._element.scaleX = 1; this._element.scaleX = 1;
this._element.setState(StateType.BLOCK_LOCK,false); this._element.setState(StateType.BLOCK_LOCK, false);
} }
} }
...@@ -137,7 +145,7 @@ export default class BaseBlock extends egret.DisplayObjectContainer { ...@@ -137,7 +145,7 @@ export default class BaseBlock extends egret.DisplayObjectContainer {
case 0: case 0:
if (!first) { if (!first) {
await this.playToBackAni(); await this.playToBackAni();
this.updateElementState(); this.updateElementState();
this._blockBgFront.visible = false; this._blockBgFront.visible = false;
this._blockBgFront.scaleX = 1; this._blockBgFront.scaleX = 1;
} else { } else {
...@@ -158,7 +166,7 @@ export default class BaseBlock extends egret.DisplayObjectContainer { ...@@ -158,7 +166,7 @@ export default class BaseBlock extends egret.DisplayObjectContainer {
break; break;
case 3://翻转了 case 3://翻转了
await this.playToFrontAni(); await this.playToFrontAni();
this.updateElementState(); this.updateElementState();
this._block.visible = false; this._block.visible = false;
this._block.scaleX = 1; this._block.scaleX = 1;
this._blockBgRed.visible = true; this._blockBgRed.visible = true;
...@@ -198,6 +206,5 @@ export default class BaseBlock extends egret.DisplayObjectContainer { ...@@ -198,6 +206,5 @@ export default class BaseBlock extends egret.DisplayObjectContainer {
egret.Tween.get(obj, { loop: true }).set({ alpha: 0 }) egret.Tween.get(obj, { loop: true }).set({ alpha: 0 })
.to({ alpha: 1 }, dur).to({ alpha: 0 }, dur) .to({ alpha: 1 }, dur).to({ alpha: 0 }, dur)
.to({ alpha: 1 }, dur).to({ alpha: 0 }, dur) .to({ alpha: 1 }, dur).to({ alpha: 0 }, dur)
// .wait(dur * 3);
} }
} }
\ No newline at end of file
...@@ -4,13 +4,21 @@ import BlockDarkIce from "./BlockDarkIce"; ...@@ -4,13 +4,21 @@ import BlockDarkIce from "./BlockDarkIce";
import BlockIce from "./BlockIce"; import BlockIce from "./BlockIce";
export default (type: LatticeType) => { export default (type: LatticeType) => {
const typestr = type + '';
let _state = -1;
if(typestr.length == 2) { //是门开
const arr = typestr.split('');
type = parseInt(arr[0]);
// _state=-1;
_state=2;
}
switch (type) { switch (type) {
case LatticeType.BlOCK: case LatticeType.BlOCK:
return new Block(); return new Block(_state);
case LatticeType.BLOCK_AND_ICE: case LatticeType.BLOCK_AND_ICE:
return new BlockIce(); return new BlockIce(_state);
case LatticeType.BLOCK_AND_DARK_ICE: case LatticeType.BLOCK_AND_DARK_ICE:
return new BlockDarkIce(); return new BlockDarkIce(_state);
default: default:
break; break;
......
This diff is collapsed.
This diff is collapsed.
...@@ -14,6 +14,7 @@ import { PassTargetData } from "../interface/PassTargetData"; ...@@ -14,6 +14,7 @@ import { PassTargetData } from "../interface/PassTargetData";
import { PassType } from "../enum/PassType"; import { PassType } from "../enum/PassType";
import { submitTran } from "../enum/ElementType"; import { submitTran } from "../enum/ElementType";
import { Chapters12 } from "./Chapter12"; import { Chapters12 } from "./Chapter12";
import { Chapters13 } from "./Chapter13";
//所有的关卡 //所有的关卡
const chapters: ChapterData[] = [].concat( const chapters: ChapterData[] = [].concat(
...@@ -29,6 +30,7 @@ const chapters: ChapterData[] = [].concat( ...@@ -29,6 +30,7 @@ const chapters: ChapterData[] = [].concat(
Chapters10, Chapters10,
Chapters11, Chapters11,
Chapters12, Chapters12,
Chapters13,
) )
/** /**
* 获取关卡数据,返回关卡数据 * 获取关卡数据,返回关卡数据
......
...@@ -362,7 +362,7 @@ export class AiControl { ...@@ -362,7 +362,7 @@ export class AiControl {
for (var i = 0; i < thisObj.lattices.length; i++) { for (var i = 0; i < thisObj.lattices.length; i++) {
var lat = thisObj.lattices[i]; var lat = thisObj.lattices[i];
//是基础元素,有气泡状态 //是基础元素,有气泡状态
if (Tool.judgeBaseEle(lat) && lat.element.hasState(StateType.BUBBLE)) { if (Tool.judgeBaseEle(lat) && lat.element.hasState(StateType.BUBBLE) && (!lat.block || !lat.block.isLock())) {
indexs.push(i); indexs.push(i);
} }
} }
......
This diff is collapsed.
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