2014-08-28 03:53:05 +00:00
/* Phaser (AP) v2.1.0 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
2014-08-29 17:13:33 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v1.6.1" , b . blendModes = { NORMAL : 0 , ADD : 1 , MULTIPLY : 2 , SCREEN : 3 , OVERLAY : 4 , DARKEN : 5 , LIGHTEN : 6 , COLOR _DODGE : 7 , COLOR _BURN : 8 , HARD _LIGHT : 9 , SOFT _LIGHT : 10 , DIFFERENCE : 11 , EXCLUSION : 12 , HUE : 13 , SATURATION : 14 , COLOR : 15 , LUMINOSITY : 16 } , b . scaleModes = { DEFAULT : 0 , LINEAR : 0 , NEAREST : 1 } , b . _UID = 0 , "undefined" != typeof Float32Array ? ( b . Float32Array = Float32Array , b . Uint16Array = Uint16Array ) : ( b . Float32Array = Array , b . Uint16Array = Array ) , b . INTERACTION _FREQUENCY = 30 , b . AUTO _PREVENT _DEFAULT = ! 0 , b . RAD _TO _DEG = 180 / Math . PI , b . DEG _TO _RAD = Math . PI / 180 , b . dontSayHello = ! 1 , b . sayHello = function ( a ) { if ( ! b . dontSayHello ) { if ( navigator . userAgent . toLowerCase ( ) . indexOf ( "chrome" ) > - 1 ) { var c = [ "%c %c %c Pixi.js " + b . VERSION + " - " + a + " %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ " , "background: #ff66a5" , "background: #ff66a5" , "color: #ff66a5; background: #030307;" , "background: #ff66a5" , "background: #ffc3dc" , "background: #ff66a5" , "color: #ff2424; background: #fff" , "color: #ff2424; background: #fff" , "color: #ff2424; background: #fff" ] ; console . log . apply ( console , c ) } else window . console && console . log ( "Pixi.js " + b . VERSION + " - http://www.pixijs.com/" ) ; b . dontSayHello = ! 0 } } , b . Matrix = function ( ) { this . a = 1 , this . b = 0 , this . c = 0 , this . d = 1 , this . tx = 0 , this . ty = 0 } , b . Matrix . prototype . fromArray = function ( a ) { this . a = a [ 0 ] , this . b = a [ 1 ] , this . c = a [ 3 ] , this . d = a [ 4 ] , this . tx = a [ 2 ] , this . ty = a [ 5 ] } , b . Matrix . prototype . toArray = function ( a ) { this . array || ( this . array = new Float32Array ( 9 ) ) ; var b = this . array ; return a ? ( b [ 0 ] = this . a , b [ 1 ] = this . c , b [ 2 ] = 0 , b [ 3 ] = this . b , b [ 4 ] = this . d , b [ 5 ] = 0 , b [ 6 ] = this . tx , b [ 7 ] = this . ty , b [ 8 ] = 1 ) : ( b [ 0 ] = this . a , b [ 1 ] = this . b , b [ 2 ] = this . tx , b [ 3 ] = this . c , b [ 4 ] = this . d , b [ 5 ] = this . ty , b [ 6 ] = 0 , b [ 7 ] = 0 , b [ 8 ] = 1 ) , b } , b . Matrix . prototype . apply = function ( a , c ) { return c = c || new b . Point , c . x = this . a * a . x + this . b * a . y + this . tx , c . y = this . c * a . x + this . d * a . y + this . ty , c } , b . Matrix . prototype . applyInverse = function ( a , c ) { c = c || new b . Point ; var d = 1 / ( this . a * this . d + this . b * - this . c ) ; return c . x = this . d * d * a . x - this . b * d * a . y + ( this . ty * this . b - this . tx * this . d ) * d , c . y = this . a * d * a . y - this . c * d * a . x + ( this . tx * this . c - this . ty * this . a ) * d , c } , b . identityMatrix = new b . Matrix , b . determineMatrixArrayType = function ( ) { return "undefined" != typeof Float32Array ? Float32Array : Array } , b . Matrix2 = b . determineMatrixArrayType ( ) , b . DisplayObject = function ( ) { this . position = new b . Point , this . scale = new b . Point ( 1 , 1 ) , this . pivot = new b . Point ( 0 , 0 ) , this . rotation = 0 , this . alpha = 1 , this . visible = ! 0 , this . hitArea = null , this . buttonMode = ! 1 , this . renderable = ! 1 , this . parent = null , this . stage = null , this . worldAlpha = 1 , this . _interactive = ! 1 , this . defaultCursor = "pointer" , this . worldTransform = new b . Matrix , this . color = [ ] , this . dynamic = ! 0 , this . _sr = 0 , this . _cr = 1 , this . filterArea = null , this . _bounds = new b . Rectangle ( 0 , 0 , 1 , 1 ) , this . _currentBounds = null , this . _mask = null , this . _cacheAsBitmap = ! 1 , this . _cacheIsDirty = ! 1 } , b . DisplayObject . prototype . constructor = b . DisplayObject , b . DisplayObject . prototype . setInteractive = function ( a ) { this . interactive = a } , Object . defineProperty ( b . DisplayObject . prototype , "interactive" , { get : function ( ) { return this . _interactive } , set : function ( a ) { this . _interactive = a , this . stage && ( this . stage . dirty = ! 0 ) } } ) , Object . defineProperty ( b . DisplayObject . prototype , "worldVisible" , { get : function ( ) { var a = this ; do { if ( ! a . visible ) return ! 1 ; a = a . parent } while ( a ) ; return ! 0 } } ) , Object . defineProperty ( b . DisplayObject . prototype , "mask" , { get : function ( ) { return this . _mask } , set : function ( a ) { this . _mask && ( this . _mask . isMask = ! 1 ) , this . _mask = a , this . _mask && ( this . _mask . isMask = ! 0 ) } } ) , Object . defineProperty ( b . DisplayObject . prototype , "filters" , { get : function ( ) { return this . _filters } , set : function ( a ) { if ( a ) { for ( var b = [ ] , c = 0 ; c < a . length ; c ++ ) for ( var d = a [ c ] . passes , e = 0 ; e < d . length ; e ++ ) b . push ( d [ e ] ) ; this . _filterBlock = { target : this , filterPasses : b } } this . _filters = a } } ) , Object . defineProperty ( b . DisplayObject . prototype , "cacheAsBitmap" , { get : function ( ) { return this . _cacheAsBitmap } , set : function ( a ) { this . _cacheAsBitmap !== a && ( a ? this . _generateCachedSprite ( ) : this . _destroyCachedSprite ( ) , this . _cacheAsBitmap = a ) } } ) , b . DisplayObject . prototype . updateTransform = function ( ) { this . rotation !== this . rotationCache && ( this . rotationCache = this . rotation , this . _sr = Math . sin ( this . rotation ) , this . _cr = Math . cos (
} , b . PixiShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attributes = null } , b . PixiShader . defaultVertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aTextureCoord;" , "attribute vec2 aColor;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "varying vec2 vTextureCoord;" , "varying vec4 vColor;" , "const vec2 center = vec2(-1.0, 1.0);" , "void main(void) {" , " gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , " vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;" , " vColor = vec4(color * aColor.x, aColor.x);" , "}" ] , b . PixiFastShader = function ( a ) { this . _UID = b . _UID ++ , this . gl = a , this . program = null , this . fragmentSrc = [ "precision lowp float;" , "varying vec2 vTextureCoord;" , "varying float vColor;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aPositionCoord;" , "attribute vec2 aScale;" , "attribute float aRotation;" , "attribute vec2 aTextureCoord;" , "attribute float aColor;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "uniform mat3 uMatrix;" , "varying vec2 vTextureCoord;" , "varying float vColor;" , "const vec2 center = vec2(-1.0, 1.0);" , "void main(void) {" , " vec2 v;" , " vec2 sv = aVertexPosition * aScale;" , " v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);" , " v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);" , " v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;" , " gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , " vColor = aColor;" , "}" ] , this . textureCount = 0 , this . init ( ) } , b . PixiFastShader . prototype . init = function ( ) { var a = this . gl , c = b . compileProgram ( a , this . vertexSrc , this . fragmentSrc ) ; a . useProgram ( c ) , this . uSampler = a . getUniformLocation ( c , "uSampler" ) , this . projectionVector = a . getUniformLocation ( c , "projectionVector" ) , this . offsetVector = a . getUniformLocation ( c , "offsetVector" ) , this . dimensions = a . getUniformLocation ( c , "dimensions" ) , this . uMatrix = a . getUniformLocation ( c , "uMatrix" ) , this . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . aPositionCoord = a . getAttribLocation ( c , "aPositionCoord" ) , this . aScale = a . getAttribLocation ( c , "aScale" ) , this . aRotation = a . getAttribLocation ( c , "aRotation" ) , this . aTextureCoord = a . getAttribLocation ( c , "aTextureCoord" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , - 1 === this . colorAttribute && ( this . colorAttribute = 2 ) , this . attributes = [ this . aVertexPosition , this . aPositionCoord , this . aScale , this . aRotation , this . aTextureCoord , this . colorAttribute ] , this . program = c } , b . PixiFastShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attributes = null } , b . StripShader = function ( a ) { this . _UID = b . _UID ++ , this . gl = a , this . program = null , this . fragmentSrc = [ "precision mediump float;" , "varying vec2 vTextureCoord;" , "uniform float alpha;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aTextureCoord;" , "uniform mat3 translationMatrix;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "varying vec2 vTextureCoord;" , "void main(void) {" , " vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);" , " v -= offsetVector.xyx;" , " gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , "}" ] , this . init ( ) } , b . StripShader . prototype . init = function ( ) { var a = this . gl , c = b . compileProgram ( a , this . vertexSrc , this . fragmentSrc ) ; a . useProgram ( c ) , this . uSampler = a . getUniformLocation ( c , "uSampler" ) , this . projectionVector = a . getUniformLocation ( c , "projectionVector" ) , this . offsetVector = a . getUniformLocation ( c , "offsetVector" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , this . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . aTextureCoord = a . getAttribLocation ( c , " aTextureCoord
} , b . WebGLSpriteBatch . prototype . flush = function ( ) { if ( 0 !== this . currentBatchSize ) { var a = this . gl ; if ( this . renderSession . shaderManager . setShader ( this . renderSession . shaderManager . defaultShader ) , this . dirty ) { this . dirty = ! 1 , a . activeTexture ( a . TEXTURE0 ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) ; var b = this . renderSession . projection ; a . uniform2f ( this . shader . projectionVector , b . x , b . y ) ; var c = 4 * this . vertSize ; a . vertexAttribPointer ( this . shader . aVertexPosition , 2 , a . FLOAT , ! 1 , c , 0 ) , a . vertexAttribPointer ( this . shader . aTextureCoord , 2 , a . FLOAT , ! 1 , c , 8 ) , a . vertexAttribPointer ( this . shader . colorAttribute , 2 , a . FLOAT , ! 1 , c , 16 ) } if ( this . currentBatchSize > . 5 * this . size ) a . bufferSubData ( a . ARRAY _BUFFER , 0 , this . vertices ) ; else { var d = this . vertices . subarray ( 0 , 4 * this . currentBatchSize * this . vertSize ) ; a . bufferSubData ( a . ARRAY _BUFFER , 0 , d ) } for ( var e , f , g = 0 , h = 0 , i = null , j = this . renderSession . blendModeManager . currentBlendMode , k = 0 , l = this . currentBatchSize ; l > k ; k ++ ) e = this . textures [ k ] , f = this . blendModes [ k ] , ( i !== e || j !== f ) && ( this . renderBatch ( i , g , h ) , h = k , g = 0 , i = e , j = f , this . renderSession . blendModeManager . setBlendMode ( j ) ) , g ++ ; this . renderBatch ( i , g , h ) , this . currentBatchSize = 0 } } , b . WebGLSpriteBatch . prototype . renderBatch = function ( a , c , d ) { if ( 0 !== c ) { var e = this . gl ; e . bindTexture ( e . TEXTURE _2D , a . _glTextures [ e . id ] || b . createWebGLTexture ( a , e ) ) , a . _dirty [ e . id ] && b . updateWebGLTexture ( this . currentBaseTexture , e ) , e . drawElements ( e . TRIANGLES , 6 * c , e . UNSIGNED _SHORT , 6 * d * 2 ) , this . renderSession . drawCount ++ } } , b . WebGLSpriteBatch . prototype . stop = function ( ) { this . flush ( ) } , b . WebGLSpriteBatch . prototype . start = function ( ) { this . dirty = ! 0 } , b . WebGLSpriteBatch . prototype . destroy = function ( ) { this . vertices = null , this . indices = null , this . gl . deleteBuffer ( this . vertexBuffer ) , this . gl . deleteBuffer ( this . indexBuffer ) , this . currentBaseTexture = null , this . gl = null } , b . WebGLFastSpriteBatch = function ( a ) { this . vertSize = 10 , this . maxSize = 6e3 , this . size = this . maxSize ; var b = 4 * this . size * this . vertSize , c = 6 * this . maxSize ; this . vertices = new Float32Array ( b ) , this . indices = new Uint16Array ( c ) , this . vertexBuffer = null , this . indexBuffer = null , this . lastIndexCount = 0 ; for ( var d = 0 , e = 0 ; c > d ; d += 6 , e += 4 ) this . indices [ d + 0 ] = e + 0 , this . indices [ d + 1 ] = e + 1 , this . indices [ d + 2 ] = e + 2 , this . indices [ d + 3 ] = e + 0 , this . indices [ d + 4 ] = e + 2 , this . indices [ d + 5 ] = e + 3 ; this . drawing = ! 1 , this . currentBatchSize = 0 , this . currentBaseTexture = null , this . currentBlendMode = 0 , this . renderSession = null , this . shader = null , this . matrix = null , this . setContext ( a ) } , b . WebGLFastSpriteBatch . prototype . setContext = function ( a ) { this . gl = a , this . vertexBuffer = a . createBuffer ( ) , this . indexBuffer = a . createBuffer ( ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) , a . bufferData ( a . ELEMENT _ARRAY _BUFFER , this . indices , a . STATIC _DRAW ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . vertices , a . DYNAMIC _DRAW ) } , b . WebGLFastSpriteBatch . prototype . begin = function ( a , b ) { this . renderSession = b , this . shader = this . renderSession . shaderManager . fastShader , this . matrix = a . worldTransform . toArray ( ! 0 ) , this . start ( ) } , b . WebGLFastSpriteBatch . prototype . end = function ( ) { this . flush ( ) } , b . WebGLFastSpriteBatch . prototype . render = function ( a ) { var b = a . children , c = b [ 0 ] ; if ( c . texture . _uvs ) { this . currentBaseTexture = c . texture . baseTexture , c . blendMode !== this . renderSession . blendModeManager . currentBlendMode && ( this . flush ( ) , this . renderSession . blendModeManager . setBlendMode ( c . blendMode ) ) ; for ( var d = 0 , e = b . length ; e > d ; d ++ ) this . renderSprite ( b [ d ] ) ; this . flush ( ) } } , b . WebGLFastSpriteBatch . prototype . renderSprite = function ( a ) { if ( a . visible && ( a . texture . baseTexture === this . currentBaseTexture || ( this . flush ( ) , this . currentBaseTexture = a . texture . baseTexture , a . texture . _uvs ) ) ) { var b , c , d , e , f , g , h , i , j = this . vertices ; if ( b = a . texture . _uvs , c = a . texture . frame . width , d = a . texture . frame . height , a . texture . trim ) { var k = a . texture . trim ; f = k . x - a . anchor . x * k . width , e = f + a . texture . crop . width , h = k . y - a . anchor . y * k . height , g = h + a . texture . crop . height } else e = a . texture . frame . width * ( 1 - a . anchor . x ) , f = a . texture . frame . width * - a . anchor . x , g = a . texture . frame . height * ( 1 - a . anchor . y ) , h = a . texture . frame . height * - a . anchor . y ; i = 4 * this . currentBatchSize * this . vertSize , j [ i ++ ] = f , j [ i ++ ] = h , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++
2014-09-04 15:56:45 +00:00
} } , b . Graphics . prototype . _renderCanvas = function ( a ) { if ( this . visible !== ! 1 && 0 !== this . alpha && this . isMask !== ! 0 ) { var c = a . context , d = this . worldTransform ; this . blendMode !== a . currentBlendMode && ( a . currentBlendMode = this . blendMode , c . globalCompositeOperation = b . blendModesCanvas [ a . currentBlendMode ] ) , this . _mask && a . maskManager . pushMask ( this . _mask , a . context ) , c . setTransform ( d . a , d . c , d . b , d . d , d . tx , d . ty ) , b . CanvasGraphics . renderGraphics ( this , c ) ; for ( var e = 0 , f = this . children . length ; f > e ; e ++ ) this . children [ e ] . _renderCanvas ( a ) ; this . _mask && a . maskManager . popMask ( a . context ) } } , b . Graphics . prototype . getBounds = function ( a ) { this . bounds || this . updateBounds ( ) ; var b = this . bounds . x , c = this . bounds . width + this . bounds . x , d = this . bounds . y , e = this . bounds . height + this . bounds . y , f = a || this . worldTransform , g = f . a , h = f . c , i = f . b , j = f . d , k = f . tx , l = f . ty , m = g * c + i * e + k , n = j * e + h * c + l , o = g * b + i * e + k , p = j * e + h * b + l , q = g * b + i * d + k , r = j * d + h * b + l , s = g * c + i * d + k , t = j * d + h * c + l , u = m , v = n , w = m , x = n ; w = w > o ? o : w , w = w > q ? q : w , w = w > s ? s : w , x = x > p ? p : x , x = x > r ? r : x , x = x > t ? t : x , u = o > u ? o : u , u = q > u ? q : u , u = s > u ? s : u , v = p > v ? p : v , v = r > v ? r : v , v = t > v ? t : v ; var y = this . _bounds ; return y . x = w , y . width = u - w , y . y = x , y . height = v - x , y } , b . Graphics . prototype . updateBounds = function ( ) { for ( var a , c , d , e , f , g = 1 / 0 , h = - 1 / 0 , i = 1 / 0 , j = - 1 / 0 , k = 0 ; k < this . graphicsData . length ; k ++ ) { var l = this . graphicsData [ k ] , m = l . type , n = l . lineWidth ; if ( a = l . points , m === b . Graphics . RECT ) c = a [ 0 ] - n / 2 , d = a [ 1 ] - n / 2 , e = a [ 2 ] + n , f = a [ 3 ] + n , g = g > c ? c : g , h = c + e > h ? c + e : h , i = i > d ? c : i , j = d + f > j ? d + f : j ; else if ( m === b . Graphics . CIRC || m === b . Graphics . ELIP ) c = a [ 0 ] , d = a [ 1 ] , e = a [ 2 ] + n / 2 , f = a [ 3 ] + n / 2 , g = g > c - e ? c - e : g , h = c + e > h ? c + e : h , i = i > d - f ? d - f : i , j = d + f > j ? d + f : j ; else for ( var o = 0 ; o < a . length ; o += 2 ) c = a [ o ] , d = a [ o + 1 ] , g = g > c - n ? c - n : g , h = c + n > h ? c + n : h , i = i > d - n ? d - n : i , j = d + n > j ? d + n : j } var p = this . boundsPadding ; this . bounds = new b . Rectangle ( g - p , i - p , h - g + 2 * p , j - i + 2 * p ) } , b . Graphics . prototype . _generateCachedSprite = function ( ) { var a = this . getLocalBounds ( ) ; if ( this . _cachedSprite ) this . _cachedSprite . buffer . resize ( a . width , a . height ) ; else { var c = new b . CanvasBuffer ( a . width , a . height ) , d = b . Texture . fromCanvas ( c . canvas ) ; this . _cachedSprite = new b . Sprite ( d ) , this . _cachedSprite . buffer = c , this . _cachedSprite . worldTransform = this . worldTransform } this . _cachedSprite . anchor . x = - ( a . x / a . width ) , this . _cachedSprite . anchor . y = - ( a . y / a . height ) , this . _cachedSprite . buffer . context . translate ( - a . x , - a . y ) , b . CanvasGraphics . renderGraphics ( this , this . _cachedSprite . buffer . context ) , this . _cachedSprite . alpha = this . alpha } , b . Graphics . prototype . destroyCachedSprite = function ( ) { this . _cachedSprite . texture . destroy ( ! 0 ) , this . _cachedSprite = null } , b . Graphics . POLY = 0 , b . Graphics . RECT = 1 , b . Graphics . CIRC = 2 , b . Graphics . ELIP = 3 , b . Graphics . RREC = 4 , b . Strip = function ( a ) { b . DisplayObjectContainer . call ( this ) , this . texture = a , this . uvs = new b . Float32Array ( [ 0 , 1 , 1 , 1 , 1 , 0 , 0 , 1 ] ) , this . verticies = new b . Float32Array ( [ 0 , 0 , 100 , 0 , 100 , 100 , 0 , 100 ] ) , this . colors = new b . Float32Array ( [ 1 , 1 , 1 , 1 ] ) , this . indices = new b . Uint16Array ( [ 0 , 1 , 2 , 3 ] ) , this . dirty = ! 0 , this . padding = 0 } , b . Strip . prototype = Object . create ( b . DisplayObjectContainer . prototype ) , b . Strip . prototype . constructor = b . Strip , b . Strip . prototype . _renderWebGL = function ( a ) { ! this . visible || this . alpha <= 0 || ( a . spriteBatch . stop ( ) , this . _vertexBuffer || this . _initWebGL ( a ) , a . shaderManager . setShader ( a . shaderManager . stripShader ) , this . _renderStrip ( a ) , a . spriteBatch . start ( ) ) } , b . Strip . prototype . _initWebGL = function ( a ) { var b = a . gl ; this . _vertexBuffer = b . createBuffer ( ) , this . _indexBuffer = b . createBuffer ( ) , this . _uvBuffer = b . createBuffer ( ) , this . _colorBuffer = b . createBuffer ( ) , b . bindBuffer ( b . ARRAY _BUFFER , this . _vertexBuffer ) , b . bufferData ( b . ARRAY _BUFFER , this . verticies , b . DYNAMIC _DRAW ) , b . bindBuffer ( b . ARRAY _BUFFER , this . _uvBuffer ) , b . bufferData ( b . ARRAY _BUFFER , this . uvs , b . STATIC _DRAW ) , b . bindBuffer ( b . ARRAY _BUFFER , this . _colorBuffer ) , b . bufferData ( b . ARRAY _BUFFER , this . colors , b . STATIC _DRAW ) , b . bindBuffer ( b . ELEMENT _ARRAY _BUFFER , this . _indexBuffer ) , b . bufferData ( b . ELEMENT _ARRAY _BUFFER , this . indices , b . STATIC _DRAW ) } , b . Strip . prototype . _renderStrip = function ( a ) { var c = a . gl , d = a . projection , e = a . offset , f = a . shaderManager . stripShader ; c . blendFunc ( c . ONE , c . ONE _MINUS _SRC _ALPHA ) , c . uniformMatrix3fv ( f . translationMatrix , ! 1 , this . worldTransform . toArray ( ! 0 ) ) , c . uniform2f ( f . projectionVector , d . x , - d . y ) , c . uniform2f ( f . offsetVector , - e . x , - e . y ) , c . uniform1f ( f . alpha , 1 )
2014-09-09 14:36:42 +00:00
var d = a . length ; if ( 1 > d ) throw new Error ( "Phaser.Point. Parameter 'points' array must not be empty" ) ; if ( 1 === d ) return c . copyFrom ( a [ 0 ] ) , c ; for ( var e = 0 ; d > e ; e ++ ) b . Point . add ( c , a [ e ] , c ) ; return c . divide ( d , d ) , c } , PIXI . Point = b . Point , b . Rectangle = function ( a , b , c , d ) { a = a || 0 , b = b || 0 , c = c || 0 , d = d || 0 , this . x = a , this . y = b , this . width = c , this . height = d } , b . Rectangle . prototype = { offset : function ( a , b ) { return this . x += a , this . y += b , this } , offsetPoint : function ( a ) { return this . offset ( a . x , a . y ) } , setTo : function ( a , b , c , d ) { return this . x = a , this . y = b , this . width = c , this . height = d , this } , centerOn : function ( a , b ) { return this . centerX = a , this . centerY = b , this } , floor : function ( ) { this . x = Math . floor ( this . x ) , this . y = Math . floor ( this . y ) } , floorAll : function ( ) { this . x = Math . floor ( this . x ) , this . y = Math . floor ( this . y ) , this . width = Math . floor ( this . width ) , this . height = Math . floor ( this . height ) } , copyFrom : function ( a ) { return this . setTo ( a . x , a . y , a . width , a . height ) } , copyTo : function ( a ) { return a . x = this . x , a . y = this . y , a . width = this . width , a . height = this . height , a } , inflate : function ( a , c ) { return b . Rectangle . inflate ( this , a , c ) } , size : function ( a ) { return b . Rectangle . size ( this , a ) } , clone : function ( a ) { return b . Rectangle . clone ( this , a ) } , contains : function ( a , c ) { return b . Rectangle . contains ( this , a , c ) } , containsRect : function ( a ) { return b . Rectangle . containsRect ( a , this ) } , equals : function ( a ) { return b . Rectangle . equals ( this , a ) } , intersection : function ( a , c ) { return b . Rectangle . intersection ( this , a , c ) } , intersects : function ( a , c ) { return b . Rectangle . intersects ( this , a , c ) } , intersectsRaw : function ( a , c , d , e , f ) { return b . Rectangle . intersectsRaw ( this , a , c , d , e , f ) } , union : function ( a , c ) { return b . Rectangle . union ( this , a , c ) } , toString : function ( ) { return "[{Rectangle (x=" + this . x + " y=" + this . y + " width=" + this . width + " height=" + this . height + " empty=" + this . empty + ")}]" } } , Object . defineProperty ( b . Rectangle . prototype , "halfWidth" , { get : function ( ) { return Math . round ( this . width / 2 ) } } ) , Object . defineProperty ( b . Rectangle . prototype , "halfHeight" , { get : function ( ) { return Math . round ( this . height / 2 ) } } ) , Object . defineProperty ( b . Rectangle . prototype , "bottom" , { get : function ( ) { return this . y + this . height } , set : function ( a ) { this . height = a <= this . y ? 0 : a - this . y } } ) , Object . defineProperty ( b . Rectangle . prototype , "bottomRight" , { get : function ( ) { return new b . Point ( this . right , this . bottom ) } , set : function ( a ) { this . right = a . x , this . bottom = a . y } } ) , Object . defineProperty ( b . Rectangle . prototype , "left" , { get : function ( ) { return this . x } , set : function ( a ) { this . width = a >= this . right ? 0 : this . right - a , this . x = a } } ) , Object . defineProperty ( b . Rectangle . prototype , "right" , { get : function ( ) { return this . x + this . width } , set : function ( a ) { this . width = a <= this . x ? 0 : a - this . x } } ) , Object . defineProperty ( b . Rectangle . prototype , "volume" , { get : function ( ) { return this . width * this . height } } ) , Object . defineProperty ( b . Rectangle . prototype , "perimeter" , { get : function ( ) { return 2 * this . width + 2 * this . height } } ) , Object . defineProperty ( b . Rectangle . prototype , "centerX" , { get : function ( ) { return this . x + this . halfWidth } , set : function ( a ) { this . x = a - this . halfWidth } } ) , Object . defineProperty ( b . Rectangle . prototype , "centerY" , { get : function ( ) { return this . y + this . halfHeight } , set : function ( a ) { this . y = a - this . halfHeight } } ) , Object . defineProperty ( b . Rectangle . prototype , "randomX" , { get : function ( ) { return this . x + Math . random ( ) * this . width } } ) , Object . defineProperty ( b . Rectangle . prototype , "randomY" , { get : function ( ) { return this . y + Math . random ( ) * this . height } } ) , Object . defineProperty ( b . Rectangle . prototype , "top" , { get : function ( ) { return this . y } , set : function ( a ) { a >= this . bottom ? ( this . height = 0 , this . y = a ) : this . height = this . bottom - a } } ) , Object . defineProperty ( b . Rectangle . prototype , "topLeft" , { get : function ( ) { return new b . Point ( this . x , this . y ) } , set : function ( a ) { this . x = a . x , this . y = a . y } } ) , Object . defineProperty ( b . Rectangle . prototype , "topRight" , { get : function ( ) { return new b . Point ( this . x + this . width , this . y ) } , set : function ( a ) { this . right = a . x , this . y = a . y } } ) , Object . defineProperty ( b . Rectangle . prototype , "empty" , { get : function ( ) { return ! this . width || ! this . height } , set : function ( a ) { a === ! 0 && this . setTo ( 0 , 0 , 0 , 0 ) } } ) , b . Rectangle . prototype . constructor = b . Rectangle , b . Rectangle . inflate = function ( a , b , c ) { return a . x -= b , a . width += 2 * b , a . y -= c , a . height += 2 * c , a } , b . Rectangle . inflatePoint = function ( a , c ) { return b . Rectangle . infl
2014-09-09 13:47:54 +00:00
} , b . Stage . prototype . boot = function ( ) { b . Canvas . getOffset ( this . game . canvas , this . offset ) ; var a = this ; this . _onChange = function ( b ) { return a . visibilityChange ( b ) } , b . Canvas . setUserSelect ( this . game . canvas , "none" ) , b . Canvas . setTouchAction ( this . game . canvas , "none" ) , this . checkVisibility ( ) } , b . Stage . prototype . preUpdate = function ( ) { this . currentRenderOrderID = 0 ; for ( var a = this . children . length , b = 0 ; a > b ; b ++ ) this . children [ b ] . preUpdate ( ) } , b . Stage . prototype . update = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . update ( ) } , b . Stage . prototype . postUpdate = function ( ) { if ( this . game . world . camera . target ) { this . game . world . camera . target . postUpdate ( ) , this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } } , b . Stage . prototype . checkVisibility = function ( ) { this . _hiddenVar = void 0 !== document . webkitHidden ? "webkitvisibilitychange" : void 0 !== document . mozHidden ? "mozvisibilitychange" : void 0 !== document . msHidden ? "msvisibilitychange" : void 0 !== document . hidden ? "visibilitychange" : null , this . _hiddenVar && document . addEventListener ( this . _hiddenVar , this . _onChange , ! 1 ) , window . onpagehide = this . _onChange , window . onpageshow = this . _onChange , window . onblur = this . _onChange , window . onfocus = this . _onChange ; var a = this ; this . game . device . cocoonJSApp && ( CocoonJS . App . onSuspended . addEventListener ( function ( ) { b . Stage . prototype . visibilityChange . call ( a , { type : "pause" } ) } ) , CocoonJS . App . onActivated . addEventListener ( function ( ) { b . Stage . prototype . visibilityChange . call ( a , { type : "resume" } ) } ) ) } , b . Stage . prototype . visibilityChange = function ( a ) { return "pagehide" === a . type || "blur" === a . type || "pageshow" === a . type || "focus" === a . type ? void ( "pagehide" === a . type || "blur" === a . type ? this . game . focusLoss ( a ) : ( "pageshow" === a . type || "focus" === a . type ) && this . game . focusGain ( a ) ) : void ( this . disableVisibilityChange || ( document . hidden || document . mozHidden || document . msHidden || document . webkitHidden || "pause" === a . type ? this . game . gamePaused ( a ) : this . game . gameResumed ( a ) ) ) } , b . Stage . prototype . setBackgroundColor = function ( a ) { if ( "string" == typeof a ) { var c = b . Color . hexToColor ( a ) ; this . _backgroundColor = b . Color . getColor ( c . r , c . g , c . b ) } else { var c = b . Color . getRGB ( a ) ; this . _backgroundColor = a } this . backgroundColorSplit = [ c . r / 255 , c . g / 255 , c . b / 255 ] , this . backgroundColorString = b . Color . RGBtoString ( c . r , c . g , c . b , 255 , "#" ) } , b . Stage . prototype . destroy = function ( ) { this . _hiddenVar && document . removeEventListener ( this . _hiddenVar , this . _onChange , ! 1 ) , window . onpagehide = null , window . onpageshow = null , window . onblur = null , window . onfocus = null } , Object . defineProperty ( b . Stage . prototype , "backgroundColor" , { get : function ( ) { return this . _backgroundColor } , set : function ( a ) { this . game . transparent || this . setBackgroundColor ( a ) } } ) , Object . defineProperty ( b . Stage . prototype , "smoothed" , { get : function ( ) { return ! PIXI . scaleModes . LINEAR } , set : function ( a ) { PIXI . scaleModes . LINEAR = a ? 0 : 1 } } ) , b . Group = function ( a , c , d , e , f , g ) { "undefined" == typeof e && ( e = ! 1 ) , "undefined" == typeof f && ( f = ! 1 ) , "undefined" == typeof g && ( g = b . Physics . ARCADE ) , this . game = a , "undefined" == typeof c && ( c = a . world ) , this . name = d || "group" , PIXI . DisplayObjectContainer . call ( this ) , e ? this . game . stage . addChild ( this ) : c && c . addChild ( this ) , this . z = 0 , this . type = b . GROUP , this . alive = ! 0 , this . exists = ! 0 , this . classType = b . Sprite , this . scale = new b . Point ( 1 , 1 ) , this . cursor = null , this . cameraOffset = new b . Point , this . enableBody = f , this . enableBodyDebug = ! 1 , this . physicsBodyType = g , this . onDestroy = new b . Signal , this . _sortProperty = "z" , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 ] } , b . Group . prototype = Object . create ( PIXI . DisplayObjectContainer . prototype ) , b . Group . prototype . constructor = b . Group , b . Group . RETURN _NONE = 0 , b . Group . RETURN _TOTAL = 1 , b . Group . RETURN _CHILD = 2 , b . Group . SORT _ASCENDING = - 1 , b . Group . SORT _DESCENDING = 1 , b . Group . prototype . add = function ( a , b ) { return "undefined" == typeof b && ( b = ! 1 ) , a . parent !== this && ( this . enableBody && this . game . physics . enable ( a , this . physicsBodyType ) , this . addChild ( a ) , a . z = this . children . length , ! b && a . events && a . events . onAddedToGroup . dispatch ( a , this ) , null === this . cursor && ( this . cursor = a ) ) , a } , b . Group . prototype . addMultiple = function ( a , b ) { if ( Array . isArray
} , stopFullScreen : function ( ) { document [ this . game . device . cancelFullscreen ] ( ) } , fullScreenChange : function ( a ) { this . event = a , this . isFullScreen ? ( this . fullScreenScaleMode === b . ScaleManager . EXACT _FIT ? ( this . fullScreenTarget . style . width = "100%" , this . fullScreenTarget . style . height = "100%" , this . width = window . outerWidth , this . height = window . outerHeight , this . game . input . scale . setTo ( this . game . width / this . width , this . game . height / this . height ) , this . aspectRatio = this . width / this . height , this . scaleFactor . x = this . game . width / this . width , this . scaleFactor . y = this . game . height / this . height , this . checkResize ( ) ) : this . fullScreenScaleMode === b . ScaleManager . SHOW _ALL && ( this . setShowAll ( ) , this . refresh ( ) ) , this . enterFullScreen . dispatch ( this . width , this . height ) ) : ( this . fullScreenTarget . style . width = this . game . width + "px" , this . fullScreenTarget . style . height = this . game . height + "px" , this . width = this . _width , this . height = this . _height , this . game . input . scale . setTo ( this . game . width / this . width , this . game . height / this . height ) , this . aspectRatio = this . width / this . height , this . scaleFactor . x = this . game . width / this . width , this . scaleFactor . y = this . game . height / this . height , this . leaveFullScreen . dispatch ( this . width , this . height ) ) } , destroy : function ( ) { window . removeEventListener ( "orientationchange" , this . _checkOrientation , ! 1 ) , window . removeEventListener ( "resize" , this . _checkResize , ! 1 ) , this . game . device . cocoonJS || ( document . removeEventListener ( "webkitfullscreenchange" , this . _fullScreenChange , ! 1 ) , document . removeEventListener ( "mozfullscreenchange" , this . _fullScreenChange , ! 1 ) , document . removeEventListener ( "fullscreenchange" , this . _fullScreenChange , ! 1 ) ) } } , b . ScaleManager . prototype . constructor = b . ScaleManager , Object . defineProperty ( b . ScaleManager . prototype , "scaleMode" , { get : function ( ) { return this . _scaleMode } , set : function ( a ) { a !== this . _scaleMode && ( this . _scaleMode = a ) } } ) , Object . defineProperty ( b . ScaleManager . prototype , "isFullScreen" , { get : function ( ) { return document . fullscreenElement || document . mozFullScreenElement || document . webkitFullscreenElement } } ) , Object . defineProperty ( b . ScaleManager . prototype , "isPortrait" , { get : function ( ) { return 0 === this . orientation || 180 === this . orientation } } ) , Object . defineProperty ( b . ScaleManager . prototype , "isLandscape" , { get : function ( ) { return 90 === this . orientation || - 90 === this . orientation } } ) , b . Game = function ( a , c , d , e , f , g , h , i ) { this . id = b . GAMES . push ( this ) - 1 , this . config = null , this . physicsConfig = i , this . parent = "" , this . width = 800 , this . height = 600 , this . transparent = ! 1 , this . antialias = ! 0 , this . preserveDrawingBuffer = ! 1 , this . renderer = null , this . renderType = b . AUTO , this . state = null , this . isBooted = ! 1 , this . isRunning = ! 1 , this . raf = null , this . add = null , this . make = null , this . cache = null , this . input = null , this . load = null , this . math = null , this . net = null , this . scale = null , this . sound = null , this . stage = null , this . time = null , this . tweens = null , this . world = null , this . physics = null , this . rnd = null , this . device = null , this . camera = null , this . canvas = null , this . context = null , this . debug = null , this . particles = null , this . stepping = ! 1 , this . pendingStep = ! 1 , this . stepCount = 0 , this . onPause = null , this . onResume = null , this . onBlur = null , this . onFocus = null , this . _paused = ! 1 , this . _codePaused = ! 1 , this . _width = 800 , this . _height = 600 , 1 === arguments . length && "object" == typeof arguments [ 0 ] ? this . parseConfig ( arguments [ 0 ] ) : ( this . config = { enableDebug : ! 0 } , "undefined" != typeof a && ( this . _width = a ) , "undefined" != typeof c && ( this . _height = c ) , "undefined" != typeof d && ( this . renderType = d ) , "undefined" != typeof e && ( this . parent = e ) , "undefined" != typeof g && ( this . transparent = g ) , "undefined" != typeof h && ( this . antialias = h ) , this . rnd = new b . RandomDataGenerator ( [ ( Date . now ( ) * Math . random ( ) ) . toString ( ) ] ) , this . state = new b . StateManager ( this , f ) ) ; var j = this ; return this . _onBoot = function ( ) { return j . boot ( ) } , "complete" === document . readyState || "interactive" === document . readyState ? window . setTimeout ( this . _onBoot , 0 ) : "undefined" != typeof window . cordova ? document . addEventListener ( "deviceready" , this . _onBoot , ! 1 ) : ( document . addEventListener ( "DOMContentLoaded" , this . _onBoot , ! 1 ) , window . addEventListener ( "load" , this . _onBoot , ! 1 ) ) , this } , b . Game . prototype = { parseConfig : function ( a ) { this . config = a , "undefined" == typeof a . enableDebug && ( this . config . enableDebug = ! 0 ) , a . width && ( this . _width = a . width ) , a . height && ( this . _heigh
} , onPointerUp : function ( a ) { this . game . input . disabled || this . disabled || ( a . preventDefault ( ) , a . identifier = a . pointerId , this . game . input . stopPointer ( a ) ) } , stop : function ( ) { this . game . canvas . removeEventListener ( "MSPointerDown" , this . _onMSPointerDown ) , this . game . canvas . removeEventListener ( "MSPointerMove" , this . _onMSPointerMove ) , this . game . canvas . removeEventListener ( "MSPointerUp" , this . _onMSPointerUp ) , this . game . canvas . removeEventListener ( "pointerDown" , this . _onMSPointerDown ) , this . game . canvas . removeEventListener ( "pointerMove" , this . _onMSPointerMove ) , this . game . canvas . removeEventListener ( "pointerUp" , this . _onMSPointerUp ) } } , b . MSPointer . prototype . constructor = b . MSPointer , b . Pointer = function ( a , c ) { this . game = a , this . id = c , this . type = b . POINTER , this . exists = ! 0 , this . identifier = 0 , this . pointerId = null , this . target = null , this . button = null , this . _holdSent = ! 1 , this . _history = [ ] , this . _nextDrop = 0 , this . _stateReset = ! 1 , this . withinGame = ! 1 , this . clientX = - 1 , this . clientY = - 1 , this . pageX = - 1 , this . pageY = - 1 , this . screenX = - 1 , this . screenY = - 1 , this . rawMovementX = 0 , this . rawMovementY = 0 , this . movementX = 0 , this . movementY = 0 , this . x = - 1 , this . y = - 1 , this . isMouse = ! 1 , this . isDown = ! 1 , this . isUp = ! 0 , this . timeDown = 0 , this . timeUp = 0 , this . previousTapTime = 0 , this . totalTouches = 0 , this . msSinceLastClick = Number . MAX _VALUE , this . targetObject = null , this . active = ! 1 , this . dirty = ! 1 , this . position = new b . Point , this . positionDown = new b . Point , this . positionUp = new b . Point , this . circle = new b . Circle ( 0 , 0 , 44 ) , 0 === c && ( this . isMouse = ! 0 ) } , b . Pointer . prototype = { start : function ( a ) { return a . pointerId && ( this . pointerId = a . pointerId ) , this . identifier = a . identifier , this . target = a . target , "undefined" != typeof a . button && ( this . button = a . button ) , this . _history = [ ] , this . active = ! 0 , this . withinGame = ! 0 , this . isDown = ! 0 , this . isUp = ! 1 , this . dirty = ! 1 , this . msSinceLastClick = this . game . time . now - this . timeDown , this . timeDown = this . game . time . now , this . _holdSent = ! 1 , this . move ( a , ! 0 ) , this . positionDown . setTo ( this . x , this . y ) , ( this . game . input . multiInputOverride === b . Input . MOUSE _OVERRIDES _TOUCH || this . game . input . multiInputOverride === b . Input . MOUSE _TOUCH _COMBINE || this . game . input . multiInputOverride === b . Input . TOUCH _OVERRIDES _MOUSE && 0 === this . game . input . currentPointers ) && ( this . game . input . x = this . x , this . game . input . y = this . y , this . game . input . position . setTo ( this . x , this . y ) , this . game . input . onDown . dispatch ( this , a ) , this . game . input . resetSpeed ( this . x , this . y ) ) , this . _stateReset = ! 1 , this . totalTouches ++ , this . isMouse || this . game . input . currentPointers ++ , null !== this . targetObject && this . targetObject . _touchedHandler ( this ) , this } , update : function ( ) { this . active && ( this . dirty && ( this . game . input . interactiveItems . total > 0 && this . processInteractiveObjects ( ! 0 ) , this . dirty = ! 1 ) , this . _holdSent === ! 1 && this . duration >= this . game . input . holdRate && ( ( this . game . input . multiInputOverride == b . Input . MOUSE _OVERRIDES _TOUCH || this . game . input . multiInputOverride == b . Input . MOUSE _TOUCH _COMBINE || this . game . input . multiInputOverride == b . Input . TOUCH _OVERRIDES _MOUSE && 0 === this . game . input . currentPointers ) && this . game . input . onHold . dispatch ( this ) , this . _holdSent = ! 0 ) , this . game . input . recordPointerHistory && this . game . time . now >= this . _nextDrop && ( this . _nextDrop = this . game . time . now + this . game . input . recordRate , this . _history . push ( { x : this . position . x , y : this . position . y } ) , this . _history . length > this . game . input . recordLimit && this . _history . shift ( ) ) ) } , move : function ( a , c ) { if ( ! this . game . input . pollLocked ) { if ( "undefined" == typeof c && ( c = ! 1 ) , "undefined" != typeof a . button && ( this . button = a . button ) , this . clientX = a . clientX , this . clientY = a . clientY , this . pageX = a . pageX , this . pageY = a . pageY , this . screenX = a . screenX , this . screenY = a . screenY , this . isMouse && this . game . input . mouse . locked && ! c && ( this . rawMovementX = a . movementX || a . mozMovementX || a . webkitMovementX || 0 , this . rawMovementY = a . movementY || a . mozMovementY || a . webkitMovementY || 0 , this . movementX += this . rawMovementX , this . movementY += this . rawMovementY ) , this . x = ( this . pageX - this . game . scale . offset . x ) * this . game . input . scale . x , this . y = ( this . pageY - this . game . scale . offset . y ) * this . game . input . scale . y , this . position . setTo ( this . x , this . y ) , this . circle . x = this . x , this . circle . y = this . y , ( this . game . input . multiInputOverride === b . Input . MOUSE _OVERRIDES _TOUCH || this . game . input . multiInputOverride === b . Input . MOUSE _TOUCH _COMBINE || th
} , justOver : function ( a , b ) { return a = a || 0 , b = b || 500 , this . _pointerData [ a ] . isOver && this . overDuration ( a ) < b } , justOut : function ( a , b ) { return a = a || 0 , b = b || 500 , this . _pointerData [ a ] . isOut && this . game . time . now - this . _pointerData [ a ] . timeOut < b } , justPressed : function ( a , b ) { return a = a || 0 , b = b || 500 , this . _pointerData [ a ] . isDown && this . downDuration ( a ) < b } , justReleased : function ( a , b ) { return a = a || 0 , b = b || 500 , this . _pointerData [ a ] . isUp && this . game . time . now - this . _pointerData [ a ] . timeUp < b } , overDuration : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . isOver ? this . game . time . now - this . _pointerData [ a ] . timeOver : - 1 } , downDuration : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . isDown ? this . game . time . now - this . _pointerData [ a ] . timeDown : - 1 } , enableDrag : function ( a , c , d , e , f , g ) { "undefined" == typeof a && ( a = ! 1 ) , "undefined" == typeof c && ( c = ! 1 ) , "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = 255 ) , "undefined" == typeof f && ( f = null ) , "undefined" == typeof g && ( g = null ) , this . _dragPoint = new b . Point , this . draggable = ! 0 , this . bringToTop = c , this . dragOffset = new b . Point , this . dragFromCenter = a , this . pixelPerfectClick = d , this . pixelPerfectAlpha = e , f && ( this . boundsRect = f ) , g && ( this . boundsSprite = g ) } , disableDrag : function ( ) { if ( this . _pointerData ) for ( var a = 0 ; 10 > a ; a ++ ) this . _pointerData [ a ] . isDragged = ! 1 ; this . draggable = ! 1 , this . isDragged = ! 1 , this . _draggedPointerID = - 1 } , startDrag : function ( a ) { if ( this . isDragged = ! 0 , this . _draggedPointerID = a . id , this . _pointerData [ a . id ] . isDragged = ! 0 , this . sprite . fixedToCamera ) this . dragFromCenter ? ( this . sprite . centerOn ( a . x , a . y ) , this . _dragPoint . setTo ( this . sprite . cameraOffset . x - a . x , this . sprite . cameraOffset . y - a . y ) ) : this . _dragPoint . setTo ( this . sprite . cameraOffset . x - a . x , this . sprite . cameraOffset . y - a . y ) ; else if ( this . dragFromCenter ) { var b = this . sprite . getBounds ( ) ; this . sprite . x = a . x + ( this . sprite . x - b . centerX ) , this . sprite . y = a . y + ( this . sprite . y - b . centerY ) , this . _dragPoint . setTo ( this . sprite . x - a . x , this . sprite . y - a . y ) } else this . _dragPoint . setTo ( this . sprite . x - a . x , this . sprite . y - a . y ) ; this . updateDrag ( a ) , this . bringToTop && ( this . _dragPhase = ! 0 , this . sprite . bringToTop ( ) ) , this . sprite . events . onDragStart . dispatch ( this . sprite , a ) } , stopDrag : function ( a ) { this . isDragged = ! 1 , this . _draggedPointerID = - 1 , this . _pointerData [ a . id ] . isDragged = ! 1 , this . _dragPhase = ! 1 , this . snapOnRelease && ( this . sprite . fixedToCamera ? ( this . sprite . cameraOffset . x = Math . round ( ( this . sprite . cameraOffset . x - this . snapOffsetX % this . snapX ) / this . snapX ) * this . snapX + this . snapOffsetX % this . snapX , this . sprite . cameraOffset . y = Math . round ( ( this . sprite . cameraOffset . y - this . snapOffsetY % this . snapY ) / this . snapY ) * this . snapY + this . snapOffsetY % this . snapY ) : ( this . sprite . x = Math . round ( ( this . sprite . x - this . snapOffsetX % this . snapX ) / this . snapX ) * this . snapX + this . snapOffsetX % this . snapX , this . sprite . y = Math . round ( ( this . sprite . y - this . snapOffsetY % this . snapY ) / this . snapY ) * this . snapY + this . snapOffsetY % this . snapY ) ) , this . sprite . events . onDragStop . dispatch ( this . sprite , a ) , this . checkPointerOver ( a ) === ! 1 && this . _pointerOutHandler ( a ) } , setDragLock : function ( a , b ) { "undefined" == typeof a && ( a = ! 0 ) , "undefined" == typeof b && ( b = ! 0 ) , this . allowHorizontalDrag = a , this . allowVerticalDrag = b } , enableSnap : function ( a , b , c , d , e , f ) { "undefined" == typeof c && ( c = ! 0 ) , "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = 0 ) , "undefined" == typeof f && ( f = 0 ) , this . snapX = a , this . snapY = b , this . snapOffsetX = e , this . snapOffsetY = f , this . snapOnDrag = c , this . snapOnRelease = d } , disableSnap : function ( ) { this . snapOnDrag = ! 1 , this . snapOnRelease = ! 1 } , checkBoundsRect : function ( ) { this . sprite . fixedToCamera ? ( this . sprite . cameraOffset . x < this . boundsRect . left ? this . sprite . cameraOffset . x = this . boundsRect . left : this . sprite . cameraOffset . x + this . sprite . width > this . boundsRect . right && ( this . sprite . cameraOffset . x = this . boundsRect . right - this . sprite . width ) , this . sprite . cameraOffset . y < this . boundsRect . top ? this . sprite . cameraOffset . y = this . boundsRect . top : this . sprite . cameraOffset . y + this . sprite . height > this . boundsRect . bottom && ( this . sprite . cameraOffset . y = this . boundsRect . bottom - this . sprite . height ) ) : ( this . sprite . x < this . boundsRect . left ? this . sprite . x = this . boundsRect . x : this . sprite . x + this . sprite . width > this . boundsRect . right && ( this . sprite . x = this . boundsRect . right - this . sprite . width ) , this . sprite . y < this . boundsRect . top ? this . sprite . y = this . boundsRect . t
} , set : function ( a ) { a ? this . texture && ( this . texture . baseTexture . scaleMode = 0 ) : this . texture && ( this . texture . baseTexture . scaleMode = 1 ) } } ) , Object . defineProperty ( b . Sprite . prototype , "x" , { get : function ( ) { return this . position . x } , set : function ( a ) { this . position . x = a , this . body && this . body . type === b . Physics . ARCADE && 2 === this . body . phase && ( this . body . _reset = 1 ) } } ) , Object . defineProperty ( b . Sprite . prototype , "y" , { get : function ( ) { return this . position . y } , set : function ( a ) { this . position . y = a , this . body && this . body . type === b . Physics . ARCADE && 2 === this . body . phase && ( this . body . _reset = 1 ) } } ) , Object . defineProperty ( b . Sprite . prototype , "destroyPhase" , { get : function ( ) { return ! ! this . _cache [ 8 ] } } ) , b . Image = function ( a , c , d , e , f ) { c = c || 0 , d = d || 0 , e = e || null , f = f || null , this . game = a , this . exists = ! 0 , this . name = "" , this . type = b . IMAGE , this . z = 0 , this . events = new b . Events ( this ) , this . animations = new b . AnimationManager ( this ) , this . key = e , PIXI . Sprite . call ( this , PIXI . TextureCache . _ _default ) , this . position . set ( c , d ) , this . world = new b . Point ( c , d ) , this . alive = ! 0 , this . autoCull = ! 1 , this . input = null , this . debug = ! 1 , this . cameraOffset = new b . Point , this . cropRect = null , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 ] , this . _crop = null , this . _frame = null , this . _bounds = new b . Rectangle , this . loadTexture ( e , f ) } , b . Image . prototype = Object . create ( PIXI . Sprite . prototype ) , b . Image . prototype . constructor = b . Image , b . Image . prototype . preUpdate = function ( ) { if ( this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , ! this . exists || ! this . parent . exists ) return this . _cache [ 3 ] = - 1 , ! 1 ; this . autoCull && ( this . _bounds . copyFrom ( this . getBounds ( ) ) , this . renderable = this . game . world . camera . screenView . intersects ( this . _bounds ) ) , this . world . setTo ( this . game . camera . x + this . worldTransform . tx , this . game . camera . y + this . worldTransform . ty ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . Image . prototype . update = function ( ) { } , b . Image . prototype . postUpdate = function ( ) { this . key instanceof b . BitmapData && this . key . render ( ) , 1 === this . _cache [ 7 ] && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) ; for ( var a = 0 , c = this . children . length ; c > a ; a ++ ) this . children [ a ] . postUpdate ( ) } , b . Image . prototype . loadTexture = function ( a , c ) { c = c || 0 , this . key = a ; var d = ! 0 , e = this . smoothed ; a instanceof b . RenderTexture ? ( this . key = a . key , this . setTexture ( a ) ) : a instanceof b . BitmapData ? this . setTexture ( a . texture ) : a instanceof PIXI . Texture ? this . setTexture ( a ) : null === a || "undefined" == typeof a ? ( this . key = "__default" , this . setTexture ( PIXI . TextureCache [ this . key ] ) ) : "string" != typeof a || this . game . cache . checkImageKey ( a ) ? ( this . setTexture ( new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) ) , d = ! this . animations . loadFrameData ( this . game . cache . getFrameData ( a ) , c ) ) : ( console . warn ( "Texture with key '" + a + "' not found." ) , this . key = "__missing" , this . setTexture ( PIXI . TextureCache [ this . key ] ) ) , d && ( this . _frame = b . Rectangle . clone ( this . texture . frame ) ) , e || ( this . smoothed = ! 1 ) } , b . Image . prototype . setFrame = function ( a ) { this . _frame = a , this . texture . frame . x = a . x , this . texture . frame . y = a . y , this . texture . frame . width = a . width , this . texture . frame . height = a . height , this . texture . crop . x = a . x , this . texture . crop . y = a . y , this . texture . crop . width = a . width , this . texture . crop . height = a . height , a . trimmed && ( this . texture . trim ? ( this . texture . trim . x = a . spriteSourceSizeX , this . texture . trim . y = a . spriteSourceSizeY , this . texture . trim . width = a . sourceSizeW , this . texture . trim . height = a . sourceSizeH ) : this . texture . trim = { x : a . spriteSourceSizeX , y : a . spriteSourceSizeY , width : a . sourceSizeW , height : a . sourceSizeH } , this . texture . width = a . sourceSizeW , this . texture . height = a . sourceSizeH , this . texture . frame . width = a . sourceSizeW , this . texture . frame . height = a . sourceSizeH ) , this . cropRect ? this . updateCrop ( ) : this . game . renderType === b . WEBGL && PIXI . WebGLRenderer . updateTextureFrame ( this . texture ) } , b . Image . prototype . resetFrame = function ( ) { this . _frame && this . setFrame ( this . _frame ) } , b . Image . prototype . crop = function ( a , c ) { "undefined" == typeof c && ( c = ! 1 ) , a ? ( c && null !== this . cropRect ? this . cropRect . setTo ( a . x , a . y , a . width , a . height ) : this . cropRect = c && null === this . cropRect ? ne
} , b . BitmapText . prototype . update = function ( ) { } , b . BitmapText . prototype . postUpdate = function ( ) { 1 === this . _cache [ 7 ] && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) } , b . BitmapText . prototype . destroy = function ( a ) { if ( null !== this . game && ! this . destroyPhase ) { "undefined" == typeof a && ( a = ! 0 ) , this . _cache [ 8 ] = 1 , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ? this . children [ c ] . destroy ( a ) : this . removeChild ( this . children [ c ] ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . exists = ! 1 , this . visible = ! 1 , this . filters = null , this . mask = null , this . game = null , this . _cache [ 8 ] = 0 } } , Object . defineProperty ( b . BitmapText . prototype , "align" , { get : function ( ) { return this . _align } , set : function ( a ) { a !== this . _align && ( this . _align = a , this . setStyle ( ) ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "tint" , { get : function ( ) { return this . _tint } , set : function ( a ) { a !== this . _tint && ( this . _tint = a , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "angle" , { get : function ( ) { return b . Math . radToDeg ( this . rotation ) } , set : function ( a ) { this . rotation = b . Math . degToRad ( a ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "font" , { get : function ( ) { return this . _font } , set : function ( a ) { a !== this . _font && ( this . _font = a . trim ( ) , this . style . font = this . _fontSize + "px '" + this . _font + "'" , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "fontSize" , { get : function ( ) { return this . _fontSize } , set : function ( a ) { a = parseInt ( a , 10 ) , a !== this . _fontSize && ( this . _fontSize = a , this . style . font = this . _fontSize + "px '" + this . _font + "'" , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "text" , { get : function ( ) { return this . _text } , set : function ( a ) { a !== this . _text && ( this . _text = a . toString ( ) || " " , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "inputEnabled" , { get : function ( ) { return this . input && this . input . enabled } , set : function ( a ) { a ? null === this . input ? ( this . input = new b . InputHandler ( this ) , this . input . start ( ) ) : this . input && ! this . input . enabled && this . input . start ( ) : this . input && this . input . enabled && this . input . stop ( ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "fixedToCamera" , { get : function ( ) { return ! ! this . _cache [ 7 ] } , set : function ( a ) { a ? ( this . _cache [ 7 ] = 1 , this . cameraOffset . set ( this . x , this . y ) ) : this . _cache [ 7 ] = 0 } } ) , Object . defineProperty ( b . BitmapText . prototype , "destroyPhase" , { get : function ( ) { return ! ! this . _cache [ 8 ] } } ) , b . Button = function ( a , c , d , e , f , g , h , i , j , k ) { c = c || 0 , d = d || 0 , e = e || null , f = f || null , g = g || this , b . Image . call ( this , a , c , d , e , i ) , this . type = b . BUTTON , this . _onOverFrameName = null , this . _onOutFrameName = null , this . _onDownFrameName = null , this . _onUpFrameName = null , this . _onOverFrameID = null , this . _onOutFrameID = null , this . _onDownFrameID = null , this . _onUpFrameID = null , this . onOverMouseOnly = ! 1 , this . onOverSound = null , this . onOutSound = null , this . onDownSound = null , this . onUpSound = null , this . onOverSoundMarker = "" , this . onOutSoundMarker = "" , this . onDownSoundMarker = "" , this . onUpSoundMarker = "" , this . onInputOver = new b . Signal , this . onInputOut = new b . Signal , this . onInputDown = new b . Signal , this . onInputUp = new b . Signal , this . freezeFrames = ! 1 , this . forceOut = ! 1 , this . inputEnabled = ! 0 , this . input . start ( 0 , ! 0 ) , this . setFrames ( h , i , j , k ) , null !== f && this . onInputUp . add ( f , g ) , this . events . onInputOver . add ( this . onInputOverHandler , this ) , this . events . onInputOut . add ( this . onInputOutHandler , this ) , this . events . onInputDown . add ( this . onInputDownHandler , this ) , this . events . onInputUp . add ( this . onInputUpHandler , this ) } , b . Button . prototype = Object . create ( b . Image . prototype ) , b . Button . prototype . constructor = b . Button , b . Button . prototype . clearFrames = function ( ) { this . _onOverFrameName = null , this . _onOverFrameID = null , this . _onOutFrameName = null , this . _onOutFrameID = null , this . _onDownFrameName = null , this . _onDownFrameID = null , this . _onUpFrameName = null , this . _onUpFrameID = null } , b . Button . prototype . setFrames = function ( a , b , c , d ) { this . clearFrames ( ) , null !== a && ( "string" == typeof a ? ( this . _onOverFrameName = a , this . input . pointerOver ( ) && ( this . frameName = a ) ) : ( this . _onOverFrameID = a , this . input . pointerOver ( ) && ( this . frame = a ) ) ) , null !== b
return a [ c ] } , max : function ( ) { if ( 1 === arguments . length && "object" == typeof arguments [ 0 ] ) var a = arguments [ 0 ] ; else var a = arguments ; for ( var b = 1 , c = 0 , d = a . length ; d > b ; b ++ ) a [ b ] > a [ c ] && ( c = b ) ; return a [ c ] } , minProperty : function ( a ) { if ( 2 === arguments . length && "object" == typeof arguments [ 1 ] ) var b = arguments [ 1 ] ; else var b = arguments . slice ( 1 ) ; for ( var c = 1 , d = 0 , e = b . length ; e > c ; c ++ ) b [ c ] [ a ] < b [ d ] [ a ] && ( d = c ) ; return b [ d ] [ a ] } , maxProperty : function ( a ) { if ( 2 === arguments . length && "object" == typeof arguments [ 1 ] ) var b = arguments [ 1 ] ; else var b = arguments . slice ( 1 ) ; for ( var c = 1 , d = 0 , e = b . length ; e > c ; c ++ ) b [ c ] [ a ] > b [ d ] [ a ] && ( d = c ) ; return b [ d ] [ a ] } , wrapAngle : function ( a , b ) { var c = b ? Math . PI / 180 : 1 ; return this . wrap ( a , - 180 * c , 180 * c ) } , angleLimit : function ( a , b , c ) { var d = a ; return a > c ? d = c : b > a && ( d = b ) , d } , linearInterpolation : function ( a , b ) { var c = a . length - 1 , d = c * b , e = Math . floor ( d ) ; return 0 > b ? this . linear ( a [ 0 ] , a [ 1 ] , d ) : b > 1 ? this . linear ( a [ c ] , a [ c - 1 ] , c - d ) : this . linear ( a [ e ] , a [ e + 1 > c ? c : e + 1 ] , d - e ) } , bezierInterpolation : function ( a , b ) { for ( var c = 0 , d = a . length - 1 , e = 0 ; d >= e ; e ++ ) c += Math . pow ( 1 - b , d - e ) * Math . pow ( b , e ) * a [ e ] * this . bernstein ( d , e ) ; return c } , catmullRomInterpolation : function ( a , b ) { var c = a . length - 1 , d = c * b , e = Math . floor ( d ) ; return a [ 0 ] === a [ c ] ? ( 0 > b && ( e = Math . floor ( d = c * ( 1 + b ) ) ) , this . catmullRom ( a [ ( e - 1 + c ) % c ] , a [ e ] , a [ ( e + 1 ) % c ] , a [ ( e + 2 ) % c ] , d - e ) ) : 0 > b ? a [ 0 ] - ( this . catmullRom ( a [ 0 ] , a [ 0 ] , a [ 1 ] , a [ 1 ] , - d ) - a [ 0 ] ) : b > 1 ? a [ c ] - ( this . catmullRom ( a [ c ] , a [ c ] , a [ c - 1 ] , a [ c - 1 ] , d - c ) - a [ c ] ) : this . catmullRom ( a [ e ? e - 1 : 0 ] , a [ e ] , a [ e + 1 > c ? c : e + 1 ] , a [ e + 2 > c ? c : e + 2 ] , d - e ) } , linear : function ( a , b , c ) { return ( b - a ) * c + a } , bernstein : function ( a , b ) { return this . factorial ( a ) / this . factorial ( b ) / this . factorial ( a - b ) } , factorial : function ( a ) { if ( 0 === a ) return 1 ; for ( var b = a ; -- a ; ) b *= a ; return b } , catmullRom : function ( a , b , c , d , e ) { var f = . 5 * ( c - a ) , g = . 5 * ( d - b ) , h = e * e , i = e * h ; return ( 2 * b - 2 * c + f + g ) * i + ( - 3 * b + 3 * c - 2 * f - g ) * h + f * e + b } , difference : function ( a , b ) { return Math . abs ( a - b ) } , getRandom : function ( a , b , c ) { if ( "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 0 ) , null != a ) { var d = c ; if ( ( 0 === d || d > a . length - b ) && ( d = a . length - b ) , d > 0 ) return a [ b + Math . floor ( Math . random ( ) * d ) ] } return null } , removeRandom : function ( a , b , c ) { if ( "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 0 ) , null != a ) { var d = c ; if ( ( 0 === d || d > a . length - b ) && ( d = a . length - b ) , d > 0 ) { var e = b + Math . floor ( Math . random ( ) * d ) , f = a . splice ( e , 1 ) ; return f [ 0 ] } } return null } , floor : function ( a ) { var b = 0 | a ; return a > 0 ? b : b != a ? b - 1 : b } , ceil : function ( a ) { var b = 0 | a ; return a > 0 && b != a ? b + 1 : b } , sinCosGenerator : function ( a , b , c , d ) { "undefined" == typeof b && ( b = 1 ) , "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = 1 ) ; for ( var e = b , f = c , g = d * Math . PI / a , h = [ ] , i = [ ] , j = 0 ; a > j ; j ++ ) f -= e * g , e += f * g , h [ j ] = f , i [ j ] = e ; return { sin : i , cos : h , length : a } } , shift : function ( a ) { var b = a . shift ( ) ; return a . push ( b ) , b } , shuffleArray : function ( a ) { for ( var b = a . length - 1 ; b > 0 ; b -- ) { var c = Math . floor ( Math . random ( ) * ( b + 1 ) ) , d = a [ b ] ; a [ b ] = a [ c ] , a [ c ] = d } return a } , distance : function ( a , b , c , d ) { var e = a - c , f = b - d ; return Math . sqrt ( e * e + f * f ) } , distancePow : function ( a , b , c , d , e ) { return "undefined" == typeof e && ( e = 2 ) , Math . sqrt ( Math . pow ( c - a , e ) + Math . pow ( d - b , e ) ) } , distanceRounded : function ( a , c , d , e ) { return Math . round ( b . Math . distance ( a , c , d , e ) ) } , clamp : function ( a , b , c ) { return b > a ? b : a > c ? c : a } , clampBottom : function ( a , b ) { return b > a ? b : a } , within : function ( a , b , c ) { return Math . abs ( a - b ) <= c } , mapLinear : function ( a , b , c , d , e ) { return d + ( a - b ) * ( e - d ) / ( c - b ) } , smoothstep : function ( a , b , c ) { return a = Math . max ( 0 , Math . min ( 1 , ( a - b ) / ( c - b ) ) ) , a * a * ( 3 - 2 * a ) } , smootherstep : function ( a , b , c ) { return a = Math . max ( 0 , Math . min ( 1 , ( a - b ) / ( c - b ) ) ) , a * a * a * ( a * ( 6 * a - 15 ) + 10 ) } , sign : function ( a ) { return 0 > a ? - 1 : a > 0 ? 1 : 0 } , percent : function ( a , b , c ) { return "undefined" == typeof c && ( c = 0 ) , a > b || c > b ? 1 : c > a || c > a ? 0 : ( a - c ) / b } , degToRad : function ( ) { var a = Math . PI / 180 ; return function ( b ) { return b * a } } ( ) , radToDeg : function ( ) { var a = 180 / Math . PI ; return function ( b ) { return b * a } } ( ) } , b . RandomDataGenerator = function ( a ) { "undefined" == typeof a && ( a = [ ] ) , this . c = 1 , this . s0 = 0 , this . s1 = 0 , this . s2 = 0 , this . sow ( a ) } , b . RandomDataGenerator . prototype = { rnd : function ( ) { var a = 2091639 * this . s0 + 2.3283064365386963 e - 10 * this . c ; return this . c = 0 | a , this . s0 = this . s1 , this . s1 = this . s2 , this . s2 = a - this . c , this . s2 } , sow : function ( a ) { "undefined" == typeof a && ( a = [ ] ) , this . s0 = this . hash ( " " ) , this . s1 = this . hash ( this . s0 ) , this . s2 = this . hash ( this . s1 ) , this . c = 1 ; for ( var b , c = 0 ; b =
} , next : function ( a ) { "undefined" == typeof a && ( a = 1 ) ; var b = this . _frameIndex + a ; b >= this . _frames . length && ( this . loop ? b %= this . _frames . length : b = this . _frames . length - 1 ) , b !== this . _frameIndex && ( this . _frameIndex = b , this . currentFrame = this . _frameData . getFrame ( this . _frames [ this . _frameIndex ] ) , this . currentFrame && ( this . _parent . setFrame ( this . currentFrame ) , this . _parent . _ _tilePattern && ( this . _parent . _ _tilePattern = ! 1 , this . _parent . tilingTexture = ! 1 ) ) , this . onUpdate && this . onUpdate . dispatch ( this , this . currentFrame ) ) } , previous : function ( a ) { "undefined" == typeof a && ( a = 1 ) ; var b = this . _frameIndex - a ; 0 > b && ( this . loop ? b = this . _frames . length + b : b ++ ) , b !== this . _frameIndex && ( this . _frameIndex = b , this . currentFrame = this . _frameData . getFrame ( this . _frames [ this . _frameIndex ] ) , this . currentFrame && ( this . _parent . setFrame ( this . currentFrame ) , this . _parent . _ _tilePattern && ( this . _parent . _ _tilePattern = ! 1 , this . _parent . tilingTexture = ! 1 ) ) , this . onUpdate && this . onUpdate . dispatch ( this , this . currentFrame ) ) } , updateFrameData : function ( a ) { this . _frameData = a , this . currentFrame = this . _frameData ? this . _frameData . getFrame ( this . _frames [ this . _frameIndex % this . _frames . length ] ) : null } , destroy : function ( ) { this . game . onPause . remove ( this . onPause , this ) , this . game . onResume . remove ( this . onResume , this ) , this . game = null , this . _parent = null , this . _frames = null , this . _frameData = null , this . currentFrame = null , this . isPlaying = ! 1 , this . onStart . dispose ( ) , this . onLoop . dispose ( ) , this . onComplete . dispose ( ) , this . onUpdate && this . onUpdate . dispose ( ) } , complete : function ( ) { this . isPlaying = ! 1 , this . isFinished = ! 0 , this . paused = ! 1 , this . _parent . events . onAnimationComplete . dispatch ( this . _parent , this ) , this . onComplete . dispatch ( this . _parent , this ) , this . killOnComplete && this . _parent . kill ( ) } } , b . Animation . prototype . constructor = b . Animation , Object . defineProperty ( b . Animation . prototype , "paused" , { get : function ( ) { return this . isPaused } , set : function ( a ) { this . isPaused = a , a ? this . _pauseStartTime = this . game . time . now : this . isPlaying && ( this . _timeNextFrame = this . game . time . now + this . delay ) } } ) , Object . defineProperty ( b . Animation . prototype , "frameTotal" , { get : function ( ) { return this . _frames . length } } ) , Object . defineProperty ( b . Animation . prototype , "frame" , { get : function ( ) { return null !== this . currentFrame ? this . currentFrame . index : this . _frameIndex } , set : function ( a ) { this . currentFrame = this . _frameData . getFrame ( this . _frames [ a ] ) , null !== this . currentFrame && ( this . _frameIndex = a , this . _parent . setFrame ( this . currentFrame ) , this . onUpdate && this . onUpdate . dispatch ( this , this . currentFrame ) ) } } ) , Object . defineProperty ( b . Animation . prototype , "speed" , { get : function ( ) { return Math . round ( 1e3 / this . delay ) } , set : function ( a ) { a >= 1 && ( this . delay = 1e3 / a ) } } ) , Object . defineProperty ( b . Animation . prototype , "enableUpdate" , { get : function ( ) { return null !== this . onUpdate } , set : function ( a ) { a && null === this . onUpdate ? this . onUpdate = new b . Signal : a || null === this . onUpdate || ( this . onUpdate . dispose ( ) , this . onUpdate = null ) } } ) , b . Animation . generateFrameNames = function ( a , c , d , e , f ) { "undefined" == typeof e && ( e = "" ) ; var g = [ ] , h = "" ; if ( d > c ) for ( var i = c ; d >= i ; i ++ ) h = "number" == typeof f ? b . Utils . pad ( i . toString ( ) , f , "0" , 1 ) : i . toString ( ) , h = a + h + e , g . push ( h ) ; else for ( var i = c ; i >= d ; i -- ) h = "number" == typeof f ? b . Utils . pad ( i . toString ( ) , f , "0" , 1 ) : i . toString ( ) , h = a + h + e , g . push ( h ) ; return g } , b . Frame = function ( a , c , d , e , f , g , h ) { this . index = a , this . x = c , this . y = d , this . width = e , this . height = f , this . name = g , this . uuid = h , this . centerX = Math . floor ( e / 2 ) , this . centerY = Math . floor ( f / 2 ) , this . distance = b . Math . distance ( 0 , 0 , e , f ) , this . rotated = ! 1 , this . rotationDirection = "cw" , this . trimmed = ! 1 , this . sourceSizeW = e , this . sourceSizeH = f , this . spriteSourceSizeX = 0 , this . spriteSourceSizeY = 0 , this . spriteSourceSizeW = 0 , this . spriteSourceSizeH = 0 , this . right = this . x + this . width , this . bottom = this . y + this . height } , b . Frame . prototype = { setTrim : function ( a , b , c , d , e , f , g ) { this . trimmed = a , a && ( this . sourceSizeW = b , this . sourceSizeH = c , this . centerX = Math . floor ( b / 2 ) , this . centerY = Math . floor ( c / 2 ) , this . spriteSourceSizeX = d , this . spriteSourceSizeY = e , this . spriteSourceSizeW = f , this . spriteSourceSizeH = g ) } , clone : function ( ) { var a = new b . Frame ( this . index , this . x , this . y , this . width , this . height , this . name , this . uuid ) ; for ( var c in this ) this . hasOwnProperty ( c ) && ( a [ c ] = this [ c ] ) ; return a } , getRect : function ( a ) { return "undefined" == type
2014-09-09 14:36:42 +00:00
} break ; case "bitmapfont" : null == c . xmlURL ? this . game . cache . addBitmapFont ( c . key , c . url , c . data , c . xmlData , c . xSpacing , c . ySpacing ) : ( d = ! 1 , this . xhrLoad ( this . _fileIndex , this . baseURL + c . xmlURL , "text" , "xmlLoadComplete" , "dataLoadError" ) ) ; break ; case "audio" : if ( this . game . sound . usingWebAudio ) { if ( c . data = this . _xhr . response , this . game . cache . addSound ( c . key , c . url , c . data , ! 0 , ! 1 ) , c . autoDecode ) { var e = this , f = c . key ; this . game . cache . updateSound ( f , "isDecoding" , ! 0 ) , this . game . sound . context . decodeAudioData ( c . data , function ( a ) { a && ( e . game . cache . decodedSound ( f , a ) , e . game . sound . onSoundDecode . dispatch ( f , e . game . cache . getSound ( f ) ) ) } ) } } else c . data . removeEventListener ( "canplaythrough" , b . GAMES [ this . game . id ] . load . fileComplete ) , this . game . cache . addSound ( c . key , c . url , c . data , ! 1 , ! 0 ) ; break ; case "text" : c . data = this . _xhr . responseText , this . game . cache . addText ( c . key , c . url , c . data ) ; break ; case "physics" : var g = JSON . parse ( this . _xhr . responseText ) ; this . game . cache . addPhysicsData ( c . key , c . url , g , c . format ) ; break ; case "script" : c . data = document . createElement ( "script" ) , c . data . language = "javascript" , c . data . type = "text/javascript" , c . data . defer = ! 1 , c . data . text = this . _xhr . responseText , document . head . appendChild ( c . data ) , c . callback && ( c . data = c . callback . call ( c . callbackContext , c . key , this . _xhr . responseText ) ) ; break ; case "binary" : c . data = c . callback ? c . callback . call ( c . callbackContext , c . key , this . _xhr . response ) : this . _xhr . response , this . game . cache . addBinary ( c . key , c . data ) } d && this . nextFile ( a , ! 0 ) } , jsonLoadComplete : function ( a ) { if ( ! this . _fileList [ a ] ) return void console . warn ( "Phaser.Loader jsonLoadComplete invalid index " + a ) ; var b = this . _fileList [ a ] ; if ( this . _ajax && this . _ajax . responseText ) var c = JSON . parse ( this . _ajax . responseText ) ; else var c = JSON . parse ( this . _xhr . responseText ) ; b . loaded = ! 0 , "tilemap" === b . type ? this . game . cache . addTilemap ( b . key , b . url , c , b . format ) : "json" === b . type ? this . game . cache . addJSON ( b . key , b . url , c ) : this . game . cache . addTextureAtlas ( b . key , b . url , b . data , c , b . format ) , this . nextFile ( a , ! 0 ) } , csvLoadComplete : function ( a ) { if ( ! this . _fileList [ a ] ) return void console . warn ( "Phaser.Loader csvLoadComplete invalid index " + a ) ; var b = this . _fileList [ a ] , c = this . _xhr . responseText ; b . loaded = ! 0 , this . game . cache . addTilemap ( b . key , b . url , c , b . format ) , this . nextFile ( a , ! 0 ) } , dataLoadError : function ( a ) { var b = this . _fileList [ a ] ; b . loaded = ! 0 , b . error = ! 0 , console . warn ( "Phaser.Loader dataLoadError: " + b . key ) , this . nextFile ( a , ! 0 ) } , xmlLoadComplete : function ( a ) { var b , c = this . _xhr . responseText ; try { if ( window . DOMParser ) { var d = new DOMParser ; b = d . parseFromString ( c , "text/xml" ) } else b = new ActiveXObject ( "Microsoft.XMLDOM" ) , b . async = "false" , b . loadXML ( c ) } catch ( e ) { b = void 0 } if ( ! b || ! b . documentElement || b . getElementsByTagName ( "parsererror" ) . length ) throw new Error ( "Phaser.Loader. Invalid XML given" ) ; var f = this . _fileList [ a ] ; f . loaded = ! 0 , "bitmapfont" == f . type ? this . game . cache . addBitmapFont ( f . key , f . url , f . data , b , f . xSpacing , f . ySpacing ) : "textureatlas" == f . type && this . game . cache . addTextureAtlas ( f . key , f . url , f . data , b , f . format ) , this . nextFile ( a , ! 0 ) } , nextFile : function ( a , b ) { this . progressFloat += this . _progressChunk , this . progress = Math . round ( this . progressFloat ) , this . progress > 100 && ( this . progress = 100 ) , null !== this . preloadSprite && ( 0 === this . preloadSprite . direction ? this . preloadSprite . rect . width = Math . floor ( this . preloadSprite . width / 100 * this . progress ) : this . preloadSprite . rect . height = Math . floor ( this . preloadSprite . height / 100 * this . progress ) , this . preloadSprite . sprite . updateCrop ( ) ) , this . onFileComplete . dispatch ( this . progress , this . _fileList [ a ] . key , b , this . totalLoadedFiles ( ) , this . _fileList . length ) , this . totalQueuedFiles ( ) > 0 ? ( this . _fileIndex ++ , this . loadFile ( ) ) : ( this . hasLoaded = ! 0 , this . isLoading = ! 1 , this . removeAll ( ) , this . onLoadComplete . dispatch ( ) ) } , totalLoadedFiles : function ( ) { for ( var a = 0 , b = 0 ; b < this . _fileList . length ; b ++ ) this . _fileList [ b ] . loaded && a ++ ; return a } , totalQueuedFiles : function ( ) { for ( var a = 0 , b = 0 ; b < this . _fileList . length ; b ++ ) this . _fileList [ b ] . loaded === ! 1 && a ++ ; return a } , totalLoadedPacks : function ( ) { for ( var a = 0 , b = 0 ; b < this . _packList . length ; b ++ ) this . _packList [ b ] . loaded && a ++ ; return a } , totalQueuedPacks : function ( ) { for ( var a = 0 , b = 0 ; b < this . _packList . length ; b ++ ) this . _packList [ b ] . loaded === ! 1 && a ++ ; return a } } , b . Loader . prototype . constructor = b . Loader , b . Load
} , getWebRGB : function ( a ) { if ( "object" == typeof a ) return "rgba(" + a . r . toString ( ) + "," + a . g . toString ( ) + "," + a . b . toString ( ) + "," + ( a . a / 255 ) . toString ( ) + ")" ; var c = b . Color . getRGB ( a ) ; return "rgba(" + c . r . toString ( ) + "," + c . g . toString ( ) + "," + c . b . toString ( ) + "," + ( c . a / 255 ) . toString ( ) + ")" } , getAlpha : function ( a ) { return a >>> 24 } , getAlphaFloat : function ( a ) { return ( a >>> 24 ) / 255 } , getRed : function ( a ) { return a >> 16 & 255 } , getGreen : function ( a ) { return a >> 8 & 255 } , getBlue : function ( a ) { return 255 & a } } , b . Physics = function ( a , b ) { b = b || { } , this . game = a , this . config = b , this . arcade = null , this . p2 = null , this . ninja = null , this . box2d = null , this . chipmunk = null , this . parseConfig ( ) } , b . Physics . ARCADE = 0 , b . Physics . P2JS = 1 , b . Physics . NINJA = 2 , b . Physics . BOX2D = 3 , b . Physics . CHIPMUNK = 5 , b . Physics . prototype = { parseConfig : function ( ) { this . config . hasOwnProperty ( "arcade" ) && this . config . arcade !== ! 0 || ! b . Physics . hasOwnProperty ( "Arcade" ) || ( this . arcade = new b . Physics . Arcade ( this . game ) , this . game . time . deltaCap = . 2 ) , this . config . hasOwnProperty ( "ninja" ) && this . config . ninja === ! 0 && b . Physics . hasOwnProperty ( "Ninja" ) && ( this . ninja = new b . Physics . Ninja ( this . game ) ) , this . config . hasOwnProperty ( "p2" ) && this . config . p2 === ! 0 && b . Physics . hasOwnProperty ( "P2" ) && ( this . p2 = new b . Physics . P2 ( this . game , this . config ) ) } , startSystem : function ( a ) { if ( a === b . Physics . ARCADE ? this . arcade = new b . Physics . Arcade ( this . game ) : a === b . Physics . P2JS && ( this . p2 = new b . Physics . P2 ( this . game , this . config ) ) , a === b . Physics . NINJA ) this . ninja = new b . Physics . Ninja ( this . game ) ; else { if ( a === b . Physics . BOX2D && null === this . box2d ) throw new Error ( "The Box2D physics system has not been implemented yet." ) ; if ( a === b . Physics . CHIPMUNK && null === this . chipmunk ) throw new Error ( "The Chipmunk physics system has not been implemented yet." ) } } , enable : function ( a , c , d ) { "undefined" == typeof c && ( c = b . Physics . ARCADE ) , "undefined" == typeof d && ( d = ! 1 ) , c === b . Physics . ARCADE ? this . arcade . enable ( a ) : c === b . Physics . P2JS && this . p2 ? this . p2 . enable ( a , d ) : c === b . Physics . NINJA && this . ninja && this . ninja . enableAABB ( a ) } , preUpdate : function ( ) { this . p2 && this . p2 . preUpdate ( ) } , update : function ( ) { this . p2 && this . p2 . update ( ) } , setBoundsToWorld : function ( ) { this . arcade && this . arcade . setBoundsToWorld ( ) , this . ninja && this . ninja . setBoundsToWorld ( ) , this . p2 && this . p2 . setBoundsToWorld ( ) } , clear : function ( ) { this . p2 && this . p2 . clear ( ) } , destroy : function ( ) { this . p2 && this . p2 . destroy ( ) , this . arcade = null , this . ninja = null , this . p2 = null } } , b . Physics . prototype . constructor = b . Physics , b . Physics . Arcade = function ( a ) { this . game = a , this . gravity = new b . Point , this . bounds = new b . Rectangle ( 0 , 0 , a . world . width , a . world . height ) , this . checkCollision = { up : ! 0 , down : ! 0 , left : ! 0 , right : ! 0 } , this . maxObjects = 10 , this . maxLevels = 4 , this . OVERLAP _BIAS = 4 , this . TILE _BIAS = 16 , this . forceX = ! 1 , this . skipQuadTree = ! 1 , this . quadTree = new b . QuadTree ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height , this . maxObjects , this . maxLevels ) , this . _overlap = 0 , this . _maxOverlap = 0 , this . _velocity1 = 0 , this . _velocity2 = 0 , this . _newVelocity1 = 0 , this . _newVelocity2 = 0 , this . _average = 0 , this . _mapData = [ ] , this . _result = ! 1 , this . _total = 0 , this . _angle = 0 , this . _dx = 0 , this . _dy = 0 , this . setBoundsToWorld ( ) } , b . Physics . Arcade . prototype . constructor = b . Physics . Arcade , b . Physics . Arcade . prototype = { setBounds : function ( a , b , c , d ) { this . bounds . setTo ( a , b , c , d ) } , setBoundsToWorld : function ( ) { this . bounds . setTo ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height ) } , enable : function ( a , c ) { "undefined" == typeof c && ( c = ! 0 ) ; var d = 1 ; if ( Array . isArray ( a ) ) for ( d = a . length ; d -- ; ) a [ d ] instanceof b . Group ? this . enable ( a [ d ] . children , c ) : ( this . enableBody ( a [ d ] ) , c && a [ d ] . hasOwnProperty ( "children" ) && a [ d ] . children . length > 0 && this . enable ( a [ d ] , ! 0 ) ) ; else a instanceof b . Group ? this . enable ( a . children , c ) : ( this . enableBody ( a ) , c && a . hasOwnProperty ( "children" ) && a . children . length > 0 && this . enable ( a . children , ! 0 ) ) } , enableBody : function ( a ) { a . hasOwnProperty ( "body" ) && null === a . body && ( a . body = new b . Physics . Arcade . Body ( a ) ) } , updateMotion : function ( a ) { this . _velocityDelta = this . computeVelocity ( 0 , a , a . angularVelocity , a . angularAcceleration , a . angularDrag , a . maxAngular ) - a . angularVelocity , a . angularVelocity += this . _velocityDelta , a . rotation += a . angularVelocity * this . game . time
} } , b . Particles . Arcade . Emitter . prototype . setScale = function ( a , c , d , e , f , g , h ) { if ( "undefined" == typeof a && ( a = 1 ) , "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = 1 ) , "undefined" == typeof e && ( e = 1 ) , "undefined" == typeof f && ( f = 0 ) , "undefined" == typeof g && ( g = b . Easing . Linear . None ) , "undefined" == typeof h && ( h = ! 1 ) , this . minParticleScale = 1 , this . maxParticleScale = 1 , this . _minParticleScale . set ( a , d ) , this . _maxParticleScale . set ( c , e ) , this . autoScale = ! 1 , f > 0 && a !== c || d !== e ) { var i = { x : a , y : d } , j = this . game . make . tween ( i ) . to ( { x : c , y : e } , f , g ) ; j . yoyo ( h ) , this . scaleData = j . generateData ( 60 ) , this . scaleData . reverse ( ) , this . autoScale = ! 0 } } , b . Particles . Arcade . Emitter . prototype . at = function ( a ) { a . center ? ( this . emitX = a . center . x , this . emitY = a . center . y ) : ( this . emitX = a . world . x + a . anchor . x * a . width , this . emitY = a . world . y + a . anchor . y * a . height ) } , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "width" , { get : function ( ) { return this . area . width } , set : function ( a ) { this . area . width = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "height" , { get : function ( ) { return this . area . height } , set : function ( a ) { this . area . height = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "x" , { get : function ( ) { return this . emitX } , set : function ( a ) { this . emitX = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "y" , { get : function ( ) { return this . emitY } , set : function ( a ) { this . emitY = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "left" , { get : function ( ) { return Math . floor ( this . x - this . area . width / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "right" , { get : function ( ) { return Math . floor ( this . x + this . area . width / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "top" , { get : function ( ) { return Math . floor ( this . y - this . area . height / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "bottom" , { get : function ( ) { return Math . floor ( this . y + this . area . height / 2 ) } } ) , b . Tile = function ( a , b , c , d , e , f ) { this . layer = a , this . index = b , this . x = c , this . y = d , this . worldX = c * e , this . worldY = d * f , this . width = e , this . height = f , this . centerX = Math . abs ( e / 2 ) , this . centerY = Math . abs ( f / 2 ) , this . alpha = 1 , this . properties = { } , this . scanned = ! 1 , this . faceTop = ! 1 , this . faceBottom = ! 1 , this . faceLeft = ! 1 , this . faceRight = ! 1 , this . collideLeft = ! 1 , this . collideRight = ! 1 , this . collideUp = ! 1 , this . collideDown = ! 1 , this . collisionCallback = null , this . collisionCallbackContext = this } , b . Tile . prototype = { containsPoint : function ( a , b ) { return ! ( a < this . worldX || b < this . worldY || a > this . right || b > this . bottom ) } , intersects : function ( a , b , c , d ) { return c <= this . worldX ? ! 1 : d <= this . worldY ? ! 1 : a >= this . worldX + this . width ? ! 1 : b >= this . worldY + this . height ? ! 1 : ! 0 } , setCollisionCallback : function ( a , b ) { this . collisionCallback = a , this . collisionCallbackContext = b } , destroy : function ( ) { this . collisionCallback = null , this . collisionCallbackContext = null , this . properties = null } , setCollision : function ( a , b , c , d ) { this . collideLeft = a , this . collideRight = b , this . collideUp = c , this . collideDown = d , this . faceLeft = a , this . faceRight = b , this . faceTop = c , this . faceBottom = d } , resetCollision : function ( ) { this . collideLeft = ! 1 , this . collideRight = ! 1 , this . collideUp = ! 1 , this . collideDown = ! 1 , this . faceTop = ! 1 , this . faceBottom = ! 1 , this . faceLeft = ! 1 , this . faceRight = ! 1 } , isInteresting : function ( a , b ) { return a && b ? this . collideLeft || this . collideRight || this . collideUp || this . collideDown || this . faceTop || this . faceBottom || this . faceLeft || this . faceRight || this . collisionCallback : a ? this . collideLeft || this . collideRight || this . collideUp || this . collideDown : b ? this . faceTop || this . faceBottom || this . faceLeft || this . faceRight : ! 1 } , copy : function ( a ) { this . index = a . index , this . alpha = a . alpha , this . properties = a . properties , this . collideUp = a . collideUp , this . collideDown = a . collideDown , this . collideLeft = a . collideLeft , this . collideRight = a . collideRight , this . collisionCallback = a . collisionCallback , this . collisionCallbackContext = a . collisionCallbackContext } } , b . Tile . prototype . constructor = b . Tile , Object . defineProperty ( b . Tile . prototype , "collides" , { get : function ( ) { return this . collideLeft || this . collideRight || this . collideUp || this . collideDown } } ) , Object . defineProperty ( b . Tile . prototype , "canCollide" , { get : function ( ) { return this . collideLeft || this . collideRight || this . collideUp || this . collideDown || this . collisionCallback }
for ( var b = this . tileMargin , c = this . tileMargin , d = this . firstgid , e = 0 ; e < this . rows ; e ++ ) { for ( var f = 0 ; f < this . columns ; f ++ ) this . drawCoords [ d ] = [ b , c ] , b += this . tileWidth + this . tileSpacing , d ++ ; b = this . tileMargin , c += this . tileHeight + this . tileSpacing } } , setSpacing : function ( a , b ) { this . tileMargin = a , this . tileSpacing = b , this . setImage ( this . image ) } } , b . Tileset . prototype . constructor = b . Tileset , "undefined" != typeof exports ? ( "undefined" != typeof module && module . exports && ( exports = module . exports = b ) , exports . Phaser = b ) : "undefined" != typeof define && define . amd ? define ( "Phaser" , function ( ) { return a . Phaser = b } ( ) ) : a . Phaser = b } . call ( this ) ;