Commit d07baf53 authored by zjz1994's avatar zjz1994

调整大炮,转盘手指的资源加载

parent f9995ad1
...@@ -1055,6 +1055,17 @@ export default class MainScene extends Scene { ...@@ -1055,6 +1055,17 @@ export default class MainScene extends Scene {
}); });
var dirType = Tool.getCannoDir(elements[i]); var dirType = Tool.getCannoDir(elements[i]);
canno.resetToCannoView(dirType,this); canno.resetToCannoView(dirType,this);
//添加大炮
if(cannomvdata){
canno.createCanno(cannomvdata);
}else{
if (!svgaParser) svgaParser = new window["SVGA"].Parser();
svgaParser.load(resPath + 'resource/assets/svgas/canno1.svga',(videoItem)=>{
cannomvdata = videoItem;
canno.createCanno(cannomvdata);
})
}
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);
......
...@@ -56,6 +56,9 @@ export default class Turntable extends Panel { ...@@ -56,6 +56,9 @@ export default class Turntable extends Panel {
this['nums'].text = `我的元宝:${getHomeData().wealth}`; this['nums'].text = `我的元宝:${getHomeData().wealth}`;
this['btnLabel'].text = ""; this['btnLabel'].text = "";
this.initUI(); this.initUI();
if(handmoveclip&&handmoveclip.parent){
handmoveclip.parent.removeChild(handmoveclip);
}
} }
public async onShowAnim(){ public async onShowAnim(){
let targetY:number; let targetY:number;
...@@ -320,6 +323,7 @@ export default class Turntable extends Panel { ...@@ -320,6 +323,7 @@ export default class Turntable extends Panel {
var whandy = this["start_btn"].parent.localToGlobal(0,startpy).y; var whandy = this["start_btn"].parent.localToGlobal(0,startpy).y;
var handy = this['container2'].globalToLocal(0,whandy).y-1334/2; var handy = this['container2'].globalToLocal(0,whandy).y-1334/2;
this['container2'].addChild(handmoveclip); this['container2'].addChild(handmoveclip);
handmoveclip.gotoAndPlay(1);
handmoveclip.y = handy; handmoveclip.y = handy;
} }
} }
......
...@@ -509,38 +509,33 @@ export class Element extends eui.Component { ...@@ -509,38 +509,33 @@ export class Element extends eui.Component {
} }
this.addChild(this.festivalEle) this.addChild(this.festivalEle)
} }
this.createCanno();
} }
//添加炮台 //添加炮台
createCanno(){ createCanno(videoItem:any){
if(this.type==ElementType.CANNO){ if(this.type==ElementType.CANNO&&videoItem){
if(this.cannoMoveClip){ if(this.cannoMoveClip){
if(this.cannoMoveClip.parent){
this.cannoMoveClip.parent.removeChild(this.cannoMoveClip);
}
this.initCannoMoveClidp();
return; return;
} }
if (!svgaParser) svgaParser = new window["SVGA"].Parser(); else{
var svgas = ["canno1"] this.cannoMoveClip = new window["SVGA"].EgretMovieClip(videoItem);
for(let i=0;i<svgas.length;i++){ this.initCannoMoveClidp();
let mvname = svgas[i]; }
svgaParser.load(resPath + 'resource/assets/svgas/'+mvname+'.svga',(videoItem)=>{
if(mvname=="canno1"){
this.cannoMoveClip = new window["SVGA"].EgretMovieClip(videoItem);
// this.cannoMoveClip.lockStep = true;
var mvwidth = 82;
var mvheight = 132;
this.cannoMoveClip.x = (this.cannoboxwid-mvwidth)/2;
this.cannoMoveClip.y = -mvheight/4;
this.cannobox.addChild(this.cannoMoveClip);
this.cannoMoveClip.gotoAndStop(1);
this.cannoMoveClip.addEventListener(egret.Event.ENTER_FRAME,this.toFrameAni,this);
}
});
}
} }
} }
initCannoMoveClidp(){
var mvwidth = 82;
var mvheight = 132;
this.cannoMoveClip.x = (this.cannoboxwid-mvwidth)/2;
this.cannoMoveClip.y = -mvheight/4;
this.cannobox.addChild(this.cannoMoveClip);
this.cannoMoveClip.gotoAndStop(1);
this.cannoMoveClip.addEventListener(egret.Event.ENTER_FRAME,this.toFrameAni,this);
}
stopFrame:number; stopFrame:number;
/** /**
* 炮台动画停止 * 炮台动画停止
......
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