Commit 5810d6a4 authored by wildfirecode's avatar wildfirecode

1

parent 37af37d1
...@@ -163,6 +163,7 @@ for (let i = 1; i < 999; i++) { /// TODO 测试 ...@@ -163,6 +163,7 @@ for (let i = 1; i < 999; i++) { /// TODO 测试
const festivalIndex: number = 40; const festivalIndex: number = 40;
export default class MainScene extends Scene { export default class MainScene extends Scene {
private _converyorTag;
get skinKey() { get skinKey() {
return 'Main2' return 'Main2'
} }
...@@ -1259,6 +1260,7 @@ export default class MainScene extends Scene { ...@@ -1259,6 +1260,7 @@ export default class MainScene extends Scene {
} }
} }
setTimeout(() => { setTimeout(() => {
this._converyorTag = true;
this.eliminate(); this.eliminate();
}, 200) }, 200)
break; break;
...@@ -1270,6 +1272,7 @@ export default class MainScene extends Scene { ...@@ -1270,6 +1272,7 @@ export default class MainScene extends Scene {
Tool.getPositionByIndex(index) Tool.getPositionByIndex(index)
) )
} }
this._converyorTag = true;
this.eliminate(); this.eliminate();
break; break;
case PropType.CHANCE_NUM: case PropType.CHANCE_NUM:
...@@ -1296,6 +1299,7 @@ export default class MainScene extends Scene { ...@@ -1296,6 +1299,7 @@ export default class MainScene extends Scene {
mouseDownE(e: egret.TextEvent) { mouseDownE(e: egret.TextEvent) {
// if (!this.enableTouch) return // if (!this.enableTouch) return
this._converyorTag=true;
var self = this; var self = this;
if (e.target.parent instanceof Element) { if (e.target.parent instanceof Element) {
//去掉提示动画 //去掉提示动画
...@@ -1321,6 +1325,7 @@ export default class MainScene extends Scene { ...@@ -1321,6 +1325,7 @@ export default class MainScene extends Scene {
} }
mouseMoveE(e) { mouseMoveE(e) {
this._converyorTag=true;
if (this.SELECTED && e.target.parent instanceof Element) { if (this.SELECTED && e.target.parent instanceof Element) {
if (!Tool.judgeChosen(e.target.parent)) return if (!Tool.judgeChosen(e.target.parent)) return
if (Tool.checkNeb(e.target.parent, this.SELECTED)) { if (Tool.checkNeb(e.target.parent, this.SELECTED)) {
...@@ -2069,7 +2074,10 @@ export default class MainScene extends Scene { ...@@ -2069,7 +2074,10 @@ export default class MainScene extends Scene {
this.eliminate(); this.eliminate();
return return
} }
if (this._converyorTag) {
await doConveyorAI(this); await doConveyorAI(this);
this._converyorTag = false;
}
await doSandAI(this); await doSandAI(this);
const doHoneyPotAIResult = await doHoneyPotAI(this); const doHoneyPotAIResult = await doHoneyPotAI(this);
if (doHoneyPotAIResult.length > 0) {//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步 if (doHoneyPotAIResult.length > 0) {//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
......
...@@ -77,16 +77,12 @@ const getTargetConveyor = (thisObj: MainScene, targetIndex: number) => { ...@@ -77,16 +77,12 @@ const getTargetConveyor = (thisObj: MainScene, targetIndex: number) => {
}; };
export default async (thisObj: MainScene) => { export default async (thisObj: MainScene) => {
//移动的动画,如果是两头的需要一个带遮罩的动画,会涉及元素的复制
//复制的元素为了保险,只做动画用。
//检查与其他元素的兼容性,比如带有svga的独眼怪、果冻怪等等
//糖果兼容
const { elementContainer } = thisObj; const { elementContainer } = thisObj;
const conveyorList = thisObj.chapterData.map.conveyor; const conveyorList = thisObj.chapterData.map.conveyor;
if (!conveyorList) return; if (!conveyorList) return;
const elementsList = []; //所有轨道元素组的列表 const elementsList = []; //所有轨道元素组的列表
const targetLatticesList: Lattice[][] = []; //所有轨道目标地图组的列表 const targetLatticesList: Lattice[][] = []; //所有轨道目标地图组的列表
const latticesList = []; //所有轨道当前地图组的列表 const latticesList:Lattice[][] = []; //所有轨道当前地图组的列表
const targetIndexsList = []; const targetIndexsList = [];
let listItems = []; let listItems = [];
...@@ -108,8 +104,10 @@ export default async (thisObj: MainScene) => { ...@@ -108,8 +104,10 @@ export default async (thisObj: MainScene) => {
targetIndexs[0] = foundTarget; targetIndexs[0] = foundTarget;
} }
console.log(list, targetIndexs); // console.log(list, targetIndexs);
const elements = list.map(index => thisObj.lattices[index].element);//当前传送带元素 const elements = list.map(index =>
thisObj.lattices[index].element
);//当前传送带元素
const lattices = list.map(index => thisObj.lattices[index]);//当前的lattices const lattices = list.map(index => thisObj.lattices[index]);//当前的lattices
const targetLattices = targetIndexs.map(index => thisObj.lattices[index]); const targetLattices = targetIndexs.map(index => thisObj.lattices[index]);
...@@ -123,8 +121,6 @@ export default async (thisObj: MainScene) => { ...@@ -123,8 +121,6 @@ export default async (thisObj: MainScene) => {
lattices.forEach(lat => lat.element = null); lattices.forEach(lat => lat.element = null);
}); });
const promiseList: Promise<any>[] = []; const promiseList: Promise<any>[] = [];
elementsList.forEach((elements, i) => { elementsList.forEach((elements, i) => {
const conveyor = conveyorList[i]; const conveyor = conveyorList[i];
...@@ -134,7 +130,13 @@ export default async (thisObj: MainScene) => { ...@@ -134,7 +130,13 @@ export default async (thisObj: MainScene) => {
const lastListIndex = getLastListIndex(conveyor); const lastListIndex = getLastListIndex(conveyor);
elements.forEach((ele, eleIndex) => { elements.forEach((ele, eleIndex) => {
targetLattices[eleIndex].element = ele; targetLattices[eleIndex].element = ele;
if(!ele)return; if (!ele) {
const currentEleIndex = lattices[eleIndex].index;
const targetEleIndex = targetLattices[eleIndex].index;
const emptyIndex = thisObj.emptys.indexOf(currentEleIndex);
thisObj.emptys[emptyIndex]=targetEleIndex;
return;
}
const targetP = Tool.getPositionByIndex(targetIndexs[eleIndex]); const targetP = Tool.getPositionByIndex(targetIndexs[eleIndex]);
const promise = new Promise((r) => { const promise = new Promise((r) => {
//这里判断哪个是尾部的元素. //这里判断哪个是尾部的元素.
......
import { ChapterData } from "../interface/ChapterData"; import { ChapterData } from "../interface/ChapterData";
import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType";
//501-525 //501-525
export const Chapters20: ChapterData[] = [ export const Chapters20: ChapterData[] = [
{ baseElementTypes: [0, 1, 2, 3, 4], bubbleProbability: 0, stepCount: 25, passTarget: { type: 1, elements: [{ type: 2, count: 88 }] }, starScores: [15000, 20000, 25000], map: { lattices: [1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 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, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 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], connectedLats: [[31, 49]], conveyor: [[24, 60], [59, 56], [47, 20]], conveyorConnectedLats: [[60, 59], [56, 47], [20, 24]], elements: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 12, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [], generateLats: [{ index: 0, type: null }, { index: 1, type: null }, { index: 2, type: null }, { index: 3, type: null }, { index: 5, type: null }, { index: 6, type: null }, { index: 7, type: null }, { index: 8, type: null }, { index: 13, type: null }] } } {
baseElementTypes: [0, 1, 2, 3], bubbleProbability: 0, stepCount: 27, passTarget: { type: 1, elements: [{ type: 3, count: 98 }] }, starScores: [15000, 20000, 25000], map: {
lattices: [1, 0, 1, 0, 1, 0, 1, 0, 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, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1], connectedLats: [],
conveyor: [[2, 65]],
conveyorConnectedLats: [[65, 2]], elements: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1, 1, 1, 1, 1, 1, 12, 1, 12, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 4
, 1, 2, 1, 2, 1, 4, 1, 1, 4,
12, 2, 12, 2, 12, 4, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [], generateLats: [{ index: 0, type: null }, { index: 2, type: null }, { index: 4, type: null }, { index: 6, type: null }, { index: 8, type: null }, { index: 10, type: null }, { index: 12, type: null }, { index: 14, type: null }, { index: 16, type: null }]
}
}
] ]
\ No newline at end of file
...@@ -3,9 +3,12 @@ import { ChapterData } from "../interface/ChapterData"; ...@@ -3,9 +3,12 @@ import { ChapterData } from "../interface/ChapterData";
export const Chapters20: ChapterData[] = [ export const Chapters20: ChapterData[] = [
{ {
baseElementTypes: [0, 1, 2, 3], bubbleProbability: 0, stepCount: 27, passTarget: { type: 1, elements: [{ type: 3, count: 98 }] }, starScores: [15000, 20000, 25000], map: { baseElementTypes: [0, 1, 2, 3], bubbleProbability: 0, stepCount: 27, passTarget: { type: 1, elements: [{ type: 3, count: 98 }] }, starScores: [15000, 20000, 25000], map: {
lattices: [1, 0, 2, 0, 1, 0, 1, 0, 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, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1], connectedLats: [], lattices: [1, 0, 1, 0, 1, 0, 1, 0, 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, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1], connectedLats: [],
conveyor: [[2, 65], [6, 69], [67, 4]], conveyor: [[2, 65]],
conveyorConnectedLats: [[65, 2], [69, 6], [4, 67]], elements: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 1, 12, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 4, 1, 2, 1, 2, 1, 4, 1, 1, 4, 12, 2, 12, 2, 12, 4, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [], generateLats: [{ index: 0, type: null }, { index: 2, type: null }, { index: 4, type: null }, { index: 6, type: null }, { index: 8, type: null }, { index: 10, type: null }, { index: 12, type: null }, { index: 14, type: null }, { index: 16, type: null }] conveyorConnectedLats: [[65, 2]], elements: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
, 1, 1, 1, 1, 1, 1, 12, 1, 12, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 4
, 1, 2, 1, 2, 1, 4, 1, 1, 4,
12, 2, 12, 2, 12, 4, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1], baseElements: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], recycles: [], generateLats: [{ index: 0, type: null }, { index: 2, type: null }, { index: 4, type: null }, { index: 6, type: null }, { index: 8, type: null }, { index: 10, type: null }, { index: 12, type: null }, { index: 14, type: null }, { index: 16, type: null }]
} }
} }
] ]
\ No newline at end of file
...@@ -155,16 +155,17 @@ export class Element extends eui.Component { ...@@ -155,16 +155,17 @@ export class Element extends eui.Component {
}); });
} }
resetToMonsterView(res: ElementType) { resetToMonsterView(res: ElementType,statusNum = 0) {
this.changeSource("ele" + res + "_png"); this.changeSource("ele" + res + "_png");
this.monster = new Monster(res, this.type); this.monster = new Monster(res, this.type, statusNum);
this.addChild(this.monster); this.addChild(this.monster);
this.showImage.alpha = 0; this.showImage.alpha = 0;
} }
resetToFishView() {
resetToFishView(s='toStandBy') {
this._fishState = 0; this._fishState = 0;
this._isNeb = false; this._isNeb = false;
this['fish'] = new Fish(); this['fish'] = new Fish(s);
this.addChild(this['fish']); this.addChild(this['fish']);
this.changeSource("ele33_0_png"); this.changeSource("ele33_0_png");
this.showImage.alpha = 0; this.showImage.alpha = 0;
......
...@@ -10,31 +10,40 @@ const frames = [ ...@@ -10,31 +10,40 @@ const frames = [
]; ];
export class Fish extends eui.Component { export class Fish extends eui.Component {
_mv; _mv;
constructor() { state;
constructor(s = 'toStandBy') {
super(); super();
this.initSvga(); this.initSvga(s);
} }
async initSvga() { async initSvga(s) {
const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/fish.svga'); const mv: any = await loadSvga(getResPath() + 'resource/assets/svgas/fish.svga');
this._mv = mv; this._mv = mv;
this.addChild(mv); this.addChild(mv);
mv.anchorOffsetX = 80 / 2; mv.anchorOffsetX = 80 / 2;
mv.anchorOffsetY = 80 / 2; mv.anchorOffsetY = 80 / 2;
this.addEvents(); this.addEvents();
if (s == 'toStandBy')
this.toStandBy(); this.toStandBy();
if (s == 'toActive')
this.toActive();
if (s == 'toExplose')
this.toExplose();
} }
toStandBy() { toStandBy() {
this.state = 'toStandBy';
this._mv.gotoAndPlay(1); this._mv.gotoAndPlay(1);
this._start = 1 this._start = 1
this._end = 180 this._end = 180
} }
toActive() { toActive() {
this.state = 'toActive';
this._mv.gotoAndPlay(181); this._mv.gotoAndPlay(181);
this._start = -1 this._start = -1
this._end = -1 this._end = -1
} }
toExplose() { toExplose() {
this.state = 'toExplose';
this._mv.stop(); this._mv.stop();
// this._mv.gotoAndPlay(361); // this._mv.gotoAndPlay(361);
// this._start = -1 // this._start = -1
...@@ -52,7 +61,7 @@ export class Fish extends eui.Component { ...@@ -52,7 +61,7 @@ export class Fish extends eui.Component {
this._start = 241; this._start = 241;
this._end = 360; this._end = 360;
} }
if (this._mv.currentFrame == (361+1)) { if (this._mv.currentFrame == (361 + 1)) {
this._start = -1; this._start = -1;
this._end = -1; this._end = -1;
this._mv.stop(); this._mv.stop();
......
...@@ -6,9 +6,22 @@ const frames = [ ...@@ -6,9 +6,22 @@ const frames = [
[1, 120], [1, 120],
[121, 360], [121, 360],
[361, 600], [361, 600],
[601, 960], [601, 841],
]; ];
export class Monster extends eui.Component { export class Monster extends eui.Component {
resetStatusNum(statusNum) {
this._statusNum=statusNum;
if (this._statusNum > 4) {
this._statusNum = 4;
this.removeEvents();
}
//播放动画,动画时间要短200ms以内
if (this._statusNum <= 3) {
this.changeSource();
}
}
async nextStatus() { async nextStatus() {
this._statusNum++; this._statusNum++;
if (this._statusNum > 4) { if (this._statusNum > 4) {
...@@ -43,6 +56,7 @@ export class Monster extends eui.Component { ...@@ -43,6 +56,7 @@ export class Monster extends eui.Component {
* 状态变化 0,1,2,3 * 状态变化 0,1,2,3
*/ */
private _statusNum: number; private _statusNum: number;
get statusNum(){return this._statusNum}
res: ElementType; res: ElementType;
_mv; _mv;
...@@ -82,7 +96,7 @@ export class Monster extends eui.Component { ...@@ -82,7 +96,7 @@ export class Monster extends eui.Component {
} }
changeSource() { changeSource() {
if (this._mv) if (this._mv && frames[this._statusNum])
this._mv.gotoAndPlay(frames[this._statusNum][0]); this._mv.gotoAndPlay(frames[this._statusNum][0]);
} }
} }
\ No newline at end of file
import { Tool } from "./Tool"; import { Tool } from "./Tool";
import { Element } from "./class/Element"; import { Element } from "./class/Element";
import { ElementType } from "./enum/ElementType";
export default (fromElement:Element) => { export default (fromElement: Element) => {
let ele = Tool.getElement(fromElement.type); let ele = Tool.getElement(fromElement.type);
//特效加上 //特效加上
ele.effectType = fromElement.effectType; ele.effectType = fromElement.effectType;
...@@ -15,13 +16,23 @@ export default (fromElement:Element) => { ...@@ -15,13 +16,23 @@ export default (fromElement:Element) => {
ele.x = fromElement.x; ele.x = fromElement.x;
ele.y = fromElement.y; ele.y = fromElement.y;
if(fromElement.isMonsterJelly) { if (fromElement.isMonsterJelly) {
ele.isMonsterJelly=true; ele.isMonsterJelly = true;
} }
if(fromElement.candy) { if (fromElement.candy) {
ele.resetToCandyView(fromElement.candy.baseElement); ele.resetToCandyView(fromElement.candy.baseElement);
ele.candy.resetStep(fromElement.candy.step); ele.candy.resetStep(fromElement.candy.step);
} }
if (fromElement.type == ElementType.JELLY_MONSTER) {
ele.resetMonster();
}
if (fromElement.monster) {
ele.resetToMonsterView(fromElement.monster.res, fromElement.monster.statusNum);
// ele.monster.resetStatusNum(fromElement.monster.statusNum);
}
if (fromElement.type == ElementType.FISH) {
ele.resetToFishView(fromElement['fish'].state);
}
return ele; return ele;
} }
\ 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