Commit 16a4c359 authored by zjz1994's avatar zjz1994

调整猩猩的动画暂存

parent 29e6f2ee
...@@ -1402,6 +1402,14 @@ export default class MainScene extends Scene { ...@@ -1402,6 +1402,14 @@ export default class MainScene extends Scene {
// console.log(cannoele.cannoMoveClip.currentFrame); // console.log(cannoele.cannoMoveClip.currentFrame);
// } // }
onTap_boomBtn() { onTap_boomBtn() {
for(var i=0;i<this.lattices.length;i++){
var lat = this.lattices[i];
if(lat&&lat.element&&lat.element.inPongoPart&&lat.element.inPongoPart=="tl"){
var pongoele:Element = lat.element;
pongoele.changePongoStop("add");
}
}
return;
NetManager.ins.clickLog(getlogItem(7)); NetManager.ins.clickLog(getlogItem(7));
if(this.propBtnCon.boomBtn.propNumShow.count <= 0) { if(this.propBtnCon.boomBtn.propNumShow.count <= 0) {
//购买弹框 //购买弹框
...@@ -1412,6 +1420,14 @@ export default class MainScene extends Scene { ...@@ -1412,6 +1420,14 @@ export default class MainScene extends Scene {
} }
onTap_hammerBtn() { onTap_hammerBtn() {
for(var i=0;i<this.lattices.length;i++){
var lat = this.lattices[i];
if(lat&&lat.element&&lat.element.inPongoPart&&lat.element.inPongoPart=="tl"){
var pongoele:Element = lat.element;
pongoele.changePongoStop("cut");
}
}
return;
NetManager.ins.clickLog(getlogItem(10)); NetManager.ins.clickLog(getlogItem(10));
if(this.propBtnCon.hammerBtn.propNumShow.count <= 0) { if(this.propBtnCon.hammerBtn.propNumShow.count <= 0) {
//购买弹框 //购买弹框
......
...@@ -280,7 +280,7 @@ export class Element extends eui.Component { ...@@ -280,7 +280,7 @@ export class Element extends eui.Component {
} }
} }
initPongoMoveClip(){ initPongoMoveClip(){
console.log("创建了一个猩猩"); console.log("创建了一个猩猩",this.pongoMoveClip);
var boxwidth = 80; var boxwidth = 80;
var boxheight = 80; var boxheight = 80;
var mvwidth = 161; var mvwidth = 161;
...@@ -289,18 +289,63 @@ export class Element extends eui.Component { ...@@ -289,18 +289,63 @@ export class Element extends eui.Component {
this.pongoMoveClip.x = (boxwidth-mvwidth)/2; this.pongoMoveClip.x = (boxwidth-mvwidth)/2;
this.pongoMoveClip.y = (boxheight-mvheight)/2; this.pongoMoveClip.y = (boxheight-mvheight)/2;
this.addChild(this.pongoMoveClip); this.addChild(this.pongoMoveClip);
this.pongoMoveClip.gotoAndPlay(1); // this.pongoMoveClip.gotoAndPlay(1);
this.pongoMoveClip.gotoAndStop(1);
this.noseeimgs = new Array(); this.noseeimgs = new Array();
this.lessPart = ["tl","tr","bl","br"]; this.lessPart = ["tl","tr","bl","br"];
this.pongoMoveClip.addEventListener(egret.Event.ENTER_FRAME,this.pongoFrameAni,this); this.pongoMoveClip.addEventListener(egret.Event.ENTER_FRAME,this.pongoFrameAni,this);
egret.ticker.$startTick(this.update,this); egret.ticker.$startTick(this.update,this);
} }
//调整猩猩显示
changePongoStop(type:string){
var curframe = this.pongoMoveClip.currentFrame;
console.log("当前猩猩cur"+curframe);
if(type=="add"){
curframe += 10;
}else if(type=="cut"){
curframe -= 10;
}
if(curframe>=481){
curframe = 481;
}else if(curframe<=1){
curframe = 1;
}
this.pongoMoveClip.gotoAndStop(curframe);
}
/**
* 脚草的动画单独
*
* 上部俩手都在 tl,tr-------1-101;
*
*/
//猩猩当前应处于的播放状态 //猩猩当前应处于的播放状态
//控制猩猩的播放 //控制猩猩的播放
ispongoMvloop:boolean = false;
pongoMvstart:number = 1;
pongoMvend:number = 101;
pongoFrameAni(){ pongoFrameAni(){
var curframe = this.pongoMoveClip.currentFrame; var curframe = this.pongoMoveClip.currentFrame;
//检测当前 //检测当前
if(this.lessPart.indexOf("tl")!=-1&&this.lessPart.indexOf("tr")!=-1){
this.ispongoMvloop = true;
this.pongoMvstart = 1;
this.pongoMvend = 101;
}
if(curframe<this.pongoMvend&&!this.pongoMoveClip.isPlaying){
console.log("检测到动画暂停,继续播放");
this.pongoMoveClip.gotoAndPlay(curframe,1);
}
if(curframe==(this.pongoMvend-1)){
if(this.ispongoMvloop){
console.log("重播猩猩");
this.pongoMoveClip.gotoAndPlay(this.pongoMvstart,1);
}else{
this.pongoMoveClip.gotoAndStop(this.pongoMvend);
}
}
} }
changePongoStat(part:string,lock:string="free"){ changePongoStat(part:string,lock:string="free"){
var partIarr:Array<number> = []; var partIarr:Array<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