Commit 4e4f00de authored by wildfirecode's avatar wildfirecode

1

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