Commit 908db4b2 authored by wildfirecode's avatar wildfirecode

1

parent e9bcbca9
import { Lattice } from "../something/class/Lattice";
import ConveyorAni, { getConveyorAni } from "../something/conveyor/ConveyorAni";
import { ARROW_DIR, fillConveyor, findTarget, getArrowDir } from "../something/conveyor/conveyorTool";
import MainScene from "./MainScene";
import { Tool } from "../something/Tool";
import { Lattice } from "../something/class/Lattice";
import MainScene from "./MainScene";
export const CONVERYOR_ANI_DUR = 200;
const getTargetIndexs = (conveyor: number[]) => {
const dir = getArrowDir(conveyor);
let list = fillConveyor(conveyor);
......@@ -14,23 +15,6 @@ const getTargetIndexs = (conveyor: number[]) => {
return list;
}
let conveyorAniList: { [key: string]: ConveyorAni; } = null;
//单个皮带转动动效
class ConveyorAni {
private orign: any[];
private list: any[];
private views: any[] = []
constructor(conveyor) {
this.list = fillConveyor(conveyor);
this.orign = JSON.parse(JSON.stringify(this.list));
this.views = this.list;
}
play() {
}
}
export default async (thisObj: MainScene) => {
//加上传送带的动画
//移动的动画,如果是两头的需要一个带遮罩的动画
......@@ -43,12 +27,13 @@ export default async (thisObj: MainScene) => {
const targetIndexsList = [];
let listItems = [];
if (!conveyorAniList) conveyorAniList = {};
if (!thisObj['conveyorAniList']) thisObj['conveyorAniList'] = {};
for (const conveyor of conveyorList) {
const list = fillConveyor(conveyor);
listItems = listItems.concat(list);
const targetIndexs = getTargetIndexs(conveyor);
conveyorAniList[conveyor.toString()] = new ConveyorAni(conveyor);
if (!thisObj['conveyorAniList'][conveyor.toString()])
thisObj['conveyorAniList'][conveyor.toString()] = getConveyorAni(conveyor, thisObj);
const dir = getArrowDir(conveyor);
let foundTarget: number;
......@@ -85,11 +70,18 @@ export default async (thisObj: MainScene) => {
targetLattices[eleIndex].element = ele;
const targetP = Tool.getPositionByIndex(targetIndexs[eleIndex]);
const promise = new Promise((r) => {
egret.Tween.get(ele).to({ x: targetP[0], y: targetP[1] }, 200).call(r);
egret.Tween.get(ele).to({ x: targetP[0], y: targetP[1] }, CONVERYOR_ANI_DUR).call(r);
});
promiseList.push(promise)
});
});
for (const key in thisObj['conveyorAniList']) {
if (thisObj['conveyorAniList'].hasOwnProperty(key)) {
const ani:ConveyorAni = thisObj['conveyorAniList'][key];
ani.play();
}
}
await Promise.all(promiseList);
}
\ No newline at end of file
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
import MainScene from "../../mainScene/MainScene";
import { Tool } from "../Tool";
import { ARROW_DIR, fillConveyor, getArrowDir } from "./conveyorTool";
//单个皮带转动动效
export default class ConveyorAni {
protected orign: any[];
protected list: any[];
protected views: any[] = []
protected _dir;
constructor(conveyor, thisobj: MainScene) {
this.list = fillConveyor(conveyor);
this.orign = JSON.parse(JSON.stringify(this.list));
this.views = this.list.map(index => thisobj.conveyorMap[index]);
this._dir = getArrowDir(conveyor);
}
play() { }
}
class ConveyorDownAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ y: view.y + Tool.height }, CONVERYOR_ANI_DUR).call(() => {
});
})
}
}
class ConveyorUpAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ y: view.y - Tool.height }, CONVERYOR_ANI_DUR).call(() => {
})
})
}
}
class ConveyorLeftAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ x: view.x - Tool.width }, CONVERYOR_ANI_DUR).call(() => {
})
})
}
}
class ConveyorRightAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ x: view.x + Tool.width }, CONVERYOR_ANI_DUR).call(() => {
})
})
}
}
export const getConveyorAni = (conveyor, thisobj: MainScene) => {
const dir = getArrowDir(conveyor);
switch (dir) {
case ARROW_DIR.LEFT:
return new ConveyorLeftAni(conveyor, thisobj)
case ARROW_DIR.RIGHT:
return new ConveyorRightAni(conveyor, thisobj)
case ARROW_DIR.UP:
return new ConveyorUpAni(conveyor, thisobj)
case ARROW_DIR.DOWN:
return new ConveyorDownAni(conveyor, thisobj)
}
}
\ No newline at end of file
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
import { Tool } from "../Tool";
import ConveyorAni from "./ConveyorAni";
//单个皮带转动动效
export default class ConveyorDownAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ y: view.y + Tool.height }, CONVERYOR_ANI_DUR);
})
}
}
import ConveyorAni from "./ConveyorAni";
import { Tool } from "../Tool";
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
//单个皮带转动动效
export class ConveyorLeftAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ x: view.x - Tool.width }, CONVERYOR_ANI_DUR);
})
}
}
import ConveyorAni from "./ConveyorAni";
import { Tool } from "../Tool";
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
//单个皮带转动动效
export default class ConveyorRightAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ x: view.x + Tool.width }, CONVERYOR_ANI_DUR);
})
}
}
import ConveyorAni from "./ConveyorAni";
import { Tool } from "../Tool";
import { CONVERYOR_ANI_DUR } from "../../mainScene/doConveyorAI";
//单个皮带转动动效
export default class ConveyorUpAni extends ConveyorAni {
play() {
this.views.forEach(view => {
egret.Tween.get(view).to({ y: view.y - Tool.height }, CONVERYOR_ANI_DUR);
})
}
}
......@@ -2513,131 +2513,6 @@
"levelNum": 500,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 501,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 502,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 503,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 504,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 505,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 506,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 507,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 508,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 509,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 510,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 511,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 512,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 513,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 514,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 515,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 516,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 517,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 518,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 519,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 520,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 521,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 522,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 523,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 524,
"maxScore": 47440,
"stars": 1
},
{
"levelNum": 525,
"maxScore": 47440,
"stars": 1
}
],
......
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