Commit 94f27fa6 authored by zjz1994's avatar zjz1994

调整动画

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