Commit 59ee086e authored by zjz1994's avatar zjz1994

调整动画

parent e4e3157b
...@@ -414,7 +414,7 @@ export default class MainScene extends Scene { ...@@ -414,7 +414,7 @@ export default class MainScene extends Scene {
//如果有节日的加 //如果有节日的加
if (this.festivalTarget) svgas.push("redBombLight"); if (this.festivalTarget) svgas.push("redBombLight");
//到时候用炮台石头的替换todo //到时候用炮台石头的替换todo
svgas.push("canno"); svgas.push("cannoblock");
for (let i = 0; i < svgas.length; i++) { for (let i = 0; i < svgas.length; i++) {
if (movieClips[svgas[i]]) continue; if (movieClips[svgas[i]]) continue;
...@@ -423,15 +423,16 @@ export default class MainScene extends Scene { ...@@ -423,15 +423,16 @@ export default class MainScene extends Scene {
svgaParser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => { svgaParser.load(resPath + 'resource/assets/svgas/' + svgas[i] + ".svga", (videoItem) => {
var mv = new window["SVGA"].EgretMovieClip(videoItem); var mv = new window["SVGA"].EgretMovieClip(videoItem);
mv.lockStep = true; mv.lockStep = true;
if(svgas[i]=="canno"){ if(svgas[i]=="cannoblock"){
// console.log("石头破裂动画",mv);
} }
else if (svgas[i] != "bonusTime") { if (svgas[i] != "bonusTime") {
mv.x = (750 - 520) / 2; mv.x = (750 - 520) / 2;
mv.y = 500; mv.y = 500;
} }
mv.stop(); mv.stop();
movieClips[svgas[i]] = mv;
let fun; let fun;
mv.addEventListener(egret.Event.COMPLETE, fun = function (e) { mv.addEventListener(egret.Event.COMPLETE, fun = function (e) {
e.target.stop() e.target.stop()
...@@ -439,7 +440,6 @@ export default class MainScene extends Scene { ...@@ -439,7 +440,6 @@ export default class MainScene extends Scene {
e.target.parent.removeChild(e.target) e.target.parent.removeChild(e.target)
} }
}, this) }, this)
movieClips[svgas[i]] = mv;
}, function (error) { }, function (error) {
// alert(error.message); // alert(error.message);
}) })
...@@ -452,7 +452,7 @@ export default class MainScene extends Scene { ...@@ -452,7 +452,7 @@ export default class MainScene extends Scene {
var resPath = getResPath(); var resPath = getResPath();
this.cannoEffect = new Array(); this.cannoEffect = new Array();
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); if (!svgaParser) svgaParser = new window["SVGA"].Parser();
var svgas = ["cannofire","cannolight","cannoparticle"];//新增大炮的动画 var svgas = ["cannofire1","cannolight","cannoparticle"];//新增大炮的动画
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;
...@@ -487,12 +487,13 @@ export default class MainScene extends Scene { ...@@ -487,12 +487,13 @@ export default class MainScene extends Scene {
// mv.lockStep = true; // mv.lockStep = true;
mv.gotoAndStop(1); mv.gotoAndStop(1);
mv["cannoidx"] = i; mv["cannoidx"] = i;
if(jsvgname=="cannofire"){ if(jsvgname=="cannofire1"){
mv.x = icannoboxwid-6; var mvwidth = 1009;
mv.y = -icannoboxhei*3/2+5; var mvheight = 100;
mv.x = icannoboxwid-8;
mv.y = (icannoboxhei-mvwidth)+180;
mv.rotation = 90; mv.rotation = 90;
// console.log("cannofireTotal-------",mv. totalFrames); // console.log("cannofireTotal-------",mv,mv.totalFrames);
mv.addEventListener(egret.Event.ENTER_FRAME,this.listenCnfire,this); mv.addEventListener(egret.Event.ENTER_FRAME,this.listenCnfire,this);
}else if(jsvgname=="cannolight"){ }else if(jsvgname=="cannolight"){
var mvwidth = 400; var mvwidth = 400;
...@@ -520,7 +521,7 @@ export default class MainScene extends Scene { ...@@ -520,7 +521,7 @@ export default class MainScene extends Scene {
listenCnfire(e){ listenCnfire(e){
var target = e.target; var target = e.target;
var curframe = target.currentFrame; var curframe = target.currentFrame;
if(curframe>=48){ if(curframe>=30){
// console.log("fire播放完成",target["cannoidx"]); // console.log("fire播放完成",target["cannoidx"]);
target.gotoAndStop(1); target.gotoAndStop(1);
if(target.parent){ if(target.parent){
...@@ -558,12 +559,12 @@ export default class MainScene extends Scene { ...@@ -558,12 +559,12 @@ export default class MainScene extends Scene {
} }
}else if(curframe==60){ }else if(curframe==60){
var icannoidx = target["cannoidx"]; var icannoidx = target["cannoidx"];
this.selectPlayCannoEffect(icannoidx,"cannofire"); this.selectPlayCannoEffect(icannoidx,"cannofire1");
} }
} }
selectPlayCannoFire(idx:number){ selectPlayCannoFire(idx:number){
var arridx = this.getCannoArrByIdx(idx); var arridx = this.getCannoArrByIdx(idx);
this.selectPlayCannoEffect(arridx,"cannofire"); this.selectPlayCannoEffect(arridx,"cannofire1");
} }
/** /**
* 播放炮台动画 * 播放炮台动画
...@@ -3721,16 +3722,17 @@ export default class MainScene extends Scene { ...@@ -3721,16 +3722,17 @@ export default class MainScene extends Scene {
removeCannoBlock(index:number){ removeCannoBlock(index:number){
this.removeOperation(index); this.removeOperation(index);
//炮台石头的动效 //炮台石头的动效
var blockmv = movieClips["canno"]; var blockmv = movieClips["cannoblock"];
if(blockmv){ if(blockmv){
console.log("播放炮台石头的动效"); console.log("播放炮台石头的动效");
var blpos = Tool.getPositionByIndex(index); var blpos = Tool.getPositionByIndex(index);
var bwpos = this.elementContainer.localToGlobal(blpos[0],blpos[1]); var bwpos = this.elementContainer.localToGlobal(blpos[0],blpos[1]);
var blockwid = 116; var blockwid = 112;
var blockhei = 116; var blockhei = 97;
blockmv.x = bwpos.x-blockwid/2; blockmv.x = bwpos.x-blockwid-5;
blockmv.y = bwpos.y-blockhei/2; blockmv.y = bwpos.y-35;
this.addChild(blockmv); this.addChild(blockmv);
// blockmv.gotoAndStop(1);
blockmv.gotoAndPlay(1,1); blockmv.gotoAndPlay(1,1);
} }
} }
...@@ -3810,6 +3812,9 @@ export default class MainScene extends Scene { ...@@ -3810,6 +3812,9 @@ export default class MainScene extends Scene {
if (!this.lattices[index] || !this.lattices[index].element) return null if (!this.lattices[index] || !this.lattices[index].element) return null
//先赋值指向 //先赋值指向
let ele = this.lattices[index].element; let ele = this.lattices[index].element;
let eletype = ele.type;
let eleffectype = ele.effectType;
//添加进emptys //添加进emptys
this.emptys.push(index) this.emptys.push(index)
//从容器移除 //从容器移除
...@@ -3821,6 +3826,7 @@ export default class MainScene extends Scene { ...@@ -3821,6 +3826,7 @@ export default class MainScene extends Scene {
//返回下,有地方要用 //返回下,有地方要用
//炮台充能 //炮台充能
// console.log("消除元素类型",eletype,eleffectype);
for(let p=0;p<this.cannoArr.length;p++){ for(let p=0;p<this.cannoArr.length;p++){
let pcannoidx = this.cannoArr[p].idx; let pcannoidx = this.cannoArr[p].idx;
var isnext = Tool.checkNebByidx(pcannoidx,index); var isnext = Tool.checkNebByidx(pcannoidx,index);
......
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