!function(){function t(t){this.type=t.type;this.keyframeOpt=t;this.changeFrame(t)}function e(){}inherits(t,QyTimeline);window.QyKeyframe=t;t.prototype.changeFrame=function(t){this.loop=null!=t.loop?t.loop:!0;this.startPosition=null!=t.startPosition?t.startPosition:0;if("multiImages"==this.type){this.setupMultiImages(t.frames);this.xStart=0;this.yStart=0}else if("largeImage"==this.type&&void 0!==t.total){this.setupLargeImage(t);this.xStart=0;this.yStart=0}else{if("string"==typeof t)t=this.frames&&this.frames[t];else if(t.frames){this.frames=t.frames;t=t.frames[t.defaultFrame]}this.delay=null!=t.delay?60*t.delay:200;this.xNum=t.xNum||1;this.xStart=null!=t.xStart?t.xStart:0;this.xEnd=null!=t.xEnd?t.xEnd:this.xNum-1;this.yStart=null!=t.yStart?t.yStart:0;this.yEnd=t.yEnd?t.yEnd:this.yStart;this.xLen=this.xEnd-this.xStart+1;this.yLen=this.yEnd-this.yStart+1,this.setupStepDefs()}this.target=this;QyTimeline.call(this,{delay:0,loop:this.loop,startPosition:this.startPosition});t.sprite&&this.setSprite(t.sprite)};t.prototype.showOneMultiImgsFrame=function(t){var e=t.extraArg[0],i=this.frames[e];this.multiImageTextures||(this.multiImageTextures={});var s=this.multiImageTextures[e];if(!s){var r,a;if(i.url)r=i.url;else if(i.type){var h=game.picturelists&&game.picturelists[i.type];r=h.image;a=h.plistData[i.frame]}if(r){s=PIXI.Texture.fromImage(r);a&&s.setFrame(a);this.multiImageTextures[e]=s}if(!s)return}this.sprite.setTexture(s);s.width&&this.sprite.setSize(s.width,s.height);return this};t.prototype.showOneLargeImgFrame=function(t){var e=t.extraArg[0],i=t.extraArg[1],s=this.frame,r=this.size,a=s.hFrameOffset+e,h=s.vFrameOffset+i,n=s.hPixelOffset+r.width*a+e*s.hSplit,o=s.vPixelOffset+r.height*h+i*s.vSplit;this.setPixiFrame(n,o,r.width,r.height);return this};t.prototype.setupMultiImages=function(t){this.frames=t;var i=t.length,s=0;this.stepDefs_=new Array(i+1);for(var r=0;i>r;r++){this.stepDefs_[r]=[s,this.showOneMultiImgsFrame,[r]];s+=100*t[r].delay}this.stepDefs_[i]=[s,e];this.stepMax_=s+1;return this};t.prototype.setupLargeImage=function(t){this.frame=t;var i=t.total,s=100*t.delay,r=t.xNum;this.stepDefs_=new Array(i+1);for(var a=0;i>a;a++)this.stepDefs_[a]=[a*s,this.showOneLargeImgFrame,[a%r,Math.floor(a/r)]];this.stepDefs_[i]=[i*s,e];this.stepMax_=i*s+1;return this};t.prototype.setupStepDefs=function(){var t=this.xStart,i=this.xLen,s=this.yStart,r=this.yLen,a=this.delay,h=i*r,n=0;this.stepDefs_=new Array(h+1);for(var o=0;r>o;o++)for(var p=0;i>p;p++){n=o*i+p;this.stepDefs_[n]=[n*a,this.showFrame,[t+p,s+o]]}this.stepDefs_[h]=[h*a,e];this.stepMax_=h*a+1;return this};t.prototype.showFrame=function(t){var e=t.extraArg,i=e[0],s=e[1],r=this.size;this.setPixiFrame(i*r.width,s*r.height,r.width,r.height);return this};t.prototype.setPixiFrame=function(t,e,i,s){var r=this.sprite,a=t+":"+e;r.pixiFrames||(r.pixiFrames={});if(!r.pixiFrames[a]){var h={x:t*qyengine.gRenderer.resolution,y:e*qyengine.gRenderer.resolution,width:i*qyengine.gRenderer.resolution,height:s*qyengine.gRenderer.resolution};r.pixiFrames[a]=new PIXI.Texture(r.texture.baseTexture,h);r.setSize(i,s)}r.setTexture(r.pixiFrames[a])};t.prototype.setSprite=function(t){this.sprite=t;this.size=t.getSize();return this};var i=!1;t.prototype.getDirector=function(){return current_scene.isPaused_&&i?null:qyengine.getDirector()};t.prototype.setSpeed=function(t,e){var i;if("multiImages"===this.type){var s;if(e){t+=100;s=JSON.parse(JSON.stringify(this.frames||[]))}else{s=this.keyframeOpt&&this.keyframeOpt.frames;s=JSON.parse(JSON.stringify(s||[]))}s&&s.length&&s.forEach(function(e){e.delay/=t/100});i={loop:this.loop,frames:s,startPosition:this.startPosition}}else if("largeImage"===this.type){var r;if(e){t+=100;r=JSON.parse(JSON.stringify(this.frame||{}))}else{r=this.keyframeOpt;r=JSON.parse(JSON.stringify(r||{}))}r.delay/=t/100;i=r}else{i=this;if(e){t+=100;this.delay=this.delay/100/t*100}else this.delay=this.keyframeOpt&&this.keyframeOpt.delay/100/t*100}this.stop();this.changeFrame(i);this.start()}}();