Commit 2f3ce460 authored by wildfirecode's avatar wildfirecode

1

parent 83405de5
...@@ -4,8 +4,8 @@ import { loadSvga } from "../loadSvga"; ...@@ -4,8 +4,8 @@ import { loadSvga } from "../loadSvga";
export const createSandDisAni = async (x, y, p) => { export const createSandDisAni = async (x, y, p) => {
const movieclip: any = await loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga'); const movieclip: any = await loadSvga(getResPath() + 'resource/assets/svgas/sand_dis.svga');
p.addChild(movieclip); p.addChild(movieclip);
movieclip.anchorOffsetX= 100; movieclip.anchorOffsetX = 100;
movieclip.anchorOffsetY= 100; movieclip.anchorOffsetY = 100;
// movieclip.scaleX=movieclip.scaleY=0.5; // movieclip.scaleX=movieclip.scaleY=0.5;
movieclip.x = x; movieclip.x = x;
movieclip.y = y; movieclip.y = y;
......
...@@ -698,7 +698,7 @@ export default class MainScene extends Scene { ...@@ -698,7 +698,7 @@ export default class MainScene extends Scene {
var connectedLat = connectedLats[i]; var connectedLat = connectedLats[i];
if (!connectedLat || !connectedLat.length) continue; if (!connectedLat || !connectedLat.length) continue;
if (!this.lattices[connectedLat[0]]) { if (!this.lattices[connectedLat[0]]) {
throw new Error('联通干了个空的@沈豪洲(牛奶) '+JSON.stringify(connectedLat)) throw new Error('联通干了个空的@沈豪洲(牛奶) ' + JSON.stringify(connectedLat))
} }
try { try {
this.lattices[connectedLat[0]].down = connectedLat[1]; this.lattices[connectedLat[0]].down = connectedLat[1];
......
import { Lattice } from "../something/class/Lattice"; import { Lattice } from "../something/class/Lattice";
import ConveyorAni, { getConveyorAni } from "../something/conveyor/ConveyorAni"; import ConveyorAni, { getConveyorAni } from "../something/conveyor/ConveyorAni";
import { ARROW_DIR, fillConveyor, findTarget, getArrowDir } from "../something/conveyor/conveyorTool"; import { ARROW_DIR, fillConveyor, findTarget, getArrowDir, getOneConveyorMask, getElementMask } from "../something/conveyor/conveyorTool";
import { Tool } from "../something/Tool"; import { Tool } from "../something/Tool";
import MainScene from "./MainScene"; import MainScene from "./MainScene";
import wait from "../../libs/new_tc/wait";
import cloneElement from "../something/cloneElement";
export const CONVERYOR_ANI_DUR = 500; export const CONVERYOR_ANI_DUR = 500;
const getTargetIndexs = (conveyor: number[]) => { const getTargetIndexs = (conveyor: number[]) => {
const dir = getArrowDir(conveyor); const dir = getArrowDir(conveyor);
...@@ -15,9 +17,71 @@ const getTargetIndexs = (conveyor: number[]) => { ...@@ -15,9 +17,71 @@ const getTargetIndexs = (conveyor: number[]) => {
return list; return list;
} }
const getLastListIndex = (conveyor) => {
const dir = getArrowDir(conveyor);
const list = fillConveyor(conveyor);
switch (dir) {
case ARROW_DIR.DOWN:
case ARROW_DIR.RIGHT:
return list.length - 1
case ARROW_DIR.UP:
case ARROW_DIR.LEFT:
return 0;
}
};
const getLastPosition = (conveyor, p) => {
const dir = getArrowDir(conveyor);
switch (dir) {
case ARROW_DIR.DOWN:
p[1] += Tool.height;
break;
case ARROW_DIR.RIGHT:
p[0] += Tool.height;
break;
case ARROW_DIR.UP:
p[1] -= Tool.height;
break;
case ARROW_DIR.LEFT:
p[0] -= Tool.height;
break;
};
return p;
}
const getFirstPosition = (conveyor, p) => {
const dir = getArrowDir(conveyor);
switch (dir) {
case ARROW_DIR.DOWN:
p[1] -= Tool.height;
break;
case ARROW_DIR.RIGHT:
p[0] -= Tool.height;
break;
case ARROW_DIR.UP:
p[1] += Tool.height;
break;
case ARROW_DIR.LEFT:
p[0] += Tool.height;
break;
};
return p;
}
const getTargetConveyor = (thisObj: MainScene, targetIndex: number) => {
const conveyors = thisObj.chapterData.map.conveyor;
for (const conveyor of conveyors) {
if (targetIndex == conveyor[0] || targetIndex == conveyor[1])
return conveyor;
}
};
export default async (thisObj: MainScene) => { export default async (thisObj: MainScene) => {
//移动的动画,如果是两头的需要一个带遮罩的动画,会涉及元素的复制 //移动的动画,如果是两头的需要一个带遮罩的动画,会涉及元素的复制
//复制的元素为了保险,只做动画用。
//检查与其他元素的兼容性,比如带有svga的独眼怪、果冻怪等等 //检查与其他元素的兼容性,比如带有svga的独眼怪、果冻怪等等
//糖果兼容
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 = []; //所有轨道元素组的列表
...@@ -59,17 +123,53 @@ export default async (thisObj: MainScene) => { ...@@ -59,17 +123,53 @@ 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 targetLattices = targetLatticesList[i]; const targetLattices = targetLatticesList[i];
const targetIndexs = targetIndexsList[i]; const targetIndexs = targetIndexsList[i];
const lattices = latticesList[i]; const lattices = latticesList[i];
const lastListIndex = getLastListIndex(conveyor);
elements.forEach((ele, eleIndex) => { elements.forEach((ele, eleIndex) => {
targetLattices[eleIndex].element = ele; targetLattices[eleIndex].element = ele;
if(!ele)return;
const targetP = Tool.getPositionByIndex(targetIndexs[eleIndex]); const targetP = Tool.getPositionByIndex(targetIndexs[eleIndex]);
const promise = new Promise((r) => { const promise = new Promise((r) => {
//这里判断哪个是尾部的元素.
//移动尾部的真实的元素,clone一个尾部元素作为头部动画,头部动画播放完成后用真实的元素替换掉
if (lastListIndex == eleIndex) { //轨道最后一个需要用遮罩动画,如果底部没有地图了,那么可以不遮罩
const lastItemTargetP = getLastPosition(conveyor, [ele.x, ele.y]);
const mask = getElementMask(ele.x, ele.y);
elementContainer.addChild(mask);
ele.mask = mask;
egret.Tween.get(ele).to({ x: lastItemTargetP[0], y: lastItemTargetP[1] }, CONVERYOR_ANI_DUR).call(() => {
ele.x = targetP[0];
ele.y = targetP[1];
elementContainer.removeChild(mask);
ele.mask = null;
r();
});
//clone元素的动画
const targetIndex = targetIndexs[eleIndex];
const targetConveyor = getTargetConveyor(thisObj, targetIndex)
const firstItemTargetP = getFirstPosition(targetConveyor, [targetP[0], targetP[1]]);
const clonedElement = cloneElement(ele);
clonedElement.x = firstItemTargetP[0];
clonedElement.y = firstItemTargetP[1];
const mask2 = getElementMask(targetP[0], targetP[1]);
elementContainer.addChild(mask2);
clonedElement.mask = mask2;
elementContainer.addChild(clonedElement);
egret.Tween.get(clonedElement).to({ x: targetP[0], y: targetP[1] }, CONVERYOR_ANI_DUR).call(() => {
elementContainer.removeChild(mask2);
elementContainer.removeChild(clonedElement);
clonedElement.mask = null;
});
} else {
egret.Tween.get(ele).to({ x: targetP[0], y: targetP[1] }, CONVERYOR_ANI_DUR).call(r); egret.Tween.get(ele).to({ x: targetP[0], y: targetP[1] }, CONVERYOR_ANI_DUR).call(r);
}
}); });
promiseList.push(promise) promiseList.push(promise)
}); });
...@@ -77,7 +177,7 @@ export default async (thisObj: MainScene) => { ...@@ -77,7 +177,7 @@ export default async (thisObj: MainScene) => {
for (const key in thisObj['conveyorAniList']) { for (const key in thisObj['conveyorAniList']) {
if (thisObj['conveyorAniList'].hasOwnProperty(key)) { if (thisObj['conveyorAniList'].hasOwnProperty(key)) {
const ani:ConveyorAni = thisObj['conveyorAniList'][key]; const ani: ConveyorAni = thisObj['conveyorAniList'][key];
ani.play(); ani.play();
} }
} }
......
...@@ -42,7 +42,7 @@ export default async (thisObj: MainScene) => { ...@@ -42,7 +42,7 @@ export default async (thisObj: MainScene) => {
sandMoveAni = new SandMoveAni(); sandMoveAni = new SandMoveAni();
} }
thisObj.map.addChild(sandMoveAni); thisObj.map.addChild(sandMoveAni);
promiseList.push(sandMoveAni.play(from, p,sand)); promiseList.push(sandMoveAni.play(from, p, sand));
// sands.push(sand); // sands.push(sand);
} }
} }
......
...@@ -17,10 +17,10 @@ export default (thisobj: MainScene, from: number[], to: number[]) => { ...@@ -17,10 +17,10 @@ export default (thisobj: MainScene, from: number[], to: number[]) => {
.to({ scaleX: 1, scaleY: 1 }, 100) .to({ scaleX: 1, scaleY: 1 }, 100)
.wait(300) .wait(300)
.set({ anchorOffsetY: tex.textureHeight / 2, y: from[1] + 20 - tex.textureHeight / 2 }) .set({ anchorOffsetY: tex.textureHeight / 2, y: from[1] + 20 - tex.textureHeight / 2 })
.to({x:to[0],y:to[1]},500) .to({ x: to[0], y: to[1] }, 500)
.to({ scaleX: 0.9, scaleY: 1.1 }, 100) .to({ scaleX: 0.9, scaleY: 1.1 }, 100)
.to({ scaleX: 1.05, scaleY: 0.95 }, 100) .to({ scaleX: 1.05, scaleY: 0.95 }, 100)
.to({ scaleX: 1, scaleY: 1 }, 100).call(()=>{ .to({ scaleX: 1, scaleY: 1 }, 100).call(() => {
thisobj.removeChild(pic); thisobj.removeChild(pic);
}); });
setTimeout(() => { setTimeout(() => {
......
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 }] } }
]
\ No newline at end of file
...@@ -3,5 +3,85 @@ import { PassType } from "../enum/PassType"; ...@@ -3,5 +3,85 @@ import { PassType } from "../enum/PassType";
import { ElementType } from "../enum/ElementType"; 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, 4],
bubbleProbability: 0,
stepCount: 999,
passTarget: {
type: PassType.ELEMENT_TARGET,
elements: [
{
type: ElementType.CHICKEN,
count: 995,
},
],
},
starScores: [1000, 5000, 10000],
map: {
lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
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, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
conveyor: [
// [29,56],
// [51, 33],
[29,56],
[57,60],
[51, 33],
[32, 30],
// [57,60],
// [32, 30],
],
conveyorConnectedLats: [
// [56,51],
// [33,29],
[56,57],
[60,51],
[33, 32],
[30, 29],
// [60,32],
// [30,57],
],
generateLats: [
{ index: 11, type: [0], cus: [] },
{ index: 15, type: [0], cus: [] },
],
// connectedLats: [[76, 11]],
elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
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, 0, 1, 1, 11, 11, 11, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0,
],
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: [70, 71, 72, 73]
},
}
] ]
\ No newline at end of file
...@@ -2,6 +2,10 @@ import { CandyBaseElementType } from "../enum/ElementType"; ...@@ -2,6 +2,10 @@ import { CandyBaseElementType } from "../enum/ElementType";
import { Element } from "./Element"; import { Element } from "./Element";
export class Candy extends egret.Sprite { export class Candy extends egret.Sprite {
resetStep(step: number) {
this._step=step;
this.changeText();
}
ele: Element; ele: Element;
nextState(): any { nextState(): any {
return new Promise(async (r) => { return new Promise(async (r) => {
......
...@@ -418,6 +418,7 @@ export class Element extends eui.Component { ...@@ -418,6 +418,7 @@ export class Element extends eui.Component {
* @param type 只应该是基础元素和特殊元素 * @param type 只应该是基础元素和特殊元素
*/ */
reset(type: ElementType) { reset(type: ElementType) {
this._isMonsterJelly=false;
this._isNeb = false; this._isNeb = false;
this.alpha = this.scaleX = this.scaleY = 1; this.alpha = this.scaleX = this.scaleY = 1;
this.showImage.anchorOffsetX = 0; this.showImage.anchorOffsetX = 0;
...@@ -488,6 +489,7 @@ export class Element extends eui.Component { ...@@ -488,6 +489,7 @@ export class Element extends eui.Component {
resetType(type: ElementType) { resetType(type: ElementType) {
//如果类型一致,return //如果类型一致,return
if (this._type == type) return if (this._type == type) return
this._isMonsterJelly=false;
//如果目标类型不是基础元素 或者原先不是基础元素 //如果目标类型不是基础元素 或者原先不是基础元素
if (FiveBaseElementTypes.indexOf(type) == -1 || if (FiveBaseElementTypes.indexOf(type) == -1 ||
FiveBaseElementTypes.indexOf(this._type) == -1 FiveBaseElementTypes.indexOf(this._type) == -1
...@@ -644,6 +646,10 @@ export class Element extends eui.Component { ...@@ -644,6 +646,10 @@ export class Element extends eui.Component {
return this.states[state] return this.states[state]
} }
getStates(): any {
return this.states;
}
/** /**
* 克隆一个 * 克隆一个
* 类型 * 类型
......
import { Tool } from "./Tool";
import { Element } from "./class/Element";
export default (fromElement:Element) => {
let ele = Tool.getElement(fromElement.type);
//特效加上
ele.effectType = fromElement.effectType;
//状态加上
for (var i = 0; i < fromElement.getStates().length; i++) {
let state = fromElement.getStates()[i];
if (!state) continue;
ele.setState(i, true, fromElement.type)
}
//位置信息
ele.x = fromElement.x;
ele.y = fromElement.y;
if(fromElement.isMonsterJelly) {
ele.isMonsterJelly=true;
}
if(fromElement.candy) {
ele.resetToCandyView(fromElement.candy.baseElement);
ele.candy.resetStep(fromElement.candy.step);
}
return ele;
}
\ No newline at end of file
...@@ -122,3 +122,14 @@ export const getOneConveyorMask = (list: number[], dir) => { ...@@ -122,3 +122,14 @@ export const getOneConveyorMask = (list: number[], dir) => {
} }
return s; return s;
} }
export const getElementMask = (x,y) => {
const shape = new egret.Shape();
shape.x=x;
shape.y=y;
shape.graphics.beginFill(0, 1);
shape.graphics.drawRect(-Tool.width / 2, -Tool.width / 2, Tool.width, Tool.height);
shape.graphics.endFill();
return shape;
}
\ No newline at end of file
...@@ -78,6 +78,10 @@ export class AiControl { ...@@ -78,6 +78,10 @@ export class AiControl {
this.hasFesEleBig = judgeFesEleBigExist(lattices) this.hasFesEleBig = judgeFesEleBigExist(lattices)
} }
updateEggs(lattices: Lattice[]) {
this.eggs = getEggs(lattices);
}
fesEleMotion(thisObj: MainScene, callback: Function) { fesEleMotion(thisObj: MainScene, callback: Function) {
//无节日大红包,直接回调, //无节日大红包,直接回调,
if (!this.hasFesEleBig) { if (!this.hasFesEleBig) {
...@@ -300,6 +304,7 @@ export class AiControl { ...@@ -300,6 +304,7 @@ export class AiControl {
* @param callback * @param callback
*/ */
eggMotion(thisObj: MainScene, callback: Function) { eggMotion(thisObj: MainScene, callback: Function) {
this.updateEggs(thisObj.lattices);
//无蛋,直接回调 //无蛋,直接回调
if (!this.eggs.length) { if (!this.eggs.length) {
callback(); callback();
......
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
"timestamp": 1573210800000, "timestamp": 1573210800000,
"data": { "data": {
"currentRemainTimes": 0, "currentRemainTimes": 0,
"currentSession1": { "currentSession": {
"sessionIndex": 6, "sessionIndex": 6,
"startTime": 1573210800000, "startTime": 1573210800000,
"endTime": 1573299903000, "endTime": 1573299903000,
"limitScore": 10 "limitScore": 10
}, },
"nextSession1": { "nextSession": {
"sessionIndex": 10, "sessionIndex": 10,
"startTime": 1573440915952, "startTime": 1573440915952,
"endTime": 1573299903000, "endTime": 1573299903000,
"limitScore": 10 "limitScore": 10
}, },
"canJoin1": true "canJoin": true
} }
} }
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