diff --git a/ads.js b/ads.js new file mode 100644 index 0000000..b809674 --- /dev/null +++ b/ads.js @@ -0,0 +1,26 @@ +function noAdGoToScene(){ + var GameConfig = __require("GameConfig"); + console.log("IndexMainMangerMaing",GameConfig.launchScene, GameConfig.Bros,GameConfig.caS); + + var launchScene = GameConfig.launchScene; + var Bros = GameConfig.Bros; + var caS = GameConfig.caS; + cc.director.loadScene(launchScene, null, + function () { + + adCompleteFlag = false; + + if (Bros) { + // show canvas + var canvas = document.getElementById('GameCanvas'); + canvas.style.visibility = ''; + var div = document.getElementById('GameDiv'); + if (div) { + div.style.backgroundImage = ''; + } + } + cc.loader.onProgress = null; + console.log('Success to load scene1Main: ' + launchScene); + } + ); +} \ No newline at end of file diff --git a/assets/internal/config.803f8.json b/assets/internal/config.803f8.json new file mode 100644 index 0000000..33b64c9 --- /dev/null +++ b/assets/internal/config.803f8.json @@ -0,0 +1 @@ +{"paths":{"0":["effects/builtin-2d-graphics",0],"1":["effects/builtin-2d-gray-sprite",0],"2":["effects/builtin-2d-label",0],"3":["effects/builtin-2d-spine",0],"4":["effects/builtin-2d-sprite",0],"5":["effects/builtin-3d-trail",0],"6":["effects/builtin-clear-stencil",0],"7":["effects/builtin-unlit",0],"8":["materials/builtin-2d-base",1],"9":["materials/builtin-2d-graphics",1],"10":["materials/builtin-2d-gray-sprite",1],"11":["materials/builtin-2d-label",1],"12":["materials/builtin-2d-spine",1],"13":["materials/builtin-2d-sprite",1],"14":["materials/builtin-3d-trail",1],"15":["materials/builtin-clear-stencil",1],"16":["materials/builtin-unlit",1]},"types":["cc.EffectAsset","cc.Material"],"uuids":["30aC+Hnw1PF4pEcoY3kUYb","14TDKXr2NJ6LjvHPops74o","f1h0LXVtJOta5JLZ1xCzfI","0ek66qC1NOQLjgYmi04HvX","28dPjdQWxEQIG3VVl1Qm6T","2afAA24LNP4YmYiaVLiivs","c0BAyVxX9JzZy8EjFrc9DU","6dkeWRTOBGXICfYQ7JUBnG","6fgBCSDDdPMInvyNlggls2","a1U5RdJRFMFL57BdJC9H1X","3ae7efMv1CLq2ilvUY/tQi","e0LYfU5ZlNFoAB4UiRrGUG","7a/QZLET9IDreTiBfRn2PD","ecpdLyjvZBwrvm+cedCcQy","46bU+b5fROqIXVPG6aZWWK","cffgu4qBxEqa150o1DmRAy","2aKWBXJHxKHLvrBUi2yYZQ","02delMVqdBD70a/HSD99FK"],"scenes":{},"redirect":[],"deps":[],"packs":{"0967b326a":[17,3,1,4,16,5,0,10,14,7,8,12,9,6,15,11,13,2]},"name":"internal","importBase":"import","nativeBase":"native","debug":false,"isZip":false,"encrypted":false,"versions":{"import":["0967b326a","381d5"],"native":[17,"cea68"]}} \ No newline at end of file diff --git a/assets/internal/import/09/0967b326a.381d5.json b/assets/internal/import/09/0967b326a.381d5.json new file mode 100644 index 0000000..3355e3e --- /dev/null +++ b/assets/internal/import/09/0967b326a.381d5.json @@ -0,0 +1 @@ +[1,["02delMVqdBD70a/HSD99FK","28dPjdQWxEQIG3VVl1Qm6T","6dkeWRTOBGXICfYQ7JUBnG","14TDKXr2NJ6LjvHPops74o","2afAA24LNP4YmYiaVLiivs","0ek66qC1NOQLjgYmi04HvX","30aC+Hnw1PF4pEcoY3kUYb","c0BAyVxX9JzZy8EjFrc9DU","f1h0LXVtJOta5JLZ1xCzfI"],["_effectAsset","diffuseTexture","mainTexture"],["cc.Texture2D",["cc.EffectAsset",["_name","shaders","techniques"],0],["cc.Material",["_name","_techniqueData"],2,11],["cc.Material",["_name","_techniqueData"],1]],[[1,0,1,2,4],[3,0,1,3],[2,0,1,2]],[[["0,9729,9729,33071,33071,0,0,1",-1],[0],0,[],[],[]],[[[0,"builtin-2d-spine",[{"hash":3550530479,"record":null,"name":"builtin-2d-spine|vs|fs","glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\n#if USE_TINT\n in vec4 a_color0;\n#endif\nin vec2 a_uv0;\nout vec2 v_uv0;\nout vec4 v_light;\n#if USE_TINT\n out vec4 v_dark;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_light = a_color;\n #if USE_TINT\n v_dark = a_color0;\n #endif\n gl_Position = mvp * vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nin vec2 v_uv0;\nin vec4 v_light;\n#if USE_TINT\n in vec4 v_dark;\n#endif\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvoid main () {\n vec4 texColor = vec4(1.0);\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n texColor.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n texColor.a *= texture_tmp.a;\n #else\n texColor *= texture_tmp;\n #endif\n vec4 finalColor;\n #if USE_TINT\n finalColor.a = v_light.a * texColor.a;\n finalColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n finalColor = texColor * v_light;\n #endif\n ALPHA_TEST(finalColor);\n gl_FragColor = finalColor;\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\n#if USE_TINT\n attribute vec4 a_color0;\n#endif\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\nvarying vec4 v_light;\n#if USE_TINT\n varying vec4 v_dark;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_light = a_color;\n #if USE_TINT\n v_dark = a_color0;\n #endif\n gl_Position = mvp * vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nvarying vec2 v_uv0;\nvarying vec4 v_light;\n#if USE_TINT\n varying vec4 v_dark;\n#endif\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvoid main () {\n vec4 texColor = vec4(1.0);\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n texColor.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n texColor.a *= texture_tmp.a;\n #else\n texColor *= texture_tmp;\n #endif\n vec4 finalColor;\n #if USE_TINT\n finalColor.a = v_light.a * texColor.a;\n finalColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n finalColor = texColor * v_light;\n #endif\n ALPHA_TEST(finalColor);\n gl_FragColor = finalColor;\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"USE_TINT","type":"boolean","defines":[]},{"name":"CC_USE_MODEL","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"CC_USE_ALPHA_ATLAS_texture","type":"boolean","defines":[]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":[]}],"blocks":[{"name":"ALPHA_TEST","binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplers":[{"name":"texture","type":29,"count":1,"binding":30,"defines":[]}]}],[{"passes":[{"program":"builtin-2d-spine|vs|fs","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"properties":{"texture":{"value":"white","type":29},"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[0,"builtin-2d-gray-sprite",[{"hash":4278481454,"record":null,"name":"builtin-2d-gray-sprite|vs|fs","glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nin vec3 a_position;\nin mediump vec2 a_uv0;\nout mediump vec2 v_uv0;\nin vec4 a_color;\nout vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float gray = 0.2126*color.r + 0.7152*color.g + 0.0722*color.b;\n gl_FragColor = vec4(gray, gray, gray, color.a);\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute mediump vec2 a_uv0;\nvarying mediump vec2 v_uv0;\nattribute vec4 a_color;\nvarying vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float gray = 0.2126*color.r + 0.7152*color.g + 0.0722*color.b;\n gl_FragColor = vec4(gray, gray, gray, color.a);\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[],"samplers":[]}},"defines":[{"name":"CC_USE_ALPHA_ATLAS_texture","type":"boolean","defines":[]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":[]}],"blocks":[],"samplers":[{"name":"texture","type":29,"count":1,"binding":30,"defines":[]}]}],[{"passes":[{"program":"builtin-2d-gray-sprite|vs|fs","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"properties":{"texture":{"value":"white","type":29}}}]}]]],0,0,[],[],[]],[[[0,"builtin-2d-sprite",[{"hash":3278106612,"record":null,"name":"builtin-2d-sprite|vs|fs","glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"USE_TEXTURE","type":"boolean","defines":[]},{"name":"CC_USE_MODEL","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"CC_USE_ALPHA_ATLAS_texture","type":"boolean","defines":["USE_TEXTURE"]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":["USE_TEXTURE"]}],"blocks":[{"name":"ALPHA_TEST","binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplers":[{"name":"texture","type":29,"count":1,"binding":30,"defines":["USE_TEXTURE"]}]}],[{"passes":[{"program":"builtin-2d-sprite|vs|fs","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"properties":{"texture":{"value":"white","type":29},"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[2,"builtin-unlit",[{},"0",11,[{"defines":{"USE_DIFFUSE_TEXTURE":true}},"props",11,[{},"diffuseTexture",6,0]]]]],0,0,[0,0],[1,0],[0,2]],[[[0,"builtin-3d-trail",[{"hash":2929688198,"record":null,"name":"builtin-3d-trail|particle-trail:vs_main|tinted-fs:add","glsl3":{"vert":"\nprecision mediump float;\nuniform Constants{\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n};\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nout vec2 uv;\nout vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nin vec2 uv;\nin vec4 color;\n#if CC_DRAW_WIRE_FRAME\n in vec3 vBarycentric;\n#endif\nuniform sampler2D mainTexture;\nuniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n #if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., 1.);\n }\n #endif\n return CCFragOutput(col);\n}\nout vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform vec4 mainTiling_Offset;\nuniform mat4 cc_matViewProj;\nuniform vec4 cc_cameraPos;\nuniform mat4 cc_matWorld;\nvarying vec2 uv;\nvarying vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nvarying vec2 uv;\nvarying vec4 color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nuniform sampler2D mainTexture;\nuniform vec4 tintColor;\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture2D(mainTexture, uv);\n #if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., 1.);\n }\n #endif\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"CC_DRAW_WIRE_FRAME","type":"boolean","defines":[]},{"name":"CC_USE_WORLD_SPACE","type":"boolean","defines":[]},{"name":"OUTPUT_TO_GAMMA","type":"boolean","defines":[]}],"blocks":[{"name":"Constants","binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1}],"defines":[]},{"name":"FragConstants","binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplers":[{"name":"mainTexture","type":29,"count":1,"binding":30,"defines":[]}]},{"hash":4224037318,"record":null,"name":"builtin-3d-trail|particle-trail:vs_main|tinted-fs:multiply","glsl3":{"vert":"\nprecision mediump float;\nuniform Constants{\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n};\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nout vec2 uv;\nout vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nin vec2 uv;\nin vec4 color;\n#if CC_DRAW_WIRE_FRAME\n in vec3 vBarycentric;\n#endif\nuniform sampler2D mainTexture;\nuniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n #if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., col.a);\n }\n #endif\n return CCFragOutput(col);\n}\nout vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform vec4 mainTiling_Offset;\nuniform mat4 cc_matViewProj;\nuniform vec4 cc_cameraPos;\nuniform mat4 cc_matWorld;\nvarying vec2 uv;\nvarying vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nvarying vec2 uv;\nvarying vec4 color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nuniform sampler2D mainTexture;\nuniform vec4 tintColor;\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture2D(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n #if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., col.a);\n }\n #endif\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"CC_DRAW_WIRE_FRAME","type":"boolean","defines":[]},{"name":"CC_USE_WORLD_SPACE","type":"boolean","defines":[]},{"name":"OUTPUT_TO_GAMMA","type":"boolean","defines":[]}],"blocks":[{"name":"Constants","binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1}],"defines":[]},{"name":"FragConstants","binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplers":[{"name":"mainTexture","type":29,"count":1,"binding":30,"defines":[]}]},{"hash":1704877102,"record":null,"name":"builtin-3d-trail|particle-trail:vs_main|no-tint-fs:addSmooth","glsl3":{"vert":"\nprecision mediump float;\nuniform Constants{\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n};\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nout vec2 uv;\nout vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nout vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform vec4 mainTiling_Offset;\nuniform mat4 cc_matViewProj;\nuniform vec4 cc_cameraPos;\nuniform mat4 cc_matWorld;\nvarying vec2 uv;\nvarying vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture2D(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"CC_DRAW_WIRE_FRAME","type":"boolean","defines":[]},{"name":"CC_USE_WORLD_SPACE","type":"boolean","defines":[]},{"name":"OUTPUT_TO_GAMMA","type":"boolean","defines":[]}],"blocks":[{"name":"Constants","binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1}],"defines":[]}],"samplers":[{"name":"mainTexture","type":29,"count":1,"binding":30,"defines":[]}]},{"hash":2717357054,"record":null,"name":"builtin-3d-trail|particle-trail:vs_main|no-tint-fs:premultiplied","glsl3":{"vert":"\nprecision mediump float;\nuniform Constants{\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n};\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nout vec2 uv;\nout vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nout vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform vec4 mainTiling_Offset;\nuniform mat4 cc_matViewProj;\nuniform vec4 cc_cameraPos;\nuniform mat4 cc_matWorld;\nvarying vec2 uv;\nvarying vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n#if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n#endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n#if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n#endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture2D(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"CC_DRAW_WIRE_FRAME","type":"boolean","defines":[]},{"name":"CC_USE_WORLD_SPACE","type":"boolean","defines":[]},{"name":"OUTPUT_TO_GAMMA","type":"boolean","defines":[]}],"blocks":[{"name":"Constants","binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1}],"defines":[]}],"samplers":[{"name":"mainTexture","type":29,"count":1,"binding":30,"defines":[]}]}],[{"name":"add","passes":[{"program":"builtin-3d-trail|particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":770,"blendDst":1,"blendSrcAlpha":770,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":29},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5],"inspector":{"type":"color"}}}}]},{"name":"alpha-blend","passes":[{"program":"builtin-3d-trail|particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":771,"blendSrcAlpha":1,"blendDstAlpha":771}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":29},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5],"inspector":{"type":"color"}}}}]},{"name":"add-multiply","passes":[{"program":"builtin-3d-trail|particle-trail:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":771,"blendSrcAlpha":1,"blendDstAlpha":771}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":29},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5],"inspector":{"type":"color"}}}}]},{"name":"add-smooth","passes":[{"program":"builtin-3d-trail|particle-trail:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":771,"blendSrcAlpha":1,"blendDstAlpha":771}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":29},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]}}}]},{"name":"premultiply-blend","passes":[{"program":"builtin-3d-trail|particle-trail:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":771,"blendSrcAlpha":1,"blendDstAlpha":771}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":29},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]}}}]}]]],0,0,[],[],[]],[[[0,"builtin-2d-graphics",[{"hash":550349795,"record":null,"name":"builtin-2d-graphics|vs|fs","glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\nin float a_dist;\nout float v_dist;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n gl_Position = pos;\n}","frag":"\n#if CC_SUPPORT_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\nin float v_dist;\nvoid main () {\n vec4 o = v_color;\n ALPHA_TEST(o);\n #if CC_SUPPORT_standard_derivatives\n float aa = fwidth(v_dist);\n #else\n float aa = 0.05;\n #endif\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\n gl_FragColor = o;\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\nattribute float a_dist;\nvarying float v_dist;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n gl_Position = pos;\n}","frag":"\n#if CC_SUPPORT_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\nvarying float v_dist;\nvoid main () {\n vec4 o = v_color;\n ALPHA_TEST(o);\n #if CC_SUPPORT_standard_derivatives\n float aa = fwidth(v_dist);\n #else\n float aa = 0.05;\n #endif\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\n gl_FragColor = o;\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"CC_SUPPORT_standard_derivatives","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]}],"blocks":[{"name":"ALPHA_TEST","binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplers":[]}],[{"passes":[{"program":"builtin-2d-graphics|vs|fs","blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":771,"blendSrcAlpha":1,"blendDstAlpha":771}]},"rasterizerState":{"cullMode":0},"properties":{"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[1,"builtin-2d-gray-sprite",{}]],0,0,[0],[0],[3]],[[[2,"builtin-3d-trail",[{},"0",11,[{},"props",11,[{},"mainTexture",6,0]]]]],0,0,[0,0],[2,0],[0,4]],[[[0,"builtin-unlit",[{"hash":922858114,"record":null,"name":"builtin-unlit|unlit-vs|unlit-fs","glsl3":{"vert":"\nprecision highp float;\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\n#if CC_USE_SKINNING\n in vec4 a_weights;\n in vec4 a_joints;\n #if CC_USE_JOINTS_TEXTRUE\n uniform SKINNING {\n vec2 jointsTextureSize;\n };\n uniform sampler2D jointsTexture;\n #if CC_JOINTS_TEXTURE_FLOAT32\n mat4 getBoneMatrix(const in float i) {\n float width = jointsTextureSize.x;\n float height = jointsTextureSize.y;\n float j = i * 4.0;\n float x = mod(j, width);\n float y = floor(j / width);\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n y = dy * (y + 0.5);\n vec4 v1 = texture(jointsTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture(jointsTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture(jointsTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture(jointsTexture, vec2(dx * (x + 3.5), y));\n return mat4(v1, v2, v3, v4);\n }\n #else\n float decode32(vec4 rgba) {\n float Sign = 1.0 - step(128.0, rgba[0]) * 2.0;\n float Exponent = 2.0 * mod(rgba[0], 128.0) + step(128.0, rgba[1]) - 127.0;\n float Mantissa = mod(rgba[1], 128.0) * 65536.0 + rgba[2] * 256.0 + rgba[3] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 decodevec4 (vec4 x, vec4 y, vec4 z, vec4 w) {\n return vec4(\n decode32(x.wzyx * 255.0),\n decode32(y.wzyx * 255.0),\n decode32(z.wzyx * 255.0),\n decode32(w.wzyx * 255.0)\n );\n }\n vec4 decodevec4 (float dx, float x, float y) {\n return decodevec4(\n texture(jointsTexture, vec2(dx * (x + 0.5), y)),\n texture(jointsTexture, vec2(dx * (x + 1.5), y)),\n texture(jointsTexture, vec2(dx * (x + 2.5), y)),\n texture(jointsTexture, vec2(dx * (x + 3.5), y))\n );\n }\n mat4 getBoneMatrix(const in float i) {\n float width = jointsTextureSize.x;\n float height = jointsTextureSize.y;\n float j = i * 16.0;\n float x = mod(j, width);\n float y = floor(j / width);\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n y = dy * (y + 0.5);\n vec4 v1 = decodevec4(dx, x, y);\n vec4 v2 = decodevec4(dx, x+4.0, y);\n vec4 v3 = decodevec4(dx, x+8.0, y);\n vec4 v4 = decodevec4(dx, x+12.0, y);\n return mat4(v1, v2, v3, v4);\n }\n #endif\n #else\n uniform JOINT_MATRIX {\n mat4 jointMatrices[50];\n };\n mat4 getBoneMatrix(const in float i) {\n return jointMatrices[int(i)];\n }\n #endif\n mat4 skinMatrix() {\n return\n getBoneMatrix(a_joints.x) * a_weights.x +\n getBoneMatrix(a_joints.y) * a_weights.y +\n getBoneMatrix(a_joints.z) * a_weights.z +\n getBoneMatrix(a_joints.w) * a_weights.w\n ;\n }\n#endif\nstruct StandardVertInput {\n vec2 uv;\n vec4 position;\n vec3 normal;\n vec4 tangent;\n vec4 color;\n};\nin vec3 a_position;\n#if CC_USE_ATTRIBUTE_UV0\nin vec2 a_uv0;\n#endif\n#if CC_USE_ATTRIBUTE_COLOR\nin vec4 a_color;\n#endif\n#if CC_USE_ATTRIBUTE_NORMAL\nin vec3 a_normal;\n#endif\n#if CC_USE_ATTRIBUTE_TANGENT\nin vec4 a_tangent;\n#endif\nvoid CCAttribute (out StandardVertInput In) {\n In.position = vec4(a_position, 1.0);\n #if CC_USE_ATTRIBUTE_UV0\n In.uv = a_uv0;\n #else\n In.uv = vec2(0.0);\n #endif\n #if CC_USE_ATTRIBUTE_COLOR\n In.color = a_color;\n #else\n In.color = vec4(1.0);\n #endif\n #if CC_USE_ATTRIBUTE_NORMAL\n In.normal = a_normal;\n #else\n In.normal = vec3(0.0, 1.0, 0.0);\n #endif\n #if CC_USE_ATTRIBUTE_TANGENT\n In.tangent = a_tangent;\n #else\n In.tangent = vec4(1.0, 0.0, 0.0, 0.0);\n #endif\n}\nvoid CCVertInput(out StandardVertInput In) {\n CCAttribute(In);\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n In.position = m * In.position;\n #if CC_USE_ATTRIBUTE_NORMAL\n In.normal = (m * vec4(In.normal, 0)).xyz;\n #endif\n #if CC_USE_ATTRIBUTE_TANGENT\n In.tangent = m * In.tangent;\n #endif\n #endif\n}\nuniform MAIN_TILING {\n vec2 mainTiling;\n vec2 mainOffset;\n};\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n out mediump vec2 v_uv0;\n#endif\n#if CC_USE_ATTRIBUTE_COLOR\n out lowp vec4 v_color;\n#endif\nvoid main () {\n StandardVertInput In;\n CCVertInput(In);\n #if CC_USE_ATTRIBUTE_COLOR\n v_color = In.color;\n #endif\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n v_uv0 = In.uv * mainTiling + mainOffset;\n #endif\n gl_Position = cc_matViewProj * cc_matWorld * In.position;\n}","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nuniform UNLIT {\n lowp vec4 diffuseColor;\n};\n#if USE_DIFFUSE_TEXTURE\n uniform sampler2D diffuseTexture;\n#endif\n#if CC_USE_ATTRIBUTE_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n in mediump vec2 v_uv0;\n#endif\nvoid main () {\n vec4 color = diffuseColor;\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n vec4 diffuseTexture_tmp = texture(diffuseTexture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_diffuseTexture\n diffuseTexture_tmp.a *= texture(diffuseTexture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (diffuseTexture_tmp.rgb * diffuseTexture_tmp.rgb);\n color.a *= diffuseTexture_tmp.a;\n #else\n color *= diffuseTexture_tmp;\n #endif\n #endif\n #if CC_USE_ATTRIBUTE_COLOR\n color *= v_color;\n #endif\n ALPHA_TEST(color);\n gl_FragColor = CCFragOutput(color);\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matWorld;\nuniform mat4 cc_matViewProj;\n#if CC_USE_SKINNING\n attribute vec4 a_weights;\n attribute vec4 a_joints;\n #if CC_USE_JOINTS_TEXTRUE\n uniform vec2 jointsTextureSize;\n uniform sampler2D jointsTexture;\n #if CC_JOINTS_TEXTURE_FLOAT32\n mat4 getBoneMatrix(const in float i) {\n float width = jointsTextureSize.x;\n float height = jointsTextureSize.y;\n float j = i * 4.0;\n float x = mod(j, width);\n float y = floor(j / width);\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(jointsTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(jointsTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(jointsTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(jointsTexture, vec2(dx * (x + 3.5), y));\n return mat4(v1, v2, v3, v4);\n }\n #else\n float decode32(vec4 rgba) {\n float Sign = 1.0 - step(128.0, rgba[0]) * 2.0;\n float Exponent = 2.0 * mod(rgba[0], 128.0) + step(128.0, rgba[1]) - 127.0;\n float Mantissa = mod(rgba[1], 128.0) * 65536.0 + rgba[2] * 256.0 + rgba[3] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 decodevec4 (vec4 x, vec4 y, vec4 z, vec4 w) {\n return vec4(\n decode32(x.wzyx * 255.0),\n decode32(y.wzyx * 255.0),\n decode32(z.wzyx * 255.0),\n decode32(w.wzyx * 255.0)\n );\n }\n vec4 decodevec4 (float dx, float x, float y) {\n return decodevec4(\n texture2D(jointsTexture, vec2(dx * (x + 0.5), y)),\n texture2D(jointsTexture, vec2(dx * (x + 1.5), y)),\n texture2D(jointsTexture, vec2(dx * (x + 2.5), y)),\n texture2D(jointsTexture, vec2(dx * (x + 3.5), y))\n );\n }\n mat4 getBoneMatrix(const in float i) {\n float width = jointsTextureSize.x;\n float height = jointsTextureSize.y;\n float j = i * 16.0;\n float x = mod(j, width);\n float y = floor(j / width);\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n y = dy * (y + 0.5);\n vec4 v1 = decodevec4(dx, x, y);\n vec4 v2 = decodevec4(dx, x+4.0, y);\n vec4 v3 = decodevec4(dx, x+8.0, y);\n vec4 v4 = decodevec4(dx, x+12.0, y);\n return mat4(v1, v2, v3, v4);\n }\n #endif\n #else\n uniform mat4 jointMatrices[50];\n mat4 getBoneMatrix(const in float i) {\n return jointMatrices[int(i)];\n }\n #endif\n mat4 skinMatrix() {\n return\n getBoneMatrix(a_joints.x) * a_weights.x +\n getBoneMatrix(a_joints.y) * a_weights.y +\n getBoneMatrix(a_joints.z) * a_weights.z +\n getBoneMatrix(a_joints.w) * a_weights.w\n ;\n }\n#endif\nstruct StandardVertInput {\n vec2 uv;\n vec4 position;\n vec3 normal;\n vec4 tangent;\n vec4 color;\n};\nattribute vec3 a_position;\n#if CC_USE_ATTRIBUTE_UV0\nattribute vec2 a_uv0;\n#endif\n#if CC_USE_ATTRIBUTE_COLOR\nattribute vec4 a_color;\n#endif\n#if CC_USE_ATTRIBUTE_NORMAL\nattribute vec3 a_normal;\n#endif\n#if CC_USE_ATTRIBUTE_TANGENT\nattribute vec4 a_tangent;\n#endif\nvoid CCAttribute (out StandardVertInput In) {\n In.position = vec4(a_position, 1.0);\n #if CC_USE_ATTRIBUTE_UV0\n In.uv = a_uv0;\n #else\n In.uv = vec2(0.0);\n #endif\n #if CC_USE_ATTRIBUTE_COLOR\n In.color = a_color;\n #else\n In.color = vec4(1.0);\n #endif\n #if CC_USE_ATTRIBUTE_NORMAL\n In.normal = a_normal;\n #else\n In.normal = vec3(0.0, 1.0, 0.0);\n #endif\n #if CC_USE_ATTRIBUTE_TANGENT\n In.tangent = a_tangent;\n #else\n In.tangent = vec4(1.0, 0.0, 0.0, 0.0);\n #endif\n}\nvoid CCVertInput(out StandardVertInput In) {\n CCAttribute(In);\n #if CC_USE_SKINNING\n mat4 m = skinMatrix();\n In.position = m * In.position;\n #if CC_USE_ATTRIBUTE_NORMAL\n In.normal = (m * vec4(In.normal, 0)).xyz;\n #endif\n #if CC_USE_ATTRIBUTE_TANGENT\n In.tangent = m * In.tangent;\n #endif\n #endif\n}\nuniform vec2 mainTiling;\nuniform vec2 mainOffset;\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n varying mediump vec2 v_uv0;\n#endif\n#if CC_USE_ATTRIBUTE_COLOR\n varying lowp vec4 v_color;\n#endif\nvoid main () {\n StandardVertInput In;\n CCVertInput(In);\n #if CC_USE_ATTRIBUTE_COLOR\n v_color = In.color;\n #endif\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n v_uv0 = In.uv * mainTiling + mainOffset;\n #endif\n gl_Position = cc_matViewProj * cc_matWorld * In.position;\n}","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvec4 CCFragOutput (vec4 color) {\n #if OUTPUT_TO_GAMMA\n color.rgb = sqrt(color.rgb);\n #endif\n\treturn color;\n}\nuniform lowp vec4 diffuseColor;\n#if USE_DIFFUSE_TEXTURE\n uniform sampler2D diffuseTexture;\n#endif\n#if CC_USE_ATTRIBUTE_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n varying mediump vec2 v_uv0;\n#endif\nvoid main () {\n vec4 color = diffuseColor;\n #if CC_USE_ATTRIBUTE_UV0 && USE_DIFFUSE_TEXTURE\n vec4 diffuseTexture_tmp = texture2D(diffuseTexture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_diffuseTexture\n diffuseTexture_tmp.a *= texture2D(diffuseTexture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (diffuseTexture_tmp.rgb * diffuseTexture_tmp.rgb);\n color.a *= diffuseTexture_tmp.a;\n #else\n color *= diffuseTexture_tmp;\n #endif\n #endif\n #if CC_USE_ATTRIBUTE_COLOR\n color *= v_color;\n #endif\n ALPHA_TEST(color);\n gl_FragColor = CCFragOutput(color);\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"CC_USE_SKINNING","type":"boolean","defines":[]},{"name":"CC_USE_JOINTS_TEXTRUE","type":"boolean","defines":["CC_USE_SKINNING"]},{"name":"CC_JOINTS_TEXTURE_FLOAT32","type":"boolean","defines":["CC_USE_SKINNING","CC_USE_JOINTS_TEXTRUE"]},{"name":"CC_USE_ATTRIBUTE_UV0","type":"boolean","defines":[]},{"name":"CC_USE_ATTRIBUTE_COLOR","type":"boolean","defines":[]},{"name":"CC_USE_ATTRIBUTE_NORMAL","type":"boolean","defines":[]},{"name":"CC_USE_ATTRIBUTE_TANGENT","type":"boolean","defines":[]},{"name":"USE_DIFFUSE_TEXTURE","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"OUTPUT_TO_GAMMA","type":"boolean","defines":[]},{"name":"CC_USE_ALPHA_ATLAS_diffuseTexture","type":"boolean","defines":["CC_USE_ATTRIBUTE_UV0","USE_DIFFUSE_TEXTURE"]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":["CC_USE_ATTRIBUTE_UV0","USE_DIFFUSE_TEXTURE"]}],"blocks":[{"name":"SKINNING","binding":0,"members":[{"name":"jointsTextureSize","type":14,"count":1}],"defines":["CC_USE_SKINNING","CC_USE_JOINTS_TEXTRUE"]},{"name":"JOINT_MATRIX","binding":1,"members":[{"name":"jointMatrices","type":26,"count":50}],"defines":["CC_USE_SKINNING"]},{"name":"MAIN_TILING","binding":2,"members":[{"name":"mainTiling","type":14,"count":1},{"name":"mainOffset","type":14,"count":1}],"defines":[]},{"name":"ALPHA_TEST","binding":3,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]},{"name":"UNLIT","binding":4,"members":[{"name":"diffuseColor","type":16,"count":1}],"defines":[]}],"samplers":[{"name":"jointsTexture","type":29,"count":1,"binding":30,"defines":["CC_USE_SKINNING","CC_USE_JOINTS_TEXTRUE"]},{"name":"diffuseTexture","type":29,"count":1,"binding":31,"defines":["USE_DIFFUSE_TEXTURE"]}]}],[{"name":"opaque","passes":[{"program":"builtin-unlit|unlit-vs|unlit-fs","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":true,"depthWrite":true},"properties":{"diffuseTexture":{"value":"white","type":29},"diffuseColor":{"type":16,"value":[1,1,1,1],"editor":{"type":"color"}},"alphaThreshold":{"type":13,"value":[0.5]},"mainTiling":{"type":14,"value":[1,1]},"mainOffset":{"type":14,"value":[0,0]}}}]},{"name":"transparent","passes":[{"stage":"transparent","program":"builtin-unlit|unlit-vs|unlit-fs","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":true,"depthWrite":true},"properties":{"diffuseTexture":{"value":"white","type":29},"diffuseColor":{"type":16,"value":[1,1,1,1],"editor":{"type":"color"}},"alphaThreshold":{"type":13,"value":[0.5]},"mainTiling":{"type":14,"value":[1,1]},"mainOffset":{"type":14,"value":[0,0]}}}]}]]],0,0,[],[],[]],[[[1,"builtin-2d-base",{}]],0,0,[0],[0],[1]],[[[1,"builtin-2d-spine",{}]],0,0,[0],[0],[5]],[[[1,"builtin-2d-graphics",{"0":{"defines":{}}}]],0,0,[0],[0],[6]],[[[0,"builtin-clear-stencil",[{"hash":2075641479,"record":null,"name":"builtin-clear-stencil|vs|fs","glsl3":{"vert":"\nprecision highp float;\nin vec3 a_position;\nvoid main () {\n gl_Position = vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nvoid main () {\n gl_FragColor = vec4(1.0);\n}"},"glsl1":{"vert":"\nprecision highp float;\nattribute vec3 a_position;\nvoid main () {\n gl_Position = vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nvoid main () {\n gl_FragColor = vec4(1.0);\n}"},"builtins":{"globals":{"blocks":[],"samplers":[]},"locals":{"blocks":[],"samplers":[]}},"defines":[],"blocks":[],"samplers":[]}],[{"passes":[{"program":"builtin-clear-stencil|vs|fs","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0}}]}]]],0,0,[],[],[]],[[[1,"builtin-clear-stencil",{}]],0,0,[0],[0],[7]],[[[1,"builtin-2d-label",{"0":{"defines":{"USE_TEXTURE":true}}}]],0,0,[0],[0],[8]],[[[1,"builtin-2d-sprite",{"0":{"defines":{"USE_TEXTURE":true}}}]],0,0,[0],[0],[1]],[[[0,"builtin-2d-label",[{"hash":1105459032,"record":null,"name":"builtin-2d-label|vs|fs","glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}","frag":"\n#if CC_SUPPORT_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_SDF\nuniform Outline {\n vec4 outlineColor;\n float outlineSize;\n};\n#endif\nvoid main () {\n#if USE_SDF\n #if USE_TEXTURE_ALPHAONLY\n float dist = texture(texture, v_uv0).a;\n #else\n float dist = texture(texture, v_uv0).r;\n #endif\n #if USE_SDF_EXTEND\n const float EDGE_VALUE = 0.45;\n #else\n const float EDGE_VALUE = 0.5;\n #endif\n #if CC_SUPPORT_standard_derivatives\n float smoothing = fwidth(dist);\n #else\n float smoothing = 0.05;\n #endif\n float outEdge = EDGE_VALUE - outlineSize;\n float bg = smoothstep(outEdge - smoothing, outEdge, dist);\n float fg = smoothstep(EDGE_VALUE - smoothing, EDGE_VALUE, dist);\n vec4 fgColor = outlineColor * (1.0 - fg) + v_color * fg;\n gl_FragColor = vec4(fgColor.rgb, fgColor.a * bg);\n#else\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_TEXTURE_ALPHAONLY\n o.a *= texture(texture, v_uv0).a;\n #else\n o *= texture(texture, v_uv0);\n #endif\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n#endif\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}","frag":"\n#if CC_SUPPORT_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_SDF\nuniform vec4 outlineColor;\nuniform float outlineSize;\n#endif\nvoid main () {\n#if USE_SDF\n #if USE_TEXTURE_ALPHAONLY\n float dist = texture2D(texture, v_uv0).a;\n #else\n float dist = texture2D(texture, v_uv0).r;\n #endif\n #if USE_SDF_EXTEND\n const float EDGE_VALUE = 0.45;\n #else\n const float EDGE_VALUE = 0.5;\n #endif\n #if CC_SUPPORT_standard_derivatives\n float smoothing = fwidth(dist);\n #else\n float smoothing = 0.05;\n #endif\n float outEdge = EDGE_VALUE - outlineSize;\n float bg = smoothstep(outEdge - smoothing, outEdge, dist);\n float fg = smoothstep(EDGE_VALUE - smoothing, EDGE_VALUE, dist);\n vec4 fgColor = outlineColor * (1.0 - fg) + v_color * fg;\n gl_FragColor = vec4(fgColor.rgb, fgColor.a * bg);\n#else\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_TEXTURE_ALPHAONLY\n o.a *= texture2D(texture, v_uv0).a;\n #else\n o *= texture2D(texture, v_uv0);\n #endif\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n#endif\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"USE_TEXTURE","type":"boolean","defines":[]},{"name":"CC_USE_MODEL","type":"boolean","defines":[]},{"name":"CC_SUPPORT_standard_derivatives","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"USE_SDF","type":"boolean","defines":[]},{"name":"USE_TEXTURE_ALPHAONLY","type":"boolean","defines":["USE_SDF"]},{"name":"USE_SDF_EXTEND","type":"boolean","defines":["USE_SDF"]},{"name":"CC_USE_ALPHA_ATLAS_TEXTURE","type":"boolean","defines":["USE_TEXTURE"]}],"blocks":[{"name":"ALPHA_TEST","binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]},{"name":"Outline","binding":1,"members":[{"name":"outlineColor","type":16,"count":1},{"name":"outlineSize","type":13,"count":1}],"defines":["USE_SDF"]}],"samplers":[{"name":"texture","type":29,"count":1,"binding":30,"defines":["USE_TEXTURE"]}]}],[{"passes":[{"program":"builtin-2d-label|vs|fs","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"properties":{"texture":{"value":"white","type":29},"alphaThreshold":{"type":13,"value":[0.5]},"outlineSize":{"type":13,"value":[0]},"outlineColor":{"type":16,"value":[1,1,1,1]}}}]}]]],0,0,[],[],[]]]] \ No newline at end of file diff --git a/assets/internal/index.803f8.js b/assets/internal/index.803f8.js new file mode 100644 index 0000000..3c6e1e1 --- /dev/null +++ b/assets/internal/index.803f8.js @@ -0,0 +1 @@ +(function r(e,n,t){function i(u,f){if(!n[u]){if(!e[u]){var _=u.split("/");if(_=_[_.length-1],!e[_]){var p="function"==typeof __require&&__require;if(!f&&p)return p(_,!0);if(o)return o(_,!0);throw new Error("Cannot find module '"+u+"'")}u=_}var a=n[u]={exports:{}};e[u][0].call(a.exports,function(r){return i(e[u][1][r]||r)},a,a.exports,r,e,n,t)}return n[u].exports}for(var o="function"==typeof __require&&__require,u=0;u t ? -1 : 1; + Math.abs(t - o) > a && (s = a, + c *= Math.abs(t - o) / a), + e.node.runAction(cc.sequence(cc.callFunc(function() { + n >= s - 1 ? e.string = i ? ToolsJs.getStrForNum2(t) : t : (o += Math.floor(c), + e.string = i ? ToolsJs.getStrForNum2(o) : Math.floor(o)), + n++ + }), cc.delayTime(.02)).repeat(s)) + } + }, + openUIAni: function(e, t, a, i) { + void 0 === a && (a = .3), + e.opacity = 0, + t.scale = 0, + e.runAction(cc.fadeTo(a, 100)), + t.runAction(cc.sequence(cc.scaleTo(a, 1).easing(cc.easeBackOut()), cc.callFunc(i))) + }, + closeUIAni: function(e, t, a, i) { + void 0 === a && (a = .2), + e.runAction(cc.fadeOut(a)), + t.runAction(cc.sequence(cc.scaleTo(a, 0).easing(cc.easeBackIn()), cc.callFunc(i), cc.removeSelf(!0))) + }, + sortFadeInArr: function(e, t, a) { + void 0 === t && (t = .3), + void 0 === a && (a = .02); + for (var i = 0; i < e.length; i++) { + var o = e[i]; + o.opacity = 0, + o.runAction(cc.sequence(cc.delayTime(a * i), cc.fadeIn(t))) + } + }, + jumpByDegressAni: function(e, t, a, i, o, n) { + void 0 === a && (a = 0), + void 0 === n && (n = 0); + var s = cc.misc.degreesToRadians(t) + , c = cc.v2(Math.cos(s) * i, Math.sin(s) * i) + , r = i / o; + e.runAction(cc.sequence(cc.delayTime(n), cc.jumpBy(r, cc.v2(1.5 * c.x, a), i, 1), cc.removeSelf(!0))) + }, + moveDegressAni: function(e, t, a, i, o, n) { + t = t || this.returnRanNum(-180, 180); + var s = cc.misc.degreesToRadians(t) + , c = cc.v2(Math.cos(s) * a, Math.sin(s) * a) + , r = a / i + , h = o ? 0 : e.scale + , l = n ? 0 : e.opacity; + e.runAction(cc.sequence(cc.spawn(cc.scaleTo(r + .1, h), cc.moveBy(r, c).easing(cc.easeQuadraticActionOut()), cc.fadeTo(r + .1, l)), cc.fadeOut(.1), cc.removeSelf(!0))) + }, + moveByOutInit: function(e, t, a, i) { + void 0 === t && (t = .5), + void 0 === a && (a = 0), + void 0 === i && (i = 0), + e.x += a, + e.y += i, + e.runAction(cc.moveBy(t, cc.v2(-a, -i)).easing(cc.easeBackOut())) + }, + sprRedAni: function(e, t, a, i) { + var o = 0; + e.runAction(cc.sequence(cc.delayTime(t), cc.callFunc(function(e) { + e.color = cc.Color.RED + }), cc.delayTime(t), cc.callFunc(function(e) { + e.color = cc.Color.WHITE, + ++o >= a && null != i && i() + })).repeat(a)) + }, + shakeAni: function(e, t, a, i, o) { + void 0 === a && (a = 10), + void 0 === i && (i = .1), + void 0 === o && (o = 2); + var n = cc.sequence(cc.rotateBy(i, a), cc.rotateBy(i, -a), cc.rotateBy(i, -a), cc.rotateBy(i, a), cc.rotateBy(i, a), cc.rotateBy(i, -a), cc.delayTime(o)); + t ? e.runAction(n.repeatForever()) : e.runAction(n) + }, + playAni: function(e, t) { + e.getComponent(cc.Animation).play(t) + }, + stopAni: function(e, t) { + e.getComponent(cc.Animation).stop(t) + }, + addNodeAni: function(e, t, a, i, o, n, s) { + var c = e.getComponent(cc.Animation); + null == c && (c = e.addComponent(cc.Animation)); + var r = []; + if (ToolsJs.SpriteFrameDic[t + i]) { + for (var h = i; h <= o; h++) { + var l = ToolsJs.SpriteFrameDic[t + h]; + r.push(l) + } + this.addClipForAnimaton(c, r, a, s, n) + } else + for (var m = this, d = 0, u = o - i + 1, g = function(e) { + cc.loader.loadRes(t + e, cc.SpriteFrame, function(t, i) { + i && (d++, + i.index = e, + r.push(i)), + d >= u && (ToolsJs.sortArrForObject(r, "index"), + m.addClipForAnimaton(c, r, a, s, n)) + }) + }, p = i; p <= o; p++) + g(p) + }, + addClipForAnimaton: function(e, t, a, i, o) { + var n = cc.AnimationClip.createWithSpriteFrames(t, t.length); + n.name = a, + n.speed = i, + n.wrapMode = o ? cc.WrapMode.Loop : cc.WrapMode.Normal, + e.addClip(n) + }, + returnRanNum: function(e, t) { + return e + Math.floor(Math.random() * (t - e + 1)) + } + }; + window.AniTools = a, + cc._RF.pop() + } + , {}], + EventData: [function(e, t) { + "use strict"; + cc._RF.push(t, "00f19xAv/JGmKf/MZ/AWHni", "EventData"), + window.EventData = { + UPDATE_GLOD: "updateGlod" + }, + cc._RF.pop() + } + , {}], + EventManager: [function(e, t) { + "use strict"; + cc._RF.push(t, "94634X4eDVNUoEnqKm3D5/S", "EventManager"); + var a = { + addListener: function(e, t, a) { + cc.systemEvent.on(e, t, a) + }, + removeListener: function(e, t, a) { + cc.systemEvent.off(e, t, a) + }, + dispachEvent: function(e, t, a, i, o, n) { + cc.systemEvent.emit(e, t, a, i, o, n) + }, + removeListenerForTarget: function(e) { + cc.systemEvent.targetOff(e) + } + }; + window.EventManager = a, + cc._RF.pop() + } + , {}], + GameConfig: [function(e, t) { + "use strict"; + cc._RF.push(t, "f0663sWtfNKCKOL+Hvnt0cI", "GameConfig"); + var a = { + GameClubButton: null, + GameScene: null, + launchScene: null, + Bros: null, + caS: null, + MAIN_MENU_NUM: "Classic", + gameScore: 0, + standScore: 6, + GAME_OVER_BOOL: !0, + publicGameBool: !1, + ranLinkData: null, + recGameData: null, + InfoData: null, + endShow0: null, + endShow1: null, + endShow2: null, + endShow3: null, + infoGameName: null, + showText: null, + startText: null, + moreGameText: null, + playAgainText: null, + playNum: 0, + curType: 2, + noTouchBool: !0, + enterGameNum: 0, + enterGameFlags: !1, + returnRanNum: function(e, t) { + return e + Math.floor(Math.random() * (t - e + 1)) + }, + getAngle: function(e, t, a, i) { + var o = Math.abs(e - a) + , n = Math.abs(t - i) + , s = n / Math.sqrt(Math.pow(o, 2) + Math.pow(n, 2)) + , c = Math.acos(s) + , r = 180 / (Math.PI / c); + return t > i && (r = 180 - r), + e > a && (r *= -1), + r + }, + setLocalStorage: function(e, t) { + cc.sys.localStorage.setItem(e, t) + }, + getLocalStorage: function(e) { + return cc.sys.localStorage.getItem(e) + } + }; + t.exports = a, + cc._RF.pop() + } + , {}], + GameUiTools: [function(e, t) { + "use strict"; + cc._RF.push(t, "b21e8tF461OFalpptyeuAE2", "GameUiTools"), + e("GameConfig"); + var a = { + newSprite: function(e, t) { + var a = new cc.Node; + return t ? (e = e.split(".")[0], + a.addComponent(cc.Sprite).spriteFrame = GameTools.love2048FrameCache.getSpriteFrame(e)) : a.addComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame("res/raw-assets/resources/" + e), + a + }, + setNodeSpriteFrame: function(e, t) { + e.getComponent(cc.Sprite).spriteFrame = GameTools.love2048FrameCache.getSpriteFrame(t) + }, + setButtonClickEvents: function(e, t, a, i, o) { + var n = new Array; + null == t.length ? n[0] = t : n = t; + for (var s = 0; s < n.length; s++) { + var c = new cc.Component.EventHandler; + c.target = e.node, + c.component = e.node.name, + c.handler = a, + null == t.length ? c.customEventData = i : c.customEventData = s; + var r = n[s].addComponent(cc.Button); + r.clickEvents.push(c), + (null == o || o) && (r.transition = cc.Button.Transition.SCALE, + r.duration = .1, + r.zoomScale = 1.2) + } + }, + scheduleOnce: function(e, t, a) { + e.runAction(cc.sequence(cc.delayTime(a), cc.callFunc(t, e))) + }, + loadingScene: function(e, t) { + t ? cc.loader.loadRes("panel/LoadingLayer", function(t, a) { + var i = cc.instantiate(a); + cc.director.getScene().children[0].addChild(i), + cc.director.preloadScene(e, function() { + cc.director.loadScene(e) + }) + }) : cc.director.preloadScene(e, function() { + cc.director.loadScene(e) + }) + }, + loadingLayer: function(e) { + cc.loader.loadRes(e, function(e, t) { + if (!e) { + var a = cc.instantiate(t); + cc.director.getScene().children[0].addChild(a, 100) + } + }) + } + }; + t.exports = a, + cc._RF.pop() + } + , { + GameConfig: "GameConfig" + }], + HttpManagerJs: [function(e, t) { + "use strict"; + var a; + cc._RF.push(t, "197e1hfNnxIcJx73V3VhUxY", "HttpManagerJs"); + var i = e("GameConfig") + , o = ((a = { + URL: "http://g.vsane.com/Service/Share/index", + cacheList: null, + isBusy: null, + req: null, + perform: null, + retGameId: 0 + }).cacheList = [], + a.ctor = function() {} + , + a.checkHave = function() { + this.isBusy || this.sendOne() + } + , + a.httpInitUrl = function(e) { + var t = window.location.href + , a = t.substring(0, t.lastIndexOf("//") + 2) + window.location.host + "/Service/Share/index"; + this.URL = a, + console.log("data", this.URL), + this.retGameId = e + } + , + a.send = function(e, t, a, i) { + this.cacheList.push({ + type: e, + data: t, + func: a, + target: i + }), + this.isBusy || this.sendOne() + } + , + a.sendOne = function() { + if (0 != this.cacheList.length) { + this.isBusy = !0, + this.perform = this.cacheList.shift(), + this.req = cc.loader.getXMLHttpRequest(), + this.req.onreadystatechange = this.onDataHandler.bind(this), + this.req.onerror = this.onErrorHandler.bind(this), + this.req.ontimeout = this.onTimeoutHandler.bind(this), + this.req.timeout = 2e3, + cc.log("pos", this.URL), + this.req.open("POST", this.URL), + this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); + var e = this.returnLanguage(); + console.log("gameIdid", this.retGameId); + var t = this.retGameId + , a = { + type: this.perform.type, + gid: t, + mid: null, + data: this.perform.data, + languageType: e + } + , i = "send=" + JSON.stringify(a); + this.req.send(i) + } + } + , + a.onDataHandler = function() { + if (404 != this.req.status) { + if (4 == this.req.readyState && this.req.status >= 200 && this.req.status <= 207 && this.req.responseText) { + var e = JSON.parse(this.req.responseText); + this.isBusy = !1, + this.perform.target ? this.perform.func.call(this.perform.target, e.error, e.data, e.commendGame, e.gameInfo) : this.perform.func(e) + } + } else { + var t = i.launchScene + , a = i.Bros; + i.caS, + cc.director.loadScene(t, null, function() { + if (a) { + var e = document.getElementById("GameDiv"); + e && (e.style.backgroundImage = "") + } + cc.loader.onProgress = null, + console.log("Success to load scene: " + t) + }) + } + } + , + a.returnLanguage = function() { + return ("" + window.navigator.language).toLocaleLowerCase() + } + , + a.onErrorHandler = function() { + cc.log("\u7f51\u7edc\u9519\u8bef"), + this.isBusy = !1, + this.perform.target ? this.perform.func.call(this.perform.target, -1) : this.perform.func(-1) + } + , + a.onTimeoutHandler = function() { + cc.log("\u8bf7\u6c42\u8d85\u65f6"), + this.isBusy = !1, + this.perform.target ? this.perform.func.call(this.perform.target, -1) : this.perform.func(-1) + } + , + a.clearAll = function() { + for (var e = this.cacheList.length, t = 0; t < e; t++) { + var a = this.cacheList[t]; + a && (a.target ? a.func.call(a.target, -1) : a.func(-1)) + } + this.cacheList.length = 0 + } + , + a); + t.exports = o, + cc._RF.pop() + } + , { + GameConfig: "GameConfig" + }], + LanguageSetJs: [function(e, t) { + "use strict"; + cc._RF.push(t, "4754e8KuPZJCqklCNyKpG29", "LanguageSetJs"), + t.exports = { + language_1: { + game_name: "\u300c\u53ec\u5524\u795e\u9f99\u300d", + game_name1: "\u53ec\u5524\u795e\u9f99", + game_info: "\u70b9\u51fb\u5c4f\u5e55\u4e32\u73e0\u5b50\uff0c\u4e24\u4e2a\u76f8\u540c\u7ea7\u522b\u7684\u73e0\u5b50\u4f1a\u5408\u6210\u66f4\u9ad8\u7ea7\u7684\u73e0\u5b50\u3002", + txtStart: "\u5f00\u59cb", + txtMore: "\u66f4\u591a\u6e38\u620f", + txtAgain: "\u518d\u73a9\u4e00\u6b21", + txtShare1: "\u5728\u6e38\u620f\u4e2d ", + txtShare2: "\u5f97\u5206\u4e86\uff0c\u597d\u554a!\u4f60\u548c\u6211\u4e00\u8d77\u6765\u6bd4\u8d5b!", + bgRgb: "#3698C5", + gameT1: "\u5173\u6ce8\u6211\u4eec", + gameT2: "\u7eb8\u724c\u63a5\u9f99", + gameT3: "\u9526\u4e0a\u6dfb\u82b1", + gameUrl1: "http://g.regogame.com/game/9/", + gameUrl2: "http://g.regogame.com/game/3/", + gameT11: "\u5173\u6ce8\u5fae\u4fe1", + gameT12: "\u5173\u6ce8Kakao", + gameT13: "\u5173\u6ce8Line", + gameEndL: "\u6e38 \u620f \u7ed3 \u675f", + gameEndL1: "\u7a0d \u5019 \u67e5 \u770b \u5206 \u6570" + }, + language_2: { + game_name: "\u300cDragon Merge\u300d", + game_name1: "Dragon Merge", + game_info: "Tap the screen to string beads, and two beads of the same level will synthesize more advanced beads.", + txtStart: "Start", + txtMore: "More Game", + txtAgain: "Play Again", + txtShare1: "In Game ", + txtShare2: " Let's play together!", + bgRgb: "#3698C5", + gameT1: "Follow Us", + gameT2: "Thousand Flower", + gameT3: "Eliminate Star", + gameUrl1: "http://g.fromgame.com/game/53", + gameUrl2: "http://g.fromgame.com/game/13", + gameT11: "Focus WeChat", + gameT12: "Focus Kakao", + gameT13: "Focus Line", + gameEndL: "Game OVer", + gameEndL1: "View the score later" + } + }, + cc._RF.pop() + } + , {}], + LoadSceneJs: [function(e, t) { + "use strict"; + cc._RF.push(t, "3ef908fwfNIwJsOjET8tCh2", "LoadSceneJs"); + var a = { + goToCover: function(e, t, a, i, o) { + var n = e; + n = null == n || null == n || e, + console.log("LoadBoolBeforeLoadS", n), + this.needShow = !1, + n && n ? (this.needShow = !0, + showMyAds()) : this.needShow = !1, + this.needShow ? (null == preloader && this.startGoToGame(a, i, o), + resCompleteFlag = !0, + adCompleteFlag && resCompleteFlag && this.startGoToGame(a, i, o)) : this.startGoToGame(a, i, o) + }, + startGoToGame: function() { + console.log("goToScene"), + noAdGoToScene() + } + }; + t.exports = a, + cc._RF.pop() + } + , {}], + MainGameJS: [function(e, t) { + "use strict"; + cc._RF.push(t, "0e7a8SkMLxEY7nCB1Bqi8WZ", "MainGameJS"); + var a = e("GameConfig") + , i = e("GameUiTools") + , o = e("MainManage") + , n = (e("mTool_WHQ"), + e("../commonJs/GameConfig").gameScore, + e("../commonJs/GameUiTools")) + , s = (n.scheduleOnce, + n.setNodeSpriteFrame, + e("../commonJs/mTool_WHQ")); + e("../MainManage").endHttpShowInfo, + cc.Class({ + extends: cc.Component, + properties: { + startBgNode: cc.Node, + sceneScore: cc.Label, + gameOverT1: cc.Label, + gameOverT2: cc.Label, + nameLabel: cc.Label, + blackLayerPre: cc.Node, + enemyNode: cc.Node, + playerNode: cc.Node, + leafNode: cc.Node, + carmeraNode: cc.Node, + liziNode: cc.Node, + stoneNode: cc.Node, + gameOverPre: cc.Prefab, + leafPre: cc.Prefab, + enemyPreArr: [cc.Prefab], + newFishPreArr: [cc.Prefab], + BGPre: cc.Prefab, + bianjiePre: cc.Prefab, + BubblePre: cc.Prefab, + PanlongPre: cc.Prefab, + bowenPre: cc.Prefab, + bloodPre: cc.Prefab, + replayButtonPre: cc.Prefab, + mainBtnPre: cc.Prefab, + ripplePre: cc.Prefab, + liziPre: cc.Prefab, + starPre: cc.Prefab, + lightPre: cc.Prefab, + eatMusic: { + default: null, + type: cc.AudioClip + }, + HurtMusic: { + default: null, + type: cc.AudioClip + }, + failMusic: { + default: null, + type: cc.AudioClip + } + }, + judgeCurPlatform: function() { + console.log(navigator.userAgent); + var e, t, a, i, o, n, s, c = (e = navigator.userAgent, + t = /(?:Windows Phone)/.test(e), + a = /(?:SymbianOS)/.test(e) || t, + i = /(?:Android)/.test(e), + o = /(?:Firefox)/.test(e), + /(?:Chrome|CriOS)/.test(e), + { + isTablet: n = /(?:iPad|PlayBook)/.test(e) || i && !/(?:Mobile)/.test(e) || o && /(?:Tablet)/.test(e), + isPhone: s = /(?:iPhone)/.test(e) && !n, + isAndroid: i, + isPc: !s && !i && !a + }); + c.isAndroid || c.isPhone ? this.platFromNum = 1 : c.isTablet ? this.platFromNum = 2 : c.isPc && (this.platFromNum = 3) + }, + adapterScreen: function() { + var e = cc.find("Canvas").getComponent(cc.Canvas); + 2 == this.platFromNum || 3 == this.platFromNum ? (e.fitWidth = !0, + e.fitHeight = !0) : (e.fitWidth = !0, + e.fitHeight = !1) + }, + onLoad: function() { + a.publicGameBool ? o.init() : finishLoad(), + this.platFromNum = 1, + this.judgeCurPlatform(), + this.adapterScreen(), + this.gameOveEndBool = !1, + this.gameOverNum = 0, + this.gameWidth = cc.winSize.width, + this.gameHeight = cc.winSize.height, + a.curType = this.returnCurrentLanType(), + a.playNum >= 1 && (this.startBgNode.active = !1), + a.playNum++, + cc.log(a.playNum), + this.addTouchEvents(), + i.loadingLayer("panel/LinkIconSpr"), + cc.director.getCollisionManager().enabled = !0, + cc.director.getCollisionManager().enabledDebugDraw = !0, + this.touchBeginFlags = !0, + this.Hscale = 1280 / this.gameHeight, + this.Wscale = 720 / this.gameWidth, + this.SizeScale = 0, + this.Hscale >= this.Wscale ? this.SizeScale = this.Wscale : this.SizeScale = this.Hscale, + a.publicGameBool || this.play(), + this.canCreateDisX = 0, + this.canCreateDisY = 0, + this.OffPos = null, + this.speedNum = 400 / this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio, + this.speed = this.speedNum, + this.BGNum = 9, + this.kedouArr = [], + this.qingwaArr = [], + this.haiguiArr = [], + this.xiaojinyuArr = [], + this.jinliArr = [], + this.dianmanArr = [], + this.shayuArr = [], + this.jingyuArr = [], + this.jiaoArr = [], + this.longArr = [], + this.tempArr = [], + this.BGArr = [], + this.fishScaleX = [], + this.fishScaleY = [], + this.myFish = null, + this.lightFlags = !1, + this.boolFlags = !1, + this.gameOverFlags = !1, + this.canMoveFlags = !0, + this.firstFlags = !0, + this.BGNode = cc.find("Canvas/bgLayer"), + this.scale = .4 * this.SizeScale; + for (var e = 0; e < this.playerNode.children.length - 1; e++) + this.changeSize(this.playerNode.children[e]); + this.playerNode.typeID = 1, + this.createMap(), + this.maxCameraMovePosX = Math.abs(this.BGArr[0][this.BGNum - 1].x) - this.gameWidth, + this.maxCameraMovePosY = Math.abs(this.BGArr[0][this.BGNum - 1].y) - this.gameHeight / 2; + for (var t = 0; t < this.leafNode.children.length; t++) { + var n = this.leafNode.children[t].position + , s = 200 * this.SizeScale * this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio; + (n.x > this.maxCameraMovePosX - s || n.x < -this.maxCameraMovePosX + s || n.y > this.maxCameraMovePosY - s || n.y < -this.maxCameraMovePosY + s) && (this.leafNode.children[t].opacity = 180) + } + this.myFish = this.playerNode.getChildByName("kedou"), + this.CreateEnemy(60), + this.waterCount = 0, + this.randnum = 10, + this.angle = 0, + this.rotSpeed = 1500, + this.addSpeed = 65, + this.maxTypeID = 1, + this.canTouchReplay = !1; + for (var c = 0; c < 9; c++) { + var r = this.playerNode.children[c].scaleX; + this.fishScaleX.push(r) + } + for (var h = 0; h < 9; h++) { + var l = this.playerNode.children[h].scaleY; + this.fishScaleY.push(l) + } + this.jingyuNum = 0, + this.jiaoNum = 0, + this.Wu = cc.find("Canvas/Wu"), + this.light1 = cc.find("Canvas/light1"), + this.light2 = cc.find("Canvas/light2"), + this.Wu.width = this.gameWidth, + this.Wu.height = this.gameHeight, + this.stoneNode.zIndex = 50, + this.Wu.setPosition(cc.v2(0, 0)), + this.Wu.zIndex = 1e3, + this.light1.zIndex = 1200, + this.light2.zIndex = 1300, + this.LightNumCount = 0, + this.lightjudeTime = 0, + this.playerNode.zIndex = 9999, + this.leafNode.zIndex = 1e4 + }, + start: function() {}, + play: function() { + console.log(1); + var e = this; + e.enableButtons(); + }, + enableButtons: function() {}, + returnCurrentLanType: function() { + var e = 1; + switch (cc.sys.language) { + case cc.sys.LANGUAGE_CHINESE: + "zh-TW" == window.navigator.language || "zh-tw" == window.navigator.language || "zh-HK" == window.navigator.language || "zh-hk" == window.navigator.language ? (cc.log("\u7e41\u4f53"), + e = 2) : (cc.log("\u7b80\u4f53"), + e = 1); + break; + case cc.sys.LANGUAGE_KOREAN: + e = 4; + break; + default: + e = 3 + } + return e + }, + changeSize: function(e) { + e.scaleX = (e.scaleX - .1) * this.SizeScale, + e.scaleY = (e.scaleY - .1) * this.SizeScale + }, + CreateBG: function() { + for (var e = this.BGNum, t = 0; t < e; t++) { + for (var a = [], i = 0; i < e; i++) { + var o = cc.instantiate(this.BGPre); + this.BGNode.addChild(o), + o.width = this.gameHeight, + o.height = this.gameHeight; + var n = o.width + , c = o.height; + this.canCreateDisX = n * e / 2 - n, + this.canCreateDisY = c * e / 2 - c; + var r = cc.v2(-n * Math.floor(e / 2), c * Math.floor(e / 2)) + , h = cc.v2(r.x + n * t, r.y - c * i); + if (o.setPosition(h), + a.push(o), + t > 0 && t < e - 1 && i > 0 && i < e - 1) { + var l = s.getRandomNum(0, 1, !0); + this.CreateLeaf(l, o) + } + } + this.BGArr.push(a) + } + }, + getCreatePos: function(e, t) { + void 0 === t && (t = 0); + var a = e.width + , i = e.height + , o = s.getRandomNum(-a / 4, a / 4, !1) + , n = s.getRandomNum(-i / 4, i / 4, !1) + , c = cc.v2(o + e.x, n + e.y) + , r = this.leafNode.convertToNodeSpaceAR(this.BGNode.convertToWorldSpaceAR(c)); + if (++t > 100) + return null; + for (var h = 0; h < this.leafNode.children.length; h++) + if (s.pDistance(r, this.leafNode.children[h].position) < 400) + return this.getCreatePos(e, t); + return r + }, + CreateLeaf: function(e, t) { + for (var a = 0; a < e; a++) { + var i = cc.instantiate(this.leafPre) + , o = s.getRandomNum(1, 2, !0) + , n = s.getRandomNum(1, 2, !1) * this.SizeScale; + i.scaleX = n, + i.scaleY = n, + i.angle = s.getRandomNum(-30, 30, !1), + ToolsJs.setTexture(i, "leaf" + o), + this.leafNode.addChild(i); + var c = this.getCreatePos(t); + c ? i.setPosition(c) : i.destroy() + } + }, + CreateBianJie: function() { + for (var e = 1; e < this.BGNum - 1; e++) + if (e == Math.floor(this.BGNum / 2)) { + var t = cc.instantiate(this.bianjiePre); + ToolsJs.setTexture(t, "bian"), + this.BGNode.addChild(t, 100); + var a = this.BGArr[0][e].position; + t.width = 1.8 * this.gameHeight, + t.height = 1.8 * this.gameHeight, + t.angle = 90, + t.setPosition(cc.v2(a.x - this.gameHeight / 4, a.y)), + ToolsJs.setNodeParent(t, this.node), + t.zIndex = 100 + } + for (var i = 1; i < this.BGNum - 1; i++) + if (i == Math.floor(this.BGNum / 2)) { + var o = cc.instantiate(this.bianjiePre); + ToolsJs.setTexture(o, "bian"), + this.BGNode.addChild(o, 100); + var n = this.BGArr[this.BGNum - 1][i].position; + o.width = 1.8 * this.gameHeight, + o.height = 1.8 * this.gameHeight, + o.angle = -90, + o.setPosition(cc.v2(n.x + this.gameHeight / 4, n.y)), + ToolsJs.setNodeParent(o, this.node), + o.zIndex = 100 + } + for (var s = 1; s < this.BGNum - 1; s++) + if (s == Math.floor(this.BGNum / 2)) { + var c = cc.instantiate(this.bianjiePre); + ToolsJs.setTexture(c, "bian"), + this.BGNode.addChild(c, 100); + var r = this.BGArr[s][0].position; + c.width = 1.8 * this.gameHeight, + c.height = 1.8 * this.gameHeight, + c.angle = 0, + c.setPosition(cc.v2(r.x, r.y + this.gameHeight / 4)), + ToolsJs.setNodeParent(c, this.node), + c.zIndex = 100 + } + for (var h = 1; h < this.BGNum - 1; h++) + if (h == Math.floor(this.BGNum / 2)) { + var l = cc.instantiate(this.bianjiePre); + ToolsJs.setTexture(l, "bian"), + this.BGNode.addChild(l, 100); + var m = this.BGArr[h][this.BGNum - 1].position; + l.width = 1.8 * this.gameHeight, + l.height = 1.8 * this.gameHeight, + l.angle = 180, + l.setPosition(cc.v2(m.x, m.y - this.gameHeight / 4)), + ToolsJs.setNodeParent(l, this.node), + l.zIndex = 100 + } + for (var d = 0; d < 4; d++) { + var u = cc.instantiate(this.bianjiePre); + if (this.BGNode.addChild(u, 300 + d), + u.width = 6 * this.gameHeight, + u.height = 6 * this.gameHeight, + 0 == d) { + var g = this.BGArr[0][0].position; + u.angle = 0, + u.setPosition(cc.v2(g.x + this.gameHeight / 3, g.y - this.gameHeight / 3)) + } + if (1 == d) { + var p = this.BGArr[0][this.BGNum - 1].position; + u.angle = 90, + u.setPosition(cc.v2(p.x + this.gameHeight / 3, p.y + this.gameHeight / 3)) + } + if (2 == d) { + var f = this.BGArr[this.BGNum - 1][0].position; + u.angle = -90, + u.setPosition(cc.v2(f.x - this.gameHeight / 3, f.y - this.gameHeight / 3)) + } + if (3 == d) { + var y = this.BGArr[this.BGNum - 1][this.BGNum - 1].position; + u.angle = 180, + u.setPosition(cc.v2(y.x - this.gameHeight / 3, y.y + this.gameHeight / 3)) + } + ToolsJs.setNodeParent(u, this.node), + u.zIndex = 100 + } + }, + createMap: function() { + this.CreateBG(), + this.CreateBianJie(); + var e = cc.instantiate(this.enemyPreArr[0]); + this.enemyNode.addChild(e), + this.changeSize(e), + e.typeID = 1, + e.speed = 100; + var t = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)) + , a = s.getRandomNum(this.gameWidth / 3, 3 * this.gameWidth / 4, !1) + , i = 360 * Math.random() + , o = s.getCircumferencePos(t, a, i); + e.setPosition(o), + this.enemyAction(e) + }, + CameraMove: function(e) { + if (!this.gameOverFlags) { + var t = this.playerNode + , a = 0 + , i = 0; + if (t.x <= -this.maxCameraMovePosX || t.x >= this.maxCameraMovePosX || t.y <= -this.maxCameraMovePosY || t.y >= this.maxCameraMovePosY) { + var o = t.x + this.OffPos.x * this.speed * e + , n = t.y + this.OffPos.y * this.speed * e; + o < -this.maxCameraMovePosX && n > -this.maxCameraMovePosY && n < this.maxCameraMovePosY ? (i = this.speedNum, + a = 0, + t.x = -this.maxCameraMovePosX) : o >= this.maxCameraMovePosX && n >= -this.maxCameraMovePosY && n <= this.maxCameraMovePosY ? (i = this.speedNum, + a = 0, + t.x = this.maxCameraMovePosX) : n >= this.maxCameraMovePosY && o >= -this.maxCameraMovePosX && o <= this.maxCameraMovePosX ? (a = this.speedNum, + i = 0, + t.y = this.maxCameraMovePosY) : n <= -this.maxCameraMovePosY && o >= -this.maxCameraMovePosX && o <= this.maxCameraMovePosX ? (a = this.speedNum, + i = 0, + t.y = -this.maxCameraMovePosY) : o <= -this.maxCameraMovePosX && n <= -this.maxCameraMovePosY ? (a = 0, + i = 0, + t.x = -this.maxCameraMovePosX, + t.y = -this.maxCameraMovePosY) : o <= -this.maxCameraMovePosX && n >= this.maxCameraMovePosY ? (a = 0, + i = 0, + t.x = -this.maxCameraMovePosX, + t.y = this.maxCameraMovePosY) : o >= this.maxCameraMovePosX && n <= -this.maxCameraMovePosY ? (a = 0, + i = 0, + t.x = this.maxCameraMovePosX, + t.y = -this.maxCameraMovePosY) : o >= this.maxCameraMovePosX && n >= this.maxCameraMovePosY ? (a = 0, + i = 0, + t.x = this.maxCameraMovePosX, + t.y = this.maxCameraMovePosY) : (a = this.speedNum, + i = this.speedNum) + } else + a = this.speedNum, + i = this.speedNum; + var s = cc.misc.degreesToRadians(this.angle); + t.x += Math.floor(-Math.sin(s) * a * e), + t.y += Math.floor(Math.cos(s) * i * e), + t.x >= -this.maxCameraMovePosX + this.gameWidth / 4 && t.x <= this.maxCameraMovePosX - this.gameWidth / 4 && t.y >= -this.maxCameraMovePosY + this.gameHeight / 4 && t.y <= this.maxCameraMovePosY - this.gameHeight / 4 ? this.carmeraNode.setPosition(t.position) : t.x > -this.maxCameraMovePosX + this.gameWidth / 4 && t.x < this.maxCameraMovePosX - this.gameWidth / 4 && t.y < -this.maxCameraMovePosY + this.gameHeight / 4 ? this.carmeraNode.setPosition(cc.v2(t.x, -this.maxCameraMovePosY + this.gameHeight / 4)) : t.x > -this.maxCameraMovePosX + this.gameWidth / 4 && t.x < this.maxCameraMovePosX - this.gameWidth / 4 && t.y > this.maxCameraMovePosY - this.gameHeight / 4 ? this.carmeraNode.setPosition(cc.v2(t.x, this.maxCameraMovePosY - this.gameHeight / 4)) : t.y > -this.maxCameraMovePosY + this.gameHeight / 4 && t.y < this.maxCameraMovePosY - this.gameHeight / 4 && t.x > this.maxCameraMovePosX - this.gameWidth / 4 ? this.carmeraNode.setPosition(cc.v2(this.maxCameraMovePosX - this.gameWidth / 4, t.y)) : t.y > -this.maxCameraMovePosY + this.gameHeight / 4 && t.y < this.maxCameraMovePosY - this.gameHeight / 4 && t.x < -this.maxCameraMovePosX + this.gameWidth / 4 ? this.carmeraNode.setPosition(cc.v2(-this.maxCameraMovePosX + this.gameWidth / 4, t.y)) : t.y >= this.maxCameraMovePosY - this.gameHeight / 4 && t.x < -this.maxCameraMovePosY + this.gameWidth / 4 ? this.carmeraNode.setPosition(cc.v2(-this.maxCameraMovePosX + this.gameWidth / 4, this.maxCameraMovePosY - this.gameHeight / 4)) : t.y > this.maxCameraMovePosY - this.gameHeight / 4 && t.x > this.maxCameraMovePosY - this.gameWidth / 4 ? this.carmeraNode.setPosition(cc.v2(this.maxCameraMovePosX - this.gameWidth / 4, this.maxCameraMovePosY - this.gameHeight / 4)) : t.y < -this.maxCameraMovePosY + this.gameHeight / 4 && t.x > this.maxCameraMovePosY - this.gameWidth / 4 ? this.carmeraNode.setPosition(cc.v2(this.maxCameraMovePosX - this.gameWidth / 4, -this.maxCameraMovePosY + this.gameHeight / 4)) : t.y < -this.maxCameraMovePosY + this.gameHeight / 4 && t.x < -this.maxCameraMovePosY + this.gameWidth / 4 && this.carmeraNode.setPosition(cc.v2(-this.maxCameraMovePosX + this.gameWidth / 4, -this.maxCameraMovePosY + this.gameHeight / 4)), + this.BubbleAction() + } + }, + CameraChangeZoomRatio: function(e, t) { + if (e != t) { + var a = this.carmeraNode.getChildByName("MoveCamera"); + a.stopAllActions(), + a.getComponent(cc.Camera).zoomRatio; + var i = !0; + t - e > 0 && (i = !1); + var o = Math.abs(t - e) + , n = Math.floor(o / .01); + a.runAction(cc.sequence(cc.callFunc(function() { + a.getComponent(cc.Camera).zoomRatio != t && (i ? a.getComponent(cc.Camera).zoomRatio -= .01 : a.getComponent(cc.Camera).zoomRatio += .01) + }, this), cc.delayTime(.005)).repeat(n)) + } + }, + getEnemyPos: function(e, t) { + if(!this.BGNode) return; + if (void 0 === t && (t = 0), + !this.gameOverFlags) { + var a = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio + , i = this.enemyNode.convertToNodeSpaceAR(this.BGNode.convertToWorldSpaceAR(this.BGArr[0][this.BGNum - 1].position)) + , o = Math.abs(i.x) - e.width - 400 + , n = Math.abs(i.y) - e.height - 400 + , c = s.getRandomNum(-o, o, !1) + , r = s.getRandomNum(-n, n, !1) + , h = cc.v2(); + if (this.firstFlags || (h = cc.v2(c, r)), + ++t > 100) { + var l = this.playerNode.position + , m = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)) + , d = 0 + , u = 0; + return l.x >= 0 && l.y >= 0 ? (d = -this.gameWidth / a, + u = -this.gameHeight / a) : l.x < 0 && l.y >= 0 ? (d = this.gameWidth / a, + u = -this.gameHeight / a) : l.x >= 0 && l.y < 0 ? (d = -this.gameWidth / a, + u = this.gameHeight / a) : (d = this.gameWidth / a, + u = this.gameHeight / a), + cc.v2(m.x + d, m.y + u) + } + if (this.firstFlags) { + var g = s.getRandomNum(2 * -this.gameHeight, 2 * this.gameHeight, !1) + , p = s.getRandomNum(2 * -this.gameHeight, 2 * this.gameHeight, !1); + if (h = cc.v2(g, p), + s.pDistance(h, cc.v2(0, 0)) < 200) + return this.getEnemyPos(e, t) + } + var f = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)); + if (s.pDistance(h, f) < (this.gameHeight + e.width) / a) + return this.getEnemyPos(e, t); + for (var y = 0; y < this.enemyNode.children.length; y++) + if (s.pDistance(h, this.enemyNode.children[y].position) < 500) + return this.getEnemyPos(e, t); + return h + } + }, + getEnemyID: function(e) { + var t = s.getRandomNum(0, 100, !1) + , a = 0; + return 1 == e ? a = t < 50 ? 0 : t > 50 && t < 75 ? 1 : 2 : 2 == e ? a = t < 20 ? 0 : t > 25 && t < 50 ? 1 : t > 50 && t < 70 ? 2 : 3 : 3 == e ? a = t < 20 ? 0 : t < 35 ? 1 : t < 40 ? 2 : t < 70 ? 3 : 4 : 4 == e ? a = t < 20 ? 1 : t < 35 ? 2 : t < 40 ? 3 : t > 40 && t < 70 ? 4 : 5 : 5 == e ? t <= 15 ? a = 2 : t <= 30 ? a = 3 : t <= 35 ? a = 4 : t <= 60 ? a = 5 : t <= 90 ? a = 6 : this.jingyuNum < 1 && (a = 7, + this.jingyuNum++) : 6 == e ? t <= 15 ? a = 3 : t <= 30 ? a = 4 : t <= 35 ? a = 5 : t <= 65 ? a = 6 : t <= 90 ? this.jingyuNum < 3 ? (a = 7, + this.jingyuNum++) : a = 6 : this.jiaoNum < 2 ? (a = 8, + this.jiaoNum++) : a = this.jingyuNum < 3 ? 7 : 6 : 7 == e ? t <= 20 ? a = 3 : t <= 25 ? a = 4 : t <= 30 ? a = 5 : t <= 35 ? a = 6 : this.jingyuNum < 5 ? (a = 7, + this.jingyuNum++) : this.jiaoNum < 5 ? (a = 8, + this.jiaoNum++) : a = s.getRandomNum(3, 4, !0) : 8 == e ? t < 40 ? a = 3 : t < 45 ? a = 4 : t <= 50 ? a = 5 : t <= 55 ? a = 6 : random <= 60 ? this.jingyuNum < 3 && (a = 7, + this.jingyuNum++) : this.jiaoNum < 3 ? (a = 8, + this.jiaoNum++) : a = s.getRandomNum(4, 5, !0) : a = s.getRandomNum(3, 5, !0), + e >= 4 && a == e - 1 ? this.getEnemyID(e) : a + }, + CreateEnemy: function(e) { + for (var t = 0; t < e; t++) { + var a; + a = t <= .8 * e ? 0 : t > .8 * e && t <= .9 * e ? 1 : 2; + var i = cc.instantiate(this.enemyPreArr[a]); + this.changeSize(i), + i.typeID = a + 1; + var o = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio; + i.speed = (200 - 15 * i.typeID) / o; + var n = this.getEnemyPos(i); + n ? (this.enemyNode.addChild(i, 1), + i.setPosition(n), + i.getComponent("enemyJS").active = !0, + this.enemyAction(i)) : i.destroy() + } + this.firstFlags = !1 + }, + updateCreate: function() { + this.gameOverFlags || this.CreateSingleEnemy(1, this.playerNode.typeID) + }, + CreateSingleEnemy: function(e, t) { + if (!this.gameOverFlags) { + var a = this.enemyNode.children.length + , i = this.playerNode.typeID; + if (i <= 3) { + if (a > 60) + return + } else if (i >= 4 && i <= 5) { + if (a > 50) + return + } else if (i > 5 && i <= 7) { + if (a > 40) + return + } else if (i > 7 && a > 20) + return; + for (var o = 0; o < e; o++) { + var n = this.getEnemyID(t) + , s = cc.instantiate(this.enemyPreArr[n]); + this.changeSize(s), + s.typeID = n + 1; + var c = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio; + s.speed = (200 - 10 * s.typeID) / c; + var r = this.getEnemyPos(s); + r ? (this.enemyNode.addChild(s, 1), + s.setPosition(r), + s.getComponent("enemyJS").active = !0, + this.enemyAction(s)) : s.destroy() + } + } + }, + judgeEnemyPos: function(e) { + var t = this.enemyNode.convertToNodeSpaceAR(this.BGNode.convertToWorldSpaceAR(this.BGArr[0][0].position)) + , a = Math.abs(t.x) + , i = Math.abs(t.y); + e.x > a - this.gameHeight || e.y > i - this.gameHeight || e.x < -a + this.gameHeight || e.y < -i + this.gameHeight ? this.EnemyReturnAction(e) : this.enemyAction(e) + }, + enemyAction: function(e) { + e.stopAllActions(); + var t = s.getRandomNum(500, 1e3, !0) + , a = e.position + , i = s.getRandomNum(-t, t, !0) + , o = s.getRandomNum(-t, t, !0) + , n = cc.v2(a.x + i, a.y + o) + , c = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(n)) + , r = Math.atan2(c.y - a.y, c.x - a.x) + , h = cc.misc.radiansToDegrees(r) - 90 + , l = e.speed + , m = s.pDistance(a, c) / l; + e.runAction(cc.sequence(cc.spawn(cc.moveTo(m, c), cc.rotateTo(.3, h)), cc.callFunc(function() { + this.judgeEnemyPos(e) + }, this))) + }, + EnemyReturnAction: function(e) { + e.stopAllActions(); + var t = e.speed + , a = s.getRandomNum(1e3, 1300, !1) + , i = a / t + , o = Math.atan2(-e.y, -e.x) + , n = cc.misc.radiansToDegrees(o) - 90; + e.runAction(cc.sequence(cc.spawn(cc.moveBy(i, a * Math.cos(o), a * Math.sin(o)), cc.rotateTo(.3, n)), cc.callFunc(function() { + this.judgeEnemyPos(e) + }, this))) + }, + ChasePlayer: function(e) { + e.stopAllActions(); + var t = e.position + , a = this.playerNode.position + , i = Math.atan2(a.y - t.y, a.x - t.x) + , o = e.speed + , n = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio + , c = s.getRandomNum(100 / n, 200 / n, !1) + , r = c / o + , h = cc.misc.radiansToDegrees(i) - 90; + e.runAction(cc.sequence(cc.spawn(cc.moveBy(r, c * Math.cos(i), c * Math.sin(i)), cc.rotateTo(2 * r / 3, h)), cc.callFunc(function() { + this.ChasePlayer(e) + }, this))) + }, + EscapePlayer: function(e) { + e.stopAllActions(); + var t = e.position + , a = this.playerNode.position + , i = Math.atan2(t.y - a.y, t.x - a.x) + , o = e.speed + , n = s.getRandomNum(100, 200, !1) + , c = n / o + , r = cc.misc.radiansToDegrees(i) - 90; + e.runAction(cc.sequence(cc.spawn(cc.moveBy(c, n * Math.cos(i), n * Math.sin(i)), cc.rotateTo(.3, r)), cc.callFunc(function() { + this.enemyAction(e) + }, this))) + }, + judgeIsChange: function(e) { + var t = this; + if (this.tempArr.length >= 2) + if (this.playerNode.typeID <= e) { + this.playerNode.typeID++, + this.playerNode.typeID > this.maxTypeID && (this.maxTypeID = this.playerNode.typeID); + for (var a = this.playerNode.getChildByName("son").convertToNodeSpaceAR(this.playerNode.convertToWorldSpaceAR(this.myFish.position)), i = function(e) { + var i = t.tempArr[e].position + , o = s.pDistance(a, i) / 2e3; + t.tempArr[e].runAction(cc.sequence(cc.spawn(cc.moveTo(o, a).easing(cc.easeQuadraticActionOut()), cc.scaleTo(o, 0, 0), cc.callFunc(function() { + if (e == this.tempArr.length - 1) { + for (var t = 0; t < this.tempArr.length; t++) + this.tempArr[t].destroy(); + this.tempArr.splice(0, this.tempArr.length), + this.createLizi(this.myFish, !0), + this.ChangeBig() + } + }, t)), cc.callFunc(function() {}, t))) + }, o = 0; o < this.tempArr.length; o++) + i(o) + } else + this.playerNode.typeID > e && this.tempArr.length >= 3 && this.EatSmallAction2() + }, + judgePushArr: function(e, t) { + 1 == e ? (this.kedouArr.push(t), + this.tempArr = this.kedouArr, + this.judgeIsChange(e)) : 2 == e ? (this.qingwaArr.push(t), + this.tempArr = this.qingwaArr, + this.judgeIsChange(e)) : 3 == e ? (this.haiguiArr.push(t), + this.tempArr = this.haiguiArr, + this.judgeIsChange(e)) : 4 == e ? (this.xiaojinyuArr.push(t), + this.tempArr = this.xiaojinyuArr, + this.judgeIsChange(e)) : 5 == e ? (this.jinliArr.push(t), + this.tempArr = this.jinliArr, + this.judgeIsChange(e)) : 6 == e ? (this.dianmanArr.push(t), + this.tempArr = this.dianmanArr, + this.judgeIsChange(e)) : 7 == e ? (this.shayuArr.push(t), + this.tempArr = this.shayuArr, + this.judgeIsChange(e)) : 8 == e ? (this.jingyuArr.push(t), + this.tempArr = this.jingyuArr, + this.judgeIsChange(e)) : 9 == e ? (this.jiaoArr.push(t), + this.tempArr = this.jiaoArr, + this.judgeIsChange(e)) : 10 == e && (this.longArr.push(t), + this.tempArr = this.longArr, + this.judgeIsChange(e)) + }, + ChangeBig: function() { + if (!this.gameOverFlags) { + var e = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio; + this.speedNum += this.addSpeed / e; + var t = this.playerNode.typeID; + this.removeSmallFish222(), + 2 == t ? (this.playerNode.getChildByName("kedou").active = !1, + this.playerNode.getChildByName("qingwa").scaleX = 0, + this.playerNode.getChildByName("qingwa").scaleY = 0, + this.playerNode.getChildByName("qingwa").active = !0, + this.myFish = this.playerNode.getChildByName("qingwa")) : 3 == t ? (this.playerNode.getChildByName("qingwa").active = !1, + this.playerNode.getChildByName("haigui").scaleX = 0, + this.playerNode.getChildByName("haigui").scaleY = 0, + this.playerNode.getChildByName("haigui").active = !0, + this.CameraChangeZoomRatio(e, .75), + this.myFish = this.playerNode.getChildByName("haigui")) : 4 == t ? (this.playerNode.getChildByName("haigui").active = !1, + this.playerNode.getChildByName("xiaojinyu").scaleX = 0, + this.playerNode.getChildByName("xiaojinyu").scaleY = 0, + this.playerNode.getChildByName("xiaojinyu").active = !0, + this.myFish = this.playerNode.getChildByName("xiaojinyu"), + this.CameraChangeZoomRatio(e, .65)) : 5 == t ? (this.playerNode.getChildByName("xiaojinyu").active = !1, + this.playerNode.getChildByName("jinli").scaleX = 0, + this.playerNode.getChildByName("jinli").scaleY = 0, + this.playerNode.getChildByName("jinli").active = !0, + this.CameraChangeZoomRatio(e, .55), + this.myFish = this.playerNode.getChildByName("jinli")) : 6 == t ? (this.playerNode.getChildByName("jinli").active = !1, + this.playerNode.getChildByName("dianman").scaleX = 0, + this.playerNode.getChildByName("dianman").scaleY = 0, + this.playerNode.getChildByName("dianman").active = !0, + this.myFish = this.playerNode.getChildByName("dianman"), + this.CameraChangeZoomRatio(e, .45)) : 7 == t ? (this.playerNode.getChildByName("dianman").active = !1, + this.playerNode.getChildByName("shayu").scaleX = 0, + this.playerNode.getChildByName("shayu").scaleY = 0, + this.playerNode.getChildByName("shayu").active = !0, + this.CameraChangeZoomRatio(e, .4), + this.myFish = this.playerNode.getChildByName("shayu")) : 8 == t ? (this.playerNode.getChildByName("shayu").active = !1, + this.playerNode.getChildByName("jingyu").scaleX = 0, + this.playerNode.getChildByName("jingyu").scaleY = 0, + this.playerNode.getChildByName("jingyu").active = !0, + this.CameraChangeZoomRatio(e, .3), + this.myFish = this.playerNode.getChildByName("jingyu")) : 9 == t ? (this.playerNode.getChildByName("jingyu").active = !1, + this.playerNode.getChildByName("jiao").scaleX = 0, + this.playerNode.getChildByName("jiao").scaleY = 0, + this.playerNode.getChildByName("jiao").active = !0, + this.CameraChangeZoomRatio(e, .25), + this.myFish = this.playerNode.getChildByName("jiao")) : 10 == t && (this.playerNode.getChildByName("jiao").active = !1, + this.SummonDragonAction()), + t < 10 && this.myFish.runAction(cc.sequence(cc.scaleTo(.1, this.fishScaleX[t - 1], this.fishScaleY[t - 1]).easing(cc.easeBackOut()), cc.callFunc(function() {}, this))) + } + }, + EatSmallAction2: function() { + var e = this; + if (this.tempArr.length >= 3) { + var t = function() { + var t = e.tempArr[0].typeID; + if (9 == t) + return { + v: void 0 + }; + var a = cc.instantiate(e.newFishPreArr[t]); + a.typeID = t + 1, + e.changeSize(a); + var i = a.scaleX + , o = a.scaleY + , n = e.playerNode.getChildByName("son") + , c = e.getSmallFishPos(a, e.myFish); + a.scaleX = 0, + a.scaleY = 0, + n.addChild(a, 100), + a.setPosition(c); + for (var r = function(n) { + var r = s.pDistance(c, e.tempArr[n].position) / 2e3; + e.tempArr[n].runAction(cc.sequence(cc.spawn(cc.moveTo(r, c).easing(cc.easeQuadraticActionOut()), cc.callFunc(function() { + if (n == this.tempArr.length - 1) { + for (var e = 0; e < this.tempArr.length; e++) + this.tempArr[e].destroy(); + this.tempArr.splice(0, this.tempArr.length), + this.createLizi(a, !1), + a.runAction(cc.sequence(cc.scaleTo(.1, i, o).easing(cc.easeQuarticActionOut()), cc.callFunc(function() { + a.zIndex = 50 * (10 - t - 1), + this.judgePushArr(a.typeID, a) + }, this))) + } + }, e)), cc.callFunc(function() {}, e))) + }, h = 0; h < e.tempArr.length; h++) + r(h) + }(); + if ("object" == typeof t) + return t.v + } + }, + getSmallFishPos: function(e, t, a) { + void 0 === a && (a = 0), + a++; + var i, o = cc.v2(), n = this.playerNode.getChildByName("son"), c = n.convertToNodeSpaceAR(n.parent.convertToWorldSpaceAR(t.position)); + i = Math.random() > .5 ? s.getRandomNum(-t.width / 2 * t.scaleX - e.width / 2 * e.scaleX, -t.width / 2 * t.scaleX - e.width / 4 * e.scaleX, !1) : s.getRandomNum(t.width / 2 * t.scaleX + e.width / 4 * e.scaleX, t.width / 2 * t.scaleX + e.width / 2 * e.scaleX, !1); + var r = s.getRandomNum(-t.height * t.scaleY, -e.height / 3 * e.scaleY, !1) + , h = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio; + if (o = cc.v2(c.x + i * h, c.y + r * h), + a > 100) { + var l = s.getRandomNum(.8, 1.3, !1) + , m = i * l + , d = r * l; + return cc.v2(cc.v2(c.x + m * h, c.y + d * h)) + } + for (var u = 0; u < n.children.length; u++) + if (s.pDistance(o, n.children[u].position) < e.width / 2 * e.scaleX) + return this.getSmallFishPos(e, t, a); + return o + }, + EatSmallAction: function(e, t) { + if (!this.gameOverFlags) { + var a = e.typeID; + 8 == e.type && this.jingyuNum--, + 9 == e.type && this.jiaoNum--; + var i = this.getSmallFishPos(e, t); + e.destroy(), + cc.audioEngine.play(this.eatMusic, !1, 1); + var o = cc.instantiate(this.newFishPreArr[a - 1]); + o.typeID = a, + this.changeSize(o); + var n = o.scaleX + , s = o.scaleY; + this.playerNode.getChildByName("son").addChild(o, 100), + o.setPosition(i), + o.scaleX = 0, + o.scaleY = 0, + o.runAction(cc.sequence(cc.spawn(cc.scaleTo(.1, n, s).easing(cc.easeQuadraticActionOut()), cc.callFunc(function() { + o.zIndex = 50 * (10 - a), + this.judgePushArr(a, o) + }, this)), cc.callFunc(function() {}, this))), + this.CreateSingleEnemy(1, this.playerNode.typeID) + } + }, + JudgeSmallFish: function() { + this.myFish.active = !1, + this.playerNode.getChildByName("son").children.length > 0 ? (cc.audioEngine.play(this.HurtMusic, !1, 1), + this.chooseBiggerFish()) : this.DieAction() + }, + chooseBiggerFish: function() { + if (!this.gameOverFlags) { + var e = cc.instantiate(this.bloodPre); + this.liziNode.addChild(e, 1e3); + var t = this.playerNode.typeID; + 2 == t || 3 == t ? ToolsJs.setTexture(e, "blood2") : ToolsJs.setTexture(e, "blood" + t); + var a = 100 + 25 * t; + e.width = a, + e.height = a; + var i = this.liziNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)); + e.scaleX = 0, + e.scaleY = 0, + e.setPosition(i), + e.runAction(cc.sequence(cc.scaleTo(.5, 1.3, 1.3).easing(cc.easeSineOut()), cc.fadeOut(.3), cc.callFunc(function() {}, this), cc.removeSelf())); + for (var o = this.playerNode.getChildByName("son"), n = this.myFish.angle, c = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio, r = o.children[0].typeID, h = this.playerNode.typeID, l = 0, m = 0; m < o.children.length; m++) + o.children[m].typeID > r && (r = o.children[m].typeID, + l = m); + var d = this.node.convertToNodeSpaceAR(o.convertToWorldSpaceAR(o.children[l].position)); + d.x < -this.maxCameraMovePosX ? d.x = -this.maxCameraMovePosX : d.x > this.maxCameraMovePosX && (d.x = this.maxCameraMovePosX), + d.y > this.maxCameraMovePosY ? d.y = this.maxCameraMovePosY : d.y < -this.maxCameraMovePosY && (d.y = this.maxCameraMovePosY); + var u = this.playerNode.position + , g = s.pDistance(d, u) / 1e3; + this.playerNode.stopAllActions(), + this.playerNode.runAction(cc.sequence(cc.spawn(cc.moveTo(g, d), cc.callFunc(function() { + var e = this; + 1 == r ? (ToolsJs.removeNodeForArr(this.kedouArr, o.children[l]), + this.tempArr = this.kedouArr, + this.myFish = this.playerNode.getChildByName("kedou"), + Math.abs(c - 1) > .05 && this.CameraChangeZoomRatio(c, 1)) : 2 == r ? (ToolsJs.removeNodeForArr(this.qingwaArr, o.children[l]), + this.tempArr = this.qingwaArr, + this.myFish = this.playerNode.getChildByName("qingwa"), + Math.abs(c - 1) > .05 && this.CameraChangeZoomRatio(c, 1)) : 3 == r ? (ToolsJs.removeNodeForArr(this.haiguiArr, o.children[l]), + this.tempArr = this.haiguiArr, + this.myFish = this.playerNode.getChildByName("haigui"), + Math.abs(c - .75) > .05 && this.CameraChangeZoomRatio(c, .75)) : 4 == r ? (ToolsJs.removeNodeForArr(this.xiaojinyuArr, o.children[l]), + this.tempArr = this.xiaojinyuArr, + this.myFish = this.playerNode.getChildByName("xiaojinyu"), + Math.abs(c - .65) > .05 && this.CameraChangeZoomRatio(c, .65)) : 5 == r ? (ToolsJs.removeNodeForArr(this.jinliArr, o.children[l]), + this.tempArr = this.jinliArr, + this.myFish = this.playerNode.getChildByName("jinli"), + Math.abs(c - .55) > .05 && this.CameraChangeZoomRatio(c, .55)) : 6 == r ? (ToolsJs.removeNodeForArr(this.dianmanArr, o.children[l]), + this.tempArr = this.dianmanArr, + this.myFish = this.playerNode.getChildByName("dianman"), + Math.abs(c - .45) > .05 && this.CameraChangeZoomRatio(c, .45)) : 7 == r ? (ToolsJs.removeNodeForArr(this.shayuArr, o.children[l]), + this.tempArr = this.shayuArr, + this.myFish = this.playerNode.getChildByName("shayu"), + Math.abs(c - .4) > .05 && this.CameraChangeZoomRatio(c, .4)) : 8 == r && (ToolsJs.removeNodeForArr(this.jingyuArr, o.children[l]), + this.tempArr = this.shayuArr, + this.myFish = this.playerNode.getChildByName("jingyu"), + Math.abs(c - .3) > .05 && this.CameraChangeZoomRatio(c, .3)), + this.playerNode.typeID = r, + o.removeChild(o.children[l]), + this.myFish.active = !0, + this.myFish.scaleX = this.fishScaleX[r - 1], + this.myFish.scaleY = this.fishScaleY[r - 1], + this.speedNum += (this.playerNode.typeID - h) * this.addSpeed / 2 / c, + this.myFish.angle = n, + this.scheduleOnce(function() { + e.gameOverFlags + }, .1) + }, this)), cc.callFunc(function() {}, this))) + } + }, + createSmallFish: function(e) { + var t; + t = e < 8 ? s.getRandomNum(0, e - 1, !0) : s.getRandomNum(1, 7, !0); + var a = cc.instantiate(this.enemyPreArr[t]); + this.changeSize(a), + a.typeID = t + 1; + var i = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio; + a.speed = 100 / i; + var o = this.getEnemyPos(a); + o ? (this.enemyNode.addChild(a, 1), + a.setPosition(o), + a.getComponent("enemyJS").active = !0, + this.enemyAction(a)) : a.destroy() + }, + removeSomeBigFish222: function() { + var e = this; + if (!(this.gameOverFlags || this.playerNode.typeID <= 2)) { + for (var t = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)), a = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio, i = [], o = 0; o < this.enemyNode.children.length; o++) + this.enemyNode.children[o].typeID >= this.playerNode.typeID + 3 && i.push(this.enemyNode.children[o]); + for (var n = function(o) { + var n = i[o]; + n.runAction(cc.sequence(cc.delayTime(.05 * o), cc.callFunc(function(e) { + if (s.pDistance(t, e.position) > (this.gameHeight + n.height / 2) / a && Math.random() < .7) { + if (this.gameOverFlags) + return; + this.enemyNode.removeChild(n), + this.createSmallFish(this.playerNode.typeID) + } + }, e))) + }, c = 0; c < i.length; c++) + n(c) + } + }, + removeSomeBigFish: function() { + if (!this.gameOverFlags) { + for (var e = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)), t = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio, a = [], i = 0; i < this.enemyNode.children.length; i++) + this.enemyNode.children[i].typeID >= this.playerNode.typeID + 3 && a.push(this.enemyNode.children[i]); + for (var o = 0; o < a.length; o++) + if (s.pDistance(e, a[o].position) > (this.gameHeight / 2 + a[o].height / 2) / t) + return 8 == a[o].typeID && this.jingyuNum--, + 9 == a[o].typeID && this.jiaoNum--, + void this.enemyNode.removeChild(a[o]) + } + }, + removeSmallFish222: function() { + var e = this; + if (!this.gameOverFlags) { + var t = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)) + , a = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio + , i = []; + if (!(this.playerNode.typeID >= 5)) { + for (var o = 0; o < this.enemyNode.children.length; o++) + this.enemyNode.children[o].typeID <= this.playerNode.typeID - 3 && i.push(this.enemyNode.children[o]); + if (i.length > 0) + for (var n = function(o) { + var n = i[o]; + n.runAction(cc.sequence(cc.delayTime(.05 * o), cc.callFunc(function(e) { + if (s.pDistance(t, e.position) > (this.gameHeight + n.height / 2) / a && Math.random() < .5) { + if (this.gameOverFlags) + return; + this.enemyNode.removeChild(n), + this.CreateSingleEnemy(1, this.playerNode.typeID) + } + }, e))) + }, c = 0; c < i.length; c++) + n(c) + } + } + }, + removeSmallFish: function() { + if (!this.gameOverFlags) { + for (var e = this.enemyNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)), t = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio, a = [], i = 0; i < this.enemyNode.children.length; i++) { + var o = this.enemyNode.children[i].typeID; + this.playerNode.typeID >= 4 && o == this.playerNode.typeID && a.push(this.enemyNode.children[i]) + } + if (a.length > 0) + for (var n = 0; n < a.length; n++) + if (s.pDistance(e, a[n].position) > (this.gameHeight / 2 + a[n].height / 2) / t) + return Math.random(), + this.enemyNode.removeChild(a[n]), + void this.CreateSingleEnemy(1, this.playerNode.typeID) + } + }, + createLizi: function(e, t) { + var a = cc.v2() + , i = 0 + , o = 0; + t ? (o = this.myFish.height / 2 * this.myFish.scaleY, + a = this.myFish.position, + i = this.playerNode.typeID) : (o = e.height / 2 * e.scaleY, + a = this.playerNode.convertToNodeSpaceAR(e.parent.convertToWorldSpaceAR(e.position)), + i = e.typeID); + for (var n = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio, c = s.getRandomNum(15, 25, !0), r = s.getRandomNum(0, .05, !1), h = 0; h < c; h++) { + var l; + l = o < 100 ? s.getRandomNum(1, 150, !1) : s.getRandomNum(1, 1.3 * o, !1); + var m = cc.instantiate(this.liziPre); + this.playerNode.addChild(m, 100); + var d = s.getRandomNum(150, 250, !1); + m.scaleX = 0, + m.scaleY = 0, + m.opacity = d, + ToolsJs.setTexture(m, "fishlizi" + i), + m.setPosition(a); + var u = s.getRandomNum(.4 / n, 1.3 / n) + , g = 360 * Math.random() + , p = s.getCircumferencePos(a, l, g) + , f = s.pDistance(a, p) / s.getRandomNum(300, 500, !0); + s.getRandomNum(30, 180, !0), + m.runAction(cc.sequence(cc.delayTime(r), cc.spawn(cc.moveTo(f, p).easing(cc.easeQuarticActionOut()), cc.scaleTo(f, u, u)), cc.fadeOut(.5), cc.callFunc(function() {}, this), cc.removeSelf())) + } + for (var y = s.getRandomNum(10, 20, !0), v = 0; v < y; v++) { + var N; + N = o < 100 ? s.getRandomNum(1, 200, !1) : s.getRandomNum(1, 1.5 * o, !1); + var S = cc.instantiate(this.starPre) + , C = s.getRandomNum(1, 2, !0); + ToolsJs.setTexture(S, "star" + C), + this.playerNode.addChild(S, 100); + var T = s.getRandomNum(150, 250, !1); + S.opacity = T, + S.scaleX = 0, + S.scaleY = 0, + S.setPosition(a); + var A = s.getRandomNum(.8 / n, 1.5 / n) + , x = 360 * Math.random() + , M = s.getCircumferencePos(a, N, x) + , P = s.pDistance(a, M) / s.getRandomNum(300, 500, !0) + , F = s.getRandomNum(180, 360, !0); + S.runAction(cc.sequence(cc.delayTime(r), cc.spawn(cc.moveTo(P, M).easing(cc.easeQuarticActionOut()), cc.scaleTo(P, A, A)), cc.spawn(cc.rotateBy(.5, F), cc.fadeOut(.5)), cc.callFunc(function() {}, this), cc.removeSelf())) + } + }, + createMouseRipple: function(e) { + var t = cc.instantiate(this.ripplePre); + this.liziNode.addChild(t, 100), + t.setPosition(e), + t.scaleX = .5, + t.scaleY = .375, + t.opacity = 200; + var a = s.getRandomNum(.5, 2); + t.runAction(cc.sequence(cc.spawn(cc.scaleTo(.2, a, 3 * a / 4), cc.fadeOut(.4)), cc.removeSelf())) + }, + EatingEffectAction: function(e) { + var t = cc.instantiate(this.bloodPre); + this.liziNode.addChild(t); + var a = e.typeID; + 2 == a || 3 == a ? ToolsJs.setTexture(t, "blood2") : ToolsJs.setTexture(t, "blood" + a); + var i; + i = e.scaleX * e.width >= e.scaleY * e.height ? e.scaleX * e.width : e.scaleY * e.height, + t.width = i, + t.height = i; + var o = e.position + , n = this.liziNode.convertToNodeSpaceAR(this.enemyNode.convertToWorldSpaceAR(o)); + t.scaleX = 0, + t.scaleY = 0, + t.setPosition(n), + t.runAction(cc.sequence(cc.scaleTo(.5, 1.3, 1.3).easing(cc.easeSineOut()), cc.fadeOut(.3), cc.removeSelf())) + }, + EatingEffectAction2: function(e) { + var t = cc.instantiate(this.bloodPre); + this.liziNode.addChild(t); + var a = e.typeID; + 2 == a || 3 == a ? ToolsJs.setTexture(t, "blood2") : ToolsJs.setTexture(t, "blood" + a); + var i; + i = e.scaleX * e.width >= e.scaleY * e.height ? e.scaleX * e.width : e.scaleY * e.height, + t.width = i, + t.height = i; + var o = e.position + , n = this.playerNode.convertToNodeSpaceAR(this.playerNode.getChildByName("son").convertToWorldSpaceAR(o)) + , s = this.liziNode.convertToNodeSpaceAR(this.playerNode.convertToWorldSpaceAR(n)); + t.scaleX = 0, + t.scaleY = 0, + t.setPosition(s), + t.runAction(cc.sequence(cc.scaleTo(.5, 1.3, 1.3).easing(cc.easeSineOut()), cc.fadeOut(.3), cc.removeSelf())) + }, + StoneFadeInAction: function() { + var e = this.carmeraNode.getChildByName("MoveCamera").getComponent(cc.Camera).zoomRatio + , t = this.playerNode.position + , a = cc.find("Canvas/RotLiziNode"); + a.setPosition(this.playerNode.position); + for (var i = s.getRandomNum(50, 100, !1), o = Math.floor(i / 2), n = 0; n < i; n++) { + var c = null; + if (n < o) { + c = cc.instantiate(this.starPre); + var r = s.getRandomNum(1, 2, !0); + ToolsJs.setTexture(c, "star" + r) + } else + c = cc.instantiate(this.liziPre), + ToolsJs.setTexture(c, "fishlizi10"); + a.addChild(c, 200), + c.scaleX = 0, + c.scaleY = 0; + var h = s.getRandomNum(50 / e, this.gameWidth / 2 / e, !1) + , l = 360 * Math.random() + , m = s.getCircumferencePos(t, h, l) + , d = a.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(m)) + , u = s.getRandomNum(1 / e, 2 / e, !1) + , g = (s.getRandomNum(50, 100, !1), + s.getRandomNum(180, 360, !1)) + , p = s.getRandomNum(.3, .6, !1) + , f = a.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(t)); + c.setPosition(f); + var y = cc.v2((f.x + d.x) / 2, (f.y + d.y) / 3 * 2) + , v = s.getRandomNum(.05, .2, !1) + , N = s.getRandomNum(.4, .8, !1) + , S = [f, y, d]; + c.runAction(cc.sequence(cc.delayTime(v), cc.spawn(cc.bezierTo(N, S).easing(cc.easeQuadraticActionOut()), cc.scaleTo(N, u, u).easing(cc.easeBounceOut())), cc.spawn(cc.rotateBy(p, g), cc.fadeOut(p)), cc.callFunc(function() {}, this), cc.removeSelf())) + } + this.myFish.opacity = 0, + this.stoneNode.scaleX = 0, + this.stoneNode.scaleY = 0, + this.stoneNode.active = !0, + this.stoneNode.zIndex = 50; + var C = this.stoneNode.getChildByName("stone1") + , T = this.stoneNode.getChildByName("stone2") + , A = this.stoneNode.getChildByName("stone3"); + this.stoneNode.runAction(cc.sequence(cc.delayTime(.15), cc.spawn(cc.scaleTo(.5, .8 * this.SizeScale, .8 * this.SizeScale).easing(cc.easeCircleActionInOut()), cc.callFunc(function() { + this.carmeraNode.runAction(cc.sequence(cc.moveBy(.05, 5, 5), cc.moveBy(.05, -5, -5)).repeat(10)) + }, this)), cc.delayTime(.1), cc.callFunc(function() { + var e = this + , t = cc.instantiate(this.blackLayerPre); + this.node.addChild(t, 10), + t.active = !0, + t.opacity = 200, + t.setPosition(cc.v2(0, 0)), + this.scheduleOnce(function() { + e.LightAction(0, .3), + e.Wu.getComponent(cc.Animation).play("wu"), + e.stoneNode.getChildByName("light0").active = !0 + }, .3), + C.runAction(cc.sequence(cc.rotateBy(1.5, 360).easing(cc.easeQuadraticActionOut()), cc.delayTime(.2), cc.callFunc(function() { + C.getChildByName("light1").active = !0, + C.getChildByName("light2").active = !0 + }, this))), + T.runAction(cc.sequence(cc.delayTime(1.7), cc.rotateBy(1, -360).easing(cc.easeQuadraticActionOut()), cc.delayTime(.2), cc.callFunc(function() { + T.getChildByName("light3").active = !0 + }, this))), + A.runAction(cc.sequence(cc.delayTime(2.9), cc.callFunc(function() { + var e = this; + A.getChildByName("light4").active = !0, + this.scheduleOnce(function() { + e.CreatePanLong() + }, .2) + }, this))) + }, this))) + }, + SummonDragonAction: function() { + var e = this; + this.gameOverFlags = !0, + this.speed = 0, + this.speedNum = 0, + this.enemyNode.removeAllChildren(), + this.enemyNode.destroy(); + for (var t = this.playerNode.getChildByName("son"), a = t.convertToNodeSpaceAR(this.playerNode.convertToWorldSpaceAR(this.myFish.position)), i = 0; i < t.children.length; i++) { + var o = s.getRandomNum(50, 100, !1) + , n = Math.atan2(a.y - t.children[i].y, a.x - t.children[i].x) + , c = cc.misc.radiansToDegrees(n) + 90; + t.children[i].runAction(cc.sequence(cc.spawn(cc.jumpTo(.5, a, o, 1).easing(cc.easeQuadraticActionOut()), cc.scaleTo(.5, 0, 0), cc.rotateTo(0, 1, c)), cc.callFunc(function() {}, this), cc.removeSelf())) + } + this.scheduleOnce(function() { + e.StoneFadeInAction() + }, 1) + }, + CreatePanLong: function() { + var e = this; + this.setHisSocre(this.maxTypeID); + var t = cc.instantiate(this.PanlongPre); + this.node.addChild(t, 100), + t.opacity = 0, + t.scaleX = .9 * this.SizeScale, + t.scaleY = .9 * this.SizeScale; + var n = this.stoneNode.position + , c = cc.v2(-50 * this.SizeScale, n.y - 400 * this.SizeScale) + , r = cc.v2(-50 * this.SizeScale, c.y - this.gameHeight / 4); + t.setPosition(r); + var h = this + , l = cc.instantiate(this.lightPre); + this.node.addChild(l, 30), + l.scaleX = 0, + l.scaleY = 0, + l.setPosition(this.stoneNode.position), + t.runAction(cc.sequence(cc.spawn(cc.moveTo(.5, c), cc.fadeIn(.3), cc.callFunc(function() { + this.LightAction(0, .5); + var e = t.getChildByName("panlong").getComponent(dragonBones.ArmatureDisplay); + e.timeScale = 1.5, + e.playAnimation("newAnimation", 1) + }, this)), cc.delayTime(.3), cc.callFunc(function() { + l.runAction(cc.sequence(cc.scaleTo(.3, 1, 1), cc.callFunc(function() {}, this))) + }, this), cc.delayTime(.6), cc.callFunc(function() { + var e = this + , t = cc.instantiate(this.mainBtnPre); + t.scaleX = .7 * this.SizeScale, + t.scaleY = .7 * this.SizeScale, + this.node.addChild(t, 5e3), + t.opacity = 0, + t.setPosition(cc.v2(-this.gameWidth / 2 + this.gameWidth / 8, this.gameHeight / 2 - this.gameWidth / 8)), + t.runAction(cc.fadeIn(.3)), + t.on(cc.Node.EventType.TOUCH_START, function() {}), + t.on(cc.Node.EventType.TOUCH_END, function() { + console.log("MoreGame"), + window.location.href = o.moreGameUrl + }); + var n = cc.instantiate(this.replayButtonPre); + this.node.addChild(n, 5e3), + n.scaleX = 0, + n.scaleY = 0, + n.setPosition(cc.v2(0, -this.stoneNode.y - 200 * this.Hscale)), + n.runAction(cc.scaleTo(.5, .6 * this.SizeScale, .6 * this.SizeScale).easing(cc.easeBackOut()), cc.callFunc(function() {}, this)); + var s = cc.find("Canvas/nameLabel"); + s.zIndex = 6001, + s.zIndex = 6e3, + s.setPosition(cc.v2(this.stoneNode.x + 150 * this.Wscale, this.stoneNode.y - 200 * this.Hscale)), + this.nameLabel.string = renderConfig.getStrForType("name_10"); + var c = cc.find("Canvas/winLabel"); + c.zIndex = 6e3; + var r = cc.v2(n.x, n.y + n.height / 2 * .7 * this.Hscale + 50 * this.Hscale); + c.setPosition(cc.v2(r.x, r.y - 50 * this.SizeScale)), + c.runAction(cc.sequence(cc.spawn(cc.fadeIn(.3), cc.moveTo(.3, r)), cc.callFunc(function() {}, this))), + this.scheduleOnce(function() { + h.canTouchReplay = !0, + n.runAction(cc.sequence(cc.delayTime(2), cc.scaleTo(.3, .7 * e.SizeScale).easing(cc.easeSineInOut()), cc.scaleTo(.3, .6 * e.SizeScale).easing(cc.easeSineInOut()), cc.rotateTo(.1, 15).easing(cc.easeSineInOut()), cc.rotateTo(.2, -15).easing(cc.easeSineInOut()), cc.rotateTo(.1, 15).easing(cc.easeSineInOut()), cc.rotateTo(.2, -15).easing(cc.easeSineInOut()), cc.rotateTo(.1, 0).easing(cc.easeSineInOut()))).repeatForever(), + n.on(cc.Node.EventType.TOUCH_START, function() {}), + n.on(cc.Node.EventType.TOUCH_END, function() { + h.canTouchReplay && (cc.eventManager.removeAllListeners(), + a.GAME_OVER_BOOL = !0, + a.gameScore = 0, + a.publicGameBool, + console.log("loadScene"), + i.loadingScene("MainGameScene")) + }) + }, .8) + }, this))), + this.scheduleOnce(function() { + e.stoneNode.runAction(cc.sequence(cc.spawn(cc.scaleBy(.5, .8 * e.SizeScale, .8 * e.SizeScale), cc.moveTo(.5, 0, e.gameHeight / 6).easing(cc.easeBackOut()), cc.callFunc(function() { + l.runAction(cc.sequence(cc.moveTo(.5, 0, this.gameHeight / 6).easing(cc.easeBackOut()), cc.callFunc(function() {}, this))) + }, e)), cc.callFunc(function() {}, e))), + e.scheduleOnce(function() { + l.runAction(cc.sequence(cc.rotateBy(10, 360), cc.callFunc(function() {}, e)).repeatForever()) + }, .5), + t.runAction(cc.sequence(cc.spawn(cc.scaleTo(.5, .9 * e.SizeScale, .9 * e.SizeScale), cc.moveTo(.5, -50 * e.SizeScale, e.gameHeight / 6 - 370 * e.SizeScale).easing(cc.easeBackOut())), cc.callFunc(function() {}, e))) + }, 1.3), + this.scheduleOnce(function() { + var t = e.stoneNode.getChildByName("stone1") + , a = e.stoneNode.getChildByName("stone2") + , i = e.stoneNode.getChildByName("stone3"); + t.runAction(cc.sequence(cc.rotateBy(2, 10), cc.callFunc(function() {}, e)).repeatForever()), + a.runAction(cc.sequence(cc.rotateBy(1, -10), cc.callFunc(function() {}, e)).repeatForever()), + i.runAction(cc.sequence(cc.rotateBy(.5, 10), cc.callFunc(function() {}, e)).repeatForever()) + }, 1.8), + this.scheduleOnce(function() { + var a = s.getRandomNum(0, 30, !1); + t.runAction(cc.sequence(cc.spawn(cc.sequence(cc.moveBy(1, 0, -a), cc.moveBy(1, 0, a)), cc.callFunc(function() { + var e = t.getChildByName("panlong").getComponent(dragonBones.ArmatureDisplay); + e.timeScale = .2, + e.playAnimation("newAnimation_\u590d\u52361", 0) + }, e)), cc.callFunc(function() {}, e)).repeatForever()) + }, 1) + }, + LightAction: function(e, t) { + this.lightFlags = !1, + this.light1.scaleX = .9, + this.light1.scaleY = .9, + this.light2.scaleX = .9, + this.light2.scaleY = .9, + this.light1.opacity = 255, + this.light2.opacity = 255, + this.light1.runAction(cc.sequence(cc.delayTime(e), cc.fadeIn(.1), cc.fadeOut(.3), cc.callFunc(function() { + this.lightFlags = !0 + }, this))), + this.light2.runAction(cc.sequence(cc.delayTime(t), cc.fadeIn(.1), cc.fadeOut(.3), cc.callFunc(function() { + this.lightFlags = !0 + }, this))), + this.lightjudeTime = s.getRandomNum(3, 6, !1) + }, + BubbleAction: function() { + if (!this.gameOverFlags) { + var e = cc.instantiate(this.BubblePre); + s.getRandomNum(1, 3, !0), + this.liziNode.addChild(e); + var t = this.liziNode.convertToNodeSpaceAR(this.playerNode.convertToWorldSpaceAR(this.myFish.position)); + e.setPosition(t), + e.scaleX = 0, + e.scaleY = 0; + var a = this.playerNode.angle + 90 + , i = cc.misc.degreesToRadians(a) + , o = s.getRandomNum(.5, 1, !1) + , n = s.getRandomNum(50, 100, !1) + , c = s.getRandomNum(.2, .5, !1) + , r = s.getRandomNum(-50, 50, !1); + e.angle = 360 * Math.random(), + e.runAction(cc.sequence(cc.spawn(cc.moveBy(c, -n * Math.cos(i) + r, -n * Math.sin(i) + r), cc.scaleTo(c, o, o)), cc.fadeOut(.2), cc.removeSelf())) + } + }, + WaterAction: function() { + if (!this.gameOverFlags) + for (var e = s.getRandomNum(2, 3, !0), t = s.getRandomNum(.2, .5, !1), a = s.getRandomNum(-.3, .3), i = this.carmeraNode.position, o = s.getRandomNum(-this.gameWidth, this.gameWidth, !1), n = s.getRandomNum(-this.gameHeight, this.gameHeight, !1), c = cc.v2(i.x + o, i.y + n), r = this.liziNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(c)), h = 0; h < e; h++) { + var l = cc.instantiate(this.bowenPre); + this.liziNode.addChild(l, 1), + l.setPosition(r); + var m = l.scaleX + , d = l.scaleY; + l.scaleX = 0, + l.scaleY = 0, + l.runAction(cc.sequence(cc.delayTime(t * h), cc.scaleTo(1, m + a, d + a), cc.fadeOut(.3), cc.removeSelf())) + } + }, + DieAction: function() { + this.speed = 0, + this.gameOverFlags = !0, + cc.audioEngine.play(this.failMusic, !1, 1), + this.playerNode.opacity = 0; + var e = cc.instantiate(this.bloodPre); + this.liziNode.addChild(e, 1e3); + var t = this.playerNode.typeID; + 2 == t || 3 == t ? ToolsJs.setTexture(e, "blood2") : ToolsJs.setTexture(e, "blood" + t); + var a = 100 + 25 * t; + e.width = a, + e.height = a; + var i = this.liziNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(this.playerNode.position)); + e.scaleX = 0, + e.scaleY = 0, + e.setPosition(i), + e.runAction(cc.sequence(cc.scaleTo(.5, 1.3, 1.3).easing(cc.easeSineOut()), cc.fadeOut(.3), cc.callFunc(function() { + this.playerNode.destroy(), + this.gameEnd() + }, this), cc.removeSelf())) + }, + updateFishRotate: function(e, t, a) { + var i = e.angle % 360; + i = e.angle < 0 ? 360 - Math.abs(i) : i; + var o = t < 0 ? 360 - Math.abs(t) : t; + Math.abs(i - o) > a && Math.abs(i - o) < 360 - a ? Math.abs(i - o) > 180 ? i - o > 180 ? e.angle += a : e.angle -= a : i >= o ? e.angle -= a : e.angle += a : e.angle = t + }, + setHisSocre: function(e) { + cc.sys.localStorage.setItem("ZhaoHuanShenLong_12WS", e) + }, + addTouchEvents: function() { + var e = this; + this.node.on(cc.Node.EventType.TOUCH_START, function(t) { + if (a.GAME_OVER_BOOL && a.noTouchBool && e.touchBeginFlags) { + e.touchBeginFlags = !1; + var i = t.getLocation(); + return e.node.convertToNodeSpaceAR(i), + !0 + } + }, this), + this.node.on(cc.Node.EventType.TOUCH_MOVE, this.on_touch_move, this), + this.node.on(cc.Node.EventType.TOUCH_END, this.on_touch_end, this) + }, + on_touch_move: function(e) { + if (!this.gameOverFlags && this.canMoveFlags) { + this.speed = this.speedNum; + var t = e.getLocation() + , a = this.node.convertToNodeSpaceAR(t) + , i = this.carmeraNode.position + , o = cc.v2(a.x + i.x, a.y + i.y) + , n = this.liziNode.convertToNodeSpaceAR(this.node.convertToWorldSpaceAR(o)); + this.createMouseRipple(n) + } + }, + on_touch_end: function(e) { + if (!this.gameOverFlags) { + this.touchBeginFlags = !0; + var t = e.getLocation(); + this.node.convertToNodeSpaceAR(t) + } + }, + update: function(e) { + if (this.updateCreate(), + this.removeSmallFish(), + this.removeSomeBigFish(), + this.playerNode.typeID, + this.waterCount++, + this.waterCount > this.randnum && (this.WaterAction(), + this.waterCount = 0, + this.randnum = s.getRandomNum(20, 40, !0)), + this.OffPos) { + if (this.gameOverFlags) + return; + var t = cc.v2(0, 1).signAngle(this.OffPos) + , a = cc.misc.radiansToDegrees(t); + this.angle = a, + this.updateFishRotate(this.myFish, this.angle, this.rotSpeed * e); + var i = this.playerNode.getChildByName("son"); + if (i.children.length >= 1) + for (var o = 0; o < i.children.length; o++) + this.updateFishRotate(i.children[o], this.angle, this.rotSpeed * e); + this.CameraMove(e) + } + if (this.lightFlags && (this.LightNumCount += e, + this.LightNumCount >= this.lightjudeTime)) { + this.lightjudeTime = 0; + var n = s.getRandomNum(.5, 1.5, !1) + , c = s.getRandomNum(.5, 1.5, !1); + this.LightAction(n, c) + } + this.gameOverGoToOVer(), + this.gameEndFlags + }, + gameEnd: function() { + a.GAME_OVER_BOOL = !1, + o.gameOverShowText(a.gameScore, 1), + this.node.runAction(cc.sequence(cc.delayTime(.5), cc.callFunc(this.gameEnd1.bind(this)))) + }, + gameEnd1: function() { + var e = cc.instantiate(this.blackLayerPre); + this.node.addChild(e, 2600), + e.width = this.gameWidth, + e.height = this.gameHeight, + e.x = 0, + e.y = 0, + e.opacity = 0, + e.active = !0, + e.runAction(cc.fadeTo(.3, 140)), + this.gameOveEndBool = !0, + 1 == a.curType ? (this.gameOverT1.string = "\u6e38 \u620f \u7ed3 \u675f", + this.gameOverT2.string = "\u70b9 \u51fb \u67e5 \u770b \u5206 \u6570") : 2 == a.curType ? (this.gameOverT1.string = "\u904a \u6232 \u7d50 \u675f", + this.gameOverT2.string = "\u9ede \u64ca \u67e5 \u770b \u5206 \u6578") : 3 == a.curType ? (this.gameOverT1.string = "Game Over", + this.gameOverT2.string = "Click to view the score") : 4 == a.curType && (this.gameOverT1.string = "\uac8c\uc784 \uc885\ub8cc", + this.gameOverT2.string = "\ud074\ub9ad \ud558\uc5ec \uc810\uc218 \ubcf4\uae30"), + this.gameOverT1.node.zIndex = 2999, + this.gameOverT2.node.zIndex = 2999, + this.gameOverT1.node.opacity = 0, + this.gameOverT1.node.x = 0, + this.gameOverT1.node.y = 0, + this.gameOverT1.node.runAction(cc.sequence(cc.delayTime(.2), cc.spawn(cc.fadeIn(.5), cc.moveBy(.5, 0, -50)), cc.callFunc(function() {}, this), cc.callFunc(function() { + e.canTouch = !0 + }, this))), + this.gameOverT2.node.opacity = 0, + this.gameOverT2.node.x = 0, + this.gameOverT2.node.y = 100, + this.gameOverT2.node.runAction(cc.sequence(cc.delayTime(.2), cc.spawn(cc.fadeIn(.5), cc.moveBy(.5, 0, -50)), cc.callFunc(function(e) { + e.runAction(cc.sequence(cc.delayTime(2), cc.scaleTo(.3, 1.2).easing(cc.easeSineInOut()), cc.scaleTo(.3, 1).easing(cc.easeSineInOut()))).repeatForever() + }, this))) + }, + initEndLayer: function() { + var e = cc.instantiate(this.gameOverPre); + this.node.addChild(e, 3e3) + }, + gameOverGoToOVer: function() { + this.gameOveEndBool && (this.gameOverNum++, + this.gameOverNum >= 900 && (this.gameOverNum = 0, + this.gameOveEndBool = !1)) + } + }), + cc._RF.pop() + } + , { + "../MainManage": "MainManage", + "../commonJs/GameConfig": "GameConfig", + "../commonJs/GameUiTools": "GameUiTools", + "../commonJs/mTool_WHQ": "mTool_WHQ", + GameConfig: "GameConfig", + GameUiTools: "GameUiTools", + MainManage: "MainManage", + mTool_WHQ: "mTool_WHQ" + }], + MainManage: [function(e, t) { + "use strict"; + cc._RF.push(t, "946adGkxvdBmZXnlD952XtK", "MainManage"); + var a = e("HttpManagerJs") + , i = e("LanguageSetJs") + , o = e("GameConfig") + , n = e("LoadSceneJs") + , s = e("GameUiTools") + , c = { + gameHttpId: 0, + subScoreHttp: null, + gameNameText: null, + gameInfoText: null, + txtStartText: null, + txtMoreText: null, + txtAgainText: null, + gameEndLText: null, + gameEndL1Text: null, + bgLayRgb: null, + gameEndName1: null, + gameEndName2: null, + gameEndUrl1: null, + gameEndUrl2: null, + langugeType: 1, + ranLinkData: null, + adShowBefore: !1, + adShowAfter: !0, + endLayCol: null, + moreBtnBgCol: null, + moreBtnTextCol: null, + recGameData: null, + recGameUrl: null, + recGameDelPau: null, + recGameDelPer: null, + recGameimg1: null, + recGameimg2: null, + recGamePos: null, + InfoData: null, + endShow0: null, + endShow1: null, + endShow2: null, + endShow3: null, + infoGameName: null, + showText: null, + startText: null, + moreGameText: null, + playAgainText: null, + endHttpShowInfo: null, + moreGameUrl: null, + init: function(e, t, i) { + if (!o.publicGameBool) { + if (o.playNum >= 1) + return; + o.playNum++ + } + o.launchScene = e, + o.Bros = t, + o.caS = i, + this.curType = 1, + //this.getHttpGameId(), + //this.gamePV_load(), + console.log("thisg", this.gameHttpId), + a.httpInitUrl(this.gameHttpId); + var s = this.initLanguage(); + this.gameNameText = s.game_name, + this.gameInfoText = s.game_info, + this.txtStartText = s.txtStart, + this.txtMoreText = s.txtMore, + this.txtAgainText = s.txtAgain, + this.gameEndLText = s.gameEndL, + this.gameEndL1Text = s.gameEndL1, + this.bgLayRgb = s.bgRgb, + this.gameEndName1 = s.gameT2, + this.gameEndName2 = s.gameT3, + this.gameEndUrl1 = s.gameUrl1, + this.gameEndUrl2 = s.gameUrl2, + this.langugeType = this.curType, + o.publicGameBool || n.goToCover(this.adShowBefore, this.adShowAfter, e, t, i) + }, + getHttpGameId1: function() { + var e = window.location.href + , t = e.substring(0, e.lastIndexOf("//") + 2) + , a = window.location.host + , i = t + a + "/Service/Share/index"; + this.gameAllHttp = i, + cc.log("gameAll", this.gameAllHttp), + this.subScoreHttp = t + a + "/Service/Score/index", + this.gamePvHttp = t + a + "/Service/GamePv/index"; + var o = document.URL + , n = 0 + , s = o.substring(o.lastIndexOf("/game/") + 1, o.length).split("/"); + s.length >= 2 && (n = s[1]), + this.gameHttpId = n, + cc.log("gameId", n), + e.substring(e.lastIndexOf("//") + 4, e.lastIndexOf("com") + 3), + this.moreGameUrl = this.httpHead + this.endHttp + }, + getHttpGameId: function() { + var e = window.location.href + , t = e.substring(0, e.lastIndexOf("//") + 2) + , a = window.location.host + , i = t + a + "/Service/Share/index"; + this.gameAllHttp = i, + this.subScoreHttp = t + a + "/Service/Score/index", + this.gamePvHttp = t + a + "/Service/GamePv/index"; + var o = document.URL + , n = o.lastIndexOf("/") + , s = o.substring(0, n) + , c = (n = s.lastIndexOf("/"), + s.substring(n + 1, s.length)); + this.gameHttpId = c, + console.log("gameIdNew", c); + var r = e.substring(e.lastIndexOf("//") + 4, e.lastIndexOf("com") + 3); + -1 == e.search("/game/") ? this.moreGameUrl = t + a : this.moreGameUrl = t + r, + console.log("moreGame", this.moreGameUrl) + }, + gameOverShowText: function(e, t) { + //this.ajaxLoad(this.subScoreHttp, "gameScore=" + e + "&gameId=" + this.gameHttpId + "&gameType=" + t, this.scoreResult) + }, + gamePV_load: function() { + //this.ajaxLoad(this.gamePvHttp, "gameId=" + this.gameHttpId, this.ajaxOnLogoResult) + }, + ajaxOnLogoResult: function() {}, + ajaxLoad: function(e, t, a) { + var i = cc.loader.getXMLHttpRequest(); + i.onreadystatechange = a, + i.open("POST", e), + i.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), + i.send(t) + }, + scoreResult: function(e) { + if (null != e.currentTarget.response && "" != e.currentTarget.response) { + var t = JSON.parse(e.currentTarget.response); + cc.log("endshow", t.content), + c.endHttpShowInfo = t.content + } + }, + initLanguage: function() { + var e = null; + return cc.sys.language == cc.sys.LANGUAGE_CHINESE ? (this.curType = 1, + e = i.language_1) : (cc.log("\u82f1\u6587"), + this.curType = 2, + e = i.language_2), + e + }, + getLinkGameReturn: function(e, t, a, i) { + if (console.log("err0", e), + console.log("err1", t), + console.log("err2", a), + console.log("err3", i), + 0 == e) { + this.ranLinkData = t, + this.adShowBefore = this.ranLinkData.gameSet.adShowBefore, + this.adShowAfter = this.ranLinkData.gameSet.adShowAfter, + this.endLayCol = this.ranLinkData.gameSet.endLayerColor, + this.moreBtnBgCol = this.ranLinkData.gameSet.moreBtnBgCol, + this.moreBtnTextCol = this.ranLinkData.gameSet.moreBtnTextCol, + this.moreGameUrl = this.ranLinkData.gameSet.moreBtnUrl, + this.recGameData = a, + this.ranRecGameData(), + this.InfoData = i, + this.endShow0 = this.InfoData.endShow0, + this.endShow1 = this.InfoData.endShow1, + this.endShow2 = this.InfoData.endShow2, + this.endShow3 = this.InfoData.endShow3, + this.infoGameName = this.InfoData.gameName, + this.showText = this.InfoData.showText, + this.startText = this.InfoData.startText, + this.moreGameText = this.InfoData.moreGame, + this.playAgainText = this.InfoData.rePlay, + this.gameInfoText = this.InfoData.showText, + this.txtStartText = this.InfoData.startText, + this.txtMoreText = this.InfoData.moreGame, + this.txtAgainText = this.InfoData.rePlay, + console.log("LoadMainGameScnee"); + var s = o.launchScene + , c = o.Bros + , r = o.caS; + n.goToCover(this.adShowBefore, this.adShowAfter, s, c, r) + } + }, + ranRecGameData: function() { + if (null != this.recGameData && "" != this.recGameData) { + this.returnBool = !1; + var e = this.recGameData.length + , t = o.returnRanNum(1, e) - 1; + cc.log("ranNNN", t), + this.recGameUrl = this.recGameData[t].data_link, + this.recGameDelPer = this.recGameData[t].delay_per, + this.recGameDelPau = this.recGameData[t].delay_pau, + this.recGameimg1 = this.recGameData[t].img_1, + this.recGameimg2 = this.recGameData[t].img_2, + this.recGamePos = this.recGameData[t].poistion + } + }, + ranLinkUrl: function() { + if (null != this.ranLinkData && this.ranLinkData.gameList && null != this.ranLinkData.gameList) { + var e = this.ranLinkData.gameList.length + , t = o.returnRanNum(1, e) - 1; + return cc.log("templ", t, this.ranLinkData.gameList), + cc.log("url", this.ranLinkData.gameList[0].gameName, this.ranLinkData.gameList[0].gameUrl), + t + } + return null + }, + gotoEndLayer: function() { + this.showGameEndLayer() + }, + showGameEndLayer: function() { + console.log("Gottttttgameend"), + s.loadingLayer("panel/GameOverLayer") + } + }; + t.exports = c, + cc._RF.pop() + } + , { + GameConfig: "GameConfig", + GameUiTools: "GameUiTools", + HttpManagerJs: "HttpManagerJs", + LanguageSetJs: "LanguageSetJs", + LoadSceneJs: "LoadSceneJs" + }], + OtherConfig: [function(e, t) { + "use strict"; + cc._RF.push(t, "608a3yCxFxLC6+PTyEzdmgt", "OtherConfig"); + var a = { + Continue: { + CN: "\u70b9\u51fb\u7ee7\u7eed", + CHT: "\u9ede\u64ca\u7e7c\u7e8c", + EN: "Click Continue", + KOR: "\ud074\ub9ad \ud558\uc5ec \uacc4\uc18d" + }, + name_1: { + CN: "\u874c\u86aa", + CHT: "\u874c\u86aa", + EN: "Tadpole", + KOR: "\uc62c\ucc59\uc774" + }, + name_2: { + CN: "\u9752\u86d9", + CHT: "\u9752\u86d9", + EN: "Frog", + KOR: "\uac1c\uad6c\ub9ac" + }, + name_3: { + CN: "\u4e4c\u9f9f", + CHT: "\u70cf\u9f9c", + EN: "Tortoise", + KOR: "\uac70\ubd81\uc774" + }, + name_4: { + CN: "\u5c0f\u91d1\u9c7c ", + CHT: "\u5c0f\u91d1\u9b5a", + EN: "Goldfish", + KOR: "\uc791\uc740 \uae08\ubd95\uc5b4" + }, + name_5: { + CN: "\u9526\u9ca4\u9c7c", + CHT: "\u9326\u9bc9\u9b5a", + EN: "Koi Fish", + KOR: "\uc789\uc5b4" + }, + name_6: { + CN: "\u7535\u9cd7", + CHT: "\u96fb\u9c3b", + EN: "Eel", + KOR: "\uc804\uae30\ubc40\uc7a5\uc5b4" + }, + name_7: { + CN: "\u9ca8\u9c7c", + CHT: "\u9bca\u9b5a", + EN: "Shark", + KOR: "\uc0c1\uc5b4." + }, + name_8: { + CN: "\u5927\u9cb8\u9c7c", + CHT: "\u5927\u9be8\u9b5a", + EN: "Whale", + KOR: "\ud070 \uace0\ub798" + }, + name_9: { + CN: "\u86df", + CHT: "\u86df", + EN: "Snake", + KOR: "\ud65c\uc6a9\ub2e8\uc5b4\ucc38\uc870" + }, + name_10: { + CN: "\u795e\u9f99", + CHT: "\u795e\u9f8d", + EN: "Dragon", + KOR: "\uc2e0\ub8e1" + }, + getStrForType: function(e) { + var t; + return t = "zh-CN" == window.navigator.language || "zh-cn" == window.navigator.language ? "CN" : "zh-TW" == window.navigator.language || "zh-HK" == window.navigator.language || "ja-JP" == window.navigator.language ? "CHT" : cc.sys.language == cc.sys.LANGUAGE_ENGLISH ? "EN" : cc.sys.language == cc.sys.LANGUAGE_KOREAN ? "KOR" : "EN", + null != this[e] ? this[e][t] : (cc.log("\u6ca1\u6709\u7ffb\u8bd1:" + e), + e) + } + }; + window.renderConfig = a, + window.zIndexAll = { + flower: 1 + }, + cc._RF.pop() + } + , {}], + PoolManager: [function(e, t) { + "use strict"; + cc._RF.push(t, "6ed4diP7FRFIJc3wpj5cOOM", "PoolManager"); + var a = { + PoolDic: { + bulletPool: null + }, + addPoolObj: function(e, t) { + null == this.PoolDic[e] && (this.PoolDic[e] = new cc.NodePool(e)), + this.PoolDic[e].put(t) + }, + getPoolObj: function(e) { + return null == this.PoolDic[e] ? null : this.PoolDic[e].size() > 1 ? this.PoolDic[e].get() : null + }, + clearPool: function(e) { + if (null != this.PoolDic[e]) + return this.PoolDic[e].clear(); + cc.error("\u6ca1\u6709\u6dfb\u52a0\u5bf9\u8c61\u6c60\uff1a", e) + } + }; + window.PoolManager = a, + cc._RF.pop() + } + , {}], + ToolsJs: [function(e, t) { + "use strict"; + cc._RF.push(t, "5eeb3uOnbFGtKGg8ygEwPGB", "ToolsJs"); + var a = { + SpriteFrameDic: {}, + PrefabDic: {}, + AudioClipDic: {}, + storageName: "LILILII", + setStorage: function(e, t, a) { + a && (t = JSON.stringify(t)), + e = this.storageName + e, + cc.sys.localStorage.setItem(e, t) + }, + getStorage: function(e, t) { + e = this.storageName + e; + var a = cc.sys.localStorage.getItem(e); + return isNaN(a) || (a = parseInt(a)), + "NaN" == a.toString() && (a = null), + t && null != a && (a = JSON.parse(a)), + a + }, + logJsonObject: function(e) { + console.log(JSON.stringify(e)) + }, + addNoArr: function(e, t) { + return e.indexOf(t) < 0 && (e.push(t), + !0) + }, + removeNodeForArr: function(e, t) { + return e.splice(e.indexOf(t), 1) + }, + addArrForIndex: function(e, t, a) { + return e.splice(t, 0, a) + }, + newSprite: function(e, t) { + var a = new cc.Node; + return null != this.SpriteFrameDic[e] ? (a.addComponent(cc.Sprite).spriteFrame = this.SpriteFrameDic[e], + null != t && t(a)) : (a.addComponent(cc.Sprite), + loadTools.loadNodeSprite(a, e, t)), + a + }, + setTexture: function(e, t) { + this.SpriteFrameDic[t] ? e.getComponent(cc.Sprite).spriteFrame = this.SpriteFrameDic[t] : loadTools.loadNodeSprite(e, t) + }, + setBtnClickSpr: function(e, t, a, i) { + this.SpriteFrameDic[t] ? (e.getComponent(cc.Button).normalSprite = this.SpriteFrameDic[t], + e.getComponent(cc.Button).hoverSprite = this.SpriteFrameDic[t], + e.getComponent(cc.Sprite).pressedSprite = this.SpriteFrameDic[a], + null != i && i()) : (loadTools.getResSpr(t, function(t) { + e.getComponent(cc.Button).normalSprite = t, + e.getComponent(cc.Button).hoverSprite = t + }), + loadTools.getResSpr(a, function(t) { + e.getComponent(cc.Button).pressedSprite = t, + null != i && i() + })) + }, + setSpriteState: function(e, t) { + var a = 0 == t ? "2d_sprite" : "gray_sprite"; + cc.loader.loadRes("materials/" + a, cc.Material, function(t, a) { + t ? cc.error(t) : e.getComponent(cc.Sprite).setMaterial(0, a) + }) + }, + clonePrefab: function(e, t, a, i, o) { + void 0 === o && (o = 0); + var n = this.PrefabDic[e] + , s = null; + return null != n ? (s = cc.instantiate(n), + t && t.addChild(s, o), + a && (s.position = a), + null != i && i(s)) : loadTools.loadPrefab(e, t, a, i, o), + s + }, + newLabel: function(e, t, a, i, o, n) { + void 0 === a && (a = 20), + void 0 === i && (i = .5), + void 0 === o && (o = .5), + void 0 === n && (n = 0); + var s = new cc.Node; + s.anchorX = i, + s.anchorY = o; + var c = s.addComponent(cc.Label); + return c.string = e, + c.fontSize = a, + t.addChild(s, n), + s + }, + delayTimeCall: function(e, t, a, i) { + e.runAction(cc.sequence(cc.delayTime(a), cc.callFunc(t, i))) + }, + getDistance: function(e, t) { + return e.sub(t).mag() + }, + getDiscForNode: function(e, t) { + var a = this.getToWorldPosAR(e) + , i = this.getToWorldPosAR(t); + return this.getDistance(a, i) + }, + getVectorForPos: function(e, t) { + return t.sub(e) + }, + getStrForNum: function(e, t, a) { + void 0 === t && (t = 1), + void 0 === a && (a = 2); + var i = ""; + return e >= 1e3 * Math.pow(10, a - 1) ? (e /= 1e3, + i = "k", + (e = Math.floor(e * Math.pow(10, t)) / Math.pow(10, t)) >= 1e3 && (e /= 1e3, + i = "M", + e = Math.floor(e * Math.pow(10, t)) / Math.pow(10, t)), + e >= 1e3 && (e /= 1e3, + i = "G", + e = Math.floor(e * Math.pow(10, t)) / Math.pow(10, t)), + e + i) : (e = Math.ceil(e)) + i + }, + getStrForNum2: function(e) { + var t = ""; + if ((e = (e || 0).toString()) <= 3) + return e; + for (; e.length > 3; ) + t = "," + e.slice(-3) + t, + e = e.slice(0, e.length - 3); + return e && (t = e + t), + t + }, + insertStrForIndex: function(e, t, a) { + return e.slice(0, t) + a + e.slice(t) + }, + prefixInteger: function(e, t) { + return void 0 === t && (t = 2), + (Array(t).join("0") + e).slice(-t) + }, + getNodePosForWroldPos: function(e, t) { + return e.convertToNodeSpaceAR(t) + }, + getToNodePos: function(e, t) { + var a = e.parent.convertToWorldSpaceAR(e.position); + return t.convertToNodeSpaceAR(a) + }, + getToWorldPosAR: function(e) { + return e.parent.convertToWorldSpaceAR(e.position) + }, + getToWorldPos: function(e) { + return e.parent.convertToWorldSpace(e.position) + }, + isBoxContainPos: function(e, t) { + return e.getBoundingBox().contains(t) + }, + isBoxContainWorldPos: function(e, t) { + return e.getBoundingBoxToWorld().contains(t) + }, + isRectInterRect: function(e, t) { + return e.getBoundingBoxToWorld().intersects(t.getBoundingBoxToWorld()) + }, + returnRandom: function(e, t) { + return e + Math.floor(Math.random() * (t - e + 1)) + }, + setAngleForParent: function() {}, + setNodeParent: function(e, t, a) { + void 0 === a && (a = !0); + var i = this.getToNodePos(e, t); + e.parent = t, + e.position = i, + a && e.parent && (e.angle += e.parent.angle) + }, + refractionY: function(e) { + return Math.atan2(Math.sin(e), -Math.cos(e)) + }, + refractionX: function(e) { + return Math.atan2(-Math.sin(e), Math.cos(e)) + }, + aginSortArr: function(e) { + for (var t = 0; t < e.length; t++) { + var i = a.returnRandom(0, e.length - 1); + if (i != t) { + var o = e[t]; + e[t] = e[i], + e[i] = o + } + } + }, + returnCurrentLanType: function() { + return cc.sys.language == cc.sys.LANGUAGE_CHINESE ? -1 != cc.sys.languageCode.toLowerCase().indexOf("zh-cn") || -1 != cc.sys.languageCode.toLowerCase().indexOf("zh_cn") ? 1 : 2 : cc.sys.language == cc.sys.LANGUAGE_KOREAN ? 4 : 3 + }, + getBeatItScore: function(e, t, a) { + if (e > a) + return 100; + if (e <= t) { + if (0 == e) + return 0; + var i = e / t * 80 + this.returnRandom(-3, 3); + return Math.max(Math.floor(i), 5) + } + var o = 80 + (e - t) / (a - t) * 20 + this.returnRandom(-3, 3); + return Math.min(Math.floor(o), 99) + }, + sortArrForObject: function(e, t, a) { + void 0 === a && (a = !1), + a ? e.sort(function(e, a) { + return a[t] - e[t] + }) : e.sort(function(e, a) { + return e[t] - a[t] + }) + }, + getDiffNumRandom: function(e, t, a) { + for (var i = [], o = e; o <= t; o++) + i.push(o); + for (var n = i.length - a, s = 0; s < n; s++) { + var c = this.returnRandom(0, i.length - 1); + i.splice(c, 1) + } + return i + }, + writeJson: function(e, t) { + if (cc.sys.isBrowser) { + console.log("\u6d4f\u89c8\u5668"); + var a = new Blob([e],{ + type: "application/json" + }) + , i = document.createElement("a"); + i.download = t, + i.innerHTML = "Download File", + null != window.webkitURL ? i.href = window.webkitURL.createObjectURL(a) : (i.href = window.URL.createObjectURL(a), + i.onclick = destroyClickedElement, + i.style.display = "none", + document.body.appendChild(i)), + i.click() + } + } + }; + window.ToolsJs = a, + cc._RF.pop() + } + , {}], + UIManager: [function(e, t) { + "use strict"; + cc._RF.push(t, "866bf0oenZKtoq5L6EbRayh", "UIManager"); + var a = { + UIDic: {}, + OpenUI: function(e, t, a) { + var o; + "string" == typeof e || (e = e.name), + i && i[e] && (o = i[e]), + null != o ? null == this.UIDic[e] ? (1 == a && this.removeAllUI(), + this.CreateUI(o, t)) : cc.error("\u5df2\u7ecf\u6253\u5f00\u8fc7UI:" + e) : cc.error("\u672a\u627e\u5230\u8be5UI\u7684\u914d\u7f6e\u4fe1\u606f:" + e) + }, + CloseUI: function(e, t) { + var a; + "string" == typeof e || (e = e.name), + null != (a = this.UIDic[e]) ? (a.getComponent(a.config.com) && null != a.getComponent(a.config.com).closeUI ? a.getComponent(a.config.com).closeUI(t) : a.destroy(), + this.UIDic[e] = null) : cc.error("\u5df2\u7ecf\u5173\u95ed\u8fc7UI:" + e) + }, + GetUI: function(e) { + var t = this.UIDic[e]; + return null != t ? t : (cc.log("\u6ca1\u6709\u6253\u5f00UI:" + e), + null) + }, + GetUIForJs: function(e) { + var t = this.UIDic[e]; + return null != t ? t.getComponent(t.config.com) : (cc.error("\u6ca1\u6709\u6253\u5f00UI:" + e), + null) + }, + CreateUI: function(e, t) { + var a = this; + if (null == this.UIDic[e.name]) { + var i = cc.director.getScene().getChildByName("Canvas"); + ToolsJs.clonePrefab(e.resUrl, i, null, function(i) { + i.config = e; + var o = i.getComponent(e.com); + null != o && null != o.openUI && o.openUI(t), + a.UIDic[e.name] = i + }, e.zIndex) + } + }, + removeAllUI: function() { + for (var e in this.UIDic) + this.CloseUI(e) + }, + openTipUI: function(e, t, a, i, o, n, s, c, r) { + void 0 === t && (t = 2), + void 0 === a && (a = 0), + void 0 === n && (n = !1), + void 0 === s && (s = 1); + var h = { + tipStr: e, + glodNum: a, + tipType: t, + yesCall: i, + noCall: o, + isDouble: n, + glodType: s, + yesStr: c || 2 == t ? renderConfig.getStrForType("yesStr") : renderConfig.getStrForType("sureStr"), + noStr: r || renderConfig.getStrForType("noStr") + }; + this.OpenUI("tipUIPanel", h) + } + }; + window.UIManager = a; + var i = { + nextPanel: { + name: "nextPanel", + resUrl: "nextPanel", + com: "nextPanel", + zIndex: 99 + } + }; + window.UIConfig = i, + cc._RF.pop() + } + , {}], + audioTools: [function(e, t) { + "use strict"; + cc._RF.push(t, "f0150VbHHtN2qKswCMoDllB", "audioTools"); + var a = { + bgAudio: null, + isPlayAudio: !0, + isPlayBG: !0, + playBG: function(e, t) { + void 0 === t && (t = .3), + this.isPlayBG && this.isPlayAudio && (this.stopBG(), + null != ToolsJs.AudioClipDic[e] ? this.bgAudio = cc.audioEngine.play(ToolsJs.AudioClipDic[e], !0, t) : this.bgAudio = cc.audioEngine.play(cc.url.raw("resources/music/" + e + ".mp3"), !0, t)) + }, + stopBG: function() { + this.stopAudio(this.bgAudio) + }, + playAudio: function(e, t, a) { + if (void 0 === t && (t = .5), + void 0 === a && (a = !1), + this.isPlayAudio) + return null != ToolsJs.AudioClipDic[e] ? cc.audioEngine.play(ToolsJs.AudioClipDic[e], a, t) : cc.audioEngine.play(cc.url.raw("resources/music/" + e + ".mp3"), a, t) + }, + stopAudio: function(e) { + null != e && (cc.audioEngine.stop(e), + e = null) + }, + newAduioSource: function(e) { + var t; + if (null != ToolsJs.AudioClipDic[e]) + t = ToolsJs.AudioClipDic[e]; + else { + if (null == e) + return console.log("clip\u4e0d\u80fd\u4e3a\u7a7a\uff01"), + null; + t = e + } + var a = new cc.Node; + return a.addComponent(cc.AudioSource).clip = t, + a.getComponent(cc.AudioSource) + } + }; + window.audioTools = a, + cc._RF.pop() + } + , {}], + endBlackJS: [function(e, t) { + "use strict"; + cc._RF.push(t, "10c1aPfzmNB9qwshKRmLq1A", "endBlackJS"); + var a = e("GameConfig"); + cc.Class({ + extends: cc.Component, + properties: {}, + onLoad: function() { + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS") + }, + clickEnterOverLayer: function() { + if (this.node.canTouch && (this.node.canTouch = !1, + a.publicGameBool, + this.mainSelf.initEndLayer(), + this.mainSelf.gameOverT1.node.destroy(), + this.mainSelf.gameOverT2.node.destroy(), + this.mainSelf.enemyNode.children.length > 0)) + for (var e = 0; e < this.mainSelf.enemyNode.children.length; e++) + this.mainSelf.enemyNode.children[e].typeID >= this.mainSelf.maxTypeID && this.mainSelf.enemyNode.children[e].destroy() + }, + start: function() {}, + update: function() {} + }), + cc._RF.pop() + } + , { + GameConfig: "GameConfig" + }], + enemyJS: [function(e, t) { + "use strict"; + cc._RF.push(t, "9bf97/TUWJAtJTYemvyINjL", "enemyJS"), + cc.Class({ + extends: cc.Component, + properties: {}, + onLoad: function() { + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS") + }, + start: function() {}, + onCollisionEnter: function(e, t) { + if (!this.mainSelf.gameOverFlags && (this.mainSelf.collision = t.node, + 666 == t.tag)) { + if (1 == e.tag) { + var a = e.node.typeID; + t.node.typeID > a && (this.mainSelf.createSmallFish(this.mainSelf.playerNode.typeID), + this.mainSelf.EatingEffectAction(e.node), + e.node.destroy()) + } + if (777 == e.tag && t.node.typeID > e.node.typeID) { + cc.audioEngine.play(this.mainSelf.HurtMusic, !1, 1), + this.mainSelf.EatingEffectAction2(e.node); + var i = e.node.typeID; + 1 == i ? ToolsJs.removeNodeForArr(this.mainSelf.kedouArr, e.node) : 2 == i ? ToolsJs.removeNodeForArr(this.mainSelf.qingwaArr, e.node) : 3 == i ? ToolsJs.removeNodeForArr(this.mainSelf.haiguiArr, e.node) : 4 == i ? ToolsJs.removeNodeForArr(this.mainSelf.xiaojinyuArr, e.node) : 5 == i ? ToolsJs.removeNodeForArr(this.mainSelf.jinliArr, e.node) : 6 == i ? ToolsJs.removeNodeForArr(this.mainSelf.dianmanArr, e.node) : 7 == i ? ToolsJs.removeNodeForArr(this.mainSelf.shayuArr, e.node) : 8 == i && ToolsJs.removeNodeForArr(this.mainSelf.jingyuArr, e.node), + e.node.destroy() + } + } + }, + update: function() {} + }), + cc._RF.pop() + } + , {}], + gameOverJs: [function(e, t) { + "use strict"; + cc._RF.push(t, "3621brbM61BsYFG7fM/74TL", "gameOverJs"); + var a = e("GameUiTools") + , i = e("GameConfig") + , o = e("MainManage"); + cc.Class({ + extends: cc.Component, + properties: { + bgLayer: cc.Node, + overScoreT: cc.Label, + overInfoT: cc.Label, + moreBtn: cc.Button, + leftBtn: cc.Button, + maxScoreText: cc.Label, + nametext: cc.Label, + nowFishNode: cc.Node, + maxFishNode: cc.Node, + mainNode: cc.Node, + replayBtn: cc.Node + }, + onLoad: function() { + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS"), + this.canTouchReplay = !1, + this.standardScore = i.standScore, + this.game_max_score = 2 * this.standardScore, + this.endPercent = ToolsJs.getBeatItScore(this.mainSelf.maxTypeID, i.standScore, 2 * i.standScore), + this.rigthBtnGameName = null, + this.rightBtnGameUrl = null, + this.UIPosChange(), + this.addClickBtns(); + var e; + this.returnCurrentLanType(); + this.maxScoreText.string = n, + this.maxScoreText._forceUpdateRenderData(), + e = this.maxScoreText.node.width; + var t = this.maxScoreText.node.children[0] + , a = e + t.width * t.scale * this.maxScoreText.node.scale + 8; + this.maxScoreText.node.x = a / 2 - e, + this.node.opacity = 0, + this.node.runAction(cc.sequence(cc.fadeIn(.3), cc.callFunc(function() { + this.canTouchReplay = !0, + this.replayBtn.runAction(cc.sequence(cc.delayTime(2), cc.scaleTo(.3, .8).easing(cc.easeSineInOut()), cc.scaleTo(.3, .7).easing(cc.easeSineInOut()), cc.rotateTo(.1, 15).easing(cc.easeSineInOut()), cc.rotateTo(.2, -15).easing(cc.easeSineInOut()), cc.rotateTo(.1, 15).easing(cc.easeSineInOut()), cc.rotateTo(.2, -15).easing(cc.easeSineInOut()), cc.rotateTo(.1, 0).easing(cc.easeSineInOut()))).repeatForever() + }, this))), + this.moreBtn.node.y = cc.winSize.height / 2 - 80; + var o = this.mainSelf.maxTypeID + , n = this.getHighScore(); + n ? n < this.mainSelf.maxTypeID && (this.setHisSocre(this.mainSelf.maxTypeID), + n = this.mainSelf.maxTypeID) : (this.setHisSocre(this.mainSelf.maxTypeID), + n = o), + this.typeID = n, + this.endPageDisplay(), + this.nametext.string = renderConfig.getStrForType("name_" + this.mainSelf.maxTypeID) + }, + endPageDisplay: function() { + var e = this.mainSelf.maxTypeID; + this.nowFishNode.getChildByName("fish1").active = !1, + this.nowFishNode.getChildByName("fish" + e).active = !0, + this.maxFishNode.scaleX = .8, + this.maxFishNode.scaleY = .8 + }, + returnCurrentLanType: function() { + var e = 1; + switch (cc.sys.language) { + case cc.sys.LANGUAGE_CHINESE: + "zh-TW" == window.navigator.language || "zh-tw" == window.navigator.language || "zh-HK" == window.navigator.language || "zh-hk" == window.navigator.language ? (cc.log("\u7e41\u4f53"), + e = 2) : (cc.log("\u7b80\u4f53"), + e = 1); + break; + case cc.sys.LANGUAGE_KOREAN: + e = 4; + break; + default: + e = 3 + } + return e + }, + setHisSocre: function(e) { + cc.sys.localStorage.setItem("ZhaoHuanShenLong_12WS", e) + }, + getHighScore: function() { + return cc.sys.localStorage.getItem("ZhaoHuanShenLong_12WS") + }, + UIPosChange: function() { + this.overScoreT.string = i.gameScore, + console.log("lang", o.langugeType); + var e = null + , t = null; + 1 == i.curType ? (e = this.getContentByScore(i.gameScore, o.gameNameText), + t = this.getContentByScore1(i.gameScore, o.gameNameText)) : 2 == i.curType ? (e = this.getContentByScore2_1(i.gameScore, o.gameNameText), + t = this.getContentByScore2(i.gameScore, o.gameNameText)) : 3 == i.curType ? (e = this.getContentByScore3_1(i.gameScore, o.gameNameText), + t = this.getContentByScore3(i.gameScore, o.gameNameText)) : 4 == i.curType && (e = this.getContentByScore4_1(i.gameScore, o.gameNameText), + t = this.getContentByScore4(i.gameScore, o.gameNameText)), + console.log("nihao", o.endHttpShowInfo), + this.overInfoT.string = t, + document.title = e + }, + addClickBtns: function() { + var e = this; + e.moreBtn.node.on(cc.Node.EventType.TOUCH_START, function() {}), + e.moreBtn.node.on(cc.Node.EventType.TOUCH_END, function() { + console.log("MoreGame"), + window.location.href = o.moreGameUrl + }), + e.leftBtn.node.on(cc.Node.EventType.TOUCH_START, function() {}), + e.leftBtn.node.on(cc.Node.EventType.TOUCH_END, function() { + e.canTouchReplay && (cc.eventManager.removeAllListeners(), + i.GAME_OVER_BOOL = !0, + i.gameScore = 0, + i.publicGameBool, + console.log("loadScene"), + a.loadingScene("MainGameScene")) + }) + }, + getPercent: function(e) { + return e <= 0 ? 0 : e <= 30 ? 1 + Math.floor(3 * Math.random()) : e <= 40 ? 5 + Math.floor(10 * Math.random()) : e <= 50 ? 10 + Math.floor(10 * Math.random()) : e <= 60 ? 20 + Math.floor(15 * Math.random()) : e <= 70 ? 30 + Math.floor(15 * Math.random()) : e <= 80 ? 40 + Math.floor(20 * Math.random()) : e <= 100 ? 50 + Math.floor(30 * Math.random()) : e <= 120 ? 60 + Math.floor(30 * Math.random()) : e <= 160 ? 70 + Math.floor(25 * Math.random()) : e <= 190 ? 80 + Math.floor(19 * Math.random()) : e <= 250 ? 91 + Math.floor(9 * Math.random()) : 100 + }, + getContentByScore: function(e, t) { + var a = "\u6211\u771f\u662f\u592a\u5389\u5bb3\uff0c\u5728" + t + "\u4e2d\u7adf\u7136\u5f97\u4e860\u5206\uff0c\u5168\u7403\u53ea\u67091\u4e2a\u4eba\u5f970\u5206\uff01" + , i = parseInt(.3 * this.standardScore) + , o = parseInt(.5 * this.standardScore) + , n = parseInt(.7 * this.standardScore) + , s = parseInt(.9 * this.standardScore) + , c = this.endPercent; + return e > 0 && e <= i ? a = "\u6211\u5728" + t + "\u4e2d\u51fb\u8d25\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u771f\u662f\u592a\u68d2\u4e86\uff0c\u518d\u7ec3\u7ec3\u5c31\u80fd\u8fbe\u5230\u6e38\u5203\u6709\u4f59\u7684\u5883\u754c\uff01" : e > i && e <= this.standardScore ? a = "\u6211\u5728" + t + "\u4e2d\u5f97\u51fb\u8d25\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u771f\u662f\u592a\u68d2\u4e86\uff0c\u518d\u7ec3\u7ec3\u5c31\u80fd\u8fbe\u5230\u6e38\u5203\u6709\u4f59\u7684\u5883\u754c\uff01" : e > this.standardScore && e <= o ? a = "\u6211\u5728" + t + "\u4e2d\u51fb\u8d25\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u8fdb\u5165\u4e86\u4fe1\u624b\u62c8\u6765\u7684\u5883\u754c\uff01" : e > o && e <= n ? a = "\u6211\u5728" + t + "\u4e2d\u51fb\u8d25\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u8fdb\u5165\u4e86\u8fd0\u7528\u81ea\u5982\u7684\u5883\u754c\uff01" : e > n && e <= s ? a = "\u6211\u5728" + t + "\u4e2d\u51fb\u8d25\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u8fbe\u5230\u4e86\u884c\u4e91\u6d41\u6c34\u7684\u5883\u754c\uff01" : e > s && e < this.game_max_score ? a = "\u6211\u5728" + t + "\u4e2d\u51fb\u8d25\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u72ec\u5b64\u6c42\u8d25\uff01" : e >= this.game_max_score && (a = "\u6211\u5728" + t + "\u4e2d\u51fb\u8d25\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u8d85\u8d8a\u4e86\u72ec\u5b64\u6c42\u8d25\uff0c\u5fc3\u6709\u7075\u7280\uff01"), + a + }, + getContentByScore2_1: function(e, t) { + var a = "\u6211\u771f\u662f\u592a\u53b2\u5bb3\uff0c\u5728" + t + "\u4e2d\u7adf\u7136\u5f97\u4e860\u5206\uff0c\u5168\u7403\u53ea\u67091\u500b\u4eba\u5f970\u5206\uff01" + , i = parseInt(.3 * this.standardScore) + , o = parseInt(.5 * this.standardScore) + , n = parseInt(.7 * this.standardScore) + , s = parseInt(.9 * this.standardScore) + , c = this.endPercent; + return e > 0 && e <= i ? a = "\u6211\u5728" + t + "\u4e2d\u64ca\u6557\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u771f\u662f\u592a\u68d2\u4e86\uff0c\u518d\u7df4\u7df4\u5c31\u80fd\u9054\u5230\u904a\u5203\u6709\u9918\u7684\u5883\u754c\uff01" : e > i && e <= this.standardScore ? a = "\u6211\u5728" + t + "\u4e2d\u64ca\u6557\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u771f\u662f\u592a\u68d2\u4e86\uff0c\u518d\u7ec3\u7ec3\u5c31\u80fd\u8fbe\u5230\u6e38\u5203\u6709\u4f59\u7684\u5883\u754c\uff01" : e > this.standardScore && e <= o ? a = "\u6211\u5728" + t + "\u4e2d\u64ca\u6557\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u9032\u5165\u4e86\u4fe1\u624b\u62c8\u4f86\u7684\u5883\u754c\uff01" : e > o && e <= n ? a = "\u6211\u5728" + t + "\u4e2d\u64ca\u6557\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u9032\u5165\u4e86\u904b\u7528\u81ea\u5982\u7684\u5883\u754c\uff01" : e > n && e <= s ? a = "\u6211\u5728" + t + "\u4e2d\u64ca\u6557\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u9054\u5230\u4e86\u884c\u96f2\u6d41\u6c34\u7684\u5883\u754c\uff01" : e > s && e < this.game_max_score ? a = "\u6211\u5728" + t + "\u4e2d\u64ca\u6557\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u7368\u5b64\u6c42\u6557\uff01" : e >= this.game_max_score && (a = "\u6211\u5728" + t + "\u4e2d\u64ca\u6557\u4e86\u5168\u7403" + c + "%\u7684\u73a9\u5bb6\uff0c\u8d85\u8d8a\u4e86\u7368\u5b64\u6c42\u6557\uff0c\u5fc3\u6709\u9748\u7280\uff01"), + a + }, + getContentByScore3_1: function(e, t) { + var a = "I'm awesome\uff0cin" + t + "get 0 score\uff0conly one person in the world has a 0\uff01" + , i = parseInt(.3 * this.standardScore) + , o = parseInt(.5 * this.standardScore) + , n = parseInt(.7 * this.standardScore) + , s = parseInt(.9 * this.standardScore) + , c = this.endPercent; + return e >= this.game_max_score ? a = "I got " + e + " points in the game, defeating all players worldwide, waiting for you to fight!" : e > 0 && e <= i ? a = "I got " + e + " points in the game, really great\uff01" : e > i && e <= this.standardScore ? a = "I got " + e + " points in the game, really great\uff01" : e > this.standardScore && e <= o ? a = "I got " + e + " points in the game , beating out " + c + "% of global players\uff01" : e > o && e <= n ? a = "I got " + e + " points in the game , beating out " + c + "% of global players\uff01" : e > n && e <= s ? a = "I got " + e + " points in the game , beating out 99% of global players\uff01" : e > s && e < this.game_max_score && (a = "I got " + e + " points in the game, it said to be the world's only 10 people to reach this level! Have you?"), + a + }, + getContentByScore4_1: function(e) { + var t = "\ub09c \uc815\ub9d0 \ub300\ub2e8 \ud574, \uac8c\uc784 \uc5d0\uc11c \ubb34\ub824 0 \uc810 \uc744 \ubc1b \uc558 \uc2b5 \ub2c8 \ub2e4. \uc804 \uc138\uacc4 \uc5d0\uc11c 1 \uba85 \ub9cc 0 \uc810 \uc744 \ubc1b \uc558 \uc2b5 \ub2c8 \ub2e4!" + , a = parseInt(.3 * this.standardScore) + , i = parseInt(.5 * this.standardScore) + , o = parseInt(.7 * this.standardScore) + , n = parseInt(.9 * this.standardScore) + , s = this.endPercent; + return e > 0 && e <= a ? t = "\uc800 \ub294 \uac8c\uc784 \uc5d0\uc11c " + e + " \uc810 \uc744 \ud68d\ub4dd \ud558\uc5ec \uc804 \uc138\uacc4 " + s + "% \uc720 \uc800 \ub97c \uaca9\ud30c \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!" : e > a && e <= this.standardScore ? t = "\uc800 \ub294 \uac8c\uc784 \uc5d0\uc11c " + e + " \uc810 \uc744 \ud68d\ub4dd \ud558\uc5ec \uc804 \uc138\uacc4 " + s + "% \uc720 \uc800 \ub97c \uaca9\ud30c \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!" : e > this.standardScore && e <= i ? t = "\uc800 \ub294 \uac8c\uc784 \uc5d0\uc11c " + e + " \uc810 \uc744 \ud68d\ub4dd \ud558\uc5ec \uc804 \uc138\uacc4 " + s + "% \uc720 \uc800 \ub97c \uaca9\ud30c \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!" : e > i && e <= o ? t = "\uc800 \ub294 \uac8c\uc784 \uc5d0\uc11c " + e + " \uc810 \uc744 \ud68d\ub4dd \ud558\uc5ec \uc804 \uc138\uacc4 " + s + "% \uc720 \uc800 \ub97c \uaca9\ud30c \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!" : e > o && e <= n ? t = "\uc800 \ub294 \uac8c\uc784 \uc5d0\uc11c " + e + " \uc810 \uc744 \ud68d\ub4dd \ud558\uc5ec \uc804 \uc138\uacc4 " + s + "% \uc720 \uc800 \ub97c \uaca9\ud30c \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!" : e > n && e < this.game_max_score ? t = "\uc800 \ub294 \uac8c\uc784 \uc5d0\uc11c " + e + " \uc810 \uc744 \ud68d\ub4dd \ud558\uc5ec \uc804 \uc138\uacc4 " + s + "% \uc720 \uc800 \ub97c \uaca9\ud30c \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!" : e >= this.game_max_score && (t = "\uc800 \ub294 \uac8c\uc784 \uc5d0\uc11c " + e + " \uc810 \uc744 \ud68d\ub4dd \ud558\uc5ec \uc804 \uc138\uacc4 " + s + "% \uc720 \uc800 \ub97c \uaca9\ud30c \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!"), + t + }, + getContentByScore1: function() { + return "\u51fb\u8d25\u4e86\u5168\u7403" + this.endPercent + "%\u7684\u73a9\u5bb6\uff01" + }, + getContentByScore2: function() { + return "\u64ca\u6557\u4e86\u5168\u7403" + this.endPercent + "%\u7684\u73a9\u5bb6\uff01" + }, + getContentByScore3: function() { + return "Beat " + this.endPercent + "% of the world's players!" + }, + getContentByScore4: function() { + return "\uc804 \uc138\uacc4" + this.endPercent + "%\uc720 \uc800 \ub97c \ucc98\uce58 \ud558 \uc600 \uc2b5 \ub2c8 \ub2e4!" + }, + start: function() {}, + update: function() {} + }), + cc._RF.pop() + } + , { + GameConfig: "GameConfig", + GameUiTools: "GameUiTools", + MainManage: "MainManage" + }], + jianceJS: [function(e, t) { + "use strict"; + cc._RF.push(t, "671d7/ykbxBLKzxFW4yZU5f", "jianceJS"), + cc.Class({ + extends: cc.Component, + properties: {}, + onLoad: function() { + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS") + }, + start: function() {}, + onCollisionEnter: function(e, t) { + if (!this.mainSelf.gameOverFlags && 2 == e.tag) { + var a = this.mainSelf.playerNode.typeID; + t.node.parent.typeID > a && this.mainSelf.ChasePlayer(t.node.parent), + t.node.parent.typeID == a && this.mainSelf.EscapePlayer(t.node.parent) + } + }, + onCollisionExit: function(e, t) { + if (2 == e.tag) { + var a = this.mainSelf.playerNode.typeID; + t.node.parent.typeID != a && (t.node.parent.stopAllActions(), + this.mainSelf.enemyAction(t.node.parent)) + } + }, + update: function() {} + }), + cc._RF.pop() + } + , {}], + leafJS: [function(e, t) { + "use strict"; + cc._RF.push(t, "f0114pL/kNBoLIFzlmVI/1D", "leafJS"), + e("../commonJs/mTool_WHQ").getRandomNum; + var a = e("../commonJs/mTool_WHQ"); + cc.Class({ + extends: cc.Component, + properties: {}, + onLoad: function() { + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS"), + this.delay = a.getRandomNum(.5, 5, !1), + this.startScaleX = this.node.scaleX, + this.startScaleY = this.node.scaleY, + this.random = a.getRandomNum(1, 10), + this.random <= 3 && this.Action() + }, + start: function() {}, + Action: function() { + this.node.runAction(cc.sequence(cc.scaleBy(.2, 1.1, 1.1), cc.scaleTo(.2, this.startScaleX, this.startScaleY), cc.scaleBy(.2, 1.1, 1.1), cc.scaleTo(.2, this.startScaleX, this.startScaleY), cc.callFunc(function() { + var e = this; + this.scheduleOnce(function() { + e.random = a.getRandomNum(1, 10), + e.random <= 3 && e.Action(), + e.delay = a.getRandomNum(2, 5, !1) + }, this.delay) + }, this))) + }, + update: function() {} + }), + cc._RF.pop() + } + , { + "../commonJs/mTool_WHQ": "mTool_WHQ" + }], + linkHttpIconJs: [function(e, t) { + "use strict"; + cc._RF.push(t, "95474fr0oNDP7SAidILF03q", "linkHttpIconJs"); + var a = e("MainManage"); + e("GameConfig"), + cc.Class({ + extends: cc.Component, + properties: { + iconSpr: cc.Node, + iconSpr1: cc.Node + }, + onLoad: function() { + if (this._imageArr = [], + this.stopUpdateBool = !0, + this.gameWidth = cc.winSize.width, + this.gameHeight = cc.winSize.height, + null != a.recGameData && "" != a.recGameData && null != a.recGameimg1 && "" != a.recGameimg1) { + var e = 50 - this.gameWidth / 2 + , t = this.gameHeight - 50 - this.gameHeight / 2; + null != a.recGamePos && "" != a.recGamePos && (1 == a.recGamePos ? (e = 50 - this.gameWidth / 2, + t = this.gameHeight - 50 - this.gameHeight / 2) : 2 == a.recGamePos ? (e = this.gameWidth - 50 - this.gameWidth / 2, + t = this.gameHeight - 50 - this.gameHeight / 2) : 3 == a.recGamePos ? (e = this.gameWidth - 50 - this.gameWidth / 2, + t = 50 - this.gameHeight / 2) : 4 == a.recGamePos && (e = 50 - this.gameWidth / 2, + t = 50 - this.gameHeight / 2)); + var i = a.recGameimg1 + , o = a.recGameimg2 + , n = this.iconSpr + , s = this.iconSpr1 + , c = this; + cc.loader.load(i, function(a, i) { + n.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(i), + c.iconSpr.opacity = 0, + c.iconSpr.x = e, + c.iconSpr.y = t, + c._imageArr.push(c.iconSpr) + }), + cc.loader.load(o, function(a, i) { + s.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(i), + c.iconSpr1.opacity = 0, + c.iconSpr1.x = e, + c.iconSpr1.y = t, + c._imageArr.push(c.iconSpr1) + }) + } + this.addTouchEvents() + }, + showLinkPic: function() { + var e, t; + e = null != a.recGameDelPau ? a.recGameDelPau : 6, + cc.log("dMainManager.recGameDelPer", a.recGameDelPer), + t = null != a.recGameDelPer ? a.recGameDelPer : .7, + this._imageArr[0].opacity = 255, + this._imageArr[0].runAction(cc.repeatForever(cc.sequence(cc.delayTime(e), cc.rotateBy(t, 0, 180), cc.callFunc(function() { + this._imageArr[0].setRotation(0), + this._imageArr[0].opacity = 0, + this._imageArr[1].opacity = 255 + }, this), cc.delayTime(e), cc.callFunc(function() { + this.flowerAction(this._imageArr[1], t) + }, this), cc.delayTime(t), cc.callFunc(function() { + this._imageArr[1].opacity = 0, + this._imageArr[0].opacity = 255 + }, this)))) + }, + flowerAction: function(e, t) { + e.runAction(cc.sequence(cc.rotateBy(t, 0, 180), cc.callFunc(function() { + e.setRotation(0) + }))) + }, + start: function() {}, + addTouchEvents: function() { + cc.EventListener.TOUCH_ONE_BY_ONE + }, + update: function() { + this.stopUpdateBool && this._imageArr.length >= 2 && (this.stopUpdateBool = !1, + this.showLinkPic()) + } + }), + cc._RF.pop() + } + , { + GameConfig: "GameConfig", + MainManage: "MainManage" + }], + loadTools: [function(e, t) { + "use strict"; + cc._RF.push(t, "9ea23JPr69LB6K5CalAIXPw", "loadTools"); + var a = { + loadNodeSprite: function(e, t, a) { + e.getComponent(cc.Sprite) ? cc.loader.loadRes(t, cc.SpriteFrame, function(t, i) { + t ? cc.error(t) : (e.getComponent(cc.Sprite).spriteFrame = i, + null != a && a(e)) + }) : cc.error("node\u4e0a\u6ca1\u6709Sprite\u7ec4\u4ef6\uff1a", e) + }, + getResSpr: function(e, t) { + cc.loader.loadRes(e, cc.SpriteFrame, function(e, a) { + e ? cc.error(e) : null != t && t(a) + }) + }, + loadPrefab: function(e, t, a, i, o) { + void 0 === o && (o = 0), + cc.loader.loadRes(e, cc.Prefab, function(e, n) { + if (e) + cc.error(e); + else { + var s = cc.instantiate(n); + t ? t.addChild(s, o) : cc.director.getScene().children[0].addChild(s, 100), + a && (s.position = a), + i && i(s) + } + }) + }, + loadScene: function(e, t) { + cc.director.preloadScene(e, function() { + cc.director.loadScene(e, t) + }) + }, + loadJson: function() {} + }; + window.loadTools = a, + cc._RF.pop() + } + , {}], + mTool_WHQ: [function(e, t) { + "use strict"; + cc._RF.push(t, "fe57af2WNxE+67eFxNClrcq", "mTool_WHQ"); + var a = { + getRandomNum: function(e, t, a) { + return a ? Math.floor(Math.random() * (t - e + 1) + e) : Math.random() * (t - e) + e + }, + cbPosToWorldPos: function(e, t, a, i, o, n) { + var s = a + (e.x - t / 2 + .5) * o + , c = i + (e.y + .5) * n; + return cc.v2(s, c) + }, + worldPosToCbPos: function(e, t, a, i, o, n) { + var s = (e.x - a) / o - .5 + t / 2 + , c = (e.y - i) / n - .5; + return s % 1 == 0 && c % 1 == 0 || (s = Math.round(s), + c = Math.round(c)), + cc.v2(s, c) + }, + judgeInArr: function(e, t) { + for (var a = 0; a < t.length; a++) + if (t[a] === e) + return !0; + return !1 + }, + getAngleByPos: function(e, t) { + var a = t.x - e.x + , i = t.y - e.y; + return 360 * Math.atan(i / a) / (2 * Math.PI) + }, + judgeIntersect: function(e, t, a, i, o, n, s, c) { + return Math.min(e, a) <= Math.max(o, s) && Math.min(n, c) <= Math.max(t, i) && Math.min(o, s) <= Math.max(e, a) && Math.min(t, i) <= Math.max(n, c) && ((o - e) * (i - t) - (a - e) * (n - t)) * ((s - e) * (i - t) - (a - e) * (c - t)) <= 1e-8 && ((e - o) * (c - n) - (s - o) * (t - n)) * ((a - o) * (c - n) - (s - o) * (i - n)) <= 1e-8 + }, + getNormalizeVector: function(e, t) { + return t.sub(e).normalize() + }, + judgeItemOverlapping: function(e, t, a, i, o, n, s, c) { + return !(e + a < o || o + s < e || t + i < n || n + c < t) + }, + getCircumferencePos: function(e, t, a) { + var i = cc.v2(0, 0); + return i.x = e.x + Math.sin(2 * Math.PI / 360 * a) * t, + i.y = e.y + Math.cos(2 * Math.PI / 360 * a) * t, + i + }, + upsetArr: function(e) { + return e.sort(function() { + return Math.random() > .5 ? -1 : 1 + }) + }, + getAudio: function(e, t) { + return cc.sys.os === cc.sys.OS_IOS ? e : t + }, + setLocalData: function(e, t) { + cc.sys.localStorage.setItem(e, t) + }, + getLocalData: function(e) { + return cc.sys.localStorage.getItem(e) + }, + getNodePos: function(e, t, a) { + return a ? e.convertToNodeSpaceAR(t.convertToWorldSpaceAR(a)) : e.convertToNodeSpaceAR(t.convertToWorldSpaceAR()) + }, + judgeArrSame: function(e, t) { + for (var a = 0; a < e.length; a++) + for (var i = 0; i < t.length; i++) + if (e[a] !== t[i]) + return !1; + return !0 + }, + pDistance: function(e, t) { + return e.sub(t).mag() + }, + getAngleByVector: function(e) { + return e.y < 0 ? 360 - cc.v2(1, 0).angle(e) / Math.PI * 180 : cc.v2(1, 0).angle(e) / Math.PI * 180 + }, + getBoundingBoxToNode: function(e, t) { + var a = t.convertToNodeSpaceAR(e.convertToWorldSpaceAR(cc.v2(-e.anchorX * e.width * (e.scaleX / Math.abs(e.scaleX)), -e.anchorY * e.height * (e.scaleY / Math.abs(e.scaleY))))); + return cc.rect(a.x, a.y, e.width * Math.abs(e.scaleX), e.height * Math.abs(e.scaleY)) + }, + degreesToVectors: function(e) { + var t = cc.misc.degreesToRadians(e); + return cc.v2(1, 0).rotate(-t) + }, + vectorsToDegrees: function(e) { + if (Math.abs(e.x) + Math.abs(e.y) !== 0) { + var t = cc.v2(1, 0) + , a = e.signAngle(t); + return cc.misc.radiansToDegrees(a) + } + return 0 + } + }; + t.exports = a, + cc._RF.pop() + } + , {}], + player2JS: [function(e, t) { + "use strict"; + cc._RF.push(t, "f41fcJj045KGo2ubgiEeGaA", "player2JS"), + cc.Class({ + extends: cc.Component, + properties: {}, + onLoad: function() { + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS") + }, + start: function() {}, + onCollisionEnter: function(e, t) { + if (!this.mainSelf.gameOverFlags && 1 == e.tag) { + if (e.flags) + return; + var a = e.node.typeID; + t.node.typeID >= a && (e.tag = 9999, + this.mainSelf.EatSmallAction(e.node, this.mainSelf.myFish)) + } + }, + update: function() {} + }), + cc._RF.pop() + } + , {}], + playerJS: [function(e, t) { + "use strict"; + cc._RF.push(t, "ba7b9DpttpMLq9QsKGwuABo", "playerJS"), + cc.Class({ + extends: cc.Component, + properties: {}, + onLoad: function() { + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS") + }, + start: function() {}, + onCollisionEnter: function(e, t) { + if (!this.mainSelf.gameOverFlags) { + if (this.mainSelf.collision = t.node, + (t.tag = 666) && 1 == e.tag) { + var a = e.node.typeID; + this.mainSelf.playerNode.typeID >= a && (e.tag = 999, + this.mainSelf.EatSmallAction(e.node, t.node), + this.mainSelf.EatingEffectAction(e.node)) + } + if ((t.tag = 2) && 666 == e.tag) { + var i = e.node.typeID; + this.mainSelf.playerNode.typeID < i && this.mainSelf.JudgeSmallFish() + } + } + }, + update: function() {} + }), + cc._RF.pop() + } + , {}], + resArr: [function(e, t) { + "use strict"; + cc._RF.push(t, "d1951bUsVBEo7LtLLUajDCO", "resArr"), + cc.Class({ + extends: cc.Component, + properties: { + SpriteFrameArr: [cc.SpriteFrame], + PrefabArr: [cc.Prefab], + audiosArr: { + type: cc.AudioClip, + default: [] + } + }, + onLoad: function() { + this.addPrefabs(), + this.addSpriteFrame(), + this.addAudio() + }, + addAudio: function() { + this.audioClipDic = {}; + for (var e = 0; e < this.audiosArr.length; e++) + if (this.audiosArr[e]) { + var t = this.audiosArr[e]; + this.audioClipDic[t.name] = t + } + ToolsJs.AudioClipDic = this.audioClipDic + }, + addSpriteFrame: function() { + this.spriteArr = {}; + for (var e = 0; e < this.SpriteFrameArr.length; e++) + if (this.SpriteFrameArr[e]) { + var t = this.SpriteFrameArr[e]; + this.spriteArr[t.name] = t + } + ToolsJs.SpriteFrameDic = this.spriteArr + }, + addPrefabs: function() { + this.prefabsArr = {}; + for (var e = 0; e < this.PrefabArr.length; e++) + if (this.PrefabArr[e]) { + var t = this.PrefabArr[e]; + this.prefabsArr[t.name] = t + } + ToolsJs.PrefabDic = this.prefabsArr + } + }), + cc._RF.pop() + } + , {}], + rockerJS: [function(e, t) { + "use strict"; + cc._RF.push(t, "132743iYdROWry4PeEjE8Fb", "rockerJS"), + cc.Class({ + extends: cc.Component, + properties: { + buttonNode: cc.Node + }, + onLoad: function() { + this.node.opacity = 0, + this.mainSelf = cc.find("Canvas").getComponent("MainGameJS"), + this.max_r = this.node.width / 2; + var e = cc.v2(0, 0); + this.dir = cc.v2(0, 0), + this.buttonNode.setPosition(e), + this.mainSelf.node.on(cc.Node.EventType.TOUCH_END, function() { + this.buttonNode.setPosition(cc.v2(0, 0)) + }, this), + this.mainSelf.node.on(cc.Node.EventType.TOUCH_CANCEL, function() { + this.buttonNode.setPosition(cc.v2(0, 0)) + }, this), + this.mainSelf.node.on(cc.Node.EventType.TOUCH_MOVE, function(e) { + var t = e.getLocation() + , a = this.node.convertToNodeSpaceAR(t) + , i = a.mag(); + this.dir.x = a.x / i, + this.dir.y = a.y / i, + i > this.max_r && (a.x = a.x / i * this.max_r, + a.y = a.y / i * this.max_r), + this.dir.mag() > .5 && i > 0 && (this.mainSelf.OffPos = this.dir), + this.buttonNode.setPosition(a) + }, this), + this.mainSelf.node.on(cc.Node.EventType.TOUCH_START, function(e) { + var t = e.getLocation() + , a = this.mainSelf.node.convertToNodeSpaceAR(t); + this.node.setPosition(a) + }, this) + }, + start: function() {}, + update: function() {} + }), + cc._RF.pop() + } + , {}], + startGameJs: [function(e, t) { + "use strict"; + cc._RF.push(t, "280c3rsZJJKnZ9RqbALVwtK", "startGameJs"), + e("GameUiTools"), + e("HttpManagerJs"); + var a = e("MainManage") + , i = (e("LoadSceneJs"), + e("GameConfig")); + cc.Class({ + extends: cc.Component, + properties: { + showInfoT: cc.Label, + startT: cc.Label + }, + onLoad: function() { + i.publicGameBool && a.init(), + this.showInfoT.string = a.gameInfoText, + this.startT.string = a.txtStartText, + this.node.zIndex = 100, + this.node.on("touchend", function() { + this.node.x = -2e3 + }, this) + }, + update: function() {} + }), + cc._RF.pop() + } + , { + GameConfig: "GameConfig", + GameUiTools: "GameUiTools", + HttpManagerJs: "HttpManagerJs", + LoadSceneJs: "LoadSceneJs", + MainManage: "MainManage" + }], + use_reversed_rotateTo: [function(e, t) { + "use strict"; + cc._RF.push(t, "16142aty4ZFBpA8RBwxcagf", "use_reversed_rotateTo"), + cc.RotateTo._reverse = !0, + cc._RF.pop() + } + , {}] +}, {}, ["HttpManagerJs", "LanguageSetJs", "LoadSceneJs", "MainGameJS", "resArr", "MainManage", "AniTools", "ToolsJs", "audioTools", "loadTools", "GameConfig", "GameUiTools", "mTool_WHQ", "gameOverJs", "linkHttpIconJs", "EventManager", "PoolManager", "UIManager", "EventData", "OtherConfig", "endBlackJS", "enemyJS", "jianceJS", "leafJS", "player2JS", "playerJS", "rockerJS", "startGameJs", "use_reversed_rotateTo"]); \ No newline at end of file diff --git a/assets/main/native/01/01d9854a-77b0-4814-bf68-cc5399d113fe.de749.mp3 b/assets/main/native/01/01d9854a-77b0-4814-bf68-cc5399d113fe.de749.mp3 new file mode 100644 index 0000000..81bc52b Binary files /dev/null and b/assets/main/native/01/01d9854a-77b0-4814-bf68-cc5399d113fe.de749.mp3 differ diff --git a/assets/main/native/0b/0b1d0f37-84b5-47d0-98b1-c6e3c857c183.a72af.png b/assets/main/native/0b/0b1d0f37-84b5-47d0-98b1-c6e3c857c183.a72af.png new file mode 100644 index 0000000..6619852 Binary files /dev/null and b/assets/main/native/0b/0b1d0f37-84b5-47d0-98b1-c6e3c857c183.a72af.png differ diff --git a/assets/main/native/0b/0b777b77-8bbe-405b-9cf7-1ce1e4f0b7d5.0a5d8.png b/assets/main/native/0b/0b777b77-8bbe-405b-9cf7-1ce1e4f0b7d5.0a5d8.png new file mode 100644 index 0000000..7ae8c45 Binary files /dev/null and b/assets/main/native/0b/0b777b77-8bbe-405b-9cf7-1ce1e4f0b7d5.0a5d8.png differ diff --git a/assets/main/native/10/100eb677-cf92-4725-a791-6c700f6e370a.92fd3.png b/assets/main/native/10/100eb677-cf92-4725-a791-6c700f6e370a.92fd3.png new file mode 100644 index 0000000..5ad4436 Binary files /dev/null and b/assets/main/native/10/100eb677-cf92-4725-a791-6c700f6e370a.92fd3.png differ diff --git a/assets/main/native/13/131f7d7ff.81214.png b/assets/main/native/13/131f7d7ff.81214.png new file mode 100644 index 0000000..7c04340 Binary files /dev/null and b/assets/main/native/13/131f7d7ff.81214.png differ diff --git a/assets/main/native/13/139b3a6ab.477b6.png b/assets/main/native/13/139b3a6ab.477b6.png new file mode 100644 index 0000000..a76c360 Binary files /dev/null and b/assets/main/native/13/139b3a6ab.477b6.png differ diff --git a/assets/main/native/14/14bd3a795.04b49.png b/assets/main/native/14/14bd3a795.04b49.png new file mode 100644 index 0000000..990132c Binary files /dev/null and b/assets/main/native/14/14bd3a795.04b49.png differ diff --git a/assets/main/native/1b/1bb33d059.b0532.png b/assets/main/native/1b/1bb33d059.b0532.png new file mode 100644 index 0000000..4845791 Binary files /dev/null and b/assets/main/native/1b/1bb33d059.b0532.png differ diff --git a/assets/main/native/20/20d65a4d-4c1b-4529-9c07-32edc1f9dcd5.31bf3.png b/assets/main/native/20/20d65a4d-4c1b-4529-9c07-32edc1f9dcd5.31bf3.png new file mode 100644 index 0000000..0e5c882 Binary files /dev/null and b/assets/main/native/20/20d65a4d-4c1b-4529-9c07-32edc1f9dcd5.31bf3.png differ diff --git a/assets/main/native/4c/4ce658b4-4739-4282-a0cf-3fcf5938ab29.c51dc.png b/assets/main/native/4c/4ce658b4-4739-4282-a0cf-3fcf5938ab29.c51dc.png new file mode 100644 index 0000000..be4ea81 Binary files /dev/null and b/assets/main/native/4c/4ce658b4-4739-4282-a0cf-3fcf5938ab29.c51dc.png differ diff --git a/assets/main/native/52/52cb2afa-670a-419c-8727-ce0d9a595a76.f2c21.png b/assets/main/native/52/52cb2afa-670a-419c-8727-ce0d9a595a76.f2c21.png new file mode 100644 index 0000000..346b7aa Binary files /dev/null and b/assets/main/native/52/52cb2afa-670a-419c-8727-ce0d9a595a76.f2c21.png differ diff --git a/assets/main/native/57/57df58ef-af5c-4dd4-a020-d6bde57d434a.91680.png b/assets/main/native/57/57df58ef-af5c-4dd4-a020-d6bde57d434a.91680.png new file mode 100644 index 0000000..b442775 Binary files /dev/null and b/assets/main/native/57/57df58ef-af5c-4dd4-a020-d6bde57d434a.91680.png differ diff --git a/assets/main/native/64/64db8663-0b63-4c97-bb54-a603c9013951.759ec.png b/assets/main/native/64/64db8663-0b63-4c97-bb54-a603c9013951.759ec.png new file mode 100644 index 0000000..77ff2f0 Binary files /dev/null and b/assets/main/native/64/64db8663-0b63-4c97-bb54-a603c9013951.759ec.png differ diff --git a/assets/main/native/6c/6cbb911d-9095-4516-bc56-d562425f290e.1fb75.png b/assets/main/native/6c/6cbb911d-9095-4516-bc56-d562425f290e.1fb75.png new file mode 100644 index 0000000..f1669d3 Binary files /dev/null and b/assets/main/native/6c/6cbb911d-9095-4516-bc56-d562425f290e.1fb75.png differ diff --git a/assets/main/native/6f/6f4658a4-e694-4ba0-8fbe-e31456f295e3.0ba26.png b/assets/main/native/6f/6f4658a4-e694-4ba0-8fbe-e31456f295e3.0ba26.png new file mode 100644 index 0000000..9032daf Binary files /dev/null and b/assets/main/native/6f/6f4658a4-e694-4ba0-8fbe-e31456f295e3.0ba26.png differ diff --git a/assets/main/native/70/709ee881-3af9-496e-933e-ca7ecf5241ba.14038.png b/assets/main/native/70/709ee881-3af9-496e-933e-ca7ecf5241ba.14038.png new file mode 100644 index 0000000..16e5526 Binary files /dev/null and b/assets/main/native/70/709ee881-3af9-496e-933e-ca7ecf5241ba.14038.png differ diff --git a/assets/main/native/71/71561142-4c83-4933-afca-cb7a17f67053.c06a9.png b/assets/main/native/71/71561142-4c83-4933-afca-cb7a17f67053.c06a9.png new file mode 100644 index 0000000..a3f2d16 Binary files /dev/null and b/assets/main/native/71/71561142-4c83-4933-afca-cb7a17f67053.c06a9.png differ diff --git a/assets/main/native/80/80c22686-1af4-4f89-a551-8c02692ce060.a7794.png b/assets/main/native/80/80c22686-1af4-4f89-a551-8c02692ce060.a7794.png new file mode 100644 index 0000000..bb4f05e Binary files /dev/null and b/assets/main/native/80/80c22686-1af4-4f89-a551-8c02692ce060.a7794.png differ diff --git a/assets/main/native/8e/8e24adff-3892-4147-bae4-28046ea905f8.65ac2.png b/assets/main/native/8e/8e24adff-3892-4147-bae4-28046ea905f8.65ac2.png new file mode 100644 index 0000000..a13f201 Binary files /dev/null and b/assets/main/native/8e/8e24adff-3892-4147-bae4-28046ea905f8.65ac2.png differ diff --git a/assets/main/native/a0/a0d8afa0-3e1a-4c59-bed8-189e9f781e66.84404.png b/assets/main/native/a0/a0d8afa0-3e1a-4c59-bed8-189e9f781e66.84404.png new file mode 100644 index 0000000..7b6be38 Binary files /dev/null and b/assets/main/native/a0/a0d8afa0-3e1a-4c59-bed8-189e9f781e66.84404.png differ diff --git a/assets/main/native/b3/b3833684-8b23-4dad-abd3-b6d4618b0cd5.57beb.png b/assets/main/native/b3/b3833684-8b23-4dad-abd3-b6d4618b0cd5.57beb.png new file mode 100644 index 0000000..1e5ae71 Binary files /dev/null and b/assets/main/native/b3/b3833684-8b23-4dad-abd3-b6d4618b0cd5.57beb.png differ diff --git a/assets/main/native/b4/b43ff3c2-02bb-4874-81f7-f2dea6970f18.83fcc.png b/assets/main/native/b4/b43ff3c2-02bb-4874-81f7-f2dea6970f18.83fcc.png new file mode 100644 index 0000000..6fe2dff Binary files /dev/null and b/assets/main/native/b4/b43ff3c2-02bb-4874-81f7-f2dea6970f18.83fcc.png differ diff --git a/assets/main/native/b9/b9cf301e-9f64-47f6-9323-a9f91274087f.8dd82.mp3 b/assets/main/native/b9/b9cf301e-9f64-47f6-9323-a9f91274087f.8dd82.mp3 new file mode 100644 index 0000000..5c38017 Binary files /dev/null and b/assets/main/native/b9/b9cf301e-9f64-47f6-9323-a9f91274087f.8dd82.mp3 differ diff --git a/assets/main/native/bf/bf5b669b-6a12-47c9-a3eb-025e4a531fda.3938e.png b/assets/main/native/bf/bf5b669b-6a12-47c9-a3eb-025e4a531fda.3938e.png new file mode 100644 index 0000000..38bddef Binary files /dev/null and b/assets/main/native/bf/bf5b669b-6a12-47c9-a3eb-025e4a531fda.3938e.png differ diff --git a/assets/main/native/c4/c4a5460c-2ca6-4797-9ff8-5c69bb95d09c.f5b37.mp3 b/assets/main/native/c4/c4a5460c-2ca6-4797-9ff8-5c69bb95d09c.f5b37.mp3 new file mode 100644 index 0000000..1c26126 Binary files /dev/null and b/assets/main/native/c4/c4a5460c-2ca6-4797-9ff8-5c69bb95d09c.f5b37.mp3 differ diff --git a/assets/main/native/c6/c6961c9e-ea38-4407-bb17-8d485d15154f.75d5c.png b/assets/main/native/c6/c6961c9e-ea38-4407-bb17-8d485d15154f.75d5c.png new file mode 100644 index 0000000..a46cd11 Binary files /dev/null and b/assets/main/native/c6/c6961c9e-ea38-4407-bb17-8d485d15154f.75d5c.png differ diff --git a/assets/main/native/ca/caeae136-5f11-4fba-ad76-4c0c2882d26a.78b85.png b/assets/main/native/ca/caeae136-5f11-4fba-ad76-4c0c2882d26a.78b85.png new file mode 100644 index 0000000..c59d66c Binary files /dev/null and b/assets/main/native/ca/caeae136-5f11-4fba-ad76-4c0c2882d26a.78b85.png differ diff --git a/assets/main/native/d6/d6bbcb8e-6520-4678-8296-f1cae8d6e0d0.0b746.png b/assets/main/native/d6/d6bbcb8e-6520-4678-8296-f1cae8d6e0d0.0b746.png new file mode 100644 index 0000000..776e7fa Binary files /dev/null and b/assets/main/native/d6/d6bbcb8e-6520-4678-8296-f1cae8d6e0d0.0b746.png differ diff --git a/assets/main/native/d8/d81ec8ad-247c-4e62-aa3c-d35c4193c7af.cdbc9.png b/assets/main/native/d8/d81ec8ad-247c-4e62-aa3c-d35c4193c7af.cdbc9.png new file mode 100644 index 0000000..6f30fe4 Binary files /dev/null and b/assets/main/native/d8/d81ec8ad-247c-4e62-aa3c-d35c4193c7af.cdbc9.png differ diff --git a/assets/main/native/f2/f21947c0-6fe9-48c5-a509-f8c6e897a072.5ccbd.png b/assets/main/native/f2/f21947c0-6fe9-48c5-a509-f8c6e897a072.5ccbd.png new file mode 100644 index 0000000..c98d967 Binary files /dev/null and b/assets/main/native/f2/f21947c0-6fe9-48c5-a509-f8c6e897a072.5ccbd.png differ diff --git a/assets/main/native/f5/f5bfe238-3fdd-4d0e-9a96-093a6a31ea43.0a4c5.png b/assets/main/native/f5/f5bfe238-3fdd-4d0e-9a96-093a6a31ea43.0a4c5.png new file mode 100644 index 0000000..b2555ef Binary files /dev/null and b/assets/main/native/f5/f5bfe238-3fdd-4d0e-9a96-093a6a31ea43.0a4c5.png differ diff --git a/assets/resources/config.93f29.json b/assets/resources/config.93f29.json new file mode 100644 index 0000000..8a51e7c --- /dev/null +++ b/assets/resources/config.93f29.json @@ -0,0 +1 @@ +{"paths":{"0":["panel/LinkIconSpr",0]},"types":["cc.Prefab"],"uuids":["41eopZwPxHZ4viv1Eku0uN"],"scenes":{},"redirect":[],"deps":[],"packs":{},"name":"resources","importBase":"import","nativeBase":"native","debug":false,"isZip":false,"encrypted":false,"versions":{"import":[0,"3881a"],"native":[]}} \ No newline at end of file diff --git a/assets/resources/import/41/417a8a59-c0fc-4767-8be2-bf5124bb4b8d.3881a.json b/assets/resources/import/41/417a8a59-c0fc-4767-8be2-bf5124bb4b8d.3881a.json new file mode 100644 index 0000000..fc30fe4 --- /dev/null +++ b/assets/resources/import/41/417a8a59-c0fc-4767-8be2-bf5124bb4b8d.3881a.json @@ -0,0 +1 @@ +[1,0,["node","root","iconSpr1","iconSpr","data"],[["cc.Node",["_name","_components","_prefab","_contentSize","_children","_parent"],2,9,4,5,2,1],["cc.Prefab",["_name"],2],["cc.Sprite",["_sizeMode","node"],2,1],["cc.PrefabInfo",["fileId","root"],2,1],["95474fr0oNDP7SAidILF03q",["node","iconSpr","iconSpr1"],3,1,1,1]],[[3,0,1,2],[0,0,5,1,2,3,2],[2,0,1,2],[1,0,2],[0,0,4,1,2,3,2],[4,0,1,2,1]],[[3,"LinkIconSpr"],[4,"IconSpr",[-5,-6],[[5,-4,-3,-2]],[0,"26HCE6jlZH2JPlJysMpbFK",-1],[5,55,55]],[1,"iconSpr",1,[[2,0,-7]],[0,"dfcxJv8x9NQ4rbq5mCpd2m",1],[5,55,55]],[1,"iconSpr1",1,[[2,0,-8]],[0,"df/Th35hhMw5m4XbK8Sp4o",1],[5,55,55]]],0,[0,1,1,0,2,3,0,3,2,0,0,1,0,-1,2,0,-2,3,0,0,2,0,0,3,0,4,1,8],[],[],[]] \ No newline at end of file diff --git a/assets/resources/index.93f29.js b/assets/resources/index.93f29.js new file mode 100644 index 0000000..3c6e1e1 --- /dev/null +++ b/assets/resources/index.93f29.js @@ -0,0 +1 @@ +(function r(e,n,t){function i(u,f){if(!n[u]){if(!e[u]){var _=u.split("/");if(_=_[_.length-1],!e[_]){var p="function"==typeof __require&&__require;if(!f&&p)return p(_,!0);if(o)return o(_,!0);throw new Error("Cannot find module '"+u+"'")}u=_}var a=n[u]={exports:{}};e[u][0].call(a.exports,function(r){return i(e[u][1][r]||r)},a,a.exports,r,e,n,t)}return n[u].exports}for(var o="function"==typeof __require&&__require,u=0;u= 0; i--) + e.push(cc.v2(t[i].x, t[i].y)); + return e + } + function n(t) { + for (var e = [], i = 0; i < t.length; i++) + e.push(cc.v2(t[i].x, t[i].y)); + return e + } + cc.CardinalSplineTo = cc.Class({ + name: "cc.CardinalSplineTo", + extends: cc.ActionInterval, + ctor: function(t, e, i) { + this._points = [], + this._deltaT = 0, + this._tension = 0, + this._previousPosition = null, + this._accumulatedDiff = null, + void 0 !== i && cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, i) + }, + initWithDuration: function(t, e, i) { + return e && 0 !== e.length ? !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this.setPoints(e), + this._tension = i, + !0) : (cc.errorID(1024), + !1) + }, + clone: function() { + var t = new cc.CardinalSplineTo; + return t.initWithDuration(this._duration, n(this._points), this._tension), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._deltaT = 1 / (this._points.length - 1), + this._previousPosition = cc.v2(this.target.x, this.target.y), + this._accumulatedDiff = cc.v2(0, 0) + }, + update: function(i) { + var n, r; + i = this._computeEaseTime(i); + var s = this._points; + if (1 === i) + n = s.length - 1, + r = 1; + else { + var a = this._deltaT; + r = (i - a * (n = 0 | i / a)) / a + } + var o, l, h = t(e(s, n - 1), e(s, n - 0), e(s, n + 1), e(s, n + 2), this._tension, r); + if (cc.macro.ENABLE_STACKABLE_ACTIONS && (o = this.target.x - this._previousPosition.x, + l = this.target.y - this._previousPosition.y, + 0 !== o || 0 !== l)) { + var c = this._accumulatedDiff; + o = c.x + o, + l = c.y + l, + c.x = o, + c.y = l, + h.x += o, + h.y += l + } + this.updatePosition(h) + }, + reverse: function() { + var t = i(this._points); + return cc.cardinalSplineTo(this._duration, t, this._tension) + }, + updatePosition: function(t) { + this.target.setPosition(t), + this._previousPosition = t + }, + getPoints: function() { + return this._points + }, + setPoints: function(t) { + this._points = t + } + }), + cc.cardinalSplineTo = function(t, e, i) { + return new cc.CardinalSplineTo(t,e,i) + } + , + cc.CardinalSplineBy = cc.Class({ + name: "cc.CardinalSplineBy", + extends: cc.CardinalSplineTo, + ctor: function(t, e, i) { + this._startPosition = cc.v2(0, 0), + void 0 !== i && this.initWithDuration(t, e, i) + }, + startWithTarget: function(t) { + cc.CardinalSplineTo.prototype.startWithTarget.call(this, t), + this._startPosition.x = t.x, + this._startPosition.y = t.y + }, + reverse: function() { + for (var t, e = this._points.slice(), n = e[0], r = 1; r < e.length; ++r) + t = e[r], + e[r] = t.sub(n), + n = t; + var s = i(e); + for (n = s[s.length - 1], + s.pop(), + n.x = -n.x, + n.y = -n.y, + s.unshift(n), + r = 1; r < s.length; ++r) + (t = s[r]).x = -t.x, + t.y = -t.y, + t.x += n.x, + t.y += n.y, + s[r] = t, + n = t; + return cc.cardinalSplineBy(this._duration, s, this._tension) + }, + updatePosition: function(t) { + var e = this._startPosition + , i = t.x + e.x + , n = t.y + e.y; + this._previousPosition.x = i, + this._previousPosition.y = n, + this.target.setPosition(i, n) + }, + clone: function() { + var t = new cc.CardinalSplineBy; + return t.initWithDuration(this._duration, n(this._points), this._tension), + t + } + }), + cc.cardinalSplineBy = function(t, e, i) { + return new cc.CardinalSplineBy(t,e,i) + } + , + cc.CatmullRomTo = cc.Class({ + name: "cc.CatmullRomTo", + extends: cc.CardinalSplineTo, + ctor: function(t, e) { + e && this.initWithDuration(t, e) + }, + initWithDuration: function(t, e) { + return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5) + }, + clone: function() { + var t = new cc.CatmullRomTo; + return t.initWithDuration(this._duration, n(this._points)), + t + } + }), + cc.catmullRomTo = function(t, e) { + return new cc.CatmullRomTo(t,e) + } + , + cc.CatmullRomBy = cc.Class({ + name: "cc.CatmullRomBy", + extends: cc.CardinalSplineBy, + ctor: function(t, e) { + e && this.initWithDuration(t, e) + }, + initWithDuration: function(t, e) { + return cc.CardinalSplineTo.prototype.initWithDuration.call(this, t, e, .5) + }, + clone: function() { + var t = new cc.CatmullRomBy; + return t.initWithDuration(this._duration, n(this._points)), + t + } + }), + cc.catmullRomBy = function(t, e) { + return new cc.CatmullRomBy(t,e) + } + } + ), {}], + 3: [(function() { + "use strict"; + cc.easeIn = function(t) { + return { + _rate: t, + easing: function(t) { + return Math.pow(t, this._rate) + }, + reverse: function() { + return cc.easeIn(1 / this._rate) + } + } + } + , + cc.easeOut = function(t) { + return { + _rate: t, + easing: function(t) { + return Math.pow(t, 1 / this._rate) + }, + reverse: function() { + return cc.easeOut(1 / this._rate) + } + } + } + , + cc.easeInOut = function(t) { + return { + _rate: t, + easing: function(t) { + return (t *= 2) < 1 ? .5 * Math.pow(t, this._rate) : 1 - .5 * Math.pow(2 - t, this._rate) + }, + reverse: function() { + return cc.easeInOut(this._rate) + } + } + } + ; + var t = { + easing: function(t) { + return 0 === t ? 0 : Math.pow(2, 10 * (t - 1)) + }, + reverse: function() { + return e + } + }; + cc.easeExponentialIn = function() { + return t + } + ; + var e = { + easing: function(t) { + return 1 === t ? 1 : 1 - Math.pow(2, -10 * t) + }, + reverse: function() { + return t + } + }; + cc.easeExponentialOut = function() { + return e + } + ; + var i = { + easing: function(t) { + return 1 !== t && 0 !== t ? (t *= 2) < 1 ? .5 * Math.pow(2, 10 * (t - 1)) : .5 * (2 - Math.pow(2, -10 * (t - 1))) : t + }, + reverse: function() { + return i + } + }; + cc.easeExponentialInOut = function() { + return i + } + ; + var n = { + easing: function(t) { + return 0 === t || 1 === t ? t : -1 * Math.cos(t * Math.PI / 2) + 1 + }, + reverse: function() { + return r + } + }; + cc.easeSineIn = function() { + return n + } + ; + var r = { + easing: function(t) { + return 0 === t || 1 === t ? t : Math.sin(t * Math.PI / 2) + }, + reverse: function() { + return n + } + }; + cc.easeSineOut = function() { + return r + } + ; + var s = { + easing: function(t) { + return 0 === t || 1 === t ? t : -.5 * (Math.cos(Math.PI * t) - 1) + }, + reverse: function() { + return s + } + }; + cc.easeSineInOut = function() { + return s + } + ; + var a = { + easing: function(t) { + return 0 === t || 1 === t ? t : (t -= 1, + -Math.pow(2, 10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3)) + }, + reverse: function() { + return o + } + }; + cc.easeElasticIn = function(t) { + return t && .3 !== t ? { + _period: t, + easing: function(t) { + return 0 === t || 1 === t ? t : (t -= 1, + -Math.pow(2, 10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period)) + }, + reverse: function() { + return cc.easeElasticOut(this._period) + } + } : a + } + ; + var o = { + easing: function(t) { + return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - .075) * Math.PI * 2 / .3) + 1 + }, + reverse: function() { + return a + } + }; + function l(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375 + } + cc.easeElasticOut = function(t) { + return t && .3 !== t ? { + _period: t, + easing: function(t) { + return 0 === t || 1 === t ? t : Math.pow(2, -10 * t) * Math.sin((t - this._period / 4) * Math.PI * 2 / this._period) + 1 + }, + reverse: function() { + return cc.easeElasticIn(this._period) + } + } : o + } + , + cc.easeElasticInOut = function(t) { + return { + _period: t = t || .3, + easing: function(t) { + var e = 0 + , i = this._period; + if (0 === t || 1 === t) + e = t; + else { + t *= 2, + i || (i = this._period = .3 * 1.5); + var n = i / 4; + e = (t -= 1) < 0 ? -.5 * Math.pow(2, 10 * t) * Math.sin((t - n) * Math.PI * 2 / i) : Math.pow(2, -10 * t) * Math.sin((t - n) * Math.PI * 2 / i) * .5 + 1 + } + return e + }, + reverse: function() { + return cc.easeElasticInOut(this._period) + } + } + } + ; + var h = { + easing: function(t) { + return 1 - l(1 - t) + }, + reverse: function() { + return c + } + }; + cc.easeBounceIn = function() { + return h + } + ; + var c = { + easing: function(t) { + return l(t) + }, + reverse: function() { + return h + } + }; + cc.easeBounceOut = function() { + return c + } + ; + var u = { + easing: function(t) { + return t < .5 ? .5 * (1 - l(1 - (t *= 2))) : .5 * l(2 * t - 1) + .5 + }, + reverse: function() { + return u + } + }; + cc.easeBounceInOut = function() { + return u + } + ; + var _ = { + easing: function(t) { + return 0 === t || 1 === t ? t : t * t * (2.70158 * t - 1.70158) + }, + reverse: function() { + return f + } + }; + cc.easeBackIn = function() { + return _ + } + ; + var f = { + easing: function(t) { + return 0 === t ? 0 : (t -= 1) * t * (2.70158 * t + 1.70158) + 1 + }, + reverse: function() { + return _ + } + }; + cc.easeBackOut = function() { + return f + } + ; + var d = { + easing: function(t) { + return (t *= 2) < 1 ? t * t * (3.5949095 * t - 2.5949095) / 2 : (t -= 2) * t * (3.5949095 * t + 2.5949095) / 2 + 1 + }, + reverse: function() { + return d + } + }; + cc.easeBackInOut = function() { + return d + } + , + cc.easeBezierAction = function(t, e, i, n) { + return { + easing: function(r) { + return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n + }, + reverse: function() { + return cc.easeBezierAction(n, i, e, t) + } + } + } + ; + var p = { + easing: function(t) { + return Math.pow(t, 2) + }, + reverse: function() { + return p + } + }; + cc.easeQuadraticActionIn = function() { + return p + } + ; + var m = { + easing: function(t) { + return -t * (t - 2) + }, + reverse: function() { + return m + } + }; + cc.easeQuadraticActionOut = function() { + return m + } + ; + var y = { + easing: function(t) { + return (t *= 2) < 1 ? t * t * .5 : -.5 * (--t * (t - 2) - 1) + }, + reverse: function() { + return y + } + }; + cc.easeQuadraticActionInOut = function() { + return y + } + ; + var v = { + easing: function(t) { + return t * t * t * t + }, + reverse: function() { + return v + } + }; + cc.easeQuarticActionIn = function() { + return v + } + ; + var g = { + easing: function(t) { + return -((t -= 1) * t * t * t - 1) + }, + reverse: function() { + return g + } + }; + cc.easeQuarticActionOut = function() { + return g + } + ; + var A = { + easing: function(t) { + return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2) + }, + reverse: function() { + return A + } + }; + cc.easeQuarticActionInOut = function() { + return A + } + ; + var x = { + easing: function(t) { + return t * t * t * t * t + }, + reverse: function() { + return x + } + }; + cc.easeQuinticActionIn = function() { + return x + } + ; + var b = { + easing: function(t) { + return (t -= 1) * t * t * t * t + 1 + }, + reverse: function() { + return b + } + }; + cc.easeQuinticActionOut = function() { + return b + } + ; + var C = { + easing: function(t) { + return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2) + }, + reverse: function() { + return C + } + }; + cc.easeQuinticActionInOut = function() { + return C + } + ; + var T = { + easing: function(t) { + return -1 * (Math.sqrt(1 - t * t) - 1) + }, + reverse: function() { + return T + } + }; + cc.easeCircleActionIn = function() { + return T + } + ; + var S = { + easing: function(t) { + return t -= 1, + Math.sqrt(1 - t * t) + }, + reverse: function() { + return S + } + }; + cc.easeCircleActionOut = function() { + return S + } + ; + var w = { + easing: function(t) { + return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : (t -= 2, + .5 * (Math.sqrt(1 - t * t) + 1)) + }, + reverse: function() { + return w + } + }; + cc.easeCircleActionInOut = function() { + return w + } + ; + var E = { + easing: function(t) { + return t * t * t + }, + reverse: function() { + return E + } + }; + cc.easeCubicActionIn = function() { + return E + } + ; + var M = { + easing: function(t) { + return (t -= 1) * t * t + 1 + }, + reverse: function() { + return M + } + }; + cc.easeCubicActionOut = function() { + return M + } + ; + var D = { + easing: function(t) { + return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2) + }, + reverse: function() { + return D + } + }; + cc.easeCubicActionInOut = function() { + return D + } + } + ), {}], + 4: [(function() { + "use strict"; + cc.ActionInstant = cc.Class({ + name: "cc.ActionInstant", + extends: cc.FiniteTimeAction, + isDone: function() { + return !0 + }, + step: function() { + this.update(1) + }, + update: function() {}, + reverse: function() { + return this.clone() + }, + clone: function() { + return new cc.ActionInstant + } + }), + cc.Show = cc.Class({ + name: "cc.Show", + extends: cc.ActionInstant, + update: function() { + for (var t = this.target.getComponentsInChildren(cc.RenderComponent), e = 0; e < t.length; ++e) + t[e].enabled = !0 + }, + reverse: function() { + return new cc.Hide + }, + clone: function() { + return new cc.Show + } + }), + cc.show = function() { + return new cc.Show + } + , + cc.Hide = cc.Class({ + name: "cc.Hide", + extends: cc.ActionInstant, + update: function() { + for (var t = this.target.getComponentsInChildren(cc.RenderComponent), e = 0; e < t.length; ++e) + t[e].enabled = !1 + }, + reverse: function() { + return new cc.Show + }, + clone: function() { + return new cc.Hide + } + }), + cc.hide = function() { + return new cc.Hide + } + , + cc.ToggleVisibility = cc.Class({ + name: "cc.ToggleVisibility", + extends: cc.ActionInstant, + update: function() { + for (var t = this.target.getComponentsInChildren(cc.RenderComponent), e = 0; e < t.length; ++e) { + var i = t[e]; + i.enabled = !i.enabled + } + }, + reverse: function() { + return new cc.ToggleVisibility + }, + clone: function() { + return new cc.ToggleVisibility + } + }), + cc.toggleVisibility = function() { + return new cc.ToggleVisibility + } + , + cc.RemoveSelf = cc.Class({ + name: "cc.RemoveSelf", + extends: cc.ActionInstant, + ctor: function(t) { + this._isNeedCleanUp = !0, + void 0 !== t && this.init(t) + }, + update: function() { + this.target.removeFromParent(this._isNeedCleanUp) + }, + init: function(t) { + return this._isNeedCleanUp = t, + !0 + }, + reverse: function() { + return new cc.RemoveSelf(this._isNeedCleanUp) + }, + clone: function() { + return new cc.RemoveSelf(this._isNeedCleanUp) + } + }), + cc.removeSelf = function(t) { + return new cc.RemoveSelf(t) + } + , + cc.DestroySelf = cc.Class({ + name: "cc.DestroySelf", + extends: cc.ActionInstant, + update: function() { + this.target.destroy() + }, + reverse: function() { + return new cc.DestroySelf + }, + clone: function() { + return new cc.DestroySelf + } + }), + cc.destroySelf = function() { + return new cc.DestroySelf + } + , + cc.FlipX = cc.Class({ + name: "cc.FlipX", + extends: cc.ActionInstant, + ctor: function(t) { + this._flippedX = !1, + void 0 !== t && this.initWithFlipX(t) + }, + initWithFlipX: function(t) { + return this._flippedX = t, + !0 + }, + update: function() { + this.target.scaleX = Math.abs(this.target.scaleX) * (this._flippedX ? -1 : 1) + }, + reverse: function() { + return new cc.FlipX(!this._flippedX) + }, + clone: function() { + var t = new cc.FlipX; + return t.initWithFlipX(this._flippedX), + t + } + }), + cc.flipX = function(t) { + return new cc.FlipX(t) + } + , + cc.FlipY = cc.Class({ + name: "cc.FlipY", + extends: cc.ActionInstant, + ctor: function(t) { + this._flippedY = !1, + void 0 !== t && this.initWithFlipY(t) + }, + initWithFlipY: function(t) { + return this._flippedY = t, + !0 + }, + update: function() { + this.target.scaleY = Math.abs(this.target.scaleY) * (this._flippedY ? -1 : 1) + }, + reverse: function() { + return new cc.FlipY(!this._flippedY) + }, + clone: function() { + var t = new cc.FlipY; + return t.initWithFlipY(this._flippedY), + t + } + }), + cc.flipY = function(t) { + return new cc.FlipY(t) + } + , + cc.Place = cc.Class({ + name: "cc.Place", + extends: cc.ActionInstant, + ctor: function(t, e) { + this._x = 0, + this._y = 0, + void 0 !== t && (void 0 !== t.x && (e = t.y, + t = t.x), + this.initWithPosition(t, e)) + }, + initWithPosition: function(t, e) { + return this._x = t, + this._y = e, + !0 + }, + update: function() { + this.target.setPosition(this._x, this._y) + }, + clone: function() { + var t = new cc.Place; + return t.initWithPosition(this._x, this._y), + t + } + }), + cc.place = function(t, e) { + return new cc.Place(t,e) + } + , + cc.CallFunc = cc.Class({ + name: "cc.CallFunc", + extends: cc.ActionInstant, + ctor: function(t, e, i) { + this._selectorTarget = null, + this._function = null, + this._data = null, + this.initWithFunction(t, e, i) + }, + initWithFunction: function(t, e, i) { + return t && (this._function = t), + e && (this._selectorTarget = e), + void 0 !== i && (this._data = i), + !0 + }, + execute: function() { + this._function && this._function.call(this._selectorTarget, this.target, this._data) + }, + update: function() { + this.execute() + }, + getTargetCallback: function() { + return this._selectorTarget + }, + setTargetCallback: function(t) { + t !== this._selectorTarget && (this._selectorTarget && (this._selectorTarget = null), + this._selectorTarget = t) + }, + clone: function() { + var t = new cc.CallFunc; + return t.initWithFunction(this._function, this._selectorTarget, this._data), + t + } + }), + cc.callFunc = function(t, e, i) { + return new cc.CallFunc(t,e,i) + } + } + ), {}], + 5: [(function() { + "use strict"; + function t(t, e, i, n, r) { + return Math.pow(1 - r, 3) * t + 3 * r * Math.pow(1 - r, 2) * e + 3 * Math.pow(r, 2) * (1 - r) * i + Math.pow(r, 3) * n + } + cc.ActionInterval = cc.Class({ + name: "cc.ActionInterval", + extends: cc.FiniteTimeAction, + ctor: function(t) { + this.MAX_VALUE = 2, + this._elapsed = 0, + this._firstTick = !1, + this._easeList = null, + this._speed = 1, + this._timesForRepeat = 1, + this._repeatForever = !1, + this._repeatMethod = !1, + this._speedMethod = !1, + void 0 !== t && cc.ActionInterval.prototype.initWithDuration.call(this, t) + }, + getElapsed: function() { + return this._elapsed + }, + initWithDuration: function(t) { + return this._duration = 0 === t ? cc.macro.FLT_EPSILON : t, + this._elapsed = 0, + this._firstTick = !0, + !0 + }, + isDone: function() { + return this._elapsed >= this._duration + }, + _cloneDecoration: function(t) { + t._repeatForever = this._repeatForever, + t._speed = this._speed, + t._timesForRepeat = this._timesForRepeat, + t._easeList = this._easeList, + t._speedMethod = this._speedMethod, + t._repeatMethod = this._repeatMethod + }, + _reverseEaseList: function(t) { + if (this._easeList) { + t._easeList = []; + for (var e = 0; e < this._easeList.length; e++) + t._easeList.push(this._easeList[e].reverse()) + } + }, + clone: function() { + var t = new cc.ActionInterval(this._duration); + return this._cloneDecoration(t), + t + }, + easing: function() { + this._easeList ? this._easeList.length = 0 : this._easeList = []; + for (var t = 0; t < arguments.length; t++) + this._easeList.push(arguments[t]); + return this + }, + _computeEaseTime: function(t) { + var e = this._easeList; + if (!e || 0 === e.length) + return t; + for (var i = 0, n = e.length; i < n; i++) + t = e[i].easing(t); + return t + }, + step: function(t) { + this._firstTick ? (this._firstTick = !1, + this._elapsed = 0) : this._elapsed += t; + var e = this._elapsed / (this._duration > 1.192092896e-7 ? this._duration : 1.192092896e-7); + e = 1 > e ? e : 1, + this.update(e > 0 ? e : 0), + this._repeatMethod && this._timesForRepeat > 1 && this.isDone() && (this._repeatForever || this._timesForRepeat--, + this.startWithTarget(this.target), + this.step(this._elapsed - this._duration)) + }, + startWithTarget: function(t) { + cc.Action.prototype.startWithTarget.call(this, t), + this._elapsed = 0, + this._firstTick = !0 + }, + reverse: function() { + return cc.logID(1010), + null + }, + setAmplitudeRate: function() { + cc.logID(1011) + }, + getAmplitudeRate: function() { + return cc.logID(1012), + 0 + }, + speed: function(t) { + return t <= 0 ? (cc.logID(1013), + this) : (this._speedMethod = !0, + this._speed *= t, + this) + }, + getSpeed: function() { + return this._speed + }, + setSpeed: function(t) { + return this._speed = t, + this + }, + repeat: function(t) { + return t = Math.round(t), + isNaN(t) || t < 1 ? (cc.logID(1014), + this) : (this._repeatMethod = !0, + this._timesForRepeat *= t, + this) + }, + repeatForever: function() { + return this._repeatMethod = !0, + this._timesForRepeat = this.MAX_VALUE, + this._repeatForever = !0, + this + } + }), + cc.actionInterval = function(t) { + return new cc.ActionInterval(t) + } + , + cc.Sequence = cc.Class({ + name: "cc.Sequence", + extends: cc.ActionInterval, + ctor: function(t) { + this._actions = [], + this._split = null, + this._last = 0, + this._reversed = !1; + var e = t instanceof Array ? t : arguments; + if (1 !== e.length) { + var i = e.length - 1; + if (i >= 0 && null == e[i] && cc.logID(1015), + i >= 0) { + for (var n, r = e[0], s = 1; s < i; s++) + e[s] && (n = r, + r = cc.Sequence._actionOneTwo(n, e[s])); + this.initWithTwoActions(r, e[i]) + } + } else + cc.errorID(1019) + }, + initWithTwoActions: function(t, e) { + if (!t || !e) + return cc.errorID(1025), + !1; + var i = t._duration + , n = e._duration + , r = (i *= t._repeatMethod ? t._timesForRepeat : 1) + (n *= e._repeatMethod ? e._timesForRepeat : 1); + return this.initWithDuration(r), + this._actions[0] = t, + this._actions[1] = e, + !0 + }, + clone: function() { + var t = new cc.Sequence; + return this._cloneDecoration(t), + t.initWithTwoActions(this._actions[0].clone(), this._actions[1].clone()), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._split = this._actions[0]._duration / this._duration, + this._split *= this._actions[0]._repeatMethod ? this._actions[0]._timesForRepeat : 1, + this._last = -1 + }, + stop: function() { + -1 !== this._last && this._actions[this._last].stop(), + cc.Action.prototype.stop.call(this) + }, + update: function(t) { + var e, i, n = 0, r = this._split, s = this._actions, a = this._last; + (t = this._computeEaseTime(t)) < r ? (e = 0 !== r ? t / r : 1, + 0 === n && 1 === a && this._reversed && (s[1].update(0), + s[1].stop())) : (n = 1, + e = 1 === r ? 1 : (t - r) / (1 - r), + -1 === a && (s[0].startWithTarget(this.target), + s[0].update(1), + s[0].stop()), + 0 === a && (s[0].update(1), + s[0].stop())), + i = s[n], + a === n && i.isDone() || (a !== n && i.startWithTarget(this.target), + e *= i._timesForRepeat, + i.update(e > 1 ? e % 1 : e), + this._last = n) + }, + reverse: function() { + var t = cc.Sequence._actionOneTwo(this._actions[1].reverse(), this._actions[0].reverse()); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t._reversed = !0, + t + } + }), + cc.sequence = function(t) { + var e = t instanceof Array ? t : arguments; + if (1 === e.length) + return cc.errorID(1019), + null; + var i = e.length - 1; + i >= 0 && null == e[i] && cc.logID(1015); + var n = null; + if (i >= 0) { + n = e[0]; + for (var r = 1; r <= i; r++) + e[r] && (n = cc.Sequence._actionOneTwo(n, e[r])) + } + return n + } + , + cc.Sequence._actionOneTwo = function(t, e) { + var i = new cc.Sequence; + return i.initWithTwoActions(t, e), + i + } + , + cc.Repeat = cc.Class({ + name: "cc.Repeat", + extends: cc.ActionInterval, + ctor: function(t, e) { + this._times = 0, + this._total = 0, + this._nextDt = 0, + this._actionInstant = !1, + this._innerAction = null, + void 0 !== e && this.initWithAction(t, e) + }, + initWithAction: function(t, e) { + var i = t._duration * e; + return !!this.initWithDuration(i) && (this._times = e, + this._innerAction = t, + t instanceof cc.ActionInstant && (this._actionInstant = !0, + this._times -= 1), + this._total = 0, + !0) + }, + clone: function() { + var t = new cc.Repeat; + return this._cloneDecoration(t), + t.initWithAction(this._innerAction.clone(), this._times), + t + }, + startWithTarget: function(t) { + this._total = 0, + this._nextDt = this._innerAction._duration / this._duration, + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._innerAction.startWithTarget(t) + }, + stop: function() { + this._innerAction.stop(), + cc.Action.prototype.stop.call(this) + }, + update: function(t) { + t = this._computeEaseTime(t); + var e = this._innerAction + , i = this._duration + , n = this._times + , r = this._nextDt; + if (t >= r) { + for (; t > r && this._total < n; ) + e.update(1), + this._total++, + e.stop(), + e.startWithTarget(this.target), + r += e._duration / i, + this._nextDt = r > 1 ? 1 : r; + t >= 1 && this._total < n && (e.update(1), + this._total++), + this._actionInstant || (this._total === n ? e.stop() : e.update(t - (r - e._duration / i))) + } else + e.update(t * n % 1) + }, + isDone: function() { + return this._total === this._times + }, + reverse: function() { + var t = new cc.Repeat(this._innerAction.reverse(),this._times); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + }, + setInnerAction: function(t) { + this._innerAction !== t && (this._innerAction = t) + }, + getInnerAction: function() { + return this._innerAction + } + }), + cc.repeat = function(t, e) { + return new cc.Repeat(t,e) + } + , + cc.RepeatForever = cc.Class({ + name: "cc.RepeatForever", + extends: cc.ActionInterval, + ctor: function(t) { + this._innerAction = null, + t && this.initWithAction(t) + }, + initWithAction: function(t) { + return t ? (this._innerAction = t, + !0) : (cc.errorID(1026), + !1) + }, + clone: function() { + var t = new cc.RepeatForever; + return this._cloneDecoration(t), + t.initWithAction(this._innerAction.clone()), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._innerAction.startWithTarget(t) + }, + step: function(t) { + var e = this._innerAction; + e.step(t), + e.isDone() && (e.startWithTarget(this.target), + e.step(e.getElapsed() - e._duration)) + }, + isDone: function() { + return !1 + }, + reverse: function() { + var t = new cc.RepeatForever(this._innerAction.reverse()); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + }, + setInnerAction: function(t) { + this._innerAction !== t && (this._innerAction = t) + }, + getInnerAction: function() { + return this._innerAction + } + }), + cc.repeatForever = function(t) { + return new cc.RepeatForever(t) + } + , + cc.Spawn = cc.Class({ + name: "cc.Spawn", + extends: cc.ActionInterval, + ctor: function(t) { + this._one = null, + this._two = null; + var e = t instanceof Array ? t : arguments; + if (1 !== e.length) { + var i = e.length - 1; + if (i >= 0 && null == e[i] && cc.logID(1015), + i >= 0) { + for (var n, r = e[0], s = 1; s < i; s++) + e[s] && (n = r, + r = cc.Spawn._actionOneTwo(n, e[s])); + this.initWithTwoActions(r, e[i]) + } + } else + cc.errorID(1020) + }, + initWithTwoActions: function(t, e) { + if (!t || !e) + return cc.errorID(1027), + !1; + var i = !1 + , n = t._duration + , r = e._duration; + return this.initWithDuration(Math.max(n, r)) && (this._one = t, + this._two = e, + n > r ? this._two = cc.Sequence._actionOneTwo(e, cc.delayTime(n - r)) : n < r && (this._one = cc.Sequence._actionOneTwo(t, cc.delayTime(r - n))), + i = !0), + i + }, + clone: function() { + var t = new cc.Spawn; + return this._cloneDecoration(t), + t.initWithTwoActions(this._one.clone(), this._two.clone()), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._one.startWithTarget(t), + this._two.startWithTarget(t) + }, + stop: function() { + this._one.stop(), + this._two.stop(), + cc.Action.prototype.stop.call(this) + }, + update: function(t) { + t = this._computeEaseTime(t), + this._one && this._one.update(t), + this._two && this._two.update(t) + }, + reverse: function() { + var t = cc.Spawn._actionOneTwo(this._one.reverse(), this._two.reverse()); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + } + }), + cc.spawn = function(t) { + var e = t instanceof Array ? t : arguments; + if (1 === e.length) + return cc.errorID(1020), + null; + e.length > 0 && null == e[e.length - 1] && cc.logID(1015); + for (var i = e[0], n = 1; n < e.length; n++) + null != e[n] && (i = cc.Spawn._actionOneTwo(i, e[n])); + return i + } + , + cc.Spawn._actionOneTwo = function(t, e) { + var i = new cc.Spawn; + return i.initWithTwoActions(t, e), + i + } + , + cc.RotateTo = cc.Class({ + name: "cc.RotateTo", + extends: cc.ActionInterval, + statics: { + _reverse: !1 + }, + ctor: function(t, e) { + this._startAngle = 0, + this._dstAngle = 0, + this._angle = 0, + void 0 !== e && this.initWithDuration(t, e) + }, + initWithDuration: function(t, e) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._dstAngle = e, + !0) + }, + clone: function() { + var t = new cc.RotateTo; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._dstAngle), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t); + var e = t.angle % 360 + , i = cc.RotateTo._reverse ? this._dstAngle - e : this._dstAngle + e; + i > 180 && (i -= 360), + i < -180 && (i += 360), + this._startAngle = e, + this._angle = cc.RotateTo._reverse ? i : -i + }, + reverse: function() { + cc.logID(1016) + }, + update: function(t) { + t = this._computeEaseTime(t), + this.target && (this.target.angle = this._startAngle + this._angle * t) + } + }), + cc.rotateTo = function(t, e) { + return new cc.RotateTo(t,e) + } + , + cc.RotateBy = cc.Class({ + name: "cc.RotateBy", + extends: cc.ActionInterval, + statics: { + _reverse: !1 + }, + ctor: function(t, e) { + e *= cc.RotateBy._reverse ? 1 : -1, + this._deltaAngle = 0, + this._startAngle = 0, + void 0 !== e && this.initWithDuration(t, e) + }, + initWithDuration: function(t, e) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._deltaAngle = e, + !0) + }, + clone: function() { + var t = new cc.RotateBy; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._deltaAngle), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._startAngle = t.angle + }, + update: function(t) { + t = this._computeEaseTime(t), + this.target && (this.target.angle = this._startAngle + this._deltaAngle * t) + }, + reverse: function() { + var t = new cc.RotateBy; + return t.initWithDuration(this._duration, -this._deltaAngle), + this._cloneDecoration(t), + this._reverseEaseList(t), + t + } + }), + cc.rotateBy = function(t, e) { + return new cc.RotateBy(t,e) + } + , + cc.MoveBy = cc.Class({ + name: "cc.MoveBy", + extends: cc.ActionInterval, + ctor: function(t, e, i) { + this._positionDelta = cc.v2(0, 0), + this._startPosition = cc.v2(0, 0), + this._previousPosition = cc.v2(0, 0), + void 0 !== e && cc.MoveBy.prototype.initWithDuration.call(this, t, e, i) + }, + initWithDuration: function(t, e, i) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (void 0 !== e.x && (i = e.y, + e = e.x), + this._positionDelta.x = e, + this._positionDelta.y = i, + !0) + }, + clone: function() { + var t = new cc.MoveBy; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._positionDelta), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t); + var e = t.x + , i = t.y; + this._previousPosition.x = e, + this._previousPosition.y = i, + this._startPosition.x = e, + this._startPosition.y = i + }, + update: function(t) { + if (t = this._computeEaseTime(t), + this.target) { + var e = this._positionDelta.x * t + , i = this._positionDelta.y * t + , n = this._startPosition; + if (cc.macro.ENABLE_STACKABLE_ACTIONS) { + var r = this.target.x + , s = this.target.y + , a = this._previousPosition; + n.x = n.x + r - a.x, + n.y = n.y + s - a.y, + e += n.x, + i += n.y, + a.x = e, + a.y = i, + this.target.setPosition(e, i) + } else + this.target.setPosition(n.x + e, n.y + i) + } + }, + reverse: function() { + var t = new cc.MoveBy(this._duration,cc.v2(-this._positionDelta.x, -this._positionDelta.y)); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + } + }), + cc.moveBy = function(t, e, i) { + return new cc.MoveBy(t,e,i) + } + , + cc.MoveTo = cc.Class({ + name: "cc.MoveTo", + extends: cc.MoveBy, + ctor: function(t, e, i) { + this._endPosition = cc.v2(0, 0), + void 0 !== e && this.initWithDuration(t, e, i) + }, + initWithDuration: function(t, e, i) { + return !!cc.MoveBy.prototype.initWithDuration.call(this, t, e, i) && (void 0 !== e.x && (i = e.y, + e = e.x), + this._endPosition.x = e, + this._endPosition.y = i, + !0) + }, + clone: function() { + var t = new cc.MoveTo; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._endPosition), + t + }, + startWithTarget: function(t) { + cc.MoveBy.prototype.startWithTarget.call(this, t), + this._positionDelta.x = this._endPosition.x - t.x, + this._positionDelta.y = this._endPosition.y - t.y + } + }), + cc.moveTo = function(t, e, i) { + return new cc.MoveTo(t,e,i) + } + , + cc.SkewTo = cc.Class({ + name: "cc.SkewTo", + extends: cc.ActionInterval, + ctor: function(t, e, i) { + this._skewX = 0, + this._skewY = 0, + this._startSkewX = 0, + this._startSkewY = 0, + this._endSkewX = 0, + this._endSkewY = 0, + this._deltaX = 0, + this._deltaY = 0, + void 0 !== i && cc.SkewTo.prototype.initWithDuration.call(this, t, e, i) + }, + initWithDuration: function(t, e, i) { + var n = !1; + return cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._endSkewX = e, + this._endSkewY = i, + n = !0), + n + }, + clone: function() { + var t = new cc.SkewTo; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._endSkewX, this._endSkewY), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._startSkewX = t.skewX % 180, + this._deltaX = this._endSkewX - this._startSkewX, + this._deltaX > 180 && (this._deltaX -= 360), + this._deltaX < -180 && (this._deltaX += 360), + this._startSkewY = t.skewY % 360, + this._deltaY = this._endSkewY - this._startSkewY, + this._deltaY > 180 && (this._deltaY -= 360), + this._deltaY < -180 && (this._deltaY += 360) + }, + update: function(t) { + t = this._computeEaseTime(t), + this.target.skewX = this._startSkewX + this._deltaX * t, + this.target.skewY = this._startSkewY + this._deltaY * t + } + }), + cc.skewTo = function(t, e, i) { + return new cc.SkewTo(t,e,i) + } + , + cc.SkewBy = cc.Class({ + name: "cc.SkewBy", + extends: cc.SkewTo, + ctor: function(t, e, i) { + void 0 !== i && this.initWithDuration(t, e, i) + }, + initWithDuration: function(t, e, i) { + var n = !1; + return cc.SkewTo.prototype.initWithDuration.call(this, t, e, i) && (this._skewX = e, + this._skewY = i, + n = !0), + n + }, + clone: function() { + var t = new cc.SkewBy; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._skewX, this._skewY), + t + }, + startWithTarget: function(t) { + cc.SkewTo.prototype.startWithTarget.call(this, t), + this._deltaX = this._skewX, + this._deltaY = this._skewY, + this._endSkewX = this._startSkewX + this._deltaX, + this._endSkewY = this._startSkewY + this._deltaY + }, + reverse: function() { + var t = new cc.SkewBy(this._duration,-this._skewX,-this._skewY); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + } + }), + cc.skewBy = function(t, e, i) { + return new cc.SkewBy(t,e,i) + } + , + cc.JumpBy = cc.Class({ + name: "cc.JumpBy", + extends: cc.ActionInterval, + ctor: function(t, e, i, n, r) { + this._startPosition = cc.v2(0, 0), + this._previousPosition = cc.v2(0, 0), + this._delta = cc.v2(0, 0), + this._height = 0, + this._jumps = 0, + void 0 !== n && cc.JumpBy.prototype.initWithDuration.call(this, t, e, i, n, r) + }, + initWithDuration: function(t, e, i, n, r) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (void 0 === r && (r = n, + n = i, + i = e.y, + e = e.x), + this._delta.x = e, + this._delta.y = i, + this._height = n, + this._jumps = r, + !0) + }, + clone: function() { + var t = new cc.JumpBy; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._delta, this._height, this._jumps), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t); + var e = t.x + , i = t.y; + this._previousPosition.x = e, + this._previousPosition.y = i, + this._startPosition.x = e, + this._startPosition.y = i + }, + update: function(t) { + if (t = this._computeEaseTime(t), + this.target) { + var e = t * this._jumps % 1 + , i = 4 * this._height * e * (1 - e); + i += this._delta.y * t; + var n = this._delta.x * t + , r = this._startPosition; + if (cc.macro.ENABLE_STACKABLE_ACTIONS) { + var s = this.target.x + , a = this.target.y + , o = this._previousPosition; + r.x = r.x + s - o.x, + r.y = r.y + a - o.y, + n += r.x, + i += r.y, + o.x = n, + o.y = i, + this.target.setPosition(n, i) + } else + this.target.setPosition(r.x + n, r.y + i) + } + }, + reverse: function() { + var t = new cc.JumpBy(this._duration,cc.v2(-this._delta.x, -this._delta.y),this._height,this._jumps); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + } + }), + cc.jumpBy = function(t, e, i, n, r) { + return new cc.JumpBy(t,e,i,n,r) + } + , + cc.JumpTo = cc.Class({ + name: "cc.JumpTo", + extends: cc.JumpBy, + ctor: function(t, e, i, n, r) { + this._endPosition = cc.v2(0, 0), + void 0 !== n && this.initWithDuration(t, e, i, n, r) + }, + initWithDuration: function(t, e, i, n, r) { + return !!cc.JumpBy.prototype.initWithDuration.call(this, t, e, i, n, r) && (void 0 === r && (i = e.y, + e = e.x), + this._endPosition.x = e, + this._endPosition.y = i, + !0) + }, + startWithTarget: function(t) { + cc.JumpBy.prototype.startWithTarget.call(this, t), + this._delta.x = this._endPosition.x - this._startPosition.x, + this._delta.y = this._endPosition.y - this._startPosition.y + }, + clone: function() { + var t = new cc.JumpTo; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._endPosition, this._height, this._jumps), + t + } + }), + cc.jumpTo = function(t, e, i, n, r) { + return new cc.JumpTo(t,e,i,n,r) + } + , + cc.BezierBy = cc.Class({ + name: "cc.BezierBy", + extends: cc.ActionInterval, + ctor: function(t, e) { + this._config = [], + this._startPosition = cc.v2(0, 0), + this._previousPosition = cc.v2(0, 0), + e && cc.BezierBy.prototype.initWithDuration.call(this, t, e) + }, + initWithDuration: function(t, e) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._config = e, + !0) + }, + clone: function() { + var t = new cc.BezierBy; + this._cloneDecoration(t); + for (var e = [], i = 0; i < this._config.length; i++) { + var n = this._config[i]; + e.push(cc.v2(n.x, n.y)) + } + return t.initWithDuration(this._duration, e), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t); + var e = t.x + , i = t.y; + this._previousPosition.x = e, + this._previousPosition.y = i, + this._startPosition.x = e, + this._startPosition.y = i + }, + update: function(e) { + if (e = this._computeEaseTime(e), + this.target) { + var i = this._config + , n = i[0].x + , r = i[1].x + , s = i[2].x + , a = i[0].y + , o = i[1].y + , l = i[2].y + , h = t(0, n, r, s, e) + , c = t(0, a, o, l, e) + , u = this._startPosition; + if (cc.macro.ENABLE_STACKABLE_ACTIONS) { + var _ = this.target.x + , f = this.target.y + , d = this._previousPosition; + u.x = u.x + _ - d.x, + u.y = u.y + f - d.y, + h += u.x, + c += u.y, + d.x = h, + d.y = c, + this.target.setPosition(h, c) + } else + this.target.setPosition(u.x + h, u.y + c) + } + }, + reverse: function() { + var t = this._config + , e = t[0].x + , i = t[0].y + , n = t[1].x + , r = t[1].y + , s = t[2].x + , a = t[2].y + , o = [cc.v2(n - s, r - a), cc.v2(e - s, i - a), cc.v2(-s, -a)] + , l = new cc.BezierBy(this._duration,o); + return this._cloneDecoration(l), + this._reverseEaseList(l), + l + } + }), + cc.bezierBy = function(t, e) { + return new cc.BezierBy(t,e) + } + , + cc.BezierTo = cc.Class({ + name: "cc.BezierTo", + extends: cc.BezierBy, + ctor: function(t, e) { + this._toConfig = [], + e && this.initWithDuration(t, e) + }, + initWithDuration: function(t, e) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._toConfig = e, + !0) + }, + clone: function() { + var t = new cc.BezierTo; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._toConfig), + t + }, + startWithTarget: function(t) { + cc.BezierBy.prototype.startWithTarget.call(this, t); + var e = this._startPosition + , i = this._toConfig + , n = this._config; + n[0] = i[0].sub(e), + n[1] = i[1].sub(e), + n[2] = i[2].sub(e) + } + }), + cc.bezierTo = function(t, e) { + return new cc.BezierTo(t,e) + } + , + cc.ScaleTo = cc.Class({ + name: "cc.ScaleTo", + extends: cc.ActionInterval, + ctor: function(t, e, i) { + this._scaleX = 1, + this._scaleY = 1, + this._startScaleX = 1, + this._startScaleY = 1, + this._endScaleX = 0, + this._endScaleY = 0, + this._deltaX = 0, + this._deltaY = 0, + void 0 !== e && cc.ScaleTo.prototype.initWithDuration.call(this, t, e, i) + }, + initWithDuration: function(t, e, i) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._endScaleX = e, + this._endScaleY = null != i ? i : e, + !0) + }, + clone: function() { + var t = new cc.ScaleTo; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._endScaleX, this._endScaleY), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._startScaleX = t.scaleX, + this._startScaleY = t.scaleY, + this._deltaX = this._endScaleX - this._startScaleX, + this._deltaY = this._endScaleY - this._startScaleY + }, + update: function(t) { + t = this._computeEaseTime(t), + this.target && (this.target.scaleX = this._startScaleX + this._deltaX * t, + this.target.scaleY = this._startScaleY + this._deltaY * t) + } + }), + cc.scaleTo = function(t, e, i) { + return new cc.ScaleTo(t,e,i) + } + , + cc.ScaleBy = cc.Class({ + name: "cc.ScaleBy", + extends: cc.ScaleTo, + startWithTarget: function(t) { + cc.ScaleTo.prototype.startWithTarget.call(this, t), + this._deltaX = this._startScaleX * this._endScaleX - this._startScaleX, + this._deltaY = this._startScaleY * this._endScaleY - this._startScaleY + }, + reverse: function() { + var t = new cc.ScaleBy(this._duration,1 / this._endScaleX,1 / this._endScaleY); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + }, + clone: function() { + var t = new cc.ScaleBy; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._endScaleX, this._endScaleY), + t + } + }), + cc.scaleBy = function(t, e, i) { + return new cc.ScaleBy(t,e,i) + } + , + cc.Blink = cc.Class({ + name: "cc.Blink", + extends: cc.ActionInterval, + ctor: function(t, e) { + this._times = 0, + this._originalState = !1, + void 0 !== e && this.initWithDuration(t, e) + }, + initWithDuration: function(t, e) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._times = e, + !0) + }, + clone: function() { + var t = new cc.Blink; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._times), + t + }, + update: function(t) { + if (t = this._computeEaseTime(t), + this.target && !this.isDone()) { + var e = 1 / this._times + , i = t % e; + this.target.opacity = i > e / 2 ? 255 : 0 + } + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._originalState = t.opacity + }, + stop: function() { + this.target.opacity = this._originalState, + cc.ActionInterval.prototype.stop.call(this) + }, + reverse: function() { + var t = new cc.Blink(this._duration,this._times); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + } + }), + cc.blink = function(t, e) { + return new cc.Blink(t,e) + } + , + cc.FadeTo = cc.Class({ + name: "cc.FadeTo", + extends: cc.ActionInterval, + ctor: function(t, e) { + this._toOpacity = 0, + this._fromOpacity = 0, + void 0 !== e && cc.FadeTo.prototype.initWithDuration.call(this, t, e) + }, + initWithDuration: function(t, e) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._toOpacity = e, + !0) + }, + clone: function() { + var t = new cc.FadeTo; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._toOpacity), + t + }, + update: function(t) { + t = this._computeEaseTime(t); + var e = void 0 !== this._fromOpacity ? this._fromOpacity : 255; + this.target.opacity = e + (this._toOpacity - e) * t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._fromOpacity = t.opacity + } + }), + cc.fadeTo = function(t, e) { + return new cc.FadeTo(t,e) + } + , + cc.FadeIn = cc.Class({ + name: "cc.FadeIn", + extends: cc.FadeTo, + ctor: function(t) { + null == t && (t = 0), + this._reverseAction = null, + this.initWithDuration(t, 255) + }, + reverse: function() { + var t = new cc.FadeOut; + return t.initWithDuration(this._duration, 0), + this._cloneDecoration(t), + this._reverseEaseList(t), + t + }, + clone: function() { + var t = new cc.FadeIn; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._toOpacity), + t + }, + startWithTarget: function(t) { + this._reverseAction && (this._toOpacity = this._reverseAction._fromOpacity), + cc.FadeTo.prototype.startWithTarget.call(this, t) + } + }), + cc.fadeIn = function(t) { + return new cc.FadeIn(t) + } + , + cc.FadeOut = cc.Class({ + name: "cc.FadeOut", + extends: cc.FadeTo, + ctor: function(t) { + null == t && (t = 0), + this._reverseAction = null, + this.initWithDuration(t, 0) + }, + reverse: function() { + var t = new cc.FadeIn; + return t._reverseAction = this, + t.initWithDuration(this._duration, 255), + this._cloneDecoration(t), + this._reverseEaseList(t), + t + }, + clone: function() { + var t = new cc.FadeOut; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._toOpacity), + t + } + }), + cc.fadeOut = function(t) { + return new cc.FadeOut(t) + } + , + cc.TintTo = cc.Class({ + name: "cc.TintTo", + extends: cc.ActionInterval, + ctor: function(t, e, i, n) { + this._to = cc.color(0, 0, 0), + this._from = cc.color(0, 0, 0), + e instanceof cc.Color && (n = e.b, + i = e.g, + e = e.r), + void 0 !== n && this.initWithDuration(t, e, i, n) + }, + initWithDuration: function(t, e, i, n) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._to = cc.color(e, i, n), + !0) + }, + clone: function() { + var t = new cc.TintTo; + this._cloneDecoration(t); + var e = this._to; + return t.initWithDuration(this._duration, e.r, e.g, e.b), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._from = this.target.color + }, + update: function(t) { + t = this._computeEaseTime(t); + var e = this._from + , i = this._to; + e && (this.target.color = cc.color(e.r + (i.r - e.r) * t, e.g + (i.g - e.g) * t, e.b + (i.b - e.b) * t)) + } + }), + cc.tintTo = function(t, e, i, n) { + return new cc.TintTo(t,e,i,n) + } + , + cc.TintBy = cc.Class({ + name: "cc.TintBy", + extends: cc.ActionInterval, + ctor: function(t, e, i, n) { + this._deltaR = 0, + this._deltaG = 0, + this._deltaB = 0, + this._fromR = 0, + this._fromG = 0, + this._fromB = 0, + void 0 !== n && this.initWithDuration(t, e, i, n) + }, + initWithDuration: function(t, e, i, n) { + return !!cc.ActionInterval.prototype.initWithDuration.call(this, t) && (this._deltaR = e, + this._deltaG = i, + this._deltaB = n, + !0) + }, + clone: function() { + var t = new cc.TintBy; + return this._cloneDecoration(t), + t.initWithDuration(this._duration, this._deltaR, this._deltaG, this._deltaB), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t); + var e = t.color; + this._fromR = e.r, + this._fromG = e.g, + this._fromB = e.b + }, + update: function(t) { + t = this._computeEaseTime(t), + this.target.color = cc.color(this._fromR + this._deltaR * t, this._fromG + this._deltaG * t, this._fromB + this._deltaB * t) + }, + reverse: function() { + var t = new cc.TintBy(this._duration,-this._deltaR,-this._deltaG,-this._deltaB); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + } + }), + cc.tintBy = function(t, e, i, n) { + return new cc.TintBy(t,e,i,n) + } + , + cc.DelayTime = cc.Class({ + name: "cc.DelayTime", + extends: cc.ActionInterval, + update: function() {}, + reverse: function() { + var t = new cc.DelayTime(this._duration); + return this._cloneDecoration(t), + this._reverseEaseList(t), + t + }, + clone: function() { + var t = new cc.DelayTime; + return this._cloneDecoration(t), + t.initWithDuration(this._duration), + t + } + }), + cc.delayTime = function(t) { + return new cc.DelayTime(t) + } + , + cc.ReverseTime = cc.Class({ + name: "cc.ReverseTime", + extends: cc.ActionInterval, + ctor: function(t) { + this._other = null, + t && this.initWithAction(t) + }, + initWithAction: function(t) { + return t ? t === this._other ? (cc.errorID(1029), + !1) : !!cc.ActionInterval.prototype.initWithDuration.call(this, t._duration) && (this._other = t, + !0) : (cc.errorID(1028), + !1) + }, + clone: function() { + var t = new cc.ReverseTime; + return this._cloneDecoration(t), + t.initWithAction(this._other.clone()), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._other.startWithTarget(t) + }, + update: function(t) { + t = this._computeEaseTime(t), + this._other && this._other.update(1 - t) + }, + reverse: function() { + return this._other.clone() + }, + stop: function() { + this._other.stop(), + cc.Action.prototype.stop.call(this) + } + }), + cc.reverseTime = function(t) { + return new cc.ReverseTime(t) + } + , + cc.TargetedAction = cc.Class({ + name: "cc.TargetedAction", + extends: cc.ActionInterval, + ctor: function(t, e) { + this._action = null, + this._forcedTarget = null, + e && this.initWithTarget(t, e) + }, + initWithTarget: function(t, e) { + return !!this.initWithDuration(e._duration) && (this._forcedTarget = t, + this._action = e, + !0) + }, + clone: function() { + var t = new cc.TargetedAction; + return this._cloneDecoration(t), + t.initWithTarget(this._forcedTarget, this._action.clone()), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t), + this._action.startWithTarget(this._forcedTarget) + }, + stop: function() { + this._action.stop() + }, + update: function(t) { + t = this._computeEaseTime(t), + this._action.update(t) + }, + getForcedTarget: function() { + return this._forcedTarget + }, + setForcedTarget: function(t) { + this._forcedTarget !== t && (this._forcedTarget = t) + } + }), + cc.targetedAction = function(t, e) { + return new cc.TargetedAction(t,e) + } + } + ), {}], + 6: [(function(t) { + "use strict"; + t("../core/platform/CCClass"); + var e = t("../core/platform/js") + , i = function() { + this.actions = [], + this.target = null, + this.actionIndex = 0, + this.currentAction = null, + this.paused = !1, + this.lock = !1 + }; + cc.ActionManager = function() { + this._hashTargets = e.createMap(!0), + this._arrayTargets = [], + this._currentTarget = null, + cc.director._scheduler && cc.director._scheduler.enableForTarget(this) + } + , + cc.ActionManager.prototype = { + constructor: cc.ActionManager, + _elementPool: [], + _searchElementByTarget: function(t, e) { + for (var i = 0; i < t.length; i++) + if (e === t[i].target) + return t[i]; + return null + }, + _getElement: function(t, e) { + var n = this._elementPool.pop(); + return n || (n = new i), + n.target = t, + n.paused = !!e, + n + }, + _putElement: function(t) { + t.actions.length = 0, + t.actionIndex = 0, + t.currentAction = null, + t.paused = !1, + t.target = null, + t.lock = !1, + this._elementPool.push(t) + }, + addAction: function(t, e, i) { + if (t && e) { + var n = this._hashTargets[e._id]; + n ? n.actions || (n.actions = []) : (n = this._getElement(e, i), + this._hashTargets[e._id] = n, + this._arrayTargets.push(n)), + n.actions.push(t), + t.startWithTarget(e) + } else + cc.errorID(1e3) + }, + removeAllActions: function() { + for (var t = this._arrayTargets, i = 0; i < t.length; i++) { + var n = t[i]; + n && this._putElement(n) + } + this._arrayTargets.length = 0, + this._hashTargets = e.createMap(!0) + }, + removeAllActionsFromTarget: function(t) { + if (null != t) { + var e = this._hashTargets[t._id]; + e && (e.actions.length = 0, + this._deleteHashElement(e)) + } + }, + removeAction: function(t) { + if (t) { + var e = t.getOriginalTarget() + , i = this._hashTargets[e._id]; + if (i) + for (var n = 0; n < i.actions.length; n++) + if (i.actions[n] === t) { + i.actions.splice(n, 1), + i.actionIndex >= n && i.actionIndex--; + break + } + } + }, + _removeActionByTag: function(t, e, i) { + for (var n = 0, r = e.actions.length; n < r; ++n) { + var s = e.actions[n]; + if (s && s.getTag() === t) { + if (i && s.getOriginalTarget() !== i) + continue; + this._removeActionAtIndex(n, e); + break + } + } + }, + removeActionByTag: function(t, e) { + t === cc.Action.TAG_INVALID && cc.logID(1002); + var i = this._hashTargets; + if (e) { + var n = i[e._id]; + n && this._removeActionByTag(t, n, e) + } else + for (var r in i) { + var s = i[r]; + this._removeActionByTag(t, s) + } + }, + getActionByTag: function(t, e) { + t === cc.Action.TAG_INVALID && cc.logID(1004); + var i = this._hashTargets[e._id]; + if (i) { + if (null != i.actions) + for (var n = 0; n < i.actions.length; ++n) { + var r = i.actions[n]; + if (r && r.getTag() === t) + return r + } + cc.logID(1005, t) + } + return null + }, + getNumberOfRunningActionsInTarget: function(t) { + var e = this._hashTargets[t._id]; + return e && e.actions ? e.actions.length : 0 + }, + pauseTarget: function(t) { + var e = this._hashTargets[t._id]; + e && (e.paused = !0) + }, + resumeTarget: function(t) { + var e = this._hashTargets[t._id]; + e && (e.paused = !1) + }, + pauseAllRunningActions: function() { + for (var t = [], e = this._arrayTargets, i = 0; i < e.length; i++) { + var n = e[i]; + n && !n.paused && (n.paused = !0, + t.push(n.target)) + } + return t + }, + resumeTargets: function(t) { + if (t) + for (var e = 0; e < t.length; e++) + t[e] && this.resumeTarget(t[e]) + }, + pauseTargets: function(t) { + if (t) + for (var e = 0; e < t.length; e++) + t[e] && this.pauseTarget(t[e]) + }, + purgeSharedManager: function() { + cc.director.getScheduler().unscheduleUpdate(this) + }, + _removeActionAtIndex: function(t, e) { + e.actions[t], + e.actions.splice(t, 1), + e.actionIndex >= t && e.actionIndex--, + 0 === e.actions.length && this._deleteHashElement(e) + }, + _deleteHashElement: function(t) { + var e = !1; + if (t && !t.lock && this._hashTargets[t.target._id]) { + delete this._hashTargets[t.target._id]; + for (var i = this._arrayTargets, n = 0, r = i.length; n < r; n++) + if (i[n] === t) { + i.splice(n, 1); + break + } + this._putElement(t), + e = !0 + } + return e + }, + update: function(t) { + for (var e, i = this._arrayTargets, n = 0; n < i.length; n++) { + if (this._currentTarget = i[n], + !(e = this._currentTarget).paused && e.actions) { + for (e.lock = !0, + e.actionIndex = 0; e.actionIndex < e.actions.length; e.actionIndex++) + if (e.currentAction = e.actions[e.actionIndex], + e.currentAction) { + if (e.currentAction.step(t * (e.currentAction._speedMethod ? e.currentAction._speed : 1)), + e.currentAction && e.currentAction.isDone()) { + e.currentAction.stop(); + var r = e.currentAction; + e.currentAction = null, + this.removeAction(r) + } + e.currentAction = null + } + e.lock = !1 + } + 0 === e.actions.length && this._deleteHashElement(e) && n-- + } + } + } + } + ), { + "../core/platform/CCClass": 193, + "../core/platform/js": 214 + }], + 7: [(function(t) { + "use strict"; + t("./CCActionManager"), + t("./CCAction"), + t("./CCActionInterval"), + t("./CCActionInstant"), + t("./CCActionEase"), + t("./CCActionCatmullRom"), + t("./tween") + } + ), { + "./CCAction": 1, + "./CCActionCatmullRom": 2, + "./CCActionEase": 3, + "./CCActionInstant": 4, + "./CCActionInterval": 5, + "./CCActionManager": 6, + "./tween": 8 + }], + 8: [(function(t) { + "use strict"; + var e = t("../animation/bezier") + , i = 0 + , n = cc.Class({ + name: "cc.TweenAction", + extends: cc.ActionInterval, + ctor: function(t, e, i) { + if (this._opts = i = i || Object.create(null), + this._props = Object.create(null), + i.progress = i.progress || this.progress, + i.easing && "string" == typeof i.easing) { + var n = i.easing; + i.easing = cc.easing[n], + !i.easing && cc.warnID(1031, n) + } + var r = this._opts.relative; + for (var s in e) { + var a = e[s] + , o = void 0 + , l = void 0; + if (void 0 !== a.value && (a.easing || a.progress) && ("string" == typeof a.easing ? !(o = cc.easing[a.easing]) && cc.warnID(1031, a.easing) : o = a.easing, + l = a.progress, + a = a.value), + "number" == typeof a || a.lerp && (!r || a.add || a.mul) && a.clone) { + var h = Object.create(null); + h.value = a, + h.easing = o, + h.progress = l, + this._props[s] = h + } else + cc.warn("Can not animate " + s + " property, because it do not have [lerp, (add|mul), clone] function.") + } + this._originProps = e, + this.initWithDuration(t) + }, + clone: function() { + var t = new n(this._duration,this._originProps,this._opts); + return this._cloneDecoration(t), + t + }, + startWithTarget: function(t) { + cc.ActionInterval.prototype.startWithTarget.call(this, t); + var e = !!this._opts.relative + , i = this._props; + for (var n in i) { + var r = t[n] + , s = i[n]; + "number" == typeof r ? (s.start = r, + s.current = r, + s.end = e ? r + s.value : s.value) : (s.start = r.clone(), + s.current = r.clone(), + s.end = e ? (r.add || r.mul).call(r, s.value) : s.value) + } + }, + update: function(t) { + var e = this._opts + , i = t; + e.easing && (i = e.easing(t)); + var n = this.target; + if (n) { + var r = this._props + , s = e.progress; + for (var a in r) { + var o = r[a] + , l = o.easing ? o.easing(t) : i + , h = o.current = (o.progress || s)(o.start, o.end, o.current, l); + n[a] = h + } + var c = e.onUpdate; + c && c(n, t) + } + }, + progress: function(t, e, i, n) { + return "number" == typeof t ? i = t + (e - t) * n : t.lerp(e, n, i), + i + } + }) + , r = cc.Class({ + name: "cc.SetAction", + extends: cc.ActionInstant, + ctor: function(t) { + this._props = {}, + void 0 !== t && this.init(t) + }, + init: function(t) { + for (var e in t) + this._props[e] = t[e]; + return !0 + }, + update: function() { + var t = this._props + , e = this.target; + for (var i in t) + e[i] = t[i] + }, + clone: function() { + var t = new r; + return t.init(this._props), + t + } + }); + function s(t) { + this._actions = [], + this._finalAction = null, + this._target = t, + this._tag = cc.Action.TAG_INVALID + } + s.stopAll = function() { + cc.director.getActionManager().removeAllActions() + } + , + s.stopAllByTag = function(t) { + cc.director.getActionManager().removeActionByTag(t) + } + , + s.stopAllByTarget = function(t) { + cc.director.getActionManager().removeAllActionsFromTarget(t) + } + , + s.prototype.then = function(t) { + return t instanceof cc.Action ? this._actions.push(t.clone()) : this._actions.push(t._union()), + this + } + , + s.prototype.target = function(t) { + return this._target = t, + this + } + , + s.prototype.start = function() { + var t = this._target; + return t ? t instanceof cc.Object && !t.isValid ? void 0 : (this._finalAction && cc.director.getActionManager().removeAction(this._finalAction), + this._finalAction = this._union(), + void 0 === t._id && (t._id = ++i), + this._finalAction.setTag(this._tag), + cc.director.getActionManager().addAction(this._finalAction, t, !1), + this) : (cc.warn("Please set target to tween first"), + this) + } + , + s.prototype.stop = function() { + return this._finalAction && cc.director.getActionManager().removeAction(this._finalAction), + this + } + , + s.prototype.tag = function(t) { + return this._tag = t, + this + } + , + s.prototype.clone = function(t) { + var e = this._union(); + return cc.tween(t).then(e.clone()) + } + , + s.prototype.union = function() { + var t = this._union(); + return this._actions.length = 0, + this._actions.push(t), + this + } + , + s.prototype._union = function() { + var t = this._actions; + return 1 === t.length ? t[0] : cc.sequence(t) + } + , + Object.assign(s.prototype, { + bezierTo: function(t, i, n, r, s) { + var a = i.x + , o = i.y + , l = n.x + , h = n.y; + return (s = s || Object.create(null)).progress = function(t, i, n, r) { + return n.x = (0, + e.bezier)(t.x, a, l, i.x, r), + n.y = (0, + e.bezier)(t.y, o, h, i.y, r), + n + } + , + this.to(t, { + position: r + }, s) + }, + bezierBy: function(t, i, n, r, s) { + var a = i.x + , o = i.y + , l = n.x + , h = n.y; + return (s = s || Object.create(null)).progress = function(t, i, n, r) { + var s = t.x + , c = t.y; + return n.x = (0, + e.bezier)(s, a + s, l + s, i.x, r), + n.y = (0, + e.bezier)(c, o + c, h + c, i.y, r), + n + } + , + this.by(t, { + position: r + }, s) + }, + flipX: function() { + var t = this; + return this.call((function() { + t._target.scaleX *= -1 + } + ), this) + }, + flipY: function() { + var t = this; + return this.call((function() { + t._target.scaleY *= -1 + } + ), this) + }, + blink: function(t, e, i) { + var n = 1 / e; + return (i = i || Object.create(null)).progress = function(t, e, i, r) { + return r >= 1 ? t : r % n > n / 2 ? 255 : 0 + } + , + this.to(t, { + opacity: 1 + }, i) + } + }); + var a = []; + function o(t) { + return function() { + a.length = 0; + for (var e = arguments.length, i = 0; i < e; i++) { + var n = a[i] = arguments[i]; + n instanceof s && (a[i] = n._union()) + } + return t.apply(this, a) + } + } + for (var l = { + to: function(t, e, i) { + return (i = i || Object.create(null)).relative = !1, + new n(t,e,i) + }, + by: function(t, e, i) { + return (i = i || Object.create(null)).relative = !0, + new n(t,e,i) + }, + set: function(t) { + return new r(t) + }, + delay: cc.delayTime, + call: cc.callFunc, + hide: cc.hide, + show: cc.show, + removeSelf: cc.removeSelf, + sequence: o(cc.sequence), + parallel: o(cc.spawn) + }, h = { + repeat: cc.repeat, + repeatForever: function(t) { + return cc.repeat(t, 1e9) + }, + reverseTime: cc.reverseTime + }, c = Object.keys(l), u = function(t) { + var e = c[t]; + s.prototype[e] = function() { + var t = l[e].apply(this, arguments); + return this._actions.push(t), + this + } + }, _ = 0; _ < c.length; _++) + u(_); + c = Object.keys(h); + for (var f = function(t) { + var e = c[t]; + s.prototype[e] = function() { + var t = this._actions + , i = arguments[arguments.length - 1] + , n = arguments.length - 1; + i instanceof cc.Tween ? i = i._union() : i instanceof cc.Action || (i = t[t.length - 1], + t.length -= 1, + n += 1); + for (var r = [i], s = 0; s < n; s++) + r.push(arguments[s]); + return i = h[e].apply(this, r), + t.push(i), + this + } + }, d = 0; d < c.length; d++) + f(d); + cc.tween = function(t) { + return new s(t) + } + , + cc.Tween = s + } + ), { + "../animation/bezier": 14 + }], + 9: [(function(t, e) { + "use strict"; + var i = cc.js + , n = t("./playable") + , r = t("./animation-curves") + , s = r.EventAnimCurve + , a = r.EventInfo + , o = t("./types").WrapModeMask + , l = t("../core/utils/binary-search").binarySearchEpsilon; + function h(t, e) { + n.call(this), + this.target = t, + this.animation = e, + this._anims = new i.array.MutableForwardIterator([]) + } + i.extend(h, n); + var c = h.prototype; + function u(t, e) { + var i = e.clip; + e.duration = i.duration, + e.speed = i.speed, + e.wrapMode = i.wrapMode, + e.frameRate = i.sample, + (e.wrapMode & o.Loop) === o.Loop ? e.repeatCount = 1 / 0 : e.repeatCount = 1; + var n = e.curves = i.createCurves(e, t) + , r = i.events; + if (r) + for (var h, c = 0, u = r.length; c < u; c++) { + h || ((h = new s).target = t, + n.push(h)); + var _ = r[c] + , f = _.frame / e.duration + , d = void 0 + , p = l(h.ratios, f); + p >= 0 ? d = h.events[p] : (d = new a, + h.ratios.push(f), + h.events.push(d)), + d.add(_.func, _.params) + } + } + c.playState = function(t, e) { + t.clip && (t.curveLoaded || u(this.target, t), + t.animator = this, + t.play(), + "number" == typeof e && t.setTime(e), + this.play()) + } + , + c.stopStatesExcept = function(t) { + var e = this._anims + , i = e.array; + for (e.i = 0; e.i < i.length; ++e.i) { + var n = i[e.i]; + n !== t && this.stopState(n) + } + } + , + c.addAnimation = function(t) { + -1 === this._anims.array.indexOf(t) && this._anims.push(t), + t._setEventTarget(this.animation) + } + , + c.removeAnimation = function(t) { + var e = this._anims.array.indexOf(t); + e >= 0 ? (this._anims.fastRemoveAt(e), + 0 === this._anims.array.length && this.stop()) : cc.errorID(3907), + t.animator = null + } + , + c.sample = function() { + var t = this._anims + , e = t.array; + for (t.i = 0; t.i < e.length; ++t.i) + e[t.i].sample() + } + , + c.stopState = function(t) { + t && t.stop() + } + , + c.pauseState = function(t) { + t && t.pause() + } + , + c.resumeState = function(t) { + t && t.resume(), + this.isPaused && this.resume() + } + , + c.setStateTime = function(t, e) { + if (void 0 !== e) + t && (t.setTime(e), + t.sample()); + else { + e = t; + for (var i = this._anims.array, n = 0; n < i.length; ++n) { + var r = i[n]; + r.setTime(e), + r.sample() + } + } + } + , + c.onStop = function() { + var t = this._anims + , e = t.array; + for (t.i = 0; t.i < e.length; ++t.i) + e[t.i].stop() + } + , + c.onPause = function() { + for (var t = this._anims.array, e = 0; e < t.length; ++e) { + var i = t[e]; + i.pause(), + i.animator = null + } + } + , + c.onResume = function() { + for (var t = this._anims.array, e = 0; e < t.length; ++e) { + var i = t[e]; + i.animator = this, + i.resume() + } + } + , + c._reloadClip = function(t) { + u(this.target, t) + } + , + e.exports = h + } + ), { + "../core/utils/binary-search": 260, + "./animation-curves": 11, + "./playable": 18, + "./types": 19 + }], + 10: [(function(t, e) { + "use strict"; + var i = t("./types").WrapMode + , n = t("./animation-curves") + , r = n.DynamicAnimCurve + , s = n.quickFindIndex + , a = t("./motion-path-helper").sampleMotionPaths + , o = t("../core/utils/binary-search").binarySearchEpsilon + , l = cc.Class({ + name: "cc.AnimationClip", + extends: cc.Asset, + properties: { + _duration: { + default: 0, + type: cc.Float + }, + duration: { + get: function() { + return this._duration + } + }, + sample: { + default: 60 + }, + speed: { + default: 1 + }, + wrapMode: { + default: i.Normal + }, + curveData: { + default: {}, + visible: !1 + }, + events: { + default: [], + visible: !1 + } + }, + statics: { + createWithSpriteFrames: function(t, e) { + if (!Array.isArray(t)) + return cc.errorID(3905), + null; + var i = new l; + i.sample = e || i.sample, + i._duration = t.length / i.sample; + for (var n = [], r = 1 / i.sample, s = 0, a = t.length; s < a; s++) + n[s] = { + frame: s * r, + value: t[s] + }; + return i.curveData = { + comps: { + "cc.Sprite": { + spriteFrame: n + } + } + }, + i + } + }, + onLoad: function() { + this._duration = Number.parseFloat(this.duration), + this.speed = Number.parseFloat(this.speed), + this.wrapMode = Number.parseInt(this.wrapMode), + this.frameRate = Number.parseFloat(this.sample) + }, + createPropCurve: function(t, e, i) { + var n = [] + , l = t instanceof cc.Node && "position" === e + , h = new r; + h.target = t, + h.prop = e; + for (var c = 0, u = i.length; c < u; c++) { + var _ = i[c] + , f = _.frame / this.duration; + h.ratios.push(f), + l && n.push(_.motionPath); + var d = _.value; + h.values.push(d); + var p = _.curve; + if (p) { + if ("string" == typeof p) { + h.types.push(p); + continue + } + if (Array.isArray(p)) { + p[0] === p[1] && p[2] === p[3] ? h.types.push(r.Linear) : h.types.push(r.Bezier(p)); + continue + } + } + h.types.push(r.Linear) + } + l && a(n, h, this.duration, this.sample, t); + for (var m, y, v = h.ratios, g = !0, A = 1, x = v.length; A < x; A++) + if (m = v[A] - v[A - 1], + 1 === A) + y = m; + else if (Math.abs(m - y) > 1e-6) { + g = !1; + break + } + h._findFrameIndex = g ? s : o; + var b = h.values[0]; + return null == b || h._lerp || ("number" == typeof b ? h._lerp = r.prototype._lerpNumber : b instanceof cc.Quat ? h._lerp = r.prototype._lerpQuat : b instanceof cc.Vec2 ? h._lerp = r.prototype._lerpVector2 : b instanceof cc.Vec3 ? h._lerp = r.prototype._lerpVector3 : b.lerp && (h._lerp = r.prototype._lerpObject)), + h + }, + createTargetCurves: function(t, e, i) { + var n = e.props + , r = e.comps; + if (n) + for (var s in n) { + var a = n[s] + , o = this.createPropCurve(t, s, a); + i.push(o) + } + if (r) + for (var l in r) { + var h = t.getComponent(l); + if (h) { + var c = r[l]; + for (var u in c) { + var _ = c[u] + , f = this.createPropCurve(h, u, _); + i.push(f) + } + } + } + }, + createCurves: function(t, e) { + var i = this.curveData + , n = i.paths + , r = []; + for (var s in this.createTargetCurves(e, i, r), + n) { + var a = cc.find(s, e); + if (a) { + var o = n[s]; + this.createTargetCurves(a, o, r) + } + } + return r + } + }); + cc.AnimationClip = e.exports = l + } + ), { + "../core/utils/binary-search": 260, + "./animation-curves": 11, + "./motion-path-helper": 17, + "./types": 19 + }], + 11: [(function(t, e) { + "use strict"; + var i = t("./bezier").bezierByTime + , n = t("../core/utils/binary-search").binarySearchEpsilon + , r = t("./types").WrapModeMask + , s = t("./types").WrappedInfo; + function a(t, e) { + if ("string" == typeof e) { + var n = cc.easing[e]; + n ? t = n(t) : cc.errorID(3906, e) + } else + Array.isArray(e) && (t = i(e, t)); + return t + } + var o = cc.Class({ + name: "cc.AnimCurve", + sample: function() {}, + onTimeChangedManually: void 0 + }); + var l, h = cc.Class({ + name: "cc.DynamicAnimCurve", + extends: o, + ctor: function() { + this._cachedIndex = 0 + }, + properties: { + target: null, + prop: "", + values: [], + ratios: [], + types: [] + }, + _findFrameIndex: n, + _lerp: void 0, + _lerpNumber: function(t, e, i) { + return t + (e - t) * i + }, + _lerpObject: function(t, e, i) { + return t.lerp(e, i) + }, + _lerpQuat: (l = cc.quat(), + function(t, e, i) { + return t.lerp(e, i, l) + } + ), + _lerpVector2: (function() { + var t = cc.v2(); + return function(e, i, n) { + return e.lerp(i, n, t) + } + } + )(), + _lerpVector3: (function() { + var t = cc.v3(); + return function(e, i, n) { + return e.lerp(i, n, t) + } + } + )(), + sample: function(t, e) { + var i = this.values + , n = this.ratios + , r = n.length; + if (0 !== r) { + var s, o = !0, l = this._cachedIndex; + if (l < 0 && (l = ~l) > 0 && l < n.length) { + var h = n[l - 1] + , c = n[l]; + e > h && e < c && (o = !1) + } + o && (this._cachedIndex = this._findFrameIndex(n, e)); + var u = this._cachedIndex; + if (u < 0) + if ((u = ~u) <= 0) + s = i[0]; + else if (u >= r) + s = i[r - 1]; + else { + var _ = i[u - 1]; + if (this._lerp) { + var f = n[u - 1] + , d = n[u] + , p = this.types[u - 1] + , m = (e - f) / (d - f); + p && (m = a(m, p)); + var y = i[u]; + s = this._lerp(_, y, m) + } else + s = _ + } + else + s = i[u]; + this.target[this.prop] = s + } + } + }); + h.Linear = null, + h.Bezier = function(t) { + return t + } + ; + var c = function() { + this.events = [] + }; + c.prototype.add = function(t, e) { + this.events.push({ + func: t || "", + params: e || [] + }) + } + ; + var u = cc.Class({ + name: "cc.EventAnimCurve", + extends: o, + properties: { + target: null, + ratios: [], + events: [], + _wrappedInfo: { + default: function() { + return new s + } + }, + _lastWrappedInfo: null, + _ignoreIndex: NaN + }, + _wrapIterations: function(t) { + return t - (0 | t) == 0 && (t -= 1), + 0 | t + }, + sample: function(t, e, i) { + var a = this.ratios.length + , o = i.getWrappedInfo(i.time, this._wrappedInfo) + , l = o.direction + , h = n(this.ratios, o.ratio); + if (h < 0 && (h = ~h - 1, + l < 0 && (h += 1)), + this._ignoreIndex !== h && (this._ignoreIndex = NaN), + o.frameIndex = h, + !this._lastWrappedInfo) + return this._fireEvent(h), + void (this._lastWrappedInfo = new s(o)); + var c = i.wrapMode + , u = this._wrapIterations(o.iterations) + , _ = this._lastWrappedInfo + , f = this._wrapIterations(_.iterations) + , d = _.frameIndex + , p = _.direction + , m = -1 !== f && u !== f; + if (d === h && m && 1 === a) + this._fireEvent(0); + else if (d !== h || m) { + l = p; + do { + if (d !== h) { + if (-1 === l && 0 === d && h > 0 ? ((c & r.PingPong) === r.PingPong ? l *= -1 : d = a, + f++) : 1 === l && d === a - 1 && h < a - 1 && ((c & r.PingPong) === r.PingPong ? l *= -1 : d = -1, + f++), + d === h) + break; + if (f > u) + break + } + d += l, + cc.director.getAnimationManager().pushDelayEvent(this, "_fireEvent", [d]) + } while (d !== h && d > -1 && d < a) + } + this._lastWrappedInfo.set(o) + }, + _fireEvent: function(t) { + if (!(t < 0 || t >= this.events.length || this._ignoreIndex === t)) { + var e = this.events[t].events; + if (this.target.isValid) + for (var i = this.target._components, n = 0; n < e.length; n++) + for (var r = e[n], s = r.func, a = 0; a < i.length; a++) { + var o = i[a] + , l = o[s]; + l && l.apply(o, r.params) + } + } + }, + onTimeChangedManually: function(t, e) { + this._lastWrappedInfo = null, + this._ignoreIndex = NaN; + var i = e.getWrappedInfo(t, this._wrappedInfo) + , r = i.direction + , s = n(this.ratios, i.ratio); + s < 0 && (s = ~s - 1, + r < 0 && (s += 1), + this._ignoreIndex = s) + } + }); + e.exports = { + AnimCurve: o, + DynamicAnimCurve: h, + EventAnimCurve: u, + EventInfo: c, + computeRatioByType: a, + quickFindIndex: function(t, e) { + var i = t.length - 1; + if (0 === i) + return 0; + var n = t[0]; + if (e < n) + return 0; + var r = t[i]; + if (e > r) + return ~t.length; + var s = (e = (e - n) / (r - n)) / (1 / i) + , a = 0 | s; + return s - a < 1e-6 ? a : a + 1 - s < 1e-6 ? a + 1 : ~(a + 1) + } + } + } + ), { + "../core/utils/binary-search": 260, + "./bezier": 14, + "./types": 19 + }], + 12: [(function(t, e) { + "use strict"; + var i = cc.js + , n = cc.Class({ + ctor: function() { + this._anims = new i.array.MutableForwardIterator([]), + this._delayEvents = [], + cc.director._scheduler && cc.director._scheduler.enableForTarget(this) + }, + update: function(t) { + var e = this._anims + , i = e.array; + for (e.i = 0; e.i < i.length; ++e.i) { + var n = i[e.i]; + n._isPlaying && !n._isPaused && n.update(t) + } + for (var r = this._delayEvents, s = 0; s < r.length; s++) { + var a = r[s]; + a.target[a.func].apply(a.target, a.args) + } + r.length = 0 + }, + destruct: function() {}, + addAnimation: function(t) { + -1 === this._anims.array.indexOf(t) && this._anims.push(t) + }, + removeAnimation: function(t) { + var e = this._anims.array.indexOf(t); + e >= 0 ? this._anims.fastRemoveAt(e) : cc.errorID(3907) + }, + pushDelayEvent: function(t, e, i) { + this._delayEvents.push({ + target: t, + func: e, + args: i + }) + } + }); + cc.AnimationManager = e.exports = n + } + ), {}], + 13: [(function(t, e) { + "use strict"; + var i = cc.js + , n = t("./playable") + , r = t("./types") + , s = r.WrappedInfo + , a = r.WrapMode + , o = r.WrapModeMask; + function l(t, e) { + n.call(this), + this._currentFramePlayed = !1, + this._delay = 0, + this._delayTime = 0, + this._wrappedInfo = new s, + this._lastWrappedInfo = null, + this._process = c, + this._clip = t, + this._name = e || t && t.name, + this.animator = null, + this.curves = [], + this.delay = 0, + this.repeatCount = 1, + this.duration = 1, + this.speed = 1, + this.wrapMode = a.Normal, + this.time = 0, + this._target = null, + this._lastframeEventOn = !1, + this.emit = function() { + for (var t = new Array(arguments.length), e = 0, i = t.length; e < i; e++) + t[e] = arguments[e]; + cc.director.getAnimationManager().pushDelayEvent(this, "_emit", t) + } + } + i.extend(l, n); + var h = l.prototype; + function c() { + var t, e = this.sample(); + this._lastframeEventOn && (t = this._lastWrappedInfo ? this._lastWrappedInfo : this._lastWrappedInfo = new s(e), + this.repeatCount > 1 && (0 | e.iterations) > (0 | t.iterations) && this.emit("lastframe", this), + t.set(e)), + e.stopped && (this.stop(), + this.emit("finished", this)) + } + function u() { + var t = this.time + , e = this.duration; + t > e ? 0 == (t %= e) && (t = e) : t < 0 && 0 != (t %= e) && (t += e); + for (var i = t / e, n = this.curves, r = 0, s = n.length; r < s; r++) + n[r].sample(t, i, this); + this._lastframeEventOn && (void 0 === this._lastIterations && (this._lastIterations = i), + (this.time > 0 && this._lastIterations > i || this.time < 0 && this._lastIterations < i) && this.emit("lastframe", this), + this._lastIterations = i) + } + h._emit = function(t, e) { + this._target && this._target.isValid && this._target.emit(t, t, e) + } + , + h.on = function(t, e, i) { + return this._target && this._target.isValid ? ("lastframe" === t && (this._lastframeEventOn = !0), + this._target.on(t, e, i)) : null + } + , + h.once = function(t, e, i) { + if (this._target && this._target.isValid) { + "lastframe" === t && (this._lastframeEventOn = !0); + var n = this; + return this._target.once(t, (function(t) { + e.call(i, t), + n._lastframeEventOn = !1 + } + )) + } + return null + } + , + h.off = function(t, e, i) { + this._target && this._target.isValid && ("lastframe" === t && (this._target.hasEventListener(t) || (this._lastframeEventOn = !1)), + this._target.off(t, e, i)) + } + , + h._setEventTarget = function(t) { + this._target = t + } + , + h.onPlay = function() { + this.setTime(0), + this._delayTime = this._delay, + cc.director.getAnimationManager().addAnimation(this), + this.animator && this.animator.addAnimation(this), + this.emit("play", this) + } + , + h.onStop = function() { + this.isPaused || cc.director.getAnimationManager().removeAnimation(this), + this.animator && this.animator.removeAnimation(this), + this.emit("stop", this) + } + , + h.onResume = function() { + cc.director.getAnimationManager().addAnimation(this), + this.emit("resume", this) + } + , + h.onPause = function() { + cc.director.getAnimationManager().removeAnimation(this), + this.emit("pause", this) + } + , + h.setTime = function(t) { + this._currentFramePlayed = !1, + this.time = t || 0; + for (var e = this.curves, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + r.onTimeChangedManually && r.onTimeChangedManually(t, this) + } + } + , + h.update = function(t) { + this._delayTime > 0 && (this._delayTime -= t, + this._delayTime > 0) || (this._currentFramePlayed ? this.time += t * this.speed : this._currentFramePlayed = !0, + this._process()) + } + , + h._needRevers = function(t) { + var e = this.wrapMode + , i = !1; + return (e & o.PingPong) === o.PingPong && (t - (0 | t) == 0 && t > 0 && (t -= 1), + 1 & t && (i = !i)), + (e & o.Reverse) === o.Reverse && (i = !i), + i + } + , + h.getWrappedInfo = function(t, e) { + e = e || new s; + var i = !1 + , n = this.duration + , r = this.repeatCount + , a = t > 0 ? t / n : -t / n; + if (a >= r) { + a = r, + i = !0; + var l = r - (0 | r); + 0 === l && (l = 1), + t = l * n * (t > 0 ? 1 : -1) + } + if (t > n) { + var h = t % n; + t = 0 === h ? n : h + } else + t < 0 && 0 != (t %= n) && (t += n); + var c = !1 + , u = this._wrapMode & o.ShouldWrap; + u && (c = this._needRevers(a)); + var _ = c ? -1 : 1; + return this.speed < 0 && (_ *= -1), + u && c && (t = n - t), + e.ratio = t / n, + e.time = t, + e.direction = _, + e.stopped = i, + e.iterations = a, + e + } + , + h.sample = function() { + for (var t = this.getWrappedInfo(this.time, this._wrappedInfo), e = this.curves, i = 0, n = e.length; i < n; i++) + e[i].sample(t.time, t.ratio, this); + return t + } + , + i.get(h, "clip", (function() { + return this._clip + } + )), + i.get(h, "name", (function() { + return this._name + } + )), + i.obsolete(h, "AnimationState.length", "duration"), + i.getset(h, "curveLoaded", (function() { + return this.curves.length > 0 + } + ), (function() { + this.curves.length = 0 + } + )), + i.getset(h, "wrapMode", (function() { + return this._wrapMode + } + ), (function(t) { + this._wrapMode = t, + this.time = 0, + t & o.Loop ? this.repeatCount = 1 / 0 : this.repeatCount = 1 + } + )), + i.getset(h, "repeatCount", (function() { + return this._repeatCount + } + ), (function(t) { + this._repeatCount = t; + var e = this._wrapMode & o.ShouldWrap + , i = (this.wrapMode & o.Reverse) === o.Reverse; + this._process = t !== 1 / 0 || e || i ? c : u + } + )), + i.getset(h, "delay", (function() { + return this._delay + } + ), (function(t) { + this._delayTime = this._delay = t + } + )), + cc.AnimationState = e.exports = l + } + ), { + "./playable": 18, + "./types": 19 + }], + 14: [(function(t, e) { + "use strict"; + var i = Math.cos + , n = Math.acos + , r = Math.max + , s = 2 * Math.PI + , a = Math.sqrt; + function o(t) { + return t < 0 ? -Math.pow(-t, 1 / 3) : Math.pow(t, 1 / 3) + } + function l(t, e) { + var l, h, c, u, _ = e - 0, f = e - t[0], d = 3 * _, p = 3 * f, m = 3 * (e - t[2]), y = 1 / (-_ + p - m + (e - 1)), v = (d - 6 * f + m) * y, g = v * (1 / 3), A = (-d + p) * y, x = 1 / 3 * (3 * A - v * v), b = x * (1 / 3), C = (2 * v * v * v - 9 * v * A + _ * y * 27) / 27, T = C / 2, S = T * T + b * b * b; + if (S < 0) { + var w = 1 / 3 * -x + , E = a(w * w * w) + , M = -C / (2 * E) + , D = n(M < -1 ? -1 : M > 1 ? 1 : M) + , B = 2 * o(E); + return h = B * i(D * (1 / 3)) - g, + c = B * i((D + s) * (1 / 3)) - g, + u = B * i((D + 2 * s) * (1 / 3)) - g, + 0 <= h && h <= 1 ? 0 <= c && c <= 1 ? 0 <= u && u <= 1 ? r(h, c, u) : r(h, c) : 0 <= u && u <= 1 ? r(h, u) : h : 0 <= c && c <= 1 ? 0 <= u && u <= 1 ? r(c, u) : c : u + } + if (0 === S) + return c = -(l = T < 0 ? o(-T) : -o(T)) - g, + 0 <= (h = 2 * l - g) && h <= 1 ? 0 <= c && c <= 1 ? r(h, c) : h : c; + var I = a(S); + return (l = o(-T + I)) - o(T + I) - g + } + e.exports = { + bezier: function(t, e, i, n, r) { + var s = 1 - r; + return s * (s * (t + (3 * e - t) * r) + 3 * i * r * r) + n * r * r * r + }, + bezierByTime: function(t, e) { + var i = l(t, e) + , n = t[1]; + return ((1 - i) * (n + (t[3] - n) * i) * 3 + i * i) * i + } + } + } + ), {}], + 15: [(function(t, e) { + "use strict"; + var i = { + constant: function() { + return 0 + }, + linear: function(t) { + return t + }, + quadIn: function(t) { + return t * t + }, + quadOut: function(t) { + return t * (2 - t) + }, + quadInOut: function(t) { + return (t *= 2) < 1 ? .5 * t * t : -.5 * (--t * (t - 2) - 1) + }, + cubicIn: function(t) { + return t * t * t + }, + cubicOut: function(t) { + return --t * t * t + 1 + }, + cubicInOut: function(t) { + return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2) + }, + quartIn: function(t) { + return t * t * t * t + }, + quartOut: function(t) { + return 1 - --t * t * t * t + }, + quartInOut: function(t) { + return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2) + }, + quintIn: function(t) { + return t * t * t * t * t + }, + quintOut: function(t) { + return --t * t * t * t * t + 1 + }, + quintInOut: function(t) { + return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2) + }, + sineIn: function(t) { + return 1 - Math.cos(t * Math.PI / 2) + }, + sineOut: function(t) { + return Math.sin(t * Math.PI / 2) + }, + sineInOut: function(t) { + return .5 * (1 - Math.cos(Math.PI * t)) + }, + expoIn: function(t) { + return 0 === t ? 0 : Math.pow(1024, t - 1) + }, + expoOut: function(t) { + return 1 === t ? 1 : 1 - Math.pow(2, -10 * t) + }, + expoInOut: function(t) { + return 0 === t ? 0 : 1 === t ? 1 : (t *= 2) < 1 ? .5 * Math.pow(1024, t - 1) : .5 * (2 - Math.pow(2, -10 * (t - 1))) + }, + circIn: function(t) { + return 1 - Math.sqrt(1 - t * t) + }, + circOut: function(t) { + return Math.sqrt(1 - --t * t) + }, + circInOut: function(t) { + return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1) + }, + elasticIn: function(t) { + var e, i = .1; + return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, + e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), + -i * Math.pow(2, 10 * (t -= 1)) * Math.sin(2 * (t - e) * Math.PI / .4)) + }, + elasticOut: function(t) { + var e, i = .1; + return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, + e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), + i * Math.pow(2, -10 * t) * Math.sin(2 * (t - e) * Math.PI / .4) + 1) + }, + elasticInOut: function(t) { + var e, i = .1; + return 0 === t ? 0 : 1 === t ? 1 : (!i || i < 1 ? (i = 1, + e = .1) : e = .4 * Math.asin(1 / i) / (2 * Math.PI), + (t *= 2) < 1 ? i * Math.pow(2, 10 * (t -= 1)) * Math.sin(2 * (t - e) * Math.PI / .4) * -.5 : i * Math.pow(2, -10 * (t -= 1)) * Math.sin(2 * (t - e) * Math.PI / .4) * .5 + 1) + }, + backIn: function(t) { + var e = 1.70158; + return t * t * ((e + 1) * t - e) + }, + backOut: function(t) { + var e = 1.70158; + return --t * t * ((e + 1) * t + e) + 1 + }, + backInOut: function(t) { + var e = 2.5949095; + return (t *= 2) < 1 ? t * t * ((e + 1) * t - e) * .5 : .5 * ((t -= 2) * t * ((e + 1) * t + e) + 2) + }, + bounceIn: function(t) { + return 1 - i.bounceOut(1 - t) + }, + bounceOut: function(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375 + }, + bounceInOut: function(t) { + return t < .5 ? .5 * i.bounceIn(2 * t) : .5 * i.bounceOut(2 * t - 1) + .5 + }, + smooth: function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : t * t * (3 - 2 * t) + }, + fade: function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : t * t * t * (t * (6 * t - 15) + 10) + } + }; + function n(t, e) { + return function(i) { + return i < .5 ? e(2 * i) / 2 : t(2 * i - 1) / 2 + .5 + } + } + i.quadOutIn = n(i.quadIn, i.quadOut), + i.cubicOutIn = n(i.cubicIn, i.cubicOut), + i.quartOutIn = n(i.quartIn, i.quartOut), + i.quintOutIn = n(i.quintIn, i.quintOut), + i.sineOutIn = n(i.sineIn, i.sineOut), + i.expoOutIn = n(i.expoIn, i.expoOut), + i.circOutIn = n(i.circIn, i.circOut), + i.backOutIn = n(i.backIn, i.backOut), + i.bounceIn = function(t) { + return 1 - i.bounceOut(1 - t) + } + , + i.bounceInOut = function(t) { + return t < .5 ? .5 * i.bounceIn(2 * t) : .5 * i.bounceOut(2 * t - 1) + .5 + } + , + i.bounceOutIn = n(i.bounceIn, i.bounceOut), + cc.easing = e.exports = i + } + ), {}], + 16: [(function(t) { + "use strict"; + t("./bezier"), + t("./easing"), + t("./types"), + t("./motion-path-helper"), + t("./animation-curves"), + t("./animation-clip"), + t("./animation-manager"), + t("./animation-state"), + t("./animation-animator") + } + ), { + "./animation-animator": 9, + "./animation-clip": 10, + "./animation-curves": 11, + "./animation-manager": 12, + "./animation-state": 13, + "./bezier": 14, + "./easing": 15, + "./motion-path-helper": 17, + "./types": 19 + }], + 17: [(function(t, e) { + "use strict"; + var i = t("./animation-curves").DynamicAnimCurve + , n = t("./animation-curves").computeRatioByType + , r = t("./bezier").bezier + , s = t("../core/utils/binary-search").binarySearchEpsilon + , a = cc.v2; + function o(t) { + this.points = t || [], + this.beziers = [], + this.ratios = [], + this.progresses = [], + this.length = 0, + this.computeBeziers() + } + function l() { + this.start = a(), + this.end = a(), + this.startCtrlPoint = a(), + this.endCtrlPoint = a() + } + function h(t) { + if (!Array.isArray(t)) + return !1; + for (var e = 0, i = t.length; e < i; e++) { + var n = t[e]; + if (!Array.isArray(n) || 6 !== n.length) + return !1 + } + return !0 + } + o.prototype.computeBeziers = function() { + var t; + this.beziers.length = 0, + this.ratios.length = 0, + this.progresses.length = 0, + this.length = 0; + for (var e = 1; e < this.points.length; e++) { + var i = this.points[e - 1] + , n = this.points[e]; + (t = new l).start = i.pos, + t.startCtrlPoint = i.out, + t.end = n.pos, + t.endCtrlPoint = n.in, + this.beziers.push(t), + this.length += t.getLength() + } + var r = 0; + for (e = 0; e < this.beziers.length; e++) + t = this.beziers[e], + this.ratios[e] = t.getLength() / this.length, + this.progresses[e] = r += this.ratios[e]; + return this.beziers + } + , + l.prototype.getPointAt = function(t) { + var e = this.getUtoTmapping(t); + return this.getPoint(e) + } + , + l.prototype.getPoint = function(t) { + var e = r(this.start.x, this.startCtrlPoint.x, this.endCtrlPoint.x, this.end.x, t) + , i = r(this.start.y, this.startCtrlPoint.y, this.endCtrlPoint.y, this.end.y, t); + return new a(e,i) + } + , + l.prototype.getLength = function() { + var t = this.getLengths(); + return t[t.length - 1] + } + , + l.prototype.getLengths = function(t) { + if (t || (t = this.__arcLengthDivisions ? this.__arcLengthDivisions : 200), + this.cacheArcLengths && this.cacheArcLengths.length === t + 1) + return this.cacheArcLengths; + var e, i, n = [], r = this.getPoint(0), s = a(), o = 0; + for (n.push(0), + i = 1; i <= t; i++) + e = this.getPoint(i / t), + s.x = r.x - e.x, + s.y = r.y - e.y, + o += s.mag(), + n.push(o), + r = e; + return this.cacheArcLengths = n, + n + } + , + l.prototype.getUtoTmapping = function(t, e) { + var i, n = this.getLengths(), r = 0, s = n.length; + i = e || t * n[s - 1]; + for (var a, o = 0, l = s - 1; o <= l; ) + if ((a = n[r = Math.floor(o + (l - o) / 2)] - i) < 0) + o = r + 1; + else { + if (!(a > 0)) { + l = r; + break + } + l = r - 1 + } + if (n[r = l] === i) + return r / (s - 1); + var h = n[r]; + return (r + (i - h) / (n[r + 1] - h)) / (s - 1) + } + , + e.exports = { + sampleMotionPaths: function(t, e, r, l, c) { + function u(t) { + return t instanceof cc.Vec2 ? { + in: t, + pos: t, + out: t + } : Array.isArray(t) && 6 === t.length ? { + in: a(t[2], t[3]), + pos: a(t[0], t[1]), + out: a(t[4], t[5]) + } : { + in: cc.Vec2.ZERO, + pos: cc.Vec2.ZERO, + out: cc.Vec2.ZERO + } + } + var _ = e.values = e.values.map((function(t) { + return Array.isArray(t) && (t = 2 === t.length ? cc.v2(t[0], t[1]) : cc.v3(t[0], t[1], t[2])), + t + } + )); + if (0 !== t.length && 0 !== _.length) { + for (var f = !1, d = 0; d < t.length; d++) { + var p = t[d]; + if (p && !h(p) && (cc.errorID(3904, c ? c.name : "", "position", d), + p = null), + p && p.length > 0) { + f = !0; + break + } + } + if (f && 1 !== _.length) { + for (var m = e.types, y = e.ratios, v = e.values = [], g = e.types = [], A = e.ratios = [], x = 0, b = i.Linear, C = 0, T = t.length; C < T - 1; C++) { + var S, w = t[C], E = y[C], M = y[C + 1] - E, D = _[C], B = _[C + 1], I = m[C], P = [], R = x / M, O = 1 / (M * r * l); + if (w && w.length > 0) { + var L = []; + L.push(u(D)); + for (var F = 0, V = w.length; F < V; F++) { + var N = u(w[F]); + L.push(N) + } + L.push(u(B)); + var k = new o(L); + k.computeBeziers(); + for (var G = k.progresses; 1 - R > 1e-6; ) { + var U, z, H, W; + if ((S = n(S = R, I)) < 0) + W = (0 - S) * (z = k.beziers[0]).getLength(), + H = z.start.sub(z.endCtrlPoint).normalize(), + U = z.start.add(H.mul(W)); + else if (S > 1) + W = (S - 1) * (z = k.beziers[k.beziers.length - 1]).getLength(), + H = z.end.sub(z.startCtrlPoint).normalize(), + U = z.end.add(H.mul(W)); + else { + var j = s(G, S); + j < 0 && (j = ~j), + S -= j > 0 ? G[j - 1] : 0, + S /= k.ratios[j], + U = k.beziers[j].getPointAt(S) + } + P.push(U), + R += O + } + } else + for (; 1 - R > 1e-6; ) + S = n(S = R, I), + P.push(D.lerp(B, S)), + R += O; + for (b = "constant" === I ? I : i.Linear, + F = 0, + V = P.length; F < V; F++) { + var X = E + x + O * F * M; + Y(P[F], b, X) + } + x = Math.abs(R - 1) > 1e-6 ? (R - 1) * M : 0 + } + y[y.length - 1] !== A[A.length - 1] && Y(_[_.length - 1], b, y[y.length - 1]) + } + } + function Y(t, e, i) { + v.push(t), + g.push(e), + A.push(i) + } + }, + Curve: o, + Bezier: l + } + } + ), { + "../core/utils/binary-search": 260, + "./animation-curves": 11, + "./bezier": 14 + }], + 18: [(function(t, e) { + "use strict"; + var i = cc.js + , n = t("../core/CCDebug"); + function r() { + this._isPlaying = !1, + this._isPaused = !1, + this._stepOnce = !1 + } + var s = r.prototype; + i.get(s, "isPlaying", (function() { + return this._isPlaying + } + ), !0), + i.get(s, "isPaused", (function() { + return this._isPaused + } + ), !0); + var a = function() {}; + s.onPlay = a, + s.onPause = a, + s.onResume = a, + s.onStop = a, + s.onError = a, + s.play = function() { + this._isPlaying ? this._isPaused ? (this._isPaused = !1, + this.onResume()) : this.onError(n.getError(3912)) : (this._isPlaying = !0, + this.onPlay()) + } + , + s.stop = function() { + this._isPlaying && (this._isPlaying = !1, + this.onStop(), + this._isPaused = !1) + } + , + s.pause = function() { + this._isPlaying && !this._isPaused && (this._isPaused = !0, + this.onPause()) + } + , + s.resume = function() { + this._isPlaying && this._isPaused && (this._isPaused = !1, + this.onResume()) + } + , + s.step = function() { + this.pause(), + this._stepOnce = !0, + this._isPlaying || this.play() + } + , + e.exports = r + } + ), { + "../core/CCDebug": 26 + }], + 19: [(function(t, e) { + "use strict"; + var i = { + Loop: 2, + ShouldWrap: 4, + PingPong: 22, + Reverse: 36 + } + , n = cc.Enum({ + Default: 0, + Normal: 1, + Reverse: i.Reverse, + Loop: i.Loop, + LoopReverse: i.Loop | i.Reverse, + PingPong: i.PingPong, + PingPongReverse: i.PingPong | i.Reverse + }); + function r(t) { + t ? this.set(t) : (this.ratio = 0, + this.time = 0, + this.direction = 1, + this.stopped = !0, + this.iterations = 0, + this.frameIndex = void 0) + } + cc.WrapMode = n, + r.prototype.set = function(t) { + this.ratio = t.ratio, + this.time = t.time, + this.direction = t.direction, + this.stopped = t.stopped, + this.iterations = t.iterations, + this.frameIndex = t.frameIndex + } + , + e.exports = { + WrapModeMask: i, + WrapMode: n, + WrappedInfo: r + } + } + ), {}], + 20: [(function(t, e) { + "use strict"; + var i, n, r = t("../core/event/event-target"), s = t("../core/platform/CCSys"), a = t("../core/assets/CCAudioClip").LoadMode, o = !1, l = [], h = function t(e) { + r.call(this), + this._shouldRecycleOnEnded = !1, + this._src = e, + this._element = null, + this.id = 0, + this._state = t.State.INITIALZING; + var i = this; + this._onended = function() { + i._state = t.State.STOPPED, + i.emit("ended") + } + , + this._onendedSecond = function() { + i._unbindEnded(i._onendedSecond), + i._bindEnded() + } + }; + cc.js.extend(h, r), + h.State = { + ERROR: -1, + INITIALZING: 0, + PLAYING: 1, + PAUSED: 2, + STOPPED: 3 + }, + (i = h.prototype)._bindEnded = function(t) { + if (!(t = t || this._onended)._binded) { + t._binded = !0; + var e = this._element; + this._src && e instanceof HTMLAudioElement ? e.addEventListener("ended", t) : e.onended = t + } + } + , + i._unbindEnded = function(t) { + if ((t = t || this._onended)._binded) { + t._binded = !1; + var e = this._element; + e instanceof HTMLAudioElement ? e.removeEventListener("ended", t) : e && (e.onended = null) + } + } + , + i._onLoaded = function() { + this._createElement(), + this._state = h.State.INITIALZING, + this.setVolume(1), + this.setLoop(!1) + } + , + i._createElement = function() { + var t = this._src._nativeAsset; + t instanceof HTMLAudioElement ? (this._element || (this._element = document.createElement("audio")), + this._element.src = t.src) : this._element = new c(t,this) + } + , + i.play = function() { + var t = this; + this._src && this._src._ensureLoaded((function() { + t._state = h.State.PLAYING, + t._bindEnded(); + var e = t._element.play(); + window.Promise && e instanceof Promise && e.catch((function() {} + )), + t._touchToPlay() + } + )) + } + , + i._touchToPlay = function() { + if (this._src && this._src.loadMode === a.DOM_AUDIO && this._element.paused && l.push({ + instance: this, + offset: 0, + audio: this._element + }), + !o) { + o = !0; + var t = "ontouchend"in window ? "touchend" : "mousedown"; + cc.game.canvas.addEventListener(t, (function() { + for (var t; t = l.pop(); ) + t.audio.play(t.offset) + } + )) + } + } + , + i.destroy = function() { + this._element = null + } + , + i.pause = function() { + if (this.getState() === h.State.PLAYING) { + var t = this; + this._src && this._src._ensureLoaded((function() { + t._unbindEnded(), + t._element.pause(), + t._state = h.State.PAUSED + } + )) + } + } + , + i.resume = function() { + if (this.getState() === h.State.PAUSED) { + var t = this; + this._src && this._src._ensureLoaded((function() { + t._bindEnded(), + t._element.play(), + t._state = h.State.PLAYING + } + )) + } + } + , + i.stop = function() { + var t = this; + this._src && this._src._ensureLoaded((function() { + t._element.pause(), + t._element.currentTime = 0; + for (var e = 0; e < l.length; e++) + if (l[e].instance === t) { + l.splice(e, 1); + break + } + t._unbindEnded(), + t.emit("stop"), + t._state = h.State.STOPPED + } + )) + } + , + i.setLoop = function(t) { + var e = this; + this._src && this._src._ensureLoaded((function() { + e._element.loop = t + } + )) + } + , + i.getLoop = function() { + return !!this._element && this._element.loop + } + , + i.setVolume = function(t) { + var e = this; + this._src && this._src._ensureLoaded((function() { + e._element.volume = t + } + )) + } + , + i.getVolume = function() { + return this._element ? this._element.volume : 1 + } + , + i.setCurrentTime = function(t) { + var e = this; + this._src && this._src._ensureLoaded((function() { + e._unbindEnded(), + e._bindEnded(e._onendedSecond), + e._element.currentTime = t + } + )) + } + , + i.getCurrentTime = function() { + return this._element ? this._element.currentTime : 0 + } + , + i.getDuration = function() { + return this._src ? this._src.duration : 0 + } + , + i.getState = function(t) { + return void 0 === t && (t = !0), + t && this._forceUpdatingState(), + this._state + } + , + i._forceUpdatingState = function() { + var t = this._element; + t && (h.State.PLAYING === this._state && t.paused ? this._state = h.State.STOPPED : h.State.STOPPED !== this._state || t.paused || (this._state = h.State.PLAYING)) + } + , + Object.defineProperty(i, "src", { + get: function() { + return this._src + }, + set: function(t) { + if (this._unbindEnded(), + t) { + if (t !== this._src) + if (this._src = t, + t.loaded) + this._onLoaded(); + else { + var e = this; + t.once("load", (function() { + t === e._src && e._onLoaded() + } + )) + } + } else + this._src = null, + this._element instanceof c ? this._element = null : this._element && (this._element.src = ""), + this._state = h.State.INITIALZING; + return t + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i, "paused", { + get: function() { + return !this._element || this._element.paused + }, + enumerable: !0, + configurable: !0 + }), + n = cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE || cc.sys.browserType === cc.sys.BROWSER_TYPE_BAIDU || cc.sys.browserType === cc.sys.BROWSER_TYPE_UC ? .01 : 0; + var c = function(t, e) { + this._audio = e, + this._context = s.__audioSupport.context, + this._buffer = t, + this._gainObj = this._context.createGain(), + this.volume = 1, + this._gainObj.connect(this._context.destination), + this._loop = !1, + this._startTime = -1, + this._currentSource = null, + this.playedLength = 0, + this._currentTimer = null, + this._endCallback = function() { + this.onended && this.onended(this) + } + .bind(this) + }; + (function(t) { + t.play = function(t) { + this._currentSource && !this.paused && (this._currentSource.onended = null, + this._currentSource.stop(0), + this.playedLength = 0); + var e = this._context.createBufferSource(); + e.buffer = this._buffer, + e.connect(this._gainObj), + e.loop = this._loop, + this._startTime = this._context.currentTime, + (t = t || this.playedLength) && (this._startTime -= t); + var i, n = this._buffer.duration, r = t; + if (this._loop ? e.start ? e.start(0, r) : e.notoGrainOn ? e.noteGrainOn(0, r) : e.noteOn(0, r) : (i = n - t, + e.start ? e.start(0, r, i) : e.noteGrainOn ? e.noteGrainOn(0, r, i) : e.noteOn(0, r, i)), + this._currentSource = e, + e.onended = this._endCallback, + (!e.context.state || "suspended" === e.context.state) && 0 === this._context.currentTime) { + var s = this; + clearTimeout(this._currentTimer), + this._currentTimer = setTimeout((function() { + 0 === s._context.currentTime && l.push({ + instance: s._audio, + offset: t, + audio: s + }) + } + ), 10) + } + var a = cc.sys; + a.os === a.OS_IOS && a.isBrowser && a.isMobile && ("suspended" === e.context.state && 0 !== this._context.currentTime || "interrupted" === e.context.state) && e.context.resume() + } + , + t.pause = function() { + if (clearTimeout(this._currentTimer), + !this.paused) { + this.playedLength = this._context.currentTime - this._startTime, + this.playedLength %= this._buffer.duration; + var t = this._currentSource; + t && (t.onended && (t.onended._binded = !1, + t.onended = null), + t.stop(0)), + this._currentSource = null, + this._startTime = -1 + } + } + , + Object.defineProperty(t, "paused", { + get: function() { + return (!this._currentSource || !this._currentSource.loop) && (-1 === this._startTime || this._context.currentTime - this._startTime > this._buffer.duration) + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t, "loop", { + get: function() { + return this._loop + }, + set: function(t) { + return this._currentSource && (this._currentSource.loop = t), + this._loop = t + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t, "volume", { + get: function() { + return this._volume + }, + set: function(t) { + if (this._volume = t, + this._gainObj.gain.setTargetAtTime) + try { + this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, n) + } catch (e) { + this._gainObj.gain.setTargetAtTime(t, this._context.currentTime, .01) + } + else + this._gainObj.gain.value = t; + s.os === s.OS_IOS && !this.paused && this._currentSource && (this._currentSource.onended = null, + this.pause(), + this.play()) + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t, "currentTime", { + get: function() { + return this.paused ? this.playedLength : (this.playedLength = this._context.currentTime - this._startTime, + this.playedLength %= this._buffer.duration, + this.playedLength) + }, + set: function(t) { + return this.paused ? this.playedLength = t : (this.pause(), + this.playedLength = t, + this.play()), + t + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t, "duration", { + get: function() { + return this._buffer.duration + }, + enumerable: !0, + configurable: !0 + }) + } + )(c.prototype), + e.exports = cc._Audio = h + } + ), { + "../core/assets/CCAudioClip": 63, + "../core/event/event-target": 140, + "../core/platform/CCSys": 202 + }], + 21: [(function(t, e) { + "use strict"; + var i = t("./CCAudio") + , n = t("../core/assets/CCAudioClip") + , r = cc.js + , s = 0 + , a = r.createMap(!0) + , o = {} + , l = [] + , h = function(t) { + t._shouldRecycleOnEnded && (t._finishCallback = null, + t.off("ended"), + t.off("stop"), + t.src = null, + l.includes(t) || (l.length < 32 ? l.push(t) : t.destroy()), + t._shouldRecycleOnEnded = !1) + } + , c = function(t) { + var e = s++ + , n = o[t]; + if (n || (n = o[t] = []), + f._maxAudioInstance <= n.length) { + var r = n.shift(); + u(r).stop() + } + var c = l.pop() || new i + , _ = function() { + if (u(this.id)) { + delete a[this.id]; + var t = n.indexOf(this.id); + cc.js.array.fastRemoveAt(n, t) + } + h(this) + }; + return c.on("ended", (function() { + this._finishCallback && this._finishCallback(), + this.getLoop() || _.call(this) + } + ), c), + c.on("stop", _, c), + c.id = e, + a[e] = c, + n.push(e), + c + } + , u = function(t) { + return a[t] + } + , _ = function(t) { + return void 0 === t ? t = 1 : "string" == typeof t && (t = Number.parseFloat(t)), + t + } + , f = { + AudioState: i.State, + _maxAudioInstance: 24, + _id2audio: a, + play: function(t, e, i) { + if (!(t instanceof n)) + return cc.error("Wrong type of AudioClip."); + var r = t.nativeUrl + , s = c(r); + return s.src = t, + t._ensureLoaded(), + s._shouldRecycleOnEnded = !0, + s.setLoop(e || !1), + i = _(i), + s.setVolume(i), + s.play(), + s.id + }, + setLoop: function(t, e) { + var i = u(t); + i && i.setLoop && i.setLoop(e) + }, + isLoop: function(t) { + var e = u(t); + return !(!e || !e.getLoop) && e.getLoop() + }, + setVolume: function(t, e) { + var i = u(t); + i && i.setVolume(e) + }, + getVolume: function(t) { + var e = u(t); + return e ? e.getVolume() : 1 + }, + setCurrentTime: function(t, e) { + var i = u(t); + return !!i && (i.setCurrentTime(e), + !0) + }, + getCurrentTime: function(t) { + var e = u(t); + return e ? e.getCurrentTime() : 0 + }, + getDuration: function(t) { + var e = u(t); + return e ? e.getDuration() : 0 + }, + getState: function(t) { + var e = u(t); + return e ? e.getState() : this.AudioState.ERROR + }, + setFinishCallback: function(t, e) { + var i = u(t); + i && (i._finishCallback = e) + }, + pause: function(t) { + var e = u(t); + return !!e && (e.pause(), + !0) + }, + _pauseIDCache: [], + pauseAll: function() { + for (var t in a) { + var e = a[t]; + e.getState() === i.State.PLAYING && (this._pauseIDCache.push(t), + e.pause()) + } + }, + resume: function(t) { + var e = u(t); + e && e.resume() + }, + resumeAll: function() { + for (var t = 0; t < this._pauseIDCache.length; ++t) { + var e = this._pauseIDCache[t] + , i = u(e); + i && i.resume() + } + this._pauseIDCache.length = 0 + }, + stop: function(t) { + var e = u(t); + return !!e && (e.stop(), + !0) + }, + stopAll: function() { + for (var t in a) { + var e = a[t]; + e && e.stop() + } + }, + setMaxAudioInstance: function() {}, + getMaxAudioInstance: function() { + return this._maxAudioInstance + }, + uncache: function(t) { + var e = t; + if ("string" == typeof t) + cc.warnID(8401, "cc.audioEngine", "cc.AudioClip", "AudioClip", "cc.AudioClip", "audio"), + e = t; + else { + if (!t) + return; + e = t.nativeUrl + } + var i = o[e]; + if (i) + for (; i.length > 0; ) { + var n = i.pop() + , r = a[n]; + r && (r.stop(), + delete a[n]) + } + }, + uncacheAll: function() { + var t; + for (var e in this.stopAll(), + a) + (t = a[e]) && t.destroy(); + for (; t = l.pop(); ) + t.destroy(); + a = r.createMap(!0), + o = {} + }, + _breakCache: null, + _break: function() { + for (var t in this._breakCache = [], + a) { + var e = a[t]; + e.getState() === i.State.PLAYING && (this._breakCache.push(t), + e.pause()) + } + }, + _restore: function() { + if (this._breakCache) { + for (; this._breakCache.length > 0; ) { + var t = this._breakCache.pop() + , e = u(t); + e && e.resume && e.resume() + } + this._breakCache = null + } + }, + _music: { + id: -1, + loop: !1, + volume: 1 + }, + _effect: { + volume: 1, + pauseCache: [] + }, + playMusic: function(t, e) { + var i = this._music; + return this.stop(i.id), + i.id = this.play(t, e, i.volume), + i.loop = e, + i.id + }, + stopMusic: function() { + this.stop(this._music.id) + }, + pauseMusic: function() { + return this.pause(this._music.id), + this._music.id + }, + resumeMusic: function() { + return this.resume(this._music.id), + this._music.id + }, + getMusicVolume: function() { + return this._music.volume + }, + setMusicVolume: function(t) { + t = _(t); + var e = this._music; + return e.volume = t, + this.setVolume(e.id, e.volume), + e.volume + }, + isMusicPlaying: function() { + return this.getState(this._music.id) === this.AudioState.PLAYING + }, + playEffect: function(t, e) { + return this.play(t, e || !1, this._effect.volume) + }, + setEffectsVolume: function(t) { + t = _(t); + var e = this._music.id; + for (var i in this._effect.volume = t, + a) { + var n = a[i]; + n && n.id !== e && f.setVolume(i, t) + } + }, + getEffectsVolume: function() { + return this._effect.volume + }, + pauseEffect: function(t) { + return this.pause(t) + }, + pauseAllEffects: function() { + var t = this._music.id + , e = this._effect; + for (var i in e.pauseCache.length = 0, + a) { + var n = a[i]; + n && n.id !== t && n.getState() === this.AudioState.PLAYING && (e.pauseCache.push(i), + n.pause()) + } + }, + resumeEffect: function(t) { + this.resume(t) + }, + resumeAllEffects: function() { + for (var t = this._effect.pauseCache, e = 0; e < t.length; ++e) { + var i = t[e] + , n = a[i]; + n && n.resume() + } + }, + stopEffect: function(t) { + return this.stop(t) + }, + stopAllEffects: function() { + var t = this._music.id; + for (var e in a) { + var i = a[e]; + i && i.id !== t && i.getState() === f.AudioState.PLAYING && i.stop() + } + } + }; + e.exports = cc.audioEngine = f + } + ), { + "../core/assets/CCAudioClip": 63, + "./CCAudio": 20 + }], + 22: [(function(t, e) { + "use strict"; + var i = { + name: "Jacob__Codec" + }; + i.Base64 = t("./base64"), + i.GZip = t("./gzip"), + i.unzip = function() { + return i.GZip.gunzip.apply(i.GZip, arguments) + } + , + i.unzipBase64 = function() { + var t = i.Base64.decode.apply(i.Base64, arguments); + try { + return i.GZip.gunzip.call(i.GZip, t) + } catch (e) { + return t.slice(7) + } + } + , + i.unzipBase64AsArray = function(t, e) { + e = e || 1; + var i, n, r, s = this.unzipBase64(t), a = []; + for (i = 0, + r = s.length / e; i < r; i++) + for (a[i] = 0, + n = e - 1; n >= 0; --n) + a[i] += s.charCodeAt(i * e + n) << 8 * n; + return a + } + , + i.unzipAsArray = function(t, e) { + e = e || 1; + var i, n, r, s = this.unzip(t), a = []; + for (i = 0, + r = s.length / e; i < r; i++) + for (a[i] = 0, + n = e - 1; n >= 0; --n) + a[i] += s.charCodeAt(i * e + n) << 8 * n; + return a + } + , + cc.codec = e.exports = i + } + ), { + "./base64": 23, + "./gzip": 24 + }], + 23: [(function(t, e) { + "use strict"; + var i = t("../core/utils/misc").BASE64_VALUES + , n = { + name: "Jacob__Codec__Base64", + decode: function(t) { + var e, n, r, s, a, o, l = [], h = 0; + for (t = t.replace(/[^A-Za-z0-9\+\/\=]/g, ""); h < t.length; ) + e = i[t.charCodeAt(h++)] << 2 | (s = i[t.charCodeAt(h++)]) >> 4, + n = (15 & s) << 4 | (a = i[t.charCodeAt(h++)]) >> 2, + r = (3 & a) << 6 | (o = i[t.charCodeAt(h++)]), + l.push(String.fromCharCode(e)), + 64 !== a && l.push(String.fromCharCode(n)), + 64 !== o && l.push(String.fromCharCode(r)); + return l.join("") + }, + decodeAsArray: function(t, e) { + var i, n, r, s = this.decode(t), a = []; + for (i = 0, + r = s.length / e; i < r; i++) + for (a[i] = 0, + n = e - 1; n >= 0; --n) + a[i] += s.charCodeAt(i * e + n) << 8 * n; + return a + } + }; + e.exports = n + } + ), { + "../core/utils/misc": 267 + }], + 24: [(function(t, e) { + "use strict"; + var i = function(t) { + this.data = t, + this.debug = !1, + this.gpflags = void 0, + this.files = 0, + this.unzipped = [], + this.buf32k = new Array(32768), + this.bIdx = 0, + this.modeZIP = !1, + this.bytepos = 0, + this.bb = 1, + this.bits = 0, + this.nameBuf = [], + this.fileout = void 0, + this.literalTree = new Array(i.LITERALS), + this.distanceTree = new Array(32), + this.treepos = 0, + this.Places = null, + this.len = 0, + this.fpos = new Array(17), + this.fpos[0] = 0, + this.flens = void 0, + this.fmax = void 0 + }; + i.gunzip = function(t) { + return t.constructor === Array || (t.constructor, + String), + new i(t).gunzip()[0][0] + } + , + i.HufNode = function() { + this.b0 = 0, + this.b1 = 0, + this.jump = null, + this.jumppos = -1 + } + , + i.LITERALS = 288, + i.NAMEMAX = 256, + i.bitReverse = [0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255], + i.cplens = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], + i.cplext = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99], + i.cpdist = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], + i.cpdext = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], + i.border = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], + i.prototype.gunzip = function() { + return this.outputArr = [], + this.nextFile(), + this.unzipped + } + , + i.prototype.readByte = function() { + return this.bits += 8, + this.bytepos < this.data.length ? this.data.charCodeAt(this.bytepos++) : -1 + } + , + i.prototype.byteAlign = function() { + this.bb = 1 + } + , + i.prototype.readBit = function() { + var t; + return this.bits++, + t = 1 & this.bb, + this.bb >>= 1, + 0 === this.bb && (this.bb = this.readByte(), + t = 1 & this.bb, + this.bb = this.bb >> 1 | 128), + t + } + , + i.prototype.readBits = function(t) { + for (var e = 0, n = t; n--; ) + e = e << 1 | this.readBit(); + return t && (e = i.bitReverse[e] >> 8 - t), + e + } + , + i.prototype.flushBuffer = function() { + this.bIdx = 0 + } + , + i.prototype.addBuffer = function(t) { + this.buf32k[this.bIdx++] = t, + this.outputArr.push(String.fromCharCode(t)), + 32768 === this.bIdx && (this.bIdx = 0) + } + , + i.prototype.IsPat = function() { + for (; ; ) { + if (this.fpos[this.len] >= this.fmax) + return -1; + if (this.flens[this.fpos[this.len]] === this.len) + return this.fpos[this.len]++; + this.fpos[this.len]++ + } + } + , + i.prototype.Rec = function() { + var t, e = this.Places[this.treepos]; + if (17 === this.len) + return -1; + if (this.treepos++, + this.len++, + (t = this.IsPat()) >= 0) + e.b0 = t; + else if (e.b0 = 32768, + this.Rec()) + return -1; + if ((t = this.IsPat()) >= 0) + e.b1 = t, + e.jump = null; + else if (e.b1 = 32768, + e.jump = this.Places[this.treepos], + e.jumppos = this.treepos, + this.Rec()) + return -1; + return this.len--, + 0 + } + , + i.prototype.CreateTree = function(t, e, i) { + var n; + for (this.Places = t, + this.treepos = 0, + this.flens = i, + this.fmax = e, + n = 0; n < 17; n++) + this.fpos[n] = 0; + return this.len = 0, + this.Rec() ? -1 : 0 + } + , + i.prototype.DecodeValue = function(t) { + for (var e, i, n = 0, r = t[n]; ; ) + if (this.readBit()) { + if (!(32768 & r.b1)) + return r.b1; + for (r = r.jump, + e = t.length, + i = 0; i < e; i++) + if (t[i] === r) { + n = i; + break + } + } else { + if (!(32768 & r.b0)) + return r.b0; + r = t[++n] + } + return -1 + } + , + i.prototype.DeflateLoop = function() { + var t, e, n; + do { + var r, s; + if (t = this.readBit(), + 0 === (e = this.readBits(2))) + for (this.byteAlign(), + r = this.readByte(), + r |= this.readByte() << 8, + s = this.readByte(), + 65535 & (r ^ ~(s |= this.readByte() << 8)) && document.write("BlockLen checksum mismatch\n"); r--; ) + a = this.readByte(), + this.addBuffer(a); + else if (1 === e) + for (; ; ) + if ((o = i.bitReverse[this.readBits(7)] >> 1) > 23 ? (o = o << 1 | this.readBit()) > 199 ? o = (o -= 128) << 1 | this.readBit() : (o -= 48) > 143 && (o += 136) : o += 256, + o < 256) + this.addBuffer(o); + else { + if (256 === o) + break; + for (o -= 257, + p = this.readBits(i.cplext[o]) + i.cplens[o], + o = i.bitReverse[this.readBits(5)] >> 3, + i.cpdext[o] > 8 ? (m = this.readBits(8), + m |= this.readBits(i.cpdext[o] - 8) << 8) : m = this.readBits(i.cpdext[o]), + m += i.cpdist[o], + o = 0; o < p; o++) { + var a = this.buf32k[this.bIdx - m & 32767]; + this.addBuffer(a) + } + } + else if (2 === e) { + var o, l, h, c, u, _ = new Array(320); + for (h = 257 + this.readBits(5), + c = 1 + this.readBits(5), + u = 4 + this.readBits(4), + o = 0; o < 19; o++) + _[o] = 0; + for (o = 0; o < u; o++) + _[i.border[o]] = this.readBits(3); + for (p = this.distanceTree.length, + n = 0; n < p; n++) + this.distanceTree[n] = new i.HufNode; + if (this.CreateTree(this.distanceTree, 19, _, 0)) + return this.flushBuffer(), + 1; + for (l = h + c, + n = 0; n < l; ) + if ((o = this.DecodeValue(this.distanceTree)) < 16) + _[n++] = o; + else if (16 === o) { + var f; + if (n + (o = 3 + this.readBits(2)) > l) + return this.flushBuffer(), + 1; + for (f = n ? _[n - 1] : 0; o--; ) + _[n++] = f + } else { + if (n + (o = 17 === o ? 3 + this.readBits(3) : 11 + this.readBits(7)) > l) + return this.flushBuffer(), + 1; + for (; o--; ) + _[n++] = 0 + } + for (p = this.literalTree.length, + n = 0; n < p; n++) + this.literalTree[n] = new i.HufNode; + if (this.CreateTree(this.literalTree, h, _, 0)) + return this.flushBuffer(), + 1; + for (p = this.literalTree.length, + n = 0; n < p; n++) + this.distanceTree[n] = new i.HufNode; + var d = new Array; + for (n = h; n < _.length; n++) + d[n - h] = _[n]; + if (this.CreateTree(this.distanceTree, c, d, 0)) + return this.flushBuffer(), + 1; + for (; ; ) + if ((o = this.DecodeValue(this.literalTree)) >= 256) { + var p, m; + if (0 == (o -= 256)) + break; + for (o--, + p = this.readBits(i.cplext[o]) + i.cplens[o], + o = this.DecodeValue(this.distanceTree), + i.cpdext[o] > 8 ? (m = this.readBits(8), + m |= this.readBits(i.cpdext[o] - 8) << 8) : m = this.readBits(i.cpdext[o]), + m += i.cpdist[o]; p--; ) + a = this.buf32k[this.bIdx - m & 32767], + this.addBuffer(a) + } else + this.addBuffer(o) + } + } while (!t);return this.flushBuffer(), + this.byteAlign(), + 0 + } + , + i.prototype.unzipFile = function(t) { + var e; + for (this.gunzip(), + e = 0; e < this.unzipped.length; e++) + if (this.unzipped[e][1] === t) + return this.unzipped[e][0] + } + , + i.prototype.nextFile = function() { + this.outputArr = [], + this.modeZIP = !1; + var t = []; + if (t[0] = this.readByte(), + t[1] = this.readByte(), + 120 === t[0] && 218 === t[1] && (this.DeflateLoop(), + this.unzipped[this.files] = [this.outputArr.join(""), "geonext.gxt"], + this.files++), + 31 === t[0] && 139 === t[1] && (this.skipdir(), + this.unzipped[this.files] = [this.outputArr.join(""), "file"], + this.files++), + 80 === t[0] && 75 === t[1] && (this.modeZIP = !0, + t[2] = this.readByte(), + t[3] = this.readByte(), + 3 === t[2] && 4 === t[3])) { + t[0] = this.readByte(), + t[1] = this.readByte(), + this.gpflags = this.readByte(), + this.gpflags |= this.readByte() << 8; + var e = this.readByte(); + e |= this.readByte() << 8, + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(); + var n = this.readByte(); + n |= this.readByte() << 8; + var r = this.readByte(); + for (r |= this.readByte() << 8, + a = 0, + this.nameBuf = []; n--; ) { + var s = this.readByte(); + "/" === s | ":" === s ? a = 0 : a < i.NAMEMAX - 1 && (this.nameBuf[a++] = String.fromCharCode(s)) + } + this.fileout || (this.fileout = this.nameBuf); + for (var a = 0; a < r; ) + s = this.readByte(), + a++; + 8 === e && (this.DeflateLoop(), + this.unzipped[this.files] = [this.outputArr.join(""), this.nameBuf.join("")], + this.files++), + this.skipdir() + } + } + , + i.prototype.skipdir = function() { + var t, e, n = []; + if (8 & this.gpflags && (n[0] = this.readByte(), + n[1] = this.readByte(), + n[2] = this.readByte(), + n[3] = this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte()), + this.modeZIP && this.nextFile(), + n[0] = this.readByte(), + 8 !== n[0]) + return 0; + if (this.gpflags = this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + 4 & this.gpflags) + for (n[0] = this.readByte(), + n[2] = this.readByte(), + this.len = n[0] + 256 * n[1], + t = 0; t < this.len; t++) + this.readByte(); + if (8 & this.gpflags) + for (t = 0, + this.nameBuf = []; e = this.readByte(); ) + "7" !== e && ":" !== e || (t = 0), + t < i.NAMEMAX - 1 && (this.nameBuf[t++] = e); + if (16 & this.gpflags) + for (; e = this.readByte(); ) + ; + 2 & this.gpflags && (this.readByte(), + this.readByte()), + this.DeflateLoop(), + this.readByte(), + this.readByte(), + this.readByte(), + this.readByte(), + this.modeZIP && this.nextFile() + } + , + e.exports = i + } + ), {}], + 25: [(function(t, e) { + "use strict"; + (function() { + function t(t) { + throw t + } + var e = void 0 + , i = !0 + , n = this; + function r(t, i) { + var r, s = t.split("."), a = n; + !(s[0]in a) && a.execScript && a.execScript("var " + s[0]); + for (; s.length && (r = s.shift()); ) + s.length || i === e ? a = a[r] ? a[r] : a[r] = {} : a[r] = i + } + var s = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array; + function a(t) { + if ("string" == typeof t) { + var e, i, n = t.split(""); + for (e = 0, + i = n.length; e < i; e++) + n[e] = (255 & n[e].charCodeAt(0)) >>> 0; + t = n + } + for (var r, s = 1, a = 0, o = t.length, l = 0; 0 < o; ) { + o -= r = 1024 < o ? 1024 : o; + do { + a += s += t[l++] + } while (--r);s %= 65521, + a %= 65521 + } + return (a << 16 | s) >>> 0 + } + function o(e, i) { + this.index = "number" == typeof i ? i : 0, + this.i = 0, + this.buffer = e instanceof (s ? Uint8Array : Array) ? e : new (s ? Uint8Array : Array)(32768), + 2 * this.buffer.length <= this.index && t(Error("invalid index")), + this.buffer.length <= this.index && this.f() + } + o.prototype.f = function() { + var t, e = this.buffer, i = e.length, n = new (s ? Uint8Array : Array)(i << 1); + if (s) + n.set(e); + else + for (t = 0; t < i; ++t) + n[t] = e[t]; + return this.buffer = n + } + , + o.prototype.d = function(t, e, i) { + var n, r = this.buffer, s = this.index, a = this.i, o = r[s]; + if (i && 1 < e && (t = 8 < e ? (f[255 & t] << 24 | f[t >>> 8 & 255] << 16 | f[t >>> 16 & 255] << 8 | f[t >>> 24 & 255]) >> 32 - e : f[t] >> 8 - e), + 8 > e + a) + o = o << e | t, + a += e; + else + for (n = 0; n < e; ++n) + o = o << 1 | t >> e - n - 1 & 1, + 8 == ++a && (a = 0, + r[s++] = f[o], + o = 0, + s === r.length && (r = this.f())); + r[s] = o, + this.buffer = r, + this.i = a, + this.index = s + } + , + o.prototype.finish = function() { + var t, e = this.buffer, i = this.index; + return 0 < this.i && (e[i] <<= 8 - this.i, + e[i] = f[e[i]], + i++), + s ? t = e.subarray(0, i) : (e.length = i, + t = e), + t + } + ; + var l, h = new (s ? Uint8Array : Array)(256); + for (l = 0; 256 > l; ++l) { + for (var c = _ = l, u = 7, _ = _ >>> 1; _; _ >>>= 1) + c <<= 1, + c |= 1 & _, + --u; + h[l] = (c << u & 255) >>> 0 + } + var f = h; + function d(t) { + this.buffer = new (s ? Uint16Array : Array)(2 * t), + this.length = 0 + } + function p(t) { + var e, i, n, r, a, o, l, h, c, u = t.length, _ = 0, f = Number.POSITIVE_INFINITY; + for (h = 0; h < u; ++h) + t[h] > _ && (_ = t[h]), + t[h] < f && (f = t[h]); + for (e = 1 << _, + i = new (s ? Uint32Array : Array)(e), + n = 1, + r = 0, + a = 2; n <= _; ) { + for (h = 0; h < u; ++h) + if (t[h] === n) { + for (o = 0, + l = r, + c = 0; c < n; ++c) + o = o << 1 | 1 & l, + l >>= 1; + for (c = o; c < e; c += a) + i[c] = n << 16 | h; + ++r + } + ++n, + r <<= 1, + a <<= 1 + } + return [i, _, f] + } + function m(t, e) { + this.h = v, + this.w = 0, + this.input = t, + this.b = 0, + e && (e.lazy && (this.w = e.lazy), + "number" == typeof e.compressionType && (this.h = e.compressionType), + e.outputBuffer && (this.a = s && e.outputBuffer instanceof Array ? new Uint8Array(e.outputBuffer) : e.outputBuffer), + "number" == typeof e.outputIndex && (this.b = e.outputIndex)), + this.a || (this.a = new (s ? Uint8Array : Array)(32768)) + } + s && new Uint32Array([0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117]), + d.prototype.getParent = function(t) { + return 2 * ((t - 2) / 4 | 0) + } + , + d.prototype.push = function(t, e) { + var i, n, r, s = this.buffer; + for (i = this.length, + s[this.length++] = e, + s[this.length++] = t; 0 < i && (n = this.getParent(i), + s[i] > s[n]); ) + r = s[i], + s[i] = s[n], + s[n] = r, + r = s[i + 1], + s[i + 1] = s[n + 1], + s[n + 1] = r, + i = n; + return this.length + } + , + d.prototype.pop = function() { + var t, e, i, n, r, s = this.buffer; + for (e = s[0], + t = s[1], + this.length -= 2, + s[0] = s[this.length], + s[1] = s[this.length + 1], + r = 0; !((n = 2 * r + 2) >= this.length) && (n + 2 < this.length && s[n + 2] > s[n] && (n += 2), + s[n] > s[r]); ) + i = s[r], + s[r] = s[n], + s[n] = i, + i = s[r + 1], + s[r + 1] = s[n + 1], + s[n + 1] = i, + r = n; + return { + index: t, + value: e, + length: this.length + } + } + ; + var y, v = 2, g = { + NONE: 0, + r: 1, + j: v, + N: 3 + }, A = []; + for (y = 0; 288 > y; y++) + switch (i) { + case 143 >= y: + A.push([y + 48, 8]); + break; + case 255 >= y: + A.push([y - 144 + 400, 9]); + break; + case 279 >= y: + A.push([y - 256 + 0, 7]); + break; + case 287 >= y: + A.push([y - 280 + 192, 8]); + break; + default: + t("invalid literal: " + y) + } + function x(t, e) { + this.length = t, + this.G = e + } + function b() { + var e = C; + switch (i) { + case 3 === e: + return [257, e - 3, 0]; + case 4 === e: + return [258, e - 4, 0]; + case 5 === e: + return [259, e - 5, 0]; + case 6 === e: + return [260, e - 6, 0]; + case 7 === e: + return [261, e - 7, 0]; + case 8 === e: + return [262, e - 8, 0]; + case 9 === e: + return [263, e - 9, 0]; + case 10 === e: + return [264, e - 10, 0]; + case 12 >= e: + return [265, e - 11, 1]; + case 14 >= e: + return [266, e - 13, 1]; + case 16 >= e: + return [267, e - 15, 1]; + case 18 >= e: + return [268, e - 17, 1]; + case 22 >= e: + return [269, e - 19, 2]; + case 26 >= e: + return [270, e - 23, 2]; + case 30 >= e: + return [271, e - 27, 2]; + case 34 >= e: + return [272, e - 31, 2]; + case 42 >= e: + return [273, e - 35, 3]; + case 50 >= e: + return [274, e - 43, 3]; + case 58 >= e: + return [275, e - 51, 3]; + case 66 >= e: + return [276, e - 59, 3]; + case 82 >= e: + return [277, e - 67, 4]; + case 98 >= e: + return [278, e - 83, 4]; + case 114 >= e: + return [279, e - 99, 4]; + case 130 >= e: + return [280, e - 115, 4]; + case 162 >= e: + return [281, e - 131, 5]; + case 194 >= e: + return [282, e - 163, 5]; + case 226 >= e: + return [283, e - 195, 5]; + case 257 >= e: + return [284, e - 227, 5]; + case 258 === e: + return [285, e - 258, 0]; + default: + t("invalid length: " + e) + } + } + m.prototype.n = function() { + var n, r, a, l, h = this.input; + switch (this.h) { + case 0: + for (a = 0, + l = h.length; a < l; ) { + var c, u, _, f = r = s ? h.subarray(a, a + 65535) : h.slice(a, a + 65535), d = (a += r.length) === l, p = e, m = e, y = this.a, g = this.b; + if (s) { + for (y = new Uint8Array(this.a.buffer); y.length <= g + f.length + 5; ) + y = new Uint8Array(y.length << 1); + y.set(this.a) + } + if (c = d ? 1 : 0, + y[g++] = 0 | c, + _ = 65536 + ~(u = f.length) & 65535, + y[g++] = 255 & u, + y[g++] = u >>> 8 & 255, + y[g++] = 255 & _, + y[g++] = _ >>> 8 & 255, + s) + y.set(f, g), + g += f.length, + y = y.subarray(0, g); + else { + for (p = 0, + m = f.length; p < m; ++p) + y[g++] = f[p]; + y.length = g + } + this.b = g, + this.a = y + } + break; + case 1: + var x = new o(new Uint8Array(this.a.buffer),this.b); + x.d(1, 1, i), + x.d(1, 2, i); + var b, C, T, S = E(this, h); + for (b = 0, + C = S.length; b < C; b++) + if (T = S[b], + o.prototype.d.apply(x, A[T]), + 256 < T) + x.d(S[++b], S[++b], i), + x.d(S[++b], 5), + x.d(S[++b], S[++b], i); + else if (256 === T) + break; + this.a = x.finish(), + this.b = this.a.length; + break; + case v: + var w, B, I, P, R, O, L, F, V, N, k, G, U, z, H, W = new o(new Uint8Array(this.a),this.b), j = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], X = Array(19); + for (w = v, + W.d(1, 1, i), + W.d(w, 2, i), + B = E(this, h), + L = D(O = M(this.L, 15)), + V = D(F = M(this.K, 7)), + I = 286; 257 < I && 0 === O[I - 1]; I--) + ; + for (P = 30; 1 < P && 0 === F[P - 1]; P--) + ; + var Y, q, J, Z, K, Q, $ = I, tt = P, et = new (s ? Uint32Array : Array)($ + tt), it = new (s ? Uint32Array : Array)(316), nt = new (s ? Uint8Array : Array)(19); + for (Y = q = 0; Y < $; Y++) + et[q++] = O[Y]; + for (Y = 0; Y < tt; Y++) + et[q++] = F[Y]; + if (!s) + for (Y = 0, + Z = nt.length; Y < Z; ++Y) + nt[Y] = 0; + for (Y = K = 0, + Z = et.length; Y < Z; Y += q) { + for (q = 1; Y + q < Z && et[Y + q] === et[Y]; ++q) + ; + if (J = q, + 0 === et[Y]) + if (3 > J) + for (; 0 < J--; ) + it[K++] = 0, + nt[0]++; + else + for (; 0 < J; ) + (Q = 138 > J ? J : 138) > J - 3 && Q < J && (Q = J - 3), + 10 >= Q ? (it[K++] = 17, + it[K++] = Q - 3, + nt[17]++) : (it[K++] = 18, + it[K++] = Q - 11, + nt[18]++), + J -= Q; + else if (it[K++] = et[Y], + nt[et[Y]]++, + 3 > --J) + for (; 0 < J--; ) + it[K++] = et[Y], + nt[et[Y]]++; + else + for (; 0 < J; ) + (Q = 6 > J ? J : 6) > J - 3 && Q < J && (Q = J - 3), + it[K++] = 16, + it[K++] = Q - 3, + nt[16]++, + J -= Q + } + for (n = s ? it.subarray(0, K) : it.slice(0, K), + N = M(nt, 7), + z = 0; 19 > z; z++) + X[z] = N[j[z]]; + for (R = 19; 4 < R && 0 === X[R - 1]; R--) + ; + for (k = D(N), + W.d(I - 257, 5, i), + W.d(P - 1, 5, i), + W.d(R - 4, 4, i), + z = 0; z < R; z++) + W.d(X[z], 3, i); + for (z = 0, + H = n.length; z < H; z++) + if (G = n[z], + W.d(k[G], N[G], i), + 16 <= G) { + switch (z++, + G) { + case 16: + U = 2; + break; + case 17: + U = 3; + break; + case 18: + U = 7; + break; + default: + t("invalid code: " + G) + } + W.d(n[z], U, i) + } + var rt, st, at, ot, lt, ht, ct, ut, _t = [L, O], ft = [V, F]; + for (lt = _t[0], + ht = _t[1], + ct = ft[0], + ut = ft[1], + rt = 0, + st = B.length; rt < st; ++rt) + if (at = B[rt], + W.d(lt[at], ht[at], i), + 256 < at) + W.d(B[++rt], B[++rt], i), + ot = B[++rt], + W.d(ct[ot], ut[ot], i), + W.d(B[++rt], B[++rt], i); + else if (256 === at) + break; + this.a = W.finish(), + this.b = this.a.length; + break; + default: + t("invalid compression type") + } + return this.a + } + ; + var C, T, S = []; + for (C = 3; 258 >= C; C++) + T = b(), + S[C] = T[2] << 24 | T[1] << 16 | T[0]; + var w = s ? new Uint32Array(S) : S; + function E(n, r) { + function a(e, n) { + var r, s, a, o, l = e.G, h = [], c = 0; + switch (r = w[e.length], + h[c++] = 65535 & r, + h[c++] = r >> 16 & 255, + h[c++] = r >> 24, + i) { + case 1 === l: + s = [0, l - 1, 0]; + break; + case 2 === l: + s = [1, l - 2, 0]; + break; + case 3 === l: + s = [2, l - 3, 0]; + break; + case 4 === l: + s = [3, l - 4, 0]; + break; + case 6 >= l: + s = [4, l - 5, 1]; + break; + case 8 >= l: + s = [5, l - 7, 1]; + break; + case 12 >= l: + s = [6, l - 9, 2]; + break; + case 16 >= l: + s = [7, l - 13, 2]; + break; + case 24 >= l: + s = [8, l - 17, 3]; + break; + case 32 >= l: + s = [9, l - 25, 3]; + break; + case 48 >= l: + s = [10, l - 33, 4]; + break; + case 64 >= l: + s = [11, l - 49, 4]; + break; + case 96 >= l: + s = [12, l - 65, 5]; + break; + case 128 >= l: + s = [13, l - 97, 5]; + break; + case 192 >= l: + s = [14, l - 129, 6]; + break; + case 256 >= l: + s = [15, l - 193, 6]; + break; + case 384 >= l: + s = [16, l - 257, 7]; + break; + case 512 >= l: + s = [17, l - 385, 7]; + break; + case 768 >= l: + s = [18, l - 513, 8]; + break; + case 1024 >= l: + s = [19, l - 769, 8]; + break; + case 1536 >= l: + s = [20, l - 1025, 9]; + break; + case 2048 >= l: + s = [21, l - 1537, 9]; + break; + case 3072 >= l: + s = [22, l - 2049, 10]; + break; + case 4096 >= l: + s = [23, l - 3073, 10]; + break; + case 6144 >= l: + s = [24, l - 4097, 11]; + break; + case 8192 >= l: + s = [25, l - 6145, 11]; + break; + case 12288 >= l: + s = [26, l - 8193, 12]; + break; + case 16384 >= l: + s = [27, l - 12289, 12]; + break; + case 24576 >= l: + s = [28, l - 16385, 13]; + break; + case 32768 >= l: + s = [29, l - 24577, 13]; + break; + default: + t("invalid distance") + } + for (r = s, + h[c++] = r[0], + h[c++] = r[1], + h[c++] = r[2], + a = 0, + o = h.length; a < o; ++a) + y[v++] = h[a]; + A[h[0]]++, + b[h[3]]++, + g = e.length + n - 1, + d = null + } + var o, l, h, c, u, _, f, d, p, m = {}, y = s ? new Uint16Array(2 * r.length) : [], v = 0, g = 0, A = new (s ? Uint32Array : Array)(286), b = new (s ? Uint32Array : Array)(30), C = n.w; + if (!s) { + for (h = 0; 285 >= h; ) + A[h++] = 0; + for (h = 0; 29 >= h; ) + b[h++] = 0 + } + for (A[256] = 1, + o = 0, + l = r.length; o < l; ++o) { + for (h = u = 0, + c = 3; h < c && o + h !== l; ++h) + u = u << 8 | r[o + h]; + if (m[u] === e && (m[u] = []), + _ = m[u], + !(0 < g--)) { + for (; 0 < _.length && 32768 < o - _[0]; ) + _.shift(); + if (o + 3 >= l) { + for (d && a(d, -1), + h = 0, + c = l - o; h < c; ++h) + p = r[o + h], + y[v++] = p, + ++A[p]; + break + } + if (0 < _.length) { + var T = e + , S = e + , E = 0 + , M = e + , D = e + , B = e + , I = r.length + , P = (D = 0, + _.length); + t: for (; D < P; D++) { + if (T = _[P - D - 1], + M = 3, + 3 < E) { + for (B = E; 3 < B; B--) + if (r[T + B - 1] !== r[o + B - 1]) + continue t; + M = E + } + for (; 258 > M && o + M < I && r[T + M] === r[o + M]; ) + ++M; + if (M > E && (S = T, + E = M), + 258 === M) + break + } + f = new x(E,o - S), + d ? d.length < f.length ? (p = r[o - 1], + y[v++] = p, + ++A[p], + a(f, 0)) : a(d, -1) : f.length < C ? d = f : a(f, 0) + } else + d ? a(d, -1) : (p = r[o], + y[v++] = p, + ++A[p]) + } + _.push(o) + } + return y[v++] = 256, + A[256]++, + n.L = A, + n.K = b, + s ? y.subarray(0, v) : y + } + function M(t, e) { + function i(t) { + var e = C[t][T[t]]; + e === v ? (i(t + 1), + i(t + 1)) : --x[e], + ++T[t] + } + var n, r, a, o, l, h = t.length, c = new d(572), u = new (s ? Uint8Array : Array)(h); + if (!s) + for (o = 0; o < h; o++) + u[o] = 0; + for (o = 0; o < h; ++o) + 0 < t[o] && c.push(o, t[o]); + if (n = Array(c.length / 2), + r = new (s ? Uint32Array : Array)(c.length / 2), + 1 === n.length) + return u[c.pop().index] = 1, + u; + for (o = 0, + l = c.length / 2; o < l; ++o) + n[o] = c.pop(), + r[o] = n[o].value; + var _, f, p, m, y, v = r.length, g = new (s ? Uint16Array : Array)(e), A = new (s ? Uint8Array : Array)(e), x = new (s ? Uint8Array : Array)(v), b = Array(e), C = Array(e), T = Array(e), S = (1 << e) - v, w = 1 << e - 1; + for (g[e - 1] = v, + f = 0; f < e; ++f) + S < w ? A[f] = 0 : (A[f] = 1, + S -= w), + S <<= 1, + g[e - 2 - f] = (g[e - 1 - f] / 2 | 0) + v; + for (g[0] = A[0], + b[0] = Array(g[0]), + C[0] = Array(g[0]), + f = 1; f < e; ++f) + g[f] > 2 * g[f - 1] + A[f] && (g[f] = 2 * g[f - 1] + A[f]), + b[f] = Array(g[f]), + C[f] = Array(g[f]); + for (_ = 0; _ < v; ++_) + x[_] = e; + for (p = 0; p < g[e - 1]; ++p) + b[e - 1][p] = r[p], + C[e - 1][p] = p; + for (_ = 0; _ < e; ++_) + T[_] = 0; + for (1 === A[e - 1] && (--x[0], + ++T[e - 1]), + f = e - 2; 0 <= f; --f) { + for (m = _ = 0, + y = T[f + 1], + p = 0; p < g[f]; p++) + (m = b[f + 1][y] + b[f + 1][y + 1]) > r[_] ? (b[f][p] = m, + C[f][p] = v, + y += 2) : (b[f][p] = r[_], + C[f][p] = _, + ++_); + T[f] = 0, + 1 === A[f] && i(f) + } + for (a = x, + o = 0, + l = n.length; o < l; ++o) + u[n[o].index] = a[o]; + return u + } + function D(e) { + var i, n, r, a, o = new (s ? Uint16Array : Array)(e.length), l = [], h = [], c = 0; + for (i = 0, + n = e.length; i < n; i++) + l[e[i]] = 1 + (0 | l[e[i]]); + for (i = 1, + n = 16; i <= n; i++) + h[i] = c, + (c += 0 | l[i]) > 1 << i && t("overcommitted"), + c <<= 1; + for (65536 > c && t("undercommitted"), + i = 0, + n = e.length; i < n; i++) + for (c = h[e[i]], + h[e[i]] += 1, + r = o[i] = 0, + a = e[i]; r < a; r++) + o[i] = o[i] << 1 | 1 & c, + c >>>= 1; + return o + } + function B(t, e) { + this.input = t, + this.a = new (s ? Uint8Array : Array)(32768), + this.h = I.j; + var i, n = {}; + for (i in !e && (e = {}) || "number" != typeof e.compressionType || (this.h = e.compressionType), + e) + n[i] = e[i]; + n.outputBuffer = this.a, + this.z = new m(this.input,n) + } + var I = g; + function P(e, i) { + switch (this.k = [], + this.l = 32768, + this.e = this.g = this.c = this.q = 0, + this.input = s ? new Uint8Array(e) : e, + this.s = !1, + this.m = O, + this.B = !1, + !i && (i = {}) || (i.index && (this.c = i.index), + i.bufferSize && (this.l = i.bufferSize), + i.bufferType && (this.m = i.bufferType), + i.resize && (this.B = i.resize)), + this.m) { + case R: + this.b = 32768, + this.a = new (s ? Uint8Array : Array)(32768 + this.l + 258); + break; + case O: + this.b = 0, + this.a = new (s ? Uint8Array : Array)(this.l), + this.f = this.J, + this.t = this.H, + this.o = this.I; + break; + default: + t(Error("invalid inflate mode")) + } + } + B.prototype.n = function() { + var e, i, n, r, o, l, h, c = 0; + switch (h = this.a, + e = ct) { + case ct: + i = Math.LOG2E * Math.log(32768) - 8; + break; + default: + t(Error("invalid compression method")) + } + switch (n = i << 4 | e, + h[c++] = n, + e) { + case ct: + switch (this.h) { + case I.NONE: + o = 0; + break; + case I.r: + o = 1; + break; + case I.j: + o = 2; + break; + default: + t(Error("unsupported compression type")) + } + break; + default: + t(Error("invalid compression method")) + } + return r = o << 6 | 0, + h[c++] = r | 31 - (256 * n + r) % 31, + l = a(this.input), + this.z.b = c, + c = (h = this.z.n()).length, + s && ((h = new Uint8Array(h.buffer)).length <= c + 4 && (this.a = new Uint8Array(h.length + 4), + this.a.set(h), + h = this.a), + h = h.subarray(0, c + 4)), + h[c++] = l >> 24 & 255, + h[c++] = l >> 16 & 255, + h[c++] = l >> 8 & 255, + h[c++] = 255 & l, + h + } + , + r("Zlib.Deflate", B), + r("Zlib.Deflate.compress", (function(t, e) { + return new B(t,e).n() + } + )), + r("Zlib.Deflate.CompressionType", I), + r("Zlib.Deflate.CompressionType.NONE", I.NONE), + r("Zlib.Deflate.CompressionType.FIXED", I.r), + r("Zlib.Deflate.CompressionType.DYNAMIC", I.j); + var R = 0 + , O = 1 + , L = { + D: R, + C: O + }; + P.prototype.p = function() { + for (; !this.s; ) { + var n = tt(this, 3); + switch (1 & n && (this.s = i), + n >>>= 1) { + case 0: + var r = this.input + , a = this.c + , o = this.a + , l = this.b + , h = e + , c = e + , u = e + , _ = o.length + , f = e; + switch (this.e = this.g = 0, + (h = r[a++]) === e && t(Error("invalid uncompressed block header: LEN (first byte)")), + c = h, + (h = r[a++]) === e && t(Error("invalid uncompressed block header: LEN (second byte)")), + c |= h << 8, + (h = r[a++]) === e && t(Error("invalid uncompressed block header: NLEN (first byte)")), + u = h, + (h = r[a++]) === e && t(Error("invalid uncompressed block header: NLEN (second byte)")), + c === ~(u |= h << 8) && t(Error("invalid uncompressed block header: length verify")), + a + c > r.length && t(Error("input buffer is broken")), + this.m) { + case R: + for (; l + c > o.length; ) { + if (c -= f = _ - l, + s) + o.set(r.subarray(a, a + f), l), + l += f, + a += f; + else + for (; f--; ) + o[l++] = r[a++]; + this.b = l, + o = this.f(), + l = this.b + } + break; + case O: + for (; l + c > o.length; ) + o = this.f({ + v: 2 + }); + break; + default: + t(Error("invalid inflate mode")) + } + if (s) + o.set(r.subarray(a, a + c), l), + l += c, + a += c; + else + for (; c--; ) + o[l++] = r[a++]; + this.c = a, + this.b = l, + this.a = o; + break; + case 1: + this.o(K, $); + break; + case 2: + it(this); + break; + default: + t(Error("unknown BTYPE: " + n)) + } + } + return this.t() + } + ; + var F, V, N = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], k = s ? new Uint16Array(N) : N, G = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258], U = s ? new Uint16Array(G) : G, z = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0], H = s ? new Uint8Array(z) : z, W = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], j = s ? new Uint16Array(W) : W, X = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], Y = s ? new Uint8Array(X) : X, q = new (s ? Uint8Array : Array)(288); + for (F = 0, + V = q.length; F < V; ++F) + q[F] = 143 >= F ? 8 : 255 >= F ? 9 : 279 >= F ? 7 : 8; + var J, Z, K = p(q), Q = new (s ? Uint8Array : Array)(30); + for (J = 0, + Z = Q.length; J < Z; ++J) + Q[J] = 5; + var $ = p(Q); + function tt(i, n) { + for (var r, s = i.g, a = i.e, o = i.input, l = i.c; a < n; ) + (r = o[l++]) === e && t(Error("input buffer is broken")), + s |= r << a, + a += 8; + return r = s & (1 << n) - 1, + i.g = s >>> n, + i.e = a - n, + i.c = l, + r + } + function et(i, n) { + for (var r, s, a, o = i.g, l = i.e, h = i.input, c = i.c, u = n[0], _ = n[1]; l < _; ) + (r = h[c++]) === e && t(Error("input buffer is broken")), + o |= r << l, + l += 8; + return a = (s = u[o & (1 << _) - 1]) >>> 16, + i.g = o >> a, + i.e = l - a, + i.c = c, + 65535 & s + } + function it(t) { + function e(t, e, i) { + var n, r, s, a; + for (a = 0; a < t; ) + switch (n = et(this, e)) { + case 16: + for (s = 3 + tt(this, 2); s--; ) + i[a++] = r; + break; + case 17: + for (s = 3 + tt(this, 3); s--; ) + i[a++] = 0; + r = 0; + break; + case 18: + for (s = 11 + tt(this, 7); s--; ) + i[a++] = 0; + r = 0; + break; + default: + r = i[a++] = n + } + return i + } + var i, n, r, a, o = tt(t, 5) + 257, l = tt(t, 5) + 1, h = tt(t, 4) + 4, c = new (s ? Uint8Array : Array)(k.length); + for (a = 0; a < h; ++a) + c[k[a]] = tt(t, 3); + i = p(c), + n = new (s ? Uint8Array : Array)(o), + r = new (s ? Uint8Array : Array)(l), + t.o(p(e.call(t, o, i, n)), p(e.call(t, l, i, r))) + } + function nt(e, i) { + var n, r; + switch (this.input = e, + this.c = 0, + !i && (i = {}) || (i.index && (this.c = i.index), + i.verify && (this.M = i.verify)), + n = e[this.c++], + r = e[this.c++], + 15 & n) { + case ct: + this.method = ct; + break; + default: + t(Error("unsupported compression method")) + } + 0 != ((n << 8) + r) % 31 && t(Error("invalid fcheck flag:" + ((n << 8) + r) % 31)), + 32 & r && t(Error("fdict flag is not supported")), + this.A = new P(e,{ + index: this.c, + bufferSize: i.bufferSize, + bufferType: i.bufferType, + resize: i.resize + }) + } + P.prototype.o = function(t, e) { + var i = this.a + , n = this.b; + this.u = t; + for (var r, s, a, o, l = i.length - 258; 256 !== (r = et(this, t)); ) + if (256 > r) + n >= l && (this.b = n, + i = this.f(), + n = this.b), + i[n++] = r; + else + for (o = U[s = r - 257], + 0 < H[s] && (o += tt(this, H[s])), + r = et(this, e), + a = j[r], + 0 < Y[r] && (a += tt(this, Y[r])), + n >= l && (this.b = n, + i = this.f(), + n = this.b); o--; ) + i[n] = i[n++ - a]; + for (; 8 <= this.e; ) + this.e -= 8, + this.c--; + this.b = n + } + , + P.prototype.I = function(t, e) { + var i = this.a + , n = this.b; + this.u = t; + for (var r, s, a, o, l = i.length; 256 !== (r = et(this, t)); ) + if (256 > r) + n >= l && (l = (i = this.f()).length), + i[n++] = r; + else + for (o = U[s = r - 257], + 0 < H[s] && (o += tt(this, H[s])), + r = et(this, e), + a = j[r], + 0 < Y[r] && (a += tt(this, Y[r])), + n + o > l && (l = (i = this.f()).length); o--; ) + i[n] = i[n++ - a]; + for (; 8 <= this.e; ) + this.e -= 8, + this.c--; + this.b = n + } + , + P.prototype.f = function() { + var t, e, i = new (s ? Uint8Array : Array)(this.b - 32768), n = this.b - 32768, r = this.a; + if (s) + i.set(r.subarray(32768, i.length)); + else + for (t = 0, + e = i.length; t < e; ++t) + i[t] = r[t + 32768]; + if (this.k.push(i), + this.q += i.length, + s) + r.set(r.subarray(n, n + 32768)); + else + for (t = 0; 32768 > t; ++t) + r[t] = r[n + t]; + return this.b = 32768, + r + } + , + P.prototype.J = function(t) { + var e, i, n, r = this.input.length / this.c + 1 | 0, a = this.input, o = this.a; + return t && ("number" == typeof t.v && (r = t.v), + "number" == typeof t.F && (r += t.F)), + i = 2 > r ? (n = (a.length - this.c) / this.u[2] / 2 * 258 | 0) < o.length ? o.length + n : o.length << 1 : o.length * r, + s ? (e = new Uint8Array(i)).set(o) : e = o, + this.a = e + } + , + P.prototype.t = function() { + var t, e, i, n, r, a = 0, o = this.a, l = this.k, h = new (s ? Uint8Array : Array)(this.q + (this.b - 32768)); + if (0 === l.length) + return s ? this.a.subarray(32768, this.b) : this.a.slice(32768, this.b); + for (e = 0, + i = l.length; e < i; ++e) + for (n = 0, + r = (t = l[e]).length; n < r; ++n) + h[a++] = t[n]; + for (e = 32768, + i = this.b; e < i; ++e) + h[a++] = o[e]; + return this.k = [], + this.buffer = h + } + , + P.prototype.H = function() { + var t, e = this.b; + return s ? this.B ? (t = new Uint8Array(e)).set(this.a.subarray(0, e)) : t = this.a.subarray(0, e) : (this.a.length > e && (this.a.length = e), + t = this.a), + this.buffer = t + } + , + nt.prototype.p = function() { + var e, i = this.input; + return e = this.A.p(), + this.c = this.A.c, + this.M && (i[this.c++] << 24 | i[this.c++] << 16 | i[this.c++] << 8 | i[this.c++]) >>> 0 !== a(e) && t(Error("invalid adler-32 checksum")), + e + } + , + r("Zlib.Inflate", nt), + r("Zlib.Inflate.BufferType", L), + L.ADAPTIVE = L.C, + L.BLOCK = L.D, + r("Zlib.Inflate.prototype.decompress", nt.prototype.p), + s && new Uint16Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), + s && new Uint16Array([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258]), + s && new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0]), + s && new Uint16Array([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577]), + s && new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]); + var rt, st, at = new (s ? Uint8Array : Array)(288); + for (rt = 0, + st = at.length; rt < st; ++rt) + at[rt] = 143 >= rt ? 8 : 255 >= rt ? 9 : 279 >= rt ? 7 : 8; + p(at); + var ot, lt, ht = new (s ? Uint8Array : Array)(30); + for (ot = 0, + lt = ht.length; ot < lt; ++ot) + ht[ot] = 5; + p(ht); + var ct = 8 + } + ).call(window); + var i = window.Zlib; + i.Deflate = i.Deflate, + i.Deflate.compress = i.Deflate.compress, + i.Inflate = i.Inflate, + i.Inflate.BufferType = i.Inflate.BufferType, + i.Inflate.prototype.decompress = i.Inflate.prototype.decompress, + e.exports = i + } + ), {}], + 26: [(function(t, e) { + "use strict"; + var i, n = t("./platform/utils"), r = (t("../../DebugInfos"), + "https://github.com/cocos-creator/engine/blob/master/EngineErrorMap.md"); + function s(t) { + return function() { + var e = arguments[0] + , i = t + " " + e + ", please go to " + r + "#" + e + " to see details."; + if (1 === arguments.length) + return i; + if (2 === arguments.length) + return i + " Arguments: " + arguments[1]; + var n = cc.js.shiftArguments.apply(null, arguments); + return i + " Arguments: " + n.join(", ") + } + } + cc.log = cc.warn = cc.error = cc.assert = console.log.bind ? console.log.bind(console) : console.log, + cc._throw = function(t) { + n.callInNextTick((function() { + throw t + } + )) + } + ; + var a = s("Log"); + cc.logID = function() { + cc.log(a.apply(null, arguments)) + } + ; + var o = s("Warning"); + cc.warnID = function() { + cc.warn(o.apply(null, arguments)) + } + ; + var l = s("Error"); + cc.errorID = function() { + cc.error(l.apply(null, arguments)) + } + ; + var h = s("Assert"); + cc.assertID = function(t) { + t || cc.assert(!1, h.apply(null, cc.js.shiftArguments.apply(null, arguments))) + } + ; + var c = cc.Enum({ + NONE: 0, + INFO: 1, + WARN: 2, + ERROR: 3, + INFO_FOR_WEB_PAGE: 4, + WARN_FOR_WEB_PAGE: 5, + ERROR_FOR_WEB_PAGE: 6 + }); + e.exports = cc.debug = { + DebugMode: c, + _resetDebugSetting: function(t) { + if (cc.log = cc.warn = cc.error = cc.assert = function() {} + , + t !== c.NONE) { + if (t > c.ERROR) { + var e = function(t) { + if (cc.game.canvas) { + if (!i) { + var e = document.createElement("Div"); + e.setAttribute("id", "logInfoDiv"), + e.setAttribute("width", "200"), + e.setAttribute("height", cc.game.canvas.height); + var n = e.style; + n.zIndex = "99999", + n.position = "absolute", + n.top = n.left = "0", + (i = document.createElement("textarea")).setAttribute("rows", "20"), + i.setAttribute("cols", "30"), + i.setAttribute("disabled", "true"); + var r = i.style; + r.backgroundColor = "transparent", + r.borderBottom = "1px solid #cccccc", + r.borderTopWidth = r.borderLeftWidth = r.borderRightWidth = "0px", + r.borderTopStyle = r.borderLeftStyle = r.borderRightStyle = "none", + r.padding = "0px", + r.margin = 0, + e.appendChild(i), + cc.game.canvas.parentNode.appendChild(e) + } + i.value = i.value + t + "\r\n", + i.scrollTop = i.scrollHeight + } + }; + cc.error = function() { + e("ERROR : " + cc.js.formatStr.apply(null, arguments)) + } + , + cc.assert = function(t, i) { + !t && i && (i = cc.js.formatStr.apply(null, cc.js.shiftArguments.apply(null, arguments)), + e("ASSERT: " + i)) + } + , + t !== c.ERROR_FOR_WEB_PAGE && (cc.warn = function() { + e("WARN : " + cc.js.formatStr.apply(null, arguments)) + } + ), + t === c.INFO_FOR_WEB_PAGE && (cc.log = function() { + e(cc.js.formatStr.apply(null, arguments)) + } + ) + } else + console && console.log.apply && (console.error || (console.error = console.log), + console.warn || (console.warn = console.log), + console.error.bind ? cc.error = console.error.bind(console) : cc.error = function() { + return console.error.apply(console, arguments) + } + , + cc.assert = function(t, e) { + if (!t) + throw e && (e = cc.js.formatStr.apply(null, cc.js.shiftArguments.apply(null, arguments))), + new Error(e) + } + ); + t !== c.ERROR && (console.warn.bind ? cc.warn = console.warn.bind(console) : cc.warn = function() { + return console.warn.apply(console, arguments) + } + ), + t === c.INFO && (console.log.bind ? cc.log = console.log.bind(console) : cc.log = function() { + return console.log.apply(console, arguments) + } + ) + } + }, + getError: s("ERROR"), + isDisplayStats: function() { + return !!cc.profiler && cc.profiler.isShowingStats() + }, + setDisplayStats: function(t) { + cc.profiler && cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS && (t ? cc.profiler.showStats() : cc.profiler.hideStats(), + cc.game.config.showFPS = !!t) + } + } + } + ), { + "../../DebugInfos": void 0, + "./platform/utils": 217 + }], + 27: [(function(t, e) { + "use strict"; + var i = t("./event/event-target") + , n = t("./component-scheduler") + , r = t("./node-activator") + , s = t("./platform/CCObject") + , a = t("./CCGame") + , o = t("./renderer") + , l = t("./event-manager") + , h = t("./CCScheduler"); + cc.Director = function() { + i.call(this), + this._paused = !1, + this._purgeDirectorInNextLoop = !1, + this._winSizeInPoints = null, + this._scene = null, + this._loadingScene = "", + this._totalFrames = 0, + this._lastUpdate = 0, + this._deltaTime = 0, + this._startTime = 0, + this._maxParticleDeltaTime = 0, + this._scheduler = null, + this._compScheduler = null, + this._nodeActivator = null, + this._actionManager = null; + var t = this; + a.on(a.EVENT_SHOW, (function() { + t._lastUpdate = performance.now() + } + )), + a.once(a.EVENT_ENGINE_INITED, this.init, this) + } + , + cc.Director.prototype = { + constructor: cc.Director, + init: function() { + return this._totalFrames = 0, + this._lastUpdate = performance.now(), + this._startTime = this._lastUpdate, + this._paused = !1, + this._purgeDirectorInNextLoop = !1, + this._winSizeInPoints = cc.size(0, 0), + this._scheduler = new h, + cc.ActionManager ? (this._actionManager = new cc.ActionManager, + this._scheduler.scheduleUpdate(this._actionManager, h.PRIORITY_SYSTEM, !1)) : this._actionManager = null, + this.sharedInit(), + !0 + }, + sharedInit: function() { + this._compScheduler = new n, + this._nodeActivator = new r, + l && l.setEnabled(!0), + cc.AnimationManager ? (this._animationManager = new cc.AnimationManager, + this._scheduler.scheduleUpdate(this._animationManager, h.PRIORITY_SYSTEM, !1)) : this._animationManager = null, + cc.CollisionManager ? (this._collisionManager = new cc.CollisionManager, + this._scheduler.scheduleUpdate(this._collisionManager, h.PRIORITY_SYSTEM, !1)) : this._collisionManager = null, + cc.PhysicsManager ? (this._physicsManager = new cc.PhysicsManager, + this._scheduler.scheduleUpdate(this._physicsManager, h.PRIORITY_SYSTEM, !1)) : this._physicsManager = null, + cc.Physics3DManager, + this._physics3DManager = null, + cc._widgetManager && cc._widgetManager.init(this) + }, + calculateDeltaTime: function(t) { + t || (t = performance.now()), + this._deltaTime = t > this._lastUpdate ? (t - this._lastUpdate) / 1e3 : 0, + this._lastUpdate = t + }, + convertToGL: function(t) { + var e = a.container + , i = cc.view + , n = e.getBoundingClientRect() + , r = n.left + window.pageXOffset - e.clientLeft + , s = n.top + window.pageYOffset - e.clientTop + , o = i._devicePixelRatio * (t.x - r) + , l = i._devicePixelRatio * (s + n.height - t.y); + return i._isRotated ? cc.v2(i._viewportRect.width - l, o) : cc.v2(o, l) + }, + convertToUI: function(t) { + var e = a.container + , i = cc.view + , n = e.getBoundingClientRect() + , r = n.left + window.pageXOffset - e.clientLeft + , s = n.top + window.pageYOffset - e.clientTop + , o = cc.v2(0, 0); + return i._isRotated ? (o.x = r + t.y / i._devicePixelRatio, + o.y = s + n.height - (i._viewportRect.width - t.x) / i._devicePixelRatio) : (o.x = r + t.x * i._devicePixelRatio, + o.y = s + n.height - t.y * i._devicePixelRatio), + o + }, + end: function() { + this._purgeDirectorInNextLoop = !0 + }, + getWinSize: function() { + return cc.size(cc.winSize) + }, + getWinSizeInPixels: function() { + return cc.size(cc.winSize) + }, + pause: function() { + this._paused || (this._paused = !0) + }, + purgeCachedData: function() { + cc.assetManager.releaseAll() + }, + purgeDirector: function() { + this._scheduler.unscheduleAll(), + this._compScheduler.unscheduleAll(), + this._nodeActivator.reset(), + l && l.setEnabled(!1), + cc.isValid(this._scene) && this._scene.destroy(), + this._scene = null, + cc.renderer.clear(), + cc.assetManager.builtins.clear(), + cc.game.pause(), + cc.assetManager.releaseAll() + }, + reset: function() { + this.purgeDirector(), + l && l.setEnabled(!0), + this._actionManager && this._scheduler.scheduleUpdate(this._actionManager, cc.Scheduler.PRIORITY_SYSTEM, !1), + this._animationManager && this._scheduler.scheduleUpdate(this._animationManager, cc.Scheduler.PRIORITY_SYSTEM, !1), + this._collisionManager && this._scheduler.scheduleUpdate(this._collisionManager, cc.Scheduler.PRIORITY_SYSTEM, !1), + this._physicsManager && this._scheduler.scheduleUpdate(this._physicsManager, cc.Scheduler.PRIORITY_SYSTEM, !1), + cc.game.resume() + }, + runSceneImmediate: function(t, e, i) { + cc.assertID(t instanceof cc.Scene || t instanceof cc.SceneAsset, 1216), + t instanceof cc.SceneAsset && (t = t.scene), + t._load(); + for (var n = Object.keys(a._persistRootNodes).map((function(t) { + return a._persistRootNodes[t] + } + )), r = 0; r < n.length; r++) { + var o = n[r] + , l = t.getChildByUuid(o.uuid); + if (l) { + var h = l.getSiblingIndex(); + l._destroyImmediate(), + t.insertChild(o, h) + } else + o.parent = t + } + var c = this._scene; + cc.assetManager._releaseManager._autoRelease(c, t, a._persistRootNodes), + cc.isValid(c) && c.destroy(), + this._scene = null, + s._deferredDestroy(), + e && e(), + this.emit(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, t), + this._scene = t, + t._activate(), + cc.game.resume(), + i && i(null, t), + this.emit(cc.Director.EVENT_AFTER_SCENE_LAUNCH, t) + }, + runScene: function(t, e, i) { + cc.assertID(t, 1205), + cc.assertID(t instanceof cc.Scene || t instanceof cc.SceneAsset, 1216), + t instanceof cc.SceneAsset && (t = t.scene), + t._load(), + this.once(cc.Director.EVENT_AFTER_DRAW, (function() { + this.runSceneImmediate(t, e, i) + } + ), this) + }, + loadScene: function(t, e, i) { + if (this._loadingScene) + return cc.warnID(1208, t, this._loadingScene), + !1; + var n = cc.assetManager.bundles.find((function(e) { + return e.getSceneInfo(t) + } + )); + if (n) { + this.emit(cc.Director.EVENT_BEFORE_SCENE_LOADING, t), + this._loadingScene = t; + var r = this; + return console.time("LoadScene " + t), + n.loadScene(t, (function(n, s) { + console.timeEnd("LoadScene " + t), + r._loadingScene = "", + n ? (n = "Failed to load scene: " + n, + cc.error(n), + e && e(n)) : r.runSceneImmediate(s, i, e) + } + )), + !0 + } + return cc.errorID(1209, t), + !1 + }, + preloadScene: function(t, e, i) { + var n = cc.assetManager.bundles.find((function(e) { + return e.getSceneInfo(t) + } + )); + if (!n) + return cc.errorID(1209, t), + null; + n.preloadScene(t, null, e, i) + }, + resume: function() { + this._paused && (this._lastUpdate = performance.now(), + this._lastUpdate || cc.logID(1200), + this._paused = !1, + this._deltaTime = 0) + }, + setDepthTest: function(t) { + cc.Camera.main && (cc.Camera.main.depth = !!t) + }, + setClearColor: function(t) { + cc.Camera.main && (cc.Camera.main.backgroundColor = t) + }, + getRunningScene: function() { + return this._scene + }, + getScene: function() { + return this._scene + }, + getAnimationInterval: function() { + return 1e3 / a.getFrameRate() + }, + setAnimationInterval: function(t) { + a.setFrameRate(Math.round(1e3 / t)) + }, + getDeltaTime: function() { + return this._deltaTime + }, + getTotalTime: function() { + return performance.now() - this._startTime + }, + getTotalFrames: function() { + return this._totalFrames + }, + isPaused: function() { + return this._paused + }, + getScheduler: function() { + return this._scheduler + }, + setScheduler: function(t) { + this._scheduler !== t && (this._scheduler = t) + }, + getActionManager: function() { + return this._actionManager + }, + setActionManager: function(t) { + this._actionManager !== t && (this._actionManager && this._scheduler.unscheduleUpdate(this._actionManager), + this._actionManager = t, + this._scheduler.scheduleUpdate(this._actionManager, cc.Scheduler.PRIORITY_SYSTEM, !1)) + }, + getAnimationManager: function() { + return this._animationManager + }, + getCollisionManager: function() { + return this._collisionManager + }, + getPhysicsManager: function() { + return this._physicsManager + }, + getPhysics3DManager: function() { + return this._physics3DManager + }, + startAnimation: function() { + cc.game.resume() + }, + stopAnimation: function() { + cc.game.pause() + }, + _resetDeltaTime: function() { + this._lastUpdate = performance.now(), + this._deltaTime = 0 + }, + mainLoop: function(t) { + this._purgeDirectorInNextLoop ? (this._purgeDirectorInNextLoop = !1, + this.purgeDirector()) : (this.calculateDeltaTime(t), + this._paused || (this.emit(cc.Director.EVENT_BEFORE_UPDATE), + this._compScheduler.startPhase(), + this._compScheduler.updatePhase(this._deltaTime), + this._scheduler.update(this._deltaTime), + this._compScheduler.lateUpdatePhase(this._deltaTime), + this.emit(cc.Director.EVENT_AFTER_UPDATE), + s._deferredDestroy()), + this.emit(cc.Director.EVENT_BEFORE_DRAW), + o.render(this._scene, this._deltaTime), + this.emit(cc.Director.EVENT_AFTER_DRAW), + l.frameUpdateListeners(), + this._totalFrames++) + }, + __fastOn: function(t, e, i) { + this.on(t, e, i) + }, + __fastOff: function(t, e, i) { + this.off(t, e, i) + } + }, + cc.js.addon(cc.Director.prototype, i.prototype), + cc.Director.EVENT_PROJECTION_CHANGED = "director_projection_changed", + cc.Director.EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading", + cc.Director.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch", + cc.Director.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch", + cc.Director.EVENT_BEFORE_UPDATE = "director_before_update", + cc.Director.EVENT_AFTER_UPDATE = "director_after_update", + cc.Director.EVENT_BEFORE_VISIT = "director_before_draw", + cc.Director.EVENT_AFTER_VISIT = "director_before_draw", + cc.Director.EVENT_BEFORE_DRAW = "director_before_draw", + cc.Director.EVENT_AFTER_DRAW = "director_after_draw", + cc.Director.PROJECTION_2D = 0, + cc.Director.PROJECTION_3D = 1, + cc.Director.PROJECTION_CUSTOM = 3, + cc.Director.PROJECTION_DEFAULT = cc.Director.PROJECTION_2D, + cc.Director.EVENT_BEFORE_PHYSICS = "director_before_physics", + cc.Director.EVENT_AFTER_PHYSICS = "director_after_physics", + cc.director = new cc.Director, + e.exports = cc.director + } + ), { + "./CCGame": 28, + "./CCScheduler": 32, + "./component-scheduler": 99, + "./event-manager": 138, + "./event/event-target": 140, + "./node-activator": 166, + "./platform/CCObject": 199, + "./renderer": 224 + }], + 28: [(function(t, e) { + "use strict"; + var i = t("./event/event-target"); + t("../audio/CCAudioEngine"); + var n = t("./CCDebug") + , r = t("./renderer/index.js") + , s = t("../core/renderer/utils/dynamic-atlas/manager") + , a = { + EVENT_HIDE: "game_on_hide", + EVENT_SHOW: "game_on_show", + EVENT_RESTART: "game_on_restart", + EVENT_GAME_INITED: "game_inited", + EVENT_ENGINE_INITED: "engine_inited", + EVENT_RENDERER_INITED: "engine_inited", + RENDER_TYPE_CANVAS: 0, + RENDER_TYPE_WEBGL: 1, + RENDER_TYPE_OPENGL: 2, + _persistRootNodes: {}, + _paused: !0, + _configLoaded: !1, + _isCloning: !1, + _prepared: !1, + _rendererInitialized: !1, + _renderContext: null, + _intervalId: null, + _lastTime: null, + _frameTime: null, + frame: null, + container: null, + canvas: null, + renderType: -1, + config: null, + onStart: null, + setFrameRate: function(t) { + this.config.frameRate = t, + this._intervalId && window.cancelAnimFrame(this._intervalId), + this._intervalId = 0, + this._paused = !0, + this._setAnimFrame(), + this._runMainLoop() + }, + getFrameRate: function() { + return this.config.frameRate + }, + step: function() { + cc.director.mainLoop() + }, + pause: function() { + this._paused || (this._paused = !0, + cc.audioEngine && cc.audioEngine._break(), + this._intervalId && window.cancelAnimFrame(this._intervalId), + this._intervalId = 0) + }, + resume: function() { + this._paused && (this._paused = !1, + cc.audioEngine && cc.audioEngine._restore(), + cc.director._resetDeltaTime(), + this._runMainLoop()) + }, + isPaused: function() { + return this._paused + }, + restart: function() { + cc.director.once(cc.Director.EVENT_AFTER_DRAW, (function() { + for (var t in a._persistRootNodes) + a.removePersistRootNode(a._persistRootNodes[t]); + cc.director.getScene().destroy(), + cc.Object._deferredDestroy(), + cc.audioEngine && cc.audioEngine.uncacheAll(), + cc.director.reset(), + a.pause(), + cc.assetManager.builtins.init((function() { + a.onStart(), + a.emit(a.EVENT_RESTART) + } + )) + } + )) + }, + end: function() { + close() + }, + _initEngine: function() { + this._rendererInitialized || (this._initRenderer(), + this._initEvents(), + this.emit(this.EVENT_ENGINE_INITED)) + }, + _loadPreviewScript: function(t) { + t() + }, + _prepareFinished: function(t) { + var e = this; + this._initEngine(), + this._setAnimFrame(), + cc.assetManager.builtins.init((function() { + console.log("Cocos Creator v" + cc.ENGINE_VERSION), + e._prepared = !0, + e._runMainLoop(), + e.emit(e.EVENT_GAME_INITED), + t && t() + } + )) + }, + eventTargetOn: i.prototype.on, + eventTargetOnce: i.prototype.once, + on: function(t, e, i, n) { + this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOn(t, e, i, n) + }, + once: function(t, e, i) { + this._prepared && t === this.EVENT_ENGINE_INITED || !this._paused && t === this.EVENT_GAME_INITED ? e.call(i) : this.eventTargetOnce(t, e, i) + }, + prepare: function(t) { + var e = this; + this._prepared ? t && t() : this._loadPreviewScript((function() { + e._prepareFinished(t) + } + )) + }, + run: function(t, e) { + this._initConfig(t), + this.onStart = e, + this.prepare(a.onStart && a.onStart.bind(a)) + }, + addPersistRootNode: function(t) { + if (cc.Node.isNode(t) && t.uuid) { + var e = t.uuid; + if (!this._persistRootNodes[e]) { + var i = cc.director._scene; + if (cc.isValid(i)) + if (t.parent) { + if (!(t.parent instanceof cc.Scene)) + return void cc.warnID(3801); + if (t.parent !== i) + return void cc.warnID(3802) + } else + t.parent = i; + this._persistRootNodes[e] = t, + t._persistNode = !0, + cc.assetManager._releaseManager._addPersistNodeRef(t) + } + } else + cc.warnID(3800) + }, + removePersistRootNode: function(t) { + var e = t.uuid || ""; + t === this._persistRootNodes[e] && (delete this._persistRootNodes[e], + t._persistNode = !1, + cc.assetManager._releaseManager._removePersistNodeRef(t)) + }, + isPersistRootNode: function(t) { + return t._persistNode + }, + _setAnimFrame: function() { + this._lastTime = performance.now(); + var t = a.config.frameRate; + this._frameTime = 1e3 / t, + cc.director._maxParticleDeltaTime = this._frameTime / 1e3 * 2; + var e = window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame; + 60 !== t && 30 !== t ? (window.requestAnimFrame = e ? this._stTimeWithRAF : this._stTime, + window.cancelAnimFrame = this._ctTime) : (window.requestAnimFrame = e || this._stTime, + window.cancelAnimFrame = window.cancelAnimationFrame || window.cancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame || window.msCancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.oCancelAnimationFrame || this._ctTime) + }, + _stTimeWithRAF: function(t) { + var e = performance.now() + , i = Math.max(0, a._frameTime - (e - a._lastTime)) + , n = window.setTimeout((function() { + window.requestAnimationFrame(t) + } + ), i); + return a._lastTime = e + i, + n + }, + _stTime: function(t) { + var e = performance.now() + , i = Math.max(0, a._frameTime - (e - a._lastTime)) + , n = window.setTimeout((function() { + t() + } + ), i); + return a._lastTime = e + i, + n + }, + _ctTime: function(t) { + window.clearTimeout(t) + }, + _runMainLoop: function() { + if (this._prepared) { + var t, e = this, i = e.config, r = cc.director, s = !0, a = i.frameRate; + n.setDisplayStats(i.showFPS), + t = function(i) { + if (!e._paused) { + if (e._intervalId = window.requestAnimFrame(t), + 30 === a && (s = !s)) + return; + r.mainLoop(i) + } + } + , + e._intervalId = window.requestAnimFrame(t), + e._paused = !1 + } + }, + _initConfig: function(t) { + "number" != typeof t.debugMode && (t.debugMode = 0), + t.exposeClassName = !!t.exposeClassName, + "number" != typeof t.frameRate && (t.frameRate = 60); + var e = t.renderMode; + ("number" != typeof e || e > 2 || e < 0) && (t.renderMode = 0), + "boolean" != typeof t.registerSystemEvent && (t.registerSystemEvent = !0), + t.showFPS = 1 !== e && !!t.showFPS, + this.collisionMatrix = t.collisionMatrix || [], + this.groupList = t.groupList || [], + n._resetDebugSetting(t.debugMode), + this.config = t, + this._configLoaded = !0 + }, + _determineRenderType: function() { + var t = this.config + , e = parseInt(t.renderMode) || 0; + this.renderType = this.RENDER_TYPE_CANVAS; + var i = !1; + if (0 === e ? cc.sys.capabilities.opengl ? (this.renderType = this.RENDER_TYPE_WEBGL, + i = !0) : cc.sys.capabilities.canvas && (this.renderType = this.RENDER_TYPE_CANVAS, + i = !0) : 1 === e && cc.sys.capabilities.canvas ? (this.renderType = this.RENDER_TYPE_CANVAS, + i = !0) : 2 === e && cc.sys.capabilities.opengl && (this.renderType = this.RENDER_TYPE_WEBGL, + i = !0), + !i) + throw new Error(n.getError(3820, e)) + }, + _initRenderer: function() { + if (!this._rendererInitialized) { + var t, e, i, n, a = this.config.id, o = a instanceof HTMLElement ? a : document.querySelector(a) || document.querySelector("#" + a); + if ("CANVAS" === o.tagName ? (t = o.width, + e = o.height, + this.canvas = i = o, + this.container = n = document.createElement("DIV"), + i.parentNode && i.parentNode.insertBefore(n, i)) : ("DIV" !== o.tagName && cc.warnID(3819), + t = o.clientWidth, + e = o.clientHeight, + this.canvas = i = document.createElement("CANVAS"), + this.container = n = document.createElement("DIV"), + o.appendChild(n)), + n.setAttribute("id", "Cocos2dGameContainer"), + n.appendChild(i), + this.frame = n.parentNode === document.body ? document.documentElement : n.parentNode, + (function(t) { + (" " + t.className + " ").indexOf(" gameCanvas ") > -1 || (t.className && (t.className += " "), + t.className += "gameCanvas") + } + )(i), + i.setAttribute("width", t || 480), + i.setAttribute("height", e || 320), + i.setAttribute("tabindex", 99), + this._determineRenderType(), + this.renderType === this.RENDER_TYPE_WEBGL) { + var l = { + stencil: !0, + antialias: cc.macro.ENABLE_WEBGL_ANTIALIAS, + alpha: cc.macro.ENABLE_TRANSPARENT_CANVAS + }; + r.initWebGL(i, l), + this._renderContext = r.device._gl, + !cc.macro.CLEANUP_IMAGE_CACHE && s && (s.enabled = !0) + } + this._renderContext || (this.renderType = this.RENDER_TYPE_CANVAS, + r.initCanvas(i), + this._renderContext = r.device._ctx), + this.canvas.oncontextmenu = function() { + if (!cc._isContextMenuEnable) + return !1 + } + , + this._rendererInitialized = !0 + } + }, + _initEvents: function() { + var t, e = window; + this.config.registerSystemEvent && cc.internal.inputManager.registerSystemEvent(this.canvas), + void 0 !== document.hidden ? t = "hidden" : void 0 !== document.mozHidden ? t = "mozHidden" : void 0 !== document.msHidden ? t = "msHidden" : void 0 !== document.webkitHidden && (t = "webkitHidden"); + var i = !1; + function n() { + i || (i = !0, + a.emit(a.EVENT_HIDE)) + } + function r(t, e, n, r, s) { + i && (i = !1, + a.emit(a.EVENT_SHOW, t, e, n, r, s)) + } + if (t) + for (var s = ["visibilitychange", "mozvisibilitychange", "msvisibilitychange", "webkitvisibilitychange", "qbrowserVisibilityChange"], o = 0; o < s.length; o++) + document.addEventListener(s[o], (function(e) { + var i = document[t]; + (i = i || e.hidden) ? n() : r() + } + )); + else + e.addEventListener("blur", n), + e.addEventListener("focus", r); + navigator.userAgent.indexOf("MicroMessenger") > -1 && (e.onfocus = r), + "onpageshow"in window && "onpagehide"in window && (e.addEventListener("pagehide", n), + e.addEventListener("pageshow", r), + document.addEventListener("pagehide", n), + document.addEventListener("pageshow", r)), + this.on(a.EVENT_HIDE, (function() { + a.pause() + } + )), + this.on(a.EVENT_SHOW, (function() { + a.resume() + } + )) + } + }; + i.call(a), + cc.js.addon(a, i.prototype), + cc.game = e.exports = a + } + ), { + "../audio/CCAudioEngine": 21, + "../core/renderer/utils/dynamic-atlas/manager": 227, + "./CCDebug": 26, + "./event/event-target": 140, + "./renderer/index.js": 224 + }], + 29: [(function(t, e) { + "use strict"; + var i = t("./value-types") + , n = t("./utils/base-node") + , r = t("./utils/prefab-helper") + , s = t("./utils/trans-pool").NodeMemPool + , a = t("./utils/affine-transform") + , o = t("./event-manager") + , l = t("./platform/CCMacro") + , h = t("./platform/js") + , c = (t("./event/event"), + t("./event/event-target")) + , u = t("./renderer/render-flow") + , _ = cc.Object.Flags.Destroying + , f = Math.PI / 180 + , d = !!cc.ActionManager + , p = function() {} + , m = new i.Vec3 + , y = new i.Quat + , v = new i.Vec3 + , g = new i.Vec3 + , A = new i.Quat + , x = new i.Quat + , b = new i.Vec3 + , C = new i.Vec3 + , T = new i.Vec3 + , S = new i.Vec3 + , w = new i.Vec3 + , E = new i.Quat + , M = new i.Quat + , D = new i.Vec3 + , B = new i.Quat + , I = new i.Vec3 + , P = new i.Quat + , R = new i.Vec3 + , O = new i.Vec3 + , L = new i.Quat + , F = new i.Quat + , V = (new i.Quat, + cc.mat4()) + , N = new i.Vec3 + , k = new Array(16); + k.length = 0; + var G = cc.Enum({ + DEBUG: 31 + }) + , U = cc.Enum({ + POSITION: 1, + SCALE: 2, + ROTATION: 4, + SKEW: 8, + TRS: 7, + RS: 6, + TRSS: 15, + PHYSICS_POSITION: 16, + PHYSICS_SCALE: 32, + PHYSICS_ROTATION: 64, + PHYSICS_TRS: 112, + PHYSICS_RS: 96, + ALL_POSITION: 17, + ALL_SCALE: 34, + ALL_ROTATION: 68, + ALL_TRS: 119, + ALL: 65535 + }) + , z = cc.Enum({ + TOUCH_START: "touchstart", + TOUCH_MOVE: "touchmove", + TOUCH_END: "touchend", + TOUCH_CANCEL: "touchcancel", + MOUSE_DOWN: "mousedown", + MOUSE_MOVE: "mousemove", + MOUSE_ENTER: "mouseenter", + MOUSE_LEAVE: "mouseleave", + MOUSE_UP: "mouseup", + MOUSE_WHEEL: "mousewheel", + POSITION_CHANGED: "position-changed", + ROTATION_CHANGED: "rotation-changed", + SCALE_CHANGED: "scale-changed", + SIZE_CHANGED: "size-changed", + ANCHOR_CHANGED: "anchor-changed", + COLOR_CHANGED: "color-changed", + CHILD_ADDED: "child-added", + CHILD_REMOVED: "child-removed", + CHILD_REORDER: "child-reorder", + GROUP_CHANGED: "group-changed", + SIBLING_ORDER_CHANGED: "sibling-order-changed" + }) + , H = [z.TOUCH_START, z.TOUCH_MOVE, z.TOUCH_END, z.TOUCH_CANCEL] + , W = [z.MOUSE_DOWN, z.MOUSE_ENTER, z.MOUSE_MOVE, z.MOUSE_LEAVE, z.MOUSE_UP, z.MOUSE_WHEEL] + , j = !0 + , X = function(t) { + if (0 !== t) { + j && cc.warn("`cc.Node.skewX/Y` is deprecated since v2.2.1, please use 3D node instead.", ""), + j = !1 + } + } + , Y = null + , q = function(t, e) { + var i = t.getLocation() + , n = this.owner; + return !!n._hitTest(i, this) && (e.type = z.TOUCH_START, + e.touch = t, + e.bubbles = !0, + n.dispatchEvent(e), + !0) + } + , J = function(t, e) { + var i = this.owner; + e.type = z.TOUCH_MOVE, + e.touch = t, + e.bubbles = !0, + i.dispatchEvent(e) + } + , Z = function(t, e) { + var i = t.getLocation() + , n = this.owner; + n._hitTest(i, this) ? e.type = z.TOUCH_END : e.type = z.TOUCH_CANCEL, + e.touch = t, + e.bubbles = !0, + n.dispatchEvent(e) + } + , K = function(t, e) { + t.getLocation(); + var i = this.owner; + e.type = z.TOUCH_CANCEL, + e.touch = t, + e.bubbles = !0, + i.dispatchEvent(e) + } + , Q = function(t) { + var e = t.getLocation() + , i = this.owner; + i._hitTest(e, this) && (t.type = z.MOUSE_DOWN, + t.bubbles = !0, + i.dispatchEvent(t)) + } + , $ = function(t) { + var e = t.getLocation() + , i = this.owner; + if (i._hitTest(e, this)) + this._previousIn || (Y && Y._mouseListener && (t.type = z.MOUSE_LEAVE, + Y.dispatchEvent(t), + Y._mouseListener._previousIn = !1), + Y = this.owner, + t.type = z.MOUSE_ENTER, + i.dispatchEvent(t), + this._previousIn = !0), + t.type = z.MOUSE_MOVE, + t.bubbles = !0, + i.dispatchEvent(t); + else { + if (!this._previousIn) + return; + t.type = z.MOUSE_LEAVE, + i.dispatchEvent(t), + this._previousIn = !1, + Y = null + } + t.stopPropagation() + } + , tt = function(t) { + var e = t.getLocation() + , i = this.owner; + i._hitTest(e, this) && (t.type = z.MOUSE_UP, + t.bubbles = !0, + i.dispatchEvent(t), + t.stopPropagation()) + } + , et = function(t) { + var e = t.getLocation() + , i = this.owner; + i._hitTest(e, this) && (t.type = z.MOUSE_WHEEL, + t.bubbles = !0, + i.dispatchEvent(t), + t.stopPropagation()) + }; + function it(t, e) { + if (e) { + for (var i = 0, n = null, r = t; r && cc.Node.isNode(r); r = r._parent, + ++i) + if (r.getComponent(e)) { + var s = { + index: i, + node: r + }; + n ? n.push(s) : n = [s] + } + return n + } + return null + } + function nt(t, e) { + if (!(t._objFlags & _)) { + if (t._bubblingListeners) + for (var i = 0, n = e.length; i < n; ++i) + if (t._bubblingListeners.hasEventListener(e[i])) + return !0; + if (t._capturingListeners) + for (var r = 0, s = e.length; r < s; ++r) + if (t._capturingListeners.hasEventListener(e[r])) + return !0; + return !1 + } + return !0 + } + function rt(t, e) { + var i, n; + for (e.target = t, + k.length = 0, + t._getCapturingTargets(e.type, k), + e.eventPhase = 1, + n = k.length - 1; n >= 0; --n) + if ((i = k[n])._capturingListeners && (e.currentTarget = i, + i._capturingListeners.emit(e.type, e, k), + e._propagationStopped)) + return void (k.length = 0); + if (k.length = 0, + e.eventPhase = 2, + e.currentTarget = t, + t._capturingListeners && t._capturingListeners.emit(e.type, e), + !e._propagationImmediateStopped && t._bubblingListeners && t._bubblingListeners.emit(e.type, e), + !e._propagationStopped && e.bubbles) + for (t._getBubblingTargets(e.type, k), + e.eventPhase = 3, + n = 0; n < k.length; ++n) + if ((i = k[n])._bubblingListeners && (e.currentTarget = i, + i._bubblingListeners.emit(e.type, e), + e._propagationStopped)) + return void (k.length = 0); + k.length = 0 + } + function st(t) { + var e = t.groupIndex; + return 0 === e && t.parent && (e = st(t.parent)), + e + } + function at(t) { + var e = st(t); + t._cullingMask = 1 << e; + for (var i = 0; i < t._children.length; i++) + at(t._children[i]) + } + function ot() { + if (this._localMatDirty & U.TRSS) { + var t = this._matrix + , e = t.m; + if (i.Trs.toMat4(t, this._trs), + this._skewX || this._skewY) { + var n = e[0] + , r = e[1] + , s = e[4] + , a = e[5] + , o = Math.tan(this._skewX * f) + , l = Math.tan(this._skewY * f); + o === 1 / 0 && (o = 99999999), + l === 1 / 0 && (l = 99999999), + e[0] = n + s * l, + e[1] = r + a * l, + e[4] = s + n * o, + e[5] = a + r * o + } + this._localMatDirty &= ~U.TRSS, + this._worldMatDirty = !0 + } + } + function lt() { + var t = this._localMatDirty; + if (t & U.TRSS) { + var e = this._matrix.m + , i = this._trs; + if (t & (U.RS | U.SKEW)) { + var n = -this._eulerAngles.z + , r = this._skewX || this._skewY + , s = i[7] + , a = i[8]; + if (n || r) { + var o = 1 + , l = 0 + , h = 0 + , c = 1; + if (n) { + var u = n * f; + h = Math.sin(u), + o = c = Math.cos(u), + l = -h + } + if (e[0] = o *= s, + e[1] = l *= s, + e[4] = h *= a, + e[5] = c *= a, + r) { + var _ = e[0] + , d = e[1] + , p = e[4] + , m = e[5] + , y = Math.tan(this._skewX * f) + , v = Math.tan(this._skewY * f); + y === 1 / 0 && (y = 99999999), + v === 1 / 0 && (v = 99999999), + e[0] = _ + p * v, + e[1] = d + m * v, + e[4] = p + _ * y, + e[5] = m + d * y + } + } else + e[0] = s, + e[1] = 0, + e[4] = 0, + e[5] = a + } + e[12] = i[0], + e[13] = i[1], + this._localMatDirty &= ~U.TRSS, + this._worldMatDirty = !0 + } + } + function ht() { + if (this._localMatDirty & U.TRSS && this._updateLocalMatrix(), + this._parent) { + var t = this._parent._worldMatrix; + i.Mat4.mul(this._worldMatrix, t, this._matrix) + } else + i.Mat4.copy(this._worldMatrix, this._matrix); + this._worldMatDirty = !1 + } + function ct() { + this._localMatDirty & U.TRSS && this._updateLocalMatrix(); + var t = this._parent; + t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : i.Mat4.copy(this._worldMatrix, this._matrix), + this._worldMatDirty = !1 + } + function ut(t, e, i) { + var n = e.m + , r = i.m + , s = t.m + , a = n[0] + , o = n[1] + , l = n[4] + , h = n[5] + , c = n[12] + , u = n[13] + , _ = r[0] + , f = r[1] + , d = r[4] + , p = r[5] + , m = r[12] + , y = r[13]; + 0 !== o || 0 !== l ? (s[0] = _ * a + f * l, + s[1] = _ * o + f * h, + s[4] = d * a + p * l, + s[5] = d * o + p * h, + s[12] = a * m + l * y + c, + s[13] = o * m + h * y + u) : (s[0] = _ * a, + s[1] = f * h, + s[4] = d * a, + s[5] = p * h, + s[12] = a * m + c, + s[13] = h * y + u) + } + var _t = i.Mat4.mul + , ft = { + name: "cc.Node", + extends: n, + properties: { + _opacity: 255, + _color: cc.Color.WHITE, + _contentSize: cc.Size, + _anchorPoint: cc.v2(.5, .5), + _position: void 0, + _scale: void 0, + _trs: null, + _eulerAngles: cc.Vec3, + _skewX: 0, + _skewY: 0, + _zIndex: { + default: void 0, + type: cc.Integer + }, + _localZOrder: { + default: 0, + serializable: !1 + }, + _is3DNode: !1, + _groupIndex: { + default: 0, + formerlySerializedAs: "groupIndex" + }, + groupIndex: { + get: function() { + return this._groupIndex + }, + set: function(t) { + this._groupIndex = t, + at(this), + this.emit(z.GROUP_CHANGED, this) + } + }, + group: { + get: function() { + return cc.game.groupList[this.groupIndex] || "" + }, + set: function(t) { + this.groupIndex = cc.game.groupList.indexOf(t) + } + }, + x: { + get: function() { + return this._trs[0] + }, + set: function(t) { + var e = this._trs; + t !== e[0] && (e[0] = t, + this.setLocalDirty(U.ALL_POSITION), + 1 & this._eventMask && this.emit(z.POSITION_CHANGED)) + } + }, + y: { + get: function() { + return this._trs[1] + }, + set: function(t) { + var e = this._trs; + t !== e[1] && (e[1] = t, + this.setLocalDirty(U.ALL_POSITION), + 1 & this._eventMask && this.emit(z.POSITION_CHANGED)) + } + }, + z: { + get: function() { + return this._trs[2] + }, + set: function(t) { + var e = this._trs; + t !== e[2] && (e[2] = t, + this.setLocalDirty(U.ALL_POSITION), + this._renderFlag |= u.FLAG_WORLD_TRANSFORM, + 1 & this._eventMask && this.emit(z.POSITION_CHANGED)) + } + }, + rotation: { + get: function() { + return -this.angle + }, + set: function(t) { + this.angle = -t + } + }, + angle: { + get: function() { + return this._eulerAngles.z + }, + set: function(t) { + i.Vec3.set(this._eulerAngles, 0, 0, t), + i.Trs.fromAngleZ(this._trs, t), + this.setLocalDirty(U.ALL_ROTATION), + 4 & this._eventMask && this.emit(z.ROTATION_CHANGED) + } + }, + rotationX: { + get: function() { + return this._eulerAngles.x + }, + set: function(t) { + this._eulerAngles.x !== t && (this._eulerAngles.x = t, + this._eulerAngles.x === this._eulerAngles.y ? i.Trs.fromAngleZ(this._trs, -t) : i.Trs.fromEulerNumber(this._trs, t, this._eulerAngles.y, 0), + this.setLocalDirty(U.ALL_ROTATION), + 4 & this._eventMask && this.emit(z.ROTATION_CHANGED)) + } + }, + rotationY: { + get: function() { + return this._eulerAngles.y + }, + set: function(t) { + this._eulerAngles.y !== t && (this._eulerAngles.y = t, + this._eulerAngles.x === this._eulerAngles.y ? i.Trs.fromAngleZ(this._trs, -t) : i.Trs.fromEulerNumber(this._trs, this._eulerAngles.x, t, 0), + this.setLocalDirty(U.ALL_ROTATION), + 4 & this._eventMask && this.emit(z.ROTATION_CHANGED)) + } + }, + eulerAngles: { + get: function() { + return i.Trs.toEuler(this._eulerAngles, this._trs) + }, + set: function(t) { + i.Trs.fromEuler(this._trs, t), + this.setLocalDirty(U.ALL_ROTATION), + this._renderFlag |= u.FLAG_TRANSFORM, + 4 & this._eventMask && this.emit(z.ROTATION_CHANGED) + } + }, + quat: { + get: function() { + var t = this._trs; + return new i.Quat(t[3],t[4],t[5],t[6]) + }, + set: function(t) { + this.setRotation(t) + } + }, + scale: { + get: function() { + return this._trs[7] + }, + set: function(t) { + this.setScale(t) + } + }, + scaleX: { + get: function() { + return this._trs[7] + }, + set: function(t) { + this._trs[7] !== t && (this._trs[7] = t, + this.setLocalDirty(U.ALL_SCALE), + 2 & this._eventMask && this.emit(z.SCALE_CHANGED)) + } + }, + scaleY: { + get: function() { + return this._trs[8] + }, + set: function(t) { + this._trs[8] !== t && (this._trs[8] = t, + this.setLocalDirty(U.ALL_SCALE), + 2 & this._eventMask && this.emit(z.SCALE_CHANGED)) + } + }, + scaleZ: { + get: function() { + return this._trs[9] + }, + set: function(t) { + this._trs[9] !== t && (this._trs[9] = t, + this.setLocalDirty(U.ALL_SCALE), + this._renderFlag |= u.FLAG_TRANSFORM, + 2 & this._eventMask && this.emit(z.SCALE_CHANGED)) + } + }, + skewX: { + get: function() { + return this._skewX + }, + set: function(t) { + X(t), + this._skewX = t, + this.setLocalDirty(U.SKEW) + } + }, + skewY: { + get: function() { + return this._skewY + }, + set: function(t) { + X(t), + this._skewY = t, + this.setLocalDirty(U.SKEW) + } + }, + opacity: { + get: function() { + return this._opacity + }, + set: function(t) { + t = cc.misc.clampf(t, 0, 255), + this._opacity !== t && (this._opacity = t, + this._renderFlag |= u.FLAG_OPACITY_COLOR) + }, + range: [0, 255] + }, + color: { + get: function() { + return this._color.clone() + }, + set: function(t) { + this._color.equals(t) || (this._color.set(t), + this._renderFlag |= u.FLAG_COLOR, + 32 & this._eventMask && this.emit(z.COLOR_CHANGED, t)) + } + }, + anchorX: { + get: function() { + return this._anchorPoint.x + }, + set: function(t) { + var e = this._anchorPoint; + e.x !== t && (e.x = t, + 16 & this._eventMask && this.emit(z.ANCHOR_CHANGED)) + } + }, + anchorY: { + get: function() { + return this._anchorPoint.y + }, + set: function(t) { + var e = this._anchorPoint; + e.y !== t && (e.y = t, + 16 & this._eventMask && this.emit(z.ANCHOR_CHANGED)) + } + }, + width: { + get: function() { + return this._contentSize.width + }, + set: function(t) { + t !== this._contentSize.width && (this._contentSize.width = t, + 8 & this._eventMask && this.emit(z.SIZE_CHANGED)) + } + }, + height: { + get: function() { + return this._contentSize.height + }, + set: function(t) { + t !== this._contentSize.height && (this._contentSize.height = t, + 8 & this._eventMask && this.emit(z.SIZE_CHANGED)) + } + }, + zIndex: { + get: function() { + return this._localZOrder >> 16 + }, + set: function(t) { + t > l.MAX_ZINDEX ? (cc.warnID(1636), + t = l.MAX_ZINDEX) : t < l.MIN_ZINDEX && (cc.warnID(1637), + t = l.MIN_ZINDEX), + this.zIndex !== t && (this._localZOrder = 65535 & this._localZOrder | t << 16, + this.emit(z.SIBLING_ORDER_CHANGED), + this._onSiblingIndexChanged()) + } + }, + is3DNode: { + get: function() { + return this._is3DNode + }, + set: function(t) { + this._is3DNode = t, + this._update3DFunction() + } + }, + up: { + get: function() { + return i.Vec3.transformQuat(I, i.Vec3.UP, this.getWorldRotation(P)).clone() + } + }, + right: { + get: function() { + return i.Vec3.transformQuat(I, i.Vec3.RIGHT, this.getWorldRotation(P)).clone() + } + }, + forward: { + get: function() { + return i.Vec3.transformQuat(I, i.Vec3.FORWARD, this.getWorldRotation(P)).clone() + } + } + }, + ctor: function() { + this._reorderChildDirty = !1, + this._widget = null, + this._renderComponent = null, + this._capturingListeners = null, + this._bubblingListeners = null, + this._touchListener = null, + this._mouseListener = null, + this._initDataFromPool(), + this._eventMask = 0, + this._cullingMask = 1, + this._childArrivalOrder = 1, + this._renderFlag = u.FLAG_TRANSFORM | u.FLAG_OPACITY_COLOR + }, + statics: { + EventType: z, + _LocalDirtyFlag: U, + isNode: function(t) { + return t instanceof dt && (t.constructor === dt || !(t instanceof cc.Scene)) + }, + BuiltinGroupIndex: G + }, + _onSiblingIndexChanged: function() { + this._parent && this._parent._delaySort() + }, + _onPreDestroy: function() { + this._onPreDestroyBase(), + d && cc.director.getActionManager().removeAllActionsFromTarget(this), + Y === this && (Y = null), + this._bubblingListeners && this._bubblingListeners.clear(), + this._capturingListeners && this._capturingListeners.clear(), + (this._touchListener || this._mouseListener) && (o.removeListeners(this), + this._touchListener && (this._touchListener.owner = null, + this._touchListener.mask = null, + this._touchListener = null), + this._mouseListener && (this._mouseListener.owner = null, + this._mouseListener.mask = null, + this._mouseListener = null)), + this._backDataIntoPool(), + this._reorderChildDirty && cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this) + }, + _onPostActivated: function(t) { + var e = d ? cc.director.getActionManager() : null; + t ? (this._renderFlag |= u.FLAG_WORLD_TRANSFORM, + e && e.resumeTarget(this), + o.resumeTarget(this), + this._checkListenerMask()) : (e && e.pauseTarget(this), + o.pauseTarget(this)) + }, + _onHierarchyChanged: function(t) { + this._updateOrderOfArrival(), + at(this), + this._parent && this._parent._delaySort(), + this._renderFlag |= u.FLAG_WORLD_TRANSFORM, + this._onHierarchyChangedBase(t), + cc._widgetManager && (cc._widgetManager._nodesOrderDirty = !0), + t && this._activeInHierarchy && this._checkListenerMask() + }, + _update3DFunction: function() { + this._is3DNode ? (this._updateLocalMatrix = ot, + this._calculWorldMatrix = ht, + this._mulMat = _t) : (this._updateLocalMatrix = lt, + this._calculWorldMatrix = ct, + this._mulMat = ut), + this._renderComponent && this._renderComponent._on3DNodeChanged && this._renderComponent._on3DNodeChanged(), + this._renderFlag |= u.FLAG_TRANSFORM, + this._localMatDirty = U.ALL + }, + _initDataFromPool: function() { + this._spaceInfo || (this._spaceInfo = s.pop()); + var t = this._spaceInfo; + this._matrix = cc.mat4(t.localMat), + i.Mat4.identity(this._matrix), + this._worldMatrix = cc.mat4(t.worldMat), + i.Mat4.identity(this._worldMatrix), + this._localMatDirty = U.ALL, + this._worldMatDirty = !0; + var e = this._trs = t.trs; + e[0] = 0, + e[1] = 0, + e[2] = 0, + e[3] = 0, + e[4] = 0, + e[5] = 0, + e[6] = 1, + e[7] = 1, + e[8] = 1, + e[9] = 1 + }, + _backDataIntoPool: function() { + s.push(this._spaceInfo), + this._matrix = null, + this._worldMatrix = null, + this._trs = null, + this._spaceInfo = null + }, + _toEuler: function() { + if (this.is3DNode) + i.Trs.toEuler(this._eulerAngles, this._trs); + else { + var t = Math.asin(this._trs[5]) / f * 2; + i.Vec3.set(this._eulerAngles, 0, 0, t) + } + }, + _fromEuler: function() { + this.is3DNode ? i.Trs.fromEuler(this._trs, this._eulerAngles) : i.Trs.fromAngleZ(this._trs, this._eulerAngles.z) + }, + _initProperties: function() { + this._is3DNode && this._update3DFunction(); + var t = this._trs; + if (t) { + var e = t; + t = this._trs = this._spaceInfo.trs, + 11 === e.length ? t.set(e.subarray(1)) : t.set(e) + } else + t = this._trs = this._spaceInfo.trs; + this._fromEuler() + }, + _onBatchCreated: function(t) { + this._initProperties(), + this._cullingMask = 1 << st(this), + this._activeInHierarchy || (d && cc.director.getActionManager().pauseTarget(this), + o.pauseTarget(this)); + for (var e = this._children, i = 0, n = e.length; i < n; i++) { + var s = e[i]; + if (!t) { + var a = s._prefab; + a && a.sync && a.root === s && r.syncWithPrefab(s), + s._updateOrderOfArrival() + } + s._onBatchCreated(t) + } + e.length > 0 && (this._renderFlag |= u.FLAG_CHILDREN) + }, + _checkListenerMask: function() { + if (this._touchListener) { + var t = this._touchListener.mask = it(this, cc.Mask); + this._mouseListener && (this._mouseListener.mask = t) + } else + this._mouseListener && (this._mouseListener.mask = it(this, cc.Mask)) + }, + _checknSetupSysEvent: function(t) { + var e = !1 + , i = !1; + return -1 !== H.indexOf(t) ? (this._touchListener || (this._touchListener = cc.EventListener.create({ + event: cc.EventListener.TOUCH_ONE_BY_ONE, + swallowTouches: !0, + owner: this, + mask: it(this, cc.Mask), + onTouchBegan: q, + onTouchMoved: J, + onTouchEnded: Z, + onTouchCancelled: K + }), + o.addListener(this._touchListener, this), + e = !0), + i = !0) : -1 !== W.indexOf(t) && (this._mouseListener || (this._mouseListener = cc.EventListener.create({ + event: cc.EventListener.MOUSE, + _previousIn: !1, + owner: this, + mask: it(this, cc.Mask), + onMouseDown: Q, + onMouseMove: $, + onMouseUp: tt, + onMouseScroll: et + }), + o.addListener(this._mouseListener, this), + e = !0), + i = !0), + e && !this._activeInHierarchy && cc.director.getScheduler().schedule((function() { + this._activeInHierarchy || o.pauseTarget(this) + } + ), this, 0, 0, 0, !1), + i + }, + on: function(t, e, i, n) { + if (this._checknSetupSysEvent(t)) + return this._onDispatch(t, e, i, n); + switch (t) { + case z.POSITION_CHANGED: + this._eventMask |= 1; + break; + case z.SCALE_CHANGED: + this._eventMask |= 2; + break; + case z.ROTATION_CHANGED: + this._eventMask |= 4; + break; + case z.SIZE_CHANGED: + this._eventMask |= 8; + break; + case z.ANCHOR_CHANGED: + this._eventMask |= 16; + break; + case z.COLOR_CHANGED: + this._eventMask |= 32 + } + return this._bubblingListeners || (this._bubblingListeners = new c), + this._bubblingListeners.on(t, e, i) + }, + once: function(t, e, i, n) { + var r = this + , s = null; + (s = this._checknSetupSysEvent(t) && n ? this._capturingListeners = this._capturingListeners || new c : this._bubblingListeners = this._bubblingListeners || new c).once(t, e, i), + s.once(t, (function() { + r.off(t, e, i) + } + ), void 0) + }, + _onDispatch: function(t, e, i, n) { + if ("boolean" == typeof i ? (n = i, + i = void 0) : n = !!n, + e) { + var r = null; + return (r = n ? this._capturingListeners = this._capturingListeners || new c : this._bubblingListeners = this._bubblingListeners || new c).hasEventListener(t, e, i) || (r.on(t, e, i), + i && i.__eventTargets && i.__eventTargets.push(this)), + e + } + cc.errorID(6800) + }, + off: function(t, e, i, n) { + var r = -1 !== H.indexOf(t) + , s = !r && -1 !== W.indexOf(t); + if (r || s) + this._offDispatch(t, e, i, n), + r ? this._touchListener && !nt(this, H) && (o.removeListener(this._touchListener), + this._touchListener = null) : s && this._mouseListener && !nt(this, W) && (o.removeListener(this._mouseListener), + this._mouseListener = null); + else if (this._bubblingListeners && (this._bubblingListeners.off(t, e, i), + !this._bubblingListeners.hasEventListener(t))) + switch (t) { + case z.POSITION_CHANGED: + this._eventMask &= -2; + break; + case z.SCALE_CHANGED: + this._eventMask &= -3; + break; + case z.ROTATION_CHANGED: + this._eventMask &= -5; + break; + case z.SIZE_CHANGED: + this._eventMask &= -9; + break; + case z.ANCHOR_CHANGED: + this._eventMask &= -17; + break; + case z.COLOR_CHANGED: + this._eventMask &= -33 + } + }, + _offDispatch: function(t, e, i, n) { + if ("boolean" == typeof i ? (n = i, + i = void 0) : n = !!n, + e) { + var r = n ? this._capturingListeners : this._bubblingListeners; + r && (r.off(t, e, i), + i && i.__eventTargets && h.array.fastRemove(i.__eventTargets, this)) + } else + this._capturingListeners && this._capturingListeners.removeAll(t), + this._bubblingListeners && this._bubblingListeners.removeAll(t) + }, + targetOff: function(t) { + var e = this._bubblingListeners; + e && (e.targetOff(t), + 1 & this._eventMask && !e.hasEventListener(z.POSITION_CHANGED) && (this._eventMask &= -2), + 2 & this._eventMask && !e.hasEventListener(z.SCALE_CHANGED) && (this._eventMask &= -3), + 4 & this._eventMask && !e.hasEventListener(z.ROTATION_CHANGED) && (this._eventMask &= -5), + 8 & this._eventMask && !e.hasEventListener(z.SIZE_CHANGED) && (this._eventMask &= -9), + 16 & this._eventMask && !e.hasEventListener(z.ANCHOR_CHANGED) && (this._eventMask &= -17), + 32 & this._eventMask && !e.hasEventListener(z.COLOR_CHANGED) && (this._eventMask &= -33)), + this._capturingListeners && this._capturingListeners.targetOff(t), + t && t.__eventTargets && h.array.fastRemove(t.__eventTargets, this), + this._touchListener && !nt(this, H) && (o.removeListener(this._touchListener), + this._touchListener = null), + this._mouseListener && !nt(this, W) && (o.removeListener(this._mouseListener), + this._mouseListener = null) + }, + hasEventListener: function(t) { + var e = !1; + return this._bubblingListeners && (e = this._bubblingListeners.hasEventListener(t)), + !e && this._capturingListeners && (e = this._capturingListeners.hasEventListener(t)), + e + }, + emit: function(t, e, i, n, r, s) { + this._bubblingListeners && this._bubblingListeners.emit(t, e, i, n, r, s) + }, + dispatchEvent: function(t) { + rt(this, t), + k.length = 0 + }, + pauseSystemEvents: function(t) { + o.pauseTarget(this, t) + }, + resumeSystemEvents: function(t) { + o.resumeTarget(this, t) + }, + _hitTest: function(t, e) { + var n = this._contentSize.width + , r = this._contentSize.height + , s = R + , a = O + , o = cc.Camera.findCamera(this); + if (o ? o.getScreenToWorldPoint(t, s) : s.set(t), + this._updateWorldMatrix(), + !i.Mat4.invert(V, this._worldMatrix)) + return !1; + i.Vec2.transformMat4(a, s, V), + a.x += this._anchorPoint.x * n, + a.y += this._anchorPoint.y * r; + var l = !1; + if (a.x >= 0 && a.y >= 0 && a.x <= n && a.y <= r && (l = !0, + e && e.mask)) + for (var h = e.mask, c = this, u = h ? h.length : 0, _ = 0, f = 0; c && f < u; ++_, + c = c.parent) { + var d = h[f]; + if (_ === d.index) { + if (c !== d.node) { + h.length = f; + break + } + var p = c.getComponent(cc.Mask); + if (p && p._enabled && !p._hitTest(s)) { + l = !1; + break + } + f++ + } else if (_ > d.index) { + h.length = f; + break + } + } + return l + }, + _getCapturingTargets: function(t, e) { + for (var i = this.parent; i; ) + i._capturingListeners && i._capturingListeners.hasEventListener(t) && e.push(i), + i = i.parent + }, + _getBubblingTargets: function(t, e) { + for (var i = this.parent; i; ) + i._bubblingListeners && i._bubblingListeners.hasEventListener(t) && e.push(i), + i = i.parent + }, + runAction: d ? function(t) { + if (this.active) { + cc.assertID(t, 1618); + var e = cc.director.getActionManager(); + return e._suppressDeprecation || (e._suppressDeprecation = !0, + cc.warnID(1639)), + e.addAction(t, this, !1), + t + } + } + : p, + pauseAllActions: d ? function() { + cc.director.getActionManager().pauseTarget(this) + } + : p, + resumeAllActions: d ? function() { + cc.director.getActionManager().resumeTarget(this) + } + : p, + stopAllActions: d ? function() { + cc.director.getActionManager().removeAllActionsFromTarget(this) + } + : p, + stopAction: d ? function(t) { + cc.director.getActionManager().removeAction(t) + } + : p, + stopActionByTag: d ? function(t) { + t !== cc.Action.TAG_INVALID ? cc.director.getActionManager().removeActionByTag(t, this) : cc.logID(1612) + } + : p, + getActionByTag: d ? function(t) { + return t === cc.Action.TAG_INVALID ? (cc.logID(1613), + null) : cc.director.getActionManager().getActionByTag(t, this) + } + : function() { + return null + } + , + getNumberOfRunningActions: d ? function() { + return cc.director.getActionManager().getNumberOfRunningActionsInTarget(this) + } + : function() { + return 0 + } + , + getPosition: function(t) { + return t = t || new i.Vec3, + i.Trs.toPosition(t, this._trs) + }, + setPosition: function(t, e, i) { + var n; + void 0 === e ? (n = t.x, + e = t.y, + i = t.z) : n = t; + var r = this._trs; + void 0 === i && (i = r[2]), + (r[0] !== n || r[1] !== e || r[2] !== i) && (r[0] = n, + r[1] = e, + r[2] = i, + this.setLocalDirty(U.ALL_POSITION), + this._renderFlag |= u.FLAG_WORLD_TRANSFORM, + 1 & this._eventMask && this.emit(z.POSITION_CHANGED)) + }, + getScale: function(t) { + return void 0 !== t ? i.Trs.toScale(t, this._trs) : (cc.errorID(1400, "cc.Node.getScale", "cc.Node.scale or cc.Node.getScale(cc.Vec3)"), + this._trs[7]) + }, + setScale: function(t, e, i) { + var n; + t && "number" != typeof t ? (n = t.x, + e = t.y, + i = t.z) : void 0 !== t && void 0 === e ? (n = t, + e = t, + i = t) : n = t; + var r = this._trs; + void 0 === i && (i = r[9]), + r[7] === n && r[8] === e && r[9] === i || (r[7] = n, + r[8] = e, + r[9] = i, + this.setLocalDirty(U.ALL_SCALE), + this._renderFlag |= u.FLAG_TRANSFORM, + 2 & this._eventMask && this.emit(z.SCALE_CHANGED)) + }, + getRotation: function(t) { + return t instanceof i.Quat ? i.Trs.toRotation(t, this._trs) : -this.angle + }, + setRotation: function(t, e, i, n) { + if ("number" == typeof t && void 0 === e) + this.angle = -t; + else { + var r = t; + void 0 === e && (r = t.x, + e = t.y, + i = t.z, + n = t.w); + var s = this._trs; + s[3] === r && s[4] === e && s[5] === i && s[6] === n || (s[3] = r, + s[4] = e, + s[5] = i, + s[6] = n, + this.setLocalDirty(U.ALL_ROTATION), + 4 & this._eventMask && this.emit(z.ROTATION_CHANGED)) + } + }, + getContentSize: function() { + return cc.size(this._contentSize.width, this._contentSize.height) + }, + setContentSize: function(t, e) { + var i = this._contentSize; + if (void 0 === e) { + if (t.width === i.width && t.height === i.height) + return; + i.width = t.width, + i.height = t.height + } else { + if (t === i.width && e === i.height) + return; + i.width = t, + i.height = e + } + 8 & this._eventMask && this.emit(z.SIZE_CHANGED) + }, + getAnchorPoint: function() { + return cc.v2(this._anchorPoint) + }, + setAnchorPoint: function(t, e) { + var i = this._anchorPoint; + if (void 0 === e) { + if (t.x === i.x && t.y === i.y) + return; + i.x = t.x, + i.y = t.y + } else { + if (t === i.x && e === i.y) + return; + i.x = t, + i.y = e + } + this.setLocalDirty(U.ALL_POSITION), + 16 & this._eventMask && this.emit(z.ANCHOR_CHANGED) + }, + _invTransformPoint: function(t, e) { + this._parent ? this._parent._invTransformPoint(t, e) : i.Vec3.copy(t, e); + var n = this._trs; + return i.Trs.toPosition(v, n), + i.Vec3.sub(t, t, v), + i.Trs.toRotation(A, n), + i.Quat.conjugate(x, A), + i.Vec3.transformQuat(t, t, x), + i.Trs.toScale(v, n), + i.Vec3.inverseSafe(g, v), + i.Vec3.mul(t, t, g), + t + }, + getWorldPosition: function(t) { + i.Trs.toPosition(t, this._trs); + for (var e, n = this._parent; n; ) + e = n._trs, + i.Trs.toScale(m, e), + i.Vec3.mul(t, t, m), + i.Trs.toRotation(y, e), + i.Vec3.transformQuat(t, t, y), + i.Trs.toPosition(m, e), + i.Vec3.add(t, t, m), + n = n._parent; + return t + }, + setWorldPosition: function(t) { + var e = this._trs; + this._parent ? this._parent._invTransformPoint(b, t) : i.Vec3.copy(b, t), + i.Trs.fromPosition(e, b), + this.setLocalDirty(U.ALL_POSITION), + 1 & this._eventMask && this.emit(z.POSITION_CHANGED) + }, + getWorldRotation: function(t) { + i.Trs.toRotation(L, this._trs), + i.Quat.copy(t, L); + for (var e = this._parent; e; ) + i.Trs.toRotation(L, e._trs), + i.Quat.mul(t, L, t), + e = e._parent; + return t + }, + setWorldRotation: function(t) { + this._parent ? (this._parent.getWorldRotation(F), + i.Quat.conjugate(F, F), + i.Quat.mul(F, F, t)) : i.Quat.copy(F, t), + i.Trs.fromRotation(this._trs, F), + this.setLocalDirty(U.ALL_ROTATION) + }, + getWorldScale: function(t) { + i.Trs.toScale(C, this._trs), + i.Vec3.copy(t, C); + for (var e = this._parent; e; ) + i.Trs.toScale(C, e._trs), + i.Vec3.mul(t, t, C), + e = e._parent; + return t + }, + setWorldScale: function(t) { + this._parent ? (this._parent.getWorldScale(T), + i.Vec3.div(T, t, T)) : i.Vec3.copy(T, t), + i.Trs.fromScale(this._trs, T), + this.setLocalDirty(U.ALL_SCALE) + }, + getWorldRT: function(t) { + var e = S + , n = E + , r = this._trs; + i.Trs.toPosition(e, r), + i.Trs.toRotation(n, r); + for (var s = this._parent; s; ) + r = s._trs, + i.Trs.toScale(w, r), + i.Vec3.mul(e, e, w), + i.Trs.toRotation(M, r), + i.Vec3.transformQuat(e, e, M), + i.Trs.toPosition(w, r), + i.Vec3.add(e, e, w), + i.Quat.mul(n, M, n), + s = s._parent; + return i.Mat4.fromRT(t, n, e), + t + }, + lookAt: function(t, e) { + this.getWorldPosition(D), + i.Vec3.sub(D, D, t), + i.Vec3.normalize(D, D), + i.Quat.fromViewUp(B, D, e), + this.setWorldRotation(B) + }, + _updateLocalMatrix: lt, + _calculWorldMatrix: function() { + this._localMatDirty & U.TRSS && this._updateLocalMatrix(); + var t = this._parent; + t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : i.Mat4.copy(this._worldMatrix, this._matrix), + this._worldMatDirty = !1 + }, + _mulMat: ut, + _updateWorldMatrix: function() { + if (this._parent && this._parent._updateWorldMatrix(), + this._worldMatDirty) { + this._calculWorldMatrix(); + for (var t = this._children, e = 0, i = t.length; e < i; e++) + t[e]._worldMatDirty = !0 + } + }, + setLocalDirty: function(t) { + this._localMatDirty |= t, + this._worldMatDirty = !0, + t === U.ALL_POSITION || t === U.POSITION ? this._renderFlag |= u.FLAG_WORLD_TRANSFORM : this._renderFlag |= u.FLAG_TRANSFORM + }, + setWorldDirty: function() { + this._worldMatDirty = !0 + }, + getLocalMatrix: function(t) { + return this._updateLocalMatrix(), + i.Mat4.copy(t, this._matrix) + }, + getWorldMatrix: function(t) { + return this._updateWorldMatrix(), + i.Mat4.copy(t, this._worldMatrix) + }, + convertToNodeSpaceAR: function(t, e) { + return this._updateWorldMatrix(), + i.Mat4.invert(V, this._worldMatrix), + t instanceof cc.Vec2 ? (e = e || new cc.Vec2, + i.Vec2.transformMat4(e, t, V)) : (e = e || new cc.Vec3, + i.Vec3.transformMat4(e, t, V)) + }, + convertToWorldSpaceAR: function(t, e) { + return this._updateWorldMatrix(), + t instanceof cc.Vec2 ? (e = e || new cc.Vec2, + i.Vec2.transformMat4(e, t, this._worldMatrix)) : (e = e || new cc.Vec3, + i.Vec3.transformMat4(e, t, this._worldMatrix)) + }, + convertToNodeSpace: function(t) { + this._updateWorldMatrix(), + i.Mat4.invert(V, this._worldMatrix); + var e = new cc.Vec2; + return i.Vec2.transformMat4(e, t, V), + e.x += this._anchorPoint.x * this._contentSize.width, + e.y += this._anchorPoint.y * this._contentSize.height, + e + }, + convertToWorldSpace: function(t) { + this._updateWorldMatrix(); + var e = new cc.Vec2(t.x - this._anchorPoint.x * this._contentSize.width,t.y - this._anchorPoint.y * this._contentSize.height); + return i.Vec2.transformMat4(e, e, this._worldMatrix) + }, + getNodeToParentTransform: function(t) { + t || (t = a.identity()), + this._updateLocalMatrix(); + var e = this._contentSize; + return N.x = -this._anchorPoint.x * e.width, + N.y = -this._anchorPoint.y * e.height, + i.Mat4.copy(V, this._matrix), + i.Mat4.transform(V, V, N), + a.fromMat4(t, V) + }, + getNodeToParentTransformAR: function(t) { + return t || (t = a.identity()), + this._updateLocalMatrix(), + a.fromMat4(t, this._matrix) + }, + getNodeToWorldTransform: function(t) { + t || (t = a.identity()), + this._updateWorldMatrix(); + var e = this._contentSize; + return N.x = -this._anchorPoint.x * e.width, + N.y = -this._anchorPoint.y * e.height, + i.Mat4.copy(V, this._worldMatrix), + i.Mat4.transform(V, V, N), + a.fromMat4(t, V) + }, + getNodeToWorldTransformAR: function(t) { + return t || (t = a.identity()), + this._updateWorldMatrix(), + a.fromMat4(t, this._worldMatrix) + }, + getParentToNodeTransform: function(t) { + return t || (t = a.identity()), + this._updateLocalMatrix(), + i.Mat4.invert(V, this._matrix), + a.fromMat4(t, V) + }, + getWorldToNodeTransform: function(t) { + return t || (t = a.identity()), + this._updateWorldMatrix(), + i.Mat4.invert(V, this._worldMatrix), + a.fromMat4(t, V) + }, + convertTouchToNodeSpace: function(t) { + return this.convertToNodeSpace(t.getLocation()) + }, + convertTouchToNodeSpaceAR: function(t) { + return this.convertToNodeSpaceAR(t.getLocation()) + }, + getBoundingBox: function() { + this._updateLocalMatrix(); + var t = this._contentSize.width + , e = this._contentSize.height + , i = cc.rect(-this._anchorPoint.x * t, -this._anchorPoint.y * e, t, e); + return i.transformMat4(i, this._matrix) + }, + getBoundingBoxToWorld: function() { + return this._parent ? (this._parent._updateWorldMatrix(), + this._getBoundingBoxTo()) : this.getBoundingBox() + }, + _getBoundingBoxTo: function() { + var t = this._contentSize.width + , e = this._contentSize.height + , i = cc.rect(-this._anchorPoint.x * t, -this._anchorPoint.y * e, t, e); + if (this._calculWorldMatrix(), + i.transformMat4(i, this._worldMatrix), + !this._children) + return i; + for (var n = this._children, r = 0; r < n.length; r++) { + var s = n[r]; + if (s && s.active) { + var a = s._getBoundingBoxTo(); + a && i.union(i, a) + } + } + return i + }, + _updateOrderOfArrival: function() { + var t = this._parent ? ++this._parent._childArrivalOrder : 0; + this._localZOrder = 4294901760 & this._localZOrder | t, + this.emit(z.SIBLING_ORDER_CHANGED) + }, + addChild: function(t, e, i) { + cc.assertID(t, 1606), + cc.assertID(null === t._parent, 1605), + t.parent = this, + void 0 !== e && (t.zIndex = e), + void 0 !== i && (t.name = i) + }, + cleanup: function() { + d && cc.director.getActionManager().removeAllActionsFromTarget(this), + o.removeListeners(this); + var t, e, i = this._children.length; + for (t = 0; t < i; ++t) + (e = this._children[t]) && e.cleanup() + }, + sortAllChildren: function() { + if (this._reorderChildDirty) { + this._reorderChildDirty = !1; + var t = this._children; + this._childArrivalOrder = 1; + for (var e = 0, i = t.length; e < i; e++) + t[e]._updateOrderOfArrival(); + if (o._setDirtyForNode(this), + t.length > 1) { + for (var n, r, s = 1, a = t.length; s < a; s++) { + n = t[s]; + for (var l = s; l > 0 && (r = t[l - 1])._localZOrder > n._localZOrder; l--) + t[l] = r; + t[l] = n + } + this.emit(z.CHILD_REORDER, this) + } + cc.director.__fastOff(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this) + } + }, + _delaySort: function() { + this._reorderChildDirty || (this._reorderChildDirty = !0, + cc.director.__fastOn(cc.Director.EVENT_AFTER_UPDATE, this.sortAllChildren, this)) + }, + _restoreProperties: !1, + onRestore: !1 + } + , dt = cc.Class(ft) + , pt = dt.prototype; + h.getset(pt, "position", pt.getPosition, pt.setPosition, !1, !0), + cc.Node = e.exports = dt + } + ), { + "./event-manager": 138, + "./event/event": 141, + "./event/event-target": 140, + "./platform/CCMacro": 198, + "./platform/js": 214, + "./renderer/render-flow": 225, + "./utils/affine-transform": 258, + "./utils/base-node": 259, + "./utils/prefab-helper": 270, + "./utils/trans-pool": 276, + "./value-types": 282 + }], + 30: [(function(t, e) { + "use strict"; + var i = t("./CCNode") + , n = t("./renderer/render-flow") + , r = (cc.Object.Flags.HideInHierarchy, + i._LocalDirtyFlag) + , s = cc.Class({ + name: "cc.PrivateNode", + extends: i, + properties: { + x: { + get: function() { + return this._originPos.x + }, + set: function(t) { + var e = this._originPos; + t !== e.x && (e.x = t, + this._posDirty(!0)) + }, + override: !0 + }, + y: { + get: function() { + return this._originPos.y + }, + set: function(t) { + var e = this._originPos; + t !== e.y && (e.y = t, + this._posDirty(!0)) + }, + override: !0 + }, + zIndex: { + get: function() { + return cc.macro.MIN_ZINDEX + }, + set: function() {}, + override: !0 + }, + showInEditor: { + default: !1, + editorOnly: !0, + override: !0 + } + }, + ctor: function() { + this._localZOrder = cc.macro.MIN_ZINDEX << 16, + this._originPos = cc.v2() + }, + _posDirty: function(t) { + this.setLocalDirty(r.POSITION), + this._renderFlag |= n.FLAG_TRANSFORM, + !0 === t && 1 & this._eventMask && this.emit(i.EventType.POSITION_CHANGED) + }, + _updateLocalMatrix: function() { + if (this._localMatDirty) { + var t = this.parent; + t && (this._trs[0] = this._originPos.x - (t._anchorPoint.x - .5) * t._contentSize.width, + this._trs[1] = this._originPos.y - (t._anchorPoint.y - .5) * t._contentSize.height), + this._super() + } + }, + getPosition: function() { + return new cc.Vec2(this._originPos) + }, + setPosition: function(t, e) { + void 0 === e && (e = (t = t.x).y); + var i = this._originPos; + i.x === t && i.y === e || (i.x = t, + i.y = e, + this._posDirty(!0)) + }, + setParent: function(t) { + var e = this._parent; + this._super(t), + e !== t && (e && e.off(i.EventType.ANCHOR_CHANGED, this._posDirty, this), + t && t.on(i.EventType.ANCHOR_CHANGED, this._posDirty, this)) + }, + _updateOrderOfArrival: function() {} + }) + , a = s.prototype; + cc.js.getset(a, "parent", a.getParent, a.setParent), + cc.js.getset(a, "position", a.getPosition, a.setPosition), + cc.PrivateNode = e.exports = s + } + ), { + "./CCNode": 29, + "./renderer/render-flow": 225 + }], + 31: [(function(t, e) { + "use strict"; + cc.Scene = cc.Class({ + name: "cc.Scene", + extends: t("./CCNode"), + properties: { + _is3DNode: { + default: !0, + override: !0 + }, + autoReleaseAssets: !1 + }, + ctor: function() { + this._anchorPoint.x = 0, + this._anchorPoint.y = 0, + this._activeInHierarchy = !1, + this._inited = !cc.game._isCloning, + this.dependAssets = null + }, + destroy: function() { + if (cc.Object.prototype.destroy.call(this)) + for (var t = this._children, e = 0; e < t.length; ++e) + t[e].active = !1; + this._active = !1, + this._activeInHierarchy = !1 + }, + _onHierarchyChanged: function() {}, + _instantiate: null, + _load: function() { + this._inited || (this._onBatchCreated(!1), + this._inited = !0) + }, + _activate: function(t) { + t = !1 !== t, + cc.director._nodeActivator.activateNode(this, t) + } + }), + e.exports = cc.Scene + } + ), { + "./CCNode": 29 + }], + 32: [(function(t, e) { + "use strict"; + var i = t("./platform/js") + , n = new (t("./platform/id-generater"))("Scheduler") + , r = function(t, e, i, n) { + this.target = t, + this.priority = e, + this.paused = i, + this.markedForDeletion = n + } + , s = []; + r.get = function(t, e, i, n) { + var a = s.pop(); + return a ? (a.target = t, + a.priority = e, + a.paused = i, + a.markedForDeletion = n) : a = new r(t,e,i,n), + a + } + , + r.put = function(t) { + s.length < 20 && (t.target = null, + s.push(t)) + } + ; + var a = function(t, e, i, n) { + this.list = t, + this.entry = e, + this.target = i, + this.callback = n + } + , o = []; + a.get = function(t, e, i, n) { + var r = o.pop(); + return r ? (r.list = t, + r.entry = e, + r.target = i, + r.callback = n) : r = new a(t,e,i,n), + r + } + , + a.put = function(t) { + o.length < 20 && (t.list = t.entry = t.target = t.callback = null, + o.push(t)) + } + ; + var l = function(t, e, i, n, r, s) { + var a = this; + a.timers = t, + a.target = e, + a.timerIndex = i, + a.currentTimer = n, + a.currentTimerSalvaged = r, + a.paused = s + } + , h = []; + function c() { + this._lock = !1, + this._scheduler = null, + this._elapsed = -1, + this._runForever = !1, + this._useDelay = !1, + this._timesExecuted = 0, + this._repeat = 0, + this._delay = 0, + this._interval = 0, + this._target = null, + this._callback = null + } + l.get = function(t, e, i, n, r, s) { + var a = h.pop(); + return a ? (a.timers = t, + a.target = e, + a.timerIndex = i, + a.currentTimer = n, + a.currentTimerSalvaged = r, + a.paused = s) : a = new l(t,e,i,n,r,s), + a + } + , + l.put = function(t) { + h.length < 20 && (t.timers = t.target = t.currentTimer = null, + h.push(t)) + } + ; + var u = c.prototype; + u.initWithCallback = function(t, e, i, n, r, s) { + return this._lock = !1, + this._scheduler = t, + this._target = i, + this._callback = e, + this._elapsed = -1, + this._interval = n, + this._delay = s, + this._useDelay = this._delay > 0, + this._repeat = r, + this._runForever = this._repeat === cc.macro.REPEAT_FOREVER, + !0 + } + , + u.getInterval = function() { + return this._interval + } + , + u.setInterval = function(t) { + this._interval = t + } + , + u.update = function(t) { + -1 === this._elapsed ? (this._elapsed = 0, + this._timesExecuted = 0) : (this._elapsed += t, + this._runForever && !this._useDelay ? this._elapsed >= this._interval && (this.trigger(), + this._elapsed = 0) : (this._useDelay ? this._elapsed >= this._delay && (this.trigger(), + this._elapsed -= this._delay, + this._timesExecuted += 1, + this._useDelay = !1) : this._elapsed >= this._interval && (this.trigger(), + this._elapsed = 0, + this._timesExecuted += 1), + this._callback && !this._runForever && this._timesExecuted > this._repeat && this.cancel())) + } + , + u.getCallback = function() { + return this._callback + } + , + u.trigger = function() { + this._target && this._callback && (this._lock = !0, + this._callback.call(this._target, this._elapsed), + this._lock = !1) + } + , + u.cancel = function() { + this._scheduler.unschedule(this._callback, this._target) + } + ; + var _ = []; + c.get = function() { + return _.pop() || new c + } + , + c.put = function(t) { + _.length < 20 && !t._lock && (t._scheduler = t._target = t._callback = null, + _.push(t)) + } + , + cc.Scheduler = function() { + this._timeScale = 1, + this._updatesNegList = [], + this._updates0List = [], + this._updatesPosList = [], + this._hashForUpdates = i.createMap(!0), + this._hashForTimers = i.createMap(!0), + this._currentTarget = null, + this._currentTargetSalvaged = !1, + this._updateHashLocked = !1, + this._arrayForTimers = [] + } + , + cc.Scheduler.prototype = { + constructor: cc.Scheduler, + _removeHashElement: function(t) { + delete this._hashForTimers[t.target._id]; + for (var e = this._arrayForTimers, i = 0, n = e.length; i < n; i++) + if (e[i] === t) { + e.splice(i, 1); + break + } + l.put(t) + }, + _removeUpdateFromHash: function(t) { + var e = t.target._id + , i = this._hashForUpdates[e]; + if (i) { + for (var n = i.list, s = i.entry, o = 0, l = n.length; o < l; o++) + if (n[o] === s) { + n.splice(o, 1); + break + } + delete this._hashForUpdates[e], + r.put(s), + a.put(i) + } + }, + _priorityIn: function(t, e, i) { + for (var n = 0; n < t.length; n++) + if (i < t[n].priority) + return void t.splice(n, 0, e); + t.push(e) + }, + _appendIn: function(t, e) { + t.push(e) + }, + enableForTarget: function(t) { + t._id || (t.__instanceId ? cc.warnID(1513) : t._id = n.getNewId()) + }, + setTimeScale: function(t) { + this._timeScale = t + }, + getTimeScale: function() { + return this._timeScale + }, + update: function(t) { + var e, i, n, r; + for (this._updateHashLocked = !0, + 1 !== this._timeScale && (t *= this._timeScale), + e = 0, + n = (i = this._updatesNegList).length; e < n; e++) + (r = i[e]).paused || r.markedForDeletion || r.target.update(t); + for (e = 0, + n = (i = this._updates0List).length; e < n; e++) + (r = i[e]).paused || r.markedForDeletion || r.target.update(t); + for (e = 0, + n = (i = this._updatesPosList).length; e < n; e++) + (r = i[e]).paused || r.markedForDeletion || r.target.update(t); + var s, a = this._arrayForTimers; + for (e = 0; e < a.length; e++) { + if (s = a[e], + this._currentTarget = s, + this._currentTargetSalvaged = !1, + !s.paused) + for (s.timerIndex = 0; s.timerIndex < s.timers.length; ++s.timerIndex) + s.currentTimer = s.timers[s.timerIndex], + s.currentTimerSalvaged = !1, + s.currentTimer.update(t), + s.currentTimer = null; + this._currentTargetSalvaged && 0 === this._currentTarget.timers.length && (this._removeHashElement(this._currentTarget), + --e) + } + for (e = 0, + i = this._updatesNegList; e < i.length; ) + (r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++; + for (e = 0, + i = this._updates0List; e < i.length; ) + (r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++; + for (e = 0, + i = this._updatesPosList; e < i.length; ) + (r = i[e]).markedForDeletion ? this._removeUpdateFromHash(r) : e++; + this._updateHashLocked = !1, + this._currentTarget = null + }, + schedule: function(t, e, i, n, r, s) { + if ("function" != typeof t) { + var a = t; + t = e, + e = a + } + 4 !== arguments.length && 5 !== arguments.length || (s = !!n, + n = cc.macro.REPEAT_FOREVER, + r = 0), + cc.assertID(e, 1502); + var o = e._id; + o || (e.__instanceId ? (cc.warnID(1513), + o = e._id = e.__instanceId) : cc.errorID(1510)); + var h, u, _ = this._hashForTimers[o]; + if (_ ? _.paused !== s && cc.warnID(1511) : (_ = l.get(null, e, 0, null, null, s), + this._arrayForTimers.push(_), + this._hashForTimers[o] = _), + null == _.timers) + _.timers = []; + else + for (u = 0; u < _.timers.length; ++u) + if ((h = _.timers[u]) && t === h._callback) + return cc.logID(1507, h.getInterval(), i), + void (h._interval = i); + (h = c.get()).initWithCallback(this, t, e, i, n, r), + _.timers.push(h), + this._currentTarget === _ && this._currentTargetSalvaged && (this._currentTargetSalvaged = !1) + }, + scheduleUpdate: function(t, e, i) { + var n = t._id; + n || (t.__instanceId ? (cc.warnID(1513), + n = t._id = t.__instanceId) : cc.errorID(1510)); + var s = this._hashForUpdates[n]; + if (s && s.entry) { + if (s.entry.priority === e) + return s.entry.markedForDeletion = !1, + void (s.entry.paused = i); + if (this._updateHashLocked) + return cc.logID(1506), + s.entry.markedForDeletion = !1, + void (s.entry.paused = i); + this.unscheduleUpdate(t) + } + var o, l = r.get(t, e, i, !1); + 0 === e ? (o = this._updates0List, + this._appendIn(o, l)) : (o = e < 0 ? this._updatesNegList : this._updatesPosList, + this._priorityIn(o, l, e)), + this._hashForUpdates[n] = a.get(o, l, t, null) + }, + unschedule: function(t, e) { + if (e && t) { + var i = e._id; + i || (e.__instanceId ? (cc.warnID(1513), + i = e._id = e.__instanceId) : cc.errorID(1510)); + var n = this._hashForTimers[i]; + if (n) + for (var r = n.timers, s = 0, a = r.length; s < a; s++) { + var o = r[s]; + if (t === o._callback) + return o !== n.currentTimer || n.currentTimerSalvaged || (n.currentTimerSalvaged = !0), + r.splice(s, 1), + c.put(o), + n.timerIndex >= s && n.timerIndex--, + void (0 === r.length && (this._currentTarget === n ? this._currentTargetSalvaged = !0 : this._removeHashElement(n))) + } + } + }, + unscheduleUpdate: function(t) { + if (t) { + var e = t._id; + e || (t.__instanceId ? (cc.warnID(1513), + e = t._id = t.__instanceId) : cc.errorID(1510)); + var i = this._hashForUpdates[e]; + i && (this._updateHashLocked ? i.entry.markedForDeletion = !0 : this._removeUpdateFromHash(i.entry)) + } + }, + unscheduleAllForTarget: function(t) { + if (t) { + var e = t._id; + e || (t.__instanceId ? (cc.warnID(1513), + e = t._id = t.__instanceId) : cc.errorID(1510)); + var i = this._hashForTimers[e]; + if (i) { + var n = i.timers; + n.indexOf(i.currentTimer) > -1 && !i.currentTimerSalvaged && (i.currentTimerSalvaged = !0); + for (var r = 0, s = n.length; r < s; r++) + c.put(n[r]); + n.length = 0, + this._currentTarget === i ? this._currentTargetSalvaged = !0 : this._removeHashElement(i) + } + this.unscheduleUpdate(t) + } + }, + unscheduleAll: function() { + this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM) + }, + unscheduleAllWithMinPriority: function(t) { + var e, i, n, r = this._arrayForTimers; + for (e = r.length - 1; e >= 0; e--) + i = r[e], + this.unscheduleAllForTarget(i.target); + var s = 0; + if (t < 0) + for (e = 0; e < this._updatesNegList.length; ) + s = this._updatesNegList.length, + (n = this._updatesNegList[e]) && n.priority >= t && this.unscheduleUpdate(n.target), + s == this._updatesNegList.length && e++; + if (t <= 0) + for (e = 0; e < this._updates0List.length; ) + s = this._updates0List.length, + (n = this._updates0List[e]) && this.unscheduleUpdate(n.target), + s == this._updates0List.length && e++; + for (e = 0; e < this._updatesPosList.length; ) + s = this._updatesPosList.length, + (n = this._updatesPosList[e]) && n.priority >= t && this.unscheduleUpdate(n.target), + s == this._updatesPosList.length && e++ + }, + isScheduled: function(t, e) { + cc.assertID(t, 1508), + cc.assertID(e, 1509); + var i = e._id; + i || (e.__instanceId ? (cc.warnID(1513), + i = e._id = e.__instanceId) : cc.errorID(1510)); + var n = this._hashForTimers[i]; + if (!n) + return !1; + if (null == n.timers) + return !1; + for (var r = n.timers, s = 0; s < r.length; ++s) + if (t === r[s]._callback) + return !0; + return !1 + }, + pauseAllTargets: function() { + return this.pauseAllTargetsWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM) + }, + pauseAllTargetsWithMinPriority: function(t) { + var e, i, n, r, s = [], a = this._arrayForTimers; + for (i = 0, + n = a.length; i < n; i++) + (e = a[i]) && (e.paused = !0, + s.push(e.target)); + if (t < 0) + for (i = 0; i < this._updatesNegList.length; i++) + (r = this._updatesNegList[i]) && r.priority >= t && (r.paused = !0, + s.push(r.target)); + if (t <= 0) + for (i = 0; i < this._updates0List.length; i++) + (r = this._updates0List[i]) && (r.paused = !0, + s.push(r.target)); + for (i = 0; i < this._updatesPosList.length; i++) + (r = this._updatesPosList[i]) && r.priority >= t && (r.paused = !0, + s.push(r.target)); + return s + }, + resumeTargets: function(t) { + if (t) + for (var e = 0; e < t.length; e++) + this.resumeTarget(t[e]) + }, + pauseTarget: function(t) { + cc.assertID(t, 1503); + var e = t._id; + e || (t.__instanceId ? (cc.warnID(1513), + e = t._id = t.__instanceId) : cc.errorID(1510)); + var i = this._hashForTimers[e]; + i && (i.paused = !0); + var n = this._hashForUpdates[e]; + n && (n.entry.paused = !0) + }, + resumeTarget: function(t) { + cc.assertID(t, 1504); + var e = t._id; + e || (t.__instanceId ? (cc.warnID(1513), + e = t._id = t.__instanceId) : cc.errorID(1510)); + var i = this._hashForTimers[e]; + i && (i.paused = !1); + var n = this._hashForUpdates[e]; + n && (n.entry.paused = !1) + }, + isTargetPaused: function(t) { + cc.assertID(t, 1505); + var e = t._id; + e || (t.__instanceId ? (cc.warnID(1513), + e = t._id = t.__instanceId) : cc.errorID(1510)); + var i = this._hashForTimers[e]; + if (i) + return i.paused; + var n = this._hashForUpdates[e]; + return !!n && n.entry.paused + } + }, + cc.Scheduler.PRIORITY_SYSTEM = 1 << 31, + cc.Scheduler.PRIORITY_NON_SYSTEM = cc.Scheduler.PRIORITY_SYSTEM + 1, + e.exports = cc.Scheduler + } + ), { + "./platform/id-generater": 210, + "./platform/js": 214 + }], + 33: [(function(t, e) { + "use strict"; + var i = t("./preprocess") + , n = t("./fetch") + , r = t("./cache") + , s = t("./helper") + , a = t("./releaseManager") + , o = t("./depend-util") + , l = t("./load") + , h = t("./pipeline") + , c = t("./task") + , u = t("./request-item") + , _ = t("./downloader") + , f = t("./parser") + , d = t("./pack-manager") + , p = t("./bundle") + , m = t("./builtins") + , y = t("./factory") + , v = t("./urlTransformer") + , g = v.parse + , A = v.combine + , x = t("./utilities") + , b = x.parseParameters + , C = x.asyncify + , T = t("./shared") + , S = T.assets + , w = T.files + , E = T.parsed + , M = T.pipeline + , D = T.transformPipeline + , B = T.fetchPipeline + , I = T.RequestType + , P = T.bundles + , R = T.BuiltinBundleName; + function O() { + this._preprocessPipe = i, + this._fetchPipe = n, + this._loadPipe = l, + this.pipeline = M.append(i).append(l), + this.fetchPipeline = B.append(i).append(n), + this.transformPipeline = D.append(g).append(A), + this.bundles = P, + this.assets = S, + this._files = w, + this._parsed = E, + this.generalImportBase = "", + this.generalNativeBase = "", + this.dependUtil = o, + this._releaseManager = a, + this.cacheAsset = !0, + this.force = !1, + this.utils = s, + this.downloader = _, + this.parser = f, + this.builtins = m, + this.packManager = d, + this.factory = y, + this.cacheManager = null, + this.presets = { + default: { + priority: 0 + }, + preload: { + maxConcurrency: 2, + maxRequestsPerFrame: 2, + priority: -1 + }, + scene: { + maxConcurrency: 8, + maxRequestsPerFrame: 8, + priority: 1 + }, + bundle: { + maxConcurrency: 8, + maxRequestsPerFrame: 8, + priority: 2 + }, + remote: { + maxRetryCount: 4 + }, + script: { + maxConcurrency: 1024, + maxRequestsPerFrame: 1024, + priority: 2 + } + } + } + O.Pipeline = h, + O.Task = c, + O.Cache = r, + O.RequestItem = u, + O.Bundle = p, + O.BuiltinBundleName = R, + O.prototype = { + constructor: O, + get main() { + return P.get(R.MAIN) + }, + get resources() { + return P.get(R.RESOURCES) + }, + get internal() { + return P.get(R.INTERNAL) + }, + init: function(t) { + t = t || Object.create(null), + this._files.clear(), + this._parsed.clear(), + this._releaseManager.init(), + this.assets.clear(), + this.bundles.clear(), + this.packManager.init(), + this.downloader.init(t.bundleVers, t.server), + this.parser.init(), + this.dependUtil.init(), + this.generalImportBase = t.importBase, + this.generalNativeBase = t.nativeBase + }, + getBundle: function(t) { + return P.get(t) + }, + removeBundle: function(t) { + t._destroy(), + P.remove(t.name) + }, + loadAny: function(t, e, i, n) { + var r = b(e, i, n); + e = r.options, + i = r.onProgress, + n = r.onComplete, + e.preset = e.preset || "default", + t = Array.isArray(t) ? t.concat() : t; + var s = new c({ + input: t, + onProgress: i, + onComplete: C(n), + options: e + }); + M.async(s) + }, + preloadAny: function(t, e, i, n) { + var r = b(e, i, n); + e = r.options, + i = r.onProgress, + n = r.onComplete, + e.preset = e.preset || "preload", + t = Array.isArray(t) ? t.concat() : t; + var s = new c({ + input: t, + onProgress: i, + onComplete: C(n), + options: e + }); + B.async(s) + }, + postLoadNative: function(t, e, i) { + if (!(t instanceof cc.Asset)) + throw new Error("input is not asset"); + var n = b(e, void 0, i); + if (e = n.options, + i = n.onComplete, + !t._native || t._nativeAsset) + return C(i)(null); + var r = o.getNativeDep(t._uuid); + if (r) { + if (!P.has(r.bundle)) { + var s = P.find((function(e) { + return e.getAssetInfo(t._uuid) + } + )); + s && (r.bundle = s.name) + } + this.loadAny(r, e, (function(e, n) { + e ? cc.error(e.message, e.stack) : t.isValid && !t._nativeAsset && (t._nativeAsset = n), + i && i(e) + } + )) + } + }, + loadRemote: function(t, e, i) { + var n = b(e, void 0, i); + if (e = n.options, + i = n.onComplete, + this.assets.has(t)) + return C(i)(null, this.assets.get(t)); + e.__isNative__ = !0, + e.preset = e.preset || "remote", + this.loadAny({ + url: t + }, e, null, (function(n, r) { + n ? (cc.error(n.message, n.stack), + i && i(n, null)) : y.create(t, r, e.ext || cc.path.extname(t), e, (function(t, e) { + i && i(t, e) + } + )) + } + )) + }, + loadScript: function(t, e, i) { + var n = b(e, void 0, i); + e = n.options, + i = n.onComplete, + e.__requestType__ = I.URL, + e.preset = e.preset || "script", + this.loadAny(t, e, i) + }, + loadBundle: function(t, e, i) { + var n = b(e, void 0, i) + , r = (e = n.options, + i = n.onComplete, + cc.path.basename(t)); + if (this.bundles.has(r)) + return C(i)(null, this.getBundle(r)); + e.preset = e.preset || "bundle", + e.ext = "bundle", + this.loadRemote(t, e, i) + }, + releaseAsset: function(t) { + a.tryRelease(t, !0) + }, + releaseUnusedAssets: function() { + S.forEach((function(t) { + a.tryRelease(t) + } + )) + }, + releaseAll: function() { + S.forEach((function(t) { + a.tryRelease(t, !0) + } + )) + }, + _transform: function(t, e) { + var i = c.create({ + input: t, + options: e + }) + , n = []; + try { + for (var r = D.sync(i), s = 0, a = r.length; s < a; s++) { + var o = r[s] + , l = o.url; + o.recycle(), + n.push(l) + } + } catch (h) { + for (s = 0, + a = i.output.length; s < a; s++) + i.output[s].recycle(); + cc.error(h.message, h.stack) + } + return i.recycle(), + n.length > 1 ? n : n[0] + } + }, + cc.AssetManager = O, + cc.assetManager = new O, + Object.defineProperty(cc, "resources", { + get: function() { + return P.get(R.RESOURCES) + } + }), + e.exports = cc.assetManager + } + ), { + "./builtins": 34, + "./bundle": 35, + "./cache": 36, + "./depend-util": 38, + "./downloader": 45, + "./factory": 46, + "./fetch": 47, + "./helper": 49, + "./load": 51, + "./pack-manager": 52, + "./parser": 53, + "./pipeline": 54, + "./preprocess": 55, + "./releaseManager": 56, + "./request-item": 57, + "./shared": 58, + "./task": 59, + "./urlTransformer": 60, + "./utilities": 61 + }], + 34: [(function(t, e) { + "use strict"; + var i = t("./cache") + , n = t("./releaseManager") + , r = t("./shared").BuiltinBundleName + , s = { + _assets: new i({ + material: new i, + effect: new i + }), + _loadBuiltins: function(t, e) { + var i = t + "s" + , n = this._assets.get(t); + return cc.assetManager.internal.loadDir(i, null, null, (function(t, i) { + if (t) + cc.error(t.message, t.stack); + else + for (var r = 0; r < i.length; r++) { + var s = i[r]; + n.add(s.name, s.addRef()) + } + e() + } + )) + }, + init: function(t) { + var e = this; + if (this.clear(), + cc.game.renderType === cc.game.RENDER_TYPE_CANVAS || !cc.assetManager.bundles.has(r.INTERNAL)) + return t && t(); + this._loadBuiltins("effect", (function() { + e._loadBuiltins("material", t) + } + )) + }, + getBuiltin: function(t, e) { + return 0 === arguments.length ? this._assets : 1 === arguments.length ? this._assets.get(t) : this._assets.get(t).get(e) + }, + clear: function() { + this._assets.forEach((function(t) { + t.forEach((function(t) { + n.tryRelease(t, !0) + } + )), + t.clear() + } + )) + } + }; + e.exports = s + } + ), { + "./cache": 36, + "./releaseManager": 56, + "./shared": 58 + }], + 35: [(function(t, e) { + "use strict"; + var i = t("./config") + , n = t("./releaseManager") + , r = t("./utilities") + , s = r.parseParameters + , a = r.parseLoadResArgs + , o = t("./shared") + , l = o.RequestType + , h = o.assets + , c = o.bundles; + function u() { + this._config = new i + } + u.prototype = { + constructor: u, + get name() { + return this._config.name + }, + get deps() { + return this._config.deps + }, + get base() { + return this._config.base + }, + getInfoWithPath: function(t, e) { + return this._config.getInfoWithPath(t, e) + }, + getDirWithPath: function(t, e, i) { + return this._config.getDirWithPath(t, e, i) + }, + getAssetInfo: function(t) { + return this._config.getAssetInfo(t) + }, + getSceneInfo: function(t) { + return this._config.getSceneInfo(t) + }, + init: function(t) { + this._config.init(t), + c.add(t.name, this) + }, + load: function(t, e, i, n) { + var r = a(e, i, n); + e = r.type, + i = r.onProgress, + n = r.onComplete, + cc.assetManager.loadAny(t, { + __requestType__: l.PATH, + type: e, + bundle: this.name, + __outputAsArray__: Array.isArray(t) + }, i, n) + }, + preload: function(t, e, i, n) { + var r = a(e, i, n); + e = r.type, + i = r.onProgress, + n = r.onComplete, + cc.assetManager.preloadAny(t, { + __requestType__: l.PATH, + type: e, + bundle: this.name + }, i, n) + }, + loadDir: function(t, e, i, n) { + var r = a(e, i, n); + e = r.type, + i = r.onProgress, + n = r.onComplete, + cc.assetManager.loadAny(t, { + __requestType__: l.DIR, + type: e, + bundle: this.name, + __outputAsArray__: !0 + }, i, n) + }, + preloadDir: function(t, e, i, n) { + var r = a(e, i, n); + e = r.type, + i = r.onProgress, + n = r.onComplete, + cc.assetManager.preloadAny(t, { + __requestType__: l.DIR, + type: e, + bundle: this.name + }, i, n) + }, + loadScene: function(t, e, i, n) { + var r = s(e, i, n); + e = r.options, + i = r.onProgress, + n = r.onComplete, + e.preset = e.preset || "scene", + e.bundle = this.name, + cc.assetManager.loadAny({ + scene: t + }, e, i, (function(t, e) { + if (t) + cc.error(t.message, t.stack), + n && n(t); + else if (e instanceof cc.SceneAsset) { + var i = e.scene; + i._id = e._uuid, + i._name = e._name, + n && n(null, e) + } else + n && n(new Error("The asset " + e._uuid + " is not a scene")) + } + )) + }, + preloadScene: function(t, e, i, n) { + var r = s(e, i, n); + e = r.options, + i = r.onProgress, + n = r.onComplete, + e.bundle = this.name, + cc.assetManager.preloadAny({ + scene: t + }, e, i, (function(e) { + e && cc.errorID(1210, t, e.message), + n && n(e) + } + )) + }, + get: function(t, e) { + var i = this.getInfoWithPath(t, e); + return h.get(i && i.uuid) + }, + release: function(t, e) { + n.tryRelease(this.get(t, e), !0) + }, + releaseUnusedAssets: function() { + var t = this; + h.forEach((function(e) { + var i = t.getAssetInfo(e._uuid); + i && !i.redirect && n.tryRelease(e) + } + )) + }, + releaseAll: function() { + var t = this; + h.forEach((function(e) { + var i = t.getAssetInfo(e._uuid); + i && !i.redirect && n.tryRelease(e, !0) + } + )) + }, + _destroy: function() { + this._config.destroy() + } + }, + e.exports = u + } + ), { + "./config": 37, + "./releaseManager": 56, + "./shared": 58, + "./utilities": 61 + }], + 36: [(function(t, e) { + "use strict"; + var i = t("../platform/js"); + function n(t) { + t ? (this._map = t, + this._count = Object.keys(t).length) : (this._map = i.createMap(!0), + this._count = 0) + } + n.prototype = { + constructor: n, + add: function(t, e) { + return t in this._map || this._count++, + this._map[t] = e + }, + get: function(t) { + return this._map[t] + }, + has: function(t) { + return t in this._map + }, + remove: function(t) { + var e = this._map[t]; + return t in this._map && (delete this._map[t], + this._count--), + e + }, + clear: function() { + 0 !== this._count && (this._map = i.createMap(!0), + this._count = 0) + }, + forEach: function(t) { + for (var e in this._map) + t(this._map[e], e) + }, + find: function(t) { + for (var e in this._map) + if (t(this._map[e], e)) + return this._map[e]; + return null + }, + get count() { + return this._count + }, + destroy: function() { + this._map = null + } + }, + e.exports = n + } + ), { + "../platform/js": 214 + }], + 37: [(function(t, e) { + "use strict"; + var i = t("../platform/js") + , n = t("./cache") + , r = t("./helper").normalize + , s = t("./utilities").processOptions; + function a() { + this.name = "", + this.base = "", + this.importBase = "", + this.nativeBase = "", + this.deps = null, + this.assetInfos = new n, + this.scenes = new n, + this.paths = new n + } + a.prototype = { + constructor: a, + init: function(t) { + s(t), + this.importBase = t.importBase || "", + this.nativeBase = t.nativeBase || "", + this.base = t.base || "", + this.name = t.name || "", + this.deps = t.deps || [], + this._initUuid(t.uuids), + this._initPath(t.paths), + this._initScene(t.scenes), + this._initPackage(t.packs), + this._initVersion(t.versions), + this._initRedirect(t.redirect) + }, + _initUuid: function(t) { + if (t) { + this.assetInfos.clear(); + for (var e = 0, i = t.length; e < i; e++) { + var n = t[e]; + this.assetInfos.add(n, { + uuid: n + }) + } + } + }, + _initPath: function(t) { + if (t) { + var e = this.paths; + for (var n in e.clear(), + t) { + var r = t[n] + , s = r[0] + , a = r[1] + , o = 3 === r.length + , l = this.assetInfos.get(n); + l.path = s, + l.ctor = i._getClassById(a), + e.has(s) ? o ? e.get(s).push(l) : e.get(s).splice(0, 0, l) : e.add(s, [l]) + } + } + }, + _initScene: function(t) { + if (t) { + var e = this.scenes; + e.clear(); + var i = this.assetInfos; + for (var n in t) { + var r = t[n] + , s = i.get(r); + s.url = n, + e.add(n, s) + } + } + }, + _initPackage: function(t) { + if (t) { + var e = this.assetInfos; + for (var i in t) { + var n = t[i] + , r = { + uuid: i, + packs: n, + ext: ".json" + }; + e.add(i, r); + for (var s = 0, a = n.length; s < a; s++) { + var o = n[s] + , l = e.get(o) + , h = l.packs; + h ? 1 === a ? h.splice(0, 0, r) : h.push(r) : l.packs = [r] + } + } + } + }, + _initVersion: function(t) { + if (t) { + var e = this.assetInfos + , i = t.import; + if (i) + for (var n = 0, r = i.length; n < r; n += 2) { + var s = i[n]; + e.get(s).ver = i[n + 1] + } + if (i = t.native) + for (n = 0, + r = i.length; n < r; n += 2) + s = i[n], + e.get(s).nativeVer = i[n + 1] + } + }, + _initRedirect: function(t) { + if (t) + for (var e = this.assetInfos, i = 0, n = t.length; i < n; i += 2) { + var r = t[i]; + e.get(r).redirect = t[i + 1] + } + }, + getInfoWithPath: function(t, e) { + if (!t) + return null; + t = r(t); + var n = this.paths.get(t); + if (n) { + if (!e) + return n[0]; + for (var s = 0, a = n.length; s < a; s++) { + var o = n[s]; + if (i.isChildClassOf(o.ctor, e)) + return o + } + } + return null + }, + getDirWithPath: function(t, e, n) { + "/" === (t = r(t))[t.length - 1] && (t = t.slice(0, -1)); + var s = n || []; + function a(t, e) { + return !(t.length > e.length) || 47 === t.charCodeAt(e.length) + } + return this.paths.forEach((function(n, r) { + if (r.startsWith(t) && a(r, t) || !t) + for (var o = 0, l = n.length; o < l; o++) { + var h = n[o]; + e && !i.isChildClassOf(h.ctor, e) || s.push(h) + } + } + )), + s + }, + getAssetInfo: function(t) { + return this.assetInfos.get(t) + }, + getSceneInfo: function(t) { + return t.endsWith(".fire") || (t += ".fire"), + "/" === t[0] || t.startsWith("db://") || (t = "/" + t), + this.scenes.find((function(e, i) { + return i.endsWith(t) + } + )) + }, + destroy: function() { + this.paths.destroy(), + this.scenes.destroy(), + this.assetInfos.destroy() + } + }, + e.exports = a + } + ), { + "../platform/js": 214, + "./cache": 36, + "./helper": 49, + "./utilities": 61 + }], + 38: [(function(t, e) { + "use strict"; + var i = (function(t) { + if (t && t.__esModule) + return t; + if (null === t || "object" != typeof t && "function" != typeof t) + return { + default: t + }; + var e = n(); + if (e && e.has(t)) + return e.get(t); + var i = {} + , r = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var s in t) + if (Object.prototype.hasOwnProperty.call(t, s)) { + var a = r ? Object.getOwnPropertyDescriptor(t, s) : null; + a && (a.get || a.set) ? Object.defineProperty(i, s, a) : i[s] = t[s] + } + return i.default = t, + e && e.set(t, i), + i + } + )(t("../platform/deserialize-compiled")); + function n() { + if ("function" != typeof WeakMap) + return null; + var t = new WeakMap; + return n = function() { + return t + } + , + t + } + var r = t("./cache") + , s = t("./deserialize") + , a = t("./shared") + , o = a.files + , l = a.parsed + , h = { + _depends: new r, + init: function() { + this._depends.clear() + }, + getNativeDep: function(t) { + var e = this._depends.get(t); + return e ? e.nativeDep && Object.assign({}, e.nativeDep) : null + }, + getDeps: function(t) { + return this._depends.has(t) ? this._depends.get(t).deps : [] + }, + getDepsRecursively: function(t) { + var e = Object.create(null) + , i = []; + return this._descend(t, e, i), + i + }, + _descend: function(t, e, i) { + for (var n = this.getDeps(t), r = 0; r < n.length; r++) { + var s = n[r]; + e[s] || (e[s] = !0, + i.push(s), + this._descend(s, e, i)) + } + }, + remove: function(t) { + this._depends.remove(t) + }, + parse: function(t, e) { + var n = null; + if (Array.isArray(e) || e.__type__) { + if (n = this._depends.get(t)) + return n; + if (Array.isArray(e) && !(0, + i.hasNativeDep)(e)) + n = { + deps: this._parseDepsFromJson(e) + }; + else + try { + var r = s(e); + (n = this._parseDepsFromAsset(r)).nativeDep && (n.nativeDep.uuid = t), + l.add(t + "@import", r) + } catch (a) { + o.remove(t + "@import"), + n = { + deps: [] + } + } + } else { + if ((n = this._depends.get(t)) && n.parsedFromExistAsset) + return n; + n = this._parseDepsFromAsset(e) + } + return this._depends.add(t, n), + n + }, + _parseDepsFromAsset: function(t) { + for (var e = { + deps: [], + parsedFromExistAsset: !0, + preventPreloadNativeObject: t.constructor.preventPreloadNativeObject, + preventDeferredLoadDependents: t.constructor.preventDeferredLoadDependents + }, i = t.__depends__, n = 0, r = i.length; n < r; n++) { + var s = i[n].uuid; + e.deps.push(s) + } + return t.__nativeDepend__ && (e.nativeDep = t._nativeDep), + e + }, + _parseDepsFromJson: function(t) { + var e = (0, + i.getDependUuidList)(t); + return e.forEach((function(t, i) { + return e[i] = cc.assetManager.utils.decodeUuid(t) + } + )), + e + } + }; + e.exports = h + } + ), { + "../platform/deserialize-compiled": 208, + "./cache": 36, + "./deserialize": 40, + "./shared": 58 + }], + 39: [(function(t) { + "use strict"; + var e = t("../platform/js"); + t("../CCDirector"); + var i = t("./utilities") + , n = t("./depend-util") + , r = t("./releaseManager") + , s = t("./downloader") + , a = t("./factory") + , o = t("./helper") + , l = [".png", ".jpg", ".bmp", ".jpeg", ".gif", ".ico", ".tiff", ".webp", ".image", ".pvr", ".pkm"] + , h = [".mp3", ".ogg", ".wav", ".m4a"]; + function c() { + return !0 + } + var u = { + transformURL: function(t) { + var e = o.getUuidFromURL(t); + if (!e) + return t; + var i = cc.assetManager.bundles.find((function(t) { + return !!t.getAssetInfo(e) + } + )); + if (!i) + return t; + var n, r = i.getAssetInfo(e); + if (!(n = t.startsWith(i.base + i._config.nativeBase) ? r.nativeVer || "" : r.ver || "") || -1 !== t.indexOf(n)) + return t; + var s = !1; + if (".ttf" === cc.path.extname(t) && (s = !0), + s) { + var a = cc.path.dirname(t) + , l = cc.path.basename(t); + t = a + "." + n + "/" + l + } else + t = t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/, (function(t) { + return t + "." + n + } + )); + return t + } + } + , _ = { + onProgress: null, + _autoReleaseSetting: Object.create(null), + get _cache() { + return cc.assetManager.assets._map + }, + load: function(t, e, i) { + void 0 === i && void 0 !== e && (i = e, + e = null), + t = Array.isArray(t) ? t : [t]; + for (var n = 0; n < t.length; n++) { + var r = t[n]; + "string" == typeof r ? t[n] = { + url: r, + __isNative__: !0 + } : (r.type && (r.ext = "." + r.type, + r.type = void 0), + r.url && (r.__isNative__ = !0)) + } + var s = [] + , o = []; + cc.assetManager.loadAny(t, null, (function(t, i, n) { + n.content && (l.includes(n.ext) ? s.push(n.content) : h.includes(n.ext) && o.push(n.content)), + e && e(t, i, n) + } + ), (function(e, n) { + var r = null; + if (!e) { + n = Array.isArray(n) ? n : [n]; + for (var l = 0; l < n.length; l++) { + var h = n[l]; + if (!(h instanceof cc.Asset)) { + var u = h + , _ = t[l].url; + s.includes(u) ? a.create(_, h, ".png", null, (function(t, e) { + u = n[l] = e + } + )) : o.includes(u) && a.create(_, h, ".mp3", null, (function(t, e) { + u = n[l] = e + } + )), + cc.assetManager.assets.add(_, u) + } + } + if (n.length > 1) { + var f = Object.create(null); + n.forEach((function(t) { + f[t._uuid] = t + } + )), + r = { + isCompleted: c, + _map: f + } + } else + r = n[0] + } + i && i(e, r) + } + )) + }, + getXMLHttpRequest: function() { + return new XMLHttpRequest + }, + _parseLoadResArgs: i.parseLoadResArgs, + getItem: function(t) { + return cc.assetManager.assets.has(t) ? { + content: cc.assetManager.assets.get(t) + } : null + }, + loadRes: function(t, e, i, n) { + var r = this._parseLoadResArgs(e, i, n) + , s = (e = r.type, + r.onProgress) + , a = r.onComplete + , o = cc.path.extname(t); + o && (t = t.slice(0, -o.length)), + cc.resources.load(t, e, s, a) + }, + loadResArray: function(t, e, i, n) { + var r = this._parseLoadResArgs(e, i, n) + , s = (e = r.type, + r.onProgress) + , a = r.onComplete; + t.forEach((function(e, i) { + var n = cc.path.extname(e); + n && (t[i] = e.slice(0, -n.length)) + } + )), + cc.resources.load(t, e, s, a) + }, + loadResDir: function(t, e, i, n) { + var r = this._parseLoadResArgs(e, i, n) + , s = (e = r.type, + r.onProgress) + , a = r.onComplete; + cc.resources.loadDir(t, e, s, (function(i, n) { + var r = []; + i || (r = cc.resources.getDirWithPath(t, e).map((function(t) { + return t.path + } + ))), + a && a(i, n, r) + } + )) + }, + getRes: function(t, e) { + return cc.assetManager.assets.has(t) ? cc.assetManager.assets.get(t) : cc.resources.get(t, e) + }, + getResCount: function() { + return cc.assetManager.assets.count + }, + getDependsRecursively: function(t) { + return t ? n.getDepsRecursively("string" == typeof t ? t : t._uuid).concat([t._uuid]) : [] + }, + get assetLoader() {}, + get md5Pipe() { + return u + }, + get downloader() { + return cc.assetManager.downloader + }, + get loader() { + return cc.assetManager.parser + }, + addDownloadHandlers: function(t) { + var e = Object.create(null); + for (var i in t) { + var n = t[i]; + e["." + i] = function(t, e, i) { + n({ + url: t + }, i) + } + } + cc.assetManager.downloader.register(e) + }, + addLoadHandlers: function(t) { + var e = Object.create(null); + for (var i in t) { + var n = t[i]; + e["." + i] = function(t, e, i) { + n({ + content: t + }, i) + } + } + cc.assetManager.parser.register(e) + }, + flowInDeps: function() {}, + release: function(t) { + if (Array.isArray(t)) + for (var e = 0; e < t.length; e++) { + var i = t[e]; + "string" == typeof i && (i = cc.assetManager.assets.get(i)), + cc.assetManager.builtins._assets.find((function(t) { + return t.find((function(t) { + return t === i + } + )) + } + )) || cc.assetManager.releaseAsset(i) + } + else if (t) { + if ("string" == typeof t && (t = cc.assetManager.assets.get(t)), + cc.assetManager.builtins._assets.find((function(e) { + return e.find((function(e) { + return e === t + } + )) + } + ))) + return; + cc.assetManager.releaseAsset(t) + } + }, + releaseAsset: function(t) { + cc.assetManager.releaseAsset(t) + }, + releaseRes: function(t, e) { + cc.resources.release(t, e) + }, + releaseResDir: function() {}, + releaseAll: function() { + cc.assetManager.releaseAll(), + cc.assetManager.assets.clear() + }, + removeItem: function(t) { + cc.assetManager.assets.remove(t) + }, + setAutoRelease: function(t, e) { + "object" == typeof t && (t = t._uuid), + this._autoReleaseSetting[t] = !!e + }, + setAutoReleaseRecursively: function(t, e) { + "object" == typeof t && (t = t._uuid), + e = !!e, + this._autoReleaseSetting[t] = e; + for (var i = n.getDepsRecursively(t), r = 0; r < i.length; r++) { + var s = i[r]; + this._autoReleaseSetting[s] = e + } + }, + isAutoRelease: function(t) { + return "object" == typeof t && (t = t._uuid), + !!this._autoReleaseSetting[t] + } + }; + s.loadSubpackage = function(t, e) { + cc.assetManager.loadBundle(t, null, e) + } + ; + var f = { + init: function(t) { + t.importBase = t.libraryPath, + t.nativeBase = t.rawAssetsBase, + cc.assetManager.init(t), + t.rawAssets && (new cc.AssetManager.Bundle).init({ + name: cc.AssetManager.BuiltinBundleName.RESOURCES, + importBase: t.importBase, + nativeBase: t.nativeBase, + paths: t.rawAssets.assets, + uuids: Object.keys(t.rawAssets.assets) + }) + }, + loadAsset: function(t, e) { + cc.assetManager.loadAny(t, e) + }, + getLibUrlNoExt: function() {}, + queryAssetInfo: function() {} + }; + cc.url = { + normalize: function(t) { + return cc.warnID(1400, "cc.url.normalize", "cc.assetManager.utils.normalize"), + cc.assetManager.utils.normalize(t) + }, + raw: function(t) { + return cc.warnID(1400, "cc.url.raw", "cc.resources.load"), + t.startsWith("resources/") ? cc.assetManager._transform({ + path: cc.path.changeExtname(t.substr(10)), + bundle: cc.AssetManager.BuiltinBundleName.RESOURCES, + __isNative__: !0, + ext: cc.path.extname(t) + }) : "" + } + }, + Object.defineProperties(cc, { + loader: { + get: function() { + return _ + } + }, + AssetLibrary: { + get: function() { + return f + } + }, + LoadingItems: { + get: function() { + return cc.warnID(1400, "cc.LoadingItems", "cc.AssetManager.Task"), + cc.AssetManager.Task + } + }, + Pipeline: { + get: function() { + return cc.warnID(1400, "cc.Pipeline", "cc.AssetManager.Pipeline"), + cc.AssetManager.Pipeline + } + } + }), + e.obsolete(cc, "cc.RawAsset", "cc.Asset"), + e.obsolete(cc.Asset.prototype, "cc.Asset.url", "nativeUrl"), + Object.defineProperties(cc.macro, { + DOWNLOAD_MAX_CONCURRENT: { + get: function() { + return cc.assetManager.downloader.maxConcurrency + }, + set: function(t) { + cc.assetManager.downloader.maxConcurrency = t + } + } + }), + Object.assign(cc.director, { + _getSceneUuid: function(t) { + cc.assetManager.main.getSceneInfo(t) + } + }), + Object.defineProperties(cc.game, { + _sceneInfos: { + get: function() { + var t = []; + return cc.assetManager.main._config.scenes.forEach((function(e) { + t.push(e) + } + )), + t + } + } + }); + var d = i.parseParameters; + i.parseParameters = function(t, e, i) { + var n = d(t, e, i); + return n.onProgress = n.onProgress || _.onProgress, + n + } + ; + var p = r._autoRelease; + r._autoRelease = function() { + p.apply(this, arguments); + for (var t = _._autoReleaseSetting, e = Object.keys(t), i = 0; i < e.length; i++) { + var n = e[i]; + if (!0 === t[n]) { + var s = cc.assetManager.assets.get(n); + s && r.tryRelease(s) + } + } + } + } + ), { + "../CCDirector": 27, + "../platform/js": 214, + "./depend-util": 38, + "./downloader": 45, + "./factory": 46, + "./helper": 49, + "./releaseManager": 56, + "./utilities": 61 + }], + 40: [(function(t, e) { + "use strict"; + var i = t("./helper"); + t("../platform/deserialize"), + e.exports = function(t, e) { + var n; + n = cc._MissingScript.safeFindClass; + var r, s = null, a = (s = cc.deserialize.Details.pool).get(); + try { + r = cc.deserialize(t, a, { + classFinder: n, + customEnv: e + }) + } catch (f) { + throw s.put(a), + f + } + for (var o = a.uuidList, l = a.uuidObjList, h = a.uuidPropList, c = [], u = 0; u < o.length; u++) { + var _ = o[u]; + c[u] = { + uuid: i.decodeUuid(_), + owner: l[u], + prop: h[u] + } + } + return r.__depends__ = c, + r._native && (r.__nativeDepend__ = !0), + s.put(a), + r + } + } + ), { + "../platform/deserialize": 209, + "../platform/deserialize-compiled": 208, + "../platform/deserialize-editor": void 0, + "./helper": 49 + }], + 41: [(function(t, e) { + "use strict"; + var i = cc.sys.__audioSupport + , n = t("./utilities").parseParameters; + e.exports = function(t, e, r) { + var s = n(e, void 0, r) + , a = (e = s.options, + r = s.onComplete, + document.createElement("audio")); + a.src = t; + var o = function() { + clearTimeout(l), + a.removeEventListener("canplaythrough", h, !1), + a.removeEventListener("error", c, !1), + i.USE_LOADER_EVENT && a.removeEventListener(i.USE_LOADER_EVENT, h, !1) + } + , l = setTimeout((function() { + 0 === a.readyState ? c() : h() + } + ), 8e3) + , h = function() { + o(), + r && r(null, a) + } + , c = function() { + o(); + var e = "load audio failure - " + t; + cc.log(e), + r && r(new Error(e)) + }; + return a.addEventListener("canplaythrough", h, !1), + a.addEventListener("error", c, !1), + i.USE_LOADER_EVENT && a.addEventListener(i.USE_LOADER_EVENT, h, !1), + a + } + } + ), { + "./utilities": 61 + }], + 42: [(function(t, e) { + "use strict"; + var i = t("./utilities").parseParameters; + e.exports = function(t, e, n) { + var r = i(e, void 0, n) + , s = (e = r.options, + n = r.onComplete, + new Image); + function a() { + s.removeEventListener("load", a), + s.removeEventListener("error", o), + n && n(null, s) + } + function o() { + s.removeEventListener("load", a), + s.removeEventListener("error", o), + n && n(new Error(cc.debug.getError(4930, t))) + } + return "file:" !== window.location.protocol && (s.crossOrigin = "anonymous"), + s.addEventListener("load", a), + s.addEventListener("error", o), + s.src = t, + s + } + } + ), { + "./utilities": 61 + }], + 43: [(function(t, e) { + "use strict"; + var i = t("./utilities").parseParameters; + e.exports = function(t, e, n, r) { + var s = i(e, n, r) + , a = (e = s.options, + n = s.onProgress, + r = s.onComplete, + new XMLHttpRequest) + , o = "download failed: " + t + ", status: "; + if (a.open("GET", t, !0), + void 0 !== e.responseType && (a.responseType = e.responseType), + void 0 !== e.withCredentials && (a.withCredentials = e.withCredentials), + void 0 !== e.mimeType && a.overrideMimeType && a.overrideMimeType(e.mimeType), + void 0 !== e.timeout && (a.timeout = e.timeout), + e.header) + for (var l in e.header) + a.setRequestHeader(l, e.header[l]); + return a.onload = function() { + 200 === a.status || 0 === a.status ? r && r(null, a.response) : r && r(new Error(o + a.status + "(no response)")) + } + , + n && (a.onprogress = function(t) { + t.lengthComputable && n(t.loaded, t.total) + } + ), + a.onerror = function() { + r && r(new Error(o + a.status + "(error)")) + } + , + a.ontimeout = function() { + r && r(new Error(o + a.status + "(time out)")) + } + , + a.onabort = function() { + r && r(new Error(o + a.status + "(abort)")) + } + , + a.send(null), + a + } + } + ), { + "./utilities": 61 + }], + 44: [(function(t, e) { + "use strict"; + var i = t("./utilities").parseParameters + , n = {}; + e.exports = function(t, e, r) { + var s = i(e, void 0, r); + if (e = s.options, + r = s.onComplete, + n[t]) + return r && r(null); + var a = document + , o = document.createElement("script"); + function l() { + o.parentNode.removeChild(o), + o.removeEventListener("load", l, !1), + o.removeEventListener("error", h, !1), + n[t] = !0, + r && r(null) + } + function h() { + o.parentNode.removeChild(o), + o.removeEventListener("load", l, !1), + o.removeEventListener("error", h, !1), + r && r(new Error(cc.debug.getError(4928, t))) + } + "file:" !== window.location.protocol && (o.crossOrigin = "anonymous"), + o.async = e.async, + o.src = t, + o.addEventListener("load", l, !1), + o.addEventListener("error", h, !1), + a.body.appendChild(o) + } + } + ), { + "./utilities": 61 + }], + 45: [(function(t, e) { + "use strict"; + var i = t("../platform/js") + , n = t("../CCDebug") + , r = t("./font-loader").loadFont + , s = t("../platform/utils").callInNextTick + , a = t("./download-dom-image") + , o = t("./download-dom-audio") + , l = t("./download-file") + , h = t("./download-script.js") + , c = t("./cache") + , u = t("./shared").files + , _ = t("../platform/CCSys") + , f = _.__audioSupport + , d = _.capabilities + , p = t("./utilities") + , m = p.urlAppendTimestamp + , y = p.retry + , v = /^(?:\w+:\/\/|\.+\/).+/ + , g = function(t, e, i) { + e.audioLoadMode !== cc.AudioClip.LoadMode.DOM_AUDIO ? C(t, e, i) : o(t, e, i) + } + , A = (g = 0 === (f.format || []).length ? function(t, e, i) { + i(new Error(n.getError(4927))) + } + : f.WEB_AUDIO ? g : o, + function() { + var t = d.imageBitmap && cc.macro.ALLOW_IMAGE_BITMAP ? x : a; + t.apply(this, arguments) + } + ) + , x = function(t, e, i) { + e.responseType = "blob", + l(t, e, e.onFileProgress, i) + } + , b = function(t, e, i) { + e.responseType = "json", + l(t, e, e.onFileProgress, (function(t, e) { + if (!t && "string" == typeof e) + try { + e = JSON.parse(e) + } catch (n) { + t = n + } + i && i(t, e) + } + )) + } + , C = function(t, e, i) { + e.responseType = "arraybuffer", + l(t, e, e.onFileProgress, i) + } + , T = function(t, e, i) { + e.responseType = "text", + l(t, e, e.onFileProgress, i) + } + , S = function(t, e, i) { + i(null, t) + } + , w = new c + , E = [] + , M = !1 + , D = 0 + , B = 0 + , I = -1 + , P = !1 + , R = function() { + var t = Date.now() + , e = cc.director._deltaTime > L._maxInterval ? L._maxInterval : cc.director._deltaTime; + t - I > 1e3 * e && (B = 0, + I = t) + } + , O = function t(e, i) { + for (P = !1, + R(); E.length > 0 && D < e && B < i; ) { + M && (E.sort((function(t, e) { + return t.priority - e.priority + } + )), + M = !1); + var n = E.pop(); + if (!n) + break; + D++, + B++, + n.invoke() + } + E.length > 0 && D < e && (s(t, e, i), + P = !0) + } + , L = { + _remoteServerAddress: "", + _maxInterval: 1 / 30, + get remoteServerAddress() { + return this._remoteServerAddress + }, + maxConcurrency: 6, + maxRequestsPerFrame: 6, + maxRetryCount: 3, + appendTimeStamp: !1, + limited: !0, + retryInterval: 2e3, + bundleVers: null, + downloadDomImage: a, + downloadDomAudio: o, + downloadFile: l, + downloadScript: h, + init: function(t, e) { + w.clear(), + E.length = 0, + this._remoteServerAddress = e || "", + this.bundleVers = t || Object.create(null) + }, + register: function(t, e) { + "object" == typeof t ? i.mixin(F, t) : F[t] = e + }, + download: function(t, e, i, n, r) { + var a, o, l = F[i] || F.default, h = this; + if (a = u.get(t)) + r(null, a); + else if (o = w.get(t)) { + o.push(r); + for (var c = 0, _ = E.length; c < _; c++) { + var f = E[c]; + if (f.id === t) { + var d = n.priority || 0; + return void (f.priority < d && (f.priority = d, + M = !0)) + } + } + } else { + var p = void 0 !== n.maxRetryCount ? n.maxRetryCount : this.maxRetryCount + , v = void 0 !== n.maxConcurrency ? n.maxConcurrency : this.maxConcurrency + , g = void 0 !== n.maxRequestsPerFrame ? n.maxRequestsPerFrame : this.maxRequestsPerFrame; + y((function(i, a) { + if (0 === i && w.add(t, [r]), + !h.limited) + return l(m(e), n, a); + function o() { + l(m(e), n, (function() { + D--, + !P && E.length > 0 && (s(O, v, g), + P = !0), + a.apply(this, arguments) + } + )) + } + R(), + D < v && B < g ? (o(), + D++, + B++) : (E.push({ + id: t, + priority: n.priority || 0, + invoke: o + }), + M = !0, + !P && D < v && (s(O, v, g), + P = !0)) + } + ), p, this.retryInterval, (function(e, i) { + e || u.add(t, i); + for (var n = w.remove(t), r = 0, s = n.length; r < s; r++) + n[r](e, i) + } + )) + } + } + } + , F = { + ".png": A, + ".jpg": A, + ".bmp": A, + ".jpeg": A, + ".gif": A, + ".ico": A, + ".tiff": A, + ".webp": A, + ".image": A, + ".pvr": C, + ".pkm": C, + ".mp3": g, + ".ogg": g, + ".wav": g, + ".m4a": g, + ".txt": T, + ".xml": T, + ".vsh": T, + ".fsh": T, + ".atlas": T, + ".tmx": T, + ".tsx": T, + ".json": b, + ".ExportJson": b, + ".plist": T, + ".fnt": T, + ".font": r, + ".eot": r, + ".ttf": r, + ".woff": r, + ".svg": r, + ".ttc": r, + ".mp4": S, + ".avi": S, + ".mov": S, + ".mpg": S, + ".mpeg": S, + ".rm": S, + ".rmvb": S, + ".binary": C, + ".bin": C, + ".dbbin": C, + ".skel": C, + ".js": h, + bundle: function(t, e, i) { + var n = cc.path.basename(t) + , r = t; + v.test(r) || (r = "assets/" + n); + var s = e.version || L.bundleVers[n] + , a = 0 + , o = null + , l = null; + b(r + "/config." + (s ? s + "." : "") + "json", e, (function(t, e) { + t && (l = t), + (o = e) && (o.base = r + "/"), + 2 == ++a && i(l, o) + } + )), + h(r + "/index." + (s ? s + "." : "") + "js", e, (function(t) { + t && (l = t), + 2 == ++a && i(l, o) + } + )) + }, + default: T + }; + L._downloaders = F, + e.exports = L + } + ), { + "../CCDebug": 26, + "../platform/CCSys": 202, + "../platform/js": 214, + "../platform/utils": 217, + "./cache": 36, + "./download-dom-audio": 41, + "./download-dom-image": 42, + "./download-file": 43, + "./download-script.js": 44, + "./font-loader": 48, + "./shared": 58, + "./utilities": 61 + }], + 46: [(function(t, e) { + "use strict"; + var i = t("./bundle") + , n = t("./cache") + , r = t("./shared") + , s = r.assets + , a = r.bundles + , o = new n; + function l(t, e, i, n) { + var r = null + , s = null; + try { + (r = new cc.Texture2D)._nativeUrl = t, + r._nativeAsset = e + } catch (a) { + s = a + } + n && n(s, r) + } + function h(t, e, i, n) { + var r = new cc.AudioClip; + r._nativeUrl = t, + r._nativeAsset = e, + r.duration = e.duration, + n && n(null, r) + } + function c(t, e, i, n) { + var r = new cc.JsonAsset; + r.json = e, + n && n(null, r) + } + function u(t, e, i, n) { + var r = new cc.TextAsset; + r.text = e, + n && n(null, r) + } + function _(t, e, i, n) { + var r = new cc.TTFFont; + r._nativeUrl = t, + r._nativeAsset = e, + n && n(null, r) + } + function f(t, e, i, n) { + var r = new cc.BufferAsset; + r._nativeUrl = t, + r._nativeAsset = e, + n && n(null, r) + } + var d = { + register: function(t, e) { + "object" == typeof t ? cc.js.mixin(p, t) : p[t] = e + }, + create: function(t, e, i, n, r) { + var a, l, h = p[i] || p.default; + (a = s.get(t)) ? r(null, a) : (l = o.get(t)) ? l.push(r) : (o.add(t, [r]), + h(t, e, n, (function(e, i) { + !e && i instanceof cc.Asset && (i._uuid = t, + s.add(t, i)); + for (var n = o.remove(t), r = 0, a = n.length; r < a; r++) + n[r](e, i) + } + ))) + } + } + , p = { + ".png": l, + ".jpg": l, + ".bmp": l, + ".jpeg": l, + ".gif": l, + ".ico": l, + ".tiff": l, + ".webp": l, + ".image": l, + ".pvr": l, + ".pkm": l, + ".mp3": h, + ".ogg": h, + ".wav": h, + ".m4a": h, + ".txt": u, + ".xml": u, + ".vsh": u, + ".fsh": u, + ".atlas": u, + ".tmx": u, + ".tsx": u, + ".fnt": u, + ".json": c, + ".ExportJson": c, + ".font": _, + ".eot": _, + ".ttf": _, + ".woff": _, + ".svg": _, + ".ttc": _, + ".binary": f, + ".bin": f, + ".dbbin": f, + ".skel": f, + bundle: function(t, e, n, r) { + var s = a.get(e.name); + s || (s = new i, + e.base = e.base || t + "/", + s.init(e)), + r && r(null, s) + }, + default: function(t, e, i, n) { + var r = new cc.Asset; + r._nativeUrl = t, + r._nativeAsset = e, + n && n(null, r) + } + }; + e.exports = d + } + ), { + "./bundle": 35, + "./cache": 36, + "./shared": 58 + }], + 47: [(function(t, e) { + "use strict"; + var i = t("./pack-manager") + , n = t("./task") + , r = t("./utilities") + , s = r.getDepends + , a = r.clear + , o = r.forEach + , l = t("./shared") + , h = l.assets + , c = l.fetchPipeline; + function u(t) { + for (var e = t.output, i = 0, n = e.length; i < n; i++) + e[i].content && e[i].content.decRef(!1) + } + function _(t, e, i, n, r, a, o) { + var l = e.options.__exclude__ + , h = e.progress; + t.content = i, + t.file = n, + e.output.push(t), + r && (l[t.uuid] = !0, + s(t.uuid, n || i, l, a, !0, !1, t.config), + h.total = o + a.length), + h.canInvoke && e.dispatch("progress", ++h.finish, h.total, t) + } + e.exports = function(t, e) { + var r = !1; + t.progress || (t.progress = { + finish: 0, + total: t.input.length, + canInvoke: !0 + }, + r = !0); + var s = t.options + , l = [] + , f = t.progress + , d = f.total; + s.__exclude__ = s.__exclude__ || Object.create(null), + t.output = [], + o(t.input, (function(n, s) { + if (!n.isNative && h.has(n.uuid)) { + var a = h.get(n.uuid); + return a.addRef(), + _(n, t, a, null, a.__asyncLoadAssets__, l, d), + s() + } + i.load(n, t.options, (function(i, a) { + i ? t.isFinish || (!cc.assetManager.force || r ? (cc.error(i.message, i.stack), + f.canInvoke = !1, + e(i)) : _(n, t, null, null, !1, l, d)) : t.isFinish || _(n, t, null, a, !n.isNative, l, d), + s() + } + )) + } + ), (function() { + if (t.isFinish) + return a(t, !0), + t.dispatch("error"); + if (l.length > 0) { + var i = n.create({ + name: t.name + " dependencies", + input: l, + progress: f, + options: s, + onProgress: t.onProgress, + onError: n.prototype.recycle, + onComplete: function(n) { + n || (t.output.push.apply(t.output, this.output), + i.recycle()), + r && u(t), + e(n) + } + }); + c.async(i) + } else + r && u(t), + e() + } + )) + } + } + ), { + "./pack-manager": 52, + "./shared": 58, + "./task": 59, + "./utilities": 61 + }], + 48: [(function(t, e) { + "use strict"; + var i, n = t("../utils/text-utils"), r = null, s = "BES bswy:->@123\u4e01\u3041\u1101", a = Object.create(null), o = -1, l = [], h = 3e3, c = (i = void 0, + function() { + if (void 0 === i) + if (window.FontFace) { + var t = /Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent) + , e = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent) && /Apple/.exec(window.navigator.vendor); + i = t ? parseInt(t[1], 10) > 42 : !e + } else + i = !1; + return i + } + ); + function u() { + for (var t = !0, e = Date.now(), i = l.length - 1; i >= 0; i--) { + var a = l[i] + , c = a.fontFamilyName; + if (e - a.startTime > h) + cc.warnID(4933, c), + a.onComplete(null, c), + l.splice(i, 1); + else { + var u = a.refWidth + , _ = "40px " + c; + r.font = _, + u !== n.safeMeasureText(r, s, _) ? (l.splice(i, 1), + a.onComplete(null, c)) : t = !1 + } + } + t && (clearInterval(o), + o = -1) + } + var _ = { + loadFont: function(t, e, i) { + var f = _._getFontFamily(t); + if (a[f]) + return i(null, f); + if (!r) { + var d = document.createElement("canvas"); + d.width = 100, + d.height = 100, + r = d.getContext("2d") + } + var p = "40px " + f; + r.font = p; + var m = n.safeMeasureText(r, s, p) + , y = document.createElement("style"); + y.type = "text/css"; + var v = ""; + isNaN(f - 0) ? v += "@font-face { font-family:" + f + "; src:" : v += "@font-face { font-family:'" + f + "'; src:", + v += "url('" + t + "');", + y.textContent = v + "}", + document.body.appendChild(y); + var g, A, x, b, C, T, S = document.createElement("div"), w = S.style; + if (w.fontFamily = f, + S.innerHTML = ".", + w.position = "absolute", + w.left = "-100px", + w.top = "-100px", + document.body.appendChild(S), + c()) + g = Date.now(), + A = f, + x = i, + b = new Promise(function(t, e) { + (function i() { + Date.now() - g >= h ? e() : document.fonts.load("40px " + A).then((function(e) { + e.length >= 1 ? t() : setTimeout(i, 100) + } + ), (function() { + e() + } + )) + } + )() + } + ), + C = null, + T = new Promise(function(t, e) { + C = setTimeout(e, h) + } + ), + Promise.race([T, b]).then((function() { + C && (clearTimeout(C), + C = null), + x(null, A) + } + ), (function() { + cc.warnID(4933, A), + x(null, A) + } + )); + else { + var E = { + fontFamilyName: f, + refWidth: m, + onComplete: i, + startTime: Date.now() + }; + l.push(E), + -1 === o && (o = setInterval(u, 100)) + } + a[f] = y + }, + _getFontFamily: function(t) { + var e = t.lastIndexOf(".ttf"); + if (-1 === e) + return t; + var i, n = t.lastIndexOf("/"); + return -1 !== (i = -1 === n ? t.substring(0, e) + "_LABEL" : t.substring(n + 1, e) + "_LABEL").indexOf(" ") && (i = '"' + i + '"'), + i + } + }; + e.exports = _ + } + ), { + "../utils/text-utils": 274 + }], + 49: [(function(t, e) { + "use strict"; + var i, n = t("./shared").bundles, r = { + decodeUuid: t("../utils/decode-uuid"), + getUuidFromURL: (i = /.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/, + function(t) { + var e = t.match(i); + return e ? e[1] : "" + } + ), + getUrlWithUuid: function(t, e) { + (e = e || Object.create(null)).__isNative__ = e.isNative, + e.ext = e.nativeExt; + var i = n.find((function(e) { + return e.getAssetInfo(t) + } + )); + return i && (e.bundle = i.name), + cc.assetManager._transform(t, e) + }, + isScene: function(t) { + return t && (t.constructor === cc.SceneAsset || t instanceof cc.Scene) + }, + normalize: function(t) { + return t && (46 === t.charCodeAt(0) && 47 === t.charCodeAt(1) ? t = t.slice(2) : 47 === t.charCodeAt(0) && (t = t.slice(1))), + t + } + }; + e.exports = r + } + ), { + "../utils/decode-uuid": 262, + "./shared": 58 + }], + 50: [(function(t) { + "use strict"; + t("./deprecated"), + t("./CCAssetManager") + } + ), { + "./CCAssetManager": 33, + "./deprecated": 39 + }], + 51: [(function(t, e) { + "use strict"; + var i = t("./pack-manager") + , n = t("./pipeline") + , r = t("./parser") + , s = t("./utilities") + , a = s.getDepends + , o = s.cache + , l = s.gatherAsset + , h = s.setProperties + , c = s.forEach + , u = s.clear + , _ = s.checkCircleReference + , f = t("./shared") + , d = f.assets + , p = f.files + , m = f.parsed + , y = f.pipeline + , v = t("./task") + , g = new n("loadOneAsset",[function(t, e) { + var n = t.output = t.input + , r = n.options + , s = n.isNative + , a = n.uuid + , o = n.file + , l = r.reload; + if (o || !l && !s && d.has(a)) + return e(); + i.load(n, t.options, (function(t, i) { + n.file = i, + e(t) + } + )) + } + , function(t, e) { + var i = t.output = t.input + , n = t.progress + , s = t.options.__exclude__ + , a = i.id + , o = i.file + , l = i.options; + if (i.isNative) + r.parse(a, o, i.ext, l, (function(r, s) { + if (r) + return e(r); + i.content = s, + n.canInvoke && t.dispatch("progress", ++n.finish, n.total, i), + p.remove(a), + m.remove(a), + e() + } + )); + else { + var h = i.uuid; + if (h in s) { + var c = s[h] + , u = c.finish + , f = c.content + , y = c.err + , v = c.callbacks; + n.canInvoke && t.dispatch("progress", ++n.finish, n.total, i), + u || _(h, h, s) ? (f && f.addRef && f.addRef(), + i.content = f, + e(y)) : v.push({ + done: e, + item: i + }) + } else if (!l.reload && d.has(h)) { + var g = d.get(h); + l.__asyncLoadAssets__ || !g.__asyncLoadAssets__ ? (i.content = g.addRef(), + n.canInvoke && t.dispatch("progress", ++n.finish, n.total, i), + e()) : A(t, g, e, !1) + } else + r.parse(a, o, "import", l, (function(i, n) { + if (i) + return e(i); + n._uuid = h, + A(t, n, e, !0) + } + )) + } + } + ]); + function A(t, e, i, n) { + var r = t.input + , s = t.progress + , l = r.uuid + , c = r.id + , u = r.options + , _ = r.config + , f = u.__asyncLoadAssets__ + , d = u.cacheAsset + , g = []; + e.addRef && e.addRef(), + a(l, e, Object.create(null), g, !1, f, _), + s.canInvoke && t.dispatch("progress", ++s.finish, s.total += g.length, r); + var A = t.options.__exclude__[l] = { + content: e, + finish: !1, + callbacks: [{ + done: i, + item: r + }] + } + , x = v.create({ + input: g, + options: t.options, + onProgress: t.onProgress, + onError: v.prototype.recycle, + progress: s, + onComplete: function(t) { + if (e.decRef && e.decRef(!1), + e.__asyncLoadAssets__ = f, + A.finish = !0, + A.err = t, + !t) { + for (var i = Array.isArray(x.output) ? x.output : [x.output], r = Object.create(null), s = 0, a = i.length; s < a; s++) { + var u = i[s]; + u && (r[u instanceof cc.Asset ? u._uuid + "@import" : l + "@native"] = u) + } + if (n) { + if (!h(l, e, r) && !e.__onLoadInvoked__) + try { + e.onLoad && e.onLoad(), + e.__onLoadInvoked__ = !0 + } catch (b) { + cc.error(b.message, b.stack) + } + p.remove(c), + m.remove(c), + o(l, e, void 0 !== d ? d : cc.assetManager.cacheAsset) + } else if (e.__nativeDepend__ && !e._nativeAsset && !h(l, e, r) && !e.__onLoadInvoked__) + try { + e.onLoad && e.onLoad(), + e.__onLoadInvoked__ = !0 + } catch (b) { + cc.error(b.message, b.stack) + } + x.recycle() + } + for (var _ = A.callbacks, y = 0, v = _.length; y < v; y++) { + var g = _[y]; + e.addRef && e.addRef(), + g.item.content = e, + g.done(t) + } + _.length = 0 + } + }); + y.async(x) + } + e.exports = function(t, e) { + var i = !1; + t.progress || (t.progress = { + finish: 0, + total: t.input.length, + canInvoke: !0 + }, + i = !0); + var n = t.options + , r = t.progress; + n.__exclude__ = n.__exclude__ || Object.create(null), + t.output = [], + c(t.input, (function(s, a) { + var o = v.create({ + input: s, + onProgress: t.onProgress, + options: n, + progress: r, + onComplete: function(n, s) { + n && !t.isFinish && (!cc.assetManager.force || i ? (cc.error(n.message, n.stack), + r.canInvoke = !1, + e(n)) : r.canInvoke && t.dispatch("progress", ++r.finish, r.total, s)), + t.output.push(s), + o.recycle(), + a() + } + }); + g.async(o) + } + ), (function() { + if (n.__exclude__ = null, + t.isFinish) + return u(t, !0), + t.dispatch("error"); + l(t), + u(t, !0), + e() + } + )) + } + } + ), { + "./pack-manager": 52, + "./parser": 53, + "./pipeline": 54, + "./shared": 58, + "./task": 59, + "./utilities": 61 + }], + 52: [(function(t, e) { + "use strict"; + var i = t("../platform/deserialize-compiled") + , n = t("./downloader") + , r = t("./cache") + , s = t("../platform/js") + , a = t("./shared").files + , o = new r; + function l(t) { + return o.has(t.uuid) + } + var h = { + unpackJson: function(t, e, n, r) { + var a = s.createMap(!0) + , o = null; + if (Array.isArray(e)) { + (e = (0, + i.unpackJSONs)(e)).length !== t.length && cc.errorID(4915); + for (var l = 0; l < t.length; l++) + a[t[l] + "@import"] = e[l] + } else { + var h = s._getClassId(cc.Texture2D); + if (e.type === h) { + if (e.data) { + var c = e.data.split("|"); + c.length !== t.length && cc.errorID(4915); + for (var u = 0; u < t.length; u++) + a[t[u] + "@import"] = (0, + i.packCustomObjData)(h, c[u], !0) + } + } else + o = new Error("unmatched type pack!"), + a = null + } + r && r(o, a) + }, + init: function() { + o.clear() + }, + register: function(t, e) { + "object" == typeof t ? s.mixin(c, t) : c[t] = e + }, + unpack: function(t, e, i, n, r) { + e ? (0, + c[i])(t, e, n, r) : r && r(new Error("package data is wrong!")) + }, + load: function(t, e, i) { + if (t.isNative || !t.info || !t.info.packs) + return n.download(t.id, t.url, t.ext, t.options, i); + if (a.has(t.id)) + return i(null, a.get(t.id)); + var r = t.info.packs + , s = r.find(l); + if (s) + return o.get(s.uuid).push({ + onComplete: i, + id: t.id + }); + s = r[0], + o.add(s.uuid, [{ + onComplete: i, + id: t.id + }]); + var c = cc.assetManager._transform(s.uuid, { + ext: s.ext, + bundle: t.config.name + }); + n.download(s.uuid, c, s.ext, t.options, (function(e, i) { + a.remove(s.uuid), + e && cc.error(e.message, e.stack), + h.unpack(s.packs, i, s.ext, t.options, (function(t, e) { + if (!t) + for (var i in e) + a.add(i, e[i]); + for (var n = o.remove(s.uuid), r = 0, l = n.length; r < l; r++) { + var h = n[r]; + if (t) + h.onComplete(t); + else { + var c = e[h.id]; + c ? h.onComplete(null, c) : h.onComplete(new Error("can not retrieve data from package")) + } + } + } + )) + } + )) + } + } + , c = { + ".json": h.unpackJson + }; + e.exports = h + } + ), { + "../platform/deserialize-compiled": 208, + "../platform/js": 214, + "./cache": 36, + "./downloader": 45, + "./shared": 58 + }], + 53: [(function(t, e) { + "use strict"; + var i = t("../platform/CCSAXParser").plistParser + , n = t("../platform/js") + , r = t("./deserialize") + , s = t("./cache") + , a = t("./helper").isScene + , o = t("./shared") + , l = o.parsed + , h = o.files + , c = t("../platform/CCSys") + , u = c.__audioSupport + , _ = c.capabilities + , f = new s + , d = { + parseImage: function(t, e, i) { + if (_.imageBitmap && t instanceof Blob) { + var n = {}; + n.imageOrientation = e.__flipY__ ? "flipY" : "none", + n.premultiplyAlpha = e.__premultiplyAlpha__ ? "premultiply" : "none", + createImageBitmap(t, n).then((function(t) { + t.flipY = !!e.__flipY__, + t.premultiplyAlpha = !!e.__premultiplyAlpha__, + i && i(null, t) + } + ), (function(t) { + i && i(t, null) + } + )) + } else + i && i(null, t) + }, + parseAudio: function(t, e, i) { + t instanceof ArrayBuffer ? u.context.decodeAudioData(t, (function(t) { + i && i(null, t) + } + ), (function(t) { + i && i(t, null) + } + )) : i && i(null, t) + }, + parsePVRTex: function(t, e, i) { + var n = null + , r = null; + try { + var s = t instanceof ArrayBuffer ? t : t.buffer + , a = new Int32Array(s,0,13); + if (55727696 != a[0]) + throw new Error("Invalid magic number in PVR header"); + var o = a[7] + , l = a[6] + , h = a[12] + 52; + r = { + _data: new Uint8Array(s,h), + _compressed: !0, + width: o, + height: l + } + } catch (c) { + n = c + } + i && i(n, r) + }, + parsePKMTex: (function() { + function t(t, e) { + return t[e] << 8 | t[e + 1] + } + return function(e, i, n) { + var r = null + , s = null; + try { + var a = e instanceof ArrayBuffer ? e : e.buffer + , o = new Uint8Array(a) + , l = t(o, 6); + if (0 !== l && 1 !== l && 3 !== l) + return new Error("Invalid magic number in ETC header"); + var h = t(o, 12) + , c = t(o, 14); + t(o, 8), + t(o, 10), + s = { + _data: new Uint8Array(a,16), + _compressed: !0, + width: h, + height: c + } + } catch (u) { + r = u + } + n && n(r, s) + } + } + )(), + parsePlist: function(t, e, n) { + var r = null + , s = i.parse(t); + s || (r = new Error("parse failed")), + n && n(r, s) + }, + parseImport: function(t, e, i) { + if (!t) + return i && i(new Error("Json is empty")); + var n, s = null; + try { + n = r(t, e) + } catch (a) { + s = a + } + i && i(s, n) + }, + init: function() { + f.clear() + }, + register: function(t, e) { + "object" == typeof t ? n.mixin(p, t) : p[t] = e + }, + parse: function(t, e, i, n, r) { + var s, o, c; + (s = l.get(t)) ? r(null, s) : (o = f.get(t)) ? o.push(r) : (c = p[i]) ? (f.add(t, [r]), + c(e, n, (function(e, i) { + e ? h.remove(t) : a(i) || l.add(t, i); + for (var n = f.remove(t), r = 0, s = n.length; r < s; r++) + n[r](e, i) + } + ))) : r(null, e) + } + } + , p = { + ".png": d.parseImage, + ".jpg": d.parseImage, + ".bmp": d.parseImage, + ".jpeg": d.parseImage, + ".gif": d.parseImage, + ".ico": d.parseImage, + ".tiff": d.parseImage, + ".webp": d.parseImage, + ".image": d.parseImage, + ".pvr": d.parsePVRTex, + ".pkm": d.parsePKMTex, + ".mp3": d.parseAudio, + ".ogg": d.parseAudio, + ".wav": d.parseAudio, + ".m4a": d.parseAudio, + ".plist": d.parsePlist, + import: d.parseImport + }; + e.exports = d + } + ), { + "../platform/CCSAXParser": 200, + "../platform/CCSys": 202, + "../platform/js": 214, + "./cache": 36, + "./deserialize": 40, + "./helper": 49, + "./shared": 58 + }], + 54: [(function(t, e) { + "use strict"; + var i = t("./task") + , n = 0; + function r(t, e) { + if (Array.isArray(e)) { + this.id = n++, + this.name = t, + this.pipes = []; + for (var i = 0, r = e.length; i < r; i++) + "function" == typeof e[i] && this.pipes.push(e[i]) + } else + cc.warn("funcs must be an array") + } + r.prototype = { + constructor: r, + insert: function(t, e) { + if (!("function" != typeof t || e > this.pipes.length)) + return this.pipes.splice(e, 0, t), + this; + cc.warnID(4921) + }, + append: function(t) { + if ("function" == typeof t) + return this.pipes.push(t), + this + }, + remove: function(t) { + if ("number" == typeof t) + return this.pipes.splice(t, 1), + this + }, + sync: function(t) { + var e = this.pipes; + if (t instanceof i && 0 !== e.length) { + null != t.output && (t.input = t.output, + t.output = null), + t._isFinish = !1; + for (var n = 0, r = e.length; n < r; ) { + var s = (0, + e[n])(t); + if (s) + return t._isFinish = !0, + s; + ++n !== r && (t.input = t.output, + t.output = null) + } + return t._isFinish = !0, + t.output + } + }, + async: function(t) { + var e = this.pipes; + t instanceof i && 0 !== e.length && (null != t.output && (t.input = t.output, + t.output = null), + t._isFinish = !1, + this._flow(0, t)) + }, + _flow: function(t, e) { + var i = this; + (0, + this.pipes[t])(e, (function(n) { + n ? (e._isFinish = !0, + e.onComplete && e.onComplete(n)) : ++t < i.pipes.length ? (e.input = e.output, + e.output = null, + i._flow(t, e)) : (e._isFinish = !0, + e.onComplete && e.onComplete(n, e.output)) + } + )) + } + }, + e.exports = r + } + ), { + "./task": 59 + }], + 55: [(function(t, e) { + "use strict"; + var i = t("./task") + , n = t("./shared") + , r = n.transformPipeline + , s = n.RequestType; + e.exports = function(t, e) { + var n = t.options + , a = Object.create(null) + , o = Object.create(null); + for (var l in n) + switch (l) { + case s.PATH: + case s.UUID: + case s.DIR: + case s.SCENE: + case s.URL: + break; + case "__requestType__": + case "__isNative__": + case "ext": + case "type": + case "__nativeName__": + case "audioLoadMode": + case "bundle": + a[l] = n[l]; + break; + case "__exclude__": + case "__outputAsArray__": + o[l] = n[l]; + break; + default: + a[l] = n[l], + o[l] = n[l] + } + t.options = o; + var h = i.create({ + input: t.input, + options: a + }) + , c = null; + try { + t.output = t.source = r.sync(h) + } catch (f) { + c = f; + for (var u = 0, _ = h.output.length; u < _; u++) + h.output[u].recycle() + } + h.recycle(), + e(c) + } + } + ), { + "./shared": 58, + "./task": 59 + }], + 56: [(function(t, e) { + "use strict"; + var i = t("./depend-util") + , n = t("./cache"); + t("../assets/CCAsset"); + var r = t("./shared").assets + , s = t("../platform/utils").callInNextTick; + function a(t, e) { + t._uuid && e.push(t._uuid) + } + function o(t, e) { + for (var i = Object.getOwnPropertyNames(t), n = 0; n < i.length; n++) { + var r = i[n]; + if ("node" !== r && "__eventTargets" !== r) { + var s = t[r]; + if ("object" == typeof s && s) + if (Array.isArray(s)) + for (var o = 0; o < s.length; o++) { + var l = s[o]; + l instanceof cc.Asset && a(l, e) + } + else if (s.constructor && s.constructor !== Object) + s instanceof cc.Asset && a(s, e); + else + for (var h = Object.getOwnPropertyNames(s), c = 0; c < h.length; c++) { + var u = s[h[c]]; + u instanceof cc.Asset && a(u, e) + } + } + } + } + var l = []; + function h(t, e) { + for (var i = 0; i < t._components.length; i++) + o(t._components[i], e); + for (var n = 0; n < t._children.length; n++) + h(t._children[n], e) + } + function c(t, e, n, s) { + n.push(t._uuid); + for (var a = i.getDeps(t._uuid), o = 0, l = a.length; o < l; o++) { + var h = r.get(a[o]); + if (h) { + var u = h._uuid; + if (u in e ? e[u] += s : e[u] = h.refCount + s, + n.includes(u)) + continue; + c(h, e, n, s) + } + } + } + function u(t) { + var e = Object.create(null); + if (e[t._uuid] = t.refCount, + c(t, e, l, -1), + l.length = 0, + 0 !== e[t._uuid]) + return e[t._uuid]; + for (var i in e) + 0 !== e[i] && c(r.get(i), e, l, 1); + return l.length = 0, + e[t._uuid] + } + var _ = new n + , f = new n + , d = !1; + function p() { + d = !1, + f.forEach((function(t) { + m._free(t) + } + )), + f.clear() + } + var m = { + init: function() { + _.clear(), + f.clear() + }, + _addPersistNodeRef: function(t) { + var e = []; + h(t, e); + for (var i = 0, n = e.length; i < n; i++) { + var s = r.get(e[i]); + s && s.addRef() + } + _.add(t.uuid, e) + }, + _removePersistNodeRef: function(t) { + if (_.has(t.uuid)) { + for (var e = _.get(t.uuid), i = 0, n = e.length; i < n; i++) { + var s = r.get(e[i]); + s && s.decRef() + } + _.remove(t.uuid) + } + }, + _autoRelease: function(t, e, n) { + if (t) { + for (var s = i.getDeps(t._id), a = 0, o = s.length; a < o; a++) { + var l = r.get(s[a]); + l && l.decRef(t.autoReleaseAssets) + } + var h = i._depends.get(t._id); + if (h && h.persistDeps) + for (var c = h.persistDeps, u = 0, f = c.length; u < f; u++) { + var d = r.get(c[u]); + d && d.decRef(t.autoReleaseAssets) + } + t._id !== e._id && i.remove(t._id) + } + var p = i._depends.get(e._id); + for (var m in p && (p.persistDeps = []), + n) { + for (var y = n[m], v = _.get(y.uuid), g = 0, A = v.length; g < A; g++) { + var x = r.get(v[g]); + x && x.addRef() + } + p && p.persistDeps.push.apply(p.persistDeps, v) + } + }, + _free: function(t, e) { + if (f.remove(t._uuid), + cc.isValid(t, !0) && !(!e && t.refCount > 0 && u(t) > 0)) { + r.remove(t._uuid); + for (var n = i.getDeps(t._uuid), s = 0, a = n.length; s < a; s++) { + var o = r.get(n[s]); + o && (o.decRef(!1), + m._free(o, !1)) + } + t.destroy(), + i.remove(t._uuid) + } + }, + tryRelease: function(t, e) { + t instanceof cc.Asset && (e ? m._free(t, e) : (f.add(t._uuid, t), + d || (d = !0, + s(p)))) + } + }; + e.exports = m + } + ), { + "../assets/CCAsset": 62, + "../platform/utils": 217, + "./cache": 36, + "./depend-util": 38, + "./shared": 58 + }], + 57: [(function(t, e) { + "use strict"; + var i = []; + function n() { + this._id = "", + this.uuid = "", + this.url = "", + this.ext = ".json", + this.content = null, + this.file = null, + this.info = null, + this.config = null, + this.isNative = !1, + this.options = Object.create(null) + } + n.prototype = { + constructor: n, + get id() { + return this._id || (this._id = this.uuid + "@" + (this.isNative ? "native" : "import")), + this._id + }, + recycle: function() { + 500 !== i.length && (this._id = "", + this.uuid = "", + this.url = "", + this.ext = ".json", + this.content = null, + this.file = null, + this.info = null, + this.config = null, + this.isNative = !1, + this.options = Object.create(null), + i.push(this)) + } + }, + n.create = function() { + return 0 !== i.length ? i.pop() : new n + } + , + e.exports = n + } + ), {}], + 58: [(function(t, e) { + "use strict"; + var i = t("./cache") + , n = t("./pipeline") + , r = new i + , s = new i + , a = new i + , o = new i + , l = new n("normal load",[]) + , h = new n("fetch",[]) + , c = new n("transform url",[]); + e.exports = { + assets: r, + files: s, + parsed: a, + pipeline: l, + fetchPipeline: h, + transformPipeline: c, + RequestType: { + UUID: "uuid", + PATH: "path", + DIR: "dir", + URL: "url", + SCENE: "scene" + }, + bundles: o, + BuiltinBundleName: { + RESOURCES: "resources", + INTERNAL: "internal", + MAIN: "main", + START_SCENE: "start-scene" + } + } + } + ), { + "./cache": 36, + "./pipeline": 54 + }], + 59: [(function(t, e) { + "use strict"; + var i = 0 + , n = []; + function r(t) { + this.id = i++, + this._isFinish = !0, + this.onComplete = null, + this.onProgress = null, + this.onError = null, + this.source = null, + this.output = null, + this.input = null, + this.progress = null, + this.options = null, + this.set(t) + } + r.prototype = { + constructor: r, + set: function(t) { + t = t || Object.create(null), + this.onComplete = t.onComplete, + this.onProgress = t.onProgress, + this.onError = t.onError, + this.source = this.input = t.input, + this.output = null, + this.progress = t.progress, + this.options = t.options || Object.create(null) + }, + dispatch: function(t, e, i, n, r) { + switch (t) { + case "complete": + this.onComplete && this.onComplete(e, i, n, r); + break; + case "progress": + this.onProgress && this.onProgress(e, i, n, r); + break; + case "error": + this.onError && this.onError(e, i, n, r); + break; + default: + var s = "on" + t[0].toUpperCase() + t.substr(1); + "function" == typeof this[s] && this[s](e, i, n, r) + } + }, + recycle: function() { + 500 !== n.length && (this.onComplete = null, + this.onProgress = null, + this.onError = null, + this.source = this.output = this.input = null, + this.progress = null, + this.options = null, + n.push(this)) + }, + get isFinish() { + return this._isFinish + } + }, + r.create = function(t) { + var e = null; + return 0 !== n.length ? (e = n.pop()).set(t) : e = new r(t), + e + } + , + e.exports = r + } + ), {}], + 60: [(function(t, e) { + "use strict"; + var i = t("./helper").decodeUuid + , n = t("./request-item") + , r = t("./shared") + , s = r.RequestType + , a = r.bundles; + e.exports = { + parse: function(t) { + var e = t.input + , r = t.options; + e = Array.isArray(e) ? e : [e], + t.output = []; + for (var o = 0; o < e.length; o++) { + var l = e[o] + , h = n.create(); + if ("string" == typeof l && ((l = Object.create(null))[r.__requestType__ || s.UUID] = e[o]), + "object" == typeof l) + for (var c in cc.js.addon(l, r), + l.preset && cc.js.addon(l, cc.assetManager.presets[l.preset]), + l) { + switch (c) { + case s.UUID: + var u = h.uuid = i(l.uuid); + if (a.has(l.bundle)) { + if ((p = (m = a.get(l.bundle)._config).getAssetInfo(u)) && p.redirect) { + if (!a.has(p.redirect)) + throw new Error("Please load bundle " + p.redirect + " first"); + p = (m = a.get(p.redirect)._config).getAssetInfo(u) + } + h.config = m, + h.info = p + } + h.ext = l.ext || ".json"; + break; + case "__requestType__": + case "ext": + case "bundle": + case "preset": + case "type": + break; + case s.DIR: + if (a.has(l.bundle)) { + var _ = []; + a.get(l.bundle)._config.getDirWithPath(l.dir, l.type, _); + for (var f = 0, d = _.length; f < d; f++) { + var p = _[f]; + e.push({ + uuid: p.uuid, + __isNative__: !1, + ext: ".json", + bundle: l.bundle + }) + } + } + h.recycle(), + h = null; + break; + case s.PATH: + if (a.has(l.bundle)) { + if ((p = (m = a.get(l.bundle)._config).getInfoWithPath(l.path, l.type)) && p.redirect) { + if (!a.has(p.redirect)) + throw new Error("you need to load bundle " + p.redirect + " first"); + p = (m = a.get(p.redirect)._config).getAssetInfo(p.uuid) + } + if (!p) + throw h.recycle(), + new Error("Bundle " + l.bundle + " doesn't contain " + l.path); + h.config = m, + h.uuid = p.uuid, + h.info = p + } + h.ext = l.ext || ".json"; + break; + case s.SCENE: + if (a.has(l.bundle)) { + var m; + if ((p = (m = a.get(l.bundle)._config).getSceneInfo(l.scene)) && p.redirect) { + if (!a.has(p.redirect)) + throw new Error("you need to load bundle " + p.redirect + " first"); + p = (m = a.get(p.redirect)._config).getAssetInfo(p.uuid) + } + if (!p) + throw h.recycle(), + new Error("Bundle " + m.name + " doesn't contain scene " + l.scene); + h.config = m, + h.uuid = p.uuid, + h.info = p + } + break; + case "__isNative__": + h.isNative = l.__isNative__; + break; + case s.URL: + h.url = l.url, + h.uuid = l.uuid || l.url, + h.ext = l.ext || cc.path.extname(l.url), + h.isNative = void 0 === l.__isNative__ || l.__isNative__; + break; + default: + h.options[c] = l[c] + } + if (!h) + break + } + if (h && (t.output.push(h), + !h.uuid && !h.url)) + throw new Error("Can not parse this input:" + JSON.stringify(l)) + } + return null + }, + combine: function(t) { + for (var e = t.output = t.input, i = 0; i < e.length; i++) { + var n = e[i]; + if (!n.url) { + var r, s, a = n.config; + s = n.isNative ? a && a.nativeBase ? a.base + a.nativeBase : cc.assetManager.generalNativeBase : a && a.importBase ? a.base + a.importBase : cc.assetManager.generalImportBase; + var o = n.uuid + , l = ""; + n.info && (l = n.isNative ? n.info.nativeVer ? "." + n.info.nativeVer : "" : n.info.ver ? "." + n.info.ver : ""), + r = ".ttf" === n.ext ? s + "/" + o.slice(0, 2) + "/" + o + l + "/" + n.options.__nativeName__ : s + "/" + o.slice(0, 2) + "/" + o + l + n.ext, + n.url = r + } + } + return null + } + } + } + ), { + "./helper": 49, + "./request-item": 57, + "./shared": 58 + }], + 61: [(function(t, e) { + "use strict"; + var i = t("./depend-util") + , n = t("./helper") + , r = n.isScene + , s = n.decodeUuid + , a = t("./shared").assets + , o = t("../platform/utils").callInNextTick; + t("../assets/CCAsset"); + var l = { + processOptions: function(t) { + var e = t.uuids + , i = t.paths + , n = t.types + , r = t.deps + , a = t.paths = Object.create(null); + if (!1 === t.debug) { + for (var o = 0, l = e.length; o < l; o++) + e[o] = s(e[o]); + for (var h in i) { + var c = i[h] + , u = c[1]; + c[1] = n[u] + } + } else { + for (var _ = Object.create(null), f = 0, d = e.length; f < d; f++) { + var p = e[f]; + e[f] = _[p] = s(p) + } + e = _ + } + for (var m in i) { + var y = i[m]; + a[e[m]] = y + } + var v = t.scenes; + for (var g in v) { + var A = v[g]; + v[g] = e[A] + } + var x = t.packs; + for (var b in x) + for (var C = x[b], T = 0; T < C.length; ++T) + C[T] = e[C[T]]; + var S = t.versions; + if (S) + for (var w in S) + for (var E = S[w], M = 0; M < E.length; M += 2) { + var D = E[M]; + E[M] = e[D] || D + } + var B = t.redirect; + if (B) + for (var I = 0; I < B.length; I += 2) + B[I] = e[B[I]], + B[I + 1] = r[B[I + 1]] + }, + clear: function(t, e) { + for (var i = 0, n = t.input.length; i < n; i++) { + var r = t.input[i]; + e && !r.isNative && r.content && r.content.decRef && r.content.decRef(!1), + r.recycle() + } + t.input = null + }, + urlAppendTimestamp: function(t) { + return cc.assetManager.downloader.appendTimeStamp && "string" == typeof t ? /\?/.test(t) ? t + "&_t=" + (new Date - 0) : t + "?_t=" + (new Date - 0) : t + }, + retry: function(t, e, i, n, r) { + t(r = r || 0, (function(s, a) { + r++, + !s || r > e ? n && n(s, a) : setTimeout((function() { + l.retry(t, e, i, n, r) + } + ), i) + } + )) + }, + getDepends: function(t, e, n, r, s, a, o) { + try { + var l = i.parse(t, e) + , h = !0; + if (e instanceof cc.Asset && (!e.__nativeDepend__ || e._nativeAsset) && (h = !1), + s) { + for (var c = 0, u = l.deps.length; c < u; c++) { + var _ = l.deps[c]; + _ in n || (n[_] = !0, + r.push({ + uuid: _, + bundle: o && o.name + })) + } + h && l.nativeDep && (o && (l.nativeDep.bundle = o.name), + r.push(Object.assign({}, l.nativeDep))) + } else { + a = !!e.asyncLoadAssets || a && !l.preventDeferredLoadDependents; + for (var f = 0, d = l.deps.length; f < d; f++) { + var p = l.deps[f]; + p in n || (n[p] = !0, + r.push({ + uuid: p, + __asyncLoadAssets__: a, + bundle: o && o.name + })) + } + h && !a && !l.preventPreloadNativeObject && l.nativeDep && (o && (l.nativeDep.bundle = o.name), + r.push(Object.assign({}, l.nativeDep))) + } + } catch (m) { + cc.error(m.message, m.stack) + } + }, + cache: function(t, e, i) { + e && (!r(e) && i && a.add(t, e)) + }, + setProperties: function(t, e, i) { + var n = !1 + , r = e.__depends__; + if (r) { + for (var s = 0, a = r.length; s < a; s++) { + var o = r[s] + , l = i[o.uuid + "@import"]; + l ? o.owner[o.prop] = l.addRef() : (cc.error("The asset " + o.uuid + " is missing!"), + n = !0) + } + e.__depends__ = void 0 + } + return e.__nativeDepend__ && (e._nativeAsset || (i[t + "@native"] ? e._nativeAsset = i[t + "@native"] : n = !0), + e.__nativeDepend__ = void 0), + n + }, + gatherAsset: function(t) { + var e = t.source; + if (t.options.__outputAsArray__ || 1 !== e.length) + for (var i = t.output = [], n = 0, r = e.length; n < r; n++) + i.push(e[n].content); + else + t.output = e[0].content + }, + forEach: function(t, e, i) { + var n = 0 + , r = []; + 0 === t.length && i && i(r); + for (var s = 0, a = t.length; s < a; s++) + e(t[s], (function(t) { + t && r.push(t), + ++n === a && i && i(r) + } + )) + }, + parseParameters: function(t, e, i) { + if (void 0 === i) { + var n = "function" == typeof t; + e ? (i = e, + n || (e = null)) : void 0 === e && n && (i = t, + t = null, + e = null), + void 0 !== e && n && (e = t, + t = null) + } + return { + options: t = t || Object.create(null), + onProgress: e, + onComplete: i + } + }, + parseLoadResArgs: function(t, e, i) { + if (void 0 === i) { + var n = cc.js.isChildClassOf(t, cc.Asset); + e ? (i = e, + n && (e = null)) : void 0 !== e || n || (i = t, + e = null, + t = null), + void 0 === e || n || (e = t, + t = null) + } + return { + type: t, + onProgress: e, + onComplete: i + } + }, + checkCircleReference: function(t, e, n, r) { + if (r || (r = Object.create(null)), + !n[e] || r[e]) + return !1; + r[e] = !0; + var s = !1 + , a = i.getDeps(e); + if (a) + for (var o = 0, h = a.length; o < h; o++) { + var c = a[o]; + if (c === t || l.checkCircleReference(t, c, n, r)) { + s = !0; + break + } + } + return s + }, + asyncify: function(t) { + return function(e, i) { + if (t) { + var n = []; + Array.isArray(i) ? i.forEach((function(t) { + return t instanceof cc.Asset && n.push(t.addRef()) + } + )) : i instanceof cc.Asset && n.push(i.addRef()), + o((function() { + n.forEach((function(t) { + return t.decRef(!1) + } + )), + t(e, i) + } + )) + } + } + } + }; + e.exports = l + } + ), { + "../assets/CCAsset": 62, + "../platform/utils": 217, + "./depend-util": 38, + "./helper": 49, + "./shared": 58 + }], + 62: [(function(t, e) { + "use strict"; + var i = t("../platform/CCObject"); + cc.Asset = cc.Class({ + name: "cc.Asset", + extends: i, + ctor: function() { + Object.defineProperty(this, "_uuid", { + value: "", + writable: !0 + }), + this.loaded = !0, + this._nativeUrl = "", + this._ref = 0 + }, + properties: { + nativeUrl: { + get: function() { + if (!this._nativeUrl && this._native) { + var t = this._native; + if (47 === t.charCodeAt(0)) + return t.slice(1); + 46 === t.charCodeAt(0) ? this._nativeUrl = cc.assetManager.utils.getUrlWithUuid(this._uuid, { + nativeExt: t, + isNative: !0 + }) : this._nativeUrl = cc.assetManager.utils.getUrlWithUuid(this._uuid, { + __nativeName__: t, + nativeExt: cc.path.extname(t), + isNative: !0 + }) + } + return this._nativeUrl + }, + visible: !1 + }, + refCount: { + get: function() { + return this._ref + } + }, + _native: "", + _nativeAsset: { + get: function() { + return this._$nativeAsset + }, + set: function(t) { + this._$nativeAsset = t + } + }, + _nativeDep: { + get: function() { + if (this._native) + return { + __isNative__: !0, + uuid: this._uuid, + ext: this._native + } + } + } + }, + statics: { + deserialize: !1, + preventDeferredLoadDependents: !1, + preventPreloadNativeObject: !1 + }, + toString: function() { + return this.nativeUrl + }, + serialize: !1, + createNode: null, + _setRawAsset: function(t, e) { + this._native = !1 !== e ? t || void 0 : "/" + t + }, + addRef: function() { + return this._ref++, + this + }, + decRef: function(t) { + return this._ref > 0 && this._ref--, + !1 !== t && cc.assetManager._releaseManager.tryRelease(this), + this + } + }), + e.exports = cc.Asset + } + ), { + "../platform/CCObject": 199 + }], + 63: [(function(t, e) { + "use strict"; + var i = t("./CCAsset") + , n = t("../event/event-target") + , r = cc.Enum({ + WEB_AUDIO: 0, + DOM_AUDIO: 1 + }) + , s = cc.Class({ + name: "cc.AudioClip", + extends: i, + mixins: [n], + ctor: function() { + this._loading = !1, + this.loaded = !1, + this._audio = null + }, + properties: { + duration: 0, + loadMode: { + default: r.WEB_AUDIO, + type: r + }, + _nativeAsset: { + get: function() { + return this._audio + }, + set: function(t) { + t instanceof cc.AudioClip ? this._audio = t._nativeAsset : this._audio = t, + this._audio && (this.loaded = !0, + this.emit("load")) + }, + override: !0 + }, + _nativeDep: { + get: function() { + return { + uuid: this._uuid, + audioLoadMode: this.loadMode, + ext: cc.path.extname(this._native), + __isNative__: !0 + } + }, + override: !0 + } + }, + statics: { + LoadMode: r, + _loadByUrl: function(t, e) { + var i = cc.assetManager.assets.get(t); + i ? e(null, i) : cc.assetManager.loadRemote(t, (function(t, i) { + if (t) + return e(t); + e(null, i) + } + )) + } + }, + _ensureLoaded: function(t) { + if (this.loaded) + return t && t(); + if (t && this.once("load", t), + !this._loading) { + this._loading = !0; + var e = this; + cc.assetManager.postLoadNative(this, (function() { + e._loading = !1 + } + )) + } + }, + destroy: function() { + cc.audioEngine.uncache(this), + this._super() + } + }); + cc.AudioClip = s, + e.exports = s + } + ), { + "../event/event-target": 140, + "./CCAsset": 62 + }], + 64: [(function(t, e) { + "use strict"; + var i = function() { + this.u = 0, + this.v = 0, + this.w = 0, + this.h = 0, + this.offsetX = 0, + this.offsetY = 0, + this.textureID = 0, + this.valid = !1, + this.xAdvance = 0 + } + , n = function(t) { + this._letterDefinitions = {}, + this._texture = t + }; + n.prototype = { + constructor: n, + addLetterDefinitions: function(t, e) { + this._letterDefinitions[t] = e + }, + cloneLetterDefinition: function() { + var t = {}; + for (var e in this._letterDefinitions) { + var n = new i; + cc.js.mixin(n, this._letterDefinitions[e]), + t[e] = n + } + return t + }, + getTexture: function() { + return this._texture + }, + getLetter: function(t) { + return this._letterDefinitions[t] + }, + getLetterDefinitionForChar: function(t) { + var e = t.charCodeAt(0); + return this._letterDefinitions.hasOwnProperty(e) ? this._letterDefinitions[e] : null + }, + clear: function() { + this._letterDefinitions = {} + } + }; + var r = cc.Class({ + name: "cc.BitmapFont", + extends: cc.Font, + properties: { + fntDataStr: { + default: "" + }, + spriteFrame: { + default: null, + type: cc.SpriteFrame + }, + fontSize: { + default: -1 + }, + _fntConfig: null, + _fontDefDictionary: null + }, + onLoad: function() { + var t = this.spriteFrame; + this._fontDefDictionary || (this._fontDefDictionary = new n, + t && (this._fontDefDictionary._texture = t._texture)); + var e = this._fntConfig; + if (e) { + var r = e.fontDefDictionary; + for (var s in r) { + var a = new i + , o = r[s].rect; + a.offsetX = r[s].xOffset, + a.offsetY = r[s].yOffset, + a.w = o.width, + a.h = o.height, + a.u = o.x, + a.v = o.y, + a.textureID = 0, + a.valid = !0, + a.xAdvance = r[s].xAdvance, + this._fontDefDictionary.addLetterDefinitions(s, a) + } + } + } + }); + cc.BitmapFont = r, + cc.BitmapFont.FontLetterDefinition = i, + cc.BitmapFont.FontAtlas = n, + e.exports = r + } + ), {}], + 65: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.BufferAsset", + extends: cc.Asset, + ctor: function() { + this._buffer = null + }, + properties: { + _nativeAsset: { + get: function() { + return this._buffer + }, + set: function(t) { + this._buffer = t.buffer || t + }, + override: !0 + }, + buffer: function() { + return this._buffer + } + } + }); + cc.BufferAsset = e.exports = i + } + ), {}], + 66: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.Font", + extends: cc.Asset + }); + cc.Font = e.exports = i + } + ), {}], + 67: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.JsonAsset", + extends: cc.Asset, + properties: { + json: null + } + }); + e.exports = cc.JsonAsset = i + } + ), {}], + 68: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.LabelAtlas", + extends: cc.BitmapFont, + onLoad: function() { + this.spriteFrame ? this._fntConfig ? this._super() : cc.warnID(9101, this.name) : cc.warnID(9100, this.name) + } + }); + cc.LabelAtlas = i, + e.exports = i + } + ), {}], + 69: [(function(t, e) { + "use strict"; + var i = cc.Enum({ + AUTO: 0, + SINGLE_INSTANCE: 1, + MULTI_INSTANCE: 2 + }) + , n = cc.Class({ + name: "cc.Prefab", + extends: cc.Asset, + ctor: function() { + this._createFunction = null, + this._instantiatedTimes = 0 + }, + properties: { + data: null, + optimizationPolicy: i.AUTO, + asyncLoadAssets: !1, + readonly: { + default: !1, + editorOnly: !0 + } + }, + statics: { + OptimizationPolicy: i, + OptimizationPolicyThreshold: 3 + }, + createNode: !1, + compileCreateFunction: function() { + var e = t("../platform/instantiate-jit"); + this._createFunction = e.compile(this.data) + }, + _doInstantiate: function(t) { + return this.data._prefab || cc.warnID(3700), + this._createFunction || this.compileCreateFunction(), + this._createFunction(t) + }, + _instantiate: function() { + var t; + return this.optimizationPolicy !== i.SINGLE_INSTANCE && (this.optimizationPolicy === i.MULTI_INSTANCE || this._instantiatedTimes + 1 >= n.OptimizationPolicyThreshold) ? (t = this._doInstantiate(), + this.data._instantiate(t)) : t = this.data._instantiate(), + ++this._instantiatedTimes, + t + }, + destroy: function() { + this.data && this.data.destroy(), + this._super() + } + }); + cc.Prefab = e.exports = n, + cc.js.obsolete(cc, "cc._Prefab", "Prefab") + } + ), { + "../platform/instantiate-jit": 212 + }], + 70: [(function(t, e) { + "use strict"; + var i, n = (i = t("../../renderer/gfx")) && i.__esModule ? i : { + default: i + }, r = t("../renderer"), s = t("./CCTexture2D"), a = cc.Enum({ + RB_FMT_D24S8: n.default.RB_FMT_D24S8, + RB_FMT_S8: n.default.RB_FMT_S8, + RB_FMT_D16: n.default.RB_FMT_D16 + }), o = cc.Class({ + name: "cc.RenderTexture", + extends: s, + statics: { + DepthStencilFormat: a + }, + ctor: function() { + this._framebuffer = null + }, + initWithSize: function(t, e, i) { + this.width = Math.floor(t || cc.visibleRect.width), + this.height = Math.floor(e || cc.visibleRect.height), + this._resetUnderlyingMipmaps(); + var s, a = { + colors: [this._texture] + }; + this._depthStencilBuffer && this._depthStencilBuffer.destroy(), + i && (s = new n.default.RenderBuffer(r.device,i,t,e), + i === n.default.RB_FMT_D24S8 ? a.depthStencil = s : i === n.default.RB_FMT_S8 ? a.stencil = s : i === n.default.RB_FMT_D16 && (a.depth = s)), + this._depthStencilBuffer = s, + this._framebuffer && this._framebuffer.destroy(), + this._framebuffer = new n.default.FrameBuffer(r.device,t,e,a), + this._packable = !1, + this.loaded = !0, + this.emit("load") + }, + updateSize: function(t, e) { + this.width = Math.floor(t || cc.visibleRect.width), + this.height = Math.floor(e || cc.visibleRect.height), + this._resetUnderlyingMipmaps(); + var i = this._depthStencilBuffer; + i && i.update(this.width, this.height), + this._framebuffer._width = t, + this._framebuffer._height = e + }, + drawTextureAt: function(t, e, i) { + t._image && 0 !== t._image.width && this._texture.updateSubImage({ + x: e, + y: i, + image: t._image, + width: t.width, + height: t.height, + level: 0, + flipY: !1, + premultiplyAlpha: t._premultiplyAlpha + }) + }, + readPixels: function(t, e, i, n, r) { + if (!this._framebuffer || !this._texture) + return t; + e = e || 0, + i = i || 0; + var s = n || this.width + , a = r || this.height; + t = t || new Uint8Array(s * a * 4); + var o = cc.game._renderContext + , l = o.getParameter(o.FRAMEBUFFER_BINDING); + return o.bindFramebuffer(o.FRAMEBUFFER, this._framebuffer.getHandle()), + o.readPixels(e, i, s, a, o.RGBA, o.UNSIGNED_BYTE, t), + o.bindFramebuffer(o.FRAMEBUFFER, l), + t + }, + destroy: function() { + this._super(), + this._framebuffer && (this._framebuffer.destroy(), + this._framebuffer = null) + } + }); + cc.RenderTexture = e.exports = o + } + ), { + "../../renderer/gfx": 315, + "../renderer": 224, + "./CCTexture2D": 77 + }], + 71: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.SceneAsset", + extends: cc.Asset, + properties: { + scene: null, + asyncLoadAssets: void 0 + } + }); + cc.SceneAsset = i, + e.exports = i + } + ), {}], + 72: [(function() { + "use strict"; + var t = cc.Class({ + name: "cc.Script", + extends: cc.Asset + }); + cc._Script = t; + var e = cc.Class({ + name: "cc.JavaScript", + extends: t + }); + cc._JavaScript = e; + var i = cc.Class({ + name: "cc.TypeScript", + extends: t + }); + cc._TypeScript = i + } + ), {}], + 73: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.SpriteAtlas", + extends: cc.Asset, + properties: { + _spriteFrames: { + default: {} + } + }, + getTexture: function() { + var t = Object.keys(this._spriteFrames); + if (t.length > 0) { + var e = this._spriteFrames[t[0]]; + return e ? e.getTexture() : null + } + return null + }, + getSpriteFrame: function(t) { + var e = this._spriteFrames[t]; + return e ? (e.name || (e.name = t), + e) : null + }, + getSpriteFrames: function() { + var t = [] + , e = this._spriteFrames; + for (var i in e) + t.push(this.getSpriteFrame(i)); + return t + } + }); + cc.SpriteAtlas = i, + e.exports = i + } + ), {}], + 74: [(function(t, e) { + "use strict"; + var i = t("../event/event-target") + , n = [{ + u: 0, + v: 0 + }, { + u: 0, + v: 0 + }, { + u: 0, + v: 0 + }, { + u: 0, + v: 0 + }] + , r = cc.Class({ + name: "cc.SpriteFrame", + extends: t("../assets/CCAsset"), + mixins: [i], + properties: { + _textureSetter: { + set: function(t) { + t && this._texture !== t && this._refreshTexture(t) + } + }, + insetTop: { + get: function() { + return this._capInsets[1] + }, + set: function(t) { + this._capInsets[1] = t, + this._texture && this._calculateSlicedUV() + } + }, + insetBottom: { + get: function() { + return this._capInsets[3] + }, + set: function(t) { + this._capInsets[3] = t, + this._texture && this._calculateSlicedUV() + } + }, + insetLeft: { + get: function() { + return this._capInsets[0] + }, + set: function(t) { + this._capInsets[0] = t, + this._texture && this._calculateSlicedUV() + } + }, + insetRight: { + get: function() { + return this._capInsets[2] + }, + set: function(t) { + this._capInsets[2] = t, + this._texture && this._calculateSlicedUV() + } + } + }, + ctor: function() { + i.call(this); + var t = arguments[0] + , e = arguments[1] + , n = arguments[2] + , r = arguments[3] + , s = arguments[4]; + this._rect = null, + this.uv = [], + this._texture = null, + this._original = null, + this._offset = null, + this._originalSize = null, + this._rotated = !1, + this._flipX = !1, + this._flipY = !1, + this.vertices = null, + this._capInsets = [0, 0, 0, 0], + this.uvSliced = [], + void 0 !== t && this.setTexture(t, e, n, r, s) + }, + textureLoaded: function() { + return this._texture && this._texture.loaded + }, + onTextureLoaded: function(t, e) { + return this.textureLoaded() ? (t.call(e), + !0) : (this.once("load", t, e), + this.ensureLoadTexture(), + !1) + }, + isRotated: function() { + return this._rotated + }, + setRotated: function(t) { + this._rotated = t, + this._texture && this._calculateUV() + }, + isFlipX: function() { + return this._flipX + }, + isFlipY: function() { + return this._flipY + }, + setFlipX: function(t) { + this._flipX = t, + this._texture && this._calculateUV() + }, + setFlipY: function(t) { + this._flipY = t, + this._texture && this._calculateUV() + }, + getRect: function() { + return cc.rect(this._rect) + }, + setRect: function(t) { + this._rect = t, + this._texture && this._calculateUV() + }, + getOriginalSize: function() { + return cc.size(this._originalSize) + }, + setOriginalSize: function(t) { + this._originalSize ? (this._originalSize.width = t.width, + this._originalSize.height = t.height) : this._originalSize = cc.size(t) + }, + getTexture: function() { + return this._texture + }, + _textureLoadedCallback: function() { + var t = this._texture; + if (t) { + var e = t.width + , i = t.height; + this._rect ? this._checkRect(this._texture) : this._rect = cc.rect(0, 0, e, i), + this._originalSize || this.setOriginalSize(cc.size(e, i)), + this._offset || this.setOffset(cc.v2(0, 0)), + this._calculateUV(), + this.emit("load") + } + }, + _refreshTexture: function(t) { + this._texture = t, + t.loaded ? this._textureLoadedCallback() : t.once("load", this._textureLoadedCallback, this) + }, + getOffset: function() { + return cc.v2(this._offset) + }, + setOffset: function(t) { + this._offset = cc.v2(t) + }, + clone: function() { + return new r(this._texture,this.getRect(),this._rotated,this.getOffset(),this.getOriginalSize()) + }, + setTexture: function(t, e, i, n, r) { + if (1 !== arguments.length || t !== this._texture) { + if (this._rect = e || null, + n ? this.setOffset(n) : this._offset = null, + r ? this.setOriginalSize(r) : this._originalSize = null, + this._rotated = i || !1, + "string" != typeof t) + return t instanceof cc.Texture2D && this._refreshTexture(t), + !0; + cc.errorID(3401) + } + }, + ensureLoadTexture: function() { + this._texture && (this._texture.loaded || (this._refreshTexture(this._texture), + cc.assetManager.postLoadNative(this._texture))) + }, + _checkRect: function(t) { + var e = this._rect + , i = e.x + , n = e.y; + this._rotated ? (i += e.height, + n += e.width) : (i += e.width, + n += e.height), + i > t.width && cc.errorID(3300, t.nativeUrl + "/" + this.name, i, t.width), + n > t.height && cc.errorID(3400, t.nativeUrl + "/" + this.name, n, t.height) + }, + _flipXY: function(t) { + if (this._flipX) { + var e = t[0]; + t[0] = t[1], + t[1] = e, + e = t[2], + t[2] = t[3], + t[3] = e + } + if (this._flipY) { + var i = t[0]; + t[0] = t[2], + t[2] = i, + i = t[1], + t[1] = t[3], + t[3] = i + } + }, + _calculateSlicedUV: function() { + var t = this._rect + , e = this._texture.width + , i = this._texture.height + , r = this._capInsets[0] + , s = this._capInsets[2] + , a = t.width - r - s + , o = this._capInsets[1] + , l = this._capInsets[3] + , h = t.height - o - l + , c = this.uvSliced; + if (c.length = 0, + this._rotated) { + n[0].u = t.x / e, + n[1].u = (t.x + l) / e, + n[2].u = (t.x + l + h) / e, + n[3].u = (t.x + t.height) / e, + n[3].v = t.y / i, + n[2].v = (t.y + r) / i, + n[1].v = (t.y + r + a) / i, + n[0].v = (t.y + t.width) / i, + this._flipXY(n); + for (var u = 0; u < 4; ++u) + for (var _ = n[u], f = 0; f < 4; ++f) { + var d = n[3 - f]; + c.push({ + u: _.u, + v: d.v + }) + } + } else { + n[0].u = t.x / e, + n[1].u = (t.x + r) / e, + n[2].u = (t.x + r + a) / e, + n[3].u = (t.x + t.width) / e, + n[3].v = t.y / i, + n[2].v = (t.y + o) / i, + n[1].v = (t.y + o + h) / i, + n[0].v = (t.y + t.height) / i, + this._flipXY(n); + for (var p = 0; p < 4; ++p) + for (var m = n[p], y = 0; y < 4; ++y) { + var v = n[y]; + c.push({ + u: v.u, + v: m.v + }) + } + } + }, + _setDynamicAtlasFrame: function(t) { + t && (this._original = { + _texture: this._texture, + _x: this._rect.x, + _y: this._rect.y + }, + this._texture = t.texture, + this._rect.x = t.x, + this._rect.y = t.y, + this._calculateUV()) + }, + _resetDynamicAtlasFrame: function() { + this._original && (this._rect.x = this._original._x, + this._rect.y = this._original._y, + this._texture = this._original._texture, + this._original = null, + this._calculateUV()) + }, + _calculateUV: function() { + var t = this._rect + , e = this._texture + , i = this.uv + , n = e.width + , r = e.height; + if (this._rotated) { + var s = 0 === n ? 0 : t.x / n + , a = 0 === n ? 0 : (t.x + t.height) / n + , o = 0 === r ? 0 : (t.y + t.width) / r + , l = 0 === r ? 0 : t.y / r; + i[0] = s, + i[1] = l, + i[2] = s, + i[3] = o, + i[4] = a, + i[5] = l, + i[6] = a, + i[7] = o + } else { + var h = 0 === n ? 0 : t.x / n + , c = 0 === n ? 0 : (t.x + t.width) / n + , u = 0 === r ? 0 : (t.y + t.height) / r + , _ = 0 === r ? 0 : t.y / r; + i[0] = h, + i[1] = u, + i[2] = c, + i[3] = u, + i[4] = h, + i[5] = _, + i[6] = c, + i[7] = _ + } + if (this._flipX) { + var f = i[0]; + i[0] = i[2], + i[2] = f, + f = i[1], + i[1] = i[3], + i[3] = f, + f = i[4], + i[4] = i[6], + i[6] = f, + f = i[5], + i[5] = i[7], + i[7] = f + } + if (this._flipY) { + var d = i[0]; + i[0] = i[4], + i[4] = d, + d = i[1], + i[1] = i[5], + i[5] = d, + d = i[2], + i[2] = i[6], + i[6] = d, + d = i[3], + i[3] = i[7], + i[7] = d + } + var p = this.vertices; + if (p) { + p.nu.length = 0, + p.nv.length = 0; + for (var m = 0; m < p.u.length; m++) + p.nu[m] = p.u[m] / n, + p.nv[m] = p.v[m] / r + } + this._calculateSlicedUV() + }, + _serialize: !1, + _deserialize: function(t) { + var e = t.rect; + e && (this._rect = new cc.Rect(e[0],e[1],e[2],e[3])), + t.offset && this.setOffset(new cc.Vec2(t.offset[0],t.offset[1])), + t.originalSize && this.setOriginalSize(new cc.Size(t.originalSize[0],t.originalSize[1])), + this._rotated = 1 === t.rotated, + this._name = t.name; + var i = t.capInsets; + i && (this._capInsets[0] = i[0], + this._capInsets[1] = i[1], + this._capInsets[2] = i[2], + this._capInsets[3] = i[3]), + this.vertices = t.vertices, + this.vertices && (this.vertices.nu = [], + this.vertices.nv = []) + } + }) + , s = r.prototype; + s.copyWithZone = s.clone, + s.copy = s.clone, + s.initWithTexture = s.setTexture, + cc.SpriteFrame = r, + e.exports = r + } + ), { + "../assets/CCAsset": 62, + "../event/event-target": 140 + }], + 75: [(function(t, e) { + "use strict"; + var i = t("./CCFont") + , n = cc.Class({ + name: "cc.TTFFont", + extends: i, + properties: { + _fontFamily: null, + _nativeAsset: { + type: cc.String, + get: function() { + return this._fontFamily + }, + set: function(t) { + this._fontFamily = t || "Arial" + }, + override: !0 + }, + _nativeDep: { + get: function() { + return { + uuid: this._uuid, + __nativeName__: this._native, + ext: cc.path.extname(this._native), + __isNative__: !0 + } + }, + override: !0 + } + } + }); + cc.TTFFont = e.exports = n + } + ), { + "./CCFont": 66 + }], + 76: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.TextAsset", + extends: cc.Asset, + properties: { + text: "" + }, + toString: function() { + return this.text + } + }); + e.exports = cc.TextAsset = i + } + ), {}], + 77: [(function(t, e) { + "use strict"; + var i, n = (i = t("../../renderer/gfx")) && i.__esModule ? i : { + default: i + }, r = t("../event/event-target"), s = t("../renderer"); + t("../platform/CCClass"); + var a = new (t("../platform/id-generater"))("Tex") + , o = 1024 + , l = cc.Enum({ + RGB565: n.default.TEXTURE_FMT_R5_G6_B5, + RGB5A1: n.default.TEXTURE_FMT_R5_G5_B5_A1, + RGBA4444: n.default.TEXTURE_FMT_R4_G4_B4_A4, + RGB888: n.default.TEXTURE_FMT_RGB8, + RGBA8888: n.default.TEXTURE_FMT_RGBA8, + RGBA32F: n.default.TEXTURE_FMT_RGBA32F, + A8: n.default.TEXTURE_FMT_A8, + I8: n.default.TEXTURE_FMT_L8, + AI8: n.default.TEXTURE_FMT_L8_A8, + RGB_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_2BPPV1, + RGBA_PVRTC_2BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_2BPPV1, + RGB_A_PVRTC_2BPPV1: o++, + RGB_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGB_PVRTC_4BPPV1, + RGBA_PVRTC_4BPPV1: n.default.TEXTURE_FMT_RGBA_PVRTC_4BPPV1, + RGB_A_PVRTC_4BPPV1: o++, + RGB_ETC1: n.default.TEXTURE_FMT_RGB_ETC1, + RGBA_ETC1: o++, + RGB_ETC2: n.default.TEXTURE_FMT_RGB_ETC2, + RGBA_ETC2: n.default.TEXTURE_FMT_RGBA_ETC2 + }) + , h = cc.Enum({ + REPEAT: 10497, + CLAMP_TO_EDGE: 33071, + MIRRORED_REPEAT: 33648 + }) + , c = cc.Enum({ + LINEAR: 9729, + NEAREST: 9728 + }) + , u = { + 9728: 0, + 9729: 1 + } + , _ = [] + , f = { + width: void 0, + height: void 0, + minFilter: void 0, + magFilter: void 0, + wrapS: void 0, + wrapT: void 0, + format: void 0, + genMipmaps: void 0, + images: void 0, + image: void 0, + flipY: void 0, + premultiplyAlpha: void 0 + }; + function d() { + for (var t in f) + f[t] = void 0; + return _.length = 0, + f.images = _, + f + } + var p = cc.Class({ + name: "cc.Texture2D", + extends: t("../assets/CCAsset"), + mixins: [r], + properties: { + _nativeAsset: { + get: function() { + return this._image + }, + set: function(t) { + t._compressed && t._data ? this.initWithData(t._data, this._format, t.width, t.height) : this.initWithElement(t) + }, + override: !0 + }, + _format: l.RGBA8888, + _premultiplyAlpha: !1, + _flipY: !1, + _minFilter: c.LINEAR, + _magFilter: c.LINEAR, + _mipFilter: c.LINEAR, + _wrapS: h.CLAMP_TO_EDGE, + _wrapT: h.CLAMP_TO_EDGE, + _isAlphaAtlas: !1, + _genMipmaps: !1, + genMipmaps: { + get: function() { + return this._genMipmaps + }, + set: function(t) { + if (this._genMipmaps !== t) { + var e = d(); + e.genMipmaps = t, + this.update(e) + } + } + }, + _packable: !0, + packable: { + get: function() { + return this._packable + }, + set: function(t) { + this._packable = t + } + }, + _nativeDep: { + get: function() { + return { + __isNative__: !0, + uuid: this._uuid, + ext: this._native, + __flipY__: this._flipY, + __premultiplyAlpha__: this._premultiplyAlpha + } + }, + override: !0 + } + }, + statics: { + PixelFormat: l, + WrapMode: h, + Filter: c, + _FilterIndex: u, + extnames: [".png", ".jpg", ".jpeg", ".bmp", ".webp", ".pvr", ".pkm"], + _parseExt: function(t, e) { + for (var i = cc.renderer.device, n = t.split("_"), r = "", s = "", a = 999, o = e, h = cc.macro.SUPPORT_TEXTURE_FORMATS, c = 0; c < n.length; c++) { + var u = n[c].split("@") + , _ = u[0]; + _ = p.extnames[_.charCodeAt(0) - 48] || _; + var f = h.indexOf(_); + if (-1 !== f && f < a) { + var d = u[1] ? parseInt(u[1]) : e; + if (".pvr" === _ && !i.ext("WEBGL_compressed_texture_pvrtc")) + continue; + if (!(d !== l.RGB_ETC1 && d !== l.RGBA_ETC1 || i.ext("WEBGL_compressed_texture_etc1"))) + continue; + if (!(d !== l.RGB_ETC2 && d !== l.RGBA_ETC2 || i.ext("WEBGL_compressed_texture_etc"))) + continue; + if (".webp" === _ && !cc.sys.capabilities.webp) + continue; + a = f, + s = _, + o = d + } else + r || (r = _) + } + return { + bestExt: s, + bestFormat: o, + defaultExt: r + } + } + }, + ctor: function() { + this._id = a.getNewId(), + this.loaded = !1, + this.width = 0, + this.height = 0, + this._hashDirty = !0, + this._hash = 0, + this._texture = null + }, + getImpl: function() { + return this._texture || (this._texture = new s.Texture2D(s.device,{})), + this._texture + }, + getId: function() { + return this._id + }, + toString: function() { + return this.nativeUrl || "" + }, + update: function(t) { + if (t) { + var e = !1; + void 0 !== t.width && (this.width = t.width), + void 0 !== t.height && (this.height = t.height), + void 0 !== t.minFilter && (this._minFilter = t.minFilter, + t.minFilter = u[t.minFilter]), + void 0 !== t.magFilter && (this._magFilter = t.magFilter, + t.magFilter = u[t.magFilter]), + void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter, + t.mipFilter = u[t.mipFilter]), + void 0 !== t.wrapS && (this._wrapS = t.wrapS), + void 0 !== t.wrapT && (this._wrapT = t.wrapT), + void 0 !== t.format && (this._format = t.format), + void 0 !== t.flipY && (this._flipY = t.flipY, + e = !0), + void 0 !== t.premultiplyAlpha && (this._premultiplyAlpha = t.premultiplyAlpha, + e = !0), + void 0 !== t.genMipmaps && (this._genMipmaps = t.genMipmaps), + cc.sys.capabilities.imageBitmap && this._image instanceof ImageBitmap ? this._checkImageBitmap(this._upload.bind(this, t, e)) : this._upload(t, e) + } + }, + _upload: function(t, e) { + e && this._image && (t.image = this._image), + t.images && t.images.length > 0 ? this._image = t.images[0] : void 0 !== t.image && (this._image = t.image, + t.images || (_.length = 0, + t.images = _), + t.images.push(t.image)), + this._texture && this._texture.update(t), + this._hashDirty = !0 + }, + initWithElement: function(t) { + if (t) + if (this._image = t, + t.complete || t instanceof HTMLCanvasElement) + this.handleLoadedTexture(); + else if (cc.sys.capabilities.imageBitmap && t instanceof ImageBitmap) + this._checkImageBitmap(this.handleLoadedTexture.bind(this)); + else { + var e = this; + t.addEventListener("load", (function() { + e.handleLoadedTexture() + } + )), + t.addEventListener("error", (function(t) { + cc.warnID(3119, t.message) + } + )) + } + }, + initWithData: function(t, e, i, n) { + var r = d(); + return r.image = t, + r.images = [r.image], + r.genMipmaps = this._genMipmaps, + r.premultiplyAlpha = this._premultiplyAlpha, + r.flipY = this._flipY, + r.minFilter = u[this._minFilter], + r.magFilter = u[this._magFilter], + r.wrapS = this._wrapS, + r.wrapT = this._wrapT, + r.format = this._getGFXPixelFormat(e), + r.width = i, + r.height = n, + this._texture ? this._texture.update(r) : this._texture = new s.Texture2D(s.device,r), + this.width = i, + this.height = n, + this._updateFormat(), + this._checkPackable(), + this.loaded = !0, + this.emit("load"), + !0 + }, + getHtmlElementObj: function() { + return this._image + }, + destroy: function() { + cc.sys.capabilities.imageBitmap && this._image instanceof ImageBitmap && this._image.close && this._image.close(), + this._packable && cc.dynamicAtlasManager && cc.dynamicAtlasManager.deleteAtlasTexture(this), + this._image = null, + this._texture && this._texture.destroy(), + this._super() + }, + getPixelFormat: function() { + return this._format + }, + hasPremultipliedAlpha: function() { + return this._premultiplyAlpha || !1 + }, + isAlphaAtlas: function() { + return this._isAlphaAtlas + }, + handleLoadedTexture: function() { + if (this._image && this._image.width && this._image.height) { + this.width = this._image.width, + this.height = this._image.height; + var t = d(); + t.image = this._image, + t.images = [t.image], + t.width = this.width, + t.height = this.height, + t.genMipmaps = this._genMipmaps, + t.format = this._getGFXPixelFormat(this._format), + t.premultiplyAlpha = this._premultiplyAlpha, + t.flipY = this._flipY, + t.minFilter = u[this._minFilter], + t.magFilter = u[this._magFilter], + t.wrapS = this._wrapS, + t.wrapT = this._wrapT, + this._texture ? this._texture.update(t) : this._texture = new s.Texture2D(s.device,t), + this._updateFormat(), + this._checkPackable(), + this.loaded = !0, + this.emit("load"), + cc.macro.CLEANUP_IMAGE_CACHE && (this._image instanceof HTMLImageElement ? this._clearImage() : cc.sys.capabilities.imageBitmap && this._image instanceof ImageBitmap && this._image.close && this._image.close()) + } + }, + description: function() { + return "" + }, + releaseTexture: function() { + this._image = null, + this._texture && this._texture.destroy() + }, + setWrapMode: function(t, e) { + if (this._wrapS !== t || this._wrapT !== e) { + var i = d(); + i.wrapS = t, + i.wrapT = e, + this.update(i) + } + }, + setFilters: function(t, e) { + if (this._minFilter !== t || this._magFilter !== e) { + var i = d(); + i.minFilter = t, + i.magFilter = e, + this.update(i) + } + }, + setFlipY: function(t) { + if (this._flipY !== t) { + var e = d(); + e.flipY = t, + e.premultiplyAlpha = this._premultiplyAlpha, + this.update(e) + } + }, + setPremultiplyAlpha: function(t) { + if (this._premultiplyAlpha !== t) { + var e = d(); + e.flipY = this._flipY, + e.premultiplyAlpha = t, + this.update(e) + } + }, + _updateFormat: function() { + this._isAlphaAtlas = this._format === l.RGBA_ETC1 || this._format === l.RGB_A_PVRTC_4BPPV1 || this._format === l.RGB_A_PVRTC_2BPPV1 + }, + _checkPackable: function() { + var t = cc.dynamicAtlasManager; + if (t) + if (this._isCompressed()) + this._packable = !1; + else { + var e = this.width + , i = this.height; + !this._image || e > t.maxFrameSize || i > t.maxFrameSize || this._getHash() !== t.Atlas.DEFAULT_HASH ? this._packable = !1 : this._image && this._image instanceof HTMLCanvasElement && (this._packable = !0) + } + }, + _getOpts: function() { + var t = d(); + return t.width = this.width, + t.height = this.height, + t.genMipmaps = this._genMipmaps, + t.format = this._format, + t.premultiplyAlpha = this._premultiplyAlpha, + t.anisotropy = this._anisotropy, + t.flipY = this._flipY, + t.minFilter = u[this._minFilter], + t.magFilter = u[this._magFilter], + t.mipFilter = u[this._mipFilter], + t.wrapS = this._wrapS, + t.wrapT = this._wrapT, + t + }, + _getGFXPixelFormat: function(t) { + return t === l.RGBA_ETC1 ? t = l.RGB_ETC1 : t === l.RGB_A_PVRTC_4BPPV1 ? t = l.RGB_PVRTC_4BPPV1 : t === l.RGB_A_PVRTC_2BPPV1 && (t = l.RGB_PVRTC_2BPPV1), + t + }, + _resetUnderlyingMipmaps: function(t) { + var e = this._getOpts(); + e.images = t || [null], + this._texture ? this._texture.update(e) : this._texture = new s.Texture2D(s.device,e) + }, + _serialize: !1, + _deserialize: function(t) { + var e = t.split(",") + , i = e[0]; + if (i) { + var n = p._parseExt(i, this._format); + if (n.bestExt) + this._setRawAsset(n.bestExt), + this._format = n.bestFormat; + else { + if (!n.defaultExt) + throw new Error(cc.debug.getError(3121)); + this._setRawAsset(n.defaultExt), + cc.warnID(3120, n.defaultExt, n.defaultExt) + } + } + 8 === e.length && (this._minFilter = parseInt(e[1]), + this._magFilter = parseInt(e[2]), + this._wrapS = parseInt(e[3]), + this._wrapT = parseInt(e[4]), + this._premultiplyAlpha = 49 === e[5].charCodeAt(0), + this._genMipmaps = 49 === e[6].charCodeAt(0), + this._packable = 49 === e[7].charCodeAt(0)) + }, + _getHash: function() { + if (!this._hashDirty) + return this._hash; + var t = this._genMipmaps ? 1 : 0 + , e = this._premultiplyAlpha ? 1 : 0 + , i = this._flipY ? 1 : 0 + , n = this._minFilter === c.LINEAR ? 1 : 2 + , r = this._magFilter === c.LINEAR ? 1 : 2 + , s = this._wrapS === h.REPEAT ? 1 : this._wrapS === h.CLAMP_TO_EDGE ? 2 : 3 + , a = this._wrapT === h.REPEAT ? 1 : this._wrapT === h.CLAMP_TO_EDGE ? 2 : 3 + , o = this._format; + return this._image, + this._hash = Number("" + n + r + o + s + a + t + e + i), + this._hashDirty = !1, + this._hash + }, + _isCompressed: function() { + return this._format < l.A8 || this._format > l.RGBA32F + }, + _clearImage: function() { + this._image.src = "" + }, + _checkImageBitmap: function(t) { + var e = this + , i = this._image + , n = this._flipY + , r = this._premultiplyAlpha; + this._flipY !== i.flipY || this._premultiplyAlpha !== i.premultiplyAlpha ? createImageBitmap(i, { + imageOrientation: n !== i.flipY ? "flipY" : "none", + premultiplyAlpha: r ? "premultiply" : "none" + }).then((function(s) { + i.close && i.close(), + s.flipY = n, + s.premultiplyAlpha = r, + e._image = s, + t() + } + ), (function(t) { + cc.error(t.message) + } + )) : t() + } + }); + cc.Texture2D = e.exports = p + } + ), { + "../../renderer/gfx": 315, + "../assets/CCAsset": 62, + "../event/event-target": 140, + "../platform/CCClass": 193, + "../platform/id-generater": 210, + "../renderer": 224 + }], + 78: [(function(t) { + "use strict"; + t("./CCAsset"), + t("./CCFont"), + t("./CCPrefab"), + t("./CCAudioClip"), + t("./CCScripts"), + t("./CCSceneAsset"), + t("./CCSpriteFrame"), + t("./CCTexture2D"), + t("./CCRenderTexture"), + t("./CCTTFFont"), + t("./CCSpriteAtlas"), + t("./CCBitmapFont"), + t("./CCLabelAtlas"), + t("./CCTextAsset"), + t("./CCJsonAsset"), + t("./CCBufferAsset"), + t("./material") + } + ), { + "./CCAsset": 62, + "./CCAudioClip": 63, + "./CCBitmapFont": 64, + "./CCBufferAsset": 65, + "./CCFont": 66, + "./CCJsonAsset": 67, + "./CCLabelAtlas": 68, + "./CCPrefab": 69, + "./CCRenderTexture": 70, + "./CCSceneAsset": 71, + "./CCScripts": 72, + "./CCSpriteAtlas": 73, + "./CCSpriteFrame": 74, + "./CCTTFFont": 75, + "./CCTextAsset": 76, + "./CCTexture2D": 77, + "./material": 85 + }], + 79: [(function(t, e) { + "use strict"; + var i, n = (i = t("../CCAsset")) && i.__esModule ? i : { + default: i + }, r = t("./effect-parser"), s = cc.Class({ + name: "cc.EffectAsset", + extends: n.default, + ctor: function() { + this._effect = null + }, + properties: { + properties: Object, + techniques: [], + shaders: [] + }, + onLoad: function() { + if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) { + for (var t = cc.renderer._forward._programLib, e = 0; e < this.shaders.length; e++) + t.define(this.shaders[e]); + this._initEffect() + } + }, + _initEffect: function() { + this._effect || (this._effect = (0, + r.parseEffect)(this), + Object.freeze(this._effect)) + }, + getInstantiatedEffect: function() { + return this._initEffect(), + this._effect.clone() + }, + getEffect: function() { + return this._initEffect(), + this._effect + } + }); + e.exports = cc.EffectAsset = s + } + ), { + "../CCAsset": 62, + "./effect-parser": 82 + }], + 80: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("../CCAsset") + , r = t("../CCTexture2D") + , s = (r.PixelFormat, + t("./CCEffectAsset")) + , a = (t("../../utils/texture-util"), + cc.gfx) + , o = cc.Enum({ + SPRITE: "2d-sprite", + GRAY_SPRITE: "2d-gray-sprite", + UNLIT: "unlit" + }) + , l = cc.Class({ + name: "cc.Material", + extends: n, + ctor: function() { + this.loaded = !1, + this._manualHash = !1, + this._dirty = !0, + this._effect = null + }, + properties: { + _defines: { + default: void 0, + type: Object + }, + _props: { + default: void 0, + type: Object + }, + _effectAsset: { + type: s, + default: null + }, + _techniqueIndex: 0, + _techniqueData: Object, + effectName: void 0, + effectAsset: { + get: function() { + return this._effectAsset + }, + set: function(t) { + cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS && (this._effectAsset = t, + t ? this._effect = this._effectAsset.getInstantiatedEffect() : cc.error("Can not set an empty effect asset.")) + } + }, + effect: { + get: function() { + return this._effect + } + }, + techniqueIndex: { + get: function() { + return this._techniqueIndex + }, + set: function(t) { + this._techniqueIndex = t, + this._effect.switchTechnique(t) + } + } + }, + statics: { + getBuiltinMaterial: function(t) { + return cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? new cc.Material : cc.assetManager.builtins.getBuiltin("material", "builtin-" + t) + }, + BUILTIN_NAME: o, + createWithBuiltin: function(t, e) { + void 0 === e && (e = 0); + var i = cc.assetManager.builtins.getBuiltin("effect", "builtin-" + t); + return l.create(i, e) + }, + create: function(t, e) { + if (void 0 === e && (e = 0), + !t) + return null; + var i = new l; + return i.effectAsset = t, + i.techniqueIndex = e, + i + } + }, + setProperty: function(t, e, i, n) { + if (cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) { + if ("string" == typeof i && (i = parseInt(i)), + e instanceof r) { + var s = e.isAlphaAtlas() + , a = "CC_USE_ALPHA_ATLAS_" + t + , o = this.getDefine(a, i); + (s || o) && this.define(a, s), + e.loaded || cc.assetManager.postLoadNative(e) + } + this._effect.setProperty(t, e, i, n) + } + }, + getProperty: function(t, e) { + return "string" == typeof e && (e = parseInt(e)), + this._effect.getProperty(t, e) + }, + define: function(t, e, i, n) { + cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS && ("string" == typeof i && (i = parseInt(i)), + this._effect.define(t, e, i, n)) + }, + getDefine: function(t, e) { + return "string" == typeof e && (e = parseInt(e)), + this._effect.getDefine(t, e) + }, + setCullMode: function(t, e) { + void 0 === t && (t = a.CULL_BACK), + this._effect.setCullMode(t, e) + }, + setDepth: function(t, e, i, n) { + void 0 === t && (t = !1), + void 0 === e && (e = !1), + void 0 === i && (i = a.DS_FUNC_LESS), + this._effect.setDepth(t, e, i, n) + }, + setBlend: function(t, e, i, n, r, s, o, l, h) { + void 0 === t && (t = !1), + void 0 === e && (e = a.BLEND_FUNC_ADD), + void 0 === i && (i = a.BLEND_SRC_ALPHA), + void 0 === n && (n = a.BLEND_ONE_MINUS_SRC_ALPHA), + void 0 === r && (r = a.BLEND_FUNC_ADD), + void 0 === s && (s = a.BLEND_SRC_ALPHA), + void 0 === o && (o = a.BLEND_ONE_MINUS_SRC_ALPHA), + void 0 === l && (l = 4294967295), + this._effect.setBlend(t, e, i, n, r, s, o, l, h) + }, + setStencilEnabled: function(t, e) { + void 0 === t && (t = a.STENCIL_INHERIT), + this._effect.setStencilEnabled(t, e) + }, + setStencil: function(t, e, i, n, r, s, o, l, h) { + void 0 === t && (t = a.STENCIL_INHERIT), + void 0 === e && (e = a.DS_FUNC_ALWAYS), + void 0 === i && (i = 0), + void 0 === n && (n = 255), + void 0 === r && (r = a.STENCIL_OP_KEEP), + void 0 === s && (s = a.STENCIL_OP_KEEP), + void 0 === o && (o = a.STENCIL_OP_KEEP), + void 0 === l && (l = 255), + this._effect.setStencil(t, e, i, n, r, s, o, l, h) + }, + updateHash: function(t) { + this._manualHash = t, + this._effect && this._effect.updateHash(t) + }, + getHash: function() { + return this._manualHash || this._effect && this._effect.getHash() + }, + onLoad: function() { + if (this.effectAsset = this._effectAsset, + this._effect) { + this._techniqueIndex && this._effect.switchTechnique(this._techniqueIndex), + this._techniqueData = this._techniqueData || {}; + var t = this._techniqueData; + for (var e in t) { + var i = t[e = parseInt(e)]; + if (i) { + for (var n in i.defines) + this.define(n, i.defines[n], e); + for (var r in i.props) + this.setProperty(r, i.props[r], e) + } + } + } + } + }) + , h = l; + i.default = h, + cc.Material = l, + e.exports = i.default + } + ), { + "../../utils/texture-util": 275, + "../CCAsset": 62, + "../CCTexture2D": 77, + "./CCEffectAsset": 79 + }], + 81: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../../renderer/core/pass")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var a = cc.gfx + , o = (function() { + function t() { + this._dirty = !0, + this._name = "", + this._technique = null + } + var e, i, n = t.prototype; + return n._createPassProp = function(t, e) { + var i = e._properties[t]; + if (i) { + var n = Object.create(null); + return n.name = t, + n.type = i.type, + i.value instanceof Float32Array ? n.value = new Float32Array(i.value) : i.value instanceof Float64Array ? n.value = new Float64Array(i.value) : n.value = i.value, + e._properties[t] = n, + n + } + } + , + n._setPassProperty = function(t, e, i, n) { + var s = i._properties; + return s.hasOwnProperty(t) || this._createPassProp(t, i), + s[t].value === e || (this._dirty = !0, + r.default.prototype.setProperty.call(i, t, e, n)) + } + , + n.setProperty = function(t, e, i, n) { + var r = !1 + , s = this.passes + , a = 0 + , o = s.length; + void 0 !== i && (a = i, + o = i + 1); + for (var l = a; l < o; l++) + this._setPassProperty(t, e, s[l], n) && (r = !0); + r || cc.warnID(9103, this.name, t) + } + , + n.getProperty = function(t, e) { + var i = this.passes; + if (!(e >= i.length)) { + var n = 0 + , r = i.length; + void 0 !== e && (n = e, + r = e + 1); + for (var s = n; s < r; s++) { + var a = i[s].getProperty(t); + if (void 0 !== a) + return a + } + } + } + , + n.define = function(t, e, i, n) { + var r = !1 + , s = this.passes + , a = 0 + , o = s.length; + void 0 !== i && (a = i, + o = i + 1); + for (var l = a; l < o; l++) + s[l].define(t, e, n) && (r = !0); + r || cc.warnID(9104, this.name, t) + } + , + n.getDefine = function(t, e) { + var i = this.passes; + if (!(e >= i.length)) { + var n = 0 + , r = i.length; + void 0 !== e && (n = e, + r = e + 1); + for (var s = n; s < r; s++) { + var a = i[s].getDefine(t); + if (void 0 !== a) + return a + } + } + } + , + n.setCullMode = function(t, e) { + void 0 === t && (t = a.CULL_BACK); + var i = this.passes + , n = 0 + , r = i.length; + void 0 !== e && (n = e, + r = e + 1); + for (var s = n; s < r; s++) + i[s].setCullMode(t); + this._dirty = !0 + } + , + n.setDepth = function(t, e, i, n) { + var r = this.passes + , s = 0 + , a = r.length; + void 0 !== n && (s = n, + a = n + 1); + for (var o = s; o < a; o++) + r[o].setDepth(t, e, i); + this._dirty = !0 + } + , + n.setBlend = function(t, e, i, n, r, s, a, o, l) { + var h = this.passes + , c = 0 + , u = h.length; + void 0 !== l && (c = l, + u = l + 1); + for (var _ = c; _ < u; _++) + h[_].setBlend(t, e, i, n, r, s, a, o); + this._dirty = !0 + } + , + n.setStencilEnabled = function(t, e) { + void 0 === t && (t = a.STENCIL_INHERIT); + var i = this.passes + , n = 0 + , r = i.length; + void 0 !== e && (n = e, + r = e + 1); + for (var s = n; s < r; s++) + i[s].setStencilEnabled(t); + this._dirty = !0 + } + , + n.setStencil = function(t, e, i, n, r, s, a, o, l) { + var h = this.passes + , c = 0 + , u = h.length; + void 0 !== l && (c = l, + u = l + 1); + for (var _ = c; _ < u; _++) { + var f = h[_]; + f.setStencilFront(t, e, i, n, r, s, a, o), + f.setStencilBack(t, e, i, n, r, s, a, o) + } + this._dirty = !0 + } + , + e = t, + (i = [{ + key: "name", + get: function() { + return this._name + } + }, { + key: "technique", + get: function() { + return this._technique + } + }, { + key: "passes", + get: function() { + return [] + } + }]) && s(e.prototype, i), + t + } + )(); + i.default = o, + cc.EffectBase = o, + e.exports = i.default + } + ), { + "../../../renderer/core/pass": 306 + }], + 82: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.parseEffect = function(t) { + var e = _(t); + return new a.default(t.name,e,0,t) + } + ; + var n = l(t("../../../renderer/core/pass")) + , r = t("../../../renderer/types") + , s = l(t("../../../renderer/enums")) + , a = l(t("./effect")) + , o = l(t("../../../renderer/core/technique")); + function l(t) { + return t && t.__esModule ? t : { + default: t + } + } + function h(t) { + return cc.renderer._forward._programLib.getTemplate(t) + } + function c(t, e) { + var i = e.properties || {} + , n = h(e.program) + , a = function(e) { + if (!n.uniforms.find((function(t) { + return t.name === e + } + ))) + return cc.warnID(9107, t.name, e), + "continue" + }; + for (var o in i) + a(o); + var l = {}; + return n.uniforms.forEach((function(t) { + var e, n = t.name, a = l[n] = Object.assign({}, t), o = i[n]; + void 0 === (e = o ? o.type === s.default.PARAM_TEXTURE_2D ? null : o.type === s.default.PARAM_INT || o.type === s.default.PARAM_FLOAT ? Array.isArray(o.value) ? o.value[0] : o.value : new Float32Array(o.value) : r.enums2default[t.type]) && (e = null), + a.value = e + } + )), + l + } + function u(t) { + var e = {}; + return h(t.program).defines.forEach((function(t) { + e[t.name] = r.enums2default[t.type] + } + )), + e + } + function _(t) { + for (var e = t.techniques.length, i = new Array(e), r = 0; r < e; ++r) { + for (var s = t.techniques[r], a = s.name || r, l = s.passes.length, h = new Array(l), _ = 0; _ < l; ++_) { + var f = s.passes[_] + , d = f.name || _ + , p = t.name + "-" + a + "-" + d + , m = f.stage || "opaque" + , y = c(t, f) + , v = u(f) + , g = h[_] = new n.default(d,p,f.program,m,y,v); + f.rasterizerState && g.setCullMode(f.rasterizerState.cullMode); + var A = f.blendState && f.blendState.targets[0]; + A && g.setBlend(A.blend, A.blendEq, A.blendSrc, A.blendDst, A.blendAlphaEq, A.blendSrcAlpha, A.blendDstAlpha, A.blendColor); + var x = f.depthStencilState; + x && (g.setDepth(x.depthTest, x.depthWrite, x.depthFunc), + g.setStencilFront(x.stencilTest, x.stencilFuncFront, x.stencilRefFront, x.stencilMaskFront, x.stencilFailOpFront, x.stencilZFailOpFront, x.stencilZPassOpFront, x.stencilWriteMaskFront), + g.setStencilBack(x.stencilTest, x.stencilFuncBack, x.stencilRefBack, x.stencilMaskBack, x.stencilFailOpBack, x.stencilZFailOpBack, x.stencilZPassOpBack, x.stencilWriteMaskBack)) + } + i[r] = new o.default(a,h) + } + return i + } + } + ), { + "../../../renderer/core/pass": 306, + "../../../renderer/core/technique": 308, + "../../../renderer/enums": 310, + "../../../renderer/types": 338, + "./effect": 84 + }], + 83: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = a(t("../../../renderer/murmurhash2_gc")) + , r = a(t("./utils")) + , s = a(t("./effect-base")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + function o(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function l(t, e) { + return (l = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + cc.gfx; + var h = (function(t) { + var e, i; + function s(e) { + var i; + return (i = t.call(this) || this)._effect = void 0, + i._passes = [], + i._stagePasses = {}, + i._hash = 0, + i.init(e), + i + } + i = t, + (e = s).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + l(e, i); + var a, h, c = s.prototype; + return c._onEffectChanged = function() {} + , + c.init = function(t) { + if (t instanceof s && (t = t.effect), + this._effect = t, + this._dirty = !0, + t) { + var e = t.passes + , i = this._passes; + i.length = 0; + for (var n = this._stagePasses = {}, r = 0; r < e.length; r++) { + var a = i[r] = Object.setPrototypeOf({}, e[r]); + a._properties = Object.setPrototypeOf({}, e[r]._properties), + a._defines = Object.setPrototypeOf({}, e[r]._defines), + n[a._stage] || (n[a._stage] = []), + n[a._stage].push(a) + } + } + } + , + c.updateHash = function() {} + , + c.getHash = function() { + if (!this._dirty) + return this._hash; + this._dirty = !1; + var t = ""; + t += r.default.serializePasses(this._passes); + var e = this._effect; + return e && (t += r.default.serializePasses(e.passes)), + this._hash = (0, + n.default)(t, 666), + this.updateHash(this._hash), + this._hash + } + , + a = s, + (h = [{ + key: "effect", + get: function() { + return this._effect + } + }, { + key: "name", + get: function() { + return this._effect && this._effect.name + " (variant)" + } + }, { + key: "passes", + get: function() { + return this._passes + } + }, { + key: "stagePasses", + get: function() { + return this._stagePasses + } + }]) && o(a.prototype, h), + s + } + )(s.default); + i.default = h, + cc.EffectVariant = h, + e.exports = i.default + } + ), { + "../../../renderer/murmurhash2_gc": 333, + "./effect-base": 81, + "./utils": 88 + }], + 84: [(function(t, e, i) { + "use strict"; + var n; + function r(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + i.__esModule = !0, + i.default = void 0; + var a = (function(t) { + var e, i; + function n(e, i, n, r) { + var s; + return (s = t.call(this) || this)._techniques = [], + s._asset = null, + s.init(e, i, n, r, !0), + s + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var a, o, l = n.prototype; + return l.init = function(t, e, i, n) { + this._name = t, + this._techniques = e, + this._technique = e[i], + this._asset = n + } + , + l.switchTechnique = function(t) { + t >= this._techniques.length ? cc.warn("Can not switch to technique with index [" + t + "]") : this._technique = this._techniques[t] + } + , + l.clear = function() { + this._techniques = [] + } + , + l.clone = function() { + for (var t = [], e = 0; e < this._techniques.length; e++) + t.push(this._techniques[e].clone()); + var i = this._techniques.indexOf(this._technique); + return new n(this._name,t,i,this._asset) + } + , + a = n, + (o = [{ + key: "technique", + get: function() { + return this._technique + } + }, { + key: "passes", + get: function() { + return this._technique.passes + } + }]) && r(a.prototype, o), + n + } + )(((n = t("./effect-base")) && n.__esModule ? n : { + default: n + }).default); + i.default = a, + cc.Effect = a, + e.exports = i.default + } + ), { + "./effect-base": 81 + }], + 85: [(function(t) { + "use strict"; + t("./CCEffectAsset"), + t("./CCMaterial"), + t("./material-variant") + } + ), { + "./CCEffectAsset": 79, + "./CCMaterial": 80, + "./material-variant": 87 + }], + 86: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = s(t("./utils")) + , r = s(t("../../utils/pool")); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + function a(t, e) { + return (a = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var o = new (function(t) { + var e, i; + function r() { + for (var e, i = arguments.length, n = new Array(i), r = 0; r < i; r++) + n[r] = arguments[r]; + return (e = t.call.apply(t, [this].concat(n)) || this).enabled = !1, + e._pool = {}, + e + } + i = t, + (e = r).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + a(e, i); + var s = r.prototype; + return s.get = function(t, e) { + var i, r = this._pool; + if (t instanceof cc.MaterialVariant) { + if (!t._owner) + return t._owner = e, + t; + if (t._owner === e) + return t; + t = t.material + } + if (this.enabled) { + var s = t.effectAsset._uuid; + if (r[s]) { + var a = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques); + i = r[s][a] && r[s][a].pop() + } + } + return i ? this.count-- : ((i = new cc.MaterialVariant(t))._name = t._name + " (Instance)", + i._uuid = t._uuid), + i._owner = e, + i + } + , + s.put = function(t) { + if (this.enabled && t._owner) { + var e = this._pool + , i = t.effectAsset._uuid; + e[i] || (e[i] = {}); + var r = n.default.serializeDefines(t._effect._defines) + n.default.serializeTechniques(t._effect._techniques); + e[i][r] || (e[i][r] = []), + this.count > this.maxSize || (this._clean(t), + e[i][r].push(t), + this.count++) + } + } + , + s.clear = function() { + this._pool = {}, + this.count = 0 + } + , + s._clean = function(t) { + t._owner = null + } + , + r + }(r.default)); + r.default.register("material", o); + var l = o; + i.default = l, + e.exports = i.default + } + ), { + "../../utils/pool": 269, + "./utils": 88 + }], + 87: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = o(t("./CCMaterial")), s = o(t("./effect-variant")), a = o(t("./material-pool")); + function o(t) { + return t && t.__esModule ? t : { + default: t + } + } + function l(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function h(t, e) { + return (h = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var c = (0, + cc._decorator.ccclass)("cc.MaterialVariant")(n = (function(t) { + var e, i, n, o; + function c(e) { + var i; + return (i = t.call(this) || this)._owner = null, + i._material = null, + i.init(e), + i + } + return i = t, + (e = c).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + h(e, i), + c.createWithBuiltin = function(t, e) { + return c.create(r.default.getBuiltinMaterial(t), e) + } + , + c.create = function(t, e) { + return t ? a.default.get(t, e) : null + } + , + c.prototype.init = function(t) { + this._effect = new s.default(t.effect), + this._effectAsset = t._effectAsset, + this._material = t + } + , + n = c, + (o = [{ + key: "uuid", + get: function() { + return this._material._uuid + } + }, { + key: "owner", + get: function() { + return this._owner + } + }, { + key: "material", + get: function() { + return this._material + } + }]) && l(n.prototype, o), + c + } + )(r.default)) || n; + i.default = c, + cc.MaterialVariant = c, + e.exports = i.default + } + ), { + "./CCMaterial": 80, + "./effect-variant": 83, + "./material-pool": 86 + }], + 88: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../../renderer/enums")) && n.__esModule ? n : { + default: n + }; + function s(t) { + var e = ""; + for (var i in t) + e += i + t[i]; + return e + } + function a(t) { + var e = ""; + for (var i in t) { + var n = t[i] + , s = n.value; + s && (n.type === r.default.PARAM_TEXTURE_2D || n.type === r.default.PARAM_TEXTURE_CUBE ? e += s._id + ";" : e += s.toString() + ";") + } + return e + } + var o = { + serializeDefines: s, + serializePasses: function(t) { + for (var e, i, n = "", r = 0; r < t.length; r++) + n += (void 0, + i = void 0, + i = (e = t[r])._programName + e._cullMode, + e._blend && (i += e._blendEq + e._blendAlphaEq + e._blendSrc + e._blendDst + e._blendSrcAlpha + e._blendDstAlpha + e._blendColor), + e._depthTest && (i += e._depthWrite + e._depthFunc), + e._stencilTest && (i += e._stencilFuncFront + e._stencilRefFront + e._stencilMaskFront + e._stencilFailOpFront + e._stencilZFailOpFront + e._stencilZPassOpFront + e._stencilWriteMaskFront + e._stencilFuncBack + e._stencilRefBack + e._stencilMaskBack + e._stencilFailOpBack + e._stencilZFailOpBack + e._stencilZPassOpBack + e._stencilWriteMaskBack), + i += a(e._properties), + i += s(e._defines)); + return n + }, + serializeUniforms: a + }; + i.default = o, + e.exports = i.default + } + ), { + "../../../renderer/enums": 310 + }], + 89: [(function(t, e) { + "use strict"; + t("../CCNode").EventType; + var i = 56 + , n = 7 + , r = cc.Enum({ + ONCE: 0, + ON_WINDOW_RESIZE: 1, + ALWAYS: 2 + }); + function s(t, e, i, n) { + for (var r = t._parent.scaleX, s = t._parent.scaleY, a = 0, o = 0, l = t._parent; ; ) { + if (a += l.x, + o += l.y, + !(l = l._parent)) + return i.x = i.y = 0, + void (n.x = n.y = 1); + if (l === e) + break; + var h = l.scaleX + , c = l.scaleY; + a *= h, + o *= c, + r *= h, + s *= c + } + n.x = 0 !== r ? 1 / r : 1, + n.y = 0 !== s ? 1 / s : 1, + i.x = -a, + i.y = -o + } + var a = cc.Vec2.ZERO + , o = cc.Vec2.ONE; + function l(t, e) { + var r, l, h, c = e._target; + c ? s(t, r = c, l = a, h = o) : r = t._parent; + var u, _ = (u = r)instanceof cc.Scene ? cc.visibleRect : u._contentSize, f = r._anchorPoint, d = r instanceof cc.Scene, p = t.x, m = t.y, y = t._anchorPoint; + if (e._alignFlags & i) { + var v, g, A = _.width; + d ? (v = cc.visibleRect.left.x, + g = cc.visibleRect.right.x) : g = (v = -f.x * A) + A, + v += e._isAbsLeft ? e._left : e._left * A, + g -= e._isAbsRight ? e._right : e._right * A, + c && (v += l.x, + v *= h.x, + g += l.x, + g *= h.x); + var x, b = y.x, C = t.scaleX; + if (C < 0 && (b = 1 - b, + C = -C), + e.isStretchWidth) + x = g - v, + 0 !== C && (t.width = x / C), + p = v + b * x; + else if (x = t.width * C, + e.isAlignHorizontalCenter) { + var T = e._isAbsHorizontalCenter ? e._horizontalCenter : e._horizontalCenter * A + , S = (.5 - f.x) * _.width; + c && (T *= h.x, + S += l.x, + S *= h.x), + p = S + (b - .5) * x + T + } else + p = e.isAlignLeft ? v + b * x : g + (b - 1) * x + } + if (e._alignFlags & n) { + var w, E, M = _.height; + d ? (E = cc.visibleRect.bottom.y, + w = cc.visibleRect.top.y) : w = (E = -f.y * M) + M, + E += e._isAbsBottom ? e._bottom : e._bottom * M, + w -= e._isAbsTop ? e._top : e._top * M, + c && (E += l.y, + E *= h.y, + w += l.y, + w *= h.y); + var D, B = y.y, I = t.scaleY; + if (I < 0 && (B = 1 - B, + I = -I), + e.isStretchHeight) + D = w - E, + 0 !== I && (t.height = D / I), + m = E + B * D; + else if (D = t.height * I, + e.isAlignVerticalCenter) { + var P = e._isAbsVerticalCenter ? e._verticalCenter : e._verticalCenter * M + , R = (.5 - f.y) * _.height; + c && (P *= h.y, + R += l.y, + R *= h.y), + m = R + (B - .5) * D + P + } else + m = e.isAlignBottom ? E + B * D : w + (B - 1) * D + } + t.setPosition(p, m) + } + function h(t) { + var e = t._widget; + e && (l(t, e), + e.alignMode !== r.ALWAYS ? _.remove(e) : u.push(e)); + for (var i = t._children, n = 0; n < i.length; n++) { + var s = i[n]; + s._active && h(s) + } + } + function c() { + var t = cc.director.getScene(); + if (t) { + if (_.isAligning = !0, + _._nodesOrderDirty) + u.length = 0, + h(t), + _._nodesOrderDirty = !1; + else { + var e, i = _._activeWidgetsIterator; + for (i.i = 0; i.i < u.length; ++i.i) + l((e = u[i.i]).node, e) + } + _.isAligning = !1 + } + } + var u = [] + , _ = cc._widgetManager = e.exports = { + _AlignFlags: { + TOP: 1, + MID: 2, + BOT: 4, + LEFT: 8, + CENTER: 16, + RIGHT: 32 + }, + isAligning: !1, + _nodesOrderDirty: !1, + _activeWidgetsIterator: new cc.js.array.MutableForwardIterator(u), + init: function(t) { + t.on(cc.Director.EVENT_AFTER_UPDATE, c); + var e = this.onResized.bind(this); + cc.view.on("canvas-resize", e), + window.addEventListener("orientationchange", e) + }, + add: function(t) { + t.node._widget = t, + this._nodesOrderDirty = !0 + }, + remove: function(t) { + t.node._widget = null, + this._activeWidgetsIterator.remove(t) + }, + onResized: function() { + var t = cc.director.getScene(); + t && this.refreshWidgetOnResized(t) + }, + refreshWidgetOnResized: function(t) { + var e = cc.Node.isNode(t) && t.getComponent(cc.Widget); + e && e.enabled && e.alignMode === r.ON_WINDOW_RESIZE && this.add(e); + for (var i = t._children, n = 0; n < i.length; n++) { + var s = i[n]; + this.refreshWidgetOnResized(s) + } + }, + updateAlignment: function t(e) { + var i = e._parent; + cc.Node.isNode(i) && t(i); + var n = e._widget || e.getComponent(cc.Widget); + n && i && l(e, n) + }, + AlignMode: r + } + } + ), { + "../CCNode": 29 + }], + 90: [(function(t, e) { + "use strict"; + var i = t("../value-types") + , n = t("../geom-utils") + , r = t("../utils/affine-transform") + , s = t("../renderer/index") + , a = t("../renderer/render-flow") + , o = t("../CCGame") + , l = null; + l = t("../../renderer/scene/camera"); + var h = cc.mat4() + , c = cc.mat4() + , u = cc.v3() + , _ = cc.v3() + , f = cc.v3() + , d = []; + function p() { + for (var t = 0, e = Number.MAX_VALUE; t < d.length; t++) { + var i = d[t]; + i._depth < e && (A.main = i, + e = i._depth) + } + } + var m = null; + function y() { + if (m) { + var t = m.getNode() + , e = cc.game.canvas; + t.z = e.height / 1.1566, + t.x = e.width / 2, + t.y = e.height / 2 + } + } + var v = cc.Enum({ + COLOR: 1, + DEPTH: 2, + STENCIL: 4 + }) + , g = cc.Enum({ + OPAQUE: 1, + TRANSPARENT: 2 + }) + , A = cc.Class({ + name: "cc.Camera", + extends: cc.Component, + ctor: function() { + if (o.renderType !== o.RENDER_TYPE_CANVAS) { + var t = new l; + t.setStages(["opaque"]), + t.dirty = !0, + this._inited = !1, + this._camera = t + } else + this._inited = !0 + }, + editor: !1, + properties: { + _cullingMask: 4294967295, + _clearFlags: v.DEPTH | v.STENCIL, + _backgroundColor: cc.color(0, 0, 0, 255), + _depth: 0, + _zoomRatio: 1, + _targetTexture: null, + _fov: 60, + _orthoSize: 10, + _nearClip: 1, + _farClip: 4096, + _ortho: !0, + _rect: cc.rect(0, 0, 1, 1), + _renderStages: 1, + _alignWithScreen: !0, + zoomRatio: { + get: function() { + return this._zoomRatio + }, + set: function(t) { + this._zoomRatio = t + }, + tooltip: !1 + }, + fov: { + get: function() { + return this._fov + }, + set: function(t) { + this._fov = t + }, + tooltip: !1 + }, + orthoSize: { + get: function() { + return this._orthoSize + }, + set: function(t) { + this._orthoSize = t + }, + tooltip: !1 + }, + nearClip: { + get: function() { + return this._nearClip + }, + set: function(t) { + this._nearClip = t, + this._updateClippingpPlanes() + }, + tooltip: !1 + }, + farClip: { + get: function() { + return this._farClip + }, + set: function(t) { + this._farClip = t, + this._updateClippingpPlanes() + }, + tooltip: !1 + }, + ortho: { + get: function() { + return this._ortho + }, + set: function(t) { + this._ortho = t, + this._updateProjection() + }, + tooltip: !1 + }, + rect: { + get: function() { + return this._rect + }, + set: function(t) { + this._rect = t, + this._updateRect() + }, + tooltip: !1 + }, + cullingMask: { + get: function() { + return this._cullingMask + }, + set: function(t) { + this._cullingMask = t, + this._updateCameraMask() + }, + tooltip: !1 + }, + clearFlags: { + get: function() { + return this._clearFlags + }, + set: function(t) { + this._clearFlags = t, + this._camera && this._camera.setClearFlags(t) + }, + tooltip: !1 + }, + backgroundColor: { + get: function() { + return this._backgroundColor + }, + set: function(t) { + this._backgroundColor.equals(t) || (this._backgroundColor.set(t), + this._updateBackgroundColor()) + }, + tooltip: !1 + }, + depth: { + get: function() { + return this._depth + }, + set: function(t) { + A.main === this ? this._depth < t && p() : A.main && t < A.main._depth && d.includes(this) && (A.main = this), + this._depth = t, + this._camera && this._camera.setPriority(t) + }, + tooltip: !1 + }, + targetTexture: { + get: function() { + return this._targetTexture + }, + set: function(t) { + this._targetTexture = t, + this._updateTargetTexture() + }, + tooltip: !1 + }, + renderStages: { + get: function() { + return this._renderStages + }, + set: function(t) { + this._renderStages = t, + this._updateStages() + }, + tooltip: !1 + }, + alignWithScreen: { + get: function() { + return this._alignWithScreen + }, + set: function(t) { + this._alignWithScreen = t + } + }, + _is3D: { + get: function() { + return this.node && this.node._is3DNode + } + } + }, + statics: { + main: null, + cameras: d, + ClearFlags: v, + findCamera: function(t) { + for (var e = 0, i = d.length; e < i; e++) { + var n = d[e]; + if (n.containsNode(t)) + return n + } + return null + }, + _findRendererCamera: function(t) { + for (var e = s.scene._cameras, i = 0; i < e._count; i++) + if (e._data[i]._cullingMask & t._cullingMask) + return e._data[i]; + return null + }, + _setupDebugCamera: function() { + if (!m && o.renderType !== o.RENDER_TYPE_CANVAS) { + var t = new l; + m = t, + t.setStages(["opaque"]), + t.setFov(60 * Math.PI / 180), + t.setNear(.1), + t.setFar(4096), + t.dirty = !0, + t.cullingMask = 1 << cc.Node.BuiltinGroupIndex.DEBUG, + t.setPriority(cc.macro.MAX_ZINDEX), + t.setClearFlags(0), + t.setColor(0, 0, 0, 0); + var e = new cc.Node; + t.setNode(e), + y(), + cc.view.on("design-resolution-changed", y), + s.scene.addCamera(t) + } + } + }, + _updateCameraMask: function() { + if (this._camera) { + var t = this._cullingMask & ~(1 << cc.Node.BuiltinGroupIndex.DEBUG); + this._camera.cullingMask = t + } + }, + _updateBackgroundColor: function() { + if (this._camera) { + var t = this._backgroundColor; + this._camera.setColor(t.r / 255, t.g / 255, t.b / 255, t.a / 255) + } + }, + _updateTargetTexture: function() { + if (this._camera) { + var t = this._targetTexture; + this._camera.setFrameBuffer(t ? t._framebuffer : null) + } + }, + _updateClippingpPlanes: function() { + this._camera && (this._camera.setNear(this._nearClip), + this._camera.setFar(this._farClip)) + }, + _updateProjection: function() { + if (this._camera) { + var t = this._ortho ? 1 : 0; + this._camera.setType(t) + } + }, + _updateRect: function() { + if (this._camera) { + var t = this._rect; + this._camera.setRect(t.x, t.y, t.width, t.height) + } + }, + _updateStages: function() { + var t = this._renderStages + , e = []; + t & g.OPAQUE && e.push("opaque"), + t & g.TRANSPARENT && e.push("transparent"), + this._camera.setStages(e) + }, + _init: function() { + if (!this._inited) { + this._inited = !0; + var t = this._camera; + t && (t.setNode(this.node), + t.setClearFlags(this._clearFlags), + t.setPriority(this._depth), + this._updateBackgroundColor(), + this._updateCameraMask(), + this._updateTargetTexture(), + this._updateClippingpPlanes(), + this._updateProjection(), + this._updateStages(), + this._updateRect(), + this.beforeDraw()) + } + }, + __preload: function() { + this._init() + }, + onEnable: function() { + o.renderType !== o.RENDER_TYPE_CANVAS && (cc.director.on(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this), + s.scene.addCamera(this._camera)), + d.push(this), + (!A.main || this._depth < A.main._depth) && (A.main = this) + }, + onDisable: function() { + o.renderType !== o.RENDER_TYPE_CANVAS && (cc.director.off(cc.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this), + s.scene.removeCamera(this._camera)), + cc.js.array.fastRemove(d, this), + A.main === this && (A.main = null, + p()) + }, + getScreenToWorldMatrix2D: function(t) { + return this.getWorldToScreenMatrix2D(t), + i.Mat4.invert(t, t), + t + }, + getWorldToScreenMatrix2D: function(t) { + this.node.getWorldRT(h); + var e = this.zoomRatio + , n = h.m; + n[0] *= e, + n[1] *= e, + n[4] *= e, + n[5] *= e; + var r = n[12] + , s = n[13] + , a = cc.visibleRect.center; + return n[12] = a.x - (n[0] * r + n[4] * s), + n[13] = a.y - (n[1] * r + n[5] * s), + t !== h && i.Mat4.copy(t, h), + t + }, + getScreenToWorldPoint: function(t, e) { + return this.node.is3DNode ? (e = e || new cc.Vec3, + this._camera.screenToWorld(e, t, cc.visibleRect.width, cc.visibleRect.height)) : (e = e || new cc.Vec2, + this.getScreenToWorldMatrix2D(h), + i.Vec2.transformMat4(e, t, h)), + e + }, + getWorldToScreenPoint: function(t, e) { + return this.node.is3DNode ? (e = e || new cc.Vec3, + this._camera.worldToScreen(e, t, cc.visibleRect.width, cc.visibleRect.height)) : (e = e || new cc.Vec2, + this.getWorldToScreenMatrix2D(h), + i.Vec2.transformMat4(e, t, h)), + e + }, + getRay: function(t) { + return cc.geomUtils ? (i.Vec3.set(f, t.x, t.y, 1), + this._camera.screenToWorld(_, f, cc.visibleRect.width, cc.visibleRect.height), + this.ortho ? (i.Vec3.set(f, t.x, t.y, -1), + this._camera.screenToWorld(u, f, cc.visibleRect.width, cc.visibleRect.height)) : this.node.getWorldPosition(u), + n.Ray.fromPoints(new n.Ray, u, _)) : t + }, + containsNode: function(t) { + return (t._cullingMask & this.cullingMask) > 0 + }, + render: function(t) { + if (!(t = t || cc.director.getScene())) + return null; + this.node.getWorldMatrix(h), + this.beforeDraw(), + a.renderCamera(this._camera, t) + }, + _onAlignWithScreen: function() { + var t = cc.game.canvas.height / cc.view._scaleY; + this._targetTexture && (t = cc.visibleRect.height); + var e = this._fov * cc.macro.RAD; + this.node.z = t / (2 * Math.tan(e / 2)), + e = 2 * Math.atan(Math.tan(e / 2) / this.zoomRatio), + this._camera.setFov(e), + this._camera.setOrthoHeight(t / 2 / this.zoomRatio), + this.node.setRotation(0, 0, 0, 1) + }, + beforeDraw: function() { + if (this._camera) { + if (this._alignWithScreen) + this._onAlignWithScreen(); + else { + var t = this._fov * cc.macro.RAD; + t = 2 * Math.atan(Math.tan(t / 2) / this.zoomRatio), + this._camera.setFov(t), + this._camera.setOrthoHeight(this._orthoSize / this.zoomRatio) + } + this._camera.dirty = !0 + } + } + }); + cc.js.mixin(A.prototype, { + getNodeToCameraTransform: function(t) { + var e = r.identity(); + return t.getWorldMatrix(c), + this.containsNode(t) && (this.getWorldToCameraMatrix(h), + i.Mat4.mul(c, c, h)), + r.fromMat4(e, c), + e + }, + getCameraToWorldPoint: function(t, e) { + return this.getScreenToWorldPoint(t, e) + }, + getWorldToCameraPoint: function(t, e) { + return this.getWorldToScreenPoint(t, e) + }, + getCameraToWorldMatrix: function(t) { + return this.getScreenToWorldMatrix2D(t) + }, + getWorldToCameraMatrix: function(t) { + return this.getWorldToScreenMatrix2D(t) + } + }), + e.exports = cc.Camera = A + } + ), { + "../../renderer/scene/camera": 335, + "../CCGame": 28, + "../geom-utils": 148, + "../renderer/index": 224, + "../renderer/render-flow": 225, + "../utils/affine-transform": 258, + "../value-types": 282 + }], + 91: [(function(t, e) { + "use strict"; + cc.Collider.Box = cc.Class({ + properties: { + _offset: cc.v2(0, 0), + _size: cc.size(100, 100), + offset: { + tooltip: !1, + get: function() { + return this._offset + }, + set: function(t) { + this._offset = t + }, + type: cc.Vec2 + }, + size: { + tooltip: !1, + get: function() { + return this._size + }, + set: function(t) { + this._size.width = t.width < 0 ? 0 : t.width, + this._size.height = t.height < 0 ? 0 : t.height + }, + type: cc.Size + } + }, + resetInEditor: !1 + }); + var i = cc.Class({ + name: "cc.BoxCollider", + extends: cc.Collider, + mixins: [cc.Collider.Box], + editor: !1 + }); + cc.BoxCollider = e.exports = i + } + ), {}], + 92: [(function(t, e) { + "use strict"; + cc.Collider.Circle = cc.Class({ + properties: { + _offset: cc.v2(0, 0), + _radius: 50, + offset: { + tooltip: !1, + get: function() { + return this._offset + }, + set: function(t) { + this._offset = t + }, + type: cc.Vec2 + }, + radius: { + tooltip: !1, + get: function() { + return this._radius + }, + set: function(t) { + this._radius = t < 0 ? 0 : t + } + } + }, + resetInEditor: !1 + }); + var i = cc.Class({ + name: "cc.CircleCollider", + extends: cc.Collider, + mixins: [cc.Collider.Circle], + editor: !1 + }); + cc.CircleCollider = e.exports = i + } + ), {}], + 93: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.Collider", + extends: cc.Component, + properties: { + editing: { + default: !1, + serializable: !1, + tooltip: !1 + }, + tag: { + tooltip: !1, + default: 0, + range: [0, 1e7], + type: cc.Integer + } + }, + onDisable: function() { + cc.director.getCollisionManager().removeCollider(this) + }, + onEnable: function() { + cc.director.getCollisionManager().addCollider(this) + } + }); + cc.Collider = e.exports = i + } + ), {}], + 94: [(function(t, e) { + "use strict"; + var i, n = (i = t("../value-types/vec2")) && i.__esModule ? i : { + default: i + }, r = t("./CCContact"), s = r.CollisionType, a = t("../CCNode").EventType, o = new n.default; + function l(t, e, i, n, r, s) { + var a = t.x + , o = t.y + , l = t.width + , h = t.height + , c = e.m + , u = c[0] + , _ = c[1] + , f = c[4] + , d = c[5] + , p = u * a + f * o + c[12] + , m = _ * a + d * o + c[13] + , y = u * l + , v = _ * l + , g = f * h + , A = d * h; + n.x = p, + n.y = m, + r.x = y + p, + r.y = v + m, + i.x = g + p, + i.y = A + m, + s.x = y + g + p, + s.y = v + A + m + } + var h = cc.Class({ + mixins: [cc.EventTarget], + properties: { + enabled: !1, + enabledDrawBoundingBox: !1 + }, + ctor: function() { + this._contacts = [], + this._colliders = [], + this._debugDrawer = null, + this._enabledDebugDraw = !1, + cc.director._scheduler && cc.director._scheduler.enableForTarget(this) + }, + update: function() { + if (this.enabled) { + var t, e, i = this._colliders; + for (t = 0, + e = i.length; t < e; t++) + this.updateCollider(i[t]); + var n = this._contacts + , r = []; + for (t = 0, + e = n.length; t < e; t++) { + var a = n[t].updateState(); + a !== s.None && r.push([a, n[t]]) + } + for (t = 0, + e = r.length; t < e; t++) { + var o = r[t]; + this._doCollide(o[0], o[1]) + } + this.drawColliders() + } + }, + _doCollide: function(t, e) { + var i; + switch (t) { + case s.CollisionEnter: + i = "onCollisionEnter"; + break; + case s.CollisionStay: + i = "onCollisionStay"; + break; + case s.CollisionExit: + i = "onCollisionExit" + } + var n, r, a, o = e.collider1, l = e.collider2, h = o.node._components, c = l.node._components; + for (n = 0, + r = h.length; n < r; n++) + (a = h[n])[i] && a[i](l, o); + for (n = 0, + r = c.length; n < r; n++) + (a = c[n])[i] && a[i](o, l) + }, + shouldCollide: function(t, e) { + var i = t.node + , n = e.node + , r = cc.game.collisionMatrix; + return i !== n && r[i.groupIndex][n.groupIndex] + }, + initCollider: function(t) { + if (!t.world) { + var e = t.world = {}; + e.aabb = cc.rect(), + e.preAabb = cc.rect(), + e.matrix = cc.mat4(), + e.radius = 0, + t instanceof cc.BoxCollider ? (e.position = null, + e.points = [cc.v2(), cc.v2(), cc.v2(), cc.v2()]) : t instanceof cc.PolygonCollider ? (e.position = null, + e.points = t.points.map((function(t) { + return cc.v2(t.x, t.y) + } + ))) : t instanceof cc.CircleCollider && (e.position = cc.v2(), + e.points = null) + } + }, + updateCollider: function(t) { + var e = t.offset + , i = t.world + , r = i.aabb + , s = i.matrix; + t.node.getWorldMatrix(s); + var a = i.preAabb; + if (a.x = r.x, + a.y = r.y, + a.width = r.width, + a.height = r.height, + t instanceof cc.BoxCollider) { + var h = t.size; + r.x = e.x - h.width / 2, + r.y = e.y - h.height / 2, + r.width = h.width, + r.height = h.height; + var c = i.points + , u = c[0] + , _ = c[1] + , f = c[2] + , d = c[3]; + l(r, s, u, _, f, d); + var p = Math.min(u.x, _.x, f.x, d.x) + , m = Math.min(u.y, _.y, f.y, d.y) + , y = Math.max(u.x, _.x, f.x, d.x) + , v = Math.max(u.y, _.y, f.y, d.y); + r.x = p, + r.y = m, + r.width = y - p, + r.height = v - m + } else if (t instanceof cc.CircleCollider) { + n.default.transformMat4(o, t.offset, s), + i.position.x = o.x, + i.position.y = o.y; + var g = s.m + , A = g[12] + , x = g[13]; + g[12] = g[13] = 0, + o.x = t.radius, + o.y = 0, + n.default.transformMat4(o, o, s); + var b = Math.sqrt(o.x * o.x + o.y * o.y); + i.radius = b, + r.x = i.position.x - b, + r.y = i.position.y - b, + r.width = 2 * b, + r.height = 2 * b, + g[12] = A, + g[13] = x + } else if (t instanceof cc.PolygonCollider) { + var C = t.points + , T = i.points; + T.length = C.length; + for (var S = 1e6, w = 1e6, E = -1e6, M = -1e6, D = 0, B = C.length; D < B; D++) { + T[D] || (T[D] = cc.v2()), + o.x = C[D].x + e.x, + o.y = C[D].y + e.y, + n.default.transformMat4(o, o, s); + var I = o.x + , P = o.y; + T[D].x = I, + T[D].y = P, + I > E && (E = I), + I < S && (S = I), + P > M && (M = P), + P < w && (w = P) + } + r.x = S, + r.y = w, + r.width = E - S, + r.height = M - w + } + }, + addCollider: function(t) { + var e = this._colliders; + if (-1 === e.indexOf(t)) { + for (var i = 0, n = e.length; i < n; i++) { + var s = e[i]; + if (this.shouldCollide(t, s)) { + var o = new r(t,s); + this._contacts.push(o) + } + } + e.push(t), + this.initCollider(t) + } + t.node.on(a.GROUP_CHANGED, this.onNodeGroupChanged, this) + }, + removeCollider: function(t) { + var e = this._colliders + , i = e.indexOf(t); + if (i >= 0) { + e.splice(i, 1); + for (var n = this._contacts, r = n.length - 1; r >= 0; r--) { + var o = n[r]; + o.collider1 !== t && o.collider2 !== t || (o.touching && this._doCollide(s.CollisionExit, o), + n.splice(r, 1)) + } + t.node.off(a.GROUP_CHANGED, this.onNodeGroupChanged, this) + } else + cc.errorID(6600) + }, + onNodeGroupChanged: function(t) { + for (var e = t.getComponents(cc.Collider), i = 0, n = e.length; i < n; i++) { + var r = e[i]; + cc.PhysicsCollider && r instanceof cc.PhysicsCollider || (this.removeCollider(r), + this.addCollider(r)) + } + }, + drawColliders: function() { + if (this._enabledDebugDraw) { + this._checkDebugDrawValid(); + var t = this._debugDrawer; + t.clear(); + for (var e = this._colliders, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (t.strokeColor = cc.Color.WHITE, + r instanceof cc.BoxCollider || r instanceof cc.PolygonCollider) { + var s = r.world.points; + if (s.length > 0) { + t.moveTo(s[0].x, s[0].y); + for (var a = 1; a < s.length; a++) + t.lineTo(s[a].x, s[a].y); + t.close(), + t.stroke() + } + } else + r instanceof cc.CircleCollider && (t.circle(r.world.position.x, r.world.position.y, r.world.radius), + t.stroke()); + if (this.enabledDrawBoundingBox) { + var o = r.world.aabb; + t.strokeColor = cc.Color.BLUE, + t.moveTo(o.xMin, o.yMin), + t.lineTo(o.xMin, o.yMax), + t.lineTo(o.xMax, o.yMax), + t.lineTo(o.xMax, o.yMin), + t.close(), + t.stroke() + } + } + } + }, + _checkDebugDrawValid: function() { + if (!this._debugDrawer || !this._debugDrawer.isValid) { + var t = new cc.Node("COLLISION_MANAGER_DEBUG_DRAW"); + t.zIndex = cc.macro.MAX_ZINDEX, + cc.game.addPersistRootNode(t), + this._debugDrawer = t.addComponent(cc.Graphics) + } + } + }); + cc.js.getset(h.prototype, "enabledDebugDraw", (function() { + return this._enabledDebugDraw + } + ), (function(t) { + t && !this._enabledDebugDraw ? (this._checkDebugDrawValid(), + this._debugDrawer.node.active = !0) : !t && this._enabledDebugDraw && (this._debugDrawer.clear(!0), + this._debugDrawer.node.active = !1), + this._enabledDebugDraw = t + } + )), + cc.CollisionManager = e.exports = h + } + ), { + "../CCNode": 29, + "../value-types/vec2": 291, + "./CCContact": 95 + }], + 95: [(function(t, e) { + "use strict"; + var i = t("./CCIntersection") + , n = cc.Enum({ + None: 0, + CollisionEnter: 1, + CollisionStay: 2, + CollisionExit: 3 + }); + function r(t, e) { + this.collider1 = t, + this.collider2 = e, + this.touching = !1; + var n = t instanceof cc.BoxCollider || t instanceof cc.PolygonCollider + , r = e instanceof cc.BoxCollider || e instanceof cc.PolygonCollider + , s = t instanceof cc.CircleCollider + , a = e instanceof cc.CircleCollider; + n && r ? this.testFunc = i.polygonPolygon : s && a ? this.testFunc = i.circleCircle : n && a ? this.testFunc = i.polygonCircle : s && r ? (this.testFunc = i.polygonCircle, + this.collider1 = e, + this.collider2 = t) : cc.errorID(6601, cc.js.getClassName(t), cc.js.getClassName(e)) + } + r.prototype.test = function() { + var t = this.collider1.world + , e = this.collider2.world; + return !!t.aabb.intersects(e.aabb) && (this.testFunc === i.polygonPolygon ? this.testFunc(t.points, e.points) : this.testFunc === i.circleCircle ? this.testFunc(t, e) : this.testFunc === i.polygonCircle && this.testFunc(t.points, e)) + } + , + r.prototype.updateState = function() { + var t = this.test() + , e = n.None; + return t && !this.touching ? (this.touching = !0, + e = n.CollisionEnter) : t && this.touching ? e = n.CollisionStay : !t && this.touching && (this.touching = !1, + e = n.CollisionExit), + e + } + , + r.CollisionType = n, + e.exports = r + } + ), { + "./CCIntersection": 96 + }], + 96: [(function(t, e) { + "use strict"; + var i = {}; + function n(t, e, i, n) { + var r = (n.x - i.x) * (t.y - i.y) - (n.y - i.y) * (t.x - i.x) + , s = (e.x - t.x) * (t.y - i.y) - (e.y - t.y) * (t.x - i.x) + , a = (n.y - i.y) * (e.x - t.x) - (n.x - i.x) * (e.y - t.y); + if (0 !== a) { + var o = r / a + , l = s / a; + if (0 <= o && o <= 1 && 0 <= l && l <= 1) + return !0 + } + return !1 + } + function r(t, e, i) { + for (var r = i.length, s = 0; s < r; ++s) + if (n(t, e, i[s], i[(s + 1) % r])) + return !0; + return !1 + } + function s(t, e) { + for (var i = !1, n = t.x, r = t.y, s = e.length, a = 0, o = s - 1; a < s; o = a++) { + var l = e[a].x + , h = e[a].y + , c = e[o].x + , u = e[o].y; + h > r != u > r && n < (c - l) * (r - h) / (u - h) + l && (i = !i) + } + return i + } + function a(t, e, i, n) { + var r, s = i.x - e.x, a = i.y - e.y, o = s * s + a * a, l = ((t.x - e.x) * s + (t.y - e.y) * a) / o; + return r = n ? o ? l < 0 ? e : l > 1 ? i : cc.v2(e.x + l * s, e.y + l * a) : e : cc.v2(e.x + l * s, e.y + l * a), + s = t.x - r.x, + a = t.y - r.y, + Math.sqrt(s * s + a * a) + } + i.lineLine = n, + i.lineRect = function(t, e, i) { + var r = new cc.Vec2(i.x,i.y) + , s = new cc.Vec2(i.x,i.yMax) + , a = new cc.Vec2(i.xMax,i.yMax) + , o = new cc.Vec2(i.xMax,i.y); + return !!(n(t, e, r, s) || n(t, e, s, a) || n(t, e, a, o) || n(t, e, o, r)) + } + , + i.linePolygon = r, + i.rectRect = function(t, e) { + var i = t.x + , n = t.y + , r = t.x + t.width + , s = t.y + t.height + , a = e.x + , o = e.y + , l = e.x + e.width + , h = e.y + e.height; + return i <= l && r >= a && n <= h && s >= o + } + , + i.rectPolygon = function(t, e) { + var i, n, a = new cc.Vec2(t.x,t.y), o = new cc.Vec2(t.x,t.yMax), l = new cc.Vec2(t.xMax,t.yMax), h = new cc.Vec2(t.xMax,t.y); + if (r(a, o, e)) + return !0; + if (r(o, l, e)) + return !0; + if (r(l, h, e)) + return !0; + if (r(h, a, e)) + return !0; + for (i = 0, + n = e.length; i < n; ++i) + if (s(e[i], t)) + return !0; + return !!(s(a, e) || s(o, e) || s(l, e) || s(h, e)) + } + , + i.polygonPolygon = function(t, e) { + var i, n; + for (i = 0, + n = t.length; i < n; ++i) + if (r(t[i], t[(i + 1) % n], e)) + return !0; + for (i = 0, + n = e.length; i < n; ++i) + if (s(e[i], t)) + return !0; + for (i = 0, + n = t.length; i < n; ++i) + if (s(t[i], e)) + return !0; + return !1 + } + , + i.circleCircle = function(t, e) { + return t.position.sub(e.position).mag() < t.radius + e.radius + } + , + i.polygonCircle = function(t, e) { + var i = e.position; + if (s(i, t)) + return !0; + for (var n = 0, r = t.length; n < r; n++) + if (a(i, 0 === n ? t[t.length - 1] : t[n - 1], t[n], !0) < e.radius) + return !0; + return !1 + } + , + i.pointInPolygon = s, + i.pointLineDistance = a, + cc.Intersection = e.exports = i + } + ), {}], + 97: [(function(t, e) { + "use strict"; + cc.Collider.Polygon = cc.Class({ + properties: { + threshold: { + default: 1, + serializable: !1, + visible: !1 + }, + _offset: cc.v2(0, 0), + offset: { + get: function() { + return this._offset + }, + set: function(t) { + this._offset = t + }, + type: cc.Vec2 + }, + points: { + tooltip: !1, + default: function() { + return [cc.v2(-50, -50), cc.v2(50, -50), cc.v2(50, 50), cc.v2(-50, 50)] + }, + type: [cc.Vec2] + } + }, + resetPointsByContour: !1 + }); + var i = cc.Class({ + name: "cc.PolygonCollider", + extends: cc.Collider, + mixins: [cc.Collider.Polygon], + editor: !1 + }); + cc.PolygonCollider = e.exports = i + } + ), {}], + 98: [(function(t) { + "use strict"; + t("./CCCollisionManager"), + t("./CCCollider"), + t("./CCBoxCollider"), + t("./CCCircleCollider"), + t("./CCPolygonCollider") + } + ), { + "./CCBoxCollider": 91, + "./CCCircleCollider": 92, + "./CCCollider": 93, + "./CCCollisionManager": 94, + "./CCPolygonCollider": 97 + }], + 99: [(function(t, e) { + "use strict"; + t("./platform/CCClass"); + var i = t("./platform/CCObject").Flags + , n = t("./platform/js").array + , r = i.IsStartCalled + , s = i.IsOnEnableCalled; + function a(t, e) { + for (var i = e.constructor._executionOrder, n = e._id, r = 0, s = t.length - 1, a = s >>> 1; r <= s; a = r + s >>> 1) { + var o = t[a] + , l = o.constructor._executionOrder; + if (l > i) + s = a - 1; + else if (l < i) + r = a + 1; + else { + var h = o._id; + if (h > n) + s = a - 1; + else { + if (!(h < n)) + return a; + r = a + 1 + } + } + } + return ~r + } + function o(t, e) { + for (var i = t.array, n = t.i + 1; n < i.length; ) { + var r = i[n]; + r._enabled && r.node._activeInHierarchy ? ++n : (t.removeAt(n), + e && (r._objFlags &= ~e)) + } + } + i.IsEditorOnEnableCalled; + var l = cc.Class({ + __ctor__: function(t) { + var e = n.MutableForwardIterator; + this._zero = new e([]), + this._neg = new e([]), + this._pos = new e([]), + this._invoke = t + }, + statics: { + stableRemoveInactive: o + }, + add: null, + remove: null, + invoke: null + }); + function h(t, e) { + return t.constructor._executionOrder - e.constructor._executionOrder + } + var c = cc.Class({ + extends: l, + add: function(t) { + var e = t.constructor._executionOrder; + (0 === e ? this._zero : e < 0 ? this._neg : this._pos).array.push(t) + }, + remove: function(t) { + var e = t.constructor._executionOrder; + (0 === e ? this._zero : e < 0 ? this._neg : this._pos).fastRemove(t) + }, + cancelInactive: function(t) { + o(this._zero, t), + o(this._neg, t), + o(this._pos, t) + }, + invoke: function() { + var t = this._neg; + t.array.length > 0 && (t.array.sort(h), + this._invoke(t), + t.array.length = 0), + this._invoke(this._zero), + this._zero.array.length = 0; + var e = this._pos; + e.array.length > 0 && (e.array.sort(h), + this._invoke(e), + e.array.length = 0) + } + }) + , u = cc.Class({ + extends: l, + add: function(t) { + var e = t.constructor._executionOrder; + if (0 === e) + this._zero.array.push(t); + else { + var i = e < 0 ? this._neg.array : this._pos.array + , n = a(i, t); + n < 0 && i.splice(~n, 0, t) + } + }, + remove: function(t) { + var e = t.constructor._executionOrder; + if (0 === e) + this._zero.fastRemove(t); + else { + var i = e < 0 ? this._neg : this._pos + , n = a(i.array, t); + n >= 0 && i.removeAt(n) + } + }, + invoke: function(t) { + this._neg.array.length > 0 && this._invoke(this._neg, t), + this._invoke(this._zero, t), + this._pos.array.length > 0 && this._invoke(this._pos, t) + } + }); + function _(t, e, i, n) { + var r = "var a=it.array;for(it.i=0;it.i= 0 ? n.fastRemoveAt(this._deferredComps, e) : (!t.start || t._objFlags & r || this.startInvoker.remove(t), + t.update && this.updateInvoker.remove(t), + t.lateUpdate && this.lateUpdateInvoker.remove(t)) + }, + enableComp: function(t, e) { + if (!(t._objFlags & s)) { + if (t.onEnable) { + if (e) + return void e.add(t); + if (t.onEnable(), + !t.node._activeInHierarchy) + return + } + this._onEnabled(t) + } + }, + disableComp: function(t) { + t._objFlags & s && (t.onDisable && t.onDisable(), + this._onDisabled(t)) + }, + _scheduleImmediate: function(t) { + "function" != typeof t.start || t._objFlags & r || this.startInvoker.add(t), + "function" == typeof t.update && this.updateInvoker.add(t), + "function" == typeof t.lateUpdate && this.lateUpdateInvoker.add(t) + }, + _deferredSchedule: function() { + for (var t = this._deferredComps, e = 0, i = t.length; e < i; e++) + this._scheduleImmediate(t[e]); + t.length = 0 + }, + _startForNewComps: function() { + this._deferredComps.length > 0 && (this._deferredSchedule(), + this.startInvoker.invoke()) + }, + startPhase: function() { + this._updating = !0, + this.startInvoker.invoke(), + this._startForNewComps() + }, + updatePhase: function(t) { + this.updateInvoker.invoke(t) + }, + lateUpdatePhase: function(t) { + this.lateUpdateInvoker.invoke(t), + this._updating = !1, + this._startForNewComps() + } + }); + e.exports = y + } + ), { + "./platform/CCClass": 193, + "./platform/CCObject": 199, + "./platform/js": 214, + "./utils/misc": 267 + }], + 100: [(function(t, e) { + "use strict"; + var i = t("../../animation/animation-animator") + , n = t("../../animation/animation-clip") + , r = t("../event/event-target") + , s = t("../platform/js") + , a = function(t, e) { + return t === e + } + , o = cc.Enum({ + PLAY: "play", + STOP: "stop", + PAUSE: "pause", + RESUME: "resume", + LASTFRAME: "lastframe", + FINISHED: "finished" + }) + , l = cc.Class({ + name: "cc.Animation", + extends: t("./CCComponent"), + mixins: [r], + editor: !1, + statics: { + EventType: o + }, + ctor: function() { + cc.EventTarget.call(this), + this._animator = null, + this._nameToState = s.createMap(!0), + this._didInit = !1, + this._currentClip = null + }, + properties: { + _defaultClip: { + default: null, + type: n + }, + defaultClip: { + type: n, + get: function() { + return this._defaultClip + }, + set: function() {}, + tooltip: !1 + }, + currentClip: { + get: function() { + return this._currentClip + }, + set: function(t) { + this._currentClip = t + }, + type: n, + visible: !1 + }, + _writableClips: { + get: function() { + return this._clips + }, + set: function(t) { + this._didInit = !1, + this._clips = t, + this._init() + }, + type: [n] + }, + _clips: { + default: [], + type: [n], + tooltip: !1, + visible: !0 + }, + playOnLoad: { + default: !1, + tooltip: !1 + } + }, + start: function() { + if (this.playOnLoad && this._defaultClip && (!this._animator || !this._animator.isPlaying)) { + var t = this.getAnimationState(this._defaultClip.name); + this._animator.playState(t) + } + }, + onEnable: function() { + this._animator && this._animator.resume() + }, + onDisable: function() { + this._animator && this._animator.pause() + }, + onDestroy: function() { + this.stop() + }, + getClips: function() { + return this._clips + }, + play: function(t, e) { + var i = this.playAdditive(t, e); + return this._animator.stopStatesExcept(i), + i + }, + playAdditive: function(t, e) { + this._init(); + var i = this.getAnimationState(t || this._defaultClip && this._defaultClip.name); + if (i) { + this.enabled = !0; + var n = this._animator; + n.isPlaying && i.isPlaying ? i.isPaused ? n.resumeState(i) : (n.stopState(i), + n.playState(i, e)) : n.playState(i, e), + this.enabledInHierarchy || n.pause(), + this.currentClip = i.clip + } + return i + }, + stop: function(t) { + if (this._didInit) + if (t) { + var e = this._nameToState[t]; + e && this._animator.stopState(e) + } else + this._animator.stop() + }, + pause: function(t) { + if (this._didInit) + if (t) { + var e = this._nameToState[t]; + e && this._animator.pauseState(e) + } else + this.enabled = !1 + }, + resume: function(t) { + if (this._didInit) + if (t) { + var e = this.getAnimationState(t); + e && this._animator.resumeState(e) + } else + this.enabled = !0 + }, + setCurrentTime: function(t, e) { + if (this._init(), + e) { + var i = this.getAnimationState(e); + i && this._animator.setStateTime(i, t) + } else + this._animator.setStateTime(t) + }, + getAnimationState: function(t) { + this._init(); + var e = this._nameToState[t]; + return e && !e.curveLoaded && this._animator._reloadClip(e), + e || null + }, + addClip: function(t, e) { + if (t) { + this._init(), + cc.js.array.contains(this._clips, t) || this._clips.push(t), + e = e || t.name; + var i = this._nameToState[e]; + if (i) { + if (i.clip === t) + return i; + var n = this._clips.indexOf(i.clip); + -1 !== n && this._clips.splice(n, 1) + } + var r = new cc.AnimationState(t,e); + return this._nameToState[e] = r, + r + } + cc.warnID(3900) + }, + removeClip: function(t, e) { + if (t) { + var i; + for (var n in this._init(), + this._nameToState) + if (i = this._nameToState[n], + a(i.clip, t)) + break; + if (t === this._defaultClip) { + if (!e) + return void cc.warnID(3902); + this._defaultClip = null + } + if (i && i.isPlaying) { + if (!e) + return void cc.warnID(3903); + this.stop(i.name) + } + this._clips = this._clips.filter((function(e) { + return !a(e, t) + } + )), + i && delete this._nameToState[i.name] + } else + cc.warnID(3901) + }, + sample: function(t) { + if (this._init(), + t) { + var e = this.getAnimationState(t); + e && e.sample() + } else + this._animator.sample() + }, + on: function(t, e, i, n) { + this._init(); + var r = this._EventTargetOn(t, e, i, n); + if ("lastframe" === t) { + var s = this._nameToState; + for (var a in s) + s[a]._lastframeEventOn = !0 + } + return r + }, + off: function(t, e, i, n) { + if (this._init(), + "lastframe" === t) { + var r = this._nameToState; + for (var s in r) + r[s]._lastframeEventOn = !1 + } + this._EventTargetOff(t, e, i, n) + }, + _init: function() { + this._didInit || (this._didInit = !0, + this._animator = new i(this.node,this), + this._createStates()) + }, + _createStates: function() { + this._nameToState = s.createMap(!0); + for (var t = null, e = !1, i = 0; i < this._clips.length; ++i) { + var n = this._clips[i]; + n && (t = new cc.AnimationState(n), + this._nameToState[t.name] = t, + a(this._defaultClip, n) && (e = t)) + } + this._defaultClip && !e && (t = new cc.AnimationState(this._defaultClip), + this._nameToState[t.name] = t) + } + }); + l.prototype._EventTargetOn = r.prototype.on, + l.prototype._EventTargetOff = r.prototype.off, + cc.Animation = e.exports = l + } + ), { + "../../animation/animation-animator": 9, + "../../animation/animation-clip": 10, + "../event/event-target": 140, + "../platform/js": 214, + "./CCComponent": 105 + }], + 101: [(function(t, e) { + "use strict"; + var i = t("../utils/misc") + , n = t("./CCComponent") + , r = t("../assets/CCAudioClip") + , s = cc.Class({ + name: "cc.AudioSource", + extends: n, + editor: !1, + ctor: function() { + this.audio = new cc._Audio + }, + properties: { + _clip: { + default: null, + type: r + }, + _volume: 1, + _mute: !1, + _loop: !1, + _pausedFlag: { + default: !1, + serializable: !1 + }, + _firstlyEnabled: !0, + isPlaying: { + get: function() { + return this.audio.getState() === cc._Audio.State.PLAYING + }, + visible: !1 + }, + clip: { + get: function() { + return this._clip + }, + set: function(t) { + if (t !== this._clip) { + if (!(t instanceof r)) + return cc.error("Wrong type of AudioClip."); + this._clip = t, + this.audio.stop(), + this.audio.src = this._clip, + this.preload && this._clip._ensureLoaded() + } + }, + type: r, + tooltip: !1, + animatable: !1 + }, + volume: { + get: function() { + return this._volume + }, + set: function(t) { + return t = i.clamp01(t), + this._volume = t, + this._mute || this.audio.setVolume(t), + t + }, + tooltip: !1 + }, + mute: { + get: function() { + return this._mute + }, + set: function(t) { + return this._mute = t, + this.audio.setVolume(t ? 0 : this._volume), + t + }, + animatable: !1, + tooltip: !1 + }, + loop: { + get: function() { + return this._loop + }, + set: function(t) { + return this._loop = t, + this.audio.setLoop(t), + t + }, + animatable: !1, + tooltip: !1 + }, + playOnLoad: { + default: !1, + tooltip: !1, + animatable: !1 + }, + preload: { + default: !1, + animatable: !1 + } + }, + _pausedCallback: function() { + this.audio.getState() === cc._Audio.State.PLAYING && (this.audio.pause(), + this._pausedFlag = !0) + }, + _restoreCallback: function() { + this._pausedFlag && this.audio.resume(), + this._pausedFlag = !1 + }, + onLoad: function() { + this.audio.src || (this.audio.src = this._clip), + this.preload && this._clip._ensureLoaded() + }, + onEnable: function() { + this.playOnLoad && this._firstlyEnabled && (this._firstlyEnabled = !1, + this.play()), + cc.game.on(cc.game.EVENT_HIDE, this._pausedCallback, this), + cc.game.on(cc.game.EVENT_SHOW, this._restoreCallback, this) + }, + onDisable: function() { + this.stop(), + cc.game.off(cc.game.EVENT_HIDE, this._pausedCallback, this), + cc.game.off(cc.game.EVENT_SHOW, this._restoreCallback, this) + }, + onDestroy: function() { + this.audio.destroy() + }, + play: function() { + if (this._clip) { + var t = this.audio; + t.setVolume(this._mute ? 0 : this._volume), + t.setLoop(this._loop), + t.setCurrentTime(0), + t.play() + } + }, + stop: function() { + this.audio.stop() + }, + pause: function() { + this.audio.pause() + }, + resume: function() { + this.audio.resume() + }, + rewind: function() { + this.audio.setCurrentTime(0) + }, + getCurrentTime: function() { + return this.audio.getCurrentTime() + }, + setCurrentTime: function(t) { + return this.audio.setCurrentTime(t), + t + }, + getDuration: function() { + return this.audio.getDuration() + } + }); + cc.AudioSource = e.exports = s + } + ), { + "../assets/CCAudioClip": 63, + "../utils/misc": 267, + "./CCComponent": 105 + }], + 102: [(function(t, e) { + "use strict"; + var i = ["touchstart", "touchmove", "touchend", "mousedown", "mousemove", "mouseup", "mouseenter", "mouseleave", "mousewheel"]; + function n(t) { + t.stopPropagation() + } + var r = cc.Class({ + name: "cc.BlockInputEvents", + extends: t("./CCComponent"), + editor: { + menu: "i18n:MAIN_MENU.component.ui/Block Input Events", + inspector: "packages://inspector/inspectors/comps/block-input-events.js", + help: "i18n:COMPONENT.help_url.block_input_events" + }, + onEnable: function() { + for (var t = 0; t < i.length; t++) + this.node.on(i[t], n, this) + }, + onDisable: function() { + for (var t = 0; t < i.length; t++) + this.node.off(i[t], n, this) + } + }); + cc.BlockInputEvents = e.exports = r + } + ), { + "./CCComponent": 105 + }], + 103: [(function(t, e) { + "use strict"; + var i = t("./CCComponent") + , n = t("../utils/gray-sprite-state") + , r = cc.Enum({ + NONE: 0, + COLOR: 1, + SPRITE: 2, + SCALE: 3 + }) + , s = cc.Enum({ + NORMAL: 0, + HOVER: 1, + PRESSED: 2, + DISABLED: 3 + }) + , a = cc.Class({ + name: "cc.Button", + extends: i, + mixins: [n], + ctor: function() { + this._pressed = !1, + this._hovered = !1, + this._fromColor = null, + this._toColor = null, + this._time = 0, + this._transitionFinished = !0, + this._fromScale = cc.Vec2.ZERO, + this._toScale = cc.Vec2.ZERO, + this._originalScale = null, + this._graySpriteMaterial = null, + this._spriteMaterial = null, + this._sprite = null + }, + editor: !1, + properties: { + interactable: { + default: !0, + tooltip: !1, + notify: function() { + this._updateState(), + this.interactable || this._resetState() + }, + animatable: !1 + }, + _resizeToTarget: { + animatable: !1, + set: function(t) { + t && this._resizeNodeToTargetNode() + } + }, + enableAutoGrayEffect: { + default: !1, + tooltip: !1, + notify: function() { + this._updateDisabledState(!0) + } + }, + transition: { + default: r.NONE, + tooltip: !1, + type: r, + animatable: !1, + notify: function(t) { + this._updateTransition(t) + }, + formerlySerializedAs: "transition" + }, + normalColor: { + default: cc.Color.WHITE, + displayName: "Normal", + tooltip: !1, + notify: function() { + this.transition === r.Color && this._getButtonState() === s.NORMAL && (this._getTarget().opacity = this.normalColor.a), + this._updateState() + } + }, + pressedColor: { + default: cc.color(211, 211, 211), + displayName: "Pressed", + tooltip: !1, + notify: function() { + this.transition === r.Color && this._getButtonState() === s.PRESSED && (this._getTarget().opacity = this.pressedColor.a), + this._updateState() + }, + formerlySerializedAs: "pressedColor" + }, + hoverColor: { + default: cc.Color.WHITE, + displayName: "Hover", + tooltip: !1, + notify: function() { + this.transition === r.Color && this._getButtonState() === s.HOVER && (this._getTarget().opacity = this.hoverColor.a), + this._updateState() + }, + formerlySerializedAs: "hoverColor" + }, + disabledColor: { + default: cc.color(124, 124, 124), + displayName: "Disabled", + tooltip: !1, + notify: function() { + this.transition === r.Color && this._getButtonState() === s.DISABLED && (this._getTarget().opacity = this.disabledColor.a), + this._updateState() + } + }, + duration: { + default: .1, + range: [0, 10], + tooltip: !1 + }, + zoomScale: { + default: 1.2, + tooltip: !1 + }, + normalSprite: { + default: null, + type: cc.SpriteFrame, + displayName: "Normal", + tooltip: !1, + notify: function() { + this._updateState() + } + }, + pressedSprite: { + default: null, + type: cc.SpriteFrame, + displayName: "Pressed", + tooltip: !1, + formerlySerializedAs: "pressedSprite", + notify: function() { + this._updateState() + } + }, + hoverSprite: { + default: null, + type: cc.SpriteFrame, + displayName: "Hover", + tooltip: !1, + formerlySerializedAs: "hoverSprite", + notify: function() { + this._updateState() + } + }, + disabledSprite: { + default: null, + type: cc.SpriteFrame, + displayName: "Disabled", + tooltip: !1, + notify: function() { + this._updateState() + } + }, + target: { + default: null, + type: cc.Node, + tooltip: !1, + notify: function(t) { + this._applyTarget(), + t && this.target !== t && this._unregisterTargetEvent(t) + } + }, + clickEvents: { + default: [], + type: cc.Component.EventHandler, + tooltip: !1 + } + }, + statics: { + Transition: r + }, + __preload: function() { + this._applyTarget(), + this._resetState() + }, + _resetState: function() { + this._pressed = !1, + this._hovered = !1; + var t = this._getTarget() + , e = this.transition + , i = this._originalScale; + e === r.COLOR && this.interactable ? this._setTargetColor(this.normalColor) : e === r.SCALE && i && t.setScale(i.x, i.y), + this._transitionFinished = !0 + }, + onEnable: function() { + this.normalSprite && this.normalSprite.ensureLoadTexture(), + this.hoverSprite && this.hoverSprite.ensureLoadTexture(), + this.pressedSprite && this.pressedSprite.ensureLoadTexture(), + this.disabledSprite && this.disabledSprite.ensureLoadTexture(), + this._registerNodeEvent(), + this._updateState() + }, + onDisable: function() { + this._resetState(), + this._unregisterNodeEvent() + }, + _getTarget: function() { + return this.target ? this.target : this.node + }, + _onTargetSpriteFrameChanged: function(t) { + this.transition === r.SPRITE && this._setCurrentStateSprite(t.spriteFrame) + }, + _onTargetColorChanged: function(t) { + this.transition === r.COLOR && this._setCurrentStateColor(t) + }, + _onTargetScaleChanged: function() { + var t = this._getTarget(); + this._originalScale && (this.transition !== r.SCALE || this._transitionFinished) && (this._originalScale.x = t.scaleX, + this._originalScale.y = t.scaleY) + }, + _setTargetColor: function(t) { + var e = this._getTarget() + , i = t.clone(); + e.opacity = i.a, + i.a = 255, + e.color = i + }, + _getStateColor: function(t) { + switch (t) { + case s.NORMAL: + return this.normalColor; + case s.HOVER: + return this.hoverColor; + case s.PRESSED: + return this.pressedColor; + case s.DISABLED: + return this.disabledColor + } + }, + _getStateSprite: function(t) { + switch (t) { + case s.NORMAL: + return this.normalSprite; + case s.HOVER: + return this.hoverSprite; + case s.PRESSED: + return this.pressedSprite; + case s.DISABLED: + return this.disabledSprite + } + }, + _setCurrentStateColor: function(t) { + switch (this._getButtonState()) { + case s.NORMAL: + this.normalColor = t; + break; + case s.HOVER: + this.hoverColor = t; + break; + case s.PRESSED: + this.pressedColor = t; + break; + case s.DISABLED: + this.disabledColor = t + } + }, + _setCurrentStateSprite: function(t) { + switch (this._getButtonState()) { + case s.NORMAL: + this.normalSprite = t; + break; + case s.HOVER: + this.hoverSprite = t; + break; + case s.PRESSED: + this.pressedSprite = t; + break; + case s.DISABLED: + this.disabledSprite = t + } + }, + update: function(t) { + var e = this._getTarget(); + if (!this._transitionFinished && (this.transition === r.COLOR || this.transition === r.SCALE)) { + this.time += t; + var i = 1; + if (this.duration > 0 && (i = this.time / this.duration), + i >= 1 && (i = 1), + this.transition === r.COLOR) { + var n = this._fromColor.lerp(this._toColor, i); + this._setTargetColor(n) + } else + this.transition === r.SCALE && this._originalScale && (e.scale = this._fromScale.lerp(this._toScale, i)); + 1 === i && (this._transitionFinished = !0) + } + }, + _registerNodeEvent: function() { + this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), + this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this), + this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), + this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this), + this.node.on(cc.Node.EventType.MOUSE_ENTER, this._onMouseMoveIn, this), + this.node.on(cc.Node.EventType.MOUSE_LEAVE, this._onMouseMoveOut, this) + }, + _unregisterNodeEvent: function() { + this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), + this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this), + this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), + this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this), + this.node.off(cc.Node.EventType.MOUSE_ENTER, this._onMouseMoveIn, this), + this.node.off(cc.Node.EventType.MOUSE_LEAVE, this._onMouseMoveOut, this) + }, + _registerTargetEvent: function(t) { + t.on(cc.Node.EventType.SCALE_CHANGED, this._onTargetScaleChanged, this) + }, + _unregisterTargetEvent: function(t) { + t.off(cc.Node.EventType.SCALE_CHANGED, this._onTargetScaleChanged, this) + }, + _getTargetSprite: function(t) { + var e = null; + return t && (e = t.getComponent(cc.Sprite)), + e + }, + _applyTarget: function() { + var t = this._getTarget(); + this._sprite = this._getTargetSprite(t), + this._originalScale || (this._originalScale = cc.Vec2.ZERO), + this._originalScale.x = t.scaleX, + this._originalScale.y = t.scaleY, + this._registerTargetEvent(t) + }, + _onTouchBegan: function(t) { + this.interactable && this.enabledInHierarchy && (this._pressed = !0, + this._updateState(), + t.stopPropagation()) + }, + _onTouchMove: function(t) { + if (this.interactable && this.enabledInHierarchy && this._pressed) { + var e, i = t.touch, n = this.node._hitTest(i.getLocation()), a = this._getTarget(), o = this._originalScale; + this.transition === r.SCALE && o ? n ? (this._fromScale.x = o.x, + this._fromScale.y = o.y, + this._toScale.x = o.x * this.zoomScale, + this._toScale.y = o.y * this.zoomScale, + this._transitionFinished = !1) : (this.time = 0, + this._transitionFinished = !0, + a.setScale(o.x, o.y)) : (e = n ? s.PRESSED : s.NORMAL, + this._applyTransition(e)), + t.stopPropagation() + } + }, + _onTouchEnded: function(t) { + this.interactable && this.enabledInHierarchy && (this._pressed && (cc.Component.EventHandler.emitEvents(this.clickEvents, t), + this.node.emit("click", this)), + this._pressed = !1, + this._updateState(), + t.stopPropagation()) + }, + _onTouchCancel: function() { + this.interactable && this.enabledInHierarchy && (this._pressed = !1, + this._updateState()) + }, + _onMouseMoveIn: function() { + !this._pressed && this.interactable && this.enabledInHierarchy && (this.transition !== r.SPRITE || this.hoverSprite) && (this._hovered || (this._hovered = !0, + this._updateState())) + }, + _onMouseMoveOut: function() { + this._hovered && (this._hovered = !1, + this._updateState()) + }, + _updateState: function() { + var t = this._getButtonState(); + this._applyTransition(t), + this._updateDisabledState() + }, + _getButtonState: function() { + return this.interactable ? this._pressed ? s.PRESSED : this._hovered ? s.HOVER : s.NORMAL : s.DISABLED + }, + _updateColorTransitionImmediately: function(t) { + var e = this._getStateColor(t); + this._setTargetColor(e), + this._fromColor = e.clone(), + this._toColor = e + }, + _updateColorTransition: function(t) { + if (t === s.DISABLED) + this._updateColorTransitionImmediately(t); + else { + var e = this._getTarget() + , i = this._getStateColor(t); + this._fromColor = e.color.clone(), + this._toColor = i, + this.time = 0, + this._transitionFinished = !1 + } + }, + _updateSpriteTransition: function(t) { + var e = this._getStateSprite(t); + this._sprite && e && (this._sprite.spriteFrame = e) + }, + _updateScaleTransition: function(t) { + t === s.PRESSED ? this._zoomUp() : this._zoomBack() + }, + _zoomUp: function() { + this._originalScale && (this._fromScale.x = this._originalScale.x, + this._fromScale.y = this._originalScale.y, + this._toScale.x = this._originalScale.x * this.zoomScale, + this._toScale.y = this._originalScale.y * this.zoomScale, + this.time = 0, + this._transitionFinished = !1) + }, + _zoomBack: function() { + if (this._originalScale) { + var t = this._getTarget(); + this._fromScale.x = t.scaleX, + this._fromScale.y = t.scaleY, + this._toScale.x = this._originalScale.x, + this._toScale.y = this._originalScale.y, + this.time = 0, + this._transitionFinished = !1 + } + }, + _updateTransition: function(t) { + t === r.COLOR ? this._updateColorTransitionImmediately(s.NORMAL) : t === r.SPRITE && this._updateSpriteTransition(s.NORMAL), + this._updateState() + }, + _applyTransition: function(t) { + var e = this.transition; + e === r.COLOR ? this._updateColorTransition(t) : e === r.SPRITE ? this._updateSpriteTransition(t) : e === r.SCALE && this._updateScaleTransition(t) + }, + _resizeNodeToTargetNode: !1, + _updateDisabledState: function(t) { + if (this._sprite && (this.enableAutoGrayEffect || t)) { + var e = !1; + this.transition === r.SPRITE && this.disabledSprite || (e = this.enableAutoGrayEffect && !this.interactable), + this._switchGrayMaterial(e, this._sprite) + } + } + }); + cc.Button = e.exports = a + } + ), { + "../utils/gray-sprite-state": 264, + "./CCComponent": 105 + }], + 104: [(function(t, e) { + "use strict"; + var i = t("../camera/CCCamera") + , n = t("./CCComponent") + , r = cc.Class({ + name: "cc.Canvas", + extends: n, + editor: !1, + resetInEditor: !1, + statics: { + instance: null + }, + properties: { + _designResolution: cc.size(960, 640), + designResolution: { + get: function() { + return cc.size(this._designResolution) + }, + set: function(t) { + this._designResolution.width = t.width, + this._designResolution.height = t.height, + this.applySettings() + }, + tooltip: !1 + }, + _fitWidth: !1, + _fitHeight: !0, + fitHeight: { + get: function() { + return this._fitHeight + }, + set: function(t) { + this._fitHeight !== t && (this._fitHeight = t, + this.applySettings()) + }, + tooltip: !1 + }, + fitWidth: { + get: function() { + return this._fitWidth + }, + set: function(t) { + this._fitWidth !== t && (this._fitWidth = t, + this.applySettings()) + }, + tooltip: !1 + } + }, + _fitDesignResolution: !1, + __preload: function() { + if (r.instance) + return cc.warnID(6700, this.node.name, r.instance.node.name); + r.instance = this, + this.applySettings(); + var t = this.getComponent(cc.Widget); + t && t.updateAlignment() + }, + start: function() { + if (!i.main && cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS) { + var t = new cc.Node("Main Camera"); + t.parent = this.node, + t.setSiblingIndex(0); + var e = t.addComponent(i) + , n = i.ClearFlags; + e.clearFlags = n.COLOR | n.DEPTH | n.STENCIL, + e.depth = -1 + } + }, + onDestroy: function() { + r.instance === this && (r.instance = null) + }, + applySettings: function() { + var t, e = cc.ResolutionPolicy; + t = this.fitHeight && this.fitWidth ? e.SHOW_ALL : this.fitHeight || this.fitWidth ? this.fitWidth ? e.FIXED_WIDTH : e.FIXED_HEIGHT : e.NO_BORDER; + var i = this._designResolution; + cc.view.setDesignResolutionSize(i.width, i.height, t) + } + }); + cc.Canvas = e.exports = r + } + ), { + "../camera/CCCamera": 90, + "./CCComponent": 105 + }], + 105: [(function(t, e) { + "use strict"; + var i = t("../platform/CCObject") + , n = t("../platform/js") + , r = new (t("../platform/id-generater"))("Comp") + , s = (i.Flags.IsOnEnableCalled, + i.Flags.IsOnLoadCalled) + , a = !!cc.ActionManager + , o = cc.Class({ + name: "cc.Component", + extends: i, + ctor: function() { + this._id = r.getNewId(), + this.__eventTargets = [] + }, + properties: { + node: { + default: null, + visible: !1 + }, + name: { + get: function() { + if (this._name) + return this._name; + var t = cc.js.getClassName(this) + , e = t.lastIndexOf("."); + return e >= 0 && (t = t.slice(e + 1)), + this.node.name + "<" + t + ">" + }, + set: function(t) { + this._name = t + }, + visible: !1 + }, + uuid: { + get: function() { + return this._id + }, + visible: !1 + }, + __scriptAsset: !1, + _enabled: !0, + enabled: { + get: function() { + return this._enabled + }, + set: function(t) { + if (this._enabled !== t && (this._enabled = t, + this.node._activeInHierarchy)) { + var e = cc.director._compScheduler; + t ? e.enableComp(this) : e.disableComp(this) + } + }, + visible: !1, + animatable: !0 + }, + enabledInHierarchy: { + get: function() { + return this._enabled && this.node._activeInHierarchy + }, + visible: !1 + }, + _isOnLoadCalled: { + get: function() { + return this._objFlags & s + } + } + }, + update: null, + lateUpdate: null, + __preload: null, + onLoad: null, + start: null, + onEnable: null, + onDisable: null, + onDestroy: null, + onFocusInEditor: null, + onLostFocusInEditor: null, + resetInEditor: null, + addComponent: function(t) { + return this.node.addComponent(t) + }, + getComponent: function(t) { + return this.node.getComponent(t) + }, + getComponents: function(t) { + return this.node.getComponents(t) + }, + getComponentInChildren: function(t) { + return this.node.getComponentInChildren(t) + }, + getComponentsInChildren: function(t) { + return this.node.getComponentsInChildren(t) + }, + _getLocalBounds: null, + onRestore: null, + destroy: function() { + this._super() && this._enabled && this.node._activeInHierarchy && cc.director._compScheduler.disableComp(this) + }, + _onPreDestroy: function() { + a && cc.director.getActionManager().removeAllActionsFromTarget(this), + this.unscheduleAllCallbacks(); + for (var t = this.__eventTargets, e = t.length - 1; e >= 0; --e) { + var i = t[e]; + i && i.targetOff(this) + } + t.length = 0, + cc.director._nodeActivator.destroyComp(this), + this.node._removeComponent(this) + }, + _instantiate: function(t) { + return t || (t = cc.instantiate._clone(this, this)), + t.node = null, + t + }, + schedule: function(t, e, i, n) { + cc.assertID(t, 1619), + e = e || 0, + cc.assertID(e >= 0, 1620), + i = isNaN(i) ? cc.macro.REPEAT_FOREVER : i, + n = n || 0; + var r = cc.director.getScheduler() + , s = r.isTargetPaused(this); + r.schedule(t, this, e, i, n, s) + }, + scheduleOnce: function(t, e) { + this.schedule(t, 0, 0, e) + }, + unschedule: function(t) { + t && cc.director.getScheduler().unschedule(t, this) + }, + unscheduleAllCallbacks: function() { + cc.director.getScheduler().unscheduleAllForTarget(this) + } + }); + o._requireComponent = null, + o._executionOrder = 0, + n.value(o, "_registerEditorProps", (function(t, e) { + var i = e.requireComponent; + i && (t._requireComponent = i); + var n = e.executionOrder; + n && "number" == typeof n && (t._executionOrder = n) + } + )), + o.prototype.__scriptUuid = "", + cc.Component = e.exports = o + } + ), { + "../platform/CCObject": 199, + "../platform/id-generater": 210, + "../platform/js": 214 + }], + 106: [(function() { + "use strict"; + cc.Component.EventHandler = cc.Class({ + name: "cc.ClickEvent", + properties: { + target: { + default: null, + type: cc.Node + }, + component: "", + _componentId: "", + _componentName: { + get: function() { + return this._genCompIdIfNeeded(), + this._compId2Name(this._componentId) + }, + set: function(t) { + this._componentId = this._compName2Id(t) + } + }, + handler: { + default: "" + }, + customEventData: { + default: "" + } + }, + statics: { + emitEvents: function(t) { + var e; + if (arguments.length > 0) + for (var i = 0, n = (e = new Array(arguments.length - 1)).length; i < n; i++) + e[i] = arguments[i + 1]; + for (var r = 0, s = t.length; r < s; r++) { + var a = t[r]; + a instanceof cc.Component.EventHandler && a.emit(e) + } + } + }, + emit: function(t) { + var e = this.target; + if (cc.isValid(e)) { + this._genCompIdIfNeeded(); + var i = cc.js._getClassById(this._componentId) + , n = e.getComponent(i); + if (cc.isValid(n)) { + var r = n[this.handler]; + "function" == typeof r && (null != this.customEventData && "" !== this.customEventData && (t = t.slice()).push(this.customEventData), + r.apply(n, t)) + } + } + }, + _compName2Id: function(t) { + var e = cc.js.getClassByName(t); + return cc.js._getClassId(e) + }, + _compId2Name: function(t) { + var e = cc.js._getClassById(t); + return cc.js.getClassName(e) + }, + _genCompIdIfNeeded: function() { + this._componentId || (this._componentName = this.component, + this.component = "") + } + }) + } + ), {}], + 107: [(function(t, e) { + "use strict"; + var i = t("../platform/CCMacro") + , n = t("./CCRenderComponent") + , r = (t("../assets/material/CCMaterial"), + t("../renderer/utils/label/label-frame")) + , s = t("../utils/blend-func") + , a = t("../renderer/utils/utils").deleteFromDynamicAtlas + , o = i.TextAlignment + , l = i.VerticalTextAlignment + , h = cc.Enum({ + NONE: 0, + CLAMP: 1, + SHRINK: 2, + RESIZE_HEIGHT: 3 + }) + , c = cc.Enum({ + NONE: 0, + BITMAP: 1, + CHAR: 2 + }) + , u = cc.Class({ + name: "cc.Label", + extends: n, + mixins: [s], + ctor: function() { + this._actualFontSize = 0, + this._assemblerData = null, + this._frame = null, + this._ttfTexture = null, + this._letterTexture = null, + cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? this._updateMaterial = this._updateMaterialCanvas : this._updateMaterial = this._updateMaterialWebgl + }, + editor: !1, + properties: { + _string: { + default: "", + formerlySerializedAs: "_N$string" + }, + string: { + get: function() { + return this._string + }, + set: function(t) { + var e = this._string; + this._string = "" + t, + this.string !== e && this.setVertsDirty(), + this._checkStringEmpty() + }, + multiline: !0, + tooltip: !1 + }, + horizontalAlign: { + default: o.LEFT, + type: o, + tooltip: !1, + notify: function(t) { + this.horizontalAlign !== t && this.setVertsDirty() + }, + animatable: !1 + }, + verticalAlign: { + default: l.TOP, + type: l, + tooltip: !1, + notify: function(t) { + this.verticalAlign !== t && this.setVertsDirty() + }, + animatable: !1 + }, + actualFontSize: { + displayName: "Actual Font Size", + animatable: !1, + readonly: !0, + get: function() { + return this._actualFontSize + }, + tooltip: !1 + }, + _fontSize: 40, + fontSize: { + get: function() { + return this._fontSize + }, + set: function(t) { + this._fontSize !== t && (this._fontSize = t, + this.setVertsDirty()) + }, + range: [0, 512], + tooltip: !1 + }, + fontFamily: { + default: "Arial", + tooltip: !1, + notify: function(t) { + this.fontFamily !== t && this.setVertsDirty() + }, + animatable: !1 + }, + _lineHeight: 40, + lineHeight: { + get: function() { + return this._lineHeight + }, + set: function(t) { + this._lineHeight !== t && (this._lineHeight = t, + this.setVertsDirty()) + }, + tooltip: !1 + }, + overflow: { + default: h.NONE, + type: h, + tooltip: !1, + notify: function(t) { + this.overflow !== t && this.setVertsDirty() + }, + animatable: !1 + }, + _enableWrapText: !0, + enableWrapText: { + get: function() { + return this._enableWrapText + }, + set: function(t) { + this._enableWrapText !== t && (this._enableWrapText = t, + this.setVertsDirty()) + }, + animatable: !1, + tooltip: !1 + }, + _N$file: null, + font: { + get: function() { + return this._N$file + }, + set: function(t) { + this.font !== t && (t || (this._isSystemFontUsed = !0), + this._N$file = t, + t && this._isSystemFontUsed && (this._isSystemFontUsed = !1), + this.enabledInHierarchy && this._forceUpdateRenderData()) + }, + type: cc.Font, + tooltip: !1, + animatable: !1 + }, + _isSystemFontUsed: !0, + useSystemFont: { + get: function() { + return this._isSystemFontUsed + }, + set: function(t) { + if (this._isSystemFontUsed !== t) { + if (this._isSystemFontUsed = !!t, + t) { + if (this.font = null, + !this.enabledInHierarchy) + return; + this._forceUpdateRenderData() + } + this.markForValidate() + } + }, + animatable: !1, + tooltip: !1 + }, + _bmFontOriginalSize: { + displayName: "BMFont Original Size", + get: function() { + return this._N$file instanceof cc.BitmapFont ? this._N$file.fontSize : -1 + }, + visible: !0, + animatable: !1 + }, + _spacingX: 0, + spacingX: { + get: function() { + return this._spacingX + }, + set: function(t) { + this._spacingX = t, + this.setVertsDirty() + }, + tooltip: !1 + }, + _batchAsBitmap: !1, + cacheMode: { + default: c.NONE, + type: c, + tooltip: !1, + notify: function(t) { + this.cacheMode !== t && (t !== c.BITMAP || this.font instanceof cc.BitmapFont || this._frame && this._frame._resetDynamicAtlasFrame(), + t === c.CHAR && (this._ttfTexture = null), + this.enabledInHierarchy && this._forceUpdateRenderData()) + }, + animatable: !1 + }, + _styleFlags: 0, + enableBold: { + get: function() { + return !!(1 & this._styleFlags) + }, + set: function(t) { + t ? this._styleFlags |= 1 : this._styleFlags &= -2, + this.setVertsDirty() + }, + animatable: !1, + tooltip: !1 + }, + enableItalic: { + get: function() { + return !!(2 & this._styleFlags) + }, + set: function(t) { + t ? this._styleFlags |= 2 : this._styleFlags &= -3, + this.setVertsDirty() + }, + animatable: !1, + tooltip: !1 + }, + enableUnderline: { + get: function() { + return !!(4 & this._styleFlags) + }, + set: function(t) { + t ? this._styleFlags |= 4 : this._styleFlags &= -5, + this.setVertsDirty() + }, + animatable: !1, + tooltip: !1 + }, + _underlineHeight: 0, + underlineHeight: { + get: function() { + return this._underlineHeight + }, + set: function(t) { + this._underlineHeight !== t && (this._underlineHeight = t, + this.setVertsDirty()) + }, + tooltip: !1 + } + }, + statics: { + HorizontalAlign: o, + VerticalAlign: l, + Overflow: h, + CacheMode: c, + _shareAtlas: null, + clearCharCache: function() { + u._shareAtlas && u._shareAtlas.clearAllCache() + } + }, + onLoad: function() { + this._batchAsBitmap && this.cacheMode === c.NONE && (this.cacheMode = c.BITMAP, + this._batchAsBitmap = !1), + cc.game.renderType === cc.game.RENDER_TYPE_CANVAS && (this.cacheMode = c.NONE) + }, + onEnable: function() { + this._super(), + this.node.on(cc.Node.EventType.SIZE_CHANGED, this._nodeSizeChanged, this), + this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this), + this.node.on(cc.Node.EventType.COLOR_CHANGED, this._nodeColorChanged, this), + this._forceUpdateRenderData() + }, + onDisable: function() { + this._super(), + this.node.off(cc.Node.EventType.SIZE_CHANGED, this._nodeSizeChanged, this), + this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this), + this.node.off(cc.Node.EventType.COLOR_CHANGED, this._nodeColorChanged, this) + }, + onDestroy: function() { + this._assembler && this._assembler._resetAssemblerData && this._assembler._resetAssemblerData(this._assemblerData), + this._assemblerData = null, + this._letterTexture = null, + this._ttfTexture && (this._ttfTexture.destroy(), + this._ttfTexture = null), + this._super() + }, + _nodeSizeChanged: function() { + this.overflow !== h.NONE && this.setVertsDirty() + }, + _nodeColorChanged: function() { + this.font instanceof cc.BitmapFont || this.setVertsDirty() + }, + setVertsDirty: function() { + this._super() + }, + _updateColor: function() { + this.font instanceof cc.BitmapFont || this._srcBlendFactor === cc.macro.BlendFactor.SRC_ALPHA && this.node._renderFlag & cc.RenderFlow.FLAG_OPACITY || this.setVertsDirty(), + n.prototype._updateColor.call(this) + }, + _validateRender: function() { + if (this.string) { + if (this._materials[0]) { + var t = this.font; + if (!(t instanceof cc.BitmapFont)) + return; + var e = t.spriteFrame; + if (e && e.textureLoaded() && t._fntConfig) + return + } + this.disableRender() + } else + this.disableRender() + }, + _resetAssembler: function() { + this._resetFrame(), + n.prototype._resetAssembler.call(this) + }, + _resetFrame: function() { + !this._frame || this.font instanceof cc.BitmapFont || (a(this, this._frame), + this._frame = null) + }, + _checkStringEmpty: function() { + this.markForRender(!!this.string) + }, + _on3DNodeChanged: function() { + this._resetAssembler(), + this._applyFontTexture() + }, + _onBMFontTextureLoaded: function() { + this._frame._texture = this.font.spriteFrame._texture, + this.markForRender(!0), + this._updateMaterial(), + this._assembler && this._assembler.updateRenderData(this) + }, + _onBlendChanged: function() { + this.useSystemFont && this.enabledInHierarchy && this._forceUpdateRenderData() + }, + _applyFontTexture: function() { + var t = this.font; + if (t instanceof cc.BitmapFont) { + var e = t.spriteFrame; + this._frame = e, + e && e.onTextureLoaded(this._onBMFontTextureLoaded, this) + } else + this._nativeTTF() || (this._frame || (this._frame = new r), + this.cacheMode === c.CHAR ? (this._letterTexture = this._assembler._getAssemblerData(), + this._frame._refreshTexture(this._letterTexture)) : this._ttfTexture || (this._ttfTexture = new cc.Texture2D, + this._assemblerData = this._assembler._getAssemblerData(), + this._ttfTexture.initWithElement(this._assemblerData.canvas)), + this.cacheMode !== c.CHAR && (this._frame._resetDynamicAtlasFrame(), + this._frame._refreshTexture(this._ttfTexture), + this._srcBlendFactor === cc.macro.BlendFactor.ONE && this._ttfTexture.setPremultiplyAlpha(!0)), + this._updateMaterial()), + this._assembler && this._assembler.updateRenderData(this); + this.markForValidate() + }, + _updateMaterialCanvas: function() { + this._frame && (this._frame._texture._nativeUrl = this.uuid + "_texture") + }, + _updateMaterialWebgl: function() { + var t = this.getMaterial(0); + this._nativeTTF() ? t && this._assembler._updateTTFMaterial(this) : this._frame && (t && t.setProperty("texture", this._frame._texture), + s.prototype._updateMaterial.call(this)) + }, + _forceUseCanvas: !1, + _useNativeTTF: function() { + return cc.macro.ENABLE_NATIVE_TTF_RENDERER && !this._forceUseCanvas + }, + _nativeTTF: function() { + return this._useNativeTTF() && !!this._assembler && !!this._assembler._updateTTFMaterial + }, + _forceUpdateRenderData: function() { + this.setVertsDirty(), + this._resetAssembler(), + this._applyFontTexture() + }, + _enableBold: function(t) { + this.enableBold = !!t + }, + _enableItalics: function(t) { + this.enableItalic = !!t + }, + _enableUnderline: function(t) { + this.enableUnderline = !!t + } + }); + cc.Label = e.exports = u + } + ), { + "../assets/material/CCMaterial": 80, + "../platform/CCMacro": 198, + "../renderer/utils/label/label-frame": 229, + "../renderer/utils/utils": 232, + "../utils/blend-func": 261, + "./CCRenderComponent": 115 + }], + 108: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.LabelOutline", + extends: t("./CCComponent"), + editor: !1, + properties: { + _color: cc.Color.WHITE, + _width: 1, + color: { + tooltip: !1, + get: function() { + return this._color.clone() + }, + set: function(t) { + this._color.equals(t) || this._color.set(t), + this._updateRenderData() + } + }, + width: { + tooltip: !1, + get: function() { + return this._width + }, + set: function(t) { + this._width !== t && (this._width = t, + this._updateRenderData()) + }, + range: [0, 512] + } + }, + onEnable: function() { + this._updateRenderData() + }, + onDisable: function() { + this._updateRenderData() + }, + _updateRenderData: function() { + var t = this.node.getComponent(cc.Label); + t && t.setVertsDirty() + } + }); + cc.LabelOutline = e.exports = i + } + ), { + "./CCComponent": 105 + }], + 109: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.LabelShadow", + extends: t("./CCComponent"), + editor: !1, + properties: { + _color: cc.Color.WHITE, + _offset: cc.v2(2, 2), + _blur: 2, + color: { + tooltip: !1, + get: function() { + return this._color.clone() + }, + set: function(t) { + this._color.equals(t) || this._color.set(t), + this._updateRenderData() + } + }, + offset: { + tooltip: !1, + get: function() { + return this._offset + }, + set: function(t) { + this._offset = t, + this._updateRenderData() + } + }, + blur: { + tooltip: !1, + get: function() { + return this._blur + }, + set: function(t) { + this._blur = t, + this._updateRenderData() + }, + range: [0, 1024] + } + }, + onEnable: function() { + this._updateRenderData() + }, + onDisable: function() { + this._updateRenderData() + }, + _updateRenderData: function() { + var t = this.node.getComponent(cc.Label); + t && t.markForRender(!0) + } + }); + cc.LabelShadow = e.exports = i + } + ), { + "./CCComponent": 105 + }], + 110: [(function(t, e) { + "use strict"; + var i = t("../CCNode").EventType + , n = cc.Enum({ + NONE: 0, + HORIZONTAL: 1, + VERTICAL: 2, + GRID: 3 + }) + , r = cc.Enum({ + NONE: 0, + CONTAINER: 1, + CHILDREN: 2 + }) + , s = cc.Enum({ + HORIZONTAL: 0, + VERTICAL: 1 + }) + , a = cc.Enum({ + BOTTOM_TO_TOP: 0, + TOP_TO_BOTTOM: 1 + }) + , o = cc.Enum({ + LEFT_TO_RIGHT: 0, + RIGHT_TO_LEFT: 1 + }) + , l = cc.Class({ + name: "cc.Layout", + extends: t("./CCComponent"), + editor: !1, + properties: { + _layoutSize: cc.size(300, 200), + _layoutDirty: { + default: !0, + serializable: !1 + }, + _resize: r.NONE, + _N$layoutType: n.NONE, + type: { + type: n, + get: function() { + return this._N$layoutType + }, + set: function(t) { + this._N$layoutType = t, + this._doLayoutDirty() + }, + tooltip: !1, + animatable: !1 + }, + resizeMode: { + type: r, + tooltip: !1, + animatable: !1, + get: function() { + return this._resize + }, + set: function(t) { + this.type === n.NONE && t === r.CHILDREN || (this._resize = t, + this._doLayoutDirty()) + } + }, + cellSize: { + default: cc.size(40, 40), + tooltip: !1, + type: cc.Size, + notify: function() { + this._doLayoutDirty() + } + }, + startAxis: { + default: s.HORIZONTAL, + tooltip: !1, + type: s, + notify: function() { + this._doLayoutDirty() + }, + animatable: !1 + }, + paddingLeft: { + default: 0, + tooltip: !1, + notify: function() { + this._doLayoutDirty() + } + }, + paddingRight: { + default: 0, + tooltip: !1, + notify: function() { + this._doLayoutDirty() + } + }, + paddingTop: { + default: 0, + tooltip: !1, + notify: function() { + this._doLayoutDirty() + } + }, + paddingBottom: { + default: 0, + tooltip: !1, + notify: function() { + this._doLayoutDirty() + } + }, + spacingX: { + default: 0, + notify: function() { + this._doLayoutDirty() + }, + tooltip: !1 + }, + spacingY: { + default: 0, + notify: function() { + this._doLayoutDirty() + }, + tooltip: !1 + }, + verticalDirection: { + default: a.TOP_TO_BOTTOM, + type: a, + notify: function() { + this._doLayoutDirty() + }, + tooltip: !1, + animatable: !1 + }, + horizontalDirection: { + default: o.LEFT_TO_RIGHT, + type: o, + notify: function() { + this._doLayoutDirty() + }, + tooltip: !1, + animatable: !1 + }, + affectedByScale: { + default: !1, + notify: function() { + this._doLayoutDirty() + }, + animatable: !1, + tooltip: !1 + } + }, + statics: { + Type: n, + VerticalDirection: a, + HorizontalDirection: o, + ResizeMode: r, + AxisDirection: s + }, + onEnable: function() { + this._addEventListeners(), + this.node.getContentSize().equals(cc.size(0, 0)) && this.node.setContentSize(this._layoutSize), + this._doLayoutDirty() + }, + onDisable: function() { + this._removeEventListeners() + }, + _doLayoutDirty: function() { + this._layoutDirty = !0 + }, + _doScaleDirty: function() { + this._layoutDirty = this._layoutDirty || this.affectedByScale + }, + _addEventListeners: function() { + cc.director.on(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this), + this.node.on(i.SIZE_CHANGED, this._resized, this), + this.node.on(i.ANCHOR_CHANGED, this._doLayoutDirty, this), + this.node.on(i.CHILD_ADDED, this._childAdded, this), + this.node.on(i.CHILD_REMOVED, this._childRemoved, this), + this.node.on(i.CHILD_REORDER, this._doLayoutDirty, this), + this._addChildrenEventListeners() + }, + _removeEventListeners: function() { + cc.director.off(cc.Director.EVENT_AFTER_UPDATE, this.updateLayout, this), + this.node.off(i.SIZE_CHANGED, this._resized, this), + this.node.off(i.ANCHOR_CHANGED, this._doLayoutDirty, this), + this.node.off(i.CHILD_ADDED, this._childAdded, this), + this.node.off(i.CHILD_REMOVED, this._childRemoved, this), + this.node.off(i.CHILD_REORDER, this._doLayoutDirty, this), + this._removeChildrenEventListeners() + }, + _addChildrenEventListeners: function() { + for (var t = this.node.children, e = 0; e < t.length; ++e) { + var n = t[e]; + n.on(i.SCALE_CHANGED, this._doScaleDirty, this), + n.on(i.SIZE_CHANGED, this._doLayoutDirty, this), + n.on(i.POSITION_CHANGED, this._doLayoutDirty, this), + n.on(i.ANCHOR_CHANGED, this._doLayoutDirty, this), + n.on("active-in-hierarchy-changed", this._doLayoutDirty, this) + } + }, + _removeChildrenEventListeners: function() { + for (var t = this.node.children, e = 0; e < t.length; ++e) { + var n = t[e]; + n.off(i.SCALE_CHANGED, this._doScaleDirty, this), + n.off(i.SIZE_CHANGED, this._doLayoutDirty, this), + n.off(i.POSITION_CHANGED, this._doLayoutDirty, this), + n.off(i.ANCHOR_CHANGED, this._doLayoutDirty, this), + n.off("active-in-hierarchy-changed", this._doLayoutDirty, this) + } + }, + _childAdded: function(t) { + t.on(i.SCALE_CHANGED, this._doScaleDirty, this), + t.on(i.SIZE_CHANGED, this._doLayoutDirty, this), + t.on(i.POSITION_CHANGED, this._doLayoutDirty, this), + t.on(i.ANCHOR_CHANGED, this._doLayoutDirty, this), + t.on("active-in-hierarchy-changed", this._doLayoutDirty, this), + this._doLayoutDirty() + }, + _childRemoved: function(t) { + t.off(i.SCALE_CHANGED, this._doScaleDirty, this), + t.off(i.SIZE_CHANGED, this._doLayoutDirty, this), + t.off(i.POSITION_CHANGED, this._doLayoutDirty, this), + t.off(i.ANCHOR_CHANGED, this._doLayoutDirty, this), + t.off("active-in-hierarchy-changed", this._doLayoutDirty, this), + this._doLayoutDirty() + }, + _resized: function() { + this._layoutSize = this.node.getContentSize(), + this._doLayoutDirty() + }, + _doLayoutHorizontally: function(t, e, i, s) { + var l = this.node.getAnchorPoint() + , h = this.node.children + , c = 1 + , u = this.paddingLeft + , _ = -l.x * t; + this.horizontalDirection === o.RIGHT_TO_LEFT && (c = -1, + _ = (1 - l.x) * t, + u = this.paddingRight); + for (var f = _ + c * u - c * this.spacingX, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, A = 0, x = 0; x < h.length; ++x) + (C = h[x]).activeInHierarchy && A++; + var b = this.cellSize.width; + for (this.type !== n.GRID && this.resizeMode === r.CHILDREN && (b = (t - (this.paddingLeft + this.paddingRight) - (A - 1) * this.spacingX) / A), + x = 0; x < h.length; ++x) { + var C = h[x] + , T = this._getUsedScaleValue(C.scaleX) + , S = this._getUsedScaleValue(C.scaleY); + if (C.activeInHierarchy) { + this._resize === r.CHILDREN && (C.width = b / T, + this.type === n.GRID && (C.height = this.cellSize.height / S)); + var w = C.anchorX + , E = C.width * T + , M = C.height * S; + m > p && (p = m), + M >= p && (m = p, + p = M, + g = C.getAnchorPoint().y), + this.horizontalDirection === o.RIGHT_TO_LEFT && (w = 1 - C.anchorX), + f = f + c * w * E + c * this.spacingX; + var D = c * (1 - w) * E; + if (e) { + var B = f + D + c * (c > 0 ? this.paddingRight : this.paddingLeft) + , I = this.horizontalDirection === o.LEFT_TO_RIGHT && B > (1 - l.x) * t + , P = this.horizontalDirection === o.RIGHT_TO_LEFT && B < -l.x * t; + (I || P) && (M >= p ? (0 === m && (m = p), + d += m, + m = p) : (d += p, + m = M, + p = 0), + f = _ + c * (u + w * E), + y++) + } + var R = i(C, d, y); + t >= E + this.paddingLeft + this.paddingRight && s && C.setPosition(cc.v2(f, R)); + var O, L = 1, F = 0 === p ? M : p; + this.verticalDirection === a.TOP_TO_BOTTOM ? (v = v || this.node._contentSize.height, + (O = R + (L = -1) * (F * g + this.paddingBottom)) < v && (v = O)) : (v = v || -this.node._contentSize.height, + (O = R + L * (F * g + this.paddingTop)) > v && (v = O)), + f += D + } + } + return v + }, + _getVerticalBaseHeight: function(t) { + var e = 0 + , i = 0; + if (this.resizeMode === r.CONTAINER) { + for (var n = 0; n < t.length; ++n) { + var s = t[n]; + s.activeInHierarchy && (i++, + e += s.height * this._getUsedScaleValue(s.scaleY)) + } + e += (i - 1) * this.spacingY + this.paddingBottom + this.paddingTop + } else + e = this.node.getContentSize().height; + return e + }, + _doLayoutVertically: function(t, e, i, s) { + var l = this.node.getAnchorPoint() + , h = this.node.children + , c = 1 + , u = this.paddingBottom + , _ = -l.y * t; + this.verticalDirection === a.TOP_TO_BOTTOM && (c = -1, + _ = (1 - l.y) * t, + u = this.paddingTop); + for (var f = _ + c * u - c * this.spacingY, d = 0, p = 0, m = 0, y = 0, v = 0, g = 0, A = 0, x = 0; x < h.length; ++x) + (C = h[x]).activeInHierarchy && A++; + var b = this.cellSize.height; + for (this.type !== n.GRID && this.resizeMode === r.CHILDREN && (b = (t - (this.paddingTop + this.paddingBottom) - (A - 1) * this.spacingY) / A), + x = 0; x < h.length; ++x) { + var C = h[x] + , T = this._getUsedScaleValue(C.scaleX) + , S = this._getUsedScaleValue(C.scaleY); + if (C.activeInHierarchy) { + this.resizeMode === r.CHILDREN && (C.height = b / S, + this.type === n.GRID && (C.width = this.cellSize.width / T)); + var w = C.anchorY + , E = C.width * T + , M = C.height * S; + m > p && (p = m), + E >= p && (m = p, + p = E, + g = C.getAnchorPoint().x), + this.verticalDirection === a.TOP_TO_BOTTOM && (w = 1 - C.anchorY), + f = f + c * w * M + c * this.spacingY; + var D = c * (1 - w) * M; + if (e) { + var B = f + D + c * (c > 0 ? this.paddingTop : this.paddingBottom) + , I = this.verticalDirection === a.BOTTOM_TO_TOP && B > (1 - l.y) * t + , P = this.verticalDirection === a.TOP_TO_BOTTOM && B < -l.y * t; + (I || P) && (E >= p ? (0 === m && (m = p), + d += m, + m = p) : (d += p, + m = E, + p = 0), + f = _ + c * (u + w * M), + y++) + } + var R = i(C, d, y); + t >= M + (this.paddingTop + this.paddingBottom) && s && C.setPosition(cc.v2(R, f)); + var O, L = 1, F = 0 === p ? E : p; + this.horizontalDirection === o.RIGHT_TO_LEFT ? (L = -1, + v = v || this.node._contentSize.width, + (O = R + L * (F * g + this.paddingLeft)) < v && (v = O)) : (v = v || -this.node._contentSize.width, + (O = R + L * (F * g + this.paddingRight)) > v && (v = O)), + f += D + } + } + return v + }, + _doLayoutBasic: function() { + for (var t = this.node.children, e = null, i = 0; i < t.length; ++i) { + var n = t[i]; + n.activeInHierarchy && (e ? e.union(e, n.getBoundingBoxToWorld()) : e = n.getBoundingBoxToWorld()) + } + if (e) { + var r = this.node.convertToNodeSpaceAR(cc.v2(e.x, e.y)); + r = cc.v2(r.x - this.paddingLeft, r.y - this.paddingBottom); + var s = this.node.convertToNodeSpaceAR(cc.v2(e.xMax, e.yMax)) + , a = (s = cc.v2(s.x + this.paddingRight, s.y + this.paddingTop)).sub(r); + if (0 !== (a = cc.size(parseFloat(a.x.toFixed(2)), parseFloat(a.y.toFixed(2)))).width) { + var o = -r.x / a.width; + this.node.anchorX = parseFloat(o.toFixed(2)) + } + if (0 !== a.height) { + var l = -r.y / a.height; + this.node.anchorY = parseFloat(l.toFixed(2)) + } + this.node.setContentSize(a) + } + }, + _doLayoutGridAxisHorizontal: function(t, e) { + var i = e.width + , n = 1 + , s = -t.y * e.height + , o = this.paddingBottom; + this.verticalDirection === a.TOP_TO_BOTTOM && (n = -1, + s = (1 - t.y) * e.height, + o = this.paddingTop); + var l = function(t, e, i) { + return s + n * (e + t.anchorY * t.height * this._getUsedScaleValue(t.scaleY) + o + i * this.spacingY) + } + .bind(this) + , h = 0; + if (this.resizeMode === r.CONTAINER) { + var c = this._doLayoutHorizontally(i, !0, l, !1); + (h = s - c) < 0 && (h *= -1), + s = -t.y * h, + this.verticalDirection === a.TOP_TO_BOTTOM && (n = -1, + s = (1 - t.y) * h) + } + this._doLayoutHorizontally(i, !0, l, !0), + this.resizeMode === r.CONTAINER && this.node.setContentSize(i, h) + }, + _doLayoutGridAxisVertical: function(t, e) { + var i = e.height + , n = 1 + , s = -t.x * e.width + , a = this.paddingLeft; + this.horizontalDirection === o.RIGHT_TO_LEFT && (n = -1, + s = (1 - t.x) * e.width, + a = this.paddingRight); + var l = function(t, e, i) { + return s + n * (e + t.anchorX * t.width * this._getUsedScaleValue(t.scaleX) + a + i * this.spacingX) + } + .bind(this) + , h = 0; + if (this.resizeMode === r.CONTAINER) { + var c = this._doLayoutVertically(i, !0, l, !1); + (h = s - c) < 0 && (h *= -1), + s = -t.x * h, + this.horizontalDirection === o.RIGHT_TO_LEFT && (n = -1, + s = (1 - t.x) * h) + } + this._doLayoutVertically(i, !0, l, !0), + this.resizeMode === r.CONTAINER && this.node.setContentSize(h, i) + }, + _doLayoutGrid: function() { + var t = this.node.getAnchorPoint() + , e = this.node.getContentSize(); + this.startAxis === s.HORIZONTAL ? this._doLayoutGridAxisHorizontal(t, e) : this.startAxis === s.VERTICAL && this._doLayoutGridAxisVertical(t, e) + }, + _getHorizontalBaseWidth: function(t) { + var e = 0 + , i = 0; + if (this.resizeMode === r.CONTAINER) { + for (var n = 0; n < t.length; ++n) { + var s = t[n]; + s.activeInHierarchy && (i++, + e += s.width * this._getUsedScaleValue(s.scaleX)) + } + e += (i - 1) * this.spacingX + this.paddingLeft + this.paddingRight + } else + e = this.node.getContentSize().width; + return e + }, + _doLayout: function() { + if (this.type === n.HORIZONTAL) { + var t = this._getHorizontalBaseWidth(this.node.children); + this._doLayoutHorizontally(t, !1, (function(t) { + return t.y + } + ), !0), + this.node.width = t + } else if (this.type === n.VERTICAL) { + var e = this._getVerticalBaseHeight(this.node.children); + this._doLayoutVertically(e, !1, (function(t) { + return t.x + } + ), !0), + this.node.height = e + } else + this.type === n.NONE ? this.resizeMode === r.CONTAINER && this._doLayoutBasic() : this.type === n.GRID && this._doLayoutGrid() + }, + _getUsedScaleValue: function(t) { + return this.affectedByScale ? Math.abs(t) : 1 + }, + updateLayout: function() { + this._layoutDirty && this.node.children.length > 0 && (this._doLayout(), + this._layoutDirty = !1) + } + }); + cc.Layout = e.exports = l + } + ), { + "../CCNode": 29, + "./CCComponent": 105 + }], + 111: [(function(t, e) { + "use strict"; + var i = a(t("../../renderer/gfx")) + , n = a(t("../value-types/mat4")) + , r = a(t("../value-types/vec2")) + , s = a(t("../assets/material/material-variant")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + var o = t("../utils/misc") + , l = t("./CCRenderComponent") + , h = t("../renderer/render-flow") + , c = t("../graphics/graphics") + , u = new r.default + , _ = new n.default + , f = []; + function d(t, e, i) { + f.length = 0; + for (var n = 2 * Math.PI / i, r = 0; r < i; ++r) + f.push(cc.v2(e.x * Math.cos(n * r) + t.x, e.y * Math.sin(n * r) + t.y)); + return f + } + var p = cc.Enum({ + RECT: 0, + ELLIPSE: 1, + IMAGE_STENCIL: 2 + }) + , m = cc.Class({ + name: "cc.Mask", + extends: l, + editor: !1, + ctor: function() { + this._graphics = null, + this._enableMaterial = null, + this._exitMaterial = null, + this._clearMaterial = null + }, + properties: { + _spriteFrame: { + default: null, + type: cc.SpriteFrame + }, + _type: p.RECT, + type: { + get: function() { + return this._type + }, + set: function(t) { + this._type !== t && this._resetAssembler(), + this._type = t, + this._type !== p.IMAGE_STENCIL && (this.spriteFrame = null, + this.alphaThreshold = 0, + this._updateGraphics()), + this._activateMaterial() + }, + type: p, + tooltip: !1 + }, + spriteFrame: { + type: cc.SpriteFrame, + tooltip: !1, + get: function() { + return this._spriteFrame + }, + set: function(t) { + this._spriteFrame !== t && (this._spriteFrame = t, + this.setVertsDirty(), + this._updateMaterial()) + } + }, + alphaThreshold: { + default: .1, + type: cc.Float, + range: [0, 1, .1], + slide: !0, + tooltip: !1, + notify: function() { + cc.game.renderType !== cc.game.RENDER_TYPE_CANVAS ? this._updateMaterial() : cc.warnID(4201) + } + }, + inverted: { + default: !1, + type: cc.Boolean, + tooltip: !1, + notify: function() { + cc.game.renderType === cc.game.RENDER_TYPE_CANVAS && cc.warnID(4202) + } + }, + _segments: 64, + segements: { + get: function() { + return this._segments + }, + set: function(t) { + this._segments = o.clampf(t, 3, 1e4), + this._updateGraphics() + }, + type: cc.Integer, + tooltip: !1 + }, + _resizeToTarget: { + animatable: !1, + set: function(t) { + t && this._resizeNodeToTargetNode() + } + } + }, + statics: { + Type: p + }, + onRestore: function() { + this._activateMaterial() + }, + onEnable: function() { + this._super(), + this._type !== p.IMAGE_STENCIL && this._updateGraphics(), + this.node.on(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this), + this.node.on(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this), + this.node.on(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this), + this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this), + this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this) + }, + onDisable: function() { + this._super(), + this.node.off(cc.Node.EventType.POSITION_CHANGED, this._updateGraphics, this), + this.node.off(cc.Node.EventType.ROTATION_CHANGED, this._updateGraphics, this), + this.node.off(cc.Node.EventType.SCALE_CHANGED, this._updateGraphics, this), + this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateGraphics, this), + this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._updateGraphics, this), + this.node._renderFlag &= ~h.FLAG_POST_RENDER + }, + onDestroy: function() { + this._super(), + this._removeGraphics() + }, + _resizeNodeToTargetNode: !1, + _validateRender: function() { + if (this._type === p.IMAGE_STENCIL) { + var t = this._spriteFrame; + t && t.textureLoaded() || this.disableRender() + } + }, + _activateMaterial: function() { + this._createGraphics(); + var t = this._materials[0]; + (t = t ? s.default.create(t, this) : s.default.createWithBuiltin("2d-sprite", this)).define("USE_ALPHA_TEST", !0), + this._type === p.IMAGE_STENCIL ? (t.define("CC_USE_MODEL", !1), + t.define("USE_TEXTURE", !0)) : (t.define("CC_USE_MODEL", !0), + t.define("USE_TEXTURE", !1)), + this._enableMaterial || (this._enableMaterial = s.default.createWithBuiltin("2d-sprite", this)), + this._exitMaterial || (this._exitMaterial = s.default.createWithBuiltin("2d-sprite", this), + this._exitMaterial.setStencilEnabled(i.default.STENCIL_DISABLE)), + this._clearMaterial || (this._clearMaterial = s.default.createWithBuiltin("clear-stencil", this)), + this.setMaterial(0, t), + this._graphics._materials[0] = t, + this._updateMaterial() + }, + _updateMaterial: function() { + var t = this._materials[0]; + if (t) { + if (this._type === p.IMAGE_STENCIL && this.spriteFrame) { + var e = this.spriteFrame.getTexture(); + t.setProperty("texture", e) + } + t.setProperty("alphaThreshold", this.alphaThreshold) + } + }, + _createGraphics: function() { + this._graphics || (this._graphics = new c, + cc.Assembler.init(this._graphics), + this._graphics.node = this.node, + this._graphics.lineWidth = 0, + this._graphics.strokeColor = cc.color(0, 0, 0, 0)) + }, + _updateGraphics: function() { + if (this.enabledInHierarchy) { + var t = this.node + , e = this._graphics; + e.clear(!1); + var i = t._contentSize.width + , n = t._contentSize.height + , r = -i * t._anchorPoint.x + , s = -n * t._anchorPoint.y; + if (this._type === p.RECT) + e.rect(r, s, i, n); + else if (this._type === p.ELLIPSE) { + for (var a = d(cc.v2(r + i / 2, s + n / 2), { + x: i / 2, + y: n / 2 + }, this._segments), o = 0; o < a.length; ++o) { + var l = a[o]; + 0 === o ? e.moveTo(l.x, l.y) : e.lineTo(l.x, l.y) + } + e.close() + } + cc.game.renderType === cc.game.RENDER_TYPE_CANVAS ? e.stroke() : e.fill() + } + }, + _removeGraphics: function() { + this._graphics && (this._graphics.destroy(), + this._graphics._destroyImmediate(), + this._graphics = null) + }, + _hitTest: function(t) { + var e = this.node + , i = e.getContentSize() + , s = i.width + , a = i.height + , o = u; + if (e._updateWorldMatrix(), + !n.default.invert(_, e._worldMatrix)) + return !1; + r.default.transformMat4(o, t, _), + o.x += e._anchorPoint.x * s, + o.y += e._anchorPoint.y * a; + var l = !1; + if (this.type === p.RECT || this.type === p.IMAGE_STENCIL) + l = o.x >= 0 && o.y >= 0 && o.x <= s && o.y <= a; + else if (this.type === p.ELLIPSE) { + var h = s / 2 + , c = a / 2 + , f = o.x - .5 * s + , d = o.y - .5 * a; + l = f * f / (h * h) + d * d / (c * c) < 1 + } + return this.inverted && (l = !l), + l + }, + markForRender: function(t) { + var e = h.FLAG_RENDER | h.FLAG_UPDATE_RENDER_DATA | h.FLAG_POST_RENDER; + t ? (this.node._renderFlag |= e, + this.markForValidate()) : t || (this.node._renderFlag &= ~e) + }, + disableRender: function() { + this.node._renderFlag &= ~(h.FLAG_RENDER | h.FLAG_UPDATE_RENDER_DATA | h.FLAG_POST_RENDER) + } + }); + cc.Mask = e.exports = m + } + ), { + "../../renderer/gfx": 315, + "../assets/material/material-variant": 87, + "../graphics/graphics": 156, + "../renderer/render-flow": 225, + "../utils/misc": 267, + "../value-types/mat4": 284, + "../value-types/vec2": 291, + "./CCRenderComponent": 115 + }], + 112: [(function(t, e) { + "use strict"; + var i = cc.Enum({ + Unified: 0, + Free: 1 + }) + , n = cc.Enum({ + Horizontal: 0, + Vertical: 1 + }) + , r = cc.Enum({ + PAGE_TURNING: 0 + }) + , s = cc.Class({ + name: "cc.PageView", + extends: cc.ScrollView, + editor: !1, + ctor: function() { + this._curPageIdx = 0, + this._lastPageIdx = 0, + this._pages = [], + this._initContentPos = cc.v2(), + this._scrollCenterOffsetX = [], + this._scrollCenterOffsetY = [] + }, + properties: { + sizeMode: { + default: i.Unified, + type: i, + tooltip: !1, + notify: function() { + this._syncSizeMode() + } + }, + direction: { + default: n.Horizontal, + type: n, + tooltip: !1, + notify: function() { + this._syncScrollDirection() + } + }, + scrollThreshold: { + default: .5, + type: cc.Float, + slide: !0, + range: [0, 1, .01], + tooltip: !1 + }, + autoPageTurningThreshold: { + default: 100, + type: cc.Float, + tooltip: !1 + }, + pageTurningEventTiming: { + default: .1, + type: cc.Float, + range: [0, 1, .01], + tooltip: !1 + }, + indicator: { + default: null, + type: cc.PageViewIndicator, + tooltip: !1, + notify: function() { + this.indicator && this.indicator.setPageView(this) + } + }, + pageTurningSpeed: { + default: .3, + type: cc.Float, + tooltip: !1 + }, + pageEvents: { + default: [], + type: cc.Component.EventHandler, + tooltip: !1 + } + }, + statics: { + SizeMode: i, + Direction: n, + EventType: r + }, + onEnable: function() { + this._super(), + this.node.on(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this), + this.node.on("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this) + }, + onDisable: function() { + this._super(), + this.node.off(cc.Node.EventType.SIZE_CHANGED, this._updateAllPagesSize, this), + this.node.off("scroll-ended-with-threshold", this._dispatchPageTurningEvent, this) + }, + onLoad: function() { + this._initPages(), + this.indicator && this.indicator.setPageView(this) + }, + getCurrentPageIndex: function() { + return this._curPageIdx + }, + setCurrentPageIndex: function(t) { + this.scrollToPage(t, !0) + }, + getPages: function() { + return this._pages + }, + addPage: function(t) { + t && -1 === this._pages.indexOf(t) && this.content && (this.content.addChild(t), + this._pages.push(t), + this._updatePageView()) + }, + insertPage: function(t, e) { + e < 0 || !t || -1 !== this._pages.indexOf(t) || !this.content || (e >= this._pages.length ? this.addPage(t) : (this._pages.splice(e, 0, t), + this.content.addChild(t), + this._updatePageView())) + }, + removePage: function(t) { + if (t && this.content) { + var e = this._pages.indexOf(t); + -1 !== e ? this.removePageAtIndex(e) : cc.warnID(4300, t.name) + } + }, + removePageAtIndex: function(t) { + var e = this._pages; + if (!(t < 0 || t >= e.length)) { + var i = e[t]; + i && (this.content.removeChild(i), + e.splice(t, 1), + this._updatePageView()) + } + }, + removeAllPages: function() { + if (this.content) { + for (var t = this._pages, e = 0, i = t.length; e < i; e++) + this.content.removeChild(t[e]); + this._pages.length = 0, + this._updatePageView() + } + }, + scrollToPage: function(t, e) { + t < 0 || t >= this._pages.length || (e = void 0 !== e ? e : .3, + this._curPageIdx = t, + this.scrollToOffset(this._moveOffsetValue(t), e, !0), + this.indicator && this.indicator._changedState()) + }, + getScrollEndedEventTiming: function() { + return this.pageTurningEventTiming + }, + _syncScrollDirection: function() { + this.horizontal = this.direction === n.Horizontal, + this.vertical = this.direction === n.Vertical + }, + _syncSizeMode: function() { + if (this.content) { + var t = this.content.getComponent(cc.Layout); + if (t) { + if (this.sizeMode === i.Free && this._pages.length > 0) { + var e = this._pages[this._pages.length - 1]; + this.direction === n.Horizontal ? (t.paddingLeft = (this._view.width - this._pages[0].width) / 2, + t.paddingRight = (this._view.width - e.width) / 2) : this.direction === n.Vertical && (t.paddingTop = (this._view.height - this._pages[0].height) / 2, + t.paddingBottom = (this._view.height - e.height) / 2) + } + t.updateLayout() + } + } + }, + _updatePageView: function() { + var t = this.content.getComponent(cc.Layout); + t && t.enabled && t.updateLayout(); + var e = this._pages.length; + this._curPageIdx >= e && (this._curPageIdx = 0 === e ? 0 : e - 1, + this._lastPageIdx = this._curPageIdx); + for (var i = this._initContentPos, r = 0; r < e; ++r) { + var s = this._pages[r]; + s.setSiblingIndex(r), + this.direction === n.Horizontal ? this._scrollCenterOffsetX[r] = Math.abs(i.x + s.x) : this._scrollCenterOffsetY[r] = Math.abs(i.y + s.y) + } + this.indicator && this.indicator._refresh() + }, + _updateAllPagesSize: function() { + if (this.sizeMode === i.Unified && this._view) + for (var t = this._pages, e = this._view.getContentSize(), n = 0, r = t.length; n < r; n++) + t[n].setContentSize(e) + }, + _initPages: function() { + if (this.content) { + this._initContentPos = this.content.position; + for (var t = this.content.children, e = 0; e < t.length; ++e) { + var i = t[e]; + this._pages.indexOf(i) >= 0 || this._pages.push(i) + } + this._syncScrollDirection(), + this._syncSizeMode(), + this._updatePageView() + } + }, + _dispatchPageTurningEvent: function() { + this._lastPageIdx !== this._curPageIdx && (this._lastPageIdx = this._curPageIdx, + cc.Component.EventHandler.emitEvents(this.pageEvents, this, r.PAGE_TURNING), + this.node.emit("page-turning", this)) + }, + _isScrollable: function(t, e, r) { + if (this.sizeMode === i.Free) { + var s, a; + if (this.direction === n.Horizontal) + return s = this._scrollCenterOffsetX[e], + a = this._scrollCenterOffsetX[r], + Math.abs(t.x) >= Math.abs(s - a) * this.scrollThreshold; + if (this.direction === n.Vertical) + return s = this._scrollCenterOffsetY[e], + a = this._scrollCenterOffsetY[r], + Math.abs(t.y) >= Math.abs(s - a) * this.scrollThreshold + } else { + if (this.direction === n.Horizontal) + return Math.abs(t.x) >= this._view.width * this.scrollThreshold; + if (this.direction === n.Vertical) + return Math.abs(t.y) >= this._view.height * this.scrollThreshold + } + }, + _isQuicklyScrollable: function(t) { + if (this.direction === n.Horizontal) { + if (Math.abs(t.x) > this.autoPageTurningThreshold) + return !0 + } else if (this.direction === n.Vertical && Math.abs(t.y) > this.autoPageTurningThreshold) + return !0; + return !1 + }, + _moveOffsetValue: function(t) { + var e = cc.v2(0, 0); + return this.sizeMode === i.Free ? this.direction === n.Horizontal ? e.x = this._scrollCenterOffsetX[t] : this.direction === n.Vertical && (e.y = this._scrollCenterOffsetY[t]) : this.direction === n.Horizontal ? e.x = t * this._view.width : this.direction === n.Vertical && (e.y = t * this._view.height), + e + }, + _getDragDirection: function(t) { + return this.direction === n.Horizontal ? 0 === t.x ? 0 : t.x > 0 ? 1 : -1 : this.direction === n.Vertical ? 0 === t.y ? 0 : t.y < 0 ? 1 : -1 : void 0 + }, + _handleReleaseLogic: function() { + this._autoScrollToPage(), + this._scrolling && (this._scrolling = !1, + this._autoScrolling || this._dispatchEvent("scroll-ended")) + }, + _autoScrollToPage: function() { + if (this._startBounceBackIfNeeded()) { + var t = this._getHowMuchOutOfBoundary(); + ((t = this._clampDelta(t)).x > 0 || t.y < 0) && (this._curPageIdx = 0 === this._pages.length ? 0 : this._pages.length - 1), + (t.x < 0 || t.y > 0) && (this._curPageIdx = 0), + this.indicator && this.indicator._changedState() + } else { + var e = this._touchBeganPosition.sub(this._touchEndPosition) + , i = this._curPageIdx + , n = i + this._getDragDirection(e) + , r = this.pageTurningSpeed * Math.abs(i - n); + if (n < this._pages.length) { + if (this._isScrollable(e, i, n)) + return void this.scrollToPage(n, r); + var s = this._calculateTouchMoveVelocity(); + if (this._isQuicklyScrollable(s)) + return void this.scrollToPage(n, r) + } + this.scrollToPage(i, r) + } + }, + _onTouchBegan: function(t, e) { + this._touchBeganPosition = t.touch.getLocation(), + this._super(t, e) + }, + _onTouchMoved: function(t, e) { + this._super(t, e) + }, + _onTouchEnded: function(t, e) { + this._touchEndPosition = t.touch.getLocation(), + this._super(t, e) + }, + _onTouchCancelled: function(t, e) { + this._touchEndPosition = t.touch.getLocation(), + this._super(t, e) + }, + _onMouseWheel: function() {} + }); + cc.PageView = e.exports = s + } + ), {}], + 113: [(function(t, e) { + "use strict"; + var i = cc.Enum({ + HORIZONTAL: 0, + VERTICAL: 1 + }) + , n = cc.Class({ + name: "cc.PageViewIndicator", + extends: t("./CCComponent"), + editor: !1, + properties: { + _layout: null, + _pageView: null, + _indicators: [], + spriteFrame: { + default: null, + type: cc.SpriteFrame, + tooltip: !1 + }, + direction: { + default: i.HORIZONTAL, + type: i, + tooltip: !1 + }, + cellSize: { + default: cc.size(20, 20), + tooltip: !1 + }, + spacing: { + default: 0, + tooltip: !1 + } + }, + statics: { + Direction: i + }, + onLoad: function() { + this._updateLayout() + }, + setPageView: function(t) { + this._pageView = t, + this._refresh() + }, + _updateLayout: function() { + this._layout = this.getComponent(cc.Layout), + this._layout || (this._layout = this.addComponent(cc.Layout)), + this.direction === i.HORIZONTAL ? (this._layout.type = cc.Layout.Type.HORIZONTAL, + this._layout.spacingX = this.spacing) : this.direction === i.VERTICAL && (this._layout.type = cc.Layout.Type.VERTICAL, + this._layout.spacingY = this.spacing), + this._layout.resizeMode = cc.Layout.ResizeMode.CONTAINER + }, + _createIndicator: function() { + var t = new cc.Node + , e = t.addComponent(cc.Sprite); + return e.spriteFrame = this.spriteFrame, + e.sizeMode = cc.Sprite.SizeMode.CUSTOM, + t.parent = this.node, + t.width = this.cellSize.width, + t.height = this.cellSize.height, + t + }, + _changedState: function() { + var t = this._indicators; + if (0 !== t.length) { + var e = this._pageView._curPageIdx; + if (!(e >= t.length)) { + for (var i = 0; i < t.length; ++i) + t[i].opacity = 127.5; + t[e].opacity = 255 + } + } + }, + _refresh: function() { + if (this._pageView) { + var t = this._indicators + , e = this._pageView.getPages(); + if (e.length !== t.length) { + var i = 0; + if (e.length > t.length) + for (i = 0; i < e.length; ++i) + t[i] || (t[i] = this._createIndicator()); + else + for (i = t.length - e.length; i > 0; --i) { + var n = t[i - 1]; + this.node.removeChild(n), + t.splice(i - 1, 1) + } + this._layout && this._layout.enabledInHierarchy && this._layout.updateLayout(), + this._changedState() + } + } + } + }); + cc.PageViewIndicator = e.exports = n + } + ), { + "./CCComponent": 105 + }], + 114: [(function(t, e) { + "use strict"; + var i = t("../utils/misc") + , n = t("./CCComponent") + , r = cc.Enum({ + HORIZONTAL: 0, + VERTICAL: 1, + FILLED: 2 + }) + , s = cc.Class({ + name: "cc.ProgressBar", + extends: n, + editor: !1, + _initBarSprite: function() { + if (this.barSprite) { + var t = this.barSprite.node; + if (!t) + return; + var e = this.node.getContentSize() + , i = this.node.getAnchorPoint() + , n = t.getContentSize(); + t.parent === this.node && this.node.setContentSize(n), + this.barSprite.fillType === cc.Sprite.FillType.RADIAL && (this.mode = r.FILLED); + var s = t.getContentSize(); + if (this.mode === r.HORIZONTAL ? this.totalLength = s.width : this.mode === r.VERTICAL ? this.totalLength = s.height : this.totalLength = this.barSprite.fillRange, + t.parent === this.node) { + var a = -e.width * i.x; + t.setPosition(cc.v2(a, 0)) + } + } + }, + _updateBarStatus: function() { + if (this.barSprite) { + var t = this.barSprite.node; + if (!t) + return; + var e, n, s, a = t.getAnchorPoint(), o = t.getContentSize(), l = t.getPosition(), h = cc.v2(0, .5), c = i.clamp01(this.progress), u = this.totalLength * c; + switch (this.mode) { + case r.HORIZONTAL: + this.reverse && (h = cc.v2(1, .5)), + e = cc.size(u, o.height), + n = this.totalLength, + s = o.height; + break; + case r.VERTICAL: + h = this.reverse ? cc.v2(.5, 1) : cc.v2(.5, 0), + e = cc.size(o.width, u), + n = o.width, + s = this.totalLength + } + if (this.mode === r.FILLED) + this.barSprite.type !== cc.Sprite.Type.FILLED ? cc.warn("ProgressBar FILLED mode only works when barSprite's Type is FILLED!") : (this.reverse && (u *= -1), + this.barSprite.fillRange = u); + else if (this.barSprite.type !== cc.Sprite.Type.FILLED) { + var _ = h.x - a.x + , f = h.y - a.y + , d = cc.v2(n * _, s * f); + t.setPosition(l.x + d.x, l.y + d.y), + t.setAnchorPoint(h), + t.setContentSize(e) + } else + cc.warn("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!") + } + }, + properties: { + barSprite: { + default: null, + type: cc.Sprite, + tooltip: !1, + notify: function() { + this._initBarSprite() + }, + animatable: !1 + }, + mode: { + default: r.HORIZONTAL, + type: r, + tooltip: !1, + notify: function() { + if (this.barSprite) { + var t = this.barSprite.node; + if (!t) + return; + var e = t.getContentSize(); + this.mode === r.HORIZONTAL ? this.totalLength = e.width : this.mode === r.VERTICAL ? this.totalLength = e.height : this.mode === r.FILLED && (this.totalLength = this.barSprite.fillRange) + } + }, + animatable: !1 + }, + _N$totalLength: 1, + totalLength: { + range: [0, Number.MAX_VALUE], + tooltip: !1, + get: function() { + return this._N$totalLength + }, + set: function(t) { + this.mode === r.FILLED && (t = i.clamp01(t)), + this._N$totalLength = t, + this._updateBarStatus() + } + }, + progress: { + default: 1, + type: cc.Float, + range: [0, 1, .1], + slide: !0, + tooltip: !1, + notify: function() { + this._updateBarStatus() + } + }, + reverse: { + default: !1, + tooltip: !1, + notify: function() { + this.barSprite && (this.barSprite.fillStart = 1 - this.barSprite.fillStart), + this._updateBarStatus() + }, + animatable: !1 + } + }, + statics: { + Mode: r + } + }); + cc.ProgressBar = e.exports = s + } + ), { + "../utils/misc": 267, + "./CCComponent": 105 + }], + 115: [(function(t, e) { + "use strict"; + var i = s(t("../renderer/assembler")) + , n = s(t("../assets/material/material-variant")) + , r = t("../value-types"); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + var a = t("./CCComponent") + , o = t("../renderer/render-flow") + , l = t("../assets/material/CCMaterial") + , h = new r.Color + , c = cc.Class({ + name: "RenderComponent", + extends: a, + editor: !1, + properties: { + _materials: { + default: [], + type: l + }, + materials: { + get: function() { + return this._materials + }, + set: function(t) { + this._materials = t, + this._activateMaterial() + }, + type: [l], + displayName: "Materials", + animatable: !1 + } + }, + ctor: function() { + this._vertsDirty = !0, + this._assembler = null + }, + _resetAssembler: function() { + i.default.init(this), + this._updateColor(), + this.setVertsDirty() + }, + __preload: function() { + this._resetAssembler(), + this._activateMaterial() + }, + onEnable: function() { + this.node._renderComponent && (this.node._renderComponent.enabled = !1), + this.node._renderComponent = this, + this.node._renderFlag |= o.FLAG_OPACITY_COLOR, + this.setVertsDirty() + }, + onDisable: function() { + this.node._renderComponent = null, + this.disableRender() + }, + onDestroy: function() { + for (var t = this._materials, e = 0; e < t.length; e++) + cc.pool.material.put(t[e]); + t.length = 0, + cc.pool.assembler.put(this._assembler) + }, + setVertsDirty: function() { + this._vertsDirty = !0, + this.markForRender(!0) + }, + _on3DNodeChanged: function() { + this._resetAssembler() + }, + _validateRender: function() {}, + markForValidate: function() { + cc.RenderFlow.registerValidate(this) + }, + markForRender: function(t) { + var e = o.FLAG_RENDER | o.FLAG_UPDATE_RENDER_DATA; + t ? (this.node._renderFlag |= e, + this.markForValidate()) : this.node._renderFlag &= ~e + }, + disableRender: function() { + this.node._renderFlag &= ~(o.FLAG_RENDER | o.FLAG_UPDATE_RENDER_DATA) + }, + getMaterial: function(t) { + if (t < 0 || t >= this._materials.length) + return null; + var e = this._materials[t]; + if (!e) + return null; + var i = n.default.create(e, this); + return i !== e && this.setMaterial(t, i), + i + }, + getMaterials: function() { + for (var t = this._materials, e = 0; e < t.length; e++) + t[e] = n.default.create(t[e], this); + return t + }, + setMaterial: function(t, e) { + return e !== this._materials[t] && (e = n.default.create(e, this), + this._materials[t] = e), + this._updateMaterial(), + this.markForRender(!0), + e + }, + _getDefaultMaterial: function() { + return l.getBuiltinMaterial("2d-sprite") + }, + _activateMaterial: function() { + var t = this._materials; + if (!t[0]) { + var e = this._getDefaultMaterial(); + t[0] = e + } + for (var i = 0; i < t.length; i++) + t[i] = n.default.create(t[i], this); + this._updateMaterial() + }, + _updateMaterial: function() {}, + _updateColor: function() { + if (this._assembler.updateColor) { + var t = this.srcBlendFactor === cc.macro.BlendFactor.ONE; + t && r.Color.premultiplyAlpha(h, this.node._color); + var e = t ? h._val : null; + this._assembler.updateColor(this, e) + } + }, + _checkBacth: function(t, e) { + var i = this._materials[0]; + (i && i.getHash() !== t.material.getHash() || t.cullingMask !== e) && (t._flush(), + t.node = i.getDefine("CC_USE_MODEL") ? this.node : t._dummyNode, + t.material = i, + t.cullingMask = e) + } + }); + cc.RenderComponent = e.exports = c + } + ), { + "../assets/material/CCMaterial": 80, + "../assets/material/material-variant": 87, + "../renderer/assembler": 221, + "../renderer/render-flow": 225, + "../value-types": 282, + "./CCComponent": 105 + }], + 116: [(function(t, e) { + "use strict"; + var i = t("../platform/js") + , n = t("../platform/CCMacro") + , r = t("../utils/text-utils") + , s = new (t("../utils/html-text-parser")) + , a = n.TextAlignment + , o = n.VerticalTextAlignment + , l = cc.Label.CacheMode + , h = new i.Pool(function(t) { + if (!cc.isValid(t)) + return !1; + var e = t.getComponent(cc.LabelOutline); + return e && (e.width = 0), + !0 + } + ,20); + h.get = function() { + var t = this._get(); + t || (t = new cc.PrivateNode("RICHTEXT_CHILD")), + t.setPosition(0, 0), + t.setAnchorPoint(.5, .5), + t.skewX = 0; + var e = t.getComponent(cc.Label); + return e || (e = t.addComponent(cc.Label)), + e.string = "", + e.horizontalAlign = a.LEFT, + e.verticalAlign = o.CENTER, + e._forceUseCanvas = !0, + t + } + ; + var c = cc.Class({ + name: "cc.RichText", + extends: cc.Component, + ctor: function() { + this._textArray = null, + this._labelSegments = [], + this._labelSegmentsCache = [], + this._linesWidth = [], + this._updateRichTextStatus = this._updateRichText + }, + editor: !1, + properties: { + string: { + default: "RichText", + multiline: !0, + tooltip: !1, + notify: function() { + this._updateRichTextStatus() + } + }, + horizontalAlign: { + default: a.LEFT, + type: a, + tooltip: !1, + animatable: !1, + notify: function(t) { + this.horizontalAlign !== t && (this._layoutDirty = !0, + this._updateRichTextStatus()) + } + }, + fontSize: { + default: 40, + tooltip: !1, + notify: function(t) { + this.fontSize !== t && (this._layoutDirty = !0, + this._updateRichTextStatus()) + } + }, + _fontFamily: "Arial", + fontFamily: { + tooltip: !1, + get: function() { + return this._fontFamily + }, + set: function(t) { + this._fontFamily !== t && (this._fontFamily = t, + this._layoutDirty = !0, + this._updateRichTextStatus()) + }, + animatable: !1 + }, + font: { + default: null, + type: cc.TTFFont, + tooltip: !1, + notify: function(t) { + this.font !== t && (this._layoutDirty = !0, + this.font ? (this.useSystemFont = !1, + this._onTTFLoaded()) : this.useSystemFont = !0, + this._updateRichTextStatus()) + } + }, + _isSystemFontUsed: !0, + useSystemFont: { + get: function() { + return this._isSystemFontUsed + }, + set: function(t) { + this._isSystemFontUsed !== t && (this._isSystemFontUsed = t, + this._layoutDirty = !0, + this._updateRichTextStatus()) + }, + animatable: !1, + tooltip: !1 + }, + cacheMode: { + default: l.NONE, + type: l, + tooltip: !1, + notify: function(t) { + this.cacheMode !== t && this._updateRichTextStatus() + }, + animatable: !1 + }, + maxWidth: { + default: 0, + tooltip: !1, + notify: function(t) { + this.maxWidth !== t && (this._layoutDirty = !0, + this._updateRichTextStatus()) + } + }, + lineHeight: { + default: 40, + tooltip: !1, + notify: function(t) { + this.lineHeight !== t && (this._layoutDirty = !0, + this._updateRichTextStatus()) + } + }, + imageAtlas: { + default: null, + type: cc.SpriteAtlas, + tooltip: !1, + notify: function(t) { + this.imageAtlas !== t && (this._layoutDirty = !0, + this._updateRichTextStatus()) + } + }, + handleTouchEvent: { + default: !0, + tooltip: !1, + notify: function(t) { + this.handleTouchEvent !== t && this.enabledInHierarchy && (this.handleTouchEvent ? this._addEventListeners() : this._removeEventListeners()) + } + } + }, + statics: { + HorizontalAlign: a, + VerticalAlign: o + }, + onEnable: function() { + this.handleTouchEvent && this._addEventListeners(), + this._updateRichText(), + this._activateChildren(!0) + }, + onDisable: function() { + this.handleTouchEvent && this._removeEventListeners(), + this._activateChildren(!1) + }, + start: function() { + this._onTTFLoaded() + }, + _onColorChanged: function(t) { + this.node.children.forEach((function(e) { + e.color = t + } + )) + }, + _addEventListeners: function() { + this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), + this.node.on(cc.Node.EventType.COLOR_CHANGED, this._onColorChanged, this) + }, + _removeEventListeners: function() { + this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), + this.node.off(cc.Node.EventType.COLOR_CHANGED, this._onColorChanged, this) + }, + _updateLabelSegmentTextAttributes: function() { + this._labelSegments.forEach(function(t) { + this._applyTextAttribute(t, null, !0) + } + .bind(this)) + }, + _createFontLabel: function(t) { + return h.get(t, this) + }, + _onTTFLoaded: function() { + if (this.font instanceof cc.TTFFont) + if (this.font._nativeAsset) + this._layoutDirty = !0, + this._updateRichText(); + else { + var t = this; + cc.assetManager.postLoadNative(this.font, (function() { + t._layoutDirty = !0, + t._updateRichText() + } + )) + } + else + this._layoutDirty = !0, + this._updateRichText() + }, + _measureText: function(t, e) { + var i = this + , n = function(e) { + var n; + return 0 === i._labelSegmentsCache.length ? (n = i._createFontLabel(e), + i._labelSegmentsCache.push(n)) : n = i._labelSegmentsCache[0], + n._styleIndex = t, + i._applyTextAttribute(n, e, !0), + n.getContentSize().width + }; + return e ? n(e) : n + }, + _onTouchEnded: function(t) { + for (var e = this, i = this.node.getComponents(cc.Component), n = function(n) { + var r = e._labelSegments[n] + , s = r._clickHandler + , a = r._clickParam; + s && e._containsTouchLocation(r, t.touch.getLocation()) && (i.forEach((function(e) { + e.enabledInHierarchy && e[s] && e[s](t, a) + } + )), + t.stopPropagation()) + }, r = 0; r < this._labelSegments.length; ++r) + n(r) + }, + _containsTouchLocation: function(t, e) { + return t.getBoundingBoxToWorld().contains(e) + }, + _resetState: function() { + for (var t = this.node.children, e = t.length - 1; e >= 0; e--) { + var i = t[e]; + "RICHTEXT_CHILD" !== i.name && "RICHTEXT_Image_CHILD" !== i.name || (i.parent === this.node ? i.parent = null : t.splice(e, 1), + "RICHTEXT_CHILD" === i.name && h.put(i)) + } + this._labelSegments.length = 0, + this._labelSegmentsCache.length = 0, + this._linesWidth.length = 0, + this._lineOffsetX = 0, + this._lineCount = 1, + this._labelWidth = 0, + this._labelHeight = 0, + this._layoutDirty = !0 + }, + onRestore: !1, + _activateChildren: function(t) { + for (var e = this.node.children.length - 1; e >= 0; e--) { + var i = this.node.children[e]; + "RICHTEXT_CHILD" !== i.name && "RICHTEXT_Image_CHILD" !== i.name || (i.active = t) + } + }, + _addLabelSegment: function(t, e) { + var i; + return (i = 0 === this._labelSegmentsCache.length ? this._createFontLabel(t) : this._labelSegmentsCache.pop())._styleIndex = e, + i._lineCount = this._lineCount, + i.active = this.node.active, + i.setAnchorPoint(0, 0), + this._applyTextAttribute(i, t), + this.node.addChild(i), + this._labelSegments.push(i), + i + }, + _updateRichTextWithMaxWidth: function(t, e, i) { + var n = e; + if (this._lineOffsetX > 0 && n + this._lineOffsetX > this.maxWidth) + for (var s = 0; this._lineOffsetX <= this.maxWidth; ) { + var a = this._getFirstWordLen(t, s, t.length) + , o = t.substr(s, a) + , l = this._measureText(i, o); + if (!(this._lineOffsetX + l <= this.maxWidth)) { + if (s > 0) { + var h = t.substr(0, s); + this._addLabelSegment(h, i), + t = t.substr(s, t.length), + n = this._measureText(i, t) + } + this._updateLineInfo(); + break + } + this._lineOffsetX += l, + s += a + } + if (n > this.maxWidth) + for (var c = r.fragmentText(t, n, this.maxWidth, this._measureText(i)), u = 0; u < c.length; ++u) { + var _ = c[u] + , f = this._addLabelSegment(_, i).getContentSize(); + this._lineOffsetX += f.width, + c.length > 1 && u < c.length - 1 && this._updateLineInfo() + } + else + this._lineOffsetX += n, + this._addLabelSegment(t, i) + }, + _isLastComponentCR: function(t) { + return t.length - 1 === t.lastIndexOf("\n") + }, + _updateLineInfo: function() { + this._linesWidth.push(this._lineOffsetX), + this._lineOffsetX = 0, + this._lineCount++ + }, + _needsUpdateTextLayout: function(t) { + if (this._layoutDirty || !this._textArray || !t) + return !0; + if (this._textArray.length !== t.length) + return !0; + for (var e = 0; e < this._textArray.length; ++e) { + var i = this._textArray[e] + , n = t[e]; + if (i.text !== n.text) + return !0; + var r = i.style + , s = n.style; + if (r) { + if (s) { + if (!r.outline != !s.outline) + return !0; + if (r.size !== s.size || !r.italic != !s.italic || r.isImage !== s.isImage) + return !0; + if (r.src !== s.src || r.imageAlign !== s.imageAlign || r.imageHeight !== s.imageHeight || r.imageWidth !== s.imageWidth || r.imageOffset !== s.imageOffset) + return !0 + } else if (r.size || r.italic || r.isImage || r.outline) + return !0 + } else if (s && (s.size || s.italic || s.isImage || s.outline)) + return !0 + } + return !1 + }, + _addRichTextImageElement: function(t) { + var e = t.style.src + , i = this.imageAtlas.getSpriteFrame(e); + if (i) { + var n = new cc.PrivateNode("RICHTEXT_Image_CHILD") + , r = n.addComponent(cc.Sprite); + switch (t.style.imageAlign) { + case "top": + n.setAnchorPoint(0, 1); + break; + case "center": + n.setAnchorPoint(0, .5); + break; + default: + n.setAnchorPoint(0, 0) + } + t.style.imageOffset && (n._imageOffset = t.style.imageOffset), + r.type = cc.Sprite.Type.SLICED, + r.sizeMode = cc.Sprite.SizeMode.CUSTOM, + this.node.addChild(n), + this._labelSegments.push(n); + var s = i.getRect() + , a = 1 + , o = s.width + , l = s.height + , h = t.style.imageWidth + , c = t.style.imageHeight; + c > 0 ? (o *= a = c / l, + l *= a) : (o *= a = this.lineHeight / l, + l *= a), + h > 0 && (o = h), + this.maxWidth > 0 ? (this._lineOffsetX + o > this.maxWidth && this._updateLineInfo(), + this._lineOffsetX += o) : (this._lineOffsetX += o, + this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX)), + r.spriteFrame = i, + n.setContentSize(o, l), + n._lineCount = this._lineCount, + t.style.event ? (t.style.event.click && (n._clickHandler = t.style.event.click), + t.style.event.param ? n._clickParam = t.style.event.param : n._clickParam = "") : n._clickHandler = null + } else + cc.warnID(4400) + }, + _updateRichText: function() { + if (this.enabledInHierarchy) { + var t = s.parse(this.string); + if (!this._needsUpdateTextLayout(t)) + return this._textArray = t, + void this._updateLabelSegmentTextAttributes(); + this._textArray = t, + this._resetState(); + for (var e, i = !1, n = 0; n < this._textArray.length; ++n) { + var a = this._textArray[n] + , o = a.text; + if ("" === o) { + if (a.style && a.style.newline) { + this._updateLineInfo(); + continue + } + if (a.style && a.style.isImage && this.imageAtlas) { + this._addRichTextImageElement(a); + continue + } + } + for (var l = o.split("\n"), h = 0; h < l.length; ++h) { + var c = l[h]; + if ("" !== c) + if (i = !1, + this.maxWidth > 0) { + var u = this._measureText(n, c); + this._updateRichTextWithMaxWidth(c, u, n), + l.length > 1 && h < l.length - 1 && this._updateLineInfo() + } else + e = this._addLabelSegment(c, n).getContentSize(), + this._lineOffsetX += e.width, + this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX), + l.length > 1 && h < l.length - 1 && this._updateLineInfo(); + else { + if (this._isLastComponentCR(o) && h === l.length - 1) + continue; + this._updateLineInfo(), + i = !0 + } + } + } + i || this._linesWidth.push(this._lineOffsetX), + this.maxWidth > 0 && (this._labelWidth = this.maxWidth), + this._labelHeight = (this._lineCount + r.BASELINE_RATIO) * this.lineHeight, + this.node.setContentSize(this._labelWidth, this._labelHeight), + this._updateRichTextPosition(), + this._layoutDirty = !1 + } + }, + _getFirstWordLen: function(t, e, i) { + var n = t.charAt(e); + if (r.isUnicodeCJK(n) || r.isUnicodeSpace(n)) + return 1; + for (var s = 1, a = e + 1; a < i && (n = t.charAt(a), + !r.isUnicodeSpace(n) && !r.isUnicodeCJK(n)); ++a) + s++; + return s + }, + _updateRichTextPosition: function() { + for (var t = 0, e = 1, i = this._lineCount, n = 0; n < this._labelSegments.length; ++n) { + var s = this._labelSegments[n] + , o = s._lineCount; + o > e && (t = 0, + e = o); + var l = 0; + switch (this.horizontalAlign) { + case a.LEFT: + l = -this._labelWidth / 2; + break; + case a.CENTER: + l = -this._linesWidth[o - 1] / 2; + break; + case a.RIGHT: + l = this._labelWidth / 2 - this._linesWidth[o - 1] + } + s.x = t + l; + var h = s.getContentSize(); + if (s.y = this.lineHeight * (i - o) - this._labelHeight / 2, + o === e && (t += h.width), + s.getComponent(cc.Sprite)) { + var c = this.lineHeight + , u = this.lineHeight * (1 + r.BASELINE_RATIO); + switch (s.anchorY) { + case 1: + s.y += c + (u - c) / 2; + break; + case .5: + s.y += u / 2; + break; + default: + s.y += (u - c) / 2 + } + if (s._imageOffset) { + var _ = s._imageOffset.split(","); + if (1 === _.length && _[0]) { + var f = parseFloat(_[0]); + Number.isInteger(f) && (s.y += f) + } else if (2 === _.length) { + var d = parseFloat(_[0]) + , p = parseFloat(_[1]); + Number.isInteger(d) && (s.x += d), + Number.isInteger(p) && (s.y += p) + } + } + } + var m = s.getComponent(cc.LabelOutline); + m && m.width && (s.y = s.y - m.width) + } + }, + _convertLiteralColorValue: function(t) { + var e = t.toUpperCase(); + return cc.Color[e] ? cc.Color[e] : cc.color().fromHEX(t) + }, + _applyTextAttribute: function(t, e, i) { + var n = t.getComponent(cc.Label); + if (n) { + var r = t._styleIndex + , s = null; + if (this._textArray[r] && (s = this._textArray[r].style), + s && s.color ? t.color = this._convertLiteralColorValue(s.color) : t.color = this.node.color, + n.cacheMode = this.cacheMode, + this.font instanceof cc.Font && !this._isSystemFontUsed ? n.font = this.font : n.fontFamily = this.fontFamily, + n.useSystemFont = this._isSystemFontUsed, + n.lineHeight = this.lineHeight, + n.enableBold = s && s.bold, + n.enableItalics = s && s.italic, + s && s.italic && (t.skewX = 12), + n.enableUnderline = s && s.underline, + s && s.outline) { + var a = t.getComponent(cc.LabelOutline); + a || (a = t.addComponent(cc.LabelOutline)), + a.color = this._convertLiteralColorValue(s.outline.color), + a.width = s.outline.width + } + s && s.size ? n.fontSize = s.size : n.fontSize = this.fontSize, + null !== e && ("string" != typeof e && (e = "" + e), + n.string = e), + i && n._forceUpdateRenderData(), + s && s.event ? (s.event.click && (t._clickHandler = s.event.click), + s.event.param ? t._clickParam = s.event.param : t._clickParam = "") : t._clickHandler = null + } + }, + onDestroy: function() { + for (var t = 0; t < this._labelSegments.length; ++t) + this._labelSegments[t].removeFromParent(), + h.put(this._labelSegments[t]) + } + }); + cc.RichText = e.exports = c + } + ), { + "../platform/CCMacro": 198, + "../platform/js": 214, + "../utils/html-text-parser": 265, + "../utils/text-utils": 274 + }], + 117: [(function(t, e) { + "use strict"; + var i = t("../utils/misc") + , n = (t("./CCComponent"), + cc.Enum({ + HORIZONTAL: 0, + VERTICAL: 1 + })) + , r = cc.Class({ + name: "cc.Scrollbar", + extends: t("./CCComponent"), + editor: !1, + properties: { + _scrollView: null, + _touching: !1, + _autoHideRemainingTime: { + default: 0, + serializable: !1 + }, + _opacity: 255, + handle: { + default: null, + type: cc.Sprite, + tooltip: !1, + notify: function() { + this._onScroll(cc.v2(0, 0)) + }, + animatable: !1 + }, + direction: { + default: n.HORIZONTAL, + type: n, + tooltip: !1, + notify: function() { + this._onScroll(cc.v2(0, 0)) + }, + animatable: !1 + }, + enableAutoHide: { + default: !0, + animatable: !1, + tooltip: !1 + }, + autoHideTime: { + default: 1, + animatable: !1, + tooltip: !1 + } + }, + statics: { + Direction: n + }, + setTargetScrollView: function(t) { + this._scrollView = t + }, + _convertToScrollViewSpace: function(t) { + var e = this._scrollView.node + , i = t.convertToWorldSpaceAR(cc.v2(-t.anchorX * t.width, -t.anchorY * t.height)) + , n = e.convertToNodeSpaceAR(i); + return n.x += e.anchorX * e.width, + n.y += e.anchorY * e.height, + n + }, + _setOpacity: function(t) { + this.handle && (this.node.opacity = t, + this.handle.node.opacity = t) + }, + _onScroll: function(t) { + if (this._scrollView) { + var e = this._scrollView.content; + if (e) { + var i = e.getContentSize() + , r = this._scrollView.node.getContentSize() + , s = this.node.getContentSize(); + if (this._conditionalDisableScrollBar(i, r)) + return; + this.enableAutoHide && (this._autoHideRemainingTime = this.autoHideTime, + this._setOpacity(this._opacity)); + var a = 0 + , o = 0 + , l = 0 + , h = 0 + , c = 0; + this.direction === n.HORIZONTAL ? (a = i.width, + o = r.width, + c = s.width, + l = t.x, + h = -this._convertToScrollViewSpace(e).x) : this.direction === n.VERTICAL && (a = i.height, + o = r.height, + c = s.height, + l = t.y, + h = -this._convertToScrollViewSpace(e).y); + var u = this._calculateLength(a, o, c, l) + , _ = this._calculatePosition(a, o, c, h, l, u); + this._updateLength(u), + this._updateHanlderPosition(_) + } + } + }, + _updateHanlderPosition: function(t) { + if (this.handle) { + var e = this._fixupHandlerPosition(); + this.handle.node.setPosition(t.x + e.x, t.y + e.y) + } + }, + _fixupHandlerPosition: function() { + var t = this.node.getContentSize() + , e = this.node.getAnchorPoint() + , i = this.handle.node.getContentSize() + , r = this.handle.node.parent + , s = this.node.convertToWorldSpaceAR(cc.v2(-t.width * e.x, -t.height * e.y)) + , a = r.convertToNodeSpaceAR(s); + return this.direction === n.HORIZONTAL ? a = cc.v2(a.x, a.y + (t.height - i.height) / 2) : this.direction === n.VERTICAL && (a = cc.v2(a.x + (t.width - i.width) / 2, a.y)), + this.handle.node.setPosition(a), + a + }, + _onTouchBegan: function() { + this.enableAutoHide && (this._touching = !0) + }, + _conditionalDisableScrollBar: function(t, e) { + return t.width <= e.width && this.direction === n.HORIZONTAL || t.height <= e.height && this.direction === n.VERTICAL + }, + _onTouchEnded: function() { + if (this.enableAutoHide && (this._touching = !1, + !(this.autoHideTime <= 0))) { + if (this._scrollView) { + var t = this._scrollView.content; + if (t) { + var e = t.getContentSize() + , i = this._scrollView.node.getContentSize(); + if (this._conditionalDisableScrollBar(e, i)) + return + } + } + this._autoHideRemainingTime = this.autoHideTime + } + }, + _calculateLength: function(t, e, i, n) { + var r = t; + return n && (r += 20 * (n > 0 ? n : -n)), + i * (e / r) + }, + _calculatePosition: function(t, e, r, s, a, o) { + var l = t - e; + a && (l += Math.abs(a)); + var h = 0; + l && (h = s / l, + h = i.clamp01(h)); + var c = (r - o) * h; + return this.direction === n.VERTICAL ? cc.v2(0, c) : cc.v2(c, 0) + }, + _updateLength: function(t) { + if (this.handle) { + var e = this.handle.node + , i = e.getContentSize(); + e.setAnchorPoint(cc.v2(0, 0)), + this.direction === n.HORIZONTAL ? e.setContentSize(t, i.height) : e.setContentSize(i.width, t) + } + }, + _processAutoHide: function(t) { + if (this.enableAutoHide && !(this._autoHideRemainingTime <= 0) && !this._touching && (this._autoHideRemainingTime -= t, + this._autoHideRemainingTime <= this.autoHideTime)) { + this._autoHideRemainingTime = Math.max(0, this._autoHideRemainingTime); + var e = this._opacity * (this._autoHideRemainingTime / this.autoHideTime); + this._setOpacity(e) + } + }, + start: function() { + this.enableAutoHide && this._setOpacity(0) + }, + hide: function() { + this._autoHideRemainingTime = 0, + this._setOpacity(0) + }, + show: function() { + this._autoHideRemainingTime = this.autoHideTime, + this._setOpacity(this._opacity) + }, + update: function(t) { + this._processAutoHide(t) + } + }); + cc.Scrollbar = e.exports = r + } + ), { + "../utils/misc": 267, + "./CCComponent": 105 + }], + 118: [(function(t, e) { + "use strict"; + var i = t("../CCNode").EventType + , n = cc.v2() + , r = cc.v2() + , s = function() { + return (new Date).getMilliseconds() + } + , a = cc.Enum({ + SCROLL_TO_TOP: 0, + SCROLL_TO_BOTTOM: 1, + SCROLL_TO_LEFT: 2, + SCROLL_TO_RIGHT: 3, + SCROLLING: 4, + BOUNCE_TOP: 5, + BOUNCE_BOTTOM: 6, + BOUNCE_LEFT: 7, + BOUNCE_RIGHT: 8, + SCROLL_ENDED: 9, + TOUCH_UP: 10, + AUTOSCROLL_ENDED_WITH_THRESHOLD: 11, + SCROLL_BEGAN: 12 + }) + , o = { + "scroll-to-top": a.SCROLL_TO_TOP, + "scroll-to-bottom": a.SCROLL_TO_BOTTOM, + "scroll-to-left": a.SCROLL_TO_LEFT, + "scroll-to-right": a.SCROLL_TO_RIGHT, + scrolling: a.SCROLLING, + "bounce-bottom": a.BOUNCE_BOTTOM, + "bounce-left": a.BOUNCE_LEFT, + "bounce-right": a.BOUNCE_RIGHT, + "bounce-top": a.BOUNCE_TOP, + "scroll-ended": a.SCROLL_ENDED, + "touch-up": a.TOUCH_UP, + "scroll-ended-with-threshold": a.AUTOSCROLL_ENDED_WITH_THRESHOLD, + "scroll-began": a.SCROLL_BEGAN + } + , l = cc.Class({ + name: "cc.ScrollView", + extends: t("./CCViewGroup"), + editor: !1, + ctor: function() { + this._topBoundary = 0, + this._bottomBoundary = 0, + this._leftBoundary = 0, + this._rightBoundary = 0, + this._touchMoveDisplacements = [], + this._touchMoveTimeDeltas = [], + this._touchMovePreviousTimestamp = 0, + this._touchMoved = !1, + this._autoScrolling = !1, + this._autoScrollAttenuate = !1, + this._autoScrollStartPosition = cc.v2(0, 0), + this._autoScrollTargetDelta = cc.v2(0, 0), + this._autoScrollTotalTime = 0, + this._autoScrollAccumulatedTime = 0, + this._autoScrollCurrentlyOutOfBoundary = !1, + this._autoScrollBraking = !1, + this._autoScrollBrakingStartPosition = cc.v2(0, 0), + this._outOfBoundaryAmount = cc.v2(0, 0), + this._outOfBoundaryAmountDirty = !0, + this._stopMouseWheel = !1, + this._mouseWheelEventElapsedTime = 0, + this._isScrollEndedWithThresholdEventFired = !1, + this._scrollEventEmitMask = 0, + this._isBouncing = !1, + this._scrolling = !1 + }, + properties: { + content: { + default: void 0, + type: cc.Node, + tooltip: !1, + formerlySerializedAs: "content", + notify: function() { + this._calculateBoundary() + } + }, + horizontal: { + default: !0, + animatable: !1, + tooltip: !1 + }, + vertical: { + default: !0, + animatable: !1, + tooltip: !1 + }, + inertia: { + default: !0, + tooltip: !1 + }, + brake: { + default: .5, + type: cc.Float, + range: [0, 1, .1], + tooltip: !1 + }, + elastic: { + default: !0, + animatable: !1, + tooltip: !1 + }, + bounceDuration: { + default: 1, + range: [0, 10], + tooltip: !1 + }, + horizontalScrollBar: { + default: void 0, + type: cc.Scrollbar, + tooltip: !1, + notify: function() { + this.horizontalScrollBar && (this.horizontalScrollBar.setTargetScrollView(this), + this._updateScrollBar(0)) + }, + animatable: !1 + }, + verticalScrollBar: { + default: void 0, + type: cc.Scrollbar, + tooltip: !1, + notify: function() { + this.verticalScrollBar && (this.verticalScrollBar.setTargetScrollView(this), + this._updateScrollBar(0)) + }, + animatable: !1 + }, + scrollEvents: { + default: [], + type: cc.Component.EventHandler, + tooltip: !1 + }, + cancelInnerEvents: { + default: !0, + animatable: !1, + tooltip: !1 + }, + _view: { + get: function() { + if (this.content) + return this.content.parent + } + } + }, + statics: { + EventType: a + }, + scrollToBottom: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(0, 0), + applyToHorizontal: !1, + applyToVertical: !0 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i, !0) + }, + scrollToTop: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(0, 1), + applyToHorizontal: !1, + applyToVertical: !0 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i) + }, + scrollToLeft: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(0, 0), + applyToHorizontal: !0, + applyToVertical: !1 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i) + }, + scrollToRight: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(1, 0), + applyToHorizontal: !0, + applyToVertical: !1 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i) + }, + scrollToTopLeft: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(0, 1), + applyToHorizontal: !0, + applyToVertical: !0 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i) + }, + scrollToTopRight: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(1, 1), + applyToHorizontal: !0, + applyToVertical: !0 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i) + }, + scrollToBottomLeft: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(0, 0), + applyToHorizontal: !0, + applyToVertical: !0 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i) + }, + scrollToBottomRight: function(t, e) { + var i = this._calculateMovePercentDelta({ + anchor: cc.v2(1, 0), + applyToHorizontal: !0, + applyToVertical: !0 + }); + t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i) + }, + scrollToOffset: function(t, e, i) { + var n = this.getMaxScrollOffset() + , r = cc.v2(0, 0); + 0 === n.x ? r.x = 0 : r.x = t.x / n.x, + 0 === n.y ? r.y = 1 : r.y = (n.y - t.y) / n.y, + this.scrollTo(r, e, i) + }, + getScrollOffset: function() { + var t = this._getContentTopBoundary() - this._topBoundary + , e = this._getContentLeftBoundary() - this._leftBoundary; + return cc.v2(e, t) + }, + getMaxScrollOffset: function() { + var t = this._view.getContentSize() + , e = this.content.getContentSize() + , i = e.width - t.width + , n = e.height - t.height; + return i = i >= 0 ? i : 0, + n = n >= 0 ? n : 0, + cc.v2(i, n) + }, + scrollToPercentHorizontal: function(t, e, i) { + var n = this._calculateMovePercentDelta({ + anchor: cc.v2(t, 0), + applyToHorizontal: !0, + applyToVertical: !1 + }); + e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n) + }, + scrollTo: function(t, e, i) { + var n = this._calculateMovePercentDelta({ + anchor: cc.v2(t), + applyToHorizontal: !0, + applyToVertical: !0 + }); + e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n) + }, + scrollToPercentVertical: function(t, e, i) { + var n = this._calculateMovePercentDelta({ + anchor: cc.v2(0, t), + applyToHorizontal: !1, + applyToVertical: !0 + }); + e ? this._startAutoScroll(n, e, !1 !== i) : this._moveContent(n) + }, + stopAutoScroll: function() { + this._autoScrolling = !1, + this._autoScrollAccumulatedTime = this._autoScrollTotalTime + }, + setContentPosition: function(t) { + t.fuzzyEquals(this.getContentPosition(), 1e-4) || (this.content.setPosition(t), + this._outOfBoundaryAmountDirty = !0) + }, + getContentPosition: function() { + return this.content.getPosition() + }, + isScrolling: function() { + return this._scrolling + }, + isAutoScrolling: function() { + return this._autoScrolling + }, + _registerEvent: function() { + this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this, !0), + this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this, !0), + this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this, !0), + this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this, !0), + this.node.on(cc.Node.EventType.MOUSE_WHEEL, this._onMouseWheel, this, !0) + }, + _unregisterEvent: function() { + this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this, !0), + this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this, !0), + this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this, !0), + this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this, !0), + this.node.off(cc.Node.EventType.MOUSE_WHEEL, this._onMouseWheel, this, !0) + }, + _onMouseWheel: function(t, e) { + if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) { + var i = cc.v2(0, 0) + , n = -.1; + cc.sys.os === cc.sys.OS_WINDOWS && cc.sys.browserType === cc.sys.BROWSER_TYPE_FIREFOX && (n = -.1 / 3), + this.vertical ? i = cc.v2(0, t.getScrollY() * n) : this.horizontal && (i = cc.v2(t.getScrollY() * n, 0)), + this._mouseWheelEventElapsedTime = 0, + this._processDeltaMove(i), + this._stopMouseWheel || (this._handlePressLogic(), + this.schedule(this._checkMouseWheel, 1 / 60), + this._stopMouseWheel = !0), + this._stopPropagationIfTargetIsMe(t) + } + }, + _checkMouseWheel: function(t) { + if (!this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4)) + return this._processInertiaScroll(), + this.unschedule(this._checkMouseWheel), + this._dispatchEvent("scroll-ended"), + void (this._stopMouseWheel = !1); + this._mouseWheelEventElapsedTime += t, + this._mouseWheelEventElapsedTime > .1 && (this._onScrollBarTouchEnded(), + this.unschedule(this._checkMouseWheel), + this._dispatchEvent("scroll-ended"), + this._stopMouseWheel = !1) + }, + _calculateMovePercentDelta: function(t) { + var e = t.anchor + , i = t.applyToHorizontal + , n = t.applyToVertical; + this._calculateBoundary(), + e = e.clampf(cc.v2(0, 0), cc.v2(1, 1)); + var r = this._view.getContentSize() + , s = this.content.getContentSize() + , a = this._getContentBottomBoundary() - this._bottomBoundary; + a = -a; + var o = this._getContentLeftBoundary() - this._leftBoundary; + o = -o; + var l = cc.v2(0, 0) + , h = 0; + return i && (h = s.width - r.width, + l.x = o - h * e.x), + n && (h = s.height - r.height, + l.y = a - h * e.y), + l + }, + _moveContentToTopLeft: function(t) { + var e = this.content.getContentSize() + , i = this._getContentBottomBoundary() - this._bottomBoundary; + i = -i; + var n = cc.v2(0, 0) + , r = 0 + , s = this._getContentLeftBoundary() - this._leftBoundary; + s = -s, + e.height < t.height && (r = e.height - t.height, + n.y = i - r), + e.width < t.width && (r = e.width - t.width, + n.x = s), + this._updateScrollBarState(), + this._moveContent(n), + this._adjustContentOutOfBoundary() + }, + _calculateBoundary: function() { + if (this.content) { + var t = this.content.getComponent(cc.Layout); + t && t.enabledInHierarchy && t.updateLayout(); + var e = this._view.getContentSize() + , i = e.width * this._view.anchorX + , n = e.height * this._view.anchorY; + this._leftBoundary = -i, + this._bottomBoundary = -n, + this._rightBoundary = this._leftBoundary + e.width, + this._topBoundary = this._bottomBoundary + e.height, + this._moveContentToTopLeft(e) + } + }, + _hasNestedViewGroup: function(t, e) { + if (t.eventPhase === cc.Event.CAPTURING_PHASE) { + if (e) + for (var i = 0; i < e.length; ++i) { + var n = e[i]; + if (this.node === n) + return !!t.target.getComponent(cc.ViewGroup); + if (n.getComponent(cc.ViewGroup)) + return !0 + } + return !1 + } + }, + _stopPropagationIfTargetIsMe: function(t) { + t.eventPhase === cc.Event.AT_TARGET && t.target === this.node && t.stopPropagation() + }, + _onTouchBegan: function(t, e) { + if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) { + var i = t.touch; + this.content && this._handlePressLogic(i), + this._touchMoved = !1, + this._stopPropagationIfTargetIsMe(t) + } + }, + _onTouchMoved: function(t, e) { + if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) { + var i = t.touch; + if (this.content && this._handleMoveLogic(i), + this.cancelInnerEvents) { + if (i.getLocation().sub(i.getStartLocation()).mag() > 7 && !this._touchMoved && t.target !== this.node) { + var n = new cc.Event.EventTouch(t.getTouches(),t.bubbles); + n.type = cc.Node.EventType.TOUCH_CANCEL, + n.touch = t.touch, + n.simulate = !0, + t.target.dispatchEvent(n), + this._touchMoved = !0 + } + this._stopPropagationIfTargetIsMe(t) + } + } + }, + _onTouchEnded: function(t, e) { + if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) { + this._dispatchEvent("touch-up"); + var i = t.touch; + this.content && this._handleReleaseLogic(i), + this._touchMoved ? t.stopPropagation() : this._stopPropagationIfTargetIsMe(t) + } + }, + _onTouchCancelled: function(t, e) { + if (this.enabledInHierarchy && !this._hasNestedViewGroup(t, e)) { + if (!t.simulate) { + var i = t.touch; + this.content && this._handleReleaseLogic(i) + } + this._stopPropagationIfTargetIsMe(t) + } + }, + _processDeltaMove: function(t) { + this._scrollChildren(t), + this._gatherTouchMove(t) + }, + _getLocalAxisAlignDelta: function(t) { + return this.node.convertToNodeSpaceAR(t.getLocation(), n), + this.node.convertToNodeSpaceAR(t.getPreviousLocation(), r), + n.sub(r) + }, + _handleMoveLogic: function(t) { + var e = this._getLocalAxisAlignDelta(t); + this._processDeltaMove(e) + }, + _scrollChildren: function(t) { + var e, i = t = this._clampDelta(t); + this.elastic && (e = this._getHowMuchOutOfBoundary(), + i.x *= 0 === e.x ? 1 : .5, + i.y *= 0 === e.y ? 1 : .5), + this.elastic || (e = this._getHowMuchOutOfBoundary(i), + i = i.add(e)); + var n = -1; + i.y > 0 ? this.content.y - this.content.anchorY * this.content.height + i.y >= this._bottomBoundary && (n = "scroll-to-bottom") : i.y < 0 && this.content.y - this.content.anchorY * this.content.height + this.content.height + i.y <= this._topBoundary && (n = "scroll-to-top"), + i.x < 0 ? this.content.x - this.content.anchorX * this.content.width + this.content.width + i.x <= this._rightBoundary && (n = "scroll-to-right") : i.x > 0 && this.content.x - this.content.anchorX * this.content.width + i.x >= this._leftBoundary && (n = "scroll-to-left"), + this._moveContent(i, !1), + 0 === i.x && 0 === i.y || (this._scrolling || (this._scrolling = !0, + this._dispatchEvent("scroll-began")), + this._dispatchEvent("scrolling")), + -1 !== n && this._dispatchEvent(n) + }, + _handlePressLogic: function() { + this._autoScrolling && this._dispatchEvent("scroll-ended"), + this._autoScrolling = !1, + this._isBouncing = !1, + this._touchMovePreviousTimestamp = s(), + this._touchMoveDisplacements.length = 0, + this._touchMoveTimeDeltas.length = 0, + this._onScrollBarTouchBegan() + }, + _clampDelta: function(t) { + var e = this.content.getContentSize() + , i = this._view.getContentSize(); + return e.width < i.width && (t.x = 0), + e.height < i.height && (t.y = 0), + t + }, + _gatherTouchMove: function(t) { + for (t = this._clampDelta(t); this._touchMoveDisplacements.length >= 5; ) + this._touchMoveDisplacements.shift(), + this._touchMoveTimeDeltas.shift(); + this._touchMoveDisplacements.push(t); + var e = s(); + this._touchMoveTimeDeltas.push((e - this._touchMovePreviousTimestamp) / 1e3), + this._touchMovePreviousTimestamp = e + }, + _startBounceBackIfNeeded: function() { + if (!this.elastic) + return !1; + var t = this._getHowMuchOutOfBoundary(); + if ((t = this._clampDelta(t)).fuzzyEquals(cc.v2(0, 0), 1e-4)) + return !1; + var e = Math.max(this.bounceDuration, 0); + return this._startAutoScroll(t, e, !0), + this._isBouncing || (t.y > 0 && this._dispatchEvent("bounce-top"), + t.y < 0 && this._dispatchEvent("bounce-bottom"), + t.x > 0 && this._dispatchEvent("bounce-right"), + t.x < 0 && this._dispatchEvent("bounce-left"), + this._isBouncing = !0), + !0 + }, + _processInertiaScroll: function() { + if (!this._startBounceBackIfNeeded() && this.inertia) { + var t = this._calculateTouchMoveVelocity(); + !t.fuzzyEquals(cc.v2(0, 0), 1e-4) && this.brake < 1 && this._startInertiaScroll(t) + } + this._onScrollBarTouchEnded() + }, + _handleReleaseLogic: function(t) { + var e = this._getLocalAxisAlignDelta(t); + this._gatherTouchMove(e), + this._processInertiaScroll(), + this._scrolling && (this._scrolling = !1, + this._autoScrolling || this._dispatchEvent("scroll-ended")) + }, + _isOutOfBoundary: function() { + return !this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4) + }, + _isNecessaryAutoScrollBrake: function() { + if (this._autoScrollBraking) + return !0; + if (this._isOutOfBoundary()) { + if (!this._autoScrollCurrentlyOutOfBoundary) + return this._autoScrollCurrentlyOutOfBoundary = !0, + this._autoScrollBraking = !0, + this._autoScrollBrakingStartPosition = this.getContentPosition(), + !0 + } else + this._autoScrollCurrentlyOutOfBoundary = !1; + return !1 + }, + getScrollEndedEventTiming: function() { + return 1e-4 + }, + _processAutoScrolling: function(t) { + var e = this._isNecessaryAutoScrollBrake() + , i = e ? .05 : 1; + this._autoScrollAccumulatedTime += t * (1 / i); + var n, r = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime); + this._autoScrollAttenuate && (n = r, + r = (n -= 1) * n * n * n * n + 1); + var s = this._autoScrollStartPosition.add(this._autoScrollTargetDelta.mul(r)) + , a = Math.abs(r - 1) <= 1e-4; + if (Math.abs(r - 1) <= this.getScrollEndedEventTiming() && !this._isScrollEndedWithThresholdEventFired && (this._dispatchEvent("scroll-ended-with-threshold"), + this._isScrollEndedWithThresholdEventFired = !0), + this.elastic) { + var o = s.sub(this._autoScrollBrakingStartPosition); + e && (o = o.mul(i)), + s = this._autoScrollBrakingStartPosition.add(o) + } else { + var l = s.sub(this.getContentPosition()) + , h = this._getHowMuchOutOfBoundary(l); + h.fuzzyEquals(cc.v2(0, 0), 1e-4) || (s = s.add(h), + a = !0) + } + a && (this._autoScrolling = !1); + var c = s.sub(this.getContentPosition()); + this._moveContent(this._clampDelta(c), a), + this._dispatchEvent("scrolling"), + this._autoScrolling || (this._isBouncing = !1, + this._scrolling = !1, + this._dispatchEvent("scroll-ended")) + }, + _startInertiaScroll: function(t) { + var e = t.mul(.7); + this._startAttenuatingAutoScroll(e, t) + }, + _calculateAttenuatedFactor: function(t) { + return this.brake <= 0 ? 1 - this.brake : (1 - this.brake) * (1 / (1 + 14e-6 * t + t * t * 8e-9)) + }, + _startAttenuatingAutoScroll: function(t, e) { + var i = this._calculateAutoScrollTimeByInitalSpeed(e.mag()) + , n = t.normalize() + , r = this.content.getContentSize() + , s = this._view.getContentSize() + , a = r.width - s.width + , o = r.height - s.height + , l = this._calculateAttenuatedFactor(a) + , h = this._calculateAttenuatedFactor(o); + n = cc.v2(n.x * a * (1 - this.brake) * l, n.y * o * h * (1 - this.brake)); + var c = t.mag() + , u = n.mag() / c; + n = n.add(t), + this.brake > 0 && u > 7 && (u = Math.sqrt(u), + n = t.mul(u).add(t)), + this.brake > 0 && u > 3 && (i *= u = 3), + 0 === this.brake && u > 1 && (i *= u), + this._startAutoScroll(n, i, !0) + }, + _calculateAutoScrollTimeByInitalSpeed: function(t) { + return Math.sqrt(Math.sqrt(t / 5)) + }, + _startAutoScroll: function(t, e, i) { + var n = this._flattenVectorByDirection(t); + this._autoScrolling = !0, + this._autoScrollTargetDelta = n, + this._autoScrollAttenuate = i, + this._autoScrollStartPosition = this.getContentPosition(), + this._autoScrollTotalTime = e, + this._autoScrollAccumulatedTime = 0, + this._autoScrollBraking = !1, + this._isScrollEndedWithThresholdEventFired = !1, + this._autoScrollBrakingStartPosition = cc.v2(0, 0), + this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0, 0), 1e-4) || (this._autoScrollCurrentlyOutOfBoundary = !0) + }, + _calculateTouchMoveVelocity: function() { + var t = 0; + if ((t = this._touchMoveTimeDeltas.reduce((function(t, e) { + return t + e + } + ), t)) <= 0 || t >= .5) + return cc.v2(0, 0); + var e = cc.v2(0, 0); + return e = this._touchMoveDisplacements.reduce((function(t, e) { + return t.add(e) + } + ), e), + cc.v2(e.x * (1 - this.brake) / t, e.y * (1 - this.brake) / t) + }, + _flattenVectorByDirection: function(t) { + var e = t; + return e.x = this.horizontal ? e.x : 0, + e.y = this.vertical ? e.y : 0, + e + }, + _moveContent: function(t, e) { + var i = this._flattenVectorByDirection(t) + , n = this.getContentPosition().add(i); + this.setContentPosition(n); + var r = this._getHowMuchOutOfBoundary(); + this._updateScrollBar(r), + this.elastic && e && this._startBounceBackIfNeeded() + }, + _getContentLeftBoundary: function() { + return this.getContentPosition().x - this.content.getAnchorPoint().x * this.content.getContentSize().width + }, + _getContentRightBoundary: function() { + var t = this.content.getContentSize(); + return this._getContentLeftBoundary() + t.width + }, + _getContentTopBoundary: function() { + var t = this.content.getContentSize(); + return this._getContentBottomBoundary() + t.height + }, + _getContentBottomBoundary: function() { + return this.getContentPosition().y - this.content.getAnchorPoint().y * this.content.getContentSize().height + }, + _getHowMuchOutOfBoundary: function(t) { + if ((t = t || cc.v2(0, 0)).fuzzyEquals(cc.v2(0, 0), 1e-4) && !this._outOfBoundaryAmountDirty) + return this._outOfBoundaryAmount; + var e = cc.v2(0, 0); + return this._getContentLeftBoundary() + t.x > this._leftBoundary ? e.x = this._leftBoundary - (this._getContentLeftBoundary() + t.x) : this._getContentRightBoundary() + t.x < this._rightBoundary && (e.x = this._rightBoundary - (this._getContentRightBoundary() + t.x)), + this._getContentTopBoundary() + t.y < this._topBoundary ? e.y = this._topBoundary - (this._getContentTopBoundary() + t.y) : this._getContentBottomBoundary() + t.y > this._bottomBoundary && (e.y = this._bottomBoundary - (this._getContentBottomBoundary() + t.y)), + t.fuzzyEquals(cc.v2(0, 0), 1e-4) && (this._outOfBoundaryAmount = e, + this._outOfBoundaryAmountDirty = !1), + this._clampDelta(e) + }, + _updateScrollBarState: function() { + if (this.content) { + var t = this.content.getContentSize() + , e = this._view.getContentSize(); + this.verticalScrollBar && (t.height < e.height ? this.verticalScrollBar.hide() : this.verticalScrollBar.show()), + this.horizontalScrollBar && (t.width < e.width ? this.horizontalScrollBar.hide() : this.horizontalScrollBar.show()) + } + }, + _updateScrollBar: function(t) { + this.horizontalScrollBar && this.horizontalScrollBar._onScroll(t), + this.verticalScrollBar && this.verticalScrollBar._onScroll(t) + }, + _onScrollBarTouchBegan: function() { + this.horizontalScrollBar && this.horizontalScrollBar._onTouchBegan(), + this.verticalScrollBar && this.verticalScrollBar._onTouchBegan() + }, + _onScrollBarTouchEnded: function() { + this.horizontalScrollBar && this.horizontalScrollBar._onTouchEnded(), + this.verticalScrollBar && this.verticalScrollBar._onTouchEnded() + }, + _dispatchEvent: function(t) { + if ("scroll-ended" === t) + this._scrollEventEmitMask = 0; + else if ("scroll-to-top" === t || "scroll-to-bottom" === t || "scroll-to-left" === t || "scroll-to-right" === t) { + var e = 1 << o[t]; + if (this._scrollEventEmitMask & e) + return; + this._scrollEventEmitMask |= e + } + cc.Component.EventHandler.emitEvents(this.scrollEvents, this, o[t]), + this.node.emit(t, this) + }, + _adjustContentOutOfBoundary: function() { + if (this._outOfBoundaryAmountDirty = !0, + this._isOutOfBoundary()) { + var t = this._getHowMuchOutOfBoundary(cc.v2(0, 0)) + , e = this.getContentPosition().add(t); + this.content && (this.content.setPosition(e), + this._updateScrollBar(0)) + } + }, + start: function() { + this._calculateBoundary(), + this.content && cc.director.once(cc.Director.EVENT_BEFORE_DRAW, this._adjustContentOutOfBoundary, this) + }, + _hideScrollbar: function() { + this.horizontalScrollBar && this.horizontalScrollBar.hide(), + this.verticalScrollBar && this.verticalScrollBar.hide() + }, + onDisable: function() { + this._unregisterEvent(), + this.content && (this.content.off(i.SIZE_CHANGED, this._calculateBoundary, this), + this.content.off(i.SCALE_CHANGED, this._calculateBoundary, this), + this._view && (this._view.off(i.POSITION_CHANGED, this._calculateBoundary, this), + this._view.off(i.SCALE_CHANGED, this._calculateBoundary, this), + this._view.off(i.SIZE_CHANGED, this._calculateBoundary, this))), + this._hideScrollbar(), + this.stopAutoScroll() + }, + onEnable: function() { + this._registerEvent(), + this.content && (this.content.on(i.SIZE_CHANGED, this._calculateBoundary, this), + this.content.on(i.SCALE_CHANGED, this._calculateBoundary, this), + this._view && (this._view.on(i.POSITION_CHANGED, this._calculateBoundary, this), + this._view.on(i.SCALE_CHANGED, this._calculateBoundary, this), + this._view.on(i.SIZE_CHANGED, this._calculateBoundary, this))), + this._updateScrollBarState() + }, + update: function(t) { + this._autoScrolling && this._processAutoScrolling(t) + } + }); + cc.ScrollView = e.exports = l + } + ), { + "../CCNode": 29, + "./CCViewGroup": 125 + }], + 119: [(function(t, e) { + "use strict"; + var i = t("../utils/misc") + , n = t("./CCComponent") + , r = cc.Enum({ + Horizontal: 0, + Vertical: 1 + }) + , s = cc.Class({ + name: "cc.Slider", + extends: n, + editor: !1, + ctor: function() { + this._offset = cc.v2(), + this._touchHandle = !1, + this._dragging = !1 + }, + properties: { + handle: { + default: null, + type: cc.Button, + tooltip: !1, + notify: function() {} + }, + direction: { + default: r.Horizontal, + type: r, + tooltip: !1 + }, + progress: { + default: .5, + type: cc.Float, + range: [0, 1, .1], + slide: !0, + tooltip: !1, + notify: function() { + this._updateHandlePosition() + } + }, + slideEvents: { + default: [], + type: cc.Component.EventHandler, + tooltip: !1 + } + }, + statics: { + Direction: r + }, + __preload: function() { + this._updateHandlePosition() + }, + onEnable: function() { + this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), + this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), + this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), + this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this), + this.handle && this.handle.isValid && (this.handle.node.on(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this), + this.handle.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), + this.handle.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this)) + }, + onDisable: function() { + this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), + this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), + this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this), + this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancelled, this), + this.handle && this.handle.isValid && (this.handle.node.off(cc.Node.EventType.TOUCH_START, this._onHandleDragStart, this), + this.handle.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved, this), + this.handle.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this)) + }, + _onHandleDragStart: function(t) { + this._dragging = !0, + this._touchHandle = !0, + this._offset = this.handle.node.convertToNodeSpaceAR(t.touch.getLocation()), + t.stopPropagation() + }, + _onTouchBegan: function(t) { + this.handle && (this._dragging = !0, + this._touchHandle || this._handleSliderLogic(t.touch), + t.stopPropagation()) + }, + _onTouchMoved: function(t) { + this._dragging && (this._handleSliderLogic(t.touch), + t.stopPropagation()) + }, + _onTouchEnded: function(t) { + this._dragging = !1, + this._touchHandle = !1, + this._offset = cc.v2(), + t.stopPropagation() + }, + _onTouchCancelled: function(t) { + this._dragging = !1, + t.stopPropagation() + }, + _handleSliderLogic: function(t) { + this._updateProgress(t), + this._emitSlideEvent() + }, + _emitSlideEvent: function() { + cc.Component.EventHandler.emitEvents(this.slideEvents, this), + this.node.emit("slide", this) + }, + _updateProgress: function(t) { + if (this.handle) { + var e = this.node + , n = e.convertToNodeSpaceAR(t.getLocation()); + this.direction === r.Horizontal ? this.progress = i.clamp01((n.x - this._offset.x + e.anchorX * e.width) / e.width) : this.progress = i.clamp01((n.y - this._offset.y + e.anchorY * e.height) / e.height) + } + }, + _updateHandlePosition: function() { + if (this.handle) { + var t; + t = this.direction === r.Horizontal ? cc.v2(-this.node.width * this.node.anchorX + this.progress * this.node.width, 0) : cc.v2(0, -this.node.height * this.node.anchorY + this.progress * this.node.height); + var e = this.node.convertToWorldSpaceAR(t); + this.handle.node.position = this.handle.node.parent.convertToNodeSpaceAR(e) + } + } + }); + cc.Slider = e.exports = s + } + ), { + "../utils/misc": 267, + "./CCComponent": 105 + }], + 120: [(function(t, e) { + "use strict"; + var i = t("../utils/misc") + , n = (t("../CCNode").EventType, + t("./CCRenderComponent")) + , r = t("../utils/blend-func") + , s = cc.Enum({ + SIMPLE: 0, + SLICED: 1, + TILED: 2, + FILLED: 3, + MESH: 4 + }) + , a = cc.Enum({ + HORIZONTAL: 0, + VERTICAL: 1, + RADIAL: 2 + }) + , o = cc.Enum({ + CUSTOM: 0, + TRIMMED: 1, + RAW: 2 + }) + , l = cc.Enum({ + NORMAL: 0, + GRAY: 1 + }) + , h = cc.Class({ + name: "cc.Sprite", + extends: n, + mixins: [r], + editor: !1, + properties: { + _spriteFrame: { + default: null, + type: cc.SpriteFrame + }, + _type: s.SIMPLE, + _sizeMode: o.TRIMMED, + _fillType: 0, + _fillCenter: cc.v2(0, 0), + _fillStart: 0, + _fillRange: 0, + _isTrimmedMode: !0, + _atlas: { + default: null, + type: cc.SpriteAtlas, + tooltip: !1, + editorOnly: !0, + visible: !0, + animatable: !1 + }, + spriteFrame: { + get: function() { + return this._spriteFrame + }, + set: function(t) { + var e = this._spriteFrame; + e !== t && (this._spriteFrame = t, + this._applySpriteFrame(e)) + }, + type: cc.SpriteFrame + }, + type: { + get: function() { + return this._type + }, + set: function(t) { + this._type !== t && (this._type = t, + this.setVertsDirty(), + this._resetAssembler()) + }, + type: s, + animatable: !1, + tooltip: !1 + }, + fillType: { + get: function() { + return this._fillType + }, + set: function(t) { + t !== this._fillType && (this._fillType = t, + this.setVertsDirty(), + this._resetAssembler()) + }, + type: a, + tooltip: !1 + }, + fillCenter: { + get: function() { + return this._fillCenter + }, + set: function(t) { + this._fillCenter.x = t.x, + this._fillCenter.y = t.y, + this._type === s.FILLED && this.setVertsDirty() + }, + tooltip: !1 + }, + fillStart: { + get: function() { + return this._fillStart + }, + set: function(t) { + this._fillStart = i.clampf(t, -1, 1), + this._type === s.FILLED && this.setVertsDirty() + }, + tooltip: !1 + }, + fillRange: { + get: function() { + return this._fillRange + }, + set: function(t) { + this._fillRange = i.clampf(t, -1, 1), + this._type === s.FILLED && this.setVertsDirty() + }, + tooltip: !1 + }, + trim: { + get: function() { + return this._isTrimmedMode + }, + set: function(t) { + this._isTrimmedMode !== t && (this._isTrimmedMode = t, + this._type !== s.SIMPLE && this._type !== s.MESH || this.setVertsDirty()) + }, + animatable: !1, + tooltip: !1 + }, + sizeMode: { + get: function() { + return this._sizeMode + }, + set: function(t) { + this._sizeMode = t, + t !== o.CUSTOM && this._applySpriteSize() + }, + animatable: !1, + type: o, + tooltip: !1 + } + }, + statics: { + FillType: a, + Type: s, + SizeMode: o, + State: l + }, + setVisible: function(t) { + this.enabled = t + }, + setState: function() {}, + getState: function() {}, + __preload: function() { + this._super(), + this._applySpriteFrame() + }, + onEnable: function() { + this._super(), + this._spriteFrame && this._spriteFrame.ensureLoadTexture(), + this.node.on(cc.Node.EventType.SIZE_CHANGED, this.setVertsDirty, this), + this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this) + }, + onDisable: function() { + this._super(), + this.node.off(cc.Node.EventType.SIZE_CHANGED, this.setVertsDirty, this), + this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this.setVertsDirty, this) + }, + _updateMaterial: function() { + var t = null; + this._spriteFrame && (t = this._spriteFrame.getTexture()); + var e = this.getMaterial(0); + e && (void 0 !== e.getDefine("USE_TEXTURE") && e.define("USE_TEXTURE", !0), + e.getProperty("texture") !== t && e.setProperty("texture", t)), + r.prototype._updateMaterial.call(this) + }, + _applyAtlas: !1, + _validateRender: function() { + var t = this._spriteFrame; + this._materials[0] && t && t.textureLoaded() || this.disableRender() + }, + _applySpriteSize: function() { + if (this._spriteFrame && this.isValid) { + if (o.RAW === this._sizeMode) { + var t = this._spriteFrame._originalSize; + this.node.setContentSize(t) + } else if (o.TRIMMED === this._sizeMode) { + var e = this._spriteFrame._rect; + this.node.setContentSize(e.width, e.height) + } + this.setVertsDirty() + } + }, + _applySpriteFrame: function(t) { + if (this.isValid) { + var e = t && t.getTexture(); + e && !e.loaded && t.off("load", this._applySpriteSize, this), + this._updateMaterial(); + var i = this._spriteFrame; + if (i) { + var n = i.getTexture(); + n && n.loaded ? this._applySpriteSize() : (this.disableRender(), + i.once("load", this._applySpriteSize, this)) + } else + this.disableRender() + } + } + }); + cc.Sprite = e.exports = h + } + ), { + "../CCNode": 29, + "../utils/blend-func": 261, + "../utils/misc": 267, + "./CCRenderComponent": 115 + }], + 121: [(function(t, e) { + "use strict"; + var i = cc.Enum({ + NONE: 0, + CHECKBOX: 1, + TEXT_ATLAS: 2, + SLIDER_BAR: 3, + LIST_VIEW: 4, + PAGE_VIEW: 5 + }) + , n = cc.Enum({ + VERTICAL: 0, + HORIZONTAL: 1 + }) + , r = cc.Enum({ + TOP: 0, + CENTER: 1, + BOTTOM: 2 + }) + , s = cc.Enum({ + LEFT: 0, + CENTER: 1, + RIGHT: 2 + }) + , a = cc.Class({ + name: "cc.StudioComponent", + extends: cc.Component, + editor: !1, + properties: !1, + statics: { + ComponentType: i, + ListDirection: n, + VerticalAlign: r, + HorizontalAlign: s + } + }); + cc.StudioComponent = e.exports = a; + var o = cc.Class({ + name: "cc.StudioWidget", + extends: cc.Widget, + editor: !1, + _validateTargetInDEV: function() {} + }); + cc.StudioWidget = e.exports = o + } + ), {}], + 122: [(function(t, e) { + "use strict"; + var i = t("../utils/gray-sprite-state") + , n = cc.Class({ + name: "cc.Toggle", + extends: t("./CCButton"), + mixins: [i], + editor: !1, + properties: { + _N$isChecked: !0, + isChecked: { + get: function() { + return this._N$isChecked + }, + set: function(t) { + if (t !== this._N$isChecked) { + var e = this.toggleGroup || this._toggleContainer; + e && e.enabled && this._N$isChecked && !e.allowSwitchOff || (this._N$isChecked = t, + this._updateCheckMark(), + e && e.enabled && e.updateToggles(this), + cc.Toggle._triggerEventInScript_isChecked && this._emitToggleEvents()) + } + }, + tooltip: !1 + }, + toggleGroup: { + default: null, + tooltip: !1, + type: t("./CCToggleGroup") + }, + checkMark: { + default: null, + type: cc.Sprite, + tooltip: !1 + }, + checkEvents: { + default: [], + type: cc.Component.EventHandler + }, + _resizeToTarget: { + animatable: !1, + set: function(t) { + t && this._resizeNodeToTargetNode() + } + } + }, + statics: { + _triggerEventInScript_check: !1, + _triggerEventInScript_isChecked: !1 + }, + onEnable: function() { + this._super(), + this._registerToggleEvent(), + this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.addToggle(this) + }, + onDisable: function() { + this._super(), + this._unregisterToggleEvent(), + this.toggleGroup && this.toggleGroup.enabledInHierarchy && this.toggleGroup.removeToggle(this) + }, + _hideCheckMark: function() { + this._N$isChecked = !1, + this._updateCheckMark() + }, + toggle: function(t) { + this.isChecked = !this.isChecked, + cc.Toggle._triggerEventInScript_isChecked || !cc.Toggle._triggerEventInScript_check && !t || this._emitToggleEvents() + }, + check: function() { + this.isChecked = !0, + !cc.Toggle._triggerEventInScript_isChecked && cc.Toggle._triggerEventInScript_check && this._emitToggleEvents() + }, + uncheck: function() { + this.isChecked = !1, + !cc.Toggle._triggerEventInScript_isChecked && cc.Toggle._triggerEventInScript_check && this._emitToggleEvents() + }, + _updateCheckMark: function() { + this.checkMark && (this.checkMark.node.active = !!this.isChecked) + }, + _updateDisabledState: function() { + if (this._super(), + this.enableAutoGrayEffect && this.checkMark) { + var t = !this.interactable; + this._switchGrayMaterial(t, this.checkMark) + } + }, + _registerToggleEvent: function() { + this.node.on("click", this.toggle, this) + }, + _unregisterToggleEvent: function() { + this.node.off("click", this.toggle, this) + }, + _emitToggleEvents: function() { + this.node.emit("toggle", this), + this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, this) + } + }); + cc.Toggle = e.exports = n, + t("../platform/js").get(n.prototype, "_toggleContainer", (function() { + var t = this.node.parent; + return cc.Node.isNode(t) ? t.getComponent(cc.ToggleContainer) : null + } + )) + } + ), { + "../platform/js": 214, + "../utils/gray-sprite-state": 264, + "./CCButton": 103, + "./CCToggleGroup": 124 + }], + 123: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.ToggleContainer", + extends: cc.Component, + editor: !1, + properties: { + allowSwitchOff: { + tooltip: !1, + default: !1 + }, + checkEvents: { + default: [], + type: cc.Component.EventHandler + } + }, + updateToggles: function(t) { + this.enabledInHierarchy && t.isChecked && (this.toggleItems.forEach((function(e) { + e !== t && e.isChecked && e.enabled && e._hideCheckMark() + } + )), + this.checkEvents && cc.Component.EventHandler.emitEvents(this.checkEvents, t)) + }, + _allowOnlyOneToggleChecked: function() { + var t = !1; + return this.toggleItems.forEach((function(e) { + t ? e._hideCheckMark() : e.isChecked && (t = !0) + } + )), + t + }, + _makeAtLeastOneToggleChecked: function() { + if (!this._allowOnlyOneToggleChecked() && !this.allowSwitchOff) { + var t = this.toggleItems; + t.length > 0 && t[0].check() + } + }, + onEnable: function() { + this._makeAtLeastOneToggleChecked(), + this.node.on("child-added", this._allowOnlyOneToggleChecked, this), + this.node.on("child-removed", this._makeAtLeastOneToggleChecked, this) + }, + onDisable: function() { + this.node.off("child-added", this._allowOnlyOneToggleChecked, this), + this.node.off("child-removed", this._makeAtLeastOneToggleChecked, this) + } + }); + t("../platform/js").get(i.prototype, "toggleItems", (function() { + return this.node._children.map((function(t) { + return t.getComponent(cc.Toggle) + } + )).filter(Boolean) + } + )), + cc.ToggleContainer = e.exports = i + } + ), { + "../platform/js": 214 + }], + 124: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.ToggleGroup", + extends: cc.Component, + ctor: function() { + this._toggleItems = [] + }, + editor: !1, + properties: { + allowSwitchOff: { + tooltip: !1, + default: !1 + }, + toggleItems: { + get: function() { + return this._toggleItems + } + } + }, + updateToggles: function(t) { + this.enabledInHierarchy && this._toggleItems.forEach((function(e) { + t.isChecked && e !== t && e.isChecked && e.enabled && e._hideCheckMark() + } + )) + }, + addToggle: function(t) { + -1 === this._toggleItems.indexOf(t) && this._toggleItems.push(t), + this._allowOnlyOneToggleChecked() + }, + removeToggle: function(t) { + var e = this._toggleItems.indexOf(t); + e > -1 && this._toggleItems.splice(e, 1), + this._makeAtLeastOneToggleChecked() + }, + _allowOnlyOneToggleChecked: function() { + var t = !1; + return this._toggleItems.forEach((function(e) { + t && e.enabled && e._hideCheckMark(), + e.isChecked && e.enabled && (t = !0) + } + )), + t + }, + _makeAtLeastOneToggleChecked: function() { + this._allowOnlyOneToggleChecked() || this.allowSwitchOff || this._toggleItems.length > 0 && (this._toggleItems[0].isChecked = !0) + }, + start: function() { + this._makeAtLeastOneToggleChecked() + } + }) + , n = t("../platform/js") + , r = !1; + n.get(cc, "ToggleGroup", (function() { + return r || (cc.errorID(1405, "cc.ToggleGroup", "cc.ToggleContainer"), + r = !0), + i + } + )), + e.exports = i + } + ), { + "../platform/js": 214 + }], + 125: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.ViewGroup", + extends: t("./CCComponent") + }); + cc.ViewGroup = e.exports = i + } + ), { + "./CCComponent": 105 + }], + 126: [(function(t, e) { + "use strict"; + var i = t("../base-ui/CCWidgetManager") + , n = i.AlignMode + , r = i._AlignFlags + , s = r.TOP + , a = r.MID + , o = r.BOT + , l = r.LEFT + , h = r.CENTER + , c = r.RIGHT + , u = s | o + , _ = l | c + , f = cc.Class({ + name: "cc.Widget", + extends: t("./CCComponent"), + editor: !1, + properties: { + target: { + get: function() { + return this._target + }, + set: function(t) { + this._target = t + }, + type: cc.Node, + tooltip: !1 + }, + isAlignTop: { + get: function() { + return (this._alignFlags & s) > 0 + }, + set: function(t) { + this._setAlign(s, t) + }, + animatable: !1, + tooltip: !1 + }, + isAlignVerticalCenter: { + get: function() { + return (this._alignFlags & a) > 0 + }, + set: function(t) { + t ? (this.isAlignTop = !1, + this.isAlignBottom = !1, + this._alignFlags |= a) : this._alignFlags &= ~a + }, + animatable: !1, + tooltip: !1 + }, + isAlignBottom: { + get: function() { + return (this._alignFlags & o) > 0 + }, + set: function(t) { + this._setAlign(o, t) + }, + animatable: !1, + tooltip: !1 + }, + isAlignLeft: { + get: function() { + return (this._alignFlags & l) > 0 + }, + set: function(t) { + this._setAlign(l, t) + }, + animatable: !1, + tooltip: !1 + }, + isAlignHorizontalCenter: { + get: function() { + return (this._alignFlags & h) > 0 + }, + set: function(t) { + t ? (this.isAlignLeft = !1, + this.isAlignRight = !1, + this._alignFlags |= h) : this._alignFlags &= ~h + }, + animatable: !1, + tooltip: !1 + }, + isAlignRight: { + get: function() { + return (this._alignFlags & c) > 0 + }, + set: function(t) { + this._setAlign(c, t) + }, + animatable: !1, + tooltip: !1 + }, + isStretchWidth: { + get: function() { + return (this._alignFlags & _) === _ + }, + visible: !1 + }, + isStretchHeight: { + get: function() { + return (this._alignFlags & u) === u + }, + visible: !1 + }, + top: { + get: function() { + return this._top + }, + set: function(t) { + this._top = t + }, + tooltip: !1 + }, + bottom: { + get: function() { + return this._bottom + }, + set: function(t) { + this._bottom = t + }, + tooltip: !1 + }, + left: { + get: function() { + return this._left + }, + set: function(t) { + this._left = t + }, + tooltip: !1 + }, + right: { + get: function() { + return this._right + }, + set: function(t) { + this._right = t + }, + tooltip: !1 + }, + horizontalCenter: { + get: function() { + return this._horizontalCenter + }, + set: function(t) { + this._horizontalCenter = t + }, + tooltip: !1 + }, + verticalCenter: { + get: function() { + return this._verticalCenter + }, + set: function(t) { + this._verticalCenter = t + }, + tooltip: !1 + }, + isAbsoluteHorizontalCenter: { + get: function() { + return this._isAbsHorizontalCenter + }, + set: function(t) { + this._isAbsHorizontalCenter = t + }, + animatable: !1 + }, + isAbsoluteVerticalCenter: { + get: function() { + return this._isAbsVerticalCenter + }, + set: function(t) { + this._isAbsVerticalCenter = t + }, + animatable: !1 + }, + isAbsoluteTop: { + get: function() { + return this._isAbsTop + }, + set: function(t) { + this._isAbsTop = t + }, + animatable: !1 + }, + isAbsoluteBottom: { + get: function() { + return this._isAbsBottom + }, + set: function(t) { + this._isAbsBottom = t + }, + animatable: !1 + }, + isAbsoluteLeft: { + get: function() { + return this._isAbsLeft + }, + set: function(t) { + this._isAbsLeft = t + }, + animatable: !1 + }, + isAbsoluteRight: { + get: function() { + return this._isAbsRight + }, + set: function(t) { + this._isAbsRight = t + }, + animatable: !1 + }, + alignMode: { + default: n.ON_WINDOW_RESIZE, + type: n, + tooltip: !1 + }, + _wasAlignOnce: { + default: void 0, + formerlySerializedAs: "isAlignOnce" + }, + _target: null, + _alignFlags: 0, + _left: 0, + _right: 0, + _top: 0, + _bottom: 0, + _verticalCenter: 0, + _horizontalCenter: 0, + _isAbsLeft: !0, + _isAbsRight: !0, + _isAbsTop: !0, + _isAbsBottom: !0, + _isAbsHorizontalCenter: !0, + _isAbsVerticalCenter: !0, + _originalWidth: 0, + _originalHeight: 0 + }, + statics: { + AlignMode: n + }, + onLoad: function() { + void 0 !== this._wasAlignOnce && (this.alignMode = this._wasAlignOnce ? n.ONCE : n.ALWAYS, + this._wasAlignOnce = void 0) + }, + onEnable: function() { + i.add(this) + }, + onDisable: function() { + i.remove(this) + }, + _validateTargetInDEV: !1, + _setAlign: function(t, e) { + if (e !== (this._alignFlags & t) > 0) { + var i = (t & _) > 0; + e ? (this._alignFlags |= t, + i ? (this.isAlignHorizontalCenter = !1, + this.isStretchWidth && (this._originalWidth = this.node.width)) : (this.isAlignVerticalCenter = !1, + this.isStretchHeight && (this._originalHeight = this.node.height))) : (i ? this.isStretchWidth && (this.node.width = this._originalWidth) : this.isStretchHeight && (this.node.height = this._originalHeight), + this._alignFlags &= ~t) + } + }, + updateAlignment: function() { + i.updateAlignment(this.node) + } + }); + Object.defineProperty(f.prototype, "isAlignOnce", { + get: function() { + return this.alignMode === n.ONCE + }, + set: function(t) { + this.alignMode = t ? n.ONCE : n.ALWAYS + } + }), + cc.Widget = e.exports = f + } + ), { + "../base-ui/CCWidgetManager": 89, + "./CCComponent": 105 + }], + 127: [(function(t, e) { + "use strict"; + var i = t("../../platform/CCMacro") + , n = t("../editbox/EditBoxImplBase") + , r = t("../CCLabel") + , s = t("./types") + , a = s.InputMode + , o = s.InputFlag + , l = s.KeyboardReturnType; + function h(t) { + return t.charAt(0).toUpperCase() + t.slice(1) + } + var c = cc.Class({ + name: "cc.EditBox", + extends: cc.Component, + editor: !1, + properties: { + _string: "", + string: { + tooltip: !1, + get: function() { + return this._string + }, + set: function(t) { + t = "" + t, + this.maxLength >= 0 && t.length >= this.maxLength && (t = t.slice(0, this.maxLength)), + this._string = t, + this._updateString(t) + } + }, + textLabel: { + tooltip: !1, + default: null, + type: r, + notify: function(t) { + this.textLabel && this.textLabel !== t && (this._updateTextLabel(), + this._updateLabels()) + } + }, + placeholderLabel: { + tooltip: !1, + default: null, + type: r, + notify: function(t) { + this.placeholderLabel && this.placeholderLabel !== t && (this._updatePlaceholderLabel(), + this._updateLabels()) + } + }, + background: { + tooltip: !1, + default: null, + type: cc.Sprite, + notify: function(t) { + this.background && this.background !== t && this._updateBackgroundSprite() + } + }, + _N$backgroundImage: { + default: void 0, + type: cc.SpriteFrame + }, + backgroundImage: { + get: function() { + return this.background ? this.background.spriteFrame : null + }, + set: function(t) { + this.background && (this.background.spriteFrame = t) + } + }, + returnType: { + default: l.DEFAULT, + tooltip: !1, + displayName: "KeyboardReturnType", + type: l + }, + _N$returnType: { + default: void 0, + type: cc.Float + }, + inputFlag: { + tooltip: !1, + default: o.DEFAULT, + type: o, + notify: function() { + this._updateString(this._string) + } + }, + inputMode: { + tooltip: !1, + default: a.ANY, + type: a, + notify: function(t) { + this.inputMode !== t && (this._updateTextLabel(), + this._updatePlaceholderLabel()) + } + }, + fontSize: { + get: function() { + return this.textLabel ? this.textLabel.fontSize : 0 + }, + set: function(t) { + this.textLabel && (this.textLabel.fontSize = t) + } + }, + _N$fontSize: { + default: void 0, + type: cc.Float + }, + lineHeight: { + get: function() { + return this.textLabel ? this.textLabel.lineHeight : 0 + }, + set: function(t) { + this.textLabel && (this.textLabel.lineHeight = t) + } + }, + _N$lineHeight: { + default: void 0, + type: cc.Float + }, + fontColor: { + get: function() { + return this.textLabel ? this.textLabel.node.color : cc.Color.BLACK + }, + set: function(t) { + this.textLabel && (this.textLabel.node.color = t, + this.textLabel.node.opacity = t.a) + } + }, + _N$fontColor: void 0, + placeholder: { + tooltip: !1, + get: function() { + return this.placeholderLabel ? this.placeholderLabel.string : "" + }, + set: function(t) { + this.placeholderLabel && (this.placeholderLabel.string = t) + } + }, + _N$placeholder: { + default: void 0, + type: cc.String + }, + placeholderFontSize: { + get: function() { + return this.placeholderLabel ? this.placeholderLabel.fontSize : 0 + }, + set: function(t) { + this.placeholderLabel && (this.placeholderLabel.fontSize = t) + } + }, + _N$placeholderFontSize: { + default: void 0, + type: cc.Float + }, + placeholderFontColor: { + get: function() { + return this.placeholderLabel ? this.placeholderLabel.node.color : cc.Color.BLACK + }, + set: function(t) { + this.placeholderLabel && (this.placeholderLabel.node.color = t, + this.placeholderLabel.node.opacity = t.a) + } + }, + _N$placeholderFontColor: void 0, + maxLength: { + tooltip: !1, + default: 20 + }, + _N$maxLength: { + default: void 0, + type: cc.Float + }, + stayOnTop: { + default: !1, + notify: function() { + cc.warn("editBox.stayOnTop is removed since v2.1.") + } + }, + _tabIndex: 0, + tabIndex: { + tooltip: !1, + get: function() { + return this._tabIndex + }, + set: function(t) { + this._tabIndex !== t && (this._tabIndex = t, + this._impl && this._impl.setTabIndex(t)) + } + }, + editingDidBegan: { + default: [], + type: cc.Component.EventHandler + }, + textChanged: { + default: [], + type: cc.Component.EventHandler + }, + editingDidEnded: { + default: [], + type: cc.Component.EventHandler + }, + editingReturn: { + default: [], + type: cc.Component.EventHandler + } + }, + statics: { + _ImplClass: n, + KeyboardReturnType: l, + InputFlag: o, + InputMode: a + }, + _init: function() { + this._upgradeComp(), + this._isLabelVisible = !0, + this.node.on(cc.Node.EventType.SIZE_CHANGED, this._syncSize, this), + (this._impl = new c._ImplClass).init(this), + this._updateString(this._string), + this._syncSize() + }, + _updateBackgroundSprite: function() { + var t = this.background; + if (!t) { + var e = this.node.getChildByName("BACKGROUND_SPRITE"); + e || (e = new cc.Node("BACKGROUND_SPRITE")), + (t = e.getComponent(cc.Sprite)) || (t = e.addComponent(cc.Sprite)), + e.parent = this.node, + this.background = t + } + t.type = cc.Sprite.Type.SLICED, + void 0 !== this._N$backgroundImage && (t.spriteFrame = this._N$backgroundImage, + this._N$backgroundImage = void 0) + }, + _updateTextLabel: function() { + var t = this.textLabel; + if (!t) { + var e = this.node.getChildByName("TEXT_LABEL"); + e || (e = new cc.Node("TEXT_LABEL")), + (t = e.getComponent(r)) || (t = e.addComponent(r)), + e.parent = this.node, + this.textLabel = t + } + t.node.setAnchorPoint(0, 1), + t.overflow = r.Overflow.CLAMP, + this.inputMode === a.ANY ? (t.verticalAlign = i.VerticalTextAlignment.TOP, + t.enableWrapText = !0) : (t.verticalAlign = i.VerticalTextAlignment.CENTER, + t.enableWrapText = !1), + t.string = this._updateLabelStringStyle(this._string), + void 0 !== this._N$fontColor && (t.node.color = this._N$fontColor, + t.node.opacity = this._N$fontColor.a, + this._N$fontColor = void 0), + void 0 !== this._N$fontSize && (t.fontSize = this._N$fontSize, + this._N$fontSize = void 0), + void 0 !== this._N$lineHeight && (t.lineHeight = this._N$lineHeight, + this._N$lineHeight = void 0) + }, + _updatePlaceholderLabel: function() { + var t = this.placeholderLabel; + if (!t) { + var e = this.node.getChildByName("PLACEHOLDER_LABEL"); + e || (e = new cc.Node("PLACEHOLDER_LABEL")), + (t = e.getComponent(r)) || (t = e.addComponent(r)), + e.parent = this.node, + this.placeholderLabel = t + } + t.node.setAnchorPoint(0, 1), + t.overflow = r.Overflow.CLAMP, + this.inputMode === a.ANY ? (t.verticalAlign = i.VerticalTextAlignment.TOP, + t.enableWrapText = !0) : (t.verticalAlign = i.VerticalTextAlignment.CENTER, + t.enableWrapText = !1), + t.string = this.placeholder, + void 0 !== this._N$placeholderFontColor && (t.node.color = this._N$placeholderFontColor, + t.node.opacity = this._N$placeholderFontColor.a, + this._N$placeholderFontColor = void 0), + void 0 !== this._N$placeholderFontSize && (t.fontSize = this._N$placeholderFontSize, + this._N$placeholderFontSize = void 0) + }, + _upgradeComp: function() { + void 0 !== this._N$returnType && (this.returnType = this._N$returnType, + this._N$returnType = void 0), + void 0 !== this._N$maxLength && (this.maxLength = this._N$maxLength, + this._N$maxLength = void 0), + void 0 !== this._N$backgroundImage && this._updateBackgroundSprite(), + void 0 === this._N$fontColor && void 0 === this._N$fontSize && void 0 === this._N$lineHeight || this._updateTextLabel(), + void 0 === this._N$placeholderFontColor && void 0 === this._N$placeholderFontSize || this._updatePlaceholderLabel(), + void 0 !== this._N$placeholder && (this.placeholder = this._N$placeholder, + this._N$placeholder = void 0) + }, + _syncSize: function() { + if (this._impl) { + var t = this.node.getContentSize(); + this._impl.setSize(t.width, t.height) + } + }, + _showLabels: function() { + this._isLabelVisible = !0, + this._updateLabels() + }, + _hideLabels: function() { + this._isLabelVisible = !1, + this.textLabel && (this.textLabel.node.active = !1), + this.placeholderLabel && (this.placeholderLabel.node.active = !1) + }, + _updateLabels: function() { + if (this._isLabelVisible) { + var t = this._string; + this.textLabel && (this.textLabel.node.active = "" !== t), + this.placeholderLabel && (this.placeholderLabel.node.active = "" === t) + } + }, + _updateString: function(t) { + var e = this.textLabel; + if (e) { + var i = t; + i && (i = this._updateLabelStringStyle(i)), + e.string = i, + this._updateLabels() + } + }, + _updateLabelStringStyle: function(t, e) { + var i = this.inputFlag; + if (e || i !== o.PASSWORD) + i === o.INITIAL_CAPS_ALL_CHARACTERS ? t = t.toUpperCase() : i === o.INITIAL_CAPS_WORD ? t = t.replace(/(?:^|\s)\S/g, (function(t) { + return t.toUpperCase() + } + )) : i === o.INITIAL_CAPS_SENTENCE && (t = h(t)); + else { + for (var n = "", r = t.length, s = 0; s < r; ++s) + n += "\u25cf"; + t = n + } + return t + }, + editBoxEditingDidBegan: function() { + cc.Component.EventHandler.emitEvents(this.editingDidBegan, this), + this.node.emit("editing-did-began", this) + }, + editBoxEditingDidEnded: function() { + cc.Component.EventHandler.emitEvents(this.editingDidEnded, this), + this.node.emit("editing-did-ended", this) + }, + editBoxTextChanged: function(t) { + t = this._updateLabelStringStyle(t, !0), + this.string = t, + cc.Component.EventHandler.emitEvents(this.textChanged, t, this), + this.node.emit("text-changed", this) + }, + editBoxEditingReturn: function() { + cc.Component.EventHandler.emitEvents(this.editingReturn, this), + this.node.emit("editing-return", this) + }, + onEnable: function() { + this._registerEvent(), + this._impl && this._impl.enable() + }, + onDisable: function() { + this._unregisterEvent(), + this._impl && this._impl.disable() + }, + onDestroy: function() { + this._impl && this._impl.clear() + }, + __preload: function() { + this._init() + }, + _registerEvent: function() { + this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), + this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this) + }, + _unregisterEvent: function() { + this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchBegan, this), + this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded, this) + }, + _onTouchBegan: function(t) { + t.stopPropagation() + }, + _onTouchCancel: function(t) { + t.stopPropagation() + }, + _onTouchEnded: function(t) { + this._impl && this._impl.beginEditing(), + t.stopPropagation() + }, + setFocus: function() { + cc.errorID(1400, "setFocus()", "focus()"), + this._impl && this._impl.setFocus(!0) + }, + focus: function() { + this._impl && this._impl.setFocus(!0) + }, + blur: function() { + this._impl && this._impl.setFocus(!1) + }, + isFocused: function() { + return !!this._impl && this._impl.isFocused() + }, + update: function() { + this._impl && this._impl.update() + } + }); + cc.EditBox = e.exports = c, + cc.sys.isBrowser && t("./WebEditBoxImpl") + } + ), { + "../../platform/CCMacro": 198, + "../CCLabel": 107, + "../editbox/EditBoxImplBase": 128, + "./WebEditBoxImpl": 129, + "./types": 131 + }], + 128: [(function(t, e) { + "use strict"; + var i = cc.Class({ + ctor: function() { + this._delegate = null, + this._editing = !1 + }, + init: function() {}, + enable: function() {}, + disable: function() { + this._editing && this.endEditing() + }, + clear: function() {}, + update: function() {}, + setTabIndex: function() {}, + setSize: function() {}, + setFocus: function(t) { + t ? this.beginEditing() : this.endEditing() + }, + isFocused: function() { + return this._editing + }, + beginEditing: function() {}, + endEditing: function() {} + }); + e.exports = i + } + ), {}], + 129: [(function(t) { + "use strict"; + var e, i = (e = t("../../value-types/mat4")) && e.__esModule ? e : { + default: e + }, n = t("../../platform/utils"), r = t("../../platform/CCMacro"), s = t("./types"), a = t("../CCLabel"), o = t("./tabIndexUtil"), l = cc.EditBox, h = cc.js, c = s.InputMode, u = s.InputFlag, _ = s.KeyboardReturnType, f = { + zoomInvalid: !1 + }; + cc.sys.OS_ANDROID !== cc.sys.os || cc.sys.browserType !== cc.sys.BROWSER_TYPE_SOUGOU && cc.sys.browserType !== cc.sys.BROWSER_TYPE_360 || (f.zoomInvalid = !0); + var d = 0 + , p = cc.v3() + , m = null + , y = !1 + , v = !1 + , g = l._ImplClass; + function A() { + g.call(this), + this._domId = "EditBoxId_" + ++d, + this._placeholderStyleSheet = null, + this._elem = null, + this._isTextArea = !1, + this._worldMat = new i.default, + this._cameraMat = new i.default, + this._m00 = 0, + this._m01 = 0, + this._m04 = 0, + this._m05 = 0, + this._m12 = 0, + this._m13 = 0, + this._w = 0, + this._h = 0, + this._cacheViewportRect = cc.rect(0, 0, 0, 0), + this._inputMode = null, + this._inputFlag = null, + this._returnType = null, + this._eventListeners = {}, + this._textLabelFont = null, + this._textLabelFontSize = null, + this._textLabelFontColor = null, + this._textLabelAlign = null, + this._placeholderLabelFont = null, + this._placeholderLabelFontSize = null, + this._placeholderLabelFontColor = null, + this._placeholderLabelAlign = null, + this._placeholderLineHeight = null + } + h.extend(A, g), + l._ImplClass = A, + Object.assign(A.prototype, { + init: function(t) { + t && (this._delegate = t, + t.inputMode === c.ANY ? this._createTextArea() : this._createInput(), + o.add(this), + this.setTabIndex(t.tabIndex), + this._initStyleSheet(), + this._registerEventListeners(), + this._addDomToGameContainer(), + y = cc.view.isAutoFullScreenEnabled(), + v = cc.view._resizeWithBrowserSize) + }, + clear: function() { + this._removeEventListeners(), + this._removeDomFromGameContainer(), + o.remove(this), + m === this && (m = null) + }, + update: function() { + this._updateMatrix() + }, + setTabIndex: function(t) { + this._elem.tabIndex = t, + o.resort() + }, + setSize: function(t, e) { + var i = this._elem; + i.style.width = t + "px", + i.style.height = e + "px" + }, + beginEditing: function() { + m && m !== this && m.setFocus(!1), + this._editing = !0, + m = this, + this._delegate.editBoxEditingDidBegan(), + this._showDom(), + this._elem.focus() + }, + endEditing: function() { + this._elem && this._elem.blur() + }, + _createInput: function() { + this._isTextArea = !1, + this._elem = document.createElement("input") + }, + _createTextArea: function() { + this._isTextArea = !0, + this._elem = document.createElement("textarea") + }, + _addDomToGameContainer: function() { + cc.game.container.appendChild(this._elem), + document.head.appendChild(this._placeholderStyleSheet) + }, + _removeDomFromGameContainer: function() { + n.contains(cc.game.container, this._elem) && cc.game.container.removeChild(this._elem), + n.contains(document.head, this._placeholderStyleSheet) && document.head.removeChild(this._placeholderStyleSheet), + delete this._elem, + delete this._placeholderStyleSheet + }, + _showDom: function() { + this._updateMaxLength(), + this._updateInputType(), + this._updateStyleSheet(), + this._elem.style.display = "", + this._delegate._hideLabels(), + cc.sys.isMobile && this._showDomOnMobile() + }, + _hideDom: function() { + this._elem.style.display = "none", + this._delegate._showLabels(), + cc.sys.isMobile && this._hideDomOnMobile() + }, + _showDomOnMobile: function() { + cc.sys.os === cc.sys.OS_ANDROID && (y && (cc.view.enableAutoFullScreen(!1), + cc.screen.exitFullScreen()), + v && cc.view.resizeWithBrowserSize(!1), + this._adjustWindowScroll()) + }, + _hideDomOnMobile: function() { + cc.sys.os === cc.sys.OS_ANDROID && (v && cc.view.resizeWithBrowserSize(!0), + setTimeout((function() { + m || y && cc.view.enableAutoFullScreen(!0) + } + ), 800)), + this._scrollBackWindow() + }, + _adjustWindowScroll: function() { + var t = this; + setTimeout((function() { + window.scrollY < 100 && t._elem.scrollIntoView({ + block: "start", + inline: "nearest", + behavior: "smooth" + }) + } + ), 800) + }, + _scrollBackWindow: function() { + setTimeout((function() { + var t = cc.sys; + t.browserType !== t.BROWSER_TYPE_WECHAT || t.os !== t.OS_IOS ? window.scrollTo(0, 0) : window.top && window.top.scrollTo(0, 0) + } + ), 800) + }, + _updateCameraMatrix: function() { + var t = this._delegate.node; + t.getWorldMatrix(this._worldMat); + var e = this._worldMat + , n = t._contentSize + , r = t._anchorPoint; + p.x = -r.x * n.width, + p.y = -r.y * n.height, + i.default.transform(e, e, p); + var s = cc.Camera.findCamera(t); + return !!s && (s.getWorldToScreenMatrix2D(this._cameraMat), + i.default.mul(this._cameraMat, this._cameraMat, e), + !0) + }, + _updateMatrix: function() { + if (this._updateCameraMatrix()) { + var t = this._cameraMat.m + , e = this._delegate.node + , i = cc.view; + if (this._m00 !== t[0] || this._m01 !== t[1] || this._m04 !== t[4] || this._m05 !== t[5] || this._m12 !== t[12] || this._m13 !== t[13] || this._w !== e._contentSize.width || this._h !== e._contentSize.height || !this._cacheViewportRect.equals(i._viewportRect)) { + this._m00 = t[0], + this._m01 = t[1], + this._m04 = t[4], + this._m05 = t[5], + this._m12 = t[12], + this._m13 = t[13], + this._w = e._contentSize.width, + this._h = e._contentSize.height, + this._cacheViewportRect.set(i._viewportRect); + var n = i._scaleX + , r = i._scaleY + , s = i._viewportRect + , a = i._devicePixelRatio; + n /= a, + r /= a; + var o = cc.game.container + , l = t[0] * n + , h = t[1] + , c = t[4] + , u = t[5] * r + , _ = o && o.style.paddingLeft && parseInt(o.style.paddingLeft); + _ += s.x / a; + var d = o && o.style.paddingBottom && parseInt(o.style.paddingBottom); + d += s.y / a; + var p = t[12] * n + _ + , m = t[13] * r + d; + f.zoomInvalid && (this.setSize(e.width * l, e.height * u), + l = 1, + u = 1); + var y = this._elem + , v = "matrix(" + l + "," + -h + "," + -c + "," + u + "," + p + "," + -m + ")"; + y.style.transform = v, + y.style["-webkit-transform"] = v, + y.style["transform-origin"] = "0px 100% 0px", + y.style["-webkit-transform-origin"] = "0px 100% 0px" + } + } + }, + _updateInputType: function() { + var t = this._delegate + , e = t.inputMode + , i = t.inputFlag + , n = t.returnType + , r = this._elem; + if (this._inputMode !== e || this._inputFlag !== i || this._returnType !== n) { + if (this._inputMode = e, + this._inputFlag = i, + this._returnType = n, + this._isTextArea) { + var s = "none"; + return i === u.INITIAL_CAPS_ALL_CHARACTERS ? s = "uppercase" : i === u.INITIAL_CAPS_WORD && (s = "capitalize"), + void (r.style.textTransform = s) + } + if (i === u.PASSWORD) + return r.type = "password", + void (r.style.textTransform = "none"); + var a = r.type; + e === c.EMAIL_ADDR ? a = "email" : e === c.NUMERIC || e === c.DECIMAL ? a = "number" : e === c.PHONE_NUMBER ? (a = "number", + r.pattern = "[0-9]*") : e === c.URL ? a = "url" : (a = "text", + n === _.SEARCH && (a = "search")), + r.type = a; + var o = "none"; + i === u.INITIAL_CAPS_ALL_CHARACTERS ? o = "uppercase" : i === u.INITIAL_CAPS_WORD && (o = "capitalize"), + r.style.textTransform = o + } + }, + _updateMaxLength: function() { + var t = this._delegate.maxLength; + t < 0 && (t = 65535), + this._elem.maxLength = t + }, + _initStyleSheet: function() { + var t = this._elem; + t.style.display = "none", + t.style.border = 0, + t.style.background = "transparent", + t.style.width = "100%", + t.style.height = "100%", + t.style.active = 0, + t.style.outline = "medium", + t.style.padding = "0", + t.style.textTransform = "none", + t.style.position = "absolute", + t.style.bottom = "0px", + t.style.left = "2px", + t.className = "cocosEditBox", + t.id = this._domId, + this._isTextArea ? (t.style.resize = "none", + t.style.overflow_y = "scroll") : (t.type = "text", + t.style["-moz-appearance"] = "textfield"), + this._placeholderStyleSheet = document.createElement("style") + }, + _updateStyleSheet: function() { + var t = this._delegate + , e = this._elem; + e.value = t.string, + e.placeholder = t.placeholder, + this._updateTextLabel(t.textLabel), + this._updatePlaceholderLabel(t.placeholderLabel) + }, + _updateTextLabel: function(t) { + if (t) { + var e = t.font; + e = !e || e instanceof cc.BitmapFont ? t.fontFamily : e._fontFamily; + var i = t.fontSize * t.node.scaleY; + if (this._textLabelFont !== e || this._textLabelFontSize !== i || this._textLabelFontColor !== t.fontColor || this._textLabelAlign !== t.horizontalAlign) { + this._textLabelFont = e, + this._textLabelFontSize = i, + this._textLabelFontColor = t.fontColor, + this._textLabelAlign = t.horizontalAlign; + var n = this._elem; + switch (n.style.fontSize = i + "px", + n.style.color = t.node.color.toCSS(), + n.style.fontFamily = e, + t.horizontalAlign) { + case a.HorizontalAlign.LEFT: + n.style.textAlign = "left"; + break; + case a.HorizontalAlign.CENTER: + n.style.textAlign = "center"; + break; + case a.HorizontalAlign.RIGHT: + n.style.textAlign = "right" + } + } + } + }, + _updatePlaceholderLabel: function(t) { + if (t) { + var e = t.font; + e = !e || e instanceof cc.BitmapFont ? t.fontFamily : t.font._fontFamily; + var i = t.fontSize * t.node.scaleY; + if (this._placeholderLabelFont !== e || this._placeholderLabelFontSize !== i || this._placeholderLabelFontColor !== t.fontColor || this._placeholderLabelAlign !== t.horizontalAlign || this._placeholderLineHeight !== t.fontSize) { + this._placeholderLabelFont = e, + this._placeholderLabelFontSize = i, + this._placeholderLabelFontColor = t.fontColor, + this._placeholderLabelAlign = t.horizontalAlign, + this._placeholderLineHeight = t.fontSize; + var n, r = this._placeholderStyleSheet, s = t.node.color.toCSS(), o = t.fontSize; + switch (t.horizontalAlign) { + case a.HorizontalAlign.LEFT: + n = "left"; + break; + case a.HorizontalAlign.CENTER: + n = "center"; + break; + case a.HorizontalAlign.RIGHT: + n = "right" + } + r.innerHTML = "#" + this._domId + "::-webkit-input-placeholder,#" + this._domId + "::-moz-placeholder,#" + this._domId + ":-ms-input-placeholder{text-transform: initial; font-family: " + e + "; font-size: " + i + "px; color: " + s + "; line-height: " + o + "px; text-align: " + n + ";}", + cc.sys.browserType === cc.sys.BROWSER_TYPE_EDGE && (r.innerHTML += "#" + this._domId + "::-ms-clear{display: none;}") + } + } + }, + _registerEventListeners: function() { + var t = this + , e = this._elem + , i = !1 + , n = this._eventListeners; + n.compositionStart = function() { + i = !0 + } + , + n.compositionEnd = function() { + i = !1, + t._delegate.editBoxTextChanged(e.value) + } + , + n.onInput = function() { + if (!i) { + var n = t._delegate.maxLength; + n >= 0 && (e.value = e.value.slice(0, n)), + t._delegate.editBoxTextChanged(e.value) + } + } + , + n.onClick = function() { + t._editing && cc.sys.isMobile && t._adjustWindowScroll() + } + , + n.onKeydown = function(i) { + i.keyCode === r.KEY.enter ? (i.stopPropagation(), + t._delegate.editBoxEditingReturn(), + t._isTextArea || e.blur()) : i.keyCode === r.KEY.tab && (i.stopPropagation(), + i.preventDefault(), + o.next(t)) + } + , + n.onBlur = function() { + cc.sys.isMobile && i && n.compositionEnd(), + t._editing = !1, + m = null, + t._hideDom(), + t._delegate.editBoxEditingDidEnded() + } + , + e.addEventListener("compositionstart", n.compositionStart), + e.addEventListener("compositionend", n.compositionEnd), + e.addEventListener("input", n.onInput), + e.addEventListener("keydown", n.onKeydown), + e.addEventListener("blur", n.onBlur), + e.addEventListener("touchstart", n.onClick) + }, + _removeEventListeners: function() { + var t = this._elem + , e = this._eventListeners; + t.removeEventListener("compositionstart", e.compositionStart), + t.removeEventListener("compositionend", e.compositionEnd), + t.removeEventListener("input", e.onInput), + t.removeEventListener("keydown", e.onKeydown), + t.removeEventListener("blur", e.onBlur), + t.removeEventListener("touchstart", e.onClick), + e.compositionStart = null, + e.compositionEnd = null, + e.onInput = null, + e.onKeydown = null, + e.onBlur = null, + e.onClick = null + } + }) + } + ), { + "../../platform/CCMacro": 198, + "../../platform/utils": 217, + "../../value-types/mat4": 284, + "../CCLabel": 107, + "./tabIndexUtil": 130, + "./types": 131 + }], + 130: [(function(t, e) { + "use strict"; + e.exports = { + _tabIndexList: [], + add: function(t) { + var e = this._tabIndexList; + -1 === e.indexOf(t) && e.push(t) + }, + remove: function(t) { + var e = this._tabIndexList + , i = e.indexOf(t); + -1 !== i && e.splice(i, 1) + }, + resort: function() { + this._tabIndexList.sort((function(t, e) { + return t._delegate._tabIndex - e._delegate._tabIndex + } + )) + }, + next: function(t) { + var e = this._tabIndexList + , i = e.indexOf(t); + if (t.setFocus(!1), + -1 !== i) { + var n = e[i + 1]; + n && n._delegate._tabIndex >= 0 && n.setFocus(!0) + } + } + } + } + ), {}], + 131: [(function(t, e) { + "use strict"; + var i = cc.Enum({ + DEFAULT: 0, + DONE: 1, + SEND: 2, + SEARCH: 3, + GO: 4, + NEXT: 5 + }) + , n = cc.Enum({ + ANY: 0, + EMAIL_ADDR: 1, + NUMERIC: 2, + PHONE_NUMBER: 3, + URL: 4, + DECIMAL: 5, + SINGLE_LINE: 6 + }) + , r = cc.Enum({ + PASSWORD: 0, + SENSITIVE: 1, + INITIAL_CAPS_WORD: 2, + INITIAL_CAPS_SENTENCE: 3, + INITIAL_CAPS_ALL_CHARACTERS: 4, + DEFAULT: 5 + }); + e.exports = { + KeyboardReturnType: i, + InputMode: n, + InputFlag: r + } + } + ), {}], + 132: [(function(t, e) { + "use strict"; + t("./CCComponent"), + t("./CCComponentEventHandler"), + t("./missing-script"); + var i = t("./SubContextView"); + i || (i = cc.Class({ + name: "cc.SubContextView", + extends: cc.Component + }), + cc.SubContextView = cc.WXSubContextView = cc.SwanSubContextView = i); + var n = [t("./CCSprite"), t("./CCWidget"), t("./CCCanvas"), t("./CCAudioSource"), t("./CCAnimation"), t("./CCButton"), t("./CCLabel"), t("./CCProgressBar"), t("./CCMask"), t("./CCScrollBar"), t("./CCScrollView"), t("./CCPageViewIndicator"), t("./CCPageView"), t("./CCSlider"), t("./CCLayout"), t("./editbox/CCEditBox"), t("./CCLabelOutline"), t("./CCLabelShadow"), t("./CCRichText"), t("./CCToggleContainer"), t("./CCToggleGroup"), t("./CCToggle"), t("./CCBlockInputEvents"), t("./CCMotionStreak"), t("./CCSafeArea"), i]; + e.exports = n + } + ), { + "./CCAnimation": 100, + "./CCAudioSource": 101, + "./CCBlockInputEvents": 102, + "./CCButton": 103, + "./CCCanvas": 104, + "./CCComponent": 105, + "./CCComponentEventHandler": 106, + "./CCLabel": 107, + "./CCLabelOutline": 108, + "./CCLabelShadow": 109, + "./CCLayout": 110, + "./CCMask": 111, + "./CCMotionStreak": void 0, + "./CCPageView": 112, + "./CCPageViewIndicator": 113, + "./CCProgressBar": 114, + "./CCRichText": 116, + "./CCSafeArea": void 0, + "./CCScrollBar": 117, + "./CCScrollView": 118, + "./CCSlider": 119, + "./CCSprite": 120, + "./CCToggle": 122, + "./CCToggleContainer": 123, + "./CCToggleGroup": 124, + "./CCWidget": 126, + "./SubContextView": void 0, + "./editbox/CCEditBox": 127, + "./missing-script": 133 + }], + 133: [(function(t, e) { + "use strict"; + var i = cc.js + , n = cc.Class({ + name: "cc.MissingScript", + extends: cc.Component, + editor: { + inspector: "packages://inspector/inspectors/comps/missing-script.js" + }, + properties: { + compiled: { + default: !1, + serializable: !1 + }, + _$erialized: { + default: null, + visible: !1, + editorOnly: !0 + } + }, + ctor: !1, + statics: { + safeFindClass: function(t) { + return i._getClassById(t) || (cc.deserialize.reportMissingClass(t), + n) + } + }, + onLoad: function() { + cc.warnID(4600, this.node.name) + } + }); + cc._MissingScript = e.exports = n + } + ), {}], + 134: [(function(t, e) { + "use strict"; + var i = cc.js; + t("../event/event"); + var n = function(t, e) { + cc.Event.call(this, cc.Event.MOUSE, e), + this._eventType = t, + this._button = 0, + this._x = 0, + this._y = 0, + this._prevX = 0, + this._prevY = 0, + this._scrollX = 0, + this._scrollY = 0 + }; + i.extend(n, cc.Event); + var r = n.prototype; + r.setScrollData = function(t, e) { + this._scrollX = t, + this._scrollY = e + } + , + r.getScrollX = function() { + return this._scrollX + } + , + r.getScrollY = function() { + return this._scrollY + } + , + r.setLocation = function(t, e) { + this._x = t, + this._y = e + } + , + r.getLocation = function() { + return cc.v2(this._x, this._y) + } + , + r.getLocationInView = function() { + return cc.v2(this._x, cc.view._designResolutionSize.height - this._y) + } + , + r._setPrevCursor = function(t, e) { + this._prevX = t, + this._prevY = e + } + , + r.getPreviousLocation = function() { + return cc.v2(this._prevX, this._prevY) + } + , + r.getDelta = function() { + return cc.v2(this._x - this._prevX, this._y - this._prevY) + } + , + r.getDeltaX = function() { + return this._x - this._prevX + } + , + r.getDeltaY = function() { + return this._y - this._prevY + } + , + r.setButton = function(t) { + this._button = t + } + , + r.getButton = function() { + return this._button + } + , + r.getLocationX = function() { + return this._x + } + , + r.getLocationY = function() { + return this._y + } + , + n.NONE = 0, + n.DOWN = 1, + n.UP = 2, + n.MOVE = 3, + n.SCROLL = 4, + n.BUTTON_LEFT = 0, + n.BUTTON_RIGHT = 2, + n.BUTTON_MIDDLE = 1, + n.BUTTON_4 = 3, + n.BUTTON_5 = 4, + n.BUTTON_6 = 5, + n.BUTTON_7 = 6, + n.BUTTON_8 = 7; + var s = function(t, e) { + cc.Event.call(this, cc.Event.TOUCH, e), + this._eventCode = 0, + this._touches = t || [], + this.touch = null, + this.currentTouch = null + }; + i.extend(s, cc.Event), + (r = s.prototype).getEventCode = function() { + return this._eventCode + } + , + r.getTouches = function() { + return this._touches + } + , + r._setEventCode = function(t) { + this._eventCode = t + } + , + r._setTouches = function(t) { + this._touches = t + } + , + r.setLocation = function(t, e) { + this.touch && this.touch.setTouchInfo(this.touch.getID(), t, e) + } + , + r.getLocation = function() { + return this.touch ? this.touch.getLocation() : cc.v2() + } + , + r.getLocationInView = function() { + return this.touch ? this.touch.getLocationInView() : cc.v2() + } + , + r.getPreviousLocation = function() { + return this.touch ? this.touch.getPreviousLocation() : cc.v2() + } + , + r.getStartLocation = function() { + return this.touch ? this.touch.getStartLocation() : cc.v2() + } + , + r.getID = function() { + return this.touch ? this.touch.getID() : null + } + , + r.getDelta = function() { + return this.touch ? this.touch.getDelta() : cc.v2() + } + , + r.getDeltaX = function() { + return this.touch ? this.touch.getDelta().x : 0 + } + , + r.getDeltaY = function() { + return this.touch ? this.touch.getDelta().y : 0 + } + , + r.getLocationX = function() { + return this.touch ? this.touch.getLocationX() : 0 + } + , + r.getLocationY = function() { + return this.touch ? this.touch.getLocationY() : 0 + } + , + s.MAX_TOUCHES = 5, + s.BEGAN = 0, + s.MOVED = 1, + s.ENDED = 2, + s.CANCELED = 3; + var a = function(t, e) { + cc.Event.call(this, cc.Event.ACCELERATION, e), + this.acc = t + }; + i.extend(a, cc.Event); + var o = function(t, e, i) { + cc.Event.call(this, cc.Event.KEYBOARD, i), + this.keyCode = t, + this.isPressed = e + }; + i.extend(o, cc.Event), + cc.Event.EventMouse = n, + cc.Event.EventTouch = s, + cc.Event.EventAcceleration = a, + cc.Event.EventKeyboard = o, + e.exports = cc.Event + } + ), { + "../event/event": 141 + }], + 135: [(function(t, e) { + "use strict"; + var i = t("../platform/js"); + cc.EventListener = function(t, e, i) { + this._onEvent = i, + this._type = t || 0, + this._listenerID = e || "", + this._registered = !1, + this._fixedPriority = 0, + this._node = null, + this._target = null, + this._paused = !0, + this._isEnabled = !0 + } + , + cc.EventListener.prototype = { + constructor: cc.EventListener, + _setPaused: function(t) { + this._paused = t + }, + _isPaused: function() { + return this._paused + }, + _setRegistered: function(t) { + this._registered = t + }, + _isRegistered: function() { + return this._registered + }, + _getType: function() { + return this._type + }, + _getListenerID: function() { + return this._listenerID + }, + _setFixedPriority: function(t) { + this._fixedPriority = t + }, + _getFixedPriority: function() { + return this._fixedPriority + }, + _setSceneGraphPriority: function(t) { + this._target = t, + this._node = t + }, + _getSceneGraphPriority: function() { + return this._node + }, + checkAvailable: function() { + return null !== this._onEvent + }, + clone: function() { + return null + }, + setEnabled: function(t) { + this._isEnabled = t + }, + isEnabled: function() { + return this._isEnabled + }, + retain: function() {}, + release: function() {} + }, + cc.EventListener.UNKNOWN = 0, + cc.EventListener.TOUCH_ONE_BY_ONE = 1, + cc.EventListener.TOUCH_ALL_AT_ONCE = 2, + cc.EventListener.KEYBOARD = 3, + cc.EventListener.MOUSE = 4, + cc.EventListener.ACCELERATION = 6, + cc.EventListener.CUSTOM = 8; + var n = cc.EventListener.ListenerID = { + MOUSE: "__cc_mouse", + TOUCH_ONE_BY_ONE: "__cc_touch_one_by_one", + TOUCH_ALL_AT_ONCE: "__cc_touch_all_at_once", + KEYBOARD: "__cc_keyboard", + ACCELERATION: "__cc_acceleration" + } + , r = function(t, e) { + this._onCustomEvent = e, + cc.EventListener.call(this, cc.EventListener.CUSTOM, t, this._callback) + }; + i.extend(r, cc.EventListener), + i.mixin(r.prototype, { + _onCustomEvent: null, + _callback: function(t) { + null !== this._onCustomEvent && this._onCustomEvent(t) + }, + checkAvailable: function() { + return cc.EventListener.prototype.checkAvailable.call(this) && null !== this._onCustomEvent + }, + clone: function() { + return new r(this._listenerID,this._onCustomEvent) + } + }); + var s = function() { + cc.EventListener.call(this, cc.EventListener.MOUSE, n.MOUSE, this._callback) + }; + i.extend(s, cc.EventListener), + i.mixin(s.prototype, { + onMouseDown: null, + onMouseUp: null, + onMouseMove: null, + onMouseScroll: null, + _callback: function(t) { + var e = cc.Event.EventMouse; + switch (t._eventType) { + case e.DOWN: + this.onMouseDown && this.onMouseDown(t); + break; + case e.UP: + this.onMouseUp && this.onMouseUp(t); + break; + case e.MOVE: + this.onMouseMove && this.onMouseMove(t); + break; + case e.SCROLL: + this.onMouseScroll && this.onMouseScroll(t) + } + }, + clone: function() { + var t = new s; + return t.onMouseDown = this.onMouseDown, + t.onMouseUp = this.onMouseUp, + t.onMouseMove = this.onMouseMove, + t.onMouseScroll = this.onMouseScroll, + t + }, + checkAvailable: function() { + return !0 + } + }); + var a = function() { + cc.EventListener.call(this, cc.EventListener.TOUCH_ONE_BY_ONE, n.TOUCH_ONE_BY_ONE, null), + this._claimedTouches = [] + }; + i.extend(a, cc.EventListener), + i.mixin(a.prototype, { + constructor: a, + _claimedTouches: null, + swallowTouches: !1, + onTouchBegan: null, + onTouchMoved: null, + onTouchEnded: null, + onTouchCancelled: null, + setSwallowTouches: function(t) { + this.swallowTouches = t + }, + isSwallowTouches: function() { + return this.swallowTouches + }, + clone: function() { + var t = new a; + return t.onTouchBegan = this.onTouchBegan, + t.onTouchMoved = this.onTouchMoved, + t.onTouchEnded = this.onTouchEnded, + t.onTouchCancelled = this.onTouchCancelled, + t.swallowTouches = this.swallowTouches, + t + }, + checkAvailable: function() { + return !!this.onTouchBegan || (cc.logID(1801), + !1) + } + }); + var o = function() { + cc.EventListener.call(this, cc.EventListener.TOUCH_ALL_AT_ONCE, n.TOUCH_ALL_AT_ONCE, null) + }; + i.extend(o, cc.EventListener), + i.mixin(o.prototype, { + constructor: o, + onTouchesBegan: null, + onTouchesMoved: null, + onTouchesEnded: null, + onTouchesCancelled: null, + clone: function() { + var t = new o; + return t.onTouchesBegan = this.onTouchesBegan, + t.onTouchesMoved = this.onTouchesMoved, + t.onTouchesEnded = this.onTouchesEnded, + t.onTouchesCancelled = this.onTouchesCancelled, + t + }, + checkAvailable: function() { + return null !== this.onTouchesBegan || null !== this.onTouchesMoved || null !== this.onTouchesEnded || null !== this.onTouchesCancelled || (cc.logID(1802), + !1) + } + }); + var l = function(t) { + this._onAccelerationEvent = t, + cc.EventListener.call(this, cc.EventListener.ACCELERATION, n.ACCELERATION, this._callback) + }; + i.extend(l, cc.EventListener), + i.mixin(l.prototype, { + constructor: l, + _onAccelerationEvent: null, + _callback: function(t) { + this._onAccelerationEvent(t.acc, t) + }, + checkAvailable: function() { + return cc.assertID(this._onAccelerationEvent, 1803), + !0 + }, + clone: function() { + return new l(this._onAccelerationEvent) + } + }); + var h = function() { + cc.EventListener.call(this, cc.EventListener.KEYBOARD, n.KEYBOARD, this._callback) + }; + i.extend(h, cc.EventListener), + i.mixin(h.prototype, { + constructor: h, + onKeyPressed: null, + onKeyReleased: null, + _callback: function(t) { + t.isPressed ? this.onKeyPressed && this.onKeyPressed(t.keyCode, t) : this.onKeyReleased && this.onKeyReleased(t.keyCode, t) + }, + clone: function() { + var t = new h; + return t.onKeyPressed = this.onKeyPressed, + t.onKeyReleased = this.onKeyReleased, + t + }, + checkAvailable: function() { + return null !== this.onKeyPressed || null !== this.onKeyReleased || (cc.logID(1800), + !1) + } + }), + cc.EventListener.create = function(t) { + cc.assertID(t && t.event, 1900); + var e = t.event; + delete t.event; + var i = null; + for (var n in e === cc.EventListener.TOUCH_ONE_BY_ONE ? i = new a : e === cc.EventListener.TOUCH_ALL_AT_ONCE ? i = new o : e === cc.EventListener.MOUSE ? i = new s : e === cc.EventListener.CUSTOM ? (i = new r(t.eventName,t.callback), + delete t.eventName, + delete t.callback) : e === cc.EventListener.KEYBOARD ? i = new h : e === cc.EventListener.ACCELERATION && (i = new l(t.callback), + delete t.callback), + t) + i[n] = t[n]; + return i + } + , + e.exports = cc.EventListener + } + ), { + "../platform/js": 214 + }], + 136: [(function(t, e) { + "use strict"; + var i = t("../platform/js"); + t("./CCEventListener"); + var n = cc.EventListener.ListenerID + , r = function() { + this._fixedListeners = [], + this._sceneGraphListeners = [], + this.gt0Index = 0 + }; + r.prototype = { + constructor: r, + size: function() { + return this._fixedListeners.length + this._sceneGraphListeners.length + }, + empty: function() { + return 0 === this._fixedListeners.length && 0 === this._sceneGraphListeners.length + }, + push: function(t) { + 0 === t._getFixedPriority() ? this._sceneGraphListeners.push(t) : this._fixedListeners.push(t) + }, + clearSceneGraphListeners: function() { + this._sceneGraphListeners.length = 0 + }, + clearFixedListeners: function() { + this._fixedListeners.length = 0 + }, + clear: function() { + this._sceneGraphListeners.length = 0, + this._fixedListeners.length = 0 + }, + getFixedPriorityListeners: function() { + return this._fixedListeners + }, + getSceneGraphPriorityListeners: function() { + return this._sceneGraphListeners + } + }; + var s = function(t) { + var e = cc.Event + , i = t.type; + return i === e.ACCELERATION ? n.ACCELERATION : i === e.KEYBOARD ? n.KEYBOARD : i.startsWith(e.MOUSE) ? n.MOUSE : (i.startsWith(e.TOUCH) && cc.logID(2e3), + "") + } + , a = { + DIRTY_NONE: 0, + DIRTY_FIXED_PRIORITY: 1, + DIRTY_SCENE_GRAPH_PRIORITY: 2, + DIRTY_ALL: 3, + _listenersMap: {}, + _priorityDirtyFlagMap: {}, + _nodeListenersMap: {}, + _toAddedListeners: [], + _toRemovedListeners: [], + _dirtyListeners: {}, + _inDispatch: 0, + _isEnabled: !1, + _currentTouch: null, + _currentTouchListener: null, + _internalCustomListenerIDs: [], + _setDirtyForNode: function(t) { + var e = this._nodeListenersMap[t._id]; + if (void 0 !== e) + for (var i = 0, n = e.length; i < n; i++) { + var r = e[i]._getListenerID(); + null == this._dirtyListeners[r] && (this._dirtyListeners[r] = !0) + } + if (t.childrenCount > 0) + for (var s = t._children, a = 0, o = s.length; a < o; a++) + this._setDirtyForNode(s[a]) + }, + pauseTarget: function(t, e) { + if (t instanceof cc._BaseNode) { + var i, n, r = this._nodeListenersMap[t._id]; + if (r) + for (i = 0, + n = r.length; i < n; i++) + r[i]._setPaused(!0); + if (!0 === e) { + var s = t._children; + for (i = 0, + n = s ? s.length : 0; i < n; i++) + this.pauseTarget(s[i], !0) + } + } else + cc.warnID(3506) + }, + resumeTarget: function(t, e) { + if (t instanceof cc._BaseNode) { + var i, n, r = this._nodeListenersMap[t._id]; + if (r) + for (i = 0, + n = r.length; i < n; i++) + r[i]._setPaused(!1); + if (this._setDirtyForNode(t), + !0 === e) { + var s = t._children; + for (i = 0, + n = s ? s.length : 0; i < n; i++) + this.resumeTarget(s[i], !0) + } + } else + cc.warnID(3506) + }, + _addListener: function(t) { + 0 === this._inDispatch ? this._forceAddEventListener(t) : this._toAddedListeners.push(t) + }, + _forceAddEventListener: function(t) { + var e = t._getListenerID() + , i = this._listenersMap[e]; + if (i || (i = new r, + this._listenersMap[e] = i), + i.push(t), + 0 === t._getFixedPriority()) { + this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY); + var n = t._getSceneGraphPriority(); + null === n && cc.logID(3507), + this._associateNodeAndEventListener(n, t), + n.activeInHierarchy && this.resumeTarget(n) + } else + this._setDirty(e, this.DIRTY_FIXED_PRIORITY) + }, + _getListeners: function(t) { + return this._listenersMap[t] + }, + _updateDirtyFlagForSceneGraph: function() { + var t = this._dirtyListeners; + for (var e in t) + this._setDirty(e, this.DIRTY_SCENE_GRAPH_PRIORITY); + this._dirtyListeners = {} + }, + _removeAllListenersInVector: function(t) { + if (t) + for (var e, i = t.length - 1; i >= 0; i--) + (e = t[i])._setRegistered(!1), + null != e._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(e._getSceneGraphPriority(), e), + e._setSceneGraphPriority(null)), + 0 === this._inDispatch && cc.js.array.removeAt(t, i) + }, + _removeListenersForListenerID: function(t) { + var e, i = this._listenersMap[t]; + if (i) { + var n = i.getFixedPriorityListeners() + , r = i.getSceneGraphPriorityListeners(); + this._removeAllListenersInVector(r), + this._removeAllListenersInVector(n), + delete this._priorityDirtyFlagMap[t], + this._inDispatch || (i.clear(), + delete this._listenersMap[t]) + } + var s, a = this._toAddedListeners; + for (e = a.length - 1; e >= 0; e--) + (s = a[e]) && s._getListenerID() === t && cc.js.array.removeAt(a, e) + }, + _sortEventListeners: function(t) { + var e = this.DIRTY_NONE + , i = this._priorityDirtyFlagMap; + i[t] && (e = i[t]), + e !== this.DIRTY_NONE && (i[t] = this.DIRTY_NONE, + e & this.DIRTY_FIXED_PRIORITY && this._sortListenersOfFixedPriority(t), + e & this.DIRTY_SCENE_GRAPH_PRIORITY && cc.director.getScene() && this._sortListenersOfSceneGraphPriority(t)) + }, + _sortListenersOfSceneGraphPriority: function(t) { + var e = this._getListeners(t); + if (e) { + var i = e.getSceneGraphPriorityListeners(); + i && 0 !== i.length && e.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes) + } + }, + _sortEventListenersOfSceneGraphPriorityDes: function(t, e) { + var i = t._getSceneGraphPriority() + , n = e._getSceneGraphPriority(); + if (!(e && n && n._activeInHierarchy && null !== n._parent)) + return -1; + if (!t || !i || !i._activeInHierarchy || null === i._parent) + return 1; + for (var r = i, s = n, a = !1; r._parent._id !== s._parent._id; ) + r = null === r._parent._parent ? (a = !0) && n : r._parent, + s = null === s._parent._parent ? (a = !0) && i : s._parent; + if (r._id === s._id) { + if (r._id === n._id) + return -1; + if (r._id === i._id) + return 1 + } + return a ? r._localZOrder - s._localZOrder : s._localZOrder - r._localZOrder + }, + _sortListenersOfFixedPriority: function(t) { + var e = this._listenersMap[t]; + if (e) { + var i = e.getFixedPriorityListeners(); + if (i && 0 !== i.length) { + i.sort(this._sortListenersOfFixedPriorityAsc); + for (var n = 0, r = i.length; n < r && !(i[n]._getFixedPriority() >= 0); ) + ++n; + e.gt0Index = n + } + } + }, + _sortListenersOfFixedPriorityAsc: function(t, e) { + return t._getFixedPriority() - e._getFixedPriority() + }, + _onUpdateListeners: function(t) { + var e, i, n, r = t.getFixedPriorityListeners(), s = t.getSceneGraphPriorityListeners(), a = this._toRemovedListeners; + if (s) + for (e = s.length - 1; e >= 0; e--) + (i = s[e])._isRegistered() || (cc.js.array.removeAt(s, e), + -1 !== (n = a.indexOf(i)) && a.splice(n, 1)); + if (r) + for (e = r.length - 1; e >= 0; e--) + (i = r[e])._isRegistered() || (cc.js.array.removeAt(r, e), + -1 !== (n = a.indexOf(i)) && a.splice(n, 1)); + s && 0 === s.length && t.clearSceneGraphListeners(), + r && 0 === r.length && t.clearFixedListeners() + }, + frameUpdateListeners: function() { + var t = this._listenersMap + , e = this._priorityDirtyFlagMap; + for (var i in t) + t[i].empty() && (delete e[i], + delete t[i]); + var n = this._toAddedListeners; + if (0 !== n.length) { + for (var r = 0, s = n.length; r < s; r++) + this._forceAddEventListener(n[r]); + n.length = 0 + } + 0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners() + }, + _updateTouchListeners: function() { + var t = this._inDispatch; + if (cc.assertID(t > 0, 3508), + !(t > 1)) { + var e; + (e = this._listenersMap[n.TOUCH_ONE_BY_ONE]) && this._onUpdateListeners(e), + (e = this._listenersMap[n.TOUCH_ALL_AT_ONCE]) && this._onUpdateListeners(e), + cc.assertID(1 === t, 3509); + var i = this._toAddedListeners; + if (0 !== i.length) { + for (var r = 0, s = i.length; r < s; r++) + this._forceAddEventListener(i[r]); + this._toAddedListeners.length = 0 + } + 0 !== this._toRemovedListeners.length && this._cleanToRemovedListeners() + } + }, + _cleanToRemovedListeners: function() { + for (var t = this._toRemovedListeners, e = 0; e < t.length; e++) { + var i = t[e] + , n = this._listenersMap[i._getListenerID()]; + if (n) { + var r, s = n.getFixedPriorityListeners(), a = n.getSceneGraphPriorityListeners(); + a && -1 !== (r = a.indexOf(i)) && a.splice(r, 1), + s && -1 !== (r = s.indexOf(i)) && s.splice(r, 1) + } + } + t.length = 0 + }, + _onTouchEventCallback: function(t, e) { + if (!t._isRegistered()) + return !1; + var i = e.event + , n = i.currentTouch; + i.currentTarget = t._node; + var r, s = !1, o = i.getEventCode(), l = cc.Event.EventTouch; + if (o === l.BEGAN) { + if (!cc.macro.ENABLE_MULTI_TOUCH && a._currentTouch) { + var h = a._currentTouchListener._node; + if (h && h.activeInHierarchy) + return !1 + } + t.onTouchBegan && (s = t.onTouchBegan(n, i)) && t._registered && (t._claimedTouches.push(n), + a._currentTouchListener = t, + a._currentTouch = n) + } else if (t._claimedTouches.length > 0 && -1 !== (r = t._claimedTouches.indexOf(n))) { + if (s = !0, + !cc.macro.ENABLE_MULTI_TOUCH && a._currentTouch && a._currentTouch !== n) + return !1; + o === l.MOVED && t.onTouchMoved ? t.onTouchMoved(n, i) : o === l.ENDED ? (t.onTouchEnded && t.onTouchEnded(n, i), + t._registered && t._claimedTouches.splice(r, 1), + a._clearCurTouch()) : o === l.CANCELED && (t.onTouchCancelled && t.onTouchCancelled(n, i), + t._registered && t._claimedTouches.splice(r, 1), + a._clearCurTouch()) + } + return i.isStopped() ? (a._updateTouchListeners(i), + !0) : !(!s || !t.swallowTouches || (e.needsMutableSet && e.touches.splice(n, 1), + 0)) + }, + _dispatchTouchEvent: function(t) { + this._sortEventListeners(n.TOUCH_ONE_BY_ONE), + this._sortEventListeners(n.TOUCH_ALL_AT_ONCE); + var e = this._getListeners(n.TOUCH_ONE_BY_ONE) + , i = this._getListeners(n.TOUCH_ALL_AT_ONCE); + if (null !== e || null !== i) { + var r = t.getTouches() + , s = cc.js.array.copy(r) + , a = { + event: t, + needsMutableSet: e && i, + touches: s, + selTouch: null + }; + if (e) + for (var o = 0; o < r.length; o++) + t.currentTouch = r[o], + t._propagationStopped = t._propagationImmediateStopped = !1, + this._dispatchEventToListeners(e, this._onTouchEventCallback, a); + i && s.length > 0 && (this._dispatchEventToListeners(i, this._onTouchesEventCallback, { + event: t, + touches: s + }), + t.isStopped()) || this._updateTouchListeners(t) + } + }, + _onTouchesEventCallback: function(t, e) { + if (!t._registered) + return !1; + var i = cc.Event.EventTouch + , n = e.event + , r = e.touches + , s = n.getEventCode(); + return n.currentTarget = t._node, + s === i.BEGAN && t.onTouchesBegan ? t.onTouchesBegan(r, n) : s === i.MOVED && t.onTouchesMoved ? t.onTouchesMoved(r, n) : s === i.ENDED && t.onTouchesEnded ? t.onTouchesEnded(r, n) : s === i.CANCELED && t.onTouchesCancelled && t.onTouchesCancelled(r, n), + !!n.isStopped() && (a._updateTouchListeners(n), + !0) + }, + _associateNodeAndEventListener: function(t, e) { + var i = this._nodeListenersMap[t._id]; + i || (i = [], + this._nodeListenersMap[t._id] = i), + i.push(e) + }, + _dissociateNodeAndEventListener: function(t, e) { + var i = this._nodeListenersMap[t._id]; + i && (cc.js.array.remove(i, e), + 0 === i.length && delete this._nodeListenersMap[t._id]) + }, + _dispatchEventToListeners: function(t, e, i) { + var n, r, s = !1, a = t.getFixedPriorityListeners(), o = t.getSceneGraphPriorityListeners(), l = 0; + if (a && 0 !== a.length) + for (; l < t.gt0Index; ++l) + if ((r = a[l]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) { + s = !0; + break + } + if (o && !s) + for (n = 0; n < o.length; n++) + if ((r = o[n]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) { + s = !0; + break + } + if (a && !s) + for (; l < a.length; ++l) + if ((r = a[l]).isEnabled() && !r._isPaused() && r._isRegistered() && e(r, i)) { + s = !0; + break + } + }, + _setDirty: function(t, e) { + var i = this._priorityDirtyFlagMap; + null == i[t] ? i[t] = e : i[t] = e | i[t] + }, + _sortNumberAsc: function(t, e) { + return t - e + }, + hasEventListener: function(t) { + return !!this._getListeners(t) + }, + addListener: function(t, e) { + if (cc.assertID(t && e, 3503), + cc.js.isNumber(e) || e instanceof cc._BaseNode) { + if (t instanceof cc.EventListener) { + if (t._isRegistered()) + return void cc.logID(3505) + } else + cc.assertID(!cc.js.isNumber(e), 3504), + t = cc.EventListener.create(t); + if (t.checkAvailable()) { + if (cc.js.isNumber(e)) { + if (0 === e) + return void cc.logID(3500); + t._setSceneGraphPriority(null), + t._setFixedPriority(e), + t._setRegistered(!0), + t._setPaused(!1), + this._addListener(t) + } else + t._setSceneGraphPriority(e), + t._setFixedPriority(0), + t._setRegistered(!0), + this._addListener(t); + return t + } + } else + cc.warnID(3506) + }, + addCustomListener: function(t, e) { + var i = new cc.EventListener.create({ + event: cc.EventListener.CUSTOM, + eventName: t, + callback: e + }); + return this.addListener(i, 1), + i + }, + removeListener: function(t) { + if (null != t) { + var e, i = this._listenersMap; + for (var n in i) { + var r = i[n] + , s = r.getFixedPriorityListeners() + , a = r.getSceneGraphPriorityListeners(); + if ((e = this._removeListenerInVector(a, t)) ? this._setDirty(t._getListenerID(), this.DIRTY_SCENE_GRAPH_PRIORITY) : (e = this._removeListenerInVector(s, t)) && this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY), + r.empty() && (delete this._priorityDirtyFlagMap[t._getListenerID()], + delete i[n]), + e) + break + } + if (!e) + for (var o = this._toAddedListeners, l = o.length - 1; l >= 0; l--) { + var h = o[l]; + if (h === t) { + cc.js.array.removeAt(o, l), + h._setRegistered(!1); + break + } + } + this._currentTouchListener === t && this._clearCurTouch() + } + }, + _clearCurTouch: function() { + this._currentTouchListener = null, + this._currentTouch = null + }, + _removeListenerInCallback: function(t, e) { + if (null == t) + return !1; + for (var i = t.length - 1; i >= 0; i--) { + var n = t[i]; + if (n._onCustomEvent === e || n._onEvent === e) + return n._setRegistered(!1), + null != n._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n), + n._setSceneGraphPriority(null)), + 0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n), + !0 + } + return !1 + }, + _removeListenerInVector: function(t, e) { + if (null == t) + return !1; + for (var i = t.length - 1; i >= 0; i--) { + var n = t[i]; + if (n === e) + return n._setRegistered(!1), + null != n._getSceneGraphPriority() && (this._dissociateNodeAndEventListener(n._getSceneGraphPriority(), n), + n._setSceneGraphPriority(null)), + 0 === this._inDispatch ? cc.js.array.removeAt(t, i) : this._toRemovedListeners.push(n), + !0 + } + return !1 + }, + removeListeners: function(t, e) { + var i = this; + if (cc.js.isNumber(t) || t instanceof cc._BaseNode) + if (void 0 !== t._id) { + var r, s = i._nodeListenersMap[t._id]; + if (s) { + var a = cc.js.array.copy(s); + for (r = 0; r < a.length; r++) + i.removeListener(a[r]); + delete i._nodeListenersMap[t._id] + } + var o = i._toAddedListeners; + for (r = 0; r < o.length; ) { + var l = o[r]; + l._getSceneGraphPriority() === t ? (l._setSceneGraphPriority(null), + l._setRegistered(!1), + o.splice(r, 1)) : ++r + } + if (!0 === e) { + var h, c = t.children; + for (r = 0, + h = c.length; r < h; r++) + i.removeListeners(c[r], !0) + } + } else + t === cc.EventListener.TOUCH_ONE_BY_ONE ? i._removeListenersForListenerID(n.TOUCH_ONE_BY_ONE) : t === cc.EventListener.TOUCH_ALL_AT_ONCE ? i._removeListenersForListenerID(n.TOUCH_ALL_AT_ONCE) : t === cc.EventListener.MOUSE ? i._removeListenersForListenerID(n.MOUSE) : t === cc.EventListener.ACCELERATION ? i._removeListenersForListenerID(n.ACCELERATION) : t === cc.EventListener.KEYBOARD ? i._removeListenersForListenerID(n.KEYBOARD) : cc.logID(3501); + else + cc.warnID(3506) + }, + removeCustomListeners: function(t) { + this._removeListenersForListenerID(t) + }, + removeAllListeners: function() { + var t = this._listenersMap + , e = this._internalCustomListenerIDs; + for (var i in t) + -1 === e.indexOf(i) && this._removeListenersForListenerID(i) + }, + setPriority: function(t, e) { + if (null != t) { + var i = this._listenersMap; + for (var n in i) { + var r = i[n].getFixedPriorityListeners(); + if (r && -1 !== r.indexOf(t)) + return null != t._getSceneGraphPriority() && cc.logID(3502), + void (t._getFixedPriority() !== e && (t._setFixedPriority(e), + this._setDirty(t._getListenerID(), this.DIRTY_FIXED_PRIORITY))) + } + } + }, + setEnabled: function(t) { + this._isEnabled = t + }, + isEnabled: function() { + return this._isEnabled + }, + dispatchEvent: function(t) { + if (this._isEnabled) + if (this._updateDirtyFlagForSceneGraph(), + this._inDispatch++, + t && t.getType) { + if (t.getType().startsWith(cc.Event.TOUCH)) + return this._dispatchTouchEvent(t), + void this._inDispatch--; + var e = s(t); + this._sortEventListeners(e); + var i = this._listenersMap[e]; + null != i && (this._dispatchEventToListeners(i, this._onListenerCallback, t), + this._onUpdateListeners(i)), + this._inDispatch-- + } else + cc.errorID(3511) + }, + _onListenerCallback: function(t, e) { + return e.currentTarget = t._target, + t._onEvent(e), + e.isStopped() + }, + dispatchCustomEvent: function(t, e) { + var i = new cc.Event.EventCustom(t); + i.setUserData(e), + this.dispatchEvent(i) + } + }; + i.get(cc, "eventManager", (function() { + return cc.errorID(1405, "cc.eventManager", "cc.EventTarget or cc.systemEvent"), + a + } + )), + e.exports = cc.internal.eventManager = a + } + ), { + "../platform/js": 214, + "./CCEventListener": 135 + }], + 137: [(function() { + "use strict"; + cc.Touch = function(t, e, i) { + this._lastModified = 0, + this.setTouchInfo(i, t, e) + } + , + cc.Touch.prototype = { + constructor: cc.Touch, + getLocation: function() { + return cc.v2(this._point.x, this._point.y) + }, + getLocationX: function() { + return this._point.x + }, + getLocationY: function() { + return this._point.y + }, + getPreviousLocation: function() { + return cc.v2(this._prevPoint.x, this._prevPoint.y) + }, + getStartLocation: function() { + return cc.v2(this._startPoint.x, this._startPoint.y) + }, + getDelta: function() { + return this._point.sub(this._prevPoint) + }, + getLocationInView: function() { + return cc.v2(this._point.x, cc.view._designResolutionSize.height - this._point.y) + }, + getPreviousLocationInView: function() { + return cc.v2(this._prevPoint.x, cc.view._designResolutionSize.height - this._prevPoint.y) + }, + getStartLocationInView: function() { + return cc.v2(this._startPoint.x, cc.view._designResolutionSize.height - this._startPoint.y) + }, + getID: function() { + return this._id + }, + setTouchInfo: function(t, e, i) { + this._prevPoint = this._point, + this._point = cc.v2(e || 0, i || 0), + this._id = t, + this._startPointCaptured || (this._startPoint = cc.v2(this._point), + cc.view._convertPointWithScale(this._startPoint), + this._startPointCaptured = !0) + }, + _setPoint: function(t, e) { + void 0 === e ? (this._point.x = t.x, + this._point.y = t.y) : (this._point.x = t, + this._point.y = e) + }, + _setPrevPoint: function(t, e) { + this._prevPoint = void 0 === e ? cc.v2(t.x, t.y) : cc.v2(t || 0, e || 0) + } + } + } + ), {}], + 138: [(function(t, e) { + "use strict"; + t("./CCEvent"), + t("./CCTouch"), + t("./CCEventListener"); + var i = t("./CCEventManager"); + e.exports = i + } + ), { + "./CCEvent": 134, + "./CCEventListener": 135, + "./CCEventManager": 136, + "./CCTouch": 137 + }], + 139: [(function(t, e) { + "use strict"; + var i = cc.js + , n = t("../platform/callbacks-invoker"); + function r() { + n.call(this) + } + i.extend(r, n), + r.prototype.emit = function(t, e) { + var i = t.type + , n = this._callbackTable[i]; + if (n) { + var r = !n.isInvoking; + n.isInvoking = !0; + for (var s = n.callbackInfos, a = 0, o = s.length; a < o; ++a) { + var l = s[a]; + if (l && l.callback && (l.callback.call(l.target, t, e), + t._propagationImmediateStopped)) + break + } + r && (n.isInvoking = !1, + n.containCanceled && n.purgeCanceled()) + } + } + , + e.exports = r + } + ), { + "../platform/callbacks-invoker": 206 + }], + 140: [(function(t, e) { + "use strict"; + var i = t("../platform/js") + , n = t("../platform/callbacks-invoker") + , r = i.array.fastRemove; + function s() { + n.call(this) + } + i.extend(s, n); + var a = s.prototype; + a.__on = a.on, + a.on = function(t, e, i, n) { + if (e) + return this.hasEventListener(t, e, i) || (this.__on(t, e, i, n), + i && i.__eventTargets && i.__eventTargets.push(this)), + e; + cc.errorID(6800) + } + , + a.__off = a.off, + a.off = function(t, e, i) { + if (e) + this.__off(t, e, i), + i && i.__eventTargets && r(i.__eventTargets, this); + else { + var n = this._callbackTable[t]; + if (!n) + return; + for (var s = n.callbackInfos, a = 0; a < s.length; ++a) { + var o = s[a] && s[a].target; + o && o.__eventTargets && r(o.__eventTargets, this) + } + this.removeAll(t) + } + } + , + a.targetOff = function(t) { + this.removeAll(t), + t && t.__eventTargets && r(t.__eventTargets, this) + } + , + a.once = function(t, e, i) { + this.on(t, e, i, !0) + } + , + a.dispatchEvent = function(t) { + this.emit(t.type, t) + } + , + a.clear = function() { + for (var t in this._callbackTable) + for (var e = this._callbackTable[t].callbackInfos, i = e.length - 1; i >= 0; i--) { + var n = e[i]; + n && this.off(t, n.callback, n.target) + } + } + , + cc.EventTarget = e.exports = s + } + ), { + "../platform/callbacks-invoker": 206, + "../platform/js": 214 + }], + 141: [(function(t, e) { + "use strict"; + var i = t("../platform/js"); + cc.Event = function(t, e) { + this.type = t, + this.bubbles = !!e, + this.target = null, + this.currentTarget = null, + this.eventPhase = 0, + this._propagationStopped = !1, + this._propagationImmediateStopped = !1 + } + , + cc.Event.prototype = { + constructor: cc.Event, + unuse: function() { + this.type = cc.Event.NO_TYPE, + this.target = null, + this.currentTarget = null, + this.eventPhase = cc.Event.NONE, + this._propagationStopped = !1, + this._propagationImmediateStopped = !1 + }, + reuse: function(t, e) { + this.type = t, + this.bubbles = e || !1 + }, + stopPropagation: function() { + this._propagationStopped = !0 + }, + stopPropagationImmediate: function() { + this._propagationImmediateStopped = !0 + }, + isStopped: function() { + return this._propagationStopped || this._propagationImmediateStopped + }, + getCurrentTarget: function() { + return this.currentTarget + }, + getType: function() { + return this.type + } + }, + cc.Event.NO_TYPE = "no_type", + cc.Event.TOUCH = "touch", + cc.Event.MOUSE = "mouse", + cc.Event.KEYBOARD = "keyboard", + cc.Event.ACCELERATION = "acceleration", + cc.Event.NONE = 0, + cc.Event.CAPTURING_PHASE = 1, + cc.Event.AT_TARGET = 2, + cc.Event.BUBBLING_PHASE = 3; + var n = function(t, e) { + cc.Event.call(this, t, e), + this.detail = null + }; + i.extend(n, cc.Event), + n.prototype.reset = n, + n.prototype.setUserData = function(t) { + this.detail = t + } + , + n.prototype.getUserData = function() { + return this.detail + } + , + n.prototype.getEventName = cc.Event.prototype.getType; + var r = new i.Pool(10); + n.put = function(t) { + r.put(t) + } + , + n.get = function(t, e) { + var i = r._get(); + return i ? i.reset(t, e) : i = new n(t,e), + i + } + , + cc.Event.EventCustom = n, + e.exports = cc.Event + } + ), { + "../platform/js": 214 + }], + 142: [(function(t) { + "use strict"; + t("./event"), + t("./event-listeners"), + t("./event-target"), + t("./system-event") + } + ), { + "./event": 141, + "./event-listeners": 139, + "./event-target": 140, + "./system-event": 143 + }], + 143: [(function(t, e) { + "use strict"; + var i = t("../event/event-target") + , n = t("../event-manager") + , r = t("../platform/CCInputManager") + , s = cc.Enum({ + KEY_DOWN: "keydown", + KEY_UP: "keyup", + DEVICEMOTION: "devicemotion" + }) + , a = null + , o = null + , l = cc.Class({ + name: "SystemEvent", + extends: i, + statics: { + EventType: s + }, + setAccelerometerEnabled: function(t) { + t && window.DeviceMotionEvent && "function" == typeof DeviceMotionEvent.requestPermission ? DeviceMotionEvent.requestPermission().then((function(t) { + console.log("Device Motion Event request permission: " + t), + r.setAccelerometerEnabled("granted" === t) + } + )) : r.setAccelerometerEnabled(t) + }, + setAccelerometerInterval: function(t) { + r.setAccelerometerInterval(t) + }, + on: function(t, e, i, r) { + this._super(t, e, i, r), + t !== s.KEY_DOWN && t !== s.KEY_UP || (a || (a = cc.EventListener.create({ + event: cc.EventListener.KEYBOARD, + onKeyPressed: function(t, e) { + e.type = s.KEY_DOWN, + cc.systemEvent.dispatchEvent(e) + }, + onKeyReleased: function(t, e) { + e.type = s.KEY_UP, + cc.systemEvent.dispatchEvent(e) + } + })), + n.hasEventListener(cc.EventListener.ListenerID.KEYBOARD) || n.addListener(a, 1)), + t === s.DEVICEMOTION && (o || (o = cc.EventListener.create({ + event: cc.EventListener.ACCELERATION, + callback: function(t, e) { + e.type = s.DEVICEMOTION, + cc.systemEvent.dispatchEvent(e) + } + })), + n.hasEventListener(cc.EventListener.ListenerID.ACCELERATION) || n.addListener(o, 1)) + }, + off: function(t, e, i) { + if (this._super(t, e, i), + a && (t === s.KEY_DOWN || t === s.KEY_UP)) { + var r = this.hasEventListener(s.KEY_DOWN) + , l = this.hasEventListener(s.KEY_UP); + r || l || n.removeListener(a) + } + o && t === s.DEVICEMOTION && n.removeListener(o) + } + }); + cc.SystemEvent = e.exports = l, + cc.systemEvent = new cc.SystemEvent + } + ), { + "../event-manager": 138, + "../event/event-target": 140, + "../platform/CCInputManager": 197 + }], + 144: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = a(t("../value-types/vec3")) + , r = a(t("../value-types/mat3")) + , s = a(t("./enums")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + var o = new n.default + , l = new n.default + , h = new r.default + , c = function(t, e, i) { + var r = h.m + , s = i.m; + r[0] = Math.abs(s[0]), + r[1] = Math.abs(s[1]), + r[2] = Math.abs(s[2]), + r[3] = Math.abs(s[4]), + r[4] = Math.abs(s[5]), + r[5] = Math.abs(s[6]), + r[6] = Math.abs(s[8]), + r[7] = Math.abs(s[9]), + r[8] = Math.abs(s[10]), + n.default.transformMat3(t, e, h) + } + , u = (function() { + function t(t, e, i, r, a, o) { + this.center = void 0, + this.halfExtents = void 0, + this._type = void 0, + this._type = s.default.SHAPE_AABB, + this.center = new n.default(t,e,i), + this.halfExtents = new n.default(r,a,o) + } + t.create = function(e, i, n, r, s, a) { + return new t(e,i,n,r,s,a) + } + , + t.clone = function(e) { + return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z) + } + , + t.copy = function(t, e) { + return n.default.copy(t.center, e.center), + n.default.copy(t.halfExtents, e.halfExtents), + t + } + , + t.fromPoints = function(t, e, i) { + return n.default.scale(t.center, n.default.add(o, e, i), .5), + n.default.scale(t.halfExtents, n.default.sub(l, i, e), .5), + t + } + , + t.set = function(t, e, i, r, s, a, o) { + return n.default.set(t.center, e, i, r), + n.default.set(t.halfExtents, s, a, o), + t + } + ; + var e = t.prototype; + return e.getBoundary = function(t, e) { + n.default.sub(t, this.center, this.halfExtents), + n.default.add(e, this.center, this.halfExtents) + } + , + e.transform = function(t, e, i, r, s) { + s || (s = this), + n.default.transformMat4(s.center, this.center, t), + c(s.halfExtents, this.halfExtents, t) + } + , + t + } + )(); + i.default = u, + e.exports = i.default + } + ), { + "../value-types/mat3": 283, + "../value-types/vec3": 292, + "./enums": 146 + }], + 145: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.point_plane = _, + i.pt_point_plane = function(t, e, i) { + var r = _(e, i); + return n.Vec3.subtract(t, e, n.Vec3.multiplyScalar(t, i.n, r)) + } + , + i.pt_point_aabb = function(t, e, i) { + return n.Vec3.copy(t, e), + n.Vec3.subtract(l, i.center, i.halfExtents), + n.Vec3.add(h, i.center, i.halfExtents), + t.x = t.x < l.x ? l.x : t.x, + t.y = t.y < l.x ? l.y : t.y, + t.z = t.z < l.x ? l.z : t.z, + t.x = t.x > h.x ? h.x : t.x, + t.y = t.y > h.x ? h.y : t.y, + t.z = t.z > h.x ? h.z : t.z, + t + } + , + i.pt_point_obb = function(t, e, i) { + var l = i.orientation.m; + n.Vec3.set(r, l[0], l[1], l[2]), + n.Vec3.set(s, l[3], l[4], l[5]), + n.Vec3.set(a, l[6], l[7], l[8]), + c[0] = r, + c[1] = s, + c[2] = a, + u[0] = i.halfExtents.x, + u[1] = i.halfExtents.y, + u[2] = i.halfExtents.z, + n.Vec3.subtract(o, e, i.center), + n.Vec3.set(t, i.center.x, i.center.y, i.center.z); + for (var h = 0; h < 3; h++) { + var _ = n.Vec3.dot(o, c[h]); + _ > u[h] && (_ = u[h]), + _ < -u[h] && (_ = -u[h]), + t.x += _ * c[h].x, + t.y += _ * c[h].y, + t.z += _ * c[h].z + } + return t + } + ; + var n = t("../value-types") + , r = new n.Vec3 + , s = new n.Vec3 + , a = new n.Vec3 + , o = new n.Vec3 + , l = new n.Vec3 + , h = new n.Vec3 + , c = new Array(3) + , u = new Array(3); + function _(t, e) { + return n.Vec3.dot(e.n, t) - e.d + } + } + ), { + "../value-types": 282 + }], + 146: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0, + i.default = { + SHAPE_RAY: 1, + SHAPE_LINE: 2, + SHAPE_SPHERE: 4, + SHAPE_AABB: 8, + SHAPE_OBB: 16, + SHAPE_PLANE: 32, + SHAPE_TRIANGLE: 64, + SHAPE_FRUSTUM: 128, + SHAPE_FRUSTUM_ACCURATE: 256 + }, + e.exports = i.default + } + ), {}], + 147: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("../value-types") + , r = a(t("./enums")) + , s = a(t("./plane")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + function o(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var l = new Array(8); + l[0] = new n.Vec3(1,1,1), + l[1] = new n.Vec3(-1,1,1), + l[2] = new n.Vec3(-1,-1,1), + l[3] = new n.Vec3(1,-1,1), + l[4] = new n.Vec3(1,1,-1), + l[5] = new n.Vec3(-1,1,-1), + l[6] = new n.Vec3(-1,-1,-1), + l[7] = new n.Vec3(1,-1,-1); + var h, c = (function() { + function t() { + this.planes = void 0, + this.vertices = void 0, + this._type = void 0, + this._type = r.default.SHAPE_FRUSTUM, + this.planes = new Array(6); + for (var t = 0; t < 6; ++t) + this.planes[t] = s.default.create(0, 0, 0, 0); + this.vertices = new Array(8); + for (var e = 0; e < 8; ++e) + this.vertices[e] = new n.Vec3 + } + t.create = function() { + return new t + } + , + t.clone = function(e) { + return t.copy(new t, e) + } + , + t.copy = function(t, e) { + t._type = e._type; + for (var i = 0; i < 6; ++i) + s.default.copy(t.planes[i], e.planes[i]); + for (var r = 0; r < 8; ++r) + n.Vec3.copy(t.vertices[r], e.vertices[r]); + return t + } + ; + var e, i, a = t.prototype; + return a.update = function(t, e) { + var i = t.m; + if (n.Vec3.set(this.planes[0].n, i[3] + i[0], i[7] + i[4], i[11] + i[8]), + this.planes[0].d = -(i[15] + i[12]), + n.Vec3.set(this.planes[1].n, i[3] - i[0], i[7] - i[4], i[11] - i[8]), + this.planes[1].d = -(i[15] - i[12]), + n.Vec3.set(this.planes[2].n, i[3] + i[1], i[7] + i[5], i[11] + i[9]), + this.planes[2].d = -(i[15] + i[13]), + n.Vec3.set(this.planes[3].n, i[3] - i[1], i[7] - i[5], i[11] - i[9]), + this.planes[3].d = -(i[15] - i[13]), + n.Vec3.set(this.planes[4].n, i[3] + i[2], i[7] + i[6], i[11] + i[10]), + this.planes[4].d = -(i[15] + i[14]), + n.Vec3.set(this.planes[5].n, i[3] - i[2], i[7] - i[6], i[11] - i[10]), + this.planes[5].d = -(i[15] - i[14]), + this._type === r.default.SHAPE_FRUSTUM_ACCURATE) { + for (var s = 0; s < 6; s++) { + var a = this.planes[s] + , o = 1 / a.n.length(); + n.Vec3.multiplyScalar(a.n, a.n, o), + a.d *= o + } + for (var h = 0; h < 8; h++) + n.Vec3.transformMat4(this.vertices[h], l[h], e) + } + } + , + a.transform = function(t) { + if (this._type === r.default.SHAPE_FRUSTUM_ACCURATE) { + for (var e = 0; e < 8; e++) + n.Vec3.transformMat4(this.vertices[e], this.vertices[e], t); + s.default.fromPoints(this.planes[0], this.vertices[1], this.vertices[5], this.vertices[6]), + s.default.fromPoints(this.planes[1], this.vertices[3], this.vertices[7], this.vertices[4]), + s.default.fromPoints(this.planes[2], this.vertices[6], this.vertices[7], this.vertices[3]), + s.default.fromPoints(this.planes[3], this.vertices[0], this.vertices[4], this.vertices[5]), + s.default.fromPoints(this.planes[4], this.vertices[2], this.vertices[3], this.vertices[0]), + s.default.fromPoints(this.planes[0], this.vertices[7], this.vertices[6], this.vertices[5]) + } + } + , + e = t, + (i = [{ + key: "accurate", + set: function(t) { + this._type = t ? r.default.SHAPE_FRUSTUM_ACCURATE : r.default.SHAPE_FRUSTUM + } + }]) && o(e.prototype, i), + t + } + )(); + i.default = c, + c.createOrtho = (h = new n.Vec3, + function(t, e, i, r, a, o) { + var l = e / 2 + , c = i / 2; + n.Vec3.set(h, l, c, r), + n.Vec3.transformMat4(t.vertices[0], h, o), + n.Vec3.set(h, -l, c, r), + n.Vec3.transformMat4(t.vertices[1], h, o), + n.Vec3.set(h, -l, -c, r), + n.Vec3.transformMat4(t.vertices[2], h, o), + n.Vec3.set(h, l, -c, r), + n.Vec3.transformMat4(t.vertices[3], h, o), + n.Vec3.set(h, l, c, a), + n.Vec3.transformMat4(t.vertices[4], h, o), + n.Vec3.set(h, -l, c, a), + n.Vec3.transformMat4(t.vertices[5], h, o), + n.Vec3.set(h, -l, -c, a), + n.Vec3.transformMat4(t.vertices[6], h, o), + n.Vec3.set(h, l, -c, a), + n.Vec3.transformMat4(t.vertices[7], h, o), + s.default.fromPoints(t.planes[0], t.vertices[1], t.vertices[6], t.vertices[5]), + s.default.fromPoints(t.planes[1], t.vertices[3], t.vertices[4], t.vertices[7]), + s.default.fromPoints(t.planes[2], t.vertices[6], t.vertices[3], t.vertices[7]), + s.default.fromPoints(t.planes[3], t.vertices[0], t.vertices[5], t.vertices[4]), + s.default.fromPoints(t.planes[4], t.vertices[2], t.vertices[0], t.vertices[3]), + s.default.fromPoints(t.planes[0], t.vertices[7], t.vertices[5], t.vertices[6]) + } + ), + e.exports = i.default + } + ), { + "../value-types": 282, + "./enums": 146, + "./plane": 152 + }], + 148: [(function(t, e, i) { + "use strict"; + i.__esModule = !0; + var n = { + enums: !0, + Triangle: !0, + Aabb: !0, + Ray: !0, + intersect: !0, + Sphere: !0, + Obb: !0, + Frustum: !0, + Line: !0, + Plane: !0 + }; + i.Plane = i.Line = i.Frustum = i.Obb = i.Sphere = i.intersect = i.Ray = i.Aabb = i.Triangle = i.enums = void 0; + var r = p(t("./enums")); + i.enums = r.default; + var s = p(t("./triangle")); + i.Triangle = s.default; + var a = p(t("./aabb")); + i.Aabb = a.default; + var o = p(t("./ray")); + i.Ray = o.default; + var l = p(t("./intersect")); + i.intersect = l.default; + var h = p(t("./sphere")); + i.Sphere = h.default; + var c = p(t("./obb")); + i.Obb = c.default; + var u = p(t("./frustum")); + i.Frustum = u.default; + var _ = p(t("./line")); + i.Line = _.default; + var f = p(t("./plane")); + i.Plane = f.default; + var d = t("./distance"); + function p(t) { + return t && t.__esModule ? t : { + default: t + } + } + Object.keys(d).forEach((function(t) { + "default" !== t && "__esModule" !== t && (Object.prototype.hasOwnProperty.call(n, t) || t in i && i[t] === d[t] || (i[t] = d[t])) + } + )), + cc.geomUtils = e.exports + } + ), { + "./aabb": 144, + "./distance": 145, + "./enums": 146, + "./frustum": 147, + "./intersect": 149, + "./line": 150, + "./obb": 151, + "./plane": 152, + "./ray": 153, + "./sphere": 154, + "./triangle": 155 + }], + 149: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = _(t("../../renderer/gfx")) + , r = _(t("../../renderer/memop/recycle-pool")) + , s = t("../value-types") + , a = _(t("./aabb")) + , o = (function(t) { + if (t && t.__esModule) + return t; + if (null === t || "object" != typeof t && "function" != typeof t) + return { + default: t + }; + var e = u(); + if (e && e.has(t)) + return e.get(t); + var i = {} + , n = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var r in t) + if (Object.prototype.hasOwnProperty.call(t, r)) { + var s = n ? Object.getOwnPropertyDescriptor(t, r) : null; + s && (s.get || s.set) ? Object.defineProperty(i, r, s) : i[r] = t[r] + } + return i.default = t, + e && e.set(t, i), + i + } + )(t("./distance")) + , l = _(t("./enums")) + , h = _(t("./ray")) + , c = _(t("./triangle")); + function u() { + if ("function" != typeof WeakMap) + return null; + var t = new WeakMap; + return u = function() { + return t + } + , + t + } + function _(t) { + return t && t.__esModule ? t : { + default: t + } + } + var f, d, p, m, y, v, g, A, x, b, C, T, S, w, E, M = (function() { + var t = c.default.create() + , e = 1 / 0; + function i(t, e, i, n) { + s.Vec3.set(t, e[i * n], e[i * n + 1], e[i * n + 2]) + } + return function(r, s) { + e = 1 / 0; + for (var a = s._subMeshes, o = 0; o < a.length; o++) + if (a[o]._primitiveType === n.default.PT_TRIANGLES) + for (var l = s._subDatas[o] || s._subDatas[0], h = s._getAttrMeshData(o, n.default.ATTR_POSITION), c = l.getIData(Uint16Array), u = l.vfm.element(n.default.ATTR_POSITION).num, _ = 0; _ < c.length; _ += 3) { + i(t.a, h, c[_], u), + i(t.b, h, c[_ + 1], u), + i(t.c, h, c[_ + 2], u); + var f = P(r, t); + f > 0 && f < e && (e = f) + } + return e + } + } + )(), D = (function() { + function t(e, i) { + for (var n = e.children, r = n.length - 1; r >= 0; r--) + t(n[r], i); + i(e) + } + function e(t, e) { + return t.distance - e.distance + } + function i(t, e, i) { + var n = i.m + , r = e.x + , s = e.y + , a = e.z + , o = n[3] * r + n[7] * s + n[11] * a; + return o = o ? 1 / o : 1, + t.x = (n[0] * r + n[4] * s + n[8] * a) * o, + t.y = (n[1] * r + n[5] * s + n[9] * a) * o, + t.z = (n[2] * r + n[6] * s + n[10] * a) * o, + t + } + var n = new r.default(function() { + return { + distance: 0, + node: null + } + } + ,1) + , o = [] + , l = a.default.create() + , c = new s.Vec3 + , u = new s.Vec3 + , _ = new h.default + , f = cc.mat4() + , d = cc.mat4() + , p = new s.Vec3; + function m(t) { + return t > 0 && t < 1 / 0 + } + return function(r, h, y, v) { + return n.reset(), + o.length = 0, + t(r = r || cc.director.getScene(), (function(t) { + if (!v || v(t)) { + s.Mat4.invert(d, t.getWorldMatrix(f)), + s.Vec3.transformMat4(_.o, h.o, d), + s.Vec3.normalize(_.d, i(_.d, h.d, d)); + var e = 1 / 0 + , r = t._renderComponent; + if (r instanceof cc.MeshRenderer ? e = V(_, r._boundingBox) : t.width && t.height && (s.Vec3.set(c, -t.width * t.anchorX, -t.height * t.anchorY, t.z), + s.Vec3.set(u, t.width * (1 - t.anchorX), t.height * (1 - t.anchorY), t.z), + a.default.fromPoints(l, c, u), + e = V(_, l)), + m(e) && (y && (e = y(_, t, e)), + m(e))) { + s.Vec3.scale(p, _.d, e), + i(p, p, f); + var g = n.add(); + g.node = t, + g.distance = s.Vec3.mag(p), + o.push(g) + } + } + } + )), + o.sort(e), + o + } + } + )(), B = (f = new s.Vec3(0,0,0), + function(t, e) { + var i = s.Vec3.dot(t.d, e.n); + if (Math.abs(i) < Number.EPSILON) + return 0; + s.Vec3.multiplyScalar(f, e.n, e.d); + var n = s.Vec3.dot(s.Vec3.subtract(f, f, t.o), e.n) / i; + return n < 0 ? 0 : n + } + ), I = (d = new s.Vec3(0,0,0), + function(t, e) { + s.Vec3.subtract(d, t.e, t.s); + var i = (e.d - s.Vec3.dot(t.s, e.n)) / s.Vec3.dot(d, e.n); + return i < 0 || i > 1 ? 0 : i + } + ), P = (function() { + var t = new s.Vec3(0,0,0) + , e = new s.Vec3(0,0,0) + , i = new s.Vec3(0,0,0) + , n = new s.Vec3(0,0,0) + , r = new s.Vec3(0,0,0); + return function(a, o, l) { + s.Vec3.subtract(t, o.b, o.a), + s.Vec3.subtract(e, o.c, o.a), + s.Vec3.cross(i, a.d, e); + var h = s.Vec3.dot(t, i); + if (h < Number.EPSILON && (!l || h > -Number.EPSILON)) + return 0; + var c = 1 / h; + s.Vec3.subtract(n, a.o, o.a); + var u = s.Vec3.dot(n, i) * c; + if (u < 0 || u > 1) + return 0; + s.Vec3.cross(r, n, t); + var _ = s.Vec3.dot(a.d, r) * c; + if (_ < 0 || u + _ > 1) + return 0; + var f = s.Vec3.dot(e, r) * c; + return f < 0 ? 0 : f + } + } + )(), R = P, O = (function() { + var t = new s.Vec3(0,0,0) + , e = new s.Vec3(0,0,0) + , i = new s.Vec3(0,0,0) + , n = new s.Vec3(0,0,0) + , r = new s.Vec3(0,0,0) + , a = new s.Vec3(0,0,0); + return function(o, l, h) { + s.Vec3.subtract(t, l.b, l.a), + s.Vec3.subtract(e, l.c, l.a), + s.Vec3.subtract(i, o.s, o.e), + s.Vec3.cross(r, t, e); + var c = s.Vec3.dot(i, r); + if (c <= 0) + return 0; + s.Vec3.subtract(n, o.s, l.a); + var u = s.Vec3.dot(n, r); + if (u < 0 || u > c) + return 0; + s.Vec3.cross(a, i, n); + var _ = s.Vec3.dot(e, a); + if (_ < 0 || _ > c) + return 0; + var f = -s.Vec3.dot(t, a); + if (f < 0 || _ + f > c) + return 0; + if (h) { + var d = 1 / c + , p = 1 - (_ *= d) - (f *= d); + s.Vec3.set(h, l.a.x * p + l.b.x * _ + l.c.x * f, l.a.y * p + l.b.y * _ + l.c.y * f, l.a.z * p + l.b.z * _ + l.c.z * f) + } + return 1 + } + } + )(), L = (p = new s.Vec3(0,0,0), + m = new s.Vec3(0,0,0), + y = new s.Vec3(0,0,0), + v = new s.Vec3(0,0,0), + g = new s.Vec3(0,0,0), + A = new s.Vec3(0,0,0), + x = new s.Vec3(0,0,0), + function(t, e, i, n, r, a, o) { + s.Vec3.subtract(p, e, t), + s.Vec3.subtract(m, i, t), + s.Vec3.subtract(y, n, t), + s.Vec3.subtract(v, r, t), + s.Vec3.cross(A, v, p); + var l = s.Vec3.dot(m, A); + if (l >= 0) { + var h = -s.Vec3.dot(y, A); + if (h < 0) + return 0; + var c = s.Vec3.dot(s.Vec3.cross(x, p, y), m); + if (c < 0) + return 0; + if (o) { + var u = 1 / (h + l + c); + h *= u, + l *= u, + c *= u, + s.Vec3.set(o, i.x * h + n.x * l + r.x * c, i.y * h + n.y * l + r.y * c, i.z * h + n.z * l + r.z * c) + } + } else { + s.Vec3.subtract(g, a, t); + var _ = s.Vec3.dot(g, A); + if (_ < 0) + return 0; + var f = s.Vec3.dot(s.Vec3.cross(x, p, m), g); + if (f < 0) + return 0; + if (o) { + var d = 1 / (_ + (l = -l) + f); + _ *= d, + l *= d, + f *= d, + s.Vec3.set(o, i.x * _ + a.x * l + r.x * f, i.y * _ + a.y * l + r.y * f, i.z * _ + a.z * l + r.z * f) + } + } + return 1 + } + ), F = (function() { + var t = new s.Vec3(0,0,0); + return function(e, i) { + var n = i.radius + , r = i.center + , a = e.o + , o = e.d + , l = n * n; + s.Vec3.subtract(t, r, a); + var h = t.lengthSqr() + , c = s.Vec3.dot(t, o) + , u = l - (h - c * c); + if (u < 0) + return 0; + var _ = Math.sqrt(u) + , f = h < l ? c + _ : c - _; + return f < 0 ? 0 : f + } + } + )(), V = (b = new s.Vec3, + C = new s.Vec3, + function(t, e) { + var i = t.o + , n = t.d + , r = 1 / n.x + , a = 1 / n.y + , o = 1 / n.z; + s.Vec3.subtract(b, e.center, e.halfExtents), + s.Vec3.add(C, e.center, e.halfExtents); + var l = (b.x - i.x) * r + , h = (C.x - i.x) * r + , c = (b.y - i.y) * a + , u = (C.y - i.y) * a + , _ = (b.z - i.z) * o + , f = (C.z - i.z) * o + , d = Math.max(Math.max(Math.min(l, h), Math.min(c, u)), Math.min(_, f)) + , p = Math.min(Math.min(Math.max(l, h), Math.max(c, u)), Math.max(_, f)); + return p < 0 || d > p ? 0 : d + } + ), N = V, k = (function() { + var t = new s.Vec3 + , e = new s.Vec3 + , i = new s.Vec3 + , n = new s.Vec3 + , r = new s.Vec3 + , a = new s.Vec3 + , o = new s.Vec3 + , l = new Array(3) + , h = new Array(3) + , c = new Array(3) + , u = new Array(6); + return function(_, f) { + l[0] = f.halfExtents.x, + l[1] = f.halfExtents.y, + l[2] = f.halfExtents.z, + t = f.center, + e = _.o, + i = _.d; + var d = f.orientation.m; + s.Vec3.set(n, d[0], d[1], d[2]), + s.Vec3.set(r, d[3], d[4], d[5]), + s.Vec3.set(a, d[6], d[7], d[8]), + s.Vec3.subtract(o, t, e), + h[0] = s.Vec3.dot(n, i), + h[1] = s.Vec3.dot(r, i), + h[2] = s.Vec3.dot(a, i), + c[0] = s.Vec3.dot(n, o), + c[1] = s.Vec3.dot(r, o), + c[2] = s.Vec3.dot(a, o); + for (var p = 0; p < 3; ++p) { + if (0 === h[p]) { + if (-c[p] - l[p] > 0 || -c[p] + l[p] < 0) + return 0; + h[p] = 1e-7 + } + u[2 * p + 0] = (c[p] + l[p]) / h[p], + u[2 * p + 1] = (c[p] - l[p]) / h[p] + } + var m = Math.max(Math.max(Math.min(u[0], u[1]), Math.min(u[2], u[3])), Math.min(u[4], u[5])) + , y = Math.min(Math.min(Math.max(u[0], u[1]), Math.max(u[2], u[3])), Math.max(u[4], u[5])); + return y < 0 || m > y || m < 0 ? 0 : m + } + } + )(), G = (T = new s.Vec3, + S = new s.Vec3, + w = new s.Vec3, + E = new s.Vec3, + function(t, e) { + return s.Vec3.subtract(T, t.center, t.halfExtents), + s.Vec3.add(S, t.center, t.halfExtents), + s.Vec3.subtract(w, e.center, e.halfExtents), + s.Vec3.add(E, e.center, e.halfExtents), + T.x <= E.x && S.x >= w.x && T.y <= E.y && S.y >= w.y && T.z <= E.z && S.z >= w.z + } + ); + function U(t, e, i) { + s.Vec3.set(i[0], t.x, e.y, e.z), + s.Vec3.set(i[1], t.x, e.y, t.z), + s.Vec3.set(i[2], t.x, t.y, e.z), + s.Vec3.set(i[3], t.x, t.y, t.z), + s.Vec3.set(i[4], e.x, e.y, e.z), + s.Vec3.set(i[5], e.x, e.y, t.z), + s.Vec3.set(i[6], e.x, t.y, e.z), + s.Vec3.set(i[7], e.x, t.y, t.z) + } + function z(t, e, i, n, r, a) { + s.Vec3.set(a[0], t.x + i.x * e.x + n.x * e.y + r.x * e.z, t.y + i.y * e.x + n.y * e.y + r.y * e.z, t.z + i.z * e.x + n.z * e.y + r.z * e.z), + s.Vec3.set(a[1], t.x - i.x * e.x + n.x * e.y + r.x * e.z, t.y - i.y * e.x + n.y * e.y + r.y * e.z, t.z - i.z * e.x + n.z * e.y + r.z * e.z), + s.Vec3.set(a[2], t.x + i.x * e.x - n.x * e.y + r.x * e.z, t.y + i.y * e.x - n.y * e.y + r.y * e.z, t.z + i.z * e.x - n.z * e.y + r.z * e.z), + s.Vec3.set(a[3], t.x + i.x * e.x + n.x * e.y - r.x * e.z, t.y + i.y * e.x + n.y * e.y - r.y * e.z, t.z + i.z * e.x + n.z * e.y - r.z * e.z), + s.Vec3.set(a[4], t.x - i.x * e.x - n.x * e.y - r.x * e.z, t.y - i.y * e.x - n.y * e.y - r.y * e.z, t.z - i.z * e.x - n.z * e.y - r.z * e.z), + s.Vec3.set(a[5], t.x + i.x * e.x - n.x * e.y - r.x * e.z, t.y + i.y * e.x - n.y * e.y - r.y * e.z, t.z + i.z * e.x - n.z * e.y - r.z * e.z), + s.Vec3.set(a[6], t.x - i.x * e.x + n.x * e.y - r.x * e.z, t.y - i.y * e.x + n.y * e.y - r.y * e.z, t.z - i.z * e.x + n.z * e.y - r.z * e.z), + s.Vec3.set(a[7], t.x - i.x * e.x - n.x * e.y + r.x * e.z, t.y - i.y * e.x - n.y * e.y + r.y * e.z, t.z - i.z * e.x - n.z * e.y + r.z * e.z) + } + function H(t, e) { + for (var i = s.Vec3.dot(e, t[0]), n = i, r = 1; r < 8; ++r) { + var a = s.Vec3.dot(e, t[r]); + i = a < i ? a : i, + n = a > n ? a : n + } + return [i, n] + } + var W, j = (function() { + for (var t = new Array(15), e = 0; e < 15; e++) + t[e] = new s.Vec3(0,0,0); + for (var i = new Array(8), n = new Array(8), r = 0; r < 8; r++) + i[r] = new s.Vec3(0,0,0), + n[r] = new s.Vec3(0,0,0); + var a = new s.Vec3 + , o = new s.Vec3; + return function(e, r) { + var l = r.orientation.m; + s.Vec3.set(t[0], 1, 0, 0), + s.Vec3.set(t[1], 0, 1, 0), + s.Vec3.set(t[2], 0, 0, 1), + s.Vec3.set(t[3], l[0], l[1], l[2]), + s.Vec3.set(t[4], l[3], l[4], l[5]), + s.Vec3.set(t[5], l[6], l[7], l[8]); + for (var h = 0; h < 3; ++h) + s.Vec3.cross(t[6 + 3 * h], t[h], t[0]), + s.Vec3.cross(t[7 + 3 * h], t[h], t[1]), + s.Vec3.cross(t[7 + 3 * h], t[h], t[2]); + s.Vec3.subtract(a, e.center, e.halfExtents), + s.Vec3.add(o, e.center, e.halfExtents), + U(a, o, i), + z(r.center, r.halfExtents, t[3], t[4], t[5], n); + for (var c = 0; c < 15; ++c) { + var u = H(i, t[c]) + , _ = H(n, t[c]); + if (_[0] > u[1] || u[0] > _[1]) + return 0 + } + return 1 + } + } + )(), X = function(t, e) { + var i = t.halfExtents.x * Math.abs(e.n.x) + t.halfExtents.y * Math.abs(e.n.y) + t.halfExtents.z * Math.abs(e.n.z) + , n = s.Vec3.dot(e.n, t.center); + return n + i < e.d ? -1 : n - i > e.d ? 0 : 1 + }, Y = function(t, e) { + for (var i = 0; i < e.planes.length; i++) + if (-1 === X(t, e.planes[i])) + return 0; + return 1 + }, q = (function() { + for (var t = new Array(8), e = 0, i = 0, n = 0; n < t.length; n++) + t[n] = new s.Vec3(0,0,0); + return function(n, r) { + for (var a = 0, o = !1, l = 0; l < r.planes.length; l++) { + if (-1 === (a = X(n, r.planes[l]))) + return 0; + 1 === a && (o = !0) + } + if (!o) + return 1; + for (var h = 0; h < r.vertices.length; h++) + s.Vec3.subtract(t[h], r.vertices[h], n.center); + e = 0, + i = 0; + for (var c = 0; c < r.vertices.length; c++) + t[c].x > n.halfExtents.x ? e++ : t[c].x < -n.halfExtents.x && i++; + if (e === r.vertices.length || i === r.vertices.length) + return 0; + e = 0, + i = 0; + for (var u = 0; u < r.vertices.length; u++) + t[u].y > n.halfExtents.y ? e++ : t[u].y < -n.halfExtents.y && i++; + if (e === r.vertices.length || i === r.vertices.length) + return 0; + e = 0, + i = 0; + for (var _ = 0; _ < r.vertices.length; _++) + t[_].z > n.halfExtents.z ? e++ : t[_].z < -n.halfExtents.z && i++; + return e === r.vertices.length || i === r.vertices.length ? 0 : 1 + } + } + )(), J = (function() { + var t = new s.Vec3(0,0,0) + , e = new s.Mat3; + return function(i, n) { + return s.Vec3.subtract(t, n, i.center), + s.Vec3.transformMat3(t, t, s.Mat3.transpose(e, i.orientation)), + r = t, + a = i.halfExtents, + Math.abs(r.x) < a.x && Math.abs(r.y) < a.y && Math.abs(r.z) < a.z; + var r, a + } + } + )(), Z = (W = function(t, e, i, n) { + return Math.abs(t.x * e + t.y * i + t.z * n) + } + , + function(t, e) { + var i = t.orientation.m + , n = t.halfExtents.x * W(e.n, i[0], i[1], i[2]) + t.halfExtents.y * W(e.n, i[3], i[4], i[5]) + t.halfExtents.z * W(e.n, i[6], i[7], i[8]) + , r = s.Vec3.dot(e.n, t.center); + return r + n < e.d ? -1 : r - n > e.d ? 0 : 1 + } + ), K = function(t, e) { + for (var i = 0; i < e.planes.length; i++) + if (-1 === Z(t, e.planes[i])) + return 0; + return 1 + }, Q = (function() { + for (var t = new Array(8), e = 0, i = 0, n = 0, r = 0; r < t.length; r++) + t[r] = new s.Vec3(0,0,0); + var a = function(t, e, i, n) { + return t.x * e + t.y * i + t.z * n + }; + return function(r, o) { + for (var l = 0, h = !1, c = 0; c < o.planes.length; c++) { + if (-1 === (l = Z(r, o.planes[c]))) + return 0; + 1 === l && (h = !0) + } + if (!h) + return 1; + for (var u = 0; u < o.vertices.length; u++) + s.Vec3.subtract(t[u], o.vertices[u], r.center); + i = 0, + n = 0; + for (var _ = r.orientation.m, f = 0; f < o.vertices.length; f++) + (e = a(t[f], _[0], _[1], _[2])) > r.halfExtents.x ? i++ : e < -r.halfExtents.x && n++; + if (i === o.vertices.length || n === o.vertices.length) + return 0; + i = 0, + n = 0; + for (var d = 0; d < o.vertices.length; d++) + (e = a(t[d], _[3], _[4], _[5])) > r.halfExtents.y ? i++ : e < -r.halfExtents.y && n++; + if (i === o.vertices.length || n === o.vertices.length) + return 0; + i = 0, + n = 0; + for (var p = 0; p < o.vertices.length; p++) + (e = a(t[p], _[6], _[7], _[8])) > r.halfExtents.z ? i++ : e < -r.halfExtents.z && n++; + return i === o.vertices.length || n === o.vertices.length ? 0 : 1 + } + } + )(), $ = (function() { + for (var t = new Array(15), e = 0; e < 15; e++) + t[e] = new s.Vec3(0,0,0); + for (var i = new Array(8), n = new Array(8), r = 0; r < 8; r++) + i[r] = new s.Vec3(0,0,0), + n[r] = new s.Vec3(0,0,0); + return function(e, r) { + var a = e.orientation.m + , o = r.orientation.m; + s.Vec3.set(t[0], a[0], a[1], a[2]), + s.Vec3.set(t[1], a[3], a[4], a[5]), + s.Vec3.set(t[2], a[6], a[7], a[8]), + s.Vec3.set(t[3], o[0], o[1], o[2]), + s.Vec3.set(t[4], o[3], o[4], o[5]), + s.Vec3.set(t[5], o[6], o[7], o[8]); + for (var l = 0; l < 3; ++l) + s.Vec3.cross(t[6 + 3 * l], t[l], t[0]), + s.Vec3.cross(t[7 + 3 * l], t[l], t[1]), + s.Vec3.cross(t[7 + 3 * l], t[l], t[2]); + z(e.center, e.halfExtents, t[0], t[1], t[2], i), + z(r.center, r.halfExtents, t[3], t[4], t[5], n); + for (var h = 0; h < 15; ++h) { + var c = H(i, t[h]) + , u = H(n, t[h]); + if (u[0] > c[1] || c[0] > u[1]) + return 0 + } + return 1 + } + } + )(), tt = function(t, e) { + var i = s.Vec3.dot(e.n, t.center) + , n = t.radius * e.n.length(); + return i + n < e.d ? -1 : i - n > e.d ? 0 : 1 + }, et = function(t, e) { + for (var i = 0; i < e.planes.length; i++) + if (-1 === tt(t, e.planes[i])) + return 0; + return 1 + }, it = (function() { + var t = new s.Vec3(0,0,0) + , e = [1, -1, 1, -1, 1, -1]; + return function(i, n) { + for (var r = 0; r < 6; r++) { + var a = n.planes[r] + , o = i.radius + , l = i.center + , h = a.n + , c = a.d + , u = s.Vec3.dot(h, l); + if (u + o < c) + return 0; + if (!(u - o > c)) { + s.Vec3.add(t, l, s.Vec3.multiplyScalar(t, h, o)); + for (var _ = 0; _ < 6; _++) + if (_ !== r && _ !== r + e[r]) { + var f = n.planes[_]; + if (s.Vec3.dot(f.n, t) < f.d) + return 0 + } + } + } + return 1 + } + } + )(), nt = function(t, e) { + var i = t.radius + e.radius; + return s.Vec3.squaredDistance(t.center, e.center) < i * i + }, rt = (function() { + var t = new s.Vec3; + return function(e, i) { + return o.pt_point_aabb(t, e.center, i), + s.Vec3.squaredDistance(e.center, t) < e.radius * e.radius + } + } + )(), st = (function() { + var t = new s.Vec3; + return function(e, i) { + return o.pt_point_obb(t, e.center, i), + s.Vec3.squaredDistance(e.center, t) < e.radius * e.radius + } + } + )(), at = { + rayAabb: N, + rayMesh: M, + raycast: D, + rayTriangle: R, + ray_sphere: F, + ray_aabb: V, + ray_obb: k, + ray_plane: B, + ray_triangle: P, + line_plane: I, + line_triangle: O, + line_quad: L, + sphere_sphere: nt, + sphere_aabb: rt, + sphere_obb: st, + sphere_plane: tt, + sphere_frustum: et, + sphere_frustum_accurate: it, + aabb_aabb: G, + aabb_obb: j, + aabb_plane: X, + aabb_frustum: Y, + aabb_frustum_accurate: q, + obb_obb: $, + obb_plane: Z, + obb_frustum: K, + obb_frustum_accurate: Q, + obb_point: J, + resolve: function(t, e, i) { + void 0 === i && (i = null); + var n = t._type + , r = e._type + , s = this[n | r]; + return n < r ? s(t, e, i) : s(e, t, i) + } + }; + at[l.default.SHAPE_RAY | l.default.SHAPE_SPHERE] = F, + at[l.default.SHAPE_RAY | l.default.SHAPE_AABB] = V, + at[l.default.SHAPE_RAY | l.default.SHAPE_OBB] = k, + at[l.default.SHAPE_RAY | l.default.SHAPE_PLANE] = B, + at[l.default.SHAPE_RAY | l.default.SHAPE_TRIANGLE] = P, + at[l.default.SHAPE_LINE | l.default.SHAPE_PLANE] = I, + at[l.default.SHAPE_LINE | l.default.SHAPE_TRIANGLE] = O, + at[l.default.SHAPE_SPHERE] = nt, + at[l.default.SHAPE_SPHERE | l.default.SHAPE_AABB] = rt, + at[l.default.SHAPE_SPHERE | l.default.SHAPE_OBB] = st, + at[l.default.SHAPE_SPHERE | l.default.SHAPE_PLANE] = tt, + at[l.default.SHAPE_SPHERE | l.default.SHAPE_FRUSTUM] = et, + at[l.default.SHAPE_SPHERE | l.default.SHAPE_FRUSTUM_ACCURATE] = it, + at[l.default.SHAPE_AABB] = G, + at[l.default.SHAPE_AABB | l.default.SHAPE_OBB] = j, + at[l.default.SHAPE_AABB | l.default.SHAPE_PLANE] = X, + at[l.default.SHAPE_AABB | l.default.SHAPE_FRUSTUM] = Y, + at[l.default.SHAPE_AABB | l.default.SHAPE_FRUSTUM_ACCURATE] = q, + at[l.default.SHAPE_OBB] = $, + at[l.default.SHAPE_OBB | l.default.SHAPE_PLANE] = Z, + at[l.default.SHAPE_OBB | l.default.SHAPE_FRUSTUM] = K, + at[l.default.SHAPE_OBB | l.default.SHAPE_FRUSTUM_ACCURATE] = Q; + var ot = at; + i.default = ot, + e.exports = i.default + } + ), { + "../../renderer/gfx": 315, + "../../renderer/memop/recycle-pool": 330, + "../value-types": 282, + "./aabb": 144, + "./distance": 145, + "./enums": 146, + "./ray": 153, + "./triangle": 155 + }], + 150: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : { + default: n + }, a = (function() { + function t(t, e, i, n, a, o) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === a && (a = 0), + void 0 === o && (o = -1), + this.s = void 0, + this.e = void 0, + this._type = void 0, + this._type = s.default.SHAPE_LINE, + this.s = new r.Vec3(t,e,i), + this.e = new r.Vec3(n,a,o) + } + return t.create = function(e, i, n, r, s, a) { + return new t(e,i,n,r,s,a) + } + , + t.clone = function(e) { + return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z) + } + , + t.copy = function(t, e) { + return r.Vec3.copy(t.s, e.s), + r.Vec3.copy(t.e, e.e), + t + } + , + t.fromPoints = function(t, e, i) { + return r.Vec3.copy(t.s, e), + r.Vec3.copy(t.e, i), + t + } + , + t.set = function(t, e, i, n, r, s, a) { + return t.s.x = e, + t.s.y = i, + t.s.z = n, + t.e.x = r, + t.e.y = s, + t.e.z = a, + t + } + , + t.len = function(t) { + return r.Vec3.distance(t.s, t.e) + } + , + t.prototype.length = function() { + return r.Vec3.distance(this.s, this.e) + } + , + t + } + )(); + i.default = a, + e.exports = i.default + } + ), { + "../value-types": 282, + "./enums": 146 + }], + 151: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : { + default: n + }; + function a(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var o = new r.Vec3 + , l = new r.Vec3 + , h = new r.Mat3 + , c = (function() { + function t(t, e, i, n, a, o, l, h, c, u, _, f, d, p, m) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 1), + void 0 === a && (a = 1), + void 0 === o && (o = 1), + void 0 === l && (l = 1), + void 0 === h && (h = 0), + void 0 === c && (c = 0), + void 0 === u && (u = 0), + void 0 === _ && (_ = 1), + void 0 === f && (f = 0), + void 0 === d && (d = 0), + void 0 === p && (p = 0), + void 0 === m && (m = 1), + this.center = void 0, + this.halfExtents = void 0, + this.orientation = void 0, + this._type = void 0, + this._type = s.default.SHAPE_OBB, + this.center = new r.Vec3(t,e,i), + this.halfExtents = new r.Vec3(n,a,o), + this.orientation = new r.Mat3(l,h,c,u,_,f,d,p,m) + } + t.create = function(e, i, n, r, s, a, o, l, h, c, u, _, f, d, p) { + return new t(e,i,n,r,s,a,o,l,h,c,u,_,f,d,p) + } + , + t.clone = function(e) { + var i = e.orientation.m; + return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8]) + } + , + t.copy = function(t, e) { + return r.Vec3.copy(t.center, e.center), + r.Vec3.copy(t.halfExtents, e.halfExtents), + r.Mat3.copy(t.orientation, e.orientation), + t + } + , + t.fromPoints = function(t, e, i) { + return r.Vec3.multiplyScalar(t.center, r.Vec3.add(o, e, i), .5), + r.Vec3.multiplyScalar(t.halfExtents, r.Vec3.subtract(l, i, e), .5), + r.Mat3.identity(t.orientation), + t + } + , + t.set = function(t, e, i, n, s, a, o, l, h, c, u, _, f, d, p, m) { + return r.Vec3.set(t.center, e, i, n), + r.Vec3.set(t.halfExtents, s, a, o), + r.Mat3.set(t.orientation, l, h, c, u, _, f, d, p, m), + t + } + ; + var e, i, n = t.prototype; + return n.getBoundary = function(t, e) { + var i, n, s, a, l; + i = o, + n = this.halfExtents, + s = this.orientation, + a = h.m, + l = s.m, + a[0] = Math.abs(l[0]), + a[1] = Math.abs(l[1]), + a[2] = Math.abs(l[2]), + a[3] = Math.abs(l[3]), + a[4] = Math.abs(l[4]), + a[5] = Math.abs(l[5]), + a[6] = Math.abs(l[6]), + a[7] = Math.abs(l[7]), + a[8] = Math.abs(l[8]), + r.Vec3.transformMat3(i, n, h), + r.Vec3.subtract(t, this.center, o), + r.Vec3.add(e, this.center, o) + } + , + n.transform = function(t, e, i, n, s) { + r.Vec3.transformMat4(s.center, this.center, t), + r.Mat3.fromQuat(s.orientation, i), + r.Vec3.multiply(s.halfExtents, this.halfExtents, n) + } + , + n.translateAndRotate = function(t, e, i) { + r.Vec3.transformMat4(i.center, this.center, t), + r.Mat3.fromQuat(i.orientation, e) + } + , + n.setScale = function(t, e) { + r.Vec3.multiply(e.halfExtents, this.halfExtents, t) + } + , + e = t, + (i = [{ + key: "type", + get: function() { + return this._type + } + }]) && a(e.prototype, i), + t + } + )(); + i.default = c, + e.exports = i.default + } + ), { + "../value-types": 282, + "./enums": 146 + }], + 152: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : { + default: n + }, a = new r.Vec3(0,0,0), o = new r.Vec3(0,0,0), l = cc.mat4(), h = cc.v4(), c = (function() { + function t(t, e, i, n) { + void 0 === t && (t = 0), + void 0 === e && (e = 1), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + this.n = void 0, + this.d = void 0, + this._type = void 0, + this._type = s.default.SHAPE_PLANE, + this.n = new r.Vec3(t,e,i), + this.d = n + } + return t.create = function(e, i, n, r) { + return new t(e,i,n,r) + } + , + t.clone = function(e) { + return new t(e.n.x,e.n.y,e.n.z,e.d) + } + , + t.copy = function(t, e) { + return r.Vec3.copy(t.n, e.n), + t.d = e.d, + t + } + , + t.fromPoints = function(t, e, i, n) { + return r.Vec3.subtract(a, i, e), + r.Vec3.subtract(o, n, e), + r.Vec3.normalize(t.n, r.Vec3.cross(t.n, a, o)), + t.d = r.Vec3.dot(t.n, e), + t + } + , + t.set = function(t, e, i, n, r) { + return t.n.x = e, + t.n.y = i, + t.n.z = n, + t.d = r, + t + } + , + t.fromNormalAndPoint = function(t, e, i) { + return r.Vec3.copy(t.n, e), + t.d = r.Vec3.dot(e, i), + t + } + , + t.normalize = function(t, e) { + var i = e.n.len(); + return r.Vec3.normalize(t.n, e.n), + i > 0 && (t.d = e.d / i), + t + } + , + t.prototype.transform = function(t) { + r.Mat4.invert(l, t), + r.Mat4.transpose(l, l), + r.Vec4.set(h, this.n.x, this.n.y, this.n.z, this.d), + r.Vec4.transformMat4(h, h, l), + r.Vec3.set(this.n, h.x, h.y, h.z), + this.d = h.w + } + , + t + } + )(); + i.default = c, + e.exports = i.default + } + ), { + "../value-types": 282, + "./enums": 146 + }], + 153: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : { + default: n + }, a = (function() { + function t(t, e, i, n, a, o) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === a && (a = 0), + void 0 === o && (o = -1), + this.o = void 0, + this.d = void 0, + this._type = void 0, + this._type = s.default.SHAPE_RAY, + this.o = new r.Vec3(t,e,i), + this.d = new r.Vec3(n,a,o) + } + return t.create = function(e, i, n, r, s, a) { + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 0), + void 0 === s && (s = 0), + void 0 === a && (a = 1), + new t(e,i,n,r,s,a) + } + , + t.clone = function(e) { + return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z) + } + , + t.copy = function(t, e) { + return r.Vec3.copy(t.o, e.o), + r.Vec3.copy(t.d, e.d), + t + } + , + t.fromPoints = function(t, e, i) { + return r.Vec3.copy(t.o, e), + r.Vec3.normalize(t.d, r.Vec3.subtract(t.d, i, e)), + t + } + , + t.set = function(t, e, i, n, r, s, a) { + return t.o.x = e, + t.o.y = i, + t.o.z = n, + t.d.x = r, + t.d.y = s, + t.d.z = a, + t + } + , + t.prototype.computeHit = function(t, e) { + r.Vec3.normalize(t, this.d), + r.Vec3.scaleAndAdd(t, this.o, t, e) + } + , + t + } + )(); + i.default = a, + e.exports = i.default + } + ), { + "../value-types": 282, + "./enums": 146 + }], + 154: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../value-types"), s = (n = t("./enums")) && n.__esModule ? n : { + default: n + }, a = new r.Vec3, o = (function() { + function t(t, e, i, n) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 1), + this.center = void 0, + this.radius = void 0, + this._type = void 0, + this._type = s.default.SHAPE_SPHERE, + this.center = new r.Vec3(t,e,i), + this.radius = n + } + t.create = function(e, i, n, r) { + return new t(e,i,n,r) + } + , + t.clone = function(e) { + return new t(e.center.x,e.center.y,e.center.z,e.radius) + } + , + t.copy = function(t, e) { + return r.Vec3.copy(t.center, e.center), + t.radius = e.radius, + t + } + , + t.fromPoints = function(t, e, i) { + return r.Vec3.multiplyScalar(t.center, r.Vec3.add(a, e, i), .5), + t.radius = .5 * r.Vec3.subtract(a, i, e).len(), + t + } + , + t.set = function(t, e, i, n, r) { + return t.center.x = e, + t.center.y = i, + t.center.z = n, + t.radius = r, + t + } + ; + var e = t.prototype; + return e.clone = function() { + return t.clone(this) + } + , + e.copy = function(e) { + return t.copy(this, e) + } + , + e.getBoundary = function(t, e) { + r.Vec3.set(t, this.center.x - this.radius, this.center.y - this.radius, this.center.z - this.radius), + r.Vec3.set(e, this.center.x + this.radius, this.center.y + this.radius, this.center.z + this.radius) + } + , + e.transform = function(t, e, i, n, s) { + r.Vec3.transformMat4(s.center, this.center, t), + s.radius = this.radius * n.maxAxis() + } + , + e.translateAndRotate = function(t, e, i) { + r.Vec3.transformMat4(i.center, this.center, t) + } + , + e.setScale = function(t, e) { + e.radius = this.radius * t.maxAxis() + } + , + t + } + )(); + i.default = o, + e.exports = i.default + } + ), { + "../value-types": 282, + "./enums": 146 + }], + 155: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = s(t("../value-types/vec3")) + , r = s(t("./enums")); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + var a = (function() { + function t(t, e, i, s, a, o, l, h, c) { + this.a = void 0, + this.b = void 0, + this.c = void 0, + this._type = void 0, + this.a = new n.default(t,e,i), + this.b = new n.default(s,a,o), + this.c = new n.default(l,h,c), + this._type = r.default.SHAPE_TRIANGLE + } + return t.create = function(e, i, n, r, s, a, o, l, h) { + return new t(e,i,n,r,s,a,o,l,h) + } + , + t.clone = function(e) { + return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z) + } + , + t.copy = function(t, e) { + return n.default.copy(t.a, e.a), + n.default.copy(t.b, e.b), + n.default.copy(t.c, e.c), + t + } + , + t.fromPoints = function(t, e, i, r) { + return n.default.copy(t.a, e), + n.default.copy(t.b, i), + n.default.copy(t.c, r), + t + } + , + t.set = function(t, e, i, n, r, s, a, o, l, h) { + return t.a.x = e, + t.a.y = i, + t.a.z = n, + t.b.x = r, + t.b.y = s, + t.b.z = a, + t.c.x = o, + t.c.y = l, + t.c.z = h, + t + } + , + t + } + )(); + i.default = a, + e.exports = i.default + } + ), { + "../value-types/vec3": 292, + "./enums": 146 + }], + 156: [(function(t, e) { + "use strict"; + var i = t("../components/CCRenderComponent") + , n = t("../assets/material/CCMaterial") + , r = t("./types") + , s = r.LineCap + , a = r.LineJoin + , o = cc.Class({ + name: "cc.Graphics", + extends: i, + editor: !1, + ctor: function() { + this._impl = new o._Impl(this) + }, + properties: { + _lineWidth: 2, + _strokeColor: cc.Color.BLACK, + _lineJoin: a.MITER, + _lineCap: s.BUTT, + _fillColor: cc.Color.WHITE, + _miterLimit: 10, + lineWidth: { + get: function() { + return this._lineWidth + }, + set: function(t) { + this._lineWidth = t, + this._impl.lineWidth = t + } + }, + lineJoin: { + get: function() { + return this._lineJoin + }, + set: function(t) { + this._lineJoin = t, + this._impl.lineJoin = t + }, + type: a + }, + lineCap: { + get: function() { + return this._lineCap + }, + set: function(t) { + this._lineCap = t, + this._impl.lineCap = t + }, + type: s + }, + strokeColor: { + get: function() { + return this._strokeColor + }, + set: function(t) { + this._impl.strokeColor = this._strokeColor = cc.color(t) + } + }, + fillColor: { + get: function() { + return this._fillColor + }, + set: function(t) { + this._impl.fillColor = this._fillColor = cc.color(t) + } + }, + miterLimit: { + get: function() { + return this._miterLimit + }, + set: function(t) { + this._miterLimit = t, + this._impl.miterLimit = t + } + } + }, + statics: { + LineJoin: a, + LineCap: s + }, + onRestore: function() { + this._impl || (this._impl = new o._Impl(this)) + }, + onDestroy: function() { + this.clear(!0), + this._super(), + this._impl = null + }, + _getDefaultMaterial: function() { + return n.getBuiltinMaterial("2d-graphics") + }, + _updateMaterial: function() { + var t = this._materials[0]; + t && (void 0 !== t.getDefine("CC_USE_MODEL") && t.define("CC_USE_MODEL", !0), + void 0 !== t.getDefine("CC_SUPPORT_standard_derivatives") && cc.sys.glExtension("OES_standard_derivatives") && t.define("CC_SUPPORT_standard_derivatives", !0)) + }, + moveTo: function(t, e) { + this._impl.moveTo(t, e) + }, + lineTo: function(t, e) { + this._impl.lineTo(t, e) + }, + bezierCurveTo: function(t, e, i, n, r, s) { + this._impl.bezierCurveTo(t, e, i, n, r, s) + }, + quadraticCurveTo: function(t, e, i, n) { + this._impl.quadraticCurveTo(t, e, i, n) + }, + arc: function(t, e, i, n, r, s) { + this._impl.arc(t, e, i, n, r, s) + }, + ellipse: function(t, e, i, n) { + this._impl.ellipse(t, e, i, n) + }, + circle: function(t, e, i) { + this._impl.circle(t, e, i) + }, + rect: function(t, e, i, n) { + this._impl.rect(t, e, i, n) + }, + roundRect: function(t, e, i, n, r) { + this._impl.roundRect(t, e, i, n, r) + }, + fillRect: function(t, e, i, n) { + this.rect(t, e, i, n), + this.fill() + }, + clear: function(t) { + this._impl.clear(t), + this._assembler && this._assembler.clear(t) + }, + close: function() { + this._impl.close() + }, + stroke: function() { + this._assembler || this._resetAssembler(), + this._assembler.stroke(this) + }, + fill: function() { + this._assembler || this._resetAssembler(), + this._assembler.fill(this) + } + }); + cc.Graphics = e.exports = o, + cc.Graphics.Types = r, + cc.Graphics.Helper = t("./helper") + } + ), { + "../assets/material/CCMaterial": 80, + "../components/CCRenderComponent": 115, + "./helper": 157, + "./types": 159 + }], + 157: [(function(t, e) { + "use strict"; + var i = t("./types").PointFlags + , n = Math.PI + , r = Math.min + , s = Math.max + , a = Math.cos + , o = Math.sin + , l = Math.abs + , h = Math.sign + , c = .5522847493; + e.exports = { + arc: function(t, e, i, h, c, u, _) { + var f, d, p, m = 0, y = 0, v = 0, g = 0, A = 0, x = 0, b = 0, C = 0, T = 0, S = 0, w = 0, E = 0, M = 0; + if (y = u - c, + _ = _ || !1) + if (l(y) >= 2 * n) + y = 2 * n; + else + for (; y < 0; ) + y += 2 * n; + else if (l(y) >= 2 * n) + y = 2 * -n; + else + for (; y > 0; ) + y -= 2 * n; + for (p = 0 | s(1, r(l(y) / (.5 * n) + .5, 5)), + v = l(4 / 3 * (1 - a(f = y / p / 2)) / o(f)), + _ || (v = -v), + d = 0; d <= p; d++) + x = e + (g = a(m = c + y * (d / p))) * h, + b = i + (A = o(m)) * h, + C = -A * h * v, + T = g * h * v, + 0 === d ? t.moveTo(x, b) : t.bezierCurveTo(S + E, w + M, x - C, b - T, x, b), + S = x, + w = b, + E = C, + M = T + }, + ellipse: function(t, e, i, n, r) { + t.moveTo(e - n, i), + t.bezierCurveTo(e - n, i + r * c, e - n * c, i + r, e, i + r), + t.bezierCurveTo(e + n * c, i + r, e + n, i + r * c, e + n, i), + t.bezierCurveTo(e + n, i - r * c, e + n * c, i - r, e, i - r), + t.bezierCurveTo(e - n * c, i - r, e - n, i - r * c, e - n, i), + t.close() + }, + roundRect: function(t, e, i, n, s, a) { + if (a < .1) + t.rect(e, i, n, s); + else { + var o = r(a, .5 * l(n)) * h(n) + , u = r(a, .5 * l(s)) * h(s); + t.moveTo(e, i + u), + t.lineTo(e, i + s - u), + t.bezierCurveTo(e, i + s - u * (1 - c), e + o * (1 - c), i + s, e + o, i + s), + t.lineTo(e + n - o, i + s), + t.bezierCurveTo(e + n - o * (1 - c), i + s, e + n, i + s - u * (1 - c), e + n, i + s - u), + t.lineTo(e + n, i + u), + t.bezierCurveTo(e + n, i + u * (1 - c), e + n - o * (1 - c), i, e + n - o, i), + t.lineTo(e + o, i), + t.bezierCurveTo(e + o * (1 - c), i, e, i + u * (1 - c), e, i + u), + t.close() + } + }, + tesselateBezier: function t(e, n, r, s, a, o, h, c, u, _, f) { + var d, p, m, y, v, g, A, x, b, C, T, S, w, E, M, D; + _ > 10 || (v = .5 * (o + c), + g = .5 * (h + u), + A = .5 * ((d = .5 * (n + s)) + (m = .5 * (s + o))), + x = .5 * ((p = .5 * (r + a)) + (y = .5 * (a + h))), + ((M = l((s - c) * (E = u - r) - (a - u) * (w = c - n))) + (D = l((o - c) * E - (h - u) * w))) * (M + D) < e._tessTol * (w * w + E * E) ? e._addPoint(c, u, 0 === f ? f | i.PT_BEVEL : f) : (t(e, n, r, d, p, A, x, T = .5 * (A + (b = .5 * (m + v))), S = .5 * (x + (C = .5 * (y + g))), _ + 1, 0), + t(e, T, S, b, C, v, g, c, u, _ + 1, f))) + } + } + } + ), { + "./types": 159 + }], + 158: [(function(t) { + "use strict"; + t("./graphics") + } + ), { + "./graphics": 156 + }], + 159: [(function(t, e) { + "use strict"; + var i = cc.Enum({ + BUTT: 0, + ROUND: 1, + SQUARE: 2 + }) + , n = cc.Enum({ + BEVEL: 0, + ROUND: 1, + MITER: 2 + }) + , r = cc.Enum({ + PT_CORNER: 1, + PT_LEFT: 2, + PT_BEVEL: 4, + PT_INNERBEVEL: 8 + }); + e.exports = { + LineCap: i, + LineJoin: n, + PointFlags: r + } + } + ), {}], + 160: [(function(t) { + "use strict"; + t("./platform"), + t("./assets"), + t("./CCNode"), + t("./CCPrivateNode"), + t("./CCScene"), + t("./components"), + t("./graphics"), + t("./collider"), + t("./collider/CCIntersection"), + t("./physics"), + t("./camera/CCCamera"), + t("./geom-utils"), + t("./mesh"), + t("./3d"), + t("./base-ui/CCWidgetManager") + } + ), { + "./3d": void 0, + "./CCNode": 29, + "./CCPrivateNode": 30, + "./CCScene": 31, + "./assets": 78, + "./base-ui/CCWidgetManager": 89, + "./camera/CCCamera": 90, + "./collider": 98, + "./collider/CCIntersection": 96, + "./components": 132, + "./geom-utils": 148, + "./graphics": 158, + "./mesh": 163, + "./physics": 178, + "./platform": 211 + }], + 161: [(function(t, e) { + "use strict"; + var i = s(t("../../renderer/core/input-assembler")) + , n = s(t("../../renderer/gfx")) + , r = t("./mesh-data"); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + var a = t("../renderer") + , o = t("../event/event-target"); + function l(t, e, i) { + t[e] = i._val + } + function h(t, e, i) { + t[e] = i.x, + t[e + 1] = i.y + } + function c(t, e, i) { + t[e] = i.x, + t[e + 1] = i.y, + t[e + 2] = i.z + } + var u, _ = { + 5120: "getInt8", + 5121: "getUint8", + 5122: "getInt16", + 5123: "getUint16", + 5124: "getInt32", + 5125: "getUint32", + 5126: "getFloat32" + }, f = { + 5120: "setInt8", + 5121: "setUint8", + 5122: "setInt16", + 5123: "setUint16", + 5124: "setInt32", + 5125: "setUint32", + 5126: "setFloat32" + }, d = (u = new ArrayBuffer(2), + new DataView(u).setInt16(0, 256, !0), + 256 === new Int16Array(u)[0]), p = cc.Class({ + name: "cc.Mesh", + extends: cc.Asset, + mixins: [o], + properties: { + _nativeAsset: { + override: !0, + get: function() { + return this._buffer + }, + set: function(t) { + this._buffer = ArrayBuffer.isView(t) ? t.buffer : t, + this.initWithBuffer() + } + }, + _vertexBundles: { + default: null, + type: r.VertexBundle + }, + _primitives: { + default: null, + Primitive: r.Primitive + }, + _minPos: cc.v3(), + _maxPos: cc.v3(), + subMeshes: { + get: function() { + return this._subMeshes + }, + set: function(t) { + this._subMeshes = t + } + }, + subDatas: { + get: function() { + return this._subDatas + } + } + }, + ctor: function() { + this._subMeshes = [], + this._subDatas = [], + this.loaded = !1 + }, + initWithBuffer: function() { + this._subMeshes.length = 0; + for (var t = this._primitives, e = 0; e < t.length; e++) { + var s = t[e] + , o = s.data + , l = new Uint8Array(this._buffer,o.offset,o.length) + , h = this._vertexBundles[s.vertexBundleIndices[0]] + , c = h.data + , u = new n.default.VertexFormat(h.formats) + , _ = new Uint8Array(this._buffer,c.offset,c.length) + , f = this._canVertexFormatBatch(u) + , d = new r.MeshData; + d.vData = _, + d.iData = l, + d.vfm = u, + d.offset = c.offset, + d.canBatch = f, + this._subDatas.push(d); + var p = new n.default.VertexBuffer(a.device,u,n.default.USAGE_STATIC,_) + , m = new n.default.IndexBuffer(a.device,s.indexUnit,n.default.USAGE_STATIC,l); + this._subMeshes.push(new i.default(p,m)) + } + this.loaded = !0, + this.emit("load") + }, + _canVertexFormatBatch: function(t) { + var e = t._attr2el[n.default.ATTR_POSITION]; + return !e || e.type === n.default.ATTR_TYPE_FLOAT32 && t._bytes % 4 == 0 + }, + init: function(t, e, s, o) { + void 0 === s && (s = !1), + void 0 === o && (o = 0); + var l = new Uint8Array(t._bytes * e) + , h = new r.MeshData; + h.vData = l, + h.vfm = t, + h.vDirty = !0, + h.canBatch = this._canVertexFormatBatch(t); + var c = new n.default.VertexBuffer(a.device,t,s ? n.default.USAGE_DYNAMIC : n.default.USAGE_STATIC,l); + h.vb = c, + this._subMeshes[o] = new i.default(h.vb); + var u = this._subDatas[o]; + u && (u.vb && u.vb.destroy(), + u.ib && u.ib.destroy()), + this._subDatas[o] = h, + this.loaded = !0, + this.emit("load"), + this.emit("init-format") + }, + setVertices: function(t, e, i) { + i = i || 0; + var r = this._subDatas[i] + , s = r.vfm.element(t); + if (!s) + return cc.warn("Cannot find " + t + " attribute in vertex defines."); + var a, o = "number" == typeof e[0], u = s.num, _ = o ? e.length / u | 0 : e.length; + r.vData.byteLength < _ * s.stride && r.setVData(new Uint8Array(_ * r.vfm._bytes)); + var f = 4; + t === n.default.ATTR_COLOR ? o ? (a = r.getVData(), + f = 1) : a = r.getVData(Uint32Array) : a = r.getVData(Float32Array); + var d = s.stride / f + , p = s.offset / f; + if (o) + for (var m = 0, y = e.length / u; m < y; m++) + for (var v = m * u, g = m * d + p, A = 0; A < u; A++) + a[g + A] = e[v + A]; + else { + var x; + x = t === n.default.ATTR_COLOR ? l : 2 === u ? h : c; + for (var b = 0, C = e.length; b < C; b++) + x(a, b * d + p, e[b]) + } + r.vDirty = !0 + }, + setIndices: function(t, e, i) { + e = e || 0; + var r = t; + t instanceof Uint16Array ? r = new Uint8Array(t.buffer,t.byteOffset,t.byteLength) : Array.isArray(t) && (r = new Uint16Array(t), + r = new Uint8Array(r.buffer,r.byteOffset,r.byteLength)); + var s = i ? n.default.USAGE_DYNAMIC : n.default.USAGE_STATIC + , o = this._subDatas[e]; + if (o.ib) + o.iData = r, + o.iDirty = !0; + else { + o.iData = r; + var l = new n.default.IndexBuffer(a.device,n.default.INDEX_FMT_UINT16,s,r,r.byteLength / n.default.IndexBuffer.BYTES_PER_INDEX[n.default.INDEX_FMT_UINT16]); + o.ib = l, + this._subMeshes[e]._indexBuffer = o.ib + } + }, + setPrimitiveType: function(t, e) { + e = e || 0, + this._subMeshes[e] ? this._subMeshes[e]._primitiveType = t : cc.warn("Do not have sub mesh at index " + e) + }, + clear: function() { + this._subMeshes.length = 0; + for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) { + var n = t[e].vb; + n && n.destroy(); + var r = t[e].ib; + r && r.destroy() + } + t.length = 0 + }, + setBoundingBox: function(t, e) { + this._minPos = t, + this._maxPos = e + }, + destroy: function() { + this.clear() + }, + _uploadData: function() { + for (var t = this._subDatas, e = 0, i = t.length; e < i; e++) { + var n = t[e]; + if (n.vDirty) { + var r = n.vb + , s = n.vData; + r.update(0, s), + n.vDirty = !1 + } + if (n.iDirty) { + var a = n.ib + , o = n.iData; + a.update(0, o), + n.iDirty = !1 + } + } + }, + _getAttrMeshData: function(t, e) { + var i = this._subDatas[t]; + if (!i) + return []; + var n = i.vfm + , r = n.element(e); + if (!r) + return []; + i.attrDatas || (i.attrDatas = {}); + var s = i.attrDatas + , a = s[e]; + if (a) + return a; + a = s[e] = []; + for (var o = i.vData, l = new DataView(o.buffer,o.byteOffset,o.byteLength), h = r.stride, c = r.offset, u = r.num, f = r.bytes / u, p = _[r.type], m = o.byteLength / n._bytes, y = 0; y < m; y++) + for (var v = y * h + c, g = 0; g < u; g++) { + var A = l[p](v + g * f, d); + a.push(A) + } + return a + }, + copyAttribute: function(t, e, i, n, r) { + var s = !1 + , a = this._subDatas[t]; + if (!a) + return s; + var o = a.vfm + , l = o.element(e); + if (!l) + return s; + var h = f[l.type]; + if (!h) + return s; + var c = this._getAttrMeshData(t, e) + , u = a.vData.byteLength / o._bytes + , _ = l.bytes / l.num; + if (c.length > 0) { + for (var p = new DataView(i,r), m = n, y = l.num, v = 0; v < u; ++v) + for (var g = v * y, A = 0; A < y; ++A) { + var x = g + A + , b = m * v + _ * A; + p[h](b, c[x], d) + } + s = !0 + } + return s + }, + copyIndices: function(t, e) { + var i = this._subDatas[t]; + if (!i) + return !1; + for (var r = i.iData, s = r.length / 2, a = new DataView(r.buffer,r.byteOffset,r.byteLength), o = _[n.default.INDEX_FMT_UINT8], l = 0; l < s; ++l) + e[l] = a[o](2 * l); + return !0 + } + }); + cc.Mesh = e.exports = p + } + ), { + "../../renderer/core/input-assembler": 305, + "../../renderer/gfx": 315, + "../event/event-target": 140, + "../renderer": 224, + "./mesh-data": 164 + }], + 162: [(function(t, e) { + "use strict"; + var i = s(t("../../renderer/gfx")) + , n = (s(t("../../renderer/core/input-assembler")), + s(t("../geom-utils/aabb"))) + , r = (s(t("../value-types/vec3")), + s(t("../value-types/mat4")), + s(t("../assets/material/material-variant"))); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + var a = t("../components/CCRenderComponent") + , o = t("./CCMesh") + , l = t("../renderer/render-flow") + , h = (t("../renderer"), + t("../assets/material/CCMaterial")) + , c = cc.Enum({ + OFF: 0, + ON: 1 + }) + , u = cc.Class({ + name: "cc.MeshRenderer", + extends: a, + editor: !1, + properties: { + _mesh: { + default: null, + type: o + }, + _receiveShadows: !1, + _shadowCastingMode: c.OFF, + _enableAutoBatch: !1, + mesh: { + get: function() { + return this._mesh + }, + set: function(t) { + this._mesh !== t && (this._setMesh(t), + t ? (this.markForRender(!0), + this.node._renderFlag |= l.FLAG_TRANSFORM) : this.disableRender()) + }, + type: o, + animatable: !1 + }, + textures: { + default: [], + type: cc.Texture2D, + visible: !1 + }, + receiveShadows: { + get: function() { + return this._receiveShadows + }, + set: function(t) { + this._receiveShadows = t, + this._updateReceiveShadow() + }, + animatable: !1 + }, + shadowCastingMode: { + get: function() { + return this._shadowCastingMode + }, + set: function(t) { + this._shadowCastingMode = t, + this._updateCastShadow() + }, + type: c, + animatable: !1 + }, + enableAutoBatch: { + get: function() { + return this._enableAutoBatch + }, + set: function(t) { + this._enableAutoBatch = t + } + } + }, + statics: { + ShadowCastingMode: c + }, + ctor: function() { + this._boundingBox = cc.geomUtils && new n.default + }, + onEnable: function() { + var t = this; + this._super(), + this._mesh && !this._mesh.loaded ? (this.disableRender(), + this._mesh.once("load", (function() { + t.isValid && (t._setMesh(t._mesh), + t.markForRender(!0)) + } + )), + cc.assetManager.postLoadNative(this._mesh)) : this._setMesh(this._mesh), + this._updateRenderNode(), + this._updateMaterial() + }, + onDestroy: function() { + this._setMesh(null), + cc.pool.assembler.put(this._assembler) + }, + _updateRenderNode: function() { + this._assembler.setRenderNode(this.node) + }, + _setMesh: function(t) { + cc.geomUtils && t && n.default.fromPoints(this._boundingBox, t._minPos, t._maxPos), + this._mesh && this._mesh.off("init-format", this._updateMeshAttribute, this), + t && t.on("init-format", this._updateMeshAttribute, this), + this._mesh = t, + this._assembler && (this._assembler._worldDatas = {}), + this._updateMeshAttribute() + }, + _getDefaultMaterial: function() { + return h.getBuiltinMaterial("unlit") + }, + _validateRender: function() { + var t = this._mesh; + t && t._subDatas.length > 0 || this.disableRender() + }, + _updateMaterial: function() { + var t = this.textures; + if (t && t.length > 0) + for (var e = this._getDefaultMaterial(), i = 0; i < t.length; i++) { + var n = this._materials[i]; + n && n._uuid !== e._uuid || (n || (n = r.default.create(e, this), + this.setMaterial(i, n)), + n.setProperty("diffuseTexture", t[i])) + } + this._updateReceiveShadow(), + this._updateCastShadow(), + this._updateMeshAttribute() + }, + _updateReceiveShadow: function() { + for (var t = this.getMaterials(), e = 0; e < t.length; e++) + t[e].define("CC_USE_SHADOW_MAP", this._receiveShadows, void 0, !0) + }, + _updateCastShadow: function() { + for (var t = this.getMaterials(), e = 0; e < t.length; e++) + t[e].define("CC_CASTING_SHADOW", this._shadowCastingMode === c.ON, void 0, !0) + }, + _updateMeshAttribute: function() { + var t = this._mesh && this._mesh.subDatas; + if (t) + for (var e = this.getMaterials(), n = 0; n < e.length && t[n]; n++) { + var r = t[n].vfm + , s = e[n]; + s.define("CC_USE_ATTRIBUTE_COLOR", !!r.element(i.default.ATTR_COLOR), void 0, !0), + s.define("CC_USE_ATTRIBUTE_UV0", !!r.element(i.default.ATTR_UV0), void 0, !0), + s.define("CC_USE_ATTRIBUTE_NORMAL", !!r.element(i.default.ATTR_NORMAL), void 0, !0), + s.define("CC_USE_ATTRIBUTE_TANGENT", !!r.element(i.default.ATTR_TANGENT), void 0, !0) + } + }, + _checkBacth: function() {} + }); + cc.MeshRenderer = e.exports = u + } + ), { + "../../renderer/core/input-assembler": 305, + "../../renderer/gfx": 315, + "../assets/material/CCMaterial": 80, + "../assets/material/material-variant": 87, + "../components/CCRenderComponent": 115, + "../geom-utils/aabb": 144, + "../renderer": 224, + "../renderer/render-flow": 225, + "../value-types/mat4": 284, + "../value-types/vec3": 292, + "./CCMesh": 161 + }], + 163: [(function(t) { + "use strict"; + t("./CCMesh"), + t("./CCMeshRenderer"), + t("./mesh-renderer") + } + ), { + "./CCMesh": 161, + "./CCMeshRenderer": 162, + "./mesh-renderer": 165 + }], + 164: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.MeshData = h, + i.Primitive = i.VertexBundle = i.VertexFormat = i.BufferRange = void 0; + var n, r = (n = t("../../renderer/gfx")) && n.__esModule ? n : { + default: n + }, s = cc.Class({ + name: "cc.BufferRange", + properties: { + offset: 0, + length: 0 + } + }); + i.BufferRange = s; + var a = cc.Class({ + name: "cc.mesh.VertexFormat", + properties: { + name: "", + type: -1, + num: -1, + normalize: !1 + } + }); + i.VertexFormat = a; + var o = cc.Class({ + name: "cc.mesh.VertexBundle", + properties: { + data: { + default: null, + type: s + }, + formats: { + default: [], + type: a + }, + verticesCount: 0 + } + }); + i.VertexBundle = o; + var l = cc.Class({ + name: "cc.mesh.Primitive", + properties: { + vertexBundleIndices: { + default: [], + type: cc.Float + }, + data: { + default: null, + type: s + }, + indexUnit: r.default.INDEX_FMT_UINT16, + topology: r.default.PT_TRIANGLES + } + }); + function h() { + this.vData = null, + this.float32VData = null, + this.uint32VData = null, + this.iData = null, + this.uint16IData = null, + this.vfm = null, + this.offset = 0, + this.vb = null, + this.ib = null, + this.vDirty = !1, + this.iDirty = !1, + this.enable = !0 + } + i.Primitive = l, + h.prototype.setVData = function(t) { + this.vData = t, + this.float32VData = null, + this.uint32VData = null + } + , + h.prototype.getVData = function(t) { + return t === Float32Array ? (this.float32VData || (this.float32VData = new Float32Array(this.vData.buffer,this.vData.byteOffset,this.vData.byteLength / 4)), + this.float32VData) : t === Uint32Array ? (this.uint32VData || (this.uint32VData = new Uint32Array(this.vData.buffer,this.vData.byteOffset,this.vData.byteLength / 4)), + this.uint32VData) : this.vData + } + , + h.prototype.getIData = function(t) { + return t === Uint16Array ? (this.uint16IData || (this.uint16IData = new Uint16Array(this.iData.buffer,this.iData.byteOffset,this.iData.byteLength / 2)), + this.uint16IData) : this.iData + } + } + ), { + "../../renderer/gfx": 315 + }], + 165: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = a(t("../renderer/assembler")) + , r = a(t("../../renderer/gfx")) + , s = a(t("../value-types/vec3")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + function o(t, e) { + return (o = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var l = t("./CCMeshRenderer") + , h = new s.default + , c = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + o(e, i); + var a = n.prototype; + return a.init = function(e) { + t.prototype.init.call(this, e), + this._worldDatas = {}, + this._renderNode = null + } + , + a.setRenderNode = function(t) { + this._renderNode = t + } + , + a.fillBuffers = function(t, e) { + if (t.mesh) { + t.mesh._uploadData(); + for (var i = e.cullingMask === t.node._cullingMask, n = t.enableAutoBatch, s = t._materials, a = t.mesh._subMeshes, o = t.mesh.subDatas, l = 0; l < a.length; l++) { + var h = a[l] + , c = o[l] + , u = s[l] || s[0]; + n && c.canBatch && h._primitiveType === r.default.PT_TRIANGLES ? (i && u.getHash() === e.material.getHash() || e._flush(), + e.material = u, + e.cullingMask = t.node._cullingMask, + e.node = e._dummyNode, + this._fillBuffer(t, c, e, l)) : (e._flush(), + e.material = u, + e.cullingMask = t.node._cullingMask, + e.node = this._renderNode, + e._flushIA(h)) + } + } + } + , + a._fillBuffer = function(t, e, i, n) { + var r = e.getVData(Float32Array) + , s = e.vfm + , a = r.byteLength / s._bytes | 0 + , o = e.getIData(Uint16Array) + , l = o.length + , h = i.getBuffer("mesh", s) + , c = h.request(a, l) + , u = c.indiceOffset + , _ = c.byteOffset >> 2 + , f = c.vertexOffset + , d = h._vData + , p = h._iData; + !i.worldMatDirty && this._worldDatas[n] || this._updateWorldVertices(n, a, r, s, t.node._worldMatrix), + d.set(this._worldDatas[n], _); + for (var m = 0; m < l; m++) + p[u + m] = f + o[m] + } + , + a._updateWorldVertices = function(t, e, i, n, a) { + var o = this._worldDatas[t]; + o || (o = this._worldDatas[t] = new Float32Array(i.length)).set(i); + for (var l = n._bytes / 4, c = n._elements, u = 0, _ = c.length; u < _; u++) { + var f = c[u] + , d = f.offset / 4; + if (f.name === r.default.ATTR_POSITION || f.name === r.default.ATTR_NORMAL) + for (var p = f.name === r.default.ATTR_NORMAL ? s.default.transformMat4Normal : s.default.transformMat4, m = 0; m < e; m++) { + var y = m * l + d; + h.x = i[y], + h.y = i[y + 1], + h.z = i[y + 2], + p(h, h, a), + o[y] = h.x, + o[y + 1] = h.y, + o[y + 2] = h.z + } + } + } + , + a._drawDebugDatas = function(t, e, i) { + var n = t._debugDatas[i]; + if (n) + for (var r = 0; r < n.length; r++) { + var s = n[r]; + if (s) { + var a = s.material; + e.material = a, + e._flushIA(s.ia) + } + } + } + , + n + } + )(n.default); + i.default = c, + n.default.register(l, c), + e.exports = i.default + } + ), { + "../../renderer/gfx": 315, + "../renderer/assembler": 221, + "../value-types/vec3": 292, + "./CCMeshRenderer": 162 + }], + 166: [(function(t, e) { + "use strict"; + var i = t("./component-scheduler") + , n = t("./platform/CCObject").Flags + , r = t("./platform/js") + , s = n.IsPreloadStarted + , a = n.IsOnLoadStarted + , o = n.IsOnLoadCalled + , l = n.Deactivating + , h = cc.Class({ + extends: i.LifeCycleInvoker, + add: function(t) { + this._zero.array.push(t) + }, + remove: function(t) { + this._zero.fastRemove(t) + }, + cancelInactive: function(t) { + i.LifeCycleInvoker.stableRemoveInactive(this._zero, t) + }, + invoke: function() { + this._invoke(this._zero), + this._zero.array.length = 0 + } + }) + , c = i.createInvokeImpl("c.__preload();") + , u = i.createInvokeImpl("c.onLoad();c._objFlags|=" + o, !1, o) + , _ = new r.Pool(4); + function f(t, e, i) { + e ? t._removeComponent(e) : r.array.removeAt(t._components, i) + } + function d() { + this._activatingStack = [] + } + _.get = function() { + var t = this._get() || { + preload: new h(c), + onLoad: new i.OneOffInvoker(u), + onEnable: new i.OneOffInvoker(i.invokeOnEnable) + }; + t.preload._zero.i = -1; + var e = t.onLoad; + return e._zero.i = -1, + e._neg.i = -1, + e._pos.i = -1, + (e = t.onEnable)._zero.i = -1, + e._neg.i = -1, + e._pos.i = -1, + t + } + ; + var p = cc.Class({ + ctor: d, + reset: d, + _activateNodeRecursively: function(t, e, i, n) { + if (t._objFlags & l) + cc.errorID(3816, t.name); + else { + t._activeInHierarchy = !0; + for (var r = t._components.length, s = 0; s < r; ++s) { + var a = t._components[s]; + a instanceof cc.Component ? this.activateComp(a, e, i, n) : (f(t, a, s), + --s, + --r) + } + t._childArrivalOrder = t._children.length; + for (var o = 0, h = t._children.length; o < h; ++o) { + var c = t._children[o]; + c._localZOrder = 4294901760 & c._localZOrder | o + 1, + c._active && this._activateNodeRecursively(c, e, i, n) + } + t._onPostActivated(!0) + } + }, + _deactivateNodeRecursively: function(t) { + t._objFlags |= l, + t._activeInHierarchy = !1; + for (var e = t._components.length, i = 0; i < e; ++i) { + var n = t._components[i]; + if (n._enabled && (cc.director._compScheduler.disableComp(n), + t._activeInHierarchy)) + return void (t._objFlags &= ~l) + } + for (var r = 0, s = t._children.length; r < s; ++r) { + var a = t._children[r]; + if (a._activeInHierarchy && (this._deactivateNodeRecursively(a), + t._activeInHierarchy)) + return void (t._objFlags &= ~l) + } + t._onPostActivated(!1), + t._objFlags &= ~l + }, + activateNode: function(t, e) { + if (e) { + var i = _.get(); + this._activatingStack.push(i), + this._activateNodeRecursively(t, i.preload, i.onLoad, i.onEnable), + i.preload.invoke(), + i.onLoad.invoke(), + i.onEnable.invoke(), + this._activatingStack.pop(), + _.put(i) + } else { + this._deactivateNodeRecursively(t); + for (var n = this._activatingStack, r = 0; r < n.length; r++) { + var o = n[r]; + o.preload.cancelInactive(s), + o.onLoad.cancelInactive(a), + o.onEnable.cancelInactive() + } + } + t.emit("active-in-hierarchy-changed", t) + }, + activateComp: function(t, e, i, n) { + if (cc.isValid(t, !0) && (t._objFlags & s || (t._objFlags |= s, + t.__preload && (e ? e.add(t) : t.__preload())), + t._objFlags & a || (t._objFlags |= a, + t.onLoad ? i ? i.add(t) : (t.onLoad(), + t._objFlags |= o) : t._objFlags |= o), + t._enabled)) { + if (!t.node._activeInHierarchy) + return; + cc.director._compScheduler.enableComp(t, n) + } + }, + destroyComp: function(t) { + cc.director._compScheduler.disableComp(t), + t.onDestroy && t._objFlags & o && t.onDestroy() + }, + resetComp: !1 + }); + e.exports = p + } + ), { + "./component-scheduler": 99, + "./platform/CCObject": 199, + "./platform/js": 214, + "./utils/misc": 267 + }], + 167: [(function(t, e) { + "use strict"; + var i = t("./CCPhysicsTypes").PTM_RATIO + , n = t("./CCPhysicsTypes").ContactType + , r = [] + , s = [cc.v2(), cc.v2()] + , a = new b2.WorldManifold + , o = { + points: [], + separations: [], + normal: cc.v2() + }; + function l() { + this.localPoint = cc.v2(), + this.normalImpulse = 0, + this.tangentImpulse = 0 + } + var h = [new l, new l] + , c = (new b2.Manifold, + { + type: 0, + localPoint: cc.v2(), + localNormal: cc.v2(), + points: [] + }) + , u = { + normalImpulses: [], + tangentImpulses: [] + }; + function _() {} + _.prototype.init = function(t) { + this.colliderA = t.GetFixtureA().collider, + this.colliderB = t.GetFixtureB().collider, + this.disabled = !1, + this.disabledOnce = !1, + this._impulse = null, + this._inverted = !1, + this._b2contact = t, + t._contact = this + } + , + _.prototype.reset = function() { + this.setTangentSpeed(0), + this.resetFriction(), + this.resetRestitution(), + this.colliderA = null, + this.colliderB = null, + this.disabled = !1, + this._impulse = null, + this._b2contact._contact = null, + this._b2contact = null + } + , + _.prototype.getWorldManifold = function() { + var t = o.points + , e = o.separations + , n = o.normal; + this._b2contact.GetWorldManifold(a); + var r = a.points + , l = a.separations + , h = this._b2contact.GetManifold().pointCount; + t.length = e.length = h; + for (var c = 0; c < h; c++) { + var u = s[c]; + u.x = r[c].x * i, + u.y = r[c].y * i, + t[c] = u, + e[c] = l[c] * i + } + return n.x = a.normal.x, + n.y = a.normal.y, + this._inverted && (n.x *= -1, + n.y *= -1), + o + } + , + _.prototype.getManifold = function() { + for (var t = c.points, e = c.localNormal, n = c.localPoint, r = this._b2contact.GetManifold(), s = r.points, a = t.length = r.pointCount, o = 0; o < a; o++) { + var l = h[o] + , u = s[o]; + l.localPoint.x = u.localPoint.x * i, + l.localPoint.Y = u.localPoint.Y * i, + l.normalImpulse = u.normalImpulse * i, + l.tangentImpulse = u.tangentImpulse, + t[o] = l + } + return n.x = r.localPoint.x * i, + n.y = r.localPoint.y * i, + e.x = r.localNormal.x, + e.y = r.localNormal.y, + c.type = r.type, + this._inverted && (e.x *= -1, + e.y *= -1), + c + } + , + _.prototype.getImpulse = function() { + var t = this._impulse; + if (!t) + return null; + for (var e = u.normalImpulses, n = u.tangentImpulses, r = t.count, s = 0; s < r; s++) + e[s] = t.normalImpulses[s] * i, + n[s] = t.tangentImpulses[s]; + return n.length = e.length = r, + u + } + , + _.prototype.emit = function(t) { + var e; + switch (t) { + case n.BEGIN_CONTACT: + e = "onBeginContact"; + break; + case n.END_CONTACT: + e = "onEndContact"; + break; + case n.PRE_SOLVE: + e = "onPreSolve"; + break; + case n.POST_SOLVE: + e = "onPostSolve" + } + var i, r, s, a, o = this.colliderA, l = this.colliderB, h = o.body, c = l.body; + if (h.enabledContactListener) + for (i = h.node._components, + this._inverted = !1, + r = 0, + s = i.length; r < s; r++) + (a = i[r])[e] && a[e](this, o, l); + if (c.enabledContactListener) + for (i = c.node._components, + this._inverted = !0, + r = 0, + s = i.length; r < s; r++) + (a = i[r])[e] && a[e](this, l, o); + (this.disabled || this.disabledOnce) && (this.setEnabled(!1), + this.disabledOnce = !1) + } + , + _.get = function(t) { + var e; + return (e = 0 === r.length ? new cc.PhysicsContact : r.pop()).init(t), + e + } + , + _.put = function(t) { + var e = t._contact; + e && (r.push(e), + e.reset()) + } + ; + var f = _.prototype; + f.setEnabled = function(t) { + this._b2contact.SetEnabled(t) + } + , + f.isTouching = function() { + return this._b2contact.IsTouching() + } + , + f.setTangentSpeed = function(t) { + this._b2contact.SetTangentSpeed(t / i) + } + , + f.getTangentSpeed = function() { + return this._b2contact.GetTangentSpeed() * i + } + , + f.setFriction = function(t) { + this._b2contact.SetFriction(t) + } + , + f.getFriction = function() { + return this._b2contact.GetFriction() + } + , + f.resetFriction = function() { + return this._b2contact.ResetFriction() + } + , + f.setRestitution = function(t) { + this._b2contact.SetRestitution(t) + } + , + f.getRestitution = function() { + return this._b2contact.GetRestitution() + } + , + f.resetRestitution = function() { + return this._b2contact.ResetRestitution() + } + , + _.ContactType = n, + cc.PhysicsContact = e.exports = _ + } + ), { + "./CCPhysicsTypes": 169 + }], + 168: [(function(t, e) { + "use strict"; + var i = t("./CCPhysicsTypes") + , n = i.ContactType + , r = i.BodyType + , s = i.RayCastType + , a = i.DrawBits + , o = i.PTM_RATIO + , l = (i.ANGLE_TO_PHYSICS_ANGLE, + i.PHYSICS_ANGLE_TO_ANGLE) + , h = t("./utils").convertToNodeRotation + , c = t("./platform/CCPhysicsDebugDraw") + , u = new b2.AABB + , _ = new b2.Vec2 + , f = new b2.Vec2 + , d = cc.v2() + , p = cc.Class({ + mixins: [cc.EventTarget], + statics: { + DrawBits: a, + PTM_RATIO: o, + VELOCITY_ITERATIONS: 10, + POSITION_ITERATIONS: 10, + FIXED_TIME_STEP: 1 / 60, + MAX_ACCUMULATOR: .2 + }, + ctor: function() { + this._debugDrawFlags = 0, + this._debugDrawer = null, + this._world = null, + this._bodies = [], + this._joints = [], + this._contactMap = {}, + this._contactID = 0, + this._delayEvents = [], + this._accumulator = 0, + cc.director._scheduler && cc.director._scheduler.enableForTarget(this), + this.enabledAccumulator = !1 + }, + pushDelayEvent: function(t, e, i) { + this._steping ? this._delayEvents.push({ + target: t, + func: e, + args: i + }) : t[e].apply(t, i) + }, + update: function(t) { + var e = this._world; + if (e && this.enabled) { + this.emit("before-step"), + this._steping = !0; + var i = p.VELOCITY_ITERATIONS + , n = p.POSITION_ITERATIONS; + if (this.enabledAccumulator) { + this._accumulator += t; + var r = p.FIXED_TIME_STEP + , s = p.MAX_ACCUMULATOR; + for (this._accumulator > s && (this._accumulator = s); this._accumulator > r; ) + e.Step(r, i, n), + this._accumulator -= r + } else { + var a = 1 / cc.game.config.frameRate; + e.Step(a, i, n) + } + this.debugDrawFlags && (this._checkDebugDrawValid(), + this._debugDrawer.clear(), + e.DrawDebugData()), + this._steping = !1; + for (var o = this._delayEvents, l = 0, h = o.length; l < h; l++) { + var c = o[l]; + c.target[c.func].apply(c.target, c.args) + } + o.length = 0, + this._syncNode() + } + }, + testPoint: function(t) { + var e = _.x = t.x / o + , i = _.y = t.y / o + , n = .2 / o; + u.lowerBound.x = e - n, + u.lowerBound.y = i - n, + u.upperBound.x = e + n, + u.upperBound.y = i + n; + var r = this._aabbQueryCallback; + r.init(_), + this._world.QueryAABB(r, u); + var s = r.getFixture(); + return s ? s.collider : null + }, + testAABB: function(t) { + u.lowerBound.x = t.xMin / o, + u.lowerBound.y = t.yMin / o, + u.upperBound.x = t.xMax / o, + u.upperBound.y = t.yMax / o; + var e = this._aabbQueryCallback; + return e.init(), + this._world.QueryAABB(e, u), + e.getFixtures().map((function(t) { + return t.collider + } + )) + }, + rayCast: function(t, e, i) { + if (t.equals(e)) + return []; + i = i || s.Closest, + _.x = t.x / o, + _.y = t.y / o, + f.x = e.x / o, + f.y = e.y / o; + var n = this._raycastQueryCallback; + n.init(i), + this._world.RayCast(n, _, f); + var r = n.getFixtures(); + if (r.length > 0) { + for (var a = n.getPoints(), l = n.getNormals(), h = n.getFractions(), c = [], u = 0, d = r.length; u < d; u++) { + var p = r[u] + , m = p.collider; + if (i === s.AllClosest) { + var y = c.find((function(t) { + return t.collider === m + } + )); + if (y) { + h[u] < y.fraction && (y.fixtureIndex = m._getFixtureIndex(p), + y.point.x = a[u].x * o, + y.point.y = a[u].y * o, + y.normal.x = l[u].x, + y.normal.y = l[u].y, + y.fraction = h[u]); + continue + } + } + c.push({ + collider: m, + fixtureIndex: m._getFixtureIndex(p), + point: cc.v2(a[u].x * o, a[u].y * o), + normal: cc.v2(l[u]), + fraction: h[u] + }) + } + return c + } + return [] + }, + syncPosition: function() { + for (var t = this._bodies, e = 0; e < t.length; e++) + t[e].syncPosition() + }, + syncRotation: function() { + for (var t = this._bodies, e = 0; e < t.length; e++) + t[e].syncRotation() + }, + _registerContactFixture: function(t) { + this._contactListener.registerContactFixture(t) + }, + _unregisterContactFixture: function(t) { + this._contactListener.unregisterContactFixture(t) + }, + _addBody: function(t, e) { + var i = this._world + , n = t.node; + i && n && (t._b2Body = i.CreateBody(e), + t._b2Body.body = t, + this._bodies.push(t)) + }, + _removeBody: function(t) { + var e = this._world; + e && (t._b2Body.body = null, + e.DestroyBody(t._b2Body), + t._b2Body = null, + cc.js.array.remove(this._bodies, t)) + }, + _addJoint: function(t, e) { + var i = this._world.CreateJoint(e); + i && (i._joint = t, + t._joint = i, + this._joints.push(t)) + }, + _removeJoint: function(t) { + t._isValid() && this._world.DestroyJoint(t._joint), + t._joint && (t._joint._joint = null), + cc.js.array.remove(this._joints, t) + }, + _initCallback: function() { + if (this._world) { + if (!this._contactListener) { + var t = new cc.PhysicsContactListener; + t.setBeginContact(this._onBeginContact), + t.setEndContact(this._onEndContact), + t.setPreSolve(this._onPreSolve), + t.setPostSolve(this._onPostSolve), + this._world.SetContactListener(t), + this._contactListener = t, + this._aabbQueryCallback = new cc.PhysicsAABBQueryCallback, + this._raycastQueryCallback = new cc.PhysicsRayCastCallback + } + } else + cc.warn("Please init PhysicsManager first") + }, + _init: function() { + this.enabled = !0, + this.debugDrawFlags = a.e_shapeBit + }, + _getWorld: function() { + return this._world + }, + _syncNode: function() { + for (var t = this._bodies, e = 0, i = t.length; e < i; e++) { + var n = t[e] + , s = n.node + , a = n._b2Body + , c = a.GetPosition(); + d.x = c.x * o, + d.y = c.y * o; + var u = a.GetAngle() * l; + null !== s.parent.parent && (d = s.parent.convertToNodeSpaceAR(d), + u = h(s.parent, u)); + var _ = s._eventMask; + s._eventMask = 0, + s.position = d, + s.angle = -u, + s._eventMask = _, + n.type === r.Animated && n.resetVelocity() + } + }, + _onBeginContact: function(t) { + cc.PhysicsContact.get(t).emit(n.BEGIN_CONTACT) + }, + _onEndContact: function(t) { + var e = t._contact; + e && (e.emit(n.END_CONTACT), + cc.PhysicsContact.put(t)) + }, + _onPreSolve: function(t) { + var e = t._contact; + e && e.emit(n.PRE_SOLVE) + }, + _onPostSolve: function(t, e) { + var i = t._contact; + i && (i._impulse = e, + i.emit(n.POST_SOLVE), + i._impulse = null) + }, + _checkDebugDrawValid: function() { + if (!this._debugDrawer || !this._debugDrawer.isValid) { + var t = new cc.Node("PHYSICS_MANAGER_DEBUG_DRAW"); + t.zIndex = cc.macro.MAX_ZINDEX, + cc.game.addPersistRootNode(t), + this._debugDrawer = t.addComponent(cc.Graphics); + var e = new c(this._debugDrawer); + e.SetFlags(this.debugDrawFlags), + this._world.SetDebugDraw(e) + } + } + }); + cc.js.getset(p.prototype, "enabled", (function() { + return this._enabled + } + ), (function(t) { + if (t && !this._world) { + var e = new b2.World(new b2.Vec2(0,-10)); + e.SetAllowSleeping(!0), + this._world = e, + this._initCallback() + } + this._enabled = t + } + )), + cc.js.getset(p.prototype, "debugDrawFlags", (function() { + return this._debugDrawFlags + } + ), (function(t) { + t && !this._debugDrawFlags ? this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !0) : !t && this._debugDrawFlags && this._debugDrawer && this._debugDrawer.node && (this._debugDrawer.node.active = !1), + t && (this._checkDebugDrawValid(), + this._world.m_debugDraw.SetFlags(t)), + this._debugDrawFlags = t, + t && (this._checkDebugDrawValid(), + this._world.m_debugDraw.SetFlags(t)) + } + )), + cc.js.getset(p.prototype, "gravity", (function() { + if (this._world) { + var t = this._world.GetGravity(); + return cc.v2(t.x * o, t.y * o) + } + return cc.v2() + } + ), (function(t) { + this._world && this._world.SetGravity(new b2.Vec2(t.x / o,t.y / o)) + } + )), + cc.PhysicsManager = e.exports = p + } + ), { + "./CCPhysicsTypes": 169, + "./platform/CCPhysicsDebugDraw": 190, + "./utils": 192 + }], + 169: [(function(t, e) { + "use strict"; + var i = cc.Enum({ + Static: 0, + Kinematic: 1, + Dynamic: 2, + Animated: 3 + }); + cc.RigidBodyType = i; + var n = cc.Enum({ + Closest: 0, + Any: 1, + AllClosest: 2, + All: 3 + }); + cc.RayCastType = n, + e.exports = { + BodyType: i, + ContactType: { + BEGIN_CONTACT: "begin-contact", + END_CONTACT: "end-contact", + PRE_SOLVE: "pre-solve", + POST_SOLVE: "post-solve" + }, + RayCastType: n, + DrawBits: b2.DrawFlags, + PTM_RATIO: 32, + ANGLE_TO_PHYSICS_ANGLE: -Math.PI / 180, + PHYSICS_ANGLE_TO_ANGLE: -180 / Math.PI + } + } + ), {}], + 170: [(function(t, e) { + "use strict"; + function i(t, e) { + var i = e.length; + return e[t < 0 ? i - -t % i : t % i] + } + function n(t, e, n) { + for (var r = []; e < t; ) + e += n.length; + for (; t <= e; ++t) + r.push(i(t, n)); + return r + } + function r(t, e, n) { + if (s(t, n)) { + if (l(i(t, n), i(t - 1, n), i(e, n)) && h(i(t, n), i(t + 1, n), i(e, n))) + return !1 + } else if (h(i(t, n), i(t + 1, n), i(e, n)) || l(i(t, n), i(t - 1, n), i(e, n))) + return !1; + if (s(e, n)) { + if (l(i(e, n), i(e - 1, n), i(t, n)) && h(i(e, n), i(e + 1, n), i(t, n))) + return !1 + } else if (h(i(e, n), i(e + 1, n), i(t, n)) || l(i(e, n), i(e - 1, n), i(t, n))) + return !1; + for (var r = 0; r < n.length; ++r) + if ((r + 1) % n.length != t && r != t && (r + 1) % n.length != e && r != e) { + var a = cc.v2(); + if (p(i(t, n), i(e, n), i(r, n), i(r + 1, n), a)) + return !1 + } + return !0 + } + function s(t, e) { + return a(t, e) + } + function a(t, e, n) { + if (void 0 === n) { + var r = t + , s = e; + t = i(r - 1, s), + e = i(r, s), + n = i(r + 1, s) + } + return m(t, e, n) < 0 + } + function o(t, e, i) { + return m(t, e, i) > 0 + } + function l(t, e, i) { + return m(t, e, i) >= 0 + } + function h(t, e, i) { + return m(t, e, i) <= 0 + } + function c(t, e) { + var i = e.x - t.x + , n = e.y - t.y; + return i * i + n * n + } + function u(t) { + _(t) || t.reverse() + } + function _(t) { + return t.length < 3 || f(t) > 0 + } + function f(t) { + var e, i = 0; + for (e = 0; e < t.length; e++) { + var n = (e + 1) % t.length; + i += t[e].x * t[n].y, + i -= t[e].y * t[n].x + } + return i / 2 + } + function d(t, e, i, n) { + var r, s = cc.v2(), a = e.y - t.y, o = t.x - e.x, l = a * t.x + o * t.y, h = n.y - i.y, c = i.x - n.x, u = h * i.x + c * i.y, _ = a * c - h * o; + return r = _, + 0, + Math.abs(r - 0) <= 1e-6 || (s.x = (c * l - o * u) / _, + s.y = (a * u - h * l) / _), + s + } + function p(t, e, i, n, r) { + if (t == i || t == n || e == i || e == n) + return !1; + var s = t.x + , a = t.y + , o = e.x + , l = e.y + , h = i.x + , c = i.y + , u = n.x + , _ = n.y; + if (Math.max(s, o) < Math.min(h, u) || Math.max(h, u) < Math.min(s, o)) + return !1; + if (Math.max(a, l) < Math.min(c, _) || Math.max(c, _) < Math.min(a, l)) + return !1; + var f = (u - h) * (a - c) - (_ - c) * (s - h) + , d = (o - s) * (a - c) - (l - a) * (s - h) + , p = (_ - c) * (o - s) - (u - h) * (l - a); + return !(Math.abs(p) < 1e-6) && (d /= p, + 0 < (f /= p) && f < 1 && 0 < d && d < 1 && (r.x = s + f * (o - s), + r.y = a + f * (l - a), + !0)) + } + function m(t, e, i) { + return t.x * (e.y - i.y) + e.x * (i.y - t.y) + i.x * (t.y - e.y) + } + e.exports = { + ConvexPartition: function t(e) { + u(e); + for (var _, f, p, m, y, v, g = [], A = cc.v2(), x = cc.v2(), b = 0, C = 0, T = 0; T < e.length; ++T) + if (s(T, e)) { + f = p = 1e8; + for (var S = 0; S < e.length; ++S) + o(i(T - 1, e), i(T, e), i(S, e)) && h(i(T - 1, e), i(T, e), i(S - 1, e)) && (m = d(i(T - 1, e), i(T, e), i(S, e), i(S - 1, e)), + a(i(T + 1, e), i(T, e), m) && (_ = c(i(T, e), m)) < f && (f = _, + A = m, + b = S)), + o(i(T + 1, e), i(T, e), i(S + 1, e)) && h(i(T + 1, e), i(T, e), i(S, e)) && (m = d(i(T + 1, e), i(T, e), i(S, e), i(S + 1, e)), + o(i(T - 1, e), i(T, e), m) && (_ = c(i(T, e), m)) < p && (p = _, + C = S, + x = m)); + if (b == (C + 1) % e.length) { + var w = A.add(x).div(2); + (y = n(T, C, e)).push(w), + (v = n(b, T, e)).push(w) + } else { + for (var E = 0, M = b; C < b; ) + C += e.length; + for (S = b; S <= C; ++S) + if (r(T, S, e)) { + var D = 1 / (c(i(T, e), i(S, e)) + 1); + s(S, e) ? h(i(S - 1, e), i(S, e), i(T, e)) && l(i(S + 1, e), i(S, e), i(T, e)) ? D += 3 : D += 2 : D += 1, + D > E && (M = S, + E = D) + } + y = n(T, M, e), + v = n(M, T, e) + } + return (g = g.concat(t(y))).concat(t(v)) + } + for (g.push(e), + T = g.length - 1; T >= 0; T--) + 0 == g[T].length && g.splice(T, 0); + return g + }, + ForceCounterClockWise: u, + IsCounterClockWise: _ + } + } + ), {}], + 171: [(function(t, e) { + "use strict"; + var i = t("../CCNode").EventType + , n = t("./CCPhysicsTypes").PTM_RATIO + , r = t("./CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE + , s = t("./CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE + , a = t("./utils").getWorldRotation + , o = t("./CCPhysicsTypes").BodyType + , l = new b2.Vec2 + , h = new b2.Vec2 + , c = cc.Vec2.ZERO + , u = cc.Class({ + name: "cc.RigidBody", + extends: cc.Component, + editor: !1, + properties: { + _type: o.Dynamic, + _allowSleep: !0, + _gravityScale: 1, + _linearDamping: 0, + _angularDamping: 0, + _linearVelocity: cc.v2(0, 0), + _angularVelocity: 0, + _fixedRotation: !1, + enabled: { + get: function() { + return this._enabled + }, + set: function() { + cc.warnID(8200) + }, + visible: !1, + override: !0 + }, + enabledContactListener: { + default: !1, + tooltip: !1 + }, + bullet: { + default: !1, + tooltip: !1 + }, + type: { + type: o, + tooltip: !1, + get: function() { + return this._type + }, + set: function(t) { + this._type = t, + this._b2Body && (t === o.Animated ? this._b2Body.SetType(o.Kinematic) : this._b2Body.SetType(t)) + } + }, + allowSleep: { + tooltip: !1, + get: function() { + return this._b2Body ? this._b2Body.IsSleepingAllowed() : this._allowSleep + }, + set: function(t) { + this._allowSleep = t, + this._b2Body && this._b2Body.SetSleepingAllowed(t) + } + }, + gravityScale: { + tooltip: !1, + get: function() { + return this._gravityScale + }, + set: function(t) { + this._gravityScale = t, + this._b2Body && this._b2Body.SetGravityScale(t) + } + }, + linearDamping: { + tooltip: !1, + get: function() { + return this._linearDamping + }, + set: function(t) { + this._linearDamping = t, + this._b2Body && this._b2Body.SetLinearDamping(this._linearDamping) + } + }, + angularDamping: { + tooltip: !1, + get: function() { + return this._angularDamping + }, + set: function(t) { + this._angularDamping = t, + this._b2Body && this._b2Body.SetAngularDamping(t) + } + }, + linearVelocity: { + tooltip: !1, + type: cc.Vec2, + get: function() { + var t = this._linearVelocity; + if (this._b2Body) { + var e = this._b2Body.GetLinearVelocity(); + t.x = e.x * n, + t.y = e.y * n + } + return t + }, + set: function(t) { + this._linearVelocity = t; + var e = this._b2Body; + if (e) { + var i = e.m_linearVelocity; + i.Set(t.x / n, t.y / n), + e.SetLinearVelocity(i) + } + } + }, + angularVelocity: { + tooltip: !1, + get: function() { + return this._b2Body ? this._b2Body.GetAngularVelocity() * s : this._angularVelocity + }, + set: function(t) { + this._angularVelocity = t, + this._b2Body && this._b2Body.SetAngularVelocity(t * r) + } + }, + fixedRotation: { + tooltip: !1, + get: function() { + return this._fixedRotation + }, + set: function(t) { + this._fixedRotation = t, + this._b2Body && this._b2Body.SetFixedRotation(t) + } + }, + awake: { + visible: !1, + tooltip: !1, + get: function() { + return !!this._b2Body && this._b2Body.IsAwake() + }, + set: function(t) { + this._b2Body && this._b2Body.SetAwake(t) + } + }, + awakeOnLoad: { + default: !0, + tooltip: !1, + animatable: !1 + }, + active: { + visible: !1, + get: function() { + return !!this._b2Body && this._b2Body.IsActive() + }, + set: function(t) { + this._b2Body && this._b2Body.SetActive(t) + } + } + }, + getLocalPoint: function(t, e) { + if (e = e || cc.v2(), + this._b2Body) { + l.Set(t.x / n, t.y / n); + var i = this._b2Body.GetLocalPoint(l, e); + e.x = i.x * n, + e.y = i.y * n + } + return e + }, + getWorldPoint: function(t, e) { + if (e = e || cc.v2(), + this._b2Body) { + l.Set(t.x / n, t.y / n); + var i = this._b2Body.GetWorldPoint(l, e); + e.x = i.x * n, + e.y = i.y * n + } + return e + }, + getWorldVector: function(t, e) { + if (e = e || cc.v2(), + this._b2Body) { + l.Set(t.x / n, t.y / n); + var i = this._b2Body.GetWorldVector(l, e); + e.x = i.x * n, + e.y = i.y * n + } + return e + }, + getLocalVector: function(t, e) { + if (e = e || cc.v2(), + this._b2Body) { + l.Set(t.x / n, t.y / n); + var i = this._b2Body.GetLocalVector(l, e); + e.x = i.x * n, + e.y = i.y * n + } + return e + }, + getWorldPosition: function(t) { + if (t = t || cc.v2(), + this._b2Body) { + var e = this._b2Body.GetPosition(); + t.x = e.x * n, + t.y = e.y * n + } + return t + }, + getWorldRotation: function() { + return this._b2Body ? this._b2Body.GetAngle() * s : 0 + }, + getLocalCenter: function(t) { + if (t = t || cc.v2(), + this._b2Body) { + var e = this._b2Body.GetLocalCenter(); + t.x = e.x * n, + t.y = e.y * n + } + return t + }, + getWorldCenter: function(t) { + if (t = t || cc.v2(), + this._b2Body) { + var e = this._b2Body.GetWorldCenter(); + t.x = e.x * n, + t.y = e.y * n + } + return t + }, + getLinearVelocityFromWorldPoint: function(t, e) { + if (e = e || cc.v2(), + this._b2Body) { + l.Set(t.x / n, t.y / n); + var i = this._b2Body.GetLinearVelocityFromWorldPoint(l, e); + e.x = i.x * n, + e.y = i.y * n + } + return e + }, + getMass: function() { + return this._b2Body ? this._b2Body.GetMass() : 0 + }, + getInertia: function() { + return this._b2Body ? this._b2Body.GetInertia() * n * n : 0 + }, + getJointList: function() { + if (!this._b2Body) + return []; + var t = [] + , e = this._b2Body.GetJointList(); + if (!e) + return []; + t.push(e.joint._joint); + for (var i = e.prev; i; ) + t.push(i.joint._joint), + i = i.prev; + for (var n = e.next; n; ) + t.push(n.joint._joint), + n = n.next; + return t + }, + applyForce: function(t, e, i) { + this._b2Body && (l.Set(t.x / n, t.y / n), + h.Set(e.x / n, e.y / n), + this._b2Body.ApplyForce(l, h, i)) + }, + applyForceToCenter: function(t, e) { + this._b2Body && (l.Set(t.x / n, t.y / n), + this._b2Body.ApplyForceToCenter(l, e)) + }, + applyTorque: function(t, e) { + this._b2Body && this._b2Body.ApplyTorque(t / n, e) + }, + applyLinearImpulse: function(t, e, i) { + this._b2Body && (l.Set(t.x / n, t.y / n), + h.Set(e.x / n, e.y / n), + this._b2Body.ApplyLinearImpulse(l, h, i)) + }, + applyAngularImpulse: function(t, e) { + this._b2Body && this._b2Body.ApplyAngularImpulse(t / n / n, e) + }, + syncPosition: function(t) { + var e = this._b2Body; + if (e) { + var i, r = this.node.convertToWorldSpaceAR(c); + if ((i = this.type === o.Animated ? e.GetLinearVelocity() : e.GetPosition()).x = r.x / n, + i.y = r.y / n, + this.type === o.Animated && t) { + var s = e.GetPosition() + , a = cc.game.config.frameRate; + i.x = (i.x - s.x) * a, + i.y = (i.y - s.y) * a, + e.SetAwake(!0), + e.SetLinearVelocity(i) + } else + e.SetTransformVec(i, e.GetAngle()) + } + }, + syncRotation: function(t) { + var e = this._b2Body; + if (e) { + var i = r * a(this.node); + if (this.type === o.Animated && t) { + var n = e.GetAngle() + , s = cc.game.config.frameRate; + e.SetAwake(!0), + e.SetAngularVelocity((i - n) * s) + } else + e.SetTransformVec(e.GetPosition(), i) + } + }, + resetVelocity: function() { + var t = this._b2Body; + if (t) { + var e = t.m_linearVelocity; + e.Set(0, 0), + t.SetLinearVelocity(e), + t.SetAngularVelocity(0) + } + }, + onEnable: function() { + this._init() + }, + onDisable: function() { + this._destroy() + }, + _registerNodeEvents: function() { + var t = this.node; + t.on(i.POSITION_CHANGED, this._onNodePositionChanged, this), + t.on(i.ROTATION_CHANGED, this._onNodeRotationChanged, this), + t.on(i.SCALE_CHANGED, this._onNodeScaleChanged, this) + }, + _unregisterNodeEvents: function() { + var t = this.node; + t.off(i.POSITION_CHANGED, this._onNodePositionChanged, this), + t.off(i.ROTATION_CHANGED, this._onNodeRotationChanged, this), + t.off(i.SCALE_CHANGED, this._onNodeScaleChanged, this) + }, + _onNodePositionChanged: function() { + this.syncPosition(!0) + }, + _onNodeRotationChanged: function() { + this.syncRotation(!0) + }, + _onNodeScaleChanged: function() { + if (this._b2Body) + for (var t = this.getComponents(cc.PhysicsCollider), e = 0; e < t.length; e++) + t[e].apply() + }, + _init: function() { + cc.director.getPhysicsManager().pushDelayEvent(this, "__init", []) + }, + _destroy: function() { + cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", []) + }, + __init: function() { + if (!this._inited) { + this._registerNodeEvents(); + var t = new b2.BodyDef; + this.type === o.Animated ? t.type = o.Kinematic : t.type = this.type, + t.allowSleep = this.allowSleep, + t.gravityScale = this.gravityScale, + t.linearDamping = this.linearDamping, + t.angularDamping = this.angularDamping; + var e = this.linearVelocity; + t.linearVelocity = new b2.Vec2(e.x / n,e.y / n), + t.angularVelocity = this.angularVelocity * r, + t.fixedRotation = this.fixedRotation, + t.bullet = this.bullet; + var i = this.node + , s = i.convertToWorldSpaceAR(c); + t.position = new b2.Vec2(s.x / n,s.y / n), + t.angle = -Math.PI / 180 * a(i), + t.awake = this.awakeOnLoad, + cc.director.getPhysicsManager()._addBody(this, t), + this._inited = !0 + } + }, + __destroy: function() { + this._inited && (cc.director.getPhysicsManager()._removeBody(this), + this._unregisterNodeEvents(), + this._inited = !1) + }, + _getBody: function() { + return this._b2Body + } + }); + cc.RigidBody = e.exports = u + } + ), { + "../CCNode": 29, + "./CCPhysicsTypes": 169, + "./utils": 192 + }], + 172: [(function(t) { + "use strict"; + var e = t("../../../external/box2d/box2d"); + for (var i in window.b2 = {}, + e) + if (-1 === i.indexOf("b2_")) { + var n = i.replace("b2", ""); + b2[n] = e[i] + } + b2.maxPolygonVertices = 8 + } + ), { + "../../../external/box2d/box2d": 377 + }], + 173: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = cc.Class({ + name: "cc.PhysicsBoxCollider", + extends: cc.PhysicsCollider, + mixins: [cc.Collider.Box], + editor: { + menu: !1, + requireComponent: cc.RigidBody + }, + _createShape: function(t) { + var e = Math.abs(t.x) + , n = Math.abs(t.y) + , r = this.size.width / 2 / i * e + , s = this.size.height / 2 / i * n + , a = this.offset.x / i * e + , o = this.offset.y / i * n + , l = new b2.PolygonShape; + return l.SetAsBox(r, s, new b2.Vec2(a,o), 0), + l + } + }); + cc.PhysicsBoxCollider = e.exports = n + } + ), { + "../CCPhysicsTypes": 169 + }], + 174: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = cc.Class({ + name: "cc.PhysicsChainCollider", + extends: cc.PhysicsCollider, + editor: { + menu: !1, + inspector: !1, + requireComponent: cc.RigidBody + }, + properties: { + loop: !1, + points: { + default: function() { + return [cc.v2(-50, 0), cc.v2(50, 0)] + }, + type: [cc.Vec2] + }, + threshold: { + default: 1, + serializable: !1, + visible: !1 + } + }, + _createShape: function(t) { + for (var e = new b2.ChainShape, n = this.points, r = [], s = 0; s < n.length; s++) { + var a = n[s]; + r.push(new b2.Vec2(a.x / i * t.x,a.y / i * t.y)) + } + return this.loop ? e.CreateLoop(r, r.length) : e.CreateChain(r, r.length), + e + }, + resetInEditor: !1, + resetPointsByContour: !1 + }); + cc.PhysicsChainCollider = e.exports = n + } + ), { + "../CCPhysicsTypes": 169 + }], + 175: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = cc.Class({ + name: "cc.PhysicsCircleCollider", + extends: cc.PhysicsCollider, + mixins: [cc.Collider.Circle], + editor: { + menu: !1, + requireComponent: cc.RigidBody + }, + _createShape: function(t) { + var e = Math.abs(t.x) + , n = Math.abs(t.y) + , r = this.offset.x / i * e + , s = this.offset.y / i * n + , a = new b2.CircleShape; + return a.m_radius = this.radius / i * e, + a.m_p = new b2.Vec2(r,s), + a + } + }); + cc.PhysicsCircleCollider = e.exports = n + } + ), { + "../CCPhysicsTypes": 169 + }], + 176: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = t("../utils").getWorldScale + , r = new b2.AABB + , s = cc.Class({ + name: "cc.PhysicsCollider", + extends: cc.Collider, + ctor: function() { + this._fixtures = [], + this._shapes = [], + this._inited = !1, + this._rect = cc.rect() + }, + properties: { + _density: 1, + _sensor: !1, + _friction: .2, + _restitution: 0, + density: { + tooltip: !1, + get: function() { + return this._density + }, + set: function(t) { + this._density = t + } + }, + sensor: { + tooltip: !1, + get: function() { + return this._sensor + }, + set: function(t) { + this._sensor = t + } + }, + friction: { + tooltip: !1, + get: function() { + return this._friction + }, + set: function(t) { + this._friction = t + } + }, + restitution: { + tooltip: !1, + get: function() { + return this._restitution + }, + set: function(t) { + this._restitution = t + } + }, + body: { + default: null, + type: cc.RigidBody, + visible: !1 + } + }, + onDisable: function() { + this._destroy() + }, + onEnable: function() { + this._init() + }, + start: function() { + this._init() + }, + _getFixtureIndex: function(t) { + return this._fixtures.indexOf(t) + }, + _init: function() { + cc.director.getPhysicsManager().pushDelayEvent(this, "__init", []) + }, + _destroy: function() { + cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", []) + }, + __init: function() { + if (!this._inited) { + var t = this.body || this.getComponent(cc.RigidBody); + if (t) { + var e = t._getBody(); + if (e) { + var i = t.node + , r = n(i); + this._scale = r; + var s = 0 === r.x && 0 === r.y ? [] : this._createShape(r); + s instanceof Array || (s = [s]); + for (var a = 1 << i.groupIndex, o = 0, l = cc.game.collisionMatrix[i.groupIndex], h = 0; h < l.length; h++) + l[h] && (o |= 1 << h); + for (var c = { + categoryBits: a, + maskBits: o, + groupIndex: 0 + }, u = cc.director.getPhysicsManager(), _ = 0; _ < s.length; _++) { + var f = s[_] + , d = new b2.FixtureDef; + d.density = this.density, + d.isSensor = this.sensor, + d.friction = this.friction, + d.restitution = this.restitution, + d.shape = f, + d.filter = c; + var p = e.CreateFixture(d); + p.collider = this, + t.enabledContactListener && u._registerContactFixture(p), + this._shapes.push(f), + this._fixtures.push(p) + } + this.body = t, + this._inited = !0 + } + } + } + }, + __destroy: function() { + if (this._inited) { + for (var t = this._fixtures, e = this.body._getBody(), i = cc.director.getPhysicsManager(), n = t.length - 1; n >= 0; n--) { + var r = t[n]; + r.collider = null, + i._unregisterContactFixture(r), + e && e.DestroyFixture(r) + } + this.body = null, + this._fixtures.length = 0, + this._shapes.length = 0, + this._inited = !1 + } + }, + _createShape: function() {}, + apply: function() { + this._destroy(), + this._init() + }, + getAABB: function() { + for (var t = 1e7, e = 1e7, n = -1e7, s = -1e7, a = this.body._getBody().GetTransform(), o = this._fixtures, l = 0; l < o.length; l++) + for (var h = o[l].GetShape(), c = h.GetChildCount(), u = 0; u < c; u++) + h.ComputeAABB(r, a, u), + r.lowerBound.x < t && (t = r.lowerBound.x), + r.lowerBound.y < e && (e = r.lowerBound.y), + r.upperBound.x > n && (n = r.upperBound.x), + r.upperBound.y > s && (s = r.upperBound.y); + t *= i, + e *= i, + n *= i, + s *= i; + var _ = this._rect; + return _.x = t, + _.y = e, + _.width = n - t, + _.height = s - e, + _ + } + }); + cc.PhysicsCollider = e.exports = s + } + ), { + "../CCPhysicsTypes": 169, + "../utils": 192 + }], + 177: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = t("../CCPolygonSeparator") + , r = cc.Class({ + name: "cc.PhysicsPolygonCollider", + extends: cc.PhysicsCollider, + mixins: [cc.Collider.Polygon], + editor: { + menu: !1, + inspector: !1, + requireComponent: cc.RigidBody + }, + _createShape: function(t) { + var e = [] + , r = this.points; + r.length > 0 && r[0].equals(r[r.length - 1]) && (r.length -= 1); + for (var s = n.ConvexPartition(r), a = this.offset, o = 0; o < s.length; o++) { + for (var l = s[o], h = null, c = [], u = null, _ = 0, f = l.length; _ < f; _++) { + h || (h = new b2.PolygonShape); + var d = l[_] + , p = (d.x + a.x) / i * t.x + , m = (d.y + a.y) / i * t.y + , y = new b2.Vec2(p,m); + c.push(y), + u || (u = y), + c.length === b2.maxPolygonVertices && (h.Set(c, c.length), + e.push(h), + h = null, + _ < f - 1 && (c = [u, c[c.length - 1]])) + } + h && (h.Set(c, c.length), + e.push(h)) + } + return e + } + }); + cc.PhysicsPolygonCollider = e.exports = r + } + ), { + "../CCPhysicsTypes": 169, + "../CCPolygonSeparator": 170 + }], + 178: [(function(t) { + "use strict"; + t("./box2d-adapter"), + t("./CCPhysicsManager"), + t("./CCRigidBody"), + t("./CCPhysicsContact"), + t("./collider/CCPhysicsCollider"), + t("./collider/CCPhysicsChainCollider"), + t("./collider/CCPhysicsCircleCollider"), + t("./collider/CCPhysicsBoxCollider"), + t("./collider/CCPhysicsPolygonCollider"), + t("./joint/CCJoint"), + t("./joint/CCDistanceJoint"), + t("./joint/CCRevoluteJoint"), + t("./joint/CCMouseJoint"), + t("./joint/CCMotorJoint"), + t("./joint/CCPrismaticJoint"), + t("./joint/CCWeldJoint"), + t("./joint/CCWheelJoint"), + t("./joint/CCRopeJoint"), + t("./platform/CCPhysicsContactListner"), + t("./platform/CCPhysicsAABBQueryCallback"), + t("./platform/CCPhysicsRayCastCallback") + } + ), { + "./CCPhysicsContact": 167, + "./CCPhysicsManager": 168, + "./CCRigidBody": 171, + "./box2d-adapter": 172, + "./collider/CCPhysicsBoxCollider": 173, + "./collider/CCPhysicsChainCollider": 174, + "./collider/CCPhysicsCircleCollider": 175, + "./collider/CCPhysicsCollider": 176, + "./collider/CCPhysicsPolygonCollider": 177, + "./joint/CCDistanceJoint": 179, + "./joint/CCJoint": 180, + "./joint/CCMotorJoint": 181, + "./joint/CCMouseJoint": 182, + "./joint/CCPrismaticJoint": 183, + "./joint/CCRevoluteJoint": 184, + "./joint/CCRopeJoint": 185, + "./joint/CCWeldJoint": 186, + "./joint/CCWheelJoint": 187, + "./platform/CCPhysicsAABBQueryCallback": 188, + "./platform/CCPhysicsContactListner": 189, + "./platform/CCPhysicsRayCastCallback": 191 + }], + 179: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = cc.Class({ + name: "cc.DistanceJoint", + extends: cc.Joint, + editor: !1, + properties: { + _distance: 1, + _frequency: 0, + _dampingRatio: 0, + distance: { + tooltip: !1, + get: function() { + return this._distance + }, + set: function(t) { + this._distance = t, + this._joint && this._joint.SetLength(t) + } + }, + frequency: { + tooltip: !1, + get: function() { + return this._frequency + }, + set: function(t) { + this._frequency = t, + this._joint && this._joint.SetFrequency(t) + } + }, + dampingRatio: { + tooltip: !1, + get: function() { + return this._dampingRatio + }, + set: function(t) { + this._dampingRatio = t, + this._joint && this._joint.SetDampingRatio(t) + } + } + }, + _createJointDef: function() { + var t = new b2.DistanceJointDef; + return t.localAnchorA = new b2.Vec2(this.anchor.x / i,this.anchor.y / i), + t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i,this.connectedAnchor.y / i), + t.length = this.distance / i, + t.dampingRatio = this.dampingRatio, + t.frequencyHz = this.frequency, + t + } + }); + cc.DistanceJoint = e.exports = n + } + ), { + "../CCPhysicsTypes": 169 + }], + 180: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = cc.Class({ + name: "cc.Joint", + extends: cc.Component, + editor: { + requireComponent: cc.RigidBody + }, + properties: { + anchor: { + default: cc.v2(0, 0), + tooltip: !1 + }, + connectedAnchor: { + default: cc.v2(0, 0), + tooltip: !1 + }, + connectedBody: { + default: null, + type: cc.RigidBody, + tooltip: !1 + }, + collideConnected: { + default: !1, + tooltip: !1 + } + }, + onDisable: function() { + this._destroy() + }, + onEnable: function() { + this._init() + }, + start: function() { + this._init() + }, + apply: function() { + this._destroy(), + this._init() + }, + getWorldAnchor: function() { + if (this._joint) { + var t = this._joint.GetAnchorA(); + return cc.v2(t.x * i, t.y * i) + } + return cc.Vec2.ZERO + }, + getWorldConnectedAnchor: function() { + if (this._joint) { + var t = this._joint.GetAnchorB(); + return cc.v2(t.x * i, t.y * i) + } + return cc.Vec2.ZERO + }, + getReactionForce: function(t) { + var e = cc.v2(); + return this._joint ? this._joint.GetReactionForce(t, e) : e + }, + getReactionTorque: function(t) { + return this._joint ? this._joint.GetReactionTorque(t) : 0 + }, + _init: function() { + cc.director.getPhysicsManager().pushDelayEvent(this, "__init", []) + }, + _destroy: function() { + cc.director.getPhysicsManager().pushDelayEvent(this, "__destroy", []) + }, + __init: function() { + if (!this._inited && (this.body = this.getComponent(cc.RigidBody), + this._isValid())) { + var t = this._createJointDef(); + if (!t) + return; + t.bodyA = this.body._getBody(), + t.bodyB = this.connectedBody._getBody(), + t.collideConnected = this.collideConnected, + cc.director.getPhysicsManager()._addJoint(this, t), + this._inited = !0 + } + }, + __destroy: function() { + this._inited && (cc.director.getPhysicsManager()._removeJoint(this), + this._joint = null, + this._inited = !1) + }, + _createJointDef: function() { + return null + }, + _isValid: function() { + return this.body && this.body._getBody() && this.connectedBody && this.connectedBody._getBody() + } + }); + cc.Joint = e.exports = n + } + ), { + "../CCPhysicsTypes": 169 + }], + 181: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE + , r = cc.Class({ + name: "cc.MotorJoint", + extends: cc.Joint, + editor: !1, + properties: { + _linearOffset: cc.v2(0, 0), + _angularOffset: 0, + _maxForce: 1, + _maxTorque: 1, + _correctionFactor: .3, + anchor: { + tooltip: !1, + default: cc.v2(0, 0), + override: !0, + visible: !1 + }, + connectedAnchor: { + tooltip: !1, + default: cc.v2(0, 0), + override: !0, + visible: !1 + }, + linearOffset: { + tooltip: !1, + get: function() { + return this._linearOffset + }, + set: function(t) { + this._linearOffset = t, + this._joint && this._joint.SetLinearOffset(new b2.Vec2(t.x / i,t.y / i)) + } + }, + angularOffset: { + tooltip: !1, + get: function() { + return this._angularOffset + }, + set: function(t) { + this._angularOffset = t, + this._joint && this._joint.SetAngularOffset(t) + } + }, + maxForce: { + tooltip: !1, + get: function() { + return this._maxForce + }, + set: function(t) { + this._maxForce = t, + this._joint && this._joint.SetMaxForce(t) + } + }, + maxTorque: { + tooltip: !1, + get: function() { + return this._maxTorque + }, + set: function(t) { + this._maxTorque = t, + this._joint && this._joint.SetMaxTorque(t) + } + }, + correctionFactor: { + tooltip: !1, + get: function() { + return this._correctionFactor + }, + set: function(t) { + this._correctionFactor = t, + this._joint && this._joint.SetCorrectionFactor(t) + } + } + }, + _createJointDef: function() { + var t = new b2.MotorJointDef; + return t.linearOffset = new b2.Vec2(this.linearOffset.x / i,this.linearOffset.y / i), + t.angularOffset = this.angularOffset * n, + t.maxForce = this.maxForce, + t.maxTorque = this.maxTorque, + t.correctionFactor = this.correctionFactor, + t + } + }); + cc.MotorJoint = e.exports = r + } + ), { + "../CCPhysicsTypes": 169 + }], + 182: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = new b2.Vec2 + , r = cc.Class({ + name: "cc.MouseJoint", + extends: cc.Joint, + editor: !1, + properties: { + _target: 1, + _frequency: 5, + _dampingRatio: .7, + _maxForce: 0, + connectedBody: { + default: null, + type: cc.RigidBody, + visible: !1, + override: !0 + }, + collideConnected: { + default: !0, + visible: !1, + override: !0 + }, + anchor: { + tooltip: !1, + default: cc.v2(0, 0), + override: !0, + visible: !1 + }, + connectedAnchor: { + tooltip: !1, + default: cc.v2(0, 0), + override: !0, + visible: !1 + }, + mouseRegion: { + tooltip: !1, + default: null, + type: cc.Node + }, + target: { + tooltip: !1, + visible: !1, + get: function() { + return this._target + }, + set: function(t) { + this._target = t, + this._joint && (n.x = t.x / i, + n.y = t.y / i, + this._joint.SetTarget(n)) + } + }, + frequency: { + tooltip: !1, + get: function() { + return this._frequency + }, + set: function(t) { + this._frequency = t, + this._joint && this._joint.SetFrequency(t) + } + }, + dampingRatio: { + tooltip: !1, + get: function() { + return this._dampingRatio + }, + set: function(t) { + this._dampingRatio = t, + this._joint && this._joint.SetDampingRatio(t) + } + }, + maxForce: { + tooltip: !1, + visible: !1, + get: function() { + return this._maxForce + }, + set: function(t) { + this._maxForce = t, + this._joint && this._joint.SetMaxForce(t) + } + } + }, + onLoad: function() { + var t = this.mouseRegion || this.node; + t.on(cc.Node.EventType.TOUCH_START, this.onTouchBegan, this), + t.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this), + t.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this), + t.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this) + }, + onEnable: function() {}, + start: function() {}, + onTouchBegan: function(t) { + var e = cc.director.getPhysicsManager() + , i = this._pressPoint = t.touch.getLocation(); + cc.Camera && cc.Camera.main && (i = cc.Camera.main.getScreenToWorldPoint(i)); + var n = e.testPoint(i); + n && ((this.connectedBody = n.body).awake = !0, + this.maxForce = 1e3 * this.connectedBody.getMass(), + this.target = i, + this._init()) + }, + onTouchMove: function(t) { + this._pressPoint = t.touch.getLocation() + }, + onTouchEnd: function() { + this._destroy(), + this._pressPoint = null + }, + _createJointDef: function() { + var t = new b2.MouseJointDef; + return n.x = this.target.x / i, + n.y = this.target.y / i, + t.target = n, + t.maxForce = this.maxForce, + t.dampingRatio = this.dampingRatio, + t.frequencyHz = this.frequency, + t + }, + update: function() { + if (this._pressPoint && this._isValid()) { + var t = cc.Camera.findCamera(this.node); + this.target = t ? t.getScreenToWorldPoint(this._pressPoint) : this._pressPoint + } + } + }); + cc.MouseJoint = e.exports = r + } + ), { + "../CCPhysicsTypes": 169 + }], + 183: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE + , r = cc.Class({ + name: "cc.PrismaticJoint", + extends: cc.Joint, + editor: !1, + properties: { + localAxisA: { + default: cc.v2(1, 0), + tooltip: !1 + }, + referenceAngle: { + default: 0, + tooltip: !1 + }, + enableLimit: { + default: !1, + tooltip: !1 + }, + enableMotor: { + default: !1, + tooltip: !1 + }, + lowerLimit: { + default: 0, + tooltip: !1 + }, + upperLimit: { + default: 0, + tooltip: !1 + }, + _maxMotorForce: 0, + _motorSpeed: 0, + maxMotorForce: { + tooltip: !1, + get: function() { + return this._maxMotorForce + }, + set: function(t) { + this._maxMotorForce = t, + this._joint && this._joint.SetMaxMotorForce(t) + } + }, + motorSpeed: { + tooltip: !1, + get: function() { + return this._motorSpeed + }, + set: function(t) { + this._motorSpeed = t, + this._joint && this._joint.SetMotorSpeed(t) + } + } + }, + _createJointDef: function() { + var t = new b2.PrismaticJointDef; + return t.localAnchorA = new b2.Vec2(this.anchor.x / i,this.anchor.y / i), + t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i,this.connectedAnchor.y / i), + t.localAxisA = new b2.Vec2(this.localAxisA.x,this.localAxisA.y), + t.referenceAngle = this.referenceAngle * n, + t.enableLimit = this.enableLimit, + t.lowerTranslation = this.lowerLimit / i, + t.upperTranslation = this.upperLimit / i, + t.enableMotor = this.enableMotor, + t.maxMotorForce = this.maxMotorForce, + t.motorSpeed = this.motorSpeed, + t + } + }); + cc.PrismaticJoint = e.exports = r + } + ), { + "../CCPhysicsTypes": 169 + }], + 184: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE + , r = t("../CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE + , s = cc.Class({ + name: "cc.RevoluteJoint", + extends: cc.Joint, + editor: !1, + properties: { + _maxMotorTorque: 0, + _motorSpeed: 0, + _enableLimit: !1, + _enableMotor: !1, + referenceAngle: { + default: 0, + tooltip: !1 + }, + lowerAngle: { + default: 0, + tooltip: !1 + }, + upperAngle: { + default: 0, + tooltip: !1 + }, + maxMotorTorque: { + tooltip: !1, + get: function() { + return this._maxMotorTorque + }, + set: function(t) { + this._maxMotorTorque = t, + this._joint && this._joint.SetMaxMotorTorque(t) + } + }, + motorSpeed: { + tooltip: !1, + get: function() { + return this._motorSpeed + }, + set: function(t) { + this._motorSpeed = t, + this._joint && this._joint.SetMotorSpeed(t * n) + } + }, + enableLimit: { + tooltip: !1, + get: function() { + return this._enableLimit + }, + set: function(t) { + this._enableLimit = t, + this._joint && this._joint.EnableLimit(t) + } + }, + enableMotor: { + tooltip: !1, + get: function() { + return this._enableMotor + }, + set: function(t) { + this._enableMotor = t, + this._joint && this._joint.EnableMotor(t) + } + } + }, + getJointAngle: function() { + return this._joint ? this._joint.GetJointAngle() * r : 0 + }, + setLimits: function(t, e) { + if (this._joint) + return this._joint.SetLimits(t * n, e * n) + }, + _createJointDef: function() { + var t = new b2.RevoluteJointDef; + return t.localAnchorA = new b2.Vec2(this.anchor.x / i,this.anchor.y / i), + t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i,this.connectedAnchor.y / i), + t.lowerAngle = this.upperAngle * n, + t.upperAngle = this.lowerAngle * n, + t.maxMotorTorque = this.maxMotorTorque, + t.motorSpeed = this.motorSpeed * n, + t.enableLimit = this.enableLimit, + t.enableMotor = this.enableMotor, + t.referenceAngle = this.referenceAngle * n, + t + } + }); + cc.RevoluteJoint = e.exports = s + } + ), { + "../CCPhysicsTypes": 169 + }], + 185: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = cc.Class({ + name: "cc.RopeJoint", + extends: cc.Joint, + editor: !1, + properties: { + _maxLength: 1, + maxLength: { + tooltip: !1, + get: function() { + return this._maxLength + }, + set: function(t) { + this._maxLength = t, + this._joint && this._joint.SetMaxLength(t) + } + } + }, + _createJointDef: function() { + var t = new b2.RopeJointDef; + return t.localAnchorA = new b2.Vec2(this.anchor.x / i,this.anchor.y / i), + t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i,this.connectedAnchor.y / i), + t.maxLength = this.maxLength / i, + t + } + }); + cc.RopeJoint = e.exports = n + } + ), { + "../CCPhysicsTypes": 169 + }], + 186: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE + , r = cc.Class({ + name: "cc.WeldJoint", + extends: cc.Joint, + editor: !1, + properties: { + referenceAngle: { + default: 0, + tooltip: !1 + }, + _frequency: 0, + _dampingRatio: 0, + frequency: { + tooltip: !1, + get: function() { + return this._frequency + }, + set: function(t) { + this._frequency = t, + this._joint && this._joint.SetFrequency(t) + } + }, + dampingRatio: { + tooltip: !1, + get: function() { + return this._dampingRatio + }, + set: function(t) { + this._dampingRatio = t, + this._joint && this._joint.SetDampingRatio(t) + } + } + }, + _createJointDef: function() { + var t = new b2.WeldJointDef; + return t.localAnchorA = new b2.Vec2(this.anchor.x / i,this.anchor.y / i), + t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i,this.connectedAnchor.y / i), + t.referenceAngle = this.referenceAngle * n, + t.frequencyHz = this.frequency, + t.dampingRatio = this.dampingRatio, + t + } + }); + cc.WeldJoint = e.exports = r + } + ), { + "../CCPhysicsTypes": 169 + }], + 187: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = t("../CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE + , r = cc.Class({ + name: "cc.WheelJoint", + extends: cc.Joint, + editor: !1, + properties: { + _maxMotorTorque: 0, + _motorSpeed: 0, + _enableMotor: !1, + _frequency: 2, + _dampingRatio: .7, + localAxisA: { + default: cc.v2(1, 0), + tooltip: !1 + }, + maxMotorTorque: { + tooltip: !1, + get: function() { + return this._maxMotorTorque + }, + set: function(t) { + this._maxMotorTorque = t, + this._joint && this._joint.SetMaxMotorTorque(t) + } + }, + motorSpeed: { + tooltip: !1, + get: function() { + return this._motorSpeed + }, + set: function(t) { + this._motorSpeed = t, + this._joint && this._joint.SetMotorSpeed(t * n) + } + }, + enableMotor: { + tooltip: !1, + get: function() { + return this._enableMotor + }, + set: function(t) { + this._enableMotor = t, + this._joint && this._joint.EnableMotor(t) + } + }, + frequency: { + tooltip: !1, + get: function() { + return this._frequency + }, + set: function(t) { + this._frequency = t, + this._joint && this._joint.SetSpringFrequencyHz(t) + } + }, + dampingRatio: { + tooltip: !1, + get: function() { + return this._dampingRatio + }, + set: function(t) { + this._dampingRatio = t, + this._joint && this._joint.SetDampingRatio(t) + } + } + }, + _createJointDef: function() { + var t = new b2.WheelJointDef; + return t.localAnchorA = new b2.Vec2(this.anchor.x / i,this.anchor.y / i), + t.localAnchorB = new b2.Vec2(this.connectedAnchor.x / i,this.connectedAnchor.y / i), + t.localAxisA = new b2.Vec2(this.localAxisA.x,this.localAxisA.y), + t.maxMotorTorque = this.maxMotorTorque, + t.motorSpeed = this.motorSpeed * n, + t.enableMotor = this.enableMotor, + t.dampingRatio = this.dampingRatio, + t.frequencyHz = this.frequency, + t + } + }); + cc.WheelJoint = e.exports = r + } + ), { + "../CCPhysicsTypes": 169 + }], + 188: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").BodyType; + function n() { + this._point = new b2.Vec2, + this._isPoint = !1, + this._fixtures = [] + } + n.prototype.init = function(t) { + t ? (this._isPoint = !0, + this._point.x = t.x, + this._point.y = t.y) : this._isPoint = !1, + this._fixtures.length = 0 + } + , + n.prototype.ReportFixture = function(t) { + if (t.GetBody().GetType() === i.Dynamic) + if (this._isPoint) { + if (t.TestPoint(this._point)) + return this._fixtures.push(t), + !1 + } else + this._fixtures.push(t); + return !0 + } + , + n.prototype.getFixture = function() { + return this._fixtures[0] + } + , + n.prototype.getFixtures = function() { + return this._fixtures + } + , + cc.PhysicsAABBQueryCallback = e.exports = n + } + ), { + "../CCPhysicsTypes": 169 + }], + 189: [(function(t, e) { + "use strict"; + function i() { + this._contactFixtures = [] + } + i.prototype.setBeginContact = function(t) { + this._BeginContact = t + } + , + i.prototype.setEndContact = function(t) { + this._EndContact = t + } + , + i.prototype.setPreSolve = function(t) { + this._PreSolve = t + } + , + i.prototype.setPostSolve = function(t) { + this._PostSolve = t + } + , + i.prototype.BeginContact = function(t) { + if (this._BeginContact) { + var e = t.GetFixtureA() + , i = t.GetFixtureB() + , n = this._contactFixtures; + t._shouldReport = !1, + -1 === n.indexOf(e) && -1 === n.indexOf(i) || (t._shouldReport = !0, + this._BeginContact(t)) + } + } + , + i.prototype.EndContact = function(t) { + this._EndContact && t._shouldReport && (t._shouldReport = !1, + this._EndContact(t)) + } + , + i.prototype.PreSolve = function(t, e) { + this._PreSolve && t._shouldReport && this._PreSolve(t, e) + } + , + i.prototype.PostSolve = function(t, e) { + this._PostSolve && t._shouldReport && this._PostSolve(t, e) + } + , + i.prototype.registerContactFixture = function(t) { + this._contactFixtures.push(t) + } + , + i.prototype.unregisterContactFixture = function(t) { + cc.js.array.remove(this._contactFixtures, t) + } + , + cc.PhysicsContactListener = e.exports = i + } + ), {}], + 190: [(function(t, e) { + "use strict"; + var i = t("../CCPhysicsTypes").PTM_RATIO + , n = cc.v2() + , r = cc.Color.GREEN + , s = cc.Color.RED; + function a(t) { + b2.Draw.call(this), + this._drawer = t, + this._xf = this._dxf = new b2.Transform + } + cc.js.extend(a, b2.Draw), + cc.js.mixin(a.prototype, { + _DrawPolygon: function(t, e) { + for (var r = this._drawer, s = 0; s < e; s++) { + b2.Transform.MulXV(this._xf, t[s], n); + var a = n.x * i + , o = n.y * i; + 0 === s ? r.moveTo(a, o) : r.lineTo(a, o) + } + r.close() + }, + DrawPolygon: function(t, e, i) { + this._applyStrokeColor(i), + this._DrawPolygon(t, e), + this._drawer.stroke() + }, + DrawSolidPolygon: function(t, e, i) { + this._applyFillColor(i), + this._DrawPolygon(t, e), + this._drawer.fill(), + this._drawer.stroke() + }, + _DrawCircle: function(t, e) { + var n = this._xf.p; + this._drawer.circle((t.x + n.x) * i, (t.y + n.y) * i, e * i) + }, + DrawCircle: function(t, e, i) { + this._applyStrokeColor(i), + this._DrawCircle(t, e), + this._drawer.stroke() + }, + DrawSolidCircle: function(t, e, i, n) { + this._applyFillColor(n), + this._DrawCircle(t, e), + this._drawer.fill() + }, + DrawSegment: function(t, e, r) { + var s = this._drawer; + if (t.x === e.x && t.y === e.y) + return this._applyFillColor(r), + this._DrawCircle(t, 2 / i), + void s.fill(); + this._applyStrokeColor(r), + b2.Transform.MulXV(this._xf, t, n), + s.moveTo(n.x * i, n.y * i), + b2.Transform.MulXV(this._xf, e, n), + s.lineTo(n.x * i, n.y * i), + s.stroke() + }, + DrawTransform: function(t) { + var e = this._drawer; + e.strokeColor = s, + n.x = n.y = 0, + b2.Transform.MulXV(t, n, n), + e.moveTo(n.x * i, n.y * i), + n.x = 1, + n.y = 0, + b2.Transform.MulXV(t, n, n), + e.lineTo(n.x * i, n.y * i), + e.stroke(), + e.strokeColor = r, + n.x = n.y = 0, + b2.Transform.MulXV(t, n, n), + e.moveTo(n.x * i, n.y * i), + n.x = 0, + n.y = 1, + b2.Transform.MulXV(t, n, n), + e.lineTo(n.x * i, n.y * i), + e.stroke() + }, + DrawPoint: function() {}, + _applyStrokeColor: function(t) { + var e = this._drawer.strokeColor; + e.r = 255 * t.r, + e.g = 255 * t.g, + e.b = 255 * t.b, + e.a = 150, + this._drawer.strokeColor = e + }, + _applyFillColor: function(t) { + var e = this._drawer.fillColor; + e.r = 255 * t.r, + e.g = 255 * t.g, + e.b = 255 * t.b, + e.a = 150, + this._drawer.fillColor = e + }, + PushTransform: function(t) { + this._xf = t + }, + PopTransform: function() { + this._xf = this._dxf + } + }), + e.exports = a + } + ), { + "../CCPhysicsTypes": 169 + }], + 191: [(function(t, e) { + "use strict"; + function i() { + this._type = 0, + this._fixtures = [], + this._points = [], + this._normals = [], + this._fractions = [] + } + i.prototype.init = function(t) { + this._type = t, + this._fixtures.length = 0, + this._points.length = 0, + this._normals.length = 0, + this._fractions.length = 0 + } + , + i.prototype.ReportFixture = function(t, e, i, n) { + return 0 === this._type ? (this._fixtures[0] = t, + this._points[0] = e, + this._normals[0] = i, + this._fractions[0] = n, + n) : (this._fixtures.push(t), + this._points.push(cc.v2(e)), + this._normals.push(cc.v2(i)), + this._fractions.push(n), + 1 === this._type ? 0 : this._type >= 2 ? 1 : n) + } + , + i.prototype.getFixtures = function() { + return this._fixtures + } + , + i.prototype.getPoints = function() { + return this._points + } + , + i.prototype.getNormals = function() { + return this._normals + } + , + i.prototype.getFractions = function() { + return this._fractions + } + , + cc.PhysicsRayCastCallback = e.exports = i + } + ), {}], + 192: [(function(t, e) { + "use strict"; + e.exports = { + getWorldRotation: function(t) { + for (var e = t.angle, i = t.parent; i.parent; ) + e += i.angle, + i = i.parent; + return -e + }, + getWorldScale: function(t) { + for (var e = t.scaleX, i = t.scaleY, n = t.parent; n.parent; ) + e *= n.scaleX, + i *= n.scaleY, + n = n.parent; + return cc.v2(e, i) + }, + convertToNodeRotation: function(t, e) { + e -= -t.angle; + for (var i = t.parent; i.parent; ) + e -= -i.angle, + i = i.parent; + return e + } + } + } + ), {}], + 193: [(function(t, e) { + "use strict"; + var i = t("./js") + , n = t("./CCEnum") + , r = t("./utils") + , s = (r.isPlainEmptyObj_DEV, + r.cloneable_DEV, + t("./attribute")) + , a = s.DELIMETER + , o = t("./preprocess-class"); + t("./requiring-frame"); + var l = ["name", "extends", "mixins", "ctor", "__ctor__", "properties", "statics", "editor", "__ES6__"]; + function h(t, e) { + t.indexOf(e) < 0 && t.push(e) + } + var c = { + datas: null, + push: function(t) { + if (this.datas) + this.datas.push(t); + else { + this.datas = [t]; + var e = this; + setTimeout((function() { + e.init() + } + ), 0) + } + }, + init: function() { + var t = this.datas; + if (t) { + for (var e = 0; e < t.length; ++e) { + var n = t[e] + , r = n.cls + , s = n.props; + "function" == typeof s && (s = s()); + var a = i.getClassName(r); + s ? E(r, a, s, r.$super, n.mixins) : cc.errorID(3633, a) + } + this.datas = null + } + } + }; + function u(t, e) { + h(t.__props__, e) + } + function _(t, e, i, n) { + var r = n.default; + s.setClassAttr(t, i, "default", r), + u(t, i), + B(t, n, 0, i) + } + function f(t, e, n, r, a) { + var o = r.get + , l = r.set + , h = t.prototype + , c = !Object.getOwnPropertyDescriptor(h, n); + o && (B(t, r, 0, n), + s.setClassAttr(t, n, "serializable", !1), + a || i.get(h, n, o, c, c)), + l && (a || i.set(h, n, l, c, c)) + } + function d(t) { + return "function" == typeof t ? t() : t + } + function p(t, e, n) { + for (var r in e) + t.hasOwnProperty(r) || n && !n(r) || Object.defineProperty(t, r, i.getPropertyDescriptor(e, r)) + } + function m(t, e, n, r) { + var a, o, l = r.__ctor__, h = r.ctor, c = r.__ES6__; + c ? (a = [h], + o = h) : (a = l ? [l] : T(e, n, r), + o = C(a, e, t, r), + i.value(o, "extend", (function(t) { + return t.extends = this, + M(t) + } + ), !0)), + i.value(o, "__ctors__", a.length > 0 ? a : null, !0); + var u = o.prototype; + if (e && (c || (i.extend(o, e), + u = o.prototype), + o.$super = e), + n) { + for (var _ = n.length - 1; _ >= 0; _--) { + var f = n[_]; + p(u, f.prototype), + p(o, f, (function(t) { + return f.hasOwnProperty(t) && !0 + } + )), + M._isCCClass(f) && p(s.getClassAttrs(o), s.getClassAttrs(f)) + } + u.constructor = o + } + return c || (u.__initProps__ = b), + i.setClassName(t, o), + o + } + function y(t, e, n, r) { + var s = cc.Component + , a = cc._RF.peek(); + if (a && i.isChildClassOf(e, s)) { + if (i.isChildClassOf(a.cls, s)) + return cc.errorID(3615), + null; + t = t || a.script + } + var o = m(t, e, n, r); + if (a) + if (i.isChildClassOf(e, s)) { + var l = a.uuid; + l && i._setClassId(l, o), + a.cls = o + } else + i.isChildClassOf(a.cls, s) || (a.cls = o); + return o + } + function v(t) { + for (var e = i.getClassName(t), n = t.constructor, r = "new " + e + "(", s = 0; s < n.__props__.length; s++) { + r += t[n.__props__[s]], + s < n.__props__.length - 1 && (r += ",") + } + return r + ")" + } + function g(t) { + return JSON.stringify(t).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029") + } + function A(t, e) { + for (var i = [], n = "", r = 0; r < e.length; r++) { + var s = e[r] + , o = s + a + "default"; + if (o in t) { + var l, h; + l = x.test(s) ? "this." + s + "=" : "this[" + g(s) + "]="; + var c = t[o]; + if ("object" == typeof c && c) + h = c instanceof cc.ValueType ? v(c) : Array.isArray(c) ? "[]" : "{}"; + else if ("function" == typeof c) { + var u = i.length; + i.push(c), + h = "F[" + u + "]()" + } else + h = "string" == typeof c ? g(c) : c; + n += l = l + h + ";\n" + } + } + return 0 === i.length ? Function(n) : Function("F", "return (function(){\n" + n + "})")(i) + } + var x = /^[A-Za-z_$][0-9A-Za-z_$]*$/; + function b(t) { + var e = s.getClassAttrs(t) + , i = t.__props__; + null === i && (c.init(), + i = t.__props__); + var n = A(e, i); + t.prototype.__initProps__ = n, + n.call(this) + } + var C = function(t, e, i, n) { + var r = "return function CCClass(){\n"; + e && w(e, n) && (r += "this._super=null;\n"), + r += "this.__initProps__(CCClass);\n"; + var s = t.length; + if (s > 0) { + var a = "].apply(this,arguments);\n"; + if (1 === s) + r += "CCClass.__ctors__[0" + a; + else { + r += "var cs=CCClass.__ctors__;\n"; + for (var o = 0; o < s; o++) + r += "cs[" + o + a + } + } + return r += "}", + Function(r)() + }; + function T(t, e, i) { + for (var n, r = [], s = [t].concat(e), a = 0; a < s.length; a++) { + var o = s[a]; + if (o) + for (var l = (n = o, + M._isCCClass(n) ? n.__ctors__ || [] : [n]), c = 0; c < l.length; c++) + h(r, l[c]) + } + var u = i.ctor; + return u && r.push(u), + r + } + var S = /xyz/.test((function() { + xyz + } + )) ? /\b\._super\b/ : /.*/; + function w(t, e) { + var n = !1; + for (var r in e) + if (!(l.indexOf(r) >= 0)) { + var s = e[r]; + if ("function" == typeof s) { + var a = i.getPropertyDescriptor(t.prototype, r); + if (a) { + var o = a.value; + if ("function" == typeof o) { + S.test(s) && (n = !0, + e[r] = (function(t, e) { + return function() { + var i = this._super; + this._super = t; + var n = e.apply(this, arguments); + return this._super = i, + n + } + } + )(o, s)); + continue + } + } + } + } + return n + } + function E(t, e, i, n, r, l) { + if (t.__props__ = [], + n && n.__props__ && (t.__props__ = n.__props__.slice()), + r) + for (var h = 0; h < r.length; ++h) { + var c = r[h]; + c.__props__ && (t.__props__ = t.__props__.concat(c.__props__.filter((function(e) { + return t.__props__.indexOf(e) < 0 + } + )))) + } + if (i) + for (var u in o.preprocessAttrs(i, e, t, l), + i) { + var d = i[u]; + "default"in d ? _(t, 0, u, d) : f(t, 0, u, d, l) + } + var p = s.getClassAttrs(t); + t.__values__ = t.__props__.filter((function(t) { + return !1 !== p[t + a + "serializable"] + } + )) + } + function M(t) { + var e = (t = t || {}).name + , n = t.extends + , r = t.mixins + , s = y(e, n, r, t); + e || (e = cc.js.getClassName(s)), + s._sealed = !0, + n && (n._sealed = !1); + var a = t.properties; + "function" == typeof a || n && null === n.__props__ || r && r.some((function(t) { + return null === t.__props__ + } + )) ? (c.push({ + cls: s, + props: a, + mixins: r + }), + s.__props__ = s.__values__ = null) : E(s, e, a, n, t.mixins, t.__ES6__); + var h, u = t.statics; + if (u) + for (h in u) + s[h] = u[h]; + for (var _ in t) + if (!(l.indexOf(_) >= 0)) { + var f = t[_]; + o.validateMethodWithProps(f, _, e, s, n) && i.value(s.prototype, _, f, !0, !0) + } + var d = t.editor; + return d && cc.Component._registerEditorProps(s, d), + s + } + /xyz/.test((function() { + xyz + } + )), + M._isCCClass = function(t) { + return t && t.hasOwnProperty("__ctors__") + } + , + M._fastDefine = function(t, e, n) { + i.setClassName(t, e); + for (var r = e.__props__ = e.__values__ = Object.keys(n), o = s.getClassAttrs(e), l = 0; l < r.length; l++) { + var h = r[l]; + o[h + a + "visible"] = !1, + o[h + a + "default"] = n[h] + } + } + , + M.Attr = s, + M.attr = s.attr, + M.getInheritanceChain = function(t) { + for (var e = []; t = i.getSuper(t); ) + t !== Object && e.push(t); + return e + } + ; + var D = { + Integer: "Number", + Float: "Number", + Boolean: "Boolean", + String: "String" + }; + function B(t, e, i, r) { + var o = null + , l = ""; + function h() { + return l = r + a, + o = s.getClassAttrs(t) + } + var c = e.type; + c && (D[c] ? (o || h())[l + "type"] = c : "Object" === c || (c === s.ScriptUuid ? ((o || h())[l + "type"] = "Script", + o[l + "ctor"] = cc.ScriptAsset) : "object" == typeof c ? n.isEnum(c) && ((o || h())[l + "type"] = "Enum", + o[l + "enumList"] = n.getList(c)) : "function" == typeof c && ((o || h())[l + "type"] = "Object", + o[l + "ctor"] = c))); + function u(t, i) { + if (t in e) { + var n = e[t]; + typeof n === i && ((o || h())[l + t] = n) + } + } + e.editorOnly && ((o || h())[l + "editorOnly"] = !0), + !1 === e.serializable && ((o || h())[l + "serializable"] = !1), + u("formerlySerializedAs", "string"); + var _ = e.range; + _ && Array.isArray(_) && _.length >= 2 && ((o || h())[l + "min"] = _[0], + o[l + "max"] = _[1], + _.length > 2 && (o[l + "step"] = _[2])), + u("min", "number"), + u("max", "number"), + u("step", "number"), + u("userData", "object") + } + cc.Class = M, + e.exports = { + isArray: function(t) { + return t = d(t), + Array.isArray(t) + }, + fastDefine: M._fastDefine, + getNewValueTypeCode: v, + IDENTIFIER_RE: x, + escapeForJS: g, + getDefault: d + } + } + ), { + "./CCEnum": 195, + "./attribute": 205, + "./js": 214, + "./preprocess-class": 215, + "./requiring-frame": 216, + "./utils": 217 + }], + 194: [(function(t, e) { + "use strict"; + t("./CCClass"); + var i = t("./preprocess-class") + , n = t("./js") + , r = "__ccclassCache__"; + function s(t) { + return t + } + function a(t, e) { + return t[e] || (t[e] = {}) + } + function o(t) { + return function(e) { + return "function" == typeof e ? t(e) : function(i) { + return t(i, e) + } + } + } + function l(t, e) { + return function(t) { + return function(i) { + return e(i, t) + } + } + } + var h = l.bind(null, !1); + function c() { + return l.bind(null, !1) + } + var u = c() + , _ = c(); + function f(t) { + return a(t, r) + } + function d(t) { + var e; + try { + e = t() + } catch (i) { + return t + } + return "object" != typeof e || null === e ? e : t + } + function p(t) { + var e; + try { + e = new t + } catch (i) { + return {} + } + return e + } + function m(t, e, r, s, a, o) { + var l, h = a && (a.get || a.set); + s && (l = i.getFullFormOfProperty(s, h)); + var c = e[r] + , u = n.mixin(c || {}, l || s || {}); + if (h) + a.get && (u.get = a.get), + a.set && (u.set = a.set); + else { + var _ = void 0; + if (a) + a.initializer && (_ = d(a.initializer)); + else { + var f = o.default || (o.default = p(t)); + f.hasOwnProperty(r) && (_ = f[r]) + } + u.default = _ + } + e[r] = u + } + var y = o((function(t, e) { + var i = n.getSuper(t); + i === Object && (i = null); + var s = { + name: e, + extends: i, + ctor: t, + __ES6__: !0 + } + , a = t[r]; + if (a) { + var o = a.proto; + o && n.mixin(s, o), + t[r] = void 0 + } + return cc.Class(s) + } + )); + function v(t, e, i) { + return t((function(t, n) { + var r = f(t); + if (r) { + var s = void 0 !== i ? i : n + , o = a(r, "proto"); + a(o, "editor")[e] = s + } + } + ), e) + } + function g(t) { + return t(s) + } + var A = g(o) + , x = v(h, "requireComponent") + , b = g(u) + , C = v(_, "executionOrder") + , T = g(o) + , S = g(o) + , w = g(u) + , E = g(u) + , M = g(u); + cc._decorator = e.exports = { + ccclass: y, + property: function(t, e, i) { + var n = null; + function r(t, e, i) { + var r = f(t.constructor); + if (r) { + var s = a(r, "proto") + , o = a(s, "properties"); + m(t.constructor, o, e, n, i, r) + } + } + if (void 0 === e) + return n = t, + r; + r(t, e, i) + }, + executeInEditMode: A, + requireComponent: x, + menu: b, + executionOrder: C, + disallowMultiple: T, + playOnFocus: S, + inspector: w, + icon: E, + help: M, + mixins: function() { + for (var t = [], e = 0; e < arguments.length; e++) + t[e] = arguments[e]; + return function(e) { + var i = f(e); + i && (a(i, "proto").mixins = t) + } + } + } + } + ), { + "./CCClass": 193, + "./js": 214, + "./preprocess-class": 215, + "./utils": 217 + }], + 195: [(function(t, e) { + "use strict"; + var i = t("./js"); + function n(t) { + if ("__enums__"in t) + return t; + i.value(t, "__enums__", null, !0); + for (var e = -1, n = Object.keys(t), r = 0; r < n.length; r++) { + var s = n[r] + , a = t[s]; + if (-1 === a) + a = ++e, + t[s] = a; + else if ("number" == typeof a) + e = a; + else if ("string" == typeof a && Number.isInteger(parseFloat(s))) + continue; + var o = "" + a; + s !== o && i.value(t, o, s) + } + return t + } + n.isEnum = function(t) { + return t && t.hasOwnProperty("__enums__") + } + , + n.getList = function(t) { + if (t.__enums__) + return t.__enums__; + var e = t.__enums__ = []; + for (var i in t) { + var n = t[i]; + Number.isInteger(n) && e.push({ + name: i, + value: n + }) + } + return e.sort((function(t, e) { + return t.value - e.value + } + )), + e + } + , + e.exports = cc.Enum = n + } + ), { + "./js": 214 + }], + 196: [(function(t) { + "use strict"; + var e, i = t("../event-manager"), n = t("./CCInputManager"); + cc.Acceleration = function(t, e, i, n) { + this.x = t || 0, + this.y = e || 0, + this.z = i || 0, + this.timestamp = n || 0 + } + , + n.setAccelerometerEnabled = function(t) { + var e = this; + if (e._accelEnabled !== t) { + e._accelEnabled = t; + var i = cc.director.getScheduler(); + i.enableForTarget(e), + e._accelEnabled ? (e._registerAccelerometerEvent(), + e._accelCurTime = 0, + i.scheduleUpdate(e)) : (e._unregisterAccelerometerEvent(), + e._accelCurTime = 0, + i.unscheduleUpdate(e)) + } + } + , + n.setAccelerometerInterval = function(t) { + this._accelInterval !== t && (this._accelInterval = t) + } + , + n._registerKeyboardEvent = function() { + cc.game.canvas.addEventListener("keydown", (function(t) { + i.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode,!0)), + t.stopPropagation(), + t.preventDefault() + } + ), !1), + cc.game.canvas.addEventListener("keyup", (function(t) { + i.dispatchEvent(new cc.Event.EventKeyboard(t.keyCode,!1)), + t.stopPropagation(), + t.preventDefault() + } + ), !1) + } + , + n._registerAccelerometerEvent = function() { + var t = window + , i = this; + i._acceleration = new cc.Acceleration, + i._accelDeviceEvent = t.DeviceMotionEvent || t.DeviceOrientationEvent, + cc.sys.browserType === cc.sys.BROWSER_TYPE_MOBILE_QQ && (i._accelDeviceEvent = window.DeviceOrientationEvent); + var n = i._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation" + , r = navigator.userAgent; + (/Android/.test(r) || /Adr/.test(r) && cc.sys.browserType === cc.BROWSER_TYPE_UC) && (i._minus = -1), + e = i.didAccelerate.bind(i), + t.addEventListener(n, e, !1) + } + , + n._unregisterAccelerometerEvent = function() { + var t = window + , i = this._accelDeviceEvent === t.DeviceMotionEvent ? "devicemotion" : "deviceorientation"; + e && t.removeEventListener(i, e, !1) + } + , + n.didAccelerate = function(t) { + var e = this + , i = window; + if (e._accelEnabled) { + var n, r, s, a = e._acceleration; + if (e._accelDeviceEvent === window.DeviceMotionEvent) { + var o = t.accelerationIncludingGravity; + n = e._accelMinus * o.x * .1, + r = e._accelMinus * o.y * .1, + s = .1 * o.z + } else + n = t.gamma / 90 * .981, + r = -t.beta / 90 * .981, + s = t.alpha / 90 * .981; + if (cc.view._isRotated) { + var l = n; + n = -r, + r = l + } + a.x = n, + a.y = r, + a.z = s, + a.timestamp = t.timeStamp || Date.now(); + var h = a.x; + 90 === i.orientation ? (a.x = -a.y, + a.y = h) : -90 === i.orientation ? (a.x = a.y, + a.y = -h) : 180 === i.orientation && (a.x = -a.x, + a.y = -a.y), + cc.sys.os === cc.sys.OS_ANDROID && cc.sys.browserType !== cc.sys.BROWSER_TYPE_MOBILE_QQ && (a.x = -a.x, + a.y = -a.y) + } + } + } + ), { + "../event-manager": 138, + "./CCInputManager": 197 + }], + 197: [(function(t, e) { + "use strict"; + var i = t("./CCMacro") + , n = t("./CCSys") + , r = t("../event-manager") + , s = i.TOUCH_TIMEOUT + , a = cc.v2() + , o = { + _mousePressed: !1, + _isRegisterEvent: !1, + _preTouchPoint: cc.v2(0, 0), + _prevMousePoint: cc.v2(0, 0), + _preTouchPool: [], + _preTouchPoolPointer: 0, + _touches: [], + _touchesIntegerDict: {}, + _indexBitsUsed: 0, + _maxTouches: 8, + _accelEnabled: !1, + _accelInterval: .2, + _accelMinus: 1, + _accelCurTime: 0, + _acceleration: null, + _accelDeviceEvent: null, + _canvasBoundingRect: { + left: 0, + top: 0, + adjustedLeft: 0, + adjustedTop: 0, + width: 0, + height: 0 + }, + _getUnUsedIndex: function() { + for (var t = this._indexBitsUsed, e = cc.sys.now(), i = 0; i < this._maxTouches; i++) { + if (!(1 & t)) + return this._indexBitsUsed |= 1 << i, + i; + var n = this._touches[i]; + if (e - n._lastModified > s) + return this._removeUsedIndexBit(i), + delete this._touchesIntegerDict[n.getID()], + i; + t >>= 1 + } + return -1 + }, + _removeUsedIndexBit: function(t) { + if (!(t < 0 || t >= this._maxTouches)) { + var e = 1 << t; + e = ~e, + this._indexBitsUsed &= e + } + }, + _glView: null, + _updateCanvasBoundingRect: function() { + var t = cc.game.canvas + , e = this._canvasBoundingRect + , i = document.documentElement + , n = window.pageXOffset - i.clientLeft + , r = window.pageYOffset - i.clientTop; + if (t.getBoundingClientRect) { + var s = t.getBoundingClientRect(); + e.left = s.left + n, + e.top = s.top + r, + e.width = s.width, + e.height = s.height + } else + t instanceof HTMLCanvasElement ? (e.left = n, + e.top = r, + e.width = t.width, + e.height = t.height) : (e.left = n, + e.top = r, + e.width = parseInt(t.style.width), + e.height = parseInt(t.style.height)) + }, + handleTouchesBegin: function(t) { + for (var e, i, s, a = [], o = this._touchesIntegerDict, l = n.now(), h = 0, c = t.length; h < c; h++) + if (null == o[s = (e = t[h]).getID()]) { + var u = this._getUnUsedIndex(); + if (-1 === u) { + cc.logID(2300, u); + continue + } + (i = this._touches[u] = new cc.Touch(e._point.x,e._point.y,e.getID()))._lastModified = l, + i._setPrevPoint(e._prevPoint), + o[s] = u, + a.push(i) + } + if (a.length > 0) { + this._glView._convertTouchesWithScale(a); + var _ = new cc.Event.EventTouch(a); + _._eventCode = cc.Event.EventTouch.BEGAN, + r.dispatchEvent(_) + } + }, + handleTouchesMove: function(t) { + for (var e, i, s, a = [], o = this._touches, l = n.now(), h = 0, c = t.length; h < c; h++) + s = (e = t[h]).getID(), + null != (i = this._touchesIntegerDict[s]) && o[i] && (o[i]._setPoint(e._point), + o[i]._setPrevPoint(e._prevPoint), + o[i]._lastModified = l, + a.push(o[i])); + if (a.length > 0) { + this._glView._convertTouchesWithScale(a); + var u = new cc.Event.EventTouch(a); + u._eventCode = cc.Event.EventTouch.MOVED, + r.dispatchEvent(u) + } + }, + handleTouchesEnd: function(t) { + var e = this.getSetOfTouchesEndOrCancel(t); + if (e.length > 0) { + this._glView._convertTouchesWithScale(e); + var i = new cc.Event.EventTouch(e); + i._eventCode = cc.Event.EventTouch.ENDED, + r.dispatchEvent(i) + } + this._preTouchPool.length = 0 + }, + handleTouchesCancel: function(t) { + var e = this.getSetOfTouchesEndOrCancel(t); + if (e.length > 0) { + this._glView._convertTouchesWithScale(e); + var i = new cc.Event.EventTouch(e); + i._eventCode = cc.Event.EventTouch.CANCELED, + r.dispatchEvent(i) + } + this._preTouchPool.length = 0 + }, + getSetOfTouchesEndOrCancel: function(t) { + for (var e, i, n, r = [], s = this._touches, a = this._touchesIntegerDict, o = 0, l = t.length; o < l; o++) + null != (i = a[n = (e = t[o]).getID()]) && s[i] && (s[i]._setPoint(e._point), + s[i]._setPrevPoint(e._prevPoint), + r.push(s[i]), + this._removeUsedIndexBit(i), + delete a[n]); + return r + }, + getPreTouch: function(t) { + for (var e = null, i = this._preTouchPool, n = t.getID(), r = i.length - 1; r >= 0; r--) + if (i[r].getID() === n) { + e = i[r]; + break + } + return e || (e = t), + e + }, + setPreTouch: function(t) { + for (var e = !1, i = this._preTouchPool, n = t.getID(), r = i.length - 1; r >= 0; r--) + if (i[r].getID() === n) { + i[r] = t, + e = !0; + break + } + e || (i.length <= 50 ? i.push(t) : (i[this._preTouchPoolPointer] = t, + this._preTouchPoolPointer = (this._preTouchPoolPointer + 1) % 50)) + }, + getTouchByXY: function(t, e, i) { + var n = this._preTouchPoint + , r = this._glView.convertToLocationInView(t, e, i) + , s = new cc.Touch(r.x,r.y,0); + return s._setPrevPoint(n.x, n.y), + n.x = r.x, + n.y = r.y, + s + }, + getMouseEvent: function(t, e, i) { + var n = this._prevMousePoint + , r = new cc.Event.EventMouse(i); + return r._setPrevCursor(n.x, n.y), + n.x = t.x, + n.y = t.y, + this._glView._convertMouseToLocationInView(n, e), + r.setLocation(n.x, n.y), + r + }, + getPointByEvent: function(t, e) { + return cc.sys.browserType !== cc.sys.BROWSER_TYPE_QQ && cc.sys.browserType !== cc.sys.BROWSER_TYPE_UC && cc.sys.browserType !== cc.sys.BROWSER_TYPE_SAFARI || this._updateCanvasBoundingRect(), + null != t.pageX ? { + x: t.pageX, + y: t.pageY + } : (e.left -= document.body.scrollLeft, + e.top -= document.body.scrollTop, + { + x: t.clientX, + y: t.clientY + }) + }, + getTouchesByEvent: function(t, e) { + for (var i, r, s, o = [], l = this._glView, h = this._preTouchPoint, c = t.changedTouches.length, u = 0; u < c; u++) + if (i = t.changedTouches[u]) { + var _; + _ = n.BROWSER_TYPE_FIREFOX === n.browserType ? l.convertToLocationInView(i.pageX, i.pageY, e, a) : l.convertToLocationInView(i.clientX, i.clientY, e, a), + null != i.identifier ? (r = new cc.Touch(_.x,_.y,i.identifier), + s = this.getPreTouch(r).getLocation(), + r._setPrevPoint(s.x, s.y), + this.setPreTouch(r)) : (r = new cc.Touch(_.x,_.y))._setPrevPoint(h.x, h.y), + h.x = _.x, + h.y = _.y, + o.push(r) + } + return o + }, + registerSystemEvent: function(t) { + if (!this._isRegisterEvent) { + this._glView = cc.view; + var e = this + , i = this._canvasBoundingRect; + window.addEventListener("resize", this._updateCanvasBoundingRect.bind(this)); + var s = n.isMobile + , a = "mouse"in n.capabilities + , o = "touches"in n.capabilities; + if (a) { + s || (window.addEventListener("mousedown", (function() { + e._mousePressed = !0 + } + ), !1), + window.addEventListener("mouseup", (function(t) { + if (e._mousePressed) { + e._mousePressed = !1; + var n = e.getPointByEvent(t, i); + if (!cc.rect(i.left, i.top, i.width, i.height).contains(n)) { + e.handleTouchesEnd([e.getTouchByXY(n.x, n.y, i)]); + var s = e.getMouseEvent(n, i, cc.Event.EventMouse.UP); + s.setButton(t.button), + r.dispatchEvent(s) + } + } + } + ), !1)); + for (var l = cc.Event.EventMouse, h = [!s && ["mousedown", l.DOWN, function(i, n, r, s) { + e._mousePressed = !0, + e.handleTouchesBegin([e.getTouchByXY(r.x, r.y, s)]), + t.focus() + } + ], !s && ["mouseup", l.UP, function(t, i, n, r) { + e._mousePressed = !1, + e.handleTouchesEnd([e.getTouchByXY(n.x, n.y, r)]) + } + ], !s && ["mousemove", l.MOVE, function(t, i, n, r) { + e.handleTouchesMove([e.getTouchByXY(n.x, n.y, r)]), + e._mousePressed || i.setButton(null) + } + ], ["mousewheel", l.SCROLL, function(t, e) { + e.setScrollData(0, t.wheelDelta) + } + ], ["DOMMouseScroll", l.SCROLL, function(t, e) { + e.setScrollData(0, -120 * t.detail) + } + ]], c = 0; c < h.length; ++c) { + var u = h[c]; + u && (function() { + var n = u[0] + , s = u[1] + , a = u[2]; + t.addEventListener(n, (function(t) { + var n = e.getPointByEvent(t, i) + , o = e.getMouseEvent(n, i, s); + o.setButton(t.button), + a(t, o, n, i), + r.dispatchEvent(o), + t.stopPropagation(), + t.preventDefault() + } + ), !1) + } + )() + } + } + if (window.navigator.msPointerEnabled) { + var _ = { + MSPointerDown: e.handleTouchesBegin, + MSPointerMove: e.handleTouchesMove, + MSPointerUp: e.handleTouchesEnd, + MSPointerCancel: e.handleTouchesCancel + } + , f = function(n) { + var r = _[n]; + t.addEventListener(n, (function(t) { + var n = document.documentElement; + i.adjustedLeft = i.left - n.scrollLeft, + i.adjustedTop = i.top - n.scrollTop, + r.call(e, [e.getTouchByXY(t.clientX, t.clientY, i)]), + t.stopPropagation() + } + ), !1) + }; + for (var d in _) + f(d) + } + if (o) { + var p = { + touchstart: function(i) { + e.handleTouchesBegin(i), + t.focus() + }, + touchmove: function(t) { + e.handleTouchesMove(t) + }, + touchend: function(t) { + e.handleTouchesEnd(t) + }, + touchcancel: function(t) { + e.handleTouchesCancel(t) + } + } + , m = function(n) { + var r = p[n]; + t.addEventListener(n, (function(t) { + if (t.changedTouches) { + var n = document.body; + i.adjustedLeft = i.left - (n.scrollLeft || window.scrollX || 0), + i.adjustedTop = i.top - (n.scrollTop || window.scrollY || 0), + r(e.getTouchesByEvent(t, i)), + t.stopPropagation(), + t.preventDefault() + } + } + ), !1) + }; + for (var y in p) + m(y) + } + this._registerKeyboardEvent(), + this._isRegisterEvent = !0 + } + }, + _registerKeyboardEvent: function() {}, + _registerAccelerometerEvent: function() {}, + update: function(t) { + this._accelCurTime > this._accelInterval && (this._accelCurTime -= this._accelInterval, + r.dispatchEvent(new cc.Event.EventAcceleration(this._acceleration))), + this._accelCurTime += t + } + }; + e.exports = cc.internal.inputManager = o + } + ), { + "../event-manager": 138, + "./CCMacro": 198, + "./CCSys": 202 + }], + 198: [(function(t, e) { + "use strict"; + cc.macro = { + RAD: Math.PI / 180, + DEG: 180 / Math.PI, + REPEAT_FOREVER: Number.MAX_VALUE - 1, + FLT_EPSILON: 1.192092896e-7, + MIN_ZINDEX: -Math.pow(2, 15), + MAX_ZINDEX: Math.pow(2, 15) - 1, + ONE: 1, + ZERO: 0, + SRC_ALPHA: 770, + SRC_ALPHA_SATURATE: 776, + SRC_COLOR: 768, + DST_ALPHA: 772, + DST_COLOR: 774, + ONE_MINUS_SRC_ALPHA: 771, + ONE_MINUS_SRC_COLOR: 769, + ONE_MINUS_DST_ALPHA: 773, + ONE_MINUS_DST_COLOR: 775, + ONE_MINUS_CONSTANT_ALPHA: 32772, + ONE_MINUS_CONSTANT_COLOR: 32770, + ORIENTATION_PORTRAIT: 1, + ORIENTATION_LANDSCAPE: 2, + ORIENTATION_AUTO: 3, + DENSITYDPI_DEVICE: "device-dpi", + DENSITYDPI_HIGH: "high-dpi", + DENSITYDPI_MEDIUM: "medium-dpi", + DENSITYDPI_LOW: "low-dpi", + FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX: !0, + DIRECTOR_STATS_POSITION: cc.v2(0, 0), + ENABLE_STACKABLE_ACTIONS: !0, + TOUCH_TIMEOUT: 5e3, + BATCH_VERTEX_COUNT: 2e4, + ENABLE_TILEDMAP_CULLING: !0, + ENABLE_TRANSPARENT_CANVAS: !1, + ENABLE_WEBGL_ANTIALIAS: !1, + ENABLE_CULLING: !1, + CLEANUP_IMAGE_CACHE: !1, + SHOW_MESH_WIREFRAME: !1, + SHOW_MESH_NORMAL: !1, + ENABLE_MULTI_TOUCH: !0, + ALLOW_IMAGE_BITMAP: !cc.sys.isMobile, + ENABLE_NATIVE_TTF_RENDERER: !0 + }, + Object.defineProperty(cc.macro, "ROTATE_ACTION_CCW", { + set: function(t) { + cc.RotateTo && cc.RotateBy && (cc.RotateTo._reverse = cc.RotateBy._reverse = t) + } + }), + cc.macro.SUPPORT_TEXTURE_FORMATS = [".pkm", ".pvr", ".webp", ".jpg", ".jpeg", ".bmp", ".png"], + cc.macro.KEY = { + none: 0, + back: 6, + menu: 18, + backspace: 8, + tab: 9, + enter: 13, + shift: 16, + ctrl: 17, + alt: 18, + pause: 19, + capslock: 20, + escape: 27, + space: 32, + pageup: 33, + pagedown: 34, + end: 35, + home: 36, + left: 37, + up: 38, + right: 39, + down: 40, + select: 41, + insert: 45, + Delete: 46, + 0: 48, + 1: 49, + 2: 50, + 3: 51, + 4: 52, + 5: 53, + 6: 54, + 7: 55, + 8: 56, + 9: 57, + a: 65, + b: 66, + c: 67, + d: 68, + e: 69, + f: 70, + g: 71, + h: 72, + i: 73, + j: 74, + k: 75, + l: 76, + m: 77, + n: 78, + o: 79, + p: 80, + q: 81, + r: 82, + s: 83, + t: 84, + u: 85, + v: 86, + w: 87, + x: 88, + y: 89, + z: 90, + num0: 96, + num1: 97, + num2: 98, + num3: 99, + num4: 100, + num5: 101, + num6: 102, + num7: 103, + num8: 104, + num9: 105, + "*": 106, + "+": 107, + "-": 109, + numdel: 110, + "/": 111, + f1: 112, + f2: 113, + f3: 114, + f4: 115, + f5: 116, + f6: 117, + f7: 118, + f8: 119, + f9: 120, + f10: 121, + f11: 122, + f12: 123, + numlock: 144, + scrolllock: 145, + ";": 186, + semicolon: 186, + equal: 187, + "=": 187, + ",": 188, + comma: 188, + dash: 189, + ".": 190, + period: 190, + forwardslash: 191, + grave: 192, + "[": 219, + openbracket: 219, + backslash: 220, + "]": 221, + closebracket: 221, + quote: 222, + dpadLeft: 1e3, + dpadRight: 1001, + dpadUp: 1003, + dpadDown: 1004, + dpadCenter: 1005 + }, + cc.macro.ImageFormat = cc.Enum({ + JPG: 0, + PNG: 1, + TIFF: 2, + WEBP: 3, + PVR: 4, + ETC: 5, + S3TC: 6, + ATITC: 7, + TGA: 8, + RAWDATA: 9, + UNKNOWN: 10 + }), + cc.macro.BlendFactor = cc.Enum({ + ONE: 1, + ZERO: 0, + SRC_ALPHA: 770, + SRC_COLOR: 768, + DST_ALPHA: 772, + DST_COLOR: 774, + ONE_MINUS_SRC_ALPHA: 771, + ONE_MINUS_SRC_COLOR: 769, + ONE_MINUS_DST_ALPHA: 773, + ONE_MINUS_DST_COLOR: 775 + }), + cc.macro.TextAlignment = cc.Enum({ + LEFT: 0, + CENTER: 1, + RIGHT: 2 + }), + cc.macro.VerticalTextAlignment = cc.Enum({ + TOP: 0, + CENTER: 1, + BOTTOM: 2 + }), + e.exports = cc.macro + } + ), {}], + 199: [(function(t, e) { + "use strict"; + var i = t("./js") + , n = t("./CCClass") + , r = 1; + function s() { + this._name = "", + this._objFlags = 0 + } + n.fastDefine("cc.Object", s, { + _name: "", + _objFlags: 0 + }), + i.value(s, "Flags", { + Destroyed: r, + DontSave: 8, + EditorOnly: 16, + Dirty: 32, + DontDestroy: 64, + PersistentMask: -4192741, + Destroying: 128, + Deactivating: 256, + LockedInEditor: 512, + HideInHierarchy: 1024, + IsPreloadStarted: 8192, + IsOnLoadStarted: 32768, + IsOnLoadCalled: 16384, + IsOnEnableCalled: 2048, + IsStartCalled: 65536, + IsEditorOnEnableCalled: 4096, + IsPositionLocked: 1 << 21, + IsRotationLocked: 1 << 17, + IsScaleLocked: 1 << 18, + IsAnchorLocked: 1 << 19, + IsSizeLocked: 1 << 20 + }); + var a = []; + i.value(s, "_deferredDestroy", (function() { + for (var t = a.length, e = 0; e < t; ++e) { + var i = a[e]; + i._objFlags & r || i._destroyImmediate() + } + t === a.length ? a.length = 0 : a.splice(0, t) + } + )); + var o = s.prototype; + function l(t, e) { + var i, r = t instanceof cc._BaseNode || t instanceof cc.Component, s = r ? "_id" : null, a = {}; + for (i in t) + if (t.hasOwnProperty(i)) { + if (i === s) + continue; + switch (typeof t[i]) { + case "string": + a[i] = ""; + break; + case "object": + case "function": + a[i] = null + } + } + if (cc.Class._isCCClass(e)) + for (var o = cc.Class.Attr.getClassAttrs(e), l = e.__props__, h = 0; h < l.length; h++) { + var c = (i = l[h]) + cc.Class.Attr.DELIMETER + "default"; + if (c in o) { + if (r && "_id" === i) + continue; + switch (typeof o[c]) { + case "string": + a[i] = ""; + break; + case "object": + case "function": + a[i] = null; + break; + case "undefined": + a[i] = void 0 + } + } + } + var u = ""; + for (i in a) { + var _; + _ = n.IDENTIFIER_RE.test(i) ? "o." + i + "=" : "o[" + n.escapeForJS(i) + "]="; + var f = a[i]; + "" === f && (f = '""'), + u += _ + f + ";\n" + } + return Function("o", u) + } + i.getset(o, "name", (function() { + return this._name + } + ), (function(t) { + this._name = t + } + ), !0), + i.get(o, "isValid", (function() { + return !(this._objFlags & r) + } + ), !0), + o.destroy = function() { + return this._objFlags & r ? (cc.warnID(5e3), + !1) : !(4 & this._objFlags || (this._objFlags |= 4, + a.push(this), + 0)) + } + , + o._destruct = function() { + var t = this.constructor + , e = t.__destruct__; + e || (e = l(this, t), + i.value(t, "__destruct__", e, !0)), + e(this) + } + , + o._onPreDestroy = null, + o._destroyImmediate = function() { + this._objFlags & r ? cc.errorID(5e3) : (this._onPreDestroy && this._onPreDestroy(), + this._destruct(), + this._objFlags |= r) + } + , + o._deserialize = null, + cc.isValid = function(t, e) { + return "object" == typeof t ? !(!t || t._objFlags & (e ? 4 | r : r)) : void 0 !== t + } + , + cc.Object = e.exports = s + } + ), { + "./CCClass": 193, + "./js": 214 + }], + 200: [(function(t, e) { + "use strict"; + var i = t("../platform/js"); + cc.SAXParser = function() { + window.DOMParser ? (this._isSupportDOMParser = !0, + this._parser = new DOMParser) : (this._isSupportDOMParser = !1, + this._parser = null) + } + , + cc.SAXParser.prototype = { + constructor: cc.SAXParser, + parse: function(t) { + return this._parseXML(t) + }, + _parseXML: function(t) { + var e; + return this._isSupportDOMParser ? e = this._parser.parseFromString(t, "text/xml") : ((e = new ActiveXObject("Microsoft.XMLDOM")).async = "false", + e.loadXML(t)), + e + } + }, + cc.PlistParser = function() { + cc.SAXParser.call(this) + } + , + i.extend(cc.PlistParser, cc.SAXParser), + i.mixin(cc.PlistParser.prototype, { + parse: function(t) { + var e = this._parseXML(t) + , i = e.documentElement; + if ("plist" !== i.tagName) + return cc.warnID(5100), + {}; + for (var n = null, r = 0, s = i.childNodes.length; r < s && 1 !== (n = i.childNodes[r]).nodeType; r++) + ; + return e = null, + this._parseNode(n) + }, + _parseNode: function(t) { + var e = null + , i = t.tagName; + if ("dict" === i) + e = this._parseDict(t); + else if ("array" === i) + e = this._parseArray(t); + else if ("string" === i) + if (1 === t.childNodes.length) + e = t.firstChild.nodeValue; + else { + e = ""; + for (var n = 0; n < t.childNodes.length; n++) + e += t.childNodes[n].nodeValue + } + else + "false" === i ? e = !1 : "true" === i ? e = !0 : "real" === i ? e = parseFloat(t.firstChild.nodeValue) : "integer" === i && (e = parseInt(t.firstChild.nodeValue, 10)); + return e + }, + _parseArray: function(t) { + for (var e = [], i = 0, n = t.childNodes.length; i < n; i++) { + var r = t.childNodes[i]; + 1 === r.nodeType && e.push(this._parseNode(r)) + } + return e + }, + _parseDict: function(t) { + for (var e = {}, i = null, n = 0, r = t.childNodes.length; n < r; n++) { + var s = t.childNodes[n]; + 1 === s.nodeType && ("key" === s.tagName ? i = s.firstChild.nodeValue : e[i] = this._parseNode(s)) + } + return e + } + }), + cc.saxParser = new cc.SAXParser, + cc.plistParser = new cc.PlistParser, + e.exports = { + saxParser: cc.saxParser, + plistParser: cc.plistParser + } + } + ), { + "../platform/js": 214 + }], + 201: [(function() { + "use strict"; + cc.screen = { + _supportsFullScreen: !1, + _onfullscreenchange: null, + _onfullscreenerror: null, + _preOnFullScreenChange: null, + _preOnFullScreenError: null, + _preOnTouch: null, + _touchEvent: "", + _fn: null, + _fnMap: [["requestFullscreen", "exitFullscreen", "fullscreenchange", "fullscreenEnabled", "fullscreenElement", "fullscreenerror"], ["requestFullScreen", "exitFullScreen", "fullScreenchange", "fullScreenEnabled", "fullScreenElement", "fullscreenerror"], ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitIsFullScreen", "webkitCurrentFullScreenElement", "webkitfullscreenerror"], ["mozRequestFullScreen", "mozCancelFullScreen", "mozfullscreenchange", "mozFullScreen", "mozFullScreenElement", "mozfullscreenerror"], ["msRequestFullscreen", "msExitFullscreen", "MSFullscreenChange", "msFullscreenEnabled", "msFullscreenElement", "msfullscreenerror"]], + init: function() { + this._fn = {}; + var t, e, i, n, r = this._fnMap; + for (t = 0, + e = r.length; t < e; t++) + if ((i = r[t]) && void 0 !== document[i[1]]) { + for (t = 0, + n = i.length; t < n; t++) + this._fn[r[0][t]] = i[t]; + break + } + this._supportsFullScreen = void 0 !== this._fn.requestFullscreen, + this._touchEvent = "ontouchend"in window ? "touchend" : "mousedown" + }, + fullScreen: function() { + return !!this._supportsFullScreen && !!(document[this._fn.fullscreenElement] || document[this._fn.webkitFullscreenElement] || document[this._fn.mozFullScreenElement]) + }, + requestFullScreen: function(t, e, i) { + if (t && "video" === t.tagName.toLowerCase()) { + if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser && t.readyState > 0) + return void (t.webkitEnterFullscreen && t.webkitEnterFullscreen()); + t.setAttribute("x5-video-player-fullscreen", "true") + } + if (this._supportsFullScreen) { + if (t = t || document.documentElement, + e) { + var n = this._fn.fullscreenchange; + this._onfullscreenchange && document.removeEventListener(n, this._onfullscreenchange), + this._onfullscreenchange = e, + document.addEventListener(n, e, !1) + } + if (i) { + var r = this._fn.fullscreenerror; + this._onfullscreenerror && document.removeEventListener(r, this._onfullscreenerror), + this._onfullscreenerror = i, + document.addEventListener(r, i, { + once: !0 + }) + } + var s = t[this._fn.requestFullscreen](); + void 0 === document[this._fn.fullscreenerror] && window.Promise && s instanceof Promise && s.catch((function() {} + )) + } + }, + exitFullScreen: function(t) { + if (t && "video" === t.tagName.toLowerCase()) { + if (cc.sys.os === cc.sys.OS_IOS && cc.sys.isBrowser) + return void (t.webkitExitFullscreen && t.webkitExitFullscreen()); + t.setAttribute("x5-video-player-fullscreen", "false") + } + return !this._supportsFullScreen || document[this._fn.exitFullscreen]() + }, + autoFullScreen: function(t, e) { + t = t || document.body, + this._ensureFullScreen(t, e), + this.requestFullScreen(t, e) + }, + disableAutoFullScreen: function(t) { + var e = cc.game.canvas || t + , i = this._touchEvent; + this._preOnTouch && (e.removeEventListener(i, this._preOnTouch), + this._preOnTouch = null) + }, + _ensureFullScreen: function(t, e) { + var i = this + , n = cc.game.canvas || t + , r = this._fn.fullscreenerror + , s = this._touchEvent; + function a() { + i._preOnFullScreenError = null, + i._preOnTouch && n.removeEventListener(s, i._preOnTouch), + i._preOnTouch = function() { + i._preOnTouch = null, + i.requestFullScreen(t, e) + } + , + n.addEventListener(s, i._preOnTouch, { + once: !0 + }) + } + this._preOnFullScreenError && t.removeEventListener(r, this._preOnFullScreenError), + this._preOnFullScreenError = a, + t.addEventListener(r, a, { + once: !0 + }) + } + }, + cc.screen.init() + } + ), {}], + 202: [(function(t, e) { + "use strict"; + window._CCSettings && _CCSettings.platform; + var i = "undefined" == typeof window ? global : window + , n = cc && cc.sys ? cc.sys : (function() { + cc.sys = {}; + var t, e, n = cc.sys; + if (n.LANGUAGE_ENGLISH = "en", + n.LANGUAGE_CHINESE = "zh", + n.LANGUAGE_FRENCH = "fr", + n.LANGUAGE_ITALIAN = "it", + n.LANGUAGE_GERMAN = "de", + n.LANGUAGE_SPANISH = "es", + n.LANGUAGE_DUTCH = "du", + n.LANGUAGE_RUSSIAN = "ru", + n.LANGUAGE_KOREAN = "ko", + n.LANGUAGE_JAPANESE = "ja", + n.LANGUAGE_HUNGARIAN = "hu", + n.LANGUAGE_PORTUGUESE = "pt", + n.LANGUAGE_ARABIC = "ar", + n.LANGUAGE_NORWEGIAN = "no", + n.LANGUAGE_POLISH = "pl", + n.LANGUAGE_TURKISH = "tr", + n.LANGUAGE_UKRAINIAN = "uk", + n.LANGUAGE_ROMANIAN = "ro", + n.LANGUAGE_BULGARIAN = "bg", + n.LANGUAGE_UNKNOWN = "unknown", + n.OS_IOS = "iOS", + n.OS_ANDROID = "Android", + n.OS_WINDOWS = "Windows", + n.OS_MARMALADE = "Marmalade", + n.OS_LINUX = "Linux", + n.OS_BADA = "Bada", + n.OS_BLACKBERRY = "Blackberry", + n.OS_OSX = "OS X", + n.OS_WP8 = "WP8", + n.OS_WINRT = "WINRT", + n.OS_UNKNOWN = "Unknown", + n.UNKNOWN = -1, + n.WIN32 = 0, + n.LINUX = 1, + n.MACOS = 2, + n.ANDROID = 3, + n.IPHONE = 4, + n.IPAD = 5, + n.BLACKBERRY = 6, + n.NACL = 7, + n.EMSCRIPTEN = 8, + n.TIZEN = 9, + n.WINRT = 10, + n.WP8 = 11, + n.MOBILE_BROWSER = 100, + n.DESKTOP_BROWSER = 101, + n.EDITOR_PAGE = 102, + n.EDITOR_CORE = 103, + n.WECHAT_GAME = 104, + n.QQ_PLAY = 105, + n.FB_PLAYABLE_ADS = 106, + n.BAIDU_GAME = 107, + n.VIVO_GAME = 108, + n.OPPO_GAME = 109, + n.HUAWEI_GAME = 110, + n.XIAOMI_GAME = 111, + n.JKW_GAME = 112, + n.ALIPAY_GAME = 113, + n.WECHAT_GAME_SUB = 114, + n.BAIDU_GAME_SUB = 115, + n.QTT_GAME = 116, + n.BYTEDANCE_GAME = 117, + n.BYTEDANCE_GAME_SUB = 118, + n.LINKSURE = 119, + n.BROWSER_TYPE_WECHAT = "wechat", + n.BROWSER_TYPE_ANDROID = "androidbrowser", + n.BROWSER_TYPE_IE = "ie", + n.BROWSER_TYPE_EDGE = "edge", + n.BROWSER_TYPE_QQ = "qqbrowser", + n.BROWSER_TYPE_MOBILE_QQ = "mqqbrowser", + n.BROWSER_TYPE_UC = "ucbrowser", + n.BROWSER_TYPE_UCBS = "ucbs", + n.BROWSER_TYPE_360 = "360browser", + n.BROWSER_TYPE_BAIDU_APP = "baiduboxapp", + n.BROWSER_TYPE_BAIDU = "baidubrowser", + n.BROWSER_TYPE_MAXTHON = "maxthon", + n.BROWSER_TYPE_OPERA = "opera", + n.BROWSER_TYPE_OUPENG = "oupeng", + n.BROWSER_TYPE_MIUI = "miuibrowser", + n.BROWSER_TYPE_FIREFOX = "firefox", + n.BROWSER_TYPE_SAFARI = "safari", + n.BROWSER_TYPE_CHROME = "chrome", + n.BROWSER_TYPE_LIEBAO = "liebao", + n.BROWSER_TYPE_QZONE = "qzone", + n.BROWSER_TYPE_SOUGOU = "sogou", + n.BROWSER_TYPE_HUAWEI = "huawei", + n.BROWSER_TYPE_UNKNOWN = "unknown", + n.isNative = !1, + n.isBrowser = "object" == typeof window && "object" == typeof document && !0, + n.glExtension = function(t) { + return !!cc.renderer.device.ext(t) + } + , + n.getMaxJointMatrixSize = function() { + if (!n._maxJointMatrixSize) { + var t = cc.game._renderContext + , e = Math.floor(t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS) / 4) - 10; + n._maxJointMatrixSize = e < 50 ? 0 : 50 + } + return n._maxJointMatrixSize + } + , + n.getSafeAreaRect = function() { + var t = cc.view.getVisibleSize(); + return cc.rect(0, 0, t.width, t.height) + } + , + i.__globalAdapter && i.__globalAdapter.adaptSys) + i.__globalAdapter.adaptSys(n); + else { + var r = window + , s = r.navigator + , a = document + , o = a.documentElement + , l = s.userAgent.toLowerCase(); + n.isMobile = /mobile|android|iphone|ipad/.test(l), + "undefined" != typeof FbPlayableAd ? n.platform = n.FB_PLAYABLE_ADS : n.platform = n.isMobile ? n.MOBILE_BROWSER : n.DESKTOP_BROWSER; + var h = s.language; + h = h || s.browserLanguage, + n.languageCode = h.toLowerCase(), + h = h ? h.split("-")[0] : n.LANGUAGE_ENGLISH, + n.language = h; + var c = !1 + , u = !1 + , _ = "" + , f = 0 + , d = /android\s*(\d+(?:\.\d+)*)/i.exec(l) || /android\s*(\d+(?:\.\d+)*)/i.exec(s.platform); + d && (c = !0, + _ = d[1] || "", + f = parseInt(_) || 0), + (d = /(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(l)) ? (u = !0, + _ = d[2] || "", + f = parseInt(_) || 0) : (/(iPhone|iPad|iPod)/.exec(s.platform) || "MacIntel" === s.platform && s.maxTouchPoints && s.maxTouchPoints > 1) && (u = !0, + _ = "", + f = 0); + var p = n.OS_UNKNOWN; + -1 !== s.appVersion.indexOf("Win") ? p = n.OS_WINDOWS : u ? p = n.OS_IOS : -1 !== s.appVersion.indexOf("Mac") ? p = n.OS_OSX : -1 !== s.appVersion.indexOf("X11") && -1 === s.appVersion.indexOf("Linux") ? p = n.OS_UNIX : c ? p = n.OS_ANDROID : -1 === s.appVersion.indexOf("Linux") && -1 === l.indexOf("ubuntu") || (p = n.OS_LINUX), + n.os = p, + n.osVersion = _, + n.osMainVersion = f, + n.browserType = n.BROWSER_TYPE_UNKNOWN, + (function() { + var t = /mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(l) || /qq|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(l) || /chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(l) + , e = t ? t[0].toLowerCase() : n.BROWSER_TYPE_UNKNOWN; + "safari" === e && c ? e = n.BROWSER_TYPE_ANDROID : "qq" === e && l.match(/android.*applewebkit/i) && (e = n.BROWSER_TYPE_ANDROID); + var i = { + micromessenger: n.BROWSER_TYPE_WECHAT, + trident: n.BROWSER_TYPE_IE, + edge: n.BROWSER_TYPE_EDGE, + "360 aphone": n.BROWSER_TYPE_360, + mxbrowser: n.BROWSER_TYPE_MAXTHON, + "opr/": n.BROWSER_TYPE_OPERA, + ubrowser: n.BROWSER_TYPE_UC, + huaweibrowser: n.BROWSER_TYPE_HUAWEI + }; + "qqbrowser" !== e && "mqqbrowser" !== e || l.match(/wechat|micromessenger/i) && (e = n.BROWSER_TYPE_WECHAT), + n.browserType = i[e] || e + } + )(), + n.browserVersion = "", + (e = l.match(/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i)) || (e = l.match(/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i)), + n.browserVersion = e ? e[4] : ""; + var m = window.innerWidth || document.documentElement.clientWidth + , y = window.innerHeight || document.documentElement.clientHeight + , v = window.devicePixelRatio || 1; + n.windowPixelResolution = { + width: v * m, + height: v * y + }, + n._checkWebGLRenderMode = function() { + if (cc.game.renderType !== cc.game.RENDER_TYPE_WEBGL) + throw new Error("This feature supports WebGL render mode only.") + } + ; + var g = document.createElement("canvas"); + try { + var A = n.localStorage = r.localStorage; + A.setItem("storage", ""), + A.removeItem("storage"), + A = null + } catch (M) { + var x = function() { + cc.warnID(5200) + }; + n.localStorage = { + getItem: x, + setItem: x, + removeItem: x, + clear: x + } + } + var b = g.toDataURL("image/webp").startsWith("data:image/webp") + , C = !!g.getContext("2d") + , T = !1; + r.WebGLRenderingContext && (T = !0); + var S, w = n.capabilities = { + canvas: C, + opengl: T, + webp: b, + imageBitmap: !1 + }; + "undefined" != typeof createImageBitmap && "undefined" != typeof Blob && (g.width = g.height = 2, + createImageBitmap(g, {}).then((function(t) { + w.imageBitmap = !0, + t.close && t.close() + } + )).catch((function() {} + ))), + (void 0 !== o.ontouchstart || void 0 !== a.ontouchstart || s.msPointerEnabled) && (w.touches = !0), + void 0 !== o.onmouseup && (w.mouse = !0), + void 0 !== o.onkeyup && (w.keyboard = !0), + (r.DeviceMotionEvent || r.DeviceOrientationEvent) && (w.accelerometer = !0), + (function() { + n.browserVersion; + var t = !!(window.AudioContext || window.webkitAudioContext || window.mozAudioContext); + S = { + ONLY_ONE: !1, + WEB_AUDIO: t, + DELAY_CREATE_CTX: !1 + }, + n.os === n.OS_IOS && (S.USE_LOADER_EVENT = "loadedmetadata"), + n.browserType === n.BROWSER_TYPE_FIREFOX && (S.DELAY_CREATE_CTX = !0, + S.USE_LOADER_EVENT = "canplay"), + n.os === n.OS_ANDROID && n.browserType === n.BROWSER_TYPE_UC && (S.ONE_SOURCE = !0) + } + )(); + try { + S.WEB_AUDIO && (S.context = new (window.AudioContext || window.webkitAudioContext || window.mozAudioContext), + S.DELAY_CREATE_CTX && setTimeout((function() { + S.context = new (window.AudioContext || window.webkitAudioContext || window.mozAudioContext) + } + ), 0)) + } catch (D) { + S.WEB_AUDIO = !1, + cc.logID(5201) + } + var E = []; + (t = document.createElement("audio")).canPlayType && (t.canPlayType('audio/ogg; codecs="vorbis"') && E.push(".ogg"), + t.canPlayType("audio/mpeg") && E.push(".mp3"), + t.canPlayType('audio/wav; codecs="1"') && E.push(".wav"), + t.canPlayType("audio/mp4") && E.push(".mp4"), + t.canPlayType("audio/x-m4a") && E.push(".m4a")), + S.format = E, + n.__audioSupport = S + } + return n.NetworkType = { + NONE: 0, + LAN: 1, + WWAN: 2 + }, + n.getNetworkType = function() { + return n.NetworkType.LAN + } + , + n.getBatteryLevel = function() { + return 1 + } + , + n.garbageCollect = function() {} + , + n.restartVM = function() {} + , + n.isObjectValid = function(t) { + return !!t + } + , + n.dump = function() { + var t = ""; + t += "isMobile : " + this.isMobile + "\r\n", + t += "language : " + this.language + "\r\n", + t += "browserType : " + this.browserType + "\r\n", + t += "browserVersion : " + this.browserVersion + "\r\n", + t += "capabilities : " + JSON.stringify(this.capabilities) + "\r\n", + t += "os : " + this.os + "\r\n", + t += "osVersion : " + this.osVersion + "\r\n", + t += "platform : " + this.platform + "\r\n", + t += "Using " + (cc.game.renderType === cc.game.RENDER_TYPE_WEBGL ? "WEBGL" : "CANVAS") + " renderer.\r\n", + cc.log(t) + } + , + n.openURL = function(t) { + window.open(t) + } + , + n.now = function() { + return Date.now ? Date.now() : +new Date + } + , + n + } + )(); + e.exports = n + } + ), {}], + 203: [(function(t, e) { + "use strict"; + var i = t("../event/event-target") + , n = t("../platform/js") + , r = t("../renderer"); + t("../platform/CCClass"); + var s = { + init: function() { + this.html = document.getElementsByTagName("html")[0] + }, + availWidth: function(t) { + return t && t !== this.html ? t.clientWidth : window.innerWidth + }, + availHeight: function(t) { + return t && t !== this.html ? t.clientHeight : window.innerHeight + }, + meta: { + width: "device-width" + }, + adaptationType: cc.sys.browserType + }; + switch (cc.sys.os === cc.sys.OS_IOS && (s.adaptationType = cc.sys.BROWSER_TYPE_SAFARI), + s.adaptationType) { + case cc.sys.BROWSER_TYPE_SAFARI: + case cc.sys.BROWSER_TYPE_SOUGOU: + case cc.sys.BROWSER_TYPE_UC: + s.meta["minimal-ui"] = "true", + s.availWidth = function(t) { + return t.clientWidth + } + , + s.availHeight = function(t) { + return t.clientHeight + } + } + var a = null + , o = function() { + i.call(this); + var t = this + , e = cc.ContainerStrategy + , n = cc.ContentStrategy; + s.init(this), + t._frameSize = cc.size(0, 0), + t._designResolutionSize = cc.size(0, 0), + t._originalDesignResolutionSize = cc.size(0, 0), + t._scaleX = 1, + t._scaleY = 1, + t._viewportRect = cc.rect(0, 0, 0, 0), + t._visibleRect = cc.rect(0, 0, 0, 0), + t._autoFullScreen = !1, + t._devicePixelRatio = 1, + t._maxPixelRatio = 2, + t._retinaEnabled = !1, + t._resizeCallback = null, + t._resizing = !1, + t._resizeWithBrowserSize = !1, + t._orientationChanging = !0, + t._isRotated = !1, + t._orientation = cc.macro.ORIENTATION_AUTO, + t._isAdjustViewport = !0, + t._antiAliasEnabled = !1, + t._resolutionPolicy = null, + t._rpExactFit = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,n.EXACT_FIT), + t._rpShowAll = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,n.SHOW_ALL), + t._rpNoBorder = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,n.NO_BORDER), + t._rpFixedHeight = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,n.FIXED_HEIGHT), + t._rpFixedWidth = new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,n.FIXED_WIDTH), + cc.game.once(cc.game.EVENT_ENGINE_INITED, this.init, this) + }; + cc.js.extend(o, i), + cc.js.mixin(o.prototype, { + init: function() { + this._initFrameSize(); + var t = cc.game.canvas.width + , e = cc.game.canvas.height; + this._designResolutionSize.width = t, + this._designResolutionSize.height = e, + this._originalDesignResolutionSize.width = t, + this._originalDesignResolutionSize.height = e, + this._viewportRect.width = t, + this._viewportRect.height = e, + this._visibleRect.width = t, + this._visibleRect.height = e, + cc.winSize.width = this._visibleRect.width, + cc.winSize.height = this._visibleRect.height, + cc.visibleRect && cc.visibleRect.init(this._visibleRect) + }, + _resizeEvent: function(t) { + var e; + e = this.setDesignResolutionSize ? this : cc.view; + var i = cc.sys; + if (i.browserType !== i.BROWSER_TYPE_UC || i.os !== i.OS_IOS) { + var n = e._frameSize.width + , r = e._frameSize.height + , s = e._isRotated; + if (cc.sys.isMobile) { + var a = cc.game.container.style + , o = a.margin; + a.margin = "0", + a.display = "none", + e._initFrameSize(), + a.margin = o, + a.display = "block" + } else + e._initFrameSize(); + if (!0 === t || e._isRotated !== s || e._frameSize.width !== n || e._frameSize.height !== r) { + var l = e._originalDesignResolutionSize.width + , h = e._originalDesignResolutionSize.height; + e._resizing = !0, + l > 0 && e.setDesignResolutionSize(l, h, e._resolutionPolicy), + e._resizing = !1, + e.emit("canvas-resize"), + e._resizeCallback && e._resizeCallback.call() + } + } else + setTimeout((function() { + e._resizeEvent(t) + } + ), 0) + }, + _orientationChange: function() { + cc.view._orientationChanging = !0, + cc.view._resizeEvent(), + cc.sys.browserType === cc.sys.BROWSER_TYPE_SAFARI && cc.sys.isMobile && setTimeout((function() { + window.innerHeight > window.innerWidth && window.scrollTo(0, 1) + } + ), 500) + }, + _resize: function() { + cc.view._resizeEvent(!1) + }, + resizeWithBrowserSize: function(t) { + t ? this._resizeWithBrowserSize || (this._resizeWithBrowserSize = !0, + window.addEventListener("resize", this._resize), + window.addEventListener("orientationchange", this._orientationChange)) : this._resizeWithBrowserSize && (this._resizeWithBrowserSize = !1, + window.removeEventListener("resize", this._resize), + window.removeEventListener("orientationchange", this._orientationChange)) + }, + setResizeCallback: function(t) { + "function" != typeof t && null != t || (this._resizeCallback = t) + }, + setOrientation: function(t) { + if ((t &= cc.macro.ORIENTATION_AUTO) && this._orientation !== t) { + this._orientation = t; + var e = this._originalDesignResolutionSize.width + , i = this._originalDesignResolutionSize.height; + this.setDesignResolutionSize(e, i, this._resolutionPolicy) + } + }, + _initFrameSize: function() { + var t = this._frameSize + , e = s.availWidth(cc.game.frame) + , i = s.availHeight(cc.game.frame) + , n = e >= i; + !cc.sys.isMobile || n && this._orientation & cc.macro.ORIENTATION_LANDSCAPE || !n && this._orientation & cc.macro.ORIENTATION_PORTRAIT ? (t.width = e, + t.height = i, + cc.game.container.style["-webkit-transform"] = "rotate(0deg)", + cc.game.container.style.transform = "rotate(0deg)", + this._isRotated = !1) : (t.width = i, + t.height = e, + cc.game.container.style["-webkit-transform"] = "rotate(90deg)", + cc.game.container.style.transform = "rotate(90deg)", + cc.game.container.style["-webkit-transform-origin"] = "0px 0px 0px", + cc.game.container.style.transformOrigin = "0px 0px 0px", + this._isRotated = !0), + this._orientationChanging && setTimeout((function() { + cc.view._orientationChanging = !1 + } + ), 1e3) + }, + _setViewportMeta: function(t, e) { + var i = document.getElementById("cocosMetaElement"); + i && e && document.head.removeChild(i); + var n, r, s, a = document.getElementsByName("viewport"), o = a ? a[0] : null; + for (r in n = o ? o.content : "", + (i = i || document.createElement("meta")).id = "cocosMetaElement", + i.name = "viewport", + i.content = "", + t) + -1 == n.indexOf(r) ? n += "," + r + "=" + t[r] : e && (s = new RegExp(r + "s*=s*[^,]+"), + n = n.replace(s, r + "=" + t[r])); + /^,/.test(n) && (n = n.substr(1)), + i.content = n, + o && (o.content = n), + document.head.appendChild(i) + }, + _adjustViewportMeta: function() { + this._isAdjustViewport && (this._setViewportMeta(s.meta, !1), + this._isAdjustViewport = !1) + }, + adjustViewportMeta: function(t) { + this._isAdjustViewport = t + }, + enableRetina: function(t) { + this._retinaEnabled = !!t + }, + isRetinaEnabled: function() { + return this._retinaEnabled + }, + enableAntiAlias: function(t) { + if (cc.warnID(9200), + this._antiAliasEnabled !== t) + if (this._antiAliasEnabled = t, + cc.game.renderType === cc.game.RENDER_TYPE_WEBGL) + cc.assetManager.assets.forEach((function(e) { + if (e instanceof cc.Texture2D) { + var i = cc.Texture2D.Filter; + t ? e.setFilters(i.LINEAR, i.LINEAR) : e.setFilters(i.NEAREST, i.NEAREST) + } + } + )); + else if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) { + var e = cc.game.canvas.getContext("2d"); + e.imageSmoothingEnabled = t, + e.mozImageSmoothingEnabled = t + } + }, + isAntiAliasEnabled: function() { + return this._antiAliasEnabled + }, + enableAutoFullScreen: function(t) { + t && t !== this._autoFullScreen && cc.sys.isMobile ? (this._autoFullScreen = !0, + cc.screen.autoFullScreen(cc.game.frame)) : (this._autoFullScreen = !1, + cc.screen.disableAutoFullScreen(cc.game.frame)) + }, + isAutoFullScreenEnabled: function() { + return this._autoFullScreen + }, + setCanvasSize: function(t, e) { + var i = cc.game.canvas + , n = cc.game.container; + i.width = t * this._devicePixelRatio, + i.height = e * this._devicePixelRatio, + i.style.width = t + "px", + i.style.height = e + "px", + n.style.width = t + "px", + n.style.height = e + "px", + this._resizeEvent() + }, + getCanvasSize: function() { + return cc.size(cc.game.canvas.width, cc.game.canvas.height) + }, + getFrameSize: function() { + return cc.size(this._frameSize.width, this._frameSize.height) + }, + setFrameSize: function(t, e) { + this._frameSize.width = t, + this._frameSize.height = e, + cc.game.frame.style.width = t + "px", + cc.game.frame.style.height = e + "px", + this._resizeEvent(!0) + }, + getVisibleSize: function() { + return cc.size(this._visibleRect.width, this._visibleRect.height) + }, + getVisibleSizeInPixel: function() { + return cc.size(this._visibleRect.width * this._scaleX, this._visibleRect.height * this._scaleY) + }, + getVisibleOrigin: function() { + return cc.v2(this._visibleRect.x, this._visibleRect.y) + }, + getVisibleOriginInPixel: function() { + return cc.v2(this._visibleRect.x * this._scaleX, this._visibleRect.y * this._scaleY) + }, + getResolutionPolicy: function() { + return this._resolutionPolicy + }, + setResolutionPolicy: function(t) { + var e = this; + if (t instanceof cc.ResolutionPolicy) + e._resolutionPolicy = t; + else { + var i = cc.ResolutionPolicy; + t === i.EXACT_FIT && (e._resolutionPolicy = e._rpExactFit), + t === i.SHOW_ALL && (e._resolutionPolicy = e._rpShowAll), + t === i.NO_BORDER && (e._resolutionPolicy = e._rpNoBorder), + t === i.FIXED_HEIGHT && (e._resolutionPolicy = e._rpFixedHeight), + t === i.FIXED_WIDTH && (e._resolutionPolicy = e._rpFixedWidth) + } + }, + setDesignResolutionSize: function(t, e, i) { + if (t > 0 && e > 0) { + this.setResolutionPolicy(i); + var n = this._resolutionPolicy; + if (n && n.preApply(this), + cc.sys.isMobile && this._adjustViewportMeta(), + this._orientationChanging = !0, + this._resizing || this._initFrameSize(), + n) { + this._originalDesignResolutionSize.width = this._designResolutionSize.width = t, + this._originalDesignResolutionSize.height = this._designResolutionSize.height = e; + var s = n.apply(this, this._designResolutionSize); + if (s.scale && 2 === s.scale.length && (this._scaleX = s.scale[0], + this._scaleY = s.scale[1]), + s.viewport) { + var a = this._viewportRect + , o = this._visibleRect + , l = s.viewport; + a.x = l.x, + a.y = l.y, + a.width = l.width, + a.height = l.height, + o.x = 0, + o.y = 0, + o.width = l.width / this._scaleX, + o.height = l.height / this._scaleY + } + n.postApply(this), + cc.winSize.width = this._visibleRect.width, + cc.winSize.height = this._visibleRect.height, + cc.visibleRect && cc.visibleRect.init(this._visibleRect), + r.updateCameraViewport(), + cc.internal.inputManager._updateCanvasBoundingRect(), + this.emit("design-resolution-changed") + } else + cc.logID(2201) + } else + cc.errorID(2200) + }, + getDesignResolutionSize: function() { + return cc.size(this._designResolutionSize.width, this._designResolutionSize.height) + }, + setRealPixelResolution: function(t, e, i) { + this._setViewportMeta({ + width: t + }, !0), + document.documentElement.style.width = t + "px", + document.body.style.width = t + "px", + document.body.style.left = "0px", + document.body.style.top = "0px", + this.setDesignResolutionSize(t, e, i) + }, + setViewportInPoints: function(t, e, i, n) { + var r = this._scaleX + , s = this._scaleY; + cc.game._renderContext.viewport(t * r + this._viewportRect.x, e * s + this._viewportRect.y, i * r, n * s) + }, + setScissorInPoints: function(t, e, i, n) { + var r = this._scaleX + , s = this._scaleY + , o = Math.ceil(t * r + this._viewportRect.x) + , l = Math.ceil(e * s + this._viewportRect.y) + , h = Math.ceil(i * r) + , c = Math.ceil(n * s) + , u = cc.game._renderContext; + if (!a) { + var _ = u.getParameter(u.SCISSOR_BOX); + a = cc.rect(_[0], _[1], _[2], _[3]) + } + a.x === o && a.y === l && a.width === h && a.height === c || (a.x = o, + a.y = l, + a.width = h, + a.height = c, + u.scissor(o, l, h, c)) + }, + isScissorEnabled: function() { + return cc.game._renderContext.isEnabled(gl.SCISSOR_TEST) + }, + getScissorRect: function() { + if (!a) { + var t = gl.getParameter(gl.SCISSOR_BOX); + a = cc.rect(t[0], t[1], t[2], t[3]) + } + var e = 1 / this._scaleX + , i = 1 / this._scaleY; + return cc.rect((a.x - this._viewportRect.x) * e, (a.y - this._viewportRect.y) * i, a.width * e, a.height * i) + }, + getViewportRect: function() { + return this._viewportRect + }, + getScaleX: function() { + return this._scaleX + }, + getScaleY: function() { + return this._scaleY + }, + getDevicePixelRatio: function() { + return this._devicePixelRatio + }, + convertToLocationInView: function(t, e, i, n) { + var r = n || cc.v2() + , s = i.adjustedLeft ? i.adjustedLeft : i.left + , a = i.adjustedTop ? i.adjustedTop : i.top + , o = this._devicePixelRatio * (t - s) + , l = this._devicePixelRatio * (a + i.height - e); + return this._isRotated ? (r.x = cc.game.canvas.width - l, + r.y = o) : (r.x = o, + r.y = l), + r + }, + _convertMouseToLocationInView: function(t, e) { + var i = this._viewportRect; + t.x = (this._devicePixelRatio * (t.x - e.left) - i.x) / this._scaleX, + t.y = (this._devicePixelRatio * (e.top + e.height - t.y) - i.y) / this._scaleY + }, + _convertPointWithScale: function(t) { + var e = this._viewportRect; + t.x = (t.x - e.x) / this._scaleX, + t.y = (t.y - e.y) / this._scaleY + }, + _convertTouchesWithScale: function(t) { + for (var e, i, n, r = this._viewportRect, s = this._scaleX, a = this._scaleY, o = 0; o < t.length; o++) + i = (e = t[o])._point, + n = e._prevPoint, + i.x = (i.x - r.x) / s, + i.y = (i.y - r.y) / a, + n.x = (n.x - r.x) / s, + n.y = (n.y - r.y) / a + } + }), + cc.ContainerStrategy = cc.Class({ + name: "ContainerStrategy", + preApply: function() {}, + apply: function() {}, + postApply: function() {}, + _setupContainer: function(t, e, i) { + var n = cc.game.canvas; + this._setupStyle(t, e, i); + var r = t._devicePixelRatio = 1; + t.isRetinaEnabled() && (r = t._devicePixelRatio = Math.min(t._maxPixelRatio, window.devicePixelRatio || 1)), + n.width = e * r, + n.height = i * r + }, + _setupStyle: function(t, e, i) { + var n = cc.game.canvas + , r = cc.game.container; + cc.sys.os === cc.sys.OS_ANDROID && (document.body.style.width = (t._isRotated ? i : e) + "px", + document.body.style.height = (t._isRotated ? e : i) + "px"), + r.style.width = n.style.width = e + "px", + r.style.height = n.style.height = i + "px" + }, + _fixContainer: function() { + document.body.insertBefore(cc.game.container, document.body.firstChild); + var t = document.body.style; + t.width = window.innerWidth + "px", + t.height = window.innerHeight + "px", + t.overflow = "hidden"; + var e = cc.game.container.style; + e.position = "fixed", + e.left = e.top = "0px", + document.body.scrollTop = 0 + } + }), + cc.ContentStrategy = cc.Class({ + name: "ContentStrategy", + ctor: function() { + this._result = { + scale: [1, 1], + viewport: null + } + }, + _buildResult: function(t, e, i, n, r, s) { + Math.abs(t - i) < 2 && (i = t), + Math.abs(e - n) < 2 && (n = e); + var a = cc.rect((t - i) / 2, (e - n) / 2, i, n); + return cc.game.renderType, + cc.game.RENDER_TYPE_CANVAS, + this._result.scale = [r, s], + this._result.viewport = a, + this._result + }, + preApply: function() {}, + apply: function() { + return { + scale: [1, 1] + } + }, + postApply: function() {} + }), + (function() { + var t = cc.Class({ + name: "EqualToFrame", + extends: cc.ContainerStrategy, + apply: function(t) { + var e = t._frameSize.height + , i = cc.game.container.style; + this._setupContainer(t, t._frameSize.width, t._frameSize.height), + t._isRotated ? i.margin = "0 0 0 " + e + "px" : i.margin = "0px", + i.padding = "0px" + } + }) + , e = cc.Class({ + name: "ProportionalToFrame", + extends: cc.ContainerStrategy, + apply: function(t, e) { + var i, n, r = t._frameSize.width, s = t._frameSize.height, a = cc.game.container.style, o = e.width, l = e.height, h = r / o, c = s / l; + h < c ? (i = r, + n = l * h) : (i = o * c, + n = s); + var u = Math.round((r - i) / 2) + , _ = Math.round((s - n) / 2); + i = r - 2 * u, + n = s - 2 * _, + this._setupContainer(t, i, n), + t._isRotated ? a.margin = "0 0 0 " + s + "px" : a.margin = "0px", + a.paddingLeft = u + "px", + a.paddingRight = u + "px", + a.paddingTop = _ + "px", + a.paddingBottom = _ + "px" + } + }) + , i = (cc.Class({ + name: "EqualToWindow", + extends: t, + preApply: function(t) { + this._super(t), + cc.game.frame = document.documentElement + }, + apply: function(t) { + this._super(t), + this._fixContainer() + } + }), + cc.Class({ + name: "ProportionalToWindow", + extends: e, + preApply: function(t) { + this._super(t), + cc.game.frame = document.documentElement + }, + apply: function(t, e) { + this._super(t, e), + this._fixContainer() + } + }), + cc.Class({ + name: "OriginalContainer", + extends: cc.ContainerStrategy, + apply: function(t) { + this._setupContainer(t, cc.game.canvas.width, cc.game.canvas.height) + } + })) + , n = ("undefined" == typeof window ? global : window).__globalAdapter; + n && (n.adaptContainerStrategy && n.adaptContainerStrategy(cc.ContainerStrategy.prototype), + n.adaptView && n.adaptView(o.prototype)), + cc.ContainerStrategy.EQUAL_TO_FRAME = new t, + cc.ContainerStrategy.PROPORTION_TO_FRAME = new e, + cc.ContainerStrategy.ORIGINAL_CONTAINER = new i; + var r = cc.Class({ + name: "ExactFit", + extends: cc.ContentStrategy, + apply: function(t, e) { + var i = cc.game.canvas.width + , n = cc.game.canvas.height + , r = i / e.width + , s = n / e.height; + return this._buildResult(i, n, i, n, r, s) + } + }) + , s = cc.Class({ + name: "ShowAll", + extends: cc.ContentStrategy, + apply: function(t, e) { + var i, n, r = cc.game.canvas.width, s = cc.game.canvas.height, a = e.width, o = e.height, l = r / a, h = s / o, c = 0; + return l < h ? (i = r, + n = o * (c = l)) : (i = a * (c = h), + n = s), + this._buildResult(r, s, i, n, c, c) + } + }) + , a = cc.Class({ + name: "NoBorder", + extends: cc.ContentStrategy, + apply: function(t, e) { + var i, n, r, s = cc.game.canvas.width, a = cc.game.canvas.height, o = e.width, l = e.height, h = s / o, c = a / l; + return h < c ? (n = o * (i = c), + r = a) : (n = s, + r = l * (i = h)), + this._buildResult(s, a, n, r, i, i) + } + }) + , l = cc.Class({ + name: "FixedHeight", + extends: cc.ContentStrategy, + apply: function(t, e) { + var i = cc.game.canvas.width + , n = cc.game.canvas.height + , r = n / e.height + , s = i + , a = n; + return this._buildResult(i, n, s, a, r, r) + } + }) + , h = cc.Class({ + name: "FixedWidth", + extends: cc.ContentStrategy, + apply: function(t, e) { + var i = cc.game.canvas.width + , n = cc.game.canvas.height + , r = i / e.width + , s = i + , a = n; + return this._buildResult(i, n, s, a, r, r) + } + }); + cc.ContentStrategy.EXACT_FIT = new r, + cc.ContentStrategy.SHOW_ALL = new s, + cc.ContentStrategy.NO_BORDER = new a, + cc.ContentStrategy.FIXED_HEIGHT = new l, + cc.ContentStrategy.FIXED_WIDTH = new h + } + )(), + cc.ResolutionPolicy = cc.Class({ + name: "cc.ResolutionPolicy", + ctor: function(t, e) { + this._containerStrategy = null, + this._contentStrategy = null, + this.setContainerStrategy(t), + this.setContentStrategy(e) + }, + preApply: function(t) { + this._containerStrategy.preApply(t), + this._contentStrategy.preApply(t) + }, + apply: function(t, e) { + return this._containerStrategy.apply(t, e), + this._contentStrategy.apply(t, e) + }, + postApply: function(t) { + this._containerStrategy.postApply(t), + this._contentStrategy.postApply(t) + }, + setContainerStrategy: function(t) { + t instanceof cc.ContainerStrategy && (this._containerStrategy = t) + }, + setContentStrategy: function(t) { + t instanceof cc.ContentStrategy && (this._contentStrategy = t) + } + }), + n.get(cc.ResolutionPolicy.prototype, "canvasSize", (function() { + return cc.v2(cc.game.canvas.width, cc.game.canvas.height) + } + )), + cc.ResolutionPolicy.EXACT_FIT = 0, + cc.ResolutionPolicy.NO_BORDER = 1, + cc.ResolutionPolicy.SHOW_ALL = 2, + cc.ResolutionPolicy.FIXED_HEIGHT = 3, + cc.ResolutionPolicy.FIXED_WIDTH = 4, + cc.ResolutionPolicy.UNKNOWN = 5, + cc.view = new o, + cc.winSize = cc.size(), + e.exports = cc.view + } + ), { + "../event/event-target": 140, + "../platform/CCClass": 193, + "../platform/js": 214, + "../renderer": 224 + }], + 204: [(function() { + "use strict"; + cc.visibleRect = { + topLeft: cc.v2(0, 0), + topRight: cc.v2(0, 0), + top: cc.v2(0, 0), + bottomLeft: cc.v2(0, 0), + bottomRight: cc.v2(0, 0), + bottom: cc.v2(0, 0), + center: cc.v2(0, 0), + left: cc.v2(0, 0), + right: cc.v2(0, 0), + width: 0, + height: 0, + init: function(t) { + var e = this.width = t.width + , i = this.height = t.height + , n = t.x + , r = t.y + , s = r + i + , a = n + e; + this.topLeft.x = n, + this.topLeft.y = s, + this.topRight.x = a, + this.topRight.y = s, + this.top.x = n + e / 2, + this.top.y = s, + this.bottomLeft.x = n, + this.bottomLeft.y = r, + this.bottomRight.x = a, + this.bottomRight.y = r, + this.bottom.x = n + e / 2, + this.bottom.y = r, + this.center.x = n + e / 2, + this.center.y = r + i / 2, + this.left.x = n, + this.left.y = r + i / 2, + this.right.x = a, + this.right.y = r + i / 2 + } + } + } + ), {}], + 205: [(function(t, e) { + "use strict"; + var i = t("./js") + , n = (t("./utils").isPlainEmptyObj_DEV, + "$_$"); + function r(t, e) { + var n = e ? Object.create(e) : {}; + return i.value(t, "__attrs__", n), + n + } + function s(t) { + if ("function" != typeof t) + return r(t, a(t.constructor)); + for (var e, i = cc.Class.getInheritanceChain(t), n = i.length - 1; n >= 0; n--) { + var s = i[n]; + s.hasOwnProperty("__attrs__") && s.__attrs__ || r(s, (e = i[n + 1]) && e.__attrs__) + } + return r(t, (e = i[0]) && e.__attrs__), + t.__attrs__ + } + function a(t) { + return t.hasOwnProperty("__attrs__") && t.__attrs__ || s(t) + } + function o(t, e) { + this.name = t, + this.default = e + } + o.prototype.toString = function() { + return this.name + } + , + cc.Integer = new o("Integer",0), + cc.Float = new o("Float",0), + cc.Boolean = new o("Boolean",!1), + cc.String = new o("String",""), + e.exports = { + PrimitiveType: o, + attr: function(t, e) { + var i = a(t) + , r = e + n + , s = {}; + for (var o in i) + o.startsWith(r) && (s[o.slice(r.length)] = i[o]); + return s + }, + getClassAttrs: a, + setClassAttr: function(t, e, i, r) { + a(t)[e + n + i] = r + }, + DELIMETER: n, + getTypeChecker_ET: !1, + getObjTypeChecker_ET: !1, + ScriptUuid: {} + } + } + ), { + "./CCClass": 193, + "./js": 214, + "./utils": 217 + }], + 206: [(function(t, e) { + "use strict"; + var i = t("./js") + , n = i.array.fastRemoveAt; + function r() {} + function s() { + this.callback = r, + this.target = void 0, + this.once = !1 + } + s.prototype.set = function(t, e, i) { + this.callback = t, + this.target = e, + this.once = !!i + } + ; + var a = new i.Pool(function(t) { + return t.callback = r, + t.target = void 0, + t.once = !1, + !0 + } + ,32); + function o() { + this.callbackInfos = [], + this.isInvoking = !1, + this.containCanceled = !1 + } + a.get = function() { + return this._get() || new s + } + ; + var l = o.prototype; + l.removeByCallback = function(t) { + for (var e = 0; e < this.callbackInfos.length; ++e) { + var i = this.callbackInfos[e]; + i && i.callback === t && (a.put(i), + n(this.callbackInfos, e), + --e) + } + } + , + l.removeByTarget = function(t) { + for (var e = 0; e < this.callbackInfos.length; ++e) { + var i = this.callbackInfos[e]; + i && i.target === t && (a.put(i), + n(this.callbackInfos, e), + --e) + } + } + , + l.cancel = function(t) { + var e = this.callbackInfos[t]; + e && (a.put(e), + this.callbackInfos[t] = null), + this.containCanceled = !0 + } + , + l.cancelAll = function() { + for (var t = 0; t < this.callbackInfos.length; t++) { + var e = this.callbackInfos[t]; + e && (a.put(e), + this.callbackInfos[t] = null) + } + this.containCanceled = !0 + } + , + l.purgeCanceled = function() { + for (var t = this.callbackInfos.length - 1; t >= 0; --t) + this.callbackInfos[t] || n(this.callbackInfos, t); + this.containCanceled = !1 + } + , + l.clear = function() { + this.cancelAll(), + this.callbackInfos.length = 0, + this.isInvoking = !1, + this.containCanceled = !1 + } + ; + var h = new i.Pool(function(t) { + return t.callbackInfos = [], + t.isInvoking = !1, + t.containCanceled = !1, + !0 + } + ,16); + function c() { + this._callbackTable = i.createMap(!0) + } + h.get = function() { + return this._get() || new o + } + , + (l = c.prototype).on = function(t, e, i, n) { + var r = this._callbackTable[t]; + r || (r = this._callbackTable[t] = h.get()); + var s = a.get(); + s.set(e, i, n), + r.callbackInfos.push(s) + } + , + l.hasEventListener = function(t, e, i) { + var n = this._callbackTable[t]; + if (!n) + return !1; + var r = n.callbackInfos; + if (!e) { + if (n.isInvoking) { + for (var s = 0; s < r.length; ++s) + if (r[s]) + return !0; + return !1 + } + return r.length > 0 + } + for (var a = 0; a < r.length; ++a) { + var o = r[a]; + if (o && o.callback === e && o.target === i) + return !0 + } + return !1 + } + , + l.removeAll = function(t) { + if ("string" == typeof t) { + var e = this._callbackTable[t]; + e && (e.isInvoking ? e.cancelAll() : (e.clear(), + h.put(e), + delete this._callbackTable[t])) + } else if (t) + for (var i in this._callbackTable) { + var n = this._callbackTable[i]; + if (n.isInvoking) + for (var r = n.callbackInfos, s = 0; s < r.length; ++s) { + var a = r[s]; + a && a.target === t && n.cancel(s) + } + else + n.removeByTarget(t) + } + } + , + l.off = function(t, e, i) { + var r = this._callbackTable[t]; + if (r) + for (var s = r.callbackInfos, o = 0; o < s.length; ++o) { + var l = s[o]; + if (l && l.callback === e && l.target === i) { + r.isInvoking ? r.cancel(o) : (n(s, o), + a.put(l)); + break + } + } + } + , + l.emit = function(t, e, i, n, r, s) { + var a = this._callbackTable[t]; + if (a) { + var o = !a.isInvoking; + a.isInvoking = !0; + for (var l = a.callbackInfos, h = 0, c = l.length; h < c; ++h) { + var u = l[h]; + if (u) { + var _ = u.target + , f = u.callback; + u.once && this.off(t, f, _), + _ ? f.call(_, e, i, n, r, s) : f(e, i, n, r, s) + } + } + o && (a.isInvoking = !1, + a.containCanceled && a.purgeCanceled()) + } + } + , + e.exports = c + } + ), { + "./js": 214 + }], + 207: [(function(t, e) { + "use strict"; + function i(t, e) { + for (var n = 0; n < e.length; n++) { + var r = e[n]; + Array.isArray(r) ? i(t, r) : t.push(r) + } + } + e.exports = { + flattenCodeArray: function(t) { + var e = []; + return i(e, t), + e.join("") + } + } + } + ), {}], + 208: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = O, + i.unpackJSONs = function(t, e) { + if (t[0] < 1) + throw new Error(cc.debug.getError(5304, t[0])); + I(t, !0, e), + P(t); + for (var i = new L(t[0]), n = t[1], r = t[2], s = t[3], a = t[4], o = t[v], l = 0; l < o.length; ++l) + o[l].unshift(i, n, r, s, a); + return o + } + , + i.packCustomObjData = function(t, e, i) { + return [1, f, f, [t], f, i ? [e, -1] : [e], [0], f, [], [], []] + } + , + i.hasNativeDep = function(t) { + var e = t[5] + , i = e[e.length - 1]; + return "number" == typeof i && i < 0 + } + , + i.getDependUuidList = function(t) { + var e = t[1]; + return t[10].map((function(t) { + return e[t] + } + )) + } + ; + var n = _(t("./js")) + , r = _(t("../value-types/vec2")) + , s = _(t("../value-types/vec3")) + , a = _(t("../value-types/vec4")) + , o = _(t("../value-types/color")) + , l = _(t("../value-types/size")) + , h = _(t("../value-types/rect")) + , c = _(t("../value-types/quat")) + , u = _(t("../value-types/mat4")); + function _(t) { + return t && t.__esModule ? t : { + default: t + } + } + var f = 0 + , d = [r.default, s.default, a.default, c.default, o.default, l.default, h.default, u.default]; + function p(t, e) { + t.x = e[1], + t.y = e[2], + t.z = e[3], + t.w = e[4] + } + var m = [function(t, e) { + t.x = e[1], + t.y = e[2] + } + , function(t, e) { + t.x = e[1], + t.y = e[2], + t.z = e[3] + } + , p, p, function(t, e) { + t._val = e[1] + } + , function(t, e) { + t.width = e[1], + t.height = e[2] + } + , function(t, e) { + t.x = e[1], + t.y = e[2], + t.width = e[3], + t.height = e[4] + } + , function(t, e) { + u.default.fromArray(t, e, 1) + } + ] + , y = 0 + , v = 5 + , g = (function() { + function t() { + this.uuidObjList = null, + this.uuidPropList = null, + this.uuidList = null + } + var e = t.prototype; + return e.init = function(t) { + this.uuidObjList = t[8], + this.uuidPropList = t[9], + this.uuidList = t[10] + } + , + e.reset = function() { + this.uuidList = null, + this.uuidObjList = null, + this.uuidPropList = null + } + , + e.push = function(t, e, i) { + this.uuidObjList.push(t), + this.uuidPropList.push(e), + this.uuidList.push(i) + } + , + t + } + )(); + function A(t, e, i) { + for (var n = t.length - 1, r = 0, s = 3 * t[n]; r < s; r += 3) { + var a = t[r] + , o = e[t[r + 2]] + , l = t[r + 1]; + l >= 0 ? a[i[l]] = o : a[~l] = o + } + for (; r < n; r += 3) { + var h = e[t[r]] + , c = e[t[r + 2]] + , u = t[r + 1]; + u >= 0 ? h[i[u]] = c : h[~u] = c + } + } + function x(t, e) { + for (var i = t[4][e[0]], n = i[0], r = new (0, + n[0]), s = n[1], a = n[2], o = i[i.length - 1], l = 1; l < o; ++l) + r[s[i[l]]] = e[l]; + for (; l < e.length; ++l) { + var h = s[i[l]] + , c = n[i[l] + a]; + (0, + E[c])(t, r, h, e[l]) + } + return r + } + function b(t, e, i) { + var r = new e; + return r._deserialize ? r._deserialize(i, t[0]) : cc.errorID(5303, n.default.getClassName(e)), + r + } + function C(t, e, i, n) { + n >= 0 ? e[i] = t[5][n] : t[7][3 * ~n] = e + } + function T(t) { + return function(e, i, n, r) { + i[n] = r; + for (var s = 0; s < r.length; ++s) + t(e, r, s, r[s]) + } + } + function S(t, e, i, n) { + e[i] = null, + t[8][n] = e + } + function w(t, e, i, n) { + e[i] = x(t, n) + } + g.pool = new n.default.Pool(function(t) { + t.reset() + } + ,5), + g.pool.get = function() { + return this._get() || new g + } + ; + var E = new Array(13); + function M(t) { + var e = t[5] + , i = t[6] + , n = 0 === i ? 0 : i.length + , r = e[e.length - 1] + , s = e.length - n; + "number" != typeof r ? r = 0 : (r < 0 && (r = ~r), + --s); + for (var a = 0; a < s; ++a) + e[a] = x(t, e[a]); + for (var o = t[3], l = 0; l < n; ++l, + ++a) { + var h = i[l] + , c = e[a]; + if (h >= 0) { + var u = o[h]; + e[a] = b(t, u, c) + } else + (0, + E[h = ~h])(t, e, a, c) + } + return r + } + function D(t, e) { + return t || O.reportMissingClass(e), + Object + } + function B(t, e, i, n, r, s) { + var a = t(e); + if (!a) { + if (r) + return void (i[n] = (function(e, i, n) { + return function() { + var r = t(n) || D(s, n); + return e[i] = r, + new r + } + } + )(i, n, e)); + a = D(s, e) + } + i[n] = a + } + function I(t, e, i) { + for (var r = i || n.default._getClassById, s = t[3], a = 0; a < s.length; ++a) { + var o = s[a]; + "string" != typeof o ? B(r, o[0], o, y, e, i) : B(r, o, s, a, e, i) + } + } + function P(t) { + var e = t[4]; + if (e) + for (var i = t[3], n = 0; n < e.length; ++n) { + var r = e[n]; + r[0] = i[r[0]] + } + } + function R(t) { + for (var e = t[5], i = t[2], n = t[1], r = t[8], s = t[9], a = t[10], o = 0; o < r.length; ++o) { + var l = r[o]; + "number" == typeof l && (r[o] = e[l]); + var h = s[o]; + "number" == typeof h && (h = h >= 0 ? i[h] : ~h, + s[o] = h); + var c = a[o]; + "number" == typeof c && (a[o] = n[c]) + } + } + function O(t, e, i) { + "string" == typeof t && (t = JSON.parse(t)); + var n = !e; + (e = e || g.pool.get()).init(t), + i = i || {}; + var r = t[0] + , s = !1; + if ("object" == typeof r && (s = r.preprocessed, + r = r.version), + r < 1) + throw new Error(cc.debug.getError(5304, r)); + i._version = r, + i.result = e, + t[0] = i, + s || (I(t, !1, i.classFinder), + P(t)), + cc.game._isCloning = !0; + var a = t[5] + , o = M(t); + return cc.game._isCloning = !1, + t[7] && A(t[7], a, t[2]), + R(t), + n && g.pool.put(e), + a[o] + } + E[0] = function(t, e, i, n) { + e[i] = n + } + , + E[1] = C, + E[2] = T(C), + E[3] = T(S), + E[4] = w, + E[5] = function(t, e, i, n) { + m[n[0]](e[i], n) + } + , + E[6] = S, + E[7] = function(t, e, i, n) { + e[i].set(n) + } + , + E[8] = function(t, e, i, n) { + var r = new d[n[0]]; + m[n[0]](r, n), + e[i] = r + } + , + E[9] = T(w), + E[10] = function(t, e, i, n) { + var r = t[3][n[0]]; + e[i] = b(t, r, n[1]) + } + , + E[11] = function(t, e, i, n) { + var r = n[0]; + e[i] = r; + for (var s = 1; s < n.length; s += 3) { + var a = n[s] + , o = n[s + 1] + , l = n[s + 2]; + (0, + E[o])(t, r, a, l) + } + } + , + E[12] = function(t, e, i, n) { + var r = n[0]; + e[i] = r; + for (var s = 0; s < r.length; ++s) { + var a = r[s] + , o = n[s + 1]; + 0 !== o && (0, + E[o])(t, r, s, a) + } + } + , + O.Details = g; + var L = function(t) { + this.preprocessed = !0, + this.version = t + } + } + ), { + "../value-types/color": 281, + "../value-types/mat4": 284, + "../value-types/quat": 285, + "../value-types/rect": 286, + "../value-types/size": 287, + "../value-types/vec2": 291, + "../value-types/vec3": 292, + "../value-types/vec4": 293, + "./js": 214 + }], + 209: [(function(t) { + "use strict"; + var e, i = (e = t("./deserialize-compiled")) && e.__esModule ? e : { + default: e + }; + i.default.reportMissingClass = function(t) { + cc.warnID(5302, t) + } + , + cc.deserialize = i.default + } + ), { + "./deserialize-compiled": 208, + "./deserialize-editor": void 0 + }], + 210: [(function(t, e) { + "use strict"; + var i = "."; + function n(t) { + this.id = 0 | 998 * Math.random(), + this.prefix = t ? t + i : "" + } + n.prototype.getNewId = function() { + return this.prefix + ++this.id + } + , + n.global = new n("global"), + e.exports = n + } + ), {}], + 211: [(function(t) { + "use strict"; + t("./js"), + t("./CCClass"), + t("./CCClassDecorator"), + t("./CCEnum"), + t("./CCObject"), + t("./callbacks-invoker"), + t("./deserialize"), + t("./instantiate"), + t("./instantiate-jit"), + t("./requiring-frame"), + t("./CCSys"), + t("./CCMacro"), + t("./CCVisibleRect") + } + ), { + "./CCClass": 193, + "./CCClassDecorator": 194, + "./CCEnum": 195, + "./CCMacro": 198, + "./CCObject": 199, + "./CCSys": 202, + "./CCVisibleRect": 204, + "./callbacks-invoker": 206, + "./deserialize": 209, + "./instantiate": 213, + "./instantiate-jit": 212, + "./js": 214, + "./requiring-frame": 216 + }], + 212: [(function(t, e) { + "use strict"; + var i = t("./CCObject") + , n = i.Flags.Destroyed + , r = i.Flags.PersistentMask + , s = t("./attribute") + , a = t("./js") + , o = t("./CCClass") + , l = t("./compiler") + , h = s.DELIMETER + "default" + , c = o.IDENTIFIER_RE + , u = o.escapeForJS + , _ = "var " + , f = "o" + , d = "t" + , p = { + "cc.Node": "cc.Node", + "cc.Sprite": "cc.Sprite", + "cc.Label": "cc.Label", + "cc.Button": "cc.Button", + "cc.Widget": "cc.Widget", + "cc.Animation": "cc.Animation", + "cc.ClickEvent": !1, + "cc.PrefabInfo": !1 + }; + try { + !Float32Array.name && (Float32Array.name = "Float32Array"), + !Float64Array.name && (Float64Array.name = "Float64Array"), + !Int8Array.name && (Int8Array.name = "Int8Array"), + !Int16Array.name && (Int16Array.name = "Int16Array"), + !Int32Array.name && (Int32Array.name = "Int32Array"), + !Uint8Array.name && (Uint8Array.name = "Uint8Array"), + !Uint16Array.name && (Uint16Array.name = "Uint16Array"), + !Uint32Array.name && (Uint32Array.name = "Uint32Array"), + !Uint8ClampedArray.name && (Uint8ClampedArray.name = "Uint8ClampedArray") + } catch (S) {} + function m(t) { + if (t === Float32Array) + return "Float32Array"; + if (t === Float64Array) + return "Float64Array"; + if (t === Int8Array) + return "Int8Array"; + if (t === Int16Array) + return "Int16Array"; + if (t === Int32Array) + return "Int32Array"; + if (t === Uint8Array) + return "Uint8Array"; + if (t === Uint16Array) + return "Uint16Array"; + if (t === Uint32Array) + return "Uint32Array"; + if (t === Uint8ClampedArray) + return "Uint8ClampedArray"; + throw new Error("Unknown TypedArray to instantiate: " + t) + } + function y(t, e) { + this.varName = t, + this.expression = e + } + function v(t, e) { + return e instanceof y ? new y(e.varName,t + e.expression) : t + e + } + function g(t, e, i) { + Array.isArray(i) ? (i[0] = v(e, i[0]), + t.push(i)) : t.push(v(e, i) + ";") + } + function A(t) { + this._exps = [], + this._targetExp = t + } + function x(t, e) { + if ("function" == typeof t) + try { + t = t() + } catch (S) { + return !1 + } + if (t === e) + return !0; + if (t && e && "object" == typeof t && "object" == typeof e && t.constructor === e.constructor) + if (t instanceof cc.ValueType) { + if (t.equals(e)) + return !0 + } else { + if (Array.isArray(t)) + return 0 === t.length && 0 === e.length; + if (t.constructor === Object) + return a.isEmptyObject(t) && a.isEmptyObject(e) + } + return !1 + } + function b(t) { + return c.test(t) ? "." + t : "[" + u(t) + "]" + } + function C(t, e) { + var i; + this.parent = e, + this.objsToClear_iN$t = [], + this.codeArray = [], + this.objs = [], + this.funcs = [], + this.funcModuleCache = a.createMap(), + a.mixin(this.funcModuleCache, p), + this.globalVariables = [], + this.globalVariableId = 0, + this.localVariableId = 0, + this.codeArray.push(_ + f + "," + d + ";", "if(R){", f + "=R;", "}else{", f + "=R=new " + this.getFuncModule(t.constructor, !0) + "();", "}"), + a.value(t, "_iN$t", { + globalVar: "R" + }, !0), + this.objsToClear_iN$t.push(t), + this.enumerateObject(this.codeArray, t), + this.globalVariables.length > 0 && (i = _ + this.globalVariables.join(",") + ";"); + var n = l.flattenCodeArray(["return (function(R){", i || [], this.codeArray, "return o;", "})"]); + this.result = Function("O", "F", n)(this.objs, this.funcs); + for (var r = 0, s = this.objsToClear_iN$t.length; r < s; ++r) + this.objsToClear_iN$t[r]._iN$t = null; + this.objsToClear_iN$t.length = 0 + } + y.prototype.toString = function() { + return _ + this.varName + "=" + this.expression + ";" + } + , + A.prototype.append = function(t, e) { + this._exps.push([t, e]) + } + , + A.prototype.writeCode = function(t) { + var e; + if (this._exps.length > 1) + t.push(d + "=" + this._targetExp + ";"), + e = d; + else { + if (1 !== this._exps.length) + return; + e = this._targetExp + } + for (var i = 0; i < this._exps.length; i++) { + var n = this._exps[i]; + g(t, e + b(n[0]) + "=", n[1]) + } + } + , + A.pool = new a.Pool(function(t) { + t._exps.length = 0, + t._targetExp = null + } + ,1), + A.pool.get = function(t) { + var e = this._get() || new A; + return e._targetExp = t, + e + } + ; + var T = C.prototype; + T.getFuncModule = function(t, e) { + var i = a.getClassName(t); + if (i) { + var n = this.funcModuleCache[i]; + if (n) + return n; + if (void 0 === n) { + var r = -1 !== i.indexOf("."); + if (r) + try { + if (r = t === Function("return " + i)()) + return this.funcModuleCache[i] = i, + i + } catch (S) {} + } + } + var s = this.funcs.indexOf(t); + s < 0 && (s = this.funcs.length, + this.funcs.push(t)); + var o = "F[" + s + "]"; + return e && (o = "(" + o + ")"), + this.funcModuleCache[i] = o, + o + } + , + T.getObjRef = function(t) { + var e = this.objs.indexOf(t); + return e < 0 && (e = this.objs.length, + this.objs.push(t)), + "O[" + e + "]" + } + , + T.setValueType = function(t, e, i, n) { + var r = A.pool.get(n) + , s = e.constructor.__props__; + s || (s = Object.keys(e)); + for (var a = 0; a < s.length; a++) { + var o = s[a] + , l = i[o]; + if (e[o] !== l) { + var h = this.enumerateField(i, o, l); + r.append(o, h) + } + } + r.writeCode(t), + A.pool.put(r) + } + , + T.enumerateCCClass = function(t, e, i) { + for (var n = i.__values__, r = s.getClassAttrs(i), a = 0; a < n.length; a++) { + var l = n[a] + , c = e[l] + , u = r[l + h]; + if (!x(u, c)) + if ("object" == typeof c && c instanceof cc.ValueType && (u = o.getDefault(u)) && u.constructor === c.constructor) { + var _ = f + b(l); + this.setValueType(t, u, c, _) + } else + this.setObjProp(t, e, l, c) + } + } + , + T.instantiateArray = function(t) { + if (0 === t.length) + return "[]"; + var e = "a" + ++this.localVariableId + , i = [new y(e,"new Array(" + t.length + ")")]; + a.value(t, "_iN$t", { + globalVar: "", + source: i + }, !0), + this.objsToClear_iN$t.push(t); + for (var n = 0; n < t.length; ++n) + g(i, e + "[" + n + "]=", this.enumerateField(t, n, t[n])); + return i + } + , + T.instantiateTypedArray = function(t) { + var e = t.constructor.name || m(t.constructor); + if (0 === t.length) + return "new " + e; + var i = "a" + ++this.localVariableId + , n = [new y(i,"new " + e + "(" + t.length + ")")]; + t._iN$t = { + globalVar: "", + source: n + }, + this.objsToClear_iN$t.push(t); + for (var r = 0; r < t.length; ++r) + 0 !== t[r] && g(n, i + "[" + r + "]=", t[r]); + return n + } + , + T.enumerateField = function(t, e, n) { + if ("object" == typeof n && n) { + var s = n._iN$t; + if (s) { + var a = s.globalVar; + if (!a) { + a = s.globalVar = "v" + ++this.globalVariableId, + this.globalVariables.push(a); + var o = s.source[0]; + s.source[0] = v(a + "=", o) + } + return a + } + return ArrayBuffer.isView(n) ? this.instantiateTypedArray(n) : Array.isArray(n) ? this.instantiateArray(n) : this.instantiateObj(n) + } + return "function" == typeof n ? this.getFuncModule(n) : "string" == typeof n ? u(n) : ("_objFlags" === e && t instanceof i && (n &= r), + n) + } + , + T.setObjProp = function(t, e, i, n) { + g(t, f + b(i) + "=", this.enumerateField(e, i, n)) + } + , + T.enumerateObject = function(t, e) { + var i = e.constructor; + if (cc.Class._isCCClass(i)) + this.enumerateCCClass(t, e, i); + else + for (var n in e) + if (e.hasOwnProperty(n) && (95 !== n.charCodeAt(0) || 95 !== n.charCodeAt(1) || "__type__" === n)) { + var r = e[n]; + "object" == typeof r && r && r === e._iN$t || this.setObjProp(t, e, n, r) + } + } + , + T.instantiateObj = function(t) { + if (t instanceof cc.ValueType) + return o.getNewValueTypeCode(t); + if (t instanceof cc.Asset) + return this.getObjRef(t); + if (t._objFlags & n) + return null; + var e, i = t.constructor; + if (cc.Class._isCCClass(i)) { + if (this.parent) + if (this.parent instanceof cc.Component) { + if (t instanceof cc._BaseNode || t instanceof cc.Component) + return this.getObjRef(t) + } else if (this.parent instanceof cc._BaseNode) + if (t instanceof cc._BaseNode) { + if (!t.isChildOf(this.parent)) + return this.getObjRef(t) + } else if (t instanceof cc.Component && !t.node.isChildOf(this.parent)) + return this.getObjRef(t); + e = new y(f,"new " + this.getFuncModule(i, !0) + "()") + } else if (i === Object) + e = new y(f,"{}"); + else { + if (i) + return this.getObjRef(t); + e = new y(f,"Object.create(null)") + } + var r = [e]; + return a.value(t, "_iN$t", { + globalVar: "", + source: r + }, !0), + this.objsToClear_iN$t.push(t), + this.enumerateObject(r, t), + ["(function(){", r, "return o;})();"] + } + , + e.exports = { + compile: function(t) { + return new C(t,t instanceof cc._BaseNode && t).result + }, + equalsToDefault: x + } + } + ), { + "./CCClass": 193, + "./CCObject": 199, + "./attribute": 205, + "./compiler": 207, + "./js": 214 + }], + 213: [(function(t, e) { + "use strict"; + var i = t("./CCObject") + , n = t("../value-types/value-type") + , r = i.Flags.Destroyed + , s = i.Flags.PersistentMask + , a = t("./utils").isDomNode + , o = t("./js"); + function l(t, e) { + if (!e) { + if ("object" != typeof t || Array.isArray(t)) + return null; + if (!t) + return null; + if (!cc.isValid(t)) + return null + } + var n; + if (t instanceof i) { + if (t._instantiate) + return cc.game._isCloning = !0, + n = t._instantiate(null, !0), + cc.game._isCloning = !1, + n; + if (t instanceof cc.Asset) + return null + } + return cc.game._isCloning = !0, + n = c(t), + cc.game._isCloning = !1, + n + } + var h = []; + function c(t, e) { + if (Array.isArray(t)) + return null; + if (a && a(t)) + return null; + var i; + _(t, i = t._iN$t ? t._iN$t : t.constructor ? new (0, + t.constructor) : Object.create(null), e); + for (var n = 0, r = h.length; n < r; ++n) + h[n]._iN$t = null; + return h.length = 0, + i + } + function u(t, e, i, r) { + for (var s = t.__values__, a = 0; a < s.length; a++) { + var o = s[a] + , l = e[o]; + if ("object" == typeof l && l) { + var h = i[o]; + h instanceof n && h.constructor === l.constructor ? h.set(l) : i[o] = l._iN$t || f(l, r) + } else + i[o] = l + } + } + function _(t, e, n) { + o.value(t, "_iN$t", e, !0), + h.push(t); + var r = t.constructor; + if (cc.Class._isCCClass(r)) + u(r, t, e, n); + else + for (var a in t) + if (t.hasOwnProperty(a) && (95 !== a.charCodeAt(0) || 95 !== a.charCodeAt(1) || "__type__" === a)) { + var l = t[a]; + if ("object" == typeof l && l) { + if (l === e) + continue; + e[a] = l._iN$t || f(l, n) + } else + e[a] = l + } + t instanceof i && (e._objFlags &= s) + } + function f(t, e) { + if (t instanceof n) + return t.clone(); + if (t instanceof cc.Asset) + return t; + var i; + if (ArrayBuffer.isView(t)) { + var s = t.length; + i = new t.constructor(s), + t._iN$t = i, + h.push(t); + for (var a = 0; a < s; ++a) + i[a] = t[a]; + return i + } + if (Array.isArray(t)) { + var l = t.length; + i = new Array(l), + o.value(t, "_iN$t", i, !0), + h.push(t); + for (var c = 0; c < l; ++c) { + var u = t[c]; + i[c] = "object" == typeof u && u ? u._iN$t || f(u, e) : u + } + return i + } + if (t._objFlags & r) + return null; + var d = t.constructor; + if (cc.Class._isCCClass(d)) { + if (e) + if (e instanceof cc.Component) { + if (t instanceof cc._BaseNode || t instanceof cc.Component) + return t + } else if (e instanceof cc._BaseNode) + if (t instanceof cc._BaseNode) { + if (!t.isChildOf(e)) + return t + } else if (t instanceof cc.Component && !t.node.isChildOf(e)) + return t; + i = new d + } else if (d === Object) + i = {}; + else { + if (d) + return t; + i = Object.create(null) + } + return _(t, i, e), + i + } + l._clone = c, + cc.instantiate = l, + e.exports = l + } + ), { + "../value-types/value-type": 290, + "./CCObject": 199, + "./js": 214, + "./utils": 217 + }], + 214: [(function(t, e) { + "use strict"; + var i = new (t("./id-generater"))("TmpCId."); + function n(t, e) { + for (; t; ) { + var i = Object.getOwnPropertyDescriptor(t, e); + if (i) + return i; + t = Object.getPrototypeOf(t) + } + return null + } + function r(t, e, i) { + var r = n(e, t); + Object.defineProperty(i, t, r) + } + var s = { + isNumber: function(t) { + return "number" == typeof t || t instanceof Number + }, + isString: function(t) { + return "string" == typeof t || t instanceof String + }, + addon: function(t) { + t = t || {}; + for (var e = 1, i = arguments.length; e < i; e++) { + var n = arguments[e]; + if (n) { + if ("object" != typeof n) { + cc.errorID(5402, n); + continue + } + for (var s in n) + s in t || r(s, n, t) + } + } + return t + }, + mixin: function(t) { + t = t || {}; + for (var e = 1, i = arguments.length; e < i; e++) { + var n = arguments[e]; + if (n) { + if ("object" != typeof n) { + cc.errorID(5403, n); + continue + } + for (var s in n) + r(s, n, t) + } + } + return t + }, + extend: function(t, e) { + for (var i in e) + e.hasOwnProperty(i) && (t[i] = e[i]); + return t.prototype = Object.create(e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), + t + }, + getSuper: function(t) { + var e = t.prototype + , i = e && Object.getPrototypeOf(e); + return i && i.constructor + }, + isChildClassOf: function(t, e) { + if (t && e) { + if ("function" != typeof t) + return !1; + if ("function" != typeof e) + return !1; + if (t === e) + return !0; + for (; ; ) { + if (!(t = s.getSuper(t))) + return !1; + if (t === e) + return !0 + } + } + return !1 + }, + clear: function(t) { + for (var e = Object.keys(t), i = 0; i < e.length; i++) + delete t[e[i]] + }, + isEmptyObject: function(t) { + for (var e in t) + return !1; + return !0 + }, + getPropertyDescriptor: n + } + , a = { + value: void 0, + enumerable: !1, + writable: !1, + configurable: !0 + }; + s.value = function(t, e, i, n, r) { + a.value = i, + a.writable = n, + a.enumerable = r, + Object.defineProperty(t, e, a), + a.value = void 0 + } + ; + var o = { + get: null, + set: null, + enumerable: !1 + }; + s.getset = function(t, e, i, n, r, s) { + "function" != typeof n && (r = n, + n = void 0), + o.get = i, + o.set = n, + o.enumerable = r, + o.configurable = s, + Object.defineProperty(t, e, o), + o.get = null, + o.set = null + } + ; + var l = { + get: null, + enumerable: !1, + configurable: !1 + }; + s.get = function(t, e, i, n, r) { + l.get = i, + l.enumerable = n, + l.configurable = r, + Object.defineProperty(t, e, l), + l.get = null + } + ; + var h = { + set: null, + enumerable: !1, + configurable: !1 + }; + s.set = function(t, e, i, n, r) { + h.set = i, + h.enumerable = n, + h.configurable = r, + Object.defineProperty(t, e, h), + h.set = null + } + , + s.getClassName = function(t) { + if ("function" == typeof t) { + var e = t.prototype; + if (e && e.hasOwnProperty("__classname__") && e.__classname__) + return e.__classname__; + var i = ""; + if (t.name && (i = t.name), + t.toString) { + var n, r = t.toString(); + (n = "[" === r.charAt(0) ? r.match(/\[\w+\s*(\w+)\]/) : r.match(/function\s*(\w+)/)) && 2 === n.length && (i = n[1]) + } + return "Object" !== i ? i : "" + } + return t && t.constructor ? s.getClassName(t.constructor) : "" + } + , + (function() { + var t = {} + , e = {}; + function n(t, e, i) { + return s.getset(s, e, (function() { + return Object.assign({}, i) + } + ), (function(t) { + s.clear(i), + Object.assign(i, t) + } + )), + function(e, n) { + if (n.prototype.hasOwnProperty(t) && delete i[n.prototype[t]], + s.value(n.prototype, t, e), + e) { + var r = i[e]; + if (r && r !== n) { + var a = "A Class already exists with the same " + t + ' : "' + e + '".'; + cc.error(a) + } else + i[e] = n + } + } + } + s._setClassId = n("__cid__", "_registeredClassIds", t); + var r = n("__classname__", "_registeredClassNames", e); + s.setClassName = function(t, e) { + if (r(t, e), + !e.prototype.hasOwnProperty("__cid__")) { + var n = t || i.getNewId(); + n && s._setClassId(n, e) + } + } + , + s.unregisterClass = function() { + for (var i = 0; i < arguments.length; i++) { + var n = arguments[i].prototype + , r = n.__cid__; + r && delete t[r]; + var s = n.__classname__; + s && delete e[s] + } + } + , + s._getClassById = function(e) { + return t[e] + } + , + s.getClassByName = function(t) { + return e[t] + } + , + s._getClassId = function(t, e) { + if (e = void 0 === e || e, + "function" == typeof t && t.prototype.hasOwnProperty("__cid__")) + return t.prototype.__cid__; + if (t && t.constructor) { + var i = t.constructor.prototype; + if (i && i.hasOwnProperty("__cid__")) + return t.__cid__ + } + return "" + } + } + )(), + s.obsolete = function(t, e, i, n) { + var r = /([^.]+)$/ + , a = r.exec(e)[0] + , o = r.exec(i)[0]; + function l() { + return this[o] + } + n ? s.getset(t, a, l, (function(t) { + this[o] = t + } + )) : s.get(t, a, l) + } + , + s.obsoletes = function(t, e, i, n) { + for (var r in i) { + var a = i[r]; + s.obsolete(t, e + "." + r, a, n) + } + } + ; + var c = /(%d)|(%s)/ + , u = /%s/; + function _(t, e) { + t.splice(e, 1) + } + function f(t, e) { + var i = t.indexOf(e); + return i >= 0 && (_(t, i), + !0) + } + function d(t, e) { + void 0 === e && (e = t, + t = null), + this.get = null, + this.count = 0, + this._pool = new Array(e), + this._cleanup = t + } + s.formatStr = function() { + var t = arguments.length; + if (0 === t) + return ""; + var e = arguments[0]; + if (1 === t) + return "" + e; + var i = "string" == typeof e && c.test(e); + if (i) + for (var n = 1; n < t; ++n) { + var r = arguments[n] + , s = "number" == typeof r ? c : u; + if (s.test(e)) { + var a = "" + r; + e = e.replace(s, a) + } else + e += " " + r + } + else + for (var o = 1; o < t; ++o) + e += " " + arguments[o]; + return e + } + , + s.shiftArguments = function() { + for (var t = arguments.length - 1, e = new Array(t), i = 0; i < t; ++i) + e[i] = arguments[i + 1]; + return e + } + , + s.createMap = function(t) { + var e = Object.create(null); + return t && (e["."] = !0, + e["/"] = !0, + delete e["."], + delete e["/"]), + e + } + , + s.array = { + remove: f, + fastRemove: function(t, e) { + var i = t.indexOf(e); + i >= 0 && (t[i] = t[t.length - 1], + --t.length) + }, + removeAt: _, + fastRemoveAt: function(t, e) { + var i = t.length; + e < 0 || e >= i || (t[e] = t[i - 1], + t.length = i - 1) + }, + contains: function(t, e) { + return t.indexOf(e) >= 0 + }, + verifyType: function(t, e) { + if (t && t.length > 0) + for (var i = 0; i < t.length; i++) + if (!(t[i]instanceof e)) + return cc.logID(1300), + !1; + return !0 + }, + removeArray: function(t, e) { + for (var i = 0, n = e.length; i < n; i++) + f(t, e[i]) + }, + appendObjectsAt: function(t, e, i) { + return t.splice.apply(t, [i, 0].concat(e)), + t + }, + copy: function(t) { + var e, i = t.length, n = new Array(i); + for (e = 0; e < i; e += 1) + n[e] = t[e]; + return n + }, + MutableForwardIterator: t("../utils/mutable-forward-iterator") + }, + d.prototype._get = function() { + if (this.count > 0) { + --this.count; + var t = this._pool[this.count]; + return this._pool[this.count] = null, + t + } + return null + } + , + d.prototype.put = function(t) { + var e = this._pool; + if (this.count < e.length) { + if (this._cleanup && !1 === this._cleanup(t)) + return; + e[this.count] = t, + ++this.count + } + } + , + d.prototype.resize = function(t) { + t >= 0 && (this._pool.length = t, + this.count > t && (this.count = t)) + } + , + s.Pool = d, + cc.js = s, + e.exports = s + } + ), { + "../utils/mutable-forward-iterator": 268, + "./id-generater": 210 + }], + 215: [(function(t, e, i) { + "use strict"; + var n = t("./js") + , r = t("./attribute") + , s = { + default: {}, + serializable: {}, + editorOnly: {}, + formerlySerializedAs: {} + }; + function a(t, e, i, n) { + if (!t.get && !t.set && t.hasOwnProperty("default")) { + var r = "_N$" + e; + t.get = function() { + return this[r] + } + , + t.set = function(t) { + var e = this[r]; + this[r] = t, + i.call(this, e) + } + ; + var a = {}; + for (var o in n[r] = a, + s) { + var l = s[o]; + t.hasOwnProperty(o) && (a[o] = t[o], + l.canUsedInGet || delete t[o]) + } + } + } + function o(t, e, i, n) { + if (Array.isArray(e)) { + if (!(e.length > 0)) + return cc.errorID(5508, i, n); + t.type = e = e[0] + } + "function" == typeof e && (e === String ? t.type = cc.String : e === Boolean ? t.type = cc.Boolean : e === Number && (t.type = cc.Float)) + } + function l(t, e, i) { + var n = t ? { + _short: !0 + } : { + _short: !0, + default: e + }; + return i && (n.type = i), + n + } + i.getFullFormOfProperty = function(t, e) { + return t && t.constructor === Object ? null : Array.isArray(t) && t.length > 0 ? l(e, [], t) : "function" == typeof t ? l(e, n.isChildClassOf(t, cc.ValueType) ? new t : null, t) : t instanceof r.PrimitiveType ? l(e, t.default) : l(e, t) + } + , + i.preprocessAttrs = function(t, e) { + for (var n in t) { + var r = t[n] + , s = i.getFullFormOfProperty(r, !1); + if (s && (r = t[n] = s), + r) { + var l = r.notify; + l && a(r, n, l, t), + "type"in r && o(r, r.type, e, n) + } + } + } + , + i.validateMethodWithProps = function(t) { + return "function" == typeof t || null === t + } + } + ), { + "./CCClass": 193, + "./attribute": 205, + "./js": 214 + }], + 216: [(function() { + "use strict"; + var t = []; + cc._RF = { + push: function(e, i, n) { + void 0 === n && (n = i, + i = ""), + t.push({ + uuid: i, + script: n, + module: e, + exports: e.exports, + beh: null + }) + }, + pop: function() { + var e = t.pop() + , i = e.module + , n = i.exports; + if (n === e.exports) { + for (var r in n) + return; + i.exports = n = e.cls + } + }, + peek: function() { + return t[t.length - 1] + } + } + } + ), {}], + 217: [(function(t, e) { + "use strict"; + t("./js"), + e.exports = { + contains: function(t, e) { + if ("function" == typeof t.contains) + return t.contains(e); + if ("function" == typeof t.compareDocumentPosition) + return !!(16 & t.compareDocumentPosition(e)); + var i = e.parentNode; + if (i) + do { + if (i === t) + return !0; + i = i.parentNode + } while (null !== i);return !1 + }, + isDomNode: "object" == typeof window && ("function" == typeof Node ? function(t) { + return t instanceof Node + } + : function(t) { + return t && "object" == typeof t && "number" == typeof t.nodeType && "string" == typeof t.nodeName + } + ), + callInNextTick: function(t, e, i) { + t && setTimeout((function() { + t(e, i) + } + ), 0) + } + } + } + ), { + "./js": 214 + }], + 218: [(function(t) { + "use strict"; + t("./platform/js"), + t("./value-types"), + t("./utils"), + t("./platform/CCInputManager"), + t("./platform/CCInputExtension"), + t("./event"), + t("./platform/CCSys"), + t("./platform/CCMacro"), + t("./asset-manager"), + t("./CCDirector"), + t("./renderer"), + t("./platform/CCView"), + t("./platform/CCScreen"), + t("./CCScheduler"), + t("./event-manager") + } + ), { + "./CCDirector": 27, + "./CCScheduler": 32, + "./asset-manager": 50, + "./event": 142, + "./event-manager": 138, + "./platform/CCInputExtension": 196, + "./platform/CCInputManager": 197, + "./platform/CCMacro": 198, + "./platform/CCScreen": 201, + "./platform/CCSys": 202, + "./platform/CCView": 203, + "./platform/js": 214, + "./renderer": 224, + "./utils": 266, + "./value-types": 282 + }], + 219: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = a(t("./assembler")) + , r = a(t("./utils/dynamic-atlas/manager")) + , s = a(t("./webgl/render-data")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + function o(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function l(t) { + if (void 0 === t) + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return t + } + function h(t, e) { + return (h = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + t("../value-types"); + var c = (function(t) { + var e, i; + function n() { + var e; + return (e = t.call(this) || this)._renderData = new s.default, + e._renderData.init(l(e)), + e.initData(), + e.initLocal(), + e + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + h(e, i); + var a, c, u = n.prototype; + return u.initData = function() { + this._renderData.createQuadData(0, this.verticesFloats, this.indicesCount) + } + , + u.initLocal = function() { + this._local = [], + this._local.length = 4 + } + , + u.updateColor = function(t, e) { + var i = this._renderData.uintVDatas[0]; + if (i) { + e = null != e ? e : t.node.color._val; + for (var n = this.floatsPerVert, r = this.colorOffset, s = i.length; r < s; r += n) + i[r] = e + } + } + , + u.getBuffer = function() { + return cc.renderer._handle._meshBuffer + } + , + u.updateWorldVerts = function(t) { + var e = this._local + , i = this._renderData.vDatas[0] + , n = t.node._worldMatrix.m + , r = n[0] + , s = n[1] + , a = n[4] + , o = n[5] + , l = n[12] + , h = n[13] + , c = e[0] + , u = e[2] + , _ = e[1] + , f = e[3] + , d = this.floatsPerVert + , p = 0; + if (1 === r && 0 === s && 0 === a && 1 === o) + i[p] = c + l, + i[p + 1] = _ + h, + i[p += d] = u + l, + i[p + 1] = _ + h, + i[p += d] = c + l, + i[p + 1] = f + h, + i[p += d] = u + l, + i[p + 1] = f + h; + else { + var m = r * c + , y = r * u + , v = s * c + , g = s * u + , A = a * _ + , x = a * f + , b = o * _ + , C = o * f; + i[p] = m + A + l, + i[p + 1] = v + b + h, + i[p += d] = y + A + l, + i[p + 1] = g + b + h, + i[p += d] = m + x + l, + i[p + 1] = v + C + h, + i[p += d] = y + x + l, + i[p + 1] = g + C + h + } + } + , + u.fillBuffers = function(t, e) { + e.worldMatDirty && this.updateWorldVerts(t); + var i = this._renderData + , n = i.vDatas[0] + , r = i.iDatas[0] + , s = this.getBuffer(e) + , a = s.request(this.verticesCount, this.indicesCount) + , o = a.byteOffset >> 2 + , l = s._vData; + n.length + o > l.length ? l.set(n.subarray(0, l.length - o), o) : l.set(n, o); + for (var h = s._iData, c = a.indiceOffset, u = a.vertexOffset, _ = 0, f = r.length; _ < f; _++) + h[c++] = u + r[_] + } + , + u.packToDynamicAtlas = function(t, e) { + if (!e._original && r.default && e._texture.packable) { + var i = r.default.insertSpriteFrame(e); + i && e._setDynamicAtlasFrame(i) + } + var n = t._materials[0]; + n && n.getProperty("texture") !== e._texture && (t._vertsDirty = !0, + t._updateMaterial()) + } + , + a = n, + (c = [{ + key: "verticesFloats", + get: function() { + return this.verticesCount * this.floatsPerVert + } + }]) && o(a.prototype, c), + n + } + )(n.default); + i.default = c, + cc.js.addon(c.prototype, { + floatsPerVert: 5, + verticesCount: 4, + indicesCount: 6, + uvOffset: 2, + colorOffset: 4 + }), + cc.Assembler2D = c, + e.exports = i.default + } + ), { + "../value-types": 282, + "./assembler": 221, + "./utils/dynamic-atlas/manager": 227, + "./webgl/render-data": 254 + }], + 220: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../utils/pool")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = 0; + function o(t) { + return Object.getOwnPropertyDescriptor(t, "__assemblerId__") || (t.__assemblerId__ = ++a), + t.__assemblerId__ + } + var l = new (function(t) { + var e, i; + function n() { + for (var e, i = arguments.length, n = new Array(i), r = 0; r < i; r++) + n[r] = arguments[r]; + return (e = t.call.apply(t, [this].concat(n)) || this)._pool = {}, + e + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.put = function(t) { + if (t && this.enabled) { + var e = o(t.constructor) + , i = this._pool; + i[e] || (i[e] = []), + this.count > this.maxSize || (this._clean(t), + i[e].push(t), + this.count++) + } + } + , + r.get = function(t) { + var e; + if (this.enabled) { + var i = this._pool + , n = o(t); + e = i[n] && i[n].pop() + } + return e ? this.count-- : e = new t, + e + } + , + r.clear = function() { + this._pool = {}, + this.count = 0 + } + , + r._clean = function(t) { + t._renderComp = null + } + , + n + }(r.default)); + r.default.register("assembler", l); + var h = l; + i.default = h, + e.exports = i.default + } + ), { + "../utils/pool": 269 + }], + 221: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("./webgl/vertex-format"), s = (n = t("./assembler-pool")) && n.__esModule ? n : { + default: n + }, a = (function() { + function t() { + this._extendNative && this._extendNative() + } + var e = t.prototype; + return e.init = function(t) { + this._renderComp = t + } + , + e.updateRenderData = function() {} + , + e.fillBuffers = function() {} + , + e.getVfmt = function() { + return r.vfmtPosUvColor + } + , + t + } + )(); + i.default = a, + a.register = function(t, e) { + t.__assembler__ = e + } + , + a.init = function(t) { + for (var e = t.constructor, i = e.__assembler__; !i; ) { + if (!(e = e.$super)) + return void cc.warn("Can not find assembler for render component : [" + cc.js.getClassName(t) + "]"); + i = e.__assembler__ + } + if (i.getConstructor && (i = i.getConstructor(t)), + !t._assembler || t._assembler.constructor !== i) { + var n = s.default.get(i); + n.init(t), + t._assembler = n + } + } + , + cc.Assembler = a, + e.exports = i.default + } + ), { + "./assembler-pool": 220, + "./webgl/vertex-format": 256 + }], + 222: [(function(t, e) { + "use strict"; + var i = function(t) { + var e; + try { + e = t.getContext("2d") + } catch (i) { + return void console.error(i) + } + this._canvas = t, + this._ctx = e, + this._caps = {}, + this._stats = { + drawcalls: 0 + }, + this._vx = this._vy = this._vw = this._vh = 0, + this._sx = this._sy = this._sw = this._sh = 0 + }; + i.prototype._restoreTexture = function() {} + , + i.prototype.setViewport = function(t, e, i, n) { + this._vx === t && this._vy === e && this._vw === i && this._vh === n || (this._vx = t, + this._vy = e, + this._vw = i, + this._vh = n) + } + , + i.prototype.setScissor = function(t, e, i, n) { + this._sx === t && this._sy === e && this._sw === i && this._sh === n || (this._sx = t, + this._sy = e, + this._sw = i, + this._sh = n) + } + , + i.prototype.clear = function(t) { + var e = this._ctx; + e.clearRect(this._vx, this._vy, this._vw, this._vh), + !t || 0 === t[0] && 0 === t[1] && 0 === t[2] || (e.fillStyle = "rgb(" + t[0] + "," + t[1] + "," + t[2] + ")", + e.globalAlpha = t[3], + e.fillRect(this._vx, this._vy, this._vw, this._vh)) + } + , + i.prototype.resetDrawCalls = function() { + this._stats.drawcalls = 0 + } + , + i.prototype.getDrawCalls = function() { + return this._stats.drawcalls + } + , + e.exports = i + } + ), {}], + 223: [(function(t, e) { + "use strict"; + var i = function(t, e) { + this._device = t, + this._width = 4, + this._height = 4, + this._image = null, + e && (void 0 !== e.width && (this._width = e.width), + void 0 !== e.height && (this._height = e.height), + this.updateImage(e)) + }; + i.prototype.update = function(t) { + this.updateImage(t) + } + , + i.prototype.updateImage = function(t) { + if (t.images && t.images[0]) { + var e = t.images[0]; + e && e !== this._image && (this._image = e) + } + } + , + i.prototype.destroy = function() { + this._image = null + } + , + e.exports = i + } + ), {}], + 224: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = a(t("../../renderer/gfx")) + , r = a(t("../../renderer/core/input-assembler")) + , s = a(t("../../renderer/core/pass")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + var o = cc.renderer = { + Texture2D: null, + InputAssembler: r.default, + Pass: s.default, + renderEngine: null, + canvas: null, + device: null, + scene: null, + drawCalls: 0, + _handle: null, + _cameraNode: null, + _camera: null, + _forward: null, + _flow: null, + initWebGL: function(e, i) { + t("./webgl/assemblers"); + var r = t("./webgl/model-batcher"); + this.Texture2D = n.default.Texture2D, + this.canvas = e, + this._flow = cc.RenderFlow; + var s = t("../../renderer/scene/scene") + , a = t("../../renderer/renderers/forward-renderer"); + this.device = new n.default.Device(e,i), + this.scene = new s; + var o, l = (o = this.device, + { + defaultTexture: new n.default.Texture2D(o,{ + images: [], + width: 128, + height: 128, + wrapS: n.default.WRAP_REPEAT, + wrapT: n.default.WRAP_REPEAT, + format: n.default.TEXTURE_FMT_RGB8, + genMipmaps: !1 + }), + programTemplates: [], + programChunks: {} + }); + this._forward = new a(this.device,l), + this._handle = new r(this.device,this.scene), + this._flow.init(this._handle, this._forward) + }, + initCanvas: function(e) { + var i = t("./canvas") + , n = t("./canvas/Texture2D") + , r = t("./canvas/Device"); + this.Device = r, + this.Texture2D = n, + this.canvas = e, + this.device = new r(e), + this._camera = { + a: 1, + b: 0, + c: 0, + d: 1, + tx: 0, + ty: 0 + }, + this._handle = new i.RenderComponentHandle(this.device,this._camera), + this._forward = new i.ForwardRenderer, + this._flow = cc.RenderFlow, + this._flow.init(this._handle, this._forward) + }, + updateCameraViewport: function() { + if (cc.director) { + var t = cc.director.getScene(); + t && t.setScale(1, 1, 1) + } + if (cc.game.renderType === cc.game.RENDER_TYPE_CANVAS) { + var e = cc.view.getViewportRect(); + this.device.setViewport(e.x, e.y, e.width, e.height), + this._camera.a = cc.view.getScaleX(), + this._camera.d = cc.view.getScaleY(), + this._camera.tx = e.x, + this._camera.ty = e.y + e.height + } + }, + render: function(t, e) { + this.device.resetDrawCalls(), + t && (this._flow.render(t, e), + this.drawCalls = this.device.getDrawCalls()) + }, + clear: function() { + this._handle.reset(), + this._forward.clear() + } + }; + i.default = o, + e.exports = i.default + } + ), { + "../../renderer/core/input-assembler": 305, + "../../renderer/core/pass": 306, + "../../renderer/gfx": 315, + "../../renderer/renderers/forward-renderer": 334, + "../../renderer/scene/scene": 337, + "./canvas": void 0, + "./canvas/Device": 222, + "./canvas/Texture2D": 223, + "./webgl/assemblers": 236, + "./webgl/model-batcher": 252 + }], + 225: [(function(t, e) { + "use strict"; + var i, n, r = 0, s = 1 << r++, a = 1 << r++, o = 1 << r++, l = 1 << r++, h = o | l, c = 1 << r++, u = 1 << r++, _ = 1 << r++, f = u | _, d = 1 << r++, p = 1 << r++, m = 1 << r++, y = 1 << r++, v = 0; + function g() { + this._func = S, + this._next = null + } + var A = g.prototype; + A._doNothing = function() {} + , + A._localTransform = function(t) { + t._updateLocalMatrix(), + t._renderFlag &= ~o, + this._next._func(t) + } + , + A._worldTransform = function(t) { + i.worldMatDirty++; + var e = t._matrix + , n = t._trs + , r = e.m; + r[12] = n[0], + r[13] = n[1], + r[14] = n[2], + t._mulMat(t._worldMatrix, t._parent._worldMatrix, e), + t._renderFlag &= ~l, + this._next._func(t), + i.worldMatDirty-- + } + , + A._opacity = function(t) { + i.parentOpacityDirty++, + this._next._func(t), + t._renderFlag &= ~u, + i.parentOpacityDirty-- + } + , + A._color = function(t) { + var e = t._renderComponent; + e && e._updateColor(), + t._renderFlag &= ~_, + this._next._func(t) + } + , + A._updateRenderData = function(t) { + var e = t._renderComponent; + e._assembler.updateRenderData(e), + t._renderFlag &= ~c, + this._next._func(t) + } + , + A._render = function(t) { + var e = t._renderComponent; + e._checkBacth(i, t._cullingMask), + e._assembler.fillBuffers(e, i), + this._next._func(t) + } + , + A._children = function(t) { + for (var e = v, n = i, r = n.parentOpacity, s = n.parentOpacity *= t._opacity / 255, a = (n.worldMatDirty ? l : 0) | (n.parentOpacityDirty ? f : 0), o = t._children, h = 0, c = o.length; h < c; h++) { + var u = o[h]; + if (u._renderFlag |= a, + u._activeInHierarchy && 0 !== u._opacity) { + v = u._cullingMask = 0 === u.groupIndex ? e : 1 << u.groupIndex; + var _ = u._color._val; + u._color._fastSetA(u._opacity * s), + b[u._renderFlag]._func(u), + u._color._val = _ + } + } + n.parentOpacity = r, + this._next._func(t) + } + , + A._postRender = function(t) { + var e = t._renderComponent; + e._checkBacth(i, t._cullingMask), + e._assembler.postFillBuffers(e, i), + this._next._func(t) + } + ; + var x = new g; + x._func = x._doNothing, + x._next = x; + var b = {}; + function C(t, e) { + var i = new g; + switch (i._next = e || x, + t) { + case s: + case a: + i._func = i._doNothing; + break; + case o: + i._func = i._localTransform; + break; + case l: + i._func = i._worldTransform; + break; + case u: + i._func = i._opacity; + break; + case _: + i._func = i._color; + break; + case c: + i._func = i._updateRenderData; + break; + case d: + i._func = i._render; + break; + case p: + i._func = i._children; + break; + case m: + i._func = i._postRender + } + return i + } + function T(t) { + for (var e = null, i = y; i > 0; ) + i & t && (e = C(i, e)), + i >>= 1; + return e + } + function S(t) { + var e = t._renderFlag; + (b[e] = T(e))._func(t) + } + g.flows = b, + g.createFlow = C; + var w = []; + g.registerValidate = function(t) { + t._inValidateList || (w.push(t), + t._inValidateList = !0) + } + , + g.validateRenderers = function() { + for (var t = 0, e = w.length; t < e; t++) { + var i = w[t]; + i.isValid && (i.enabledInHierarchy ? i._validateRender() : i.disableRender(), + i._inValidateList = !1) + } + w.length = 0 + } + , + g.visitRootNode = function(t) { + g.validateRenderers(); + var e = v; + v = t._cullingMask, + t._renderFlag & l ? (i.worldMatDirty++, + t._calculWorldMatrix(), + t._renderFlag &= ~l, + b[t._renderFlag]._func(t), + i.worldMatDirty--) : b[t._renderFlag]._func(t), + v = e + } + , + g.render = function(t, e) { + i.reset(), + i.walking = !0, + g.visitRootNode(t), + i.terminate(), + i.walking = !1, + n.render(i._renderScene, e) + } + , + g.renderCamera = function(t, e) { + i.reset(), + i.walking = !0, + g.visitRootNode(e), + i.terminate(), + i.walking = !1, + n.renderCamera(t, i._renderScene) + } + , + g.init = function(t, e) { + i = t, + n = e, + b[0] = x; + for (var r = 1; r < y; r++) + b[r] = new g + } + , + g.getBachther = function() { + return i + } + , + g.FLAG_DONOTHING = s, + g.FLAG_BREAK_FLOW = a, + g.FLAG_LOCAL_TRANSFORM = o, + g.FLAG_WORLD_TRANSFORM = l, + g.FLAG_TRANSFORM = h, + g.FLAG_OPACITY = u, + g.FLAG_COLOR = _, + g.FLAG_OPACITY_COLOR = f, + g.FLAG_UPDATE_RENDER_DATA = c, + g.FLAG_RENDER = d, + g.FLAG_CHILDREN = p, + g.FLAG_POST_RENDER = m, + g.FLAG_FINAL = y, + e.exports = cc.RenderFlow = g + } + ), {}], + 226: [(function(t, e) { + "use strict"; + var i = t("../../../assets/CCRenderTexture") + , n = 2; + function r(t, e) { + var r = new i; + r.initWithSize(t, e), + r.update(), + this._texture = r, + this._x = n, + this._y = n, + this._nexty = n, + this._width = t, + this._height = e, + this._innerTextureInfos = {}, + this._innerSpriteFrames = [], + this._count = 0 + } + r.DEFAULT_HASH = (new i)._getHash(), + cc.js.mixin(r.prototype, { + insertSpriteFrame: function(t) { + var e = t._rect + , i = t._texture + , r = this._innerTextureInfos[i._id] + , s = e.x + , a = e.y; + if (r) + s += r.x, + a += r.y; + else { + var o = i.width + , l = i.height; + if (this._x + o + n > this._width && (this._x = n, + this._y = this._nexty), + this._y + l + n > this._nexty && (this._nexty = this._y + l + n), + this._nexty > this._height) + return null; + cc.dynamicAtlasManager.textureBleeding && ((o <= 8 || l <= 8) && (this._texture.drawTextureAt(i, this._x - 1, this._y - 1), + this._texture.drawTextureAt(i, this._x - 1, this._y + 1), + this._texture.drawTextureAt(i, this._x + 1, this._y - 1), + this._texture.drawTextureAt(i, this._x + 1, this._y + 1)), + this._texture.drawTextureAt(i, this._x - 1, this._y), + this._texture.drawTextureAt(i, this._x + 1, this._y), + this._texture.drawTextureAt(i, this._x, this._y - 1), + this._texture.drawTextureAt(i, this._x, this._y + 1)), + this._texture.drawTextureAt(i, this._x, this._y), + this._innerTextureInfos[i._id] = { + x: this._x, + y: this._y, + texture: i + }, + this._count++, + s += this._x, + a += this._y, + this._x += o + n, + this._dirty = !0 + } + var h = { + x: s, + y: a, + texture: this._texture + }; + return this._innerSpriteFrames.push(t), + h + }, + update: function() { + this._dirty && (this._texture.update(), + this._dirty = !1) + }, + deleteInnerTexture: function(t) { + t && this._innerTextureInfos[t._id] && (delete this._innerTextureInfos[t._id], + this._count--) + }, + isEmpty: function() { + return this._count <= 0 + }, + reset: function() { + this._x = n, + this._y = n, + this._nexty = n; + for (var t = this._innerSpriteFrames, e = 0, i = t.length; e < i; e++) { + var r = t[e]; + r.isValid && r._resetDynamicAtlasFrame() + } + this._innerSpriteFrames.length = 0, + this._innerTextureInfos = {} + }, + destroy: function() { + this.reset(), + this._texture.destroy() + } + }), + e.exports = r + } + ), { + "../../../assets/CCRenderTexture": 70 + }], + 227: [(function(t, e) { + "use strict"; + var i = t("./atlas") + , n = [] + , r = -1 + , s = 5 + , a = 2048 + , o = 512 + , l = !0; + function h() { + var t = n[++r]; + return t || (t = new i(a,a), + n.push(t)), + t + } + function c() { + _.reset() + } + var u = !1 + , _ = { + Atlas: i, + get enabled() { + return u + }, + set enabled(t) { + u !== t && (t ? (this.reset(), + cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, c)) : cc.director.off(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, c), + u = t) + }, + get maxAtlasCount() { + return s + }, + set maxAtlasCount(t) { + s = t + }, + get atlasCount() { + return n.length + }, + get textureBleeding() { + return l + }, + set textureBleeding(t) { + l = t + }, + get textureSize() { + return a + }, + set textureSize(t) { + a = t + }, + get maxFrameSize() { + return o + }, + set maxFrameSize(t) { + o = t + }, + insertSpriteFrame: function(t) { + if (!u || r === s || !t || t._original) + return null; + if (!t._texture.packable) + return null; + var e = n[r]; + e || (e = h()); + var i = e.insertSpriteFrame(t); + return i || r === s ? i : (e = h()).insertSpriteFrame(t) + }, + reset: function() { + for (var t = 0, e = n.length; t < e; t++) + n[t].destroy(); + n.length = 0, + r = -1 + }, + deleteAtlasSpriteFrame: function(t) { + if (t._original) { + var e = t._original._texture; + this.deleteAtlasTexture(e) + } + }, + deleteAtlasTexture: function(t) { + if (t) + for (var e = n.length - 1; e >= 0; e--) + n[e].deleteInnerTexture(t), + n[e].isEmpty() && (n[e].destroy(), + n.splice(e, 1), + r--) + }, + showDebug: !1, + update: function() { + if (this.enabled) + for (var t = 0; t <= r; t++) + n[t].update() + } + }; + e.exports = cc.dynamicAtlasManager = _ + } + ), { + "./atlas": 226 + }], + 228: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../assembler-2d")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = t("../../../utils/text-utils") + , o = t("../../../platform/CCMacro") + , l = t("../../../components/CCLabel").Overflow + , h = t("../utils").shareLabelInfo + , c = function() { + this.char = "", + this.valid = !0, + this.x = 0, + this.y = 0, + this.line = 0, + this.hash = "" + } + , u = cc.rect() + , _ = null + , f = [] + , d = [] + , p = [] + , m = [] + , y = null + , v = 0 + , g = 0 + , A = 0 + , x = 0 + , b = 0 + , C = 1 + , T = null + , S = cc.size() + , w = "" + , E = 0 + , M = 0 + , D = 0 + , B = 0 + , I = 0 + , P = 0 + , R = 0 + , O = !1 + , L = 0 + , F = 0 + , V = 0 + , N = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.updateRenderData = function(t) { + t._vertsDirty && _ !== t && (_ = t, + this._reserveQuads(t, t.string.toString().length), + this._updateFontFamily(t), + this._updateProperties(t), + this._updateLabelInfo(t), + this._updateContent(), + this.updateWorldVerts(t), + _._actualFontSize = E, + _.node.setContentSize(S), + _._vertsDirty = !1, + _ = null, + this._resetProperties()) + } + , + r._updateFontScale = function() { + C = E / M + } + , + r._updateFontFamily = function(t) { + var e = t.font; + T = e.spriteFrame, + y = e._fntConfig, + h.fontAtlas = e._fontDefDictionary, + this.packToDynamicAtlas(t, T) + } + , + r._updateLabelInfo = function() { + h.hash = "", + h.margin = 0 + } + , + r._updateProperties = function(t) { + w = t.string.toString(), + E = t.fontSize, + M = y ? y.fontSize : t.fontSize, + D = t.horizontalAlign, + B = t.verticalAlign, + I = t.spacingX, + R = t.overflow, + P = t._lineHeight, + S.width = t.node.width, + S.height = t.node.height, + R === l.NONE ? (O = !1, + S.width += 2 * h.margin, + S.height += 2 * h.margin) : R === l.RESIZE_HEIGHT ? (O = !0, + S.height += 2 * h.margin) : O = t.enableWrapText, + h.lineHeight = P, + h.fontSize = E, + this._setupBMFontOverflowMetrics() + } + , + r._resetProperties = function() { + y = null, + T = null, + h.hash = "", + h.margin = 0 + } + , + r._updateContent = function() { + this._updateFontScale(), + this._computeHorizontalKerningForText(), + this._alignText() + } + , + r._computeHorizontalKerningForText = function() { + var t, e = w, i = e.length, n = f; + if (y && (t = y.kerningDict), + t && !cc.js.isEmptyObject(t)) + for (var r = -1, s = 0; s < i; ++s) { + var a = e.charCodeAt(s) + , o = t[r << 16 | 65535 & a] || 0; + n[s] = s < i - 1 ? o : 0, + r = a + } + else + n.length = 0 + } + , + r._multilineTextWrap = function(t) { + for (var e = w.length, i = 0, n = 0, r = 0, s = 0, o = 0, c = 0, u = 0, _ = null, d = cc.v2(0, 0), m = 0; m < e; ) { + var A = w.charAt(m); + if ("\n" !== A) { + for (var T = t(w, m, e), E = c, M = u, D = o, B = n, N = !1, k = 0; k < T; ++k) { + var G = m + k; + if ("\r" !== (A = w.charAt(G))) + if (_ = h.fontAtlas.getLetterDefinitionForChar(A, h)) { + var U = B + _.offsetX * C - h.margin; + if (O && V > 0 && n > 0 && U + _.w * C > V && !a.isUnicodeSpace(A)) { + p.push(o), + o = 0, + i++, + n = 0, + r -= P * this._getFontScale() + 0, + N = !0; + break + } + d.x = U, + d.y = r - _.offsetY * C + h.margin, + this._recordLetterInfo(d, A, G, i), + G + 1 < f.length && G < e - 1 && (B += f[G + 1]), + B += _.xAdvance * C + I - 2 * h.margin, + D = d.x + _.w * C - h.margin, + E < d.y && (E = d.y), + M > d.y - _.h * C && (M = d.y - _.h * C) + } else { + this._recordPlaceholderInfo(G, A); + var z = ""; + y && (z = y.atlasName), + console.log("Can't find letter definition in texture atlas " + z + " for letter:" + A) + } + else + this._recordPlaceholderInfo(G, A) + } + N || (n = B, + c < E && (c = E), + u > M && (u = M), + s < (o = D) && (s = o), + m += T) + } else + p.push(o), + o = 0, + i++, + n = 0, + r -= P * this._getFontScale() + 0, + this._recordPlaceholderInfo(m, A), + m++ + } + return p.push(o), + g = (v = i + 1) * P * this._getFontScale(), + v > 1 && (g += 0 * (v - 1)), + S.width = L, + S.height = F, + L <= 0 && (S.width = parseFloat(s.toFixed(2)) + 2 * h.margin), + F <= 0 && (S.height = parseFloat(g.toFixed(2)) + 2 * h.margin), + x = S.height, + b = 0, + R !== l.CLAMP && (c > 0 && (x = S.height + c), + u < -g && (b = g + u)), + !0 + } + , + r._getFirstCharLen = function() { + return 1 + } + , + r._getFontScale = function() { + return R === l.SHRINK ? C : 1 + } + , + r._getFirstWordLen = function(t, e, i) { + var n = t.charAt(e); + if (a.isUnicodeCJK(n) || "\n" === n || a.isUnicodeSpace(n)) + return 1; + var r = 1 + , s = h.fontAtlas.getLetterDefinitionForChar(n, h); + if (!s) + return r; + for (var o = s.xAdvance * C + I, l = e + 1; l < i && (n = t.charAt(l), + s = h.fontAtlas.getLetterDefinitionForChar(n, h)); ++l) { + if (o + s.offsetX * C + s.w * C > V && !a.isUnicodeSpace(n) && V > 0) + return r; + if (o += s.xAdvance * C + I, + "\n" === n || a.isUnicodeSpace(n) || a.isUnicodeCJK(n)) + break; + r++ + } + return r + } + , + r._multilineTextWrapByWord = function() { + return this._multilineTextWrap(this._getFirstWordLen) + } + , + r._multilineTextWrapByChar = function() { + return this._multilineTextWrap(this._getFirstCharLen) + } + , + r._recordPlaceholderInfo = function(t, e) { + if (t >= d.length) { + var i = new c; + d.push(i) + } + d[t].char = e, + d[t].hash = e.charCodeAt(0) + h.hash, + d[t].valid = !1 + } + , + r._recordLetterInfo = function(t, e, i, n) { + if (i >= d.length) { + var r = new c; + d.push(r) + } + var s = e.charCodeAt(0) + h.hash; + d[i].line = n, + d[i].char = e, + d[i].hash = s, + d[i].valid = h.fontAtlas.getLetter(s).valid, + d[i].x = t.x, + d[i].y = t.y + } + , + r._alignText = function() { + g = 0, + p.length = 0, + this._multilineTextWrapByWord(), + this._computeAlignmentOffset(), + R === l.SHRINK && E > 0 && this._isVerticalClamp() && this._shrinkLabelToContentSize(this._isVerticalClamp), + this._updateQuads() || R === l.SHRINK && this._shrinkLabelToContentSize(this._isHorizontalClamp) + } + , + r._scaleFontSizeDown = function(t) { + var e = !0; + t || (t = .1, + e = !1), + E = t, + e && this._updateContent() + } + , + r._shrinkLabelToContentSize = function(t) { + for (var e = 0, i = 0 | E, n = 0; e < i; ) { + var r = n = e + i + 1 >> 1; + if (r <= 0) + break; + C = r / M, + this._multilineTextWrapByWord(), + this._computeAlignmentOffset(), + t() ? i = n - 1 : e = n + } + var s = e; + s >= 0 && this._scaleFontSizeDown(s) + } + , + r._isVerticalClamp = function() { + return g > S.height + } + , + r._isHorizontalClamp = function() { + for (var t = !1, e = 0, i = w.length; e < i; ++e) { + var n = d[e]; + if (n.valid) { + var r = h.fontAtlas.getLetter(n.hash) + , s = n.x + r.w * C + , a = n.line; + if (L > 0) + if (O) { + if (p[a] > S.width && (s > S.width || s < 0)) { + t = !0; + break + } + } else if (s > S.width) { + t = !0; + break + } + } + } + return t + } + , + r._isHorizontalClamped = function(t, e) { + var i = p[e] + , n = t > S.width || t < 0; + return O ? i > S.width && n : n + } + , + r._updateQuads = function() { + var t = T ? T._texture : h.fontAtlas.getTexture() + , e = _.node; + this.verticesCount = this.indicesCount = 0, + this._renderData && (this._renderData.dataLength = 0); + for (var i = S, n = e._anchorPoint.x * i.width, r = e._anchorPoint.y * i.height, s = !0, a = 0, o = w.length; a < o; ++a) { + var c = d[a]; + if (c.valid) { + var f = h.fontAtlas.getLetter(c.hash); + u.height = f.h, + u.width = f.w, + u.x = f.u, + u.y = f.v; + var p = c.y + A; + if (F > 0) { + if (p > x) { + var y = p - x; + u.y += y, + u.height -= y, + p -= y + } + p - f.h * C < b && R === l.CLAMP && (u.height = p < b ? 0 : (p - b) / C) + } + var v = c.line + , g = c.x + f.w / 2 * C + m[v]; + if (L > 0 && this._isHorizontalClamped(g, v)) + if (R === l.CLAMP) + u.width = 0; + else if (R === l.SHRINK) { + if (S.width > f.w) { + s = !1; + break + } + u.width = 0 + } + if (u.height > 0 && u.width > 0) { + var E = this._determineRect(u) + , M = c.x + m[c.line]; + this.appendQuad(_, t, u, E, M - n, p - r, C) + } + } + } + return this._quadsUpdated(_), + s + } + , + r._determineRect = function(t) { + var e = T.isRotated() + , i = T._originalSize + , n = T._rect + , r = T._offset + , s = r.x + (i.width - n.width) / 2 + , a = r.y - (i.height - n.height) / 2; + if (e) { + var o = t.x; + t.x = n.x + n.height - t.y - t.height - a, + t.y = o + n.y - s, + t.y < 0 && (t.height = t.height + a) + } else + t.x += n.x - s, + t.y += n.y + a; + return e + } + , + r._computeAlignmentOffset = function() { + switch (m.length = 0, + D) { + case o.TextAlignment.LEFT: + for (var t = 0; t < v; ++t) + m.push(0); + break; + case o.TextAlignment.CENTER: + for (var e = 0, i = p.length; e < i; e++) + m.push((S.width - p[e]) / 2); + break; + case o.TextAlignment.RIGHT: + for (var n = 0, r = p.length; n < r; n++) + m.push(S.width - p[n]) + } + if (A = S.height, + B !== o.VerticalTextAlignment.TOP) { + var s = S.height - g + P * this._getFontScale() - M * C; + B === o.VerticalTextAlignment.BOTTOM ? A -= s : A -= s / 2 + } + } + , + r._setupBMFontOverflowMetrics = function() { + var t = S.width + , e = S.height; + R === l.RESIZE_HEIGHT && (e = 0), + R === l.NONE && (t = 0, + e = 0), + L = t, + F = e, + V = t + } + , + r.updateWorldVerts = function() {} + , + r.appendQuad = function() {} + , + r._quadsUpdated = function() {} + , + r._reserveQuads = function() {} + , + n + } + )(r.default); + i.default = N, + e.exports = i.default + } + ), { + "../../../components/CCLabel": 107, + "../../../platform/CCMacro": 198, + "../../../utils/text-utils": 274, + "../../assembler-2d": 219, + "../utils": 232 + }], + 229: [(function(t, e) { + "use strict"; + function i() { + this._rect = null, + this.uv = [], + this._texture = null, + this._original = null + } + i.prototype = { + constructor: i, + getRect: function() { + return cc.rect(this._rect) + }, + setRect: function(t) { + this._rect = t, + this._texture && this._calculateUV() + }, + _setDynamicAtlasFrame: function(t) { + t && (this._original = { + _texture: this._texture, + _x: this._rect.x, + _y: this._rect.y + }, + this._texture = t.texture, + this._rect.x = t.x, + this._rect.y = t.y, + this._calculateUV()) + }, + _resetDynamicAtlasFrame: function() { + this._original && (this._rect.x = this._original._x, + this._rect.y = this._original._y, + this._texture = this._original._texture, + this._original = null, + this._calculateUV()) + }, + _refreshTexture: function(t) { + this._texture = t, + this._rect = cc.rect(0, 0, t.width, t.height), + this._calculateUV() + }, + _calculateUV: function() { + var t = this._rect + , e = this._texture + , i = this.uv + , n = e.width + , r = e.height + , s = 0 === n ? 0 : t.x / n + , a = 0 === n ? 0 : (t.x + t.width) / n + , o = 0 === r ? 0 : (t.y + t.height) / r + , l = 0 === r ? 0 : t.y / r; + i[0] = s, + i[1] = o, + i[2] = a, + i[3] = o, + i[4] = s, + i[5] = l, + i[6] = a, + i[7] = l + } + }, + e.exports = i + } + ), {}], + 230: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../webgl/assemblers/label/2d/bmfont")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = t("../../../components/CCLabel") + , o = t("../../../components/CCLabelOutline") + , l = t("../../../utils/text-utils") + , h = t("../../../components/CCComponent") + , c = t("../../../assets/CCRenderTexture") + , u = cc.js.isChildClassOf(o, h) + , _ = t("../utils").getFontFamily + , f = t("../utils").shareLabelInfo + , d = cc.BitmapFont.FontLetterDefinition + , p = cc.BitmapFont.FontAtlas + , m = cc.Color.WHITE + , y = 0 + , v = (1 / 255).toFixed(3); + function g(t, e) { + this._texture = null, + this._labelInfo = e, + this._char = t, + this._hash = null, + this._data = null, + this._canvas = null, + this._context = null, + this._width = 0, + this._height = 0, + this._offsetY = 0, + this._hash = t.charCodeAt(0) + e.hash + } + function A(t, e) { + var i = new c; + i.initWithSize(t, e), + i.update(), + this._fontDefDictionary = new p(i), + this._x = y, + this._y = y, + this._nexty = y, + this._width = t, + this._height = e, + cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this) + } + g.prototype = { + constructor: g, + updateRenderData: function() { + this._updateProperties(), + this._updateTexture() + }, + _updateProperties: function() { + this._texture = new cc.Texture2D, + this._data = a._canvasPool.get(), + this._canvas = this._data.canvas, + this._context = this._data.context, + this._context.font = this._labelInfo.fontDesc; + var t = l.safeMeasureText(this._context, this._char, this._labelInfo.fontDesc) + , e = 2 * this._labelInfo.margin + 2; + this._width = parseFloat(t.toFixed(2)) + e, + this._height = (1 + l.BASELINE_RATIO) * this._labelInfo.fontSize + e, + this._offsetY = -this._labelInfo.fontSize * l.BASELINE_RATIO / 2, + this._canvas.width !== this._width && (this._canvas.width = this._width), + this._canvas.height !== this._height && (this._canvas.height = this._height), + this._texture.initWithElement(this._canvas) + }, + _updateTexture: function() { + var t = this._context + , e = this._labelInfo + , i = this._canvas.width + , n = this._canvas.height + , r = this._labelInfo.fontSize + , s = i / 2 + , a = n / 2 + r * l.MIDDLE_RATIO + r * l.BASELINE_OFFSET + , o = e.color; + if (t.lineJoin = "round", + t.textAlign = "center", + t.clearRect(0, 0, i, n), + t.fillStyle = "rgba(" + o.r + ", " + o.g + ", " + o.b + ", " + v + ")", + t.fillRect(0, 0, i, n), + t.font = e.fontDesc, + t.fillStyle = "rgba(" + o.r + ", " + o.g + ", " + o.b + ", 1)", + e.isOutlined && e.margin > 0) { + var h = e.out || m; + t.strokeStyle = "rgba(" + h.r + ", " + h.g + ", " + h.b + ", " + h.a / 255 + ")", + t.lineWidth = 2 * e.margin, + t.strokeText(this._char, s, a) + } + t.fillText(this._char, s, a), + this._texture.handleLoadedTexture() + }, + destroy: function() { + this._texture.destroy(), + this._texture = null, + a._canvasPool.put(this._data) + } + }, + cc.js.mixin(A.prototype, { + insertLetterTexture: function(t) { + var e = t._texture + , i = e.width + , n = e.height; + if (this._x + i + y > this._width && (this._x = y, + this._y = this._nexty), + this._y + n > this._nexty && (this._nexty = this._y + n + y), + this._nexty > this._height) + return null; + this._fontDefDictionary._texture.drawTextureAt(e, this._x, this._y), + this._dirty = !0; + var r = new d; + return r.u = this._x + 1, + r.v = this._y + 1, + r.texture = this._fontDefDictionary._texture, + r.valid = !0, + r.w = t._width - 2, + r.h = t._height - 2, + r.xAdvance = r.w, + r.offsetY = t._offsetY, + this._x += i + y, + this._fontDefDictionary.addLetterDefinitions(t._hash, r), + r + }, + update: function() { + this._dirty && (this._fontDefDictionary._texture.update(), + this._dirty = !1) + }, + reset: function() { + this._x = y, + this._y = y, + this._nexty = y; + for (var t = this._fontDefDictionary._letterDefinitions, e = 0, i = t.length; e < i; e++) { + var n = t[e]; + n.isValid && n.destroy() + } + this._fontDefDictionary.clear() + }, + destroy: function() { + this.reset(), + this._fontDefDictionary._texture.destroy(), + this._fontDefDictionary._texture = null + }, + beforeSceneLoad: function() { + this.clearAllCache() + }, + clearAllCache: function() { + this.destroy(); + var t = new c; + t.initWithSize(this._width, this._height), + t.update(), + this._fontDefDictionary._texture = t + }, + getLetter: function(t) { + return this._fontDefDictionary._letterDefinitions[t] + }, + getTexture: function() { + return this._fontDefDictionary.getTexture() + }, + getLetterDefinitionForChar: function(t, e) { + var i = t.charCodeAt(0) + e.hash + , n = this._fontDefDictionary._letterDefinitions[i]; + if (!n) { + var r = new g(t,e); + r.updateRenderData(), + n = this.insertLetterTexture(r), + r.destroy() + } + return n + } + }); + var x = null + , b = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r._getAssemblerData = function() { + return x || (x = new A(2048,2048), + cc.Label._shareAtlas = x), + x.getTexture() + } + , + r._updateFontFamily = function(t) { + f.fontAtlas = x, + f.fontFamily = _(t); + var e = u && t.getComponent(o); + e && e.enabled ? (f.isOutlined = !0, + f.margin = e.width, + f.out = e.color.clone(), + f.out.a = e.color.a * t.node.color.a / 255) : (f.isOutlined = !1, + f.margin = 0) + } + , + r._updateLabelInfo = function(t) { + var e, i, n; + f.fontDesc = this._getFontDesc(), + f.color = t.node.color, + f.hash = (i = (e = f).color.toHEX(), + n = "", + e.isOutlined && e.margin > 0 && (n = n + e.margin + e.out.toHEX()), + "" + e.fontSize + e.fontFamily + i + n) + } + , + r._getFontDesc = function() { + return f.fontSize.toString() + "px " + f.fontFamily + } + , + r._computeHorizontalKerningForText = function() {} + , + r._determineRect = function() { + return !1 + } + , + n + } + )(r.default); + i.default = b, + e.exports = i.default + } + ), { + "../../../assets/CCRenderTexture": 70, + "../../../components/CCComponent": 105, + "../../../components/CCLabel": 107, + "../../../components/CCLabelOutline": 108, + "../../../utils/text-utils": 274, + "../../webgl/assemblers/label/2d/bmfont": 237, + "../utils": 232 + }], + 231: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../assembler-2d")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a, o = t("../../../utils/text-utils"), l = t("../../../platform/CCMacro"), h = t("../../../components/CCLabel"), c = t("../../../components/CCLabelOutline"), u = t("../../../components/CCLabelShadow"), _ = h.Overflow, f = t("../utils").deleteFromDynamicAtlas, d = t("../utils").getFontFamily, p = (1 / 255).toFixed(3), m = null, y = null, v = null, g = "", A = "", x = 0, b = 0, C = [], T = cc.Size.ZERO, S = 0, w = 0, E = 0, M = null, D = "", B = _.NONE, I = !1, P = !1, R = null, O = cc.Color.WHITE, L = null, F = cc.Color.BLACK, V = cc.rect(), N = cc.Size.ZERO, k = cc.Size.ZERO, G = !1, U = !1, z = !1, H = 0, W = cc.Vec2.ZERO, j = 0, X = ["left", "center", "right"], Y = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r._getAssemblerData = function() { + return (a = h._canvasPool.get()).canvas.width = a.canvas.height = 1, + a + } + , + r._resetAssemblerData = function(t) { + t && h._canvasPool.put(t) + } + , + r.updateRenderData = function(e) { + t.prototype.updateRenderData.call(this, e), + e._vertsDirty && (this._updateProperties(e), + this._calculateLabelFont(), + this._updateLabelDimensions(), + this._updateTexture(e), + this._calDynamicAtlas(e), + e._actualFontSize = x, + e.node.setContentSize(k), + this.updateVerts(e), + e._vertsDirty = !1, + m = null, + y = null, + v = null) + } + , + r.updateVerts = function() {} + , + r._updatePaddingRect = function() { + var t = 0 + , e = 0 + , i = 0 + , n = 0 + , r = 0; + if (N.width = N.height = 0, + R && (t = e = i = n = r = R.width, + N.width = N.height = 2 * r), + L) { + var s = L.blur + r; + i = Math.max(i, -L._offset.x + s), + n = Math.max(n, L._offset.x + s), + t = Math.max(t, L._offset.y + s), + e = Math.max(e, -L._offset.y + s) + } + if (U) { + var a = b * Math.tan(.20943951); + n += a, + N.width += a + } + V.x = i, + V.y = t, + V.width = i + n, + V.height = t + e + } + , + r._updateProperties = function(t) { + var e = t._assemblerData; + m = e.context, + y = e.canvas, + v = t._frame._original ? t._frame._original._texture : t._frame._texture, + A = t.string.toString(), + x = t._fontSize, + b = x, + H = t.underlineHeight || b / 8, + B = t.overflow, + T.width = t.node.width, + T.height = t.node.height, + k = t.node.getContentSize(), + S = t._lineHeight, + w = t.horizontalAlign, + E = t.verticalAlign, + M = t.node.color, + G = t.enableBold, + U = t.enableItalic, + z = t.enableUnderline, + D = d(t), + P = t.srcBlendFactor === cc.macro.BlendFactor.ONE, + I = B !== _.NONE && (B === _.RESIZE_HEIGHT || t.enableWrapText), + (R = (R = c && t.getComponent(c)) && R.enabled && R.width > 0 ? R : null) && O.set(R.color), + (L = (L = u && t.getComponent(u)) && L.enabled ? L : null) && (F.set(L.color), + F.a = F.a * t.node.color.a / 255), + this._updatePaddingRect() + } + , + r._calculateFillTextStartPosition = function() { + var t = 0; + w === l.TextAlignment.RIGHT ? t = T.width - V.width : w === l.TextAlignment.CENTER && (t = (T.width - V.width) / 2); + var e = this._getLineHeight() * (C.length - 1) + , i = x * (1 - o.BASELINE_RATIO / 2); + if (E !== l.VerticalTextAlignment.TOP) { + var n = e + V.height + x - T.height; + E === l.VerticalTextAlignment.BOTTOM ? i -= n += o.BASELINE_RATIO / 2 * x : i -= n / 2 + } + return i += o.BASELINE_OFFSET * x, + cc.v2(t + V.x, i + V.y) + } + , + r._setupOutline = function() { + m.strokeStyle = "rgba(" + O.r + ", " + O.g + ", " + O.b + ", " + O.a / 255 + ")", + m.lineWidth = 2 * R.width + } + , + r._setupShadow = function() { + m.shadowColor = "rgba(" + F.r + ", " + F.g + ", " + F.b + ", " + F.a / 255 + ")", + m.shadowBlur = L.blur, + m.shadowOffsetX = L.offset.x, + m.shadowOffsetY = -L.offset.y + } + , + r._drawTextEffect = function(t, e) { + if (L || R || z) { + var i = C.length > 1 && L + , n = this._measureText(m, g) + , r = 0 + , s = 0; + L && this._setupShadow(), + R && this._setupOutline(); + for (var a = 0; a < C.length; ++a) + r = t.x, + s = t.y + a * e, + i && (R && m.strokeText(C[a], r, s), + m.fillText(C[a], r, s)), + z && (j = n(C[a]), + w === l.TextAlignment.RIGHT ? W.x = t.x - j : w === l.TextAlignment.CENTER ? W.x = t.x - j / 2 : W.x = t.x, + W.y = s + b / 8, + m.fillRect(W.x, W.y, j, H)); + i && (m.shadowColor = "transparent") + } + } + , + r._updateTexture = function() { + if (m.clearRect(0, 0, y.width, y.height), + m.lineJoin = "round", + P) + m.fillStyle = "rgba(" + M.r + ", " + M.g + ", " + M.b + ", " + M.a / 255 + ")"; + else { + var t = R ? O : M; + m.fillStyle = "rgba(" + t.r + ", " + t.g + ", " + t.b + ", " + p + ")", + m.fillRect(0, 0, y.width, y.height), + m.fillStyle = "rgba(" + M.r + ", " + M.g + ", " + M.b + ", 1)" + } + var e = this._calculateFillTextStartPosition() + , i = this._getLineHeight() + , n = e.x + , r = 0; + this._drawTextEffect(e, i); + for (var s = 0; s < C.length; ++s) + r = e.y + s * i, + R && m.strokeText(C[s], n, r), + m.fillText(C[s], n, r); + L && (m.shadowColor = "transparent"), + v.handleLoadedTexture() + } + , + r._calDynamicAtlas = function(t) { + if (t.cacheMode === h.CacheMode.BITMAP) { + var e = t._frame; + f(t, e), + e._original || e.setRect(cc.rect(0, 0, y.width, y.height)), + this.packToDynamicAtlas(t, e) + } + } + , + r._updateLabelDimensions = function() { + T.width = Math.min(T.width, 2048), + T.height = Math.min(T.height, 2048); + var t = !1; + y.width !== T.width && (y.width = T.width, + t = !0), + y.height !== T.height && (y.height = T.height, + t = !0), + t && (m.font = g), + m.textAlign = X[w] + } + , + r._getFontDesc = function() { + var t = x.toString() + "px "; + return t += D, + G && (t = "bold " + t), + U && (t = "italic " + t), + t + } + , + r._getLineHeight = function() { + return 0 | (0 === S ? x : S * x / b) + } + , + r._calculateParagraphLength = function(t, e) { + for (var i = [], n = 0; n < t.length; ++n) { + var r = o.safeMeasureText(e, t[n], g); + i.push(r) + } + return i + } + , + r._measureText = function(t, e) { + return function(i) { + return o.safeMeasureText(t, i, e) + } + } + , + r._calculateShrinkFont = function(t) { + var e = this._calculateParagraphLength(t, m) + , i = 0 + , n = 0 + , r = 0; + if (I) { + var s = k.width + , a = k.height; + if (s < 0 || a < 0) + return; + n = a + 1; + for (var l = 0, h = 0 | x + 1, c = 0; l < h; ) { + if ((c = l + h + 1 >> 1) <= 0) { + cc.logID(4003); + break + } + x = c, + g = this._getFontDesc(), + m.font = g; + var u = this._getLineHeight(); + for (n = 0, + i = 0; i < t.length; ++i) { + var _ = o.safeMeasureText(m, t[i], g); + n += o.fragmentText(t[i], _, s, this._measureText(m, g)).length * u + } + n > a ? h = c - 1 : l = c + } + 0 === l ? cc.logID(4003) : (x = l, + g = this._getFontDesc(), + m.font = g) + } else { + for (n = t.length * this._getLineHeight(), + i = 0; i < t.length; ++i) + r < e[i] && (r = e[i]); + var f = (T.width - V.width) / r + , d = T.height / n; + x = b * Math.min(1, f, d) | 0, + g = this._getFontDesc(), + m.font = g + } + } + , + r._calculateWrapText = function(t) { + if (I) { + C = []; + for (var e = k.width, i = 0; i < t.length; ++i) { + var n = o.safeMeasureText(m, t[i], g) + , r = o.fragmentText(t[i], n, e, this._measureText(m, g)); + C = C.concat(r) + } + } + } + , + r._calculateLabelFont = function() { + var t = A.split("\n"); + switch (C = t, + g = this._getFontDesc(), + m.font = g, + B) { + case _.NONE: + for (var e = 0, i = 0, n = 0; n < t.length; ++n) { + var r = o.safeMeasureText(m, t[n], g); + e = e > r ? e : r + } + i = (C.length + o.BASELINE_RATIO) * this._getLineHeight(); + var s = parseFloat(e.toFixed(2)) + , a = parseFloat(i.toFixed(2)); + T.width = s + V.width, + T.height = a + V.height, + k.width = s + N.width, + k.height = a + N.height; + break; + case _.SHRINK: + this._calculateShrinkFont(t), + this._calculateWrapText(t); + break; + case _.CLAMP: + this._calculateWrapText(t); + break; + case _.RESIZE_HEIGHT: + this._calculateWrapText(t); + var l = (C.length + o.BASELINE_RATIO) * this._getLineHeight(); + T.height = l + V.height, + k.height = l + N.height + } + } + , + n + } + )(r.default); + i.default = Y, + e.exports = i.default + } + ), { + "../../../components/CCLabel": 107, + "../../../components/CCLabelOutline": 108, + "../../../components/CCLabelShadow": 109, + "../../../platform/CCMacro": 198, + "../../../utils/text-utils": 274, + "../../assembler-2d": 219, + "../utils": 232 + }], + 232: [(function(t, e) { + "use strict"; + var i = t("./dynamic-atlas/manager") + , n = cc.Color.WHITE + , r = { + fontAtlas: null, + fontSize: 0, + lineHeight: 0, + hAlign: 0, + vAlign: 0, + hash: "", + fontFamily: "", + fontDesc: "Arial", + color: n, + isOutlined: !1, + out: n, + margin: 0 + }; + e.exports = { + deleteFromDynamicAtlas: function(t, e) { + e && e._original && i && (i.deleteAtlasSpriteFrame(e), + e._resetDynamicAtlasFrame()) + }, + getFontFamily: function(t) { + return t.useSystemFont ? t.fontFamily || "Arial" : t.font ? t.font._nativeAsset ? t.font._nativeAsset : (cc.assetManager.postLoadNative(t.font, (function() { + t.isValid && t.setVertsDirty() + } + )), + "Arial") : "Arial" + }, + shareLabelInfo: r + } + } + ), { + "./dynamic-atlas/manager": 227 + }], + 233: [(function(t, e) { + "use strict"; + function i(t, e, i) { + i = i || 2; + var r, a, o, l, h, u, _, f = e && e.length, d = f ? e[0] * i : t.length, p = n(t, 0, d, i, !0), m = []; + if (!p) + return m; + if (f && (p = c(t, e, p, i)), + t.length > 80 * i) { + r = o = t[0], + a = l = t[1]; + for (var y = i; y < d; y += i) + (h = t[y]) < r && (r = h), + (u = t[y + 1]) < a && (a = u), + h > o && (o = h), + u > l && (l = u); + _ = Math.max(o - r, l - a) + } + return s(p, m, i, r, a, _), + m + } + function n(t, e, i, n, r) { + var s, a; + if (r === B(t, e, i, n) > 0) + for (s = e; s < i; s += n) + a = E(s, t[s], t[s + 1], a); + else + for (s = i - n; s >= e; s -= n) + a = E(s, t[s], t[s + 1], a); + return a && x(a, a.next) && (M(a), + a = a.next), + a + } + function r(t, e) { + if (!t) + return t; + e || (e = t); + var i, n = t; + do { + if (i = !1, + n.steiner || !x(n, n.next) && 0 !== A(n.prev, n, n.next)) + n = n.next; + else { + if (M(n), + (n = e = n.prev) === n.next) + return null; + i = !0 + } + } while (i || n !== e);return e + } + function s(t, e, i, n, c, u, _) { + if (t) { + !_ && u && d(t, n, c, u); + for (var f, p, m = t; t.prev !== t.next; ) + if (f = t.prev, + p = t.next, + u ? o(t, n, c, u) : a(t)) + e.push(f.i / i), + e.push(t.i / i), + e.push(p.i / i), + M(t), + t = p.next, + m = p.next; + else if ((t = p) === m) { + _ ? 1 === _ ? s(t = l(t, e, i), e, i, n, c, u, 2) : 2 === _ && h(t, e, i, n, c, u) : s(r(t), e, i, n, c, u, 1); + break + } + } + } + function a(t) { + var e = t.prev + , i = t + , n = t.next; + if (A(e, i, n) >= 0) + return !1; + for (var r = t.next.next; r !== t.prev; ) { + if (v(e.x, e.y, i.x, i.y, n.x, n.y, r.x, r.y) && A(r.prev, r, r.next) >= 0) + return !1; + r = r.next + } + return !0 + } + function o(t, e, i, n) { + var r = t.prev + , s = t + , a = t.next; + if (A(r, s, a) >= 0) + return !1; + for (var o = r.x < s.x ? r.x < a.x ? r.x : a.x : s.x < a.x ? s.x : a.x, l = r.y < s.y ? r.y < a.y ? r.y : a.y : s.y < a.y ? s.y : a.y, h = r.x > s.x ? r.x > a.x ? r.x : a.x : s.x > a.x ? s.x : a.x, c = r.y > s.y ? r.y > a.y ? r.y : a.y : s.y > a.y ? s.y : a.y, u = m(o, l, e, i, n), _ = m(h, c, e, i, n), f = t.nextZ; f && f.z <= _; ) { + if (f !== t.prev && f !== t.next && v(r.x, r.y, s.x, s.y, a.x, a.y, f.x, f.y) && A(f.prev, f, f.next) >= 0) + return !1; + f = f.nextZ + } + for (f = t.prevZ; f && f.z >= u; ) { + if (f !== t.prev && f !== t.next && v(r.x, r.y, s.x, s.y, a.x, a.y, f.x, f.y) && A(f.prev, f, f.next) >= 0) + return !1; + f = f.prevZ + } + return !0 + } + function l(t, e, i) { + var n = t; + do { + var r = n.prev + , s = n.next.next; + !x(r, s) && b(r, n, n.next, s) && T(r, s) && T(s, r) && (e.push(r.i / i), + e.push(n.i / i), + e.push(s.i / i), + M(n), + M(n.next), + n = t = s), + n = n.next + } while (n !== t);return n + } + function h(t, e, i, n, a, o) { + var l = t; + do { + for (var h = l.next.next; h !== l.prev; ) { + if (l.i !== h.i && g(l, h)) { + var c = w(l, h); + return l = r(l, l.next), + c = r(c, c.next), + s(l, e, i, n, a, o), + void s(c, e, i, n, a, o) + } + h = h.next + } + l = l.next + } while (l !== t) + } + function c(t, e, i, s) { + var a, o, l, h = []; + for (a = 0, + o = e.length; a < o; a++) + (l = n(t, e[a] * s, a < o - 1 ? e[a + 1] * s : t.length, s, !1)) === l.next && (l.steiner = !0), + h.push(y(l)); + for (h.sort(u), + a = 0; a < h.length; a++) + _(h[a], i), + i = r(i, i.next); + return i + } + function u(t, e) { + return t.x - e.x + } + function _(t, e) { + if (e = f(t, e)) { + var i = w(e, t); + r(i, i.next) + } + } + function f(t, e) { + var i, n = e, r = t.x, s = t.y, a = -1 / 0; + do { + if (s <= n.y && s >= n.next.y) { + var o = n.x + (s - n.y) * (n.next.x - n.x) / (n.next.y - n.y); + if (o <= r && o > a) { + if (a = o, + o === r) { + if (s === n.y) + return n; + if (s === n.next.y) + return n.next + } + i = n.x < n.next.x ? n : n.next + } + } + n = n.next + } while (n !== e);if (!i) + return null; + if (r === a) + return i.prev; + var l, h = i, c = i.x, u = i.y, _ = 1 / 0; + for (n = i.next; n !== h; ) + r >= n.x && n.x >= c && v(s < u ? r : a, s, c, u, s < u ? a : r, s, n.x, n.y) && ((l = Math.abs(s - n.y) / (r - n.x)) < _ || l === _ && n.x > i.x) && T(n, t) && (i = n, + _ = l), + n = n.next; + return i + } + function d(t, e, i, n) { + var r = t; + do { + null === r.z && (r.z = m(r.x, r.y, e, i, n)), + r.prevZ = r.prev, + r.nextZ = r.next, + r = r.next + } while (r !== t);r.prevZ.nextZ = null, + r.prevZ = null, + p(r) + } + function p(t) { + var e, i, n, r, s, a, o, l, h = 1; + do { + for (i = t, + t = null, + s = null, + a = 0; i; ) { + for (a++, + n = i, + o = 0, + e = 0; e < h && (o++, + n = n.nextZ); e++) + ; + for (l = h; o > 0 || l > 0 && n; ) + 0 === o ? (r = n, + n = n.nextZ, + l--) : 0 !== l && n ? i.z <= n.z ? (r = i, + i = i.nextZ, + o--) : (r = n, + n = n.nextZ, + l--) : (r = i, + i = i.nextZ, + o--), + s ? s.nextZ = r : t = r, + r.prevZ = s, + s = r; + i = n + } + s.nextZ = null, + h *= 2 + } while (a > 1);return t + } + function m(t, e, i, n, r) { + return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - i) / r) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - n) / r) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1 + } + function y(t) { + var e = t + , i = t; + do { + e.x < i.x && (i = e), + e = e.next + } while (e !== t);return i + } + function v(t, e, i, n, r, s, a, o) { + return (r - a) * (e - o) - (t - a) * (s - o) >= 0 && (t - a) * (n - o) - (i - a) * (e - o) >= 0 && (i - a) * (s - o) - (r - a) * (n - o) >= 0 + } + function g(t, e) { + return t.next.i !== e.i && t.prev.i !== e.i && !C(t, e) && T(t, e) && T(e, t) && S(t, e) + } + function A(t, e, i) { + return (e.y - t.y) * (i.x - e.x) - (e.x - t.x) * (i.y - e.y) + } + function x(t, e) { + return t.x === e.x && t.y === e.y + } + function b(t, e, i, n) { + return !!(x(t, e) && x(i, n) || x(t, n) && x(i, e)) || A(t, e, i) > 0 != A(t, e, n) > 0 && A(i, n, t) > 0 != A(i, n, e) > 0 + } + function C(t, e) { + var i = t; + do { + if (i.i !== t.i && i.next.i !== t.i && i.i !== e.i && i.next.i !== e.i && b(i, i.next, t, e)) + return !0; + i = i.next + } while (i !== t);return !1 + } + function T(t, e) { + return A(t.prev, t, t.next) < 0 ? A(t, e, t.next) >= 0 && A(t, t.prev, e) >= 0 : A(t, e, t.prev) < 0 || A(t, t.next, e) < 0 + } + function S(t, e) { + var i = t + , n = !1 + , r = (t.x + e.x) / 2 + , s = (t.y + e.y) / 2; + do { + i.y > s != i.next.y > s && r < (i.next.x - i.x) * (s - i.y) / (i.next.y - i.y) + i.x && (n = !n), + i = i.next + } while (i !== t);return n + } + function w(t, e) { + var i = new D(t.i,t.x,t.y) + , n = new D(e.i,e.x,e.y) + , r = t.next + , s = e.prev; + return t.next = e, + e.prev = t, + i.next = r, + r.prev = i, + n.next = i, + i.prev = n, + s.next = n, + n.prev = s, + n + } + function E(t, e, i, n) { + var r = new D(t,e,i); + return n ? (r.next = n.next, + r.prev = n, + n.next.prev = r, + n.next = r) : (r.prev = r, + r.next = r), + r + } + function M(t) { + t.next.prev = t.prev, + t.prev.next = t.next, + t.prevZ && (t.prevZ.nextZ = t.nextZ), + t.nextZ && (t.nextZ.prevZ = t.prevZ) + } + function D(t, e, i) { + this.i = t, + this.x = e, + this.y = i, + this.prev = null, + this.next = null, + this.z = null, + this.prevZ = null, + this.nextZ = null, + this.steiner = !1 + } + function B(t, e, i, n) { + for (var r = 0, s = e, a = i - n; s < i; s += n) + r += (t[a] - t[s]) * (t[s + 1] + t[a + 1]), + a = s; + return r + } + cc.Graphics.earcut = e.exports = i, + i.deviation = function(t, e, i, n) { + var r = e && e.length + , s = r ? e[0] * i : t.length + , a = Math.abs(B(t, 0, s, i)); + if (r) + for (var o = 0, l = e.length; o < l; o++) { + var h = e[o] * i + , c = o < l - 1 ? e[o + 1] * i : t.length; + a -= Math.abs(B(t, h, c, i)) + } + var u = 0; + for (o = 0; o < n.length; o += 3) { + var _ = n[o] * i + , f = n[o + 1] * i + , d = n[o + 2] * i; + u += Math.abs((t[_] - t[d]) * (t[f + 1] - t[_ + 1]) - (t[_] - t[f]) * (t[d + 1] - t[_ + 1])) + } + return 0 === a && 0 === u ? 0 : Math.abs((u - a) / a) + } + , + i.flatten = function(t) { + for (var e = t[0][0].length, i = { + vertices: [], + holes: [], + dimensions: e + }, n = 0, r = 0; r < t.length; r++) { + for (var s = 0; s < t[r].length; s++) + for (var a = 0; a < e; a++) + i.vertices.push(t[r][s][a]); + r > 0 && (n += t[r - 1].length, + i.holes.push(n)) + } + return i + } + } + ), {}], + 234: [(function(t, e) { + "use strict"; + var i = t("../../../../graphics/helper") + , n = t("../../../../graphics/types").PointFlags + , r = cc.Graphics.Point = cc.Class({ + name: "cc.GraphicsPoint", + extends: cc.Vec2, + ctor: function() { + this.reset() + }, + reset: function() { + this.dx = 0, + this.dy = 0, + this.dmx = 0, + this.dmy = 0, + this.flags = 0, + this.len = 0 + } + }); + function s() { + this.reset() + } + function a() { + this._tessTol = .25, + this._distTol = .01, + this._updatePathOffset = !1, + this._paths = null, + this._pathLength = 0, + this._pathOffset = 0, + this._points = null, + this._pointsOffset = 0, + this._commandx = 0, + this._commandy = 0, + this._paths = [], + this._points = [] + } + cc.js.mixin(s.prototype, { + reset: function() { + this.closed = !1, + this.nbevel = 0, + this.complex = !0, + this.points ? this.points.length = 0 : this.points = [] + } + }), + cc.js.mixin(a.prototype, { + moveTo: function(t, e) { + this._updatePathOffset && (this._pathOffset = this._pathLength, + this._updatePathOffset = !1), + this._addPath(), + this._addPoint(t, e, n.PT_CORNER), + this._commandx = t, + this._commandy = e + }, + lineTo: function(t, e) { + this._addPoint(t, e, n.PT_CORNER), + this._commandx = t, + this._commandy = e + }, + bezierCurveTo: function(t, e, r, s, a, o) { + var l = this._curPath + , h = l.points[l.points.length - 1]; + h.x !== t || h.y !== e || r !== a || s !== o ? (i.tesselateBezier(this, h.x, h.y, t, e, r, s, a, o, 0, n.PT_CORNER), + this._commandx = a, + this._commandy = o) : this.lineTo(a, o) + }, + quadraticCurveTo: function(t, e, i, n) { + var r = this._commandx + , s = this._commandy; + this.bezierCurveTo(r + 2 / 3 * (t - r), s + 2 / 3 * (e - s), i + 2 / 3 * (t - i), n + 2 / 3 * (e - n), i, n) + }, + arc: function(t, e, n, r, s, a) { + i.arc(this, t, e, n, r, s, a) + }, + ellipse: function(t, e, n, r) { + i.ellipse(this, t, e, n, r), + this._curPath.complex = !1 + }, + circle: function(t, e, n) { + i.ellipse(this, t, e, n, n), + this._curPath.complex = !1 + }, + rect: function(t, e, i, n) { + this.moveTo(t, e), + this.lineTo(t, e + n), + this.lineTo(t + i, e + n), + this.lineTo(t + i, e), + this.close(), + this._curPath.complex = !1 + }, + roundRect: function(t, e, n, r, s) { + i.roundRect(this, t, e, n, r, s), + this._curPath.complex = !1 + }, + clear: function(t) { + this._pathLength = 0, + this._pathOffset = 0, + this._pointsOffset = 0, + this._curPath = null, + t && (this._paths.length = 0, + this._points.length = 0) + }, + close: function() { + this._curPath.closed = !0 + }, + _addPath: function() { + var t = this._pathLength + , e = this._paths[t]; + return e ? e.reset() : (e = new s, + this._paths.push(e)), + this._pathLength++, + this._curPath = e, + e + }, + _addPoint: function(t, e, i) { + var n = this._curPath; + if (n) { + var s, a = this._points, o = n.points; + (s = a[this._pointsOffset++]) ? (s.x = t, + s.y = e) : (s = new r(t,e), + a.push(s)), + s.flags = i, + o.push(s) + } + } + }), + cc.Graphics._Impl = a, + e.exports = a + } + ), { + "../../../../graphics/helper": 157, + "../../../../graphics/types": 159 + }], + 235: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = s(t("../../../assembler")) + , r = s(t("../../../../../renderer/core/input-assembler")); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + function a(t, e) { + return (a = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var o = t("../../mesh-buffer") + , l = t("../../../index") + , h = t("../../../../graphics/graphics") + , c = t("../../../../graphics/types").PointFlags + , u = h.LineJoin + , _ = h.LineCap + , f = t("./earcut"); + t("./impl"); + var d = Math.PI + , p = Math.min + , m = Math.max + , y = Math.ceil + , v = Math.acos + , g = Math.cos + , A = Math.sin + , x = Math.atan2; + function b(t, e, i) { + return t < e ? e : t > i ? i : t + } + var C = cc.gfx + , T = new C.VertexFormat([{ + name: C.ATTR_POSITION, + type: C.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: C.ATTR_COLOR, + type: C.ATTR_TYPE_UINT8, + num: 4, + normalize: !0 + }, { + name: "a_dist", + type: C.ATTR_TYPE_FLOAT32, + num: 1 + }]); + T.name = "vfmtPosColorSdf"; + var S = (function(t) { + var e, i; + function n(e) { + var i; + return (i = t.call(this, e) || this)._buffer = null, + i._buffers = [], + i._bufferOffset = 0, + i + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + a(e, i); + var s = n.prototype; + return s.getVfmt = function() { + return T + } + , + s.getVfmtFloatCount = function() { + return 4 + } + , + s.requestBuffer = function() { + var t = { + indiceStart: 0, + vertexStart: 0 + } + , e = new o(l._handle,this.getVfmt()); + t.meshbuffer = e; + var i = new r.default(e._vb,e._ib); + return t.ia = i, + this._buffers.push(t), + t + } + , + s.getBuffers = function() { + return 0 === this._buffers.length && this.requestBuffer(), + this._buffers + } + , + s.clear = function(t) { + this._bufferOffset = 0; + var e = this._buffers; + if (t) { + for (var i = 0, n = e.length; i < n; i++) { + var r = e[i]; + r.meshbuffer.destroy(), + r.meshbuffer = null + } + e.length = 0 + } else + for (var s = 0, a = e.length; s < a; s++) { + var o = e[s]; + o.indiceStart = 0, + o.vertexStart = 0, + o.meshbuffer.reset() + } + } + , + s.fillBuffers = function(t, e) { + e._flush(), + e.node = t.node, + e.material = t._materials[0]; + for (var i = this.getBuffers(), n = 0, r = i.length; n < r; n++) { + var s = i[n] + , a = s.meshbuffer; + s.ia._count = s.indiceStart, + e._flushIA(s.ia), + a.uploadData() + } + } + , + s.genBuffer = function(t, e) { + var i = this.getBuffers() + , n = i[this._bufferOffset] + , r = n.meshbuffer + , s = n.vertexStart + e; + return (s > 65535 || 3 * s > 131070) && (++this._bufferOffset, + s = e, + this._bufferOffset < i.length ? n = i[this._bufferOffset] : (n = this.requestBuffer(t), + i[this._bufferOffset] = n), + r = n.meshbuffer), + s > r.vertexOffset && r.requestStatic(e, 3 * e), + this._buffer = n, + n + } + , + s.stroke = function(t) { + this._curColor = t._strokeColor._val, + this._flattenPaths(t._impl), + this._expandStroke(t), + t._impl._updatePathOffset = !0 + } + , + s.fill = function(t) { + this._curColor = t._fillColor._val, + this._expandFill(t), + t._impl._updatePathOffset = !0 + } + , + s._expandStroke = function(t) { + var e, i, n, r, s = .5 * t.lineWidth, a = t.lineCap, o = t.lineJoin, l = t.miterLimit, h = t._impl, f = (e = s, + i = d, + n = h._tessTol, + r = 2 * v(e / (e + n)), + m(2, y(i / r))); + this._calculateJoins(h, s, o, l); + for (var p = h._paths, g = 0, A = h._pathOffset, x = h._pathLength; A < x; A++) { + var b = p[A] + , C = b.points.length; + o === u.ROUND ? g += 2 * (C + b.nbevel * (f + 2) + 1) : g += 2 * (C + 5 * b.nbevel + 1), + b.closed || (a === _.ROUND ? g += 2 * (2 * f + 2) : g += 12) + } + for (var T = this.genBuffer(t, g), S = T.meshbuffer, w = S._vData, E = S._iData, M = h._pathOffset, D = h._pathLength; M < D; M++) { + var B, I = p[M], P = I.points, R = P.length, O = T.vertexStart, L = void 0, F = void 0, V = void 0, N = void 0; + if ((B = I.closed) ? (L = P[R - 1], + F = P[0], + V = 0, + N = R) : (L = P[0], + F = P[1], + V = 1, + N = R - 1), + F = F || L, + !B) { + var k = F.sub(L); + k.normalizeSelf(); + var G = k.x + , U = k.y; + a === _.BUTT ? this._buttCapStart(L, G, U, s, 0) : a === _.SQUARE ? this._buttCapStart(L, G, U, s, s) : a === _.ROUND && this._roundCapStart(L, G, U, s, f) + } + for (var z = V; z < N; ++z) + o === u.ROUND ? this._roundJoin(L, F, s, s, f) : 0 != (F.flags & (c.PT_BEVEL | c.PT_INNERBEVEL)) ? this._bevelJoin(L, F, s, s) : (this._vset(F.x + F.dmx * s, F.y + F.dmy * s, 1), + this._vset(F.x - F.dmx * s, F.y - F.dmy * s, -1)), + L = F, + F = P[z + 1]; + if (B) { + var H = this.getVfmtFloatCount() + , W = O * H; + this._vset(w[W], w[W + 1], 1), + this._vset(w[W + H], w[W + H + 1], -1) + } else { + var j = F.sub(L); + j.normalizeSelf(); + var X = j.x + , Y = j.y; + a === _.BUTT ? this._buttCapEnd(F, X, Y, s, 0) : a === _.SQUARE ? this._buttCapEnd(F, X, Y, s, s) : a === _.ROUND && this._roundCapEnd(F, X, Y, s, f) + } + for (var q = T.indiceStart, J = O + 2, Z = T.vertexStart; J < Z; J++) + E[q++] = J - 2, + E[q++] = J - 1, + E[q++] = J; + T.indiceStart = q + } + } + , + s._expandFill = function(t) { + for (var e = t._impl, i = e._paths, n = 0, r = e._pathOffset, s = e._pathLength; r < s; r++) + n += i[r].points.length; + for (var a = this.genBuffer(t, n), o = a.meshbuffer, l = o._vData, h = o._iData, c = e._pathOffset, u = e._pathLength; c < u; c++) { + var _ = i[c] + , d = _.points + , p = d.length; + if (0 !== p) { + for (var m = a.vertexStart, y = 0; y < p; ++y) + this._vset(d[y].x, d[y].y); + var v = a.indiceStart; + if (_.complex) { + for (var g = [], A = this.getVfmtFloatCount(), x = m, b = a.vertexStart; x < b; x++) { + var C = x * A; + g.push(l[C]), + g.push(l[C + 1]) + } + var T = f(g, null, 2); + if (!T || 0 === T.length) + continue; + for (var S = 0, w = T.length; S < w; S++) + h[v++] = T[S] + m + } else + for (var E = m, M = m + 2, D = a.vertexStart; M < D; M++) + h[v++] = E, + h[v++] = M - 1, + h[v++] = M; + a.indiceStart = v + } + } + } + , + s._calculateJoins = function(t, e, i, n) { + var r = 0; + e > 0 && (r = 1 / e); + for (var s = t._paths, a = t._pathOffset, o = t._pathLength; a < o; a++) { + var l = s[a] + , h = l.points + , _ = h.length + , f = h[_ - 1] + , d = h[0]; + l.nbevel = 0; + for (var y = 0; y < _; y++) { + var v, g, A = f.dy, x = -f.dx, b = d.dy, C = -d.dx; + if (d.dmx = .5 * (A + b), + d.dmy = .5 * (x + C), + (v = d.dmx * d.dmx + d.dmy * d.dmy) > 1e-6) { + var T = 1 / v; + T > 600 && (T = 600), + d.dmx *= T, + d.dmy *= T + } + d.dx * f.dy - f.dx * d.dy > 0 && (d.flags |= c.PT_LEFT), + v * (g = m(11, p(f.len, d.len) * r)) * g < 1 && (d.flags |= c.PT_INNERBEVEL); + var S = d.dmx * e + , w = d.dmy * e + , E = S * S + w * w; + (E > d.len * d.len || E > f.len * f.len) && (d.flags |= c.PT_INNERBEVEL), + d.flags & c.PT_CORNER && (v * n * n < 1 || i === u.BEVEL || i === u.ROUND) && (d.flags |= c.PT_BEVEL), + 0 != (d.flags & (c.PT_BEVEL | c.PT_INNERBEVEL)) && l.nbevel++, + f = d, + d = h[y + 1] + } + } + } + , + s._flattenPaths = function(t) { + for (var e = t._paths, i = t._pathOffset, n = t._pathLength; i < n; i++) { + var r = e[i] + , s = r.points + , a = s[s.length - 1] + , o = s[0]; + s.length > 2 && a.equals(o) && (r.closed = !0, + s.pop(), + a = s[s.length - 1]); + for (var l = 0, h = s.length; l < h; l++) { + var c = o.sub(a); + a.len = c.mag(), + (c.x || c.y) && c.normalizeSelf(), + a.dx = c.x, + a.dy = c.y, + a = o, + o = s[l + 1] + } + } + } + , + s._chooseBevel = function(t, e, i, n) { + var r, s, a, o, l = i.x, h = i.y; + return 0 !== t ? (r = l + e.dy * n, + s = h - e.dx * n, + a = l + i.dy * n, + o = h - i.dx * n) : (r = a = l + i.dmx * n, + s = o = h + i.dmy * n), + [r, s, a, o] + } + , + s._buttCapStart = function(t, e, i, n, r) { + var s = t.x - e * r + , a = t.y - i * r + , o = i + , l = -e; + this._vset(s + o * n, a + l * n, 1), + this._vset(s - o * n, a - l * n, -1) + } + , + s._buttCapEnd = function(t, e, i, n, r) { + var s = t.x + e * r + , a = t.y + i * r + , o = i + , l = -e; + this._vset(s + o * n, a + l * n, 1), + this._vset(s - o * n, a - l * n, -1) + } + , + s._roundCapStart = function(t, e, i, n, r) { + for (var s = t.x, a = t.y, o = i, l = -e, h = 0; h < r; h++) { + var c = h / (r - 1) * d + , u = g(c) * n + , _ = A(c) * n; + this._vset(s - o * u - e * _, a - l * u - i * _, 1), + this._vset(s, a, 0) + } + this._vset(s + o * n, a + l * n, 1), + this._vset(s - o * n, a - l * n, -1) + } + , + s._roundCapEnd = function(t, e, i, n, r) { + var s = t.x + , a = t.y + , o = i + , l = -e; + this._vset(s + o * n, a + l * n, 1), + this._vset(s - o * n, a - l * n, -1); + for (var h = 0; h < r; h++) { + var c = h / (r - 1) * d + , u = g(c) * n + , _ = A(c) * n; + this._vset(s, a, 0), + this._vset(s - o * u + e * _, a - l * u + i * _, 1) + } + } + , + s._roundJoin = function(t, e, i, n, r) { + var s = t.dy + , a = -t.dx + , o = e.dy + , l = -e.dx + , h = e.x + , u = e.y; + if (0 != (e.flags & c.PT_LEFT)) { + var _ = this._chooseBevel(e.flags & c.PT_INNERBEVEL, t, e, i) + , f = _[0] + , p = _[1] + , m = _[2] + , v = _[3] + , C = x(-a, -s) + , T = x(-l, -o); + T > C && (T -= 2 * d), + this._vset(f, p, 1), + this._vset(h - s * n, e.y - a * n, -1); + for (var S = b(y((C - T) / d) * r, 2, r), w = 0; w < S; w++) { + var E = C + w / (S - 1) * (T - C) + , M = h + g(E) * n + , D = u + A(E) * n; + this._vset(h, u, 0), + this._vset(M, D, -1) + } + this._vset(m, v, 1), + this._vset(h - o * n, u - l * n, -1) + } else { + var B = this._chooseBevel(e.flags & c.PT_INNERBEVEL, t, e, -n) + , I = B[0] + , P = B[1] + , R = B[2] + , O = B[3] + , L = x(a, s) + , F = x(l, o); + F < L && (F += 2 * d), + this._vset(h + s * n, u + a * n, 1), + this._vset(I, P, -1); + for (var V = b(y((F - L) / d) * r, 2, r), N = 0; N < V; N++) { + var k = L + N / (V - 1) * (F - L) + , G = h + g(k) * i + , U = u + A(k) * i; + this._vset(G, U, 1), + this._vset(h, u, 0) + } + this._vset(h + o * n, u + l * n, 1), + this._vset(R, O, -1) + } + } + , + s._bevelJoin = function(t, e, i, n) { + var r, s, a, o, l, h, u, _, f = t.dy, d = -t.dx, p = e.dy, m = -e.dx; + if (e.flags & c.PT_LEFT) { + var y = this._chooseBevel(e.flags & c.PT_INNERBEVEL, t, e, i); + l = y[0], + h = y[1], + u = y[2], + _ = y[3], + this._vset(l, h, 1), + this._vset(e.x - f * n, e.y - d * n, -1), + this._vset(u, _, 1), + this._vset(e.x - p * n, e.y - m * n, -1) + } else { + var v = this._chooseBevel(e.flags & c.PT_INNERBEVEL, t, e, -n); + r = v[0], + s = v[1], + a = v[2], + o = v[3], + this._vset(e.x + f * i, e.y + d * i, 1), + this._vset(r, s, -1), + this._vset(e.x + p * i, e.y + m * i, 1), + this._vset(a, o, -1) + } + } + , + s._vset = function(t, e, i) { + void 0 === i && (i = 0); + var n = this._buffer + , r = n.meshbuffer + , s = n.vertexStart * this.getVfmtFloatCount() + , a = r._vData + , o = r._uintVData; + a[s] = t, + a[s + 1] = e, + o[s + 2] = this._curColor, + a[s + 3] = i, + n.vertexStart++, + r._dirty = !0 + } + , + n + } + )(n.default); + i.default = S, + n.default.register(cc.Graphics, S), + e.exports = i.default + } + ), { + "../../../../../renderer/core/input-assembler": 305, + "../../../../graphics/graphics": 156, + "../../../../graphics/types": 159, + "../../../assembler": 221, + "../../../index": 224, + "../../mesh-buffer": 251, + "./earcut": 233, + "./impl": 234 + }], + 236: [(function(t) { + "use strict"; + cc.assemblers = {}, + t("./sprite"), + t("./mask-assembler"), + t("./graphics"), + t("./label"), + t("./motion-streak") + } + ), { + "./graphics": 235, + "./label": 241, + "./mask-assembler": 242, + "./motion-streak": void 0, + "./sprite": 249 + }], + 237: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../../../utils/label/bmfont")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = 0 + , o = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.initData = function() { + this._renderData.createFlexData(0, 4, 6, this.getVfmt()) + } + , + r._reserveQuads = function(t, e) { + var i = 4 * e + , n = 6 * e + , r = this._renderData._flexBuffer; + r.reserve(i, n), + r.used(i, n); + for (var s = this._renderData.iDatas[0], o = 0, l = 0, h = n; o < h; o += 6, + l += 4) + s[o] = l, + s[o + 1] = l + 1, + s[o + 2] = l + 2, + s[o + 3] = l + 1, + s[o + 4] = l + 3, + s[o + 5] = l + 2; + a = 0 + } + , + r._quadsUpdated = function() { + a = 0, + this._renderData._flexBuffer.used(this.verticesCount, this.indicesCount) + } + , + r._getColor = function(t) { + return t.node._color._val + } + , + r.appendQuad = function(t, e, i, n, r, s, o) { + var l = this._renderData + , h = l.vDatas[0] + , c = l.uintVDatas[0]; + this.verticesCount += 4, + this.indicesCount = this.verticesCount / 2 * 3; + var u, _, f, d, p = e.width, m = e.height, y = i.width, v = i.height, g = this._getColor(t), A = this.floatsPerVert, x = a + this.uvOffset; + n ? (u = i.x / p, + f = (i.x + v) / p, + _ = (i.y + y) / m, + d = i.y / m, + h[x] = u, + h[x + 1] = d, + h[x += A] = u, + h[x + 1] = _, + h[x += A] = f, + h[x + 1] = d, + h[x += A] = f, + h[x + 1] = _) : (u = i.x / p, + f = (i.x + y) / p, + _ = (i.y + v) / m, + d = i.y / m, + h[x] = u, + h[x + 1] = _, + h[x += A] = f, + h[x + 1] = _, + h[x += A] = u, + h[x + 1] = d, + h[x += A] = f, + h[x + 1] = d), + u = r, + f = r + y * o, + _ = s - v * o, + d = s, + this.appendVerts(t, a, u, f, _, d); + for (var b = a + this.colorOffset, C = 0; C < 4; C++) + c[b] = g, + b += A; + a += 4 * this.floatsPerVert + } + , + r.appendVerts = function(t, e, i, n, r, s) { + var a = this._local + , o = this.floatsPerVert; + a[e] = i, + a[e + 1] = r, + a[e += o] = n, + a[e + 1] = r, + a[e += o] = i, + a[e + 1] = s, + a[e += o] = n, + a[e + 1] = s + } + , + r.updateWorldVerts = function(t) { + for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], a = e[12], o = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < l.length; u += c) { + var _ = l[u] + , f = l[u + 1]; + h[u] = _ * i + f * r + a, + h[u + 1] = _ * n + f * s + o + } + } + , + n + } + )(r.default); + i.default = o, + e.exports = i.default + } + ), { + "../../../../utils/label/bmfont": 228 + }], + 238: [(function(t, e, i) { + "use strict"; + function n(t, e) { + return (n = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + i.__esModule = !0, + i.default = void 0, + t("../../../../../platform/js"), + t("./bmfont"); + var r = t("../../../../utils/label/letter-font") + , s = cc.color(255, 255, 255, 255) + , a = (function(t) { + var e, i; + function r() { + return t.apply(this, arguments) || this + } + i = t, + (e = r).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + n(e, i); + var a = r.prototype; + return a.createData = function(t) { + return t.requestRenderData() + } + , + a._getColor = function(t) { + return s._fastSetA(t.node._color.a), + s._val + } + , + a.updateColor = function(e) { + var i = this._getColor(e); + t.prototype.updateColor.call(this, e, i) + } + , + r + } + )(r); + i.default = a, + e.exports = i.default + } + ), { + "../../../../../platform/js": 214, + "../../../../utils/label/letter-font": 230, + "./bmfont": 237 + }], + 239: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../../../../assets/material/material-variant")) && n.__esModule ? n : { + default: n + }; + t("../../../../../components/CCLabel"), + t("../../../../../components/CCLabelShadow"), + t("../../../../../components/CCLabelOutline"), + t("../../../../../assets/material/CCMaterial"); + var s = (function() { + function t() {} + var e = t.prototype; + return e.init = function(t) { + this.labelMaterial = null, + this._label = this._renderComp = t, + renderer.CustomAssembler.prototype.ctor.call(this), + t.node._proxy.setAssembler(this), + this._layout = new jsb.LabelRenderer, + this._layout.init(t), + this._cfg = new DataView(this._layout._cfg), + this._layoutInfo = new DataView(this._layout._layout), + this._cfgFields = jsb.LabelRenderer._cfgFields, + this._layoutFields = jsb.LabelRenderer._layoutFields, + this._layout.bindNodeProxy(t.node._proxy), + this._bindMaterial(t) + } + , + e._setBufferFlag = function(t, e, i, n, r) { + if ("int8" == n && 1 == i) { + var s = t.getInt8(e); + t.setInt8(e, r | s) + } else if ("int32" == n && 4 == i) { + var a = t.getInt32(e, jsb.__isLittleEndian__); + t.setInt32(e, r | a, jsb.__isLittleEndian__) + } else + cc.warn("flag storage type should be int8/int32 only, type/size -> " + n + "/" + i + ".") + } + , + e._updateCfgFlag = function(t) { + var e = this._cfgFields.updateFlags; + this._setBufferFlag(this._cfg, e.offset, e.size, e.type, t) + } + , + e._setBufferValue = function(t, e, i, n, r) { + "float" == n && 4 == i ? t.setFloat32(e, r, jsb.__isLittleEndian__) : "int32" == n && 4 == i ? t.setInt32(e, r, jsb.__isLittleEndian__) : "bool" == n && 1 == i ? t.setInt8(e, r ? 1 : 0, jsb.__isLittleEndian__) : "Color4B" == n && 4 == i ? (t.setUint8(e, r.r), + t.setUint8(e + 1, r.g), + t.setUint8(e + 2, r.b), + t.setUint8(e + 3, r.a)) : "int8" == n && 1 == i ? t.setUint8(e, r) : cc.warn("dont know how to set value to buffer, type/size -> " + n + "/" + i + ".") + } + , + e._setFieldValue = function(t, e, i, n) { + var r = e[i]; + this._setBufferValue(t, r.offset, r.size, r.type, n) + } + , + e._getBufferValue = function(t, e, i, n) { + return "float" == n && 4 == i ? t.getFloat32(e, jsb.__isLittleEndian__) : "int32" == n && 4 == i ? t.getInt32(e, jsb.__isLittleEndian__) : "bool" == n && 1 == i ? 0 != t.getInt8(e, jsb.__isLittleEndian__) : "Color4B" == n && 4 == i ? { + r: t.getUint8(e), + g: t.getUint8(e + 1), + b: t.getUint8(e + 2), + a: t.getUint8(e + 3) + } : "int8" == n && 1 == i ? t.getUint8(e) : void cc.warn("dont know how to get value from buffer, type/size -> " + n + "/" + i + ".") + } + , + e._getFieldValue = function(t, e, i) { + var n = e[i]; + return this._getBufferValue(t, n.offset, n.size, n.type) + } + , + e._getLayoutValue = function(t) { + return this._getFieldValue(this._layoutInfo, this._layoutFields, t) + } + , + e._setLayoutValue = function(t, e) { + return this._setFieldValue(this._layoutInfo, this._layoutFields, t, e) + } + , + e._updateCfgFlag_Content = function() { + this._updateCfgFlag(1) + } + , + e._updateCfgFlag_Font = function() { + this._updateCfgFlag(2) + } + , + e._colorEqual = function(t, e) { + return t.r == e.r && t.g == e.g && t.b == e.b && t.a == e.a + } + , + e._colorToObj = function(t, e, i, n) { + return { + r: t, + g: e, + b: i, + a: n + } + } + , + e.setString = function(t) { + t != this._layout.string && (this._layout.string = t, + this._updateCfgFlag_Content()) + } + , + e.setFontPath = function(t) { + t != this._layout.fontPath && (this._layout.fontPath = t, + this._updateCfgFlag_Font()) + } + , + e.setFontSize = function(t, e) { + this._getFieldValue(this._cfg, this._cfgFields, "fontSize") != t && (this._setFieldValue(this._cfg, this._cfgFields, "fontSize", t), + this._setFieldValue(this._cfg, this._cfgFields, "fontSizeRetina", e), + this._updateCfgFlag_Font()) + } + , + e.setOutline = function(t) { + var e = this._getLayoutValue("outlineSize"); + e > 0 != t > 0 && this._updateCfgFlag_Font(), + e != t && (this._updateCfgFlag_Content(), + this._setLayoutValue("outlineSize", t)) + } + , + e.setOutlineColor = function(t) { + var e = this._getLayoutValue("outlineColor"); + this._colorEqual(e, t) || (this._setLayoutValue("outlineColor", t), + this._updateCfgFlag_Content()) + } + , + e.setLineHeight = function(t) { + this._getLayoutValue("lineHeight") != t && (this._setLayoutValue("lineHeight", t), + this._updateCfgFlag_Content()) + } + , + e.setOverFlow = function(t) { + this._getLayoutValue("overflow") != t && (this._setLayoutValue("overflow", t), + this._updateCfgFlag_Content()) + } + , + e.setEnableWrap = function(t) { + this._getLayoutValue("wrap") != t && (this._setLayoutValue("wrap", t), + this._updateCfgFlag_Content()) + } + , + e.setVerticalAlign = function(t) { + this._getLayoutValue("valign") != t && (this._setLayoutValue("valign", t), + this._updateCfgFlag_Content()) + } + , + e.setHorizontalAlign = function(t) { + this._getLayoutValue("halign") != t && (this._setLayoutValue("halign", t), + this._updateCfgFlag_Content()) + } + , + e.setContentSize = function(t, e) { + var i = this._getLayoutValue("width") + , n = this._getLayoutValue("height"); + i == t && n == e || (this._setLayoutValue("height", e), + this._setLayoutValue("width", t), + this._updateCfgFlag_Content()) + } + , + e.setAnchorPoint = function(t, e) { + var i = this._getLayoutValue("anchorX") + , n = this._getLayoutValue("anchorY"); + i == t && n == e || (this._setLayoutValue("anchorX", t), + this._setLayoutValue("anchorY", e), + this._updateCfgFlag_Content()) + } + , + e.setColor = function(t) { + var e = this._getLayoutValue("color"); + this._colorEqual(e, t) || (this._setLayoutValue("color", t), + this._updateCfgFlag_Content()) + } + , + e.setShadow = function(t, e, i) { + var n = this._getLayoutValue("shadowBlur") + , r = this._getLayoutValue("shadowX") + , s = this._getLayoutValue("shadowY"); + n > 0 != i > 0 && this._updateCfgFlag_Font(); + var a = !1; + n != i && (this._setLayoutValue("shadowBlur", i), + a = !0), + r != t && (this._setLayoutValue("shadowX", t), + a = !0), + s != e && (this._setLayoutValue("shadowY", e), + a = !0), + a && this._updateCfgFlag_Content() + } + , + e.setShadowColor = function(t) { + var e = this._getLayoutValue("shadowColor"); + this._colorEqual(e, t) || (this._setLayoutValue("shadowColor", t), + this._updateCfgFlag_Content()) + } + , + e.setItalic = function(t) { + this._getLayoutValue("italic") != t && (this._setLayoutValue("italic", t), + this._updateCfgFlag_Content()) + } + , + e.setBold = function(t) { + this._getLayoutValue("bold") != t && (this._setLayoutValue("bold", t), + this._updateCfgFlag_Content(), + this._updateCfgFlag_Font()) + } + , + e.setUnderline = function(t) { + this._getLayoutValue("underline") != t && (this._setLayoutValue("underline", t), + this._updateCfgFlag_Content()) + } + , + e.setSpacingX = function(t) { + this._getLayoutValue("spaceX") == t || "number" != typeof t || isNaN(t) || (this._setLayoutValue("spaceX", t), + this._updateCfgFlag_Content()) + } + , + e.updateRenderData = function(t) { + if (t._vertsDirty) { + t.font && t.font.nativeUrl && this.setFontPath(cc.assetManager.cacheManager.getCache(t.font.nativeUrl) || t.font.nativeUrl); + var e = this._layout + , i = t.node.color + , n = t.node + , r = t.fontSize; + this.setString(t.string), + this.setFontSize(t.fontSize, r / 72 * t.fontSize), + this.setLineHeight(t.lineHeight), + this.setEnableWrap(t.enableWrapText), + this.setItalic(t.enableItalic), + this.setUnderline(t.enableUnderline), + this.setBold(t.enableBold), + this.setOverFlow(t.overflow), + this.setVerticalAlign(t.verticalAlign), + this.setHorizontalAlign(t.horizontalAlign), + this.setSpacingX(t.spacingX), + this.setContentSize(n.getContentSize().width, n.getContentSize().height), + this.setAnchorPoint(n.anchorX, n.anchorY), + this.setColor(this._colorToObj(i.getR(), i.getG(), i.getB(), Math.ceil(i.getA() * n.opacity / 255))); + var s = n.getComponent(cc.LabelShadow); + if (s && s.enabled) { + var a = s.color; + this.setShadow(s.offset.x, s.offset.y, s.blur), + this.setShadowColor(this._colorToObj(a.getR(), a.getG(), a.getB(), Math.ceil(a.getA() * n.opacity / 255))) + } else + this.setShadow(0, 0, -1); + this._updateTTFMaterial(t), + e.render() + } + } + , + e._bindMaterial = function(t) { + var e = this.labelMaterial; + return e || (e = r.default.createWithBuiltin("2d-label", t), + this.labelMaterial = e), + e + } + , + e._updateTTFMaterial = function(t) { + var e = this._bindMaterial(t) + , i = this._label.node + , n = this._layout + , r = i.getComponent(cc.LabelOutline) + , s = 0; + if (r && r.enabled && r.width > 0) { + s = Math.max(Math.min(r.width / 10, .4), .1); + var a = r.color; + this.setOutlineColor(this._colorToObj(a.getR(), a.getG(), a.getB(), Math.ceil(a.getA() * i.opacity / 255))) + } + this.setOutline(s), + e.define("CC_USE_MODEL", !0), + e.define("USE_TEXTURE_ALPHAONLY", !0), + e.define("USE_SDF", s > 0 || t.enableBold), + e.define("USE_SDF_EXTEND", t.enableBold ? 1 : 0), + void 0 !== e.getDefine("CC_SUPPORT_standard_derivatives") && cc.sys.glExtension("OES_standard_derivatives") && e.define("CC_SUPPORT_standard_derivatives", !0), + n.setEffect(e.effect._nativeObj) + } + , + e.fillBuffers = function() { + this._layout.render() + } + , + e.getVfmt = function() {} + , + t + } + )(); + i.default = s, + e.exports = i.default + } + ), { + "../../../../../assets/material/CCMaterial": 80, + "../../../../../assets/material/material-variant": 87, + "../../../../../components/CCLabel": 107, + "../../../../../components/CCLabelOutline": 108, + "../../../../../components/CCLabelShadow": 109 + }], + 240: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../../../utils/label/ttf")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = t("../../../../../components/CCLabelShadow") + , o = cc.color(255, 255, 255, 255) + , l = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.updateUVs = function(t) { + for (var e = this._renderData.vDatas[0], i = t._frame.uv, n = this.uvOffset, r = this.floatsPerVert, s = 0; s < 4; s++) { + var a = 2 * s + , o = r * s + n; + e[o] = i[a], + e[o + 1] = i[a + 1] + } + } + , + r.updateColor = function(e) { + o._fastSetA(e.node._color.a); + var i = o._val; + t.prototype.updateColor.call(this, e, i) + } + , + r.updateVerts = function(t) { + var e = t.node + , i = t._ttfTexture.width + , n = t._ttfTexture.height + , r = e.anchorX * e.width + , s = e.anchorY * e.height + , o = a && t.getComponent(a); + if (o && o._enabled) { + var l = (i - e.width) / 2 + , h = (n - e.height) / 2 + , c = o.offset; + -c.x > l ? r += i - e.width : l > c.x && (r += l - c.x), + -c.y > h ? s += n - e.height : h > c.y && (s += h - c.y) + } + var u = this._local; + u[0] = -r, + u[1] = -s, + u[2] = i - r, + u[3] = n - s, + this.updateUVs(t), + this.updateWorldVerts(t) + } + , + n + } + )(r.default); + i.default = l, + e.exports = i.default + } + ), { + "../../../../../components/CCLabelShadow": 109, + "../../../../utils/label/ttf": 231 + }], + 241: [(function(t) { + "use strict"; + var e = h(t("../../../assembler")) + , i = h(t("../../../../components/CCLabel")) + , n = h(t("./2d/ttf")) + , r = h(t("./2d/bmfont")) + , s = h(t("./2d/letter")) + , a = h(t("./3d/ttf")) + , o = h(t("./3d/bmfont")) + , l = h(t("./3d/letter")); + function h(t) { + return t && t.__esModule ? t : { + default: t + } + } + i.default._canvasPool = { + pool: [], + get: function() { + var t = this.pool.pop(); + if (!t) { + var e = document.createElement("canvas") + , i = e.getContext("2d"); + t = { + canvas: e, + context: i + }, + i.textBaseline = "alphabetic" + } + return t + }, + put: function(t) { + this.pool.length >= 32 || this.pool.push(t) + } + }, + e.default.register(cc.Label, { + getConstructor: function(t) { + var e = t.node.is3DNode + , h = e ? a.default : n.default; + return t.font instanceof cc.BitmapFont ? h = e ? o.default : r.default : t.cacheMode === i.default.CacheMode.CHAR && (cc.sys.platform === cc.sys.WECHAT_GAME_SUB ? cc.warn("sorry, subdomain does not support CHAR mode currently!") : h = e ? l.default : s.default), + h + }, + TTF: n.default, + Bmfont: r.default, + Letter: s.default, + TTF3D: a.default, + Bmfont3D: o.default, + Letter3D: l.default, + NativeTTF: void 0 + }) + } + ), { + "../../../../components/CCLabel": 107, + "../../../assembler": 221, + "./2d/bmfont": 237, + "./2d/letter": 238, + "./2d/nativeTTF": 239, + "./2d/ttf": 240, + "./3d/bmfont": void 0, + "./3d/letter": void 0, + "./3d/ttf": void 0 + }], + 242: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.MaskAssembler = void 0; + var n, r = (n = t("../../assembler")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = t("../../../components/CCMask") + , o = t("../../render-flow") + , l = t("./sprite/2d/simple") + , h = t("./graphics") + , c = t("../../../../renderer/gfx") + , u = t("../vertex-format").vfmtPos + , _ = 8 + , f = []; + function d() { + return 1 << f.length - 1 + } + function p() { + for (var t = 0, e = 0; e < f.length; ++e) + t += 1 << e; + return t + } + function m(t, e, i, n, r, s) { + var a = t.effect + , o = c.STENCIL_OP_KEEP + , l = c.STENCIL_OP_KEEP; + a.setStencil(c.STENCIL_ENABLE, e, n, r, i, o, l, s) + } + function y(t) { + f.length + 1 > _ && cc.errorID(9e3, _), + f.push(t) + } + function v(t, e) { + 0 === f.length && cc.errorID(9001), + f.pop(), + 0 === f.length ? e._flushMaterial(t._exitMaterial) : x(e) + } + function g(t, e) { + var i = c.DS_FUNC_NEVER + , n = d() + , r = n + , s = n + , a = t.inverted ? c.STENCIL_OP_REPLACE : c.STENCIL_OP_ZERO; + m(t._clearMaterial, i, a, n, r, s); + var o = e.getBuffer("mesh", u) + , l = o.request(4, 6) + , h = l.indiceOffset + , _ = l.byteOffset >> 2 + , f = l.vertexOffset + , p = o._vData + , y = o._iData; + p[_++] = -1, + p[_++] = -1, + p[_++] = -1, + p[_++] = 1, + p[_++] = 1, + p[_++] = 1, + p[_++] = 1, + p[_++] = -1, + y[h++] = f, + y[h++] = f + 3, + y[h++] = f + 1, + y[h++] = f + 1, + y[h++] = f + 3, + y[h++] = f + 2, + e.node = e._dummyNode, + e.material = t._clearMaterial, + e._flush() + } + function A(t, e) { + var i = c.DS_FUNC_NEVER + , n = d() + , r = n + , s = n + , o = t.inverted ? c.STENCIL_OP_ZERO : c.STENCIL_OP_REPLACE; + m(t._materials[0], i, o, n, r, s), + e.material = t._materials[0], + t._type === a.Type.IMAGE_STENCIL ? (e.node = e._dummyNode, + l.prototype.fillBuffers.call(t._assembler, t, e), + e._flush()) : (e.node = t.node, + h.prototype.fillBuffers.call(t._graphics._assembler, t._graphics, e)) + } + function x(t) { + var e = c.DS_FUNC_EQUAL + , i = c.STENCIL_OP_KEEP + , n = p() + , r = n + , s = d() + , a = f[f.length - 1]; + m(a._enableMaterial, e, i, n, r, s), + t._flushMaterial(a._enableMaterial) + } + var b = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.updateRenderData = function(t) { + t._type === a.Type.IMAGE_STENCIL ? t.spriteFrame ? l.prototype.updateRenderData.call(this, t) : t.setMaterial(0, null) : (t._graphics.setMaterial(0, t._materials[0]), + h.prototype.updateRenderData.call(t._graphics._assembler, t._graphics, t._graphics)) + } + , + r.fillBuffers = function(t, e) { + (t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) && (y(t), + g(t, e), + A(t, e), + x(e)), + t.node._renderFlag |= o.FLAG_UPDATE_RENDER_DATA + } + , + r.postFillBuffers = function(t, e) { + (t._type !== a.Type.IMAGE_STENCIL || t.spriteFrame) && v(t, e), + t.node._renderFlag |= o.FLAG_UPDATE_RENDER_DATA + } + , + n + } + )(l); + i.MaskAssembler = b, + r.default.register(a, b) + } + ), { + "../../../../renderer/gfx": 315, + "../../../components/CCMask": 111, + "../../assembler": 221, + "../../render-flow": 225, + "../vertex-format": 256, + "./graphics": 235, + "./sprite/2d/simple": 246 + }], + 243: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../../../assembler-2d")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = t("../../../../../components/CCSprite").FillType + , o = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.updateRenderData = function(t) { + var e = t._spriteFrame; + if (this.packToDynamicAtlas(t, e), + t._vertsDirty) { + var i = t._fillStart + , n = t._fillRange; + n < 0 && (i += n, + n = -n), + n = (n = (n = i + n) > 1 ? 1 : n) < 0 ? 0 : n; + var r = (i = (i = i > 1 ? 1 : i) < 0 ? 0 : i) + (n = (n -= i) < 0 ? 0 : n); + r = r > 1 ? 1 : r, + this.updateUVs(t, i, r), + this.updateVerts(t, i, r), + t._vertsDirty = !1 + } + } + , + r.updateUVs = function(t, e, i) { + var n, r, s, o, l, h, c, u, _, f, d = t._spriteFrame, p = d._texture.width, m = d._texture.height, y = d._rect; + d._rotated ? (n = y.x / p, + r = (y.y + y.width) / m, + s = l = n, + c = _ = (y.x + y.height) / p, + h = f = r, + o = u = y.y / m) : (n = y.x / p, + r = (y.y + y.height) / m, + s = c = n, + l = _ = (y.x + y.width) / p, + o = h = r, + u = f = y.y / m); + var v = this._renderData.vDatas[0] + , g = this.uvOffset + , A = this.floatsPerVert; + switch (t._fillType) { + case a.HORIZONTAL: + v[g] = s + (l - s) * e, + v[g + 1] = o + (h - o) * e, + v[g + A] = s + (l - s) * i, + v[g + A + 1] = o + (h - o) * i, + v[g + 2 * A] = c + (_ - c) * e, + v[g + 2 * A + 1] = u + (f - u) * e, + v[g + 3 * A] = c + (_ - c) * i, + v[g + 3 * A + 1] = u + (f - u) * i; + break; + case a.VERTICAL: + v[g] = s + (c - s) * e, + v[g + 1] = o + (u - o) * e, + v[g + A] = l + (_ - l) * e, + v[g + A + 1] = h + (f - h) * e, + v[g + 2 * A] = s + (c - s) * i, + v[g + 2 * A + 1] = o + (u - o) * i, + v[g + 3 * A] = l + (_ - l) * i, + v[g + 3 * A + 1] = h + (f - h) * i; + break; + default: + cc.errorID(2626) + } + } + , + r.updateVerts = function(t, e, i) { + var n, r = t.node, s = r.width, o = r.height, l = r.anchorX * s, h = r.anchorY * o, c = -l, u = -h, _ = s - l, f = o - h; + switch (t._fillType) { + case a.HORIZONTAL: + n = c + (_ - c) * i, + c += (_ - c) * e, + _ = n; + break; + case a.VERTICAL: + n = u + (f - u) * i, + u += (f - u) * e, + f = n; + break; + default: + cc.errorID(2626) + } + var d = this._local; + d[0] = c, + d[1] = u, + d[2] = _, + d[3] = f, + this.updateWorldVerts(t) + } + , + n + } + )(r.default); + i.default = o, + e.exports = i.default + } + ), { + "../../../../../components/CCSprite": 120, + "../../../../assembler-2d": 219 + }], + 244: [(function(t, e, i) { + "use strict"; + var n; + function r(t, e) { + return (r = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + i.__esModule = !0, + i.default = void 0; + var s = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + r(e, i); + var s = n.prototype; + return s.initData = function() { + this._renderData.createFlexData(0, 4, 6, this.getVfmt()) + } + , + s.updateRenderData = function(t) { + this.packToDynamicAtlas(t, t._spriteFrame); + var e = t.spriteFrame; + if (e) { + var i = e.vertices; + if (i) { + this.verticesCount = i.x.length, + this.indicesCount = i.triangles.length; + var n = this._renderData._flexBuffer; + n.reserve(this.verticesCount, this.indicesCount) && (this.updateColor(t), + t._vertsDirty = !0), + n.used(this.verticesCount, this.indicesCount), + this.updateIndices(i.triangles), + t._vertsDirty && (this.updateUVs(t), + this.updateVerts(t), + this.updateWorldVerts(t), + t._vertsDirty = !1) + } + } + } + , + s.updateIndices = function(t) { + this._renderData.iDatas[0].set(t) + } + , + s.updateUVs = function(t) { + for (var e = t.spriteFrame.vertices, i = e.nu, n = e.nv, r = this.uvOffset, s = this.floatsPerVert, a = this._renderData.vDatas[0], o = 0; o < i.length; o++) { + var l = s * o + r; + a[l] = i[o], + a[l + 1] = n[o] + } + } + , + s.updateVerts = function(t) { + var e = t.node + , i = Math.abs(e.width) + , n = Math.abs(e.height) + , r = e.anchorX * i + , s = e.anchorY * n + , a = t.spriteFrame + , o = a.vertices + , l = o.x + , h = o.y + , c = a._originalSize.width + , u = a._originalSize.height + , _ = a._rect.width + , f = a._rect.height + , d = a._offset.x + (c - _) / 2 + , p = a._offset.y + (u - f) / 2 + , m = i / (t.trim ? _ : c) + , y = n / (t.trim ? f : u) + , v = this._local; + if (t.trim) + for (var g = 0, A = l.length; g < A; g++) { + var x = 2 * g; + v[x] = (l[g] - d) * m - r, + v[x + 1] = (u - h[g] - p) * y - s + } + else + for (var b = 0, C = l.length; b < C; b++) { + var T = 2 * b; + v[T] = l[b] * m - r, + v[T + 1] = (u - h[b]) * y - s + } + if (a._flipX) + for (var S = 0, w = this.verticesCount; S < w; S++) + v[2 * S] = i - v[2 * S] - 2 * r; + if (a._flipY) + for (var E = 0, M = this.verticesCount; E < M; E++) + v[2 * E + 1] = n - v[2 * E + 1] - 2 * s + } + , + s.updateWorldVerts = function(t) { + for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], a = e[12], o = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0, _ = this.verticesCount; u < _; u++) { + var f = l[2 * u] + , d = l[2 * u + 1]; + h[c * u] = f * i + d * r + a, + h[c * u + 1] = f * n + d * s + o + } + } + , + n + } + )(((n = t("../../../../assembler-2d")) && n.__esModule ? n : { + default: n + }).default); + i.default = s, + e.exports = i.default + } + ), { + "../../../../assembler-2d": 219 + }], + 245: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../../../assembler-2d")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = 2 * Math.PI + , o = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)] + , l = [0, 0, 0, 0] + , h = [0, 0, 0, 0, 0, 0, 0, 0] + , c = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)] + , u = [cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0), cc.v2(0, 0)] + , _ = cc.v2(0, 0) + , f = []; + function d(t, e, i, n, r, s, a) { + var o, l, h = Math.sin(s), c = Math.cos(s); + if (0 !== Math.cos(s)) { + if (o = h / c, + (t - r.x) * c > 0) { + var u = r.y + o * (t - r.x); + a[0].x = t, + a[0].y = u + } + if ((e - r.x) * c > 0) { + var _ = r.y + o * (e - r.x); + a[2].x = e, + a[2].y = _ + } + } + if (0 !== Math.sin(s)) { + if (l = c / h, + (n - r.y) * h > 0) { + var f = r.x + l * (n - r.y); + a[3].x = f, + a[3].y = n + } + if ((i - r.y) * h > 0) { + var d = r.x + l * (i - r.y); + a[1].x = d, + a[1].y = i + } + } + } + function p(t) { + var e = t.node + , i = e.width + , n = e.height + , r = e.anchorX * i + , s = e.anchorY * n + , a = -r + , h = -s + , c = i - r + , u = n - s + , d = l; + d[0] = a, + d[1] = h, + d[2] = c, + d[3] = u; + var p = t._fillCenter + , m = _.x = Math.min(Math.max(0, p.x), 1) * (c - a) + a + , y = _.y = Math.min(Math.max(0, p.y), 1) * (u - h) + h; + o[0].x = o[3].x = a, + o[1].x = o[2].x = c, + o[0].y = o[1].y = h, + o[2].y = o[3].y = u, + f.length = 0, + m !== d[0] && (f[0] = [3, 0]), + m !== d[2] && (f[2] = [1, 2]), + y !== d[1] && (f[1] = [0, 1]), + y !== d[3] && (f[3] = [2, 3]) + } + function m(t, e) { + var i, n; + if (i = e.x - t.x, + n = e.y - t.y, + 0 !== i || 0 !== n) { + if (0 === i) + return n > 0 ? .5 * Math.PI : 1.5 * Math.PI; + var r = Math.atan(n / i); + return i < 0 && (r += Math.PI), + r + } + } + var y = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.initData = function() { + this._renderData.createFlexData(0, 4, 6, this.getVfmt()), + this.updateIndices() + } + , + r.updateRenderData = function(e) { + t.prototype.updateRenderData.call(this, e); + var i, n, r, s, o, f, m, y, v, g = e.spriteFrame; + if (this.packToDynamicAtlas(e, g), + e._vertsDirty) { + var A = e._fillStart + , x = e._fillRange; + for (x < 0 && (A += x, + x = -x); A >= 1; ) + A -= 1; + for (; A < 0; ) + A += 1; + A *= a, + x *= a, + p(e), + f = (i = g)._texture.width, + m = i._texture.height, + y = i._rect, + v = h, + i._rotated ? (n = y.x / f, + r = (y.x + y.height) / f, + s = y.y / m, + o = (y.y + y.width) / m, + v[0] = v[2] = n, + v[4] = v[6] = r, + v[3] = v[7] = o, + v[1] = v[5] = s) : (n = y.x / f, + r = (y.x + y.width) / f, + s = y.y / m, + o = (y.y + y.height) / m, + v[0] = v[4] = n, + v[2] = v[6] = r, + v[1] = v[3] = o, + v[5] = v[7] = s), + d(l[0], l[2], l[1], l[3], _, A, c), + d(l[0], l[2], l[1], l[3], _, A + x, u), + this.updateVerts(e, A, x), + e._vertsDirty = !1 + } + } + , + r.updateVerts = function(t, e, i) { + var n = e + i + , r = this._local; + r.length = 0; + for (var s = 0, l = 3 * this.floatsPerVert, h = 0; h < 4; ++h) { + var d = f[h]; + if (d) + if (i >= a) + r.length = s + l, + this._generateTriangle(r, s, _, o[d[0]], o[d[1]]), + s += l; + else { + var p = m(_, o[d[0]]) + , y = m(_, o[d[1]]); + y < p && (y += a), + p -= a, + y -= a; + for (var v = 0; v < 3; ++v) + p >= n || (p >= e ? (r.length = s + l, + y >= n ? this._generateTriangle(r, s, _, o[d[0]], u[h]) : this._generateTriangle(r, s, _, o[d[0]], o[d[1]]), + s += l) : y <= e || (y <= n ? (r.length = s + l, + this._generateTriangle(r, s, _, c[h], o[d[1]]), + s += l) : (r.length = s + l, + this._generateTriangle(r, s, _, c[h], u[h]), + s += l))), + p += a, + y += a + } + } + this.allocWorldVerts(t), + this.updateWorldVerts(t) + } + , + r.allocWorldVerts = function(t) { + var e = t.node._color._val + , i = this._renderData + , n = this.floatsPerVert + , r = this._local + , s = r.length / n; + this.verticesCount = this.indicesCount = s; + var a = i._flexBuffer; + a.reserve(s, s) && this.updateIndices(), + a.used(this.verticesCount, this.indicesCount); + for (var o = i.vDatas[0], l = i.uintVDatas[0], h = this.uvOffset, c = 0; c < r.length; c += n) { + var u = c + h; + o[u] = r[u], + o[u + 1] = r[u + 1], + l[u + 2] = e + } + } + , + r.updateIndices = function() { + for (var t = this._renderData.iDatas[0], e = 0; e < t.length; e++) + t[e] = e + } + , + r.updateWorldVerts = function(t) { + for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], a = e[12], o = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < l.length; u += c) { + var _ = l[u] + , f = l[u + 1]; + h[u] = _ * i + f * r + a, + h[u + 1] = _ * n + f * s + o + } + } + , + r._generateTriangle = function(t, e, i, n, r) { + var s = l + , a = s[0] + , o = s[1] + , h = s[2] + , c = s[3] + , u = this.floatsPerVert; + t[e] = i.x, + t[e + 1] = i.y, + t[e + u] = n.x, + t[e + u + 1] = n.y, + t[e + 2 * u] = r.x, + t[e + 2 * u + 1] = r.y; + var _, f, d = this.uvOffset; + _ = (i.x - a) / (h - a), + f = (i.y - o) / (c - o), + this._generateUV(_, f, t, e + d), + _ = (n.x - a) / (h - a), + f = (n.y - o) / (c - o), + this._generateUV(_, f, t, e + u + d), + _ = (r.x - a) / (h - a), + f = (r.y - o) / (c - o), + this._generateUV(_, f, t, e + 2 * u + d) + } + , + r._generateUV = function(t, e, i, n) { + var r = h[0] + (h[2] - h[0]) * t + , s = h[4] + (h[6] - h[4]) * t + , a = h[1] + (h[3] - h[1]) * t + , o = h[5] + (h[7] - h[5]) * t; + i[n] = r + (s - r) * e, + i[n + 1] = a + (o - a) * e + } + , + n + } + )(r.default); + i.default = y, + e.exports = i.default + } + ), { + "../../../../assembler-2d": 219 + }], + 246: [(function(t, e, i) { + "use strict"; + var n; + function r(t, e) { + return (r = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + i.__esModule = !0, + i.default = void 0; + var s = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + r(e, i); + var s = n.prototype; + return s.updateRenderData = function(t) { + this.packToDynamicAtlas(t, t._spriteFrame), + t._vertsDirty && (this.updateUVs(t), + this.updateVerts(t), + t._vertsDirty = !1) + } + , + s.updateUVs = function(t) { + for (var e = t._spriteFrame.uv, i = this.uvOffset, n = this.floatsPerVert, r = this._renderData.vDatas[0], s = 0; s < 4; s++) { + var a = 2 * s + , o = n * s + i; + r[o] = e[a], + r[o + 1] = e[a + 1] + } + } + , + s.updateVerts = function(t) { + var e, i, n, r, s = t.node, a = s.width, o = s.height, l = s.anchorX * a, h = s.anchorY * o; + if (t.trim) + e = -l, + i = -h, + n = a - l, + r = o - h; + else { + var c = t.spriteFrame + , u = c._originalSize.width + , _ = c._originalSize.height + , f = c._rect.width + , d = c._rect.height + , p = c._offset + , m = a / u + , y = o / _ + , v = p.x + (u - f) / 2 + , g = p.x - (u - f) / 2; + e = v * m - l, + i = (p.y + (_ - d) / 2) * y - h, + n = a + g * m - l, + r = o + (p.y - (_ - d) / 2) * y - h + } + var A = this._local; + A[0] = e, + A[1] = i, + A[2] = n, + A[3] = r, + this.updateWorldVerts(t) + } + , + n + } + )(((n = t("../../../../assembler-2d")) && n.__esModule ? n : { + default: n + }).default); + i.default = s, + e.exports = i.default + } + ), { + "../../../../assembler-2d": 219 + }], + 247: [(function(t, e, i) { + "use strict"; + var n; + function r(t, e) { + return (r = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + i.__esModule = !0, + i.default = void 0; + var s = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + r(e, i); + var s = n.prototype; + return s.initData = function() { + if (!(this._renderData.meshCount > 0)) { + this._renderData.createData(0, this.verticesFloats, this.indicesCount); + for (var t = this._renderData.iDatas[0], e = 0, i = 0; i < 3; ++i) + for (var n = 0; n < 3; ++n) { + var r = 4 * i + n; + t[e++] = r, + t[e++] = r + 1, + t[e++] = r + 4, + t[e++] = r + 1, + t[e++] = r + 5, + t[e++] = r + 4 + } + } + } + , + s.initLocal = function() { + this._local = [], + this._local.length = 8 + } + , + s.updateRenderData = function(t) { + var e = t._spriteFrame; + this.packToDynamicAtlas(t, e), + t._vertsDirty && (this.updateUVs(t), + this.updateVerts(t), + t._vertsDirty = !1) + } + , + s.updateVerts = function(t) { + var e = t.node + , i = e.width + , n = e.height + , r = e.anchorX * i + , s = e.anchorY * n + , a = t.spriteFrame + , o = a.insetLeft + , l = a.insetRight + , h = a.insetTop + , c = a.insetBottom + , u = i - o - l + , _ = n - h - c + , f = i / (o + l) + , d = n / (h + c); + f = isNaN(f) || f > 1 ? 1 : f, + d = isNaN(d) || d > 1 ? 1 : d, + u = u < 0 ? 0 : u, + _ = _ < 0 ? 0 : _; + var p = this._local; + p[0] = -r, + p[1] = -s, + p[2] = o * f - r, + p[3] = c * d - s, + p[4] = p[2] + u, + p[5] = p[3] + _, + p[6] = i - r, + p[7] = n - s, + this.updateWorldVerts(t) + } + , + s.updateUVs = function(t) { + for (var e = this._renderData.vDatas[0], i = t.spriteFrame.uvSliced, n = this.uvOffset, r = this.floatsPerVert, s = 0; s < 4; ++s) + for (var a = 0; a < 4; ++a) { + var o = 4 * s + a + , l = i[o] + , h = o * r; + e[h + n] = l.u, + e[h + n + 1] = l.v + } + } + , + s.updateWorldVerts = function(t) { + for (var e = t.node._worldMatrix.m, i = e[0], n = e[1], r = e[4], s = e[5], a = e[12], o = e[13], l = this._local, h = this._renderData.vDatas[0], c = this.floatsPerVert, u = 0; u < 4; ++u) + for (var _ = l[2 * u + 1], f = 0; f < 4; ++f) { + var d = l[2 * f] + , p = (4 * u + f) * c; + h[p] = d * i + _ * r + a, + h[p + 1] = d * n + _ * s + o + } + } + , + n + } + )(((n = t("../../../../assembler-2d")) && n.__esModule ? n : { + default: n + }).default); + i.default = s, + Object.assign(s.prototype, { + verticesCount: 16, + indicesCount: 54 + }), + e.exports = i.default + } + ), { + "../../../../assembler-2d": 219 + }], + 248: [(function(t, e, i) { + "use strict"; + var n; + function r(t, e) { + return (r = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + i.__esModule = !0, + i.default = void 0; + var s = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + r(e, i); + var s = n.prototype; + return s.initData = function() { + this.verticesCount = 0, + this.contentWidth = 0, + this.contentHeight = 0, + this.rectWidth = 0, + this.rectHeight = 0, + this.hRepeat = 0, + this.vRepeat = 0, + this.row = 0, + this.col = 0, + this._renderData.createFlexData(0, 4, 6, this.getVfmt()), + this._updateIndices() + } + , + s.initLocal = function() { + this._local = { + x: [], + y: [] + } + } + , + s._updateIndices = function() { + for (var t = this._renderData.iDatas[0], e = 0, i = 0, n = t.length; e < n; e += 6, + i += 4) + t[e] = i, + t[e + 1] = i + 1, + t[e + 2] = i + 2, + t[e + 3] = i + 1, + t[e + 4] = i + 3, + t[e + 5] = i + 2 + } + , + s.updateRenderData = function(t) { + var e = t._spriteFrame; + this.packToDynamicAtlas(t, e); + var i = t.node + , n = this.contentWidth = Math.abs(i.width) + , r = this.contentHeight = Math.abs(i.height) + , s = e._rect + , a = e.insetLeft + , o = e.insetRight + , l = s.width - a - o + , h = e.insetTop + , c = e.insetBottom + , u = s.height - h - c; + this.sizableWidth = n - a - o, + this.sizableHeight = r - h - c, + this.sizableWidth = this.sizableWidth > 0 ? this.sizableWidth : 0, + this.sizableHeight = this.sizableHeight > 0 ? this.sizableHeight : 0; + var _ = this.hRepeat = 0 === l ? this.sizableWidth : this.sizableWidth / l + , f = this.vRepeat = 0 === u ? this.sizableHeight : this.sizableHeight / u + , d = (this.row = Math.ceil(f + 2)) * (this.col = Math.ceil(_ + 2)); + this.verticesCount = 4 * d, + this.indicesCount = 6 * d; + var p = this._renderData._flexBuffer; + p.reserve(this.verticesCount, this.indicesCount) && (this._updateIndices(), + this.updateColor(t)), + p.used(this.verticesCount, this.indicesCount), + t._vertsDirty && (this.updateUVs(t), + this.updateVerts(t), + t._vertsDirty = !1) + } + , + s.updateVerts = function(t) { + var e = t._spriteFrame + , i = e._rect + , n = t.node + , r = n.anchorX * n.width + , s = n.anchorY * n.height + , a = this.row + , o = this.col + , l = this.contentWidth + , h = this.contentHeight + , c = this._local + , u = c.x + , _ = c.y; + u.length = _.length = 0; + var f, d, p = e.insetLeft, m = e.insetRight, y = i.width - p - m, v = e.insetTop, g = e.insetBottom, A = i.height - v - g, x = n.width / (p + m) > 1 ? 1 : n.width / (p + m), b = n.height / (v + g) > 1 ? 1 : n.height / (v + g); + f = y > 0 ? Math.floor(1e3 * this.sizableWidth) / 1e3 % y == 0 ? y : this.sizableWidth % y : this.sizableWidth, + d = A > 0 ? Math.floor(1e3 * this.sizableHeight) / 1e3 % A == 0 ? A : this.sizableHeight % A : this.sizableHeight; + for (var C = 0; C <= o; C++) + 0 === C ? u[C] = -r : C > 0 && C < o ? u[C] = 1 === C ? p * x + Math.min(y, this.sizableWidth) - r : y > 0 ? C === o - 1 ? p + f + y * (C - 2) - r : p + Math.min(y, this.sizableWidth) + y * (C - 2) - r : p + this.sizableWidth - r : C === o && (u[C] = Math.min(p + this.sizableWidth + m, l) - r); + for (var T = 0; T <= a; T++) + 0 === T ? _[T] = -s : T > 0 && T < a ? _[T] = 1 === T ? g * b + Math.min(A, this.sizableHeight) - s : A > 0 ? T === a - 1 ? g + d + (T - 2) * A - s : g + Math.min(A, this.sizableHeight) + (T - 2) * A - s : g + this.sizableHeight - s : T === a && (_[T] = Math.min(g + this.sizableHeight + v, h) - s); + this.updateWorldVerts(t) + } + , + s.updateWorldVerts = function(t) { + for (var e, i, n, r, s = this._renderData, a = this._local, o = a.x, l = a.y, h = s.vDatas[0], c = this.row, u = this.col, _ = t.node._worldMatrix.m, f = _[0], d = _[1], p = _[4], m = _[5], y = _[12], v = _[13], g = this.floatsPerVert, A = 0, x = 0, b = c; x < b; ++x) { + n = l[x], + r = l[x + 1]; + for (var C = 0, T = u; C < T; ++C) + e = o[C], + i = o[C + 1], + h[A] = e * f + n * p + y, + h[A + 1] = e * d + n * m + v, + h[A += g] = i * f + n * p + y, + h[A + 1] = i * d + n * m + v, + h[A += g] = e * f + r * p + y, + h[A + 1] = e * d + r * m + v, + h[A += g] = i * f + r * p + y, + h[A + 1] = i * d + r * m + v, + A += g + } + } + , + s.updateUVs = function(t) { + var e = this._renderData.vDatas[0]; + if (e) + for (var i = t._spriteFrame, n = i._rect, r = i.insetLeft, s = i.insetRight, a = n.width - r - s, o = i.insetTop, l = i.insetBottom, h = n.height - o - l, c = this.row, u = this.col, _ = this.hRepeat, f = this.vRepeat, d = 0, p = 0, m = t.spriteFrame.uv, y = t.spriteFrame.uvSliced, v = t.spriteFrame._rotated, g = this.floatsPerVert, A = this.uvOffset, x = [], b = [], C = 0, T = c; C < T; ++C) { + p = this.sizableHeight > h ? this.sizableHeight >= C * h ? 1 : f % 1 : f; + for (var S = 0, w = u; S < w; ++S) + d = this.sizableWidth > a ? this.sizableWidth >= S * a ? 1 : _ % 1 : _, + v ? (0 === C ? (x[0] = y[0].u, + x[1] = y[0].u, + x[2] = y[4].u + (y[8].u - y[4].u) * p) : C < c - 1 ? (x[0] = y[4].u, + x[1] = y[4].u, + x[2] = y[4].u + (y[8].u - y[4].u) * p) : C === c - 1 && (x[0] = y[8].u, + x[1] = y[8].u, + x[2] = y[12].u), + 0 === S ? (b[0] = y[0].v, + b[1] = y[1].v + (y[2].v - y[1].v) * d, + b[2] = y[0].v) : S < u - 1 ? (b[0] = y[1].v, + b[1] = y[1].v + (y[2].v - y[1].v) * d, + b[2] = y[1].v) : S === u - 1 && (b[0] = y[2].v, + b[1] = y[3].v, + b[2] = y[2].v), + x[3] = x[2], + b[3] = b[1]) : (0 === S ? (x[0] = y[0].u, + x[1] = y[1].u + (y[2].u - y[1].u) * d, + x[2] = m[0]) : S < u - 1 ? (x[0] = y[1].u, + x[1] = y[1].u + (y[2].u - y[1].u) * d, + x[2] = y[1].u) : S === u - 1 && (x[0] = y[2].u, + x[1] = y[3].u, + x[2] = y[2].u), + 0 === C ? (b[0] = y[0].v, + b[1] = y[0].v, + b[2] = y[4].v + (y[8].v - y[4].v) * p) : C < c - 1 ? (b[0] = y[4].v, + b[1] = y[4].v, + b[2] = y[4].v + (y[8].v - y[4].v) * p) : C === c - 1 && (b[0] = y[8].v, + b[1] = y[8].v, + b[2] = y[12].v), + x[3] = x[1], + b[3] = b[2]), + e[A] = x[0], + e[A + 1] = b[0], + e[A += g] = x[1], + e[A + 1] = b[1], + e[A += g] = x[2], + e[A + 1] = b[2], + e[A += g] = x[3], + e[A + 1] = b[3], + A += g + } + } + , + n + } + )(((n = t("../../../../assembler-2d")) && n.__esModule ? n : { + default: n + }).default); + i.default = s, + e.exports = i.default + } + ), { + "../../../../assembler-2d": 219 + }], + 249: [(function(t) { + "use strict"; + var e = p(t("../../../assembler")) + , i = t("../../../../components/CCSprite") + , n = p(t("./2d/simple")) + , r = p(t("./2d/sliced")) + , s = p(t("./2d/tiled")) + , a = p(t("./2d/radial-filled")) + , o = p(t("./2d/bar-filled")) + , l = p(t("./2d/mesh")) + , h = p(t("./3d/simple")) + , c = p(t("./3d/sliced")) + , u = p(t("./3d/tiled")) + , _ = p(t("./3d/radial-filled")) + , f = p(t("./3d/bar-filled")) + , d = p(t("./3d/mesh")); + function p(t) { + return t && t.__esModule ? t : { + default: t + } + } + var m = { + getConstructor: function(t) { + var e = t.node.is3DNode + , p = e ? h.default : n.default; + switch (t.type) { + case i.Type.SLICED: + p = e ? c.default : r.default; + break; + case i.Type.TILED: + p = e ? u.default : s.default; + break; + case i.Type.FILLED: + p = t._fillType === i.FillType.RADIAL ? e ? _.default : a.default : e ? f.default : o.default; + break; + case i.Type.MESH: + p = e ? d.default : l.default + } + return p + }, + Simple: n.default, + Sliced: r.default, + Tiled: s.default, + RadialFilled: a.default, + BarFilled: o.default, + Mesh: l.default, + Simple3D: h.default, + Sliced3D: c.default, + Tiled3D: u.default, + RadialFilled3D: _.default, + BarFilled3D: f.default, + Mesh3D: d.default + }; + e.default.register(cc.Sprite, m) + } + ), { + "../../../../components/CCSprite": 120, + "../../../assembler": 221, + "./2d/bar-filled": 243, + "./2d/mesh": 244, + "./2d/radial-filled": 245, + "./2d/simple": 246, + "./2d/sliced": 247, + "./2d/tiled": 248, + "./3d/bar-filled": void 0, + "./3d/mesh": void 0, + "./3d/radial-filled": void 0, + "./3d/simple": void 0, + "./3d/sliced": void 0, + "./3d/tiled": void 0 + }], + 250: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = (function() { + function t(t, e, i, n, r) { + this._handler = t, + this._index = e, + this._vfmt = r, + this._verticesBytes = r._bytes, + this._initVerticesCount = i, + this._initIndicesCount = n, + this.reset() + } + var e = t.prototype; + return e._reallocVData = function(t, e) { + this.vData = new Float32Array(t), + this.uintVData = new Uint32Array(this.vData.buffer), + e && this.vData.set(e), + this._handler.updateMesh(this._index, this.vData, this.iData) + } + , + e._reallocIData = function(t, e) { + this.iData = new Uint16Array(t), + e && this.iData.set(e), + this._handler.updateMesh(this._index, this.vData, this.iData) + } + , + e.reserve = function(t, e) { + var i = t * this._verticesBytes >> 2 + , n = this.vData.length + , r = !1; + if (i > n) { + for (; n < i; ) + n *= 2; + this._reallocVData(n, this.vData), + r = !0 + } + var s = this.iData.length; + if (e > s) { + for (; s < e; ) + s *= 2; + this._reallocIData(e, this.iData), + r = !0 + } + return r + } + , + e.used = function(t, e) { + this.usedVertices = t, + this.usedIndices = e, + this.usedVerticesFloats = t * this._verticesBytes >> 2, + this._handler.updateMeshRange(t, e) + } + , + e.reset = function() { + var t = this._initVerticesCount * this._verticesBytes >> 2; + this._reallocVData(t), + this._reallocIData(this._initIndicesCount), + this.usedVertices = 0, + this.usedVerticesFloats = 0, + this.usedIndices = 0 + } + , + t + } + )(); + i.default = n, + cc.FlexBuffer = n, + e.exports = i.default + } + ), {}], + 251: [(function(t, e) { + "use strict"; + var i, n = (i = t("../../../renderer/gfx")) && i.__esModule ? i : { + default: i + }, r = (cc.sys.os === cc.sys.OS_IOS || cc.sys.os === cc.sys.OS_OSX) && cc.sys.isBrowser && /(OS 1[4-9])|(Version\/1[4-9])/.test(window.navigator.userAgent), s = cc.Class({ + name: "cc.MeshBuffer", + ctor: function(t, e) { + this.init(t, e) + }, + init: function(t, e) { + this.byteOffset = 0, + this.indiceOffset = 0, + this.vertexOffset = 0, + this.indiceStart = 0, + this._dirty = !1, + this._vertexFormat = e, + this._vertexBytes = this._vertexFormat._bytes, + this._arrOffset = 0, + this._vbArr = [], + this._vb = new n.default.VertexBuffer(t._device,e,n.default.USAGE_DYNAMIC,new ArrayBuffer,0), + this._vbArr[0] = this._vb, + this._ibArr = [], + this._ib = new n.default.IndexBuffer(t._device,n.default.INDEX_FMT_UINT16,n.default.USAGE_STATIC,new ArrayBuffer,0), + this._ibArr[0] = this._ib, + this._vData = null, + this._uintVData = null, + this._iData = null, + this._batcher = t, + this._initVDataCount = 256 * e._bytes, + this._initIDataCount = 1536, + this._offsetInfo = { + byteOffset: 0, + vertexOffset: 0, + indiceOffset: 0 + }, + this._reallocBuffer() + }, + uploadData: function() { + if (0 !== this.byteOffset && this._dirty) { + var t = new Float32Array(this._vData.buffer,0,this.byteOffset >> 2) + , e = new Uint16Array(this._iData.buffer,0,this.indiceOffset); + this._vb.update(0, t), + this._ib.update(0, e), + this._dirty = !1 + } + }, + switchBuffer: function() { + var t = ++this._arrOffset; + this.byteOffset = 0, + this.vertexOffset = 0, + this.indiceOffset = 0, + this.indiceStart = 0, + t < this._vbArr.length ? (this._vb = this._vbArr[t], + this._ib = this._ibArr[t]) : (this._vb = new n.default.VertexBuffer(this._batcher._device,this._vertexFormat,n.default.USAGE_DYNAMIC,new ArrayBuffer,0), + this._vbArr[t] = this._vb, + this._ib = new n.default.IndexBuffer(this._batcher._device,n.default.INDEX_FMT_UINT16,n.default.USAGE_STATIC,new ArrayBuffer,0), + this._ibArr[t] = this._ib) + }, + checkAndSwitchBuffer: function(t) { + this.vertexOffset + t > 65535 && (this.uploadData(), + this._batcher._flush(), + this.switchBuffer()) + }, + requestStatic: function(t, e) { + this.checkAndSwitchBuffer(t); + var i = this.byteOffset + t * this._vertexBytes + , n = this.indiceOffset + e + , r = this._vData.byteLength + , s = this._iData.length; + if (i > r || n > s) { + for (; r < i || s < n; ) + this._initVDataCount *= 2, + this._initIDataCount *= 2, + r = 4 * this._initVDataCount, + s = this._initIDataCount; + this._reallocBuffer() + } + this._updateOffset(t, e, i) + }, + _updateOffset: function(t, e, i) { + var n = this._offsetInfo; + n.vertexOffset = this.vertexOffset, + this.vertexOffset += t, + n.indiceOffset = this.indiceOffset, + this.indiceOffset += e, + n.byteOffset = this.byteOffset, + this.byteOffset = i, + this._dirty = !0 + }, + request: function(t, e) { + return this._batcher._buffer !== this && (this._batcher._flush(), + this._batcher._buffer = this), + this.requestStatic(t, e), + this._offsetInfo + }, + _reallocBuffer: function() { + this._reallocVData(!0), + this._reallocIData(!0) + }, + _reallocVData: function(t) { + var e; + this._vData && (e = new Uint8Array(this._vData.buffer)), + this._vData = new Float32Array(this._initVDataCount), + this._uintVData = new Uint32Array(this._vData.buffer); + var i = new Uint8Array(this._uintVData.buffer); + if (e && t) + for (var n = 0, r = e.length; n < r; n++) + i[n] = e[n] + }, + _reallocIData: function(t) { + var e = this._iData; + if (this._iData = new Uint16Array(this._initIDataCount), + e && t) + for (var i = this._iData, n = 0, r = e.length; n < r; n++) + i[n] = e[n] + }, + reset: function() { + this._arrOffset = 0, + this._vb = this._vbArr[0], + this._ib = this._ibArr[0], + this.byteOffset = 0, + this.indiceOffset = 0, + this.vertexOffset = 0, + this.indiceStart = 0, + this._dirty = !1 + }, + destroy: function() { + this.reset(); + for (var t = 0; t < this._vbArr.length; t++) + this._vbArr[t].destroy(); + this._vbArr = null; + for (var e = 0; e < this._ibArr.length; e++) + this._ibArr[e].destroy(); + this._ibArr = null, + this._ib = null, + this._vb = null + }, + forwardIndiceStartToOffset: function() { + this.indiceStart = this.indiceOffset + } + }); + r && (s.prototype.checkAndSwitchBuffer = function(t) { + this.vertexOffset + t > 65535 && (this.uploadData(), + this._batcher._flush()) + } + , + s.prototype.forwardIndiceStartToOffset = function() { + this.uploadData(), + this.switchBuffer() + } + ), + cc.MeshBuffer = e.exports = s + } + ), { + "../../../renderer/gfx": 315 + }], + 252: [(function(t, e) { + "use strict"; + var i = s(t("../../../renderer/core/input-assembler")) + , n = s(t("../../../renderer/memop/recycle-pool")) + , r = s(t("../../../renderer/scene/model")); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + var a = t("./vertex-format") + , o = a.vfmtPosUvColor + , l = a.vfmt3D + , h = t("./quad-buffer") + , c = t("./mesh-buffer") + , u = t("./spine-buffer") + , _ = t("../../assets/material/CCMaterial") + , f = (new (t("../../platform/id-generater"))("VertextFormat"), + {}) + , d = new _ + , p = new i.default; + p._count = 0; + var m = function(t, e) { + this._renderScene = e, + this._device = t, + this.walking = !1, + this.material = d, + this.cullingMask = 1, + this._iaPool = new n.default(function() { + return new i.default + } + ,16), + this._modelPool = new n.default(function() { + return new r.default + } + ,16), + this._quadBuffer = this.getBuffer("quad", o), + this._meshBuffer = this.getBuffer("mesh", o), + this._quadBuffer3D = this.getBuffer("quad", l), + this._meshBuffer3D = this.getBuffer("mesh", l), + this._buffer = this._meshBuffer, + this._batchedModels = [], + this._dummyNode = new cc.Node, + this._sortKey = 0, + this.node = this._dummyNode, + this.parentOpacity = 1, + this.parentOpacityDirty = 0, + this.worldMatDirty = 0 + }; + m.prototype = { + constructor: m, + reset: function() { + this._iaPool.reset(); + for (var t = this._renderScene, e = this._batchedModels, i = 0; i < e.length; ++i) + e[i].setInputAssembler(null), + e[i].setEffect(null), + t.removeModel(e[i]); + for (var n in this._modelPool.reset(), + e.length = 0, + this._sortKey = 0, + f) + f[n].reset(); + this._buffer = this._meshBuffer, + this.node = this._dummyNode, + this.material = d, + this.cullingMask = 1, + this.parentOpacity = 1, + this.parentOpacityDirty = 0, + this.worldMatDirty = 0 + }, + _flushMaterial: function(t) { + if (t) { + this.material = t; + var e = t.effect; + if (e) { + var i = this._modelPool.add(); + this._batchedModels.push(i), + i.sortKey = this._sortKey++, + i._cullingMask = this.cullingMask, + i.setNode(this.node), + i.setEffect(e, null), + i.setInputAssembler(p), + this._renderScene.addModel(i) + } + } + }, + _flush: function() { + var t = this.material + , e = this._buffer + , i = e.indiceOffset - e.indiceStart; + if (this.walking && t && !(i <= 0)) { + var n = t.effect; + if (n) { + var r = this._iaPool.add(); + r._vertexBuffer = e._vb, + r._indexBuffer = e._ib, + r._start = e.indiceStart, + r._count = i; + var s = this._modelPool.add(); + this._batchedModels.push(s), + s.sortKey = this._sortKey++, + s._cullingMask = this.cullingMask, + s.setNode(this.node), + s.setEffect(n), + s.setInputAssembler(r), + this._renderScene.addModel(s), + e.forwardIndiceStartToOffset() + } + } + }, + _flushIA: function(t) { + if (t) { + var e = this.material.effect; + if (e) { + var i = this._modelPool.add(); + this._batchedModels.push(i), + i.sortKey = this._sortKey++, + i._cullingMask = this.cullingMask, + i.setNode(this.node), + i.setEffect(e), + i.setInputAssembler(t), + this._renderScene.addModel(i) + } + } + }, + terminate: function() { + for (var t in cc.dynamicAtlasManager && cc.dynamicAtlasManager.enabled && cc.dynamicAtlasManager.update(), + this._flush(), + f) + f[t].uploadData(); + this.walking = !1 + }, + getBuffer: function(t, e) { + var i = t + e.getHash() + , n = f[i]; + if (!n) { + if ("mesh" === t) + n = new c(this,e); + else if ("quad" === t) + n = new h(this,e); + else { + if ("spine" !== t) + return cc.error("Not support buffer type [" + t + "]"), + null; + n = new u(this,e) + } + f[i] = n + } + return n + } + }, + e.exports = m + } + ), { + "../../../renderer/core/input-assembler": 305, + "../../../renderer/memop/recycle-pool": 330, + "../../../renderer/scene/model": 336, + "../../assets/material/CCMaterial": 80, + "../../platform/id-generater": 210, + "./mesh-buffer": 251, + "./quad-buffer": 253, + "./spine-buffer": 255, + "./vertex-format": 256 + }], + 253: [(function(t, e) { + "use strict"; + var i = t("./mesh-buffer") + , n = cc.Class({ + name: "cc.QuadBuffer", + extends: i, + _fillQuadBuffer: function() { + for (var t = this._initIDataCount / 6, e = this._iData, i = 0, n = 0; i < t; i++) { + var r = 4 * i; + e[n++] = r, + e[n++] = r + 1, + e[n++] = r + 2, + e[n++] = r + 1, + e[n++] = r + 3, + e[n++] = r + 2 + } + var s = new Uint16Array(this._iData.buffer,0,6 * t); + this._ib.update(0, s) + }, + uploadData: function() { + if (0 !== this.byteOffset && this._dirty) { + var t = new Float32Array(this._vData.buffer,0,this.byteOffset >> 2); + this._vb.update(0, t), + this._dirty = !1 + } + }, + switchBuffer: function() { + this._super(); + var t = new Uint16Array(this._iData.buffer,0,this._initIDataCount); + this._ib.update(0, t) + }, + _reallocBuffer: function() { + this._reallocVData(!0), + this._reallocIData(), + this._fillQuadBuffer() + } + }); + cc.QuadBuffer = e.exports = n + } + ), { + "./mesh-buffer": 251 + }], + 254: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = a; + var n, r = (n = t("./flex-buffer")) && n.__esModule ? n : { + default: n + }, s = t("./vertex-format"); + function a() { + this.vDatas = [], + this.uintVDatas = [], + this.iDatas = [], + this.meshCount = 0, + this._infos = null, + this._flexBuffer = null + } + cc.js.mixin(a.prototype, { + init: function() {}, + clear: function() { + this.vDatas.length = 0, + this.iDatas.length = 0, + this.uintVDatas.length = 0, + this.meshCount = 0, + this._infos = null, + this._flexBuffer && this._flexBuffer.reset() + }, + updateMesh: function(t, e, i) { + this.vDatas[t] = e, + this.uintVDatas[t] = new Uint32Array(e.buffer,0,e.length), + this.iDatas[t] = i, + this.meshCount = this.vDatas.length + }, + updateMeshRange: function() {}, + createData: function(t, e, i) { + var n = new Float32Array(e) + , r = new Uint16Array(i); + this.updateMesh(t, n, r) + }, + createQuadData: function(t, e, i) { + this.createData(t, e, i), + this.initQuadIndices(this.iDatas[t]) + }, + createFlexData: function(t, e, i, n) { + n = n || s.vfmtPosUvColor, + this._flexBuffer = new r.default(this,t,e,i,n) + }, + initQuadIndices: function(t) { + for (var e = t.length / 6, i = 0, n = 0; i < e; i++) { + var r = 4 * i; + t[n++] = r, + t[n++] = r + 1, + t[n++] = r + 2, + t[n++] = r + 1, + t[n++] = r + 3, + t[n++] = r + 2 + } + } + }), + cc.RenderData = a, + e.exports = i.default + } + ), { + "./flex-buffer": 250, + "./vertex-format": 256 + }], + 255: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.SpineBuffer", + extends: t("./mesh-buffer"), + requestStatic: function(t, e) { + this.checkAndSwitchBuffer(t); + var i = this.byteOffset + t * this._vertexBytes + , n = this.indiceOffset + e + , r = this._vData.byteLength + , s = this._iData.length; + if (i > r || n > s) { + for (; r < i || s < n; ) + this._initVDataCount *= 2, + this._initIDataCount *= 2, + r = 4 * this._initVDataCount, + s = this._initIDataCount; + this._reallocBuffer() + } + var a = this._offsetInfo; + a.vertexOffset = this.vertexOffset, + a.indiceOffset = this.indiceOffset, + a.byteOffset = this.byteOffset + }, + adjust: function(t, e) { + this.vertexOffset += t, + this.indiceOffset += e, + this.byteOffset = this.byteOffset + t * this._vertexBytes, + this._dirty = !0 + } + }); + cc.SpineBuffer = e.exports = i + } + ), { + "./mesh-buffer": 251 + }], + 256: [(function(t, e) { + "use strict"; + var i, n = (i = t("../../../renderer/gfx")) && i.__esModule ? i : { + default: i + }, r = new n.default.VertexFormat([{ + name: n.default.ATTR_POSITION, + type: n.default.ATTR_TYPE_FLOAT32, + num: 3 + }, { + name: n.default.ATTR_UV0, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: n.default.ATTR_COLOR, + type: n.default.ATTR_TYPE_UINT8, + num: 4, + normalize: !0 + }]); + r.name = "vfmt3D", + n.default.VertexFormat.XYZ_UV_Color = r; + var s = new n.default.VertexFormat([{ + name: n.default.ATTR_POSITION, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: n.default.ATTR_UV0, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: n.default.ATTR_COLOR, + type: n.default.ATTR_TYPE_UINT8, + num: 4, + normalize: !0 + }]); + s.name = "vfmtPosUvColor", + n.default.VertexFormat.XY_UV_Color = s; + var a = new n.default.VertexFormat([{ + name: n.default.ATTR_POSITION, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: n.default.ATTR_UV0, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: n.default.ATTR_COLOR, + type: n.default.ATTR_TYPE_UINT8, + num: 4, + normalize: !0 + }, { + name: n.default.ATTR_COLOR0, + type: n.default.ATTR_TYPE_UINT8, + num: 4, + normalize: !0 + }]); + a.name = "vfmtPosUvTwoColor", + n.default.VertexFormat.XY_UV_Two_Color = a; + var o = new n.default.VertexFormat([{ + name: n.default.ATTR_POSITION, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: n.default.ATTR_UV0, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }]); + o.name = "vfmtPosUv", + n.default.VertexFormat.XY_UV = o; + var l = new n.default.VertexFormat([{ + name: n.default.ATTR_POSITION, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }, { + name: n.default.ATTR_COLOR, + type: n.default.ATTR_TYPE_UINT8, + num: 4, + normalize: !0 + }]); + l.name = "vfmtPosColor", + n.default.VertexFormat.XY_Color = l; + var h = new n.default.VertexFormat([{ + name: n.default.ATTR_POSITION, + type: n.default.ATTR_TYPE_FLOAT32, + num: 2 + }]); + h.name = "vfmtPos", + n.default.VertexFormat.XY = h, + e.exports = { + vfmt3D: r, + vfmtPosUvColor: s, + vfmtPosUvTwoColor: a, + vfmtPosUv: o, + vfmtPosColor: l, + vfmtPos: h + } + } + ), { + "../../../renderer/gfx": 315 + }], + 257: [(function(t, e) { + "use strict"; + t("../platform/CCSys"); + var i = /(\.[^\.\/\?\\]*)(\?.*)?$/ + , n = /((.*)(\/|\\|\\\\))?(.*?\..*$)?/ + , r = /[^\.\/]+\/\.\.\//; + cc.path = { + join: function() { + for (var t = arguments.length, e = "", i = 0; i < t; i++) + e = (e + ("" === e ? "" : "/") + arguments[i]).replace(/(\/|\\\\)$/, ""); + return e + }, + extname: function(t) { + var e = i.exec(t); + return e ? e[1] : "" + }, + mainFileName: function(t) { + if (t) { + var e = t.lastIndexOf("."); + if (-1 !== e) + return t.substring(0, e) + } + return t + }, + basename: function(t, e) { + var i = t.indexOf("?"); + i > 0 && (t = t.substring(0, i)); + var n = /(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/, "")); + if (!n) + return t; + var r = n[2]; + return e && t.substring(t.length - e.length).toLowerCase() === e.toLowerCase() ? r.substring(0, r.length - e.length) : r + }, + dirname: function(t) { + var e = n.exec(t); + return e ? e[2] : "" + }, + changeExtname: function(t, e) { + e = e || ""; + var i = t.indexOf("?") + , n = ""; + return i > 0 && (n = t.substring(i), + t = t.substring(0, i)), + (i = t.lastIndexOf(".")) < 0 ? t + e + n : t.substring(0, i) + e + n + }, + changeBasename: function(t, e, i) { + if (0 === e.indexOf(".")) + return this.changeExtname(t, e); + var n = t.indexOf("?") + , r = "" + , s = i ? this.extname(t) : ""; + return n > 0 && (r = t.substring(n), + t = t.substring(0, n)), + n = (n = t.lastIndexOf("/")) <= 0 ? 0 : n + 1, + t.substring(0, n) + e + s + r + }, + _normalize: function(t) { + var e = t = String(t); + do { + e = t, + t = t.replace(r, "") + } while (e.length !== t.length);return t + }, + sep: cc.sys.os === cc.sys.OS_WINDOWS ? "\\" : "/", + stripSep: function(t) { + return t.replace(/[\/\\]$/, "") + } + }, + e.exports = cc.path + } + ), { + "../platform/CCSys": 202 + }], + 258: [(function(t, e) { + "use strict"; + var i = function(t, e, i, n, r, s) { + this.a = t, + this.b = e, + this.c = i, + this.d = n, + this.tx = r, + this.ty = s + }; + i.create = function(t, e, i, n, r, s) { + return { + a: t, + b: e, + c: i, + d: n, + tx: r, + ty: s + } + } + , + i.identity = function() { + return { + a: 1, + b: 0, + c: 0, + d: 1, + tx: 0, + ty: 0 + } + } + , + i.clone = function(t) { + return { + a: t.a, + b: t.b, + c: t.c, + d: t.d, + tx: t.tx, + ty: t.ty + } + } + , + i.concat = function(t, e, i) { + var n = e.a + , r = e.b + , s = e.c + , a = e.d + , o = e.tx + , l = e.ty; + return t.a = n * i.a + r * i.c, + t.b = n * i.b + r * i.d, + t.c = s * i.a + a * i.c, + t.d = s * i.b + a * i.d, + t.tx = o * i.a + l * i.c + i.tx, + t.ty = o * i.b + l * i.d + i.ty, + t + } + , + i.invert = function(t, e) { + var i = e.a + , n = e.b + , r = e.c + , s = e.d + , a = 1 / (i * s - n * r) + , o = e.tx + , l = e.ty; + return t.a = a * s, + t.b = -a * n, + t.c = -a * r, + t.d = a * i, + t.tx = a * (r * l - s * o), + t.ty = a * (n * o - i * l), + t + } + , + i.fromMat4 = function(t, e) { + var i = e.m; + return t.a = i[0], + t.b = i[1], + t.c = i[4], + t.d = i[5], + t.tx = i[12], + t.ty = i[13], + t + } + , + i.transformVec2 = function(t, e, i, n) { + var r, s; + return void 0 === n ? (n = i, + r = e.x, + s = e.y) : (r = e, + s = i), + t.x = n.a * r + n.c * s + n.tx, + t.y = n.b * r + n.d * s + n.ty, + t + } + , + i.transformSize = function(t, e, i) { + return t.width = i.a * e.width + i.c * e.height, + t.height = i.b * e.width + i.d * e.height, + t + } + , + i.transformRect = function(t, e, i) { + var n = e.x + , r = e.y + , s = n + e.width + , a = r + e.height + , o = i.a * n + i.c * r + i.tx + , l = i.b * n + i.d * r + i.ty + , h = i.a * s + i.c * r + i.tx + , c = i.b * s + i.d * r + i.ty + , u = i.a * n + i.c * a + i.tx + , _ = i.b * n + i.d * a + i.ty + , f = i.a * s + i.c * a + i.tx + , d = i.b * s + i.d * a + i.ty + , p = Math.min(o, h, u, f) + , m = Math.max(o, h, u, f) + , y = Math.min(l, c, _, d) + , v = Math.max(l, c, _, d); + return t.x = p, + t.y = y, + t.width = m - p, + t.height = v - y, + t + } + , + i.transformObb = function(t, e, i, n, r, s) { + var a = r.x + , o = r.y + , l = r.width + , h = r.height + , c = s.a * a + s.c * o + s.tx + , u = s.b * a + s.d * o + s.ty + , _ = s.a * l + , f = s.b * l + , d = s.c * h + , p = s.d * h; + e.x = c, + e.y = u, + i.x = _ + c, + i.y = f + u, + t.x = d + c, + t.y = p + u, + n.x = _ + d + c, + n.y = f + p + u + } + , + cc.AffineTransform = e.exports = i + } + ), {}], + 259: [(function(t, e) { + "use strict"; + var i = t("../platform/CCObject").Flags + , n = t("./misc") + , r = t("../platform/js") + , s = t("../platform/id-generater") + , a = t("../event-manager") + , o = t("../renderer/render-flow") + , l = i.Destroying + , h = i.DontDestroy + , c = i.Deactivating + , u = new s("Node"); + function _(t) { + return t ? "string" == typeof t ? r.getClassByName(t) : t : (cc.errorID(3804), + null) + } + function f(t, e) { + if (e._sealed) + for (var i = 0; i < t._components.length; ++i) { + var n = t._components[i]; + if (n.constructor === e) + return n + } + else + for (var r = 0; r < t._components.length; ++r) { + var s = t._components[r]; + if (s instanceof e) + return s + } + return null + } + function d(t, e, i) { + if (e._sealed) + for (var n = 0; n < t._components.length; ++n) { + var r = t._components[n]; + r.constructor === e && i.push(r) + } + else + for (var s = 0; s < t._components.length; ++s) { + var a = t._components[s]; + a instanceof e && i.push(a) + } + } + function p(t, e) { + for (var i = 0; i < t.length; ++i) { + var n = t[i] + , r = f(n, e); + if (r) + return r; + if (n._children.length > 0 && (r = p(n._children, e))) + return r + } + return null + } + function m(t, e, i) { + for (var n = 0; n < t.length; ++n) { + var r = t[n]; + d(r, e, i), + r._children.length > 0 && m(r._children, e, i) + } + } + var y = cc.Class({ + name: "cc._BaseNode", + extends: cc.Object, + properties: { + _parent: null, + _children: [], + _active: !0, + _components: [], + _prefab: null, + _persistNode: { + get: function() { + return (this._objFlags & h) > 0 + }, + set: function(t) { + t ? this._objFlags |= h : this._objFlags &= ~h + } + }, + name: { + get: function() { + return this._name + }, + set: function(t) { + this._name = t + } + }, + uuid: { + get: function() { + return this._id + } + }, + children: { + get: function() { + return this._children + } + }, + childrenCount: { + get: function() { + return this._children.length + } + }, + active: { + get: function() { + return this._active + }, + set: function(t) { + if (t = !!t, + this._active !== t) { + this._active = t; + var e = this._parent; + e && e._activeInHierarchy && cc.director._nodeActivator.activateNode(this, t) + } + } + }, + activeInHierarchy: { + get: function() { + return this._activeInHierarchy + } + } + }, + ctor: function(t) { + this._name = void 0 !== t ? t : "New Node", + this._activeInHierarchy = !1, + this._id = u.getNewId(), + cc.director._scheduler && cc.director._scheduler.enableForTarget(this), + this.__eventTargets = [] + }, + getParent: function() { + return this._parent + }, + setParent: function(t) { + if (this._parent !== t) { + var e = this._parent; + if (this._parent = t || null, + this._onSetParent(t), + t && (a._setDirtyForNode(this), + t._children.push(this), + t.emit && t.emit("child-added", this), + t._renderFlag |= o.FLAG_CHILDREN), + e) { + if (!(e._objFlags & l)) { + var i = e._children.indexOf(this); + e._children.splice(i, 1), + e.emit && e.emit("child-removed", this), + this._onHierarchyChanged(e), + 0 === e._children.length && (e._renderFlag &= ~o.FLAG_CHILDREN) + } + } else + t && this._onHierarchyChanged(null) + } + }, + attr: function(t) { + r.mixin(this, t) + }, + getChildByUuid: function(t) { + if (!t) + return cc.log("Invalid uuid"), + null; + for (var e = this._children, i = 0, n = e.length; i < n; i++) + if (e[i]._id === t) + return e[i]; + return null + }, + getChildByName: function(t) { + if (!t) + return cc.log("Invalid name"), + null; + for (var e = this._children, i = 0, n = e.length; i < n; i++) + if (e[i]._name === t) + return e[i]; + return null + }, + addChild: function(t) { + cc.assertID(t, 1606), + cc.assertID(null === t._parent, 1605), + t.setParent(this) + }, + insertChild: function(t, e) { + t.parent = this, + t.setSiblingIndex(e) + }, + getSiblingIndex: function() { + return this._parent ? this._parent._children.indexOf(this) : 0 + }, + setSiblingIndex: function(t) { + if (this._parent) + if (this._parent._objFlags & c) + cc.errorID(3821); + else { + var e = this._parent._children; + t = -1 !== t ? t : e.length - 1; + var i = e.indexOf(this); + t !== i && (e.splice(i, 1), + t < e.length ? e.splice(t, 0, this) : e.push(this), + this._onSiblingIndexChanged && this._onSiblingIndexChanged(t)) + } + }, + walk: function(t, e) { + var i, n, r, s, a = cc._BaseNode, o = 1, l = a._stacks[a._stackId]; + l || (l = [], + a._stacks.push(l)), + a._stackId++, + l.length = 0, + l[0] = this; + var h = null; + for (s = !1; o; ) + if (n = l[--o]) + if (!s && t ? t(n) : s && e && e(n), + l[o] = null, + s) { + if (h === this._parent) + break; + if (s = !1, + i) + if (i[++r]) + l[o] = i[r], + o++; + else if (h && (l[o] = h, + o++, + s = !0, + h._parent ? (r = (i = h._parent._children).indexOf(h), + h = h._parent) : (h = null, + i = null), + r < 0)) + break + } else + n._children.length > 0 ? (h = n, + i = n._children, + r = 0, + l[o] = i[r], + o++) : (l[o] = n, + o++, + s = !0); + l.length = 0, + a._stackId-- + }, + cleanup: function() {}, + removeFromParent: function(t) { + this._parent && (void 0 === t && (t = !0), + this._parent.removeChild(this, t)) + }, + removeChild: function(t, e) { + this._children.indexOf(t) > -1 && ((e || void 0 === e) && t.cleanup(), + t.parent = null) + }, + removeAllChildren: function(t) { + var e = this._children; + void 0 === t && (t = !0); + for (var i = e.length - 1; i >= 0; i--) { + var n = e[i]; + n && (t && n.cleanup(), + n.parent = null) + } + this._children.length = 0 + }, + isChildOf: function(t) { + var e = this; + do { + if (e === t) + return !0; + e = e._parent + } while (e);return !1 + }, + getComponent: function(t) { + var e = _(t); + return e ? f(this, e) : null + }, + getComponents: function(t) { + var e = _(t) + , i = []; + return e && d(this, e, i), + i + }, + getComponentInChildren: function(t) { + var e = _(t); + return e ? p(this._children, e) : null + }, + getComponentsInChildren: function(t) { + var e = _(t) + , i = []; + return e && (d(this, e, i), + m(this._children, e, i)), + i + }, + _checkMultipleComp: !1, + addComponent: function(t) { + var e; + if ("string" == typeof t) { + if (!(e = r.getClassByName(t))) + return cc.errorID(3807, t), + cc._RFpeek() && cc.errorID(3808, t), + null + } else { + if (!t) + return cc.errorID(3804), + null; + e = t + } + if ("function" != typeof e) + return cc.errorID(3809), + null; + if (!r.isChildClassOf(e, cc.Component)) + return cc.errorID(3810), + null; + var i = e._requireComponent; + if (i && !this.getComponent(i) && !this.addComponent(i)) + return null; + var n = new e; + return n.node = this, + this._components.push(n), + this._activeInHierarchy && cc.director._nodeActivator.activateComp(n), + n + }, + _addComponentAt: !1, + removeComponent: function(t) { + t ? (t instanceof cc.Component || (t = this.getComponent(t)), + t && t.destroy()) : cc.errorID(3813) + }, + _getDependComponent: !1, + _removeComponent: function(t) { + if (t) { + if (!(this._objFlags & l)) { + var e = this._components.indexOf(t); + -1 !== e ? this._components.splice(e, 1) : t.node !== this && cc.errorID(3815) + } + } else + cc.errorID(3814) + }, + destroy: function() { + cc.Object.prototype.destroy.call(this) && (this.active = !1) + }, + destroyAllChildren: function() { + for (var t = this._children, e = 0; e < t.length; ++e) + t[e].destroy() + }, + _onSetParent: function() {}, + _onPostActivated: function() {}, + _onBatchCreated: function() {}, + _onHierarchyChanged: function() { + var t = this._parent; + !this._persistNode || t instanceof cc.Scene || cc.game.removePersistRootNode(this); + var e = this._active && !(!t || !t._activeInHierarchy); + this._activeInHierarchy !== e && cc.director._nodeActivator.activateNode(this, e) + }, + _instantiate: function(t, e) { + return t || (t = cc.instantiate._clone(this, this)), + t._prefab, + t._parent = null, + t._onBatchCreated(e), + t + }, + _registerIfAttached: !1, + _onPreDestroy: function() { + var t, e; + this._objFlags |= l; + var i = this._parent + , n = i && i._objFlags & l + , r = this._children; + for (t = 0, + e = r.length; t < e; ++t) + r[t]._destroyImmediate(); + for (t = 0, + e = this._components.length; t < e; ++t) + this._components[t]._destroyImmediate(); + var s = this.__eventTargets; + for (t = 0, + e = s.length; t < e; ++t) { + var a = s[t]; + a && a.targetOff(this) + } + if (s.length = 0, + this._persistNode && cc.game.removePersistRootNode(this), + !n && i) { + var o = i._children.indexOf(this); + i._children.splice(o, 1), + i.emit && i.emit("child-removed", this) + } + return n + }, + onRestore: !1 + }); + y.idGenerater = u, + y._stacks = [[]], + y._stackId = 0, + y.prototype._onPreDestroyBase = y.prototype._onPreDestroy, + y.prototype._onHierarchyChangedBase = y.prototype._onHierarchyChanged, + n.propertyDefine(y, ["parent", "name", "children", "childrenCount"], {}), + cc._BaseNode = e.exports = y + } + ), { + "../event-manager": 138, + "../platform/CCObject": 199, + "../platform/id-generater": 210, + "../platform/js": 214, + "../renderer/render-flow": 225, + "./misc": 267 + }], + 260: [(function(t, e) { + "use strict"; + e.exports = { + binarySearchEpsilon: function(t, e) { + for (var i = 0, n = t.length - 1, r = n >>> 1; i <= n; r = i + n >>> 1) { + var s = t[r]; + if (s > e + 1e-6) + n = r - 1; + else { + if (!(s < e - 1e-6)) + return r; + i = r + 1 + } + } + return ~i + } + } + } + ), {}], + 261: [(function(t, e) { + "use strict"; + var i = t("../components/CCRenderComponent") + , n = t("../platform/CCMacro").BlendFactor + , r = t("../../renderer/gfx") + , s = cc.Class({ + properties: { + _srcBlendFactor: n.SRC_ALPHA, + _dstBlendFactor: n.ONE_MINUS_SRC_ALPHA, + srcBlendFactor: { + get: function() { + return this._srcBlendFactor + }, + set: function(t) { + this._srcBlendFactor !== t && (this._srcBlendFactor = t, + this._updateBlendFunc(!0), + this._onBlendChanged && this._onBlendChanged()) + }, + animatable: !1, + type: n, + tooltip: !1, + visible: !0 + }, + dstBlendFactor: { + get: function() { + return this._dstBlendFactor + }, + set: function(t) { + this._dstBlendFactor !== t && (this._dstBlendFactor = t, + this._updateBlendFunc(!0)) + }, + animatable: !1, + type: n, + tooltip: !1, + visible: !0 + } + }, + setMaterial: function(t, e) { + var r = i.prototype.setMaterial.call(this, t, e); + return this._srcBlendFactor === n.SRC_ALPHA && this._dstBlendFactor === n.ONE_MINUS_SRC_ALPHA || this._updateMaterialBlendFunc(r), + r + }, + _updateMaterial: function() { + this._updateBlendFunc() + }, + _updateBlendFunc: function(t) { + if (t || this._srcBlendFactor !== n.SRC_ALPHA || this._dstBlendFactor !== n.ONE_MINUS_SRC_ALPHA) + for (var e = this.getMaterials(), i = 0; i < e.length; i++) { + var r = e[i]; + this._updateMaterialBlendFunc(r) + } + }, + _updateMaterialBlendFunc: function(t) { + t.setBlend(!0, r.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor, r.BLEND_FUNC_ADD, this._srcBlendFactor, this._dstBlendFactor) + } + }); + e.exports = cc.BlendFunc = s + } + ), { + "../../renderer/gfx": 315, + "../components/CCRenderComponent": 115, + "../platform/CCMacro": 198 + }], + 262: [(function(t, e) { + "use strict"; + var i = t("./misc").BASE64_VALUES + , n = "0123456789abcdef".split("") + , r = ["", "", "", ""] + , s = r.concat(r, "-", r, "-", r, "-", r, "-", r, r, r) + , a = s.map((function(t, e) { + return "-" === t ? NaN : e + } + )).filter(isFinite); + e.exports = function(t) { + if (22 !== t.length) + return t; + s[0] = t[0], + s[1] = t[1]; + for (var e = 2, r = 2; e < 22; e += 2) { + var o = i[t.charCodeAt(e)] + , l = i[t.charCodeAt(e + 1)]; + s[a[r++]] = n[o >> 2], + s[a[r++]] = n[(3 & o) << 2 | l >> 4], + s[a[r++]] = n[15 & l] + } + return s.join("") + } + } + ), { + "./misc": 267 + }], + 263: [(function(t, e) { + "use strict"; + cc.find = e.exports = function(t, e) { + if (null == t) + return cc.errorID(3814), + null; + if (e) + ; + else { + var i = cc.director.getScene(); + if (!i) + return null; + e = i + } + for (var n = e, r = "/" !== t[0] ? 0 : 1, s = t.split("/"), a = r; a < s.length; a++) { + var o = s[a] + , l = n._children; + n = null; + for (var h = 0, c = l.length; h < c; ++h) { + var u = l[h]; + if (u.name === o) { + n = u; + break + } + } + if (!n) + return null + } + return n + } + } + ), {}], + 264: [(function(t, e) { + "use strict"; + var i, n = (i = t("../assets/material/material-variant")) && i.__esModule ? i : { + default: i + }, r = t("../assets/material/CCMaterial"), s = cc.Class({ + properties: { + _normalMaterial: null, + normalMaterial: { + get: function() { + return this._normalMaterial + }, + set: function(t) { + this._normalMaterial = t, + this._updateDisabledState && this._updateDisabledState() + }, + type: r, + tooltip: !1, + animatable: !1 + }, + _grayMaterial: null, + grayMaterial: { + get: function() { + return this._grayMaterial + }, + set: function(t) { + this._grayMaterial = t, + this._updateDisabledState && this._updateDisabledState() + }, + type: r, + tooltip: !1, + animatable: !1 + } + }, + _switchGrayMaterial: function(t, e) { + var i; + t ? ((i = this._grayMaterial) || (i = r.getBuiltinMaterial("2d-gray-sprite")), + i = this._grayMaterial = n.default.create(i, e)) : ((i = this._normalMaterial) || (i = r.getBuiltinMaterial("2d-sprite", e)), + i = this._normalMaterial = n.default.create(i, e)), + e.setMaterial(0, i) + } + }); + e.exports = s + } + ), { + "../assets/material/CCMaterial": 80, + "../assets/material/material-variant": 87 + }], + 265: [(function(t, e) { + "use strict"; + var i = /^(click)(\s)*=|(param)(\s)*=/ + , n = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/ + , r = function() { + this._parsedObject = {}, + this._specialSymbolArray = [], + this._specialSymbolArray.push([/</g, "<"]), + this._specialSymbolArray.push([/>/g, ">"]), + this._specialSymbolArray.push([/&/g, "&"]), + this._specialSymbolArray.push([/"/g, '"']), + this._specialSymbolArray.push([/'/g, "'"]), + this._specialSymbolArray.push([/ /g, " "]) + }; + r.prototype = { + constructor: r, + parse: function(t) { + this._resultObjectArray = [], + this._stack = []; + for (var e = 0, i = t.length; e < i; ) { + var n = t.indexOf(">", e) + , r = -1; + if (n >= 0 && (r = t.lastIndexOf("<", n)) < e - 1 && (r = t.indexOf("<", n + 1), + n = t.indexOf(">", r + 1)), + r < 0) + this._stack.pop(), + this._processResult(t.substring(e)), + e = i; + else { + var s = t.substring(e, r) + , a = t.substring(r + 1, n); + "" === a && (s = t.substring(e, n + 1)), + this._processResult(s), + -1 === n ? n = r : "/" === t.charAt(r + 1) ? this._stack.pop() : this._addToStack(a), + e = n + 1 + } + } + return this._resultObjectArray + }, + _attributeToObject: function(t) { + var e, i, r, s, a = {}, o = (t = t.trim()).match(/^(color|size)(\s)*=/); + if (o) { + if (e = o[0], + "" === (t = t.substring(e.length).trim())) + return a; + switch (i = t.indexOf(" "), + e[0]) { + case "c": + a.color = i > -1 ? t.substring(0, i).trim() : t; + break; + case "s": + a.size = parseInt(t) + } + return i > -1 && (s = t.substring(i + 1).trim(), + r = this._processEventHandler(s), + a.event = r), + a + } + if ((o = t.match(/^(br(\s)*\/)/)) && o[0].length > 0 && (e = o[0].trim()).startsWith("br") && "/" === e[e.length - 1]) + return a.isNewLine = !0, + this._resultObjectArray.push({ + text: "", + style: { + newline: !0 + } + }), + a; + if ((o = t.match(/^(img(\s)*src(\s)*=[^>]+\/)/)) && o[0].length > 0 && (e = o[0].trim()).startsWith("img") && "/" === e[e.length - 1]) { + var l; + o = t.match(n); + for (var h = !1; o; ) { + if (e = (t = t.substring(t.indexOf(o[0]))).substr(0, o[0].length), + u = (i = (l = t.substring(e.length).trim()).indexOf(" ")) > -1 ? l.substr(0, i) : l, + e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase(), + t = l.substring(i).trim(), + u.endsWith("/") && (u = u.slice(0, -1)), + "src" === e) { + switch (u.charCodeAt(0)) { + case 34: + case 39: + h = !0, + u = u.slice(1, -1) + } + a.isImage = !0, + a.src = u + } else if ("height" === e) + a.imageHeight = parseInt(u); + else if ("width" === e) + a.imageWidth = parseInt(u); + else if ("align" === e) { + switch (u.charCodeAt(0)) { + case 34: + case 39: + u = u.slice(1, -1) + } + a.imageAlign = u.toLocaleLowerCase() + } else + "offset" === e ? a.imageOffset = u : "click" === e && (a.event = this._processEventHandler(e + "=" + u)); + a.event && "param" === e && (a.event.param = u.replace(/^\"|\"$/g, "")), + o = t.match(n) + } + return h && a.isImage && this._resultObjectArray.push({ + text: "", + style: a + }), + {} + } + if (o = t.match(/^(outline(\s)*[^>]*)/)) { + var c = { + color: "#ffffff", + width: 1 + }; + if (t = o[0].substring("outline".length).trim()) { + var u, _ = /(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/; + for (o = t.match(_); o; ) + e = (t = t.substring(t.indexOf(o[0]))).substr(0, o[0].length), + u = (i = (l = t.substring(e.length).trim()).indexOf(" ")) > -1 ? l.substr(0, i) : l, + e = (e = e.replace(/[^a-zA-Z]/g, "").trim()).toLocaleLowerCase(), + t = l.substring(i).trim(), + "click" === e ? a.event = this._processEventHandler(e + "=" + u) : "color" === e ? c.color = u : "width" === e && (c.width = parseInt(u)), + a.event && "param" === e && (a.event.param = u.replace(/^\"|\"$/g, "")), + o = t.match(_) + } + a.outline = c + } + if ((o = t.match(/^(on|u|b|i)(\s)*/)) && o[0].length > 0) { + switch (e = o[0], + t = t.substring(e.length).trim(), + e[0]) { + case "u": + a.underline = !0; + break; + case "i": + a.italic = !0; + break; + case "b": + a.bold = !0 + } + if ("" === t) + return a; + r = this._processEventHandler(t), + a.event = r + } + return a + }, + _processEventHandler: function(t) { + for (var e = 0, n = {}, r = t.match(i), s = !1; r; ) { + var a = r[0] + , o = ""; + if (s = !1, + '"' === (t = t.substring(a.length).trim()).charAt(0)) + (e = t.indexOf('"', 1)) > -1 && (o = t.substring(1, e).trim(), + s = !0), + e++; + else if ("'" === t.charAt(0)) + (e = t.indexOf("'", 1)) > -1 && (o = t.substring(1, e).trim(), + s = !0), + e++; + else { + var l = t.match(/(\S)+/); + e = (o = l ? l[0] : "").length + } + s && (n[a = a.substring(0, a.length - 1).trim()] = o), + r = (t = t.substring(e).trim()).match(i) + } + return n + }, + _addToStack: function(t) { + var e = this._attributeToObject(t); + if (0 === this._stack.length) + this._stack.push(e); + else { + if (e.isNewLine || e.isImage) + return; + var i = this._stack[this._stack.length - 1]; + for (var n in i) + e[n] || (e[n] = i[n]); + this._stack.push(e) + } + }, + _processResult: function(t) { + "" !== t && (t = this._escapeSpecialSymbol(t), + this._stack.length > 0 ? this._resultObjectArray.push({ + text: t, + style: this._stack[this._stack.length - 1] + }) : this._resultObjectArray.push({ + text: t + })) + }, + _escapeSpecialSymbol: function(t) { + for (var e = 0; e < this._specialSymbolArray.length; ++e) { + var i = this._specialSymbolArray[e][0] + , n = this._specialSymbolArray[e][1]; + t = t.replace(i, n) + } + return t + } + }, + e.exports = r + } + ), {}], + 266: [(function(t) { + "use strict"; + t("./CCPath"), + t("./profiler/CCProfiler"), + t("./find"), + t("./mutable-forward-iterator") + } + ), { + "./CCPath": 257, + "./find": 263, + "./mutable-forward-iterator": 268, + "./profiler/CCProfiler": 271 + }], + 267: [(function(t, e) { + "use strict"; + for (var i = t("../platform/js"), n = { + propertyDefine: function(t, e, n) { + function r(t, e, n, r) { + var s = Object.getOwnPropertyDescriptor(t, e); + if (s) + s.get && (t[n] = s.get), + s.set && r && (t[r] = s.set); + else { + var a = t[n]; + i.getset(t, e, a, t[r]) + } + } + for (var s, a = t.prototype, o = 0; o < e.length; o++) { + var l = (s = e[o])[0].toUpperCase() + s.slice(1); + r(a, s, "get" + l, "set" + l) + } + for (s in n) { + var h = n[s]; + r(a, s, h[0], h[1]) + } + }, + NextPOT: function(t) { + return t -= 1, + t |= t >> 1, + t |= t >> 2, + t |= t >> 4, + t |= t >> 8, + 1 + (t |= t >> 16) + }, + BUILTIN_CLASSID_RE: /^(?:cc|dragonBones|sp|ccsg)\..+/ + }, r = new Array(123), s = 0; s < 123; ++s) + r[s] = 64; + for (var a = 0; a < 64; ++a) + r["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(a)] = a; + n.BASE64_VALUES = r, + n.pushToMap = function(t, e, i, n) { + var r = t[e]; + r ? Array.isArray(r) ? n ? (r.push(r[0]), + r[0] = i) : r.push(i) : t[e] = n ? [i, r] : [r, i] : t[e] = i + } + , + n.clampf = function(t, e, i) { + if (e > i) { + var n = e; + e = i, + i = n + } + return t < e ? e : t < i ? t : i + } + , + n.clamp01 = function(t) { + return t < 0 ? 0 : t < 1 ? t : 1 + } + , + n.lerp = function(t, e, i) { + return t + (e - t) * i + } + , + n.degreesToRadians = function(t) { + return t * cc.macro.RAD + } + , + n.radiansToDegrees = function(t) { + return t * cc.macro.DEG + } + , + cc.misc = e.exports = n + } + ), { + "../platform/js": 214 + }], + 268: [(function(t, e) { + "use strict"; + function i(t) { + this.i = 0, + this.array = t + } + var n = i.prototype; + n.remove = function(t) { + var e = this.array.indexOf(t); + e >= 0 && this.removeAt(e) + } + , + n.removeAt = function(t) { + this.array.splice(t, 1), + t <= this.i && --this.i + } + , + n.fastRemove = function(t) { + var e = this.array.indexOf(t); + e >= 0 && this.fastRemoveAt(e) + } + , + n.fastRemoveAt = function(t) { + var e = this.array; + e[t] = e[e.length - 1], + --e.length, + t <= this.i && --this.i + } + , + n.push = function(t) { + this.array.push(t) + } + , + e.exports = i + } + ), {}], + 269: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = (function() { + function t() { + this.enabled = !1, + this.count = 0, + this.maxSize = 1024 + } + var e = t.prototype; + return e.get = function() {} + , + e.put = function() {} + , + e.clear = function() {} + , + t + } + )(); + i.default = n, + cc.pool = {}, + n.register = function(t, e) { + cc.pool[t] = e + } + , + e.exports = i.default + } + ), {}], + 270: [(function(t, e) { + "use strict"; + cc._PrefabInfo = cc.Class({ + name: "cc.PrefabInfo", + properties: { + root: null, + asset: null, + fileId: "", + sync: !1 + } + }), + e.exports = { + syncWithPrefab: function(t) { + var e = t._prefab; + if (!e.asset) + return cc.errorID(3701, t.name), + void (t._prefab = null); + var i = t._objFlags + , n = t._parent + , r = t._id + , s = t._name + , a = t._active + , o = t._eulerAngles.x + , l = t._eulerAngles.y + , h = t._eulerAngles.z + , c = t._localZOrder + , u = t._trs + , _ = u[0] + , f = u[1] + , d = u[2]; + cc.game._isCloning = !0, + e.asset._doInstantiate(t), + cc.game._isCloning = !1, + t._objFlags = i, + t._parent = n, + t._id = r, + t._prefab = e, + t._name = s, + t._active = a, + t._localZOrder = c, + (u = t._trs)[0] = _, + u[1] = f, + u[2] = d, + t._eulerAngles.x = o, + t._eulerAngles.y = l, + t._eulerAngles.z = h + } + } + } + ), {}], + 271: [(function(t, e) { + "use strict"; + var i = t("../../platform/CCMacro") + , n = t("./perf-counter") + , r = !1 + , s = 15 + , a = null + , o = null + , l = null; + function h() { + if (!a) { + a = { + fps: { + desc: "Framerate (FPS)", + below: 30, + average: 500 + }, + draws: { + desc: "Draw Call" + }, + frame: { + desc: "Frame time (ms)", + min: 0, + max: 50, + average: 500 + }, + logic: { + desc: "Game Logic (ms)", + min: 0, + max: 50, + average: 500, + color: "#080" + }, + render: { + desc: "Renderer (ms)", + min: 0, + max: 50, + average: 500, + color: "#f90" + }, + mode: { + desc: cc.game.renderType === cc.game.RENDER_TYPE_WEBGL ? "WebGL" : "Canvas", + min: 1 + } + }; + var t = performance.now(); + for (var e in a) + a[e]._counter = new n(e,a[e],t) + } + } + function c() { + if (!o || !o.isValid) { + (o = new cc.Node("PROFILER-NODE")).x = o.y = 10, + o.groupIndex = cc.Node.BuiltinGroupIndex.DEBUG, + cc.Camera._setupDebugCamera(), + o.zIndex = i.MAX_ZINDEX, + cc.game.addPersistRootNode(o); + var t = new cc.Node("LEFT-PANEL"); + t.anchorX = t.anchorY = 0; + var e = t.addComponent(cc.Label); + e.fontSize = s, + e.lineHeight = s, + t.parent = o; + var n = new cc.Node("RIGHT-PANEL"); + n.anchorX = 1, + n.anchorY = 0, + n.x = 200; + var r = n.addComponent(cc.Label); + r.horizontalAlign = cc.Label.HorizontalAlign.RIGHT, + r.fontSize = s, + r.lineHeight = s, + n.parent = o, + cc.sys.platform !== cc.sys.BAIDU_GAME_SUB && cc.sys.platform !== cc.sys.WECHAT_GAME_SUB && (e.cacheMode = cc.Label.CacheMode.CHAR, + r.cacheMode = cc.Label.CacheMode.CHAR), + l = { + left: e, + right: r + } + } + } + function u() { + c(); + var t = cc.director._lastUpdate; + a.frame._counter.start(t), + a.logic._counter.start(t) + } + function _() { + var t = performance.now(); + cc.director.isPaused() ? a.frame._counter.start(t) : a.logic._counter.end(t), + a.render._counter.start(t) + } + function f() { + var t = performance.now(); + a.render._counter.end(t), + a.draws._counter.value = cc.renderer.drawCalls, + a.frame._counter.end(t), + a.fps._counter.frame(t); + var e = "" + , i = ""; + for (var n in a) { + var r = a[n]; + r._counter.sample(t), + e += r.desc + "\n", + i += r._counter.human() + "\n" + } + l && (l.left.string = e, + l.right.string = i) + } + cc.profiler = e.exports = { + isShowingStats: function() { + return r + }, + hideStats: function() { + r && (o && (o.active = !1), + cc.director.off(cc.Director.EVENT_BEFORE_UPDATE, u), + cc.director.off(cc.Director.EVENT_AFTER_UPDATE, _), + cc.director.off(cc.Director.EVENT_AFTER_DRAW, f), + r = !1) + }, + showStats: function() { + r || (h(), + o && (o.active = !0), + cc.director.on(cc.Director.EVENT_BEFORE_UPDATE, u), + cc.director.on(cc.Director.EVENT_AFTER_UPDATE, _), + cc.director.on(cc.Director.EVENT_AFTER_DRAW, f), + r = !0) + } + } + } + ), { + "../../platform/CCMacro": 198, + "./perf-counter": 273 + }], + 272: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.Counter", + ctor: function(t, e, i) { + this._id = t, + this._opts = e || {}, + this._value = 0, + this._total = 0, + this._averageValue = 0, + this._accumValue = 0, + this._accumSamples = 0, + this._accumStart = i + }, + properties: { + value: { + get: function() { + return this._value + }, + set: function(t) { + this._value = t + } + } + }, + _average: function(t, e) { + if (this._opts.average) { + this._accumValue += t, + ++this._accumSamples; + var i = e; + i - this._accumStart >= this._opts.average && (this._averageValue = this._accumValue / this._accumSamples, + this._accumValue = 0, + this._accumStart = i, + this._accumSamples = 0) + } + }, + sample: function(t) { + this._average(this._value, t) + }, + human: function() { + var t = this._opts.average ? this._averageValue : this._value; + return Math.round(100 * t) / 100 + }, + alarm: function() { + return this._opts.below && this._value < this._opts.below || this._opts.over && this._value > this._opts.over + } + }); + e.exports = i + } + ), {}], + 273: [(function(t, e) { + "use strict"; + var i = t("./counter") + , n = cc.Class({ + name: "cc.PerfCounter", + extends: i, + ctor: function(t, e, i) { + this._time = i + }, + start: function(t) { + this._time = t + }, + end: function(t) { + this._value = t - this._time, + this._average(this._value) + }, + tick: function() { + this.end(), + this.start() + }, + frame: function(t) { + var e = t + , i = e - this._time; + this._total++, + i > (this._opts.average || 1e3) && (this._value = 1e3 * this._total / i, + this._total = 0, + this._time = e, + this._average(this._value)) + } + }); + e.exports = n + } + ), { + "./counter": 272 + }], + 274: [(function(t, e) { + "use strict"; + var i, n = new (((i = t("../platform/js")) && i.__esModule ? i : { + default: i + }).default.Pool)(2); + function r(t) { + this.count = 0, + this.limit = t, + this.datas = {}, + this.head = null, + this.tail = null + } + n.get = function() { + return this._get() || { + key: null, + value: null, + prev: null, + next: null + } + } + , + r.prototype.moveToHead = function(t) { + t.next = this.head, + t.prev = null, + null !== this.head && (this.head.prev = t), + this.head = t, + null === this.tail && (this.tail = t), + this.count++, + this.datas[t.key] = t + } + , + r.prototype.put = function(t, e) { + var i = n.get(); + if (i.key = t, + i.value = e, + this.count >= this.limit) { + var r = this.tail; + delete this.datas[r.key], + this.count--, + this.tail = r.prev, + this.tail.next = null, + r.prev = null, + r.next = null, + n.put(r) + } + this.moveToHead(i) + } + , + r.prototype.remove = function(t) { + null !== t.prev ? t.prev.next = t.next : this.head = t.next, + null !== t.next ? t.next.prev = t.prev : this.tail = t.prev, + delete this.datas[t.key], + this.count-- + } + , + r.prototype.get = function(t) { + var e = this.datas[t]; + return e ? (this.remove(e), + this.moveToHead(e), + e.value) : null + } + , + r.prototype.clear = function() { + this.count = 0, + this.datas = {}, + this.head = null, + this.tail = null + } + , + r.prototype.has = function(t) { + return !!this.datas[t] + } + , + r.prototype.delete = function(t) { + var e = this.datas[t]; + this.remove(e) + } + ; + var s = new r(100) + , a = { + BASELINE_RATIO: .26, + MIDDLE_RATIO: .37, + BASELINE_OFFSET: 0, + label_wordRex: /([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430-\u044f\u0410-\u042f\u0401\u0451]+|\S)/, + label_symbolRex: /^[!,.:;'}\]%\?>\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/, + label_lastWordRex: /([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+|\S)$/, + label_lastEnglish: /[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+$/, + label_firstEnglish: /^[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]/, + highSurrogateRex: /[\uD800-\uDBFF]/, + lowSurrogateRex: /[\uDC00-\uDFFF]/, + label_wrapinspection: !0, + __CHINESE_REG: /^[\u4E00-\u9FFF\u3400-\u4DFF]+$/, + __JAPANESE_REG: /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g, + __KOREAN_REG: /^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/, + isUnicodeCJK: function(t) { + return this.__CHINESE_REG.test(t) || this.__JAPANESE_REG.test(t) || this.__KOREAN_REG.test(t) + }, + isUnicodeSpace: function(t) { + return (t = t.charCodeAt(0)) >= 9 && t <= 13 || 32 === t || 133 === t || 160 === t || 5760 === t || t >= 8192 && t <= 8202 || 8232 === t || 8233 === t || 8239 === t || 8287 === t || 12288 === t + }, + safeMeasureText: function(t, e, i) { + var n = (i || t.font) + "\ud83c\udfae" + e + , r = s.get(n); + if (null !== r) + return r; + var a = t.measureText(e) + , o = a && a.width || 0; + return s.put(n, o), + o + }, + _safeSubstring: function(t, e, i) { + var n = e + , r = i + , s = t[e]; + if (this.lowSurrogateRex.test(s) && n--, + void 0 !== i) + if (i - 1 !== e) { + var a = t[i - 1]; + this.highSurrogateRex.test(a) && r-- + } else + this.highSurrogateRex.test(s) && r++; + return t.substring(n, r) + }, + fragmentText: function(t, e, i, n) { + var r = []; + if (0 === t.length || i < 0) + return r.push(""), + r; + for (var s = t; e > i && s.length > 1; ) { + for (var a = s.length * (i / e) | 0, o = this._safeSubstring(s, a), l = e - n(o), h = o, c = 0, u = 0; l > i && u++ < 10; ) + a *= i / l, + a |= 0, + l = e - n(o = this._safeSubstring(s, a)); + for (u = 0; l <= i && u++ < 10; ) { + if (o) { + var _ = this.label_wordRex.exec(o); + c = _ ? _[0].length : 1, + h = o + } + a += c, + l = e - n(o = this._safeSubstring(s, a)) + } + 0 == (a -= c) ? (a = 1, + h = this._safeSubstring(s, 1)) : 1 === a && this.highSurrogateRex.test(s[0]) && (a = 2, + h = this._safeSubstring(s, 2)); + var f, d = this._safeSubstring(s, 0, a); + this.label_wrapinspection && this.label_symbolRex.test(h || o) && (0 == (a -= (f = this.label_lastWordRex.exec(d)) ? f[0].length : 0) && (a = 1), + h = this._safeSubstring(s, a), + d = this._safeSubstring(s, 0, a)), + this.label_firstEnglish.test(h) && (f = this.label_lastEnglish.exec(d)) && d !== f[0] && (a -= f[0].length, + h = this._safeSubstring(s, a), + d = this._safeSubstring(s, 0, a)), + 0 === r.length ? r.push(d) : (d = d.trimLeft()).length > 0 && r.push(d), + e = n(s = h || o) + } + return 0 === r.length ? r.push(s) : (s = s.trimLeft()).length > 0 && r.push(s), + r + } + }; + cc.textUtils = e.exports = a + } + ), { + "../platform/js": 214 + }], + 275: [(function(t, e) { + "use strict"; + var i = t("../assets/CCTexture2D") + , n = { + loadImage: function(t, e, i) { + cc.assertID(t, 3103); + var n = cc.assetManager.assets.get(t); + if (n) + return n.loaded ? (e && e.call(i, null, n), + n) : (n.once("load", (function() { + e && e.call(i, null, n) + } + ), i), + n); + cc.assetManager.loadRemote(t, (function(t, n) { + e && e.call(i, t, n) + } + )) + }, + cacheImage: function(t, e) { + if (t && e) { + var n = new i; + return n.initWithElement(e), + cc.assetManager.assets.add(t, n), + n + } + }, + postLoadTexture: function(t, e) { + t.loaded ? e && e() : t.nativeUrl ? cc.assetManager.postLoadNative(t, e) : e && e() + } + }; + e.exports = n + } + ), { + "../assets/CCTexture2D": 77 + }], + 276: [(function(t, e) { + "use strict"; + var i = t("./node-unit") + , n = t("./node-mem-pool"); + e.exports = { + NodeMemPool: new n(i) + } + } + ), { + "./node-mem-pool": 278, + "./node-unit": 279 + }], + 277: [(function(t, e) { + "use strict"; + var i = function(t) { + this._unitClass = t, + this._pool = [], + this._findOrder = [] + } + , n = i.prototype; + n._initNative = function() { + this._nativeMemPool = new renderer.MemPool + } + , + n._buildUnit = function(t) { + return new this._unitClass(t,this) + } + , + n._destroyUnit = function(t) { + this._pool[t] = null; + for (var e = 0, i = this._findOrder.length; e < i; e++) { + var n = this._findOrder[e]; + if (n && n.unitID == t) { + this._findOrder.splice(e, 1); + break + } + } + } + , + n._findUnitID = function() { + for (var t = 0, e = this._pool; e[t]; ) + t++; + return t + } + , + n.pop = function() { + for (var t = null, e = 0, i = this._findOrder, n = this._pool, r = i.length; e < r; e++) { + var s = i[e]; + if (s && s.hasSpace()) { + t = s; + break + } + } + if (!t) { + var a = this._findUnitID(); + t = this._buildUnit(a), + n[a] = t, + i.push(t), + e = i.length - 1 + } + var o = i[0]; + return o !== t && (i[0] = t, + i[e] = o), + t.pop() + } + , + n.push = function(t) { + var e = this._pool[t.unitID]; + return e.push(t.index), + this._findOrder.length > 1 && e.isAllFree() && this._destroyUnit(t.unitID), + e + } + , + e.exports = i + } + ), {}], + 278: [(function(t, e) { + "use strict"; + var i, n = t("./mem-pool"), r = function(t) { + n.call(this, t) + }; + (i = function() {} + ).prototype = n.prototype; + var s = r.prototype = new i; + s._initNative = function() { + this._nativeMemPool = new renderer.NodeMemPool + } + , + s._destroyUnit = function(t) { + n.prototype._destroyUnit.call(this, t) + } + , + e.exports = r + } + ), { + "./mem-pool": 277 + }], + 279: [(function(t, e) { + "use strict"; + var i, n = t("../../value-types/utils"), r = (Uint32Array, + 10 * n.FLOAT_BYTES), s = 16 * n.FLOAT_BYTES, a = 16 * n.FLOAT_BYTES, o = (Uint32Array, + Uint32Array, + Int32Array, + Uint8Array, + Uint8Array, + Uint32Array, + n.FLOAT_BYTES, + t("./unit-base")), l = function(t, e) { + o.call(this, t, e); + var i = this._contentNum; + this.trsList = new n.FLOAT_ARRAY_TYPE(10 * i), + this.localMatList = new n.FLOAT_ARRAY_TYPE(16 * i), + this.worldMatList = new n.FLOAT_ARRAY_TYPE(16 * i); + for (var l = 0; l < i; l++) { + var h = this._spacesData[l]; + h.trs = new n.FLOAT_ARRAY_TYPE(this.trsList.buffer,l * r,10), + h.localMat = new n.FLOAT_ARRAY_TYPE(this.localMatList.buffer,l * s,16), + h.worldMat = new n.FLOAT_ARRAY_TYPE(this.worldMatList.buffer,l * a,16) + } + }; + (i = function() {} + ).prototype = o.prototype, + l.prototype = new i, + e.exports = l + } + ), { + "../../value-types/utils": 289, + "./unit-base": 280 + }], + 280: [(function(t, e) { + "use strict"; + var i = function(t, e, i) { + i = i || 128, + this.unitID = t, + this._memPool = e, + this._data = new Uint16Array(2), + this._data[0] = 0, + this._data[1] = 0, + this._contentNum = i, + this._signData = new Uint16Array(2 * this._contentNum), + this._spacesData = []; + for (var n = 0; n < i; n++) { + var r = 2 * n; + this._signData[r + 0] = n + 1, + this._signData[r + 1] = 0, + this._spacesData[n] = { + index: n, + unitID: t + } + } + this._signData[2 * (i - 1)] = 65535 + } + , n = i.prototype; + n.hasSpace = function() { + return 65535 !== this._data[0] + } + , + n.isAllFree = function() { + return 0 == this._data[1] + } + , + n.pop = function() { + var t = this._data[0]; + if (65535 === t) + return null; + var e = t + , i = 2 * e + , n = this._spacesData[e]; + return this._signData[i + 1] = 1, + this._data[0] = this._signData[i + 0], + this._data[1]++, + n + } + , + n.push = function(t) { + var e = 2 * t; + this._signData[e + 1] = 0, + this._signData[e + 0] = this._data[0], + this._data[0] = t, + this._data[1]-- + } + , + n.dump = function() { + for (var t = 0, e = this._data[0], i = ""; 65535 != e; ) + t++, + i += e + "->", + e = this._signData[2 * e + 0]; + for (var n = 0, r = "", s = this._contentNum, a = 0; a < s; a++) + 1 == this._signData[2 * a + 1] && (n++, + r += a + "->"); + var o = t + n; + console.log("unitID:", this.unitID, "spaceNum:", t, "calc using num:", n, "store using num:", this._data[1], "calc total num:", o, "actually total num:", this._contentNum), + console.log("free info:", i), + console.log("using info:", r), + n != this._data[1] && cc.error("using num error", "calc using num:", n, "store using num:", this._data[1]), + t + n != this._contentNum && cc.error("total num error", "calc total num:", o, "actually total num:", this._contentNum) + } + , + e.exports = i + } + ), {}], + 281: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = a(t("./value-type")) + , r = a(t("../platform/CCClass")) + , s = a(t("../utils/misc")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + function o(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function l(t, e) { + return (l = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var h = (function(t) { + var e, i; + function n(e, i, n, r) { + var s; + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 255), + (s = t.call(this) || this)._val = 0, + "object" == typeof e && (i = e.g, + n = e.b, + r = e.a, + e = e.r), + s._val = (r << 24 >>> 0) + (n << 16) + (i << 8) + (0 | e), + s + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + l(e, i), + n.copy = function(t, e) { + return t.r = e.r, + t.g = e.g, + t.b = e.b, + t.a = e.a, + t + } + , + n.clone = function(t) { + return new n(t.r,t.g,t.b,t.a) + } + , + n.set = function(t, e, i, n, r) { + return void 0 === e && (e = 255), + void 0 === i && (i = 255), + void 0 === n && (n = 255), + void 0 === r && (r = 255), + t.r = e, + t.g = i, + t.b = n, + t.a = r, + t + } + , + n.fromHex = function(t, e) { + var i = (e >> 24) / 255 + , n = (e >> 16 & 255) / 255 + , r = (e >> 8 & 255) / 255 + , s = (255 & e) / 255; + return t.r = i, + t.g = n, + t.b = r, + t.a = s, + t + } + , + n.fromHEX = function(t, e) { + return e = 0 === e.indexOf("#") ? e.substring(1) : e, + t.r = parseInt(e.substr(0, 2), 16) || 0, + t.g = parseInt(e.substr(2, 2), 16) || 0, + t.b = parseInt(e.substr(4, 2), 16) || 0, + t.a = parseInt(e.substr(6, 2), 16) || 255, + t._val = (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r, + t + } + , + n.add = function(t, e, i) { + return t.r = e.r + i.r, + t.g = e.g + i.g, + t.b = e.b + i.b, + t.a = e.a + i.a, + t + } + , + n.subtract = function(t, e, i) { + return t.r = e.r - i.r, + t.g = e.g - i.g, + t.b = e.b - i.b, + t.a = e.a - i.a, + t + } + , + n.multiply = function(t, e, i) { + return t.r = e.r * i.r, + t.g = e.g * i.g, + t.b = e.b * i.b, + t.a = e.a * i.a, + t + } + , + n.divide = function(t, e, i) { + return t.r = e.r / i.r, + t.g = e.g / i.g, + t.b = e.b / i.b, + t.a = e.a / i.a, + t + } + , + n.scale = function(t, e, i) { + return t.r = e.r * i, + t.g = e.g * i, + t.b = e.b * i, + t.a = e.a * i, + t + } + , + n.lerp = function(t, e, i, n) { + var r = e.r + , s = e.g + , a = e.b + , o = e.a; + return t.r = r + n * (i.r - r), + t.g = s + n * (i.g - s), + t.b = a + n * (i.b - a), + t.a = o + n * (i.a - o), + t + } + , + n.toArray = function(t, e, i) { + void 0 === i && (i = 0); + var r = e instanceof n || e.a > 1 ? 1 / 255 : 1; + return t[i + 0] = e.r * r, + t[i + 1] = e.g * r, + t[i + 2] = e.b * r, + t[i + 3] = e.a * r, + t + } + , + n.fromArray = function(t, e, i) { + return void 0 === i && (i = 0), + e.r = 255 * t[i + 0], + e.g = 255 * t[i + 1], + e.b = 255 * t[i + 2], + e.a = 255 * t[i + 3], + e + } + , + n.premultiplyAlpha = function(t, e) { + var i = e.a / 255; + return t.r = e.r * i, + t.g = e.g * i, + t.b = e.b * i, + t._fastSetA(e.a), + t + } + ; + var r, a, h, c = n.prototype; + return c.clone = function() { + var t = new n; + return t._val = this._val, + t + } + , + c.equals = function(t) { + return t && this._val === t._val + } + , + c.lerp = function(t, e, i) { + i = i || new n; + var r = this.r + , s = this.g + , a = this.b + , o = this.a; + return i.r = r + (t.r - r) * e, + i.g = s + (t.g - s) * e, + i.b = a + (t.b - a) * e, + i.a = o + (t.a - o) * e, + i + } + , + c.toString = function() { + return "rgba(" + this.r.toFixed() + ", " + this.g.toFixed() + ", " + this.b.toFixed() + ", " + this.a.toFixed() + ")" + } + , + c.getR = function() { + return 255 & this._val + } + , + c.setR = function(t) { + return t = ~~s.default.clampf(t, 0, 255), + this._val = (4294967040 & this._val | t) >>> 0, + this + } + , + c.getG = function() { + return (65280 & this._val) >> 8 + } + , + c.setG = function(t) { + return t = ~~s.default.clampf(t, 0, 255), + this._val = (4294902015 & this._val | t << 8) >>> 0, + this + } + , + c.getB = function() { + return (16711680 & this._val) >> 16 + } + , + c.setB = function(t) { + return t = ~~s.default.clampf(t, 0, 255), + this._val = (4278255615 & this._val | t << 16) >>> 0, + this + } + , + c.getA = function() { + return (4278190080 & this._val) >>> 24 + } + , + c.setA = function(t) { + return t = ~~s.default.clampf(t, 0, 255), + this._val = (16777215 & this._val | t << 24) >>> 0, + this + } + , + c.toCSS = function(t) { + return t && "rgba" !== t ? "rgb" === t ? "rgb(" + this.r + "," + this.g + "," + this.b + ")" : "#" + this.toHEX(t) : "rgba(" + this.r + "," + this.g + "," + this.b + "," + (this.a / 255).toFixed(2) + ")" + } + , + c.fromHEX = function(t) { + t = 0 === t.indexOf("#") ? t.substring(1) : t; + var e = parseInt(t.substr(0, 2), 16) || 0 + , i = parseInt(t.substr(2, 2), 16) || 0 + , n = parseInt(t.substr(4, 2), 16) || 0 + , r = parseInt(t.substr(6, 2), 16) || 255; + return this._val = (r << 24 >>> 0) + (n << 16) + (i << 8) + e, + this + } + , + c.toHEX = function(t) { + var e = [(this.r < 16 ? "0" : "") + this.r.toString(16), (this.g < 16 ? "0" : "") + this.g.toString(16), (this.b < 16 ? "0" : "") + this.b.toString(16)]; + return "#rgb" === t ? (e[0] = e[0][0], + e[1] = e[1][0], + e[2] = e[2][0]) : "#rrggbbaa" === t && e.push((this.a < 16 ? "0" : "") + this.a.toString(16)), + e.join("") + } + , + c.toRGBValue = function() { + return 16777215 & this._val + } + , + c.fromHSV = function(t, e, i) { + var n, r, s; + if (0 === e) + n = r = s = i; + else if (0 === i) + n = r = s = 0; + else { + 1 === t && (t = 0), + t *= 6; + var a = Math.floor(t) + , o = t - a + , l = i * (1 - e) + , h = i * (1 - e * o) + , c = i * (1 - e * (1 - o)); + switch (a) { + case 0: + n = i, + r = c, + s = l; + break; + case 1: + n = h, + r = i, + s = l; + break; + case 2: + n = l, + r = i, + s = c; + break; + case 3: + n = l, + r = h, + s = i; + break; + case 4: + n = c, + r = l, + s = i; + break; + case 5: + n = i, + r = l, + s = h + } + } + return n *= 255, + r *= 255, + s *= 255, + this._val = (this.a << 24 >>> 0) + (s << 16) + (r << 8) + (0 | n), + this + } + , + c.toHSV = function() { + var t = this.r / 255 + , e = this.g / 255 + , i = this.b / 255 + , n = { + h: 0, + s: 0, + v: 0 + } + , r = Math.max(t, e, i) + , s = Math.min(t, e, i) + , a = 0; + return n.v = r, + n.s = r ? (r - s) / r : 0, + n.s ? (a = r - s, + n.h = t === r ? (e - i) / a : e === r ? 2 + (i - t) / a : 4 + (t - e) / a, + n.h /= 6, + n.h < 0 && (n.h += 1)) : n.h = 0, + n + } + , + c.set = function(t) { + return t._val ? this._val = t._val : (this.r = t.r, + this.g = t.g, + this.b = t.b, + this.a = t.a), + this + } + , + c._fastSetA = function(t) { + this._val = (16777215 & this._val | t << 24) >>> 0 + } + , + c.multiply = function(t) { + var e = (255 & this._val) * t.r >> 8 + , i = (65280 & this._val) * t.g >> 8 + , n = (16711680 & this._val) * t.b >> 8 + , r = ((4278190080 & this._val) >>> 8) * t.a; + return this._val = 4278190080 & r | 16711680 & n | 65280 & i | 255 & e, + this + } + , + r = n, + h = [{ + key: "WHITE", + get: function() { + return new n(255,255,255,255) + } + }, { + key: "BLACK", + get: function() { + return new n(0,0,0,255) + } + }, { + key: "TRANSPARENT", + get: function() { + return new n(0,0,0,0) + } + }, { + key: "GRAY", + get: function() { + return new n(127.5,127.5,127.5) + } + }, { + key: "RED", + get: function() { + return new n(255,0,0) + } + }, { + key: "GREEN", + get: function() { + return new n(0,255,0) + } + }, { + key: "BLUE", + get: function() { + return new n(0,0,255) + } + }, { + key: "YELLOW", + get: function() { + return new n(255,235,4) + } + }, { + key: "ORANGE", + get: function() { + return new n(255,127,0) + } + }, { + key: "CYAN", + get: function() { + return new n(0,255,255) + } + }, { + key: "MAGENTA", + get: function() { + return new n(255,0,255) + } + }], + (a = [{ + key: "r", + get: function() { + return this.getR() + }, + set: function(t) { + this.setR(t) + } + }, { + key: "g", + get: function() { + return this.getG() + }, + set: function(t) { + this.setG(t) + } + }, { + key: "b", + get: function() { + return this.getB() + }, + set: function(t) { + this.setB(t) + } + }, { + key: "a", + get: function() { + return this.getA() + }, + set: function(t) { + this.setA(t) + } + }]) && o(r.prototype, a), + h && o(r, h), + n + } + )(n.default); + i.default = h, + h.div = h.divide, + h.sub = h.subtract, + h.mul = h.multiply, + h.WHITE_R = h.WHITE, + h.BLACK_R = h.BLACK, + h.TRANSPARENT_R = h.TRANSPARENT, + h.GRAY_R = h.GRAY, + h.RED_R = h.RED, + h.GREEN_R = h.GREEN, + h.BLUE_R = h.BLUE, + h.YELLOW_R = h.YELLOW, + h.ORANGE_R = h.ORANGE, + h.CYAN_R = h.CYAN, + h.MAGENTA_R = h.MAGENTA, + r.default.fastDefine("cc.Color", h, { + r: 0, + g: 0, + b: 0, + a: 255 + }), + cc.Color = h, + cc.color = function(t, e, i, n) { + return "string" == typeof t ? (new h).fromHEX(t) : "object" == typeof t ? new h(t.r,t.g,t.b,t.a) : new h(t,e,i,n) + } + , + e.exports = i.default + } + ), { + "../platform/CCClass": 193, + "../utils/misc": 267, + "./value-type": 290 + }], + 282: [(function(t, e, i) { + "use strict"; + i.__esModule = !0; + var n = { + Vec2: !0, + Vec3: !0, + Vec4: !0, + Mat4: !0, + Mat3: !0, + Rect: !0, + Size: !0, + Color: !0, + Quat: !0, + Trs: !0 + }; + i.Trs = i.Quat = i.Color = i.Size = i.Rect = i.Mat3 = i.Mat4 = i.Vec4 = i.Vec3 = i.Vec2 = void 0; + var r = p(t("./vec2")); + i.Vec2 = r.default; + var s = p(t("./vec3")); + i.Vec3 = s.default; + var a = p(t("./vec4")); + i.Vec4 = a.default; + var o = p(t("./mat4")); + i.Mat4 = o.default; + var l = p(t("./mat3")); + i.Mat3 = l.default; + var h = p(t("./rect")); + i.Rect = h.default; + var c = p(t("./size")); + i.Size = c.default; + var u = p(t("./color")); + i.Color = u.default; + var _ = p(t("./quat")); + i.Quat = _.default; + var f = p(t("./trs")); + i.Trs = f.default; + var d = t("./utils"); + function p(t) { + return t && t.__esModule ? t : { + default: t + } + } + Object.keys(d).forEach((function(t) { + "default" !== t && "__esModule" !== t && (Object.prototype.hasOwnProperty.call(n, t) || t in i && i[t] === d[t] || (i[t] = d[t])) + } + )), + cc.math = e.exports + } + ), { + "./color": 281, + "./mat3": 283, + "./mat4": 284, + "./quat": 285, + "./rect": 286, + "./size": 287, + "./trs": 288, + "./utils": 289, + "./vec2": 291, + "./vec3": 292, + "./vec4": 293 + }], + 283: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../value-types/utils"), s = (n = t("./vec3")) && n.__esModule ? n : { + default: n + }, a = (function() { + function t(t, e, i, n, s, a, o, l, h) { + if (void 0 === t && (t = 1), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === s && (s = 1), + void 0 === a && (a = 0), + void 0 === o && (o = 0), + void 0 === l && (l = 0), + void 0 === h && (h = 1), + this.m = void 0, + t instanceof r.FLOAT_ARRAY_TYPE) + this.m = t; + else { + this.m = new r.FLOAT_ARRAY_TYPE(9); + var c = this.m; + c[0] = t, + c[1] = e, + c[2] = i, + c[3] = n, + c[4] = s, + c[5] = a, + c[6] = o, + c[7] = l, + c[8] = h + } + } + return t.create = function(e, i, n, r, s, a, o, l, h) { + return void 0 === e && (e = 1), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 0), + void 0 === s && (s = 1), + void 0 === a && (a = 0), + void 0 === o && (o = 0), + void 0 === l && (l = 0), + void 0 === h && (h = 1), + new t(e,i,n,r,s,a,o,l,h) + } + , + t.clone = function(e) { + var i = e.m; + return new t(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8]) + } + , + t.copy = function(t, e) { + return t.m.set(e.m), + t + } + , + t.set = function(t, e, i, n, r, s, a, o, l, h) { + var c = t.m; + return c[0] = e, + c[1] = i, + c[2] = n, + c[3] = r, + c[4] = s, + c[5] = a, + c[6] = o, + c[7] = l, + c[8] = h, + t + } + , + t.identity = function(t) { + var e = t.m; + return e[0] = 1, + e[1] = 0, + e[2] = 0, + e[3] = 0, + e[4] = 1, + e[5] = 0, + e[6] = 0, + e[7] = 0, + e[8] = 1, + t + } + , + t.transpose = function(t, e) { + var i = e.m + , n = t.m; + if (t === e) { + var r = i[1] + , s = i[2] + , a = i[5]; + n[1] = i[3], + n[2] = i[6], + n[3] = r, + n[5] = i[7], + n[6] = s, + n[7] = a + } else + n[0] = i[0], + n[1] = i[3], + n[2] = i[6], + n[3] = i[1], + n[4] = i[4], + n[5] = i[7], + n[6] = i[2], + n[7] = i[5], + n[8] = i[8]; + return t + } + , + t.invert = function(t, e) { + var i = e.m + , n = t.m + , r = i[0] + , s = i[1] + , a = i[2] + , o = i[3] + , l = i[4] + , h = i[5] + , c = i[6] + , u = i[7] + , _ = i[8] + , f = _ * l - h * u + , d = -_ * o + h * c + , p = u * o - l * c + , m = r * f + s * d + a * p; + return m ? (m = 1 / m, + n[0] = f * m, + n[1] = (-_ * s + a * u) * m, + n[2] = (h * s - a * l) * m, + n[3] = d * m, + n[4] = (_ * r - a * c) * m, + n[5] = (-h * r + a * o) * m, + n[6] = p * m, + n[7] = (-u * r + s * c) * m, + n[8] = (l * r - s * o) * m, + t) : t + } + , + t.adjoint = function(t, e) { + var i = e.m + , n = t.m + , r = i[0] + , s = i[1] + , a = i[2] + , o = i[3] + , l = i[4] + , h = i[5] + , c = i[6] + , u = i[7] + , _ = i[8]; + return n[0] = l * _ - h * u, + n[1] = a * u - s * _, + n[2] = s * h - a * l, + n[3] = h * c - o * _, + n[4] = r * _ - a * c, + n[5] = a * o - r * h, + n[6] = o * u - l * c, + n[7] = s * c - r * u, + n[8] = r * l - s * o, + t + } + , + t.determinant = function(t) { + var e = t.m + , i = e[0] + , n = e[1] + , r = e[2] + , s = e[3] + , a = e[4] + , o = e[5] + , l = e[6] + , h = e[7] + , c = e[8]; + return i * (c * a - o * h) + n * (-c * s + o * l) + r * (h * s - a * l) + } + , + t.multiply = function(t, e, i) { + var n = e.m + , r = i.m + , s = t.m + , a = n[0] + , o = n[1] + , l = n[2] + , h = n[3] + , c = n[4] + , u = n[5] + , _ = n[6] + , f = n[7] + , d = n[8] + , p = r[0] + , m = r[1] + , y = r[2] + , v = r[3] + , g = r[4] + , A = r[5] + , x = r[6] + , b = r[7] + , C = r[8]; + return s[0] = p * a + m * h + y * _, + s[1] = p * o + m * c + y * f, + s[2] = p * l + m * u + y * d, + s[3] = v * a + g * h + A * _, + s[4] = v * o + g * c + A * f, + s[5] = v * l + g * u + A * d, + s[6] = x * a + b * h + C * _, + s[7] = x * o + b * c + C * f, + s[8] = x * l + b * u + C * d, + t + } + , + t.multiplyMat4 = function(t, e, i) { + var n = e.m + , r = i.m + , s = t.m + , a = n[0] + , o = n[1] + , l = n[2] + , h = n[3] + , c = n[4] + , u = n[5] + , _ = n[6] + , f = n[7] + , d = n[8] + , p = r[0] + , m = r[1] + , y = r[2] + , v = r[4] + , g = r[5] + , A = r[6] + , x = r[8] + , b = r[9] + , C = r[10]; + return s[0] = p * a + m * h + y * _, + s[1] = p * o + m * c + y * f, + s[2] = p * l + m * u + y * d, + s[3] = v * a + g * h + A * _, + s[4] = v * o + g * c + A * f, + s[5] = v * l + g * u + A * d, + s[6] = x * a + b * h + C * _, + s[7] = x * o + b * c + C * f, + s[8] = x * l + b * u + C * d, + t + } + , + t.translate = function(t, e, i) { + var n = e.m + , r = t.m + , s = n[0] + , a = n[1] + , o = n[2] + , l = n[3] + , h = n[4] + , c = n[5] + , u = n[6] + , _ = n[7] + , f = n[8] + , d = i.x + , p = i.y; + return r[0] = s, + r[1] = a, + r[2] = o, + r[3] = l, + r[4] = h, + r[5] = c, + r[6] = d * s + p * l + u, + r[7] = d * a + p * h + _, + r[8] = d * o + p * c + f, + t + } + , + t.rotate = function(t, e, i) { + var n = e.m + , r = t.m + , s = n[0] + , a = n[1] + , o = n[2] + , l = n[3] + , h = n[4] + , c = n[5] + , u = n[6] + , _ = n[7] + , f = n[8] + , d = Math.sin(i) + , p = Math.cos(i); + return r[0] = p * s + d * l, + r[1] = p * a + d * h, + r[2] = p * o + d * c, + r[3] = p * l - d * s, + r[4] = p * h - d * a, + r[5] = p * c - d * o, + r[6] = u, + r[7] = _, + r[8] = f, + t + } + , + t.scale = function(t, e, i) { + var n = i.x + , r = i.y + , s = e.m + , a = t.m; + return a[0] = n * s[0], + a[1] = n * s[1], + a[2] = n * s[2], + a[3] = r * s[3], + a[4] = r * s[4], + a[5] = r * s[5], + a[6] = s[6], + a[7] = s[7], + a[8] = s[8], + t + } + , + t.fromMat4 = function(t, e) { + var i = e.m + , n = t.m; + return n[0] = i[0], + n[1] = i[1], + n[2] = i[2], + n[3] = i[4], + n[4] = i[5], + n[5] = i[6], + n[6] = i[8], + n[7] = i[9], + n[8] = i[10], + t + } + , + t.fromTranslation = function(t, e) { + var i = t.m; + return i[0] = 1, + i[1] = 0, + i[2] = 0, + i[3] = 0, + i[4] = 1, + i[5] = 0, + i[6] = e.x, + i[7] = e.y, + i[8] = 1, + t + } + , + t.fromRotation = function(t, e) { + var i = Math.sin(e) + , n = Math.cos(e) + , r = t.m; + return r[0] = n, + r[1] = i, + r[2] = 0, + r[3] = -i, + r[4] = n, + r[5] = 0, + r[6] = 0, + r[7] = 0, + r[8] = 1, + t + } + , + t.fromScaling = function(t, e) { + var i = t.m; + return i[0] = e.x, + i[1] = 0, + i[2] = 0, + i[3] = 0, + i[4] = e.y, + i[5] = 0, + i[6] = 0, + i[7] = 0, + i[8] = 1, + t + } + , + t.fromQuat = function(t, e) { + var i = t.m + , n = e.x + , r = e.y + , s = e.z + , a = e.w + , o = n + n + , l = r + r + , h = s + s + , c = n * o + , u = r * o + , _ = r * l + , f = s * o + , d = s * l + , p = s * h + , m = a * o + , y = a * l + , v = a * h; + return i[0] = 1 - _ - p, + i[3] = u - v, + i[6] = f + y, + i[1] = u + v, + i[4] = 1 - c - p, + i[7] = d - m, + i[2] = f - y, + i[5] = d + m, + i[8] = 1 - c - _, + t + } + , + t.fromViewUp = function(e, i, n) { + var a, o, l; + return (a = new s.default(0,1,0), + o = new s.default, + l = new s.default, + function(e, i, n) { + return s.default.lengthSqr(i) < r.EPSILON * r.EPSILON ? (t.identity(e), + e) : (n = n || a, + s.default.normalize(o, s.default.cross(o, n, i)), + s.default.lengthSqr(o) < r.EPSILON * r.EPSILON ? (t.identity(e), + e) : (s.default.cross(l, i, o), + t.set(e, o.x, o.y, o.z, l.x, l.y, l.z, i.x, i.y, i.z), + e)) + } + )(e, i, n) + } + , + t.normalFromMat4 = function(t, e) { + var i = e.m + , n = t.m + , r = i[0] + , s = i[1] + , a = i[2] + , o = i[3] + , l = i[4] + , h = i[5] + , c = i[6] + , u = i[7] + , _ = i[8] + , f = i[9] + , d = i[10] + , p = i[11] + , m = i[12] + , y = i[13] + , v = i[14] + , g = i[15] + , A = r * h - s * l + , x = r * c - a * l + , b = r * u - o * l + , C = s * c - a * h + , T = s * u - o * h + , S = a * u - o * c + , w = _ * y - f * m + , E = _ * v - d * m + , M = _ * g - p * m + , D = f * v - d * y + , B = f * g - p * y + , I = d * g - p * v + , P = A * I - x * B + b * D + C * M - T * E + S * w; + return P ? (P = 1 / P, + n[0] = (h * I - c * B + u * D) * P, + n[1] = (c * M - l * I - u * E) * P, + n[2] = (l * B - h * M + u * w) * P, + n[3] = (a * B - s * I - o * D) * P, + n[4] = (r * I - a * M + o * E) * P, + n[5] = (s * M - r * B - o * w) * P, + n[6] = (y * S - v * T + g * C) * P, + n[7] = (v * b - m * S - g * x) * P, + n[8] = (m * T - y * b + g * A) * P, + t) : t + } + , + t.frob = function(t) { + var e = t.m; + return Math.sqrt(Math.pow(e[0], 2) + Math.pow(e[1], 2) + Math.pow(e[2], 2) + Math.pow(e[3], 2) + Math.pow(e[4], 2) + Math.pow(e[5], 2) + Math.pow(e[6], 2) + Math.pow(e[7], 2) + Math.pow(e[8], 2)) + } + , + t.add = function(t, e, i) { + var n = e.m + , r = i.m + , s = t.m; + return s[0] = n[0] + r[0], + s[1] = n[1] + r[1], + s[2] = n[2] + r[2], + s[3] = n[3] + r[3], + s[4] = n[4] + r[4], + s[5] = n[5] + r[5], + s[6] = n[6] + r[6], + s[7] = n[7] + r[7], + s[8] = n[8] + r[8], + t + } + , + t.subtract = function(t, e, i) { + var n = e.m + , r = i.m + , s = t.m; + return s[0] = n[0] - r[0], + s[1] = n[1] - r[1], + s[2] = n[2] - r[2], + s[3] = n[3] - r[3], + s[4] = n[4] - r[4], + s[5] = n[5] - r[5], + s[6] = n[6] - r[6], + s[7] = n[7] - r[7], + s[8] = n[8] - r[8], + t + } + , + t.multiplyScalar = function(t, e, i) { + var n = e.m + , r = t.m; + return r[0] = n[0] * i, + r[1] = n[1] * i, + r[2] = n[2] * i, + r[3] = n[3] * i, + r[4] = n[4] * i, + r[5] = n[5] * i, + r[6] = n[6] * i, + r[7] = n[7] * i, + r[8] = n[8] * i, + t + } + , + t.multiplyScalarAndAdd = function(t, e, i, n) { + var r = e.m + , s = i.m + , a = t.m; + return a[0] = r[0] + s[0] * n, + a[1] = r[1] + s[1] * n, + a[2] = r[2] + s[2] * n, + a[3] = r[3] + s[3] * n, + a[4] = r[4] + s[4] * n, + a[5] = r[5] + s[5] * n, + a[6] = r[6] + s[6] * n, + a[7] = r[7] + s[7] * n, + a[8] = r[8] + s[8] * n, + t + } + , + t.exactEquals = function(t, e) { + var i = t.m + , n = e.m; + return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5] && i[6] === n[6] && i[7] === n[7] && i[8] === n[8] + } + , + t.equals = function(t, e) { + var i = t.m + , n = e.m + , s = i[0] + , a = i[1] + , o = i[2] + , l = i[3] + , h = i[4] + , c = i[5] + , u = i[6] + , _ = i[7] + , f = i[8] + , d = n[0] + , p = n[1] + , m = n[2] + , y = n[3] + , v = n[4] + , g = n[5] + , A = n[6] + , x = n[7] + , b = n[8]; + return Math.abs(s - d) <= r.EPSILON * Math.max(1, Math.abs(s), Math.abs(d)) && Math.abs(a - p) <= r.EPSILON * Math.max(1, Math.abs(a), Math.abs(p)) && Math.abs(o - m) <= r.EPSILON * Math.max(1, Math.abs(o), Math.abs(m)) && Math.abs(l - y) <= r.EPSILON * Math.max(1, Math.abs(l), Math.abs(y)) && Math.abs(h - v) <= r.EPSILON * Math.max(1, Math.abs(h), Math.abs(v)) && Math.abs(c - g) <= r.EPSILON * Math.max(1, Math.abs(c), Math.abs(g)) && Math.abs(u - A) <= r.EPSILON * Math.max(1, Math.abs(u), Math.abs(A)) && Math.abs(_ - x) <= r.EPSILON * Math.max(1, Math.abs(_), Math.abs(x)) && Math.abs(f - b) <= r.EPSILON * Math.max(1, Math.abs(f), Math.abs(b)) + } + , + t.toArray = function(t, e, i) { + void 0 === i && (i = 0); + for (var n = e.m, r = 0; r < 9; r++) + t[i + r] = n[r]; + return t + } + , + t.fromArray = function(t, e, i) { + void 0 === i && (i = 0); + for (var n = t.m, r = 0; r < 9; r++) + n[r] = e[i + r]; + return t + } + , + t.prototype.toString = function() { + var t = this.m; + return "mat3(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ")" + } + , + t + } + )(); + i.default = a, + a.sub = a.subtract, + a.mul = a.multiply, + a.IDENTITY = Object.freeze(new a), + cc.Mat3 = a, + e.exports = i.default + } + ), { + "../value-types/utils": 289, + "./vec3": 292 + }], + 284: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = h(t("./value-type")) + , r = h(t("../platform/CCClass")) + , s = h(t("./vec3")) + , a = h(t("./quat")) + , o = t("./utils") + , l = h(t("./mat3")); + function h(t) { + return t && t.__esModule ? t : { + default: t + } + } + function c(t, e) { + return (c = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var u = 0 + , _ = 0 + , f = 0 + , d = 0 + , p = 0 + , m = 0 + , y = 0 + , v = 0 + , g = 0 + , A = 0 + , x = 0 + , b = 0 + , C = 0 + , T = 0 + , S = 0 + , w = 0 + , E = (function(t) { + var e, i; + i = t, + (e = r).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + c(e, i); + var n = r.prototype; + function r(e, i, n, r, s, a, l, h, c, u, _, f, d, p, m, y) { + var v; + if (void 0 === e && (e = 1), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 0), + void 0 === s && (s = 0), + void 0 === a && (a = 1), + void 0 === l && (l = 0), + void 0 === h && (h = 0), + void 0 === c && (c = 0), + void 0 === u && (u = 0), + void 0 === _ && (_ = 1), + void 0 === f && (f = 0), + void 0 === d && (d = 0), + void 0 === p && (p = 0), + void 0 === m && (m = 0), + void 0 === y && (y = 1), + (v = t.call(this) || this).m = void 0, + e instanceof o.FLOAT_ARRAY_TYPE) + v.m = e; + else { + v.m = new o.FLOAT_ARRAY_TYPE(16); + var g = v.m; + g[0] = e, + g[1] = i, + g[2] = n, + g[3] = r, + g[4] = s, + g[5] = a, + g[6] = l, + g[7] = h, + g[8] = c, + g[9] = u, + g[10] = _, + g[11] = f, + g[12] = d, + g[13] = p, + g[14] = m, + g[15] = y + } + return v + } + return n.mul = function(t, e) { + return r.multiply(e || new r, this, t) + } + , + n.mulScalar = function(t, e) { + r.multiplyScalar(e || new r, this, t) + } + , + n.sub = function(t, e) { + r.subtract(e || new r, this, t) + } + , + r.clone = function(t) { + var e = t.m; + return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]) + } + , + r.copy = function(t, e) { + var i = t.m + , n = e.m; + return i[0] = n[0], + i[1] = n[1], + i[2] = n[2], + i[3] = n[3], + i[4] = n[4], + i[5] = n[5], + i[6] = n[6], + i[7] = n[7], + i[8] = n[8], + i[9] = n[9], + i[10] = n[10], + i[11] = n[11], + i[12] = n[12], + i[13] = n[13], + i[14] = n[14], + i[15] = n[15], + t + } + , + r.set = function(t, e, i, n, r, s, a, o, l, h, c, u, _, f, d, p, m) { + var y = t.m; + return y[0] = e, + y[1] = i, + y[2] = n, + y[3] = r, + y[4] = s, + y[5] = a, + y[6] = o, + y[7] = l, + y[8] = h, + y[9] = c, + y[10] = u, + y[11] = _, + y[12] = f, + y[13] = d, + y[14] = p, + y[15] = m, + t + } + , + r.identity = function(t) { + var e = t.m; + return e[0] = 1, + e[1] = 0, + e[2] = 0, + e[3] = 0, + e[4] = 0, + e[5] = 1, + e[6] = 0, + e[7] = 0, + e[8] = 0, + e[9] = 0, + e[10] = 1, + e[11] = 0, + e[12] = 0, + e[13] = 0, + e[14] = 0, + e[15] = 1, + t + } + , + r.transpose = function(t, e) { + var i = t.m + , n = e.m; + if (t === e) { + var r = n[1] + , s = n[2] + , a = n[3] + , o = n[6] + , l = n[7] + , h = n[11]; + i[1] = n[4], + i[2] = n[8], + i[3] = n[12], + i[4] = r, + i[6] = n[9], + i[7] = n[13], + i[8] = s, + i[9] = o, + i[11] = n[14], + i[12] = a, + i[13] = l, + i[14] = h + } else + i[0] = n[0], + i[1] = n[4], + i[2] = n[8], + i[3] = n[12], + i[4] = n[1], + i[5] = n[5], + i[6] = n[9], + i[7] = n[13], + i[8] = n[2], + i[9] = n[6], + i[10] = n[10], + i[11] = n[14], + i[12] = n[3], + i[13] = n[7], + i[14] = n[11], + i[15] = n[15]; + return t + } + , + r.invert = function(t, e) { + var i = e.m; + u = i[0], + _ = i[1], + f = i[2], + d = i[3], + p = i[4], + m = i[5], + y = i[6], + v = i[7], + g = i[8], + A = i[9], + x = i[10], + b = i[11], + C = i[12], + T = i[13], + S = i[14], + w = i[15]; + var n = u * m - _ * p + , r = u * y - f * p + , s = u * v - d * p + , a = _ * y - f * m + , o = _ * v - d * m + , l = f * v - d * y + , h = g * T - A * C + , c = g * S - x * C + , E = g * w - b * C + , M = A * S - x * T + , D = A * w - b * T + , B = x * w - b * S + , I = n * B - r * D + s * M + a * E - o * c + l * h; + if (0 === I) + return null; + I = 1 / I; + var P = t.m; + return P[0] = (m * B - y * D + v * M) * I, + P[1] = (f * D - _ * B - d * M) * I, + P[2] = (T * l - S * o + w * a) * I, + P[3] = (x * o - A * l - b * a) * I, + P[4] = (y * E - p * B - v * c) * I, + P[5] = (u * B - f * E + d * c) * I, + P[6] = (S * s - C * l - w * r) * I, + P[7] = (g * l - x * s + b * r) * I, + P[8] = (p * D - m * E + v * h) * I, + P[9] = (_ * E - u * D - d * h) * I, + P[10] = (C * o - T * s + w * n) * I, + P[11] = (A * s - g * o - b * n) * I, + P[12] = (m * c - p * M - y * h) * I, + P[13] = (u * M - _ * c + f * h) * I, + P[14] = (T * r - C * a - S * n) * I, + P[15] = (g * a - A * r + x * n) * I, + t + } + , + r.determinant = function(t) { + var e = t.m; + return u = e[0], + _ = e[1], + f = e[2], + d = e[3], + p = e[4], + m = e[5], + y = e[6], + v = e[7], + g = e[8], + A = e[9], + x = e[10], + b = e[11], + C = e[12], + T = e[13], + S = e[14], + w = e[15], + (u * m - _ * p) * (x * w - b * S) - (u * y - f * p) * (A * w - b * T) + (u * v - d * p) * (A * S - x * T) + (_ * y - f * m) * (g * w - b * C) - (_ * v - d * m) * (g * S - x * C) + (f * v - d * y) * (g * T - A * C) + } + , + r.multiply = function(t, e, i) { + var n = t.m + , r = e.m + , s = i.m; + u = r[0], + _ = r[1], + f = r[2], + d = r[3], + p = r[4], + m = r[5], + y = r[6], + v = r[7], + g = r[8], + A = r[9], + x = r[10], + b = r[11], + C = r[12], + T = r[13], + S = r[14], + w = r[15]; + var a = s[0] + , o = s[1] + , l = s[2] + , h = s[3]; + return n[0] = a * u + o * p + l * g + h * C, + n[1] = a * _ + o * m + l * A + h * T, + n[2] = a * f + o * y + l * x + h * S, + n[3] = a * d + o * v + l * b + h * w, + a = s[4], + o = s[5], + l = s[6], + h = s[7], + n[4] = a * u + o * p + l * g + h * C, + n[5] = a * _ + o * m + l * A + h * T, + n[6] = a * f + o * y + l * x + h * S, + n[7] = a * d + o * v + l * b + h * w, + a = s[8], + o = s[9], + l = s[10], + h = s[11], + n[8] = a * u + o * p + l * g + h * C, + n[9] = a * _ + o * m + l * A + h * T, + n[10] = a * f + o * y + l * x + h * S, + n[11] = a * d + o * v + l * b + h * w, + a = s[12], + o = s[13], + l = s[14], + h = s[15], + n[12] = a * u + o * p + l * g + h * C, + n[13] = a * _ + o * m + l * A + h * T, + n[14] = a * f + o * y + l * x + h * S, + n[15] = a * d + o * v + l * b + h * w, + t + } + , + r.transform = function(t, e, i) { + var n = i.x + , r = i.y + , s = i.z + , a = t.m + , o = e.m; + return e === t ? (a[12] = o[0] * n + o[4] * r + o[8] * s + o[12], + a[13] = o[1] * n + o[5] * r + o[9] * s + o[13], + a[14] = o[2] * n + o[6] * r + o[10] * s + o[14], + a[15] = o[3] * n + o[7] * r + o[11] * s + o[15]) : (u = o[0], + _ = o[1], + f = o[2], + d = o[3], + p = o[4], + m = o[5], + y = o[6], + v = o[7], + g = o[8], + A = o[9], + x = o[10], + b = o[11], + C = o[12], + T = o[13], + S = o[14], + w = o[15], + a[0] = u, + a[1] = _, + a[2] = f, + a[3] = d, + a[4] = p, + a[5] = m, + a[6] = y, + a[7] = v, + a[8] = g, + a[9] = A, + a[10] = x, + a[11] = b, + a[12] = u * n + p * r + g * s + o[12], + a[13] = _ * n + m * r + A * s + o[13], + a[14] = f * n + y * r + x * s + o[14], + a[15] = d * n + v * r + b * s + o[15]), + t + } + , + r.translate = function(t, e, i) { + var n = t.m + , r = e.m; + return e === t ? (n[12] += i.x, + n[13] += i.y, + n[14] += i.z) : (n[0] = r[0], + n[1] = r[1], + n[2] = r[2], + n[3] = r[3], + n[4] = r[4], + n[5] = r[5], + n[6] = r[6], + n[7] = r[7], + n[8] = r[8], + n[9] = r[9], + n[10] = r[10], + n[11] = r[11], + n[12] += i.x, + n[13] += i.y, + n[14] += i.z, + n[15] = r[15]), + t + } + , + r.scale = function(t, e, i) { + var n = i.x + , r = i.y + , s = i.z + , a = t.m + , o = e.m; + return a[0] = o[0] * n, + a[1] = o[1] * n, + a[2] = o[2] * n, + a[3] = o[3] * n, + a[4] = o[4] * r, + a[5] = o[5] * r, + a[6] = o[6] * r, + a[7] = o[7] * r, + a[8] = o[8] * s, + a[9] = o[9] * s, + a[10] = o[10] * s, + a[11] = o[11] * s, + a[12] = o[12], + a[13] = o[13], + a[14] = o[14], + a[15] = o[15], + t + } + , + r.rotate = function(t, e, i, n) { + var r = n.x + , s = n.y + , a = n.z + , l = Math.sqrt(r * r + s * s + a * a); + if (Math.abs(l) < o.EPSILON) + return null; + r *= l = 1 / l, + s *= l, + a *= l; + var h = Math.sin(i) + , c = Math.cos(i) + , C = 1 - c + , T = e.m; + u = T[0], + _ = T[1], + f = T[2], + d = T[3], + p = T[4], + m = T[5], + y = T[6], + v = T[7], + g = T[8], + A = T[9], + x = T[10], + b = T[11]; + var S = r * r * C + c + , w = s * r * C + a * h + , E = a * r * C - s * h + , M = r * s * C - a * h + , D = s * s * C + c + , B = a * s * C + r * h + , I = r * a * C + s * h + , P = s * a * C - r * h + , R = a * a * C + c + , O = t.m; + return O[0] = u * S + p * w + g * E, + O[1] = _ * S + m * w + A * E, + O[2] = f * S + y * w + x * E, + O[3] = d * S + v * w + b * E, + O[4] = u * M + p * D + g * B, + O[5] = _ * M + m * D + A * B, + O[6] = f * M + y * D + x * B, + O[7] = d * M + v * D + b * B, + O[8] = u * I + p * P + g * R, + O[9] = _ * I + m * P + A * R, + O[10] = f * I + y * P + x * R, + O[11] = d * I + v * P + b * R, + e !== t && (O[12] = T[12], + O[13] = T[13], + O[14] = T[14], + O[15] = T[15]), + t + } + , + r.rotateX = function(t, e, i) { + var n = t.m + , r = e.m + , s = Math.sin(i) + , a = Math.cos(i) + , o = r[4] + , l = r[5] + , h = r[6] + , c = r[7] + , u = r[8] + , _ = r[9] + , f = r[10] + , d = r[11]; + return e !== t && (n[0] = r[0], + n[1] = r[1], + n[2] = r[2], + n[3] = r[3], + n[12] = r[12], + n[13] = r[13], + n[14] = r[14], + n[15] = r[15]), + n[4] = o * a + u * s, + n[5] = l * a + _ * s, + n[6] = h * a + f * s, + n[7] = c * a + d * s, + n[8] = u * a - o * s, + n[9] = _ * a - l * s, + n[10] = f * a - h * s, + n[11] = d * a - c * s, + t + } + , + r.rotateY = function(t, e, i) { + var n = t.m + , r = e.m + , s = Math.sin(i) + , a = Math.cos(i) + , o = r[0] + , l = r[1] + , h = r[2] + , c = r[3] + , u = r[8] + , _ = r[9] + , f = r[10] + , d = r[11]; + return e !== t && (n[4] = r[4], + n[5] = r[5], + n[6] = r[6], + n[7] = r[7], + n[12] = r[12], + n[13] = r[13], + n[14] = r[14], + n[15] = r[15]), + n[0] = o * a - u * s, + n[1] = l * a - _ * s, + n[2] = h * a - f * s, + n[3] = c * a - d * s, + n[8] = o * s + u * a, + n[9] = l * s + _ * a, + n[10] = h * s + f * a, + n[11] = c * s + d * a, + t + } + , + r.rotateZ = function(t, e, i) { + var n = e.m + , r = t.m + , s = Math.sin(i) + , a = Math.cos(i) + , o = e.m[0] + , l = e.m[1] + , h = e.m[2] + , c = e.m[3] + , u = e.m[4] + , _ = e.m[5] + , f = e.m[6] + , d = e.m[7]; + return e !== t && (r[8] = n[8], + r[9] = n[9], + r[10] = n[10], + r[11] = n[11], + r[12] = n[12], + r[13] = n[13], + r[14] = n[14], + r[15] = n[15]), + r[0] = o * a + u * s, + r[1] = l * a + _ * s, + r[2] = h * a + f * s, + r[3] = c * a + d * s, + r[4] = u * a - o * s, + r[5] = _ * a - l * s, + r[6] = f * a - h * s, + r[7] = d * a - c * s, + t + } + , + r.fromTranslation = function(t, e) { + var i = t.m; + return i[0] = 1, + i[1] = 0, + i[2] = 0, + i[3] = 0, + i[4] = 0, + i[5] = 1, + i[6] = 0, + i[7] = 0, + i[8] = 0, + i[9] = 0, + i[10] = 1, + i[11] = 0, + i[12] = e.x, + i[13] = e.y, + i[14] = e.z, + i[15] = 1, + t + } + , + r.fromScaling = function(t, e) { + var i = t.m; + return i[0] = e.x, + i[1] = 0, + i[2] = 0, + i[3] = 0, + i[4] = 0, + i[5] = e.y, + i[6] = 0, + i[7] = 0, + i[8] = 0, + i[9] = 0, + i[10] = e.z, + i[11] = 0, + i[12] = 0, + i[13] = 0, + i[14] = 0, + i[15] = 1, + t + } + , + r.fromRotation = function(t, e, i) { + var n = i.x + , r = i.y + , s = i.z + , a = Math.sqrt(n * n + r * r + s * s); + if (Math.abs(a) < o.EPSILON) + return null; + n *= a = 1 / a, + r *= a, + s *= a; + var l = Math.sin(e) + , h = Math.cos(e) + , c = 1 - h + , u = t.m; + return u[0] = n * n * c + h, + u[1] = r * n * c + s * l, + u[2] = s * n * c - r * l, + u[3] = 0, + u[4] = n * r * c - s * l, + u[5] = r * r * c + h, + u[6] = s * r * c + n * l, + u[7] = 0, + u[8] = n * s * c + r * l, + u[9] = r * s * c - n * l, + u[10] = s * s * c + h, + u[11] = 0, + u[12] = 0, + u[13] = 0, + u[14] = 0, + u[15] = 1, + t + } + , + r.fromXRotation = function(t, e) { + var i = Math.sin(e) + , n = Math.cos(e) + , r = t.m; + return r[0] = 1, + r[1] = 0, + r[2] = 0, + r[3] = 0, + r[4] = 0, + r[5] = n, + r[6] = i, + r[7] = 0, + r[8] = 0, + r[9] = -i, + r[10] = n, + r[11] = 0, + r[12] = 0, + r[13] = 0, + r[14] = 0, + r[15] = 1, + t + } + , + r.fromYRotation = function(t, e) { + var i = Math.sin(e) + , n = Math.cos(e) + , r = t.m; + return r[0] = n, + r[1] = 0, + r[2] = -i, + r[3] = 0, + r[4] = 0, + r[5] = 1, + r[6] = 0, + r[7] = 0, + r[8] = i, + r[9] = 0, + r[10] = n, + r[11] = 0, + r[12] = 0, + r[13] = 0, + r[14] = 0, + r[15] = 1, + t + } + , + r.fromZRotation = function(t, e) { + var i = Math.sin(e) + , n = Math.cos(e) + , r = t.m; + return r[0] = n, + r[1] = i, + r[2] = 0, + r[3] = 0, + r[4] = -i, + r[5] = n, + r[6] = 0, + r[7] = 0, + r[8] = 0, + r[9] = 0, + r[10] = 1, + r[11] = 0, + r[12] = 0, + r[13] = 0, + r[14] = 0, + r[15] = 1, + t + } + , + r.fromRT = function(t, e, i) { + var n = e.x + , r = e.y + , s = e.z + , a = e.w + , o = n + n + , l = r + r + , h = s + s + , c = n * o + , u = n * l + , _ = n * h + , f = r * l + , d = r * h + , p = s * h + , m = a * o + , y = a * l + , v = a * h + , g = t.m; + return g[0] = 1 - (f + p), + g[1] = u + v, + g[2] = _ - y, + g[3] = 0, + g[4] = u - v, + g[5] = 1 - (c + p), + g[6] = d + m, + g[7] = 0, + g[8] = _ + y, + g[9] = d - m, + g[10] = 1 - (c + f), + g[11] = 0, + g[12] = i.x, + g[13] = i.y, + g[14] = i.z, + g[15] = 1, + t + } + , + r.getTranslation = function(t, e) { + var i = e.m; + return t.x = i[12], + t.y = i[13], + t.z = i[14], + t + } + , + r.getScaling = function(t, e) { + var i = e.m + , n = D.m + , r = n[0] = i[0] + , s = n[1] = i[1] + , a = n[2] = i[2] + , o = n[3] = i[4] + , h = n[4] = i[5] + , c = n[5] = i[6] + , u = n[6] = i[8] + , _ = n[7] = i[9] + , f = n[8] = i[10]; + return t.x = Math.sqrt(r * r + s * s + a * a), + t.y = Math.sqrt(o * o + h * h + c * c), + t.z = Math.sqrt(u * u + _ * _ + f * f), + l.default.determinant(D) < 0 && (t.x *= -1), + t + } + , + r.getRotation = function(t, e) { + var i = e.m + , n = i[0] + i[5] + i[10] + , r = 0; + return n > 0 ? (r = 2 * Math.sqrt(n + 1), + t.w = .25 * r, + t.x = (i[6] - i[9]) / r, + t.y = (i[8] - i[2]) / r, + t.z = (i[1] - i[4]) / r) : i[0] > i[5] && i[0] > i[10] ? (r = 2 * Math.sqrt(1 + i[0] - i[5] - i[10]), + t.w = (i[6] - i[9]) / r, + t.x = .25 * r, + t.y = (i[1] + i[4]) / r, + t.z = (i[8] + i[2]) / r) : i[5] > i[10] ? (r = 2 * Math.sqrt(1 + i[5] - i[0] - i[10]), + t.w = (i[8] - i[2]) / r, + t.x = (i[1] + i[4]) / r, + t.y = .25 * r, + t.z = (i[6] + i[9]) / r) : (r = 2 * Math.sqrt(1 + i[10] - i[0] - i[5]), + t.w = (i[1] - i[4]) / r, + t.x = (i[8] + i[2]) / r, + t.y = (i[6] + i[9]) / r, + t.z = .25 * r), + t + } + , + r.toRTS = function(t, e, i, n) { + var r = t.m + , o = D.m; + n.x = s.default.set(M, r[0], r[1], r[2]).mag(), + o[0] = r[0] / n.x, + o[1] = r[1] / n.x, + o[2] = r[2] / n.x, + n.y = s.default.set(M, r[4], r[5], r[6]).mag(), + o[3] = r[4] / n.y, + o[4] = r[5] / n.y, + o[5] = r[6] / n.y, + n.z = s.default.set(M, r[8], r[9], r[10]).mag(), + o[6] = r[8] / n.z, + o[7] = r[9] / n.z, + o[8] = r[10] / n.z, + l.default.determinant(D) < 0 && (n.x *= -1, + o[0] *= -1, + o[1] *= -1, + o[2] *= -1), + a.default.fromMat3(e, D), + s.default.set(i, r[12], r[13], r[14]) + } + , + r.fromRTS = function(t, e, i, n) { + var r = e.x + , s = e.y + , a = e.z + , o = e.w + , l = r + r + , h = s + s + , c = a + a + , u = r * l + , _ = r * h + , f = r * c + , d = s * h + , p = s * c + , m = a * c + , y = o * l + , v = o * h + , g = o * c + , A = n.x + , x = n.y + , b = n.z + , C = t.m; + return C[0] = (1 - (d + m)) * A, + C[1] = (_ + g) * A, + C[2] = (f - v) * A, + C[3] = 0, + C[4] = (_ - g) * x, + C[5] = (1 - (u + m)) * x, + C[6] = (p + y) * x, + C[7] = 0, + C[8] = (f + v) * b, + C[9] = (p - y) * b, + C[10] = (1 - (u + d)) * b, + C[11] = 0, + C[12] = i.x, + C[13] = i.y, + C[14] = i.z, + C[15] = 1, + t + } + , + r.fromRTSOrigin = function(t, e, i, n, r) { + var s = e.x + , a = e.y + , o = e.z + , l = e.w + , h = s + s + , c = a + a + , u = o + o + , _ = s * h + , f = s * c + , d = s * u + , p = a * c + , m = a * u + , y = o * u + , v = l * h + , g = l * c + , A = l * u + , x = n.x + , b = n.y + , C = n.z + , T = r.x + , S = r.y + , w = r.z + , E = t.m; + return E[0] = (1 - (p + y)) * x, + E[1] = (f + A) * x, + E[2] = (d - g) * x, + E[3] = 0, + E[4] = (f - A) * b, + E[5] = (1 - (_ + y)) * b, + E[6] = (m + v) * b, + E[7] = 0, + E[8] = (d + g) * C, + E[9] = (m - v) * C, + E[10] = (1 - (_ + p)) * C, + E[11] = 0, + E[12] = i.x + T - (E[0] * T + E[4] * S + E[8] * w), + E[13] = i.y + S - (E[1] * T + E[5] * S + E[9] * w), + E[14] = i.z + w - (E[2] * T + E[6] * S + E[10] * w), + E[15] = 1, + t + } + , + r.fromQuat = function(t, e) { + var i = e.x + , n = e.y + , r = e.z + , s = e.w + , a = i + i + , o = n + n + , l = r + r + , h = i * a + , c = n * a + , u = n * o + , _ = r * a + , f = r * o + , d = r * l + , p = s * a + , m = s * o + , y = s * l + , v = t.m; + return v[0] = 1 - u - d, + v[1] = c + y, + v[2] = _ - m, + v[3] = 0, + v[4] = c - y, + v[5] = 1 - h - d, + v[6] = f + p, + v[7] = 0, + v[8] = _ + m, + v[9] = f - p, + v[10] = 1 - h - u, + v[11] = 0, + v[12] = 0, + v[13] = 0, + v[14] = 0, + v[15] = 1, + t + } + , + r.frustum = function(t, e, i, n, r, s, a) { + var o = 1 / (i - e) + , l = 1 / (r - n) + , h = 1 / (s - a) + , c = t.m; + return c[0] = 2 * s * o, + c[1] = 0, + c[2] = 0, + c[3] = 0, + c[4] = 0, + c[5] = 2 * s * l, + c[6] = 0, + c[7] = 0, + c[8] = (i + e) * o, + c[9] = (r + n) * l, + c[10] = (a + s) * h, + c[11] = -1, + c[12] = 0, + c[13] = 0, + c[14] = a * s * 2 * h, + c[15] = 0, + t + } + , + r.perspective = function(t, e, i, n, r) { + var s = 1 / Math.tan(e / 2) + , a = 1 / (n - r) + , o = t.m; + return o[0] = s / i, + o[1] = 0, + o[2] = 0, + o[3] = 0, + o[4] = 0, + o[5] = s, + o[6] = 0, + o[7] = 0, + o[8] = 0, + o[9] = 0, + o[10] = (r + n) * a, + o[11] = -1, + o[12] = 0, + o[13] = 0, + o[14] = 2 * r * n * a, + o[15] = 0, + t + } + , + r.ortho = function(t, e, i, n, r, s, a) { + var o = 1 / (e - i) + , l = 1 / (n - r) + , h = 1 / (s - a) + , c = t.m; + return c[0] = -2 * o, + c[1] = 0, + c[2] = 0, + c[3] = 0, + c[4] = 0, + c[5] = -2 * l, + c[6] = 0, + c[7] = 0, + c[8] = 0, + c[9] = 0, + c[10] = 2 * h, + c[11] = 0, + c[12] = (e + i) * o, + c[13] = (r + n) * l, + c[14] = (a + s) * h, + c[15] = 1, + t + } + , + r.lookAt = function(t, e, i, n) { + var r = e.x + , s = e.y + , a = e.z + , o = n.x + , l = n.y + , h = n.z + , c = r - i.x + , u = s - i.y + , _ = a - i.z + , f = 1 / Math.sqrt(c * c + u * u + _ * _) + , d = l * (_ *= f) - h * (u *= f) + , p = h * (c *= f) - o * _ + , m = o * u - l * c + , y = u * (m *= f = 1 / Math.sqrt(d * d + p * p + m * m)) - _ * (p *= f) + , v = _ * (d *= f) - c * m + , g = c * p - u * d + , A = t.m; + return A[0] = d, + A[1] = y, + A[2] = c, + A[3] = 0, + A[4] = p, + A[5] = v, + A[6] = u, + A[7] = 0, + A[8] = m, + A[9] = g, + A[10] = _, + A[11] = 0, + A[12] = -(d * r + p * s + m * a), + A[13] = -(y * r + v * s + g * a), + A[14] = -(c * r + u * s + _ * a), + A[15] = 1, + t + } + , + r.inverseTranspose = function(t, e) { + var i = e.m; + u = i[0], + _ = i[1], + f = i[2], + d = i[3], + p = i[4], + m = i[5], + y = i[6], + v = i[7], + g = i[8], + A = i[9], + x = i[10], + b = i[11], + C = i[12], + T = i[13], + S = i[14], + w = i[15]; + var n = u * m - _ * p + , r = u * y - f * p + , s = u * v - d * p + , a = _ * y - f * m + , o = _ * v - d * m + , l = f * v - d * y + , h = g * T - A * C + , c = g * S - x * C + , E = g * w - b * C + , M = A * S - x * T + , D = A * w - b * T + , B = x * w - b * S + , I = n * B - r * D + s * M + a * E - o * c + l * h; + return I ? (I = 1 / I, + (i = t.m)[0] = (m * B - y * D + v * M) * I, + i[1] = (y * E - p * B - v * c) * I, + i[2] = (p * D - m * E + v * h) * I, + i[3] = 0, + i[4] = (f * D - _ * B - d * M) * I, + i[5] = (u * B - f * E + d * c) * I, + i[6] = (_ * E - u * D - d * h) * I, + i[7] = 0, + i[8] = (T * l - S * o + w * a) * I, + i[9] = (S * s - C * l - w * r) * I, + i[10] = (C * o - T * s + w * n) * I, + i[11] = 0, + i[12] = 0, + i[13] = 0, + i[14] = 0, + i[15] = 1, + t) : null + } + , + r.add = function(t, e, i) { + var n = t.m + , r = e.m + , s = i.m; + return n[0] = r[0] + s[0], + n[1] = r[1] + s[1], + n[2] = r[2] + s[2], + n[3] = r[3] + s[3], + n[4] = r[4] + s[4], + n[5] = r[5] + s[5], + n[6] = r[6] + s[6], + n[7] = r[7] + s[7], + n[8] = r[8] + s[8], + n[9] = r[9] + s[9], + n[10] = r[10] + s[10], + n[11] = r[11] + s[11], + n[12] = r[12] + s[12], + n[13] = r[13] + s[13], + n[14] = r[14] + s[14], + n[15] = r[15] + s[15], + t + } + , + r.subtract = function(t, e, i) { + var n = t.m + , r = e.m + , s = i.m; + return n[0] = r[0] - s[0], + n[1] = r[1] - s[1], + n[2] = r[2] - s[2], + n[3] = r[3] - s[3], + n[4] = r[4] - s[4], + n[5] = r[5] - s[5], + n[6] = r[6] - s[6], + n[7] = r[7] - s[7], + n[8] = r[8] - s[8], + n[9] = r[9] - s[9], + n[10] = r[10] - s[10], + n[11] = r[11] - s[11], + n[12] = r[12] - s[12], + n[13] = r[13] - s[13], + n[14] = r[14] - s[14], + n[15] = r[15] - s[15], + t + } + , + r.multiplyScalar = function(t, e, i) { + var n = t.m + , r = e.m; + return n[0] = r[0] * i, + n[1] = r[1] * i, + n[2] = r[2] * i, + n[3] = r[3] * i, + n[4] = r[4] * i, + n[5] = r[5] * i, + n[6] = r[6] * i, + n[7] = r[7] * i, + n[8] = r[8] * i, + n[9] = r[9] * i, + n[10] = r[10] * i, + n[11] = r[11] * i, + n[12] = r[12] * i, + n[13] = r[13] * i, + n[14] = r[14] * i, + n[15] = r[15] * i, + t + } + , + r.multiplyScalarAndAdd = function(t, e, i, n) { + var r = t.m + , s = e.m + , a = i.m; + return r[0] = s[0] + a[0] * n, + r[1] = s[1] + a[1] * n, + r[2] = s[2] + a[2] * n, + r[3] = s[3] + a[3] * n, + r[4] = s[4] + a[4] * n, + r[5] = s[5] + a[5] * n, + r[6] = s[6] + a[6] * n, + r[7] = s[7] + a[7] * n, + r[8] = s[8] + a[8] * n, + r[9] = s[9] + a[9] * n, + r[10] = s[10] + a[10] * n, + r[11] = s[11] + a[11] * n, + r[12] = s[12] + a[12] * n, + r[13] = s[13] + a[13] * n, + r[14] = s[14] + a[14] * n, + r[15] = s[15] + a[15] * n, + t + } + , + r.strictEquals = function(t, e) { + var i = t.m + , n = e.m; + return i[0] === n[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3] && i[4] === n[4] && i[5] === n[5] && i[6] === n[6] && i[7] === n[7] && i[8] === n[8] && i[9] === n[9] && i[10] === n[10] && i[11] === n[11] && i[12] === n[12] && i[13] === n[13] && i[14] === n[14] && i[15] === n[15] + } + , + r.equals = function(t, e, i) { + void 0 === i && (i = o.EPSILON); + var n = t.m + , r = e.m; + return Math.abs(n[0] - r[0]) <= i * Math.max(1, Math.abs(n[0]), Math.abs(r[0])) && Math.abs(n[1] - r[1]) <= i * Math.max(1, Math.abs(n[1]), Math.abs(r[1])) && Math.abs(n[2] - r[2]) <= i * Math.max(1, Math.abs(n[2]), Math.abs(r[2])) && Math.abs(n[3] - r[3]) <= i * Math.max(1, Math.abs(n[3]), Math.abs(r[3])) && Math.abs(n[4] - r[4]) <= i * Math.max(1, Math.abs(n[4]), Math.abs(r[4])) && Math.abs(n[5] - r[5]) <= i * Math.max(1, Math.abs(n[5]), Math.abs(r[5])) && Math.abs(n[6] - r[6]) <= i * Math.max(1, Math.abs(n[6]), Math.abs(r[6])) && Math.abs(n[7] - r[7]) <= i * Math.max(1, Math.abs(n[7]), Math.abs(r[7])) && Math.abs(n[8] - r[8]) <= i * Math.max(1, Math.abs(n[8]), Math.abs(r[8])) && Math.abs(n[9] - r[9]) <= i * Math.max(1, Math.abs(n[9]), Math.abs(r[9])) && Math.abs(n[10] - r[10]) <= i * Math.max(1, Math.abs(n[10]), Math.abs(r[10])) && Math.abs(n[11] - r[11]) <= i * Math.max(1, Math.abs(n[11]), Math.abs(r[11])) && Math.abs(n[12] - r[12]) <= i * Math.max(1, Math.abs(n[12]), Math.abs(r[12])) && Math.abs(n[13] - r[13]) <= i * Math.max(1, Math.abs(n[13]), Math.abs(r[13])) && Math.abs(n[14] - r[14]) <= i * Math.max(1, Math.abs(n[14]), Math.abs(r[14])) && Math.abs(n[15] - r[15]) <= i * Math.max(1, Math.abs(n[15]), Math.abs(r[15])) + } + , + r.adjoint = function(t, e) { + var i = e.m + , n = t.m + , r = i[0] + , s = i[1] + , a = i[2] + , o = i[3] + , l = i[4] + , h = i[5] + , c = i[6] + , u = i[7] + , _ = i[8] + , f = i[9] + , d = i[10] + , p = i[11] + , m = i[12] + , y = i[13] + , v = i[14] + , g = i[15]; + return n[0] = h * (d * g - p * v) - f * (c * g - u * v) + y * (c * p - u * d), + n[1] = -(s * (d * g - p * v) - f * (a * g - o * v) + y * (a * p - o * d)), + n[2] = s * (c * g - u * v) - h * (a * g - o * v) + y * (a * u - o * c), + n[3] = -(s * (c * p - u * d) - h * (a * p - o * d) + f * (a * u - o * c)), + n[4] = -(l * (d * g - p * v) - _ * (c * g - u * v) + m * (c * p - u * d)), + n[5] = r * (d * g - p * v) - _ * (a * g - o * v) + m * (a * p - o * d), + n[6] = -(r * (c * g - u * v) - l * (a * g - o * v) + m * (a * u - o * c)), + n[7] = r * (c * p - u * d) - l * (a * p - o * d) + _ * (a * u - o * c), + n[8] = l * (f * g - p * y) - _ * (h * g - u * y) + m * (h * p - u * f), + n[9] = -(r * (f * g - p * y) - _ * (s * g - o * y) + m * (s * p - o * f)), + n[10] = r * (h * g - u * y) - l * (s * g - o * y) + m * (s * u - o * h), + n[11] = -(r * (h * p - u * f) - l * (s * p - o * f) + _ * (s * u - o * h)), + n[12] = -(l * (f * v - d * y) - _ * (h * v - c * y) + m * (h * d - c * f)), + n[13] = r * (f * v - d * y) - _ * (s * v - a * y) + m * (s * d - a * f), + n[14] = -(r * (h * v - c * y) - l * (s * v - a * y) + m * (s * c - a * h)), + n[15] = r * (h * d - c * f) - l * (s * d - a * f) + _ * (s * c - a * h), + t + } + , + r.toArray = function(t, e, i) { + void 0 === i && (i = 0); + for (var n = e.m, r = 0; r < 16; r++) + t[i + r] = n[r]; + return t + } + , + r.fromArray = function(t, e, i) { + void 0 === i && (i = 0); + for (var n = t.m, r = 0; r < 16; r++) + n[r] = e[i + r]; + return t + } + , + n.clone = function() { + var t = this.m; + return new r(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]) + } + , + n.set = function(t) { + var e = this.m + , i = t.m; + return e[0] = i[0], + e[1] = i[1], + e[2] = i[2], + e[3] = i[3], + e[4] = i[4], + e[5] = i[5], + e[6] = i[6], + e[7] = i[7], + e[8] = i[8], + e[9] = i[9], + e[10] = i[10], + e[11] = i[11], + e[12] = i[12], + e[13] = i[13], + e[14] = i[14], + e[15] = i[15], + this + } + , + n.equals = function(t) { + return r.strictEquals(this, t) + } + , + n.fuzzyEquals = function(t) { + return r.equals(this, t) + } + , + n.toString = function() { + var t = this.m; + return t ? "[\n" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ",\n" + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ",\n" + t[8] + ", " + t[9] + ", " + t[10] + ", " + t[11] + ",\n" + t[12] + ", " + t[13] + ", " + t[14] + ", " + t[15] + "\n]" : "[\n1, 0, 0, 0\n0, 1, 0, 0\n0, 0, 1, 0\n0, 0, 0, 1\n]" + } + , + n.identity = function() { + return r.identity(this) + } + , + n.transpose = function(t) { + return t = t || new r, + r.transpose(t, this) + } + , + n.invert = function(t) { + return t = t || new r, + r.invert(t, this) + } + , + n.adjoint = function(t) { + return t = t || new r, + r.adjoint(t, this) + } + , + n.determinant = function() { + return r.determinant(this) + } + , + n.add = function(t, e) { + return e = e || new r, + r.add(e, this, t) + } + , + n.subtract = function(t) { + return r.subtract(this, this, t) + } + , + n.multiply = function(t) { + return r.multiply(this, this, t) + } + , + n.multiplyScalar = function(t) { + return r.multiplyScalar(this, this, t) + } + , + n.translate = function(t, e) { + return e = e || new r, + r.translate(e, this, t) + } + , + n.scale = function(t, e) { + return e = e || new r, + r.scale(e, this, t) + } + , + n.rotate = function(t, e, i) { + return i = i || new r, + r.rotate(i, this, t, e) + } + , + n.getTranslation = function(t) { + return t = t || new s.default, + r.getTranslation(t, this) + } + , + n.getScale = function(t) { + return t = t || new s.default, + r.getScaling(t, this) + } + , + n.getRotation = function(t) { + return t = t || new a.default, + r.getRotation(t, this) + } + , + n.fromRTS = function(t, e, i) { + return r.fromRTS(this, t, e, i) + } + , + n.fromQuat = function(t) { + return r.fromQuat(this, t) + } + , + r + } + )(n.default); + i.default = E, + E.mul = E.multiply, + E.sub = E.subtract, + E.IDENTITY = Object.freeze(new E); + var M = new s.default + , D = new l.default; + r.default.fastDefine("cc.Mat4", E, { + m00: 1, + m01: 0, + m02: 0, + m03: 0, + m04: 0, + m05: 1, + m06: 0, + m07: 0, + m08: 0, + m09: 0, + m10: 1, + m11: 0, + m12: 0, + m13: 0, + m14: 0, + m15: 1 + }); + for (var B = function(t) { + Object.defineProperty(E.prototype, "m" + t, { + get: function() { + return this.m[t] + }, + set: function(e) { + this.m[t] = e + } + }) + }, I = 0; I < 16; I++) + B(I); + cc.mat4 = function(t, e, i, n, r, s, a, o, l, h, c, u, _, f, d, p) { + var m = new E(t,e,i,n,r,s,a,o,l,h,c,u,_,f,d,p); + return void 0 === t && E.identity(m), + m + } + , + cc.Mat4 = E, + e.exports = i.default + } + ), { + "../platform/CCClass": 193, + "./mat3": 283, + "./quat": 285, + "./utils": 289, + "./value-type": 290, + "./vec3": 292 + }], + 285: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = l(t("./value-type")) + , r = l(t("../platform/CCClass")) + , s = l(t("./vec3")) + , a = l(t("./mat3")) + , o = t("./utils"); + function l(t) { + return t && t.__esModule ? t : { + default: t + } + } + function h(t, e) { + return (h = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var c = 0 + , u = 0 + , _ = 0 + , f = 0 + , d = (function(t) { + var e, i; + i = t, + (e = r).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + h(e, i); + var n = r.prototype; + function r(e, i, n, r) { + var s; + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 1), + (s = t.call(this) || this).x = void 0, + s.y = void 0, + s.z = void 0, + s.w = void 0, + e && "object" == typeof e ? (s.x = e.x, + s.y = e.y, + s.z = e.z, + s.w = e.w) : (s.x = e, + s.y = i, + s.z = n, + s.w = r), + s + } + return n.mul = function(t, e) { + return r.multiply(e || new r, this, t) + } + , + r.clone = function(t) { + return new r(t.x,t.y,t.z,t.w) + } + , + r.copy = function(t, e) { + return t.x = e.x, + t.y = e.y, + t.z = e.z, + t.w = e.w, + t + } + , + r.set = function(t, e, i, n, r) { + return t.x = e, + t.y = i, + t.z = n, + t.w = r, + t + } + , + r.identity = function(t) { + return t.x = 0, + t.y = 0, + t.z = 0, + t.w = 1, + t + } + , + r.rotationTo = function(t, e, i) { + var n = s.default.dot(e, i); + return n < -.999999 ? (s.default.cross(y, s.default.RIGHT, e), + y.mag() < 1e-6 && s.default.cross(y, s.default.UP, e), + s.default.normalize(y, y), + r.fromAxisAngle(t, y, Math.PI), + t) : n > .999999 ? (t.x = 0, + t.y = 0, + t.z = 0, + t.w = 1, + t) : (s.default.cross(y, e, i), + t.x = y.x, + t.y = y.y, + t.z = y.z, + t.w = 1 + n, + r.normalize(t, t)) + } + , + r.getAxisAngle = function(t, e) { + var i = 2 * Math.acos(e.w) + , n = Math.sin(i / 2); + return 0 !== n ? (t.x = e.x / n, + t.y = e.y / n, + t.z = e.z / n) : (t.x = 1, + t.y = 0, + t.z = 0), + i + } + , + r.multiply = function(t, e, i) { + return c = e.x * i.w + e.w * i.x + e.y * i.z - e.z * i.y, + u = e.y * i.w + e.w * i.y + e.z * i.x - e.x * i.z, + _ = e.z * i.w + e.w * i.z + e.x * i.y - e.y * i.x, + f = e.w * i.w - e.x * i.x - e.y * i.y - e.z * i.z, + t.x = c, + t.y = u, + t.z = _, + t.w = f, + t + } + , + r.multiplyScalar = function(t, e, i) { + return t.x = e.x * i, + t.y = e.y * i, + t.z = e.z * i, + t.w = e.w * i, + t + } + , + r.scaleAndAdd = function(t, e, i, n) { + return t.x = e.x + i.x * n, + t.y = e.y + i.y * n, + t.z = e.z + i.z * n, + t.w = e.w + i.w * n, + t + } + , + r.rotateX = function(t, e, i) { + i *= .5; + var n = Math.sin(i) + , r = Math.cos(i); + return c = e.x * r + e.w * n, + u = e.y * r + e.z * n, + _ = e.z * r - e.y * n, + f = e.w * r - e.x * n, + t.x = c, + t.y = u, + t.z = _, + t.w = f, + t + } + , + r.rotateY = function(t, e, i) { + i *= .5; + var n = Math.sin(i) + , r = Math.cos(i); + return c = e.x * r - e.z * n, + u = e.y * r + e.w * n, + _ = e.z * r + e.x * n, + f = e.w * r - e.y * n, + t.x = c, + t.y = u, + t.z = _, + t.w = f, + t + } + , + r.rotateZ = function(t, e, i) { + i *= .5; + var n = Math.sin(i) + , r = Math.cos(i); + return c = e.x * r + e.y * n, + u = e.y * r - e.x * n, + _ = e.z * r + e.w * n, + f = e.w * r - e.z * n, + t.x = c, + t.y = u, + t.z = _, + t.w = f, + t + } + , + r.rotateAround = function(t, e, i, n) { + return r.invert(p, e), + s.default.transformQuat(y, i, p), + r.fromAxisAngle(p, y, n), + r.multiply(t, e, p), + t + } + , + r.rotateAroundLocal = function(t, e, i, n) { + return r.fromAxisAngle(p, i, n), + r.multiply(t, e, p), + t + } + , + r.calculateW = function(t, e) { + return t.x = e.x, + t.y = e.y, + t.z = e.z, + t.w = Math.sqrt(Math.abs(1 - e.x * e.x - e.y * e.y - e.z * e.z)), + t + } + , + r.dot = function(t, e) { + return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w + } + , + r.lerp = function(t, e, i, n) { + return t.x = e.x + n * (i.x - e.x), + t.y = e.y + n * (i.y - e.y), + t.z = e.z + n * (i.z - e.z), + t.w = e.w + n * (i.w - e.w), + t + } + , + r.slerp = function(t, e, i, n) { + var r = 0 + , s = 0 + , a = e.x * i.x + e.y * i.y + e.z * i.z + e.w * i.w; + if (a < 0 && (a = -a, + i.x = -i.x, + i.y = -i.y, + i.z = -i.z, + i.w = -i.w), + 1 - a > 1e-6) { + var o = Math.acos(a) + , l = Math.sin(o); + r = Math.sin((1 - n) * o) / l, + s = Math.sin(n * o) / l + } else + r = 1 - n, + s = n; + return t.x = r * e.x + s * i.x, + t.y = r * e.y + s * i.y, + t.z = r * e.z + s * i.z, + t.w = r * e.w + s * i.w, + t + } + , + r.sqlerp = function(t, e, i, n, s, a) { + return r.slerp(p, e, s, a), + r.slerp(m, i, n, a), + r.slerp(t, p, m, 2 * a * (1 - a)), + t + } + , + r.invert = function(t, e) { + var i = e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w + , n = i ? 1 / i : 0; + return t.x = -e.x * n, + t.y = -e.y * n, + t.z = -e.z * n, + t.w = e.w * n, + t + } + , + r.conjugate = function(t, e) { + return t.x = -e.x, + t.y = -e.y, + t.z = -e.z, + t.w = e.w, + t + } + , + r.len = function(t) { + return Math.sqrt(t.x * t.x + t.y * t.y + t.z * t.z + t.w * t.w) + } + , + r.lengthSqr = function(t) { + return t.x * t.x + t.y * t.y + t.z * t.z + t.w * t.w + } + , + r.normalize = function(t, e) { + var i = e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w; + return i > 0 && (i = 1 / Math.sqrt(i), + t.x = e.x * i, + t.y = e.y * i, + t.z = e.z * i, + t.w = e.w * i), + t + } + , + r.fromAxes = function(t, e, i, n) { + return a.default.set(v, e.x, e.y, e.z, i.x, i.y, i.z, n.x, n.y, n.z), + r.normalize(t, r.fromMat3(t, v)) + } + , + r.fromViewUp = function(t, e, i) { + return a.default.fromViewUp(v, e, i), + r.normalize(t, r.fromMat3(t, v)) + } + , + r.fromAxisAngle = function(t, e, i) { + i *= .5; + var n = Math.sin(i); + return t.x = n * e.x, + t.y = n * e.y, + t.z = n * e.z, + t.w = Math.cos(i), + t + } + , + r.fromAngleZ = function(t, e) { + return e *= g, + t.x = t.y = 0, + t.z = Math.sin(e), + t.w = Math.cos(e), + t + } + , + r.fromMat3 = function(t, e) { + var i = e.m + , n = i[0] + , r = i[1] + , s = i[2] + , a = i[3] + , o = i[4] + , l = i[5] + , h = i[6] + , c = i[7] + , u = i[8] + , _ = n + o + u; + if (_ > 0) { + var f = .5 / Math.sqrt(_ + 1); + t.w = .25 / f, + t.x = (l - c) * f, + t.y = (h - s) * f, + t.z = (r - a) * f + } else if (n > o && n > u) { + var d = 2 * Math.sqrt(1 + n - o - u); + t.w = (l - c) / d, + t.x = .25 * d, + t.y = (a + r) / d, + t.z = (h + s) / d + } else if (o > u) { + var p = 2 * Math.sqrt(1 + o - n - u); + t.w = (h - s) / p, + t.x = (a + r) / p, + t.y = .25 * p, + t.z = (c + l) / p + } else { + var m = 2 * Math.sqrt(1 + u - n - o); + t.w = (r - a) / m, + t.x = (h + s) / m, + t.y = (c + l) / m, + t.z = .25 * m + } + return t + } + , + r.fromEuler = function(t, e, i, n) { + e *= g, + i *= g, + n *= g; + var r = Math.sin(e) + , s = Math.cos(e) + , a = Math.sin(i) + , o = Math.cos(i) + , l = Math.sin(n) + , h = Math.cos(n); + return t.x = r * o * h + s * a * l, + t.y = s * a * h + r * o * l, + t.z = s * o * l - r * a * h, + t.w = s * o * h - r * a * l, + t + } + , + r.toAxisX = function(t, e) { + var i = 2 * e.y + , n = 2 * e.z; + return t.x = 1 - i * e.y - n * e.z, + t.y = i * e.x + n * e.w, + t.z = n * e.x + i * e.w, + t + } + , + r.toAxisY = function(t, e) { + var i = 2 * e.x + , n = 2 * e.y + , r = 2 * e.z; + return t.x = n * e.x - r * e.w, + t.y = 1 - i * e.x - r * e.z, + t.z = r * e.y + i * e.w, + t + } + , + r.toAxisZ = function(t, e) { + var i = 2 * e.x + , n = 2 * e.y + , r = 2 * e.z; + return t.x = r * e.x - n * e.w, + t.y = r * e.y - i * e.w, + t.z = 1 - i * e.x - n * e.y, + t + } + , + r.toEuler = function(t, e, i) { + var n = e.x + , r = e.y + , s = e.z + , a = e.w + , l = 0 + , h = 0 + , c = 0 + , u = n * r + s * a; + if (u > .499999) + l = 0, + h = (0, + o.toDegree)(2 * Math.atan2(n, a)), + c = 90; + else if (u < -.499999) + l = 0, + h = -(0, + o.toDegree)(2 * Math.atan2(n, a)), + c = -90; + else { + var _ = n * n + , f = r * r + , d = s * s; + l = (0, + o.toDegree)(Math.atan2(2 * n * a - 2 * r * s, 1 - 2 * _ - 2 * d)), + h = (0, + o.toDegree)(Math.atan2(2 * r * a - 2 * n * s, 1 - 2 * f - 2 * d)), + c = (0, + o.toDegree)(Math.asin(2 * u)), + i && (l = -180 * Math.sign(l + 1e-6) + l, + h = -180 * Math.sign(h + 1e-6) + h, + c = 180 * Math.sign(c + 1e-6) - c) + } + return t.x = l, + t.y = h, + t.z = c, + t + } + , + r.strictEquals = function(t, e) { + return t.x === e.x && t.y === e.y && t.z === e.z && t.w === e.w + } + , + r.equals = function(t, e, i) { + return void 0 === i && (i = o.EPSILON), + Math.abs(t.x - e.x) <= i * Math.max(1, Math.abs(t.x), Math.abs(e.x)) && Math.abs(t.y - e.y) <= i * Math.max(1, Math.abs(t.y), Math.abs(e.y)) && Math.abs(t.z - e.z) <= i * Math.max(1, Math.abs(t.z), Math.abs(e.z)) && Math.abs(t.w - e.w) <= i * Math.max(1, Math.abs(t.w), Math.abs(e.w)) + } + , + r.toArray = function(t, e, i) { + return void 0 === i && (i = 0), + t[i + 0] = e.x, + t[i + 1] = e.y, + t[i + 2] = e.z, + t[i + 3] = e.w, + t + } + , + r.fromArray = function(t, e, i) { + return void 0 === i && (i = 0), + t.x = e[i + 0], + t.y = e[i + 1], + t.z = e[i + 2], + t.w = e[i + 3], + t + } + , + n.clone = function() { + return new r(this.x,this.y,this.z,this.w) + } + , + n.set = function(t) { + return this.x = t.x, + this.y = t.y, + this.z = t.z, + this.w = t.w, + this + } + , + n.equals = function(t) { + return t && this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w + } + , + n.toEuler = function(t) { + return r.toEuler(t, this) + } + , + n.fromEuler = function(t) { + return r.fromEuler(this, t.x, t.y, t.z) + } + , + n.lerp = function(t, e, i) { + return i = i || new r, + r.slerp(i, this, t, e), + i + } + , + n.multiply = function(t) { + return r.multiply(this, this, t) + } + , + n.rotateAround = function(t, e, i, n) { + return n = n || new r, + r.rotateAround(n, t, e, i) + } + , + r + } + )(n.default); + i.default = d, + d.mul = d.multiply, + d.scale = d.multiplyScalar, + d.mag = d.len, + d.IDENTITY = Object.freeze(new d); + var p = new d + , m = new d + , y = new s.default + , v = new a.default + , g = .5 * Math.PI / 180; + r.default.fastDefine("cc.Quat", d, { + x: 0, + y: 0, + z: 0, + w: 1 + }), + cc.quat = function(t, e, i, n) { + return new d(t,e,i,n) + } + , + cc.Quat = d, + e.exports = i.default + } + ), { + "../platform/CCClass": 193, + "./mat3": 283, + "./utils": 289, + "./value-type": 290, + "./vec3": 292 + }], + 286: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = o(t("./value-type")) + , r = o(t("../platform/CCClass")) + , s = o(t("./vec2")) + , a = o(t("./size")); + function o(t) { + return t && t.__esModule ? t : { + default: t + } + } + function l(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function h(t, e) { + return (h = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var c = (function(t) { + var e, i; + function n(e, i, n, r) { + var s; + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 0), + (s = t.call(this) || this).x = void 0, + s.y = void 0, + s.width = void 0, + s.height = void 0, + e && "object" == typeof e && (i = e.y, + n = e.width, + r = e.height, + e = e.x), + s.x = e || 0, + s.y = i || 0, + s.width = n || 0, + s.height = r || 0, + s + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + h(e, i), + n.fromMinMax = function(t, e) { + var i = Math.min(t.x, e.x) + , r = Math.min(t.y, e.y); + return new n(i,r,Math.max(t.x, e.x) - i,Math.max(t.y, e.y) - r) + } + ; + var r, o, c = n.prototype; + return c.clone = function() { + return new n(this.x,this.y,this.width,this.height) + } + , + c.equals = function(t) { + return t && this.x === t.x && this.y === t.y && this.width === t.width && this.height === t.height + } + , + c.lerp = function(t, e, i) { + i = i || new n; + var r = this.x + , s = this.y + , a = this.width + , o = this.height; + return i.x = r + (t.x - r) * e, + i.y = s + (t.y - s) * e, + i.width = a + (t.width - a) * e, + i.height = o + (t.height - o) * e, + i + } + , + c.set = function(t) { + return this.x = t.x, + this.y = t.y, + this.width = t.width, + this.height = t.height, + this + } + , + c.intersects = function(t) { + var e = this.x + this.width + , i = this.y + this.height + , n = t.x + t.width + , r = t.y + t.height; + return !(e < t.x || n < this.x || i < t.y || r < this.y) + } + , + c.intersection = function(t, e) { + var i = this.x + , n = this.y + , r = this.x + this.width + , s = this.y + this.height + , a = e.x + , o = e.y + , l = e.x + e.width + , h = e.y + e.height; + return t.x = Math.max(i, a), + t.y = Math.max(n, o), + t.width = Math.min(r, l) - t.x, + t.height = Math.min(s, h) - t.y, + t + } + , + c.contains = function(t) { + return this.x <= t.x && this.x + this.width >= t.x && this.y <= t.y && this.y + this.height >= t.y + } + , + c.containsRect = function(t) { + return this.x <= t.x && this.x + this.width >= t.x + t.width && this.y <= t.y && this.y + this.height >= t.y + t.height + } + , + c.union = function(t, e) { + var i = this.x + , n = this.y + , r = this.width + , s = this.height + , a = e.x + , o = e.y + , l = e.width + , h = e.height; + return t.x = Math.min(i, a), + t.y = Math.min(n, o), + t.width = Math.max(i + r, a + l) - t.x, + t.height = Math.max(n + s, o + h) - t.y, + t + } + , + c.transformMat4 = function(t, e) { + var i = this.x + , n = this.y + , r = i + this.width + , s = n + this.height + , a = e.m + , o = a[0] * i + a[4] * n + a[12] + , l = a[1] * i + a[5] * n + a[13] + , h = a[0] * r + a[4] * n + a[12] + , c = a[1] * r + a[5] * n + a[13] + , u = a[0] * i + a[4] * s + a[12] + , _ = a[1] * i + a[5] * s + a[13] + , f = a[0] * r + a[4] * s + a[12] + , d = a[1] * r + a[5] * s + a[13] + , p = Math.min(o, h, u, f) + , m = Math.max(o, h, u, f) + , y = Math.min(l, c, _, d) + , v = Math.max(l, c, _, d); + return t.x = p, + t.y = y, + t.width = m - p, + t.height = v - y, + t + } + , + c.toString = function() { + return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")" + } + , + r = n, + (o = [{ + key: "xMin", + get: function() { + return this.x + }, + set: function(t) { + this.width += this.x - t, + this.x = t + } + }, { + key: "yMin", + get: function() { + return this.y + }, + set: function(t) { + this.height += this.y - t, + this.y = t + } + }, { + key: "xMax", + get: function() { + return this.x + this.width + }, + set: function(t) { + this.width = t - this.x + } + }, { + key: "yMax", + get: function() { + return this.y + this.height + }, + set: function(t) { + this.height = t - this.y + } + }, { + key: "center", + get: function() { + return new s.default(this.x + .5 * this.width,this.y + .5 * this.height) + }, + set: function(t) { + this.x = t.x - .5 * this.width, + this.y = t.y - .5 * this.height + } + }, { + key: "origin", + get: function() { + return new s.default(this.x,this.y) + }, + set: function(t) { + this.x = t.x, + this.y = t.y + } + }, { + key: "size", + get: function() { + return new a.default(this.width,this.height) + }, + set: function(t) { + this.width = t.width, + this.height = t.height + } + }]) && l(r.prototype, o), + n + } + )(n.default); + i.default = c, + r.default.fastDefine("cc.Rect", c, { + x: 0, + y: 0, + width: 0, + height: 0 + }), + cc.Rect = c, + cc.rect = function(t, e, i, n) { + return new c(t,e,i,n) + } + , + e.exports = i.default + } + ), { + "../platform/CCClass": 193, + "./size": 287, + "./value-type": 290, + "./vec2": 291 + }], + 287: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = s(t("./value-type")) + , r = s(t("../platform/CCClass")); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + function a(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function o(t, e) { + return (o = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var l = (function(t) { + var e, i; + function n(e, i) { + var n; + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + (n = t.call(this) || this).width = void 0, + n.height = void 0, + e && "object" == typeof e ? (n.width = e.width, + n.height = e.height) : (n.width = e || 0, + n.height = i || 0), + n + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + o(e, i); + var r, s, l = n.prototype; + return l.clone = function() { + return new n(this.width,this.height) + } + , + l.equals = function(t) { + return t && this.width === t.width && this.height === t.height + } + , + l.lerp = function(t, e, i) { + i = i || new n; + var r = this.width + , s = this.height; + return i.width = r + (t.width - r) * e, + i.height = s + (t.height - s) * e, + i + } + , + l.set = function(t) { + return this.width = t.width, + this.height = t.height, + this + } + , + l.toString = function() { + return "(" + this.width.toFixed(2) + ", " + this.height.toFixed(2) + ")" + } + , + r = n, + s = [{ + key: "ZERO", + get: function() { + return new n + } + }], + null && a(r.prototype, null), + s && a(r, s), + n + } + )(n.default); + i.default = l, + l.ZERO_R = l.ZERO, + r.default.fastDefine("cc.Size", l, { + width: 0, + height: 0 + }), + cc.size = function(t, e) { + return new l(t,e) + } + , + cc.Size = l, + e.exports = i.default + } + ), { + "../platform/CCClass": 193, + "./value-type": 290 + }], + 288: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("./quat")) && n.__esModule ? n : { + default: n + }, s = new r.default, a = (function() { + function t() {} + return t.toRotation = function(t, e) { + return t.x = e[3], + t.y = e[4], + t.z = e[5], + t.w = e[6], + t + } + , + t.fromRotation = function(t, e) { + return t[3] = e.x, + t[4] = e.y, + t[5] = e.z, + t[6] = e.w, + t + } + , + t.toEuler = function(e, i) { + return t.toRotation(s, i), + r.default.toEuler(e, s), + e + } + , + t.fromEuler = function(e, i) { + return r.default.fromEuler(s, i.x, i.y, i.z), + t.fromRotation(e, s), + e + } + , + t.fromEulerNumber = function(e, i, n, a) { + return r.default.fromEuler(s, i, n, a), + t.fromRotation(e, s), + e + } + , + t.toScale = function(t, e) { + return t.x = e[7], + t.y = e[8], + t.z = e[9], + t + } + , + t.fromScale = function(t, e) { + return t[7] = e.x, + t[8] = e.y, + t[9] = e.z, + t + } + , + t.toPosition = function(t, e) { + return t.x = e[0], + t.y = e[1], + t.z = e[2], + t + } + , + t.fromPosition = function(t, e) { + return t[0] = e.x, + t[1] = e.y, + t[2] = e.z, + t + } + , + t.fromAngleZ = function(e, i) { + return r.default.fromAngleZ(s, i), + t.fromRotation(e, s), + e + } + , + t.toMat4 = function(t, e) { + var i = e[3] + , n = e[4] + , r = e[5] + , s = e[6] + , a = i + i + , o = n + n + , l = r + r + , h = i * a + , c = i * o + , u = i * l + , _ = n * o + , f = n * l + , d = r * l + , p = s * a + , m = s * o + , y = s * l + , v = e[7] + , g = e[8] + , A = e[9] + , x = t.m; + return x[0] = (1 - (_ + d)) * v, + x[1] = (c + y) * v, + x[2] = (u - m) * v, + x[3] = 0, + x[4] = (c - y) * g, + x[5] = (1 - (h + d)) * g, + x[6] = (f + p) * g, + x[7] = 0, + x[8] = (u + m) * A, + x[9] = (f - p) * A, + x[10] = (1 - (h + _)) * A, + x[11] = 0, + x[12] = e[0], + x[13] = e[1], + x[14] = e[2], + x[15] = 1, + t + } + , + t + } + )(); + i.default = a, + cc.Trs = a, + e.exports = i.default + } + ), { + "./quat": 285 + }], + 289: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.equals = function(t, e) { + return Math.abs(t - e) <= s * Math.max(1, Math.abs(t), Math.abs(e)) + } + , + i.approx = function(t, e, i) { + return i = i || s, + Math.abs(t - e) <= i + } + , + i.clamp = function(t, e, i) { + return t < e ? e : t > i ? i : t + } + , + i.clamp01 = function(t) { + return t < 0 ? 0 : t > 1 ? 1 : t + } + , + i.lerp = function(t, e, i) { + return t + (e - t) * i + } + , + i.toRadian = function(t) { + return t * n + } + , + i.toDegree = function(t) { + return t * r + } + , + i.randomRange = l, + i.randomRangeInt = function(t, e) { + return Math.floor(l(t, e)) + } + , + i.pseudoRandom = h, + i.pseudoRandomRange = c, + i.pseudoRandomRangeInt = function(t, e, i) { + return Math.floor(c(t, e, i)) + } + , + i.nextPow2 = function(t) { + return --t, + t |= t >> 1, + t |= t >> 2, + t |= t >> 4, + t |= t >> 8, + t |= t >> 16, + ++t + } + , + i.repeat = u, + i.pingPong = function(t, e) { + return t = u(t, 2 * e), + e - Math.abs(t - e) + } + , + i.inverseLerp = function(t, e, i) { + return (i - t) / (e - t) + } + , + i.sign = function(t) { + return (t > 0) - (t < 0) + } + , + i.random = i.FLOAT_BYTES = i.FLOAT_ARRAY_TYPE = i.INT_MIN = i.INT_MAX = i.INT_BITS = i.EPSILON = void 0; + var n = Math.PI / 180 + , r = 180 / Math.PI + , s = 1e-6; + i.EPSILON = s, + i.INT_BITS = 32, + i.INT_MAX = 2147483647, + i.INT_MIN = -1 << 31; + var a = Float64Array; + i.FLOAT_ARRAY_TYPE = a, + i.FLOAT_BYTES = 8; + var o = Math.random; + function l(t, e) { + return Math.random() * (e - t) + t + } + function h(t) { + return (t = (9301 * t + 49297) % 233280) / 233280 + } + function c(t, e, i) { + return h(t) * (i - e) + e + } + function u(t, e) { + return t - Math.floor(t / e) * e + } + i.random = o + } + ), {}], + 290: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../platform/js")) && n.__esModule ? n : { + default: n + }, s = (function() { + function t() {} + var e = t.prototype; + return e.clone = function() { + return cc.errorID("0100", r.default.getClassName(this) + ".clone"), + null + } + , + e.equals = function() { + return cc.errorID("0100", r.default.getClassName(this) + ".equals"), + !1 + } + , + e.lerp = function() { + return cc.errorID("0100", r.default.getClassName(this) + ".lerp"), + this.clone() + } + , + e.set = function() { + cc.errorID("0100", r.default.getClassName(this) + ".set") + } + , + e.toString = function() { + return "" + {} + } + , + t + } + )(); + i.default = s, + r.default.setClassName("cc.ValueType", s), + cc.ValueType = s, + e.exports = i.default + } + ), { + "../platform/js": 214 + }], + 291: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = o(t("./value-type")) + , r = o(t("../platform/CCClass")) + , s = o(t("../utils/misc")) + , a = t("./utils"); + function o(t) { + return t && t.__esModule ? t : { + default: t + } + } + function l(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function h(t, e) { + return (h = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var c = 0 + , u = 0 + , _ = (function(t) { + var e, i; + i = t, + (e = _).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + h(e, i); + var n, r, o = _.prototype; + function _(e, i) { + var n; + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + (n = t.call(this) || this).mag = _.prototype.len, + n.magSqr = _.prototype.lengthSqr, + n.subSelf = _.prototype.subtract, + n.mulSelf = _.prototype.multiplyScalar, + n.divSelf = _.prototype.divide, + n.scaleSelf = _.prototype.multiply, + n.negSelf = _.prototype.negate, + n.x = void 0, + n.y = void 0, + n.z = 0, + e && "object" == typeof e ? (n.x = e.x || 0, + n.y = e.y || 0) : (n.x = e || 0, + n.y = i || 0), + n + } + return o.sub = function(t, e) { + return _.subtract(e || new _, this, t) + } + , + o.mul = function(t, e) { + return _.multiplyScalar(e || new _, this, t) + } + , + o.div = function(t, e) { + return _.multiplyScalar(e || new _, this, 1 / t) + } + , + o.scale = function(t, e) { + return _.multiply(e || new _, this, t) + } + , + o.neg = function(t) { + return _.negate(t || new _, this) + } + , + _.clone = function(t) { + return new _(t.x,t.y) + } + , + _.copy = function(t, e) { + return t.x = e.x, + t.y = e.y, + t + } + , + _.set = function(t, e, i) { + return t.x = e, + t.y = i, + t + } + , + _.add = function(t, e, i) { + return t.x = e.x + i.x, + t.y = e.y + i.y, + t + } + , + _.subtract = function(t, e, i) { + return t.x = e.x - i.x, + t.y = e.y - i.y, + t + } + , + _.multiply = function(t, e, i) { + return t.x = e.x * i.x, + t.y = e.y * i.y, + t + } + , + _.divide = function(t, e, i) { + return t.x = e.x / i.x, + t.y = e.y / i.y, + t + } + , + _.ceil = function(t, e) { + return t.x = Math.ceil(e.x), + t.y = Math.ceil(e.y), + t + } + , + _.floor = function(t, e) { + return t.x = Math.floor(e.x), + t.y = Math.floor(e.y), + t + } + , + _.min = function(t, e, i) { + return t.x = Math.min(e.x, i.x), + t.y = Math.min(e.y, i.y), + t + } + , + _.max = function(t, e, i) { + return t.x = Math.max(e.x, i.x), + t.y = Math.max(e.y, i.y), + t + } + , + _.round = function(t, e) { + return t.x = Math.round(e.x), + t.y = Math.round(e.y), + t + } + , + _.multiplyScalar = function(t, e, i) { + return t.x = e.x * i, + t.y = e.y * i, + t + } + , + _.scaleAndAdd = function(t, e, i, n) { + return t.x = e.x + i.x * n, + t.y = e.y + i.y * n, + t + } + , + _.distance = function(t, e) { + return c = e.x - t.x, + u = e.y - t.y, + Math.sqrt(c * c + u * u) + } + , + _.squaredDistance = function(t, e) { + return c = e.x - t.x, + u = e.y - t.y, + c * c + u * u + } + , + _.len = function(t) { + return c = t.x, + u = t.y, + Math.sqrt(c * c + u * u) + } + , + _.lengthSqr = function(t) { + return c = t.x, + u = t.y, + c * c + u * u + } + , + _.negate = function(t, e) { + return t.x = -e.x, + t.y = -e.y, + t + } + , + _.inverse = function(t, e) { + return t.x = 1 / e.x, + t.y = 1 / e.y, + t + } + , + _.inverseSafe = function(t, e) { + return c = e.x, + u = e.y, + Math.abs(c) < a.EPSILON ? t.x = 0 : t.x = 1 / c, + Math.abs(u) < a.EPSILON ? t.y = 0 : t.y = 1 / u, + t + } + , + _.normalize = function(t, e) { + c = e.x, + u = e.y; + var i = c * c + u * u; + return i > 0 && (i = 1 / Math.sqrt(i), + t.x = c * i, + t.y = u * i), + t + } + , + _.dot = function(t, e) { + return t.x * e.x + t.y * e.y + } + , + _.cross = function(t, e, i) { + return t.x = t.y = 0, + t.z = e.x * i.y - e.y * i.x, + t + } + , + _.lerp = function(t, e, i, n) { + return c = e.x, + u = e.y, + t.x = c + n * (i.x - c), + t.y = u + n * (i.y - u), + t + } + , + _.random = function(t, e) { + e = e || 1; + var i = 2 * (0, + a.random)() * Math.PI; + return t.x = Math.cos(i) * e, + t.y = Math.sin(i) * e, + t + } + , + _.transformMat3 = function(t, e, i) { + c = e.x, + u = e.y; + var n = i.m; + return t.x = n[0] * c + n[3] * u + n[6], + t.y = n[1] * c + n[4] * u + n[7], + t + } + , + _.transformMat4 = function(t, e, i) { + c = e.x, + u = e.y; + var n = i.m; + return t.x = n[0] * c + n[4] * u + n[12], + t.y = n[1] * c + n[5] * u + n[13], + t + } + , + _.strictEquals = function(t, e) { + return t.x === e.x && t.y === e.y + } + , + _.equals = function(t, e, i) { + return void 0 === i && (i = a.EPSILON), + Math.abs(t.x - e.x) <= i * Math.max(1, Math.abs(t.x), Math.abs(e.x)) && Math.abs(t.y - e.y) <= i * Math.max(1, Math.abs(t.y), Math.abs(e.y)) + } + , + _.angle = function(t, e) { + _.normalize(f, t), + _.normalize(d, e); + var i = _.dot(f, d); + return i > 1 ? 0 : i < -1 ? Math.PI : Math.acos(i) + } + , + _.toArray = function(t, e, i) { + return void 0 === i && (i = 0), + t[i + 0] = e.x, + t[i + 1] = e.y, + t + } + , + _.fromArray = function(t, e, i) { + return void 0 === i && (i = 0), + t.x = e[i + 0], + t.y = e[i + 1], + t + } + , + o.clone = function() { + return new _(this.x,this.y) + } + , + o.set = function(t) { + return this.x = t.x, + this.y = t.y, + this + } + , + o.equals = function(t) { + return t && this.x === t.x && this.y === t.y + } + , + o.fuzzyEquals = function(t, e) { + return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e + } + , + o.toString = function() { + return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ")" + } + , + o.lerp = function(t, e, i) { + i = i || new _; + var n = this.x + , r = this.y; + return i.x = n + (t.x - n) * e, + i.y = r + (t.y - r) * e, + i + } + , + o.clampf = function(t, e) { + return this.x = s.default.clampf(this.x, t.x, e.x), + this.y = s.default.clampf(this.y, t.y, e.y), + this + } + , + o.add = function(t, e) { + return (e = e || new _).x = this.x + t.x, + e.y = this.y + t.y, + e + } + , + o.addSelf = function(t) { + return this.x += t.x, + this.y += t.y, + this + } + , + o.subtract = function(t) { + return this.x -= t.x, + this.y -= t.y, + this + } + , + o.multiplyScalar = function(t) { + return this.x *= t, + this.y *= t, + this + } + , + o.multiply = function(t) { + return this.x *= t.x, + this.y *= t.y, + this + } + , + o.divide = function(t) { + return this.x /= t, + this.y /= t, + this + } + , + o.negate = function() { + return this.x = -this.x, + this.y = -this.y, + this + } + , + o.dot = function(t) { + return this.x * t.x + this.y * t.y + } + , + o.cross = function(t) { + return this.x * t.y - this.y * t.x + } + , + o.len = function() { + return Math.sqrt(this.x * this.x + this.y * this.y) + } + , + o.lengthSqr = function() { + return this.x * this.x + this.y * this.y + } + , + o.normalizeSelf = function() { + var t = this.x * this.x + this.y * this.y; + if (1 === t) + return this; + if (0 === t) + return this; + var e = 1 / Math.sqrt(t); + return this.x *= e, + this.y *= e, + this + } + , + o.normalize = function(t) { + return (t = t || new _).x = this.x, + t.y = this.y, + t.normalizeSelf(), + t + } + , + o.angle = function(t) { + var e = this.magSqr() + , i = t.magSqr(); + if (0 === e || 0 === i) + return console.warn("Can't get angle between zero vector"), + 0; + var n = this.dot(t) / Math.sqrt(e * i); + return n = s.default.clampf(n, -1, 1), + Math.acos(n) + } + , + o.signAngle = function(t) { + var e = this.angle(t); + return this.cross(t) < 0 ? -e : e + } + , + o.rotate = function(t, e) { + return (e = e || new _).x = this.x, + e.y = this.y, + e.rotateSelf(t) + } + , + o.rotateSelf = function(t) { + var e = Math.sin(t) + , i = Math.cos(t) + , n = this.x; + return this.x = i * n - e * this.y, + this.y = e * n + i * this.y, + this + } + , + o.project = function(t) { + return t.multiplyScalar(this.dot(t) / t.dot(t)) + } + , + o.transformMat4 = function(t, e) { + return e = e || new _, + _.transformMat4(e, this, t), + e + } + , + o.maxAxis = function() { + return Math.max(this.x, this.y) + } + , + n = _, + r = [{ + key: "ONE", + get: function() { + return new _(1,1) + } + }, { + key: "ZERO", + get: function() { + return new _(0,0) + } + }, { + key: "UP", + get: function() { + return new _(0,1) + } + }, { + key: "RIGHT", + get: function() { + return new _(1,0) + } + }], + null && l(n.prototype, null), + r && l(n, r), + _ + } + )(n.default); + i.default = _, + _.sub = _.subtract, + _.mul = _.multiply, + _.scale = _.multiplyScalar, + _.mag = _.len, + _.squaredMagnitude = _.lengthSqr, + _.div = _.divide, + _.ONE_R = _.ONE, + _.ZERO_R = _.ZERO, + _.UP_R = _.UP, + _.RIGHT_R = _.RIGHT; + var f = new _ + , d = new _; + r.default.fastDefine("cc.Vec2", _, { + x: 0, + y: 0 + }), + cc.v2 = function(t, e) { + return new _(t,e) + } + , + cc.Vec2 = _, + e.exports = i.default + } + ), { + "../platform/CCClass": 193, + "../utils/misc": 267, + "./utils": 289, + "./value-type": 290 + }], + 292: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = l(t("./value-type")) + , r = l(t("../platform/CCClass")) + , s = l(t("../utils/misc")) + , a = l(t("./vec2")) + , o = t("./utils"); + function l(t) { + return t && t.__esModule ? t : { + default: t + } + } + function h(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function c(t, e) { + return (c = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var u = 0 + , _ = 0 + , f = 0 + , d = (function(t) { + var e, i; + i = t, + (e = d).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + c(e, i); + var n, r, l = d.prototype; + function d(e, i, n) { + var r; + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + (r = t.call(this) || this).mag = d.prototype.len, + r.magSqr = d.prototype.lengthSqr, + r.subSelf = d.prototype.subtract, + r.mulSelf = d.prototype.multiplyScalar, + r.divSelf = d.prototype.divide, + r.scaleSelf = d.prototype.multiply, + r.negSelf = d.prototype.negate, + r.x = void 0, + r.y = void 0, + r.z = void 0, + r.angle = a.default.prototype.angle, + r.project = a.default.prototype.project, + e && "object" == typeof e ? (r.x = e.x, + r.y = e.y, + r.z = e.z) : (r.x = e, + r.y = i, + r.z = n), + r + } + return l.sub = function(t, e) { + return d.subtract(e || new d, this, t) + } + , + l.mul = function(t, e) { + return d.multiplyScalar(e || new d, this, t) + } + , + l.div = function(t, e) { + return d.multiplyScalar(e || new d, this, 1 / t) + } + , + l.scale = function(t, e) { + return d.multiply(e || new d, this, t) + } + , + l.neg = function(t) { + return d.negate(t || new d, this) + } + , + d.zero = function(t) { + return t.x = 0, + t.y = 0, + t.z = 0, + t + } + , + d.clone = function(t) { + return new d(t.x,t.y,t.z) + } + , + d.copy = function(t, e) { + return t.x = e.x, + t.y = e.y, + t.z = e.z, + t + } + , + d.set = function(t, e, i, n) { + return t.x = e, + t.y = i, + t.z = n, + t + } + , + d.add = function(t, e, i) { + return t.x = e.x + i.x, + t.y = e.y + i.y, + t.z = e.z + i.z, + t + } + , + d.subtract = function(t, e, i) { + return t.x = e.x - i.x, + t.y = e.y - i.y, + t.z = e.z - i.z, + t + } + , + d.multiply = function(t, e, i) { + return t.x = e.x * i.x, + t.y = e.y * i.y, + t.z = e.z * i.z, + t + } + , + d.divide = function(t, e, i) { + return t.x = e.x / i.x, + t.y = e.y / i.y, + t.z = e.z / i.z, + t + } + , + d.ceil = function(t, e) { + return t.x = Math.ceil(e.x), + t.y = Math.ceil(e.y), + t.z = Math.ceil(e.z), + t + } + , + d.floor = function(t, e) { + return t.x = Math.floor(e.x), + t.y = Math.floor(e.y), + t.z = Math.floor(e.z), + t + } + , + d.min = function(t, e, i) { + return t.x = Math.min(e.x, i.x), + t.y = Math.min(e.y, i.y), + t.z = Math.min(e.z, i.z), + t + } + , + d.max = function(t, e, i) { + return t.x = Math.max(e.x, i.x), + t.y = Math.max(e.y, i.y), + t.z = Math.max(e.z, i.z), + t + } + , + d.round = function(t, e) { + return t.x = Math.round(e.x), + t.y = Math.round(e.y), + t.z = Math.round(e.z), + t + } + , + d.multiplyScalar = function(t, e, i) { + return t.x = e.x * i, + t.y = e.y * i, + t.z = e.z * i, + t + } + , + d.scaleAndAdd = function(t, e, i, n) { + return t.x = e.x + i.x * n, + t.y = e.y + i.y * n, + t.z = e.z + i.z * n, + t + } + , + d.distance = function(t, e) { + return u = e.x - t.x, + _ = e.y - t.y, + f = e.z - t.z, + Math.sqrt(u * u + _ * _ + f * f) + } + , + d.squaredDistance = function(t, e) { + return u = e.x - t.x, + _ = e.y - t.y, + f = e.z - t.z, + u * u + _ * _ + f * f + } + , + d.len = function(t) { + return u = t.x, + _ = t.y, + f = t.z, + Math.sqrt(u * u + _ * _ + f * f) + } + , + d.lengthSqr = function(t) { + return u = t.x, + _ = t.y, + f = t.z, + u * u + _ * _ + f * f + } + , + d.negate = function(t, e) { + return t.x = -e.x, + t.y = -e.y, + t.z = -e.z, + t + } + , + d.inverse = function(t, e) { + return t.x = 1 / e.x, + t.y = 1 / e.y, + t.z = 1 / e.z, + t + } + , + d.inverseSafe = function(t, e) { + return u = e.x, + _ = e.y, + f = e.z, + Math.abs(u) < o.EPSILON ? t.x = 0 : t.x = 1 / u, + Math.abs(_) < o.EPSILON ? t.y = 0 : t.y = 1 / _, + Math.abs(f) < o.EPSILON ? t.z = 0 : t.z = 1 / f, + t + } + , + d.normalize = function(t, e) { + u = e.x, + _ = e.y, + f = e.z; + var i = u * u + _ * _ + f * f; + return i > 0 && (i = 1 / Math.sqrt(i), + t.x = u * i, + t.y = _ * i, + t.z = f * i), + t + } + , + d.dot = function(t, e) { + return t.x * e.x + t.y * e.y + t.z * e.z + } + , + d.cross = function(t, e, i) { + var n = e.x + , r = e.y + , s = e.z + , a = i.x + , o = i.y + , l = i.z; + return t.x = r * l - s * o, + t.y = s * a - n * l, + t.z = n * o - r * a, + t + } + , + d.lerp = function(t, e, i, n) { + return t.x = e.x + n * (i.x - e.x), + t.y = e.y + n * (i.y - e.y), + t.z = e.z + n * (i.z - e.z), + t + } + , + d.random = function(t, e) { + e = e || 1; + var i = 2 * (0, + o.random)() * Math.PI + , n = 2 * (0, + o.random)() - 1 + , r = Math.sqrt(1 - n * n); + return t.x = r * Math.cos(i) * e, + t.y = r * Math.sin(i) * e, + t.z = n * e, + t + } + , + d.transformMat4 = function(t, e, i) { + u = e.x, + _ = e.y, + f = e.z; + var n = i.m + , r = n[3] * u + n[7] * _ + n[11] * f + n[15]; + return r = r ? 1 / r : 1, + t.x = (n[0] * u + n[4] * _ + n[8] * f + n[12]) * r, + t.y = (n[1] * u + n[5] * _ + n[9] * f + n[13]) * r, + t.z = (n[2] * u + n[6] * _ + n[10] * f + n[14]) * r, + t + } + , + d.transformMat4Normal = function(t, e, i) { + u = e.x, + _ = e.y, + f = e.z; + var n = i.m + , r = n[3] * u + n[7] * _ + n[11] * f; + return r = r ? 1 / r : 1, + t.x = (n[0] * u + n[4] * _ + n[8] * f) * r, + t.y = (n[1] * u + n[5] * _ + n[9] * f) * r, + t.z = (n[2] * u + n[6] * _ + n[10] * f) * r, + t + } + , + d.transformMat3 = function(t, e, i) { + u = e.x, + _ = e.y, + f = e.z; + var n = i.m; + return t.x = u * n[0] + _ * n[3] + f * n[6], + t.y = u * n[1] + _ * n[4] + f * n[7], + t.z = u * n[2] + _ * n[5] + f * n[8], + t + } + , + d.transformAffine = function(t, e, i) { + u = e.x, + _ = e.y, + f = e.z; + var n = i.m; + return t.x = n[0] * u + n[1] * _ + n[2] * f + n[3], + t.y = n[4] * u + n[5] * _ + n[6] * f + n[7], + t.x = n[8] * u + n[9] * _ + n[10] * f + n[11], + t + } + , + d.transformQuat = function(t, e, i) { + var n = i.w * e.x + i.y * e.z - i.z * e.y + , r = i.w * e.y + i.z * e.x - i.x * e.z + , s = i.w * e.z + i.x * e.y - i.y * e.x + , a = -i.x * e.x - i.y * e.y - i.z * e.z; + return t.x = n * i.w + a * -i.x + r * -i.z - s * -i.y, + t.y = r * i.w + a * -i.y + s * -i.x - n * -i.z, + t.z = s * i.w + a * -i.z + n * -i.y - r * -i.x, + t + } + , + d.transformRTS = function(t, e, i, n, r) { + var s = e.x * r.x + , a = e.y * r.y + , o = e.z * r.z + , l = i.w * s + i.y * o - i.z * a + , h = i.w * a + i.z * s - i.x * o + , c = i.w * o + i.x * a - i.y * s + , u = -i.x * s - i.y * a - i.z * o; + return t.x = l * i.w + u * -i.x + h * -i.z - c * -i.y + n.x, + t.y = h * i.w + u * -i.y + c * -i.x - l * -i.z + n.y, + t.z = c * i.w + u * -i.z + l * -i.y - h * -i.x + n.z, + t + } + , + d.transformInverseRTS = function(t, e, i, n, r) { + var s = e.x - n.x + , a = e.y - n.y + , o = e.z - n.z + , l = i.w * s - i.y * o + i.z * a + , h = i.w * a - i.z * s + i.x * o + , c = i.w * o - i.x * a + i.y * s + , u = i.x * s + i.y * a + i.z * o; + return t.x = (l * i.w + u * i.x + h * i.z - c * i.y) / r.x, + t.y = (h * i.w + u * i.y + c * i.x - l * i.z) / r.y, + t.z = (c * i.w + u * i.z + l * i.y - h * i.x) / r.z, + t + } + , + d.rotateX = function(t, e, i, n) { + u = e.x - i.x, + _ = e.y - i.y, + f = e.z - i.z; + var r = Math.cos(n) + , s = Math.sin(n) + , a = u + , o = _ * r - f * s + , l = _ * s + f * r; + return t.x = a + i.x, + t.y = o + i.y, + t.z = l + i.z, + t + } + , + d.rotateY = function(t, e, i, n) { + u = e.x - i.x, + _ = e.y - i.y, + f = e.z - i.z; + var r = Math.cos(n) + , s = Math.sin(n) + , a = f * s + u * r + , o = _ + , l = f * r - u * s; + return t.x = a + i.x, + t.y = o + i.y, + t.z = l + i.z, + t + } + , + d.rotateZ = function(t, e, i, n) { + u = e.x - i.x, + _ = e.y - i.y, + f = e.z - i.z; + var r = Math.cos(n) + , s = Math.sin(n) + , a = u * r - _ * s + , o = u * s + _ * r + , l = f; + return t.x = a + i.x, + t.y = o + i.y, + t.z = l + i.z, + t + } + , + d.strictEquals = function(t, e) { + return t.x === e.x && t.y === e.y && t.z === e.z + } + , + d.equals = function(t, e, i) { + void 0 === i && (i = o.EPSILON); + var n = t.x + , r = t.y + , s = t.z + , a = e.x + , l = e.y + , h = e.z; + return Math.abs(n - a) <= i * Math.max(1, Math.abs(n), Math.abs(a)) && Math.abs(r - l) <= i * Math.max(1, Math.abs(r), Math.abs(l)) && Math.abs(s - h) <= i * Math.max(1, Math.abs(s), Math.abs(h)) + } + , + d.angle = function(t, e) { + d.normalize(p, t), + d.normalize(m, e); + var i = d.dot(p, m); + return i > 1 ? 0 : i < -1 ? Math.PI : Math.acos(i) + } + , + d.projectOnPlane = function(t, e, i) { + return d.subtract(t, e, d.project(t, e, i)) + } + , + d.project = function(t, e, i) { + var n = d.lengthSqr(i); + return n < 1e-6 ? d.set(t, 0, 0, 0) : d.multiplyScalar(t, i, d.dot(e, i) / n) + } + , + d.toArray = function(t, e, i) { + return void 0 === i && (i = 0), + t[i + 0] = e.x, + t[i + 1] = e.y, + t[i + 2] = e.z, + t + } + , + d.fromArray = function(t, e, i) { + return void 0 === i && (i = 0), + t.x = e[i + 0], + t.y = e[i + 1], + t.z = e[i + 2], + t + } + , + l.clone = function() { + return new d(this.x,this.y,this.z) + } + , + l.set = function(t) { + return this.x = t.x, + this.y = t.y, + this.z = t.z, + this + } + , + l.equals = function(t) { + return t && this.x === t.x && this.y === t.y && this.z === t.z + } + , + l.fuzzyEquals = function(t, e) { + return this.x - e <= t.x && t.x <= this.x + e && this.y - e <= t.y && t.y <= this.y + e && this.z - e <= t.z && t.z <= this.z + e + } + , + l.toString = function() { + return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.z.toFixed(2) + ")" + } + , + l.lerp = function(t, e, i) { + return i = i || new d, + d.lerp(i, this, t, e), + i + } + , + l.clampf = function(t, e) { + return this.x = s.default.clampf(this.x, t.x, e.x), + this.y = s.default.clampf(this.y, t.y, e.y), + this.z = s.default.clampf(this.z, t.z, e.z), + this + } + , + l.addSelf = function(t) { + return this.x += t.x, + this.y += t.y, + this.z += t.z, + this + } + , + l.add = function(t, e) { + return (e = e || new d).x = this.x + t.x, + e.y = this.y + t.y, + e.z = this.z + t.z, + e + } + , + l.subtract = function(t) { + return this.x -= t.x, + this.y -= t.y, + this.z -= t.z, + this + } + , + l.multiplyScalar = function(t) { + return this.x *= t, + this.y *= t, + this.z *= t, + this + } + , + l.multiply = function(t) { + return this.x *= t.x, + this.y *= t.y, + this.z *= t.z, + this + } + , + l.divide = function(t) { + return this.x /= t, + this.y /= t, + this.z /= t, + this + } + , + l.negate = function() { + return this.x = -this.x, + this.y = -this.y, + this.z = -this.z, + this + } + , + l.dot = function(t) { + return this.x * t.x + this.y * t.y + this.z * t.z + } + , + l.cross = function(t, e) { + return e = e || new d, + d.cross(e, this, t), + e + } + , + l.len = function() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z) + } + , + l.lengthSqr = function() { + return this.x * this.x + this.y * this.y + this.z * this.z + } + , + l.normalizeSelf = function() { + return d.normalize(this, this), + this + } + , + l.normalize = function(t) { + return t = t || new d, + d.normalize(t, this), + t + } + , + l.transformMat4 = function(t, e) { + return e = e || new d, + d.transformMat4(e, this, t), + e + } + , + l.maxAxis = function() { + return Math.max(this.x, this.y, this.z) + } + , + l.signAngle = function(t) { + cc.warnID(1408, "vec3.signAngle", "v2.1", "cc.v2(selfVector).signAngle(vector)"); + var e = new a.default(this.x,this.y) + , i = new a.default(t.x,t.y); + return e.signAngle(i) + } + , + l.rotate = function(t, e) { + return cc.warnID(1408, "vec3.rotate", "v2.1", "cc.v2(selfVector).rotate(radians, out)"), + a.default.prototype.rotate.call(this, t, e) + } + , + l.rotateSelf = function(t) { + return cc.warnID(1408, "vec3.rotateSelf", "v2.1", "cc.v2(selfVector).rotateSelf(radians)"), + a.default.prototype.rotateSelf.call(this, t) + } + , + n = d, + r = [{ + key: "ONE", + get: function() { + return new d(1,1,1) + } + }, { + key: "ZERO", + get: function() { + return new d + } + }, { + key: "UP", + get: function() { + return new d(0,1,0) + } + }, { + key: "RIGHT", + get: function() { + return new d(1,0,0) + } + }, { + key: "FORWARD", + get: function() { + return new d(0,0,1) + } + }], + null && h(n.prototype, null), + r && h(n, r), + d + } + )(n.default); + i.default = d, + d.sub = d.subtract, + d.mul = d.multiply, + d.scale = d.multiplyScalar, + d.mag = d.len, + d.squaredMagnitude = d.lengthSqr, + d.div = d.divide, + d.ONE_R = d.ONE, + d.ZERO_R = d.ZERO, + d.UP_R = d.UP, + d.RIGHT_R = d.RIGHT, + d.FRONT_R = d.FORWARD; + var p = new d + , m = new d; + r.default.fastDefine("cc.Vec3", d, { + x: 0, + y: 0, + z: 0 + }), + cc.v3 = function(t, e, i) { + return new d(t,e,i) + } + , + cc.Vec3 = d, + e.exports = i.default + } + ), { + "../platform/CCClass": 193, + "../utils/misc": 267, + "./utils": 289, + "./value-type": 290, + "./vec2": 291 + }], + 293: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.v4 = d, + i.default = void 0; + var n = a(t("../platform/CCClass")) + , r = a(t("./value-type")) + , s = t("./utils"); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + function o(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + function l(t, e) { + return (l = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var h = 0 + , c = 0 + , u = 0 + , _ = 0 + , f = (function(t) { + var e, i; + i = t, + (e = f).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + l(e, i); + var n, r, a = f.prototype; + function f(e, i, n, r) { + var s; + return void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 0), + (s = t.call(this) || this).mag = f.prototype.len, + s.magSqr = f.prototype.lengthSqr, + s.subSelf = f.prototype.subtract, + s.mulSelf = f.prototype.multiplyScalar, + s.divSelf = f.prototype.divide, + s.scaleSelf = f.prototype.multiply, + s.negSelf = f.prototype.negate, + s.x = void 0, + s.y = void 0, + s.z = void 0, + s.w = void 0, + e && "object" == typeof e ? (s.x = e.x, + s.y = e.y, + s.z = e.z, + s.w = e.w) : (s.x = e, + s.y = i, + s.z = n, + s.w = r), + s + } + return a.sub = function(t, e) { + return f.subtract(e || new f, this, t) + } + , + a.mul = function(t, e) { + return f.multiplyScalar(e || new f, this, t) + } + , + a.div = function(t, e) { + return f.multiplyScalar(e || new f, this, 1 / t) + } + , + a.scale = function(t, e) { + return f.multiply(e || new f, this, t) + } + , + a.neg = function(t) { + return f.negate(t || new f, this) + } + , + f.clone = function(t) { + return new f(t.x,t.y,t.z,t.w) + } + , + f.copy = function(t, e) { + return t.x = e.x, + t.y = e.y, + t.z = e.z, + t.w = e.w, + t + } + , + f.set = function(t, e, i, n, r) { + return t.x = e, + t.y = i, + t.z = n, + t.w = r, + t + } + , + f.add = function(t, e, i) { + return t.x = e.x + i.x, + t.y = e.y + i.y, + t.z = e.z + i.z, + t.w = e.w + i.w, + t + } + , + f.subtract = function(t, e, i) { + return t.x = e.x - i.x, + t.y = e.y - i.y, + t.z = e.z - i.z, + t.w = e.w - i.w, + t + } + , + f.multiply = function(t, e, i) { + return t.x = e.x * i.x, + t.y = e.y * i.y, + t.z = e.z * i.z, + t.w = e.w * i.w, + t + } + , + f.divide = function(t, e, i) { + return t.x = e.x / i.x, + t.y = e.y / i.y, + t.z = e.z / i.z, + t.w = e.w / i.w, + t + } + , + f.ceil = function(t, e) { + return t.x = Math.ceil(e.x), + t.y = Math.ceil(e.y), + t.z = Math.ceil(e.z), + t.w = Math.ceil(e.w), + t + } + , + f.floor = function(t, e) { + return t.x = Math.floor(e.x), + t.y = Math.floor(e.y), + t.z = Math.floor(e.z), + t.w = Math.floor(e.w), + t + } + , + f.min = function(t, e, i) { + return t.x = Math.min(e.x, i.x), + t.y = Math.min(e.y, i.y), + t.z = Math.min(e.z, i.z), + t.w = Math.min(e.w, i.w), + t + } + , + f.max = function(t, e, i) { + return t.x = Math.max(e.x, i.x), + t.y = Math.max(e.y, i.y), + t.z = Math.max(e.z, i.z), + t.w = Math.max(e.w, i.w), + t + } + , + f.round = function(t, e) { + return t.x = Math.round(e.x), + t.y = Math.round(e.y), + t.z = Math.round(e.z), + t.w = Math.round(e.w), + t + } + , + f.multiplyScalar = function(t, e, i) { + return t.x = e.x * i, + t.y = e.y * i, + t.z = e.z * i, + t.w = e.w * i, + t + } + , + f.scaleAndAdd = function(t, e, i, n) { + return t.x = e.x + i.x * n, + t.y = e.y + i.y * n, + t.z = e.z + i.z * n, + t.w = e.w + i.w * n, + t + } + , + f.distance = function(t, e) { + var i = e.x - t.x + , n = e.y - t.y + , r = e.z - t.z + , s = e.w - t.w; + return Math.sqrt(i * i + n * n + r * r + s * s) + } + , + f.squaredDistance = function(t, e) { + var i = e.x - t.x + , n = e.y - t.y + , r = e.z - t.z + , s = e.w - t.w; + return i * i + n * n + r * r + s * s + } + , + f.len = function(t) { + return h = t.x, + c = t.y, + u = t.z, + _ = t.w, + Math.sqrt(h * h + c * c + u * u + _ * _) + } + , + f.lengthSqr = function(t) { + return h = t.x, + c = t.y, + u = t.z, + _ = t.w, + h * h + c * c + u * u + _ * _ + } + , + f.negate = function(t, e) { + return t.x = -e.x, + t.y = -e.y, + t.z = -e.z, + t.w = -e.w, + t + } + , + f.inverse = function(t, e) { + return t.x = 1 / e.x, + t.y = 1 / e.y, + t.z = 1 / e.z, + t.w = 1 / e.w, + t + } + , + f.inverseSafe = function(t, e) { + return h = e.x, + c = e.y, + u = e.z, + _ = e.w, + Math.abs(h) < s.EPSILON ? t.x = 0 : t.x = 1 / h, + Math.abs(c) < s.EPSILON ? t.y = 0 : t.y = 1 / c, + Math.abs(u) < s.EPSILON ? t.z = 0 : t.z = 1 / u, + Math.abs(_) < s.EPSILON ? t.w = 0 : t.w = 1 / _, + t + } + , + f.normalize = function(t, e) { + h = e.x, + c = e.y, + u = e.z, + _ = e.w; + var i = h * h + c * c + u * u + _ * _; + return i > 0 && (i = 1 / Math.sqrt(i), + t.x = h * i, + t.y = c * i, + t.z = u * i, + t.w = _ * i), + t + } + , + f.dot = function(t, e) { + return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w + } + , + f.lerp = function(t, e, i, n) { + return t.x = e.x + n * (i.x - e.x), + t.y = e.y + n * (i.y - e.y), + t.z = e.z + n * (i.z - e.z), + t.w = e.w + n * (i.w - e.w), + t + } + , + f.random = function(t, e) { + e = e || 1; + var i = 2 * (0, + s.random)() * Math.PI + , n = 2 * (0, + s.random)() - 1 + , r = Math.sqrt(1 - n * n); + return t.x = r * Math.cos(i) * e, + t.y = r * Math.sin(i) * e, + t.z = n * e, + t.w = 0, + t + } + , + f.transformMat4 = function(t, e, i) { + h = e.x, + c = e.y, + u = e.z, + _ = e.w; + var n = i.m; + return t.x = n[0] * h + n[4] * c + n[8] * u + n[12] * _, + t.y = n[1] * h + n[5] * c + n[9] * u + n[13] * _, + t.z = n[2] * h + n[6] * c + n[10] * u + n[14] * _, + t.w = n[3] * h + n[7] * c + n[11] * u + n[15] * _, + t + } + , + f.transformAffine = function(t, e, i) { + h = e.x, + c = e.y, + u = e.z, + _ = e.w; + var n = i.m; + return t.x = n[0] * h + n[1] * c + n[2] * u + n[3] * _, + t.y = n[4] * h + n[5] * c + n[6] * u + n[7] * _, + t.x = n[8] * h + n[9] * c + n[10] * u + n[11] * _, + t.w = e.w, + t + } + , + f.transformQuat = function(t, e, i) { + var n = e.x + , r = e.y + , s = e.z; + h = i.x, + c = i.y, + u = i.z; + var a = (_ = i.w) * n + c * s - u * r + , o = _ * r + u * n - h * s + , l = _ * s + h * r - c * n + , f = -h * n - c * r - u * s; + return t.x = a * _ + f * -h + o * -u - l * -c, + t.y = o * _ + f * -c + l * -h - a * -u, + t.z = l * _ + f * -u + a * -c - o * -h, + t.w = e.w, + t + } + , + f.strictEquals = function(t, e) { + return t.x === e.x && t.y === e.y && t.z === e.z && t.w === e.w + } + , + f.equals = function(t, e, i) { + return void 0 === i && (i = s.EPSILON), + Math.abs(t.x - e.x) <= i * Math.max(1, Math.abs(t.x), Math.abs(e.x)) && Math.abs(t.y - e.y) <= i * Math.max(1, Math.abs(t.y), Math.abs(e.y)) && Math.abs(t.z - e.z) <= i * Math.max(1, Math.abs(t.z), Math.abs(e.z)) && Math.abs(t.w - e.w) <= i * Math.max(1, Math.abs(t.w), Math.abs(e.w)) + } + , + f.toArray = function(t, e, i) { + return void 0 === i && (i = 0), + t[i + 0] = e.x, + t[i + 1] = e.y, + t[i + 2] = e.z, + t[i + 3] = e.w, + t + } + , + f.fromArray = function(t, e, i) { + return void 0 === i && (i = 0), + t.x = e[i + 0], + t.y = e[i + 1], + t.z = e[i + 2], + t.w = e[i + 3], + t + } + , + a.clone = function() { + return new f(this.x,this.y,this.z,this.w) + } + , + a.set = function(t, e, i, n) { + return t && "object" == typeof t ? (this.x = t.x, + this.y = t.y, + this.z = t.z, + this.w = t.w) : (this.x = t || 0, + this.y = e || 0, + this.z = i || 0, + this.w = n || 0), + this + } + , + a.equals = function(t, e) { + return void 0 === e && (e = s.EPSILON), + Math.abs(this.x - t.x) <= e * Math.max(1, Math.abs(this.x), Math.abs(t.x)) && Math.abs(this.y - t.y) <= e * Math.max(1, Math.abs(this.y), Math.abs(t.y)) && Math.abs(this.z - t.z) <= e * Math.max(1, Math.abs(this.z), Math.abs(t.z)) && Math.abs(this.w - t.w) <= e * Math.max(1, Math.abs(this.w), Math.abs(t.w)) + } + , + a.equals4f = function(t, e, i, n, r) { + return void 0 === r && (r = s.EPSILON), + Math.abs(this.x - t) <= r * Math.max(1, Math.abs(this.x), Math.abs(t)) && Math.abs(this.y - e) <= r * Math.max(1, Math.abs(this.y), Math.abs(e)) && Math.abs(this.z - i) <= r * Math.max(1, Math.abs(this.z), Math.abs(i)) && Math.abs(this.w - n) <= r * Math.max(1, Math.abs(this.w), Math.abs(n)) + } + , + a.strictEquals = function(t) { + return this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w + } + , + a.strictEquals4f = function(t, e, i, n) { + return this.x === t && this.y === e && this.z === i && this.w === n + } + , + a.lerp = function(t, e) { + return h = this.x, + c = this.y, + u = this.z, + _ = this.w, + this.x = h + e * (t.x - h), + this.y = c + e * (t.y - c), + this.z = u + e * (t.z - u), + this.w = _ + e * (t.w - _), + this + } + , + a.toString = function() { + return "(" + this.x.toFixed(2) + ", " + this.y.toFixed(2) + ", " + this.z.toFixed(2) + ", " + this.w.toFixed(2) + ")" + } + , + a.clampf = function(t, e) { + return this.x = (0, + s.clamp)(this.x, t.x, e.x), + this.y = (0, + s.clamp)(this.y, t.y, e.y), + this.z = (0, + s.clamp)(this.z, t.z, e.z), + this.w = (0, + s.clamp)(this.w, t.w, e.w), + this + } + , + a.addSelf = function(t) { + return this.x += t.x, + this.y += t.y, + this.z += t.z, + this.w += t.w, + this + } + , + a.add = function(t, e) { + return (e = e || new f).x = this.x + t.x, + e.y = this.y + t.y, + e.z = this.z + t.z, + e.w = this.w + t.w, + e + } + , + a.subtract = function(t, e) { + return (e = e || new f).x = this.x - t.x, + e.y = this.y - t.y, + e.z = this.z - t.z, + e.w = this.w - t.w, + e + } + , + a.multiplyScalar = function(t) { + return this.x *= t, + this.y *= t, + this.z *= t, + this.w *= t, + this + } + , + a.multiply = function(t) { + return this.x *= t.x, + this.y *= t.y, + this.z *= t.z, + this.w *= t.w, + this + } + , + a.divide = function(t) { + return this.x /= t, + this.y /= t, + this.z /= t, + this.w /= t, + this + } + , + a.negate = function() { + return this.x = -this.x, + this.y = -this.y, + this.z = -this.z, + this.w = -this.w, + this + } + , + a.dot = function(t) { + return this.x * t.x + this.y * t.y + this.z * t.z + this.w * t.w + } + , + a.cross = function(t, e) { + e = e || new f; + var i = this.x + , n = this.y + , r = this.z + , s = t.x + , a = t.y + , o = t.z; + return e.x = n * o - r * a, + e.y = r * s - i * o, + e.z = i * a - n * s, + e + } + , + a.len = function() { + var t = this.x + , e = this.y + , i = this.z + , n = this.w; + return Math.sqrt(t * t + e * e + i * i + n * n) + } + , + a.lengthSqr = function() { + var t = this.x + , e = this.y + , i = this.z + , n = this.w; + return t * t + e * e + i * i + n * n + } + , + a.normalizeSelf = function() { + return this.normalize(this), + this + } + , + a.normalize = function(t) { + t = t || new f, + h = this.x, + c = this.y, + u = this.z, + _ = this.w; + var e = h * h + c * c + u * u + _ * _; + return e > 0 && (e = 1 / Math.sqrt(e), + t.x = h * e, + t.y = c * e, + t.z = u * e, + t.w = _ * e), + t + } + , + a.transformMat4 = function(t, e) { + e = e || new f, + h = this.x, + c = this.y, + u = this.z, + _ = this.w; + var i = t.m; + return e.x = i[0] * h + i[4] * c + i[8] * u + i[12] * _, + e.y = i[1] * h + i[5] * c + i[9] * u + i[13] * _, + e.z = i[2] * h + i[6] * c + i[10] * u + i[14] * _, + e.w = i[3] * h + i[7] * c + i[11] * u + i[15] * _, + e + } + , + a.maxAxis = function() { + return Math.max(this.x, this.y, this.z, this.w) + } + , + n = f, + r = [{ + key: "ZERO", + get: function() { + return new f(0,0,0,0) + } + }, { + key: "ONE", + get: function() { + return new f(1,1,1,1) + } + }, { + key: "NEG_ONE", + get: function() { + return new f(-1,-1,-1,-1) + } + }], + null && o(n.prototype, null), + r && o(n, r), + f + } + )(r.default); + function d(t, e, i, n) { + return new f(t,e,i,n) + } + i.default = f, + f.sub = f.subtract, + f.mul = f.multiply, + f.div = f.divide, + f.scale = f.multiplyScalar, + f.mag = f.len, + f.squaredMagnitude = f.lengthSqr, + f.ZERO_R = f.ZERO, + f.ONE_R = f.ONE, + f.NEG_ONE_R = f.NEG_ONE, + n.default.fastDefine("cc.Vec4", f, { + x: 0, + y: 0, + z: 0, + w: 0 + }), + cc.v4 = d, + cc.Vec4 = f + } + ), { + "../platform/CCClass": 193, + "./utils": 289, + "./value-type": 290 + }], + 294: [(function() { + "use strict"; + cc.js + } + ), {}], + 295: [(function(t) { + "use strict"; + t("./core/CCGame"), + t("./actions") + } + ), { + "./actions": 7, + "./core/CCGame": 28 + }], + 296: [(function(t, e) { + "use strict"; + var i = t("../compression/zlib.min") + , n = t("../core/CCDebug") + , r = function(t) { + var e, i, r, s, a, o, l, h, c, u, _, f, d; + for (this.data = t, + this.pos = 8, + this.palette = [], + this.imgData = [], + this.transparency = {}, + this.animation = null, + this.text = {}, + a = null; ; ) { + switch (e = this.readUInt32(), + h = function() { + var t, e; + for (e = [], + t = 0; t < 4; ++t) + e.push(String.fromCharCode(this.data[this.pos++])); + return e + } + .call(this).join("")) { + case "IHDR": + this.width = this.readUInt32(), + this.height = this.readUInt32(), + this.bits = this.data[this.pos++], + this.colorType = this.data[this.pos++], + this.compressionMethod = this.data[this.pos++], + this.filterMethod = this.data[this.pos++], + this.interlaceMethod = this.data[this.pos++]; + break; + case "acTL": + this.animation = { + numFrames: this.readUInt32(), + numPlays: this.readUInt32() || 1 / 0, + frames: [] + }; + break; + case "PLTE": + this.palette = this.read(e); + break; + case "fcTL": + a && this.animation.frames.push(a), + this.pos += 4, + a = { + width: this.readUInt32(), + height: this.readUInt32(), + xOffset: this.readUInt32(), + yOffset: this.readUInt32() + }, + s = this.readUInt16(), + r = this.readUInt16() || 100, + a.delay = 1e3 * s / r, + a.disposeOp = this.data[this.pos++], + a.blendOp = this.data[this.pos++], + a.data = []; + break; + case "IDAT": + case "fdAT": + for ("fdAT" === h && (this.pos += 4, + e -= 4), + t = (null != a ? a.data : void 0) || this.imgData, + _ = 0; 0 <= e ? _ < e : _ > e; 0 <= e ? ++_ : --_) + t.push(this.data[this.pos++]); + break; + case "tRNS": + switch (this.transparency = {}, + this.colorType) { + case 3: + if (this.transparency.indexed = this.read(e), + (c = 255 - this.transparency.indexed.length) > 0) + for (f = 0; 0 <= c ? f < c : f > c; 0 <= c ? ++f : --f) + this.transparency.indexed.push(255); + break; + case 0: + this.transparency.grayscale = this.read(e)[0]; + break; + case 2: + this.transparency.rgb = this.read(e) + } + break; + case "tEXt": + o = (u = this.read(e)).indexOf(0), + l = String.fromCharCode.apply(String, u.slice(0, o)), + this.text[l] = String.fromCharCode.apply(String, u.slice(o + 1)); + break; + case "IEND": + return a && this.animation.frames.push(a), + this.colors = function() { + switch (this.colorType) { + case 0: + case 3: + case 4: + return 1; + case 2: + case 6: + return 3 + } + } + .call(this), + this.hasAlphaChannel = 4 === (d = this.colorType) || 6 === d, + i = this.colors + (this.hasAlphaChannel ? 1 : 0), + this.pixelBitlength = this.bits * i, + this.colorSpace = function() { + switch (this.colors) { + case 1: + return "DeviceGray"; + case 3: + return "DeviceRGB" + } + } + .call(this), + void (Uint8Array != Array && (this.imgData = new Uint8Array(this.imgData))); + default: + this.pos += e + } + if (this.pos += 4, + this.pos > this.data.length) + throw new Error(n.getError(6017)) + } + }; + r.prototype = { + constructor: r, + read: function(t) { + var e, i; + for (i = [], + e = 0; 0 <= t ? e < t : e > t; 0 <= t ? ++e : --e) + i.push(this.data[this.pos++]); + return i + }, + readUInt32: function() { + return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++] + }, + readUInt16: function() { + return this.data[this.pos++] << 8 | this.data[this.pos++] + }, + decodePixels: function(t) { + var e, r, s, a, o, l, h, c, u, _, f, d, p, m, y, v, g, A, x, b, C, T, S; + if (null == t && (t = this.imgData), + 0 === t.length) + return new Uint8Array(0); + for (t = new i.Inflate(t,{ + index: 0, + verify: !1 + }).decompress(), + v = (d = this.pixelBitlength / 8) * this.width, + p = new Uint8Array(v * this.height), + l = t.length, + y = 0, + m = 0, + r = 0; m < l; ) { + switch (t[m++]) { + case 0: + for (a = x = 0; x < v; a = x += 1) + p[r++] = t[m++]; + break; + case 1: + for (a = b = 0; b < v; a = b += 1) + e = t[m++], + o = a < d ? 0 : p[r - d], + p[r++] = (e + o) % 256; + break; + case 2: + for (a = C = 0; C < v; a = C += 1) + e = t[m++], + s = (a - a % d) / d, + g = y && p[(y - 1) * v + s * d + a % d], + p[r++] = (g + e) % 256; + break; + case 3: + for (a = T = 0; T < v; a = T += 1) + e = t[m++], + s = (a - a % d) / d, + o = a < d ? 0 : p[r - d], + g = y && p[(y - 1) * v + s * d + a % d], + p[r++] = (e + Math.floor((o + g) / 2)) % 256; + break; + case 4: + for (a = S = 0; S < v; a = S += 1) + e = t[m++], + s = (a - a % d) / d, + o = a < d ? 0 : p[r - d], + 0 === y ? g = A = 0 : (g = p[(y - 1) * v + s * d + a % d], + A = s && p[(y - 1) * v + (s - 1) * d + a % d]), + h = o + g - A, + c = Math.abs(h - o), + _ = Math.abs(h - g), + f = Math.abs(h - A), + u = c <= _ && c <= f ? o : _ <= f ? g : A, + p[r++] = (e + u) % 256; + break; + default: + throw new Error(n.getError(6018, t[m - 1])) + } + y++ + } + return p + }, + copyToImageData: function(t, e) { + var i, n, r, s, a, o, l, h, c, u, _; + if (n = this.colors, + c = null, + i = this.hasAlphaChannel, + this.palette.length && (c = null != (_ = this._decodedPalette) ? _ : this._decodedPalette = this.decodePalette(), + n = 4, + i = !0), + h = (r = t.data || t).length, + a = c || e, + s = o = 0, + 1 === n) + for (; s < h; ) + l = c ? 4 * e[s / 4] : o, + u = a[l++], + r[s++] = u, + r[s++] = u, + r[s++] = u, + r[s++] = i ? a[l++] : 255, + o = l; + else + for (; s < h; ) + l = c ? 4 * e[s / 4] : o, + r[s++] = a[l++], + r[s++] = a[l++], + r[s++] = a[l++], + r[s++] = i ? a[l++] : 255, + o = l + }, + decodePalette: function() { + var t, e, i, n, r, s, a, o, l; + for (i = this.palette, + s = this.transparency.indexed || [], + r = new Uint8Array((s.length || 0) + i.length), + n = 0, + t = 0, + e = a = 0, + o = i.length; a < o; e = a += 3) + r[n++] = i[e], + r[n++] = i[e + 1], + r[n++] = i[e + 2], + r[n++] = null != (l = s[t++]) ? l : 255; + return r + }, + render: function(t) { + var e, i; + return t.width = this.width, + t.height = this.height, + i = (e = t.getContext("2d")).createImageData(this.width, this.height), + this.copyToImageData(i, this.decodePixels()), + e.putImageData(i, 0, 0) + } + }, + e.exports = r + } + ), { + "../compression/zlib.min": 25, + "../core/CCDebug": 26 + }], + 297: [(function(t, e) { + "use strict"; + var i = t("../core/assets/CCAsset") + , n = t("../core/assets/CCSpriteFrame") + , r = cc.Class({ + name: "cc.ParticleAsset", + extends: i, + properties: { + spriteFrame: { + default: null, + type: n + } + } + }); + cc.ParticleAsset = e.exports = r + } + ), { + "../core/assets/CCAsset": 62, + "../core/assets/CCSpriteFrame": 74 + }], + 298: [(function(t, e) { + "use strict"; + var i = t("../core/platform/CCMacro") + , n = t("./CCParticleAsset") + , r = t("../core/components/CCRenderComponent") + , s = t("../compression/ZipUtils") + , a = t("./CCPNGReader") + , o = t("./CCTIFFReader") + , l = t("../core/utils/texture-util") + , h = (t("../core/renderer/render-flow"), + t("./particle-simulator")) + , c = (t("../core/assets/material/CCMaterial"), + t("../core/utils/blend-func")) + , u = cc.Enum({ + GRAVITY: 0, + RADIUS: 1 + }) + , _ = cc.Enum({ + FREE: 0, + RELATIVE: 1, + GROUPED: 2 + }) + , f = { + preview: { + default: !0, + editorOnly: !0, + notify: !1, + animatable: !1, + tooltip: !1 + }, + _custom: !1, + custom: { + get: function() { + return this._custom + }, + set: function(t) { + this._custom !== t && (this._custom = t, + this._applyFile()) + }, + animatable: !1, + tooltip: !1 + }, + _file: { + default: null, + type: n + }, + file: { + get: function() { + return this._file + }, + set: function(t) { + this._file !== t && (this._file = t, + t ? this._applyFile() : this.custom = !0) + }, + animatable: !1, + type: n, + tooltip: !1 + }, + _spriteFrame: { + default: null, + type: cc.SpriteFrame + }, + spriteFrame: { + get: function() { + return this._spriteFrame + }, + set: function(t) { + var e = this._renderSpriteFrame; + e !== t && (this._renderSpriteFrame = t, + t && !t._uuid || (this._spriteFrame = t), + this._applySpriteFrame(e)) + }, + type: cc.SpriteFrame, + tooltip: !1 + }, + _texture: { + default: null, + type: cc.Texture2D, + editorOnly: !0 + }, + texture: { + get: function() { + return this._getTexture() + }, + set: function(t) { + t && cc.warnID(6017) + }, + type: cc.Texture2D, + tooltip: !1, + readonly: !0, + visible: !1, + animatable: !1 + }, + particleCount: { + visible: !1, + get: function() { + return this._simulator.particles.length + }, + readonly: !0 + }, + _stopped: !0, + stopped: { + get: function() { + return this._stopped + }, + animatable: !1, + visible: !1 + }, + playOnLoad: !0, + autoRemoveOnFinish: { + default: !1, + animatable: !1, + tooltip: !1 + }, + active: { + get: function() { + return this._simulator.active + }, + visible: !1 + }, + totalParticles: 150, + duration: -1, + emissionRate: 10, + life: 1, + lifeVar: 0, + _startColor: null, + startColor: { + type: cc.Color, + get: function() { + return this._startColor + }, + set: function(t) { + this._startColor.r = t.r, + this._startColor.g = t.g, + this._startColor.b = t.b, + this._startColor.a = t.a + } + }, + _startColorVar: null, + startColorVar: { + type: cc.Color, + get: function() { + return this._startColorVar + }, + set: function(t) { + this._startColorVar.r = t.r, + this._startColorVar.g = t.g, + this._startColorVar.b = t.b, + this._startColorVar.a = t.a + } + }, + _endColor: null, + endColor: { + type: cc.Color, + get: function() { + return this._endColor + }, + set: function(t) { + this._endColor.r = t.r, + this._endColor.g = t.g, + this._endColor.b = t.b, + this._endColor.a = t.a + } + }, + _endColorVar: null, + endColorVar: { + type: cc.Color, + get: function() { + return this._endColorVar + }, + set: function(t) { + this._endColorVar.r = t.r, + this._endColorVar.g = t.g, + this._endColorVar.b = t.b, + this._endColorVar.a = t.a + } + }, + angle: 90, + angleVar: 20, + startSize: 50, + startSizeVar: 0, + endSize: 0, + endSizeVar: 0, + startSpin: 0, + startSpinVar: 0, + endSpin: 0, + endSpinVar: 0, + sourcePos: cc.Vec2.ZERO, + posVar: cc.Vec2.ZERO, + _positionType: { + default: _.FREE, + formerlySerializedAs: "positionType" + }, + positionType: { + type: _, + get: function() { + return this._positionType + }, + set: function(t) { + this._positionType = t, + this._updateMaterial() + } + }, + emitterMode: { + default: u.GRAVITY, + type: u + }, + gravity: cc.Vec2.ZERO, + speed: 180, + speedVar: 50, + tangentialAccel: 80, + tangentialAccelVar: 0, + radialAccel: 0, + radialAccelVar: 0, + rotationIsDir: !1, + startRadius: 0, + startRadiusVar: 0, + endRadius: 0, + endRadiusVar: 0, + rotatePerS: 0, + rotatePerSVar: 0 + } + , d = cc.Class({ + name: "cc.ParticleSystem", + extends: r, + mixins: [c], + editor: !1, + ctor: function() { + this.initProperties() + }, + initProperties: function() { + this._previewTimer = null, + this._focused = !1, + this._aspectRatio = 1, + this._simulator = new h(this), + this._startColor = cc.color(255, 255, 255, 255), + this._startColorVar = cc.color(0, 0, 0, 0), + this._endColor = cc.color(255, 255, 255, 0), + this._endColorVar = cc.color(0, 0, 0, 0), + this._renderSpriteFrame = null + }, + properties: f, + statics: { + DURATION_INFINITY: -1, + START_SIZE_EQUAL_TO_END_SIZE: -1, + START_RADIUS_EQUAL_TO_END_RADIUS: -1, + EmitterMode: u, + PositionType: _, + _PNGReader: a, + _TIFFReader: o + }, + onFocusInEditor: !1, + onLostFocusInEditor: !1, + _startPreview: !1, + _stopPreview: !1, + _convertTextureToSpriteFrame: !1, + __preload: function() { + this._super(), + this._custom && this.spriteFrame && !this._renderSpriteFrame ? this._applySpriteFrame(this.spriteFrame) : this._file && (this._custom ? !this._getTexture() && this._applyFile() : this._applyFile()), + this.playOnLoad && this.resetSystem() + }, + onDestroy: function() { + this.autoRemoveOnFinish && (this.autoRemoveOnFinish = !1), + this._buffer && (this._buffer.destroy(), + this._buffer = null), + this._simulator._uvFilled = 0, + this._super() + }, + lateUpdate: function(t) { + this._simulator.finished || this._simulator.step(t) + }, + addParticle: function() {}, + stopSystem: function() { + this._stopped = !0, + this._simulator.stop() + }, + resetSystem: function() { + this._stopped = !1, + this._simulator.reset(), + this.markForRender(!0) + }, + isFull: function() { + return this.particleCount >= this.totalParticles + }, + setTextureWithRect: function(t, e) { + t instanceof cc.Texture2D && (this.spriteFrame = new cc.SpriteFrame(t,e)) + }, + _applyFile: function() { + var t = this._file; + if (t) { + var e = this; + cc.assetManager.postLoadNative(t, (function(i) { + !i && t._nativeAsset ? e.isValid && (e._plistFile = t.nativeUrl, + e._custom || (e._spriteFrame !== t.spriteFrame && (e.spriteFrame = t.spriteFrame), + e._initWithDictionary(t._nativeAsset)), + e._spriteFrame ? !e._renderSpriteFrame && e._spriteFrame && e._applySpriteFrame(e.spriteFrame) : t.spriteFrame ? e.spriteFrame = t.spriteFrame : e._custom && e._initTextureWithDictionary(t._nativeAsset)) : cc.errorID(6029) + } + )) + } + }, + _initTextureWithDictionary: function(t) { + var e, n = cc.path.changeBasename(this._plistFile, t.textureFileName || ""); + if (t.textureFileName) + l.loadImage(n, (function(e, i) { + e ? (t.textureFileName = void 0, + this._initTextureWithDictionary(t)) : (cc.assetManager.assets.add(n, i), + this.spriteFrame = new cc.SpriteFrame(i)) + } + ), this); + else if (t.textureImageData) { + var r = t.textureImageData; + if (!(r && r.length > 0)) + return !1; + var h = cc.assetManager.assets.get(n); + if (!h) { + var c = s.unzipBase64AsArray(r, 1); + if (!c) + return cc.warnID(6030, this._file.name), + !1; + var u = (e = c).length > 8 && 137 === e[0] && 80 === e[1] && 78 === e[2] && 71 === e[3] && 13 === e[4] && 10 === e[5] && 26 === e[6] && 10 === e[7] ? i.ImageFormat.PNG : e.length > 2 && (73 === e[0] && 73 === e[1] || 77 === e[0] && 77 === e[1] || 255 === e[0] && 216 === e[1]) ? i.ImageFormat.TIFF : i.ImageFormat.UNKNOWN; + if (u !== i.ImageFormat.TIFF && u !== i.ImageFormat.PNG) + return cc.warnID(6031, this._file.name), + !1; + var _ = document.createElement("canvas"); + u === i.ImageFormat.PNG ? new a(c).render(_) : o.parseTIFF(c, _), + h = l.cacheImage(n, _) + } + h || cc.warnID(6032, this._file.name), + this.spriteFrame = new cc.SpriteFrame(h) + } + return !0 + }, + _initWithDictionary: function(t) { + this.totalParticles = parseInt(t.maxParticles || 0), + this.life = parseFloat(t.particleLifespan || 0), + this.lifeVar = parseFloat(t.particleLifespanVariance || 0); + var e = t.emissionRate; + this.emissionRate = e || Math.min(this.totalParticles / this.life, Number.MAX_VALUE), + this.duration = parseFloat(t.duration || 0), + this.srcBlendFactor = parseInt(t.blendFuncSource || i.SRC_ALPHA), + this.dstBlendFactor = parseInt(t.blendFuncDestination || i.ONE_MINUS_SRC_ALPHA); + var n = this._startColor; + n.r = 255 * parseFloat(t.startColorRed || 0), + n.g = 255 * parseFloat(t.startColorGreen || 0), + n.b = 255 * parseFloat(t.startColorBlue || 0), + n.a = 255 * parseFloat(t.startColorAlpha || 0); + var r = this._startColorVar; + r.r = 255 * parseFloat(t.startColorVarianceRed || 0), + r.g = 255 * parseFloat(t.startColorVarianceGreen || 0), + r.b = 255 * parseFloat(t.startColorVarianceBlue || 0), + r.a = 255 * parseFloat(t.startColorVarianceAlpha || 0); + var s = this._endColor; + s.r = 255 * parseFloat(t.finishColorRed || 0), + s.g = 255 * parseFloat(t.finishColorGreen || 0), + s.b = 255 * parseFloat(t.finishColorBlue || 0), + s.a = 255 * parseFloat(t.finishColorAlpha || 0); + var a = this._endColorVar; + if (a.r = 255 * parseFloat(t.finishColorVarianceRed || 0), + a.g = 255 * parseFloat(t.finishColorVarianceGreen || 0), + a.b = 255 * parseFloat(t.finishColorVarianceBlue || 0), + a.a = 255 * parseFloat(t.finishColorVarianceAlpha || 0), + this.startSize = parseFloat(t.startParticleSize || 0), + this.startSizeVar = parseFloat(t.startParticleSizeVariance || 0), + this.endSize = parseFloat(t.finishParticleSize || 0), + this.endSizeVar = parseFloat(t.finishParticleSizeVariance || 0), + this.positionType = parseFloat(void 0 !== t.positionType ? t.positionType : _.RELATIVE), + this.sourcePos.x = 0, + this.sourcePos.y = 0, + this.posVar.x = parseFloat(t.sourcePositionVariancex || 0), + this.posVar.y = parseFloat(t.sourcePositionVariancey || 0), + this.angle = parseFloat(t.angle || 0), + this.angleVar = parseFloat(t.angleVariance || 0), + this.startSpin = parseFloat(t.rotationStart || 0), + this.startSpinVar = parseFloat(t.rotationStartVariance || 0), + this.endSpin = parseFloat(t.rotationEnd || 0), + this.endSpinVar = parseFloat(t.rotationEndVariance || 0), + this.emitterMode = parseInt(t.emitterType || u.GRAVITY), + this.emitterMode === u.GRAVITY) { + this.gravity.x = parseFloat(t.gravityx || 0), + this.gravity.y = parseFloat(t.gravityy || 0), + this.speed = parseFloat(t.speed || 0), + this.speedVar = parseFloat(t.speedVariance || 0), + this.radialAccel = parseFloat(t.radialAcceleration || 0), + this.radialAccelVar = parseFloat(t.radialAccelVariance || 0), + this.tangentialAccel = parseFloat(t.tangentialAcceleration || 0), + this.tangentialAccelVar = parseFloat(t.tangentialAccelVariance || 0); + var o = t.rotationIsDir || ""; + null !== o ? (o = o.toString().toLowerCase(), + this.rotationIsDir = "true" === o || "1" === o) : this.rotationIsDir = !1 + } else { + if (this.emitterMode !== u.RADIUS) + return cc.warnID(6009), + !1; + this.startRadius = parseFloat(t.maxRadius || 0), + this.startRadiusVar = parseFloat(t.maxRadiusVariance || 0), + this.endRadius = parseFloat(t.minRadius || 0), + this.endRadiusVar = parseFloat(t.minRadiusVariance || 0), + this.rotatePerS = parseFloat(t.rotatePerSecond || 0), + this.rotatePerSVar = parseFloat(t.rotatePerSecondVariance || 0) + } + return this._initTextureWithDictionary(t), + !0 + }, + _validateRender: function() { + var t = this._getTexture(); + t && t.loaded ? this._super() : this.disableRender() + }, + _onTextureLoaded: function() { + this._simulator.updateUVs(!0), + this._syncAspect(), + this._updateMaterial(), + this.markForRender(!0) + }, + _syncAspect: function() { + var t = this._renderSpriteFrame._rect; + this._aspectRatio = t.width / t.height + }, + _applySpriteFrame: function() { + this._renderSpriteFrame = this._renderSpriteFrame || this._spriteFrame, + this._renderSpriteFrame && (this._renderSpriteFrame.textureLoaded() ? this._onTextureLoaded() : this._renderSpriteFrame.onTextureLoaded(this._onTextureLoaded, this)) + }, + _getTexture: function() { + return this._renderSpriteFrame && this._renderSpriteFrame.getTexture() || this._texture + }, + _updateMaterial: function() { + var t = this.getMaterial(0); + t && (t.define("CC_USE_MODEL", this._positionType !== _.FREE), + t.setProperty("texture", this._getTexture()), + c.prototype._updateMaterial.call(this)) + }, + _finishedSimulation: function() { + this.resetSystem(), + this.stopSystem(), + this.disableRender(), + this.autoRemoveOnFinish && this._stopped && this.node.destroy() + } + }); + cc.ParticleSystem = e.exports = d + } + ), { + "../compression/ZipUtils": 22, + "../core/assets/material/CCMaterial": 80, + "../core/components/CCRenderComponent": 115, + "../core/platform/CCMacro": 198, + "../core/renderer/render-flow": 225, + "../core/utils/blend-func": 261, + "../core/utils/texture-util": 275, + "./CCPNGReader": 296, + "./CCParticleAsset": 297, + "./CCTIFFReader": 299, + "./particle-simulator": 301, + "fire-url": void 0 + }], + 299: [(function(t, e) { + "use strict"; + var i = t("../core/CCDebug") + , n = { + _littleEndian: !1, + _tiffData: null, + _fileDirectories: [], + getUint8: function(t) { + return this._tiffData[t] + }, + getUint16: function(t) { + return this._littleEndian ? this._tiffData[t + 1] << 8 | this._tiffData[t] : this._tiffData[t] << 8 | this._tiffData[t + 1] + }, + getUint32: function(t) { + var e = this._tiffData; + return this._littleEndian ? e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t] : e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3] + }, + checkLittleEndian: function() { + var t = this.getUint16(0); + if (18761 === t) + this.littleEndian = !0; + else { + if (19789 !== t) + throw console.log(t), + TypeError(i.getError(6019)); + this.littleEndian = !1 + } + return this.littleEndian + }, + hasTowel: function() { + if (42 !== this.getUint16(2)) + throw RangeError(i.getError(6020)); + return !0 + }, + getFieldTypeName: function(t) { + var e = this.fieldTypeNames; + return t in e ? e[t] : null + }, + getFieldTagName: function(t) { + var e = this.fieldTagNames; + return t in e ? e[t] : (cc.logID(6021, t), + "Tag" + t) + }, + getFieldTypeLength: function(t) { + return -1 !== ["BYTE", "ASCII", "SBYTE", "UNDEFINED"].indexOf(t) ? 1 : -1 !== ["SHORT", "SSHORT"].indexOf(t) ? 2 : -1 !== ["LONG", "SLONG", "FLOAT"].indexOf(t) ? 4 : -1 !== ["RATIONAL", "SRATIONAL", "DOUBLE"].indexOf(t) ? 8 : null + }, + getFieldValues: function(t, e, i, n) { + var r = [] + , s = this.getFieldTypeLength(e); + if (s * i <= 4) + !1 === this.littleEndian ? r.push(n >>> 8 * (4 - s)) : r.push(n); + else + for (var a = 0; a < i; a++) { + var o = s * a; + s >= 8 ? -1 !== ["RATIONAL", "SRATIONAL"].indexOf(e) ? (r.push(this.getUint32(n + o)), + r.push(this.getUint32(n + o + 4))) : cc.logID(8e3) : r.push(this.getBytes(s, n + o)) + } + return "ASCII" === e && r.forEach((function(t, e, i) { + i[e] = String.fromCharCode(t) + } + )), + r + }, + getBytes: function(t, e) { + if (t <= 0) + cc.logID(8001); + else { + if (t <= 1) + return this.getUint8(e); + if (t <= 2) + return this.getUint16(e); + if (t <= 3) + return this.getUint32(e) >>> 8; + if (t <= 4) + return this.getUint32(e); + cc.logID(8002) + } + }, + getBits: function(t, e, i) { + i = i || 0; + var n, r, s = e + Math.floor(i / 8), a = i + t, o = 32 - t; + return a <= 0 ? cc.logID(6023) : a <= 8 ? (n = 24 + i, + r = this.getUint8(s)) : a <= 16 ? (n = 16 + i, + r = this.getUint16(s)) : a <= 32 ? (n = i, + r = this.getUint32(s)) : cc.logID(6022), + { + bits: r << n >>> o, + byteOffset: s + Math.floor(a / 8), + bitOffset: a % 8 + } + }, + parseFileDirectory: function(t) { + for (var e = this.getUint16(t), i = [], n = t + 2, r = 0; r < e; n += 12, + r++) { + var s = this.getUint16(n) + , a = this.getUint16(n + 2) + , o = this.getUint32(n + 4) + , l = this.getUint32(n + 8) + , h = this.getFieldTagName(s) + , c = this.getFieldTypeName(a) + , u = this.getFieldValues(h, c, o, l); + i[h] = { + type: c, + values: u + } + } + this._fileDirectories.push(i); + var _ = this.getUint32(n); + 0 !== _ && this.parseFileDirectory(_) + }, + clampColorSample: function(t, e) { + var i = Math.pow(2, 8 - e); + return Math.floor(t * i + (i - 1)) + }, + parseTIFF: function(t, e) { + if (e = e || document.createElement("canvas"), + this._tiffData = t, + this.canvas = e, + this.checkLittleEndian(), + this.hasTowel()) { + var n = this.getUint32(4); + this._fileDirectories.length = 0, + this.parseFileDirectory(n); + var r = this._fileDirectories[0] + , s = r.ImageWidth.values[0] + , a = r.ImageLength.values[0]; + this.canvas.width = s, + this.canvas.height = a; + var o = [] + , l = r.Compression ? r.Compression.values[0] : 1 + , h = r.SamplesPerPixel.values[0] + , c = [] + , u = 0 + , _ = !1; + if (r.BitsPerSample.values.forEach((function(t, e) { + c[e] = { + bitsPerSample: t, + hasBytesPerSample: !1, + bytesPerSample: void 0 + }, + t % 8 == 0 && (c[e].hasBytesPerSample = !0, + c[e].bytesPerSample = t / 8), + u += t + } + ), this), + u % 8 == 0) { + _ = !0; + var f = u / 8 + } + var d = r.StripOffsets.values + , p = d.length; + if (r.StripByteCounts) + var m = r.StripByteCounts.values; + else { + if (cc.logID(8003), + 1 !== p) + throw Error(i.getError(6024)); + m = [Math.ceil(s * a * u / 8)] + } + for (var y = 0; y < p; y++) { + var v = d[y]; + o[y] = []; + for (var g = m[y], A = 0, x = 0, b = 1, C = !0, T = [], S = 0, w = 0, E = 0; A < g; A += b) + switch (l) { + case 1: + var M = 0; + for (T = []; M < h; M++) { + if (!c[M].hasBytesPerSample) { + var D = this.getBits(c[M].bitsPerSample, v + A, x); + throw T.push(D.bits), + A = D.byteOffset - v, + x = D.bitOffset, + RangeError(i.getError(6025)) + } + var B = c[M].bytesPerSample * M; + T.push(this.getBytes(c[M].bytesPerSample, v + A + B)) + } + if (o[y].push(T), + !_) + throw b = 0, + RangeError(i.getError(6026)); + b = f; + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + case 32773: + if (C) { + C = !1; + var I = 1 + , P = 1 + , R = this.getInt8(v + A); + R >= 0 && R <= 127 ? I = R + 1 : R >= -127 && R <= -1 ? P = 1 - R : C = !0 + } else { + var O = this.getUint8(v + A); + for (M = 0; M < P; M++) { + if (!c[w].hasBytesPerSample) + throw RangeError(i.getError(6025)); + E = E << 8 * S | O, + ++S === c[w].bytesPerSample && (T.push(E), + E = S = 0, + w++), + w === h && (o[y].push(T), + T = [], + w = 0) + } + 0 == --I && (C = !0) + } + b = 1 + } + } + if (e.getContext) { + var L = this.canvas.getContext("2d"); + L.fillStyle = "rgba(255, 255, 255, 0)"; + var F = r.RowsPerStrip ? r.RowsPerStrip.values[0] : a + , V = o.length + , N = a % F + , k = 0 === N ? F : N + , G = F + , U = 0 + , z = r.PhotometricInterpretation.values[0] + , H = [] + , W = 0; + if (r.ExtraSamples && (W = (H = r.ExtraSamples.values).length), + r.ColorMap) + var j = r.ColorMap.values + , X = Math.pow(2, c[0].bitsPerSample); + for (y = 0; y < V; y++) { + y + 1 === V && (G = k); + for (var Y = o[y].length, q = U * y, J = 0, Z = 0; Z < Y; J++) + for (var K = 0; K < s; K++, + Z++) { + var Q = o[y][Z] + , $ = 0 + , tt = 0 + , et = 0 + , it = 1; + if (W > 0) + for (var nt = 0; nt < W; nt++) + if (1 === H[nt] || 2 === H[nt]) { + it = Q[3 + nt] / 256; + break + } + switch (z) { + case 0: + if (c[0].hasBytesPerSample) + var rt = Math.pow(16, 2 * c[0].bytesPerSample); + Q.forEach((function(t, e, i) { + i[e] = rt - t + } + )); + case 1: + $ = tt = et = this.clampColorSample(Q[0], c[0].bitsPerSample); + break; + case 2: + $ = this.clampColorSample(Q[0], c[0].bitsPerSample), + tt = this.clampColorSample(Q[1], c[1].bitsPerSample), + et = this.clampColorSample(Q[2], c[2].bitsPerSample); + break; + case 3: + if (void 0 === j) + throw Error(i.getError(6027)); + var st = Q[0]; + $ = this.clampColorSample(j[st], 16), + tt = this.clampColorSample(j[X + st], 16), + et = this.clampColorSample(j[2 * X + st], 16); + break; + default: + throw RangeError(i.getError(6028, z)) + } + L.fillStyle = "rgba(" + $ + ", " + tt + ", " + et + ", " + it + ")", + L.fillRect(K, q + J, 1, 1) + } + U = G + } + } + return this.canvas + } + }, + fieldTagNames: { + 315: "Artist", + 258: "BitsPerSample", + 265: "CellLength", + 264: "CellWidth", + 320: "ColorMap", + 259: "Compression", + 33432: "Copyright", + 306: "DateTime", + 338: "ExtraSamples", + 266: "FillOrder", + 289: "FreeByteCounts", + 288: "FreeOffsets", + 291: "GrayResponseCurve", + 290: "GrayResponseUnit", + 316: "HostComputer", + 270: "ImageDescription", + 257: "ImageLength", + 256: "ImageWidth", + 271: "Make", + 281: "MaxSampleValue", + 280: "MinSampleValue", + 272: "Model", + 254: "NewSubfileType", + 274: "Orientation", + 262: "PhotometricInterpretation", + 284: "PlanarConfiguration", + 296: "ResolutionUnit", + 278: "RowsPerStrip", + 277: "SamplesPerPixel", + 305: "Software", + 279: "StripByteCounts", + 273: "StripOffsets", + 255: "SubfileType", + 263: "Threshholding", + 282: "XResolution", + 283: "YResolution", + 326: "BadFaxLines", + 327: "CleanFaxData", + 343: "ClipPath", + 328: "ConsecutiveBadFaxLines", + 433: "Decode", + 434: "DefaultImageColor", + 269: "DocumentName", + 336: "DotRange", + 321: "HalftoneHints", + 346: "Indexed", + 347: "JPEGTables", + 285: "PageName", + 297: "PageNumber", + 317: "Predictor", + 319: "PrimaryChromaticities", + 532: "ReferenceBlackWhite", + 339: "SampleFormat", + 559: "StripRowCounts", + 330: "SubIFDs", + 292: "T4Options", + 293: "T6Options", + 325: "TileByteCounts", + 323: "TileLength", + 324: "TileOffsets", + 322: "TileWidth", + 301: "TransferFunction", + 318: "WhitePoint", + 344: "XClipPathUnits", + 286: "XPosition", + 529: "YCbCrCoefficients", + 531: "YCbCrPositioning", + 530: "YCbCrSubSampling", + 345: "YClipPathUnits", + 287: "YPosition", + 37378: "ApertureValue", + 40961: "ColorSpace", + 36868: "DateTimeDigitized", + 36867: "DateTimeOriginal", + 34665: "Exif IFD", + 36864: "ExifVersion", + 33434: "ExposureTime", + 41728: "FileSource", + 37385: "Flash", + 40960: "FlashpixVersion", + 33437: "FNumber", + 42016: "ImageUniqueID", + 37384: "LightSource", + 37500: "MakerNote", + 37377: "ShutterSpeedValue", + 37510: "UserComment", + 33723: "IPTC", + 34675: "ICC Profile", + 700: "XMP", + 42112: "GDAL_METADATA", + 42113: "GDAL_NODATA", + 34377: "Photoshop" + }, + fieldTypeNames: { + 1: "BYTE", + 2: "ASCII", + 3: "SHORT", + 4: "LONG", + 5: "RATIONAL", + 6: "SBYTE", + 7: "UNDEFINED", + 8: "SSHORT", + 9: "SLONG", + 10: "SRATIONAL", + 11: "FLOAT", + 12: "DOUBLE" + } + }; + e.exports = n + } + ), { + "../core/CCDebug": 26 + }], + 300: [(function(t) { + "use strict"; + t("./CCParticleAsset"), + t("./CCParticleSystem"), + t("./particle-simulator"), + t("./particle-system-assembler") + } + ), { + "./CCParticleAsset": 297, + "./CCParticleSystem": 298, + "./particle-simulator": 301, + "./particle-system-assembler": 302 + }], + 301: [(function(t, e) { + "use strict"; + var i = t("../core/platform/js") + , n = t("../core/utils/misc") + , r = cc.v2(0, 0) + , s = cc.v2() + , a = cc.v2() + , o = cc.v2() + , l = cc.v2() + , h = function() { + this.pos = cc.v2(0, 0), + this.startPos = cc.v2(0, 0), + this.color = cc.color(0, 0, 0, 255), + this.deltaColor = { + r: 0, + g: 0, + b: 0, + a: 255 + }, + this.preciseColor = { + r: 0, + g: 0, + b: 0, + a: 255 + }, + this.size = 0, + this.deltaSize = 0, + this.rotation = 0, + this.deltaRotation = 0, + this.timeToLive = 0, + this.drawPos = cc.v2(0, 0), + this.aspectRatio = 1, + this.dir = cc.v2(0, 0), + this.radialAccel = 0, + this.tangentialAccel = 0, + this.angle = 0, + this.degreesPerSecond = 0, + this.radius = 0, + this.deltaRadius = 0 + } + , c = new i.Pool(function(t) { + t.pos.set(r), + t.startPos.set(r), + t.color._val = 4278190080, + t.deltaColor.r = t.deltaColor.g = t.deltaColor.b = 0, + t.deltaColor.a = 255, + t.size = 0, + t.deltaSize = 0, + t.rotation = 0, + t.deltaRotation = 0, + t.timeToLive = 0, + t.drawPos.set(r), + t.aspectRatio = 1, + t.dir.set(r), + t.radialAccel = 0, + t.tangentialAccel = 0, + t.angle = 0, + t.degreesPerSecond = 0, + t.radius = 0, + t.deltaRadius = 0 + } + ,1024); + c.get = function() { + return this._get() || new h + } + ; + var u = function(t) { + this.sys = t, + this.particles = [], + this.active = !1, + this.readyToPlay = !0, + this.finished = !1, + this.elapsed = 0, + this.emitCounter = 0, + this._uvFilled = 0, + this._worldRotation = 0 + }; + function _(t) { + for (var e = 0, i = t; i; ) + e += i.angle, + i = i.parent; + return e + } + u.prototype.stop = function() { + this.active = !1, + this.readyToPlay = !1, + this.elapsed = this.sys.duration, + this.emitCounter = 0 + } + , + u.prototype.reset = function() { + this.active = !0, + this.readyToPlay = !0, + this.elapsed = 0, + this.emitCounter = 0, + this.finished = !1; + for (var t = this.particles, e = 0; e < t.length; ++e) + c.put(t[e]); + t.length = 0 + } + , + u.prototype.emitParticle = function(t) { + var e = this.sys + , i = n.clampf + , r = c.get(); + this.particles.push(r), + r.timeToLive = e.life + e.lifeVar * (Math.random() - .5) * 2; + var s, a, o, l, h = r.timeToLive = Math.max(0, r.timeToLive); + r.pos.x = e.sourcePos.x + e.posVar.x * (Math.random() - .5) * 2, + r.pos.y = e.sourcePos.y + e.posVar.y * (Math.random() - .5) * 2; + var u = e._startColor + , _ = e._startColorVar + , f = e._endColor + , d = e._endColorVar; + r.color.r = s = i(u.r + _.r * (Math.random() - .5) * 2, 0, 255), + r.color.g = a = i(u.g + _.g * (Math.random() - .5) * 2, 0, 255), + r.color.b = o = i(u.b + _.b * (Math.random() - .5) * 2, 0, 255), + r.color.a = l = i(u.a + _.a * (Math.random() - .5) * 2, 0, 255); + var p = r.color + , m = r.preciseColor; + m.r = p.r, + m.g = p.g, + m.b = p.b, + m.a = p.a, + r.deltaColor.r = (i(f.r + d.r * (Math.random() - .5) * 2, 0, 255) - s) / h, + r.deltaColor.g = (i(f.g + d.g * (Math.random() - .5) * 2, 0, 255) - a) / h, + r.deltaColor.b = (i(f.b + d.b * (Math.random() - .5) * 2, 0, 255) - o) / h, + r.deltaColor.a = (i(f.a + d.a * (Math.random() - .5) * 2, 0, 255) - l) / h; + var y = e.startSize + e.startSizeVar * (Math.random() - .5) * 2; + if (y = Math.max(0, y), + r.size = y, + e.endSize === cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE) + r.deltaSize = 0; + else { + var v = e.endSize + e.endSizeVar * (Math.random() - .5) * 2; + v = Math.max(0, v), + r.deltaSize = (v - y) / h + } + var g = e.startSpin + e.startSpinVar * (Math.random() - .5) * 2 + , A = e.endSpin + e.endSpinVar * (Math.random() - .5) * 2; + r.rotation = g, + r.deltaRotation = (A - g) / h, + r.startPos.x = t.x, + r.startPos.y = t.y, + r.aspectRatio = e._aspectRatio || 1; + var x = n.degreesToRadians(e.angle + this._worldRotation + e.angleVar * (Math.random() - .5) * 2); + if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) { + var b = e.speed + e.speedVar * (Math.random() - .5) * 2; + r.dir.x = Math.cos(x), + r.dir.y = Math.sin(x), + r.dir.mulSelf(b), + r.radialAccel = e.radialAccel + e.radialAccelVar * (Math.random() - .5) * 2, + r.tangentialAccel = e.tangentialAccel + e.tangentialAccelVar * (Math.random() - .5) * 2, + e.rotationIsDir && (r.rotation = -n.radiansToDegrees(Math.atan2(r.dir.y, r.dir.x))) + } else { + var C = e.startRadius + e.startRadiusVar * (Math.random() - .5) * 2 + , T = e.endRadius + e.endRadiusVar * (Math.random() - .5) * 2; + r.radius = C, + r.deltaRadius = e.endRadius === cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS ? 0 : (T - C) / h, + r.angle = x, + r.degreesPerSecond = n.degreesToRadians(e.rotatePerS + e.rotatePerSVar * (Math.random() - .5) * 2) + } + } + , + u.prototype.updateUVs = function(t) { + var e = this.sys._assembler; + if (e) { + var i = e.getBuffer(); + if (i && this.sys._renderSpriteFrame) { + for (var n = 4 * e._vfmt._bytes / 4, r = i._vData, s = this.sys._renderSpriteFrame.uv, a = t ? 0 : this._uvFilled, o = this.particles.length, l = a; l < o; l++) { + var h = l * n; + r[h + 2] = s[0], + r[h + 3] = s[1], + r[h + 7] = s[2], + r[h + 8] = s[3], + r[h + 12] = s[4], + r[h + 13] = s[5], + r[h + 17] = s[6], + r[h + 18] = s[7] + } + this._uvFilled = o + } + } + } + , + u.prototype.updateParticleBuffer = function(t, e, i, r) { + var s = i._vData + , a = i._uintVData + , o = e.x + , l = e.y + , h = t.size + , c = h + , u = t.aspectRatio; + u > 1 ? c = h / u : h = c * u; + var _ = h / 2 + , f = c / 2; + if (t.rotation) { + var d = -_ + , p = -f + , m = _ + , y = f + , v = -n.degreesToRadians(t.rotation) + , g = Math.cos(v) + , A = Math.sin(v); + s[r] = d * g - p * A + o, + s[r + 1] = d * A + p * g + l, + s[r + 5] = m * g - p * A + o, + s[r + 6] = m * A + p * g + l, + s[r + 10] = d * g - y * A + o, + s[r + 11] = d * A + y * g + l, + s[r + 15] = m * g - y * A + o, + s[r + 16] = m * A + y * g + l + } else + s[r] = o - _, + s[r + 1] = l - f, + s[r + 5] = o + _, + s[r + 6] = l - f, + s[r + 10] = o - _, + s[r + 11] = l + f, + s[r + 15] = o + _, + s[r + 16] = l + f; + a[r + 4] = t.color._val, + a[r + 9] = t.color._val, + a[r + 14] = t.color._val, + a[r + 19] = t.color._val + } + , + u.prototype.step = function(t) { + t = t > cc.director._maxParticleDeltaTime ? cc.director._maxParticleDeltaTime : t; + var e = this.sys + , i = e.node + , n = this.particles + , r = 4 * this.sys._assembler._vfmt._bytes / 4 + , h = cc.ParticleSystem.PositionType; + if (i._updateWorldMatrix(), + e.positionType === h.FREE) { + this._worldRotation = _(i); + var u = i._worldMatrix.m; + s.x = u[12], + s.y = u[13] + } else + e.positionType === h.RELATIVE ? (this._worldRotation = i.angle, + s.x = i.x, + s.y = i.y) : this._worldRotation = 0; + if (this.active && e.emissionRate) { + var f = 1 / e.emissionRate; + for (n.length < e.totalParticles && (this.emitCounter += t); n.length < e.totalParticles && this.emitCounter > f; ) + this.emitParticle(s), + this.emitCounter -= f; + this.elapsed += t, + -1 !== e.duration && e.duration < this.elapsed && e.stopSystem() + } + var d = e._assembler.getBuffer() + , p = n.length; + d.reset(), + d.request(4 * p, 6 * p), + p > this._uvFilled && this.updateUVs(); + for (var m = 0; m < n.length; ) { + a.x = a.y = o.x = o.y = l.x = l.y = 0; + var y = n[m]; + if (y.timeToLive -= t, + y.timeToLive > 0) { + if (e.emitterMode === cc.ParticleSystem.EmitterMode.GRAVITY) { + var v = l + , g = a + , A = o; + (y.pos.x || y.pos.y) && (g.set(y.pos), + g.normalizeSelf()), + A.set(g), + g.mulSelf(y.radialAccel); + var x = A.x; + A.x = -A.y, + A.y = x, + A.mulSelf(y.tangentialAccel), + v.set(g), + v.addSelf(A), + v.addSelf(e.gravity), + v.mulSelf(t), + y.dir.addSelf(v), + v.set(y.dir), + v.mulSelf(t), + y.pos.addSelf(v) + } else + y.angle += y.degreesPerSecond * t, + y.radius += y.deltaRadius * t, + y.pos.x = -Math.cos(y.angle) * y.radius, + y.pos.y = -Math.sin(y.angle) * y.radius; + var b = y.preciseColor + , C = y.deltaColor; + b.r += C.r * t, + b.g += C.g * t, + b.b += C.b * t, + b.a += C.a * t; + var T = y.color; + T.r = b.r, + T.g = b.g, + T.b = b.b, + T.a = b.a, + y.size += y.deltaSize * t, + y.size < 0 && (y.size = 0), + y.rotation += y.deltaRotation * t; + var S = a; + S.set(y.pos), + e.positionType !== h.GROUPED && S.addSelf(y.startPos); + var w = r * m; + this.updateParticleBuffer(y, S, d, w), + ++m + } else { + var E = n[m]; + m !== n.length - 1 && (n[m] = n[n.length - 1]), + c.put(E), + n.length-- + } + } + e._assembler._ia._count = 6 * n.length, + n.length > 0 ? d.uploadData() : this.active || this.readyToPlay || (this.finished = !0, + e._finishedSimulation()) + } + , + e.exports = u + } + ), { + "../core/platform/js": 214, + "../core/utils/misc": 267 + }], + 302: [(function(t, e) { + "use strict"; + var i = r(t("../core/renderer/assembler")) + , n = r(t("../renderer/core/input-assembler")); + function r(t) { + return t && t.__esModule ? t : { + default: t + } + } + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a = t("./CCParticleSystem") + , o = t("../core/renderer/") + , l = t("../core/renderer/webgl/quad-buffer") + , h = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor + , c = (function(t) { + var e, i; + function r(e) { + var i; + return (i = t.call(this, e) || this)._buffer = null, + i._ia = null, + i._vfmt = h, + i + } + i = t, + (e = r).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var a = r.prototype; + return a.getBuffer = function() { + return this._buffer || (this._buffer = new l(o._handle,h), + this._ia = new n.default, + this._ia._vertexBuffer = this._buffer._vb, + this._ia._indexBuffer = this._buffer._ib, + this._ia._start = 0, + this._ia._count = 0), + this._buffer + } + , + a.fillBuffers = function(t, e) { + if (this._ia) { + var i = cc.ParticleSystem.PositionType; + t.positionType === i.RELATIVE ? e.node = t.node.parent : e.node = t.node, + e.material = t._materials[0], + e._flushIA(this._ia) + } + } + , + r + } + )(i.default); + i.default.register(a, c), + e.exports = c + } + ), { + "../core/renderer/": 224, + "../core/renderer/assembler": 221, + "../core/renderer/webgl/quad-buffer": 253, + "../core/renderer/webgl/vertex-format": 256, + "../renderer/core/input-assembler": 305, + "./CCParticleSystem": 298 + }], + 303: [(function(t, e) { + "use strict"; + var i, n, r, s, a, o, l, h, c, u, _, f, d, p, m, y, v, g, A, x, b, C, T, S, w, E, M, D, B, I, P, R, O, L, F, V, N, k, G, U, z, H; + (function(t) { + t[t.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", + t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", + t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", + t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", + t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", + t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", + t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", + t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", + t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", + t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", + t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", + t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", + t[t.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL" + } + )(i || (i = {})), + (function(t) { + t[t.UNKNOWN = 0] = "UNKNOWN", + t[t.BUFFER = 1] = "BUFFER", + t[t.TEXTURE = 2] = "TEXTURE", + t[t.TEXTURE_VIEW = 3] = "TEXTURE_VIEW", + t[t.RENDER_PASS = 4] = "RENDER_PASS", + t[t.FRAMEBUFFER = 5] = "FRAMEBUFFER", + t[t.SAMPLER = 6] = "SAMPLER", + t[t.SHADER = 7] = "SHADER", + t[t.PIPELINE_LAYOUT = 8] = "PIPELINE_LAYOUT", + t[t.PIPELINE_STATE = 9] = "PIPELINE_STATE", + t[t.BINDING_LAYOUT = 10] = "BINDING_LAYOUT", + t[t.INPUT_ASSEMBLER = 11] = "INPUT_ASSEMBLER", + t[t.COMMAND_ALLOCATOR = 12] = "COMMAND_ALLOCATOR", + t[t.COMMAND_BUFFER = 13] = "COMMAND_BUFFER", + t[t.QUEUE = 14] = "QUEUE", + t[t.WINDOW = 15] = "WINDOW" + } + )(n || (n = {})), + (function(t) { + t[t.UNREADY = 0] = "UNREADY", + t[t.FAILED = 1] = "FAILED", + t[t.SUCCESS = 2] = "SUCCESS" + } + )(r || (r = {})), + (function() { + function t(t) { + this._gfxType = n.UNKNOWN, + this._status = r.UNREADY, + this._gfxType = t + } + Object.defineProperty(t.prototype, "gfxType", { + get: function() { + return this._gfxType + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t.prototype, "status", { + get: function() { + return this._status + }, + enumerable: !0, + configurable: !0 + }) + } + )(), + (function(t) { + t.ATTR_POSITION = "a_position", + t.ATTR_NORMAL = "a_normal", + t.ATTR_TANGENT = "a_tangent", + t.ATTR_BITANGENT = "a_bitangent", + t.ATTR_WEIGHTS = "a_weights", + t.ATTR_JOINTS = "a_joints", + t.ATTR_COLOR = "a_color", + t.ATTR_COLOR1 = "a_color1", + t.ATTR_COLOR2 = "a_color2", + t.ATTR_TEX_COORD = "a_texCoord", + t.ATTR_TEX_COORD1 = "a_texCoord1", + t.ATTR_TEX_COORD2 = "a_texCoord2", + t.ATTR_TEX_COORD3 = "a_texCoord3", + t.ATTR_TEX_COORD4 = "a_texCoord4", + t.ATTR_TEX_COORD5 = "a_texCoord5", + t.ATTR_TEX_COORD6 = "a_texCoord6", + t.ATTR_TEX_COORD7 = "a_texCoord7", + t.ATTR_TEX_COORD8 = "a_texCoord8" + } + )(s || (s = {})), + (function(t) { + t[t.UNKNOWN = 0] = "UNKNOWN", + t[t.BOOL = 1] = "BOOL", + t[t.BOOL2 = 2] = "BOOL2", + t[t.BOOL3 = 3] = "BOOL3", + t[t.BOOL4 = 4] = "BOOL4", + t[t.INT = 5] = "INT", + t[t.INT2 = 6] = "INT2", + t[t.INT3 = 7] = "INT3", + t[t.INT4 = 8] = "INT4", + t[t.UINT = 9] = "UINT", + t[t.UINT2 = 10] = "UINT2", + t[t.UINT3 = 11] = "UINT3", + t[t.UINT4 = 12] = "UINT4", + t[t.FLOAT = 13] = "FLOAT", + t[t.FLOAT2 = 14] = "FLOAT2", + t[t.FLOAT3 = 15] = "FLOAT3", + t[t.FLOAT4 = 16] = "FLOAT4", + t[t.COLOR4 = 17] = "COLOR4", + t[t.MAT2 = 18] = "MAT2", + t[t.MAT2X3 = 19] = "MAT2X3", + t[t.MAT2X4 = 20] = "MAT2X4", + t[t.MAT3X2 = 21] = "MAT3X2", + t[t.MAT3 = 22] = "MAT3", + t[t.MAT3X4 = 23] = "MAT3X4", + t[t.MAT4X2 = 24] = "MAT4X2", + t[t.MAT4X3 = 25] = "MAT4X3", + t[t.MAT4 = 26] = "MAT4", + t[t.SAMPLER1D = 27] = "SAMPLER1D", + t[t.SAMPLER1D_ARRAY = 28] = "SAMPLER1D_ARRAY", + t[t.SAMPLER2D = 29] = "SAMPLER2D", + t[t.SAMPLER2D_ARRAY = 30] = "SAMPLER2D_ARRAY", + t[t.SAMPLER3D = 31] = "SAMPLER3D", + t[t.SAMPLER_CUBE = 32] = "SAMPLER_CUBE", + t[t.COUNT = 33] = "COUNT" + } + )(a || (a = {})), + (function(t) { + t[t.UNKNOWN = 0] = "UNKNOWN", + t[t.A8 = 1] = "A8", + t[t.L8 = 2] = "L8", + t[t.LA8 = 3] = "LA8", + t[t.R8 = 4] = "R8", + t[t.R8SN = 5] = "R8SN", + t[t.R8UI = 6] = "R8UI", + t[t.R8I = 7] = "R8I", + t[t.R16F = 8] = "R16F", + t[t.R16UI = 9] = "R16UI", + t[t.R16I = 10] = "R16I", + t[t.R32F = 11] = "R32F", + t[t.R32UI = 12] = "R32UI", + t[t.R32I = 13] = "R32I", + t[t.RG8 = 14] = "RG8", + t[t.RG8SN = 15] = "RG8SN", + t[t.RG8UI = 16] = "RG8UI", + t[t.RG8I = 17] = "RG8I", + t[t.RG16F = 18] = "RG16F", + t[t.RG16UI = 19] = "RG16UI", + t[t.RG16I = 20] = "RG16I", + t[t.RG32F = 21] = "RG32F", + t[t.RG32UI = 22] = "RG32UI", + t[t.RG32I = 23] = "RG32I", + t[t.RGB8 = 24] = "RGB8", + t[t.SRGB8 = 25] = "SRGB8", + t[t.RGB8SN = 26] = "RGB8SN", + t[t.RGB8UI = 27] = "RGB8UI", + t[t.RGB8I = 28] = "RGB8I", + t[t.RGB16F = 29] = "RGB16F", + t[t.RGB16UI = 30] = "RGB16UI", + t[t.RGB16I = 31] = "RGB16I", + t[t.RGB32F = 32] = "RGB32F", + t[t.RGB32UI = 33] = "RGB32UI", + t[t.RGB32I = 34] = "RGB32I", + t[t.RGBA8 = 35] = "RGBA8", + t[t.SRGB8_A8 = 36] = "SRGB8_A8", + t[t.RGBA8SN = 37] = "RGBA8SN", + t[t.RGBA8UI = 38] = "RGBA8UI", + t[t.RGBA8I = 39] = "RGBA8I", + t[t.RGBA16F = 40] = "RGBA16F", + t[t.RGBA16UI = 41] = "RGBA16UI", + t[t.RGBA16I = 42] = "RGBA16I", + t[t.RGBA32F = 43] = "RGBA32F", + t[t.RGBA32UI = 44] = "RGBA32UI", + t[t.RGBA32I = 45] = "RGBA32I", + t[t.R5G6B5 = 46] = "R5G6B5", + t[t.R11G11B10F = 47] = "R11G11B10F", + t[t.RGB5A1 = 48] = "RGB5A1", + t[t.RGBA4 = 49] = "RGBA4", + t[t.RGB10A2 = 50] = "RGB10A2", + t[t.RGB10A2UI = 51] = "RGB10A2UI", + t[t.RGB9E5 = 52] = "RGB9E5", + t[t.D16 = 53] = "D16", + t[t.D16S8 = 54] = "D16S8", + t[t.D24 = 55] = "D24", + t[t.D24S8 = 56] = "D24S8", + t[t.D32F = 57] = "D32F", + t[t.D32F_S8 = 58] = "D32F_S8", + t[t.BC1 = 59] = "BC1", + t[t.BC1_ALPHA = 60] = "BC1_ALPHA", + t[t.BC1_SRGB = 61] = "BC1_SRGB", + t[t.BC1_SRGB_ALPHA = 62] = "BC1_SRGB_ALPHA", + t[t.BC2 = 63] = "BC2", + t[t.BC2_SRGB = 64] = "BC2_SRGB", + t[t.BC3 = 65] = "BC3", + t[t.BC3_SRGB = 66] = "BC3_SRGB", + t[t.BC4 = 67] = "BC4", + t[t.BC4_SNORM = 68] = "BC4_SNORM", + t[t.BC5 = 69] = "BC5", + t[t.BC5_SNORM = 70] = "BC5_SNORM", + t[t.BC6H_UF16 = 71] = "BC6H_UF16", + t[t.BC6H_SF16 = 72] = "BC6H_SF16", + t[t.BC7 = 73] = "BC7", + t[t.BC7_SRGB = 74] = "BC7_SRGB", + t[t.ETC_RGB8 = 75] = "ETC_RGB8", + t[t.ETC2_RGB8 = 76] = "ETC2_RGB8", + t[t.ETC2_SRGB8 = 77] = "ETC2_SRGB8", + t[t.ETC2_RGB8_A1 = 78] = "ETC2_RGB8_A1", + t[t.ETC2_SRGB8_A1 = 79] = "ETC2_SRGB8_A1", + t[t.ETC2_RGBA8 = 80] = "ETC2_RGBA8", + t[t.ETC2_SRGB8_A8 = 81] = "ETC2_SRGB8_A8", + t[t.EAC_R11 = 82] = "EAC_R11", + t[t.EAC_R11SN = 83] = "EAC_R11SN", + t[t.EAC_RG11 = 84] = "EAC_RG11", + t[t.EAC_RG11SN = 85] = "EAC_RG11SN", + t[t.PVRTC_RGB2 = 86] = "PVRTC_RGB2", + t[t.PVRTC_RGBA2 = 87] = "PVRTC_RGBA2", + t[t.PVRTC_RGB4 = 88] = "PVRTC_RGB4", + t[t.PVRTC_RGBA4 = 89] = "PVRTC_RGBA4", + t[t.PVRTC2_2BPP = 90] = "PVRTC2_2BPP", + t[t.PVRTC2_4BPP = 91] = "PVRTC2_4BPP" + } + )(o || (o = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC", + t[t.TRANSFER_DST = 2] = "TRANSFER_DST", + t[t.INDEX = 4] = "INDEX", + t[t.VERTEX = 8] = "VERTEX", + t[t.UNIFORM = 16] = "UNIFORM", + t[t.STORAGE = 32] = "STORAGE", + t[t.INDIRECT = 64] = "INDIRECT" + } + )(l || (l = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.DEVICE = 1] = "DEVICE", + t[t.HOST = 2] = "HOST" + } + )(h || (h = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.READ = 1] = "READ", + t[t.WRITE = 2] = "WRITE" + } + )(c || (c = {})), + (function(t) { + t[t.POINT_LIST = 0] = "POINT_LIST", + t[t.LINE_LIST = 1] = "LINE_LIST", + t[t.LINE_STRIP = 2] = "LINE_STRIP", + t[t.LINE_LOOP = 3] = "LINE_LOOP", + t[t.LINE_LIST_ADJACENCY = 4] = "LINE_LIST_ADJACENCY", + t[t.LINE_STRIP_ADJACENCY = 5] = "LINE_STRIP_ADJACENCY", + t[t.ISO_LINE_LIST = 6] = "ISO_LINE_LIST", + t[t.TRIANGLE_LIST = 7] = "TRIANGLE_LIST", + t[t.TRIANGLE_STRIP = 8] = "TRIANGLE_STRIP", + t[t.TRIANGLE_FAN = 9] = "TRIANGLE_FAN", + t[t.TRIANGLE_LIST_ADJACENCY = 10] = "TRIANGLE_LIST_ADJACENCY", + t[t.TRIANGLE_STRIP_ADJACENCY = 11] = "TRIANGLE_STRIP_ADJACENCY", + t[t.TRIANGLE_PATCH_ADJACENCY = 12] = "TRIANGLE_PATCH_ADJACENCY", + t[t.QUAD_PATCH_LIST = 13] = "QUAD_PATCH_LIST" + } + )(u || (u = {})), + (function(t) { + t[t.FILL = 0] = "FILL", + t[t.POINT = 1] = "POINT", + t[t.LINE = 2] = "LINE" + } + )(_ || (_ = {})), + (function(t) { + t[t.GOURAND = 0] = "GOURAND", + t[t.FLAT = 1] = "FLAT" + } + )(f || (f = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.FRONT = 1] = "FRONT", + t[t.BACK = 2] = "BACK" + } + )(d || (d = {})), + (function(t) { + t[t.NEVER = 0] = "NEVER", + t[t.LESS = 1] = "LESS", + t[t.EQUAL = 2] = "EQUAL", + t[t.LESS_EQUAL = 3] = "LESS_EQUAL", + t[t.GREATER = 4] = "GREATER", + t[t.NOT_EQUAL = 5] = "NOT_EQUAL", + t[t.GREATER_EQUAL = 6] = "GREATER_EQUAL", + t[t.ALWAYS = 7] = "ALWAYS" + } + )(p || (p = {})), + (function(t) { + t[t.ZERO = 0] = "ZERO", + t[t.KEEP = 1] = "KEEP", + t[t.REPLACE = 2] = "REPLACE", + t[t.INCR = 3] = "INCR", + t[t.DECR = 4] = "DECR", + t[t.INVERT = 5] = "INVERT", + t[t.INCR_WRAP = 6] = "INCR_WRAP", + t[t.DECR_WRAP = 7] = "DECR_WRAP" + } + )(m || (m = {})), + (function(t) { + t[t.ADD = 0] = "ADD", + t[t.SUB = 1] = "SUB", + t[t.REV_SUB = 2] = "REV_SUB", + t[t.MIN = 3] = "MIN", + t[t.MAX = 4] = "MAX" + } + )(y || (y = {})), + (function(t) { + t[t.ZERO = 0] = "ZERO", + t[t.ONE = 1] = "ONE", + t[t.SRC_ALPHA = 2] = "SRC_ALPHA", + t[t.DST_ALPHA = 3] = "DST_ALPHA", + t[t.ONE_MINUS_SRC_ALPHA = 4] = "ONE_MINUS_SRC_ALPHA", + t[t.ONE_MINUS_DST_ALPHA = 5] = "ONE_MINUS_DST_ALPHA", + t[t.SRC_COLOR = 6] = "SRC_COLOR", + t[t.DST_COLOR = 7] = "DST_COLOR", + t[t.ONE_MINUS_SRC_COLOR = 8] = "ONE_MINUS_SRC_COLOR", + t[t.ONE_MINUS_DST_COLOR = 9] = "ONE_MINUS_DST_COLOR", + t[t.SRC_ALPHA_SATURATE = 10] = "SRC_ALPHA_SATURATE", + t[t.CONSTANT_COLOR = 11] = "CONSTANT_COLOR", + t[t.ONE_MINUS_CONSTANT_COLOR = 12] = "ONE_MINUS_CONSTANT_COLOR", + t[t.CONSTANT_ALPHA = 13] = "CONSTANT_ALPHA", + t[t.ONE_MINUS_CONSTANT_ALPHA = 14] = "ONE_MINUS_CONSTANT_ALPHA" + } + )(v || (v = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.R = 1] = "R", + t[t.G = 2] = "G", + t[t.B = 4] = "B", + t[t.A = 8] = "A", + t[t.ALL = 15] = "ALL" + } + )(g || (g = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.POINT = 1] = "POINT", + t[t.LINEAR = 2] = "LINEAR", + t[t.ANISOTROPIC = 3] = "ANISOTROPIC" + } + )(A || (A = {})), + (function(t) { + t[t.WRAP = 0] = "WRAP", + t[t.MIRROR = 1] = "MIRROR", + t[t.CLAMP = 2] = "CLAMP", + t[t.BORDER = 3] = "BORDER" + } + )(x || (x = {})), + (function(t) { + t[t.TEX1D = 0] = "TEX1D", + t[t.TEX2D = 1] = "TEX2D", + t[t.TEX3D = 2] = "TEX3D" + } + )(b || (b = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC", + t[t.TRANSFER_DST = 2] = "TRANSFER_DST", + t[t.SAMPLED = 4] = "SAMPLED", + t[t.STORAGE = 8] = "STORAGE", + t[t.COLOR_ATTACHMENT = 16] = "COLOR_ATTACHMENT", + t[t.DEPTH_STENCIL_ATTACHMENT = 32] = "DEPTH_STENCIL_ATTACHMENT", + t[t.TRANSIENT_ATTACHMENT = 64] = "TRANSIENT_ATTACHMENT", + t[t.INPUT_ATTACHMENT = 128] = "INPUT_ATTACHMENT" + } + )(C || (C = {})), + (function(t) { + t[t.X1 = 0] = "X1", + t[t.X2 = 1] = "X2", + t[t.X4 = 2] = "X4", + t[t.X8 = 3] = "X8", + t[t.X16 = 4] = "X16", + t[t.X32 = 5] = "X32", + t[t.X64 = 6] = "X64" + } + )(T || (T = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.GEN_MIPMAP = 1] = "GEN_MIPMAP", + t[t.CUBEMAP = 2] = "CUBEMAP", + t[t.BAKUP_BUFFER = 4] = "BAKUP_BUFFER" + } + )(S || (S = {})), + (function(t) { + t[t.TV1D = 0] = "TV1D", + t[t.TV2D = 1] = "TV2D", + t[t.TV3D = 2] = "TV3D", + t[t.CUBE = 3] = "CUBE", + t[t.TV1D_ARRAY = 4] = "TV1D_ARRAY", + t[t.TV2D_ARRAY = 5] = "TV2D_ARRAY" + } + )(w || (w = {})), + (function(t) { + t[t.VERTEX = 0] = "VERTEX", + t[t.HULL = 1] = "HULL", + t[t.DOMAIN = 2] = "DOMAIN", + t[t.GEOMETRY = 3] = "GEOMETRY", + t[t.FRAGMENT = 4] = "FRAGMENT", + t[t.COMPUTE = 5] = "COMPUTE", + t[t.COUNT = 6] = "COUNT" + } + )(E || (E = {})), + (function(t) { + t[t.UNKNOWN = 0] = "UNKNOWN", + t[t.UNIFORM_BUFFER = 1] = "UNIFORM_BUFFER", + t[t.SAMPLER = 2] = "SAMPLER", + t[t.STORAGE_BUFFER = 3] = "STORAGE_BUFFER" + } + )(M || (M = {})), + (function(t) { + t[t.PRIMARY = 0] = "PRIMARY", + t[t.SECONDARY = 1] = "SECONDARY" + } + )(D || (D = {})), + (function(t) { + t[t.LOAD = 0] = "LOAD", + t[t.CLEAR = 1] = "CLEAR", + t[t.DISCARD = 2] = "DISCARD" + } + )(B || (B = {})), + (function(t) { + t[t.STORE = 0] = "STORE", + t[t.DISCARD = 1] = "DISCARD" + } + )(I || (I = {})), + (function(t) { + t[t.UNDEFINED = 0] = "UNDEFINED", + t[t.GENERAL = 1] = "GENERAL", + t[t.COLOR_ATTACHMENT_OPTIMAL = 2] = "COLOR_ATTACHMENT_OPTIMAL", + t[t.DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3] = "DEPTH_STENCIL_ATTACHMENT_OPTIMAL", + t[t.DEPTH_STENCIL_READONLY_OPTIMAL = 4] = "DEPTH_STENCIL_READONLY_OPTIMAL", + t[t.SHADER_READONLY_OPTIMAL = 5] = "SHADER_READONLY_OPTIMAL", + t[t.TRANSFER_SRC_OPTIMAL = 6] = "TRANSFER_SRC_OPTIMAL", + t[t.TRANSFER_DST_OPTIMAL = 7] = "TRANSFER_DST_OPTIMAL", + t[t.PREINITIALIZED = 8] = "PREINITIALIZED", + t[t.PRESENT_SRC = 9] = "PRESENT_SRC" + } + )(P || (P = {})), + (function(t) { + t[t.GRAPHICS = 0] = "GRAPHICS", + t[t.COMPUTE = 1] = "COMPUTE", + t[t.RAY_TRACING = 2] = "RAY_TRACING" + } + )(R || (R = {})), + (function(t) { + t[t.VIEWPORT = 0] = "VIEWPORT", + t[t.SCISSOR = 1] = "SCISSOR", + t[t.LINE_WIDTH = 2] = "LINE_WIDTH", + t[t.DEPTH_BIAS = 3] = "DEPTH_BIAS", + t[t.BLEND_CONSTANTS = 4] = "BLEND_CONSTANTS", + t[t.DEPTH_BOUNDS = 5] = "DEPTH_BOUNDS", + t[t.STENCIL_WRITE_MASK = 6] = "STENCIL_WRITE_MASK", + t[t.STENCIL_COMPARE_MASK = 7] = "STENCIL_COMPARE_MASK" + } + )(O || (O = {})), + (function(t) { + t[t.FRONT = 0] = "FRONT", + t[t.BACK = 1] = "BACK", + t[t.ALL = 2] = "ALL" + } + )(L || (L = {})), + (function(t) { + t[t.GRAPHICS = 0] = "GRAPHICS", + t[t.COMPUTE = 1] = "COMPUTE", + t[t.TRANSFER = 2] = "TRANSFER" + } + )(F || (F = {})), + (function(t) { + t[t.NONE = 0] = "NONE", + t[t.COLOR = 1] = "COLOR", + t[t.DEPTH = 2] = "DEPTH", + t[t.STENCIL = 4] = "STENCIL", + t[t.DEPTH_STENCIL = 6] = "DEPTH_STENCIL", + t[t.ALL = 7] = "ALL" + } + )(V || (V = {})), + (function(t) { + t[t.DEFAULT = 100] = "DEFAULT" + } + )(N || (N = {})), + (function(t) { + t[t.MIN = 0] = "MIN", + t[t.MAX = 255] = "MAX", + t[t.DEFAULT = 128] = "DEFAULT" + } + )(k || (k = {})), + (function(t) { + t[t.UBO_GLOBAL = 23] = "UBO_GLOBAL", + t[t.UBO_SHADOW = 22] = "UBO_SHADOW", + t[t.UBO_LOCAL = 21] = "UBO_LOCAL", + t[t.UBO_FORWARD_LIGHTS = 20] = "UBO_FORWARD_LIGHTS", + t[t.UBO_SKINNING = 19] = "UBO_SKINNING", + t[t.UBO_SKINNING_TEXTURE = 18] = "UBO_SKINNING_TEXTURE", + t[t.UBO_UI = 17] = "UBO_UI", + t[t.SAMPLER_JOINTS = 25] = "SAMPLER_JOINTS", + t[t.SAMPLER_ENVIRONMENT = 26] = "SAMPLER_ENVIRONMENT", + t[t.CUSTUM_UBO_BINDING_END_POINT = 17] = "CUSTUM_UBO_BINDING_END_POINT", + t[t.CUSTOM_SAMPLER_BINDING_START_POINT = 30] = "CUSTOM_SAMPLER_BINDING_START_POINT" + } + )(G || (G = {})), + (function(t) { + t[t.minFilter = 0] = "minFilter", + t[t.magFilter = 1] = "magFilter", + t[t.mipFilter = 2] = "mipFilter", + t[t.addressU = 3] = "addressU", + t[t.addressV = 4] = "addressV", + t[t.addressW = 5] = "addressW", + t[t.maxAnisotropy = 6] = "maxAnisotropy", + t[t.cmpFunc = 7] = "cmpFunc", + t[t.minLOD = 8] = "minLOD", + t[t.maxLOD = 9] = "maxLOD", + t[t.mipLODBias = 10] = "mipLODBias", + t[t.borderColor = 11] = "borderColor", + t[t.total = 15] = "total" + } + )(H || (H = {})); + var W = {}; + W[W.bool = a.BOOL] = "bool", + W[W.int = a.INT] = "int", + W[W.ivec2 = a.INT2] = "ivec2invTypeParams", + W[W.ivec3 = a.INT3] = "ivec3", + W[W.ivec4 = a.INT4] = "ivec4", + W[W.float = a.FLOAT] = "float", + W[W.vec2 = a.FLOAT2] = "vec2", + W[W.vec3 = a.FLOAT3] = "vec3", + W[W.vec4 = a.FLOAT4] = "vec4", + W[W.mat2 = a.MAT2] = "mat2", + W[W.mat3 = a.MAT3] = "mat3", + W[W.mat4 = a.MAT4] = "mat4", + W[W.sampler2D = a.SAMPLER2D] = "sampler2D", + W[W.samplerCube = a.SAMPLER_CUBE] = "samplerCube"; + var j = ((U = {})[a.BOOL] = 4, + U[a.INT] = 4, + U[a.INT2] = 8, + U[a.INT3] = 12, + U[a.INT4] = 16, + U[a.FLOAT] = 4, + U[a.FLOAT2] = 8, + U[a.FLOAT3] = 12, + U[a.FLOAT4] = 16, + U[a.MAT2] = 16, + U[a.MAT3] = 36, + U[a.MAT4] = 64, + U[a.SAMPLER2D] = 4, + U[a.SAMPLER_CUBE] = 4, + U) + , X = ((z = {})[a.BOOL] = o.R32I, + z[a.INT] = o.R32I, + z[a.INT2] = o.RG32I, + z[a.INT3] = o.RGB32I, + z[a.INT4] = o.RGBA32I, + z[a.FLOAT] = o.R32F, + z[a.FLOAT2] = o.RG32F, + z[a.FLOAT3] = o.RGB32F, + z[a.FLOAT4] = o.RGBA32F, + z) + , Y = { + BACK: 1029, + FRONT: 1028, + NONE: 0, + ADD: 32774, + SUB: 32778, + REV_SUB: 32779, + ZERO: 0, + ONE: 1, + SRC_COLOR: 768, + ONE_MINUS_SRC_COLOR: 769, + DST_COLOR: 774, + ONE_MINUS_DST_COLOR: 775, + SRC_ALPHA: 770, + ONE_MINUS_SRC_ALPHA: 771, + DST_ALPHA: 772, + ONE_MINUS_DST_ALPHA: 773, + CONSTANT_COLOR: 32769, + ONE_MINUS_CONSTANT_COLOR: 32770, + CONSTANT_ALPHA: 32771, + ONE_MINUS_CONSTANT_ALPHA: 32772, + SRC_ALPHA_SATURATE: 776, + NEVER: 512, + LESS: 513, + EQUAL: 514, + LEQUAL: 515, + GREATER: 516, + NOTEQUAL: 517, + GEQUAL: 518, + ALWAYS: 519, + KEEP: 7680, + REPLACE: 7681, + INCR: 7682, + INCR_WRAP: 34055, + DECR: 7683, + DECR_WRAP: 34056, + INVERT: 5386 + }; + Object.assign(Y, N); + var q = { + murmurhash2_32_gc: function(t, e) { + for (var i, n = t.length, r = e ^ n, s = 0; n >= 4; ) + i = 1540483477 * (65535 & (i = 255 & t.charCodeAt(s) | (255 & t.charCodeAt(++s)) << 8 | (255 & t.charCodeAt(++s)) << 16 | (255 & t.charCodeAt(++s)) << 24)) + ((1540483477 * (i >>> 16) & 65535) << 16), + r = 1540483477 * (65535 & r) + ((1540483477 * (r >>> 16) & 65535) << 16) ^ (i = 1540483477 * (65535 & (i ^= i >>> 24)) + ((1540483477 * (i >>> 16) & 65535) << 16)), + n -= 4, + ++s; + switch (n) { + case 3: + r ^= (255 & t.charCodeAt(s + 2)) << 16; + case 2: + r ^= (255 & t.charCodeAt(s + 1)) << 8; + case 1: + r = 1540483477 * (65535 & (r ^= 255 & t.charCodeAt(s))) + ((1540483477 * (r >>> 16) & 65535) << 16) + } + return r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16), + (r ^= r >>> 15) >>> 0 + }, + SamplerInfoIndex: H, + effectStructure: { + $techniques: [{ + $passes: [{ + depthStencilState: {}, + rasterizerState: {}, + blendState: { + targets: [{}] + }, + properties: { + any: { + sampler: {}, + inspector: {} + } + } + }] + }] + }, + typeMap: W, + sizeMap: j, + formatMap: X, + passParams: Y, + RenderQueue: { + OPAQUE: 0, + TRANSPARENT: 1, + OVERLAY: 2 + }, + RenderPriority: k, + GFXGetTypeSize: function(t) { + switch (t) { + case a.BOOL: + case a.INT: + case a.UINT: + case a.FLOAT: + return 4; + case a.BOOL2: + case a.INT2: + case a.UINT2: + case a.FLOAT2: + return 8; + case a.BOOL3: + case a.INT3: + case a.UINT3: + case a.FLOAT3: + return 12; + case a.BOOL4: + case a.INT4: + case a.UINT4: + case a.FLOAT4: + case a.MAT2: + return 16; + case a.MAT2X3: + return 24; + case a.MAT2X4: + return 32; + case a.MAT3X2: + return 24; + case a.MAT3: + return 36; + case a.MAT3X4: + return 48; + case a.MAT4X2: + case a.MAT4X2: + return 32; + case a.MAT4: + return 64; + case a.SAMPLER1D: + case a.SAMPLER1D_ARRAY: + case a.SAMPLER2D: + case a.SAMPLER2D_ARRAY: + case a.SAMPLER3D: + case a.SAMPLER_CUBE: + return 4; + default: + return 0 + } + }, + UniformBinding: G + }; + e.exports = q + } + ), {}], + 304: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("../memop") + , r = h(t("../enums")) + , s = t("../../core/value-types") + , a = h(t("./program-lib")) + , o = h(t("./view")) + , l = h(t("../gfx")); + function h(t) { + return t && t.__esModule ? t : { + default: t + } + } + var c = new s.Mat4 + , u = new n.RecyclePool(function() { + return { + stage: null, + items: null + } + } + ,8) + , _ = new n.RecyclePool(function() { + return new Float32Array(2) + } + ,8) + , f = new n.RecyclePool(function() { + return new Float32Array(3) + } + ,8) + , d = new n.RecyclePool(function() { + return new Float32Array(4) + } + ,8) + , p = new n.RecyclePool(function() { + return new Float32Array(9) + } + ,8) + , m = new n.RecyclePool(function() { + return new Float32Array(16) + } + ,8) + , y = new n.RecyclePool(function() { + return new Float32Array(64) + } + ,8) + , v = new n.RecyclePool(function() { + return new Int32Array(2) + } + ,8) + , g = new n.RecyclePool(function() { + return new Int32Array(3) + } + ,8) + , A = new n.RecyclePool(function() { + return new Int32Array(4) + } + ,8) + , x = new n.RecyclePool(function() { + return new Int32Array(64) + } + ,8) + , b = (function() { + function t(t, e) { + var i; + this._device = t, + this._programLib = new a.default(t), + this._opts = e, + this._type2defaultValue = ((i = {})[r.default.PARAM_INT] = 0, + i[r.default.PARAM_INT2] = new s.Vec2(0,0), + i[r.default.PARAM_INT3] = new s.Vec3(0,0,0), + i[r.default.PARAM_INT4] = new s.Vec4(0,0,0,0), + i[r.default.PARAM_FLOAT] = 0, + i[r.default.PARAM_FLOAT2] = new s.Vec2(0,0), + i[r.default.PARAM_FLOAT3] = new s.Vec3(0,0,0), + i[r.default.PARAM_FLOAT4] = new s.Vec4(0,0,0,0), + i[r.default.PARAM_COLOR4] = new s.Color(0,0,0,1), + i[r.default.PARAM_MAT3] = new s.Mat3, + i[r.default.PARAM_MAT4] = new s.Mat4, + i[r.default.PARAM_TEXTURE_2D] = e.defaultTexture, + i[r.default.PARAM_TEXTURE_CUBE] = e.defaultTextureCube, + i), + this._stage2fn = {}, + this._usedTextureUnits = 0, + this._viewPools = new n.RecyclePool(function() { + return new o.default + } + ,8), + this._drawItemsPools = new n.RecyclePool(function() { + return { + model: null, + node: null, + ia: null, + effect: null, + defines: null, + uniforms: null + } + } + ,100), + this._stageItemsPools = new n.RecyclePool(function() { + return new n.RecyclePool(function() { + return { + model: null, + node: null, + ia: null, + effect: null, + defines: null, + passes: [], + sortKey: -1, + uniforms: null + } + } + ,100) + } + ,16), + this._definesChanged = !1 + } + var e = t.prototype; + return e._resetTextuerUnit = function() { + this._usedTextureUnits = 0 + } + , + e._allocTextureUnit = function() { + var t = this._device + , e = this._usedTextureUnits; + return e >= t._caps.maxTextureUnits && console.warn("Trying to use " + e + " texture units while this GPU supports only " + t._caps.maxTextureUnits), + this._usedTextureUnits += 1, + e + } + , + e._registerStage = function(t, e) { + this._stage2fn[t] = e + } + , + e.clear = function() { + this._programLib.clear(), + this.reset() + } + , + e.reset = function() { + this._viewPools.reset(), + this._stageItemsPools.reset(), + this._definesChanged = !1 + } + , + e._requestView = function() { + return this._viewPools.add() + } + , + e._render = function(t, e) { + var i = this._device; + i.setFrameBuffer(t._framebuffer), + i.setViewport(t._rect.x, t._rect.y, t._rect.w, t._rect.h); + var n = {}; + t._clearFlags & r.default.CLEAR_COLOR && (n.color = s.Vec4.toArray([], t._color)), + t._clearFlags & r.default.CLEAR_DEPTH && (n.depth = t._depth), + t._clearFlags & r.default.CLEAR_STENCIL && (n.stencil = t._stencil), + i.clear(n), + this._drawItemsPools.reset(); + for (var a = 0; a < e._models.length; ++a) { + var o = e._models.data[a]; + if (0 != (o._cullingMask & t._cullingMask)) { + var l = this._drawItemsPools.add(); + o.extractDrawItem(l) + } + } + u.reset(); + for (var h = 0; h < t._stages.length; ++h) { + var c = t._stages[h] + , _ = this._stageItemsPools.add(); + _.reset(); + for (var f = 0; f < this._drawItemsPools.length; ++f) { + var d = this._drawItemsPools.data[f] + , p = d.effect.stagePasses[c]; + if (p && 0 !== p.length) { + var m = _.add(); + m.passes = p, + m.model = d.model, + m.node = d.node, + m.ia = d.ia, + m.effect = d.effect, + m.defines = d.defines, + m.sortKey = -1, + m.uniforms = d.uniforms + } + } + var y = u.add(); + y.stage = c, + y.items = _ + } + for (var v = 0; v < u.length; ++v) { + var g = u.data[v]; + (0, + this._stage2fn[g.stage])(t, g.items) + } + } + , + e._setProperty = function(t) { + var e = this._device + , i = t.value; + if (void 0 === i && (i = t.val), + void 0 === i && (i = this._type2defaultValue[t.type]), + void 0 !== i) + if (t.type === r.default.PARAM_TEXTURE_2D || t.type === r.default.PARAM_TEXTURE_CUBE) + if (Array.isArray(i)) { + if (i.length > t.count) + return void console.error("Failed to set property [" + t.name + "] : The length of texture array [" + i.length + "] is bigger than [" + t.count + "]."); + for (var n = x.add(), s = 0; s < i.length; ++s) + n[s] = this._allocTextureUnit(); + e.setTextureArray(t.name, i, n) + } else + e.setTexture(t.name, i, this._allocTextureUnit()); + else + t.directly ? e.setUniformDirectly(t.name, i) : e.setUniform(t.name, i); + else + console.warn("Failed to set technique property " + t.name + ", value not found.") + } + , + e._draw = function(t) { + var e = this._device + , i = this._programLib + , n = t.node + , r = t.ia + , a = t.passes + , o = t.effect; + _.reset(), + f.reset(), + d.reset(), + p.reset(), + m.reset(), + y.reset(), + v.reset(), + g.reset(), + A.reset(), + x.reset(), + n.getWorldMatrix(c), + e.setUniform("cc_matWorld", s.Mat4.toArray(m.add(), c)), + s.Mat4.invert(c, c), + s.Mat4.transpose(c, c), + e.setUniform("cc_matWorldIT", s.Mat4.toArray(m.add(), c)); + for (var h = this._defines, u = 0; u < a.length; ++u) { + var b = a[u]; + this._definesChanged && (b._programKey = null); + var C = r.count; + r._vertexBuffer && e.setVertexBuffer(0, r._vertexBuffer), + r._indexBuffer && e.setIndexBuffer(r._indexBuffer), + e.setPrimitiveType(r._primitiveType), + Object.setPrototypeOf(h, b._defines); + var T = i.getProgram(b, h, o.name); + e.setProgram(T); + for (var S = T._uniforms, w = b._properties, E = 0; E < S.length; E++) { + var M = w[S[E].name]; + void 0 !== M && this._setProperty(M) + } + e.setCullMode(b._cullMode), + b._blend && (e.enableBlend(), + e.setBlendFuncSep(b._blendSrc, b._blendDst, b._blendSrcAlpha, b._blendDstAlpha), + e.setBlendEqSep(b._blendEq, b._blendAlphaEq), + e.setBlendColor32(b._blendColor)), + b._depthTest && (e.enableDepthTest(), + e.setDepthFunc(b._depthFunc)), + b._depthWrite && e.enableDepthWrite(), + e.setStencilTest(b._stencilTest), + b._stencilTest === l.default.STENCIL_ENABLE && (e.setStencilFuncFront(b._stencilFuncFront, b._stencilRefFront, b._stencilMaskFront), + e.setStencilOpFront(b._stencilFailOpFront, b._stencilZFailOpFront, b._stencilZPassOpFront, b._stencilWriteMaskFront), + e.setStencilFuncBack(b._stencilFuncBack, b._stencilRefBack, b._stencilMaskBack), + e.setStencilOpBack(b._stencilFailOpBack, b._stencilZFailOpBack, b._stencilZPassOpBack, b._stencilWriteMaskBack)), + e.draw(r._start, C), + this._resetTextuerUnit() + } + } + , + t + } + )(); + i.default = b, + e.exports = i.default + } + ), { + "../../core/value-types": 282, + "../enums": 310, + "../gfx": 315, + "../memop": 327, + "./program-lib": 307, + "./view": 309 + }], + 305: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../gfx")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var a = (function() { + function t(t, e, i) { + void 0 === i && (i = r.default.PT_TRIANGLES), + this._vertexBuffer = t, + this._indexBuffer = e, + this._primitiveType = i, + this._start = 0, + this._count = -1 + } + var e, i; + return e = t, + (i = [{ + key: "count", + get: function() { + return -1 !== this._count ? this._count : this._indexBuffer ? this._indexBuffer.count : this._vertexBuffer ? this._vertexBuffer.count : 0 + } + }]) && s(e.prototype, i), + t + } + )(); + i.default = a, + e.exports = i.default + } + ), { + "../gfx": 315 + }], + 306: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = a(t("../gfx")) + , r = a(t("../enums")) + , s = a(t("../../core/value-types/value-type")); + function a(t) { + return t && t.__esModule ? t : { + default: t + } + } + var o = (function() { + function t(t, e, i, r, s, a) { + void 0 === s && (s = {}), + void 0 === a && (a = {}), + this._name = t, + this._detailName = e, + this._programName = i, + this._programKey = null, + this._stage = r, + this._properties = s, + this._defines = a, + this._cullMode = n.default.CULL_BACK, + this._blend = !1, + this._blendEq = n.default.BLEND_FUNC_ADD, + this._blendAlphaEq = n.default.BLEND_FUNC_ADD, + this._blendSrc = n.default.BLEND_SRC_ALPHA, + this._blendDst = n.default.BLEND_ONE_MINUS_SRC_ALPHA, + this._blendSrcAlpha = n.default.BLEND_SRC_ALPHA, + this._blendDstAlpha = n.default.BLEND_ONE_MINUS_SRC_ALPHA, + this._blendColor = 4294967295, + this._depthTest = !1, + this._depthWrite = !1, + this._depthFunc = n.default.DS_FUNC_LESS, + this._stencilTest = n.default.STENCIL_INHERIT, + this._stencilFuncFront = n.default.DS_FUNC_ALWAYS, + this._stencilRefFront = 0, + this._stencilMaskFront = 255, + this._stencilFailOpFront = n.default.STENCIL_OP_KEEP, + this._stencilZFailOpFront = n.default.STENCIL_OP_KEEP, + this._stencilZPassOpFront = n.default.STENCIL_OP_KEEP, + this._stencilWriteMaskFront = 255, + this._stencilFuncBack = n.default.DS_FUNC_ALWAYS, + this._stencilRefBack = 0, + this._stencilMaskBack = 255, + this._stencilFailOpBack = n.default.STENCIL_OP_KEEP, + this._stencilZFailOpBack = n.default.STENCIL_OP_KEEP, + this._stencilZPassOpBack = n.default.STENCIL_OP_KEEP, + this._stencilWriteMaskBack = 255 + } + var e = t.prototype; + return e.setCullMode = function(t) { + void 0 === t && (t = n.default.CULL_BACK), + this._cullMode = t + } + , + e.setBlend = function(t, e, i, r, s, a, o, l) { + void 0 === t && (t = !1), + void 0 === e && (e = n.default.BLEND_FUNC_ADD), + void 0 === i && (i = n.default.BLEND_SRC_ALPHA), + void 0 === r && (r = n.default.BLEND_ONE_MINUS_SRC_ALPHA), + void 0 === s && (s = n.default.BLEND_FUNC_ADD), + void 0 === a && (a = n.default.BLEND_SRC_ALPHA), + void 0 === o && (o = n.default.BLEND_ONE_MINUS_SRC_ALPHA), + void 0 === l && (l = 4294967295), + this._blend = t, + this._blendEq = e, + this._blendSrc = i, + this._blendDst = r, + this._blendAlphaEq = s, + this._blendSrcAlpha = a, + this._blendDstAlpha = o, + this._blendColor = l + } + , + e.setDepth = function(t, e, i) { + void 0 === t && (t = !1), + void 0 === e && (e = !1), + void 0 === i && (i = n.default.DS_FUNC_LESS), + this._depthTest = t, + this._depthWrite = e, + this._depthFunc = i + } + , + e.setStencilFront = function(t, e, i, r, s, a, o, l) { + void 0 === t && (t = n.default.STENCIL_INHERIT), + void 0 === e && (e = n.default.DS_FUNC_ALWAYS), + void 0 === i && (i = 0), + void 0 === r && (r = 255), + void 0 === s && (s = n.default.STENCIL_OP_KEEP), + void 0 === a && (a = n.default.STENCIL_OP_KEEP), + void 0 === o && (o = n.default.STENCIL_OP_KEEP), + void 0 === l && (l = 255), + this._stencilTest = t, + this._stencilFuncFront = e, + this._stencilRefFront = i, + this._stencilMaskFront = r, + this._stencilFailOpFront = s, + this._stencilZFailOpFront = a, + this._stencilZPassOpFront = o, + this._stencilWriteMaskFront = l + } + , + e.setStencilEnabled = function(t) { + void 0 === t && (t = n.default.STENCIL_INHERIT), + this._stencilTest = t + } + , + e.setStencilBack = function(t, e, i, r, s, a, o, l) { + void 0 === t && (t = n.default.STENCIL_INHERIT), + void 0 === e && (e = n.default.DS_FUNC_ALWAYS), + void 0 === i && (i = 0), + void 0 === r && (r = 255), + void 0 === s && (s = n.default.STENCIL_OP_KEEP), + void 0 === a && (a = n.default.STENCIL_OP_KEEP), + void 0 === o && (o = n.default.STENCIL_OP_KEEP), + void 0 === l && (l = 255), + this._stencilTest = t, + this._stencilFuncBack = e, + this._stencilRefBack = i, + this._stencilMaskBack = r, + this._stencilFailOpBack = s, + this._stencilZFailOpBack = a, + this._stencilZPassOpBack = o, + this._stencilWriteMaskBack = l + } + , + e.setStage = function(t) { + this._stage = t + } + , + e.setProperties = function(t) { + this._properties = t + } + , + e.getProperty = function(t) { + if (this._properties[t]) + return this._properties[t].value + } + , + e.setProperty = function(t, e, i) { + var n = this._properties[t]; + if (!n) + return !1; + if (n.directly = i, + Array.isArray(e)) { + var a = n.value; + if (a.length !== e.length) + return void cc.warnID(9105, this._name, t); + for (var o = 0; o < e.length; o++) + a[o] = e[o] + } else + e && !ArrayBuffer.isView(e) ? n.type === r.default.PARAM_TEXTURE_2D ? n.value = e.getImpl() : e instanceof s.default ? e.constructor.toArray(n.value, e) : ("object" == typeof e && cc.warnID(9106, this._name, t), + n.value = e) : n.value = e; + return !0 + } + , + e.getDefine = function(t) { + return this._defines[t] + } + , + e.define = function(t, e, i) { + var n = this._defines[t]; + return !(!i && void 0 === n || (n !== e && (this._defines[t] = e, + this._programKey = null), + 0)) + } + , + e.clone = function() { + var e = new t(this._programName); + Object.assign(e, this); + var i = {} + , n = this._properties; + for (var r in n) { + var s = n[r] + , a = i[r] = {} + , o = s.value; + for (var l in Array.isArray(o) ? a.value = o.concat() : ArrayBuffer.isView(o) ? a.value = new o.__proto__.constructor(o) : a.value = o, + s) + "value" !== l && (a[l] = s[l]) + } + return e._properties = i, + e._defines = Object.assign({}, this._defines), + e + } + , + t + } + )(); + i.default = o, + e.exports = i.default + } + ), { + "../../core/value-types/value-type": 290, + "../enums": 310, + "../gfx": 315 + }], + 307: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../gfx")) && n.__esModule ? n : { + default: n + }, s = 0; + function a(t, e) { + for (var i = [], n = 0; n < t.length; n++) { + var r = t[n].name + , s = e[r]; + "number" != typeof s && (s = s ? 1 : 0), + i.push("#define " + r + " " + s) + } + return i.join("\n") + "\n" + } + function o(t, e, i) { + for (var n = t, r = 0; r < e.length; r++) { + var s = e[r].name + , a = i[s]; + if (Number.isInteger(a)) { + var o = new RegExp(s,"g"); + n = n.replace(o, a) + } + } + return n + } + function l(t) { + return t.replace(/#pragma for (\w+) in range\(\s*(\d+)\s*,\s*(\d+)\s*\)([\s\S]+?)#pragma endFor/g, (function(t, e, i, n, r) { + var s = "" + , a = parseInt(i) + , o = parseInt(n); + (a.isNaN || o.isNaN) && console.error("Unroll For Loops Error: begin and end of range must be an int num."); + for (var l = a; l < o; ++l) + s += r.replace(new RegExp("{" + e + "}","g"), l); + return s + } + )) + } + function h(t) { + return t.replace(/\bhighp\b/g, "mediump") + } + var c = (function() { + function t(t) { + this._device = t, + this._templates = {}, + this._cache = {}, + this._checkPrecision() + } + var e = t.prototype; + return e.clear = function() { + this._templates = {}, + this._cache = {} + } + , + e.define = function(t) { + var e = t.name + , i = t.defines + , n = t.glsl1 || t + , r = n.vert + , a = n.frag; + if (!this._templates[e]) { + for (var o = ++s, l = 0, h = 0; h < i.length; ++h) { + var c = i[h] + , u = 1; + if ("number" === c.type) { + var _ = c.range || []; + c.min = _[0] || 0, + c.max = _[1] || 4, + u = Math.ceil(Math.log2(c.max - c.min)), + c._map = function(t) { + return t - this.min << this._offset + } + .bind(c) + } else + c._map = function(t) { + return t ? 1 << this._offset : 0 + } + .bind(c); + c._offset = l, + l += u + } + var f = t.uniforms || []; + if (t.samplers) + for (var d = 0; d < t.samplers.length; d++) + f.push(t.samplers[d]); + if (t.blocks) + for (var p = 0; p < t.blocks.length; p++) + for (var m = t.blocks[p].defines, y = t.blocks[p].members, v = 0; v < y.length; v++) + f.push({ + defines: m, + name: y[v].name, + type: y[v].type + }); + this._templates[e] = { + id: o, + name: e, + vert: r, + frag: a, + defines: i, + attributes: t.attributes, + uniforms: f, + extensions: t.extensions + } + } + } + , + e.getTemplate = function(t) { + return this._templates[t] + } + , + e.hasProgram = function(t) { + return void 0 !== this._templates[t] + } + , + e.getKey = function(t, e) { + for (var i = this._templates[t], n = 0, r = 0; r < i.defines.length; ++r) { + var s = i.defines[r] + , a = e[s.name]; + void 0 !== a && (n |= s._map(a)) + } + return i.id + ":" + n + } + , + e.getProgram = function(t, e, i) { + var n = t._programKey = t._programKey || this.getKey(t._programName, e) + , s = this._cache[n]; + if (s) + return s; + var c = this._templates[t._programName] + , u = a(c.defines, e) + , _ = o(c.vert, c.defines, e); + _ = u + l(_), + this._highpSupported || (_ = h(_)); + var f = o(c.frag, c.defines, e); + f = u + l(f), + this._highpSupported || (f = h(f)); + var d = (s = new r.default.Program(this._device,{ + vert: _, + frag: f + })).link(); + if (d) { + var p = _.split("\n") + , m = f.split("\n") + , y = c.defines.length; + d.forEach((function(t) { + var e = t.line - 1 + , n = t.line - y + , r = ("vs" === t.type ? p : m)[e] + , s = t.info || "Failed to compile " + t.type + " " + t.fileID + " (ln " + n + "): \n " + t.message + ": \n " + r; + cc.error(i + " : " + s) + } + )) + } + return this._cache[n] = s, + s + } + , + e._checkPrecision = function() { + var t = this._device._gl + , e = !1; + if (t.getShaderPrecisionFormat) { + var i = t.getShaderPrecisionFormat(t.VERTEX_SHADER, t.HIGH_FLOAT) + , n = t.getShaderPrecisionFormat(t.FRAGMENT_SHADER, t.HIGH_FLOAT); + e = i && i.precision > 0 && n && n.precision > 0 + } + e || cc.warnID(9102), + this._highpSupported = e + } + , + t + } + )(); + i.default = c, + e.exports = i.default + } + ), { + "../gfx": 315 + }], + 308: [(function(t, e, i) { + "use strict"; + function n(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + i.__esModule = !0, + i.default = void 0; + var r = (function() { + function t(t, e) { + this._name = t, + this._passes = e + } + var e, i; + return t.prototype.clone = function() { + for (var e = [], i = 0; i < this._passes.length; i++) + e.push(this._passes[i].clone()); + return new t(this._name,e) + } + , + e = t, + (i = [{ + key: "name", + get: function() { + return this._name + } + }, { + key: "passes", + get: function() { + return this._passes + } + }]) && n(e.prototype, i), + t + } + )(); + i.default = r, + e.exports = i.default + } + ), {}], + 309: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../../core/value-types"), s = (n = t("../enums")) && n.__esModule ? n : { + default: n + }, a = new r.Mat4, o = 0, l = (function() { + function t() { + this._id = o++, + this._priority = 0, + this._rect = { + x: 0, + y: 0, + w: 1, + h: 1 + }, + this._color = new r.Vec4(.3,.3,.3,1), + this._depth = 1, + this._stencil = 0, + this._clearFlags = s.default.CLEAR_COLOR | s.default.CLEAR_DEPTH, + this._clearModel = null, + this._matView = cc.mat4(), + this._matViewInv = cc.mat4(), + this._matProj = cc.mat4(), + this._matViewProj = cc.mat4(), + this._matInvViewProj = cc.mat4(), + this._stages = [], + this._cullingByID = !1, + this._framebuffer = null, + this._shadowLight = null, + this._cullingMask = 4294967295 + } + var e = t.prototype; + return e.getForward = function(t) { + var e = this._matView.m; + return r.Vec3.set(t, -e[2], -e[6], -e[10]) + } + , + e.getPosition = function(t) { + return r.Mat4.invert(a, this._matView), + r.Mat4.getTranslation(t, a) + } + , + t + } + )(); + i.default = l, + e.exports = i.default + } + ), { + "../../core/value-types": 282, + "../enums": 310 + }], + 310: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("./build/mappings") + , r = { + PROJ_PERSPECTIVE: 0, + PROJ_ORTHO: 1, + LIGHT_DIRECTIONAL: 0, + LIGHT_POINT: 1, + LIGHT_SPOT: 2, + LIGHT_AMBIENT: 3, + SHADOW_NONE: 0, + SHADOW_HARD: 1, + SHADOW_SOFT: 2, + PARAM_INT: n.typeMap.int, + PARAM_INT2: n.typeMap.ivec2, + PARAM_INT3: n.typeMap.ivec3, + PARAM_INT4: n.typeMap.ivec4, + PARAM_FLOAT: n.typeMap.float, + PARAM_FLOAT2: n.typeMap.vec2, + PARAM_FLOAT3: n.typeMap.vec3, + PARAM_FLOAT4: n.typeMap.vec4, + PARAM_MAT2: n.typeMap.mat2, + PARAM_MAT3: n.typeMap.mat3, + PARAM_MAT4: n.typeMap.mat4, + PARAM_TEXTURE_2D: n.typeMap.sampler2D, + PARAM_TEXTURE_CUBE: n.typeMap.samplerCube, + CLEAR_COLOR: 1, + CLEAR_DEPTH: 2, + CLEAR_STENCIL: 4, + CLEAR_SKYBOX: 8, + BUFFER_VIEW_INT8: 0, + BUFFER_VIEW_UINT8: 1, + BUFFER_VIEW_INT16: 2, + BUFFER_VIEW_UINT16: 3, + BUFFER_VIEW_INT32: 4, + BUFFER_VIEW_UINT32: 5, + BUFFER_VIEW_FLOAT32: 6 + }; + i.default = r, + e.exports = i.default + } + ), { + "./build/mappings": 303 + }], + 311: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r, s = h(t("./state")), a = t("./enums"), o = h(t("./texture-2d")), l = h(t("./texture-cube")); + function h(t) { + return t && t.__esModule ? t : { + default: t + } + } + function c(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var u = ((n = {})[5124] = function(t, e, i) { + t.uniform1i(e, i) + } + , + n[5126] = function(t, e, i) { + t.uniform1f(e, i) + } + , + n[35664] = function(t, e, i) { + t.uniform2fv(e, i) + } + , + n[35665] = function(t, e, i) { + t.uniform3fv(e, i) + } + , + n[35666] = function(t, e, i) { + t.uniform4fv(e, i) + } + , + n[35667] = function(t, e, i) { + t.uniform2iv(e, i) + } + , + n[35668] = function(t, e, i) { + t.uniform3iv(e, i) + } + , + n[35669] = function(t, e, i) { + t.uniform4iv(e, i) + } + , + n[35670] = function(t, e, i) { + t.uniform1i(e, i) + } + , + n[35671] = function(t, e, i) { + t.uniform2iv(e, i) + } + , + n[35672] = function(t, e, i) { + t.uniform3iv(e, i) + } + , + n[35673] = function(t, e, i) { + t.uniform4iv(e, i) + } + , + n[35674] = function(t, e, i) { + t.uniformMatrix2fv(e, !1, i) + } + , + n[35675] = function(t, e, i) { + t.uniformMatrix3fv(e, !1, i) + } + , + n[35676] = function(t, e, i) { + t.uniformMatrix4fv(e, !1, i) + } + , + n[35678] = function(t, e, i) { + t.uniform1i(e, i) + } + , + n[35680] = function(t, e, i) { + t.uniform1i(e, i) + } + , + n) + , _ = ((r = {})[5124] = function(t, e, i) { + t.uniform1iv(e, i) + } + , + r[5126] = function(t, e, i) { + t.uniform1fv(e, i) + } + , + r[35664] = function(t, e, i) { + t.uniform2fv(e, i) + } + , + r[35665] = function(t, e, i) { + t.uniform3fv(e, i) + } + , + r[35666] = function(t, e, i) { + t.uniform4fv(e, i) + } + , + r[35667] = function(t, e, i) { + t.uniform2iv(e, i) + } + , + r[35668] = function(t, e, i) { + t.uniform3iv(e, i) + } + , + r[35669] = function(t, e, i) { + t.uniform4iv(e, i) + } + , + r[35670] = function(t, e, i) { + t.uniform1iv(e, i) + } + , + r[35671] = function(t, e, i) { + t.uniform2iv(e, i) + } + , + r[35672] = function(t, e, i) { + t.uniform3iv(e, i) + } + , + r[35673] = function(t, e, i) { + t.uniform4iv(e, i) + } + , + r[35674] = function(t, e, i) { + t.uniformMatrix2fv(e, !1, i) + } + , + r[35675] = function(t, e, i) { + t.uniformMatrix3fv(e, !1, i) + } + , + r[35676] = function(t, e, i) { + t.uniformMatrix4fv(e, !1, i) + } + , + r[35678] = function(t, e, i) { + t.uniform1iv(e, i) + } + , + r[35680] = function(t, e, i) { + t.uniform1iv(e, i) + } + , + r); + function f(t, e, i) { + if (e.blend !== i.blend) + return i.blend ? (t.enable(t.BLEND), + i.blendSrc !== a.enums.BLEND_CONSTANT_COLOR && i.blendSrc !== a.enums.BLEND_ONE_MINUS_CONSTANT_COLOR && i.blendDst !== a.enums.BLEND_CONSTANT_COLOR && i.blendDst !== a.enums.BLEND_ONE_MINUS_CONSTANT_COLOR || t.blendColor((i.blendColor >> 24) / 255, (i.blendColor >> 16 & 255) / 255, (i.blendColor >> 8 & 255) / 255, (255 & i.blendColor) / 255), + void (i.blendSep ? (t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), + t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (t.blendFunc(i.blendSrc, i.blendDst), + t.blendEquation(i.blendEq)))) : void t.disable(t.BLEND); + !1 !== i.blend && (e.blendColor !== i.blendColor && t.blendColor((i.blendColor >> 24) / 255, (i.blendColor >> 16 & 255) / 255, (i.blendColor >> 8 & 255) / 255, (255 & i.blendColor) / 255), + e.blendSep === i.blendSep ? i.blendSep ? (e.blendSrc === i.blendSrc && e.blendDst === i.blendDst && e.blendSrcAlpha === i.blendSrcAlpha && e.blendDstAlpha === i.blendDstAlpha || t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), + e.blendEq === i.blendEq && e.blendAlphaEq === i.blendAlphaEq || t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (e.blendSrc === i.blendSrc && e.blendDst === i.blendDst || t.blendFunc(i.blendSrc, i.blendDst), + e.blendEq !== i.blendEq && t.blendEquation(i.blendEq)) : i.blendSep ? (t.blendFuncSeparate(i.blendSrc, i.blendDst, i.blendSrcAlpha, i.blendDstAlpha), + t.blendEquationSeparate(i.blendEq, i.blendAlphaEq)) : (t.blendFunc(i.blendSrc, i.blendDst), + t.blendEquation(i.blendEq))) + } + function d(t, e, i) { + if (e.depthTest !== i.depthTest) + return i.depthTest ? (t.enable(t.DEPTH_TEST), + t.depthFunc(i.depthFunc), + void t.depthMask(i.depthWrite)) : void t.disable(t.DEPTH_TEST); + e.depthWrite !== i.depthWrite && t.depthMask(i.depthWrite), + !1 !== i.depthTest ? e.depthFunc !== i.depthFunc && t.depthFunc(i.depthFunc) : i.depthWrite && (i.depthTest = !0, + i.depthFunc = a.enums.DS_FUNC_ALWAYS, + t.enable(t.DEPTH_TEST), + t.depthFunc(i.depthFunc)) + } + function p(t, e, i) { + if (i.stencilTest !== a.enums.STENCIL_INHERIT) + return i.stencilTest !== e.stencilTest ? i.stencilTest === a.enums.STENCIL_DISABLE ? void t.disable(t.STENCIL_TEST) : (t.enable(t.STENCIL_TEST), + void (i.stencilSep ? (t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), + t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), + t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), + t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), + t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), + t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), + t.stencilMask(i.stencilWriteMaskFront), + t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront)))) : void (i.stencilTest !== a.enums.STENCIL_DISABLE && (e.stencilSep === i.stencilSep ? i.stencilSep ? (e.stencilFuncFront === i.stencilFuncFront && e.stencilRefFront === i.stencilRefFront && e.stencilMaskFront === i.stencilMaskFront || t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), + e.stencilWriteMaskFront !== i.stencilWriteMaskFront && t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), + e.stencilFailOpFront === i.stencilFailOpFront && e.stencilZFailOpFront === i.stencilZFailOpFront && e.stencilZPassOpFront === i.stencilZPassOpFront || t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), + e.stencilFuncBack === i.stencilFuncBack && e.stencilRefBack === i.stencilRefBack && e.stencilMaskBack === i.stencilMaskBack || t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), + e.stencilWriteMaskBack !== i.stencilWriteMaskBack && t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), + e.stencilFailOpBack === i.stencilFailOpBack && e.stencilZFailOpBack === i.stencilZFailOpBack && e.stencilZPassOpBack === i.stencilZPassOpBack || t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (e.stencilFuncFront === i.stencilFuncFront && e.stencilRefFront === i.stencilRefFront && e.stencilMaskFront === i.stencilMaskFront || t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), + e.stencilWriteMaskFront !== i.stencilWriteMaskFront && t.stencilMask(i.stencilWriteMaskFront), + e.stencilFailOpFront === i.stencilFailOpFront && e.stencilZFailOpFront === i.stencilZFailOpFront && e.stencilZPassOpFront === i.stencilZPassOpFront || t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront)) : i.stencilSep ? (t.stencilFuncSeparate(t.FRONT, i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), + t.stencilMaskSeparate(t.FRONT, i.stencilWriteMaskFront), + t.stencilOpSeparate(t.FRONT, i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront), + t.stencilFuncSeparate(t.BACK, i.stencilFuncBack, i.stencilRefBack, i.stencilMaskBack), + t.stencilMaskSeparate(t.BACK, i.stencilWriteMaskBack), + t.stencilOpSeparate(t.BACK, i.stencilFailOpBack, i.stencilZFailOpBack, i.stencilZPassOpBack)) : (t.stencilFunc(i.stencilFuncFront, i.stencilRefFront, i.stencilMaskFront), + t.stencilMask(i.stencilWriteMaskFront), + t.stencilOp(i.stencilFailOpFront, i.stencilZFailOpFront, i.stencilZPassOpFront)))) + } + function m(t, e, i) { + e.cullMode !== i.cullMode && (i.cullMode !== a.enums.CULL_NONE ? (t.enable(t.CULL_FACE), + t.cullFace(i.cullMode)) : t.disable(t.CULL_FACE)) + } + function y(t, e, i, n) { + var r = !1; + if (-1 !== n.maxStream) { + if (i.maxStream !== n.maxStream) + r = !0; + else if (i.program !== n.program) + r = !0; + else + for (var s = 0; s < n.maxStream + 1; ++s) + if (i.vertexBuffers[s] !== n.vertexBuffers[s] || i.vertexBufferOffsets[s] !== n.vertexBufferOffsets[s]) { + r = !0; + break + } + if (r) { + for (var a = 0; a < t._caps.maxVertexAttribs; ++a) + t._newAttributes[a] = 0; + for (var o = 0; o < n.maxStream + 1; ++o) { + var l = n.vertexBuffers[o] + , h = n.vertexBufferOffsets[o]; + if (l && -1 !== l._glID) { + e.bindBuffer(e.ARRAY_BUFFER, l._glID); + for (var c = 0; c < n.program._attributes.length; ++c) { + var u = n.program._attributes[c] + , _ = l._format.element(u.name); + _ ? (0 === t._enabledAttributes[u.location] && (e.enableVertexAttribArray(u.location), + t._enabledAttributes[u.location] = 1), + t._newAttributes[u.location] = 1, + e.vertexAttribPointer(u.location, _.num, _.type, _.normalize, _.stride, _.offset + h * _.stride)) : console.warn("Can not find vertex attribute: " + u.name) + } + } + } + for (var f = 0; f < t._caps.maxVertexAttribs; ++f) + t._enabledAttributes[f] !== t._newAttributes[f] && (e.disableVertexAttribArray(f), + t._enabledAttributes[f] = 0) + } + } + } + function v(t, e, i) { + for (var n = 0; n < i.maxTextureSlot + 1; ++n) + if (e.textureUnits[n] !== i.textureUnits[n]) { + var r = i.textureUnits[n]; + r && -1 !== r._glID && (t.activeTexture(t.TEXTURE0 + n), + t.bindTexture(r._target, r._glID)) + } + } + function g(t, e, i, n) { + void 0 === n && (n = 0), + i instanceof o.default ? t.framebufferTexture2D(t.FRAMEBUFFER, e, t.TEXTURE_2D, i._glID, 0) : i instanceof l.default ? t.framebufferTexture2D(t.FRAMEBUFFER, e, t.TEXTURE_CUBE_MAP_POSITIVE_X + n, i._glID, 0) : t.framebufferRenderbuffer(t.FRAMEBUFFER, e, t.RENDERBUFFER, i._glID) + } + var A = (function() { + function t(t, e) { + var i; + void 0 === (e = e || {}).alpha && (e.alpha = !1), + void 0 === e.stencil && (e.stencil = !0), + void 0 === e.depth && (e.depth = !0), + void 0 === e.antialias && (e.antialias = !1), + void 0 === e.preserveDrawingBuffer && (e.preserveDrawingBuffer = !1); + try { + i = t.getContext("webgl", e) || t.getContext("experimental-webgl", e) || t.getContext("webkit-3d", e) || t.getContext("moz-webgl", e) + } catch (r) { + return void console.error(r) + } + i || console.error("This device does not support webgl"), + this._gl = i, + this._extensions = {}, + this._caps = {}, + this._stats = { + texture: 0, + vb: 0, + ib: 0, + drawcalls: 0 + }, + this._initExtensions(["EXT_texture_filter_anisotropic", "EXT_shader_texture_lod", "OES_standard_derivatives", "OES_texture_float", "OES_texture_float_linear", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_vertex_array_object", "WEBGL_compressed_texture_atc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_depth_texture", "WEBGL_draw_buffers"]), + this._initCaps(), + this._initStates(), + s.default.initDefault(this), + this._current = new s.default(this), + this._next = new s.default(this), + this._uniforms = {}, + this._vx = this._vy = this._vw = this._vh = 0, + this._sx = this._sy = this._sw = this._sh = 0, + this._framebuffer = null, + this._enabledAttributes = new Array(this._caps.maxVertexAttribs), + this._newAttributes = new Array(this._caps.maxVertexAttribs); + for (var n = 0; n < this._caps.maxVertexAttribs; ++n) + this._enabledAttributes[n] = 0, + this._newAttributes[n] = 0 + } + var e, i, n = t.prototype; + return n._initExtensions = function(t) { + for (var e = this._gl, i = 0; i < t.length; ++i) + for (var n = t[i], r = ["", "WEBKIT_", "MOZ_"], s = 0; s < r.length; s++) + try { + var a = e.getExtension(r[s] + n); + if (a) { + this._extensions[n] = a; + break + } + } catch (o) { + console.error(o) + } + } + , + n._initCaps = function() { + var t = this._gl + , e = this.ext("WEBGL_draw_buffers"); + this._caps.maxVertexStreams = 4, + this._caps.maxVertexTextures = t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS), + this._caps.maxFragUniforms = t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS), + this._caps.maxTextureUnits = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS), + this._caps.maxVertexAttribs = t.getParameter(t.MAX_VERTEX_ATTRIBS), + this._caps.maxTextureSize = t.getParameter(t.MAX_TEXTURE_SIZE), + this._caps.maxDrawBuffers = e ? t.getParameter(e.MAX_DRAW_BUFFERS_WEBGL) : 1, + this._caps.maxColorAttachments = e ? t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL) : 1 + } + , + n._initStates = function() { + var t = this._gl; + t.disable(t.BLEND), + t.blendFunc(t.ONE, t.ZERO), + t.blendEquation(t.FUNC_ADD), + t.blendColor(1, 1, 1, 1), + t.colorMask(!0, !0, !0, !0), + t.enable(t.CULL_FACE), + t.cullFace(t.BACK), + t.disable(t.DEPTH_TEST), + t.depthFunc(t.LESS), + t.depthMask(!1), + t.disable(t.POLYGON_OFFSET_FILL), + t.depthRange(0, 1), + t.disable(t.STENCIL_TEST), + t.stencilFunc(t.ALWAYS, 0, 255), + t.stencilMask(255), + t.stencilOp(t.KEEP, t.KEEP, t.KEEP), + t.clearDepth(1), + t.clearColor(0, 0, 0, 0), + t.clearStencil(0), + t.disable(t.SCISSOR_TEST) + } + , + n._restoreTexture = function(t) { + var e = this._gl + , i = this._current.textureUnits[t]; + i && -1 !== i._glID ? e.bindTexture(i._target, i._glID) : e.bindTexture(e.TEXTURE_2D, null) + } + , + n._restoreIndexBuffer = function() { + var t = this._gl + , e = this._current.indexBuffer; + e && -1 !== e._glID ? t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, e._glID) : t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null) + } + , + n.ext = function(t) { + return this._extensions[t] + } + , + n.allowFloatTexture = function() { + return null != this.ext("OES_texture_float") + } + , + n.setFrameBuffer = function(t) { + if (this._framebuffer !== t) { + this._framebuffer = t; + var e = this._gl; + if (t) { + e.bindFramebuffer(e.FRAMEBUFFER, t._glID); + for (var i = t._colors.length, n = 0; n < i; ++n) { + var r = t._colors[n]; + g(e, e.COLOR_ATTACHMENT0 + n, r) + } + for (var s = i; s < this._caps.maxColorAttachments; ++s) + e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + s, e.TEXTURE_2D, null, 0); + t._depth && g(e, e.DEPTH_ATTACHMENT, t._depth), + t._stencil && g(e, e.STENCIL_ATTACHMENT, t._stencil), + t._depthStencil && g(e, e.DEPTH_STENCIL_ATTACHMENT, t._depthStencil) + } else + e.bindFramebuffer(e.FRAMEBUFFER, null) + } + } + , + n.setViewport = function(t, e, i, n) { + this._vx === t && this._vy === e && this._vw === i && this._vh === n || (this._gl.viewport(t, e, i, n), + this._vx = t, + this._vy = e, + this._vw = i, + this._vh = n) + } + , + n.setScissor = function(t, e, i, n) { + this._sx === t && this._sy === e && this._sw === i && this._sh === n || (this._gl.scissor(t, e, i, n), + this._sx = t, + this._sy = e, + this._sw = i, + this._sh = n) + } + , + n.clear = function(t) { + if (void 0 !== t.color || void 0 !== t.depth || void 0 !== t.stencil) { + var e = this._gl + , i = 0; + void 0 !== t.color && (i |= e.COLOR_BUFFER_BIT, + e.clearColor(t.color[0], t.color[1], t.color[2], t.color[3])), + void 0 !== t.depth && (i |= e.DEPTH_BUFFER_BIT, + e.clearDepth(t.depth), + e.enable(e.DEPTH_TEST), + e.depthMask(!0), + e.depthFunc(e.ALWAYS)), + void 0 !== t.stencil && (i |= e.STENCIL_BUFFER_BIT, + e.clearStencil(t.stencil)), + e.clear(i), + void 0 !== t.depth && (!1 === this._current.depthTest ? e.disable(e.DEPTH_TEST) : (!1 === this._current.depthWrite && e.depthMask(!1), + this._current.depthFunc !== a.enums.DS_FUNC_ALWAYS && e.depthFunc(this._current.depthFunc))) + } + } + , + n.enableBlend = function() { + this._next.blend = !0 + } + , + n.enableDepthTest = function() { + this._next.depthTest = !0 + } + , + n.enableDepthWrite = function() { + this._next.depthWrite = !0 + } + , + n.setStencilTest = function(t) { + this._next.stencilTest = t + } + , + n.setStencilFunc = function(t, e, i) { + this._next.stencilSep = !1, + this._next.stencilFuncFront = this._next.stencilFuncBack = t, + this._next.stencilRefFront = this._next.stencilRefBack = e, + this._next.stencilMaskFront = this._next.stencilMaskBack = i + } + , + n.setStencilFuncFront = function(t, e, i) { + this._next.stencilSep = !0, + this._next.stencilFuncFront = t, + this._next.stencilRefFront = e, + this._next.stencilMaskFront = i + } + , + n.setStencilFuncBack = function(t, e, i) { + this._next.stencilSep = !0, + this._next.stencilFuncBack = t, + this._next.stencilRefBack = e, + this._next.stencilMaskBack = i + } + , + n.setStencilOp = function(t, e, i, n) { + this._next.stencilFailOpFront = this._next.stencilFailOpBack = t, + this._next.stencilZFailOpFront = this._next.stencilZFailOpBack = e, + this._next.stencilZPassOpFront = this._next.stencilZPassOpBack = i, + this._next.stencilWriteMaskFront = this._next.stencilWriteMaskBack = n + } + , + n.setStencilOpFront = function(t, e, i, n) { + this._next.stencilSep = !0, + this._next.stencilFailOpFront = t, + this._next.stencilZFailOpFront = e, + this._next.stencilZPassOpFront = i, + this._next.stencilWriteMaskFront = n + } + , + n.setStencilOpBack = function(t, e, i, n) { + this._next.stencilSep = !0, + this._next.stencilFailOpBack = t, + this._next.stencilZFailOpBack = e, + this._next.stencilZPassOpBack = i, + this._next.stencilWriteMaskBack = n + } + , + n.setDepthFunc = function(t) { + this._next.depthFunc = t + } + , + n.setBlendColor32 = function(t) { + this._next.blendColor = t + } + , + n.setBlendColor = function(t, e, i, n) { + this._next.blendColor = (255 * t << 24 | 255 * e << 16 | 255 * i << 8 | 255 * n) >>> 0 + } + , + n.setBlendFunc = function(t, e) { + this._next.blendSep = !1, + this._next.blendSrc = t, + this._next.blendDst = e + } + , + n.setBlendFuncSep = function(t, e, i, n) { + this._next.blendSep = !0, + this._next.blendSrc = t, + this._next.blendDst = e, + this._next.blendSrcAlpha = i, + this._next.blendDstAlpha = n + } + , + n.setBlendEq = function(t) { + this._next.blendSep = !1, + this._next.blendEq = t + } + , + n.setBlendEqSep = function(t, e) { + this._next.blendSep = !0, + this._next.blendEq = t, + this._next.blendAlphaEq = e + } + , + n.setCullMode = function(t) { + this._next.cullMode = t + } + , + n.setVertexBuffer = function(t, e, i) { + void 0 === i && (i = 0), + this._next.vertexBuffers[t] = e, + this._next.vertexBufferOffsets[t] = i, + this._next.maxStream < t && (this._next.maxStream = t) + } + , + n.setIndexBuffer = function(t) { + this._next.indexBuffer = t + } + , + n.setProgram = function(t) { + this._next.program = t + } + , + n.setTexture = function(t, e, i) { + i >= this._caps.maxTextureUnits ? console.warn("Can not set texture " + t + " at stage " + i + ", max texture exceed: " + this._caps.maxTextureUnits) : (this._next.textureUnits[i] = e, + this.setUniform(t, i), + this._next.maxTextureSlot < i && (this._next.maxTextureSlot = i)) + } + , + n.setTextureArray = function(t, e, i) { + var n = e.length; + if (n >= this._caps.maxTextureUnits) + console.warn("Can not set " + n + " textures for " + t + ", max texture exceed: " + this._caps.maxTextureUnits); + else { + for (var r = 0; r < n; ++r) { + var s = i[r]; + this._next.textureUnits[s] = e[r], + this._next.maxTextureSlot < s && (this._next.maxTextureSlot = s) + } + this.setUniform(t, i) + } + } + , + n.setUniform = function(t, e) { + var i = this._uniforms[t] + , n = !1 + , r = !1 + , s = !1 + , a = !1; + do { + if (!i) + break; + if (s = Array.isArray(e) || e instanceof Float32Array, + a = e instanceof Int32Array, + r = s || a, + i.isArray !== r) + break; + if (i.isArray && i.value.length !== e.length) + break; + n = !0 + } while (0);if (n) { + var o = i.value + , l = !1; + if (i.isArray) + for (var h = 0, c = o.length; h < c; h++) + o[h] !== e[h] && (l = !0, + o[h] = e[h]); + else + o !== e && (l = !0, + i.value = e); + l && (i.dirty = !0) + } else { + var u = e; + s ? u = new Float32Array(e) : a && (u = new Int32Array(e)), + i = { + dirty: !0, + value: u, + isArray: r + } + } + this._uniforms[t] = i + } + , + n.setUniformDirectly = function(t, e) { + var i = this._uniforms[t]; + i || (this._uniforms[t] = i = {}), + i.dirty = !0, + i.value = e + } + , + n.setPrimitiveType = function(t) { + this._next.primitiveType = t + } + , + n.resetDrawCalls = function() { + this._stats.drawcalls = 0 + } + , + n.getDrawCalls = function() { + return this._stats.drawcalls + } + , + n.draw = function(t, e) { + var i = this._gl + , n = this._current + , r = this._next; + f(i, n, r), + d(i, n, r), + p(i, n, r), + m(i, n, r), + y(this, i, n, r), + n.indexBuffer !== r.indexBuffer && i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, r.indexBuffer && -1 !== r.indexBuffer._glID ? r.indexBuffer._glID : null); + var s = !1; + n.program !== r.program && (r.program._linked ? i.useProgram(r.program._glID) : console.warn("Failed to use program: has not linked yet."), + s = !0), + v(i, n, r); + for (var a = 0; a < r.program._uniforms.length; ++a) { + var o = r.program._uniforms[a] + , l = this._uniforms[o.name]; + if (l && (s || l.dirty)) { + l.dirty = !1; + var h = void 0 === o.size ? u[o.type] : _[o.type]; + h ? h(i, o.location, l.value) : console.warn("Can not find commit function for uniform " + o.name) + } + } + e && (r.indexBuffer ? i.drawElements(this._next.primitiveType, e, r.indexBuffer._format, t * r.indexBuffer._bytesPerIndex) : i.drawArrays(this._next.primitiveType, t, e), + this._stats.drawcalls++), + n.set(r), + r.reset() + } + , + e = t, + (i = [{ + key: "caps", + get: function() { + return this._caps + } + }]) && c(e.prototype, i), + t + } + )(); + i.default = A, + e.exports = i.default + } + ), { + "./enums": 312, + "./state": 319, + "./texture-2d": 320, + "./texture-cube": 321 + }], + 312: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.attrTypeBytes = function(t) { + return t === s.ATTR_TYPE_INT8 ? 1 : t === s.ATTR_TYPE_UINT8 ? 1 : t === s.ATTR_TYPE_INT16 ? 2 : t === s.ATTR_TYPE_UINT16 ? 2 : t === s.ATTR_TYPE_INT32 ? 4 : t === s.ATTR_TYPE_UINT32 ? 4 : t === s.ATTR_TYPE_FLOAT32 ? 4 : (console.warn("Unknown ATTR_TYPE: " + t), + 0) + } + , + i.glFilter = function(t, e, i) { + void 0 === i && (i = -1); + var r = n[e][i + 1]; + return void 0 === r ? (console.warn("Unknown FILTER: " + e), + -1 === i ? t.LINEAR : t.LINEAR_MIPMAP_LINEAR) : r + } + , + i.glTextureFmt = function(t) { + var e = r[t]; + return void 0 === e ? (console.warn("Unknown TEXTURE_FMT: " + t), + r[s.TEXTURE_FMT_RGBA8]) : e + } + , + i.enums = void 0; + var n = [[9728, 9984, 9986], [9729, 9985, 9987]] + , r = [{ + format: 6407, + internalFormat: 33776, + pixelType: null + }, { + format: 6408, + internalFormat: 33777, + pixelType: null + }, { + format: 6408, + internalFormat: 33778, + pixelType: null + }, { + format: 6408, + internalFormat: 33779, + pixelType: null + }, { + format: 6407, + internalFormat: 36196, + pixelType: null + }, { + format: 6407, + internalFormat: 35841, + pixelType: null + }, { + format: 6408, + internalFormat: 35843, + pixelType: null + }, { + format: 6407, + internalFormat: 35840, + pixelType: null + }, { + format: 6408, + internalFormat: 35842, + pixelType: null + }, { + format: 6406, + internalFormat: 6406, + pixelType: 5121 + }, { + format: 6409, + internalFormat: 6409, + pixelType: 5121 + }, { + format: 6410, + internalFormat: 6410, + pixelType: 5121 + }, { + format: 6407, + internalFormat: 6407, + pixelType: 33635 + }, { + format: 6408, + internalFormat: 6408, + pixelType: 32820 + }, { + format: 6408, + internalFormat: 6408, + pixelType: 32819 + }, { + format: 6407, + internalFormat: 6407, + pixelType: 5121 + }, { + format: 6408, + internalFormat: 6408, + pixelType: 5121 + }, { + format: 6407, + internalFormat: 6407, + pixelType: 36193 + }, { + format: 6408, + internalFormat: 6408, + pixelType: 36193 + }, { + format: 6407, + internalFormat: 6407, + pixelType: 5126 + }, { + format: 6408, + internalFormat: 6408, + pixelType: 5126 + }, { + format: null, + internalFormat: null, + pixelType: null + }, { + format: null, + internalFormat: null, + pixelType: null + }, { + format: null, + internalFormat: null, + pixelType: null + }, { + format: null, + internalFormat: null, + pixelType: null + }, { + format: 6402, + internalFormat: 6402, + pixelType: 5123 + }, { + format: 6402, + internalFormat: 6402, + pixelType: 5125 + }, { + format: 6402, + internalFormat: 6402, + pixelType: 5125 + }, { + format: 6407, + internalFormat: 37492, + pixelType: null + }, { + format: 6408, + internalFormat: 37496, + pixelType: null + }] + , s = { + USAGE_STATIC: 35044, + USAGE_DYNAMIC: 35048, + USAGE_STREAM: 35040, + INDEX_FMT_UINT8: 5121, + INDEX_FMT_UINT16: 5123, + INDEX_FMT_UINT32: 5125, + ATTR_POSITION: "a_position", + ATTR_NORMAL: "a_normal", + ATTR_TANGENT: "a_tangent", + ATTR_BITANGENT: "a_bitangent", + ATTR_WEIGHTS: "a_weights", + ATTR_JOINTS: "a_joints", + ATTR_COLOR: "a_color", + ATTR_COLOR0: "a_color0", + ATTR_COLOR1: "a_color1", + ATTR_UV: "a_uv", + ATTR_UV0: "a_uv0", + ATTR_UV1: "a_uv1", + ATTR_UV2: "a_uv2", + ATTR_UV3: "a_uv3", + ATTR_UV4: "a_uv4", + ATTR_UV5: "a_uv5", + ATTR_UV6: "a_uv6", + ATTR_UV7: "a_uv7", + ATTR_TEX_COORD: "a_texCoord", + ATTR_TEX_COORD1: "a_texCoord1", + ATTR_TEX_COORD2: "a_texCoord2", + ATTR_TEX_COORD3: "a_texCoord3", + ATTR_TEX_COORD4: "a_texCoord4", + ATTR_TEX_COORD5: "a_texCoord5", + ATTR_TEX_COORD6: "a_texCoord6", + ATTR_TEX_COORD7: "a_texCoord7", + ATTR_TEX_COORD8: "a_texCoord8", + ATTR_TYPE_INT8: 5120, + ATTR_TYPE_UINT8: 5121, + ATTR_TYPE_INT16: 5122, + ATTR_TYPE_UINT16: 5123, + ATTR_TYPE_INT32: 5124, + ATTR_TYPE_UINT32: 5125, + ATTR_TYPE_FLOAT32: 5126, + FILTER_NEAREST: 0, + FILTER_LINEAR: 1, + WRAP_REPEAT: 10497, + WRAP_CLAMP: 33071, + WRAP_MIRROR: 33648, + TEXTURE_FMT_RGB_DXT1: 0, + TEXTURE_FMT_RGBA_DXT1: 1, + TEXTURE_FMT_RGBA_DXT3: 2, + TEXTURE_FMT_RGBA_DXT5: 3, + TEXTURE_FMT_RGB_ETC1: 4, + TEXTURE_FMT_RGB_PVRTC_2BPPV1: 5, + TEXTURE_FMT_RGBA_PVRTC_2BPPV1: 6, + TEXTURE_FMT_RGB_PVRTC_4BPPV1: 7, + TEXTURE_FMT_RGBA_PVRTC_4BPPV1: 8, + TEXTURE_FMT_A8: 9, + TEXTURE_FMT_L8: 10, + TEXTURE_FMT_L8_A8: 11, + TEXTURE_FMT_R5_G6_B5: 12, + TEXTURE_FMT_R5_G5_B5_A1: 13, + TEXTURE_FMT_R4_G4_B4_A4: 14, + TEXTURE_FMT_RGB8: 15, + TEXTURE_FMT_RGBA8: 16, + TEXTURE_FMT_RGB16F: 17, + TEXTURE_FMT_RGBA16F: 18, + TEXTURE_FMT_RGB32F: 19, + TEXTURE_FMT_RGBA32F: 20, + TEXTURE_FMT_R32F: 21, + TEXTURE_FMT_111110F: 22, + TEXTURE_FMT_SRGB: 23, + TEXTURE_FMT_SRGBA: 24, + TEXTURE_FMT_D16: 25, + TEXTURE_FMT_D32: 26, + TEXTURE_FMT_D24S8: 27, + TEXTURE_FMT_RGB_ETC2: 28, + TEXTURE_FMT_RGBA_ETC2: 29, + DS_FUNC_NEVER: 512, + DS_FUNC_LESS: 513, + DS_FUNC_EQUAL: 514, + DS_FUNC_LEQUAL: 515, + DS_FUNC_GREATER: 516, + DS_FUNC_NOTEQUAL: 517, + DS_FUNC_GEQUAL: 518, + DS_FUNC_ALWAYS: 519, + RB_FMT_RGBA4: 32854, + RB_FMT_RGB5_A1: 32855, + RB_FMT_RGB565: 36194, + RB_FMT_D16: 33189, + RB_FMT_S8: 36168, + RB_FMT_D24S8: 34041, + BLEND_FUNC_ADD: 32774, + BLEND_FUNC_SUBTRACT: 32778, + BLEND_FUNC_REVERSE_SUBTRACT: 32779, + BLEND_ZERO: 0, + BLEND_ONE: 1, + BLEND_SRC_COLOR: 768, + BLEND_ONE_MINUS_SRC_COLOR: 769, + BLEND_DST_COLOR: 774, + BLEND_ONE_MINUS_DST_COLOR: 775, + BLEND_SRC_ALPHA: 770, + BLEND_ONE_MINUS_SRC_ALPHA: 771, + BLEND_DST_ALPHA: 772, + BLEND_ONE_MINUS_DST_ALPHA: 773, + BLEND_CONSTANT_COLOR: 32769, + BLEND_ONE_MINUS_CONSTANT_COLOR: 32770, + BLEND_CONSTANT_ALPHA: 32771, + BLEND_ONE_MINUS_CONSTANT_ALPHA: 32772, + BLEND_SRC_ALPHA_SATURATE: 776, + STENCIL_DISABLE: 0, + STENCIL_ENABLE: 1, + STENCIL_INHERIT: 2, + STENCIL_OP_KEEP: 7680, + STENCIL_OP_ZERO: 0, + STENCIL_OP_REPLACE: 7681, + STENCIL_OP_INCR: 7682, + STENCIL_OP_INCR_WRAP: 34055, + STENCIL_OP_DECR: 7683, + STENCIL_OP_DECR_WRAP: 34056, + STENCIL_OP_INVERT: 5386, + CULL_NONE: 0, + CULL_FRONT: 1028, + CULL_BACK: 1029, + CULL_FRONT_AND_BACK: 1032, + PT_POINTS: 0, + PT_LINES: 1, + PT_LINE_LOOP: 2, + PT_LINE_STRIP: 3, + PT_TRIANGLES: 4, + PT_TRIANGLE_STRIP: 5, + PT_TRIANGLE_FAN: 6 + }; + i.enums = s + } + ), {}], + 313: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = (function() { + function t(t, e, i, n) { + this._device = t, + this._width = e, + this._height = i, + this._colors = n.colors || [], + this._depth = n.depth || null, + this._stencil = n.stencil || null, + this._depthStencil = n.depthStencil || null, + this._glID = t._gl.createFramebuffer() + } + var e = t.prototype; + return e.destroy = function() { + null !== this._glID ? (this._device._gl.deleteFramebuffer(this._glID), + this._glID = null) : console.error("The frame-buffer already destroyed") + } + , + e.getHandle = function() { + return this._glID + } + , + t + } + )(); + i.default = n, + e.exports = i.default + } + ), {}], + 314: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("./enums"); + function s(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var a = ((n = {})[r.enums.INDEX_FMT_UINT8] = 1, + n[r.enums.INDEX_FMT_UINT16] = 2, + n[r.enums.INDEX_FMT_UINT32] = 4, + n) + , o = (function() { + function t(t, e, i, n) { + this._device = t, + this._format = e, + this._usage = i, + this._bytesPerIndex = a[e], + this._bytes = n.byteLength, + this._numIndices = this._bytes / this._bytesPerIndex, + this._needExpandDataStore = !0, + this._glID = t._gl.createBuffer(), + this.update(0, n), + t._stats.ib += this._bytes + } + var e, i, n = t.prototype; + return n.destroy = function() { + -1 !== this._glID ? (this._device._gl.deleteBuffer(this._glID), + this._device._stats.ib -= this.bytes, + this._glID = -1) : console.error("The buffer already destroyed") + } + , + n.update = function(t, e) { + if (-1 !== this._glID) { + if (0 !== e.byteLength) { + if (t + e.byteLength > this._bytes) { + if (t) + return void console.error("Failed to update data, bytes exceed."); + this._needExpandDataStore = !0, + this._bytes = t + e.byteLength, + this._numIndices = this._bytes / this._bytesPerIndex + } + var i = this._device._gl + , n = this._usage; + i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, this._glID), + this._needExpandDataStore ? (i.bufferData(i.ELEMENT_ARRAY_BUFFER, e, n), + this._needExpandDataStore = !1) : i.bufferSubData(i.ELEMENT_ARRAY_BUFFER, t, e), + this._device._restoreIndexBuffer() + } + } else + console.error("The buffer is destroyed") + } + , + n.setUsage = function(t) { + this._usage = t + } + , + e = t, + (i = [{ + key: "count", + get: function() { + return this._numIndices + } + }]) && s(e.prototype, i), + t + } + )(); + o.BYTES_PER_INDEX = a; + var l = o; + i.default = l, + e.exports = i.default + } + ), { + "./enums": 312 + }], + 315: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("./enums"); + n = { + VertexFormat: t("./vertex-format"), + IndexBuffer: t("./index-buffer"), + VertexBuffer: t("./vertex-buffer"), + Program: t("./program"), + Texture: t("./texture"), + Texture2D: t("./texture-2d"), + TextureCube: t("./texture-cube"), + RenderBuffer: t("./render-buffer"), + FrameBuffer: t("./frame-buffer"), + Device: t("./device"), + attrTypeBytes: r.attrTypeBytes, + glFilter: r.glFilter, + glTextureFmt: r.glTextureFmt + }, + Object.assign(n, r.enums); + var s = n; + i.default = s, + cc.gfx = n, + e.exports = i.default + } + ), { + "./device": 311, + "./enums": 312, + "./frame-buffer": 313, + "./index-buffer": 314, + "./program": 317, + "./render-buffer": 318, + "./texture": 322, + "./texture-2d": 320, + "./texture-cube": 321, + "./vertex-buffer": 323, + "./vertex-format": 324 + }], + 316: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.isPow2 = function(t) { + return !(t & t - 1 || !t) + } + } + ), {}], + 317: [(function(t, e, i) { + "use strict"; + function n(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + i.__esModule = !0, + i.default = void 0; + var r = 0; + function s(t, e, i) { + i && i.split("\n").forEach((function(i) { + if (!(i.length < 5)) { + var n = /^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(i); + n ? t.push({ + type: e, + fileID: 0 | n[1], + line: 0 | n[2], + message: n[3].trim() + }) : i.length > 0 && t.push({ + type: e, + fileID: -1, + line: 0, + message: i + }) + } + } + )) + } + var a = (function() { + function t(t, e) { + this._device = t, + this._attributes = [], + this._uniforms = [], + this._samplers = [], + this._errors = [], + this._linked = !1, + this._vertSource = e.vert, + this._fragSource = e.frag, + this._glID = null, + this._id = r++ + } + var e, i, a = t.prototype; + return a.link = function() { + if (!this._linked) { + var t = this._device._gl + , e = o(t, t.VERTEX_SHADER, this._vertSource) + , i = o(t, t.FRAGMENT_SHADER, this._fragSource) + , n = t.createProgram(); + t.attachShader(n, e), + t.attachShader(n, i), + t.linkProgram(n); + var r = !1 + , a = this._errors; + if (t.getShaderParameter(e, t.COMPILE_STATUS) || (s(a, "vs", t.getShaderInfoLog(e)), + r = !0), + t.getShaderParameter(i, t.COMPILE_STATUS) || (s(a, "fs", t.getShaderInfoLog(i)), + r = !0), + t.deleteShader(e), + t.deleteShader(i), + r) + return a; + if (!t.getProgramParameter(n, t.LINK_STATUS)) + return a.push({ + info: "Failed to link shader program: " + t.getProgramInfoLog(n) + }), + a; + this._glID = n; + for (var l = t.getProgramParameter(n, t.ACTIVE_ATTRIBUTES), h = 0; h < l; ++h) { + var c = t.getActiveAttrib(n, h) + , u = t.getAttribLocation(n, c.name); + this._attributes.push({ + name: c.name, + location: u, + type: c.type + }) + } + for (var _ = t.getProgramParameter(n, t.ACTIVE_UNIFORMS), f = 0; f < _; ++f) { + var d = t.getActiveUniform(n, f) + , p = d.name + , m = t.getUniformLocation(n, p) + , y = "[0]" === p.substr(p.length - 3); + y && (p = p.substr(0, p.length - 3)); + var v = { + name: p, + location: m, + type: d.type, + size: y ? d.size : void 0 + }; + this._uniforms.push(v) + } + this._linked = !0 + } + } + , + a.destroy = function() { + this._device._gl.deleteProgram(this._glID), + this._linked = !1, + this._glID = null, + this._attributes = [], + this._uniforms = [], + this._samplers = [] + } + , + e = t, + (i = [{ + key: "id", + get: function() { + return this._id + } + }]) && n(e.prototype, i), + t + } + )(); + function o(t, e, i) { + var n = t.createShader(e); + return t.shaderSource(n, i), + t.compileShader(n), + n + } + i.default = a, + e.exports = i.default + } + ), {}], + 318: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = (function() { + function t(t, e, i, n) { + this._device = t, + this._format = e, + this._glID = t._gl.createRenderbuffer(), + this.update(i, n) + } + var e = t.prototype; + return e.update = function(t, e) { + this._width = t, + this._height = e; + var i = this._device._gl; + i.bindRenderbuffer(i.RENDERBUFFER, this._glID), + i.renderbufferStorage(i.RENDERBUFFER, this._format, t, e), + i.bindRenderbuffer(i.RENDERBUFFER, null) + } + , + e.destroy = function() { + if (null !== this._glID) { + var t = this._device._gl; + t.bindRenderbuffer(t.RENDERBUFFER, null), + t.deleteRenderbuffer(this._glID), + this._glID = null + } else + console.error("The render-buffer already destroyed") + } + , + t + } + )(); + i.default = n, + e.exports = i.default + } + ), {}], + 319: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("./enums") + , r = { + blend: !1, + blendSep: !1, + blendColor: 4294967295, + blendEq: n.enums.BLEND_FUNC_ADD, + blendAlphaEq: n.enums.BLEND_FUNC_ADD, + blendSrc: n.enums.BLEND_ONE, + blendDst: n.enums.BLEND_ZERO, + blendSrcAlpha: n.enums.BLEND_ONE, + blendDstAlpha: n.enums.BLEND_ZERO, + depthTest: !1, + depthWrite: !1, + depthFunc: n.enums.DS_FUNC_LESS, + stencilTest: !1, + stencilSep: !1, + stencilFuncFront: n.enums.DS_FUNC_ALWAYS, + stencilRefFront: 0, + stencilMaskFront: 255, + stencilFailOpFront: n.enums.STENCIL_OP_KEEP, + stencilZFailOpFront: n.enums.STENCIL_OP_KEEP, + stencilZPassOpFront: n.enums.STENCIL_OP_KEEP, + stencilWriteMaskFront: 255, + stencilFuncBack: n.enums.DS_FUNC_ALWAYS, + stencilRefBack: 0, + stencilMaskBack: 255, + stencilFailOpBack: n.enums.STENCIL_OP_KEEP, + stencilZFailOpBack: n.enums.STENCIL_OP_KEEP, + stencilZPassOpBack: n.enums.STENCIL_OP_KEEP, + stencilWriteMaskBack: 255, + cullMode: n.enums.CULL_BACK, + primitiveType: n.enums.PT_TRIANGLES, + maxStream: -1, + vertexBuffers: [], + vertexBufferOffsets: [], + indexBuffer: null, + maxTextureSlot: -1, + textureUnits: [], + program: null + } + , s = (function() { + function t(t) { + this.vertexBuffers = new Array(t._caps.maxVertexStreams), + this.vertexBufferOffsets = new Array(t._caps.maxVertexStreams), + this.textureUnits = new Array(t._caps.maxTextureUnits), + this.set(r) + } + t.initDefault = function(t) { + r.vertexBuffers = new Array(t._caps.maxVertexStreams), + r.vertexBufferOffsets = new Array(t._caps.maxVertexStreams), + r.textureUnits = new Array(t._caps.maxTextureUnits) + } + ; + var e = t.prototype; + return e.reset = function() { + this.set(r) + } + , + e.set = function(t) { + this.blend = t.blend, + this.blendSep = t.blendSep, + this.blendColor = t.blendColor, + this.blendEq = t.blendEq, + this.blendAlphaEq = t.blendAlphaEq, + this.blendSrc = t.blendSrc, + this.blendDst = t.blendDst, + this.blendSrcAlpha = t.blendSrcAlpha, + this.blendDstAlpha = t.blendDstAlpha, + this.depthTest = t.depthTest, + this.depthWrite = t.depthWrite, + this.depthFunc = t.depthFunc, + this.stencilTest = t.stencilTest, + this.stencilSep = t.stencilSep, + this.stencilFuncFront = t.stencilFuncFront, + this.stencilRefFront = t.stencilRefFront, + this.stencilMaskFront = t.stencilMaskFront, + this.stencilFailOpFront = t.stencilFailOpFront, + this.stencilZFailOpFront = t.stencilZFailOpFront, + this.stencilZPassOpFront = t.stencilZPassOpFront, + this.stencilWriteMaskFront = t.stencilWriteMaskFront, + this.stencilFuncBack = t.stencilFuncBack, + this.stencilRefBack = t.stencilRefBack, + this.stencilMaskBack = t.stencilMaskBack, + this.stencilFailOpBack = t.stencilFailOpBack, + this.stencilZFailOpBack = t.stencilZFailOpBack, + this.stencilZPassOpBack = t.stencilZPassOpBack, + this.stencilWriteMaskBack = t.stencilWriteMaskBack, + this.cullMode = t.cullMode, + this.primitiveType = t.primitiveType, + this.maxStream = t.maxStream; + for (var e = 0; e < t.vertexBuffers.length; ++e) + this.vertexBuffers[e] = t.vertexBuffers[e]; + for (var i = 0; i < t.vertexBufferOffsets.length; ++i) + this.vertexBufferOffsets[i] = t.vertexBufferOffsets[i]; + this.indexBuffer = t.indexBuffer, + this.maxTextureSlot = t.maxTextureSlot; + for (var n = 0; n < t.textureUnits.length; ++n) + this.textureUnits[n] = t.textureUnits[n]; + this.program = t.program + } + , + t + } + )(); + i.default = s, + e.exports = i.default + } + ), { + "./enums": 312 + }], + 320: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("./texture")) && n.__esModule ? n : { + default: n + }, s = t("./enums"), a = t("./misc"); + function o(t, e) { + return (o = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var l = (function(t) { + var e, i; + function n(e, i) { + var n, r = (n = t.call(this, e) || this)._device._gl; + return n._target = r.TEXTURE_2D, + n._glID = r.createTexture(), + i.images = i.images || [null], + n.update(i), + n + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + o(e, i); + var r = n.prototype; + return r.update = function(t) { + var e = this._device._gl + , i = this._genMipmap; + if (t) { + void 0 !== t.width && (this._width = t.width), + void 0 !== t.height && (this._height = t.height), + void 0 !== t.anisotropy && (this._anisotropy = t.anisotropy), + void 0 !== t.minFilter && (this._minFilter = t.minFilter), + void 0 !== t.magFilter && (this._magFilter = t.magFilter), + void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter), + void 0 !== t.wrapS && (this._wrapS = t.wrapS), + void 0 !== t.wrapT && (this._wrapT = t.wrapT), + void 0 !== t.format && (this._format = t.format, + this._compressed = this._format >= s.enums.TEXTURE_FMT_RGB_DXT1 && this._format <= s.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1 || this._format >= s.enums.TEXTURE_FMT_RGB_ETC2 && this._format <= s.enums.TEXTURE_FMT_RGBA_ETC2), + void 0 !== t.genMipmaps && (this._genMipmap = t.genMipmaps, + i = t.genMipmaps); + var n = this._device.caps.maxTextureSize || Number.MAX_VALUE + , r = Math.max(t.width || 0, t.height || 0); + n < r && console.warn("The current texture size " + r + " exceeds the maximum size [" + n + "] supported on the device."), + void 0 !== t.images && t.images.length > 1 && (i = !1, + (t.width > t.height ? t.width : t.height) >> t.images.length - 1 != 1 && console.error("texture-2d mipmap is invalid, should have a 1x1 mipmap.")) + } + (0, + a.isPow2)(this._width) && (0, + a.isPow2)(this._height) || (i = !1), + e.activeTexture(e.TEXTURE0), + e.bindTexture(e.TEXTURE_2D, this._glID), + void 0 !== t.images && t.images.length > 0 && (this._setMipmap(t.images, t.flipY, t.premultiplyAlpha), + t.images.length > 1 && (this._genMipmap = !0)), + i && (e.hint(e.GENERATE_MIPMAP_HINT, e.NICEST), + e.generateMipmap(e.TEXTURE_2D), + this._genMipmap = !0), + this._setTexInfo(), + this._device._restoreTexture(0) + } + , + r.updateSubImage = function(t) { + var e = this._device._gl + , i = (0, + s.glTextureFmt)(this._format); + e.activeTexture(e.TEXTURE0), + e.bindTexture(e.TEXTURE_2D, this._glID), + this._setSubImage(i, t), + this._device._restoreTexture(0) + } + , + r.updateImage = function(t) { + var e = this._device._gl + , i = (0, + s.glTextureFmt)(this._format); + e.activeTexture(e.TEXTURE0), + e.bindTexture(e.TEXTURE_2D, this._glID), + this._setImage(i, t), + this._device._restoreTexture(0) + } + , + r._setSubImage = function(t, e) { + var i = this._device._gl + , n = e.flipY + , r = e.premultiplyAlpha + , s = e.image; + !s || ArrayBuffer.isView(s) || s instanceof ArrayBuffer ? (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), + void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), + this._compressed ? i.compressedTexSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, e.width, e.height, t.format, s) : i.texSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, e.width, e.height, t.format, t.pixelType, s)) : (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !0) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), + void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), + i.texSubImage2D(i.TEXTURE_2D, e.level, e.x, e.y, t.format, t.pixelType, s)) + } + , + r._setImage = function(t, e) { + var i = this._device._gl + , n = e.flipY + , r = e.premultiplyAlpha + , s = e.image; + !s || ArrayBuffer.isView(s) || s instanceof ArrayBuffer ? (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), + void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), + this._compressed ? i.compressedTexImage2D(i.TEXTURE_2D, e.level, t.internalFormat, e.width, e.height, 0, s) : i.texImage2D(i.TEXTURE_2D, e.level, t.internalFormat, e.width, e.height, 0, t.format, t.pixelType, s)) : (void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !0) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), + void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), + i.texImage2D(i.TEXTURE_2D, e.level, t.internalFormat, t.format, t.pixelType, s)) + } + , + r._setMipmap = function(t, e, i) { + for (var n = (0, + s.glTextureFmt)(this._format), r = { + width: this._width, + height: this._height, + flipY: e, + premultiplyAlpha: i, + level: 0, + image: null + }, a = 0; a < t.length; ++a) + r.level = a, + r.width = this._width >> a, + r.height = this._height >> a, + r.image = t[a], + this._setImage(n, r) + } + , + r._setTexInfo = function() { + var t = this._device._gl + , e = (0, + a.isPow2)(this._width) && (0, + a.isPow2)(this._height); + e || this._wrapS === s.enums.WRAP_CLAMP && this._wrapT === s.enums.WRAP_CLAMP || (console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"), + this._wrapS = s.enums.WRAP_CLAMP, + this._wrapT = s.enums.WRAP_CLAMP); + var i = this._genMipmap ? this._mipFilter : -1; + e || -1 === i || (console.warn("NPOT textures do not support mipmap filter"), + i = -1), + t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, (0, + s.glFilter)(t, this._minFilter, i)), + t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, (0, + s.glFilter)(t, this._magFilter, -1)), + t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, this._wrapS), + t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, this._wrapT); + var n = this._device.ext("EXT_texture_filter_anisotropic"); + n && t.texParameteri(t.TEXTURE_2D, n.TEXTURE_MAX_ANISOTROPY_EXT, this._anisotropy) + } + , + n + } + )(r.default); + i.default = l, + e.exports = i.default + } + ), { + "./enums": 312, + "./misc": 316, + "./texture": 322 + }], + 321: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("./texture")) && n.__esModule ? n : { + default: n + }, s = t("./enums"), a = t("./misc"); + function o(t, e) { + return (o = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var l = (function(t) { + var e, i; + function n(e, i) { + var n, r = (n = t.call(this, e) || this)._device._gl; + return n._target = r.TEXTURE_CUBE_MAP, + n._glID = r.createTexture(), + n.update(i), + n + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + o(e, i); + var r = n.prototype; + return r.update = function(t) { + var e = this._device._gl + , i = this._genMipmaps; + t && (void 0 !== t.width && (this._width = t.width), + void 0 !== t.height && (this._height = t.height), + void 0 !== t.anisotropy && (this._anisotropy = t.anisotropy), + void 0 !== t.minFilter && (this._minFilter = t.minFilter), + void 0 !== t.magFilter && (this._magFilter = t.magFilter), + void 0 !== t.mipFilter && (this._mipFilter = t.mipFilter), + void 0 !== t.wrapS && (this._wrapS = t.wrapS), + void 0 !== t.wrapT && (this._wrapT = t.wrapT), + void 0 !== t.format && (this._format = t.format, + this._compressed = this._format >= s.enums.TEXTURE_FMT_RGB_DXT1 && this._format <= s.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1 || this._format >= s.enums.TEXTURE_FMT_RGB_ETC2 && this._format <= s.enums.TEXTURE_FMT_RGBA_ETC2), + void 0 !== t.genMipmaps && (this._genMipmaps = t.genMipmaps, + i = t.genMipmaps), + void 0 !== t.images && t.images.length > 1 && (i = !1, + t.width !== t.height && console.warn("texture-cube width and height should be identical."), + t.width >> t.images.length - 1 != 1 && console.error("texture-cube mipmap is invalid. please set mipmap as 1x1, 2x2, 4x4 ... nxn"))), + (0, + a.isPow2)(this._width) && (0, + a.isPow2)(this._height) || (i = !1), + e.activeTexture(e.TEXTURE0), + e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), + void 0 !== t.images && t.images.length > 0 && (this._setMipmap(t.images, t.flipY, t.premultiplyAlpha), + t.images.length > 1 && (this._genMipmaps = !0)), + i && (e.hint(e.GENERATE_MIPMAP_HINT, e.NICEST), + e.generateMipmap(e.TEXTURE_CUBE_MAP), + this._genMipmaps = !0), + this._setTexInfo(), + this._device._restoreTexture(0) + } + , + r.updateSubImage = function(t) { + var e = this._device._gl + , i = (0, + s.glTextureFmt)(this._format); + e.activeTexture(e.TEXTURE0), + e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), + this._setSubImage(i, t), + this._device._restoreTexture(0) + } + , + r.updateImage = function(t) { + var e = this._device._gl + , i = (0, + s.glTextureFmt)(this._format); + e.activeTexture(e.TEXTURE0), + e.bindTexture(e.TEXTURE_CUBE_MAP, this._glID), + this._setImage(i, t), + this._device._restoreTexture(0) + } + , + r._setSubImage = function(t, e) { + var i = this._device._gl + , n = e.flipY + , r = e.premultiplyAlpha + , s = e.faceIndex + , a = e.image; + void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), + void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), + !a || ArrayBuffer.isView(a) || a instanceof ArrayBuffer ? this._compressed ? i.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, e.width, e.height, t.format, a) : i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, e.width, e.height, t.format, t.pixelType, a) : i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, e.x, e.y, t.format, t.pixelType, a) + } + , + r._setImage = function(t, e) { + var i = this._device._gl + , n = e.flipY + , r = e.premultiplyAlpha + , s = e.faceIndex + , a = e.image; + void 0 === n ? i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, !1) : i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, n), + void 0 === r ? i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1) : i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r), + !a || ArrayBuffer.isView(a) || a instanceof ArrayBuffer ? this._compressed ? i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, e.width, e.height, 0, a) : i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, e.width, e.height, 0, t.format, t.pixelType, a) : i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + s, e.level, t.internalFormat, t.format, t.pixelType, a) + } + , + r._setMipmap = function(t, e, i) { + for (var n = (0, + s.glTextureFmt)(this._format), r = { + width: this._width, + height: this._height, + faceIndex: 0, + flipY: e, + premultiplyAlpha: i, + level: 0, + image: null + }, a = 0; a < t.length; ++a) { + var o = t[a]; + r.level = a, + r.width = this._width >> a, + r.height = this._height >> a; + for (var l = 0; l < 6; ++l) + r.faceIndex = l, + r.image = o[l], + this._setImage(n, r) + } + } + , + r._setTexInfo = function() { + var t = this._device._gl + , e = (0, + a.isPow2)(this._width) && (0, + a.isPow2)(this._height); + e || this._wrapS === s.enums.WRAP_CLAMP && this._wrapT === s.enums.WRAP_CLAMP || (console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"), + this._wrapS = s.enums.WRAP_CLAMP, + this._wrapT = s.enums.WRAP_CLAMP); + var i = this._genMipmaps ? this._mipFilter : -1; + e || -1 === i || (console.warn("NPOT textures do not support mipmap filter"), + i = -1), + t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MIN_FILTER, (0, + s.glFilter)(t, this._minFilter, i)), + t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MAG_FILTER, (0, + s.glFilter)(t, this._magFilter, -1)), + t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_S, this._wrapS), + t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_WRAP_T, this._wrapT); + var n = this._device.ext("EXT_texture_filter_anisotropic"); + n && t.texParameteri(t.TEXTURE_CUBE_MAP, n.TEXTURE_MAX_ANISOTROPY_EXT, this._anisotropy) + } + , + n + } + )(r.default); + i.default = l, + e.exports = i.default + } + ), { + "./enums": 312, + "./misc": 316, + "./texture": 322 + }], + 322: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("./enums") + , r = 0 + , s = (function() { + function t(t) { + this._device = t, + this._width = 4, + this._height = 4, + this._genMipmaps = !1, + this._compressed = !1, + this._anisotropy = 1, + this._minFilter = n.enums.FILTER_LINEAR, + this._magFilter = n.enums.FILTER_LINEAR, + this._mipFilter = n.enums.FILTER_LINEAR, + this._wrapS = n.enums.WRAP_REPEAT, + this._wrapT = n.enums.WRAP_REPEAT, + this._format = n.enums.TEXTURE_FMT_RGBA8, + this._target = -1, + this._id = r++ + } + return t.prototype.destroy = function() { + null !== this._glID ? (this._device._gl.deleteTexture(this._glID), + this._device._stats.tex -= this.bytes, + this._glID = null) : console.error("The texture already destroyed") + } + , + t + } + )(); + i.default = s, + e.exports = i.default + } + ), { + "./enums": 312 + }], + 323: [(function(t, e, i) { + "use strict"; + function n(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + i.__esModule = !0, + i.default = void 0, + t("./enums"); + var r = (function() { + function t(t, e, i, n) { + this._device = t, + this._format = e, + this._usage = i, + this._bytesPerVertex = this._format._bytes, + this._bytes = n.byteLength, + this._numVertices = this._bytes / this._bytesPerVertex, + this._needExpandDataStore = !0, + this._glID = t._gl.createBuffer(), + this.update(0, n), + t._stats.vb += this._bytes + } + var e, i, r = t.prototype; + return r.destroy = function() { + -1 !== this._glID ? (this._device._gl.deleteBuffer(this._glID), + this._device._stats.vb -= this.bytes, + this._glID = -1) : console.error("The buffer already destroyed") + } + , + r.update = function(t, e) { + if (-1 !== this._glID) { + if (0 !== e.byteLength) { + if (t + e.byteLength > this._bytes) { + if (t) + return void console.error("Failed to update data, bytes exceed."); + this._needExpandDataStore = !0, + this._bytes = t + e.byteLength, + this._numVertices = this._bytes / this._bytesPerVertex + } + var i = this._device._gl + , n = this._usage; + i.bindBuffer(i.ARRAY_BUFFER, this._glID), + this._needExpandDataStore ? (i.bufferData(i.ARRAY_BUFFER, e, n), + this._needExpandDataStore = !1) : i.bufferSubData(i.ARRAY_BUFFER, t, e), + i.bindBuffer(i.ARRAY_BUFFER, null) + } + } else + console.error("The buffer is destroyed") + } + , + r.getFormat = function(t) { + return this._format.element(t) + } + , + r.setUsage = function(t) { + this._usage = t + } + , + e = t, + (i = [{ + key: "count", + get: function() { + return this._numVertices + } + }]) && n(e.prototype, i), + t + } + )(); + i.default = r, + e.exports = i.default + } + ), { + "./enums": 312 + }], + 324: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("./enums"), s = (n = t("../murmurhash2_gc")) && n.__esModule ? n : { + default: n + }, a = (function() { + function t(t) { + this._attr2el = {}, + this._elements = [], + this._bytes = 0; + for (var e = "", i = 0, n = t.length; i < n; ++i) { + var a = t[i] + , o = { + name: a.name, + offset: this._bytes, + stride: 0, + stream: -1, + type: a.type, + num: a.num, + normalize: void 0 !== a.normalize && a.normalize, + bytes: a.num * (0, + r.attrTypeBytes)(a.type) + }; + this._attr2el[o.name] = o, + this._elements.push(o), + this._bytes += o.bytes, + e += o.name + ":" + o.num + ":" + o.type + ":" + o.normalize + } + for (var l = 0, h = this._elements.length; l < h; ++l) + this._elements[l].stride = this._bytes; + this._hash = (0, + s.default)(e, 666) + } + var e = t.prototype; + return e.element = function(t) { + return this._attr2el[t] + } + , + e.getHash = function() { + return this._hash + } + , + t + } + )(); + i.default = a, + e.exports = i.default + } + ), { + "../murmurhash2_gc": 333, + "./enums": 312 + }], + 325: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = (function() { + function t(t, e) { + this._cursor = 0, + this._data = new Array(e); + for (var i = 0; i < e; ++i) + this._data[i] = t() + } + return t.prototype.request = function() { + var t = this._data[this._cursor]; + return this._cursor = (this._cursor + 1) % this._data.length, + t + } + , + t + } + )(); + i.default = n, + e.exports = i.default + } + ), {}], + 326: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("./timsort")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var a = (function() { + function t(t) { + this._count = 0, + this._data = new Array(t) + } + var e, i, n = t.prototype; + return n._resize = function(t) { + if (t > this._data.length) + for (var e = this._data.length; e < t; ++e) + this._data[e] = void 0 + } + , + n.reset = function() { + for (var t = 0; t < this._count; ++t) + this._data[t] = void 0; + this._count = 0 + } + , + n.push = function(t) { + this._count >= this._data.length && this._resize(2 * this._data.length), + this._data[this._count] = t, + ++this._count + } + , + n.pop = function() { + --this._count, + this._count < 0 && (this._count = 0); + var t = this._data[this._count]; + return this._data[this._count] = void 0, + t + } + , + n.fastRemove = function(t) { + if (!(t >= this._count || t < 0)) { + var e = this._count - 1; + this._data[t] = this._data[e], + this._data[e] = void 0, + this._count -= 1 + } + } + , + n.indexOf = function(t) { + return this._data.indexOf(t) + } + , + n.sort = function(t) { + return (0, + r.default)(this._data, 0, this._count, t) + } + , + e = t, + (i = [{ + key: "length", + get: function() { + return this._count + } + }, { + key: "data", + get: function() { + return this._data + } + }]) && s(e.prototype, i), + t + } + )(); + i.default = a, + e.exports = i.default + } + ), { + "./timsort": 331 + }], + 327: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.TypedArrayPool = i.RecyclePool = i.Pool = i.LinkedArray = i.FixedArray = i.CircularPool = void 0; + var n = h(t("./circular-pool")); + i.CircularPool = n.default; + var r = h(t("./fixed-array")); + i.FixedArray = r.default; + var s = h(t("./linked-array")); + i.LinkedArray = s.default; + var a = h(t("./pool")); + i.Pool = a.default; + var o = h(t("./recycle-pool")); + i.RecyclePool = o.default; + var l = h(t("./typed-array-pool")); + function h(t) { + return t && t.__esModule ? t : { + default: t + } + } + i.TypedArrayPool = l.default + } + ), { + "./circular-pool": 325, + "./fixed-array": 326, + "./linked-array": 328, + "./pool": 329, + "./recycle-pool": 330, + "./typed-array-pool": 332 + }], + 328: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("./pool")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var a = (function() { + function t(t, e) { + this._fn = t, + this._count = 0, + this._head = null, + this._tail = null, + this._pool = new r.default(t,e) + } + var e, i, n = t.prototype; + return n.add = function() { + var t = this._pool.alloc(); + return this._tail ? (this._tail._next = t, + t._prev = this._tail) : this._head = t, + this._tail = t, + this._count += 1, + t + } + , + n.remove = function(t) { + t._prev ? t._prev._next = t._next : this._head = t._next, + t._next ? t._next._prev = t._prev : this._tail = t._prev, + t._next = null, + t._prev = null, + this._pool.free(t), + this._count -= 1 + } + , + n.forEach = function(t, e) { + var i = this._head; + if (i) { + e && (t = t.bind(e)); + for (var n = 0, r = i; i; ) + r = i._next, + t(i, n, this), + i = r, + ++n + } + } + , + e = t, + (i = [{ + key: "head", + get: function() { + return this._head + } + }, { + key: "tail", + get: function() { + return this._tail + } + }, { + key: "length", + get: function() { + return this._count + } + }]) && s(e.prototype, i), + t + } + )(); + i.default = a, + e.exports = i.default + } + ), { + "./pool": 329 + }], + 329: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = (function() { + function t(t, e) { + this._fn = t, + this._idx = e - 1, + this._frees = new Array(e); + for (var i = 0; i < e; ++i) + this._frees[i] = t() + } + var e = t.prototype; + return e._expand = function(t) { + var e = this._frees; + this._frees = new Array(t); + for (var i = t - e.length, n = 0; n < i; ++n) + this._frees[n] = this._fn(); + for (var r = i, s = 0; r < t; ++r, + ++s) + this._frees[r] = e[s]; + this._idx += i + } + , + e.alloc = function() { + this._idx < 0 && this._expand(Math.round(1.2 * this._frees.length) + 1); + var t = this._frees[this._idx]; + return this._frees[this._idx] = null, + --this._idx, + t + } + , + e.free = function(t) { + ++this._idx, + this._frees[this._idx] = t + } + , + e.clear = function(t) { + for (var e = 0; e <= this._idx; e++) + t && t(this._frees[e]); + this._frees.length = 0, + this._idx = -1 + } + , + t + } + )(); + i.default = n, + e.exports = i.default + } + ), {}], + 330: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("./timsort")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var a = (function() { + function t(t, e) { + this._fn = t, + this._count = 0, + this._data = new Array(e); + for (var i = 0; i < e; ++i) + this._data[i] = t() + } + var e, i, n = t.prototype; + return n.reset = function() { + this._count = 0 + } + , + n.resize = function(t) { + if (t > this._data.length) + for (var e = this._data.length; e < t; ++e) + this._data[e] = this._fn() + } + , + n.add = function() { + return this._count >= this._data.length && this.resize(2 * this._data.length), + this._data[this._count++] + } + , + n.remove = function(t) { + if (!(t >= this._count)) { + var e = this._count - 1 + , i = this._data[t]; + this._data[t] = this._data[e], + this._data[e] = i, + this._count -= 1 + } + } + , + n.sort = function(t) { + return (0, + r.default)(this._data, 0, this._count, t) + } + , + e = t, + (i = [{ + key: "length", + get: function() { + return this._count + } + }, { + key: "data", + get: function() { + return this._data + } + }]) && s(e.prototype, i), + t + } + )(); + i.default = a, + cc.RecyclePool = a, + e.exports = i.default + } + ), { + "./timsort": 331 + }], + 331: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = function(t, e, i, r) { + if (!Array.isArray(t)) + throw new TypeError("Can only sort arrays"); + void 0 === e && (e = 0), + void 0 === i && (i = t.length), + void 0 === r && (r = l); + var s = i - e; + if (!(s < 2)) { + var a = 0; + if (s < n) + return void _(t, e, i, e + (a = c(t, e, i, r)), r); + var o = new p(t,r) + , u = h(s); + do { + if ((a = c(t, e, i, r)) < u) { + var f = s; + f > u && (f = u), + _(t, e, e + f, e + a, r), + a = f + } + o.pushRun(e, a), + o.mergeRuns(), + s -= a, + e += a + } while (0 !== s);o.forceMergeRuns() + } + } + ; + var n = 32 + , r = 7 + , s = 256 + , a = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9]; + function o(t) { + return t < 1e5 ? t < 100 ? t < 10 ? 0 : 1 : t < 1e4 ? t < 1e3 ? 2 : 3 : 4 : t < 1e7 ? t < 1e6 ? 5 : 6 : t < 1e9 ? t < 1e8 ? 7 : 8 : 9 + } + function l(t, e) { + if (t === e) + return 0; + if (~~t === t && ~~e === e) { + if (0 === t || 0 === e) + return t < e ? -1 : 1; + if (t < 0 || e < 0) { + if (e >= 0) + return -1; + if (t >= 0) + return 1; + t = -t, + e = -e + } + var i = o(t) + , n = o(e) + , r = 0; + return i < n ? (t *= a[n - i - 1], + e /= 10, + r = -1) : i > n && (e *= a[i - n - 1], + t /= 10, + r = 1), + t === e ? r : t < e ? -1 : 1 + } + var s = String(t) + , l = String(e); + return s === l ? 0 : s < l ? -1 : 1 + } + function h(t) { + for (var e = 0; t >= n; ) + e |= 1 & t, + t >>= 1; + return t + e + } + function c(t, e, i, n) { + var r = e + 1; + if (r === i) + return 1; + if (n(t[r++], t[e]) < 0) { + for (; r < i && n(t[r], t[r - 1]) < 0; ) + r++; + u(t, e, r) + } else + for (; r < i && n(t[r], t[r - 1]) >= 0; ) + r++; + return r - e + } + function u(t, e, i) { + for (i--; e < i; ) { + var n = t[e]; + t[e++] = t[i], + t[i--] = n + } + } + function _(t, e, i, n, r) { + for (n === e && n++; n < i; n++) { + for (var s = t[n], a = e, o = n; a < o; ) { + var l = a + o >>> 1; + r(s, t[l]) < 0 ? o = l : a = l + 1 + } + var h = n - a; + switch (h) { + case 3: + t[a + 3] = t[a + 2]; + case 2: + t[a + 2] = t[a + 1]; + case 1: + t[a + 1] = t[a]; + break; + default: + for (; h > 0; ) + t[a + h] = t[a + h - 1], + h-- + } + t[a] = s + } + } + function f(t, e, i, n, r, s) { + var a = 0 + , o = 0 + , l = 1; + if (s(t, e[i + r]) > 0) { + for (o = n - r; l < o && s(t, e[i + r + l]) > 0; ) + a = l, + (l = 1 + (l << 1)) <= 0 && (l = o); + l > o && (l = o), + a += r, + l += r + } else { + for (o = r + 1; l < o && s(t, e[i + r - l]) <= 0; ) + a = l, + (l = 1 + (l << 1)) <= 0 && (l = o); + l > o && (l = o); + var h = a; + a = r - l, + l = r - h + } + for (a++; a < l; ) { + var c = a + (l - a >>> 1); + s(t, e[i + c]) > 0 ? a = c + 1 : l = c + } + return l + } + function d(t, e, i, n, r, s) { + var a = 0 + , o = 0 + , l = 1; + if (s(t, e[i + r]) < 0) { + for (o = r + 1; l < o && s(t, e[i + r - l]) < 0; ) + a = l, + (l = 1 + (l << 1)) <= 0 && (l = o); + l > o && (l = o); + var h = a; + a = r - l, + l = r - h + } else { + for (o = n - r; l < o && s(t, e[i + r + l]) >= 0; ) + a = l, + (l = 1 + (l << 1)) <= 0 && (l = o); + l > o && (l = o), + a += r, + l += r + } + for (a++; a < l; ) { + var c = a + (l - a >>> 1); + s(t, e[i + c]) < 0 ? l = c : a = c + 1 + } + return l + } + var p = (function() { + function t(t, e) { + this.array = t, + this.compare = e, + this.minGallop = r, + this.length = t.length, + this.tmpStorageLength = s, + this.length < 2 * s && (this.tmpStorageLength = this.length >>> 1), + this.tmp = new Array(this.tmpStorageLength), + this.stackLength = this.length < 120 ? 5 : this.length < 1542 ? 10 : this.length < 119151 ? 19 : 40, + this.runStart = new Array(this.stackLength), + this.runLength = new Array(this.stackLength), + this.stackSize = 0 + } + var e = t.prototype; + return e.pushRun = function(t, e) { + this.runStart[this.stackSize] = t, + this.runLength[this.stackSize] = e, + this.stackSize += 1 + } + , + e.mergeRuns = function() { + for (; this.stackSize > 1; ) { + var t = this.stackSize - 2; + if (t >= 1 && this.runLength[t - 1] <= this.runLength[t] + this.runLength[t + 1] || t >= 2 && this.runLength[t - 2] <= this.runLength[t] + this.runLength[t - 1]) + this.runLength[t - 1] < this.runLength[t + 1] && t--; + else if (this.runLength[t] > this.runLength[t + 1]) + break; + this.mergeAt(t) + } + } + , + e.forceMergeRuns = function() { + for (; this.stackSize > 1; ) { + var t = this.stackSize - 2; + t > 0 && this.runLength[t - 1] < this.runLength[t + 1] && t--, + this.mergeAt(t) + } + } + , + e.mergeAt = function(t) { + var e = this.compare + , i = this.array + , n = this.runStart[t] + , r = this.runLength[t] + , s = this.runStart[t + 1] + , a = this.runLength[t + 1]; + this.runLength[t] = r + a, + t === this.stackSize - 3 && (this.runStart[t + 1] = this.runStart[t + 2], + this.runLength[t + 1] = this.runLength[t + 2]), + this.stackSize--; + var o = d(i[s], i, n, r, 0, e); + n += o, + 0 != (r -= o) && 0 !== (a = f(i[n + r - 1], i, s, a, a - 1, e)) && (r <= a ? this.mergeLow(n, r, s, a) : this.mergeHigh(n, r, s, a)) + } + , + e.mergeLow = function(t, e, i, n) { + var s = this.compare + , a = this.array + , o = this.tmp + , l = 0; + for (l = 0; l < e; l++) + o[l] = a[t + l]; + var h = 0 + , c = i + , u = t; + if (a[u++] = a[c++], + 0 != --n) + if (1 !== e) { + for (var _ = this.minGallop; ; ) { + var p = 0 + , m = 0 + , y = !1; + do { + if (s(a[c], o[h]) < 0) { + if (a[u++] = a[c++], + m++, + p = 0, + 0 == --n) { + y = !0; + break + } + } else if (a[u++] = o[h++], + p++, + m = 0, + 1 == --e) { + y = !0; + break + } + } while ((p | m) < _);if (y) + break; + do { + if (0 !== (p = d(a[c], o, h, e, 0, s))) { + for (l = 0; l < p; l++) + a[u + l] = o[h + l]; + if (u += p, + h += p, + (e -= p) <= 1) { + y = !0; + break + } + } + if (a[u++] = a[c++], + 0 == --n) { + y = !0; + break + } + if (0 !== (m = f(o[h], a, c, n, 0, s))) { + for (l = 0; l < m; l++) + a[u + l] = a[c + l]; + if (u += m, + c += m, + 0 == (n -= m)) { + y = !0; + break + } + } + if (a[u++] = o[h++], + 1 == --e) { + y = !0; + break + } + _-- + } while (p >= r || m >= r);if (y) + break; + _ < 0 && (_ = 0), + _ += 2 + } + if (this.minGallop = _, + _ < 1 && (this.minGallop = 1), + 1 === e) { + for (l = 0; l < n; l++) + a[u + l] = a[c + l]; + a[u + n] = o[h] + } else { + if (0 === e) + throw new Error("mergeLow preconditions were not respected"); + for (l = 0; l < e; l++) + a[u + l] = o[h + l] + } + } else { + for (l = 0; l < n; l++) + a[u + l] = a[c + l]; + a[u + n] = o[h] + } + else + for (l = 0; l < e; l++) + a[u + l] = o[h + l] + } + , + e.mergeHigh = function(t, e, i, n) { + var s = this.compare + , a = this.array + , o = this.tmp + , l = 0; + for (l = 0; l < n; l++) + o[l] = a[i + l]; + var h = t + e - 1 + , c = n - 1 + , u = i + n - 1 + , _ = 0 + , p = 0; + if (a[u--] = a[h--], + 0 != --e) + if (1 !== n) { + for (var m = this.minGallop; ; ) { + var y = 0 + , v = 0 + , g = !1; + do { + if (s(o[c], a[h]) < 0) { + if (a[u--] = a[h--], + y++, + v = 0, + 0 == --e) { + g = !0; + break + } + } else if (a[u--] = o[c--], + v++, + y = 0, + 1 == --n) { + g = !0; + break + } + } while ((y | v) < m);if (g) + break; + do { + if (0 != (y = e - d(o[c], a, t, e, e - 1, s))) { + for (e -= y, + p = 1 + (u -= y), + _ = 1 + (h -= y), + l = y - 1; l >= 0; l--) + a[p + l] = a[_ + l]; + if (0 === e) { + g = !0; + break + } + } + if (a[u--] = o[c--], + 1 == --n) { + g = !0; + break + } + if (0 != (v = n - f(a[h], o, 0, n, n - 1, s))) { + for (n -= v, + p = 1 + (u -= v), + _ = 1 + (c -= v), + l = 0; l < v; l++) + a[p + l] = o[_ + l]; + if (n <= 1) { + g = !0; + break + } + } + if (a[u--] = a[h--], + 0 == --e) { + g = !0; + break + } + m-- + } while (y >= r || v >= r);if (g) + break; + m < 0 && (m = 0), + m += 2 + } + if (this.minGallop = m, + m < 1 && (this.minGallop = 1), + 1 === n) { + for (p = 1 + (u -= e), + _ = 1 + (h -= e), + l = e - 1; l >= 0; l--) + a[p + l] = a[_ + l]; + a[u] = o[c] + } else { + if (0 === n) + throw new Error("mergeHigh preconditions were not respected"); + for (_ = u - (n - 1), + l = 0; l < n; l++) + a[_ + l] = o[l] + } + } else { + for (p = 1 + (u -= e), + _ = 1 + (h -= e), + l = e - 1; l >= 0; l--) + a[p + l] = a[_ + l]; + a[u] = o[c] + } + else + for (_ = u - (n - 1), + l = 0; l < n; l++) + a[_ + l] = o[l] + } + , + t + } + )(); + e.exports = i.default + } + ), {}], + 332: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + for (var n = Array(8), r = 0; r < 8; ++r) + n[r] = []; + function s(t) { + for (var e = 16; e <= 1 << 28; e *= 16) + if (t <= e) + return e; + return 0 + } + function a(t) { + var e, i; + return e = (t > 65535) << 4, + e |= i = ((t >>>= e) > 255) << 3, + e |= i = ((t >>>= i) > 15) << 2, + (e |= i = ((t >>>= i) > 3) << 1) | (t >>>= i) >> 1 + } + function o(t) { + var e = s(t) + , i = n[a(e) >> 2]; + return i.length > 0 ? i.pop() : new ArrayBuffer(e) + } + var l = { + alloc_int8: function(t) { + var e = new Int8Array(o(t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_uint8: function(t) { + var e = new Uint8Array(o(t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_int16: function(t) { + var e = new Int16Array(o(2 * t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_uint16: function(t) { + var e = new Uint16Array(o(2 * t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_int32: function(t) { + var e = new Int32Array(o(4 * t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_uint32: function(t) { + var e = new Uint32Array(o(4 * t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_float32: function(t) { + var e = new Float32Array(o(4 * t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_float64: function(t) { + var e = new Float64Array(o(8 * t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + alloc_dataview: function(t) { + var e = new DataView(o(t),0,t); + return e.length !== t ? e.subarray(0, t) : e + }, + free: function(t) { + var e; + e = t.buffer, + n[a(e.byteLength) >> 2].push(e) + }, + reset: function() { + for (var t = Array(8), e = 0; e < 8; ++e) + t[e] = [] + } + }; + i.default = l, + e.exports = i.default + } + ), {}], + 333: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = function(t, e) { + for (var i, n = t.length, r = e ^ n, s = 0; n >= 4; ) + i = 1540483477 * (65535 & (i = 255 & t.charCodeAt(s) | (255 & t.charCodeAt(++s)) << 8 | (255 & t.charCodeAt(++s)) << 16 | (255 & t.charCodeAt(++s)) << 24)) + ((1540483477 * (i >>> 16) & 65535) << 16), + r = 1540483477 * (65535 & r) + ((1540483477 * (r >>> 16) & 65535) << 16) ^ (i = 1540483477 * (65535 & (i ^= i >>> 24)) + ((1540483477 * (i >>> 16) & 65535) << 16)), + n -= 4, + ++s; + switch (n) { + case 3: + r ^= (255 & t.charCodeAt(s + 2)) << 16; + case 2: + r ^= (255 & t.charCodeAt(s + 1)) << 8; + case 1: + r = 1540483477 * (65535 & (r ^= 255 & t.charCodeAt(s))) + ((1540483477 * (r >>> 16) & 65535) << 16) + } + return r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16), + (r ^= r >>> 15) >>> 0 + } + , + e.exports = i.default + } + ), {}], + 334: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("../../core/value-types") + , r = o(t("../core/base-renderer")) + , s = o(t("../enums")) + , a = t("../memop"); + function o(t) { + return t && t.__esModule ? t : { + default: t + } + } + function l(t) { + if (void 0 === t) + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return t + } + function h(t, e) { + return (h = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var c = new Float32Array(16) + , u = new Float32Array(16) + , _ = new Float32Array(16) + , f = new Float32Array(16) + , d = new Float32Array(4) + , p = new Float32Array(64) + , m = [] + , y = new Float32Array(4) + , v = new n.Vec4(0,0,0,0) + , g = new n.Vec3(0,0,0) + , A = new n.Vec3(0,0,0) + , x = new a.RecyclePool(function() { + return new Float32Array(16) + } + ,8); + function b(t, e) { + return t._priority - e._priority + } + var C = (function(t) { + var e, i; + function r(e, i) { + var n; + return (n = t.call(this, e, i) || this)._time = new Float32Array(4), + n._lights = [], + n._shadowLights = [], + n._numLights = 0, + n._defines = {}, + n._registerStage("shadowcast", n._shadowStage.bind(l(n))), + n._registerStage("opaque", n._opaqueStage.bind(l(n))), + n._registerStage("transparent", n._transparentStage.bind(l(n))), + n + } + i = t, + (e = r).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + h(e, i); + var a = r.prototype; + return a.reset = function() { + x.reset(), + t.prototype.reset.call(this) + } + , + a.render = function(t, e) { + this.reset(), + e && (this._time[0] += e, + this._time[1] = e, + this._time[2]++), + this._device.setUniform("cc_time", this._time), + this._updateLights(t); + for (var i = this._device._gl.canvas, n = 0; n < t._cameras.length; ++n) { + var r = this._requestView() + , s = i.width + , a = i.height; + t._cameras.data[n].extractView(r, s, a) + } + this._viewPools.sort(b); + for (var o = 0; o < this._viewPools.length; ++o) { + var l = this._viewPools.data[o]; + this._render(l, t) + } + } + , + a.renderCamera = function(t, e) { + this.reset(), + this._updateLights(e); + var i = this._device._gl.canvas + , n = i.width + , r = i.height + , s = this._requestView(); + t.extractView(s, n, r), + this._viewPools.sort(b); + for (var a = 0; a < this._viewPools.length; ++a) { + var o = this._viewPools.data[a]; + this._render(o, e) + } + } + , + a._updateLights = function(t) { + this._lights.length = 0, + this._shadowLights.length = 0; + for (var e = t._lights, i = 0; i < e.length; ++i) { + var n = e.data[i]; + if (n.update(this._device), + n.shadowType !== s.default.SHADOW_NONE) { + this._shadowLights.length < 2 && this._shadowLights.splice(0, 0, n); + var r = this._requestView(); + n.extractView(r, ["shadowcast"]), + this._lights.splice(0, 0, n) + } else + this._lights.push(n) + } + this._updateLightDefines(), + this._numLights = e._count + } + , + a._updateLightDefines = function() { + for (var t = this._defines, e = 0; e < this._lights.length; ++e) { + var i = this._lights[e] + , n = "CC_LIGHT_" + e + "_TYPE" + , r = "CC_SHADOW_" + e + "_TYPE"; + t[n] !== i._type && (t[n] = i._type, + this._definesChanged = !0), + t[r] !== i._shadowType && (t[r] = i._shadowType, + this._definesChanged = !0) + } + var s = Math.min(4, this._lights.length); + t.CC_NUM_LIGHTS !== s && (t.CC_NUM_LIGHTS = s, + this._definesChanged = !0), + s = Math.min(4, this._shadowLights.length), + t.CC_NUM_SHADOW_LIGHTS !== s && (t.CC_NUM_SHADOW_LIGHTS = s, + this._definesChanged = !0) + } + , + a._submitLightsUniforms = function() { + var t = this._device; + if (this._lights.length > 0) { + for (var e = x.add(), i = x.add(), n = x.add(), r = Math.min(4, this._lights.length), a = 0; a < r; ++a) { + var o = this._lights[a] + , l = 4 * a; + n.set(o._colorUniform, l), + i.set(o._directionUniform, l), + e.set(o._positionUniform, l), + e[l + 3] = o._range, + o._type === s.default.LIGHT_SPOT ? (i[l + 3] = o._spotUniform[0], + n[l + 3] = o._spotUniform[1]) : (i[l + 3] = 0, + n[l + 3] = 0) + } + t.setUniform("cc_lightDirection", i), + t.setUniform("cc_lightColor", n), + t.setUniform("cc_lightPositionAndRange", e) + } + } + , + a._submitShadowStageUniforms = function(t) { + var e = t._shadowLight + , i = y; + i[0] = e.shadowMinDepth, + i[1] = e.shadowMaxDepth, + i[2] = e.shadowDepthScale, + i[3] = e.shadowDarkness, + this._device.setUniform("cc_shadow_map_lightViewProjMatrix", n.Mat4.toArray(f, t._matViewProj)), + this._device.setUniform("cc_shadow_map_info", i), + this._device.setUniform("cc_shadow_map_bias", e.shadowBias), + this._defines.CC_SHADOW_TYPE = e._shadowType + } + , + a._submitOtherStagesUniforms = function() { + for (var t = x.add(), e = 0; e < this._shadowLights.length; ++e) { + var i = this._shadowLights[e] + , r = m[e]; + r || (r = m[e] = new Float32Array(p.buffer,64 * e,16)), + n.Mat4.toArray(r, i.viewProjMatrix); + var s = 4 * e; + t[s] = i.shadowMinDepth, + t[s + 1] = i.shadowMaxDepth, + t[s + 2] = i._shadowResolution, + t[s + 3] = i.shadowDarkness + } + this._device.setUniform("cc_shadow_lightViewProjMatrix", p), + this._device.setUniform("cc_shadow_info", t) + } + , + a._sortItems = function(t) { + t.sort((function(t, e) { + return t.passes.length !== e.passes.length ? t.passes.length - e.passes.length : t.sortKey - e.sortKey + } + )) + } + , + a._shadowStage = function(t, e) { + this._submitShadowStageUniforms(t); + for (var i = 0; i < e.length; ++i) { + var n = e.data[i]; + n.effect.getDefine("CC_CASTING_SHADOW") && this._draw(n) + } + } + , + a._drawItems = function(t, e) { + var i = this._shadowLights; + if (0 === i.length && 0 === this._numLights) + for (var n = 0; n < e.length; ++n) { + var r = e.data[n]; + this._draw(r) + } + else + for (var s = 0; s < e.length; ++s) { + for (var a = e.data[s], o = 0; o < i.length; ++o) + this._device.setTexture("cc_shadow_map_" + o, i[o].shadowMap, this._allocTextureUnit()); + this._draw(a) + } + } + , + a._opaqueStage = function(t, e) { + t.getPosition(v), + this._device.setUniform("cc_matView", n.Mat4.toArray(c, t._matView)), + this._device.setUniform("cc_matViewInv", n.Mat4.toArray(u, t._matViewInv)), + this._device.setUniform("cc_matProj", n.Mat4.toArray(_, t._matProj)), + this._device.setUniform("cc_matViewProj", n.Mat4.toArray(f, t._matViewProj)), + this._device.setUniform("cc_cameraPos", n.Vec4.toArray(d, v)), + this._submitLightsUniforms(), + this._submitOtherStagesUniforms(), + this._drawItems(t, e) + } + , + a._transparentStage = function(t, e) { + t.getPosition(v), + t.getForward(g), + this._device.setUniform("cc_matView", n.Mat4.toArray(c, t._matView)), + this._device.setUniform("cc_matViewInv", n.Mat4.toArray(u, t._matViewInv)), + this._device.setUniform("cc_matProj", n.Mat4.toArray(_, t._matProj)), + this._device.setUniform("cc_matViewProj", n.Mat4.toArray(f, t._matViewProj)), + this._device.setUniform("cc_cameraPos", n.Vec4.toArray(d, v)), + this._submitLightsUniforms(), + this._submitOtherStagesUniforms(); + for (var i = 0; i < e.length; ++i) { + var r = e.data[i]; + r.node.getWorldPosition(A), + n.Vec3.sub(A, A, v), + r.sortKey = -n.Vec3.dot(A, g) + } + this._sortItems(e), + this._drawItems(t, e) + } + , + r + } + )(r.default); + i.default = C, + e.exports = i.default + } + ), { + "../../core/value-types": 282, + "../core/base-renderer": 304, + "../enums": 310, + "../memop": 327 + }], + 335: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = t("../../core/value-types"), s = t("../../core/geom-utils"), a = (n = t("../enums")) && n.__esModule ? n : { + default: n + }; + function o(t, e) { + for (var i = 0; i < e.length; i++) { + var n = e[i]; + n.enumerable = n.enumerable || !1, + n.configurable = !0, + "value"in n && (n.writable = !0), + Object.defineProperty(t, n.key, n) + } + } + var l = new r.Mat4 + , h = new r.Mat4 + , c = new r.Mat4 + , u = new r.Mat4 + , _ = new r.Mat4 + , f = new r.Mat4 + , d = new r.Vec3 + , p = new r.Vec3 + , m = (function() { + function t() { + this._poolID = -1, + this._node = null, + this._projection = a.default.PROJ_PERSPECTIVE, + this._priority = 0, + this._color = new r.Vec4(.2,.3,.47,1), + this._depth = 1, + this._stencil = 0, + this._clearFlags = a.default.CLEAR_COLOR | a.default.CLEAR_DEPTH, + this._clearModel = null, + this._stages = [], + this._framebuffer = null, + this._near = .01, + this._far = 1e3, + this._fov = Math.PI / 4, + this._rect = { + x: 0, + y: 0, + w: 1, + h: 1 + }, + this._orthoHeight = 10, + this._cullingMask = 4294967295 + } + var e, i, n = t.prototype; + return n.setCullingMask = function(t) { + this._cullingMask = t + } + , + n.getNode = function() { + return this._node + } + , + n.setNode = function(t) { + this._node = t + } + , + n.getType = function() { + return this._projection + } + , + n.setType = function(t) { + this._projection = t + } + , + n.getPriority = function() { + return this._priority + } + , + n.setPriority = function(t) { + this._priority = t + } + , + n.getOrthoHeight = function() { + return this._orthoHeight + } + , + n.setOrthoHeight = function(t) { + this._orthoHeight = t + } + , + n.getFov = function() { + return this._fov + } + , + n.setFov = function(t) { + this._fov = t + } + , + n.getNear = function() { + return this._near + } + , + n.setNear = function(t) { + this._near = t + } + , + n.getFar = function() { + return this._far + } + , + n.setFar = function(t) { + this._far = t + } + , + n.getColor = function(t) { + return r.Vec4.copy(t, this._color) + } + , + n.setColor = function(t, e, i, n) { + r.Vec4.set(this._color, t, e, i, n) + } + , + n.getDepth = function() { + return this._depth + } + , + n.setDepth = function(t) { + this._depth = t + } + , + n.getStencil = function() { + return this._stencil + } + , + n.setStencil = function(t) { + this._stencil = t + } + , + n.getClearFlags = function() { + return this._clearFlags + } + , + n.setClearFlags = function(t) { + this._clearFlags = t + } + , + n.getRect = function(t) { + return t.x = this._rect.x, + t.y = this._rect.y, + t.w = this._rect.w, + t.h = this._rect.h, + t + } + , + n.setRect = function(t, e, i, n) { + this._rect.x = t, + this._rect.y = e, + this._rect.w = i, + this._rect.h = n + } + , + n.getStages = function() { + return this._stages + } + , + n.setStages = function(t) { + this._stages = t + } + , + n.getFramebuffer = function() { + return this._framebuffer + } + , + n.setFrameBuffer = function(t) { + this._framebuffer = t + } + , + n._calcMatrices = function(t, e) { + this._node.getWorldRT(c), + r.Mat4.invert(h, c); + var i = t / e; + if (this._projection === a.default.PROJ_PERSPECTIVE) + r.Mat4.perspective(u, this._fov, i, this._near, this._far); + else { + var n = this._orthoHeight * i + , s = this._orthoHeight; + r.Mat4.ortho(u, -n, n, -s, s, this._near, this._far) + } + r.Mat4.mul(_, u, h), + r.Mat4.invert(f, _) + } + , + n.extractView = function(t, e, i) { + this._framebuffer && (e = this._framebuffer._width, + i = this._framebuffer._height), + t._priority = this._priority, + t._rect.x = this._rect.x * e, + t._rect.y = this._rect.y * i, + t._rect.w = this._rect.w * e, + t._rect.h = this._rect.h * i, + this.getColor(t._color), + t._depth = this._depth, + t._stencil = this._stencil, + t._clearFlags = this._clearFlags, + t._clearModel = this._clearModel, + t._stages = this._stages, + t._framebuffer = this._framebuffer, + this._calcMatrices(e, i), + r.Mat4.copy(t._matView, h), + r.Mat4.copy(t._matViewInv, c), + r.Mat4.copy(t._matProj, u), + r.Mat4.copy(t._matViewProj, _), + r.Mat4.copy(t._matInvViewProj, f), + t._cullingMask = this._cullingMask + } + , + n.screenPointToRay = function(t, e, i, n, o) { + if (!cc.geomUtils) + return o; + o = o || new s.Ray, + this._calcMatrices(i, n); + var l = this._rect.x * i + , h = this._rect.y * n + , c = this._rect.w * i + , u = this._rect.h * n; + return r.Vec3.set(p, (t - l) / c * 2 - 1, (e - h) / u * 2 - 1, 1), + r.Vec3.transformMat4(p, p, f), + this._projection === a.default.PROJ_PERSPECTIVE ? this._node.getWorldPosition(d) : (r.Vec3.set(d, (t - l) / c * 2 - 1, (e - h) / u * 2 - 1, -1), + r.Vec3.transformMat4(d, d, f)), + s.Ray.fromPoints(o, d, p) + } + , + n.screenToWorld = function(t, e, i, n) { + this._calcMatrices(i, n); + var s = this._rect.x * i + , o = this._rect.y * n + , l = this._rect.w * i + , h = this._rect.h * n; + return this._projection === a.default.PROJ_PERSPECTIVE ? (r.Vec3.set(t, (e.x - s) / l * 2 - 1, (e.y - o) / h * 2 - 1, .9999), + r.Vec3.transformMat4(t, t, f), + this._node.getWorldPosition(d), + r.Vec3.lerp(t, d, t, (0, + r.lerp)(this._near / this._far, 1, e.z))) : (r.Vec3.set(t, (e.x - s) / l * 2 - 1, (e.y - o) / h * 2 - 1, 2 * e.z - 1), + r.Vec3.transformMat4(t, t, f)), + t + } + , + n.worldToScreen = function(t, e, i, n) { + this._calcMatrices(i, n); + var s = this._rect.x * i + , a = this._rect.y * n + , o = this._rect.w * i + , l = this._rect.h * n; + return r.Vec3.transformMat4(t, e, _), + t.x = s + .5 * (t.x + 1) * o, + t.y = a + .5 * (t.y + 1) * l, + t.z = .5 * t.z + .5, + t + } + , + n.worldMatrixToScreen = function(t, e, i, n) { + this._calcMatrices(i, n), + r.Mat4.mul(t, _, e); + var s = i / 2 + , a = n / 2; + return r.Mat4.identity(l), + r.Mat4.transform(l, l, r.Vec3.set(d, s, a, 0)), + r.Mat4.scale(l, l, r.Vec3.set(d, s, a, 1)), + r.Mat4.mul(t, l, t), + t + } + , + e = t, + (i = [{ + key: "cullingMask", + get: function() { + return this._cullingMask + }, + set: function(t) { + this._cullingMask = t + } + }]) && o(e.prototype, i), + t + } + )(); + i.default = m, + e.exports = i.default + } + ), { + "../../core/geom-utils": 148, + "../../core/value-types": 282, + "../enums": 310 + }], + 336: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = (function() { + function t() { + this._type = "default", + this._poolID = -1, + this._node = null, + this._inputAssembler = null, + this._effect = null, + this._viewID = -1, + this._cameraID = -1, + this._userKey = -1, + this._castShadow = !1, + this._boundingShape = null + } + var e = t.prototype; + return e.setNode = function(t) { + this._node = t + } + , + e.setInputAssembler = function(t) { + this._inputAssembler = t + } + , + e.setEffect = function(t) { + this._effect = t + } + , + e.setUserKey = function(t) { + this._userKey = t + } + , + e.extractDrawItem = function(t) { + t.model = this, + t.node = this._node, + t.ia = this._inputAssembler, + t.effect = this._effect + } + , + t + } + )(); + i.default = n, + e.exports = i.default + } + ), {}], + 337: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = t("../memop") + , r = (function() { + function t(t) { + this._lights = new n.FixedArray(16), + this._models = new n.FixedArray(16), + this._cameras = new n.FixedArray(16), + this._debugCamera = null, + this._app = t, + this._views = [] + } + var e = t.prototype; + return e._add = function(t, e) { + -1 === e._poolID && (t.push(e), + e._poolID = t.length - 1) + } + , + e._remove = function(t, e) { + -1 !== e._poolID && (t.data[t.length - 1]._poolID = e._poolID, + t.fastRemove(e._poolID), + e._poolID = -1) + } + , + e.reset = function() { + for (var t = 0; t < this._models.length; ++t) + this._models.data[t]._viewID = -1 + } + , + e.setDebugCamera = function(t) { + this._debugCamera = t + } + , + e.getCameraCount = function() { + return this._cameras.length + } + , + e.getCamera = function(t) { + return this._cameras.data[t] + } + , + e.addCamera = function(t) { + this._add(this._cameras, t) + } + , + e.removeCamera = function(t) { + this._remove(this._cameras, t) + } + , + e.getModelCount = function() { + return this._models.length + } + , + e.getModel = function(t) { + return this._models.data[t] + } + , + e.addModel = function(t) { + this._add(this._models, t) + } + , + e.removeModel = function(t) { + this._remove(this._models, t) + } + , + e.getLightCount = function() { + return this._lights.length + } + , + e.getLight = function(t) { + return this._lights.data[t] + } + , + e.addLight = function(t) { + this._add(this._lights, t) + } + , + e.removeLight = function(t) { + this._remove(this._lights, t) + } + , + e.addView = function(t) { + -1 === this._views.indexOf(t) && this._views.push(t) + } + , + e.removeView = function(t) { + var e = this._views.indexOf(t); + -1 !== e && this._views.splice(e, 1) + } + , + t + } + )(); + i.default = r, + e.exports = i.default + } + ), { + "../memop": 327 + }], + 338: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.getInspectorProps = function(t) { + var e = { + type: t.type + }; + Object.assign(e, t.editor || t.inspector), + e.defines = t.defines, + e.value = v(e.type)(t.value), + t.range && (e.range = t.range); + var i = g(e.type); + return e.typeName = A[i] || i, + e.valueCtor = d[e.type], + "cc.Texture2D" == e.typeName && (e.typeName = "cc.Asset", + e.assetType = "cc.Texture2D"), + e + } + , + i.getClassName = i.getInstanceCtor = i.getInstanceType = i.enums2default = i.ctor2enums = void 0; + var n, r, s, a, o = c(t("./enums")), l = t("../core/value-types"), h = c(t("../core/assets/CCTexture2D")); + function c(t) { + return t && t.__esModule ? t : { + default: t + } + } + var u; + u = t("./gfx/texture-2d"); + var _ = cc.Object + , f = ((n = {})[Boolean] = function(t) { + return t || !1 + } + , + n[Number] = function(t) { + return t ? ArrayBuffer.isView(t) ? t[0] : t : 0 + } + , + n[l.Vec2] = function(t) { + return t ? cc.v2(t[0], t[1]) : cc.v2() + } + , + n[l.Vec3] = function(t) { + return t ? cc.v3(t[0], t[1], t[2]) : cc.v3() + } + , + n[l.Vec4] = function(t) { + return t ? cc.v4(t[0], t[1], t[2], t[3]) : cc.v4() + } + , + n[l.Color] = function(t) { + return t ? cc.color(255 * t[0], 255 * t[1], 255 * t[2], 255 * (t[3] || 1)) : cc.color() + } + , + n[l.Mat4] = function(t) { + return t ? cc.mat4(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]) : cc.mat4() + } + , + n[h.default] = function() { + return null + } + , + n[_] = function() { + return null + } + , + n) + , d = ((r = {})[o.default.PARAM_INT] = Number, + r[o.default.PARAM_INT2] = l.Vec2, + r[o.default.PARAM_INT3] = l.Vec3, + r[o.default.PARAM_INT4] = l.Vec4, + r[o.default.PARAM_FLOAT] = Number, + r[o.default.PARAM_FLOAT2] = l.Vec2, + r[o.default.PARAM_FLOAT3] = l.Vec3, + r[o.default.PARAM_FLOAT4] = l.Vec4, + r[o.default.PARAM_MAT4] = l.Mat4, + r[o.default.PARAM_TEXTURE_2D] = h.default, + r.color = l.Color, + r.number = Number, + r.boolean = Boolean, + r.default = _, + r) + , p = ((s = {})[Number] = o.default.PARAM_FLOAT, + s[l.Vec2] = o.default.PARAM_FLOAT2, + s[l.Vec3] = o.default.PARAM_FLOAT3, + s[l.Vec4] = o.default.PARAM_FLOAT4, + s[l.Color] = o.default.PARAM_COLOR3, + s[l.Color] = o.default.PARAM_COLOR4, + s[l.Mat4] = o.default.PARAM_MAT4, + s[h.default] = o.default.PARAM_TEXTURE_2D, + s[u] = o.default.PARAM_TEXTURE_2D, + s); + i.ctor2enums = p; + var m = ((a = {})[o.default.PARAM_INT] = new Uint32Array([0]), + a[o.default.PARAM_INT2] = new Uint32Array([0, 0]), + a[o.default.PARAM_INT3] = new Uint32Array([0, 0, 0]), + a[o.default.PARAM_INT4] = new Uint32Array([0, 0, 0, 0]), + a[o.default.PARAM_FLOAT] = new Float32Array([0]), + a[o.default.PARAM_FLOAT2] = new Float32Array([0, 0]), + a[o.default.PARAM_FLOAT3] = new Float32Array([0, 0, 0]), + a[o.default.PARAM_FLOAT4] = new Float32Array([0, 0, 0, 0]), + a[o.default.PARAM_MAT4] = cc.mat4().m, + a[o.default.PARAM_TEXTURE_2D] = null, + a.number = 0, + a.boolean = !1, + a); + i.enums2default = m; + var y = function(t) { + return d[t] || d.default + }; + i.getInstanceType = y; + var v = function(t) { + return f[y(t)] + }; + i.getInstanceCtor = v; + var g = function(t) { + return cc.js.getClassName(y(t)) + }; + i.getClassName = g; + var A = { + Number: "number", + Boolean: "boolean" + } + } + ), { + "../core/assets/CCTexture2D": 77, + "../core/value-types": 282, + "./enums": 310, + "./gfx/texture-2d": 320 + }], + 339: [(function(t) { + "use strict"; + var e = t("../compression/ZipUtils") + , i = t("../compression/zlib.min") + , n = t("../core/platform/js"); + function r(t) { + if (t.length % 4 != 0) + return null; + for (var e = t.length / 4, i = window.Uint32Array ? new Uint32Array(e) : [], n = 0; n < e; n++) { + var r = 4 * n; + i[n] = t[r] + 256 * t[r + 1] + 65536 * t[r + 2] + t[r + 3] * (1 << 24) + } + return i + } + function s(t) { + var e = cc.Label.HorizontalAlign; + switch (t) { + case "center": + return e.CENTER; + case "right": + return e.RIGHT; + default: + return e.LEFT + } + } + function a(t) { + var e = cc.Label.VerticalAlign; + switch (t) { + case "center": + return e.CENTER; + case "bottom": + return e.BOTTOM; + default: + return e.TOP + } + } + function o(t) { + if (!t) + return cc.color(0, 0, 0, 255); + if (8 === (t = -1 !== t.indexOf("#") ? t.substring(1) : t).length) { + var e = parseInt(t.substr(0, 2), 16) || 255 + , i = parseInt(t.substr(2, 2), 16) || 0 + , n = parseInt(t.substr(4, 2), 16) || 0 + , r = parseInt(t.substr(6, 2), 16) || 0; + return cc.color(i, n, r, e) + } + var s = parseInt(t.substr(0, 2), 16) || 0 + , a = parseInt(t.substr(2, 2), 16) || 0 + , o = parseInt(t.substr(4, 2), 16) || 0; + return cc.color(s, a, o, 255) + } + function l(t, e) { + for (var i = [], n = t.getElementsByTagName("properties"), r = 0; r < n.length; ++r) + for (var s = n[r].getElementsByTagName("property"), a = 0; a < s.length; ++a) + i.push(s[a]); + e = e || {}; + for (var l = 0; l < i.length; l++) { + var h = i[l] + , c = h.getAttribute("name") + , u = h.getAttribute("type") || "string" + , _ = h.getAttribute("value"); + "int" === u ? _ = parseInt(_) : "float" === u ? _ = parseFloat(_) : "bool" === u ? _ = "true" === _ : "color" === u && (_ = o(_)), + e[c] = _ + } + return e + } + t("../core/platform/CCSAXParser"), + cc.TMXLayerInfo = function() { + this.properties = {}, + this.name = "", + this._layerSize = null, + this._tiles = [], + this.visible = !0, + this._opacity = 0, + this.ownTiles = !0, + this._minGID = 1e5, + this._maxGID = 0, + this.offset = cc.v2(0, 0) + } + , + cc.TMXLayerInfo.prototype = { + constructor: cc.TMXLayerInfo, + getProperties: function() { + return this.properties + }, + setProperties: function(t) { + this.properties = t + } + }, + cc.TMXImageLayerInfo = function() { + this.name = "", + this.visible = !0, + this.width = 0, + this.height = 0, + this.offset = cc.v2(0, 0), + this._opacity = 0, + this._trans = new cc.Color(255,255,255,255), + this.sourceImage = null + } + , + cc.TMXObjectGroupInfo = function() { + this.properties = {}, + this.name = "", + this._objects = [], + this.visible = !0, + this._opacity = 0, + this._color = new cc.Color(255,255,255,255), + this.offset = cc.v2(0, 0), + this._draworder = "topdown" + } + , + cc.TMXObjectGroupInfo.prototype = { + constructor: cc.TMXObjectGroupInfo, + getProperties: function() { + return this.properties + }, + setProperties: function(t) { + this.properties = t + } + }, + cc.TMXTilesetInfo = function() { + this.name = "", + this.firstGid = 0, + this.spacing = 0, + this.margin = 0, + this.sourceImage = null, + this.imageSize = cc.size(0, 0), + this.tileOffset = cc.v2(0, 0), + this._tileSize = cc.size(0, 0) + } + , + cc.TMXTilesetInfo.prototype = { + constructor: cc.TMXTilesetInfo, + rectForGID: function(t, e) { + var i = e || cc.rect(0, 0, 0, 0); + i.width = this._tileSize.width, + i.height = this._tileSize.height, + t &= cc.TiledMap.TileFlag.FLIPPED_MASK, + t -= parseInt(this.firstGid, 10); + var n = parseInt((this.imageSize.width - 2 * this.margin + this.spacing) / (this._tileSize.width + this.spacing), 10); + return i.x = parseInt(t % n * (this._tileSize.width + this.spacing) + this.margin, 10), + i.y = parseInt(parseInt(t / n, 10) * (this._tileSize.height + this.spacing) + this.margin, 10), + i + } + }, + cc.TMXMapInfo = function(t, e, i, n, r) { + this.properties = [], + this.orientation = null, + this.parentElement = null, + this.parentGID = null, + this.layerAttrs = 0, + this.storingCharacters = !1, + this.currentString = null, + this.renderOrder = cc.TiledMap.RenderOrder.RightDown, + this._supportVersion = [1, 2, 0], + this._parser = new cc.SAXParser, + this._objectGroups = [], + this._allChildren = [], + this._mapSize = cc.size(0, 0), + this._tileSize = cc.size(0, 0), + this._layers = [], + this._tilesets = [], + this._imageLayers = [], + this._tileProperties = {}, + this._tileAnimations = {}, + this._tsxMap = null, + this._textures = null, + this._staggerAxis = null, + this._staggerIndex = null, + this._hexSideLength = 0, + this._imageLayerTextures = null, + this.initWithXML(t, e, i, n, r) + } + , + cc.TMXMapInfo.prototype = { + constructor: cc.TMXMapInfo, + getOrientation: function() { + return this.orientation + }, + setOrientation: function(t) { + this.orientation = t + }, + getStaggerAxis: function() { + return this._staggerAxis + }, + setStaggerAxis: function(t) { + this._staggerAxis = t + }, + getStaggerIndex: function() { + return this._staggerIndex + }, + setStaggerIndex: function(t) { + this._staggerIndex = t + }, + getHexSideLength: function() { + return this._hexSideLength + }, + setHexSideLength: function(t) { + this._hexSideLength = t + }, + getMapSize: function() { + return cc.size(this._mapSize.width, this._mapSize.height) + }, + setMapSize: function(t) { + this._mapSize.width = t.width, + this._mapSize.height = t.height + }, + _getMapWidth: function() { + return this._mapSize.width + }, + _setMapWidth: function(t) { + this._mapSize.width = t + }, + _getMapHeight: function() { + return this._mapSize.height + }, + _setMapHeight: function(t) { + this._mapSize.height = t + }, + getTileSize: function() { + return cc.size(this._tileSize.width, this._tileSize.height) + }, + setTileSize: function(t) { + this._tileSize.width = t.width, + this._tileSize.height = t.height + }, + _getTileWidth: function() { + return this._tileSize.width + }, + _setTileWidth: function(t) { + this._tileSize.width = t + }, + _getTileHeight: function() { + return this._tileSize.height + }, + _setTileHeight: function(t) { + this._tileSize.height = t + }, + getLayers: function() { + return this._layers + }, + setLayers: function(t) { + this._allChildren.push(t), + this._layers.push(t) + }, + getImageLayers: function() { + return this._imageLayers + }, + setImageLayers: function(t) { + this._allChildren.push(t), + this._imageLayers.push(t) + }, + getTilesets: function() { + return this._tilesets + }, + setTilesets: function(t) { + this._tilesets.push(t) + }, + getObjectGroups: function() { + return this._objectGroups + }, + setObjectGroups: function(t) { + this._allChildren.push(t), + this._objectGroups.push(t) + }, + getAllChildren: function() { + return this._allChildren + }, + getParentElement: function() { + return this.parentElement + }, + setParentElement: function(t) { + this.parentElement = t + }, + getParentGID: function() { + return this.parentGID + }, + setParentGID: function(t) { + this.parentGID = t + }, + getLayerAttribs: function() { + return this.layerAttrs + }, + setLayerAttribs: function(t) { + this.layerAttrs = t + }, + getStoringCharacters: function() { + return this.storingCharacters + }, + setStoringCharacters: function(t) { + this.storingCharacters = t + }, + getProperties: function() { + return this.properties + }, + setProperties: function(t) { + this.properties = t + }, + initWithXML: function(t, e, i, n, r) { + return this._tilesets.length = 0, + this._layers.length = 0, + this._imageLayers.length = 0, + this._tsxMap = e, + this._textures = i, + this._imageLayerTextures = r, + this._textureSizes = n, + this._objectGroups.length = 0, + this._allChildren.length = 0, + this.properties.length = 0, + this._tileProperties = {}, + this._tileAnimations = {}, + this.currentString = "", + this.storingCharacters = !1, + this.layerAttrs = cc.TMXLayerInfo.ATTRIB_NONE, + this.parentElement = cc.TiledMap.NONE, + this.parseXMLString(t) + }, + parseXMLString: function(t, e) { + var i, n = this._parser._parseXML(t).documentElement, r = n.getAttribute("orientation"), s = n.getAttribute("staggeraxis"), a = n.getAttribute("staggerindex"), o = n.getAttribute("hexsidelength"), h = n.getAttribute("renderorder"), c = n.getAttribute("version") || "1.0.0"; + if ("map" === n.nodeName) { + for (var u = c.split("."), _ = this._supportVersion, f = 0; f < _.length; f++) { + var d = parseInt(u[f]) || 0; + if (_[f] < d) { + cc.logID(7216, c); + break + } + } + "orthogonal" === r ? this.orientation = cc.TiledMap.Orientation.ORTHO : "isometric" === r ? this.orientation = cc.TiledMap.Orientation.ISO : "hexagonal" === r ? this.orientation = cc.TiledMap.Orientation.HEX : null !== r && cc.logID(7217, r), + this.renderOrder = "right-up" === h ? cc.TiledMap.RenderOrder.RightUp : "left-up" === h ? cc.TiledMap.RenderOrder.LeftUp : "left-down" === h ? cc.TiledMap.RenderOrder.LeftDown : cc.TiledMap.RenderOrder.RightDown, + "x" === s ? this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_X) : "y" === s && this.setStaggerAxis(cc.TiledMap.StaggerAxis.STAGGERAXIS_Y), + "odd" === a ? this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD) : "even" === a && this.setStaggerIndex(cc.TiledMap.StaggerIndex.STAGGERINDEX_EVEN), + o && this.setHexSideLength(parseFloat(o)); + var p = cc.size(0, 0); + p.width = parseFloat(n.getAttribute("width")), + p.height = parseFloat(n.getAttribute("height")), + this.setMapSize(p), + (p = cc.size(0, 0)).width = parseFloat(n.getAttribute("tilewidth")), + p.height = parseFloat(n.getAttribute("tileheight")), + this.setTileSize(p), + this.properties = l(n) + } + var m = n.getElementsByTagName("tileset"); + for ("map" !== n.nodeName && (m = []).push(n), + i = 0; i < m.length; i++) { + var y = m[i] + , v = y.getAttribute("source"); + if (v) { + var g = parseInt(y.getAttribute("firstgid")) + , A = this._tsxMap[v]; + A && this.parseXMLString(A, g) + } else { + var x = y.getElementsByTagName("image") + , b = x.length > 1 + , C = x[0] + , T = C.getAttribute("source"); + T = T.replace(/\\/g, "/"); + var S = y.getElementsByTagName("tile") + , w = S && S.length || 1 + , E = null + , M = y.getAttribute("name") || "" + , D = parseInt(y.getAttribute("spacing")) || 0 + , B = parseInt(y.getAttribute("margin")) || 0 + , I = parseInt(e); + I || (I = parseInt(y.getAttribute("firstgid")) || 0); + var P = cc.size(0, 0); + P.width = parseFloat(y.getAttribute("tilewidth")), + P.height = parseFloat(y.getAttribute("tileheight")); + var R = y.getElementsByTagName("tileoffset")[0] + , O = cc.v2(0, 0); + R && (O.x = parseFloat(R.getAttribute("x")), + O.y = parseFloat(R.getAttribute("y"))); + for (var L = null, F = 0; F < w; F++) + if (L && !b || ((L = new cc.TMXTilesetInfo).name = M, + L.firstGid = I, + L.spacing = D, + L.margin = B, + L._tileSize = P, + L.tileOffset = O, + L.sourceImage = this._textures[T], + L.imageSize = this._textureSizes[T] || L.imageSize, + L.sourceImage || cc.errorID(7221, T), + this.setTilesets(L)), + E = S && S[F]) { + this.parentGID = parseInt(I) + parseInt(E.getAttribute("id") || 0); + var V = E.getElementsByTagName("image"); + if (V && V.length > 0) { + var N = (C = V[0]).getAttribute("source"); + N = N.replace(/\\/g, "/"), + L.sourceImage = this._textures[N], + L.sourceImage || cc.errorID(7221, N); + var k = cc.size(0, 0); + k.width = parseFloat(C.getAttribute("width")), + k.height = parseFloat(C.getAttribute("height")), + L._tileSize = k, + L.firstGid = this.parentGID + } + this._tileProperties[this.parentGID] = l(E); + var G = E.getElementsByTagName("animation"); + if (G && G.length > 0) { + var U = G[0].getElementsByTagName("frame") + , z = { + frames: [], + dt: 0, + frameIdx: 0 + }; + this._tileAnimations[this.parentGID] = z; + for (var H = z.frames, W = 0; W < U.length; W++) { + var j = U[W] + , X = parseInt(I) + parseInt(j.getAttribute("tileid")) + , Y = parseFloat(j.getAttribute("duration")); + H.push({ + tileid: X, + duration: Y / 1e3, + grid: null + }) + } + } + } + } + } + var q = n.childNodes; + for (i = 0; i < q.length; i++) { + var J = q[i]; + if (!this._shouldIgnoreNode(J)) { + if ("imagelayer" === J.nodeName) { + var Z = this._parseImageLayer(J); + Z && this.setImageLayers(Z) + } + if ("layer" === J.nodeName) { + var K = this._parseLayer(J); + this.setLayers(K) + } + if ("objectgroup" === J.nodeName) { + var Q = this._parseObjectGroup(J); + this.setObjectGroups(Q) + } + } + } + return n + }, + _shouldIgnoreNode: function(t) { + return 3 === t.nodeType || 8 === t.nodeType || 4 === t.nodeType + }, + _parseImageLayer: function(t) { + var e = t.getElementsByTagName("image"); + if (!e || 0 == e.length) + return null; + var i = new cc.TMXImageLayerInfo; + i.name = t.getAttribute("name"), + i.offset.x = parseFloat(t.getAttribute("offsetx")) || 0, + i.offset.y = parseFloat(t.getAttribute("offsety")) || 0; + var n = t.getAttribute("visible"); + i.visible = !("0" === n); + var r = t.getAttribute("opacity") || 1; + i.opacity = parseInt(255 * parseFloat(r)) || 255; + var s = e[0] + , a = s.getAttribute("source"); + return i.sourceImage = this._imageLayerTextures[a], + i.width = parseInt(s.getAttribute("width")) || 0, + i.height = parseInt(s.getAttribute("height")) || 0, + i.trans = o(s.getAttribute("trans")), + i.sourceImage ? i : (cc.errorID(7221, a), + null) + }, + _parseLayer: function(t) { + var n = t.getElementsByTagName("data")[0] + , s = new cc.TMXLayerInfo; + s.name = t.getAttribute("name"); + var a = cc.size(0, 0); + a.width = parseFloat(t.getAttribute("width")), + a.height = parseFloat(t.getAttribute("height")), + s._layerSize = a; + var o = t.getAttribute("visible"); + s.visible = !("0" === o); + var h = t.getAttribute("opacity") || 1; + s._opacity = h ? parseInt(255 * parseFloat(h)) : 255, + s.offset = cc.v2(parseFloat(t.getAttribute("offsetx")) || 0, parseFloat(t.getAttribute("offsety")) || 0); + for (var c = "", u = 0; u < n.childNodes.length; u++) + c += n.childNodes[u].nodeValue; + c = c.trim(); + var _, f = n.getAttribute("compression"), d = n.getAttribute("encoding"); + if (f && "gzip" !== f && "zlib" !== f) + return cc.logID(7218), + null; + switch (f) { + case "gzip": + _ = e.unzipBase64AsArray(c, 4); + break; + case "zlib": + _ = r(new i.Inflate(e.Base64.decodeAsArray(c, 1)).decompress()); + break; + case null: + case "": + if ("base64" === d) + _ = e.Base64.decodeAsArray(c, 4); + else if ("csv" === d) { + _ = []; + for (var p = c.split(","), m = 0; m < p.length; m++) + _.push(parseInt(p[m])) + } else { + var y = n.getElementsByTagName("tile"); + _ = []; + for (var v = 0; v < y.length; v++) + _.push(parseInt(y[v].getAttribute("gid"))) + } + break; + default: + this.layerAttrs === cc.TMXLayerInfo.ATTRIB_NONE && cc.logID(7219) + } + return _ && (s._tiles = new Uint32Array(_)), + s.properties = l(t), + s + }, + _parseObjectGroup: function(t) { + var e = new cc.TMXObjectGroupInfo; + e.name = t.getAttribute("name") || "", + e.offset = cc.v2(parseFloat(t.getAttribute("offsetx")), parseFloat(t.getAttribute("offsety"))); + var i = t.getAttribute("opacity") || 1; + e._opacity = i ? parseInt(255 * parseFloat(i)) : 255; + var n = t.getAttribute("visible"); + n && 0 === parseInt(n) && (e.visible = !1); + var r = t.getAttribute("color"); + r && e._color.fromHEX(r); + var h = t.getAttribute("draworder"); + h && (e._draworder = h), + e.setProperties(l(t)); + var c = t.getElementsByTagName("object"); + if (c) { + for (var u = 0; u < c.length; u++) { + var _ = c[u] + , f = {}; + f.id = _.getAttribute("id") || u, + f.name = _.getAttribute("name") || "", + f.width = parseFloat(_.getAttribute("width")) || 0, + f.height = parseFloat(_.getAttribute("height")) || 0, + f.x = parseFloat(_.getAttribute("x")) || 0, + f.y = parseFloat(_.getAttribute("y")) || 0, + f.rotation = parseFloat(_.getAttribute("rotation")) || 0, + l(_, f); + var d = _.getAttribute("visible"); + f.visible = !(d && 0 === parseInt(d)); + var p = _.getElementsByTagName("text"); + if (p && p.length > 0) { + var m = p[0]; + f.type = cc.TiledMap.TMXObjectType.TEXT, + f.wrap = "1" == m.getAttribute("wrap"), + f.color = o(m.getAttribute("color")), + f.halign = s(m.getAttribute("halign")), + f.valign = a(m.getAttribute("valign")), + f.pixelsize = parseInt(m.getAttribute("pixelsize")) || 16, + f.text = m.childNodes[0].nodeValue + } + var y = _.getAttribute("gid"); + y && (f.gid = parseInt(y), + f.type = cc.TiledMap.TMXObjectType.IMAGE); + var v = _.getElementsByTagName("ellipse"); + v && v.length > 0 && (f.type = cc.TiledMap.TMXObjectType.ELLIPSE); + var g = _.getElementsByTagName("polygon"); + if (g && g.length > 0) { + f.type = cc.TiledMap.TMXObjectType.POLYGON; + var A = g[0].getAttribute("points"); + A && (f.points = this._parsePointsString(A)) + } + var x = _.getElementsByTagName("polyline"); + if (x && x.length > 0) { + f.type = cc.TiledMap.TMXObjectType.POLYLINE; + var b = x[0].getAttribute("points"); + b && (f.polylinePoints = this._parsePointsString(b)) + } + f.type || (f.type = cc.TiledMap.TMXObjectType.RECT), + e._objects.push(f) + } + "index" !== h && e._objects.sort((function(t, e) { + return t.y - e.y + } + )) + } + return e + }, + _parsePointsString: function(t) { + if (!t) + return null; + for (var e = [], i = t.split(" "), n = 0; n < i.length; n++) { + var r = i[n].split(","); + e.push({ + x: parseFloat(r[0]), + y: parseFloat(r[1]) + }) + } + return e + }, + setTileAnimations: function(t) { + this._tileAnimations = t + }, + getTileAnimations: function() { + return this._tileAnimations + }, + getTileProperties: function() { + return this._tileProperties + }, + setTileProperties: function(t) { + this._tileProperties = t + }, + getCurrentString: function() { + return this.currentString + }, + setCurrentString: function(t) { + this.currentString = t + } + }; + var h = cc.TMXMapInfo.prototype; + n.getset(h, "mapWidth", h._getMapWidth, h._setMapWidth), + n.getset(h, "mapHeight", h._getMapHeight, h._setMapHeight), + n.getset(h, "tileWidth", h._getTileWidth, h._setTileWidth), + n.getset(h, "tileHeight", h._getTileHeight, h._setTileHeight), + cc.TMXLayerInfo.ATTRIB_NONE = 1, + cc.TMXLayerInfo.ATTRIB_BASE64 = 2, + cc.TMXLayerInfo.ATTRIB_GZIP = 4, + cc.TMXLayerInfo.ATTRIB_ZLIB = 8 + } + ), { + "../compression/ZipUtils": 22, + "../compression/zlib.min": 25, + "../core/platform/CCSAXParser": 200, + "../core/platform/js": 214 + }], + 340: [(function(t, e) { + "use strict"; + var i, n = t("../core/value-types"), r = (i = t("../core/assets/material/material-variant")) && i.__esModule ? i : { + default: i + }, s = t("../core/components/CCRenderComponent"), a = t("../core/assets/material/CCMaterial"), o = t("../core/renderer/render-flow"), l = cc.mat4(), h = cc.v2(), c = cc.v2(), u = cc.v2(), _ = { + row: 0, + col: 0 + }, f = cc.Class({ + name: "cc.TiledUserNodeData", + extends: cc.Component, + ctor: function() { + this._index = -1, + this._row = -1, + this._col = -1, + this._tiledLayer = null + } + }), d = cc.Class({ + name: "cc.TiledLayer", + extends: s, + editor: { + inspector: "packages://inspector/inspectors/comps/tiled-layer.js" + }, + ctor: function() { + this._userNodeGrid = {}, + this._userNodeMap = {}, + this._userNodeDirty = !1, + this._tiledTiles = [], + this._tilesetIndexArr = [], + this._tilesetIndexToArrIndex = {}, + this._texIdToMatIndex = {}, + this._viewPort = { + x: -1, + y: -1, + width: -1, + height: -1 + }, + this._cullingRect = { + leftDown: { + row: -1, + col: -1 + }, + rightTop: { + row: -1, + col: -1 + } + }, + this._cullingDirty = !0, + this._rightTop = { + row: -1, + col: -1 + }, + this._layerInfo = null, + this._mapInfo = null, + this._topOffset = 0, + this._downOffset = 0, + this._leftOffset = 0, + this._rightOffset = 0, + this._tiles = [], + this._vertices = [], + this._verticesDirty = !0, + this._layerName = "", + this._layerOrientation = null, + this._texGrids = null, + this._textures = null, + this._tilesets = null, + this._leftDownToCenterX = 0, + this._leftDownToCenterY = 0, + this._hasTiledNodeGrid = !1, + this._hasAniGrid = !1, + this._animations = null, + this._enableCulling = cc.macro.ENABLE_TILEDMAP_CULLING + }, + _hasTiledNode: function() { + return this._hasTiledNodeGrid + }, + _hasAnimation: function() { + return this._hasAniGrid + }, + enableCulling: function(t) { + this._enableCulling != t && (this._enableCulling = t, + this._cullingDirty = !0) + }, + addUserNode: function(t) { + var e = t.getComponent(f); + return e ? (cc.warn("CCTiledLayer:addUserNode node has been added"), + !1) : (e = t.addComponent(f), + t.parent = this.node, + t._renderFlag |= o.FLAG_BREAK_FLOW, + this._userNodeMap[t._id] = e, + e._row = -1, + e._col = -1, + e._tiledLayer = this, + this._nodeLocalPosToLayerPos(t, h), + this._positionToRowCol(h.x, h.y, _), + this._addUserNodeToGrid(e, _), + this._updateCullingOffsetByUserNode(t), + t.on(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e), + t.on(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e), + !0) + }, + removeUserNode: function(t) { + var e = t.getComponent(f); + return e ? (t.off(cc.Node.EventType.POSITION_CHANGED, this._userNodePosChange, e), + t.off(cc.Node.EventType.SIZE_CHANGED, this._userNodeSizeChange, e), + this._removeUserNodeFromGrid(e), + delete this._userNodeMap[t._id], + t._removeComponent(e), + e.destroy(), + t.removeFromParent(!0), + t._renderFlag &= ~o.FLAG_BREAK_FLOW, + !0) : (cc.warn("CCTiledLayer:removeUserNode node is not exist"), + !1) + }, + destroyUserNode: function(t) { + this.removeUserNode(t), + t.destroy() + }, + _nodeLocalPosToLayerPos: function(t, e) { + e.x = t.x + this._leftDownToCenterX, + e.y = t.y + this._leftDownToCenterY + }, + _getNodesByRowCol: function(t, e) { + var i = this._userNodeGrid[t]; + return i ? i[e] : null + }, + _getNodesCountByRow: function(t) { + var e = this._userNodeGrid[t]; + return e ? e.count : 0 + }, + _updateAllUserNode: function() { + for (var t in this._userNodeGrid = {}, + this._userNodeMap) { + var e = this._userNodeMap[t]; + this._nodeLocalPosToLayerPos(e.node, h), + this._positionToRowCol(h.x, h.y, _), + this._addUserNodeToGrid(e, _), + this._updateCullingOffsetByUserNode(e.node) + } + }, + _updateCullingOffsetByUserNode: function(t) { + this._topOffset < t.height && (this._topOffset = t.height), + this._downOffset < t.height && (this._downOffset = t.height), + this._leftOffset < t.width && (this._leftOffset = t.width), + this._rightOffset < t.width && (this._rightOffset = t.width) + }, + _userNodeSizeChange: function() { + var t = this.node; + this._tiledLayer._updateCullingOffsetByUserNode(t) + }, + _userNodePosChange: function() { + var t = this.node + , e = this._tiledLayer; + e._nodeLocalPosToLayerPos(t, h), + e._positionToRowCol(h.x, h.y, _), + e._limitInLayer(_), + _.row === this._row && _.col === this._col || (e._removeUserNodeFromGrid(this), + e._addUserNodeToGrid(this, _)) + }, + _removeUserNodeFromGrid: function(t) { + var e = t._row + , i = t._col + , n = t._index + , r = this._userNodeGrid[e] + , s = r && r[i]; + s && (r.count--, + s.count--, + s.list[n] = null, + s.count <= 0 && (s.list.length = 0, + s.count = 0)), + t._row = -1, + t._col = -1, + t._index = -1, + this._userNodeDirty = !0 + }, + _limitInLayer: function(t) { + var e = t.row + , i = t.col; + e < 0 && (t.row = 0), + e > this._rightTop.row && (t.row = this._rightTop.row), + i < 0 && (t.col = 0), + i > this._rightTop.col && (t.col = this._rightTop.col) + }, + _addUserNodeToGrid: function(t, e) { + var i = e.row + , n = e.col + , r = this._userNodeGrid[i] = this._userNodeGrid[i] || { + count: 0 + } + , s = r[n] = r[n] || { + count: 0, + list: [] + }; + t._row = i, + t._col = n, + t._index = s.list.length, + r.count++, + s.count++, + s.list.push(t), + this._userNodeDirty = !0 + }, + _isUserNodeDirty: function() { + return this._userNodeDirty + }, + _setUserNodeDirty: function(t) { + this._userNodeDirty = t + }, + onEnable: function() { + this._super(), + this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this), + this._activateMaterial() + }, + onDisable: function() { + this._super(), + this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this) + }, + _syncAnchorPoint: function() { + var t = this.node; + this._leftDownToCenterX = t.width * t.anchorX * t.scaleX, + this._leftDownToCenterY = t.height * t.anchorY * t.scaleY, + this._cullingDirty = !0 + }, + onDestroy: function() { + this._super(), + this._buffer && (this._buffer.destroy(), + this._buffer = null), + this._renderDataList = null + }, + getLayerName: function() { + return this._layerName + }, + setLayerName: function(t) { + this._layerName = t + }, + getProperty: function(t) { + return this._properties[t] + }, + getPositionAt: function(t, e) { + var i, n; + switch (void 0 !== e ? (i = Math.floor(t), + e = Math.floor(e)) : (i = Math.floor(t.x), + e = Math.floor(t.y)), + this._layerOrientation) { + case cc.TiledMap.Orientation.ORTHO: + n = this._positionForOrthoAt(i, e); + break; + case cc.TiledMap.Orientation.ISO: + n = this._positionForIsoAt(i, e); + break; + case cc.TiledMap.Orientation.HEX: + n = this._positionForHexAt(i, e) + } + return n + }, + _isInvalidPosition: function(t, e) { + if (t && "object" == typeof t) { + var i = t; + e = i.y, + t = i.x + } + return t >= this._layerSize.width || e >= this._layerSize.height || t < 0 || e < 0 + }, + _positionForIsoAt: function(t, e) { + var i = 0 + , n = 0 + , r = Math.floor(t) + Math.floor(e) * this._layerSize.width + , s = this._tiles[r]; + if (s) { + var a = (s & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0 + , o = this._texGrids[a].tileset.tileOffset; + i = o.x, + n = o.y + } + return cc.v2(.5 * this._mapTileSize.width * (this._layerSize.height + t - e - 1) + i, .5 * this._mapTileSize.height * (this._layerSize.width - t + this._layerSize.height - e - 2) - n) + }, + _positionForOrthoAt: function(t, e) { + var i = 0 + , n = 0 + , r = Math.floor(t) + Math.floor(e) * this._layerSize.width + , s = this._tiles[r]; + if (s) { + var a = (s & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0 + , o = this._texGrids[a].tileset.tileOffset; + i = o.x, + n = o.y + } + return cc.v2(t * this._mapTileSize.width + i, (this._layerSize.height - e - 1) * this._mapTileSize.height - n) + }, + _positionForHexAt: function(t, e) { + var i, n = this._mapTileSize.width, r = this._mapTileSize.height, s = this._layerSize.height, a = Math.floor(t) + Math.floor(e) * this._layerSize.width, o = this._tiles[a]; + i = this._texGrids[o] ? this._texGrids[o].tileset.tileOffset : { + x: 0, + y: 0 + }; + var l = this._staggerIndex === cc.TiledMap.StaggerIndex.STAGGERINDEX_ODD ? 1 : -1 + , h = 0 + , c = 0 + , u = 0 + , _ = 0; + switch (this._staggerAxis) { + case cc.TiledMap.StaggerAxis.STAGGERAXIS_Y: + u = 0, + e % 2 == 1 && (u = n / 2 * l), + h = t * n + u + i.x, + c = (s - e - 1) * (r - (r - this._hexSideLength) / 2) - i.y; + break; + case cc.TiledMap.StaggerAxis.STAGGERAXIS_X: + _ = 0, + t % 2 == 1 && (_ = r / 2 * -l), + h = t * (n - (n - this._hexSideLength) / 2) + i.x, + c = (s - e - 1) * r + _ - i.y + } + return cc.v2(h, c) + }, + setTilesGIDAt: function(t, e, i, n) { + if (t && 0 !== t.length && !(n <= 0)) { + i < 0 && (i = 0), + e < 0 && (e = 0); + for (var r = 0, s = e + n, a = i; ; a++) + for (var o = e; o < s; o++) { + if (r >= t.length) + return; + this._updateTileForGID(t[r], o, a), + r++ + } + } + }, + setTileGIDAt: function(t, e, i, n) { + if (void 0 === e) + throw new Error("cc.TiledLayer.setTileGIDAt(): pos should be non-null"); + var r; + void 0 === n && e instanceof cc.Vec2 ? (r = e, + n = i) : (u.x = e, + u.y = i, + r = u); + var s = t & cc.TiledMap.TileFlag.FLIPPED_MASK; + if (r.x = Math.floor(r.x), + r.y = Math.floor(r.y), + this._isInvalidPosition(r)) + throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position"); + this._tiles && this._tilesets && 0 != this._tilesets.length ? 0 !== s && s < this._tilesets[0].firstGid ? cc.logID(7239, t) : (n = n || 0, + this._updateTileForGID((t | n) >>> 0, r.x, r.y)) : cc.logID(7238) + }, + _updateTileForGID: function(t, e, i) { + var n = 0 | e + i * this._layerSize.width; + if (!(n >= this._tiles.length) && t !== this._tiles[n]) { + var r = (t & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0 + , s = this._texGrids[r] + , a = s && s.texId; + s ? (this._tiles[n] = t, + this._updateVertex(e, i), + this._buildMaterial(a)) : this._tiles[n] = 0, + this._cullingDirty = !0 + } + }, + getTiles: function() { + return this._tiles + }, + getTileGIDAt: function(t, e) { + if (void 0 === t) + throw new Error("cc.TiledLayer.getTileGIDAt(): pos should be non-null"); + var i = t; + if (void 0 === e && (i = t.x, + e = t.y), + this._isInvalidPosition(i, e)) + throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position"); + if (!this._tiles) + return cc.logID(7237), + null; + var n = Math.floor(i) + Math.floor(e) * this._layerSize.width; + return (this._tiles[n] & cc.TiledMap.TileFlag.FLIPPED_MASK) >>> 0 + }, + getTileFlagsAt: function(t, e) { + if (!t) + throw new Error("TiledLayer.getTileFlagsAt: pos should be non-null"); + if (void 0 !== e && (t = cc.v2(t, e)), + this._isInvalidPosition(t)) + throw new Error("TiledLayer.getTileFlagsAt: invalid position"); + if (!this._tiles) + return cc.logID(7240), + null; + var i = Math.floor(t.x) + Math.floor(t.y) * this._layerSize.width; + return (this._tiles[i] & cc.TiledMap.TileFlag.FLIPPED_ALL) >>> 0 + }, + _setCullingDirty: function(t) { + this._cullingDirty = t + }, + _isCullingDirty: function() { + return this._cullingDirty + }, + _updateViewPort: function(t, e, i, n) { + if (this._viewPort.width !== i || this._viewPort.height !== n || this._viewPort.x !== t || this._viewPort.y !== e) { + this._viewPort.x = t, + this._viewPort.y = e, + this._viewPort.width = i, + this._viewPort.height = n; + var r = 1; + this._layerOrientation === cc.TiledMap.Orientation.ISO && (r = 2); + var s = this._viewPort.x - this._offset.x + this._leftDownToCenterX + , a = this._viewPort.y - this._offset.y + this._leftDownToCenterY + , o = s - this._leftOffset + , l = a - this._downOffset + , h = s + i + this._rightOffset + , c = a + n + this._topOffset + , u = this._cullingRect.leftDown + , f = this._cullingRect.rightTop; + o < 0 && (o = 0), + l < 0 && (l = 0), + this._positionToRowCol(o, l, _), + _.row -= r, + _.col -= r, + _.row = _.row > 0 ? _.row : 0, + _.col = _.col > 0 ? _.col : 0, + _.row === u.row && _.col === u.col || (u.row = _.row, + u.col = _.col, + this._cullingDirty = !0), + h < 0 || c < 0 ? (_.row = -1, + _.col = -1) : (this._positionToRowCol(h, c, _), + _.row++, + _.col++), + _.row > this._rightTop.row && (_.row = this._rightTop.row), + _.col > this._rightTop.col && (_.col = this._rightTop.col), + _.row === f.row && _.col === f.col || (f.row = _.row, + f.col = _.col, + this._cullingDirty = !0) + } + }, + _positionToRowCol: function(t, e, i) { + var n = cc.TiledMap + , r = n.Orientation + , s = n.StaggerAxis + , a = this._mapTileSize.width + , o = this._mapTileSize.height + , l = .5 * a + , h = .5 * o + , c = 0 + , u = 0 + , _ = 0 + , f = 0 + , d = this._staggerAxis; + switch (this._layerSize.width, + this._layerOrientation) { + case r.ORTHO: + u = Math.floor(t / a), + c = Math.floor(e / o); + break; + case r.ISO: + u = Math.floor(t / l), + c = Math.floor(e / h); + break; + case r.HEX: + d === s.STAGGERAXIS_Y ? (_ = (c = Math.floor(e / (o - this._diffY1))) % 2 == 1 ? l * this._odd_even : 0, + u = Math.floor((t - _) / a)) : (f = (u = Math.floor(t / (a - this._diffX1))) % 2 == 1 ? h * -this._odd_even : 0, + c = Math.floor((e - f) / o)) + } + return i.row = c, + i.col = u, + i + }, + _updateCulling: function() { + if (this._enableCulling) { + this.node._updateWorldMatrix(), + n.Mat4.invert(l, this.node._worldMatrix); + var t = cc.visibleRect + , e = cc.Camera.findCamera(this.node); + e && (h.x = 0, + h.y = 0, + c.x = h.x + t.width, + c.y = h.y + t.height, + e.getScreenToWorldPoint(h, h), + e.getScreenToWorldPoint(c, c), + n.Vec2.transformMat4(h, h, l), + n.Vec2.transformMat4(c, c, l), + this._updateViewPort(h.x, h.y, c.x - h.x, c.y - h.y)) + } + }, + getLayerOrientation: function() { + return this._layerOrientation + }, + getProperties: function() { + return this._properties + }, + _updateVertex: function(t, e) { + var i = cc.TiledMap + , n = i.TileFlag.FLIPPED_MASK + , r = i.StaggerAxis + , s = i.Orientation + , a = this._vertices + , o = this._layerOrientation + , l = this._tiles; + if (l) { + var h, c, u, _, f, d, p, m = this._rightTop, y = this._mapTileSize.width, v = this._mapTileSize.height, g = .5 * y, A = .5 * v, x = this._layerSize.height, b = this._layerSize.width, C = this._texGrids; + o === s.HEX && (_ = this._staggerAxis, + f = this._diffX1, + d = this._diffY1, + p = this._odd_even); + var T, S, w, E, M = 0, D = 0, B = 0, I = 0, P = e * b + t; + if (h = C[S = (l[P] & n) >>> 0]) { + switch (this._animations[S] && (this._hasAniGrid = this._hasAniGrid || !0), + o) { + case s.ORTHO: + c = (M = t) * y, + u = (D = x - e - 1) * v; + break; + case s.ISO: + c = g * (M = x + t - e - 1), + u = A * (D = x + b - t - e - 2); + break; + case s.HEX: + c = t * (y - f) + (_ === r.STAGGERAXIS_Y && e % 2 == 1 ? g * p : 0), + u = (x - e - 1) * (v - d) + (_ === r.STAGGERAXIS_X && t % 2 == 1 ? A * -p : 0), + M = t, + D = x - e - 1 + } + var R = a[D] = a[D] || { + minCol: 0, + maxCol: 0 + } + , O = R[M] = R[M] || {}; + R.minCol > M && (R.minCol = M), + R.maxCol < M && (R.maxCol = M), + m.row < D && (m.row = D), + m.col < M && (m.col = M), + T = h.tileset.tileOffset, + c += this._offset.x + T.x, + u += this._offset.y - T.y, + B = (B = -T.y + h.tileset._tileSize.height - v) < 0 ? 0 : B, + w = T.y < 0 ? 0 : T.y, + E = -T.x < 0 ? 0 : -T.x, + I = (I = T.x + h.tileset._tileSize.width - y) < 0 ? 0 : I, + this._rightOffset < E && (this._rightOffset = E), + this._leftOffset < I && (this._leftOffset = I), + this._topOffset < w && (this._topOffset = w), + this._downOffset < B && (this._downOffset = B), + O.left = c, + O.bottom = u, + O.index = P, + this._cullingDirty = !0 + } + } + }, + _updateVertices: function() { + if (this._vertices.length = 0, + this._tiles) { + var t = this._rightTop; + t.row = -1, + t.col = -1; + var e = this._layerSize.height + , i = this._layerSize.width; + this._topOffset = 0, + this._downOffset = 0, + this._leftOffset = 0, + this._rightOffset = 0, + this._hasAniGrid = !1; + for (var n = 0; n < e; ++n) + for (var r = 0; r < i; ++r) + this._updateVertex(r, n); + this._verticesDirty = !1 + } + }, + getTiledTileAt: function(t, e, i) { + if (this._isInvalidPosition(t, e)) + throw new Error("TiledLayer.getTiledTileAt: invalid position"); + if (!this._tiles) + return cc.logID(7236), + null; + var n = Math.floor(t) + Math.floor(e) * this._layerSize.width + , r = this._tiledTiles[n]; + if (!r && i) { + var s = new cc.Node; + return (r = s.addComponent(cc.TiledTile))._x = t, + r._y = e, + r._layer = this, + r._updateInfo(), + s.parent = this.node, + r + } + return r + }, + setTiledTileAt: function(t, e, i) { + if (this._isInvalidPosition(t, e)) + throw new Error("TiledLayer.setTiledTileAt: invalid position"); + if (!this._tiles) + return cc.logID(7236), + null; + var n = Math.floor(t) + Math.floor(e) * this._layerSize.width; + return this._tiledTiles[n] = i, + this._cullingDirty = !0, + this._hasTiledNodeGrid = !!i || this._tiledTiles.some((function(t) { + return !!t + } + )), + i + }, + getTexture: function(t) { + return t = t || 0, + this._textures && t >= 0 && this._textures.length > t ? this._textures[t] : null + }, + getTextures: function() { + return this._textures + }, + setTexture: function(t) { + this.setTextures([t]) + }, + setTextures: function(t) { + this._textures = t, + this._activateMaterial() + }, + getLayerSize: function() { + return this._layerSize + }, + getMapTileSize: function() { + return this._mapTileSize + }, + getTileSet: function(t) { + return t = t || 0, + this._tilesets && t >= 0 && this._tilesets.length > t ? this._tilesets[t] : null + }, + getTileSets: function() { + return this._tilesets + }, + setTileSet: function(t) { + this.setTileSets([t]) + }, + setTileSets: function(t) { + this._tilesets = t; + for (var e = this._textures = [], i = this._texGrids = [], n = 0; n < t.length; n++) { + var r = t[n]; + r && (e[n] = r.sourceImage) + } + cc.TiledMap.loadAllTextures(e, function() { + for (var e = 0, n = t.length; e < n; ++e) { + var r = t[e]; + r && cc.TiledMap.fillTextureGrids(r, i, e) + } + this._prepareToRender() + } + .bind(this)) + }, + _traverseAllGrid: function() { + var t = this._tiles + , e = this._texGrids + , i = this._tilesetIndexArr + , n = this._tilesetIndexToArrIndex = {} + , r = cc.TiledMap.TileFlag.FLIPPED_MASK; + i.length = 0; + for (var s = 0; s < t.length; s++) { + var a = t[s]; + if (0 !== a) { + var o = e[a = (a & r) >>> 0]; + if (o) { + var l = o.texId; + void 0 === n[l] && (n[l] = i.length, + i.push(l)) + } else + cc.error("CCTiledLayer:_traverseAllGrid grid is null, gid is:", a) + } + } + }, + _init: function(t, e, i, n, r) { + this._cullingDirty = !0, + this._layerInfo = t, + this._mapInfo = e; + var s = t._layerSize; + this._layerName = t.name, + this._tiles = t._tiles, + this._properties = t.properties, + this._layerSize = s, + this._minGID = t._minGID, + this._maxGID = t._maxGID, + this._opacity = t._opacity, + this._renderOrder = e.renderOrder, + this._staggerAxis = e.getStaggerAxis(), + this._staggerIndex = e.getStaggerIndex(), + this._hexSideLength = e.getHexSideLength(), + this._animations = e.getTileAnimations(), + this._tilesets = i, + this._textures = n, + this._texGrids = r, + this._layerOrientation = e.orientation, + this._mapTileSize = e.getTileSize(); + var a = this._mapTileSize.width + , o = this._mapTileSize.height + , l = this._layerSize.width + , h = this._layerSize.height; + if (this._layerOrientation === cc.TiledMap.Orientation.HEX) { + var c = cc.TiledMap + , u = c.StaggerAxis + , _ = c.StaggerIndex + , f = 0 + , d = 0; + this._odd_even = this._staggerIndex === _.STAGGERINDEX_ODD ? 1 : -1, + this._staggerAxis === u.STAGGERAXIS_X ? (this._diffX1 = (a - this._hexSideLength) / 2, + this._diffY1 = 0, + d = o * (h + .5), + f = (a + this._hexSideLength) * Math.floor(l / 2) + a * (l % 2)) : (this._diffX1 = 0, + this._diffY1 = (o - this._hexSideLength) / 2, + f = a * (l + .5), + d = (o + this._hexSideLength) * Math.floor(h / 2) + o * (h % 2)), + this.node.setContentSize(f, d) + } else if (this._layerOrientation === cc.TiledMap.Orientation.ISO) { + var p = l + h; + this.node.setContentSize(.5 * a * p, .5 * o * p) + } else + this.node.setContentSize(l * a, h * o); + this._offset = cc.v2(t.offset.x, -t.offset.y), + this._useAutomaticVertexZ = !1, + this._vertexZvalue = 0, + this._syncAnchorPoint(), + this._prepareToRender() + }, + _prepareToRender: function() { + this._updateVertices(), + this._traverseAllGrid(), + this._updateAllUserNode(), + this._activateMaterial() + }, + _buildMaterial: function(t) { + var e = this._texIdToMatIndex; + if (void 0 !== e[t]) + return null; + var i = this._tilesetIndexArr + , n = this._tilesetIndexToArrIndex + , s = n[t]; + void 0 === s && (n[t] = s = i.length, + i.push(t)); + var o = this._textures[t] + , l = this._materials[s]; + return l || (l = a.getBuiltinMaterial("2d-sprite")), + (l = r.default.create(l, this)).define("CC_USE_MODEL", !0), + l.setProperty("texture", o), + this._materials[s] = l, + e[t] = s, + l + }, + _activateMaterial: function() { + var t = this._tilesetIndexArr; + if (0 !== t.length) { + for (var e = t.length, i = 0; i < e; i++) + this._buildMaterial(t[i]); + this._materials.length = e, + this.markForRender(!0) + } else + this.disableRender() + } + }); + cc.TiledLayer = e.exports = d + } + ), { + "../core/assets/material/CCMaterial": 80, + "../core/assets/material/material-variant": 87, + "../core/components/CCRenderComponent": 115, + "../core/renderer/render-flow": 225, + "../core/value-types": 282 + }], + 341: [(function(t, e) { + "use strict"; + t("./CCTMXXMLParser"), + t("./CCTiledMapAsset"), + t("./CCTiledLayer"), + t("./CCTiledTile"), + t("./CCTiledObjectGroup"); + var i = cc.Enum({ + ORTHO: 0, + HEX: 1, + ISO: 2 + }) + , n = cc.Enum({ + NONE: 0, + MAP: 1, + LAYER: 2, + OBJECTGROUP: 3, + OBJECT: 4, + TILE: 5 + }) + , r = cc.Enum({ + HORIZONTAL: 2147483648, + VERTICAL: 1073741824, + DIAGONAL: 536870912, + FLIPPED_ALL: 4026531840, + FLIPPED_MASK: 268435455 + }) + , s = cc.Enum({ + STAGGERAXIS_X: 0, + STAGGERAXIS_Y: 1 + }) + , a = cc.Enum({ + STAGGERINDEX_ODD: 0, + STAGGERINDEX_EVEN: 1 + }) + , o = cc.Enum({ + RightDown: 0, + RightUp: 1, + LeftDown: 2, + LeftUp: 3 + }) + , l = cc.Enum({ + RECT: 0, + ELLIPSE: 1, + POLYGON: 2, + POLYLINE: 3, + IMAGE: 4, + TEXT: 5 + }) + , h = cc.Class({ + name: "cc.TiledMap", + extends: cc.Component, + editor: !1, + ctor: function() { + this._texGrids = [], + this._textures = [], + this._tilesets = [], + this._animations = [], + this._imageLayers = [], + this._layers = [], + this._groups = [], + this._images = [], + this._properties = [], + this._tileProperties = [], + this._mapSize = cc.size(0, 0), + this._tileSize = cc.size(0, 0) + }, + statics: { + Orientation: i, + Property: n, + TileFlag: r, + StaggerAxis: s, + StaggerIndex: a, + TMXObjectType: l, + RenderOrder: o + }, + properties: { + _tmxFile: { + default: null, + type: cc.TiledMapAsset + }, + tmxAsset: { + get: function() { + return this._tmxFile + }, + set: function(t) { + this._tmxFile !== t && (this._tmxFile = t, + this._applyFile()) + }, + type: cc.TiledMapAsset + } + }, + getMapSize: function() { + return this._mapSize + }, + getTileSize: function() { + return this._tileSize + }, + getMapOrientation: function() { + return this._mapOrientation + }, + getObjectGroups: function() { + return this._groups + }, + getObjectGroup: function(t) { + for (var e = this._groups, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r && r.getGroupName() === t) + return r + } + return null + }, + enableCulling: function(t) { + for (var e = this._layers, i = 0; i < e.length; ++i) + e[i].enableCulling(t) + }, + getProperties: function() { + return this._properties + }, + getLayers: function() { + return this._layers + }, + getLayer: function(t) { + for (var e = this._layers, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r && r.getLayerName() === t) + return r + } + return null + }, + _changeLayer: function(t, e) { + for (var i = this._layers, n = 0, r = i.length; n < r; n++) { + var s = i[n]; + if (s && s.getLayerName() === t) + return void (i[n] = e) + } + }, + getProperty: function(t) { + return this._properties[t.toString()] + }, + getPropertiesForGID: function(t) { + return this._tileProperties[t] + }, + __preload: function() { + this._tmxFile && this._applyFile() + }, + onEnable: function() { + this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this) + }, + onDisable: function() { + this.node.off(cc.Node.EventType.ANCHOR_CHANGED, this._syncAnchorPoint, this) + }, + _applyFile: function() { + var t = this._tmxFile; + if (t) { + for (var e = t.textures, i = t.textureNames, n = t.textureSizes, r = {}, s = {}, a = 0; a < e.length; ++a) { + var o = i[a]; + r[o] = e[a], + s[o] = n[a] + } + var l = {}; + e = t.imageLayerTextures, + i = t.imageLayerTextureNames; + for (var h = 0; h < e.length; ++h) + l[i[h]] = e[h]; + for (var c = t.tsxFileNames, u = t.tsxFiles, _ = {}, f = 0; f < c.length; ++f) + c[f].length > 0 && (_[c[f]] = u[f].text); + var d = new cc.TMXMapInfo(t.tmxXmlStr,_,r,s,l) + , p = d.getTilesets(); + p && 0 !== p.length || cc.logID(7241), + this._buildWithMapInfo(d) + } else + this._releaseMapInfo() + }, + _releaseMapInfo: function() { + for (var t = this._layers, e = 0, i = t.length; e < i; e++) + t[e].node.removeFromParent(!0), + t[e].node.destroy(); + t.length = 0; + for (var n = this._groups, r = 0, s = n.length; r < s; r++) + n[r].node.removeFromParent(!0), + n[r].node.destroy(); + n.length = 0; + for (var a = this._images, o = 0, l = a.length; o < l; o++) + a[o].removeFromParent(!0), + a[o].destroy(); + a.length = 0 + }, + _syncAnchorPoint: function() { + var t, e, i = this.node.getAnchorPoint(), n = this.node.width * i.x, r = this.node.height * (1 - i.y); + for (t = 0, + e = this._layers.length; t < e; t++) + this._layers[t].node.setAnchorPoint(i); + for (t = 0, + e = this._groups.length; t < e; t++) { + var s = this._groups[t] + , a = s.node; + a.anchorX = .5, + a.anchorY = .5, + a.x = s._offset.x - n + a.width * a.anchorX, + a.y = s._offset.y + r - a.height * a.anchorY + } + for (t = 0, + e = this._images.length; t < e; t++) { + var o = this._images[t]; + o.anchorX = .5, + o.anchorY = .5, + o.x = o._offset.x - n + o.width * o.anchorX, + o.y = o._offset.y + r - o.height * o.anchorY + } + }, + _fillAniGrids: function(t, e) { + for (var i in e) { + var n = e[i]; + if (n) + for (var r = n.frames, s = 0; s < r.length; s++) { + var a = r[s]; + a.grid = t[a.tileid] + } + } + }, + _buildLayerAndGroup: function() { + var t = this._tilesets + , e = this._texGrids + , i = this._animations; + e.length = 0; + for (var n = 0, r = t.length; n < r; ++n) { + var s = t[n]; + s && cc.TiledMap.fillTextureGrids(s, e, n) + } + this._fillAniGrids(e, i); + for (var a = this._layers, o = this._groups, l = this._images, h = {}, c = 0, u = a.length; c < u; c++) + h[a[c].node._name] = !0; + for (var _ = 0, f = o.length; _ < f; _++) + h[o[_].node._name] = !0; + for (var d = 0, p = l.length; d < p; d++) + h[l[d]._name] = !0; + a = this._layers = [], + o = this._groups = [], + l = this._images = []; + var m = this._mapInfo + , y = this.node + , v = m.getAllChildren() + , g = this._textures + , A = 0 + , x = 0; + if (v && v.length > 0) + for (var b = 0, C = v.length; b < C; b++) { + var T = v[b] + , S = T.name + , w = this.node.getChildByName(S); + if (h[S] = !1, + w || ((w = new cc.Node).name = S, + y.addChild(w)), + w.setSiblingIndex(b), + w.active = T.visible, + T instanceof cc.TMXLayerInfo) { + var E = w.getComponent(cc.TiledLayer); + E || (E = w.addComponent(cc.TiledLayer)), + E._init(T, m, t, g, e), + T.ownTiles = !1, + a.push(E) + } else if (T instanceof cc.TMXObjectGroupInfo) { + var M = w.getComponent(cc.TiledObjectGroup); + M || (M = w.addComponent(cc.TiledObjectGroup)), + M._init(T, m, e), + o.push(M) + } else if (T instanceof cc.TMXImageLayerInfo) { + var D = T.sourceImage; + w.opacity = T.opacity, + w.layerInfo = T, + w._offset = cc.v2(T.offset.x, -T.offset.y); + var B = w.getComponent(cc.Sprite); + B || (B = w.addComponent(cc.Sprite)); + var I = B.spriteFrame || new cc.SpriteFrame; + I.setTexture(D), + B.spriteFrame = I, + w.width = D.width, + w.height = D.height, + l.push(w) + } + A = Math.max(A, w.width), + x = Math.max(x, w.height) + } + for (var P = y.children, R = 0, O = P.length; R < O; R++) { + var L = P[R]; + h[L._name] && L.destroy() + } + this.node.width = A, + this.node.height = x, + this._syncAnchorPoint() + }, + _buildWithMapInfo: function(t) { + this._mapInfo = t, + this._mapSize = t.getMapSize(), + this._tileSize = t.getTileSize(), + this._mapOrientation = t.orientation, + this._properties = t.properties, + this._tileProperties = t.getTileProperties(), + this._imageLayers = t.getImageLayers(), + this._animations = t.getTileAnimations(), + this._tilesets = t.getTilesets(); + var e = this._tilesets; + this._textures.length = 0; + for (var i = [], n = 0, r = e.length; n < r; ++n) { + var s = e[n]; + s && s.sourceImage && (this._textures[n] = s.sourceImage, + i.push(s.sourceImage)) + } + for (var a = 0; a < this._imageLayers.length; a++) { + var o = this._imageLayers[a]; + o && o.sourceImage && i.push(o.sourceImage) + } + cc.TiledMap.loadAllTextures(i, function() { + this._buildLayerAndGroup() + } + .bind(this)) + }, + update: function(t) { + var e = this._animations + , i = this._texGrids; + for (var n in e) { + var r = e[n] + , s = r.frames + , a = s[r.frameIdx]; + r.dt += t, + a.duration < r.dt && (r.dt = 0, + r.frameIdx++, + r.frameIdx >= s.length && (r.frameIdx = 0), + a = s[r.frameIdx]), + i[n] = a.grid + } + } + }); + cc.TiledMap = e.exports = h, + cc.TiledMap.loadAllTextures = function(t, e) { + var i = t.length; + if (0 !== i) + for (var n = 0, r = function() { + ++n >= i && e() + }, s = 0; s < i; s++) { + var a = t[s]; + a.loaded ? r() : a.once("load", (function() { + r() + } + )) + } + else + e() + } + , + cc.TiledMap.fillTextureGrids = function(t, e, i) { + var n = t.sourceImage; + t.imageSize.width && t.imageSize.height || (t.imageSize.width = n.width, + t.imageSize.height = n.height); + var r = t._tileSize.width + , s = t._tileSize.height + , a = n.width + , o = n.height + , l = t.spacing + , h = t.margin + , c = Math.floor((a - 2 * h + l) / (r + l)) + , u = Math.floor((o - 2 * h + l) / (s + l)) * c + , _ = t.firstGid + , f = null + , d = !!e[_] + , p = cc.macro.FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX ? .5 : 0; + u <= 0 && (u = 1); + for (var m = t.firstGid + u; _ < m && (d && !e[_] && (d = !1), + d || !e[_]); ++_) + f = { + texId: i, + tileset: t, + x: 0, + y: 0, + width: r, + height: s, + t: 0, + l: 0, + r: 0, + b: 0, + gid: _ + }, + t.rectForGID(_, f), + f.x += p, + f.y += p, + f.width -= 2 * p, + f.height -= 2 * p, + f.t = f.y / o, + f.l = f.x / a, + f.r = (f.x + f.width) / a, + f.b = (f.y + f.height) / o, + e[_] = f + } + , + cc.js.obsolete(cc.TiledMap.prototype, "cc.TiledMap.tmxFile", "tmxAsset", !0), + cc.js.get(cc.TiledMap.prototype, "mapLoaded", (function() { + return cc.errorID(7203), + [] + } + ), !1) + } + ), { + "./CCTMXXMLParser": 339, + "./CCTiledLayer": 340, + "./CCTiledMapAsset": 342, + "./CCTiledObjectGroup": 344, + "./CCTiledTile": 345 + }], + 342: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.TiledMapAsset", + extends: cc.Asset, + properties: { + tmxXmlStr: "", + textures: { + default: [], + type: [cc.Texture2D] + }, + textureNames: [cc.String], + textureSizes: { + default: [], + type: [cc.Size] + }, + imageLayerTextures: { + default: [], + type: [cc.Texture2D] + }, + imageLayerTextureNames: [cc.String], + tsxFiles: [cc.TextAsset], + tsxFileNames: [cc.String] + }, + statics: { + preventDeferredLoadDependents: !0 + }, + createNode: !1 + }); + cc.TiledMapAsset = i, + e.exports = i + } + ), {}], + 343: [(function(t, e) { + "use strict"; + var i, n = (i = t("../renderer/core/input-assembler")) && i.__esModule ? i : { + default: i + }, r = cc.Class({ + name: "cc.TiledMapRenderDataList", + ctor: function() { + this._dataList = [], + this._offset = 0 + }, + _pushRenderData: function() { + var t = {}; + t.ia = new n.default, + t.nodesRenderList = [], + this._dataList.push(t) + }, + popRenderData: function(t) { + this._offset >= this._dataList.length && this._pushRenderData(); + var e = this._dataList[this._offset]; + e.nodesRenderList.length = 0; + var i = e.ia; + return i._vertexBuffer = t._vb, + i._indexBuffer = t._ib, + i._start = t.indiceOffset, + i._count = 0, + this._offset++, + e + }, + pushNodesList: function(t, e) { + t.nodesRenderList.push(e) + }, + reset: function() { + this._offset = 0 + } + }); + cc.TiledMapRenderDataList = e.exports = r + } + ), { + "../renderer/core/input-assembler": 305 + }], + 344: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.TiledObjectGroup", + extends: cc.Component, + getPositionOffset: function() { + return this._positionOffset + }, + getProperties: function() { + this._properties + }, + getGroupName: function() { + return this._groupName + }, + getProperty: function(t) { + return this._properties[t.toString()] + }, + getObject: function(t) { + for (var e = 0, i = this._objects.length; e < i; e++) { + var n = this._objects[e]; + if (n && n.name === t) + return n + } + return null + }, + getObjects: function() { + return this._objects + }, + _init: function(t, e, i) { + var n = cc.TiledMap + , r = n.TMXObjectType + , s = n.Orientation + , a = n.StaggerAxis + , o = n.TileFlag + , l = o.FLIPPED_MASK + , h = o.HORIZONTAL + , c = o.VERTICAL; + this._groupName = t.name, + this._positionOffset = t.offset, + this._mapInfo = e, + this._properties = t.getProperties(), + this._offset = cc.v2(t.offset.x, -t.offset.y), + this._opacity = t._opacity; + var u = e._mapSize + , _ = e._tileSize + , f = 0 + , d = 0; + if (e.orientation === s.HEX) + e.getStaggerAxis() === a.STAGGERAXIS_X ? (d = _.height * (u.height + .5), + f = (_.width + e.getHexSideLength()) * Math.floor(u.width / 2) + _.width * (u.width % 2)) : (f = _.width * (u.width + .5), + d = (_.height + e.getHexSideLength()) * Math.floor(u.height / 2) + _.height * (u.height % 2)); + else if (e.orientation === s.ISO) { + var p = u.width + u.height; + f = .5 * _.width * p, + d = .5 * _.height * p + } else + f = u.width * _.width, + d = u.height * _.height; + this.node.setContentSize(f, d); + for (var m = f * this.node.anchorX, y = d * (1 - this.node.anchorY), v = t._objects, g = {}, A = 0, x = v.length; A < x; A++) { + var b = v[A] + , C = b.type; + b.offset = cc.v2(b.x, b.y); + var T = b.points || b.polylinePoints; + if (T) + for (var S = 0; S < T.length; S++) + T[S].y *= -1; + if (s.ISO !== e.orientation) + b.y = d - b.y; + else { + var w = b.x / _.height + , E = b.y / _.height; + b.x = .5 * _.width * (u.height + w - E), + b.y = .5 * _.height * (u.width + u.height - w - E) + } + if (C === r.TEXT) { + var M = "text" + b.id; + g[M] = !0; + var D = this.node.getChildByName(M); + D || (D = new cc.Node), + D.active = b.visible, + D.anchorX = 0, + D.anchorY = 1, + D.angle = -b.rotation, + D.x = b.x - m, + D.y = b.y - y, + D.name = M, + D.parent = this.node, + D.color = b.color, + D.opacity = this._opacity, + D.setSiblingIndex(A); + var B = D.getComponent(cc.Label); + B || (B = D.addComponent(cc.Label)), + B.overflow = cc.Label.Overflow.SHRINK, + B.lineHeight = b.height, + B.string = b.text, + B.horizontalAlign = b.halign, + B.verticalAlign = b.valign, + B.fontSize = b.pixelsize, + D.width = b.width, + D.height = b.height + } + if (C === r.IMAGE) { + var I = b.gid + , P = i[(I & l) >>> 0]; + if (!P) + continue; + var R = P.tileset + , O = "img" + b.id; + g[O] = !0; + var L = this.node.getChildByName(O) + , F = b.width || P.width + , V = b.height || P.height + , N = R.tileOffset.x + , k = R.tileOffset.y; + L instanceof cc.PrivateNode && (L.removeFromParent(), + L.destroy(), + L = null), + L || (L = new cc.Node), + s.ISO == e.orientation ? (L.anchorX = .5 + N / F, + L.anchorY = k / V) : (L.anchorX = N / F, + L.anchorY = k / V), + L.active = b.visible, + L.angle = -b.rotation, + L.x = b.x - m, + L.y = b.y - y, + L.name = O, + L.parent = this.node, + L.opacity = this._opacity, + L.setSiblingIndex(A); + var G = L.getComponent(cc.Sprite); + G || (G = L.addComponent(cc.Sprite)); + var U = G.spriteFrame; + U || (U = new cc.SpriteFrame), + (I & h) >>> 0 ? U.setFlipX(!0) : U.setFlipX(!1), + (I & c) >>> 0 ? U.setFlipY(!0) : U.setFlipY(!1), + U.setTexture(P.tileset.sourceImage, cc.rect(P)), + G.spriteFrame = U, + G.setVertsDirty(), + L.width = F, + L.height = V + } + } + this._objects = v; + for (var z = this.node.children, H = /^(?:img|text)\d+$/, W = 0, j = z.length; W < j; W++) { + var X = z[W] + , Y = X._name; + H.test(Y) && !g[Y] && X.destroy() + } + } + }); + cc.TiledObjectGroup = e.exports = i + } + ), {}], + 345: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.TiledTile", + extends: cc.Component, + editor: !1, + ctor: function() { + this._layer = null + }, + properties: { + _x: 0, + _y: 0, + x: { + get: function() { + return this._x + }, + set: function(t) { + t !== this._x && (this._layer && this._layer._isInvalidPosition(t, this._y) ? cc.warn("Invalid x, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.width) : (this._resetTile(), + this._x = t, + this._updateInfo())) + }, + type: cc.Integer + }, + y: { + get: function() { + return this._y + }, + set: function(t) { + t !== this._y && (this._layer && this._layer._isInvalidPosition(this._x, t) ? cc.warn("Invalid y, the valid value is between [%s] ~ [%s]", 0, this._layer._layerSize.height) : (this._resetTile(), + this._y = t, + this._updateInfo())) + }, + type: cc.Integer + }, + gid: { + get: function() { + return this._layer ? this._layer.getTileGIDAt(this._x, this._y) : 0 + }, + set: function(t) { + this._layer && this._layer.setTileGIDAt(t, this._x, this._y) + }, + type: cc.Integer + } + }, + onEnable: function() { + var t = this.node.parent; + this._layer = t.getComponent(cc.TiledLayer), + this._resetTile(), + this._updateInfo() + }, + onDisable: function() { + this._resetTile() + }, + _resetTile: function() { + this._layer && this._layer.getTiledTileAt(this._x, this._y) === this && this._layer.setTiledTileAt(this._x, this._y, null) + }, + _updateInfo: function() { + if (this._layer) { + var t = this._x + , e = this._y; + this._layer.getTiledTileAt(t, e) ? cc.warn("There is already a TiledTile at [%s, %s]", t, e) : (this.node.setPosition(this._layer.getPositionAt(t, e)), + this._layer.setTiledTileAt(t, e, this)) + } + } + }); + cc.TiledTile = e.exports = i + } + ), {}], + 346: [(function(t) { + "use strict"; + t("./CCTiledMap"), + t("./CCTiledMapRenderDataList"), + t("./tiledmap-buffer"), + t("./tmx-layer-assembler") + } + ), { + "./CCTiledMap": 341, + "./CCTiledMapRenderDataList": 343, + "./tiledmap-buffer": 347, + "./tmx-layer-assembler": 348 + }], + 347: [(function(t, e) { + "use strict"; + var i = cc.Class({ + name: "cc.TiledMapBuffer", + extends: t("../core/renderer/webgl/quad-buffer"), + _updateOffset: function() { + var t = this._offsetInfo; + t.vertexOffset = this.vertexOffset, + t.indiceOffset = this.indiceOffset, + t.byteOffset = this.byteOffset + }, + adjust: function(t, e) { + this.vertexOffset += t, + this.indiceOffset += e, + this.indiceStart = this.indiceOffset, + this.byteOffset = this.byteOffset + t * this._vertexBytes, + this._dirty = !0 + } + }); + cc.TiledMapBuffer = e.exports = i + } + ), { + "../core/renderer/webgl/quad-buffer": 253 + }], + 348: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../core/renderer/assembler")) && n.__esModule ? n : { + default: n + }, s = t("../core/value-types"); + function a(t, e) { + return (a = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var o = t("./CCTiledLayer") + , l = t("./CCTiledMap") + , h = l.TileFlag + , c = h.FLIPPED_MASK + , u = t("../core/renderer/") + , _ = t("../core/renderer/webgl/vertex-format").vfmtPosUvColor + , f = parseInt(10922.5) + , d = l.RenderOrder + , p = t("../core/renderer/render-flow") + , m = cc.mat4() + , y = cc.v3() + , v = { + row: 0, + col: 0 + } + , g = { + x: 0, + y: 0 + } + , A = { + x: 0, + y: 0 + } + , x = { + x: 0, + y: 0 + } + , b = { + x: 0, + y: 0 + } + , C = null + , T = null + , S = 0 + , w = 0 + , E = 0 + , M = 0 + , D = null + , B = null + , I = null + , P = null + , R = null + , O = null + , L = null + , F = null; + function V(t) { + t._updateLocalMatrix(), + s.Mat4.mul(t._worldMatrix, D, t._matrix), + t._renderFlag &= ~(p.FLAG_TRANSFORM | p.FLAG_BREAK_FLOW), + p.visitRootNode(t), + t._renderFlag |= p.FLAG_BREAK_FLOW + } + function N() { + 0 !== T._count && (B.material = C.material, + B.node = O.node, + B._flushIA(C.ia), + S >= f ? (P.uploadData(), + P.switchBuffer(), + L = P._vData, + F = P._uintVData, + C = I.popRenderData(P), + T = C.ia, + w = 0, + S = 0) : (C = I.popRenderData(P), + T = C.ia), + C.material = R) + } + function k(t, e) { + var i = O._getNodesByRowCol(t, e); + if (i && 0 != i.count) { + var n = i.list + , r = 0 + , s = 0; + for (N(), + B.worldMatDirty++; r < i.count; ) { + var a = n[s]; + s++, + a && (V(a.node), + r !== s && (n[r] = a, + a._index = r), + r++) + } + n.length = r, + B.worldMatDirty--, + I.pushNodesList(C, n), + B._flush(), + B.node = O.node + } + } + function G(t, e) { + g.x = t.l, + g.y = t.t, + A.x = t.r, + A.y = t.t, + x.x = t.l, + x.y = t.b, + b.x = t.r, + b.y = t.b; + var i = null; + (e & h.DIAGONAL) >>> 0 && (i = A, + A = x, + x = i), + (e & h.HORIZONTAL) >>> 0 && (i = g, + g = A, + A = i, + i = x, + x = b, + b = i), + (e & h.VERTICAL) >>> 0 && (i = g, + g = x, + x = i, + i = A, + A = b, + b = i) + } + var U = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + a(e, i); + var r = n.prototype; + return r.updateRenderData = function(t) { + t._renderDataList || (t._buffer = new cc.TiledMapBuffer(u._handle,_), + t._renderDataList = new cc.TiledMapRenderDataList) + } + , + r.fillBuffers = function(t, e) { + if (0 !== t._vertices.length) { + t._updateCulling(); + var i = t.node; + if (E = t._leftDownToCenterX, + M = t._leftDownToCenterY, + D = i._worldMatrix, + B = e, + O = t, + I = t._renderDataList, + P = t._buffer, + t._isCullingDirty() || t._isUserNodeDirty() || t._hasAnimation() || t._hasTiledNode()) { + var n, r; + if (P.reset(), + t._enableCulling) { + var s = t._cullingRect; + n = s.leftDown, + r = s.rightTop + } else + n = v, + r = t._rightTop; + var a = (r.row - n.row + 1) * (r.col - n.col + 1); + switch (a > f && (a = f), + P.request(4 * a, 6 * a), + t._renderOrder) { + case d.RightDown: + this.traverseGrids(n, r, -1, 1); + break; + case d.LeftDown: + this.traverseGrids(n, r, -1, -1); + break; + case d.RightUp: + this.traverseGrids(n, r, 1, 1); + break; + case d.LeftUp: + this.traverseGrids(n, r, 1, -1) + } + t._setCullingDirty(!1), + t._setUserNodeDirty(!1) + } else + for (var o = null, l = null, h = null, c = 0; c < I._offset; c++) { + if ((l = (o = I._dataList[c]).nodesRenderList).length > 0) { + e.worldMatDirty++; + for (var u = 0; u < l.length; u++) + if (h = l[u]) + for (var _ = 0; _ < h.length; _++) { + var p = h[_]; + p && V(p.node) + } + e.worldMatDirty--, + e._flush() + } + o.ia._count > 0 && (e.material = o.material, + e.node = i, + e._flushIA(o.ia)) + } + C = null, + T = null, + D = null, + B = null, + I = null, + P = null, + R = null, + O = null, + L = null, + F = null + } + } + , + r.traverseGrids = function(t, e, i, n) { + if (I.reset(), + !(e.row < 0 || e.col < 0)) { + C = I.popRenderData(P), + T = C.ia, + L = P._vData, + F = P._uintVData, + S = 0, + w = 0, + R = null; + var r = O.node + , s = (r.parent ? r.parent._opacity / 255 : 1) * r._opacity; + r._color._fastSetA(s); + var a, o, l, h, u, _, d, p, m = r._color._val, y = O._tiledTiles, v = O._texGrids, D = O._tiles, V = O._texIdToMatIndex, U = O._materials, z = O._vertices, H = null, W = 0, j = 0, X = 0, Y = 0, q = 0, J = null, Z = -1, K = 0, Q = !0; + for (-1 == i ? (h = e.row, + u = t.row) : (h = t.row, + u = e.row); (u - h) * i >= 0; h += i) + for (a = z[h], + Q = 0 == (K = O._getNodesCountByRow(h)) && null != a, + 1 == n ? (o = Q && t.col < a.minCol ? a.minCol : t.col, + l = Q && e.col > a.maxCol ? a.maxCol : e.col) : (o = Q && e.col > a.maxCol ? a.maxCol : e.col, + l = Q && t.col < a.minCol ? a.minCol : t.col); (l - o) * n >= 0; o += n) + (_ = a && a[o]) ? (H = v[((W = D[_.index]) & c) >>> 0]) && (Z !== H.texId && (-1 !== Z && N(), + p = V[Z = H.texId], + R = U[p], + C.material = R), + R && (j = _.left - E, + X = _.bottom - M, + Y = j + (d = H.tileset._tileSize).width, + q = X + d.height, + (J = y[_.index]) ? J.node.active && (J.node._color._fastSetA(J.node._opacity * s / 255), + this.fillByTiledNode(J.node, L, F, j, Y, q, X)) : (L[w] = j, + L[w + 1] = q, + F[w + 4] = m, + L[w + 5] = j, + L[w + 6] = X, + F[w + 9] = m, + L[w + 10] = Y, + L[w + 11] = q, + F[w + 14] = m, + L[w + 15] = Y, + L[w + 16] = X, + F[w + 19] = m), + G(H, W), + L[w + 2] = g.x, + L[w + 3] = g.y, + L[w + 7] = x.x, + L[w + 8] = x.y, + L[w + 12] = A.x, + L[w + 13] = A.y, + L[w + 17] = b.x, + L[w + 18] = b.y, + w += 20, + P.adjust(4, 6), + T._count += 6, + S++, + K > 0 && k(h, o), + S >= f && N())) : K > 0 && k(h, o); + P.uploadData(), + T._count > 0 && (B.material = C.material, + B.node = O.node, + B._flushIA(C.ia)) + } + } + , + r.fillByTiledNode = function(t, e, i, n, r, a, o) { + t._updateLocalMatrix(), + s.Mat4.copy(m, t._matrix), + s.Vec3.set(y, -(n + E), -(o + M), 0), + s.Mat4.transform(m, m, y); + var l = m.m + , h = l[0] + , c = l[1] + , u = l[4] + , _ = l[5] + , f = l[12] + , d = l[13] + , p = t._color._val; + e[w] = n * h + a * u + f, + e[w + 1] = n * c + a * _ + d, + i[w + 4] = p, + e[w + 5] = n * h + o * u + f, + e[w + 6] = n * c + o * _ + d, + i[w + 9] = p, + e[w + 10] = r * h + a * u + f, + e[w + 11] = r * c + a * _ + d, + i[w + 14] = p, + e[w + 15] = r * h + o * u + f, + e[w + 16] = r * c + o * _ + d, + i[w + 19] = p + } + , + n + } + )(r.default); + i.default = U, + r.default.register(o, U), + e.exports = i.default + } + ), { + "../core/renderer/": 224, + "../core/renderer/assembler": 221, + "../core/renderer/render-flow": 225, + "../core/renderer/webgl/vertex-format": 256, + "../core/value-types": 282, + "./CCTiledLayer": 340, + "./CCTiledMap": 341 + }], + 349: [(function(t, e) { + "use strict"; + var i = t("./video-player-impl") + , n = i.EventType + , r = cc.Enum({ + REMOTE: 0, + LOCAL: 1 + }) + , s = cc.Class({ + name: "cc.VideoPlayer", + extends: cc.Component, + editor: !1, + properties: { + _resourceType: r.REMOTE, + resourceType: { + tooltip: !1, + type: r, + set: function(t) { + this._resourceType = t, + this._updateVideoSource() + }, + get: function() { + return this._resourceType + } + }, + _remoteURL: "", + remoteURL: { + tooltip: !1, + type: cc.String, + set: function(t) { + this._remoteURL = t, + this._updateVideoSource() + }, + get: function() { + return this._remoteURL + } + }, + _clip: { + default: null, + type: cc.Asset + }, + clip: { + tooltip: !1, + get: function() { + return this._clip + }, + set: function(t) { + this._clip = t, + this._updateVideoSource() + }, + type: cc.Asset + }, + currentTime: { + tooltip: !1, + type: cc.Float, + set: function(t) { + this._impl && this._impl.seekTo(t) + }, + get: function() { + return this._impl ? this._currentStatus === n.NONE || this._currentStatus === n.STOPPED || this._currentStatus === n.META_LOADED || this._currentStatus === n.READY_TO_PLAY ? 0 : this._currentStatus === n.COMPLETED ? this._impl.duration() : this._impl.currentTime() : -1 + } + }, + _volume: 1, + volume: { + get: function() { + return this._volume + }, + set: function(t) { + this._volume = t, + this.isPlaying() && !this._mute && this._syncVolume() + }, + range: [0, 1], + type: cc.Float, + tooltip: !1 + }, + _mute: !1, + mute: { + get: function() { + return this._mute + }, + set: function(t) { + this._mute = t, + this._syncVolume() + }, + tooltip: !1 + }, + keepAspectRatio: { + tooltip: !1, + default: !0, + type: cc.Boolean, + notify: function() { + this._impl && this._impl.setKeepAspectRatioEnabled(this.keepAspectRatio) + } + }, + _isFullscreen: { + default: !1, + formerlySerializedAs: "_N$isFullscreen" + }, + isFullscreen: { + get: function() { + return this._isFullscreen = this._impl && this._impl.isFullScreenEnabled(), + this._isFullscreen + }, + set: function(t) { + this._isFullscreen = t, + this._impl && this._impl.setFullScreenEnabled(t) + }, + animatable: !1, + tooltip: !1 + }, + _stayOnBottom: !1, + stayOnBottom: { + get: function() { + return this._stayOnBottom + }, + set: function(t) { + this._stayOnBottom = t, + this._impl && this._impl.setStayOnBottom(t) + }, + animatable: !1, + tooltip: !1 + }, + videoPlayerEvent: { + default: [], + type: cc.Component.EventHandler + } + }, + statics: { + EventType: n, + ResourceType: r, + Impl: i + }, + ctor: function() { + this._impl = new i, + this._currentStatus = n.NONE + }, + _syncVolume: function() { + var t = this._impl; + if (t) { + var e = this._mute ? 0 : this._volume; + t.setVolume(e) + } + }, + _updateVideoSource: function() { + var t = ""; + this.resourceType === r.REMOTE ? t = this.remoteURL : this._clip && (t = this._clip.nativeUrl), + this._impl.setURL(t, this._mute || 0 === this._volume), + this._impl.setKeepAspectRatioEnabled(this.keepAspectRatio) + }, + onLoad: function() { + var t = this._impl; + t && (t.createDomElementIfNeeded(this._mute || 0 === this._volume), + t.setStayOnBottom(this._stayOnBottom), + this._updateVideoSource(), + t.seekTo(this.currentTime), + t.setFullScreenEnabled(this._isFullscreen), + this.pause(), + t.setEventListener(n.PLAYING, this.onPlaying.bind(this)), + t.setEventListener(n.PAUSED, this.onPasued.bind(this)), + t.setEventListener(n.STOPPED, this.onStopped.bind(this)), + t.setEventListener(n.COMPLETED, this.onCompleted.bind(this)), + t.setEventListener(n.META_LOADED, this.onMetaLoaded.bind(this)), + t.setEventListener(n.CLICKED, this.onClicked.bind(this)), + t.setEventListener(n.READY_TO_PLAY, this.onReadyToPlay.bind(this))) + }, + onRestore: function() { + this._impl || (this._impl = new i) + }, + onEnable: function() { + this._impl && this._impl.enable() + }, + onDisable: function() { + this._impl && this._impl.disable() + }, + onDestroy: function() { + this._impl && (this._impl.destroy(), + this._impl = null) + }, + update: function() { + this._impl && this._impl.updateMatrix(this.node) + }, + onReadyToPlay: function() { + this._currentStatus = n.READY_TO_PLAY, + cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.READY_TO_PLAY), + this.node.emit("ready-to-play", this) + }, + onMetaLoaded: function() { + this._currentStatus = n.META_LOADED, + cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.META_LOADED), + this.node.emit("meta-loaded", this) + }, + onClicked: function() { + this._currentStatus = n.CLICKED, + cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.CLICKED), + this.node.emit("clicked", this) + }, + onPlaying: function() { + this._currentStatus = n.PLAYING, + cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.PLAYING), + this.node.emit("playing", this) + }, + onPasued: function() { + this._currentStatus = n.PAUSED, + cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.PAUSED), + this.node.emit("paused", this) + }, + onStopped: function() { + this._currentStatus = n.STOPPED, + cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.STOPPED), + this.node.emit("stopped", this) + }, + onCompleted: function() { + this._currentStatus = n.COMPLETED, + cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, n.COMPLETED), + this.node.emit("completed", this) + }, + play: function() { + this._impl && (this._syncVolume(), + this._impl.play()) + }, + resume: function() { + this._impl && (this._syncVolume(), + this._impl.resume()) + }, + pause: function() { + this._impl && this._impl.pause() + }, + stop: function() { + this._impl && this._impl.stop() + }, + getDuration: function() { + return this._impl ? this._impl.duration() : -1 + }, + isPlaying: function() { + return !!this._impl && this._impl.isPlaying() + } + }); + cc.VideoPlayer = e.exports = s + } + ), { + "./video-player-impl": 350 + }], + 350: [(function(t, e) { + "use strict"; + var i = t("../core/platform/utils") + , n = t("../core/platform/CCSys") + , r = t("../core/platform/CCMacro") + , s = 1 + , a = 4 + , o = cc.mat4() + , l = cc.Class({ + name: "VideoPlayerImpl", + ctor: function() { + this._EventList = {}, + this._video = null, + this._url = "", + this._waitingFullscreen = !1, + this._fullScreenEnabled = !1, + this._stayOnBottom = !1, + this._loadedmeta = !1, + this._loaded = !1, + this._visible = !1, + this._playing = !1, + this._ignorePause = !1, + this._forceUpdate = !1, + this._m00 = 0, + this._m01 = 0, + this._m04 = 0, + this._m05 = 0, + this._m12 = 0, + this._m13 = 0, + this._w = 0, + this._h = 0, + this.__eventListeners = {} + }, + _bindEvent: function() { + var t = this._video + , e = this + , i = this.__eventListeners; + i.loadedmetadata = function() { + e._loadedmeta = !0, + e._forceUpdate = !0, + e._waitingFullscreen && (e._waitingFullscreen = !1, + e._toggleFullscreen(!0)), + e._dispatchEvent(l.EventType.META_LOADED) + } + , + i.ended = function() { + e._video === t && (e._playing = !1, + e._dispatchEvent(l.EventType.COMPLETED)) + } + , + i.play = function() { + e._video === t && (e._playing = !0, + e._updateVisibility(), + e._dispatchEvent(l.EventType.PLAYING)) + } + , + i.pause = function() { + e._video === t && (e._playing = !1, + e._ignorePause || e._dispatchEvent(l.EventType.PAUSED)) + } + , + i.click = function() { + e._dispatchEvent(l.EventType.CLICKED) + } + , + t.addEventListener("loadedmetadata", i.loadedmetadata), + t.addEventListener("ended", i.ended), + t.addEventListener("play", i.play), + t.addEventListener("pause", i.pause), + t.addEventListener("click", i.click), + i.onCanPlay = function() { + if (!e._loaded && !e._playing) { + var t = e._video; + t.readyState !== a && t.readyState !== s || (t.currentTime = 0, + e._loaded = !0, + e._forceUpdate = !0, + e._dispatchEvent(l.EventType.READY_TO_PLAY), + e._updateVisibility()) + } + } + , + t.addEventListener("canplay", i.onCanPlay), + t.addEventListener("canplaythrough", i.onCanPlay), + t.addEventListener("suspend", i.onCanPlay) + }, + _updateVisibility: function() { + var t = this._video; + t && (this._visible ? t.style.visibility = "visible" : (t.style.visibility = "hidden", + t.pause(), + this._playing = !1)) + }, + _updateSize: function(t, e) { + var i = this._video; + i && (i.style.width = t + "px", + i.style.height = e + "px") + }, + _createDom: function(t) { + var e = document.createElement("video"); + e.style.position = "absolute", + e.style.bottom = "0px", + e.style.left = "0px", + e.style["z-index"] = this._stayOnBottom ? r.MIN_ZINDEX : 0, + e.className = "cocosVideo", + e.setAttribute("preload", "auto"), + e.setAttribute("webkit-playsinline", ""), + e.setAttribute("x5-playsinline", ""), + e.setAttribute("playsinline", ""), + t && e.setAttribute("muted", ""), + this._video = e, + cc.game.container.appendChild(e) + }, + createDomElementIfNeeded: function(t) { + this._video || this._createDom(t) + }, + removeDom: function() { + var t = this._video; + if (t) { + i.contains(cc.game.container, t) && cc.game.container.removeChild(t); + var e = this.__eventListeners; + t.removeEventListener("loadedmetadata", e.loadedmetadata), + t.removeEventListener("ended", e.ended), + t.removeEventListener("play", e.play), + t.removeEventListener("pause", e.pause), + t.removeEventListener("click", e.click), + t.removeEventListener("canplay", e.onCanPlay), + t.removeEventListener("canplaythrough", e.onCanPlay), + t.removeEventListener("suspend", e.onCanPlay), + e.loadedmetadata = null, + e.ended = null, + e.play = null, + e.pause = null, + e.click = null, + e.onCanPlay = null + } + this._video = null, + this._url = "" + }, + setURL: function(t, e) { + var i, n; + if (this._url !== t) { + this.removeDom(), + this._url = t, + this.createDomElementIfNeeded(e), + this._bindEvent(); + var r = this._video; + r.style.visibility = "hidden", + this._loaded = !1, + this._playing = !1, + this._loadedmeta = !1, + (i = document.createElement("source")).src = t, + r.appendChild(i), + n = cc.path.extname(t); + for (var s = l._polyfill, a = 0; a < s.canPlayType.length; a++) + n !== s.canPlayType[a] && ((i = document.createElement("source")).src = t.replace(n, s.canPlayType[a]), + r.appendChild(i)) + } + }, + getURL: function() { + return this._url + }, + play: function() { + var t = this._video; + t && this._visible && !this._playing && t.play() + }, + pause: function() { + var t = this._video; + this._playing && t && t.pause() + }, + resume: function() { + this.play() + }, + stop: function() { + var t = this._video; + t && this._visible && (this._ignorePause = !0, + t.currentTime = 0, + t.pause(), + setTimeout(function() { + this._dispatchEvent(l.EventType.STOPPED), + this._ignorePause = !1 + } + .bind(this), 0)) + }, + setVolume: function(t) { + var e = this._video; + e && (e.volume = t) + }, + seekTo: function(t) { + var e = this._video; + e && (this._loaded ? e.currentTime = t : e.addEventListener(l._polyfill.event, (function i() { + e.currentTime = t, + e.removeEventListener(l._polyfill.event, i) + } + ))) + }, + isPlaying: function() { + return this._playing + }, + duration: function() { + var t = this._video + , e = -1; + return t ? ((e = t.duration) <= 0 && cc.logID(7702), + e) : e + }, + currentTime: function() { + var t = this._video; + return t ? t.currentTime : -1 + }, + setKeepAspectRatioEnabled: function() { + cc.logID(7700) + }, + isKeepAspectRatioEnabled: function() { + return !0 + }, + _toggleFullscreen: function(t) { + var e = this + , i = this._video; + i && (t ? (n.browserType === n.BROWSER_TYPE_IE && (i.style.transform = ""), + cc.screen.requestFullScreen(i, (function() { + var t = n.browserType === n.BROWSER_TYPE_IE ? document.msFullscreenElement : document.fullscreenElement; + e._fullScreenEnabled = t === i + } + ), (function() { + e._fullScreenEnabled = !1 + } + ))) : cc.screen.fullScreen() && cc.screen.exitFullScreen(i)) + }, + setStayOnBottom: function(t) { + this._stayOnBottom = t, + this._video && (this._video.style["z-index"] = t ? r.MIN_ZINDEX : 0) + }, + setFullScreenEnabled: function(t) { + !this._loadedmeta && t ? this._waitingFullscreen = !0 : this._toggleFullscreen(t) + }, + isFullScreenEnabled: function() { + return this._fullScreenEnabled + }, + setEventListener: function(t, e) { + this._EventList[t] = e + }, + removeEventListener: function(t) { + this._EventList[t] = null + }, + _dispatchEvent: function(t) { + var e = this._EventList[t]; + e && e.call(this, this, this._video.src) + }, + onPlayEvent: function() { + this._EventList[l.EventType.PLAYING].call(this, this, this._video.src) + }, + enable: function() { + var t = l.elements; + -1 === t.indexOf(this) && t.push(this), + this.setVisible(!0) + }, + disable: function() { + var t = l.elements + , e = t.indexOf(this); + -1 !== e && t.splice(e, 1), + this.setVisible(!1) + }, + destroy: function() { + this.disable(), + this.removeDom() + }, + setVisible: function(t) { + this._visible !== t && (this._visible = !!t, + this._updateVisibility()) + }, + updateMatrix: function(t) { + if (this._video && this._visible && !this._fullScreenEnabled) { + t.getWorldMatrix(o); + var e = cc.Camera._findRendererCamera(t); + e && e.worldMatrixToScreen(o, o, cc.game.canvas.width, cc.game.canvas.height); + var i = o.m; + if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) { + this._m00 = i[0], + this._m01 = i[1], + this._m04 = i[4], + this._m05 = i[5], + this._m12 = i[12], + this._m13 = i[13], + this._w = t._contentSize.width, + this._h = t._contentSize.height; + var r, s, a = cc.view._devicePixelRatio, h = 1 / a, c = 1 / a, u = cc.game.container, _ = i[0] * h, f = i[1], d = i[4], p = i[5] * c, m = u && u.style.paddingLeft ? parseInt(u.style.paddingLeft) : 0, y = u && u.style.paddingBottom ? parseInt(u.style.paddingBottom) : 0; + l._polyfill.zoomInvalid ? (this._updateSize(this._w * _, this._h * p), + _ = 1, + p = 1, + r = this._w * h, + s = this._h * c) : (r = this._w * h, + s = this._h * c, + this._updateSize(this._w, this._h)); + var v = r * i[0] * t._anchorPoint.x + , g = s * i[5] * t._anchorPoint.y + , A = "matrix(" + _ + "," + -f + "," + -d + "," + p + "," + (i[12] * h - v + m) + "," + -(i[13] * c - g + y) + ")"; + this._video.style.transform = A, + this._video.style["-webkit-transform"] = A, + this._video.style["transform-origin"] = "0px 100% 0px", + this._video.style["-webkit-transform-origin"] = "0px 100% 0px", + n.browserType !== n.BROWSER_TYPE_IE && (this._forceUpdate = !1) + } + } + } + }); + l.EventType = { + NONE: -1, + PLAYING: 0, + PAUSED: 1, + STOPPED: 2, + COMPLETED: 3, + META_LOADED: 4, + CLICKED: 5, + READY_TO_PLAY: 6 + }, + l.elements = [], + l.pauseElements = [], + cc.game.on(cc.game.EVENT_HIDE, (function() { + for (var t, e = l.elements, i = 0; i < e.length; i++) + (t = e[i]).isPlaying() && (t.pause(), + l.pauseElements.push(t)) + } + )), + cc.game.on(cc.game.EVENT_SHOW, (function() { + for (var t = l.pauseElements, e = t.pop(); e; ) + e.play(), + e = t.pop() + } + )), + l._polyfill = { + devicePixelRatio: !1, + event: "canplay", + canPlayType: [] + }; + var h = document.createElement("video"); + h.canPlayType && (h.canPlayType("video/ogg") && (l._polyfill.canPlayType.push(".ogg"), + l._polyfill.canPlayType.push(".ogv")), + h.canPlayType("video/mp4") && l._polyfill.canPlayType.push(".mp4"), + h.canPlayType("video/webm") && l._polyfill.canPlayType.push(".webm")), + n.OS_ANDROID !== n.os || n.browserType !== n.BROWSER_TYPE_SOUGOU && n.browserType !== n.BROWSER_TYPE_360 || (l._polyfill.zoomInvalid = !0); + var c = document.createElement("style"); + c.innerHTML = ".cocosVideo:-moz-full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:-webkit-full-screen{transform:matrix(1,0,0,1,0,0) !important;}", + document.head.appendChild(c), + e.exports = l + } + ), { + "../core/platform/CCMacro": 198, + "../core/platform/CCSys": 202, + "../core/platform/utils": 217 + }], + 351: [(function(t, e) { + "use strict"; + var i = t("./webview-impl") + , n = i.EventType; + function r() {} + var s = cc.Class({ + name: "cc.WebView", + extends: cc.Component, + editor: !1, + properties: { + _url: "", + url: { + type: cc.String, + tooltip: !1, + get: function() { + return this._url + }, + set: function(t) { + this._url = t; + var e = this._impl; + e && e.loadURL(t) + } + }, + webviewEvents: { + default: [], + type: cc.Component.EventHandler + } + }, + statics: { + EventType: n, + Impl: i + }, + ctor: function() { + this._impl = new s.Impl + }, + onRestore: function() { + this._impl || (this._impl = new s.Impl) + }, + onEnable: function() { + var t = this._impl; + t.createDomElementIfNeeded(this.node.width, this.node.height), + t.setEventListener(n.LOADED, this._onWebViewLoaded.bind(this)), + t.setEventListener(n.LOADING, this._onWebViewLoading.bind(this)), + t.setEventListener(n.ERROR, this._onWebViewLoadError.bind(this)), + t.loadURL(this._url), + t.setVisible(!0) + }, + onDisable: function() { + var t = this._impl; + t.setVisible(!1), + t.setEventListener(n.LOADED, r), + t.setEventListener(n.LOADING, r), + t.setEventListener(n.ERROR, r) + }, + onDestroy: function() { + this._impl && (this._impl.destroy(), + this._impl = null) + }, + update: function() { + this._impl && this._impl.updateMatrix(this.node) + }, + _onWebViewLoaded: function() { + cc.Component.EventHandler.emitEvents(this.webviewEvents, this, n.LOADED), + this.node.emit("loaded", this) + }, + _onWebViewLoading: function() { + return cc.Component.EventHandler.emitEvents(this.webviewEvents, this, n.LOADING), + this.node.emit("loading", this), + !0 + }, + _onWebViewLoadError: function() { + cc.Component.EventHandler.emitEvents(this.webviewEvents, this, n.ERROR), + this.node.emit("error", this) + }, + setJavascriptInterfaceScheme: function(t) { + this._impl && this._impl.setJavascriptInterfaceScheme(t) + }, + setOnJSCallback: function(t) { + this._impl && this._impl.setOnJSCallback(t) + }, + evaluateJS: function(t) { + this._impl && this._impl.evaluateJS(t) + } + }); + cc.WebView = e.exports = s + } + ), { + "./webview-impl": 352 + }], + 352: [(function(t, e) { + "use strict"; + var i = t("../core/platform/utils") + , n = t("../core/platform/CCSys") + , r = cc.mat4() + , s = cc.Class({ + name: "WebViewImpl", + ctor: function() { + this._EventList = {}, + this._visible = !1, + this._parent = null, + this._div = null, + this._iframe = null, + this._listener = null, + this._forceUpdate = !1, + this._m00 = 0, + this._m01 = 0, + this._m04 = 0, + this._m05 = 0, + this._m12 = 0, + this._m13 = 0, + this._w = 0, + this._h = 0, + this.__eventListeners = {} + }, + _updateVisibility: function() { + if (this._div) { + var t = this._div; + this._visible ? t.style.visibility = "visible" : t.style.visibility = "hidden" + } + }, + _updateSize: function(t, e) { + var i = this._div; + i && (i.style.width = t + "px", + i.style.height = e + "px") + }, + _initEvent: function() { + var t = this._iframe; + if (t) { + var e = this.__eventListeners + , i = this; + e.load = function() { + i._forceUpdate = !0, + i._dispatchEvent(s.EventType.LOADED) + } + , + e.error = function() { + i._dispatchEvent(s.EventType.ERROR) + } + , + t.addEventListener("load", e.load), + t.addEventListener("error", e.error) + } + }, + _initStyle: function() { + if (this._div) { + var t = this._div; + t.style.position = "absolute", + t.style.bottom = "0px", + t.style.left = "0px" + } + }, + _setOpacity: function(t) { + var e = this._iframe; + e && e.style && (e.style.opacity = t / 255) + }, + _createDom: function(t, e) { + s._polyfill.enableDiv ? (this._div = document.createElement("div"), + this._div.style["-webkit-overflow"] = "auto", + this._div.style["-webkit-overflow-scrolling"] = "touch", + this._iframe = document.createElement("iframe"), + this._div.appendChild(this._iframe), + this._iframe.style.width = "100%", + this._iframe.style.height = "100%") : this._div = this._iframe = document.createElement("iframe"), + s._polyfill.enableBG && (this._div.style.background = "#FFF"), + this._div.style.height = e + "px", + this._div.style.width = t + "px", + this._div.style.overflow = "scroll", + this._iframe.style.border = "none", + cc.game.container.appendChild(this._div), + this._updateVisibility() + }, + _createNativeControl: function(t, e) { + this._createDom(t, e), + this._initStyle(), + this._initEvent() + }, + createDomElementIfNeeded: function(t, e) { + this._div ? this._updateSize(t, e) : this._createNativeControl(t, e) + }, + removeDom: function() { + var t = this._div; + t && (i.contains(cc.game.container, t) && cc.game.container.removeChild(t), + this._div = null); + var e = this._iframe; + if (e) { + var n = this.__eventListeners; + e.removeEventListener("load", n.load), + e.removeEventListener("error", n.error), + n.load = null, + n.error = null, + this._iframe = null + } + }, + setOnJSCallback: function() {}, + setJavascriptInterfaceScheme: function() {}, + loadData: function() {}, + loadHTMLString: function() {}, + loadURL: function(t) { + var e = this._iframe; + if (e) { + e.src = t; + var i = this; + e.addEventListener("load", (function t() { + i._loaded = !0, + i._updateVisibility(), + e.removeEventListener("load", t) + } + )), + this._dispatchEvent(s.EventType.LOADING) + } + }, + stopLoading: function() { + cc.logID(7800) + }, + reload: function() { + var t = this._iframe; + if (t) { + var e = t.contentWindow; + e && e.location && e.location.reload() + } + }, + canGoBack: function() { + return cc.logID(7801), + !0 + }, + canGoForward: function() { + return cc.logID(7802), + !0 + }, + goBack: function() { + try { + if (s._polyfill.closeHistory) + return cc.logID(7803); + var t = this._iframe; + if (t) { + var e = t.contentWindow; + e && e.location && e.history.back.call(e) + } + } catch (i) { + cc.log(i) + } + }, + goForward: function() { + try { + if (s._polyfill.closeHistory) + return cc.logID(7804); + var t = this._iframe; + if (t) { + var e = t.contentWindow; + e && e.location && e.history.forward.call(e) + } + } catch (i) { + cc.log(i) + } + }, + evaluateJS: function(t) { + var e = this._iframe; + if (e) { + var i = e.contentWindow; + try { + i.eval(t), + this._dispatchEvent(s.EventType.JS_EVALUATED) + } catch (n) { + console.error(n) + } + } + }, + setScalesPageToFit: function() { + cc.logID(7805) + }, + setEventListener: function(t, e) { + this._EventList[t] = e + }, + removeEventListener: function(t) { + this._EventList[t] = null + }, + _dispatchEvent: function(t) { + var e = this._EventList[t]; + e && e.call(this, this, this._iframe.src) + }, + _createRenderCmd: function() { + return new s.RenderCmd(this) + }, + destroy: function() { + this.removeDom() + }, + setVisible: function(t) { + this._visible !== t && (this._visible = !!t, + this._updateVisibility()) + }, + updateMatrix: function(t) { + if (this._div && this._visible) { + t.getWorldMatrix(r); + var e = cc.Camera._findRendererCamera(t); + e && e.worldMatrixToScreen(r, r, cc.game.canvas.width, cc.game.canvas.height); + var i = r.m; + if (this._forceUpdate || this._m00 !== i[0] || this._m01 !== i[1] || this._m04 !== i[4] || this._m05 !== i[5] || this._m12 !== i[12] || this._m13 !== i[13] || this._w !== t._contentSize.width || this._h !== t._contentSize.height) { + this._m00 = i[0], + this._m01 = i[1], + this._m04 = i[4], + this._m05 = i[5], + this._m12 = i[12], + this._m13 = i[13], + this._w = t._contentSize.width, + this._h = t._contentSize.height; + var n = cc.view._devicePixelRatio + , s = 1 / n + , a = 1 / n + , o = cc.game.container + , l = i[0] * s + , h = i[1] + , c = i[4] + , u = i[5] * a + , _ = o && o.style.paddingLeft ? parseInt(o.style.paddingLeft) : 0 + , f = o && o.style.paddingBottom ? parseInt(o.style.paddingBottom) : 0; + this._updateSize(this._w, this._h); + var d = this._w * s + , p = this._h * a + , m = d * i[0] * t._anchorPoint.x + , y = p * i[5] * t._anchorPoint.y + , v = "matrix(" + l + "," + -h + "," + -c + "," + u + "," + (i[12] * s - m + _) + "," + -(i[13] * a - y + f) + ")"; + this._div.style.transform = v, + this._div.style["-webkit-transform"] = v, + this._div.style["transform-origin"] = "0px 100% 0px", + this._div.style["-webkit-transform-origin"] = "0px 100% 0px", + this._setOpacity(t.opacity), + this._forceUpdate = !1 + } + } + } + }); + s.EventType = { + LOADING: 0, + LOADED: 1, + ERROR: 2, + JS_EVALUATED: 3 + }; + var a = s._polyfill = { + devicePixelRatio: !1, + enableDiv: !1 + }; + n.os === n.OS_IOS && (a.enableDiv = !0), + n.isMobile ? n.browserType === n.BROWSER_TYPE_FIREFOX && (a.enableBG = !0) : n.browserType === n.BROWSER_TYPE_IE && (a.closeHistory = !0), + e.exports = s + } + ), { + "../core/platform/CCSys": 202, + "../core/platform/utils": 217 + }], + 353: [(function(t) { + "use strict"; + t("./cocos2d/core"), + t("./cocos2d/animation"), + t("./cocos2d/particle"), + t("./cocos2d/tilemap"), + t("./cocos2d/videoplayer/CCVideoPlayer"), + t("./cocos2d/webview/CCWebView"), + t("./cocos2d/core/components/CCStudioComponent"), + t("./extensions/ccpool/CCNodePool"), + t("./cocos2d/actions"), + t("./extensions/spine"), + t("./extensions/dragonbones"), + t("./cocos2d/deprecated") + } + ), { + "./cocos2d/actions": 7, + "./cocos2d/animation": 16, + "./cocos2d/core": 160, + "./cocos2d/core/components/CCStudioComponent": 121, + "./cocos2d/deprecated": 294, + "./cocos2d/particle": 300, + "./cocos2d/particle/CCParticleAsset": 297, + "./cocos2d/tilemap": 346, + "./cocos2d/tilemap/CCTiledMapAsset": 342, + "./cocos2d/videoplayer/CCVideoPlayer": 349, + "./cocos2d/webview/CCWebView": 351, + "./extensions/ccpool/CCNodePool": 354, + "./extensions/dragonbones": 364, + "./extensions/spine": 369 + }], + 354: [(function(t, e) { + "use strict"; + cc.NodePool = function(t) { + this.poolHandlerComp = t, + this._pool = [] + } + , + cc.NodePool.prototype = { + constructor: cc.NodePool, + size: function() { + return this._pool.length + }, + clear: function() { + for (var t = this._pool.length, e = 0; e < t; ++e) + this._pool[e].destroy(); + this._pool.length = 0 + }, + put: function(t) { + if (t && -1 === this._pool.indexOf(t)) { + t.removeFromParent(!1); + var e = this.poolHandlerComp ? t.getComponent(this.poolHandlerComp) : null; + e && e.unuse && e.unuse(), + this._pool.push(t) + } + }, + get: function() { + var t = this._pool.length - 1; + if (t < 0) + return null; + var e = this._pool[t]; + this._pool.length = t; + var i = this.poolHandlerComp ? e.getComponent(this.poolHandlerComp) : null; + return i && i.reuse && i.reuse.apply(i, arguments), + e + } + }, + e.exports = cc.NodePool + } + ), {}], + 355: [(function(t, e) { + "use strict"; + var i, n, r = [], s = [], a = 0, o = 0, l = 0, h = null, c = null, u = 0, _ = 0, f = 0, d = 0, p = null, m = cc.Class({ + ctor: function() { + this._privateMode = !1, + this._inited = !1, + this._invalid = !0, + this._enableCacheAttachedInfo = !1, + this.frames = [], + this.totalTime = 0, + this.isCompleted = !1, + this._frameIdx = -1, + this._armatureInfo = null, + this._animationName = null, + this._tempSegments = null, + this._tempColors = null, + this._tempBoneInfos = null + }, + init: function(t, e) { + this._inited = !0, + this._armatureInfo = t, + this._animationName = e + }, + clear: function() { + this._inited = !1; + for (var t = 0, e = this.frames.length; t < e; t++) + this.frames[t].segments.length = 0; + this.invalidAllFrame() + }, + begin: function() { + if (this._invalid) { + var t = this._armatureInfo + , e = t.curAnimationCache; + e && e != this && (this._privateMode ? e.invalidAllFrame() : e.updateToFrame()), + t.armature.animation.play(this._animationName, 1), + t.curAnimationCache = this, + this._invalid = !1, + this._frameIdx = -1, + this.totalTime = 0, + this.isCompleted = !1 + } + }, + end: function() { + this._needToUpdate() || (this._armatureInfo.curAnimationCache = null, + this.frames.length = this._frameIdx + 1, + this.isCompleted = !0) + }, + _needToUpdate: function(t) { + return !this._armatureInfo.armature.animation.isCompleted && this.totalTime < 30 && (null == t || this._frameIdx < t) + }, + updateToFrame: function(t) { + if (this._inited && (this.begin(), + this._needToUpdate(t))) { + var e = this._armatureInfo.armature; + do { + e.advanceTime(1 / 60), + this._frameIdx++, + this._updateFrame(e, this._frameIdx), + this.totalTime += 1 / 60 + } while (this._needToUpdate(t));this.end() + } + }, + isInited: function() { + return this._inited + }, + isInvalid: function() { + return this._invalid + }, + invalidAllFrame: function() { + this.isCompleted = !1, + this._invalid = !0 + }, + updateAllFrame: function() { + this.invalidAllFrame(), + this.updateToFrame() + }, + enableCacheAttachedInfo: function() { + this._enableCacheAttachedInfo || (this._enableCacheAttachedInfo = !0, + this.invalidAllFrame()) + }, + _updateFrame: function(t, e) { + l = 0, + a = 0, + o = 0, + h = null, + c = null, + u = 0, + _ = 0, + f = 0, + d = 0, + p = null, + this.frames[e] = this.frames[e] || { + segments: [], + colors: [], + boneInfos: [], + vertices: null, + uintVert: null, + indices: null + }; + var i = this.frames[e] + , n = this._tempSegments = i.segments + , m = this._tempColors = i.colors + , y = this._tempBoneInfos = i.boneInfos; + this._traverseArmature(t, 1), + d > 0 && (m[d - 1].vfOffset = l), + m.length = d, + y.length = a; + var v = f - 1; + if (v >= 0) + if (_ > 0) { + var g = n[v]; + g.indexCount = _, + g.vfCount = 5 * u, + g.vertexCount = u, + n.length = f + } else + n.length = f - 1; + if (0 !== n.length) { + var A = i.vertices + , x = i.uintVert; + (!A || A.length < l) && (A = i.vertices = new Float32Array(l), + x = i.uintVert = new Uint32Array(A.buffer)); + for (var b = 0, C = 0; b < l; ) + A[b++] = r[C++], + A[b++] = r[C++], + A[b++] = r[C++], + A[b++] = r[C++], + x[b++] = r[C++]; + var T = i.indices; + (!T || T.length < o) && (T = i.indices = new Uint16Array(o)); + for (var S = 0; S < o; S++) + T[S] = s[S]; + i.vertices = A, + i.uintVert = x, + i.indices = T + } + }, + _traverseArmature: function(t, e) { + var m, y, v, g, A, x, b, C, T, S = this._tempColors, w = this._tempSegments, E = this._tempBoneInfos, M = r, D = s, B = t._slots, I = t._bones; + if (this._enableCacheAttachedInfo) + for (var P = 0, R = I.length; P < R; P++, + a++) { + var O = I[P] + , L = E[a]; + L || (L = E[a] = { + globalTransformMatrix: new dragonBones.Matrix + }); + var F = O.globalTransformMatrix; + L.globalTransformMatrix.copyFrom(F) + } + for (var V = 0, N = B.length; V < N; V++) + if ((v = B[V])._visible && v._displayData) + if (v.updateWorldMatrix(), + A = v._color, + v.childArmature) + this._traverseArmature(v.childArmature, e * A.a / 255); + else if (b = v.getTexture()) { + h === b.nativeUrl && c === v._blendMode || (h = b.nativeUrl, + c = v._blendMode, + (C = f - 1) >= 0 && (_ > 0 ? ((T = w[C]).indexCount = _, + T.vertexCount = u, + T.vfCount = 5 * u) : f--), + w[f] = { + tex: b, + blendMode: v._blendMode, + indexCount: 0, + vertexCount: 0, + vfCount: 0 + }, + f++, + _ = 0, + u = 0), + x = (A.a * e << 24 >>> 0) + (A.b << 16) + (A.g << 8) + A.r, + p !== x && (p = x, + d > 0 && (S[d - 1].vfOffset = l), + S[d++] = { + r: A.r, + g: A.g, + b: A.b, + a: A.a * e, + vfOffset: 0 + }), + m = v._localVertices, + y = v._indices, + g = v._worldMatrix.m; + for (var k = 0, G = m.length; k < G; ) + i = m[k++], + n = m[k++], + M[l++] = i * g[0] + n * g[4] + g[12], + M[l++] = i * g[1] + n * g[5] + g[13], + M[l++] = m[k++], + M[l++] = m[k++], + M[l++] = x; + for (var U = 0, z = y.length; U < z; U++) + D[o++] = u + y[U]; + _ += y.length, + u += m.length / 4 + } + } + }), y = cc.Class({ + ctor: function() { + this._privateMode = !1, + this._animationPool = {}, + this._armatureCache = {} + }, + enablePrivateMode: function() { + this._privateMode = !0 + }, + dispose: function() { + for (var t in this._armatureCache) { + var e = this._armatureCache[t]; + if (e) { + var i = e.armature; + i && i.dispose() + } + } + this._armatureCache = null, + this._animationPool = null + }, + _removeArmature: function(t) { + var e = this._armatureCache[t] + , i = e.animationsCache; + for (var n in i) { + var r = i[n]; + r && (this._animationPool[t + "#" + n] = r, + r.clear()) + } + var s = e.armature; + s && s.dispose(), + delete this._armatureCache[t] + }, + resetArmature: function(t) { + for (var e in this._armatureCache) + -1 != e.indexOf(t) && this._removeArmature(e) + }, + getArmatureCache: function(t, e, i) { + var n, r = this._armatureCache[e]; + if (r) + n = r.armature; + else { + var s = dragonBones.CCFactory.getInstance().buildArmatureDisplay(t, e, "", i); + if (!s || !s._armature) + return; + if (n = s._armature, + !y.canCache(n)) + return void n.dispose(); + this._armatureCache[e] = { + armature: n, + animationsCache: {}, + curAnimationCache: null + } + } + return n + }, + getAnimationCache: function(t, e) { + var i = this._armatureCache[t]; + return i ? i.animationsCache[e] : null + }, + initAnimationCache: function(t, e) { + if (!e) + return null; + var i = this._armatureCache[t] + , n = i && i.armature; + if (!n) + return null; + if (!n.animation.hasAnimation(e)) + return null; + var r = i.animationsCache + , s = r[e]; + if (!s) { + var a = t + "#" + e; + (s = this._animationPool[a]) ? delete this._animationPool[a] : (s = new m)._privateMode = this._privateMode, + s.init(i, e), + r[e] = s + } + return s + }, + invalidAnimationCache: function(t) { + var e = this._armatureCache[t]; + if (!e || !e.armature) + return null; + var i = e.animationsCache; + for (var n in i) + i[n].invalidAllFrame() + }, + updateAnimationCache: function(t, e) { + if (e) { + var i = this.initAnimationCache(t, e); + if (!i) + return; + i.updateAllFrame() + } else { + var n = this._armatureCache[t]; + if (!n || !n.armature) + return null; + var r = n.animationsCache; + for (var s in r) + r[s].updateAllFrame() + } + } + }); + y.FrameTime = 1 / 60, + y.sharedCache = new y, + y.canCache = function(t) { + for (var e = t._slots, i = 0, n = e.length; i < n; i++) + if (e[i].childArmature) + return !1; + return !0 + } + , + e.exports = y + } + ), {}], + 356: [(function(t, e) { + "use strict"; + var i = t("../../cocos2d/core/components/CCRenderComponent") + , n = t("../../cocos2d/core/event/event-target") + , r = t("../../cocos2d/core/graphics/graphics") + , s = t("../../cocos2d/core/renderer/render-flow").FLAG_POST_RENDER + , a = t("./ArmatureCache") + , o = t("./AttachUtil") + , l = cc.Enum({ + default: -1 + }) + , h = cc.Enum({ + "": 0 + }) + , c = (cc.Enum({ + REALTIME: 0 + }), + cc.Enum({ + REALTIME: 0, + SHARED_CACHE: 1, + PRIVATE_CACHE: 2 + })) + , u = cc.Class({ + name: "dragonBones.ArmatureDisplay", + extends: i, + editor: !1, + statics: { + AnimationCacheMode: c + }, + properties: { + _factory: { + default: null, + type: dragonBones.CCFactory, + serializable: !1 + }, + dragonAsset: { + default: null, + type: dragonBones.DragonBonesAsset, + notify: function() { + this._refresh() + }, + tooltip: !1 + }, + dragonAtlasAsset: { + default: null, + type: dragonBones.DragonBonesAtlasAsset, + notify: function() { + this._parseDragonAtlasAsset(), + this._refresh() + }, + tooltip: !1 + }, + _armatureName: "", + armatureName: { + get: function() { + return this._armatureName + }, + set: function(t) { + this._armatureName = t; + var e = this.getAnimationNames(this._armatureName); + (!this.animationName || e.indexOf(this.animationName) < 0) && (this.animationName = ""), + this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature), + this._refresh(), + this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature) + }, + visible: !1 + }, + _animationName: "", + animationName: { + get: function() { + return this._animationName + }, + set: function(t) { + this._animationName = t + }, + visible: !1 + }, + _defaultArmatureIndex: { + default: 0, + notify: function() { + var t = ""; + if (this.dragonAsset) { + var e; + if (this.dragonAsset && (e = this.dragonAsset.getArmatureEnum()), + !e) + return cc.errorID(7400, this.name); + t = e[this._defaultArmatureIndex] + } + void 0 !== t ? this.armatureName = t : cc.errorID(7401, this.name) + }, + type: l, + visible: !0, + editorOnly: !0, + animatable: !1, + displayName: "Armature", + tooltip: !1 + }, + _animationIndex: { + default: 0, + notify: function() { + var t; + if (0 !== this._animationIndex) { + if (this.dragonAsset && (t = this.dragonAsset.getAnimsEnum(this.armatureName)), + t) { + var e = t[this._animationIndex]; + void 0 !== e ? this.playAnimation(e, this.playTimes) : cc.errorID(7402, this.name) + } + } else + this.animationName = "" + }, + type: h, + visible: !0, + editorOnly: !0, + animatable: !1, + displayName: "Animation", + tooltip: !1 + }, + _preCacheMode: -1, + _cacheMode: c.REALTIME, + _defaultCacheMode: { + default: 0, + type: c, + notify: function() { + if (this._defaultCacheMode !== c.REALTIME && this._armature && !a.canCache(this._armature)) + return this._defaultCacheMode = c.REALTIME, + void cc.warn("Animation cache mode doesn't support skeletal nesting"); + this.setAnimationCacheMode(this._defaultCacheMode) + }, + editorOnly: !0, + visible: !0, + animatable: !1, + displayName: "Animation Cache Mode", + tooltip: !1 + }, + timeScale: { + default: 1, + notify: function() { + this._armature && !this.isAnimationCached() && (this._armature.animation.timeScale = this.timeScale) + }, + tooltip: !1 + }, + playTimes: { + default: -1, + tooltip: !1 + }, + premultipliedAlpha: { + default: !1, + tooltip: !1 + }, + debugBones: { + default: !1, + notify: function() { + this._updateDebugDraw() + }, + tooltip: !1 + }, + enableBatch: { + default: !1, + notify: function() { + this._updateBatch() + }, + tooltip: !1 + }, + _armatureKey: "", + _accTime: 0, + _playCount: 0, + _frameCache: null, + _curFrame: null, + _playing: !1, + _armatureCache: null + }, + ctor: function() { + this._eventTarget = new n, + this._materialCache = {}, + this._inited = !1, + this.attachUtil = new o, + this._factory = dragonBones.CCFactory.getInstance() + }, + onLoad: function() { + for (var t = this.node.children, e = 0, i = t.length; e < i; e++) { + var n = t[e]; + 0 === (n._name && n._name.search("CHILD_ARMATURE-")) && n.destroy() + } + }, + _updateBatch: function() { + var t = this.getMaterial(0); + t && t.define("CC_USE_MODEL", !this.enableBatch), + this._materialCache = {} + }, + _updateMaterial: function() { + var t = this.getMaterial(0); + if (t) { + t.define("CC_USE_MODEL", !this.enableBatch), + t.define("USE_TEXTURE", !0); + var e = this.premultipliedAlpha ? cc.gfx.BLEND_ONE : cc.gfx.BLEND_SRC_ALPHA + , i = cc.gfx.BLEND_ONE_MINUS_SRC_ALPHA; + t.setBlend(!0, cc.gfx.BLEND_FUNC_ADD, e, e, cc.gfx.BLEND_FUNC_ADD, i, i) + } + this._materialCache = {} + }, + disableRender: function() { + this._super(), + this.node._renderFlag &= ~s + }, + markForRender: function(t) { + this._super(t), + t ? this.node._renderFlag |= s : this.node._renderFlag &= ~s + }, + _validateRender: function() { + var t = this.dragonAtlasAsset && this.dragonAtlasAsset.texture; + t && t.loaded ? this._super() : this.disableRender() + }, + __preload: function() { + this._init() + }, + _init: function() { + if (!this._inited) { + this._inited = !0, + this._resetAssembler(), + this._activateMaterial(), + this._parseDragonAtlasAsset(), + this._refresh(); + for (var t = this.node.children, e = 0, i = t.length; e < i; e++) { + var n = t[e]; + n && "DEBUG_DRAW_NODE" === n._name && n.destroy() + } + this._updateDebugDraw() + } + }, + getArmatureKey: function() { + return this._armatureKey + }, + setAnimationCacheMode: function(t) { + this._preCacheMode !== t && (this._cacheMode = t, + this._buildArmature(), + this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature)) + }, + isAnimationCached: function() { + return this._cacheMode !== c.REALTIME + }, + onEnable: function() { + this._super(), + this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature) + }, + onDisable: function() { + this._super(), + this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature) + }, + _emitCacheCompleteEvent: function() { + this._eventTarget.emit(dragonBones.EventObject.LOOP_COMPLETE), + this._eventTarget.emit(dragonBones.EventObject.COMPLETE) + }, + update: function(t) { + if (this.isAnimationCached() && this._frameCache) { + var e = this._frameCache; + if (e.isInited()) { + var i = e.frames; + if (this._playing) { + var n = a.FrameTime; + 0 == this._accTime && 0 == this._playCount && this._eventTarget.emit(dragonBones.EventObject.START); + var r = dragonBones.timeScale; + this._accTime += t * this.timeScale * r; + var s = Math.floor(this._accTime / n); + if (e.isCompleted || e.updateToFrame(s), + e.isCompleted && s >= i.length) { + if (this._playCount++, + this.playTimes > 0 && this._playCount >= this.playTimes) + return this._curFrame = i[i.length - 1], + this._accTime = 0, + this._playing = !1, + this._playCount = 0, + void this._emitCacheCompleteEvent(); + this._accTime = 0, + s = 0, + this._emitCacheCompleteEvent() + } + this._curFrame = i[s] + } else + e.isInvalid() && (e.updateToFrame(), + this._curFrame = i[i.length - 1]) + } + } + }, + onDestroy: function() { + this._super(), + this._inited = !1, + this._cacheMode === c.PRIVATE_CACHE ? (this._armatureCache.dispose(), + this._armatureCache = null, + this._armature = null) : this._cacheMode === c.SHARED_CACHE ? (this._armatureCache = null, + this._armature = null) : this._armature && (this._armature.dispose(), + this._armature = null) + }, + _updateDebugDraw: function() { + if (this.debugBones) { + if (!this._debugDraw) { + var t = new cc.PrivateNode; + t.name = "DEBUG_DRAW_NODE"; + var e = t.addComponent(r); + e.lineWidth = 1, + e.strokeColor = cc.color(255, 0, 0, 255), + this._debugDraw = e + } + this._debugDraw.node.parent = this.node + } else + this._debugDraw && (this._debugDraw.node.parent = null) + }, + _buildArmature: function() { + if (this.dragonAsset && this.dragonAtlasAsset && this.armatureName) { + this._armature && (this._preCacheMode === c.PRIVATE_CACHE ? this._armatureCache.dispose() : this._preCacheMode === c.REALTIME && this._armature.dispose(), + this._armatureCache = null, + this._armature = null, + this._displayProxy = null, + this._frameCache = null, + this._curFrame = null, + this._playing = !1, + this._preCacheMode = null), + this._cacheMode === c.SHARED_CACHE ? this._armatureCache = a.sharedCache : this._cacheMode === c.PRIVATE_CACHE && (this._armatureCache = new a, + this._armatureCache.enablePrivateMode()); + var t = this.dragonAtlasAsset._uuid; + if (this._armatureKey = this.dragonAsset.init(this._factory, t), + this.isAnimationCached() && (this._armature = this._armatureCache.getArmatureCache(this.armatureName, this._armatureKey, t), + this._armature || (this._cacheMode = c.REALTIME)), + this._preCacheMode = this._cacheMode, + this._cacheMode === c.REALTIME) { + if (this._displayProxy = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", t), + !this._displayProxy) + return; + this._displayProxy._ccNode = this.node, + this._displayProxy.setEventTarget(this._eventTarget), + this._armature = this._displayProxy._armature, + this._armature.animation.timeScale = this.timeScale + } + if (this._cacheMode !== c.REALTIME && this.debugBones && cc.warn("Debug bones is invalid in cached mode"), + this._armature) { + var e = this._armature.armatureData.aabb; + this.node.setContentSize(e.width, e.height) + } + this._updateBatch(), + this.attachUtil.init(this), + this.attachUtil._associateAttachedNode(), + this.animationName && this.playAnimation(this.animationName, this.playTimes), + this.markForRender(!0) + } + }, + _parseDragonAtlasAsset: function() { + this.dragonAtlasAsset && this.dragonAtlasAsset.init(this._factory) + }, + _refresh: function() { + this._buildArmature() + }, + _updateCacheModeEnum: !1, + _updateAnimEnum: !1, + _updateArmatureEnum: !1, + playAnimation: function(t, e) { + if (this.playTimes = void 0 === e ? -1 : e, + this.animationName = t, + this.isAnimationCached()) { + var i = this._armatureCache.getAnimationCache(this._armatureKey, t); + i || (i = this._armatureCache.initAnimationCache(this._armatureKey, t)), + i && (this._accTime = 0, + this._playCount = 0, + this._frameCache = i, + this.attachUtil._hasAttachedNode() && this._frameCache.enableCacheAttachedInfo(), + this._frameCache.updateToFrame(0), + this._playing = !0, + this._curFrame = this._frameCache.frames[0]) + } else if (this._armature) + return this._armature.animation.play(t, this.playTimes) + }, + updateAnimationCache: function(t) { + this.isAnimationCached() && this._armatureCache.updateAnimationCache(this._armatureKey, t) + }, + invalidAnimationCache: function() { + this.isAnimationCached() && this._armatureCache.invalidAnimationCache(this._armatureKey) + }, + getArmatureNames: function() { + var t = this._factory.getDragonBonesData(this._armatureKey); + return t && t.armatureNames || [] + }, + getAnimationNames: function(t) { + var e = [] + , i = this._factory.getDragonBonesData(this._armatureKey); + if (i) { + var n = i.getArmature(t); + if (n) + for (var r in n.animations) + n.animations.hasOwnProperty(r) && e.push(r) + } + return e + }, + on: function(t, e, i) { + this.addEventListener(t, e, i) + }, + off: function(t, e, i) { + this.removeEventListener(t, e, i) + }, + once: function(t, e, i) { + this._eventTarget.once(t, e, i) + }, + addEventListener: function(t, e, i) { + this._eventTarget.on(t, e, i) + }, + removeEventListener: function(t, e, i) { + this._eventTarget.off(t, e, i) + }, + buildArmature: function(t, e) { + return this._factory.createArmatureNode(this, t, e) + }, + armature: function() { + return this._armature + } + }); + e.exports = dragonBones.ArmatureDisplay = u + } + ), { + "../../cocos2d/core/components/CCRenderComponent": 115, + "../../cocos2d/core/event/event-target": 140, + "../../cocos2d/core/graphics/graphics": 156, + "../../cocos2d/core/renderer/render-flow": 225, + "./ArmatureCache": 355, + "./AttachUtil": 357 + }], + 357: [(function(t, e) { + "use strict"; + var i, n = (i = t("../../cocos2d/core/value-types/mat4")) && i.__esModule ? i : { + default: i + }, r = t("../../cocos2d/core/renderer/render-flow").FLAG_TRANSFORM, s = function() {}, a = function(t) { + Object.defineProperty(t, "_worldMatDirty", { + get: function() { + return !0 + }, + set: function() {} + }), + t._calculWorldMatrix = s, + t._mulMat = s + }, o = new n.default, l = cc.Class({ + name: "dragonBones.AttachUtil", + ctor: function() { + this._inited = !1, + this._armature = null, + this._armatureNode = null, + this._armatureDisplay = null, + this._attachedRootNode = null, + this._attachedNodeArray = [], + this._boneIndexToNode = {} + }, + init: function(t) { + this._inited = !0, + this._armature = t._armature, + this._armatureNode = t.node, + this._armatureDisplay = t + }, + reset: function() { + this._inited = !1, + this._armature = null, + this._armatureNode = null, + this._armatureDisplay = null + }, + _prepareAttachNode: function() { + if (this._armature) { + var t = this._armatureNode.getChildByName("ATTACHED_NODE_TREE"); + return t && t.isValid || (t = new cc.Node("ATTACHED_NODE_TREE"), + a(t), + this._armatureNode.addChild(t)), + this._armatureDisplay.isAnimationCached() && this._armatureDisplay._frameCache && this._armatureDisplay._frameCache.enableCacheAttachedInfo(), + this._attachedRootNode = t, + t + } + }, + _buildBoneAttachedNode: function(t, e) { + var i = "ATTACHED_NODE:" + t.name + , n = new cc.Node(i); + return this._buildBoneRelation(n, t, e), + n + }, + _buildBoneRelation: function(t, e, i) { + a(t), + t._bone = e, + t._boneIndex = i, + this._attachedNodeArray.push(t), + this._boneIndexToNode[i] = t + }, + getAttachedRootNode: function() { + return this._attachedRootNode + }, + getAttachedNodes: function(t) { + var e = this._attachedNodeArray + , i = []; + if (!this._inited) + return i; + for (var n = 0, r = e.length; n < r; n++) { + var s = e[n]; + s && s.isValid && s.name === "ATTACHED_NODE:" + t && i.push(s) + } + return i + }, + _rebuildNodeArray: function() { + for (var t = this._boneIndexToNode = {}, e = this._attachedNodeArray, i = this._attachedNodeArray = [], n = 0, r = e.length; n < r; n++) { + var s = e[n]; + s && s.isValid && !s._toRemove && (i.push(s), + t[s._boneIndex] = s) + } + }, + _sortNodeArray: function() { + this._attachedNodeArray.sort((function(t, e) { + return t._boneIndex < e._boneIndex ? -1 : 1 + } + )) + }, + _getNodeByBoneIndex: function(t) { + var e = this._boneIndexToNode[t]; + return e && e.isValid ? e : null + }, + destroyAttachedNodes: function(t) { + if (this._inited) { + for (var e = this._attachedNodeArray, i = function t(e) { + for (var i = e.children, n = 0, r = i.length; n < r; n++) { + var s = i[n]; + s && t(s) + } + e._toRemove = !0 + }, n = 0, r = e.length; n < r; n++) { + var s = e[n]; + s && s.isValid && s.name.split("ATTACHED_NODE:")[1] === t && (i(s), + s.removeFromParent(!0), + s.destroy(), + e[n] = null) + } + this._rebuildNodeArray() + } + }, + generateAttachedNodes: function(t) { + var e = []; + if (!this._inited) + return e; + var i = this._prepareAttachNode(); + if (!i) + return e; + var n = 0 + , r = [] + , s = function(e) { + if (e) { + for (var i, a = e.getBones(), o = 0, l = a.length; o < l; o++) + (i = a[o])._boneIndex = n++, + t === i.name && r.push(i); + for (var h, c = e.getSlots(), u = 0, _ = c.length; u < _; u++) + (h = c[u]).childArmature && s(h.childArmature) + } + } + .bind(this); + s(this._armature); + for (var a = function(t) { + if (t) { + var e = this._getNodeByBoneIndex(t._boneIndex); + if (e) + return e; + e = this._buildBoneAttachedNode(t, t._boneIndex); + var n = null; + t.armature.parent && (n = t.armature.parent.parent); + var r = a(t.parent || n) || i; + return e.parent = r, + t.parent ? e._rootNode = r._rootNode : e._rootNode = r, + e + } + } + .bind(this), o = 0, l = r.length; o < l; o++) { + var h = a(r[o]); + h && e.push(h) + } + return this._sortNodeArray(), + e + }, + destroyAllAttachedNodes: function() { + if (this._attachedRootNode = null, + this._attachedNodeArray.length = 0, + this._boneIndexToNode = {}, + this._inited) { + var t = this._armatureNode.getChildByName("ATTACHED_NODE_TREE"); + t && (t.removeFromParent(!0), + t.destroy(), + t = null) + } + }, + generateAllAttachedNodes: function() { + if (this._inited) { + this._boneIndexToNode = {}, + this._attachedNodeArray.length = 0; + var t = this._prepareAttachNode(); + if (t) { + var e = 0 + , i = function(n) { + if (n) { + var r = t; + n.parent && (r = n.parent.parent._attachedNode); + for (var s, a = n.getBones(), o = 0, l = a.length; o < l; o++) { + var h = e++; + (s = a[o])._attachedNode = null; + var c = null; + if (c = s.parent ? s.parent._attachedNode : r) { + var u = c.getChildByName("ATTACHED_NODE:" + s.name); + u && u.isValid ? this._buildBoneRelation(u, s, h) : (u = this._buildBoneAttachedNode(s, h), + c.addChild(u)), + u._rootNode = r, + s._attachedNode = u + } + } + for (var _, f = n.getSlots(), d = 0, p = f.length; d < p; d++) + (_ = f[d]).childArmature && i(_.childArmature) + } + } + .bind(this); + return i(this._armature), + t + } + } + }, + _hasAttachedNode: function() { + return !!this._inited && !!this._armatureNode.getChildByName("ATTACHED_NODE_TREE") + }, + _associateAttachedNode: function() { + if (this._inited) { + var t = this._armatureNode.getChildByName("ATTACHED_NODE_TREE"); + if (t && t.isValid) { + this._attachedRootNode = t, + this._boneIndexToNode = {}, + this._attachedNodeArray.length = 0; + var e = this._armature; + if (e) { + a(t), + this._armatureDisplay.isAnimationCached() && this._armatureDisplay._frameCache && this._armatureDisplay._frameCache.enableCacheAttachedInfo(); + var i = 0 + , n = function(e) { + if (e) { + var r = t; + e.parent && (r = e.parent.parent._attachedNode); + for (var s, a = e.getBones(), o = 0, l = a.length; o < l; o++) { + var h = i++; + (s = a[o])._attachedNode = null; + var c = null; + if (c = s.parent ? s.parent._attachedNode : r) { + var u = c.getChildByName("ATTACHED_NODE:" + s.name); + u && u.isValid && (this._buildBoneRelation(u, s, h), + u._rootNode = r, + s._attachedNode = u) + } + } + for (var _, f = e.getSlots(), d = 0, p = f.length; d < p; d++) + (_ = f[d]).childArmature && n(_.childArmature) + } + } + .bind(this); + n(e) + } + } + } + }, + _syncAttachedNode: function() { + if (this._inited) { + var t = this._attachedRootNode + , e = this._attachedNodeArray; + if (!t || !t.isValid) + return this._attachedRootNode = null, + void (e.length = 0); + var i = this._armatureNode._worldMatrix; + n.default.copy(t._worldMatrix, i), + t._renderFlag &= ~r; + var s = null + , a = this._armatureDisplay.isAnimationCached(); + if (!a || (s = this._armatureDisplay._curFrame && this._armatureDisplay._curFrame.boneInfos)) { + for (var l, h, c, u, _ = this._armatureNode._mulMat, f = !1, d = 0, p = e.length; d < p; d++) { + var m = e[d]; + if (m && m.isValid) { + var y = a ? s[m._boneIndex] : m._bone; + y && !y._isInPool ? (l = m._worldMatrix, + h = m._rootNode._worldMatrix, + c = y.globalTransformMatrix, + u = void 0, + (u = o.m)[0] = c.a, + u[1] = c.b, + u[4] = -c.c, + u[5] = -c.d, + u[12] = c.tx, + u[13] = c.ty, + _(l, h, o), + m._renderFlag &= ~r) : (m.removeFromParent(!0), + m.destroy(), + e[d] = null, + f = !0) + } else + e[d] = null, + f = !0 + } + f && this._rebuildNodeArray() + } + } + } + }); + e.exports = dragonBones.AttachUtil = l + } + ), { + "../../cocos2d/core/renderer/render-flow": 225, + "../../cocos2d/core/value-types/mat4": 284 + }], + 358: [(function(t) { + "use strict"; + var e = t("../../cocos2d/core/event/event-target"); + dragonBones.CCArmatureDisplay = cc.Class({ + name: "dragonBones.CCArmatureDisplay", + properties: { + node: { + get: function() { + return this + } + } + }, + ctor: function() { + this._eventTarget = new e + }, + setEventTarget: function(t) { + this._eventTarget = t + }, + getRootDisplay: function() { + var t, e = this._armature._parent; + if (!e) + return this; + for (; e; ) + t = e, + e = e._armature._parent; + return t._armature.getDisplay() + }, + convertToRootSpace: function(t) { + var e = this._armature._parent; + if (!e) + return t; + e.updateWorldMatrix(); + var i = e._worldMatrix.m + , n = cc.v2(0, 0); + return n.x = t.x * i[0] + t.y * i[4] + i[12], + n.y = t.x * i[1] + t.y * i[5] + i[13], + n + }, + convertToWorldSpace: function(t) { + var e = this.convertToRootSpace(t); + return this.getRootNode().convertToWorldSpaceAR(e) + }, + getRootNode: function() { + var t = this.getRootDisplay(); + return t && t._ccNode + }, + dbInit: function(t) { + this._armature = t + }, + dbClear: function() { + this._armature = null + }, + dbUpdate: function() {}, + advanceTimeBySelf: function(t) { + this.shouldAdvanced = !!t + }, + hasDBEventListener: function(t) { + return this._eventTarget.hasEventListener(t) + }, + addDBEventListener: function(t, e, i) { + this._eventTarget.on(t, e, i) + }, + removeDBEventListener: function(t, e, i) { + this._eventTarget.off(t, e, i) + }, + dispatchDBEvent: function(t, e) { + this._eventTarget.emit(t, e) + } + }) + } + ), { + "../../cocos2d/core/event/event-target": 140 + }], + 359: [(function() { + "use strict"; + var t = dragonBones.BaseObject + , e = dragonBones.BaseFactory + , i = dragonBones.CCFactory = cc.Class({ + name: "dragonBones.CCFactory", + extends: e, + statics: { + _factory: null, + getInstance: function() { + return i._factory || (i._factory = new i), + i._factory + } + }, + ctor: function() { + var t = new dragonBones.CCArmatureDisplay; + this._dragonBones = new dragonBones.DragonBones(t), + cc.director._scheduler && (cc.game.on(cc.game.EVENT_RESTART, this.initUpdate, this), + this.initUpdate()) + }, + initUpdate: function() { + cc.director._scheduler.enableForTarget(this), + cc.director._scheduler.scheduleUpdate(this, cc.Scheduler.PRIORITY_SYSTEM, !1) + }, + update: function(t) { + this._dragonBones.advanceTime(t) + }, + getDragonBonesDataByRawData: function(t) { + return (t instanceof ArrayBuffer ? e._binaryParser : this._dataParser).parseDragonBonesData(t, 1) + }, + buildArmatureDisplay: function(t, e, i, n) { + var r = this.buildArmature(t, e, i, n); + return r && r._display + }, + createArmatureNode: function(t, e, i) { + var n = (i = i || new cc.Node).getComponent(dragonBones.ArmatureDisplay); + return n || (n = i.addComponent(dragonBones.ArmatureDisplay)), + i.name = e, + n._armatureName = e, + n._N$dragonAsset = t.dragonAsset, + n._N$dragonAtlasAsset = t.dragonAtlasAsset, + n._init(), + n + }, + _buildTextureAtlasData: function(e, i) { + return e ? e.renderTexture = i : e = t.borrowObject(dragonBones.CCTextureAtlasData), + e + }, + _sortSlots: function() { + for (var t = this._slots, e = [], i = 0, n = t.length; i < n; i++) { + for (var r = t[i], s = r._zOrder, a = !1, o = e.length - 1; o >= 0; o--) + if (s >= e[o]._zOrder) { + e.splice(o + 1, 0, r), + a = !0; + break + } + a || e.splice(0, 0, r) + } + this._slots = e + }, + _buildArmature: function(e) { + var i = t.borrowObject(dragonBones.Armature); + i._skinData = e.skin, + i._animation = t.borrowObject(dragonBones.Animation), + i._animation._armature = i, + i._animation.animations = e.armature.animations, + i._isChildArmature = !1; + var n = new dragonBones.CCArmatureDisplay; + return i.init(e.armature, n, n, this._dragonBones), + i + }, + _buildSlot: function(e, i, n) { + var r = t.borrowObject(dragonBones.CCSlot) + , s = r; + return r.init(i, n, s, s), + r + }, + getDragonBonesDataByUUID: function(t) { + for (var e in this._dragonBonesDataMap) + if (-1 != e.indexOf(t)) + return this._dragonBonesDataMap[e]; + return null + }, + removeDragonBonesDataByUUID: function(t, e) { + for (var i in void 0 === e && (e = !0), + this._dragonBonesDataMap) + -1 !== i.indexOf(t) && (e && this._dragonBones.bufferObject(this._dragonBonesDataMap[i]), + delete this._dragonBonesDataMap[i]) + } + }) + } + ), {}], + 360: [(function(t) { + "use strict"; + var e, i = (e = t("../../cocos2d/core/value-types/mat4")) && e.__esModule ? e : { + default: e + }, n = dragonBones.BinaryOffset, r = dragonBones.BoneType; + dragonBones.CCSlot = cc.Class({ + name: "dragonBones.CCSlot", + extends: dragonBones.Slot, + ctor: function() { + this._localVertices = [], + this._indices = [], + this._matrix = cc.mat4(), + this._worldMatrix = cc.mat4(), + this._worldMatrixDirty = !0, + this._visible = !1, + this._color = cc.color() + }, + _onClear: function() { + this._super(), + this._localVertices.length = 0, + this._indices.length = 0, + i.default.identity(this._matrix), + i.default.identity(this._worldMatrix), + this._worldMatrixDirty = !0, + this._color = cc.color(), + this._visible = !1 + }, + statics: { + toString: function() { + return "[class dragonBones.CCSlot]" + } + }, + _onUpdateDisplay: function() {}, + _initDisplay: function() {}, + _addDisplay: function() { + this._visible = !0 + }, + _replaceDisplay: function() {}, + _removeDisplay: function() { + this._visible = !1 + }, + _disposeDisplay: function() {}, + _updateVisible: function() { + this._visible = this.parent._visible + }, + _updateZOrder: function() {}, + _updateBlendMode: function() { + if (this._childArmature) + for (var t = this._childArmature.getSlots(), e = 0, i = t.length; e < i; e++) { + var n = t[e]; + n._blendMode = this._blendMode, + n._updateBlendMode() + } + }, + _updateColor: function() { + var t = this._color; + t.r = 255 * this._colorTransform.redMultiplier, + t.g = 255 * this._colorTransform.greenMultiplier, + t.b = 255 * this._colorTransform.blueMultiplier, + t.a = 255 * this._colorTransform.alphaMultiplier + }, + getTexture: function() { + return this._textureData && this._textureData.spriteFrame && this._textureData.spriteFrame.getTexture() + }, + _updateFrame: function() { + this._indices.length = 0; + var t = this._indices + , e = this._localVertices + , i = 0 + , r = 0 + , s = this._textureData; + if (this._display && !(this._displayIndex < 0) && s && s.spriteFrame) { + var a = s.spriteFrame.getTexture() + , o = a.width + , l = a.height + , h = s.region + , c = null !== this._deformVertices && this._display === this._meshDisplay ? this._deformVertices.verticesData : null; + if (c) { + var u = c.data + , _ = u.intArray + , f = u.floatArray + , d = _[c.offset + n.MeshVertexCount] + , p = _[c.offset + n.MeshTriangleCount] + , m = _[c.offset + n.MeshFloatOffset]; + m < 0 && (m += 65536); + for (var y = m + 2 * d, v = this._armature._armatureData.scale, g = 0, A = 2 * d; g < A; g += 2) + e[r++] = f[m + g] * v, + e[r++] = -f[m + g + 1] * v, + c.rotated ? (e[r++] = (h.x + (1 - f[y + g]) * h.width) / o, + e[r++] = (h.y + f[y + g + 1] * h.height) / l) : (e[r++] = (h.x + f[y + g] * h.width) / o, + e[r++] = (h.y + f[y + g + 1] * h.height) / l); + for (var x = 0; x < 3 * p; ++x) + t[i++] = _[c.offset + n.MeshVertexIndices + x]; + e.length = r, + t.length = i, + c.weight && this._identityTransform() + } else { + var b = h.x / o + , C = (h.y + h.height) / l + , T = (h.x + h.width) / o + , S = h.y / l; + e[r++] = 0, + e[r++] = 0, + e[r++] = b, + e[r++] = C, + e[r++] = h.width, + e[r++] = 0, + e[r++] = T, + e[r++] = C, + e[r++] = 0, + e[r++] = h.height, + e[r++] = b, + e[r++] = S, + e[r++] = h.width, + e[r++] = h.height, + e[r++] = T, + e[r++] = S, + t[0] = 0, + t[1] = 1, + t[2] = 2, + t[3] = 1, + t[4] = 3, + t[5] = 2, + e.length = r, + t.length = 6 + } + this._visibleDirty = !0, + this._blendModeDirty = !0, + this._colorDirty = !0 + } + }, + _updateMesh: function() { + var t = this._armature._armatureData.scale + , e = this._deformVertices.vertices + , i = this._deformVertices.bones + , s = this._deformVertices.verticesData + , a = s.weight + , o = e.length > 0 && s.inheritDeform + , l = this._localVertices; + if (a) { + var h = s.data + , c = h.intArray + , u = h.floatArray + , _ = c[s.offset + n.MeshVertexCount] + , f = c[a.offset + n.WeigthFloatOffset]; + f < 0 && (f += 65536); + for (var d = 0, p = a.offset + n.WeigthBoneIndices + i.length, m = f, y = 0, v = 0; d < _; d++, + v += 4) { + for (var g = c[p++], A = 0, x = 0, b = 0; b < g; ++b) { + var C = i[c[p++]]; + if (null !== C) { + var T = C.globalTransformMatrix + , S = u[m++] + , w = u[m++] * t + , E = u[m++] * t; + o && (w += e[y++], + E += e[y++]), + A += (T.a * w + T.c * E + T.tx) * S, + x += (T.b * w + T.d * E + T.ty) * S + } + } + l[v] = A, + l[v + 1] = -x + } + } else if (o) { + var M = this._parent._boneData.type !== r.Bone + , D = s.data + , B = D.intArray + , I = D.floatArray + , P = B[s.offset + n.MeshVertexCount] + , R = B[s.offset + n.MeshFloatOffset]; + R < 0 && (R += 65536); + for (var O = 0, L = P, F = 0; O < L; O++, + F += 4) { + var V = I[R + 2 * O] * t + e[2 * O] + , N = I[R + 2 * O + 1] * t + e[2 * O + 1]; + if (M) { + var k = this._parent._getGlobalTransformMatrix(V, N); + l[F] = k.a * V + k.c * N + k.tx, + l[F + 1] = -k.b * V + k.d * N + k.ty + } else + l[F] = V, + l[F + 1] = -N + } + } + a && this._identityTransform() + }, + _identityTransform: function() { + var t = this._matrix.m; + t[0] = 1, + t[1] = 0, + t[4] = -0, + t[5] = -1, + t[12] = 0, + t[13] = 0, + this._worldMatrixDirty = !0 + }, + _updateTransform: function() { + var t = this._matrix.m; + t[0] = this.globalTransformMatrix.a, + t[1] = this.globalTransformMatrix.b, + t[4] = -this.globalTransformMatrix.c, + t[5] = -this.globalTransformMatrix.d, + this._childArmature ? (t[12] = this.globalTransformMatrix.tx, + t[13] = this.globalTransformMatrix.ty) : (t[12] = this.globalTransformMatrix.tx - (this.globalTransformMatrix.a * this._pivotX - this.globalTransformMatrix.c * this._pivotY), + t[13] = this.globalTransformMatrix.ty - (this.globalTransformMatrix.b * this._pivotX - this.globalTransformMatrix.d * this._pivotY)), + this._worldMatrixDirty = !0 + }, + updateWorldMatrix: function() { + if (this._armature) { + var t = this._armature._parent; + if (t && t.updateWorldMatrix(), + this._worldMatrixDirty) { + this.calculWorldMatrix(); + var e = this.childArmature; + if (!e) + return; + for (var i = e.getSlots(), n = 0, r = i.length; n < r; n++) { + var s = i[n]; + s && (s._worldMatrixDirty = !0) + } + } + } + }, + _mulMat: function(t, e, i) { + var n = e.m + , r = i.m + , s = t.m + , a = n[0] + , o = n[1] + , l = n[4] + , h = n[5] + , c = n[12] + , u = n[13] + , _ = r[0] + , f = r[1] + , d = r[4] + , p = r[5] + , m = r[12] + , y = r[13]; + 0 !== o || 0 !== l ? (s[0] = _ * a + f * l, + s[1] = _ * o + f * h, + s[4] = d * a + p * l, + s[5] = d * o + p * h, + s[12] = a * m + l * y + c, + s[13] = o * m + h * y + u) : (s[0] = _ * a, + s[1] = f * h, + s[4] = d * a, + s[5] = p * h, + s[12] = a * m + c, + s[13] = h * y + u) + }, + calculWorldMatrix: function() { + var t = this._armature._parent; + t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : i.default.copy(this._worldMatrix, this._matrix), + this._worldMatrixDirty = !1 + } + }) + } + ), { + "../../cocos2d/core/value-types/mat4": 284 + }], + 361: [(function() { + "use strict"; + dragonBones.CCTextureAtlasData = cc.Class({ + extends: dragonBones.TextureAtlasData, + name: "dragonBones.CCTextureAtlasData", + properties: { + _renderTexture: { + default: null, + serializable: !1 + }, + renderTexture: { + get: function() { + return this._renderTexture + }, + set: function(t) { + if (this._renderTexture = t, + t) + for (var e in this.textures) { + var i = this.textures[e]; + if (!i.spriteFrame) { + var n; + n = i.rotated ? cc.rect(i.region.x, i.region.y, i.region.height, i.region.width) : cc.rect(i.region.x, i.region.y, i.region.width, i.region.height); + var r = cc.v2(0, 0) + , s = cc.size(n.width, n.height); + i.spriteFrame = new cc.SpriteFrame, + i.spriteFrame.setTexture(t, n, !1, r, s) + } + } + else + for (var a in this.textures) + this.textures[a].spriteFrame = null + } + } + }, + statics: { + toString: function() { + return "[class dragonBones.CCTextureAtlasData]" + } + }, + _onClear: function() { + dragonBones.TextureAtlasData.prototype._onClear.call(this), + this.renderTexture = null + }, + createTexture: function() { + return dragonBones.BaseObject.borrowObject(dragonBones.CCTextureData) + } + }), + dragonBones.CCTextureData = cc.Class({ + extends: dragonBones.TextureData, + name: "dragonBones.CCTextureData", + properties: { + spriteFrame: { + default: null, + serializable: !1 + } + }, + statics: { + toString: function() { + return "[class dragonBones.CCTextureData]" + } + }, + _onClear: function() { + dragonBones.TextureData.prototype._onClear.call(this), + this.spriteFrame = null + } + }) + } + ), {}], + 362: [(function(t, e) { + "use strict"; + var i = t("./ArmatureCache").sharedCache + , n = cc.Class({ + name: "dragonBones.DragonBonesAsset", + extends: cc.Asset, + ctor: function() { + this.reset() + }, + properties: { + _dragonBonesJson: "", + dragonBonesJson: { + get: function() { + return this._dragonBonesJson + }, + set: function(t) { + this._dragonBonesJson = t, + this._dragonBonesJsonData = JSON.parse(t), + this.reset() + } + }, + _nativeAsset: { + get: function() { + return this._buffer + }, + set: function(t) { + this._buffer = t.buffer || t, + this.reset() + }, + override: !0 + } + }, + statics: { + preventDeferredLoadDependents: !0 + }, + createNode: !1, + reset: function() { + this._clear() + }, + init: function(t, e) { + this._factory = t, + !this._dragonBonesJsonData && this.dragonBonesJson && (this._dragonBonesJsonData = JSON.parse(this.dragonBonesJson)); + var i; + if (i = this._dragonBonesJsonData ? this._dragonBonesJsonData : this._nativeAsset, + !this._uuid) { + var n = this._factory.getDragonBonesDataByRawData(i); + n ? this._uuid = n.name : cc.warn("dragonbones name is empty") + } + var r = this._uuid + "#" + e; + return this._factory.getDragonBonesData(r) ? r : (this._factory.parseDragonBonesData(i, r), + r) + }, + getArmatureEnum: !1, + getAnimsEnum: !1, + _clear: function() { + this._factory && (i.resetArmature(this._uuid), + this._factory.removeDragonBonesDataByUUID(this._uuid, !0)) + }, + destroy: function() { + this._clear(), + this._super() + } + }); + dragonBones.DragonBonesAsset = e.exports = n + } + ), { + "./ArmatureCache": 355 + }], + 363: [(function(t, e) { + "use strict"; + var i = t("./ArmatureCache").sharedCache + , n = cc.Class({ + name: "dragonBones.DragonBonesAtlasAsset", + extends: cc.Asset, + ctor: function() { + this._clear() + }, + properties: { + _atlasJson: "", + atlasJson: { + get: function() { + return this._atlasJson + }, + set: function(t) { + this._atlasJson = t, + this._atlasJsonData = JSON.parse(this.atlasJson), + this._clear() + } + }, + _texture: { + default: null, + type: cc.Texture2D, + formerlySerializedAs: "texture" + }, + texture: { + get: function() { + return this._texture + }, + set: function(t) { + this._texture = t, + this._clear() + } + }, + _textureAtlasData: null + }, + statics: { + preventDeferredLoadDependents: !0 + }, + createNode: !1, + init: function(t) { + this._factory = t, + this._atlasJsonData || (this._atlasJsonData = JSON.parse(this.atlasJson)); + var e = this._atlasJsonData; + this._uuid = this._uuid || e.name, + this._textureAtlasData ? t.addTextureAtlasData(this._textureAtlasData, this._uuid) : this._textureAtlasData = t.parseTextureAtlasData(e, this.texture, this._uuid) + }, + _clear: function() { + this._factory && (i.resetArmature(this._uuid), + this._factory.removeTextureAtlasData(this._uuid, !0), + this._factory.removeDragonBonesDataByUUID(this._uuid, !0)), + this._textureAtlasData = null + }, + destroy: function() { + this._clear(), + this._super() + } + }); + dragonBones.DragonBonesAtlasAsset = e.exports = n + } + ), { + "./ArmatureCache": 355 + }], + 364: [(function(t) { + "use strict"; + var e = "undefined" == typeof window ? global : window; + e.dragonBones = t("./lib/dragonBones"), + void 0 !== e.dragonBones && (dragonBones._timeScale = 1, + Object.defineProperty(dragonBones, "timeScale", { + get: function() { + return this._timeScale + }, + set: function(t) { + this._timeScale = t, + this.CCFactory.getInstance()._dragonBones.clock.timeScale = t + }, + configurable: !0 + }), + dragonBones.DisplayType = { + Image: 0, + Armature: 1, + Mesh: 2 + }, + dragonBones.ArmatureType = { + Armature: 0, + MovieClip: 1, + Stage: 2 + }, + dragonBones.ExtensionType = { + FFD: 0, + AdjustColor: 10, + BevelFilter: 11, + BlurFilter: 12, + DropShadowFilter: 13, + GlowFilter: 14, + GradientBevelFilter: 15, + GradientGlowFilter: 16 + }, + dragonBones.EventType = { + Frame: 0, + Sound: 1 + }, + dragonBones.ActionType = { + Play: 0, + Stop: 1, + GotoAndPlay: 2, + GotoAndStop: 3, + FadeIn: 4, + FadeOut: 5 + }, + dragonBones.AnimationFadeOutMode = { + None: 0, + SameLayer: 1, + SameGroup: 2, + SameLayerAndGroup: 3, + All: 4 + }, + dragonBones.BinaryOffset = { + WeigthBoneCount: 0, + WeigthFloatOffset: 1, + WeigthBoneIndices: 2, + MeshVertexCount: 0, + MeshTriangleCount: 1, + MeshFloatOffset: 2, + MeshWeightOffset: 3, + MeshVertexIndices: 4, + TimelineScale: 0, + TimelineOffset: 1, + TimelineKeyFrameCount: 2, + TimelineFrameValueCount: 3, + TimelineFrameValueOffset: 4, + TimelineFrameOffset: 5, + FramePosition: 0, + FrameTweenType: 1, + FrameTweenEasingOrCurveSampleCount: 2, + FrameCurveSamples: 3, + DeformMeshOffset: 0, + DeformCount: 1, + DeformValueCount: 2, + DeformValueOffset: 3, + DeformFloatOffset: 4 + }, + dragonBones.BoneType = { + Bone: 0, + Surface: 1 + }, + t("./CCFactory"), + t("./CCSlot"), + t("./CCTextureData"), + t("./CCArmatureDisplay"), + t("./ArmatureCache"), + t("./DragonBonesAsset"), + t("./DragonBonesAtlasAsset"), + t("./ArmatureDisplay"), + t("./webgl-assembler")) + } + ), { + "./ArmatureCache": 355, + "./ArmatureDisplay": 356, + "./CCArmatureDisplay": 358, + "./CCFactory": 359, + "./CCSlot": 360, + "./CCTextureData": 361, + "./DragonBonesAsset": 362, + "./DragonBonesAtlasAsset": 363, + "./lib/dragonBones": 365, + "./webgl-assembler": 366 + }], + 365: [(function(t, e) { + "use strict"; + var i, n, r, s = Object.setPrototypeOf || Array; + r || (r = {}), + (function(t) { + var e = (function() { + function e(i) { + this._clock = new t.WorldClock, + this._events = [], + this._objects = [], + this._eventManager = null, + this._eventManager = i, + console.info("DragonBones: " + e.VERSION + "\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/") + } + return e.prototype.advanceTime = function(e) { + if (this._objects.length > 0) { + for (var i = 0, n = this._objects; i < n.length; i++) + n[i].returnToPool(); + this._objects.length = 0 + } + if (this._clock.advanceTime(e), + this._events.length > 0) { + for (var r = 0; r < this._events.length; ++r) { + var s = this._events[r] + , a = s.armature; + null !== a._armatureData && (a.eventDispatcher.dispatchDBEvent(s.type, s), + s.type === t.EventObject.SOUND_EVENT && this._eventManager.dispatchDBEvent(s.type, s)), + this.bufferObject(s) + } + this._events.length = 0 + } + } + , + e.prototype.bufferEvent = function(t) { + this._events.indexOf(t) < 0 && this._events.push(t) + } + , + e.prototype.bufferObject = function(t) { + this._objects.indexOf(t) < 0 && this._objects.push(t) + } + , + Object.defineProperty(e.prototype, "clock", { + get: function() { + return this._clock + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "eventManager", { + get: function() { + return this._eventManager + }, + enumerable: !0, + configurable: !0 + }), + e.VERSION = "5.6.300", + e.yDown = !1, + e.debug = !1, + e.debugDraw = !1, + e.webAssembly = !1, + e + } + )(); + t.DragonBones = e + } + )(r || (r = {})), + console.warn || (console.warn = function() {} + ), + console.assert || (console.assert = function() {} + ), + Date.now || (Date.now = function() { + return (new Date).getTime() + } + ), + s = function(t, e) { + function i() { + this.constructor = t + } + for (var n in e) + e.hasOwnProperty(n) && (t[n] = e[n]); + i.prototype = e.prototype, + t.prototype = new i + } + , + (function(t) { + var e = (function() { + function t() { + this.hashCode = t._hashCode++, + this._isInPool = !1 + } + return t._returnObject = function(e) { + var i = String(e.constructor) + , n = i in t._maxCountMap ? t._maxCountMap[i] : t._defaultMaxCount + , r = t._poolsMap[i] = t._poolsMap[i] || []; + r.length < n && (e._isInPool ? console.warn("The object is already in the pool.") : (e._isInPool = !0, + r.push(e))) + } + , + t.toString = function() { + throw new Error + } + , + t.setMaxCount = function(e, i) { + if ((i < 0 || i != i) && (i = 0), + null !== e) + null !== (r = (n = String(e))in t._poolsMap ? t._poolsMap[n] : null) && r.length > i && (r.length = i), + t._maxCountMap[n] = i; + else + for (var n in t._defaultMaxCount = i, + t._poolsMap) { + var r; + (r = t._poolsMap[n]).length > i && (r.length = i), + n in t._maxCountMap && (t._maxCountMap[n] = i) + } + } + , + t.clearPool = function(e) { + if (void 0 === e && (e = null), + null !== e) { + var i = String(e); + null !== (r = i in t._poolsMap ? t._poolsMap[i] : null) && r.length > 0 && (r.length = 0) + } else + for (var n in t._poolsMap) { + var r; + (r = t._poolsMap[n]).length = 0 + } + } + , + t.borrowObject = function(e) { + var i = String(e) + , n = i in t._poolsMap ? t._poolsMap[i] : null; + if (null !== n && n.length > 0) { + var r = n.pop(); + return r._isInPool = !1, + r + } + var s = new e; + return s._onClear(), + s + } + , + t.prototype.returnToPool = function() { + this._onClear(), + t._returnObject(this) + } + , + t._hashCode = 0, + t._defaultMaxCount = 3e3, + t._maxCountMap = {}, + t._poolsMap = {}, + t + } + )(); + t.BaseObject = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t, e, i, n, r, s) { + void 0 === t && (t = 1), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 1), + void 0 === r && (r = 0), + void 0 === s && (s = 0), + this.a = t, + this.b = e, + this.c = i, + this.d = n, + this.tx = r, + this.ty = s + } + return t.prototype.toString = function() { + return "[object dragonBones.Matrix] a:" + this.a + " b:" + this.b + " c:" + this.c + " d:" + this.d + " tx:" + this.tx + " ty:" + this.ty + } + , + t.prototype.copyFrom = function(t) { + return this.a = t.a, + this.b = t.b, + this.c = t.c, + this.d = t.d, + this.tx = t.tx, + this.ty = t.ty, + this + } + , + t.prototype.copyFromArray = function(t, e) { + return void 0 === e && (e = 0), + this.a = t[e], + this.b = t[e + 1], + this.c = t[e + 2], + this.d = t[e + 3], + this.tx = t[e + 4], + this.ty = t[e + 5], + this + } + , + t.prototype.identity = function() { + return this.a = this.d = 1, + this.b = this.c = 0, + this.tx = this.ty = 0, + this + } + , + t.prototype.concat = function(t) { + var e = this.a * t.a + , i = 0 + , n = 0 + , r = this.d * t.d + , s = this.tx * t.a + t.tx + , a = this.ty * t.d + t.ty; + return 0 === this.b && 0 === this.c || (e += this.b * t.c, + i += this.b * t.d, + n += this.c * t.a, + r += this.c * t.b), + 0 === t.b && 0 === t.c || (i += this.a * t.b, + n += this.d * t.c, + s += this.ty * t.c, + a += this.tx * t.b), + this.a = e, + this.b = i, + this.c = n, + this.d = r, + this.tx = s, + this.ty = a, + this + } + , + t.prototype.invert = function() { + var t = this.a + , e = this.b + , i = this.c + , n = this.d + , r = this.tx + , s = this.ty; + if (0 === e && 0 === i) + return this.b = this.c = 0, + 0 === t || 0 === n ? this.a = this.b = this.tx = this.ty = 0 : (t = this.a = 1 / t, + n = this.d = 1 / n, + this.tx = -t * r, + this.ty = -n * s), + this; + var a = t * n - e * i; + if (0 === a) + return this.a = this.d = 1, + this.b = this.c = 0, + this.tx = this.ty = 0, + this; + a = 1 / a; + var o = this.a = n * a; + return e = this.b = -e * a, + i = this.c = -i * a, + n = this.d = t * a, + this.tx = -(o * r + i * s), + this.ty = -(e * r + n * s), + this + } + , + t.prototype.transformPoint = function(t, e, i, n) { + void 0 === n && (n = !1), + i.x = this.a * t + this.c * e, + i.y = this.b * t + this.d * e, + n || (i.x += this.tx, + i.y += this.ty) + } + , + t.prototype.transformRectangle = function(t, e) { + void 0 === e && (e = !1); + var i = this.a + , n = this.b + , r = this.c + , s = this.d + , a = e ? 0 : this.tx + , o = e ? 0 : this.ty + , l = t.x + , h = t.y + , c = l + t.width + , u = h + t.height + , _ = i * l + r * h + a + , f = n * l + s * h + o + , d = i * c + r * h + a + , p = n * c + s * h + o + , m = i * c + r * u + a + , y = n * c + s * u + o + , v = i * l + r * u + a + , g = n * l + s * u + o + , A = 0; + _ > d && (A = _, + _ = d, + d = A), + m > v && (A = m, + m = v, + v = A), + t.x = Math.floor(_ < m ? _ : m), + t.width = Math.ceil((d > v ? d : v) - t.x), + f > p && (A = f, + f = p, + p = A), + y > g && (A = y, + y = g, + g = A), + t.y = Math.floor(f < y ? f : y), + t.height = Math.ceil((p > g ? p : g) - t.y) + } + , + t + } + )(); + t.Matrix = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t, e, i, n, r, s) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + void 0 === r && (r = 1), + void 0 === s && (s = 1), + this.x = t, + this.y = e, + this.skew = i, + this.rotation = n, + this.scaleX = r, + this.scaleY = s + } + return t.normalizeRadian = function(t) { + return (t = (t + Math.PI) % (2 * Math.PI)) + (t > 0 ? -Math.PI : Math.PI) + } + , + t.prototype.toString = function() { + return "[object dragonBones.Transform] x:" + this.x + " y:" + this.y + " skewX:" + 180 * this.skew / Math.PI + " skewY:" + 180 * this.rotation / Math.PI + " scaleX:" + this.scaleX + " scaleY:" + this.scaleY + } + , + t.prototype.copyFrom = function(t) { + return this.x = t.x, + this.y = t.y, + this.skew = t.skew, + this.rotation = t.rotation, + this.scaleX = t.scaleX, + this.scaleY = t.scaleY, + this + } + , + t.prototype.identity = function() { + return this.x = this.y = 0, + this.skew = this.rotation = 0, + this.scaleX = this.scaleY = 1, + this + } + , + t.prototype.add = function(t) { + return this.x += t.x, + this.y += t.y, + this.skew += t.skew, + this.rotation += t.rotation, + this.scaleX *= t.scaleX, + this.scaleY *= t.scaleY, + this + } + , + t.prototype.minus = function(t) { + return this.x -= t.x, + this.y -= t.y, + this.skew -= t.skew, + this.rotation -= t.rotation, + this.scaleX /= t.scaleX, + this.scaleY /= t.scaleY, + this + } + , + t.prototype.fromMatrix = function(e) { + var i = this.scaleX + , n = this.scaleY + , r = t.PI_Q; + this.x = e.tx, + this.y = e.ty, + this.rotation = Math.atan(e.b / e.a); + var s = Math.atan(-e.c / e.d); + return this.scaleX = this.rotation > -r && this.rotation < r ? e.a / Math.cos(this.rotation) : e.b / Math.sin(this.rotation), + this.scaleY = s > -r && s < r ? e.d / Math.cos(s) : -e.c / Math.sin(s), + i >= 0 && this.scaleX < 0 && (this.scaleX = -this.scaleX, + this.rotation = this.rotation - Math.PI), + n >= 0 && this.scaleY < 0 && (this.scaleY = -this.scaleY, + s -= Math.PI), + this.skew = s - this.rotation, + this + } + , + t.prototype.toMatrix = function(t) { + return 0 === this.rotation ? (t.a = 1, + t.b = 0) : (t.a = Math.cos(this.rotation), + t.b = Math.sin(this.rotation)), + 0 === this.skew ? (t.c = -t.b, + t.d = t.a) : (t.c = -Math.sin(this.skew + this.rotation), + t.d = Math.cos(this.skew + this.rotation)), + 1 !== this.scaleX && (t.a *= this.scaleX, + t.b *= this.scaleX), + 1 !== this.scaleY && (t.c *= this.scaleY, + t.d *= this.scaleY), + t.tx = this.x, + t.ty = this.y, + this + } + , + t.PI = Math.PI, + t.PI_D = 2 * Math.PI, + t.PI_H = Math.PI / 2, + t.PI_Q = Math.PI / 4, + t.RAD_DEG = 180 / Math.PI, + t.DEG_RAD = Math.PI / 180, + t + } + )(); + t.Transform = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t, e, i, n, r, s, a, o) { + void 0 === t && (t = 1), + void 0 === e && (e = 1), + void 0 === i && (i = 1), + void 0 === n && (n = 1), + void 0 === r && (r = 0), + void 0 === s && (s = 0), + void 0 === a && (a = 0), + void 0 === o && (o = 0), + this.alphaMultiplier = t, + this.redMultiplier = e, + this.greenMultiplier = i, + this.blueMultiplier = n, + this.alphaOffset = r, + this.redOffset = s, + this.greenOffset = a, + this.blueOffset = o + } + return t.prototype.copyFrom = function(t) { + this.alphaMultiplier = t.alphaMultiplier, + this.redMultiplier = t.redMultiplier, + this.greenMultiplier = t.greenMultiplier, + this.blueMultiplier = t.blueMultiplier, + this.alphaOffset = t.alphaOffset, + this.redOffset = t.redOffset, + this.greenOffset = t.greenOffset, + this.blueOffset = t.blueOffset + } + , + t.prototype.identity = function() { + this.alphaMultiplier = this.redMultiplier = this.greenMultiplier = this.blueMultiplier = 1, + this.alphaOffset = this.redOffset = this.greenOffset = this.blueOffset = 0 + } + , + t + } + )(); + t.ColorTransform = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t, e) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + this.x = t, + this.y = e + } + return t.prototype.copyFrom = function(t) { + this.x = t.x, + this.y = t.y + } + , + t.prototype.clear = function() { + this.x = this.y = 0 + } + , + t + } + )(); + t.Point = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t, e, i, n) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + this.x = t, + this.y = e, + this.width = i, + this.height = n + } + return t.prototype.copyFrom = function(t) { + this.x = t.x, + this.y = t.y, + this.width = t.width, + this.height = t.height + } + , + t.prototype.clear = function() { + this.x = this.y = 0, + this.width = this.height = 0 + } + , + t + } + )(); + t.Rectangle = e + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.ints = [], + e.floats = [], + e.strings = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.UserData]" + } + , + e.prototype._onClear = function() { + this.ints.length = 0, + this.floats.length = 0, + this.strings.length = 0 + } + , + e.prototype.addInt = function(t) { + this.ints.push(t) + } + , + e.prototype.addFloat = function(t) { + this.floats.push(t) + } + , + e.prototype.addString = function(t) { + this.strings.push(t) + } + , + e.prototype.getInt = function(t) { + return void 0 === t && (t = 0), + t >= 0 && t < this.ints.length ? this.ints[t] : 0 + } + , + e.prototype.getFloat = function(t) { + return void 0 === t && (t = 0), + t >= 0 && t < this.floats.length ? this.floats[t] : 0 + } + , + e.prototype.getString = function(t) { + return void 0 === t && (t = 0), + t >= 0 && t < this.strings.length ? this.strings[t] : "" + } + , + e + } + )(t.BaseObject); + t.UserData = e; + var i = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.data = null, + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.ActionData]" + } + , + e.prototype._onClear = function() { + null !== this.data && this.data.returnToPool(), + this.type = 0, + this.name = "", + this.bone = null, + this.slot = null, + this.data = null + } + , + e + } + )(t.BaseObject); + t.ActionData = i + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.frameIndices = [], + e.cachedFrames = [], + e.armatureNames = [], + e.armatures = {}, + e.userData = null, + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.DragonBonesData]" + } + , + e.prototype._onClear = function() { + for (var t in this.armatures) + this.armatures[t].returnToPool(), + delete this.armatures[t]; + null !== this.userData && this.userData.returnToPool(), + this.autoSearch = !1, + this.frameRate = 0, + this.version = "", + this.name = "", + this.stage = null, + this.frameIndices.length = 0, + this.cachedFrames.length = 0, + this.armatureNames.length = 0, + this.binary = null, + this.intArray = null, + this.floatArray = null, + this.frameIntArray = null, + this.frameFloatArray = null, + this.frameArray = null, + this.timelineArray = null, + this.userData = null + } + , + e.prototype.addArmature = function(t) { + t.name in this.armatures ? console.warn("Same armature: " + t.name) : (t.parent = this, + this.armatures[t.name] = t, + this.armatureNames.push(t.name)) + } + , + e.prototype.getArmature = function(t) { + return t in this.armatures ? this.armatures[t] : null + } + , + e.prototype.dispose = function() { + console.warn("\u5df2\u5e9f\u5f03"), + this.returnToPool() + } + , + e + } + )(t.BaseObject); + t.DragonBonesData = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.aabb = new t.Rectangle, + i.animationNames = [], + i.sortedBones = [], + i.sortedSlots = [], + i.defaultActions = [], + i.actions = [], + i.bones = {}, + i.slots = {}, + i.constraints = {}, + i.skins = {}, + i.animations = {}, + i.canvas = null, + i.userData = null, + i + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.ArmatureData]" + } + , + i.prototype._onClear = function() { + for (var t = 0, e = this.defaultActions; t < e.length; t++) + e[t].returnToPool(); + for (var i = 0, n = this.actions; i < n.length; i++) + n[i].returnToPool(); + for (var r in this.bones) + this.bones[r].returnToPool(), + delete this.bones[r]; + for (var r in this.slots) + this.slots[r].returnToPool(), + delete this.slots[r]; + for (var r in this.constraints) + this.constraints[r].returnToPool(), + delete this.constraints[r]; + for (var r in this.skins) + this.skins[r].returnToPool(), + delete this.skins[r]; + for (var r in this.animations) + this.animations[r].returnToPool(), + delete this.animations[r]; + null !== this.canvas && this.canvas.returnToPool(), + null !== this.userData && this.userData.returnToPool(), + this.type = 0, + this.frameRate = 0, + this.cacheFrameRate = 0, + this.scale = 1, + this.name = "", + this.aabb.clear(), + this.animationNames.length = 0, + this.sortedBones.length = 0, + this.sortedSlots.length = 0, + this.defaultActions.length = 0, + this.actions.length = 0, + this.defaultSkin = null, + this.defaultAnimation = null, + this.canvas = null, + this.userData = null, + this.parent = null + } + , + i.prototype.sortBones = function() { + var t = this.sortedBones.length; + if (!(t <= 0)) { + var e = this.sortedBones.concat() + , i = 0 + , n = 0; + for (this.sortedBones.length = 0; n < t; ) { + var r = e[i++]; + if (i >= t && (i = 0), + !(this.sortedBones.indexOf(r) >= 0)) { + var s = !1; + for (var a in this.constraints) { + var o = this.constraints[a]; + if (o.root === r && this.sortedBones.indexOf(o.target) < 0) { + s = !0; + break + } + } + s || null !== r.parent && this.sortedBones.indexOf(r.parent) < 0 || (this.sortedBones.push(r), + n++) + } + } + } + } + , + i.prototype.cacheFrames = function(t) { + if (!(this.cacheFrameRate > 0)) + for (var e in this.cacheFrameRate = t, + this.animations) + this.animations[e].cacheFrames(this.cacheFrameRate) + } + , + i.prototype.setCacheFrame = function(t, e) { + var i = this.parent.cachedFrames + , n = i.length; + return i.length += 10, + i[n] = t.a, + i[n + 1] = t.b, + i[n + 2] = t.c, + i[n + 3] = t.d, + i[n + 4] = t.tx, + i[n + 5] = t.ty, + i[n + 6] = e.rotation, + i[n + 7] = e.skew, + i[n + 8] = e.scaleX, + i[n + 9] = e.scaleY, + n + } + , + i.prototype.getCacheFrame = function(t, e, i) { + var n = this.parent.cachedFrames; + t.a = n[i], + t.b = n[i + 1], + t.c = n[i + 2], + t.d = n[i + 3], + t.tx = n[i + 4], + t.ty = n[i + 5], + e.rotation = n[i + 6], + e.skew = n[i + 7], + e.scaleX = n[i + 8], + e.scaleY = n[i + 9], + e.x = t.tx, + e.y = t.ty + } + , + i.prototype.addBone = function(t) { + t.name in this.bones ? console.warn("Same bone: " + t.name) : (this.bones[t.name] = t, + this.sortedBones.push(t)) + } + , + i.prototype.addSlot = function(t) { + t.name in this.slots ? console.warn("Same slot: " + t.name) : (this.slots[t.name] = t, + this.sortedSlots.push(t)) + } + , + i.prototype.addConstraint = function(t) { + t.name in this.constraints ? console.warn("Same constraint: " + t.name) : this.constraints[t.name] = t + } + , + i.prototype.addSkin = function(t) { + t.name in this.skins ? console.warn("Same skin: " + t.name) : (t.parent = this, + this.skins[t.name] = t, + null === this.defaultSkin && (this.defaultSkin = t), + "default" === t.name && (this.defaultSkin = t)) + } + , + i.prototype.addAnimation = function(t) { + t.name in this.animations ? console.warn("Same animation: " + t.name) : (t.parent = this, + this.animations[t.name] = t, + this.animationNames.push(t.name), + null === this.defaultAnimation && (this.defaultAnimation = t)) + } + , + i.prototype.addAction = function(t, e) { + e ? this.defaultActions.push(t) : this.actions.push(t) + } + , + i.prototype.getBone = function(t) { + return t in this.bones ? this.bones[t] : null + } + , + i.prototype.getSlot = function(t) { + return t in this.slots ? this.slots[t] : null + } + , + i.prototype.getConstraint = function(t) { + return t in this.constraints ? this.constraints[t] : null + } + , + i.prototype.getSkin = function(t) { + return t in this.skins ? this.skins[t] : null + } + , + i.prototype.getMesh = function(t, e, i) { + var n = this.getSkin(t); + return null === n ? null : n.getDisplay(e, i) + } + , + i.prototype.getAnimation = function(t) { + return t in this.animations ? this.animations[t] : null + } + , + i + } + )(t.BaseObject); + t.ArmatureData = e; + var i = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.transform = new t.Transform, + i.userData = null, + i + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.BoneData]" + } + , + i.prototype._onClear = function() { + null !== this.userData && this.userData.returnToPool(), + this.inheritTranslation = !1, + this.inheritRotation = !1, + this.inheritScale = !1, + this.inheritReflection = !1, + this.type = 0, + this.length = 0, + this.name = "", + this.transform.identity(), + this.userData = null, + this.parent = null + } + , + i + } + )(t.BaseObject); + t.BoneData = i; + var n = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.vertices = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.SurfaceData]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.type = 1, + this.segmentX = 0, + this.segmentY = 0, + this.vertices.length = 0 + } + , + e + } + )(i); + t.SurfaceData = n; + var r = (function(e) { + function i() { + var t = null !== e && e.apply(this, arguments) || this; + return t.color = null, + t.userData = null, + t + } + return s(i, e), + i.createColor = function() { + return new t.ColorTransform + } + , + i.toString = function() { + return "[class dragonBones.SlotData]" + } + , + i.prototype._onClear = function() { + null !== this.userData && this.userData.returnToPool(), + this.blendMode = 0, + this.displayIndex = 0, + this.zOrder = 0, + this.name = "", + this.color = null, + this.userData = null, + this.parent = null + } + , + i.DEFAULT_COLOR = new t.ColorTransform, + i + } + )(t.BaseObject); + t.SlotData = r + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.prototype._onClear = function() { + this.order = 0, + this.name = "", + this.type = 0, + this.target = null, + this.root = null, + this.bone = null + } + , + e + } + )(t.BaseObject); + t.ConstraintData = e; + var i = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.IKConstraintData]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.scaleEnabled = !1, + this.bendPositive = !1, + this.weight = 1 + } + , + e + } + )(e); + t.IKConstraintData = i; + var n = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.bones = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.PathConstraintData]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.pathSlot = null, + this.pathDisplayData = null, + this.bones.length = 0, + this.positionMode = 0, + this.spacingMode = 1, + this.rotateMode = 1, + this.position = 0, + this.spacing = 0, + this.rotateOffset = 0, + this.rotateMix = 0, + this.translateMix = 0 + } + , + e.prototype.AddBone = function(t) { + this.bones.push(t) + } + , + e + } + )(e); + t.PathConstraintData = n + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.CanvasData]" + } + , + e.prototype._onClear = function() { + this.hasBackground = !1, + this.color = 0, + this.x = 0, + this.y = 0, + this.width = 0, + this.height = 0 + } + , + e + } + )(t.BaseObject); + t.CanvasData = e + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.displays = {}, + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.SkinData]" + } + , + e.prototype._onClear = function() { + for (var t in this.displays) { + for (var e = 0, i = this.displays[t]; e < i.length; e++) { + var n = i[e]; + null !== n && n.returnToPool() + } + delete this.displays[t] + } + this.name = "", + this.parent = null + } + , + e.prototype.addDisplay = function(t, e) { + t in this.displays || (this.displays[t] = []), + null !== e && (e.parent = this), + this.displays[t].push(e) + } + , + e.prototype.getDisplay = function(t, e) { + var i = this.getDisplays(t); + if (null !== i) + for (var n = 0, r = i; n < r.length; n++) { + var s = r[n]; + if (null !== s && s.name === e) + return s + } + return null + } + , + e.prototype.getDisplays = function(t) { + return t in this.displays ? this.displays[t] : null + } + , + e + } + )(t.BaseObject); + t.SkinData = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t() { + this.weight = null + } + return t.prototype.clear = function() { + this.isShared || null === this.weight || this.weight.returnToPool(), + this.isShared = !1, + this.inheritDeform = !1, + this.offset = 0, + this.data = null, + this.weight = null + } + , + t.prototype.shareFrom = function(t) { + this.isShared = !0, + this.offset = t.offset, + this.weight = t.weight + } + , + t + } + )(); + t.VerticesData = e; + var i = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.transform = new t.Transform, + i + } + return s(i, e), + i.prototype._onClear = function() { + this.name = "", + this.path = "", + this.transform.identity(), + this.parent = null + } + , + i + } + )(t.BaseObject); + t.DisplayData = i; + var n = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.pivot = new t.Point, + i + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.ImageDisplayData]" + } + , + i.prototype._onClear = function() { + e.prototype._onClear.call(this), + this.type = 0, + this.pivot.clear(), + this.texture = null + } + , + i + } + )(i); + t.ImageDisplayData = n; + var r = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.actions = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.ArmatureDisplayData]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this); + for (var e = 0, i = this.actions; e < i.length; e++) + i[e].returnToPool(); + this.type = 1, + this.inheritAnimation = !1, + this.actions.length = 0, + this.armature = null + } + , + e.prototype.addAction = function(t) { + this.actions.push(t) + } + , + e + } + )(i); + t.ArmatureDisplayData = r; + var a = (function(t) { + function i() { + var i = null !== t && t.apply(this, arguments) || this; + return i.vertices = new e, + i + } + return s(i, t), + i.toString = function() { + return "[class dragonBones.MeshDisplayData]" + } + , + i.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.type = 2, + this.vertices.clear(), + this.texture = null + } + , + i + } + )(i); + t.MeshDisplayData = a; + var o = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.boundingBox = null, + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.BoundingBoxDisplayData]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + null !== this.boundingBox && this.boundingBox.returnToPool(), + this.type = 3, + this.boundingBox = null + } + , + e + } + )(i); + t.BoundingBoxDisplayData = o; + var l = (function(t) { + function i() { + var i = null !== t && t.apply(this, arguments) || this; + return i.vertices = new e, + i.curveLengths = [], + i + } + return s(i, t), + i.toString = function() { + return "[class dragonBones.PathDisplayData]" + } + , + i.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.type = 4, + this.closed = !1, + this.constantSpeed = !1, + this.vertices.clear(), + this.curveLengths.length = 0 + } + , + i + } + )(i); + t.PathDisplayData = l; + var h = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.bones = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.WeightData]" + } + , + e.prototype._onClear = function() { + this.count = 0, + this.offset = 0, + this.bones.length = 0 + } + , + e.prototype.addBone = function(t) { + this.bones.push(t) + } + , + e + } + )(t.BaseObject); + t.WeightData = h + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.prototype._onClear = function() { + this.color = 0, + this.width = 0, + this.height = 0 + } + , + e + } + )(t.BaseObject); + t.BoundingBoxData = e; + var i = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.RectangleBoundingBoxData]" + } + , + e._computeOutCode = function(t, e, i, n, r, s) { + var a = 0; + return t < i ? a |= 1 : t > r && (a |= 2), + e < n ? a |= 4 : e > s && (a |= 8), + a + } + , + e.rectangleIntersectsSegment = function(t, i, n, r, s, a, o, l, h, c, u) { + void 0 === h && (h = null), + void 0 === c && (c = null), + void 0 === u && (u = null); + var _ = t > s && t < o && i > a && i < l + , f = n > s && n < o && r > a && r < l; + if (_ && f) + return -1; + for (var d = 0, p = e._computeOutCode(t, i, s, a, o, l), m = e._computeOutCode(n, r, s, a, o, l); ; ) { + if (0 == (p | m)) { + d = 2; + break + } + if (0 != (p & m)) + break; + var y = 0 + , v = 0 + , g = 0 + , A = 0 !== p ? p : m; + 0 != (4 & A) ? (y = t + (n - t) * (a - i) / (r - i), + v = a, + null !== u && (g = .5 * -Math.PI)) : 0 != (8 & A) ? (y = t + (n - t) * (l - i) / (r - i), + v = l, + null !== u && (g = .5 * Math.PI)) : 0 != (2 & A) ? (v = i + (r - i) * (o - t) / (n - t), + y = o, + null !== u && (g = 0)) : 0 != (1 & A) && (v = i + (r - i) * (s - t) / (n - t), + y = s, + null !== u && (g = Math.PI)), + A === p ? (t = y, + i = v, + p = e._computeOutCode(t, i, s, a, o, l), + null !== u && (u.x = g)) : (n = y, + r = v, + m = e._computeOutCode(n, r, s, a, o, l), + null !== u && (u.y = g)) + } + return d && (_ ? (d = 2, + null !== h && (h.x = n, + h.y = r), + null !== c && (c.x = n, + c.y = n), + null !== u && (u.x = u.y + Math.PI)) : f ? (d = 1, + null !== h && (h.x = t, + h.y = i), + null !== c && (c.x = t, + c.y = i), + null !== u && (u.y = u.x + Math.PI)) : (d = 3, + null !== h && (h.x = t, + h.y = i), + null !== c && (c.x = n, + c.y = r))), + d + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.type = 0 + } + , + e.prototype.containsPoint = function(t, e) { + var i = .5 * this.width; + if (t >= -i && t <= i) { + var n = .5 * this.height; + if (e >= -n && e <= n) + return !0 + } + return !1 + } + , + e.prototype.intersectsSegment = function(t, i, n, r, s, a, o) { + void 0 === s && (s = null), + void 0 === a && (a = null), + void 0 === o && (o = null); + var l = .5 * this.width + , h = .5 * this.height; + return e.rectangleIntersectsSegment(t, i, n, r, -l, -h, l, h, s, a, o) + } + , + e + } + )(e); + t.RectangleBoundingBoxData = i; + var n = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.EllipseData]" + } + , + e.ellipseIntersectsSegment = function(t, e, i, n, r, s, a, o, l, h, c) { + void 0 === l && (l = null), + void 0 === h && (h = null), + void 0 === c && (c = null); + var u = a / o + , _ = u * u + , f = i - t + , d = (n *= u) - (e *= u) + , p = Math.sqrt(f * f + d * d) + , m = f / p + , y = d / p + , v = (r - t) * m + (s - e) * y + , g = a * a + , A = g - (t * t + e * e) + v * v + , x = 0; + if (A >= 0) { + var b = Math.sqrt(A) + , C = v - b + , T = v + b + , S = C < 0 ? -1 : C <= p ? 0 : 1 + , w = T < 0 ? -1 : T <= p ? 0 : 1 + , E = S * w; + if (E < 0) + return -1; + 0 === E && (-1 === S ? (x = 2, + i = t + T * m, + n = (e + T * y) / u, + null !== l && (l.x = i, + l.y = n), + null !== h && (h.x = i, + h.y = n), + null !== c && (c.x = Math.atan2(n / g * _, i / g), + c.y = c.x + Math.PI)) : 1 === w ? (x = 1, + t += C * m, + e = (e + C * y) / u, + null !== l && (l.x = t, + l.y = e), + null !== h && (h.x = t, + h.y = e), + null !== c && (c.x = Math.atan2(e / g * _, t / g), + c.y = c.x + Math.PI)) : (x = 3, + null !== l && (l.x = t + C * m, + l.y = (e + C * y) / u, + null !== c && (c.x = Math.atan2(l.y / g * _, l.x / g))), + null !== h && (h.x = t + T * m, + h.y = (e + T * y) / u, + null !== c && (c.y = Math.atan2(h.y / g * _, h.x / g))))) + } + return x + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.type = 1 + } + , + e.prototype.containsPoint = function(t, e) { + var i = .5 * this.width; + if (t >= -i && t <= i) { + var n = .5 * this.height; + if (e >= -n && e <= n) + return e *= i / n, + Math.sqrt(t * t + e * e) <= i + } + return !1 + } + , + e.prototype.intersectsSegment = function(t, i, n, r, s, a, o) { + return void 0 === s && (s = null), + void 0 === a && (a = null), + void 0 === o && (o = null), + e.ellipseIntersectsSegment(t, i, n, r, 0, 0, .5 * this.width, .5 * this.height, s, a, o) + } + , + e + } + )(e); + t.EllipseBoundingBoxData = n; + var r = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.vertices = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.PolygonBoundingBoxData]" + } + , + e.polygonIntersectsSegment = function(t, e, i, n, r, s, a, o) { + void 0 === s && (s = null), + void 0 === a && (a = null), + void 0 === o && (o = null), + t === i && (t = i + 1e-6), + e === n && (e = n + 1e-6); + for (var l = r.length, h = t - i, c = e - n, u = t * n - e * i, _ = 0, f = r[l - 2], d = r[l - 1], p = 0, m = 0, y = 0, v = 0, g = 0, A = 0, x = 0; x < l; x += 2) { + var b = r[x] + , C = r[x + 1]; + f === b && (f = b + 1e-4), + d === C && (d = C + 1e-4); + var T = f - b + , S = d - C + , w = f * C - d * b + , E = h * S - c * T + , M = (u * T - h * w) / E; + if ((M >= f && M <= b || M >= b && M <= f) && (0 === h || M >= t && M <= i || M >= i && M <= t)) { + var D = (u * S - c * w) / E; + if ((D >= d && D <= C || D >= C && D <= d) && (0 === c || D >= e && D <= n || D >= n && D <= e)) { + if (null === a) { + y = M, + v = D, + g = M, + A = D, + _++, + null !== o && (o.x = Math.atan2(C - d, b - f) - .5 * Math.PI, + o.y = o.x); + break + } + var B = M - t; + B < 0 && (B = -B), + 0 === _ ? (p = B, + m = B, + y = M, + v = D, + g = M, + A = D, + null !== o && (o.x = Math.atan2(C - d, b - f) - .5 * Math.PI, + o.y = o.x)) : (B < p && (p = B, + y = M, + v = D, + null !== o && (o.x = Math.atan2(C - d, b - f) - .5 * Math.PI)), + B > m && (m = B, + g = M, + A = D, + null !== o && (o.y = Math.atan2(C - d, b - f) - .5 * Math.PI))), + _++ + } + } + f = b, + d = C + } + return 1 === _ ? (null !== s && (s.x = y, + s.y = v), + null !== a && (a.x = y, + a.y = v), + null !== o && (o.y = o.x + Math.PI)) : _ > 1 && (_++, + null !== s && (s.x = y, + s.y = v), + null !== a && (a.x = g, + a.y = A)), + _ + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.type = 2, + this.x = 0, + this.y = 0, + this.vertices.length = 0 + } + , + e.prototype.containsPoint = function(t, e) { + var i = !1; + if (t >= this.x && t <= this.width && e >= this.y && e <= this.height) + for (var n = 0, r = this.vertices.length, s = r - 2; n < r; n += 2) { + var a = this.vertices[s + 1] + , o = this.vertices[n + 1]; + if (o < e && a >= e || a < e && o >= e) { + var l = this.vertices[s] + , h = this.vertices[n]; + (e - o) * (l - h) / (a - o) + h < t && (i = !i) + } + s = n + } + return i + } + , + e.prototype.intersectsSegment = function(t, n, r, s, a, o, l) { + void 0 === a && (a = null), + void 0 === o && (o = null), + void 0 === l && (l = null); + var h = 0; + return 0 !== i.rectangleIntersectsSegment(t, n, r, s, this.x, this.y, this.x + this.width, this.y + this.height, null, null, null) && (h = e.polygonIntersectsSegment(t, n, r, s, this.vertices, a, o, l)), + h + } + , + e + } + )(e); + t.PolygonBoundingBoxData = r + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.cachedFrames = [], + e.boneTimelines = {}, + e.surfaceTimelines = {}, + e.slotTimelines = {}, + e.constraintTimelines = {}, + e.animationTimelines = {}, + e.boneCachedFrameIndices = {}, + e.slotCachedFrameIndices = {}, + e.actionTimeline = null, + e.zOrderTimeline = null, + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.AnimationData]" + } + , + e.prototype._onClear = function() { + for (var t in this.boneTimelines) { + for (var e = 0, i = this.boneTimelines[t]; e < i.length; e++) + i[e].returnToPool(); + delete this.boneTimelines[t] + } + for (var t in this.surfaceTimelines) { + for (var n = 0, r = this.surfaceTimelines[t]; n < r.length; n++) + r[n].returnToPool(); + delete this.surfaceTimelines[t] + } + for (var t in this.slotTimelines) { + for (var s = 0, a = this.slotTimelines[t]; s < a.length; s++) + a[s].returnToPool(); + delete this.slotTimelines[t] + } + for (var t in this.constraintTimelines) { + for (var o = 0, l = this.constraintTimelines[t]; o < l.length; o++) + l[o].returnToPool(); + delete this.constraintTimelines[t] + } + for (var t in this.animationTimelines) { + for (var h = 0, c = this.animationTimelines[t]; h < c.length; h++) + c[h].returnToPool(); + delete this.animationTimelines[t] + } + for (var t in this.boneCachedFrameIndices) + delete this.boneCachedFrameIndices[t]; + for (var t in this.slotCachedFrameIndices) + delete this.slotCachedFrameIndices[t]; + null !== this.actionTimeline && this.actionTimeline.returnToPool(), + null !== this.zOrderTimeline && this.zOrderTimeline.returnToPool(), + this.frameIntOffset = 0, + this.frameFloatOffset = 0, + this.frameOffset = 0, + this.frameCount = 0, + this.playTimes = 0, + this.duration = 0, + this.scale = 1, + this.fadeInTime = 0, + this.cacheFrameRate = 0, + this.name = "", + this.cachedFrames.length = 0, + this.actionTimeline = null, + this.zOrderTimeline = null, + this.parent = null + } + , + e.prototype.cacheFrames = function(t) { + if (!(this.cacheFrameRate > 0)) { + this.cacheFrameRate = Math.max(Math.ceil(t * this.scale), 1); + var e = Math.ceil(this.cacheFrameRate * this.duration) + 1; + this.cachedFrames.length = e; + for (var i = 0, n = this.cacheFrames.length; i < n; ++i) + this.cachedFrames[i] = !1; + for (var r = 0, s = this.parent.sortedBones; r < s.length; r++) { + var a = s[r]; + for (i = 0, + n = (h = new Array(e)).length; i < n; ++i) + h[i] = -1; + this.boneCachedFrameIndices[a.name] = h + } + for (var o = 0, l = this.parent.sortedSlots; o < l.length; o++) { + var h, c = l[o]; + for (i = 0, + n = (h = new Array(e)).length; i < n; ++i) + h[i] = -1; + this.slotCachedFrameIndices[c.name] = h + } + } + } + , + e.prototype.addBoneTimeline = function(t, e) { + var i = t.name in this.boneTimelines ? this.boneTimelines[t.name] : this.boneTimelines[t.name] = []; + i.indexOf(e) < 0 && i.push(e) + } + , + e.prototype.addSurfaceTimeline = function(t, e) { + var i = t.name in this.surfaceTimelines ? this.surfaceTimelines[t.name] : this.surfaceTimelines[t.name] = []; + i.indexOf(e) < 0 && i.push(e) + } + , + e.prototype.addSlotTimeline = function(t, e) { + var i = t.name in this.slotTimelines ? this.slotTimelines[t.name] : this.slotTimelines[t.name] = []; + i.indexOf(e) < 0 && i.push(e) + } + , + e.prototype.addConstraintTimeline = function(t, e) { + var i = t.name in this.constraintTimelines ? this.constraintTimelines[t.name] : this.constraintTimelines[t.name] = []; + i.indexOf(e) < 0 && i.push(e) + } + , + e.prototype.addAnimationTimeline = function(t, e) { + var i = t in this.animationTimelines ? this.animationTimelines[t] : this.animationTimelines[t] = []; + i.indexOf(e) < 0 && i.push(e) + } + , + e.prototype.getBoneTimelines = function(t) { + return t in this.boneTimelines ? this.boneTimelines[t] : null + } + , + e.prototype.getSurfaceTimelines = function(t) { + return t in this.surfaceTimelines ? this.surfaceTimelines[t] : null + } + , + e.prototype.getSlotTimelines = function(t) { + return t in this.slotTimelines ? this.slotTimelines[t] : null + } + , + e.prototype.getConstraintTimelines = function(t) { + return t in this.constraintTimelines ? this.constraintTimelines[t] : null + } + , + e.prototype.getAnimationTimelines = function(t) { + return t in this.animationTimelines ? this.animationTimelines[t] : null + } + , + e.prototype.getBoneCachedFrameIndices = function(t) { + return t in this.boneCachedFrameIndices ? this.boneCachedFrameIndices[t] : null + } + , + e.prototype.getSlotCachedFrameIndices = function(t) { + return t in this.slotCachedFrameIndices ? this.slotCachedFrameIndices[t] : null + } + , + e + } + )(t.BaseObject); + t.AnimationData = e; + var i = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.TimelineData]" + } + , + e.prototype._onClear = function() { + this.type = 10, + this.offset = 0, + this.frameIndicesOffset = -1 + } + , + e + } + )(t.BaseObject); + t.TimelineData = i + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.boneMask = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.AnimationConfig]" + } + , + e.prototype._onClear = function() { + this.pauseFadeOut = !0, + this.fadeOutMode = 4, + this.fadeOutTweenType = 1, + this.fadeOutTime = -1, + this.actionEnabled = !0, + this.additiveBlending = !1, + this.displayControl = !0, + this.pauseFadeIn = !0, + this.resetToPose = !0, + this.fadeInTweenType = 1, + this.playTimes = -1, + this.layer = 0, + this.position = 0, + this.duration = -1, + this.timeScale = -100, + this.weight = 1, + this.fadeInTime = -1, + this.autoFadeOutTime = -1, + this.name = "", + this.animation = "", + this.group = "", + this.boneMask.length = 0 + } + , + e.prototype.clear = function() { + this._onClear() + } + , + e.prototype.copyFrom = function(t) { + this.pauseFadeOut = t.pauseFadeOut, + this.fadeOutMode = t.fadeOutMode, + this.autoFadeOutTime = t.autoFadeOutTime, + this.fadeOutTweenType = t.fadeOutTweenType, + this.actionEnabled = t.actionEnabled, + this.additiveBlending = t.additiveBlending, + this.displayControl = t.displayControl, + this.pauseFadeIn = t.pauseFadeIn, + this.resetToPose = t.resetToPose, + this.playTimes = t.playTimes, + this.layer = t.layer, + this.position = t.position, + this.duration = t.duration, + this.timeScale = t.timeScale, + this.fadeInTime = t.fadeInTime, + this.fadeOutTime = t.fadeOutTime, + this.fadeInTweenType = t.fadeInTweenType, + this.weight = t.weight, + this.name = t.name, + this.animation = t.animation, + this.group = t.group, + this.boneMask.length = t.boneMask.length; + for (var e = 0, i = this.boneMask.length; e < i; ++e) + this.boneMask[e] = t.boneMask[e] + } + , + e.prototype.containsBoneMask = function(t) { + return 0 === this.boneMask.length || this.boneMask.indexOf(t) >= 0 + } + , + e.prototype.addBoneMask = function(t, e, i) { + void 0 === i && (i = !0); + var n = t.getBone(e); + if (null !== n && (this.boneMask.indexOf(e) < 0 && this.boneMask.push(e), + i)) + for (var r = 0, s = t.getBones(); r < s.length; r++) { + var a = s[r]; + this.boneMask.indexOf(a.name) < 0 && n.contains(a) && this.boneMask.push(a.name) + } + } + , + e.prototype.removeBoneMask = function(t, e, i) { + void 0 === i && (i = !0); + var n = this.boneMask.indexOf(e); + if (n >= 0 && this.boneMask.splice(n, 1), + i) { + var r = t.getBone(e); + if (null !== r) + if (this.boneMask.length > 0) + for (var s = 0, a = t.getBones(); s < a.length; s++) { + var o = a[s] + , l = this.boneMask.indexOf(o.name); + l >= 0 && r.contains(o) && this.boneMask.splice(l, 1) + } + else + for (var h = 0, c = t.getBones(); h < c.length; h++) + (o = c[h]) !== r && (r.contains(o) || this.boneMask.push(o.name)) + } + } + , + e + } + )(t.BaseObject); + t.AnimationConfig = e + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.textures = {}, + e + } + return s(e, t), + e.prototype._onClear = function() { + for (var t in this.textures) + this.textures[t].returnToPool(), + delete this.textures[t]; + this.autoSearch = !1, + this.width = 0, + this.height = 0, + this.scale = 1, + this.name = "", + this.imagePath = "" + } + , + e.prototype.copyFrom = function(t) { + for (var e in this.autoSearch = t.autoSearch, + this.scale = t.scale, + this.width = t.width, + this.height = t.height, + this.name = t.name, + this.imagePath = t.imagePath, + this.textures) + this.textures[e].returnToPool(), + delete this.textures[e]; + for (var e in t.textures) { + var i = this.createTexture(); + i.copyFrom(t.textures[e]), + this.textures[e] = i + } + } + , + e.prototype.addTexture = function(t) { + t.name in this.textures ? console.warn("Same texture: " + t.name) : (t.parent = this, + this.textures[t.name] = t) + } + , + e.prototype.getTexture = function(t) { + return t in this.textures ? this.textures[t] : null + } + , + e + } + )(t.BaseObject); + t.TextureAtlasData = e; + var i = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.region = new t.Rectangle, + i.frame = null, + i + } + return s(i, e), + i.createRectangle = function() { + return new t.Rectangle + } + , + i.prototype._onClear = function() { + this.rotated = !1, + this.name = "", + this.region.clear(), + this.parent = null, + this.frame = null + } + , + i.prototype.copyFrom = function(t) { + this.rotated = t.rotated, + this.name = t.name, + this.region.copyFrom(t.region), + this.parent = t.parent, + null === this.frame && null !== t.frame ? this.frame = i.createRectangle() : null !== this.frame && null === t.frame && (this.frame = null), + null !== this.frame && null !== t.frame && this.frame.copyFrom(t.frame) + } + , + i + } + )(t.BaseObject); + t.TextureData = i + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.vertices = [], + e.bones = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.DeformVertices]" + } + , + e.prototype._onClear = function() { + this.verticesDirty = !1, + this.vertices.length = 0, + this.bones.length = 0, + this.verticesData = null + } + , + e.prototype.init = function(t, e) { + if (this.verticesData = t, + null !== this.verticesData) { + var i; + i = null !== this.verticesData.weight ? 2 * this.verticesData.weight.count : 2 * this.verticesData.data.intArray[this.verticesData.offset + 0], + this.verticesDirty = !0, + this.vertices.length = i, + this.bones.length = 0; + for (var n = 0, r = this.vertices.length; n < r; ++n) + this.vertices[n] = 0; + if (null !== this.verticesData.weight) + for (n = 0, + r = this.verticesData.weight.bones.length; n < r; ++n) { + var s = e.getBone(this.verticesData.weight.bones[n].name); + this.bones.push(s) + } + } else + this.verticesDirty = !1, + this.vertices.length = 0, + this.bones.length = 0, + this.verticesData = null + } + , + e.prototype.isBonesUpdate = function() { + for (var t = 0, e = this.bones; t < e.length; t++) { + var i = e[t]; + if (null !== i && i._childrenTransformDirty) + return !0 + } + return !1 + } + , + e + } + )(t.BaseObject); + t.DeformVertices = e + } + )(r || (r = {})), + n = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e._bones = [], + e._slots = [], + e._constraints = [], + e._actions = [], + e._animation = null, + e._proxy = null, + e._replaceTextureAtlasData = null, + e._clock = null, + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.Armature]" + } + , + e._onSortSlots = function(t, e) { + return t._zOrder > e._zOrder ? 1 : -1 + } + , + e.prototype._onClear = function() { + null !== this._clock && this._clock.remove(this); + for (var t = 0, e = this._bones; t < e.length; t++) + e[t].returnToPool(); + for (var i = 0, n = this._slots; i < n.length; i++) + n[i].returnToPool(); + for (var r = 0, s = this._constraints; r < s.length; r++) + s[r].returnToPool(); + for (var a = 0, o = this._actions; a < o.length; a++) + o[a].returnToPool(); + null !== this._animation && this._animation.returnToPool(), + null !== this._proxy && this._proxy.dbClear(), + null !== this._replaceTextureAtlasData && this._replaceTextureAtlasData.returnToPool(), + this.inheritAnimation = !0, + this.userData = null, + this._lockUpdate = !1, + this._slotsDirty = !0, + this._zOrderDirty = !1, + this._flipX = !1, + this._flipY = !1, + this._cacheFrameIndex = -1, + this._bones.length = 0, + this._slots.length = 0, + this._constraints.length = 0, + this._actions.length = 0, + this._armatureData = null, + this._animation = null, + this._proxy = null, + this._display = null, + this._replaceTextureAtlasData = null, + this._replacedTexture = null, + this._dragonBones = null, + this._clock = null, + this._parent = null + } + , + e.prototype._sortZOrder = function(t, e) { + var i = this._armatureData.sortedSlots + , n = null === t; + if (this._zOrderDirty || !n) { + for (var r = 0, s = i.length; r < s; ++r) { + var a = n ? r : t[e + r]; + if (!(a < 0 || a >= s)) { + var o = i[a] + , l = this.getSlot(o.name); + null !== l && l._setZorder(r) + } + } + this._slotsDirty = !0, + this._zOrderDirty = !n + } + } + , + e.prototype._addBone = function(t) { + this._bones.indexOf(t) < 0 && this._bones.push(t) + } + , + e.prototype._addSlot = function(t) { + this._slots.indexOf(t) < 0 && this._slots.push(t) + } + , + e.prototype._addConstraint = function(t) { + this._constraints.indexOf(t) < 0 && this._constraints.push(t) + } + , + e.prototype._bufferAction = function(t, e) { + this._actions.indexOf(t) < 0 && (e ? this._actions.push(t) : this._actions.unshift(t)) + } + , + e.prototype.dispose = function() { + null !== this._armatureData && (this._lockUpdate = !0, + this._dragonBones.bufferObject(this)) + } + , + e.prototype.init = function(t, e, n, r) { + null === this._armatureData && (this._armatureData = t, + this._animation = i.BaseObject.borrowObject(i.Animation), + this._proxy = e, + this._display = n, + this._dragonBones = r, + this._proxy.dbInit(this), + this._animation.init(this), + this._animation.animations = this._armatureData.animations) + } + , + e.prototype.advanceTime = function(t) { + if (!this._lockUpdate) + if (null !== this._armatureData) + if (null !== this._armatureData.parent) { + var i = this._cacheFrameIndex; + if (this._animation.advanceTime(t), + this._slotsDirty && (this._slotsDirty = !1, + this._slots.sort(e._onSortSlots)), + this._cacheFrameIndex < 0 || this._cacheFrameIndex !== i) { + var n = 0 + , r = 0; + for (n = 0, + r = this._bones.length; n < r; ++n) + this._bones[n].update(this._cacheFrameIndex); + for (n = 0, + r = this._slots.length; n < r; ++n) + this._slots[n].update(this._cacheFrameIndex) + } + if (this._actions.length > 0) { + this._lockUpdate = !0; + for (var s = 0, a = this._actions; s < a.length; s++) { + var o = a[s] + , l = o.actionData; + if (null !== l && 0 === l.type) + if (null !== o.slot) + null !== (u = o.slot.childArmature) && u.animation.fadeIn(l.name); + else if (null !== o.bone) + for (var h = 0, c = this.getSlots(); h < c.length; h++) { + var u, _ = c[h]; + _.parent === o.bone && null !== (u = _.childArmature) && u.animation.fadeIn(l.name) + } + else + this._animation.fadeIn(l.name); + o.returnToPool() + } + this._actions.length = 0, + this._lockUpdate = !1 + } + this._proxy.dbUpdate() + } else + console.warn("The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear()."); + else + console.warn("The armature has been disposed.") + } + , + e.prototype.invalidUpdate = function(t, e) { + if (void 0 === t && (t = null), + void 0 === e && (e = !1), + null !== t && t.length > 0) { + if (null !== (a = this.getBone(t)) && (a.invalidUpdate(), + e)) + for (var i = 0, n = this._slots; i < n.length; i++) + (h = n[i]).parent === a && h.invalidUpdate() + } else { + for (var r = 0, s = this._bones; r < s.length; r++) { + var a; + (a = s[r]).invalidUpdate() + } + if (e) + for (var o = 0, l = this._slots; o < l.length; o++) { + var h; + (h = l[o]).invalidUpdate() + } + } + } + , + e.prototype.containsPoint = function(t, e) { + for (var i = 0, n = this._slots; i < n.length; i++) { + var r = n[i]; + if (r.containsPoint(t, e)) + return r + } + return null + } + , + e.prototype.intersectsSegment = function(t, e, i, n, r, s, a) { + void 0 === r && (r = null), + void 0 === s && (s = null), + void 0 === a && (a = null); + for (var o = t === i, l = 0, h = 0, c = 0, u = 0, _ = 0, f = 0, d = 0, p = 0, m = null, y = null, v = 0, g = this._slots; v < g.length; v++) { + var A = g[v]; + if (A.intersectsSegment(t, e, i, n, r, s, a) > 0) { + if (null === r && null === s) { + m = A; + break + } + var x; + null !== r && ((x = o ? r.y - e : r.x - t) < 0 && (x = -x), + (null === m || x < l) && (l = x, + c = r.x, + u = r.y, + m = A, + a && (d = a.x))), + null !== s && ((x = s.x - t) < 0 && (x = -x), + (null === y || x > h) && (h = x, + _ = s.x, + f = s.y, + y = A, + null !== a && (p = a.y))) + } + } + return null !== m && null !== r && (r.x = c, + r.y = u, + null !== a && (a.x = d)), + null !== y && null !== s && (s.x = _, + s.y = f, + null !== a && (a.y = p)), + m + } + , + e.prototype.getBone = function(t) { + for (var e = 0, i = this._bones; e < i.length; e++) { + var n = i[e]; + if (n.name === t) + return n + } + return null + } + , + e.prototype.getBoneByDisplay = function(t) { + var e = this.getSlotByDisplay(t); + return null !== e ? e.parent : null + } + , + e.prototype.getSlot = function(t) { + for (var e = 0, i = this._slots; e < i.length; e++) { + var n = i[e]; + if (n.name === t) + return n + } + return null + } + , + e.prototype.getSlotByDisplay = function(t) { + if (null !== t) + for (var e = 0, i = this._slots; e < i.length; e++) { + var n = i[e]; + if (n.display === t) + return n + } + return null + } + , + e.prototype.getBones = function() { + return this._bones + } + , + e.prototype.getSlots = function() { + return this._slots + } + , + Object.defineProperty(e.prototype, "flipX", { + get: function() { + return this._flipX + }, + set: function(t) { + this._flipX !== t && (this._flipX = t, + this.invalidUpdate()) + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "flipY", { + get: function() { + return this._flipY + }, + set: function(t) { + this._flipY !== t && (this._flipY = t, + this.invalidUpdate()) + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "cacheFrameRate", { + get: function() { + return this._armatureData.cacheFrameRate + }, + set: function(t) { + if (this._armatureData.cacheFrameRate !== t) { + this._armatureData.cacheFrames(t); + for (var e = 0, i = this._slots; e < i.length; e++) { + var n = i[e].childArmature; + null !== n && (n.cacheFrameRate = t) + } + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "name", { + get: function() { + return this._armatureData.name + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "armatureData", { + get: function() { + return this._armatureData + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "animation", { + get: function() { + return this._animation + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "proxy", { + get: function() { + return this._proxy + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "eventDispatcher", { + get: function() { + return this._proxy + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "display", { + get: function() { + return this._display + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "replacedTexture", { + get: function() { + return this._replacedTexture + }, + set: function(t) { + if (this._replacedTexture !== t) { + null !== this._replaceTextureAtlasData && (this._replaceTextureAtlasData.returnToPool(), + this._replaceTextureAtlasData = null), + this._replacedTexture = t; + for (var e = 0, i = this._slots; e < i.length; e++) { + var n = i[e]; + n.invalidUpdate(), + n.update(-1) + } + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "clock", { + get: function() { + return this._clock + }, + set: function(t) { + if (this._clock !== t) { + null !== this._clock && this._clock.remove(this), + this._clock = t, + this._clock && this._clock.add(this); + for (var e = 0, i = this._slots; e < i.length; e++) { + var n = i[e].childArmature; + null !== n && (n.clock = this._clock) + } + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "parent", { + get: function() { + return this._parent + }, + enumerable: !0, + configurable: !0 + }), + e.prototype.replaceTexture = function(t) { + this.replacedTexture = t + } + , + e.prototype.hasEventListener = function(t) { + return this._proxy.hasDBEventListener(t) + } + , + e.prototype.addEventListener = function(t, e, i) { + this._proxy.addDBEventListener(t, e, i) + } + , + e.prototype.removeEventListener = function(t, e, i) { + this._proxy.removeDBEventListener(t, e, i) + } + , + e.prototype.enableAnimationCache = function(t) { + console.warn("Deprecated."), + this.cacheFrameRate = t + } + , + e.prototype.getDisplay = function() { + return this._display + } + , + e + } + )((i = r || (r = {})).BaseObject), + i.Armature = n, + (function(t) { + var e = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.globalTransformMatrix = new t.Matrix, + i.global = new t.Transform, + i.offset = new t.Transform, + i + } + return s(i, e), + i.prototype._onClear = function() { + this.globalTransformMatrix.identity(), + this.global.identity(), + this.offset.identity(), + this.origin = null, + this.userData = null, + this._globalDirty = !1, + this._armature = null + } + , + i.prototype.updateGlobalTransform = function() { + this._globalDirty && (this._globalDirty = !1, + this.global.fromMatrix(this.globalTransformMatrix)) + } + , + Object.defineProperty(i.prototype, "armature", { + get: function() { + return this._armature + }, + enumerable: !0, + configurable: !0 + }), + i._helpMatrix = new t.Matrix, + i._helpTransform = new t.Transform, + i._helpPoint = new t.Point, + i + } + )(t.BaseObject); + t.TransformObject = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.animationPose = new t.Transform, + i._blendState = new t.BlendState, + i + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.Bone]" + } + , + i.prototype._onClear = function() { + e.prototype._onClear.call(this), + this.offsetMode = 1, + this.animationPose.identity(), + this._transformDirty = !1, + this._childrenTransformDirty = !1, + this._localDirty = !0, + this._hasConstraint = !1, + this._visible = !0, + this._cachedFrameIndex = -1, + this._blendState.clear(), + this._boneData = null, + this._parent = null, + this._cachedFrameIndices = null + } + , + i.prototype._updateGlobalTransformMatrix = function(e) { + var i = this._boneData + , n = this.global + , r = this.globalTransformMatrix + , s = this.origin + , a = this.offset + , o = this.animationPose + , l = this._parent + , h = this._armature.flipX + , c = this._armature.flipY === t.DragonBones.yDown + , u = null !== l + , _ = 0; + if (1 === this.offsetMode ? null !== s ? (n.x = s.x + a.x + o.x, + n.scaleX = s.scaleX * a.scaleX * o.scaleX, + n.scaleY = s.scaleY * a.scaleY * o.scaleY, + t.DragonBones.yDown ? (n.y = s.y + a.y + o.y, + n.skew = s.skew + a.skew + o.skew, + n.rotation = s.rotation + a.rotation + o.rotation) : (n.y = s.y - a.y + o.y, + n.skew = s.skew - a.skew + o.skew, + n.rotation = s.rotation - a.rotation + o.rotation)) : (n.copyFrom(a), + t.DragonBones.yDown || (n.y = -n.y, + n.skew = -n.skew, + n.rotation = -n.rotation), + n.add(o)) : 0 === this.offsetMode ? null !== s ? n.copyFrom(s).add(o) : n.copyFrom(o) : (u = !1, + n.copyFrom(a), + t.DragonBones.yDown || (n.y = -n.y, + n.skew = -n.skew, + n.rotation = -n.rotation)), + u) { + var f = 0 === l._boneData.type ? l.globalTransformMatrix : l._getGlobalTransformMatrix(n.x, n.y); + if (i.inheritScale) + i.inheritRotation || (l.updateGlobalTransform(), + _ = h && c ? n.rotation - (l.global.rotation + Math.PI) : h ? n.rotation + l.global.rotation + Math.PI : c ? n.rotation + l.global.rotation : n.rotation - l.global.rotation, + n.rotation = _), + n.toMatrix(r), + r.concat(f), + i.inheritTranslation ? (n.x = r.tx, + n.y = r.ty) : (r.tx = n.x, + r.ty = n.y), + e ? n.fromMatrix(r) : this._globalDirty = !0; + else { + if (i.inheritTranslation) { + var d = n.x + , p = n.y; + n.x = f.a * d + f.c * p + f.tx, + n.y = f.b * d + f.d * p + f.ty + } else + h && (n.x = -n.x), + c && (n.y = -n.y); + i.inheritRotation ? (l.updateGlobalTransform(), + _ = l.global.scaleX < 0 ? n.rotation + l.global.rotation + Math.PI : n.rotation + l.global.rotation, + f.a * f.d - f.b * f.c < 0 && (_ -= 2 * n.rotation, + (h !== c || i.inheritReflection) && (n.skew += Math.PI), + t.DragonBones.yDown || (n.skew = -n.skew)), + n.rotation = _) : (h || c) && (h && c ? _ = n.rotation + Math.PI : (_ = h ? Math.PI - n.rotation : -n.rotation, + n.skew += Math.PI), + n.rotation = _), + n.toMatrix(r) + } + } else + (h || c) && (h && (n.x = -n.x), + c && (n.y = -n.y), + h && c ? _ = n.rotation + Math.PI : (_ = h ? Math.PI - n.rotation : -n.rotation, + n.skew += Math.PI), + n.rotation = _), + n.toMatrix(r) + } + , + i.prototype.init = function(t, e) { + null === this._boneData && (this._boneData = t, + this._armature = e, + null !== this._boneData.parent && (this._parent = this._armature.getBone(this._boneData.parent.name)), + this._armature._addBone(this), + this.origin = this._boneData.transform) + } + , + i.prototype.update = function(t) { + if (this._blendState.dirty = !1, + t >= 0 && null !== this._cachedFrameIndices) { + var e = this._cachedFrameIndices[t]; + if (e >= 0 && this._cachedFrameIndex === e) + this._transformDirty = !1; + else if (e >= 0) + this._transformDirty = !0, + this._cachedFrameIndex = e; + else { + if (this._hasConstraint) + for (var i = 0, n = this._armature._constraints; i < n.length; i++) + (a = n[i])._root === this && a.update(); + this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty ? (this._transformDirty = !0, + this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, + this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, + this._cachedFrameIndex = -1) + } + } else { + if (this._hasConstraint) + for (var r = 0, s = this._armature._constraints; r < s.length; r++) { + var a; + (a = s[r])._root === this && a.update() + } + (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && (t = -1, + this._transformDirty = !0, + this._cachedFrameIndex = -1) + } + if (this._transformDirty) + if (this._transformDirty = !1, + this._childrenTransformDirty = !0, + this._cachedFrameIndex < 0) { + var o = t >= 0; + this._localDirty && this._updateGlobalTransformMatrix(o), + o && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global)) + } else + this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex); + else + this._childrenTransformDirty && (this._childrenTransformDirty = !1); + this._localDirty = !0 + } + , + i.prototype.updateByConstraint = function() { + this._localDirty && (this._localDirty = !1, + (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && this._updateGlobalTransformMatrix(!0), + this._transformDirty = !0) + } + , + i.prototype.invalidUpdate = function() { + this._transformDirty = !0 + } + , + i.prototype.contains = function(t) { + if (t === this) + return !1; + for (var e = t; e !== this && null !== e; ) + e = e.parent; + return e === this + } + , + Object.defineProperty(i.prototype, "boneData", { + get: function() { + return this._boneData + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "visible", { + get: function() { + return this._visible + }, + set: function(t) { + if (this._visible !== t) { + this._visible = t; + for (var e = 0, i = this._armature.getSlots(); e < i.length; e++) { + var n = i[e]; + n.parent === this && n._updateVisible() + } + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "name", { + get: function() { + return this._boneData.name + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "parent", { + get: function() { + return this._parent + }, + enumerable: !0, + configurable: !0 + }), + i.prototype.getBones = function() { + console.warn("Deprecated."); + for (var t = new Array, e = 0, i = this._armature.getBones(); e < i.length; e++) { + var n = i[e]; + n.parent === this && t.push(n) + } + return t + } + , + i.prototype.getSlots = function() { + console.warn("Deprecated."); + for (var t = new Array, e = 0, i = this._armature.getSlots(); e < i.length; e++) { + var n = i[e]; + n.parent === this && t.push(n) + } + return t + } + , + Object.defineProperty(i.prototype, "slot", { + get: function() { + console.warn("Deprecated."); + for (var t = 0, e = this._armature.getSlots(); t < e.length; t++) { + var i = e[t]; + if (i.parent === this) + return i + } + return null + }, + enumerable: !0, + configurable: !0 + }), + i + } + )(t.TransformObject); + t.Bone = e + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e._vertices = [], + e._deformVertices = [], + e._hullCache = [], + e._matrixCahce = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.Surface]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this._dX = 0, + this._dY = 0, + this._k = 0, + this._kX = 0, + this._kY = 0, + this._vertices.length = 0, + this._deformVertices.length = 0, + this._matrixCahce.length = 0, + this._hullCache.length = 0 + } + , + e.prototype._getAffineTransform = function(t, e, i, n, r, s, a, o, l, h, c, u, _) { + var f = a - r + , d = o - s + , p = l - r + , m = h - s; + c.rotation = Math.atan2(d, f), + c.skew = Math.atan2(m, p) - .5 * Math.PI - c.rotation, + _ && (c.rotation += Math.PI), + c.scaleX = Math.sqrt(f * f + d * d) / i, + c.scaleY = Math.sqrt(p * p + m * m) / n, + c.toMatrix(u), + c.x = u.tx = r - (u.a * t + u.c * e), + c.y = u.ty = s - (u.b * t + u.d * e) + } + , + e.prototype._updateVertices = function() { + var t = this._boneData.vertices + , e = this._vertices + , i = this._deformVertices; + if (null !== this._parent) + if (1 === this._parent._boneData.type) + for (var n = 0, r = t.length; n < r; n += 2) { + var s = t[n] + i[n] + , a = t[n + 1] + i[n] + , o = this._parent._getGlobalTransformMatrix(s, a); + e[n] = o.a * s + o.c * a + o.tx, + e[n + 1] = o.b * s + o.d * a + o.ty + } + else { + var l = this._parent.globalTransformMatrix; + for (n = 0, + r = t.length; n < r; n += 2) + s = t[n] + i[n], + a = t[n + 1] + i[n + 1], + e[n] = l.a * s + l.c * a + l.tx, + e[n + 1] = l.b * s + l.d * a + l.ty + } + else + for (n = 0, + r = t.length; n < r; n += 2) + e[n] = t[n] + i[n], + e[n + 1] = t[n + 1] + i[n + 1] + } + , + e.prototype._updateGlobalTransformMatrix = function() { + var t = 2 * this._boneData.segmentX + , e = this._vertices.length - 2 + , i = this._vertices[0] + , n = this._vertices[1] + , r = this._vertices[t] + , s = this._vertices[t + 1] + , a = this._vertices[e] + , o = this._vertices[e + 1] + , l = this._vertices[e - t] + , h = this._vertices[e - t + 1] + , c = i + .5 * (a - i) + , u = n + .5 * (o - n) + , _ = c + .5 * (r + .5 * (l - r) - c) + , f = u + .5 * (s + .5 * (h - s) - u) + , d = r + .5 * (a - r) + , p = s + .5 * (o - s) + , m = l + .5 * (a - l) + , y = h + .5 * (o - h); + this._globalDirty = !1, + this._getAffineTransform(0, 0, 200, 200, _, f, d, p, m, y, this.global, this.globalTransformMatrix, !1) + } + , + e.prototype._getGlobalTransformMatrix = function(t, i) { + var n = 1e3; + if (t < -n || n < t || i < -n || n < i) + return this.globalTransformMatrix; + var r = !1 + , s = 200 + , a = this._boneData + , o = a.segmentX + , l = a.segmentY + , h = 2 * a.segmentX + , c = this._dX + , u = this._dY + , _ = Math.floor((t + s) / c) + , f = Math.floor((i + s) / u) + , d = 0 + , p = _ * c - s + , m = f * u - s + , y = this._matrixCahce + , v = e._helpMatrix; + if (t < -s) { + if (i < -s || i >= s) + return this.globalTransformMatrix; + if (d = 7 * (2 * (o * (l + 1) + 2 * o + l + f) + ((r = i > this._kX * (t + s) + m) ? 1 : 0)), + this._matrixCahce[d] > 0) + v.copyFromArray(y, d + 1); + else { + var g = f * (h + 2) + , A = this._hullCache[4] + , x = this._hullCache[5] + , b = this._hullCache[2] - (l - f) * A + , C = this._hullCache[3] - (l - f) * x + , T = this._vertices; + r ? this._getAffineTransform(-s, m + u, 800, u, T[g + h + 2], T[g + h + 3], b + A, C + x, T[g], T[g + 1], e._helpTransform, v, !0) : this._getAffineTransform(-n, m, 800, u, b, C, T[g], T[g + 1], b + A, C + x, e._helpTransform, v, !1), + y[d] = 1, + y[d + 1] = v.a, + y[d + 2] = v.b, + y[d + 3] = v.c, + y[d + 4] = v.d, + y[d + 5] = v.tx, + y[d + 6] = v.ty + } + } else if (t >= s) { + if (i < -s || i >= s) + return this.globalTransformMatrix; + d = 7 * (2 * (o * (l + 1) + o + f) + ((r = i > this._kX * (t - n) + m) ? 1 : 0)), + this._matrixCahce[d] > 0 ? v.copyFromArray(y, d + 1) : (g = (f + 1) * (h + 2) - 2, + A = this._hullCache[4], + x = this._hullCache[5], + b = this._hullCache[0] + f * A, + C = this._hullCache[1] + f * x, + T = this._vertices, + r ? this._getAffineTransform(n, m + u, 800, u, b + A, C + x, T[g + h + 2], T[g + h + 3], b, C, e._helpTransform, v, !0) : this._getAffineTransform(s, m, 800, u, T[g], T[g + 1], b, C, T[g + h + 2], T[g + h + 3], e._helpTransform, v, !1), + y[d] = 1, + y[d + 1] = v.a, + y[d + 2] = v.b, + y[d + 3] = v.c, + y[d + 4] = v.d, + y[d + 5] = v.tx, + y[d + 6] = v.ty) + } else if (i < -s) { + if (t < -s || t >= s) + return this.globalTransformMatrix; + d = 7 * (o * (l + 1) + 2 * _ + ((r = i > this._kY * (t - p - c) - n) ? 1 : 0)), + this._matrixCahce[d] > 0 ? v.copyFromArray(y, d + 1) : (g = 2 * _, + A = this._hullCache[10], + x = this._hullCache[11], + b = this._hullCache[8] + _ * A, + C = this._hullCache[9] + _ * x, + T = this._vertices, + r ? this._getAffineTransform(p + c, -s, c, 800, T[g + 2], T[g + 3], T[g], T[g + 1], b + A, C + x, e._helpTransform, v, !0) : this._getAffineTransform(p, -n, c, 800, b, C, b + A, C + x, T[g], T[g + 1], e._helpTransform, v, !1), + y[d] = 1, + y[d + 1] = v.a, + y[d + 2] = v.b, + y[d + 3] = v.c, + y[d + 4] = v.d, + y[d + 5] = v.tx, + y[d + 6] = v.ty) + } else if (i >= s) { + if (t < -s || t >= s) + return this.globalTransformMatrix; + d = 7 * (2 * (o * (l + 1) + o + l + f) + ((r = i > this._kY * (t - p - c) + s) ? 1 : 0)), + this._matrixCahce[d] > 0 ? v.copyFromArray(y, d + 1) : (g = l * (h + 2) + 2 * _, + A = this._hullCache[10], + x = this._hullCache[11], + b = this._hullCache[6] - (o - _) * A, + C = this._hullCache[7] - (o - _) * x, + T = this._vertices, + r ? this._getAffineTransform(p + c, n, c, 800, b + A, C + x, b, C, T[g + 2], T[g + 3], e._helpTransform, v, !0) : this._getAffineTransform(p, s, c, 800, T[g], T[g + 1], T[g + 2], T[g + 3], b, C, e._helpTransform, v, !1), + y[d] = 1, + y[d + 1] = v.a, + y[d + 2] = v.b, + y[d + 3] = v.c, + y[d + 4] = v.d, + y[d + 5] = v.tx, + y[d + 6] = v.ty) + } else + d = 7 * (2 * (o * f + _) + ((r = i > this._k * (t - p - c) + m) ? 1 : 0)), + this._matrixCahce[d] > 0 ? v.copyFromArray(y, d + 1) : (g = 2 * _ + f * (h + 2), + T = this._vertices, + r ? this._getAffineTransform(p + c, m + u, c, u, T[g + h + 4], T[g + h + 5], T[g + h + 2], T[g + h + 3], T[g + 2], T[g + 3], e._helpTransform, v, !0) : this._getAffineTransform(p, m, c, u, T[g], T[g + 1], T[g + 2], T[g + 3], T[g + h + 2], T[g + h + 3], e._helpTransform, v, !1), + y[d] = 1, + y[d + 1] = v.a, + y[d + 2] = v.b, + y[d + 3] = v.c, + y[d + 4] = v.d, + y[d + 5] = v.tx, + y[d + 6] = v.ty); + return v + } + , + e.prototype.init = function(e, i) { + if (null === this._boneData) { + t.prototype.init.call(this, e, i); + var n = e.segmentX + , r = e.segmentY + , s = e.vertices.length; + this._dX = 400 / n, + this._dY = 400 / r, + this._k = -this._dY / this._dX, + this._kX = -this._dY / 800, + this._kY = -800 / this._dX, + this._vertices.length = s, + this._deformVertices.length = s, + this._matrixCahce.length = 14 * (n * r + 2 * n + 2 * r), + this._hullCache.length = 10; + for (var a = 0; a < s; ++a) + this._deformVertices[a] = 0 + } + } + , + e.prototype.update = function(t) { + if (this._blendState.dirty = !1, + t >= 0 && null !== this._cachedFrameIndices) { + var i = this._cachedFrameIndices[t]; + if (i >= 0 && this._cachedFrameIndex === i) + this._transformDirty = !1; + else if (i >= 0) + this._transformDirty = !0, + this._cachedFrameIndex = i; + else { + if (this._hasConstraint) + for (var n = 0, r = this._armature._constraints; n < r.length; n++) + (o = r[n])._root === this && o.update(); + this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty ? (this._transformDirty = !0, + this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, + this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, + this._cachedFrameIndex = -1) + } + } else { + if (this._hasConstraint) + for (var s = 0, a = this._armature._constraints; s < a.length; s++) { + var o; + (o = a[s])._root === this && o.update() + } + (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && (t = -1, + this._transformDirty = !0, + this._cachedFrameIndex = -1) + } + if (this._transformDirty) { + this._transformDirty = !1, + this._childrenTransformDirty = !0; + for (var l = 0, h = this._matrixCahce.length; l < h; l += 7) + this._matrixCahce[l] = -1; + if (this._updateVertices(), + this._cachedFrameIndex < 0) { + var c = t >= 0; + this._localDirty && this._updateGlobalTransformMatrix(c), + c && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global)) + } else + this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex); + var u = 2 * this.global.x + , _ = 2 * this.global.y + , f = e._helpPoint; + this.globalTransformMatrix.transformPoint(1e3, -200, f), + this._hullCache[0] = f.x, + this._hullCache[1] = f.y, + this._hullCache[2] = u - f.x, + this._hullCache[3] = _ - f.y, + this.globalTransformMatrix.transformPoint(0, this._dY, f, !0), + this._hullCache[4] = f.x, + this._hullCache[5] = f.y, + this.globalTransformMatrix.transformPoint(200, 1e3, f), + this._hullCache[6] = f.x, + this._hullCache[7] = f.y, + this._hullCache[8] = u - f.x, + this._hullCache[9] = _ - f.y, + this.globalTransformMatrix.transformPoint(this._dX, 0, f, !0), + this._hullCache[10] = f.x, + this._hullCache[11] = f.y + } else + this._childrenTransformDirty && (this._childrenTransformDirty = !1); + this._localDirty = !0 + } + , + e + } + )(t.Bone); + t.Surface = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i._localMatrix = new t.Matrix, + i._colorTransform = new t.ColorTransform, + i._displayDatas = [], + i._displayList = [], + i._deformVertices = null, + i._rawDisplay = null, + i._meshDisplay = null, + i + } + return s(i, e), + i.prototype._onClear = function() { + e.prototype._onClear.call(this); + for (var i = [], n = 0, r = this._displayList; n < r.length; n++) + null !== (o = r[n]) && o !== this._rawDisplay && o !== this._meshDisplay && i.indexOf(o) < 0 && i.push(o); + for (var s = 0, a = i; s < a.length; s++) { + var o; + (o = a[s])instanceof t.Armature ? o.dispose() : this._disposeDisplay(o, !0) + } + null !== this._deformVertices && this._deformVertices.returnToPool(), + null !== this._meshDisplay && this._meshDisplay !== this._rawDisplay && this._disposeDisplay(this._meshDisplay, !1), + null !== this._rawDisplay && this._disposeDisplay(this._rawDisplay, !1), + this.displayController = null, + this._displayDirty = !1, + this._zOrderDirty = !1, + this._blendModeDirty = !1, + this._colorDirty = !1, + this._transformDirty = !1, + this._visible = !0, + this._blendMode = 0, + this._displayIndex = -1, + this._animationDisplayIndex = -1, + this._zOrder = 0, + this._cachedFrameIndex = -1, + this._pivotX = 0, + this._pivotY = 0, + this._localMatrix.identity(), + this._colorTransform.identity(), + this._displayList.length = 0, + this._displayDatas.length = 0, + this._slotData = null, + this._rawDisplayDatas = null, + this._displayData = null, + this._boundingBoxData = null, + this._textureData = null, + this._deformVertices = null, + this._rawDisplay = null, + this._meshDisplay = null, + this._display = null, + this._childArmature = null, + this._parent = null, + this._cachedFrameIndices = null + } + , + i.prototype._getDefaultRawDisplayData = function(t) { + var e = this._armature._armatureData.defaultSkin; + if (null !== e) { + var i = e.getDisplays(this._slotData.name); + if (null !== i) + return t < i.length ? i[t] : null + } + return null + } + , + i.prototype._updateDisplayData = function() { + var e = this._displayData + , n = null !== this._deformVertices ? this._deformVertices.verticesData : null + , r = this._textureData + , s = null + , a = null; + if (this._displayData = null, + this._boundingBoxData = null, + this._textureData = null, + this._displayIndex >= 0 && (null !== this._rawDisplayDatas && (s = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null), + null === s && (s = this._getDefaultRawDisplayData(this._displayIndex)), + this._displayIndex < this._displayDatas.length && (this._displayData = this._displayDatas[this._displayIndex])), + null !== this._displayData && (2 === this._displayData.type ? a = this._displayData.vertices : 4 === this._displayData.type ? a = this._displayData.vertices : null !== s && (2 === s.type ? a = s.vertices : 4 === s.type && (a = s.vertices)), + 3 === this._displayData.type ? this._boundingBoxData = this._displayData.boundingBox : null !== s && 3 === s.type && (this._boundingBoxData = s.boundingBox), + 0 === this._displayData.type ? this._textureData = this._displayData.texture : 2 === this._displayData.type && (this._textureData = this._displayData.texture)), + this._displayData !== e || a !== n || this._textureData !== r) { + if (null === a && null !== this._textureData) { + var o = this._displayData + , l = this._textureData.parent.scale * this._armature._armatureData.scale + , h = this._textureData.frame; + this._pivotX = o.pivot.x, + this._pivotY = o.pivot.y; + var c = null !== h ? h : this._textureData.region + , u = c.width + , _ = c.height; + this._textureData.rotated && null === h && (u = c.height, + _ = c.width), + this._pivotX *= u * l, + this._pivotY *= _ * l, + null !== h && (this._pivotX += h.x * l, + this._pivotY += h.y * l), + null !== this._displayData && null !== s && this._displayData !== s && (s.transform.toMatrix(i._helpMatrix), + i._helpMatrix.invert(), + i._helpMatrix.transformPoint(0, 0, i._helpPoint), + this._pivotX -= i._helpPoint.x, + this._pivotY -= i._helpPoint.y, + this._displayData.transform.toMatrix(i._helpMatrix), + i._helpMatrix.invert(), + i._helpMatrix.transformPoint(0, 0, i._helpPoint), + this._pivotX += i._helpPoint.x, + this._pivotY += i._helpPoint.y), + t.DragonBones.yDown || (this._pivotY = (this._textureData.rotated ? this._textureData.region.width : this._textureData.region.height) * l - this._pivotY) + } else + this._pivotX = 0, + this._pivotY = 0; + null !== s ? this.origin = s.transform : null !== this._displayData ? this.origin = this._displayData.transform : this.origin = null, + a !== n ? (null === this._deformVertices && (this._deformVertices = t.BaseObject.borrowObject(t.DeformVertices)), + this._deformVertices.init(a, this._armature)) : null !== this._deformVertices && this._textureData !== r && (this._deformVertices.verticesDirty = !0), + this._displayDirty = !0, + this._transformDirty = !0 + } + } + , + i.prototype._updateDisplay = function() { + var e = null !== this._display ? this._display : this._rawDisplay + , i = this._childArmature; + this._displayIndex >= 0 && this._displayIndex < this._displayList.length ? (this._display = this._displayList[this._displayIndex], + null !== this._display && this._display instanceof t.Armature ? (this._childArmature = this._display, + this._display = this._childArmature.display) : this._childArmature = null) : (this._display = null, + this._childArmature = null); + var n = null !== this._display ? this._display : this._rawDisplay; + if (n !== e && (this._onUpdateDisplay(), + this._replaceDisplay(e), + this._transformDirty = !0, + this._visibleDirty = !0, + this._blendModeDirty = !0, + this._colorDirty = !0), + n !== this._rawDisplay && n !== this._meshDisplay || this._updateFrame(), + this._childArmature !== i && (null !== i && (i._parent = null, + i.clock = null, + i.inheritAnimation && i.animation.reset()), + null !== this._childArmature && (this._childArmature._parent = this, + this._childArmature.clock = this._armature.clock, + this._childArmature.inheritAnimation))) { + if (0 === this._childArmature.cacheFrameRate) { + var r = this._armature.cacheFrameRate; + 0 !== r && (this._childArmature.cacheFrameRate = r) + } + var s = null; + if (null !== this._displayData && 1 === this._displayData.type) + s = this._displayData.actions; + else if (this._displayIndex >= 0 && null !== this._rawDisplayDatas) { + var a = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null; + null === a && (a = this._getDefaultRawDisplayData(this._displayIndex)), + null !== a && 1 === a.type && (s = a.actions) + } + if (null !== s && s.length > 0) + for (var o = 0, l = s; o < l.length; o++) { + var h = l[o] + , c = t.BaseObject.borrowObject(t.EventObject); + t.EventObject.actionDataToInstance(h, c, this._armature), + c.slot = this, + this._armature._bufferAction(c, !1) + } + else + this._childArmature.animation.play() + } + } + , + i.prototype._updateGlobalTransformMatrix = function(t) { + var e = 0 === this._parent._boneData.type ? this._parent.globalTransformMatrix : this._parent._getGlobalTransformMatrix(this.global.x, this.global.y); + this.globalTransformMatrix.copyFrom(this._localMatrix), + this.globalTransformMatrix.concat(e), + t ? this.global.fromMatrix(this.globalTransformMatrix) : this._globalDirty = !0 + } + , + i.prototype._setDisplayIndex = function(t, e) { + if (void 0 === e && (e = !1), + e) { + if (this._animationDisplayIndex === t) + return !1; + this._animationDisplayIndex = t + } + return this._displayIndex !== t && (this._displayIndex = t, + this._displayDirty = !0, + this._updateDisplayData(), + this._displayDirty) + } + , + i.prototype._setZorder = function(t) { + return this._zOrder, + this._zOrder = t, + this._zOrderDirty = !0, + this._zOrderDirty + } + , + i.prototype._setColor = function(t) { + return this._colorTransform.copyFrom(t), + this._colorDirty = !0, + this._colorDirty + } + , + i.prototype._setDisplayList = function(e) { + if (null !== e && e.length > 0) { + this._displayList.length !== e.length && (this._displayList.length = e.length); + for (var i = 0, n = e.length; i < n; ++i) { + var r = e[i]; + null !== r && r !== this._rawDisplay && r !== this._meshDisplay && !(r instanceof t.Armature) && this._displayList.indexOf(r) < 0 && this._initDisplay(r, !0), + this._displayList[i] = r + } + } else + this._displayList.length > 0 && (this._displayList.length = 0); + return this._displayIndex >= 0 && this._displayIndex < this._displayList.length ? this._displayDirty = this._display !== this._displayList[this._displayIndex] : this._displayDirty = null !== this._display, + this._updateDisplayData(), + this._displayDirty + } + , + i.prototype.init = function(t, e, i, n) { + if (null === this._slotData) { + this._slotData = t, + this._isFromCache = !1, + this._visibleDirty = !0, + this._blendModeDirty = !0, + this._colorDirty = !0, + this._blendMode = this._slotData.blendMode, + this._zOrder = this._slotData.zOrder, + this._colorTransform.copyFrom(this._slotData.color), + this._rawDisplay = i, + this._meshDisplay = n, + this._armature = e; + var r = this._armature.getBone(this._slotData.parent.name); + null !== r && (this._parent = r), + this._armature._addSlot(this), + this._initDisplay(this._rawDisplay, !1), + this._rawDisplay !== this._meshDisplay && this._initDisplay(this._meshDisplay, !1), + this._onUpdateDisplay(), + this._addDisplay() + } + } + , + i.prototype.update = function(t) { + if (this._isFromCache = !1, + this._displayDirty && (this._displayDirty = !1, + this._updateDisplay(), + this._transformDirty && (null !== this.origin ? this.global.copyFrom(this.origin).add(this.offset).toMatrix(this._localMatrix) : this.global.copyFrom(this.offset).toMatrix(this._localMatrix))), + this._zOrderDirty && (this._zOrderDirty = !1, + this._updateZOrder()), + t >= 0 && null !== this._cachedFrameIndices) { + var e = this._cachedFrameIndices[t]; + e >= 0 && this._cachedFrameIndex === e ? this._transformDirty = !1 : e >= 0 ? (this._transformDirty = !0, + this._cachedFrameIndex = e) : this._transformDirty || this._parent._childrenTransformDirty ? (this._transformDirty = !0, + this._cachedFrameIndex = -1) : this._cachedFrameIndex >= 0 ? (this._transformDirty = !1, + this._cachedFrameIndices[t] = this._cachedFrameIndex) : (this._transformDirty = !0, + this._cachedFrameIndex = -1) + } else + (this._transformDirty || this._parent._childrenTransformDirty) && (t = -1, + this._transformDirty = !0, + this._cachedFrameIndex = -1); + if (null !== this._display) { + if (this._visibleDirty && (this._visibleDirty = !1, + this._updateVisible()), + this._blendModeDirty && (this._blendModeDirty = !1, + this._updateBlendMode()), + this._colorDirty && (this._colorDirty = !1, + this._updateColor()), + null !== this._deformVertices && null !== this._deformVertices.verticesData && this._display === this._meshDisplay) { + var i = null !== this._deformVertices.verticesData.weight + , n = 0 !== this._parent._boneData.type; + if ((this._deformVertices.verticesDirty || i && this._deformVertices.isBonesUpdate() || n && this._parent._childrenTransformDirty) && (this._deformVertices.verticesDirty = !1, + this._updateMesh()), + i || n) + return + } + if (this._transformDirty) { + if (this._transformDirty = !1, + this._cachedFrameIndex < 0) { + var r = t >= 0; + this._updateGlobalTransformMatrix(r), + r && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global)) + } else + this._isFromCache = !0, + this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex); + this._updateTransform() + } + } + } + , + i.prototype.updateTransformAndMatrix = function() { + this._transformDirty && (this._transformDirty = !1, + this._updateGlobalTransformMatrix(!1)) + } + , + i.prototype.replaceDisplayData = function(t, e) { + if (void 0 === e && (e = -1), + e < 0 && (e = this._displayIndex < 0 ? 0 : this._displayIndex), + this._displayDatas.length <= e) { + this._displayDatas.length = e + 1; + for (var i = 0, n = this._displayDatas.length; i < n; ++i) + this._displayDatas[i] || (this._displayDatas[i] = null) + } + this._displayDatas[e] = t + } + , + i.prototype.containsPoint = function(t, e) { + return null !== this._boundingBoxData && (this.updateTransformAndMatrix(), + i._helpMatrix.copyFrom(this.globalTransformMatrix), + i._helpMatrix.invert(), + i._helpMatrix.transformPoint(t, e, i._helpPoint), + this._boundingBoxData.containsPoint(i._helpPoint.x, i._helpPoint.y)) + } + , + i.prototype.intersectsSegment = function(t, e, n, r, s, a, o) { + if (void 0 === s && (s = null), + void 0 === a && (a = null), + void 0 === o && (o = null), + null === this._boundingBoxData) + return 0; + this.updateTransformAndMatrix(), + i._helpMatrix.copyFrom(this.globalTransformMatrix), + i._helpMatrix.invert(), + i._helpMatrix.transformPoint(t, e, i._helpPoint), + t = i._helpPoint.x, + e = i._helpPoint.y, + i._helpMatrix.transformPoint(n, r, i._helpPoint), + n = i._helpPoint.x, + r = i._helpPoint.y; + var l = this._boundingBoxData.intersectsSegment(t, e, n, r, s, a, o); + return l > 0 && (1 === l || 2 === l ? null !== s ? (this.globalTransformMatrix.transformPoint(s.x, s.y, s), + null !== a && (a.x = s.x, + a.y = s.y)) : null !== a && this.globalTransformMatrix.transformPoint(a.x, a.y, a) : (null !== s && this.globalTransformMatrix.transformPoint(s.x, s.y, s), + null !== a && this.globalTransformMatrix.transformPoint(a.x, a.y, a)), + null !== o && (this.globalTransformMatrix.transformPoint(Math.cos(o.x), Math.sin(o.x), i._helpPoint, !0), + o.x = Math.atan2(i._helpPoint.y, i._helpPoint.x), + this.globalTransformMatrix.transformPoint(Math.cos(o.y), Math.sin(o.y), i._helpPoint, !0), + o.y = Math.atan2(i._helpPoint.y, i._helpPoint.x))), + l + } + , + i.prototype.invalidUpdate = function() { + this._displayDirty = !0, + this._transformDirty = !0 + } + , + Object.defineProperty(i.prototype, "visible", { + get: function() { + return this._visible + }, + set: function(t) { + this._visible !== t && (this._visible = t, + this._updateVisible()) + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "displayIndex", { + get: function() { + return this._displayIndex + }, + set: function(t) { + this._setDisplayIndex(t) && this.update(-1) + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "name", { + get: function() { + return this._slotData.name + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "displayList", { + get: function() { + return this._displayList.concat() + }, + set: function(e) { + var i = this._displayList.concat() + , n = new Array; + this._setDisplayList(e) && this.update(-1); + for (var r = 0, s = i; r < s.length; r++) + null !== (l = s[r]) && l !== this._rawDisplay && l !== this._meshDisplay && this._displayList.indexOf(l) < 0 && n.indexOf(l) < 0 && n.push(l); + for (var a = 0, o = n; a < o.length; a++) { + var l; + (l = o[a])instanceof t.Armature || this._disposeDisplay(l, !0) + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "slotData", { + get: function() { + return this._slotData + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "rawDisplayDatas", { + get: function() { + return this._rawDisplayDatas + }, + set: function(t) { + if (this._rawDisplayDatas !== t) + if (this._displayDirty = !0, + this._rawDisplayDatas = t, + null !== this._rawDisplayDatas) { + this._displayDatas.length = this._rawDisplayDatas.length; + for (var e = 0, i = this._displayDatas.length; e < i; ++e) { + var n = this._rawDisplayDatas[e]; + null === n && (n = this._getDefaultRawDisplayData(e)), + this._displayDatas[e] = n + } + } else + this._displayDatas.length = 0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "displayData", { + get: function() { + return this._displayData + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "boundingBoxData", { + get: function() { + return this._boundingBoxData + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "rawDisplay", { + get: function() { + return this._rawDisplay + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "meshDisplay", { + get: function() { + return this._meshDisplay + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "display", { + get: function() { + return this._display + }, + set: function(t) { + if (this._display !== t) { + var e = this._displayList.length; + if (this._displayIndex < 0 && 0 === e && (this._displayIndex = 0), + !(this._displayIndex < 0)) { + var i = this.displayList; + e <= this._displayIndex && (i.length = this._displayIndex + 1), + i[this._displayIndex] = t, + this.displayList = i + } + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "childArmature", { + get: function() { + return this._childArmature + }, + set: function(t) { + this._childArmature !== t && (this.display = t) + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "parent", { + get: function() { + return this._parent + }, + enumerable: !0, + configurable: !0 + }), + i.prototype.getDisplay = function() { + return this._display + } + , + i.prototype.setDisplay = function(t) { + this.display = t + } + , + i + } + )(t.TransformObject); + t.Slot = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i() { + return null !== e && e.apply(this, arguments) || this + } + return s(i, e), + i.prototype._onClear = function() { + this._armature = null, + this._target = null, + this._root = null, + this._bone = null + } + , + Object.defineProperty(i.prototype, "name", { + get: function() { + return this._constraintData.name + }, + enumerable: !0, + configurable: !0 + }), + i._helpMatrix = new t.Matrix, + i._helpTransform = new t.Transform, + i._helpPoint = new t.Point, + i + } + )(t.BaseObject); + t.Constraint = e; + var i = (function(e) { + function i() { + return null !== e && e.apply(this, arguments) || this + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.IKConstraint]" + } + , + i.prototype._onClear = function() { + e.prototype._onClear.call(this), + this._scaleEnabled = !1, + this._bendPositive = !1, + this._weight = 1, + this._constraintData = null + } + , + i.prototype._computeA = function() { + var e = this._target.global + , i = this._root.global + , n = this._root.globalTransformMatrix + , r = Math.atan2(e.y - i.y, e.x - i.x); + i.scaleX < 0 && (r += Math.PI), + i.rotation += t.Transform.normalizeRadian(r - i.rotation) * this._weight, + i.toMatrix(n) + } + , + i.prototype._computeB = function() { + var e = this._bone._boneData.length + , i = this._root + , n = this._target.global + , r = i.global + , s = this._bone.global + , a = this._bone.globalTransformMatrix + , o = a.a * e + , l = a.b * e + , h = o * o + l * l + , c = Math.sqrt(h) + , u = s.x - r.x + , _ = s.y - r.y + , f = u * u + _ * _ + , d = Math.sqrt(f) + , p = s.rotation + , m = r.rotation + , y = Math.atan2(_, u) + , v = (u = n.x - r.x) * u + (_ = n.y - r.y) * _ + , g = Math.sqrt(v) + , A = 0; + if (c + d <= g || g + c <= d || g + d <= c) + A = Math.atan2(n.y - r.y, n.x - r.x), + c + d <= g || d < c && (A += Math.PI); + else { + var x = (f - h + v) / (2 * v) + , b = Math.sqrt(f - x * x * v) / g + , C = r.x + u * x + , T = r.y + _ * x + , S = -_ * b + , w = u * b + , E = !1 + , M = i.parent; + if (null !== M) { + var D = M.globalTransformMatrix; + E = D.a * D.d - D.b * D.c < 0 + } + E !== this._bendPositive ? (s.x = C - S, + s.y = T - w) : (s.x = C + S, + s.y = T + w), + A = Math.atan2(s.y - r.y, s.x - r.x) + } + var B = t.Transform.normalizeRadian(A - y); + r.rotation = m + B * this._weight, + r.toMatrix(i.globalTransformMatrix); + var I = y + B * this._weight; + s.x = r.x + Math.cos(I) * d, + s.y = r.y + Math.sin(I) * d; + var P = Math.atan2(n.y - s.y, n.x - s.x); + s.scaleX < 0 && (P += Math.PI), + s.rotation = r.rotation + p - m + t.Transform.normalizeRadian(P - B - p) * this._weight, + s.toMatrix(a) + } + , + i.prototype.init = function(t, e) { + if (null === this._constraintData) { + this._constraintData = t, + this._armature = e, + this._target = this._armature.getBone(this._constraintData.target.name), + this._root = this._armature.getBone(this._constraintData.root.name), + this._bone = null !== this._constraintData.bone ? this._armature.getBone(this._constraintData.bone.name) : null; + var i = this._constraintData; + this._scaleEnabled = i.scaleEnabled, + this._bendPositive = i.bendPositive, + this._weight = i.weight, + this._root._hasConstraint = !0 + } + } + , + i.prototype.update = function() { + this._root.updateByConstraint(), + null !== this._bone ? (this._bone.updateByConstraint(), + this._computeB()) : this._computeA() + } + , + i.prototype.invalidUpdate = function() { + this._root.invalidUpdate(), + null !== this._bone && this._bone.invalidUpdate() + } + , + i + } + )(e); + t.IKConstraint = i; + var n = (function(e) { + function i() { + var t = null !== e && e.apply(this, arguments) || this; + return t._bones = [], + t._spaces = [], + t._positions = [], + t._curves = [], + t._boneLengths = [], + t._pathGlobalVertices = [], + t._segments = [10], + t + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.PathConstraint]" + } + , + i.prototype._onClear = function() { + e.prototype._onClear.call(this), + this.dirty = !1, + this.pathOffset = 0, + this.position = 0, + this.spacing = 0, + this.rotateOffset = 0, + this.rotateMix = 1, + this.translateMix = 1, + this._pathSlot = null, + this._bones.length = 0, + this._spaces.length = 0, + this._positions.length = 0, + this._curves.length = 0, + this._boneLengths.length = 0, + this._pathGlobalVertices.length = 0 + } + , + i.prototype._updatePathVertices = function(t) { + var e = this._armature + , i = e.armatureData.parent + , n = e.armatureData.scale + , r = i.intArray + , s = i.floatArray + , a = t.offset + , o = r[a + 0] + , l = r[a + 2]; + this._pathGlobalVertices.length = 2 * o; + var h = t.weight; + if (null !== h) + for (var c = this._pathSlot._deformVertices.bones, u = h.bones.length, _ = h.offset, f = r[_ + 1], d = _ + 2 + u, p = (T = 0, + 0); T < o; T++) { + for (var m = 0, y = 0, v = 0, g = r[d++]; v < g; v++) { + var A = c[r[d++]]; + if (null !== A) { + A.updateByConstraint(), + C = A.globalTransformMatrix; + var x = s[f++]; + w = s[f++] * n, + E = s[f++] * n, + m += (C.a * w + C.c * E + C.tx) * x, + y += (C.b * w + C.d * E + C.ty) * x + } + } + this._pathGlobalVertices[p++] = m, + this._pathGlobalVertices[p++] = y + } + else { + var b = this._pathSlot.parent; + b.updateByConstraint(); + for (var C = b.globalTransformMatrix, T = 0, S = l; T < o; T += 2) { + var w = s[S++] * n + , E = s[S++] * n + , M = C.a * w + C.c * E + C.tx + , D = C.b * w + C.d * E + C.ty; + this._pathGlobalVertices[T] = M, + this._pathGlobalVertices[T + 1] = D + } + } + } + , + i.prototype._computeVertices = function(t, e, i, n) { + for (var r = i, s = t; r < e; r += 2) + n[r] = this._pathGlobalVertices[s++], + n[r + 1] = this._pathGlobalVertices[s++] + } + , + i.prototype._computeBezierCurve = function(t, e, i, n, r) { + var s = this._armature.armatureData.parent.intArray[t.vertices.offset + 0] + , a = this._positions + , o = this._spaces + , l = t.closed + , h = Array() + , c = 2 * s + , u = c / 6 + , _ = -1 + , f = this.position; + a.length = 3 * e + 2; + var d = 0; + if (t.constantSpeed) { + l ? (c += 2, + h.length = s, + this._computeVertices(2, c - 4, 0, h), + this._computeVertices(0, 2, c - 4, h), + h[c - 2] = h[0], + h[c - 1] = h[1]) : (u--, + c -= 4, + h.length = c, + this._computeVertices(2, c, 0, h)); + var p = new Array(u); + d = 0; + for (var m, y, v, g, A, x, b, C, T = h[0], S = h[1], w = 0, E = 0, M = 0, D = 0, B = 0, I = 0, P = (z = 0, + 2); z < u; z++, + P += 6) + w = h[P], + E = h[P + 1], + M = h[P + 2], + D = h[P + 3], + A = 2 * (m = .1875 * (T - 2 * w + M)) + (v = .09375 * (3 * (w - M) - T + (B = h[P + 4]))), + x = 2 * (y = .1875 * (S - 2 * E + D)) + (g = .09375 * (3 * (E - D) - S + (I = h[P + 5]))), + b = .75 * (w - T) + m + .16666667 * v, + C = .75 * (E - S) + y + .16666667 * g, + d += Math.sqrt(b * b + C * C), + b += A, + C += x, + A += v, + x += g, + d += Math.sqrt(b * b + C * C), + b += A, + C += x, + d += Math.sqrt(b * b + C * C), + b += A + v, + C += x + g, + d += Math.sqrt(b * b + C * C), + p[z] = d, + T = B, + S = I; + if (n && (f *= d), + r) + for (z = 0; z < e; z++) + o[z] *= d; + for (var R = this._segments, O = 0, L = (z = 0, + H = 0, + W = 0, + 0); z < e; z++, + H += 3) { + var F = f += o[z]; + if (l) + (F %= d) < 0 && (F += d), + W = 0; + else { + if (F < 0) + continue; + if (F > d) + continue + } + for (; ; W++) { + var V = p[W]; + if (!(F > V)) { + 0 === W ? F /= V : F = (F - (G = p[W - 1])) / (V - G); + break + } + } + if (W !== _) { + _ = W; + var N = 6 * W; + for (T = h[N], + S = h[N + 1], + w = h[N + 2], + E = h[N + 3], + M = h[N + 4], + D = h[N + 5], + A = 2 * (m = .03 * (T - 2 * w + M)) + (v = .006 * (3 * (w - M) - T + (B = h[N + 6]))), + x = 2 * (y = .03 * (S - 2 * E + D)) + (g = .006 * (3 * (E - D) - S + (I = h[N + 7]))), + b = .3 * (w - T) + m + .16666667 * v, + C = .3 * (E - S) + y + .16666667 * g, + O = Math.sqrt(b * b + C * C), + R[0] = O, + N = 1; N < 8; N++) + b += A, + C += x, + A += v, + x += g, + O += Math.sqrt(b * b + C * C), + R[N] = O; + b += A, + C += x, + O += Math.sqrt(b * b + C * C), + R[8] = O, + b += A + v, + C += x + g, + O += Math.sqrt(b * b + C * C), + R[9] = O, + L = 0 + } + for (F *= O; ; L++) { + var k = R[L]; + if (!(F > k)) { + var G; + 0 === L ? F /= k : F = L + (F - (G = R[L - 1])) / (k - G); + break + } + } + this.addCurvePosition(.1 * F, T, S, w, E, M, D, B, I, a, H, i) + } + } else { + var U = t.curveLengths; + if (d = U[u -= l ? 1 : 2], + n && (f *= d), + r) + for (var z = 0; z < e; z++) + o[z] *= d; + h.length = 8; + z = 0; + for (var H = 0, W = 0; z < e; z++, + H += 3) { + if (f += o[z], + l) + (f %= d) < 0 && (f += d), + W = 0; + else { + if (f < 0) + continue; + if (f > d) + continue + } + for (var j = 0; ; W++) { + var X = U[W]; + if (!(f > X)) { + if (0 === W) + j = f / X; + else { + var Y = U[W - 1]; + j = (f - Y) / (X - Y) + } + break + } + } + W !== _ && (_ = W, + l && W === u ? (this._computeVertices(c - 4, 4, 0, h), + this._computeVertices(0, 4, 4, h)) : this._computeVertices(6 * W + 2, 8, 0, h)), + this.addCurvePosition(j, h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7], a, H, i) + } + } + } + , + i.prototype.addCurvePosition = function(t, e, i, n, r, s, a, o, l, h, c, u) { + if (0 === t) + return h[c] = e, + h[c + 1] = i, + void (h[c + 2] = 0); + if (1 === t) + return h[c] = o, + h[c + 1] = l, + void (h[c + 2] = 0); + var _ = 1 - t + , f = _ * _ + , d = t * t + , p = f * _ + , m = f * t * 3 + , y = _ * d * 3 + , v = t * d + , g = p * e + m * n + y * s + v * o + , A = p * i + m * r + y * a + v * l; + h[c] = g, + h[c + 1] = A, + h[c + 2] = u ? Math.atan2(A - (p * i + m * r + y * a), g - (p * e + m * n + y * s)) : 0 + } + , + i.prototype.init = function(t, e) { + this._constraintData = t, + this._armature = e; + var i = t; + this.pathOffset = i.pathDisplayData.vertices.offset, + this.position = i.position, + this.spacing = i.spacing, + this.rotateOffset = i.rotateOffset, + this.rotateMix = i.rotateMix, + this.translateMix = i.translateMix, + this._root = this._armature.getBone(i.root.name), + this._target = this._armature.getBone(i.target.name), + this._pathSlot = this._armature.getSlot(i.pathSlot.name); + for (var n = 0, r = i.bones.length; n < r; n++) { + var s = this._armature.getBone(i.bones[n].name); + null !== s && this._bones.push(s) + } + 2 === i.rotateMode && (this._boneLengths.length = this._bones.length), + this._root._hasConstraint = !0 + } + , + i.prototype.update = function() { + var e = this._pathSlot; + if (null !== e._deformVertices && null !== e._deformVertices.verticesData && e._deformVertices.verticesData.offset === this.pathOffset) { + var i = this._constraintData + , n = e._displayData + , r = !1 + , s = e._deformVertices; + if (this._root._childrenTransformDirty ? (this._updatePathVertices(n.vertices), + r = !0) : null !== s && (s.verticesDirty || s.isBonesUpdate()) && (this._updatePathVertices(n.vertices), + s.verticesDirty = !1, + r = !0), + r || this.dirty) { + var a = i.positionMode + , o = i.spacingMode + , l = i.rotateMode + , h = this._bones + , c = 0 === o + , u = 2 === l + , _ = 0 === l + , f = h.length + , d = _ ? f : f + 1 + , p = this.spacing + , m = this._spaces; + if (m.length = d, + u || c) { + m[0] = 0; + for (var y = 0, v = d - 1; y < v; y++) { + (I = h[y]).updateByConstraint(); + var g = I._boneData.length + , A = g * (P = I.globalTransformMatrix).a + , x = g * P.b + , b = Math.sqrt(A * A + x * x); + u && (this._boneLengths[y] = b), + m[y + 1] = (g + p) * b / g + } + } else + for (y = 0; y < d; y++) + m[y] = p; + this._computeBezierCurve(n, d, _, 1 === a, 2 === o); + var C, T = this._positions, S = this.rotateOffset, w = T[0], E = T[1]; + 0 === S ? C = 1 === l : (C = !1, + null !== (I = e.parent) && (S *= (P = I.globalTransformMatrix).a * P.d - P.b * P.c > 0 ? t.Transform.DEG_RAD : -t.Transform.DEG_RAD)); + for (var M = this.rotateMix, D = this.translateMix, B = (y = 0, + 3); y < f; y++, + B += 3) { + var I, P; + (I = h[y]).updateByConstraint(), + (P = I.globalTransformMatrix).tx += (w - P.tx) * D, + P.ty += (E - P.ty) * D; + var R = (A = T[B]) - w + , O = (x = T[B + 1]) - E; + if (u) { + var L = this._boneLengths[y] + , F = (Math.sqrt(R * R + O * O) / L - 1) * M + 1; + P.a *= F, + P.b *= F + } + if (w = A, + E = x, + M > 0) { + var V = P.a + , N = P.b + , k = P.c + , G = P.d + , U = void 0 + , z = void 0 + , H = void 0; + if (U = _ ? T[B - 1] : Math.atan2(O, R), + U -= Math.atan2(N, V), + C) { + z = Math.cos(U), + H = Math.sin(U); + var W = I._boneData.length; + w += (W * (z * V - H * N) - R) * M, + E += (W * (H * V + z * N) - O) * M + } else + U += S; + U > t.Transform.PI ? U -= t.Transform.PI_D : U < -t.Transform.PI && (U += t.Transform.PI_D), + U *= M, + z = Math.cos(U), + H = Math.sin(U), + P.a = z * V - H * N, + P.b = H * V + z * N, + P.c = z * k - H * G, + P.d = H * k + z * G + } + I.global.fromMatrix(P) + } + this.dirty = !1 + } + } + } + , + i.prototype.invalidUpdate = function() {} + , + i + } + )(e); + t.PathConstraint = n + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t) { + void 0 === t && (t = 0), + this.time = 0, + this.timeScale = 1, + this._systemTime = 0, + this._animatebles = [], + this._clock = null, + this.time = t, + this._systemTime = .001 * (new Date).getTime() + } + return t.prototype.advanceTime = function(t) { + t != t && (t = 0); + var e = .001 * Date.now(); + if (t < 0 && (t = e - this._systemTime), + this._systemTime = e, + 1 !== this.timeScale && (t *= this.timeScale), + 0 !== t) { + t < 0 ? this.time -= t : this.time += t; + for (var i = 0, n = 0, r = this._animatebles.length; i < r; ++i) { + var s = this._animatebles[i]; + null !== s ? (n > 0 && (this._animatebles[i - n] = s, + this._animatebles[i] = null), + s.advanceTime(t)) : n++ + } + if (n > 0) { + for (r = this._animatebles.length; i < r; ++i) { + var a = this._animatebles[i]; + null !== a ? this._animatebles[i - n] = a : n++ + } + this._animatebles.length -= n + } + } + } + , + t.prototype.contains = function(t) { + if (t === this) + return !1; + for (var e = t; e !== this && null !== e; ) + e = e.clock; + return e === this + } + , + t.prototype.add = function(t) { + this._animatebles.indexOf(t) < 0 && (this._animatebles.push(t), + t.clock = this) + } + , + t.prototype.remove = function(t) { + var e = this._animatebles.indexOf(t); + e >= 0 && (this._animatebles[e] = null, + t.clock = null) + } + , + t.prototype.clear = function() { + for (var t = 0, e = this._animatebles; t < e.length; t++) { + var i = e[t]; + null !== i && (i.clock = null) + } + } + , + Object.defineProperty(t.prototype, "clock", { + get: function() { + return this._clock + }, + set: function(t) { + this._clock !== t && (null !== this._clock && this._clock.remove(this), + this._clock = t, + null !== this._clock && this._clock.add(this)) + }, + enumerable: !0, + configurable: !0 + }), + t.clock = new t, + t + } + )(); + t.WorldClock = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i() { + var t = null !== e && e.apply(this, arguments) || this; + return t._animationNames = [], + t._animationStates = [], + t._animations = {}, + t._animationConfig = null, + t + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.Animation]" + } + , + i.prototype._onClear = function() { + for (var t = 0, e = this._animationStates; t < e.length; t++) + e[t].returnToPool(); + for (var i in this._animations) + delete this._animations[i]; + null !== this._animationConfig && this._animationConfig.returnToPool(), + this.timeScale = 1, + this._lockUpdate = !1, + this._animationDirty = !1, + this._inheritTimeScale = 1, + this._animationNames.length = 0, + this._animationStates.length = 0, + this._armature = null, + this._animationConfig = null, + this._lastAnimationState = null + } + , + i.prototype._fadeOut = function(t) { + switch (t.fadeOutMode) { + case 1: + for (var e = 0, i = this._animationStates; e < i.length; e++) + null === (h = i[e])._parent && h.layer === t.layer && h.fadeOut(t.fadeOutTime, t.pauseFadeOut); + break; + case 2: + for (var n = 0, r = this._animationStates; n < r.length; n++) + null === (h = r[n])._parent && h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut); + break; + case 3: + for (var s = 0, a = this._animationStates; s < a.length; s++) + null === (h = a[s])._parent && h.layer === t.layer && h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut); + break; + case 4: + for (var o = 0, l = this._animationStates; o < l.length; o++) { + var h; + null === (h = l[o])._parent && h.fadeOut(t.fadeOutTime, t.pauseFadeOut) + } + } + } + , + i.prototype.init = function(e) { + null === this._armature && (this._armature = e, + this._animationConfig = t.BaseObject.borrowObject(t.AnimationConfig)) + } + , + i.prototype.advanceTime = function(t) { + t < 0 && (t = -t), + this._armature.inheritAnimation && null !== this._armature._parent ? this._inheritTimeScale = this._armature._parent._armature.animation._inheritTimeScale * this.timeScale : this._inheritTimeScale = this.timeScale, + 1 !== this._inheritTimeScale && (t *= this._inheritTimeScale); + var e = this._animationStates.length; + if (1 === e) + if ((d = this._animationStates[0])._fadeState > 0 && d._subFadeState > 0) + this._armature._dragonBones.bufferObject(d), + this._animationStates.length = 0, + this._lastAnimationState = null; + else { + var i = d._animationData + , n = i.cacheFrameRate; + if (this._animationDirty && n > 0) { + this._animationDirty = !1; + for (var r = 0, s = this._armature.getBones(); r < s.length; r++) { + var a = s[r]; + a._cachedFrameIndices = i.getBoneCachedFrameIndices(a.name) + } + for (var o = 0, l = this._armature.getSlots(); o < l.length; o++) { + var h = l[o] + , c = h.rawDisplayDatas; + if (null !== c && c.length > 0) { + var u = c[0]; + if (null !== u && u.parent === this._armature.armatureData.defaultSkin) { + h._cachedFrameIndices = i.getSlotCachedFrameIndices(h.name); + continue + } + } + h._cachedFrameIndices = null + } + } + d.advanceTime(t, n) + } + else if (e > 1) { + for (var _ = 0, f = 0; _ < e; ++_) { + var d; + (d = this._animationStates[_])._fadeState > 0 && d._subFadeState > 0 ? (f++, + this._armature._dragonBones.bufferObject(d), + this._animationDirty = !0, + this._lastAnimationState === d && (this._lastAnimationState = null)) : (f > 0 && (this._animationStates[_ - f] = d), + d.advanceTime(t, 0)), + _ === e - 1 && f > 0 && (this._animationStates.length -= f, + null === this._lastAnimationState && this._animationStates.length > 0 && (this._lastAnimationState = this._animationStates[this._animationStates.length - 1])) + } + this._armature._cacheFrameIndex = -1 + } else + this._armature._cacheFrameIndex = -1 + } + , + i.prototype.reset = function() { + for (var t = 0, e = this._animationStates; t < e.length; t++) + e[t].returnToPool(); + this._animationDirty = !1, + this._animationConfig.clear(), + this._animationStates.length = 0, + this._lastAnimationState = null + } + , + i.prototype.stop = function(t) { + if (void 0 === t && (t = null), + null !== t) + null !== (n = this.getState(t)) && n.stop(); + else + for (var e = 0, i = this._animationStates; e < i.length; e++) { + var n; + (n = i[e]).stop() + } + } + , + i.prototype.playConfig = function(e) { + var i = e.animation; + if (!(i in this._animations)) + return console.warn("Non-existent animation.\n", "DragonBones name: " + this._armature.armatureData.parent.name, "Armature name: " + this._armature.name, "Animation name: " + i), + null; + var n = this._animations[i]; + if (5 === e.fadeOutMode) + for (var r = 0, s = this._animationStates; r < s.length; r++) { + var a = s[r]; + if (a._animationData === n) + return a + } + 0 === this._animationStates.length ? e.fadeInTime = 0 : e.fadeInTime < 0 && (e.fadeInTime = n.fadeInTime), + e.fadeOutTime < 0 && (e.fadeOutTime = e.fadeInTime), + e.timeScale <= -100 && (e.timeScale = 1 / n.scale), + n.frameCount > 1 ? (e.position < 0 ? (e.position %= n.duration, + e.position = n.duration - e.position) : e.position === n.duration ? e.position -= 1e-6 : e.position > n.duration && (e.position %= n.duration), + e.duration > 0 && e.position + e.duration > n.duration && (e.duration = n.duration - e.position), + e.playTimes < 0 && (e.playTimes = n.playTimes)) : (e.playTimes = 1, + e.position = 0, + e.duration > 0 && (e.duration = 0)), + 0 === e.duration && (e.duration = -1), + this._fadeOut(e); + var o = t.BaseObject.borrowObject(t.AnimationState); + if (o.init(this._armature, n, e), + this._animationDirty = !0, + this._armature._cacheFrameIndex = -1, + this._animationStates.length > 0) { + for (var l = !1, h = 0, c = this._animationStates.length; h < c; ++h) { + if (o.layer > this._animationStates[h].layer) { + l = !0, + this._animationStates.splice(h, 0, o); + break + } + if (h !== c - 1 && o.layer > this._animationStates[h + 1].layer) { + l = !0, + this._animationStates.splice(h + 1, 0, o); + break + } + } + l || this._animationStates.push(o) + } else + this._animationStates.push(o); + for (var u = 0, _ = this._armature.getSlots(); u < _.length; u++) { + var f = _[u].childArmature; + null !== f && f.inheritAnimation && f.animation.hasAnimation(i) && null === f.animation.getState(i) && f.animation.fadeIn(i) + } + var d = !1; + for (var p in n.animationTimelines) { + this._lockUpdate || (d = !0, + this._lockUpdate = !0); + var m = this.fadeIn(p, e.fadeInTime, 1, o.layer, null, 0); + null !== m && (m.resetToPose = !1, + m._parent = o, + m.stop()) + } + return d && (this._lockUpdate = !1), + this._lockUpdate || (e.fadeInTime <= 0 && this._armature.advanceTime(0), + this._lastAnimationState = o), + o + } + , + i.prototype.play = function(t, e) { + if (void 0 === t && (t = null), + void 0 === e && (e = -1), + this._animationConfig.clear(), + this._animationConfig.resetToPose = !0, + this._animationConfig.playTimes = e, + this._animationConfig.fadeInTime = 0, + this._animationConfig.animation = null !== t ? t : "", + null !== t && t.length > 0) + this.playConfig(this._animationConfig); + else if (null === this._lastAnimationState) { + var i = this._armature.armatureData.defaultAnimation; + null !== i && (this._animationConfig.animation = i.name, + this.playConfig(this._animationConfig)) + } else + this._lastAnimationState.isPlaying || this._lastAnimationState.isCompleted ? (this._animationConfig.animation = this._lastAnimationState.name, + this.playConfig(this._animationConfig)) : this._lastAnimationState.play(); + return this._lastAnimationState + } + , + i.prototype.fadeIn = function(t, e, i, n, r, s) { + return void 0 === e && (e = -1), + void 0 === i && (i = -1), + void 0 === n && (n = 0), + void 0 === r && (r = null), + void 0 === s && (s = 3), + this._animationConfig.clear(), + this._animationConfig.fadeOutMode = s, + this._animationConfig.playTimes = i, + this._animationConfig.layer = n, + this._animationConfig.fadeInTime = e, + this._animationConfig.animation = t, + this._animationConfig.group = null !== r ? r : "", + this.playConfig(this._animationConfig) + } + , + i.prototype.gotoAndPlayByTime = function(t, e, i) { + return void 0 === e && (e = 0), + void 0 === i && (i = -1), + this._animationConfig.clear(), + this._animationConfig.resetToPose = !0, + this._animationConfig.playTimes = i, + this._animationConfig.position = e, + this._animationConfig.fadeInTime = 0, + this._animationConfig.animation = t, + this.playConfig(this._animationConfig) + } + , + i.prototype.gotoAndPlayByFrame = function(t, e, i) { + void 0 === e && (e = 0), + void 0 === i && (i = -1), + this._animationConfig.clear(), + this._animationConfig.resetToPose = !0, + this._animationConfig.playTimes = i, + this._animationConfig.fadeInTime = 0, + this._animationConfig.animation = t; + var n = t in this._animations ? this._animations[t] : null; + return null !== n && (this._animationConfig.position = n.duration * e / n.frameCount), + this.playConfig(this._animationConfig) + } + , + i.prototype.gotoAndPlayByProgress = function(t, e, i) { + void 0 === e && (e = 0), + void 0 === i && (i = -1), + this._animationConfig.clear(), + this._animationConfig.resetToPose = !0, + this._animationConfig.playTimes = i, + this._animationConfig.fadeInTime = 0, + this._animationConfig.animation = t; + var n = t in this._animations ? this._animations[t] : null; + return null !== n && (this._animationConfig.position = n.duration * (e > 0 ? e : 0)), + this.playConfig(this._animationConfig) + } + , + i.prototype.gotoAndStopByTime = function(t, e) { + void 0 === e && (e = 0); + var i = this.gotoAndPlayByTime(t, e, 1); + return null !== i && i.stop(), + i + } + , + i.prototype.gotoAndStopByFrame = function(t, e) { + void 0 === e && (e = 0); + var i = this.gotoAndPlayByFrame(t, e, 1); + return null !== i && i.stop(), + i + } + , + i.prototype.gotoAndStopByProgress = function(t, e) { + void 0 === e && (e = 0); + var i = this.gotoAndPlayByProgress(t, e, 1); + return null !== i && i.stop(), + i + } + , + i.prototype.getState = function(t) { + for (var e = this._animationStates.length; e--; ) { + var i = this._animationStates[e]; + if (i.name === t) + return i + } + return null + } + , + i.prototype.hasAnimation = function(t) { + return t in this._animations + } + , + i.prototype.getStates = function() { + return this._animationStates + } + , + Object.defineProperty(i.prototype, "isPlaying", { + get: function() { + for (var t = 0, e = this._animationStates; t < e.length; t++) + if (e[t].isPlaying) + return !0; + return !1 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "isCompleted", { + get: function() { + for (var t = 0, e = this._animationStates; t < e.length; t++) + if (!e[t].isCompleted) + return !1; + return this._animationStates.length > 0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "lastAnimationName", { + get: function() { + return null !== this._lastAnimationState ? this._lastAnimationState.name : "" + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "animationNames", { + get: function() { + return this._animationNames + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "animations", { + get: function() { + return this._animations + }, + set: function(t) { + if (this._animations !== t) { + for (var e in this._animationNames.length = 0, + this._animations) + delete this._animations[e]; + for (var e in t) + this._animationNames.push(e), + this._animations[e] = t[e] + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "animationConfig", { + get: function() { + return this._animationConfig.clear(), + this._animationConfig + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "lastAnimationState", { + get: function() { + return this._lastAnimationState + }, + enumerable: !0, + configurable: !0 + }), + i.prototype.gotoAndPlay = function(t, e, i, n, r, s, a, o, l) { + void 0 === e && (e = -1), + void 0 === i && (i = -1), + void 0 === n && (n = -1), + void 0 === r && (r = 0), + void 0 === s && (s = null), + void 0 === a && (a = 3), + void 0 === o && (o = !0), + void 0 === l && (l = !0), + console.warn("Deprecated."), + this._animationConfig.clear(), + this._animationConfig.resetToPose = !0, + this._animationConfig.fadeOutMode = a, + this._animationConfig.playTimes = n, + this._animationConfig.layer = r, + this._animationConfig.fadeInTime = e, + this._animationConfig.animation = t, + this._animationConfig.group = null !== s ? s : ""; + var h = this._animations[t]; + return h && i > 0 && (this._animationConfig.timeScale = h.duration / i), + this.playConfig(this._animationConfig) + } + , + i.prototype.gotoAndStop = function(t, e) { + return void 0 === e && (e = 0), + console.warn("Deprecated."), + this.gotoAndStopByTime(t, e) + } + , + Object.defineProperty(i.prototype, "animationList", { + get: function() { + return console.warn("Deprecated."), + this._animationNames + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(i.prototype, "animationDataList", { + get: function() { + console.warn("Deprecated."); + for (var t = [], e = 0, i = this._animationNames.length; e < i; ++e) + t.push(this._animations[this._animationNames[e]]); + return t + }, + enumerable: !0, + configurable: !0 + }), + i + } + )(t.BaseObject); + t.Animation = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function r() { + var t = null !== e && e.apply(this, arguments) || this; + return t._blendState = new n, + t._boneMask = [], + t._boneTimelines = [], + t._surfaceTimelines = [], + t._slotTimelines = [], + t._constraintTimelines = [], + t._animationTimelines = [], + t._poseTimelines = [], + t._bonePoses = {}, + t._actionTimeline = null, + t._zOrderTimeline = null, + t._parent = null, + t + } + return s(r, e), + r.toString = function() { + return "[class dragonBones.AnimationState]" + } + , + r.prototype._onClear = function() { + for (var t = 0, e = this._boneTimelines; t < e.length; t++) + e[t].returnToPool(); + for (var i = 0, n = this._surfaceTimelines; i < n.length; i++) + n[i].returnToPool(); + for (var r = 0, s = this._slotTimelines; r < s.length; r++) + s[r].returnToPool(); + for (var a = 0, o = this._constraintTimelines; a < o.length; a++) + o[a].returnToPool(); + for (var l = 0, h = this._animationTimelines; l < h.length; l++) + h[l].returnToPool(); + for (var c in this._bonePoses) + this._bonePoses[c].returnToPool(), + delete this._bonePoses[c]; + null !== this._actionTimeline && this._actionTimeline.returnToPool(), + null !== this._zOrderTimeline && this._zOrderTimeline.returnToPool(), + this.actionEnabled = !1, + this.additiveBlending = !1, + this.displayControl = !1, + this.resetToPose = !1, + this.playTimes = 1, + this.layer = 0, + this.timeScale = 1, + this.weight = 1, + this.autoFadeOutTime = 0, + this.fadeTotalTime = 0, + this.name = "", + this.group = "", + this._timelineDirty = 2, + this._playheadState = 0, + this._fadeState = -1, + this._subFadeState = -1, + this._position = 0, + this._duration = 0, + this._fadeTime = 0, + this._time = 0, + this._fadeProgress = 0, + this._weightResult = 0, + this._blendState.clear(), + this._boneMask.length = 0, + this._boneTimelines.length = 0, + this._surfaceTimelines.length = 0, + this._slotTimelines.length = 0, + this._constraintTimelines.length = 0, + this._animationTimelines.length = 0, + this._poseTimelines.length = 0, + this._animationData = null, + this._armature = null, + this._actionTimeline = null, + this._zOrderTimeline = null, + this._parent = null + } + , + r.prototype._updateTimelines = function() { + for (var e = 0, i = this._armature._constraints; e < i.length; e++) { + var n = i[e]; + if (null !== (l = this._animationData.getConstraintTimelines(n.name))) + for (var r = 0, s = l; r < s.length; r++) + switch ((_ = s[r]).type) { + case 30: + (f = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = n, + f.init(this._armature, this, _), + this._constraintTimelines.push(f) + } + else + this.resetToPose && ((f = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = n, + f.init(this._armature, this, null), + this._constraintTimelines.push(f), + this._poseTimelines.push(f)) + } + for (var a = 0, o = this._armature.animation.getStates(); a < o.length; a++) { + var l, h = o[a]; + if (h._parent === this && null !== (l = this._animationData.getAnimationTimelines(h.name))) + for (var c = 0, u = l; c < u.length; c++) { + var _; + switch ((_ = u[c]).type) { + case 40: + var f; + (f = t.BaseObject.borrowObject(t.AnimationTimelineState)).animationState = h, + f.init(this._armature, this, _), + this._animationTimelines.push(f) + } + } + } + } + , + r.prototype._updateBoneAndSlotTimelines = function() { + for (var e = {}, n = 0, r = this._boneTimelines; n < r.length; n++) + (l = (v = r[n]).bone.name)in e || (e[l] = []), + e[l].push(v); + for (var s = 0, a = this._armature.getBones(); s < a.length; s++) { + var o = a[s] + , l = o.name; + if (this.containsBoneMask(l)) + if (l in e) + delete e[l]; + else if (0 === o._boneData.type) { + var h = this._animationData.getBoneTimelines(l) + , c = l in this._bonePoses ? this._bonePoses[l] : this._bonePoses[l] = t.BaseObject.borrowObject(i); + if (null !== h) + for (var u = 0, _ = h; u < _.length; u++) + switch ((I = _[u]).type) { + case 10: + (v = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = o, + v.bonePose = c, + v.init(this._armature, this, I), + this._boneTimelines.push(v); + break; + case 11: + (v = t.BaseObject.borrowObject(t.BoneTranslateTimelineState)).bone = o, + v.bonePose = c, + v.init(this._armature, this, I), + this._boneTimelines.push(v); + break; + case 12: + (v = t.BaseObject.borrowObject(t.BoneRotateTimelineState)).bone = o, + v.bonePose = c, + v.init(this._armature, this, I), + this._boneTimelines.push(v); + break; + case 13: + (v = t.BaseObject.borrowObject(t.BoneScaleTimelineState)).bone = o, + v.bonePose = c, + v.init(this._armature, this, I), + this._boneTimelines.push(v) + } + else + this.resetToPose && ((v = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = o, + v.bonePose = c, + v.init(this._armature, this, null), + this._boneTimelines.push(v), + this._poseTimelines.push(v)) + } else if (1 === o._boneData.type) + if (null !== (h = this._animationData.getSurfaceTimelines(l))) + for (var f = 0, d = h; f < d.length; f++) + switch ((I = d[f]).type) { + case 50: + (v = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = o, + v.init(this._armature, this, I), + this._surfaceTimelines.push(v) + } + else + this.resetToPose && ((v = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = o, + v.init(this._armature, this, null), + this._surfaceTimelines.push(v), + this._poseTimelines.push(v)) + } + for (var p in e) + for (var m = 0, y = e[p]; m < y.length; m++) { + var v = y[m]; + this._boneTimelines.splice(this._boneTimelines.indexOf(v), 1), + v.returnToPool() + } + for (var g = {}, A = [], x = 0, b = this._slotTimelines; x < b.length; x++) + (l = (v = b[x]).slot.name)in g || (g[l] = []), + g[l].push(v); + for (var C = 0, T = this._armature.getSlots(); C < T.length; C++) { + var S = T[C] + , w = S.parent.name; + if (this.containsBoneMask(w)) + if (l = S.name, + h = this._animationData.getSlotTimelines(l), + l in g) + delete g[l]; + else { + var E = !1 + , M = !1; + if (A.length = 0, + null !== h) + for (var D = 0, B = h; D < B.length; D++) { + var I; + switch ((I = B[D]).type) { + case 20: + (v = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = S, + v.init(this._armature, this, I), + this._slotTimelines.push(v), + E = !0; + break; + case 21: + (v = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = S, + v.init(this._armature, this, I), + this._slotTimelines.push(v), + M = !0; + break; + case 22: + (v = t.BaseObject.borrowObject(t.DeformTimelineState)).slot = S, + v.init(this._armature, this, I), + this._slotTimelines.push(v), + A.push(v.vertexOffset) + } + } + if (this.resetToPose && (E || ((v = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = S, + v.init(this._armature, this, null), + this._slotTimelines.push(v), + this._poseTimelines.push(v)), + M || ((v = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = S, + v.init(this._armature, this, null), + this._slotTimelines.push(v), + this._poseTimelines.push(v)), + null !== S.rawDisplayDatas)) + for (var P = 0, R = S.rawDisplayDatas; P < R.length; P++) { + var O = R[P]; + if (null !== O && 2 === O.type) { + var L = O.vertices.offset; + A.indexOf(L) < 0 && ((v = t.BaseObject.borrowObject(t.DeformTimelineState)).vertexOffset = L, + v.slot = S, + v.init(this._armature, this, null), + this._slotTimelines.push(v), + this._poseTimelines.push(v)) + } + } + } + } + for (var p in g) + for (var F = 0, V = g[p]; F < V.length; F++) + v = V[F], + this._slotTimelines.splice(this._slotTimelines.indexOf(v), 1), + v.returnToPool() + } + , + r.prototype._advanceFadeTime = function(e) { + var i, n = this._fadeState > 0; + if (this._subFadeState < 0) { + this._subFadeState = 0; + var r = n ? t.EventObject.FADE_OUT : t.EventObject.FADE_IN; + this._armature.eventDispatcher.hasDBEventListener(r) && ((i = t.BaseObject.borrowObject(t.EventObject)).type = r, + i.armature = this._armature, + i.animationState = this, + this._armature._dragonBones.bufferEvent(i)) + } + (e < 0 && (e = -e), + this._fadeTime += e, + this._fadeTime >= this.fadeTotalTime ? (this._subFadeState = 1, + this._fadeProgress = n ? 0 : 1) : this._fadeTime > 0 ? this._fadeProgress = n ? 1 - this._fadeTime / this.fadeTotalTime : this._fadeTime / this.fadeTotalTime : this._fadeProgress = n ? 1 : 0, + this._subFadeState > 0) && (n || (this._playheadState |= 1, + this._fadeState = 0), + r = n ? t.EventObject.FADE_OUT_COMPLETE : t.EventObject.FADE_IN_COMPLETE, + this._armature.eventDispatcher.hasDBEventListener(r) && ((i = t.BaseObject.borrowObject(t.EventObject)).type = r, + i.armature = this._armature, + i.animationState = this, + this._armature._dragonBones.bufferEvent(i))) + } + , + r.prototype.init = function(e, i, n) { + if (null === this._armature) { + if (this._armature = e, + this._animationData = i, + this.resetToPose = n.resetToPose, + this.additiveBlending = n.additiveBlending, + this.displayControl = n.displayControl, + this.actionEnabled = n.actionEnabled, + this.layer = n.layer, + this.playTimes = n.playTimes, + this.timeScale = n.timeScale, + this.fadeTotalTime = n.fadeInTime, + this.autoFadeOutTime = n.autoFadeOutTime, + this.weight = n.weight, + this.name = n.name.length > 0 ? n.name : n.animation, + this.group = n.group, + n.pauseFadeIn ? this._playheadState = 2 : this._playheadState = 3, + n.duration < 0 ? (this._position = 0, + this._duration = this._animationData.duration, + 0 !== n.position ? this.timeScale >= 0 ? this._time = n.position : this._time = n.position - this._duration : this._time = 0) : (this._position = n.position, + this._duration = n.duration, + this._time = 0), + this.timeScale < 0 && 0 === this._time && (this._time = -1e-6), + this.fadeTotalTime <= 0 && (this._fadeProgress = .999999), + n.boneMask.length > 0) { + this._boneMask.length = n.boneMask.length; + for (var r = 0, s = this._boneMask.length; r < s; ++r) + this._boneMask[r] = n.boneMask[r] + } + this._actionTimeline = t.BaseObject.borrowObject(t.ActionTimelineState), + this._actionTimeline.init(this._armature, this, this._animationData.actionTimeline), + this._actionTimeline.currentTime = this._time, + this._actionTimeline.currentTime < 0 && (this._actionTimeline.currentTime = this._duration - this._actionTimeline.currentTime), + null !== this._animationData.zOrderTimeline && (this._zOrderTimeline = t.BaseObject.borrowObject(t.ZOrderTimelineState), + this._zOrderTimeline.init(this._armature, this, this._animationData.zOrderTimeline)) + } + } + , + r.prototype.advanceTime = function(e, i) { + if (this._blendState.dirty = !1, + 0 === this._fadeState && 0 === this._subFadeState || this._advanceFadeTime(e), + 3 === this._playheadState && (1 !== this.timeScale && (e *= this.timeScale), + this._time += e), + 0 !== this._timelineDirty && (2 === this._timelineDirty && this._updateTimelines(), + this._timelineDirty = 0, + this._updateBoneAndSlotTimelines()), + 0 !== this.weight) { + var n = 0 === this._fadeState && i > 0 + , r = !0 + , s = !0 + , a = this._time; + if (this._weightResult = this.weight * this._fadeProgress, + null !== this._parent && (this._weightResult *= this._parent._weightResult / this._parent._fadeProgress), + this._actionTimeline.playState <= 0 && this._actionTimeline.update(a), + n) { + var o = 2 * i; + this._actionTimeline.currentTime = Math.floor(this._actionTimeline.currentTime * o) / o + } + if (null !== this._zOrderTimeline && this._zOrderTimeline.playState <= 0 && this._zOrderTimeline.update(a), + n) { + var l = Math.floor(this._actionTimeline.currentTime * i); + this._armature._cacheFrameIndex === l ? (r = !1, + s = !1) : (this._armature._cacheFrameIndex = l, + this._animationData.cachedFrames[l] ? s = !1 : this._animationData.cachedFrames[l] = !0) + } + if (r) { + if (s) + for (var h = 0, c = this._boneTimelines.length; h < c; ++h) + (p = this._boneTimelines[h]).playState <= 0 && p.update(a), + (h === c - 1 || p.bone !== this._boneTimelines[h + 1].bone) && 0 !== (u = p.bone._blendState.update(this._weightResult, this.layer)) && p.blend(u); + for (h = 0, + c = this._surfaceTimelines.length; h < c; ++h) { + var u = (p = this._surfaceTimelines[h]).surface._blendState.update(this._weightResult, this.layer); + p.playState <= 0 && p.update(a), + 0 !== u && p.blend(u) + } + if (this.displayControl) + for (h = 0, + c = this._slotTimelines.length; h < c; ++h) { + var _ = (p = this._slotTimelines[h]).slot.displayController; + null !== _ && _ !== this.name && _ !== this.group || p.playState <= 0 && p.update(a) + } + for (h = 0, + c = this._constraintTimelines.length; h < c; ++h) + (p = this._constraintTimelines[h]).playState <= 0 && p.update(a); + for (h = 0, + c = this._animationTimelines.length; h < c; ++h) + u = (p = this._animationTimelines[h]).animationState._blendState.update(this._weightResult, this.layer), + p.playState <= 0 && p.update(a), + 0 !== u && p.blend(u) + } + if (0 === this._fadeState) { + if (this._subFadeState > 0 && (this._subFadeState = 0, + this._poseTimelines.length > 0)) { + for (var f = 0, d = this._poseTimelines; f < d.length; f++) { + var p; + (p = d[f])instanceof t.BoneTimelineState ? this._boneTimelines.splice(this._boneTimelines.indexOf(p), 1) : p instanceof t.SurfaceTimelineState ? this._surfaceTimelines.splice(this._surfaceTimelines.indexOf(p), 1) : p instanceof t.SlotTimelineState ? this._slotTimelines.splice(this._slotTimelines.indexOf(p), 1) : p instanceof t.ConstraintTimelineState && this._constraintTimelines.splice(this._constraintTimelines.indexOf(p), 1), + p.returnToPool() + } + this._poseTimelines.length = 0 + } + this._actionTimeline.playState > 0 && this.autoFadeOutTime >= 0 && this.fadeOut(this.autoFadeOutTime) + } + } + } + , + r.prototype.play = function() { + this._playheadState = 3 + } + , + r.prototype.stop = function() { + this._playheadState &= 1 + } + , + r.prototype.fadeOut = function(t, e) { + if (void 0 === e && (e = !0), + t < 0 && (t = 0), + e && (this._playheadState &= 2), + this._fadeState > 0) { + if (t > this.fadeTotalTime - this._fadeTime) + return + } else { + this._fadeState = 1, + this._subFadeState = -1, + (t <= 0 || this._fadeProgress <= 0) && (this._fadeProgress = 1e-6); + for (var i = 0, n = this._boneTimelines; i < n.length; i++) + (_ = n[i]).fadeOut(); + for (var r = 0, s = this._surfaceTimelines; r < s.length; r++) + (_ = s[r]).fadeOut(); + for (var a = 0, o = this._slotTimelines; a < o.length; a++) + (_ = o[a]).fadeOut(); + for (var l = 0, h = this._constraintTimelines; l < h.length; l++) + (_ = h[l]).fadeOut(); + for (var c = 0, u = this._animationTimelines; c < u.length; c++) { + var _; + (_ = u[c]).animationState.fadeOut(t, e), + _.fadeOut() + } + } + this.displayControl = !1, + this.fadeTotalTime = this._fadeProgress > 1e-6 ? t / this._fadeProgress : 0, + this._fadeTime = this.fadeTotalTime * (1 - this._fadeProgress) + } + , + r.prototype.containsBoneMask = function(t) { + return 0 === this._boneMask.length || this._boneMask.indexOf(t) >= 0 + } + , + r.prototype.addBoneMask = function(t, e) { + void 0 === e && (e = !0); + var i = this._armature.getBone(t); + if (null !== i) { + if (this._boneMask.indexOf(t) < 0 && this._boneMask.push(t), + e) + for (var n = 0, r = this._armature.getBones(); n < r.length; n++) { + var s = r[n]; + this._boneMask.indexOf(s.name) < 0 && i.contains(s) && this._boneMask.push(s.name) + } + this._timelineDirty = 1 + } + } + , + r.prototype.removeBoneMask = function(t, e) { + void 0 === e && (e = !0); + var i = this._boneMask.indexOf(t); + if (i >= 0 && this._boneMask.splice(i, 1), + e) { + var n = this._armature.getBone(t); + if (null !== n) { + var r = this._armature.getBones(); + if (this._boneMask.length > 0) + for (var s = 0, a = r; s < a.length; s++) { + var o = a[s] + , l = this._boneMask.indexOf(o.name); + l >= 0 && n.contains(o) && this._boneMask.splice(l, 1) + } + else + for (var h = 0, c = r; h < c.length; h++) + (o = c[h]) !== n && (n.contains(o) || this._boneMask.push(o.name)) + } + } + this._timelineDirty = 1 + } + , + r.prototype.removeAllBoneMask = function() { + this._boneMask.length = 0, + this._timelineDirty = 1 + } + , + Object.defineProperty(r.prototype, "isFadeIn", { + get: function() { + return this._fadeState < 0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "isFadeOut", { + get: function() { + return this._fadeState > 0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "isFadeComplete", { + get: function() { + return 0 === this._fadeState + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "isPlaying", { + get: function() { + return 0 != (2 & this._playheadState) && this._actionTimeline.playState <= 0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "isCompleted", { + get: function() { + return this._actionTimeline.playState > 0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "currentPlayTimes", { + get: function() { + return this._actionTimeline.currentPlayTimes + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "totalTime", { + get: function() { + return this._duration + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "currentTime", { + get: function() { + return this._actionTimeline.currentTime + }, + set: function(t) { + var e = this._actionTimeline.currentPlayTimes - (this._actionTimeline.playState > 0 ? 1 : 0); + if ((t < 0 || this._duration < t) && (t = t % this._duration + e * this._duration) < 0 && (t += this._duration), + this.playTimes > 0 && e === this.playTimes - 1 && t === this._duration && (t = this._duration - 1e-6), + this._time !== t) { + this._time = t, + this._actionTimeline.setCurrentTime(this._time), + null !== this._zOrderTimeline && (this._zOrderTimeline.playState = -1); + for (var i = 0, n = this._boneTimelines; i < n.length; i++) + n[i].playState = -1; + for (var r = 0, s = this._slotTimelines; r < s.length; r++) + s[r].playState = -1 + } + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(r.prototype, "animationData", { + get: function() { + return this._animationData + }, + enumerable: !0, + configurable: !0 + }), + r + } + )(t.BaseObject); + t.AnimationState = e; + var i = (function(e) { + function i() { + var i = null !== e && e.apply(this, arguments) || this; + return i.current = new t.Transform, + i.delta = new t.Transform, + i.result = new t.Transform, + i + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.BonePose]" + } + , + i.prototype._onClear = function() { + this.current.identity(), + this.delta.identity(), + this.result.identity() + } + , + i + } + )(t.BaseObject); + t.BonePose = i; + var n = (function() { + function t() {} + return t.prototype.update = function(t, e) { + if (this.dirty) { + if (!(this.leftWeight > 0)) + return 0; + if (this.layer !== e) { + if (this.layerWeight >= this.leftWeight) + return this.leftWeight = 0, + 0; + this.layer = e, + this.leftWeight -= this.layerWeight, + this.layerWeight = 0 + } + return t *= this.leftWeight, + this.layerWeight += t, + this.blendWeight = t, + 2 + } + return this.dirty = !0, + this.layer = e, + this.layerWeight = t, + this.leftWeight = 1, + this.blendWeight = t, + 1 + } + , + t.prototype.clear = function() { + this.dirty = !1, + this.layer = 0, + this.leftWeight = 0, + this.layerWeight = 0, + this.blendWeight = 0 + } + , + t + } + )(); + t.BlendState = n + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.prototype._onClear = function() { + this.playState = -1, + this.currentPlayTimes = -1, + this.currentTime = -1, + this._tweenState = 0, + this._frameRate = 0, + this._frameValueOffset = 0, + this._frameCount = 0, + this._frameOffset = 0, + this._frameIndex = -1, + this._frameRateR = 0, + this._position = 0, + this._duration = 0, + this._timeScale = 1, + this._timeOffset = 0, + this._dragonBonesData = null, + this._animationData = null, + this._timelineData = null, + this._armature = null, + this._animationState = null, + this._actionTimeline = null, + this._frameArray = null, + this._frameIntArray = null, + this._frameFloatArray = null, + this._timelineArray = null, + this._frameIndices = null + } + , + e.prototype._setCurrentTime = function(t) { + var e = this.playState + , i = this.currentPlayTimes + , n = this.currentTime; + if (null !== this._actionTimeline && this._frameCount <= 1) + this.playState = this._actionTimeline.playState >= 0 ? 1 : -1, + this.currentPlayTimes = 1, + this.currentTime = this._actionTimeline.currentTime; + else if (null === this._actionTimeline || 1 !== this._timeScale || 0 !== this._timeOffset) { + var r = this._animationState.playTimes + , s = r * this._duration; + t *= this._timeScale, + 0 !== this._timeOffset && (t += this._timeOffset * this._animationData.duration), + r > 0 && (t >= s || t <= -s) ? (this.playState <= 0 && 3 === this._animationState._playheadState && (this.playState = 1), + this.currentPlayTimes = r, + this.currentTime = t < 0 ? 0 : this._duration + 1e-6) : (0 !== this.playState && 3 === this._animationState._playheadState && (this.playState = 0), + t < 0 ? (t = -t, + this.currentPlayTimes = Math.floor(t / this._duration), + this.currentTime = this._duration - t % this._duration) : (this.currentPlayTimes = Math.floor(t / this._duration), + this.currentTime = t % this._duration)), + this.currentTime += this._position + } else + this.playState = this._actionTimeline.playState, + this.currentPlayTimes = this._actionTimeline.currentPlayTimes, + this.currentTime = this._actionTimeline.currentTime; + return (this.currentPlayTimes !== i || this.currentTime !== n) && ((e < 0 && this.playState !== e || this.playState <= 0 && this.currentPlayTimes !== i) && (this._frameIndex = -1), + !0) + } + , + e.prototype.init = function(t, e, i) { + this._armature = t, + this._animationState = e, + this._timelineData = i, + this._actionTimeline = this._animationState._actionTimeline, + this === this._actionTimeline && (this._actionTimeline = null), + this._animationData = this._animationState._animationData, + this._frameRate = this._animationData.parent.frameRate, + this._frameRateR = 1 / this._frameRate, + this._position = this._animationState._position, + this._duration = this._animationState._duration, + this._dragonBonesData = this._animationData.parent.parent, + null !== this._timelineData && (this._frameIntArray = this._dragonBonesData.frameIntArray, + this._frameFloatArray = this._dragonBonesData.frameFloatArray, + this._frameArray = this._dragonBonesData.frameArray, + this._timelineArray = this._dragonBonesData.timelineArray, + this._frameIndices = this._dragonBonesData.frameIndices, + this._frameCount = this._timelineArray[this._timelineData.offset + 2], + this._frameValueOffset = this._timelineArray[this._timelineData.offset + 4], + this._timeScale = 100 / this._timelineArray[this._timelineData.offset + 0], + this._timeOffset = .01 * this._timelineArray[this._timelineData.offset + 1]) + } + , + e.prototype.fadeOut = function() {} + , + e.prototype.update = function(t) { + if (this._setCurrentTime(t)) { + if (this._frameCount > 1) { + var e = Math.floor(this.currentTime * this._frameRate) + , i = this._frameIndices[this._timelineData.frameIndicesOffset + e]; + this._frameIndex !== i && (this._frameIndex = i, + this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex], + this._onArriveAtFrame()) + } else + this._frameIndex < 0 && (this._frameIndex = 0, + null !== this._timelineData && (this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5]), + this._onArriveAtFrame()); + 0 !== this._tweenState && this._onUpdateFrame() + } + } + , + e + } + )(t.BaseObject); + t.TimelineState = e; + var i = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e._getEasingValue = function(t, e, i) { + var n = e; + switch (t) { + case 3: + n = Math.pow(e, 2); + break; + case 4: + n = 1 - Math.pow(1 - e, 2); + break; + case 5: + n = .5 * (1 - Math.cos(e * Math.PI)) + } + return (n - e) * i + e + } + , + e._getEasingCurveValue = function(t, e, i, n) { + if (t <= 0) + return 0; + if (t >= 1) + return 1; + var r = i + 1 + , s = Math.floor(t * r) + , a = 0 === s ? 0 : e[n + s - 1]; + return 1e-4 * (a + ((s === r - 1 ? 1e4 : e[n + s]) - a) * (t * r - s)) + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this._tweenType = 0, + this._curveCount = 0, + this._framePosition = 0, + this._frameDurationR = 0, + this._tweenProgress = 0, + this._tweenEasing = 0 + } + , + e.prototype._onArriveAtFrame = function() { + if (this._frameCount > 1 && (this._frameIndex !== this._frameCount - 1 || 0 === this._animationState.playTimes || this._animationState.currentPlayTimes < this._animationState.playTimes - 1)) + if (this._tweenType = this._frameArray[this._frameOffset + 1], + this._tweenState = 0 === this._tweenType ? 1 : 2, + 2 === this._tweenType ? this._curveCount = this._frameArray[this._frameOffset + 2] : 0 !== this._tweenType && 1 !== this._tweenType && (this._tweenEasing = .01 * this._frameArray[this._frameOffset + 2]), + this._framePosition = this._frameArray[this._frameOffset] * this._frameRateR, + this._frameIndex === this._frameCount - 1) + this._frameDurationR = 1 / (this._animationData.duration - this._framePosition); + else { + var t = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex + 1] + , e = this._frameArray[t] * this._frameRateR - this._framePosition; + this._frameDurationR = e > 0 ? 1 / e : 0 + } + else + this._tweenState = 1 + } + , + e.prototype._onUpdateFrame = function() { + 2 === this._tweenState ? (this._tweenProgress = (this.currentTime - this._framePosition) * this._frameDurationR, + 2 === this._tweenType ? this._tweenProgress = e._getEasingCurveValue(this._tweenProgress, this._frameArray, this._curveCount, this._frameOffset + 3) : 1 !== this._tweenType && (this._tweenProgress = e._getEasingValue(this._tweenType, this._tweenProgress, this._tweenEasing))) : this._tweenProgress = 0 + } + , + e + } + )(e); + t.TweenTimelineState = i; + var n = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.bone = null, + this.bonePose = null + } + , + e.prototype.blend = function(t) { + var e = this.bone._blendState.blendWeight + , i = this.bone.animationPose + , n = this.bonePose.result; + 2 === t ? (i.x += n.x * e, + i.y += n.y * e, + i.rotation += n.rotation * e, + i.skew += n.skew * e, + i.scaleX += (n.scaleX - 1) * e, + i.scaleY += (n.scaleY - 1) * e) : 1 !== e ? (i.x = n.x * e, + i.y = n.y * e, + i.rotation = n.rotation * e, + i.skew = n.skew * e, + i.scaleX = (n.scaleX - 1) * e + 1, + i.scaleY = (n.scaleY - 1) * e + 1) : (i.x = n.x, + i.y = n.y, + i.rotation = n.rotation, + i.skew = n.skew, + i.scaleX = n.scaleX, + i.scaleY = n.scaleY), + 0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.bone._transformDirty = !0) + } + , + e + } + )(i); + t.BoneTimelineState = n; + var r = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.slot = null + } + , + e + } + )(i); + t.SlotTimelineState = r; + var a = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.constraint = null + } + , + e + } + )(i); + t.ConstraintTimelineState = a + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i() { + return null !== e && e.apply(this, arguments) || this + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.ActionTimelineState]" + } + , + i.prototype._onCrossFrame = function(e) { + var i = this._armature.eventDispatcher; + if (this._animationState.actionEnabled) + for (var n = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + e], r = this._frameArray[n + 1], s = this._animationData.parent.actions, a = 0; a < r; ++a) { + var o = s[this._frameArray[n + 2 + a]]; + if (0 === o.type) + (l = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[n] / this._frameRate, + l.animationState = this._animationState, + t.EventObject.actionDataToInstance(o, l, this._armature), + this._armature._bufferAction(l, !0); + else { + var l, h = 10 === o.type ? t.EventObject.FRAME_EVENT : t.EventObject.SOUND_EVENT; + (11 === o.type || i.hasDBEventListener(h)) && ((l = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[n] / this._frameRate, + l.animationState = this._animationState, + t.EventObject.actionDataToInstance(o, l, this._armature), + this._armature._dragonBones.bufferEvent(l)) + } + } + } + , + i.prototype._onArriveAtFrame = function() {} + , + i.prototype._onUpdateFrame = function() {} + , + i.prototype.update = function(e) { + var i = this.playState + , n = this.currentPlayTimes + , r = this.currentTime; + if (this._setCurrentTime(e)) { + var s = this._armature.eventDispatcher; + if (i < 0) { + if (this.playState === i) + return; + if (this._animationState.displayControl && this._animationState.resetToPose && this._armature._sortZOrder(null, 0), + n = this.currentPlayTimes, + s.hasDBEventListener(t.EventObject.START)) { + var a = t.BaseObject.borrowObject(t.EventObject); + a.type = t.EventObject.START, + a.armature = this._armature, + a.animationState = this._animationState, + this._armature._dragonBones.bufferEvent(a) + } + } + var o = this._animationState.timeScale < 0 + , l = null + , h = null; + if (this.currentPlayTimes !== n && (s.hasDBEventListener(t.EventObject.LOOP_COMPLETE) && ((l = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.LOOP_COMPLETE, + l.armature = this._armature, + l.animationState = this._animationState), + this.playState > 0 && s.hasDBEventListener(t.EventObject.COMPLETE) && ((h = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.COMPLETE, + h.armature = this._armature, + h.animationState = this._animationState)), + this._frameCount > 1) { + var c = this._timelineData + , u = Math.floor(this.currentTime * this._frameRate) + , _ = this._frameIndices[c.frameIndicesOffset + u]; + if (this._frameIndex !== _) { + var f = this._frameIndex; + if (this._frameIndex = _, + null !== this._timelineArray) + if (this._frameOffset = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + this._frameIndex], + o) { + if (f < 0) { + var d = Math.floor(r * this._frameRate); + f = this._frameIndices[c.frameIndicesOffset + d], + this.currentPlayTimes === n && f === _ && (f = -1) + } + for (; f >= 0; ) { + var p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f] + , m = this._frameArray[p] / this._frameRate; + if (this._position <= m && m <= this._position + this._duration && this._onCrossFrame(f), + null !== l && 0 === f && (this._armature._dragonBones.bufferEvent(l), + l = null), + f > 0 ? f-- : f = this._frameCount - 1, + f === _) + break + } + } else + for (f < 0 && (d = Math.floor(r * this._frameRate), + f = this._frameIndices[c.frameIndicesOffset + d], + p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f], + m = this._frameArray[p] / this._frameRate, + this.currentPlayTimes === n && (r <= m ? f > 0 ? f-- : f = this._frameCount - 1 : f === _ && (f = -1))); f >= 0 && (f < this._frameCount - 1 ? f++ : f = 0, + p = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + f], + m = this._frameArray[p] / this._frameRate, + this._position <= m && m <= this._position + this._duration && this._onCrossFrame(f), + null !== l && 0 === f && (this._armature._dragonBones.bufferEvent(l), + l = null), + f !== _); ) + ; + } + } else + this._frameIndex < 0 && (this._frameIndex = 0, + null !== this._timelineData) && (this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5], + m = this._frameArray[this._frameOffset] / this._frameRate, + this.currentPlayTimes === n ? r <= m && this._onCrossFrame(this._frameIndex) : this._position <= m && (o || null === l || (this._armature._dragonBones.bufferEvent(l), + l = null), + this._onCrossFrame(this._frameIndex))); + null !== l && this._armature._dragonBones.bufferEvent(l), + null !== h && this._armature._dragonBones.bufferEvent(h) + } + } + , + i.prototype.setCurrentTime = function(t) { + this._setCurrentTime(t), + this._frameIndex = -1 + } + , + i + } + )(t.TimelineState); + t.ActionTimelineState = e; + var i = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.ZOrderTimelineState]" + } + , + e.prototype._onArriveAtFrame = function() { + this.playState >= 0 && (this._frameArray[this._frameOffset + 1] > 0 ? this._armature._sortZOrder(this._frameArray, this._frameOffset + 2) : this._armature._sortZOrder(null, 0)) + } + , + e.prototype._onUpdateFrame = function() {} + , + e + } + )(t.TimelineState); + t.ZOrderTimelineState = i; + var n = (function(e) { + function i() { + return null !== e && e.apply(this, arguments) || this + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.BoneAllTimelineState]" + } + , + i.prototype._onArriveAtFrame = function() { + if (e.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var t = this._animationData.frameFloatOffset + this._frameValueOffset + 6 * this._frameIndex + , i = this._armature._armatureData.scale + , n = this._frameFloatArray + , r = this.bonePose.current + , s = this.bonePose.delta; + r.x = n[t++] * i, + r.y = n[t++] * i, + r.rotation = n[t++], + r.skew = n[t++], + r.scaleX = n[t++], + r.scaleY = n[t++], + 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (t = this._animationData.frameFloatOffset + this._frameValueOffset), + s.x = n[t++] * i - r.x, + s.y = n[t++] * i - r.y, + s.rotation = n[t++] - r.rotation, + s.skew = n[t++] - r.skew, + s.scaleX = n[t++] - r.scaleX, + s.scaleY = n[t++] - r.scaleY) : (s.x = 0, + s.y = 0, + s.rotation = 0, + s.skew = 0, + s.scaleX = 0, + s.scaleY = 0) + } else + r = this.bonePose.current, + s = this.bonePose.delta, + r.x = 0, + r.y = 0, + r.rotation = 0, + r.skew = 0, + r.scaleX = 1, + r.scaleY = 1, + s.x = 0, + s.y = 0, + s.rotation = 0, + s.skew = 0, + s.scaleX = 0, + s.scaleY = 0 + } + , + i.prototype._onUpdateFrame = function() { + e.prototype._onUpdateFrame.call(this); + var t = this.bonePose.current + , i = this.bonePose.delta + , n = this.bonePose.result; + this.bone._transformDirty = !0, + 2 !== this._tweenState && (this._tweenState = 0), + n.x = t.x + i.x * this._tweenProgress, + n.y = t.y + i.y * this._tweenProgress, + n.rotation = t.rotation + i.rotation * this._tweenProgress, + n.skew = t.skew + i.skew * this._tweenProgress, + n.scaleX = t.scaleX + i.scaleX * this._tweenProgress, + n.scaleY = t.scaleY + i.scaleY * this._tweenProgress + } + , + i.prototype.fadeOut = function() { + var e = this.bonePose.result; + e.rotation = t.Transform.normalizeRadian(e.rotation), + e.skew = t.Transform.normalizeRadian(e.skew) + } + , + i + } + )(t.BoneTimelineState); + t.BoneAllTimelineState = n; + var r = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.BoneTranslateTimelineState]" + } + , + e.prototype._onArriveAtFrame = function() { + if (t.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex + , i = this._armature._armatureData.scale + , n = this._frameFloatArray + , r = this.bonePose.current + , s = this.bonePose.delta; + r.x = n[e++] * i, + r.y = n[e++] * i, + 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset), + s.x = n[e++] * i - r.x, + s.y = n[e++] * i - r.y) : (s.x = 0, + s.y = 0) + } else + r = this.bonePose.current, + s = this.bonePose.delta, + r.x = 0, + r.y = 0, + s.x = 0, + s.y = 0 + } + , + e.prototype._onUpdateFrame = function() { + t.prototype._onUpdateFrame.call(this); + var e = this.bonePose.current + , i = this.bonePose.delta + , n = this.bonePose.result; + this.bone._transformDirty = !0, + 2 !== this._tweenState && (this._tweenState = 0), + n.x = e.x + i.x * this._tweenProgress, + n.y = e.y + i.y * this._tweenProgress + } + , + e + } + )(t.BoneTimelineState); + t.BoneTranslateTimelineState = r; + var a = (function(e) { + function i() { + return null !== e && e.apply(this, arguments) || this + } + return s(i, e), + i.toString = function() { + return "[class dragonBones.BoneRotateTimelineState]" + } + , + i.prototype._onArriveAtFrame = function() { + if (e.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var i = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex + , n = this._frameFloatArray + , r = this.bonePose.current + , s = this.bonePose.delta; + r.rotation = n[i++], + r.skew = n[i++], + 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 ? (i = this._animationData.frameFloatOffset + this._frameValueOffset, + s.rotation = t.Transform.normalizeRadian(n[i++] - r.rotation)) : s.rotation = n[i++] - r.rotation, + s.skew = n[i++] - r.skew) : (s.rotation = 0, + s.skew = 0) + } else + r = this.bonePose.current, + s = this.bonePose.delta, + r.rotation = 0, + r.skew = 0, + s.rotation = 0, + s.skew = 0 + } + , + i.prototype._onUpdateFrame = function() { + e.prototype._onUpdateFrame.call(this); + var t = this.bonePose.current + , i = this.bonePose.delta + , n = this.bonePose.result; + this.bone._transformDirty = !0, + 2 !== this._tweenState && (this._tweenState = 0), + n.rotation = t.rotation + i.rotation * this._tweenProgress, + n.skew = t.skew + i.skew * this._tweenProgress + } + , + i.prototype.fadeOut = function() { + var e = this.bonePose.result; + e.rotation = t.Transform.normalizeRadian(e.rotation), + e.skew = t.Transform.normalizeRadian(e.skew) + } + , + i + } + )(t.BoneTimelineState); + t.BoneRotateTimelineState = a; + var o = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.BoneScaleTimelineState]" + } + , + e.prototype._onArriveAtFrame = function() { + if (t.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex + , i = this._frameFloatArray + , n = this.bonePose.current + , r = this.bonePose.delta; + n.scaleX = i[e++], + n.scaleY = i[e++], + 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset), + r.scaleX = i[e++] - n.scaleX, + r.scaleY = i[e++] - n.scaleY) : (r.scaleX = 0, + r.scaleY = 0) + } else + n = this.bonePose.current, + r = this.bonePose.delta, + n.scaleX = 1, + n.scaleY = 1, + r.scaleX = 0, + r.scaleY = 0 + } + , + e.prototype._onUpdateFrame = function() { + t.prototype._onUpdateFrame.call(this); + var e = this.bonePose.current + , i = this.bonePose.delta + , n = this.bonePose.result; + this.bone._transformDirty = !0, + 2 !== this._tweenState && (this._tweenState = 0), + n.scaleX = e.scaleX + i.scaleX * this._tweenProgress, + n.scaleY = e.scaleY + i.scaleY * this._tweenProgress + } + , + e + } + )(t.BoneTimelineState); + t.BoneScaleTimelineState = o; + var l = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e._current = [], + e._delta = [], + e._result = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.SurfaceTimelineState]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.surface = null, + this._frameFloatOffset = 0, + this._valueCount = 0, + this._deformCount = 0, + this._valueOffset = 0, + this._current.length = 0, + this._delta.length = 0, + this._result.length = 0 + } + , + e.prototype._onArriveAtFrame = function() { + if (t.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount + , i = this._armature._armatureData.scale + , n = this._frameFloatArray; + if (2 === this._tweenState) { + var r = e + this._valueCount; + this._frameIndex === this._frameCount - 1 && (r = this._animationData.frameFloatOffset + this._frameValueOffset); + for (var s = 0; s < this._valueCount; ++s) + this._delta[s] = n[r + s] * i - (this._current[s] = n[e + s] * i) + } else + for (s = 0; s < this._valueCount; ++s) + this._current[s] = n[e + s] * i + } else + for (s = 0; s < this._valueCount; ++s) + this._current[s] = 0 + } + , + e.prototype._onUpdateFrame = function() { + t.prototype._onUpdateFrame.call(this), + this.surface._transformDirty = !0, + 2 !== this._tweenState && (this._tweenState = 0); + for (var e = 0; e < this._valueCount; ++e) + this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress + } + , + e.prototype.init = function(e, i, n) { + if (t.prototype.init.call(this, e, i, n), + null !== this._timelineData) { + var r = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3]; + this._deformCount = this._frameIntArray[r + 1], + this._valueCount = this._frameIntArray[r + 2], + this._valueOffset = this._frameIntArray[r + 3], + this._frameFloatOffset = this._frameIntArray[r + 4] + this._animationData.frameFloatOffset + } else + this._deformCount = this.surface._deformVertices.length, + this._valueCount = this._deformCount, + this._valueOffset = 0, + this._frameFloatOffset = 0; + this._current.length = this._valueCount, + this._delta.length = this._valueCount, + this._result.length = this._valueCount; + for (var s = 0; s < this._valueCount; ++s) + this._delta[s] = 0 + } + , + e.prototype.blend = function(t) { + for (var e = this.surface._blendState.blendWeight, i = this.surface._deformVertices, n = 0; n < this._deformCount; ++n) { + var r; + r = n < this._valueOffset ? this._frameFloatArray[this._frameFloatOffset + n] : n < this._valueOffset + this._valueCount ? this._result[n - this._valueOffset] : this._frameFloatArray[this._frameFloatOffset + n - this._valueCount], + 2 === t ? i[n] += r * e : i[n] = 1 !== e ? r * e : r + } + 0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.surface._transformDirty = !0) + } + , + e + } + )(t.TweenTimelineState); + t.SurfaceTimelineState = l; + var h = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.SlotDislayTimelineState]" + } + , + e.prototype._onArriveAtFrame = function() { + if (this.playState >= 0) { + var t = null !== this._timelineData ? this._frameArray[this._frameOffset + 1] : this.slot._slotData.displayIndex; + this.slot.displayIndex !== t && this.slot._setDisplayIndex(t, !0) + } + } + , + e + } + )(t.SlotTimelineState); + t.SlotDislayTimelineState = h; + var c = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e._current = [0, 0, 0, 0, 0, 0, 0, 0], + e._delta = [0, 0, 0, 0, 0, 0, 0, 0], + e._result = [0, 0, 0, 0, 0, 0, 0, 0], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.SlotColorTimelineState]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this._dirty = !1 + } + , + e.prototype._onArriveAtFrame = function() { + if (t.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var e = this._dragonBonesData.intArray + , i = this._frameIntArray + , n = this._animationData.frameIntOffset + this._frameValueOffset + 1 * this._frameIndex + , r = i[n]; + r < 0 && (r += 65536), + this._current[0] = e[r++], + this._current[1] = e[r++], + this._current[2] = e[r++], + this._current[3] = e[r++], + this._current[4] = e[r++], + this._current[5] = e[r++], + this._current[6] = e[r++], + this._current[7] = e[r++], + 2 === this._tweenState && ((r = this._frameIndex === this._frameCount - 1 ? i[this._animationData.frameIntOffset + this._frameValueOffset] : i[n + 1]) < 0 && (r += 65536), + this._delta[0] = e[r++] - this._current[0], + this._delta[1] = e[r++] - this._current[1], + this._delta[2] = e[r++] - this._current[2], + this._delta[3] = e[r++] - this._current[3], + this._delta[4] = e[r++] - this._current[4], + this._delta[5] = e[r++] - this._current[5], + this._delta[6] = e[r++] - this._current[6], + this._delta[7] = e[r++] - this._current[7]) + } else { + var s = this.slot._slotData.color; + this._current[0] = 100 * s.alphaMultiplier, + this._current[1] = 100 * s.redMultiplier, + this._current[2] = 100 * s.greenMultiplier, + this._current[3] = 100 * s.blueMultiplier, + this._current[4] = s.alphaOffset, + this._current[5] = s.redOffset, + this._current[6] = s.greenOffset, + this._current[7] = s.blueOffset + } + } + , + e.prototype._onUpdateFrame = function() { + t.prototype._onUpdateFrame.call(this), + this._dirty = !0, + 2 !== this._tweenState && (this._tweenState = 0), + this._result[0] = .01 * (this._current[0] + this._delta[0] * this._tweenProgress), + this._result[1] = .01 * (this._current[1] + this._delta[1] * this._tweenProgress), + this._result[2] = .01 * (this._current[2] + this._delta[2] * this._tweenProgress), + this._result[3] = .01 * (this._current[3] + this._delta[3] * this._tweenProgress), + this._result[4] = this._current[4] + this._delta[4] * this._tweenProgress, + this._result[5] = this._current[5] + this._delta[5] * this._tweenProgress, + this._result[6] = this._current[6] + this._delta[6] * this._tweenProgress, + this._result[7] = this._current[7] + this._delta[7] * this._tweenProgress + } + , + e.prototype.fadeOut = function() { + this._tweenState = 0, + this._dirty = !1 + } + , + e.prototype.update = function(e) { + if (t.prototype.update.call(this, e), + 0 !== this._tweenState || this._dirty) { + var i = this.slot._colorTransform; + if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) { + if (i.alphaMultiplier !== this._result[0] || i.redMultiplier !== this._result[1] || i.greenMultiplier !== this._result[2] || i.blueMultiplier !== this._result[3] || i.alphaOffset !== this._result[4] || i.redOffset !== this._result[5] || i.greenOffset !== this._result[6] || i.blueOffset !== this._result[7]) { + var n = Math.pow(this._animationState._fadeProgress, 4); + i.alphaMultiplier += (this._result[0] - i.alphaMultiplier) * n, + i.redMultiplier += (this._result[1] - i.redMultiplier) * n, + i.greenMultiplier += (this._result[2] - i.greenMultiplier) * n, + i.blueMultiplier += (this._result[3] - i.blueMultiplier) * n, + i.alphaOffset += (this._result[4] - i.alphaOffset) * n, + i.redOffset += (this._result[5] - i.redOffset) * n, + i.greenOffset += (this._result[6] - i.greenOffset) * n, + i.blueOffset += (this._result[7] - i.blueOffset) * n, + this.slot._colorDirty = !0 + } + } else + this._dirty && (this._dirty = !1, + i.alphaMultiplier === this._result[0] && i.redMultiplier === this._result[1] && i.greenMultiplier === this._result[2] && i.blueMultiplier === this._result[3] && i.alphaOffset === this._result[4] && i.redOffset === this._result[5] && i.greenOffset === this._result[6] && i.blueOffset === this._result[7] || (i.alphaMultiplier = this._result[0], + i.redMultiplier = this._result[1], + i.greenMultiplier = this._result[2], + i.blueMultiplier = this._result[3], + i.alphaOffset = this._result[4], + i.redOffset = this._result[5], + i.greenOffset = this._result[6], + i.blueOffset = this._result[7], + this.slot._colorDirty = !0)) + } + } + , + e + } + )(t.SlotTimelineState); + t.SlotColorTimelineState = c; + var u = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e._current = [], + e._delta = [], + e._result = [], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.DeformTimelineState]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.vertexOffset = 0, + this._dirty = !1, + this._frameFloatOffset = 0, + this._valueCount = 0, + this._deformCount = 0, + this._valueOffset = 0, + this._current.length = 0, + this._delta.length = 0, + this._result.length = 0 + } + , + e.prototype._onArriveAtFrame = function() { + if (t.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount + , i = this._armature._armatureData.scale + , n = this._frameFloatArray; + if (2 === this._tweenState) { + var r = e + this._valueCount; + this._frameIndex === this._frameCount - 1 && (r = this._animationData.frameFloatOffset + this._frameValueOffset); + for (var s = 0; s < this._valueCount; ++s) + this._delta[s] = n[r + s] * i - (this._current[s] = n[e + s] * i) + } else + for (s = 0; s < this._valueCount; ++s) + this._current[s] = n[e + s] * i + } else + for (s = 0; s < this._valueCount; ++s) + this._current[s] = 0 + } + , + e.prototype._onUpdateFrame = function() { + t.prototype._onUpdateFrame.call(this), + this._dirty = !0, + 2 !== this._tweenState && (this._tweenState = 0); + for (var e = 0; e < this._valueCount; ++e) + this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress + } + , + e.prototype.init = function(e, i, n) { + if (t.prototype.init.call(this, e, i, n), + null !== this._timelineData) { + var r = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3]; + this.vertexOffset = this._frameIntArray[r + 0], + this.vertexOffset < 0 && (this.vertexOffset += 65536), + this._deformCount = this._frameIntArray[r + 1], + this._valueCount = this._frameIntArray[r + 2], + this._valueOffset = this._frameIntArray[r + 3], + this._frameFloatOffset = this._frameIntArray[r + 4] + this._animationData.frameFloatOffset + } else { + var s = this.slot._deformVertices; + this._deformCount = null !== s ? s.vertices.length : 0, + this._valueCount = this._deformCount, + this._valueOffset = 0, + this._frameFloatOffset = 0 + } + this._current.length = this._valueCount, + this._delta.length = this._valueCount, + this._result.length = this._valueCount; + for (var a = 0; a < this._valueCount; ++a) + this._delta[a] = 0 + } + , + e.prototype.fadeOut = function() { + this._tweenState = 0, + this._dirty = !1 + } + , + e.prototype.update = function(e) { + var i = this.slot._deformVertices; + if (null !== i && null !== i.verticesData && i.verticesData.offset === this.vertexOffset && (t.prototype.update.call(this, e), + 0 !== this._tweenState || this._dirty)) { + var n = i.vertices; + if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) { + for (var r = Math.pow(this._animationState._fadeProgress, 2), s = 0; s < this._deformCount; ++s) + s < this._valueOffset ? n[s] += (this._frameFloatArray[this._frameFloatOffset + s] - n[s]) * r : s < this._valueOffset + this._valueCount ? n[s] += (this._result[s - this._valueOffset] - n[s]) * r : n[s] += (this._frameFloatArray[this._frameFloatOffset + s - this._valueCount] - n[s]) * r; + i.verticesDirty = !0 + } else if (this._dirty) { + for (this._dirty = !1, + s = 0; s < this._deformCount; ++s) + s < this._valueOffset ? n[s] = this._frameFloatArray[this._frameFloatOffset + s] : s < this._valueOffset + this._valueCount ? n[s] = this._result[s - this._valueOffset] : n[s] = this._frameFloatArray[this._frameFloatOffset + s - this._valueCount]; + i.verticesDirty = !0 + } + } + } + , + e + } + )(t.SlotTimelineState); + t.DeformTimelineState = u; + var _ = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.IKConstraintTimelineState]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this._current = 0, + this._delta = 0 + } + , + e.prototype._onArriveAtFrame = function() { + t.prototype._onArriveAtFrame.call(this); + var e = this.constraint; + if (null !== this._timelineData) { + var i = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex + , n = this._frameIntArray + , r = 0 !== n[i++]; + this._current = .01 * n[i++], + 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (i = this._animationData.frameIntOffset + this._frameValueOffset), + this._delta = .01 * n[i + 1] - this._current) : this._delta = 0, + e._bendPositive = r + } else { + var s = e._constraintData; + this._current = s.weight, + this._delta = 0, + e._bendPositive = s.bendPositive + } + e.invalidUpdate() + } + , + e.prototype._onUpdateFrame = function() { + t.prototype._onUpdateFrame.call(this), + 2 !== this._tweenState && (this._tweenState = 0); + var e = this.constraint; + e._weight = this._current + this._delta * this._tweenProgress, + e.invalidUpdate() + } + , + e + } + )(t.ConstraintTimelineState); + t.IKConstraintTimelineState = _; + var f = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e._floats = [0, 0, 0, 0, 0, 0], + e + } + return s(e, t), + e.toString = function() { + return "[class dragonBones.AnimationTimelineState]" + } + , + e.prototype._onClear = function() { + t.prototype._onClear.call(this), + this.animationState = null + } + , + e.prototype._onArriveAtFrame = function() { + if (t.prototype._onArriveAtFrame.call(this), + null !== this._timelineData) { + var e = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex + , i = 1 / this.animationState._animationData.parent.frameRate + , n = this._frameIntArray; + this._floats[0] = n[e++] * i, + this._floats[3] = .01 * n[e++], + 2 === this._tweenState ? (this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameIntOffset + this._frameValueOffset), + this._floats[1] = n[e++] * i - this._floats[0], + this._floats[4] = .01 * n[e++] - this._floats[3]) : (this._floats[1] = 0, + this._floats[4] = 0) + } + } + , + e.prototype._onUpdateFrame = function() { + t.prototype._onUpdateFrame.call(this), + 2 !== this._tweenState && (this._tweenState = 0), + this._floats[0] >= 0 && (this._floats[2] = this._floats[0] + this._floats[1] * this._tweenProgress), + this._floats[5] = this._floats[3] + this._floats[4] * this._tweenProgress + } + , + e.prototype.blend = function(t) { + var e = this.animationState + , i = e._blendState.blendWeight; + 2 === t ? (e.weight += this._floats[5] * i, + e.currentTime += this._floats[2] * i) : (e.weight = this._floats[5] * i, + e.currentTime = this._floats[2] * i) + } + , + e + } + )(t.TweenTimelineState); + t.AnimationTimelineState = f + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.actionDataToInstance = function(t, i, n) { + 0 === t.type ? i.type = e.FRAME_EVENT : i.type = 10 === t.type ? e.FRAME_EVENT : e.SOUND_EVENT, + i.name = t.name, + i.armature = n, + i.actionData = t, + i.data = t.data, + null !== t.bone && (i.bone = n.getBone(t.bone.name)), + null !== t.slot && (i.slot = n.getSlot(t.slot.name)) + } + , + e.toString = function() { + return "[class dragonBones.EventObject]" + } + , + e.prototype._onClear = function() { + this.time = 0, + this.type = "", + this.name = "", + this.armature = null, + this.bone = null, + this.slot = null, + this.animationState = null, + this.actionData = null, + this.data = null + } + , + e.START = "start", + e.LOOP_COMPLETE = "loopComplete", + e.COMPLETE = "complete", + e.FADE_IN = "fadeIn", + e.FADE_IN_COMPLETE = "fadeInComplete", + e.FADE_OUT = "fadeOut", + e.FADE_OUT_COMPLETE = "fadeOutComplete", + e.FRAME_EVENT = "frameEvent", + e.SOUND_EVENT = "soundEvent", + e + } + )(t.BaseObject); + t.EventObject = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e() {} + return e._getArmatureType = function(t) { + switch (t.toLowerCase()) { + case "stage": + return 2; + case "armature": + return 0; + case "movieclip": + return 1; + default: + return 0 + } + } + , + e._getBoneType = function(t) { + switch (t.toLowerCase()) { + case "bone": + return 0; + case "surface": + return 1; + default: + return 0 + } + } + , + e._getDisplayType = function(t) { + switch (t.toLowerCase()) { + case "image": + return 0; + case "mesh": + return 2; + case "armature": + return 1; + case "boundingbox": + return 3; + case "path": + return 4; + default: + return 0 + } + } + , + e._getBoundingBoxType = function(t) { + switch (t.toLowerCase()) { + case "rectangle": + return 0; + case "ellipse": + return 1; + case "polygon": + return 2; + default: + return 0 + } + } + , + e._getActionType = function(t) { + switch (t.toLowerCase()) { + case "play": + return 0; + case "frame": + return 10; + case "sound": + return 11; + default: + return 0 + } + } + , + e._getBlendMode = function(t) { + switch (t.toLowerCase()) { + case "normal": + return 0; + case "add": + return 1; + case "alpha": + return 2; + case "darken": + return 3; + case "difference": + return 4; + case "erase": + return 5; + case "hardlight": + return 6; + case "invert": + return 7; + case "layer": + return 8; + case "lighten": + return 9; + case "multiply": + return 10; + case "overlay": + return 11; + case "screen": + return 12; + case "subtract": + return 13; + default: + return 0 + } + } + , + e._getPositionMode = function(t) { + switch (t.toLocaleLowerCase()) { + case "percent": + return 1; + case "fixed": + return 0; + default: + return 1 + } + } + , + e._getSpacingMode = function(t) { + switch (t.toLocaleLowerCase()) { + case "length": + return 0; + case "percent": + return 2; + case "fixed": + return 1; + default: + return 0 + } + } + , + e._getRotateMode = function(t) { + switch (t.toLocaleLowerCase()) { + case "tangent": + return 0; + case "chain": + return 1; + case "chainscale": + return 2; + default: + return 0 + } + } + , + e.parseDragonBonesData = function(e) { + return console.warn("Deprecated."), + e instanceof ArrayBuffer ? t.BinaryDataParser.getInstance().parseDragonBonesData(e) : t.ObjectDataParser.getInstance().parseDragonBonesData(e) + } + , + e.parseTextureAtlasData = function(i, n) { + void 0 === n && (n = 1), + console.warn("\u5df2\u5e9f\u5f03"); + for (var r = {}, s = i[e.SUB_TEXTURE], a = 0, o = s.length; a < o; a++) { + var l = s[a] + , h = l[e.NAME] + , c = new t.Rectangle + , u = null; + c.x = l[e.X] / n, + c.y = l[e.Y] / n, + c.width = l[e.WIDTH] / n, + c.height = l[e.HEIGHT] / n, + e.FRAME_WIDTH in l && ((u = new t.Rectangle).x = l[e.FRAME_X] / n, + u.y = l[e.FRAME_Y] / n, + u.width = l[e.FRAME_WIDTH] / n, + u.height = l[e.FRAME_HEIGHT] / n), + r[h] = { + region: c, + frame: u, + rotated: !1 + } + } + return r + } + , + e.DATA_VERSION_2_3 = "2.3", + e.DATA_VERSION_3_0 = "3.0", + e.DATA_VERSION_4_0 = "4.0", + e.DATA_VERSION_4_5 = "4.5", + e.DATA_VERSION_5_0 = "5.0", + e.DATA_VERSION_5_5 = "5.5", + e.DATA_VERSION = e.DATA_VERSION_5_5, + e.DATA_VERSIONS = [e.DATA_VERSION_4_0, e.DATA_VERSION_4_5, e.DATA_VERSION_5_0, e.DATA_VERSION_5_5], + e.TEXTURE_ATLAS = "textureAtlas", + e.SUB_TEXTURE = "SubTexture", + e.FORMAT = "format", + e.IMAGE_PATH = "imagePath", + e.WIDTH = "width", + e.HEIGHT = "height", + e.ROTATED = "rotated", + e.FRAME_X = "frameX", + e.FRAME_Y = "frameY", + e.FRAME_WIDTH = "frameWidth", + e.FRAME_HEIGHT = "frameHeight", + e.DRADON_BONES = "dragonBones", + e.USER_DATA = "userData", + e.ARMATURE = "armature", + e.BONE = "bone", + e.SURFACE = "surface", + e.SLOT = "slot", + e.CONSTRAINT = "constraint", + e.IK = "ik", + e.PATH_CONSTRAINT = "path", + e.SKIN = "skin", + e.DISPLAY = "display", + e.ANIMATION = "animation", + e.Z_ORDER = "zOrder", + e.FFD = "ffd", + e.FRAME = "frame", + e.TRANSLATE_FRAME = "translateFrame", + e.ROTATE_FRAME = "rotateFrame", + e.SCALE_FRAME = "scaleFrame", + e.DISPLAY_FRAME = "displayFrame", + e.COLOR_FRAME = "colorFrame", + e.DEFAULT_ACTIONS = "defaultActions", + e.ACTIONS = "actions", + e.EVENTS = "events", + e.INTS = "ints", + e.FLOATS = "floats", + e.STRINGS = "strings", + e.CANVAS = "canvas", + e.TRANSFORM = "transform", + e.PIVOT = "pivot", + e.AABB = "aabb", + e.COLOR = "color", + e.VERSION = "version", + e.COMPATIBLE_VERSION = "compatibleVersion", + e.FRAME_RATE = "frameRate", + e.TYPE = "type", + e.SUB_TYPE = "subType", + e.NAME = "name", + e.PARENT = "parent", + e.TARGET = "target", + e.STAGE = "stage", + e.SHARE = "share", + e.PATH = "path", + e.LENGTH = "length", + e.DISPLAY_INDEX = "displayIndex", + e.BLEND_MODE = "blendMode", + e.INHERIT_TRANSLATION = "inheritTranslation", + e.INHERIT_ROTATION = "inheritRotation", + e.INHERIT_SCALE = "inheritScale", + e.INHERIT_REFLECTION = "inheritReflection", + e.INHERIT_ANIMATION = "inheritAnimation", + e.INHERIT_DEFORM = "inheritDeform", + e.SEGMENT_X = "segmentX", + e.SEGMENT_Y = "segmentY", + e.BEND_POSITIVE = "bendPositive", + e.CHAIN = "chain", + e.WEIGHT = "weight", + e.FADE_IN_TIME = "fadeInTime", + e.PLAY_TIMES = "playTimes", + e.SCALE = "scale", + e.OFFSET = "offset", + e.POSITION = "position", + e.DURATION = "duration", + e.TWEEN_EASING = "tweenEasing", + e.TWEEN_ROTATE = "tweenRotate", + e.TWEEN_SCALE = "tweenScale", + e.CLOCK_WISE = "clockwise", + e.CURVE = "curve", + e.SOUND = "sound", + e.EVENT = "event", + e.ACTION = "action", + e.X = "x", + e.Y = "y", + e.SKEW_X = "skX", + e.SKEW_Y = "skY", + e.SCALE_X = "scX", + e.SCALE_Y = "scY", + e.VALUE = "value", + e.ROTATE = "rotate", + e.SKEW = "skew", + e.ALPHA_OFFSET = "aO", + e.RED_OFFSET = "rO", + e.GREEN_OFFSET = "gO", + e.BLUE_OFFSET = "bO", + e.ALPHA_MULTIPLIER = "aM", + e.RED_MULTIPLIER = "rM", + e.GREEN_MULTIPLIER = "gM", + e.BLUE_MULTIPLIER = "bM", + e.UVS = "uvs", + e.VERTICES = "vertices", + e.TRIANGLES = "triangles", + e.WEIGHTS = "weights", + e.SLOT_POSE = "slotPose", + e.BONE_POSE = "bonePose", + e.GLUE_WEIGHTS = "glueWeights", + e.GLUE_MESHES = "glueMeshes", + e.BONES = "bones", + e.POSITION_MODE = "positionMode", + e.SPACING_MODE = "spacingMode", + e.ROTATE_MODE = "rotateMode", + e.SPACING = "spacing", + e.ROTATE_OFFSET = "rotateOffset", + e.ROTATE_MIX = "rotateMix", + e.TRANSLATE_MIX = "translateMix", + e.TARGET_DISPLAY = "targetDisplay", + e.CLOSED = "closed", + e.CONSTANT_SPEED = "constantSpeed", + e.VERTEX_COUNT = "vertexCount", + e.LENGTHS = "lengths", + e.GOTO_AND_PLAY = "gotoAndPlay", + e.DEFAULT_NAME = "default", + e + } + )(); + t.DataParser = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function n() { + var i = null !== e && e.apply(this, arguments) || this; + return i._rawTextureAtlasIndex = 0, + i._rawBones = [], + i._data = null, + i._armature = null, + i._bone = null, + i._surface = null, + i._slot = null, + i._skin = null, + i._mesh = null, + i._animation = null, + i._timeline = null, + i._rawTextureAtlases = null, + i._defaultColorOffset = -1, + i._prevClockwise = 0, + i._prevRotation = 0, + i._helpMatrixA = new t.Matrix, + i._helpMatrixB = new t.Matrix, + i._helpTransform = new t.Transform, + i._helpColorTransform = new t.ColorTransform, + i._helpPoint = new t.Point, + i._helpArray = [], + i._intArray = [], + i._floatArray = [], + i._frameIntArray = [], + i._frameFloatArray = [], + i._frameArray = [], + i._timelineArray = [], + i._cacheRawMeshes = [], + i._cacheMeshes = [], + i._actionFrames = [], + i._weightSlotPose = {}, + i._weightBonePoses = {}, + i._cacheBones = {}, + i._slotChildActions = {}, + i + } + return s(n, e), + n._getBoolean = function(t, e, i) { + if (e in t) { + var n = t[e] + , r = typeof n; + if ("boolean" === r) + return n; + if ("string" !== r) + return !!n; + switch (n) { + case "0": + case "NaN": + case "": + case "false": + case "null": + case "undefined": + return !1; + default: + return !0 + } + } + return i + } + , + n._getNumber = function(t, e, i) { + if (e in t) { + var n = t[e]; + return null === n || "NaN" === n ? i : +n || 0 + } + return i + } + , + n._getString = function(e, i, n) { + if (i in e) { + var r = e[i]; + if ("string" == typeof r) { + if (t.DragonBones.webAssembly) + for (var s = 0, a = r.length; s < a; ++s) + if (r.charCodeAt(s) > 255) + return encodeURI(r); + return r + } + return String(r) + } + return n + } + , + n.prototype._getCurvePoint = function(t, e, i, n, r, s, a, o, l, h) { + var c = 1 - l + , u = c * c + , _ = l * l + , f = c * u + , d = 3 * l * u + , p = 3 * c * _ + , m = l * _; + h.x = f * t + d * i + p * r + m * a, + h.y = f * e + d * n + p * s + m * o + } + , + n.prototype._samplingEasingCurve = function(t, e) { + for (var i = t.length, n = -2, r = 0, s = e.length; r < s; ++r) { + for (var a = (r + 1) / (s + 1); (n + 6 < i ? t[n + 6] : 1) < a; ) + n += 6; + for (var o = n >= 0 && n + 6 < i, l = o ? t[n] : 0, h = o ? t[n + 1] : 0, c = t[n + 2], u = t[n + 3], _ = t[n + 4], f = t[n + 5], d = o ? t[n + 6] : 1, p = o ? t[n + 7] : 1, m = 0, y = 1; y - m > 1e-4; ) { + var v = .5 * (y + m); + this._getCurvePoint(l, h, c, u, _, f, d, p, v, this._helpPoint), + a - this._helpPoint.x > 0 ? m = v : y = v + } + e[r] = this._helpPoint.y + } + } + , + n.prototype._parseActionDataInFrame = function(e, i, n, r) { + t.DataParser.EVENT in e && this._mergeActionFrame(e[t.DataParser.EVENT], i, 10, n, r), + t.DataParser.SOUND in e && this._mergeActionFrame(e[t.DataParser.SOUND], i, 11, n, r), + t.DataParser.ACTION in e && this._mergeActionFrame(e[t.DataParser.ACTION], i, 0, n, r), + t.DataParser.EVENTS in e && this._mergeActionFrame(e[t.DataParser.EVENTS], i, 10, n, r), + t.DataParser.ACTIONS in e && this._mergeActionFrame(e[t.DataParser.ACTIONS], i, 0, n, r) + } + , + n.prototype._mergeActionFrame = function(e, n, r, s, a) { + for (var o = t.DragonBones.webAssembly ? this._armature.actions.size() : this._armature.actions.length, l = this._parseActionData(e, r, s, a), h = 0, c = null, u = 0, _ = l; u < _.length; u++) { + var f = _[u]; + this._armature.addAction(f, !1) + } + 0 === this._actionFrames.length && ((c = new i).frameStart = 0, + this._actionFrames.push(c), + c = null); + for (var d = 0, p = this._actionFrames; d < p.length; d++) { + var m = p[d]; + if (m.frameStart === n) { + c = m; + break + } + if (m.frameStart > n) + break; + h++ + } + null === c && ((c = new i).frameStart = n, + this._actionFrames.splice(h + 1, 0, c)); + for (var y = 0; y < l.length; ++y) + c.actions.push(o + y) + } + , + n.prototype._parseArmature = function(e, i) { + var r = t.BaseObject.borrowObject(t.ArmatureData); + if (r.name = n._getString(e, t.DataParser.NAME, ""), + r.frameRate = n._getNumber(e, t.DataParser.FRAME_RATE, this._data.frameRate), + r.scale = i, + t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? r.type = t.DataParser._getArmatureType(e[t.DataParser.TYPE]) : r.type = n._getNumber(e, t.DataParser.TYPE, 0), + 0 === r.frameRate && (r.frameRate = 24), + this._armature = r, + t.DataParser.CANVAS in e) { + var s = e[t.DataParser.CANVAS] + , a = t.BaseObject.borrowObject(t.CanvasData); + t.DataParser.COLOR in s ? a.hasBackground = !0 : a.hasBackground = !1, + a.color = n._getNumber(s, t.DataParser.COLOR, 0), + a.x = n._getNumber(s, t.DataParser.X, 0) * r.scale, + a.y = n._getNumber(s, t.DataParser.Y, 0) * r.scale, + a.width = n._getNumber(s, t.DataParser.WIDTH, 0) * r.scale, + a.height = n._getNumber(s, t.DataParser.HEIGHT, 0) * r.scale, + r.canvas = a + } + if (t.DataParser.AABB in e) { + var o = e[t.DataParser.AABB]; + r.aabb.x = n._getNumber(o, t.DataParser.X, 0) * r.scale, + r.aabb.y = n._getNumber(o, t.DataParser.Y, 0) * r.scale, + r.aabb.width = n._getNumber(o, t.DataParser.WIDTH, 0) * r.scale, + r.aabb.height = n._getNumber(o, t.DataParser.HEIGHT, 0) * r.scale + } + if (t.DataParser.BONE in e) + for (var l = 0, h = e[t.DataParser.BONE]; l < h.length; l++) { + var c = h[l] + , u = n._getString(c, t.DataParser.PARENT, "") + , _ = this._parseBone(c); + if (u.length > 0) { + var f = r.getBone(u); + null !== f ? _.parent = f : (u in this._cacheBones || (this._cacheBones[u] = []), + this._cacheBones[u].push(_)) + } + if (_.name in this._cacheBones) { + for (var d = 0, p = this._cacheBones[_.name]; d < p.length; d++) + p[d].parent = _; + delete this._cacheBones[_.name] + } + r.addBone(_), + this._rawBones.push(_) + } + if (t.DataParser.IK in e) + for (var m = 0, y = e[t.DataParser.IK]; m < y.length; m++) { + var v = y[m]; + (M = this._parseIKConstraint(v)) && r.addConstraint(M) + } + if (r.sortBones(), + t.DataParser.SLOT in e) + for (var g = 0, A = 0, x = e[t.DataParser.SLOT]; A < x.length; A++) { + var b = x[A]; + r.addSlot(this._parseSlot(b, g++)) + } + if (t.DataParser.SKIN in e) + for (var C = 0, T = e[t.DataParser.SKIN]; C < T.length; C++) { + var S = T[C]; + r.addSkin(this._parseSkin(S)) + } + if (t.DataParser.PATH_CONSTRAINT in e) + for (var w = 0, E = e[t.DataParser.PATH_CONSTRAINT]; w < E.length; w++) { + var M, D = E[w]; + (M = this._parsePathConstraint(D)) && r.addConstraint(M) + } + for (var B = 0, I = this._cacheRawMeshes.length; B < I; ++B) { + var P = this._cacheRawMeshes[B]; + t.DataParser.GLUE_WEIGHTS in P && t.DataParser.GLUE_MESHES in P && this._parseMeshGlue(P, this._cacheMeshes[B]) + } + for (B = 0, + I = this._cacheRawMeshes.length; B < I; ++B) { + var R = this._cacheRawMeshes[B] + , O = n._getString(R, t.DataParser.SHARE, ""); + if (0 !== O.length) { + var L = n._getString(R, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME); + 0 === L.length && (L = t.DataParser.DEFAULT_NAME); + var F = r.getMesh(L, "", O); + null !== F && this._cacheMeshes[B].vertices.shareFrom(F.vertices) + } + } + if (t.DataParser.ANIMATION in e) + for (var V = 0, N = e[t.DataParser.ANIMATION]; V < N.length; V++) { + var k = N[V] + , G = this._parseAnimation(k); + r.addAnimation(G) + } + if (t.DataParser.DEFAULT_ACTIONS in e) + for (var U = 0, z = this._parseActionData(e[t.DataParser.DEFAULT_ACTIONS], 0, null, null); U < z.length; U++) { + var H = z[U]; + r.addAction(H, !0), + 0 === H.type && null !== (G = r.getAnimation(H.name)) && (r.defaultAnimation = G) + } + if (t.DataParser.ACTIONS in e) + for (var W = 0, j = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); W < j.length; W++) + H = j[W], + r.addAction(H, !1); + for (var X in this._rawBones.length = 0, + this._cacheRawMeshes.length = 0, + this._cacheMeshes.length = 0, + this._armature = null, + this._weightSlotPose) + delete this._weightSlotPose[X]; + for (var X in this._weightBonePoses) + delete this._weightBonePoses[X]; + for (var X in this._cacheBones) + delete this._cacheBones[X]; + for (var X in this._slotChildActions) + delete this._slotChildActions[X]; + return r + } + , + n.prototype._parseBone = function(e) { + var i = this._armature.scale; + if (0 === (t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getBoneType(e[t.DataParser.TYPE]) : n._getNumber(e, t.DataParser.TYPE, 0))) { + var r = t.BaseObject.borrowObject(t.BoneData); + return r.inheritTranslation = n._getBoolean(e, t.DataParser.INHERIT_TRANSLATION, !0), + r.inheritRotation = n._getBoolean(e, t.DataParser.INHERIT_ROTATION, !0), + r.inheritScale = n._getBoolean(e, t.DataParser.INHERIT_SCALE, !0), + r.inheritReflection = n._getBoolean(e, t.DataParser.INHERIT_REFLECTION, !0), + r.length = n._getNumber(e, t.DataParser.LENGTH, 0) * i, + r.name = n._getString(e, t.DataParser.NAME, ""), + t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], r.transform, i), + r + } + var s = t.BaseObject.borrowObject(t.SurfaceData); + if (s.name = n._getString(e, t.DataParser.NAME, ""), + s.segmentX = n._getNumber(e, t.DataParser.SEGMENT_X, 0), + s.segmentY = n._getNumber(e, t.DataParser.SEGMENT_Y, 0), + s.vertices.length = (s.segmentX + 1) * (s.segmentY + 1) * 2, + t.DataParser.VERTICES in e) + for (var a = e[t.DataParser.VERTICES], o = 0, l = s.vertices.length; o < l; ++o) + o < a.length ? s.vertices[o] = a[o] * i : s.vertices[o] = 0; + return s + } + , + n.prototype._parseIKConstraint = function(e) { + var i = this._armature.getBone(n._getString(e, t.DataParser.BONE, "")); + if (null === i) + return null; + var r = this._armature.getBone(n._getString(e, t.DataParser.TARGET, "")); + if (null === r) + return null; + var s = t.BaseObject.borrowObject(t.IKConstraintData); + return s.scaleEnabled = n._getBoolean(e, t.DataParser.SCALE, !1), + s.bendPositive = n._getBoolean(e, t.DataParser.BEND_POSITIVE, !0), + s.weight = n._getNumber(e, t.DataParser.WEIGHT, 1), + s.name = n._getString(e, t.DataParser.NAME, ""), + s.type = 0, + s.target = r, + n._getNumber(e, t.DataParser.CHAIN, 0) > 0 && null !== i.parent ? (s.root = i.parent, + s.bone = i) : (s.root = i, + s.bone = null), + s + } + , + n.prototype._parsePathConstraint = function(e) { + var i = this._armature.getSlot(n._getString(e, t.DataParser.TARGET, "")); + if (null === i) + return null; + var r = this._armature.defaultSkin; + if (null === r) + return null; + var s = r.getDisplay(i.name, n._getString(e, t.DataParser.TARGET_DISPLAY, i.name)); + if (null === s || !(s instanceof t.PathDisplayData)) + return null; + var a = e[t.DataParser.BONES]; + if (null === a || 0 === a.length) + return null; + var o = t.BaseObject.borrowObject(t.PathConstraintData); + o.name = n._getString(e, t.DataParser.NAME, ""), + o.type = 1, + o.pathSlot = i, + o.pathDisplayData = s, + o.target = i.parent, + o.positionMode = t.DataParser._getPositionMode(n._getString(e, t.DataParser.POSITION_MODE, "")), + o.spacingMode = t.DataParser._getSpacingMode(n._getString(e, t.DataParser.SPACING_MODE, "")), + o.rotateMode = t.DataParser._getRotateMode(n._getString(e, t.DataParser.ROTATE_MODE, "")), + o.position = n._getNumber(e, t.DataParser.POSITION, 0), + o.spacing = n._getNumber(e, t.DataParser.SPACING, 0), + o.rotateOffset = n._getNumber(e, t.DataParser.ROTATE_OFFSET, 0), + o.rotateMix = n._getNumber(e, t.DataParser.ROTATE_MIX, 1), + o.translateMix = n._getNumber(e, t.DataParser.TRANSLATE_MIX, 1); + for (var l = 0, h = a; l < h.length; l++) { + var c = h[l] + , u = this._armature.getBone(c); + null !== u && (o.AddBone(u), + null === o.root && (o.root = u)) + } + return o + } + , + n.prototype._parseSlot = function(e, i) { + var r = t.BaseObject.borrowObject(t.SlotData); + return r.displayIndex = n._getNumber(e, t.DataParser.DISPLAY_INDEX, 0), + r.zOrder = i, + r.name = n._getString(e, t.DataParser.NAME, ""), + r.parent = this._armature.getBone(n._getString(e, t.DataParser.PARENT, "")), + t.DataParser.BLEND_MODE in e && "string" == typeof e[t.DataParser.BLEND_MODE] ? r.blendMode = t.DataParser._getBlendMode(e[t.DataParser.BLEND_MODE]) : r.blendMode = n._getNumber(e, t.DataParser.BLEND_MODE, 0), + t.DataParser.COLOR in e ? (r.color = t.SlotData.createColor(), + this._parseColorTransform(e[t.DataParser.COLOR], r.color)) : r.color = t.SlotData.DEFAULT_COLOR, + t.DataParser.ACTIONS in e && (this._slotChildActions[r.name] = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null)), + r + } + , + n.prototype._parseSkin = function(e) { + var i = t.BaseObject.borrowObject(t.SkinData); + if (i.name = n._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), + 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME), + t.DataParser.SLOT in e) { + var r = e[t.DataParser.SLOT]; + this._skin = i; + for (var s = 0, a = r; s < a.length; s++) { + var o = a[s] + , l = n._getString(o, t.DataParser.NAME, "") + , h = this._armature.getSlot(l); + if (null !== h) { + if (this._slot = h, + t.DataParser.DISPLAY in o) + for (var c = 0, u = o[t.DataParser.DISPLAY]; c < u.length; c++) { + var _ = u[c]; + _ ? i.addDisplay(l, this._parseDisplay(_)) : i.addDisplay(l, null) + } + this._slot = null + } + } + this._skin = null + } + return i + } + , + n.prototype._parseDisplay = function(e) { + var i = n._getString(e, t.DataParser.NAME, "") + , r = n._getString(e, t.DataParser.PATH, "") + , s = 0 + , a = null; + switch (s = t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getDisplayType(e[t.DataParser.TYPE]) : n._getNumber(e, t.DataParser.TYPE, s)) { + case 0: + var o = a = t.BaseObject.borrowObject(t.ImageDisplayData); + o.name = i, + o.path = r.length > 0 ? r : i, + this._parsePivot(e, o); + break; + case 1: + var l = a = t.BaseObject.borrowObject(t.ArmatureDisplayData); + if (l.name = i, + l.path = r.length > 0 ? r : i, + l.inheritAnimation = !0, + t.DataParser.ACTIONS in e) + for (var h = 0, c = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); h < c.length; h++) { + var u = c[h]; + l.addAction(u) + } + else if (this._slot.name in this._slotChildActions) { + var _ = this._skin.getDisplays(this._slot.name); + if (null === _ ? 0 === this._slot.displayIndex : this._slot.displayIndex === _.length) { + for (var f = 0, d = this._slotChildActions[this._slot.name]; f < d.length; f++) + u = d[f], + l.addAction(u); + delete this._slotChildActions[this._slot.name] + } + } + break; + case 2: + var p = a = t.BaseObject.borrowObject(t.MeshDisplayData); + p.vertices.inheritDeform = n._getBoolean(e, t.DataParser.INHERIT_DEFORM, !0), + p.name = i, + p.path = r.length > 0 ? r : i, + p.vertices.data = this._data, + t.DataParser.SHARE in e ? (this._cacheRawMeshes.push(e), + this._cacheMeshes.push(p)) : this._parseMesh(e, p), + t.DataParser.GLUE_WEIGHTS in e && t.DataParser.GLUE_MESHES in e && (this._cacheRawMeshes.push(e), + this._cacheMeshes.push(p)); + break; + case 3: + var m = this._parseBoundingBox(e); + if (null !== m) { + var y = a = t.BaseObject.borrowObject(t.BoundingBoxDisplayData); + y.name = i, + y.path = r.length > 0 ? r : i, + y.boundingBox = m + } + break; + case 4: + var v = e[t.DataParser.LENGTHS] + , g = a = t.BaseObject.borrowObject(t.PathDisplayData); + g.closed = n._getBoolean(e, t.DataParser.CLOSED, !1), + g.constantSpeed = n._getBoolean(e, t.DataParser.CONSTANT_SPEED, !1), + g.name = i, + g.path = r.length > 0 ? r : i, + g.vertices.data = this._data, + g.curveLengths.length = v.length; + for (var A = 0, x = v.length; A < x; ++A) + g.curveLengths[A] = v[A]; + this._parsePath(e, g) + } + return null !== a && t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], a.transform, this._armature.scale), + a + } + , + n.prototype._parsePath = function(e, i) { + var r = e[t.DataParser.VERTICES] + , s = n._getNumber(e, t.DataParser.VERTEX_COUNT, 0) + , a = this._floatArray.length + , o = this._intArray.length; + if (i.vertices.offset = o, + this._intArray.length += 2, + this._intArray[o + 0] = s, + this._intArray[o + 2] = a, + t.DataParser.WEIGHTS in e) { + var l = e[t.DataParser.WEIGHTS] + , h = e[t.DataParser.BONES] + , c = h.length + , u = Math.floor(l.length - s) / 2 + , _ = this._intArray.length + , f = this._floatArray.length + , d = this._armature.sortedBones + , p = t.BaseObject.borrowObject(t.WeightData); + for (p.count = u, + p.offset = _, + this._intArray.length += 2 + c + s + u, + this._intArray[_ + 0] = c, + this._intArray[_ + 1] = f, + M = 0; M < c; M++) { + var m = h[M] + , y = this._rawBones[m]; + p.addBone(y), + this._intArray[_ + 2 + M] = d.indexOf(y) + } + this._floatArray.length += 3 * u, + M = 0; + for (var v = 0, g = 0, A = _ + 2 + c, x = f; M < u; M++) { + var b = l[v++]; + this._intArray[A++] = b; + for (var C = 0; C < b; C++) { + var T = l[v++] + , S = l[v++] + , w = r[g++] + , E = r[g++]; + this._intArray[A++] = h.indexOf(T), + this._floatArray[x++] = S, + this._floatArray[x++] = w, + this._floatArray[x++] = E + } + } + i.vertices.weight = p + } else { + this._floatArray.length += r.length; + for (var M = 0, D = r.length; M < D; ++M) + this._floatArray[a + M] = r[M] + } + } + , + n.prototype._parsePivot = function(e, i) { + if (t.DataParser.PIVOT in e) { + var r = e[t.DataParser.PIVOT]; + i.pivot.x = n._getNumber(r, t.DataParser.X, 0), + i.pivot.y = n._getNumber(r, t.DataParser.Y, 0) + } else + i.pivot.x = .5, + i.pivot.y = .5 + } + , + n.prototype._parseMesh = function(e, i) { + var n = e[t.DataParser.VERTICES] + , r = e[t.DataParser.UVS] + , s = e[t.DataParser.TRIANGLES] + , a = Math.floor(n.length / 2) + , o = Math.floor(s.length / 3) + , l = this._floatArray.length + , h = l + 2 * a + , c = this._intArray.length + , u = this._skin.name + "_" + this._slot.name + "_" + i.name; + i.vertices.offset = c, + this._intArray.length += 4 + 3 * o, + this._intArray[c + 0] = a, + this._intArray[c + 1] = o, + this._intArray[c + 2] = l; + for (var _ = 0, f = 3 * o; _ < f; ++_) + this._intArray[c + 4 + _] = s[_]; + for (this._floatArray.length += 2 * a + 2 * a, + _ = 0, + f = 2 * a; _ < f; ++_) + this._floatArray[l + _] = n[_], + this._floatArray[h + _] = r[_]; + if (t.DataParser.WEIGHTS in e) { + var d = e[t.DataParser.WEIGHTS] + , p = e[t.DataParser.SLOT_POSE] + , m = e[t.DataParser.BONE_POSE] + , y = this._armature.sortedBones + , v = new Array + , g = Math.floor(m.length / 7) + , A = this._floatArray.length + , x = Math.floor(d.length - a) / 2 + , b = this._intArray.length + , C = t.BaseObject.borrowObject(t.WeightData); + for (C.count = x, + C.offset = b, + v.length = g, + this._intArray.length += 2 + g + a + x, + this._intArray[b + 1] = A, + _ = 0; _ < g; ++_) { + var T = m[7 * _] + , S = this._rawBones[T]; + C.addBone(S), + v[_] = T, + this._intArray[b + 2 + _] = y.indexOf(S) + } + this._floatArray.length += 3 * x, + this._helpMatrixA.copyFromArray(p, 0), + _ = 0; + for (var w = 0, E = b + 2 + g, M = A; _ < a; ++_) { + var D = 2 * _ + , B = this._intArray[E++] = d[w++] + , I = this._floatArray[l + D] + , P = this._floatArray[l + D + 1]; + this._helpMatrixA.transformPoint(I, P, this._helpPoint), + I = this._helpPoint.x, + P = this._helpPoint.y; + for (var R = 0; R < B; ++R) { + T = d[w++]; + var O = v.indexOf(T); + this._helpMatrixB.copyFromArray(m, 7 * O + 1), + this._helpMatrixB.invert(), + this._helpMatrixB.transformPoint(I, P, this._helpPoint), + this._intArray[E++] = O, + this._floatArray[M++] = d[w++], + this._floatArray[M++] = this._helpPoint.x, + this._floatArray[M++] = this._helpPoint.y + } + } + i.vertices.weight = C, + this._weightSlotPose[u] = p, + this._weightBonePoses[u] = m + } + } + , + n.prototype._parseMeshGlue = function() {} + , + n.prototype._parseBoundingBox = function(e) { + var i = null + , r = 0; + switch (r = t.DataParser.SUB_TYPE in e && "string" == typeof e[t.DataParser.SUB_TYPE] ? t.DataParser._getBoundingBoxType(e[t.DataParser.SUB_TYPE]) : n._getNumber(e, t.DataParser.SUB_TYPE, r)) { + case 0: + i = t.BaseObject.borrowObject(t.RectangleBoundingBoxData); + break; + case 1: + i = t.BaseObject.borrowObject(t.EllipseBoundingBoxData); + break; + case 2: + i = this._parsePolygonBoundingBox(e) + } + return null !== i && (i.color = n._getNumber(e, t.DataParser.COLOR, 0), + 0 !== i.type && 1 !== i.type || (i.width = n._getNumber(e, t.DataParser.WIDTH, 0), + i.height = n._getNumber(e, t.DataParser.HEIGHT, 0))), + i + } + , + n.prototype._parsePolygonBoundingBox = function(e) { + var i = t.BaseObject.borrowObject(t.PolygonBoundingBoxData); + if (t.DataParser.VERTICES in e) { + var n = this._armature.scale + , r = e[t.DataParser.VERTICES] + , s = i.vertices; + t.DragonBones.webAssembly ? s.resize(r.length, 0) : s.length = r.length; + for (var a = 0, o = r.length; a < o; a += 2) { + var l = r[a] * n + , h = r[a + 1] * n; + t.DragonBones.webAssembly ? (s.set(a, l), + s.set(a + 1, h)) : (s[a] = l, + s[a + 1] = h), + 0 === a ? (i.x = l, + i.y = h, + i.width = l, + i.height = h) : (l < i.x ? i.x = l : l > i.width && (i.width = l), + h < i.y ? i.y = h : h > i.height && (i.height = h)) + } + i.width -= i.x, + i.height -= i.y + } else + console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug."); + return i + } + , + n.prototype._parseAnimation = function(e) { + var i = t.BaseObject.borrowObject(t.AnimationData); + if (i.frameCount = Math.max(n._getNumber(e, t.DataParser.DURATION, 1), 1), + i.playTimes = n._getNumber(e, t.DataParser.PLAY_TIMES, 1), + i.duration = i.frameCount / this._armature.frameRate, + i.fadeInTime = n._getNumber(e, t.DataParser.FADE_IN_TIME, 0), + i.scale = n._getNumber(e, t.DataParser.SCALE, 1), + i.name = n._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), + 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME), + i.frameIntOffset = this._frameIntArray.length, + i.frameFloatOffset = this._frameFloatArray.length, + i.frameOffset = this._frameArray.length, + this._animation = i, + t.DataParser.FRAME in e) { + var r = e[t.DataParser.FRAME] + , s = r.length; + if (s > 0) + for (var a = 0, o = 0; a < s; ++a) { + var l = r[a]; + this._parseActionDataInFrame(l, o, null, null), + o += n._getNumber(l, t.DataParser.DURATION, 1) + } + } + if (t.DataParser.Z_ORDER in e && (this._animation.zOrderTimeline = this._parseTimeline(e[t.DataParser.Z_ORDER], null, t.DataParser.FRAME, 1, !1, !1, 0, this._parseZOrderFrame)), + t.DataParser.BONE in e) + for (var h = 0, c = e[t.DataParser.BONE]; h < c.length; h++) { + var u = c[h]; + this._parseBoneTimeline(u) + } + if (t.DataParser.SURFACE in e) + for (var _ = 0, f = e[t.DataParser.SURFACE]; _ < f.length; _++) { + u = f[_]; + var d = n._getString(u, t.DataParser.NAME, ""); + this._surface = this._armature.getBone(d), + null !== this._surface && (null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 50, !1, !0, 0, this._parseSurfaceFrame)) && this._animation.addSurfaceTimeline(this._surface, M), + this._surface = null) + } + if (t.DataParser.SLOT in e) + for (var p = 0, m = e[t.DataParser.SLOT]; p < m.length; p++) + u = m[p], + this._parseSlotTimeline(u); + if (t.DataParser.FFD in e) + for (var y = 0, v = e[t.DataParser.FFD]; y < v.length; y++) { + u = v[y]; + var g = n._getString(u, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME) + , A = n._getString(u, t.DataParser.SLOT, "") + , x = n._getString(u, t.DataParser.NAME, ""); + 0 === g.length && (g = t.DataParser.DEFAULT_NAME), + this._slot = this._armature.getSlot(A), + this._mesh = this._armature.getMesh(g, A, x), + null !== this._slot && null !== this._mesh && (null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 22, !1, !0, 0, this._parseSlotFFDFrame)) && this._animation.addSlotTimeline(this._slot, M), + this._slot = null, + this._mesh = null) + } + if (t.DataParser.IK in e) + for (var b = 0, C = e[t.DataParser.IK]; b < C.length; b++) { + u = C[b]; + var T = n._getString(u, t.DataParser.NAME, "") + , S = this._armature.getConstraint(T); + null !== S && null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 30, !0, !1, 2, this._parseIKConstraintFrame)) && this._animation.addConstraintTimeline(S, M) + } + if (t.DataParser.ANIMATION in e) + for (var w = 0, E = e[t.DataParser.ANIMATION]; w < E.length; w++) { + u = E[w]; + var M, D = n._getString(u, t.DataParser.NAME, ""); + null !== (M = this._parseTimeline(u, null, t.DataParser.FRAME, 40, !0, !1, 2, this._parseAnimationFrame)) && this._animation.addAnimationTimeline(D, M) + } + return this._actionFrames.length > 0 && (this._animation.actionTimeline = this._parseTimeline(null, this._actionFrames, "", 0, !1, !1, 0, this._parseActionFrame), + this._actionFrames.length = 0), + this._animation = null, + i + } + , + n.prototype._parseTimeline = function(e, r, s, a, o, l, h, c) { + if (null !== e && s.length > 0 && s in e && (r = e[s]), + null === r) + return null; + var u = r.length; + if (0 === u) + return null; + var _ = this._frameIntArray.length + , f = this._frameFloatArray.length + , d = t.BaseObject.borrowObject(t.TimelineData) + , p = this._timelineArray.length; + if (this._timelineArray.length += 5 + u, + null !== e ? (this._timelineArray[p + 0] = Math.round(100 * n._getNumber(e, t.DataParser.SCALE, 1)), + this._timelineArray[p + 1] = Math.round(100 * n._getNumber(e, t.DataParser.OFFSET, 0))) : (this._timelineArray[p + 0] = 100, + this._timelineArray[p + 1] = 0), + this._timelineArray[p + 2] = u, + this._timelineArray[p + 3] = h, + this._timelineArray[p + 4] = o ? _ - this._animation.frameIntOffset : l ? f - this._animation.frameFloatOffset : 0, + this._timeline = d, + d.type = a, + d.offset = p, + 1 === u) + d.frameIndicesOffset = -1, + this._timelineArray[p + 5 + 0] = c.call(this, r[0], 0, 0) - this._animation.frameOffset; + else { + var m = this._animation.frameCount + 1 + , y = this._data.frameIndices + , v = 0; + t.DragonBones.webAssembly ? (v = y.size(), + y.resize(v + m, 0)) : (v = y.length, + y.length += m), + d.frameIndicesOffset = v; + for (var g = 0, A = 0, x = 0, b = 0; g < m; ++g) { + if (x + b <= g && A < u) { + var C = r[A]; + x = g, + b = A === u - 1 ? this._animation.frameCount - x : C instanceof i ? this._actionFrames[A + 1].frameStart - x : n._getNumber(C, t.DataParser.DURATION, 1), + this._timelineArray[p + 5 + A] = c.call(this, C, x, b) - this._animation.frameOffset, + A++ + } + t.DragonBones.webAssembly ? y.set(v + g, A - 1) : y[v + g] = A - 1 + } + } + return this._timeline = null, + d + } + , + n.prototype._parseBoneTimeline = function(e) { + var i, r = this._armature.getBone(n._getString(e, t.DataParser.NAME, "")); + null !== r && (this._bone = r, + this._slot = this._armature.getSlot(this._bone.name), + t.DataParser.TRANSLATE_FRAME in e && null !== (i = this._parseTimeline(e, null, t.DataParser.TRANSLATE_FRAME, 11, !1, !0, 2, this._parseBoneTranslateFrame)) && this._animation.addBoneTimeline(r, i), + t.DataParser.ROTATE_FRAME in e && null !== (i = this._parseTimeline(e, null, t.DataParser.ROTATE_FRAME, 12, !1, !0, 2, this._parseBoneRotateFrame)) && this._animation.addBoneTimeline(r, i), + t.DataParser.SCALE_FRAME in e && null !== (i = this._parseTimeline(e, null, t.DataParser.SCALE_FRAME, 13, !1, !0, 2, this._parseBoneScaleFrame)) && this._animation.addBoneTimeline(r, i), + t.DataParser.FRAME in e && null !== (i = this._parseTimeline(e, null, t.DataParser.FRAME, 10, !1, !0, 6, this._parseBoneAllFrame)) && this._animation.addBoneTimeline(r, i), + this._bone = null, + this._slot = null) + } + , + n.prototype._parseSlotTimeline = function(e) { + var i = this._armature.getSlot(n._getString(e, t.DataParser.NAME, "")); + if (null !== i) { + this._slot = i; + var r; + null !== (r = t.DataParser.DISPLAY_FRAME in e ? this._parseTimeline(e, null, t.DataParser.DISPLAY_FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame)) && this._animation.addSlotTimeline(i, r); + var s; + null !== (s = t.DataParser.COLOR_FRAME in e ? this._parseTimeline(e, null, t.DataParser.COLOR_FRAME, 21, !0, !1, 1, this._parseSlotColorFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 21, !0, !1, 1, this._parseSlotColorFrame)) && this._animation.addSlotTimeline(i, s), + this._slot = null + } + } + , + n.prototype._parseFrame = function(t, e) { + var i = this._frameArray.length; + return this._frameArray.length += 1, + this._frameArray[i + 0] = e, + i + } + , + n.prototype._parseTweenFrame = function(e, i, r) { + var s = this._parseFrame(e, i, r); + if (r > 0) + if (t.DataParser.CURVE in e) { + var a = r + 1; + this._helpArray.length = a, + this._samplingEasingCurve(e[t.DataParser.CURVE], this._helpArray), + this._frameArray.length += 2 + this._helpArray.length, + this._frameArray[s + 1] = 2, + this._frameArray[s + 2] = a; + for (var o = 0; o < a; ++o) + this._frameArray[s + 3 + o] = Math.round(1e4 * this._helpArray[o]) + } else { + var l = -2; + t.DataParser.TWEEN_EASING in e && (l = n._getNumber(e, t.DataParser.TWEEN_EASING, -2)), + -2 === l ? (this._frameArray.length += 1, + this._frameArray[s + 1] = 0) : 0 === l ? (this._frameArray.length += 1, + this._frameArray[s + 1] = 1) : l < 0 ? (this._frameArray.length += 2, + this._frameArray[s + 1] = 3, + this._frameArray[s + 2] = Math.round(100 * -l)) : l <= 1 ? (this._frameArray.length += 2, + this._frameArray[s + 1] = 4, + this._frameArray[s + 2] = Math.round(100 * l)) : (this._frameArray.length += 2, + this._frameArray[s + 1] = 5, + this._frameArray[s + 2] = Math.round(100 * l - 100)) + } + else + this._frameArray.length += 1, + this._frameArray[s + 1] = 0; + return s + } + , + n.prototype._parseActionFrame = function(t, e) { + var i = this._frameArray.length + , n = t.actions.length; + this._frameArray.length += 2 + n, + this._frameArray[i + 0] = e, + this._frameArray[i + 0 + 1] = n; + for (var r = 0; r < n; ++r) + this._frameArray[i + 0 + 2 + r] = t.actions[r]; + return i + } + , + n.prototype._parseZOrderFrame = function(e, i, n) { + var r = this._parseFrame(e, i, n); + if (t.DataParser.Z_ORDER in e) { + var s = e[t.DataParser.Z_ORDER]; + if (s.length > 0) { + for (var a = this._armature.sortedSlots.length, o = new Array(a - s.length / 2), l = new Array(a), h = 0; h < o.length; ++h) + o[h] = 0; + for (var c = 0; c < a; ++c) + l[c] = -1; + for (var u = 0, _ = 0, f = 0, d = s.length; f < d; f += 2) { + for (var p = s[f], m = s[f + 1]; u !== p; ) + o[_++] = u++; + l[u + m] = u++ + } + for (; u < a; ) + o[_++] = u++; + this._frameArray.length += 1 + a, + this._frameArray[r + 1] = a; + for (var y = a; y--; ) + -1 === l[y] ? this._frameArray[r + 2 + y] = o[--_] || 0 : this._frameArray[r + 2 + y] = l[y] || 0; + return r + } + } + return this._frameArray.length += 1, + this._frameArray[r + 1] = 0, + r + } + , + n.prototype._parseBoneAllFrame = function(e, i, r) { + this._helpTransform.identity(), + t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], this._helpTransform, 1); + var s = this._helpTransform.rotation; + 0 !== i && (0 === this._prevClockwise ? s = this._prevRotation + t.Transform.normalizeRadian(s - this._prevRotation) : ((this._prevClockwise > 0 ? s >= this._prevRotation : s <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1), + s = this._prevRotation + s - this._prevRotation + t.Transform.PI_D * this._prevClockwise)), + this._prevClockwise = n._getNumber(e, t.DataParser.TWEEN_ROTATE, 0), + this._prevRotation = s; + var a = this._parseTweenFrame(e, i, r) + , o = this._frameFloatArray.length; + return this._frameFloatArray.length += 6, + this._frameFloatArray[o++] = this._helpTransform.x, + this._frameFloatArray[o++] = this._helpTransform.y, + this._frameFloatArray[o++] = s, + this._frameFloatArray[o++] = this._helpTransform.skew, + this._frameFloatArray[o++] = this._helpTransform.scaleX, + this._frameFloatArray[o++] = this._helpTransform.scaleY, + this._parseActionDataInFrame(e, i, this._bone, this._slot), + a + } + , + n.prototype._parseBoneTranslateFrame = function(e, i, r) { + var s = this._parseTweenFrame(e, i, r) + , a = this._frameFloatArray.length; + return this._frameFloatArray.length += 2, + this._frameFloatArray[a++] = n._getNumber(e, t.DataParser.X, 0), + this._frameFloatArray[a++] = n._getNumber(e, t.DataParser.Y, 0), + s + } + , + n.prototype._parseBoneRotateFrame = function(e, i, r) { + var s = n._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD; + 0 !== i && (0 === this._prevClockwise ? s = this._prevRotation + t.Transform.normalizeRadian(s - this._prevRotation) : ((this._prevClockwise > 0 ? s >= this._prevRotation : s <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1), + s = this._prevRotation + s - this._prevRotation + t.Transform.PI_D * this._prevClockwise)), + this._prevClockwise = n._getNumber(e, t.DataParser.CLOCK_WISE, 0), + this._prevRotation = s; + var a = this._parseTweenFrame(e, i, r) + , o = this._frameFloatArray.length; + return this._frameFloatArray.length += 2, + this._frameFloatArray[o++] = s, + this._frameFloatArray[o++] = n._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD, + a + } + , + n.prototype._parseBoneScaleFrame = function(e, i, r) { + var s = this._parseTweenFrame(e, i, r) + , a = this._frameFloatArray.length; + return this._frameFloatArray.length += 2, + this._frameFloatArray[a++] = n._getNumber(e, t.DataParser.X, 1), + this._frameFloatArray[a++] = n._getNumber(e, t.DataParser.Y, 1), + s + } + , + n.prototype._parseSurfaceFrame = function(e, i, r) { + var s = this._frameFloatArray.length + , a = this._parseTweenFrame(e, i, r) + , o = e[t.DataParser.VERTICES] + , l = n._getNumber(e, t.DataParser.OFFSET, 0) + , h = this._surface.vertices.length / 2 + , c = 0 + , u = 0; + this._frameFloatArray.length += 2 * h; + for (var _ = 0; _ < 2 * h; _ += 2) + c = _ < l || _ - l >= o.length ? 0 : o[_ - l], + u = _ + 1 < l || _ + 1 - l >= o.length ? 0 : o[_ + 1 - l], + this._frameFloatArray[s + _] = c, + this._frameFloatArray[s + _ + 1] = u; + if (0 === i) { + var f = this._frameIntArray.length; + this._frameIntArray.length += 5, + this._frameIntArray[f + 0] = 0, + this._frameIntArray[f + 1] = this._frameFloatArray.length - s, + this._frameIntArray[f + 2] = this._frameFloatArray.length - s, + this._frameIntArray[f + 3] = 0, + this._frameIntArray[f + 4] = s - this._animation.frameFloatOffset, + this._timelineArray[this._timeline.offset + 3] = f - this._animation.frameIntOffset + } + return a + } + , + n.prototype._parseSlotDisplayFrame = function(e, i, r) { + var s = this._parseFrame(e, i, r); + return this._frameArray.length += 1, + t.DataParser.VALUE in e ? this._frameArray[s + 1] = n._getNumber(e, t.DataParser.VALUE, 0) : this._frameArray[s + 1] = n._getNumber(e, t.DataParser.DISPLAY_INDEX, 0), + this._parseActionDataInFrame(e, i, this._slot.parent, this._slot), + s + } + , + n.prototype._parseSlotColorFrame = function(e, i, n) { + var r = this._parseTweenFrame(e, i, n) + , s = -1; + if (t.DataParser.VALUE in e || t.DataParser.COLOR in e) { + var a = t.DataParser.VALUE in e ? e[t.DataParser.VALUE] : e[t.DataParser.COLOR]; + for (var o in a) { + this._parseColorTransform(a, this._helpColorTransform), + s = this._intArray.length, + this._intArray.length += 8, + this._intArray[s++] = Math.round(100 * this._helpColorTransform.alphaMultiplier), + this._intArray[s++] = Math.round(100 * this._helpColorTransform.redMultiplier), + this._intArray[s++] = Math.round(100 * this._helpColorTransform.greenMultiplier), + this._intArray[s++] = Math.round(100 * this._helpColorTransform.blueMultiplier), + this._intArray[s++] = Math.round(this._helpColorTransform.alphaOffset), + this._intArray[s++] = Math.round(this._helpColorTransform.redOffset), + this._intArray[s++] = Math.round(this._helpColorTransform.greenOffset), + this._intArray[s++] = Math.round(this._helpColorTransform.blueOffset), + s -= 8; + break + } + } + s < 0 && (this._defaultColorOffset < 0 && (this._defaultColorOffset = s = this._intArray.length, + this._intArray.length += 8, + this._intArray[s++] = 100, + this._intArray[s++] = 100, + this._intArray[s++] = 100, + this._intArray[s++] = 100, + this._intArray[s++] = 0, + this._intArray[s++] = 0, + this._intArray[s++] = 0, + this._intArray[s++] = 0), + s = this._defaultColorOffset); + var l = this._frameIntArray.length; + return this._frameIntArray.length += 1, + this._frameIntArray[l] = s, + r + } + , + n.prototype._parseSlotFFDFrame = function(e, i, r) { + var s = this._frameFloatArray.length + , a = this._parseTweenFrame(e, i, r) + , o = t.DataParser.VERTICES in e ? e[t.DataParser.VERTICES] : null + , l = n._getNumber(e, t.DataParser.OFFSET, 0) + , h = this._intArray[this._mesh.vertices.offset + 0] + , c = this._mesh.parent.name + "_" + this._slot.name + "_" + this._mesh.name + , u = this._mesh.vertices.weight + , _ = 0 + , f = 0 + , d = 0 + , p = 0; + if (null !== u) { + var m = this._weightSlotPose[c]; + this._helpMatrixA.copyFromArray(m, 0), + this._frameFloatArray.length += 2 * u.count, + d = u.offset + 2 + u.bones.length + } else + this._frameFloatArray.length += 2 * h; + for (var y = 0; y < 2 * h; y += 2) + if (null === o ? (_ = 0, + f = 0) : (_ = y < l || y - l >= o.length ? 0 : o[y - l], + f = y + 1 < l || y + 1 - l >= o.length ? 0 : o[y + 1 - l]), + null !== u) { + var v = this._weightBonePoses[c] + , g = this._intArray[d++]; + this._helpMatrixA.transformPoint(_, f, this._helpPoint, !0), + _ = this._helpPoint.x, + f = this._helpPoint.y; + for (var A = 0; A < g; ++A) { + var x = this._intArray[d++]; + this._helpMatrixB.copyFromArray(v, 7 * x + 1), + this._helpMatrixB.invert(), + this._helpMatrixB.transformPoint(_, f, this._helpPoint, !0), + this._frameFloatArray[s + p++] = this._helpPoint.x, + this._frameFloatArray[s + p++] = this._helpPoint.y + } + } else + this._frameFloatArray[s + y] = _, + this._frameFloatArray[s + y + 1] = f; + if (0 === i) { + var b = this._frameIntArray.length; + this._frameIntArray.length += 5, + this._frameIntArray[b + 0] = this._mesh.vertices.offset, + this._frameIntArray[b + 1] = this._frameFloatArray.length - s, + this._frameIntArray[b + 2] = this._frameFloatArray.length - s, + this._frameIntArray[b + 3] = 0, + this._frameIntArray[b + 4] = s - this._animation.frameFloatOffset, + this._timelineArray[this._timeline.offset + 3] = b - this._animation.frameIntOffset + } + return a + } + , + n.prototype._parseIKConstraintFrame = function(e, i, r) { + var s = this._parseTweenFrame(e, i, r) + , a = this._frameIntArray.length; + return this._frameIntArray.length += 2, + this._frameIntArray[a++] = n._getBoolean(e, t.DataParser.BEND_POSITIVE, !0) ? 1 : 0, + this._frameIntArray[a++] = Math.round(100 * n._getNumber(e, t.DataParser.WEIGHT, 1)), + s + } + , + n.prototype._parseAnimationFrame = function(e, i, r) { + var s = this._parseTweenFrame(e, i, r) + , a = this._frameIntArray.length; + return this._frameIntArray.length += 2, + this._frameIntArray[a++] = n._getNumber(e, t.DataParser.VALUE, 0), + this._frameIntArray[a++] = Math.round(100 * n._getNumber(e, t.DataParser.WEIGHT, 1)), + s + } + , + n.prototype._parseActionData = function(e, i, r, s) { + var a = new Array; + if ("string" == typeof e) + (c = t.BaseObject.borrowObject(t.ActionData)).type = i, + c.name = e, + c.bone = r, + c.slot = s, + a.push(c); + else if (e instanceof Array) + for (var o = 0, l = e; o < l.length; o++) { + var h = l[o] + , c = t.BaseObject.borrowObject(t.ActionData); + if (t.DataParser.GOTO_AND_PLAY in h ? (c.type = 0, + c.name = n._getString(h, t.DataParser.GOTO_AND_PLAY, "")) : (t.DataParser.TYPE in h && "string" == typeof h[t.DataParser.TYPE] ? c.type = t.DataParser._getActionType(h[t.DataParser.TYPE]) : c.type = n._getNumber(h, t.DataParser.TYPE, i), + c.name = n._getString(h, t.DataParser.NAME, "")), + t.DataParser.BONE in h) { + var u = n._getString(h, t.DataParser.BONE, ""); + c.bone = this._armature.getBone(u) + } else + c.bone = r; + if (t.DataParser.SLOT in h) { + var _ = n._getString(h, t.DataParser.SLOT, ""); + c.slot = this._armature.getSlot(_) + } else + c.slot = s; + var f = null; + if (t.DataParser.INTS in h) { + null === f && (f = t.BaseObject.borrowObject(t.UserData)); + for (var d = 0, p = h[t.DataParser.INTS]; d < p.length; d++) { + var m = p[d]; + f.addInt(m) + } + } + if (t.DataParser.FLOATS in h) { + null === f && (f = t.BaseObject.borrowObject(t.UserData)); + for (var y = 0, v = h[t.DataParser.FLOATS]; y < v.length; y++) + m = v[y], + f.addFloat(m) + } + if (t.DataParser.STRINGS in h) { + null === f && (f = t.BaseObject.borrowObject(t.UserData)); + for (var g = 0, A = h[t.DataParser.STRINGS]; g < A.length; g++) + m = A[g], + f.addString(m) + } + c.data = f, + a.push(c) + } + return a + } + , + n.prototype._parseTransform = function(e, i, r) { + i.x = n._getNumber(e, t.DataParser.X, 0) * r, + i.y = n._getNumber(e, t.DataParser.Y, 0) * r, + t.DataParser.ROTATE in e || t.DataParser.SKEW in e ? (i.rotation = t.Transform.normalizeRadian(n._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD), + i.skew = t.Transform.normalizeRadian(n._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD)) : (t.DataParser.SKEW_X in e || t.DataParser.SKEW_Y in e) && (i.rotation = t.Transform.normalizeRadian(n._getNumber(e, t.DataParser.SKEW_Y, 0) * t.Transform.DEG_RAD), + i.skew = t.Transform.normalizeRadian(n._getNumber(e, t.DataParser.SKEW_X, 0) * t.Transform.DEG_RAD) - i.rotation), + i.scaleX = n._getNumber(e, t.DataParser.SCALE_X, 1), + i.scaleY = n._getNumber(e, t.DataParser.SCALE_Y, 1) + } + , + n.prototype._parseColorTransform = function(e, i) { + i.alphaMultiplier = .01 * n._getNumber(e, t.DataParser.ALPHA_MULTIPLIER, 100), + i.redMultiplier = .01 * n._getNumber(e, t.DataParser.RED_MULTIPLIER, 100), + i.greenMultiplier = .01 * n._getNumber(e, t.DataParser.GREEN_MULTIPLIER, 100), + i.blueMultiplier = .01 * n._getNumber(e, t.DataParser.BLUE_MULTIPLIER, 100), + i.alphaOffset = n._getNumber(e, t.DataParser.ALPHA_OFFSET, 0), + i.redOffset = n._getNumber(e, t.DataParser.RED_OFFSET, 0), + i.greenOffset = n._getNumber(e, t.DataParser.GREEN_OFFSET, 0), + i.blueOffset = n._getNumber(e, t.DataParser.BLUE_OFFSET, 0) + } + , + n.prototype._parseArray = function() { + this._intArray.length = 0, + this._floatArray.length = 0, + this._frameIntArray.length = 0, + this._frameFloatArray.length = 0, + this._frameArray.length = 0, + this._timelineArray.length = 0 + } + , + n.prototype._modifyArray = function() { + this._intArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._intArray.push(0), + this._frameIntArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameIntArray.push(0), + this._frameArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameArray.push(0), + this._timelineArray.length % Uint16Array.BYTES_PER_ELEMENT != 0 && this._timelineArray.push(0); + var e = this._intArray.length * Int16Array.BYTES_PER_ELEMENT + , i = this._floatArray.length * Float32Array.BYTES_PER_ELEMENT + , n = this._frameIntArray.length * Int16Array.BYTES_PER_ELEMENT + , r = this._frameFloatArray.length * Float32Array.BYTES_PER_ELEMENT + , s = this._frameArray.length * Int16Array.BYTES_PER_ELEMENT + , a = this._timelineArray.length * Uint16Array.BYTES_PER_ELEMENT + , o = e + i + n + r + s + a; + if (t.DragonBones.webAssembly) { + for (var l = t.webAssemblyModule.HEAP16.buffer, h = t.webAssemblyModule._malloc(o), c = new Int16Array(l,h,this._intArray.length), u = new Float32Array(l,h + e,this._floatArray.length), _ = new Int16Array(l,h + e + i,this._frameIntArray.length), f = new Float32Array(l,h + e + i + n,this._frameFloatArray.length), d = new Int16Array(l,h + e + i + n + r,this._frameArray.length), p = new Uint16Array(l,h + e + i + n + r + s,this._timelineArray.length), m = 0, y = this._intArray.length; m < y; ++m) + c[m] = this._intArray[m]; + for (m = 0, + y = this._floatArray.length; m < y; ++m) + u[m] = this._floatArray[m]; + for (m = 0, + y = this._frameIntArray.length; m < y; ++m) + _[m] = this._frameIntArray[m]; + for (m = 0, + y = this._frameFloatArray.length; m < y; ++m) + f[m] = this._frameFloatArray[m]; + for (m = 0, + y = this._frameArray.length; m < y; ++m) + d[m] = this._frameArray[m]; + for (m = 0, + y = this._timelineArray.length; m < y; ++m) + p[m] = this._timelineArray[m]; + t.webAssemblyModule.setDataBinary(this._data, h, e, i, n, r, s, a) + } else { + var v = new ArrayBuffer(o); + for (c = new Int16Array(v,0,this._intArray.length), + u = new Float32Array(v,e,this._floatArray.length), + _ = new Int16Array(v,e + i,this._frameIntArray.length), + f = new Float32Array(v,e + i + n,this._frameFloatArray.length), + d = new Int16Array(v,e + i + n + r,this._frameArray.length), + p = new Uint16Array(v,e + i + n + r + s,this._timelineArray.length), + m = 0, + y = this._intArray.length; m < y; ++m) + c[m] = this._intArray[m]; + for (m = 0, + y = this._floatArray.length; m < y; ++m) + u[m] = this._floatArray[m]; + for (m = 0, + y = this._frameIntArray.length; m < y; ++m) + _[m] = this._frameIntArray[m]; + for (m = 0, + y = this._frameFloatArray.length; m < y; ++m) + f[m] = this._frameFloatArray[m]; + for (m = 0, + y = this._frameArray.length; m < y; ++m) + d[m] = this._frameArray[m]; + for (m = 0, + y = this._timelineArray.length; m < y; ++m) + p[m] = this._timelineArray[m]; + this._data.binary = v, + this._data.intArray = c, + this._data.floatArray = u, + this._data.frameIntArray = _, + this._data.frameFloatArray = f, + this._data.frameArray = d, + this._data.timelineArray = p + } + this._defaultColorOffset = -1 + } + , + n.prototype.parseDragonBonesData = function(e, i) { + void 0 === i && (i = 1), + console.assert(null != e, "Data error."); + var r = n._getString(e, t.DataParser.VERSION, "") + , s = n._getString(e, t.DataParser.COMPATIBLE_VERSION, ""); + if (t.DataParser.DATA_VERSIONS.indexOf(r) >= 0 || t.DataParser.DATA_VERSIONS.indexOf(s) >= 0) { + var a = t.BaseObject.borrowObject(t.DragonBonesData); + if (a.version = r, + a.name = n._getString(e, t.DataParser.NAME, ""), + a.frameRate = n._getNumber(e, t.DataParser.FRAME_RATE, 24), + 0 === a.frameRate && (a.frameRate = 24), + t.DataParser.ARMATURE in e) { + this._data = a, + this._parseArray(e); + for (var o = 0, l = e[t.DataParser.ARMATURE]; o < l.length; o++) { + var h = l[o]; + a.addArmature(this._parseArmature(h, i)) + } + this._data.binary || this._modifyArray(), + t.DataParser.STAGE in e ? a.stage = a.getArmature(n._getString(e, t.DataParser.STAGE, "")) : a.armatureNames.length > 0 && (a.stage = a.getArmature(a.armatureNames[0])), + this._data = null + } + return t.DataParser.TEXTURE_ATLAS in e && (this._rawTextureAtlases = e[t.DataParser.TEXTURE_ATLAS]), + a + } + return console.assert(!1, "Nonsupport data version: " + r + "\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"), + null + } + , + n.prototype.parseTextureAtlasData = function(e, i, r) { + if (void 0 === r && (r = 1), + console.assert(void 0 !== e), + null === e) { + if (null === this._rawTextureAtlases || 0 === this._rawTextureAtlases.length) + return !1; + var s = this._rawTextureAtlases[this._rawTextureAtlasIndex++]; + return this.parseTextureAtlasData(s, i, r), + this._rawTextureAtlasIndex >= this._rawTextureAtlases.length && (this._rawTextureAtlasIndex = 0, + this._rawTextureAtlases = null), + !0 + } + if (i.width = n._getNumber(e, t.DataParser.WIDTH, 0), + i.height = n._getNumber(e, t.DataParser.HEIGHT, 0), + i.scale = 1 === r ? 1 / n._getNumber(e, t.DataParser.SCALE, 1) : r, + i.name = n._getString(e, t.DataParser.NAME, ""), + i.imagePath = n._getString(e, t.DataParser.IMAGE_PATH, ""), + t.DataParser.SUB_TEXTURE in e) + for (var a = e[t.DataParser.SUB_TEXTURE], o = 0, l = a.length; o < l; ++o) { + var h = a[o] + , c = i.createTexture(); + c.rotated = n._getBoolean(h, t.DataParser.ROTATED, !1), + c.name = n._getString(h, t.DataParser.NAME, ""), + c.region.x = n._getNumber(h, t.DataParser.X, 0), + c.region.y = n._getNumber(h, t.DataParser.Y, 0), + c.region.width = n._getNumber(h, t.DataParser.WIDTH, 0), + c.region.height = n._getNumber(h, t.DataParser.HEIGHT, 0); + var u = n._getNumber(h, t.DataParser.FRAME_WIDTH, -1) + , _ = n._getNumber(h, t.DataParser.FRAME_HEIGHT, -1); + u > 0 && _ > 0 && (c.frame = t.TextureData.createRectangle(), + c.frame.x = n._getNumber(h, t.DataParser.FRAME_X, 0), + c.frame.y = n._getNumber(h, t.DataParser.FRAME_Y, 0), + c.frame.width = u, + c.frame.height = _), + i.addTexture(c) + } + return !0 + } + , + n.getInstance = function() { + return null === n._objectDataParserInstance && (n._objectDataParserInstance = new n), + n._objectDataParserInstance + } + , + n._objectDataParserInstance = null, + n + } + )(t.DataParser); + t.ObjectDataParser = e; + var i = function() { + this.frameStart = 0, + this.actions = [] + }; + t.ActionFrame = i + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i() { + return null !== e && e.apply(this, arguments) || this + } + return s(i, e), + i.prototype._inRange = function(t, e, i) { + return e <= t && t <= i + } + , + i.prototype._decodeUTF8 = function(t) { + for (var e, i = 0, n = "", r = 0, s = 0, a = 0, o = 0; t.length > i; ) { + var l = t[i++]; + if (-1 === l) + e = 0 !== s ? 65533 : -1; + else if (0 === s) + this._inRange(l, 0, 127) ? e = l : (this._inRange(l, 194, 223) ? (s = 1, + o = 128, + r = l - 192) : this._inRange(l, 224, 239) ? (s = 2, + o = 2048, + r = l - 224) : this._inRange(l, 240, 244) && (s = 3, + o = 65536, + r = l - 240), + r *= Math.pow(64, s), + e = null); + else if (this._inRange(l, 128, 191)) + if (a += 1, + r += (l - 128) * Math.pow(64, s - a), + a !== s) + e = null; + else { + var h = r + , c = o; + r = 0, + s = 0, + a = 0, + o = 0, + e = this._inRange(h, c, 1114111) && !this._inRange(h, 55296, 57343) ? h : l + } + else + r = 0, + s = 0, + a = 0, + o = 0, + i--, + e = l; + null !== e && -1 !== e && (e <= 65535 ? e > 0 && (n += String.fromCharCode(e)) : (e -= 65536, + n += String.fromCharCode(55296 + (e >> 10 & 1023)), + n += String.fromCharCode(56320 + (1023 & e)))) + } + return n + } + , + i.prototype._getUTF16Key = function(t) { + for (var e = 0, i = t.length; e < i; ++e) + if (t.charCodeAt(e) > 255) + return encodeURI(t); + return t + } + , + i.prototype._parseBinaryTimeline = function(e, i, n) { + void 0 === n && (n = null); + var r = null !== n ? n : t.BaseObject.borrowObject(t.TimelineData); + r.type = e, + r.offset = i, + this._timeline = r; + var s = this._timelineArrayBuffer[r.offset + 2]; + if (1 === s) + r.frameIndicesOffset = -1; + else { + var a = 0 + , o = this._animation.frameCount + 1 + , l = this._data.frameIndices; + t.DragonBones.webAssembly ? (a = l.size(), + l.resize(a + o, 0)) : (a = l.length, + l.length += o), + r.frameIndicesOffset = a; + for (var h = 0, c = 0, u = 0, _ = 0; h < o; ++h) + u + _ <= h && c < s && (u = this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[r.offset + 5 + c]], + _ = c === s - 1 ? this._animation.frameCount - u : this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[r.offset + 5 + c + 1]] - u, + c++), + t.DragonBones.webAssembly ? l.set(a + h, c - 1) : l[a + h] = c - 1 + } + return this._timeline = null, + r + } + , + i.prototype._parseVertices = function(e, i) { + i.offset = e[t.DataParser.OFFSET]; + var n = this._intArrayBuffer[i.offset + 3]; + if (n >= 0) { + var r = t.BaseObject.borrowObject(t.WeightData) + , s = this._intArrayBuffer[i.offset + 0] + , a = this._intArrayBuffer[n + 0]; + r.offset = n; + for (var o = 0; o < a; ++o) { + var l = this._intArrayBuffer[n + 2 + o]; + r.addBone(this._rawBones[l]) + } + for (var h = n + 2 + a, c = 0, u = (o = 0, + s); o < u; ++o) { + var _ = this._intArrayBuffer[h++]; + c += _, + h += _ + } + r.count = c, + i.weight = r + } + } + , + i.prototype._parseMesh = function(t, e) { + this._parseVertices(t, e.vertices) + } + , + i.prototype._parsePath = function(t, e) { + this._parseVertices(t, e.vertices) + } + , + i.prototype._parseAnimation = function(e) { + var i = t.BaseObject.borrowObject(t.AnimationData); + i.frameCount = Math.max(t.ObjectDataParser._getNumber(e, t.DataParser.DURATION, 1), 1), + i.playTimes = t.ObjectDataParser._getNumber(e, t.DataParser.PLAY_TIMES, 1), + i.duration = i.frameCount / this._armature.frameRate, + i.fadeInTime = t.ObjectDataParser._getNumber(e, t.DataParser.FADE_IN_TIME, 0), + i.scale = t.ObjectDataParser._getNumber(e, t.DataParser.SCALE, 1), + i.name = t.ObjectDataParser._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME), + 0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME); + var n = e[t.DataParser.OFFSET]; + if (i.frameIntOffset = n[0], + i.frameFloatOffset = n[1], + i.frameOffset = n[2], + this._animation = i, + t.DataParser.ACTION in e && (i.actionTimeline = this._parseBinaryTimeline(0, e[t.DataParser.ACTION])), + t.DataParser.Z_ORDER in e && (i.zOrderTimeline = this._parseBinaryTimeline(1, e[t.DataParser.Z_ORDER])), + t.DataParser.BONE in e) { + var r = e[t.DataParser.BONE]; + for (var s in r) { + var a = r[s]; + t.DragonBones.webAssembly && (s = this._getUTF16Key(s)); + var o = this._armature.getBone(s); + if (null !== o) + for (var l = 0, h = a.length; l < h; l += 2) { + var c = a[l] + , u = a[l + 1] + , _ = this._parseBinaryTimeline(c, u); + this._animation.addBoneTimeline(o, _) + } + } + } + if (t.DataParser.SURFACE in e) + for (var s in r = e[t.DataParser.SURFACE]) { + a = r[s], + t.DragonBones.webAssembly && (s = this._getUTF16Key(s)); + var f = this._armature.getBone(s); + if (null !== f) + for (l = 0, + h = a.length; l < h; l += 2) + c = a[l], + u = a[l + 1], + _ = this._parseBinaryTimeline(c, u), + this._animation.addSurfaceTimeline(f, _) + } + if (t.DataParser.SLOT in e) + for (var s in r = e[t.DataParser.SLOT]) { + a = r[s], + t.DragonBones.webAssembly && (s = this._getUTF16Key(s)); + var d = this._armature.getSlot(s); + if (null !== d) + for (l = 0, + h = a.length; l < h; l += 2) + c = a[l], + u = a[l + 1], + _ = this._parseBinaryTimeline(c, u), + this._animation.addSlotTimeline(d, _) + } + if (t.DataParser.CONSTRAINT in e) + for (var s in r = e[t.DataParser.CONSTRAINT]) { + a = r[s], + t.DragonBones.webAssembly && (s = this._getUTF16Key(s)); + var p = this._armature.getConstraint(s); + if (null !== p) + for (l = 0, + h = a.length; l < h; l += 2) + c = a[l], + u = a[l + 1], + _ = this._parseBinaryTimeline(c, u), + this._animation.addConstraintTimeline(p, _) + } + if (t.DataParser.ANIMATION in e) + for (var s in r = e[t.DataParser.ANIMATION]) + for (a = r[s], + t.DragonBones.webAssembly && (s = this._getUTF16Key(s)), + l = 0, + h = a.length; l < h; l += 2) + c = a[l], + u = a[l + 1], + _ = this._parseBinaryTimeline(c, u), + this._animation.addAnimationTimeline(s, _); + return this._animation = null, + i + } + , + i.prototype._parseArray = function(e) { + var i = e[t.DataParser.OFFSET] + , n = i[1] + , r = i[3] + , s = i[5] + , a = i[7] + , o = i[9] + , l = i[11] + , h = new Int16Array(this._binary,this._binaryOffset + i[0],n / Int16Array.BYTES_PER_ELEMENT) + , c = new Float32Array(this._binary,this._binaryOffset + i[2],r / Float32Array.BYTES_PER_ELEMENT) + , u = new Int16Array(this._binary,this._binaryOffset + i[4],s / Int16Array.BYTES_PER_ELEMENT) + , _ = new Float32Array(this._binary,this._binaryOffset + i[6],a / Float32Array.BYTES_PER_ELEMENT) + , f = new Int16Array(this._binary,this._binaryOffset + i[8],o / Int16Array.BYTES_PER_ELEMENT) + , d = new Uint16Array(this._binary,this._binaryOffset + i[10],l / Uint16Array.BYTES_PER_ELEMENT); + if (t.DragonBones.webAssembly) { + for (var p = n + r + s + a + o + l, m = t.webAssemblyModule._malloc(p), y = new Uint8Array(this._binary,this._binaryOffset,p / Uint8Array.BYTES_PER_ELEMENT), v = new Uint8Array(t.webAssemblyModule.HEAP16.buffer,m,y.length), g = 0, A = y.length; g < A; ++g) + v[g] = y[g]; + t.webAssemblyModule.setDataBinary(this._data, m, n, r, s, a, o, l), + this._intArrayBuffer = h, + this._floatArrayBuffer = c, + this._frameIntArrayBuffer = u, + this._frameFloatArrayBuffer = _, + this._frameArrayBuffer = f, + this._timelineArrayBuffer = d + } else + this._data.binary = this._binary, + this._data.intArray = this._intArrayBuffer = h, + this._data.floatArray = this._floatArrayBuffer = c, + this._data.frameIntArray = this._frameIntArrayBuffer = u, + this._data.frameFloatArray = this._frameFloatArrayBuffer = _, + this._data.frameArray = this._frameArrayBuffer = f, + this._data.timelineArray = this._timelineArrayBuffer = d + } + , + i.prototype.parseDragonBonesData = function(t, i) { + void 0 === i && (i = 1), + console.assert(null != t && t instanceof ArrayBuffer, "Data error."); + var n = new Uint8Array(t,0,8); + if (n[0] !== "D".charCodeAt(0) || n[1] !== "B".charCodeAt(0) || n[2] !== "D".charCodeAt(0) || n[3] !== "T".charCodeAt(0)) + return console.assert(!1, "Nonsupport data."), + null; + var r = new Uint32Array(t,8,1)[0] + , s = new Uint8Array(t,12,r) + , a = this._decodeUTF8(s) + , o = JSON.parse(a); + return this._binaryOffset = 12 + r, + this._binary = t, + e.prototype.parseDragonBonesData.call(this, o, i) + } + , + i.getInstance = function() { + return null === i._binaryDataParserInstance && (i._binaryDataParserInstance = new i), + i._binaryDataParserInstance + } + , + i._binaryDataParserInstance = null, + i + } + )(t.ObjectDataParser); + t.BinaryDataParser = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(i) { + void 0 === i && (i = null), + this.autoSearch = !1, + this._dragonBonesDataMap = {}, + this._textureAtlasDataMap = {}, + this._dragonBones = null, + this._dataParser = null, + null === e._objectParser && (e._objectParser = new t.ObjectDataParser), + null === e._binaryParser && (e._binaryParser = new t.BinaryDataParser), + this._dataParser = null !== i ? i : e._objectParser + } + return e.prototype._isSupportMesh = function() { + return !0 + } + , + e.prototype._getTextureData = function(t, e) { + if (t in this._textureAtlasDataMap) + for (var i = 0, n = this._textureAtlasDataMap[t]; i < n.length; i++) + if (null !== (l = (o = n[i]).getTexture(e))) + return l; + if (this.autoSearch) + for (var r in this._textureAtlasDataMap) + for (var s = 0, a = this._textureAtlasDataMap[r]; s < a.length; s++) { + var o, l; + if ((o = a[s]).autoSearch && null !== (l = o.getTexture(e))) + return l + } + return null + } + , + e.prototype._fillBuildArmaturePackage = function(t, e, i, n, r) { + var s = null + , a = null; + if (e.length > 0 && e in this._dragonBonesDataMap && (a = (s = this._dragonBonesDataMap[e]).getArmature(i)), + null === a && (0 === e.length || this.autoSearch)) + for (var o in this._dragonBonesDataMap) + if (s = this._dragonBonesDataMap[o], + (0 === e.length || s.autoSearch) && null !== (a = s.getArmature(i))) { + e = o; + break + } + if (null !== a) { + if (t.dataName = e, + t.textureAtlasName = r, + t.data = s, + t.armature = a, + t.skin = null, + n.length > 0 && (t.skin = a.getSkin(n), + null === t.skin && this.autoSearch)) + for (var o in this._dragonBonesDataMap) { + var l = this._dragonBonesDataMap[o].getArmature(n); + if (null !== l) { + t.skin = l.defaultSkin; + break + } + } + return null === t.skin && (t.skin = a.defaultSkin), + !0 + } + return !1 + } + , + e.prototype._buildBones = function(e, i) { + for (var n = 0, r = e.armature.sortedBones; n < r.length; n++) { + var s = r[n]; + t.BaseObject.borrowObject(0 === s.type ? t.Bone : t.Surface).init(s, i) + } + } + , + e.prototype._buildSlots = function(e, i) { + var n = e.skin + , r = e.armature.defaultSkin; + if (null !== n && null !== r) { + var s = {}; + for (var a in r.displays) { + var o = r.getDisplays(a); + s[a] = o + } + if (n !== r) + for (var a in n.displays) + o = n.getDisplays(a), + s[a] = o; + for (var l = 0, h = e.armature.sortedSlots; l < h.length; l++) { + var c = h[l] + , u = c.name in s ? s[c.name] : null + , _ = this._buildSlot(e, c, i); + if (_.rawDisplayDatas = u, + null !== u) { + for (var f = new Array, d = 0, p = t.DragonBones.webAssembly ? u.size() : u.length; d < p; ++d) { + var m = t.DragonBones.webAssembly ? u.get(d) : u[d]; + null !== m ? f.push(this._getSlotDisplay(e, m, null, _)) : f.push(null) + } + _._setDisplayList(f) + } + _._setDisplayIndex(c.displayIndex, !0) + } + } + } + , + e.prototype._buildConstraints = function(e, i) { + var n = e.armature.constraints; + for (var r in n) { + var s = n[r]; + switch (s.type) { + case 0: + var a = t.BaseObject.borrowObject(t.IKConstraint); + a.init(s, i), + i._addConstraint(a); + break; + case 1: + var o = t.BaseObject.borrowObject(t.PathConstraint); + o.init(s, i), + i._addConstraint(o); + break; + default: + var l = t.BaseObject.borrowObject(t.IKConstraint); + l.init(s, i), + i._addConstraint(l) + } + } + } + , + e.prototype._buildChildArmature = function(t, e, i) { + return this.buildArmature(i.path, null !== t ? t.dataName : "", "", null !== t ? t.textureAtlasName : "") + } + , + e.prototype._getSlotDisplay = function(e, i, n, r) { + var s = null !== e ? e.dataName : i.parent.parent.parent.name + , a = null; + switch (i.type) { + case 0: + var o = i; + null !== e && e.textureAtlasName.length > 0 && (o.texture = this._getTextureData(e.textureAtlasName, i.path)), + null === o.texture && (o.texture = this._getTextureData(s, i.path)), + a = null !== n && 2 === n.type && this._isSupportMesh() ? r.meshDisplay : r.rawDisplay; + break; + case 2: + var l = i; + null !== e && e.textureAtlasName.length > 0 && (l.texture = this._getTextureData(e.textureAtlasName, l.path)), + null === l.texture && (l.texture = this._getTextureData(s, l.path)), + a = this._isSupportMesh() ? r.meshDisplay : r.rawDisplay; + break; + case 1: + var h = i + , c = this._buildChildArmature(e, r, i); + if (null !== c) { + if (c.inheritAnimation = h.inheritAnimation, + !c.inheritAnimation) { + var u = h.actions.length > 0 ? h.actions : c.armatureData.defaultActions; + if (u.length > 0) + for (var _ = 0, f = u; _ < f.length; _++) { + var d = f[_] + , p = t.BaseObject.borrowObject(t.EventObject); + t.EventObject.actionDataToInstance(d, p, r.armature), + p.slot = r, + r.armature._bufferAction(p, !1) + } + else + c.animation.play() + } + h.armature = c.armatureData + } + a = c + } + return a + } + , + e.prototype.parseDragonBonesData = function(t, i, n) { + void 0 === i && (i = null), + void 0 === n && (n = 1); + for (var r = t instanceof ArrayBuffer ? e._binaryParser : this._dataParser, s = r.parseDragonBonesData(t, n); ; ) { + var a = this._buildTextureAtlasData(null, null); + if (!r.parseTextureAtlasData(null, a, n)) { + a.returnToPool(); + break + } + this.addTextureAtlasData(a, i) + } + return null !== s && this.addDragonBonesData(s, i), + s + } + , + e.prototype.parseTextureAtlasData = function(t, e, i, n) { + void 0 === i && (i = null), + void 0 === n && (n = 1); + var r = this._buildTextureAtlasData(null, null); + return this._dataParser.parseTextureAtlasData(t, r, n), + this._buildTextureAtlasData(r, e || null), + this.addTextureAtlasData(r, i), + r + } + , + e.prototype.updateTextureAtlasData = function(t, e) { + var i = this.getTextureAtlasData(t); + if (null !== i) + for (var n = 0, r = i.length; n < r; ++n) + n < e.length && this._buildTextureAtlasData(i[n], e[n]) + } + , + e.prototype.getDragonBonesData = function(t) { + return t in this._dragonBonesDataMap ? this._dragonBonesDataMap[t] : null + } + , + e.prototype.addDragonBonesData = function(t, e) { + if (void 0 === e && (e = null), + (e = null !== e ? e : t.name)in this._dragonBonesDataMap) { + if (this._dragonBonesDataMap[e] === t) + return; + console.warn("Can not add same name data: " + e) + } else + this._dragonBonesDataMap[e] = t + } + , + e.prototype.removeDragonBonesData = function(t, e) { + void 0 === e && (e = !0), + t in this._dragonBonesDataMap && (e && this._dragonBones.bufferObject(this._dragonBonesDataMap[t]), + delete this._dragonBonesDataMap[t]) + } + , + e.prototype.getTextureAtlasData = function(t) { + return t in this._textureAtlasDataMap ? this._textureAtlasDataMap[t] : null + } + , + e.prototype.addTextureAtlasData = function(t, e) { + void 0 === e && (e = null); + var i = (e = null !== e ? e : t.name)in this._textureAtlasDataMap ? this._textureAtlasDataMap[e] : this._textureAtlasDataMap[e] = []; + i.indexOf(t) < 0 && i.push(t) + } + , + e.prototype.removeTextureAtlasData = function(t, e) { + if (void 0 === e && (e = !0), + t in this._textureAtlasDataMap) { + var i = this._textureAtlasDataMap[t]; + if (e) + for (var n = 0, r = i; n < r.length; n++) { + var s = r[n]; + this._dragonBones.bufferObject(s) + } + delete this._textureAtlasDataMap[t] + } + } + , + e.prototype.getArmatureData = function(t, e) { + void 0 === e && (e = ""); + var n = new i; + return this._fillBuildArmaturePackage(n, e, t, "", "") ? n.armature : null + } + , + e.prototype.clear = function(t) { + for (var e in void 0 === t && (t = !0), + this._dragonBonesDataMap) + t && this._dragonBones.bufferObject(this._dragonBonesDataMap[e]), + delete this._dragonBonesDataMap[e]; + for (var e in this._textureAtlasDataMap) { + if (t) + for (var i = 0, n = this._textureAtlasDataMap[e]; i < n.length; i++) { + var r = n[i]; + this._dragonBones.bufferObject(r) + } + delete this._textureAtlasDataMap[e] + } + } + , + e.prototype.buildArmature = function(t, e, n, r) { + void 0 === e && (e = ""), + void 0 === n && (n = ""), + void 0 === r && (r = ""); + var s = new i; + if (!this._fillBuildArmaturePackage(s, e || "", t, n || "", r || "")) + return console.warn("No armature data: " + t + ", " + (null !== e ? e : "")), + null; + var a = this._buildArmature(s); + return this._buildBones(s, a), + this._buildSlots(s, a), + this._buildConstraints(s, a), + a.invalidUpdate(null, !0), + a.advanceTime(0), + a + } + , + e.prototype.replaceDisplay = function(e, i, n) { + void 0 === n && (n = -1), + n < 0 && (n = e.displayIndex), + n < 0 && (n = 0), + e.replaceDisplayData(i, n); + var r = e.displayList; + if (r.length <= n) { + r.length = n + 1; + for (var s = 0, a = r.length; s < a; ++s) + r[s] || (r[s] = null) + } + if (null !== i) { + var o = e.rawDisplayDatas + , l = null; + o && (t.DragonBones.webAssembly ? n < o.size() && (l = o.get(n)) : n < o.length && (l = o[n])), + r[n] = this._getSlotDisplay(null, i, l, e) + } else + r[n] = null; + e.displayList = r + } + , + e.prototype.replaceSlotDisplay = function(t, e, i, n, r, s) { + void 0 === s && (s = -1); + var a = this.getArmatureData(e, t || ""); + if (!a || !a.defaultSkin) + return !1; + var o = a.defaultSkin.getDisplay(i, n); + return !!o && (this.replaceDisplay(r, o, s), + !0) + } + , + e.prototype.replaceSlotDisplayList = function(e, i, n, r) { + var s = this.getArmatureData(i, e || ""); + if (!s || !s.defaultSkin) + return !1; + var a = s.defaultSkin.getDisplays(n); + if (!a) + return !1; + for (var o = 0, l = 0, h = t.DragonBones.webAssembly ? a.size() : a.length; l < h; ++l) { + var c = t.DragonBones.webAssembly ? a.get(l) : a[l]; + this.replaceDisplay(r, c, o++) + } + return !0 + } + , + e.prototype.replaceSkin = function(e, i, n, r) { + void 0 === n && (n = !1), + void 0 === r && (r = null); + for (var s = !1, a = i.parent.defaultSkin, o = 0, l = e.getSlots(); o < l.length; o++) { + var h = l[o]; + if (!(null !== r && r.indexOf(h.name) >= 0)) { + var c = i.getDisplays(h.name); + if (c || (null !== a && i !== a && (c = a.getDisplays(h.name)), + c)) { + var u = t.DragonBones.webAssembly ? c.size() : c.length + , _ = h.displayList; + _.length = u; + for (var f = 0, d = u; f < d; ++f) { + var p = t.DragonBones.webAssembly ? c.get(f) : c[f]; + _[f] = null !== p ? this._getSlotDisplay(null, p, null, h) : null + } + s = !0, + h.rawDisplayDatas = c, + h.displayList = _ + } else + n && (h.rawDisplayDatas = null, + h.displayList = []) + } + } + return s + } + , + e.prototype.replaceAnimation = function(e, i, n) { + void 0 === n && (n = !0); + var r = i.defaultSkin; + if (null === r) + return !1; + if (n) + e.animation.animations = i.animations; + else { + var s = e.animation.animations + , a = {}; + for (var o in s) + a[o] = s[o]; + for (var o in i.animations) + a[o] = i.animations[o]; + e.animation.animations = a + } + for (var l = 0, h = e.getSlots(); l < h.length; l++) + for (var c = h[l], u = 0, _ = 0, f = c.displayList; _ < f.length; _++) { + var d = f[_]; + if (d instanceof t.Armature) { + var p = r.getDisplays(c.name); + if (null !== p && u < (t.DragonBones.webAssembly ? p.size() : p.length)) { + var m = t.DragonBones.webAssembly ? p.get(u) : p[u]; + if (null !== m && 1 === m.type) { + var y = this.getArmatureData(m.path, m.parent.parent.parent.name); + y && this.replaceAnimation(d, y, n) + } + } + } + u++ + } + return !0 + } + , + e.prototype.getAllDragonBonesData = function() { + return this._dragonBonesDataMap + } + , + e.prototype.getAllTextureAtlasData = function() { + return this._textureAtlasDataMap + } + , + Object.defineProperty(e.prototype, "clock", { + get: function() { + return this._dragonBones.clock + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(e.prototype, "dragonBones", { + get: function() { + return this._dragonBones + }, + enumerable: !0, + configurable: !0 + }), + e.prototype.changeSkin = function(t, e, i) { + return void 0 === i && (i = null), + this.replaceSkin(t, e, !1, i) + } + , + e.prototype.copyAnimationsToArmature = function(t, e, i, n, r) { + void 0 === i && (i = ""), + void 0 === n && (n = ""), + void 0 === r && (r = !0); + var s = this.getArmatureData(e, n); + return !!s && this.replaceAnimation(t, s, r) + } + , + e._objectParser = null, + e._binaryParser = null, + e + } + )(); + t.BaseFactory = e; + var i = function() { + this.dataName = "", + this.textureAtlasName = "", + this.skin = null + }; + t.BuildArmaturePackage = i + } + )(r || (r = {})), + e.exports = r + } + ), {}], + 366: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n = s(t("../../cocos2d/core/renderer/assembler")) + , r = s(t("../../cocos2d/core/value-types/mat4")); + function s(t) { + return t && t.__esModule ? t : { + default: t + } + } + function a(t, e) { + return (a = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var o, l, h, c, u, _, f, d, p, m, y, v, g, A, x, b, C, T, S, w, E, M, D, B, I, P, R, O, L, F, V = t("./ArmatureDisplay"), N = t("../../cocos2d/core/renderer/render-flow"), k = cc.gfx, G = cc.color(255, 0, 0, 255), U = cc.color(0, 0, 255, 255), z = cc.color(0, 255, 0, 255); + function H(t, e) { + if (!t) + return null; + var i, n; + switch (e) { + case 1: + i = u ? cc.macro.ONE : cc.macro.SRC_ALPHA, + n = cc.macro.ONE; + break; + case 10: + i = cc.macro.DST_COLOR, + n = cc.macro.ONE_MINUS_SRC_ALPHA; + break; + case 12: + i = cc.macro.ONE, + n = cc.macro.ONE_MINUS_SRC_COLOR; + break; + case 0: + default: + i = u ? cc.macro.ONE : cc.macro.SRC_ALPHA, + n = cc.macro.ONE_MINUS_SRC_ALPHA + } + var r = !y.enableBatch + , s = y._materials[0]; + if (!s) + return null; + var a = y._materialCache + , o = t.getId() + i + n + r + , l = a[o]; + return l || (a.baseMaterial ? l = cc.MaterialVariant.create(s) : (l = s, + a.baseMaterial = s), + l.define("CC_USE_MODEL", r), + l.setProperty("texture", t), + l.setBlend(!0, k.BLEND_FUNC_ADD, i, n, k.BLEND_FUNC_ADD, i, n), + a[o] = l), + l + } + function W(t, e) { + D = t.a * e * c, + _ = u ? D / 255 : 1, + w = t.r * o * _, + E = t.g * l * _, + M = t.b * h * _, + S = (D << 24 >>> 0) + (M << 16) + (E << 8) + w + } + var j = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + a(e, i); + var s = n.prototype; + return s.updateRenderData = function() {} + , + s.realTimeTraverse = function(t, e, i) { + for (var n, s, a, o, l, h, c, u, _, y, w = t._slots, E = 0, M = w.length; E < M; E++) + if (c = (u = w[E])._color, + u._visible && u._displayData) + if (e ? u._mulMat(u._worldMatrix, e, u._matrix) : r.default.copy(u._worldMatrix, u._matrix), + u.childArmature) + this.realTimeTraverse(u.childArmature, u._worldMatrix, i * c.a / 255); + else if (o = H(u.getTexture(), u._blendMode)) { + (f || o.getHash() !== m.material.getHash()) && (f = !1, + m._flush(), + m.node = p, + m.material = o), + W(c, i), + _ = u._worldMatrix.m, + l = u._localVertices, + x = l.length >> 2, + h = u._indices, + b = h.length, + y = d.request(x, b), + g = y.indiceOffset, + v = y.byteOffset >> 2, + A = y.vertexOffset, + n = d._vData, + s = d._iData, + a = d._uintVData, + I = _[0], + P = _[4], + R = _[12], + O = _[1], + L = _[5], + F = _[13]; + for (var D = 0, B = l.length; D < B; ) + C = l[D++], + T = l[D++], + n[v++] = C * I + T * P + R, + n[v++] = C * O + T * L + F, + n[v++] = l[D++], + n[v++] = l[D++], + a[v++] = S; + for (var V = 0, N = h.length; V < N; V++) + s[g++] = A + h[V] + } + } + , + s.cacheTraverse = function(t, e) { + if (t) { + var i = t.segments; + if (0 != i.length) { + var n, r, s, a, o, l = t.vertices, h = t.indices, c = 0, u = 0, _ = 0; + if (e) { + var y = e.m; + I = y[0], + O = y[1], + P = y[4], + L = y[5], + R = y[12], + F = y[13] + } + var w = 16 & B + , E = w && 1 === I && 0 === O && 0 === P && 1 === L + , M = 0 + , D = t.colors + , V = D[M++] + , N = V.vfOffset; + W(V, 1); + for (var k = 0, G = i.length; k < G; k++) { + var U = i[k]; + a = H(U.tex, U.blendMode), + (f || a.getHash() !== m.material.getHash()) && (f = !1, + m._flush(), + m.node = p, + m.material = a), + x = U.vertexCount, + b = U.indexCount, + o = d.request(x, b), + g = o.indiceOffset, + A = o.vertexOffset, + v = o.byteOffset >> 2, + n = d._vData, + r = d._iData, + s = d._uintVData; + for (var z = g, j = g + b; z < j; z++) + r[z] = A + h[u++]; + if (_ = U.vfCount, + n.set(l.subarray(c, c + _), v), + c += _, + E) + for (var X = v, Y = v + _; X < Y; X += 5) + n[X] += R, + n[X + 1] += F; + else if (w) + for (var q = v, J = v + _; q < J; q += 5) + C = n[q], + T = n[q + 1], + n[q] = C * I + T * P + R, + n[q + 1] = C * O + T * L + F; + if (1 & B) + for (var Z = c - _, K = v + 4, Q = v + 4 + _; K < Q; K += 5, + Z += 5) + Z >= N && (W(V = D[M++], 1), + N = V.vfOffset), + s[K] = S + } + } + } + } + , + s.fillBuffers = function(t, e) { + t.node._renderFlag |= N.FLAG_UPDATE_RENDER_DATA; + var i = t._armature; + if (i) { + f = !0, + u = t.premultipliedAlpha, + p = t.node, + d = e._meshBuffer, + m = e, + y = t, + B = 0; + var n = p._color; + o = n.r / 255, + l = n.g / 255, + h = n.b / 255, + c = n.a / 255, + 4294967295 !== n._val && (B |= 1); + var r = void 0; + if (y.enableBatch && (r = p._worldMatrix, + f = !1, + B |= 16), + t.isAnimationCached()) + this.cacheTraverse(t._curFrame, r); + else { + this.realTimeTraverse(i, r, 1); + var s = t._debugDraw; + if (t.debugBones && s) { + s.clear(), + s.lineWidth = 5, + s.strokeColor = G, + s.fillColor = U; + for (var a = i.getBones(), _ = 0, v = a.length; _ < v; _++) { + var g = a[_] + , A = Math.max(g.boneData.length, 5) + , x = g.globalTransformMatrix.tx + , b = g.globalTransformMatrix.ty + , C = x + g.globalTransformMatrix.a * A + , T = b + g.globalTransformMatrix.b * A; + s.moveTo(x, b), + s.lineTo(C, T), + s.stroke(), + s.circle(x, b, 2 * Math.PI), + s.fill(), + 0 === _ && (s.fillColor = z) + } + } + } + e.worldMatDirty++, + t.attachUtil._syncAttachedNode(), + p = void 0, + d = void 0, + m = void 0, + y = void 0 + } + } + , + s.postFillBuffers = function(t, e) { + e.worldMatDirty-- + } + , + n + } + )(n.default); + i.default = j, + n.default.register(V, j), + e.exports = i.default + } + ), { + "../../cocos2d/core/renderer/assembler": 221, + "../../cocos2d/core/renderer/render-flow": 225, + "../../cocos2d/core/value-types/mat4": 284, + "./ArmatureDisplay": 356 + }], + 367: [(function(t, e) { + "use strict"; + var i, n = (i = t("../../cocos2d/core/value-types/mat4")) && i.__esModule ? i : { + default: i + }, r = t("../../cocos2d/core/renderer/render-flow").FLAG_TRANSFORM, s = function() {}, a = function(t) { + Object.defineProperty(t, "_worldMatDirty", { + get: function() { + return !0 + }, + set: function() {} + }), + t._calculWorldMatrix = s, + t._mulMat = s + }, o = new n.default, l = cc.Class({ + name: "sp.AttachUtil", + ctor: function() { + this._inited = !1, + this._skeleton = null, + this._skeletonNode = null, + this._skeletonComp = null, + this._attachedRootNode = null, + this._attachedNodeArray = [], + this._boneIndexToNode = {} + }, + init: function(t) { + this._inited = !0, + this._skeleton = t._skeleton, + this._skeletonNode = t.node, + this._skeletonComp = t + }, + reset: function() { + this._inited = !1, + this._skeleton = null, + this._skeletonNode = null, + this._skeletonComp = null + }, + _prepareAttachNode: function() { + if (this._skeleton) { + var t = this._skeletonNode.getChildByName("ATTACHED_NODE_TREE"); + return t && t.isValid || (t = new cc.Node("ATTACHED_NODE_TREE"), + a(t), + this._skeletonNode.addChild(t)), + this._skeletonComp.isAnimationCached() && this._skeletonComp._frameCache && this._skeletonComp._frameCache.enableCacheAttachedInfo(), + this._attachedRootNode = t, + t + } + }, + _buildBoneAttachedNode: function(t, e) { + var i = "ATTACHED_NODE:" + t.data.name + , n = new cc.Node(i); + return this._buildBoneRelation(n, t, e), + n + }, + _buildBoneRelation: function(t, e, i) { + a(t), + t._bone = e, + t._boneIndex = i, + this._attachedNodeArray.push(t), + this._boneIndexToNode[i] = t + }, + getAttachedRootNode: function() { + return this._attachedRootNode + }, + getAttachedNodes: function(t) { + var e = this._attachedNodeArray + , i = []; + if (!this._inited) + return i; + for (var n = 0, r = e.length; n < r; n++) { + var s = e[n]; + s && s.isValid && s.name === "ATTACHED_NODE:" + t && i.push(s) + } + return i + }, + _rebuildNodeArray: function() { + for (var t = this._boneIndexToNode = {}, e = this._attachedNodeArray, i = this._attachedNodeArray = [], n = 0, r = e.length; n < r; n++) { + var s = e[n]; + s && s.isValid && !s._toRemove && (i.push(s), + t[s._boneIndex] = s) + } + }, + _sortNodeArray: function() { + this._attachedNodeArray.sort((function(t, e) { + return t._boneIndex < e._boneIndex ? -1 : 1 + } + )) + }, + _getNodeByBoneIndex: function(t) { + var e = this._boneIndexToNode[t]; + return e && e.isValid ? e : null + }, + destroyAttachedNodes: function(t) { + if (this._inited) { + for (var e = this._attachedNodeArray, i = function t(e) { + for (var i = e.children, n = 0, r = i.length; n < r; n++) { + var s = i[n]; + s && t(s) + } + e._toRemove = !0 + }, n = 0, r = e.length; n < r; n++) { + var s = e[n]; + s && s.isValid && s.name.split("ATTACHED_NODE:")[1] === t && (i(s), + s.removeFromParent(!0), + s.destroy(), + e[n] = null) + } + this._rebuildNodeArray() + } + }, + generateAttachedNodes: function(t) { + var e = []; + if (!this._inited) + return e; + var i = this._prepareAttachNode(); + if (!i) + return e; + for (var n = [], r = this._skeleton.bones, s = 0, a = r.length; s < a; s++) { + var o = r[s]; + o.data.name == t && n.push(o) + } + for (var l = function(t) { + if (t) { + var e = t.data + , n = this._getNodeByBoneIndex(e.index); + if (n) + return n; + n = this._buildBoneAttachedNode(t, e.index); + var r = l(t.parent) || i; + return n.parent = r, + n + } + } + .bind(this), h = 0, c = n.length; h < c; h++) { + var u = l(n[h]); + e.push(u) + } + return this._sortNodeArray(), + e + }, + destroyAllAttachedNodes: function() { + if (this._attachedRootNode = null, + this._attachedNodeArray.length = 0, + this._boneIndexToNode = {}, + this._inited) { + var t = this._skeletonNode.getChildByName("ATTACHED_NODE_TREE"); + t && (t.removeFromParent(!0), + t.destroy(), + t = null) + } + }, + generateAllAttachedNodes: function() { + if (this._inited) { + this._boneIndexToNode = {}, + this._attachedNodeArray.length = 0; + var t = this._prepareAttachNode(); + if (t) { + for (var e = this._skeleton.bones, i = 0, n = e.length; i < n; i++) { + var r = e[i] + , s = r.data + , a = null; + if (r.parent) { + var o = r.parent.data.index; + a = this._boneIndexToNode[o] + } else + a = t; + if (a) { + var l = a.getChildByName("ATTACHED_NODE:" + s.name); + l && l.isValid ? this._buildBoneRelation(l, r, s.index) : (l = this._buildBoneAttachedNode(r, s.index), + a.addChild(l)) + } + } + return t + } + } + }, + _hasAttachedNode: function() { + return !!this._inited && !!this._skeletonNode.getChildByName("ATTACHED_NODE_TREE") + }, + _associateAttachedNode: function() { + if (this._inited) { + var t = this._skeletonNode.getChildByName("ATTACHED_NODE_TREE"); + if (t && t.isValid) { + this._attachedRootNode = t, + this._boneIndexToNode = {}, + this._attachedNodeArray.length = 0, + a(t), + this._skeletonComp.isAnimationCached() && this._skeletonComp._frameCache && this._skeletonComp._frameCache.enableCacheAttachedInfo(); + for (var e = this._skeleton.bones, i = 0, n = e.length; i < n; i++) { + var r = e[i] + , s = r.data + , o = null; + if (r.parent) { + var l = r.parent.data.index; + o = this._boneIndexToNode[l] + } else + o = t; + if (o) { + var h = o.getChildByName("ATTACHED_NODE:" + s.name); + h && h.isValid && this._buildBoneRelation(h, r, s.index) + } + } + } + } + }, + _syncAttachedNode: function() { + if (this._inited) { + var t = this._attachedRootNode + , e = this._attachedNodeArray; + if (!t || !t.isValid) + return this._attachedRootNode = null, + void (e.length = 0); + var i = this._skeletonNode._worldMatrix; + n.default.copy(t._worldMatrix, i), + t._renderFlag &= ~r; + var s; + if (s = this._skeletonComp.isAnimationCached() ? this._skeletonComp._curFrame && this._skeletonComp._curFrame.boneInfos : this._skeleton.bones) { + for (var a = this._skeletonNode._mulMat, l = function(t, e, i) { + var n = o.m; + n[0] = i.a, + n[1] = i.c, + n[4] = i.b, + n[5] = i.d, + n[12] = i.worldX, + n[13] = i.worldY, + a(t, e, o) + }, h = !1, c = 0, u = e.length; c < u; c++) { + var _ = e[c]; + if (_ && _.isValid) { + var f = s[_._boneIndex]; + f ? (l(_._worldMatrix, t._worldMatrix, f), + _._renderFlag &= ~r) : (_.removeFromParent(!0), + _.destroy(), + e[c] = null, + h = !0) + } else + e[c] = null, + h = !0 + } + h && this._rebuildNodeArray() + } + } + } + }); + e.exports = sp.AttachUtil = l + } + ), { + "../../cocos2d/core/renderer/render-flow": 225, + "../../cocos2d/core/value-types/mat4": 284 + }], + 368: [(function(t, e) { + "use strict"; + var i = t("./track-entry-listeners") + , n = t("../../cocos2d/core/components/CCRenderComponent") + , r = t("./lib/spine") + , s = t("../../cocos2d/core/graphics/graphics") + , a = t("../../cocos2d/core/renderer/render-flow").FLAG_POST_RENDER + , o = t("./skeleton-cache") + , l = t("./AttachUtil") + , h = cc.Enum({ + default: -1 + }) + , c = cc.Enum({ + "": 0 + }) + , u = cc.Enum({ + REALTIME: 0, + SHARED_CACHE: 1, + PRIVATE_CACHE: 2 + }); + sp.Skeleton = cc.Class({ + name: "sp.Skeleton", + extends: n, + editor: !1, + statics: { + AnimationCacheMode: u + }, + properties: { + paused: { + default: !1, + visible: !1 + }, + skeletonData: { + default: null, + type: sp.SkeletonData, + notify: function() { + this.defaultSkin = "", + this.defaultAnimation = "", + this._updateSkeletonData() + }, + tooltip: !1 + }, + defaultSkin: { + default: "", + visible: !1 + }, + defaultAnimation: { + default: "", + visible: !1 + }, + animation: { + get: function() { + if (this.isAnimationCached()) + return this._animationName; + var t = this.getCurrent(0); + return t && t.animation.name || "" + }, + set: function(t) { + this.defaultAnimation = t, + t ? this.setAnimation(0, t, this.loop) : this.isAnimationCached() || (this.clearTrack(0), + this.setToSetupPose()) + }, + visible: !1 + }, + _defaultSkinIndex: { + get: function() { + if (this.skeletonData) { + var t = this.skeletonData.getSkinsEnum(); + if (t) + if ("" === this.defaultSkin) { + if (t.hasOwnProperty(0)) + return this._defaultSkinIndex = 0, + 0 + } else { + var e = t[this.defaultSkin]; + if (void 0 !== e) + return e + } + } + return 0 + }, + set: function(t) { + var e; + if (this.skeletonData && (e = this.skeletonData.getSkinsEnum()), + !e) + return cc.errorID("", this.name); + var i = e[t]; + void 0 !== i ? (this.defaultSkin = i, + this.setSkin(this.defaultSkin)) : cc.errorID(7501, this.name) + }, + type: h, + visible: !0, + animatable: !1, + displayName: "Default Skin", + tooltip: !1 + }, + _animationIndex: { + get: function() { + var t = this.animation; + if (this.skeletonData && t) { + var e = this.skeletonData.getAnimsEnum(); + if (e) { + var i = e[t]; + if (void 0 !== i) + return i + } + } + return 0 + }, + set: function(t) { + if (0 !== t) { + var e; + if (this.skeletonData && (e = this.skeletonData.getAnimsEnum()), + !e) + return cc.errorID(7502, this.name); + var i = e[t]; + void 0 !== i ? this.animation = i : cc.errorID(7503, this.name) + } else + this.animation = "" + }, + type: c, + visible: !0, + animatable: !1, + displayName: "Animation", + tooltip: !1 + }, + _preCacheMode: -1, + _cacheMode: u.REALTIME, + _defaultCacheMode: { + default: 0, + type: u, + notify: function() { + this.setAnimationCacheMode(this._defaultCacheMode) + }, + editorOnly: !0, + visible: !0, + animatable: !1, + displayName: "Animation Cache Mode", + tooltip: !1 + }, + loop: { + default: !0, + tooltip: !1 + }, + premultipliedAlpha: { + default: !0, + tooltip: !1 + }, + timeScale: { + default: 1, + tooltip: !1 + }, + debugSlots: { + default: !1, + editorOnly: !0, + tooltip: !1, + notify: function() { + this._updateDebugDraw() + } + }, + debugBones: { + default: !1, + editorOnly: !0, + tooltip: !1, + notify: function() { + this._updateDebugDraw() + } + }, + debugMesh: { + default: !1, + editorOnly: !0, + tooltip: !1, + notify: function() { + this._updateDebugDraw() + } + }, + useTint: { + default: !1, + tooltip: !1, + notify: function() { + this._updateUseTint() + } + }, + enableBatch: { + default: !1, + notify: function() { + this._updateBatch() + }, + tooltip: !1 + }, + _accTime: 0, + _playCount: 0, + _frameCache: null, + _curFrame: null, + _skeletonCache: null, + _animationName: "", + _animationQueue: [], + _headAniInfo: null, + _playTimes: 0, + _isAniComplete: !0 + }, + ctor: function() { + this._effectDelegate = null, + this._skeleton = null, + this._rootBone = null, + this._listener = null, + this._materialCache = {}, + this._debugRenderer = null, + this._startSlotIndex = -1, + this._endSlotIndex = -1, + this._startEntry = { + animation: { + name: "" + }, + trackIndex: 0 + }, + this._endEntry = { + animation: { + name: "" + }, + trackIndex: 0 + }, + this.attachUtil = new l + }, + _getDefaultMaterial: function() { + return cc.Material.getBuiltinMaterial("2d-spine") + }, + _updateMaterial: function() { + var t = this.useTint || this.isAnimationCached() && !0 + , e = this.getMaterial(0); + if (e) { + e.define("USE_TINT", t), + e.define("CC_USE_MODEL", !this.enableBatch); + var i = this.premultipliedAlpha ? cc.gfx.BLEND_ONE : cc.gfx.BLEND_SRC_ALPHA + , n = cc.gfx.BLEND_ONE_MINUS_SRC_ALPHA; + e.setBlend(!0, cc.gfx.BLEND_FUNC_ADD, i, i, cc.gfx.BLEND_FUNC_ADD, n, n) + } + this._materialCache = {} + }, + disableRender: function() { + this._super(), + this.node._renderFlag &= ~a + }, + markForRender: function(t) { + this._super(t), + t ? this.node._renderFlag |= a : this.node._renderFlag &= ~a + }, + _updateUseTint: function() { + var t = this.getMaterial(0); + if (t) { + var e = this.useTint || this.isAnimationCached() && !0; + t.define("USE_TINT", e) + } + this._materialCache = {} + }, + _updateBatch: function() { + var t = this.getMaterial(0); + t && t.define("CC_USE_MODEL", !this.enableBatch), + this._materialCache = {} + }, + _validateRender: function() { + var t = this.skeletonData; + t && t.isTexturesLoaded() ? this._super() : this.disableRender() + }, + setSkeletonData: function(t) { + if (null != t.width && null != t.height && this.node.setContentSize(t.width, t.height), + this._cacheMode === u.SHARED_CACHE ? this._skeletonCache = o.sharedCache : this._cacheMode === u.PRIVATE_CACHE && (this._skeletonCache = new o, + this._skeletonCache.enablePrivateMode()), + this.isAnimationCached()) { + (this.debugBones || this.debugSlots) && cc.warn("Debug bones or slots is invalid in cached mode"); + var e = this._skeletonCache.getSkeletonCache(this.skeletonData._uuid, t); + this._skeleton = e.skeleton, + this._clipper = e.clipper, + this._rootBone = this._skeleton.getRootBone() + } else + this._skeleton = new r.Skeleton(t), + this._clipper = new r.SkeletonClipping, + this._rootBone = this._skeleton.getRootBone(); + this.markForRender(!0) + }, + setSlotsRange: function(t, e) { + this.isAnimationCached() ? cc.warn("Slots visible range can not be modified in cached mode.") : (this._startSlotIndex = t, + this._endSlotIndex = e) + }, + setAnimationStateData: function(t) { + if (this.isAnimationCached()) + cc.warn("'setAnimationStateData' interface can not be invoked in cached mode."); + else { + var e = new r.AnimationState(t); + this._listener && (this._state && this._state.removeListener(this._listener), + e.addListener(this._listener)), + this._state = e + } + }, + __preload: function() { + this._super(); + for (var t = this.node.children, e = 0, i = t.length; e < i; e++) { + var n = t[e]; + n && "DEBUG_DRAW_NODE" === n._name && n.destroy() + } + this._updateSkeletonData(), + this._updateDebugDraw(), + this._updateUseTint(), + this._updateBatch() + }, + setAnimationCacheMode: function(t) { + this._preCacheMode !== t && (this._cacheMode = t, + this._updateSkeletonData(), + this._updateUseTint()) + }, + isAnimationCached: function() { + return this._cacheMode !== u.REALTIME + }, + update: function(t) { + if (!this.paused) + if (t *= this.timeScale * sp.timeScale, + this.isAnimationCached()) { + if (this._isAniComplete) { + if (0 === this._animationQueue.length && !this._headAniInfo) { + var e = this._frameCache; + if (e && e.isInvalid()) { + e.updateToFrame(); + var i = e.frames; + this._curFrame = i[i.length - 1] + } + return + } + if (this._headAniInfo || (this._headAniInfo = this._animationQueue.shift()), + this._accTime += t, + this._accTime > this._headAniInfo.delay) { + var n = this._headAniInfo; + this._headAniInfo = null, + this.setAnimation(0, n.animationName, n.loop) + } + return + } + this._updateCache(t) + } else + this._updateRealtime(t) + }, + _emitCacheCompleteEvent: function() { + this._listener && (this._endEntry.animation.name = this._animationName, + this._listener.complete && this._listener.complete(this._endEntry), + this._listener.end && this._listener.end(this._endEntry)) + }, + _updateCache: function(t) { + var e = this._frameCache; + if (e.isInited()) { + var i = e.frames + , n = o.FrameTime; + 0 == this._accTime && 0 == this._playCount && (this._startEntry.animation.name = this._animationName, + this._listener && this._listener.start && this._listener.start(this._startEntry)), + this._accTime += t; + var r = Math.floor(this._accTime / n); + if (e.isCompleted || e.updateToFrame(r), + e.isCompleted && r >= i.length) { + if (this._playCount++, + this._playTimes > 0 && this._playCount >= this._playTimes) + return this._curFrame = i[i.length - 1], + this._accTime = 0, + this._playCount = 0, + this._isAniComplete = !0, + void this._emitCacheCompleteEvent(); + this._accTime = 0, + r = 0, + this._emitCacheCompleteEvent() + } + this._curFrame = i[r] + } + }, + _updateRealtime: function(t) { + var e = this._skeleton + , i = this._state; + e && (e.update(t), + i && (i.update(t), + i.apply(e))) + }, + setVertexEffectDelegate: function(t) { + this._effectDelegate = t + }, + updateWorldTransform: function() { + this.isAnimationCached() && this._skeleton && this._skeleton.updateWorldTransform() + }, + setToSetupPose: function() { + this._skeleton && this._skeleton.setToSetupPose() + }, + setBonesToSetupPose: function() { + this._skeleton && this._skeleton.setBonesToSetupPose() + }, + setSlotsToSetupPose: function() { + this._skeleton && this._skeleton.setSlotsToSetupPose() + }, + updateAnimationCache: function(t) { + if (this.isAnimationCached()) { + var e = this.skeletonData._uuid; + this._skeletonCache && this._skeletonCache.updateAnimationCache(e, t) + } + }, + invalidAnimationCache: function() { + this.isAnimationCached() && this._skeletonCache && this._skeletonCache.invalidAnimationCache(this.skeletonData._uuid) + }, + findBone: function(t) { + return this._skeleton ? this._skeleton.findBone(t) : null + }, + findSlot: function(t) { + return this._skeleton ? this._skeleton.findSlot(t) : null + }, + setSkin: function(t) { + this._skeleton && (this._skeleton.setSkinByName(t), + this._skeleton.setSlotsToSetupPose()), + this.invalidAnimationCache() + }, + getAttachment: function(t, e) { + return this._skeleton ? this._skeleton.getAttachmentByName(t, e) : null + }, + setAttachment: function(t, e) { + this._skeleton && this._skeleton.setAttachment(t, e), + this.invalidAnimationCache() + }, + getTextureAtlas: function(t) { + return t.region + }, + setMix: function(t, e, i) { + this._state && this._state.data.setMix(t, e, i) + }, + setAnimation: function(t, e, i) { + if (this._playTimes = i ? 0 : 1, + this._animationName = e, + this.isAnimationCached()) { + if (0 !== t && cc.warn("Track index can not greater than 0 in cached mode."), + !this._skeletonCache) + return null; + var n = this._skeletonCache.getAnimationCache(this.skeletonData._uuid, e); + n || (n = this._skeletonCache.initAnimationCache(this.skeletonData._uuid, e)), + n && (this._isAniComplete = !1, + this._accTime = 0, + this._playCount = 0, + this._frameCache = n, + this.attachUtil._hasAttachedNode() && this._frameCache.enableCacheAttachedInfo(), + this._frameCache.updateToFrame(0), + this._curFrame = this._frameCache.frames[0]) + } else if (this._skeleton) { + var r = this._skeleton.data.findAnimation(e); + if (!r) + return cc.logID(7509, e), + null; + var s = this._state.setAnimationWith(t, r, i); + return this._state.apply(this._skeleton), + s + } + return null + }, + addAnimation: function(t, e, i, n) { + if (n = n || 0, + this.isAnimationCached()) + 0 !== t && cc.warn("Track index can not greater than 0 in cached mode."), + this._animationQueue.push({ + animationName: e, + loop: i, + delay: n + }); + else if (this._skeleton) { + var r = this._skeleton.data.findAnimation(e); + return r ? this._state.addAnimationWith(t, r, i, n) : (cc.logID(7510, e), + null) + } + return null + }, + findAnimation: function(t) { + return this._skeleton ? this._skeleton.data.findAnimation(t) : null + }, + getCurrent: function(t) { + if (this.isAnimationCached()) + cc.warn("'getCurrent' interface can not be invoked in cached mode."); + else if (this._state) + return this._state.getCurrent(t); + return null + }, + clearTracks: function() { + this.isAnimationCached() ? cc.warn("'clearTracks' interface can not be invoked in cached mode.") : this._state && this._state.clearTracks() + }, + clearTrack: function(t) { + this.isAnimationCached() ? cc.warn("'clearTrack' interface can not be invoked in cached mode.") : this._state && this._state.clearTrack(t) + }, + setStartListener: function(t) { + this._ensureListener(), + this._listener.start = t + }, + setInterruptListener: function(t) { + this._ensureListener(), + this._listener.interrupt = t + }, + setEndListener: function(t) { + this._ensureListener(), + this._listener.end = t + }, + setDisposeListener: function(t) { + this._ensureListener(), + this._listener.dispose = t + }, + setCompleteListener: function(t) { + this._ensureListener(), + this._listener.complete = t + }, + setEventListener: function(t) { + this._ensureListener(), + this._listener.event = t + }, + setTrackStartListener: function(t, e) { + i.getListeners(t).start = e + }, + setTrackInterruptListener: function(t, e) { + i.getListeners(t).interrupt = e + }, + setTrackEndListener: function(t, e) { + i.getListeners(t).end = e + }, + setTrackDisposeListener: function(t, e) { + i.getListeners(t).dispose = e + }, + setTrackCompleteListener: function(t, e) { + i.getListeners(t).complete = function(t) { + var i = Math.floor(t.trackTime / t.animationEnd); + e(t, i) + } + }, + setTrackEventListener: function(t, e) { + i.getListeners(t).event = e + }, + getState: function() { + return this._state + }, + _updateAnimEnum: !1, + _updateSkinEnum: !1, + _ensureListener: function() { + this._listener || (this._listener = new i, + this._state && this._state.addListener(this._listener)) + }, + _updateSkeletonData: function() { + if (this.skeletonData) { + var t = this.skeletonData.getRuntimeData(); + if (t) { + try { + this.setSkeletonData(t), + this.isAnimationCached() || this.setAnimationStateData(new r.AnimationStateData(this._skeleton.data)), + this.defaultSkin && this.setSkin(this.defaultSkin) + } catch (e) { + cc.warn(e) + } + this.attachUtil.init(this), + this.attachUtil._associateAttachedNode(), + this._preCacheMode = this._cacheMode, + this.animation = this.defaultAnimation + } else + this.disableRender() + } else + this.disableRender() + }, + _refreshInspector: function() { + this._updateAnimEnum(), + this._updateSkinEnum(), + Editor.Utils.refreshSelectedInspector("node", this.node.uuid) + }, + _updateDebugDraw: function() { + if (this.debugBones || this.debugSlots) { + if (!this._debugRenderer) { + var t = new cc.PrivateNode; + t.name = "DEBUG_DRAW_NODE"; + var e = t.addComponent(s); + e.lineWidth = 1, + e.strokeColor = cc.color(255, 0, 0, 255), + this._debugRenderer = e + } + this._debugRenderer.node.parent = this.node, + this.isAnimationCached() && cc.warn("Debug bones or slots is invalid in cached mode") + } else + this._debugRenderer && (this._debugRenderer.node.parent = null) + } + }), + e.exports = sp.Skeleton + } + ), { + "../../cocos2d/core/components/CCRenderComponent": 115, + "../../cocos2d/core/graphics/graphics": 156, + "../../cocos2d/core/renderer/render-flow": 225, + "./AttachUtil": 367, + "./lib/spine": 370, + "./skeleton-cache": 371, + "./track-entry-listeners": 375 + }], + 369: [(function(t) { + "use strict"; + var e = "undefined" == typeof window ? global : window; + e.spine = t("./lib/spine"), + e.sp = {}, + sp._timeScale = 1, + Object.defineProperty(sp, "timeScale", { + get: function() { + return this._timeScale + }, + set: function(t) { + this._timeScale = t + }, + configurable: !0 + }), + sp.ATTACHMENT_TYPE = { + REGION: 0, + BOUNDING_BOX: 1, + MESH: 2, + SKINNED_MESH: 3 + }, + sp.AnimationEventType = cc.Enum({ + START: 0, + INTERRUPT: 1, + END: 2, + DISPOSE: 3, + COMPLETE: 4, + EVENT: 5 + }), + sp.spine = e.spine, + t("./skeleton-texture"), + t("./skeleton-data"), + t("./vertex-effect-delegate"), + t("./Skeleton"), + t("./spine-assembler") + } + ), { + "./Skeleton": 368, + "./lib/spine": 370, + "./skeleton-data": 372, + "./skeleton-texture": 373, + "./spine-assembler": 374, + "./vertex-effect-delegate": 376 + }], + 370: [(function(t, e) { + "use strict"; + var i, n, r, s = (i = function(t, e) { + return (i = Object.setPrototypeOf || { + __proto__: [] + }instanceof Array && function(t, e) { + t.__proto__ = e + } + || function(t, e) { + for (var i in e) + e.hasOwnProperty(i) && (t[i] = e[i]) + } + )(t, e) + } + , + function(t, e) { + function n() { + this.constructor = t + } + i(t, e), + t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, + new n) + } + ); + (function(t) { + var e, i, n, r = (function() { + function t(t, e, i) { + if (null == t) + throw new Error("name cannot be null."); + if (null == e) + throw new Error("timelines cannot be null."); + this.name = t, + this.timelines = e, + this.timelineIds = []; + for (var n = 0; n < e.length; n++) + this.timelineIds[e[n].getPropertyId()] = !0; + this.duration = i + } + return t.prototype.hasTimeline = function(t) { + return 1 == this.timelineIds[t] + } + , + t.prototype.apply = function(t, e, i, n, r, s, a, o) { + if (null == t) + throw new Error("skeleton cannot be null."); + n && 0 != this.duration && (i %= this.duration, + e > 0 && (e %= this.duration)); + for (var l = this.timelines, h = 0, c = l.length; h < c; h++) + l[h].apply(t, e, i, r, s, a, o) + } + , + t.binarySearch = function(t, e, i) { + void 0 === i && (i = 1); + var n = 0 + , r = t.length / i - 2; + if (0 == r) + return i; + for (var s = r >>> 1; ; ) { + if (t[(s + 1) * i] <= e ? n = s + 1 : r = s, + n == r) + return (n + 1) * i; + s = n + r >>> 1 + } + } + , + t.linearSearch = function(t, e, i) { + for (var n = 0, r = t.length - i; n <= r; n += i) + if (t[n] > e) + return n; + return -1 + } + , + t + } + )(); + t.Animation = r, + (function(t) { + t[t.setup = 0] = "setup", + t[t.first = 1] = "first", + t[t.replace = 2] = "replace", + t[t.add = 3] = "add" + } + )(e = t.MixBlend || (t.MixBlend = {})), + (function(t) { + t[t.mixIn = 0] = "mixIn", + t[t.mixOut = 1] = "mixOut" + } + )(i = t.MixDirection || (t.MixDirection = {})), + (function(t) { + t[t.rotate = 0] = "rotate", + t[t.translate = 1] = "translate", + t[t.scale = 2] = "scale", + t[t.shear = 3] = "shear", + t[t.attachment = 4] = "attachment", + t[t.color = 5] = "color", + t[t.deform = 6] = "deform", + t[t.event = 7] = "event", + t[t.drawOrder = 8] = "drawOrder", + t[t.ikConstraint = 9] = "ikConstraint", + t[t.transformConstraint = 10] = "transformConstraint", + t[t.pathConstraintPosition = 11] = "pathConstraintPosition", + t[t.pathConstraintSpacing = 12] = "pathConstraintSpacing", + t[t.pathConstraintMix = 13] = "pathConstraintMix", + t[t.twoColor = 14] = "twoColor" + } + )(n = t.TimelineType || (t.TimelineType = {})); + var a = (function() { + function e(i) { + if (i <= 0) + throw new Error("frameCount must be > 0: " + i); + this.curves = t.Utils.newFloatArray((i - 1) * e.BEZIER_SIZE) + } + return e.prototype.getFrameCount = function() { + return this.curves.length / e.BEZIER_SIZE + 1 + } + , + e.prototype.setLinear = function(t) { + this.curves[t * e.BEZIER_SIZE] = e.LINEAR + } + , + e.prototype.setStepped = function(t) { + this.curves[t * e.BEZIER_SIZE] = e.STEPPED + } + , + e.prototype.getCurveType = function(t) { + var i = t * e.BEZIER_SIZE; + if (i == this.curves.length) + return e.LINEAR; + var n = this.curves[i]; + return n == e.LINEAR ? e.LINEAR : n == e.STEPPED ? e.STEPPED : e.BEZIER + } + , + e.prototype.setCurve = function(t, i, n, r, s) { + var a = .03 * (2 * -i + r) + , o = .03 * (2 * -n + s) + , l = .006 * (3 * (i - r) + 1) + , h = .006 * (3 * (n - s) + 1) + , c = 2 * a + l + , u = 2 * o + h + , _ = .3 * i + a + .16666667 * l + , f = .3 * n + o + .16666667 * h + , d = t * e.BEZIER_SIZE + , p = this.curves; + p[d++] = e.BEZIER; + for (var m = _, y = f, v = d + e.BEZIER_SIZE - 1; d < v; d += 2) + p[d] = m, + p[d + 1] = y, + _ += c, + f += u, + c += l, + u += h, + m += _, + y += f + } + , + e.prototype.getCurvePercent = function(i, n) { + n = t.MathUtils.clamp(n, 0, 1); + var r = this.curves + , s = i * e.BEZIER_SIZE + , a = r[s]; + if (a == e.LINEAR) + return n; + if (a == e.STEPPED) + return 0; + for (var o = 0, l = ++s, h = s + e.BEZIER_SIZE - 1; s < h; s += 2) + if ((o = r[s]) >= n) { + var c = void 0 + , u = void 0; + return s == l ? (c = 0, + u = 0) : (c = r[s - 2], + u = r[s - 1]), + u + (r[s + 1] - u) * (n - c) / (o - c) + } + var _ = r[s - 1]; + return _ + (1 - _) * (n - o) / (1 - o) + } + , + e.LINEAR = 0, + e.STEPPED = 1, + e.BEZIER = 2, + e.BEZIER_SIZE = 19, + e + } + )(); + t.CurveTimeline = a; + var o = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e << 1), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.rotate << 24) + this.boneIndex + } + , + a.prototype.setFrame = function(t, e, i) { + t <<= 1, + this.frames[t] = e, + this.frames[t + a.ROTATION] = i + } + , + a.prototype.apply = function(t, i, n, s, o, l) { + var h = this.frames + , c = t.bones[this.boneIndex]; + if (c.active) + if (n < h[0]) + switch (l) { + case e.setup: + return void (c.rotation = c.data.rotation); + case e.first: + var u = c.data.rotation - c.rotation; + c.rotation += (u - 360 * (16384 - (16384.499999999996 - u / 360 | 0))) * o + } + else if (n >= h[h.length - a.ENTRIES]) { + var _ = h[h.length + a.PREV_ROTATION]; + switch (l) { + case e.setup: + c.rotation = c.data.rotation + _ * o; + break; + case e.first: + case e.replace: + _ += c.data.rotation - c.rotation, + _ -= 360 * (16384 - (16384.499999999996 - _ / 360 | 0)); + case e.add: + c.rotation += _ * o + } + } else { + var f = r.binarySearch(h, n, a.ENTRIES) + , d = h[f + a.PREV_ROTATION] + , p = h[f] + , m = this.getCurvePercent((f >> 1) - 1, 1 - (n - p) / (h[f + a.PREV_TIME] - p)) + , y = h[f + a.ROTATION] - d; + switch (y = d + (y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))) * m, + l) { + case e.setup: + c.rotation = c.data.rotation + (y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))) * o; + break; + case e.first: + case e.replace: + y += c.data.rotation - c.rotation; + case e.add: + c.rotation += (y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))) * o + } + } + } + , + a.ENTRIES = 2, + a.PREV_TIME = -2, + a.PREV_ROTATION = -1, + a.ROTATION = 1, + a + } + )(a); + t.RotateTimeline = o; + var l = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e * a.ENTRIES), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.translate << 24) + this.boneIndex + } + , + a.prototype.setFrame = function(t, e, i, n) { + t *= a.ENTRIES, + this.frames[t] = e, + this.frames[t + a.X] = i, + this.frames[t + a.Y] = n + } + , + a.prototype.apply = function(t, i, n, s, o, l) { + var h = this.frames + , c = t.bones[this.boneIndex]; + if (c.active) + if (n < h[0]) + switch (l) { + case e.setup: + return c.x = c.data.x, + void (c.y = c.data.y); + case e.first: + c.x += (c.data.x - c.x) * o, + c.y += (c.data.y - c.y) * o + } + else { + var u = 0 + , _ = 0; + if (n >= h[h.length - a.ENTRIES]) + u = h[h.length + a.PREV_X], + _ = h[h.length + a.PREV_Y]; + else { + var f = r.binarySearch(h, n, a.ENTRIES); + u = h[f + a.PREV_X], + _ = h[f + a.PREV_Y]; + var d = h[f] + , p = this.getCurvePercent(f / a.ENTRIES - 1, 1 - (n - d) / (h[f + a.PREV_TIME] - d)); + u += (h[f + a.X] - u) * p, + _ += (h[f + a.Y] - _) * p + } + switch (l) { + case e.setup: + c.x = c.data.x + u * o, + c.y = c.data.y + _ * o; + break; + case e.first: + case e.replace: + c.x += (c.data.x + u - c.x) * o, + c.y += (c.data.y + _ - c.y) * o; + break; + case e.add: + c.x += u * o, + c.y += _ * o + } + } + } + , + a.ENTRIES = 3, + a.PREV_TIME = -3, + a.PREV_X = -2, + a.PREV_Y = -1, + a.X = 1, + a.Y = 2, + a + } + )(a); + t.TranslateTimeline = l; + var h = (function(a) { + function o(t) { + return a.call(this, t) || this + } + return s(o, a), + o.prototype.getPropertyId = function() { + return (n.scale << 24) + this.boneIndex + } + , + o.prototype.apply = function(n, s, a, l, h, c, u) { + var _ = this.frames + , f = n.bones[this.boneIndex]; + if (f.active) + if (a < _[0]) + switch (c) { + case e.setup: + return f.scaleX = f.data.scaleX, + void (f.scaleY = f.data.scaleY); + case e.first: + f.scaleX += (f.data.scaleX - f.scaleX) * h, + f.scaleY += (f.data.scaleY - f.scaleY) * h + } + else { + var d = 0 + , p = 0; + if (a >= _[_.length - o.ENTRIES]) + d = _[_.length + o.PREV_X] * f.data.scaleX, + p = _[_.length + o.PREV_Y] * f.data.scaleY; + else { + var m = r.binarySearch(_, a, o.ENTRIES); + d = _[m + o.PREV_X], + p = _[m + o.PREV_Y]; + var y = _[m] + , v = this.getCurvePercent(m / o.ENTRIES - 1, 1 - (a - y) / (_[m + o.PREV_TIME] - y)); + d = (d + (_[m + o.X] - d) * v) * f.data.scaleX, + p = (p + (_[m + o.Y] - p) * v) * f.data.scaleY + } + if (1 == h) + c == e.add ? (f.scaleX += d - f.data.scaleX, + f.scaleY += p - f.data.scaleY) : (f.scaleX = d, + f.scaleY = p); + else { + var g = 0 + , A = 0; + if (u == i.mixOut) + switch (c) { + case e.setup: + g = f.data.scaleX, + A = f.data.scaleY, + f.scaleX = g + (Math.abs(d) * t.MathUtils.signum(g) - g) * h, + f.scaleY = A + (Math.abs(p) * t.MathUtils.signum(A) - A) * h; + break; + case e.first: + case e.replace: + g = f.scaleX, + A = f.scaleY, + f.scaleX = g + (Math.abs(d) * t.MathUtils.signum(g) - g) * h, + f.scaleY = A + (Math.abs(p) * t.MathUtils.signum(A) - A) * h; + break; + case e.add: + g = f.scaleX, + A = f.scaleY, + f.scaleX = g + (Math.abs(d) * t.MathUtils.signum(g) - f.data.scaleX) * h, + f.scaleY = A + (Math.abs(p) * t.MathUtils.signum(A) - f.data.scaleY) * h + } + else + switch (c) { + case e.setup: + g = Math.abs(f.data.scaleX) * t.MathUtils.signum(d), + A = Math.abs(f.data.scaleY) * t.MathUtils.signum(p), + f.scaleX = g + (d - g) * h, + f.scaleY = A + (p - A) * h; + break; + case e.first: + case e.replace: + g = Math.abs(f.scaleX) * t.MathUtils.signum(d), + A = Math.abs(f.scaleY) * t.MathUtils.signum(p), + f.scaleX = g + (d - g) * h, + f.scaleY = A + (p - A) * h; + break; + case e.add: + g = t.MathUtils.signum(d), + A = t.MathUtils.signum(p), + f.scaleX = Math.abs(f.scaleX) * g + (d - Math.abs(f.data.scaleX) * g) * h, + f.scaleY = Math.abs(f.scaleY) * A + (p - Math.abs(f.data.scaleY) * A) * h + } + } + } + } + , + o + } + )(l); + t.ScaleTimeline = h; + var c = (function(t) { + function i(e) { + return t.call(this, e) || this + } + return s(i, t), + i.prototype.getPropertyId = function() { + return (n.shear << 24) + this.boneIndex + } + , + i.prototype.apply = function(t, n, s, a, o, l) { + var h = this.frames + , c = t.bones[this.boneIndex]; + if (c.active) + if (s < h[0]) + switch (l) { + case e.setup: + return c.shearX = c.data.shearX, + void (c.shearY = c.data.shearY); + case e.first: + c.shearX += (c.data.shearX - c.shearX) * o, + c.shearY += (c.data.shearY - c.shearY) * o + } + else { + var u = 0 + , _ = 0; + if (s >= h[h.length - i.ENTRIES]) + u = h[h.length + i.PREV_X], + _ = h[h.length + i.PREV_Y]; + else { + var f = r.binarySearch(h, s, i.ENTRIES); + u = h[f + i.PREV_X], + _ = h[f + i.PREV_Y]; + var d = h[f] + , p = this.getCurvePercent(f / i.ENTRIES - 1, 1 - (s - d) / (h[f + i.PREV_TIME] - d)); + u += (h[f + i.X] - u) * p, + _ += (h[f + i.Y] - _) * p + } + switch (l) { + case e.setup: + c.shearX = c.data.shearX + u * o, + c.shearY = c.data.shearY + _ * o; + break; + case e.first: + case e.replace: + c.shearX += (c.data.shearX + u - c.shearX) * o, + c.shearY += (c.data.shearY + _ - c.shearY) * o; + break; + case e.add: + c.shearX += u * o, + c.shearY += _ * o + } + } + } + , + i + } + )(l); + t.ShearTimeline = c; + var u = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e * a.ENTRIES), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.color << 24) + this.slotIndex + } + , + a.prototype.setFrame = function(t, e, i, n, r, s) { + t *= a.ENTRIES, + this.frames[t] = e, + this.frames[t + a.R] = i, + this.frames[t + a.G] = n, + this.frames[t + a.B] = r, + this.frames[t + a.A] = s + } + , + a.prototype.apply = function(t, i, n, s, o, l) { + var h = t.slots[this.slotIndex]; + if (h.bone.active) { + var c = this.frames; + if (n < c[0]) + switch (l) { + case e.setup: + return void h.color.setFromColor(h.data.color); + case e.first: + var u = h.color + , _ = h.data.color; + u.add((_.r - u.r) * o, (_.g - u.g) * o, (_.b - u.b) * o, (_.a - u.a) * o) + } + else { + var f = 0 + , d = 0 + , p = 0 + , m = 0; + if (n >= c[c.length - a.ENTRIES]) { + var y = c.length; + f = c[y + a.PREV_R], + d = c[y + a.PREV_G], + p = c[y + a.PREV_B], + m = c[y + a.PREV_A] + } else { + var v = r.binarySearch(c, n, a.ENTRIES); + f = c[v + a.PREV_R], + d = c[v + a.PREV_G], + p = c[v + a.PREV_B], + m = c[v + a.PREV_A]; + var g = c[v] + , A = this.getCurvePercent(v / a.ENTRIES - 1, 1 - (n - g) / (c[v + a.PREV_TIME] - g)); + f += (c[v + a.R] - f) * A, + d += (c[v + a.G] - d) * A, + p += (c[v + a.B] - p) * A, + m += (c[v + a.A] - m) * A + } + 1 == o ? h.color.set(f, d, p, m) : (u = h.color, + l == e.setup && u.setFromColor(h.data.color), + u.add((f - u.r) * o, (d - u.g) * o, (p - u.b) * o, (m - u.a) * o)) + } + } + } + , + a.ENTRIES = 5, + a.PREV_TIME = -5, + a.PREV_R = -4, + a.PREV_G = -3, + a.PREV_B = -2, + a.PREV_A = -1, + a.R = 1, + a.G = 2, + a.B = 3, + a.A = 4, + a + } + )(a); + t.ColorTimeline = u; + var _ = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e * a.ENTRIES), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.twoColor << 24) + this.slotIndex + } + , + a.prototype.setFrame = function(t, e, i, n, r, s, o, l, h) { + t *= a.ENTRIES, + this.frames[t] = e, + this.frames[t + a.R] = i, + this.frames[t + a.G] = n, + this.frames[t + a.B] = r, + this.frames[t + a.A] = s, + this.frames[t + a.R2] = o, + this.frames[t + a.G2] = l, + this.frames[t + a.B2] = h + } + , + a.prototype.apply = function(t, i, n, s, o, l) { + var h = t.slots[this.slotIndex]; + if (h.bone.active) { + var c = this.frames; + if (n < c[0]) + switch (l) { + case e.setup: + return h.color.setFromColor(h.data.color), + void h.darkColor.setFromColor(h.data.darkColor); + case e.first: + var u = h.color + , _ = h.darkColor + , f = h.data.color + , d = h.data.darkColor; + u.add((f.r - u.r) * o, (f.g - u.g) * o, (f.b - u.b) * o, (f.a - u.a) * o), + _.add((d.r - _.r) * o, (d.g - _.g) * o, (d.b - _.b) * o, 0) + } + else { + var p = 0 + , m = 0 + , y = 0 + , v = 0 + , g = 0 + , A = 0 + , x = 0; + if (n >= c[c.length - a.ENTRIES]) { + var b = c.length; + p = c[b + a.PREV_R], + m = c[b + a.PREV_G], + y = c[b + a.PREV_B], + v = c[b + a.PREV_A], + g = c[b + a.PREV_R2], + A = c[b + a.PREV_G2], + x = c[b + a.PREV_B2] + } else { + var C = r.binarySearch(c, n, a.ENTRIES); + p = c[C + a.PREV_R], + m = c[C + a.PREV_G], + y = c[C + a.PREV_B], + v = c[C + a.PREV_A], + g = c[C + a.PREV_R2], + A = c[C + a.PREV_G2], + x = c[C + a.PREV_B2]; + var T = c[C] + , S = this.getCurvePercent(C / a.ENTRIES - 1, 1 - (n - T) / (c[C + a.PREV_TIME] - T)); + p += (c[C + a.R] - p) * S, + m += (c[C + a.G] - m) * S, + y += (c[C + a.B] - y) * S, + v += (c[C + a.A] - v) * S, + g += (c[C + a.R2] - g) * S, + A += (c[C + a.G2] - A) * S, + x += (c[C + a.B2] - x) * S + } + 1 == o ? (h.color.set(p, m, y, v), + h.darkColor.set(g, A, x, 1)) : (u = h.color, + _ = h.darkColor, + l == e.setup && (u.setFromColor(h.data.color), + _.setFromColor(h.data.darkColor)), + u.add((p - u.r) * o, (m - u.g) * o, (y - u.b) * o, (v - u.a) * o), + _.add((g - _.r) * o, (A - _.g) * o, (x - _.b) * o, 0)) + } + } + } + , + a.ENTRIES = 8, + a.PREV_TIME = -8, + a.PREV_R = -7, + a.PREV_G = -6, + a.PREV_B = -5, + a.PREV_A = -4, + a.PREV_R2 = -3, + a.PREV_G2 = -2, + a.PREV_B2 = -1, + a.R = 1, + a.G = 2, + a.B = 3, + a.A = 4, + a.R2 = 5, + a.G2 = 6, + a.B2 = 7, + a + } + )(a); + t.TwoColorTimeline = _; + var f = (function() { + function s(e) { + this.frames = t.Utils.newFloatArray(e), + this.attachmentNames = new Array(e) + } + return s.prototype.getPropertyId = function() { + return (n.attachment << 24) + this.slotIndex + } + , + s.prototype.getFrameCount = function() { + return this.frames.length + } + , + s.prototype.setFrame = function(t, e, i) { + this.frames[t] = e, + this.attachmentNames[t] = i + } + , + s.prototype.apply = function(t, n, s, a, o, l, h) { + var c = t.slots[this.slotIndex]; + if (c.bone.active) + if (h != i.mixOut || l != e.setup) { + var u = this.frames; + if (s < u[0]) { + if (l == e.setup || l == e.first) { + var _ = c.data.attachmentName; + c.setAttachment(null == _ ? null : t.getAttachment(this.slotIndex, _)) + } + } else { + var f; + f = s >= u[u.length - 1] ? u.length - 1 : r.binarySearch(u, s, 1) - 1; + var d = this.attachmentNames[f]; + t.slots[this.slotIndex].setAttachment(null == d ? null : t.getAttachment(this.slotIndex, d)) + } + } else { + var p = c.data.attachmentName; + c.setAttachment(null == p ? null : t.getAttachment(this.slotIndex, p)) + } + } + , + s + } + )(); + t.AttachmentTimeline = f; + var d = null + , p = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e), + n.frameVertices = new Array(e), + null == d && (d = t.Utils.newFloatArray(64)), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.deform << 27) + +this.attachment.id + this.slotIndex + } + , + a.prototype.setFrame = function(t, e, i) { + this.frames[t] = e, + this.frameVertices[t] = i + } + , + a.prototype.apply = function(i, n, s, a, o, l) { + var h = i.slots[this.slotIndex]; + if (h.bone.active) { + var c = h.getAttachment(); + if (c instanceof t.VertexAttachment && c.deformAttachment == this.attachment) { + var u = h.deform; + 0 == u.length && (l = e.setup); + var _ = this.frameVertices + , f = _[0].length + , d = this.frames; + if (s < d[0]) { + var p = c; + switch (l) { + case e.setup: + return void (u.length = 0); + case e.first: + if (1 == o) { + u.length = 0; + break + } + var m = t.Utils.setArraySize(u, f); + if (null == p.bones) + for (var y = p.vertices, v = 0; v < f; v++) + m[v] += (y[v] - m[v]) * o; + else + for (o = 1 - o, + v = 0; v < f; v++) + m[v] *= o + } + } else { + var g = t.Utils.setArraySize(u, f); + if (s >= d[d.length - 1]) { + var A = _[d.length - 1]; + if (1 == o) + if (l == e.add) + if (null == (p = c).bones) { + y = p.vertices; + for (var x = 0; x < f; x++) + g[x] += A[x] - y[x] + } else + for (var b = 0; b < f; b++) + g[b] += A[b]; + else + t.Utils.arrayCopy(A, 0, g, 0, f); + else + switch (l) { + case e.setup: + var C = c; + if (null == C.bones) { + y = C.vertices; + for (var T = 0; T < f; T++) { + var S = y[T]; + g[T] = S + (A[T] - S) * o + } + } else + for (var w = 0; w < f; w++) + g[w] = A[w] * o; + break; + case e.first: + case e.replace: + for (var E = 0; E < f; E++) + g[E] += (A[E] - g[E]) * o; + case e.add: + if (null == (p = c).bones) { + y = p.vertices; + for (var M = 0; M < f; M++) + g[M] += (A[M] - y[M]) * o + } else + for (var D = 0; D < f; D++) + g[D] += A[D] * o + } + } else { + var B = r.binarySearch(d, s) + , I = _[B - 1] + , P = _[B] + , R = d[B] + , O = this.getCurvePercent(B - 1, 1 - (s - R) / (d[B - 1] - R)); + if (1 == o) + if (l == e.add) + if (null == (p = c).bones) { + y = p.vertices; + for (var L = 0; L < f; L++) { + var F = I[L]; + g[L] += F + (P[L] - F) * O - y[L] + } + } else + for (var V = 0; V < f; V++) + F = I[V], + g[V] += F + (P[V] - F) * O; + else + for (var N = 0; N < f; N++) + F = I[N], + g[N] = F + (P[N] - F) * O; + else + switch (l) { + case e.setup: + var k = c; + if (null == k.bones) { + y = k.vertices; + for (var G = 0; G < f; G++) + F = I[G], + S = y[G], + g[G] = S + (F + (P[G] - F) * O - S) * o + } else + for (var U = 0; U < f; U++) + F = I[U], + g[U] = (F + (P[U] - F) * O) * o; + break; + case e.first: + case e.replace: + for (var z = 0; z < f; z++) + F = I[z], + g[z] += (F + (P[z] - F) * O - g[z]) * o; + break; + case e.add: + if (null == (p = c).bones) { + y = p.vertices; + for (var H = 0; H < f; H++) + F = I[H], + g[H] += (F + (P[H] - F) * O - y[H]) * o + } else + for (var W = 0; W < f; W++) + F = I[W], + g[W] += (F + (P[W] - F) * O) * o + } + } + } + } + } + } + , + a + } + )(a); + t.DeformTimeline = p; + var m = (function() { + function e(e) { + this.frames = t.Utils.newFloatArray(e), + this.events = new Array(e) + } + return e.prototype.getPropertyId = function() { + return n.event << 24 + } + , + e.prototype.getFrameCount = function() { + return this.frames.length + } + , + e.prototype.setFrame = function(t, e) { + this.frames[t] = e.time, + this.events[t] = e + } + , + e.prototype.apply = function(t, e, i, n, s, a, o) { + if (null != n) { + var l = this.frames + , h = this.frames.length; + if (e > i) + this.apply(t, e, Number.MAX_VALUE, n, s, a, o), + e = -1; + else if (e >= l[h - 1]) + return; + if (!(i < l[0])) { + var c = 0; + if (e < l[0]) + c = 0; + else + for (var u = l[c = r.binarySearch(l, e)]; c > 0 && l[c - 1] == u; ) + c--; + for (; c < h && i >= l[c]; c++) + n.push(this.events[c]) + } + } + } + , + e + } + )(); + t.EventTimeline = m; + var y = (function() { + function s(e) { + this.frames = t.Utils.newFloatArray(e), + this.drawOrders = new Array(e) + } + return s.prototype.getPropertyId = function() { + return n.drawOrder << 24 + } + , + s.prototype.getFrameCount = function() { + return this.frames.length + } + , + s.prototype.setFrame = function(t, e, i) { + this.frames[t] = e, + this.drawOrders[t] = i + } + , + s.prototype.apply = function(n, s, a, o, l, h, c) { + var u = n.drawOrder + , _ = n.slots; + if (c != i.mixOut || h != e.setup) { + var f = this.frames; + if (a < f[0]) + h != e.setup && h != e.first || t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length); + else { + var d; + d = a >= f[f.length - 1] ? f.length - 1 : r.binarySearch(f, a) - 1; + var p = this.drawOrders[d]; + if (null == p) + t.Utils.arrayCopy(_, 0, u, 0, _.length); + else + for (var m = 0, y = p.length; m < y; m++) + u[m] = _[p[m]] + } + } else + t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length) + } + , + s + } + )(); + t.DrawOrderTimeline = y; + var v = (function(a) { + function o(e) { + var i = a.call(this, e) || this; + return i.frames = t.Utils.newFloatArray(e * o.ENTRIES), + i + } + return s(o, a), + o.prototype.getPropertyId = function() { + return (n.ikConstraint << 24) + this.ikConstraintIndex + } + , + o.prototype.setFrame = function(t, e, i, n, r, s, a) { + t *= o.ENTRIES, + this.frames[t] = e, + this.frames[t + o.MIX] = i, + this.frames[t + o.SOFTNESS] = n, + this.frames[t + o.BEND_DIRECTION] = r, + this.frames[t + o.COMPRESS] = s ? 1 : 0, + this.frames[t + o.STRETCH] = a ? 1 : 0 + } + , + o.prototype.apply = function(t, n, s, a, l, h, c) { + var u = this.frames + , _ = t.ikConstraints[this.ikConstraintIndex]; + if (_.active) + if (s < u[0]) + switch (h) { + case e.setup: + return _.mix = _.data.mix, + _.softness = _.data.softness, + _.bendDirection = _.data.bendDirection, + _.compress = _.data.compress, + void (_.stretch = _.data.stretch); + case e.first: + _.mix += (_.data.mix - _.mix) * l, + _.softness += (_.data.softness - _.softness) * l, + _.bendDirection = _.data.bendDirection, + _.compress = _.data.compress, + _.stretch = _.data.stretch + } + else if (s >= u[u.length - o.ENTRIES]) + h == e.setup ? (_.mix = _.data.mix + (u[u.length + o.PREV_MIX] - _.data.mix) * l, + _.softness = _.data.softness + (u[u.length + o.PREV_SOFTNESS] - _.data.softness) * l, + c == i.mixOut ? (_.bendDirection = _.data.bendDirection, + _.compress = _.data.compress, + _.stretch = _.data.stretch) : (_.bendDirection = u[u.length + o.PREV_BEND_DIRECTION], + _.compress = 0 != u[u.length + o.PREV_COMPRESS], + _.stretch = 0 != u[u.length + o.PREV_STRETCH])) : (_.mix += (u[u.length + o.PREV_MIX] - _.mix) * l, + _.softness += (u[u.length + o.PREV_SOFTNESS] - _.softness) * l, + c == i.mixIn && (_.bendDirection = u[u.length + o.PREV_BEND_DIRECTION], + _.compress = 0 != u[u.length + o.PREV_COMPRESS], + _.stretch = 0 != u[u.length + o.PREV_STRETCH])); + else { + var f = r.binarySearch(u, s, o.ENTRIES) + , d = u[f + o.PREV_MIX] + , p = u[f + o.PREV_SOFTNESS] + , m = u[f] + , y = this.getCurvePercent(f / o.ENTRIES - 1, 1 - (s - m) / (u[f + o.PREV_TIME] - m)); + h == e.setup ? (_.mix = _.data.mix + (d + (u[f + o.MIX] - d) * y - _.data.mix) * l, + _.softness = _.data.softness + (p + (u[f + o.SOFTNESS] - p) * y - _.data.softness) * l, + c == i.mixOut ? (_.bendDirection = _.data.bendDirection, + _.compress = _.data.compress, + _.stretch = _.data.stretch) : (_.bendDirection = u[f + o.PREV_BEND_DIRECTION], + _.compress = 0 != u[f + o.PREV_COMPRESS], + _.stretch = 0 != u[f + o.PREV_STRETCH])) : (_.mix += (d + (u[f + o.MIX] - d) * y - _.mix) * l, + _.softness += (p + (u[f + o.SOFTNESS] - p) * y - _.softness) * l, + c == i.mixIn && (_.bendDirection = u[f + o.PREV_BEND_DIRECTION], + _.compress = 0 != u[f + o.PREV_COMPRESS], + _.stretch = 0 != u[f + o.PREV_STRETCH])) + } + } + , + o.ENTRIES = 6, + o.PREV_TIME = -6, + o.PREV_MIX = -5, + o.PREV_SOFTNESS = -4, + o.PREV_BEND_DIRECTION = -3, + o.PREV_COMPRESS = -2, + o.PREV_STRETCH = -1, + o.MIX = 1, + o.SOFTNESS = 2, + o.BEND_DIRECTION = 3, + o.COMPRESS = 4, + o.STRETCH = 5, + o + } + )(a); + t.IkConstraintTimeline = v; + var g = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e * a.ENTRIES), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.transformConstraint << 24) + this.transformConstraintIndex + } + , + a.prototype.setFrame = function(t, e, i, n, r, s) { + t *= a.ENTRIES, + this.frames[t] = e, + this.frames[t + a.ROTATE] = i, + this.frames[t + a.TRANSLATE] = n, + this.frames[t + a.SCALE] = r, + this.frames[t + a.SHEAR] = s + } + , + a.prototype.apply = function(t, i, n, s, o, l) { + var h = this.frames + , c = t.transformConstraints[this.transformConstraintIndex]; + if (c.active) + if (n < h[0]) { + var u = c.data; + switch (l) { + case e.setup: + return c.rotateMix = u.rotateMix, + c.translateMix = u.translateMix, + c.scaleMix = u.scaleMix, + void (c.shearMix = u.shearMix); + case e.first: + c.rotateMix += (u.rotateMix - c.rotateMix) * o, + c.translateMix += (u.translateMix - c.translateMix) * o, + c.scaleMix += (u.scaleMix - c.scaleMix) * o, + c.shearMix += (u.shearMix - c.shearMix) * o + } + } else { + var _ = 0 + , f = 0 + , d = 0 + , p = 0; + if (n >= h[h.length - a.ENTRIES]) { + var m = h.length; + _ = h[m + a.PREV_ROTATE], + f = h[m + a.PREV_TRANSLATE], + d = h[m + a.PREV_SCALE], + p = h[m + a.PREV_SHEAR] + } else { + var y = r.binarySearch(h, n, a.ENTRIES); + _ = h[y + a.PREV_ROTATE], + f = h[y + a.PREV_TRANSLATE], + d = h[y + a.PREV_SCALE], + p = h[y + a.PREV_SHEAR]; + var v = h[y] + , g = this.getCurvePercent(y / a.ENTRIES - 1, 1 - (n - v) / (h[y + a.PREV_TIME] - v)); + _ += (h[y + a.ROTATE] - _) * g, + f += (h[y + a.TRANSLATE] - f) * g, + d += (h[y + a.SCALE] - d) * g, + p += (h[y + a.SHEAR] - p) * g + } + l == e.setup ? (u = c.data, + c.rotateMix = u.rotateMix + (_ - u.rotateMix) * o, + c.translateMix = u.translateMix + (f - u.translateMix) * o, + c.scaleMix = u.scaleMix + (d - u.scaleMix) * o, + c.shearMix = u.shearMix + (p - u.shearMix) * o) : (c.rotateMix += (_ - c.rotateMix) * o, + c.translateMix += (f - c.translateMix) * o, + c.scaleMix += (d - c.scaleMix) * o, + c.shearMix += (p - c.shearMix) * o) + } + } + , + a.ENTRIES = 5, + a.PREV_TIME = -5, + a.PREV_ROTATE = -4, + a.PREV_TRANSLATE = -3, + a.PREV_SCALE = -2, + a.PREV_SHEAR = -1, + a.ROTATE = 1, + a.TRANSLATE = 2, + a.SCALE = 3, + a.SHEAR = 4, + a + } + )(a); + t.TransformConstraintTimeline = g; + var A = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e * a.ENTRIES), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.pathConstraintPosition << 24) + this.pathConstraintIndex + } + , + a.prototype.setFrame = function(t, e, i) { + t *= a.ENTRIES, + this.frames[t] = e, + this.frames[t + a.VALUE] = i + } + , + a.prototype.apply = function(t, i, n, s, o, l) { + var h = this.frames + , c = t.pathConstraints[this.pathConstraintIndex]; + if (c.active) + if (n < h[0]) + switch (l) { + case e.setup: + return void (c.position = c.data.position); + case e.first: + c.position += (c.data.position - c.position) * o + } + else { + var u = 0; + if (n >= h[h.length - a.ENTRIES]) + u = h[h.length + a.PREV_VALUE]; + else { + var _ = r.binarySearch(h, n, a.ENTRIES); + u = h[_ + a.PREV_VALUE]; + var f = h[_] + , d = this.getCurvePercent(_ / a.ENTRIES - 1, 1 - (n - f) / (h[_ + a.PREV_TIME] - f)); + u += (h[_ + a.VALUE] - u) * d + } + l == e.setup ? c.position = c.data.position + (u - c.data.position) * o : c.position += (u - c.position) * o + } + } + , + a.ENTRIES = 2, + a.PREV_TIME = -2, + a.PREV_VALUE = -1, + a.VALUE = 1, + a + } + )(a); + t.PathConstraintPositionTimeline = A; + var x = (function(t) { + function i(e) { + return t.call(this, e) || this + } + return s(i, t), + i.prototype.getPropertyId = function() { + return (n.pathConstraintSpacing << 24) + this.pathConstraintIndex + } + , + i.prototype.apply = function(t, n, s, a, o, l) { + var h = this.frames + , c = t.pathConstraints[this.pathConstraintIndex]; + if (c.active) + if (s < h[0]) + switch (l) { + case e.setup: + return void (c.spacing = c.data.spacing); + case e.first: + c.spacing += (c.data.spacing - c.spacing) * o + } + else { + var u = 0; + if (s >= h[h.length - i.ENTRIES]) + u = h[h.length + i.PREV_VALUE]; + else { + var _ = r.binarySearch(h, s, i.ENTRIES); + u = h[_ + i.PREV_VALUE]; + var f = h[_] + , d = this.getCurvePercent(_ / i.ENTRIES - 1, 1 - (s - f) / (h[_ + i.PREV_TIME] - f)); + u += (h[_ + i.VALUE] - u) * d + } + l == e.setup ? c.spacing = c.data.spacing + (u - c.data.spacing) * o : c.spacing += (u - c.spacing) * o + } + } + , + i + } + )(A); + t.PathConstraintSpacingTimeline = x; + var b = (function(i) { + function a(e) { + var n = i.call(this, e) || this; + return n.frames = t.Utils.newFloatArray(e * a.ENTRIES), + n + } + return s(a, i), + a.prototype.getPropertyId = function() { + return (n.pathConstraintMix << 24) + this.pathConstraintIndex + } + , + a.prototype.setFrame = function(t, e, i, n) { + t *= a.ENTRIES, + this.frames[t] = e, + this.frames[t + a.ROTATE] = i, + this.frames[t + a.TRANSLATE] = n + } + , + a.prototype.apply = function(t, i, n, s, o, l) { + var h = this.frames + , c = t.pathConstraints[this.pathConstraintIndex]; + if (c.active) + if (n < h[0]) + switch (l) { + case e.setup: + return c.rotateMix = c.data.rotateMix, + void (c.translateMix = c.data.translateMix); + case e.first: + c.rotateMix += (c.data.rotateMix - c.rotateMix) * o, + c.translateMix += (c.data.translateMix - c.translateMix) * o + } + else { + var u = 0 + , _ = 0; + if (n >= h[h.length - a.ENTRIES]) + u = h[h.length + a.PREV_ROTATE], + _ = h[h.length + a.PREV_TRANSLATE]; + else { + var f = r.binarySearch(h, n, a.ENTRIES); + u = h[f + a.PREV_ROTATE], + _ = h[f + a.PREV_TRANSLATE]; + var d = h[f] + , p = this.getCurvePercent(f / a.ENTRIES - 1, 1 - (n - d) / (h[f + a.PREV_TIME] - d)); + u += (h[f + a.ROTATE] - u) * p, + _ += (h[f + a.TRANSLATE] - _) * p + } + l == e.setup ? (c.rotateMix = c.data.rotateMix + (u - c.data.rotateMix) * o, + c.translateMix = c.data.translateMix + (_ - c.data.translateMix) * o) : (c.rotateMix += (u - c.rotateMix) * o, + c.translateMix += (_ - c.translateMix) * o) + } + } + , + a.ENTRIES = 3, + a.PREV_TIME = -3, + a.PREV_ROTATE = -2, + a.PREV_TRANSLATE = -1, + a.ROTATE = 1, + a.TRANSLATE = 2, + a + } + )(a); + t.PathConstraintMixTimeline = b + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(e) { + this.tracks = new Array, + this.timeScale = 1, + this.events = new Array, + this.listeners = new Array, + this.queue = new r(this), + this.propertyIDs = new t.IntSet, + this.animationsChanged = !1, + this.trackEntryPool = new t.Pool(function() { + return new i + } + ), + this.data = e + } + return e.prototype.update = function(t) { + t *= this.timeScale; + for (var e = this.tracks, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (null != r) { + r.animationLast = r.nextAnimationLast, + r.trackLast = r.nextTrackLast; + var s = t * r.timeScale; + if (r.delay > 0) { + if (r.delay -= s, + r.delay > 0) + continue; + s = -r.delay, + r.delay = 0 + } + var a = r.next; + if (null != a) { + var o = r.trackLast - a.delay; + if (o >= 0) { + for (a.delay = 0, + a.trackTime += 0 == r.timeScale ? 0 : (o / r.timeScale + t) * a.timeScale, + r.trackTime += s, + this.setCurrent(i, a, !0); null != a.mixingFrom; ) + a.mixTime += t, + a = a.mixingFrom; + continue + } + } else if (r.trackLast >= r.trackEnd && null == r.mixingFrom) { + e[i] = null, + this.queue.end(r), + this.disposeNext(r); + continue + } + if (null != r.mixingFrom && this.updateMixingFrom(r, t)) { + var l = r.mixingFrom; + for (r.mixingFrom = null, + null != l && (l.mixingTo = null); null != l; ) + this.queue.end(l), + l = l.mixingFrom + } + r.trackTime += s + } + } + this.queue.drain() + } + , + e.prototype.updateMixingFrom = function(t, e) { + var i = t.mixingFrom; + if (null == i) + return !0; + var n = this.updateMixingFrom(i, e); + return i.animationLast = i.nextAnimationLast, + i.trackLast = i.nextTrackLast, + t.mixTime > 0 && t.mixTime >= t.mixDuration ? (0 != i.totalAlpha && 0 != t.mixDuration || (t.mixingFrom = i.mixingFrom, + null != i.mixingFrom && (i.mixingFrom.mixingTo = t), + t.interruptAlpha = i.interruptAlpha, + this.queue.end(i)), + n) : (i.trackTime += e * i.timeScale, + t.mixTime += e, + !1) + } + , + e.prototype.apply = function(i) { + if (null == i) + throw new Error("skeleton cannot be null."); + this.animationsChanged && this._animationsChanged(); + for (var n = this.events, r = this.tracks, s = !1, a = 0, o = r.length; a < o; a++) { + var l = r[a]; + if (!(null == l || l.delay > 0)) { + s = !0; + var h = 0 == a ? t.MixBlend.first : l.mixBlend + , c = l.alpha; + null != l.mixingFrom ? c *= this.applyMixingFrom(l, i, h) : l.trackTime >= l.trackEnd && null == l.next && (c = 0); + var u = l.animationLast + , _ = l.getAnimationTime() + , f = l.animation.timelines.length + , d = l.animation.timelines; + if (0 == a && 1 == c || h == t.MixBlend.add) + for (var p = 0; p < f; p++) + t.Utils.webkit602BugfixHelper(c, h), + d[p].apply(i, u, _, n, c, h, t.MixDirection.mixIn); + else { + var m = l.timelineMode + , y = 0 == l.timelinesRotation.length; + y && t.Utils.setArraySize(l.timelinesRotation, f << 1, null); + var v = l.timelinesRotation; + for (p = 0; p < f; p++) { + var g = d[p] + , A = (m[p] & e.NOT_LAST - 1) == e.SUBSEQUENT ? h : t.MixBlend.setup; + g instanceof t.RotateTimeline ? this.applyRotateTimeline(g, i, _, c, A, v, p << 1, y) : (t.Utils.webkit602BugfixHelper(c, h), + g.apply(i, u, _, n, c, A, t.MixDirection.mixIn)) + } + } + this.queueEvents(l, _), + n.length = 0, + l.nextAnimationLast = _, + l.nextTrackLast = l.trackTime + } + } + return this.queue.drain(), + s + } + , + e.prototype.applyMixingFrom = function(i, n, r) { + var s = i.mixingFrom; + null != s.mixingFrom && this.applyMixingFrom(s, n, r); + var a = 0; + 0 == i.mixDuration ? (a = 1, + r == t.MixBlend.first && (r = t.MixBlend.setup)) : ((a = i.mixTime / i.mixDuration) > 1 && (a = 1), + r != t.MixBlend.first && (r = s.mixBlend)); + var o = a < s.eventThreshold ? this.events : null + , l = a < s.attachmentThreshold + , h = a < s.drawOrderThreshold + , c = s.animationLast + , u = s.getAnimationTime() + , _ = s.animation.timelines.length + , f = s.animation.timelines + , d = s.alpha * i.interruptAlpha + , p = d * (1 - a); + if (r == t.MixBlend.add) + for (var m = 0; m < _; m++) + f[m].apply(n, c, u, o, p, r, t.MixDirection.mixOut); + else { + var y = s.timelineMode + , v = s.timelineHoldMix + , g = 0 == s.timelinesRotation.length; + g && t.Utils.setArraySize(s.timelinesRotation, _ << 1, null); + var A = s.timelinesRotation; + for (s.totalAlpha = 0, + m = 0; m < _; m++) { + var x = f[m] + , b = t.MixDirection.mixOut + , C = void 0 + , T = 0; + switch (y[m] & e.NOT_LAST - 1) { + case e.SUBSEQUENT: + if (C = r, + !l && x instanceof t.AttachmentTimeline) { + if ((y[m] & e.NOT_LAST) == e.NOT_LAST) + continue; + C = t.MixBlend.setup + } + if (!h && x instanceof t.DrawOrderTimeline) + continue; + T = p; + break; + case e.FIRST: + C = t.MixBlend.setup, + T = p; + break; + case e.HOLD: + C = t.MixBlend.setup, + T = d; + break; + default: + C = t.MixBlend.setup; + var S = v[m]; + T = d * Math.max(0, 1 - S.mixTime / S.mixDuration) + } + s.totalAlpha += T, + x instanceof t.RotateTimeline ? this.applyRotateTimeline(x, n, u, T, C, A, m << 1, g) : (t.Utils.webkit602BugfixHelper(T, r), + C == t.MixBlend.setup && (x instanceof t.AttachmentTimeline ? (l || (y[m] & e.NOT_LAST) == e.NOT_LAST) && (b = t.MixDirection.mixIn) : x instanceof t.DrawOrderTimeline && h && (b = t.MixDirection.mixIn)), + x.apply(n, c, u, o, T, C, b)) + } + } + return i.mixDuration > 0 && this.queueEvents(s, u), + this.events.length = 0, + s.nextAnimationLast = u, + s.nextTrackLast = s.trackTime, + a + } + , + e.prototype.applyRotateTimeline = function(e, i, n, r, s, a, o, l) { + if (l && (a[o] = 0), + 1 != r) { + var h = e + , c = h.frames + , u = i.bones[h.boneIndex]; + if (u.active) { + var _ = 0 + , f = 0; + if (n < c[0]) + switch (s) { + case t.MixBlend.setup: + u.rotation = u.data.rotation; + default: + return; + case t.MixBlend.first: + _ = u.rotation, + f = u.data.rotation + } + else if (_ = s == t.MixBlend.setup ? u.data.rotation : u.rotation, + n >= c[c.length - t.RotateTimeline.ENTRIES]) + f = u.data.rotation + c[c.length + t.RotateTimeline.PREV_ROTATION]; + else { + var d = t.Animation.binarySearch(c, n, t.RotateTimeline.ENTRIES) + , p = c[d + t.RotateTimeline.PREV_ROTATION] + , m = c[d] + , y = h.getCurvePercent((d >> 1) - 1, 1 - (n - m) / (c[d + t.RotateTimeline.PREV_TIME] - m)); + f = c[d + t.RotateTimeline.ROTATION] - p, + f = p + (f -= 360 * (16384 - (16384.499999999996 - f / 360 | 0))) * y + u.data.rotation, + f -= 360 * (16384 - (16384.499999999996 - f / 360 | 0)) + } + var v = 0 + , g = f - _; + if (0 == (g -= 360 * (16384 - (16384.499999999996 - g / 360 | 0)))) + v = a[o]; + else { + var A = 0 + , x = 0; + l ? (A = 0, + x = g) : (A = a[o], + x = a[o + 1]); + var b = g > 0 + , C = A >= 0; + t.MathUtils.signum(x) != t.MathUtils.signum(g) && Math.abs(x) <= 90 && (Math.abs(A) > 180 && (A += 360 * t.MathUtils.signum(A)), + C = b), + v = g + A - A % 360, + C != b && (v += 360 * t.MathUtils.signum(A)), + a[o] = v + } + a[o + 1] = g, + _ += v * r, + u.rotation = _ - 360 * (16384 - (16384.499999999996 - _ / 360 | 0)) + } + } else + e.apply(i, 0, n, null, 1, s, t.MixDirection.mixIn) + } + , + e.prototype.queueEvents = function(t, e) { + for (var i = t.animationStart, n = t.animationEnd, r = n - i, s = t.trackLast % r, a = this.events, o = 0, l = a.length; o < l; o++) { + var h = a[o]; + if (h.time < s) + break; + h.time > n || this.queue.event(t, h) + } + for ((t.loop ? 0 == r || s > t.trackTime % r : e >= n && t.animationLast < n) && this.queue.complete(t); o < l; o++) + a[o].time < i || this.queue.event(t, a[o]) + } + , + e.prototype.clearTracks = function() { + var t = this.queue.drainDisabled; + this.queue.drainDisabled = !0; + for (var e = 0, i = this.tracks.length; e < i; e++) + this.clearTrack(e); + this.tracks.length = 0, + this.queue.drainDisabled = t, + this.queue.drain() + } + , + e.prototype.clearTrack = function(t) { + if (!(t >= this.tracks.length)) { + var e = this.tracks[t]; + if (null != e) { + this.queue.end(e), + this.disposeNext(e); + for (var i = e; ; ) { + var n = i.mixingFrom; + if (null == n) + break; + this.queue.end(n), + i.mixingFrom = null, + i.mixingTo = null, + i = n + } + this.tracks[e.trackIndex] = null, + this.queue.drain() + } + } + } + , + e.prototype.setCurrent = function(t, e, i) { + var n = this.expandToIndex(t); + this.tracks[t] = e, + null != n && (i && this.queue.interrupt(n), + e.mixingFrom = n, + n.mixingTo = e, + e.mixTime = 0, + null != n.mixingFrom && n.mixDuration > 0 && (e.interruptAlpha *= Math.min(1, n.mixTime / n.mixDuration)), + n.timelinesRotation.length = 0), + this.queue.start(e) + } + , + e.prototype.setAnimation = function(t, e, i) { + var n = this.data.skeletonData.findAnimation(e); + if (null == n) + throw new Error("Animation not found: " + e); + return this.setAnimationWith(t, n, i) + } + , + e.prototype.setAnimationWith = function(t, e, i) { + if (null == e) + throw new Error("animation cannot be null."); + var n = !0 + , r = this.expandToIndex(t); + null != r && (-1 == r.nextTrackLast ? (this.tracks[t] = r.mixingFrom, + this.queue.interrupt(r), + this.queue.end(r), + this.disposeNext(r), + r = r.mixingFrom, + n = !1) : this.disposeNext(r)); + var s = this.trackEntry(t, e, i, r); + return this.setCurrent(t, s, n), + this.queue.drain(), + s + } + , + e.prototype.addAnimation = function(t, e, i, n) { + var r = this.data.skeletonData.findAnimation(e); + if (null == r) + throw new Error("Animation not found: " + e); + return this.addAnimationWith(t, r, i, n) + } + , + e.prototype.addAnimationWith = function(t, e, i, n) { + if (null == e) + throw new Error("animation cannot be null."); + var r = this.expandToIndex(t); + if (null != r) + for (; null != r.next; ) + r = r.next; + var s = this.trackEntry(t, e, i, r); + if (null == r) + this.setCurrent(t, s, !0), + this.queue.drain(); + else if (r.next = s, + n <= 0) { + var a = r.animationEnd - r.animationStart; + 0 != a ? (r.loop ? n += a * (1 + (r.trackTime / a | 0)) : n += Math.max(a, r.trackTime), + n -= this.data.getMix(r.animation, e)) : n = r.trackTime + } + return s.delay = n, + s + } + , + e.prototype.setEmptyAnimation = function(t, i) { + var n = this.setAnimationWith(t, e.emptyAnimation, !1); + return n.mixDuration = i, + n.trackEnd = i, + n + } + , + e.prototype.addEmptyAnimation = function(t, i, n) { + n <= 0 && (n -= i); + var r = this.addAnimationWith(t, e.emptyAnimation, !1, n); + return r.mixDuration = i, + r.trackEnd = i, + r + } + , + e.prototype.setEmptyAnimations = function(t) { + var e = this.queue.drainDisabled; + this.queue.drainDisabled = !0; + for (var i = 0, n = this.tracks.length; i < n; i++) { + var r = this.tracks[i]; + null != r && this.setEmptyAnimation(r.trackIndex, t) + } + this.queue.drainDisabled = e, + this.queue.drain() + } + , + e.prototype.expandToIndex = function(e) { + return e < this.tracks.length ? this.tracks[e] : (t.Utils.ensureArrayCapacity(this.tracks, e + 1, null), + this.tracks.length = e + 1, + null) + } + , + e.prototype.trackEntry = function(t, e, i, n) { + var r = this.trackEntryPool.obtain(); + return r.trackIndex = t, + r.animation = e, + r.loop = i, + r.holdPrevious = !1, + r.eventThreshold = 0, + r.attachmentThreshold = 0, + r.drawOrderThreshold = 0, + r.animationStart = 0, + r.animationEnd = e.duration, + r.animationLast = -1, + r.nextAnimationLast = -1, + r.delay = 0, + r.trackTime = 0, + r.trackLast = -1, + r.nextTrackLast = -1, + r.trackEnd = Number.MAX_VALUE, + r.timeScale = 1, + r.alpha = 1, + r.interruptAlpha = 1, + r.mixTime = 0, + r.mixDuration = null == n ? 0 : this.data.getMix(n.animation, e), + r + } + , + e.prototype.disposeNext = function(t) { + for (var e = t.next; null != e; ) + this.queue.dispose(e), + e = e.next; + t.next = null + } + , + e.prototype._animationsChanged = function() { + this.animationsChanged = !1, + this.propertyIDs.clear(); + for (var e = 0, i = this.tracks.length; e < i; e++) + if (null != (n = this.tracks[e])) { + for (; null != n.mixingFrom; ) + n = n.mixingFrom; + do { + null != n.mixingFrom && n.mixBlend == t.MixBlend.add || this.computeHold(n), + n = n.mixingTo + } while (null != n) + } + for (this.propertyIDs.clear(), + e = this.tracks.length - 1; e >= 0; e--) + for (var n = this.tracks[e]; null != n; ) + this.computeNotLast(n), + n = n.mixingFrom + } + , + e.prototype.computeHold = function(i) { + var n = i.mixingTo + , r = i.animation.timelines + , s = i.animation.timelines.length + , a = t.Utils.setArraySize(i.timelineMode, s); + i.timelineHoldMix.length = 0; + var o = t.Utils.setArraySize(i.timelineHoldMix, s) + , l = this.propertyIDs; + if (null != n && n.holdPrevious) + for (var h = 0; h < s; h++) + l.add(r[h].getPropertyId()), + a[h] = e.HOLD; + else + t: for (h = 0; h < s; h++) { + var c = r[h] + , u = c.getPropertyId(); + if (l.add(u)) + if (null == n || c instanceof t.AttachmentTimeline || c instanceof t.DrawOrderTimeline || c instanceof t.EventTimeline || !n.animation.hasTimeline(u)) + a[h] = e.FIRST; + else { + for (var _ = n.mixingTo; null != _; _ = _.mixingTo) + if (!_.animation.hasTimeline(u)) { + if (i.mixDuration > 0) { + a[h] = e.HOLD_MIX, + o[h] = _; + continue t + } + break + } + a[h] = e.HOLD + } + else + a[h] = e.SUBSEQUENT + } + } + , + e.prototype.computeNotLast = function(i) { + for (var n = i.animation.timelines, r = i.animation.timelines.length, s = i.timelineMode, a = this.propertyIDs, o = 0; o < r; o++) + if (n[o]instanceof t.AttachmentTimeline) { + var l = n[o]; + a.add(l.slotIndex) || (s[o] |= e.NOT_LAST) + } + } + , + e.prototype.getCurrent = function(t) { + return t >= this.tracks.length ? null : this.tracks[t] + } + , + e.prototype.addListener = function(t) { + if (null == t) + throw new Error("listener cannot be null."); + this.listeners.push(t) + } + , + e.prototype.removeListener = function(t) { + var e = this.listeners.indexOf(t); + e >= 0 && this.listeners.splice(e, 1) + } + , + e.prototype.clearListeners = function() { + this.listeners.length = 0 + } + , + e.prototype.clearListenerNotifications = function() { + this.queue.clear() + } + , + e.emptyAnimation = new t.Animation("",[],0), + e.SUBSEQUENT = 0, + e.FIRST = 1, + e.HOLD = 2, + e.HOLD_MIX = 3, + e.NOT_LAST = 4, + e + } + )(); + t.AnimationState = e; + var i = (function() { + function e() { + this.mixBlend = t.MixBlend.replace, + this.timelineMode = new Array, + this.timelineHoldMix = new Array, + this.timelinesRotation = new Array + } + return e.prototype.reset = function() { + this.next = null, + this.mixingFrom = null, + this.mixingTo = null, + this.animation = null, + this.listener = null, + this.timelineMode.length = 0, + this.timelineHoldMix.length = 0, + this.timelinesRotation.length = 0 + } + , + e.prototype.getAnimationTime = function() { + if (this.loop) { + var t = this.animationEnd - this.animationStart; + return 0 == t ? this.animationStart : this.trackTime % t + this.animationStart + } + return Math.min(this.trackTime + this.animationStart, this.animationEnd) + } + , + e.prototype.setAnimationLast = function(t) { + this.animationLast = t, + this.nextAnimationLast = t + } + , + e.prototype.isComplete = function() { + return this.trackTime >= this.animationEnd - this.animationStart + } + , + e.prototype.resetRotationDirections = function() { + this.timelinesRotation.length = 0 + } + , + e + } + )(); + t.TrackEntry = i; + var n, r = (function() { + function t(t) { + this.objects = [], + this.drainDisabled = !1, + this.animState = t + } + return t.prototype.start = function(t) { + this.objects.push(n.start), + this.objects.push(t), + this.animState.animationsChanged = !0 + } + , + t.prototype.interrupt = function(t) { + this.objects.push(n.interrupt), + this.objects.push(t) + } + , + t.prototype.end = function(t) { + this.objects.push(n.end), + this.objects.push(t), + this.animState.animationsChanged = !0 + } + , + t.prototype.dispose = function(t) { + this.objects.push(n.dispose), + this.objects.push(t) + } + , + t.prototype.complete = function(t) { + this.objects.push(n.complete), + this.objects.push(t) + } + , + t.prototype.event = function(t, e) { + this.objects.push(n.event), + this.objects.push(t), + this.objects.push(e) + } + , + t.prototype.drain = function() { + if (!this.drainDisabled) { + this.drainDisabled = !0; + for (var t = this.objects, e = this.animState.listeners, i = 0; i < t.length; i += 2) { + var r = t[i] + , s = t[i + 1]; + switch (r) { + case n.start: + null != s.listener && s.listener.start && s.listener.start(s); + for (var a = 0; a < e.length; a++) + e[a].start && e[a].start(s); + break; + case n.interrupt: + for (null != s.listener && s.listener.interrupt && s.listener.interrupt(s), + a = 0; a < e.length; a++) + e[a].interrupt && e[a].interrupt(s); + break; + case n.end: + for (null != s.listener && s.listener.end && s.listener.end(s), + a = 0; a < e.length; a++) + e[a].end && e[a].end(s); + case n.dispose: + for (null != s.listener && s.listener.dispose && s.listener.dispose(s), + a = 0; a < e.length; a++) + e[a].dispose && e[a].dispose(s); + this.animState.trackEntryPool.free(s); + break; + case n.complete: + for (null != s.listener && s.listener.complete && s.listener.complete(s), + a = 0; a < e.length; a++) + e[a].complete && e[a].complete(s); + break; + case n.event: + var o = t[2 + i++]; + for (null != s.listener && s.listener.event && s.listener.event(s, o), + a = 0; a < e.length; a++) + e[a].event && e[a].event(s, o) + } + } + this.clear(), + this.drainDisabled = !1 + } + } + , + t.prototype.clear = function() { + this.objects.length = 0 + } + , + t + } + )(); + t.EventQueue = r, + (function(t) { + t[t.start = 0] = "start", + t[t.interrupt = 1] = "interrupt", + t[t.end = 2] = "end", + t[t.dispose = 3] = "dispose", + t[t.complete = 4] = "complete", + t[t.event = 5] = "event" + } + )(n = t.EventType || (t.EventType = {})); + var s = (function() { + function t() {} + return t.prototype.start = function() {} + , + t.prototype.interrupt = function() {} + , + t.prototype.end = function() {} + , + t.prototype.dispose = function() {} + , + t.prototype.complete = function() {} + , + t.prototype.event = function() {} + , + t + } + )(); + t.AnimationStateAdapter = s + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t) { + if (this.animationToMixTime = {}, + this.defaultMix = 0, + null == t) + throw new Error("skeletonData cannot be null."); + this.skeletonData = t + } + return t.prototype.setMix = function(t, e, i) { + var n = this.skeletonData.findAnimation(t); + if (null == n) + throw new Error("Animation not found: " + t); + var r = this.skeletonData.findAnimation(e); + if (null == r) + throw new Error("Animation not found: " + e); + this.setMixWith(n, r, i) + } + , + t.prototype.setMixWith = function(t, e, i) { + if (null == t) + throw new Error("from cannot be null."); + if (null == e) + throw new Error("to cannot be null."); + var n = t.name + "." + e.name; + this.animationToMixTime[n] = i + } + , + t.prototype.getMix = function(t, e) { + var i = t.name + "." + e.name + , n = this.animationToMixTime[i]; + return void 0 === n ? this.defaultMix : n + } + , + t + } + )(); + t.AnimationStateData = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t, e) { + void 0 === e && (e = ""), + this.assets = {}, + this.errors = {}, + this.toLoad = 0, + this.loaded = 0, + this.textureLoader = t, + this.pathPrefix = e + } + return e.downloadText = function(t, e, i) { + var n = new XMLHttpRequest; + n.open("GET", t, !0), + n.onload = function() { + 200 == n.status ? e(n.responseText) : i(n.status, n.responseText) + } + , + n.onerror = function() { + i(n.status, n.responseText) + } + , + n.send() + } + , + e.downloadBinary = function(t, e, i) { + var n = new XMLHttpRequest; + n.open("GET", t, !0), + n.responseType = "arraybuffer", + n.onload = function() { + 200 == n.status ? e(new Uint8Array(n.response)) : i(n.status, n.responseText) + } + , + n.onerror = function() { + i(n.status, n.responseText) + } + , + n.send() + } + , + e.prototype.loadBinary = function(t, i, n) { + var r = this; + void 0 === i && (i = null), + void 0 === n && (n = null), + t = this.pathPrefix + t, + this.toLoad++, + e.downloadBinary(t, (function(e) { + r.assets[t] = e, + i && i(t, e), + r.toLoad--, + r.loaded++ + } + ), (function(e, i) { + r.errors[t] = "Couldn't load binary " + t + ": status " + status + ", " + i, + n && n(t, "Couldn't load binary " + t + ": status " + status + ", " + i), + r.toLoad--, + r.loaded++ + } + )) + } + , + e.prototype.loadText = function(t, i, n) { + var r = this; + void 0 === i && (i = null), + void 0 === n && (n = null), + t = this.pathPrefix + t, + this.toLoad++, + e.downloadText(t, (function(e) { + r.assets[t] = e, + i && i(t, e), + r.toLoad--, + r.loaded++ + } + ), (function(e, i) { + r.errors[t] = "Couldn't load text " + t + ": status " + status + ", " + i, + n && n(t, "Couldn't load text " + t + ": status " + status + ", " + i), + r.toLoad--, + r.loaded++ + } + )) + } + , + e.prototype.loadTexture = function(t, e, i) { + var n = this; + void 0 === e && (e = null), + void 0 === i && (i = null), + t = this.pathPrefix + t, + this.toLoad++; + var r = new Image; + r.crossOrigin = "anonymous", + r.onload = function() { + var i = n.textureLoader(r); + n.assets[t] = i, + n.toLoad--, + n.loaded++, + e && e(t, r) + } + , + r.onerror = function() { + n.errors[t] = "Couldn't load image " + t, + n.toLoad--, + n.loaded++, + i && i(t, "Couldn't load image " + t) + } + , + r.src = t + } + , + e.prototype.loadTextureData = function(t, e, i, n) { + var r = this; + void 0 === i && (i = null), + void 0 === n && (n = null), + t = this.pathPrefix + t, + this.toLoad++; + var s = new Image; + s.onload = function() { + var e = r.textureLoader(s); + r.assets[t] = e, + r.toLoad--, + r.loaded++, + i && i(t, s) + } + , + s.onerror = function() { + r.errors[t] = "Couldn't load image " + t, + r.toLoad--, + r.loaded++, + n && n(t, "Couldn't load image " + t) + } + , + s.src = e + } + , + e.prototype.loadTextureAtlas = function(i, n, r) { + var s = this; + void 0 === n && (n = null), + void 0 === r && (r = null); + var a = i.lastIndexOf("/") >= 0 ? i.substring(0, i.lastIndexOf("/")) : ""; + i = this.pathPrefix + i, + this.toLoad++, + e.downloadText(i, (function(e) { + var o = { + count: 0 + } + , l = new Array; + try { + new t.TextureAtlas(e,function(e) { + l.push(a + "/" + e); + var i = document.createElement("img"); + return i.width = 16, + i.height = 16, + new t.FakeTexture(i) + } + ) + } catch (f) { + var h = f; + return s.errors[i] = "Couldn't load texture atlas " + i + ": " + h.message, + r && r(i, "Couldn't load texture atlas " + i + ": " + h.message), + s.toLoad--, + void s.loaded++ + } + for (var c = function(h) { + var c = !1; + s.loadTexture(h, (function(h) { + if (o.count++, + o.count == l.length) + if (c) + s.errors[i] = "Couldn't load texture atlas page " + h + "} of atlas " + i, + r && r(i, "Couldn't load texture atlas page " + h + " of atlas " + i), + s.toLoad--, + s.loaded++; + else + try { + var u = new t.TextureAtlas(e,function(t) { + return s.get(a + "/" + t) + } + ); + s.assets[i] = u, + n && n(i, u), + s.toLoad--, + s.loaded++ + } catch (f) { + var _ = f; + s.errors[i] = "Couldn't load texture atlas " + i + ": " + _.message, + r && r(i, "Couldn't load texture atlas " + i + ": " + _.message), + s.toLoad--, + s.loaded++ + } + } + ), (function(t) { + c = !0, + o.count++, + o.count == l.length && (s.errors[i] = "Couldn't load texture atlas page " + t + "} of atlas " + i, + r && r(i, "Couldn't load texture atlas page " + t + " of atlas " + i), + s.toLoad--, + s.loaded++) + } + )) + }, u = 0, _ = l; u < _.length; u++) + c(_[u]) + } + ), (function(t, e) { + s.errors[i] = "Couldn't load texture atlas " + i + ": status " + status + ", " + e, + r && r(i, "Couldn't load texture atlas " + i + ": status " + status + ", " + e), + s.toLoad--, + s.loaded++ + } + )) + } + , + e.prototype.get = function(t) { + return t = this.pathPrefix + t, + this.assets[t] + } + , + e.prototype.remove = function(t) { + t = this.pathPrefix + t; + var e = this.assets[t]; + e.dispose && e.dispose(), + this.assets[t] = null + } + , + e.prototype.removeAll = function() { + for (var t in this.assets) { + var e = this.assets[t]; + e.dispose && e.dispose() + } + this.assets = {} + } + , + e.prototype.isLoadingComplete = function() { + return 0 == this.toLoad + } + , + e.prototype.getToLoad = function() { + return this.toLoad + } + , + e.prototype.getLoaded = function() { + return this.loaded + } + , + e.prototype.dispose = function() { + this.removeAll() + } + , + e.prototype.hasErrors = function() { + return Object.keys(this.errors).length > 0 + } + , + e.prototype.getErrors = function() { + return this.errors + } + , + e + } + )(); + t.AssetManager = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t) { + this.atlas = t + } + return e.prototype.newRegionAttachment = function(e, i, n) { + var r = this.atlas.findRegion(n); + if (null == r) + return null; + r.renderObject = r; + var s = new t.RegionAttachment(i); + return s.setRegion(r), + s + } + , + e.prototype.newMeshAttachment = function(e, i, n) { + var r = this.atlas.findRegion(n); + if (null == r) + return null; + r.renderObject = r; + var s = new t.MeshAttachment(i); + return s.region = r, + s + } + , + e.prototype.newBoundingBoxAttachment = function(e, i) { + return new t.BoundingBoxAttachment(i) + } + , + e.prototype.newPathAttachment = function(e, i) { + return new t.PathAttachment(i) + } + , + e.prototype.newPointAttachment = function(e, i) { + return new t.PointAttachment(i) + } + , + e.prototype.newClippingAttachment = function(e, i) { + return new t.ClippingAttachment(i) + } + , + e + } + )(); + t.AtlasAttachmentLoader = e + } + )(r || (r = {})), + (function(t) { + (function(t) { + t[t.Normal = 0] = "Normal", + t[t.Additive = 1] = "Additive", + t[t.Multiply = 2] = "Multiply", + t[t.Screen = 3] = "Screen" + } + )(t.BlendMode || (t.BlendMode = {})) + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t, e, i) { + if (this.children = new Array, + this.x = 0, + this.y = 0, + this.rotation = 0, + this.scaleX = 0, + this.scaleY = 0, + this.shearX = 0, + this.shearY = 0, + this.ax = 0, + this.ay = 0, + this.arotation = 0, + this.ascaleX = 0, + this.ascaleY = 0, + this.ashearX = 0, + this.ashearY = 0, + this.appliedValid = !1, + this.a = 0, + this.b = 0, + this.c = 0, + this.d = 0, + this.worldY = 0, + this.worldX = 0, + this.sorted = !1, + this.active = !1, + null == t) + throw new Error("data cannot be null."); + if (null == e) + throw new Error("skeleton cannot be null."); + this.data = t, + this.skeleton = e, + this.parent = i, + this.setToSetupPose() + } + return e.prototype.isActive = function() { + return this.active + } + , + e.prototype.update = function() { + this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY) + } + , + e.prototype.updateWorldTransform = function() { + this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY) + } + , + e.prototype.updateWorldTransformWith = function(e, i, n, r, s, a, o) { + this.ax = e, + this.ay = i, + this.arotation = n, + this.ascaleX = r, + this.ascaleY = s, + this.ashearX = a, + this.ashearY = o, + this.appliedValid = !0; + var l = this.parent; + if (null == l) { + var h = this.skeleton + , c = n + 90 + o + , u = h.scaleX + , _ = h.scaleY; + return this.a = t.MathUtils.cosDeg(n + a) * r * u, + this.b = t.MathUtils.cosDeg(c) * s * u, + this.c = t.MathUtils.sinDeg(n + a) * r * _, + this.d = t.MathUtils.sinDeg(c) * s * _, + this.worldX = e * u + h.x, + void (this.worldY = i * _ + h.y) + } + var f = l.a + , d = l.b + , p = l.c + , m = l.d; + switch (this.worldX = f * e + d * i + l.worldX, + this.worldY = p * e + m * i + l.worldY, + this.data.transformMode) { + case t.TransformMode.Normal: + c = n + 90 + o; + var y = t.MathUtils.cosDeg(n + a) * r + , v = t.MathUtils.cosDeg(c) * s + , g = t.MathUtils.sinDeg(n + a) * r + , A = t.MathUtils.sinDeg(c) * s; + return this.a = f * y + d * g, + this.b = f * v + d * A, + this.c = p * y + m * g, + void (this.d = p * v + m * A); + case t.TransformMode.OnlyTranslation: + c = n + 90 + o, + this.a = t.MathUtils.cosDeg(n + a) * r, + this.b = t.MathUtils.cosDeg(c) * s, + this.c = t.MathUtils.sinDeg(n + a) * r, + this.d = t.MathUtils.sinDeg(c) * s; + break; + case t.TransformMode.NoRotationOrReflection: + var x = 0; + (T = f * f + p * p) > 1e-4 ? (d = p * (T = Math.abs(f * m - d * p) / T), + m = f * T, + x = Math.atan2(p, f) * t.MathUtils.radDeg) : (f = 0, + p = 0, + x = 90 - Math.atan2(m, d) * t.MathUtils.radDeg); + var b = n + a - x + , C = n + o - x + 90; + y = t.MathUtils.cosDeg(b) * r, + v = t.MathUtils.cosDeg(C) * s, + g = t.MathUtils.sinDeg(b) * r, + A = t.MathUtils.sinDeg(C) * s, + this.a = f * y - d * g, + this.b = f * v - d * A, + this.c = p * y + m * g, + this.d = p * v + m * A; + break; + case t.TransformMode.NoScale: + case t.TransformMode.NoScaleOrReflection: + var T, S = t.MathUtils.cosDeg(n), w = t.MathUtils.sinDeg(n), E = (f * S + d * w) / this.skeleton.scaleX, M = (p * S + m * w) / this.skeleton.scaleY; + (T = Math.sqrt(E * E + M * M)) > 1e-5 && (T = 1 / T), + E *= T, + M *= T, + T = Math.sqrt(E * E + M * M), + this.data.transformMode == t.TransformMode.NoScale && f * m - d * p < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0) && (T = -T); + var D = Math.PI / 2 + Math.atan2(M, E) + , B = Math.cos(D) * T + , I = Math.sin(D) * T; + y = t.MathUtils.cosDeg(a) * r, + v = t.MathUtils.cosDeg(90 + o) * s, + g = t.MathUtils.sinDeg(a) * r, + A = t.MathUtils.sinDeg(90 + o) * s, + this.a = E * y + B * g, + this.b = E * v + B * A, + this.c = M * y + I * g, + this.d = M * v + I * A + } + this.a *= this.skeleton.scaleX, + this.b *= this.skeleton.scaleX, + this.c *= this.skeleton.scaleY, + this.d *= this.skeleton.scaleY + } + , + e.prototype.setToSetupPose = function() { + var t = this.data; + this.x = t.x, + this.y = t.y, + this.rotation = t.rotation, + this.scaleX = t.scaleX, + this.scaleY = t.scaleY, + this.shearX = t.shearX, + this.shearY = t.shearY + } + , + e.prototype.getWorldRotationX = function() { + return Math.atan2(this.c, this.a) * t.MathUtils.radDeg + } + , + e.prototype.getWorldRotationY = function() { + return Math.atan2(this.d, this.b) * t.MathUtils.radDeg + } + , + e.prototype.getWorldScaleX = function() { + return Math.sqrt(this.a * this.a + this.c * this.c) + } + , + e.prototype.getWorldScaleY = function() { + return Math.sqrt(this.b * this.b + this.d * this.d) + } + , + e.prototype.updateAppliedTransform = function() { + this.appliedValid = !0; + var e = this.parent; + if (null == e) + return this.ax = this.worldX, + this.ay = this.worldY, + this.arotation = Math.atan2(this.c, this.a) * t.MathUtils.radDeg, + this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c), + this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d), + this.ashearX = 0, + void (this.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * t.MathUtils.radDeg); + var i = e.a + , n = e.b + , r = e.c + , s = e.d + , a = 1 / (i * s - n * r) + , o = this.worldX - e.worldX + , l = this.worldY - e.worldY; + this.ax = o * s * a - l * n * a, + this.ay = l * i * a - o * r * a; + var h = a * s + , c = a * i + , u = a * n + , _ = a * r + , f = h * this.a - u * this.c + , d = h * this.b - u * this.d + , p = c * this.c - _ * this.a + , m = c * this.d - _ * this.b; + if (this.ashearX = 0, + this.ascaleX = Math.sqrt(f * f + p * p), + this.ascaleX > 1e-4) { + var y = f * m - d * p; + this.ascaleY = y / this.ascaleX, + this.ashearY = Math.atan2(f * d + p * m, y) * t.MathUtils.radDeg, + this.arotation = Math.atan2(p, f) * t.MathUtils.radDeg + } else + this.ascaleX = 0, + this.ascaleY = Math.sqrt(d * d + m * m), + this.ashearY = 0, + this.arotation = 90 - Math.atan2(m, d) * t.MathUtils.radDeg + } + , + e.prototype.worldToLocal = function(t) { + var e = this.a + , i = this.b + , n = this.c + , r = this.d + , s = 1 / (e * r - i * n) + , a = t.x - this.worldX + , o = t.y - this.worldY; + return t.x = a * r * s - o * i * s, + t.y = o * e * s - a * n * s, + t + } + , + e.prototype.localToWorld = function(t) { + var e = t.x + , i = t.y; + return t.x = e * this.a + i * this.b + this.worldX, + t.y = e * this.c + i * this.d + this.worldY, + t + } + , + e.prototype.worldToLocalRotation = function(e) { + var i = t.MathUtils.sinDeg(e) + , n = t.MathUtils.cosDeg(e); + return Math.atan2(this.a * i - this.c * n, this.d * n - this.b * i) * t.MathUtils.radDeg + this.rotation - this.shearX + } + , + e.prototype.localToWorldRotation = function(e) { + e -= this.rotation - this.shearX; + var i = t.MathUtils.sinDeg(e) + , n = t.MathUtils.cosDeg(e); + return Math.atan2(n * this.c + i * this.d, n * this.a + i * this.b) * t.MathUtils.radDeg + } + , + e.prototype.rotateWorld = function(e) { + var i = this.a + , n = this.b + , r = this.c + , s = this.d + , a = t.MathUtils.cosDeg(e) + , o = t.MathUtils.sinDeg(e); + this.a = a * i - o * r, + this.b = a * n - o * s, + this.c = o * i + a * r, + this.d = o * n + a * s, + this.appliedValid = !1 + } + , + e + } + )(); + t.Bone = e + } + )(r || (r = {})), + (function(t) { + var e; + t.BoneData = function(i, n, r) { + if (this.x = 0, + this.y = 0, + this.rotation = 0, + this.scaleX = 1, + this.scaleY = 1, + this.shearX = 0, + this.shearY = 0, + this.transformMode = e.Normal, + this.skinRequired = !1, + this.color = new t.Color, + i < 0) + throw new Error("index must be >= 0."); + if (null == n) + throw new Error("name cannot be null."); + this.index = i, + this.name = n, + this.parent = r + } + , + (function(t) { + t[t.Normal = 0] = "Normal", + t[t.OnlyTranslation = 1] = "OnlyTranslation", + t[t.NoRotationOrReflection = 2] = "NoRotationOrReflection", + t[t.NoScale = 3] = "NoScale", + t[t.NoScaleOrReflection = 4] = "NoScaleOrReflection" + } + )(e = t.TransformMode || (t.TransformMode = {})) + } + )(r || (r = {})), + (function(t) { + t.ConstraintData = function(t, e, i) { + this.name = t, + this.order = e, + this.skinRequired = i + } + } + )(r || (r = {})), + (function(t) { + t.Event = function(t, e) { + if (null == e) + throw new Error("data cannot be null."); + this.time = t, + this.data = e + } + } + )(r || (r = {})), + (function(t) { + t.EventData = function(t) { + this.name = t + } + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t, e) { + if (this.bendDirection = 0, + this.compress = !1, + this.stretch = !1, + this.mix = 1, + this.softness = 0, + this.active = !1, + null == t) + throw new Error("data cannot be null."); + if (null == e) + throw new Error("skeleton cannot be null."); + this.data = t, + this.mix = t.mix, + this.softness = t.softness, + this.bendDirection = t.bendDirection, + this.compress = t.compress, + this.stretch = t.stretch, + this.bones = new Array; + for (var i = 0; i < t.bones.length; i++) + this.bones.push(e.findBone(t.bones[i].name)); + this.target = e.findBone(t.target.name) + } + return e.prototype.isActive = function() { + return this.active + } + , + e.prototype.apply = function() { + this.update() + } + , + e.prototype.update = function() { + var t = this.target + , e = this.bones; + switch (e.length) { + case 1: + this.apply1(e[0], t.worldX, t.worldY, this.compress, this.stretch, this.data.uniform, this.mix); + break; + case 2: + this.apply2(e[0], e[1], t.worldX, t.worldY, this.bendDirection, this.stretch, this.softness, this.mix) + } + } + , + e.prototype.apply1 = function(e, i, n, r, s, a, o) { + e.appliedValid || e.updateAppliedTransform(); + var l = e.parent + , h = 1 / (l.a * l.d - l.b * l.c) + , c = i - l.worldX + , u = n - l.worldY + , _ = (c * l.d - u * l.b) * h - e.ax + , f = (u * l.a - c * l.c) * h - e.ay + , d = Math.atan2(f, _) * t.MathUtils.radDeg - e.ashearX - e.arotation; + e.ascaleX < 0 && (d += 180), + d > 180 ? d -= 360 : d < -180 && (d += 360); + var p = e.ascaleX + , m = e.ascaleY; + if (r || s) { + var y = e.data.length * p + , v = Math.sqrt(_ * _ + f * f); + if (r && v < y || s && v > y && y > 1e-4) { + var g = (v / y - 1) * o + 1; + p *= g, + a && (m *= g) + } + } + e.updateWorldTransformWith(e.ax, e.ay, e.arotation + d * o, p, m, e.ashearX, e.ashearY) + } + , + e.prototype.apply2 = function(e, i, n, r, s, a, o, l) { + if (0 != l) { + e.appliedValid || e.updateAppliedTransform(), + i.appliedValid || i.updateAppliedTransform(); + var h = e.ax + , c = e.ay + , u = e.ascaleX + , _ = u + , f = e.ascaleY + , d = i.ascaleX + , p = 0 + , m = 0 + , y = 0; + u < 0 ? (u = -u, + p = 180, + y = -1) : (p = 0, + y = 1), + f < 0 && (f = -f, + y = -y), + d < 0 ? (d = -d, + m = 180) : m = 0; + var v = i.ax + , g = 0 + , A = 0 + , x = 0 + , b = e.a + , C = e.b + , T = e.c + , S = e.d + , w = Math.abs(u - f) <= 1e-4; + w ? (A = b * v + C * (g = i.ay) + e.worldX, + x = T * v + S * g + e.worldY) : (g = 0, + A = b * v + e.worldX, + x = T * v + e.worldY); + var E = e.parent; + b = E.a, + C = E.b, + T = E.c; + var M, D, B = 1 / (b * (S = E.d) - C * T), I = A - E.worldX, P = x - E.worldY, R = (I * S - P * C) * B - h, O = (P * b - I * T) * B - c, L = Math.sqrt(R * R + O * O), F = i.data.length * d; + if (L < 1e-4) + return this.apply1(e, n, r, !1, a, !1, l), + void i.updateWorldTransformWith(v, g, 0, i.ascaleX, i.ascaleY, i.ashearX, i.ashearY); + var V = ((I = n - E.worldX) * S - (P = r - E.worldY) * C) * B - h + , N = (P * b - I * T) * B - c + , k = V * V + N * N; + if (0 != o) { + o *= u * (d + 1) / 2; + var G = Math.sqrt(k) + , U = G - L - F * u + o; + if (U > 0) { + var z = Math.min(1, U / (2 * o)) - 1; + k = (V -= (z = (U - o * (1 - z * z)) / G) * V) * V + (N -= z * N) * N + } + } + t: if (w) { + var H = (k - L * L - (F *= u) * F) / (2 * L * F); + H < -1 ? H = -1 : H > 1 && (H = 1, + a && (_ *= (Math.sqrt(k) / (L + F) - 1) * l + 1)), + D = Math.acos(H) * s, + b = L + F * H, + C = F * Math.sin(D), + M = Math.atan2(N * b - V * C, V * b + N * C) + } else { + var W = (b = u * F) * b + , j = (C = f * F) * C + , X = Math.atan2(N, V) + , Y = -2 * j * L + , q = j - W; + if ((S = Y * Y - 4 * q * (T = j * L * L + W * k - W * j)) >= 0) { + var J = Math.sqrt(S); + Y < 0 && (J = -J); + var Z = (J = -(Y + J) / 2) / q + , K = T / J + , Q = Math.abs(Z) < Math.abs(K) ? Z : K; + if (Q * Q <= k) { + P = Math.sqrt(k - Q * Q) * s, + M = X - Math.atan2(P, Q), + D = Math.atan2(P / f, (Q - L) / u); + break t + } + } + var $ = t.MathUtils.PI + , tt = L - b + , et = tt * tt + , it = 0 + , nt = 0 + , rt = L + b + , st = rt * rt + , at = 0; + (T = -b * L / (W - j)) >= -1 && T <= 1 && (T = Math.acos(T), + (S = (I = b * Math.cos(T) + L) * I + (P = C * Math.sin(T)) * P) < et && ($ = T, + et = S, + tt = I, + it = P), + S > st && (nt = T, + st = S, + rt = I, + at = P)), + k <= (et + st) / 2 ? (M = X - Math.atan2(it * s, tt), + D = $ * s) : (M = X - Math.atan2(at * s, rt), + D = nt * s) + } + var ot = Math.atan2(g, v) * y + , lt = e.arotation; + (M = (M - ot) * t.MathUtils.radDeg + p - lt) > 180 ? M -= 360 : M < -180 && (M += 360), + e.updateWorldTransformWith(h, c, lt + M * l, _, e.ascaleY, 0, 0), + lt = i.arotation, + (D = ((D + ot) * t.MathUtils.radDeg - i.ashearX) * y + m - lt) > 180 ? D -= 360 : D < -180 && (D += 360), + i.updateWorldTransformWith(v, g, lt + D * l, i.ascaleX, i.ascaleY, i.ashearX, i.ashearY) + } else + i.updateWorldTransform() + } + , + e + } + )(); + t.IkConstraint = e + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e(e) { + var i = t.call(this, e, 0, !1) || this; + return i.bones = new Array, + i.bendDirection = 1, + i.compress = !1, + i.stretch = !1, + i.uniform = !1, + i.mix = 1, + i.softness = 0, + i + } + return s(e, t), + e + } + )(t.ConstraintData); + t.IkConstraintData = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t, e) { + if (this.position = 0, + this.spacing = 0, + this.rotateMix = 0, + this.translateMix = 0, + this.spaces = new Array, + this.positions = new Array, + this.world = new Array, + this.curves = new Array, + this.lengths = new Array, + this.segments = new Array, + this.active = !1, + null == t) + throw new Error("data cannot be null."); + if (null == e) + throw new Error("skeleton cannot be null."); + this.data = t, + this.bones = new Array; + for (var i = 0, n = t.bones.length; i < n; i++) + this.bones.push(e.findBone(t.bones[i].name)); + this.target = e.findSlot(t.target.name), + this.position = t.position, + this.spacing = t.spacing, + this.rotateMix = t.rotateMix, + this.translateMix = t.translateMix + } + return e.prototype.isActive = function() { + return this.active + } + , + e.prototype.apply = function() { + this.update() + } + , + e.prototype.update = function() { + var i = this.target.getAttachment(); + if (i instanceof t.PathAttachment) { + var n = this.rotateMix + , r = this.translateMix + , s = n > 0; + if (r > 0 || s) { + var a = this.data + , o = a.spacingMode == t.SpacingMode.Percent + , l = a.rotateMode + , h = l == t.RotateMode.Tangent + , c = l == t.RotateMode.ChainScale + , u = this.bones.length + , _ = h ? u : u + 1 + , f = this.bones + , d = t.Utils.setArraySize(this.spaces, _) + , p = null + , m = this.spacing; + if (c || !o) { + c && (p = t.Utils.setArraySize(this.lengths, u)); + for (var y = a.spacingMode == t.SpacingMode.Length, v = 0, g = _ - 1; v < g; ) { + var A = (I = f[v]).data.length; + if (A < e.epsilon) + c && (p[v] = 0), + d[++v] = 0; + else if (o) { + if (c) { + var x = A * I.a + , b = A * I.c + , C = Math.sqrt(x * x + b * b); + p[v] = C + } + d[++v] = m + } else { + x = A * I.a, + b = A * I.c; + var T = Math.sqrt(x * x + b * b); + c && (p[v] = T), + d[++v] = (y ? A + m : m) * T / A + } + } + } else + for (v = 1; v < _; v++) + d[v] = m; + var S = this.computeWorldPositions(i, _, h, a.positionMode == t.PositionMode.Percent, o) + , w = S[0] + , E = S[1] + , M = a.offsetRotation + , D = !1; + 0 == M ? D = l == t.RotateMode.Chain : (D = !1, + M *= (B = this.target.bone).a * B.d - B.b * B.c > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad), + v = 0; + for (var B = 3; v < u; v++, + B += 3) { + var I; + (I = f[v]).worldX += (w - I.worldX) * r, + I.worldY += (E - I.worldY) * r; + var P = (x = S[B]) - w + , R = (b = S[B + 1]) - E; + if (c) { + var O = p[v]; + if (0 != O) { + var L = (Math.sqrt(P * P + R * R) / O - 1) * n + 1; + I.a *= L, + I.c *= L + } + } + if (w = x, + E = b, + s) { + var F = I.a + , V = I.b + , N = I.c + , k = I.d + , G = 0 + , U = 0 + , z = 0; + if (G = h ? S[B - 1] : 0 == d[v + 1] ? S[B + 2] : Math.atan2(R, P), + G -= Math.atan2(N, F), + D) { + U = Math.cos(G), + z = Math.sin(G); + var H = I.data.length; + w += (H * (U * F - z * N) - P) * n, + E += (H * (z * F + U * N) - R) * n + } else + G += M; + G > t.MathUtils.PI ? G -= t.MathUtils.PI2 : G < -t.MathUtils.PI && (G += t.MathUtils.PI2), + G *= n, + U = Math.cos(G), + z = Math.sin(G), + I.a = U * F - z * N, + I.b = U * V - z * k, + I.c = z * F + U * N, + I.d = z * V + U * k + } + I.appliedValid = !1 + } + } + } + } + , + e.prototype.computeWorldPositions = function(i, n, r, s, a) { + var o = this.target + , l = this.position + , h = this.spaces + , c = t.Utils.setArraySize(this.positions, 3 * n + 2) + , u = null + , _ = i.closed + , f = i.worldVerticesLength + , d = f / 6 + , p = e.NONE; + if (!i.constantSpeed) { + var m = i.lengths + , y = m[d -= _ ? 1 : 2]; + if (s && (l *= y), + a) + for (var v = 1; v < n; v++) + h[v] *= y; + u = t.Utils.setArraySize(this.world, 8), + v = 0; + for (var g = 0, A = 0; v < n; v++, + g += 3) { + var x = l += j = h[v]; + if (_) + (x %= y) < 0 && (x += y), + A = 0; + else { + if (x < 0) { + p != e.BEFORE && (p = e.BEFORE, + i.computeWorldVertices(o, 2, 4, u, 0, 2)), + this.addBeforePosition(x, u, 0, c, g); + continue + } + if (x > y) { + p != e.AFTER && (p = e.AFTER, + i.computeWorldVertices(o, f - 6, 4, u, 0, 2)), + this.addAfterPosition(x - y, u, 0, c, g); + continue + } + } + for (; ; A++) { + var b = m[A]; + if (!(x > b)) { + 0 == A ? x /= b : x = (x - (J = m[A - 1])) / (b - J); + break + } + } + A != p && (p = A, + _ && A == d ? (i.computeWorldVertices(o, f - 4, 4, u, 0, 2), + i.computeWorldVertices(o, 0, 4, u, 4, 2)) : i.computeWorldVertices(o, 6 * A + 2, 8, u, 0, 2)), + this.addCurvePosition(x, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], c, g, r || v > 0 && 0 == j) + } + return c + } + _ ? (f += 2, + u = t.Utils.setArraySize(this.world, f), + i.computeWorldVertices(o, 2, f - 4, u, 0, 2), + i.computeWorldVertices(o, 0, 2, u, f - 4, 2), + u[f - 2] = u[0], + u[f - 1] = u[1]) : (d--, + f -= 4, + u = t.Utils.setArraySize(this.world, f), + i.computeWorldVertices(o, 2, f, u, 0, 2)); + for (var C = t.Utils.setArraySize(this.curves, d), T = 0, S = u[0], w = u[1], E = 0, M = 0, D = 0, B = 0, I = 0, P = 0, R = 0, O = 0, L = 0, F = 0, V = 0, N = 0, k = 0, G = 0, U = (v = 0, + 2); v < d; v++, + U += 6) + E = u[U], + M = u[U + 1], + D = u[U + 2], + B = u[U + 3], + V = 2 * (R = .1875 * (S - 2 * E + D)) + (L = .09375 * (3 * (E - D) - S + (I = u[U + 4]))), + N = 2 * (O = .1875 * (w - 2 * M + B)) + (F = .09375 * (3 * (M - B) - w + (P = u[U + 5]))), + k = .75 * (E - S) + R + .16666667 * L, + G = .75 * (M - w) + O + .16666667 * F, + T += Math.sqrt(k * k + G * G), + k += V, + G += N, + V += L, + N += F, + T += Math.sqrt(k * k + G * G), + k += V, + G += N, + T += Math.sqrt(k * k + G * G), + k += V + L, + G += N + F, + T += Math.sqrt(k * k + G * G), + C[v] = T, + S = I, + w = P; + if (l *= s ? T : T / i.lengths[d - 1], + a) + for (v = 1; v < n; v++) + h[v] *= T; + for (var z = this.segments, H = 0, W = (v = 0, + g = 0, + A = 0, + 0); v < n; v++, + g += 3) { + var j; + if (x = l += j = h[v], + _) + (x %= T) < 0 && (x += T), + A = 0; + else { + if (x < 0) { + this.addBeforePosition(x, u, 0, c, g); + continue + } + if (x > T) { + this.addAfterPosition(x - T, u, f - 4, c, g); + continue + } + } + for (; ; A++) { + var X = C[A]; + if (!(x > X)) { + 0 == A ? x /= X : x = (x - (J = C[A - 1])) / (X - J); + break + } + } + if (A != p) { + p = A; + var Y = 6 * A; + for (S = u[Y], + w = u[Y + 1], + E = u[Y + 2], + M = u[Y + 3], + D = u[Y + 4], + B = u[Y + 5], + V = 2 * (R = .03 * (S - 2 * E + D)) + (L = .006 * (3 * (E - D) - S + (I = u[Y + 6]))), + N = 2 * (O = .03 * (w - 2 * M + B)) + (F = .006 * (3 * (M - B) - w + (P = u[Y + 7]))), + k = .3 * (E - S) + R + .16666667 * L, + G = .3 * (M - w) + O + .16666667 * F, + H = Math.sqrt(k * k + G * G), + z[0] = H, + Y = 1; Y < 8; Y++) + k += V, + G += N, + V += L, + N += F, + H += Math.sqrt(k * k + G * G), + z[Y] = H; + k += V, + G += N, + H += Math.sqrt(k * k + G * G), + z[8] = H, + k += V + L, + G += N + F, + H += Math.sqrt(k * k + G * G), + z[9] = H, + W = 0 + } + for (x *= H; ; W++) { + var q = z[W]; + if (!(x > q)) { + var J; + 0 == W ? x /= q : x = W + (x - (J = z[W - 1])) / (q - J); + break + } + } + this.addCurvePosition(.1 * x, S, w, E, M, D, B, I, P, c, g, r || v > 0 && 0 == j) + } + return c + } + , + e.prototype.addBeforePosition = function(t, e, i, n, r) { + var s = e[i] + , a = e[i + 1] + , o = e[i + 2] - s + , l = e[i + 3] - a + , h = Math.atan2(l, o); + n[r] = s + t * Math.cos(h), + n[r + 1] = a + t * Math.sin(h), + n[r + 2] = h + } + , + e.prototype.addAfterPosition = function(t, e, i, n, r) { + var s = e[i + 2] + , a = e[i + 3] + , o = s - e[i] + , l = a - e[i + 1] + , h = Math.atan2(l, o); + n[r] = s + t * Math.cos(h), + n[r + 1] = a + t * Math.sin(h), + n[r + 2] = h + } + , + e.prototype.addCurvePosition = function(t, e, i, n, r, s, a, o, l, h, c, u) { + if (0 == t || isNaN(t)) + return h[c] = e, + h[c + 1] = i, + void (h[c + 2] = Math.atan2(r - i, n - e)); + var _ = t * t + , f = _ * t + , d = 1 - t + , p = d * d + , m = p * d + , y = d * t + , v = 3 * y + , g = d * v + , A = v * t + , x = e * m + n * g + s * A + o * f + , b = i * m + r * g + a * A + l * f; + h[c] = x, + h[c + 1] = b, + u && (h[c + 2] = t < .001 ? Math.atan2(r - i, n - e) : Math.atan2(b - (i * p + r * y * 2 + a * _), x - (e * p + n * y * 2 + s * _))) + } + , + e.NONE = -1, + e.BEFORE = -2, + e.AFTER = -3, + e.epsilon = 1e-5, + e + } + )(); + t.PathConstraint = e + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e(e) { + var i = t.call(this, e, 0, !1) || this; + return i.bones = new Array, + i + } + return s(e, t), + e + } + )(t.ConstraintData); + t.PathConstraintData = e, + (function(t) { + t[t.Fixed = 0] = "Fixed", + t[t.Percent = 1] = "Percent" + } + )(t.PositionMode || (t.PositionMode = {})), + (function(t) { + t[t.Length = 0] = "Length", + t[t.Fixed = 1] = "Fixed", + t[t.Percent = 2] = "Percent" + } + )(t.SpacingMode || (t.SpacingMode = {})), + (function(t) { + t[t.Tangent = 0] = "Tangent", + t[t.Chain = 1] = "Chain", + t[t.ChainScale = 2] = "ChainScale" + } + )(t.RotateMode || (t.RotateMode = {})) + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t(t) { + this.toLoad = new Array, + this.assets = {}, + this.clientId = t + } + return t.prototype.loaded = function() { + var t = 0; + for (var e in this.assets) + t++; + return t + } + , + t + } + )() + , i = (function() { + function t(t) { + void 0 === t && (t = ""), + this.clientAssets = {}, + this.queuedAssets = {}, + this.rawAssets = {}, + this.errors = {}, + this.pathPrefix = t + } + return t.prototype.queueAsset = function(t, i, n) { + var r = this.clientAssets[t]; + return null == r && (r = new e(t), + this.clientAssets[t] = r), + null !== i && (r.textureLoader = i), + r.toLoad.push(n), + this.queuedAssets[n] !== n && (this.queuedAssets[n] = n, + !0) + } + , + t.prototype.loadText = function(t, e) { + var i = this; + if (e = this.pathPrefix + e, + this.queueAsset(t, null, e)) { + var n = new XMLHttpRequest; + n.onreadystatechange = function() { + n.readyState == XMLHttpRequest.DONE && (n.status >= 200 && n.status < 300 ? i.rawAssets[e] = n.responseText : i.errors[e] = "Couldn't load text " + e + ": status " + n.status + ", " + n.responseText) + } + , + n.open("GET", e, !0), + n.send() + } + } + , + t.prototype.loadJson = function(t, e) { + var i = this; + if (e = this.pathPrefix + e, + this.queueAsset(t, null, e)) { + var n = new XMLHttpRequest; + n.onreadystatechange = function() { + n.readyState == XMLHttpRequest.DONE && (n.status >= 200 && n.status < 300 ? i.rawAssets[e] = JSON.parse(n.responseText) : i.errors[e] = "Couldn't load text " + e + ": status " + n.status + ", " + n.responseText) + } + , + n.open("GET", e, !0), + n.send() + } + } + , + t.prototype.loadTexture = function(t, e, i) { + var n = this; + if (i = this.pathPrefix + i, + this.queueAsset(t, e, i)) { + var r = new Image; + r.src = i, + r.crossOrigin = "anonymous", + r.onload = function() { + n.rawAssets[i] = r + } + , + r.onerror = function() { + n.errors[i] = "Couldn't load image " + i + } + } + } + , + t.prototype.get = function(t, e) { + e = this.pathPrefix + e; + var i = this.clientAssets[t]; + return null == i || i.assets[e] + } + , + t.prototype.updateClientAssets = function(t) { + for (var e = 0; e < t.toLoad.length; e++) { + var i = t.toLoad[e]; + if (null == t.assets[i]) { + var n = this.rawAssets[i]; + if (null == n) + continue; + n instanceof HTMLImageElement ? t.assets[i] = t.textureLoader(n) : t.assets[i] = n + } + } + } + , + t.prototype.isLoadingComplete = function(t) { + var e = this.clientAssets[t]; + return null == e || (this.updateClientAssets(e), + e.toLoad.length == e.loaded()) + } + , + t.prototype.dispose = function() {} + , + t.prototype.hasErrors = function() { + return Object.keys(this.errors).length > 0 + } + , + t.prototype.getErrors = function() { + return this.errors + } + , + t + } + )(); + t.SharedAssetManager = i + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(e) { + if (this._updateCache = new Array, + this.updateCacheReset = new Array, + this.time = 0, + this.scaleX = 1, + this.scaleY = 1, + this.x = 0, + this.y = 0, + null == e) + throw new Error("data cannot be null."); + this.data = e, + this.bones = new Array; + for (var i = 0; i < e.bones.length; i++) { + var n = e.bones[i] + , r = void 0; + if (null == n.parent) + r = new t.Bone(n,this,null); + else { + var s = this.bones[n.parent.index]; + r = new t.Bone(n,this,s), + s.children.push(r) + } + this.bones.push(r) + } + for (this.slots = new Array, + this.drawOrder = new Array, + i = 0; i < e.slots.length; i++) { + var a = e.slots[i] + , o = (r = this.bones[a.boneData.index], + new t.Slot(a,r)); + this.slots.push(o), + this.drawOrder.push(o) + } + for (this.ikConstraints = new Array, + i = 0; i < e.ikConstraints.length; i++) { + var l = e.ikConstraints[i]; + this.ikConstraints.push(new t.IkConstraint(l,this)) + } + for (this.transformConstraints = new Array, + i = 0; i < e.transformConstraints.length; i++) { + var h = e.transformConstraints[i]; + this.transformConstraints.push(new t.TransformConstraint(h,this)) + } + for (this.pathConstraints = new Array, + i = 0; i < e.pathConstraints.length; i++) { + var c = e.pathConstraints[i]; + this.pathConstraints.push(new t.PathConstraint(c,this)) + } + this.color = new t.Color(1,1,1,1), + this.updateCache() + } + return e.prototype.updateCache = function() { + this._updateCache.length = 0, + this.updateCacheReset.length = 0; + for (var t = this.bones, e = 0, i = t.length; e < i; e++) + (r = t[e]).sorted = r.data.skinRequired, + r.active = !r.sorted; + if (null != this.skin) { + var n = this.skin.bones; + for (e = 0, + i = this.skin.bones.length; e < i; e++) { + var r = this.bones[n[e].index]; + do { + r.sorted = !1, + r.active = !0, + r = r.parent + } while (null != r) + } + } + var s = this.ikConstraints + , a = this.transformConstraints + , o = this.pathConstraints + , l = s.length + , h = a.length + , c = o.length + , u = l + h + c; + t: for (e = 0; e < u; e++) { + for (var _ = 0; _ < l; _++) + if ((f = s[_]).data.order == e) { + this.sortIkConstraint(f); + continue t + } + for (_ = 0; _ < h; _++) + if ((f = a[_]).data.order == e) { + this.sortTransformConstraint(f); + continue t + } + for (_ = 0; _ < c; _++) { + var f; + if ((f = o[_]).data.order == e) { + this.sortPathConstraint(f); + continue t + } + } + } + for (e = 0, + i = t.length; e < i; e++) + this.sortBone(t[e]) + } + , + e.prototype.sortIkConstraint = function(e) { + if (e.active = e.target.isActive() && (!e.data.skinRequired || null != this.skin && t.Utils.contains(this.skin.constraints, e.data, !0)), + e.active) { + var i = e.target; + this.sortBone(i); + var n = e.bones + , r = n[0]; + if (this.sortBone(r), + n.length > 1) { + var s = n[n.length - 1]; + this._updateCache.indexOf(s) > -1 || this.updateCacheReset.push(s) + } + this._updateCache.push(e), + this.sortReset(r.children), + n[n.length - 1].sorted = !0 + } + } + , + e.prototype.sortPathConstraint = function(e) { + if (e.active = e.target.bone.isActive() && (!e.data.skinRequired || null != this.skin && t.Utils.contains(this.skin.constraints, e.data, !0)), + e.active) { + var i = e.target + , n = i.data.index + , r = i.bone; + null != this.skin && this.sortPathConstraintAttachment(this.skin, n, r), + null != this.data.defaultSkin && this.data.defaultSkin != this.skin && this.sortPathConstraintAttachment(this.data.defaultSkin, n, r); + for (var s = 0, a = this.data.skins.length; s < a; s++) + this.sortPathConstraintAttachment(this.data.skins[s], n, r); + var o = i.getAttachment(); + o instanceof t.PathAttachment && this.sortPathConstraintAttachmentWith(o, r); + var l = e.bones + , h = l.length; + for (s = 0; s < h; s++) + this.sortBone(l[s]); + for (this._updateCache.push(e), + s = 0; s < h; s++) + this.sortReset(l[s].children); + for (s = 0; s < h; s++) + l[s].sorted = !0 + } + } + , + e.prototype.sortTransformConstraint = function(e) { + if (e.active = e.target.isActive() && (!e.data.skinRequired || null != this.skin && t.Utils.contains(this.skin.constraints, e.data, !0)), + e.active) { + this.sortBone(e.target); + var i = e.bones + , n = i.length; + if (e.data.local) + for (var r = 0; r < n; r++) { + var s = i[r]; + this.sortBone(s.parent), + this._updateCache.indexOf(s) > -1 || this.updateCacheReset.push(s) + } + else + for (r = 0; r < n; r++) + this.sortBone(i[r]); + this._updateCache.push(e); + for (var a = 0; a < n; a++) + this.sortReset(i[a].children); + for (a = 0; a < n; a++) + i[a].sorted = !0 + } + } + , + e.prototype.sortPathConstraintAttachment = function(t, e, i) { + var n = t.attachments[e]; + if (n) + for (var r in n) + this.sortPathConstraintAttachmentWith(n[r], i) + } + , + e.prototype.sortPathConstraintAttachmentWith = function(e, i) { + if (e instanceof t.PathAttachment) { + var n = e.bones; + if (null == n) + this.sortBone(i); + else + for (var r = this.bones, s = 0; s < n.length; ) + for (var a = n[s++], o = s + a; s < o; s++) { + var l = n[s]; + this.sortBone(r[l]) + } + } + } + , + e.prototype.sortBone = function(t) { + if (!t.sorted) { + var e = t.parent; + null != e && this.sortBone(e), + t.sorted = !0, + this._updateCache.push(t) + } + } + , + e.prototype.sortReset = function(t) { + for (var e = 0, i = t.length; e < i; e++) { + var n = t[e]; + n.active && (n.sorted && this.sortReset(n.children), + n.sorted = !1) + } + } + , + e.prototype.updateWorldTransform = function() { + for (var t = this.updateCacheReset, e = 0, i = t.length; e < i; e++) { + var n = t[e]; + n.ax = n.x, + n.ay = n.y, + n.arotation = n.rotation, + n.ascaleX = n.scaleX, + n.ascaleY = n.scaleY, + n.ashearX = n.shearX, + n.ashearY = n.shearY, + n.appliedValid = !0 + } + var r = this._updateCache; + for (e = 0, + i = r.length; e < i; e++) + r[e].update() + } + , + e.prototype.setToSetupPose = function() { + this.setBonesToSetupPose(), + this.setSlotsToSetupPose() + } + , + e.prototype.setBonesToSetupPose = function() { + for (var t = this.bones, e = 0, i = t.length; e < i; e++) + t[e].setToSetupPose(); + var n = this.ikConstraints; + for (e = 0, + i = n.length; e < i; e++) + (o = n[e]).mix = o.data.mix, + o.softness = o.data.softness, + o.bendDirection = o.data.bendDirection, + o.compress = o.data.compress, + o.stretch = o.data.stretch; + var r = this.transformConstraints; + for (e = 0, + i = r.length; e < i; e++) { + var s = (o = r[e]).data; + o.rotateMix = s.rotateMix, + o.translateMix = s.translateMix, + o.scaleMix = s.scaleMix, + o.shearMix = s.shearMix + } + var a = this.pathConstraints; + for (e = 0, + i = a.length; e < i; e++) { + var o; + s = (o = a[e]).data, + o.position = s.position, + o.spacing = s.spacing, + o.rotateMix = s.rotateMix, + o.translateMix = s.translateMix + } + } + , + e.prototype.setSlotsToSetupPose = function() { + var e = this.slots; + t.Utils.arrayCopy(e, 0, this.drawOrder, 0, e.length); + for (var i = 0, n = e.length; i < n; i++) + e[i].setToSetupPose() + } + , + e.prototype.getRootBone = function() { + return 0 == this.bones.length ? null : this.bones[0] + } + , + e.prototype.findBone = function(t) { + if (null == t) + throw new Error("boneName cannot be null."); + for (var e = this.bones, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.data.name == t) + return r + } + return null + } + , + e.prototype.findBoneIndex = function(t) { + if (null == t) + throw new Error("boneName cannot be null."); + for (var e = this.bones, i = 0, n = e.length; i < n; i++) + if (e[i].data.name == t) + return i; + return -1 + } + , + e.prototype.findSlot = function(t) { + if (null == t) + throw new Error("slotName cannot be null."); + for (var e = this.slots, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.data.name == t) + return r + } + return null + } + , + e.prototype.findSlotIndex = function(t) { + if (null == t) + throw new Error("slotName cannot be null."); + for (var e = this.slots, i = 0, n = e.length; i < n; i++) + if (e[i].data.name == t) + return i; + return -1 + } + , + e.prototype.setSkinByName = function(t) { + var e = this.data.findSkin(t); + if (null == e) + throw new Error("Skin not found: " + t); + this.setSkin(e) + } + , + e.prototype.setSkin = function(t) { + if (t != this.skin) { + if (null != t) + if (null != this.skin) + t.attachAll(this, this.skin); + else + for (var e = this.slots, i = 0, n = e.length; i < n; i++) { + var r = e[i] + , s = r.data.attachmentName; + if (null != s) { + var a = t.getAttachment(i, s); + null != a && r.setAttachment(a) + } + } + this.skin = t, + this.updateCache() + } + } + , + e.prototype.getAttachmentByName = function(t, e) { + return this.getAttachment(this.data.findSlotIndex(t), e) + } + , + e.prototype.getAttachment = function(t, e) { + if (null == e) + throw new Error("attachmentName cannot be null."); + if (null != this.skin) { + var i = this.skin.getAttachment(t, e); + if (null != i) + return i + } + return null != this.data.defaultSkin ? this.data.defaultSkin.getAttachment(t, e) : null + } + , + e.prototype.setAttachment = function(t, e) { + if (null == t) + throw new Error("slotName cannot be null."); + for (var i = this.slots, n = 0, r = i.length; n < r; n++) { + var s = i[n]; + if (s.data.name == t) { + var a = null; + if (null != e && null == (a = this.getAttachment(n, e))) + throw new Error("Attachment not found: " + e + ", for slot: " + t); + return void s.setAttachment(a) + } + } + throw new Error("Slot not found: " + t) + } + , + e.prototype.findIkConstraint = function(t) { + if (null == t) + throw new Error("constraintName cannot be null."); + for (var e = this.ikConstraints, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.data.name == t) + return r + } + return null + } + , + e.prototype.findTransformConstraint = function(t) { + if (null == t) + throw new Error("constraintName cannot be null."); + for (var e = this.transformConstraints, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.data.name == t) + return r + } + return null + } + , + e.prototype.findPathConstraint = function(t) { + if (null == t) + throw new Error("constraintName cannot be null."); + for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.data.name == t) + return r + } + return null + } + , + e.prototype.getBounds = function(e, i, n) { + if (void 0 === n && (n = new Array(2)), + null == e) + throw new Error("offset cannot be null."); + if (null == i) + throw new Error("size cannot be null."); + for (var r = this.drawOrder, s = Number.POSITIVE_INFINITY, a = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY, h = 0, c = r.length; h < c; h++) { + var u = r[h]; + if (u.bone.active) { + var _ = 0 + , f = null + , d = u.getAttachment(); + if (d instanceof t.RegionAttachment) + _ = 8, + f = t.Utils.setArraySize(n, _, 0), + d.computeWorldVertices(u.bone, f, 0, 2); + else if (d instanceof t.MeshAttachment) { + var p = d; + _ = p.worldVerticesLength, + f = t.Utils.setArraySize(n, _, 0), + p.computeWorldVertices(u, 0, _, f, 0, 2) + } + if (null != f) + for (var m = 0, y = f.length; m < y; m += 2) { + var v = f[m] + , g = f[m + 1]; + s = Math.min(s, v), + a = Math.min(a, g), + o = Math.max(o, v), + l = Math.max(l, g) + } + } + } + e.set(s, a), + i.set(o - s, l - a) + } + , + e.prototype.update = function(t) { + this.time += t + } + , + e + } + )(); + t.Skeleton = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t) { + this.scale = 1, + this.linkedMeshes = new Array, + this.attachmentLoader = t + } + return e.prototype.readSkeletonData = function(n) { + var r = this.scale + , s = new t.SkeletonData; + s.name = ""; + var a = new i(n); + s.hash = a.readString(), + s.version = a.readString(), + s.x = a.readFloat(), + s.y = a.readFloat(), + s.width = a.readFloat(), + s.height = a.readFloat(); + var o = a.readBoolean(); + o && (s.fps = a.readFloat(), + s.imagesPath = a.readString(), + s.audioPath = a.readString()); + var l = 0; + l = a.readInt(!0); + for (var h = 0; h < l; h++) + a.strings.push(a.readString()); + for (l = a.readInt(!0), + h = 0; h < l; h++) { + var c = a.readString() + , u = 0 == h ? null : s.bones[a.readInt(!0)]; + (d = new t.BoneData(h,c,u)).rotation = a.readFloat(), + d.x = a.readFloat() * r, + d.y = a.readFloat() * r, + d.scaleX = a.readFloat(), + d.scaleY = a.readFloat(), + d.shearX = a.readFloat(), + d.shearY = a.readFloat(), + d.length = a.readFloat() * r, + d.transformMode = e.TransformModeValues[a.readInt(!0)], + d.skinRequired = a.readBoolean(), + o && t.Color.rgba8888ToColor(d.color, a.readInt32()), + s.bones.push(d) + } + for (l = a.readInt(!0), + h = 0; h < l; h++) { + var _ = a.readString() + , f = s.bones[a.readInt(!0)] + , d = new t.SlotData(h,_,f); + t.Color.rgba8888ToColor(d.color, a.readInt32()); + var p = a.readInt32(); + -1 != p && t.Color.rgb888ToColor(d.darkColor = new t.Color, p), + d.attachmentName = a.readStringRef(), + d.blendMode = e.BlendModeValues[a.readInt(!0)], + s.slots.push(d) + } + l = a.readInt(!0), + h = 0; + for (var m = void 0; h < l; h++) { + (d = new t.IkConstraintData(a.readString())).order = a.readInt(!0), + d.skinRequired = a.readBoolean(), + m = a.readInt(!0); + for (var y = 0; y < m; y++) + d.bones.push(s.bones[a.readInt(!0)]); + d.target = s.bones[a.readInt(!0)], + d.mix = a.readFloat(), + d.softness = a.readFloat() * r, + d.bendDirection = a.readByte(), + d.compress = a.readBoolean(), + d.stretch = a.readBoolean(), + d.uniform = a.readBoolean(), + s.ikConstraints.push(d) + } + for (l = a.readInt(!0), + h = 0, + m = void 0; h < l; h++) { + for ((d = new t.TransformConstraintData(a.readString())).order = a.readInt(!0), + d.skinRequired = a.readBoolean(), + m = a.readInt(!0), + y = 0; y < m; y++) + d.bones.push(s.bones[a.readInt(!0)]); + d.target = s.bones[a.readInt(!0)], + d.local = a.readBoolean(), + d.relative = a.readBoolean(), + d.offsetRotation = a.readFloat(), + d.offsetX = a.readFloat() * r, + d.offsetY = a.readFloat() * r, + d.offsetScaleX = a.readFloat(), + d.offsetScaleY = a.readFloat(), + d.offsetShearY = a.readFloat(), + d.rotateMix = a.readFloat(), + d.translateMix = a.readFloat(), + d.scaleMix = a.readFloat(), + d.shearMix = a.readFloat(), + s.transformConstraints.push(d) + } + for (l = a.readInt(!0), + h = 0, + m = void 0; h < l; h++) { + for ((d = new t.PathConstraintData(a.readString())).order = a.readInt(!0), + d.skinRequired = a.readBoolean(), + m = a.readInt(!0), + y = 0; y < m; y++) + d.bones.push(s.bones[a.readInt(!0)]); + d.target = s.slots[a.readInt(!0)], + d.positionMode = e.PositionModeValues[a.readInt(!0)], + d.spacingMode = e.SpacingModeValues[a.readInt(!0)], + d.rotateMode = e.RotateModeValues[a.readInt(!0)], + d.offsetRotation = a.readFloat(), + d.position = a.readFloat(), + d.positionMode == t.PositionMode.Fixed && (d.position *= r), + d.spacing = a.readFloat(), + d.spacingMode != t.SpacingMode.Length && d.spacingMode != t.SpacingMode.Fixed || (d.spacing *= r), + d.rotateMix = a.readFloat(), + d.translateMix = a.readFloat(), + s.pathConstraints.push(d) + } + var v = this.readSkin(a, s, !0, o); + for (null != v && (s.defaultSkin = v, + s.skins.push(v)), + h = s.skins.length, + t.Utils.setArraySize(s.skins, l = h + a.readInt(!0)); h < l; h++) + s.skins[h] = this.readSkin(a, s, !1, o); + for (l = this.linkedMeshes.length, + h = 0; h < l; h++) { + var g = this.linkedMeshes[h] + , A = null == g.skin ? s.defaultSkin : s.findSkin(g.skin); + if (null == A) + throw new Error("Skin not found: " + g.skin); + var x = A.getAttachment(g.slotIndex, g.parent); + if (null == x) + throw new Error("Parent mesh not found: " + g.parent); + g.mesh.deformAttachment = g.inheritDeform ? x : g.mesh, + g.mesh.setParentMesh(x), + g.mesh.updateUVs() + } + for (this.linkedMeshes.length = 0, + l = a.readInt(!0), + h = 0; h < l; h++) + (d = new t.EventData(a.readStringRef())).intValue = a.readInt(!1), + d.floatValue = a.readFloat(), + d.stringValue = a.readString(), + d.audioPath = a.readString(), + null != d.audioPath && (d.volume = a.readFloat(), + d.balance = a.readFloat()), + s.events.push(d); + for (l = a.readInt(!0), + h = 0; h < l; h++) + s.animations.push(this.readAnimation(a, a.readString(), s)); + return s + } + , + e.prototype.readSkin = function(e, i, n, r) { + var s = null + , a = 0; + if (n) { + if (0 == (a = e.readInt(!0))) + return null; + s = new t.Skin("default") + } else { + (s = new t.Skin(e.readStringRef())).bones.length = e.readInt(!0); + for (var o = 0, l = s.bones.length; o < l; o++) + s.bones[o] = i.bones[e.readInt(!0)]; + for (o = 0, + l = e.readInt(!0); o < l; o++) + s.constraints.push(i.ikConstraints[e.readInt(!0)]); + for (o = 0, + l = e.readInt(!0); o < l; o++) + s.constraints.push(i.transformConstraints[e.readInt(!0)]); + for (o = 0, + l = e.readInt(!0); o < l; o++) + s.constraints.push(i.pathConstraints[e.readInt(!0)]); + a = e.readInt(!0) + } + for (o = 0; o < a; o++) + for (var h = e.readInt(!0), c = 0, u = e.readInt(!0); c < u; c++) { + var _ = e.readStringRef() + , f = this.readAttachment(e, i, s, h, _, r); + null != f && s.setAttachment(h, _, f) + } + return s + } + , + e.prototype.readAttachment = function(i, r, s, a, o, l) { + var h = this.scale + , c = i.readStringRef(); + null == c && (c = o); + var u = i.readByte(); + switch (e.AttachmentTypeValues[u]) { + case t.AttachmentType.Region: + var _ = i.readStringRef() + , f = i.readFloat() + , d = i.readFloat() + , p = i.readFloat() + , m = i.readFloat() + , y = i.readFloat() + , v = i.readFloat() + , g = i.readFloat() + , A = i.readInt32(); + null == _ && (_ = c); + var x = this.attachmentLoader.newRegionAttachment(s, c, _); + return null == x ? null : (x.path = _, + x.x = d * h, + x.y = p * h, + x.scaleX = m, + x.scaleY = y, + x.rotation = f, + x.width = v * h, + x.height = g * h, + t.Color.rgba8888ToColor(x.color, A), + x.updateOffset(), + x); + case t.AttachmentType.BoundingBox: + var b = i.readInt(!0) + , C = this.readVertices(i, b) + , T = (A = l ? i.readInt32() : 0, + this.attachmentLoader.newBoundingBoxAttachment(s, c)); + return null == T ? null : (T.worldVerticesLength = b << 1, + T.vertices = C.vertices, + T.bones = C.bones, + l && t.Color.rgba8888ToColor(T.color, A), + T); + case t.AttachmentType.Mesh: + _ = i.readStringRef(), + A = i.readInt32(), + b = i.readInt(!0); + var S = this.readFloatArray(i, b << 1, 1) + , w = this.readShortArray(i) + , E = (C = this.readVertices(i, b), + i.readInt(!0)) + , M = null; + return v = 0, + g = 0, + l && (M = this.readShortArray(i), + v = i.readFloat(), + g = i.readFloat()), + null == _ && (_ = c), + null == (D = this.attachmentLoader.newMeshAttachment(s, c, _)) ? null : (D.path = _, + t.Color.rgba8888ToColor(D.color, A), + D.bones = C.bones, + D.vertices = C.vertices, + D.worldVerticesLength = b << 1, + D.triangles = w, + D.regionUVs = S, + D.updateUVs(), + D.hullLength = E << 1, + l && (D.edges = M, + D.width = v * h, + D.height = g * h), + D); + case t.AttachmentType.LinkedMesh: + _ = i.readStringRef(), + A = i.readInt32(); + var D, B = i.readStringRef(), I = i.readStringRef(), P = i.readBoolean(); + return v = 0, + g = 0, + l && (v = i.readFloat(), + g = i.readFloat()), + null == _ && (_ = c), + null == (D = this.attachmentLoader.newMeshAttachment(s, c, _)) ? null : (D.path = _, + t.Color.rgba8888ToColor(D.color, A), + l && (D.width = v * h, + D.height = g * h), + this.linkedMeshes.push(new n(D,B,a,I,P)), + D); + case t.AttachmentType.Path: + for (var R = i.readBoolean(), O = i.readBoolean(), L = (b = i.readInt(!0), + C = this.readVertices(i, b), + t.Utils.newArray(b / 3, 0)), F = 0, V = L.length; F < V; F++) + L[F] = i.readFloat() * h; + return A = l ? i.readInt32() : 0, + null == (_ = this.attachmentLoader.newPathAttachment(s, c)) ? null : (_.closed = R, + _.constantSpeed = O, + _.worldVerticesLength = b << 1, + _.vertices = C.vertices, + _.bones = C.bones, + _.lengths = L, + l && t.Color.rgba8888ToColor(_.color, A), + _); + case t.AttachmentType.Point: + f = i.readFloat(), + d = i.readFloat(), + p = i.readFloat(), + A = l ? i.readInt32() : 0; + var N = this.attachmentLoader.newPointAttachment(s, c); + return null == N ? null : (N.x = d * h, + N.y = p * h, + N.rotation = f, + l && t.Color.rgba8888ToColor(N.color, A), + N); + case t.AttachmentType.Clipping: + var k = i.readInt(!0) + , G = (b = i.readInt(!0), + C = this.readVertices(i, b), + A = l ? i.readInt32() : 0, + this.attachmentLoader.newClippingAttachment(s, c)); + return null == G ? null : (G.endSlot = r.slots[k], + G.worldVerticesLength = b << 1, + G.vertices = C.vertices, + G.bones = C.bones, + l && t.Color.rgba8888ToColor(G.color, A), + G) + } + return null + } + , + e.prototype.readVertices = function(e, i) { + var n = i << 1 + , s = new r + , a = this.scale; + if (!e.readBoolean()) + return s.vertices = this.readFloatArray(e, n, a), + s; + for (var o = new Array, l = new Array, h = 0; h < i; h++) { + var c = e.readInt(!0); + l.push(c); + for (var u = 0; u < c; u++) + l.push(e.readInt(!0)), + o.push(e.readFloat() * a), + o.push(e.readFloat() * a), + o.push(e.readFloat()) + } + return s.vertices = t.Utils.toFloatArray(o), + s.bones = l, + s + } + , + e.prototype.readFloatArray = function(t, e, i) { + var n = new Array(e); + if (1 == i) + for (var r = 0; r < e; r++) + n[r] = t.readFloat(); + else + for (r = 0; r < e; r++) + n[r] = t.readFloat() * i; + return n + } + , + e.prototype.readShortArray = function(t) { + for (var e = t.readInt(!0), i = new Array(e), n = 0; n < e; n++) + i[n] = t.readShort(); + return i + } + , + e.prototype.readAnimation = function(i, n, r) { + for (var s = new Array, a = this.scale, o = 0, l = new t.Color, h = new t.Color, c = 0, u = i.readInt(!0); c < u; c++) + for (var _ = i.readInt(!0), f = 0, d = i.readInt(!0); f < d; f++) { + var p = i.readByte() + , m = i.readInt(!0); + switch (p) { + case e.SLOT_ATTACHMENT: + (A = new t.AttachmentTimeline(m)).slotIndex = _; + for (var y = 0; y < m; y++) + A.setFrame(y, i.readFloat(), i.readStringRef()); + s.push(A), + o = Math.max(o, A.frames[m - 1]); + break; + case e.SLOT_COLOR: + for ((A = new t.ColorTimeline(m)).slotIndex = _, + y = 0; y < m; y++) { + var v = i.readFloat(); + t.Color.rgba8888ToColor(l, i.readInt32()), + A.setFrame(y, v, l.r, l.g, l.b, l.a), + y < m - 1 && this.readCurve(i, y, A) + } + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.ColorTimeline.ENTRIES]); + break; + case e.SLOT_TWO_COLOR: + for ((A = new t.TwoColorTimeline(m)).slotIndex = _, + y = 0; y < m; y++) + v = i.readFloat(), + t.Color.rgba8888ToColor(l, i.readInt32()), + t.Color.rgb888ToColor(h, i.readInt32()), + A.setFrame(y, v, l.r, l.g, l.b, l.a, h.r, h.g, h.b), + y < m - 1 && this.readCurve(i, y, A); + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.TwoColorTimeline.ENTRIES]) + } + } + for (c = 0, + u = i.readInt(!0); c < u; c++) { + var g = i.readInt(!0); + for (f = 0, + d = i.readInt(!0); f < d; f++) + switch (p = i.readByte(), + m = i.readInt(!0), + p) { + case e.BONE_ROTATE: + for ((A = new t.RotateTimeline(m)).boneIndex = g, + y = 0; y < m; y++) + A.setFrame(y, i.readFloat(), i.readFloat()), + y < m - 1 && this.readCurve(i, y, A); + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.RotateTimeline.ENTRIES]); + break; + case e.BONE_TRANSLATE: + case e.BONE_SCALE: + case e.BONE_SHEAR: + var A = void 0 + , x = 1; + for (p == e.BONE_SCALE ? A = new t.ScaleTimeline(m) : p == e.BONE_SHEAR ? A = new t.ShearTimeline(m) : (A = new t.TranslateTimeline(m), + x = a), + A.boneIndex = g, + y = 0; y < m; y++) + A.setFrame(y, i.readFloat(), i.readFloat() * x, i.readFloat() * x), + y < m - 1 && this.readCurve(i, y, A); + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.TranslateTimeline.ENTRIES]) + } + } + for (c = 0, + u = i.readInt(!0); c < u; c++) { + var b = i.readInt(!0); + for (m = i.readInt(!0), + (A = new t.IkConstraintTimeline(m)).ikConstraintIndex = b, + y = 0; y < m; y++) + A.setFrame(y, i.readFloat(), i.readFloat(), i.readFloat() * a, i.readByte(), i.readBoolean(), i.readBoolean()), + y < m - 1 && this.readCurve(i, y, A); + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.IkConstraintTimeline.ENTRIES]) + } + for (c = 0, + u = i.readInt(!0); c < u; c++) { + for (b = i.readInt(!0), + m = i.readInt(!0), + (A = new t.TransformConstraintTimeline(m)).transformConstraintIndex = b, + y = 0; y < m; y++) + A.setFrame(y, i.readFloat(), i.readFloat(), i.readFloat(), i.readFloat(), i.readFloat()), + y < m - 1 && this.readCurve(i, y, A); + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.TransformConstraintTimeline.ENTRIES]) + } + for (c = 0, + u = i.readInt(!0); c < u; c++) { + b = i.readInt(!0); + var C = r.pathConstraints[b]; + for (f = 0, + d = i.readInt(!0); f < d; f++) + switch (p = i.readByte(), + m = i.readInt(!0), + p) { + case e.PATH_POSITION: + case e.PATH_SPACING: + for (A = void 0, + x = 1, + p == e.PATH_SPACING ? (A = new t.PathConstraintSpacingTimeline(m), + C.spacingMode != t.SpacingMode.Length && C.spacingMode != t.SpacingMode.Fixed || (x = a)) : (A = new t.PathConstraintPositionTimeline(m), + C.positionMode == t.PositionMode.Fixed && (x = a)), + A.pathConstraintIndex = b, + y = 0; y < m; y++) + A.setFrame(y, i.readFloat(), i.readFloat() * x), + y < m - 1 && this.readCurve(i, y, A); + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.PathConstraintPositionTimeline.ENTRIES]); + break; + case e.PATH_MIX: + for ((A = new t.PathConstraintMixTimeline(m)).pathConstraintIndex = b, + y = 0; y < m; y++) + A.setFrame(y, i.readFloat(), i.readFloat(), i.readFloat()), + y < m - 1 && this.readCurve(i, y, A); + s.push(A), + o = Math.max(o, A.frames[(m - 1) * t.PathConstraintMixTimeline.ENTRIES]) + } + } + for (c = 0, + u = i.readInt(!0); c < u; c++) { + var T = r.skins[i.readInt(!0)]; + for (f = 0, + d = i.readInt(!0); f < d; f++) { + _ = i.readInt(!0); + for (var S = 0, w = i.readInt(!0); S < w; S++) { + var E = T.getAttachment(_, i.readStringRef()) + , M = null != E.bones + , D = E.vertices + , B = M ? D.length / 3 * 2 : D.length; + for (m = i.readInt(!0), + (A = new t.DeformTimeline(m)).slotIndex = _, + A.attachment = E, + y = 0; y < m; y++) { + v = i.readFloat(); + var I = void 0 + , P = i.readInt(!0); + if (0 == P) + I = M ? t.Utils.newFloatArray(B) : D; + else { + I = t.Utils.newFloatArray(B); + var R = i.readInt(!0); + if (P += R, + 1 == a) + for (var O = R; O < P; O++) + I[O] = i.readFloat(); + else + for (O = R; O < P; O++) + I[O] = i.readFloat() * a; + if (!M) { + O = 0; + for (var L = I.length; O < L; O++) + I[O] += D[O] + } + } + A.setFrame(y, v, I), + y < m - 1 && this.readCurve(i, y, A) + } + s.push(A), + o = Math.max(o, A.frames[m - 1]) + } + } + } + var F = i.readInt(!0); + if (F > 0) { + A = new t.DrawOrderTimeline(F); + var V = r.slots.length; + for (c = 0; c < F; c++) { + v = i.readFloat(); + var N = i.readInt(!0) + , k = t.Utils.newArray(V, 0); + for (f = V - 1; f >= 0; f--) + k[f] = -1; + var G = t.Utils.newArray(V - N, 0) + , U = 0 + , z = 0; + for (f = 0; f < N; f++) { + for (_ = i.readInt(!0); U != _; ) + G[z++] = U++; + k[U + i.readInt(!0)] = U++ + } + for (; U < V; ) + G[z++] = U++; + for (f = V - 1; f >= 0; f--) + -1 == k[f] && (k[f] = G[--z]); + A.setFrame(c, v, k) + } + s.push(A), + o = Math.max(o, A.frames[F - 1]) + } + var H = i.readInt(!0); + if (H > 0) { + for (A = new t.EventTimeline(H), + c = 0; c < H; c++) { + v = i.readFloat(); + var W = r.events[i.readInt(!0)] + , j = new t.Event(v,W); + j.intValue = i.readInt(!1), + j.floatValue = i.readFloat(), + j.stringValue = i.readBoolean() ? i.readString() : W.stringValue, + null != j.data.audioPath && (j.volume = i.readFloat(), + j.balance = i.readFloat()), + A.setFrame(c, j) + } + s.push(A), + o = Math.max(o, A.frames[H - 1]) + } + return new t.Animation(n,s,o) + } + , + e.prototype.readCurve = function(t, i, n) { + switch (t.readByte()) { + case e.CURVE_STEPPED: + n.setStepped(i); + break; + case e.CURVE_BEZIER: + this.setCurve(n, i, t.readFloat(), t.readFloat(), t.readFloat(), t.readFloat()) + } + } + , + e.prototype.setCurve = function(t, e, i, n, r, s) { + t.setCurve(e, i, n, r, s) + } + , + e.AttachmentTypeValues = [0, 1, 2, 3, 4, 5, 6], + e.TransformModeValues = [t.TransformMode.Normal, t.TransformMode.OnlyTranslation, t.TransformMode.NoRotationOrReflection, t.TransformMode.NoScale, t.TransformMode.NoScaleOrReflection], + e.PositionModeValues = [t.PositionMode.Fixed, t.PositionMode.Percent], + e.SpacingModeValues = [t.SpacingMode.Length, t.SpacingMode.Fixed, t.SpacingMode.Percent], + e.RotateModeValues = [t.RotateMode.Tangent, t.RotateMode.Chain, t.RotateMode.ChainScale], + e.BlendModeValues = [t.BlendMode.Normal, t.BlendMode.Additive, t.BlendMode.Multiply, t.BlendMode.Screen], + e.BONE_ROTATE = 0, + e.BONE_TRANSLATE = 1, + e.BONE_SCALE = 2, + e.BONE_SHEAR = 3, + e.SLOT_ATTACHMENT = 0, + e.SLOT_COLOR = 1, + e.SLOT_TWO_COLOR = 2, + e.PATH_POSITION = 0, + e.PATH_SPACING = 1, + e.PATH_MIX = 2, + e.CURVE_LINEAR = 0, + e.CURVE_STEPPED = 1, + e.CURVE_BEZIER = 2, + e + } + )(); + t.SkeletonBinary = e; + var i = (function() { + function t(t, e, i, n) { + void 0 === e && (e = new Array), + void 0 === i && (i = 0), + void 0 === n && (n = new DataView(t.buffer)), + this.strings = e, + this.index = i, + this.buffer = n + } + return t.prototype.readByte = function() { + return this.buffer.getInt8(this.index++) + } + , + t.prototype.readShort = function() { + var t = this.buffer.getInt16(this.index); + return this.index += 2, + t + } + , + t.prototype.readInt32 = function() { + var t = this.buffer.getInt32(this.index); + return this.index += 4, + t + } + , + t.prototype.readInt = function(t) { + var e = this.readByte() + , i = 127 & e; + return 0 != (128 & e) && (i |= (127 & (e = this.readByte())) << 7, + 0 != (128 & e) && (i |= (127 & (e = this.readByte())) << 14, + 0 != (128 & e) && (i |= (127 & (e = this.readByte())) << 21, + 0 != (128 & e) && (i |= (127 & (e = this.readByte())) << 28)))), + t ? i : i >>> 1 ^ -(1 & i) + } + , + t.prototype.readStringRef = function() { + var t = this.readInt(!0); + return 0 == t ? null : this.strings[t - 1] + } + , + t.prototype.readString = function() { + var t = this.readInt(!0); + switch (t) { + case 0: + return null; + case 1: + return "" + } + t--; + for (var e = "", i = 0; i < t; ) { + var n = this.readByte(); + switch (n >> 4) { + case 12: + case 13: + e += String.fromCharCode((31 & n) << 6 | 63 & this.readByte()), + i += 2; + break; + case 14: + e += String.fromCharCode((15 & n) << 12 | (63 & this.readByte()) << 6 | 63 & this.readByte()), + i += 3; + break; + default: + e += String.fromCharCode(n), + i++ + } + } + return e + } + , + t.prototype.readFloat = function() { + var t = this.buffer.getFloat32(this.index); + return this.index += 4, + t + } + , + t.prototype.readBoolean = function() { + return 0 != this.readByte() + } + , + t + } + )() + , n = function(t, e, i, n, r) { + this.mesh = t, + this.skin = e, + this.slotIndex = i, + this.parent = n, + this.inheritDeform = r + } + , r = function(t, e) { + void 0 === t && (t = null), + void 0 === e && (e = null), + this.bones = t, + this.vertices = e + } + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e() { + this.minX = 0, + this.minY = 0, + this.maxX = 0, + this.maxY = 0, + this.boundingBoxes = new Array, + this.polygons = new Array, + this.polygonPool = new t.Pool(function() { + return t.Utils.newFloatArray(16) + } + ) + } + return e.prototype.update = function(e, i) { + if (null == e) + throw new Error("skeleton cannot be null."); + var n = this.boundingBoxes + , r = this.polygons + , s = this.polygonPool + , a = e.slots + , o = a.length; + n.length = 0, + s.freeAll(r), + r.length = 0; + for (var l = 0; l < o; l++) { + var h = a[l]; + if (h.bone.active) { + var c = h.getAttachment(); + if (c instanceof t.BoundingBoxAttachment) { + var u = c; + n.push(u); + var _ = s.obtain(); + _.length != u.worldVerticesLength && (_ = t.Utils.newFloatArray(u.worldVerticesLength)), + r.push(_), + u.computeWorldVertices(h, 0, u.worldVerticesLength, _, 0, 2) + } + } + } + i ? this.aabbCompute() : (this.minX = Number.POSITIVE_INFINITY, + this.minY = Number.POSITIVE_INFINITY, + this.maxX = Number.NEGATIVE_INFINITY, + this.maxY = Number.NEGATIVE_INFINITY) + } + , + e.prototype.aabbCompute = function() { + for (var t = Number.POSITIVE_INFINITY, e = Number.POSITIVE_INFINITY, i = Number.NEGATIVE_INFINITY, n = Number.NEGATIVE_INFINITY, r = this.polygons, s = 0, a = r.length; s < a; s++) + for (var o = r[s], l = o, h = 0, c = o.length; h < c; h += 2) { + var u = l[h] + , _ = l[h + 1]; + t = Math.min(t, u), + e = Math.min(e, _), + i = Math.max(i, u), + n = Math.max(n, _) + } + this.minX = t, + this.minY = e, + this.maxX = i, + this.maxY = n + } + , + e.prototype.aabbContainsPoint = function(t, e) { + return t >= this.minX && t <= this.maxX && e >= this.minY && e <= this.maxY + } + , + e.prototype.aabbIntersectsSegment = function(t, e, i, n) { + var r = this.minX + , s = this.minY + , a = this.maxX + , o = this.maxY; + if (t <= r && i <= r || e <= s && n <= s || t >= a && i >= a || e >= o && n >= o) + return !1; + var l = (n - e) / (i - t) + , h = l * (r - t) + e; + if (h > s && h < o) + return !0; + if ((h = l * (a - t) + e) > s && h < o) + return !0; + var c = (s - e) / l + t; + return c > r && c < a || (c = (o - e) / l + t) > r && c < a + } + , + e.prototype.aabbIntersectsSkeleton = function(t) { + return this.minX < t.maxX && this.maxX > t.minX && this.minY < t.maxY && this.maxY > t.minY + } + , + e.prototype.containsPoint = function(t, e) { + for (var i = this.polygons, n = 0, r = i.length; n < r; n++) + if (this.containsPointPolygon(i[n], t, e)) + return this.boundingBoxes[n]; + return null + } + , + e.prototype.containsPointPolygon = function(t, e, i) { + for (var n = t, r = t.length, s = r - 2, a = !1, o = 0; o < r; o += 2) { + var l = n[o + 1] + , h = n[s + 1]; + if (l < i && h >= i || h < i && l >= i) { + var c = n[o]; + c + (i - l) / (h - l) * (n[s] - c) < e && (a = !a) + } + s = o + } + return a + } + , + e.prototype.intersectsSegment = function(t, e, i, n) { + for (var r = this.polygons, s = 0, a = r.length; s < a; s++) + if (this.intersectsSegmentPolygon(r[s], t, e, i, n)) + return this.boundingBoxes[s]; + return null + } + , + e.prototype.intersectsSegmentPolygon = function(t, e, i, n, r) { + for (var s = t, a = t.length, o = e - n, l = i - r, h = e * r - i * n, c = s[a - 2], u = s[a - 1], _ = 0; _ < a; _ += 2) { + var f = s[_] + , d = s[_ + 1] + , p = c * d - u * f + , m = c - f + , y = u - d + , v = o * y - l * m + , g = (h * m - o * p) / v; + if ((g >= c && g <= f || g >= f && g <= c) && (g >= e && g <= n || g >= n && g <= e)) { + var A = (h * y - l * p) / v; + if ((A >= u && A <= d || A >= d && A <= u) && (A >= i && A <= r || A >= r && A <= i)) + return !0 + } + c = f, + u = d + } + return !1 + } + , + e.prototype.getPolygon = function(t) { + if (null == t) + throw new Error("boundingBox cannot be null."); + var e = this.boundingBoxes.indexOf(t); + return -1 == e ? null : this.polygons[e] + } + , + e.prototype.getWidth = function() { + return this.maxX - this.minX + } + , + e.prototype.getHeight = function() { + return this.maxY - this.minY + } + , + e + } + )(); + t.SkeletonBounds = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e() { + this.triangulator = new t.Triangulator, + this.clippingPolygon = new Array, + this.clipOutput = new Array, + this.clippedVertices = new Array, + this.clippedTriangles = new Array, + this.scratch = new Array + } + return e.prototype.clipStart = function(i, n) { + if (null != this.clipAttachment) + return 0; + this.clipAttachment = n; + var r = n.worldVerticesLength + , s = t.Utils.setArraySize(this.clippingPolygon, r); + n.computeWorldVertices(i, 0, r, s, 0, 2); + var a = this.clippingPolygon; + e.makeClockwise(a); + for (var o = this.clippingPolygons = this.triangulator.decompose(a, this.triangulator.triangulate(a)), l = 0, h = o.length; l < h; l++) { + var c = o[l]; + e.makeClockwise(c), + c.push(c[0]), + c.push(c[1]) + } + return o.length + } + , + e.prototype.clipEndWithSlot = function(t) { + null != this.clipAttachment && this.clipAttachment.endSlot == t.data && this.clipEnd() + } + , + e.prototype.clipEnd = function() { + null != this.clipAttachment && (this.clipAttachment = null, + this.clippingPolygons = null, + this.clippedVertices.length = 0, + this.clippedTriangles.length = 0, + this.clippingPolygon.length = 0) + } + , + e.prototype.isClipping = function() { + return null != this.clipAttachment + } + , + e.prototype.clipTriangles = function(e, i, n, r, s, a, o, l, h, c, u, _) { + var f = this.clipOutput + , d = this.clippedVertices + , p = this.clippedTriangles + , m = this.clippingPolygons + , y = this.clippingPolygons.length + , v = l ? 12 : 8 + , g = 0; + c = c || 0, + u = u || 0, + _ = _ || 0, + d.length = 0, + p.length = 0; + t: for (var A = c, x = c + r; A < x; A += 3) { + var b = n[A] * h + , C = b + u + , T = b + _ + , S = e[C] + , w = e[C + 1] + , E = s[T] + , M = s[T + 1]; + T = (b = n[A + 1] * h) + _; + var D = e[C = b + u] + , B = e[C + 1] + , I = s[T] + , P = s[T + 1]; + T = (b = n[A + 2] * h) + _; + for (var R = e[C = b + u], O = e[C + 1], L = s[T], F = s[T + 1], V = 0; V < y; V++) { + var N = d.length; + if (!this.clip(S, w, D, B, R, O, m[V], f)) { + (Y = t.Utils.setArraySize(d, N + 3 * v))[N] = S, + Y[N + 1] = w, + Y[N + 2] = a.r, + Y[N + 3] = a.g, + Y[N + 4] = a.b, + Y[N + 5] = a.a, + l ? (Y[N + 6] = E, + Y[N + 7] = M, + Y[N + 8] = o.r, + Y[N + 9] = o.g, + Y[N + 10] = o.b, + Y[N + 11] = o.a, + Y[N + 12] = D, + Y[N + 13] = B, + Y[N + 14] = a.r, + Y[N + 15] = a.g, + Y[N + 16] = a.b, + Y[N + 17] = a.a, + Y[N + 18] = I, + Y[N + 19] = P, + Y[N + 20] = o.r, + Y[N + 21] = o.g, + Y[N + 22] = o.b, + Y[N + 23] = o.a, + Y[N + 24] = R, + Y[N + 25] = O, + Y[N + 26] = a.r, + Y[N + 27] = a.g, + Y[N + 28] = a.b, + Y[N + 29] = a.a, + Y[N + 30] = L, + Y[N + 31] = F, + Y[N + 32] = o.r, + Y[N + 33] = o.g, + Y[N + 34] = o.b, + Y[N + 35] = o.a) : (Y[N + 6] = E, + Y[N + 7] = M, + Y[N + 8] = D, + Y[N + 9] = B, + Y[N + 10] = a.r, + Y[N + 11] = a.g, + Y[N + 12] = a.b, + Y[N + 13] = a.a, + Y[N + 14] = I, + Y[N + 15] = P, + Y[N + 16] = R, + Y[N + 17] = O, + Y[N + 18] = a.r, + Y[N + 19] = a.g, + Y[N + 20] = a.b, + Y[N + 21] = a.a, + Y[N + 22] = L, + Y[N + 23] = F), + N = p.length, + (it = t.Utils.setArraySize(p, N + 3))[N] = g, + it[N + 1] = g + 1, + it[N + 2] = g + 2, + g += 3; + continue t + } + var k = f.length; + if (0 != k) { + for (var G = B - O, U = R - D, z = S - R, H = O - w, W = 1 / (G * z + U * (w - O)), j = k >> 1, X = this.clipOutput, Y = t.Utils.setArraySize(d, N + j * v), q = 0; q < k; q += 2) { + var J = X[q] + , Z = X[q + 1]; + Y[N] = J, + Y[N + 1] = Z, + Y[N + 2] = a.r, + Y[N + 3] = a.g, + Y[N + 4] = a.b, + Y[N + 5] = a.a; + var K = J - R + , Q = Z - O + , $ = (G * K + U * Q) * W + , tt = (H * K + z * Q) * W + , et = 1 - $ - tt; + Y[N + 6] = E * $ + I * tt + L * et, + Y[N + 7] = M * $ + P * tt + F * et, + l && (Y[N + 8] = o.r, + Y[N + 9] = o.g, + Y[N + 10] = o.b, + Y[N + 11] = o.a), + N += v + } + N = p.length; + var it = t.Utils.setArraySize(p, N + 3 * (j - 2)); + for (j--, + q = 1; q < j; q++) + it[N] = g, + it[N + 1] = g + q, + it[N + 2] = g + q + 1, + N += 3; + g += j + 1 + } + } + } + } + , + e.prototype.clip = function(t, e, i, n, r, s, a, o) { + var l = o + , h = !1 + , c = null; + a.length % 4 >= 2 ? (c = o, + o = this.scratch) : c = this.scratch, + c.length = 0, + c.push(t), + c.push(e), + c.push(i), + c.push(n), + c.push(r), + c.push(s), + c.push(t), + c.push(e), + o.length = 0; + for (var u = a, _ = a.length - 4, f = 0; ; f += 2) { + for (var d = u[f], p = u[f + 1], m = u[f + 2], y = u[f + 3], v = d - m, g = p - y, A = c, x = c.length - 2, b = o.length, C = 0; C < x; C += 2) { + var T = A[C] + , S = A[C + 1] + , w = A[C + 2] + , E = A[C + 3] + , M = v * (E - y) - g * (w - m) > 0; + if (v * (S - y) - g * (T - m) > 0) { + if (M) { + o.push(w), + o.push(E); + continue + } + var D = (I = E - S) * (m - d) - (P = w - T) * (y - p); + if (Math.abs(D) > 1e-6) { + var B = (P * (p - S) - I * (d - T)) / D; + o.push(d + (m - d) * B), + o.push(p + (y - p) * B) + } else + o.push(d), + o.push(p) + } else if (M) { + var I, P; + D = (I = E - S) * (m - d) - (P = w - T) * (y - p), + Math.abs(D) > 1e-6 ? (B = (P * (p - S) - I * (d - T)) / D, + o.push(d + (m - d) * B), + o.push(p + (y - p) * B)) : (o.push(d), + o.push(p)), + o.push(w), + o.push(E) + } + h = !0 + } + if (b == o.length) + return l.length = 0, + !0; + if (o.push(o[0]), + o.push(o[1]), + f == _) + break; + var R = o; + (o = c).length = 0, + c = R + } + if (l != o) { + l.length = 0, + f = 0; + for (var O = o.length - 2; f < O; f++) + l[f] = o[f] + } else + l.length = l.length - 2; + return h + } + , + e.makeClockwise = function(t) { + for (var e = t, i = t.length, n = e[i - 2] * e[1] - e[0] * e[i - 1], r = 0, s = 0, a = 0, o = 0, l = i - 3; o < l; o += 2) + r = e[o], + s = e[o + 1], + a = e[o + 2], + n += r * e[o + 3] - a * s; + if (!(n < 0)) { + o = 0; + var h = i - 2; + for (l = i >> 1; o < l; o += 2) { + var c = e[o] + , u = e[o + 1] + , _ = h - o; + e[o] = e[_], + e[o + 1] = e[_ + 1], + e[_] = c, + e[_ + 1] = u + } + } + } + , + e + } + )(); + t.SkeletonClipping = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t() { + this.bones = new Array, + this.slots = new Array, + this.skins = new Array, + this.events = new Array, + this.animations = new Array, + this.ikConstraints = new Array, + this.transformConstraints = new Array, + this.pathConstraints = new Array, + this.fps = 0 + } + return t.prototype.findBone = function(t) { + if (null == t) + throw new Error("boneName cannot be null."); + for (var e = this.bones, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findBoneIndex = function(t) { + if (null == t) + throw new Error("boneName cannot be null."); + for (var e = this.bones, i = 0, n = e.length; i < n; i++) + if (e[i].name == t) + return i; + return -1 + } + , + t.prototype.findSlot = function(t) { + if (null == t) + throw new Error("slotName cannot be null."); + for (var e = this.slots, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findSlotIndex = function(t) { + if (null == t) + throw new Error("slotName cannot be null."); + for (var e = this.slots, i = 0, n = e.length; i < n; i++) + if (e[i].name == t) + return i; + return -1 + } + , + t.prototype.findSkin = function(t) { + if (null == t) + throw new Error("skinName cannot be null."); + for (var e = this.skins, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findEvent = function(t) { + if (null == t) + throw new Error("eventDataName cannot be null."); + for (var e = this.events, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findAnimation = function(t) { + if (null == t) + throw new Error("animationName cannot be null."); + for (var e = this.animations, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findIkConstraint = function(t) { + if (null == t) + throw new Error("constraintName cannot be null."); + for (var e = this.ikConstraints, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findTransformConstraint = function(t) { + if (null == t) + throw new Error("constraintName cannot be null."); + for (var e = this.transformConstraints, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findPathConstraint = function(t) { + if (null == t) + throw new Error("constraintName cannot be null."); + for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++) { + var r = e[i]; + if (r.name == t) + return r + } + return null + } + , + t.prototype.findPathConstraintIndex = function(t) { + if (null == t) + throw new Error("pathConstraintName cannot be null."); + for (var e = this.pathConstraints, i = 0, n = e.length; i < n; i++) + if (e[i].name == t) + return i; + return -1 + } + , + t + } + )(); + t.SkeletonData = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t) { + this.scale = 1, + this.linkedMeshes = new Array, + this.attachmentLoader = t + } + return e.prototype.readSkeletonData = function(i) { + var n = this.scale + , r = new t.SkeletonData + , s = "string" == typeof i ? JSON.parse(i) : i + , a = s.skeleton; + if (null != a && (r.hash = a.hash, + r.version = a.spine, + r.x = a.x, + r.y = a.y, + r.width = a.width, + r.height = a.height, + r.fps = a.fps, + r.imagesPath = a.images), + s.bones) + for (var o = 0; o < s.bones.length; o++) { + var l = s.bones[o] + , h = null + , c = this.getValue(l, "parent", null); + if (null != c && null == (h = r.findBone(c))) + throw new Error("Parent bone not found: " + c); + (d = new t.BoneData(r.bones.length,l.name,h)).length = this.getValue(l, "length", 0) * n, + d.x = this.getValue(l, "x", 0) * n, + d.y = this.getValue(l, "y", 0) * n, + d.rotation = this.getValue(l, "rotation", 0), + d.scaleX = this.getValue(l, "scaleX", 1), + d.scaleY = this.getValue(l, "scaleY", 1), + d.shearX = this.getValue(l, "shearX", 0), + d.shearY = this.getValue(l, "shearY", 0), + d.transformMode = e.transformModeFromString(this.getValue(l, "transform", "normal")), + d.skinRequired = this.getValue(l, "skin", !1), + r.bones.push(d) + } + if (s.slots) + for (o = 0; o < s.slots.length; o++) { + var u = (D = s.slots[o]).name + , _ = D.bone + , f = r.findBone(_); + if (null == f) + throw new Error("Slot bone not found: " + _); + var d = new t.SlotData(r.slots.length,u,f) + , p = this.getValue(D, "color", null); + null != p && d.color.setFromString(p); + var m = this.getValue(D, "dark", null); + null != m && (d.darkColor = new t.Color(1,1,1,1), + d.darkColor.setFromString(m)), + d.attachmentName = this.getValue(D, "attachment", null), + d.blendMode = e.blendModeFromString(this.getValue(D, "blend", "normal")), + r.slots.push(d) + } + if (s.ik) + for (o = 0; o < s.ik.length; o++) { + var y = s.ik[o]; + (d = new t.IkConstraintData(y.name)).order = this.getValue(y, "order", 0), + d.skinRequired = this.getValue(y, "skin", !1); + for (var v = 0; v < y.bones.length; v++) { + if (_ = y.bones[v], + null == (w = r.findBone(_))) + throw new Error("IK bone not found: " + _); + d.bones.push(w) + } + var g = y.target; + if (d.target = r.findBone(g), + null == d.target) + throw new Error("IK target bone not found: " + g); + d.mix = this.getValue(y, "mix", 1), + d.softness = this.getValue(y, "softness", 0) * n, + d.bendDirection = this.getValue(y, "bendPositive", !0) ? 1 : -1, + d.compress = this.getValue(y, "compress", !1), + d.stretch = this.getValue(y, "stretch", !1), + d.uniform = this.getValue(y, "uniform", !1), + r.ikConstraints.push(d) + } + if (s.transform) + for (o = 0; o < s.transform.length; o++) { + for (y = s.transform[o], + (d = new t.TransformConstraintData(y.name)).order = this.getValue(y, "order", 0), + d.skinRequired = this.getValue(y, "skin", !1), + v = 0; v < y.bones.length; v++) { + if (_ = y.bones[v], + null == (w = r.findBone(_))) + throw new Error("Transform constraint bone not found: " + _); + d.bones.push(w) + } + if (g = y.target, + d.target = r.findBone(g), + null == d.target) + throw new Error("Transform constraint target bone not found: " + g); + d.local = this.getValue(y, "local", !1), + d.relative = this.getValue(y, "relative", !1), + d.offsetRotation = this.getValue(y, "rotation", 0), + d.offsetX = this.getValue(y, "x", 0) * n, + d.offsetY = this.getValue(y, "y", 0) * n, + d.offsetScaleX = this.getValue(y, "scaleX", 0), + d.offsetScaleY = this.getValue(y, "scaleY", 0), + d.offsetShearY = this.getValue(y, "shearY", 0), + d.rotateMix = this.getValue(y, "rotateMix", 1), + d.translateMix = this.getValue(y, "translateMix", 1), + d.scaleMix = this.getValue(y, "scaleMix", 1), + d.shearMix = this.getValue(y, "shearMix", 1), + r.transformConstraints.push(d) + } + if (s.path) + for (o = 0; o < s.path.length; o++) { + for (y = s.path[o], + (d = new t.PathConstraintData(y.name)).order = this.getValue(y, "order", 0), + d.skinRequired = this.getValue(y, "skin", !1), + v = 0; v < y.bones.length; v++) { + if (_ = y.bones[v], + null == (w = r.findBone(_))) + throw new Error("Transform constraint bone not found: " + _); + d.bones.push(w) + } + if (g = y.target, + d.target = r.findSlot(g), + null == d.target) + throw new Error("Path target slot not found: " + g); + d.positionMode = e.positionModeFromString(this.getValue(y, "positionMode", "percent")), + d.spacingMode = e.spacingModeFromString(this.getValue(y, "spacingMode", "length")), + d.rotateMode = e.rotateModeFromString(this.getValue(y, "rotateMode", "tangent")), + d.offsetRotation = this.getValue(y, "rotation", 0), + d.position = this.getValue(y, "position", 0), + d.positionMode == t.PositionMode.Fixed && (d.position *= n), + d.spacing = this.getValue(y, "spacing", 0), + d.spacingMode != t.SpacingMode.Length && d.spacingMode != t.SpacingMode.Fixed || (d.spacing *= n), + d.rotateMix = this.getValue(y, "rotateMix", 1), + d.translateMix = this.getValue(y, "translateMix", 1), + r.pathConstraints.push(d) + } + if (s.skins) { + var A = s.skins; + if (!(A instanceof Array)) { + var x = []; + for (var b in A) + x.push({ + name: b, + attachments: A[b] + }); + A = x + } + for (o = 0; o < A.length; o++) { + var C = A[o] + , T = new t.Skin(C.name); + if (C.bones) + for (var S = 0; S < C.bones.length; S++) { + var w; + if (null == (w = r.findBone(C.bones[S]))) + throw new Error("Skin bone not found: " + C.bones[o]); + T.bones.push(w) + } + if (C.ik) + for (S = 0; S < C.ik.length; S++) { + if (null == (E = r.findIkConstraint(C.ik[S]))) + throw new Error("Skin IK constraint not found: " + C.ik[o]); + T.constraints.push(E) + } + if (C.transform) + for (S = 0; S < C.transform.length; S++) { + if (null == (E = r.findTransformConstraint(C.transform[S]))) + throw new Error("Skin transform constraint not found: " + C.transform[o]); + T.constraints.push(E) + } + if (C.path) + for (S = 0; S < C.path.length; S++) { + var E; + if (null == (E = r.findPathConstraint(C.path[S]))) + throw new Error("Skin path constraint not found: " + C.path[o]); + T.constraints.push(E) + } + for (var u in C.attachments) { + var M = r.findSlot(u); + if (null == M) + throw new Error("Slot not found: " + u); + var D = C.attachments[u]; + for (var B in D) { + var I = this.readAttachment(D[B], T, M.index, B, r); + null != I && T.setAttachment(M.index, B, I) + } + } + r.skins.push(T), + "default" == T.name && (r.defaultSkin = T) + } + } + o = 0; + for (var P = this.linkedMeshes.length; o < P; o++) { + var R = this.linkedMeshes[o]; + if (null == (T = null == R.skin ? r.defaultSkin : r.findSkin(R.skin))) + throw new Error("Skin not found: " + R.skin); + var O = T.getAttachment(R.slotIndex, R.parent); + if (null == O) + throw new Error("Parent mesh not found: " + R.parent); + R.mesh.deformAttachment = R.inheritDeform ? O : R.mesh, + R.mesh.setParentMesh(O), + R.mesh.updateUVs() + } + if (this.linkedMeshes.length = 0, + s.events) + for (var L in s.events) { + var F = s.events[L]; + (d = new t.EventData(L)).intValue = this.getValue(F, "int", 0), + d.floatValue = this.getValue(F, "float", 0), + d.stringValue = this.getValue(F, "string", ""), + d.audioPath = this.getValue(F, "audio", null), + null != d.audioPath && (d.volume = this.getValue(F, "volume", 1), + d.balance = this.getValue(F, "balance", 0)), + r.events.push(d) + } + if (s.animations) + for (var V in s.animations) { + var N = s.animations[V]; + this.readAnimation(N, V, r) + } + return r + } + , + e.prototype.readAttachment = function(e, n, r, s, a) { + var o = this.scale; + switch (s = this.getValue(e, "name", s), + this.getValue(e, "type", "region")) { + case "region": + var l = this.getValue(e, "path", s) + , h = this.attachmentLoader.newRegionAttachment(n, s, l); + return null == h ? null : (h.path = l, + h.x = this.getValue(e, "x", 0) * o, + h.y = this.getValue(e, "y", 0) * o, + h.scaleX = this.getValue(e, "scaleX", 1), + h.scaleY = this.getValue(e, "scaleY", 1), + h.rotation = this.getValue(e, "rotation", 0), + h.width = e.width * o, + h.height = e.height * o, + null != (g = this.getValue(e, "color", null)) && h.color.setFromString(g), + h.updateOffset(), + h); + case "boundingbox": + var c = this.attachmentLoader.newBoundingBoxAttachment(n, s); + return null == c ? null : (this.readVertices(e, c, e.vertexCount << 1), + null != (g = this.getValue(e, "color", null)) && c.color.setFromString(g), + c); + case "mesh": + case "linkedmesh": + l = this.getValue(e, "path", s); + var u = this.attachmentLoader.newMeshAttachment(n, s, l); + if (null == u) + return null; + u.path = l, + null != (g = this.getValue(e, "color", null)) && u.color.setFromString(g), + u.width = this.getValue(e, "width", 0) * o, + u.height = this.getValue(e, "height", 0) * o; + var _ = this.getValue(e, "parent", null); + if (null != _) + return this.linkedMeshes.push(new i(u,this.getValue(e, "skin", null),r,_,this.getValue(e, "deform", !0))), + u; + var f = e.uvs; + return this.readVertices(e, u, f.length), + u.triangles = e.triangles, + u.regionUVs = f, + u.updateUVs(), + u.edges = this.getValue(e, "edges", null), + u.hullLength = 2 * this.getValue(e, "hull", 0), + u; + case "path": + if (null == (l = this.attachmentLoader.newPathAttachment(n, s))) + return null; + l.closed = this.getValue(e, "closed", !1), + l.constantSpeed = this.getValue(e, "constantSpeed", !0); + var d = e.vertexCount; + this.readVertices(e, l, d << 1); + for (var p = t.Utils.newArray(d / 3, 0), m = 0; m < e.lengths.length; m++) + p[m] = e.lengths[m] * o; + return l.lengths = p, + null != (g = this.getValue(e, "color", null)) && l.color.setFromString(g), + l; + case "point": + var y = this.attachmentLoader.newPointAttachment(n, s); + return null == y ? null : (y.x = this.getValue(e, "x", 0) * o, + y.y = this.getValue(e, "y", 0) * o, + y.rotation = this.getValue(e, "rotation", 0), + null != (g = this.getValue(e, "color", null)) && y.color.setFromString(g), + y); + case "clipping": + var v = this.attachmentLoader.newClippingAttachment(n, s); + if (null == v) + return null; + var g, A = this.getValue(e, "end", null); + if (null != A) { + var x = a.findSlot(A); + if (null == x) + throw new Error("Clipping end slot not found: " + A); + v.endSlot = x + } + return d = e.vertexCount, + this.readVertices(e, v, d << 1), + null != (g = this.getValue(e, "color", null)) && v.color.setFromString(g), + v + } + return null + } + , + e.prototype.readVertices = function(e, i, n) { + var r = this.scale; + i.worldVerticesLength = n; + var s = e.vertices; + if (n != s.length) { + var a = new Array + , o = new Array; + for (u = 0, + _ = s.length; u < _; ) { + var l = s[u++]; + o.push(l); + for (var h = u + 4 * l; u < h; u += 4) + o.push(s[u]), + a.push(s[u + 1] * r), + a.push(s[u + 2] * r), + a.push(s[u + 3]) + } + i.bones = o, + i.vertices = t.Utils.toFloatArray(a) + } else { + var c = t.Utils.toFloatArray(s); + if (1 != r) + for (var u = 0, _ = s.length; u < _; u++) + c[u] *= r; + i.vertices = c + } + } + , + e.prototype.readAnimation = function(e, i, n) { + var r = this.scale + , s = new Array + , a = 0; + if (e.slots) + for (var o in e.slots) { + var l = e.slots[o]; + if (-1 == (K = n.findSlotIndex(o))) + throw new Error("Slot not found: " + o); + for (var h in l) { + var c = l[h]; + if ("attachment" == h) { + (A = new t.AttachmentTimeline(c.length)).slotIndex = K; + for (var u = 0, _ = 0; _ < c.length; _++) { + var f = c[_]; + A.setFrame(u++, this.getValue(f, "time", 0), f.name) + } + s.push(A), + a = Math.max(a, A.frames[A.getFrameCount() - 1]) + } else if ("color" == h) { + for ((A = new t.ColorTimeline(c.length)).slotIndex = K, + u = 0, + _ = 0; _ < c.length; _++) { + f = c[_]; + var d = new t.Color; + d.setFromString(f.color), + A.setFrame(u, this.getValue(f, "time", 0), d.r, d.g, d.b, d.a), + this.readCurve(f, A, u), + u++ + } + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.ColorTimeline.ENTRIES]) + } else { + if ("twoColor" != h) + throw new Error("Invalid timeline type for a slot: " + h + " (" + o + ")"); + for ((A = new t.TwoColorTimeline(c.length)).slotIndex = K, + u = 0, + _ = 0; _ < c.length; _++) { + f = c[_]; + var p = new t.Color + , m = new t.Color; + p.setFromString(f.light), + m.setFromString(f.dark), + A.setFrame(u, this.getValue(f, "time", 0), p.r, p.g, p.b, p.a, m.r, m.g, m.b), + this.readCurve(f, A, u), + u++ + } + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.TwoColorTimeline.ENTRIES]) + } + } + } + if (e.bones) + for (var y in e.bones) { + var v = e.bones[y] + , g = n.findBoneIndex(y); + if (-1 == g) + throw new Error("Bone not found: " + y); + for (var h in v) + if (c = v[h], + "rotate" === h) { + for ((A = new t.RotateTimeline(c.length)).boneIndex = g, + u = 0, + _ = 0; _ < c.length; _++) + f = c[_], + A.setFrame(u, this.getValue(f, "time", 0), this.getValue(f, "angle", 0)), + this.readCurve(f, A, u), + u++; + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.RotateTimeline.ENTRIES]) + } else { + if ("translate" !== h && "scale" !== h && "shear" !== h) + throw new Error("Invalid timeline type for a bone: " + h + " (" + y + ")"); + var A = null + , x = 1 + , b = 0; + for ("scale" === h ? (A = new t.ScaleTimeline(c.length), + b = 1) : "shear" === h ? A = new t.ShearTimeline(c.length) : (A = new t.TranslateTimeline(c.length), + x = r), + A.boneIndex = g, + u = 0, + _ = 0; _ < c.length; _++) { + f = c[_]; + var C = this.getValue(f, "x", b) + , T = this.getValue(f, "y", b); + A.setFrame(u, this.getValue(f, "time", 0), C * x, T * x), + this.readCurve(f, A, u), + u++ + } + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.TranslateTimeline.ENTRIES]) + } + } + if (e.ik) + for (var S in e.ik) { + var w = e.ik[S] + , E = n.findIkConstraint(S); + for ((A = new t.IkConstraintTimeline(w.length)).ikConstraintIndex = n.ikConstraints.indexOf(E), + u = 0, + _ = 0; _ < w.length; _++) + f = w[_], + A.setFrame(u, this.getValue(f, "time", 0), this.getValue(f, "mix", 1), this.getValue(f, "softness", 0) * r, this.getValue(f, "bendPositive", !0) ? 1 : -1, this.getValue(f, "compress", !1), this.getValue(f, "stretch", !1)), + this.readCurve(f, A, u), + u++; + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.IkConstraintTimeline.ENTRIES]) + } + if (e.transform) + for (var S in e.transform) { + for (w = e.transform[S], + E = n.findTransformConstraint(S), + (A = new t.TransformConstraintTimeline(w.length)).transformConstraintIndex = n.transformConstraints.indexOf(E), + u = 0, + _ = 0; _ < w.length; _++) + f = w[_], + A.setFrame(u, this.getValue(f, "time", 0), this.getValue(f, "rotateMix", 1), this.getValue(f, "translateMix", 1), this.getValue(f, "scaleMix", 1), this.getValue(f, "shearMix", 1)), + this.readCurve(f, A, u), + u++; + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.TransformConstraintTimeline.ENTRIES]) + } + var M = e.path || e.paths; + if (M) + for (var S in M) { + w = M[S]; + var D = n.findPathConstraintIndex(S); + if (-1 == D) + throw new Error("Path constraint not found: " + S); + var B = n.pathConstraints[D]; + for (var h in w) + if (c = w[h], + "position" === h || "spacing" === h) { + for (A = null, + x = 1, + "spacing" === h ? (A = new t.PathConstraintSpacingTimeline(c.length), + B.spacingMode != t.SpacingMode.Length && B.spacingMode != t.SpacingMode.Fixed || (x = r)) : (A = new t.PathConstraintPositionTimeline(c.length), + B.positionMode == t.PositionMode.Fixed && (x = r)), + A.pathConstraintIndex = D, + u = 0, + _ = 0; _ < c.length; _++) + f = c[_], + A.setFrame(u, this.getValue(f, "time", 0), this.getValue(f, h, 0) * x), + this.readCurve(f, A, u), + u++; + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.PathConstraintPositionTimeline.ENTRIES]) + } else if ("mix" === h) { + for ((A = new t.PathConstraintMixTimeline(c.length)).pathConstraintIndex = D, + u = 0, + _ = 0; _ < c.length; _++) + f = c[_], + A.setFrame(u, this.getValue(f, "time", 0), this.getValue(f, "rotateMix", 1), this.getValue(f, "translateMix", 1)), + this.readCurve(f, A, u), + u++; + s.push(A), + a = Math.max(a, A.frames[(A.getFrameCount() - 1) * t.PathConstraintMixTimeline.ENTRIES]) + } + } + if (e.deform) + for (var I in e.deform) { + var P = e.deform[I] + , R = n.findSkin(I); + if (null == R) + throw new Error("Skin not found: " + I); + for (var o in P) { + if (l = P[o], + -1 == (K = n.findSlotIndex(o))) + throw new Error("Slot not found: " + l.name); + for (var h in l) { + c = l[h]; + var O = R.getAttachment(K, h); + if (null != O) { + var L = null != O.bones + , F = O.vertices + , V = L ? F.length / 3 * 2 : F.length; + (A = new t.DeformTimeline(c.length)).slotIndex = K, + A.attachment = O, + u = 0; + for (var N = 0; N < c.length; N++) { + f = c[N]; + var k = void 0 + , G = this.getValue(f, "vertices", null); + if (null == G) + k = L ? t.Utils.newFloatArray(V) : F; + else { + k = t.Utils.newFloatArray(V); + var U = this.getValue(f, "offset", 0); + if (t.Utils.arrayCopy(G, 0, k, U, G.length), + 1 != r) + for (var z = (_ = U) + G.length; _ < z; _++) + k[_] *= r; + if (!L) + for (_ = 0; _ < V; _++) + k[_] += F[_] + } + A.setFrame(u, this.getValue(f, "time", 0), k), + this.readCurve(f, A, u), + u++ + } + s.push(A), + a = Math.max(a, A.frames[A.getFrameCount() - 1]) + } + } + } + } + var H = e.drawOrder; + if (null == H && (H = e.draworder), + null != H) { + A = new t.DrawOrderTimeline(H.length); + var W = n.slots.length; + for (u = 0, + N = 0; N < H.length; N++) { + var j = H[N] + , X = null + , Y = this.getValue(j, "offsets", null); + if (null != Y) { + X = t.Utils.newArray(W, -1); + var q = t.Utils.newArray(W - Y.length, 0) + , J = 0 + , Z = 0; + for (_ = 0; _ < Y.length; _++) { + var K, Q = Y[_]; + if (-1 == (K = n.findSlotIndex(Q.slot))) + throw new Error("Slot not found: " + Q.slot); + for (; J != K; ) + q[Z++] = J++; + X[J + Q.offset] = J++ + } + for (; J < W; ) + q[Z++] = J++; + for (_ = W - 1; _ >= 0; _--) + -1 == X[_] && (X[_] = q[--Z]) + } + A.setFrame(u++, this.getValue(j, "time", 0), X) + } + s.push(A), + a = Math.max(a, A.frames[A.getFrameCount() - 1]) + } + if (e.events) { + for (A = new t.EventTimeline(e.events.length), + u = 0, + _ = 0; _ < e.events.length; _++) { + var $ = e.events[_] + , tt = n.findEvent($.name); + if (null == tt) + throw new Error("Event not found: " + $.name); + var et = new t.Event(t.Utils.toSinglePrecision(this.getValue($, "time", 0)),tt); + et.intValue = this.getValue($, "int", tt.intValue), + et.floatValue = this.getValue($, "float", tt.floatValue), + et.stringValue = this.getValue($, "string", tt.stringValue), + null != et.data.audioPath && (et.volume = this.getValue($, "volume", 1), + et.balance = this.getValue($, "balance", 0)), + A.setFrame(u++, et) + } + s.push(A), + a = Math.max(a, A.frames[A.getFrameCount() - 1]) + } + if (isNaN(a)) + throw new Error("Error while parsing animation, duration is NaN"); + n.animations.push(new t.Animation(i,s,a)) + } + , + e.prototype.readCurve = function(t, e, i) { + var n = t.curve; + n && ("stepped" == n ? e.setStepped(i) : "[object Array]" === Object.prototype.toString.call(n) ? e.setCurve(i, n[0], n[1], n[2], n[3]) : e.setCurve(i, n, this.getValue(t, "c2", 0), this.getValue(t, "c3", 1), this.getValue(t, "c4", 1))) + } + , + e.prototype.getValue = function(t, e, i) { + return void 0 !== t[e] ? t[e] : i + } + , + e.blendModeFromString = function(e) { + if ("normal" == (e = e.toLowerCase())) + return t.BlendMode.Normal; + if ("additive" == e) + return t.BlendMode.Additive; + if ("multiply" == e) + return t.BlendMode.Multiply; + if ("screen" == e) + return t.BlendMode.Screen; + throw new Error("Unknown blend mode: " + e) + } + , + e.positionModeFromString = function(e) { + if ("fixed" == (e = e.toLowerCase())) + return t.PositionMode.Fixed; + if ("percent" == e) + return t.PositionMode.Percent; + throw new Error("Unknown position mode: " + e) + } + , + e.spacingModeFromString = function(e) { + if ("length" == (e = e.toLowerCase())) + return t.SpacingMode.Length; + if ("fixed" == e) + return t.SpacingMode.Fixed; + if ("percent" == e) + return t.SpacingMode.Percent; + throw new Error("Unknown position mode: " + e) + } + , + e.rotateModeFromString = function(e) { + if ("tangent" == (e = e.toLowerCase())) + return t.RotateMode.Tangent; + if ("chain" == e) + return t.RotateMode.Chain; + if ("chainscale" == e) + return t.RotateMode.ChainScale; + throw new Error("Unknown rotate mode: " + e) + } + , + e.transformModeFromString = function(e) { + if ("normal" == (e = e.toLowerCase())) + return t.TransformMode.Normal; + if ("onlytranslation" == e) + return t.TransformMode.OnlyTranslation; + if ("norotationorreflection" == e) + return t.TransformMode.NoRotationOrReflection; + if ("noscale" == e) + return t.TransformMode.NoScale; + if ("noscaleorreflection" == e) + return t.TransformMode.NoScaleOrReflection; + throw new Error("Unknown transform mode: " + e) + } + , + e + } + )(); + t.SkeletonJson = e; + var i = function(t, e, i, n, r) { + this.mesh = t, + this.skin = e, + this.slotIndex = i, + this.parent = n, + this.inheritDeform = r + } + } + )(r || (r = {})), + (function(t) { + var e = function(t, e, i) { + this.slotIndex = t, + this.name = e, + this.attachment = i + }; + t.SkinEntry = e; + var i = (function() { + function i(t) { + if (this.attachments = new Array, + this.bones = Array(), + this.constraints = new Array, + null == t) + throw new Error("name cannot be null."); + this.name = t + } + return i.prototype.setAttachment = function(t, e, i) { + if (null == i) + throw new Error("attachment cannot be null."); + var n = this.attachments; + t >= n.length && (n.length = t + 1), + n[t] || (n[t] = {}), + n[t][e] = i + } + , + i.prototype.addSkin = function(t) { + for (var e = 0; e < t.bones.length; e++) { + for (var i = t.bones[e], n = !1, r = 0; r < this.bones.length; r++) + if (this.bones[r] == i) { + n = !0; + break + } + n || this.bones.push(i) + } + for (e = 0; e < t.constraints.length; e++) { + var s = t.constraints[e]; + for (n = !1, + r = 0; r < this.constraints.length; r++) + if (this.constraints[r] == s) { + n = !0; + break + } + n || this.constraints.push(s) + } + var a = t.getAttachments(); + for (e = 0; e < a.length; e++) { + var o = a[e]; + this.setAttachment(o.slotIndex, o.name, o.attachment) + } + } + , + i.prototype.copySkin = function(e) { + for (var i = 0; i < e.bones.length; i++) { + for (var n = e.bones[i], r = !1, s = 0; s < this.bones.length; s++) + if (this.bones[s] == n) { + r = !0; + break + } + r || this.bones.push(n) + } + for (i = 0; i < e.constraints.length; i++) { + var a = e.constraints[i]; + for (r = !1, + s = 0; s < this.constraints.length; s++) + if (this.constraints[s] == a) { + r = !0; + break + } + r || this.constraints.push(a) + } + var o = e.getAttachments(); + for (i = 0; i < o.length; i++) { + var l = o[i]; + null != l.attachment && (l.attachment instanceof t.MeshAttachment ? (l.attachment = l.attachment.newLinkedMesh(), + this.setAttachment(l.slotIndex, l.name, l.attachment)) : (l.attachment = l.attachment.copy(), + this.setAttachment(l.slotIndex, l.name, l.attachment))) + } + } + , + i.prototype.getAttachment = function(t, e) { + var i = this.attachments[t]; + return i ? i[e] : null + } + , + i.prototype.removeAttachment = function(t, e) { + var i = this.attachments[t]; + i && (i[e] = null) + } + , + i.prototype.getAttachments = function() { + for (var t = new Array, i = 0; i < this.attachments.length; i++) { + var n = this.attachments[i]; + if (n) + for (var r in n) { + var s = n[r]; + s && t.push(new e(i,r,s)) + } + } + return t + } + , + i.prototype.getAttachmentsForSlot = function(t, i) { + var n = this.attachments[t]; + if (n) + for (var r in n) { + var s = n[r]; + s && i.push(new e(t,r,s)) + } + } + , + i.prototype.clear = function() { + this.attachments.length = 0, + this.bones.length = 0, + this.constraints.length = 0 + } + , + i.prototype.attachAll = function(t, e) { + for (var i = 0, n = 0; n < t.slots.length; n++) { + var r = t.slots[n] + , s = r.getAttachment(); + if (s && i < e.attachments.length) { + var a = e.attachments[i]; + for (var o in a) + if (s == a[o]) { + var l = this.getAttachment(i, o); + null != l && r.setAttachment(l); + break + } + } + i++ + } + } + , + i + } + )(); + t.Skin = i + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(e, i) { + if (this.deform = new Array, + null == e) + throw new Error("data cannot be null."); + if (null == i) + throw new Error("bone cannot be null."); + this.data = e, + this.bone = i, + this.color = new t.Color, + this.darkColor = null == e.darkColor ? null : new t.Color, + this.setToSetupPose() + } + return e.prototype.getSkeleton = function() { + return this.bone.skeleton + } + , + e.prototype.getAttachment = function() { + return this.attachment + } + , + e.prototype.setAttachment = function(t) { + this.attachment != t && (this.attachment = t, + this.attachmentTime = this.bone.skeleton.time, + this.deform.length = 0) + } + , + e.prototype.setAttachmentTime = function(t) { + this.attachmentTime = this.bone.skeleton.time - t + } + , + e.prototype.getAttachmentTime = function() { + return this.bone.skeleton.time - this.attachmentTime + } + , + e.prototype.setToSetupPose = function() { + this.color.setFromColor(this.data.color), + null != this.darkColor && this.darkColor.setFromColor(this.data.darkColor), + null == this.data.attachmentName ? this.attachment = null : (this.attachment = null, + this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName))) + } + , + e + } + )(); + t.Slot = e + } + )(r || (r = {})), + (function(t) { + t.SlotData = function(e, i, n) { + if (this.color = new t.Color(1,1,1,1), + e < 0) + throw new Error("index must be >= 0."); + if (null == i) + throw new Error("name cannot be null."); + if (null == n) + throw new Error("boneData cannot be null."); + this.index = e, + this.name = i, + this.boneData = n + } + } + )(r || (r = {})), + (function(t) { + var e, i, n = (function() { + function t(t) { + this._image = t + } + return t.prototype.getImage = function() { + return this._image + } + , + t.filterFromString = function(t) { + switch (t.toLowerCase()) { + case "nearest": + return e.Nearest; + case "linear": + return e.Linear; + case "mipmap": + return e.MipMap; + case "mipmapnearestnearest": + return e.MipMapNearestNearest; + case "mipmaplinearnearest": + return e.MipMapLinearNearest; + case "mipmapnearestlinear": + return e.MipMapNearestLinear; + case "mipmaplinearlinear": + return e.MipMapLinearLinear; + default: + throw new Error("Unknown texture filter " + t) + } + } + , + t.wrapFromString = function(t) { + switch (t.toLowerCase()) { + case "mirroredtepeat": + return i.MirroredRepeat; + case "clamptoedge": + return i.ClampToEdge; + case "repeat": + return i.Repeat; + default: + throw new Error("Unknown texture wrap " + t) + } + } + , + t + } + )(); + t.Texture = n, + (function(t) { + t[t.Nearest = 9728] = "Nearest", + t[t.Linear = 9729] = "Linear", + t[t.MipMap = 9987] = "MipMap", + t[t.MipMapNearestNearest = 9984] = "MipMapNearestNearest", + t[t.MipMapLinearNearest = 9985] = "MipMapLinearNearest", + t[t.MipMapNearestLinear = 9986] = "MipMapNearestLinear", + t[t.MipMapLinearLinear = 9987] = "MipMapLinearLinear" + } + )(e = t.TextureFilter || (t.TextureFilter = {})), + (function(t) { + t[t.MirroredRepeat = 33648] = "MirroredRepeat", + t[t.ClampToEdge = 33071] = "ClampToEdge", + t[t.Repeat = 10497] = "Repeat" + } + )(i = t.TextureWrap || (t.TextureWrap = {})); + t.TextureRegion = function() { + this.u = 0, + this.v = 0, + this.u2 = 0, + this.v2 = 0, + this.width = 0, + this.height = 0, + this.rotate = !1, + this.offsetX = 0, + this.offsetY = 0, + this.originalWidth = 0, + this.originalHeight = 0 + } + ; + var r = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e.prototype.setFilters = function() {} + , + e.prototype.setWraps = function() {} + , + e.prototype.dispose = function() {} + , + e + } + )(n); + t.FakeTexture = r + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t, e) { + this.pages = new Array, + this.regions = new Array, + this.load(t, e) + } + return e.prototype.load = function(e, s) { + if (null == s) + throw new Error("textureLoader cannot be null."); + for (var a = new i(e), o = new Array(4), l = null; ; ) { + var h = a.readLine(); + if (null == h) + break; + if (0 == (h = h.trim()).length) + l = null; + else if (l) { + var c = new r; + c.name = h, + c.page = l; + var u = a.readValue(); + "true" == u.toLocaleLowerCase() ? c.degrees = 90 : "false" == u.toLocaleLowerCase() ? c.degrees = 0 : c.degrees = parseFloat(u), + c.rotate = 90 == c.degrees, + a.readTuple(o); + var _ = parseInt(o[0]) + , f = parseInt(o[1]); + a.readTuple(o); + var d = parseInt(o[0]) + , p = parseInt(o[1]); + c.u = _ / l.width, + c.v = f / l.height, + c.rotate ? (c.u2 = (_ + p) / l.width, + c.v2 = (f + d) / l.height) : (c.u2 = (_ + d) / l.width, + c.v2 = (f + p) / l.height), + c.x = _, + c.y = f, + c.width = Math.abs(d), + c.height = Math.abs(p), + 4 == a.readTuple(o) && 4 == a.readTuple(o) && a.readTuple(o), + c.originalWidth = parseInt(o[0]), + c.originalHeight = parseInt(o[1]), + a.readTuple(o), + c.offsetX = parseInt(o[0]), + c.offsetY = parseInt(o[1]), + c.index = parseInt(a.readValue()), + c.texture = l.texture, + this.regions.push(c) + } else { + (l = new n).name = h, + 2 == a.readTuple(o) && (l.width = parseInt(o[0]), + l.height = parseInt(o[1]), + a.readTuple(o)), + a.readTuple(o), + l.minFilter = t.Texture.filterFromString(o[0]), + l.magFilter = t.Texture.filterFromString(o[1]); + var m = a.readValue(); + l.uWrap = t.TextureWrap.ClampToEdge, + l.vWrap = t.TextureWrap.ClampToEdge, + "x" == m ? l.uWrap = t.TextureWrap.Repeat : "y" == m ? l.vWrap = t.TextureWrap.Repeat : "xy" == m && (l.uWrap = l.vWrap = t.TextureWrap.Repeat), + l.texture = s(h), + l.texture.setFilters(l.minFilter, l.magFilter), + l.texture.setWraps(l.uWrap, l.vWrap), + l.width = l.texture.getImage().width, + l.height = l.texture.getImage().height, + this.pages.push(l) + } + } + } + , + e.prototype.findRegion = function(t) { + for (var e = 0; e < this.regions.length; e++) + if (this.regions[e].name == t) + return this.regions[e]; + return null + } + , + e.prototype.dispose = function() { + for (var t = 0; t < this.pages.length; t++) + this.pages[t].texture.dispose() + } + , + e + } + )(); + t.TextureAtlas = e; + var i = (function() { + function t(t) { + this.index = 0, + this.lines = t.split(/\r\n|\r|\n/) + } + return t.prototype.readLine = function() { + return this.index >= this.lines.length ? null : this.lines[this.index++] + } + , + t.prototype.readValue = function() { + var t = this.readLine() + , e = t.indexOf(":"); + if (-1 == e) + throw new Error("Invalid line: " + t); + return t.substring(e + 1).trim() + } + , + t.prototype.readTuple = function(t) { + var e = this.readLine() + , i = e.indexOf(":"); + if (-1 == i) + throw new Error("Invalid line: " + e); + for (var n = 0, r = i + 1; n < 3; n++) { + var s = e.indexOf(",", r); + if (-1 == s) + break; + t[n] = e.substr(r, s - r).trim(), + r = s + 1 + } + return t[n] = e.substring(r).trim(), + n + 1 + } + , + t + } + )() + , n = function() {}; + t.TextureAtlasPage = n; + var r = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return s(e, t), + e + } + )(t.TextureRegion); + t.TextureAtlasRegion = r + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(e, i) { + if (this.rotateMix = 0, + this.translateMix = 0, + this.scaleMix = 0, + this.shearMix = 0, + this.temp = new t.Vector2, + this.active = !1, + null == e) + throw new Error("data cannot be null."); + if (null == i) + throw new Error("skeleton cannot be null."); + this.data = e, + this.rotateMix = e.rotateMix, + this.translateMix = e.translateMix, + this.scaleMix = e.scaleMix, + this.shearMix = e.shearMix, + this.bones = new Array; + for (var n = 0; n < e.bones.length; n++) + this.bones.push(i.findBone(e.bones[n].name)); + this.target = i.findBone(e.target.name) + } + return e.prototype.isActive = function() { + return this.active + } + , + e.prototype.apply = function() { + this.update() + } + , + e.prototype.update = function() { + this.data.local ? this.data.relative ? this.applyRelativeLocal() : this.applyAbsoluteLocal() : this.data.relative ? this.applyRelativeWorld() : this.applyAbsoluteWorld() + } + , + e.prototype.applyAbsoluteWorld = function() { + for (var e = this.rotateMix, i = this.translateMix, n = this.scaleMix, r = this.shearMix, s = this.target, a = s.a, o = s.b, l = s.c, h = s.d, c = a * h - o * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad, u = this.data.offsetRotation * c, _ = this.data.offsetShearY * c, f = this.bones, d = 0, p = f.length; d < p; d++) { + var m = f[d] + , y = !1; + if (0 != e) { + var v = m.a + , g = m.b + , A = m.c + , x = m.d; + (E = Math.atan2(l, a) - Math.atan2(A, v) + u) > t.MathUtils.PI ? E -= t.MathUtils.PI2 : E < -t.MathUtils.PI && (E += t.MathUtils.PI2), + E *= e; + var b = Math.cos(E) + , C = Math.sin(E); + m.a = b * v - C * A, + m.b = b * g - C * x, + m.c = C * v + b * A, + m.d = C * g + b * x, + y = !0 + } + if (0 != i) { + var T = this.temp; + s.localToWorld(T.set(this.data.offsetX, this.data.offsetY)), + m.worldX += (T.x - m.worldX) * i, + m.worldY += (T.y - m.worldY) * i, + y = !0 + } + if (n > 0) { + var S = Math.sqrt(m.a * m.a + m.c * m.c) + , w = Math.sqrt(a * a + l * l); + S > 1e-5 && (S = (S + (w - S + this.data.offsetScaleX) * n) / S), + m.a *= S, + m.c *= S, + S = Math.sqrt(m.b * m.b + m.d * m.d), + w = Math.sqrt(o * o + h * h), + S > 1e-5 && (S = (S + (w - S + this.data.offsetScaleY) * n) / S), + m.b *= S, + m.d *= S, + y = !0 + } + if (r > 0) { + g = m.b, + x = m.d; + var E, M = Math.atan2(x, g); + (E = Math.atan2(h, o) - Math.atan2(l, a) - (M - Math.atan2(m.c, m.a))) > t.MathUtils.PI ? E -= t.MathUtils.PI2 : E < -t.MathUtils.PI && (E += t.MathUtils.PI2), + E = M + (E + _) * r, + S = Math.sqrt(g * g + x * x), + m.b = Math.cos(E) * S, + m.d = Math.sin(E) * S, + y = !0 + } + y && (m.appliedValid = !1) + } + } + , + e.prototype.applyRelativeWorld = function() { + for (var e = this.rotateMix, i = this.translateMix, n = this.scaleMix, r = this.shearMix, s = this.target, a = s.a, o = s.b, l = s.c, h = s.d, c = a * h - o * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad, u = this.data.offsetRotation * c, _ = this.data.offsetShearY * c, f = this.bones, d = 0, p = f.length; d < p; d++) { + var m, y = f[d], v = !1; + if (0 != e) { + var g = y.a + , A = y.b + , x = y.c + , b = y.d; + (m = Math.atan2(l, a) + u) > t.MathUtils.PI ? m -= t.MathUtils.PI2 : m < -t.MathUtils.PI && (m += t.MathUtils.PI2), + m *= e; + var C = Math.cos(m) + , T = Math.sin(m); + y.a = C * g - T * x, + y.b = C * A - T * b, + y.c = T * g + C * x, + y.d = T * A + C * b, + v = !0 + } + if (0 != i) { + var S = this.temp; + s.localToWorld(S.set(this.data.offsetX, this.data.offsetY)), + y.worldX += S.x * i, + y.worldY += S.y * i, + v = !0 + } + if (n > 0) { + var w = (Math.sqrt(a * a + l * l) - 1 + this.data.offsetScaleX) * n + 1; + y.a *= w, + y.c *= w, + w = (Math.sqrt(o * o + h * h) - 1 + this.data.offsetScaleY) * n + 1, + y.b *= w, + y.d *= w, + v = !0 + } + if (r > 0) + (m = Math.atan2(h, o) - Math.atan2(l, a)) > t.MathUtils.PI ? m -= t.MathUtils.PI2 : m < -t.MathUtils.PI && (m += t.MathUtils.PI2), + A = y.b, + b = y.d, + m = Math.atan2(b, A) + (m - t.MathUtils.PI / 2 + _) * r, + w = Math.sqrt(A * A + b * b), + y.b = Math.cos(m) * w, + y.d = Math.sin(m) * w, + v = !0; + v && (y.appliedValid = !1) + } + } + , + e.prototype.applyAbsoluteLocal = function() { + var t = this.rotateMix + , e = this.translateMix + , i = this.scaleMix + , n = this.shearMix + , r = this.target; + r.appliedValid || r.updateAppliedTransform(); + for (var s = this.bones, a = 0, o = s.length; a < o; a++) { + var l = s[a]; + l.appliedValid || l.updateAppliedTransform(); + var h = l.arotation; + if (0 != t) { + var c = r.arotation - h + this.data.offsetRotation; + h += (c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0))) * t + } + var u = l.ax + , _ = l.ay; + 0 != e && (u += (r.ax - u + this.data.offsetX) * e, + _ += (r.ay - _ + this.data.offsetY) * e); + var f = l.ascaleX + , d = l.ascaleY; + 0 != i && (f > 1e-5 && (f = (f + (r.ascaleX - f + this.data.offsetScaleX) * i) / f), + d > 1e-5 && (d = (d + (r.ascaleY - d + this.data.offsetScaleY) * i) / d)); + var p = l.ashearY; + 0 != n && (c = r.ashearY - p + this.data.offsetShearY, + c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0)), + l.shearY += c * n), + l.updateWorldTransformWith(u, _, h, f, d, l.ashearX, p) + } + } + , + e.prototype.applyRelativeLocal = function() { + var t = this.rotateMix + , e = this.translateMix + , i = this.scaleMix + , n = this.shearMix + , r = this.target; + r.appliedValid || r.updateAppliedTransform(); + for (var s = this.bones, a = 0, o = s.length; a < o; a++) { + var l = s[a]; + l.appliedValid || l.updateAppliedTransform(); + var h = l.arotation; + 0 != t && (h += (r.arotation + this.data.offsetRotation) * t); + var c = l.ax + , u = l.ay; + 0 != e && (c += (r.ax + this.data.offsetX) * e, + u += (r.ay + this.data.offsetY) * e); + var _ = l.ascaleX + , f = l.ascaleY; + 0 != i && (_ > 1e-5 && (_ *= (r.ascaleX - 1 + this.data.offsetScaleX) * i + 1), + f > 1e-5 && (f *= (r.ascaleY - 1 + this.data.offsetScaleY) * i + 1)); + var d = l.ashearY; + 0 != n && (d += (r.ashearY + this.data.offsetShearY) * n), + l.updateWorldTransformWith(c, u, h, _, f, l.ashearX, d) + } + } + , + e + } + )(); + t.TransformConstraint = e + } + )(r || (r = {})), + (function(t) { + var e = (function(t) { + function e(e) { + var i = t.call(this, e, 0, !1) || this; + return i.bones = new Array, + i.rotateMix = 0, + i.translateMix = 0, + i.scaleMix = 0, + i.shearMix = 0, + i.offsetRotation = 0, + i.offsetX = 0, + i.offsetY = 0, + i.offsetScaleX = 0, + i.offsetScaleY = 0, + i.offsetShearY = 0, + i.relative = !1, + i.local = !1, + i + } + return s(e, t), + e + } + )(t.ConstraintData); + t.TransformConstraintData = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e() { + this.convexPolygons = new Array, + this.convexPolygonsIndices = new Array, + this.indicesArray = new Array, + this.isConcaveArray = new Array, + this.triangles = new Array, + this.polygonPool = new t.Pool(function() { + return new Array + } + ), + this.polygonIndicesPool = new t.Pool(function() { + return new Array + } + ) + } + return e.prototype.triangulate = function(t) { + var i = t + , n = t.length >> 1 + , r = this.indicesArray; + r.length = 0; + for (var s = 0; s < n; s++) + r[s] = s; + var a = this.isConcaveArray; + a.length = 0, + s = 0; + for (var o = n; s < o; ++s) + a[s] = e.isConcave(s, n, i, r); + var l = this.triangles; + for (l.length = 0; n > 3; ) { + for (var h = n - 1, c = (s = 0, + 1); ; ) { + t: if (!a[s]) { + for (var u = r[h] << 1, _ = r[s] << 1, f = r[c] << 1, d = i[u], p = i[u + 1], m = i[_], y = i[_ + 1], v = i[f], g = i[f + 1], A = (c + 1) % n; A != h; A = (A + 1) % n) + if (a[A]) { + var x = r[A] << 1 + , b = i[x] + , C = i[x + 1]; + if (e.positiveArea(v, g, d, p, b, C) && e.positiveArea(d, p, m, y, b, C) && e.positiveArea(m, y, v, g, b, C)) + break t + } + break + } + if (0 == c) { + do { + if (!a[s]) + break; + s-- + } while (s > 0);break + } + h = s, + s = c, + c = (c + 1) % n + } + l.push(r[(n + s - 1) % n]), + l.push(r[s]), + l.push(r[(s + 1) % n]), + r.splice(s, 1), + a.splice(s, 1); + var T = (--n + s - 1) % n + , S = s == n ? 0 : s; + a[T] = e.isConcave(T, n, i, r), + a[S] = e.isConcave(S, n, i, r) + } + return 3 == n && (l.push(r[2]), + l.push(r[0]), + l.push(r[1])), + l + } + , + e.prototype.decompose = function(t, i) { + var n = t + , r = this.convexPolygons; + this.polygonPool.freeAll(r), + r.length = 0; + var s = this.convexPolygonsIndices; + this.polygonIndicesPool.freeAll(s), + s.length = 0; + var a = this.polygonIndicesPool.obtain(); + a.length = 0; + var o = this.polygonPool.obtain(); + o.length = 0; + for (var l = -1, h = 0, c = 0, u = i.length; c < u; c += 3) { + var _ = i[c] << 1 + , f = i[c + 1] << 1 + , d = i[c + 2] << 1 + , p = n[_] + , m = n[_ + 1] + , y = n[f] + , v = n[f + 1] + , g = n[d] + , A = n[d + 1] + , x = !1; + if (l == _) { + var b = o.length - 4 + , C = e.winding(o[b], o[b + 1], o[b + 2], o[b + 3], g, A) + , T = e.winding(g, A, o[0], o[1], o[2], o[3]); + C == h && T == h && (o.push(g), + o.push(A), + a.push(d), + x = !0) + } + x || (o.length > 0 ? (r.push(o), + s.push(a)) : (this.polygonPool.free(o), + this.polygonIndicesPool.free(a)), + (o = this.polygonPool.obtain()).length = 0, + o.push(p), + o.push(m), + o.push(y), + o.push(v), + o.push(g), + o.push(A), + (a = this.polygonIndicesPool.obtain()).length = 0, + a.push(_), + a.push(f), + a.push(d), + h = e.winding(p, m, y, v, g, A), + l = _) + } + for (o.length > 0 && (r.push(o), + s.push(a)), + c = 0, + u = r.length; c < u; c++) + if (0 != (a = s[c]).length) + for (var S = a[0], w = a[a.length - 1], E = (o = r[c])[b = o.length - 4], M = o[b + 1], D = o[b + 2], B = o[b + 3], I = o[0], P = o[1], R = o[2], O = o[3], L = e.winding(E, M, D, B, I, P), F = 0; F < u; F++) + if (F != c) { + var V = s[F]; + if (3 == V.length) { + var N = V[0] + , k = V[1] + , G = V[2] + , U = r[F]; + g = U[U.length - 2], + A = U[U.length - 1], + N == S && k == w && (C = e.winding(E, M, D, B, g, A), + T = e.winding(g, A, I, P, R, O), + C == L && T == L && (U.length = 0, + V.length = 0, + o.push(g), + o.push(A), + a.push(G), + E = D, + M = B, + D = g, + B = A, + F = 0)) + } + } + for (c = r.length - 1; c >= 0; c--) + 0 == (o = r[c]).length && (r.splice(c, 1), + this.polygonPool.free(o), + a = s[c], + s.splice(c, 1), + this.polygonIndicesPool.free(a)); + return r + } + , + e.isConcave = function(t, e, i, n) { + var r = n[(e + t - 1) % e] << 1 + , s = n[t] << 1 + , a = n[(t + 1) % e] << 1; + return !this.positiveArea(i[r], i[r + 1], i[s], i[s + 1], i[a], i[a + 1]) + } + , + e.positiveArea = function(t, e, i, n, r, s) { + return t * (s - n) + i * (e - s) + r * (n - e) >= 0 + } + , + e.winding = function(t, e, i, n, r, s) { + var a = i - t + , o = n - e; + return r * o - s * a + a * e - t * o >= 0 ? 1 : -1 + } + , + e + } + )(); + t.Triangulator = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function t() { + this.array = new Array + } + return t.prototype.add = function(t) { + var e = this.contains(t); + return this.array[0 | t] = 0 | t, + !e + } + , + t.prototype.contains = function(t) { + return null != this.array[0 | t] + } + , + t.prototype.remove = function(t) { + this.array[0 | t] = void 0 + } + , + t.prototype.clear = function() { + this.array.length = 0 + } + , + t + } + )(); + t.IntSet = e; + var i = (function() { + function t(t, e, i, n) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === n && (n = 0), + this.r = t, + this.g = e, + this.b = i, + this.a = n + } + return t.prototype.set = function(t, e, i, n) { + return this.r = t, + this.g = e, + this.b = i, + this.a = n, + this.clamp(), + this + } + , + t.prototype.setFromColor = function(t) { + return this.r = t.r, + this.g = t.g, + this.b = t.b, + this.a = t.a, + this + } + , + t.prototype.setFromString = function(t) { + return t = "#" == t.charAt(0) ? t.substr(1) : t, + this.r = parseInt(t.substr(0, 2), 16) / 255, + this.g = parseInt(t.substr(2, 2), 16) / 255, + this.b = parseInt(t.substr(4, 2), 16) / 255, + this.a = (8 != t.length ? 255 : parseInt(t.substr(6, 2), 16)) / 255, + this + } + , + t.prototype.add = function(t, e, i, n) { + return this.r += t, + this.g += e, + this.b += i, + this.a += n, + this.clamp(), + this + } + , + t.prototype.clamp = function() { + return this.r < 0 ? this.r = 0 : this.r > 1 && (this.r = 1), + this.g < 0 ? this.g = 0 : this.g > 1 && (this.g = 1), + this.b < 0 ? this.b = 0 : this.b > 1 && (this.b = 1), + this.a < 0 ? this.a = 0 : this.a > 1 && (this.a = 1), + this + } + , + t.rgba8888ToColor = function(t, e) { + t.r = ((4278190080 & e) >>> 24) / 255, + t.g = ((16711680 & e) >>> 16) / 255, + t.b = ((65280 & e) >>> 8) / 255, + t.a = (255 & e) / 255 + } + , + t.rgb888ToColor = function(t, e) { + t.r = ((16711680 & e) >>> 16) / 255, + t.g = ((65280 & e) >>> 8) / 255, + t.b = (255 & e) / 255 + } + , + t.WHITE = new t(1,1,1,1), + t.RED = new t(1,0,0,1), + t.GREEN = new t(0,1,0,1), + t.BLUE = new t(0,0,1,1), + t.MAGENTA = new t(1,0,1,1), + t + } + )(); + t.Color = i; + var n = (function() { + function t() {} + return t.clamp = function(t, e, i) { + return t < e ? e : t > i ? i : t + } + , + t.cosDeg = function(e) { + return Math.cos(e * t.degRad) + } + , + t.sinDeg = function(e) { + return Math.sin(e * t.degRad) + } + , + t.signum = function(t) { + return t > 0 ? 1 : t < 0 ? -1 : 0 + } + , + t.toInt = function(t) { + return t > 0 ? Math.floor(t) : Math.ceil(t) + } + , + t.cbrt = function(t) { + var e = Math.pow(Math.abs(t), 1 / 3); + return t < 0 ? -e : e + } + , + t.randomTriangular = function(e, i) { + return t.randomTriangularWith(e, i, .5 * (e + i)) + } + , + t.randomTriangularWith = function(t, e, i) { + var n = Math.random() + , r = e - t; + return n <= (i - t) / r ? t + Math.sqrt(n * r * (i - t)) : e - Math.sqrt((1 - n) * r * (e - i)) + } + , + t.PI = 3.1415927, + t.PI2 = 2 * t.PI, + t.radiansToDegrees = 180 / t.PI, + t.radDeg = t.radiansToDegrees, + t.degreesToRadians = t.PI / 180, + t.degRad = t.degreesToRadians, + t + } + )(); + t.MathUtils = n; + var r = (function() { + function t() {} + return t.prototype.apply = function(t, e, i) { + return t + (e - t) * this.applyInternal(i) + } + , + t + } + )(); + t.Interpolation = r; + var a = (function(t) { + function e(e) { + var i = t.call(this) || this; + return i.power = 2, + i.power = e, + i + } + return s(e, t), + e.prototype.applyInternal = function(t) { + return t <= .5 ? Math.pow(2 * t, this.power) / 2 : Math.pow(2 * (t - 1), this.power) / (this.power % 2 == 0 ? -2 : 2) + 1 + } + , + e + } + )(r); + t.Pow = a; + var o = (function(t) { + function e(e) { + return t.call(this, e) || this + } + return s(e, t), + e.prototype.applyInternal = function(t) { + return Math.pow(t - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1 + } + , + e + } + )(a); + t.PowOut = o; + var l = (function() { + function t() {} + return t.arrayCopy = function(t, e, i, n, r) { + for (var s = e, a = n; s < e + r; s++, + a++) + i[a] = t[s] + } + , + t.setArraySize = function(t, e, i) { + void 0 === i && (i = 0); + var n = t.length; + if (n == e) + return t; + if (t.length = e, + n < e) + for (var r = n; r < e; r++) + t[r] = i; + return t + } + , + t.ensureArrayCapacity = function(e, i, n) { + return void 0 === n && (n = 0), + e.length >= i ? e : t.setArraySize(e, i, n) + } + , + t.newArray = function(t, e) { + for (var i = new Array(t), n = 0; n < t; n++) + i[n] = e; + return i + } + , + t.newFloatArray = function(e) { + if (t.SUPPORTS_TYPED_ARRAYS) + return new Float32Array(e); + for (var i = new Array(e), n = 0; n < i.length; n++) + i[n] = 0; + return i + } + , + t.newShortArray = function(e) { + if (t.SUPPORTS_TYPED_ARRAYS) + return new Int16Array(e); + for (var i = new Array(e), n = 0; n < i.length; n++) + i[n] = 0; + return i + } + , + t.toFloatArray = function(e) { + return t.SUPPORTS_TYPED_ARRAYS ? new Float32Array(e) : e + } + , + t.toSinglePrecision = function(e) { + return t.SUPPORTS_TYPED_ARRAYS ? Math.fround(e) : e + } + , + t.webkit602BugfixHelper = function() {} + , + t.contains = function(t, e, i) { + void 0 === i && (i = !0); + for (var n = 0; n < t.length; n++) + if (t[n] == e) + return !0; + return !1 + } + , + t.SUPPORTS_TYPED_ARRAYS = "undefined" != typeof Float32Array, + t + } + )(); + t.Utils = l; + var h = (function() { + function t() {} + return t.logBones = function(t) { + for (var e = 0; e < t.bones.length; e++) { + var i = t.bones[e]; + console.log(i.data.name + ", " + i.a + ", " + i.b + ", " + i.c + ", " + i.d + ", " + i.worldX + ", " + i.worldY) + } + } + , + t + } + )(); + t.DebugUtils = h; + var c = (function() { + function t(t) { + this.items = new Array, + this.instantiator = t + } + return t.prototype.obtain = function() { + return this.items.length > 0 ? this.items.pop() : this.instantiator() + } + , + t.prototype.free = function(t) { + t.reset && t.reset(), + this.items.push(t) + } + , + t.prototype.freeAll = function(t) { + for (var e = 0; e < t.length; e++) + t[e].reset && t[e].reset(), + this.items[e] = t[e] + } + , + t.prototype.clear = function() { + this.items.length = 0 + } + , + t + } + )(); + t.Pool = c; + var u = (function() { + function t(t, e) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + this.x = t, + this.y = e + } + return t.prototype.set = function(t, e) { + return this.x = t, + this.y = e, + this + } + , + t.prototype.length = function() { + var t = this.x + , e = this.y; + return Math.sqrt(t * t + e * e) + } + , + t.prototype.normalize = function() { + var t = this.length(); + return 0 != t && (this.x /= t, + this.y /= t), + this + } + , + t + } + )(); + t.Vector2 = u; + var _ = (function() { + function t() { + this.maxDelta = .064, + this.framesPerSecond = 0, + this.delta = 0, + this.totalTime = 0, + this.lastTime = Date.now() / 1e3, + this.frameCount = 0, + this.frameTime = 0 + } + return t.prototype.update = function() { + var t = Date.now() / 1e3; + this.delta = t - this.lastTime, + this.frameTime += this.delta, + this.totalTime += this.delta, + this.delta > this.maxDelta && (this.delta = this.maxDelta), + this.lastTime = t, + this.frameCount++, + this.frameTime > 1 && (this.framesPerSecond = this.frameCount / this.frameTime, + this.frameTime = 0, + this.frameCount = 0) + } + , + t + } + )(); + t.TimeKeeper = _; + var f = (function() { + function t(t) { + void 0 === t && (t = 32), + this.addedValues = 0, + this.lastValue = 0, + this.mean = 0, + this.dirty = !0, + this.values = new Array(t) + } + return t.prototype.hasEnoughData = function() { + return this.addedValues >= this.values.length + } + , + t.prototype.addValue = function(t) { + this.addedValues < this.values.length && this.addedValues++, + this.values[this.lastValue++] = t, + this.lastValue > this.values.length - 1 && (this.lastValue = 0), + this.dirty = !0 + } + , + t.prototype.getMean = function() { + if (this.hasEnoughData()) { + if (this.dirty) { + for (var t = 0, e = 0; e < this.values.length; e++) + t += this.values[e]; + this.mean = t / this.values.length, + this.dirty = !1 + } + return this.mean + } + return 0 + } + , + t + } + )(); + t.WindowedMean = f + } + )(r || (r = {})), + Math.fround || (Math.fround = (n = new Float32Array(1), + function(t) { + return n[0] = t, + n[0] + } + )), + (function(t) { + var e = function(t) { + if (null == t) + throw new Error("name cannot be null."); + this.name = t + }; + t.Attachment = e; + var i = (function(e) { + function i(t) { + var n = e.call(this, t) || this; + return n.id = (65535 & i.nextID++) << 11, + n.worldVerticesLength = 0, + n.deformAttachment = n, + n + } + return s(i, e), + i.prototype.computeWorldVertices = function(t, e, i, n, r, s) { + i = r + (i >> 1) * s; + var a = t.bone.skeleton + , o = t.deform + , l = this.vertices + , h = this.bones; + if (null != h) { + for (var c = 0, u = 0, _ = 0; _ < e; _ += 2) + c += (m = h[c]) + 1, + u += m; + var f = a.bones; + if (0 == o.length) + for (M = r, + T = 3 * u; M < i; M += s) { + var d = 0 + , p = 0 + , m = h[c++]; + for (m += c; c < m; c++, + T += 3) { + A = f[h[c]], + D = l[T], + B = l[T + 1]; + var y = l[T + 2]; + d += (D * A.a + B * A.b + A.worldX) * y, + p += (D * A.c + B * A.d + A.worldY) * y + } + n[M] = d, + n[M + 1] = p + } + else + for (var v = o, g = (M = r, + T = 3 * u, + u << 1); M < i; M += s) { + for (d = 0, + p = 0, + m = h[c++], + m += c; c < m; c++, + T += 3, + g += 2) + A = f[h[c]], + D = l[T] + v[g], + B = l[T + 1] + v[g + 1], + y = l[T + 2], + d += (D * A.a + B * A.b + A.worldX) * y, + p += (D * A.c + B * A.d + A.worldY) * y; + n[M] = d, + n[M + 1] = p + } + } else { + o.length > 0 && (l = o); + for (var A, x = (A = t.bone).worldX, b = A.worldY, C = A.a, T = A.b, S = A.c, w = A.d, E = e, M = r; M < i; E += 2, + M += s) { + var D = l[E] + , B = l[E + 1]; + n[M] = D * C + B * T + x, + n[M + 1] = D * S + B * w + b + } + } + } + , + i.prototype.copyTo = function(e) { + null != this.bones ? (e.bones = new Array(this.bones.length), + t.Utils.arrayCopy(this.bones, 0, e.bones, 0, this.bones.length)) : e.bones = null, + null != this.vertices ? (e.vertices = t.Utils.newFloatArray(this.vertices.length), + t.Utils.arrayCopy(this.vertices, 0, e.vertices, 0, this.vertices.length)) : e.vertices = null, + e.worldVerticesLength = this.worldVerticesLength, + e.deformAttachment = this.deformAttachment + } + , + i.nextID = 0, + i + } + )(e); + t.VertexAttachment = i + } + )(r || (r = {})), + (function(t) { + (function(t) { + t[t.Region = 0] = "Region", + t[t.BoundingBox = 1] = "BoundingBox", + t[t.Mesh = 2] = "Mesh", + t[t.LinkedMesh = 3] = "LinkedMesh", + t[t.Path = 4] = "Path", + t[t.Point = 5] = "Point", + t[t.Clipping = 6] = "Clipping" + } + )(t.AttachmentType || (t.AttachmentType = {})) + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i(i) { + var n = e.call(this, i) || this; + return n.color = new t.Color(1,1,1,1), + n + } + return s(i, e), + i.prototype.copy = function() { + var t = new i(name); + return this.copyTo(t), + t.color.setFromColor(this.color), + t + } + , + i + } + )(t.VertexAttachment); + t.BoundingBoxAttachment = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i(i) { + var n = e.call(this, i) || this; + return n.color = new t.Color(.2275,.2275,.8078,1), + n + } + return s(i, e), + i.prototype.copy = function() { + var t = new i(name); + return this.copyTo(t), + t.endSlot = this.endSlot, + t.color.setFromColor(this.color), + t + } + , + i + } + )(t.VertexAttachment); + t.ClippingAttachment = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i(i) { + var n = e.call(this, i) || this; + return n.color = new t.Color(1,1,1,1), + n.tempColor = new t.Color(0,0,0,0), + n + } + return s(i, e), + i.prototype.updateUVs = function() { + var e = this.regionUVs; + null != this.uvs && this.uvs.length == e.length || (this.uvs = t.Utils.newFloatArray(e.length)); + var i = this.uvs + , n = this.uvs.length + , r = this.region.u + , s = this.region.v + , a = 0 + , o = 0; + if (this.region instanceof t.TextureAtlasRegion) { + var l = this.region + , h = l.texture.getImage().width + , c = l.texture.getImage().height; + switch (l.degrees) { + case 90: + r -= (l.originalHeight - l.offsetY - l.height) / h, + s -= (l.originalWidth - l.offsetX - l.width) / c, + a = l.originalHeight / h, + o = l.originalWidth / c; + for (var u = 0; u < n; u += 2) + i[u] = r + e[u + 1] * a, + i[u + 1] = s + (1 - e[u]) * o; + return; + case 180: + for (r -= (l.originalWidth - l.offsetX - l.width) / h, + s -= l.offsetY / c, + a = l.originalWidth / h, + o = l.originalHeight / c, + u = 0; u < n; u += 2) + i[u] = r + (1 - e[u]) * a, + i[u + 1] = s + (1 - e[u + 1]) * o; + return; + case 270: + for (r -= l.offsetY / h, + s -= l.offsetX / c, + a = l.originalHeight / h, + o = l.originalWidth / c, + u = 0; u < n; u += 2) + i[u] = r + (1 - e[u + 1]) * a, + i[u + 1] = s + e[u] * o; + return + } + r -= l.offsetX / h, + s -= (l.originalHeight - l.offsetY - l.height) / c, + a = l.originalWidth / h, + o = l.originalHeight / c + } else + null == this.region ? (r = s = 0, + a = o = 1) : (a = this.region.u2 - r, + o = this.region.v2 - s); + for (u = 0; u < n; u += 2) + i[u] = r + e[u] * a, + i[u + 1] = s + e[u + 1] * o + } + , + i.prototype.getParentMesh = function() { + return this.parentMesh + } + , + i.prototype.setParentMesh = function(t) { + this.parentMesh = t, + null != t && (this.bones = t.bones, + this.vertices = t.vertices, + this.worldVerticesLength = t.worldVerticesLength, + this.regionUVs = t.regionUVs, + this.triangles = t.triangles, + this.hullLength = t.hullLength, + this.worldVerticesLength = t.worldVerticesLength) + } + , + i.prototype.copy = function() { + if (null != this.parentMesh) + return this.newLinkedMesh(); + var e = new i(this.name); + return e.region = this.region, + e.path = this.path, + e.color.setFromColor(this.color), + this.copyTo(e), + e.regionUVs = new Array(this.regionUVs.length), + t.Utils.arrayCopy(this.regionUVs, 0, e.regionUVs, 0, this.regionUVs.length), + e.uvs = new Array(this.uvs.length), + t.Utils.arrayCopy(this.uvs, 0, e.uvs, 0, this.uvs.length), + e.triangles = new Array(this.triangles.length), + t.Utils.arrayCopy(this.triangles, 0, e.triangles, 0, this.triangles.length), + e.hullLength = this.hullLength, + null != this.edges && (e.edges = new Array(this.edges.length), + t.Utils.arrayCopy(this.edges, 0, e.edges, 0, this.edges.length)), + e.width = this.width, + e.height = this.height, + e + } + , + i.prototype.newLinkedMesh = function() { + var t = new i(this.name); + return t.region = this.region, + t.path = this.path, + t.color.setFromColor(this.color), + t.deformAttachment = this.deformAttachment, + t.setParentMesh(null != this.parentMesh ? this.parentMesh : this), + t.updateUVs(), + t + } + , + i + } + )(t.VertexAttachment); + t.MeshAttachment = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i(i) { + var n = e.call(this, i) || this; + return n.closed = !1, + n.constantSpeed = !1, + n.color = new t.Color(1,1,1,1), + n + } + return s(i, e), + i.prototype.copy = function() { + var e = new i(name); + return this.copyTo(e), + e.lengths = new Array(this.lengths.length), + t.Utils.arrayCopy(this.lengths, 0, e.lengths, 0, this.lengths.length), + e.closed = closed, + e.constantSpeed = this.constantSpeed, + e.color.setFromColor(this.color), + e + } + , + i + } + )(t.VertexAttachment); + t.PathAttachment = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i(i) { + var n = e.call(this, i) || this; + return n.color = new t.Color(.38,.94,0,1), + n + } + return s(i, e), + i.prototype.computeWorldPosition = function(t, e) { + return e.x = this.x * t.a + this.y * t.b + t.worldX, + e.y = this.x * t.c + this.y * t.d + t.worldY, + e + } + , + i.prototype.computeWorldRotation = function(e) { + var i = t.MathUtils.cosDeg(this.rotation) + , n = t.MathUtils.sinDeg(this.rotation) + , r = i * e.a + n * e.b + , s = i * e.c + n * e.d; + return Math.atan2(s, r) * t.MathUtils.radDeg + } + , + i.prototype.copy = function() { + var t = new i(name); + return t.x = this.x, + t.y = this.y, + t.rotation = this.rotation, + t.color.setFromColor(this.color), + t + } + , + i + } + )(t.VertexAttachment); + t.PointAttachment = e + } + )(r || (r = {})), + (function(t) { + var e = (function(e) { + function i(i) { + var n = e.call(this, i) || this; + return n.x = 0, + n.y = 0, + n.scaleX = 1, + n.scaleY = 1, + n.rotation = 0, + n.width = 0, + n.height = 0, + n.color = new t.Color(1,1,1,1), + n.offset = t.Utils.newFloatArray(8), + n.uvs = t.Utils.newFloatArray(8), + n.tempColor = new t.Color(1,1,1,1), + n + } + return s(i, e), + i.prototype.updateOffset = function() { + var t = this.width / this.region.originalWidth * this.scaleX + , e = this.height / this.region.originalHeight * this.scaleY + , n = -this.width / 2 * this.scaleX + this.region.offsetX * t + , r = -this.height / 2 * this.scaleY + this.region.offsetY * e + , s = n + this.region.width * t + , a = r + this.region.height * e + , o = this.rotation * Math.PI / 180 + , l = Math.cos(o) + , h = Math.sin(o) + , c = n * l + this.x + , u = n * h + , _ = r * l + this.y + , f = r * h + , d = s * l + this.x + , p = s * h + , m = a * l + this.y + , y = a * h + , v = this.offset; + v[i.OX1] = c - f, + v[i.OY1] = _ + u, + v[i.OX2] = c - y, + v[i.OY2] = m + u, + v[i.OX3] = d - y, + v[i.OY3] = m + p, + v[i.OX4] = d - f, + v[i.OY4] = _ + p + } + , + i.prototype.setRegion = function(t) { + this.region = t; + var e = this.uvs; + t.rotate ? (e[2] = t.u, + e[3] = t.v2, + e[4] = t.u, + e[5] = t.v, + e[6] = t.u2, + e[7] = t.v, + e[0] = t.u2, + e[1] = t.v2) : (e[0] = t.u, + e[1] = t.v2, + e[2] = t.u, + e[3] = t.v, + e[4] = t.u2, + e[5] = t.v, + e[6] = t.u2, + e[7] = t.v2) + } + , + i.prototype.computeWorldVertices = function(t, e, n, r) { + var s = this.offset + , a = t.worldX + , o = t.worldY + , l = t.a + , h = t.b + , c = t.c + , u = t.d + , _ = 0 + , f = 0; + _ = s[i.OX1], + f = s[i.OY1], + e[n] = _ * l + f * h + a, + e[n + 1] = _ * c + f * u + o, + n += r, + _ = s[i.OX2], + f = s[i.OY2], + e[n] = _ * l + f * h + a, + e[n + 1] = _ * c + f * u + o, + n += r, + _ = s[i.OX3], + f = s[i.OY3], + e[n] = _ * l + f * h + a, + e[n + 1] = _ * c + f * u + o, + n += r, + _ = s[i.OX4], + f = s[i.OY4], + e[n] = _ * l + f * h + a, + e[n + 1] = _ * c + f * u + o + } + , + i.prototype.copy = function() { + var e = new i(name); + return e.region = this.region, + e.rendererObject = this.rendererObject, + e.path = this.path, + e.x = this.x, + e.y = this.y, + e.scaleX = this.scaleX, + e.scaleY = this.scaleY, + e.rotation = this.rotation, + e.width = this.width, + e.height = this.height, + t.Utils.arrayCopy(this.uvs, 0, e.uvs, 0, 8), + t.Utils.arrayCopy(this.offset, 0, e.offset, 0, 8), + e.color.setFromColor(this.color), + e + } + , + i.OX1 = 0, + i.OY1 = 1, + i.OX2 = 2, + i.OY2 = 3, + i.OX3 = 4, + i.OY3 = 5, + i.OX4 = 6, + i.OY4 = 7, + i.X1 = 0, + i.Y1 = 1, + i.C1R = 2, + i.C1G = 3, + i.C1B = 4, + i.C1A = 5, + i.U1 = 6, + i.V1 = 7, + i.X2 = 8, + i.Y2 = 9, + i.C2R = 10, + i.C2G = 11, + i.C2B = 12, + i.C2A = 13, + i.U2 = 14, + i.V2 = 15, + i.X3 = 16, + i.Y3 = 17, + i.C3R = 18, + i.C3G = 19, + i.C3B = 20, + i.C3A = 21, + i.U3 = 22, + i.V3 = 23, + i.X4 = 24, + i.Y4 = 25, + i.C4R = 26, + i.C4G = 27, + i.C4B = 28, + i.C4A = 29, + i.U4 = 30, + i.V4 = 31, + i + } + )(t.Attachment); + t.RegionAttachment = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t, e) { + this.jitterX = 0, + this.jitterY = 0, + this.jitterX = t, + this.jitterY = e + } + return e.prototype.begin = function() {} + , + e.prototype.transform = function(e) { + e.x += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY), + e.y += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY) + } + , + e.prototype.end = function() {} + , + e + } + )(); + t.JitterEffect = e + } + )(r || (r = {})), + (function(t) { + var e = (function() { + function e(t, e) { + this.centerX = 0, + this.centerY = 0, + this.radius = 0, + this.angle = 0, + this.worldX = 0, + this.worldY = 0, + this.radius = t, + this.interpolation = e + } + return e.prototype.begin = function(t) { + this.worldX = t.x + this.centerX, + this.worldY = t.y + this.centerY + } + , + e.prototype.transform = function(e) { + var i = this.angle * t.MathUtils.degreesToRadians + , n = e.x - this.worldX + , r = e.y - this.worldY + , s = Math.sqrt(n * n + r * r); + if (s < this.radius) { + var a = this.interpolation.apply(0, i, (this.radius - s) / this.radius) + , o = Math.cos(a) + , l = Math.sin(a); + e.x = o * n - l * r + this.worldX, + e.y = l * n + o * r + this.worldY + } + } + , + e.prototype.end = function() {} + , + e.interpolation = new t.PowOut(2), + e + } + )(); + t.SwirlEffect = e + } + )(r || (r = {})), + e.exports = r + } + ), {}], + 371: [(function(t, e) { + "use strict"; + var i, n, r, s, a, o, l = t("./track-entry-listeners"), h = t("./lib/spine"), c = [], u = [], _ = 0, f = 0, d = 0, p = null, m = null, y = 0, v = 0, g = 0, A = 0, x = null, b = null, C = 0, T = 0, S = new h.Color(1,1,1,1), w = new h.Color(1,1,1,1), E = [0, 1, 2, 2, 3, 0], M = cc.Class({ + ctor: function() { + this._privateMode = !1, + this._inited = !1, + this._invalid = !0, + this._enableCacheAttachedInfo = !1, + this.frames = [], + this.totalTime = 0, + this._frameIdx = -1, + this.isCompleted = !1, + this._skeletonInfo = null, + this._animationName = null, + this._tempSegments = null, + this._tempColors = null, + this._tempBoneInfos = null + }, + init: function(t, e) { + this._inited = !0, + this._animationName = e, + this._skeletonInfo = t + }, + clear: function() { + this._inited = !1; + for (var t = 0, e = this.frames.length; t < e; t++) + this.frames[t].segments.length = 0; + this.invalidAllFrame() + }, + bind: function(t) { + var e = function(t) { + t && t.animation.name === this._animationName && (this.isCompleted = !0) + } + .bind(this); + t.complete = e + }, + unbind: function(t) { + t.complete = null + }, + begin: function() { + if (this._invalid) { + var t = this._skeletonInfo + , e = t.curAnimationCache; + e && e !== this && (this._privateMode ? e.invalidAllFrame() : e.updateToFrame()); + var i = t.skeleton + , n = t.listener + , r = t.state + , s = i.data.findAnimation(this._animationName); + r.setAnimationWith(0, s, !1), + this.bind(n), + t.curAnimationCache = this, + this._frameIdx = -1, + this.isCompleted = !1, + this.totalTime = 0, + this._invalid = !1 + } + }, + end: function() { + this._needToUpdate() || (this._skeletonInfo.curAnimationCache = null, + this.frames.length = this._frameIdx + 1, + this.isCompleted = !0, + this.unbind(this._skeletonInfo.listener)) + }, + _needToUpdate: function(t) { + return !this.isCompleted && this.totalTime < 30 && (null == t || this._frameIdx < t) + }, + updateToFrame: function(t) { + if (this._inited && (this.begin(), + this._needToUpdate(t))) { + var e = this._skeletonInfo + , i = e.skeleton + , n = e.clipper + , r = e.state; + do { + i.update(1 / 60), + r.update(1 / 60), + r.apply(i), + i.updateWorldTransform(), + this._frameIdx++, + this._updateFrame(i, n, this._frameIdx), + this.totalTime += 1 / 60 + } while (this._needToUpdate(t));this.end() + } + }, + isInited: function() { + return this._inited + }, + isInvalid: function() { + return this._invalid + }, + invalidAllFrame: function() { + this.isCompleted = !1, + this._invalid = !0 + }, + updateAllFrame: function() { + this.invalidAllFrame(), + this.updateToFrame() + }, + enableCacheAttachedInfo: function() { + this._enableCacheAttachedInfo || (this._enableCacheAttachedInfo = !0, + this.invalidAllFrame()) + }, + _updateFrame: function(t, e, i) { + d = 0, + _ = 0, + f = 0, + p = null, + m = null, + y = 0, + v = 0, + g = 0, + A = 0, + x = null, + b = null, + this.frames[i] = this.frames[i] || { + segments: [], + colors: [], + boneInfos: [], + vertices: null, + uintVert: null, + indices: null + }; + var n = this.frames[i] + , r = this._tempSegments = n.segments + , s = this._tempColors = n.colors + , a = this._tempBoneInfos = n.boneInfos; + this._traverseSkeleton(t, e), + A > 0 && (s[A - 1].vfOffset = d), + s.length = A, + a.length = _; + var o = g - 1; + if (o >= 0) + if (v > 0) { + var l = r[o]; + l.indexCount = v, + l.vfCount = 6 * y, + l.vertexCount = y, + r.length = g + } else + r.length = g - 1; + if (0 != r.length) { + var h = n.vertices + , C = n.uintVert; + (!h || h.length < d) && (h = n.vertices = new Float32Array(d), + C = n.uintVert = new Uint32Array(h.buffer)); + for (var T = 0, S = 0; T < d; ) + h[T++] = c[S++], + h[T++] = c[S++], + h[T++] = c[S++], + h[T++] = c[S++], + C[T++] = c[S++], + C[T++] = c[S++]; + var w = n.indices; + (!w || w.length < f) && (w = n.indices = new Uint16Array(f)); + for (var E = 0; E < f; E++) + w[E] = u[E]; + n.vertices = h, + n.uintVert = C, + n.indices = w + } + }, + fillVertices: function(t, e, l, h, _) { + if (s = l.a * e.a * t.a * 255, + i = e.r * t.r * 255, + n = e.g * t.g * 255, + r = e.b * t.b * 255, + S.r = i * l.r, + S.g = n * l.g, + S.b = r * l.b, + S.a = s, + null == _.darkColor ? w.set(0, 0, 0, 1) : (w.r = _.darkColor.r * i, + w.g = _.darkColor.g * n, + w.b = _.darkColor.b * r), + w.a = 0, + a = (S.a << 24 >>> 0) + (S.b << 16) + (S.g << 8) + S.r, + o = (w.a << 24 >>> 0) + (w.b << 16) + (w.g << 8) + w.r, + x !== a || b !== o) { + var p = this._tempColors; + x = a, + b = o, + A > 0 && (p[A - 1].vfOffset = d), + p[A++] = { + fr: S.r, + fg: S.g, + fb: S.b, + fa: S.a, + dr: w.r, + dg: w.g, + db: w.b, + da: w.a, + vfOffset: 0 + } + } + if (h.isClipping()) { + h.clipTriangles(c, C, u, T, c, S, w, !0, 6, f, d, d + 2); + var m = h.clippedVertices + , y = h.clippedTriangles; + T = y.length, + C = m.length / 12 * 6; + for (var v = 0, g = f, E = y.length; v < E; ) + u[g++] = y[v++]; + for (var M = 0, D = m.length, B = d; M < D; M += 12, + B += 6) + c[B] = m[M], + c[B + 1] = m[M + 1], + c[B + 2] = m[M + 6], + c[B + 3] = m[M + 7], + c[B + 4] = a, + c[B + 5] = o + } else + for (var I = d, P = d + C; I < P; I += 6) + c[I + 4] = a, + c[I + 5] = o + }, + _traverseSkeleton: function(t, e) { + var i, n, r, s, a, o, l, A, x, b, S, w, M = this._tempSegments, D = this._tempBoneInfos, B = t.color, I = t.bones; + if (this._enableCacheAttachedInfo) + for (var P = 0, R = I.length; P < R; P++, + _++) { + var O = I[P] + , L = D[_]; + L || (L = D[_] = {}), + L.a = O.a, + L.b = O.b, + L.c = O.c, + L.d = O.d, + L.worldX = O.worldX, + L.worldY = O.worldY + } + for (var F = 0, V = t.drawOrder.length; F < V; F++) + if (w = t.drawOrder[F], + C = 0, + T = 0, + i = w.getAttachment()) + if (o = i instanceof h.RegionAttachment, + l = i instanceof h.MeshAttachment, + i instanceof h.ClippingAttachment) + e.clipStart(w, i); + else if (o || l) + if (A = i.region.texture._texture) + if (S = w.data.blendMode, + p === A.nativeUrl && m === S || (p = A.nativeUrl, + m = S, + (x = g - 1) >= 0 && (v > 0 ? ((b = M[x]).indexCount = v, + b.vertexCount = y, + b.vfCount = 6 * y) : g--), + M[g] = { + tex: A, + blendMode: S, + indexCount: 0, + vertexCount: 0, + vfCount: 0 + }, + g++, + v = 0, + y = 0), + o ? (a = E, + C = 24, + T = 6, + i.computeWorldVertices(w.bone, c, d, 6)) : l && (a = i.triangles, + C = 6 * (i.worldVerticesLength >> 1), + T = a.length, + i.computeWorldVertices(w, 0, i.worldVerticesLength, c, d, 6)), + 0 != C && 0 != T) { + for (var N = 0, k = f, G = a.length; N < G; ) + u[k++] = a[N++]; + s = i.uvs; + for (var U = d, z = d + C, H = 0; U < z; U += 6, + H += 2) + c[U + 2] = s[H], + c[U + 3] = s[H + 1]; + if (n = i.color, + r = w.color, + this.fillVertices(B, n, r, e, w), + T > 0) { + for (var W = f, j = f + T; W < j; W++) + u[W] += y; + f += T, + d += C, + v += T, + y += C / 6 + } + e.clipEndWithSlot(w) + } else + e.clipEndWithSlot(w); + else + e.clipEndWithSlot(w); + else + e.clipEndWithSlot(w); + else + e.clipEndWithSlot(w); + e.clipEnd() + } + }), D = cc.Class({ + ctor: function() { + this._privateMode = !1, + this._animationPool = {}, + this._skeletonCache = {} + }, + enablePrivateMode: function() { + this._privateMode = !0 + }, + clear: function() { + this._animationPool = {}, + this._skeletonCache = {} + }, + removeSkeleton: function(t) { + var e = this._skeletonCache[t]; + if (e) { + var i = e.animationsCache; + for (var n in i) { + var r = i[n]; + r && (this._animationPool[t + "#" + n] = r, + r.clear()) + } + delete this._skeletonCache[t] + } + }, + getSkeletonCache: function(t, e) { + var i = this._skeletonCache[t]; + if (!i) { + var n = new h.Skeleton(e) + , r = new h.SkeletonClipping + , s = new h.AnimationStateData(n.data) + , a = new h.AnimationState(s) + , o = new l; + a.addListener(o), + this._skeletonCache[t] = i = { + skeleton: n, + clipper: r, + state: a, + listener: o, + animationsCache: {}, + curAnimationCache: null + } + } + return i + }, + getAnimationCache: function(t, e) { + var i = this._skeletonCache[t]; + return i ? i.animationsCache[e] : null + }, + invalidAnimationCache: function(t) { + var e = this._skeletonCache[t]; + if (e && e.skeleton) { + var i = e.animationsCache; + for (var n in i) + i[n].invalidAllFrame() + } + }, + initAnimationCache: function(t, e) { + if (!e) + return null; + var i = this._skeletonCache[t] + , n = i && i.skeleton; + if (!n) + return null; + if (!n.data.findAnimation(e)) + return null; + var r = i.animationsCache + , s = r[e]; + if (!s) { + var a = t + "#" + e; + (s = this._animationPool[a]) ? delete this._animationPool[a] : (s = new M)._privateMode = this._privateMode, + s.init(i, e), + r[e] = s + } + return s + }, + updateAnimationCache: function(t, e) { + if (e) { + var i = this.initAnimationCache(t, e); + if (!i) + return null; + i.updateAllFrame() + } else { + var n = this._skeletonCache[t]; + if (!n || !n.skeleton) + return; + var r = n.animationsCache; + for (var s in r) + r[s].updateAllFrame() + } + } + }); + D.FrameTime = 1 / 60, + D.sharedCache = new D, + e.exports = D + } + ), { + "./lib/spine": 370, + "./track-entry-listeners": 375 + }], + 372: [(function(t, e) { + "use strict"; + var i = t("./skeleton-cache").sharedCache + , n = cc.Class({ + name: "sp.SkeletonData", + extends: cc.Asset, + ctor: function() { + this.reset() + }, + properties: { + _skeletonJson: null, + skeletonJsonStr: { + get: function() { + return this._skeletonJson ? JSON.stringify(this._skeletonJson) : "" + } + }, + skeletonJson: { + get: function() { + return this._skeletonJson + }, + set: function(t) { + this.reset(), + this._skeletonJson = "string" == typeof t ? JSON.parse(t) : t, + !this._uuid && t.skeleton && (this._uuid = t.skeleton.hash) + } + }, + _atlasText: "", + atlasText: { + get: function() { + return this._atlasText + }, + set: function(t) { + this._atlasText = t, + this.reset() + } + }, + textures: { + default: [], + type: [cc.Texture2D] + }, + textureNames: { + default: [], + type: [cc.String] + }, + scale: 1, + _nativeAsset: { + get: function() { + return this._buffer + }, + set: function(t) { + this._buffer = t.buffer || t, + this.reset() + }, + override: !0 + } + }, + statics: { + preventDeferredLoadDependents: !0 + }, + createNode: !1, + reset: function() { + this._skeletonCache = null, + this._atlasCache = null + }, + ensureTexturesLoaded: function(t, e) { + var i = this.textures + , n = i.length; + if (0 != n) + for (var r = 0, s = function() { + ++r >= n && (t && t.call(e, !0), + t = null) + }, a = 0; a < n; a++) { + var o = i[a]; + o.loaded ? s() : o.once("load", s) + } + else + t.call(e, !1) + }, + isTexturesLoaded: function() { + for (var t = this.textures, e = t.length, i = 0; i < e; i++) + if (!t[i].loaded) + return !1; + return !0 + }, + getRuntimeData: function(t) { + if (this._skeletonCache) + return this._skeletonCache; + if (!(this.textures && this.textures.length > 0) && this.textureNames && this.textureNames.length > 0) + return t || cc.errorID(7507, this.name), + null; + var e = this._getAtlas(t); + if (!e) + return null; + var i = new sp.spine.AtlasAttachmentLoader(e) + , n = null + , r = null; + return this.skeletonJson ? (r = new sp.spine.SkeletonJson(i), + n = this.skeletonJson) : (r = new sp.spine.SkeletonBinary(i), + n = new Uint8Array(this._nativeAsset)), + r.scale = this.scale, + this._skeletonCache = r.readSkeletonData(n), + e.dispose(), + this._skeletonCache + }, + getSkinsEnum: !1, + getAnimsEnum: !1, + _getTexture: function(t) { + for (var e = this.textureNames, i = 0; i < e.length; i++) + if (e[i] === t) { + var n = this.textures[i] + , r = new sp.SkeletonTexture({ + width: n.width, + height: n.height + }); + return r.setRealTexture(n), + r + } + return cc.errorID(7506, t), + null + }, + _getAtlas: function(t) { + return this._atlasCache ? this._atlasCache : this.atlasText ? this._atlasCache = new sp.spine.TextureAtlas(this.atlasText,this._getTexture.bind(this)) : (t || cc.errorID(7508, this.name), + null) + }, + destroy: function() { + i.removeSkeleton(this._uuid), + this._super() + } + }); + sp.SkeletonData = e.exports = n + } + ), { + "./skeleton-cache": 371 + }], + 373: [(function() { + "use strict"; + sp.SkeletonTexture = cc.Class({ + name: "sp.SkeletonTexture", + extends: sp.spine.Texture, + _texture: null, + _material: null, + setRealTexture: function(t) { + this._texture = t + }, + getRealTexture: function() { + return this._texture + }, + setFilters: function(t, e) { + this._texture && this._texture.setFilters(t, e) + }, + setWraps: function(t, e) { + this._texture && this._texture.setWrapMode(t, e) + }, + dispose: function() {} + }) + } + ), {}], + 374: [(function(t, e, i) { + "use strict"; + i.__esModule = !0, + i.default = void 0; + var n, r = (n = t("../../cocos2d/core/renderer/assembler")) && n.__esModule ? n : { + default: n + }; + function s(t, e) { + return (s = Object.setPrototypeOf || function(t, e) { + return t.__proto__ = e, + t + } + )(t, e) + } + var a, o, l, h, c, u, _, f, d, p, m, y, v, g, A, x, b, C = t("./Skeleton"), T = t("./lib/spine"), S = t("../../cocos2d/core/renderer/render-flow"), w = t("../../cocos2d/core/renderer/webgl/vertex-format"), E = w.vfmtPosUvColor, M = w.vfmtPosUvTwoColor, D = cc.gfx, B = 0, I = [0, 1, 2, 2, 3, 0], P = cc.color(0, 0, 255, 255), R = cc.color(255, 0, 0, 255), O = cc.color(0, 255, 0, 255), L = cc.color(255, 255, 0, 255), F = null, V = null, N = null, k = null; + F = new T.Color(1,1,1,1), + V = new T.Color(1,1,1,1), + N = new T.Vector2, + k = new T.Vector2; + var G, U, z, H, W, j, X, Y, q, J, Z, K, Q, $, tt, et, it, nt, rt, st, at, ot, lt, ht, ct, ut, _t, ft, dt, pt = 0, mt = 0, yt = 0, vt = 0, gt = 0, At = 0, xt = 0; + function bt(t, e) { + var i, n; + switch (e) { + case T.BlendMode.Additive: + i = a ? cc.macro.ONE : cc.macro.SRC_ALPHA, + n = cc.macro.ONE; + break; + case T.BlendMode.Multiply: + i = cc.macro.DST_COLOR, + n = cc.macro.ONE_MINUS_SRC_ALPHA; + break; + case T.BlendMode.Screen: + i = cc.macro.ONE, + n = cc.macro.ONE_MINUS_SRC_COLOR; + break; + case T.BlendMode.Normal: + default: + i = a ? cc.macro.ONE : cc.macro.SRC_ALPHA, + n = cc.macro.ONE_MINUS_SRC_ALPHA + } + var r = !ht.enableBatch + , s = ht._materials[0]; + if (!s) + return null; + var o = t.getId() + i + n + c + r + , l = ht._materialCache + , h = l[o]; + return h || (l.baseMaterial ? h = cc.MaterialVariant.create(s) : (h = s, + l.baseMaterial = s), + h.define("CC_USE_MODEL", r), + h.define("USE_TINT", c), + h.setProperty("texture", t), + h.setBlend(!0, D.BLEND_FUNC_ADD, i, n, D.BLEND_FUNC_ADD, i, n), + l[o] = h), + h + } + function Ct(t) { + st = t.fa * y, + $ = d * (o = a ? st / 255 : 1), + tt = p * o, + et = m * o, + it = t.fr * $, + nt = t.fg * tt, + rt = t.fb * et, + v = (st << 24 >>> 0) + (rt << 16) + (nt << 8) + it, + at = t.dr * $, + ot = t.dg * tt, + lt = t.db * et, + g = ((a ? 255 : 0) << 24 >>> 0) + (lt << 16) + (ot << 8) + at + } + function Tt(t) { + return (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r + } + var St = (function(t) { + var e, i; + function n() { + return t.apply(this, arguments) || this + } + i = t, + (e = n).prototype = Object.create(i.prototype), + e.prototype.constructor = e, + s(e, i); + var r = n.prototype; + return r.updateRenderData = function(t) { + if (!t.isAnimationCached()) { + var e = t._skeleton; + e && e.updateWorldTransform() + } + } + , + r.fillVertices = function(t, e, i, n, r) { + var s, l = ct._vData, h = ct._iData, u = ct._uintVData; + if (F.a = i.a * e.a * t.a * y * 255, + o = a ? F.a : 255, + G = d * e.r * t.r * o, + U = p * e.g * t.g * o, + z = m * e.b * t.b * o, + F.r = G * i.r, + F.g = U * i.g, + F.b = z * i.b, + null == r.darkColor ? V.set(0, 0, 0, 1) : (V.r = r.darkColor.r * G, + V.g = r.darkColor.g * U, + V.b = r.darkColor.b * z), + V.a = a ? 255 : 0, + n.isClipping()) { + var _ = l.subarray(yt + 2); + n.clipTriangles(l.subarray(yt), pt, h.subarray(At), gt, _, F, V, c, x); + var f = new Float32Array(n.clippedVertices) + , A = n.clippedTriangles; + if (gt = A.length, + pt = f.length / b * x, + s = ct.request(pt / x, gt), + At = s.indiceOffset, + vt = s.vertexOffset, + yt = s.byteOffset >> 2, + l = ct._vData, + h = ct._iData, + u = ct._uintVData, + h.set(A, At), + dt) + for (var C = 0, T = f.length, S = yt; C < T; C += b, + S += x) + N.x = f[C], + N.y = f[C + 1], + F.set(f[C + 2], f[C + 3], f[C + 4], f[C + 5]), + k.x = f[C + 6], + k.y = f[C + 7], + c ? V.set(f[C + 8], f[C + 9], f[C + 10], f[C + 11]) : V.set(0, 0, 0, 0), + dt.transform(N, k, F, V), + l[S] = N.x, + l[S + 1] = N.y, + l[S + 2] = k.x, + l[S + 3] = k.y, + u[S + 4] = Tt(F), + c && (u[S + 5] = Tt(V)); + else + for (var w = 0, E = f.length, M = yt; w < E; w += b, + M += x) + l[M] = f[w], + l[M + 1] = f[w + 1], + l[M + 2] = f[w + 6], + l[M + 3] = f[w + 7], + v = (f[w + 5] << 24 >>> 0) + (f[w + 4] << 16) + (f[w + 3] << 8) + f[w + 2], + u[M + 4] = v, + c && (g = (f[w + 11] << 24 >>> 0) + (f[w + 10] << 16) + (f[w + 9] << 8) + f[w + 8], + u[M + 5] = g) + } else if (dt) + for (var D = yt, B = yt + pt; D < B; D += x) + N.x = l[D], + N.y = l[D + 1], + k.x = l[D + 2], + k.y = l[D + 3], + dt.transform(N, k, F, V), + l[D] = N.x, + l[D + 1] = N.y, + l[D + 2] = k.x, + l[D + 3] = k.y, + u[D + 4] = Tt(F), + c && (u[D + 5] = Tt(V)); + else { + v = Tt(F), + g = Tt(V); + for (var I = yt, P = yt + pt; I < P; I += x) + u[I + 4] = v, + c && (u[I + 5] = g) + } + } + , + r.realTimeTraverse = function(t) { + var e, i, n, r, s, a, o, d, p, m, y, v, g = ht._skeleton, A = g.color, C = ht._debugRenderer, S = ht._clipper, w = null; + l = ht._startSlotIndex, + h = ht._endSlotIndex, + H = !1, + -1 == l && (H = !0), + u = ht.debugSlots, + _ = ht.debugBones, + f = ht.debugMesh, + C && (_ || u || f) && (C.clear(), + C.lineWidth = 2), + b = c ? 12 : 8, + pt = 0, + yt = 0, + vt = 0, + gt = 0, + At = 0; + for (var E = 0, M = g.drawOrder.length; E < M; E++) + if (null != (y = g.drawOrder[E])) + if (l >= 0 && l == y.data.index && (H = !0), + H) + if (h >= 0 && h == y.data.index && (H = !1), + pt = 0, + gt = 0, + n = y.getAttachment()) + if (d = n instanceof T.RegionAttachment, + p = n instanceof T.MeshAttachment, + n instanceof T.ClippingAttachment) + S.clipStart(y, n); + else if (d || p) + if (w = bt(n.region.texture._texture, y.data.blendMode)) { + if ((W || w.getHash() !== ut.material.getHash()) && (W = !1, + ut._flush(), + ut.node = _t, + ut.material = w), + d) { + if (o = I, + pt = 4 * x, + gt = 6, + m = ct.request(4, 6), + At = m.indiceOffset, + vt = m.vertexOffset, + yt = m.byteOffset >> 2, + e = ct._vData, + i = ct._iData, + n.computeWorldVertices(y.bone, e, yt, x), + C && u) { + C.strokeColor = P, + C.moveTo(e[yt], e[yt + 1]); + for (var D = yt + x, B = yt + pt; D < B; D += x) + C.lineTo(e[D], e[D + 1]); + C.close(), + C.stroke() + } + } else if (p && (o = n.triangles, + pt = (n.worldVerticesLength >> 1) * x, + gt = o.length, + m = ct.request(pt / x, gt), + At = m.indiceOffset, + vt = m.vertexOffset, + yt = m.byteOffset >> 2, + e = ct._vData, + i = ct._iData, + n.computeWorldVertices(y, 0, n.worldVerticesLength, e, yt, x), + C && f)) { + C.strokeColor = L; + for (var F = 0, V = o.length; F < V; F += 3) { + var N = o[F] * x + yt + , k = o[F + 1] * x + yt + , G = o[F + 2] * x + yt; + C.moveTo(e[N], e[N + 1]), + C.lineTo(e[k], e[k + 1]), + C.lineTo(e[G], e[G + 1]), + C.close(), + C.stroke() + } + } + if (0 != pt && 0 != gt) { + i.set(o, At), + a = n.uvs; + for (var U = yt, z = yt + pt, $ = 0; U < z; U += x, + $ += 2) + e[U + 2] = a[$], + e[U + 3] = a[$ + 1]; + if (r = n.color, + s = y.color, + this.fillVertices(A, r, s, S, y), + e = ct._vData, + i = ct._iData, + gt > 0) { + for (var tt = At, et = At + gt; tt < et; tt++) + i[tt] += vt; + if (t) { + v = t.m, + Y = v[0], + q = v[4], + J = v[12], + Z = v[1], + K = v[5], + Q = v[13]; + for (var it = yt, nt = yt + pt; it < nt; it += x) + j = e[it], + X = e[it + 1], + e[it] = j * Y + X * q + J, + e[it + 1] = j * Z + X * K + Q + } + ct.adjust(pt / x, gt) + } + S.clipEndWithSlot(y) + } else + S.clipEndWithSlot(y) + } else + S.clipEndWithSlot(y); + else + S.clipEndWithSlot(y); + else + S.clipEndWithSlot(y); + else + S.clipEndWithSlot(y); + if (S.clipEnd(), + C && _) { + var rt; + C.strokeColor = R, + C.fillColor = P; + for (var st = 0, at = g.bones.length; st < at; st++) { + var ot = (rt = g.bones[st]).data.length * rt.a + rt.worldX + , lt = rt.data.length * rt.c + rt.worldY; + C.moveTo(rt.worldX, rt.worldY), + C.lineTo(ot, lt), + C.stroke(), + C.circle(rt.worldX, rt.worldY, 1.5 * Math.PI), + C.fill(), + 0 === st && (C.fillColor = O) + } + } + } + , + r.cacheTraverse = function(t) { + var e = ht._curFrame; + if (e) { + var i = e.segments; + if (0 != i.length) { + var n, r, s, a, o, l, h = e.vertices, c = e.indices, u = 0, _ = 0, f = 0; + t && (l = t.m, + Y = l[0], + Z = l[1], + q = l[4], + K = l[5], + J = l[12], + Q = l[13]); + var d = 16 & B + , p = d && 1 === Y && 0 === Z && 0 === q && 1 === K + , m = 0 + , y = e.colors + , A = y[m++] + , x = A.vfOffset; + Ct(A); + for (var b = 0, C = i.length; b < C; b++) { + var T = i[b]; + if (a = bt(T.tex, T.blendMode)) { + (W || a.getHash() !== ut.material.getHash()) && (W = !1, + ut._flush(), + ut.node = _t, + ut.material = a), + mt = T.vertexCount, + gt = T.indexCount, + o = ct.request(mt, gt), + At = o.indiceOffset, + vt = o.vertexOffset, + xt = o.byteOffset >> 2, + n = ct._vData, + r = ct._iData, + s = ct._uintVData; + for (var S = At, w = At + gt; S < w; S++) + r[S] = vt + c[_++]; + if (f = T.vfCount, + n.set(h.subarray(u, u + f), xt), + u += f, + p) + for (var E = xt, M = xt + f; E < M; E += 6) + n[E] += J, + n[E + 1] += Q; + else if (d) + for (var D = xt, I = xt + f; D < I; D += 6) + j = n[D], + X = n[D + 1], + n[D] = j * Y + X * q + J, + n[D + 1] = j * Z + X * K + Q; + if (ct.adjust(mt, gt), + ft) + for (var P = u - f, R = xt + 4, O = xt + 4 + f; R < O; R += 6, + P += 6) + P >= x && (Ct(A = y[m++]), + x = A.vfOffset), + s[R] = v, + s[R + 1] = g + } + } + } + } + } + , + r.fillBuffers = function(t, e) { + var i = t.node; + if (i._renderFlag |= S.FLAG_UPDATE_RENDER_DATA, + t._skeleton) { + var n = i._color; + d = n.r / 255, + p = n.g / 255, + m = n.b / 255, + y = n.a / 255, + c = t.useTint || t.isAnimationCached(), + A = c ? M : E, + x = c ? 6 : 5, + _t = t.node, + ct = e.getBuffer("spine", A), + ut = e, + ht = t, + W = !0, + a = t.premultipliedAlpha, + o = 1, + B = 0, + ft = !1, + dt = t._effectDelegate && t._effectDelegate._vertexEffect, + (4294967295 !== n._val || a) && (ft = !0), + c && (B |= 1); + var r = void 0; + ht.enableBatch && (r = _t._worldMatrix, + W = !1, + B |= 16), + t.isAnimationCached() ? this.cacheTraverse(r) : (dt && dt.begin(t._skeleton), + this.realTimeTraverse(r), + dt && dt.end()), + e.worldMatDirty++, + t.attachUtil._syncAttachedNode(), + _t = void 0, + ct = void 0, + ut = void 0, + ht = void 0, + dt = null + } + } + , + r.postFillBuffers = function(t, e) { + e.worldMatDirty-- + } + , + n + } + )(r.default); + i.default = St, + r.default.register(C, St), + e.exports = i.default + } + ), { + "../../cocos2d/core/renderer/assembler": 221, + "../../cocos2d/core/renderer/render-flow": 225, + "../../cocos2d/core/renderer/webgl/vertex-format": 256, + "./Skeleton": 368, + "./lib/spine": 370 + }], + 375: [(function(t, e) { + "use strict"; + var i = function() { + this.start = null, + this.end = null, + this.complete = null, + this.event = null, + this.interrupt = null, + this.dispose = null + }; + i.getListeners = function(t) { + return t.listener || (t.listener = new i), + t.listener + } + , + e.exports = i + } + ), {}], + 376: [(function(t, e) { + "use strict"; + var i = t("./lib/spine"); + sp.VertexEffectDelegate = cc.Class({ + name: "sp.VertexEffectDelegate", + ctor: function() { + this._vertexEffect = null, + this._interpolation = null, + this._effectType = "none" + }, + clear: function() { + this._vertexEffect = null, + this._interpolation = null, + this._effectType = "none" + }, + initJitter: function(t, e) { + return this._effectType = "jitter", + this._vertexEffect = new i.JitterEffect(t,e), + this._vertexEffect + }, + initSwirlWithPow: function(t, e) { + return this._interpolation = new i.Pow(e), + this._vertexEffect = new i.SwirlEffect(t,this._interpolation), + this._vertexEffect + }, + initSwirlWithPowOut: function(t, e) { + return this._interpolation = new i.PowOut(e), + this._vertexEffect = new i.SwirlEffect(t,this._interpolation), + this._vertexEffect + }, + getJitterVertexEffect: function() { + return this._vertexEffect + }, + getSwirlVertexEffect: function() { + return this._vertexEffect + }, + getVertexEffect: function() { + return this._vertexEffect + }, + getEffectType: function() { + return this._effectType + } + }), + e.exports = sp.VertexEffectDelegate + } + ), { + "./lib/spine": 370 + }], + 377: [(function(t, e, i) { + "use strict"; + var n; + n = function(t) { + function e(t, e) { + return void 0 !== t ? t : e + } + var i = 1e37 + , n = 1e-5 + , r = n * n + , s = 3.14159265359 + , a = 2 + , o = 8 + , l = .008 + , h = 2 / 180 * s + , c = 2 * l + , u = -1 + , _ = (function() { + function t(t, e, i) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + this.major = 0, + this.minor = 0, + this.revision = 0, + this.major = t, + this.minor = e, + this.revision = i + } + return t.prototype.toString = function() { + return this.major + "." + this.minor + "." + this.revision + } + , + t + } + )() + , f = new _(2,3,2); + function d(t, e) { + for (var i = [], n = 0; n < t; ++n) + i.push(e(n)); + return i + } + function p(t, e) { + void 0 === e && (e = 0); + for (var i = [], n = 0; n < t; ++n) + i.push(e); + return i + } + var m = Math.abs + , y = Math.min + , v = Math.max; + function g(t, e, i) { + return t < e ? e : t > i ? i : t + } + var A = isFinite; + function x(t) { + return t * t + } + function b(t) { + return 1 / Math.sqrt(t) + } + var C, T = Math.sqrt, S = Math.pow, w = Math.cos, E = Math.sin, M = Math.acos, D = Math.asin, B = Math.atan2, I = (function() { + function t(t, e) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + this.x = t, + this.y = e + } + return t.prototype.Clone = function() { + return new t(this.x,this.y) + } + , + t.prototype.SetZero = function() { + return this.x = 0, + this.y = 0, + this + } + , + t.prototype.Set = function(t, e) { + return this.x = t, + this.y = e, + this + } + , + t.prototype.Copy = function(t) { + return this.x = t.x, + this.y = t.y, + this + } + , + t.prototype.SelfAdd = function(t) { + return this.x += t.x, + this.y += t.y, + this + } + , + t.prototype.SelfAddXY = function(t, e) { + return this.x += t, + this.y += e, + this + } + , + t.prototype.SelfSub = function(t) { + return this.x -= t.x, + this.y -= t.y, + this + } + , + t.prototype.SelfSubXY = function(t, e) { + return this.x -= t, + this.y -= e, + this + } + , + t.prototype.SelfMul = function(t) { + return this.x *= t, + this.y *= t, + this + } + , + t.prototype.SelfMulAdd = function(t, e) { + return this.x += t * e.x, + this.y += t * e.y, + this + } + , + t.prototype.SelfMulSub = function(t, e) { + return this.x -= t * e.x, + this.y -= t * e.y, + this + } + , + t.prototype.Dot = function(t) { + return this.x * t.x + this.y * t.y + } + , + t.prototype.Cross = function(t) { + return this.x * t.y - this.y * t.x + } + , + t.prototype.Length = function() { + var t = this.x + , e = this.y; + return Math.sqrt(t * t + e * e) + } + , + t.prototype.LengthSquared = function() { + var t = this.x + , e = this.y; + return t * t + e * e + } + , + t.prototype.Normalize = function() { + var t = this.Length(); + if (t >= n) { + var e = 1 / t; + this.x *= e, + this.y *= e + } + return t + } + , + t.prototype.SelfNormalize = function() { + var t = this.Length(); + if (t >= n) { + var e = 1 / t; + this.x *= e, + this.y *= e + } + return this + } + , + t.prototype.SelfRotate = function(t) { + var e = Math.cos(t) + , i = Math.sin(t) + , n = this.x; + return this.x = e * n - i * this.y, + this.y = i * n + e * this.y, + this + } + , + t.prototype.IsValid = function() { + return isFinite(this.x) && isFinite(this.y) + } + , + t.prototype.SelfCrossVS = function(t) { + var e = this.x; + return this.x = t * this.y, + this.y = -t * e, + this + } + , + t.prototype.SelfCrossSV = function(t) { + var e = this.x; + return this.x = -t * this.y, + this.y = t * e, + this + } + , + t.prototype.SelfMinV = function(t) { + return this.x = y(this.x, t.x), + this.y = y(this.y, t.y), + this + } + , + t.prototype.SelfMaxV = function(t) { + return this.x = v(this.x, t.x), + this.y = v(this.y, t.y), + this + } + , + t.prototype.SelfAbs = function() { + return this.x = m(this.x), + this.y = m(this.y), + this + } + , + t.prototype.SelfNeg = function() { + return this.x = -this.x, + this.y = -this.y, + this + } + , + t.prototype.SelfSkew = function() { + var t = this.x; + return this.x = -this.y, + this.y = t, + this + } + , + t.MakeArray = function(e) { + return d(e, (function() { + return new t + } + )) + } + , + t.AbsV = function(t, e) { + return e.x = m(t.x), + e.y = m(t.y), + e + } + , + t.MinV = function(t, e, i) { + return i.x = y(t.x, e.x), + i.y = y(t.y, e.y), + i + } + , + t.MaxV = function(t, e, i) { + return i.x = v(t.x, e.x), + i.y = v(t.y, e.y), + i + } + , + t.ClampV = function(t, e, i, n) { + return n.x = g(t.x, e.x, i.x), + n.y = g(t.y, e.y, i.y), + n + } + , + t.RotateV = function(t, e, i) { + var n = t.x + , r = t.y + , s = Math.cos(e) + , a = Math.sin(e); + return i.x = s * n - a * r, + i.y = a * n + s * r, + i + } + , + t.DotVV = function(t, e) { + return t.x * e.x + t.y * e.y + } + , + t.CrossVV = function(t, e) { + return t.x * e.y - t.y * e.x + } + , + t.CrossVS = function(t, e, i) { + var n = t.x; + return i.x = e * t.y, + i.y = -e * n, + i + } + , + t.CrossVOne = function(t, e) { + var i = t.x; + return e.x = t.y, + e.y = -i, + e + } + , + t.CrossSV = function(t, e, i) { + var n = e.x; + return i.x = -t * e.y, + i.y = t * n, + i + } + , + t.CrossOneV = function(t, e) { + var i = t.x; + return e.x = -t.y, + e.y = i, + e + } + , + t.AddVV = function(t, e, i) { + return i.x = t.x + e.x, + i.y = t.y + e.y, + i + } + , + t.SubVV = function(t, e, i) { + return i.x = t.x - e.x, + i.y = t.y - e.y, + i + } + , + t.MulSV = function(t, e, i) { + return i.x = e.x * t, + i.y = e.y * t, + i + } + , + t.MulVS = function(t, e, i) { + return i.x = t.x * e, + i.y = t.y * e, + i + } + , + t.AddVMulSV = function(t, e, i, n) { + return n.x = t.x + e * i.x, + n.y = t.y + e * i.y, + n + } + , + t.SubVMulSV = function(t, e, i, n) { + return n.x = t.x - e * i.x, + n.y = t.y - e * i.y, + n + } + , + t.AddVCrossSV = function(t, e, i, n) { + var r = i.x; + return n.x = t.x - e * i.y, + n.y = t.y + e * r, + n + } + , + t.MidVV = function(t, e, i) { + return i.x = .5 * (t.x + e.x), + i.y = .5 * (t.y + e.y), + i + } + , + t.ExtVV = function(t, e, i) { + return i.x = .5 * (e.x - t.x), + i.y = .5 * (e.y - t.y), + i + } + , + t.IsEqualToV = function(t, e) { + return t.x === e.x && t.y === e.y + } + , + t.DistanceVV = function(t, e) { + var i = t.x - e.x + , n = t.y - e.y; + return Math.sqrt(i * i + n * n) + } + , + t.DistanceSquaredVV = function(t, e) { + var i = t.x - e.x + , n = t.y - e.y; + return i * i + n * n + } + , + t.NegV = function(t, e) { + return e.x = -t.x, + e.y = -t.y, + e + } + , + t.ZERO = new t(0,0), + t.UNITX = new t(1,0), + t.UNITY = new t(0,1), + t.s_t0 = new t, + t.s_t1 = new t, + t.s_t2 = new t, + t.s_t3 = new t, + t + } + )(), P = new I(0,0), R = (function() { + function t(t, e, i) { + void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + this.x = t, + this.y = e, + this.z = i + } + return t.prototype.Clone = function() { + return new t(this.x,this.y,this.z) + } + , + t.prototype.SetZero = function() { + return this.x = 0, + this.y = 0, + this.z = 0, + this + } + , + t.prototype.SetXYZ = function(t, e, i) { + return this.x = t, + this.y = e, + this.z = i, + this + } + , + t.prototype.Copy = function(t) { + return this.x = t.x, + this.y = t.y, + this.z = t.z, + this + } + , + t.prototype.SelfNeg = function() { + return this.x = -this.x, + this.y = -this.y, + this.z = -this.z, + this + } + , + t.prototype.SelfAdd = function(t) { + return this.x += t.x, + this.y += t.y, + this.z += t.z, + this + } + , + t.prototype.SelfAddXYZ = function(t, e, i) { + return this.x += t, + this.y += e, + this.z += i, + this + } + , + t.prototype.SelfSub = function(t) { + return this.x -= t.x, + this.y -= t.y, + this.z -= t.z, + this + } + , + t.prototype.SelfSubXYZ = function(t, e, i) { + return this.x -= t, + this.y -= e, + this.z -= i, + this + } + , + t.prototype.SelfMul = function(t) { + return this.x *= t, + this.y *= t, + this.z *= t, + this + } + , + t.DotV3V3 = function(t, e) { + return t.x * e.x + t.y * e.y + t.z * e.z + } + , + t.CrossV3V3 = function(t, e, i) { + var n = t.x + , r = t.y + , s = t.z + , a = e.x + , o = e.y + , l = e.z; + return i.x = r * l - s * o, + i.y = s * a - n * l, + i.z = n * o - r * a, + i + } + , + t.ZERO = new t(0,0,0), + t.s_t0 = new t, + t + } + )(), O = (function() { + function t() { + this.ex = new I(1,0), + this.ey = new I(0,1) + } + return t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t.FromVV = function(e, i) { + return (new t).SetVV(e, i) + } + , + t.FromSSSS = function(e, i, n, r) { + return (new t).SetSSSS(e, i, n, r) + } + , + t.FromAngle = function(e) { + return (new t).SetAngle(e) + } + , + t.prototype.SetSSSS = function(t, e, i, n) { + return this.ex.Set(t, i), + this.ey.Set(e, n), + this + } + , + t.prototype.SetVV = function(t, e) { + return this.ex.Copy(t), + this.ey.Copy(e), + this + } + , + t.prototype.SetAngle = function(t) { + var e = Math.cos(t) + , i = Math.sin(t); + return this.ex.Set(e, i), + this.ey.Set(-i, e), + this + } + , + t.prototype.Copy = function(t) { + return this.ex.Copy(t.ex), + this.ey.Copy(t.ey), + this + } + , + t.prototype.SetIdentity = function() { + return this.ex.Set(1, 0), + this.ey.Set(0, 1), + this + } + , + t.prototype.SetZero = function() { + return this.ex.SetZero(), + this.ey.SetZero(), + this + } + , + t.prototype.GetAngle = function() { + return Math.atan2(this.ex.y, this.ex.x) + } + , + t.prototype.GetInverse = function(t) { + var e = this.ex.x + , i = this.ey.x + , n = this.ex.y + , r = this.ey.y + , s = e * r - i * n; + return 0 !== s && (s = 1 / s), + t.ex.x = s * r, + t.ey.x = -s * i, + t.ex.y = -s * n, + t.ey.y = s * e, + t + } + , + t.prototype.Solve = function(t, e, i) { + var n = this.ex.x + , r = this.ey.x + , s = this.ex.y + , a = this.ey.y + , o = n * a - r * s; + return 0 !== o && (o = 1 / o), + i.x = o * (a * t - r * e), + i.y = o * (n * e - s * t), + i + } + , + t.prototype.SelfAbs = function() { + return this.ex.SelfAbs(), + this.ey.SelfAbs(), + this + } + , + t.prototype.SelfInv = function() { + return this.GetInverse(this), + this + } + , + t.prototype.SelfAddM = function(t) { + return this.ex.SelfAdd(t.ex), + this.ey.SelfAdd(t.ey), + this + } + , + t.prototype.SelfSubM = function(t) { + return this.ex.SelfSub(t.ex), + this.ey.SelfSub(t.ey), + this + } + , + t.AbsM = function(t, e) { + var i = t.ex + , n = t.ey; + return e.ex.x = m(i.x), + e.ex.y = m(i.y), + e.ey.x = m(n.x), + e.ey.y = m(n.y), + e + } + , + t.MulMV = function(t, e, i) { + var n = t.ex + , r = t.ey + , s = e.x + , a = e.y; + return i.x = n.x * s + r.x * a, + i.y = n.y * s + r.y * a, + i + } + , + t.MulTMV = function(t, e, i) { + var n = t.ex + , r = t.ey + , s = e.x + , a = e.y; + return i.x = n.x * s + n.y * a, + i.y = r.x * s + r.y * a, + i + } + , + t.AddMM = function(t, e, i) { + var n = t.ex + , r = t.ey + , s = e.ex + , a = e.ey; + return i.ex.x = n.x + s.x, + i.ex.y = n.y + s.y, + i.ey.x = r.x + a.x, + i.ey.y = r.y + a.y, + i + } + , + t.MulMM = function(t, e, i) { + var n = t.ex.x + , r = t.ex.y + , s = t.ey.x + , a = t.ey.y + , o = e.ex.x + , l = e.ex.y + , h = e.ey.x + , c = e.ey.y; + return i.ex.x = n * o + s * l, + i.ex.y = r * o + a * l, + i.ey.x = n * h + s * c, + i.ey.y = r * h + a * c, + i + } + , + t.MulTMM = function(t, e, i) { + var n = t.ex.x + , r = t.ex.y + , s = t.ey.x + , a = t.ey.y + , o = e.ex.x + , l = e.ex.y + , h = e.ey.x + , c = e.ey.y; + return i.ex.x = n * o + r * l, + i.ex.y = s * o + a * l, + i.ey.x = n * h + r * c, + i.ey.y = s * h + a * c, + i + } + , + t.IDENTITY = new t, + t + } + )(), L = (function() { + function t() { + this.ex = new R(1,0,0), + this.ey = new R(0,1,0), + this.ez = new R(0,0,1) + } + return t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t.prototype.SetVVV = function(t, e, i) { + return this.ex.Copy(t), + this.ey.Copy(e), + this.ez.Copy(i), + this + } + , + t.prototype.Copy = function(t) { + return this.ex.Copy(t.ex), + this.ey.Copy(t.ey), + this.ez.Copy(t.ez), + this + } + , + t.prototype.SetIdentity = function() { + return this.ex.SetXYZ(1, 0, 0), + this.ey.SetXYZ(0, 1, 0), + this.ez.SetXYZ(0, 0, 1), + this + } + , + t.prototype.SetZero = function() { + return this.ex.SetZero(), + this.ey.SetZero(), + this.ez.SetZero(), + this + } + , + t.prototype.SelfAddM = function(t) { + return this.ex.SelfAdd(t.ex), + this.ey.SelfAdd(t.ey), + this.ez.SelfAdd(t.ez), + this + } + , + t.prototype.Solve33 = function(t, e, i, n) { + var r = this.ex.x + , s = this.ex.y + , a = this.ex.z + , o = this.ey.x + , l = this.ey.y + , h = this.ey.z + , c = this.ez.x + , u = this.ez.y + , _ = this.ez.z + , f = r * (l * _ - h * u) + s * (h * c - o * _) + a * (o * u - l * c); + return 0 !== f && (f = 1 / f), + n.x = f * (t * (l * _ - h * u) + e * (h * c - o * _) + i * (o * u - l * c)), + n.y = f * (r * (e * _ - i * u) + s * (i * c - t * _) + a * (t * u - e * c)), + n.z = f * (r * (l * i - h * e) + s * (h * t - o * i) + a * (o * e - l * t)), + n + } + , + t.prototype.Solve22 = function(t, e, i) { + var n = this.ex.x + , r = this.ey.x + , s = this.ex.y + , a = this.ey.y + , o = n * a - r * s; + return 0 !== o && (o = 1 / o), + i.x = o * (a * t - r * e), + i.y = o * (n * e - s * t), + i + } + , + t.prototype.GetInverse22 = function(t) { + var e = this.ex.x + , i = this.ey.x + , n = this.ex.y + , r = this.ey.y + , s = e * r - i * n; + 0 !== s && (s = 1 / s), + t.ex.x = s * r, + t.ey.x = -s * i, + t.ex.z = 0, + t.ex.y = -s * n, + t.ey.y = s * e, + t.ey.z = 0, + t.ez.x = 0, + t.ez.y = 0, + t.ez.z = 0 + } + , + t.prototype.GetSymInverse33 = function(t) { + var e = R.DotV3V3(this.ex, R.CrossV3V3(this.ey, this.ez, R.s_t0)); + 0 !== e && (e = 1 / e); + var i = this.ex.x + , n = this.ey.x + , r = this.ez.x + , s = this.ey.y + , a = this.ez.y + , o = this.ez.z; + t.ex.x = e * (s * o - a * a), + t.ex.y = e * (r * a - n * o), + t.ex.z = e * (n * a - r * s), + t.ey.x = t.ex.y, + t.ey.y = e * (i * o - r * r), + t.ey.z = e * (r * n - i * a), + t.ez.x = t.ex.z, + t.ez.y = t.ey.z, + t.ez.z = e * (i * s - n * n) + } + , + t.MulM33V3 = function(t, e, i) { + var n = e.x + , r = e.y + , s = e.z; + return i.x = t.ex.x * n + t.ey.x * r + t.ez.x * s, + i.y = t.ex.y * n + t.ey.y * r + t.ez.y * s, + i.z = t.ex.z * n + t.ey.z * r + t.ez.z * s, + i + } + , + t.MulM33XYZ = function(t, e, i, n, r) { + return r.x = t.ex.x * e + t.ey.x * i + t.ez.x * n, + r.y = t.ex.y * e + t.ey.y * i + t.ez.y * n, + r.z = t.ex.z * e + t.ey.z * i + t.ez.z * n, + r + } + , + t.MulM33V2 = function(t, e, i) { + var n = e.x + , r = e.y; + return i.x = t.ex.x * n + t.ey.x * r, + i.y = t.ex.y * n + t.ey.y * r, + i + } + , + t.MulM33XY = function(t, e, i, n) { + return n.x = t.ex.x * e + t.ey.x * i, + n.y = t.ex.y * e + t.ey.y * i, + n + } + , + t.IDENTITY = new t, + t + } + )(), F = (function() { + function t(t) { + void 0 === t && (t = 0), + this.s = 0, + this.c = 1, + t && (this.s = Math.sin(t), + this.c = Math.cos(t)) + } + return t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t.prototype.Copy = function(t) { + return this.s = t.s, + this.c = t.c, + this + } + , + t.prototype.SetAngle = function(t) { + return this.s = Math.sin(t), + this.c = Math.cos(t), + this + } + , + t.prototype.SetIdentity = function() { + return this.s = 0, + this.c = 1, + this + } + , + t.prototype.GetAngle = function() { + return Math.atan2(this.s, this.c) + } + , + t.prototype.GetXAxis = function(t) { + return t.x = this.c, + t.y = this.s, + t + } + , + t.prototype.GetYAxis = function(t) { + return t.x = -this.s, + t.y = this.c, + t + } + , + t.MulRR = function(t, e, i) { + var n = t.c + , r = t.s + , s = e.c + , a = e.s; + return i.s = r * s + n * a, + i.c = n * s - r * a, + i + } + , + t.MulTRR = function(t, e, i) { + var n = t.c + , r = t.s + , s = e.c + , a = e.s; + return i.s = n * a - r * s, + i.c = n * s + r * a, + i + } + , + t.MulRV = function(t, e, i) { + var n = t.c + , r = t.s + , s = e.x + , a = e.y; + return i.x = n * s - r * a, + i.y = r * s + n * a, + i + } + , + t.MulTRV = function(t, e, i) { + var n = t.c + , r = t.s + , s = e.x + , a = e.y; + return i.x = n * s + r * a, + i.y = -r * s + n * a, + i + } + , + t.IDENTITY = new t, + t + } + )(), V = (function() { + function t() { + this.p = new I, + this.q = new F + } + return t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t.prototype.Copy = function(t) { + return this.p.Copy(t.p), + this.q.Copy(t.q), + this + } + , + t.prototype.SetIdentity = function() { + return this.p.SetZero(), + this.q.SetIdentity(), + this + } + , + t.prototype.SetPositionRotation = function(t, e) { + return this.p.Copy(t), + this.q.Copy(e), + this + } + , + t.prototype.SetPositionAngle = function(t, e) { + return this.p.Copy(t), + this.q.SetAngle(e), + this + } + , + t.prototype.SetPosition = function(t) { + return this.p.Copy(t), + this + } + , + t.prototype.SetPositionXY = function(t, e) { + return this.p.Set(t, e), + this + } + , + t.prototype.SetRotation = function(t) { + return this.q.Copy(t), + this + } + , + t.prototype.SetRotationAngle = function(t) { + return this.q.SetAngle(t), + this + } + , + t.prototype.GetPosition = function() { + return this.p + } + , + t.prototype.GetRotation = function() { + return this.q + } + , + t.prototype.GetRotationAngle = function() { + return this.q.GetAngle() + } + , + t.prototype.GetAngle = function() { + return this.q.GetAngle() + } + , + t.MulXV = function(t, e, i) { + var n = t.q.c + , r = t.q.s + , s = e.x + , a = e.y; + return i.x = n * s - r * a + t.p.x, + i.y = r * s + n * a + t.p.y, + i + } + , + t.MulTXV = function(t, e, i) { + var n = t.q.c + , r = t.q.s + , s = e.x - t.p.x + , a = e.y - t.p.y; + return i.x = n * s + r * a, + i.y = -r * s + n * a, + i + } + , + t.MulXX = function(t, e, i) { + return F.MulRR(t.q, e.q, i.q), + I.AddVV(F.MulRV(t.q, e.p, i.p), t.p, i.p), + i + } + , + t.MulTXX = function(t, e, i) { + return F.MulTRR(t.q, e.q, i.q), + F.MulTRV(t.q, I.SubVV(e.p, t.p, i.p), i.p), + i + } + , + t.IDENTITY = new t, + t + } + )(), N = (function() { + function t() { + this.localCenter = new I, + this.c0 = new I, + this.c = new I, + this.a0 = 0, + this.a = 0, + this.alpha0 = 0 + } + return t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t.prototype.Copy = function(t) { + return this.localCenter.Copy(t.localCenter), + this.c0.Copy(t.c0), + this.c.Copy(t.c), + this.a0 = t.a0, + this.a = t.a, + this.alpha0 = t.alpha0, + this + } + , + t.prototype.GetTransform = function(t, e) { + var i = 1 - e; + t.p.x = i * this.c0.x + e * this.c.x, + t.p.y = i * this.c0.y + e * this.c.y; + var n = i * this.a0 + e * this.a; + return t.q.SetAngle(n), + t.p.SelfSub(F.MulRV(t.q, this.localCenter, I.s_t0)), + t + } + , + t.prototype.Advance = function(t) { + var e = (t - this.alpha0) / (1 - this.alpha0) + , i = 1 - e; + this.c0.x = i * this.c0.x + e * this.c.x, + this.c0.y = i * this.c0.y + e * this.c.y, + this.a0 = i * this.a0 + e * this.a, + this.alpha0 = t + } + , + t.prototype.Normalize = function() { + var t = 6.28318530718 * Math.floor(this.a0 / 6.28318530718); + this.a0 -= t, + this.a -= t + } + , + t + } + )(), k = (function() { + function t(t, e, i, n) { + void 0 === t && (t = .5), + void 0 === e && (e = .5), + void 0 === i && (i = .5), + void 0 === n && (n = 1), + this.r = t, + this.g = e, + this.b = i, + this.a = n + } + return t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t.prototype.Copy = function(t) { + return this.r = t.r, + this.g = t.g, + this.b = t.b, + this.a = t.a, + this + } + , + t.prototype.IsEqual = function(t) { + return this.r === t.r && this.g === t.g && this.b === t.b && this.a === t.a + } + , + t.prototype.IsZero = function() { + return 0 === this.r && 0 === this.g && 0 === this.b && 0 === this.a + } + , + t.prototype.Set = function(t, e, i, n) { + void 0 === n && (n = this.a), + this.SetRGBA(t, e, i, n) + } + , + t.prototype.SetByteRGB = function(t, e, i) { + return this.r = t / 255, + this.g = e / 255, + this.b = i / 255, + this + } + , + t.prototype.SetByteRGBA = function(t, e, i, n) { + return this.r = t / 255, + this.g = e / 255, + this.b = i / 255, + this.a = n / 255, + this + } + , + t.prototype.SetRGB = function(t, e, i) { + return this.r = t, + this.g = e, + this.b = i, + this + } + , + t.prototype.SetRGBA = function(t, e, i, n) { + return this.r = t, + this.g = e, + this.b = i, + this.a = n, + this + } + , + t.prototype.SelfAdd = function(t) { + return this.r += t.r, + this.g += t.g, + this.b += t.b, + this.a += t.a, + this + } + , + t.prototype.Add = function(t, e) { + return e.r = this.r + t.r, + e.g = this.g + t.g, + e.b = this.b + t.b, + e.a = this.a + t.a, + e + } + , + t.prototype.SelfSub = function(t) { + return this.r -= t.r, + this.g -= t.g, + this.b -= t.b, + this.a -= t.a, + this + } + , + t.prototype.Sub = function(t, e) { + return e.r = this.r - t.r, + e.g = this.g - t.g, + e.b = this.b - t.b, + e.a = this.a - t.a, + e + } + , + t.prototype.SelfMul = function(t) { + return this.r *= t, + this.g *= t, + this.b *= t, + this.a *= t, + this + } + , + t.prototype.Mul = function(t, e) { + return e.r = this.r * t, + e.g = this.g * t, + e.b = this.b * t, + e.a = this.a * t, + e + } + , + t.prototype.Mix = function(e, i) { + t.MixColors(this, e, i) + } + , + t.MixColors = function(t, e, i) { + var n = i * (e.r - t.r) + , r = i * (e.g - t.g) + , s = i * (e.b - t.b) + , a = i * (e.a - t.a); + t.r += n, + t.g += r, + t.b += s, + t.a += a, + e.r -= n, + e.g -= r, + e.b -= s, + e.a -= a + } + , + t.prototype.MakeStyleString = function(e) { + return void 0 === e && (e = this.a), + t.MakeStyleString(this.r, this.g, this.b, e) + } + , + t.MakeStyleString = function(t, e, i, n) { + return void 0 === n && (n = 1), + t *= 255, + e *= 255, + i *= 255, + n < 1 ? "rgba(" + t + "," + e + "," + i + "," + n + ")" : "rgb(" + t + "," + e + "," + i + ")" + } + , + t.ZERO = new t(0,0,0,0), + t.RED = new t(1,0,0), + t.GREEN = new t(0,1,0), + t.BLUE = new t(0,0,1), + t + } + )(); + (C = t.b2DrawFlags || (t.b2DrawFlags = {}))[C.e_none = 0] = "e_none", + C[C.e_shapeBit = 1] = "e_shapeBit", + C[C.e_jointBit = 2] = "e_jointBit", + C[C.e_aabbBit = 4] = "e_aabbBit", + C[C.e_pairBit = 8] = "e_pairBit", + C[C.e_centerOfMassBit = 16] = "e_centerOfMassBit", + C[C.e_particleBit = 32] = "e_particleBit", + C[C.e_controllerBit = 64] = "e_controllerBit", + C[C.e_all = 63] = "e_all"; + var G = (function() { + function t() { + this.m_drawFlags = 0 + } + return t.prototype.SetFlags = function(t) { + this.m_drawFlags = t + } + , + t.prototype.GetFlags = function() { + return this.m_drawFlags + } + , + t.prototype.AppendFlags = function(t) { + this.m_drawFlags |= t + } + , + t.prototype.ClearFlags = function(t) { + this.m_drawFlags &= ~t + } + , + t + } + )() + , U = (function() { + function t() { + this.m_start = Date.now() + } + return t.prototype.Reset = function() { + return this.m_start = Date.now(), + this + } + , + t.prototype.GetMilliseconds = function() { + return Date.now() - this.m_start + } + , + t + } + )() + , z = (function() { + function t() { + this.m_count = 0, + this.m_min_count = 0, + this.m_max_count = 0 + } + return t.prototype.GetCount = function() { + return this.m_count + } + , + t.prototype.GetMinCount = function() { + return this.m_min_count + } + , + t.prototype.GetMaxCount = function() { + return this.m_max_count + } + , + t.prototype.ResetCount = function() { + var t = this.m_count; + return this.m_count = 0, + t + } + , + t.prototype.ResetMinCount = function() { + this.m_min_count = 0 + } + , + t.prototype.ResetMaxCount = function() { + this.m_max_count = 0 + } + , + t.prototype.Increment = function() { + this.m_count++, + this.m_max_count < this.m_count && (this.m_max_count = this.m_count) + } + , + t.prototype.Decrement = function() { + this.m_count--, + this.m_min_count > this.m_count && (this.m_min_count = this.m_count) + } + , + t + } + )() + , H = (function() { + function t(t) { + this.m_stack = [], + this.m_count = 0, + this.m_stack = d(t, (function() { + return null + } + )), + this.m_count = 0 + } + return t.prototype.Reset = function() { + return this.m_count = 0, + this + } + , + t.prototype.Push = function(t) { + this.m_stack[this.m_count] = t, + this.m_count++ + } + , + t.prototype.Pop = function() { + this.m_count--; + var t = this.m_stack[this.m_count]; + if (this.m_stack[this.m_count] = null, + null === t) + throw new Error; + return t + } + , + t.prototype.GetCount = function() { + return this.m_count + } + , + t + } + )() + , W = (function() { + function t() { + this.m_buffer = I.MakeArray(2), + this.m_vertices = this.m_buffer, + this.m_count = 0, + this.m_radius = 0 + } + return t.prototype.Copy = function(t) { + return t.m_vertices === t.m_buffer ? (this.m_vertices = this.m_buffer, + this.m_buffer[0].Copy(t.m_buffer[0]), + this.m_buffer[1].Copy(t.m_buffer[1])) : this.m_vertices = t.m_vertices, + this.m_count = t.m_count, + this.m_radius = t.m_radius, + this + } + , + t.prototype.Reset = function() { + return this.m_vertices = this.m_buffer, + this.m_count = 0, + this.m_radius = 0, + this + } + , + t.prototype.SetShape = function(t, e) { + t.SetupDistanceProxy(this, e) + } + , + t.prototype.SetVerticesRadius = function(t, e, i) { + this.m_vertices = t, + this.m_count = e, + this.m_radius = i + } + , + t.prototype.GetSupport = function(t) { + for (var e = 0, i = I.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) { + var r = I.DotVV(this.m_vertices[n], t); + r > i && (e = n, + i = r) + } + return e + } + , + t.prototype.GetSupportVertex = function(t) { + for (var e = 0, i = I.DotVV(this.m_vertices[0], t), n = 1; n < this.m_count; ++n) { + var r = I.DotVV(this.m_vertices[n], t); + r > i && (e = n, + i = r) + } + return this.m_vertices[e] + } + , + t.prototype.GetVertexCount = function() { + return this.m_count + } + , + t.prototype.GetVertex = function(t) { + return this.m_vertices[t] + } + , + t + } + )() + , j = (function() { + function t() { + this.metric = 0, + this.count = 0, + this.indexA = [0, 0, 0], + this.indexB = [0, 0, 0] + } + return t.prototype.Reset = function() { + return this.metric = 0, + this.count = 0, + this + } + , + t + } + )() + , X = (function() { + function t() { + this.proxyA = new W, + this.proxyB = new W, + this.transformA = new V, + this.transformB = new V, + this.useRadii = !1 + } + return t.prototype.Reset = function() { + return this.proxyA.Reset(), + this.proxyB.Reset(), + this.transformA.SetIdentity(), + this.transformB.SetIdentity(), + this.useRadii = !1, + this + } + , + t + } + )() + , Y = (function() { + function t() { + this.pointA = new I, + this.pointB = new I, + this.distance = 0, + this.iterations = 0 + } + return t.prototype.Reset = function() { + return this.pointA.SetZero(), + this.pointB.SetZero(), + this.distance = 0, + this.iterations = 0, + this + } + , + t + } + )(); + t.b2_gjkCalls = 0, + t.b2_gjkIters = 0, + t.b2_gjkMaxIters = 0; + var q = (function() { + function t() { + this.wA = new I, + this.wB = new I, + this.w = new I, + this.a = 0, + this.indexA = 0, + this.indexB = 0 + } + return t.prototype.Copy = function(t) { + return this.wA.Copy(t.wA), + this.wB.Copy(t.wB), + this.w.Copy(t.w), + this.a = t.a, + this.indexA = t.indexA, + this.indexB = t.indexB, + this + } + , + t + } + )() + , J = (function() { + function t() { + this.m_v1 = new q, + this.m_v2 = new q, + this.m_v3 = new q, + this.m_vertices = [], + this.m_count = 0, + this.m_vertices[0] = this.m_v1, + this.m_vertices[1] = this.m_v2, + this.m_vertices[2] = this.m_v3 + } + return t.prototype.ReadCache = function(t, e, i, r, s) { + this.m_count = t.count; + for (var a = this.m_vertices, o = 0; o < this.m_count; ++o) { + (_ = a[o]).indexA = t.indexA[o], + _.indexB = t.indexB[o]; + var l = e.GetVertex(_.indexA) + , h = r.GetVertex(_.indexB); + V.MulXV(i, l, _.wA), + V.MulXV(s, h, _.wB), + I.SubVV(_.wB, _.wA, _.w), + _.a = 0 + } + if (this.m_count > 1) { + var c = t.metric + , u = this.GetMetric(); + (u < .5 * c || 2 * c < u || u < n) && (this.m_count = 0) + } + var _; + 0 === this.m_count && ((_ = a[0]).indexA = 0, + _.indexB = 0, + l = e.GetVertex(0), + h = r.GetVertex(0), + V.MulXV(i, l, _.wA), + V.MulXV(s, h, _.wB), + I.SubVV(_.wB, _.wA, _.w), + _.a = 1, + this.m_count = 1) + } + , + t.prototype.WriteCache = function(t) { + t.metric = this.GetMetric(), + t.count = this.m_count; + for (var e = this.m_vertices, i = 0; i < this.m_count; ++i) + t.indexA[i] = e[i].indexA, + t.indexB[i] = e[i].indexB + } + , + t.prototype.GetSearchDirection = function(t) { + switch (this.m_count) { + case 1: + return I.NegV(this.m_v1.w, t); + case 2: + var e = I.SubVV(this.m_v2.w, this.m_v1.w, t); + return I.CrossVV(e, I.NegV(this.m_v1.w, I.s_t0)) > 0 ? I.CrossOneV(e, t) : I.CrossVOne(e, t); + default: + return t.SetZero() + } + } + , + t.prototype.GetClosestPoint = function(t) { + switch (this.m_count) { + case 0: + return t.SetZero(); + case 1: + return t.Copy(this.m_v1.w); + case 2: + return t.Set(this.m_v1.a * this.m_v1.w.x + this.m_v2.a * this.m_v2.w.x, this.m_v1.a * this.m_v1.w.y + this.m_v2.a * this.m_v2.w.y); + case 3: + default: + return t.SetZero() + } + } + , + t.prototype.GetWitnessPoints = function(t, e) { + switch (this.m_count) { + case 0: + break; + case 1: + t.Copy(this.m_v1.wA), + e.Copy(this.m_v1.wB); + break; + case 2: + t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x, + t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y, + e.x = this.m_v1.a * this.m_v1.wB.x + this.m_v2.a * this.m_v2.wB.x, + e.y = this.m_v1.a * this.m_v1.wB.y + this.m_v2.a * this.m_v2.wB.y; + break; + case 3: + e.x = t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x + this.m_v3.a * this.m_v3.wA.x, + e.y = t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y + this.m_v3.a * this.m_v3.wA.y + } + } + , + t.prototype.GetMetric = function() { + switch (this.m_count) { + case 0: + case 1: + return 0; + case 2: + return I.DistanceVV(this.m_v1.w, this.m_v2.w); + case 3: + return I.CrossVV(I.SubVV(this.m_v2.w, this.m_v1.w, I.s_t0), I.SubVV(this.m_v3.w, this.m_v1.w, I.s_t1)); + default: + return 0 + } + } + , + t.prototype.Solve2 = function() { + var e = this.m_v1.w + , i = this.m_v2.w + , n = I.SubVV(i, e, t.s_e12) + , r = -I.DotVV(e, n); + if (r <= 0) + return this.m_v1.a = 1, + void (this.m_count = 1); + var s = I.DotVV(i, n); + if (s <= 0) + return this.m_v2.a = 1, + this.m_count = 1, + void this.m_v1.Copy(this.m_v2); + var a = 1 / (s + r); + this.m_v1.a = s * a, + this.m_v2.a = r * a, + this.m_count = 2 + } + , + t.prototype.Solve3 = function() { + var e = this.m_v1.w + , i = this.m_v2.w + , n = this.m_v3.w + , r = I.SubVV(i, e, t.s_e12) + , s = I.DotVV(e, r) + , a = I.DotVV(i, r) + , o = -s + , l = I.SubVV(n, e, t.s_e13) + , h = I.DotVV(e, l) + , c = I.DotVV(n, l) + , u = -h + , _ = I.SubVV(n, i, t.s_e23) + , f = I.DotVV(i, _) + , d = I.DotVV(n, _) + , p = -f + , m = I.CrossVV(r, l) + , y = m * I.CrossVV(i, n) + , v = m * I.CrossVV(n, e) + , g = m * I.CrossVV(e, i); + if (o <= 0 && u <= 0) + return this.m_v1.a = 1, + void (this.m_count = 1); + if (a > 0 && o > 0 && g <= 0) { + var A = 1 / (a + o); + return this.m_v1.a = a * A, + this.m_v2.a = o * A, + void (this.m_count = 2) + } + if (c > 0 && u > 0 && v <= 0) { + var x = 1 / (c + u); + return this.m_v1.a = c * x, + this.m_v3.a = u * x, + this.m_count = 2, + void this.m_v2.Copy(this.m_v3) + } + if (a <= 0 && p <= 0) + return this.m_v2.a = 1, + this.m_count = 1, + void this.m_v1.Copy(this.m_v2); + if (c <= 0 && d <= 0) + return this.m_v3.a = 1, + this.m_count = 1, + void this.m_v1.Copy(this.m_v3); + if (d > 0 && p > 0 && y <= 0) { + var b = 1 / (d + p); + return this.m_v2.a = d * b, + this.m_v3.a = p * b, + this.m_count = 2, + void this.m_v1.Copy(this.m_v3) + } + var C = 1 / (y + v + g); + this.m_v1.a = y * C, + this.m_v2.a = v * C, + this.m_v3.a = g * C, + this.m_count = 3 + } + , + t.s_e12 = new I, + t.s_e13 = new I, + t.s_e23 = new I, + t + } + )() + , Z = new J + , K = [0, 0, 0] + , Q = [0, 0, 0] + , $ = new I + , tt = new I + , et = new I + , it = new I + , nt = new I; + function rt(e, i, s) { + ++t.b2_gjkCalls; + var a = s.proxyA + , o = s.proxyB + , l = s.transformA + , h = s.transformB + , c = Z; + c.ReadCache(i, a, l, o, h); + for (var u = c.m_vertices, _ = K, f = Q, d = 0, p = 0; p < 20; ) { + d = c.m_count; + for (var m = 0; m < d; ++m) + _[m] = u[m].indexA, + f[m] = u[m].indexB; + switch (c.m_count) { + case 1: + break; + case 2: + c.Solve2(); + break; + case 3: + c.Solve3() + } + if (3 === c.m_count) + break; + var y = c.GetSearchDirection(tt); + if (y.LengthSquared() < r) + break; + var g = u[c.m_count]; + g.indexA = a.GetSupport(F.MulTRV(l.q, I.NegV(y, I.s_t0), it)), + V.MulXV(l, a.GetVertex(g.indexA), g.wA), + g.indexB = o.GetSupport(F.MulTRV(h.q, y, nt)), + V.MulXV(h, o.GetVertex(g.indexB), g.wB), + I.SubVV(g.wB, g.wA, g.w), + ++p, + ++t.b2_gjkIters; + var A = !1; + for (m = 0; m < d; ++m) + if (g.indexA === _[m] && g.indexB === f[m]) { + A = !0; + break + } + if (A) + break; + ++c.m_count + } + if (t.b2_gjkMaxIters = v(t.b2_gjkMaxIters, p), + c.GetWitnessPoints(e.pointA, e.pointB), + e.distance = I.DistanceVV(e.pointA, e.pointB), + e.iterations = p, + c.WriteCache(i), + s.useRadii) { + var x = a.m_radius + , b = o.m_radius; + if (e.distance > x + b && e.distance > n) { + e.distance -= x + b; + var C = I.SubVV(e.pointB, e.pointA, et); + C.Normalize(), + e.pointA.SelfMulAdd(x, C), + e.pointB.SelfMulSub(b, C) + } else { + var T = I.MidVV(e.pointA, e.pointB, $); + e.pointA.Copy(T), + e.pointB.Copy(T), + e.distance = 0 + } + } + } + var st, at = new I, ot = new J, lt = new I, ht = new I, ct = new I, ut = new I, _t = new I, ft = new I; + (st = t.b2ContactFeatureType || (t.b2ContactFeatureType = {}))[st.e_vertex = 0] = "e_vertex", + st[st.e_face = 1] = "e_face"; + var dt, pt = (function() { + function t() { + this._key = 0, + this._key_invalid = !1, + this._indexA = 0, + this._indexB = 0, + this._typeA = 0, + this._typeB = 0 + } + return Object.defineProperty(t.prototype, "key", { + get: function() { + return this._key_invalid && (this._key_invalid = !1, + this._key = this._indexA | this._indexB << 8 | this._typeA << 16 | this._typeB << 24), + this._key + }, + set: function(t) { + this._key = t, + this._key_invalid = !1, + this._indexA = 255 & this._key, + this._indexB = this._key >> 8 & 255, + this._typeA = this._key >> 16 & 255, + this._typeB = this._key >> 24 & 255 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t.prototype, "indexA", { + get: function() { + return this._indexA + }, + set: function(t) { + this._indexA = t, + this._key_invalid = !0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t.prototype, "indexB", { + get: function() { + return this._indexB + }, + set: function(t) { + this._indexB = t, + this._key_invalid = !0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t.prototype, "typeA", { + get: function() { + return this._typeA + }, + set: function(t) { + this._typeA = t, + this._key_invalid = !0 + }, + enumerable: !0, + configurable: !0 + }), + Object.defineProperty(t.prototype, "typeB", { + get: function() { + return this._typeB + }, + set: function(t) { + this._typeB = t, + this._key_invalid = !0 + }, + enumerable: !0, + configurable: !0 + }), + t + } + )(), mt = (function() { + function t() { + this.cf = new pt + } + return t.prototype.Copy = function(t) { + return this.key = t.key, + this + } + , + t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + Object.defineProperty(t.prototype, "key", { + get: function() { + return this.cf.key + }, + set: function(t) { + this.cf.key = t + }, + enumerable: !0, + configurable: !0 + }), + t + } + )(), yt = (function() { + function t() { + this.localPoint = new I, + this.normalImpulse = 0, + this.tangentImpulse = 0, + this.id = new mt + } + return t.MakeArray = function(e) { + return d(e, (function() { + return new t + } + )) + } + , + t.prototype.Reset = function() { + this.localPoint.SetZero(), + this.normalImpulse = 0, + this.tangentImpulse = 0, + this.id.key = 0 + } + , + t.prototype.Copy = function(t) { + return this.localPoint.Copy(t.localPoint), + this.normalImpulse = t.normalImpulse, + this.tangentImpulse = t.tangentImpulse, + this.id.Copy(t.id), + this + } + , + t + } + )(); + (dt = t.b2ManifoldType || (t.b2ManifoldType = {}))[dt.e_unknown = -1] = "e_unknown", + dt[dt.e_circles = 0] = "e_circles", + dt[dt.e_faceA = 1] = "e_faceA", + dt[dt.e_faceB = 2] = "e_faceB"; + var vt, gt = (function() { + function e() { + this.points = yt.MakeArray(a), + this.localNormal = new I, + this.localPoint = new I, + this.type = t.b2ManifoldType.e_unknown, + this.pointCount = 0 + } + return e.prototype.Reset = function() { + for (var e = 0; e < a; ++e) + this.points[e].Reset(); + this.localNormal.SetZero(), + this.localPoint.SetZero(), + this.type = t.b2ManifoldType.e_unknown, + this.pointCount = 0 + } + , + e.prototype.Copy = function(t) { + this.pointCount = t.pointCount; + for (var e = 0; e < a; ++e) + this.points[e].Copy(t.points[e]); + return this.localNormal.Copy(t.localNormal), + this.localPoint.Copy(t.localPoint), + this.type = t.type, + this + } + , + e.prototype.Clone = function() { + return (new e).Copy(this) + } + , + e + } + )(), At = (function() { + function e() { + this.normal = new I, + this.points = I.MakeArray(a), + this.separations = p(a) + } + return e.prototype.Initialize = function(i, n, s, a, o) { + if (0 !== i.pointCount) + switch (i.type) { + case t.b2ManifoldType.e_circles: + this.normal.Set(1, 0); + var l = V.MulXV(n, i.localPoint, e.Initialize_s_pointA) + , h = V.MulXV(a, i.points[0].localPoint, e.Initialize_s_pointB); + I.DistanceSquaredVV(l, h) > r && I.SubVV(h, l, this.normal).SelfNormalize(); + var c = I.AddVMulSV(l, s, this.normal, e.Initialize_s_cA) + , u = I.SubVMulSV(h, o, this.normal, e.Initialize_s_cB); + I.MidVV(c, u, this.points[0]), + this.separations[0] = I.DotVV(I.SubVV(u, c, I.s_t0), this.normal); + break; + case t.b2ManifoldType.e_faceA: + F.MulRV(n.q, i.localNormal, this.normal); + for (var _ = V.MulXV(n, i.localPoint, e.Initialize_s_planePoint), f = 0; f < i.pointCount; ++f) { + var d = V.MulXV(a, i.points[f].localPoint, e.Initialize_s_clipPoint) + , p = s - I.DotVV(I.SubVV(d, _, I.s_t0), this.normal); + c = I.AddVMulSV(d, p, this.normal, e.Initialize_s_cA), + u = I.SubVMulSV(d, o, this.normal, e.Initialize_s_cB), + I.MidVV(c, u, this.points[f]), + this.separations[f] = I.DotVV(I.SubVV(u, c, I.s_t0), this.normal) + } + break; + case t.b2ManifoldType.e_faceB: + for (F.MulRV(a.q, i.localNormal, this.normal), + _ = V.MulXV(a, i.localPoint, e.Initialize_s_planePoint), + f = 0; f < i.pointCount; ++f) + d = V.MulXV(n, i.points[f].localPoint, e.Initialize_s_clipPoint), + p = o - I.DotVV(I.SubVV(d, _, I.s_t0), this.normal), + u = I.AddVMulSV(d, p, this.normal, e.Initialize_s_cB), + c = I.SubVMulSV(d, s, this.normal, e.Initialize_s_cA), + I.MidVV(c, u, this.points[f]), + this.separations[f] = I.DotVV(I.SubVV(c, u, I.s_t0), this.normal); + this.normal.SelfNeg() + } + } + , + e.Initialize_s_pointA = new I, + e.Initialize_s_pointB = new I, + e.Initialize_s_cA = new I, + e.Initialize_s_cB = new I, + e.Initialize_s_planePoint = new I, + e.Initialize_s_clipPoint = new I, + e + } + )(); + (vt = t.b2PointState || (t.b2PointState = {}))[vt.b2_nullState = 0] = "b2_nullState", + vt[vt.b2_addState = 1] = "b2_addState", + vt[vt.b2_persistState = 2] = "b2_persistState", + vt[vt.b2_removeState = 3] = "b2_removeState"; + var xt = (function() { + function t() { + this.v = new I, + this.id = new mt + } + return t.MakeArray = function(e) { + return d(e, (function() { + return new t + } + )) + } + , + t.prototype.Copy = function(t) { + return this.v.Copy(t.v), + this.id.Copy(t.id), + this + } + , + t + } + )() + , bt = (function() { + function t() { + this.p1 = new I, + this.p2 = new I, + this.maxFraction = 1 + } + return t.prototype.Copy = function(t) { + return this.p1.Copy(t.p1), + this.p2.Copy(t.p2), + this.maxFraction = t.maxFraction, + this + } + , + t + } + )() + , Ct = (function() { + function t() { + this.normal = new I, + this.fraction = 0 + } + return t.prototype.Copy = function(t) { + return this.normal.Copy(t.normal), + this.fraction = t.fraction, + this + } + , + t + } + )() + , Tt = (function() { + function t() { + this.lowerBound = new I, + this.upperBound = new I, + this.m_cache_center = new I, + this.m_cache_extent = new I + } + return t.prototype.Copy = function(t) { + return this.lowerBound.Copy(t.lowerBound), + this.upperBound.Copy(t.upperBound), + this + } + , + t.prototype.IsValid = function() { + var t = this.upperBound.x - this.lowerBound.x + , e = this.upperBound.y - this.lowerBound.y + , i = t >= 0 && e >= 0; + return i && this.lowerBound.IsValid() && this.upperBound.IsValid() + } + , + t.prototype.GetCenter = function() { + return I.MidVV(this.lowerBound, this.upperBound, this.m_cache_center) + } + , + t.prototype.GetExtents = function() { + return I.ExtVV(this.lowerBound, this.upperBound, this.m_cache_extent) + } + , + t.prototype.GetPerimeter = function() { + return 2 * (this.upperBound.x - this.lowerBound.x + (this.upperBound.y - this.lowerBound.y)) + } + , + t.prototype.Combine1 = function(t) { + return this.lowerBound.x = y(this.lowerBound.x, t.lowerBound.x), + this.lowerBound.y = y(this.lowerBound.y, t.lowerBound.y), + this.upperBound.x = v(this.upperBound.x, t.upperBound.x), + this.upperBound.y = v(this.upperBound.y, t.upperBound.y), + this + } + , + t.prototype.Combine2 = function(t, e) { + return this.lowerBound.x = y(t.lowerBound.x, e.lowerBound.x), + this.lowerBound.y = y(t.lowerBound.y, e.lowerBound.y), + this.upperBound.x = v(t.upperBound.x, e.upperBound.x), + this.upperBound.y = v(t.upperBound.y, e.upperBound.y), + this + } + , + t.Combine = function(t, e, i) { + return i.Combine2(t, e), + i + } + , + t.prototype.Contains = function(t) { + var e = !0; + return (e = (e = (e = e && this.lowerBound.x <= t.lowerBound.x) && this.lowerBound.y <= t.lowerBound.y) && t.upperBound.x <= this.upperBound.x) && t.upperBound.y <= this.upperBound.y + } + , + t.prototype.RayCast = function(t, e) { + var r, s, a = -i, o = i, l = e.p1.x, h = e.p1.y, c = e.p2.x - e.p1.x, u = e.p2.y - e.p1.y, _ = m(c), f = m(u), d = t.normal; + if (_ < n) { + if (l < this.lowerBound.x || this.upperBound.x < l) + return !1 + } else { + var p = 1 / c + , v = -1; + if ((r = (this.lowerBound.x - l) * p) > (s = (this.upperBound.x - l) * p)) { + var g = r; + r = s, + s = g, + v = 1 + } + if (r > a && (d.x = v, + d.y = 0, + a = r), + a > (o = y(o, s))) + return !1 + } + if (f < n) { + if (h < this.lowerBound.y || this.upperBound.y < h) + return !1 + } else if (p = 1 / u, + v = -1, + (r = (this.lowerBound.y - h) * p) > (s = (this.upperBound.y - h) * p) && (g = r, + r = s, + s = g, + v = 1), + r > a && (d.x = 0, + d.y = v, + a = r), + a > (o = y(o, s))) + return !1; + return !(a < 0 || e.maxFraction < a || (t.fraction = a, + 0)) + } + , + t.prototype.TestContain = function(t) { + return !(t.x < this.lowerBound.x || this.upperBound.x < t.x || t.y < this.lowerBound.y || this.upperBound.y < t.y) + } + , + t.prototype.TestOverlap = function(t) { + var e = t.lowerBound.x - this.upperBound.x + , i = t.lowerBound.y - this.upperBound.y + , n = this.lowerBound.x - t.upperBound.x + , r = this.lowerBound.y - t.upperBound.y; + return !(e > 0 || i > 0 || n > 0 || r > 0) + } + , + t + } + )(); + function St(t, e) { + var i = e.lowerBound.x - t.upperBound.x + , n = e.lowerBound.y - t.upperBound.y + , r = t.lowerBound.x - e.upperBound.x + , s = t.lowerBound.y - e.upperBound.y; + return !(i > 0 || n > 0 || r > 0 || s > 0) + } + function wt(e, i, n, r, s) { + var a = 0 + , o = i[0] + , l = i[1] + , h = I.DotVV(n, o.v) - r + , c = I.DotVV(n, l.v) - r; + if (h <= 0 && e[a++].Copy(o), + c <= 0 && e[a++].Copy(l), + h * c < 0) { + var u = h / (h - c) + , _ = e[a].v; + _.x = o.v.x + u * (l.v.x - o.v.x), + _.y = o.v.y + u * (l.v.y - o.v.y); + var f = e[a].id; + f.cf.indexA = s, + f.cf.indexB = o.id.cf.indexB, + f.cf.typeA = t.b2ContactFeatureType.e_vertex, + f.cf.typeB = t.b2ContactFeatureType.e_face, + ++a + } + return a + } + var Et = new X + , Mt = new j + , Dt = new Y; + function Bt(t, e, i, r, s, a) { + var o = Et.Reset(); + o.proxyA.SetShape(t, e), + o.proxyB.SetShape(i, r), + o.transformA.Copy(s), + o.transformB.Copy(a), + o.useRadii = !0; + var l = Mt.Reset(); + l.count = 0; + var h = Dt.Reset(); + return rt(h, l, o), + h.distance < 10 * n + } + function It(t) { + if (null === t) + throw new Error; + return t + } + var Pt = (function() { + function t(t) { + void 0 === t && (t = 0), + this.m_id = 0, + this.aabb = new Tt, + this.parent = null, + this.child1 = null, + this.child2 = null, + this.height = 0, + this.m_id = t + } + return t.prototype.IsLeaf = function() { + return null === this.child1 + } + , + t + } + )() + , Rt = (function() { + function t() { + this.m_root = null, + this.m_freeList = null, + this.m_path = 0, + this.m_insertionCount = 0, + this.m_stack = new H(256) + } + return t.prototype.Query = function(t, e) { + if (null !== this.m_root) { + var i = this.m_stack.Reset(); + for (i.Push(this.m_root); i.GetCount() > 0; ) { + var n = i.Pop(); + if (n.aabb.TestOverlap(t)) + if (n.IsLeaf()) { + if (!e(n)) + return + } else + i.Push(It(n.child1)), + i.Push(It(n.child2)) + } + } + } + , + t.prototype.QueryPoint = function(t, e) { + if (null !== this.m_root) { + var i = this.m_stack.Reset(); + for (i.Push(this.m_root); i.GetCount() > 0; ) { + var n = i.Pop(); + if (n.aabb.TestContain(t)) + if (n.IsLeaf()) { + if (!e(n)) + return + } else + i.Push(It(n.child1)), + i.Push(It(n.child2)) + } + } + } + , + t.prototype.RayCast = function(e, i) { + if (null !== this.m_root) { + var n = e.p1 + , r = e.p2 + , s = I.SubVV(r, n, t.s_r); + s.Normalize(); + var a = I.CrossOneV(s, t.s_v) + , o = I.AbsV(a, t.s_abs_v) + , l = e.maxFraction + , h = t.s_segmentAABB + , c = n.x + l * (r.x - n.x) + , u = n.y + l * (r.y - n.y); + h.lowerBound.x = y(n.x, c), + h.lowerBound.y = y(n.y, u), + h.upperBound.x = v(n.x, c), + h.upperBound.y = v(n.y, u); + var _ = this.m_stack.Reset(); + for (_.Push(this.m_root); _.GetCount() > 0; ) { + var f = _.Pop(); + if (St(f.aabb, h)) { + var d = f.aabb.GetCenter() + , p = f.aabb.GetExtents(); + if (!(m(I.DotVV(a, I.SubVV(n, d, I.s_t0))) - I.DotVV(o, p) > 0)) + if (f.IsLeaf()) { + var g = t.s_subInput; + g.p1.Copy(e.p1), + g.p2.Copy(e.p2), + g.maxFraction = l; + var A = i(g, f); + if (0 === A) + return; + A > 0 && (l = A, + c = n.x + l * (r.x - n.x), + u = n.y + l * (r.y - n.y), + h.lowerBound.x = y(n.x, c), + h.lowerBound.y = y(n.y, u), + h.upperBound.x = v(n.x, c), + h.upperBound.y = v(n.y, u)) + } else + _.Push(It(f.child1)), + _.Push(It(f.child2)) + } + } + } + } + , + t.prototype.AllocateNode = function() { + if (this.m_freeList) { + var e = this.m_freeList; + return this.m_freeList = e.parent, + e.parent = null, + e.child1 = null, + e.child2 = null, + e.height = 0, + delete e.userData, + e + } + return new Pt(t.s_node_id++) + } + , + t.prototype.FreeNode = function(t) { + t.parent = this.m_freeList, + t.child1 = null, + t.child2 = null, + t.height = -1, + delete t.userData, + this.m_freeList = t + } + , + t.prototype.CreateProxy = function(t, e) { + var i = this.AllocateNode(); + return i.aabb.lowerBound.x = t.lowerBound.x - .1, + i.aabb.lowerBound.y = t.lowerBound.y - .1, + i.aabb.upperBound.x = t.upperBound.x + .1, + i.aabb.upperBound.y = t.upperBound.y + .1, + i.userData = e, + i.height = 0, + this.InsertLeaf(i), + i + } + , + t.prototype.DestroyProxy = function(t) { + this.RemoveLeaf(t), + this.FreeNode(t) + } + , + t.prototype.MoveProxy = function(t, e, i) { + if (t.aabb.Contains(e)) + return !1; + this.RemoveLeaf(t); + var n = .1 + 2 * (i.x > 0 ? i.x : -i.x) + , r = .1 + 2 * (i.y > 0 ? i.y : -i.y); + return t.aabb.lowerBound.x = e.lowerBound.x - n, + t.aabb.lowerBound.y = e.lowerBound.y - r, + t.aabb.upperBound.x = e.upperBound.x + n, + t.aabb.upperBound.y = e.upperBound.y + r, + this.InsertLeaf(t), + !0 + } + , + t.prototype.InsertLeaf = function(e) { + if (++this.m_insertionCount, + null === this.m_root) + return this.m_root = e, + void (this.m_root.parent = null); + for (var i = e.aabb, n = this.m_root; !n.IsLeaf(); ) { + var r = It(n.child1) + , s = It(n.child2) + , a = n.aabb.GetPerimeter() + , o = t.s_combinedAABB; + o.Combine2(n.aabb, i); + var l = o.GetPerimeter() + , h = 2 * l + , c = 2 * (l - a) + , u = void 0 + , _ = t.s_aabb + , f = void 0; + r.IsLeaf() ? (_.Combine2(i, r.aabb), + u = _.GetPerimeter() + c) : (_.Combine2(i, r.aabb), + f = r.aabb.GetPerimeter(), + u = _.GetPerimeter() - f + c); + var d = void 0; + if (s.IsLeaf() ? (_.Combine2(i, s.aabb), + d = _.GetPerimeter() + c) : (_.Combine2(i, s.aabb), + f = s.aabb.GetPerimeter(), + d = _.GetPerimeter() - f + c), + h < u && h < d) + break; + n = u < d ? r : s + } + var p = n + , m = p.parent + , y = this.AllocateNode(); + y.parent = m, + delete y.userData, + y.aabb.Combine2(i, p.aabb), + y.height = p.height + 1, + m ? (m.child1 === p ? m.child1 = y : m.child2 = y, + y.child1 = p, + y.child2 = e, + p.parent = y, + e.parent = y) : (y.child1 = p, + y.child2 = e, + p.parent = y, + e.parent = y, + this.m_root = y); + for (var g = e.parent; null !== g; ) + r = It((g = this.Balance(g)).child1), + s = It(g.child2), + g.height = 1 + v(r.height, s.height), + g.aabb.Combine2(r.aabb, s.aabb), + g = g.parent + } + , + t.prototype.RemoveLeaf = function(t) { + if (t !== this.m_root) { + var e, i = It(t.parent), n = i && i.parent; + if (e = i.child1 === t ? It(i.child2) : It(i.child1), + n) { + n.child1 === i ? n.child1 = e : n.child2 = e, + e.parent = n, + this.FreeNode(i); + for (var r = n; r; ) { + var s = It((r = this.Balance(r)).child1) + , a = It(r.child2); + r.aabb.Combine2(s.aabb, a.aabb), + r.height = 1 + v(s.height, a.height), + r = r.parent + } + } else + this.m_root = e, + e.parent = null, + this.FreeNode(i) + } else + this.m_root = null + } + , + t.prototype.Balance = function(t) { + if (t.IsLeaf() || t.height < 2) + return t; + var e = It(t.child1) + , i = It(t.child2) + , n = i.height - e.height; + if (n > 1) { + var r = It(i.child1) + , s = It(i.child2); + return i.child1 = t, + i.parent = t.parent, + t.parent = i, + null !== i.parent ? i.parent.child1 === t ? i.parent.child1 = i : i.parent.child2 = i : this.m_root = i, + r.height > s.height ? (i.child2 = r, + t.child2 = s, + s.parent = t, + t.aabb.Combine2(e.aabb, s.aabb), + i.aabb.Combine2(t.aabb, r.aabb), + t.height = 1 + v(e.height, s.height), + i.height = 1 + v(t.height, r.height)) : (i.child2 = s, + t.child2 = r, + r.parent = t, + t.aabb.Combine2(e.aabb, r.aabb), + i.aabb.Combine2(t.aabb, s.aabb), + t.height = 1 + v(e.height, r.height), + i.height = 1 + v(t.height, s.height)), + i + } + if (n < -1) { + var a = It(e.child1) + , o = It(e.child2); + return e.child1 = t, + e.parent = t.parent, + t.parent = e, + null !== e.parent ? e.parent.child1 === t ? e.parent.child1 = e : e.parent.child2 = e : this.m_root = e, + a.height > o.height ? (e.child2 = a, + t.child1 = o, + o.parent = t, + t.aabb.Combine2(i.aabb, o.aabb), + e.aabb.Combine2(t.aabb, a.aabb), + t.height = 1 + v(i.height, o.height), + e.height = 1 + v(t.height, a.height)) : (e.child2 = o, + t.child1 = a, + a.parent = t, + t.aabb.Combine2(i.aabb, a.aabb), + e.aabb.Combine2(t.aabb, o.aabb), + t.height = 1 + v(i.height, a.height), + e.height = 1 + v(t.height, o.height)), + e + } + return t + } + , + t.prototype.GetHeight = function() { + return null === this.m_root ? 0 : this.m_root.height + } + , + t.GetAreaNode = function(e) { + if (null === e) + return 0; + if (e.IsLeaf()) + return 0; + var i = e.aabb.GetPerimeter(); + return (i += t.GetAreaNode(e.child1)) + t.GetAreaNode(e.child2) + } + , + t.prototype.GetAreaRatio = function() { + if (null === this.m_root) + return 0; + var e = this.m_root.aabb.GetPerimeter(); + return t.GetAreaNode(this.m_root) / e + } + , + t.prototype.ComputeHeightNode = function(t) { + if (!t || t.IsLeaf()) + return 0; + var e = this.ComputeHeightNode(t.child1) + , i = this.ComputeHeightNode(t.child2); + return 1 + v(e, i) + } + , + t.prototype.ComputeHeight = function() { + return this.ComputeHeightNode(this.m_root) + } + , + t.prototype.ValidateStructure = function(t) { + if (null !== t) { + this.m_root; + var e = t; + if (!e.IsLeaf()) { + var i = It(e.child1) + , n = It(e.child2); + this.ValidateStructure(i), + this.ValidateStructure(n) + } + } + } + , + t.prototype.ValidateMetrics = function(e) { + if (null !== e) { + var i = e; + if (!i.IsLeaf()) { + var n = It(i.child1) + , r = It(i.child2); + t.s_aabb.Combine2(n.aabb, r.aabb), + this.ValidateMetrics(n), + this.ValidateMetrics(r) + } + } + } + , + t.prototype.Validate = function() {} + , + t.GetMaxBalanceNode = function(t, e) { + if (null === t) + return e; + if (t.height <= 1) + return e; + var i = It(t.child1) + , n = It(t.child2) + , r = m(n.height - i.height); + return v(e, r) + } + , + t.prototype.GetMaxBalance = function() { + return t.GetMaxBalanceNode(this.m_root, 0) + } + , + t.prototype.RebuildBottomUp = function() { + this.Validate() + } + , + t.ShiftOriginNode = function(e, i) { + if (null !== e && !(e.height <= 1)) { + var n = e.child1 + , r = e.child2; + t.ShiftOriginNode(n, i), + t.ShiftOriginNode(r, i), + e.aabb.lowerBound.SelfSub(i), + e.aabb.upperBound.SelfSub(i) + } + } + , + t.prototype.ShiftOrigin = function(e) { + t.ShiftOriginNode(this.m_root, e) + } + , + t.s_r = new I, + t.s_v = new I, + t.s_abs_v = new I, + t.s_segmentAABB = new Tt, + t.s_subInput = new bt, + t.s_combinedAABB = new Tt, + t.s_aabb = new Tt, + t.s_node_id = 0, + t + } + )() + , Ot = function(t, e) { + this.proxyA = t, + this.proxyB = e + } + , Lt = (function() { + function t() { + this.m_tree = new Rt, + this.m_proxyCount = 0, + this.m_moveCount = 0, + this.m_moveBuffer = [], + this.m_pairCount = 0, + this.m_pairBuffer = [] + } + return t.prototype.CreateProxy = function(t, e) { + var i = this.m_tree.CreateProxy(t, e); + return ++this.m_proxyCount, + this.BufferMove(i), + i + } + , + t.prototype.DestroyProxy = function(t) { + this.UnBufferMove(t), + --this.m_proxyCount, + this.m_tree.DestroyProxy(t) + } + , + t.prototype.MoveProxy = function(t, e, i) { + this.m_tree.MoveProxy(t, e, i) && this.BufferMove(t) + } + , + t.prototype.TouchProxy = function(t) { + this.BufferMove(t) + } + , + t.prototype.GetProxyCount = function() { + return this.m_proxyCount + } + , + t.prototype.UpdatePairs = function(t) { + var e = this; + this.m_pairCount = 0; + for (var i = function(t) { + var i = n.m_moveBuffer[t]; + if (null === i) + return "continue"; + var r = i.aabb; + n.m_tree.Query(r, (function(t) { + if (t.m_id === i.m_id) + return !0; + var n, r; + if (t.m_id < i.m_id ? (n = t, + r = i) : (n = i, + r = t), + e.m_pairCount === e.m_pairBuffer.length) + e.m_pairBuffer[e.m_pairCount] = new Ot(n,r); + else { + var s = e.m_pairBuffer[e.m_pairCount]; + s.proxyA = n, + s.proxyB = r + } + return ++e.m_pairCount, + !0 + } + )) + }, n = this, r = 0; r < this.m_moveCount; ++r) + i(r); + this.m_moveCount = 0, + this.m_pairBuffer.length = this.m_pairCount, + this.m_pairBuffer.sort(Ft); + for (var s = 0; s < this.m_pairCount; ) { + var a = this.m_pairBuffer[s] + , o = a.proxyA.userData + , l = a.proxyB.userData; + for (o && l && t(o, l), + ++s; s < this.m_pairCount; ) { + var h = this.m_pairBuffer[s]; + if (h.proxyA.m_id !== a.proxyA.m_id || h.proxyB.m_id !== a.proxyB.m_id) + break; + ++s + } + } + } + , + t.prototype.Query = function(t, e) { + this.m_tree.Query(t, e) + } + , + t.prototype.QueryPoint = function(t, e) { + this.m_tree.QueryPoint(t, e) + } + , + t.prototype.RayCast = function(t, e) { + this.m_tree.RayCast(t, e) + } + , + t.prototype.GetTreeHeight = function() { + return this.m_tree.GetHeight() + } + , + t.prototype.GetTreeBalance = function() { + return this.m_tree.GetMaxBalance() + } + , + t.prototype.GetTreeQuality = function() { + return this.m_tree.GetAreaRatio() + } + , + t.prototype.ShiftOrigin = function(t) { + this.m_tree.ShiftOrigin(t) + } + , + t.prototype.BufferMove = function(t) { + this.m_moveBuffer[this.m_moveCount] = t, + ++this.m_moveCount + } + , + t.prototype.UnBufferMove = function(t) { + var e = this.m_moveBuffer.indexOf(t); + this.m_moveBuffer[e] = null + } + , + t + } + )(); + function Ft(t, e) { + return t.proxyA.m_id === e.proxyA.m_id ? t.proxyB.m_id - e.proxyB.m_id : t.proxyA.m_id - e.proxyA.m_id + } + t.b2_toiTime = 0, + t.b2_toiMaxTime = 0, + t.b2_toiCalls = 0, + t.b2_toiIters = 0, + t.b2_toiMaxIters = 0, + t.b2_toiRootIters = 0, + t.b2_toiMaxRootIters = 0; + var Vt, Nt = new V, kt = new V, Gt = new I, Ut = new I, zt = new I, Ht = new I, Wt = new I, jt = function() { + this.proxyA = new W, + this.proxyB = new W, + this.sweepA = new N, + this.sweepB = new N, + this.tMax = 0 + }; + (Vt = t.b2TOIOutputState || (t.b2TOIOutputState = {}))[Vt.e_unknown = 0] = "e_unknown", + Vt[Vt.e_failed = 1] = "e_failed", + Vt[Vt.e_overlapped = 2] = "e_overlapped", + Vt[Vt.e_touching = 3] = "e_touching", + Vt[Vt.e_separated = 4] = "e_separated"; + var Xt, Yt = function() { + this.state = t.b2TOIOutputState.e_unknown, + this.t = 0 + }; + (Xt = t.b2SeparationFunctionType || (t.b2SeparationFunctionType = {}))[Xt.e_unknown = -1] = "e_unknown", + Xt[Xt.e_points = 0] = "e_points", + Xt[Xt.e_faceA = 1] = "e_faceA", + Xt[Xt.e_faceB = 2] = "e_faceB"; + var qt = (function() { + function e() { + this.m_sweepA = new N, + this.m_sweepB = new N, + this.m_type = t.b2SeparationFunctionType.e_unknown, + this.m_localPoint = new I, + this.m_axis = new I + } + return e.prototype.Initialize = function(e, i, n, r, s, a) { + this.m_proxyA = i, + this.m_proxyB = r; + var o = e.count; + this.m_sweepA.Copy(n), + this.m_sweepB.Copy(s); + var l = Nt + , h = kt; + if (this.m_sweepA.GetTransform(l, a), + this.m_sweepB.GetTransform(h, a), + 1 === o) { + this.m_type = t.b2SeparationFunctionType.e_points; + var c = this.m_proxyA.GetVertex(e.indexA[0]) + , u = this.m_proxyB.GetVertex(e.indexB[0]) + , _ = V.MulXV(l, c, Gt) + , f = V.MulXV(h, u, Ut); + I.SubVV(f, _, this.m_axis); + var d = this.m_axis.Normalize(); + return this.m_localPoint.SetZero(), + d + } + if (e.indexA[0] === e.indexA[1]) { + this.m_type = t.b2SeparationFunctionType.e_faceB; + var p = this.m_proxyB.GetVertex(e.indexB[0]) + , m = this.m_proxyB.GetVertex(e.indexB[1]); + I.CrossVOne(I.SubVV(m, p, I.s_t0), this.m_axis).SelfNormalize(); + var y = F.MulRV(h.q, this.m_axis, zt); + return I.MidVV(p, m, this.m_localPoint), + f = V.MulXV(h, this.m_localPoint, Ut), + c = this.m_proxyA.GetVertex(e.indexA[0]), + _ = V.MulXV(l, c, Gt), + (d = I.DotVV(I.SubVV(_, f, I.s_t0), y)) < 0 && (this.m_axis.SelfNeg(), + d = -d), + d + } + this.m_type = t.b2SeparationFunctionType.e_faceA; + var v = this.m_proxyA.GetVertex(e.indexA[0]) + , g = this.m_proxyA.GetVertex(e.indexA[1]); + return I.CrossVOne(I.SubVV(g, v, I.s_t0), this.m_axis).SelfNormalize(), + y = F.MulRV(l.q, this.m_axis, zt), + I.MidVV(v, g, this.m_localPoint), + _ = V.MulXV(l, this.m_localPoint, Gt), + u = this.m_proxyB.GetVertex(e.indexB[0]), + f = V.MulXV(h, u, Ut), + (d = I.DotVV(I.SubVV(f, _, I.s_t0), y)) < 0 && (this.m_axis.SelfNeg(), + d = -d), + d + } + , + e.prototype.FindMinSeparation = function(e, i, n) { + var r = Nt + , s = kt; + switch (this.m_sweepA.GetTransform(r, n), + this.m_sweepB.GetTransform(s, n), + this.m_type) { + case t.b2SeparationFunctionType.e_points: + var a = F.MulTRV(r.q, this.m_axis, Ht) + , o = F.MulTRV(s.q, I.NegV(this.m_axis, I.s_t0), Wt); + e[0] = this.m_proxyA.GetSupport(a), + i[0] = this.m_proxyB.GetSupport(o); + var l = this.m_proxyA.GetVertex(e[0]) + , h = this.m_proxyB.GetVertex(i[0]) + , c = V.MulXV(r, l, Gt) + , u = V.MulXV(s, h, Ut); + return I.DotVV(I.SubVV(u, c, I.s_t0), this.m_axis); + case t.b2SeparationFunctionType.e_faceA: + var _ = F.MulRV(r.q, this.m_axis, zt); + return c = V.MulXV(r, this.m_localPoint, Gt), + o = F.MulTRV(s.q, I.NegV(_, I.s_t0), Wt), + e[0] = -1, + i[0] = this.m_proxyB.GetSupport(o), + h = this.m_proxyB.GetVertex(i[0]), + u = V.MulXV(s, h, Ut), + I.DotVV(I.SubVV(u, c, I.s_t0), _); + case t.b2SeparationFunctionType.e_faceB: + return _ = F.MulRV(s.q, this.m_axis, zt), + u = V.MulXV(s, this.m_localPoint, Ut), + a = F.MulTRV(r.q, I.NegV(_, I.s_t0), Ht), + i[0] = -1, + e[0] = this.m_proxyA.GetSupport(a), + l = this.m_proxyA.GetVertex(e[0]), + c = V.MulXV(r, l, Gt), + I.DotVV(I.SubVV(c, u, I.s_t0), _); + default: + return e[0] = -1, + i[0] = -1, + 0 + } + } + , + e.prototype.Evaluate = function(e, i, n) { + var r = Nt + , s = kt; + switch (this.m_sweepA.GetTransform(r, n), + this.m_sweepB.GetTransform(s, n), + this.m_type) { + case t.b2SeparationFunctionType.e_points: + var a = this.m_proxyA.GetVertex(e) + , o = this.m_proxyB.GetVertex(i) + , l = V.MulXV(r, a, Gt) + , h = V.MulXV(s, o, Ut); + return I.DotVV(I.SubVV(h, l, I.s_t0), this.m_axis); + case t.b2SeparationFunctionType.e_faceA: + var c = F.MulRV(r.q, this.m_axis, zt); + return l = V.MulXV(r, this.m_localPoint, Gt), + o = this.m_proxyB.GetVertex(i), + h = V.MulXV(s, o, Ut), + I.DotVV(I.SubVV(h, l, I.s_t0), c); + case t.b2SeparationFunctionType.e_faceB: + return c = F.MulRV(s.q, this.m_axis, zt), + h = V.MulXV(s, this.m_localPoint, Ut), + a = this.m_proxyA.GetVertex(e), + l = V.MulXV(r, a, Gt), + I.DotVV(I.SubVV(l, h, I.s_t0), c); + default: + return 0 + } + } + , + e + } + )() + , Jt = new U + , Zt = new j + , Kt = new X + , Qt = new Y + , $t = new qt + , te = [0] + , ee = [0] + , ie = new N + , ne = new N; + function re(e, i) { + var n = Jt.Reset(); + ++t.b2_toiCalls, + e.state = t.b2TOIOutputState.e_unknown, + e.t = i.tMax; + var r = i.proxyA + , s = i.proxyB + , a = ie.Copy(i.sweepA) + , h = ne.Copy(i.sweepB); + a.Normalize(), + h.Normalize(); + var c = i.tMax + , u = r.m_radius + s.m_radius + , _ = v(l, u - 3 * l) + , f = .25 * l + , d = 0 + , p = 0 + , y = Zt; + y.count = 0; + var g = Kt; + for (g.proxyA.Copy(i.proxyA), + g.proxyB.Copy(i.proxyB), + g.useRadii = !1; ; ) { + var A = Nt + , x = kt; + a.GetTransform(A, d), + h.GetTransform(x, d), + g.transformA.Copy(A), + g.transformB.Copy(x); + var b = Qt; + if (rt(b, y, g), + b.distance <= 0) { + e.state = t.b2TOIOutputState.e_overlapped, + e.t = 0; + break + } + if (b.distance < _ + f) { + e.state = t.b2TOIOutputState.e_touching, + e.t = d; + break + } + var C = $t; + C.Initialize(y, r, a, s, h, d); + for (var T = !1, S = c, w = 0; ; ) { + var E = te + , M = ee + , D = C.FindMinSeparation(E, M, S); + if (D > _ + f) { + e.state = t.b2TOIOutputState.e_separated, + e.t = c, + T = !0; + break + } + if (D > _ - f) { + d = S; + break + } + var B = C.Evaluate(E[0], M[0], d); + if (B < _ - f) { + e.state = t.b2TOIOutputState.e_failed, + e.t = d, + T = !0; + break + } + if (B <= _ + f) { + e.state = t.b2TOIOutputState.e_touching, + e.t = d, + T = !0; + break + } + for (var I = 0, P = d, R = S; ; ) { + var O; + O = 1 & I ? P + (_ - B) * (R - P) / (D - B) : .5 * (P + R), + ++I, + ++t.b2_toiRootIters; + var L = C.Evaluate(E[0], M[0], O); + if (m(L - _) < f) { + S = O; + break + } + if (L > _ ? (P = O, + B = L) : (R = O, + D = L), + 50 === I) + break + } + if (t.b2_toiMaxRootIters = v(t.b2_toiMaxRootIters, I), + ++w === o) + break + } + if (++p, + ++t.b2_toiIters, + T) + break; + if (20 === p) { + e.state = t.b2TOIOutputState.e_failed, + e.t = d; + break + } + } + t.b2_toiMaxIters = v(t.b2_toiMaxIters, p); + var F = n.GetMilliseconds(); + t.b2_toiMaxTime = v(t.b2_toiMaxTime, F), + t.b2_toiTime += F + } + var se = new I + , ae = new I; + function oe(e, i, n, r, s) { + e.pointCount = 0; + var a = V.MulXV(n, i.m_p, se) + , o = V.MulXV(s, r.m_p, ae) + , l = I.DistanceSquaredVV(a, o) + , h = i.m_radius + r.m_radius; + l > h * h || (e.type = t.b2ManifoldType.e_circles, + e.localPoint.Copy(i.m_p), + e.localNormal.SetZero(), + e.pointCount = 1, + e.points[0].localPoint.Copy(r.m_p), + e.points[0].id.key = 0) + } + var le = new I + , he = new I + , ce = new I; + function ue(e, r, s, a, o) { + e.pointCount = 0; + for (var l = V.MulXV(o, a.m_p, le), h = V.MulTXV(s, l, he), c = 0, u = -i, _ = r.m_radius + a.m_radius, f = r.m_count, d = r.m_vertices, p = r.m_normals, m = 0; m < f; ++m) { + var y = I.DotVV(p[m], I.SubVV(h, d[m], I.s_t0)); + if (y > _) + return; + y > u && (u = y, + c = m) + } + var v = c + , g = (v + 1) % f + , A = d[v] + , x = d[g]; + if (u < n) + return e.pointCount = 1, + e.type = t.b2ManifoldType.e_faceA, + e.localNormal.Copy(p[c]), + I.MidVV(A, x, e.localPoint), + e.points[0].localPoint.Copy(a.m_p), + void (e.points[0].id.key = 0); + var b = I.DotVV(I.SubVV(h, A, I.s_t0), I.SubVV(x, A, I.s_t1)) + , C = I.DotVV(I.SubVV(h, x, I.s_t0), I.SubVV(A, x, I.s_t1)); + if (b <= 0) { + if (I.DistanceSquaredVV(h, A) > _ * _) + return; + e.pointCount = 1, + e.type = t.b2ManifoldType.e_faceA, + I.SubVV(h, A, e.localNormal).SelfNormalize(), + e.localPoint.Copy(A), + e.points[0].localPoint.Copy(a.m_p), + e.points[0].id.key = 0 + } else if (C <= 0) { + if (I.DistanceSquaredVV(h, x) > _ * _) + return; + e.pointCount = 1, + e.type = t.b2ManifoldType.e_faceA, + I.SubVV(h, x, e.localNormal).SelfNormalize(), + e.localPoint.Copy(x), + e.points[0].localPoint.Copy(a.m_p), + e.points[0].id.key = 0 + } else { + var T = I.MidVV(A, x, ce); + if (I.DotVV(I.SubVV(h, T, I.s_t1), p[v]) > _) + return; + e.pointCount = 1, + e.type = t.b2ManifoldType.e_faceA, + e.localNormal.Copy(p[v]).SelfNormalize(), + e.localPoint.Copy(T), + e.points[0].localPoint.Copy(a.m_p), + e.points[0].id.key = 0 + } + } + var _e = new I + , fe = new I + , de = new I + , pe = new I; + function me(t, e, n, r, s) { + for (var a = t.m_vertices, o = t.m_normals, l = r.m_count, h = r.m_vertices, c = F.MulRV(e.q, o[n], _e), u = F.MulTRV(s.q, c, fe), _ = 0, f = i, d = 0; d < l; ++d) { + var p = I.DotVV(h[d], u); + p < f && (f = p, + _ = d) + } + var m = V.MulXV(e, a[n], de) + , y = V.MulXV(s, h[_], pe); + return I.DotVV(I.SubVV(y, m, I.s_t0), c) + } + var ye = new I + , ve = new I; + function ge(t, e, n, r, s) { + for (var a = e.m_count, o = e.m_normals, l = I.SubVV(V.MulXV(s, r.m_centroid, I.s_t0), V.MulXV(n, e.m_centroid, I.s_t1), ye), h = F.MulTRV(n.q, l, ve), c = 0, u = -i, _ = 0; _ < a; ++_) { + var f = I.DotVV(o[_], h); + f > u && (u = f, + c = _) + } + var d = me(e, n, c, r, s) + , p = (c + a - 1) % a + , m = me(e, n, p, r, s) + , y = (c + 1) % a + , v = me(e, n, y, r, s) + , g = 0 + , A = 0 + , x = 0; + if (m > d && m > v) + x = -1, + g = p, + A = m; + else { + if (!(v > d)) + return t[0] = c, + d; + x = 1, + g = y, + A = v + } + for (; (d = me(e, n, c = -1 === x ? (g + a - 1) % a : (g + 1) % a, r, s)) > A; ) + g = c, + A = d; + return t[0] = g, + A + } + var Ae = new I; + function xe(e, n, r, s, a, o) { + for (var l = n.m_normals, h = a.m_count, c = a.m_vertices, u = a.m_normals, _ = F.MulTRV(o.q, F.MulRV(r.q, l[s], I.s_t0), Ae), f = 0, d = i, p = 0; p < h; ++p) { + var m = I.DotVV(_, u[p]); + m < d && (d = m, + f = p) + } + var y = f + , v = (y + 1) % h + , g = e[0]; + V.MulXV(o, c[y], g.v); + var A = g.id.cf; + A.indexA = s, + A.indexB = y, + A.typeA = t.b2ContactFeatureType.e_face, + A.typeB = t.b2ContactFeatureType.e_vertex; + var x = e[1]; + V.MulXV(o, c[v], x.v); + var b = x.id.cf; + b.indexA = s, + b.indexB = v, + b.typeA = t.b2ContactFeatureType.e_face, + b.typeB = t.b2ContactFeatureType.e_vertex + } + var be = xt.MakeArray(2) + , Ce = xt.MakeArray(2) + , Te = xt.MakeArray(2) + , Se = [0] + , we = [0] + , Ee = new I + , Me = new I + , De = new I + , Be = new I + , Ie = new I + , Pe = new I + , Re = new I + , Oe = new I; + function Le(e, i, n, r, s) { + e.pointCount = 0; + var o = i.m_radius + r.m_radius + , l = Se; + l[0] = 0; + var h = ge(l, i, n, r, s); + if (!(h > o)) { + var c = we; + c[0] = 0; + var u = ge(c, r, s, i, n); + if (!(u > o)) { + var _, f, d, p, m = 0, y = 0; + u > .98 * h + .001 ? (_ = r, + f = i, + d = s, + p = n, + m = c[0], + e.type = t.b2ManifoldType.e_faceB, + y = 1) : (_ = i, + f = r, + d = n, + p = s, + m = l[0], + e.type = t.b2ManifoldType.e_faceA, + y = 0); + var v = be; + xe(v, _, d, m, f, p); + var g = _.m_count + , A = _.m_vertices + , x = m + , b = (m + 1) % g + , C = A[x] + , T = A[b] + , S = I.SubVV(T, C, Ee); + S.Normalize(); + var w = I.CrossVOne(S, Me) + , E = I.MidVV(C, T, De) + , M = F.MulRV(d.q, S, Ie) + , D = I.CrossVOne(M, Be) + , B = V.MulXV(d, C, Re) + , P = V.MulXV(d, T, Oe) + , R = I.DotVV(D, B) + , O = -I.DotVV(M, B) + o + , L = I.DotVV(M, P) + o + , N = Ce + , k = Te; + if (!(wt(N, v, I.NegV(M, Pe), O, x) < 2 || wt(k, N, M, L, b) < 2)) { + e.localNormal.Copy(w), + e.localPoint.Copy(E); + for (var G = 0, U = 0; U < a; ++U) { + var z = k[U]; + if (I.DotVV(D, z.v) - R <= o) { + var H = e.points[G]; + if (V.MulTXV(p, z.v, H.localPoint), + H.id.Copy(z.id), + y) { + var W = H.id.cf; + H.id.cf.indexA = W.indexB, + H.id.cf.indexB = W.indexA, + H.id.cf.typeA = W.typeB, + H.id.cf.typeB = W.typeA + } + ++G + } + } + e.pointCount = G + } + } + } + } + var Fe = new I + , Ve = new I + , Ne = new I + , ke = new I + , Ge = new I + , Ue = new I + , ze = new I + , He = new mt; + function We(e, i, n, r, s) { + e.pointCount = 0; + var a = V.MulTXV(n, V.MulXV(s, r.m_p, I.s_t0), Fe) + , o = i.m_vertex1 + , l = i.m_vertex2 + , h = I.SubVV(l, o, Ve) + , c = I.DotVV(h, I.SubVV(l, a, I.s_t0)) + , u = I.DotVV(h, I.SubVV(a, o, I.s_t0)) + , _ = i.m_radius + r.m_radius + , f = He; + if (f.cf.indexB = 0, + f.cf.typeB = t.b2ContactFeatureType.e_vertex, + u <= 0) { + var d = o + , p = I.SubVV(a, d, Ne); + if (I.DotVV(p, p) > _ * _) + return; + if (i.m_hasVertex0) { + var m = i.m_vertex0 + , y = o + , v = I.SubVV(y, m, ke); + if (I.DotVV(v, I.SubVV(y, a, I.s_t0)) > 0) + return + } + return f.cf.indexA = 0, + f.cf.typeA = t.b2ContactFeatureType.e_vertex, + e.pointCount = 1, + e.type = t.b2ManifoldType.e_circles, + e.localNormal.SetZero(), + e.localPoint.Copy(d), + e.points[0].id.Copy(f), + void e.points[0].localPoint.Copy(r.m_p) + } + if (c <= 0) { + var g = l + , A = I.SubVV(a, g, Ne); + if (I.DotVV(A, A) > _ * _) + return; + if (i.m_hasVertex3) { + var x = i.m_vertex3 + , b = l + , C = I.SubVV(x, b, Ge); + if (I.DotVV(C, I.SubVV(a, b, I.s_t0)) > 0) + return + } + return f.cf.indexA = 1, + f.cf.typeA = t.b2ContactFeatureType.e_vertex, + e.pointCount = 1, + e.type = t.b2ManifoldType.e_circles, + e.localNormal.SetZero(), + e.localPoint.Copy(g), + e.points[0].id.Copy(f), + void e.points[0].localPoint.Copy(r.m_p) + } + var T = I.DotVV(h, h) + , S = Ue; + S.x = 1 / T * (c * o.x + u * l.x), + S.y = 1 / T * (c * o.y + u * l.y); + var w = I.SubVV(a, S, Ne); + if (!(I.DotVV(w, w) > _ * _)) { + var E = ze.Set(-h.y, h.x); + I.DotVV(E, I.SubVV(a, o, I.s_t0)) < 0 && E.Set(-E.x, -E.y), + E.Normalize(), + f.cf.indexA = 0, + f.cf.typeA = t.b2ContactFeatureType.e_face, + e.pointCount = 1, + e.type = t.b2ManifoldType.e_faceA, + e.localNormal.Copy(E), + e.localPoint.Copy(o), + e.points[0].id.Copy(f), + e.points[0].localPoint.Copy(r.m_p) + } + } + var je = function() { + this.type = 0, + this.index = 0, + this.separation = 0 + } + , Xe = function() { + this.vertices = I.MakeArray(o), + this.normals = I.MakeArray(o), + this.count = 0 + } + , Ye = function() { + this.i1 = 0, + this.i2 = 0, + this.v1 = new I, + this.v2 = new I, + this.normal = new I, + this.sideNormal1 = new I, + this.sideOffset1 = 0, + this.sideNormal2 = new I, + this.sideOffset2 = 0 + } + , qe = new (function() { + function e() { + this.m_polygonB = new Xe, + this.m_xf = new V, + this.m_centroidB = new I, + this.m_v0 = new I, + this.m_v1 = new I, + this.m_v2 = new I, + this.m_v3 = new I, + this.m_normal0 = new I, + this.m_normal1 = new I, + this.m_normal2 = new I, + this.m_normal = new I, + this.m_type1 = 0, + this.m_type2 = 0, + this.m_lowerLimit = new I, + this.m_upperLimit = new I, + this.m_radius = 0, + this.m_front = !1 + } + return e.prototype.Collide = function(i, n, r, s, o) { + V.MulTXX(r, o, this.m_xf), + V.MulXV(this.m_xf, s.m_centroid, this.m_centroidB), + this.m_v0.Copy(n.m_vertex0), + this.m_v1.Copy(n.m_vertex1), + this.m_v2.Copy(n.m_vertex2), + this.m_v3.Copy(n.m_vertex3); + var l = n.m_hasVertex0 + , h = n.m_hasVertex3 + , c = I.SubVV(this.m_v2, this.m_v1, e.s_edge1); + c.Normalize(), + this.m_normal1.Set(c.y, -c.x); + var u = I.DotVV(this.m_normal1, I.SubVV(this.m_centroidB, this.m_v1, I.s_t0)) + , _ = 0 + , f = 0 + , d = !1 + , p = !1; + if (l) { + var m = I.SubVV(this.m_v1, this.m_v0, e.s_edge0); + m.Normalize(), + this.m_normal0.Set(m.y, -m.x), + d = I.CrossVV(m, c) >= 0, + _ = I.DotVV(this.m_normal0, I.SubVV(this.m_centroidB, this.m_v0, I.s_t0)) + } + if (h) { + var y = I.SubVV(this.m_v3, this.m_v2, e.s_edge2); + y.Normalize(), + this.m_normal2.Set(y.y, -y.x), + p = I.CrossVV(c, y) > 0, + f = I.DotVV(this.m_normal2, I.SubVV(this.m_centroidB, this.m_v2, I.s_t0)) + } + l && h ? d && p ? (this.m_front = _ >= 0 || u >= 0 || f >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal0), + this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : d ? (this.m_front = _ >= 0 || u >= 0 && f >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal0), + this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : p ? (this.m_front = f >= 0 || _ >= 0 && u >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal1), + this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : (this.m_front = _ >= 0 && u >= 0 && f >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal1), + this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : l ? d ? (this.m_front = _ >= 0 || u >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal0), + this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal1), + this.m_upperLimit.Copy(this.m_normal1).SelfNeg())) : (this.m_front = _ >= 0 && u >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal1), + this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal1), + this.m_upperLimit.Copy(this.m_normal0).SelfNeg())) : h ? p ? (this.m_front = u >= 0 || f >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal2)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal1))) : (this.m_front = u >= 0 && f >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal1)) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal1))) : (this.m_front = u >= 0, + this.m_front ? (this.m_normal.Copy(this.m_normal1), + this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(), + this.m_upperLimit.Copy(this.m_normal1).SelfNeg()) : (this.m_normal.Copy(this.m_normal1).SelfNeg(), + this.m_lowerLimit.Copy(this.m_normal1), + this.m_upperLimit.Copy(this.m_normal1))), + this.m_polygonB.count = s.m_count; + for (var v = 0; v < s.m_count; ++v) + V.MulXV(this.m_xf, s.m_vertices[v], this.m_polygonB.vertices[v]), + F.MulRV(this.m_xf.q, s.m_normals[v], this.m_polygonB.normals[v]); + this.m_radius = s.m_radius + n.m_radius, + i.pointCount = 0; + var g = this.ComputeEdgeSeparation(e.s_edgeAxis); + if (0 !== g.type && !(g.separation > this.m_radius)) { + var A = this.ComputePolygonSeparation(e.s_polygonAxis); + if (!(0 !== A.type && A.separation > this.m_radius)) { + var x; + x = 0 === A.type ? g : A.separation > .98 * g.separation + .001 ? A : g; + var b = e.s_ie + , C = e.s_rf; + if (1 === x.type) { + i.type = t.b2ManifoldType.e_faceA; + var T = 0 + , S = I.DotVV(this.m_normal, this.m_polygonB.normals[0]); + for (v = 1; v < this.m_polygonB.count; ++v) { + var w = I.DotVV(this.m_normal, this.m_polygonB.normals[v]); + w < S && (S = w, + T = v) + } + var E = T + , M = (E + 1) % this.m_polygonB.count; + (D = b[0]).v.Copy(this.m_polygonB.vertices[E]), + D.id.cf.indexA = 0, + D.id.cf.indexB = E, + D.id.cf.typeA = t.b2ContactFeatureType.e_face, + D.id.cf.typeB = t.b2ContactFeatureType.e_vertex, + (B = b[1]).v.Copy(this.m_polygonB.vertices[M]), + B.id.cf.indexA = 0, + B.id.cf.indexB = M, + B.id.cf.typeA = t.b2ContactFeatureType.e_face, + B.id.cf.typeB = t.b2ContactFeatureType.e_vertex, + this.m_front ? (C.i1 = 0, + C.i2 = 1, + C.v1.Copy(this.m_v1), + C.v2.Copy(this.m_v2), + C.normal.Copy(this.m_normal1)) : (C.i1 = 1, + C.i2 = 0, + C.v1.Copy(this.m_v2), + C.v2.Copy(this.m_v1), + C.normal.Copy(this.m_normal1).SelfNeg()) + } else { + var D, B; + i.type = t.b2ManifoldType.e_faceB, + (D = b[0]).v.Copy(this.m_v1), + D.id.cf.indexA = 0, + D.id.cf.indexB = x.index, + D.id.cf.typeA = t.b2ContactFeatureType.e_vertex, + D.id.cf.typeB = t.b2ContactFeatureType.e_face, + (B = b[1]).v.Copy(this.m_v2), + B.id.cf.indexA = 0, + B.id.cf.indexB = x.index, + B.id.cf.typeA = t.b2ContactFeatureType.e_vertex, + B.id.cf.typeB = t.b2ContactFeatureType.e_face, + C.i1 = x.index, + C.i2 = (C.i1 + 1) % this.m_polygonB.count, + C.v1.Copy(this.m_polygonB.vertices[C.i1]), + C.v2.Copy(this.m_polygonB.vertices[C.i2]), + C.normal.Copy(this.m_polygonB.normals[C.i1]) + } + C.sideNormal1.Set(C.normal.y, -C.normal.x), + C.sideNormal2.Copy(C.sideNormal1).SelfNeg(), + C.sideOffset1 = I.DotVV(C.sideNormal1, C.v1), + C.sideOffset2 = I.DotVV(C.sideNormal2, C.v2); + var P = e.s_clipPoints1 + , R = e.s_clipPoints2; + if (!(wt(P, b, C.sideNormal1, C.sideOffset1, C.i1) < a || wt(R, P, C.sideNormal2, C.sideOffset2, C.i2) < a)) { + 1 === x.type ? (i.localNormal.Copy(C.normal), + i.localPoint.Copy(C.v1)) : (i.localNormal.Copy(s.m_normals[C.i1]), + i.localPoint.Copy(s.m_vertices[C.i1])); + var O = 0; + for (v = 0; v < a; ++v) + if (I.DotVV(C.normal, I.SubVV(R[v].v, C.v1, I.s_t0)) <= this.m_radius) { + var L = i.points[O]; + 1 === x.type ? (V.MulTXV(this.m_xf, R[v].v, L.localPoint), + L.id = R[v].id) : (L.localPoint.Copy(R[v].v), + L.id.cf.typeA = R[v].id.cf.typeB, + L.id.cf.typeB = R[v].id.cf.typeA, + L.id.cf.indexA = R[v].id.cf.indexB, + L.id.cf.indexB = R[v].id.cf.indexA), + ++O + } + i.pointCount = O + } + } + } + } + , + e.prototype.ComputeEdgeSeparation = function(t) { + var e = t; + e.type = 1, + e.index = this.m_front ? 0 : 1, + e.separation = i; + for (var n = 0; n < this.m_polygonB.count; ++n) { + var r = I.DotVV(this.m_normal, I.SubVV(this.m_polygonB.vertices[n], this.m_v1, I.s_t0)); + r < e.separation && (e.separation = r) + } + return e + } + , + e.prototype.ComputePolygonSeparation = function(t) { + var n = t; + n.type = 0, + n.index = -1, + n.separation = -i; + for (var r = e.s_perp.Set(-this.m_normal.y, this.m_normal.x), s = 0; s < this.m_polygonB.count; ++s) { + var a = I.NegV(this.m_polygonB.normals[s], e.s_n) + , o = I.DotVV(a, I.SubVV(this.m_polygonB.vertices[s], this.m_v1, I.s_t0)) + , l = I.DotVV(a, I.SubVV(this.m_polygonB.vertices[s], this.m_v2, I.s_t0)) + , c = y(o, l); + if (c > this.m_radius) + return n.type = 2, + n.index = s, + n.separation = c, + n; + if (I.DotVV(a, r) >= 0) { + if (I.DotVV(I.SubVV(a, this.m_upperLimit, I.s_t0), this.m_normal) < -h) + continue + } else if (I.DotVV(I.SubVV(a, this.m_lowerLimit, I.s_t0), this.m_normal) < -h) + continue; + c > n.separation && (n.type = 2, + n.index = s, + n.separation = c) + } + return n + } + , + e.s_edge1 = new I, + e.s_edge0 = new I, + e.s_edge2 = new I, + e.s_ie = xt.MakeArray(2), + e.s_rf = new Ye, + e.s_clipPoints1 = xt.MakeArray(2), + e.s_clipPoints2 = xt.MakeArray(2), + e.s_edgeAxis = new je, + e.s_polygonAxis = new je, + e.s_n = new I, + e.s_perp = new I, + e + }()); + function Je(t, e, i, n, r) { + qe.Collide(t, e, i, n, r) + } + var Ze, Ke = function() { + this.mass = 0, + this.center = new I(0,0), + this.I = 0 + }; + (Ze = t.b2ShapeType || (t.b2ShapeType = {}))[Ze.e_unknown = -1] = "e_unknown", + Ze[Ze.e_circleShape = 0] = "e_circleShape", + Ze[Ze.e_edgeShape = 1] = "e_edgeShape", + Ze[Ze.e_polygonShape = 2] = "e_polygonShape", + Ze[Ze.e_chainShape = 3] = "e_chainShape", + Ze[Ze.e_shapeTypeCount = 4] = "e_shapeTypeCount"; + var Qe = (function() { + function e(e, i) { + this.m_type = t.b2ShapeType.e_unknown, + this.m_radius = 0, + this.m_type = e, + this.m_radius = i + } + return e.prototype.Copy = function(t) { + return this.m_radius = t.m_radius, + this + } + , + e.prototype.GetType = function() { + return this.m_type + } + , + e + } + )() + , $e = Object.setPrototypeOf || { + __proto__: [] + }instanceof Array && function(t, e) { + t.__proto__ = e + } + || function(t, e) { + for (var i in e) + e.hasOwnProperty(i) && (t[i] = e[i]) + } + ; + function ti(t, e) { + function i() { + this.constructor = t + } + $e(t, e), + t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, + new i) + } + var ei, ii = (function(e) { + function i(i) { + void 0 === i && (i = 0); + var n = e.call(this, t.b2ShapeType.e_circleShape, i) || this; + return n.m_p = new I, + n + } + return ti(i, e), + i.prototype.Set = function(t, e) { + return void 0 === e && (e = this.m_radius), + this.m_p.Copy(t), + this.m_radius = e, + this + } + , + i.prototype.Clone = function() { + return (new i).Copy(this) + } + , + i.prototype.Copy = function(t) { + return e.prototype.Copy.call(this, t), + this.m_p.Copy(t.m_p), + this + } + , + i.prototype.GetChildCount = function() { + return 1 + } + , + i.prototype.TestPoint = function(t, e) { + var n = V.MulXV(t, this.m_p, i.TestPoint_s_center) + , r = I.SubVV(e, n, i.TestPoint_s_d); + return I.DotVV(r, r) <= x(this.m_radius) + } + , + i.prototype.ComputeDistance = function(t, e, n) { + var r = V.MulXV(t, this.m_p, i.ComputeDistance_s_center); + return I.SubVV(e, r, n), + n.Normalize() - this.m_radius + } + , + i.prototype.RayCast = function(t, e, r) { + var s = V.MulXV(r, this.m_p, i.RayCast_s_position) + , a = I.SubVV(e.p1, s, i.RayCast_s_s) + , o = I.DotVV(a, a) - x(this.m_radius) + , l = I.SubVV(e.p2, e.p1, i.RayCast_s_r) + , h = I.DotVV(a, l) + , c = I.DotVV(l, l) + , u = h * h - c * o; + if (u < 0 || c < n) + return !1; + var _ = -(h + T(u)); + return 0 <= _ && _ <= e.maxFraction * c && (_ /= c, + t.fraction = _, + I.AddVMulSV(a, _, l, t.normal).SelfNormalize(), + !0) + } + , + i.prototype.ComputeAABB = function(t, e) { + var n = V.MulXV(e, this.m_p, i.ComputeAABB_s_p); + t.lowerBound.Set(n.x - this.m_radius, n.y - this.m_radius), + t.upperBound.Set(n.x + this.m_radius, n.y + this.m_radius) + } + , + i.prototype.ComputeMass = function(t, e) { + var i = x(this.m_radius); + t.mass = e * s * i, + t.center.Copy(this.m_p), + t.I = t.mass * (.5 * i + I.DotVV(this.m_p, this.m_p)) + } + , + i.prototype.SetupDistanceProxy = function(t) { + t.m_vertices = t.m_buffer, + t.m_vertices[0].Copy(this.m_p), + t.m_count = 1, + t.m_radius = this.m_radius + } + , + i.prototype.ComputeSubmergedArea = function(t, e, i, r) { + var a = V.MulXV(i, this.m_p, new I) + , o = -(I.DotVV(t, a) - e); + if (o < -this.m_radius + n) + return 0; + if (o > this.m_radius) + return r.Copy(a), + s * this.m_radius * this.m_radius; + var l = this.m_radius * this.m_radius + , h = o * o + , c = l * (D(o / this.m_radius) + s / 2) + o * T(l - h) + , u = -2 / 3 * S(l - h, 1.5) / c; + return r.x = a.x + t.x * u, + r.y = a.y + t.y * u, + c + } + , + i.prototype.Dump = function(t) { + t(" const shape: b2CircleShape = new b2CircleShape();\n"), + t(" shape.m_radius = %.15f;\n", this.m_radius), + t(" shape.m_p.Set(%.15f, %.15f);\n", this.m_p.x, this.m_p.y) + } + , + i.TestPoint_s_center = new I, + i.TestPoint_s_d = new I, + i.ComputeDistance_s_center = new I, + i.RayCast_s_position = new I, + i.RayCast_s_s = new I, + i.RayCast_s_r = new I, + i.ComputeAABB_s_p = new I, + i + } + )(Qe), ni = (function(e) { + function r() { + var i = e.call(this, t.b2ShapeType.e_polygonShape, c) || this; + return i.m_centroid = new I(0,0), + i.m_vertices = [], + i.m_normals = [], + i.m_count = 0, + i + } + return ti(r, e), + r.prototype.Clone = function() { + return (new r).Copy(this) + } + , + r.prototype.Copy = function(t) { + e.prototype.Copy.call(this, t), + this.m_centroid.Copy(t.m_centroid), + this.m_count = t.m_count, + this.m_vertices = I.MakeArray(this.m_count), + this.m_normals = I.MakeArray(this.m_count); + for (var i = 0; i < this.m_count; ++i) + this.m_vertices[i].Copy(t.m_vertices[i]), + this.m_normals[i].Copy(t.m_normals[i]); + return this + } + , + r.prototype.GetChildCount = function() { + return 1 + } + , + r.prototype.Set = function(t, e, i) { + if (void 0 === e && (e = t.length), + void 0 === i && (i = 0), + e < 3) + return this.SetAsBox(1, 1); + for (var n = y(e, o), s = r.Set_s_ps, a = 0, h = 0; h < n; ++h) { + for (var c = t[i + h], u = !0, _ = 0; _ < a; ++_) + if (I.DistanceSquaredVV(c, s[_]) < .25 * l * l) { + u = !1; + break + } + u && s[a++].Copy(c) + } + if ((n = a) < 3) + return this.SetAsBox(1, 1); + var f = 0 + , d = s[0].x; + for (h = 1; h < n; ++h) { + var p = s[h].x; + (p > d || p === d && s[h].y < s[f].y) && (f = h, + d = p) + } + for (var m = r.Set_s_hull, v = 0, g = f; ; ) { + m[v] = g; + var A = 0; + for (_ = 1; _ < n; ++_) + if (A !== g) { + var x = I.SubVV(s[A], s[m[v]], r.Set_s_r) + , b = (c = I.SubVV(s[_], s[m[v]], r.Set_s_v), + I.CrossVV(x, c)); + b < 0 && (A = _), + 0 === b && c.LengthSquared() > x.LengthSquared() && (A = _) + } else + A = _; + if (++v, + g = A, + A === f) + break + } + for (this.m_count = v, + this.m_vertices = I.MakeArray(this.m_count), + this.m_normals = I.MakeArray(this.m_count), + h = 0; h < v; ++h) + this.m_vertices[h].Copy(s[m[h]]); + for (h = 0; h < v; ++h) { + var C = this.m_vertices[h] + , T = this.m_vertices[(h + 1) % v] + , S = I.SubVV(T, C, I.s_t0); + I.CrossVOne(S, this.m_normals[h]).SelfNormalize() + } + return r.ComputeCentroid(this.m_vertices, v, this.m_centroid), + this + } + , + r.prototype.SetAsArray = function(t, e) { + return void 0 === e && (e = t.length), + this.Set(t, e) + } + , + r.prototype.SetAsBox = function(t, e, i, n) { + if (void 0 === n && (n = 0), + this.m_count = 4, + this.m_vertices = I.MakeArray(this.m_count), + this.m_normals = I.MakeArray(this.m_count), + this.m_vertices[0].Set(-t, -e), + this.m_vertices[1].Set(t, -e), + this.m_vertices[2].Set(t, e), + this.m_vertices[3].Set(-t, e), + this.m_normals[0].Set(0, -1), + this.m_normals[1].Set(1, 0), + this.m_normals[2].Set(0, 1), + this.m_normals[3].Set(-1, 0), + this.m_centroid.SetZero(), + i) { + this.m_centroid.Copy(i); + var r = new V; + r.SetPosition(i), + r.SetRotationAngle(n); + for (var s = 0; s < this.m_count; ++s) + V.MulXV(r, this.m_vertices[s], this.m_vertices[s]), + F.MulRV(r.q, this.m_normals[s], this.m_normals[s]) + } + return this + } + , + r.prototype.TestPoint = function(t, e) { + for (var i = V.MulTXV(t, e, r.TestPoint_s_pLocal), n = 0; n < this.m_count; ++n) + if (I.DotVV(this.m_normals[n], I.SubVV(i, this.m_vertices[n], I.s_t0)) > 0) + return !1; + return !0 + } + , + r.prototype.ComputeDistance = function(t, e, n) { + for (var s = V.MulTXV(t, e, r.ComputeDistance_s_pLocal), a = -i, o = r.ComputeDistance_s_normalForMaxDistance.Copy(s), l = 0; l < this.m_count; ++l) { + var h = I.DotVV(this.m_normals[l], I.SubVV(s, this.m_vertices[l], I.s_t0)); + h > a && (a = h, + o.Copy(this.m_normals[l])) + } + if (a > 0) { + var c = r.ComputeDistance_s_minDistance.Copy(o) + , u = a * a; + for (l = 0; l < this.m_count; ++l) { + var _ = I.SubVV(s, this.m_vertices[l], r.ComputeDistance_s_distance) + , f = _.LengthSquared(); + u > f && (c.Copy(_), + u = f) + } + return F.MulRV(t.q, c, n), + n.Normalize(), + Math.sqrt(u) + } + return F.MulRV(t.q, o, n), + a + } + , + r.prototype.RayCast = function(t, e, i) { + for (var n = V.MulTXV(i, e.p1, r.RayCast_s_p1), s = V.MulTXV(i, e.p2, r.RayCast_s_p2), a = I.SubVV(s, n, r.RayCast_s_d), o = 0, l = e.maxFraction, h = -1, c = 0; c < this.m_count; ++c) { + var u = I.DotVV(this.m_normals[c], I.SubVV(this.m_vertices[c], n, I.s_t0)) + , _ = I.DotVV(this.m_normals[c], a); + if (0 === _) { + if (u < 0) + return !1 + } else + _ < 0 && u < o * _ ? (o = u / _, + h = c) : _ > 0 && u < l * _ && (l = u / _); + if (l < o) + return !1 + } + return h >= 0 && (t.fraction = o, + F.MulRV(i.q, this.m_normals[h], t.normal), + !0) + } + , + r.prototype.ComputeAABB = function(t, e) { + for (var i = V.MulXV(e, this.m_vertices[0], t.lowerBound), n = t.upperBound.Copy(i), s = 0; s < this.m_count; ++s) { + var a = V.MulXV(e, this.m_vertices[s], r.ComputeAABB_s_v); + I.MinV(a, i, i), + I.MaxV(a, n, n) + } + var o = this.m_radius; + i.SelfSubXY(o, o), + n.SelfAddXY(o, o) + } + , + r.prototype.ComputeMass = function(t, e) { + for (var i = r.ComputeMass_s_center.SetZero(), n = 0, s = 0, a = r.ComputeMass_s_s.SetZero(), o = 0; o < this.m_count; ++o) + a.SelfAdd(this.m_vertices[o]); + for (a.SelfMul(1 / this.m_count), + o = 0; o < this.m_count; ++o) { + var l = I.SubVV(this.m_vertices[o], a, r.ComputeMass_s_e1) + , h = I.SubVV(this.m_vertices[(o + 1) % this.m_count], a, r.ComputeMass_s_e2) + , c = I.CrossVV(l, h) + , u = .5 * c; + n += u, + i.SelfAdd(I.MulSV(u * (1 / 3), I.AddVV(l, h, I.s_t0), I.s_t1)); + var _ = l.x + , f = l.y + , d = h.x + , p = h.y; + s += 1 / 3 * .25 * c * (_ * _ + d * _ + d * d + f * f + p * f + p * p) + } + t.mass = e * n, + i.SelfMul(1 / n), + I.AddVV(i, a, t.center), + t.I = e * s, + t.I += t.mass * (I.DotVV(t.center, t.center) - I.DotVV(i, i)) + } + , + r.prototype.Validate = function() { + for (var t = 0; t < this.m_count; ++t) + for (var e = t, i = (t + 1) % this.m_count, n = this.m_vertices[e], s = I.SubVV(this.m_vertices[i], n, r.Validate_s_e), a = 0; a < this.m_count; ++a) + if (a !== e && a !== i) { + var o = I.SubVV(this.m_vertices[a], n, r.Validate_s_v); + if (I.CrossVV(s, o) < 0) + return !1 + } + return !0 + } + , + r.prototype.SetupDistanceProxy = function(t) { + t.m_vertices = this.m_vertices, + t.m_count = this.m_count, + t.m_radius = this.m_radius + } + , + r.prototype.ComputeSubmergedArea = function(t, e, i, s) { + for (var a = F.MulTRV(i.q, t, r.ComputeSubmergedArea_s_normalL), o = e - I.DotVV(t, i.p), l = r.ComputeSubmergedArea_s_depths, h = 0, c = -1, u = -1, _ = !1, f = 0; f < this.m_count; ++f) { + l[f] = I.DotVV(a, this.m_vertices[f]) - o; + var d = l[f] < -n; + f > 0 && (d ? _ || (c = f - 1, + h++) : _ && (u = f - 1, + h++)), + _ = d + } + switch (h) { + case 0: + if (_) { + var p = r.ComputeSubmergedArea_s_md; + return this.ComputeMass(p, 1), + V.MulXV(i, p.center, s), + p.mass + } + return 0; + case 1: + -1 === c ? c = this.m_count - 1 : u = this.m_count - 1 + } + for (var m, y = (c + 1) % this.m_count, v = (u + 1) % this.m_count, g = (0 - l[c]) / (l[y] - l[c]), A = (0 - l[u]) / (l[v] - l[u]), x = r.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[c].x * (1 - g) + this.m_vertices[y].x * g, this.m_vertices[c].y * (1 - g) + this.m_vertices[y].y * g), b = r.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[u].x * (1 - A) + this.m_vertices[v].x * A, this.m_vertices[u].y * (1 - A) + this.m_vertices[v].y * A), C = 0, T = r.ComputeSubmergedArea_s_center.SetZero(), S = this.m_vertices[y], w = y; w !== v; ) { + m = (w = (w + 1) % this.m_count) === v ? b : this.m_vertices[w]; + var E = .5 * ((S.x - x.x) * (m.y - x.y) - (S.y - x.y) * (m.x - x.x)); + C += E, + T.x += E * (x.x + S.x + m.x) / 3, + T.y += E * (x.y + S.y + m.y) / 3, + S = m + } + return T.SelfMul(1 / C), + V.MulXV(i, T, s), + C + } + , + r.prototype.Dump = function(t) { + t(" const shape: b2PolygonShape = new b2PolygonShape();\n"), + t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", o); + for (var e = 0; e < this.m_count; ++e) + t(" vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y); + t(" shape.Set(vs, %d);\n", this.m_count) + } + , + r.ComputeCentroid = function(t, e, i) { + var n = i; + n.SetZero(); + for (var s = 0, a = r.ComputeCentroid_s_pRef.SetZero(), o = 0; o < e; ++o) { + var l = a + , h = t[o] + , c = t[(o + 1) % e] + , u = I.SubVV(h, l, r.ComputeCentroid_s_e1) + , _ = I.SubVV(c, l, r.ComputeCentroid_s_e2) + , f = .5 * I.CrossVV(u, _); + s += f, + n.x += f * (1 / 3) * (l.x + h.x + c.x), + n.y += f * (1 / 3) * (l.y + h.y + c.y) + } + return n.SelfMul(1 / s), + n + } + , + r.Set_s_ps = I.MakeArray(o), + r.Set_s_hull = p(o), + r.Set_s_r = new I, + r.Set_s_v = new I, + r.TestPoint_s_pLocal = new I, + r.ComputeDistance_s_pLocal = new I, + r.ComputeDistance_s_normalForMaxDistance = new I, + r.ComputeDistance_s_minDistance = new I, + r.ComputeDistance_s_distance = new I, + r.RayCast_s_p1 = new I, + r.RayCast_s_p2 = new I, + r.RayCast_s_d = new I, + r.ComputeAABB_s_v = new I, + r.ComputeMass_s_center = new I, + r.ComputeMass_s_s = new I, + r.ComputeMass_s_e1 = new I, + r.ComputeMass_s_e2 = new I, + r.Validate_s_e = new I, + r.Validate_s_v = new I, + r.ComputeSubmergedArea_s_normalL = new I, + r.ComputeSubmergedArea_s_depths = p(o), + r.ComputeSubmergedArea_s_md = new Ke, + r.ComputeSubmergedArea_s_intoVec = new I, + r.ComputeSubmergedArea_s_outoVec = new I, + r.ComputeSubmergedArea_s_center = new I, + r.ComputeCentroid_s_pRef = new I, + r.ComputeCentroid_s_e1 = new I, + r.ComputeCentroid_s_e2 = new I, + r + } + )(Qe), ri = (function(e) { + function i() { + var i = e.call(this, t.b2ShapeType.e_edgeShape, c) || this; + return i.m_vertex1 = new I, + i.m_vertex2 = new I, + i.m_vertex0 = new I, + i.m_vertex3 = new I, + i.m_hasVertex0 = !1, + i.m_hasVertex3 = !1, + i + } + return ti(i, e), + i.prototype.Set = function(t, e) { + return this.m_vertex1.Copy(t), + this.m_vertex2.Copy(e), + this.m_hasVertex0 = !1, + this.m_hasVertex3 = !1, + this + } + , + i.prototype.Clone = function() { + return (new i).Copy(this) + } + , + i.prototype.Copy = function(t) { + return e.prototype.Copy.call(this, t), + this.m_vertex1.Copy(t.m_vertex1), + this.m_vertex2.Copy(t.m_vertex2), + this.m_vertex0.Copy(t.m_vertex0), + this.m_vertex3.Copy(t.m_vertex3), + this.m_hasVertex0 = t.m_hasVertex0, + this.m_hasVertex3 = t.m_hasVertex3, + this + } + , + i.prototype.GetChildCount = function() { + return 1 + } + , + i.prototype.TestPoint = function() { + return !1 + } + , + i.prototype.ComputeDistance = function(t, e, n) { + var r = V.MulXV(t, this.m_vertex1, i.ComputeDistance_s_v1) + , s = V.MulXV(t, this.m_vertex2, i.ComputeDistance_s_v2) + , a = I.SubVV(e, r, i.ComputeDistance_s_d) + , o = I.SubVV(s, r, i.ComputeDistance_s_s) + , l = I.DotVV(a, o); + if (l > 0) { + var h = I.DotVV(o, o); + l > h ? I.SubVV(e, s, a) : a.SelfMulSub(l / h, o) + } + return n.Copy(a), + n.Normalize() + } + , + i.prototype.RayCast = function(t, e, n) { + var r = V.MulTXV(n, e.p1, i.RayCast_s_p1) + , s = V.MulTXV(n, e.p2, i.RayCast_s_p2) + , a = I.SubVV(s, r, i.RayCast_s_d) + , o = this.m_vertex1 + , l = this.m_vertex2 + , h = I.SubVV(l, o, i.RayCast_s_e) + , c = t.normal.Set(h.y, -h.x).SelfNormalize() + , u = I.DotVV(c, I.SubVV(o, r, I.s_t0)) + , _ = I.DotVV(c, a); + if (0 === _) + return !1; + var f = u / _; + if (f < 0 || e.maxFraction < f) + return !1; + var d = I.AddVMulSV(r, f, a, i.RayCast_s_q) + , p = I.SubVV(l, o, i.RayCast_s_r) + , m = I.DotVV(p, p); + if (0 === m) + return !1; + var y = I.DotVV(I.SubVV(d, o, I.s_t0), p) / m; + return !(y < 0 || 1 < y || (t.fraction = f, + F.MulRV(n.q, t.normal, t.normal), + u > 0 && t.normal.SelfNeg(), + 0)) + } + , + i.prototype.ComputeAABB = function(t, e) { + var n = V.MulXV(e, this.m_vertex1, i.ComputeAABB_s_v1) + , r = V.MulXV(e, this.m_vertex2, i.ComputeAABB_s_v2); + I.MinV(n, r, t.lowerBound), + I.MaxV(n, r, t.upperBound); + var s = this.m_radius; + t.lowerBound.SelfSubXY(s, s), + t.upperBound.SelfAddXY(s, s) + } + , + i.prototype.ComputeMass = function(t) { + t.mass = 0, + I.MidVV(this.m_vertex1, this.m_vertex2, t.center), + t.I = 0 + } + , + i.prototype.SetupDistanceProxy = function(t) { + t.m_vertices = t.m_buffer, + t.m_vertices[0].Copy(this.m_vertex1), + t.m_vertices[1].Copy(this.m_vertex2), + t.m_count = 2, + t.m_radius = this.m_radius + } + , + i.prototype.ComputeSubmergedArea = function(t, e, i, n) { + return n.SetZero(), + 0 + } + , + i.prototype.Dump = function(t) { + t(" const shape: b2EdgeShape = new b2EdgeShape();\n"), + t(" shape.m_radius = %.15f;\n", this.m_radius), + t(" shape.m_vertex0.Set(%.15f, %.15f);\n", this.m_vertex0.x, this.m_vertex0.y), + t(" shape.m_vertex1.Set(%.15f, %.15f);\n", this.m_vertex1.x, this.m_vertex1.y), + t(" shape.m_vertex2.Set(%.15f, %.15f);\n", this.m_vertex2.x, this.m_vertex2.y), + t(" shape.m_vertex3.Set(%.15f, %.15f);\n", this.m_vertex3.x, this.m_vertex3.y), + t(" shape.m_hasVertex0 = %s;\n", this.m_hasVertex0), + t(" shape.m_hasVertex3 = %s;\n", this.m_hasVertex3) + } + , + i.ComputeDistance_s_v1 = new I, + i.ComputeDistance_s_v2 = new I, + i.ComputeDistance_s_d = new I, + i.ComputeDistance_s_s = new I, + i.RayCast_s_p1 = new I, + i.RayCast_s_p2 = new I, + i.RayCast_s_d = new I, + i.RayCast_s_e = new I, + i.RayCast_s_q = new I, + i.RayCast_s_r = new I, + i.ComputeAABB_s_v1 = new I, + i.ComputeAABB_s_v2 = new I, + i + } + )(Qe), si = (function(e) { + function i() { + var i = e.call(this, t.b2ShapeType.e_chainShape, c) || this; + return i.m_vertices = [], + i.m_count = 0, + i.m_prevVertex = new I, + i.m_nextVertex = new I, + i.m_hasPrevVertex = !1, + i.m_hasNextVertex = !1, + i + } + return ti(i, e), + i.prototype.CreateLoop = function(t, e, i) { + if (void 0 === e && (e = t.length), + void 0 === i && (i = 0), + e < 3) + return this; + this.m_count = e + 1, + this.m_vertices = I.MakeArray(this.m_count); + for (var n = 0; n < e; ++n) + this.m_vertices[n].Copy(t[i + n]); + return this.m_vertices[e].Copy(this.m_vertices[0]), + this.m_prevVertex.Copy(this.m_vertices[this.m_count - 2]), + this.m_nextVertex.Copy(this.m_vertices[1]), + this.m_hasPrevVertex = !0, + this.m_hasNextVertex = !0, + this + } + , + i.prototype.CreateChain = function(t, e, i) { + void 0 === e && (e = t.length), + void 0 === i && (i = 0), + this.m_count = e, + this.m_vertices = I.MakeArray(e); + for (var n = 0; n < e; ++n) + this.m_vertices[n].Copy(t[i + n]); + return this.m_hasPrevVertex = !1, + this.m_hasNextVertex = !1, + this.m_prevVertex.SetZero(), + this.m_nextVertex.SetZero(), + this + } + , + i.prototype.SetPrevVertex = function(t) { + return this.m_prevVertex.Copy(t), + this.m_hasPrevVertex = !0, + this + } + , + i.prototype.SetNextVertex = function(t) { + return this.m_nextVertex.Copy(t), + this.m_hasNextVertex = !0, + this + } + , + i.prototype.Clone = function() { + return (new i).Copy(this) + } + , + i.prototype.Copy = function(t) { + return e.prototype.Copy.call(this, t), + this.CreateChain(t.m_vertices, t.m_count), + this.m_prevVertex.Copy(t.m_prevVertex), + this.m_nextVertex.Copy(t.m_nextVertex), + this.m_hasPrevVertex = t.m_hasPrevVertex, + this.m_hasNextVertex = t.m_hasNextVertex, + this + } + , + i.prototype.GetChildCount = function() { + return this.m_count - 1 + } + , + i.prototype.GetChildEdge = function(e, i) { + e.m_type = t.b2ShapeType.e_edgeShape, + e.m_radius = this.m_radius, + e.m_vertex1.Copy(this.m_vertices[i]), + e.m_vertex2.Copy(this.m_vertices[i + 1]), + i > 0 ? (e.m_vertex0.Copy(this.m_vertices[i - 1]), + e.m_hasVertex0 = !0) : (e.m_vertex0.Copy(this.m_prevVertex), + e.m_hasVertex0 = this.m_hasPrevVertex), + i < this.m_count - 2 ? (e.m_vertex3.Copy(this.m_vertices[i + 2]), + e.m_hasVertex3 = !0) : (e.m_vertex3.Copy(this.m_nextVertex), + e.m_hasVertex3 = this.m_hasNextVertex) + } + , + i.prototype.TestPoint = function() { + return !1 + } + , + i.prototype.ComputeDistance = function(t, e, n, r) { + var s = i.ComputeDistance_s_edgeShape; + return this.GetChildEdge(s, r), + s.ComputeDistance(t, e, n, 0) + } + , + i.prototype.RayCast = function(t, e, n, r) { + var s = i.RayCast_s_edgeShape; + return s.m_vertex1.Copy(this.m_vertices[r]), + s.m_vertex2.Copy(this.m_vertices[(r + 1) % this.m_count]), + s.RayCast(t, e, n, 0) + } + , + i.prototype.ComputeAABB = function(t, e, n) { + var r = this.m_vertices[n] + , s = this.m_vertices[(n + 1) % this.m_count] + , a = V.MulXV(e, r, i.ComputeAABB_s_v1) + , o = V.MulXV(e, s, i.ComputeAABB_s_v2); + I.MinV(a, o, t.lowerBound), + I.MaxV(a, o, t.upperBound) + } + , + i.prototype.ComputeMass = function(t) { + t.mass = 0, + t.center.SetZero(), + t.I = 0 + } + , + i.prototype.SetupDistanceProxy = function(t, e) { + t.m_vertices = t.m_buffer, + t.m_vertices[0].Copy(this.m_vertices[e]), + e + 1 < this.m_count ? t.m_vertices[1].Copy(this.m_vertices[e + 1]) : t.m_vertices[1].Copy(this.m_vertices[0]), + t.m_count = 2, + t.m_radius = this.m_radius + } + , + i.prototype.ComputeSubmergedArea = function(t, e, i, n) { + return n.SetZero(), + 0 + } + , + i.prototype.Dump = function(t) { + t(" const shape: b2ChainShape = new b2ChainShape();\n"), + t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n", o); + for (var e = 0; e < this.m_count; ++e) + t(" vs[%d].Set(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y); + t(" shape.CreateChain(vs, %d);\n", this.m_count), + t(" shape.m_prevVertex.Set(%.15f, %.15f);\n", this.m_prevVertex.x, this.m_prevVertex.y), + t(" shape.m_nextVertex.Set(%.15f, %.15f);\n", this.m_nextVertex.x, this.m_nextVertex.y), + t(" shape.m_hasPrevVertex = %s;\n", this.m_hasPrevVertex ? "true" : "false"), + t(" shape.m_hasNextVertex = %s;\n", this.m_hasNextVertex ? "true" : "false") + } + , + i.ComputeDistance_s_edgeShape = new ri, + i.RayCast_s_edgeShape = new ri, + i.ComputeAABB_s_v1 = new I, + i.ComputeAABB_s_v2 = new I, + i + } + )(Qe), ai = (function() { + function t() { + this.categoryBits = 1, + this.maskBits = 65535, + this.groupIndex = 0 + } + return t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t.prototype.Copy = function(t) { + return this.categoryBits = t.categoryBits, + this.maskBits = t.maskBits, + this.groupIndex = t.groupIndex || 0, + this + } + , + t.DEFAULT = new t, + t + } + )(), oi = function() { + this.userData = null, + this.friction = .2, + this.restitution = 0, + this.density = 0, + this.isSensor = !1, + this.filter = new ai + }, li = function(t) { + this.aabb = new Tt, + this.childIndex = 0, + this.fixture = t + }, hi = (function() { + function t(t, e) { + this.m_density = 0, + this.m_next = null, + this.m_friction = 0, + this.m_restitution = 0, + this.m_proxies = [], + this.m_proxyCount = 0, + this.m_filter = new ai, + this.m_isSensor = !1, + this.m_userData = null, + this.m_body = e, + this.m_shape = t.shape.Clone() + } + return t.prototype.GetType = function() { + return this.m_shape.GetType() + } + , + t.prototype.GetShape = function() { + return this.m_shape + } + , + t.prototype.SetSensor = function(t) { + t !== this.m_isSensor && (this.m_body.SetAwake(!0), + this.m_isSensor = t) + } + , + t.prototype.IsSensor = function() { + return this.m_isSensor + } + , + t.prototype.SetFilterData = function(t) { + this.m_filter.Copy(t), + this.Refilter() + } + , + t.prototype.GetFilterData = function() { + return this.m_filter + } + , + t.prototype.Refilter = function() { + for (var t = this.m_body.GetContactList(); t; ) { + var e = t.contact + , i = e.GetFixtureA() + , n = e.GetFixtureB(); + i !== this && n !== this || e.FlagForFiltering(), + t = t.next + } + var r = this.m_body.GetWorld(); + if (null !== r) + for (var s = r.m_contactManager.m_broadPhase, a = 0; a < this.m_proxyCount; ++a) + s.TouchProxy(this.m_proxies[a].treeNode) + } + , + t.prototype.GetBody = function() { + return this.m_body + } + , + t.prototype.GetNext = function() { + return this.m_next + } + , + t.prototype.GetUserData = function() { + return this.m_userData + } + , + t.prototype.SetUserData = function(t) { + this.m_userData = t + } + , + t.prototype.TestPoint = function(t) { + return this.m_shape.TestPoint(this.m_body.GetTransform(), t) + } + , + t.prototype.ComputeDistance = function(t, e, i) { + return this.m_shape.ComputeDistance(this.m_body.GetTransform(), t, e, i) + } + , + t.prototype.RayCast = function(t, e, i) { + return this.m_shape.RayCast(t, e, this.m_body.GetTransform(), i) + } + , + t.prototype.GetMassData = function(t) { + return void 0 === t && (t = new Ke), + this.m_shape.ComputeMass(t, this.m_density), + t + } + , + t.prototype.SetDensity = function(t) { + this.m_density = t + } + , + t.prototype.GetDensity = function() { + return this.m_density + } + , + t.prototype.GetFriction = function() { + return this.m_friction + } + , + t.prototype.SetFriction = function(t) { + this.m_friction = t + } + , + t.prototype.GetRestitution = function() { + return this.m_restitution + } + , + t.prototype.SetRestitution = function(t) { + this.m_restitution = t + } + , + t.prototype.GetAABB = function(t) { + return this.m_proxies[t].aabb + } + , + t.prototype.Dump = function(t, e) { + t(" const fd: b2FixtureDef = new b2FixtureDef();\n"), + t(" fd.friction = %.15f;\n", this.m_friction), + t(" fd.restitution = %.15f;\n", this.m_restitution), + t(" fd.density = %.15f;\n", this.m_density), + t(" fd.isSensor = %s;\n", this.m_isSensor ? "true" : "false"), + t(" fd.filter.categoryBits = %d;\n", this.m_filter.categoryBits), + t(" fd.filter.maskBits = %d;\n", this.m_filter.maskBits), + t(" fd.filter.groupIndex = %d;\n", this.m_filter.groupIndex), + this.m_shape.Dump(t), + t("\n"), + t(" fd.shape = shape;\n"), + t("\n"), + t(" bodies[%d].CreateFixture(fd);\n", e) + } + , + t.prototype.Create = function(t) { + var i = this; + this.m_userData = t.userData, + this.m_friction = e(t.friction, .2), + this.m_restitution = e(t.restitution, 0), + this.m_next = null, + this.m_filter.Copy(e(t.filter, ai.DEFAULT)), + this.m_isSensor = e(t.isSensor, !1), + this.m_proxies = d(this.m_shape.GetChildCount(), (function() { + return new li(i) + } + )), + this.m_proxyCount = 0, + this.m_density = e(t.density, 0) + } + , + t.prototype.Destroy = function() {} + , + t.prototype.CreateProxies = function(t) { + var e = this.m_body.m_world.m_contactManager.m_broadPhase; + this.m_proxyCount = this.m_shape.GetChildCount(); + for (var i = 0; i < this.m_proxyCount; ++i) { + var n = this.m_proxies[i] = new li(this); + this.m_shape.ComputeAABB(n.aabb, t, i), + n.treeNode = e.CreateProxy(n.aabb, n), + n.childIndex = i + } + } + , + t.prototype.DestroyProxies = function() { + for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = 0; e < this.m_proxyCount; ++e) { + var i = this.m_proxies[e]; + delete i.treeNode.userData, + t.DestroyProxy(i.treeNode), + delete i.treeNode + } + this.m_proxyCount = 0 + } + , + t.prototype.TouchProxies = function() { + for (var t = this.m_body.m_world.m_contactManager.m_broadPhase, e = this.m_proxyCount, i = 0; i < e; ++i) + t.TouchProxy(this.m_proxies[i].treeNode) + } + , + t.prototype.Synchronize = function(e, i) { + if (0 !== this.m_proxyCount) + for (var n = this.m_body.m_world.m_contactManager.m_broadPhase, r = 0; r < this.m_proxyCount; ++r) { + var s = this.m_proxies[r] + , a = t.Synchronize_s_aabb1 + , o = t.Synchronize_s_aabb2; + this.m_shape.ComputeAABB(a, e, r), + this.m_shape.ComputeAABB(o, i, r), + s.aabb.Combine2(a, o); + var l = I.SubVV(i.p, e.p, t.Synchronize_s_displacement); + n.MoveProxy(s.treeNode, s.aabb, l) + } + } + , + t.Synchronize_s_aabb1 = new Tt, + t.Synchronize_s_aabb2 = new Tt, + t.Synchronize_s_displacement = new I, + t + } + )(); + (ei = t.b2BodyType || (t.b2BodyType = {}))[ei.b2_unknown = -1] = "b2_unknown", + ei[ei.b2_staticBody = 0] = "b2_staticBody", + ei[ei.b2_kinematicBody = 1] = "b2_kinematicBody", + ei[ei.b2_dynamicBody = 2] = "b2_dynamicBody"; + var ci, ui, _i = (function() { + function i(i, n) { + this.m_type = t.b2BodyType.b2_staticBody, + this.m_islandFlag = !1, + this.m_awakeFlag = !1, + this.m_autoSleepFlag = !1, + this.m_bulletFlag = !1, + this.m_fixedRotationFlag = !1, + this.m_activeFlag = !1, + this.m_toiFlag = !1, + this.m_islandIndex = 0, + this.m_xf = new V, + this.m_xf0 = new V, + this.m_sweep = new N, + this.m_linearVelocity = new I, + this.m_angularVelocity = 0, + this.m_force = new I, + this.m_torque = 0, + this.m_prev = null, + this.m_next = null, + this.m_fixtureList = null, + this.m_fixtureCount = 0, + this.m_jointList = null, + this.m_contactList = null, + this.m_mass = 1, + this.m_invMass = 1, + this.m_I = 0, + this.m_invI = 0, + this.m_linearDamping = 0, + this.m_angularDamping = 0, + this.m_gravityScale = 1, + this.m_sleepTime = 0, + this.m_userData = null, + this.m_controllerList = null, + this.m_controllerCount = 0, + this.m_bulletFlag = e(i.bullet, !1), + this.m_fixedRotationFlag = e(i.fixedRotation, !1), + this.m_autoSleepFlag = e(i.allowSleep, !0), + this.m_awakeFlag = e(i.awake, !0), + this.m_activeFlag = e(i.active, !0), + this.m_world = n, + this.m_xf.p.Copy(e(i.position, I.ZERO)), + this.m_xf.q.SetAngle(e(i.angle, 0)), + this.m_xf0.Copy(this.m_xf), + this.m_sweep.localCenter.SetZero(), + this.m_sweep.c0.Copy(this.m_xf.p), + this.m_sweep.c.Copy(this.m_xf.p), + this.m_sweep.a0 = this.m_sweep.a = this.m_xf.q.GetAngle(), + this.m_sweep.alpha0 = 0, + this.m_linearVelocity.Copy(e(i.linearVelocity, I.ZERO)), + this.m_angularVelocity = e(i.angularVelocity, 0), + this.m_linearDamping = e(i.linearDamping, 0), + this.m_angularDamping = e(i.angularDamping, 0), + this.m_gravityScale = e(i.gravityScale, 1), + this.m_force.SetZero(), + this.m_torque = 0, + this.m_sleepTime = 0, + this.m_type = e(i.type, t.b2BodyType.b2_staticBody), + i.type === t.b2BodyType.b2_dynamicBody ? (this.m_mass = 1, + this.m_invMass = 1) : (this.m_mass = 0, + this.m_invMass = 0), + this.m_I = 0, + this.m_invI = 0, + this.m_userData = i.userData, + this.m_fixtureList = null, + this.m_fixtureCount = 0, + this.m_controllerList = null, + this.m_controllerCount = 0 + } + return i.prototype.CreateFixture = function(t, e) { + return void 0 === e && (e = 0), + t instanceof Qe ? this.CreateFixtureShapeDensity(t, e) : this.CreateFixtureDef(t) + } + , + i.prototype.CreateFixtureDef = function(t) { + if (this.m_world.IsLocked()) + throw new Error; + var e = new hi(t,this); + return e.Create(t), + this.m_activeFlag && e.CreateProxies(this.m_xf), + e.m_next = this.m_fixtureList, + this.m_fixtureList = e, + ++this.m_fixtureCount, + e.m_density > 0 && this.ResetMassData(), + this.m_world.m_newFixture = !0, + e + } + , + i.prototype.CreateFixtureShapeDensity = function(t, e) { + void 0 === e && (e = 0); + var n = i.CreateFixtureShapeDensity_s_def; + return n.shape = t, + n.density = e, + this.CreateFixtureDef(n) + } + , + i.prototype.DestroyFixture = function(t) { + if (this.m_world.IsLocked()) + throw new Error; + for (var e = this.m_fixtureList, i = null; null !== e; ) { + if (e === t) { + i ? i.m_next = t.m_next : this.m_fixtureList = t.m_next; + break + } + i = e, + e = e.m_next + } + for (var n = this.m_contactList; n; ) { + var r = n.contact; + n = n.next; + var s = r.GetFixtureA() + , a = r.GetFixtureB(); + t !== s && t !== a || this.m_world.m_contactManager.Destroy(r) + } + this.m_activeFlag && t.DestroyProxies(), + t.m_next = null, + t.Destroy(), + --this.m_fixtureCount, + this.ResetMassData() + } + , + i.prototype.SetTransformVec = function(t, e) { + this.SetTransformXY(t.x, t.y, e) + } + , + i.prototype.SetTransformXY = function(t, e, i) { + if (this.m_world.IsLocked()) + throw new Error; + this.m_xf.q.SetAngle(i), + this.m_xf.p.Set(t, e), + this.m_xf0.Copy(this.m_xf), + V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), + this.m_sweep.a = i, + this.m_sweep.c0.Copy(this.m_sweep.c), + this.m_sweep.a0 = i; + for (var n = this.m_fixtureList; n; n = n.m_next) + n.Synchronize(this.m_xf, this.m_xf); + this.m_world.m_contactManager.FindNewContacts() + } + , + i.prototype.SetTransform = function(t) { + this.SetTransformVec(t.p, t.GetAngle()) + } + , + i.prototype.GetTransform = function() { + return this.m_xf + } + , + i.prototype.GetPosition = function() { + return this.m_xf.p + } + , + i.prototype.SetPosition = function(t) { + this.SetTransformVec(t, this.GetAngle()) + } + , + i.prototype.SetPositionXY = function(t, e) { + this.SetTransformXY(t, e, this.GetAngle()) + } + , + i.prototype.GetAngle = function() { + return this.m_sweep.a + } + , + i.prototype.SetAngle = function(t) { + this.SetTransformVec(this.GetPosition(), t) + } + , + i.prototype.GetWorldCenter = function() { + return this.m_sweep.c + } + , + i.prototype.GetLocalCenter = function() { + return this.m_sweep.localCenter + } + , + i.prototype.SetLinearVelocity = function(e) { + this.m_type !== t.b2BodyType.b2_staticBody && (I.DotVV(e, e) > 0 && this.SetAwake(!0), + this.m_linearVelocity.Copy(e)) + } + , + i.prototype.GetLinearVelocity = function() { + return this.m_linearVelocity + } + , + i.prototype.SetAngularVelocity = function(e) { + this.m_type !== t.b2BodyType.b2_staticBody && (e * e > 0 && this.SetAwake(!0), + this.m_angularVelocity = e) + } + , + i.prototype.GetAngularVelocity = function() { + return this.m_angularVelocity + } + , + i.prototype.GetDefinition = function(t) { + return t.type = this.GetType(), + t.allowSleep = this.m_autoSleepFlag, + t.angle = this.GetAngle(), + t.angularDamping = this.m_angularDamping, + t.gravityScale = this.m_gravityScale, + t.angularVelocity = this.m_angularVelocity, + t.fixedRotation = this.m_fixedRotationFlag, + t.bullet = this.m_bulletFlag, + t.awake = this.m_awakeFlag, + t.linearDamping = this.m_linearDamping, + t.linearVelocity.Copy(this.GetLinearVelocity()), + t.position.Copy(this.GetPosition()), + t.userData = this.GetUserData(), + t + } + , + i.prototype.ApplyForce = function(e, i, n) { + void 0 === n && (n = !0), + this.m_type === t.b2BodyType.b2_dynamicBody && (n && !this.m_awakeFlag && this.SetAwake(!0), + this.m_awakeFlag && (this.m_force.x += e.x, + this.m_force.y += e.y, + this.m_torque += (i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x)) + } + , + i.prototype.ApplyForceToCenter = function(e, i) { + void 0 === i && (i = !0), + this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), + this.m_awakeFlag && (this.m_force.x += e.x, + this.m_force.y += e.y)) + } + , + i.prototype.ApplyTorque = function(e, i) { + void 0 === i && (i = !0), + this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), + this.m_awakeFlag && (this.m_torque += e)) + } + , + i.prototype.ApplyLinearImpulse = function(e, i, n) { + void 0 === n && (n = !0), + this.m_type === t.b2BodyType.b2_dynamicBody && (n && !this.m_awakeFlag && this.SetAwake(!0), + this.m_awakeFlag && (this.m_linearVelocity.x += this.m_invMass * e.x, + this.m_linearVelocity.y += this.m_invMass * e.y, + this.m_angularVelocity += this.m_invI * ((i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x))) + } + , + i.prototype.ApplyLinearImpulseToCenter = function(e, i) { + void 0 === i && (i = !0), + this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), + this.m_awakeFlag && (this.m_linearVelocity.x += this.m_invMass * e.x, + this.m_linearVelocity.y += this.m_invMass * e.y)) + } + , + i.prototype.ApplyAngularImpulse = function(e, i) { + void 0 === i && (i = !0), + this.m_type === t.b2BodyType.b2_dynamicBody && (i && !this.m_awakeFlag && this.SetAwake(!0), + this.m_awakeFlag && (this.m_angularVelocity += this.m_invI * e)) + } + , + i.prototype.GetMass = function() { + return this.m_mass + } + , + i.prototype.GetInertia = function() { + return this.m_I + this.m_mass * I.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter) + } + , + i.prototype.GetMassData = function(t) { + return t.mass = this.m_mass, + t.I = this.m_I + this.m_mass * I.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter), + t.center.Copy(this.m_sweep.localCenter), + t + } + , + i.prototype.SetMassData = function(e) { + if (this.m_world.IsLocked()) + throw new Error; + if (this.m_type === t.b2BodyType.b2_dynamicBody) { + this.m_invMass = 0, + this.m_I = 0, + this.m_invI = 0, + this.m_mass = e.mass, + this.m_mass <= 0 && (this.m_mass = 1), + this.m_invMass = 1 / this.m_mass, + e.I > 0 && !this.m_fixedRotationFlag && (this.m_I = e.I - this.m_mass * I.DotVV(e.center, e.center), + this.m_invI = 1 / this.m_I); + var n = i.SetMassData_s_oldCenter.Copy(this.m_sweep.c); + this.m_sweep.localCenter.Copy(e.center), + V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), + this.m_sweep.c0.Copy(this.m_sweep.c), + I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(this.m_sweep.c, n, I.s_t0), this.m_linearVelocity) + } + } + , + i.prototype.ResetMassData = function() { + if (this.m_mass = 0, + this.m_invMass = 0, + this.m_I = 0, + this.m_invI = 0, + this.m_sweep.localCenter.SetZero(), + this.m_type === t.b2BodyType.b2_staticBody || this.m_type === t.b2BodyType.b2_kinematicBody) + return this.m_sweep.c0.Copy(this.m_xf.p), + this.m_sweep.c.Copy(this.m_xf.p), + void (this.m_sweep.a0 = this.m_sweep.a); + for (var e = i.ResetMassData_s_localCenter.SetZero(), n = this.m_fixtureList; n; n = n.m_next) + if (0 !== n.m_density) { + var r = n.GetMassData(i.ResetMassData_s_massData); + this.m_mass += r.mass, + e.x += r.center.x * r.mass, + e.y += r.center.y * r.mass, + this.m_I += r.I + } + this.m_mass > 0 ? (this.m_invMass = 1 / this.m_mass, + e.x *= this.m_invMass, + e.y *= this.m_invMass) : (this.m_mass = 1, + this.m_invMass = 1), + this.m_I > 0 && !this.m_fixedRotationFlag ? (this.m_I -= this.m_mass * I.DotVV(e, e), + this.m_invI = 1 / this.m_I) : (this.m_I = 0, + this.m_invI = 0); + var s = i.ResetMassData_s_oldCenter.Copy(this.m_sweep.c); + this.m_sweep.localCenter.Copy(e), + V.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c), + this.m_sweep.c0.Copy(this.m_sweep.c), + I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(this.m_sweep.c, s, I.s_t0), this.m_linearVelocity) + } + , + i.prototype.GetWorldPoint = function(t, e) { + return V.MulXV(this.m_xf, t, e) + } + , + i.prototype.GetWorldVector = function(t, e) { + return F.MulRV(this.m_xf.q, t, e) + } + , + i.prototype.GetLocalPoint = function(t, e) { + return V.MulTXV(this.m_xf, t, e) + } + , + i.prototype.GetLocalVector = function(t, e) { + return F.MulTRV(this.m_xf.q, t, e) + } + , + i.prototype.GetLinearVelocityFromWorldPoint = function(t, e) { + return I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(t, this.m_sweep.c, I.s_t0), e) + } + , + i.prototype.GetLinearVelocityFromLocalPoint = function(t, e) { + return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t, e), e) + } + , + i.prototype.GetLinearDamping = function() { + return this.m_linearDamping + } + , + i.prototype.SetLinearDamping = function(t) { + this.m_linearDamping = t + } + , + i.prototype.GetAngularDamping = function() { + return this.m_angularDamping + } + , + i.prototype.SetAngularDamping = function(t) { + this.m_angularDamping = t + } + , + i.prototype.GetGravityScale = function() { + return this.m_gravityScale + } + , + i.prototype.SetGravityScale = function(t) { + this.m_gravityScale = t + } + , + i.prototype.SetType = function(e) { + if (this.m_world.IsLocked()) + throw new Error; + if (this.m_type !== e) { + this.m_type = e, + this.ResetMassData(), + this.m_type === t.b2BodyType.b2_staticBody && (this.m_linearVelocity.SetZero(), + this.m_angularVelocity = 0, + this.m_sweep.a0 = this.m_sweep.a, + this.m_sweep.c0.Copy(this.m_sweep.c), + this.SynchronizeFixtures()), + this.SetAwake(!0), + this.m_force.SetZero(), + this.m_torque = 0; + for (var i = this.m_contactList; i; ) { + var n = i; + i = i.next, + this.m_world.m_contactManager.Destroy(n.contact) + } + this.m_contactList = null; + for (var r = this.m_fixtureList; r; r = r.m_next) + r.TouchProxies() + } + } + , + i.prototype.GetType = function() { + return this.m_type + } + , + i.prototype.SetBullet = function(t) { + this.m_bulletFlag = t + } + , + i.prototype.IsBullet = function() { + return this.m_bulletFlag + } + , + i.prototype.SetSleepingAllowed = function(t) { + this.m_autoSleepFlag = t, + t || this.SetAwake(!0) + } + , + i.prototype.IsSleepingAllowed = function() { + return this.m_autoSleepFlag + } + , + i.prototype.SetAwake = function(t) { + t ? (this.m_awakeFlag = !0, + this.m_sleepTime = 0) : (this.m_awakeFlag = !1, + this.m_sleepTime = 0, + this.m_linearVelocity.SetZero(), + this.m_angularVelocity = 0, + this.m_force.SetZero(), + this.m_torque = 0) + } + , + i.prototype.IsAwake = function() { + return this.m_awakeFlag + } + , + i.prototype.SetActive = function(t) { + if (this.m_world.IsLocked()) + throw new Error; + if (t !== this.IsActive()) + if (this.m_activeFlag = t, + t) + for (var e = this.m_fixtureList; e; e = e.m_next) + e.CreateProxies(this.m_xf); + else { + for (e = this.m_fixtureList; e; e = e.m_next) + e.DestroyProxies(); + for (var i = this.m_contactList; i; ) { + var n = i; + i = i.next, + this.m_world.m_contactManager.Destroy(n.contact) + } + this.m_contactList = null + } + } + , + i.prototype.IsActive = function() { + return this.m_activeFlag + } + , + i.prototype.SetFixedRotation = function(t) { + this.m_fixedRotationFlag !== t && (this.m_fixedRotationFlag = t, + this.m_angularVelocity = 0, + this.ResetMassData()) + } + , + i.prototype.IsFixedRotation = function() { + return this.m_fixedRotationFlag + } + , + i.prototype.GetFixtureList = function() { + return this.m_fixtureList + } + , + i.prototype.GetJointList = function() { + return this.m_jointList + } + , + i.prototype.GetContactList = function() { + return this.m_contactList + } + , + i.prototype.GetNext = function() { + return this.m_next + } + , + i.prototype.GetUserData = function() { + return this.m_userData + } + , + i.prototype.SetUserData = function(t) { + this.m_userData = t + } + , + i.prototype.GetWorld = function() { + return this.m_world + } + , + i.prototype.Dump = function(e) { + var i = this.m_islandIndex; + e("{\n"), + e(" const bd: b2BodyDef = new b2BodyDef();\n"); + var n = ""; + switch (this.m_type) { + case t.b2BodyType.b2_staticBody: + n = "b2BodyType.b2_staticBody"; + break; + case t.b2BodyType.b2_kinematicBody: + n = "b2BodyType.b2_kinematicBody"; + break; + case t.b2BodyType.b2_dynamicBody: + n = "b2BodyType.b2_dynamicBody" + } + e(" bd.type = %s;\n", n), + e(" bd.position.Set(%.15f, %.15f);\n", this.m_xf.p.x, this.m_xf.p.y), + e(" bd.angle = %.15f;\n", this.m_sweep.a), + e(" bd.linearVelocity.Set(%.15f, %.15f);\n", this.m_linearVelocity.x, this.m_linearVelocity.y), + e(" bd.angularVelocity = %.15f;\n", this.m_angularVelocity), + e(" bd.linearDamping = %.15f;\n", this.m_linearDamping), + e(" bd.angularDamping = %.15f;\n", this.m_angularDamping), + e(" bd.allowSleep = %s;\n", this.m_autoSleepFlag ? "true" : "false"), + e(" bd.awake = %s;\n", this.m_awakeFlag ? "true" : "false"), + e(" bd.fixedRotation = %s;\n", this.m_fixedRotationFlag ? "true" : "false"), + e(" bd.bullet = %s;\n", this.m_bulletFlag ? "true" : "false"), + e(" bd.active = %s;\n", this.m_activeFlag ? "true" : "false"), + e(" bd.gravityScale = %.15f;\n", this.m_gravityScale), + e("\n"), + e(" bodies[%d] = this.m_world.CreateBody(bd);\n", this.m_islandIndex), + e("\n"); + for (var r = this.m_fixtureList; r; r = r.m_next) + e(" {\n"), + r.Dump(e, i), + e(" }\n"); + e("}\n") + } + , + i.prototype.SynchronizeFixtures = function() { + var t = i.SynchronizeFixtures_s_xf1; + t.q.SetAngle(this.m_sweep.a0), + F.MulRV(t.q, this.m_sweep.localCenter, t.p), + I.SubVV(this.m_sweep.c0, t.p, t.p); + for (var e = this.m_fixtureList; e; e = e.m_next) + e.Synchronize(t, this.m_xf) + } + , + i.prototype.SynchronizeTransform = function() { + this.m_xf.q.SetAngle(this.m_sweep.a), + F.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p), + I.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p) + } + , + i.prototype.ShouldCollide = function(e) { + return (this.m_type !== t.b2BodyType.b2_staticBody || e.m_type !== t.b2BodyType.b2_staticBody) && this.ShouldCollideConnected(e) + } + , + i.prototype.ShouldCollideConnected = function(t) { + for (var e = this.m_jointList; e; e = e.next) + if (e.other === t && !e.joint.m_collideConnected) + return !1; + return !0 + } + , + i.prototype.Advance = function(t) { + this.m_sweep.Advance(t), + this.m_sweep.c.Copy(this.m_sweep.c0), + this.m_sweep.a = this.m_sweep.a0, + this.m_xf.q.SetAngle(this.m_sweep.a), + F.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p), + I.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p) + } + , + i.prototype.GetControllerList = function() { + return this.m_controllerList + } + , + i.prototype.GetControllerCount = function() { + return this.m_controllerCount + } + , + i.CreateFixtureShapeDensity_s_def = new oi, + i.SetMassData_s_oldCenter = new I, + i.ResetMassData_s_localCenter = new I, + i.ResetMassData_s_oldCenter = new I, + i.ResetMassData_s_massData = new Ke, + i.SynchronizeFixtures_s_xf1 = new V, + i + } + )(); + (ci = t.b2JointType || (t.b2JointType = {}))[ci.e_unknownJoint = 0] = "e_unknownJoint", + ci[ci.e_revoluteJoint = 1] = "e_revoluteJoint", + ci[ci.e_prismaticJoint = 2] = "e_prismaticJoint", + ci[ci.e_distanceJoint = 3] = "e_distanceJoint", + ci[ci.e_pulleyJoint = 4] = "e_pulleyJoint", + ci[ci.e_mouseJoint = 5] = "e_mouseJoint", + ci[ci.e_gearJoint = 6] = "e_gearJoint", + ci[ci.e_wheelJoint = 7] = "e_wheelJoint", + ci[ci.e_weldJoint = 8] = "e_weldJoint", + ci[ci.e_frictionJoint = 9] = "e_frictionJoint", + ci[ci.e_ropeJoint = 10] = "e_ropeJoint", + ci[ci.e_motorJoint = 11] = "e_motorJoint", + ci[ci.e_areaJoint = 12] = "e_areaJoint", + (ui = t.b2LimitState || (t.b2LimitState = {}))[ui.e_inactiveLimit = 0] = "e_inactiveLimit", + ui[ui.e_atLowerLimit = 1] = "e_atLowerLimit", + ui[ui.e_atUpperLimit = 2] = "e_atUpperLimit", + ui[ui.e_equalLimits = 3] = "e_equalLimits"; + var fi = (function() { + function t() { + this.linear = new I, + this.angularA = 0, + this.angularB = 0 + } + return t.prototype.SetZero = function() { + return this.linear.SetZero(), + this.angularA = 0, + this.angularB = 0, + this + } + , + t.prototype.Set = function(t, e, i) { + return this.linear.Copy(t), + this.angularA = e, + this.angularB = i, + this + } + , + t + } + )() + , di = function(t, e) { + this.prev = null, + this.next = null, + this.joint = t, + this.other = e + } + , pi = function(e) { + this.type = t.b2JointType.e_unknownJoint, + this.userData = null, + this.collideConnected = !1, + this.type = e + } + , mi = (function() { + function i(i) { + this.m_type = t.b2JointType.e_unknownJoint, + this.m_prev = null, + this.m_next = null, + this.m_index = 0, + this.m_islandFlag = !1, + this.m_collideConnected = !1, + this.m_userData = null, + this.m_type = i.type, + this.m_edgeA = new di(this,i.bodyB), + this.m_edgeB = new di(this,i.bodyA), + this.m_bodyA = i.bodyA, + this.m_bodyB = i.bodyB, + this.m_collideConnected = e(i.collideConnected, !1), + this.m_userData = i.userData + } + return i.prototype.GetType = function() { + return this.m_type + } + , + i.prototype.GetBodyA = function() { + return this.m_bodyA + } + , + i.prototype.GetBodyB = function() { + return this.m_bodyB + } + , + i.prototype.GetNext = function() { + return this.m_next + } + , + i.prototype.GetUserData = function() { + return this.m_userData + } + , + i.prototype.SetUserData = function(t) { + this.m_userData = t + } + , + i.prototype.IsActive = function() { + return this.m_bodyA.IsActive() && this.m_bodyB.IsActive() + } + , + i.prototype.GetCollideConnected = function() { + return this.m_collideConnected + } + , + i.prototype.Dump = function(t) { + t("// Dump is not supported for this joint type.\n") + } + , + i.prototype.ShiftOrigin = function() {} + , + i + } + )() + , yi = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_distanceJoint) || this; + return i.localAnchorA = new I, + i.localAnchorB = new I, + i.length = 1, + i.frequencyHz = 0, + i.dampingRatio = 0, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e, i, n) { + this.bodyA = t, + this.bodyB = e, + this.bodyA.GetLocalPoint(i, this.localAnchorA), + this.bodyB.GetLocalPoint(n, this.localAnchorB), + this.length = I.DistanceVV(i, n), + this.frequencyHz = 0, + this.dampingRatio = 0 + } + , + i + } + )(pi) + , vi = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + return n.m_frequencyHz = 0, + n.m_dampingRatio = 0, + n.m_bias = 0, + n.m_localAnchorA = new I, + n.m_localAnchorB = new I, + n.m_gamma = 0, + n.m_impulse = 0, + n.m_length = 0, + n.m_indexA = 0, + n.m_indexB = 0, + n.m_u = new I, + n.m_rA = new I, + n.m_rB = new I, + n.m_localCenterA = new I, + n.m_localCenterB = new I, + n.m_invMassA = 0, + n.m_invMassB = 0, + n.m_invIA = 0, + n.m_invIB = 0, + n.m_mass = 0, + n.m_qA = new F, + n.m_qB = new F, + n.m_lalcA = new I, + n.m_lalcB = new I, + n.m_frequencyHz = e(i.frequencyHz, 0), + n.m_dampingRatio = e(i.dampingRatio, 0), + n.m_localAnchorA.Copy(i.localAnchorA), + n.m_localAnchorB.Copy(i.localAnchorB), + n.m_length = i.length, + n + } + return ti(i, t), + i.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + i.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + i.prototype.GetReactionForce = function(t, e) { + return e.x = t * this.m_impulse * this.m_u.x, + e.y = t * this.m_impulse * this.m_u.y, + e + } + , + i.prototype.GetReactionTorque = function() { + return 0 + } + , + i.prototype.GetLocalAnchorA = function() { + return this.m_localAnchorA + } + , + i.prototype.GetLocalAnchorB = function() { + return this.m_localAnchorB + } + , + i.prototype.SetLength = function(t) { + this.m_length = t + } + , + i.prototype.Length = function() { + return this.m_length + } + , + i.prototype.SetFrequency = function(t) { + this.m_frequencyHz = t + } + , + i.prototype.GetFrequency = function() { + return this.m_frequencyHz + } + , + i.prototype.SetDampingRatio = function(t) { + this.m_dampingRatio = t + } + , + i.prototype.GetDampingRatio = function() { + return this.m_dampingRatio + } + , + i.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.length = %.15f;\n", this.m_length), + t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), + t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + i.prototype.InitVelocityConstraints = function(t) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var e = t.positions[this.m_indexA].c + , n = t.positions[this.m_indexA].a + , r = t.velocities[this.m_indexA].v + , a = t.velocities[this.m_indexA].w + , o = t.positions[this.m_indexB].c + , h = t.positions[this.m_indexB].a + , c = t.velocities[this.m_indexB].v + , u = t.velocities[this.m_indexB].w + , _ = this.m_qA.SetAngle(n) + , f = this.m_qB.SetAngle(h); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), + F.MulRV(_, this.m_lalcA, this.m_rA), + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), + F.MulRV(f, this.m_lalcB, this.m_rB), + this.m_u.x = o.x + this.m_rB.x - e.x - this.m_rA.x, + this.m_u.y = o.y + this.m_rB.y - e.y - this.m_rA.y; + var d = this.m_u.Length(); + d > l ? this.m_u.SelfMul(1 / d) : this.m_u.SetZero(); + var p = I.CrossVV(this.m_rA, this.m_u) + , m = I.CrossVV(this.m_rB, this.m_u) + , y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m; + if (this.m_mass = 0 !== y ? 1 / y : 0, + this.m_frequencyHz > 0) { + var v = d - this.m_length + , g = 2 * s * this.m_frequencyHz + , A = 2 * this.m_mass * this.m_dampingRatio * g + , x = this.m_mass * g * g + , b = t.step.dt; + this.m_gamma = b * (A + b * x), + this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0, + this.m_bias = v * b * x * this.m_gamma, + y += this.m_gamma, + this.m_mass = 0 !== y ? 1 / y : 0 + } else + this.m_gamma = 0, + this.m_bias = 0; + if (t.step.warmStarting) { + this.m_impulse *= t.step.dtRatio; + var C = I.MulSV(this.m_impulse, this.m_u, i.InitVelocityConstraints_s_P); + r.SelfMulSub(this.m_invMassA, C), + a -= this.m_invIA * I.CrossVV(this.m_rA, C), + c.SelfMulAdd(this.m_invMassB, C), + u += this.m_invIB * I.CrossVV(this.m_rB, C) + } else + this.m_impulse = 0; + t.velocities[this.m_indexA].w = a, + t.velocities[this.m_indexB].w = u + } + , + i.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexA].v + , n = t.velocities[this.m_indexA].w + , r = t.velocities[this.m_indexB].v + , s = t.velocities[this.m_indexB].w + , a = I.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA) + , o = I.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB) + , l = I.DotVV(this.m_u, I.SubVV(o, a, I.s_t0)) + , h = -this.m_mass * (l + this.m_bias + this.m_gamma * this.m_impulse); + this.m_impulse += h; + var c = I.MulSV(h, this.m_u, i.SolveVelocityConstraints_s_P); + e.SelfMulSub(this.m_invMassA, c), + n -= this.m_invIA * I.CrossVV(this.m_rA, c), + r.SelfMulAdd(this.m_invMassB, c), + s += this.m_invIB * I.CrossVV(this.m_rB, c), + t.velocities[this.m_indexA].w = n, + t.velocities[this.m_indexB].w = s + } + , + i.prototype.SolvePositionConstraints = function(t) { + if (this.m_frequencyHz > 0) + return !0; + var e = t.positions[this.m_indexA].c + , n = t.positions[this.m_indexA].a + , r = t.positions[this.m_indexB].c + , s = t.positions[this.m_indexB].a + , a = this.m_qA.SetAngle(n) + , o = this.m_qB.SetAngle(s) + , h = F.MulRV(a, this.m_lalcA, this.m_rA) + , c = F.MulRV(o, this.m_lalcB, this.m_rB) + , u = this.m_u; + u.x = r.x + c.x - e.x - h.x, + u.y = r.y + c.y - e.y - h.y; + var _ = this.m_u.Normalize() - this.m_length; + _ = g(_, -.2, .2); + var f = -this.m_mass * _ + , d = I.MulSV(f, u, i.SolvePositionConstraints_s_P); + return e.SelfMulSub(this.m_invMassA, d), + n -= this.m_invIA * I.CrossVV(h, d), + r.SelfMulAdd(this.m_invMassB, d), + s += this.m_invIB * I.CrossVV(c, d), + t.positions[this.m_indexA].a = n, + t.positions[this.m_indexB].a = s, + m(_) < l + } + , + i.InitVelocityConstraints_s_P = new I, + i.SolveVelocityConstraints_s_vpA = new I, + i.SolveVelocityConstraints_s_vpB = new I, + i.SolveVelocityConstraints_s_P = new I, + i.SolvePositionConstraints_s_P = new I, + i + } + )(mi) + , gi = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_areaJoint) || this; + return i.bodies = [], + i.frequencyHz = 0, + i.dampingRatio = 0, + i + } + return ti(i, e), + i.prototype.AddBody = function(t) { + this.bodies.push(t), + 1 === this.bodies.length ? this.bodyA = t : 2 === this.bodies.length && (this.bodyB = t) + } + , + i + } + )(pi) + , Ai = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + n.m_frequencyHz = 0, + n.m_dampingRatio = 0, + n.m_impulse = 0, + n.m_targetArea = 0, + n.m_bodies = i.bodies, + n.m_frequencyHz = e(i.frequencyHz, 0), + n.m_dampingRatio = e(i.dampingRatio, 0), + n.m_targetLengths = p(i.bodies.length), + n.m_normals = I.MakeArray(i.bodies.length), + n.m_joints = [], + n.m_deltas = I.MakeArray(i.bodies.length), + n.m_delta = new I; + var r = new yi; + r.frequencyHz = n.m_frequencyHz, + r.dampingRatio = n.m_dampingRatio, + n.m_targetArea = 0; + for (var s = 0; s < n.m_bodies.length; ++s) { + var a = n.m_bodies[s] + , o = n.m_bodies[(s + 1) % n.m_bodies.length] + , l = a.GetWorldCenter() + , h = o.GetWorldCenter(); + n.m_targetLengths[s] = I.DistanceVV(l, h), + n.m_targetArea += I.CrossVV(l, h), + r.Initialize(a, o, l, h), + n.m_joints[s] = a.GetWorld().CreateJoint(r) + } + return n.m_targetArea *= .5, + n + } + return ti(i, t), + i.prototype.GetAnchorA = function(t) { + return t + } + , + i.prototype.GetAnchorB = function(t) { + return t + } + , + i.prototype.GetReactionForce = function(t, e) { + return e + } + , + i.prototype.GetReactionTorque = function() { + return 0 + } + , + i.prototype.SetFrequency = function(t) { + this.m_frequencyHz = t; + for (var e = 0; e < this.m_joints.length; ++e) + this.m_joints[e].SetFrequency(t) + } + , + i.prototype.GetFrequency = function() { + return this.m_frequencyHz + } + , + i.prototype.SetDampingRatio = function(t) { + this.m_dampingRatio = t; + for (var e = 0; e < this.m_joints.length; ++e) + this.m_joints[e].SetDampingRatio(t) + } + , + i.prototype.GetDampingRatio = function() { + return this.m_dampingRatio + } + , + i.prototype.Dump = function(t) { + t("Area joint dumping is not supported.\n") + } + , + i.prototype.InitVelocityConstraints = function(t) { + for (var e = 0; e < this.m_bodies.length; ++e) { + var i = this.m_bodies[(e + this.m_bodies.length - 1) % this.m_bodies.length] + , n = this.m_bodies[(e + 1) % this.m_bodies.length] + , r = t.positions[i.m_islandIndex].c + , s = t.positions[n.m_islandIndex].c + , a = this.m_deltas[e]; + I.SubVV(s, r, a) + } + if (t.step.warmStarting) + for (this.m_impulse *= t.step.dtRatio, + e = 0; e < this.m_bodies.length; ++e) { + var o = this.m_bodies[e] + , l = t.velocities[o.m_islandIndex].v; + a = this.m_deltas[e], + l.x += o.m_invMass * a.y * .5 * this.m_impulse, + l.y += o.m_invMass * -a.x * .5 * this.m_impulse + } + else + this.m_impulse = 0 + } + , + i.prototype.SolveVelocityConstraints = function(t) { + for (var e = 0, i = 0, n = 0; n < this.m_bodies.length; ++n) { + var r = this.m_bodies[n] + , s = t.velocities[r.m_islandIndex].v; + e += (o = this.m_deltas[n]).LengthSquared() / r.GetMass(), + i += I.CrossVV(s, o) + } + var a = -2 * i / e; + for (this.m_impulse += a, + n = 0; n < this.m_bodies.length; ++n) { + r = this.m_bodies[n], + s = t.velocities[r.m_islandIndex].v; + var o = this.m_deltas[n]; + s.x += r.m_invMass * o.y * .5 * a, + s.y += r.m_invMass * -o.x * .5 * a + } + } + , + i.prototype.SolvePositionConstraints = function(t) { + for (var e = 0, i = 0, r = 0; r < this.m_bodies.length; ++r) { + var s = this.m_bodies[r] + , a = this.m_bodies[(r + 1) % this.m_bodies.length] + , o = t.positions[s.m_islandIndex].c + , h = t.positions[a.m_islandIndex].c + , c = (f = I.SubVV(h, o, this.m_delta)).Length(); + c < n && (c = 1), + this.m_normals[r].x = f.y / c, + this.m_normals[r].y = -f.x / c, + e += c, + i += I.CrossVV(o, h) + } + i *= .5; + var u = .5 * (this.m_targetArea - i) / e + , _ = !0; + for (r = 0; r < this.m_bodies.length; ++r) { + s = this.m_bodies[r], + o = t.positions[s.m_islandIndex].c; + var f, d = (r + 1) % this.m_bodies.length; + (f = I.AddVV(this.m_normals[r], this.m_normals[d], this.m_delta)).SelfMul(u); + var p = f.LengthSquared(); + p > x(.2) && f.SelfMul(.2 / T(p)), + p > x(l) && (_ = !1), + o.x += f.x, + o.y += f.y + } + return _ + } + , + i + } + )(mi) + , xi = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_frictionJoint) || this; + return i.localAnchorA = new I, + i.localAnchorB = new I, + i.maxForce = 0, + i.maxTorque = 0, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e, i) { + this.bodyA = t, + this.bodyB = e, + this.bodyA.GetLocalPoint(i, this.localAnchorA), + this.bodyB.GetLocalPoint(i, this.localAnchorB) + } + , + i + } + )(pi) + , bi = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + return n.m_localAnchorA = new I, + n.m_localAnchorB = new I, + n.m_linearImpulse = new I, + n.m_angularImpulse = 0, + n.m_maxForce = 0, + n.m_maxTorque = 0, + n.m_indexA = 0, + n.m_indexB = 0, + n.m_rA = new I, + n.m_rB = new I, + n.m_localCenterA = new I, + n.m_localCenterB = new I, + n.m_invMassA = 0, + n.m_invMassB = 0, + n.m_invIA = 0, + n.m_invIB = 0, + n.m_linearMass = new O, + n.m_angularMass = 0, + n.m_qA = new F, + n.m_qB = new F, + n.m_lalcA = new I, + n.m_lalcB = new I, + n.m_K = new O, + n.m_localAnchorA.Copy(i.localAnchorA), + n.m_localAnchorB.Copy(i.localAnchorB), + n.m_linearImpulse.SetZero(), + n.m_maxForce = e(i.maxForce, 0), + n.m_maxTorque = e(i.maxTorque, 0), + n.m_linearMass.SetZero(), + n + } + return ti(i, t), + i.prototype.InitVelocityConstraints = function(t) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var e = t.positions[this.m_indexA].a + , i = t.velocities[this.m_indexA].v + , n = t.velocities[this.m_indexA].w + , r = t.positions[this.m_indexB].a + , s = t.velocities[this.m_indexB].v + , a = t.velocities[this.m_indexB].w + , o = this.m_qA.SetAngle(e) + , l = this.m_qB.SetAngle(r); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var h = F.MulRV(o, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var c = F.MulRV(l, this.m_lalcB, this.m_rB) + , u = this.m_invMassA + , _ = this.m_invMassB + , f = this.m_invIA + , d = this.m_invIB + , p = this.m_K; + if (p.ex.x = u + _ + f * h.y * h.y + d * c.y * c.y, + p.ex.y = -f * h.x * h.y - d * c.x * c.y, + p.ey.x = p.ex.y, + p.ey.y = u + _ + f * h.x * h.x + d * c.x * c.x, + p.GetInverse(this.m_linearMass), + this.m_angularMass = f + d, + this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass), + t.step.warmStarting) { + this.m_linearImpulse.SelfMul(t.step.dtRatio), + this.m_angularImpulse *= t.step.dtRatio; + var m = this.m_linearImpulse; + i.SelfMulSub(u, m), + n -= f * (I.CrossVV(this.m_rA, m) + this.m_angularImpulse), + s.SelfMulAdd(_, m), + a += d * (I.CrossVV(this.m_rB, m) + this.m_angularImpulse) + } else + this.m_linearImpulse.SetZero(), + this.m_angularImpulse = 0; + t.velocities[this.m_indexA].w = n, + t.velocities[this.m_indexB].w = a + } + , + i.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexA].v + , n = t.velocities[this.m_indexA].w + , r = t.velocities[this.m_indexB].v + , s = t.velocities[this.m_indexB].w + , a = this.m_invMassA + , o = this.m_invMassB + , l = this.m_invIA + , h = this.m_invIB + , c = t.step.dt + , u = s - n + , _ = -this.m_angularMass * u + , f = this.m_angularImpulse + , d = c * this.m_maxTorque; + this.m_angularImpulse = g(this.m_angularImpulse + _, -d, d), + n -= l * (_ = this.m_angularImpulse - f), + s += h * _; + var p = I.SubVV(I.AddVCrossSV(r, s, this.m_rB, I.s_t0), I.AddVCrossSV(e, n, this.m_rA, I.s_t1), i.SolveVelocityConstraints_s_Cdot_v2) + , m = O.MulMV(this.m_linearMass, p, i.SolveVelocityConstraints_s_impulseV).SelfNeg() + , y = i.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse); + this.m_linearImpulse.SelfAdd(m), + d = c * this.m_maxForce, + this.m_linearImpulse.LengthSquared() > d * d && (this.m_linearImpulse.Normalize(), + this.m_linearImpulse.SelfMul(d)), + I.SubVV(this.m_linearImpulse, y, m), + e.SelfMulSub(a, m), + n -= l * I.CrossVV(this.m_rA, m), + r.SelfMulAdd(o, m), + s += h * I.CrossVV(this.m_rB, m), + t.velocities[this.m_indexA].w = n, + t.velocities[this.m_indexB].w = s + } + , + i.prototype.SolvePositionConstraints = function() { + return !0 + } + , + i.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + i.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + i.prototype.GetReactionForce = function(t, e) { + return e.x = t * this.m_linearImpulse.x, + e.y = t * this.m_linearImpulse.y, + e + } + , + i.prototype.GetReactionTorque = function(t) { + return t * this.m_angularImpulse + } + , + i.prototype.GetLocalAnchorA = function() { + return this.m_localAnchorA + } + , + i.prototype.GetLocalAnchorB = function() { + return this.m_localAnchorB + } + , + i.prototype.SetMaxForce = function(t) { + this.m_maxForce = t + } + , + i.prototype.GetMaxForce = function() { + return this.m_maxForce + } + , + i.prototype.SetMaxTorque = function(t) { + this.m_maxTorque = t + } + , + i.prototype.GetMaxTorque = function() { + return this.m_maxTorque + } + , + i.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.maxForce = %.15f;\n", this.m_maxForce), + t(" jd.maxTorque = %.15f;\n", this.m_maxTorque), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + i.SolveVelocityConstraints_s_Cdot_v2 = new I, + i.SolveVelocityConstraints_s_impulseV = new I, + i.SolveVelocityConstraints_s_oldImpulseV = new I, + i + } + )(mi) + , Ci = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_gearJoint) || this; + return i.ratio = 1, + i + } + return ti(i, e), + i + } + )(pi) + , Ti = (function(i) { + function n(n) { + var r, s, a = i.call(this, n) || this; + a.m_typeA = t.b2JointType.e_unknownJoint, + a.m_typeB = t.b2JointType.e_unknownJoint, + a.m_localAnchorA = new I, + a.m_localAnchorB = new I, + a.m_localAnchorC = new I, + a.m_localAnchorD = new I, + a.m_localAxisC = new I, + a.m_localAxisD = new I, + a.m_referenceAngleA = 0, + a.m_referenceAngleB = 0, + a.m_constant = 0, + a.m_ratio = 0, + a.m_impulse = 0, + a.m_indexA = 0, + a.m_indexB = 0, + a.m_indexC = 0, + a.m_indexD = 0, + a.m_lcA = new I, + a.m_lcB = new I, + a.m_lcC = new I, + a.m_lcD = new I, + a.m_mA = 0, + a.m_mB = 0, + a.m_mC = 0, + a.m_mD = 0, + a.m_iA = 0, + a.m_iB = 0, + a.m_iC = 0, + a.m_iD = 0, + a.m_JvAC = new I, + a.m_JvBD = new I, + a.m_JwA = 0, + a.m_JwB = 0, + a.m_JwC = 0, + a.m_JwD = 0, + a.m_mass = 0, + a.m_qA = new F, + a.m_qB = new F, + a.m_qC = new F, + a.m_qD = new F, + a.m_lalcA = new I, + a.m_lalcB = new I, + a.m_lalcC = new I, + a.m_lalcD = new I, + a.m_joint1 = n.joint1, + a.m_joint2 = n.joint2, + a.m_typeA = a.m_joint1.GetType(), + a.m_typeB = a.m_joint2.GetType(), + a.m_bodyC = a.m_joint1.GetBodyA(), + a.m_bodyA = a.m_joint1.GetBodyB(); + var o = a.m_bodyA.m_xf + , l = a.m_bodyA.m_sweep.a + , h = a.m_bodyC.m_xf + , c = a.m_bodyC.m_sweep.a; + if (a.m_typeA === t.b2JointType.e_revoluteJoint) { + var u = n.joint1; + a.m_localAnchorC.Copy(u.m_localAnchorA), + a.m_localAnchorA.Copy(u.m_localAnchorB), + a.m_referenceAngleA = u.m_referenceAngle, + a.m_localAxisC.SetZero(), + r = l - c - a.m_referenceAngleA + } else { + var _ = n.joint1; + a.m_localAnchorC.Copy(_.m_localAnchorA), + a.m_localAnchorA.Copy(_.m_localAnchorB), + a.m_referenceAngleA = _.m_referenceAngle, + a.m_localAxisC.Copy(_.m_localXAxisA); + var f = a.m_localAnchorC + , d = F.MulTRV(h.q, I.AddVV(F.MulRV(o.q, a.m_localAnchorA, I.s_t0), I.SubVV(o.p, h.p, I.s_t1), I.s_t0), I.s_t0); + r = I.DotVV(I.SubVV(d, f, I.s_t0), a.m_localAxisC) + } + a.m_bodyD = a.m_joint2.GetBodyA(), + a.m_bodyB = a.m_joint2.GetBodyB(); + var p = a.m_bodyB.m_xf + , m = a.m_bodyB.m_sweep.a + , y = a.m_bodyD.m_xf + , v = a.m_bodyD.m_sweep.a; + if (a.m_typeB === t.b2JointType.e_revoluteJoint) + u = n.joint2, + a.m_localAnchorD.Copy(u.m_localAnchorA), + a.m_localAnchorB.Copy(u.m_localAnchorB), + a.m_referenceAngleB = u.m_referenceAngle, + a.m_localAxisD.SetZero(), + s = m - v - a.m_referenceAngleB; + else { + _ = n.joint2, + a.m_localAnchorD.Copy(_.m_localAnchorA), + a.m_localAnchorB.Copy(_.m_localAnchorB), + a.m_referenceAngleB = _.m_referenceAngle, + a.m_localAxisD.Copy(_.m_localXAxisA); + var g = a.m_localAnchorD + , A = F.MulTRV(y.q, I.AddVV(F.MulRV(p.q, a.m_localAnchorB, I.s_t0), I.SubVV(p.p, y.p, I.s_t1), I.s_t0), I.s_t0); + s = I.DotVV(I.SubVV(A, g, I.s_t0), a.m_localAxisD) + } + return a.m_ratio = e(n.ratio, 1), + a.m_constant = r + a.m_ratio * s, + a.m_impulse = 0, + a + } + return ti(n, i), + n.prototype.InitVelocityConstraints = function(e) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_indexC = this.m_bodyC.m_islandIndex, + this.m_indexD = this.m_bodyD.m_islandIndex, + this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter), + this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter), + this.m_mA = this.m_bodyA.m_invMass, + this.m_mB = this.m_bodyB.m_invMass, + this.m_mC = this.m_bodyC.m_invMass, + this.m_mD = this.m_bodyD.m_invMass, + this.m_iA = this.m_bodyA.m_invI, + this.m_iB = this.m_bodyB.m_invI, + this.m_iC = this.m_bodyC.m_invI, + this.m_iD = this.m_bodyD.m_invI; + var i = e.positions[this.m_indexA].a + , r = e.velocities[this.m_indexA].v + , s = e.velocities[this.m_indexA].w + , a = e.positions[this.m_indexB].a + , o = e.velocities[this.m_indexB].v + , l = e.velocities[this.m_indexB].w + , h = e.positions[this.m_indexC].a + , c = e.velocities[this.m_indexC].v + , u = e.velocities[this.m_indexC].w + , _ = e.positions[this.m_indexD].a + , f = e.velocities[this.m_indexD].v + , d = e.velocities[this.m_indexD].w + , p = this.m_qA.SetAngle(i) + , m = this.m_qB.SetAngle(a) + , y = this.m_qC.SetAngle(h) + , v = this.m_qD.SetAngle(_); + if (this.m_mass = 0, + this.m_typeA === t.b2JointType.e_revoluteJoint) + this.m_JvAC.SetZero(), + this.m_JwA = 1, + this.m_JwC = 1, + this.m_mass += this.m_iA + this.m_iC; + else { + var g = F.MulRV(y, this.m_localAxisC, n.InitVelocityConstraints_s_u); + I.SubVV(this.m_localAnchorC, this.m_lcC, this.m_lalcC); + var A = F.MulRV(y, this.m_lalcC, n.InitVelocityConstraints_s_rC); + I.SubVV(this.m_localAnchorA, this.m_lcA, this.m_lalcA); + var x = F.MulRV(p, this.m_lalcA, n.InitVelocityConstraints_s_rA); + this.m_JvAC.Copy(g), + this.m_JwC = I.CrossVV(A, g), + this.m_JwA = I.CrossVV(x, g), + this.m_mass += this.m_mC + this.m_mA + this.m_iC * this.m_JwC * this.m_JwC + this.m_iA * this.m_JwA * this.m_JwA + } + if (this.m_typeB === t.b2JointType.e_revoluteJoint) + this.m_JvBD.SetZero(), + this.m_JwB = this.m_ratio, + this.m_JwD = this.m_ratio, + this.m_mass += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD); + else { + g = F.MulRV(v, this.m_localAxisD, n.InitVelocityConstraints_s_u), + I.SubVV(this.m_localAnchorD, this.m_lcD, this.m_lalcD); + var b = F.MulRV(v, this.m_lalcD, n.InitVelocityConstraints_s_rD); + I.SubVV(this.m_localAnchorB, this.m_lcB, this.m_lalcB); + var C = F.MulRV(m, this.m_lalcB, n.InitVelocityConstraints_s_rB); + I.MulSV(this.m_ratio, g, this.m_JvBD), + this.m_JwD = this.m_ratio * I.CrossVV(b, g), + this.m_JwB = this.m_ratio * I.CrossVV(C, g), + this.m_mass += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * this.m_JwD * this.m_JwD + this.m_iB * this.m_JwB * this.m_JwB + } + this.m_mass = this.m_mass > 0 ? 1 / this.m_mass : 0, + e.step.warmStarting ? (r.SelfMulAdd(this.m_mA * this.m_impulse, this.m_JvAC), + s += this.m_iA * this.m_impulse * this.m_JwA, + o.SelfMulAdd(this.m_mB * this.m_impulse, this.m_JvBD), + l += this.m_iB * this.m_impulse * this.m_JwB, + c.SelfMulSub(this.m_mC * this.m_impulse, this.m_JvAC), + u -= this.m_iC * this.m_impulse * this.m_JwC, + f.SelfMulSub(this.m_mD * this.m_impulse, this.m_JvBD), + d -= this.m_iD * this.m_impulse * this.m_JwD) : this.m_impulse = 0, + e.velocities[this.m_indexA].w = s, + e.velocities[this.m_indexB].w = l, + e.velocities[this.m_indexC].w = u, + e.velocities[this.m_indexD].w = d + } + , + n.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexA].v + , i = t.velocities[this.m_indexA].w + , n = t.velocities[this.m_indexB].v + , r = t.velocities[this.m_indexB].w + , s = t.velocities[this.m_indexC].v + , a = t.velocities[this.m_indexC].w + , o = t.velocities[this.m_indexD].v + , l = t.velocities[this.m_indexD].w + , h = I.DotVV(this.m_JvAC, I.SubVV(e, s, I.s_t0)) + I.DotVV(this.m_JvBD, I.SubVV(n, o, I.s_t0)); + h += this.m_JwA * i - this.m_JwC * a + (this.m_JwB * r - this.m_JwD * l); + var c = -this.m_mass * h; + this.m_impulse += c, + e.SelfMulAdd(this.m_mA * c, this.m_JvAC), + i += this.m_iA * c * this.m_JwA, + n.SelfMulAdd(this.m_mB * c, this.m_JvBD), + r += this.m_iB * c * this.m_JwB, + s.SelfMulSub(this.m_mC * c, this.m_JvAC), + a -= this.m_iC * c * this.m_JwC, + o.SelfMulSub(this.m_mD * c, this.m_JvBD), + l -= this.m_iD * c * this.m_JwD, + t.velocities[this.m_indexA].w = i, + t.velocities[this.m_indexB].w = r, + t.velocities[this.m_indexC].w = a, + t.velocities[this.m_indexD].w = l + } + , + n.prototype.SolvePositionConstraints = function(e) { + var i, r, s, a, o, h, c = e.positions[this.m_indexA].c, u = e.positions[this.m_indexA].a, _ = e.positions[this.m_indexB].c, f = e.positions[this.m_indexB].a, d = e.positions[this.m_indexC].c, p = e.positions[this.m_indexC].a, m = e.positions[this.m_indexD].c, y = e.positions[this.m_indexD].a, v = this.m_qA.SetAngle(u), g = this.m_qB.SetAngle(f), A = this.m_qC.SetAngle(p), x = this.m_qD.SetAngle(y), b = this.m_JvAC, C = this.m_JvBD, T = 0; + if (this.m_typeA === t.b2JointType.e_revoluteJoint) + b.SetZero(), + s = 1, + o = 1, + T += this.m_iA + this.m_iC, + i = u - p - this.m_referenceAngleA; + else { + var S = F.MulRV(A, this.m_localAxisC, n.SolvePositionConstraints_s_u) + , w = F.MulRV(A, this.m_lalcC, n.SolvePositionConstraints_s_rC) + , E = F.MulRV(v, this.m_lalcA, n.SolvePositionConstraints_s_rA); + b.Copy(S), + o = I.CrossVV(w, S), + s = I.CrossVV(E, S), + T += this.m_mC + this.m_mA + this.m_iC * o * o + this.m_iA * s * s; + var M = this.m_lalcC + , D = F.MulTRV(A, I.AddVV(E, I.SubVV(c, d, I.s_t0), I.s_t0), I.s_t0); + i = I.DotVV(I.SubVV(D, M, I.s_t0), this.m_localAxisC) + } + if (this.m_typeB === t.b2JointType.e_revoluteJoint) + C.SetZero(), + a = this.m_ratio, + h = this.m_ratio, + T += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD), + r = f - y - this.m_referenceAngleB; + else { + S = F.MulRV(x, this.m_localAxisD, n.SolvePositionConstraints_s_u); + var B = F.MulRV(x, this.m_lalcD, n.SolvePositionConstraints_s_rD) + , P = F.MulRV(g, this.m_lalcB, n.SolvePositionConstraints_s_rB); + I.MulSV(this.m_ratio, S, C), + h = this.m_ratio * I.CrossVV(B, S), + a = this.m_ratio * I.CrossVV(P, S), + T += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * h * h + this.m_iB * a * a; + var R = this.m_lalcD + , O = F.MulTRV(x, I.AddVV(P, I.SubVV(_, m, I.s_t0), I.s_t0), I.s_t0); + r = I.DotVV(I.SubVV(O, R, I.s_t0), this.m_localAxisD) + } + var L = i + this.m_ratio * r - this.m_constant + , V = 0; + return T > 0 && (V = -L / T), + c.SelfMulAdd(this.m_mA * V, b), + u += this.m_iA * V * s, + _.SelfMulAdd(this.m_mB * V, C), + f += this.m_iB * V * a, + d.SelfMulSub(this.m_mC * V, b), + p -= this.m_iC * V * o, + m.SelfMulSub(this.m_mD * V, C), + y -= this.m_iD * V * h, + e.positions[this.m_indexA].a = u, + e.positions[this.m_indexB].a = f, + e.positions[this.m_indexC].a = p, + e.positions[this.m_indexD].a = y, + 0 < l + } + , + n.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + n.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + n.prototype.GetReactionForce = function(t, e) { + return I.MulSV(t * this.m_impulse, this.m_JvAC, e) + } + , + n.prototype.GetReactionTorque = function(t) { + return t * this.m_impulse * this.m_JwA + } + , + n.prototype.GetJoint1 = function() { + return this.m_joint1 + } + , + n.prototype.GetJoint2 = function() { + return this.m_joint2 + } + , + n.prototype.GetRatio = function() { + return this.m_ratio + } + , + n.prototype.SetRatio = function(t) { + this.m_ratio = t + } + , + n.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex + , n = this.m_joint1.m_index + , r = this.m_joint2.m_index; + t(" const jd: b2GearJointDef = new b2GearJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.joint1 = joints[%d];\n", n), + t(" jd.joint2 = joints[%d];\n", r), + t(" jd.ratio = %.15f;\n", this.m_ratio), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + n.InitVelocityConstraints_s_u = new I, + n.InitVelocityConstraints_s_rA = new I, + n.InitVelocityConstraints_s_rB = new I, + n.InitVelocityConstraints_s_rC = new I, + n.InitVelocityConstraints_s_rD = new I, + n.SolvePositionConstraints_s_u = new I, + n.SolvePositionConstraints_s_rA = new I, + n.SolvePositionConstraints_s_rB = new I, + n.SolvePositionConstraints_s_rC = new I, + n.SolvePositionConstraints_s_rD = new I, + n + } + )(mi) + , Si = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_motorJoint) || this; + return i.linearOffset = new I(0,0), + i.angularOffset = 0, + i.maxForce = 1, + i.maxTorque = 1, + i.correctionFactor = .3, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e) { + this.bodyA = t, + this.bodyB = e, + this.bodyA.GetLocalPoint(this.bodyB.GetPosition(), this.linearOffset); + var i = this.bodyA.GetAngle() + , n = this.bodyB.GetAngle(); + this.angularOffset = n - i + } + , + i + } + )(pi) + , wi = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + return n.m_linearOffset = new I, + n.m_angularOffset = 0, + n.m_linearImpulse = new I, + n.m_angularImpulse = 0, + n.m_maxForce = 0, + n.m_maxTorque = 0, + n.m_correctionFactor = .3, + n.m_indexA = 0, + n.m_indexB = 0, + n.m_rA = new I, + n.m_rB = new I, + n.m_localCenterA = new I, + n.m_localCenterB = new I, + n.m_linearError = new I, + n.m_angularError = 0, + n.m_invMassA = 0, + n.m_invMassB = 0, + n.m_invIA = 0, + n.m_invIB = 0, + n.m_linearMass = new O, + n.m_angularMass = 0, + n.m_qA = new F, + n.m_qB = new F, + n.m_K = new O, + n.m_linearOffset.Copy(e(i.linearOffset, I.ZERO)), + n.m_linearImpulse.SetZero(), + n.m_maxForce = e(i.maxForce, 0), + n.m_maxTorque = e(i.maxTorque, 0), + n.m_correctionFactor = e(i.correctionFactor, .3), + n + } + return ti(i, t), + i.prototype.GetAnchorA = function(t) { + var e = this.m_bodyA.GetPosition(); + return t.x = e.x, + t.y = e.y, + t + } + , + i.prototype.GetAnchorB = function(t) { + var e = this.m_bodyB.GetPosition(); + return t.x = e.x, + t.y = e.y, + t + } + , + i.prototype.GetReactionForce = function(t, e) { + return I.MulSV(t, this.m_linearImpulse, e) + } + , + i.prototype.GetReactionTorque = function(t) { + return t * this.m_angularImpulse + } + , + i.prototype.SetLinearOffset = function(t) { + I.IsEqualToV(t, this.m_linearOffset) || (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_linearOffset.Copy(t)) + } + , + i.prototype.GetLinearOffset = function() { + return this.m_linearOffset + } + , + i.prototype.SetAngularOffset = function(t) { + t !== this.m_angularOffset && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_angularOffset = t) + } + , + i.prototype.GetAngularOffset = function() { + return this.m_angularOffset + } + , + i.prototype.SetMaxForce = function(t) { + this.m_maxForce = t + } + , + i.prototype.GetMaxForce = function() { + return this.m_maxForce + } + , + i.prototype.SetMaxTorque = function(t) { + this.m_maxTorque = t + } + , + i.prototype.GetMaxTorque = function() { + return this.m_maxTorque + } + , + i.prototype.InitVelocityConstraints = function(t) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var e = t.positions[this.m_indexA].c + , i = t.positions[this.m_indexA].a + , n = t.velocities[this.m_indexA].v + , r = t.velocities[this.m_indexA].w + , s = t.positions[this.m_indexB].c + , a = t.positions[this.m_indexB].a + , o = t.velocities[this.m_indexB].v + , l = t.velocities[this.m_indexB].w + , h = this.m_qA.SetAngle(i) + , c = this.m_qB.SetAngle(a) + , u = F.MulRV(h, I.SubVV(this.m_linearOffset, this.m_localCenterA, I.s_t0), this.m_rA) + , _ = F.MulRV(c, I.NegV(this.m_localCenterB, I.s_t0), this.m_rB) + , f = this.m_invMassA + , d = this.m_invMassB + , p = this.m_invIA + , m = this.m_invIB + , y = this.m_K; + if (y.ex.x = f + d + p * u.y * u.y + m * _.y * _.y, + y.ex.y = -p * u.x * u.y - m * _.x * _.y, + y.ey.x = y.ex.y, + y.ey.y = f + d + p * u.x * u.x + m * _.x * _.x, + y.GetInverse(this.m_linearMass), + this.m_angularMass = p + m, + this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass), + I.SubVV(I.AddVV(s, _, I.s_t0), I.AddVV(e, u, I.s_t1), this.m_linearError), + this.m_angularError = a - i - this.m_angularOffset, + t.step.warmStarting) { + this.m_linearImpulse.SelfMul(t.step.dtRatio), + this.m_angularImpulse *= t.step.dtRatio; + var v = this.m_linearImpulse; + n.SelfMulSub(f, v), + r -= p * (I.CrossVV(u, v) + this.m_angularImpulse), + o.SelfMulAdd(d, v), + l += m * (I.CrossVV(_, v) + this.m_angularImpulse) + } else + this.m_linearImpulse.SetZero(), + this.m_angularImpulse = 0; + t.velocities[this.m_indexA].w = r, + t.velocities[this.m_indexB].w = l + } + , + i.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexA].v + , n = t.velocities[this.m_indexA].w + , r = t.velocities[this.m_indexB].v + , s = t.velocities[this.m_indexB].w + , a = this.m_invMassA + , o = this.m_invMassB + , l = this.m_invIA + , h = this.m_invIB + , c = t.step.dt + , u = t.step.inv_dt + , _ = s - n + u * this.m_correctionFactor * this.m_angularError + , f = -this.m_angularMass * _ + , d = this.m_angularImpulse + , p = c * this.m_maxTorque; + this.m_angularImpulse = g(this.m_angularImpulse + f, -p, p), + n -= l * (f = this.m_angularImpulse - d), + s += h * f; + var m = this.m_rA + , y = this.m_rB + , v = I.AddVV(I.SubVV(I.AddVV(r, I.CrossSV(s, y, I.s_t0), I.s_t0), I.AddVV(e, I.CrossSV(n, m, I.s_t1), I.s_t1), I.s_t2), I.MulSV(u * this.m_correctionFactor, this.m_linearError, I.s_t3), i.SolveVelocityConstraints_s_Cdot_v2) + , A = O.MulMV(this.m_linearMass, v, i.SolveVelocityConstraints_s_impulse_v2).SelfNeg() + , x = i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse); + this.m_linearImpulse.SelfAdd(A), + p = c * this.m_maxForce, + this.m_linearImpulse.LengthSquared() > p * p && (this.m_linearImpulse.Normalize(), + this.m_linearImpulse.SelfMul(p)), + I.SubVV(this.m_linearImpulse, x, A), + e.SelfMulSub(a, A), + n -= l * I.CrossVV(m, A), + r.SelfMulAdd(o, A), + s += h * I.CrossVV(y, A), + t.velocities[this.m_indexA].w = n, + t.velocities[this.m_indexB].w = s + } + , + i.prototype.SolvePositionConstraints = function() { + return !0 + } + , + i.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.linearOffset.Set(%.15f, %.15f);\n", this.m_linearOffset.x, this.m_linearOffset.y), + t(" jd.angularOffset = %.15f;\n", this.m_angularOffset), + t(" jd.maxForce = %.15f;\n", this.m_maxForce), + t(" jd.maxTorque = %.15f;\n", this.m_maxTorque), + t(" jd.correctionFactor = %.15f;\n", this.m_correctionFactor), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + i.SolveVelocityConstraints_s_Cdot_v2 = new I, + i.SolveVelocityConstraints_s_impulse_v2 = new I, + i.SolveVelocityConstraints_s_oldImpulse_v2 = new I, + i + } + )(mi) + , Ei = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_mouseJoint) || this; + return i.target = new I, + i.maxForce = 0, + i.frequencyHz = 5, + i.dampingRatio = .7, + i + } + return ti(i, e), + i + } + )(pi) + , Mi = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + return n.m_localAnchorB = new I, + n.m_targetA = new I, + n.m_frequencyHz = 0, + n.m_dampingRatio = 0, + n.m_beta = 0, + n.m_impulse = new I, + n.m_maxForce = 0, + n.m_gamma = 0, + n.m_indexA = 0, + n.m_indexB = 0, + n.m_rB = new I, + n.m_localCenterB = new I, + n.m_invMassB = 0, + n.m_invIB = 0, + n.m_mass = new O, + n.m_C = new I, + n.m_qB = new F, + n.m_lalcB = new I, + n.m_K = new O, + n.m_targetA.Copy(e(i.target, I.ZERO)), + V.MulTXV(n.m_bodyB.GetTransform(), n.m_targetA, n.m_localAnchorB), + n.m_maxForce = e(i.maxForce, 0), + n.m_impulse.SetZero(), + n.m_frequencyHz = e(i.frequencyHz, 0), + n.m_dampingRatio = e(i.dampingRatio, 0), + n.m_beta = 0, + n.m_gamma = 0, + n + } + return ti(i, t), + i.prototype.SetTarget = function(t) { + this.m_bodyB.IsAwake() || this.m_bodyB.SetAwake(!0), + this.m_targetA.Copy(t) + } + , + i.prototype.GetTarget = function() { + return this.m_targetA + } + , + i.prototype.SetMaxForce = function(t) { + this.m_maxForce = t + } + , + i.prototype.GetMaxForce = function() { + return this.m_maxForce + } + , + i.prototype.SetFrequency = function(t) { + this.m_frequencyHz = t + } + , + i.prototype.GetFrequency = function() { + return this.m_frequencyHz + } + , + i.prototype.SetDampingRatio = function(t) { + this.m_dampingRatio = t + } + , + i.prototype.GetDampingRatio = function() { + return this.m_dampingRatio + } + , + i.prototype.InitVelocityConstraints = function(t) { + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIB = this.m_bodyB.m_invI; + var e = t.positions[this.m_indexB].c + , i = t.positions[this.m_indexB].a + , n = t.velocities[this.m_indexB].v + , r = t.velocities[this.m_indexB].w + , a = this.m_qB.SetAngle(i) + , o = this.m_bodyB.GetMass() + , l = 2 * s * this.m_frequencyHz + , h = 2 * o * this.m_dampingRatio * l + , c = o * l * l + , u = t.step.dt; + this.m_gamma = u * (h + u * c), + 0 !== this.m_gamma && (this.m_gamma = 1 / this.m_gamma), + this.m_beta = u * c * this.m_gamma, + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), + F.MulRV(a, this.m_lalcB, this.m_rB); + var _ = this.m_K; + _.ex.x = this.m_invMassB + this.m_invIB * this.m_rB.y * this.m_rB.y + this.m_gamma, + _.ex.y = -this.m_invIB * this.m_rB.x * this.m_rB.y, + _.ey.x = _.ex.y, + _.ey.y = this.m_invMassB + this.m_invIB * this.m_rB.x * this.m_rB.x + this.m_gamma, + _.GetInverse(this.m_mass), + this.m_C.x = e.x + this.m_rB.x - this.m_targetA.x, + this.m_C.y = e.y + this.m_rB.y - this.m_targetA.y, + this.m_C.SelfMul(this.m_beta), + r *= .98, + t.step.warmStarting ? (this.m_impulse.SelfMul(t.step.dtRatio), + n.x += this.m_invMassB * this.m_impulse.x, + n.y += this.m_invMassB * this.m_impulse.y, + r += this.m_invIB * I.CrossVV(this.m_rB, this.m_impulse)) : this.m_impulse.SetZero(), + t.velocities[this.m_indexB].w = r + } + , + i.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexB].v + , n = t.velocities[this.m_indexB].w + , r = I.AddVCrossSV(e, n, this.m_rB, i.SolveVelocityConstraints_s_Cdot) + , s = O.MulMV(this.m_mass, I.AddVV(r, I.AddVV(this.m_C, I.MulSV(this.m_gamma, this.m_impulse, I.s_t0), I.s_t0), I.s_t0).SelfNeg(), i.SolveVelocityConstraints_s_impulse) + , a = i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse); + this.m_impulse.SelfAdd(s); + var o = t.step.dt * this.m_maxForce; + this.m_impulse.LengthSquared() > o * o && this.m_impulse.SelfMul(o / this.m_impulse.Length()), + I.SubVV(this.m_impulse, a, s), + e.SelfMulAdd(this.m_invMassB, s), + n += this.m_invIB * I.CrossVV(this.m_rB, s), + t.velocities[this.m_indexB].w = n + } + , + i.prototype.SolvePositionConstraints = function() { + return !0 + } + , + i.prototype.GetAnchorA = function(t) { + return t.x = this.m_targetA.x, + t.y = this.m_targetA.y, + t + } + , + i.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + i.prototype.GetReactionForce = function(t, e) { + return I.MulSV(t, this.m_impulse, e) + } + , + i.prototype.GetReactionTorque = function() { + return 0 + } + , + i.prototype.Dump = function(t) { + t("Mouse joint dumping is not supported.\n") + } + , + i.prototype.ShiftOrigin = function(t) { + this.m_targetA.SelfSub(t) + } + , + i.SolveVelocityConstraints_s_Cdot = new I, + i.SolveVelocityConstraints_s_impulse = new I, + i.SolveVelocityConstraints_s_oldImpulse = new I, + i + } + )(mi) + , Di = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_prismaticJoint) || this; + return i.localAnchorA = new I, + i.localAnchorB = new I, + i.localAxisA = new I(1,0), + i.referenceAngle = 0, + i.enableLimit = !1, + i.lowerTranslation = 0, + i.upperTranslation = 0, + i.enableMotor = !1, + i.maxMotorForce = 0, + i.motorSpeed = 0, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e, i, n) { + this.bodyA = t, + this.bodyB = e, + this.bodyA.GetLocalPoint(i, this.localAnchorA), + this.bodyB.GetLocalPoint(i, this.localAnchorB), + this.bodyA.GetLocalVector(n, this.localAxisA), + this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle() + } + , + i + } + )(pi) + , Bi = (function(i) { + function n(n) { + var r = i.call(this, n) || this; + return r.m_localAnchorA = new I, + r.m_localAnchorB = new I, + r.m_localXAxisA = new I, + r.m_localYAxisA = new I, + r.m_referenceAngle = 0, + r.m_impulse = new R(0,0,0), + r.m_motorImpulse = 0, + r.m_lowerTranslation = 0, + r.m_upperTranslation = 0, + r.m_maxMotorForce = 0, + r.m_motorSpeed = 0, + r.m_enableLimit = !1, + r.m_enableMotor = !1, + r.m_limitState = t.b2LimitState.e_inactiveLimit, + r.m_indexA = 0, + r.m_indexB = 0, + r.m_localCenterA = new I, + r.m_localCenterB = new I, + r.m_invMassA = 0, + r.m_invMassB = 0, + r.m_invIA = 0, + r.m_invIB = 0, + r.m_axis = new I(0,0), + r.m_perp = new I(0,0), + r.m_s1 = 0, + r.m_s2 = 0, + r.m_a1 = 0, + r.m_a2 = 0, + r.m_K = new L, + r.m_K3 = new L, + r.m_K2 = new O, + r.m_motorMass = 0, + r.m_qA = new F, + r.m_qB = new F, + r.m_lalcA = new I, + r.m_lalcB = new I, + r.m_rA = new I, + r.m_rB = new I, + r.m_localAnchorA.Copy(e(n.localAnchorA, I.ZERO)), + r.m_localAnchorB.Copy(e(n.localAnchorB, I.ZERO)), + r.m_localXAxisA.Copy(e(n.localAxisA, new I(1,0))).SelfNormalize(), + I.CrossOneV(r.m_localXAxisA, r.m_localYAxisA), + r.m_referenceAngle = e(n.referenceAngle, 0), + r.m_lowerTranslation = e(n.lowerTranslation, 0), + r.m_upperTranslation = e(n.upperTranslation, 0), + r.m_maxMotorForce = e(n.maxMotorForce, 0), + r.m_motorSpeed = e(n.motorSpeed, 0), + r.m_enableLimit = e(n.enableLimit, !1), + r.m_enableMotor = e(n.enableMotor, !1), + r + } + return ti(n, i), + n.prototype.InitVelocityConstraints = function(e) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var i = e.positions[this.m_indexA].c + , r = e.positions[this.m_indexA].a + , s = e.velocities[this.m_indexA].v + , a = e.velocities[this.m_indexA].w + , o = e.positions[this.m_indexB].c + , h = e.positions[this.m_indexB].a + , c = e.velocities[this.m_indexB].v + , u = e.velocities[this.m_indexB].w + , _ = this.m_qA.SetAngle(r) + , f = this.m_qB.SetAngle(h); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var d = F.MulRV(_, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var p = F.MulRV(f, this.m_lalcB, this.m_rB) + , y = I.AddVV(I.SubVV(o, i, I.s_t0), I.SubVV(p, d, I.s_t1), n.InitVelocityConstraints_s_d) + , v = this.m_invMassA + , g = this.m_invMassB + , A = this.m_invIA + , x = this.m_invIB; + if (F.MulRV(_, this.m_localXAxisA, this.m_axis), + this.m_a1 = I.CrossVV(I.AddVV(y, d, I.s_t0), this.m_axis), + this.m_a2 = I.CrossVV(p, this.m_axis), + this.m_motorMass = v + g + A * this.m_a1 * this.m_a1 + x * this.m_a2 * this.m_a2, + this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass), + F.MulRV(_, this.m_localYAxisA, this.m_perp), + this.m_s1 = I.CrossVV(I.AddVV(y, d, I.s_t0), this.m_perp), + this.m_s2 = I.CrossVV(p, this.m_perp), + this.m_K.ex.x = v + g + A * this.m_s1 * this.m_s1 + x * this.m_s2 * this.m_s2, + this.m_K.ex.y = A * this.m_s1 + x * this.m_s2, + this.m_K.ex.z = A * this.m_s1 * this.m_a1 + x * this.m_s2 * this.m_a2, + this.m_K.ey.x = this.m_K.ex.y, + this.m_K.ey.y = A + x, + 0 === this.m_K.ey.y && (this.m_K.ey.y = 1), + this.m_K.ey.z = A * this.m_a1 + x * this.m_a2, + this.m_K.ez.x = this.m_K.ex.z, + this.m_K.ez.y = this.m_K.ey.z, + this.m_K.ez.z = v + g + A * this.m_a1 * this.m_a1 + x * this.m_a2 * this.m_a2, + this.m_enableLimit) { + var b = I.DotVV(this.m_axis, y); + m(this.m_upperTranslation - this.m_lowerTranslation) < 2 * l ? this.m_limitState = t.b2LimitState.e_equalLimits : b <= this.m_lowerTranslation ? this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_limitState = t.b2LimitState.e_atLowerLimit, + this.m_impulse.z = 0) : b >= this.m_upperTranslation ? this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_limitState = t.b2LimitState.e_atUpperLimit, + this.m_impulse.z = 0) : (this.m_limitState = t.b2LimitState.e_inactiveLimit, + this.m_impulse.z = 0) + } else + this.m_limitState = t.b2LimitState.e_inactiveLimit, + this.m_impulse.z = 0; + if (this.m_enableMotor || (this.m_motorImpulse = 0), + e.step.warmStarting) { + this.m_impulse.SelfMul(e.step.dtRatio), + this.m_motorImpulse *= e.step.dtRatio; + var C = I.AddVV(I.MulSV(this.m_impulse.x, this.m_perp, I.s_t0), I.MulSV(this.m_motorImpulse + this.m_impulse.z, this.m_axis, I.s_t1), n.InitVelocityConstraints_s_P) + , T = this.m_impulse.x * this.m_s1 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a1 + , S = this.m_impulse.x * this.m_s2 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a2; + s.SelfMulSub(v, C), + a -= A * T, + c.SelfMulAdd(g, C), + u += x * S + } else + this.m_impulse.SetZero(), + this.m_motorImpulse = 0; + e.velocities[this.m_indexA].w = a, + e.velocities[this.m_indexB].w = u + } + , + n.prototype.SolveVelocityConstraints = function(e) { + var i = e.velocities[this.m_indexA].v + , r = e.velocities[this.m_indexA].w + , s = e.velocities[this.m_indexB].v + , a = e.velocities[this.m_indexB].w + , o = this.m_invMassA + , l = this.m_invMassB + , h = this.m_invIA + , c = this.m_invIB; + if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits) { + var u = I.DotVV(this.m_axis, I.SubVV(s, i, I.s_t0)) + this.m_a2 * a - this.m_a1 * r + , _ = this.m_motorMass * (this.m_motorSpeed - u) + , f = this.m_motorImpulse + , d = e.step.dt * this.m_maxMotorForce; + this.m_motorImpulse = g(this.m_motorImpulse + _, -d, d), + _ = this.m_motorImpulse - f; + var p = I.MulSV(_, this.m_axis, n.SolveVelocityConstraints_s_P) + , m = _ * this.m_a1 + , A = _ * this.m_a2; + i.SelfMulSub(o, p), + r -= h * m, + s.SelfMulAdd(l, p), + a += c * A + } + var x = I.DotVV(this.m_perp, I.SubVV(s, i, I.s_t0)) + this.m_s2 * a - this.m_s1 * r + , b = a - r; + if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit) { + var C = I.DotVV(this.m_axis, I.SubVV(s, i, I.s_t0)) + this.m_a2 * a - this.m_a1 * r + , T = n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse) + , S = this.m_K.Solve33(-x, -b, -C, n.SolveVelocityConstraints_s_df3); + this.m_impulse.SelfAdd(S), + this.m_limitState === t.b2LimitState.e_atLowerLimit ? this.m_impulse.z = v(this.m_impulse.z, 0) : this.m_limitState === t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = y(this.m_impulse.z, 0)); + var w = -x - (this.m_impulse.z - T.z) * this.m_K.ez.x + , E = -b - (this.m_impulse.z - T.z) * this.m_K.ez.y + , M = this.m_K.Solve22(w, E, n.SolveVelocityConstraints_s_f2r); + M.x += T.x, + M.y += T.y, + this.m_impulse.x = M.x, + this.m_impulse.y = M.y, + S.x = this.m_impulse.x - T.x, + S.y = this.m_impulse.y - T.y, + S.z = this.m_impulse.z - T.z, + p = I.AddVV(I.MulSV(S.x, this.m_perp, I.s_t0), I.MulSV(S.z, this.m_axis, I.s_t1), n.SolveVelocityConstraints_s_P), + m = S.x * this.m_s1 + S.y + S.z * this.m_a1, + A = S.x * this.m_s2 + S.y + S.z * this.m_a2, + i.SelfMulSub(o, p), + r -= h * m, + s.SelfMulAdd(l, p), + a += c * A + } else { + var D = this.m_K.Solve22(-x, -b, n.SolveVelocityConstraints_s_df2); + this.m_impulse.x += D.x, + this.m_impulse.y += D.y, + p = I.MulSV(D.x, this.m_perp, n.SolveVelocityConstraints_s_P), + m = D.x * this.m_s1 + D.y, + A = D.x * this.m_s2 + D.y, + i.SelfMulSub(o, p), + r -= h * m, + s.SelfMulAdd(l, p), + a += c * A + } + e.velocities[this.m_indexA].w = r, + e.velocities[this.m_indexB].w = a + } + , + n.prototype.SolvePositionConstraints = function(t) { + var e = t.positions[this.m_indexA].c + , i = t.positions[this.m_indexA].a + , r = t.positions[this.m_indexB].c + , s = t.positions[this.m_indexB].a + , a = this.m_qA.SetAngle(i) + , o = this.m_qB.SetAngle(s) + , c = this.m_invMassA + , u = this.m_invMassB + , _ = this.m_invIA + , f = this.m_invIB + , d = F.MulRV(a, this.m_lalcA, this.m_rA) + , p = F.MulRV(o, this.m_lalcB, this.m_rB) + , y = I.SubVV(I.AddVV(r, p, I.s_t0), I.AddVV(e, d, I.s_t1), n.SolvePositionConstraints_s_d) + , A = F.MulRV(a, this.m_localXAxisA, this.m_axis) + , x = I.CrossVV(I.AddVV(y, d, I.s_t0), A) + , b = I.CrossVV(p, A) + , C = F.MulRV(a, this.m_localYAxisA, this.m_perp) + , T = I.CrossVV(I.AddVV(y, d, I.s_t0), C) + , S = I.CrossVV(p, C) + , w = n.SolvePositionConstraints_s_impulse + , E = I.DotVV(C, y) + , M = s - i - this.m_referenceAngle + , D = m(E) + , B = m(M) + , P = !1 + , R = 0; + if (this.m_enableLimit) { + var O = I.DotVV(A, y); + m(this.m_upperTranslation - this.m_lowerTranslation) < 2 * l ? (R = g(O, -.2, .2), + D = v(D, m(O)), + P = !0) : O <= this.m_lowerTranslation ? (R = g(O - this.m_lowerTranslation + l, -.2, 0), + D = v(D, this.m_lowerTranslation - O), + P = !0) : O >= this.m_upperTranslation && (R = g(O - this.m_upperTranslation - l, 0, .2), + D = v(D, O - this.m_upperTranslation), + P = !0) + } + if (P) { + var L = c + u + _ * T * T + f * S * S + , V = _ * T + f * S + , N = _ * T * x + f * S * b; + 0 === (z = _ + f) && (z = 1); + var k = _ * x + f * b + , G = c + u + _ * x * x + f * b * b + , U = this.m_K3; + U.ex.SetXYZ(L, V, N), + U.ey.SetXYZ(V, z, k), + U.ez.SetXYZ(N, k, G), + w = U.Solve33(-E, -M, -R, w) + } else { + var z; + L = c + u + _ * T * T + f * S * S, + V = _ * T + f * S, + 0 === (z = _ + f) && (z = 1); + var H = this.m_K2; + H.ex.Set(L, V), + H.ey.Set(V, z); + var W = H.Solve(-E, -M, n.SolvePositionConstraints_s_impulse1); + w.x = W.x, + w.y = W.y, + w.z = 0 + } + var j = I.AddVV(I.MulSV(w.x, C, I.s_t0), I.MulSV(w.z, A, I.s_t1), n.SolvePositionConstraints_s_P) + , X = w.x * T + w.y + w.z * x + , Y = w.x * S + w.y + w.z * b; + return e.SelfMulSub(c, j), + i -= _ * X, + r.SelfMulAdd(u, j), + s += f * Y, + t.positions[this.m_indexA].a = i, + t.positions[this.m_indexB].a = s, + D <= l && B <= h + } + , + n.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + n.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + n.prototype.GetReactionForce = function(t, e) { + return e.x = t * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x), + e.y = t * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y), + e + } + , + n.prototype.GetReactionTorque = function(t) { + return t * this.m_impulse.y + } + , + n.prototype.GetLocalAnchorA = function() { + return this.m_localAnchorA + } + , + n.prototype.GetLocalAnchorB = function() { + return this.m_localAnchorB + } + , + n.prototype.GetLocalAxisA = function() { + return this.m_localXAxisA + } + , + n.prototype.GetReferenceAngle = function() { + return this.m_referenceAngle + } + , + n.prototype.GetJointTranslation = function() { + var t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, n.GetJointTranslation_s_pA) + , e = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, n.GetJointTranslation_s_pB) + , i = I.SubVV(e, t, n.GetJointTranslation_s_d) + , r = this.m_bodyA.GetWorldVector(this.m_localXAxisA, n.GetJointTranslation_s_axis); + return I.DotVV(i, r) + } + , + n.prototype.GetJointSpeed = function() { + var t = this.m_bodyA + , e = this.m_bodyB; + I.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA); + var i = F.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB); + var n = F.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB) + , r = I.AddVV(t.m_sweep.c, i, I.s_t0) + , s = I.AddVV(e.m_sweep.c, n, I.s_t1) + , a = I.SubVV(s, r, I.s_t2) + , o = t.GetWorldVector(this.m_localXAxisA, this.m_axis) + , l = t.m_linearVelocity + , h = e.m_linearVelocity + , c = t.m_angularVelocity + , u = e.m_angularVelocity; + return I.DotVV(a, I.CrossSV(c, o, I.s_t0)) + I.DotVV(o, I.SubVV(I.AddVCrossSV(h, u, n, I.s_t0), I.AddVCrossSV(l, c, i, I.s_t1), I.s_t0)) + } + , + n.prototype.IsLimitEnabled = function() { + return this.m_enableLimit + } + , + n.prototype.EnableLimit = function(t) { + t !== this.m_enableLimit && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_enableLimit = t, + this.m_impulse.z = 0) + } + , + n.prototype.GetLowerLimit = function() { + return this.m_lowerTranslation + } + , + n.prototype.GetUpperLimit = function() { + return this.m_upperTranslation + } + , + n.prototype.SetLimits = function(t, e) { + t === this.m_lowerTranslation && e === this.m_upperTranslation || (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_lowerTranslation = t, + this.m_upperTranslation = e, + this.m_impulse.z = 0) + } + , + n.prototype.IsMotorEnabled = function() { + return this.m_enableMotor + } + , + n.prototype.EnableMotor = function(t) { + t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_enableMotor = t) + } + , + n.prototype.SetMotorSpeed = function(t) { + t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_motorSpeed = t) + } + , + n.prototype.GetMotorSpeed = function() { + return this.m_motorSpeed + } + , + n.prototype.SetMaxMotorForce = function(t) { + t !== this.m_maxMotorForce && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_maxMotorForce = t) + } + , + n.prototype.GetMaxMotorForce = function() { + return this.m_maxMotorForce + } + , + n.prototype.GetMotorForce = function(t) { + return t * this.m_motorImpulse + } + , + n.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y), + t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), + t(" jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false"), + t(" jd.lowerTranslation = %.15f;\n", this.m_lowerTranslation), + t(" jd.upperTranslation = %.15f;\n", this.m_upperTranslation), + t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), + t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), + t(" jd.maxMotorForce = %.15f;\n", this.m_maxMotorForce), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + n.InitVelocityConstraints_s_d = new I, + n.InitVelocityConstraints_s_P = new I, + n.SolveVelocityConstraints_s_P = new I, + n.SolveVelocityConstraints_s_f2r = new I, + n.SolveVelocityConstraints_s_f1 = new R, + n.SolveVelocityConstraints_s_df3 = new R, + n.SolveVelocityConstraints_s_df2 = new I, + n.SolvePositionConstraints_s_d = new I, + n.SolvePositionConstraints_s_impulse = new R, + n.SolvePositionConstraints_s_impulse1 = new I, + n.SolvePositionConstraints_s_P = new I, + n.GetJointTranslation_s_pA = new I, + n.GetJointTranslation_s_pB = new I, + n.GetJointTranslation_s_d = new I, + n.GetJointTranslation_s_axis = new I, + n + } + )(mi) + , Ii = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_pulleyJoint) || this; + return i.groundAnchorA = new I(-1,1), + i.groundAnchorB = new I(1,1), + i.localAnchorA = new I(-1,0), + i.localAnchorB = new I(1,0), + i.lengthA = 0, + i.lengthB = 0, + i.ratio = 1, + i.collideConnected = !0, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e, i, n, r, s, a) { + this.bodyA = t, + this.bodyB = e, + this.groundAnchorA.Copy(i), + this.groundAnchorB.Copy(n), + this.bodyA.GetLocalPoint(r, this.localAnchorA), + this.bodyB.GetLocalPoint(s, this.localAnchorB), + this.lengthA = I.DistanceVV(r, i), + this.lengthB = I.DistanceVV(s, n), + this.ratio = a + } + , + i + } + )(pi) + , Pi = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + return n.m_groundAnchorA = new I, + n.m_groundAnchorB = new I, + n.m_lengthA = 0, + n.m_lengthB = 0, + n.m_localAnchorA = new I, + n.m_localAnchorB = new I, + n.m_constant = 0, + n.m_ratio = 0, + n.m_impulse = 0, + n.m_indexA = 0, + n.m_indexB = 0, + n.m_uA = new I, + n.m_uB = new I, + n.m_rA = new I, + n.m_rB = new I, + n.m_localCenterA = new I, + n.m_localCenterB = new I, + n.m_invMassA = 0, + n.m_invMassB = 0, + n.m_invIA = 0, + n.m_invIB = 0, + n.m_mass = 0, + n.m_qA = new F, + n.m_qB = new F, + n.m_lalcA = new I, + n.m_lalcB = new I, + n.m_groundAnchorA.Copy(e(i.groundAnchorA, new I(-1,1))), + n.m_groundAnchorB.Copy(e(i.groundAnchorB, new I(1,0))), + n.m_localAnchorA.Copy(e(i.localAnchorA, new I(-1,0))), + n.m_localAnchorB.Copy(e(i.localAnchorB, new I(1,0))), + n.m_lengthA = e(i.lengthA, 0), + n.m_lengthB = e(i.lengthB, 0), + n.m_ratio = e(i.ratio, 1), + n.m_constant = e(i.lengthA, 0) + n.m_ratio * e(i.lengthB, 0), + n.m_impulse = 0, + n + } + return ti(i, t), + i.prototype.InitVelocityConstraints = function(t) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var e = t.positions[this.m_indexA].c + , n = t.positions[this.m_indexA].a + , r = t.velocities[this.m_indexA].v + , s = t.velocities[this.m_indexA].w + , a = t.positions[this.m_indexB].c + , o = t.positions[this.m_indexB].a + , h = t.velocities[this.m_indexB].v + , c = t.velocities[this.m_indexB].w + , u = this.m_qA.SetAngle(n) + , _ = this.m_qB.SetAngle(o); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), + F.MulRV(u, this.m_lalcA, this.m_rA), + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), + F.MulRV(_, this.m_lalcB, this.m_rB), + this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA), + this.m_uB.Copy(a).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB); + var f = this.m_uA.Length() + , d = this.m_uB.Length(); + f > 10 * l ? this.m_uA.SelfMul(1 / f) : this.m_uA.SetZero(), + d > 10 * l ? this.m_uB.SelfMul(1 / d) : this.m_uB.SetZero(); + var p = I.CrossVV(this.m_rA, this.m_uA) + , m = I.CrossVV(this.m_rB, this.m_uB) + , y = this.m_invMassA + this.m_invIA * p * p + , v = this.m_invMassB + this.m_invIB * m * m; + if (this.m_mass = y + this.m_ratio * this.m_ratio * v, + this.m_mass > 0 && (this.m_mass = 1 / this.m_mass), + t.step.warmStarting) { + this.m_impulse *= t.step.dtRatio; + var g = I.MulSV(-this.m_impulse, this.m_uA, i.InitVelocityConstraints_s_PA) + , A = I.MulSV(-this.m_ratio * this.m_impulse, this.m_uB, i.InitVelocityConstraints_s_PB); + r.SelfMulAdd(this.m_invMassA, g), + s += this.m_invIA * I.CrossVV(this.m_rA, g), + h.SelfMulAdd(this.m_invMassB, A), + c += this.m_invIB * I.CrossVV(this.m_rB, A) + } else + this.m_impulse = 0; + t.velocities[this.m_indexA].w = s, + t.velocities[this.m_indexB].w = c + } + , + i.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexA].v + , n = t.velocities[this.m_indexA].w + , r = t.velocities[this.m_indexB].v + , s = t.velocities[this.m_indexB].w + , a = I.AddVCrossSV(e, n, this.m_rA, i.SolveVelocityConstraints_s_vpA) + , o = I.AddVCrossSV(r, s, this.m_rB, i.SolveVelocityConstraints_s_vpB) + , l = -I.DotVV(this.m_uA, a) - this.m_ratio * I.DotVV(this.m_uB, o) + , h = -this.m_mass * l; + this.m_impulse += h; + var c = I.MulSV(-h, this.m_uA, i.SolveVelocityConstraints_s_PA) + , u = I.MulSV(-this.m_ratio * h, this.m_uB, i.SolveVelocityConstraints_s_PB); + e.SelfMulAdd(this.m_invMassA, c), + n += this.m_invIA * I.CrossVV(this.m_rA, c), + r.SelfMulAdd(this.m_invMassB, u), + s += this.m_invIB * I.CrossVV(this.m_rB, u), + t.velocities[this.m_indexA].w = n, + t.velocities[this.m_indexB].w = s + } + , + i.prototype.SolvePositionConstraints = function(t) { + var e = t.positions[this.m_indexA].c + , n = t.positions[this.m_indexA].a + , r = t.positions[this.m_indexB].c + , s = t.positions[this.m_indexB].a + , a = this.m_qA.SetAngle(n) + , o = this.m_qB.SetAngle(s); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var h = F.MulRV(a, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var c = F.MulRV(o, this.m_lalcB, this.m_rB) + , u = this.m_uA.Copy(e).SelfAdd(h).SelfSub(this.m_groundAnchorA) + , _ = this.m_uB.Copy(r).SelfAdd(c).SelfSub(this.m_groundAnchorB) + , f = u.Length() + , d = _.Length(); + f > 10 * l ? u.SelfMul(1 / f) : u.SetZero(), + d > 10 * l ? _.SelfMul(1 / d) : _.SetZero(); + var p = I.CrossVV(h, u) + , y = I.CrossVV(c, _) + , v = this.m_invMassA + this.m_invIA * p * p + , g = this.m_invMassB + this.m_invIB * y * y + , A = v + this.m_ratio * this.m_ratio * g; + A > 0 && (A = 1 / A); + var x = this.m_constant - f - this.m_ratio * d + , b = m(x) + , C = -A * x + , T = I.MulSV(-C, u, i.SolvePositionConstraints_s_PA) + , S = I.MulSV(-this.m_ratio * C, _, i.SolvePositionConstraints_s_PB); + return e.SelfMulAdd(this.m_invMassA, T), + n += this.m_invIA * I.CrossVV(h, T), + r.SelfMulAdd(this.m_invMassB, S), + s += this.m_invIB * I.CrossVV(c, S), + t.positions[this.m_indexA].a = n, + t.positions[this.m_indexB].a = s, + b < l + } + , + i.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + i.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + i.prototype.GetReactionForce = function(t, e) { + return e.x = t * this.m_impulse * this.m_uB.x, + e.y = t * this.m_impulse * this.m_uB.y, + e + } + , + i.prototype.GetReactionTorque = function() { + return 0 + } + , + i.prototype.GetGroundAnchorA = function() { + return this.m_groundAnchorA + } + , + i.prototype.GetGroundAnchorB = function() { + return this.m_groundAnchorB + } + , + i.prototype.GetLengthA = function() { + return this.m_lengthA + } + , + i.prototype.GetLengthB = function() { + return this.m_lengthB + } + , + i.prototype.GetRatio = function() { + return this.m_ratio + } + , + i.prototype.GetCurrentLengthA = function() { + var t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, i.GetCurrentLengthA_s_p) + , e = this.m_groundAnchorA; + return I.DistanceVV(t, e) + } + , + i.prototype.GetCurrentLengthB = function() { + var t = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, i.GetCurrentLengthB_s_p) + , e = this.m_groundAnchorB; + return I.DistanceVV(t, e) + } + , + i.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2PulleyJointDef = new b2PulleyJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.groundAnchorA.Set(%.15f, %.15f);\n", this.m_groundAnchorA.x, this.m_groundAnchorA.y), + t(" jd.groundAnchorB.Set(%.15f, %.15f);\n", this.m_groundAnchorB.x, this.m_groundAnchorB.y), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.lengthA = %.15f;\n", this.m_lengthA), + t(" jd.lengthB = %.15f;\n", this.m_lengthB), + t(" jd.ratio = %.15f;\n", this.m_ratio), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + i.prototype.ShiftOrigin = function(t) { + this.m_groundAnchorA.SelfSub(t), + this.m_groundAnchorB.SelfSub(t) + } + , + i.InitVelocityConstraints_s_PA = new I, + i.InitVelocityConstraints_s_PB = new I, + i.SolveVelocityConstraints_s_vpA = new I, + i.SolveVelocityConstraints_s_vpB = new I, + i.SolveVelocityConstraints_s_PA = new I, + i.SolveVelocityConstraints_s_PB = new I, + i.SolvePositionConstraints_s_PA = new I, + i.SolvePositionConstraints_s_PB = new I, + i.GetCurrentLengthA_s_p = new I, + i.GetCurrentLengthB_s_p = new I, + i + } + )(mi) + , Ri = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_revoluteJoint) || this; + return i.localAnchorA = new I(0,0), + i.localAnchorB = new I(0,0), + i.referenceAngle = 0, + i.enableLimit = !1, + i.lowerAngle = 0, + i.upperAngle = 0, + i.enableMotor = !1, + i.motorSpeed = 0, + i.maxMotorTorque = 0, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e, i) { + this.bodyA = t, + this.bodyB = e, + this.bodyA.GetLocalPoint(i, this.localAnchorA), + this.bodyB.GetLocalPoint(i, this.localAnchorB), + this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle() + } + , + i + } + )(pi) + , Oi = (function(i) { + function n(n) { + var r = i.call(this, n) || this; + return r.m_localAnchorA = new I, + r.m_localAnchorB = new I, + r.m_impulse = new R, + r.m_motorImpulse = 0, + r.m_enableMotor = !1, + r.m_maxMotorTorque = 0, + r.m_motorSpeed = 0, + r.m_enableLimit = !1, + r.m_referenceAngle = 0, + r.m_lowerAngle = 0, + r.m_upperAngle = 0, + r.m_indexA = 0, + r.m_indexB = 0, + r.m_rA = new I, + r.m_rB = new I, + r.m_localCenterA = new I, + r.m_localCenterB = new I, + r.m_invMassA = 0, + r.m_invMassB = 0, + r.m_invIA = 0, + r.m_invIB = 0, + r.m_mass = new L, + r.m_motorMass = 0, + r.m_limitState = t.b2LimitState.e_inactiveLimit, + r.m_qA = new F, + r.m_qB = new F, + r.m_lalcA = new I, + r.m_lalcB = new I, + r.m_K = new O, + r.m_localAnchorA.Copy(e(n.localAnchorA, I.ZERO)), + r.m_localAnchorB.Copy(e(n.localAnchorB, I.ZERO)), + r.m_referenceAngle = e(n.referenceAngle, 0), + r.m_impulse.SetZero(), + r.m_motorImpulse = 0, + r.m_lowerAngle = e(n.lowerAngle, 0), + r.m_upperAngle = e(n.upperAngle, 0), + r.m_maxMotorTorque = e(n.maxMotorTorque, 0), + r.m_motorSpeed = e(n.motorSpeed, 0), + r.m_enableLimit = e(n.enableLimit, !1), + r.m_enableMotor = e(n.enableMotor, !1), + r.m_limitState = t.b2LimitState.e_inactiveLimit, + r + } + return ti(n, i), + n.prototype.InitVelocityConstraints = function(e) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var i = e.positions[this.m_indexA].a + , r = e.velocities[this.m_indexA].v + , s = e.velocities[this.m_indexA].w + , a = e.positions[this.m_indexB].a + , o = e.velocities[this.m_indexB].v + , l = e.velocities[this.m_indexB].w + , c = this.m_qA.SetAngle(i) + , u = this.m_qB.SetAngle(a); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), + F.MulRV(c, this.m_lalcA, this.m_rA), + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), + F.MulRV(u, this.m_lalcB, this.m_rB); + var _ = this.m_invMassA + , f = this.m_invMassB + , d = this.m_invIA + , p = this.m_invIB + , y = d + p === 0; + if (this.m_mass.ex.x = _ + f + this.m_rA.y * this.m_rA.y * d + this.m_rB.y * this.m_rB.y * p, + this.m_mass.ey.x = -this.m_rA.y * this.m_rA.x * d - this.m_rB.y * this.m_rB.x * p, + this.m_mass.ez.x = -this.m_rA.y * d - this.m_rB.y * p, + this.m_mass.ex.y = this.m_mass.ey.x, + this.m_mass.ey.y = _ + f + this.m_rA.x * this.m_rA.x * d + this.m_rB.x * this.m_rB.x * p, + this.m_mass.ez.y = this.m_rA.x * d + this.m_rB.x * p, + this.m_mass.ex.z = this.m_mass.ez.x, + this.m_mass.ey.z = this.m_mass.ez.y, + this.m_mass.ez.z = d + p, + this.m_motorMass = d + p, + this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass), + this.m_enableMotor && !y || (this.m_motorImpulse = 0), + this.m_enableLimit && !y) { + var v = a - i - this.m_referenceAngle; + m(this.m_upperAngle - this.m_lowerAngle) < 2 * h ? this.m_limitState = t.b2LimitState.e_equalLimits : v <= this.m_lowerAngle ? (this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_impulse.z = 0), + this.m_limitState = t.b2LimitState.e_atLowerLimit) : v >= this.m_upperAngle ? (this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = 0), + this.m_limitState = t.b2LimitState.e_atUpperLimit) : (this.m_limitState = t.b2LimitState.e_inactiveLimit, + this.m_impulse.z = 0) + } else + this.m_limitState = t.b2LimitState.e_inactiveLimit; + if (e.step.warmStarting) { + this.m_impulse.SelfMul(e.step.dtRatio), + this.m_motorImpulse *= e.step.dtRatio; + var g = n.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y); + r.SelfMulSub(_, g), + s -= d * (I.CrossVV(this.m_rA, g) + this.m_motorImpulse + this.m_impulse.z), + o.SelfMulAdd(f, g), + l += p * (I.CrossVV(this.m_rB, g) + this.m_motorImpulse + this.m_impulse.z) + } else + this.m_impulse.SetZero(), + this.m_motorImpulse = 0; + e.velocities[this.m_indexA].w = s, + e.velocities[this.m_indexB].w = l + } + , + n.prototype.SolveVelocityConstraints = function(e) { + var i = e.velocities[this.m_indexA].v + , r = e.velocities[this.m_indexA].w + , s = e.velocities[this.m_indexB].v + , a = e.velocities[this.m_indexB].w + , o = this.m_invMassA + , l = this.m_invMassB + , h = this.m_invIA + , c = this.m_invIB + , u = h + c === 0; + if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits && !u) { + var _ = a - r - this.m_motorSpeed + , f = -this.m_motorMass * _ + , d = this.m_motorImpulse + , p = e.step.dt * this.m_maxMotorTorque; + this.m_motorImpulse = g(this.m_motorImpulse + f, -p, p), + r -= h * (f = this.m_motorImpulse - d), + a += c * f + } + if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !u) { + var m = I.SubVV(I.AddVCrossSV(s, a, this.m_rB, I.s_t0), I.AddVCrossSV(i, r, this.m_rA, I.s_t1), n.SolveVelocityConstraints_s_Cdot1) + , y = a - r + , v = this.m_mass.Solve33(m.x, m.y, y, n.SolveVelocityConstraints_s_impulse_v3).SelfNeg(); + if (this.m_limitState === t.b2LimitState.e_equalLimits) + this.m_impulse.SelfAdd(v); + else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) + if (this.m_impulse.z + v.z < 0) { + var A = -m.x + this.m_impulse.z * this.m_mass.ez.x + , x = -m.y + this.m_impulse.z * this.m_mass.ez.y + , b = this.m_mass.Solve22(A, x, n.SolveVelocityConstraints_s_reduced_v2); + v.x = b.x, + v.y = b.y, + v.z = -this.m_impulse.z, + this.m_impulse.x += b.x, + this.m_impulse.y += b.y, + this.m_impulse.z = 0 + } else + this.m_impulse.SelfAdd(v); + else + this.m_limitState === t.b2LimitState.e_atUpperLimit && (this.m_impulse.z + v.z > 0 ? (A = -m.x + this.m_impulse.z * this.m_mass.ez.x, + x = -m.y + this.m_impulse.z * this.m_mass.ez.y, + b = this.m_mass.Solve22(A, x, n.SolveVelocityConstraints_s_reduced_v2), + v.x = b.x, + v.y = b.y, + v.z = -this.m_impulse.z, + this.m_impulse.x += b.x, + this.m_impulse.y += b.y, + this.m_impulse.z = 0) : this.m_impulse.SelfAdd(v)); + var C = n.SolveVelocityConstraints_s_P.Set(v.x, v.y); + i.SelfMulSub(o, C), + r -= h * (I.CrossVV(this.m_rA, C) + v.z), + s.SelfMulAdd(l, C), + a += c * (I.CrossVV(this.m_rB, C) + v.z) + } else { + var T = I.SubVV(I.AddVCrossSV(s, a, this.m_rB, I.s_t0), I.AddVCrossSV(i, r, this.m_rA, I.s_t1), n.SolveVelocityConstraints_s_Cdot_v2) + , S = this.m_mass.Solve22(-T.x, -T.y, n.SolveVelocityConstraints_s_impulse_v2); + this.m_impulse.x += S.x, + this.m_impulse.y += S.y, + i.SelfMulSub(o, S), + r -= h * I.CrossVV(this.m_rA, S), + s.SelfMulAdd(l, S), + a += c * I.CrossVV(this.m_rB, S) + } + e.velocities[this.m_indexA].w = r, + e.velocities[this.m_indexB].w = a + } + , + n.prototype.SolvePositionConstraints = function(e) { + var i, r = e.positions[this.m_indexA].c, s = e.positions[this.m_indexA].a, a = e.positions[this.m_indexB].c, o = e.positions[this.m_indexB].a, c = this.m_qA.SetAngle(s), u = this.m_qB.SetAngle(o), _ = 0, f = this.m_invIA + this.m_invIB === 0; + if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !f) { + var d = o - s - this.m_referenceAngle + , p = 0; + if (this.m_limitState === t.b2LimitState.e_equalLimits) { + var y = g(d - this.m_lowerAngle, -.13962634015955555, .13962634015955555); + p = -this.m_motorMass * y, + _ = m(y) + } else + this.m_limitState === t.b2LimitState.e_atLowerLimit ? (_ = -(y = d - this.m_lowerAngle), + y = g(y + h, -.13962634015955555, 0), + p = -this.m_motorMass * y) : this.m_limitState === t.b2LimitState.e_atUpperLimit && (_ = y = d - this.m_upperAngle, + y = g(y - h, 0, .13962634015955555), + p = -this.m_motorMass * y); + s -= this.m_invIA * p, + o += this.m_invIB * p + } + c.SetAngle(s), + u.SetAngle(o), + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var v = F.MulRV(c, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var A = F.MulRV(u, this.m_lalcB, this.m_rB) + , x = I.SubVV(I.AddVV(a, A, I.s_t0), I.AddVV(r, v, I.s_t1), n.SolvePositionConstraints_s_C_v2); + i = x.Length(); + var b = this.m_invMassA + , C = this.m_invMassB + , T = this.m_invIA + , S = this.m_invIB + , w = this.m_K; + w.ex.x = b + C + T * v.y * v.y + S * A.y * A.y, + w.ex.y = -T * v.x * v.y - S * A.x * A.y, + w.ey.x = w.ex.y, + w.ey.y = b + C + T * v.x * v.x + S * A.x * A.x; + var E = w.Solve(x.x, x.y, n.SolvePositionConstraints_s_impulse).SelfNeg(); + return r.SelfMulSub(b, E), + s -= T * I.CrossVV(v, E), + a.SelfMulAdd(C, E), + o += S * I.CrossVV(A, E), + e.positions[this.m_indexA].a = s, + e.positions[this.m_indexB].a = o, + i <= l && _ <= h + } + , + n.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + n.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + n.prototype.GetReactionForce = function(t, e) { + return e.x = t * this.m_impulse.x, + e.y = t * this.m_impulse.y, + e + } + , + n.prototype.GetReactionTorque = function(t) { + return t * this.m_impulse.z + } + , + n.prototype.GetLocalAnchorA = function() { + return this.m_localAnchorA + } + , + n.prototype.GetLocalAnchorB = function() { + return this.m_localAnchorB + } + , + n.prototype.GetReferenceAngle = function() { + return this.m_referenceAngle + } + , + n.prototype.GetJointAngle = function() { + return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a - this.m_referenceAngle + } + , + n.prototype.GetJointSpeed = function() { + return this.m_bodyB.m_angularVelocity - this.m_bodyA.m_angularVelocity + } + , + n.prototype.IsMotorEnabled = function() { + return this.m_enableMotor + } + , + n.prototype.EnableMotor = function(t) { + t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_enableMotor = t) + } + , + n.prototype.GetMotorTorque = function(t) { + return t * this.m_motorImpulse + } + , + n.prototype.GetMotorSpeed = function() { + return this.m_motorSpeed + } + , + n.prototype.SetMaxMotorTorque = function(t) { + t !== this.m_maxMotorTorque && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_maxMotorTorque = t) + } + , + n.prototype.GetMaxMotorTorque = function() { + return this.m_maxMotorTorque + } + , + n.prototype.IsLimitEnabled = function() { + return this.m_enableLimit + } + , + n.prototype.EnableLimit = function(t) { + t !== this.m_enableLimit && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_enableLimit = t, + this.m_impulse.z = 0) + } + , + n.prototype.GetLowerLimit = function() { + return this.m_lowerAngle + } + , + n.prototype.GetUpperLimit = function() { + return this.m_upperAngle + } + , + n.prototype.SetLimits = function(t, e) { + t === this.m_lowerAngle && e === this.m_upperAngle || (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_impulse.z = 0, + this.m_lowerAngle = t, + this.m_upperAngle = e) + } + , + n.prototype.SetMotorSpeed = function(t) { + t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_motorSpeed = t) + } + , + n.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), + t(" jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false"), + t(" jd.lowerAngle = %.15f;\n", this.m_lowerAngle), + t(" jd.upperAngle = %.15f;\n", this.m_upperAngle), + t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), + t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), + t(" jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + n.InitVelocityConstraints_s_P = new I, + n.SolveVelocityConstraints_s_P = new I, + n.SolveVelocityConstraints_s_Cdot_v2 = new I, + n.SolveVelocityConstraints_s_Cdot1 = new I, + n.SolveVelocityConstraints_s_impulse_v3 = new R, + n.SolveVelocityConstraints_s_reduced_v2 = new I, + n.SolveVelocityConstraints_s_impulse_v2 = new I, + n.SolvePositionConstraints_s_C_v2 = new I, + n.SolvePositionConstraints_s_impulse = new I, + n + } + )(mi) + , Li = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_ropeJoint) || this; + return i.localAnchorA = new I(-1,0), + i.localAnchorB = new I(1,0), + i.maxLength = 0, + i + } + return ti(i, e), + i + } + )(pi) + , Fi = (function(i) { + function n(n) { + var r = i.call(this, n) || this; + return r.m_localAnchorA = new I, + r.m_localAnchorB = new I, + r.m_maxLength = 0, + r.m_length = 0, + r.m_impulse = 0, + r.m_indexA = 0, + r.m_indexB = 0, + r.m_u = new I, + r.m_rA = new I, + r.m_rB = new I, + r.m_localCenterA = new I, + r.m_localCenterB = new I, + r.m_invMassA = 0, + r.m_invMassB = 0, + r.m_invIA = 0, + r.m_invIB = 0, + r.m_mass = 0, + r.m_state = t.b2LimitState.e_inactiveLimit, + r.m_qA = new F, + r.m_qB = new F, + r.m_lalcA = new I, + r.m_lalcB = new I, + r.m_localAnchorA.Copy(e(n.localAnchorA, new I(-1,0))), + r.m_localAnchorB.Copy(e(n.localAnchorB, new I(1,0))), + r.m_maxLength = e(n.maxLength, 0), + r + } + return ti(n, i), + n.prototype.InitVelocityConstraints = function(e) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var i = e.positions[this.m_indexA].c + , r = e.positions[this.m_indexA].a + , s = e.velocities[this.m_indexA].v + , a = e.velocities[this.m_indexA].w + , o = e.positions[this.m_indexB].c + , h = e.positions[this.m_indexB].a + , c = e.velocities[this.m_indexB].v + , u = e.velocities[this.m_indexB].w + , _ = this.m_qA.SetAngle(r) + , f = this.m_qB.SetAngle(h); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), + F.MulRV(_, this.m_lalcA, this.m_rA), + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), + F.MulRV(f, this.m_lalcB, this.m_rB), + this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA), + this.m_length = this.m_u.Length(); + var d = this.m_length - this.m_maxLength; + if (this.m_state = d > 0 ? t.b2LimitState.e_atUpperLimit : t.b2LimitState.e_inactiveLimit, + !(this.m_length > l)) + return this.m_u.SetZero(), + this.m_mass = 0, + void (this.m_impulse = 0); + this.m_u.SelfMul(1 / this.m_length); + var p = I.CrossVV(this.m_rA, this.m_u) + , m = I.CrossVV(this.m_rB, this.m_u) + , y = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m; + if (this.m_mass = 0 !== y ? 1 / y : 0, + e.step.warmStarting) { + this.m_impulse *= e.step.dtRatio; + var v = I.MulSV(this.m_impulse, this.m_u, n.InitVelocityConstraints_s_P); + s.SelfMulSub(this.m_invMassA, v), + a -= this.m_invIA * I.CrossVV(this.m_rA, v), + c.SelfMulAdd(this.m_invMassB, v), + u += this.m_invIB * I.CrossVV(this.m_rB, v) + } else + this.m_impulse = 0; + e.velocities[this.m_indexA].w = a, + e.velocities[this.m_indexB].w = u + } + , + n.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexA].v + , i = t.velocities[this.m_indexA].w + , r = t.velocities[this.m_indexB].v + , s = t.velocities[this.m_indexB].w + , a = I.AddVCrossSV(e, i, this.m_rA, n.SolveVelocityConstraints_s_vpA) + , o = I.AddVCrossSV(r, s, this.m_rB, n.SolveVelocityConstraints_s_vpB) + , l = this.m_length - this.m_maxLength + , h = I.DotVV(this.m_u, I.SubVV(o, a, I.s_t0)); + l < 0 && (h += t.step.inv_dt * l); + var c = -this.m_mass * h + , u = this.m_impulse; + this.m_impulse = y(0, this.m_impulse + c), + c = this.m_impulse - u; + var _ = I.MulSV(c, this.m_u, n.SolveVelocityConstraints_s_P); + e.SelfMulSub(this.m_invMassA, _), + i -= this.m_invIA * I.CrossVV(this.m_rA, _), + r.SelfMulAdd(this.m_invMassB, _), + s += this.m_invIB * I.CrossVV(this.m_rB, _), + t.velocities[this.m_indexA].w = i, + t.velocities[this.m_indexB].w = s + } + , + n.prototype.SolvePositionConstraints = function(t) { + var e = t.positions[this.m_indexA].c + , i = t.positions[this.m_indexA].a + , r = t.positions[this.m_indexB].c + , s = t.positions[this.m_indexB].a + , a = this.m_qA.SetAngle(i) + , o = this.m_qB.SetAngle(s); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var h = F.MulRV(a, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var c = F.MulRV(o, this.m_lalcB, this.m_rB) + , u = this.m_u.Copy(r).SelfAdd(c).SelfSub(e).SelfSub(h) + , _ = u.Normalize() + , f = _ - this.m_maxLength; + f = g(f, 0, .2); + var d = -this.m_mass * f + , p = I.MulSV(d, u, n.SolvePositionConstraints_s_P); + return e.SelfMulSub(this.m_invMassA, p), + i -= this.m_invIA * I.CrossVV(h, p), + r.SelfMulAdd(this.m_invMassB, p), + s += this.m_invIB * I.CrossVV(c, p), + t.positions[this.m_indexA].a = i, + t.positions[this.m_indexB].a = s, + _ - this.m_maxLength < l + } + , + n.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + n.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + n.prototype.GetReactionForce = function(t, e) { + return I.MulSV(t * this.m_impulse, this.m_u, e) + } + , + n.prototype.GetReactionTorque = function() { + return 0 + } + , + n.prototype.GetLocalAnchorA = function() { + return this.m_localAnchorA + } + , + n.prototype.GetLocalAnchorB = function() { + return this.m_localAnchorB + } + , + n.prototype.SetMaxLength = function(t) { + this.m_maxLength = t + } + , + n.prototype.GetMaxLength = function() { + return this.m_maxLength + } + , + n.prototype.GetLimitState = function() { + return this.m_state + } + , + n.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2RopeJointDef = new b2RopeJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.maxLength = %.15f;\n", this.m_maxLength), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + n.InitVelocityConstraints_s_P = new I, + n.SolveVelocityConstraints_s_vpA = new I, + n.SolveVelocityConstraints_s_vpB = new I, + n.SolveVelocityConstraints_s_P = new I, + n.SolvePositionConstraints_s_P = new I, + n + } + )(mi) + , Vi = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_weldJoint) || this; + return i.localAnchorA = new I, + i.localAnchorB = new I, + i.referenceAngle = 0, + i.frequencyHz = 0, + i.dampingRatio = 0, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e, i) { + this.bodyA = t, + this.bodyB = e, + this.bodyA.GetLocalPoint(i, this.localAnchorA), + this.bodyB.GetLocalPoint(i, this.localAnchorB), + this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle() + } + , + i + } + )(pi) + , Ni = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + return n.m_frequencyHz = 0, + n.m_dampingRatio = 0, + n.m_bias = 0, + n.m_localAnchorA = new I, + n.m_localAnchorB = new I, + n.m_referenceAngle = 0, + n.m_gamma = 0, + n.m_impulse = new R(0,0,0), + n.m_indexA = 0, + n.m_indexB = 0, + n.m_rA = new I, + n.m_rB = new I, + n.m_localCenterA = new I, + n.m_localCenterB = new I, + n.m_invMassA = 0, + n.m_invMassB = 0, + n.m_invIA = 0, + n.m_invIB = 0, + n.m_mass = new L, + n.m_qA = new F, + n.m_qB = new F, + n.m_lalcA = new I, + n.m_lalcB = new I, + n.m_K = new L, + n.m_frequencyHz = e(i.frequencyHz, 0), + n.m_dampingRatio = e(i.dampingRatio, 0), + n.m_localAnchorA.Copy(e(i.localAnchorA, I.ZERO)), + n.m_localAnchorB.Copy(e(i.localAnchorB, I.ZERO)), + n.m_referenceAngle = e(i.referenceAngle, 0), + n.m_impulse.SetZero(), + n + } + return ti(i, t), + i.prototype.InitVelocityConstraints = function(t) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var e = t.positions[this.m_indexA].a + , n = t.velocities[this.m_indexA].v + , r = t.velocities[this.m_indexA].w + , a = t.positions[this.m_indexB].a + , o = t.velocities[this.m_indexB].v + , l = t.velocities[this.m_indexB].w + , h = this.m_qA.SetAngle(e) + , c = this.m_qB.SetAngle(a); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA), + F.MulRV(h, this.m_lalcA, this.m_rA), + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB), + F.MulRV(c, this.m_lalcB, this.m_rB); + var u = this.m_invMassA + , _ = this.m_invMassB + , f = this.m_invIA + , d = this.m_invIB + , p = this.m_K; + if (p.ex.x = u + _ + this.m_rA.y * this.m_rA.y * f + this.m_rB.y * this.m_rB.y * d, + p.ey.x = -this.m_rA.y * this.m_rA.x * f - this.m_rB.y * this.m_rB.x * d, + p.ez.x = -this.m_rA.y * f - this.m_rB.y * d, + p.ex.y = p.ey.x, + p.ey.y = u + _ + this.m_rA.x * this.m_rA.x * f + this.m_rB.x * this.m_rB.x * d, + p.ez.y = this.m_rA.x * f + this.m_rB.x * d, + p.ex.z = p.ez.x, + p.ey.z = p.ez.y, + p.ez.z = f + d, + this.m_frequencyHz > 0) { + p.GetInverse22(this.m_mass); + var m = f + d + , y = m > 0 ? 1 / m : 0 + , v = a - e - this.m_referenceAngle + , g = 2 * s * this.m_frequencyHz + , A = 2 * y * this.m_dampingRatio * g + , x = y * g * g + , b = t.step.dt; + this.m_gamma = b * (A + b * x), + this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0, + this.m_bias = v * b * x * this.m_gamma, + m += this.m_gamma, + this.m_mass.ez.z = 0 !== m ? 1 / m : 0 + } else + p.GetSymInverse33(this.m_mass), + this.m_gamma = 0, + this.m_bias = 0; + if (t.step.warmStarting) { + this.m_impulse.SelfMul(t.step.dtRatio); + var C = i.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y); + n.SelfMulSub(u, C), + r -= f * (I.CrossVV(this.m_rA, C) + this.m_impulse.z), + o.SelfMulAdd(_, C), + l += d * (I.CrossVV(this.m_rB, C) + this.m_impulse.z) + } else + this.m_impulse.SetZero(); + t.velocities[this.m_indexA].w = r, + t.velocities[this.m_indexB].w = l + } + , + i.prototype.SolveVelocityConstraints = function(t) { + var e = t.velocities[this.m_indexA].v + , n = t.velocities[this.m_indexA].w + , r = t.velocities[this.m_indexB].v + , s = t.velocities[this.m_indexB].w + , a = this.m_invMassA + , o = this.m_invMassB + , l = this.m_invIA + , h = this.m_invIB; + if (this.m_frequencyHz > 0) { + var c = s - n + , u = -this.m_mass.ez.z * (c + this.m_bias + this.m_gamma * this.m_impulse.z); + this.m_impulse.z += u, + n -= l * u, + s += h * u; + var _ = I.SubVV(I.AddVCrossSV(r, s, this.m_rB, I.s_t0), I.AddVCrossSV(e, n, this.m_rA, I.s_t1), i.SolveVelocityConstraints_s_Cdot1) + , f = L.MulM33XY(this.m_mass, _.x, _.y, i.SolveVelocityConstraints_s_impulse1).SelfNeg(); + this.m_impulse.x += f.x, + this.m_impulse.y += f.y; + var d = f; + e.SelfMulSub(a, d), + n -= l * I.CrossVV(this.m_rA, d), + r.SelfMulAdd(o, d), + s += h * I.CrossVV(this.m_rB, d) + } else { + _ = I.SubVV(I.AddVCrossSV(r, s, this.m_rB, I.s_t0), I.AddVCrossSV(e, n, this.m_rA, I.s_t1), i.SolveVelocityConstraints_s_Cdot1), + c = s - n; + var p = L.MulM33XYZ(this.m_mass, _.x, _.y, c, i.SolveVelocityConstraints_s_impulse).SelfNeg(); + this.m_impulse.SelfAdd(p), + d = i.SolveVelocityConstraints_s_P.Set(p.x, p.y), + e.SelfMulSub(a, d), + n -= l * (I.CrossVV(this.m_rA, d) + p.z), + r.SelfMulAdd(o, d), + s += h * (I.CrossVV(this.m_rB, d) + p.z) + } + t.velocities[this.m_indexA].w = n, + t.velocities[this.m_indexB].w = s + } + , + i.prototype.SolvePositionConstraints = function(t) { + var e = t.positions[this.m_indexA].c + , n = t.positions[this.m_indexA].a + , r = t.positions[this.m_indexB].c + , s = t.positions[this.m_indexB].a + , a = this.m_qA.SetAngle(n) + , o = this.m_qB.SetAngle(s) + , c = this.m_invMassA + , u = this.m_invMassB + , _ = this.m_invIA + , f = this.m_invIB; + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var d = F.MulRV(a, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var p, y, v = F.MulRV(o, this.m_lalcB, this.m_rB), g = this.m_K; + if (g.ex.x = c + u + d.y * d.y * _ + v.y * v.y * f, + g.ey.x = -d.y * d.x * _ - v.y * v.x * f, + g.ez.x = -d.y * _ - v.y * f, + g.ex.y = g.ey.x, + g.ey.y = c + u + d.x * d.x * _ + v.x * v.x * f, + g.ez.y = d.x * _ + v.x * f, + g.ex.z = g.ez.x, + g.ey.z = g.ez.y, + g.ez.z = _ + f, + this.m_frequencyHz > 0) { + p = (x = I.SubVV(I.AddVV(r, v, I.s_t0), I.AddVV(e, d, I.s_t1), i.SolvePositionConstraints_s_C1)).Length(), + y = 0; + var A = g.Solve22(x.x, x.y, i.SolvePositionConstraints_s_P).SelfNeg(); + e.SelfMulSub(c, A), + n -= _ * I.CrossVV(d, A), + r.SelfMulAdd(u, A), + s += f * I.CrossVV(v, A) + } else { + var x = I.SubVV(I.AddVV(r, v, I.s_t0), I.AddVV(e, d, I.s_t1), i.SolvePositionConstraints_s_C1) + , b = s - n - this.m_referenceAngle; + p = x.Length(), + y = m(b); + var C = g.Solve33(x.x, x.y, b, i.SolvePositionConstraints_s_impulse).SelfNeg(); + A = i.SolvePositionConstraints_s_P.Set(C.x, C.y), + e.SelfMulSub(c, A), + n -= _ * (I.CrossVV(this.m_rA, A) + C.z), + r.SelfMulAdd(u, A), + s += f * (I.CrossVV(this.m_rB, A) + C.z) + } + return t.positions[this.m_indexA].a = n, + t.positions[this.m_indexB].a = s, + p <= l && y <= h + } + , + i.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + i.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + i.prototype.GetReactionForce = function(t, e) { + return e.x = t * this.m_impulse.x, + e.y = t * this.m_impulse.y, + e + } + , + i.prototype.GetReactionTorque = function(t) { + return t * this.m_impulse.z + } + , + i.prototype.GetLocalAnchorA = function() { + return this.m_localAnchorA + } + , + i.prototype.GetLocalAnchorB = function() { + return this.m_localAnchorB + } + , + i.prototype.GetReferenceAngle = function() { + return this.m_referenceAngle + } + , + i.prototype.SetFrequency = function(t) { + this.m_frequencyHz = t + } + , + i.prototype.GetFrequency = function() { + return this.m_frequencyHz + } + , + i.prototype.SetDampingRatio = function(t) { + this.m_dampingRatio = t + } + , + i.prototype.GetDampingRatio = function() { + return this.m_dampingRatio + } + , + i.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.referenceAngle = %.15f;\n", this.m_referenceAngle), + t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), + t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + i.InitVelocityConstraints_s_P = new I, + i.SolveVelocityConstraints_s_Cdot1 = new I, + i.SolveVelocityConstraints_s_impulse1 = new I, + i.SolveVelocityConstraints_s_impulse = new R, + i.SolveVelocityConstraints_s_P = new I, + i.SolvePositionConstraints_s_C1 = new I, + i.SolvePositionConstraints_s_P = new I, + i.SolvePositionConstraints_s_impulse = new R, + i + } + )(mi) + , ki = (function(e) { + function i() { + var i = e.call(this, t.b2JointType.e_wheelJoint) || this; + return i.localAnchorA = new I(0,0), + i.localAnchorB = new I(0,0), + i.localAxisA = new I(1,0), + i.enableMotor = !1, + i.maxMotorTorque = 0, + i.motorSpeed = 0, + i.frequencyHz = 2, + i.dampingRatio = .7, + i + } + return ti(i, e), + i.prototype.Initialize = function(t, e, i, n) { + this.bodyA = t, + this.bodyB = e, + this.bodyA.GetLocalPoint(i, this.localAnchorA), + this.bodyB.GetLocalPoint(i, this.localAnchorB), + this.bodyA.GetLocalVector(n, this.localAxisA) + } + , + i + } + )(pi) + , Gi = (function(t) { + function i(i) { + var n = t.call(this, i) || this; + return n.m_frequencyHz = 0, + n.m_dampingRatio = 0, + n.m_localAnchorA = new I, + n.m_localAnchorB = new I, + n.m_localXAxisA = new I, + n.m_localYAxisA = new I, + n.m_impulse = 0, + n.m_motorImpulse = 0, + n.m_springImpulse = 0, + n.m_maxMotorTorque = 0, + n.m_motorSpeed = 0, + n.m_enableMotor = !1, + n.m_indexA = 0, + n.m_indexB = 0, + n.m_localCenterA = new I, + n.m_localCenterB = new I, + n.m_invMassA = 0, + n.m_invMassB = 0, + n.m_invIA = 0, + n.m_invIB = 0, + n.m_ax = new I, + n.m_ay = new I, + n.m_sAx = 0, + n.m_sBx = 0, + n.m_sAy = 0, + n.m_sBy = 0, + n.m_mass = 0, + n.m_motorMass = 0, + n.m_springMass = 0, + n.m_bias = 0, + n.m_gamma = 0, + n.m_qA = new F, + n.m_qB = new F, + n.m_lalcA = new I, + n.m_lalcB = new I, + n.m_rA = new I, + n.m_rB = new I, + n.m_frequencyHz = e(i.frequencyHz, 2), + n.m_dampingRatio = e(i.dampingRatio, .7), + n.m_localAnchorA.Copy(e(i.localAnchorA, I.ZERO)), + n.m_localAnchorB.Copy(e(i.localAnchorB, I.ZERO)), + n.m_localXAxisA.Copy(e(i.localAxisA, I.UNITX)), + I.CrossOneV(n.m_localXAxisA, n.m_localYAxisA), + n.m_maxMotorTorque = e(i.maxMotorTorque, 0), + n.m_motorSpeed = e(i.motorSpeed, 0), + n.m_enableMotor = e(i.enableMotor, !1), + n.m_ax.SetZero(), + n.m_ay.SetZero(), + n + } + return ti(i, t), + i.prototype.GetMotorSpeed = function() { + return this.m_motorSpeed + } + , + i.prototype.GetMaxMotorTorque = function() { + return this.m_maxMotorTorque + } + , + i.prototype.SetSpringFrequencyHz = function(t) { + this.m_frequencyHz = t + } + , + i.prototype.GetSpringFrequencyHz = function() { + return this.m_frequencyHz + } + , + i.prototype.SetSpringDampingRatio = function(t) { + this.m_dampingRatio = t + } + , + i.prototype.GetSpringDampingRatio = function() { + return this.m_dampingRatio + } + , + i.prototype.InitVelocityConstraints = function(t) { + this.m_indexA = this.m_bodyA.m_islandIndex, + this.m_indexB = this.m_bodyB.m_islandIndex, + this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter), + this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter), + this.m_invMassA = this.m_bodyA.m_invMass, + this.m_invMassB = this.m_bodyB.m_invMass, + this.m_invIA = this.m_bodyA.m_invI, + this.m_invIB = this.m_bodyB.m_invI; + var e = this.m_invMassA + , n = this.m_invMassB + , r = this.m_invIA + , a = this.m_invIB + , o = t.positions[this.m_indexA].c + , l = t.positions[this.m_indexA].a + , h = t.velocities[this.m_indexA].v + , c = t.velocities[this.m_indexA].w + , u = t.positions[this.m_indexB].c + , _ = t.positions[this.m_indexB].a + , f = t.velocities[this.m_indexB].v + , d = t.velocities[this.m_indexB].w + , p = this.m_qA.SetAngle(l) + , m = this.m_qB.SetAngle(_); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var y = F.MulRV(p, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var v = F.MulRV(m, this.m_lalcB, this.m_rB) + , g = I.SubVV(I.AddVV(u, v, I.s_t0), I.AddVV(o, y, I.s_t1), i.InitVelocityConstraints_s_d); + if (F.MulRV(p, this.m_localYAxisA, this.m_ay), + this.m_sAy = I.CrossVV(I.AddVV(g, y, I.s_t0), this.m_ay), + this.m_sBy = I.CrossVV(v, this.m_ay), + this.m_mass = e + n + r * this.m_sAy * this.m_sAy + a * this.m_sBy * this.m_sBy, + this.m_mass > 0 && (this.m_mass = 1 / this.m_mass), + this.m_springMass = 0, + this.m_bias = 0, + this.m_gamma = 0, + this.m_frequencyHz > 0) { + F.MulRV(p, this.m_localXAxisA, this.m_ax), + this.m_sAx = I.CrossVV(I.AddVV(g, y, I.s_t0), this.m_ax), + this.m_sBx = I.CrossVV(v, this.m_ax); + var A = e + n + r * this.m_sAx * this.m_sAx + a * this.m_sBx * this.m_sBx; + if (A > 0) { + this.m_springMass = 1 / A; + var x = I.DotVV(g, this.m_ax) + , b = 2 * s * this.m_frequencyHz + , C = 2 * this.m_springMass * this.m_dampingRatio * b + , T = this.m_springMass * b * b + , S = t.step.dt; + this.m_gamma = S * (C + S * T), + this.m_gamma > 0 && (this.m_gamma = 1 / this.m_gamma), + this.m_bias = x * S * T * this.m_gamma, + this.m_springMass = A + this.m_gamma, + this.m_springMass > 0 && (this.m_springMass = 1 / this.m_springMass) + } + } else + this.m_springImpulse = 0; + if (this.m_enableMotor ? (this.m_motorMass = r + a, + this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass)) : (this.m_motorMass = 0, + this.m_motorImpulse = 0), + t.step.warmStarting) { + this.m_impulse *= t.step.dtRatio, + this.m_springImpulse *= t.step.dtRatio, + this.m_motorImpulse *= t.step.dtRatio; + var w = I.AddVV(I.MulSV(this.m_impulse, this.m_ay, I.s_t0), I.MulSV(this.m_springImpulse, this.m_ax, I.s_t1), i.InitVelocityConstraints_s_P) + , E = this.m_impulse * this.m_sAy + this.m_springImpulse * this.m_sAx + this.m_motorImpulse + , M = this.m_impulse * this.m_sBy + this.m_springImpulse * this.m_sBx + this.m_motorImpulse; + h.SelfMulSub(this.m_invMassA, w), + c -= this.m_invIA * E, + f.SelfMulAdd(this.m_invMassB, w), + d += this.m_invIB * M + } else + this.m_impulse = 0, + this.m_springImpulse = 0, + this.m_motorImpulse = 0; + t.velocities[this.m_indexA].w = c, + t.velocities[this.m_indexB].w = d + } + , + i.prototype.SolveVelocityConstraints = function(t) { + var e = this.m_invMassA + , n = this.m_invMassB + , r = this.m_invIA + , s = this.m_invIB + , a = t.velocities[this.m_indexA].v + , o = t.velocities[this.m_indexA].w + , l = t.velocities[this.m_indexB].v + , h = t.velocities[this.m_indexB].w + , c = I.DotVV(this.m_ax, I.SubVV(l, a, I.s_t0)) + this.m_sBx * h - this.m_sAx * o + , u = -this.m_springMass * (c + this.m_bias + this.m_gamma * this.m_springImpulse); + this.m_springImpulse += u; + var _ = I.MulSV(u, this.m_ax, i.SolveVelocityConstraints_s_P) + , f = u * this.m_sAx + , d = u * this.m_sBx; + a.SelfMulSub(e, _), + o -= r * f, + l.SelfMulAdd(n, _), + c = (h += s * d) - o - this.m_motorSpeed, + u = -this.m_motorMass * c; + var p = this.m_motorImpulse + , m = t.step.dt * this.m_maxMotorTorque; + this.m_motorImpulse = g(this.m_motorImpulse + u, -m, m), + o -= r * (u = this.m_motorImpulse - p), + h += s * u, + c = I.DotVV(this.m_ay, I.SubVV(l, a, I.s_t0)) + this.m_sBy * h - this.m_sAy * o, + u = -this.m_mass * c, + this.m_impulse += u, + _ = I.MulSV(u, this.m_ay, i.SolveVelocityConstraints_s_P), + f = u * this.m_sAy, + d = u * this.m_sBy, + a.SelfMulSub(e, _), + o -= r * f, + l.SelfMulAdd(n, _), + h += s * d, + t.velocities[this.m_indexA].w = o, + t.velocities[this.m_indexB].w = h + } + , + i.prototype.SolvePositionConstraints = function(t) { + var e = t.positions[this.m_indexA].c + , n = t.positions[this.m_indexA].a + , r = t.positions[this.m_indexB].c + , s = t.positions[this.m_indexB].a + , a = this.m_qA.SetAngle(n) + , o = this.m_qB.SetAngle(s); + I.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA); + var h = F.MulRV(a, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB); + var c, u = F.MulRV(o, this.m_lalcB, this.m_rB), _ = I.AddVV(I.SubVV(r, e, I.s_t0), I.SubVV(u, h, I.s_t1), i.SolvePositionConstraints_s_d), f = F.MulRV(a, this.m_localYAxisA, this.m_ay), d = I.CrossVV(I.AddVV(_, h, I.s_t0), f), p = I.CrossVV(u, f), y = I.DotVV(_, this.m_ay), v = this.m_invMassA + this.m_invMassB + this.m_invIA * this.m_sAy * this.m_sAy + this.m_invIB * this.m_sBy * this.m_sBy; + c = 0 !== v ? -y / v : 0; + var g = I.MulSV(c, f, i.SolvePositionConstraints_s_P) + , A = c * d + , x = c * p; + return e.SelfMulSub(this.m_invMassA, g), + n -= this.m_invIA * A, + r.SelfMulAdd(this.m_invMassB, g), + s += this.m_invIB * x, + t.positions[this.m_indexA].a = n, + t.positions[this.m_indexB].a = s, + m(y) <= l + } + , + i.prototype.GetDefinition = function(t) { + return t + } + , + i.prototype.GetAnchorA = function(t) { + return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t) + } + , + i.prototype.GetAnchorB = function(t) { + return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t) + } + , + i.prototype.GetReactionForce = function(t, e) { + return e.x = t * (this.m_impulse * this.m_ay.x + this.m_springImpulse * this.m_ax.x), + e.y = t * (this.m_impulse * this.m_ay.y + this.m_springImpulse * this.m_ax.y), + e + } + , + i.prototype.GetReactionTorque = function(t) { + return t * this.m_motorImpulse + } + , + i.prototype.GetLocalAnchorA = function() { + return this.m_localAnchorA + } + , + i.prototype.GetLocalAnchorB = function() { + return this.m_localAnchorB + } + , + i.prototype.GetLocalAxisA = function() { + return this.m_localXAxisA + } + , + i.prototype.GetJointTranslation = function() { + return this.GetPrismaticJointTranslation() + } + , + i.prototype.GetJointLinearSpeed = function() { + return this.GetPrismaticJointSpeed() + } + , + i.prototype.GetJointAngle = function() { + return this.GetRevoluteJointAngle() + } + , + i.prototype.GetJointAngularSpeed = function() { + return this.GetRevoluteJointSpeed() + } + , + i.prototype.GetPrismaticJointTranslation = function() { + var t = this.m_bodyA + , e = this.m_bodyB + , i = t.GetWorldPoint(this.m_localAnchorA, new I) + , n = e.GetWorldPoint(this.m_localAnchorB, new I) + , r = I.SubVV(n, i, new I) + , s = t.GetWorldVector(this.m_localXAxisA, new I); + return I.DotVV(r, s) + } + , + i.prototype.GetPrismaticJointSpeed = function() { + var t = this.m_bodyA + , e = this.m_bodyB; + I.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA); + var i = F.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA); + I.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB); + var n = F.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB) + , r = I.AddVV(t.m_sweep.c, i, I.s_t0) + , s = I.AddVV(e.m_sweep.c, n, I.s_t1) + , a = I.SubVV(s, r, I.s_t2) + , o = t.GetWorldVector(this.m_localXAxisA, new I) + , l = t.m_linearVelocity + , h = e.m_linearVelocity + , c = t.m_angularVelocity + , u = e.m_angularVelocity; + return I.DotVV(a, I.CrossSV(c, o, I.s_t0)) + I.DotVV(o, I.SubVV(I.AddVCrossSV(h, u, n, I.s_t0), I.AddVCrossSV(l, c, i, I.s_t1), I.s_t0)) + } + , + i.prototype.GetRevoluteJointAngle = function() { + return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a + } + , + i.prototype.GetRevoluteJointSpeed = function() { + var t = this.m_bodyA.m_angularVelocity; + return this.m_bodyB.m_angularVelocity - t + } + , + i.prototype.IsMotorEnabled = function() { + return this.m_enableMotor + } + , + i.prototype.EnableMotor = function(t) { + t !== this.m_enableMotor && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_enableMotor = t) + } + , + i.prototype.SetMotorSpeed = function(t) { + t !== this.m_motorSpeed && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_motorSpeed = t) + } + , + i.prototype.SetMaxMotorTorque = function(t) { + t !== this.m_maxMotorTorque && (this.m_bodyA.SetAwake(!0), + this.m_bodyB.SetAwake(!0), + this.m_maxMotorTorque = t) + } + , + i.prototype.GetMotorTorque = function(t) { + return t * this.m_motorImpulse + } + , + i.prototype.Dump = function(t) { + var e = this.m_bodyA.m_islandIndex + , i = this.m_bodyB.m_islandIndex; + t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"), + t(" jd.bodyA = bodies[%d];\n", e), + t(" jd.bodyB = bodies[%d];\n", i), + t(" jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false"), + t(" jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y), + t(" jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y), + t(" jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y), + t(" jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false"), + t(" jd.motorSpeed = %.15f;\n", this.m_motorSpeed), + t(" jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque), + t(" jd.frequencyHz = %.15f;\n", this.m_frequencyHz), + t(" jd.dampingRatio = %.15f;\n", this.m_dampingRatio), + t(" joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index) + } + , + i.InitVelocityConstraints_s_d = new I, + i.InitVelocityConstraints_s_P = new I, + i.SolveVelocityConstraints_s_P = new I, + i.SolvePositionConstraints_s_d = new I, + i.SolvePositionConstraints_s_P = new I, + i + } + )(mi); + function Ui(t, e) { + return T(t * e) + } + function zi(t, e) { + return t > e ? t : e + } + var Hi, Wi = function(t) { + this.prev = null, + this.next = null, + this.contact = t + }, ji = (function() { + function t() { + this.m_islandFlag = !1, + this.m_touchingFlag = !1, + this.m_enabledFlag = !1, + this.m_filterFlag = !1, + this.m_bulletHitFlag = !1, + this.m_toiFlag = !1, + this.m_prev = null, + this.m_next = null, + this.m_indexA = 0, + this.m_indexB = 0, + this.m_manifold = new gt, + this.m_toiCount = 0, + this.m_toi = 0, + this.m_friction = 0, + this.m_restitution = 0, + this.m_tangentSpeed = 0, + this.m_oldManifold = new gt, + this.m_nodeA = new Wi(this), + this.m_nodeB = new Wi(this) + } + return t.prototype.GetManifold = function() { + return this.m_manifold + } + , + t.prototype.GetWorldManifold = function(t) { + var e = this.m_fixtureA.GetBody() + , i = this.m_fixtureB.GetBody() + , n = this.m_fixtureA.GetShape() + , r = this.m_fixtureB.GetShape(); + t.Initialize(this.m_manifold, e.GetTransform(), n.m_radius, i.GetTransform(), r.m_radius) + } + , + t.prototype.IsTouching = function() { + return this.m_touchingFlag + } + , + t.prototype.SetEnabled = function(t) { + this.m_enabledFlag = t + } + , + t.prototype.IsEnabled = function() { + return this.m_enabledFlag + } + , + t.prototype.GetNext = function() { + return this.m_next + } + , + t.prototype.GetFixtureA = function() { + return this.m_fixtureA + } + , + t.prototype.GetChildIndexA = function() { + return this.m_indexA + } + , + t.prototype.GetFixtureB = function() { + return this.m_fixtureB + } + , + t.prototype.GetChildIndexB = function() { + return this.m_indexB + } + , + t.prototype.FlagForFiltering = function() { + this.m_filterFlag = !0 + } + , + t.prototype.SetFriction = function(t) { + this.m_friction = t + } + , + t.prototype.GetFriction = function() { + return this.m_friction + } + , + t.prototype.ResetFriction = function() { + this.m_friction = Ui(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction) + } + , + t.prototype.SetRestitution = function(t) { + this.m_restitution = t + } + , + t.prototype.GetRestitution = function() { + return this.m_restitution + } + , + t.prototype.ResetRestitution = function() { + this.m_restitution = zi(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution) + } + , + t.prototype.SetTangentSpeed = function(t) { + this.m_tangentSpeed = t + } + , + t.prototype.GetTangentSpeed = function() { + return this.m_tangentSpeed + } + , + t.prototype.Reset = function(t, e, i, n) { + this.m_islandFlag = !1, + this.m_touchingFlag = !1, + this.m_enabledFlag = !0, + this.m_filterFlag = !1, + this.m_bulletHitFlag = !1, + this.m_toiFlag = !1, + this.m_fixtureA = t, + this.m_fixtureB = i, + this.m_indexA = e, + this.m_indexB = n, + this.m_manifold.pointCount = 0, + this.m_prev = null, + this.m_next = null, + delete this.m_nodeA.contact, + this.m_nodeA.prev = null, + this.m_nodeA.next = null, + delete this.m_nodeA.other, + delete this.m_nodeB.contact, + this.m_nodeB.prev = null, + this.m_nodeB.next = null, + delete this.m_nodeB.other, + this.m_toiCount = 0, + this.m_friction = Ui(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction), + this.m_restitution = zi(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution) + } + , + t.prototype.Update = function(t) { + var e = this.m_oldManifold; + this.m_oldManifold = this.m_manifold, + this.m_manifold = e, + this.m_enabledFlag = !0; + var i = !1 + , n = this.m_touchingFlag + , r = this.m_fixtureA.IsSensor() + , s = this.m_fixtureB.IsSensor() + , a = r || s + , o = this.m_fixtureA.GetBody() + , l = this.m_fixtureB.GetBody() + , h = o.GetTransform() + , c = l.GetTransform(); + if (a) { + var u = this.m_fixtureA.GetShape() + , _ = this.m_fixtureB.GetShape(); + i = Bt(u, this.m_indexA, _, this.m_indexB, h, c), + this.m_manifold.pointCount = 0 + } else { + this.Evaluate(this.m_manifold, h, c), + i = this.m_manifold.pointCount > 0; + for (var f = 0; f < this.m_manifold.pointCount; ++f) { + var d = this.m_manifold.points[f]; + d.normalImpulse = 0, + d.tangentImpulse = 0; + for (var p = d.id, m = 0; m < this.m_oldManifold.pointCount; ++m) { + var y = this.m_oldManifold.points[m]; + if (y.id.key === p.key) { + d.normalImpulse = y.normalImpulse, + d.tangentImpulse = y.tangentImpulse; + break + } + } + } + i !== n && (o.SetAwake(!0), + l.SetAwake(!0)) + } + this.m_touchingFlag = i, + !n && i && t && t.BeginContact(this), + n && !i && t && t.EndContact(this), + !a && i && t && t.PreSolve(this, this.m_oldManifold) + } + , + t.prototype.ComputeTOI = function(e, i) { + var n = t.ComputeTOI_s_input; + n.proxyA.SetShape(this.m_fixtureA.GetShape(), this.m_indexA), + n.proxyB.SetShape(this.m_fixtureB.GetShape(), this.m_indexB), + n.sweepA.Copy(e), + n.sweepB.Copy(i), + n.tMax = l; + var r = t.ComputeTOI_s_output; + return re(r, n), + r.t + } + , + t.ComputeTOI_s_input = new jt, + t.ComputeTOI_s_output = new Yt, + t + } + )(), Xi = (function(t) { + function e() { + return t.call(this) || this + } + return ti(e, t), + e.Create = function() { + return new e + } + , + e.Destroy = function() {} + , + e.prototype.Reset = function(e, i, n, r) { + t.prototype.Reset.call(this, e, i, n, r) + } + , + e.prototype.Evaluate = function(t, e, i) { + oe(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i) + } + , + e + } + )(ji), Yi = (function(t) { + function e() { + return t.call(this) || this + } + return ti(e, t), + e.Create = function() { + return new e + } + , + e.Destroy = function() {} + , + e.prototype.Reset = function(e, i, n, r) { + t.prototype.Reset.call(this, e, i, n, r) + } + , + e.prototype.Evaluate = function(t, e, i) { + Le(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i) + } + , + e + } + )(ji), qi = (function(t) { + function e() { + return t.call(this) || this + } + return ti(e, t), + e.Create = function() { + return new e + } + , + e.Destroy = function() {} + , + e.prototype.Reset = function(e, i, n, r) { + t.prototype.Reset.call(this, e, i, n, r) + } + , + e.prototype.Evaluate = function(t, e, i) { + ue(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i) + } + , + e + } + )(ji), Ji = (function(t) { + function e() { + return t.call(this) || this + } + return ti(e, t), + e.Create = function() { + return new e + } + , + e.Destroy = function() {} + , + e.prototype.Reset = function(e, i, n, r) { + t.prototype.Reset.call(this, e, i, n, r) + } + , + e.prototype.Evaluate = function(t, e, i) { + We(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i) + } + , + e + } + )(ji), Zi = (function(t) { + function e() { + return t.call(this) || this + } + return ti(e, t), + e.Create = function() { + return new e + } + , + e.Destroy = function() {} + , + e.prototype.Reset = function(e, i, n, r) { + t.prototype.Reset.call(this, e, i, n, r) + } + , + e.prototype.Evaluate = function(t, e, i) { + Je(t, this.m_fixtureA.GetShape(), e, this.m_fixtureB.GetShape(), i) + } + , + e + } + )(ji), Ki = (function(t) { + function e() { + return t.call(this) || this + } + return ti(e, t), + e.Create = function() { + return new e + } + , + e.Destroy = function() {} + , + e.prototype.Reset = function(e, i, n, r) { + t.prototype.Reset.call(this, e, i, n, r) + } + , + e.prototype.Evaluate = function(t, i, n) { + var r = this.m_fixtureA.GetShape() + , s = this.m_fixtureB.GetShape() + , a = r + , o = e.Evaluate_s_edge; + a.GetChildEdge(o, this.m_indexA), + We(t, o, i, s, n) + } + , + e.Evaluate_s_edge = new ri, + e + } + )(ji), Qi = (function(t) { + function e() { + return t.call(this) || this + } + return ti(e, t), + e.Create = function() { + return new e + } + , + e.Destroy = function() {} + , + e.prototype.Reset = function(e, i, n, r) { + t.prototype.Reset.call(this, e, i, n, r) + } + , + e.prototype.Evaluate = function(t, i, n) { + var r = this.m_fixtureA.GetShape() + , s = this.m_fixtureB.GetShape() + , a = r + , o = e.Evaluate_s_edge; + a.GetChildEdge(o, this.m_indexA), + Je(t, o, i, s, n) + } + , + e.Evaluate_s_edge = new ri, + e + } + )(ji), $i = function() { + this.createFcn = null, + this.destroyFcn = null, + this.primary = !1 + }, tn = (function() { + function e(t) { + this.m_allocator = null, + this.m_allocator = t, + this.InitializeRegisters() + } + return e.prototype.AddType = function(t, e, i, n) { + var r = this + , s = d(256, (function() { + return t(r.m_allocator) + } + )); + function a(e) { + return s.pop() || t(e) + } + function o(t) { + s.push(t) + } + this.m_registers[i][n].createFcn = a, + this.m_registers[i][n].destroyFcn = o, + this.m_registers[i][n].primary = !0, + i !== n && (this.m_registers[n][i].createFcn = a, + this.m_registers[n][i].destroyFcn = o, + this.m_registers[n][i].primary = !1) + } + , + e.prototype.InitializeRegisters = function() { + this.m_registers = []; + for (var e = 0; e < t.b2ShapeType.e_shapeTypeCount; e++) { + this.m_registers[e] = []; + for (var i = 0; i < t.b2ShapeType.e_shapeTypeCount; i++) + this.m_registers[e][i] = new $i + } + this.AddType(Xi.Create, Xi.Destroy, t.b2ShapeType.e_circleShape, t.b2ShapeType.e_circleShape), + this.AddType(qi.Create, qi.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_circleShape), + this.AddType(Yi.Create, Yi.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_polygonShape), + this.AddType(Ji.Create, Ji.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_circleShape), + this.AddType(Zi.Create, Zi.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_polygonShape), + this.AddType(Ki.Create, Ki.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_circleShape), + this.AddType(Qi.Create, Qi.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_polygonShape) + } + , + e.prototype.Create = function(t, e, i, n) { + var r = t.GetType() + , s = i.GetType() + , a = this.m_registers[r][s]; + if (a.createFcn) { + var o = a.createFcn(this.m_allocator); + return a.primary ? o.Reset(t, e, i, n) : o.Reset(i, n, t, e), + o + } + return null + } + , + e.prototype.Destroy = function(t) { + var e = t.m_fixtureA + , i = t.m_fixtureB; + t.m_manifold.pointCount > 0 && !e.IsSensor() && !i.IsSensor() && (e.GetBody().SetAwake(!0), + i.GetBody().SetAwake(!0)); + var n = e.GetType() + , r = i.GetType() + , s = this.m_registers[n][r]; + s.destroyFcn && s.destroyFcn(t, this.m_allocator) + } + , + e + } + )(), en = (function() { + function t() {} + return t.prototype.SayGoodbyeJoint = function() {} + , + t.prototype.SayGoodbyeFixture = function() {} + , + t.prototype.SayGoodbyeParticleGroup = function() {} + , + t.prototype.SayGoodbyeParticle = function() {} + , + t + } + )(), nn = (function() { + function e() {} + return e.prototype.ShouldCollide = function(e, i) { + var n = e.GetBody() + , r = i.GetBody(); + if (r.GetType() === t.b2BodyType.b2_staticBody && n.GetType() === t.b2BodyType.b2_staticBody) + return !1; + if (!r.ShouldCollideConnected(n)) + return !1; + var s = e.GetFilterData() + , a = i.GetFilterData(); + return s.groupIndex === a.groupIndex && 0 !== s.groupIndex ? s.groupIndex > 0 : 0 != (s.maskBits & a.categoryBits) && 0 != (s.categoryBits & a.maskBits) + } + , + e.prototype.ShouldCollideFixtureParticle = function() { + return !0 + } + , + e.prototype.ShouldCollideParticleParticle = function() { + return !0 + } + , + e.b2_defaultFilter = new e, + e + } + )(), rn = function() { + this.normalImpulses = p(a), + this.tangentImpulses = p(a), + this.count = 0 + }, sn = (function() { + function t() {} + return t.prototype.BeginContact = function() {} + , + t.prototype.EndContact = function() {} + , + t.prototype.BeginContactFixtureParticle = function() {} + , + t.prototype.EndContactFixtureParticle = function() {} + , + t.prototype.BeginContactParticleParticle = function() {} + , + t.prototype.EndContactParticleParticle = function() {} + , + t.prototype.PreSolve = function() {} + , + t.prototype.PostSolve = function() {} + , + t.b2_defaultListener = new t, + t + } + )(), an = (function() { + function t() {} + return t.prototype.ReportFixture = function() { + return !0 + } + , + t.prototype.ReportParticle = function() { + return !1 + } + , + t.prototype.ShouldQueryParticleSystem = function() { + return !0 + } + , + t + } + )(), on = (function() { + function t() {} + return t.prototype.ReportFixture = function(t, e, i, n) { + return n + } + , + t.prototype.ReportParticle = function() { + return 0 + } + , + t.prototype.ShouldQueryParticleSystem = function() { + return !0 + } + , + t + } + )(), ln = (function() { + function e() { + this.m_broadPhase = new Lt, + this.m_contactList = null, + this.m_contactCount = 0, + this.m_contactFilter = nn.b2_defaultFilter, + this.m_contactListener = sn.b2_defaultListener, + this.m_allocator = null, + this.m_contactFactory = new tn(this.m_allocator) + } + return e.prototype.AddPair = function(t, e) { + var i = t.fixture + , n = e.fixture + , r = t.childIndex + , s = e.childIndex + , a = i.GetBody() + , o = n.GetBody(); + if (a !== o) { + for (var l = o.GetContactList(); l; ) { + if (l.other === a) { + var h = l.contact.GetFixtureA() + , c = l.contact.GetFixtureB() + , u = l.contact.GetChildIndexA() + , _ = l.contact.GetChildIndexB(); + if (h === i && c === n && u === r && _ === s) + return; + if (h === n && c === i && u === s && _ === r) + return + } + l = l.next + } + if (!this.m_contactFilter || this.m_contactFilter.ShouldCollide(i, n)) { + var f = this.m_contactFactory.Create(i, r, n, s); + null !== f && (i = f.GetFixtureA(), + n = f.GetFixtureB(), + r = f.GetChildIndexA(), + s = f.GetChildIndexB(), + a = i.m_body, + o = n.m_body, + f.m_prev = null, + f.m_next = this.m_contactList, + null !== this.m_contactList && (this.m_contactList.m_prev = f), + this.m_contactList = f, + f.m_nodeA.contact = f, + f.m_nodeA.other = o, + f.m_nodeA.prev = null, + f.m_nodeA.next = a.m_contactList, + null !== a.m_contactList && (a.m_contactList.prev = f.m_nodeA), + a.m_contactList = f.m_nodeA, + f.m_nodeB.contact = f, + f.m_nodeB.other = a, + f.m_nodeB.prev = null, + f.m_nodeB.next = o.m_contactList, + null !== o.m_contactList && (o.m_contactList.prev = f.m_nodeB), + o.m_contactList = f.m_nodeB, + i.IsSensor() || n.IsSensor() || (a.SetAwake(!0), + o.SetAwake(!0)), + ++this.m_contactCount) + } + } + } + , + e.prototype.FindNewContacts = function() { + var t = this; + this.m_broadPhase.UpdatePairs((function(e, i) { + t.AddPair(e, i) + } + )) + } + , + e.prototype.Destroy = function(t) { + var e = t.GetFixtureA() + , i = t.GetFixtureB() + , n = e.GetBody() + , r = i.GetBody(); + this.m_contactListener && t.IsTouching() && this.m_contactListener.EndContact(t), + t.m_prev && (t.m_prev.m_next = t.m_next), + t.m_next && (t.m_next.m_prev = t.m_prev), + t === this.m_contactList && (this.m_contactList = t.m_next), + t.m_nodeA.prev && (t.m_nodeA.prev.next = t.m_nodeA.next), + t.m_nodeA.next && (t.m_nodeA.next.prev = t.m_nodeA.prev), + t.m_nodeA === n.m_contactList && (n.m_contactList = t.m_nodeA.next), + t.m_nodeB.prev && (t.m_nodeB.prev.next = t.m_nodeB.next), + t.m_nodeB.next && (t.m_nodeB.next.prev = t.m_nodeB.prev), + t.m_nodeB === r.m_contactList && (r.m_contactList = t.m_nodeB.next), + this.m_contactFactory.Destroy(t), + --this.m_contactCount + } + , + e.prototype.Collide = function() { + for (var e = this.m_contactList; e; ) { + var i = e.GetFixtureA() + , n = e.GetFixtureB() + , r = e.GetChildIndexA() + , s = e.GetChildIndexB() + , a = i.GetBody() + , o = n.GetBody(); + if (e.m_filterFlag) { + if (this.m_contactFilter && !this.m_contactFilter.ShouldCollide(i, n)) { + e = (c = e).m_next, + this.Destroy(c); + continue + } + e.m_filterFlag = !1 + } + var l = a.IsAwake() && a.m_type !== t.b2BodyType.b2_staticBody + , h = o.IsAwake() && o.m_type !== t.b2BodyType.b2_staticBody; + if (l || h) { + var c, u = i.m_proxies[r].treeNode, _ = n.m_proxies[s].treeNode; + St(u.aabb, _.aabb) ? (e.Update(this.m_contactListener), + e = e.m_next) : (e = (c = e).m_next, + this.Destroy(c)) + } else + e = e.m_next + } + } + , + e + } + )(), hn = (function() { + function t() { + this.step = 0, + this.collide = 0, + this.solve = 0, + this.solveInit = 0, + this.solveVelocity = 0, + this.solvePosition = 0, + this.broadphase = 0, + this.solveTOI = 0 + } + return t.prototype.Reset = function() { + return this.step = 0, + this.collide = 0, + this.solve = 0, + this.solveInit = 0, + this.solveVelocity = 0, + this.solvePosition = 0, + this.broadphase = 0, + this.solveTOI = 0, + this + } + , + t + } + )(), cn = (function() { + function t() { + this.dt = 0, + this.inv_dt = 0, + this.dtRatio = 0, + this.velocityIterations = 0, + this.positionIterations = 0, + this.particleIterations = 0, + this.warmStarting = !1 + } + return t.prototype.Copy = function(t) { + return this.dt = t.dt, + this.inv_dt = t.inv_dt, + this.dtRatio = t.dtRatio, + this.positionIterations = t.positionIterations, + this.velocityIterations = t.velocityIterations, + this.particleIterations = t.particleIterations, + this.warmStarting = t.warmStarting, + this + } + , + t + } + )(), un = (function() { + function t() { + this.c = new I, + this.a = 0 + } + return t.MakeArray = function(e) { + return d(e, (function() { + return new t + } + )) + } + , + t + } + )(), _n = (function() { + function t() { + this.v = new I, + this.w = 0 + } + return t.MakeArray = function(e) { + return d(e, (function() { + return new t + } + )) + } + , + t + } + )(), fn = function() { + this.step = new cn + }, dn = (function() { + function t() { + this.rA = new I, + this.rB = new I, + this.normalImpulse = 0, + this.tangentImpulse = 0, + this.normalMass = 0, + this.tangentMass = 0, + this.velocityBias = 0 + } + return t.MakeArray = function(e) { + return d(e, (function() { + return new t + } + )) + } + , + t + } + )(), pn = (function() { + function t() { + this.points = dn.MakeArray(a), + this.normal = new I, + this.tangent = new I, + this.normalMass = new O, + this.K = new O, + this.indexA = 0, + this.indexB = 0, + this.invMassA = 0, + this.invMassB = 0, + this.invIA = 0, + this.invIB = 0, + this.friction = 0, + this.restitution = 0, + this.tangentSpeed = 0, + this.pointCount = 0, + this.contactIndex = 0 + } + return t.MakeArray = function(e) { + return d(e, (function() { + return new t + } + )) + } + , + t + } + )(), mn = (function() { + function e() { + this.localPoints = I.MakeArray(a), + this.localNormal = new I, + this.localPoint = new I, + this.indexA = 0, + this.indexB = 0, + this.invMassA = 0, + this.invMassB = 0, + this.localCenterA = new I, + this.localCenterB = new I, + this.invIA = 0, + this.invIB = 0, + this.type = t.b2ManifoldType.e_unknown, + this.radiusA = 0, + this.radiusB = 0, + this.pointCount = 0 + } + return e.MakeArray = function(t) { + return d(t, (function() { + return new e + } + )) + } + , + e + } + )(), yn = function() { + this.step = new cn, + this.count = 0, + this.allocator = null + }, vn = (function() { + function e() { + this.normal = new I, + this.point = new I, + this.separation = 0 + } + return e.prototype.Initialize = function(i, n, r, s) { + var a = e.Initialize_s_pointA + , o = e.Initialize_s_pointB + , l = e.Initialize_s_planePoint + , h = e.Initialize_s_clipPoint; + switch (i.type) { + case t.b2ManifoldType.e_circles: + V.MulXV(n, i.localPoint, a), + V.MulXV(r, i.localPoints[0], o), + I.SubVV(o, a, this.normal).SelfNormalize(), + I.MidVV(a, o, this.point), + this.separation = I.DotVV(I.SubVV(o, a, I.s_t0), this.normal) - i.radiusA - i.radiusB; + break; + case t.b2ManifoldType.e_faceA: + F.MulRV(n.q, i.localNormal, this.normal), + V.MulXV(n, i.localPoint, l), + V.MulXV(r, i.localPoints[s], h), + this.separation = I.DotVV(I.SubVV(h, l, I.s_t0), this.normal) - i.radiusA - i.radiusB, + this.point.Copy(h); + break; + case t.b2ManifoldType.e_faceB: + F.MulRV(r.q, i.localNormal, this.normal), + V.MulXV(r, i.localPoint, l), + V.MulXV(n, i.localPoints[s], h), + this.separation = I.DotVV(I.SubVV(h, l, I.s_t0), this.normal) - i.radiusA - i.radiusB, + this.point.Copy(h), + this.normal.SelfNeg() + } + } + , + e.Initialize_s_pointA = new I, + e.Initialize_s_pointB = new I, + e.Initialize_s_planePoint = new I, + e.Initialize_s_clipPoint = new I, + e + } + )(), gn = (function() { + function t() { + this.m_step = new cn, + this.m_allocator = null, + this.m_positionConstraints = mn.MakeArray(1024), + this.m_velocityConstraints = pn.MakeArray(1024), + this.m_count = 0 + } + return t.prototype.Initialize = function(t) { + if (this.m_step.Copy(t.step), + this.m_allocator = t.allocator, + this.m_count = t.count, + this.m_positionConstraints.length < this.m_count) + for (var e = v(2 * this.m_positionConstraints.length, this.m_count); this.m_positionConstraints.length < e; ) + this.m_positionConstraints[this.m_positionConstraints.length] = new mn; + if (this.m_velocityConstraints.length < this.m_count) + for (e = v(2 * this.m_velocityConstraints.length, this.m_count); this.m_velocityConstraints.length < e; ) + this.m_velocityConstraints[this.m_velocityConstraints.length] = new pn; + this.m_positions = t.positions, + this.m_velocities = t.velocities, + this.m_contacts = t.contacts; + for (var i = 0; i < this.m_count; ++i) { + var n = this.m_contacts[i] + , r = n.m_fixtureA + , s = n.m_fixtureB + , a = r.GetShape() + , o = s.GetShape() + , l = a.m_radius + , h = o.m_radius + , c = r.GetBody() + , u = s.GetBody() + , _ = n.GetManifold() + , f = _.pointCount + , d = this.m_velocityConstraints[i]; + d.friction = n.m_friction, + d.restitution = n.m_restitution, + d.tangentSpeed = n.m_tangentSpeed, + d.indexA = c.m_islandIndex, + d.indexB = u.m_islandIndex, + d.invMassA = c.m_invMass, + d.invMassB = u.m_invMass, + d.invIA = c.m_invI, + d.invIB = u.m_invI, + d.contactIndex = i, + d.pointCount = f, + d.K.SetZero(), + d.normalMass.SetZero(); + var p = this.m_positionConstraints[i]; + p.indexA = c.m_islandIndex, + p.indexB = u.m_islandIndex, + p.invMassA = c.m_invMass, + p.invMassB = u.m_invMass, + p.localCenterA.Copy(c.m_sweep.localCenter), + p.localCenterB.Copy(u.m_sweep.localCenter), + p.invIA = c.m_invI, + p.invIB = u.m_invI, + p.localNormal.Copy(_.localNormal), + p.localPoint.Copy(_.localPoint), + p.pointCount = f, + p.radiusA = l, + p.radiusB = h, + p.type = _.type; + for (var m = 0; m < f; ++m) { + var y = _.points[m] + , g = d.points[m]; + this.m_step.warmStarting ? (g.normalImpulse = this.m_step.dtRatio * y.normalImpulse, + g.tangentImpulse = this.m_step.dtRatio * y.tangentImpulse) : (g.normalImpulse = 0, + g.tangentImpulse = 0), + g.rA.SetZero(), + g.rB.SetZero(), + g.normalMass = 0, + g.tangentMass = 0, + g.velocityBias = 0, + p.localPoints[m].Copy(y.localPoint) + } + } + return this + } + , + t.prototype.InitializeVelocityConstraints = function() { + for (var e = t.InitializeVelocityConstraints_s_xfA, i = t.InitializeVelocityConstraints_s_xfB, n = t.InitializeVelocityConstraints_s_worldManifold, r = 0; r < this.m_count; ++r) { + var s = this.m_velocityConstraints[r] + , a = this.m_positionConstraints[r] + , o = a.radiusA + , l = a.radiusB + , h = this.m_contacts[s.contactIndex].GetManifold() + , c = s.indexA + , u = s.indexB + , _ = s.invMassA + , f = s.invMassB + , d = s.invIA + , p = s.invIB + , m = a.localCenterA + , y = a.localCenterB + , v = this.m_positions[c].c + , g = this.m_positions[c].a + , A = this.m_velocities[c].v + , x = this.m_velocities[c].w + , b = this.m_positions[u].c + , C = this.m_positions[u].a + , T = this.m_velocities[u].v + , S = this.m_velocities[u].w; + e.q.SetAngle(g), + i.q.SetAngle(C), + I.SubVV(v, F.MulRV(e.q, m, I.s_t0), e.p), + I.SubVV(b, F.MulRV(i.q, y, I.s_t0), i.p), + n.Initialize(h, e, o, i, l), + s.normal.Copy(n.normal), + I.CrossVOne(s.normal, s.tangent); + for (var w = s.pointCount, E = 0; E < w; ++E) { + var M = s.points[E]; + I.SubVV(n.points[E], v, M.rA), + I.SubVV(n.points[E], b, M.rB); + var D = I.CrossVV(M.rA, s.normal) + , B = I.CrossVV(M.rB, s.normal) + , P = _ + f + d * D * D + p * B * B; + M.normalMass = P > 0 ? 1 / P : 0; + var R = s.tangent + , O = I.CrossVV(M.rA, R) + , L = I.CrossVV(M.rB, R) + , V = _ + f + d * O * O + p * L * L; + M.tangentMass = V > 0 ? 1 / V : 0, + M.velocityBias = 0; + var N = I.DotVV(s.normal, I.SubVV(I.AddVCrossSV(T, S, M.rB, I.s_t0), I.AddVCrossSV(A, x, M.rA, I.s_t1), I.s_t0)); + N < -1 && (M.velocityBias += -s.restitution * N) + } + s.pointCount + } + } + , + t.prototype.WarmStart = function() { + for (var e = t.WarmStart_s_P, i = 0; i < this.m_count; ++i) { + for (var n = this.m_velocityConstraints[i], r = n.indexA, s = n.indexB, a = n.invMassA, o = n.invIA, l = n.invMassB, h = n.invIB, c = n.pointCount, u = this.m_velocities[r].v, _ = this.m_velocities[r].w, f = this.m_velocities[s].v, d = this.m_velocities[s].w, p = n.normal, m = n.tangent, y = 0; y < c; ++y) { + var v = n.points[y]; + I.AddVV(I.MulSV(v.normalImpulse, p, I.s_t0), I.MulSV(v.tangentImpulse, m, I.s_t1), e), + _ -= o * I.CrossVV(v.rA, e), + u.SelfMulSub(a, e), + d += h * I.CrossVV(v.rB, e), + f.SelfMulAdd(l, e) + } + this.m_velocities[r].w = _, + this.m_velocities[s].w = d + } + } + , + t.prototype.SolveVelocityConstraints = function() { + for (var e = t.SolveVelocityConstraints_s_dv, i = (t.SolveVelocityConstraints_s_dv1, + t.SolveVelocityConstraints_s_dv2, + t.SolveVelocityConstraints_s_P), n = (t.SolveVelocityConstraints_s_a, + t.SolveVelocityConstraints_s_b, + t.SolveVelocityConstraints_s_x, + t.SolveVelocityConstraints_s_d, + t.SolveVelocityConstraints_s_P1, + t.SolveVelocityConstraints_s_P2, + t.SolveVelocityConstraints_s_P1P2, + 0); n < this.m_count; ++n) { + for (var r = this.m_velocityConstraints[n], s = r.indexA, a = r.indexB, o = r.invMassA, l = r.invIA, h = r.invMassB, c = r.invIB, u = r.pointCount, _ = this.m_velocities[s].v, f = this.m_velocities[s].w, d = this.m_velocities[a].v, p = this.m_velocities[a].w, m = r.normal, y = r.tangent, A = r.friction, x = 0; x < u; ++x) { + var b = r.points[x]; + I.SubVV(I.AddVCrossSV(d, p, b.rB, I.s_t0), I.AddVCrossSV(_, f, b.rA, I.s_t1), e); + var C = I.DotVV(e, y) - r.tangentSpeed + , T = b.tangentMass * -C + , S = A * b.normalImpulse; + T = (w = g(b.tangentImpulse + T, -S, S)) - b.tangentImpulse, + b.tangentImpulse = w, + I.MulSV(T, y, i), + _.SelfMulSub(o, i), + f -= l * I.CrossVV(b.rA, i), + d.SelfMulAdd(h, i), + p += c * I.CrossVV(b.rB, i) + } + for (r.pointCount, + x = 0; x < u; ++x) { + b = r.points[x], + I.SubVV(I.AddVCrossSV(d, p, b.rB, I.s_t0), I.AddVCrossSV(_, f, b.rA, I.s_t1), e); + var w, E = I.DotVV(e, m); + T = -b.normalMass * (E - b.velocityBias), + T = (w = v(b.normalImpulse + T, 0)) - b.normalImpulse, + b.normalImpulse = w, + I.MulSV(T, m, i), + _.SelfMulSub(o, i), + f -= l * I.CrossVV(b.rA, i), + d.SelfMulAdd(h, i), + p += c * I.CrossVV(b.rB, i) + } + this.m_velocities[s].w = f, + this.m_velocities[a].w = p + } + } + , + t.prototype.StoreImpulses = function() { + for (var t = 0; t < this.m_count; ++t) + for (var e = this.m_velocityConstraints[t], i = this.m_contacts[e.contactIndex].GetManifold(), n = 0; n < e.pointCount; ++n) + i.points[n].normalImpulse = e.points[n].normalImpulse, + i.points[n].tangentImpulse = e.points[n].tangentImpulse + } + , + t.prototype.SolvePositionConstraints = function() { + for (var e = t.SolvePositionConstraints_s_xfA, i = t.SolvePositionConstraints_s_xfB, n = t.SolvePositionConstraints_s_psm, r = t.SolvePositionConstraints_s_rA, s = t.SolvePositionConstraints_s_rB, a = t.SolvePositionConstraints_s_P, o = 0, h = 0; h < this.m_count; ++h) { + for (var c = this.m_positionConstraints[h], u = c.indexA, _ = c.indexB, f = c.localCenterA, d = c.invMassA, p = c.invIA, m = c.localCenterB, v = c.invMassB, A = c.invIB, x = c.pointCount, b = this.m_positions[u].c, C = this.m_positions[u].a, T = this.m_positions[_].c, S = this.m_positions[_].a, w = 0; w < x; ++w) { + e.q.SetAngle(C), + i.q.SetAngle(S), + I.SubVV(b, F.MulRV(e.q, f, I.s_t0), e.p), + I.SubVV(T, F.MulRV(i.q, m, I.s_t0), i.p), + n.Initialize(c, e, i, w); + var E = n.normal + , M = n.point + , D = n.separation; + I.SubVV(M, b, r), + I.SubVV(M, T, s), + o = y(o, D); + var B = g(.2 * (D + l), -.2, 0) + , P = I.CrossVV(r, E) + , R = I.CrossVV(s, E) + , O = d + v + p * P * P + A * R * R + , L = O > 0 ? -B / O : 0; + I.MulSV(L, E, a), + b.SelfMulSub(d, a), + C -= p * I.CrossVV(r, a), + T.SelfMulAdd(v, a), + S += A * I.CrossVV(s, a) + } + this.m_positions[u].a = C, + this.m_positions[_].a = S + } + return o > -3 * l + } + , + t.prototype.SolveTOIPositionConstraints = function(e, i) { + for (var n = t.SolveTOIPositionConstraints_s_xfA, r = t.SolveTOIPositionConstraints_s_xfB, s = t.SolveTOIPositionConstraints_s_psm, a = t.SolveTOIPositionConstraints_s_rA, o = t.SolveTOIPositionConstraints_s_rB, h = t.SolveTOIPositionConstraints_s_P, c = 0, u = 0; u < this.m_count; ++u) { + var _ = this.m_positionConstraints[u] + , f = _.indexA + , d = _.indexB + , p = _.localCenterA + , m = _.localCenterB + , v = _.pointCount + , A = 0 + , x = 0; + f !== e && f !== i || (A = _.invMassA, + x = _.invIA); + var b = 0 + , C = 0; + d !== e && d !== i || (b = _.invMassB, + C = _.invIB); + for (var T = this.m_positions[f].c, S = this.m_positions[f].a, w = this.m_positions[d].c, E = this.m_positions[d].a, M = 0; M < v; ++M) { + n.q.SetAngle(S), + r.q.SetAngle(E), + I.SubVV(T, F.MulRV(n.q, p, I.s_t0), n.p), + I.SubVV(w, F.MulRV(r.q, m, I.s_t0), r.p), + s.Initialize(_, n, r, M); + var D = s.normal + , B = s.point + , P = s.separation; + I.SubVV(B, T, a), + I.SubVV(B, w, o), + c = y(c, P); + var R = g(.75 * (P + l), -.2, 0) + , O = I.CrossVV(a, D) + , L = I.CrossVV(o, D) + , V = A + b + x * O * O + C * L * L + , N = V > 0 ? -R / V : 0; + I.MulSV(N, D, h), + T.SelfMulSub(A, h), + S -= x * I.CrossVV(a, h), + w.SelfMulAdd(b, h), + E += C * I.CrossVV(o, h) + } + this.m_positions[f].a = S, + this.m_positions[d].a = E + } + return c >= -1.5 * l + } + , + t.InitializeVelocityConstraints_s_xfA = new V, + t.InitializeVelocityConstraints_s_xfB = new V, + t.InitializeVelocityConstraints_s_worldManifold = new At, + t.WarmStart_s_P = new I, + t.SolveVelocityConstraints_s_dv = new I, + t.SolveVelocityConstraints_s_dv1 = new I, + t.SolveVelocityConstraints_s_dv2 = new I, + t.SolveVelocityConstraints_s_P = new I, + t.SolveVelocityConstraints_s_a = new I, + t.SolveVelocityConstraints_s_b = new I, + t.SolveVelocityConstraints_s_x = new I, + t.SolveVelocityConstraints_s_d = new I, + t.SolveVelocityConstraints_s_P1 = new I, + t.SolveVelocityConstraints_s_P2 = new I, + t.SolveVelocityConstraints_s_P1P2 = new I, + t.SolvePositionConstraints_s_xfA = new V, + t.SolvePositionConstraints_s_xfB = new V, + t.SolvePositionConstraints_s_psm = new vn, + t.SolvePositionConstraints_s_rA = new I, + t.SolvePositionConstraints_s_rB = new I, + t.SolvePositionConstraints_s_P = new I, + t.SolveTOIPositionConstraints_s_xfA = new V, + t.SolveTOIPositionConstraints_s_xfB = new V, + t.SolveTOIPositionConstraints_s_psm = new vn, + t.SolveTOIPositionConstraints_s_rA = new I, + t.SolveTOIPositionConstraints_s_rB = new I, + t.SolveTOIPositionConstraints_s_P = new I, + t + } + )(), An = (function() { + function e() { + this.m_allocator = null, + this.m_bodies = [], + this.m_contacts = [], + this.m_joints = [], + this.m_positions = un.MakeArray(1024), + this.m_velocities = _n.MakeArray(1024), + this.m_bodyCount = 0, + this.m_jointCount = 0, + this.m_contactCount = 0, + this.m_bodyCapacity = 0, + this.m_contactCapacity = 0, + this.m_jointCapacity = 0 + } + return e.prototype.Initialize = function(t, e, i, n, r) { + if (this.m_bodyCapacity = t, + this.m_contactCapacity = e, + this.m_jointCapacity = i, + this.m_bodyCount = 0, + this.m_contactCount = 0, + this.m_jointCount = 0, + this.m_allocator = n, + this.m_listener = r, + this.m_positions.length < t) + for (var s = v(2 * this.m_positions.length, t); this.m_positions.length < s; ) + this.m_positions[this.m_positions.length] = new un; + if (this.m_velocities.length < t) + for (s = v(2 * this.m_velocities.length, t); this.m_velocities.length < s; ) + this.m_velocities[this.m_velocities.length] = new _n + } + , + e.prototype.Clear = function() { + this.m_bodyCount = 0, + this.m_contactCount = 0, + this.m_jointCount = 0 + } + , + e.prototype.AddBody = function(t) { + t.m_islandIndex = this.m_bodyCount, + this.m_bodies[this.m_bodyCount++] = t + } + , + e.prototype.AddContact = function(t) { + this.m_contacts[this.m_contactCount++] = t + } + , + e.prototype.AddJoint = function(t) { + this.m_joints[this.m_jointCount++] = t + } + , + e.prototype.Solve = function(n, r, s, a) { + for (var o = e.s_timer.Reset(), l = r.dt, h = 0; h < this.m_bodyCount; ++h) { + var c = this.m_bodies[h]; + this.m_positions[h].c.Copy(c.m_sweep.c); + var u = c.m_sweep.a + , _ = this.m_velocities[h].v.Copy(c.m_linearVelocity) + , f = c.m_angularVelocity; + c.m_sweep.c0.Copy(c.m_sweep.c), + c.m_sweep.a0 = c.m_sweep.a, + c.m_type === t.b2BodyType.b2_dynamicBody && (_.x += l * (c.m_gravityScale * s.x + c.m_invMass * c.m_force.x), + _.y += l * (c.m_gravityScale * s.y + c.m_invMass * c.m_force.y), + f += l * c.m_invI * c.m_torque, + _.SelfMul(1 / (1 + l * c.m_linearDamping)), + f *= 1 / (1 + l * c.m_angularDamping)), + this.m_positions[h].a = u, + this.m_velocities[h].w = f + } + o.Reset(); + var d = e.s_solverData; + d.step.Copy(r), + d.positions = this.m_positions, + d.velocities = this.m_velocities; + var p = e.s_contactSolverDef; + p.step.Copy(r), + p.contacts = this.m_contacts, + p.count = this.m_contactCount, + p.positions = this.m_positions, + p.velocities = this.m_velocities, + p.allocator = this.m_allocator; + var v = e.s_contactSolver.Initialize(p); + for (v.InitializeVelocityConstraints(), + r.warmStarting && v.WarmStart(), + h = 0; h < this.m_jointCount; ++h) + this.m_joints[h].InitVelocityConstraints(d); + for (n.solveInit = o.GetMilliseconds(), + o.Reset(), + h = 0; h < r.velocityIterations; ++h) { + for (var g = 0; g < this.m_jointCount; ++g) + this.m_joints[g].SolveVelocityConstraints(d); + v.SolveVelocityConstraints() + } + for (v.StoreImpulses(), + n.solveVelocity = o.GetMilliseconds(), + h = 0; h < this.m_bodyCount; ++h) { + var A = this.m_positions[h].c + , x = (u = this.m_positions[h].a, + _ = this.m_velocities[h].v, + f = this.m_velocities[h].w, + I.MulSV(l, _, e.s_translation)); + if (I.DotVV(x, x) > 4) { + var b = 2 / x.Length(); + _.SelfMul(b) + } + var C = l * f; + C * C > 2.4674011002726646 && (f *= b = 1.570796326795 / m(C)), + A.x += l * _.x, + A.y += l * _.y, + u += l * f, + this.m_positions[h].a = u, + this.m_velocities[h].w = f + } + o.Reset(); + var T = !1; + for (h = 0; h < r.positionIterations; ++h) { + var S = v.SolvePositionConstraints() + , w = !0; + for (g = 0; g < this.m_jointCount; ++g) { + var E = this.m_joints[g].SolvePositionConstraints(d); + w = w && E + } + if (S && w) { + T = !0; + break + } + } + for (h = 0; h < this.m_bodyCount; ++h) { + var M = this.m_bodies[h]; + M.m_sweep.c.Copy(this.m_positions[h].c), + M.m_sweep.a = this.m_positions[h].a, + M.m_linearVelocity.Copy(this.m_velocities[h].v), + M.m_angularVelocity = this.m_velocities[h].w, + M.SynchronizeTransform() + } + if (n.solvePosition = o.GetMilliseconds(), + this.Report(v.m_velocityConstraints), + a) { + var D = i; + for (h = 0; h < this.m_bodyCount; ++h) + (c = this.m_bodies[h]).GetType() !== t.b2BodyType.b2_staticBody && (!c.m_autoSleepFlag || c.m_angularVelocity * c.m_angularVelocity > .0012184696791469947 || I.DotVV(c.m_linearVelocity, c.m_linearVelocity) > 1e-4 ? (c.m_sleepTime = 0, + D = 0) : (c.m_sleepTime += l, + D = y(D, c.m_sleepTime))); + if (D >= .5 && T) + for (h = 0; h < this.m_bodyCount; ++h) + (c = this.m_bodies[h]).SetAwake(!1) + } + } + , + e.prototype.SolveTOI = function(t, i, n) { + for (var r = 0; r < this.m_bodyCount; ++r) { + var s = this.m_bodies[r]; + this.m_positions[r].c.Copy(s.m_sweep.c), + this.m_positions[r].a = s.m_sweep.a, + this.m_velocities[r].v.Copy(s.m_linearVelocity), + this.m_velocities[r].w = s.m_angularVelocity + } + var a = e.s_contactSolverDef; + a.contacts = this.m_contacts, + a.count = this.m_contactCount, + a.allocator = this.m_allocator, + a.step.Copy(t), + a.positions = this.m_positions, + a.velocities = this.m_velocities; + var o = e.s_contactSolver.Initialize(a); + for (r = 0; r < t.positionIterations && !o.SolveTOIPositionConstraints(i, n); ++r) + ; + for (this.m_bodies[i].m_sweep.c0.Copy(this.m_positions[i].c), + this.m_bodies[i].m_sweep.a0 = this.m_positions[i].a, + this.m_bodies[n].m_sweep.c0.Copy(this.m_positions[n].c), + this.m_bodies[n].m_sweep.a0 = this.m_positions[n].a, + o.InitializeVelocityConstraints(), + r = 0; r < t.velocityIterations; ++r) + o.SolveVelocityConstraints(); + var l = t.dt; + for (r = 0; r < this.m_bodyCount; ++r) { + var h = this.m_positions[r].c + , c = this.m_positions[r].a + , u = this.m_velocities[r].v + , _ = this.m_velocities[r].w + , f = I.MulSV(l, u, e.s_translation); + if (I.DotVV(f, f) > 4) { + var d = 2 / f.Length(); + u.SelfMul(d) + } + var p = l * _; + p * p > 2.4674011002726646 && (_ *= d = 1.570796326795 / m(p)), + h.SelfMulAdd(l, u), + c += l * _, + this.m_positions[r].a = c, + this.m_velocities[r].w = _; + var y = this.m_bodies[r]; + y.m_sweep.c.Copy(h), + y.m_sweep.a = c, + y.m_linearVelocity.Copy(u), + y.m_angularVelocity = _, + y.SynchronizeTransform() + } + this.Report(o.m_velocityConstraints) + } + , + e.prototype.Report = function(t) { + if (null !== this.m_listener) + for (var i = 0; i < this.m_contactCount; ++i) { + var n = this.m_contacts[i]; + if (n) { + var r = t[i] + , s = e.s_impulse; + s.count = r.pointCount; + for (var a = 0; a < r.pointCount; ++a) + s.normalImpulses[a] = r.points[a].normalImpulse, + s.tangentImpulses[a] = r.points[a].tangentImpulse; + this.m_listener.PostSolve(n, s) + } + } + } + , + e.s_timer = new U, + e.s_solverData = new fn, + e.s_contactSolverDef = new yn, + e.s_contactSolver = new gn, + e.s_translation = new I, + e.s_impulse = new rn, + e + } + )(); + (Hi = t.b2ParticleFlag || (t.b2ParticleFlag = {}))[Hi.b2_waterParticle = 0] = "b2_waterParticle", + Hi[Hi.b2_zombieParticle = 2] = "b2_zombieParticle", + Hi[Hi.b2_wallParticle = 4] = "b2_wallParticle", + Hi[Hi.b2_springParticle = 8] = "b2_springParticle", + Hi[Hi.b2_elasticParticle = 16] = "b2_elasticParticle", + Hi[Hi.b2_viscousParticle = 32] = "b2_viscousParticle", + Hi[Hi.b2_powderParticle = 64] = "b2_powderParticle", + Hi[Hi.b2_tensileParticle = 128] = "b2_tensileParticle", + Hi[Hi.b2_colorMixingParticle = 256] = "b2_colorMixingParticle", + Hi[Hi.b2_destructionListenerParticle = 512] = "b2_destructionListenerParticle", + Hi[Hi.b2_barrierParticle = 1024] = "b2_barrierParticle", + Hi[Hi.b2_staticPressureParticle = 2048] = "b2_staticPressureParticle", + Hi[Hi.b2_reactiveParticle = 4096] = "b2_reactiveParticle", + Hi[Hi.b2_repulsiveParticle = 8192] = "b2_repulsiveParticle", + Hi[Hi.b2_fixtureContactListenerParticle = 16384] = "b2_fixtureContactListenerParticle", + Hi[Hi.b2_particleContactListenerParticle = 32768] = "b2_particleContactListenerParticle", + Hi[Hi.b2_fixtureContactFilterParticle = 65536] = "b2_fixtureContactFilterParticle", + Hi[Hi.b2_particleContactFilterParticle = 131072] = "b2_particleContactFilterParticle"; + var xn = function() { + this.flags = 0, + this.position = new I, + this.velocity = new I, + this.color = new k(0,0,0,0), + this.lifetime = 0, + this.userData = null, + this.group = null + }; + function bn(t, e, i) { + return g(Math.ceil(Math.sqrt(t / (.01 * e)) * i), 1, 8) + } + var Cn, Tn = (function() { + function t() { + this.m_index = u + } + return t.prototype.GetIndex = function() { + return this.m_index + } + , + t.prototype.SetIndex = function(t) { + this.m_index = t + } + , + t + } + )(); + (Cn = t.b2ParticleGroupFlag || (t.b2ParticleGroupFlag = {}))[Cn.b2_solidParticleGroup = 1] = "b2_solidParticleGroup", + Cn[Cn.b2_rigidParticleGroup = 2] = "b2_rigidParticleGroup", + Cn[Cn.b2_particleGroupCanBeEmpty = 4] = "b2_particleGroupCanBeEmpty", + Cn[Cn.b2_particleGroupWillBeDestroyed = 8] = "b2_particleGroupWillBeDestroyed", + Cn[Cn.b2_particleGroupNeedsUpdateDepth = 16] = "b2_particleGroupNeedsUpdateDepth", + Cn[Cn.b2_particleGroupInternalMask = 24] = "b2_particleGroupInternalMask"; + var Sn = function() { + this.flags = 0, + this.groupFlags = 0, + this.position = new I, + this.angle = 0, + this.linearVelocity = new I, + this.angularVelocity = 0, + this.color = new k, + this.strength = 1, + this.shapeCount = 0, + this.stride = 0, + this.particleCount = 0, + this.lifetime = 0, + this.userData = null, + this.group = null + } + , wn = (function() { + function e(t) { + this.m_firstIndex = 0, + this.m_lastIndex = 0, + this.m_groupFlags = 0, + this.m_strength = 1, + this.m_prev = null, + this.m_next = null, + this.m_timestamp = -1, + this.m_mass = 0, + this.m_inertia = 0, + this.m_center = new I, + this.m_linearVelocity = new I, + this.m_angularVelocity = 0, + this.m_transform = new V, + this.m_userData = null, + this.m_system = t + } + return e.prototype.GetNext = function() { + return this.m_next + } + , + e.prototype.GetParticleSystem = function() { + return this.m_system + } + , + e.prototype.GetParticleCount = function() { + return this.m_lastIndex - this.m_firstIndex + } + , + e.prototype.GetBufferIndex = function() { + return this.m_firstIndex + } + , + e.prototype.ContainsParticle = function(t) { + return this.m_firstIndex <= t && t < this.m_lastIndex + } + , + e.prototype.GetAllParticleFlags = function() { + if (!this.m_system.m_flagsBuffer.data) + throw new Error; + for (var t = 0, e = this.m_firstIndex; e < this.m_lastIndex; e++) + t |= this.m_system.m_flagsBuffer.data[e]; + return t + } + , + e.prototype.GetGroupFlags = function() { + return this.m_groupFlags + } + , + e.prototype.SetGroupFlags = function(e) { + e |= this.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupInternalMask, + this.m_system.SetGroupFlags(this, e) + } + , + e.prototype.GetMass = function() { + return this.UpdateStatistics(), + this.m_mass + } + , + e.prototype.GetInertia = function() { + return this.UpdateStatistics(), + this.m_inertia + } + , + e.prototype.GetCenter = function() { + return this.UpdateStatistics(), + this.m_center + } + , + e.prototype.GetLinearVelocity = function() { + return this.UpdateStatistics(), + this.m_linearVelocity + } + , + e.prototype.GetAngularVelocity = function() { + return this.UpdateStatistics(), + this.m_angularVelocity + } + , + e.prototype.GetTransform = function() { + return this.m_transform + } + , + e.prototype.GetPosition = function() { + return this.m_transform.p + } + , + e.prototype.GetAngle = function() { + return this.m_transform.q.GetAngle() + } + , + e.prototype.GetLinearVelocityFromWorldPoint = function(t, i) { + var n = e.GetLinearVelocityFromWorldPoint_s_t0; + return this.UpdateStatistics(), + I.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, I.SubVV(t, this.m_center, n), i) + } + , + e.prototype.GetUserData = function() { + return this.m_userData + } + , + e.prototype.SetUserData = function(t) { + this.m_userData = t + } + , + e.prototype.ApplyForce = function(t) { + this.m_system.ApplyForce(this.m_firstIndex, this.m_lastIndex, t) + } + , + e.prototype.ApplyLinearImpulse = function(t) { + this.m_system.ApplyLinearImpulse(this.m_firstIndex, this.m_lastIndex, t) + } + , + e.prototype.DestroyParticles = function(t) { + if (this.m_system.m_world.IsLocked()) + throw new Error; + for (var e = this.m_firstIndex; e < this.m_lastIndex; e++) + this.m_system.DestroyParticle(e, t) + } + , + e.prototype.UpdateStatistics = function() { + if (!this.m_system.m_positionBuffer.data) + throw new Error; + if (!this.m_system.m_velocityBuffer.data) + throw new Error; + var t = new I + , e = new I; + if (this.m_timestamp !== this.m_system.m_timestamp) { + var i = this.m_system.GetParticleMass(); + this.m_mass = i * (this.m_lastIndex - this.m_firstIndex), + this.m_center.SetZero(), + this.m_linearVelocity.SetZero(); + for (var n = this.m_firstIndex; n < this.m_lastIndex; n++) + this.m_center.SelfMulAdd(i, this.m_system.m_positionBuffer.data[n]), + this.m_linearVelocity.SelfMulAdd(i, this.m_system.m_velocityBuffer.data[n]); + if (this.m_mass > 0) { + var r = 1 / this.m_mass; + this.m_center.SelfMul(r), + this.m_linearVelocity.SelfMul(r) + } + for (this.m_inertia = 0, + this.m_angularVelocity = 0, + n = this.m_firstIndex; n < this.m_lastIndex; n++) + I.SubVV(this.m_system.m_positionBuffer.data[n], this.m_center, t), + I.SubVV(this.m_system.m_velocityBuffer.data[n], this.m_linearVelocity, e), + this.m_inertia += i * I.DotVV(t, t), + this.m_angularVelocity += i * I.CrossVV(t, e); + this.m_inertia > 0 && (this.m_angularVelocity *= 1 / this.m_inertia), + this.m_timestamp = this.m_system.m_timestamp + } + } + , + e.GetLinearVelocityFromWorldPoint_s_t0 = new I, + e + } + )() + , En = (function() { + function t(t) { + this.m_front = 0, + this.m_back = 0, + this.m_capacity = 0, + this.m_buffer = d(t, (function() { + return null + } + )), + this.m_capacity = t + } + return t.prototype.Push = function(t) { + if (this.m_back >= this.m_capacity) { + for (var e = this.m_front; e < this.m_back; e++) + this.m_buffer[e - this.m_front] = this.m_buffer[e]; + this.m_back -= this.m_front, + this.m_front = 0, + this.m_back >= this.m_capacity && (this.m_capacity > 0 ? (this.m_buffer.concat(d(this.m_capacity, (function() { + return null + } + ))), + this.m_capacity *= 2) : (this.m_buffer.concat(d(1, (function() { + return null + } + ))), + this.m_capacity = 1)) + } + this.m_buffer[this.m_back] = t, + this.m_back++ + } + , + t.prototype.Pop = function() { + this.m_buffer[this.m_front] = null, + this.m_front++ + } + , + t.prototype.Empty = function() { + return this.m_front === this.m_back + } + , + t.prototype.Front = function() { + var t = this.m_buffer[this.m_front]; + if (!t) + throw new Error; + return t + } + , + t + } + )() + , Mn = (function() { + function t(e) { + this.m_generatorCapacity = 0, + this.m_generatorCount = 0, + this.m_countX = 0, + this.m_countY = 0, + this.m_diagram = [], + this.m_generatorBuffer = d(e, (function() { + return new t.Generator + } + )), + this.m_generatorCapacity = e + } + return t.prototype.AddGenerator = function(t, e, i) { + var n = this.m_generatorBuffer[this.m_generatorCount++]; + n.center.Copy(t), + n.tag = e, + n.necessary = i + } + , + t.prototype.Generate = function(e, n) { + for (var r = 1 / e, s = new I(+i,+i), a = new I(-i,-i), o = 0, l = 0; l < this.m_generatorCount; l++) + (f = this.m_generatorBuffer[l]).necessary && (I.MinV(s, f.center, s), + I.MaxV(a, f.center, a), + ++o); + if (0 === o) + return this.m_countX = 0, + void (this.m_countY = 0); + s.x -= n, + s.y -= n, + a.x += n, + a.y += n, + this.m_countX = 1 + Math.floor(r * (a.x - s.x)), + this.m_countY = 1 + Math.floor(r * (a.y - s.y)), + this.m_diagram = []; + var h = new En(4 * this.m_countX * this.m_countY); + for (l = 0; l < this.m_generatorCount; l++) { + (f = this.m_generatorBuffer[l]).center.SelfSub(s).SelfMul(r); + var c = Math.floor(f.center.x) + , u = Math.floor(f.center.y); + c >= 0 && u >= 0 && c < this.m_countX && u < this.m_countY && h.Push(new t.Task(c,u,c + u * this.m_countX,f)) + } + for (; !h.Empty(); ) { + c = (d = h.Front()).m_x, + u = d.m_y; + var _ = d.m_i + , f = d.m_generator; + h.Pop(), + this.m_diagram[_] || (this.m_diagram[_] = f, + c > 0 && h.Push(new t.Task(c - 1,u,_ - 1,f)), + u > 0 && h.Push(new t.Task(c,u - 1,_ - this.m_countX,f)), + c < this.m_countX - 1 && h.Push(new t.Task(c + 1,u,_ + 1,f)), + u < this.m_countY - 1 && h.Push(new t.Task(c,u + 1,_ + this.m_countX,f))) + } + for (u = 0; u < this.m_countY; u++) + for (c = 0; c < this.m_countX - 1; c++) + _ = c + u * this.m_countX, + (p = this.m_diagram[_]) !== (m = this.m_diagram[_ + 1]) && (h.Push(new t.Task(c,u,_,m)), + h.Push(new t.Task(c + 1,u,_ + 1,p))); + for (u = 0; u < this.m_countY - 1; u++) + for (c = 0; c < this.m_countX; c++) + _ = c + u * this.m_countX, + (p = this.m_diagram[_]) !== (m = this.m_diagram[_ + this.m_countX]) && (h.Push(new t.Task(c,u,_,m)), + h.Push(new t.Task(c,u + 1,_ + this.m_countX,p))); + for (; !h.Empty(); ) { + var d, p, m; + if (c = (d = h.Front()).m_x, + u = d.m_y, + _ = d.m_i, + l = d.m_generator, + h.Pop(), + (p = this.m_diagram[_]) !== (m = l)) { + var y = p.center.x - c + , v = p.center.y - u + , g = m.center.x - c + , A = m.center.y - u; + y * y + v * v > g * g + A * A && (this.m_diagram[_] = m, + c > 0 && h.Push(new t.Task(c - 1,u,_ - 1,m)), + u > 0 && h.Push(new t.Task(c,u - 1,_ - this.m_countX,m)), + c < this.m_countX - 1 && h.Push(new t.Task(c + 1,u,_ + 1,m)), + u < this.m_countY - 1 && h.Push(new t.Task(c,u + 1,_ + this.m_countX,m))) + } + } + } + , + t.prototype.GetNodes = function(t) { + for (var e = 0; e < this.m_countY - 1; e++) + for (var i = 0; i < this.m_countX - 1; i++) { + var n = i + e * this.m_countX + , r = this.m_diagram[n] + , s = this.m_diagram[n + 1] + , a = this.m_diagram[n + this.m_countX] + , o = this.m_diagram[n + 1 + this.m_countX]; + s !== a && (r !== s && r !== a && (r.necessary || s.necessary || a.necessary) && t(r.tag, s.tag, a.tag), + o !== s && o !== a && (r.necessary || s.necessary || a.necessary) && t(s.tag, o.tag, a.tag)) + } + } + , + t + } + )(); + function Dn(t, e, i) { + var n = t[e]; + t[e] = t[i], + t[i] = n + } + function Bn(t, e) { + return t < e + } + function In(t, e, i, n) { + void 0 === e && (e = 0), + void 0 === i && (i = t.length - e), + void 0 === n && (n = Bn); + for (var r = e, s = [], a = 0; ; ) { + for (; r + 1 < i; i++) { + var o = t[r + Math.floor(Math.random() * (i - r))]; + s[a++] = i; + for (var l = r - 1; ; ) { + for (; n(t[++l], o); ) + ; + for (; n(o, t[--i]); ) + ; + if (l >= i) + break; + Dn(t, l, i) + } + } + if (0 === a) + break; + r = i, + i = s[--a] + } + return t + } + function Pn(t, e, i, n) { + return void 0 === e && (e = 0), + void 0 === i && (i = t.length - e), + void 0 === n && (n = Bn), + In(t, e, i, n) + } + function Rn(t, e, i) { + void 0 === i && (i = t.length); + for (var n = 0, r = 0; r < i; ++r) + e(t[r]) || (r !== n ? Dn(t, n++, r) : ++n); + return n + } + function On(t, e, i, n, r) { + void 0 === r && (r = Bn); + for (var s = i - e; s > 0; ) { + var a = Math.floor(s / 2) + , o = e + a; + r(t[o], n) ? (e = ++o, + s -= a + 1) : s = a + } + return e + } + function Ln(t, e, i, n, r) { + void 0 === r && (r = Bn); + for (var s = i - e; s > 0; ) { + var a = Math.floor(s / 2) + , o = e + a; + r(n, t[o]) ? s = a : (e = ++o, + s -= a + 1) + } + return e + } + function Fn(t, e, i, n) { + for (var r = i; e !== r; ) + Dn(t, e++, r++), + r === n ? r = i : e === i && (i = r) + } + function Vn(t, e, i, n) { + if (e === i) + return i; + for (var r = e; ++e !== i; ) + n(t[r], t[e]) || Dn(t, ++r, e); + return ++r + } + (function(t) { + t.Generator = function() { + this.center = new I, + this.tag = 0, + this.necessary = !1 + } + ; + t.Task = function(t, e, i, n) { + this.m_x = t, + this.m_y = e, + this.m_i = i, + this.m_generator = n + } + } + )(Mn || (Mn = {})); + var Nn = (function() { + function t(t) { + this.data = [], + this.count = 0, + this.capacity = 0, + this.allocator = t + } + return t.prototype.Append = function() { + return this.count >= this.capacity && this.Grow(), + this.count++ + } + , + t.prototype.Reserve = function(t) { + if (!(this.capacity >= t)) { + for (var e = this.capacity; e < t; ++e) + this.data[e] = this.allocator(); + this.capacity = t + } + } + , + t.prototype.Grow = function() { + var t = this.capacity ? 2 * this.capacity : 256; + this.Reserve(t) + } + , + t.prototype.Free = function() { + 0 !== this.data.length && (this.data = [], + this.capacity = 0, + this.count = 0) + } + , + t.prototype.Shorten = function() {} + , + t.prototype.Data = function() { + return this.data + } + , + t.prototype.GetCount = function() { + return this.count + } + , + t.prototype.SetCount = function(t) { + this.count = t + } + , + t.prototype.GetCapacity = function() { + return this.capacity + } + , + t.prototype.RemoveIf = function(t) { + this.count = Rn(this.data, t, this.count) + } + , + t.prototype.Unique = function(t) { + this.count = Vn(this.data, 0, this.count, t) + } + , + t + } + )() + , kn = (function(t) { + function e(e) { + var i = t.call(this) || this; + return i.m_system = e, + i + } + return ti(e, t), + e.prototype.ShouldQueryParticleSystem = function() { + return !1 + } + , + e.prototype.ReportFixture = function(t) { + if (t.IsSensor()) + return !0; + for (var e = t.GetShape().GetChildCount(), i = 0; i < e; i++) + for (var n = t.GetAABB(i), r = this.m_system.GetInsideBoundsEnumerator(n), s = void 0; (s = r.GetNext()) >= 0; ) + this.ReportFixtureAndParticle(t, i, s); + return !0 + } + , + e.prototype.ReportParticle = function() { + return !1 + } + , + e.prototype.ReportFixtureAndParticle = function() {} + , + e + } + )(an) + , Gn = (function() { + function t() { + this.indexA = 0, + this.indexB = 0, + this.weight = 0, + this.normal = new I, + this.flags = 0 + } + return t.prototype.SetIndices = function(t, e) { + this.indexA = t, + this.indexB = e + } + , + t.prototype.SetWeight = function(t) { + this.weight = t + } + , + t.prototype.SetNormal = function(t) { + this.normal.Copy(t) + } + , + t.prototype.SetFlags = function(t) { + this.flags = t + } + , + t.prototype.GetIndexA = function() { + return this.indexA + } + , + t.prototype.GetIndexB = function() { + return this.indexB + } + , + t.prototype.GetWeight = function() { + return this.weight + } + , + t.prototype.GetNormal = function() { + return this.normal + } + , + t.prototype.GetFlags = function() { + return this.flags + } + , + t.prototype.IsEqual = function(t) { + return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && this.weight === t.weight && this.normal.x === t.normal.x && this.normal.y === t.normal.y + } + , + t.prototype.IsNotEqual = function(t) { + return !this.IsEqual(t) + } + , + t.prototype.ApproximatelyEqual = function(t) { + return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && m(this.weight - t.weight) < .01 && I.DistanceSquaredVV(this.normal, t.normal) < 1e-4 + } + , + t + } + )() + , Un = function() { + this.index = 0, + this.weight = 0, + this.normal = new I, + this.mass = 0 + } + , zn = function() { + this.indexA = 0, + this.indexB = 0, + this.flags = 0, + this.strength = 0, + this.distance = 0 + } + , Hn = function() { + this.indexA = 0, + this.indexB = 0, + this.indexC = 0, + this.flags = 0, + this.strength = 0, + this.pa = new I(0,0), + this.pb = new I(0,0), + this.pc = new I(0,0), + this.ka = 0, + this.kb = 0, + this.kc = 0, + this.s = 0 + } + , Wn = (function() { + function t() { + this.strictContactCheck = !1, + this.density = 1, + this.gravityScale = 1, + this.radius = 1, + this.maxCount = 0, + this.pressureStrength = .005, + this.dampingStrength = 1, + this.elasticStrength = .25, + this.springStrength = .25, + this.viscousStrength = .25, + this.surfaceTensionPressureStrength = .2, + this.surfaceTensionNormalStrength = .2, + this.repulsiveStrength = 1, + this.powderStrength = .5, + this.ejectionStrength = .5, + this.staticPressureStrength = .2, + this.staticPressureRelaxation = .2, + this.staticPressureIterations = 8, + this.colorMixingStrength = .5, + this.destroyByAge = !0, + this.lifetimeGranularity = 1 / 60 + } + return t.prototype.Copy = function(t) { + return this.strictContactCheck = t.strictContactCheck, + this.density = t.density, + this.gravityScale = t.gravityScale, + this.radius = t.radius, + this.maxCount = t.maxCount, + this.pressureStrength = t.pressureStrength, + this.dampingStrength = t.dampingStrength, + this.elasticStrength = t.elasticStrength, + this.springStrength = t.springStrength, + this.viscousStrength = t.viscousStrength, + this.surfaceTensionPressureStrength = t.surfaceTensionPressureStrength, + this.surfaceTensionNormalStrength = t.surfaceTensionNormalStrength, + this.repulsiveStrength = t.repulsiveStrength, + this.powderStrength = t.powderStrength, + this.ejectionStrength = t.ejectionStrength, + this.staticPressureStrength = t.staticPressureStrength, + this.staticPressureRelaxation = t.staticPressureRelaxation, + this.staticPressureIterations = t.staticPressureIterations, + this.colorMixingStrength = t.colorMixingStrength, + this.destroyByAge = t.destroyByAge, + this.lifetimeGranularity = t.lifetimeGranularity, + this + } + , + t.prototype.Clone = function() { + return (new t).Copy(this) + } + , + t + } + )(); + t.b2ParticleSystem = (function() { + function n(t, e) { + this.m_paused = !1, + this.m_timestamp = 0, + this.m_allParticleFlags = 0, + this.m_needsUpdateAllParticleFlags = !1, + this.m_allGroupFlags = 0, + this.m_needsUpdateAllGroupFlags = !1, + this.m_hasForce = !1, + this.m_iterationIndex = 0, + this.m_inverseDensity = 0, + this.m_particleDiameter = 0, + this.m_inverseDiameter = 0, + this.m_squaredDiameter = 0, + this.m_count = 0, + this.m_internalAllocatedCapacity = 0, + this.m_handleIndexBuffer = new n.UserOverridableBuffer, + this.m_flagsBuffer = new n.UserOverridableBuffer, + this.m_positionBuffer = new n.UserOverridableBuffer, + this.m_velocityBuffer = new n.UserOverridableBuffer, + this.m_forceBuffer = [], + this.m_weightBuffer = [], + this.m_staticPressureBuffer = [], + this.m_accumulationBuffer = [], + this.m_accumulation2Buffer = [], + this.m_depthBuffer = [], + this.m_colorBuffer = new n.UserOverridableBuffer, + this.m_groupBuffer = [], + this.m_userDataBuffer = new n.UserOverridableBuffer, + this.m_stuckThreshold = 0, + this.m_lastBodyContactStepBuffer = new n.UserOverridableBuffer, + this.m_bodyContactCountBuffer = new n.UserOverridableBuffer, + this.m_consecutiveContactStepsBuffer = new n.UserOverridableBuffer, + this.m_stuckParticleBuffer = new Nn(function() { + return 0 + } + ), + this.m_proxyBuffer = new Nn(function() { + return new n.Proxy + } + ), + this.m_contactBuffer = new Nn(function() { + return new Gn + } + ), + this.m_bodyContactBuffer = new Nn(function() { + return new Un + } + ), + this.m_pairBuffer = new Nn(function() { + return new zn + } + ), + this.m_triadBuffer = new Nn(function() { + return new Hn + } + ), + this.m_expirationTimeBuffer = new n.UserOverridableBuffer, + this.m_indexByExpirationTimeBuffer = new n.UserOverridableBuffer, + this.m_timeElapsed = 0, + this.m_expirationTimeBufferRequiresSorting = !1, + this.m_groupCount = 0, + this.m_groupList = null, + this.m_def = new Wn, + this.m_prev = null, + this.m_next = null, + this.SetStrictContactCheck(t.strictContactCheck), + this.SetDensity(t.density), + this.SetGravityScale(t.gravityScale), + this.SetRadius(t.radius), + this.SetMaxParticleCount(t.maxCount), + this.m_def = t.Clone(), + this.m_world = e, + this.SetDestructionByAge(this.m_def.destroyByAge) + } + return n.computeTag = function(t, e) { + return (e + n.yOffset >>> 0 << n.yShift) + (n.xScale * t + n.xOffset >>> 0) >>> 0 + } + , + n.computeRelativeTag = function(t, e, i) { + return t + (i << n.yShift) + (e << n.xShift) >>> 0 + } + , + n.prototype.Drop = function() { + for (; this.m_groupList; ) + this.DestroyParticleGroup(this.m_groupList); + this.FreeUserOverridableBuffer(this.m_handleIndexBuffer), + this.FreeUserOverridableBuffer(this.m_flagsBuffer), + this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer), + this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer), + this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer), + this.FreeUserOverridableBuffer(this.m_positionBuffer), + this.FreeUserOverridableBuffer(this.m_velocityBuffer), + this.FreeUserOverridableBuffer(this.m_colorBuffer), + this.FreeUserOverridableBuffer(this.m_userDataBuffer), + this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer), + this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer), + this.FreeBuffer(this.m_forceBuffer, this.m_internalAllocatedCapacity), + this.FreeBuffer(this.m_weightBuffer, this.m_internalAllocatedCapacity), + this.FreeBuffer(this.m_staticPressureBuffer, this.m_internalAllocatedCapacity), + this.FreeBuffer(this.m_accumulationBuffer, this.m_internalAllocatedCapacity), + this.FreeBuffer(this.m_accumulation2Buffer, this.m_internalAllocatedCapacity), + this.FreeBuffer(this.m_depthBuffer, this.m_internalAllocatedCapacity), + this.FreeBuffer(this.m_groupBuffer, this.m_internalAllocatedCapacity) + } + , + n.prototype.CreateParticle = function(t) { + if (this.m_world.IsLocked()) + throw new Error; + if (this.m_count >= this.m_internalAllocatedCapacity) { + var i = this.m_count ? 2 * this.m_count : 256; + this.ReallocateInternalAllocatedBuffers(i) + } + if (this.m_count >= this.m_internalAllocatedCapacity) { + if (!this.m_def.destroyByAge) + return u; + this.DestroyOldestParticle(0, !1), + this.SolveZombie() + } + var n = this.m_count++; + if (!this.m_flagsBuffer.data) + throw new Error; + if (this.m_flagsBuffer.data[n] = 0, + this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[n] = 0), + this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[n] = 0), + this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[n] = 0), + !this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + this.m_positionBuffer.data[n] = (this.m_positionBuffer.data[n] || new I).Copy(e(t.position, I.ZERO)), + this.m_velocityBuffer.data[n] = (this.m_velocityBuffer.data[n] || new I).Copy(e(t.velocity, I.ZERO)), + this.m_weightBuffer[n] = 0, + this.m_forceBuffer[n] = (this.m_forceBuffer[n] || new I).SetZero(), + this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = 0), + this.m_depthBuffer && (this.m_depthBuffer[n] = 0); + var r = (new k).Copy(e(t.color, k.ZERO)); + !this.m_colorBuffer.data && r.IsZero() || (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data), + this.m_colorBuffer.data[n] = (this.m_colorBuffer.data[n] || new k).Copy(r)), + (this.m_userDataBuffer.data || t.userData) && (this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data), + this.m_userDataBuffer.data[n] = t.userData), + this.m_handleIndexBuffer.data && (this.m_handleIndexBuffer.data[n] = null); + var s = this.m_proxyBuffer.data[this.m_proxyBuffer.Append()] + , a = e(t.lifetime, 0) + , o = a > 0; + if (this.m_expirationTimeBuffer.data || o) { + if (this.SetParticleLifetime(n, o ? a : this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())), + !this.m_indexByExpirationTimeBuffer.data) + throw new Error; + this.m_indexByExpirationTimeBuffer.data[n] = n + } + s.index = n; + var l = e(t.group, null); + return this.m_groupBuffer[n] = l, + l && (l.m_firstIndex < l.m_lastIndex ? (this.RotateBuffer(l.m_firstIndex, l.m_lastIndex, n), + l.m_lastIndex = n + 1) : (l.m_firstIndex = n, + l.m_lastIndex = n + 1)), + this.SetParticleFlags(n, e(t.flags, 0)), + n + } + , + n.prototype.GetParticleHandleFromIndex = function(t) { + this.m_handleIndexBuffer.data = this.RequestBuffer(this.m_handleIndexBuffer.data); + var e = this.m_handleIndexBuffer.data[t]; + return e || ((e = new Tn).SetIndex(t), + this.m_handleIndexBuffer.data[t] = e, + e) + } + , + n.prototype.DestroyParticle = function(e, i) { + if (void 0 === i && (i = !1), + !this.m_flagsBuffer.data) + throw new Error; + var n = t.b2ParticleFlag.b2_zombieParticle; + i && (n |= t.b2ParticleFlag.b2_destructionListenerParticle), + this.SetParticleFlags(e, this.m_flagsBuffer.data[e] | n) + } + , + n.prototype.DestroyOldestParticle = function(t, e) { + void 0 === e && (e = !1); + var i = this.GetParticleCount(); + if (!this.m_indexByExpirationTimeBuffer.data) + throw new Error; + if (!this.m_expirationTimeBuffer.data) + throw new Error; + var n = this.m_indexByExpirationTimeBuffer.data[i - (t + 1)] + , r = this.m_indexByExpirationTimeBuffer.data[t]; + this.DestroyParticle(this.m_expirationTimeBuffer.data[n] > 0 ? n : r, e) + } + , + n.prototype.DestroyParticlesInShape = function(t, e, i) { + void 0 === i && (i = !1); + var r = n.DestroyParticlesInShape_s_aabb; + if (this.m_world.IsLocked()) + throw new Error; + var s = new n.DestroyParticlesInShapeCallback(this,t,e,i) + , a = r; + return t.ComputeAABB(a, e, 0), + this.m_world.QueryAABB(s, a), + s.Destroyed() + } + , + n.prototype.CreateParticleGroup = function(t) { + var i = n.CreateParticleGroup_s_transform; + if (this.m_world.IsLocked()) + throw new Error; + var r = i; + r.SetPositionAngle(e(t.position, I.ZERO), e(t.angle, 0)); + var s = this.m_count; + if (t.shape && this.CreateParticlesWithShapeForGroup(t.shape, t, r), + t.shapes && this.CreateParticlesWithShapesForGroup(t.shapes, e(t.shapeCount, t.shapes.length), t, r), + t.positionData) + for (var a = e(t.particleCount, t.positionData.length), o = 0; o < a; o++) { + var l = t.positionData[o]; + this.CreateParticleForGroup(t, r, l) + } + var h = this.m_count + , c = new wn(this); + for (c.m_firstIndex = s, + c.m_lastIndex = h, + c.m_strength = e(t.strength, 1), + c.m_userData = t.userData, + c.m_transform.Copy(r), + c.m_prev = null, + c.m_next = this.m_groupList, + this.m_groupList && (this.m_groupList.m_prev = c), + this.m_groupList = c, + ++this.m_groupCount, + o = s; o < h; o++) + this.m_groupBuffer[o] = c; + this.SetGroupFlags(c, e(t.groupFlags, 0)); + var u = new n.ConnectionFilter; + return this.UpdateContacts(!0), + this.UpdatePairsAndTriads(s, h, u), + t.group && (this.JoinParticleGroups(t.group, c), + c = t.group), + c + } + , + n.prototype.JoinParticleGroups = function(t, e) { + if (this.m_world.IsLocked()) + throw new Error; + this.RotateBuffer(e.m_firstIndex, e.m_lastIndex, this.m_count), + this.RotateBuffer(t.m_firstIndex, t.m_lastIndex, e.m_firstIndex); + var i = new n.JoinParticleGroupsFilter(e.m_firstIndex); + this.UpdateContacts(!0), + this.UpdatePairsAndTriads(t.m_firstIndex, e.m_lastIndex, i); + for (var r = e.m_firstIndex; r < e.m_lastIndex; r++) + this.m_groupBuffer[r] = t; + var s = t.m_groupFlags | e.m_groupFlags; + this.SetGroupFlags(t, s), + t.m_lastIndex = e.m_lastIndex, + e.m_firstIndex = e.m_lastIndex, + this.DestroyParticleGroup(e) + } + , + n.prototype.SplitParticleGroup = function(t) { + this.UpdateContacts(!0); + var e = d(t.GetParticleCount(), (function() { + return new n.ParticleListNode + } + )); + n.InitializeParticleLists(t, e), + this.MergeParticleListsInContact(t, e); + var i = n.FindLongestParticleList(t, e); + this.MergeZombieParticleListNodes(t, e, i), + this.CreateParticleGroupsFromParticleList(t, e, i), + this.UpdatePairsAndTriadsWithParticleList(t, e) + } + , + n.prototype.GetParticleGroupList = function() { + return this.m_groupList + } + , + n.prototype.GetParticleGroupCount = function() { + return this.m_groupCount + } + , + n.prototype.GetParticleCount = function() { + return this.m_count + } + , + n.prototype.GetMaxParticleCount = function() { + return this.m_def.maxCount + } + , + n.prototype.SetMaxParticleCount = function(t) { + this.m_def.maxCount = t + } + , + n.prototype.GetAllParticleFlags = function() { + return this.m_allParticleFlags + } + , + n.prototype.GetAllGroupFlags = function() { + return this.m_allGroupFlags + } + , + n.prototype.SetPaused = function(t) { + this.m_paused = t + } + , + n.prototype.GetPaused = function() { + return this.m_paused + } + , + n.prototype.SetDensity = function(t) { + this.m_def.density = t, + this.m_inverseDensity = 1 / this.m_def.density + } + , + n.prototype.GetDensity = function() { + return this.m_def.density + } + , + n.prototype.SetGravityScale = function(t) { + this.m_def.gravityScale = t + } + , + n.prototype.GetGravityScale = function() { + return this.m_def.gravityScale + } + , + n.prototype.SetDamping = function(t) { + this.m_def.dampingStrength = t + } + , + n.prototype.GetDamping = function() { + return this.m_def.dampingStrength + } + , + n.prototype.SetStaticPressureIterations = function(t) { + this.m_def.staticPressureIterations = t + } + , + n.prototype.GetStaticPressureIterations = function() { + return this.m_def.staticPressureIterations + } + , + n.prototype.SetRadius = function(t) { + this.m_particleDiameter = 2 * t, + this.m_squaredDiameter = this.m_particleDiameter * this.m_particleDiameter, + this.m_inverseDiameter = 1 / this.m_particleDiameter + } + , + n.prototype.GetRadius = function() { + return this.m_particleDiameter / 2 + } + , + n.prototype.GetPositionBuffer = function() { + if (!this.m_positionBuffer.data) + throw new Error; + return this.m_positionBuffer.data + } + , + n.prototype.GetVelocityBuffer = function() { + if (!this.m_velocityBuffer.data) + throw new Error; + return this.m_velocityBuffer.data + } + , + n.prototype.GetColorBuffer = function() { + return this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data), + this.m_colorBuffer.data + } + , + n.prototype.GetGroupBuffer = function() { + return this.m_groupBuffer + } + , + n.prototype.GetWeightBuffer = function() { + return this.m_weightBuffer + } + , + n.prototype.GetUserDataBuffer = function() { + return this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data), + this.m_userDataBuffer.data + } + , + n.prototype.GetFlagsBuffer = function() { + if (!this.m_flagsBuffer.data) + throw new Error; + return this.m_flagsBuffer.data + } + , + n.prototype.SetParticleFlags = function(e, i) { + if (!this.m_flagsBuffer.data) + throw new Error; + this.m_flagsBuffer.data[e] & ~i && (this.m_needsUpdateAllParticleFlags = !0), + ~this.m_allParticleFlags & i && (i & t.b2ParticleFlag.b2_tensileParticle && (this.m_accumulation2Buffer = this.RequestBuffer(this.m_accumulation2Buffer)), + i & t.b2ParticleFlag.b2_colorMixingParticle && (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data)), + this.m_allParticleFlags |= i), + this.m_flagsBuffer.data[e] = i + } + , + n.prototype.GetParticleFlags = function(t) { + if (!this.m_flagsBuffer.data) + throw new Error; + return this.m_flagsBuffer.data[t] + } + , + n.prototype.SetFlagsBuffer = function(t, e) { + this.SetUserOverridableBuffer(this.m_flagsBuffer, t, e) + } + , + n.prototype.SetPositionBuffer = function(t, e) { + this.SetUserOverridableBuffer(this.m_positionBuffer, t, e) + } + , + n.prototype.SetVelocityBuffer = function(t, e) { + this.SetUserOverridableBuffer(this.m_velocityBuffer, t, e) + } + , + n.prototype.SetColorBuffer = function(t, e) { + this.SetUserOverridableBuffer(this.m_colorBuffer, t, e) + } + , + n.prototype.SetUserDataBuffer = function(t, e) { + this.SetUserOverridableBuffer(this.m_userDataBuffer, t, e) + } + , + n.prototype.GetContacts = function() { + return this.m_contactBuffer.data + } + , + n.prototype.GetContactCount = function() { + return this.m_contactBuffer.count + } + , + n.prototype.GetBodyContacts = function() { + return this.m_bodyContactBuffer.data + } + , + n.prototype.GetBodyContactCount = function() { + return this.m_bodyContactBuffer.count + } + , + n.prototype.GetPairs = function() { + return this.m_pairBuffer.data + } + , + n.prototype.GetPairCount = function() { + return this.m_pairBuffer.count + } + , + n.prototype.GetTriads = function() { + return this.m_triadBuffer.data + } + , + n.prototype.GetTriadCount = function() { + return this.m_triadBuffer.count + } + , + n.prototype.SetStuckThreshold = function(t) { + this.m_stuckThreshold = t, + t > 0 && (this.m_lastBodyContactStepBuffer.data = this.RequestBuffer(this.m_lastBodyContactStepBuffer.data), + this.m_bodyContactCountBuffer.data = this.RequestBuffer(this.m_bodyContactCountBuffer.data), + this.m_consecutiveContactStepsBuffer.data = this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data)) + } + , + n.prototype.GetStuckCandidates = function() { + return this.m_stuckParticleBuffer.Data() + } + , + n.prototype.GetStuckCandidateCount = function() { + return this.m_stuckParticleBuffer.GetCount() + } + , + n.prototype.ComputeCollisionEnergy = function() { + if (!this.m_velocityBuffer.data) + throw new Error; + for (var t = n.ComputeCollisionEnergy_s_v, e = this.m_velocityBuffer.data, i = 0, r = 0; r < this.m_contactBuffer.count; r++) { + var s = this.m_contactBuffer.data[r] + , a = s.indexA + , o = s.indexB + , l = s.normal + , h = I.SubVV(e[o], e[a], t) + , c = I.DotVV(h, l); + c < 0 && (i += c * c) + } + return .5 * this.GetParticleMass() * i + } + , + n.prototype.SetStrictContactCheck = function(t) { + this.m_def.strictContactCheck = t + } + , + n.prototype.GetStrictContactCheck = function() { + return this.m_def.strictContactCheck + } + , + n.prototype.SetParticleLifetime = function(t, e) { + var i = null === this.m_indexByExpirationTimeBuffer.data; + if (this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data), + this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data), + i) + for (var n = this.GetParticleCount(), r = 0; r < n; ++r) + this.m_indexByExpirationTimeBuffer.data[r] = r; + var s = e / this.m_def.lifetimeGranularity + , a = s > 0 ? this.GetQuantizedTimeElapsed() + s : s; + a !== this.m_expirationTimeBuffer.data[t] && (this.m_expirationTimeBuffer.data[t] = a, + this.m_expirationTimeBufferRequiresSorting = !0) + } + , + n.prototype.GetParticleLifetime = function(t) { + return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t]) + } + , + n.prototype.SetDestructionByAge = function(t) { + t && this.GetExpirationTimeBuffer(), + this.m_def.destroyByAge = t + } + , + n.prototype.GetDestructionByAge = function() { + return this.m_def.destroyByAge + } + , + n.prototype.GetExpirationTimeBuffer = function() { + return this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data), + this.m_expirationTimeBuffer.data + } + , + n.prototype.ExpirationTimeToLifetime = function(t) { + return (t > 0 ? t - this.GetQuantizedTimeElapsed() : t) * this.m_def.lifetimeGranularity + } + , + n.prototype.GetIndexByExpirationTimeBuffer = function() { + if (this.GetParticleCount() ? this.SetParticleLifetime(0, this.GetParticleLifetime(0)) : this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data), + !this.m_indexByExpirationTimeBuffer.data) + throw new Error; + return this.m_indexByExpirationTimeBuffer.data + } + , + n.prototype.ParticleApplyLinearImpulse = function(t, e) { + this.ApplyLinearImpulse(t, t + 1, e) + } + , + n.prototype.ApplyLinearImpulse = function(t, e, i) { + if (!this.m_velocityBuffer.data) + throw new Error; + for (var n = this.m_velocityBuffer.data, r = (e - t) * this.GetParticleMass(), s = (new I).Copy(i).SelfMul(1 / r), a = t; a < e; a++) + n[a].SelfAdd(s) + } + , + n.IsSignificantForce = function(t) { + return 0 !== t.x || 0 !== t.y + } + , + n.prototype.ParticleApplyForce = function(t, e) { + if (!this.m_flagsBuffer.data) + throw new Error; + n.IsSignificantForce(e) && this.ForceCanBeApplied(this.m_flagsBuffer.data[t]) && (this.PrepareForceBuffer(), + this.m_forceBuffer[t].SelfAdd(e)) + } + , + n.prototype.ApplyForce = function(t, e, i) { + var r = (new I).Copy(i).SelfMul(1 / (e - t)); + if (n.IsSignificantForce(r)) { + this.PrepareForceBuffer(); + for (var s = t; s < e; s++) + this.m_forceBuffer[s].SelfAdd(r) + } + } + , + n.prototype.GetNext = function() { + return this.m_next + } + , + n.prototype.QueryAABB = function(t, e) { + if (0 !== this.m_proxyBuffer.count) { + var i = this.m_proxyBuffer.count + , r = On(this.m_proxyBuffer.data, 0, i, n.computeTag(this.m_inverseDiameter * e.lowerBound.x, this.m_inverseDiameter * e.lowerBound.y), n.Proxy.CompareProxyTag) + , s = Ln(this.m_proxyBuffer.data, r, i, n.computeTag(this.m_inverseDiameter * e.upperBound.x, this.m_inverseDiameter * e.upperBound.y), n.Proxy.CompareTagProxy); + if (!this.m_positionBuffer.data) + throw new Error; + for (var a = this.m_positionBuffer.data, o = r; o < s; ++o) { + var l = this.m_proxyBuffer.data[o].index + , h = a[l]; + if (e.lowerBound.x < h.x && h.x < e.upperBound.x && e.lowerBound.y < h.y && h.y < e.upperBound.y && !t.ReportParticle(this, l)) + break + } + } + } + , + n.prototype.QueryShapeAABB = function(t, e, i, r) { + void 0 === r && (r = 0); + var s = n.QueryShapeAABB_s_aabb; + e.ComputeAABB(s, i, r), + this.QueryAABB(t, s) + } + , + n.prototype.QueryPointAABB = function(t, e, i) { + void 0 === i && (i = l); + var r = n.QueryPointAABB_s_aabb; + r.lowerBound.Set(e.x - i, e.y - i), + r.upperBound.Set(e.x + i, e.y + i), + this.QueryAABB(t, r) + } + , + n.prototype.RayCast = function(t, e, i) { + var r = n.RayCast_s_aabb + , s = n.RayCast_s_p + , a = n.RayCast_s_v + , o = n.RayCast_s_n + , l = n.RayCast_s_point; + if (0 !== this.m_proxyBuffer.count) { + if (!this.m_positionBuffer.data) + throw new Error; + var h = this.m_positionBuffer.data + , c = r; + I.MinV(e, i, c.lowerBound), + I.MaxV(e, i, c.upperBound); + for (var u, _ = 1, f = I.SubVV(i, e, a), d = I.DotVV(f, f), p = this.GetInsideBoundsEnumerator(c); (u = p.GetNext()) >= 0; ) { + var m = I.SubVV(e, h[u], s) + , v = I.DotVV(m, f) + , g = v * v - d * (I.DotVV(m, m) - this.m_squaredDiameter); + if (g >= 0) { + var A = T(g) + , x = (-v - A) / d; + if (x > _) + continue; + if (x < 0 && ((x = (-v + A) / d) < 0 || x > _)) + continue; + var b = I.AddVMulSV(m, x, f, o); + b.Normalize(); + var C = t.ReportParticle(this, u, I.AddVMulSV(e, x, f, l), b, x); + if ((_ = y(_, C)) <= 0) + break + } + } + } + } + , + n.prototype.ComputeAABB = function(t) { + var e = this.GetParticleCount(); + if (t.lowerBound.x = +i, + t.lowerBound.y = +i, + t.upperBound.x = -i, + t.upperBound.y = -i, + !this.m_positionBuffer.data) + throw new Error; + for (var n = this.m_positionBuffer.data, r = 0; r < e; r++) { + var s = n[r]; + I.MinV(t.lowerBound, s, t.lowerBound), + I.MaxV(t.upperBound, s, t.upperBound) + } + t.lowerBound.x -= this.m_particleDiameter, + t.lowerBound.y -= this.m_particleDiameter, + t.upperBound.x += this.m_particleDiameter, + t.upperBound.y += this.m_particleDiameter + } + , + n.prototype.FreeBuffer = function(t) { + null !== t && (t.length = 0) + } + , + n.prototype.FreeUserOverridableBuffer = function(t) { + 0 === t.userSuppliedCapacity && this.FreeBuffer(t.data, this.m_internalAllocatedCapacity) + } + , + n.prototype.ReallocateBuffer3 = function(t, e, i) { + if (i <= e) + throw new Error; + var n = t ? t.slice() : []; + return n.length = i, + n + } + , + n.prototype.ReallocateBuffer5 = function(t, e, i, n, r) { + if (n <= i) + throw new Error; + if (e && !(n <= e)) + throw new Error; + return r && !t || e || (t = this.ReallocateBuffer3(t, i, n)), + t + } + , + n.prototype.ReallocateBuffer4 = function(t, e, i, n) { + return this.ReallocateBuffer5(t.data, t.userSuppliedCapacity, e, i, n) + } + , + n.prototype.RequestBuffer = function(t) { + return t || (0 === this.m_internalAllocatedCapacity && this.ReallocateInternalAllocatedBuffers(256), + (t = []).length = this.m_internalAllocatedCapacity), + t + } + , + n.prototype.ReallocateHandleBuffers = function(t) { + this.m_handleIndexBuffer.data = this.ReallocateBuffer4(this.m_handleIndexBuffer, this.m_internalAllocatedCapacity, t, !0) + } + , + n.prototype.ReallocateInternalAllocatedBuffers = function(t) { + function e(t, e) { + return e && t > e ? e : t + } + if (t = e(t, this.m_def.maxCount), + t = e(t, this.m_flagsBuffer.userSuppliedCapacity), + t = e(t, this.m_positionBuffer.userSuppliedCapacity), + t = e(t, this.m_velocityBuffer.userSuppliedCapacity), + t = e(t, this.m_colorBuffer.userSuppliedCapacity), + t = e(t, this.m_userDataBuffer.userSuppliedCapacity), + this.m_internalAllocatedCapacity < t) { + this.ReallocateHandleBuffers(t), + this.m_flagsBuffer.data = this.ReallocateBuffer4(this.m_flagsBuffer, this.m_internalAllocatedCapacity, t, !1); + var i = this.m_stuckThreshold > 0; + this.m_lastBodyContactStepBuffer.data = this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer, this.m_internalAllocatedCapacity, t, i), + this.m_bodyContactCountBuffer.data = this.ReallocateBuffer4(this.m_bodyContactCountBuffer, this.m_internalAllocatedCapacity, t, i), + this.m_consecutiveContactStepsBuffer.data = this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer, this.m_internalAllocatedCapacity, t, i), + this.m_positionBuffer.data = this.ReallocateBuffer4(this.m_positionBuffer, this.m_internalAllocatedCapacity, t, !1), + this.m_velocityBuffer.data = this.ReallocateBuffer4(this.m_velocityBuffer, this.m_internalAllocatedCapacity, t, !1), + this.m_forceBuffer = this.ReallocateBuffer5(this.m_forceBuffer, 0, this.m_internalAllocatedCapacity, t, !1), + this.m_weightBuffer = this.ReallocateBuffer5(this.m_weightBuffer, 0, this.m_internalAllocatedCapacity, t, !1), + this.m_staticPressureBuffer = this.ReallocateBuffer5(this.m_staticPressureBuffer, 0, this.m_internalAllocatedCapacity, t, !0), + this.m_accumulationBuffer = this.ReallocateBuffer5(this.m_accumulationBuffer, 0, this.m_internalAllocatedCapacity, t, !1), + this.m_accumulation2Buffer = this.ReallocateBuffer5(this.m_accumulation2Buffer, 0, this.m_internalAllocatedCapacity, t, !0), + this.m_depthBuffer = this.ReallocateBuffer5(this.m_depthBuffer, 0, this.m_internalAllocatedCapacity, t, !0), + this.m_colorBuffer.data = this.ReallocateBuffer4(this.m_colorBuffer, this.m_internalAllocatedCapacity, t, !0), + this.m_groupBuffer = this.ReallocateBuffer5(this.m_groupBuffer, 0, this.m_internalAllocatedCapacity, t, !1), + this.m_userDataBuffer.data = this.ReallocateBuffer4(this.m_userDataBuffer, this.m_internalAllocatedCapacity, t, !0), + this.m_expirationTimeBuffer.data = this.ReallocateBuffer4(this.m_expirationTimeBuffer, this.m_internalAllocatedCapacity, t, !0), + this.m_indexByExpirationTimeBuffer.data = this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer, this.m_internalAllocatedCapacity, t, !1), + this.m_internalAllocatedCapacity = t + } + } + , + n.prototype.CreateParticleForGroup = function(t, i, n) { + var r = new xn; + r.flags = e(t.flags, 0), + V.MulXV(i, n, r.position), + I.AddVV(e(t.linearVelocity, I.ZERO), I.CrossSV(e(t.angularVelocity, 0), I.SubVV(r.position, e(t.position, I.ZERO), I.s_t0), I.s_t0), r.velocity), + r.color.Copy(e(t.color, k.ZERO)), + r.lifetime = e(t.lifetime, 0), + r.userData = t.userData, + this.CreateParticle(r) + } + , + n.prototype.CreateParticlesStrokeShapeForGroup = function(i, r, s) { + var a = n.CreateParticlesStrokeShapeForGroup_s_edge + , o = n.CreateParticlesStrokeShapeForGroup_s_d + , l = n.CreateParticlesStrokeShapeForGroup_s_p + , h = e(r.stride, 0); + 0 === h && (h = this.GetParticleStride()); + for (var c = 0, u = i.GetChildCount(), _ = 0; _ < u; _++) { + var f = null; + i.GetType() === t.b2ShapeType.e_edgeShape ? f = i : (f = a, + i.GetChildEdge(f, _)); + for (var d = I.SubVV(f.m_vertex2, f.m_vertex1, o), p = d.Length(); c < p; ) { + var m = I.AddVMulSV(f.m_vertex1, c / p, d, l); + this.CreateParticleForGroup(r, s, m), + c += h + } + c -= p + } + } + , + n.prototype.CreateParticlesFillShapeForGroup = function(t, i, r) { + var s = n.CreateParticlesFillShapeForGroup_s_aabb + , a = n.CreateParticlesFillShapeForGroup_s_p + , o = e(i.stride, 0); + 0 === o && (o = this.GetParticleStride()); + var l = V.IDENTITY + , h = s; + t.ComputeAABB(h, l, 0); + for (var c = Math.floor(h.lowerBound.y / o) * o; c < h.upperBound.y; c += o) + for (var u = Math.floor(h.lowerBound.x / o) * o; u < h.upperBound.x; u += o) { + var _ = a.Set(u, c); + t.TestPoint(l, _) && this.CreateParticleForGroup(i, r, _) + } + } + , + n.prototype.CreateParticlesWithShapeForGroup = function(e, i, n) { + switch (e.GetType()) { + case t.b2ShapeType.e_edgeShape: + case t.b2ShapeType.e_chainShape: + this.CreateParticlesStrokeShapeForGroup(e, i, n); + break; + case t.b2ShapeType.e_polygonShape: + case t.b2ShapeType.e_circleShape: + this.CreateParticlesFillShapeForGroup(e, i, n) + } + } + , + n.prototype.CreateParticlesWithShapesForGroup = function(t, e, i, r) { + var s = new n.CompositeShape(t,e); + this.CreateParticlesFillShapeForGroup(s, i, r) + } + , + n.prototype.CloneParticle = function(t, e) { + var i = new xn; + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + i.flags = this.m_flagsBuffer.data[t], + i.position.Copy(this.m_positionBuffer.data[t]), + i.velocity.Copy(this.m_velocityBuffer.data[t]), + this.m_colorBuffer.data && i.color.Copy(this.m_colorBuffer.data[t]), + this.m_userDataBuffer.data && (i.userData = this.m_userDataBuffer.data[t]), + i.group = e; + var n = this.CreateParticle(i); + if (this.m_handleIndexBuffer.data) { + var r = this.m_handleIndexBuffer.data[t]; + r && r.SetIndex(n), + this.m_handleIndexBuffer.data[n] = r, + this.m_handleIndexBuffer.data[t] = null + } + return this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[n] = this.m_lastBodyContactStepBuffer.data[t]), + this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[n] = this.m_bodyContactCountBuffer.data[t]), + this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[n] = this.m_consecutiveContactStepsBuffer.data[t]), + this.m_hasForce && this.m_forceBuffer[n].Copy(this.m_forceBuffer[t]), + this.m_staticPressureBuffer && (this.m_staticPressureBuffer[n] = this.m_staticPressureBuffer[t]), + this.m_depthBuffer && (this.m_depthBuffer[n] = this.m_depthBuffer[t]), + this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[n] = this.m_expirationTimeBuffer.data[t]), + n + } + , + n.prototype.DestroyParticlesInGroup = function(t, e) { + void 0 === e && (e = !1); + for (var i = t.m_firstIndex; i < t.m_lastIndex; i++) + this.DestroyParticle(i, e) + } + , + n.prototype.DestroyParticleGroup = function(t) { + this.m_world.m_destructionListener && this.m_world.m_destructionListener.SayGoodbyeParticleGroup(t), + this.SetGroupFlags(t, 0); + for (var e = t.m_firstIndex; e < t.m_lastIndex; e++) + this.m_groupBuffer[e] = null; + t.m_prev && (t.m_prev.m_next = t.m_next), + t.m_next && (t.m_next.m_prev = t.m_prev), + t === this.m_groupList && (this.m_groupList = t.m_next), + --this.m_groupCount + } + , + n.ParticleCanBeConnected = function(e, i) { + return 0 != (e & (t.b2ParticleFlag.b2_wallParticle | t.b2ParticleFlag.b2_springParticle | t.b2ParticleFlag.b2_elasticParticle)) || null !== i && 0 != (i.GetGroupFlags() & t.b2ParticleGroupFlag.b2_rigidParticleGroup) + } + , + n.prototype.UpdatePairsAndTriads = function(e, i, r) { + var s = n.UpdatePairsAndTriads_s_dab + , a = n.UpdatePairsAndTriads_s_dbc + , o = n.UpdatePairsAndTriads_s_dca; + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var l = this.m_positionBuffer.data, h = 0, c = e; c < i; c++) + h |= this.m_flagsBuffer.data[c]; + if (h & n.k_pairFlags) + for (var u = 0; u < this.m_contactBuffer.count; u++) { + var _ = this.m_contactBuffer.data[u] + , f = _.indexA + , d = _.indexB + , p = this.m_flagsBuffer.data[f] + , m = this.m_flagsBuffer.data[d] + , v = this.m_groupBuffer[f] + , g = this.m_groupBuffer[d]; + if (f >= e && f < i && d >= e && d < i && !((p | m) & t.b2ParticleFlag.b2_zombieParticle) && (p | m) & n.k_pairFlags && (r.IsNecessary(f) || r.IsNecessary(d)) && n.ParticleCanBeConnected(p, v) && n.ParticleCanBeConnected(m, g) && r.ShouldCreatePair(f, d)) { + var A = this.m_pairBuffer.data[this.m_pairBuffer.Append()]; + A.indexA = f, + A.indexB = d, + A.flags = _.flags, + A.strength = y(v ? v.m_strength : 1, g ? g.m_strength : 1), + A.distance = I.DistanceVV(l[f], l[d]) + } + Pn(this.m_pairBuffer.data, 0, this.m_pairBuffer.count, n.ComparePairIndices), + this.m_pairBuffer.Unique(n.MatchPairIndices) + } + if (h & n.k_triadFlags) { + var x = new Mn(i - e); + for (c = e; c < i; c++) { + var b = this.m_flagsBuffer.data[c] + , C = this.m_groupBuffer[c]; + b & t.b2ParticleFlag.b2_zombieParticle || !n.ParticleCanBeConnected(b, C) || x.AddGenerator(l[c], c, r.IsNecessary(c)) + } + var T = this.GetParticleStride(); + x.Generate(T / 2, 2 * T); + var S = this; + x.GetNodes((function(t, e, i) { + if (!S.m_flagsBuffer.data) + throw new Error; + var h = S.m_flagsBuffer.data[t] + , c = S.m_flagsBuffer.data[e] + , u = S.m_flagsBuffer.data[i]; + if ((h | c | u) & n.k_triadFlags && r.ShouldCreateTriad(t, e, i)) { + var _ = l[t] + , f = l[e] + , d = l[i] + , p = I.SubVV(_, f, s) + , m = I.SubVV(f, d, a) + , v = I.SubVV(d, _, o) + , g = 4 * S.m_squaredDiameter; + if (I.DotVV(p, p) > g || I.DotVV(m, m) > g || I.DotVV(v, v) > g) + return; + var A = S.m_groupBuffer[t] + , x = S.m_groupBuffer[e] + , b = S.m_groupBuffer[i] + , C = S.m_triadBuffer.data[S.m_triadBuffer.Append()]; + C.indexA = t, + C.indexB = e, + C.indexC = i, + C.flags = h | c | u, + C.strength = y(y(A ? A.m_strength : 1, x ? x.m_strength : 1), b ? b.m_strength : 1); + var T = (_.x + f.x + d.x) / 3 + , w = (_.y + f.y + d.y) / 3; + C.pa.x = _.x - T, + C.pa.y = _.y - w, + C.pb.x = f.x - T, + C.pb.y = f.y - w, + C.pc.x = d.x - T, + C.pc.y = d.y - w, + C.ka = -I.DotVV(v, p), + C.kb = -I.DotVV(p, m), + C.kc = -I.DotVV(m, v), + C.s = I.CrossVV(_, f) + I.CrossVV(f, d) + I.CrossVV(d, _) + } + } + )), + Pn(this.m_triadBuffer.data, 0, this.m_triadBuffer.count, n.CompareTriadIndices), + this.m_triadBuffer.Unique(n.MatchTriadIndices) + } + } + , + n.prototype.UpdatePairsAndTriadsWithReactiveParticles = function() { + var e = new n.ReactiveFilter(this.m_flagsBuffer); + if (this.UpdatePairsAndTriads(0, this.m_count, e), + !this.m_flagsBuffer.data) + throw new Error; + for (var i = 0; i < this.m_count; i++) + this.m_flagsBuffer.data[i] &= ~t.b2ParticleFlag.b2_reactiveParticle; + this.m_allParticleFlags &= ~t.b2ParticleFlag.b2_reactiveParticle + } + , + n.ComparePairIndices = function(t, e) { + var i = t.indexA - e.indexA; + return 0 !== i ? i < 0 : t.indexB < e.indexB + } + , + n.MatchPairIndices = function(t, e) { + return t.indexA === e.indexA && t.indexB === e.indexB + } + , + n.CompareTriadIndices = function(t, e) { + var i = t.indexA - e.indexA; + if (0 !== i) + return i < 0; + var n = t.indexB - e.indexB; + return 0 !== n ? n < 0 : t.indexC < e.indexC + } + , + n.MatchTriadIndices = function(t, e) { + return t.indexA === e.indexA && t.indexB === e.indexB && t.indexC === e.indexC + } + , + n.InitializeParticleLists = function(t, e) { + for (var i = t.GetBufferIndex(), n = t.GetParticleCount(), r = 0; r < n; r++) { + var s = e[r]; + s.list = s, + s.next = null, + s.count = 1, + s.index = r + i + } + } + , + n.prototype.MergeParticleListsInContact = function(t, e) { + for (var i = t.GetBufferIndex(), r = 0; r < this.m_contactBuffer.count; r++) { + var s = this.m_contactBuffer.data[r] + , a = s.indexA + , o = s.indexB; + if (t.ContainsParticle(a) && t.ContainsParticle(o)) { + var l = e[a - i].list + , h = e[o - i].list; + if (l !== h) { + if (l.count < h.count) { + var c = l; + l = h, + h = c + } + n.MergeParticleLists(l, h) + } + } + } + } + , + n.MergeParticleLists = function(t, e) { + for (var i = e; ; ) { + i.list = t; + var n = i.next; + if (!n) { + i.next = t.next; + break + } + i = n + } + t.next = e, + t.count += e.count, + e.count = 0 + } + , + n.FindLongestParticleList = function(t, e) { + for (var i = t.GetParticleCount(), n = e[0], r = 0; r < i; r++) { + var s = e[r]; + n.count < s.count && (n = s) + } + return n + } + , + n.prototype.MergeZombieParticleListNodes = function(e, i, r) { + if (!this.m_flagsBuffer.data) + throw new Error; + for (var s = e.GetParticleCount(), a = 0; a < s; a++) { + var o = i[a]; + o !== r && this.m_flagsBuffer.data[o.index] & t.b2ParticleFlag.b2_zombieParticle && n.MergeParticleListAndNode(r, o) + } + } + , + n.MergeParticleListAndNode = function(t, e) { + e.list = t, + e.next = t.next, + t.next = e, + t.count++, + e.count = 0 + } + , + n.prototype.CreateParticleGroupsFromParticleList = function(e, i, n) { + if (!this.m_flagsBuffer.data) + throw new Error; + var r = e.GetParticleCount() + , s = new Sn; + s.groupFlags = e.GetGroupFlags(), + s.userData = e.GetUserData(); + for (var a = 0; a < r; a++) { + var o = i[a]; + if (o.count && o !== n) + for (var l = this.CreateParticleGroup(s), h = o; h; h = h.next) { + var c = h.index + , u = this.CloneParticle(c, l); + this.m_flagsBuffer.data[c] |= t.b2ParticleFlag.b2_zombieParticle, + h.index = u + } + } + } + , + n.prototype.UpdatePairsAndTriadsWithParticleList = function(t, e) { + for (var i = t.GetBufferIndex(), n = 0; n < this.m_pairBuffer.count; n++) { + var r = this.m_pairBuffer.data[n] + , s = r.indexA + , a = r.indexB; + t.ContainsParticle(s) && (r.indexA = e[s - i].index), + t.ContainsParticle(a) && (r.indexB = e[a - i].index) + } + for (n = 0; n < this.m_triadBuffer.count; n++) { + var o = this.m_triadBuffer.data[n] + , l = (s = o.indexA, + a = o.indexB, + o.indexC); + t.ContainsParticle(s) && (o.indexA = e[s - i].index), + t.ContainsParticle(a) && (o.indexB = e[a - i].index), + t.ContainsParticle(l) && (o.indexC = e[l - i].index) + } + } + , + n.prototype.ComputeDepth = function() { + for (var e = [], n = 0, r = 0; r < this.m_contactBuffer.count; r++) { + var s = (v = this.m_contactBuffer.data[r]).indexA + , a = v.indexB + , o = this.m_groupBuffer[s] + , l = this.m_groupBuffer[a]; + o && o === l && o.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && (e[n++] = v) + } + for (var h = [], c = 0, u = this.m_groupList; u; u = u.GetNext()) + if (u.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth) { + h[c++] = u, + this.SetGroupFlags(u, u.m_groupFlags & ~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth); + for (var _ = u.m_firstIndex; _ < u.m_lastIndex; _++) + this.m_accumulationBuffer[_] = 0 + } + for (r = 0; r < n; r++) { + s = (v = e[r]).indexA, + a = v.indexB; + var f = v.weight; + this.m_accumulationBuffer[s] += f, + this.m_accumulationBuffer[a] += f + } + for (_ = 0; _ < c; _++) + for (var d = (u = h[_]).m_firstIndex; d < u.m_lastIndex; d++) + f = this.m_accumulationBuffer[d], + this.m_depthBuffer[d] = f < .8 ? 0 : i; + for (var p = T(this.m_count) >> 0, m = 0; m < p; m++) { + var y = !1; + for (r = 0; r < n; r++) { + s = (v = e[r]).indexA, + a = v.indexB; + var v, g = 1 - v.weight, A = this.m_depthBuffer[s], x = this.m_depthBuffer[a], b = x + g, C = A + g; + A > b && (this.m_depthBuffer[s] = b, + y = !0), + x > C && (this.m_depthBuffer[a] = C, + y = !0) + } + if (!y) + break + } + for (_ = 0; _ < c; _++) + for (var S = (u = h[_]).m_firstIndex; S < u.m_lastIndex; S++) + this.m_depthBuffer[S] < i ? this.m_depthBuffer[S] *= this.m_particleDiameter : this.m_depthBuffer[S] = 0 + } + , + n.prototype.GetInsideBoundsEnumerator = function(t) { + var e = n.computeTag(this.m_inverseDiameter * t.lowerBound.x - 1, this.m_inverseDiameter * t.lowerBound.y - 1) + , i = n.computeTag(this.m_inverseDiameter * t.upperBound.x + 1, this.m_inverseDiameter * t.upperBound.y + 1) + , r = this.m_proxyBuffer.count + , s = On(this.m_proxyBuffer.data, 0, r, e, n.Proxy.CompareProxyTag) + , a = Ln(this.m_proxyBuffer.data, 0, r, i, n.Proxy.CompareTagProxy); + return new n.InsideBoundsEnumerator(this,e,i,s,a) + } + , + n.prototype.UpdateAllParticleFlags = function() { + if (!this.m_flagsBuffer.data) + throw new Error; + this.m_allParticleFlags = 0; + for (var t = 0; t < this.m_count; t++) + this.m_allParticleFlags |= this.m_flagsBuffer.data[t]; + this.m_needsUpdateAllParticleFlags = !1 + } + , + n.prototype.UpdateAllGroupFlags = function() { + this.m_allGroupFlags = 0; + for (var t = this.m_groupList; t; t = t.GetNext()) + this.m_allGroupFlags |= t.m_groupFlags; + this.m_needsUpdateAllGroupFlags = !1 + } + , + n.prototype.AddContact = function(t, e) { + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + var i = n.AddContact_s_d + , r = this.m_positionBuffer.data + , s = I.SubVV(r[e], r[t], i) + , a = I.DotVV(s, s); + if (a < this.m_squaredDiameter) { + var o = b(a); + isFinite(o) || (o = 198177537e11); + var l = this.m_contactBuffer.data[this.m_contactBuffer.Append()]; + l.indexA = t, + l.indexB = e, + l.flags = this.m_flagsBuffer.data[t] | this.m_flagsBuffer.data[e], + l.weight = 1 - a * o * this.m_inverseDiameter, + I.MulSV(o, s, l.normal) + } + } + , + n.prototype.FindContacts_Reference = function() { + var t = this.m_proxyBuffer.count; + this.m_contactBuffer.count = 0; + for (var e = 0, i = 0; e < t; e++) { + for (var r = n.computeRelativeTag(this.m_proxyBuffer.data[e].tag, 1, 0), s = e + 1; s < t && !(r < this.m_proxyBuffer.data[s].tag); s++) + this.AddContact(this.m_proxyBuffer.data[e].index, this.m_proxyBuffer.data[s].index, this.m_contactBuffer); + for (var a = n.computeRelativeTag(this.m_proxyBuffer.data[e].tag, -1, 1); i < t && !(a <= this.m_proxyBuffer.data[i].tag); i++) + ; + var o = n.computeRelativeTag(this.m_proxyBuffer.data[e].tag, 1, 1); + for (s = i; s < t && !(o < this.m_proxyBuffer.data[s].tag); s++) + this.AddContact(this.m_proxyBuffer.data[e].index, this.m_proxyBuffer.data[s].index, this.m_contactBuffer) + } + } + , + n.prototype.FindContacts = function(t) { + this.FindContacts_Reference(t) + } + , + n.prototype.UpdateProxies_Reference = function() { + if (!this.m_positionBuffer.data) + throw new Error; + for (var t = this.m_positionBuffer.data, e = this.m_inverseDiameter, i = 0; i < this.m_proxyBuffer.count; ++i) { + var r = this.m_proxyBuffer.data[i] + , s = t[r.index]; + r.tag = n.computeTag(e * s.x, e * s.y) + } + } + , + n.prototype.UpdateProxies = function(t) { + this.UpdateProxies_Reference(t) + } + , + n.prototype.SortProxies = function() { + In(this.m_proxyBuffer.data, 0, this.m_proxyBuffer.count, n.Proxy.CompareProxyProxy) + } + , + n.prototype.FilterContacts = function() { + var e = this.GetParticleContactFilter(); + if (null !== e) { + var i = this; + this.m_contactBuffer.RemoveIf((function(n) { + return 0 != (n.flags & t.b2ParticleFlag.b2_particleContactFilterParticle) && !e.ShouldCollideParticleParticle(i, n.indexA, n.indexB) + } + )) + } + } + , + n.prototype.NotifyContactListenerPreContact = function(t) { + if (null !== this.GetParticleContactListener()) + throw t.Initialize(this.m_contactBuffer, this.m_flagsBuffer), + new Error + } + , + n.prototype.NotifyContactListenerPostContact = function() { + var t = this.GetParticleContactListener(); + if (null !== t) { + for (var e = 0; e < this.m_contactBuffer.count; ++e) { + var i = this.m_contactBuffer.data[e]; + t.BeginContactParticleParticle(this, i) + } + throw new Error + } + } + , + n.b2ParticleContactIsZombie = function(e) { + return (e.flags & t.b2ParticleFlag.b2_zombieParticle) === t.b2ParticleFlag.b2_zombieParticle + } + , + n.prototype.UpdateContacts = function(t) { + this.UpdateProxies(this.m_proxyBuffer), + this.SortProxies(this.m_proxyBuffer); + var e = new n.b2ParticlePairSet; + this.NotifyContactListenerPreContact(e), + this.FindContacts(this.m_contactBuffer), + this.FilterContacts(this.m_contactBuffer), + this.NotifyContactListenerPostContact(e), + t && this.m_contactBuffer.RemoveIf(n.b2ParticleContactIsZombie) + } + , + n.prototype.NotifyBodyContactListenerPreContact = function(t) { + if (null !== this.GetFixtureContactListener()) + throw t.Initialize(this.m_bodyContactBuffer, this.m_flagsBuffer), + new Error + } + , + n.prototype.NotifyBodyContactListenerPostContact = function() { + var t = this.GetFixtureContactListener(); + if (null !== t) { + for (var e = 0; e < this.m_bodyContactBuffer.count; e++) { + var i = this.m_bodyContactBuffer.data[e]; + t.BeginContactFixtureParticle(this, i) + } + throw new Error + } + } + , + n.prototype.UpdateBodyContacts = function() { + var t = n.UpdateBodyContacts_s_aabb + , e = new n.FixtureParticleSet; + if (this.NotifyBodyContactListenerPreContact(e), + this.m_stuckThreshold > 0) { + if (!this.m_bodyContactCountBuffer.data) + throw new Error; + if (!this.m_lastBodyContactStepBuffer.data) + throw new Error; + if (!this.m_consecutiveContactStepsBuffer.data) + throw new Error; + for (var i = this.GetParticleCount(), r = 0; r < i; r++) + this.m_bodyContactCountBuffer.data[r] = 0, + this.m_timestamp > this.m_lastBodyContactStepBuffer.data[r] + 1 && (this.m_consecutiveContactStepsBuffer.data[r] = 0) + } + this.m_bodyContactBuffer.SetCount(0), + this.m_stuckParticleBuffer.SetCount(0); + var s = t; + this.ComputeAABB(s); + var a = new n.UpdateBodyContactsCallback(this,this.GetFixtureContactFilter()); + this.m_world.QueryAABB(a, s), + this.m_def.strictContactCheck && this.RemoveSpuriousBodyContacts(), + this.NotifyBodyContactListenerPostContact(e) + } + , + n.prototype.Solve = function(e) { + var i = n.Solve_s_subStep; + if (0 !== this.m_count && (this.m_expirationTimeBuffer.data && this.SolveLifetimes(e), + this.m_allParticleFlags & t.b2ParticleFlag.b2_zombieParticle && this.SolveZombie(), + this.m_needsUpdateAllParticleFlags && this.UpdateAllParticleFlags(), + this.m_needsUpdateAllGroupFlags && this.UpdateAllGroupFlags(), + !this.m_paused)) + for (this.m_iterationIndex = 0; this.m_iterationIndex < e.particleIterations; this.m_iterationIndex++) { + ++this.m_timestamp; + var r = i.Copy(e); + if (r.dt /= e.particleIterations, + r.inv_dt *= e.particleIterations, + this.UpdateContacts(!1), + this.UpdateBodyContacts(), + this.ComputeWeight(), + this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && this.ComputeDepth(), + this.m_allParticleFlags & t.b2ParticleFlag.b2_reactiveParticle && this.UpdatePairsAndTriadsWithReactiveParticles(), + this.m_hasForce && this.SolveForce(r), + this.m_allParticleFlags & t.b2ParticleFlag.b2_viscousParticle && this.SolveViscous(), + this.m_allParticleFlags & t.b2ParticleFlag.b2_repulsiveParticle && this.SolveRepulsive(r), + this.m_allParticleFlags & t.b2ParticleFlag.b2_powderParticle && this.SolvePowder(r), + this.m_allParticleFlags & t.b2ParticleFlag.b2_tensileParticle && this.SolveTensile(r), + this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SolveSolid(r), + this.m_allParticleFlags & t.b2ParticleFlag.b2_colorMixingParticle && this.SolveColorMixing(), + this.SolveGravity(r), + this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle && this.SolveStaticPressure(r), + this.SolvePressure(r), + this.SolveDamping(r), + this.m_allParticleFlags & n.k_extraDampingFlags && this.SolveExtraDamping(), + this.m_allParticleFlags & t.b2ParticleFlag.b2_elasticParticle && this.SolveElastic(r), + this.m_allParticleFlags & t.b2ParticleFlag.b2_springParticle && this.SolveSpring(r), + this.LimitVelocity(r), + this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigidDamping(), + this.m_allParticleFlags & t.b2ParticleFlag.b2_barrierParticle && this.SolveBarrier(r), + this.SolveCollision(r), + this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigid(r), + this.m_allParticleFlags & t.b2ParticleFlag.b2_wallParticle && this.SolveWall(), + !this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var s = 0; s < this.m_count; s++) + this.m_positionBuffer.data[s].SelfMulAdd(r.dt, this.m_velocityBuffer.data[s]) + } + } + , + n.prototype.SolveCollision = function(t) { + var e = n.SolveCollision_s_aabb; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + var r = this.m_positionBuffer.data + , s = this.m_velocityBuffer.data + , a = e; + a.lowerBound.x = +i, + a.lowerBound.y = +i, + a.upperBound.x = -i, + a.upperBound.y = -i; + for (var o = 0; o < this.m_count; o++) { + var l = s[o] + , h = r[o] + , c = h.x + t.dt * l.x + , u = h.y + t.dt * l.y; + a.lowerBound.x = y(a.lowerBound.x, y(h.x, c)), + a.lowerBound.y = y(a.lowerBound.y, y(h.y, u)), + a.upperBound.x = v(a.upperBound.x, v(h.x, c)), + a.upperBound.y = v(a.upperBound.y, v(h.y, u)) + } + var _ = new n.SolveCollisionCallback(this,t); + this.m_world.QueryAABB(_, a) + } + , + n.prototype.LimitVelocity = function(t) { + if (!this.m_velocityBuffer.data) + throw new Error; + for (var e = this.m_velocityBuffer.data, i = this.GetCriticalVelocitySquared(t), n = 0; n < this.m_count; n++) { + var r = e[n] + , s = I.DotVV(r, r); + s > i && r.SelfMul(T(i / s)) + } + } + , + n.prototype.SolveGravity = function(t) { + if (!this.m_velocityBuffer.data) + throw new Error; + for (var e = n.SolveGravity_s_gravity, i = this.m_velocityBuffer.data, r = I.MulSV(t.dt * this.m_def.gravityScale, this.m_world.GetGravity(), e), s = 0; s < this.m_count; s++) + i[s].SelfAdd(r) + } + , + n.prototype.SolveBarrier = function(e) { + var i = n.SolveBarrier_s_aabb + , r = n.SolveBarrier_s_va + , s = n.SolveBarrier_s_vb + , a = n.SolveBarrier_s_pba + , o = n.SolveBarrier_s_vba + , l = n.SolveBarrier_s_vc + , h = n.SolveBarrier_s_pca + , c = n.SolveBarrier_s_vca + , u = n.SolveBarrier_s_qba + , _ = n.SolveBarrier_s_qca + , f = n.SolveBarrier_s_dv + , d = n.SolveBarrier_s_f; + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var p = this.m_positionBuffer.data, m = this.m_velocityBuffer.data, y = 0; y < this.m_count; y++) + 0 != (this.m_flagsBuffer.data[y] & n.k_barrierWallFlags) && m[y].SetZero(); + for (var v = 2.5 * e.dt, g = this.GetParticleMass(), A = 0; A < this.m_pairBuffer.count; A++) { + var x = this.m_pairBuffer.data[A]; + if (x.flags & t.b2ParticleFlag.b2_barrierParticle) { + var b = x.indexA + , C = x.indexB + , S = p[b] + , w = p[C] + , E = i; + I.MinV(S, w, E.lowerBound), + I.MaxV(S, w, E.upperBound); + for (var M = this.m_groupBuffer[b], D = this.m_groupBuffer[C], B = this.GetLinearVelocity(M, b, S, r), P = this.GetLinearVelocity(D, C, w, s), R = I.SubVV(w, S, a), O = I.SubVV(P, B, o), L = this.GetInsideBoundsEnumerator(E), F = void 0; (F = L.GetNext()) >= 0; ) { + var V = p[F] + , N = this.m_groupBuffer[F]; + if (M !== N && D !== N) { + var k = this.GetLinearVelocity(N, F, V, l) + , G = I.SubVV(V, S, h) + , U = I.SubVV(k, B, c) + , z = I.CrossVV(O, U) + , H = I.CrossVV(R, U) - I.CrossVV(G, O) + , W = I.CrossVV(R, G) + , j = void 0 + , X = void 0 + , Y = u + , q = _; + if (0 === z) { + if (0 === H) + continue; + if (!((X = -W / H) >= 0 && X < v)) + continue; + if (I.AddVMulSV(R, X, O, Y), + I.AddVMulSV(G, X, U, q), + !((j = I.DotVV(Y, q) / I.DotVV(Y, Y)) >= 0 && j <= 1)) + continue + } else { + var J = H * H - 4 * W * z; + if (J < 0) + continue; + var Z = T(J) + , K = (-H - Z) / (2 * z) + , Q = (-H + Z) / (2 * z); + if (K > Q) { + var $ = K; + K = Q, + Q = $ + } + if (X = K, + I.AddVMulSV(R, X, O, Y), + I.AddVMulSV(G, X, U, q), + j = I.DotVV(Y, q) / I.DotVV(Y, Y), + !(X >= 0 && X < v && j >= 0 && j <= 1)) { + if (!((X = Q) >= 0 && X < v)) + continue; + if (I.AddVMulSV(R, X, O, Y), + I.AddVMulSV(G, X, U, q), + !((j = I.DotVV(Y, q) / I.DotVV(Y, Y)) >= 0 && j <= 1)) + continue + } + } + var tt = f; + tt.x = B.x + j * O.x - k.x, + tt.y = B.y + j * O.y - k.y; + var et = I.MulSV(g, tt, d); + if (N && this.IsRigidGroup(N)) { + var it = N.GetMass() + , nt = N.GetInertia(); + it > 0 && N.m_linearVelocity.SelfMulAdd(1 / it, et), + nt > 0 && (N.m_angularVelocity += I.CrossVV(I.SubVV(V, N.GetCenter(), I.s_t0), et) / nt) + } else + m[F].SelfAdd(tt); + this.ParticleApplyForce(F, et.SelfMul(-e.inv_dt)) + } + } + } + } + } + , + n.prototype.SolveStaticPressure = function(e) { + if (!this.m_flagsBuffer.data) + throw new Error; + this.m_staticPressureBuffer = this.RequestBuffer(this.m_staticPressureBuffer); + for (var i = this.GetCriticalPressure(e), n = this.m_def.staticPressureStrength * i, r = .25 * i, s = this.m_def.staticPressureRelaxation, a = 0; a < this.m_def.staticPressureIterations; a++) { + for (var o = 0; o < this.m_count; o++) + this.m_accumulationBuffer[o] = 0; + for (var l = 0; l < this.m_contactBuffer.count; l++) { + var h = this.m_contactBuffer.data[l]; + if (h.flags & t.b2ParticleFlag.b2_staticPressureParticle) { + var c = h.indexA + , u = h.indexB + , _ = h.weight; + this.m_accumulationBuffer[c] += _ * this.m_staticPressureBuffer[u], + this.m_accumulationBuffer[u] += _ * this.m_staticPressureBuffer[c] + } + } + for (o = 0; o < this.m_count; o++) + if (_ = this.m_weightBuffer[o], + this.m_flagsBuffer.data[o] & t.b2ParticleFlag.b2_staticPressureParticle) { + var f = (this.m_accumulationBuffer[o] + n * (_ - 1)) / (_ + s); + this.m_staticPressureBuffer[o] = g(f, 0, r) + } else + this.m_staticPressureBuffer[o] = 0 + } + } + , + n.prototype.ComputeWeight = function() { + for (var t = 0; t < this.m_count; t++) + this.m_weightBuffer[t] = 0; + for (t = 0; t < this.m_bodyContactBuffer.count; t++) { + var e = (n = this.m_bodyContactBuffer.data[t]).index + , i = n.weight; + this.m_weightBuffer[e] += i + } + for (t = 0; t < this.m_contactBuffer.count; t++) { + e = (n = this.m_contactBuffer.data[t]).indexA; + var n, r = n.indexB; + i = n.weight, + this.m_weightBuffer[e] += i, + this.m_weightBuffer[r] += i + } + } + , + n.prototype.SolvePressure = function(e) { + var i = n.SolvePressure_s_f; + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, a = this.GetCriticalPressure(e), o = this.m_def.pressureStrength * a, l = .25 * a, h = 0; h < this.m_count; h++) { + var c = this.m_weightBuffer[h] + , u = o * v(0, c - 1); + this.m_accumulationBuffer[h] = y(u, l) + } + if (this.m_allParticleFlags & n.k_noPressureFlags) + for (h = 0; h < this.m_count; h++) + this.m_flagsBuffer.data[h] & n.k_noPressureFlags && (this.m_accumulationBuffer[h] = 0); + if (this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle) + for (h = 0; h < this.m_count; h++) + this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_staticPressureParticle && (this.m_accumulationBuffer[h] += this.m_staticPressureBuffer[h]); + for (var _ = e.dt / (this.m_def.density * this.m_particleDiameter), f = this.GetParticleInvMass(), d = 0; d < this.m_bodyContactBuffer.count; d++) { + var p = (C = this.m_bodyContactBuffer.data[d]).index + , m = C.body + , g = (c = C.weight, + C.mass) + , A = C.normal + , x = r[p] + , b = (u = this.m_accumulationBuffer[p] + o * c, + I.MulSV(_ * c * g * u, A, i)); + s[p].SelfMulSub(f, b), + m.ApplyLinearImpulse(b, x, !0) + } + for (d = 0; d < this.m_contactBuffer.count; d++) { + var C; + p = (C = this.m_contactBuffer.data[d]).indexA, + m = C.indexB, + c = C.weight, + A = C.normal, + u = this.m_accumulationBuffer[p] + this.m_accumulationBuffer[m], + b = I.MulSV(_ * c * u, A, i), + s[p].SelfSub(b), + s[m].SelfAdd(b) + } + } + , + n.prototype.SolveDamping = function(t) { + var e = n.SolveDamping_s_v + , i = n.SolveDamping_s_f; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, a = this.m_def.dampingStrength, o = 1 / this.GetCriticalVelocity(t), l = this.GetParticleInvMass(), h = 0; h < this.m_bodyContactBuffer.count; h++) { + var c = (x = this.m_bodyContactBuffer.data[h]).index + , u = x.body + , _ = x.weight + , f = x.mass + , d = x.normal + , p = r[c] + , m = I.SubVV(u.GetLinearVelocityFromWorldPoint(p, I.s_t0), s[c], e); + if ((b = I.DotVV(m, d)) < 0) { + var g = v(a * _, y(-o * b, .5)) + , A = I.MulSV(g * f * b, d, i); + s[c].SelfMulAdd(l, A), + u.ApplyLinearImpulse(A.SelfNeg(), p, !0) + } + } + for (h = 0; h < this.m_contactBuffer.count; h++) { + var x, b; + c = (x = this.m_contactBuffer.data[h]).indexA, + u = x.indexB, + _ = x.weight, + d = x.normal, + m = I.SubVV(s[u], s[c], e), + (b = I.DotVV(m, d)) < 0 && (g = v(a * _, y(-o * b, .5)), + A = I.MulSV(g * b, d, i), + s[c].SelfAdd(A), + s[u].SelfSub(A)) + } + } + , + n.prototype.SolveRigidDamping = function() { + var t = n.SolveRigidDamping_s_t0 + , e = n.SolveRigidDamping_s_t1 + , i = n.SolveRigidDamping_s_p + , r = n.SolveRigidDamping_s_v + , s = [0] + , a = [0] + , o = [0] + , l = [0] + , h = [0] + , c = [0]; + if (!this.m_positionBuffer.data) + throw new Error; + for (var u = this.m_positionBuffer.data, _ = this.m_def.dampingStrength, f = 0; f < this.m_bodyContactBuffer.count; f++) { + var d = (b = this.m_bodyContactBuffer.data[f]).index; + if ((T = this.m_groupBuffer[d]) && this.IsRigidGroup(T)) { + var p = b.body + , m = b.normal + , v = b.weight + , g = u[d] + , A = I.SubVV(p.GetLinearVelocityFromWorldPoint(g, t), T.GetLinearVelocityFromWorldPoint(g, e), r); + if ((C = I.DotVV(A, m)) < 0) { + this.InitDampingParameterWithRigidGroupOrParticle(s, a, o, !0, T, d, g, m), + this.InitDampingParameter(l, h, c, p.GetMass(), p.GetInertia() - p.GetMass() * p.GetLocalCenter().LengthSquared(), p.GetWorldCenter(), g, m); + var x = _ * y(v, 1) * this.ComputeDampingImpulse(s[0], a[0], o[0], l[0], h[0], c[0], C); + this.ApplyDamping(s[0], a[0], o[0], !0, T, d, x, m), + p.ApplyLinearImpulse(I.MulSV(-x, m, I.s_t0), g, !0) + } + } + } + for (f = 0; f < this.m_contactBuffer.count; f++) { + d = (b = this.m_contactBuffer.data[f]).indexA, + p = b.indexB, + m = b.normal, + v = b.weight; + var b, C, T = this.m_groupBuffer[d], S = this.m_groupBuffer[p], w = this.IsRigidGroup(T), E = this.IsRigidGroup(S); + T !== S && (w || E) && (g = I.MidVV(u[d], u[p], i), + A = I.SubVV(this.GetLinearVelocity(S, p, g, t), this.GetLinearVelocity(T, d, g, e), r), + (C = I.DotVV(A, m)) < 0 && (this.InitDampingParameterWithRigidGroupOrParticle(s, a, o, w, T, d, g, m), + this.InitDampingParameterWithRigidGroupOrParticle(l, h, c, E, S, p, g, m), + x = _ * v * this.ComputeDampingImpulse(s[0], a[0], o[0], l[0], h[0], c[0], C), + this.ApplyDamping(s[0], a[0], o[0], w, T, d, x, m), + this.ApplyDamping(l[0], h[0], c[0], E, S, p, -x, m))) + } + } + , + n.prototype.SolveExtraDamping = function() { + var t = n.SolveExtraDamping_s_v + , e = n.SolveExtraDamping_s_f; + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var i = this.m_velocityBuffer.data, r = this.m_positionBuffer.data, s = this.GetParticleInvMass(), a = 0; a < this.m_bodyContactBuffer.count; a++) { + var o = this.m_bodyContactBuffer.data[a] + , l = o.index; + if (this.m_flagsBuffer.data[l] & n.k_extraDampingFlags) { + var h = o.body + , c = o.mass + , u = o.normal + , _ = r[l] + , f = I.SubVV(h.GetLinearVelocityFromWorldPoint(_, I.s_t0), i[l], t) + , d = I.DotVV(f, u); + if (d < 0) { + var p = I.MulSV(.5 * c * d, u, e); + i[l].SelfMulAdd(s, p), + h.ApplyLinearImpulse(p.SelfNeg(), _, !0) + } + } + } + } + , + n.prototype.SolveWall = function() { + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var e = this.m_velocityBuffer.data, i = 0; i < this.m_count; i++) + this.m_flagsBuffer.data[i] & t.b2ParticleFlag.b2_wallParticle && e[i].SetZero() + } + , + n.prototype.SolveRigid = function(e) { + var i = n.SolveRigid_s_position + , r = n.SolveRigid_s_rotation + , s = n.SolveRigid_s_transform + , a = n.SolveRigid_s_velocityTransform; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var o = this.m_positionBuffer.data, l = this.m_velocityBuffer.data, h = this.m_groupList; h; h = h.GetNext()) + if (h.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup) { + h.UpdateStatistics(); + var c = r; + c.SetAngle(e.dt * h.m_angularVelocity); + var u = I.AddVV(h.m_center, I.SubVV(I.MulSV(e.dt, h.m_linearVelocity, I.s_t0), F.MulRV(c, h.m_center, I.s_t1), I.s_t0), i) + , _ = s; + _.SetPositionRotation(u, c), + V.MulXX(_, h.m_transform, h.m_transform); + var f = a; + f.p.x = e.inv_dt * _.p.x, + f.p.y = e.inv_dt * _.p.y, + f.q.s = e.inv_dt * _.q.s, + f.q.c = e.inv_dt * (_.q.c - 1); + for (var d = h.m_firstIndex; d < h.m_lastIndex; d++) + V.MulXV(f, o[d], l[d]) + } + } + , + n.prototype.SolveElastic = function(e) { + var i = n.SolveElastic_s_pa + , r = n.SolveElastic_s_pb + , s = n.SolveElastic_s_pc + , a = n.SolveElastic_s_r + , o = n.SolveElastic_s_t0; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var l = this.m_positionBuffer.data, h = this.m_velocityBuffer.data, c = e.inv_dt * this.m_def.elasticStrength, u = 0; u < this.m_triadBuffer.count; u++) { + var _ = this.m_triadBuffer.data[u]; + if (_.flags & t.b2ParticleFlag.b2_elasticParticle) { + var f = _.indexA + , d = _.indexB + , p = _.indexC + , m = _.pa + , y = _.pb + , v = _.pc + , g = i.Copy(l[f]) + , A = r.Copy(l[d]) + , x = s.Copy(l[p]) + , C = h[f] + , T = h[d] + , S = h[p]; + g.SelfMulAdd(e.dt, C), + A.SelfMulAdd(e.dt, T), + x.SelfMulAdd(e.dt, S); + var w = (g.x + A.x + x.x) / 3 + , E = (g.y + A.y + x.y) / 3; + g.x -= w, + g.y -= E, + A.x -= w, + A.y -= E, + x.x -= w, + x.y -= E; + var M = a; + M.s = I.CrossVV(m, g) + I.CrossVV(y, A) + I.CrossVV(v, x), + M.c = I.DotVV(m, g) + I.DotVV(y, A) + I.DotVV(v, x); + var D = b(M.s * M.s + M.c * M.c); + isFinite(D) || (D = 198177537e11), + M.s *= D, + M.c *= D; + var B = c * _.strength; + F.MulRV(M, m, o), + I.SubVV(o, g, o), + I.MulSV(B, o, o), + C.SelfAdd(o), + F.MulRV(M, y, o), + I.SubVV(o, A, o), + I.MulSV(B, o, o), + T.SelfAdd(o), + F.MulRV(M, v, o), + I.SubVV(o, x, o), + I.MulSV(B, o, o), + S.SelfAdd(o) + } + } + } + , + n.prototype.SolveSpring = function(e) { + var i = n.SolveSpring_s_pa + , r = n.SolveSpring_s_pb + , s = n.SolveSpring_s_d + , a = n.SolveSpring_s_f; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var o = this.m_positionBuffer.data, l = this.m_velocityBuffer.data, h = e.inv_dt * this.m_def.springStrength, c = 0; c < this.m_pairBuffer.count; c++) { + var u = this.m_pairBuffer.data[c]; + if (u.flags & t.b2ParticleFlag.b2_springParticle) { + var _ = u.indexA + , f = u.indexB + , d = i.Copy(o[_]) + , p = r.Copy(o[f]) + , m = l[_] + , y = l[f]; + d.SelfMulAdd(e.dt, m), + p.SelfMulAdd(e.dt, y); + var v = I.SubVV(p, d, s) + , g = u.distance + , A = v.Length() + , x = h * u.strength + , b = I.MulSV(x * (g - A) / A, v, a); + m.SelfSub(b), + y.SelfAdd(b) + } + } + } + , + n.prototype.SolveTensile = function(e) { + var i = n.SolveTensile_s_weightedNormal + , r = n.SolveTensile_s_s + , s = n.SolveTensile_s_f; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var a = this.m_velocityBuffer.data, o = 0; o < this.m_count; o++) + this.m_accumulation2Buffer[o] = new I, + this.m_accumulation2Buffer[o].SetZero(); + for (var l = 0; l < this.m_contactBuffer.count; l++) + if ((g = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_tensileParticle) { + var h = g.indexA + , c = g.indexB + , u = g.weight + , _ = g.normal + , f = I.MulSV((1 - u) * u, _, i); + this.m_accumulation2Buffer[h].SelfSub(f), + this.m_accumulation2Buffer[c].SelfAdd(f) + } + var d = this.GetCriticalVelocity(e) + , p = this.m_def.surfaceTensionPressureStrength * d + , m = this.m_def.surfaceTensionNormalStrength * d + , v = .5 * d; + for (l = 0; l < this.m_contactBuffer.count; l++) { + var g; + if ((g = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_tensileParticle) { + h = g.indexA, + c = g.indexB, + u = g.weight, + _ = g.normal; + var A = this.m_weightBuffer[h] + this.m_weightBuffer[c] + , x = I.SubVV(this.m_accumulation2Buffer[c], this.m_accumulation2Buffer[h], r) + , b = y(p * (A - 2) + m * I.DotVV(x, _), v) * u + , C = I.MulSV(b, _, s); + a[h].SelfSub(C), + a[c].SelfAdd(C) + } + } + } + , + n.prototype.SolveViscous = function() { + var e = n.SolveViscous_s_v + , i = n.SolveViscous_s_f; + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, a = this.m_def.viscousStrength, o = this.GetParticleInvMass(), l = 0; l < this.m_bodyContactBuffer.count; l++) { + var h = (m = this.m_bodyContactBuffer.data[l]).index; + if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_viscousParticle) { + var c = m.body + , u = m.weight + , _ = m.mass + , f = r[h] + , d = I.SubVV(c.GetLinearVelocityFromWorldPoint(f, I.s_t0), s[h], e) + , p = I.MulSV(a * _ * u, d, i); + s[h].SelfMulAdd(o, p), + c.ApplyLinearImpulse(p.SelfNeg(), f, !0) + } + } + for (l = 0; l < this.m_contactBuffer.count; l++) { + var m; + (m = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_viscousParticle && (h = m.indexA, + c = m.indexB, + u = m.weight, + d = I.SubVV(s[c], s[h], e), + p = I.MulSV(a * u, d, i), + s[h].SelfAdd(p), + s[c].SelfSub(p)) + } + } + , + n.prototype.SolveRepulsive = function(e) { + var i = n.SolveRepulsive_s_f; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var r = this.m_velocityBuffer.data, s = this.m_def.repulsiveStrength * this.GetCriticalVelocity(e), a = 0; a < this.m_contactBuffer.count; a++) { + var o = this.m_contactBuffer.data[a]; + if (o.flags & t.b2ParticleFlag.b2_repulsiveParticle) { + var l = o.indexA + , h = o.indexB; + if (this.m_groupBuffer[l] !== this.m_groupBuffer[h]) { + var c = o.weight + , u = o.normal + , _ = I.MulSV(s * c, u, i); + r[l].SelfSub(_), + r[h].SelfAdd(_) + } + } + } + } + , + n.prototype.SolvePowder = function(e) { + var i = n.SolvePowder_s_f; + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var r = this.m_positionBuffer.data, s = this.m_velocityBuffer.data, a = this.m_def.powderStrength * this.GetCriticalVelocity(e), o = this.GetParticleInvMass(), l = 0; l < this.m_bodyContactBuffer.count; l++) { + var h = (p = this.m_bodyContactBuffer.data[l]).index; + if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_powderParticle && (m = p.weight) > .25) { + var c = p.body + , u = p.mass + , _ = r[h] + , f = p.normal + , d = I.MulSV(a * u * (m - .25), f, i); + s[h].SelfMulSub(o, d), + c.ApplyLinearImpulse(d, _, !0) + } + } + for (l = 0; l < this.m_contactBuffer.count; l++) { + var p, m; + (p = this.m_contactBuffer.data[l]).flags & t.b2ParticleFlag.b2_powderParticle && (m = p.weight) > .25 && (h = p.indexA, + c = p.indexB, + f = p.normal, + d = I.MulSV(a * (m - .25), f, i), + s[h].SelfSub(d), + s[c].SelfAdd(d)) + } + } + , + n.prototype.SolveSolid = function(t) { + var e = n.SolveSolid_s_f; + if (!this.m_velocityBuffer.data) + throw new Error; + var i = this.m_velocityBuffer.data; + this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer); + for (var r = t.inv_dt * this.m_def.ejectionStrength, s = 0; s < this.m_contactBuffer.count; s++) { + var a = this.m_contactBuffer.data[s] + , o = a.indexA + , l = a.indexB; + if (this.m_groupBuffer[o] !== this.m_groupBuffer[l]) { + var h = a.weight + , c = a.normal + , u = this.m_depthBuffer[o] + this.m_depthBuffer[l] + , _ = I.MulSV(r * u * h, c, e); + i[o].SelfSub(_), + i[l].SelfAdd(_) + } + } + } + , + n.prototype.SolveForce = function(t) { + if (!this.m_velocityBuffer.data) + throw new Error; + for (var e = this.m_velocityBuffer.data, i = t.dt * this.GetParticleInvMass(), n = 0; n < this.m_count; n++) + e[n].SelfMulAdd(i, this.m_forceBuffer[n]); + this.m_hasForce = !1 + } + , + n.prototype.SolveColorMixing = function() { + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_colorBuffer.data) + throw new Error; + var e = .5 * this.m_def.colorMixingStrength; + if (e) + for (var i = 0; i < this.m_contactBuffer.count; i++) { + var n = this.m_contactBuffer.data[i] + , r = n.indexA + , s = n.indexB; + if (this.m_flagsBuffer.data[r] & this.m_flagsBuffer.data[s] & t.b2ParticleFlag.b2_colorMixingParticle) { + var a = this.m_colorBuffer.data[r] + , o = this.m_colorBuffer.data[s]; + k.MixColors(a, o, e) + } + } + } + , + n.prototype.SolveZombie = function() { + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + for (var e = 0, i = [], n = 0; n < this.m_count; n++) + i[n] = u; + var r = 0; + for (n = 0; n < this.m_count; n++) { + var s = this.m_flagsBuffer.data[n]; + if (s & t.b2ParticleFlag.b2_zombieParticle) { + var a = this.m_world.m_destructionListener; + s & t.b2ParticleFlag.b2_destructionListenerParticle && a && a.SayGoodbyeParticle(this, n), + this.m_handleIndexBuffer.data && (o = this.m_handleIndexBuffer.data[n]) && (o.SetIndex(u), + this.m_handleIndexBuffer.data[n] = null), + i[n] = u + } else { + var o; + i[n] = e, + n !== e && (this.m_handleIndexBuffer.data && ((o = this.m_handleIndexBuffer.data[n]) && o.SetIndex(e), + this.m_handleIndexBuffer.data[e] = o), + this.m_flagsBuffer.data[e] = this.m_flagsBuffer.data[n], + this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[e] = this.m_lastBodyContactStepBuffer.data[n]), + this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[e] = this.m_bodyContactCountBuffer.data[n]), + this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[e] = this.m_consecutiveContactStepsBuffer.data[n]), + this.m_positionBuffer.data[e].Copy(this.m_positionBuffer.data[n]), + this.m_velocityBuffer.data[e].Copy(this.m_velocityBuffer.data[n]), + this.m_groupBuffer[e] = this.m_groupBuffer[n], + this.m_hasForce && this.m_forceBuffer[e].Copy(this.m_forceBuffer[n]), + this.m_staticPressureBuffer && (this.m_staticPressureBuffer[e] = this.m_staticPressureBuffer[n]), + this.m_depthBuffer && (this.m_depthBuffer[e] = this.m_depthBuffer[n]), + this.m_colorBuffer.data && this.m_colorBuffer.data[e].Copy(this.m_colorBuffer.data[n]), + this.m_userDataBuffer.data && (this.m_userDataBuffer.data[e] = this.m_userDataBuffer.data[n]), + this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[e] = this.m_expirationTimeBuffer.data[n])), + e++, + r |= s + } + } + for (var l = 0; l < this.m_proxyBuffer.count; l++) { + var h = this.m_proxyBuffer.data[l]; + h.index = i[h.index] + } + for (this.m_proxyBuffer.RemoveIf((function(t) { + return t.index < 0 + } + )), + l = 0; l < this.m_contactBuffer.count; l++) + (c = this.m_contactBuffer.data[l]).indexA = i[c.indexA], + c.indexB = i[c.indexB]; + for (this.m_contactBuffer.RemoveIf((function(t) { + return t.indexA < 0 || t.indexB < 0 + } + )), + l = 0; l < this.m_bodyContactBuffer.count; l++) { + var c; + (c = this.m_bodyContactBuffer.data[l]).index = i[c.index] + } + for (this.m_bodyContactBuffer.RemoveIf((function(t) { + return t.index < 0 + } + )), + l = 0; l < this.m_pairBuffer.count; l++) { + var _ = this.m_pairBuffer.data[l]; + _.indexA = i[_.indexA], + _.indexB = i[_.indexB] + } + for (this.m_pairBuffer.RemoveIf((function(t) { + return t.indexA < 0 || t.indexB < 0 + } + )), + l = 0; l < this.m_triadBuffer.count; l++) { + var f = this.m_triadBuffer.data[l]; + f.indexA = i[f.indexA], + f.indexB = i[f.indexB], + f.indexC = i[f.indexC] + } + if (this.m_triadBuffer.RemoveIf((function(t) { + return t.indexA < 0 || t.indexB < 0 || t.indexC < 0 + } + )), + this.m_indexByExpirationTimeBuffer.data) + for (var d = 0, p = 0; p < this.m_count; p++) { + var m = i[this.m_indexByExpirationTimeBuffer.data[p]]; + m !== u && (this.m_indexByExpirationTimeBuffer.data[d++] = m) + } + for (var g = this.m_groupList; g; g = g.GetNext()) { + var A = e + , x = 0 + , b = !1; + for (n = g.m_firstIndex; n < g.m_lastIndex; n++) { + var C = i[n]; + C >= 0 ? (A = y(A, C), + x = v(x, C + 1)) : b = !0 + } + A < x ? (g.m_firstIndex = A, + g.m_lastIndex = x, + b && g.m_groupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SetGroupFlags(g, g.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth)) : (g.m_firstIndex = 0, + g.m_lastIndex = 0, + g.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty || this.SetGroupFlags(g, g.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed)) + } + for (this.m_count = e, + this.m_allParticleFlags = r, + this.m_needsUpdateAllParticleFlags = !1, + g = this.m_groupList; g; ) { + var T = g.GetNext(); + g.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed && this.DestroyParticleGroup(g), + g = T + } + } + , + n.prototype.SolveLifetimes = function(t) { + if (!this.m_expirationTimeBuffer.data) + throw new Error; + if (!this.m_indexByExpirationTimeBuffer.data) + throw new Error; + this.m_timeElapsed = this.LifetimeToExpirationTime(t.dt); + var e = this.GetQuantizedTimeElapsed() + , i = this.m_expirationTimeBuffer.data + , n = this.m_indexByExpirationTimeBuffer.data + , r = this.GetParticleCount(); + this.m_expirationTimeBufferRequiresSorting && (In(n, 0, r, (function(t, e) { + var n = i[t] + , r = i[e] + , s = n <= 0; + return s === r <= 0 ? n > r : s + } + )), + this.m_expirationTimeBufferRequiresSorting = !1); + for (var s = r - 1; s >= 0; --s) { + var a = n[s] + , o = i[a]; + if (e < o || o <= 0) + break; + this.DestroyParticle(a) + } + } + , + n.prototype.RotateBuffer = function(t, e, i) { + if (t !== e && e !== i) { + if (!this.m_flagsBuffer.data) + throw new Error; + if (!this.m_positionBuffer.data) + throw new Error; + if (!this.m_velocityBuffer.data) + throw new Error; + if (Fn(this.m_flagsBuffer.data, t, e, i), + this.m_lastBodyContactStepBuffer.data && Fn(this.m_lastBodyContactStepBuffer.data, t, e, i), + this.m_bodyContactCountBuffer.data && Fn(this.m_bodyContactCountBuffer.data, t, e, i), + this.m_consecutiveContactStepsBuffer.data && Fn(this.m_consecutiveContactStepsBuffer.data, t, e, i), + Fn(this.m_positionBuffer.data, t, e, i), + Fn(this.m_velocityBuffer.data, t, e, i), + Fn(this.m_groupBuffer, t, e, i), + this.m_hasForce && Fn(this.m_forceBuffer, t, e, i), + this.m_staticPressureBuffer && Fn(this.m_staticPressureBuffer, t, e, i), + this.m_depthBuffer && Fn(this.m_depthBuffer, t, e, i), + this.m_colorBuffer.data && Fn(this.m_colorBuffer.data, t, e, i), + this.m_userDataBuffer.data && Fn(this.m_userDataBuffer.data, t, e, i), + this.m_handleIndexBuffer.data) { + Fn(this.m_handleIndexBuffer.data, t, e, i); + for (var n = t; n < i; ++n) { + var r = this.m_handleIndexBuffer.data[n]; + r && r.SetIndex(f(r.GetIndex())) + } + } + if (this.m_expirationTimeBuffer.data) { + Fn(this.m_expirationTimeBuffer.data, t, e, i); + var s = this.GetParticleCount(); + if (!this.m_indexByExpirationTimeBuffer.data) + throw new Error; + var a = this.m_indexByExpirationTimeBuffer.data; + for (n = 0; n < s; ++n) + a[n] = f(a[n]) + } + for (var o = 0; o < this.m_proxyBuffer.count; o++) { + var l = this.m_proxyBuffer.data[o]; + l.index = f(l.index) + } + for (o = 0; o < this.m_contactBuffer.count; o++) + (h = this.m_contactBuffer.data[o]).indexA = f(h.indexA), + h.indexB = f(h.indexB); + for (o = 0; o < this.m_bodyContactBuffer.count; o++) { + var h; + (h = this.m_bodyContactBuffer.data[o]).index = f(h.index) + } + for (o = 0; o < this.m_pairBuffer.count; o++) { + var c = this.m_pairBuffer.data[o]; + c.indexA = f(c.indexA), + c.indexB = f(c.indexB) + } + for (o = 0; o < this.m_triadBuffer.count; o++) { + var u = this.m_triadBuffer.data[o]; + u.indexA = f(u.indexA), + u.indexB = f(u.indexB), + u.indexC = f(u.indexC) + } + for (var _ = this.m_groupList; _; _ = _.GetNext()) + _.m_firstIndex = f(_.m_firstIndex), + _.m_lastIndex = f(_.m_lastIndex - 1) + 1 + } + function f(n) { + return n < t ? n : n < e ? n + i - e : n < i ? n + t - e : n + } + } + , + n.prototype.GetCriticalVelocity = function(t) { + return this.m_particleDiameter * t.inv_dt + } + , + n.prototype.GetCriticalVelocitySquared = function(t) { + var e = this.GetCriticalVelocity(t); + return e * e + } + , + n.prototype.GetCriticalPressure = function(t) { + return this.m_def.density * this.GetCriticalVelocitySquared(t) + } + , + n.prototype.GetParticleStride = function() { + return .75 * this.m_particleDiameter + } + , + n.prototype.GetParticleMass = function() { + var t = this.GetParticleStride(); + return this.m_def.density * t * t + } + , + n.prototype.GetParticleInvMass = function() { + var t = this.m_inverseDiameter * (1 / .75); + return this.m_inverseDensity * t * t + } + , + n.prototype.GetFixtureContactFilter = function() { + return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null + } + , + n.prototype.GetParticleContactFilter = function() { + return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null + } + , + n.prototype.GetFixtureContactListener = function() { + return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null + } + , + n.prototype.GetParticleContactListener = function() { + return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null + } + , + n.prototype.SetUserOverridableBuffer = function(t, e, i) { + t.data = e, + t.userSuppliedCapacity = i + } + , + n.prototype.SetGroupFlags = function(e, i) { + var n = e.m_groupFlags; + (n ^ i) & t.b2ParticleGroupFlag.b2_solidParticleGroup && (i |= t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth), + n & ~i && (this.m_needsUpdateAllGroupFlags = !0), + ~this.m_allGroupFlags & i && (i & t.b2ParticleGroupFlag.b2_solidParticleGroup && (this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer)), + this.m_allGroupFlags |= i), + e.m_groupFlags = i + } + , + n.BodyContactCompare = function(t, e) { + return t.index === e.index ? t.weight > e.weight : t.index < e.index + } + , + n.prototype.RemoveSpuriousBodyContacts = function() { + In(this.m_bodyContactBuffer.data, 0, this.m_bodyContactBuffer.count, n.BodyContactCompare); + var t = n.RemoveSpuriousBodyContacts_s_n + , e = n.RemoveSpuriousBodyContacts_s_pos + , i = n.RemoveSpuriousBodyContacts_s_normal + , r = this + , s = -1 + , a = 0; + this.m_bodyContactBuffer.count = Rn(this.m_bodyContactBuffer.data, (function(n) { + if (n.index !== s && (a = 0, + s = n.index), + a++ > 3) + return !0; + var o = t.Copy(n.normal); + if (o.SelfMul(r.m_particleDiameter * (1 - n.weight)), + !r.m_positionBuffer.data) + throw new Error; + var h = I.AddVV(r.m_positionBuffer.data[n.index], o, e); + if (!n.fixture.TestPoint(h)) { + for (var c = n.fixture.GetShape().GetChildCount(), u = 0; u < c; u++) { + var _ = i; + if (n.fixture.ComputeDistance(h, _, u) < l) + return !1 + } + return !0 + } + return !1 + } + ), this.m_bodyContactBuffer.count) + } + , + n.prototype.DetectStuckParticle = function(t) { + if (!(this.m_stuckThreshold <= 0)) { + if (!this.m_bodyContactCountBuffer.data) + throw new Error; + if (!this.m_consecutiveContactStepsBuffer.data) + throw new Error; + if (!this.m_lastBodyContactStepBuffer.data) + throw new Error; + ++this.m_bodyContactCountBuffer.data[t], + 2 === this.m_bodyContactCountBuffer.data[t] && (++this.m_consecutiveContactStepsBuffer.data[t], + this.m_consecutiveContactStepsBuffer.data[t] > this.m_stuckThreshold && (this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()] = t)), + this.m_lastBodyContactStepBuffer.data[t] = this.m_timestamp + } + } + , + n.prototype.ValidateParticleIndex = function(t) { + return t >= 0 && t < this.GetParticleCount() && t !== u + } + , + n.prototype.GetQuantizedTimeElapsed = function() { + return Math.floor(this.m_timeElapsed / 4294967296) + } + , + n.prototype.LifetimeToExpirationTime = function(t) { + return this.m_timeElapsed + Math.floor(t / this.m_def.lifetimeGranularity * 4294967296) + } + , + n.prototype.ForceCanBeApplied = function(e) { + return !(e & t.b2ParticleFlag.b2_wallParticle) + } + , + n.prototype.PrepareForceBuffer = function() { + if (!this.m_hasForce) { + for (var t = 0; t < this.m_count; t++) + this.m_forceBuffer[t].SetZero(); + this.m_hasForce = !0 + } + } + , + n.prototype.IsRigidGroup = function(e) { + return null !== e && 0 != (e.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup) + } + , + n.prototype.GetLinearVelocity = function(t, e, i, n) { + if (t && this.IsRigidGroup(t)) + return t.GetLinearVelocityFromWorldPoint(i, n); + if (!this.m_velocityBuffer.data) + throw new Error; + return n.Copy(this.m_velocityBuffer.data[e]) + } + , + n.prototype.InitDampingParameter = function(t, e, i, n, r, s, a, o) { + t[0] = n > 0 ? 1 / n : 0, + e[0] = r > 0 ? 1 / r : 0, + i[0] = I.CrossVV(I.SubVV(a, s, I.s_t0), o) + } + , + n.prototype.InitDampingParameterWithRigidGroupOrParticle = function(e, i, n, r, s, a, o, l) { + if (s && r) + this.InitDampingParameter(e, i, n, s.GetMass(), s.GetInertia(), s.GetCenter(), o, l); + else { + if (!this.m_flagsBuffer.data) + throw new Error; + var h = this.m_flagsBuffer.data[a]; + this.InitDampingParameter(e, i, n, h & t.b2ParticleFlag.b2_wallParticle ? 0 : this.GetParticleMass(), 0, o, o, l) + } + } + , + n.prototype.ComputeDampingImpulse = function(t, e, i, n, r, s, a) { + var o = t + e * i * i + n + r * s * s; + return o > 0 ? a / o : 0 + } + , + n.prototype.ApplyDamping = function(t, e, i, n, r, s, a, o) { + if (r && n) + r.m_linearVelocity.SelfMulAdd(a * t, o), + r.m_angularVelocity += a * i * e; + else { + if (!this.m_velocityBuffer.data) + throw new Error; + this.m_velocityBuffer.data[s].SelfMulAdd(a * t, o) + } + } + , + n.xTruncBits = 12, + n.yTruncBits = 12, + n.tagBits = 32, + n.yOffset = 1 << n.yTruncBits - 1, + n.yShift = n.tagBits - n.yTruncBits, + n.xShift = n.tagBits - n.yTruncBits - n.xTruncBits, + n.xScale = 1 << n.xShift, + n.xOffset = n.xScale * (1 << n.xTruncBits - 1), + n.yMask = (1 << n.yTruncBits) - 1 << n.yShift, + n.xMask = ~n.yMask, + n.DestroyParticlesInShape_s_aabb = new Tt, + n.CreateParticleGroup_s_transform = new V, + n.ComputeCollisionEnergy_s_v = new I, + n.QueryShapeAABB_s_aabb = new Tt, + n.QueryPointAABB_s_aabb = new Tt, + n.RayCast_s_aabb = new Tt, + n.RayCast_s_p = new I, + n.RayCast_s_v = new I, + n.RayCast_s_n = new I, + n.RayCast_s_point = new I, + n.k_pairFlags = t.b2ParticleFlag.b2_springParticle, + n.k_triadFlags = t.b2ParticleFlag.b2_elasticParticle, + n.k_noPressureFlags = t.b2ParticleFlag.b2_powderParticle | t.b2ParticleFlag.b2_tensileParticle, + n.k_extraDampingFlags = t.b2ParticleFlag.b2_staticPressureParticle, + n.k_barrierWallFlags = t.b2ParticleFlag.b2_barrierParticle | t.b2ParticleFlag.b2_wallParticle, + n.CreateParticlesStrokeShapeForGroup_s_edge = new ri, + n.CreateParticlesStrokeShapeForGroup_s_d = new I, + n.CreateParticlesStrokeShapeForGroup_s_p = new I, + n.CreateParticlesFillShapeForGroup_s_aabb = new Tt, + n.CreateParticlesFillShapeForGroup_s_p = new I, + n.UpdatePairsAndTriads_s_dab = new I, + n.UpdatePairsAndTriads_s_dbc = new I, + n.UpdatePairsAndTriads_s_dca = new I, + n.AddContact_s_d = new I, + n.UpdateBodyContacts_s_aabb = new Tt, + n.Solve_s_subStep = new cn, + n.SolveCollision_s_aabb = new Tt, + n.SolveGravity_s_gravity = new I, + n.SolveBarrier_s_aabb = new Tt, + n.SolveBarrier_s_va = new I, + n.SolveBarrier_s_vb = new I, + n.SolveBarrier_s_pba = new I, + n.SolveBarrier_s_vba = new I, + n.SolveBarrier_s_vc = new I, + n.SolveBarrier_s_pca = new I, + n.SolveBarrier_s_vca = new I, + n.SolveBarrier_s_qba = new I, + n.SolveBarrier_s_qca = new I, + n.SolveBarrier_s_dv = new I, + n.SolveBarrier_s_f = new I, + n.SolvePressure_s_f = new I, + n.SolveDamping_s_v = new I, + n.SolveDamping_s_f = new I, + n.SolveRigidDamping_s_t0 = new I, + n.SolveRigidDamping_s_t1 = new I, + n.SolveRigidDamping_s_p = new I, + n.SolveRigidDamping_s_v = new I, + n.SolveExtraDamping_s_v = new I, + n.SolveExtraDamping_s_f = new I, + n.SolveRigid_s_position = new I, + n.SolveRigid_s_rotation = new F, + n.SolveRigid_s_transform = new V, + n.SolveRigid_s_velocityTransform = new V, + n.SolveElastic_s_pa = new I, + n.SolveElastic_s_pb = new I, + n.SolveElastic_s_pc = new I, + n.SolveElastic_s_r = new F, + n.SolveElastic_s_t0 = new I, + n.SolveSpring_s_pa = new I, + n.SolveSpring_s_pb = new I, + n.SolveSpring_s_d = new I, + n.SolveSpring_s_f = new I, + n.SolveTensile_s_weightedNormal = new I, + n.SolveTensile_s_s = new I, + n.SolveTensile_s_f = new I, + n.SolveViscous_s_v = new I, + n.SolveViscous_s_f = new I, + n.SolveRepulsive_s_f = new I, + n.SolvePowder_s_f = new I, + n.SolveSolid_s_f = new I, + n.RemoveSpuriousBodyContacts_s_n = new I, + n.RemoveSpuriousBodyContacts_s_pos = new I, + n.RemoveSpuriousBodyContacts_s_normal = new I, + n + } + )(), + (function(e) { + e.UserOverridableBuffer = function() { + this.data = null, + this.userSuppliedCapacity = 0 + } + ; + var n = (function() { + function t() { + this.index = u, + this.tag = 0 + } + return t.CompareProxyProxy = function(t, e) { + return t.tag < e.tag + } + , + t.CompareTagProxy = function(t, e) { + return t < e.tag + } + , + t.CompareProxyTag = function(t, e) { + return t.tag < e + } + , + t + } + )(); + e.Proxy = n; + var r = (function() { + function t(t, i, n, r, s) { + this.m_system = t, + this.m_xLower = (i & e.xMask) >>> 0, + this.m_xUpper = (n & e.xMask) >>> 0, + this.m_yLower = (i & e.yMask) >>> 0, + this.m_yUpper = (n & e.yMask) >>> 0, + this.m_first = r, + this.m_last = s + } + return t.prototype.GetNext = function() { + for (; this.m_first < this.m_last; ) { + var t = (this.m_system.m_proxyBuffer.data[this.m_first].tag & e.xMask) >>> 0; + if (t >= this.m_xLower && t <= this.m_xUpper) + return this.m_system.m_proxyBuffer.data[this.m_first++].index; + this.m_first++ + } + return u + } + , + t + } + )(); + e.InsideBoundsEnumerator = r; + e.ParticleListNode = function() { + this.next = null, + this.count = 0, + this.index = 0 + } + ; + var s = (function() { + function t() {} + return t.prototype.Allocate = function(t, e) { + return e + } + , + t.prototype.Clear = function() {} + , + t.prototype.GetCount = function() { + return 0 + } + , + t.prototype.Invalidate = function() {} + , + t.prototype.GetValidBuffer = function() { + return [] + } + , + t.prototype.GetBuffer = function() { + return [] + } + , + t.prototype.SetCount = function() {} + , + t + } + )(); + e.FixedSetAllocator = s; + e.FixtureParticle = function(t, e) { + this.second = u, + this.first = t, + this.second = e + } + ; + var a = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return ti(e, t), + e.prototype.Initialize = function() {} + , + e.prototype.Find = function() { + return u + } + , + e + } + )(e.FixedSetAllocator); + e.FixtureParticleSet = a; + e.ParticlePair = function(t, e) { + this.first = u, + this.second = u, + this.first = t, + this.second = e + } + ; + var o = (function(t) { + function e() { + return null !== t && t.apply(this, arguments) || this + } + return ti(e, t), + e.prototype.Initialize = function() {} + , + e.prototype.Find = function() { + return u + } + , + e + } + )(e.FixedSetAllocator); + e.b2ParticlePairSet = o; + var h = (function() { + function t() {} + return t.prototype.IsNecessary = function() { + return !0 + } + , + t.prototype.ShouldCreatePair = function() { + return !0 + } + , + t.prototype.ShouldCreateTriad = function() { + return !0 + } + , + t + } + )(); + e.ConnectionFilter = h; + var c = (function(t) { + function e(e, i, n, r) { + var s = t.call(this) || this; + return s.m_callDestructionListener = !1, + s.m_destroyed = 0, + s.m_system = e, + s.m_shape = i, + s.m_xf = n, + s.m_callDestructionListener = r, + s.m_destroyed = 0, + s + } + return ti(e, t), + e.prototype.ReportFixture = function() { + return !1 + } + , + e.prototype.ReportParticle = function(t, e) { + if (t !== this.m_system) + return !1; + if (!this.m_system.m_positionBuffer.data) + throw new Error; + return this.m_shape.TestPoint(this.m_xf, this.m_system.m_positionBuffer.data[e]) && (this.m_system.DestroyParticle(e, this.m_callDestructionListener), + this.m_destroyed++), + !0 + } + , + e.prototype.Destroyed = function() { + return this.m_destroyed + } + , + e + } + )(an); + e.DestroyParticlesInShapeCallback = c; + var _ = (function(t) { + function e(e) { + var i = t.call(this) || this; + return i.m_threshold = 0, + i.m_threshold = e, + i + } + return ti(e, t), + e.prototype.ShouldCreatePair = function(t, e) { + return t < this.m_threshold && this.m_threshold <= e || e < this.m_threshold && this.m_threshold <= t + } + , + e.prototype.ShouldCreateTriad = function(t, e, i) { + return (t < this.m_threshold || e < this.m_threshold || i < this.m_threshold) && (this.m_threshold <= t || this.m_threshold <= e || this.m_threshold <= i) + } + , + e + } + )(e.ConnectionFilter); + e.JoinParticleGroupsFilter = _; + var f = (function(e) { + function n(i, n) { + void 0 === n && (n = i.length); + var r = e.call(this, t.b2ShapeType.e_unknown, 0) || this; + return r.m_shapeCount = 0, + r.m_shapes = i, + r.m_shapeCount = n, + r + } + return ti(n, e), + n.prototype.Clone = function() { + throw new Error + } + , + n.prototype.GetChildCount = function() { + return 1 + } + , + n.prototype.TestPoint = function(t, e) { + for (var i = 0; i < this.m_shapeCount; i++) + if (this.m_shapes[i].TestPoint(t, e)) + return !0; + return !1 + } + , + n.prototype.ComputeDistance = function() { + return 0 + } + , + n.prototype.RayCast = function() { + return !1 + } + , + n.prototype.ComputeAABB = function(t, e) { + var n = new Tt; + t.lowerBound.x = +i, + t.lowerBound.y = +i, + t.upperBound.x = -i, + t.upperBound.y = -i; + for (var r = 0; r < this.m_shapeCount; r++) + for (var s = this.m_shapes[r].GetChildCount(), a = 0; a < s; a++) { + var o = n; + this.m_shapes[r].ComputeAABB(o, e, a), + t.Combine1(o) + } + } + , + n.prototype.ComputeMass = function() {} + , + n.prototype.SetupDistanceProxy = function() {} + , + n.prototype.ComputeSubmergedArea = function() { + return 0 + } + , + n.prototype.Dump = function() {} + , + n + } + )(Qe); + e.CompositeShape = f; + var d = (function(e) { + function i(t) { + var i = e.call(this) || this; + return i.m_flagsBuffer = t, + i + } + return ti(i, e), + i.prototype.IsNecessary = function(e) { + if (!this.m_flagsBuffer.data) + throw new Error; + return 0 != (this.m_flagsBuffer.data[e] & t.b2ParticleFlag.b2_reactiveParticle) + } + , + i + } + )(e.ConnectionFilter); + e.ReactiveFilter = d; + var p = (function(i) { + function n(t, e) { + var n = i.call(this, t) || this; + return n.m_contactFilter = e, + n + } + return ti(n, i), + n.prototype.ShouldCollideFixtureParticle = function(e, i, n) { + return !(this.m_contactFilter && this.m_system.GetFlagsBuffer()[n] & t.b2ParticleFlag.b2_fixtureContactFilterParticle) || this.m_contactFilter.ShouldCollideFixtureParticle(e, this.m_system, n) + } + , + n.prototype.ReportFixtureAndParticle = function(i, n, r) { + var s = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_n + , a = e.UpdateBodyContactsCallback.ReportFixtureAndParticle_s_rp; + if (!this.m_system.m_flagsBuffer.data) + throw new Error; + if (!this.m_system.m_positionBuffer.data) + throw new Error; + var o = this.m_system.m_positionBuffer.data[r] + , l = s + , h = i.ComputeDistance(o, l, n); + if (h < this.m_system.m_particleDiameter && this.ShouldCollideFixtureParticle(i, this.m_system, r)) { + var c = i.GetBody() + , u = c.GetWorldCenter() + , _ = c.GetMass() + , f = c.GetInertia() - _ * c.GetLocalCenter().LengthSquared() + , d = _ > 0 ? 1 / _ : 0 + , p = f > 0 ? 1 / f : 0 + , m = this.m_system.m_flagsBuffer.data[r] & t.b2ParticleFlag.b2_wallParticle ? 0 : this.m_system.GetParticleInvMass() + , y = I.SubVV(o, u, a) + , v = I.CrossVV(y, l) + , g = m + d + p * v * v + , A = this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()]; + A.index = r, + A.body = c, + A.fixture = i, + A.weight = 1 - h * this.m_system.m_inverseDiameter, + A.normal.Copy(l.SelfNeg()), + A.mass = g > 0 ? 1 / g : 0, + this.m_system.DetectStuckParticle(r) + } + } + , + n.ReportFixtureAndParticle_s_n = new I, + n.ReportFixtureAndParticle_s_rp = new I, + n + } + )(kn); + e.UpdateBodyContactsCallback = p; + var m = (function(i) { + function n(t, e) { + var n = i.call(this, t) || this; + return n.m_step = e, + n + } + return ti(n, i), + n.prototype.ReportFixtureAndParticle = function(i, n, r) { + var s = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p1 + , a = e.SolveCollisionCallback.ReportFixtureAndParticle_s_output + , o = e.SolveCollisionCallback.ReportFixtureAndParticle_s_input + , h = e.SolveCollisionCallback.ReportFixtureAndParticle_s_p + , c = e.SolveCollisionCallback.ReportFixtureAndParticle_s_v + , u = e.SolveCollisionCallback.ReportFixtureAndParticle_s_f + , _ = i.GetBody(); + if (!this.m_system.m_positionBuffer.data) + throw new Error; + if (!this.m_system.m_velocityBuffer.data) + throw new Error; + var f = this.m_system.m_positionBuffer.data[r] + , d = this.m_system.m_velocityBuffer.data[r] + , p = a + , m = o; + if (0 === this.m_system.m_iterationIndex) { + var y = V.MulTXV(_.m_xf0, f, s); + i.GetShape().GetType() === t.b2ShapeType.e_circleShape && (y.SelfSub(_.GetLocalCenter()), + F.MulRV(_.m_xf0.q, y, y), + F.MulTRV(_.m_xf.q, y, y), + y.SelfAdd(_.GetLocalCenter())), + V.MulXV(_.m_xf, y, m.p1) + } else + m.p1.Copy(f); + if (I.AddVMulSV(f, this.m_step.dt, d, m.p2), + m.maxFraction = 1, + i.RayCast(p, m, n)) { + var v = p.normal + , g = h; + g.x = (1 - p.fraction) * m.p1.x + p.fraction * m.p2.x + l * v.x, + g.y = (1 - p.fraction) * m.p1.y + p.fraction * m.p2.y + l * v.y; + var A = c; + A.x = this.m_step.inv_dt * (g.x - f.x), + A.y = this.m_step.inv_dt * (g.y - f.y), + this.m_system.m_velocityBuffer.data[r].Copy(A); + var x = u; + x.x = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.x - A.x), + x.y = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.y - A.y), + this.m_system.ParticleApplyForce(r, x) + } + } + , + n.prototype.ReportParticle = function() { + return !1 + } + , + n.ReportFixtureAndParticle_s_p1 = new I, + n.ReportFixtureAndParticle_s_output = new Ct, + n.ReportFixtureAndParticle_s_input = new bt, + n.ReportFixtureAndParticle_s_p = new I, + n.ReportFixtureAndParticle_s_v = new I, + n.ReportFixtureAndParticle_s_f = new I, + n + } + )(kn); + e.SolveCollisionCallback = m + } + )(t.b2ParticleSystem || (t.b2ParticleSystem = {})); + var jn = (function() { + function e(t) { + this.m_newFixture = !1, + this.m_locked = !1, + this.m_clearForces = !0, + this.m_contactManager = new ln, + this.m_bodyList = null, + this.m_jointList = null, + this.m_particleSystemList = null, + this.m_bodyCount = 0, + this.m_jointCount = 0, + this.m_gravity = new I, + this.m_allowSleep = !0, + this.m_destructionListener = null, + this.m_debugDraw = null, + this.m_inv_dt0 = 0, + this.m_warmStarting = !0, + this.m_continuousPhysics = !0, + this.m_subStepping = !1, + this.m_stepComplete = !0, + this.m_profile = new hn, + this.m_island = new An, + this.s_stack = [], + this.m_controllerList = null, + this.m_controllerCount = 0, + this.m_gravity.Copy(t) + } + return e.prototype.SetDestructionListener = function(t) { + this.m_destructionListener = t + } + , + e.prototype.SetContactFilter = function(t) { + this.m_contactManager.m_contactFilter = t + } + , + e.prototype.SetContactListener = function(t) { + this.m_contactManager.m_contactListener = t + } + , + e.prototype.SetDebugDraw = function(t) { + this.m_debugDraw = t + } + , + e.prototype.CreateBody = function(t) { + if (void 0 === t && (t = {}), + this.IsLocked()) + throw new Error; + var e = new _i(t,this); + return e.m_prev = null, + e.m_next = this.m_bodyList, + this.m_bodyList && (this.m_bodyList.m_prev = e), + this.m_bodyList = e, + ++this.m_bodyCount, + e + } + , + e.prototype.DestroyBody = function(t) { + if (this.IsLocked()) + throw new Error; + for (var e = t.m_jointList; e; ) { + var i = e; + e = e.next, + this.m_destructionListener && this.m_destructionListener.SayGoodbyeJoint(i.joint), + this.DestroyJoint(i.joint), + t.m_jointList = e + } + t.m_jointList = null; + for (var n = t.m_controllerList; n; ) { + var r = n; + n = n.nextController, + r.controller.RemoveBody(t) + } + for (var s = t.m_contactList; s; ) { + var a = s; + s = s.next, + this.m_contactManager.Destroy(a.contact) + } + t.m_contactList = null; + for (var o = t.m_fixtureList; o; ) { + var l = o; + o = o.m_next, + this.m_destructionListener && this.m_destructionListener.SayGoodbyeFixture(l), + l.DestroyProxies(), + l.Destroy(), + t.m_fixtureList = o, + t.m_fixtureCount -= 1 + } + t.m_fixtureList = null, + t.m_fixtureCount = 0, + t.m_prev && (t.m_prev.m_next = t.m_next), + t.m_next && (t.m_next.m_prev = t.m_prev), + t === this.m_bodyList && (this.m_bodyList = t.m_next), + --this.m_bodyCount + } + , + e._Joint_Create = function(e) { + switch (e.type) { + case t.b2JointType.e_distanceJoint: + return new vi(e); + case t.b2JointType.e_mouseJoint: + return new Mi(e); + case t.b2JointType.e_prismaticJoint: + return new Bi(e); + case t.b2JointType.e_revoluteJoint: + return new Oi(e); + case t.b2JointType.e_pulleyJoint: + return new Pi(e); + case t.b2JointType.e_gearJoint: + return new Ti(e); + case t.b2JointType.e_wheelJoint: + return new Gi(e); + case t.b2JointType.e_weldJoint: + return new Ni(e); + case t.b2JointType.e_frictionJoint: + return new bi(e); + case t.b2JointType.e_ropeJoint: + return new Fi(e); + case t.b2JointType.e_motorJoint: + return new wi(e); + case t.b2JointType.e_areaJoint: + return new Ai(e) + } + throw new Error + } + , + e._Joint_Destroy = function() {} + , + e.prototype.CreateJoint = function(t) { + if (this.IsLocked()) + throw new Error; + var i = e._Joint_Create(t, null); + i.m_prev = null, + i.m_next = this.m_jointList, + this.m_jointList && (this.m_jointList.m_prev = i), + this.m_jointList = i, + ++this.m_jointCount, + i.m_edgeA.prev = null, + i.m_edgeA.next = i.m_bodyA.m_jointList, + i.m_bodyA.m_jointList && (i.m_bodyA.m_jointList.prev = i.m_edgeA), + i.m_bodyA.m_jointList = i.m_edgeA, + i.m_edgeB.prev = null, + i.m_edgeB.next = i.m_bodyB.m_jointList, + i.m_bodyB.m_jointList && (i.m_bodyB.m_jointList.prev = i.m_edgeB), + i.m_bodyB.m_jointList = i.m_edgeB; + var n = t.bodyA + , r = t.bodyB; + if (!t.collideConnected) + for (var s = r.GetContactList(); s; ) + s.other === n && s.contact.FlagForFiltering(), + s = s.next; + return i + } + , + e.prototype.DestroyJoint = function(t) { + if (this.IsLocked()) + throw new Error; + var i = t.m_collideConnected; + t.m_prev && (t.m_prev.m_next = t.m_next), + t.m_next && (t.m_next.m_prev = t.m_prev), + t === this.m_jointList && (this.m_jointList = t.m_next); + var n = t.m_bodyA + , r = t.m_bodyB; + if (n.SetAwake(!0), + r.SetAwake(!0), + t.m_edgeA.prev && (t.m_edgeA.prev.next = t.m_edgeA.next), + t.m_edgeA.next && (t.m_edgeA.next.prev = t.m_edgeA.prev), + t.m_edgeA === n.m_jointList && (n.m_jointList = t.m_edgeA.next), + t.m_edgeA.prev = null, + t.m_edgeA.next = null, + t.m_edgeB.prev && (t.m_edgeB.prev.next = t.m_edgeB.next), + t.m_edgeB.next && (t.m_edgeB.next.prev = t.m_edgeB.prev), + t.m_edgeB === r.m_jointList && (r.m_jointList = t.m_edgeB.next), + t.m_edgeB.prev = null, + t.m_edgeB.next = null, + e._Joint_Destroy(t, null), + --this.m_jointCount, + !i) + for (var s = r.GetContactList(); s; ) + s.other === n && s.contact.FlagForFiltering(), + s = s.next + } + , + e.prototype.CreateParticleSystem = function(e) { + if (this.IsLocked()) + throw new Error; + var i = new t.b2ParticleSystem(e,this); + return i.m_prev = null, + i.m_next = this.m_particleSystemList, + this.m_particleSystemList && (this.m_particleSystemList.m_prev = i), + this.m_particleSystemList = i, + i + } + , + e.prototype.DestroyParticleSystem = function(t) { + if (this.IsLocked()) + throw new Error; + t.m_prev && (t.m_prev.m_next = t.m_next), + t.m_next && (t.m_next.m_prev = t.m_prev), + t === this.m_particleSystemList && (this.m_particleSystemList = t.m_next) + } + , + e.prototype.CalculateReasonableParticleIterations = function(t) { + return null === this.m_particleSystemList ? 1 : bn(this.m_gravity.Length(), (function(t) { + for (var e = i, n = t.GetParticleSystemList(); null !== n; n = n.m_next) + e = y(e, n.GetRadius()); + return e + } + )(this), t) + } + , + e.prototype.Step = function(t, i, n, r) { + void 0 === r && (r = this.CalculateReasonableParticleIterations(t)); + var s = e.Step_s_stepTimer.Reset(); + this.m_newFixture && (this.m_contactManager.FindNewContacts(), + this.m_newFixture = !1), + this.m_locked = !0; + var a = e.Step_s_step; + a.dt = t, + a.velocityIterations = i, + a.positionIterations = n, + a.particleIterations = r, + a.inv_dt = t > 0 ? 1 / t : 0, + a.dtRatio = this.m_inv_dt0 * t, + a.warmStarting = this.m_warmStarting; + var o = e.Step_s_timer.Reset(); + if (this.m_contactManager.Collide(), + this.m_profile.collide = o.GetMilliseconds(), + this.m_stepComplete && a.dt > 0) { + for (var l = e.Step_s_timer.Reset(), h = this.m_particleSystemList; h; h = h.m_next) + h.Solve(a); + this.Solve(a), + this.m_profile.solve = l.GetMilliseconds() + } + if (this.m_continuousPhysics && a.dt > 0) { + var c = e.Step_s_timer.Reset(); + this.SolveTOI(a), + this.m_profile.solveTOI = c.GetMilliseconds() + } + a.dt > 0 && (this.m_inv_dt0 = a.inv_dt), + this.m_clearForces && this.ClearForces(), + this.m_locked = !1, + this.m_profile.step = s.GetMilliseconds() + } + , + e.prototype.ClearForces = function() { + for (var t = this.m_bodyList; t; t = t.m_next) + t.m_force.SetZero(), + t.m_torque = 0 + } + , + e.prototype.DrawParticleSystem = function(t) { + if (null !== this.m_debugDraw) { + var e = t.GetParticleCount(); + if (e) { + var i = t.GetRadius() + , n = t.GetPositionBuffer(); + if (t.m_colorBuffer.data) { + var r = t.GetColorBuffer(); + this.m_debugDraw.DrawParticles(n, i, r, e) + } else + this.m_debugDraw.DrawParticles(n, i, null, e) + } + } + } + , + e.prototype.DrawDebugData = function() { + if (null !== this.m_debugDraw) { + var i = this.m_debugDraw.GetFlags() + , n = e.DrawDebugData_s_color.SetRGB(0, 0, 0); + if (i & t.b2DrawFlags.e_shapeBit) + for (var r = this.m_bodyList; r; r = r.m_next) { + var s = r.m_xf; + this.m_debugDraw.PushTransform(s); + for (var a = r.GetFixtureList(); a; a = a.m_next) + r.IsActive() ? r.GetType() === t.b2BodyType.b2_staticBody ? (n.SetRGB(.5, .9, .5), + this.DrawShape(a, n)) : r.GetType() === t.b2BodyType.b2_kinematicBody ? (n.SetRGB(.5, .5, .9), + this.DrawShape(a, n)) : r.IsAwake() ? (n.SetRGB(.9, .7, .7), + this.DrawShape(a, n)) : (n.SetRGB(.6, .6, .6), + this.DrawShape(a, n)) : (n.SetRGB(.5, .5, .3), + this.DrawShape(a, n)); + this.m_debugDraw.PopTransform(s) + } + if (i & t.b2DrawFlags.e_particleBit) + for (var o = this.m_particleSystemList; o; o = o.m_next) + this.DrawParticleSystem(o); + if (i & t.b2DrawFlags.e_jointBit) + for (var l = this.m_jointList; l; l = l.m_next) + this.DrawJoint(l); + if (i & t.b2DrawFlags.e_aabbBit) { + n.SetRGB(.9, .3, .9); + var h = e.DrawDebugData_s_vs; + for (r = this.m_bodyList; r; r = r.m_next) + if (r.IsActive()) + for (a = r.GetFixtureList(); a; a = a.m_next) + for (var c = 0; c < a.m_proxyCount; ++c) { + var u = a.m_proxies[c].treeNode.aabb; + h[0].Set(u.lowerBound.x, u.lowerBound.y), + h[1].Set(u.upperBound.x, u.lowerBound.y), + h[2].Set(u.upperBound.x, u.upperBound.y), + h[3].Set(u.lowerBound.x, u.upperBound.y), + this.m_debugDraw.DrawPolygon(h, 4, n) + } + } + if (i & t.b2DrawFlags.e_centerOfMassBit) + for (r = this.m_bodyList; r; r = r.m_next) + (s = e.DrawDebugData_s_xf).q.Copy(r.m_xf.q), + s.p.Copy(r.GetWorldCenter()), + this.m_debugDraw.DrawTransform(s); + if (i & t.b2DrawFlags.e_controllerBit) + for (var _ = this.m_controllerList; _; _ = _.m_next) + _.Draw(this.m_debugDraw) + } + } + , + e.prototype.QueryAABB = function(t, e, i) { + if (this.m_contactManager.m_broadPhase.Query(e, (function(e) { + var n = e.userData.fixture; + return t ? t.ReportFixture(n) : !i || i(n) + } + )), + t instanceof an) + for (var n = this.m_particleSystemList; n; n = n.m_next) + t.ShouldQueryParticleSystem(n) && n.QueryAABB(t, e) + } + , + e.prototype.QueryAllAABB = function(t, e) { + return void 0 === e && (e = []), + this.QueryAABB(null, t, (function(t) { + return e.push(t), + !0 + } + )), + e + } + , + e.prototype.QueryPointAABB = function(t, e, i) { + if (this.m_contactManager.m_broadPhase.QueryPoint(e, (function(e) { + var n = e.userData.fixture; + return t ? t.ReportFixture(n) : !i || i(n) + } + )), + t instanceof an) + for (var n = this.m_particleSystemList; n; n = n.m_next) + t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e) + } + , + e.prototype.QueryAllPointAABB = function(t, e) { + return void 0 === e && (e = []), + this.QueryPointAABB(null, t, (function(t) { + return e.push(t), + !0 + } + )), + e + } + , + e.prototype.QueryFixtureShape = function(t, i, n, r, s) { + var a = e.QueryFixtureShape_s_aabb; + if (i.ComputeAABB(a, r, n), + this.m_contactManager.m_broadPhase.Query(a, (function(e) { + var a = e.userData + , o = a.fixture; + if (Bt(i, n, o.GetShape(), a.childIndex, r, o.GetBody().GetTransform())) { + if (t) + return t.ReportFixture(o); + if (s) + return s(o) + } + return !0 + } + )), + t instanceof an) + for (var o = this.m_particleSystemList; o; o = o.m_next) + t.ShouldQueryParticleSystem(o) && o.QueryAABB(t, a) + } + , + e.prototype.QueryAllFixtureShape = function(t, e, i, n) { + return void 0 === n && (n = []), + this.QueryFixtureShape(null, t, e, i, (function(t) { + return n.push(t), + !0 + } + )), + n + } + , + e.prototype.QueryFixturePoint = function(t, e, i) { + if (this.m_contactManager.m_broadPhase.QueryPoint(e, (function(n) { + var r = n.userData.fixture; + if (r.TestPoint(e)) { + if (t) + return t.ReportFixture(r); + if (i) + return i(r) + } + return !0 + } + )), + t) + for (var n = this.m_particleSystemList; n; n = n.m_next) + t.ShouldQueryParticleSystem(n) && n.QueryPointAABB(t, e) + } + , + e.prototype.QueryAllFixturePoint = function(t, e) { + return void 0 === e && (e = []), + this.QueryFixturePoint(null, t, (function(t) { + return e.push(t), + !0 + } + )), + e + } + , + e.prototype.RayCast = function(t, i, n, r) { + var s = e.RayCast_s_input; + if (s.maxFraction = 1, + s.p1.Copy(i), + s.p2.Copy(n), + this.m_contactManager.m_broadPhase.RayCast(s, (function(s, a) { + var o = a.userData + , l = o.fixture + , h = o.childIndex + , c = e.RayCast_s_output; + if (l.RayCast(c, s, h)) { + var u = c.fraction + , _ = e.RayCast_s_point; + if (_.Set((1 - u) * i.x + u * n.x, (1 - u) * i.y + u * n.y), + t) + return t.ReportFixture(l, _, c.normal, u); + if (r) + return r(l, _, c.normal, u) + } + return s.maxFraction + } + )), + t) + for (var a = this.m_particleSystemList; a; a = a.m_next) + t.ShouldQueryParticleSystem(a) && a.RayCast(t, i, n) + } + , + e.prototype.RayCastOne = function(t, e) { + var i = null + , n = 1; + return this.RayCast(null, t, e, (function(t, e, r, s) { + return s < n && (n = s, + i = t), + n + } + )), + i + } + , + e.prototype.RayCastAll = function(t, e, i) { + return void 0 === i && (i = []), + this.RayCast(null, t, e, (function(t) { + return i.push(t), + 1 + } + )), + i + } + , + e.prototype.GetBodyList = function() { + return this.m_bodyList + } + , + e.prototype.GetJointList = function() { + return this.m_jointList + } + , + e.prototype.GetParticleSystemList = function() { + return this.m_particleSystemList + } + , + e.prototype.GetContactList = function() { + return this.m_contactManager.m_contactList + } + , + e.prototype.SetAllowSleeping = function(t) { + if (t !== this.m_allowSleep && (this.m_allowSleep = t, + !this.m_allowSleep)) + for (var e = this.m_bodyList; e; e = e.m_next) + e.SetAwake(!0) + } + , + e.prototype.GetAllowSleeping = function() { + return this.m_allowSleep + } + , + e.prototype.SetWarmStarting = function(t) { + this.m_warmStarting = t + } + , + e.prototype.GetWarmStarting = function() { + return this.m_warmStarting + } + , + e.prototype.SetContinuousPhysics = function(t) { + this.m_continuousPhysics = t + } + , + e.prototype.GetContinuousPhysics = function() { + return this.m_continuousPhysics + } + , + e.prototype.SetSubStepping = function(t) { + this.m_subStepping = t + } + , + e.prototype.GetSubStepping = function() { + return this.m_subStepping + } + , + e.prototype.GetProxyCount = function() { + return this.m_contactManager.m_broadPhase.GetProxyCount() + } + , + e.prototype.GetBodyCount = function() { + return this.m_bodyCount + } + , + e.prototype.GetJointCount = function() { + return this.m_jointCount + } + , + e.prototype.GetContactCount = function() { + return this.m_contactManager.m_contactCount + } + , + e.prototype.GetTreeHeight = function() { + return this.m_contactManager.m_broadPhase.GetTreeHeight() + } + , + e.prototype.GetTreeBalance = function() { + return this.m_contactManager.m_broadPhase.GetTreeBalance() + } + , + e.prototype.GetTreeQuality = function() { + return this.m_contactManager.m_broadPhase.GetTreeQuality() + } + , + e.prototype.SetGravity = function(t, e) { + if (void 0 === e && (e = !0), + !I.IsEqualToV(this.m_gravity, t) && (this.m_gravity.Copy(t), + e)) + for (var i = this.m_bodyList; i; i = i.m_next) + i.SetAwake(!0) + } + , + e.prototype.GetGravity = function() { + return this.m_gravity + } + , + e.prototype.IsLocked = function() { + return this.m_locked + } + , + e.prototype.SetAutoClearForces = function(t) { + this.m_clearForces = t + } + , + e.prototype.GetAutoClearForces = function() { + return this.m_clearForces + } + , + e.prototype.ShiftOrigin = function(t) { + if (this.IsLocked()) + throw new Error; + for (var e = this.m_bodyList; e; e = e.m_next) + e.m_xf.p.SelfSub(t), + e.m_sweep.c0.SelfSub(t), + e.m_sweep.c.SelfSub(t); + for (var i = this.m_jointList; i; i = i.m_next) + i.ShiftOrigin(t); + this.m_contactManager.m_broadPhase.ShiftOrigin(t) + } + , + e.prototype.GetContactManager = function() { + return this.m_contactManager + } + , + e.prototype.GetProfile = function() { + return this.m_profile + } + , + e.prototype.Dump = function(e) { + if (!this.m_locked) { + e("const g: b2Vec2 = new b2Vec2(%.15f, %.15f);\n", this.m_gravity.x, this.m_gravity.y), + e("this.m_world.SetGravity(g);\n"), + e("const bodies: b2Body[] = [];\n"), + e("const joints: b2Joint[] = [];\n"); + for (var i = 0, n = this.m_bodyList; n; n = n.m_next) + n.m_islandIndex = i, + n.Dump(e), + ++i; + i = 0; + for (var r = this.m_jointList; r; r = r.m_next) + r.m_index = i, + ++i; + for (r = this.m_jointList; r; r = r.m_next) + r.m_type !== t.b2JointType.e_gearJoint && (e("{\n"), + r.Dump(e), + e("}\n")); + for (r = this.m_jointList; r; r = r.m_next) + r.m_type === t.b2JointType.e_gearJoint && (e("{\n"), + r.Dump(e), + e("}\n")) + } + } + , + e.prototype.DrawJoint = function(i) { + if (null !== this.m_debugDraw) { + var n = i.GetBodyA() + , r = i.GetBodyB() + , s = n.m_xf + , a = r.m_xf + , o = s.p + , l = a.p + , h = i.GetAnchorA(e.DrawJoint_s_p1) + , c = i.GetAnchorB(e.DrawJoint_s_p2) + , u = e.DrawJoint_s_color.SetRGB(.5, .8, .8); + switch (i.m_type) { + case t.b2JointType.e_distanceJoint: + this.m_debugDraw.DrawSegment(h, c, u); + break; + case t.b2JointType.e_pulleyJoint: + var _ = i + , f = _.GetGroundAnchorA() + , d = _.GetGroundAnchorB(); + this.m_debugDraw.DrawSegment(f, h, u), + this.m_debugDraw.DrawSegment(d, c, u), + this.m_debugDraw.DrawSegment(f, d, u); + break; + case t.b2JointType.e_mouseJoint: + var p = e.DrawJoint_s_c; + p.Set(0, 1, 0), + this.m_debugDraw.DrawPoint(h, 4, p), + this.m_debugDraw.DrawPoint(c, 4, p), + p.Set(.8, .8, .8), + this.m_debugDraw.DrawSegment(h, c, p); + break; + default: + this.m_debugDraw.DrawSegment(o, h, u), + this.m_debugDraw.DrawSegment(h, c, u), + this.m_debugDraw.DrawSegment(l, c, u) + } + } + } + , + e.prototype.DrawShape = function(i, n) { + if (null !== this.m_debugDraw) { + var r = i.GetShape(); + switch (r.m_type) { + case t.b2ShapeType.e_circleShape: + var s = r + , a = s.m_p + , o = s.m_radius + , l = I.UNITX; + this.m_debugDraw.DrawSolidCircle(a, o, l, n); + break; + case t.b2ShapeType.e_edgeShape: + var h = r + , c = h.m_vertex1 + , u = h.m_vertex2; + this.m_debugDraw.DrawSegment(c, u, n); + break; + case t.b2ShapeType.e_chainShape: + var _ = r + , f = _.m_count + , d = _.m_vertices + , p = e.DrawShape_s_ghostColor.SetRGBA(.75 * n.r, .75 * n.g, .75 * n.b, n.a); + if (c = d[0], + this.m_debugDraw.DrawPoint(c, 4, n), + _.m_hasPrevVertex) { + var m = _.m_prevVertex; + this.m_debugDraw.DrawSegment(m, c, p), + this.m_debugDraw.DrawCircle(m, .1, p) + } + for (var y = 1; y < f; ++y) + u = d[y], + this.m_debugDraw.DrawSegment(c, u, n), + this.m_debugDraw.DrawPoint(u, 4, n), + c = u; + if (_.m_hasNextVertex) { + var v = _.m_nextVertex; + this.m_debugDraw.DrawSegment(v, c, p), + this.m_debugDraw.DrawCircle(v, .1, p) + } + break; + case t.b2ShapeType.e_polygonShape: + var g = r + , A = g.m_count; + d = g.m_vertices, + this.m_debugDraw.DrawSolidPolygon(d, A, n) + } + } + } + , + e.prototype.Solve = function(e) { + for (var i = this.m_bodyList; i; i = i.m_next) + i.m_xf0.Copy(i.m_xf); + for (var n = this.m_controllerList; n; n = n.m_next) + n.Step(e); + this.m_profile.solveInit = 0, + this.m_profile.solveVelocity = 0, + this.m_profile.solvePosition = 0; + var r = this.m_island; + for (r.Initialize(this.m_bodyCount, this.m_contactManager.m_contactCount, this.m_jointCount, null, this.m_contactManager.m_contactListener), + i = this.m_bodyList; i; i = i.m_next) + i.m_islandFlag = !1; + for (var s = this.m_contactManager.m_contactList; s; s = s.m_next) + s.m_islandFlag = !1; + for (var a = this.m_jointList; a; a = a.m_next) + a.m_islandFlag = !1; + for (var o = this.s_stack, l = this.m_bodyList; l; l = l.m_next) + if (!l.m_islandFlag && l.IsAwake() && l.IsActive() && l.GetType() !== t.b2BodyType.b2_staticBody) { + r.Clear(); + var h = 0; + for (o[h++] = l, + l.m_islandFlag = !0; h > 0; ) { + if (!(i = o[--h])) + throw new Error; + if (r.AddBody(i), + i.m_awakeFlag = !0, + i.GetType() !== t.b2BodyType.b2_staticBody) { + for (var c = i.m_contactList; c; c = c.next) { + var u = c.contact; + if (!u.m_islandFlag && u.IsEnabled() && u.IsTouching()) { + var _ = u.m_fixtureA.m_isSensor + , f = u.m_fixtureB.m_isSensor; + if (!_ && !f) { + if (r.AddContact(u), + u.m_islandFlag = !0, + !(p = c.other)) + throw new Error; + p.m_islandFlag || (o[h++] = p, + p.m_islandFlag = !0) + } + } + } + for (var d = i.m_jointList; d; d = d.next) { + var p; + d.joint.m_islandFlag || (p = d.other).IsActive() && (r.AddJoint(d.joint), + d.joint.m_islandFlag = !0, + p.m_islandFlag || (o[h++] = p, + p.m_islandFlag = !0)) + } + } + } + var m = new hn; + r.Solve(m, e, this.m_gravity, this.m_allowSleep), + this.m_profile.solveInit += m.solveInit, + this.m_profile.solveVelocity += m.solveVelocity, + this.m_profile.solvePosition += m.solvePosition; + for (var y = 0; y < r.m_bodyCount; ++y) + (i = r.m_bodies[y]).GetType() === t.b2BodyType.b2_staticBody && (i.m_islandFlag = !1) + } + for (y = 0; y < o.length && o[y]; ++y) + o[y] = null; + var v = new U; + for (i = this.m_bodyList; i; i = i.m_next) + i.m_islandFlag && i.GetType() !== t.b2BodyType.b2_staticBody && i.SynchronizeFixtures(); + this.m_contactManager.FindNewContacts(), + this.m_profile.broadphase = v.GetMilliseconds() + } + , + e.prototype.SolveTOI = function(i) { + var r = this.m_island; + if (r.Initialize(64, 32, 0, null, this.m_contactManager.m_contactListener), + this.m_stepComplete) { + for (var s = this.m_bodyList; s; s = s.m_next) + s.m_islandFlag = !1, + s.m_sweep.alpha0 = 0; + for (var a = this.m_contactManager.m_contactList; a; a = a.m_next) + a.m_toiFlag = !1, + a.m_islandFlag = !1, + a.m_toiCount = 0, + a.m_toi = 1 + } + for (; ; ) { + var o = null + , l = 1; + for (a = this.m_contactManager.m_contactList; a; a = a.m_next) + if (a.IsEnabled() && !(a.m_toiCount > 8)) { + var h = 1; + if (a.m_toiFlag) + h = a.m_toi; + else { + var c = a.GetFixtureA() + , u = a.GetFixtureB(); + if (c.IsSensor() || u.IsSensor()) + continue; + var _ = c.GetBody() + , f = u.GetBody() + , d = _.m_type + , p = f.m_type + , m = _.IsAwake() && d !== t.b2BodyType.b2_staticBody + , v = f.IsAwake() && p !== t.b2BodyType.b2_staticBody; + if (!m && !v) + continue; + var g = _.IsBullet() || d !== t.b2BodyType.b2_dynamicBody + , A = f.IsBullet() || p !== t.b2BodyType.b2_dynamicBody; + if (!g && !A) + continue; + var x = _.m_sweep.alpha0; + _.m_sweep.alpha0 < f.m_sweep.alpha0 ? (x = f.m_sweep.alpha0, + _.m_sweep.Advance(x)) : f.m_sweep.alpha0 < _.m_sweep.alpha0 && (x = _.m_sweep.alpha0, + f.m_sweep.Advance(x)); + var b = a.GetChildIndexA() + , C = a.GetChildIndexB() + , T = e.SolveTOI_s_toi_input; + T.proxyA.SetShape(c.GetShape(), b), + T.proxyB.SetShape(u.GetShape(), C), + T.sweepA.Copy(_.m_sweep), + T.sweepB.Copy(f.m_sweep), + T.tMax = 1; + var S = e.SolveTOI_s_toi_output; + re(S, T); + var w = S.t; + h = S.state === t.b2TOIOutputState.e_touching ? y(x + (1 - x) * w, 1) : 1, + a.m_toi = h, + a.m_toiFlag = !0 + } + h < l && (o = a, + l = h) + } + if (null === o || 1 - 10 * n < l) { + this.m_stepComplete = !0; + break + } + var E = o.GetFixtureA() + , M = o.GetFixtureB() + , D = E.GetBody() + , B = M.GetBody() + , I = e.SolveTOI_s_backup1.Copy(D.m_sweep) + , P = e.SolveTOI_s_backup2.Copy(B.m_sweep); + if (D.Advance(l), + B.Advance(l), + o.Update(this.m_contactManager.m_contactListener), + o.m_toiFlag = !1, + ++o.m_toiCount, + o.IsEnabled() && o.IsTouching()) { + D.SetAwake(!0), + B.SetAwake(!0), + r.Clear(), + r.AddBody(D), + r.AddBody(B), + r.AddContact(o), + D.m_islandFlag = !0, + B.m_islandFlag = !0, + o.m_islandFlag = !0; + for (var R = 0; R < 2; ++R) + if ((U = 0 === R ? D : B).m_type === t.b2BodyType.b2_dynamicBody) + for (var O = U.m_contactList; O && r.m_bodyCount !== r.m_bodyCapacity && r.m_contactCount !== r.m_contactCapacity; O = O.next) { + var L = O.contact; + if (!L.m_islandFlag) { + var F = O.other; + if (F.m_type !== t.b2BodyType.b2_dynamicBody || U.IsBullet() || F.IsBullet()) { + var V = L.m_fixtureA.m_isSensor + , N = L.m_fixtureB.m_isSensor; + if (!V && !N) { + var k = e.SolveTOI_s_backup.Copy(F.m_sweep); + F.m_islandFlag || F.Advance(l), + L.Update(this.m_contactManager.m_contactListener), + L.IsEnabled() && L.IsTouching() ? (L.m_islandFlag = !0, + r.AddContact(L), + F.m_islandFlag || (F.m_islandFlag = !0, + F.m_type !== t.b2BodyType.b2_staticBody && F.SetAwake(!0), + r.AddBody(F))) : (F.m_sweep.Copy(k), + F.SynchronizeTransform()) + } + } + } + } + var G = e.SolveTOI_s_subStep; + for (G.dt = (1 - l) * i.dt, + G.inv_dt = 1 / G.dt, + G.dtRatio = 1, + G.positionIterations = 20, + G.velocityIterations = i.velocityIterations, + G.particleIterations = i.particleIterations, + G.warmStarting = !1, + r.SolveTOI(G, D.m_islandIndex, B.m_islandIndex), + R = 0; R < r.m_bodyCount; ++R) { + var U; + if ((U = r.m_bodies[R]).m_islandFlag = !1, + U.m_type === t.b2BodyType.b2_dynamicBody) + for (U.SynchronizeFixtures(), + O = U.m_contactList; O; O = O.next) + O.contact.m_toiFlag = !1, + O.contact.m_islandFlag = !1 + } + if (this.m_contactManager.FindNewContacts(), + this.m_subStepping) { + this.m_stepComplete = !1; + break + } + } else + o.SetEnabled(!1), + D.m_sweep.Copy(I), + B.m_sweep.Copy(P), + D.SynchronizeTransform(), + B.SynchronizeTransform() + } + } + , + e.prototype.AddController = function(t) { + return t.m_next = this.m_controllerList, + t.m_prev = null, + this.m_controllerList && (this.m_controllerList.m_prev = t), + this.m_controllerList = t, + ++this.m_controllerCount, + t + } + , + e.prototype.RemoveController = function(t) { + return t.m_prev && (t.m_prev.m_next = t.m_next), + t.m_next && (t.m_next.m_prev = t.m_prev), + this.m_controllerList === t && (this.m_controllerList = t.m_next), + --this.m_controllerCount, + t.m_prev = null, + t.m_next = null, + t + } + , + e.Step_s_step = new cn, + e.Step_s_stepTimer = new U, + e.Step_s_timer = new U, + e.DrawDebugData_s_color = new k(0,0,0), + e.DrawDebugData_s_vs = I.MakeArray(4), + e.DrawDebugData_s_xf = new V, + e.QueryFixtureShape_s_aabb = new Tt, + e.RayCast_s_input = new bt, + e.RayCast_s_output = new Ct, + e.RayCast_s_point = new I, + e.DrawJoint_s_p1 = new I, + e.DrawJoint_s_p2 = new I, + e.DrawJoint_s_color = new k(.5,.8,.8), + e.DrawJoint_s_c = new k, + e.DrawShape_s_ghostColor = new k, + e.SolveTOI_s_subStep = new cn, + e.SolveTOI_s_backup = new N, + e.SolveTOI_s_backup1 = new N, + e.SolveTOI_s_backup2 = new N, + e.SolveTOI_s_toi_input = new jt, + e.SolveTOI_s_toi_output = new Yt, + e + } + )() + , Xn = function(t, e) { + this.prevBody = null, + this.nextBody = null, + this.prevController = null, + this.nextController = null, + this.controller = t, + this.body = e + } + , Yn = (function() { + function t() { + this.m_bodyList = null, + this.m_bodyCount = 0, + this.m_prev = null, + this.m_next = null + } + return t.prototype.GetNext = function() { + return this.m_next + } + , + t.prototype.GetPrev = function() { + return this.m_prev + } + , + t.prototype.GetBodyList = function() { + return this.m_bodyList + } + , + t.prototype.AddBody = function(t) { + var e = new Xn(this,t); + e.nextBody = this.m_bodyList, + e.prevBody = null, + this.m_bodyList && (this.m_bodyList.prevBody = e), + this.m_bodyList = e, + ++this.m_bodyCount, + e.nextController = t.m_controllerList, + e.prevController = null, + t.m_controllerList && (t.m_controllerList.prevController = e), + t.m_controllerList = e, + ++t.m_controllerCount + } + , + t.prototype.RemoveBody = function(t) { + if (this.m_bodyCount <= 0) + throw new Error; + for (var e = this.m_bodyList; e && e.body !== t; ) + e = e.nextBody; + if (null === e) + throw new Error; + e.prevBody && (e.prevBody.nextBody = e.nextBody), + e.nextBody && (e.nextBody.prevBody = e.prevBody), + this.m_bodyList === e && (this.m_bodyList = e.nextBody), + --this.m_bodyCount, + e.nextController && (e.nextController.prevController = e.prevController), + e.prevController && (e.prevController.nextController = e.nextController), + t.m_controllerList === e && (t.m_controllerList = e.nextController), + --t.m_controllerCount + } + , + t.prototype.Clear = function() { + for (; this.m_bodyList; ) + this.RemoveBody(this.m_bodyList.body); + this.m_bodyCount = 0 + } + , + t + } + )() + , qn = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.normal = new I(0,1), + e.offset = 0, + e.density = 0, + e.velocity = new I(0,0), + e.linearDrag = 0, + e.angularDrag = 0, + e.useDensity = !1, + e.useWorldGravity = !0, + e.gravity = new I(0,0), + e + } + return ti(e, t), + e.prototype.Step = function() { + if (this.m_bodyList) { + this.useWorldGravity && this.gravity.Copy(this.m_bodyList.body.GetWorld().GetGravity()); + for (var t = this.m_bodyList; t; t = t.nextBody) { + var e = t.body; + if (e.IsAwake()) { + for (var i = new I, r = new I, s = 0, a = 0, o = e.GetFixtureList(); o; o = o.m_next) { + var l = new I + , h = o.GetShape().ComputeSubmergedArea(this.normal, this.offset, e.GetTransform(), l); + s += h, + i.x += h * l.x, + i.y += h * l.y; + var c; + a += h * (c = this.useDensity ? o.GetDensity() : 1), + r.x += h * l.x * c, + r.y += h * l.y * c + } + if (i.x /= s, + i.y /= s, + r.x /= a, + r.y /= a, + !(s < n)) { + var u = this.gravity.Clone().SelfNeg(); + u.SelfMul(this.density * s), + e.ApplyForce(u, r); + var _ = e.GetLinearVelocityFromWorldPoint(i, new I); + _.SelfSub(this.velocity), + _.SelfMul(-this.linearDrag * s), + e.ApplyForce(_, i), + e.ApplyTorque(-e.GetInertia() / e.GetMass() * s * e.GetAngularVelocity() * this.angularDrag) + } + } + } + } + } + , + e.prototype.Draw = function(t) { + var e = 100 + , i = new I + , n = new I; + i.x = this.normal.x * this.offset + this.normal.y * e, + i.y = this.normal.y * this.offset - this.normal.x * e, + n.x = this.normal.x * this.offset - this.normal.y * e, + n.y = this.normal.y * this.offset + this.normal.x * e; + var r = new k(0,0,.8); + t.DrawSegment(i, n, r) + } + , + e + } + )(Yn) + , Jn = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.A = new I(0,0), + e + } + return ti(e, t), + e.prototype.Step = function(t) { + for (var i = I.MulSV(t.dt, this.A, e.Step_s_dtA), n = this.m_bodyList; n; n = n.nextBody) { + var r = n.body; + r.IsAwake() && r.SetLinearVelocity(I.AddVV(r.GetLinearVelocity(), i, I.s_t0)) + } + } + , + e.prototype.Draw = function() {} + , + e.Step_s_dtA = new I, + e + } + )(Yn) + , Zn = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.F = new I(0,0), + e + } + return ti(e, t), + e.prototype.Step = function() { + for (var t = this.m_bodyList; t; t = t.nextBody) { + var e = t.body; + e.IsAwake() && e.ApplyForce(this.F, e.GetWorldCenter()) + } + } + , + e.prototype.Draw = function() {} + , + e + } + )(Yn) + , Kn = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.G = 1, + e.invSqr = !0, + e + } + return ti(e, t), + e.prototype.Step = function() { + if (this.invSqr) + for (var t = this.m_bodyList; t; t = t.nextBody) + for (var i = (l = t.body).GetWorldCenter(), r = l.GetMass(), s = this.m_bodyList; s && s !== t; s = s.nextBody) { + var a = (h = s.body).GetWorldCenter() + , o = h.GetMass(); + (_ = (c = a.x - i.x) * c + (u = a.y - i.y) * u) < n || ((f = e.Step_s_f.Set(c, u)).SelfMul(this.G / _ / T(_) * r * o), + l.IsAwake() && l.ApplyForce(f, i), + h.IsAwake() && h.ApplyForce(f.SelfMul(-1), a)) + } + else + for (t = this.m_bodyList; t; t = t.nextBody) { + var l; + for (i = (l = t.body).GetWorldCenter(), + r = l.GetMass(), + s = this.m_bodyList; s && s !== t; s = s.nextBody) { + var h, c, u, _, f; + a = (h = s.body).GetWorldCenter(), + o = h.GetMass(), + (_ = (c = a.x - i.x) * c + (u = a.y - i.y) * u) < n || ((f = e.Step_s_f.Set(c, u)).SelfMul(this.G / _ * r * o), + l.IsAwake() && l.ApplyForce(f, i), + h.IsAwake() && h.ApplyForce(f.SelfMul(-1), a)) + } + } + } + , + e.prototype.Draw = function() {} + , + e.Step_s_f = new I, + e + } + )(Yn) + , Qn = (function(t) { + function e() { + var e = null !== t && t.apply(this, arguments) || this; + return e.T = new O, + e.maxTimestep = 0, + e + } + return ti(e, t), + e.prototype.Step = function(t) { + var i = t.dt; + if (!(i <= n)) { + i > this.maxTimestep && this.maxTimestep > 0 && (i = this.maxTimestep); + for (var r = this.m_bodyList; r; r = r.nextBody) { + var s = r.body; + if (s.IsAwake()) { + var a = s.GetWorldVector(O.MulMV(this.T, s.GetLocalVector(s.GetLinearVelocity(), I.s_t0), I.s_t1), e.Step_s_damping); + s.SetLinearVelocity(I.AddVV(s.GetLinearVelocity(), I.MulSV(i, a, I.s_t0), I.s_t1)) + } + } + } + } + , + e.prototype.Draw = function() {} + , + e.prototype.SetAxisAligned = function(t, e) { + this.T.ex.x = -t, + this.T.ex.y = 0, + this.T.ey.x = 0, + this.T.ey.y = -e, + this.maxTimestep = t > 0 || e > 0 ? 1 / v(t, e) : 0 + } + , + e.Step_s_damping = new I, + e + } + )(Yn) + , $n = (function() { + function t() { + this.m_count = 0, + this.m_ps = [], + this.m_p0s = [], + this.m_vs = [], + this.m_ims = [], + this.m_Ls = [], + this.m_as = [], + this.m_gravity = new I, + this.m_damping = 0, + this.m_k2 = 1, + this.m_k3 = .1 + } + return t.prototype.GetVertexCount = function() { + return this.m_count + } + , + t.prototype.GetVertices = function() { + return this.m_ps + } + , + t.prototype.Initialize = function(t) { + this.m_count = t.count, + this.m_ps = I.MakeArray(this.m_count), + this.m_p0s = I.MakeArray(this.m_count), + this.m_vs = I.MakeArray(this.m_count), + this.m_ims = p(this.m_count); + for (var e = 0; e < this.m_count; ++e) { + this.m_ps[e].Copy(t.vertices[e]), + this.m_p0s[e].Copy(t.vertices[e]), + this.m_vs[e].SetZero(); + var i = t.masses[e]; + this.m_ims[e] = i > 0 ? 1 / i : 0 + } + var n = this.m_count - 1 + , r = this.m_count - 2; + for (this.m_Ls = p(n), + this.m_as = p(r), + e = 0; e < n; ++e) { + var s = this.m_ps[e] + , a = this.m_ps[e + 1]; + this.m_Ls[e] = I.DistanceVV(s, a) + } + for (e = 0; e < r; ++e) { + s = this.m_ps[e], + a = this.m_ps[e + 1]; + var o = this.m_ps[e + 2] + , l = I.SubVV(a, s, I.s_t0) + , h = I.SubVV(o, a, I.s_t1) + , c = I.CrossVV(l, h) + , u = I.DotVV(l, h); + this.m_as[e] = B(c, u) + } + this.m_gravity.Copy(t.gravity), + this.m_damping = t.damping, + this.m_k2 = t.k2, + this.m_k3 = t.k3 + } + , + t.prototype.Step = function(t, e) { + if (0 !== t) { + for (var i = Math.exp(-t * this.m_damping), n = 0; n < this.m_count; ++n) + this.m_p0s[n].Copy(this.m_ps[n]), + this.m_ims[n] > 0 && this.m_vs[n].SelfMulAdd(t, this.m_gravity), + this.m_vs[n].SelfMul(i), + this.m_ps[n].SelfMulAdd(t, this.m_vs[n]); + for (n = 0; n < e; ++n) + this.SolveC2(), + this.SolveC3(), + this.SolveC2(); + var r = 1 / t; + for (n = 0; n < this.m_count; ++n) + I.MulSV(r, I.SubVV(this.m_ps[n], this.m_p0s[n], I.s_t0), this.m_vs[n]) + } + } + , + t.prototype.SolveC2 = function() { + for (var e = this.m_count - 1, i = 0; i < e; ++i) { + var n = this.m_ps[i] + , r = this.m_ps[i + 1] + , s = I.SubVV(r, n, t.s_d) + , a = s.Normalize() + , o = this.m_ims[i] + , l = this.m_ims[i + 1]; + if (o + l !== 0) { + var h = o / (o + l) + , c = l / (o + l); + n.SelfMulSub(this.m_k2 * h * (this.m_Ls[i] - a), s), + r.SelfMulAdd(this.m_k2 * c * (this.m_Ls[i] - a), s) + } + } + } + , + t.prototype.SetAngle = function(t) { + for (var e = this.m_count - 2, i = 0; i < e; ++i) + this.m_as[i] = t + } + , + t.prototype.SolveC3 = function() { + for (var e = this.m_count - 2, i = 0; i < e; ++i) { + var n = this.m_ps[i] + , r = this.m_ps[i + 1] + , a = this.m_ps[i + 2] + , o = this.m_ims[i] + , l = this.m_ims[i + 1] + , h = this.m_ims[i + 2] + , c = I.SubVV(r, n, t.s_d1) + , u = I.SubVV(a, r, t.s_d2) + , _ = c.LengthSquared() + , f = u.LengthSquared(); + if (_ * f != 0) { + var d = I.CrossVV(c, u) + , p = I.DotVV(c, u) + , m = B(d, p) + , y = I.MulSV(-1 / _, c.SelfSkew(), t.s_Jd1) + , v = I.MulSV(1 / f, u.SelfSkew(), t.s_Jd2) + , g = I.NegV(y, t.s_J1) + , A = I.SubVV(y, v, t.s_J2) + , x = v + , b = o * I.DotVV(g, g) + l * I.DotVV(A, A) + h * I.DotVV(x, x); + if (0 !== b) { + b = 1 / b; + for (var C = m - this.m_as[i]; C > s; ) + C = (m -= 2 * s) - this.m_as[i]; + for (; C < -s; ) + C = (m += 2 * s) - this.m_as[i]; + var T = -this.m_k3 * b * C; + n.SelfMulAdd(o * T, g), + r.SelfMulAdd(l * T, A), + a.SelfMulAdd(h * T, x) + } + } + } + } + , + t.prototype.Draw = function(t) { + for (var e = new k(.4,.5,.7), i = 0; i < this.m_count - 1; ++i) + t.DrawSegment(this.m_ps[i], this.m_ps[i + 1], e) + } + , + t.s_d = new I, + t.s_d1 = new I, + t.s_d2 = new I, + t.s_Jd1 = new I, + t.s_Jd2 = new I, + t.s_J1 = new I, + t.s_J2 = new I, + t + } + )(); + t.b2Assert = function(t) { + for (var e = [], i = 1; i < arguments.length; i++) + e[i - 1] = arguments[i]; + if (!t) + throw new (Error.bind.apply(Error, [void 0].concat(e))) + } + , + t.b2Maybe = e, + t.b2_maxFloat = i, + t.b2_epsilon = n, + t.b2_epsilon_sq = r, + t.b2_pi = s, + t.b2_maxManifoldPoints = a, + t.b2_maxPolygonVertices = o, + t.b2_aabbExtension = .1, + t.b2_aabbMultiplier = 2, + t.b2_linearSlop = l, + t.b2_angularSlop = h, + t.b2_polygonRadius = c, + t.b2_maxSubSteps = 8, + t.b2_maxTOIContacts = 32, + t.b2_velocityThreshold = 1, + t.b2_maxLinearCorrection = .2, + t.b2_maxAngularCorrection = .13962634015955555, + t.b2_maxTranslation = 2, + t.b2_maxTranslationSquared = 4, + t.b2_maxRotation = 1.570796326795, + t.b2_maxRotationSquared = 2.4674011002726646, + t.b2_baumgarte = .2, + t.b2_toiBaumgarte = .75, + t.b2_invalidParticleIndex = u, + t.b2_maxParticleIndex = 2147483647, + t.b2_particleStride = .75, + t.b2_minParticleWeight = 1, + t.b2_maxParticlePressure = .25, + t.b2_maxParticleForce = .5, + t.b2_maxTriadDistance = 2, + t.b2_maxTriadDistanceSquared = 4, + t.b2_minParticleSystemBufferCapacity = 256, + t.b2_barrierCollisionTime = 2.5, + t.b2_timeToSleep = .5, + t.b2_linearSleepTolerance = .01, + t.b2_angularSleepTolerance = .03490658503988889, + t.b2Alloc = function() { + return null + } + , + t.b2Free = function() {} + , + t.b2Log = function(t) { + for (var e = [], i = 1; i < arguments.length; i++) + e[i - 1] = arguments[i] + } + , + t.b2Version = _, + t.b2_version = f, + t.b2_branch = "master", + t.b2_commit = "fbf51801d80fc389d43dc46524520e89043b6faf", + t.b2ParseInt = function(t) { + return parseInt(t, 10) + } + , + t.b2ParseUInt = function(t) { + return Math.abs(parseInt(t, 10)) + } + , + t.b2MakeArray = d, + t.b2MakeNullArray = function(t) { + for (var e = [], i = 0; i < t; ++i) + e.push(null); + return e + } + , + t.b2MakeNumberArray = p, + t.b2_pi_over_180 = .017453292519944444, + t.b2_180_over_pi = 57.29577951307855, + t.b2_two_pi = 6.28318530718, + t.b2Abs = m, + t.b2Min = y, + t.b2Max = v, + t.b2Clamp = g, + t.b2Swap = function(t, e) { + var i = t[0]; + t[0] = e[0], + e[0] = i + } + , + t.b2IsValid = A, + t.b2Sq = x, + t.b2InvSqrt = b, + t.b2Sqrt = T, + t.b2Pow = S, + t.b2DegToRad = function(t) { + return .017453292519944444 * t + } + , + t.b2RadToDeg = function(t) { + return 57.29577951307855 * t + } + , + t.b2Cos = w, + t.b2Sin = E, + t.b2Acos = M, + t.b2Asin = D, + t.b2Atan2 = B, + t.b2NextPowerOfTwo = function(t) { + return t |= t >> 1 & 2147483647, + t |= t >> 2 & 1073741823, + t |= t >> 4 & 268435455, + 1 + ((t |= t >> 8 & 16777215) | t >> 16 & 65535) + } + , + t.b2IsPowerOfTwo = function(t) { + return t > 0 && 0 == (t & t - 1) + } + , + t.b2Random = function() { + return 2 * Math.random() - 1 + } + , + t.b2RandomRange = function(t, e) { + return (e - t) * Math.random() + t + } + , + t.b2Vec2 = I, + t.b2Vec2_zero = P, + t.b2Vec3 = R, + t.b2Mat22 = O, + t.b2Mat33 = L, + t.b2Rot = F, + t.b2Transform = V, + t.b2Sweep = N, + t.b2Color = k, + t.b2Draw = G, + t.b2Timer = U, + t.b2Counter = z, + t.b2GrowableStack = H, + t.b2BlockAllocator = function() {} + , + t.b2StackAllocator = function() {} + , + t.b2ContactFeature = pt, + t.b2ContactID = mt, + t.b2ManifoldPoint = yt, + t.b2Manifold = gt, + t.b2WorldManifold = At, + t.b2GetPointStates = function(e, i, n, r) { + var s; + for (s = 0; s < n.pointCount; ++s) { + var o = n.points[s].id.key; + e[s] = t.b2PointState.b2_removeState; + for (var l = 0, h = r.pointCount; l < h; ++l) + if (r.points[l].id.key === o) { + e[s] = t.b2PointState.b2_persistState; + break + } + } + for (; s < a; ++s) + e[s] = t.b2PointState.b2_nullState; + for (s = 0; s < r.pointCount; ++s) + for (o = r.points[s].id.key, + i[s] = t.b2PointState.b2_addState, + l = 0, + h = n.pointCount; l < h; ++l) + if (n.points[l].id.key === o) { + i[s] = t.b2PointState.b2_persistState; + break + } + for (; s < a; ++s) + i[s] = t.b2PointState.b2_nullState + } + , + t.b2ClipVertex = xt, + t.b2RayCastInput = bt, + t.b2RayCastOutput = Ct, + t.b2AABB = Tt, + t.b2TestOverlapAABB = St, + t.b2ClipSegmentToLine = wt, + t.b2TestOverlapShape = Bt, + t.b2DistanceProxy = W, + t.b2SimplexCache = j, + t.b2DistanceInput = X, + t.b2DistanceOutput = Y, + t.b2ShapeCastInput = function() { + this.proxyA = new W, + this.proxyB = new W, + this.transformA = new V, + this.transformB = new V, + this.translationB = new I + } + , + t.b2ShapeCastOutput = function() { + this.point = new I, + this.normal = new I, + this.lambda = 0, + this.iterations = 0 + } + , + t.b2_gjk_reset = function() { + t.b2_gjkCalls = 0, + t.b2_gjkIters = 0, + t.b2_gjkMaxIters = 0 + } + , + t.b2SimplexVertex = q, + t.b2Simplex = J, + t.b2Distance = rt, + t.b2ShapeCast = function(t, e) { + t.iterations = 0, + t.lambda = 1, + t.normal.SetZero(), + t.point.SetZero(); + var i = e.proxyA + , n = e.proxyB + , r = v(i.m_radius, c) + v(n.m_radius, c) + , s = e.transformA + , a = e.transformB + , o = e.translationB + , h = at.Set(0, 0) + , u = 0 + , _ = ot; + _.m_count = 0; + for (var f = _.m_vertices, d = i.GetSupport(F.MulTRV(s.q, I.NegV(o, I.s_t1), I.s_t0)), p = V.MulXV(s, i.GetVertex(d), lt), y = n.GetSupport(F.MulTRV(a.q, o, I.s_t0)), g = V.MulXV(a, n.GetVertex(y), ht), A = I.SubVV(p, g, ct), x = v(c, r - c), b = .5 * l, C = 0; C < 20 && m(A.Length() - x) > b; ) { + t.iterations += 1, + d = i.GetSupport(F.MulTRV(s.q, I.NegV(A, I.s_t1), I.s_t0)), + p = V.MulXV(s, i.GetVertex(d), lt), + y = n.GetSupport(F.MulTRV(a.q, A, I.s_t0)), + g = V.MulXV(a, n.GetVertex(y), ht); + var T = I.SubVV(p, g, ut); + A.Normalize(); + var S = I.DotVV(A, T) + , w = I.DotVV(A, o); + if (S - x > u * w) { + if (w <= 0) + return !1; + if ((u = (S - x) / w) > 1) + return !1; + h.Copy(A).SelfNeg(), + _.m_count = 0 + } + var E = f[_.m_count]; + switch (E.indexA = y, + E.wA.Copy(g).SelfMulAdd(u, o), + E.indexB = d, + E.wB.Copy(p), + E.w.Copy(E.wB).SelfSub(E.wA), + E.a = 1, + _.m_count += 1, + _.m_count) { + case 1: + break; + case 2: + _.Solve2(); + break; + case 3: + _.Solve3() + } + if (3 === _.m_count) + return !1; + _.GetClosestPoint(A), + ++C + } + var M = _t + , D = ft; + return _.GetWitnessPoints(M, D), + A.LengthSquared() > 0 && (h.Copy(A).SelfNeg(), + h.Normalize()), + t.normal.Copy(h), + t.lambda = u, + t.iterations = C, + !0 + } + , + t.b2Pair = Ot, + t.b2BroadPhase = Lt, + t.b2PairLessThan = Ft, + t.b2TreeNode = Pt, + t.b2DynamicTree = Rt, + t.b2_toi_reset = function() { + t.b2_toiTime = 0, + t.b2_toiMaxTime = 0, + t.b2_toiCalls = 0, + t.b2_toiIters = 0, + t.b2_toiMaxIters = 0, + t.b2_toiRootIters = 0, + t.b2_toiMaxRootIters = 0 + } + , + t.b2TOIInput = jt, + t.b2TOIOutput = Yt, + t.b2SeparationFunction = qt, + t.b2TimeOfImpact = re, + t.b2CollideCircles = oe, + t.b2CollidePolygonAndCircle = ue, + t.b2CollidePolygons = Le, + t.b2CollideEdgeAndCircle = We, + t.b2CollideEdgeAndPolygon = Je, + t.b2MassData = Ke, + t.b2Shape = Qe, + t.b2CircleShape = ii, + t.b2PolygonShape = ni, + t.b2EdgeShape = ri, + t.b2ChainShape = si, + t.b2Filter = ai, + t.b2FixtureDef = oi, + t.b2FixtureProxy = li, + t.b2Fixture = hi, + t.b2BodyDef = function() { + this.type = t.b2BodyType.b2_staticBody, + this.position = new I(0,0), + this.angle = 0, + this.linearVelocity = new I(0,0), + this.angularVelocity = 0, + this.linearDamping = 0, + this.angularDamping = 0, + this.allowSleep = !0, + this.awake = !0, + this.fixedRotation = !1, + this.bullet = !1, + this.active = !0, + this.userData = null, + this.gravityScale = 1 + } + , + t.b2Body = _i, + t.b2World = jn, + t.b2DestructionListener = en, + t.b2ContactFilter = nn, + t.b2ContactImpulse = rn, + t.b2ContactListener = sn, + t.b2QueryCallback = an, + t.b2RayCastCallback = on, + t.b2Island = An, + t.b2Profile = hn, + t.b2TimeStep = cn, + t.b2Position = un, + t.b2Velocity = _n, + t.b2SolverData = fn, + t.b2ContactManager = ln, + t.b2MixFriction = Ui, + t.b2MixRestitution = zi, + t.b2ContactEdge = Wi, + t.b2Contact = ji, + t.b2ContactRegister = $i, + t.b2ContactFactory = tn, + t.g_blockSolve = !1, + t.b2VelocityConstraintPoint = dn, + t.b2ContactVelocityConstraint = pn, + t.b2ContactPositionConstraint = mn, + t.b2ContactSolverDef = yn, + t.b2PositionSolverManifold = vn, + t.b2ContactSolver = gn, + t.b2CircleContact = Xi, + t.b2PolygonContact = Yi, + t.b2PolygonAndCircleContact = qi, + t.b2EdgeAndCircleContact = Ji, + t.b2EdgeAndPolygonContact = Zi, + t.b2ChainAndCircleContact = Ki, + t.b2ChainAndPolygonContact = Qi, + t.b2Jacobian = fi, + t.b2JointEdge = di, + t.b2JointDef = pi, + t.b2Joint = mi, + t.b2AreaJointDef = gi, + t.b2AreaJoint = Ai, + t.b2DistanceJointDef = yi, + t.b2DistanceJoint = vi, + t.b2FrictionJointDef = xi, + t.b2FrictionJoint = bi, + t.b2GearJointDef = Ci, + t.b2GearJoint = Ti, + t.b2MotorJointDef = Si, + t.b2MotorJoint = wi, + t.b2MouseJointDef = Ei, + t.b2MouseJoint = Mi, + t.b2PrismaticJointDef = Di, + t.b2PrismaticJoint = Bi, + t.b2_minPulleyLength = 2, + t.b2PulleyJointDef = Ii, + t.b2PulleyJoint = Pi, + t.b2RevoluteJointDef = Ri, + t.b2RevoluteJoint = Oi, + t.b2RopeJointDef = Li, + t.b2RopeJoint = Fi, + t.b2WeldJointDef = Vi, + t.b2WeldJoint = Ni, + t.b2WheelJointDef = ki, + t.b2WheelJoint = Gi, + t.b2ControllerEdge = Xn, + t.b2Controller = Yn, + t.b2BuoyancyController = qn, + t.b2ConstantAccelController = Jn, + t.b2ConstantForceController = Zn, + t.b2GravityController = Kn, + t.b2TensorDampingController = Qn, + t.b2ParticleDef = xn, + t.b2CalculateParticleIterations = bn, + t.b2ParticleHandle = Tn, + t.b2ParticleGroupDef = Sn, + t.b2ParticleGroup = wn, + t.b2GrowableBuffer = Nn, + t.b2FixtureParticleQueryCallback = kn, + t.b2ParticleContact = Gn, + t.b2ParticleBodyContact = Un, + t.b2ParticlePair = zn, + t.b2ParticleTriad = Hn, + t.b2ParticleSystemDef = Wn, + t.b2RopeDef = function() { + this.vertices = [], + this.count = 0, + this.masses = [], + this.gravity = new I(0,0), + this.damping = .1, + this.k2 = .9, + this.k3 = .1 + } + , + t.b2Rope = $n, + Object.defineProperty(t, "__esModule", { + value: !0 + }) + } + , + "object" == typeof i && void 0 !== e ? n(i) : "function" == typeof define && define.amd ? define(["exports"], n) : n((void 0).box2d = {}) + } + ), {}], + 378: [(function(t, e) { + "use strict"; + var i = "undefined" == typeof window ? global : window; + i.cc = i.cc || {}, + cc.internal = cc.internal || {}, + t("./predefine"), + t("./polyfill/string"), + t("./polyfill/misc"), + t("./polyfill/array"), + t("./polyfill/object"), + t("./polyfill/array-buffer"), + t("./polyfill/number"), + t("./polyfill/typescript"), + t("./cocos2d/core/predefine"), + t("./cocos2d"), + t("./extends"), + e.exports = i.cc + } + ), { + "./cocos2d": 295, + "./cocos2d/core/predefine": 218, + "./extends": 353, + "./package": void 0, + "./polyfill/array": 380, + "./polyfill/array-buffer": 379, + "./polyfill/misc": 381, + "./polyfill/number": 382, + "./polyfill/object": 383, + "./polyfill/string": 384, + "./polyfill/typescript": void 0, + "./predefine": 385 + }], + 379: [(function() { + "use strict"; + if (!ArrayBuffer.isView) { + var t = Object.getPrototypeOf(Int8Array); + ArrayBuffer.isView = "function" == typeof t ? function(e) { + return e instanceof t + } + : function(t) { + if ("object" != typeof t) + return !1; + var e = t.constructor; + return e === Float64Array || e === Float32Array || e === Uint8Array || e === Uint32Array || e === Int8Array + } + } + } + ), {}], + 380: [(function() { + "use strict"; + Array.isArray || (Array.isArray = function(t) { + return "[object Array]" === Object.prototype.toString.call(t) + } + ), + Array.prototype.find || (Array.prototype.find = function(t) { + for (var e = this.length, i = 0; i < e; i++) { + var n = this[i]; + if (t.call(this, n, i, this)) + return n + } + } + ), + Array.prototype.includes || (Array.prototype.includes = function(t) { + return -1 !== this.indexOf(t) + } + ) + } + ), {}], + 381: [(function() { + "use strict"; + if (Math.sign || (Math.sign = function(t) { + return 0 == (t = +t) || isNaN(t) ? t : t > 0 ? 1 : -1 + } + ), + Math.log2 || (Math.log2 = function(t) { + return Math.log(t) * Math.LOG2E + } + ), + Number.isInteger || (Number.isInteger = function(t) { + return "number" == typeof t && isFinite(t) && Math.floor(t) === t + } + ), + !console.time) { + var t = window.performance || Date + , e = Object.create(null); + console.time = function(i) { + e[i] = t.now() + } + , + console.timeEnd = function(i) { + var n = e[i] + , r = t.now() - n; + console.log(i + ": " + r + "ms") + } + } + } + ), {}], + 382: [(function() { + "use strict"; + Number.parseFloat = Number.parseFloat || parseFloat, + Number.parseInt = Number.parseInt || parseInt + } + ), {}], + 383: [(function() { + "use strict"; + Object.assign || (Object.assign = function(t, e) { + return cc.js.mixin(t, e) + } + ), + Object.getOwnPropertyDescriptors || (Object.getOwnPropertyDescriptors = function(t) { + var e = {} + , i = Object.getOwnPropertyNames(t); + Object.getOwnPropertySymbols && (i = i.concat(Object.getOwnPropertySymbols(t))); + for (var n = 0; n < i.length; ++n) { + var r = i[n]; + e[r] = Object.getOwnPropertyDescriptor(t, r) + } + return e + } + ) + } + ), {}], + 384: [(function() { + "use strict"; + String.prototype.startsWith || (String.prototype.startsWith = function(t, e) { + return e = e || 0, + this.lastIndexOf(t, e) === e + } + ), + String.prototype.endsWith || (String.prototype.endsWith = function(t, e) { + (void 0 === e || e > this.length) && (e = this.length), + e -= t.length; + var i = this.indexOf(t, e); + return -1 !== i && i === e + } + ), + String.prototype.trimLeft || (String.prototype.trimLeft = function() { + return this.replace(/^\s+/, "") + } + ) + } + ), {}], + 385: [(function() { + "use strict"; + var t = "undefined" == typeof window ? global : window; + function e(e, i) { + void 0 === t[e] && Object.defineProperty(t, e, { + get: function() { + var t; + return "CC_WECHATGAMESUB" === e ? t = "cc.sys.platform === cc.sys.WECHAT_GAME_SUB" : "CC_WECHATGAME" === e ? t = "cc.sys.platform === cc.sys.WECHAT_GAME" : "CC_QQPLAY" === e && (t = "cc.sys.platform === cc.sys.QQ_PLAY"), + cc.warnID(1400, e, t), + i + } + }) + } + function i(e) { + return "object" == typeof t[e] + } + (function(e, i) { + void 0 === t[e] && (t[e] = i) + } + )("CC_BUILD", !1), + t.CC_BUILD = !0, + t.CC_DEV = !1, + t.CC_DEBUG = !1, + t.CC_JSB = !1, + t.CC_NATIVERENDERER = !1, + t.CC_SUPPORT_JIT = !0, + t.CC_PHYSICS_BUILTIN = !1, + t.CC_PHYSICS_CANNON = !1, + t.CC_EDITOR = !1, + t.CC_PREVIEW = !1, + t.CC_TEST = !1, + t.CC_RUNTIME = !1, + t.CC_JSB = !1; + var n = !(!i("wx") || !wx.getSharedCanvas) + , r = !(!i("wx") || !wx.getSystemInfoSync && !wx.getSharedCanvas) + , s = i("bk"); + e("CC_WECHATGAMESUB", n), + e("CC_WECHATGAME", r), + e("CC_QQPLAY", s), + t.CocosEngine = cc.ENGINE_VERSION = "2.4.5" + } + ), {}] +}, {}, [378]); diff --git a/f.txt b/f.txt new file mode 100644 index 0000000..744574b --- /dev/null +++ b/f.txt @@ -0,0 +1,248 @@ +(function(sttc){/* + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/ +var aa,ba;function ca(a){var b=0;return function(){return b>>0,ia[d]=ha?fa.Symbol(d):"$jscp$"+a+"$"+d),da(f,ia[d],{configurable:!0,writable:!0,value:b})))}} +ja("Symbol",function(a){function b(f){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(f||"")+"_"+e++,f)}function c(f,g){this.h=f;da(this,"description",{configurable:!0,writable:!0,value:g})}if(a)return a;c.prototype.toString=function(){return this.h};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return b},"es6"); +ja("Symbol.iterator",function(a){if(a)return a;a=(0,n.Symbol)("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c=e}},"es6");ja("globalThis",function(a){return a||fa},"es_2020"); +ja("Array.prototype.keys",function(a){return a?a:function(){return va(this,function(b){return b})}},"es6");ja("Array.prototype.values",function(a){return a?a:function(){return va(this,function(b,c){return c})}},"es8");ja("Promise.prototype.finally",function(a){return a?a:function(b){return this.then(function(c){return n.Promise.resolve(b()).then(function(){return c})},function(c){return n.Promise.resolve(b()).then(function(){throw c;})})}},"es9");var v=this||self; +function xa(a){a=a.split(".");for(var b=v,c=0;c>>0),Ba=0;function Ca(a,b,c){return a.call.apply(a.bind,arguments)} +function Da(a,b,c){if(!a)throw Error();if(2b?1:0};function Ma(){var a=v.navigator;return a&&(a=a.userAgent)?a:""}function w(a){return-1!=Ma().indexOf(a)};function Na(){return w("Trident")||w("MSIE")}function Oa(){return(w("Chrome")||w("CriOS"))&&!w("Edge")||w("Silk")}function Pa(a){var b={};a.forEach(function(c){b[c[0]]=c[1]});return function(c){return b[p(c,"find").call(c,function(d){return d in b})]||""}} +function Qa(){var a=Ma();if(Na()){var b=/rv: *([\d\.]*)/.exec(a);if(b&&b[1])a=b[1];else{b="";var c=/MSIE +([\d\.]+)/.exec(a);if(c&&c[1])if(a=/Trident\/(\d.\d)/.exec(a),"7.0"==c[1])if(a&&a[1])switch(a[1]){case "4.0":b="8.0";break;case "5.0":b="9.0";break;case "6.0":b="10.0";break;case "7.0":b="11.0"}else b="7.0";else b=c[1];a=b}return a}c=RegExp("([A-Z][\\w ]+)/([^\\s]+)\\s*(?:\\((.*?)\\))?","g");b=[];for(var d;d=c.exec(a);)b.push([d[1],d[2],d[3]||void 0]);a=Pa(b);return w("Opera")?a(["Version","Opera"]): +w("Edge")?a(["Edge"]):w("Edg/")?a(["Edg"]):w("Silk")?a(["Silk"]):Oa()?a(["Chrome","CriOS","HeadlessChrome"]):(a=b[2])&&a[1]||""};function Ra(a,b){for(var c=a.length,d="string"===typeof a?a.split(""):a,e=0;eb?null:"string"===typeof a?a.charAt(b):a[b]} +function Wa(a,b){a:{for(var c="string"===typeof a?a.split(""):a,d=a.length-1;0<=d;d--)if(d in c&&b.call(void 0,c[d],d,a)){b=d;break a}b=-1}return 0>b?null:"string"===typeof a?a.charAt(b):a[b]}function Xa(a,b){a:if("string"===typeof a)a="string"!==typeof b||1!=b.length?-1:a.indexOf(b,0);else{for(var c=0;ce;e++){var f=c.concat(d[e].split(""));ab[e]=f;for(var g=0;g>2];k=b[(k&3)<<4|l>>4];l=b[(l&15)<<2|h>>6];h=b[h&63];c[e++]=g+k+l+h}g=0;h=d;switch(a.length-f){case 2:g=a[f+1],h=b[(g&15)<<2]||d;case 1:a=a[f],c[e]=b[a>>2]+b[(a&3)<<4|g>>4]+h+d}return c.join("")}}return a};function jb(a,b){if(null!=a)return Array.isArray(a)||fb(a)?kb(a,b):b(a)}function kb(a,b){if(Array.isArray(a)){for(var c=Array(a.length),d=0;d=a.m?a.j?a.j[b]:void 0:(void 0===c?0:c)&&a.j&&a.j[b]?a.j[b]:a.i[b+a.l]}function qb(a,b,c){c=void 0===c?!1:c;var d=z(a,b,c);null==d&&(d=ob);d===ob&&(d=eb(d.slice()),B(a,b,d,c));return d}function rb(a,b){a=z(a,b);return null==a?a:!!a}function C(a,b,c){a=z(a,b);return null==a?c:a}function sb(a,b,c){a=rb(a,b);return null==a?void 0===c?!1:c:a} +function tb(a,b,c){a=z(a,b);a=null==a?a:+a;return null==a?void 0===c?0:c:a}function B(a,b,c,d){(void 0===d?0:d)||b>=a.m?(pb(a),a.j[b]=c):a.i[b+a.l]=c;return a}function ub(a,b,c){var d=void 0===d?!1:d;return B(a,b,null==c?eb([]):Array.isArray(c)?eb(c):c,d)}function vb(a,b,c){0!==c?B(a,b,c):B(a,b,void 0,!1);return a}function wb(a,b,c,d){(c=xb(a,c))&&c!==b&&null!=d&&(a.h&&c in a.h&&(a.h[c]=void 0),B(a,c,void 0));return B(a,b,d)} +function xb(a,b){for(var c=0,d=0;da.length?"&":"")+encodeURIComponent(d)+"="+encodeURIComponent(String(g)))}}return b};/* + + SPDX-License-Identifier: Apache-2.0 +*/ +var Yb={};function Zb(){var a="undefined"!==typeof window?window.trustedTypes:void 0;return null!==a&&void 0!==a?a:null}var $b;function ac(){var a,b;if(void 0===$b)try{$b=null!==(b=null===(a=Zb())||void 0===a?void 0:a.createPolicy("google#safe",{createHTML:function(c){return c},createScript:function(c){return c},createScriptURL:function(c){return c}}))&&void 0!==b?b:null}catch(c){$b=null}return $b};function bc(){}function cc(a){this.h=a}u(cc,bc);cc.prototype.toString=function(){return this.h.toString()};function dc(a){var b,c=null===(b=ac())||void 0===b?void 0:b.createScriptURL(a);return new cc(null!==c&&void 0!==c?c:a,Yb)}function ec(a){if(a instanceof cc)return a.h;throw Error("");};function fc(a){var b=ta.apply(1,arguments);if(0===b.length)return dc(a[0]);for(var c=[a[0]],d=0;dc)return null;d=a.indexOf("&",c);if(0>d||d>b)d=b;c+=7;return decodeURIComponent(a.substr(c,d-c).replace(/\+/g," "))};function wc(a){try{var b;if(b=!!a&&null!=a.location.href)a:{try{Za(a.foo);b=!0;break a}catch(c){}b=!1}return b}catch(c){return!1}}function xc(a){return wc(a.top)?a.top:null} +function yc(a,b){var c=zc("SCRIPT",a);c.src=gc(b);var d;b=(c.ownerDocument&&c.ownerDocument.defaultView||window).document;var e=null===(d=b.querySelector)||void 0===d?void 0:d.call(b,"script[nonce]");(d=e?e.nonce||e.getAttribute("nonce")||"":"")&&c.setAttribute("nonce",d);return(a=a.getElementsByTagName("script")[0])&&a.parentNode?(a.parentNode.insertBefore(c,a),c):null}function Ac(a,b){return b.getComputedStyle?b.getComputedStyle(a,null):a.currentStyle} +function Bc(a,b){if(!Cc()&&!Dc()){var c=Math.random();if(c>2)+a.charCodeAt(d)&4294967295;return 0Math.random()});function Ic(a,b){var c=-1;try{a&&(c=parseInt(a.getItem(b),10))}catch(d){return null}return 0<=c&&1E3>c?c:null} +function Jc(a,b){var c=Dc()?null:Math.floor(1E3*Ec());var d;if(d=null!=c&&a)a:{var e=String(c);try{if(a){a.setItem(b,e);d=e;break a}}catch(f){}d=null}return d?c:null}var Cc=ic(function(){return Hc("MSIE")});function Hc(a){return-1!=Ma().indexOf(a)}var Kc=/^([0-9.]+)px$/,Lc=/^(-?[0-9.]{1,30})$/;function Mc(a){return Lc.test(a)&&(a=Number(a),!isNaN(a))?a:null}function H(a){return(a=Kc.exec(a))?+a[1]:null} +function Nc(a,b){for(var c=0;50>c;++c){try{var d=!(!a.frames||!a.frames[b])}catch(g){d=!1}if(d)return a;a:{try{var e=a.parent;if(e&&e!=a){var f=e;break a}}catch(g){}f=null}if(!(a=f))break}return null}var Oc=ic(function(){return rc()?2:sc()?1:0});function Pc(a){Fc({display:"none"},function(b,c){a.style.setProperty(c,b,"important")})}var Qc=[];function Rc(){var a=Qc;Qc=[];a=r(a);for(var b=a.next();!b.done;b=a.next()){b=b.value;try{b()}catch(c){}}} +function Sc(a,b){b=void 0===b?window.document:b;0!=a.length&&b.head&&a.forEach(function(c){if(c){var d=b;d=void 0===d?window.document:d;if(c&&d.head){var e=zc("META");d.head.appendChild(e);e.httpEquiv="origin-trial";e.content=c}}})}function Tc(a){if("number"!==typeof a.goog_pvsid)try{Object.defineProperty(a,"goog_pvsid",{value:Math.floor(Math.random()*Math.pow(2,52)),configurable:!1})}catch(b){}return Number(a.goog_pvsid)||-1} +function Uc(a){var b=Vc;"complete"===b.readyState||"interactive"===b.readyState?(Qc.push(a),1==Qc.length&&(n.Promise?n.Promise.resolve().then(Rc):window.setImmediate?setImmediate(Rc):setTimeout(Rc,0))):b.addEventListener("DOMContentLoaded",a)}function zc(a,b){b=void 0===b?document:b;return b.createElement(String(a).toLowerCase())};var Wc=null;var Vc=document,I=window;var Xc=null;function Yc(a,b){b=void 0===b?[]:b;var c=!1;v.google_logging_queue||(c=!0,v.google_logging_queue=[]);v.google_logging_queue.push([a,b]);if(a=c){if(null==Xc){Xc=!1;try{var d=xc(v);d&&-1!==d.location.hash.indexOf("google_logging")&&(Xc=!0);v.localStorage.getItem("google_logging")&&(Xc=!0)}catch(e){}}a=Xc}a&&(d=v.document,a=new Kb(Lb,"https://pagead2.googlesyndication.com/pagead/js/logging_library.js"),a=Wb(a instanceof Kb&&a.constructor===Kb&&a.h===Mb?a.i:"type_error:Const"),yc(d,a))};function Zc(a,b){var c=void 0===c?{}:c;this.error=a;this.context=b.context;this.msg=b.message||"";this.id=b.id||"jserror";this.meta=c}function $c(a){return!!(a.error&&a.meta&&a.id)};var ad=RegExp("^https?://(\\w|-)+\\.cdn\\.ampproject\\.(net|org)(\\?|/|$)");function bd(a,b){this.h=a;this.i=b}function cd(a,b,c){this.url=a;this.ba=b;this.Ia=!!c;this.depth=null};function dd(a,b){a.google_image_requests||(a.google_image_requests=[]);var c=zc("IMG",a.document);c.src=b;a.google_image_requests.push(c)}function ed(a,b){var c="https://pagead2.googlesyndication.com/pagead/gen_204?id="+b;Fc(a,function(d,e){d&&(c+="&"+e+"="+encodeURIComponent(d))});fd(c)}function fd(a){var b=window;b.fetch?b.fetch(a,{keepalive:!0,credentials:"include",redirect:"follow",method:"get",mode:"no-cors"}):dd(b,a)};function gd(){this.j="&";this.i={};this.l=0;this.h=[]}function hd(a,b){var c={};c[a]=b;return[c]}function id(a,b,c,d,e){var f=[];Fc(a,function(g,h){(g=jd(g,b,c,d,e))&&f.push(h+"="+g)});return f.join(b)} +function jd(a,b,c,d,e){if(null==a)return"";b=b||"&";c=c||",$";"string"==typeof c&&(c=c.split(""));if(a instanceof Array){if(d=d||0,de?encodeURIComponent(id(a,b,c,d,e+1)):"...";return encodeURIComponent(String(a))} +function kd(a,b){var c="https://pagead2.googlesyndication.com"+b,d=ld(a)-b.length;if(0>d)return"";a.h.sort(function(m,q){return m-q});b=null;for(var e="",f=0;f=l.length){d-=l.length;c+=l;e=a.j;break}b=null==b?g:b}}a="";null!=b&&(a=e+"trn="+b);return c+a}function ld(a){var b=1,c;for(c in a.i)b=c.length>b?c.length:b;return 3997-b-a.j.length-1};function md(){this.h=Math.random()}function nd(){var a=od,b=v.google_srt;0<=b&&1>=b&&(a.h=b)}function pd(a,b,c,d,e){if((d?a.h:Math.random())<(e||.01))try{if(c instanceof gd)var f=c;else f=new gd,Fc(c,function(h,k){var l=f,m=l.l++;h=hd(k,h);l.h.push(m);l.i[m]=h});var g=kd(f,"/pagead/gen_204?id="+b+"&");g&&dd(v,g)}catch(h){}};var qd=null;function rd(){if(null===qd){qd="";try{var a="";try{a=v.top.location.hash}catch(c){a=v.location.hash}if(a){var b=a.match(/\bdeid=([\d,]+)/);qd=b?b[1]:""}}catch(c){}}return qd};function sd(){var a=v.performance;return a&&a.now&&a.timing?Math.floor(a.now()+a.timing.navigationStart):Date.now()}function td(){var a=void 0===a?v:a;return(a=a.performance)&&a.now?a.now():null};function ud(a,b){var c=td()||sd();this.label=a;this.type=b;this.value=c;this.duration=0;this.uniqueId=Math.random();this.slotId=void 0};var vd=v.performance,wd=!!(vd&&vd.mark&&vd.measure&&vd.clearMarks),xd=ic(function(){var a;if(a=wd)a=rd(),a=!!a.indexOf&&0<=a.indexOf("1337");return a});function yd(){this.events=[];this.i=v||v;var a=null;v&&(v.google_js_reporting_queue=v.google_js_reporting_queue||[],this.events=v.google_js_reporting_queue,a=v.google_measure_js_timing);this.h=xd()||(null!=a?a:1>Math.random())} +function zd(a){a&&vd&&xd()&&(vd.clearMarks("goog_"+a.label+"_"+a.uniqueId+"_start"),vd.clearMarks("goog_"+a.label+"_"+a.uniqueId+"_end"))}yd.prototype.start=function(a,b){if(!this.h)return null;a=new ud(a,b);b="goog_"+a.label+"_"+a.uniqueId+"_start";vd&&xd()&&vd.mark(b);return a};yd.prototype.end=function(a){if(this.h&&"number"===typeof a.value){a.duration=(td()||sd())-a.value;var b="goog_"+a.label+"_"+a.uniqueId+"_end";vd&&xd()&&vd.mark(b);!this.h||2048a;case 12:return Fd(a)&&Fd(e)&&(new RegExp(a)).test(e);case 10:return null!=e&&-1===Ka(String(e),a);case 11:return null!=e&&1===Ka(String(e),a)}}}}function Td(a,b){return!a||!(!b||!Rd(a,b))};function Ud(a){y.call(this,a,-1,Vd)}u(Ud,y);var Vd=[4];function Wd(a){y.call(this,a)}u(Wd,y);function Xd(a){y.call(this,a,-1,Yd)}u(Xd,y);var Yd=[5],Zd=[1,2,3,6,7];function $d(a){a.jb.apply(a,ma(ta.apply(1,arguments).map(function(b){return{qb:4,message:b}})))};function ae(a){return function(){var b=ta.apply(0,arguments);try{return a.apply(this,b)}catch(c){}}}var be=ae(function(a){var b=[],c={};a=r(a);for(var d=a.next();!d.done;c={ca:c.ca},d=a.next())c.ca=d.value,ae(function(e){return function(){b.push('[{"'+e.ca.qb+'":'+Cb(e.ca.message)+"}]")}}(c))();return"[["+b.join(",")+"]]"});function ce(a,b){if(n.globalThis.fetch)n.globalThis.fetch(a,{method:"POST",body:b,keepalive:65536>b.length,credentials:"omit",mode:"no-cors",redirect:"follow"});else{var c=new XMLHttpRequest;c.open("POST",a,!0);c.send(b)}};function de(a){var b=void 0===b?ce:b;this.l=void 0===a?1E3:a;this.j=b;this.i=[];this.h=null}de.prototype.jb=function(){var a=ta.apply(0,arguments),b=this;ae(function(){b.i.push.apply(b.i,ma(a));var c=ae(function(){var d=be(b.i);b.j("https://pagead2.googlesyndication.com/pagead/ping?e=1",d);b.i=[];b.h=null});100<=b.i.length?(null!==b.h&&clearTimeout(b.h),b.h=setTimeout(c,0)):null===b.h&&(b.h=setTimeout(c,b.l))})()};function ee(a){y.call(this,a,-1,fe)}u(ee,y);function ge(a){y.call(this,a)}u(ge,y);ge.prototype.$=function(){return C(this,1,0)};function he(a){y.call(this,a)}u(he,y);var fe=[2,4,5],ie=[1,2];function je(a){y.call(this,a,-1,ke)}u(je,y);function le(a){y.call(this,a,-1,me)}u(le,y);var ke=[2,3],me=[5],ne=[1,2,3,4];function oe(a){y.call(this,a)}u(oe,y);oe.prototype.getTagSessionCorrelator=function(){return C(this,2,0)};var zb=[4,5,7];function pe(a,b,c){var d=void 0===d?new de(b):d;this.i=a;this.m=c;this.j=d;this.h=[];this.l=0Math.random()&&ed({stack:Error().stack,aswift:window.google_async_iframe_id},"badpubwin");return zf}function Bf(){var a=void 0===a?I:a;if(!a)return!1;try{return!(!a.navigator.standalone&&!a.top.navigator.standalone)}catch(b){return!1}} +function Cf(a){if(!a)return"";a=a.toLowerCase();"ca-"!=a.substring(0,3)&&(a="ca-"+a);return a};function Hf(){this.i=new If(this);this.h=0}Hf.prototype.resolve=function(a){Jf(this);this.h=1;this.l=a;Kf(this.i)};Hf.prototype.reject=function(a){Jf(this);this.h=2;this.j=a;Kf(this.i)};function Jf(a){if(0!=a.h)throw Error("Already resolved/rejected.");}function If(a){this.h=a}If.prototype.then=function(a,b){if(this.i)throw Error("Then functions already set.");this.i=a;this.j=b;Kf(this)}; +function Kf(a){switch(a.h.h){case 0:break;case 1:a.i&&a.i(a.h.l);break;case 2:a.j&&a.j(a.h.j);break;default:throw Error("Unhandled deferred state.");}};function Lf(a){this.h=a.slice(0)}Lf.prototype.apply=function(a){return new Lf(a(this.h.slice(0)))};Lf.prototype.get=function(a){return this.h[a]};Lf.prototype.add=function(a){var b=this.h.slice(0);b.push(a);return new Lf(b)};function Mf(a,b){for(var c=[],d=a.length,e=0;e=d.length?d:d.slice(0,19)+"_"))}a=new eg(null,{google_placement_id:a.join("~")})}return a};var ig={},jg=new eg(["google-auto-placed"],(ig.google_reactive_ad_format=40,ig.google_tag_origin="qs",ig));function kg(a){y.call(this,a)}u(kg,y);function lg(a){y.call(this,a)}u(lg,y);lg.prototype.getName=function(){return z(this,4)};function mg(a){y.call(this,a)}u(mg,y);function ng(a){y.call(this,a)}u(ng,y);function og(a){y.call(this,a)}u(og,y);var pg=[1,2,3];function qg(a){y.call(this,a)}u(qg,y);function rg(a){y.call(this,a,-1,sg)}u(rg,y);var sg=[6,7,9,10,11];function tg(a){y.call(this,a,-1,ug)}u(tg,y);function vg(a){y.call(this,a)}u(vg,y);function wg(a){y.call(this,a)}u(wg,y);var ug=[1],xg=[1,2];function yg(a){y.call(this,a,-1,zg)}u(yg,y);function Ag(a){y.call(this,a)}u(Ag,y);function Bg(a){y.call(this,a,-1,Cg)}u(Bg,y);function Dg(a){y.call(this,a)}u(Dg,y);function Eg(a){y.call(this,a)}u(Eg,y);function Fg(a){y.call(this,a)}u(Fg,y);function Gg(a){y.call(this,a)}u(Gg,y);var zg=[1,2,5,7],Cg=[2,5,6,11];function Hg(a){y.call(this,a)}u(Hg,y);function Ig(a){if(1!=a.nodeType)var b=!1;else if(b="INS"==a.tagName)a:{b=["adsbygoogle-placeholder"];a=a.className?a.className.split(/\s+/):[];for(var c={},d=0;df}function e(f){f=Uh(f);return null==f?!1:ctf(a)))return 4;if(!(a.innerHeight>=a.innerWidth))return 5;var f=tf(a);if(!f||(f-c)/f>d)a=6;else{if(c="true"!=e.google_full_width_responsive)a:{c=tf(a);for(b=b.parentElement;b;b=b.parentElement)if((d=Ac(b,a))&&(e=H(d.width))&&!(e>=c)&&"visible"!=d.overflow){c=!0;break a}c=!1}a=c?7:!0}return a} +function di(a,b,c,d){var e=ci(b,c,a,.3,d);!0!==e?a=e:"true"==d.google_full_width_responsive||Xh(c,b)?(b=tf(b),a=b-a,a=b&&0<=a?!0:b?-10>a?11:0>a?14:12:10):a=9;return a}function ei(a,b,c){a=a.style;"rtl"==b?Q(yh)?a.setProperty("margin-right",c,"important"):a.marginRight=c:Q(yh)?a.setProperty("margin-left",c,"important"):a.marginLeft=c} +function fi(a,b){if(3==b.nodeType)return/\S/.test(b.data);if(1==b.nodeType){if(/^(script|style)$/i.test(b.nodeName))return!1;try{var c=Ac(b,a)}catch(d){}return!c||"none"!=c.display&&!("absolute"==c.position&&("hidden"==c.visibility||"collapse"==c.visibility))}return!1}function gi(a,b,c){a=ai(b,a);return"rtl"==c?-a.x:a.x} +function hi(a,b){var c;c=(c=b.parentElement)?(c=Ac(c,a))?c.direction:"":"";if(c){b.style.border=b.style.borderStyle=b.style.outline=b.style.outlineStyle=b.style.transition="none";b.style.borderSpacing=b.style.padding="0";ei(b,c,"0px");b.style.width=tf(a)+"px";if(0!==gi(a,b,c)){ei(b,c,"0px");var d=gi(a,b,c);ei(b,c,-1*d+"px");a=gi(a,b,c);0!==a&&a!==d&&ei(b,c,d/(a-d)*d+"px")}b.style.zIndex=30}};function S(a,b){this.l=a;this.j=b}S.prototype.minWidth=function(){return this.l};S.prototype.height=function(){return this.j};S.prototype.h=function(a){return 300=f)}}function ni(a){return function(b){return b.height()<=a}}function li(a,b){return $h(a,b)c&&(c+=b.length),b=0<=c&&cf&&(f+=e.length);0<=f&&fe)){e=!0;break b}e=!1}g=e?g.eatfAbg=!0:!1}else g=h;if(g)return!0;g=new Wf([2]);for(e=0;e=c.offsetWidth);f=!c}if(!(c= +f)){c=a.v;f=z(b,2);g=za(d);g=c.i.h.get(g);if(!(g=g?g.contains(f):!1))a:{if(c.h.contains(za(d)))switch(f){case 2:case 3:g=!0;break a;default:g=!1;break a}for(f=d.parentElement;f;){if(c.h.contains(za(f))){g=!0;break a}f=f.parentElement}g=!1}c=g}if(c)return null;c=D(b,qg,3);f={};c&&(f.Sa=z(c,1),f.Fa=z(c,2),f.Za=!!rb(c,3));c=D(b,dg,4)&&z(D(b,dg,4),2)?z(D(b,dg,4),2):null;c=gg(c);g=null==z(b,12)?null:z(b,12);g=null==g?null:new eg(null,{google_ml_rank:g});b=Xi(a,b);b=fg(a.m,c,g,b);c=a.h;a=a.A;var h=c.document, +k=f.Za||!1;g=pc((new qc(h)).h,"DIV");var l=g.style;l.width="100%";l.height="auto";l.clear=k?"both":"none";k=g.style;k.textAlign="center";f.hb&&ri(k,f.hb);h=pc((new qc(h)).h,"INS");k=h.style;k.display="block";k.margin="auto";k.backgroundColor="transparent";f.Sa&&(k.marginTop=f.Sa);f.Fa&&(k.marginBottom=f.Fa);f.Wa&&ri(k,f.Wa);g.appendChild(h);f={pa:g,fa:h};f.fa.setAttribute("data-ad-format","auto");g=[];if(h=b&&b.Ga)f.pa.className=h.join(" ");h=f.fa;h.className="adsbygoogle";h.setAttribute("data-ad-client", +a);g.length&&h.setAttribute("data-ad-channel",g.join("+"));a:{try{var m=f.pa;var q=void 0===q?0:q;if(Q(bh)){q=void 0===q?0:q;var t=Th(d,e,q);if(t.init){var x=t.init;for(d=x;d=t.ha(d);)x=d;var F={anchor:x,position:t.la}}else F={anchor:d,position:e};m["google-ama-order-assurance"]=q;Jg(m,F.anchor,F.position)}else Jg(m,d,e);b:{var A=f.fa;A.dataset.adsbygoogleStatus="reserved";A.className+=" adsbygoogle-noablate";m={element:A};var E=b&&b.Ma;if(A.hasAttribute("data-pub-vars")){try{E=JSON.parse(A.getAttribute("data-pub-vars"))}catch(P){break b}A.removeAttribute("data-pub-vars")}E&& +(m.params=E);(c.adsbygoogle=c.adsbygoogle||[]).push(m)}}catch(P){(A=f.pa)&&A.parentNode&&(E=A.parentNode,E.removeChild(A),Ig(E)&&(E.style.display=E.getAttribute("data-init-display")||"none"));A=!1;break a}A=!0}return A?f:null}function Xi(a,b){return Qf(Tf(Ei(b).map(hg),function(c){Ci(a.h).exception=c}))};function Yi(a){if(Q(ah))var b=null;else try{b=a.getItem("google_ama_config")}catch(d){b=null}try{var c=b?nb(yg,b?JSON.parse(b):null):null}catch(d){c=null}return c};function Zi(a){y.call(this,a)}u(Zi,y);function $i(a){try{var b=a.localStorage.getItem("google_auto_fc_cmp_setting")||null}catch(d){b=null}var c=b;return c?Vf(function(){return nb(Zi,c?JSON.parse(c):null)}):Sf(null)};function aj(){this.S={}}function bj(){if(cj)return cj;var a=vf()||Af(),b=a.google_persistent_state_async;return null!=b&&"object"==typeof b&&null!=b.S&&"object"==typeof b.S?cj=b:a.google_persistent_state_async=cj=new aj}function dj(a){return ej[a]||"google_ps_"+a}function fj(a,b,c){b=dj(b);a=a.S;var d=a[b];return void 0===d?a[b]=c:d}var cj=null,gj={},ej=(gj[8]="google_prev_ad_formats_by_region",gj[9]="google_prev_ad_slotnames_by_region",gj);function hj(a){this.h=a||{cookie:""}} +hj.prototype.set=function(a,b,c){var d=!1;if("object"===typeof c){var e=c.Cb;d=c.Db||!1;var f=c.domain||void 0;var g=c.path||void 0;var h=c.fb}if(/[;=\s]/.test(a))throw Error('Invalid cookie name "'+a+'"');if(/[;\r\n]/.test(b))throw Error('Invalid cookie value "'+b+'"');void 0===h&&(h=-1);this.h.cookie=a+"="+b+(f?";domain="+f:"")+(g?";path="+g:"")+(0>h?"":0==h?";expires="+(new Date(1970,1,1)).toUTCString():";expires="+(new Date(Date.now()+1E3*h)).toUTCString())+(d?";secure":"")+(null!=e?";samesite="+ +e:"")};hj.prototype.get=function(a,b){for(var c=a+"=",d=(this.h.cookie||"").split(";"),e=0,f;ewindow.top.postMessage('"+a+"', '*');\n \n
\n

Requested size:'+d+"x"+e+"

\n

Rendered size:"+d+"x"+e+"

\n
")};/* + + Copyright 2019 The AMP HTML Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS-IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +var Ak={},Bk=(Ak.image_stacked=1/1.91,Ak.image_sidebyside=1/3.82,Ak.mobile_banner_image_sidebyside=1/3.82,Ak.pub_control_image_stacked=1/1.91,Ak.pub_control_image_sidebyside=1/3.82,Ak.pub_control_image_card_stacked=1/1.91,Ak.pub_control_image_card_sidebyside=1/3.74,Ak.pub_control_text=0,Ak.pub_control_text_card=0,Ak),Ck={},Dk=(Ck.image_stacked=80,Ck.image_sidebyside=0,Ck.mobile_banner_image_sidebyside=0,Ck.pub_control_image_stacked=80,Ck.pub_control_image_sidebyside=0,Ck.pub_control_image_card_stacked= +85,Ck.pub_control_image_card_sidebyside=0,Ck.pub_control_text=80,Ck.pub_control_text_card=80,Ck),Ek={},Fk=(Ek.pub_control_image_stacked=100,Ek.pub_control_image_sidebyside=200,Ek.pub_control_image_card_stacked=150,Ek.pub_control_image_card_sidebyside=250,Ek.pub_control_text=100,Ek.pub_control_text_card=150,Ek); +function Gk(a){var b=0;a.K&&b++;a.F&&b++;a.G&&b++;if(3>b)return{J:"Tags data-matched-content-ui-type, data-matched-content-columns-num and data-matched-content-rows-num should be set together."};b=a.K.split(",");var c=a.G.split(",");a=a.F.split(",");if(b.length!==c.length||b.length!==a.length)return{J:'Lengths of parameters data-matched-content-ui-type, data-matched-content-columns-num and data-matched-content-rows-num must match. Example: \n data-matched-content-rows-num="4,2"\ndata-matched-content-columns-num="1,6"\ndata-matched-content-ui-type="image_stacked,image_card_sidebyside"'}; +if(2a?c?(c=a-8-8,c=Math.floor(c/1.91+70)+Math.floor(11*(c*Bk.mobile_banner_image_sidebyside+Dk.mobile_banner_image_sidebyside)+96),a={X:a,V:c,F:1,G:12,K:"mobile_banner_image_sidebyside"}):(a=Hk(a),a={X:a.width,V:a.height,F:1,G:13,K:"image_sidebyside"}):(a=Hk(a),a={X:a.width,V:a.height,F:4,G:2,K:"image_stacked"});Mk(b,a);return new yk(9,new Jk(a.X,a.V))} +function Nk(a,b){Lk(a,b);var c=Gk({G:b.google_content_recommendation_rows_num,F:b.google_content_recommendation_columns_num,K:b.google_content_recommendation_ui_type});if(c.J)a={X:0,V:0,F:0,G:0,K:"image_stacked",J:c.J};else{var d=2===c.Ka.length&&468<=a?1:0;var e=c.Ka[d];e=0===e.indexOf("pub_control_")?e:"pub_control_"+e;var f=Fk[e];for(var g=c.F[d];a/g=a)throw new J("Invalid responsive width from Matched Content slot "+b.google_ad_slot+": "+a+". Please ensure to put this Matched Content slot into a non-zero width div container.");} +function Mk(a,b){a.google_content_recommendation_ui_type=b.K;a.google_content_recommendation_columns_num=b.F;a.google_content_recommendation_rows_num=b.G};function Ok(a,b){S.call(this,a,b)}u(Ok,S);Ok.prototype.h=function(){return this.minWidth()};Ok.prototype.i=function(a,b,c){hi(a,c);b.google_ad_resize||(c.style.height=this.height()+"px",b.rpe=!0)};var Pk={"image-top":function(a){return 600>=a?284+.414*(a-250):429},"image-middle":function(a){return 500>=a?196-.13*(a-250):164+.2*(a-500)},"image-side":function(a){return 500>=a?205-.28*(a-250):134+.21*(a-500)},"text-only":function(a){return 500>=a?187-.228*(a-250):130},"in-article":function(a){return 420>=a?a/1.2:460>=a?a/1.91+130:800>=a?a/4:200}};function Qk(a,b){S.call(this,a,b)}u(Qk,S);Qk.prototype.h=function(){return Math.min(1200,this.minWidth())}; +function Rk(a,b,c,d,e){var f=e.google_ad_layout||"image-top";if("in-article"==f){var g=a;if("false"==e.google_full_width_responsive)a=g;else if(a=ci(b,c,g,.2,e),!0!==a)e.gfwrnwer=a,a=g;else if(a=tf(b))if(e.google_full_width_responsive_allowed=!0,c.parentElement){b:{g=c;for(var h=0;100>h&&g.parentElement;++h){for(var k=g.parentElement.childNodes,l=0;la)throw new J("Fluid responsive ads must be at least 250px wide: availableWidth="+ +a);a=Math.min(1200,Math.floor(a));if(d&&"in-article"!=f){f=Math.ceil(d);if(50>f)throw new J("Fluid responsive ads must be at least 50px tall: height="+f);return new yk(11,new S(a,f))}if("in-article"!=f&&(d=e.google_ad_layout_key)){f=""+d;b=Math.pow(10,3);if(d=(c=f.match(/([+-][0-9a-z]+)/g))&&c.length){e=[];for(g=0;g=a/Math.min(1200,tf(c))?4:3:bi(b);var g=!1,h=!1;if(488>tf(c)){var k=Xh(d,c);var l=li(d,c);g=!l&&k;h=l&&k}l=[ji(a),wk(b)];l.push(ki(488>tf(c),c,d,h));null!=e.google_max_responsive_height&&l.push(ni(e.google_max_responsive_height));var m=[function(t){return!t.eb}];if(g||h)g=oi(c,d),m.push(ni(g));var q=Tk(Sk(l),Sk(m));if(!q)throw new J("No slot size for availableWidth="+a);l=jf(248,function(){var t;a:if(f){if(e.gfwrnh&&(t=H(e.gfwrnh))){t={W:new Ok(a,t),T:!0}; +break a}t=a/1.2;var x=Math;var F=x.min;if(e.google_resizing_allowed||"true"==e.google_full_width_responsive)var A=Infinity;else{A=d;var E=Infinity;do{var P=ii(A,c,"height",H);P&&(E=Math.min(E,P));(P=ii(A,c,"maxHeight",H))&&(E=Math.min(E,P))}while((A=A.parentElement)&&"HTML"!=A.tagName);A=E}x=F.call(x,t,A);if(x<.5*t||100>x)x=t;Q(vh)&&!li(d,c)&&(x=Math.max(x,.5*sf(c).clientHeight));t={W:new Ok(a,Math.floor(x)),T:xa*d.height()?new V(b.minWidth(),b.height(),1):d}function $k(a){return Q(th)||a.location&&"#hffwroe2etoq"==a.location.hash};function bl(a,b,c,d,e){var f;(f=tf(b))?488>tf(b)?b.innerHeight>=b.innerWidth?(e.google_full_width_responsive_allowed=!0,hi(b,c),f={B:f,C:!0}):f={B:a,C:5}:f={B:a,C:4}:f={B:a,C:10};var g=f;f=g.B;g=g.C;if(!0!==g||a==f)return new yk(12,new S(a,d),null,null,!0,g,100);a=Yk(f,"auto",b,c,e,!0);return new yk(1,a.W,a.na,2,!0,g,a.T)};function cl(a,b){var c=b.google_ad_format;if("autorelaxed"==c){a:{if("pedestal"!=b.google_content_recommendation_ui_type)for(a=r(Ik),c=a.next();!c.done;c=a.next())if(null!=b[c.value]){b=!0;break a}b=!1}return b?9:5}if(Wk(c))return 1;if("link"===c)return 4;if("fluid"==c){if(c="in-article"===b.google_ad_layout)c=Q(uh)||Q(th)||a.location&&("#hffwroe2etop"==a.location.hash||"#hffwroe2etoq"==a.location.hash);return c?(dl(b),1):8}if(27===b.google_reactive_ad_format)return dl(b),1} +function el(a,b,c,d,e){e=b.offsetWidth||(c.google_ad_resize||(void 0===e?!1:e))&&ii(b,d,"width",H)||c.google_ad_width||0;4===a&&(c.google_ad_format="auto",a=1);var f=(f=fl(a,e,b,c,d))?f:Xk(e,c.google_ad_format,d,b,c);f.size().i(d,c,b);zk(f,e,c);1!=a&&(a=f.size().height(),b.style.height=a+"px")} +function fl(a,b,c,d,e){var f=d.google_ad_height||ii(c,e,"height",H);switch(a){case 5:return f=jf(247,function(){return Vk(b,d.google_ad_format,e,c,d)}),a=f.B,f=f.C,!0===f&&b!=a&&hi(e,c),!0===f?d.google_full_width_responsive_allowed=!0:(d.google_full_width_responsive_allowed=!1,d.gfwrnwer=f),Kk(a,d);case 9:return Nk(b,d);case 8:return Rk(b,e,c,f,d);case 10:return bl(b,e,c,f,d)}}function dl(a){a.google_ad_format="auto";a.armr=3};function gl(a,b){var c=xc(b);if(c){c=tf(c);var d=Ac(a,b)||{},e=d.direction;if("0px"===d.width&&"none"!==d.cssFloat)return-1;if("ltr"===e&&c)return Math.floor(Math.min(1200,c-a.getBoundingClientRect().left));if("rtl"===e&&c)return a=b.document.body.getBoundingClientRect().right-a.getBoundingClientRect().right,Math.floor(Math.min(1200,c-a-Math.floor((c-b.document.body.clientWidth)/2)))}return-1};var hl=la(["https://pagead2.googlesyndication.com/pagead/managed/js/adsense/","/slotcar_library",".js"]),il=la(["https://googleads.g.doubleclick.net/pagead/html/","/","/zrt_lookup.html"]),jl=la(["https://pagead2.googlesyndication.com/pagead/managed/js/adsense/","/show_ads_impl",".js"]),kl=la(["https://pagead2.googlesyndication.com/pagead/managed/js/adsense/","/show_ads_impl_with_ama",".js"]),ll=la(["https://pagead2.googlesyndication.com/pagead/managed/js/adsense/","/show_ads_impl_instrumented",".js"]);function ml(a){y.call(this,a)}u(ml,y);function nl(a){y.call(this,a,-1,ol)}u(nl,y);var ol=[1];function pl(a){y.call(this,a,-1,ql)}u(pl,y);pl.prototype.getId=function(){return C(this,1,0)};pl.prototype.$=function(){return C(this,7,0)};var ql=[2];function rl(a){y.call(this,a,-1,sl)}u(rl,y);rl.prototype.$=function(){return C(this,5,0)};var sl=[2];function tl(a){y.call(this,a,-1,ul)}u(tl,y);function vl(a){y.call(this,a,-1,wl)}u(vl,y);vl.prototype.$=function(){return C(this,1,0)};function xl(a){y.call(this,a)}u(xl,y);var ul=[1,4,2,3],wl=[2];function yl(a){y.call(this,a,-1,zl)}u(yl,y);var zl=[19],Al=[13,14];var Bl=void 0;function Cl(){Ed(Bl,Dd);return Bl}function Dl(a){Ed(Bl,Gd);Bl=a};function El(a,b,c,d){c=void 0===c?"":c;return 1===b&&Fl(c,void 0===d?null:d)?!0:Gl(a,c,function(e){return Ua(G(e,Jb,2),function(f){return z(f,1)===b})})}function Fl(a,b){return b?13===xb(b,Al)?sb(Gb(b,ml,13,Al),1):14===xb(b,Al)&&""!==a&&1===qb(Gb(b,nl,14,Al),1).length&&qb(Gb(b,nl,14,Al),1)[0]===a?sb(D(Gb(b,nl,14,Al),ml,2),1):!1:!1}function Hl(a,b){b=C(b,18,0);-1!==b&&(a.tmod=b)} +function Il(a){var b=void 0===b?"":b;var c=xc(I)||I;return Jl(c,a)?!0:Gl(I,b,function(d){return Ua(qb(d,3),function(e){return e===a})})}function Kl(a){return Gl(v,void 0===a?"":a,function(){return!0})}function Jl(a,b){a=(a=(a=a.location&&a.location.hash)&&a.match(/forced_clientside_labs=([\d,]+)/))&&a[1];return!!a&&Xa(a.split(","),b.toString())} +function Gl(a,b,c){a=xc(a)||a;var d=Ll(a);b&&(b=Cf(String(b)));return Ob(d,function(e,f){return Object.prototype.hasOwnProperty.call(d,f)&&(!b||b===f)&&c(e)})}function Ll(a){a=Ml(a);var b={};Fc(a,function(c,d){try{var e=new Hb(c);b[d]=e}catch(f){}});return b}function Ml(a){return Q(Mg)?(a=sj({ba:a,ka:Cl()}),null!=a.h?(Nl("ok"),a=Ol(a.h.value)):(Nl(a.i.message),a={}),a):Ol(a.localStorage)} +function Ol(a){try{var b=a.getItem("google_adsense_settings");if(!b)return{};var c=JSON.parse(b);return c!==Object(c)?{}:Nb(c,function(d,e){return Object.prototype.hasOwnProperty.call(c,e)&&"string"===typeof e&&Array.isArray(d)})}catch(d){return{}}}function Nl(a){Q(Lg)&&lf("abg_adsensesettings_lserr",{s:a,g:Q(Mg),c:Cl(),r:.01},.01)};function Pl(a,b){return a instanceof HTMLScriptElement&&b.test(a.src)?0:1}function Ql(a){var b=I.document;if(b.currentScript)return Pl(b.currentScript,a);b=r(b.scripts);for(var c=b.next();!c.done;c=b.next())if(0===Pl(c.value,a))return 0;return 1};function Rl(a,b){var c={},d={},e={},f={};return f[Md]=(c[55]=function(){return 0===a},c[23]=function(g){return El(I,Number(g))},c[24]=function(g){return Il(Number(g))},c[61]=function(){return sb(b,6)},c[63]=function(){return sb(b,6)||".google.ch"===Eb(b,8)},c),f[Nd]=(d[7]=function(g){try{var h=window.localStorage}catch(l){h=null}g=Number(g);g=void 0===g?0:g;g=0!=g?"google_experiment_mod"+g:"google_experiment_mod";var k=Ic(h,g);h=null===k?Jc(h,g):k;return null!==h&&void 0!==h?h:void 0},d),f[Od]=(e[6]= +function(){return Eb(b,15)},e),f};function Sl(a){a=void 0===a?v:a;return a.ggeac||(a.ggeac={})};function Tl(a,b){try{var c=a.split(".");a=v;for(var d=0,e;null!=a&&d=e)return null;d=cm(a,d,c/e);a.m[b]=d?0:e-c;return d}function cm(a,b,c){var d=a.j,e=Va(b,function(f){return!!d[f.getId()]});return e?e:a.D?null:Bc(b,c)} +function em(a,b){M(Le,function(c){a.j[c]=!0},b);M(Oe,function(c,d){return Xl(a,c,d)},b);M(Pe,function(c){return(a.i[c]||[]).concat(a.i[4])},b);M(Ye,function(c){return am(a,c)},b);M(Me,function(c,d){return $l(a,c,d)},b)}function Yl(a,b){return(a=Va(a,function(c){return c.$()==b}))&&G(a,rl,2)||[]}function bm(a,b){var c=G(a,pl,2),d=c.length,e=C(a,8,0);a=d*C(a,1,0)-1;b=void 0!==b?b:Math.floor(1E3*Ec());d=(b-e)%d;if(b=a)return null;c=c[d];e=K(te).h;return!c||e&&!Td(D(c,Hd,3),e)?null:c};function fm(){this.h=function(){}}function gm(a){K(fm).h(a)};var hm,im,jm,km,lm,mm; +function nm(a,b,c,d){var e=1;d=void 0===d?Sl():d;e=void 0===e?0:e;var f=void 0===f?new pe(null!=(km=null==(hm=D(a,xl,5))?void 0:C(hm,2,0))?km:0,null!=(lm=null==(im=D(a,xl,5))?void 0:C(im,4,0))?lm:0,null!=(mm=null==(jm=D(a,xl,5))?void 0:sb(jm,3))?mm:!1):f;d.hasOwnProperty("init-done")?(af(Ye,d)(Ta(G(a,vl,2),function(g){return g.toJSON()})),af(Ze,d)(Ta(G(a,Xd,1),function(g){return g.toJSON()}),e),b&&af($e,d)(b),om(d,e)):(em(K(Wl).init(G(a,vl,2),e,f,c),d),bf(d),cf(d),df(d),om(d,e),He(G(a,Xd,1),[e],f, +void 0,!0),ue=ue||!(!c||!c.cb),gm(K(Ul)),b&&gm(b))}function om(a,b){a=void 0===a?Sl():a;b=void 0===b?0:b;var c=a,d=b;d=void 0===d?0:d;ff(K(ef),c,d);pm(a,b);K(fm).h=af($e,a);K(Rh).m()}function pm(a,b){var c=K(Rh);c.i=function(d,e){return af(Re,a,function(){return!1})(d,e,b)};c.j=function(d,e){return af(Se,a,function(){return 0})(d,e,b)};c.l=function(d,e){return af(Te,a,function(){return""})(d,e,b)};c.h=function(d,e){return af(Ue,a,function(){return[]})(d,e,b)};c.m=function(){af(Ne,a)(b)}};function qm(a,b,c){var d=U(a);if(d.plle)om(Sl(a),1);else{d.plle=!0;try{var e=a.localStorage}catch(f){e=null}d=e;null==Ic(d,"goog_pem_mod")&&Jc(d,"goog_pem_mod");d=D(b,tl,12);e=sb(b,9);nm(d,Rl(c,b),{Ha:e&&!!a.google_disable_experiments,cb:e},Sl(a));if(c=Eb(b,15))c=Number(c),K(ef).l(c);if(c=Eb(b,10))c=Number(c),K(ef).i(c);b=r(qb(b,19));for(c=b.next();!c.done;c=b.next())c=c.value,K(ef).i(c);K(ef).j(12);K(ef).j(10);a=xc(a)||a;fk(a.location,"google_mc_lab")&&K(ef).i(44738307)}};function rm(a){gf.Oa(function(b){b.shv=String(a);b.mjsv="m202112060101";var c=K(ef).h(),d=U(v);d.eids||(d.eids=[]);b.eid=c.concat(d.eids).join(",")})};function sm(a){var b=a.kb;return a.$a||("dev"===b?"dev":"")};var tm={},um=(tm.google_ad_modifications=!0,tm.google_analytics_domain_name=!0,tm.google_analytics_uacct=!0,tm.google_pause_ad_requests=!0,tm.google_user_agent_client_hint=!0,tm);function vm(a){return(a=a.innerText||a.innerHTML)&&(a=a.replace(/^\s+/,"").split(/\r?\n/,1)[0].match(/^\x3c!--+(.*?)(?:--+>)?\s*$/))&&RegExp("google_ad_client").test(a[1])?a[1]:null} +function wm(a){if(a=a.innerText||a.innerHTML)if(a=a.replace(/^\s+|\s+$/g,"").replace(/\s*(\r?\n)+\s*/g,";"),(a=a.match(/^\x3c!--+(.*?)(?:--+>)?$/)||a.match(/^\/*\s*)?$/i))&&RegExp("google_ad_client").test(a[1]))return a[1];return null} +function xm(a){switch(a){case "true":return!0;case "false":return!1;case "null":return null;case "undefined":break;default:try{var b=a.match(/^(?:'(.*)'|"(.*)")$/);if(b)return b[1]||b[2]||"";if(/^[-+]?\d*(\.\d+)?$/.test(a)){var c=parseFloat(a);return c===c?c:void 0}}catch(d){}}};function ym(){var a,b,c,d;if(I.google_ad_client)return String(I.google_ad_client);var e=U(I).head_tag_slot_vars;if(null!==(c=null!==(a=null===e||void 0===e?void 0:e.google_ad_client)&&void 0!==a?a:null===(b=I.document.querySelector(".adsbygoogle[data-ad-client]"))||void 0===b?void 0:b.getAttribute("data-ad-client"))&&void 0!==c)e=c;else{b:{e=I.document.getElementsByTagName("script");var f=I.navigator&&I.navigator.userAgent||"";f=RegExp("appbankapppuzdradb|daumapps|fban|fbios|fbav|fb_iab|gsa/|messengerforios|naver|niftyappmobile|nonavigation|pinterest|twitter|ucbrowser|yjnewsapp|youtube", +"i").test(f)||/i(phone|pad|pod)/i.test(f)&&/applewebkit/i.test(f)&&!/version|safari/i.test(f)&&!Bf()?vm:wm;for(var g=e.length-1;0<=g;g--){var h=e[g];if(!h.google_parsed_script_for_pub_code&&(h.google_parsed_script_for_pub_code=!0,h=f(h))){e=h;break b}}e=null}if(e){f=/(google_\w+) *= *(['"]?[\w.-]+['"]?) *(?:;|$)/gm;for(g={};h=f.exec(e);)g[h[1]]=xm(h[2]);e=g.google_ad_client?g.google_ad_client:""}else e=""}return null!==(d=e)&&void 0!==d?d:""};var zm="undefined"===typeof sttc?void 0:sttc;function Am(a){var b=gf;try{return Ed(a,Fd),new yl(JSON.parse(a))}catch(c){b.I(838,c instanceof Error?c:Error(String(c)),void 0,function(d){d.jspb=String(a)})}return new yl};var Bm=K(Rh).h(zh.h,zh.defaultValue);function Cm(){var a=I.document;a=void 0===a?window.document:a;Sc(Bm,a)};var Dm=K(Rh).h(Ah.h,Ah.defaultValue);function Em(){var a=I.document;a=void 0===a?window.document:a;Sc(Dm,a)};var Fm=la(["https://pagead2.googlesyndication.com/pagead/js/err_rep.js"]);function Gm(){this.h=null;this.j=!1;this.l=Math.random();this.i=this.I;this.m=null}aa=Gm.prototype;aa.Oa=function(a){this.h=a};aa.Qa=function(a){this.j=a};aa.Pa=function(a){this.i=a}; +aa.I=function(a,b,c,d,e){if((this.j?this.l:Math.random())>(void 0===c?.01:c))return!1;$c(b)||(b=new Zc(b,{context:a,id:void 0===e?"jserror":e}));if(d||this.h)b.meta={},this.h&&this.h(b.meta),d&&d(b.meta);v.google_js_errors=v.google_js_errors||[];v.google_js_errors.push(b);if(!v.error_rep_loaded){a=fc(Fm);var f;yc(v.document,null!=(f=this.m)?f:Wb(gc(a).toString()));v.error_rep_loaded=!0}return!1};aa.ma=function(a,b,c){try{var d=b()}catch(e){if(!this.i(a,e,.01,c,"jserror"))throw e;}return d}; +aa.La=function(a,b,c,d){var e=this;return function(){var f=ta.apply(0,arguments);return e.ma(a,function(){return b.apply(c,f)},d)}};function Hm(a,b,c){var d=window;return function(){var e=td(),f=3;try{var g=b.apply(this,arguments)}catch(h){f=13;if(c)return c(a,h),g;throw h;}finally{d.google_measure_js_timing&&e&&(e={label:a.toString(),value:e,duration:(td()||0)-e,type:f},f=d.google_js_reporting_queue=d.google_js_reporting_queue||[],2048>f.length&&f.push(e))}return g}}function Im(a,b){return Hm(a,b,function(c,d){(new Gm).I(c,d)})};function Jm(a,b){return null==b?"&"+a+"=null":"&"+a+"="+Math.floor(b)}function Km(a,b){return"&"+a+"="+b.toFixed(3)}function Lm(){var a=new n.Set,b=Fi();try{if(!b)return a;for(var c=b.pubads(),d=r(c.getSlots()),e=d.next();!e.done;e=d.next())a.add(e.value.getSlotId().getDomId())}catch(f){}return a}function Mm(a){a=a.id;return null!=a&&(Lm().has(a)||p(a,"startsWith").call(a,"google_ads_iframe_")||p(a,"startsWith").call(a,"aswift"))} +function Nm(a,b,c){if(!a.sources)return!1;var d=R(Fh);switch(Om(a)){case 2:var e=Pm(a);if(e)return c.some(function(g){return Qm(e,g,d)});case 1:var f=Rm(a);if(f)return b.some(function(g){return Qm(f,g,d)})}return!1}function Om(a){if(!a.sources)return 0;a=a.sources.filter(function(b){return b.previousRect&&b.currentRect});if(1<=a.length){a=a[0];if(a.previousRect.topa.currentRect.top)return 1}return 0} +function Rm(a){return Sm(a,function(b){return b.currentRect})}function Pm(a){return Sm(a,function(b){return b.previousRect})}function Sm(a,b){return a.sources.reduce(function(c,d){d=b(d);return c?d&&0!==d.width*d.height?d.topf.N&&(f.N=Number(e.value));f.O+=1;var g=Nm(e,c,d);g&&(f.m+=e.value,f.xa++);if(5E3f.R&&(f.R=f.h,f.Ca=f.i,f.Ba=e.startTime+e.duration)}break;case "largest-contentful-paint":a.va=Math.floor(e.renderTime||e.loadTime);a.ua=e.size;break;case "first-input":a.sa=Number((e.processingStart-e.startTime).toFixed(3));a.ta=!0;break;case "longtask":e=Math.max(0,e.duration-50),a.A+=e,a.M=Math.max(a.M,e),a.P+=1}})));return a.l} +function Wm(a){var b=Im(641,function(){var f=document;2==(Q(Bh)&&f.prerendering?3:{visible:1,hidden:2,prerender:3,preview:4,unloaded:5}[f.visibilityState||f.webkitVisibilityState||f.mozVisibilityState||""]||0)&&an(a)}),c=Im(641,function(){return void an(a)});document.addEventListener("visibilitychange",b);document.addEventListener("unload",c);var d=R(Gh),e;0=d||0>=a?!1:100*d*a/((b.right-b.left)*(b.bottom-b.top))>=c} +function $m(){var a=[].concat(ma(document.getElementsByTagName("iframe"))).filter(Mm),b=[].concat(ma(Lm())).map(function(c){return document.getElementById(c)}).filter(function(c){return null!==c});Xm=window.scrollX;Ym=window.scrollY;return Zm=[].concat(ma(a),ma(b)).map(function(c){return c.getBoundingClientRect()})}var Xm=void 0,Ym=void 0,Zm=[];function bn(a){a=void 0===a?window:a;return!a.PeriodicSyncManager}function cn(){var a=void 0===a?window:a;if(!bn(a)&&Q(Ih)||bn(a)&&Q(Jh)){a=a.navigator.userAgent;var b=/Chrome/.test(a);return/Android/.test(a)&&b}return!1} +var X={issuerOrigin:"https://attestation.android.com",issuancePath:"/att/i",redemptionPath:"/att/r",shouldRedeemToken:function(){return cn()},shouldRequestToken:function(){return cn()}},Y={issuerOrigin:"https://pagead2.googlesyndication.com",issuancePath:"/dtt/i",redemptionPath:"/dtt/r",getStatePath:"/dtt/s",shouldRedeemToken:function(){return!0},shouldRequestToken:function(){return!0}};var dn=K(Rh).h(Oh.h,Oh.defaultValue);function en(a){a=void 0===a?!1:a;kj.call(this);var b=this;this.h=a;a=[];cn()&&a.push(X);Q(Lh)&&a.push(Y);if(document.hasTrustToken&&!Q(Kh)&&!Array.isArray(window.goog_tt_state)){var c=a.map(function(d){return{issuerOrigin:d.issuerOrigin,state:b.h?1:12}});Object.defineProperty(window,"goog_tt_state",{configurable:!1,get:function(){return c.slice()}})}}u(en,kj);function fn(){var a=void 0===a?window.document:a;Sc(dn,a)} +function gn(a,b){return Q(Mh)||a&&(Q(Ph)||".google.de"!=b)||".google.ch"===b||"function"===typeof I.__tcfapi}function Z(a,b,c){var d=p(window.goog_tt_state,"find").call(window.goog_tt_state,function(e){return e.issuerOrigin===a});d&&(d.state=b,void 0!=c&&(d.hasRedemptionRecord=c))}function hn(){var a=window.goog_tt_state;return Array.isArray(a)&&a.some(function(b){return 1!=b.state})} +function jn(){var a=X.issuerOrigin+X.redemptionPath,b={keepalive:!0,trustToken:{type:"token-redemption",issuer:X.issuerOrigin,refreshPolicy:"none"}};Z(X.issuerOrigin,2);return window.fetch(a,b).then(function(c){if(!c.ok)throw Error(c.status+": Network response was not ok!");Z(X.issuerOrigin,6,!0)}).catch(function(c){c&&"NoModificationAllowedError"===c.name?Z(X.issuerOrigin,6,!0):Z(X.issuerOrigin,5)})} +function kn(){var a=X.issuerOrigin+X.issuancePath;Z(X.issuerOrigin,8);return window.fetch(a,{keepalive:!0,trustToken:{type:"token-request"}}).then(function(b){if(!b.ok)throw Error(b.status+": Network response was not ok!");Z(X.issuerOrigin,10);return jn()}).catch(function(b){if(b&&"NoModificationAllowedError"===b.name)return Z(X.issuerOrigin,10),jn();Z(X.issuerOrigin,9)})}function ln(){Z(X.issuerOrigin,13);return document.hasTrustToken(X.issuerOrigin).then(function(a){return a?jn():kn()})} +function mn(){Z(Y.issuerOrigin,13);if(n.Promise){var a=document.hasTrustToken(Y.issuerOrigin).then(function(e){return e}).catch(function(e){return n.Promise.reject({state:19,error:e})}),b=Y.issuerOrigin+Y.redemptionPath,c={keepalive:!0,trustToken:{type:"token-redemption",refreshPolicy:"none"}};Z(Y.issuerOrigin,16);a=a.then(function(e){return window.fetch(b,c).then(function(f){if(!f.ok)throw Error(f.status+": Network response was not ok!");Z(Y.issuerOrigin,18,!0)}).catch(function(f){if(f&&"NoModificationAllowedError"=== +f.name)Z(Y.issuerOrigin,18,!0);else{if(e)return n.Promise.reject({state:17,error:f});Z(Y.issuerOrigin,17)}})}).then(function(){return document.hasTrustToken(Y.issuerOrigin).then(function(e){return e}).catch(function(e){return n.Promise.reject({state:19,error:e})})}).then(function(e){var f=Y.issuerOrigin+Y.getStatePath;Z(Y.issuerOrigin,20);return window.fetch(f+"?ht="+e,{trustToken:{type:"send-redemption-record",issuers:[Y.issuerOrigin]}}).then(function(g){if(!g.ok)throw Error(g.status+": Network response was not ok!"); +Z(Y.issuerOrigin,22);return g.text().then(function(h){return JSON.parse(h)})}).catch(function(g){return n.Promise.reject({state:21,error:g})})});var d=Tc(window);return a.then(function(e){var f=Y.issuerOrigin+Y.issuancePath;return e&&e.srqt&&e.cs?(Z(Y.issuerOrigin,23),window.fetch(f+"?cs="+e.cs+"&correlator="+d,{keepalive:!0,trustToken:{type:"token-request"}}).then(function(g){if(!g.ok)throw Error(g.status+": Network response was not ok!");Z(Y.issuerOrigin,25);return e}).catch(function(g){return n.Promise.reject({state:24, +error:g})})):e}).then(function(e){if(e&&e.srdt&&e.cs)return Z(Y.issuerOrigin,26),window.fetch(b+"?cs="+e.cs+"&correlator="+d,{keepalive:!0,trustToken:{type:"token-redemption",refreshPolicy:"refresh"}}).then(function(f){if(!f.ok)throw Error(f.status+": Network response was not ok!");Z(Y.issuerOrigin,28,!0)}).catch(function(f){return n.Promise.reject({state:27,error:f})})}).then(function(){Z(Y.issuerOrigin,29)}).catch(function(e){if(e instanceof Object&&e.hasOwnProperty("state")&&e.hasOwnProperty("error"))if("number"=== +typeof e.state&&e.error instanceof Error){Z(Y.issuerOrigin,e.state);var f=R(Nh);Math.random()<=f&&ed({state:e.state,err:e.error.toString()},"dtt_err")}else throw Error(e);else throw e;})}} +function nn(a){if(document.hasTrustToken&&!Q(Kh)&&a.h){if(hn())return window.goog_tt_promise;a=[];cn()&&a.push(ln());Q(Lh)&&a.push(mn());if(n.Promise&&n.Promise.all)return a=n.Promise.all(a),"object"!=typeof window.goog_tt_promise&&Object.defineProperty(window,"goog_tt_promise",{configurable:!1,value:a,writable:!1}),a}};var on="platform platformVersion architecture model uaFullVersion bitness".split(" ");function pn(){return I.navigator&&I.navigator.userAgentData&&"function"===typeof I.navigator.userAgentData.getHighEntropyValues?I.navigator.userAgentData.getHighEntropyValues(on).then(function(a){var b=new Cj;b=B(b,1,a.platform);b=B(b,2,a.platformVersion);b=B(b,3,a.architecture);b=B(b,4,a.model);b=B(b,5,a.uaFullVersion);return B(b,9,a.bitness)}):null};function qn(a,b){b.google_ad_host||(a=a.document.querySelector('meta[name="google-adsense-platform-account"]'))&&(b.google_ad_host=a.getAttribute("content"))}function rn(a,b,c){c=void 0===c?"":c;I.google_sa_impl&&!I.document.getElementById("google_shimpl")&&(I.google_sa_queue=null,I.google_sl_win=null,I.google_sa_impl=null);I.google_sa_queue||(I.google_sa_queue=[],I.google_sl_win=I,I.google_process_slots=kf(215,function(){return sn(I)}),a=tn(c,a,b),yc(I.document,a).id="google_shimpl")} +function sn(a){var b=a.google_sa_queue,c=b.shift();a.google_sa_impl||lf("shimpl",{t:"no_fn"});"function"===typeof c&&jf(216,c);b.length&&a.setTimeout(kf(215,function(){return sn(a)}),0)}function un(a,b,c){a.google_sa_queue=a.google_sa_queue||[];a.google_sa_impl?c(b):a.google_sa_queue.push(b)} +function tn(a,b,c){var d=Math.random()b.length;++g)b.push(e.frames[g])}catch(l){}}for(b=0;bc?e-c:1;a.google_sv_map=a.google_sv_map||{};a.google_sv_map[f]=b;b.dninfo=b.google_loader_used;c=(d=!!a.document.getElementById(f+"_anchor"))?function(h){return h()}:function(h){return window.setTimeout(h,0)};b.dninfo+="_"+d;var g={pubWin:a,iframeWin:null,vars:b};un(a,function(){var h=!!a.document.getElementById(f+"_anchor");b.dninfo+="_"+h; +(h=a.google_sa_impl(g))&&h.catch&&h.catch(mf(911))},c)} +function zn(a,b,c){var d=c.google_ad_output,e=c.google_ad_format,f=c.google_ad_width||0,g=c.google_ad_height||0;e||"html"!=d&&null!=d||(e=f+"x"+g);d=!c.google_ad_slot||c.google_override_format||!uk[c.google_ad_width+"x"+c.google_ad_height]&&"aa"==c.google_loader_used;e&&d?e=e.toLowerCase():e="";c.google_ad_format=e;if("number"!==typeof c.google_reactive_sra_index||!c.google_ad_unit_key){e=[c.google_ad_slot,c.google_orig_ad_format||c.google_ad_format,c.google_ad_type,c.google_orig_ad_width||c.google_ad_width, +c.google_orig_ad_height||c.google_ad_height];d=[];f=0;for(g=b;g&&25>f;g=g.parentNode,++f)9===g.nodeType?d.push(""):d.push(g.id);(d=d.join())&&e.push(d);c.google_ad_unit_key=Gc(e.join(":")).toString();var h=void 0===h?!1:h;e=[];for(d=0;b&&25>d;++d){f="";void 0!==h&&h||(f=(f=9!==b.nodeType&&b.id)?"/"+f:"");a:{if(b&&b.nodeName&&b.parentElement){g=b.nodeName.toString().toLowerCase();for(var k=b.parentElement.childNodes,l=0,m=0;me;++e){var x=t.frames;for(d=0;df){var g=parseInt(a.style.height,10);e=!!uk[e+"x"+g];var h=f;if(e){var k=vk(f,g);if(k)h=k,b.google_ad_format=k+"x"+g+"_0ads_al";else throw new J("No slot size for availableWidth="+f);}b.google_ad_resize=!0;b.google_ad_width=h;e||(b.google_ad_format=null,b.google_override_format=!0);f=h;a.style.width=f+"px";g=Xk(f,"auto",c,a,b);h=f;g.size().i(c,b, +a);zk(g,h,b);g=g.size();b.google_responsive_formats=null;g.minWidth()>f&&!e&&(b.google_ad_width=g.minWidth(),a.style.width=g.minWidth()+"px")}}e=a.offsetWidth||ii(a,c,"width",H)||b.google_ad_width||0;f=Fa(Xk,e,"auto",c,a,b,!1,!0);!(g=Q(ih)||!(488>tf(c))&&!Q(qh))&&(g=Q(sh))&&(g=c===c.top,g||(xc(c)?b.gfwrnwer=3:b.gfwrnwer=16,g=!1),g=!g);if(g)d=!1;else{g=xc(c)||c;h=b.google_ad_client;d=g.location&&"#ftptohbh"===g.location.hash?2:fk(g.location,"google_responsive_slot_preview")||Q(rh)?1:Q(ph)?2:El(g,1, +h,d)?1:0;if(g=0!==d)b:if(b.google_reactive_ad_format||cl(c,b)||Zh(a,b))g=!1;else{for(g=a;g;g=g.parentElement){h=Ac(g,c);if(!h){b.gfwrnwer=18;g=!1;break b}if(!Xa(["static","relative"],h.position)){b.gfwrnwer=17;g=!1;break b}}if(!Q(qh)&&(g=ci(c,a,e,.3,b),!0!==g)){b.gfwrnwer=g;g=!1;break b}g=c===c.top?!0:!1}g?(b.google_resizing_allowed=!0,b.ovlp=!0,2===d?(d={},zk(f(),e,d),b.google_resizing_width=d.google_ad_width,b.google_resizing_height=d.google_ad_height,b.iaaso=!1):(b.google_ad_format="auto",b.iaaso= +!0,b.armr=1),d=!0):d=!1}if(e=cl(c,b))el(e,a,b,c,d);else{if(Zh(a,b)){if(d=Ac(a,c))a.style.width=d.width,a.style.height=d.height,Yh(d,b);b.google_ad_width||(b.google_ad_width=a.offsetWidth);b.google_ad_height||(b.google_ad_height=a.offsetHeight);b.google_loader_features_used=256;b.google_responsive_auto_format=En(c)}else Yh(a.style,b);c.location&&"#gfwmrp"==c.location.hash||12==b.google_responsive_auto_format&&"true"==b.google_full_width_responsive?el(10,a,b,c,!1):.01>Math.random()&&12===b.google_responsive_auto_format&& +(a=di(a.offsetWidth||parseInt(a.style.width,10)||b.google_ad_width,c,a,b),!0!==a?(b.efwr=!1,b.gfwrnwer=a):b.efwr=!0)}};function Gn(a){var b=window;var c=void 0===c?null:c;kc(b,"message",function(d){try{var e=JSON.parse(d.data)}catch(f){return}!e||"sc-cnf"!==e.googMsgType||c&&/[:|%3A]javascript\(/i.test(d.data)&&!c(e,d)||a(e,d)})};function Hn(a,b){b=void 0===b?500:b;kj.call(this);this.i=a;this.Ra=b;this.h=null;this.m={};this.l=null}u(Hn,kj);Hn.prototype.j=function(){this.m={};this.l&&(lc(this.i,this.l),delete this.l);delete this.m;delete this.i;delete this.h;kj.prototype.j.call(this)};function In(a){kj.call(this);this.h=a;this.i=null;this.l=!1}u(In,kj);var Jn=null,Kn=[],Ln=new n.Map,Mn=-1;function Nn(a){return qi.test(a.className)&&"done"!=a.dataset.adsbygoogleStatus}function On(a,b,c){a.dataset.adsbygoogleStatus="done";Pn(a,b,c)} +function Pn(a,b,c){var d=window,e=Af();e.google_spfd||(e.google_spfd=Fn);(e=b.google_reactive_ads_config)||Fn(a,b,d,c);qn(d,b);if(!Qn(a,b,d)){e||(d.google_lpabyc=$h(a,d)+ii(a,d,"height",H));if(e){e=e.page_level_pubvars||{};if(U(I).page_contains_reactive_tag&&!U(I).allow_second_reactive_tag){if(e.pltais){dk(!1);return}throw new J("Only one 'enable_page_level_ads' allowed per page.");}U(I).page_contains_reactive_tag=!0;dk(7===e.google_pgb_reactive)}b.google_unique_id=wf(d);Fc(um,function(f,g){b[g]= +b[g]||d[g]});b.google_loader_used="aa";b.google_reactive_tag_first=1===(U(I).first_tag_on_page||0);jf(164,function(){xn(d,b,a,c)})}} +function Qn(a,b,c){var d=b.google_reactive_ads_config,e="string"===typeof a.className&&RegExp("(\\W|^)adsbygoogle-noablate(\\W|$)").test(a.className),f=ak(c);if(f&&f.Da&&"on"!=b.google_adtest&&!e){e=$h(a,c);var g=sf(c).clientHeight;if(!f.oa||f.oa&&((0==g?null:e/g)||0)>=f.oa)return a.className+=" adsbygoogle-ablated-ad-slot",c=c.google_sv_map=c.google_sv_map||{},d=za(a),b.google_element_uid=d,c[b.google_element_uid]=b,a.setAttribute("google_element_uid",d),"slot"==f.pb&&(null!==Mc(a.getAttribute("width"))&& +a.setAttribute("width",0),null!==Mc(a.getAttribute("height"))&&a.setAttribute("height",0),a.style.width="0px",a.style.height="0px"),!0}if((f=Ac(a,c))&&"none"==f.display&&!("on"==b.google_adtest||0 + + + + + 召唤神龙 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + +
+ + + +
+ +
+ +
+ + + + + + + + + + + + + + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..47d5398 --- /dev/null +++ b/main.js @@ -0,0 +1,164 @@ +var loadingNum = 0; +window.boot = function () { + var settings = window._CCSettings; + window._CCSettings = undefined; + var onProgress = null; + + var RESOURCES = cc.AssetManager.BuiltinBundleName.RESOURCES; + var INTERNAL = cc.AssetManager.BuiltinBundleName.INTERNAL; + var MAIN = cc.AssetManager.BuiltinBundleName.MAIN; + + + function setLoadingDisplay () { + // Loading splash scene + var splash = document.getElementById('splash'); + var loadintT = document.getElementById("loadingText") + // var progressBar = splash.querySelector('.progress-bar span'); + cc.loader.onProgress = function (finish, total, item) { + loadData.completedCount = finish; + loadData.totalCount = total; + + var percent = 100 * finish / total; + if(loadingNum >= 1 && total > 1){ + if(percent.toFixed(0) >= 100){ + loadintT.innerHTML = 'loading......100' + '%'; + clearInterval(timer); + setTimeout(function(){ + loadintT.remove(); + },0.1 * 1000); + } + } + loadingNum++; + }; + splash.style.display = 'block'; + // progressBar.style.width = '0%'; + + cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () { + splash.style.display = 'none'; + }); + } + + var onStart = function () { + + cc.view.enableRetina(true); + cc.view.resizeWithBrowserSize(true); + + if (cc.sys.isBrowser) { + setLoadingDisplay(); + } + + if (cc.sys.isMobile) { + if (settings.orientation === 'landscape') { + cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE); + } + else if (settings.orientation === 'portrait') { + cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT); + } + // cc.view.enableAutoFullScreen([ + // cc.sys.BROWSER_TYPE_BAIDU, + // cc.sys.BROWSER_TYPE_BAIDU_APP, + // cc.sys.BROWSER_TYPE_WECHAT, + // cc.sys.BROWSER_TYPE_MOBILE_QQ, + // cc.sys.BROWSER_TYPE_MIUI, + // cc.sys.BROWSER_TYPE_HUAWEI, + // cc.sys.BROWSER_TYPE_UC, + // ].indexOf(cc.sys.browserType) < 0); + cc.view.enableAutoFullScreen(false); + } + + // Limit downloading max concurrent task to 2, + // more tasks simultaneously may cause performance draw back on some android system / browsers. + // You can adjust the number based on your own test result, you have to set it before any loading process to take effect. + if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) { + cc.assetManager.downloader.maxConcurrency = 2; + cc.assetManager.downloader.maxRequestsPerFrame = 2; + } + + var launchScene = settings.launchScene; + var bundle = cc.assetManager.bundles.find(function (b) { + return b.getSceneInfo(launchScene); + }); + var canvas; + if (cc.sys.isBrowser) { + canvas = document.getElementById('GameCanvas'); + } + + var MainManger = __require("MainManage"); + MainManger.init(launchScene,cc.sys.isBrowser,canvas.style.visibility); + // bundle.loadScene(launchScene, null, onProgress, + // function (err, scene) { + // if (!err) { + // cc.director.runSceneImmediate(scene); + // if (cc.sys.isBrowser) { + // // show canvas + // var canvas = document.getElementById('GameCanvas'); + // canvas.style.visibility = ''; + // var div = document.getElementById('GameDiv'); + // if (div) { + // div.style.backgroundImage = ''; + // } + // console.log('Success to load scene: ' + launchScene); + // } + // } + // } + // ); + }; + + var option = { + id: 'GameCanvas', + debugMode: settings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR, + showFPS: settings.debug, + frameRate: 60, + groupList: settings.groupList, + collisionMatrix: settings.collisionMatrix, + }; + + cc.assetManager.init({ + bundleVers: settings.bundleVers, + remoteBundles: settings.remoteBundles, + server: settings.server + }); + + var bundleRoot = [INTERNAL]; + settings.hasResourcesBundle && bundleRoot.push(RESOURCES); + + var count = 0; + function cb (err) { + if (err) return console.error(err.message, err.stack); + count++; + if (count === bundleRoot.length + 1) { + cc.assetManager.loadBundle(MAIN, function (err) { + if (!err) cc.game.run(option, onStart); + }); + } + } + + cc.assetManager.loadScript(settings.jsList.map(function (x) { return 'src/' + x;}), cb); + + for (var i = 0; i < bundleRoot.length; i++) { + cc.assetManager.loadBundle(bundleRoot[i], cb); + } +}; + +if (window.jsb) { + var isRuntime = (typeof loadRuntime === 'function'); + if (isRuntime) { + require('src/settings.js'); + require('src/cocos2d-runtime.js'); + if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) { + require('src/physics.js'); + } + require('jsb-adapter/engine/index.js'); + } + else { + require('src/settings.js'); + require('src/cocos2d-jsb.js'); + if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) { + require('src/physics.js'); + } + require('jsb-adapter/jsb-engine.js'); + } + + cc.macro.CLEANUP_IMAGE_CACHE = true; + window.boot(); +} \ No newline at end of file diff --git a/res/loading.gif b/res/loading.gif new file mode 100644 index 0000000..915c198 Binary files /dev/null and b/res/loading.gif differ diff --git a/res/share.png b/res/share.png new file mode 100644 index 0000000..7f9f284 Binary files /dev/null and b/res/share.png differ diff --git a/settings.js b/settings.js new file mode 100644 index 0000000..7bd7b50 --- /dev/null +++ b/settings.js @@ -0,0 +1 @@ +window._CCSettings={platform:"web-mobile",groupList:["default","move","UI","fish"],collisionMatrix:[[true,true,true,true],[true,true,null,true],[true,false,false],[true,true,false,false]],hasResourcesBundle:true,hasStartSceneBundle:false,remoteBundles:[],subpackages:[],launchScene:"db://assets/Scene/MainGameScene.fire",orientation:"portrait",jsList:[],bundleVers:{internal:"803f8",resources:"93f29",main:"fbdd2"}}; \ No newline at end of file diff --git a/singleColor.png b/singleColor.png new file mode 100644 index 0000000..fa6376e Binary files /dev/null and b/singleColor.png differ diff --git a/src/settings.js b/src/settings.js new file mode 100644 index 0000000..7bd7b50 --- /dev/null +++ b/src/settings.js @@ -0,0 +1 @@ +window._CCSettings={platform:"web-mobile",groupList:["default","move","UI","fish"],collisionMatrix:[[true,true,true,true],[true,true,null,true],[true,false,false],[true,true,false,false]],hasResourcesBundle:true,hasStartSceneBundle:false,remoteBundles:[],subpackages:[],launchScene:"db://assets/Scene/MainGameScene.fire",orientation:"portrait",jsList:[],bundleVers:{internal:"803f8",resources:"93f29",main:"fbdd2"}}; \ No newline at end of file diff --git a/style-mobile.css b/style-mobile.css new file mode 100644 index 0000000..65a314a --- /dev/null +++ b/style-mobile.css @@ -0,0 +1,127 @@ +html { + -ms-touch-action: none; +} + +body, canvas, div { + display: block; + outline: none; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + -khtml-user-select: none; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +/* Remove spin of input type number */ +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + /* display: none; <- Crashes Chrome on hover */ + -webkit-appearance: none; + margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ +} + +body { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + padding: 0; + border: 0; + margin: 0; + + cursor: default; + color: #888; + background-color: #333; + + text-align: center; + font-family: Helvetica, Verdana, Arial, sans-serif; + + display: flex; + flex-direction: column; + + /* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */ + /* overflow cannot be applied in Cocos2dGameContainer, + otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */ + overflow: hidden; +} + +#Cocos2dGameContainer { + position: absolute; + margin: 0; + left: 0px; + top: 0px; + + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-align: center; + -webkit-box-pack: center; +} + +canvas { + background-color: rgba(0, 0, 0, 0); +} + +a:link, a:visited { + color: #666; +} + +a:active, a:hover { + color: #666; +} + +p.header { + font-size: small; +} + +p.footer { + font-size: x-small; +} + +#splash { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: #ffffff url(./singleColor.png) no-repeat center; + background-size: 100%; +} + +.progress-bar { + background-color: #1a1a1a; + position: absolute; + left: 25%; + top: 80%; + height: 15px; + padding: 5px; + width: 50%; + /*margin: 0 -175px; */ + border-radius: 5px; + box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444; +} + +.progress-bar span { + display: block; + height: 100%; + border-radius: 3px; + box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset; + transition: width .4s ease-in-out; + background-color: #34c2e3; +} + +.stripes span { + background-size: 30px 30px; + background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, + transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, + transparent 75%, transparent); + + animation: animate-stripes 1s linear infinite; +} + +@keyframes animate-stripes { + 0% {background-position: 0 0;} 100% {background-position: 60px 0;} +}