2014-10-22 20:42:03 +00:00
/* Phaser (NP) v2.1.3 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
2014-10-23 11:34:33 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v2.0.0" , 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 . PI _2 = 2 * Math . PI , b . RAD _TO _DEG = 180 / Math . PI , b . DEG _TO _RAD = Math . PI / 180 , b . RETINA _PREFIX = "@2x" , b . dontSayHello = ! 1 , b . defaultRenderOptions = { view : null , transparent : ! 1 , antialias : ! 1 , preserveDrawingBuffer : ! 1 , resolution : 1 , clearBeforeRender : ! 0 } , 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 . Polygon = function ( a ) { if ( a instanceof Array || ( a = Array . prototype . slice . call ( arguments ) ) , a [ 0 ] instanceof b . Point ) { for ( var c = [ ] , d = 0 , e = a . length ; e > d ; d ++ ) c . push ( a [ d ] . x , a [ d ] . y ) ; a = c } this . closed = ! 0 , this . points = a } , b . Polygon . prototype . clone = function ( ) { var a = this . points . slice ( ) ; return new b . Polygon ( a ) } , b . Polygon . prototype . contains = function ( a , b ) { for ( var c = ! 1 , d = this . points . length / 2 , e = 0 , f = d - 1 ; d > e ; f = e ++ ) { var g = this . points [ 2 * e ] , h = this . points [ 2 * e + 1 ] , i = this . points [ 2 * f ] , j = this . points [ 2 * f + 1 ] , k = h > b != j > b && ( i - g ) * ( b - h ) / ( j - h ) + g > a ; k && ( c = ! c ) } return c } , b . Polygon . prototype . constructor = b . Polygon , 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 b . Float32Array ( 9 ) ) ; var c = this . array ; return a ? ( c [ 0 ] = this . a , c [ 1 ] = this . b , c [ 2 ] = 0 , c [ 3 ] = this . c , c [ 4 ] = this . d , c [ 5 ] = 0 , c [ 6 ] = this . tx , c [ 7 ] = this . ty , c [ 8 ] = 1 ) : ( c [ 0 ] = this . a , c [ 1 ] = this . c , c [ 2 ] = this . tx , c [ 3 ] = this . b , c [ 4 ] = this . d , c [ 5 ] = this . ty , c [ 6 ] = 0 , c [ 7 ] = 0 , c [ 8 ] = 1 ) , c } , 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 . c * - this . b ) ; return c . x = this . d * d * a . x + - this . c * d * a . y + ( this . ty * this . c - this . tx * this . d ) * d , c . y = this . a * d * a . y + - this . b * d * a . x + ( - this . ty * this . a + this . tx * this . b ) * d , c } , b . Matrix . prototype . translate = function ( a , b ) { return this . tx += a , this . ty += b , this } , b . Matrix . prototype . scale = function ( a , b ) { return this . a *= a , this . d *= b , this . c *= a , this . b *= b , this . tx *= a , this . ty *= b , this } , b . Matrix . prototype . rotate = function ( a ) { var b = Math . cos ( a ) , c = Math . sin ( a ) , d = this . a , e = this . c , f = this . tx ; return this . a = d * b - this . b * c , this . b = d * c + this . b * b , this . c = e * b - this . d * c , this . d = e * c + this . d * b , this . tx = f * b - this . ty * c , this . ty = f * c + this . ty * b , this } , b . Matrix . prototype . append = function ( a ) { var b = this . a , c = this . b , d = this . c , e = this . d ; return this . a = a . a * b + a . b * d , this . b = a . a * c + a . b * e , this . c = a . c * b + a . d * d , this . d = a . c * c + a . d * e , this . tx = a . tx * b + a . ty * d + this . tx , this . ty = a . tx * c + a . ty * e + this . ty , this } , b . Matrix . prototype . identity = function ( ) { return this . a = 1 , this . b = 0 , this . c = 0 , this . d = 1 , this . tx = 0 , this . ty = 0 , this } , b . identityMatrix = new b . Matrix , 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 . _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 . _cacheIs
for ( e = [ ] , f = [ ] , g = 0 ; d > g ; g ++ ) f . push ( g ) ; g = 0 , h = d , c = ! 1 } } return e . push ( f [ 0 ] , f [ 1 ] , f [ 2 ] ) , e } , b . PolyK . _PointInTriangle = function ( a , b , c , d , e , f , g , h ) { var i = g - c , j = h - d , k = e - c , l = f - d , m = a - c , n = b - d , o = i * i + j * j , p = i * k + j * l , q = i * m + j * n , r = k * k + l * l , s = k * m + l * n , t = 1 / ( o * r - p * p ) , u = ( r * q - p * s ) * t , v = ( o * s - p * q ) * t ; return u >= 0 && v >= 0 && 1 > u + v } , b . PolyK . _convex = function ( a , b , c , d , e , f , g ) { return ( b - d ) * ( e - c ) + ( c - a ) * ( f - d ) >= 0 === g } , b . initDefaultShaders = function ( ) { } , b . CompileVertexShader = function ( a , c ) { return b . _CompileShader ( a , c , a . VERTEX _SHADER ) } , b . CompileFragmentShader = function ( a , c ) { return b . _CompileShader ( a , c , a . FRAGMENT _SHADER ) } , b . _CompileShader = function ( a , b , c ) { var d = b . join ( "\n" ) , e = a . createShader ( c ) ; return a . shaderSource ( e , d ) , a . compileShader ( e ) , a . getShaderParameter ( e , a . COMPILE _STATUS ) ? e : ( window . console . log ( a . getShaderInfoLog ( e ) ) , null ) } , b . compileProgram = function ( a , c , d ) { var e = b . CompileFragmentShader ( a , d ) , f = b . CompileVertexShader ( a , c ) , g = a . createProgram ( ) ; return a . attachShader ( g , f ) , a . attachShader ( g , e ) , a . linkProgram ( g ) , a . getProgramParameter ( g , a . LINK _STATUS ) || window . console . log ( "Could not initialise shaders" ) , g } , b . PixiShader = function ( a ) { this . _UID = b . _UID ++ , this . gl = a , this . program = null , this . fragmentSrc = [ "precision lowp float;" , "varying vec2 vTextureCoord;" , "varying vec4 vColor;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;" , "}" ] , this . textureCount = 0 , this . firstRun = ! 0 , this . dirty = ! 0 , this . attributes = [ ] , this . init ( ) } , b . PixiShader . prototype . constructor = b . PixiShader , b . PixiShader . prototype . init = function ( ) { var a = this . gl , c = b . compileProgram ( a , this . vertexSrc || b . PixiShader . defaultVertexSrc , 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 . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . aTextureCoord = a . getAttribLocation ( c , "aTextureCoord" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , - 1 === this . colorAttribute && ( this . colorAttribute = 2 ) , this . attributes = [ this . aVertexPosition , this . aTextureCoord , this . colorAttribute ] ; for ( var d in this . uniforms ) this . uniforms [ d ] . uniformLocation = a . getUniformLocation ( c , d ) ; this . initUniforms ( ) , this . program = c } , b . PixiShader . prototype . initUniforms = function ( ) { this . textureCount = 1 ; var a , b = this . gl ; for ( var c in this . uniforms ) { a = this . uniforms [ c ] ; var d = a . type ; "sampler2D" === d ? ( a . _init = ! 1 , null !== a . value && this . initSampler2D ( a ) ) : "mat2" === d || "mat3" === d || "mat4" === d ? ( a . glMatrix = ! 0 , a . glValueLength = 1 , "mat2" === d ? a . glFunc = b . uniformMatrix2fv : "mat3" === d ? a . glFunc = b . uniformMatrix3fv : "mat4" === d && ( a . glFunc = b . uniformMatrix4fv ) ) : ( a . glFunc = b [ "uniform" + d ] , a . glValueLength = "2f" === d || "2i" === d ? 2 : "3f" === d || "3i" === d ? 3 : "4f" === d || "4i" === d ? 4 : 1 ) } } , b . PixiShader . prototype . initSampler2D = function ( a ) { if ( a . value && a . value . baseTexture && a . value . baseTexture . hasLoaded ) { var b = this . gl ; if ( b . activeTexture ( b [ "TEXTURE" + this . textureCount ] ) , b . bindTexture ( b . TEXTURE _2D , a . value . baseTexture . _glTextures [ b . id ] ) , a . textureData ) { var c = a . textureData , d = c . magFilter ? c . magFilter : b . LINEAR , e = c . minFilter ? c . minFilter : b . LINEAR , f = c . wrapS ? c . wrapS : b . CLAMP _TO _EDGE , g = c . wrapT ? c . wrapT : b . CLAMP _TO _EDGE , h = c . luminance ? b . LUMINANCE : b . RGBA ; if ( c . repeat && ( f = b . REPEAT , g = b . REPEAT ) , b . pixelStorei ( b . UNPACK _FLIP _Y _WEBGL , ! ! c . flipY ) , c . width ) { var i = c . width ? c . width : 512 , j = c . height ? c . height : 2 , k = c . border ? c . border : 0 ; b . texImage2D ( b . TEXTURE _2D , 0 , h , i , j , k , h , b . UNSIGNED _BYTE , null ) } else b . texImage2D ( b . TEXTURE _2D , 0 , h , b . RGBA , b . UNSIGNED _BYTE , a . value . baseTexture . source ) ; b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _MAG _FILTER , d ) , b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _MIN _FILTER , e ) , b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _WRAP _S , f ) , b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _WRAP _T , g ) } b . uniform1i ( a . uniformLocation , this . textureCount ) , a . _init = ! 0 , this . textureCount ++ } } , b . PixiShader . prototype . syncUniforms = function ( ) { this . textureCount = 1 ; var a , c = this . gl ; for ( var d in this . uniforms ) a = this . uniforms [ d ] , 1 === a . glValueLength ? a . glMatrix === ! 0 ? a . glFunc . call ( c , a . uniformLocation , a . transpose , a . value ) : a . glFunc . call ( c , a . uniformLocation , a . value ) : 2 =
this . tempAttribState [ c ] = ! 0 } var d = this . gl ; for ( b = 0 ; b < this . attribState . length ; b ++ ) this . attribState [ b ] !== this . tempAttribState [ b ] && ( this . attribState [ b ] = this . tempAttribState [ b ] , this . tempAttribState [ b ] ? d . enableVertexAttribArray ( b ) : d . disableVertexAttribArray ( b ) ) } , b . WebGLShaderManager . prototype . setShader = function ( a ) { return this . _currentId === a . _UID ? ! 1 : ( this . _currentId = a . _UID , this . currentShader = a , this . gl . useProgram ( a . program ) , this . setAttribs ( a . attributes ) , ! 0 ) } , b . WebGLShaderManager . prototype . destroy = function ( ) { this . attribState = null , this . tempAttribState = null , this . primitiveShader . destroy ( ) , this . complexPrimitiveShader . destroy ( ) , this . defaultShader . destroy ( ) , this . fastShader . destroy ( ) , this . stripShader . destroy ( ) , this . gl = null } , b . WebGLSpriteBatch = function ( ) { this . vertSize = 6 , this . size = 2e3 ; var a = 4 * this . size * this . vertSize , c = 6 * this . size ; this . vertices = new Float32Array ( a ) , this . indices = new Uint16Array ( c ) , 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 . dirty = ! 0 , this . textures = [ ] , this . blendModes = [ ] , this . shaders = [ ] , this . sprites = [ ] , this . defaultShader = new b . AbstractFilter ( [ "precision lowp float;" , "varying vec2 vTextureCoord;" , "varying vec4 vColor;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;" , "}" ] ) } , b . WebGLSpriteBatch . 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 ) , this . currentBlendMode = 99999 ; var c = new b . PixiShader ( a ) ; c . fragmentSrc = this . defaultShader . fragmentSrc , c . uniforms = { } , c . init ( ) , this . defaultShader . shaders [ a . id ] = c } , b . WebGLSpriteBatch . prototype . begin = function ( a ) { this . renderSession = a , this . shader = this . renderSession . shaderManager . defaultShader , this . start ( ) } , b . WebGLSpriteBatch . prototype . end = function ( ) { this . flush ( ) } , b . WebGLSpriteBatch . prototype . render = function ( a ) { var b = a . texture ; this . currentBatchSize >= this . size && ( this . flush ( ) , this . currentBaseTexture = b . baseTexture ) ; var c = b . _uvs ; if ( c ) { var d , e , f , g , h = a . worldAlpha , i = a . tint , j = this . vertices , k = a . anchor . x , l = a . anchor . y ; if ( b . trim ) { var m = b . trim ; e = m . x - k * m . width , d = e + b . crop . width , g = m . y - l * m . height , f = g + b . crop . height } else d = b . frame . width * ( 1 - k ) , e = b . frame . width * - k , f = b . frame . height * ( 1 - l ) , g = b . frame . height * - l ; var n = 4 * this . currentBatchSize * this . vertSize , o = b . baseTexture . resolution , p = a . worldTransform , q = p . a / o , r = p . b / o , s = p . c / o , t = p . d / o , u = p . tx , v = p . ty ; j [ n ++ ] = q * e + s * g + u , j [ n ++ ] = t * g + r * e + v , j [ n ++ ] = c . x0 , j [ n ++ ] = c . y0 , j [ n ++ ] = h , j [ n ++ ] = i , j [ n ++ ] = q * d + s * g + u , j [ n ++ ] = t * g + r * d + v , j [ n ++ ] = c . x1 , j [ n ++ ] = c . y1 , j [ n ++ ] = h , j [ n ++ ] = i , j [ n ++ ] = q * d + s * f + u , j [ n ++ ] = t * f + r * d + v , j [ n ++ ] = c . x2 , j [ n ++ ] = c . y2 , j [ n ++ ] = h , j [ n ++ ] = i , j [ n ++ ] = q * e + s * f + u , j [ n ++ ] = t * f + r * e + v , j [ n ++ ] = c . x3 , j [ n ++ ] = c . y3 , j [ n ++ ] = h , j [ n ++ ] = i , this . sprites [ this . currentBatchSize ++ ] = a } } , b . WebGLSpriteBatch . prototype . renderTilingSprite = function ( a ) { var c = a . tilingTexture ; this . currentBatchSize >= this . size && ( this . flush ( ) , this . currentBaseTexture = c . baseTexture ) , a . _uvs || ( a . _uvs = new b . TextureUvs ) ; var d = a . _uvs ; a . tilePosition . x %= c . baseTexture . width * a . tileScaleOffset . x , a . tilePosition . y %= c . baseTexture . height * a . tileScaleOffset . y ; var e = a . tilePosition . x / ( c . baseTexture . width * a . tileScaleOffset . x ) , f = a . tilePosition . y / ( c . baseTexture . height * a . tileScaleOffset . y ) , g = a . width / c . baseTexture . width / ( a . tileScale . x * a . tileScaleOffset . x ) , h = a . height / c . baseTexture . height / ( a . tileScale . y * a . tileScaleOffset . y ) ; d . x0 = 0 - e , d . y0 = 0 - f , d . x1 = 1 * g - e , d . y1 = 0 - f , d . x2 = 1 * g - e , d . y2 = 1 * h - f , d . x3 = 0 - e , d . y3 = 1 * h - f ; var i = a . worldAlpha , j = a . tint , k = this . vertices , l = a . width , m = a . height , n = a . anchor . x , o = a . anchor . y , p = l * ( 1 - n ) , q = l * - n , r = m * ( 1 - o ) , s = m * - o , t = 4 * this . currentBatchSize * this . vertSize , u = c . baseTexture . resolution , v = a . worldTransform , w = v . a / u , x = v . b / u , y = v . c / u , z = v . d / u , A = v . tx , B = v . ty ; k [ t ++ ] = w * q + y * s + A , k [ t ++ ] = z * s + x * q + B , k [ t ++ ] = d . x0 , k [ t ++ ] = d . y0 , k [ t ++ ] = i , k [ t ++ ] = j , k
} , b . Strip . prototype . _renderCanvas = function ( a ) { var b = a . context , c = this . worldTransform ; a . roundPixels ? b . setTransform ( c . a , c . b , c . c , c . d , 0 | c . tx , 0 | c . ty ) : b . setTransform ( c . a , c . b , c . c , c . d , c . tx , c . ty ) ; var d = this , e = d . verticies , f = d . uvs , g = e . length / 2 ; this . count ++ ; for ( var h = 0 ; g - 2 > h ; h ++ ) { var i = 2 * h , j = e [ i ] , k = e [ i + 2 ] , l = e [ i + 4 ] , m = e [ i + 1 ] , n = e [ i + 3 ] , o = e [ i + 5 ] ; if ( this . padding > 0 ) { var p = ( j + k + l ) / 3 , q = ( m + n + o ) / 3 , r = j - p , s = m - q , t = Math . sqrt ( r * r + s * s ) ; j = p + r / t * ( t + 3 ) , m = q + s / t * ( t + 3 ) , r = k - p , s = n - q , t = Math . sqrt ( r * r + s * s ) , k = p + r / t * ( t + 3 ) , n = q + s / t * ( t + 3 ) , r = l - p , s = o - q , t = Math . sqrt ( r * r + s * s ) , l = p + r / t * ( t + 3 ) , o = q + s / t * ( t + 3 ) } var u = f [ i ] * d . texture . width , v = f [ i + 2 ] * d . texture . width , w = f [ i + 4 ] * d . texture . width , x = f [ i + 1 ] * d . texture . height , y = f [ i + 3 ] * d . texture . height , z = f [ i + 5 ] * d . texture . height ; b . save ( ) , b . beginPath ( ) , b . moveTo ( j , m ) , b . lineTo ( k , n ) , b . lineTo ( l , o ) , b . closePath ( ) , b . clip ( ) ; var A = u * y + x * w + v * z - y * w - x * v - u * z , B = j * y + x * l + k * z - y * l - x * k - j * z , C = u * k + j * w + v * l - k * w - j * v - u * l , D = u * y * l + x * k * w + j * v * z - j * y * w - x * v * l - u * k * z , E = m * y + x * o + n * z - y * o - x * n - m * z , F = u * n + m * w + v * o - n * w - m * v - u * o , G = u * y * o + x * n * w + m * v * z - m * y * w - x * v * o - u * n * z ; b . transform ( B / A , E / A , C / A , F / A , D / A , G / A ) , b . drawImage ( d . texture . baseTexture . source , 0 , 0 ) , b . restore ( ) } } , b . Strip . prototype . renderStripFlat = function ( a ) { var b = this . context , c = a . verticies , d = c . length / 2 ; this . count ++ , b . beginPath ( ) ; for ( var e = 1 ; d - 2 > e ; e ++ ) { var f = 2 * e , g = c [ f ] , h = c [ f + 2 ] , i = c [ f + 4 ] , j = c [ f + 1 ] , k = c [ f + 3 ] , l = c [ f + 5 ] ; b . moveTo ( g , j ) , b . lineTo ( h , k ) , b . lineTo ( i , l ) } b . fillStyle = "#FF0000" , b . fill ( ) , b . closePath ( ) } , b . Strip . prototype . onTextureUpdate = function ( ) { this . updateFrame = ! 0 } , b . Rope = function ( a , c ) { b . Strip . call ( this , a ) , this . points = c , this . verticies = new b . Float32Array ( 4 * c . length ) , this . uvs = new b . Float32Array ( 4 * c . length ) , this . colors = new b . Float32Array ( 2 * c . length ) , this . indices = new b . Uint16Array ( 2 * c . length ) , this . refresh ( ) } , b . Rope . prototype = Object . create ( b . Strip . prototype ) , b . Rope . prototype . constructor = b . Rope , b . Rope . prototype . refresh = function ( ) { var a = this . points ; if ( ! ( a . length < 1 ) ) { var b = this . uvs , c = a [ 0 ] , d = this . indices , e = this . colors ; this . count -= . 2 , b [ 0 ] = 0 , b [ 1 ] = 0 , b [ 2 ] = 0 , b [ 3 ] = 1 , e [ 0 ] = 1 , e [ 1 ] = 1 , d [ 0 ] = 0 , d [ 1 ] = 1 ; for ( var f , g , h , i = a . length , j = 1 ; i > j ; j ++ ) f = a [ j ] , g = 4 * j , h = j / ( i - 1 ) , j % 2 ? ( b [ g ] = h , b [ g + 1 ] = 0 , b [ g + 2 ] = h , b [ g + 3 ] = 1 ) : ( b [ g ] = h , b [ g + 1 ] = 0 , b [ g + 2 ] = h , b [ g + 3 ] = 1 ) , g = 2 * j , e [ g ] = 1 , e [ g + 1 ] = 1 , g = 2 * j , d [ g ] = g , d [ g + 1 ] = g + 1 , c = f } } , b . Rope . prototype . updateTransform = function ( ) { var a = this . points ; if ( ! ( a . length < 1 ) ) { var c , d = a [ 0 ] , e = { x : 0 , y : 0 } ; this . count -= . 2 ; for ( var f , g , h , i , j , k = this . verticies , l = a . length , m = 0 ; l > m ; m ++ ) f = a [ m ] , g = 4 * m , c = m < a . length - 1 ? a [ m + 1 ] : f , e . y = - ( c . x - d . x ) , e . x = c . y - d . y , h = 10 * ( 1 - m / ( l - 1 ) ) , h > 1 && ( h = 1 ) , i = Math . sqrt ( e . x * e . x + e . y * e . y ) , j = this . texture . height / 2 , e . x /= i , e . y /= i , e . x *= j , e . y *= j , k [ g ] = f . x + e . x , k [ g + 1 ] = f . y + e . y , k [ g + 2 ] = f . x - e . x , k [ g + 3 ] = f . y - e . y , d = f ; b . DisplayObjectContainer . prototype . updateTransform . call ( this ) } } , b . Rope . prototype . setTexture = function ( a ) { this . texture = a } , b . TilingSprite = function ( a , c , d ) { b . Sprite . call ( this , a ) , this . _width = c || 100 , this . _height = d || 100 , this . tileScale = new b . Point ( 1 , 1 ) , this . tileScaleOffset = new b . Point ( 1 , 1 ) , this . tilePosition = new b . Point ( 0 , 0 ) , this . renderable = ! 0 , this . tint = 16777215 , this . blendMode = b . blendModes . NORMAL } , b . TilingSprite . prototype = Object . create ( b . Sprite . prototype ) , b . TilingSprite . prototype . constructor = b . TilingSprite , Object . defineProperty ( b . TilingSprite . prototype , "width" , { get : function ( ) { return this . _width } , set : function ( a ) { this . _width = a } } ) , Object . defineProperty ( b . TilingSprite . prototype , "height" , { get : function ( ) { return this . _height } , set : function ( a ) { this . _height = a } } ) , b . TilingSprite . prototype . setTexture = function ( a ) { this . texture !== a && ( this . texture = a , this . refreshTexture = ! 0 , this . cachedTint = 16777215 ) } , b . TilingSprite . prototype . _renderWebGL = function ( a ) { if ( this . visible !== ! 1 && 0 !== this . alpha ) { var c , d ; for ( this . _mask && ( a . spriteBatch . stop ( ) , a . maskManager . pushMask ( this . mask , a ) , a . spriteBatch . start ( ) ) , this . _filters && ( a . spriteBatch . flush ( ) , a . filterManager . pushFilter ( this . _filterBlock ) ) , ! this . tilingTexture || this . refreshTexture ? ( this . generateTilingTexture ( ! 0 ) , this . tilingTexture && this . tilingTexture . needsUpdate && ( b . updateWebGLTexture ( this . tilingTexture . baseTexture , a . gl ) , this . tilingTexture . needsUpdate = ! 1 ) ) : a . spriteBatch . renderTilingSprite ( this ) , c = 0 , d = this . children . length ; d > c ; c ++ ) this . children [ c ] . _renderWebGL ( a ) ; a . spriteBatc
} } ) , 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 . inflate ( a , c . x , c . y ) } , b . Rectangle . size = function ( a , c ) { return "undefined" == typeof c || null === c ? c = new b . Point ( a . width , a . height ) : c . setTo ( a . width , a . height ) , c } , b . Rectangle . clone = function ( a , c ) { return "undefined" == typeof c || null === c ? c = new b . Rectangle ( a . x , a . y , a . width , a . height ) : c . setTo ( a . x , a . y , a . width , a . height ) , c } , b . Rectangle . contains = function ( a , b , c ) { return a . width <= 0 || a . height <= 0 ? ! 1 : b >= a . x && b < a . right && c >= a . y && c < a . bottom } , b . Rectangle . containsRaw = function ( a , b , c , d , e , f ) { return e >= a && a + c > e && f >= b && b + d > f } , b . Rectangle . containsPoint = function ( a , c ) { return b . Rectangle . contains ( a , c . x , c . y ) } , b . Rectangle . containsRect = function ( a , b ) { return a . volume > b . volume ? ! 1 : a . x >= b . x && a . y >= b . y && a . right < b . right && a . bottom < b . bottom } , b . Rectangle . equals = function ( a , b ) { return a . x == b . x && a . y == b . y && a . width == b . width && a . height == b . height } , b . Rectangle . intersection = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Rectangle ) , b . Rectangle . intersects ( a , c ) && ( d . x = Math . max ( a . x , c . x ) , d . y = Math . max ( a . y , c . y ) , d . width = Math . min ( a . right , c . right ) - d . x , d . height = Math . min ( a . bottom , c . bottom ) - d . y ) , d } , b . Rectangle . intersects = function ( a , b ) { return a . width <= 0 || a . height <= 0 || b . width <= 0 || b . height <= 0 ? ! 1 : ! ( a . right < b . x || a . bottom < b . y || a . x > b . right || a . y > b . bottom ) } , b . Rectangle . intersectsRaw = function ( a , b , c , d , e , f ) { return "undefined" == typeof f && ( f = 0 ) , ! ( b > a . right + f || c < a . left - f || d > a . bottom + f || e < a . top - f ) } , b . Rectangle . union = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Rectangle ) , d . setTo ( Math . min ( a . x , c . x ) , Math . min ( a . y , c . y ) , Math . max ( a . right , c . right ) - Math . min ( a . left , c . left ) , Math . max ( a . bottom , c . bottom ) - Math . min ( a . top , c . top ) ) } , b . Rectangle . aabb = function ( a , c ) { "undefined" == typeof c && ( c = new b . Rectangle ) ; var d = Number . MIN _VALUE , e = Number . MAX _VALUE , f = Number . MIN _VALUE , g = Number . MAX _VALUE ; return a . forEach ( function ( a ) { a . x > d && ( d = a . x ) , a . x < e && ( e = a . x ) , a . y > f && ( f = a . y ) , a . y < g && ( g = a . y ) } ) , c . setTo ( e , g , d - e , f - g ) , c } , PIXI . Rectangle = b . Rectangle , PIXI . EmptyRectangle = new b . Rectangle ( 0 , 0 , 0 , 0 ) , b . Line = function ( a , c , d , e ) { a = a || 0 , c = c || 0 , d = d || 0 , e = e || 0 , this . start = new b . Point ( a , c ) , this . end = new b . Point ( d , e ) } , b . Line . prototype = { setTo : function ( a , b , c , d ) { return this . start . setTo ( a , b ) , this . end . setTo ( c , d ) , this } , fromSprite : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? this . setTo ( a . center . x , a . center . y , b . center . x , b . center . y ) : this . setTo ( a . x , a . y , b . x , b . y ) } , intersects : function ( a , c , d ) { return b . Line . intersectsPoints ( this . start , this . end , a . start , a . end , c , d ) } , pointOnLine : function ( a , b ) { return ( a - this . start . x ) * ( this . end . y - this . start . y ) === ( this . end . x - this . start . x ) * ( b - this . start . y ) } , pointOnSegment : function ( a , b ) { var c = Math . min ( this . start . x , this . end . x ) , d = Math . max ( this . start . x , this . end . x ) , e = Math . min ( this . start . y , this . end . y ) , f = Math . max ( this . start . y , this . end . y ) ; return this . pointOnLine ( a , b ) && a >= c && d >= a && b >= e && f >= b } , coordinatesOnLine : function ( a , b ) { "undefined" == typeof a && ( a = 1 ) , "undefined" == typeof b && ( b = [ ] ) ; var c = Math . round ( this . start . x ) , d = Math . round ( this . start . y ) , e = Math . round ( this . end . x ) , f = Math . round ( this . end . y ) , g = Math . abs ( e - c ) , h = Math . abs ( f - d ) , i = e > c ? 1 : - 1 , j = f > d ? 1 : - 1 , k = g - h ; b . push ( [ c , d ] ) ; for ( var l = 1 ; c != e || d != f ; ) { var m = k << 1 ; m > - h && ( k -= h , c += i ) , g > m && ( k += g , d += j ) , l % a === 0 && b . push ( [ c , d ] ) , l ++ } return b } , clone : function ( a ) { return "undefined" == typeof a || null === a ? a = new b . Line ( this . start . x , this . start . y , this . end . x , this . end . y ) : a . setTo ( this . start . x , this . start . y , this . end . x , this . end . y ) , a } } , Object . defineProperty ( b . Line . prototype , "length" , { get : function ( ) { return Math . sqrt ( ( this . end . x - this . start . x ) * ( this . end . x - this . start . x ) + ( this . end . y - this . start . y ) * ( this . end . y - this . start . y ) ) } } ) , Object . defineProperty ( b . Line . prototype , "angle" , { get : function ( ) { return Math . atan2 ( this . end . y - this . start . y , this . end . x - this . start . x ) } } ) , Object
} , getIndex : function ( a ) { return this . list . indexOf ( a ) } , exists : function ( a ) { return this . list . indexOf ( a ) > - 1 } , reset : function ( ) { this . list . length = 0 , this . total = 0 } , remove : function ( a ) { var b = this . list . indexOf ( a ) ; return b > - 1 ? ( this . list . splice ( b , 1 ) , this . total -- , a ) : void 0 } , setAll : function ( a , b ) { for ( var c = this . list . length ; c -- ; ) this . list [ c ] && this . list [ c ] [ a ] && ( this . list [ c ] [ a ] = b ) } , callAll : function ( a ) { for ( var b = Array . prototype . splice . call ( arguments , 1 ) , c = this . list . length ; c -- ; ) this . list [ c ] && this . list [ c ] [ a ] && this . list [ c ] [ a ] . apply ( this . list [ c ] , b ) } } , Object . defineProperty ( b . ArrayList . prototype , "first" , { get : function ( ) { return this . position = 0 , this . total > 0 ? this . list [ 0 ] : null } } ) , Object . defineProperty ( b . ArrayList . prototype , "next" , { get : function ( ) { return this . position < this . total ? ( this . position ++ , this . list [ this . position ] ) : null } } ) , b . ArrayList . prototype . constructor = b . ArrayList , b . Signal = function ( ) { this . _bindings = [ ] , this . _prevParams = null ; var a = this ; this . dispatch = function ( ) { b . Signal . prototype . dispatch . apply ( a , arguments ) } } , b . Signal . prototype = { memorize : ! 1 , _shouldPropagate : ! 0 , active : ! 0 , validateListener : function ( a , b ) { if ( "function" != typeof a ) throw new Error ( "Phaser.Signal: listener is a required param of {fn}() and should be a Function." . replace ( "{fn}" , b ) ) } , _registerListener : function ( a , c , d , e ) { var f , g = this . _indexOfListener ( a , d ) ; if ( - 1 !== g ) { if ( f = this . _bindings [ g ] , f . isOnce ( ) !== c ) throw new Error ( "You cannot add" + ( c ? "" : "Once" ) + "() then add" + ( c ? "Once" : "" ) + "() the same listener without removing the relationship first." ) } else f = new b . SignalBinding ( this , a , c , d , e ) , this . _addBinding ( f ) ; return this . memorize && this . _prevParams && f . execute ( this . _prevParams ) , f } , _addBinding : function ( a ) { var b = this . _bindings . length ; do b -- ; while ( this . _bindings [ b ] && a . _priority <= this . _bindings [ b ] . _priority ) ; this . _bindings . splice ( b + 1 , 0 , a ) } , _indexOfListener : function ( a , b ) { for ( var c , d = this . _bindings . length ; d -- ; ) if ( c = this . _bindings [ d ] , c . _listener === a && c . context === b ) return d ; return - 1 } , has : function ( a , b ) { return - 1 !== this . _indexOfListener ( a , b ) } , add : function ( a , b , c ) { return this . validateListener ( a , "add" ) , this . _registerListener ( a , ! 1 , b , c ) } , addOnce : function ( a , b , c ) { return this . validateListener ( a , "addOnce" ) , this . _registerListener ( a , ! 0 , b , c ) } , remove : function ( a , b ) { this . validateListener ( a , "remove" ) ; var c = this . _indexOfListener ( a , b ) ; return - 1 !== c && ( this . _bindings [ c ] . _destroy ( ) , this . _bindings . splice ( c , 1 ) ) , a } , removeAll : function ( a ) { "undefined" == typeof a && ( a = null ) ; for ( var b = this . _bindings . length ; b -- ; ) a ? this . _bindings [ b ] . context === a && ( this . _bindings [ b ] . _destroy ( ) , this . _bindings . splice ( b , 1 ) ) : this . _bindings [ b ] . _destroy ( ) ; a || ( this . _bindings . length = 0 ) } , getNumListeners : function ( ) { return this . _bindings . length } , halt : function ( ) { this . _shouldPropagate = ! 1 } , dispatch : function ( ) { if ( this . active ) { var a , b = Array . prototype . slice . call ( arguments ) , c = this . _bindings . length ; if ( this . memorize && ( this . _prevParams = b ) , c ) { a = this . _bindings . slice ( ) , this . _shouldPropagate = ! 0 ; do c -- ; while ( a [ c ] && this . _shouldPropagate && a [ c ] . execute ( b ) !== ! 1 ) } } } , forget : function ( ) { this . _prevParams = null } , dispose : function ( ) { this . removeAll ( ) , delete this . _bindings , delete this . _prevParams } , toString : function ( ) { return "[Phaser.Signal active:" + this . active + " numListeners:" + this . getNumListeners ( ) + "]" } } , b . Signal . prototype . constructor = b . Signal , b . SignalBinding = function ( a , b , c , d , e ) { this . _listener = b , this . _isOnce = c , this . context = d , this . _signal = a , this . _priority = e || 0 } , b . SignalBinding . prototype = { active : ! 0 , params : null , execute : function ( a ) { var b , c ; return this . active && this . _listener && ( c = this . params ? this . params . concat ( a ) : a , b = this . _listener . apply ( this . context , c ) , this . _isOnce && this . detach ( ) ) , b } , detach : function ( ) { return this . isBound ( ) ? this . _signal . remove ( this . _listener , this . context ) : null } , isBound : function ( ) { return ! ! this . _signal && ! ! this . _listener } , isOnce : function ( ) { return this . _isOnce } , getListener : function ( ) { return this . _listener } , getSignal : function ( ) { return this . _signal } , _destroy : function ( ) { delete this . _signal , delete this . _listener , delete this . context } , toString : function ( ) { return "[Phaser.SignalBinding isOnce:" + this . _isOnce + ", isBound:" + this . isBound ( ) + ", active:" + this . active + "]" } } , b . SignalBinding . prototype . constructor = b . SignalB
2014-10-22 20:42:03 +00:00
} , b . ScaleManager . EXACT _FIT = 0 , b . ScaleManager . NO _SCALE = 1 , b . ScaleManager . SHOW _ALL = 2 , b . ScaleManager . RESIZE = 3 , b . ScaleManager . prototype = { parseConfig : function ( a ) { a . scaleMode && ( this . scaleMode = a . scaleMode ) , a . fullScreenScaleMode && ( this . fullScreenScaleMode = a . fullScreenScaleMode ) , a . fullScreenTarget && ( this . fullScreenTarget = a . fullScreenTarget ) } , setupScale : function ( a , c ) { var d , e = new b . Rectangle ; "" !== this . game . parent && ( "string" == typeof this . game . parent ? d = document . getElementById ( this . game . parent ) : "object" == typeof this . game . parent && 1 === this . game . parent . nodeType && ( d = this . game . parent ) ) , d ? ( this . parentNode = d , this . parentIsWindow = ! 1 , this . _parentBounds = this . parentNode . getBoundingClientRect ( ) , e . width = this . _parentBounds . width , e . height = this . _parentBounds . height , this . offset . set ( this . _parentBounds . left , this . _parentBounds . top ) ) : ( this . parentNode = null , this . parentIsWindow = ! 0 , e . width = window . innerWidth , e . height = window . innerHeight ) ; var f = 0 , g = 0 ; "number" == typeof a ? f = a : ( this . parentScaleFactor . x = parseInt ( a , 10 ) / 100 , f = e . width * this . parentScaleFactor . x ) , "number" == typeof c ? g = c : ( this . parentScaleFactor . y = parseInt ( c , 10 ) / 100 , g = e . height * this . parentScaleFactor . y ) , this . grid = new b . FlexGrid ( this , f , g ) , this . updateDimensions ( f , g , ! 1 ) } , boot : function ( ) { this . fullScreenTarget = this . game . canvas ; var a = this ; this . _checkOrientation = function ( b ) { return a . checkOrientation ( b ) } , this . _checkResize = function ( b ) { return a . checkResize ( b ) } , this . _fullScreenChange = function ( b ) { return a . fullScreenChange ( b ) } , window . addEventListener ( "orientationchange" , this . _checkOrientation , ! 1 ) , window . addEventListener ( "resize" , this . _checkResize , ! 1 ) , this . game . device . cocoonJS || ( document . addEventListener ( "webkitfullscreenchange" , this . _fullScreenChange , ! 1 ) , document . addEventListener ( "mozfullscreenchange" , this . _fullScreenChange , ! 1 ) , document . addEventListener ( "fullscreenchange" , this . _fullScreenChange , ! 1 ) ) , this . updateDimensions ( this . width , this . height , ! 0 ) , b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . bounds . setTo ( this . offset . x , this . offset . y , this . width , this . height ) } , setResizeCallback : function ( a , b ) { this . onResize = a , this . onResizeContext = b } , setMinMax : function ( a , b , c , d ) { this . minWidth = a , this . minHeight = b , "undefined" != typeof c && ( this . maxWidth = c ) , "undefined" != typeof d && ( this . maxHeight = d ) } , preUpdate : function ( ) { this . game . time . now < this . _nextParentCheck || ( this . parentIsWindow || ( b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . _scaleMode === b . ScaleManager . RESIZE && ( this . _parentBounds = this . parentNode . getBoundingClientRect ( ) , ( this . _parentBounds . width !== this . width || this . _parentBounds . height !== this . height ) && this . updateDimensions ( this . _parentBounds . width , this . _parentBounds . height , ! 0 ) ) ) , this . _nextParentCheck = this . game . time . now + this . trackParentInterval ) } , updateDimensions : function ( a , b , c ) { this . width = a * this . parentScaleFactor . x , this . height = b * this . parentScaleFactor . y , this . game . width = this . width , this . game . height = this . height , this . sourceAspectRatio = this . width / this . height , this . bounds . width = this . width , this . bounds . height = this . height , c && ( this . game . renderer . resize ( this . width , this . height ) , this . game . camera . setSize ( this . width , this . height ) , this . game . world . resize ( this . width , this . height ) ) , this . grid . onResize ( a , b ) , this . onResize && this . onResize . call ( this . onResizeContext , this . width , this . height ) , this . game . state . resize ( a , b ) } , forceOrientation : function ( a , b ) { "undefined" == typeof b && ( b = ! 1 ) , this . forceLandscape = a , this . forcePortrait = b } , checkOrientationState : function ( ) { this . incorrectOrientation ? ( this . forceLandscape && window . innerWidth > window . innerHeight || this . forcePortrait && window . innerHeight > window . innerWidth ) && ( this . incorrectOrientation = ! 1 , this . leaveIncorrectOrientation . dispatch ( ) , this . scaleMode !== b . ScaleManager . NO _SCALE && this . refresh ( ) ) : ( this . forceLandscape && window . innerWidth < window . innerHeight || this . forcePortrait && window . innerHeight < window . innerWidth ) && ( this . incorrectOrientation = ! 0 , this . enterIncorrectOrientation . dispatch ( ) , this . scaleMode !== b . ScaleManager . NO _SCALE && this . refresh ( ) ) } , checkOrientation : function ( a ) { this . event = a , this . orientation = window . orientation , this . isLandscape ? this . enterLandscape . dispatch ( this . orientation , ! 0 , ! 1 ) : this . enterPortrait . dispatch ( this . orientation , ! 1 , ! 0 ) ,
} , b . Mouse . NO _BUTTON = - 1 , b . Mouse . LEFT _BUTTON = 0 , b . Mouse . MIDDLE _BUTTON = 1 , b . Mouse . RIGHT _BUTTON = 2 , b . Mouse . WHEEL _UP = 1 , b . Mouse . WHEEL _DOWN = - 1 , b . Mouse . prototype = { start : function ( ) { if ( ( ! this . game . device . android || this . game . device . chrome !== ! 1 ) && null === this . _onMouseDown ) { var a = this ; this . _onMouseDown = function ( b ) { return a . onMouseDown ( b ) } , this . _onMouseMove = function ( b ) { return a . onMouseMove ( b ) } , this . _onMouseUp = function ( b ) { return a . onMouseUp ( b ) } , this . _onMouseUpGlobal = function ( b ) { return a . onMouseUpGlobal ( b ) } , this . _onMouseOut = function ( b ) { return a . onMouseOut ( b ) } , this . _onMouseOver = function ( b ) { return a . onMouseOver ( b ) } , this . _onMouseWheel = function ( b ) { return a . onMouseWheel ( b ) } , this . game . canvas . addEventListener ( "mousedown" , this . _onMouseDown , ! 0 ) , this . game . canvas . addEventListener ( "mousemove" , this . _onMouseMove , ! 0 ) , this . game . canvas . addEventListener ( "mouseup" , this . _onMouseUp , ! 0 ) , this . game . device . cocoonJS || ( window . addEventListener ( "mouseup" , this . _onMouseUpGlobal , ! 0 ) , this . game . canvas . addEventListener ( "mouseover" , this . _onMouseOver , ! 0 ) , this . game . canvas . addEventListener ( "mouseout" , this . _onMouseOut , ! 0 ) , this . game . canvas . addEventListener ( "mousewheel" , this . _onMouseWheel , ! 0 ) , this . game . canvas . addEventListener ( "DOMMouseScroll" , this . _onMouseWheel , ! 0 ) ) } } , onMouseDown : function ( a ) { this . event = a , this . capture && a . preventDefault ( ) , this . button = a . button , this . mouseDownCallback && this . mouseDownCallback . call ( this . callbackContext , a ) , this . game . input . disabled || this . disabled || ( a . identifier = 0 , this . game . input . mousePointer . start ( a ) ) } , onMouseMove : function ( a ) { this . event = a , this . capture && a . preventDefault ( ) , this . mouseMoveCallback && this . mouseMoveCallback . call ( this . callbackContext , a ) , this . game . input . disabled || this . disabled || ( a . identifier = 0 , this . game . input . mousePointer . move ( a ) ) } , onMouseUp : function ( a ) { this . event = a , this . capture && a . preventDefault ( ) , this . button = b . Mouse . NO _BUTTON , this . mouseUpCallback && this . mouseUpCallback . call ( this . callbackContext , a ) , this . game . input . disabled || this . disabled || ( a . identifier = 0 , this . game . input . mousePointer . stop ( a ) ) } , onMouseUpGlobal : function ( a ) { this . game . input . mousePointer . withinGame || ( this . button = b . Mouse . NO _BUTTON , this . mouseUpCallback && this . mouseUpCallback . call ( this . callbackContext , a ) , a . identifier = 0 , this . game . input . mousePointer . stop ( a ) ) } , onMouseOut : function ( a ) { this . event = a , this . capture && a . preventDefault ( ) , this . game . input . mousePointer . withinGame = ! 1 , this . mouseOutCallback && this . mouseOutCallback . call ( this . callbackContext , a ) , this . game . input . disabled || this . disabled || this . stopOnGameOut && ( a . identifier = 0 , this . game . input . mousePointer . stop ( a ) ) } , onMouseWheel : function ( a ) { this . event = a , this . capture && a . preventDefault ( ) , this . wheelDelta = Math . max ( - 1 , Math . min ( 1 , a . wheelDelta || - a . detail ) ) , this . mouseWheelCallback && this . mouseWheelCallback . call ( this . callbackContext , a ) } , onMouseOver : function ( a ) { this . event = a , this . capture && a . preventDefault ( ) , this . game . input . mousePointer . withinGame = ! 0 , this . mouseOverCallback && this . mouseOverCallback . call ( this . callbackContext , a ) , this . game . input . disabled || this . disabled } , requestPointerLock : function ( ) { if ( this . game . device . pointerLock ) { var a = this . game . canvas ; a . requestPointerLock = a . requestPointerLock || a . mozRequestPointerLock || a . webkitRequestPointerLock , a . requestPointerLock ( ) ; var b = this ; this . _pointerLockChange = function ( a ) { return b . pointerLockChange ( a ) } , document . addEventListener ( "pointerlockchange" , this . _pointerLockChange , ! 0 ) , document . addEventListener ( "mozpointerlockchange" , this . _pointerLockChange , ! 0 ) , document . addEventListener ( "webkitpointerlockchange" , this . _pointerLockChange , ! 0 ) } } , pointerLockChange : function ( a ) { var b = this . game . canvas ; document . pointerLockElement === b || document . mozPointerLockElement === b || document . webkitPointerLockElement === b ? ( this . locked = ! 0 , this . pointerLock . dispatch ( ! 0 , a ) ) : ( this . locked = ! 1 , this . pointerLock . dispatch ( ! 1 , a ) ) } , releasePointerLock : function ( ) { document . exitPointerLock = document . exitPointerLock || document . mozExitPointerLock || document . webkitExitPointerLock , document . exitPointerLock ( ) , document . removeEventListener ( "pointerlockchange" , this . _pointerLockChange , ! 0 ) , document . removeEventListener ( "mozpointerlockchange" , this . _pointerLockChange , ! 0 ) , document . removeEventListe
for ( var a = 0 ; 10 > a ; a ++ ) this . _pointerData [ a ] = { id : a , x : 0 , y : 0 , isDown : ! 1 , isUp : ! 1 , isOver : ! 1 , isOut : ! 1 , timeOver : 0 , timeOut : 0 , timeDown : 0 , timeUp : 0 , downDuration : 0 , isDragged : ! 1 } } , stop : function ( ) { this . enabled !== ! 1 && ( this . enabled = ! 1 , this . game . input . interactiveItems . remove ( this ) ) } , destroy : function ( ) { this . sprite && ( this . _setHandCursor && ( this . game . canvas . style . cursor = "default" , this . _setHandCursor = ! 1 ) , this . enabled = ! 1 , this . game . input . interactiveItems . remove ( this ) , this . _pointerData . length = 0 , this . boundsRect = null , this . boundsSprite = null , this . sprite = null ) } , validForInput : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 0 ) , 0 === this . sprite . scale . x || 0 === this . sprite . scale . y || this . priorityID < this . game . input . minPriorityID ? ! 1 : ( c || ! this . pixelPerfectClick && ! this . pixelPerfectOver ) && ( this . priorityID > a || this . priorityID === a && this . sprite . _cache [ 3 ] < b ) ? ! 0 : ! 1 } , isPixelPerfect : function ( ) { return this . pixelPerfectClick || this . pixelPerfectOver } , pointerX : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . x } , pointerY : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . y } , pointerDown : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . isDown } , pointerUp : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . isUp } , pointerTimeDown : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . timeDown } , pointerTimeUp : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . timeUp } , pointerOver : function ( a ) { if ( this . enabled ) { if ( "undefined" != typeof a ) return this . _pointerData [ a ] . isOver ; for ( var b = 0 ; 10 > b ; b ++ ) if ( this . _pointerData [ b ] . isOver ) return ! 0 } return ! 1 } , pointerOut : function ( a ) { if ( this . enabled ) { if ( "undefined" != typeof a ) return this . _pointerData [ a ] . isOut ; for ( var b = 0 ; 10 > b ; b ++ ) if ( this . _pointerData [ b ] . isOut ) return ! 0 } return ! 1 } , pointerTimeOver : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . timeOver } , pointerTimeOut : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . timeOut } , pointerDragged : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . isDragged } , checkPointerDown : function ( a , b ) { return a . isDown && this . enabled && this . sprite && this . sprite . parent && this . sprite . visible && this . sprite . parent . visible && this . game . input . hitTest ( this . sprite , a , this . _tempPoint ) ? ( "undefined" == typeof b && ( b = ! 1 ) , ! b && this . pixelPerfectClick ? this . checkPixel ( this . _tempPoint . x , this . _tempPoint . y ) : ! 0 ) : ! 1 } , checkPointerOver : function ( a , b ) { return this . enabled && this . sprite && this . sprite . parent && this . sprite . visible && this . sprite . parent . visible && this . game . input . hitTest ( this . sprite , a , this . _tempPoint ) ? ( "undefined" == typeof b && ( b = ! 1 ) , ! b && this . pixelPerfectOver ? this . checkPixel ( this . _tempPoint . x , this . _tempPoint . y ) : ! 0 ) : ! 1 } , checkPixel : function ( a , b , c ) { if ( this . sprite . texture . baseTexture . source ) { if ( null === a && null === b ) { this . game . input . getLocalPosition ( this . sprite , c , this . _tempPoint ) ; var a = this . _tempPoint . x , b = this . _tempPoint . y } if ( 0 !== this . sprite . anchor . x && ( a -= - this . sprite . texture . frame . width * this . sprite . anchor . x ) , 0 !== this . sprite . anchor . y && ( b -= - this . sprite . texture . frame . height * this . sprite . anchor . y ) , a += this . sprite . texture . frame . x , b += this . sprite . texture . frame . y , this . sprite . texture . trim && ( a -= this . sprite . texture . trim . x , b -= this . sprite . texture . trim . y , a < this . sprite . texture . crop . x || a > this . sprite . texture . crop . right || b < this . sprite . texture . crop . y || b > this . sprite . texture . crop . bottom ) ) return this . _dx = a , this . _dy = b , ! 1 ; this . _dx = a , this . _dy = b , this . game . input . hitContext . clearRect ( 0 , 0 , 1 , 1 ) , this . game . input . hitContext . drawImage ( this . sprite . texture . baseTexture . source , a , b , 1 , 1 , 0 , 0 , 1 , 1 ) ; var d = this . game . input . hitContext . getImageData ( 0 , 0 , 1 , 1 ) ; if ( d . data [ 3 ] >= this . pixelPerfectAlpha ) return ! 0 } return ! 1 } , update : function ( a ) { return null !== this . sprite && void 0 !== this . sprite . parent ? this . enabled && this . sprite . visible && this . sprite . parent . visible ? this . draggable && this . _draggedPointerID === a . id ? this . updateDrag ( a ) : this . _pointerData [ a . id ] . isOver ? this . checkPointerOver ( a ) ? ( this . _pointerData [ a . id ] . x = a . x - this . sprite . x , this . _pointerData [ a . id ] . y = a . y - this . sprite . y , ! 0 ) : ( this . _pointerOutHandler ( a ) , ! 1 ) : void 0 : ( this . _pointerOutHandler ( a ) , ! 1 ) : void 0 } , _pointerOverHandler : function ( a ) { null !== this . sprite && ( this . _pointerData [ a . id ] . isOver === ! 1 || a . dirty ) && ( this . _pointerData [ a . id ] . isOver = ! 0 , this . _pointerData [ a . id ] . isOut = ! 1 , this . _pointerData [ a . id ] . timeOver = this . game . time . now , this . _poi
} , b . BitmapData . prototype . constructor = b . BitmapData , b . Sprite = function ( a , c , d , e , f ) { c = c || 0 , d = d || 0 , e = e || null , f = f || null , this . game = a , this . name = "" , this . type = b . SPRITE , 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 . autoCull = ! 1 , this . input = null , this . body = null , this . alive = ! 0 , this . health = 1 , this . lifespan = 0 , this . checkWorldBounds = ! 1 , this . outOfBoundsKill = ! 1 , this . debug = ! 1 , this . cameraOffset = new b . Point , this . cropRect = null , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ] , this . _crop = null , this . _frame = null , this . _bounds = new b . Rectangle , this . loadTexture ( e , f ) } , b . Sprite . prototype = Object . create ( PIXI . Sprite . prototype ) , b . Sprite . prototype . constructor = b . Sprite , b . Sprite . prototype . preUpdate = function ( ) { if ( 1 === this . _cache [ 4 ] && this . exists ) return this . world . setTo ( this . parent . position . x + this . position . x , this . parent . position . y + this . position . y ) , this . worldTransform . tx = this . world . x , this . worldTransform . ty = this . world . y , this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , this . body && this . body . preUpdate ( ) , this . _cache [ 4 ] = 0 , ! 1 ; 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 ; if ( this . lifespan > 0 && ( this . lifespan -= this . game . time . elapsed , this . lifespan <= 0 ) ) return this . kill ( ) , ! 1 ; if ( ( this . autoCull || this . checkWorldBounds ) && this . _bounds . copyFrom ( this . getBounds ( ) ) , this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . _bounds ) ) , this . checkWorldBounds ) if ( 1 === this . _cache [ 5 ] && this . game . world . bounds . intersects ( this . _bounds ) ) this . _cache [ 5 ] = 0 , this . events . onEnterBounds . dispatch ( this ) ; else if ( 0 === this . _cache [ 5 ] && ! this . game . world . bounds . intersects ( this . _bounds ) && ( this . _cache [ 5 ] = 1 , this . events . onOutOfBounds . dispatch ( this ) , this . outOfBoundsKill ) ) return this . kill ( ) , ! 1 ; 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 ++ ) , this . animations . update ( ) , this . body && this . body . preUpdate ( ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . Sprite . prototype . update = function ( ) { } , b . Sprite . prototype . postUpdate = function ( ) { this . key instanceof b . BitmapData && this . key . render ( ) , this . exists && this . body && this . body . postUpdate ( ) , 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 . Sprite . prototype . loadTexture = function ( a , c , d ) { c = c || 0 , ( d || "undefined" == typeof d ) && this . animations . stop ( ) , this . key = a ; var e = ! 0 , f = this . smoothed ; a instanceof b . RenderTexture ? ( this . key = a . key , this . setTexture ( a ) ) : a instanceof b . BitmapData ? ( this . setTexture ( a . texture ) , this . game . cache . getFrameData ( a . key , b . Cache . BITMAPDATA ) && ( e = ! this . animations . loadFrameData ( this . game . cache . getFrameData ( a . key , b . Cache . BITMAPDATA ) , c ) ) ) : 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 ] ) ) , e = ! 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 ] ) ) , this . texture . baseTexture . dirty ( ) , e && ( this . _frame = b . Rectangle . clone ( this . texture . frame ) ) , f || ( this . smoothed = ! 1 ) } , b . Sprite . 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
2014-10-23 15:03:29 +00:00
return j } } ) , Object . defineProperty ( b . Rope . prototype , "destroyPhase" , { get : function ( ) { return ! ! this . _cache [ 8 ] } } ) , b . Text = function ( a , c , d , e , f ) { c = c || 0 , d = d || 0 , e = e || " " , f = f || { } , e = 0 === e . length ? " " : e . toString ( ) , this . game = a , this . exists = ! 0 , this . name = "" , this . type = b . TEXT , this . z = 0 , this . world = new b . Point ( c , d ) , this . _text = e , this . _font = "" , this . _fontSize = 32 , this . _fontWeight = "normal" , this . _lineSpacing = 0 , this . _charCount = 0 , this . events = new b . Events ( this ) , this . input = null , this . cameraOffset = new b . Point , this . colors = [ ] , this . setStyle ( f ) , PIXI . Text . call ( this , e , this . style ) , this . position . set ( c , d ) , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 ] , " " !== e && this . updateText ( ) } , b . Text . prototype = Object . create ( PIXI . Text . prototype ) , b . Text . prototype . constructor = b . Text , b . Text . 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 . renderOrderID = - 1 , ! 1 ; this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . getBounds ( ) ) ) , 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 . Text . prototype . update = function ( ) { } , b . Text . 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 ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . postUpdate ( ) } , b . Text . prototype . destroy = function ( a ) { if ( null !== this . game && ! this . destroyPhase ) { "undefined" == typeof a && ( a = ! 0 ) , this . _cache [ 8 ] = 1 , this . events && this . events . onDestroy . dispatch ( this ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) , this . texture . destroy ( ! 0 ) , this . canvas . parentNode ? this . canvas . parentNode . removeChild ( this . canvas ) : ( this . canvas = null , this . context = null ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; 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 } } , b . Text . prototype . setShadow = function ( a , b , c , d ) { this . style . shadowOffsetX = a || 0 , this . style . shadowOffsetY = b || 0 , this . style . shadowColor = c || "rgba(0,0,0,0)" , this . style . shadowBlur = d || 0 , this . dirty = ! 0 } , b . Text . prototype . setStyle = function ( a ) { a = a || { } , a . font = a . font || "bold 20pt Arial" , a . fill = a . fill || "black" , a . align = a . align || "left" , a . stroke = a . stroke || "black" , a . strokeThickness = a . strokeThickness || 0 , a . wordWrap = a . wordWrap || ! 1 , a . wordWrapWidth = a . wordWrapWidth || 100 , a . shadowOffsetX = a . shadowOffsetX || 0 , a . shadowOffsetY = a . shadowOffsetY || 0 , a . shadowColor = a . shadowColor || "rgba(0,0,0,0)" , a . shadowBlur = a . shadowBlur || 0 , this . style = a , this . dirty = ! 0 } , b . Text . prototype . updateText = function ( ) { this . texture . baseTexture . resolution = this . resolution , this . context . font = this . style . font ; var a = this . text ; this . style . wordWrap && ( a = this . runWordWrap ( this . text ) ) ; for ( var b = a . split ( /(?:\r\n|\r|\n)/ ) , c = [ ] , d = 0 , e = this . determineFontProperties ( this . style . font ) , f = 0 ; f < b . length ; f ++ ) { var g = this . context . measureText ( b [ f ] ) . width ; c [ f ] = g , d = Math . max ( d , g ) } var h = d + this . style . strokeThickness ; this . canvas . width = ( h + this . context . lineWidth ) * this . resolution ; var i = e . fontSize + this . style . strokeThickness , j = i * b . length ; this . canvas . height = j * this . resolution , this . context . scale ( this . resolution , this . resolution ) , navigator . isCocoonJS && this . context . clearRect ( 0 , 0 , this . canvas . width , this . canvas . height ) , this . context . fillStyle = this . style . fill , this . context . font = this . style . font , this . context . strokeStyle = this . style . stroke , this . context . textBaseline = "alphabetic" , this . context . shadowOffsetX = this . style . shadowOffsetX , this . context . shadowOffsetY = this . style . shadowOffsetY , this . context . shadowColor = this . style . shadowColor , this . context . shadowBlur = this . style . shadowBlur , this . context . lineWidth = this . style . strokeThickness , this . context . lineCap = "round" , this . context . lineJoin = "round" ; var k , l ; for ( this . _charCount = 0 , f = 0 ; f < b . length ; f ++ ) k = this . style . strokeThickness / 2 , l = thi
2014-10-22 22:53:32 +00:00
} , _checkFeatures : function ( ) { this . canvas = ! ! window . CanvasRenderingContext2D || this . cocoonJS ; try { this . localStorage = ! ! localStorage . getItem } catch ( a ) { this . localStorage = ! 1 } this . file = ! ! ( window . File && window . FileReader && window . FileList && window . Blob ) , this . fileSystem = ! ! window . requestFileSystem , this . webGL = function ( ) { try { var a = document . createElement ( "canvas" ) ; return a . screencanvas = ! 1 , ! ! window . WebGLRenderingContext && ( a . getContext ( "webgl" ) || a . getContext ( "experimental-webgl" ) ) } catch ( b ) { return ! 1 } } ( ) , this . webGL = null === this . webGL || this . webGL === ! 1 ? ! 1 : ! 0 , this . worker = ! ! window . Worker , ( "ontouchstart" in document . documentElement || window . navigator . maxTouchPoints && window . navigator . maxTouchPoints > 1 ) && ( this . touch = ! 0 ) , ( window . navigator . msPointerEnabled || window . navigator . pointerEnabled ) && ( this . mspointer = ! 0 ) , this . pointerLock = "pointerLockElement" in document || "mozPointerLockElement" in document || "webkitPointerLockElement" in document , this . quirksMode = "CSS1Compat" === document . compatMode ? ! 1 : ! 0 , this . getUserMedia = ! ! ( navigator . getUserMedia || navigator . webkitGetUserMedia || navigator . mozGetUserMedia || navigator . msGetUserMedia ) } , checkFullScreenSupport : function ( ) { for ( var a = [ "requestFullscreen" , "requestFullScreen" , "webkitRequestFullscreen" , "webkitRequestFullScreen" , "msRequestFullscreen" , "msRequestFullScreen" , "mozRequestFullScreen" , "mozRequestFullscreen" ] , b = 0 ; b < a . length ; b ++ ) if ( this . game . canvas [ a [ b ] ] ) { this . fullscreen = ! 0 , this . requestFullscreen = a [ b ] ; break } var c = [ "cancelFullScreen" , "exitFullscreen" , "webkitCancelFullScreen" , "webkitExitFullscreen" , "msCancelFullScreen" , "msExitFullscreen" , "mozCancelFullScreen" , "mozExitFullscreen" ] ; if ( this . fullscreen ) for ( var b = 0 ; b < c . length ; b ++ ) if ( document [ c [ b ] ] ) { this . cancelFullscreen = c [ b ] ; break } window . Element && Element . ALLOW _KEYBOARD _INPUT && ( this . fullscreenKeyboard = ! 0 ) } , _checkBrowser : function ( ) { var a = navigator . userAgent ; if ( /Arora/ . test ( a ) ? this . arora = ! 0 : /Chrome/ . test ( a ) ? this . chrome = ! 0 : /Epiphany/ . test ( a ) ? this . epiphany = ! 0 : /Firefox/ . test ( a ) ? this . firefox = ! 0 : /AppleWebKit/ . test ( a ) && this . iOS ? this . mobileSafari = ! 0 : /MSIE (\d+\.\d+);/ . test ( a ) ? ( this . ie = ! 0 , this . ieVersion = parseInt ( RegExp . $1 , 10 ) ) : /Midori/ . test ( a ) ? this . midori = ! 0 : /Opera/ . test ( a ) ? this . opera = ! 0 : /Safari/ . test ( a ) ? this . safari = ! 0 : /Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/ . test ( a ) && ( this . ie = ! 0 , this . trident = ! 0 , this . tridentVersion = parseInt ( RegExp . $1 , 10 ) , this . ieVersion = parseInt ( RegExp . $3 , 10 ) ) , /Silk/ . test ( a ) && ( this . silk = ! 0 ) , navigator . standalone && ( this . webApp = ! 0 ) , "undefined" != typeof window . cordova && ( this . cordova = ! 0 ) , "undefined" != typeof process && "undefined" != typeof require && ( this . node = ! 0 ) , this . node ) try { this . nodeWebkit = "undefined" != typeof require ( "nw.gui" ) } catch ( b ) { this . nodeWebkit = ! 1 } if ( navigator . isCocoonJS && ( this . cocoonJS = ! 0 ) , this . cocoonJS ) try { this . cocoonJSApp = "undefined" != typeof CocoonJS } catch ( b ) { this . cocoonJSApp = ! 1 } "undefined" != typeof window . ejecta && ( this . ejecta = ! 0 ) , /Crosswalk/ . test ( a ) && ( this . crosswalk = ! 0 ) } , _checkAudio : function ( ) { this . audioData = ! ! window . Audio , this . webAudio = ! ( ! window . webkitAudioContext && ! window . AudioContext ) ; var a = document . createElement ( "audio" ) , b = ! 1 ; try { ( b = ! ! a . canPlayType ) && ( a . canPlayType ( 'audio/ogg; codecs="vorbis"' ) . replace ( /^no$/ , "" ) && ( this . ogg = ! 0 ) , ( a . canPlayType ( 'audio/ogg; codecs="opus"' ) . replace ( /^no$/ , "" ) || a . canPlayType ( "audio/opus;" ) . replace ( /^no$/ , "" ) ) && ( this . opus = ! 0 ) , a . canPlayType ( "audio/mpeg;" ) . replace ( /^no$/ , "" ) && ( this . mp3 = ! 0 ) , a . canPlayType ( 'audio/wav; codecs="1"' ) . replace ( /^no$/ , "" ) && ( this . wav = ! 0 ) , ( a . canPlayType ( "audio/x-m4a;" ) || a . canPlayType ( "audio/aac;" ) . replace ( /^no$/ , "" ) ) && ( this . m4a = ! 0 ) , a . canPlayType ( 'audio/webm; codecs="vorbis"' ) . replace ( /^no$/ , "" ) && ( this . webm = ! 0 ) ) } catch ( c ) { } } , _checkDevice : function ( ) { this . pixelRatio = window . devicePixelRatio || 1 , this . iPhone = - 1 != navigator . userAgent . toLowerCase ( ) . indexOf ( "iphone" ) , this . iPhone4 = 2 == this . pixelRatio && this . iPhone , this . iPad = - 1 != navigator . userAgent . toLowerCase ( ) . indexOf ( "ipad" ) , this . typedArray = "undefined" != typeof Int8Array ? ! 0 : ! 1 , "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array && "undefined" != typeof Uint32Array && ( this . littleEndian = this . _checkIsLittleEndian ( ) , b . Device . LITTLE _ENDIAN = this . littleEndian ) , this . support32bit = "undefined" !=
this . _len = this . events . length , this . _i = 0 } , update : function ( a ) { if ( this . paused ) return ! 0 ; if ( this . elapsed = a - this . _now , this . _now = a , this . elapsed > this . timeCap && this . adjustEvents ( a - this . elapsed ) , this . _marked = 0 , this . clearPendingEvents ( ) , this . running && this . _now >= this . nextTick && this . _len > 0 ) { for ( ; this . _i < this . _len && this . running && this . _now >= this . events [ this . _i ] . tick ; ) this . _newTick = this . _now + this . events [ this . _i ] . delay - ( this . _now - this . events [ this . _i ] . tick ) , this . _newTick < 0 && ( this . _newTick = this . _now + this . events [ this . _i ] . delay ) , this . events [ this . _i ] . loop === ! 0 ? ( this . events [ this . _i ] . tick = this . _newTick , this . events [ this . _i ] . callback . apply ( this . events [ this . _i ] . callbackContext , this . events [ this . _i ] . args ) ) : this . events [ this . _i ] . repeatCount > 0 ? ( this . events [ this . _i ] . repeatCount -- , this . events [ this . _i ] . tick = this . _newTick , this . events [ this . _i ] . callback . apply ( this . events [ this . _i ] . callbackContext , this . events [ this . _i ] . args ) ) : ( this . _marked ++ , this . events [ this . _i ] . pendingDelete = ! 0 , this . events [ this . _i ] . callback . apply ( this . events [ this . _i ] . callbackContext , this . events [ this . _i ] . args ) ) , this . _i ++ ; this . events . length > this . _marked ? this . order ( ) : ( this . expired = ! 0 , this . onComplete . dispatch ( this ) ) } return this . expired && this . autoDestroy ? ! 1 : ! 0 } , pause : function ( ) { this . running && ( this . _codePaused = ! 0 , this . paused || ( this . _pauseStarted = this . game . time . now , this . paused = ! 0 ) ) } , _pause : function ( ) { ! this . paused && this . running && ( this . _pauseStarted = this . game . time . now , this . paused = ! 0 ) } , adjustEvents : function ( a ) { for ( var b = 0 ; b < this . events . length ; b ++ ) if ( ! this . events [ b ] . pendingDelete ) { var c = this . events [ b ] . tick - a ; 0 > c && ( c = 0 ) , this . events [ b ] . tick = this . _now + c } var d = this . nextTick - a ; this . nextTick = 0 > d ? this . _now : this . _now + d } , resume : function ( ) { if ( this . paused ) { var a = this . game . time . now ; this . _pauseTotal += a - this . _now , this . _now = a , this . adjustEvents ( this . _pauseStarted ) , this . paused = ! 1 , this . _codePaused = ! 1 } } , _resume : function ( ) { this . _codePaused || this . resume ( ) } , removeAll : function ( ) { this . onComplete . removeAll ( ) , this . events . length = 0 , this . _len = 0 , this . _i = 0 } , destroy : function ( ) { this . onComplete . removeAll ( ) , this . running = ! 1 , this . events = [ ] , this . _len = 0 , this . _i = 0 } } , Object . defineProperty ( b . Timer . prototype , "next" , { get : function ( ) { return this . nextTick } } ) , Object . defineProperty ( b . Timer . prototype , "duration" , { get : function ( ) { return this . running && this . nextTick > this . _now ? this . nextTick - this . _now : 0 } } ) , Object . defineProperty ( b . Timer . prototype , "length" , { get : function ( ) { return this . events . length } } ) , Object . defineProperty ( b . Timer . prototype , "ms" , { get : function ( ) { return this . running ? this . _now - this . _started - this . _pauseTotal : 0 } } ) , Object . defineProperty ( b . Timer . prototype , "seconds" , { get : function ( ) { return this . running ? . 001 * this . ms : 0 } } ) , b . Timer . prototype . constructor = b . Timer , b . TimerEvent = function ( a , b , c , d , e , f , g , h ) { this . timer = a , this . delay = b , this . tick = c , this . repeatCount = d - 1 , this . loop = e , this . callback = f , this . callbackContext = g , this . args = h , this . pendingDelete = ! 1 } , b . TimerEvent . prototype . constructor = b . TimerEvent , b . AnimationManager = function ( a ) { this . sprite = a , this . game = a . game , this . currentFrame = null , this . currentAnim = null , this . updateIfVisible = ! 0 , this . isLoaded = ! 1 , this . _frameData = null , this . _anims = { } , this . _outputFrames = [ ] } , b . AnimationManager . prototype = { loadFrameData : function ( a , b ) { if ( "undefined" == typeof a ) return ! 1 ; if ( this . isLoaded ) for ( var c in this . _anims ) this . _anims [ c ] . updateFrameData ( a ) ; return this . _frameData = a , "undefined" == typeof b || null === b ? this . frame = 0 : "string" == typeof b ? this . frameName = b : this . frame = b , this . isLoaded = ! 0 , ! 0 } , copyFrameData : function ( a , b ) { if ( this . _frameData = a . clone ( ) , this . isLoaded ) for ( var c in this . _anims ) this . _anims [ c ] . updateFrameData ( this . _frameData ) ; return "undefined" == typeof b || null === b ? this . frame = 0 : "string" == typeof b ? this . frameName = b : this . frame = b , this . isLoaded = ! 0 , ! 0 } , add : function ( a , c , d , e , f ) { return c = c || [ ] , d = d || 60 , "undefined" == typeof e && ( e = ! 1 ) , "undefined" == typeof f && ( f = c && "number" == typeof c [ 0 ] ? ! 0 : ! 1 ) , null === this . sprite . events . onAnimationStart && ( this . sprite . events . onAnimationStart = new b . Signal , this . sprite . events . onAnimationComplete = new b . Signal , this . sprite . events . onAnimationLoop = new b . Signal ) , this . _outputFrames . length = 0 , this . _frameData . getFrameIndexes ( c , f , this . _outputFrames )
} , b . Loader . TEXTURE _ATLAS _JSON _ARRAY = 0 , b . Loader . TEXTURE _ATLAS _JSON _HASH = 1 , b . Loader . TEXTURE _ATLAS _XML _STARLING = 2 , b . Loader . PHYSICS _LIME _CORONA _JSON = 3 , b . Loader . PHYSICS _PHASER _JSON = 4 , b . Loader . prototype = { setPreloadSprite : function ( a , c ) { c = c || 0 , this . preloadSprite = { sprite : a , direction : c , width : a . width , height : a . height , rect : null } , this . preloadSprite . rect = 0 === c ? new b . Rectangle ( 0 , 0 , 1 , a . height ) : new b . Rectangle ( 0 , 0 , a . width , 1 ) , a . crop ( this . preloadSprite . rect ) , a . visible = ! 0 } , checkKeyExists : function ( a , b ) { if ( this . _fileList . length > 0 ) for ( var c = 0 ; c < this . _fileList . length ; c ++ ) if ( this . _fileList [ c ] . type === a && this . _fileList [ c ] . key === b ) return ! 0 ; return ! 1 } , getAssetIndex : function ( a , b ) { if ( this . _fileList . length > 0 ) for ( var c = 0 ; c < this . _fileList . length ; c ++ ) if ( this . _fileList [ c ] . type === a && this . _fileList [ c ] . key === b ) return c ; return - 1 } , getAsset : function ( a , b ) { if ( this . _fileList . length > 0 ) for ( var c = 0 ; c < this . _fileList . length ; c ++ ) if ( this . _fileList [ c ] . type === a && this . _fileList [ c ] . key === b ) return { index : c , file : this . _fileList [ c ] } ; return ! 1 } , reset : function ( ) { this . preloadSprite = null , this . isLoading = ! 1 , this . _packList . length = 0 , this . _packIndex = 0 , this . _fileList . length = 0 , this . _fileIndex = 0 } , addToFileList : function ( a , b , c , d ) { var e = { type : a , key : b , url : c , data : null , error : ! 1 , loaded : ! 1 } ; if ( "undefined" != typeof d ) for ( var f in d ) e [ f ] = d [ f ] ; this . checkKeyExists ( a , b ) === ! 1 && this . _fileList . push ( e ) } , replaceInFileList : function ( a , b , c , d ) { var e = { type : a , key : b , url : c , data : null , error : ! 1 , loaded : ! 1 } ; if ( "undefined" != typeof d ) for ( var f in d ) e [ f ] = d [ f ] ; var g = this . getAssetIndex ( a , b ) ; - 1 === g ? this . _fileList . push ( e ) : this . _fileList [ g ] = e } , pack : function ( a , b , c , d ) { return "undefined" == typeof b && ( b = null ) , "undefined" == typeof c && ( c = null ) , "undefined" == typeof d && ( d = this ) , null === b && null === c ? ( console . warn ( "Phaser.Loader.pack - Both url and data are null. One must be set." ) , this ) : ( c && "string" == typeof c && ( c = JSON . parse ( c ) ) , this . _packList . push ( { key : a , url : b , data : c , loaded : ! 1 , error : ! 1 , callbackContext : d } ) , this ) } , image : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? this . replaceInFileList ( "image" , a , b ) : this . addToFileList ( "image" , a , b ) , this } , text : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? this . replaceInFileList ( "text" , a , b ) : this . addToFileList ( "text" , a , b ) , this } , json : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? this . replaceInFileList ( "json" , a , b ) : this . addToFileList ( "json" , a , b ) , this } , xml : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? this . replaceInFileList ( "xml" , a , b ) : this . addToFileList ( "xml" , a , b ) , this } , script : function ( a , b , c , d ) { return "undefined" == typeof c && ( c = ! 1 ) , c !== ! 1 && "undefined" == typeof d && ( d = c ) , this . addToFileList ( "script" , a , b , { callback : c , callbackContext : d } ) , this } , binary : function ( a , b , c , d ) { return "undefined" == typeof c && ( c = ! 1 ) , c !== ! 1 && "undefined" == typeof d && ( d = c ) , this . addToFileList ( "binary" , a , b , { callback : c , callbackContext : d } ) , this } , spritesheet : function ( a , b , c , d , e , f , g ) { return "undefined" == typeof e && ( e = - 1 ) , "undefined" == typeof f && ( f = 0 ) , "undefined" == typeof g && ( g = 0 ) , this . addToFileList ( "spritesheet" , a , b , { frameWidth : c , frameHeight : d , frameMax : e , margin : f , spacing : g } ) , this } , audio : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 0 ) , this . addToFileList ( "audio" , a , b , { buffer : null , autoDecode : c } ) , this } , audiosprite : function ( a , b , c ) { return this . audio ( a , b ) , this . json ( a + "-audioatlas" , c ) , this } , tilemap : function ( a , c , d , e ) { if ( "undefined" == typeof c && ( c = null ) , "undefined" == typeof d && ( d = null ) , "undefined" == typeof e && ( e = b . Tilemap . CSV ) , null == c && null == d ) return console . warn ( "Phaser.Loader.tilemap - Both url and data are null. One must be set." ) , this ; if ( d ) { switch ( e ) { case b . Tilemap . CSV : break ; case b . Tilemap . TILED _JSON : "string" == typeof d && ( d = JSON . parse ( d ) ) } this . game . cache . addTilemap ( a , null , d , e ) } else this . addToFileList ( "tilemap" , a , c , { format : e } ) ; return this } , physics : function ( a , c , d , e ) { return "undefined" == typeof c && ( c = null ) , "undefined" == typeof d && ( d = null ) , "undefined" == typeof e && ( e = b . Physics . LIME _CORONA _JSON ) , null == c && null == d ? ( console . warn ( "Phaser.Loader.physics - Both url and data are null. One must be set." ) , this ) : ( d ? ( "string" == typeof d && ( d = JSON . parse ( d ) ) , this . game . cache . addPhysicsData ( a , null , d , e ) ) : this . addToFileList ( "physics" , a , c , { format : e } ) , this ) } , bitmapFont : function ( a , b ,
2014-10-23 11:27:34 +00:00
} } , destroy : function ( ) { this . stopAll ( ) ; for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . destroy ( ) ; this . _sounds = [ ] , this . onSoundDecode . dispose ( ) } } , b . SoundManager . prototype . constructor = b . SoundManager , Object . defineProperty ( b . SoundManager . prototype , "mute" , { get : function ( ) { return this . _muted } , set : function ( a ) { if ( a = a || null ) { if ( this . _muted ) return ; this . _codeMuted = ! 0 , this . setMute ( ) } else { if ( ! this . _muted ) return ; this . _codeMuted = ! 1 , this . unsetMute ( ) } } } ) , Object . defineProperty ( b . SoundManager . prototype , "volume" , { get : function ( ) { return this . usingWebAudio ? this . masterGain . gain . value : this . _volume } , set : function ( a ) { if ( this . _volume = a , this . usingWebAudio ) this . masterGain . gain . value = a ; else for ( var b = 0 ; b < this . _sounds . length ; b ++ ) this . _sounds [ b ] . usingAudioTag && ( this . _sounds [ b ] . volume = this . _sounds [ b ] . volume * a ) } } ) , b . Utils . Debug = function ( a ) { this . game = a , this . sprite = null , this . bmd = null , this . canvas = null , this . context = null , this . font = "14px Courier" , this . columnWidth = 100 , this . lineHeight = 16 , this . renderShadow = ! 0 , this . currentX = 0 , this . currentY = 0 , this . currentAlpha = 1 , this . dirty = ! 1 } , b . Utils . Debug . prototype = { boot : function ( ) { this . game . renderType === b . CANVAS ? this . context = this . game . context : ( this . bmd = this . game . make . bitmapData ( this . game . width , this . game . height ) , this . sprite = this . game . make . image ( 0 , 0 , this . bmd ) , this . game . stage . addChild ( this . sprite ) , this . canvas = b . Canvas . create ( this . game . width , this . game . height , "" , ! 0 ) , this . context = this . canvas . getContext ( "2d" ) ) } , preUpdate : function ( ) { this . dirty && this . sprite && ( this . bmd . clear ( ) , this . bmd . draw ( this . canvas , 0 , 0 ) , this . context . clearRect ( 0 , 0 , this . game . width , this . game . height ) , this . dirty = ! 1 ) } , reset : function ( ) { this . context && this . context . clearRect ( 0 , 0 , this . game . width , this . game . height ) , this . sprite && this . bmd . clear ( ) } , start : function ( a , b , c , d ) { "number" != typeof a && ( a = 0 ) , "number" != typeof b && ( b = 0 ) , c = c || "rgb(255,255,255)" , "undefined" == typeof d && ( d = 0 ) , this . currentX = a , this . currentY = b , this . currentColor = c , this . currentAlpha = this . context . globalAlpha , this . columnWidth = d , this . dirty = ! 0 , this . context . save ( ) , this . context . setTransform ( 1 , 0 , 0 , 1 , 0 , 0 ) , this . context . strokeStyle = c , this . context . fillStyle = c , this . context . font = this . font , this . context . globalAlpha = 1 } , stop : function ( ) { this . context . restore ( ) , this . context . globalAlpha = this . currentAlpha } , line : function ( ) { for ( var a = this . currentX , b = 0 ; b < arguments . length ; b ++ ) this . renderShadow && ( this . context . fillStyle = "rgb(0,0,0)" , this . context . fillText ( arguments [ b ] , a + 1 , this . currentY + 1 ) , this . context . fillStyle = this . currentColor ) , this . context . fillText ( arguments [ b ] , a , this . currentY ) , a += this . columnWidth ; this . currentY += this . lineHeight } , soundInfo : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Sound: " + a . key + " Locked: " + a . game . sound . touchLocked ) , this . line ( "Is Ready?: " + this . game . cache . isSoundReady ( a . key ) + " Pending Playback: " + a . pendingPlayback ) , this . line ( "Decoded: " + a . isDecoded + " Decoding: " + a . isDecoding ) , this . line ( "Total Duration: " + a . totalDuration + " Playing: " + a . isPlaying ) , this . line ( "Time: " + a . currentTime ) , this . line ( "Volume: " + a . volume + " Muted: " + a . mute ) , this . line ( "WebAudio: " + a . usingWebAudio + " Audio: " + a . usingAudioTag ) , "" !== a . currentMarker && ( this . line ( "Marker: " + a . currentMarker + " Duration: " + a . duration + " (ms: " + a . durationMS + ")" ) , this . line ( "Start: " + a . markers [ a . currentMarker ] . start + " Stop: " + a . markers [ a . currentMarker ] . stop ) , this . line ( "Position: " + a . position ) ) , this . stop ( ) } , cameraInfo : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Camera (" + a . width + " x " + a . height + ")" ) , this . line ( "X: " + a . x + " Y: " + a . y ) , a . bounds && this . line ( "Bounds x: " + a . bounds . x + " Y: " + a . bounds . y + " w: " + a . bounds . width + " h: " + a . bounds . height ) , this . line ( "View x: " + a . view . x + " Y: " + a . view . y + " w: " + a . view . width + " h: " + a . view . height ) , this . stop ( ) } , timer : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Timer (running: " + a . running + " expired: " + a . expired + ")" ) , this . line ( "Next Tick: " + a . next + " Duration: " + a . duration ) , this . line ( "Paused: " + a . paused + " Length: " + a . length ) , this . stop ( ) } , pointer : function ( a , b , c , d , e ) { null != a && ( "undefined" == typeof b && ( b = ! 1 ) , c = c || "rgba(0,255,0,0.5)" , d = d || "rgba(255,0,0,0.5)" , ( b !== ! 0 || a . isUp !== ! 0 ) && ( this . start ( a . x , a . y - 100 , e ) , this . context . beginPath ( ) , this . context . arc ( a .