Commit e92a7e22 authored by wjf's avatar wjf

l

parent 7dbf98a1
......@@ -9,9 +9,10 @@
<e:Image id="starProgress" x="73" y="77.85" source="starProgress_png"/>
<e:Image x="162.5" y="74.85" source="yezi1_png"/>
<e:Image x="54" y="28.85" source="stepsBoard_png"/>
<e:Image x="226.5" y="88.85" source="dangqianfenshu_png"/>
<e:Image x="226.5" y="88.85" source="dangqianfenshu_png" visible="false"/>
<e:Label id="scoreTxt" touchEnabled="false" size="20" width="194.85" anchorOffsetY="0" height="36" textAlign="left" bold="true" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="0" y="81.85" textColor="0x00556a" x="320.85"/>
<e:Label id="scoreTxt" touchEnabled="false" size="20" width="194.85" anchorOffsetY="0" height="36" textAlign="left" bold="true" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="0" y="83.85" x="320.85" textColor="0xffffff" stroke="1"/>
<e:Label touchEnabled="false" size="20" width="101.85" anchorOffsetY="0" height="36" textAlign="left" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="当前分数:" y="81.85" x="227" bold="true" textColor="0xffffff" stroke="1"/>
<e:Label touchEnabled="false" size="20" width="101.85" anchorOffsetY="0" height="36" textAlign="left" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="当前分数:" y="63.85" textColor="0x00556A" x="765"/>
<e:Label id="targetScoreTxt" touchEnabled="false" size="26" width="292.85" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="目标分数" y="169.85" textColor="0x9d4a06" bold="true" horizontalCenter="0.5"/>
<e:Label touchEnabled="false" size="19" width="115.18" anchorOffsetY="0" height="36" textAlign="center" anchorOffsetX="0" verticalAlign="middle" fontFamily="Microsoft YaHei" text="剩余步数" y="53.48" x="66.35" textColor="0xffffff"/>
......
......@@ -199,7 +199,7 @@ export default class MainScene extends Scene {
Tool.init();
//第几关
this.chapter = (data && data.chapter) ? data.chapter : 1;
// this.chapter = 36;
this.chapter = 55;
this.chapterTxt.text = "第" + this.chapter + "关";
//关卡数据,1期定制,70,后面35关地图一致,步数减少
var mapDataIndex = this.chapter;
......@@ -618,6 +618,8 @@ export default class MainScene extends Scene {
}
}
// this.lattices[18].element.effectType=EffectType.MAGICLION;
// this.lattices[19].element.effectType=EffectType.MAGICLION;
//初始化完先检测死图
this.warningCop = Tool.dieMapCheck(this.lattices);
......@@ -1016,7 +1018,7 @@ export default class MainScene extends Scene {
//去重一次
Tool.removeReapty(this.emptys);
//注释里的备用
var anis = this.fallVertical();
/*var anis = this.fallVertical();
anis = anis.concat(this.fallSkew());
if (!anis.length) {
//如果没有能掉落的就直接回调
......@@ -1026,6 +1028,21 @@ export default class MainScene extends Scene {
this.fallAni(anis, () => {
this.fall(callback)
})
}*/
var anis = this.fallVerticalEx();
if (!anis.length) {
anis = this.fallSkew()
if (!anis.length) {
callback();
} else {
this.fallAni(anis, () => {
this.fall(callback)
})
}
} else {
this.fallVerAni(anis, () => {
this.fall(callback)
})
}
}
/**
......@@ -1072,6 +1089,72 @@ export default class MainScene extends Scene {
return anis;
}
/**
* 一次性都竖直掉落
*/
fallVerticalEx() {
var anis = []
//先把竖直的掉落完,掉满后
var maxCount = 1;
for (var m = 0; m < Tool.colNum; m++) {
//同一列
for (var n = Tool.rowNum - 1; n >= 0; n--) {
var index = Tool.rcToIndex(n, m);
let lat = this.lattices[index];
if (Tool.judgeFall(lat)) {
var emptyIndex = Tool.findBottom(lat, this.emptys, this.lattices);
var downIndex = this.emptys[emptyIndex];
if (emptyIndex != null) {
var ccc = (downIndex - index) / Tool.colNum
maxCount = Math.max(ccc, maxCount);
anis.push([lat.element, downIndex, ccc > 1 ? ccc / 2 : ccc]);
//去掉一个
this.emptys.splice(emptyIndex, 1);
//加上一个
this.emptys.push(index);
lat.element = null
}
} else {
//如果有格子。无元素,是生成口,要补齐下面能掉落的
if (lat && !lat.element && lat.isGenerate) {
//找出从生成口一直到能掉落的空格
var arr = [];
var downIndex = index;
while (this.emptys.indexOf(downIndex) > -1) {
arr.push(downIndex);
downIndex += Tool.colNum;
}
var p = Tool.getPositionByIndex(index);
var len = arr.length;//越前面的越上面,y越小
for (var i = 0; i < arr.length; i++) {
let tarIndex = arr[i];
var type;
if (this.lollipopMark) {
this.lollipopMark = false;
type = ElementType.LOLLIPOP;
this.lollipopCount++;
} else {
type = Tool.randomT(this.chapterData.baseElementTypes)
}
let obj = Tool.getElement(type)
obj.x = p[0];
obj.y = p[1] - Tool.height * (len - i);
this.elementContainer.addChild(obj)
anis.push([obj, tarIndex, len > 1 ? len / 2 : len]);
Tool.removeEle(tarIndex, this.emptys)
}
maxCount = Math.max(len, maxCount);
// console.log(len)
}
}
}
}
anis["maxCount"] = maxCount > 1 ? maxCount / 2 : maxCount;
return anis;
}
private fallSkew() {
//记录一个对象和位置信息[obj,index]的数组,如果obj是null则生成,index位置上方
var anis = [];
......@@ -1205,6 +1288,46 @@ export default class MainScene extends Scene {
})
}
}
fallVerAni(anis: any[], callback: Function) {
playSound(SoundType.fall);
var maxCount = anis["maxCount"] || 1;
// console.log(maxCount)
let count = 0;
let countAll = anis.length;
for (let i = 0; i < anis.length; i++) {
let obj: Element = anis[i][0];
let index = anis[i][1];
let rowCount = anis[i][2] || 1;
let position = Tool.getPositionByIndex(index);
//现在得位置的赋值
var lat = this.lattices[index];
lat.element = obj;
obj.fallAni()
//执行Tween
egret.Tween.get(obj)
.to({ x: position[0], y: position[1] }, 150 * rowCount/*, egret.Ease.cubicOut*/)
.call(() => {
obj.x = position[0];
obj.y = position[1];
//查看每个掉落的obj是否有冰淇淋,并且index是底部的索引,如果是,掉落完后,该格置空,加入emptys,并且需要掉落冰淇淋判断
if (obj.type == ElementType.LOLLIPOP && Tool.indexToRc(index)[0] == this.endRowNum) {
this.recoverEle(index);
this.lollipopCount--;
//通关目标还有棒棒糖,并且,图中不足,下次需要生成
if (this.passElements &&
this.passElements[ElementType.LOLLIPOP] &&
this.lollipopCount < this.passElements[ElementType.LOLLIPOP]) {
this.lollipopMark = true
}
}
count++;
if (count == countAll) {
callback()
}
})
}
}
/**
* 只关心交换后元素的可消除
......@@ -1858,7 +1981,7 @@ export default class MainScene extends Scene {
setTimeout(() => {
this.steps--;
//分数
this.score += 500;
this.score += 1000;
this.addChild(bonusShootAni);
//算角度
var r = Tool.getForwardRotation(stepPosition, [ele.x, ele.y])
......@@ -1871,7 +1994,7 @@ export default class MainScene extends Scene {
this.eliminate();
//如果还有步数就置0
if (this.steps) {
this.score += 500 * this.steps;
this.score += 1000 * this.steps;
this.steps = 0;
}
}
......@@ -2064,10 +2187,10 @@ export default class MainScene extends Scene {
submitData.prizeResponse.orderNum,
() => { return DataManager.ins.getData('getPlugOrderStatus').result == 0 });
} else if(submitData.prizeType == 2) {
} else if (submitData.prizeType == 2) {
Loading2.instace.hide();
PanelCtrl.instance.show('prize2', { level: this.chapter });
}else {
} else {
Loading2.instace.hide();
PanelCtrl.instance.show(ModuleTypes.NO_PRIZE_PANEL, { level: this.chapter });
}
......
......@@ -44,7 +44,7 @@ export const Chapters: ChapterData[] = [
// connectedLats: [[27, 45], [28, 46], [29, 47]]
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.1,
effectInitProbability: 0.03,
stepCount: 20,
passTarget: {
type: PassType.SCORE_TARGET,
......
import { ImageAni } from "../class/ImageAni";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { playSound, SoundType } from "../../soundCtrl";
export const stepPosition: number[] = [125, 115];
......@@ -40,6 +41,7 @@ export class BonusShootAni extends egret.DisplayObjectContainer {
.to({ x: p[0], y: p[1] }, 300)
.call(() => {
callback();
// playSound(SoundType.bonusShoot)
this.shoot.visible = false;
this.imageAni.visible = true;
this.imageAni.play(() => {
......
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