Commit 83a5d042 authored by zjz1994's avatar zjz1994

黑洞与烟花

parent ece84fb2
...@@ -350,6 +350,8 @@ export default class MainScene extends Scene { ...@@ -350,6 +350,8 @@ export default class MainScene extends Scene {
//记录是否有红包炸弹弹框 //记录是否有红包炸弹弹框
redBombPanelMark: boolean; redBombPanelMark: boolean;
//烟花绽放
fireworkPromise: Promise<any>[];
async start(data) { async start(data) {
super.start(); super.start();
window['gm'] = this.gm; window['gm'] = this.gm;
...@@ -1676,6 +1678,7 @@ export default class MainScene extends Scene { ...@@ -1676,6 +1678,7 @@ export default class MainScene extends Scene {
this.removeChild(this.stepCircle) this.removeChild(this.stepCircle)
} }
if(s) { if(s) {
this.fireworkPromise = new Array();
//成功的 //成功的
switch(prop) { switch(prop) {
case PropType.BOOM: case PropType.BOOM:
...@@ -1852,6 +1855,7 @@ export default class MainScene extends Scene { ...@@ -1852,6 +1855,7 @@ export default class MainScene extends Scene {
} }
mouseDownE(e: egret.TextEvent) { mouseDownE(e: egret.TextEvent) {
this.fireworkPromise = new Array();
// if (!this.enableTouch) return // if (!this.enableTouch) return
this._converyorTag = true; this._converyorTag = true;
this._wormholeTag = true; this._wormholeTag = true;
...@@ -1879,6 +1883,7 @@ export default class MainScene extends Scene { ...@@ -1879,6 +1883,7 @@ export default class MainScene extends Scene {
} }
mouseMoveE(e) { mouseMoveE(e) {
this.fireworkPromise = new Array();
this._converyorTag = true; this._converyorTag = true;
this._wormholeTag = true; this._wormholeTag = true;
if(this.SELECTED && e.target.parent instanceof Element) { if(this.SELECTED && e.target.parent instanceof Element) {
...@@ -2803,34 +2808,38 @@ export default class MainScene extends Scene { ...@@ -2803,34 +2808,38 @@ export default class MainScene extends Scene {
} }
//黑洞转移 //黑洞转移
if(this._wormholeTag){ if(this._wormholeTag){
this._wormholeTag = false;
let wormholes = this.chapterData.map.WORMHOLE; let wormholes = this.chapterData.map.WORMHOLE;
if(wormholes&&wormholes.length>0){ if(wormholes&&wormholes.length>0){
await Promise.all(this.fireworkPromise).then(()=>{
// console.log("本次烟花播放完毕");
});
await doWormHoleAI(this); await doWormHoleAI(this);
// console.log("黑洞转移完毕"); // console.log("黑洞转移完毕");
}
this._wormholeTag = false; //黑洞转移,使黑洞占位变空,需要添加到emptys中
//黑洞转移,使黑洞占位变空,需要添加到emptys中 for(var _w=0;_w<this.lattices.length;_w++){
for(var _w=0;_w<this.lattices.length;_w++){ var _wlattice = this.lattices[_w];
var _wlattice = this.lattices[_w]; if(_wlattice&&!_wlattice.element
if(_wlattice&&!_wlattice.element &&this.emptys.indexOf(_wlattice.index)==-1){
&&this.emptys.indexOf(_wlattice.index)==-1){ this.emptys.push(_wlattice.index);
this.emptys.push(_wlattice.index); }
} }
}
//棒棒糖消除 //棒棒糖消除
var recoverlp2 = this.checkEmtbbt(); var recoverlp2 = this.checkEmtbbt();
if(recoverlp2>0){ if(recoverlp2>0){
// console.log("传送带棒棒糖消除"); // console.log("传送带棒棒糖消除");
// this.fall(()=>{ // this.fall(()=>{
// this.fallCallback(); // this.fallCallback();
// }) // })
// return; // return;
}
this.fall(()=>{
this.fallCallback();
})
return;
} }
this.fall(()=>{
this.fallCallback();
})
return;
} }
...@@ -4341,7 +4350,14 @@ export default class MainScene extends Scene { ...@@ -4341,7 +4350,14 @@ export default class MainScene extends Scene {
const type = fireworksTypeMap[ele.type]; const type = fireworksTypeMap[ele.type];
if(this.passElements && this.passElements[type] != 0) { if(this.passElements && this.passElements[type] != 0) {
// if (this.passElements && this.passElements[type] != undefined && this.passElements[type] != 0) { // if (this.passElements && this.passElements[type] != undefined && this.passElements[type] != 0) {
lat.element.canFire && lat.element.fire(type); if(lat.element.canFire){
let pro = lat.element.fire(type);
let isInworm = Tool.judgeInWormHole(index,this.chapterData.map.WORMHOLE);
if(isInworm){
this.fireworkPromise.push(pro);
}
}
this.goElementTarget(type, [ele.x, ele.y]); this.goElementTarget(type, [ele.x, ele.y]);
} }
} }
......
...@@ -2,6 +2,7 @@ import MainScene from "./MainScene"; ...@@ -2,6 +2,7 @@ import MainScene from "./MainScene";
import { Lattice } from "../something/class/Lattice"; import { Lattice } from "../something/class/Lattice";
import { LatticeType } from "../something/enum/LatticeType"; import { LatticeType } from "../something/enum/LatticeType";
import { Tool } from "../something/Tool"; import { Tool } from "../something/Tool";
import { ElementType } from "../something/enum/ElementType";
const getMapsp = function(lattice:Lattice){ const getMapsp = function(lattice:Lattice){
var mapcf:{ var mapcf:{
...@@ -83,11 +84,11 @@ const tweenAnisp = function(sp:egret.DisplayObject,posx:number,posy:number,latti ...@@ -83,11 +84,11 @@ const tweenAnisp = function(sp:egret.DisplayObject,posx:number,posy:number,latti
scaleY:norscaleY scaleY:norscaleY
},500) },500)
.call(()=>{ .call(()=>{
if(lattice&&mapcf&&elecf){ // if(lattice&&mapcf&&elecf){
// console.log("需要替换数据11111111",lattice.index); // // console.log("需要替换数据11111111",lattice.index);
lattice.changeData(mapcf,elecf); // lattice.changeData(mapcf,elecf);
// console.log("替换数据",JSON.stringify(lattice)); // // console.log("替换数据",JSON.stringify(lattice));
} // }
resolve(); resolve();
}) })
}) })
...@@ -165,6 +166,16 @@ export default async (thisObj:MainScene)=>{ ...@@ -165,6 +166,16 @@ export default async (thisObj:MainScene)=>{
// console.log("000000发起时准备替换元素",jlidxlattice.index,mapcf.mapdata["maptype"],elecf.eledata["type"]); // console.log("000000发起时准备替换元素",jlidxlattice.index,mapcf.mapdata["maptype"],elecf.eledata["type"]);
let elepro = tweenAnisp(elesp,jlidxpos[0],jlidxpos[1]); let elepro = tweenAnisp(elesp,jlidxpos[0],jlidxpos[1]);
promiseList.push(elepro); promiseList.push(elepro);
//烟花特殊处理
if(elecf.eledata["type"]==ElementType.FIREWORKS_SHOOTER){
// console.log("烟花特殊处理");
let firework = elesp["_fireworks"];
let fireposx = jlidxpos[0];
let fireposy = jlidxpos[1]+12;
let firepro = tweenAnisp(firework,fireposx,fireposy);
promiseList.push(firepro);
}
} }
} }
} }
......
...@@ -52,14 +52,14 @@ export const Chapters25: ChapterData[] = [ ...@@ -52,14 +52,14 @@ export const Chapters25: ChapterData[] = [
// [ 72, 53 ] // [ 72, 53 ]
// ], // ],
elements: [ elements: [
1, 19, 1, 1, 1, 1, 1, 1, 22, 1, 13, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 22, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 18, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 13, 1, 1, 9, 1, 13,
1, 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1
], ],
baseElements: [ baseElements: [
......
...@@ -85,18 +85,21 @@ export class Element extends eui.Component { ...@@ -85,18 +85,21 @@ export class Element extends eui.Component {
return t - this._fireworksTimer > 2 * 1000; return t - this._fireworksTimer > 2 * 1000;
} }
fire(type: ElementType) {// zi hong huang lan lv fire(type: ElementType) {// zi hong huang lan lv
let pro;
this._fireworksTimer = new Date().getTime(); this._fireworksTimer = new Date().getTime();
if (type == ElementType.FIREWORKS_RABBIT) //rabbit 紫 if (type == ElementType.FIREWORKS_RABBIT) //rabbit 紫
this.toFireworksAction(1, 90); pro = this.toFireworksAction(1, 90);
else if (type == ElementType.FIREWORKS_PIG) //pig 粉 else if (type == ElementType.FIREWORKS_PIG) //pig 粉
this.toFireworksAction(91, 180); pro = this.toFireworksAction(91, 180);
else if (type == ElementType.FIREWORKS_LION) //lion 黄 else if (type == ElementType.FIREWORKS_LION) //lion 黄
this.toFireworksAction(181, 270); pro = this.toFireworksAction(181, 270);
else if (type == ElementType.FIREWORKS_CATTLE) //cattle 蓝 else if (type == ElementType.FIREWORKS_CATTLE) //cattle 蓝
this.toFireworksAction(271, 360); pro = this.toFireworksAction(271, 360);
else if (type == ElementType.FIREWORKS_CHICKEN) //chicken 绿 else if (type == ElementType.FIREWORKS_CHICKEN) //chicken 绿
this.toFireworksAction(361, 450); pro = this.toFireworksAction(361, 450);
return pro;
} }
_fireworks; _fireworks;
...@@ -105,23 +108,31 @@ export class Element extends eui.Component { ...@@ -105,23 +108,31 @@ export class Element extends eui.Component {
this.showImage.alpha = 0; this.showImage.alpha = 0;
const mv: any = initSvga(getFireworksVideoItem()); const mv: any = initSvga(getFireworksVideoItem());
this._fireworks = mv; this._fireworks = mv;
this._fireworks.touchEnabled = false;
this._fireworks.touchThrough = true;
thisobj.addChild(mv); thisobj.addChild(mv);
// this.addChild(this._fireworks);
mv.anchorOffsetX = 340 / 2; mv.anchorOffsetX = 340 / 2;
mv.anchorOffsetY = 500; mv.anchorOffsetY = 550;
mv.x = this.x; mv.x = this.x;
mv.y = this.y - 38; mv.y = this.y + 12;
// mv.y = -38;
this._fireworks.gotoAndStop(1); this._fireworks.gotoAndStop(1);
} }
toFireworksAction(start, end) { toFireworksAction(start, end) {
const cb = () => { var pro = new Promise(function(resolve,reject){
if (this._fireworks.currentFrame == end) { //向上吹 const cb = () => {
this._fireworks.gotoAndStop(start); if (this._fireworks.currentFrame == end) { //向上吹
this._fireworks.removeEventListener(egret.Event.ENTER_FRAME, cb, this); this._fireworks.gotoAndStop(start);
} this._fireworks.removeEventListener(egret.Event.ENTER_FRAME, cb, this);
}; resolve();
this._fireworks.addEventListener(egret.Event.ENTER_FRAME, cb, this); }
this._fireworks.gotoAndPlay(start, true); };
this._fireworks.addEventListener(egret.Event.ENTER_FRAME, cb, this);
this._fireworks.gotoAndPlay(start, true);
}.bind(this));
return pro;
} }
_mv; _mv;
......
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