Commit 5810d6a4 authored by wildfirecode's avatar wildfirecode

1

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