Commit abc51661 authored by zjz1994's avatar zjz1994

调整动画

parent 36366b73
......@@ -478,7 +478,7 @@ export class NetManager extends ABNetManager {
deviceSessionId: window['_device_session_id'],
score: score
};
// console.log("通关提交",data);
console.log("通关提交",data);
if (relatedTaskType) {
data['relatedTaskType'] = relatedTaskType;
}
......
......@@ -121,7 +121,6 @@ import Rect = eui.Rect;
import WormHole from '../something/class/WormHole';
import doWormHoleAI from './doWormHoleAI';
import { Grass } from '../something/class/Grass';
import { GameEvent } from '../configData/GameEvent';
const aniClass = {
"BoomAni": BoomAni,
......@@ -179,6 +178,9 @@ let pongojioArr:Array<any> = [];
let wormlightdata:any = null;
let wormlightArr:Array<any> = [];
//草坪的特效
let lawndata:any = null;
let lawnArr:Array<any> = [];
//红包炸弹弹框名字
const redBombPanelName = "RedBombAlert";
......@@ -392,7 +394,7 @@ export default class MainScene extends Scene {
guideContainer:egret.DisplayObjectContainer;
festivalContainer:egret.DisplayObjectContainer;
fallAllPormise:Promise<any>[];
//铺草坪
// turfingArr:Array<number> = [];//当前已有草的格子
//一次掉落前的消除集合
......@@ -520,6 +522,7 @@ export default class MainScene extends Scene {
async start(data) {
super.start();
this.fallAllPormise = new Array();
this.resetMainScene();
// window['gm'] = this.gm;
//第几关
......@@ -543,6 +546,8 @@ export default class MainScene extends Scene {
//虫洞
this.initWormHole();
//有草坪,加塞草坪的动画
this.initLawn();
//初始话地图格子数据
this.initLattices();
//初始化回收口,如果是棒棒糖关卡,那么在地图底部增加棒棒糖洞,用到map
......@@ -753,6 +758,20 @@ export default class MainScene extends Scene {
})
}
}
//草坪动画
initLawn(call=null){
var resPath = getResPath();
if (!svgaParser) svgaParser = new window["SVGA"].Parser();
if(lawndata){
}else{
svgaParser.load(resPath + 'resource/assets/svgas/lawn.svga', (videoItem) => {
if(!lawndata){
lawndata = videoItem;
}
})
}
}
/**
* 加载猩猩脚印
*/
......@@ -2242,6 +2261,7 @@ export default class MainScene extends Scene {
* @param callback 所有fall完成后的回调,检查三消,
*/
fall(callback: Function) {
this.fallAllPormise = new Array();
//去重一次
Tool.removeReapty(this.emptys);
......@@ -2886,7 +2906,7 @@ export default class MainScene extends Scene {
* 执行消除,应该是一个迭代,只要eliminatedElements有东西就一直执行
* 掉落后的逻辑很复杂
*/
eliminate(data:Array<{ineffect:boolean,addnum:number}>=null) {
async eliminate(data:Array<{ineffect:boolean,addnum:number}>=null) {
var pcannostatArr:Array<{ineffect:boolean,addnum:number}>;
if(data){
pcannostatArr = data;
......@@ -2971,12 +2991,14 @@ export default class MainScene extends Scene {
}
//没有可消除元素,执行掉落,
setTimeout(() => {
// setTimeout(() => {
await wait(200);
await Promise.all(this.fallAllPormise);
this.fall(() => {
//掉落停止回调
this.fallCallback();
});
}, 200)
// }, 200)
}
}
incheckFall:boolean = false;
......@@ -5768,12 +5790,24 @@ export default class MainScene extends Scene {
let block = lat.block;
block.parent.removeChild(block);
if(lat.block.blocktype==LatticeType.BlOCK){
this.removeBlockGrass(block);
Pool.recover(RecoverName.BLOCK,block);
}else if(lat.block.blocktype==LatticeType.BLOCK_AND_ICE){
this.removeBlockGrass(block);
Pool.recover(RecoverName.ICE_BLOCK,block);
// if(block.ice){
// block.ice.parent.removeChild(block.ice);
// block.ice = null;
// }
}else if(lat.block.blocktype==LatticeType.BLOCK_AND_DARK_ICE){
this.removeBlockGrass(block);
Pool.recover(RecoverName.DARK_ICE_BLOCK,block);
// if(block.ice){
// block.ice.parent.removeChild(block.ice);
// block.ice = null;
// }
}else if(lat.block.blocktype==LatticeType.BLOCK_AND_GRASS){
Pool.recover(RecoverName.GRASS_BLOCK,block);
}
......@@ -5788,6 +5822,12 @@ export default class MainScene extends Scene {
Pool.recover(RecoverName.GRASS,grass);
}
}
removeBlockGrass(block){
if(block.grass){
block.grass.parent.removeChild(block.grass);
block.grass = null;
}
}
recoverEleast(lat:Lattice){
let ele = lat.element;
if(!ele)return;
......@@ -6205,6 +6245,58 @@ export default class MainScene extends Scene {
this.turfing(pidx);
}
}
//草坪动画
lawnAnm(posx,posy,grass:any,grassp:any,passpos:Array<number>,index:number){
var pro = new Promise((resolve)=>{
let onelawn;
if(lawnArr.length>0){
onelawn = lawnArr.shift();
}else{
onelawn = new window["SVGA"].EgretMovieClip(lawndata);
}
this.effectContainer.addChild(onelawn);
onelawn.x = posx-80;
onelawn.y = posy-80;
let mainScene:MainScene = this;
let compfunc = function(){
onelawn.removeEventListener(egret.Event.COMPLETE,compfunc);
onelawn.gotoAndStop(1);
if(onelawn.parent){
onelawn.parent.removeChild(onelawn);
lawnArr.push(onelawn);
}
}
onelawn.addEventListener(egret.Event.COMPLETE,compfunc);
onelawn.gotoAndPlay(1,1);
let framefunc = function(){
let curframe = onelawn.currentFrame;
if(curframe==30){
// console.log("草坪--------------------------------------------取消监听lawn----frame",index);
grassp.addChild(grass);
onelawn.removeEventListener(egret.Event.ENTER_FRAME,framefunc);
egret.Tween.get(grass).set({
scaleX:0.8,
scaleY:0.8,
alpha:0.2
})
.to({
scaleY:1,
scaleX:1,
alpha:1,
},400,egret.Ease.backOut)
.call(()=>{
resolve();
})
}
}
onelawn.addEventListener(egret.Event.ENTER_FRAME,framefunc);
});
return pro;
}
//新增铺草地
turfing(index:number){
var lat = this.lattices[index];
......@@ -6221,24 +6313,38 @@ export default class MainScene extends Scene {
// return;
// }
// if(!lat.grass){
let grasspos = Tool.getPositionByIndex(index);
let grassparent:egret.DisplayObject;
let grassDisplay = Pool.takeOut(RecoverName.GRASS);
if(!grassDisplay){
grassDisplay = new Grass();
}
// grassDisplay.width = grassDisplay.height = 80;
// grassDisplay.anchorOffsetY = 40;
// grassDisplay.anchorOffsetX = 40;
lat.grass = grassDisplay;
var passpos:Array<number> = [];
if(lat.block){
lat.block.grass = grassDisplay;
lat.block.addChild(grassDisplay);
grassDisplay.x = 0;
grassDisplay.y = 0;
// lat.block.addChild(grassDisplay);
grassparent = lat.block;
passpos = [lat.block.x,lat.block.y];
}else{
this.mapupContainer.addChild(grassDisplay);
var grasspos = Tool.getPositionByIndex(index);
// this.mapupContainer.addChild(grassDisplay);
grassparent = this.mapupContainer;
grassDisplay.x = grasspos[0];
grassDisplay.y = grasspos[1];
passpos = [lat.grass.x,lat.grass.y];
}
this.goElementTarget(ElementType.Grass,passpos);
// console.log("准备添加草坪",index)
var pro = this.lawnAnm(grasspos[0],grasspos[1],grassDisplay,grassparent,passpos,index);
this.fallAllPormise.push(pro);
// this.goElementTarget(ElementType.Grass,passpos);
// }
}
}
......
This diff is collapsed.
......@@ -6,7 +6,10 @@ export class Grass extends egret.Bitmap {
super();
var texture:egret.Texture = RES.getRes("ele"+ElementType.Grass+"_png");
this.texture = texture;
this.anchorOffsetX = texture.textureWidth/2;
this.anchorOffsetY = texture.textureHeight/2;
console.log("草的大小",texture.textureWidth,texture.textureHeight);
var grasswidth = 76;
this.width = this.height = grasswidth;
this.anchorOffsetX = grasswidth/2;
this.anchorOffsetY = grasswidth/2;
}
}
\ No newline at end of file
......@@ -256,6 +256,7 @@ export const submitTran = {
26: 15,
34: 16,
36: 17,
41: 18,
}
// SCORE(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