Commit 55eca18d authored by wjf's avatar wjf

l

parent 9e222ff4
......@@ -157,9 +157,8 @@ export default class MainBase extends eui.UILayer {
}
for (var i = 0; i < 5; i++) {
RES.getResAsync("ele" + i + "_png")
for (var j = 0; j < 3; j++) {
RES.getResAsync("ele" + i + j + "_png")
}
RES.getResAsync("ele" + i + "Line" + "_png")
RES.getResAsync("ele" + i + "Exp" + "_png")
}
for (var i = 1; i <= 27; i++) {
RES.getResAsync("bonusFra" + i + "_png")
......@@ -167,10 +166,10 @@ export default class MainBase extends eui.UILayer {
for (var i = 1; i <= 19; i++) {
RES.getResAsync("eleDis" + i + "_png")
}
for (var i = 1; i <= 6; i++) {
for (var i = 2; i <= 6; i++) {
RES.getResAsync("ice" + i + "_png")
}
for (var i = 1; i <= 6; i++) {
for (var i = 2; i <= 6; i++) {
RES.getResAsync("rock" + i + "_png")
}
for (var i = 0; i <= 9; i++) {
......@@ -225,6 +224,7 @@ export default class MainBase extends eui.UILayer {
"ele5",
"ele6",
"ele7",
"ele8",
"leftArrow",
"chooseRect",
"lightedStar",
......
......@@ -45,7 +45,7 @@
"name": "shop"
},
{
"keys": "yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rock1_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,ice1_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele42_png,ele41_png,ele40_png,ele4_png,ele32_png,ele31_png,ele30_png,ele3_png,ele22_png,ele21_png,ele20_png,ele2_png,ele12_png,ele11_png,ele10_png,ele1_png,ele02_png,ele01_png,ele00_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png,guideTxt5_png,guideTxt4_png,guideTxt3_png,guideTxt2_png,guideTxt1_png,guideKnowBtn_png,guideBg_png,propNum9_png,propNum8_png,propNum7_png,propNum6_png,propNum5_png,propNum4_png,propNum3_png,propNum2_png,propNum1_png,propNum0_png,propNumBg_png,bonusTime_png,eleDis19_png,eleDis18_png,eleDis17_png,eleDis16_png,eleDis15_png,eleDis14_png,eleDis13_png,main_mapbottom_png,guidePropShoe_png,guidePropMsgPanel_png,guidePropHand_png,guidePropHammer_png,guidePropCow_png,guidePropBoom_png,stepAni9_png,stepAni8_png,stepAni7_png,stepAni6_png,stepAni5_png,stepAni4_png,stepAni3_png,stepAni2_png,stepAni11_png,stepAni10_png,stepAni1_png,lockVine_png,exLighting1_png,exLighting11_png,exLighting14_png,exLighting16_png,exLighting18_png,exLighting19_png,exLighting21_png,exLighting23_png,exLighting25_png,exLighting27_png,exLighting29_png,exLighting3_png,exLighting32_png,exLighting34_png,exLighting5_png,exLighting7_png,exLighting9_png,playSceneBg_jpg",
"keys": "yezi1_png,unlightedStar_png,targetBoard_png,stepsBoard_png,stepNumber9_png,stepNumber8_png,stepNumber7_png,stepNumber6_png,stepNumber5_png,stepNumber4_png,stepNumber3_png,stepNumber2_png,stepNumber1_png,stepNumber0_png,stepBtn_png,starProgress_png,setting_png,scoreNumber9_png,scoreNumber8_png,scoreNumber7_png,scoreNumber6_png,scoreNumber5_png,scoreNumber4_png,scoreNumber3_png,scoreNumber2_png,scoreNumber1_png,scoreNumber0_png,rock6_png,rock5_png,rock4_png,rock3_png,rock2_png,rightMark_png,rightArrow_png,rectLat_png,progressDown_png,magicLionBg_png,magicLion_png,lockUp_png,lockDown_png,lineLight_png,lightedStar_png,leftArrow_png,ice6_png,ice5_png,ice4_png,ice3_png,ice2_png,hammerBtn_png,eleDis9_png,eleDis8_png,eleDis7_png,eleDis6_png,eleDis5_png,eleDis4_png,eleDis3_png,eleDis2_png,eleDis12_png,eleDis11_png,eleDis10_png,eleDis1_png,ele5_png,ele4_png,ele3_png,ele2_png,ele1_png,ele0_png,dangqianfenshu_png,chooseRect_png,boomBtn_png,boom9_png,boom8_png,boom7_png,boom6_png,boom5_png,boom4_png,boom3_png,boom2_png,boom18_png,boom17_png,boom16_png,boom15_png,boom14_png,boom13_png,boom12_png,boom11_png,boom10_png,boom1_png,mainSoundBtnOn_png,mainSettingBg_png,mainQuestionBtn_png,mainMusicBtnOn_png,mainQuitBtn_png,mainSoundBtnOff_png,mainMusicBtnOff_png,targetNumber9_png,targetNumber8_png,targetNumber7_png,targetNumber6_png,targetNumber5_png,targetNumber4_png,targetNumber3_png,targetNumber2_png,targetNumber1_png,targetNumber0_png,ele7_png,ele6_png,bonusFra9_png,bonusFra8_png,bonusFra7_png,bonusFra6_png,bonusFra5_png,bonusFra4_png,bonusFra3_png,bonusFra27_png,bonusFra26_png,bonusFra25_png,bonusFra24_png,bonusFra23_png,bonusFra22_png,bonusFra21_png,bonusFra20_png,bonusFra2_png,bonusFra19_png,bonusFra18_png,bonusFra17_png,bonusFra16_png,bonusFra15_png,bonusFra14_png,bonusFra13_png,bonusFra12_png,bonusFra11_png,bonusFra10_png,bonusFra1_png,bonusShoot_png,guideTxt5_png,guideTxt4_png,guideTxt3_png,guideTxt2_png,guideTxt1_png,guideKnowBtn_png,guideBg_png,propNum9_png,propNum8_png,propNum7_png,propNum6_png,propNum5_png,propNum4_png,propNum3_png,propNum2_png,propNum1_png,propNum0_png,propNumBg_png,bonusTime_png,eleDis19_png,eleDis18_png,eleDis17_png,eleDis16_png,eleDis15_png,eleDis14_png,eleDis13_png,main_mapbottom_png,guidePropShoe_png,guidePropMsgPanel_png,guidePropHand_png,guidePropHammer_png,guidePropCow_png,guidePropBoom_png,stepAni9_png,stepAni8_png,stepAni7_png,stepAni6_png,stepAni5_png,stepAni4_png,stepAni3_png,stepAni2_png,stepAni11_png,stepAni10_png,stepAni1_png,lockVine_png,exLighting1_png,exLighting11_png,exLighting14_png,exLighting16_png,exLighting18_png,exLighting19_png,exLighting21_png,exLighting23_png,exLighting25_png,exLighting27_png,exLighting29_png,exLighting3_png,exLighting32_png,exLighting34_png,exLighting5_png,exLighting7_png,exLighting9_png,playSceneBg_jpg,ele8_png,ele0Line_png,ele0Exp_png,ele1Line_png,ele1Exp_png,ele2Line_png,ele2Exp_png,ele3Line_png,ele3Exp_png,ele4Line_png,ele4Exp_png",
"name": "main2"
},
{
......@@ -585,101 +585,26 @@
"type": "image",
"name": "ele0_png"
},
{
"url": "assets/mainScene/ele00.png",
"type": "image",
"name": "ele00_png"
},
{
"url": "assets/mainScene/ele01.png",
"type": "image",
"name": "ele01_png"
},
{
"url": "assets/mainScene/ele02.png",
"type": "image",
"name": "ele02_png"
},
{
"url": "assets/mainScene/ele1.png",
"type": "image",
"name": "ele1_png"
},
{
"url": "assets/mainScene/ele10.png",
"type": "image",
"name": "ele10_png"
},
{
"url": "assets/mainScene/ele11.png",
"type": "image",
"name": "ele11_png"
},
{
"url": "assets/mainScene/ele12.png",
"type": "image",
"name": "ele12_png"
},
{
"url": "assets/mainScene/ele2.png",
"type": "image",
"name": "ele2_png"
},
{
"url": "assets/mainScene/ele20.png",
"type": "image",
"name": "ele20_png"
},
{
"url": "assets/mainScene/ele21.png",
"type": "image",
"name": "ele21_png"
},
{
"url": "assets/mainScene/ele22.png",
"type": "image",
"name": "ele22_png"
},
{
"url": "assets/mainScene/ele3.png",
"type": "image",
"name": "ele3_png"
},
{
"url": "assets/mainScene/ele30.png",
"type": "image",
"name": "ele30_png"
},
{
"url": "assets/mainScene/ele31.png",
"type": "image",
"name": "ele31_png"
},
{
"url": "assets/mainScene/ele32.png",
"type": "image",
"name": "ele32_png"
},
{
"url": "assets/mainScene/ele4.png",
"type": "image",
"name": "ele4_png"
},
{
"url": "assets/mainScene/ele40.png",
"type": "image",
"name": "ele40_png"
},
{
"url": "assets/mainScene/ele41.png",
"type": "image",
"name": "ele41_png"
},
{
"url": "assets/mainScene/ele42.png",
"type": "image",
"name": "ele42_png"
},
{
"url": "assets/mainScene/ele5.png",
"type": "image",
......@@ -750,11 +675,6 @@
"type": "image",
"name": "hammerBtn_png"
},
{
"url": "assets/mainScene/ice1.png",
"type": "image",
"name": "ice1_png"
},
{
"url": "assets/mainScene/ice2.png",
"type": "image",
......@@ -835,11 +755,6 @@
"type": "image",
"name": "rightMark_png"
},
{
"url": "assets/mainScene/rock1.png",
"type": "image",
"name": "rock1_png"
},
{
"url": "assets/mainScene/rock2.png",
"type": "image",
......@@ -1964,6 +1879,61 @@
"url": "assets/mainScene/playSceneBg.jpg",
"type": "image",
"name": "playSceneBg_jpg"
},
{
"url": "assets/mainScene/ele8.png",
"type": "image",
"name": "ele8_png"
},
{
"url": "assets/mainScene/ele0Line.png",
"type": "image",
"name": "ele0Line_png"
},
{
"url": "assets/mainScene/ele2Line.png",
"type": "image",
"name": "ele2Line_png"
},
{
"url": "assets/mainScene/ele1Line.png",
"type": "image",
"name": "ele1Line_png"
},
{
"url": "assets/mainScene/ele3Line.png",
"type": "image",
"name": "ele3Line_png"
},
{
"url": "assets/mainScene/ele4Line.png",
"type": "image",
"name": "ele4Line_png"
},
{
"url": "assets/mainScene/ele0Exp.png",
"type": "image",
"name": "ele0Exp_png"
},
{
"url": "assets/mainScene/ele1Exp.png",
"type": "image",
"name": "ele1Exp_png"
},
{
"url": "assets/mainScene/ele2Exp.png",
"type": "image",
"name": "ele2Exp_png"
},
{
"url": "assets/mainScene/ele3Exp.png",
"type": "image",
"name": "ele3Exp_png"
},
{
"url": "assets/mainScene/ele4Exp.png",
"type": "image",
"name": "ele4Exp_png"
}
]
}
\ No newline at end of file
This diff is collapsed.
......@@ -2941,7 +2941,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0.3,
stepCount: 14+6+5,
stepCount: 14 + 6 + 5,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -2986,7 +2986,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3],
effectInitProbability: 0.03,
stepCount: 20+6,
stepCount: 20 + 6,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -3031,7 +3031,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.02,
stepCount: 15+5,
stepCount: 15 + 5,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -3076,7 +3076,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0,
stepCount: 20+4,
stepCount: 20 + 4,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -3121,7 +3121,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.03,
stepCount: 20+5,
stepCount: 20 + 5,
passTarget: {
type: PassType.SCORE_TARGET,
score: 15000
......@@ -3161,7 +3161,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.03,
stepCount: 20+4,
stepCount: 20 + 4,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -3206,7 +3206,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.03,
stepCount: 15+5,
stepCount: 15 + 5,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -3251,7 +3251,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.03,
stepCount: 20+4,
stepCount: 20 + 4,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -3296,7 +3296,7 @@ export const Chapters: ChapterData[] = [
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.02,
stepCount: 25+3,
stepCount: 25 + 3,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
......@@ -3312,4 +3312,50 @@ export const Chapters: ChapterData[] = [
15000
]
},
//第八十一关
{
map: {
lattices: [
0, 3, 0, 3, 0, 3, 0, 3, 0,
3, 3, 3, 3, 3, 3, 3, 3, 3,
0, 3, 3, 3, 3, 3, 3, 3, 0,
3, 3, 3, 3, 3, 3, 3, 3, 3,
0, 3, 3, 3, 3, 3, 3, 3, 0,
3, 3, 3, 3, 3, 3, 3, 3, 3,
0, 3, 3, 3, 3, 3, 3, 3, 0,
3, 3, 3, 3, 3, 3, 3, 3, 3,
0, 3, 0, 3, 0, 3, 0, 3, 0,
],
generateLats: [0, 1, 0, 1, 0, 1, 0, 1, 0],
elements: [
0, 1, 0, 1, 0, 1, 0, 1, 0,
5, 1, 1, 1, 1, 1, 1, 1, 5,
0, 1, 1, 1, 1, 1, 1, 1, 0,
2, 1, 1, 1, 1, 1, 1, 1, 2,
0, 1, 1, 1, 1, 1, 1, 1, 0,
2, 1, 1, 1, 1, 1, 1, 1, 2,
0, 1, 1, 1, 1, 1, 1, 1, 0,
5, 1, 1, 1, 1, 1, 1, 1, 5,
0, 5, 0, 5, 0, 5, 0, 5, 0,
],
},
baseElementTypes: [0, 1, 2, 3, 4],
effectInitProbability: 0.02,
stepCount: 250 + 3,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.ICE,
count: 65
}
],
},
starScores: [
4000,
8000,
15000
]
},
]
\ No newline at end of file
......@@ -207,8 +207,11 @@ export class Tool {
if (!lat || !lat.element) {
return false
}
//上方元素为石头,或元素为锁定
else if (lat.element.type == ElementType.ROCK || lat.element.isLock) {
//上方元素为石头,或元素为锁定,或者是果冻,或者鸡蛋
else if (lat.element.type == ElementType.ROCK ||
lat.element.isLock ||
lat.element.type == ElementType.JELLY ||
lat.element.type == ElementType.CHICKEN_EGG) {
return false
}
//剩下情况
......@@ -228,10 +231,12 @@ export class Tool {
if (!lat || !lat.element) {
return false
}
//上方元素为石头,或为冰淇淋,或为魔力鸟
//上方元素为石头,或为冰淇淋,或为魔力鸟,或为果冻,或为鸡蛋
else if (lat.element.type == ElementType.ROCK ||
lat.element.type == ElementType.LOLLIPOP ||
lat.element.effectType == EffectType.MAGICLION) {
lat.element.effectType == EffectType.MAGICLION ||
lat.element.type == ElementType.JELLY ||
lat.element.type == ElementType.CHICKEN_EGG) {
return false
}
//剩下情况
......@@ -241,7 +246,7 @@ export class Tool {
}
/**
* 判断能执行消除的元素,
* 包括所有特效和基本元素
* 包括所有特效和基本元素,石头,果冻,鸡蛋
* @param lat
*/
public static judgeEliminate(lat: Lattice) {
......@@ -249,8 +254,8 @@ export class Tool {
if (!lat || !lat.element) {
return false
}
//上方元素为石头,或为冰淇淋
else if (lat.element.type == ElementType.ROCK || lat.element.type == ElementType.LOLLIPOP) {
//上方元素为冰淇淋
else if (lat.element.type == ElementType.LOLLIPOP) {
return false
}
//剩下情况
......@@ -259,6 +264,24 @@ export class Tool {
}
}
/**
* 判断元素是否可被手势选中和交换
* 主要点击元素判断使用
* @param ele 元素
* @return 返回true为可选,false不可选
*/
public static judgeChosen(ele: Element) {
if (!ele ||
ele.type == ElementType.ROCK ||
ele.isLock ||
ele.type == ElementType.JELLY ||
ele.type == ElementType.CHICKEN_EGG
) {
return false;
}
return true
}
/**
* 检测死图,需要提示
* 需要返回一组提示 两个能互相交换元素,数组
......@@ -501,6 +524,86 @@ export class Tool {
return null
}
/**
* 判断已死
* @param lattices
*/
public static alreadyDie(lattices: Lattice[]) {
//记录基本元素的个数
var arr = {};
//记录是否有特效,两个任意特效,或一个魔力鸟特效,都未锁定
var hasEffect = false;
var effectCount = 0;
//记录是否有两个格子挨着,且未锁定
var hasTwo = false;
//记录是否有三个格子挨着,且未锁定,这个逻辑略烦,暂定至少都未锁定,有bug再改
var hasThree = false;
for (var i = 0; i < lattices.length; i++) {
if (lattices[i] &&
lattices[i].element &&
lattices[i].element.type <= 4 &&
!lattices[i].element.isLock) {
var type = lattices[i].element.type;
if (!arr[type]) arr[type] = 0;
arr[type]++;
var ele = lattices[i].element;
if (ele.effectType == EffectType.MAGICLION) {
hasEffect = true;
}
if (ele.effectType != null) {
effectCount++;
if (effectCount >= 2) {
hasEffect = true;
}
}
var rc = Tool.indexToRc(i);
//右1
if (rc[1] < Tool.colNum - 1) {
var latRight1 = lattices[i + 1];
if (Tool.judgeFall(latRight1) && latRight1.element.type != ElementType.LOLLIPOP) {
hasTwo = true;
}
//右2
if (rc[1] < Tool.colNum - 2) {
var latRight2 = lattices[i + 2];
if (Tool.judgeFall(latRight1) &&
latRight1.element.type != ElementType.LOLLIPOP &&
Tool.judgeFall(latRight2) &&
latRight2.element.type != ElementType.LOLLIPOP) {
hasThree = true;
}
}
}
//下1
var latDown1 = lattices[i + Tool.colNum];
if (Tool.judgeFall(latDown1) && latDown1.element.type != ElementType.LOLLIPOP) {
hasTwo = true;
}
//提前判断下
if (hasTwo && hasEffect) return false;
//下2
var latDown2 = lattices[i + Tool.colNum * 2];
if (Tool.judgeFall(latDown1) &&
latDown1.element.type != ElementType.LOLLIPOP &&
Tool.judgeFall(latDown2) &&
latDown2.element.type != ElementType.LOLLIPOP) {
hasThree = true;
}
if (hasThree) {
for (var a in arr) {
if (arr[a] >= 3) {
return false
}
}
}
}
}
return true
}
/**
* 将有相邻相同的组合,不是基础元素的,都会是单独的
* @param arr
......@@ -699,8 +802,8 @@ export class Tool {
* 获得元素
* @param type
*/
public static getElement(type: ElementType) {
let obj = Pool.takeOut(RecoverName.ELEMENT);
public static getElement(type: ElementType):Element {
let obj:Element = Pool.takeOut(RecoverName.ELEMENT);
if (!obj) {
obj = new Element(type)
} else {
......
......@@ -10,7 +10,7 @@ export class IceAni extends Ani {
constructor() {
super();
this.aniName = "IceAni";
this.showImage = new ImageAni(["ice1_png", "ice2_png", "ice3_png", "ice4_png", "ice5_png", "ice6_png"]);
this.showImage = new ImageAni(["ele7_png", "ice2_png", "ice3_png", "ice4_png", "ice5_png", "ice6_png"]);
this.addChild(this.showImage)
}
......
import { ImageAni } from "../class/ImageAni";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { playSound, SoundType } from "../../soundCtrl";
/**
* 需要回调的
*
*/
export class JellySpreadAni extends egret.DisplayObjectContainer {
//目标位置的图片,到时根据方向定
targetImage: egret.Bitmap;
imageAni: ImageAni
constructor() {
super()
var texture = RES.getRes("bonusShoot_png")
this.targetImage = new egret.Bitmap(texture);
this.targetImage.anchorOffsetX = 78;
this.targetImage.anchorOffsetY = 37 / 2;
this.addChild(this.targetImage);
var arr = []
for (var i = 1; i <= 27; i++) {
arr.push("bonusFra" + i + "_png");
}
this.imageAni = new ImageAni(arr);
this.addChild(this.imageAni);
}
play(startP: number[], endP: number[], callback: Function) {
this.x = startP[0];
this.y = startP[1];
//判断方向
this.imageAni.play(() => {
callback();
if (this.$parent) {
this.$parent.removeChild(this)
};
Pool.recover(RecoverName.JELLYSPREAD_ANI, this)
})
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ export class RockAni extends Ani {
constructor() {
super();
this.aniName = "RockAni";
this.showImage = new ImageAni(["rock1_png", "rock2_png", "rock3_png", "rock4_png", "rock5_png", "rock6_png"]);
this.showImage = new ImageAni(["ele5_png", "rock2_png", "rock3_png", "rock4_png", "rock5_png", "rock6_png"]);
this.addChild(this.showImage)
}
......
......@@ -50,7 +50,7 @@ export class Element extends eui.Component {
this.addChildAt(this.magicLionBgAni, 0);
break;
case EffectType.HORIZONTAL:
this.changeSource("ele" + this.type + value + "_png");
this.changeSource("ele" + this.type + "Line" + "_png");
//添加HorizontalBgAni
this.horizontalBgAni = Pool.takeOut(RecoverName.HORIZONTALBG_ANI)
if (!this.horizontalBgAni) {
......@@ -61,7 +61,7 @@ export class Element extends eui.Component {
this.addChildAt(this.horizontalBgAni, 1)
break;
case EffectType.VERTICAL:
this.changeSource("ele" + this.type + value + "_png");
this.changeSource("ele" + this.type + "Line" + "_png");
//添加VerticalBgAni
this.verticalBgAni = Pool.takeOut(RecoverName.VERTICALBG_ANI)
if (!this.verticalBgAni) {
......@@ -72,7 +72,7 @@ export class Element extends eui.Component {
this.addChildAt(this.verticalBgAni, 1)
break;
case EffectType.EXPLOSIVE:
this.changeSource("ele" + this.type + value + "_png");
this.changeSource("ele" + this.type + "Exp" + "_png");
this.explosiveBgAni = Pool.takeOut(RecoverName.EXPLOSIVEBG_ANI)
if (!this.explosiveBgAni) {
this.explosiveBgAni = new ExplosiveBgAni();
......
/**
* 元素类型
* 元素类型 <=4就是基础元素
*/
export enum ElementType {
RABBIT = 0,//兔子0
......@@ -7,9 +7,14 @@ export enum ElementType {
CATTLE,//牛2
LION,//狮子3
PIG,//猪4
ROCK,//石头5
LOLLIPOP,//棒棒糖6
ICE,//冰块7
ICE,//冰块7 有时间重构的话,不适合放这里
JELLY,//果冻8
CHICKEN_EGG,//鸡蛋9
}
export const codeMsgs = {
"E1002090011": "用户关卡记录异常",
......
......@@ -13,6 +13,9 @@ export enum RecoverName {
SCORE_ANI = "ScoreAni",
BONUSSHOOT_ANI = "BonusShootAni",
JELLYSPREAD_ANI = "JellySpreadAni",
//元素身上
LOCK_ANI = "LockAni",
MAGICLIONBG_ANI = "MagicLionBgAni",
......
......@@ -31,6 +31,7 @@ export interface MapData {
* 2石头
* 3棒棒糖
* 4元素枷锁
* 5果冻
*/
elements?:number[]
/**
......
import MainScene from "../../mainScene/MainScene";
import { JellySpreadAni } from "../anis/JellySpreadAni";
import { Pool } from "../Pool";
import { RecoverName } from "../enum/RecoverName";
import { Tool } from "../Tool";
import { ElementType } from "../enum/ElementType";
import { Lattice } from "../class/Lattice";
export class AiControl {
private static _ins: AiControl
static get ins() {
return AiControl._ins || (AiControl._ins = new AiControl())
}
/**
* 判断是否还有果冻,暂时不考虑果冻无中生有,否则逻辑修改
*/
private hasJelly: boolean;
private hasEgg: boolean;
init(lattices: Lattice[]) {
this.hasJelly = judgeJellyExist(lattices);
this.hasEgg = judgeEggExist(lattices);
}
aiMotion(thisObj: MainScene, callback: Function) {
//果冻的
this.jellyMotion(thisObj, () => {
//鸡蛋的
this.eggMotion(thisObj, callback)
})
// if (noAction) {
// callback()
// }
}
private jellyMotion(thisObj: MainScene, callback: Function) {
if (!this.hasJelly || thisObj.jellyBrokeMark) {
thisObj.jellyBrokeMark = false;
//没有果冻,或上一步有果冻被消除,直接回调
callback();
return
}
//标识记为false
thisObj.jellyBrokeMark = false;
//果冻蔓延
var spread = getJellySpreadAni(thisObj.lattices);
if (spread) {
//执行动画
let jellySpreadAni: JellySpreadAni = Pool.takeOut(RecoverName.JELLYSPREAD_ANI)
if (!jellySpreadAni) {
jellySpreadAni = new JellySpreadAni()
}
thisObj.addChild(jellySpreadAni);
jellySpreadAni.play(Tool.getPositionByIndex(spread[0]), Tool.getPositionByIndex(spread[1]), () => {
//播放完后,将终点元素变成果冻
thisObj.lattices[spread[1]].element.reset(ElementType.JELLY);
//执行回调
callback()
})
} else {
callback()
if (spread === 0) {
//如果无果冻了
this.hasJelly = false;
}
}
}
private eggMotion(thisObj: MainScene, callback: Function) {
if (!this.hasEgg) {
callback();
return
}
//逻辑再写,暂时没有
callback();
}
}
/**
* 判断果冻是否存在
* @param lattices
* @return false表示不存在,true表示存在
*/
function judgeJellyExist(lattices: Lattice[]) {
for (var i = 0; i < lattices.length; i++) {
var lattice = lattices[i]
//没有格子或没有元素或不是果冻 跳过
if (!lattice || !lattice.element || lattice.element.type != ElementType.JELLY) continue
return true
}
return false;
}
/**
* 判断鸡蛋是否存在
* @param lattices
* @return false表示不存在,true表示存在
*/
function judgeEggExist(lattices: Lattice[]) {
for (var i = 0; i < lattices.length; i++) {
var lattice = lattices[i]
//没有格子或没有元素或不是果冻 跳过
if (!lattice || !lattice.element || lattice.element.type != ElementType.CHICKEN_EGG) continue
return true
}
return false;
}
/**
* 获取能蔓延的
* @param lattices
*/
function getJellySpreadAni(lattices: Lattice[]) {
var indexs: number[] = [];
var hasJelly: boolean = false;
for (var i = 0; i < lattices.length; i++) {
var lattice = lattices[i]
//没有格子或没有元素或不是果冻 跳过
if (!lattice || !lattice.element || lattice.element.type != ElementType.JELLY) continue
indexs.push(i);
}
if (!indexs.length) return 0
while (indexs.length) {
var rand = Math.floor(Math.random() * indexs.length);
var randIndex = indexs.splice(rand, 1)[0];
var index = judgeSpread(randIndex, lattices);
if (index != null) {
//能蔓延,返回自身索引和蔓延的索引
return [randIndex, index];
}
}
return null;
}
/**
* 判断可蔓延的方向,并返回蔓延的格子索引
* @param index
* @return 没有返回null,注意判断时可能有0
*/
function judgeSpread(index: number, lattices: Lattice[]): number {
//四个方向尽量随机
var arr = [index - Tool.colNum, index + Tool.colNum];
var rc = Tool.indexToRc(index);
var col = rc[1];
//列数大于0才可能有左边格子
if (col > 0) arr.push(index - 1);
//列数不为最右边
if (col < Tool.colNum - 1) arr.push(index + 1);
while (arr.length) {
var rand = Math.floor(Math.random() * arr.length);
var i = arr.splice(rand, 1)[0];
if (lattices[i] &&
lattices[i].element &&
lattices[i].element.type <= 4) {
return i
}
}
return null
}
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