Commit 83a5d042 authored by zjz1994's avatar zjz1994

黑洞与烟花

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