Commit 2585ed68 authored by wildfirecode's avatar wildfirecode

1

parent a48e1eff
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"eleDisNew","version":5,"files":["../assets/eleDisNew/eleDisNew4_9.png","../assets/eleDisNew/eleDisNew4_8.png","../assets/eleDisNew/eleDisNew4_7.png","../assets/eleDisNew/eleDisNew4_6.png","../assets/eleDisNew/eleDisNew4_5.png","../assets/eleDisNew/eleDisNew4_4.png","../assets/eleDisNew/eleDisNew4_3.png","../assets/eleDisNew/eleDisNew4_2.png","../assets/eleDisNew/eleDisNew4_14.png","../assets/eleDisNew/eleDisNew4_13.png","../assets/eleDisNew/eleDisNew4_12.png","../assets/eleDisNew/eleDisNew4_11.png","../assets/eleDisNew/eleDisNew4_10.png","../assets/eleDisNew/eleDisNew4_1.png","../assets/eleDisNew/eleDisNew4_0.png","../assets/eleDisNew/eleDisNew3_9.png","../assets/eleDisNew/eleDisNew3_8.png","../assets/eleDisNew/eleDisNew3_7.png","../assets/eleDisNew/eleDisNew3_6.png","../assets/eleDisNew/eleDisNew3_5.png","../assets/eleDisNew/eleDisNew3_4.png","../assets/eleDisNew/eleDisNew3_3.png","../assets/eleDisNew/eleDisNew3_2.png","../assets/eleDisNew/eleDisNew3_14.png","../assets/eleDisNew/eleDisNew3_13.png","../assets/eleDisNew/eleDisNew3_12.png","../assets/eleDisNew/eleDisNew3_11.png","../assets/eleDisNew/eleDisNew3_10.png","../assets/eleDisNew/eleDisNew3_1.png","../assets/eleDisNew/eleDisNew3_0.png","../assets/eleDisNew/eleDisNew2_9.png","../assets/eleDisNew/eleDisNew2_8.png","../assets/eleDisNew/eleDisNew2_7.png","../assets/eleDisNew/eleDisNew2_6.png","../assets/eleDisNew/eleDisNew2_5.png","../assets/eleDisNew/eleDisNew2_4.png","../assets/eleDisNew/eleDisNew2_3.png","../assets/eleDisNew/eleDisNew2_2.png","../assets/eleDisNew/eleDisNew2_14.png","../assets/eleDisNew/eleDisNew2_13.png","../assets/eleDisNew/eleDisNew2_12.png","../assets/eleDisNew/eleDisNew2_11.png","../assets/eleDisNew/eleDisNew2_10.png","../assets/eleDisNew/eleDisNew2_1.png","../assets/eleDisNew/eleDisNew2_0.png","../assets/eleDisNew/eleDisNew1_9.png","../assets/eleDisNew/eleDisNew1_8.png","../assets/eleDisNew/eleDisNew1_7.png","../assets/eleDisNew/eleDisNew1_6.png","../assets/eleDisNew/eleDisNew1_5.png","../assets/eleDisNew/eleDisNew1_4.png","../assets/eleDisNew/eleDisNew1_3.png","../assets/eleDisNew/eleDisNew1_2.png","../assets/eleDisNew/eleDisNew1_14.png","../assets/eleDisNew/eleDisNew1_13.png","../assets/eleDisNew/eleDisNew1_12.png","../assets/eleDisNew/eleDisNew1_11.png","../assets/eleDisNew/eleDisNew1_10.png","../assets/eleDisNew/eleDisNew1_1.png","../assets/eleDisNew/eleDisNew1_0.png","../assets/eleDisNew/eleDisNew0_9.png","../assets/eleDisNew/eleDisNew0_8.png","../assets/eleDisNew/eleDisNew0_7.png","../assets/eleDisNew/eleDisNew0_6.png","../assets/eleDisNew/eleDisNew0_5.png","../assets/eleDisNew/eleDisNew0_4.png","../assets/eleDisNew/eleDisNew0_3.png","../assets/eleDisNew/eleDisNew0_2.png","../assets/eleDisNew/eleDisNew0_14.png","../assets/eleDisNew/eleDisNew0_13.png","../assets/eleDisNew/eleDisNew0_12.png","../assets/eleDisNew/eleDisNew0_11.png","../assets/eleDisNew/eleDisNew0_10.png","../assets/eleDisNew/eleDisNew0_1.png","../assets/eleDisNew/eleDisNew0_0.png"]}
\ No newline at end of file
import MainScene from "./MainScene"; import { SandMoveAni } from "../something/anis/SandMoveAni";
import { Lattice } from "../something/class/Lattice"; import { Lattice } from "../something/class/Lattice";
import { RecoverName } from "../something/enum/RecoverName";
import { Pool } from "../something/Pool";
import { Tool } from "../something/Tool"; import { Tool } from "../something/Tool";
import MainScene from "./MainScene";
/** /**
* 沙子移动 * 沙子移动
*/ */
...@@ -16,21 +19,35 @@ export default async (thisObj: MainScene) => { ...@@ -16,21 +19,35 @@ export default async (thisObj: MainScene) => {
console.log(sandLattices); console.log(sandLattices);
//map promise //map promise
//先判断是否能跳动,目前都能跳 //先判断是否能跳动,目前都能跳
const promiseList: Promise<any>[] = [];
const sands = [];
for (let i = 0; i < sandLattices.length; i++) { for (let i = 0; i < sandLattices.length; i++) {
const sandLattice = sandLattices[i]; const sandLattice = sandLattices[i];
const indexEnd = judgeActionIndex(sandLattice.index, thisObj.lattices) const indexEnd = judgeActionIndex(sandLattice.index, thisObj.lattices)
if (indexEnd) {//判断是否有地方可以 if (indexEnd) {//判断是否有地方可以
//先修改数据,再进行动画播放 //先修改数据,再进行动画播放
const sand = sandLattice.sand; const sand = sandLattice.sand;
sandLattice.sand=null; sandLattice.sand = null;
const latticeEnd = thisObj.lattices[indexEnd]; const latticeEnd = thisObj.lattices[indexEnd];
latticeEnd.sand = sand; latticeEnd.sand = sand;
const p = Tool.getPositionByIndex(indexEnd); const p = Tool.getPositionByIndex(indexEnd);
egret.Tween.get(sand).to({x:p[0],y:p[1]},200); // egret.Tween.get(sand).to({x:p[0],y:p[1]},200);
// sand.x = p[0]; const from = [sand.x, sand.y];
// sand.y = p[1]; sand.x = p[0];
sand.y = p[1];
sand.visible = false;
let sandMoveAni: SandMoveAni = Pool.takeOut(RecoverName.SAND_MOVE_ANI);
if (!sandMoveAni) {
sandMoveAni = new SandMoveAni();
}
thisObj.addChild(sandMoveAni);
promiseList.push(sandMoveAni.play([sand.x, sand.y], p));
sands.push(sand);
} }
} }
await Promise.all(promiseList);
sands.forEach(e => e.visible = true);
} }
//找到毛球移动的目标位置 //找到毛球移动的目标位置
......
import { RecoverName } from "../enum/RecoverName";
import { Pool } from "../Pool";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import wait from "../../../libs/new_tc/wait";
export const monstShootAniDur: number = 400;
/**
* 需要回调的
* 手动修改this.shoot.rotation=
*/
export class SandMoveAni extends egret.DisplayObjectContainer {
fromContainer;
toContainer;
constructor() {
super()
}
async initMc(from: number[], to: number[]) {
const fromContainer = await this.createContainer();
fromContainer.x = from[0];
fromContainer.y = from[1];
this.fromContainer = fromContainer;
const toContainer = await this.createContainer();
toContainer.x = to[0];
toContainer.y = to[1];
this.toContainer = toContainer;
this.addChild(this.fromContainer);
this.addChild(this.toContainer);
}
private reset(from: number[], to: number[]) {
this.fromContainer.x = from[0];
this.fromContainer.y = from[1];
this.toContainer.x = to[0];
this.toContainer.y = to[1];
}
async play(from: number[], to: number[]) {
if (!this.fromContainer) {
await this.initMc(from, to);
} else {
this.reset(from, to);
}
await wait(5000);
this.parent && this.parent.removeChild(this);
Pool.recover(RecoverName.SAND_MOVE_ANI, this);
return null;
}
private async createContainer() {
const container = new egret.Sprite();
const rect = this.createRect();
const mc = await this.createMc();
container.addChild(mc);
container.addChild(rect);
mc.mask = rect;
return mc;
}
private createRect() {
const rect = new egret.Shape();
rect.graphics.beginFill(0, 1);
const r = 80;
rect.graphics.drawRect(-r / 2, -r / 2, r, r);
rect.graphics.endFill();
return rect;
}
private async createMc() {
const movieclip: egret.DisplayObject = await loadSvga(getResPath() + 'resource/assets/svgas/sand_standby.svga') as egret.DisplayObject;
movieclip.anchorOffsetX = 78 / 2;
movieclip.anchorOffsetY = 78 / 2;
return movieclip;
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -18,6 +18,7 @@ export enum RecoverName { ...@@ -18,6 +18,7 @@ export enum RecoverName {
//带回调的动画,和不带的合并不了,因为可能还有其他参数 //带回调的动画,和不带的合并不了,因为可能还有其他参数
BONUSSHOOT_ANI = "BonusShootAni", BONUSSHOOT_ANI = "BonusShootAni",
MONSTER_SHOOT_ANI = "MONSTER_SHOOT_ANI", MONSTER_SHOOT_ANI = "MONSTER_SHOOT_ANI",
SAND_MOVE_ANI = "SAND_MOVE_ANI",
HONEY_SHOOT_ANI = "HONEY_SHOOT_ANI", HONEY_SHOOT_ANI = "HONEY_SHOOT_ANI",
JELLYSPREAD_ANI = "JellySpreadAni", JELLYSPREAD_ANI = "JellySpreadAni",
PIECETOEGG_ANI = "PieceToEggAni", PIECETOEGG_ANI = "PieceToEggAni",
......
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