Commit 94f27fa6 authored by zjz1994's avatar zjz1994

调整动画

parent e4fededc
...@@ -450,9 +450,9 @@ export default class MainScene extends Scene { ...@@ -450,9 +450,9 @@ export default class MainScene extends Scene {
for(let i=0;i<arr.length;i++){ for(let i=0;i<arr.length;i++){
let icanno:Element = arr[i].ele; let icanno:Element = arr[i].ele;
var icannodir:forwardDirection = icanno._cannoDir; let icannodir:forwardDirection = icanno._cannoDir;
var icannolpos = Tool.getPositionByIndex(arr[i].idx); let icannolpos = Tool.getPositionByIndex(arr[i].idx);
var icannowpos = this.elementContainer.localToGlobal(icannolpos[0],icannolpos[1]); let icannowpos = this.elementContainer.localToGlobal(icannolpos[0],icannolpos[1]);
let icannobox:eui.Group = new eui.Group; let icannobox:eui.Group = new eui.Group;
let icannoboxwid:number=116; let icannoboxwid:number=116;
...@@ -470,69 +470,106 @@ export default class MainScene extends Scene { ...@@ -470,69 +470,106 @@ export default class MainScene extends Scene {
this.addChild(icannobox); this.addChild(icannobox);
icannobox.x = icannowpos.x; icannobox.x = icannowpos.x;
icannobox.y = icannowpos.y; icannobox.y = icannowpos.y;
var roanum = Tool.getCannoRoaByDir(icannodir); let roanum = Tool.getCannoRoaByDir(icannodir);
// console.log("icannobox旋转朝向",roanum);
icannobox.touchEnabled = false; icannobox.touchEnabled = false;
icannobox.touchThrough = true; icannobox.touchThrough = true;
icannobox.rotation = roanum; icannobox.rotation = roanum;
for(let j=0;j<svgas.length;j++){ for(let j=0;j<svgas.length;j++){
let jsvgname = svgas[j]; let jsvgname = svgas[j];
svgaParser.load(resPath + 'resource/assets/svgas/' + jsvgname + ".svga", (videoItem) => { svgaParser.load(resPath + 'resource/assets/svgas/' + jsvgname + ".svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem); let mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep = true; // mv.lockStep = true;
mv.gotoAndStop(1);
mv["cannoidx"] = i;
if(jsvgname=="cannofire"){ if(jsvgname=="cannofire"){
// console.log("cannofire",mv);
mv.x = icannoboxwid-6; mv.x = icannoboxwid-6;
mv.y = -icannoboxhei*3/2; mv.y = -icannoboxhei*3/2+5;
mv.rotation = 90; mv.rotation = 90;
// console.log("cannofireTotal-------",mv. totalFrames);
mv.addEventListener(egret.Event.ENTER_FRAME,this.listenCnfire,this);
}else if(jsvgname=="cannolight"){ }else if(jsvgname=="cannolight"){
var mvwidth = 400; var mvwidth = 400;
var mvheight = 400; var mvheight = 400;
mv.x = (icannoboxwid-mvwidth)/2; mv.x = (icannoboxwid-mvwidth)/2;
mv.y = (icannoboxhei-mvheight)/2; mv.y = (icannoboxhei-mvheight)/2;
// console.log("cannolight-------",mv. totalFrames);
mv.addEventListener(egret.Event.ENTER_FRAME,this.listenCnlight,this);
}else if(jsvgname=="cannoparticle"){ }else if(jsvgname=="cannoparticle"){
mv.x = icannoboxwid; mv.x = icannoboxwid;
mv.y = -icannoboxhei/2; mv.y = -icannoboxhei/2;
mv.rotation = 90; mv.rotation = 90;
// console.log("cannoparticle-------",mv. totalFrames);
mv.addEventListener(egret.Event.ENTER_FRAME,this.listenCnparticle,this);
} }
mv.stop();
// mv.gotoAndPlay(1,true);
let fun;
mv.addEventListener(egret.Event.COMPLETE,fun=function(e){
e.target.stop();
e.target.visible = false;
if(jsvgname=="cannofire"){//炮弹光波完毕,执行消除
// console.log("光波发射完毕,执行消除");
this.callBackFireCanno(icanno);
}else if(jsvgname=="cannoparticle"){
console.log("发射充能光波");
this.selectPlayCannoEffect(i,"cannofire");
}
},this);
// mv.gotoAndStop(100);
this.cannoEffect[i][jsvgname] = mv; this.cannoEffect[i][jsvgname] = mv;
// if(jsvgname=="cannofire"){
icannobox.addChild(this.cannoEffect[i][jsvgname]);
// }
this.cannoEffect[i][jsvgname].visible = false;
// console.log("初始"+i+"炮台"+jsvgname+"特效");
},function(error){ },function(error){
console.log("炮台svg加载失败",jsvgname); console.log("炮台svg加载失败",jsvgname);
}) })
} }
} }
} }
listenCnfire(e){
var target = e.target;
var curframe = target.currentFrame;
if(curframe>=48){
// console.log("fire播放完成",target["cannoidx"]);
target.gotoAndStop(1);
if(target.parent){
target.parent.removeChild(target);
}
}else if(curframe==25){
var icannoidx = target["cannoidx"];
var icanno = this.cannoArr[icannoidx].ele;
this.callBackFireCanno(icanno);
}
}
listenCnlight(e){
var target = e.target;
var curframe = target.currentFrame;
if(curframe>=28){
// console.log("light播放完成",target["cannoidx"]);
target.gotoAndStop(1);
if(target.parent){
target.parent.removeChild(target);
}
var icannoidx = target["cannoidx"];
var icanno = this.cannoArr[icannoidx].ele;
var anmstat = icanno._cannoStat;
icanno.changeMvPlay(anmstat);
}
}
listenCnparticle(e){
var target = e.target;
var curframe = target.currentFrame;
if(curframe>=98){
// console.log("particle播放完成",target["cannoidx"]);
target.gotoAndStop(1);
if(target.parent){
target.parent.removeChild(target);
}
}else if(curframe==60){
var icannoidx = target["cannoidx"];
this.selectPlayCannoEffect(icannoidx,"cannofire");
}
}
selectPlayCannoFire(idx:number){
var arridx = this.getCannoArrByIdx(idx);
this.selectPlayCannoEffect(arridx,"cannofire");
}
/** /**
* 播放炮台动画 * 播放炮台动画
*/ */
selectPlayCannoEffect(idx:number,name:string){ selectPlayCannoEffect(idx:number,name:string){
if(!this.cannoEffect[idx][name].visible){ if(this.cannoEffect&&this.cannoEffect[idx]&&this.cannoEffect[idx][name]){
this.cannoEffect[idx][name].visible = true; if(!this.cannoEffect[idx][name].visible){
this.cannoEffect[idx][name].visible = true;
}
this.cannoEffect[idx]["box"].addChild(this.cannoEffect[idx][name]);
this.cannoEffect[idx][name].gotoAndPlay(1,1);
} }
this.cannoEffect[idx][name].stop();
// this.cannoEffect[idx][name].gotoAndStop(1);
console.error("炮台特效播放",idx,name)
this.cannoEffect[idx][name].gotoAndPlay(1);
} }
//初始化界面ui,,道具弄在这里s //初始化界面ui,,道具弄在这里s
...@@ -984,7 +1021,7 @@ export default class MainScene extends Scene { ...@@ -984,7 +1021,7 @@ export default class MainScene extends Scene {
ele:canno ele:canno
}); });
var dirType = Tool.getCannoDir(elements[i]); var dirType = Tool.getCannoDir(elements[i]);
canno.resetToCannoView(dirType); canno.resetToCannoView(dirType,this);
break; break;
case ElementConfigType.CANNO_BLOCK: case ElementConfigType.CANNO_BLOCK:
let canno_block:Element = Tool.getElement(ElementType.CANNO_BLOCK); let canno_block:Element = Tool.getElement(ElementType.CANNO_BLOCK);
...@@ -2518,7 +2555,8 @@ export default class MainScene extends Scene { ...@@ -2518,7 +2555,8 @@ export default class MainScene extends Scene {
} }
canno.fireCanno(); canno.fireCanno();
var cannoarridx = this.getCannoArrByIdx(canno); var cannoidx = canno.index;
var cannoarridx = this.getCannoArrByIdx(cannoidx);
this.selectPlayCannoEffect(cannoarridx,"cannoparticle"); this.selectPlayCannoEffect(cannoarridx,"cannoparticle");
// setTimeout(()=>{ // setTimeout(()=>{
// this.eliminate(); // this.eliminate();
...@@ -2527,8 +2565,7 @@ export default class MainScene extends Scene { ...@@ -2527,8 +2565,7 @@ export default class MainScene extends Scene {
// canno.resetCannoStat(); // canno.resetCannoStat();
// },200); // },200);
} }
getCannoArrByIdx(canno:Element){ getCannoArrByIdx(cannoidx:number){
var cannoidx = canno.index;
var arridx:number = 0; var arridx:number = 0;
for(var i=0;i<this.cannoArr.length;i++){ for(var i=0;i<this.cannoArr.length;i++){
var icannoidx = this.cannoArr[i].idx; var icannoidx = this.cannoArr[i].idx;
...@@ -3775,7 +3812,7 @@ export default class MainScene extends Scene { ...@@ -3775,7 +3812,7 @@ export default class MainScene extends Scene {
pcannoele.addOneCannoStat(); pcannoele.addOneCannoStat();
var newpcannostatnum:number = pcannoele._cannoStat var newpcannostatnum:number = pcannoele._cannoStat
if(newpcannostatnum>lastpcannostatnum){ if(newpcannostatnum>lastpcannostatnum){
console.log('发射充能光波',lastpcannostatnum,newpcannostatnum); // console.log('炮台充能------'+p,lastpcannostatnum,newpcannostatnum);
this.selectPlayCannoEffect(p,"cannolight"); this.selectPlayCannoEffect(p,"cannolight");
} }
var pcannostat = pcannoele.checkCannoStat(); var pcannostat = pcannoele.checkCannoStat();
......
...@@ -6,59 +6,110 @@ import { ElementType } from "../enum/ElementType"; ...@@ -6,59 +6,110 @@ import { ElementType } from "../enum/ElementType";
export const Chapters22: ChapterData[] = [ export const Chapters22: ChapterData[] = [
//551 //551
{ {
baseElementTypes: [0, 1, 2, 3], baseElementTypes: [0, 2, 3, 4, 1],
bubbleProbability: 0, bubbleProbability: 0,
stepCount: 25, stepCount: 35,
passTarget: { passTarget: {
type: PassType.ELEMENT_TARGET, type: 1,
elements: [ elements: [{
{ type: 22,
type: ElementType.CHICKEN, count: 20
count: 45, }, {
}, type: 24,
], count: 20
}, {
type: 26,
count: 20
}]
}, },
starScores: [1000, 5000, 10000], starScores: [15000, 20000, 25000],
map: { map: {
lattices: [ lattices: [
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
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,
0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,
], 0, 1, 1, 1, 1, 1, 1, 1, 0,
generateLats: [ 1, 1, 1, 1, 1, 1, 1, 1, 1,
{ index: 11, type: [0], cus: [] }, 1, 1, 1, 1, 1, 1, 1, 1, 1
{ index: 15, type: [0], cus: [] },
], ],
// connectedLats: [[0, 18], [1, 19], [2, 20]], connectedLats: [],
conveyor: [],
conveyorConnectedLats: [],
elements: [ elements: [
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0,
0, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 21, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 13, 22, 1, 22, 13, 1, 1,
0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 22, 13, 1, 13, 22, 1, 1,
0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 22, 22, 22, 22, 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, 18, 18, 18, 18, 18, 1, 1
], ],
baseElements: [ baseElements: [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 20, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 20, 10, 20, 0, 20, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
20, 10, 20, 10, 20, 10, 20, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
20, 10, 20, 20, 10, 20, 20, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 20, 10, 14, 11, 20, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 20, 10, 20, 10, 20, 0, 0, 0, 0, 0, 14, 11, 0, 0, 0, 0,
0, 0, 0, 20, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
], ],
// recycles: [70, 71, 72, 73] recycles: [],
}, generateLats: [{
index: 0,
type: null
}, {
index: 1,
type: null
}, {
index: 7,
type: null
}, {
index: 8,
type: null
}, {
index: 11,
type: null
}, {
index: 12,
type: null
}, {
index: 13,
type: null
}, {
index: 14,
type: null
}, {
index: 15,
type: null
}, {
index: 46,
type: null
}, {
index: 47,
type: null
}, {
index: 48,
type: null
}, {
index: 49,
type: null
}, {
index: 50,
type: null
}, {
index: 51,
type: null
}, {
index: 52,
type: null
}]
}
} }
] ]
...@@ -30,6 +30,7 @@ import { Monster } from "./Monster"; ...@@ -30,6 +30,7 @@ import { Monster } from "./Monster";
import { State } from "./State"; import { State } from "./State";
import wait from "../../../libs/new_tc/wait"; import wait from "../../../libs/new_tc/wait";
import { Fish } from "./Fish"; import { Fish } from "./Fish";
import MainScene from "../../mainScene/MainScene";
/** /**
* 考虑到底继承白鹭的啥Component还是Container * 考虑到底继承白鹭的啥Component还是Container
* 坐标原点需要坐落在格子的中心点 * 坐标原点需要坐落在格子的中心点
...@@ -198,40 +199,28 @@ export class Element extends eui.Component { ...@@ -198,40 +199,28 @@ export class Element extends eui.Component {
_cannoDir:forwardDirection; _cannoDir:forwardDirection;
_cannoStat:number = 0; _cannoStat:number = 0;
resetToCannoView(cannodir:forwardDirection){ cannoAmnStat:number = 0;
mainScene:MainScene;
resetToCannoView(cannodir:forwardDirection,mainscene:MainScene){
this._cannoDir = cannodir; this._cannoDir = cannodir;
this.resetCannoStat(); this.resetCannoStat();
this.mainScene = mainscene;
// this.showImage.x = 0;
// this.showImage.y = 0;
// this.showImage.anchorOffsetX = this.showImage.width / 2;
// this.showImage.anchorOffsetY = this.showImage.height / 2;
// var roaidx:number;
// if(cannodir==forwardDirection.left){
// roaidx = 0;
// }else if(cannodir==forwardDirection.up){
// roaidx = 1;
// }else if(cannodir==forwardDirection.right){
// roaidx = 2;
// }else if(cannodir==forwardDirection.down){
// roaidx = 3;
// }
// this.cannobox.rotation = [-90,0,90,180][roaidx];
var roanum = Tool.getCannoRoaByDir(cannodir); var roanum = Tool.getCannoRoaByDir(cannodir);
this.cannobox.rotation = roanum; this.cannobox.rotation = roanum;
} }
changeShowCannoStat(){ changeShowCannoStat(){
this.cannolab.text = this._cannoStat+""; this.cannolab.text = this._cannoStat+"";
this.changeMvPlay(this._cannoStat); // this.changeMvPlay(this._cannoStat);
} }
changeMvPlay(_stat:number){ changeMvPlay(_stat:number){
if(this.cannoMoveClip){ if(this.cannoMoveClip){
var endframe:number; var endframe:number;
var curframe:number = this.cannoMoveClip.currentFrame; var curframe:number = this.cannoMoveClip.currentFrame;
if(curframe>=241){
if(_stat==3||_stat==2){
return;
}
}
if(_stat==0){ if(_stat==0){
curframe = 0; curframe = 0;
endframe = 1; endframe = 1;
...@@ -248,9 +237,10 @@ export class Element extends eui.Component { ...@@ -248,9 +237,10 @@ export class Element extends eui.Component {
curframe = 241; curframe = 241;
endframe = 361; endframe = 361;
} }
// console.log("ele播放大炮动画",curframe,endframe,_stat);
// this.cannoMoveClip.gotoAndPlay(curframe,true); // this.cannoMoveClip.gotoAndPlay(curframe,true);
this.cannoMoveClip.gotoAndPlay(curframe,1);
this.stopFrame = endframe; this.stopFrame = endframe;
this.cannoMoveClip.gotoAndPlay(curframe,1);
} }
} }
/** /**
...@@ -266,12 +256,13 @@ export class Element extends eui.Component { ...@@ -266,12 +256,13 @@ export class Element extends eui.Component {
* 炮台发射 * 炮台发射
*/ */
fireCanno(){ fireCanno(){
// console.error("ele播放蓄力动画-----",this.index,this.cannoMoveClip.currentFrame);
this.changeMvPlay(4); this.changeMvPlay(4);
} }
resetCannoStat(){ resetCannoStat(){
this._cannoStat = 0; this._cannoStat = 0;
this.changeShowCannoStat(); this.changeShowCannoStat();
this.changeMvPlay(this._cannoStat);
} }
addOneCannoStat(){ addOneCannoStat(){
this._cannoStat += 1; this._cannoStat += 1;
...@@ -488,7 +479,7 @@ export class Element extends eui.Component { ...@@ -488,7 +479,7 @@ export class Element extends eui.Component {
this.cannobox.visible = this.cannolab.visible = type == ElementType.CANNO; this.cannobox.visible = this.cannolab.visible = type == ElementType.CANNO;
this.touchEnabled = this.showImage.visible = type != ElementType.CANNO; this.touchEnabled = this.showImage.visible = type != ElementType.CANNO;
// this.cannolab.visible = false; this.cannolab.visible = false;
//鸡蛋 //鸡蛋
if (type == ElementType.CHICKEN_EGG) { if (type == ElementType.CHICKEN_EGG) {
this.chickenEgg = Pool.takeOut(RecoverName.CHICKEN_EGG) this.chickenEgg = Pool.takeOut(RecoverName.CHICKEN_EGG)
...@@ -537,20 +528,6 @@ export class Element extends eui.Component { ...@@ -537,20 +528,6 @@ export class Element extends eui.Component {
this.cannoMoveClip.gotoAndStop(1); this.cannoMoveClip.gotoAndStop(1);
this.cannoMoveClip.addEventListener(egret.Event.ENTER_FRAME,this.toFrameAni,this); this.cannoMoveClip.addEventListener(egret.Event.ENTER_FRAME,this.toFrameAni,this);
} }
// else if(mvname=="cannolight"){
// this.cannoCnClip = new window["SVGA"].EgretMovieClip(videoItem);
// this.cannoCnClip.lockStep = true;
// var mvwidth = 400;
// var mvheight = 400;
// this.cannoCnClip.x = (this.cannoboxwid-mvwidth)/2;
// this.cannoCnClip.y = (this.cannoboxhei-mvheight)/2;
// this.cannobox.addChild(this.cannoCnClip);
// this.cannoCnClip.gotoAndStop(1);
// this.cannoCnClip.addEventListener(egret.Event.COMPLETE,this.addOnePower,this);
// console.log("光圈cannocnClip",this.cannoCnClip);
// }else if(mvname=="cannoparticle"){
// }
}); });
} }
} }
...@@ -562,10 +539,12 @@ export class Element extends eui.Component { ...@@ -562,10 +539,12 @@ export class Element extends eui.Component {
toFrameAni(){ toFrameAni(){
var curframe = this.cannoMoveClip.currentFrame; var curframe = this.cannoMoveClip.currentFrame;
if(curframe>=this.stopFrame){ if(curframe>=this.stopFrame){
this.cannoMoveClip.gotoAndStop(this.stopFrame);
if(this.stopFrame==361){ if(this.stopFrame==361){
this.cannoMoveClip.gotoAndStop(1);
return;
// console.log("炮台发射完毕"); // console.log("炮台发射完毕");
} }
this.cannoMoveClip.gotoAndStop(this.stopFrame-1);
} }
} }
// /** // /**
...@@ -615,7 +594,7 @@ export class Element extends eui.Component { ...@@ -615,7 +594,7 @@ export class Element extends eui.Component {
this._type = type; this._type = type;
this.cannobox.visible = this.cannolab.visible = type == ElementType.CANNO; this.cannobox.visible = this.cannolab.visible = type == ElementType.CANNO;
this.showImage.visible = type != ElementType.CANNO; this.showImage.visible = type != ElementType.CANNO;
// this.cannolab.visible = false; this.cannolab.visible = false;
this.changeSource("ele" + type + "_png"); this.changeSource("ele" + type + "_png");
//特效重置 //特效重置
......
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