Browse Subversion Repository
Contents of /trunk/jgame.min.js
Parent Directory
| Revision Log
Revision 158 -
( show annotations)
( download)
( as text)
Tue Sep 10 03:58:36 2013 UTC
(10 years, 8 months ago)
by tsugehara
File MIME type: application/x-javascript
File size: 104838 byte(s)
動作しないエフェクトをenumからさ駆除
| 1 |
var jg;!function(t){!function(t){t[t.Unknown=0]="Unknown",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.Up=3]="Up",t[t.Down=4]="Down"}(t.Angle||(t.Angle={})),t.Angle,function(t){t[t.Unknown=0]="Unknown",t[t.Transfer=1]="Transfer",t[t.Flip=2]="Flip",t[t.Direct=3]="Direct"}(t.RenderTransferMode||(t.RenderTransferMode={})),t.RenderTransferMode,function(t){t[t.Unknown=0]="Unknown",t[t.Keyboard=1]="Keyboard",t[t.Point=2]="Point"}(t.InputEventType||(t.InputEventType={})),t.InputEventType,function(t){t[t.Unknown=0]="Unknown",t[t.Down=1]="Down",t[t.Move=2]="Move",t[t.Up=3]="Up"}(t.InputEventAction||(t.InputEventAction={})),t.InputEventAction,function(t){t[t.Unknown=0]="Unknown",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.Up=3]="Up",t[t.Down=4]="Down",t[t.Enter=5]="Enter",t[t.Esc=6]="Esc"}(t.Keytype||(t.Keytype={})),t.Keytype,function(t){t[t.Unknown=0]="Unknown",t[t.Stroke=1]="Stroke",t[t.Fill=2]="Fill"}(t.ShapeStyle||(t.ShapeStyle={})),t.ShapeStyle,function(t){t[t.Unknown=0]="Unknown",t[t.Rect=1]="Rect",t[t.Arc=2]="Arc"}(t.ShapeType||(t.ShapeType={})),t.ShapeType,function(t){t[t.None=0]="None",t[t.Fade=1]="Fade",t[t.Mosaic=2]="Mosaic",t[t.Blur=3]="Blur",t[t.SlideUp=4]="SlideUp",t[t.SlideDown=5]="SlideDown",t[t.SlideLeft=6]="SlideLeft",t[t.SlideRight=7]="SlideRight",t[t.WipeUp=8]="WipeUp",t[t.WipeDown=9]="WipeDown",t[t.WipeLeft=10]="WipeLeft",t[t.WipeRight=11]="WipeRight",t[t.WipeFadeUp=12]="WipeFadeUp",t[t.WipeFadeDown=13]="WipeFadeDown",t[t.WipeFadeLeft=14]="WipeFadeLeft",t[t.WipeFadeRight=15]="WipeFadeRight",t[t.BoxOut=16]="BoxOut",t[t.BoxOut45=17]="BoxOut45",t[t.BoxIn=18]="BoxIn",t[t.BoxIn45=19]="BoxIn45",t[t.ArcOut=20]="ArcOut",t[t.ArcIn=21]="ArcIn"}(t.EffectType||(t.EffectType={})),t.EffectType}(jg||(jg={})),window.requestAnimationFrame||(window.requestAnimationFrame=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(){var t=Date.now?Date.now():(new Date).getTime(),e=1e3/60;return function(i){var n=Date.now?Date.now():(new Date).getTime(),r=setTimeout(function(){i(Date.now?Date.now():(new Date).getTime())},Math.max(0,t+e-n));return t=n,r}}()),window.createCanvas=function(t,e){var i=document.createElement("canvas");if(i.width=t,i.height=e,"imageSmoothingEnabled"in window){var n=jg.JGUtil.getBrowser();n.opera?i.style.imageRendering="-o-crisp-edges":n.msie?i.style.msInterpolationMode="nearest-neighbor":n.safari&&(i.style.imageRendering="-webkit-optimize-contrast");var r=i.getContext("2d");r.imageSmoothingEnabled&&(r.imageSmoothingEnabled=!1),r.webkitImageSmoothingEnabled&&(r.webkitImageSmoothingEnabled=!1),r.mozImageSmoothingEnabled&&(r.mozImageSmoothingEnabled=!1)}return i};var jg;!function(t){var e=function(){function t(t,e,i,n){this.left=t,this.top=e,this.right=i,this.bottom=n}return t.prototype.hitTest=function(t){return this.left<=t.x&&this.right>=t.x&&this.top<=t.y&&this.bottom>=t.y},t.prototype.fit=function(t){t.y<this.top?t.y=this.top:t.y>this.bottom&&(t.y=this.bottom),t.x<this.left?t.x=this.left:t.x>this.right&&(t.x=this.right)},t.prototype.width=function(){return Math.abs(this.right-this.left)},t.prototype.height=function(){return Math.abs(this.bottom-this.top)},t}();t.Rectangle=e}(jg||(jg={}));var jg;!function(t){var e=function(){function t(){}return t.LINEAR=function(t,e,i,n){return i*t/n+e},t.SWING=function(t,e,i,n){return i*(.5-Math.cos(t/n*Math.PI)/2)+e},t.QUAD_EASEIN=function(t,e,i,n){return i*(t/=n)*t+e},t.QUAD_EASEOUT=function(t,e,i,n){return-i*(t/=n)*(t-2)+e},t.QUAD_EASEINOUT=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},t.CUBIC_EASEIN=function(t,e,i,n){return i*(t/=n)*t*t+e},t.CUBIC_EASEOUT=function(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e},t.CUBIC_EASEINOUT=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},t.QUART_EASEIN=function(t,e,i,n){return i*(t/=n)*t*t*t+e},t.QUART_EASEOUT=function(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e},t.QUART_EASEINOUT=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},t.QUINT_EASEIN=function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},t.QUINT_EASEOUT=function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},t.QUINT_EASEINOUT=function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},t.SIN_EASEIN=function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},t.SIN_EASEOUT=function(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e},t.SIN_EASEINOUT=function(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e},t.CIRC_EASEIN=function(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e},t.CIRC_EASEOUT=function(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e},t.CIRC_EASEINOUT=function(t,e,i,n){return(t/=n/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},t.ELASTIC_EASEIN=function(t,e,i,n,r,s){if(0===t)return e;if(1===(t/=n))return e+i;s||(s=.3*n);var o;return!r||r<Math.abs(i)?(r=i,o=s/4):o=s/(2*Math.PI)*Math.asin(i/r),-(r*Math.pow(2,10*(t-=1))*Math.sin((t*n-o)*2*Math.PI/s))+e},t.ELASTIC_EASEOUT=function(t,e,i,n,r,s){if(0===t)return e;if(1===(t/=n))return e+i;s||(s=.3*n);var o;return!r||r<Math.abs(i)?(r=i,o=s/4):o=s/(2*Math.PI)*Math.asin(i/r),r*Math.pow(2,-10*t)*Math.sin((t*n-o)*2*Math.PI/s)+i+e},t.ELASTIC_EASEINOUT=function(t,e,i,n,r,s){if(0===t)return e;if(2===(t/=n/2))return e+i;s||(s=n*.3*1.5);var o;return!r||r<Math.abs(i)?(r=i,o=s/4):o=s/(2*Math.PI)*Math.asin(i/r),1>t?-.5*r*Math.pow(2,10*(t-=1))*Math.sin((t*n-o)*2*Math.PI/s)+e:.5*r*Math.pow(2,-10*(t-=1))*Math.sin((t*n-o)*2*Math.PI/s)+i+e},t.BOUNCE_EASEOUT=function(t,e,i,n){return(t/=n)<1/2.75?i*7.5625*t*t+e:2/2.75>t?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:2.5/2.75>t?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},t.BOUNCE_EASEIN=function(e,i,n,r){return n-t.BOUNCE_EASEOUT(r-e,0,n,r)+i},t.BOUNCE_EASEINOUT=function(e,i,n,r){return r/2>e?.5*t.BOUNCE_EASEIN(2*e,0,n,r)+i:.5*t.BOUNCE_EASEOUT(2*e-r,0,n,r)+.5*n+i},t.BACK_EASEIN=function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*(t/=n)*t*((r+1)*t-r)+e},t.BACK_EASEOUT=function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*((t=t/n-1)*t*((r+1)*t+r)+1)+e},t.BACK_EASEINOUT=function(t,e,i,n,r){return void 0===r&&(r=1.70158),(t/=n/2)<1?i/2*t*t*(((r*=1.525)+1)*t-r)+e:i/2*((t-=2)*t*(((r*=1.525)+1)*t+r)+2)+e},t.EXPO_EASEIN=function(t,e,i,n){return 0===t?e:i*Math.pow(2,10*(t/n-1))+e},t.EXPO_EASEOUT=function(t,e,i,n){return t===n?e+i:i*(-Math.pow(2,-10*t/n)+1)+e},t.EXPO_EASEINOUT=function(t,e,i,n){return 0===t?e:t===n?e+i:(t/=n/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(-Math.pow(2,-10*--t)+2)+e},t}();t.Easing=e}(jg||(jg={}));var jg;!function(t){t.ENTITY_OPTIONS_DEFAULT_VALUES={rotate:0,translate:{x:0,y:0},transform:{m11:1,m12:0,m21:0,m22:1,dx:0,dy:0},scale:{x:1,y:1},purescale:{x:1,y:1},globalAlpha:void 0,font:void 0,fillStyle:void 0,strokeStyle:void 0,lineCap:void 0,lineJoin:void 0,lineWidth:void 0,miterLimit:void 0,shadowBlur:void 0,shadowColor:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,textAlign:void 0,textBaseline:void 0,globalCompositeOperation:void 0};var e=function(){function e(){this.opacity=1,this.x=0,this.y=0}return e.prototype.enablePointingEvent=function(){this.pointCapture=!0,this.pointDown||(this.pointDown=new t.Trigger),this.pointUp||(this.pointUp=new t.Trigger),this.pointMove||(this.pointMove=new t.Trigger)},e.prototype.disablePointingEvent=function(){delete this.pointCapture},e.prototype.removeDrawOption=function(t){if(this.options){void 0!==this.options[t]&&delete this.options[t];var e=0;for(var i in this.options){e++;break}e||delete this.options,this.updated()}},e.prototype.setDrawOption=function(t,e){this.options||(this.options={}),this.options[t]=e,this.updated()},e.prototype.getDrawOption=function(e){return this.options&&void 0!=this.options[e]?this.options[e]:t.ENTITY_OPTIONS_DEFAULT_VALUES[e]},e.prototype.moveTo=function(t,e){this.x=t,this.y=e,this.updated()},e.prototype.moveBy=function(t,e){this.x+=t,this.y+=e,this.updated()},e.prototype.scrollTo=function(t,e){this.scroll={x:t,y:e},this.updated()},e.prototype.scrollBy=function(t,e){this.scroll||(this.scroll={x:0,y:0}),this.scroll.x+=t,this.scroll.y+=e,this.updated()},e.prototype.activate=function(){if(this.active_queue){for(var t;t=this.active_queue.shift();)t.call(this);delete this.active_queue}if(this.entities)for(var e=0;e<this.entities.length;e++)this.entities[e].scene||(this.entities[e].scene=this.scene,this.entities[e].activate())},e.prototype.addActiveQueue=function(t){return this.scene?(t.call(this),void 0):(this.active_queue||(this.active_queue=[]),this.active_queue.push(t),void 0)},e.prototype.appendTo=function(t,e){t.append(this,e)},e.prototype.remove=function(){if(!this.parent)throw"Can not remove layer. (use scene.deleteLayer)";this.parent.removeChild(this)},e.prototype.insert=function(t,e){if(!this.entities)throw"Can not call append of non-container entity";if(t.scene=this.scene,t.parent=this,"number"!=typeof e)for(var i=0;i<this.entities.length;i++)if(this.entities[i]==e){e=i;break}this.entities.splice(e,0,t),t.activate(),this.updated()},e.prototype.append=function(t){if(!this.entities)throw"Can not call append of non-container entity";t.scene=this.scene,t.parent=this,this.entities.push(t),this.scene&&t.activate(),this.updated()},e.prototype.removeChild=function(t){if(!this.entities)throw"Can not call removeChild of non-container entity";for(var e=0;e<this.entities.length;e++)if(this.entities[e]==t){if(t.entities)for(var i;i=t.entities.pop();)t.removeChild(i);return this.entities.splice(e,1),t.destroy(),this.updated(),!0}return!1},e.prototype.start=function(){this.started||(this.started=!0,this.scene?this.scene.game.update.handle(this,this.update):this.addActiveQueue(function(){this.scene.game.update.handle(this,this.update)}))},e.prototype.stop=function(){this.started&&(this.started=!1,this.scene?this.scene.game.update.remove(this,this.update):this.addActiveQueue(function(){this.scene.game.update.remove(this,this.update)}))},e.prototype.startTimer=function(t,e){this.scene?this.scene.game.addTimer(t,this,e?e:this.interval):this.addActiveQueue(function(){this.scene.game.addTimer(t,this,e?e:this.interval)})},e.prototype.stopTimer=function(t,e){this.scene?this.scene.game.removeTimer(t,this,e?e:this.interval):this.addActiveQueue(function(){this.scene.game.removeTimer(t,this,e?e:this.interval)})},e.prototype.updated=function(){for(var t=this;t.parent;)t=t.parent;t.isUpdated=!0},e.prototype.tl=function(){return this._tl||(this._tl=new t.Timeline(this)),this._tl},e.prototype.destroy=function(){if(this._tl&&(this._tl.clear(),delete this._tl),this.stop(),this.scene&&(this.scene.game.removeTimerAll(this),this.scene=null),delete this.parent,this.entities)for(var t;t=this.entities.pop();)t.destroy();this.pointDown&&(this.pointDown.destroy(),delete this.pointDown),this.pointUp&&(this.pointUp.destroy(),delete this.pointUp),this.pointMove&&(this.pointMove.destroy(),delete this.pointMove)},e.prototype.offset=function(){var t=this.parent?this.parent.offset():{x:this.scroll?this.scroll.x:0,y:this.scroll?this.scroll.y:0};return{x:this.x+t.x,y:this.y+t.y}},e.prototype.rect=function(){var e=this.offset();return new t.Rectangle(e.x,e.y,e.x+this.width,e.y+this.height)},e.prototype.hitTest=function(t){return this.rect().hitTest(t)},e.prototype.getDistance=function(t){var e=t;return e.width&&e.height?{x:Math.abs(e.x+e.width/2-(this.x+this.width/2)),y:Math.abs(e.y+e.height/2-(this.y+this.height/2))}:{x:Math.abs(t.x-(this.x+this.width/2)),y:Math.abs(t.y-(this.y+this.height/2))}},e.prototype.getEntityByPoint=function(t,e){if(this.entities)for(var i=this.entities.length-1;i>=0;i--)if(e||this.entities[i].pointCapture){var n=this.entities[i].getEntityByPoint(t);if(n)return n}return(e||this.pointCapture)&&this.hitTest(t)?this:null},e.prototype.createSprite=function(){var e=new t.BufferedRenderer({width:this.width,height:this.height}),i=this.x,n=this.y;return this.x=0,this.y=0,e.renderUnit(this),this.x=i,this.y=n,e.createSprite()},e.prototype.update=function(){},e.prototype.interval=function(){},e.prototype.draw=function(){},e.prototype.show=function(){this.opacity=1,this.updated()},e.prototype.hide=function(){this.opacity=0,this.updated()},e}();t.E=e}(jg||(jg={})),function(){var t=document.createElement("canvas"),e=t.getContext("2d");for(var i in jg.ENTITY_OPTIONS_DEFAULT_VALUES)void 0===jg.ENTITY_OPTIONS_DEFAULT_VALUES[i]&&(jg.ENTITY_OPTIONS_DEFAULT_VALUES[i]=e[i])}();var __extends=this.__extends||function(t,e){function i(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);i.prototype=e.prototype,t.prototype=new i},jg;!function(t){var e=function(e){function i(i,n,r,s,o){e.call(this),this.x=0,this.y=0,this.width=i,this.height=n,this.style=r?r:t.ShapeStyle.Stroke,s&&this.setColor(s),this.type=o?o:t.ShapeType.Rect}return __extends(i,e),i.prototype.setClip=function(t){this.clip=t,this.clip?this.disableTransform=!0:delete this.disableTransform},i.prototype.setStyle=function(t){this.style=t,this.setColor(this.getColor())},i.prototype.setLineWidth=function(t){this.setDrawOption("lineWidth",t)},i.prototype.getLineWidth=function(){return this.getDrawOption("lineWidth")},i.prototype.setColor=function(e){this.style==t.ShapeStyle.Stroke?this.setDrawOption("strokeStyle",e):this.setDrawOption("fillStyle",e)},i.prototype.getColor=function(){return this.style==t.ShapeStyle.Stroke?this.getDrawOption("strokeStyle"):this.getDrawOption("filltyle")},i.prototype.synchronize=function(t,e){this.syncObj=t,this.syncFunc=e},i.prototype.draw=function(e){switch(this.syncObj&&this.syncFunc.call(this.syncObj,this),this.clip&&(e.save(),e.translate(this.x,this.y),this.options&&this.scene.game.renderer.useDrawOption(this,e)),e.beginPath(),this.type){case t.ShapeType.Rect:e.rect(0,0,this.width,this.height);break;case t.ShapeType.Arc:var n=this.width/2;e.arc(n,n,n,0,i.PI_200_PER,!1)}this.clip?(e.restore(),e.clip()):this.style==t.ShapeStyle.Fill?e.fill():e.stroke()},i.PI_200_PER=2*Math.PI,i}(t.E);t.Shape=e}(jg||(jg={}));var jg;!function(t){var e=function(){function t(){this.handlers=[]}return t.prototype.handleInsert=function(t,e,i){i?this.handlers.splice(t,0,{owner:e,handler:i}):this.handlers.splice(t,0,{owner:window,handler:e})},t.prototype.handle=function(t,e){e?this.handlers.push({owner:t,handler:e}):this.handlers.push({owner:window,handler:t})},t.prototype.destroy=function(){this.handlers=[]},t.prototype.removeAll=function(t){for(var e,i=[];e=this.handlers.shift();)e.owner!=t&&i.push(e);this.handlers=i},t.prototype.removeAllByHandler=function(t){for(var e,i=[];e=this.handlers.shift();)e.handler!=t&&i.push(e);this.handlers=i},t.prototype.remove=function(t,e){var i,n=[];for(e||(e=t,t=window);i=this.handlers.shift();)(i.handler!=e||i.owner!=t)&&n.push(i);this.handlers=n},t.prototype.fire=function(t){if(0!=this.handlers.length)for(var e=this.handlers.concat(),i=0;i<e.length;i++)e[i].handler.call(e[i].owner,t)},t.prototype.fastFire=function(t){for(var e=0;e<this.handlers.length;e++)this.handlers[e].handler.call(this.handlers[e].owner,t)},t}();t.Trigger=e}(jg||(jg={}));var jg;!function(t){var e=function(){function t(){}return t.play=function(t,e){var i=new Audio(null);return i.src=t.src,i.loop=e?e:!1,i.play(),i},t.hasBgm=function(){return void 0!==t.bgm},t.playBgm=function(e,i){return t.bgm&&t.stopBgm(),e.load(),e.loop=i?i:!1,e.play(),t.bgm=e,t.bgm},t.stop=function(t){t&&t.pause()},t.stopBgm=function(){t.stop(t.bgm),delete t.bgm},t}();t.SimpleSound=e}(jg||(jg={}));var jg;!function(t){var e=function(){function t(t,e){this.img=t,this.sound=e}return t.prototype.isAbsolute=function(t){var e=[".","/"];return e.indexOf(t.charAt(0))>=0||t.match(/^(http:|https:|data:)/)?t:void 0},t.prototype.imageUrl=function(t){return this.isAbsolute(t)?t:this.img+t},t.prototype.soundUrl=function(t){return this.isAbsolute(t)?t:this.sound+t},t.Default=new t("img/","sound/"),t.Plain=new t("",""),t}();t.ResourceStructure=e}(jg||(jg={}));var jg;!function(t){var e=function(){function t(t){this.resource=t}return t.prototype.load=function(){},t}();t.ResourceLoader=e;var i=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e.prototype.load=function(t,e){var i=new Image;i.src=this.resource.structure.imageUrl(t);var n=this,r=this.completed;i.onerror=function(){r.call(n,e,i,!1)},i.onload=function(){r.call(n,e,i,!0)}},e.prototype.completed=function(t,e,i){i?this.resource.images[t]=e:console.log("error: "+t),this.resource.requestCompleted(t)},e}(e);t.ImageResourceLoader=i;var n=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e.prototype.load=function(t,i){var n=this,r=this.completed,s=function(){if(e.loading)return window.setTimeout(s,100),void 0;e.loading=!0;var o=document.createElement("script"),h=document.getElementsByTagName("head");if(0==h.length)throw"can not find head tag";o.src=t+"?"+(new Date).getTime(),o.onload=function(){r.call(n,i,o,!0),e.loading=!1},o.onerror=function(){r.call(n,i,o,!1),e.loading=!1},h[0].appendChild(o)};s()},e.prototype.completed=function(t,e,i){i?this.resource.scripts[t]=e:console.log("error: "+t),this.resource.requestCompleted(t)},e}(e);t.ScriptResourceLoader=n;var r=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e.prototype.load=function(t,e){var i=this,n=new Audio(null);n.autoplay=!1,n.preload="auto",n.src=this.resource.structure.soundUrl(t),n.load(),n.addEventListener("canplaythrough",function(){i.completed(e,n,!0)},!0),n.addEventListener("error",function(){i.completed(e,n,!1)},!0)},e.prototype.completed=function(t,e,i){i?this.resource.sounds[t]=e:console.log("error: "+t),this.resource.requestCompleted(t)},e}(e);t.SoundResourceLoader=r}(jg||(jg={}));var jg;!function(t){var e=function(){function e(){this.requests=[],this.loaded=new t.Trigger,this.added=new t.Trigger,this.clear(),this.loaders={},this.loaders.js=new t.ScriptResourceLoader(this),this.loaders["default"]=new t.ImageResourceLoader(this),this.loaders.mp3=new t.SoundResourceLoader(this),this.loaders.ogg=this.loaders.mp3,this.loaders.wav=this.loaders.mp3,this.loaders.mid=this.loaders.mp3,this.structure=t.ResourceStructure.Default}return e.getInstance=function(){return function(){return e.instance||(e.instance=new e),e.instance}()},e.prototype.clear=function(){this.images={},this.scripts={},this.sounds={}},e.prototype.get=function(t){return this.images[t]},e.prototype.sound=function(t){return this.sounds[t]},e.prototype.requestCompleted=function(t){for(var e=0;e<this.requests.length;e++)if(this.requests[e]==t){this.requests.splice(e,1);break}this.loaded.fire(this.requests.length)},e.prototype.load=function(t,e){e||(e=t),this.requests.push(t);var i,n=e.split(/\./g);i=0==n.length?"":n[n.length-1],i=i.toLowerCase();var r=this.loaders[i]?this.loaders[i]:this.loaders["default"];r.load(e,t),this.added.fire({name:t,url:e,loader:r})},e.prototype.loadManual=function(t){this.requests.push(t),this.added.fire({name:t,url:null,loader:null})},e.prototype.completeManual=function(t){this.requestCompleted(t)},e}();t.Resource=e}(jg||(jg={}));var jg;!function(t){var e=function(){function e(e){this.game=e,this.layers={},this.root=new t.Layer(this),this.layers.root=this.root,this.layerCount=1,this.mode=[],this.started=new t.Trigger,this.ended=new t.Trigger,this.showed=new t.Trigger,this.hid=new t.Trigger}return e.prototype.currentMode=function(){return 0==this.mode.length?null:this.mode[this.mode.length-1]},e.prototype.getLayerArray=function(){var t=[];for(var e in this.layers)t.push(this.layers[e]);return t},e.prototype.enablePointingEvent=function(){this.root.enablePointingEvent(),this.pointDown||(this.pointDown=new t.Trigger),this.pointMove||(this.pointMove=new t.Trigger),this.pointUp||(this.pointUp=new t.Trigger)},e.prototype.disablePointingEvent=function(){this.root.disablePointingEvent()},e.prototype.changeMode=function(t){var e=this.currentMode();e&&this[e+"Hide"]&&this[e+"Hide"](),this.mode.push(t),t&&(this[t+"Start"]&&this[t+"Start"](),this[t+"Show"]&&this[t+"Show"]())},e.prototype.endCurrentMode=function(t){if(0==this.mode.length)return this.end(),void 0;var e=this.mode.pop();e&&this[e+"End"]&&this[e+"End"]();var i=this.currentMode();void 0!==t?this.changeMode(t):i&&this[i+"Show"]&&this[i+"Show"]()},e.prototype.createLayer=function(e,i){for(var n in this.layers)this.layers[n].hasBuffer()||this.layers[n].createBuffer();return i&&i instanceof t.Layer?(this.layers[e]=i,this.layers[e].scene=this):(this.layers[e]=new t.Layer(this),i&&(this.layers[e].width=i.width,this.layers[e].height=i.height)),this.layers[e].createBuffer(),this.layerCount++,this.layers[e]},e.prototype.deleteLayer=function(t){if("root"==t)throw"can not delete root layer";this.layers[t].destroy(),delete this.layers[t],this.layerCount--,1==this.layerCount&&this.root.deleteBuffer()},e.prototype.destroy=function(){for(var t in this.layers)this.layers[t].destroy();this.keyDown&&this.keyDown.destroy(),this.keyUp&&this.keyUp.destroy(),this.pointDown&&this.pointDown.destroy(),this.pointUp&&this.pointUp.destroy(),this.pointMove&&this.pointMove.destroy()},e.prototype.end=function(){this.game.endScene()},e.prototype.refresh=function(){for(var t in this.layers)this.layers[t].refresh(),this.layers[t].updated()},e.prototype.scrollTo=function(t,e,i){i||(i="root"),this.layers[i].scrollTo(t,e)},e.prototype.scrollBy=function(t,e,i){(0!=t||0!=e)&&(i||(i="root"),this.layers[i].scrollBy(t,e))},e.prototype.append=function(t,e){e?this.layers[e].append(t):this.root.append(t)},e.prototype.removeEntity=function(t){for(var e in this.layers)this.layers[e].removeChild(t)},e}();t.Scene=e}(jg||(jg={}));var jg;!function(t){var e=function(t){function e(e,i,n){t.call(this),this.x=0,this.y=0,this.width=i?i:e.width,this.height=n?n:e.height,this.srcWidth=this.width,this.srcHeight=this.height,this.srcX=0,this.srcY=0,this.image=e}return __extends(e,t),e.prototype.draw=function(t){t.drawImage(this.image,this.srcX,this.srcY,this.srcWidth,this.srcHeight,0,0,this.width,this.height)},e}(t.E);t.Sprite=e}(jg||(jg={}));var jg;!function(t){var e=function(t){function e(e,i,n,r){t.call(this,e,i,n),this.sep=Math.floor(this.image.width/this.width);var s=Math.ceil(e.width*e.height)/(i*n);this.frame=[];for(var o=0;s>o;o++)this.frame.push(o);this.fno=0,this.animation=!1,this.wait=void 0===r?200:r,this.loop=!0}return __extends(e,t),e.prototype.changeFrame=function(){this.srcX=this.frame[this.fno]%this.sep*this.srcWidth,this.srcY=Math.floor(this.frame[this.fno]/this.sep)*this.srcHeight,this.updated()},e.prototype.animate=function(t){return this.animation?!0:(t||(this.fno=0),this.animation=!0,this.startTimer(this.wait),void 0)},e.prototype.inanimate=function(){this.animation&&(this.stopTimer(this.wait),this.animation=!1)},e.prototype.interval=function(){if(this.fno++,this.fno>=this.frame.length)if(this.loop)this.fno=0;else if(this.frameEnded)return this.inanimate(),this.frameEnded.fire(),void 0;this.changeFrame()},e}(t.Sprite);t.FrameSprite=e}(jg||(jg={}));var jg;!function(t){var e=function(e){function i(t,i,n,r){e.call(this,t,i,n,r),this.moving=!1,r||(r=200),this.animeCnt=2,this.charaSeq=0,this.charaCol=1,this.movePixel=64,this.moveTime=300,this.animate()}return __extends(i,e),i.prototype.moveLeft=function(e){return this.move(-this.movePixel,0,this.moveTime)?(this.angle(t.Angle.Left),!0):(e&&2*this.moveInfo.t>=this.moveInfo.f&&(this.nextMove="Left"),!1)},i.prototype.moveRight=function(e){return this.move(this.movePixel,0,this.moveTime)?(this.angle(t.Angle.Right),!0):(e&&2*this.moveInfo.t>=this.moveInfo.f&&(this.nextMove="Right"),!1)},i.prototype.moveUp=function(e){return this.move(0,-this.movePixel,this.moveTime)?(this.angle(t.Angle.Up),!0):(e&&2*this.moveInfo.t>=this.moveInfo.f&&(this.nextMove="Up"),!1)},i.prototype.moveDown=function(e){return this.move(0,this.movePixel,this.moveTime)?(this.angle(t.Angle.Down),!0):(e&&2*this.moveInfo.t>=this.moveInfo.f&&(this.nextMove="Down"),!1)},i.prototype.move=function(t,e,i){return this.moving?!1:(this.moving=!0,this.moveInfo={x:this.x,y:this.y,dx:this.x+t,dy:this.y+e,f:i,t:0},this.beginMove&&this.beginMove.fire(this.moveInfo),this.moving&&this.start(),!0)},i.prototype.update=function(t){this.moving&&(this.moveInfo.t+=t,this.moveInfo.t<this.moveInfo.f?this.moveTo(this.moveInfo.x+Math.round((this.moveInfo.dx-this.moveInfo.x)/this.moveInfo.f*this.moveInfo.t),this.moveInfo.y+Math.round((this.moveInfo.dy-this.moveInfo.y)/this.moveInfo.f*this.moveInfo.t)):(this.moveTo(this.moveInfo.dx,this.moveInfo.dy),this.endMove()))},i.prototype.endMove=function(){this.moving=!1,this.stop();var t={};this.nextMove&&(t.nextMove=this.nextMove,delete this.nextMove),this.moved&&this.moved.fire(t),t.nextMove&&this["move"+t.nextMove]()},i.prototype.angle=function(e){this.currentAngle=e;var i=4*Math.floor(this.charaSeq/this.charaCol);switch(e){case t.Angle.Up:i+=this.angleSeq?this.angleSeq[t.Angle.Up]:3;break;case t.Angle.Down:i+=this.angleSeq?this.angleSeq[t.Angle.Down]:0;break;case t.Angle.Left:i+=this.angleSeq?this.angleSeq[t.Angle.Left]:1;break;case t.Angle.Right:i+=this.angleSeq?this.angleSeq[t.Angle.Right]:2}var n=this.animeCnt*(this.charaSeq%this.charaCol)+this.charaCol*this.animeCnt*i;if(this.frame=[],1==this.animeCnt%2){for(var r=0;r<this.animeCnt;r++)this.frame.push(r+n);for(var r=this.animeCnt-2;r>0;r--)this.frame.push(r+n)}else for(var r=0;r<this.animeCnt;r++)this.frame.push(r+n);this.changeFrame()},i}(t.FrameSprite);t.Character=e}(jg||(jg={}));var jg;!function(t){var e=function(){function e(e,i,n){this.width=i,this.height=n,this.image=e,this.wait=200,this.charaCol=1,this.animeCnt=2,this.moveTime=300,this.movePixel=64,this.angle=t.Angle.Down,this.createClass=t.Character}return e.prototype.create=function(t,e,i){var n=new this.createClass(this.image,this.width,this.height,this.wait),r=["width","height","image","wait","angle"];for(var s in this)"function"!=typeof this[s]&&(r.indexOf(s)>=0||(n[s]=this[s]));return n.charaSeq=t,n.angle(void 0==i?this.angle:i),e&&n.moveTo(e.x,e.y),n},e}();t.CharacterFactory=e}(jg||(jg={}));var jg;!function(t){var e=function(t){function e(e,i,n,r){t.call(this),this.x=0,this.y=0,e?this.setText(e):(this.setText(""),this.width=0,this.height=0),this.setTextBaseline(r?r:"top"),this.setFontSize(i?i:14),this.setColor(n?n:"black")}return __extends(e,t),e.prototype.setMaxWidth=function(t){this.maxWidth=t,this.updateSize()},e.prototype.updateSize=function(){var t=window.createCanvas(10,10),e=t.getContext("2d");e.font=this.getFont();var i=e.measureText(this.text);this.width=i.width,this.height=this.getFontSize()},e.prototype.addShadow=function(t){this.setDrawOption("shadowBlur",2),this.setDrawOption("shadowColor",t?t:"black")},e.prototype.removeShadow=function(){this.removeDrawOption("shadowBlur"),this.removeDrawOption("shadowColor")},e.prototype.setText=function(t){this.text=t,this.updateSize(),this.updated()},e.prototype.setFont=function(t){this.setDrawOption("font",t),this.updateSize()},e.prototype.getFont=function(){return this.getDrawOption("font")},e.prototype.setFontSize=function(t){var e=this.getFont(),i=e.indexOf(" ");this.setFont(t+"px "+e.substr(i+1))},e.prototype.getFontSize=function(){var t=this.getFont(),e=t.indexOf(" ");try{return parseInt(t.substr(0,e-2))}catch(i){}return this.height},e.prototype.setTextAlign=function(t){this.setDrawOption("textAlign",t)},e.prototype.getTextAlign=function(){return this.getDrawOption("textAlign")},e.prototype.setTextBaseline=function(t){this.setDrawOption("textBaseline",t)},e.prototype.getTextBaseline=function(){return this.getDrawOption("textBaseline")},e.prototype.setColor=function(t){this.setDrawOption("fillStyle",t)},e.prototype.getColor=function(){return this.getDrawOption("fillStyle")},e.prototype.synchronize=function(t,e,i){this.syncObj=t,this.syncProp=e,this.syncRound=i},e.prototype.draw=function(t){if(this.syncObj){var e;e="function"==typeof this.syncObj[this.syncProp]?this.syncObj[this.syncProp](this):this.syncObj[this.syncProp],this.text=this.syncRound?Math.round(e):e}this.maxWidth?t.fillText(this.text,0,0,this.maxWidth):t.fillText(this.text,0,0)},e}(t.E);t.Label=e}(jg||(jg={}));var jg;!function(t){var e=function(){function t(t){this.width=0,this.height=0,this.offsetY=t}return t}();t.TextLineInfo=e;var i=function(){function t(){}return t.prototype.init=function(t,e,i){this.mode=0,this.owner=t,this.context=e,this.pos=i},t.prototype.next=function(t){if(this.mode){if(" "==t){if(this.mode=0,"page"==this.buf)return-1}else this.buf+=t;return 1}return"#"==t?(this.mode=1,this.buf="",1):0},t}();t.MultilineScriptAnalyzer=i;var n=function(n){function r(e,r){n.call(this),this.scriptAnalyzer=new i,this.width=e.width,this.height=e.height,r?this.moveTo(r.x,r.y):this.moveTo(0,0),this.defaultStyle="#000",this.defaultFont="18px sans-serif",this.defaultBlur=.6,this.defaultShadowColor="#000",this.defaultShadowOffsetX=.3,this.defaultShadowOffsetY=.3,this.clip=new t.Line({x:0,y:0}),this.clip.addLine(this.width,0),this.clip.addLine(this.width,this.height),this.clip.addLine(0,this.height),this.clip.addLine(0,this.height),this.clip.addLine(0,this.height),this.clip.closePath=!0,this.clip.setClip(!0),this.entities=[],this.entities.push(this.clip),this.animeSpeed=400,this.animated=new t.Trigger}return __extends(r,n),r.prototype.setText=function(t,e){var i=t;return this.setScript(i,e)},r.prototype.setScript=function(t,e){return this.script=t.replace(/\r\n?/g,"\n"),this.updated(),this.createBuffer(e)},r.prototype.getLineHeight=function(t){var e=t.font,i=e.indexOf("px"),n=e.lastIndexOf(" ",i);if(0>n&&(n=0),0>i)return 16;var s=parseInt(e.substring(n,i)),o=Math.round(s*r.LINE_HEIGHT_NORMAL);return o},r.prototype.createBuffer=function(i){var n=this;this.buffer||(this.buffer=window.createCanvas(this.width,this.height)),void 0===i&&(i=0);var s,o=this.script,h=o.length,a={x:0,y:0},p=this.buffer.getContext("2d"),c=r.BROWSER_BASELINE_MARGIN;this.lines=[],this.bufferBg?p.putImageData(this.bufferBg,0,0):p.clearRect(0,0,this.width,this.height),p.fillStyle=this.defaultStyle,p.font=this.defaultFont,p.textBaseline="top",this.disableShadow||(p.shadowBlur=this.defaultBlur,p.shadowColor=this.defaultShadowColor,p.shadowOffsetX=this.defaultShadowOffsetX,p.shadowOffsetY=this.defaultShadowOffsetY);var l=this.getLineHeight(p),u=new e(0);u.height=l,this.lines.push(u);var d=function(){return a.x=0,a.y+=u.height,a.y+u.height>n.height?!1:(u=new e(a.y),u.height=l,n.lines.push(u),!0)};for(this.scriptAnalyzer.init(this,p,a);h>i;){s=o.substr(i,1);var f=this.scriptAnalyzer.next(s);if(f){if(l=u.height,0>f){i-=f;break}i+=f}else if("\n"!=s){var g=p.measureText(s);if(a.x+g.width>this.width&&!d())break;p.fillText(s,a.x,a.y+c),a.x+=g.width,u.width+=g.width,i++}else if(i++,!d())break}return this.sprite=new t.Sprite(this.buffer),this.sprite.moveTo(0,0),1==this.entities.length?this.entities.push(this.sprite):this.entities[1]=this.sprite,i==h?-1:i},r.prototype.refresh=function(){delete this.buffer,this.createBuffer()},r.prototype.startAnimation=function(t){this.start(),this.animeLine=0,this.animePos={x:0,y:this.lines[this.animeLine].height},void 0!==t&&(this.animeSpeed=t),this.hideAll(),this.clip.p[4].y=this.animePos.y,this.clip.p[5].y=this.animePos.y},r.prototype.update=function(t){this.animePos.x+=this.animeSpeed/1e3*t,this.animePos.x>=this.lines[this.animeLine].width&&(this.animePos.x=0,this.animePos.y+=this.lines[this.animeLine].height,this.animeLine++,this.animeLine<this.lines.length&&(this.clip.p[2].y=this.lines[this.animeLine].offsetY,this.clip.p[3].y=this.clip.p[2].y,this.clip.p[4].y=this.animePos.y,this.clip.p[5].y=this.animePos.y)),this.animeLine>=this.lines.length?this.showAll():(this.clip.p[3].x=this.animePos.x,this.clip.p[4].x=this.clip.p[3].x),this.updated()},r.prototype.hideAll=function(){this.clip.p[0]={x:0,y:0},this.clip.p[1]={x:this.width,y:0},this.clip.p[2]={x:this.width,y:0},this.clip.p[3]={x:0,y:0},this.clip.p[4]={x:0,y:0},this.clip.p[5]={x:0,y:0}},r.prototype.showAll=function(){this.clip.p[0]={x:0,y:0},this.clip.p[1]={x:this.width,y:0},this.clip.p[2]={x:this.width,y:this.height},this.clip.p[3]={x:0,y:this.height},this.clip.p[4]={x:0,y:this.height},this.clip.p[5]={x:0,y:this.height},this.stop(),this.animated.fire()},r.LINE_HEIGHT_NORMAL=1.2,r.BROWSER_BASELINE_MARGIN=0,r |
| 2 |
}(t.E);t.MultilineText=n}(jg||(jg={}));var jg;!function(t){var e=function(){function e(t){this.image=t}return e.prototype.count=function(t){return Math.round(this.image.width*this.image.height/(t.tileWidth*t.tileHeight))},e.prototype.draw=function(t,e,i,n,r){var s=t.tileWidth,o=t.tileHeight,h=Math.floor(this.image.width/t.tileWidth);e.drawImage(this.image,r%h*s,Math.floor(r/h)*o,s,o,i*s,n*o,s,o)},e.prototype.getChips=function(e){var i=this.count(e),n=new t.Sprite(this.image),r=new t.BufferedRenderer(n),s=[],o=e.tileWidth,h=e.tileHeight,a={x:0,y:0,width:o,height:h};r.renderUnit(n);for(var p=Math.floor(this.image.width/e.tileWidth),c=0;i>c;c++)s.push(r.createSprite({x:c%p*o,y:Math.floor(c/p)*h,width:o,height:h},a,a));return s},e}();t.ChipSet=e;var i=function(e){function i(){e.apply(this,arguments)}return __extends(i,e),i.prototype.map=function(t,e,i,n){return 0>e||0>i||e>=t.size.width||i>=t.size.height?void 0!==n?n:-1:t.data[e][i]},i.prototype.count=function(){return 1},i.prototype.draw=function(t,e,i,n,r){var s=t.tileWidth,o=t.tileHeight,h=Math.floor(s/2),a=Math.floor(o/2),p=Math.floor(this.image.width/t.tileWidth);r+=this.chipOffset;for(var c=0;2>c;c++)for(var l=0;2>l;l++){var u=i+(0==c?-1:1),d=n+(0==l?-1:1),f=this.map(t,u,n,r),g=this.map(t,i,d,r),y=this.map(t,u,d,r),m=0;g==r&&m++,f==r&&(m+=2),3==m&&y==r&&m++,e.drawImage(this.image,m%p*s+h*c,Math.floor(m/p)*o+a*l,h,a,i*s+h*c,n*o+a*l,h,a)}},i.prototype.getChips=function(e){this.count(e);var i=new t.Sprite(this.image,e.tileWidth,e.tileHeight);return[i.createSprite()]},i}(e);t.AutoTileChipSet=i;var n=function(n){function r(t,e,i){n.call(this),this.tileWidth=e,this.tileHeight=i,this.chips=[],this.chipMap=[],this.chipCount=0,t&&this.addChipSet(t),this.x=0,this.y=0,this.disableTransform=!0}return __extends(r,n),r.prototype.addChipSet=function(t,n){var r;n&&n.autoTile&&(r=new i(t)),r||(r=new e(t)),r.chipOffset=this.chipCount,this.chips.push(r);for(var s=r.count(this),o=this.chipCount+s,h=this.chipCount;o>h;h++)this.chipMap[h]=r;this.chipCount=o},r.prototype.copyChips=function(t){t.chips=this.chips,t.chipCount=this.chipCount,t.chipMap=this.chipMap},r.prototype._clear=function(t,e){this.size={width:t,height:e},this.width=this.tileWidth*t,this.height=this.tileHeight*e},r.prototype.clear=function(t,e,i){t||(t=this.size.width),e||(e=this.size.height),void 0===i&&(i=-1),this._clear(t,e),this.data=[];for(var n=0;t>n;n++){this.data[n]=[];for(var r=0;e>r;r++)this.data[n][r]=i}this.refresh()},r.prototype.generate=function(e,i,n,r){i===!0&&(r=!0,i=e.length,n=e[0].length),i||(i=e.length),n||(n=e[0].length),this.data=r?t.JGUtil.transpose(e):e,this._clear(i,n),this.refresh()},r.prototype.refresh=function(){this.canvas=window.createCanvas(this.width,this.height);var t=this.canvas.getContext("2d"),e=this.size.width,i=this.size.height;this.data,this.chipMap;for(var n=0;e>n;n++)for(var r=0;i>r;r++)this.drawChip(n,r,!1,t);this.updated()},r.prototype.drawChip=function(t,e,i,n){if(void 0===n&&(n=this.canvas.getContext("2d")),i&&n.clearRect(t*this.tileWidth,e*this.tileHeight,this.tileWidth,this.tileHeight),!(this.data[t][e]<0)){var r=this.chipMap[this.data[t][e]];r.draw(this,n,t,e,this.data[t][e]-r.chipOffset)}},r.prototype.draw=function(t){if(this.canvas){var e=this.parent?this.parent:this,i=e.scroll?e.scroll:{x:0,y:0},n={x:-i.x,y:-i.y,width:e.width,height:e.height},r={x:-i.x,y:-i.y,width:e.width,height:e.height};if(n.x<0){if(n.width+=n.x,n.width<=0)return;r.x-=n.x,r.width+=n.x,n.x=0}else if(n.x+n.width>this.width){var s=n.x+n.width-this.width;if(n.width-=s,n.width<=0)return;r.width-=s}if(n.y<0){if(n.height+=n.y,n.height<=0)return;r.y-=n.y,r.height+=n.y,n.y=0}else if(n.y+n.height>this.height){var s=n.y+n.height-this.height;if(n.height-=s,n.height<=0)return;r.height-=s}t.drawImage(this.canvas,n.x,n.y,n.width,n.height,r.x,r.y,r.width,r.height)}},r.prototype.getChips=function(){for(var t=[],e=this.chips.length,i=0;e>i;i++)t=t.concat(this.chips[i].getChips(this));return t},r}(t.E);t.Tile=n}(jg||(jg={}));var jg;!function(t){var e=function(t){function e(e){t.call(this),this.entities=[],this.x=0,this.y=0,this.scene=e,this.scene&&(this.width=this.scene.game.width,this.height=this.scene.game.height),this.isUpdated=!0}return __extends(e,t),e.prototype.hasBuffer=function(){return this.canvas?!0:!1},e.prototype.createBuffer=function(){this.refresh(!0)},e.prototype.refresh=function(t){if((t||this.hasBuffer())&&(this.canvas=window.createCanvas(this.width,this.height),this.context=this.canvas.getContext("2d"),this.updated()),this.entities)for(var e=0;e<this.entities.length;e++)this.entities[e].refresh&&this.entities[e].refresh()},e.prototype.deleteBuffer=function(){delete this.context,delete this.canvas},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.hasBuffer()&&this.deleteBuffer()},e}(t.E);t.Layer=e}(jg||(jg={}));var jg;!function(t){var e=function(e){function i(i,n){e.call(this,i),this.resource=n,this.resource.loaded.handle(this,this.complete),this.resource.added.handle(this,this.added),this.requestCount=this.resource.requests.length,this.finished=new t.Trigger,this.init()}return __extends(i,e),i.prototype.init=function(){this.shape=new t.Shape(this.game.width,32),this.shape.moveTo(0,this.game.height/2-16),this.shapeP=new t.Shape(1,32,t.ShapeStyle.Fill),this.shapeP.moveTo(0,this.game.height/2-16),this.append(this.shape),this.append(this.shapeP)},i.prototype.animate=function(t){this.shapeP.width=this.game.width*t,this.shapeP.updated()},i.prototype.complete=function(t){var e=(this.requestCount-t)/this.requestCount;this.animate(e),1==e&&(this.resource.loaded.remove(this,this.complete),this.resource.added.remove(this,this.added),this.end(),this.finished.fire())},i.prototype.added=function(){this.requestCount++},i}(t.Scene);t.LoadingScene=e}(jg||(jg={}));var jg;!function(t){var e=function(){function t(t,e,i){this.type=t,this.action=e,this.param=i}return t}();t.InputEvent=e;var i=function(e){function i(i,n,r){e.call(this,t.InputEventType.Keyboard,i,r),this.key=n}return __extends(i,e),i}(e);t.InputKeyboardEvent=i;var n=function(e){function i(i,n,r){e.call(this,t.InputEventType.Point,i,n),this.point=r}return __extends(i,e),i.prototype.set=function(t){var e=t.offset();this.entity=t,this.x=this.point.x-e.x,this.y=this.point.y-e.y},i}(e);t.InputPointEvent=n}(jg||(jg={}));var jg;!function(t){var e=function(){function e(){var t=this;this.radian=Math.PI/180,this.drawOptionFunctions={transform:function(t,e,i){t.transform(i.m11,i.m12,i.m21,i.m22,i.dx,i.dy)},translate:function(t,e,i){t.translate(i.x,i.y)},scale:function(e,i,n){e.transform.apply(e,t.getMatrix(i.width,i.height,n.x,n.y,0))},purescale:function(t,e,i){t.scale(i.x,i.y)},rotate:function(e,i,n){e.transform.apply(e,t.getMatrix(i.width,i.height,1,1,n))}}}return e.prototype.getMatrix=function(t,e,i,n,r){var s=r*this.radian,o=Math.cos(s),h=Math.sin(s),a=o*i,p=h*i,c=h*n,l=o*n,u=t/2,d=e/2;return[a,p,-c,l,-a*u+c*d+u,-p*u-l*d+d]},e.prototype.renderParent=function(t,e){if(t.orderDraw&&t.orderDraw(t),e.save(),1!=t.opacity&&(e.globalAlpha=t.opacity),t.options&&this.useDrawOption(t,e))return e.restore(),void 0;t.scroll&&e.translate(t.scroll.x,t.scroll.y);for(var i=0;i<t.entities.length;i++)this.renderEntity(t.entities[i],e);e.restore()},e.prototype.renderEntity=function(t,e){if(t.opacity)if(t.disableTransform)t.draw(e);else{if(e.save(),e.translate(t.x,t.y),1!=t.opacity&&(e.globalAlpha*=t.opacity),t.options&&this.useDrawOption(t,e))return e.restore(),void 0;if(t.filter)this.filterDraw(t,e);else if(t.draw(e),t.entities){t.scroll&&e.translate(t.scroll.x,t.scroll.y);for(var i=0;i<t.entities.length;i++)this.renderEntity(t.entities[i],e)}e.restore()}},e.prototype.renderPure=function(t,e){if(t.draw(e),t.entities)for(var i=0;i<t.entities.length;i++)this.renderEntity(t.entities[i],e)},e.prototype.filterDraw=function(e,i){var n=new t.BufferedRenderer(e);n.filter=e.filter,n.renderPure(e,n.c),n.applyFilter(n.c,e),n.draw(i)},e.prototype.useDrawOption=function(t,e){for(var i in t.options)this.drawOptionFunctions[i]?this.drawOptionFunctions[i].call(this,e,t,t.options[i]):e[i]=t.options[i]},e}();t.Renderer=e}(jg||(jg={}));var jg;!function(t){var e=function(e){function i(i,n,r,s){if(e.call(this),this.game=i,this.container=n?n:document.getElementById("jgame"),!this.container){var o=document.createElement("div");o.id="jgame";var h=document.getElementsByTagName("body");if(0==h.length)throw"can not initialize game engine";h[0].appendChild(o),this.container=o}if(this.handler=document.createElement("div"),this.handler.style.display="inline-block",this.handler.setAttribute("tabindex","1"),this.handler.className="input-handler",this.handler.style.outline="none",this.container.appendChild(this.handler),this.handler.focus(),this.changeTransferMode(r?r:t.RenderTransferMode.Transfer),!s){this.bg=this.fc.getImageData(0,0,this.game.width,this.game.height);for(var a=0;a<this.bg.data.length;a++)this.bg.data[a]=255}}return __extends(i,e),i.prototype.changeFrontCanvasSize=function(t,e){this.frontCanvasSize=t,this.frontCanvasOffset=e,this.refresh()},i.prototype.changeTransferMode=function(e){this.transferMode=e,this.transferMode==t.RenderTransferMode.Flip&&(this.handler.style.position="relative",this.handler.style.width=this.game.width+"px",this.handler.style.height=this.game.height+"px"),this.refresh()},i.prototype.changeScene=function(t){this.scene=t},i.prototype.flip=function(){this.fc,this.fc=this.bc,this.bc=this.fc,this.flipNo=this.flipNo?0:1,this.buffer[this.flipNo].style.zIndex="1",this.buffer[this.flipNo?0:1].style.zIndex="0"},i.prototype.render=function(){var e=!1;if(1==this.scene.layerCount){var i=this.scene.root;i.isUpdated&&(e=!0,this.disableClear||this.bc.putImageData(this.bg,0,0),this.renderParent(i,this.bc),i.isUpdated=!1)}else{for(var n in this.scene.layers)if(this.scene.layers[n].isUpdated){e=!0;break}if(e){this.disableClear||this.bc.putImageData(this.bg,0,0);for(var n in this.scene.layers){var i=this.scene.layers[n];i.isUpdated&&(i.context.clearRect(0,0,i.width,i.height),this.renderParent(i,i.context)),this.bc.drawImage(i.canvas,i.x,i.y),i.isUpdated=!1}}}if(e)if(this.filter){var r=this.bc.getImageData(0,0,this.game.width,this.game.height);this.filter.filter(r),this.fc.putImageData(r,0,0)}else this.bc!=this.fc?this.fc.drawImage(this.buffer[1],0,0):this.transferMode==t.RenderTransferMode.Flip&&this.flip()},i.prototype.refresh=function(){if(delete this.buffer,this.buffer=[],this.transferMode==t.RenderTransferMode.Flip){this.handler.innerHTML="";for(var e=0;2>e;e++)this.buffer[e]=window.createCanvas(this.game.width,this.game.height),this.buffer[e].style.position="absolute",this.buffer[e].style.zIndex=e.toString(),this.handler.appendChild(this.buffer[e]);this.fc=this.buffer[1].getContext("2d"),this.bc=this.buffer[0].getContext("2d"),this.flipNo=1,this.frontCanvasSize&&t.JGUtil.scaleCanvas(this.buffer[1],this.frontCanvasSize)}else if(this.transferMode==t.RenderTransferMode.Transfer){this.handler.innerHTML="";for(var e=0;2>e;e++)this.buffer[e]=window.createCanvas(this.game.width,this.game.height);this.handler.appendChild(this.buffer[0]),this.fc=this.buffer[0].getContext("2d"),this.bc=this.buffer[1].getContext("2d")}else this.handler.innerHTML="",this.buffer[0]=window.createCanvas(this.game.width,this.game.height),this.handler.appendChild(this.buffer[0]),this.fc=this.buffer[0].getContext("2d"),this.bc=this.fc;this.frontCanvasSize&&(t.JGUtil.scaleCanvas(this.buffer[0],this.frontCanvasSize),this.frontCanvasOffset&&(this.handler.style.position="relative",this.handler.style.left=this.frontCanvasOffset.x+"px",this.handler.style.top=this.frontCanvasOffset.y+"px"));var i=this.handler.getBoundingClientRect();this._pageX=Math.round(window.scrollX||window.pageXOffset+i.left),this._pageY=Math.round(window.scrollY||window.pageYOffset+i.top)},i}(t.Renderer);t.GameRenderer=e}(jg||(jg={}));var jg;!function(t){var e=function(e){function i(t){e.call(this),this.size=t,this.refresh()}return __extends(i,e),i.prototype.clear=function(){this.c.clearRect(0,0,this.size.width,this.size.height)},i.prototype.createImage=function(t,e,i){t||(t={x:0,y:0,width:this.size.width,height:this.size.height}),e||(e={x:0,y:0,width:t.width,height:t.height}),i||(i=t);var n=window.createCanvas(i.width,i.height),r=n.getContext("2d");return r.drawImage(this.buffer,t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),this.filter&&this.applyFilter(r,e),n},i.prototype.createSprite=function(e,i,n){return e||(e={x:0,y:0,width:this.size.width,height:this.size.height}),i||(i={x:0,y:0,width:e.width,height:e.height}),new t.Sprite(this.createImage(e,i,n),e.width,e.height)},i.prototype.applyFilter=function(t,e){var i=t.getImageData(0,0,e.width,e.height);this.filter.filter(i),t.putImageData(i,0,0)},i.prototype.renderUnit=function(t){({x:0,y:0,width:t.width,height:t.height}),this.renderEntity(t,this.c)},i.prototype.renderLayer=function(t){this.renderParent(t,this.c)},i.prototype.renderScene=function(t){this.clear();for(var e in t.layers){this.c.save();var i=t.layers[e];(i.x||i.y)&&this.c.translate(i.x,i.y),this.renderLayer(i),this.c.restore()}},i.prototype.refresh=function(){delete this.buffer,this.buffer=window.createCanvas(this.size.width,this.size.height),this.c=this.buffer.getContext("2d")},i.prototype.draw=function(t){t.drawImage(this.buffer,0,0,this.size.width,this.size.height,0,0,this.size.width,this.size.height)},i}(t.Renderer);t.BufferedRenderer=e}(jg||(jg={}));var jg;!function(t){var e=function(){function e(e){this.wait=e,this.tick=0,this.trigger=new t.Trigger}return e.prototype.tryFire=function(t){this.tick+=t,this.wait<=this.tick&&this.fire()},e.prototype.fire=function(){this.tick=0,this.trigger.fastFire(this)},e}();t.GameTimer=e}(jg||(jg={}));var jg;!function(t){var e=function(){function e(e,i){for(var n=[],r=0;r<arguments.length-2;r++)n[r]=arguments[r+2];var s=this;this._exit=!1,this.id=t.JGUtil.generateId(),this.width=e,this.height=i,this.targetFps=0,this.loadingSceneClass=t.LoadingScene,this.keymap={13:t.Keytype.Enter,27:t.Keytype.Esc,37:t.Keytype.Left,38:t.Keytype.Up,39:t.Keytype.Right,40:t.Keytype.Down},this.loaded=new t.Trigger,this.update=new t.Trigger,this.pointDown=new t.Trigger,this.pointUp=new t.Trigger,this.pointMove=new t.Trigger,this.keyDown=new t.Trigger,this.keyUp=new t.Trigger,this.userEvent=new t.Trigger,this.timers=[],this.scene=new t.Scene(this),this.scenes=[],this.scenes.push(this.scene),this.resource=t.Resource.getInstance();for(var o,h,a=2;a<arguments.length;a++)arguments[a]instanceof HTMLElement?o=arguments[a]:"string"==typeof arguments[a]?(this.renderer=new window[arguments[a]](this,o,h),this.renderer.changeScene(this.scene)):h=arguments[a];this.renderer||(this.renderer=new t.GameRenderer(this,o,h),this.renderer.changeScene(this.scene)),this.eventQueue=[],this.inputEventMap={},this.inputEventMap[t.InputEventType.Keyboard]={},this.inputEventMap[t.InputEventType.Keyboard][t.InputEventAction.Down]="keyDown",this.inputEventMap[t.InputEventType.Keyboard][t.InputEventAction.Up]="keyUp",this.inputEventMap[t.InputEventType.Point]={},this.inputEventMap[t.InputEventType.Point][t.InputEventAction.Down]="pointDown",this.inputEventMap[t.InputEventType.Point][t.InputEventAction.Move]="pointMove",this.inputEventMap[t.InputEventType.Point][t.InputEventAction.Up]="pointUp",document.getElementById("fps_show")&&(this.fps=document.getElementById("fps_show")),this.renderer.handler.addEventListener("focus",function(){s.focus=!0},!1),this.renderer.handler.addEventListener("blur",function(){s.focus=!1},!1),this.focus=!0,this.setSeed(),this.main()}return e.prototype.setSeed=function(e){this.seed=void 0===e?(new Date).getTime():e,this.mt=new t.MT(e)},e.prototype.random=function(t,e){return this.mt.nextInt(t,e-t+1)},e.prototype.getWindowSize=function(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}},e.prototype.fitToWindow=function(t){var e=this.renderer.container.parentElement;e.style.margin="0",e.style.padding="0",e.style.overflow="hidden",this.renderer.container.style.margin="0",this.renderer.container.style.padding="0";var i=this.getWindowSize();this.renderer.container.style.width=i.width+"px",this.renderer.container.style.height=i.height+"px",this.scale=Math.min(i.width/this.width,i.height/this.height);var n={width:Math.floor(this.width*this.scale),height:Math.floor(this.height*this.scale)};this.renderer.changeFrontCanvasSize(n,t?void 0:{x:Math.floor((i.width-n.width)/2),y:Math.floor((i.height-n.height)/2)})},e.prototype.setBgColor=function(t,e,i,n){for(var r=0;r<this.renderer.bg.data.length;r+=4)this.renderer.bg.data[r]=t,this.renderer.bg.data[r+1]=e,this.renderer.bg.data[r+2]=i,this.renderer.bg.data[r+3]=n},e.prototype.refresh=function(){this.renderer.refresh();for(var t=0;t<this.scenes.length;t++)this.scenes[t].refresh()},e.prototype.isTouchEnable=function(){var t=document.createElement("div");return t.setAttribute("ontouchstart","return"),"function"==typeof t.ontouchstart},e.prototype.getOffsetByEvent=function(t){return t.offset={x:t.pageX-this.renderer._pageX,y:t.pageY-this.renderer._pageY},{x:this.scale?t.offset.x/this.scale:t.offset.x,y:this.scale?t.offset.y/this.scale:t.offset.y}},e.prototype.onmousedown=function(e){this.isPointDown=!0,this.eventQueue.push(new t.InputPointEvent(t.InputEventAction.Down,e,this.getOffsetByEvent(e))),this.focus||this.renderer.handler.focus(),e.preventDefault()},e.prototype.ontouchstart=function(e){var i=e.changedTouches;this.isPointDown=!0;for(var n=0,r=i.length;r>n;n++)this.eventQueue.push(new t.InputPointEvent(t.InputEventAction.Down,i[n],this.getOffsetByEvent(i[n])));this.focus||this.renderer.handler.focus(),e.preventDefault()},e.prototype.onmousemove=function(e){this.isPointDown&&(this.eventQueue.push(new t.InputPointEvent(t.InputEventAction.Move,e,this.getOffsetByEvent(e))),e.preventDefault())},e.prototype.ontouchmove=function(e){if(this.isPointDown){for(var i=e.changedTouches,n=0,r=i.length;r>n;n++)this.eventQueue.push(new t.InputPointEvent(t.InputEventAction.Move,i[n],this.getOffsetByEvent(i[n])));e.preventDefault()}},e.prototype.onmouseup=function(e){this.isPointDown&&(this.eventQueue.push(new t.InputPointEvent(t.InputEventAction.Up,e,this.getOffsetByEvent(e))),this.isPointDown=!1,e.preventDefault())},e.prototype.ontouchend=function(e){if(this.isPointDown){for(var i=e.changedTouches,n=0,r=i.length;r>n;n++)this.eventQueue.push(new t.InputPointEvent(t.InputEventAction.Up,i[n],this.getOffsetByEvent(i[n])));this.isPointDown=!1,e.preventDefault()}},e.prototype.enablePointHandler=function(){this.disablePointHandler();try{this.isTouchEnable()?(this.renderer.handler.addEventListener("touchstart",t.JGUtil.createIdProxy(this.id,this.ontouchstart,this),!1),this.renderer.handler.addEventListener("touchmove",t.JGUtil.createIdProxy(this.id,this.ontouchmove,this),!1),this.renderer.handler.addEventListener("touchend",t.JGUtil.createIdProxy(this.id,this.ontouchend,this),!1)):(this.renderer.handler.addEventListener("mousedown",t.JGUtil.createIdProxy(this.id,this.onmousedown,this),!1),this.renderer.handler.addEventListener("mousemove",t.JGUtil.createIdProxy(this.id,this.onmousemove,this),!1),this.renderer.handler.addEventListener("mouseup",t.JGUtil.createIdProxy(this.id,this.onmouseup,this),!1))}catch(e){}},e.prototype.disablePointHandler=function(){this.dragParam=null;try{this.isTouchEnable()?t.JGUtil.getIdProxy(this.id,this.ontouchstart,this)&&(this.renderer.handler.removeEventListener("touchstart",t.JGUtil.getIdProxy(this.id,this.ontouchstart,this),!1),this.renderer.handler.removeEventListener("touchmove",t.JGUtil.getIdProxy(this.id,this.ontouchmove,this),!1),this.renderer.handler.removeEventListener("touchend",t.JGUtil.getIdProxy(this.id,this.ontouchend,this),!1),t.JGUtil.deleteIdProxy(this.id,this.ontouchstart,this),t.JGUtil.deleteIdProxy(this.id,this.ontouchmove,this),t.JGUtil.deleteIdProxy(this.id,this.ontouchend,this)):t.JGUtil.getIdProxy(this.id,this.onmousedown,this)&&(this.renderer.handler.removeEventListener("mousedown",t.JGUtil.getIdProxy(this.id,this.onmousedown,this),!1),this.renderer.handler.removeEventListener("mousemove",t.JGUtil.getIdProxy(this.id,this.onmousemove,this),!1),this.renderer.handler.removeEventListener("mouseup",t.JGUtil.getIdProxy(this.id,this.onmouseup,this),!1),t.JGUtil.deleteIdProxy(this.id,this.onmousedown,this),t.JGUtil.deleteIdProxy(this.id,this.onmousemove,this),t.JGUtil.deleteIdProxy(this.id,this.onmouseup,this))}catch(e){}},e.prototype.onkeydown=function(e){var i=new t.InputKeyboardEvent(t.InputEventAction.Down,this.keymap[e.keyCode],e);this.eventQueue.push(i),void 0!=this.keymap[e.keyCode]&&e.preventDefault()},e.prototype.onkeyup=function(e){var i=new t.InputKeyboardEvent(t.InputEventAction.Up,this.keymap[e.keyCode],e);this.eventQueue.push(i),void 0!=this.keymap[e.keyCode]&&e.preventDefault()},e.prototype.enableKeyboardHandler=function(){this.disableKeyboardHandler();try{this.renderer.handler.addEventListener("keydown",t.JGUtil.createIdProxy(this.id,this.onkeydown,this),!1),this.renderer.handler.addEventListener("keyup",t.JGUtil.createIdProxy(this.id,this.onkeyup,this),!1)}catch(e){}},e.prototype.disableKeyboardHandler=function(){t.JGUtil.getIdProxy(this.id,this.onkeydown,this)&&(this.renderer.handler.removeEventListener("keydown",t.JGUtil.getIdProxy(this.id,this.onkeydown,this),!1),this.renderer.handler.removeEventListener("keyup",t.JGUtil.getIdProxy(this.id,this.onkeyup,this),!1),t.JGUtil.deleteIdProxy(this.id,this.onkeydown,this),t.JGUtil.deleteIdProxy(this.id,this.onkeyup,this))},e.prototype.addTimer=function(e,i,n){for(var r=null,s=0;s<this.timers.length;s++)if(this.timers[s].wait==e){r=this.timers[s];break}null==r&&(r=new t.GameTimer(e),this.timers.push(r)),r.trigger.handle(i,n)},e.prototype.removeTimer=function(t,e,i){for(var n=null,r=0;r<this.timers.length;r++)if(this.timers[r].wait==t){n=this.timers[r];break}if(null==n)throw"error removeTimer: dont have "+t+" timer";n.trigger.remove(e,i)},e.prototype.removeTimerAll=function(t){for(var e=0;e<this.timers.length;e++)this.timers[e].trigger.removeAll(t)},e.prototype.changeScene=function(e,i,n){var r=this;if(i){var s=this.scene;return t.Effect.sceneEffect(this,s,e,i,function(){r.endScene(),r.changeScene(e)},n),void 0}this.scenes.push(e),e.game=this,this.scene.hid.fire(),this.scene=e,this.renderer.changeScene(this.scene),this.scene.started.fire()},e.prototype.endScene=function(e){var i=this;return 1==this.scenes.length?(this.end(),void 0):e?(t.Effect.sceneEffect(this,this.scene,this.scenes[this.scenes.length-2],e,function(){i.endScene()},!0),void 0):(this.scene.destroy(),this.scenes.pop(),this.scene.ended.fire(),this.scene=this.scenes[this.scenes.length-1],this.renderer.changeScene(this.scene),this.scene.showed.fire(),void 0)},e.prototype.r=function(t){return this.resource.get(t)},e.prototype.s=function(t){return this.resource.sound(t)},e.prototype.preload=function(t){if(t instanceof Array)for(var e=0;e<t.length;e++)this.resource.load(t[e],t[e]);else if("string"==typeof t)for(var e=0;e<arguments.length;e++)this.resource.load(arguments[e],arguments[e]);else for(var i in t)this.resource.load(i,t[i]);this.loadingSceneClass&&!this.loadingScene&&this.setLoadingScene(this.loadingSceneClass)},e.prototype.preloadOther=function(t){this.resource.loadManual(t)},e.prototype.preloadCompleteOther=function(t){this.resource.completeManual(t)},e.prototype.setLoadingScene=function(e){this.loadingScene||(this.loadingScene=e instanceof t.LoadingScene?e:new e(this,this.resource),this.loadingScene.finished.handle(this,this.preloadComplete),this.changeScene(this.loadingScene))},e.prototype.preloadComplete=function(){this.loadingScene&&delete this.loadingScene,this.loaded.fire()},e.prototype.end=function(){return this._exit?!1:(this.renderer.render(),this._exit=!0,!0)},e.prototype.resume=function(){return this._exit?(this._exit=!1,this.main(),!0):!1},e.prototype.setPointingEntity=function(t){for(var e,i=this.scene.getLayerArray(),n=t.point;e=i.pop();)if(e.pointCapture){var r=e.getEntityByPoint(n);r||(r=e),t.set(r),this.dragParam=t;break}},e.prototype.raiseInputEvent=function(){for(var e;e=this.eventQueue.shift();)if(this.inputEventMap[e.type]){var i=this.inputEventMap[e.type][e.action];if(e.type==t.InputEventType.Keyboard)this.scene[i]&&this.scene[i].fire(e),this[i].fire(e);else{if(e.action==t.InputEventAction.Down)this.setPointingEntity(e);else{if(!this.dragParam)continue;e.set(this.dragParam.entity)}e.entity&&e.entity[i]&&e.entity[i].fire(e),this.scene[i]&&this.scene[i].fire(e),this[i].fire(e)}}else this.userEvent.fire(e)},e.prototype.main=function(){var t=this,e=[],i=function(n){if(!t._exit){void 0===n&&(n=Date.now?Date.now():(new Date).getTime()),(t.tick>n+1e4||t.tick+1e4<n)&&(t.tick=n-1,t.renderTick=n-t.targetFps,t.refresh());var r=n-t.tick;t.tick<n&&(t.raiseInputEvent(),t.update.fire(r),t.tick=n);for(var s=0;s<t.timers.length;s++)t.timers[s].tryFire(r);(0==t.targetFps||t.renderTick<=n)&&(t.render&&t.render.fire(),t.renderer.render(),t.targetFps&&(t.renderTick=n+t.targetFps),t.fps&&(19==e.length?(t.fps.innerHTML=Math.round(2e4/(n-e[0])).toString(),e=[]):e.push(n))),window.requestAnimationFrame(i)}};this.tick=0,this.renderTick=0,window.requestAnimationFrame(i)},e.prototype.fullscreen=function(){var t=this.renderer.container;if(t.requestFullScreen)t.requestFullScreen();else if(t.webkitRequestFullScreen)t.webkitRequestFullScreen();else{if(!t.mozRequestFullScreen)return!1;t.mozRequestFullScreen()}return!0},e.prototype.exitFullscreen=function(){var t=this.renderer.container;if(t.exitFullscreen)t.exitFullscreen();else if(t.webkitCancelFullScreen)t.webkitCancelFullScreen();else{if(!t.mozCancelFullScreen)return!1;t.mozCancelFullScreen()}return!0},e}();t.Game=e}(jg||(jg={}));var jg;!function(t){!function(e){var i=function(){function e(){this.filters=[]}return e.prototype.get=function(t){return this.filters[t]},e.prototype.add=function(t){return this.filters.push(t),this},e.prototype.set=function(t){return this.filters=[t],this},e.prototype.insert=function(t){for(var e=1;e<arguments.length;e++)this.filters.splice(t,0,arguments[e]);return this},e.prototype.remove=function(t){for(var e=0;e<this.filters.length;e++)if(this.filters[e]==t)return this.filters.splice(e,1),void 0},e.prototype.clear=function(){return this.filters=[],this},e.prototype.count=function(){return this.filters.length},e.prototype.has=function(){return this.filters.length>0},e.prototype.createSprite=function(e){var i=new t.BufferedRenderer({width:e.width,height:e.height});i.filter=this;var n=e.x,r=e.y;return e.x=0,e.y=0,i.renderUnit(e),e.x=n,e.y=r,i.createSprite()},e.prototype.createImage=function(e){var i=new t.BufferedRenderer({width:e.image.width,height:e.image.height}),n=new t.Sprite(e.image);return n.x=0,n.y=0,i.filter=this,i.renderUnit(n),i.createImage()},e.prototype.filter=function(t){for(var e=this.filters.length,i=0;e>i;i++)this.filters[i].filter(t)},e}();e.FilterChain=i;var n=function(){function t(t){this.opt={},this.game=t}return t.prototype.filter=function(){},t.prototype.getOption=function(t,e){return void 0===this.opt[t]?e:this.opt[t]},t.prototype.findColorDifference=function(t,e,i){return t*e+(1-t)*i},t.prototype.createColor=function(t){return t=t.replace(/^#/,""),3==t.length&&(t=t.replace(/(.)/g,"$1$1")),t},t.prototype.applyMatrix=function(t,e,i){for(var n=t.data,r=t.width,s=t.height,o=n.length,h=new Array(n.length),a=0;o>a;a++)h[a]=n[a];for(var p=Math.sqrt(e.length),c=Math.floor(p/2),a=1;r-1>a;a++)for(var l=1;s-1>l;l++){for(var u=0,d=0,f=0,g=0;p>g;g++)for(var y=0;p>y;y++){var m=a+y-c+(l+g-c)*r<<2;u+=h[m]*e[y+g*p],d+=h[m+1]*e[y+g*p],f+=h[m+2]*e[y+g*p]}var v=a+l*r<<2,w=n[v],x=n[v+1],T=n[v+2];n[v]=this.findColorDifference(i,u,w),n[v+1]=this.findColorDifference(i,d,x),n[v+2]=this.findColorDifference(i,f,T)}return t},t.prototype.checkRGBBoundary=function(t){return 0>t?0:t>255?255:t},t}();e.Filter=n;var r=function(t){function e(e,i,n,r){t.call(this,e),this.opt.amount=n,this.opt.image=i,this.opt.repeat=r}return __extends(e,t),e.prototype.getImageData=function(t,e){var i;return e?i=e.getContext("2d"):(e=window.createCanvas(t.width,t.height),i=e.getContext("2d"),i.drawImage(t,0,0)),i.getImageData(0,0,t.width,t.height)},e.prototype.createRuleImage=function(){var t=this.opt.image;if(t instanceof ImageData)this.ruleImage=t;else if(t instanceof HTMLCanvasElement)this.ruleImage=this.getImageData(t,t);else if(t instanceof HTMLImageElement||t instanceof HTMLVideoElement)this.ruleImage=this.getImageData(t);else{var e=t.createSprite();this.ruleImage=this.getImageData(e.image)}},e.prototype.createMask=function(){var t,e=this.getImageData(this.opt.mask1).data,i=this.getImageData(this.opt.mask2).data;this.ruleImage.data,t={};for(var n=0,r=e.length;r>n;n+=4)t[n]=e[n]==i[n]&&e[n+1]==i[n+1]&&e[n+2]==i[n+2]&&e[n+3]==i[n+3]?1:0;return this.mask=t,t},e.prototype.filter=function(t){this.ruleImage||this.createRuleImage();var e,i=this.getOption("amount",255),n=this.getOption("repeat",!1),r=t.width,s=t.height,o=this.ruleImage.width,h=this.ruleImage.height,a=t.data,p=this.ruleImage.data;if(this.opt.mask1&&this.opt.mask2&&(e=this.mask?this.mask:this.createMask()),r==o&&s==h)for(var c=0,l=a.length;l>>2>c;c++){var u=c<<2;if(e&&e[u]){if(this.opt.maskDraw)continue;a[u+3]=0}else a[u+3]=Math.round(a[u+3]/255*Math.max(0,p[u]-i))}else if(n)for(var d=0;r>d;d++)for(var f=0;s>f;f++){var u=4*(d+f*r);if(e&&e[u]){if(this.opt.maskDraw)continue;a[u+3]=0}else{var g=d%o,y=f%h,m=4*(g+y*o);a[u+3]=Math.round(a[u+3]/255*Math.max(0,p[m]-i))}}else for(var v=Math.round(100*(o/r))/100,w=Math.round(100*(h/s))/100,d=0;r>d;d++)for(var f=0;s>f;f++){var u=4*(d+f*r);if(e&&e[u]){if(this.opt.maskDraw)continue;a[u+3]=0}else{var g=Math.round(v*d),y=Math.round(w*f),m=4*(g+y*o);a[u+3]=Math.round(a[u+3]/255*Math.max(0,p[m]-i))}}},e}(n);e.UniversalTransitionFilter=r;var s=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e.prototype.createImageData=function(t,e){var i=window.createCanvas(t,e),n=i.getContext("2d");return n.createImageData(t,e)},e.prototype.createRuleImage=function(){t.prototype.createRuleImage.call(this);for(var e=this.ruleImage.data,i=0,n=e.length;n>>2>i;i++){var r=i<<2;e[r]=255-e[r],e[r+1]=255-e[r+1],e[r+2]=255-e[r+2]}},e}(r);e.ReverseUniversalTransitionFilter=s;var o=function(t){function e(e,i){t.call(this,e),this.opt.opacity=i}return __extends(e,t),e.prototype.filter=function(t){for(var e=this.getOption("opacity",1),i=t.data,n=0,r=i.length;r>>2>n;n++){var s=n<<2,o=i[s],h=i[s+1],a=i[s+2],p=.21*o+.71*h+.07*a;i[s]=this.findColorDifference(e,p,o),i[s+1]=this.findColorDifference(e,p,h),i[s+2]=this.findColorDifference(e,p,a)}},e}(n);e.GreyscaleFilter=o;var h=function(t){function e(e,i){t.call(this,e),this.opt.opacity=i}return __extends(e,t),e.prototype.filter=function(t){for(var e=this.getOption("opacity",1),i=t.data,n=0,r=i.length;r>>2>n;n++){var s=n<<2,o=i[s],h=i[s+1],a=i[s+2];i[s]=this.findColorDifference(e,.393*o+.769*h+.189*a,o),i[s+1]=this.findColorDifference(e,.349*o+.686*h+.168*a,h),i[s+2]=this.findColorDifference(e,.272*o+.534*h+.131*a,a)}},e}(n);e.SepiaFilter=h;var a=function(t){function e(e,i,n){t.call(this,e),this.opt.color=i,this.opt.opacity=n}return __extends(e,t),e.prototype.filter=function(t){for(var e=this.getOption("opacity",1),i=this.getOption("color","#f00"),n=t.data,r=parseInt(this.createColor(i),16),s=(16711680&r)>>16,o=(65280&r)>>8,h=255&r,a=0,p=n.length;p>>2>a;a++){var c=a<<2,l=n[c],u=n[c+1],d=n[c+2];n[c]=this.findColorDifference(e,s,l),n[c+1]=this.findColorDifference(e,o,u),n[c+2]=this.findColorDifference(e,h,d)}},e}(n);e.TintFilter=a;var p=function(t){function e(e,i){t.call(this,e),this.opt.amount=i}return __extends(e,t),e.prototype.filter=function(t){var e=[0,1,0,1,-4,1,0,1,0];this.applyMatrix(t,e,this.getOption("amount",1))},e}(n);e.EdgesFilter=p;var c=function(t){function e(e,i){t.call(this,e),this.opt.amount=i}return __extends(e,t),e.prototype.filter=function(t){var e=[-2,-1,0,-1,1,1,0,1,2];this.applyMatrix(t,e,this.getOption("amount",.5))},e}(n);e.EmbossFilter=c;var l=function(t){function e(e,i){t.call(this,e),this.opt.amount=i |
| 3 |
}return __extends(e,t),e.prototype.filter=function(t){var e=[-1,-1,-1,-1,9,-1,-1,-1,-1];this.applyMatrix(t,e,this.getOption("amount",.5))},e}(n);e.SharpenFilter=l;var u=function(t){function e(e,i,n){t.call(this,e),this.opt.amount=i,this.opt.matrix=n}return __extends(e,t),e.prototype.filter=function(t){var e=this.getOption("matrix",[.111,.111,.111,.111,.111,.111,.111,.111,.111]);this.applyMatrix(t,e,this.getOption("amount",.5))},e}(n);e.MatrixFilter=u;var d=function(t){function e(e,i){t.call(this,e),this.opt.amount=i}return __extends(e,t),e.prototype.filter=function(t){var e=t.width,i=e<<2,n=t.height,r=this.getOption("amount",2);if(t){var s,o=t.data;0>r&&(r=0),s=r>=2.5?.98711*r-.9633:r>=.5?3.97156-4.14554*Math.sqrt(1-.26891*r):2*r*(3.97156-4.14554*Math.sqrt(.865545));for(var h=s*s,a=h*s,p=1.57825+2.44413*s+1.4281*h+.422205*a,c=(2.44413*s+2.85619*h+1.26661*a)/p,l=-(1.4281*h+1.26661*a)/p,u=.422205*a/p,d=1-(c+l+u),f=0;3>f;f++)for(var g=0;n>g;g++){for(var y=g*i+f,m=g*i+(e-1<<2)+f,v=o[y],w=v,x=w,T=x;m>=y;y+=4)v=d*o[y]+c*w+l*x+u*T,o[y]=v,T=x,x=w,w=v;for(y=g*i+(e-1<<2)+f,m=g*i+f,v=o[y],w=v,x=w,T=x;y>=m;y-=4)v=d*o[y]+c*w+l*x+u*T,o[y]=v,T=x,x=w,w=v}for(var f=0;3>f;f++)for(var S=0;e>S;S++){for(var y=(S<<2)+f,m=(n-1)*i+(S<<2)+f,v=o[y],w=v,x=w,T=x;m>=y;y+=i)v=d*o[y]+c*w+l*x+u*T,o[y]=v,T=x,x=w,w=v;for(y=(n-1)*i+(S<<2)+f,m=(S<<2)+f,v=o[y],w=v,x=w,T=x;y>=m;y-=i)v=d*o[y]+c*w+l*x+u*T,o[y]=v,T=x,x=w,w=v}}},e}(n);e.BlurFilter=d;var f=function(t){function e(e,i,n){t.call(this,e),this.opt.size=i,this.opt.opacity=n}return __extends(e,t),e.prototype.filter=function(t){for(var e=this.getOption("opacity",1),i=Math.round(this.getOption("size",5)),n=t.width,r=0,s=t.data,o=s.length;o>>2>r;r++){var h=r<<2,a=s[h],p=s[h+1],c=s[h+2],l=h>>2,u=Math.floor(l/n),d=u%i,f=l-u*n,g=f%i;d&&(l-=d*n),g&&(l-=g),l<<=2,s[h]=this.findColorDifference(e,s[l],a),s[h+1]=this.findColorDifference(e,s[l+1],p),s[h+2]=this.findColorDifference(e,s[l+2],c)}},e}(n);e.MosaicFilter=f,function(t){t[t.Mono=0]="Mono",t[t.Color=1]="Color"}(e.NoiseType||(e.NoiseType={}));var g=e.NoiseType,y=function(t){function e(e,i,n){t.call(this,e),this.opt.amount=i,this.opt.type=n}return __extends(e,t),e.prototype.filter=function(t){for(var e=this.getOption("amount",30),i=this.getOption("type",g.Mono),n=(e>>1)-1,r=n-e,s=0,o=t.data,h=o.length;h>>2>s;s++){var a=s<<2,p=o[a],c=o[a+1],l=o[a+2];if(i==g.Mono){var u=this.game.random(r,n);o[a]=this.checkRGBBoundary(p+u),o[a+1]=this.checkRGBBoundary(c+u),o[a+2]=this.checkRGBBoundary(l+u)}else o[a]=this.checkRGBBoundary(p+this.game.random(r,n)),o[a+1]=this.checkRGBBoundary(c+this.game.random(r,n)),o[a+2]=this.checkRGBBoundary(l+this.game.random(r,n))}},e}(n);e.NoiseFilter=y;var m=function(t){function e(e,i,n){t.call(this,e),this.opt.opacity=n,this.opt.amount=i}return __extends(e,t),e.prototype.filter=function(t){for(var e=this.getOption("opacity",1),i=this.getOption("amount",2),n=256/i,r=255/(i-1),s=0,o=t.data,h=o.length;h>>2>s;s++){var a=s<<2,p=o[a],c=o[a+1],l=o[a+2];o[a]=this.findColorDifference(e,Math.round(r*Math.round(p/n)),p),o[a+1]=this.findColorDifference(e,Math.round(r*Math.round(c/n)),c),o[a+2]=this.findColorDifference(e,Math.round(r*Math.round(l/n)),l)}},e}(n);e.PosterizeFilter=m}(t.ImageFilter||(t.ImageFilter={})),t.ImageFilter}(jg||(jg={}));var jg;!function(t){var e=function(){function e(e){if(this.added_to_timeline=new t.Trigger,this.removed_from_timeline=new t.Trigger,this.action_tick=new t.Trigger,this.time=null,this.frame=0,e)for(var i in e)e.hasOwnProperty(i)&&null!=e[i]&&(this[i]=e[i]);this.timeline=null,this.entity=null,this.removed_from_timeline.handle(this,this.removedFromTimeline),this.added_to_timeline.handle(this,this.addedToTimeline),this.action_tick.handle(this,this.actionTick)}return e.prototype.removedFromTimeline=function(){this.timeline=null,this.entity=null,this.frame=0},e.prototype.addedToTimeline=function(t){this.timeline=t.timeline,this.entity=t.timeline.entity,this.frame=0},e.prototype.actionTick=function(t){var e=this.time-(this.frame+t.elapsed);null!=this.time&&0>=e?(this.frame=this.time,t.timeline.next(-e)):this.frame+=t.elapsed},e}();t.Action=e}(jg||(jg={}));var jg;!function(t){var e=function(e){function i(i){e.call(this,i),this.actions=[],this.endedActions=[],this.action_start=new t.Trigger,this.action_start.handle(this,this.parallelActionStart)}return __extends(i,e),i.prototype.addedToTimeline=function(t){e.prototype.addedToTimeline.call(this,t);for(var i=0,n=this.actions.length;n>i;i++)this.actions[i].added_to_timeline.fire(t)},i.prototype.removedFromTimeline=function(){e.prototype.removedFromTimeline.call(this),this.actions=this.endedActions,this.endedActions=[]},i.prototype.actionTick=function(t){e.prototype.actionTick.call(this,t);var i,n,r=this,s={next:function(){var t=r.actions[i];r.actions.splice(i--,1),n=r.actions.length,r.endedActions.push(t),t.action_end&&t.action_end.fire({timeline:this}),t.removed_from_timeline.fire({timeline:this})}},o={timeline:s,elapsed:t.elapsed};for(i=0,n=this.actions.length;n>i;i++)this.actions[i].action_tick.fire(o);0===this.actions.length&&t.timeline.next(1)},i.prototype.parallelActionStart=function(t){for(var e=0,i=this.actions.length;i>e;e++)this.actions[e].action_start&&this.actions[e].action_start.fire(t)},i}(t.Action);t.ParallelAction=e}(jg||(jg={}));var jg;!function(t){t.TWEEN_DRAW_OPTION_SETTERS={};var e=function(e){function i(i){e.call(this,i),this.origin={},this.target={},this.old={},this.props={};var n=["frame","easing","time","callback","onactiontick","onactionstart","onactionend"];for(var r in i)-1===n.indexOf(r)&&(this.props[r]=i[r]);null==this.easing&&(this.easing=function(t,e,i,n){return i*t/n+e}),this.action_start=new t.Trigger,this.action_start.handle(this,this.actionStart),this.action_tick.handleInsert(0,this,this.tweenActionTick)}return __extends(i,e),i.prototype.actionStart=function(){for(var e in this.props)if("filter"!=e)if(t.TWEEN_DRAW_OPTION_SETTERS[e]||"object"!=typeof this.props[e])this.target[e]="function"==typeof this.props[e]?this.props[e].call(this.entity):this.props[e],this.origin[e]=t.TWEEN_DRAW_OPTION_SETTERS[e]?this.entity.getDrawOption(e):this.entity[e],this.old[e]=this.origin[e];else{this.target[e]={},this.origin[e]={},this.old[e]={};for(var i in this.props[e])this.target[e][i]="function"==typeof this.props[e][i]?this.props[e][i].call(this.entity):this.props[e][i],this.origin[e][i]=this.entity[e][i],this.old[e][i]=this.entity[e][i];this.otherTarget=this.entity[e]}else{var n=new this.props[e].targetClass(this.entity.scene.game);this.entity.filter||(this.entity.filter=new t.ImageFilter.FilterChain),this.entity.filter.add(n),this.props[e].autoDelete&&this.removed_from_timeline.handleInsert(0,this,function(){this.entity.filter&&(this.entity.filter.remove(n),0==this.entity.filter.count()&&delete this.entity.filter,this.entity.updated())}),this.target[e]={},this.origin[e]={},this.old[e]={};for(var i in this.props[e])if("targetClass"!=i&&"autoDelete"!=i)if(void 0!==this.props[e][i].start&&this.props[e][i].start!=t.E.prototype.start){var r=this.props[e][i].start;n.opt[i]=r,this.origin[e][i]=r,this.old[e][i]=r,this.target[e][i]=this.props[e][i].end}else n.opt[i]=this.props[e][i];this.otherTarget=n}},i.prototype.tweenActionTick=function(e){var i=0===this.time?1:this.easing(Math.min(this.time,this.frame+e.elapsed),0,1,this.time)-this.easing(this.frame,0,1,this.time);for(var n in this.target)if(void 0!==this[n])if(t.TWEEN_DRAW_OPTION_SETTERS[n]){var r=t.TWEEN_DRAW_OPTION_SETTERS[n];this.old[n]=r(this.entity,n,this.old[n],this.target[n],this.origin[n],i)}else if("filter"==n)for(var s in this.target[n])this.otherTarget.opt[s]=this.old[n][s]+(this.target[n][s]-this.origin[n][s])*i,Math.abs(this.otherTarget.opt[s])<1e-7&&(this.otherTarget.opt[s]=0),this.old[n][s]=this.otherTarget.opt[s];else if(this.otherTarget)for(var s in this.target[n])this.otherTarget[s]=this.old[n][s]+(this.target[n][s]-this.origin[n][s])*i,Math.abs(this.otherTarget[s])<1e-7&&(this.otherTarget[s]=0),this.old[n][s]=this.otherTarget[s];else this.entity[n]=this.old[n]+(this.target[n]-this.origin[n])*i,Math.abs(this.entity[n])<1e-7&&(this.entity[n]=0),this.old[n]=this.entity[n];this.entity.updated()},i}(t.Action);t.Tween=e}(jg||(jg={}));for(var p in jg.ENTITY_OPTIONS_DEFAULT_VALUES)"object"==typeof jg.ENTITY_OPTIONS_DEFAULT_VALUES[p]?"translate"==p?jg.TWEEN_DRAW_OPTION_SETTERS[p]=function(t,e,i,n,r,s){var o={x:i.x+(n.x-r.x)*s,y:i.y+(n.y-r.y)*s};return t.setDrawOption(e,o),o}:"transform"==p?jg.TWEEN_DRAW_OPTION_SETTERS[p]=function(){throw"unsupported transform tween"}:"scale"==p&&(jg.TWEEN_DRAW_OPTION_SETTERS[p]=function(t,e,i,n,r,s){var o={x:i.x+(n.x-r.x)*s,y:i.y+(n.y-r.y)*s};return t.setDrawOption(e,o),o}):jg.TWEEN_DRAW_OPTION_SETTERS[p]=function(t,e,i,n,r,s){var o=i+(n-r)*s;return Math.abs(o)<1e-7&&(o=0),t.setDrawOption(e,o),o};var jg;!function(t){var e=function(){function e(t){this.entity=t,this.queue=[],this.paused=!1,this.looped=!1,this._parallel=null,this._activated=!1}return e.prototype._deactivateTimeline=function(t){var e=this;(t||this._activated)&&(this._activated=!1,this.entity.scene?this.entity.scene.game.update.remove(this,this.tick):this.entity.addActiveQueue(function(){e.entity.scene.game.update.remove(e,e.tick)}))},e.prototype._activateTimeline=function(t){var e=this;(t||!this._activated&&!this.paused)&&(this.entity.scene?this.entity.scene.game.update.handle(this,this.tick):this.entity.addActiveQueue(function(){e.entity.scene.game.update.handle(e,e.tick)}),this._activated=!0)},e.prototype.setFrameBased=function(){this.isFrameBased=!0},e.prototype.setTimeBased=function(){this.isFrameBased=!1},e.prototype.next=function(t){var e=this.queue.shift();if(e){if(e.action_end&&e.action_end.fire({timeline:this}),0===this.queue.length&&!this.looped)return e.removed_from_timeline.fire({timeline:this}),this._deactivateTimeline(!0),void 0;this.looped?(e.removed_from_timeline.fire({timeline:this}),e.frame=0,this.add(e)):e.removed_from_timeline.fire({timeline:this}),(t>0||this.queue[0]&&0===this.queue[0].time)&&this.tick(t)}},e.prototype.tick=function(t){if(!this.paused&&this.queue.length>0){var e=this.queue[0];0===e.frame&&e.action_start&&e.action_start.fire({timeline:this}),e.action_tick.fire({timeline:this,elapsed:this.isFrameBased?1:t})}},e.prototype.add=function(t){return this._activated||this._activateTimeline(!0),this._parallel?(this._parallel.actions.push(t),this._parallel=null):this.queue.push(t),t.frame=0,t.added_to_timeline.fire({timeline:this}),this},e.prototype.action=function(e){return this.add(new t.Action(e))},e.prototype.tween=function(e){return this.add(new t.Tween(e))},e.prototype.clear=function(){for(var t=0,e=this.queue.length;e>t;t++)this.queue[t].removed_from_timeline.fire({timeline:this});return this.queue=[],this._deactivateTimeline(),this},e.prototype.skip=function(t){var e={};for(this.isFrameBased?e.elapsed=1:(e.elapsed=t,t=1);t--;)this.tick(e);return this},e.prototype.pause=function(){return this.paused||(this.paused=!0,this._deactivateTimeline()),this},e.prototype.resume=function(){return this.paused&&(this.paused=!1,this._activateTimeline()),this},e.prototype.loop=function(){return this.looped=!0,this},e.prototype.unloop=function(){return this.looped=!1,this},e.prototype.delay=function(e){return this.add(new t.Action({time:e})),this},e.prototype.then=function(e){var i=this,n=new t.Action({time:0});return n.action_tick.handleInsert(0,n,function(t){e.call(i.entity,t)}),this.add(n),this},e.prototype.frame=function(t,e){var i=this.entity;return void 0==e?this.then(function(){i.frame=t,i.changeFrame()}):this.delay(t).then(function(){i.frame=e,i.changeFrame()}),this},e.prototype.fno=function(t,e){var i=this.entity;return void 0==e?this.then(function(){i.fno=t,i.changeFrame()}):this.delay(t).then(function(){i.fno=e,i.changeFrame()}),this},e.prototype.cue=function(t){var e=0;for(var i in t){var n=parseInt(i);t.hasOwnProperty(i)&&(this.delay(n-e),this.then(t[i]),e=n)}},e.prototype.repeat=function(e,i){var n=new t.Action({time:i});return n.action_tick.handle(n,function(t){e.call(n,t)}),this},e.prototype.and=function(){var e=this.queue.pop();if(e instanceof t.ParallelAction)this._parallel=e,this.queue.push(e);else{var i=new t.ParallelAction;i.actions.push(e),this.queue.push(i),this._parallel=i}return this},e.prototype.waitUntil=function(e){var i=this,n=new t.Action;return n.action_start=new t.Trigger,n.action_tick.handle(n,function(t){e.call(n,t)&&i.next(0)}),this.add(n),this},e.prototype.moveTo=function(t,e,i,n){return this.tween({x:t,y:e,time:i,easing:n})},e.prototype.moveX=function(t,e,i){return this.tween({x:t,time:e,easing:i})},e.prototype.moveY=function(t,e,i){return this.tween({y:t,time:e,easing:i})},e.prototype.moveBy=function(t,e,i,n){return this.tween({x:function(){return this.x+t},y:function(){return this.y+e},time:i,easing:n})},e.prototype.scrollTo=function(t,e,i,n){return this.entity.scroll||this.entity.scrollTo(0,0),this.tween({scroll:{x:t,y:e},time:i,easing:n})},e.prototype.scrollX=function(t,e,i){return this.entity.scroll||this.entity.scrollTo(0,0),this.tween({scroll:{x:t},time:e,easing:i})},e.prototype.scrollY=function(t,e,i){return this.entity.scroll||this.entity.scrollTo(0,0),this.tween({scroll:{y:t},time:e,easing:i})},e.prototype.scrollBy=function(t,e,i,n){return this.entity.scroll||this.entity.scrollTo(0,0),this.tween({scroll:{x:function(){return this.scroll?this.scroll.x+t:t},y:function(){return this.scroll?this.scroll.y+e:e}},time:i,easing:n})},e.prototype.fadeTo=function(t,e,i){return this.tween({opacity:t,time:e,easing:i}),this},e.prototype.fadeIn=function(t,e){return this.fadeTo(1,t,e)},e.prototype.fadeOut=function(t,e){return this.fadeTo(0,t,e)},e.prototype.hide=function(){return this.then(function(){this.hide()})},e.prototype.show=function(){return this.then(function(){this.show()})},e.prototype.resizeTo=function(t,e,i,n){return"number"==typeof i?this.tween({width:t,height:e,time:i,easing:n}):this.tween({width:t,height:t,time:e,easing:i})},e.prototype.resizeBy=function(t,e,i,n){return"number"== |
|