Commit c42e19a7 authored by wjf's avatar wjf

l

parent 99829df1
...@@ -87,6 +87,8 @@ export default class MainScene extends Scene { ...@@ -87,6 +87,8 @@ export default class MainScene extends Scene {
chapterData: ChapterData; chapterData: ChapterData;
//所有的格子数组 //所有的格子数组
lattices: Lattice[]; lattices: Lattice[];
//最后一行的行数
endRowNum: number = 0;
//元素的容器,为了移动事件简单 //元素的容器,为了移动事件简单
elementContainer: egret.DisplayObjectContainer; elementContainer: egret.DisplayObjectContainer;
//选中框 //选中框
...@@ -133,6 +135,7 @@ export default class MainScene extends Scene { ...@@ -133,6 +135,7 @@ export default class MainScene extends Scene {
//每一步生成的总分数 //每一步生成的总分数
oneStepScore: number; oneStepScore: number;
//三个toast
movieClips: any = {} movieClips: any = {}
//皮肤上的 //皮肤上的
...@@ -178,8 +181,6 @@ export default class MainScene extends Scene { ...@@ -178,8 +181,6 @@ export default class MainScene extends Scene {
// egret.Tween.removeTweens(this.scoreProgress); // egret.Tween.removeTweens(this.scoreProgress);
egret.Tween.get(this.scoreProgress, {}, null, true) egret.Tween.get(this.scoreProgress, {}, null, true)
.to({ score: value }, 300) .to({ score: value }, 300)
//同时加进度条,和星星的判断
// this.scoreProgress.score=value
} }
boomBtnNum: PropNumShow; boomBtnNum: PropNumShow;
hammerBtnNum: PropNumShow; hammerBtnNum: PropNumShow;
...@@ -190,6 +191,7 @@ export default class MainScene extends Scene { ...@@ -190,6 +191,7 @@ export default class MainScene extends Scene {
Tool.init(); Tool.init();
//第几关 //第几关
var chapter = (data && data.chapter) ? data.chapter : 1; var chapter = (data && data.chapter) ? data.chapter : 1;
// var chapter = 9
this.chapterTxt.text = "第" + chapter + "关"; this.chapterTxt.text = "第" + chapter + "关";
//关卡数据 //关卡数据
this.chapterData = Chapters[chapter]; this.chapterData = Chapters[chapter];
...@@ -253,14 +255,14 @@ export default class MainScene extends Scene { ...@@ -253,14 +255,14 @@ export default class MainScene extends Scene {
for (let i = 0; i < svgas.length; i++) { for (let i = 0; i < svgas.length; i++) {
parser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => { parser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem); var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep=true; mv.lockStep = true;
mv.x = (750 - 520) / 2; mv.x = (750 - 520) / 2;
mv.y = 500; mv.y = 500;
mv.stop(); mv.stop();
let fun; let fun;
mv.addEventListener(egret.Event.COMPLETE, fun = function (e) { mv.addEventListener(egret.Event.COMPLETE, fun = function (e) {
e.target.stop() e.target.stop()
if(e.target.parent){ if (e.target.parent) {
this.removeChild(e.target) this.removeChild(e.target)
} }
}, this) }, this)
...@@ -335,6 +337,9 @@ export default class MainScene extends Scene { ...@@ -335,6 +337,9 @@ export default class MainScene extends Scene {
this.lattices = []; this.lattices = [];
for (var i = 0; i < latticesD.length; i++) { for (var i = 0; i < latticesD.length; i++) {
if (!latticesD[i]) continue; if (!latticesD[i]) continue;
//记录最下一层的行数
var rc = Tool.indexToRc(i);
this.endRowNum = rc[0] > this.endRowNum ? rc[0] : this.endRowNum;
this.lattices[i] = Pool.takeOut(RecoverName.LATTICE); this.lattices[i] = Pool.takeOut(RecoverName.LATTICE);
if (!this.lattices[i]) { if (!this.lattices[i]) {
this.lattices[i] = new Lattice(i); this.lattices[i] = new Lattice(i);
...@@ -418,7 +423,7 @@ export default class MainScene extends Scene { ...@@ -418,7 +423,7 @@ export default class MainScene extends Scene {
} }
} }
//联通口 //联通口
var connectedLats = this.chapterData.map.connectedLats; var connectedLats = this.chapterData.map.connectedLats || [];
for (var i = 0; i < connectedLats.length; i++) { for (var i = 0; i < connectedLats.length; i++) {
var connectedLat = connectedLats[i]; var connectedLat = connectedLats[i];
this.lattices[connectedLat[0]].down = connectedLat[1]; this.lattices[connectedLat[0]].down = connectedLat[1];
...@@ -670,7 +675,7 @@ export default class MainScene extends Scene { ...@@ -670,7 +675,7 @@ export default class MainScene extends Scene {
var aarr = [s, o] var aarr = [s, o]
for (var i = 0; i < aarr.length; i++) { for (var i = 0; i < aarr.length; i++) {
var ele = aarr[i]; var ele = aarr[i];
if (ele.type == ElementType.LOLLIPOP && ele.row == Tool.rowNum - 1) { if (ele.type == ElementType.LOLLIPOP && ele.row == this.endRowNum) {
this.recoverEle(ele.index); this.recoverEle(ele.index);
this.lollipopCount--; this.lollipopCount--;
//通关目标还有棒棒糖,并且,图中已为0,下次需要生成 //通关目标还有棒棒糖,并且,图中已为0,下次需要生成
...@@ -872,6 +877,7 @@ export default class MainScene extends Scene { ...@@ -872,6 +877,7 @@ export default class MainScene extends Scene {
if (this.lollipopMark) { if (this.lollipopMark) {
this.lollipopMark = false; this.lollipopMark = false;
type = ElementType.LOLLIPOP; type = ElementType.LOLLIPOP;
this.lollipopCount++;
} else { } else {
type = Tool.randomT(this.chapterData.baseElementTypes) type = Tool.randomT(this.chapterData.baseElementTypes)
} }
...@@ -896,7 +902,7 @@ export default class MainScene extends Scene { ...@@ -896,7 +902,7 @@ export default class MainScene extends Scene {
obj.x = position[0]; obj.x = position[0];
obj.y = position[1]; obj.y = position[1];
//查看每个掉落的obj是否有冰淇淋,并且index是底部的索引,如果是,掉落完后,该格置空,加入emptys,并且需要掉落冰淇淋判断 //查看每个掉落的obj是否有冰淇淋,并且index是底部的索引,如果是,掉落完后,该格置空,加入emptys,并且需要掉落冰淇淋判断
if (obj.type == ElementType.LOLLIPOP && Tool.indexToRc(index)[0] == Tool.rowNum - 1) { if (obj.type == ElementType.LOLLIPOP && Tool.indexToRc(index)[0] == this.endRowNum) {
this.recoverEle(index); this.recoverEle(index);
this.lollipopCount--; this.lollipopCount--;
//通关目标还有棒棒糖,并且,图中已为0,下次需要生成 //通关目标还有棒棒糖,并且,图中已为0,下次需要生成
...@@ -1626,7 +1632,7 @@ export default class MainScene extends Scene { ...@@ -1626,7 +1632,7 @@ export default class MainScene extends Scene {
if (ele.temEffectType != null) { if (ele.temEffectType != null) {
ele.effectType = ele.temEffectType; ele.effectType = ele.temEffectType;
ele.temEffectType = null; ele.temEffectType = null;
//但是算个数 //但是算个数,考虑是否冰块要消除
this.goElementTarget(ele); this.goElementTarget(ele);
} else { } else {
//单纯元素消失特效 //单纯元素消失特效
...@@ -1862,11 +1868,11 @@ export default class MainScene extends Scene { ...@@ -1862,11 +1868,11 @@ export default class MainScene extends Scene {
if (sv && this.movieClips[sv]) { if (sv && this.movieClips[sv]) {
this.addChild(this.movieClips[sv]) this.addChild(this.movieClips[sv])
this.movieClips[sv].gotoAndPlay(1, true) this.movieClips[sv].gotoAndPlay(1, true)
setTimeout(()=>{ setTimeout(() => {
if(this.movieClips[sv].parent){ if (this.movieClips[sv].parent) {
this.removeChild(this.movieClips[sv]) this.removeChild(this.movieClips[sv])
} }
},667) }, 667)
} }
this.oneStepScore = 0; this.oneStepScore = 0;
} }
......
...@@ -28,12 +28,12 @@ export default class StartPanel extends Panel { ...@@ -28,12 +28,12 @@ export default class StartPanel extends Panel {
const prop2Nums = getPropNums(PropType.BOOM); const prop2Nums = getPropNums(PropType.BOOM);
const prop1Nums = getPropNums(PropType.HAMMER); const prop1Nums = getPropNums(PropType.HAMMER);
const prop3Nums = getPropNums(PropType.CHANCE_NUM); const prop3Nums = getPropNums(PropType.CHANCE_NUM);
this['buy1btn'].visible=prop1Nums <=0; this['buy1btn'].visible = prop1Nums <= 0;
this['nums1'].visible=prop1Nums >0; this['nums1'].visible = prop1Nums > 0;
this['buy2btn'].visible=prop2Nums <=0; this['buy2btn'].visible = prop2Nums <= 0;
this['nums2'].visible=prop2Nums >0; this['nums2'].visible = prop2Nums > 0;
this['buy3btn'].visible=prop3Nums <=0; this['buy3btn'].visible = prop3Nums <= 0;
this['nums3'].visible=prop3Nums >0; this['nums3'].visible = prop3Nums > 0;
this['nums1Txt'].text = prop1Nums; this['nums1Txt'].text = prop1Nums;
this['nums2Txt'].text = prop2Nums; this['nums2Txt'].text = prop2Nums;
this['nums3Txt'].text = prop3Nums; this['nums3Txt'].text = prop3Nums;
...@@ -50,7 +50,7 @@ export default class StartPanel extends Panel { ...@@ -50,7 +50,7 @@ export default class StartPanel extends Panel {
onTap_startBtn() { onTap_startBtn() {
this.hidePanel(); this.hidePanel();
// console.log('level '+this._level+'game start......') // console.log('level '+this._level+'game start......')
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE) SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE, { chapter: this._level })
} }
onTap_buy1btn() { onTap_buy1btn() {
PanelCtrl.instance.show('Buy1'); PanelCtrl.instance.show('Buy1');
......
...@@ -38,27 +38,282 @@ export const Chapters: ChapterData[] = [ ...@@ -38,27 +38,282 @@ export const Chapters: ChapterData[] = [
baseElementTypes: [0, 1, 2, 3, 4], baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.15, effectInitProbability: 0.15,
stepCount: 30, stepCount: 30,
passTarget: {
type: PassType.SCORE_TARGET,
score: 10000,
},
// passTarget: { // passTarget: {
// type: PassType.ELEMENT_TARGET, // type: PassType.SCORE_TARGET,
// elements: [ // score: 10000,
// // {
// // type: ElementType.ICE,
// // count: 100,
// // },
// {
// type: ElementType.RABBIT,
// count: 56,
// },
// {
// type: ElementType.LOLLIPOP,
// count: 2,
// }
// ],
// }, // },
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
// {
// type: ElementType.ICE,
// count: 100,
// },
{
type: ElementType.RABBIT,
count: 56,
},
{
type: ElementType.LOLLIPOP,
count: 4,
}
],
},
starScores: [3000, 5000, 10000] starScores: [3000, 5000, 10000]
} },
//第二关
{
map: {
lattices: [
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
],
generateLats: [18, 2, 3, 4, 5, 6, 26],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.1,
stepCount: 18,
passTarget: {
type: PassType.SCORE_TARGET,
score: 4000,
},
starScores: [2000, 3000, 4000]
},
//第三关
{
map: {
lattices: [
0, 0, 1, 1, 1, 1, 1, 0, 0,
1, 0, 1, 1, 1, 1, 1, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 1, 1, 1, 1, 0, 1,
0, 0, 1, 1, 1, 1, 1, 0, 0,
],
generateLats: [9, 0, 2, 3, 4, 5, 6, 17],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.05,
stepCount: 18,
passTarget: {
type: PassType.SCORE_TARGET,
score: 4500,
},
starScores: [2000, 3000, 4500]
},
//第四关
{
map: {
lattices: [
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 0, 0, 0, 0, 0, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
],
generateLats: [1, 2, 3, 4, 5, 6, 7],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.1,
stepCount: 23,
passTarget: {
type: PassType.SCORE_TARGET,
score: 5500,
},
starScores: [3000, 4000, 5500]
},
//第五关
{
map: {
lattices: [
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 2, 2, 2, 1, 0, 0,
0, 0, 1, 1, 2, 1, 1, 0, 0,
0, 0, 1, 2, 2, 2, 1, 0, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
],
generateLats: [2, 3, 4, 5, 6],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.1,
stepCount: 19,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 12,
},
]
},
starScores: [4000, 5000, 6000]
},
//第六关
{
map: {
lattices: [
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 2, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2,
],
generateLats: [0, 1, 2, 3, 4, 5, 6, 7, 8],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.05,
stepCount: 52,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 52,
},
]
},
starScores: [30000, 36000, 40000]
},
//第七关
{
map: {
lattices: [
1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 2, 2, 1, 1, 1,
1, 1, 1, 2, 2, 2, 1, 1, 1,
1, 1, 1, 2, 2, 2, 1, 1, 1,
0, 1, 1, 2, 2, 2, 1, 1, 0,
0, 0, 2, 2, 2, 2, 2, 0, 0,
],
generateLats: [0, 1, 2, 3, 5, 6, 7, 8],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.05,
stepCount: 23,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 17,
},
]
},
starScores: [9000, 14000, 20000]
},
//第八关
{
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 2, 2, 2, 2, 2, 1, 0,
1, 1, 2, 2, 2, 2, 2, 1, 1,
0, 1, 2, 2, 2, 2, 2, 1, 0,
0, 2, 2, 2, 2, 2, 2, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
],
generateLats: [10, 11, 12, 13, 14, 15, 16],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.05,
stepCount: 28,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 22,
},
]
},
starScores: [12000, 24000, 36000]
},
//第九关
{
map: {
lattices: [
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 2, 1, 1, 1, 0,
1, 1, 2, 2, 2, 2, 2, 1, 1,
1, 1, 2, 2, 0, 2, 2, 1, 1,
1, 1, 2, 2, 2, 2, 2, 1, 1,
1, 1, 2, 2, 2, 2, 2, 1, 1,
1, 1, 2, 2, 2, 2, 2, 1, 1,
],
generateLats: [0, 1, 2, 3, 4, 5, 6, 7, 8],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.05,
stepCount: 43,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 25,
},
]
},
starScores: [20000, 35000, 50000]
},
//第十关
{
map: {
lattices: [
0, 0, 1, 1, 4, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0,
],
generateLats: [2, 3, 4, 5, 6],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.05,
stepCount: 50,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.LOLLIPOP,
count: 1,
},
]
},
starScores: [1000, 2000, 3000]
},
] ]
\ No newline at end of file
...@@ -25,6 +25,6 @@ export interface MapData { ...@@ -25,6 +25,6 @@ export interface MapData {
* 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down * 元素为两个索引的数组[8,9],第一个元素为up,第二个元素为down
* [[8,9],[10,13]] * [[8,9],[10,13]]
*/ */
connectedLats: any[]; connectedLats?: any[];
} }
\ No newline at end of file
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