var qqPlayCoreBuildInfo = { buildPath:'/branches/7.8.0_dev',version:'5608',creator:'wesleyxiao',buildTime:'Wed Oct 24 2018 21:53:12 GMT+0800 (GMT+08:00)'};function clone_(t){var e,i,r;if("object"!=typeof t||null===t)return t;if(t instanceof Array)for(e=[],i=0,r=t.length;i=10||"android"==t.platform?isSupportTA=!0:(BK.Script.log(1,0,"Current Device dont supoort TypedArray.[info = "+JSON.stringify(t)+"]"),isSupportTA=!1)}return isSupportTA}function __TypedArrayGetData(t){if(Object.prototype.hasOwnProperty.call(t,"__rawBKData"))return t.__rawBKData;if(Object.prototype.hasOwnProperty.call(t,"__nativeObj"))return t.__nativeObj;if(0==__bkIsSupportTypedArray()){var e=t instanceof ArrayBuffer;return BK.Misc.arrayBufferToBKBuffer(e?t:t.buffer,e?0:t.byteOffset,t.byteLength)}return t}function checkFirstFrames(){0==firstFrameUpload&&(BK.MQQ.SsoRequest.send({},"cs.first_frame_drawn.local"),firstFrameUpload=!0)}function activeTexture(t){glpause||gl.glActiveTexture(t)}function attachShader(t,e){glpause||gl.glAttachShader(t,e)}function bindAttribLocation(t,e,i){glpause||gl.glBindAttribLocation(t,e,i)}function bindBuffer(t,e){glpause||gl.glBindBuffer(t,e)}function bindFramebuffer(t,e){glpause||gl.glBindFramebuffer(t,e)}function bindRenderbuffer(t,e){glpause||gl.glBindRenderbuffer(t,e)}function bindTexture(t,e){glpause||gl.glBindTexture(t,e)}function blendColor(t,e,i,r){glpause||gl.glBlendColor(t,e,i,r)}function blendEquation(t){glpause||gl.glBlendEquation(t)}function blendEquationSeparate(t,e){glpause||gl.glBlendEquationSeparate(t,e)}function blendFunc(t,e){glpause||gl.glBlendFunc(t,e)}function blendFuncSeparate(t,e,i,r){glpause||gl.glBlendFuncSeparate(t,e,i,r)}function bufferData(t,e,i){glpause||("number"!=typeof e?gl.glBufferData(t,__TypedArrayGetData(e),i):gl.glBufferData(t,e,i))}function bufferSubData(t,e,i){glpause||gl.glBufferSubData(t,e,__TypedArrayGetData(i))}function checkFramebufferStatus(t){if(!glpause)return gl.glCheckFramebufferStatus(t)}function clear(t){glpause||gl.glClear(t)}function clearColor(t,e,i,r){glpause||gl.glClearColor(t,e,i,r)}function clearDepth(t){glpause||gl.glClearDepth(t)}function clearStencil(t){glpause||gl.glClearStencil(t)}function colorMask(t,e,i,r){glpause||gl.glColorMask(t,e,i,r)}function compileShader(t){glpause||gl.glCompileShader(t)}function compressedTexImage2D(t,e,i,r,n,o,a){glpause||gl.glCompressedTexImage2D(t,e,i,r,n,o,a)}function compressedTexSubImage2D(t,e,i,r,n,o,a,s){glpause||gl.glCompressedTexSubImage2D(t,e,i,r,n,o,a,s)}function copyTexImage2D(t,e,i,r,n,o,a,s){glpause||gl.glCopyTexImage2D(t,e,i,r,n,o,a,s)}function copyTexSubImage2D(t,e,i,r,n,o,a,s){glpause||gl.glCopyTexSubImage2D(t,e,i,r,n,o,a,s)}function createBuffer(){return glpause?-1:gl.glCreateBuffer()}function createFramebuffer(){return glpause?-1:gl.glCreateFramebuffer()}function createProgram(){return glpause?-1:gl.glCreateProgram()}function createRenderbuffer(){return glpause?-1:gl.glCreateRenderbuffer()}function createShader(t){return glpause?-1:gl.glCreateShader(t)}function createTexture(){return glpause?-1:gl.glCreateTexture()}function cullFace(t){glpause||gl.glCullFace(t)}function deleteBuffer(t){glpause||gl.glDeleteBuffer(t)}function deleteFramebuffer(t){glpause||gl.glDeleteFramebuffer(t)}function deleteProgram(t){glpause||gl.glDeleteProgram(t)}function deleteRenderbuffer(t){glpause||gl.glDeleteRenderbuffer(t)}function deleteShader(t){glpause||gl.glDeleteShader(t)}function deleteTexture(t){glpause||gl.glDeleteTexture(t)}function depthFunc(t){glpause||gl.glDepthFunc(t)}function depthMask(t){glpause||gl.glDepthMask(t)}function depthRange(t,e){glpause||gl.glDepthRange(t,e)}function detachShader(t,e){glpause||gl.glDetachShader(t,e)}function disable(t){glpause||gl.glDisable(t)}function disableVertexAttribArray(t){glpause||gl.glDisableVertexAttribArray(t)}function drawArrays(t,e,i){glpause||(gl.glDrawArrays(t,e,i),i>0&&checkFirstFrames())}function drawElements(t,e,i,r){glpause||(gl.glDrawElements(t,e,i,r),e>0&&checkFirstFrames())}function enable(t){glpause||gl.glEnable(t)}function enableVertexAttribArray(t){glpause||gl.glEnableVertexAttribArray(t)}function finish(){glpause||gl.glFinish()}function flush(){glpause||gl.glFlush()}function framebufferRenderbuffer(t,e,i,r){glpause||gl.glFramebufferRenderbuffer(t,e,i,r)}function framebufferTexture2D(t,e,i,r,n){glpause||gl.glFramebufferTexture2D(t,e,i,r,n)}function frontFace(t){glpause||gl.glFrontFace(t)}function generateMipmap(t){glpause||gl.glGenerateMipmap(t)}function getAttribLocation(t,e){return glpause?-1:gl.glGetAttribLocation(t,e)}function getError(){return glpause?null:gl.glGetError()}function getShaderPrecisionFormat(t,e){return glpause?-1:gl.glGetShaderPrecisionFormat(t,e)}function getProgramInfoLog(t){return glpause?null:gl.glGetProgramInfoLog(t)}function getShaderInfoLog(t){return glpause?null:gl.glGetShaderInfoLog(t)}function getShaderSource(t){return glpause?null:gl.glGetShaderSource(t)}function getUniformLocation(t,e){return glpause?-1:gl.glGetUniformLocation(t,e)}function getVertexAttribOffset(t,e){return glpause?-1:gl.glGetVertexAttribOffset(t,e)}function hint(t,e){glpause||gl.glHint(t,e)}function isBuffer(t){return!glpause&&gl.glIsBuffer(t)}function isEnabled(t){return!glpause&&gl.glIsEnabled(t)}function isFramebuffer(t){return!glpause&&gl.glIsFramebuffer(t)}function isProgram(t){return!glpause&&gl.glIsProgram(t)}function isRenderbuffer(t){return!glpause&&gl.glIsRenderbuffer(t)}function isShader(t){return!glpause&&gl.glIsShader(t)}function isTexture(t){return!glpause&&gl.glIsTexture(t)}function lineWidth(t){glpause||gl.glLineWidth(t)}function linkProgram(t){glpause||gl.glLinkProgram(t)}function pixelStorei(t,e){glpause||gl.glPixelStorei(t,e)}function polygonOffset(t,e){glpause||gl.glPolygonOffset(t,e)}function readPixels(t,e,i,r,n,o,a){}function renderbufferStorage(t,e,i,r){glpause||gl.glRenderbufferStorage(t,e,i,r)}function sampleCoverage(t,e){glpause||gl.glSampleCoverage(t,e)}function scissor(t,e,i,r){glpause||gl.glScissor(t,e,i,r)}function shaderSource(t,e){glpause||gl.glShaderSource(t,e)}function stencilFunc(t,e,i){glpause||gl.glStencilFunc(t,e,i)}function stencilFuncSeparate(t,e,i,r){glpause||gl.glStencilFuncSeparate(t,e,i,r)}function stencilMask(t){glpause||gl.glStencilMask(t)}function stencilMaskSeparate(t,e){glpause||gl.glStencilMaskSeparate(t,e)}function stencilOp(t,e,i){glpause||gl.glStencilOp(t,e,i)}function stencilOpSeparate(t,e,i,r){glpause||gl.glStencilOpSeparate(t,e,i,r)}function texImage2D(t,e,i){if(!glpause)switch(arguments.length){case 6:var r=arguments[3],n=arguments[4],o=arguments[5];Object.prototype.hasOwnProperty.call(o,"__nativeObj")?gl.glTexImage2D(t,e,i,r,n,o.__nativeObj):Object.prototype.hasOwnProperty.call(o,"buffer")&&Object.prototype.hasOwnProperty.call(o.buffer,"eof")&&Object.prototype.hasOwnProperty.call(o.buffer,"pointer")&&Object.prototype.hasOwnProperty.call(o.buffer,"netOrder")&&o.width>0&&o.height>0?gl.glTexImage2D(t,e,i,r,n,o):Object.prototype.hasOwnProperty.call(o,"buffer")&&o.buffer.__proto__.hasOwnProperty("eof")&&o.buffer.__proto__.hasOwnProperty("pointer")&&o.buffer.__proto__.hasOwnProperty("netOrder")&&o.width>0&&o.height>0&&gl.glTexImage2D(t,e,i,r,n,o);break;case 9:var a=arguments[3],s=arguments[4],h=arguments[5],r=arguments[6],n=arguments[7],c=arguments[8];gl.glTexImage2D(t,e,i,a,s,h,r,n,c)}}function texParameterf(t,e,i){glpause||gl.glTexParameterf(t,e,i)}function texParameteri(t,e,i){glpause||gl.glTexParameteri(t,e,i)}function texSubImage2D(t,e,i,r){if(!glpause)switch(arguments.length){case 7:var n=arguments[4],o=arguments[5],a=arguments[6];Object.prototype.hasOwnProperty.call(a,"__nativeObj")?gl.glTexSubImage2D(t,e,i,r,n,o,a.__nativeObj):gl.glTexSubImage2D(t,e,i,r,n,o,a);break;case 9:var s=arguments[4],h=arguments[5],n=arguments[6],o=arguments[7],c=arguments[8];gl.glTexSubImage2D(t,e,i,r,s,h,n,o,c)}}function uniform1f(t,e){glpause||gl.glUniform1f(t,e)}function uniform2f(t,e,i){glpause||gl.glUniform2f(t,e,i)}function uniform3f(t,e,i,r){glpause||gl.glUniform3f(t,e,i,r)}function uniform4f(t,e,i,r,n){glpause||gl.glUniform4f(t,e,i,r,n)}function uniform1i(t,e){glpause||gl.glUniform1i(t,e)}function uniform2i(t,e,i){glpause||gl.glUniform2i(t,e,i)}function uniform3i(t,e,i,r){glpause||gl.glUniform3i(t,e,i,r)}function uniform4i(t,e,i,r,n){glpause||gl.glUniform4i(t,e,i,r,n)}function uniform1fv(t,e){glpause||gl.glUniform1fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform2fv(t,e){glpause||gl.glUniform2fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform3fv(t,e){glpause||gl.glUniform3fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform4fv(t,e){glpause||gl.glUniform4fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function uniform1iv(t,e){glpause||gl.glUniform1iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniform2iv(t,e){glpause||gl.glUniform2iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniform3iv(t,e){glpause||gl.glUniform3iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniform4iv(t,e){glpause||gl.glUniform4iv(t,__TypedArrayGetData(e instanceof Array==1?new Int32Array(e):e))}function uniformMatrix2fv(t,e,i){glpause||gl.glUniformMatrix2fv(t,e,__TypedArrayGetData(i instanceof Array==1?new Float32Array(i):i))}function uniformMatrix3fv(t,e,i){glpause||gl.glUniformMatrix3fv(t,e,__TypedArrayGetData(i instanceof Array==1?new Float32Array(i):i))}function uniformMatrix4fv(t,e,i){glpause||gl.glUniformMatrix4fv(t,e,__TypedArrayGetData(i instanceof Array==1?new Float32Array(i):i))}function useProgram(t){glpause||gl.glUseProgram(t)}function validateProgram(t){glpause||gl.glValidateProgram(t)}function vertexAttrib1f(t,e){glpause||gl.glVertexAttrib1f(t,e)}function vertexAttrib2f(t,e,i){glpause||gl.glVertexAttrib2f(t,e,i)}function vertexAttrib3f(t,e,i,r){glpause||gl.glVertexAttrib3f(t,e,i,r)}function vertexAttrib4f(t,e,i,r,n){glpause||gl.glVertexAttrib4f(t,e,i,r,n)}function vertexAttrib1fv(t,e){glpause||gl.glVertexAttrib1fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttrib2fv(t,e){glpause||gl.glVertexAttrib2fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttrib3fv(t,e){glpause||gl.glVertexAttrib3fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttrib4fv(t,e){glpause||gl.glVertexAttrib4fv(t,__TypedArrayGetData(e instanceof Array==1?new Float32Array(e):e))}function vertexAttribPointer(t,e,i,r,n,o,a){if(!glpause){if(void 0===a){var s={index:t,size:e,type:i,normalized:r,stride:n,offset:o};void 0===gl.recordVertexAttribPointer&&(gl.recordVertexAttribPointer=[]);for(var h=!1,c=0;c0&&(gl.flushCommand(next_index,buffer_data),next_index=0)}function glCommitOpt(){flushCommand(),gl.commit()}function activeTextureOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ACTIVE_TEXTURE,buffer_data[next_index+1]=t,next_index+=2}function attachShaderOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ATTACH_SHADER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function bindAttribLocationOpt(t,e,i){flushCommand(),bindAttribLocation(t,e,i)}function bindBufferOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BIND_BUFFER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function bindFramebufferOpt(t,e){flushCommand(),bindFramebuffer(t,e)}function bindRenderbufferOpt(t,e){flushCommand(),bindRenderbuffer(t,e)}function bindTextureOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BIND_TEXTURE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function blendColorOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_COLOR,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function blendEquationOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_EQUATION,buffer_data[next_index+1]=t,next_index+=2}function blendEquationSeparateOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_EQUATION_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function blendFuncOpt(t,e){next_index+3>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_FUNC,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function blendFuncSeparateOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_BLEND_FUNC_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function bufferDataOpt(t,e,i){flushCommand(),bufferData(t,e,i)}function bufferSubDataOpt(t,e,i){flushCommand(),bufferSubData(t,e,i)}function checkFramebufferStatusOpt(t){flushCommand(),checkFramebufferStatus(t)}function clearOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR,buffer_data[next_index+1]=t,next_index+=2}function clearColorOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_COLOR,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function clearDepthOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_DEPTH,buffer_data[next_index+1]=t,next_index+=2}function clearStencilOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CLEAR_STENCIL,buffer_data[next_index+1]=t,next_index+=2}function colorMaskOpt(t,e,i,r){next_index+5>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COLOR_MASK,buffer_data[next_index+1]=t?1:0,buffer_data[next_index+2]=e?1:0,buffer_data[next_index+3]=i?1:0,buffer_data[next_index+4]=r?1:0,next_index+=5}function compileShaderOpt(t){next_index+2>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COMPILE_SHADER,buffer_data[next_index+1]=t,next_index+=2}function compressedTexImage2DOpt(t,e,i,r,n,o,a){flushCommand(),compressedTexImage2D(t,e,i,r,n,o,a)}function compressedTexSubImage2DOpt(t,e,i,r,n,o,a,s){flushCommand(),compressedTexSubImage2D(t,e,i,r,n,o,a,s)}function copyTexImage2DOpt(t,e,i,r,n,o,a,s){next_index+9>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COPY_TEX_IMAGE_2D,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,buffer_data[next_index+6]=o,buffer_data[next_index+7]=a,buffer_data[next_index+8]=s,next_index+=9}function copyTexSubImage2DOpt(t,e,i,r,n,o,a,s){next_index+9>total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_COPY_TEX_SUB_IMAGE_2D,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,buffer_data[next_index+6]=o,buffer_data[next_index+7]=a,buffer_data[next_index+8]=s,next_index+=9}function createBufferOpt(){return flushCommand(),createBuffer()}function createFramebufferOpt(){return flushCommand(),createFramebuffer()}function createProgramOpt(){return flushCommand(),createProgram()}function createRenderbufferOpt(){return flushCommand(),createRenderbuffer()}function createShaderOpt(t){return flushCommand(),createShader(t)}function createTextureOpt(){return flushCommand(),createTexture()}function cullFaceOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_CULL_FACE,buffer_data[next_index+1]=t,next_index+=2}function deleteBufferOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteFramebufferOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_FRAME_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function deleteRenderbufferOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_RENDER_BUFFER,buffer_data[next_index+1]=t,next_index+=2}function deleteShaderOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_SHADER,buffer_data[next_index+1]=t,next_index+=2}function deleteTextureOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DELETE_TEXTURE,buffer_data[next_index+1]=t,next_index+=2}function depthFuncOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_FUNC,buffer_data[next_index+1]=t,next_index+=2}function depthMaskOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_MASK,buffer_data[next_index+1]=t?1:0,next_index+=2}function depthRangeOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DEPTH_RANGE,buffer_data[next_index+1]=t,buffer_data[next_index+1]=e,next_index+=3}function detachShaderOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DETACH_SHADER,buffer_data[next_index+1]=t,buffer_data[next_index+1]=e,next_index+=3}function disableOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DISABLE,buffer_data[next_index+1]=t,next_index+=2}function disableVertexAttribArrayOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DISABLE_VERTEX_ATTRIB_ARRAY,buffer_data[next_index+1]=t,next_index+=2}function drawArraysOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DRAW_ARRAYS,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4,i>0&&checkFirstFrames()}function drawElementsOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_DRAW_ELEMENTS,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5,e>0&&checkFirstFrames()}function enableOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ENABLE,buffer_data[next_index+1]=t,next_index+=2}function enableVertexAttribArrayOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_ENABLE_VERTEX_ATTRIB_ARRAY,buffer_data[next_index+1]=t,next_index+=2}function finishOpt(){next_index+1>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FINISH,next_index+=1}function flushOpt(){next_index+1>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FLUSH,next_index+=1}function framebufferRenderbufferOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FRAME_BUFFER_RENDER_BUFFER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function framebufferTexture2DOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FRAME_BUFFER_TEXTURE_2D,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function frontFaceOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_FRONT_FACE,buffer_data[next_index+1]=t,next_index+=2}function generateMipmapOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_GENERATE_MIPMAP,buffer_data[next_index+1]=t,next_index+=2}function getActiveAttribOpt(t,e){return flushCommand(),getActiveAttrib(t,e)}function getActiveUniformOpt(t,e){return flushCommand(),getActiveUniform(t,e)}function getAttachedShadersOpt(t){return flushCommand(),getAttachedShaders(t)}function getAttribLocationOpt(t,e){return flushCommand(),getAttribLocation(t,e)}function getBufferParameterOpt(t,e){return flushCommand(),getBufferParameter(t,e)}function getParameterOpt(t){return flushCommand(),getParameter(t)}function getErrorOpt(){return flushCommand(),getError()}function getFramebufferAttachmentParameterOpt(t,e,i){return flushCommand(),getFramebufferAttachmentParameter(t,e,i)}function getProgramParameterOpt(t,e){return flushCommand(),getProgramParameter(t,e)}function getProgramInfoLogOpt(t){return flushCommand(),getProgramInfoLog(t)}function getRenderbufferParameterOpt(t,e){return flushCommand(),getRenderbufferParameter(t,e)}function getShaderParameterOpt(t,e){return flushCommand(),getShaderParameter(t,e)}function getShaderPrecisionFormatOpt(t,e){return flushCommand(),getShaderPrecisionFormat(t,e)}function getShaderInfoLogOpt(t){return flushCommand(),getShaderInfoLog(t)}function getShaderSourceOpt(t){return flushCommand(),getShaderSource(t)}function getTexParameterOpt(t,e){return flushCommand(),getTexParameter(t,e)}function getUniformOpt(t,e){return flushCommand(),getUniform(t,e)}function getUniformLocationOpt(t,e){return flushCommand(),getUniformLocation(t,e)}function getVertexAttribOpt(t,e){return flushCommand(),getVertexAttrib(t,e)}function getVertexAttribOffsetOpt(t,e){return flushCommand(),getVertexAttribOffset(t,e)}function hintOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_HINT,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function isBufferOpt(t){return flushCommand(),isBuffer(t)}function isEnabledOpt(t){return flushCommand(),isEnabled(t)}function isFramebufferOpt(t){return flushCommand(),isFramebuffer(t)}function isProgramOpt(t){return flushCommand(),isProgram(t)}function isRenderbufferOpt(t){return flushCommand(),isRenderbuffer(t)}function isShaderOpt(t){return flushCommand(),isShader(t)}function isTextureOpt(t){return flushCommand(),isTexture(t)}function lineWidthOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_LINE_WIDTH,buffer_data[next_index+1]=t,next_index+=2}function linkProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_LINK_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function pixelStoreiOpt(t,e){flushCommand(),pixelStorei(t,e)}function polygonOffsetOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_POLYGON_OFFSET,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function readPixelsOpt(t,e,i,r,n,o,a){}function renderbufferStorageOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_RENDER_BUFFER_STORAGE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=internalformat,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function sampleCoverageOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_SAMPLE_COVERAGE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e?1:0,next_index+=3}function scissorOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_SCISSOR,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function shaderSourceOpt(t,e){flushCommand(),shaderSource(t,e)}function stencilFuncOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_FUNC,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function stencilFuncSeparateOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_FUNC_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function stencilMaskOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_MASK,buffer_data[next_index+1]=t,next_index+=2}function stencilMaskSeparateOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_MASK_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function stencilOpOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_OP,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function stencilOpSeparateOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_STENCIL_OP_SEPARATE,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function texImage2DOpt(t,e,i){switch(flushCommand(),arguments.length){case 6:var r=arguments[3],n=arguments[4],o=arguments[5];Object.prototype.hasOwnProperty.call(o,"__nativeObj")?gl.glTexImage2D(t,e,i,r,n,o.__nativeObj):Object.prototype.hasOwnProperty.call(o,"buffer")&&Object.prototype.hasOwnProperty.call(o.buffer,"eof")&&Object.prototype.hasOwnProperty.call(o.buffer,"pointer")&&Object.prototype.hasOwnProperty.call(o.buffer,"netOrder")&&o.width>0&&o.height>0&&gl.glTexImage2D(t,e,i,r,n,o);break;case 9:var a=arguments[3],s=arguments[4],h=arguments[5],r=arguments[6],n=arguments[7],c=arguments[8];gl.glTexImage2D(t,e,i,a,s,h,r,n,c)}}function texParameterfOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_TEX_PARAMETER_F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function texParameteriOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_TEX_PARAMETER_I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function texSubImage2DOpt(t,e,i,r,n,o,a,s,h){flushCommand(),texSubImage2D(t,e,i,r,n,o,a,s,h)}function texSubImage2DOpt(t,e,i,r,n,o,a){flushCommand(),texSubImage2D(t,e,i,r,n,o,a)}function uniform1fOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function uniform2fOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function uniform3fOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function uniform4fOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function uniform1iOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function uniform2iOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function uniform3iOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function uniform4iOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4I,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function uniform1fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform2fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform3fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform4fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform1ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_1IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform2ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_2IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform3ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_3IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniform4ivOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_4IV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function uniformMatrix2fvOpt(t,e,i){next_index+4+i.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_MATRIX_2FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i.length,buffer_data.set(i,next_index+4),next_index+=4+i.length}function uniformMatrix3fvOpt(t,e,i){next_index+4+i.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_MATRIX_3FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i.length,buffer_data.set(i,next_index+4),next_index+=4+i.length}function uniformMatrix4fvOpt(t,e,i){next_index+4+i.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_UNIFORM_MATRIX_4FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i.length,buffer_data.set(i,next_index+4),next_index+=4+i.length}function useProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_USE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function validateProgramOpt(t){next_index+2>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VALIDATE_PROGRAM,buffer_data[next_index+1]=t,next_index+=2}function vertexAttrib1fOpt(t,e){next_index+3>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_1F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,next_index+=3}function vertexAttrib2fOpt(t,e,i){next_index+4>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_2F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,next_index+=4}function vertexAttrib3fOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_3F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function vertexAttrib4fOpt(t,e,i,r,n){next_index+6>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_4F,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,buffer_data[next_index+5]=n,next_index+=6}function vertexAttrib1fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_1FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttrib2fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_2FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttrib3fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_3FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttrib4fvOpt(t,e){next_index+3+e.length>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_4FV,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e.length,buffer_data.set(e,next_index+3),next_index+=3+e.length}function vertexAttribPointerOpt(t,e,i,r,n,o){next_index+7>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VERTEX_ATTRIB_POINTER,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r?1:0,buffer_data[next_index+5]=n,buffer_data[next_index+6]=o,next_index+=7}function viewportOpt(t,e,i,r){next_index+5>=total_size&&flushCommand(),buffer_data[next_index]=GL_COMMAND_VIEW_PORT,buffer_data[next_index+1]=t,buffer_data[next_index+2]=e,buffer_data[next_index+3]=i,buffer_data[next_index+4]=r,next_index+=5}function isSupportTypeArray(){if("android"==GameStatusInfo.platform)return!0;var t=BK.Director.queryDeviceInfo(),e=t.version.split(".");return"ios"==t.platform&&Number(e[0])>=10}function attachMethodOpt(){gl.activeTexture=activeTextureOpt,gl.attachShader=attachShaderOpt,gl.bindAttribLocation=bindAttribLocationOpt,gl.bindBuffer=bindBufferOpt,gl.bindFramebuffer=bindFramebufferOpt,gl.bindRenderbuffer=bindRenderbufferOpt,gl.bindTexture=bindTextureOpt,gl.blendColor=blendColorOpt,gl.blendEquation=blendEquationOpt,gl.blendEquationSeparate=blendEquationSeparateOpt,gl.blendFunc=blendFuncOpt,gl.blendFuncSeparate=blendFuncSeparateOpt,gl.bufferData=bufferDataOpt,gl.bufferData=bufferDataOpt,gl.bufferSubData=bufferSubDataOpt,gl.checkFramebufferStatus=checkFramebufferStatusOpt,gl.clear=clearOpt,gl.clearColor=clearColorOpt,gl.clearDepth=clearDepthOpt,gl.clearStencil=clearStencilOpt,gl.colorMask=colorMaskOpt,gl.compileShader=compileShaderOpt,gl.compressedTexImage2D=compressedTexImage2DOpt,gl.compressedTexSubImage2D=compressedTexSubImage2DOpt,gl.copyTexImage2D=copyTexImage2DOpt,gl.copyTexSubImage2D=copyTexSubImage2DOpt,gl.createBuffer=createBufferOpt,gl.createFramebuffer=createFramebufferOpt,gl.createProgram=createProgramOpt,gl.createRenderbuffer=createRenderbufferOpt,gl.createShader=createShaderOpt,gl.createTexture=createTextureOpt,gl.cullFace=cullFaceOpt,gl.deleteBuffer=deleteBufferOpt,gl.deleteFramebuffer=deleteFramebufferOpt,gl.deleteProgram=deleteProgramOpt,gl.deleteRenderbuffer=deleteRenderbufferOpt,gl.deleteShader=deleteShaderOpt,gl.deleteTexture=deleteTextureOpt,gl.depthFunc=depthFuncOpt,gl.depthMask=depthMaskOpt,gl.depthRange=depthRangeOpt,gl.detachShader=detachShaderOpt,gl.disable=disableOpt,gl.disableVertexAttribArray=disableVertexAttribArrayOpt,gl.drawArrays=drawArraysOpt,gl.drawElements=drawElementsOpt,gl.enable=enableOpt,gl.enableVertexAttribArray=enableVertexAttribArrayOpt,gl.finish=finishOpt,gl.flush=flushOpt,gl.framebufferRenderbuffer=framebufferRenderbufferOpt,gl.framebufferTexture2D=framebufferTexture2DOpt,gl.frontFace=frontFaceOpt,gl.generateMipmap=generateMipmapOpt,gl.getActiveAttrib=getActiveAttribOpt,gl.getActiveUniform=getActiveUniformOpt,gl.getAttachedShaders=getAttachedShadersOpt,gl.getAttribLocation=getAttribLocationOpt,gl.getBufferParameter=getBufferParameterOpt,gl.getParameter=getParameterOpt,gl.getError=getErrorOpt,gl.getFramebufferAttachmentParameter=getFramebufferAttachmentParameterOpt,gl.getProgramParameter=getProgramParameterOpt,gl.getProgramInfoLog=getProgramInfoLogOpt,gl.getRenderbufferParameter=getRenderbufferParameterOpt,gl.getShaderParameter=getShaderParameterOpt,gl.getShaderPrecisionFormat=getShaderPrecisionFormatOpt,gl.getShaderInfoLog=getShaderInfoLogOpt,gl.getShaderSource=getShaderSourceOpt,gl.getTexParameter=getTexParameterOpt,gl.getUniform=getUniformOpt,gl.getUniformLocation=getUniformLocationOpt,gl.getVertexAttrib=getVertexAttribOpt,gl.getVertexAttribOffset=getVertexAttribOffsetOpt,gl.hint=hintOpt,gl.isBuffer=isBufferOpt,gl.isEnabled=isEnabledOpt,gl.isFramebuffer=isFramebufferOpt,gl.isProgram=isProgramOpt,gl.isRenderbuffer=isRenderbufferOpt,gl.isShader=isShaderOpt,gl.isTexture=isTextureOpt,gl.lineWidth=lineWidthOpt,gl.linkProgram=linkProgramOpt,gl.pixelStorei=pixelStoreiOpt,gl.polygonOffset=polygonOffsetOpt,gl.readPixels=readPixelsOpt,gl.renderbufferStorage=renderbufferStorageOpt,gl.sampleCoverage=sampleCoverageOpt,gl.scissor=scissorOpt,gl.shaderSource=shaderSourceOpt,gl.stencilFunc=stencilFuncOpt,gl.stencilFuncSeparate=stencilFuncSeparateOpt,gl.stencilMask=stencilMaskOpt,gl.stencilMaskSeparate=stencilMaskSeparateOpt,gl.stencilOp=stencilOpOpt,gl.stencilOpSeparate=stencilOpSeparateOpt,gl.texImage2D=texImage2DOpt,gl.texImage2D=texImage2DOpt,gl.texParameterf=texParameterfOpt,gl.texParameteri=texParameteriOpt,gl.texSubImage2D=texSubImage2DOpt,gl.texSubImage2D=texSubImage2DOpt,gl.uniform1f=uniform1fOpt,gl.uniform2f=uniform2fOpt,gl.uniform3f=uniform3fOpt,gl.uniform4f=uniform4fOpt,gl.uniform1i=uniform1iOpt,gl.uniform2i=uniform2iOpt,gl.uniform3i=uniform3iOpt,gl.uniform4i=uniform4iOpt,gl.uniform1fv=uniform1fvOpt,gl.uniform2fv=uniform2fvOpt,gl.uniform3fv=uniform3fvOpt,gl.uniform4fv=uniform4fvOpt,gl.uniform1iv=uniform1ivOpt,gl.uniform2iv=uniform2ivOpt,gl.uniform3iv=uniform3ivOpt,gl.uniform4iv=uniform4ivOpt,gl.uniformMatrix2fv=uniformMatrix2fvOpt,gl.uniformMatrix3fv=uniformMatrix3fvOpt,gl.uniformMatrix4fv=uniformMatrix4fvOpt,gl.useProgram=useProgramOpt,gl.validateProgram=validateProgramOpt,gl.vertexAttrib1f=vertexAttrib1fOpt,gl.vertexAttrib2f=vertexAttrib2fOpt,gl.vertexAttrib3f=vertexAttrib3fOpt,gl.vertexAttrib4f=vertexAttrib4fOpt,gl.vertexAttrib1fv=vertexAttrib1fvOpt,gl.vertexAttrib2fv=vertexAttrib2fvOpt,gl.vertexAttrib3fv=vertexAttrib3fvOpt,gl.vertexAttrib4fv=vertexAttrib4fvOpt,gl.vertexAttribPointer=vertexAttribPointerOpt,gl.viewport=viewportOpt,gl.glCommit=glCommitOpt}function SandBoxCanvas(){var t=arguments.length;this._shadowColor={r:0,g:0,b:0,a:0},this._shadowOffset={x:0,y:0},this._shadowRadius=0,this._textBaseLine=0,this._textAlign=0,this._useH5Mode=0,this._a=1,this._b=0,this._c=0,this._d=1,this._tx=0,this._ty=0,2==t&&(this.__nativeObj=new BK.SandBoxCanvasNode(arguments[0],arguments[1]),this.setFlipXY(0,1),Object.getOwnPropertyNames(this.__nativeObj).forEach(function(t){var e=t;"scale"!=e&&"transform"!=e&&"contentSize"!=e&&"size"!=e&&"fontPath"!=e&&Object.defineProperty(this,e,{get:function(){return this.__nativeObj[e]},set:function(t){this.__nativeObj[e]=t}})},this),Object.defineProperty(SandBoxCanvas.prototype,"fontPath",{get:function(){return this.__nativeObj.fontPath},set:function(t){BK.FileUtil.isFileExist(t)&&(this.__nativeObj.fontPath=t)},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"contentSize",{get:function(){return this.__nativeObj.contentSize},set:function(t){this.__nativeObj.contentSize=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"size",{get:function(){return this.__nativeObj.size},set:function(t){this.__nativeObj.size=t,this.__nativeObj.resetCanvas()},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"textBaseline",{get:function(){return this._textBaseLine},set:function(t){switch(t){case 0:case 1:case 2:this._textBaseLine=t;break;case"bottom":case"Bottom":this._textBaseLine=0;break;case"Middle":case"middle":this._textBaseLine=1;break;case"Top":case"top":this._textBaseLine=2}},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"textAlign",{get:function(){return this._textAlign},set:function(t){switch(t){case 0:case 1:case 2:this._textAlign=t;break;case"left":this._textAlign=0;break;case"center":this._textAlign=1;break;case"right":this._textAlign=2}this.__nativeObj.setTextAlign(this._textAlign)},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"lineWidth",{get:function(){return this.__nativeObj.lineWidth},set:function(t){this.__nativeObj.lineWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"globalAlpha",{get:function(){return this.__nativeObj.globalAlpha},set:function(t){t=Math.min(1,t),t=Math.max(0,t),this.__nativeObj.globalAlpha=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"fillColor",{get:function(){return this.__nativeObj.fillColor},set:function(t){this.__nativeObj.fillColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"strokeColor",{get:function(){return this.__nativeObj.strokeColor},set:function(t){this.__nativeObj.strokeColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"lineCap",{get:function(){return this.__nativeObj.lineCap},set:function(t){this.__nativeObj.lineCap=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"lineJoin",{get:function(){return this.__nativeObj.lineJoin},set:function(t){this.__nativeObj.lineJoin=t},enumerable:!0,configurable:!0}),Object.defineProperty(SandBoxCanvas.prototype,"miterLimit",{get:function(){return this.__nativeObj.miterLimit},set:function(t){this.__nativeObj.miterLimit=t},enumerable:!0,configurable:!0}))}function __dispatchEvent(t,e,i){BK.Script.log(0,0,"__dispatchEvent err:"+t+" cmd:"+e+" data:"+i),Array.isArray(__browserMsgHdl.listenerInfos)&&__browserMsgHdl.listenerInfos.length<=0&&"sc.init_global_var.local"==e&&(GameStatusInfo=JSON.parse(i)),__browserMsgHdl.listenerInfos.forEach(function(r){if(r.cmd==e){var n=r.callback;try{n(t,e,JSON.parse(i))}catch(t){console.log(t),BK.Script.log(0,0,"JSON parse error:"+t+" data: "+i)}}},this),BK.MQQ.SsoRequest.listenerInfos.forEach(function(r){if(r.cmd==e){var n=r.callback;try{"cs.get_file_data.local"==e?n(t,e,i):n(t,e,JSON.parse(i))}catch(t){console.log(t),BK.Script.log(0,0,"JSON parse error:"+t+" data: "+i)}}},this)}function registerRedPackageListener(){function t(){BK.Script.log(1,0,"on onGameLoad for redpackage "+localStorage.loadRedpackage),"1"!==localStorage.loadRedpackage&&(localStorage.loadRedpackage="1",BK.QQ.isOpenActivityPage()&&BK.QQ.showRedPackageActivityPage())}function e(){BK.Script.log(1,0,"on onGameForeground for redpackage "+localStorage.loadRedpackage),localStorage.loadRedpackage="0"}function i(){BK.Script.log(1,0,"on onGameLoad for redpackage not H5"),BK.QQ.isOpenActivityPage()&&BK.QQ.showRedPackageActivityPage()}BK.isBrowser?(BK.Script.log(1,0,"set listener for notifyJSEVent redpackage h5"),BK.MQQ.SsoRequest.addListener("sc.init_global_var.local",this,t),BK.MQQ.SsoRequest.addListener("sc.game_enter_foreground.local",this,e)):(BK.Script.log(1,0,"set listener for notifyJSEVent redpackage not h5"),BK.MQQ.SsoRequest.addListener("sc.init_global_var.local",this,i)),BK.MQQ.SsoRequest.addListener("apollo_router_light.apollo_activity_linkcmd_query_new_redpacket",BK.QQ,BK.QQ.onNewRedPackage.bind(BK.QQ))}var hasBK=!("object"!=typeof BK),isBrowser=!hasBK;if(isBrowser){"undefined"!=typeof BK==0&&(BK={},BK.isBrowser=!0),function(t,e){if("object"==typeof t){var i=function(){var t=function(){function t(){}return t.open=function(t){e.send({url:t},"cs.openWebView.local")},t.openTransparent=function(t,i,r){void 0===i&&(i=1);var n="cs.openWebViewWithoutUrl.local";r&&(__browserMsgHdl.removeListener(n,this),__browserMsgHdl.addListener(n,this,r)),e.send({url:t},n)},t.closeTransparent=function(t){e.send({taskId:t},"cs.closeWebview.local")},t.onMessageHandle=function(t){},t}(),e=function(){function t(){}return t.ssoRequestCallBack=function(t,e,i){BK.Script.log(0,0,"ssoRequestCallBack cmd:"+e+" errCode:"+t+" data:"+JSON.stringify(i)),__dispatchEvent(t,i.cmd,JSON.stringify(i.data))},t.sendSSO=function(e,i){__browserMsgHdl.addListener("cs.ssoMessage.local",this,this.ssoRequestCallBack),t.send({cmd:i,data:JSON.stringify(e)},"cs.ssoMessage.local")},t.addListener=function(t,e,i){__browserMsgHdl.addListener(t,e,i)},t.removeListener=function(t,e){__browserMsgHdl.removeListener(t,e)},t.send=function(t,e){-1!=e.indexOf("cs.")&&-1!=e.indexOf(".local")?"undefined"!=typeof __browserMsg?__browserMsg.send(JSON.stringify(t),e):void 0!==window.webkit.messageHandlers&&window.webkit.messageHandlers.cmWebGameSend.postMessage({data:JSON.stringify(t),cmd:e}):BK.MQQ.SsoRequest.sendSSO(t,e)},t.sendWebMessage=function(e,i){t.send({cmd:i,data:JSON.stringify(e)},"sc.web_callback_game.local")},t}(),i=function(){function t(){}return t.accountCallBack=function(e,i,r){var n="0";1===r.nickname?n="1":1===r.avatar&&(n="2");var o=i+"_"+n;t.accountCallBackArr[o]&&(0,t.accountCallBackArr[o])(r.openId,r.data)},t.getNick=function(e,i){t.accountCallBackArr["cs.get_userInfo.local_1"]=i,BK.MQQ.SsoRequest.addListener("cs.get_userInfo.local",this,this.accountCallBack),BK.MQQ.SsoRequest.send({openId:e,nickname:1},"cs.get_userInfo.local")},t.getHead=function(e,i){t.accountCallBackArr["cs.get_userInfo.local_2"]=i,BK.MQQ.SsoRequest.addListener("cs.get_userInfo.local",this,this.accountCallBack),BK.MQQ.SsoRequest.send({openId:e,avatar:1},"cs.get_userInfo.local")},t.accountCallBackArr=[],t}(),r=function(){function t(){}return t.log=function(t,e,i){"undefined"!=typeof GameStatusInfo&&this.compareVersion(GameStatusInfo.QQVer,"7.6.0")>=0&&("undefined"!=typeof __browserMsg?__browserMsg.log(t,e,"webGame_log",i,""):void 0!==window.webkit.messageHandlers&&window.webkit.messageHandlers.cmWebGameLog.postMessage({level:t,errcode:e,info1:"webGame_log",info2:i,info3:""}))},t.compareVersion=function(e,i){var r=e.split("."),n=i.split("."),o=r[0]-n[0];return 0==o&&e!=i?t.compareVersion(r.splice(1).join("."),n.splice(1).join(".")):o},t}(),n=function(){function t(){}return t.base64ToUint8Array=function(t){var e,i,r,n,o,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=.75*t.length,h=t.length,c=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var l=new ArrayBuffer(s),u=new Uint8Array(l);for(e=0;e>4,u[c++]=(15&r)<<4|n>>2,u[c++]=(3&n)<<6|63&o;return u},t.upload=function(t,e,i){for(var r=t.length>1024?1024:t.length,n=new Uint8Array(r),o=0;o0&&BK.Script.log(1,1,"reportGameResult :"+t),BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){BK.QQ.checkNewRedPackage(),e&&e(t,i,r)}),BK.MQQ.SsoRequest.send(t,i)},t.sendB2CRedPacket=function(t,e){if(e){var i="sc.send_b2c_redpacket_result.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t,i,r),BK.MQQ.SsoRequest.removeListener(i,this)})}var r={groupPushData:{gameRedPacketId:1,gameId:GameStatusInfo.gameId,extraInfo:t}};BK.Script.log(1,1,"sendB2CRedPacket:"+JSON.stringify(r)),BK.MQQ.SsoRequest.send(r,"cs.send_b2c_redpacket.local"),BK.Script.log(0,0,"sendB2CRedPacket")},t}(),a=function(){function t(){}return t.close=function(){BK.MQQ.SsoRequest.sendWebMessage({},"cs.close_room.local")},t.packUp=function(){BK.MQQ.SsoRequest.sendWebMessage({},"cs.make_room_min.local")},t}(),s=function(){function t(){}return t}();return{Webview:t,SsoRequest:e,Account:i,Script:r,FileUtil:n,QQ:o,Game:a,Misc:s}}();void 0===t.MQQ&&(t.MQQ={Webview:i.Webview,SsoRequest:i.SsoRequest,Account:i.Account}),void 0===t.FileUtil&&(t.FileUtil=i.FileUtil),void 0===t.Script&&(t.Script=i.Script),void 0===t.QQ&&(t.QQ=i.QQ),void 0===t.Game&&(t.Game=i.Game),void 0===t.Misc&&(t.Misc=i.Misc)}}(BK),function(t,e){e.Script.setErrorObserver=function(t){},t._globalErrorCallback_=function(t){}}(this,BK),BK.Misc.compQQVersion||(BK.Misc.compQQVersion=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),o=0;o>4,bytes[c++]=(15&n)<<4|o>>2,bytes[c++]=(3&o)<<6|63&a;return l}function e(t,e,i){var n,o=new Uint8Array(t,e||0,i||t.byteLength),a=o.length,s="";for(n=0;n>2],s+=r[(3&o[n])<<4|o[n+1]>>4],s+=r[(15&o[n+1])<<2|o[n+2]>>6],s+=r[63&o[n+2]];return a%3==2?s=s.substring(0,s.length-1)+"=":a%3==1&&(s=s.substring(0,s.length-2)+"=="),s}function i(t){function e(t,e){var i=e.length,r={type:t};switch(t){case 0:for(a=0;i>0;){var n=Math.min(i,4096),o=new Int8Array(e.buffer,a*Int8Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,o),a+=4096,i-=4096}break;case 1:for(a=0;i>0;){var n=Math.min(i,4096),o=new Int16Array(e.buffer,a*Int16Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,o),a+=4096,i-=4096}break;case 2:for(a=0;i>0;){var n=Math.min(i,4096),o=new Int32Array(e.buffer,a*Int32Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,o),a+=4096,i-=4096}break;case 3:for(a=0;i>0;){var n=Math.min(i,4096),o=new Uint8Array(e.buffer,a*Uint8Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,o),a+=4096,i-=4096}break;case 5:for(a=0;i>0;){var n=Math.min(i,4096),o=new Uint16Array(e.buffer,a*Uint16Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,o),a+=4096,i-=4096}break;case 6:for(a=0;i>0;){var n=Math.min(i,4096),o=new Uint32Array(e.buffer,a*Uint32Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,o),a+=4096,i-=4096}break;case 7:for(var a=0;i>0;){var n=Math.min(i,4096),o=new Float32Array(e.buffer,a*Float32Array.BYTES_PER_ELEMENT,n);BK.Misc.transferArrayBuffer.apply(r,o),a+=4096,i-=4096}}}return t instanceof Int8Array==!0?e(0,t):t instanceof Int16Array==!0?e(1,t):t instanceof Int32Array==!0?e(2,t):t instanceof Uint8Array==!0?e(3,t):t instanceof Uint16Array==!0?e(5,t):t instanceof Uint32Array==!0?e(6,t):t instanceof Float32Array==!0&&e(7,t),BK.Misc.getTransferedArrayBuffer()}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";BK.Misc.BKBufferToArrayBuffer=function(e){return e.rewind(),t(BK.Misc.encodeBase64FromBuffer(e))},BK.Misc.arrayBufferToBKBuffer=function(t,i,r){var n=e(t,i,r);return BK.Misc.decodeBase64FromString(n)},BK.Misc.typedArrayToBKBuffer=function(t){return BK.Misc.transferArrayBuffer?i(t):BK.Misc.arrayBufferToBKBuffer(t.buffer,t.byteOffset,t.byteLength)}}(),enGameHallSucc=0,eReqDataLenErr=1e3,eReqMagicErr=1001,eReqFrontCmdErr=1002,eReqBackCmdErr=1003,eReqBackSrcErr=1004,eReqFromIdErr=1005,eSTDecryErr=1006,eReqDecryErr=1007,eSTExpire=1008,eSystmeErr=1009,eVerUnvalid=1010,eReqLimit=1011,eGetSvrErr=1012,eInitMemErr=2001,eQueryMemErr=2002,eUpdateMemErr=2003,eDelMemErr=2004,eGetConfigErr=2005,eNotifyCreateErr=2006,eGetRoomIdErr=2007,eCmdInvalid=2008,eRoomNotExist=2009,eInBlackList=2010,eMatchTimeOut=2011,eGetRoomErr=3e3,eRoomStatusErr=3001,eIsNotCreator=3002,eIsNotInRoom=3003,eFlushTsErr=3004,eLogoutIdErr=3005,eIsNotInSvc=3006,eUsrOverFlow=3007,eRoomOverFlow=3008,eRoomIsExist=3009,eRmvUsrErr=3010,eLoginSysErr=3011,eUsrHasLoginErr=3012,eRoomIsFullErr=3013,eCreateRoomErr=3014,ePlayerHasJoin=3015,eUgcDataAnti=3020,eFowardToClientErr=4e3,eFowardToSvrErr=4001;var DebugRecommandRoomSvrHost="139.199.216.130",DebugRecommandRoomSvrPort=10060,NormalRecommandRoomSvrHost="139.199.216.128",NormalRecommandRoomSvrPort=10060,TLVType=new Object;TLVType.Int8=33,TLVType.Uint8=34,TLVType.Int16=33,TLVType.Uint16=36,TLVType.Int32=37,TLVType.Uint32=38,TLVType.Int64=39,TLVType.Uint64=40,TLVType.Byte=41,TLVType.Double=42,TLVType.Float=43,TLVType.Int8Repeated=49,TLVType.Uint8Repeated=50,TLVType.Int16Repeated=51,TLVType.Uint16Repeated=52,TLVType.Int32Repeated=53,TLVType.Uint32Repeated=54,TLVType.Int64Repeated=55,TLVType.Uint64Repeated=56,TLVType.ByteRepeated=57,TLVType.DoubleRepeated=58,TLVType.FloatRepeated=59;var fixedHeaderLen=120,HeaderLen=12,currentGameMode=GameStatusInfo.gameMode,fromPlatform=GameStatusInfo.platform,currentAioType=GameStatusInfo.aioType,currentPlayerOpenId=GameStatusInfo.openId,isMaster=GameStatusInfo.isMaster;NETWORK_ENVIRONMENT_QQ_RELEASE=0,NETWORK_ENVIRONMENT_QQ_DEBUG=1,NETWORK_ENVIRONMENT_DEMO_DEV=2,CMSHOW_SRV_CMD_JOIN_ROOM="apollo_aio_game.join_room",CMSHOW_SRV_CMD_QUIT_GAME="apollo_aio_game.quit_room",CMSHOW_SRV_CMD_START_GAME="apollo_aio_game.start_game",CMSHOW_SRV_CMD_CANCEL_GAME="apollo_aio_game.cancel_game_room",CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC="apollo_game_openapi.custom_game_logic",CMSHOW_SRV_GET_RANK_LIST="apollo_router_game.game_rank_linkcmd_get_fri_rank_for_engine",CMSHOW_SC_CMD_STOP_GAME="sc.force_stop_game.local",CMSHOW_CS_CMD_MINI_WND="cs.make_room_min.local",CMSHOW_CS_CMD_CLOSE_WND="cs.close_room.local",CMSHOW_CS_CMD_CREATE_ROOM="cs.create_room.local",CMSHOW_CS_CMD_JOIN_ROOM="cs.join_room.local",CMSHOW_CS_CMD_SEND_GAME_MSG="cs.send_game_msg.local",CMSHOW_CS_CMD_GAME_TIPS="cs.game_tips.local",CMSHOW_CS_CMD_GET_PLAYER_DRESS="cs.get_dress_path.local",CMSHOW_CS_CMD_GAME_READY="cs.game_ready.local",CMSHOW_CS_CMD_GAME_START="cs.game_start.local",CMSHOW_CS_CMD_SAVE_RECOMM_VIP="cs.save_recommend_ip.local",CMSHOW_CS_CMD_GET_SRV_IP_PORT="cs.get_server_ip_port.local",CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE="cs.check_pubAccount_state.local",CMSHOW_CS_CMD_ENTER_PUBACCOUNT_CARD="cs.enter_pubAccount_card.local",CMSHOW_CS_CMD_SHARE_PIC="cs.share_pic.local",CMSHOW_CS_CMD_SHARE_IN_ARK="cs.share_game_in_ark.local",CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE="cs.fetch_cloud_signature.local",CMSHOW_AIO_PAUSE="sc.aio_pause.local",CMSHOW_AIO_RESUME="sc.aio_resume.local",CMD_CMSHOW_GAME_ENTER_BACKGROUND="sc.game_enter_background.local",CMD_CMSHOW_GAME_ENTER_FORGROUND="sc.game_enter_foreground.local",CMD_CMSHOW_GAME_MAXIMIZE="sc.game_maximize.local",CMD_CMSHOW_GAME_MINIMIZE="sc.game_minimize.local",CMSHOW_CS_CMD_AUDIOROOM_ENTERN="cs.audioRoom_enter.local",CMSHOW_CS_CMD_AUDIOROOM_EXIT="cs.audioRoom_exit.local",CMSHOW_CS_CMD_AUDIOROOM_UPDATEUSERINFO="cs.audioRoom_update_userinfo.local",CMSHOW_CS_CMD_AUDIOROOM_SET_MIC="cs.audioRoom_set_mic.local",CMSHOW_CS_CMD_AUDIOROOM_SET_SPEAKER="cs.audioRoom_set_speaker.local",CMSHOW_CS_CMD_AUDIOROOM_INIT="cs.audioRoom_init.local",CMSHOW_CS_CMD_AUDIOROOM_DISCONNECT="cs.audioRoom_disconnect.local",CMSHOW_CS_CMD_AUDIOROOM_CAMERASWITCH="cs.audioRoom_cameraswitch.local",CMSHOW_CS_CMD_AUDIOROOM_SET_BEAUTY="cs.audioRoom_set_beauty.local",CMSHOW_CS_CMD_AUDIOROOM_REQ_AUDIO_SESSION="cs.audioRoom_req_audio_session.local",CMSHOW_CS_CMD_LOAD_PACKAGE="cs.load_subpackage.local",CMSHOW_CS_CMD_LOAD_PERCENTAGE_NOTIFY="sc.load_percentage_nofity.local",CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK="cs.file_correctness_check.local",CMSHOW_CS_CMD_SHOW_ONE_MORE_PAGE="cs.show_one_more_page.local";var currentRenderMode,glpause;checkRenderMode=function(){0==currentRenderMode&&(BK.Script.renderMode=1,currentRenderMode=1)}(function(t,e){t.QQ=function(){return new function(){this.gameCfg=clone_(GameStatusInfo),this.gameCfg.gameId=parseInt(this.gameCfg.gameId),this.gameCfg.gameMode=0,GameStatusInfo.gameMode=0,this.hasJoinRoomSucc=!1,this.arkData={modeWording:""},this.setArkData=function(t){this.arkData.modeWording=t},this.gameCfg.roomId&&(this.gameCfg.roomId=parseInt(this.gameCfg.roomId)),1==this.gameCfg.isMaster?this.gameCfg.isCreator=!0:this.gameCfg.isCreator=!1,this.delegate={},this.ssoJoinRoomCallback,this.ssoJoinRoomCallbackPublic,BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_ENTER_BACKGROUND,this,function(){BK.Director.tickerPause()}.bind(this)),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_ENTER_FORGROUND,this,function(){BK.Director.tickerResume()}.bind(this)),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MINIMIZE,this,function(){renderTicker.paused=!0,glpause=!0}.bind(this)),BK.MQQ.SsoRequest.addListener(CMD_CMSHOW_GAME_MAXIMIZE,this,function(){renderTicker.paused=!1,glpause=!1}.bind(this)),this.queryCloudSignature=function(t){if(BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.3")){if(t){var e=JSON.parse(GameStatusInfo.extInfo),i=e.certInfo.credentials,r=i.tmpSecretId,n=i.sessionToken,o=e.certInfo.upLoadPrefUrl,a=e.certInfo.downLoadPrefUrl,s=((c=new Date).getFullYear(),c.getMonth()+1<10?c.getMonth():c.getMonth(),c.getDate(),(l=c.getTime()/1e3-1)+";"+(l+600)),h=BK.Crypt.hex_hmac_sha1(i.tmpSecretKey,s);t(0,u={tmpSecretId:r,upLoadPrefUrl:o,downloadUrl:a,sessionToken:n,signature:h,signTime:s})}}else{var c=new Date,l=parseInt(c.getTime()/1e3)-1,u={cmd:CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,now:l,delta:600};t&&(BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(u,CMSHOW_CS_CMD_QUERY_CLOUD_SIGNATURE))}},this.qGetRankBoard=function(t,e,i,r){var n={gameOrientation:t,openId:GameStatusInfo.openId,transparent:1,businessType:2,url:"http://cmshow.qq.com/apollo/html/game-platform/general-chart.html?gameId="+GameStatusInfo.gameId+"&_wwv=2&gameOrientation="+t};BK.MQQ.SsoRequest.send(n,"cs.openWebViewWithoutUrl.local")},this.qPayPurchase=function(t,e,i,r){var n=1;n=1==e?1:0;var o={gameOrientation:t,openId:GameStatusInfo.openId,transparent:n,businessType:1,itemList:i};if(r){var a="sc.apolloGameWebMessage.local";BK.MQQ.SsoRequest.removeListener(a,this),BK.MQQ.SsoRequest.addListener(a,this,function(t,e,i){0==t&&i.op&&"apolloGamePlatform.buyProps"==i.op&&r(i.data.code,i.data)}.bind(this))}BK.MQQ.SsoRequest.send(o,"cs.openWebViewWithoutUrl.local")},this.consumeItems=function(t,e){var i="apollo_game_item.consume_game_items",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){var n=[],o=[];0==t&&(n=r.data.succList,o=r.data.failList),e(t,n,o)}.bind(this))),BK.MQQ.SsoRequest.send(r,i)},this.rollbackGameItems=function(t,e){var i="apollo_game_item.rollback_game_items",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,items:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){var n=[],o=[];0==t&&(n=r.data.succList,o=r.data.failList),e(t,n,o)}.bind(this))),BK.MQQ.SsoRequest.send(r,i)},this.shareToMQQ=function(t,e,i,r){var n="cs.share_game_result.local",o={cmd:n,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,gameVersion:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,title:t,summary:e,detailUrl:i,picUrl:r};BK.MQQ.SsoRequest.send(o,n)},this.scoreUpload=function(t,e,i){BK.Script.log(1,1,"成绩上报 scoreData:"+JSON.stringify(t));var r="apollo_aio_game.report_user_score_3rd",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,gData:t,src:GameStatusInfo.src};i&&(n.arkData=i),e&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,e)),BK.MQQ.SsoRequest.send(n,r)},this.getRoomUserScoreInfo=function(t,e){var i="apollo_aio_game.get_room_info_3rd",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,roomId:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},this.getUserGameinfo=function(t,e,i){var r="apollo_aio_game.get_user_gameinfo_3rd",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,roomId:GameStatusInfo.roomId,toOpenId:t,cycleNum:e};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.send(n,r)},this.getUserCurrencyInfo=function(t,e){var i="apollo_aio_game.get_user_curreInfo",r={cmd:i,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,mask:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},this.getCmshowDressInfo=function(t,e){var i="cs.get_dress_path.local";e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e));var r={openId:t};BK.MQQ.SsoRequest.send(r,"cs.get_dress_path.local")},this.getGameItemList=function(t){var e="apollo_aio_game.get_game_itemList",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(i,e)},this.getUserGameItems=function(t){var e="apollo_aio_game.get_user_game_items",i={cmd:e,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(i,e)},this.buyGameItems=function(t,e,i){var r="apollo_aio_game.buy_game_items",n={cmd:r,from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,curreType:t,itemIdList:e};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.send(n,r)},this.notifyNewRoom=function(t,e){var i={gameId:this.gameCfg.gameId,roomId:t,retcode:e};this.gameCfg.roomId||(this.gameCfg.roomId=t),BK.Script.log(0,0,"BK.QQ.notifyNewRoom!gameId = "+i.gameId+", roomId = "+i.roomId+", retCode = "+e),BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_CREATE_ROOM)},this.notifyHideGame=function(){var t={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyHideGame!gameId = "+t.gameId+", roomId = "+t.roomId),1==("android"==GameStatusInfo.platform?1:2)&&(BK.Script.renderMode=0,currentRenderMode=0),BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_MINI_WND)},this.notifyCloseGame=function(){this._closeRoom();var t={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyCloseGame!gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_CLOSE_WND)},this.notifyReadyGame=function(){var t={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_GAME_READY)},this.notifyGameTips=function(t){var e={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId,tips:t};BK.MQQ.SsoRequest.send(e,CMSHOW_CS_CMD_GAME_TIPS)},this.notifyGameTipsWaiting=function(){this.notifyGameTips("等待玩家加入")},this.notifyGameTipsSomeOneJoinRoom=function(t){this.notifyGameTips(t+"加入房间")},this.notifyGameTipsSomeOneLeaveRoom=function(t){this.notifyGameTips(t+"离开房间")},this.notifyGameTipsReady=function(){this.notifyGameTips("游戏即将开始")},this.notifyGameTipsPlaying=function(){this.notifyGameTips("游戏进行中")},this.notifyGameTipsGameOver=function(){this.notifyGameTips("游戏已结束")},this.inviteFriend=function(t,e){var i="cs.invite_friends.local",r={cmd:i,wording:t,gameId:this.gameCfg.gameId,gameMode:8,extendInfo:{}};e&&(r.roomId=e),BK.MQQ.SsoRequest.send(r,i)},this.uploadData=function(t,e,i,r,n,o){var a="cs.report_data_2_compass.local",s=this.gameCfg.gameId;"ios"==this.gameCfg.platform&&(t=t.toString(),i=i.toString());var h={cmd:a,actionName:t,enter:e,entry:e,result:i,r2:s.toString(),r3:r,r4:n,r5:o};BK.MQQ.SsoRequest.send(h,a)},this.sharePic=function(t){var e={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId,path:t};BK.MQQ.SsoRequest.send(e,CMSHOW_CS_CMD_SHARE_PIC)};var t={},e={};this.loadPackage=function(i,r,n){if(!GameStatusInfo||"xcode"===GameStatusInfo.devPlatform)return BK.Script.log(1,1,"bk.qq.loadpackage xcode demo ."),r(i,0);var o=GameStatusInfo.QQVer.split(".");if(Number(o[0])<7||7==Number(o[0])&&Number(o[1])<7||7==Number(o[0])&&7==Number(o[1])&&Number(o[2])<5)return BK.Script.log(1,1,"bk.qq.loadpackage old version before 775 ."),r(i,0);var a={xyId:GameStatusInfo.gameId,packName:i};r&&(t[i]=r),n&&(e[i]=n),BK.MQQ.SsoRequest.send(a,CMSHOW_CS_CMD_LOAD_PACKAGE)},this.onLoadPackageFinish=function(e,i,r){BK.Script.log(0,0,"BK.QQ.onLoadPackageFinish errCode = "+e+" cmd = "+i+" data = "+JSON.stringify(r)),r.packName&&t[r.packName]&&(t[r.packName](r.packName,r.result),t[r.packName]=void 0)},BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_LOAD_PACKAGE,this,this.onLoadPackageFinish.bind(this)),this.onLoadPackagePercentage=function(t,i,r){BK.Script.log(0,0,"BK.QQ.onLoadPackagePercentage errCode = "+t+" cmd = "+i+" data = "+JSON.stringify(r)),r.packName&&e[r.packName]&&(e[r.packName](r.packName,r.percentage),e[r.packName]=void 0)},BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_LOAD_PERCENTAGE_NOTIFY,this,this.onLoadPackagePercentage.bind(this)),this.checkPakcage=function(t,e){var i={xyId:GameStatusInfo.gameId,packName:t};this.checkpakcageCallback=e,BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK,this,this._evnet4Checkpackage.bind(this)),BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK)},this.checkpakcageCallback=void 0,this._evnet4Checkpackage=function(t,e,i){BK.Script.log(0,0,"BK.QQ._evnet4Checkpackage!errCode = "+t+", cmd = "+e+", data = "+JSON.stringify(i)),this.checkpakcageCallback&&this.checkpakcageCallback(i.packName,i.result),this.checkpakcageCallback=void 0,BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_FILE_CORRECTNESS_CHECK,this)},this.addSSOJoinRoomCallBack=function(t){this.ssoJoinRoomCallbackPublic=t},this.checkPubAccountState=function(t,e){e&&(BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE,this,e));var i=CMSHOW_CS_CMD_CHECK_PUBACCOUNT_STATE,r={cmd:i,puin:t};BK.MQQ.SsoRequest.send(r,i)},this.enterPubAccountCard=function(t){var e=CMSHOW_CS_CMD_ENTER_PUBACCOUNT_CARD,i={cmd:e,puin:t};BK.MQQ.SsoRequest.send(i,e)},this.fetchOpenKey=function(t){var e="cs.on_get_open_key.local",i={gameId:GameStatusInfo.gameId};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(i,e)},this.listenGameEventEnterBackground=function(t,e){var i="sc.game_enter_background.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this.listenGameEventEnterForeground=function(t,e){var i="sc.game_enter_foreground.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this.listenGameEventMaximize=function(t,e){var i="sc.game_maximize.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this.listenGameEventMinimize=function(t,e){var i="sc.game_minimize.local";e&&(BK.MQQ.SsoRequest.removeListener(i,t),BK.MQQ.SsoRequest.addListener(i,t,e))},this._event4GetVIPInfo=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4GetVIPInfo!errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.delegate.onGetVIPInfoEvent&&this.delegate.onGetVIPInfoEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_SRV_IP_PORT,this)},this.notifyGetVIPInfo=function(){BK.MQQ.SsoRequest.send({},CMSHOW_CS_CMD_GET_SRV_IP_PORT),BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_SRV_IP_PORT,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_GET_SRV_IP_PORT,this,this._event4GetVIPInfo.bind(this))},this.notifySaveRecommVIP=function(t,e){BK.Script.log(0,0,"BK.QQ.notifySaveRecommVIP!ip = "+t+", port = "+e);var i={gameId:this.gameCfg.gameId,roomId:this.game.roomId,ip:t,port:e};BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_SAVE_RECOMM_VIP)},this._event4GetPlayerDress=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4GetPlayerDress!errCode = "+t+", cmd = "+e+", data = "+JSON.stringify(i)),this.delegate.onGetPlayerDressEvent&&this.delegate.onGetPlayerDressEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_PLAYER_DRESS,this)},this.notifyGetPlayerDress=function(t){var e={openId:t};BK.MQQ.SsoRequest.removeListener(CMSHOW_CS_CMD_GET_PLAYER_DRESS,this),BK.MQQ.SsoRequest.addListener(CMSHOW_CS_CMD_GET_PLAYER_DRESS,this,this._event4GetPlayerDress.bind(this)),BK.MQQ.SsoRequest.send(e,CMSHOW_CS_CMD_GET_PLAYER_DRESS)},this._startGameLocal=function(t,e){var i={gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId,resp:e,retcode:t,gameMode:this.gameCfg.gameMode};BK.MQQ.SsoRequest.send(i,CMSHOW_CS_CMD_GAME_START)},this.notifyJoinRoom=function(t,e,i){t&&t.length>0?t.forEach(function(t){var r=t.openId==currentPlayerOpenId;BK.Script.log(1,1,"player.openid="+t.openId+" currentPlayerOpenId="+currentPlayerOpenId);var n=0;e&&e.data&&e.data.avRoomId&&(n=e.data.avRoomId);var o=0;e&&e.data&&e.data.sdkAppId&&(o=e.data.sdkAppId);var a=0;e&&e.data&&e.data.accountType&&(a=e.data.accountType);var s={gameId:this.gameCfg.gameId,openId:t.openId,isCreator:this.gameCfg.isCreator&&t.openId==currentPlayerOpenId?1:0,roomId:this.gameCfg.roomId,resp:e,retcode:i,gameMode:this.gameCfg.gameMode,avRoomId:n,sdkAppId:o,accountType:a,isMine:r,isDisableSendMsg:1};BK.Script.log(0,0,"BK.QQ.notifyJoinroom isDisableSendMsg: "+s.isDisableSendMsg),BK.MQQ.SsoRequest.send(s,CMSHOW_CS_CMD_JOIN_ROOM)},this):BK.Script.log(0,0,"BK.QQ.notifyJoinRoom!newJoinPlayers data error")},this.sendGameMsg=function(){if(this.gameCfg.roomId&&this.gameCfg.roomId>0){var t={gameId:this.gameCfg.gameId,openId:GameStatusInfo.openId,roomId:this.gameCfg.roomId,gameMode:this.gameCfg.gameMode};BK.Script.log(0,0,"SendGameMsg : gameId="+t.gameId+" openId="+t.openId+" roomId="+t.roomId+" gameMode="+t.gameMode),BK.MQQ.SsoRequest.send(t,CMSHOW_CS_CMD_SEND_GAME_MSG)}},this.shareToArk=function(t,e,i,r,n,o){if(BK.Misc.compQQVersion(GameStatusInfo.QQVer,"7.6.3"))this._oldShareToArk(t,e,i,r,n,o);else{var a={summary:e,extendInfo:n,localPicPath:"",picUrl:"",activityId:0,reqCode:1};0==i.indexOf("GameRes://")||0==i.indexOf("GameSandBox://")?a.localPicPath=i:a.picUrl=i,this._share(a,o)}},this._share=function(t,e){if(t.inner=1,t.localPicPath){if(e){var i="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t,i,r),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(i,this)}.bind(this))}BK.Script.log(0,0,"share "+JSON.stringify(t)),BK.MQQ.SsoRequest.send(t,"cs.game_shell_share_callback.local")}else{var r="轻游戏";t.gameName&&(r=t.gameName);var n="一起来玩游戏吧~";t.summary&&(n=t.summary),BK.QQ.defaultSharePic(r,n,function(i,r,n){if(e){var o="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(o,this),BK.MQQ.SsoRequest.addListener(o,this,function(t,i,r){e(t,i,r),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(i,this)}.bind(this))}0==i&&(t.localPicPath=n),BK.Script.log(0,0,"share with default pic"+JSON.stringify(t)),BK.MQQ.SsoRequest.send(t,"cs.game_shell_share_callback.local")}.bind(this))}},this.share=function(t,e){this._share(t,function(t,i,r){if(0==t){var n=r.ret,o=r.shareTo,a=1==r.isFirstShare;e(n,o,a)}else e(t,-1,!1)}.bind(this))},this.shareUpload=function(t){var e=t.toString();BK.QQ.uploadData("clickShowOffButton","",e,"","","")},this._oldShareToArk=function(t,e,i,r,n,o){"boolean"==typeof r&&(r=1==r?1:0);var a={summary:e,picUrl:i,gameId:this.gameCfg.gameId,roomId:t,gameMode:this.gameCfg.gameMode,isSelectFriend:r,extendInfo:n};if(o){var s="sc.share_game_to_friend_result.local";BK.MQQ.SsoRequest.removeListener(s,this),BK.MQQ.SsoRequest.addListener(s,this,function(t,e,i){o(t,e,i),this.shareUpload(0==t?0:1),BK.MQQ.SsoRequest.removeListener(e,this)}.bind(this))}BK.Script.log(0,0,"ShareToArk summary="+a.summary+" roomId="+a.roomId+" gameMode="+a.gameMode+"picUrl="+a.picUrl+" gameId="+a.gameId),BK.MQQ.SsoRequest.send(a,CMSHOW_CS_CMD_SHARE_IN_ARK)},this.sendB2CRedPacket=function(t,e){if(e){var i="sc.send_b2c_redpacket_result.local";BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t,i,r),BK.MQQ.SsoRequest.removeListener(i,this)}.bind(this))}var r={groupPushData:{gameRedPacketId:1,gameId:GameStatusInfo.gameId,extraInfo:t}};BK.Script.log(1,1,"sendB2CRedPacket:"+JSON.stringify(r)),BK.MQQ.SsoRequest.send(r,"cs.send_b2c_redpacket.local"),BK.Script.log(0,0,"sendB2CRedPacket")},this.createShortCut=function(t,e){var i="";t&&(i=t);var r={extendInfo:i};if(e){var n="cs.create_xy_shortcut.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,function(t,i,r){e(t,i,r),BK.MQQ.SsoRequest.removeListener(i,this)}.bind(this))}BK.MQQ.SsoRequest.send(r,"cs.create_xy_shortcut.local"),BK.Script.log(0,0,"createShortCut")},this.defaultSharePic=function(t,e,i){t||(t="轻游戏"),e||(e="一起来玩吧!");var r=1;if(BK.FileUtil.isFileExist("GameRes://inviteIcon.png")){var n=BK.Image.loadImage("GameRes://inviteIcon.png");if(n){var o=n.height,a=n.width;r=Math.abs(o/a-304/540)<.01?3:2}else BK.Script.log(1,1,"defaultSharePic loadImage inviteIcon failed.")}else r=1;1==r?i(-1,r,null):3==r?this.generateQRCodeAnd169(t,e,function(t,e){i(t,r,e)}.bind(this),"GameSandBox://shareDefault.png"):i(-1,r,null)},this.generateQRCodeAnd169=function(t,e,i,r){i(0,this.composeShare(t,e,"GameRes://inviteIcon.png","GameRes://share_logo.png",r))},this.composeShare=function(t,e,i,r,n){var o="GameSandBox://compose.png";n&&(o=n);var a=BK.Image.loadImage(i),s=new BK.Canvas(750,750);if(s.fillColor={r:1,g:1,b:1,a:1},s.fillRect(0,0,750,750),BK.FileUtil.isFileExist(r)){s.drawImage(r,0,0,125,28,32,32,126,27)}a&&s.drawImage(i,0,0,a.width,a.height,0,330,750,420);s.fillColor={r:0,g:0,b:0,a:1},s.drawStyle=0,s.setTextAlign(1),s.setTextSize(40),s.textBaseLine="bottom",s.textAlign="left",s.fillText(t,35,258);s.fillColor={r:137/255,g:137/255,b:137/255,a:.5},s.drawStyle=0,s.setTextAlign(1),s.setTextSize(30),s.textBaseLine="bottom",s.textAlign="left",s.fillText(e,35,215);s.fillColor={r:1,g:1,b:1,a:1};var h=this.generatePureQRCode();s.drawImage(h,0,0,256,256,600,64,120,120);return s.fillColor={r:0,g:0,b:0,a:1},s.drawStyle=0,s.setTextAlign(1),s.setTextSize(19),s.textBaseLine="bottom",s.textAlign="left",s.fillText("长按扫码即玩",600,28),s.saveTo(o),s.dispose(),o},this.generatePureQRCode=function(t){var e="GameSandBox://qrcode.png";t&&(e=t);var i={width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2},r="http://cmshow.qq.com/apollo/html/game-platform/scan-game.html?gameId="+GameStatusInfo.gameId.toString()+"&src=203";return BK.QRCode.createQRCodeToFile(e,r,i),e},this._event4QuitGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4QuitGame errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.delegate.onQuitGameEvent&&this.delegate.onQuitGameEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_QUIT_GAME,this)},this._event4CancelGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4CancelGame errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.delegate.onCancelGameEvent&&this.delegate.onCancelGameEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CANCEL_GAME,this)},this.notifyQuitGameSrv=function(){var t={cmd:CMSHOW_SRV_CMD_QUIT_GAME,from:this.gameCfg.platform,gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyQuitGameSrv!, cmd = "+t.cmd+", from = "+t.from+", gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_QUIT_GAME,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_QUIT_GAME,this,this._event4QuitGame.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_QUIT_GAME)},this.notifyCancelGameSrv=function(){var t={cmd:CMSHOW_SRV_CMD_CANCEL_GAME,from:this.gameCfg.platform,gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyCancelGameSrv!, cmd = "+t.cmd+", from = "+t.from+", gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CANCEL_GAME,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_CANCEL_GAME,this,this._event4CancelGame.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_CANCEL_GAME)},this._event4StartGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4StartGame! errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.hasStartGameSucc=0==t,this._startGameLocal(t,i),this.delegate.onStartGameEvent&&this.delegate.onStartGameEvent(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_START_GAME,this)},this.notifyStartGameSrv=function(){var t={cmd:CMSHOW_SRV_CMD_START_GAME,from:this.gameCfg.platform,gameId:this.gameCfg.gameId,roomId:this.gameCfg.roomId};BK.Script.log(0,0,"BK.QQ.notifyStartGameSrv!, cmd = "+t.cmd+", from = "+t.from+", gameId = "+t.gameId+", roomId = "+t.roomId),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_START_GAME,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_START_GAME,this,this._event4StartGame.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_START_GAME)},this._event4JoinRoom=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4JoinRoom errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this.hasJoinRoomSucc=0==t,this.delegate.onJoinRoomEvent&&this.delegate.onJoinRoomEvent(t,e,i),BK.QQ.notifyJoinRoom(this.newJoinPlayers,i,t),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_JOIN_ROOM,this),this.ssoJoinRoomCallback&&this.ssoJoinRoomCallback(t,e,i),this.ssoJoinRoomCallbackPublic&&(i.gameId=this.gameCfg.gameId,i.gameRoomId=this.gameCfg.roomId,i.avRoomId=i.data.avRoomId?i.data.avRoomId:0,i.sdkAppId=i.data.sdkAppId?i.data.sdkAppId:0,i.accountType=i.data.accountType?i.data.accountType:0,this.ssoJoinRoomCallbackPublic(t,e,i))},this.notifyNewOrJoinRoomSrv=function(t,e,i,r){var n={cmd:CMSHOW_SRV_CMD_JOIN_ROOM,from:this.gameCfg.platform,aioType:this.gameCfg.aioType,gameId:this.gameCfg.gameId,version:this.gameCfg.gameVersion,roomId:e,opType:i,gameMode:this.gameCfg.gameMode,roomVol:this.roomVol,arkData:this.arkData,src:r};BK.Script.log(1,1,"BK.QQ.notifyNewOrJoinRoomSrv!, cmd = "+n.cmd+", from = "+n.from+", aioType = "+n.aioType+", gameId = "+n.gameId+", version = "+n.version+", roomId = "+n.roomId+", opType = "+n.opType),this.newJoinPlayers=t,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_JOIN_ROOM,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_JOIN_ROOM,this,this._event4JoinRoom.bind(this)),BK.MQQ.SsoRequest.send(n,CMSHOW_SRV_CMD_JOIN_ROOM)},this._customGameLogicCallBack=void 0,this._event4CustomLogic=function(t,e,i){void 0!=this._customGameLogicCallBack&&this._customGameLogicCallBack(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC,this)},this.reqCustomLogic=function(t,e){void 0!=t?(this._customGameLogicCallBack=e,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC,this,this._event4CustomLogic.bind(this)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CMD_CUSTOM_GAME_LOGIC)):BK.Script.log(0,0,"reqCustomLogic data undefined!")},this._getRankListLogicCallBack=void 0,this._event4GetRankList=function(t,e,i){BK.Script.log(1,1,"BK.QQ.reqGetRankList! callback cmd"+e+" errCode:"+t+" data:"+JSON.stringify(i)),void 0!=this._getRankListLogicCallBack&&this._getRankListLogicCallBack(t,e,i),BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_GET_RANK_LIST,this)},this.getRankList=function(t,e){var i={cmd:CMSHOW_SRV_GET_RANK_LIST,from:"default",objType:1,objId:0,busType:3,busId:this.gameCfg.gameId.toString()};e&&(e.objType&&(i.objType=e.objType),e.objId&&(i.objId=e.objId),e.from&&(i.from=e.from)),BK.Script.log(1,1,"BK.QQ.reqGetRankList! "+JSON.stringify(i)),void 0!=i?(this._getRankListLogicCallBack=t,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_GET_RANK_LIST,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_GET_RANK_LIST,this,this._event4GetRankList.bind(this)),BK.MQQ.SsoRequest.send(i,CMSHOW_SRV_GET_RANK_LIST)):BK.Script.log(0,0,"reqGetRankList data undefined!")},this._pushPublicMsgCallBack=void 0,this._event4PushPublicMsg=function(t,e,i){BK.Script.log(1,1,"BK.QQ.pushPublicMsg! callback cmd"+e+" errCode:"+t+" data:"+JSON.stringify(i)),void 0!=this._pushPublicMsgCallBack&&this._pushPublicMsgCallBack(t,e,i)},this.pushPublicMsg=function(t,e){var i={gameid:this.gameCfg.gameId,templateid:e.templateid,report_ts:e.report_ts,tmpl_param:e.tmpl_param};BK.Script.log(1,1,"BK.QQ.pushPublicMsg! "+JSON.stringify(i)),void 0!=i?(this._pushPublicMsgCallBack=t,BK.MQQ.SsoRequest.removeListener(CMSHOW_SRV_PUSH_PUBLIC_MSG,this),BK.MQQ.SsoRequest.addListener(CMSHOW_SRV_PUSH_PUBLIC_MSG,this,this._event4PushPublicMsg.bind(this)),BK.MQQ.SsoRequest.send(i,CMSHOW_SRV_PUSH_PUBLIC_MSG)):BK.Script.log(0,0,"pushPublicMsg data undefined!")},this.hasJoinRoom=function(){return this.hasJoinRoomSucc},this.hasStartGame=function(){return this.hasStartGameSucc},this._event4StopGame=function(t,e,i){BK.Script.log(0,0,"BK.QQ._event4StopGame!errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),this._closeRoom(),this.delegate.onStopGameEvent&&this.delegate.onStopGameEvent(t,e,i)},this._closeRoom=function(t){BK.QQ.isNeedSSOServer=void 0==t||null==t||t,1==Boolean(BK.QQ.isNeedSSOServer)&&(this.hasStartGameSucc||this.gameCfg.roomId&&0!=this.gameCfg.roomId&&(this.gameCfg.isCreator?this.notifyCancelGameSrv():this.notifyQuitGameSrv()))},this.uploadScoreWithoutRoom=function(t,e,i){var r="apollo_report_result.single_user_result",n=Math.floor((new Date).getTime()/1e3),o={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,aioType:GameStatusInfo.aioType,ts:n.toString(),src:GameStatusInfo.src,mode:void 0!==t?t:1,userData:e.userData,attr:e.attr};i&&(BK.MQQ.SsoRequest.removeListener(r,this),BK.MQQ.SsoRequest.addListener(r,this,i)),BK.MQQ.SsoRequest.send(o,r)},this.getRankListWithoutRoom=function(t,e,i,r){var n="apollo_router_game.apollo_user_rankinglist_linkcmd_custom_ranking",o=Math.floor((new Date).getTime()/1e3),a={from:GameStatusInfo.platform,gameId:GameStatusInfo.gameId,openId:GameStatusInfo.openId,version:GameStatusInfo.gameVersion,ts:o.toString(),attr:void 0!==t?t:"score",order:void 0!==e?e:1,rankType:void 0!==i?i:0};r&&(BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,r)),BK.MQQ.SsoRequest.send(a,n)},this.saveGameData=function(t,e){var i="apollo_private_data.set_user_data",r=Math.floor((new Date).getTime()/1e3),n={openId:GameStatusInfo.openId,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,from:GameStatusInfo.platform,ts:r.toString(),data:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(n,i)},this.loadGameData=function(t){var e="apollo_private_data.get_user_data",i=Math.floor((new Date).getTime()/1e3),r={openId:GameStatusInfo.openId,gameId:GameStatusInfo.gameId,version:GameStatusInfo.gameVersion,from:GameStatusInfo.platform,ts:i.toString()};t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)),BK.MQQ.SsoRequest.send(r,e)},this.reportGameResult=function(t,e){var i="apollo_router_game.apollo_reportcm_linkcmd_game_result";t.gameId=GameStatusInfo.gameId,GameStatusInfo.isWhiteUser>0&&BK.Script.log(1,1,"reportGameResult :"+t),BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){this.checkNewRedPackage(),e&&e(t,i,r)}.bind(this)),BK.MQQ.SsoRequest.send(t,i)},this.updateScoreLocal=function(t){BK.MQQ.SsoRequest.send({gameId:GameStatusInfo.gameId,score:t},"cs.game_update_score.local")},this.getRedPacketResult=function(t,e){var i="cs.get_redPacket_result.local";e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send({gameId:GameStatusInfo.gameId,score:t},i)},this.listenRedPacketEvent=function(t){var e="sc.web_callback_game.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t))},this.skipGame=function(t,e){var i={xyId:t,extendInfo:e,src:302};BK.MQQ.SsoRequest.send(i,"cs.create_xy.local");var r=new Date,n=r.getFullYear(),o=r.getMonth()+1,a=r.getDate(),s=r.getHours(),h=""+n+(o=(""+o).length<2?"0"+o:o)+(a=""+a<2?"0"+a:a)+(s=""+s<2?"0"+s:s);BK.QQ.uploadData("gameAtoB","302",1,t,h,"")},BK.MQQ.SsoRequest.addListener(CMSHOW_SC_CMD_STOP_GAME,this,this._event4StopGame.bind(this)),CMSHOW_SRV_CHECK_NEW_RED_PACKAGE="apollo_router_light.apollo_activity_linkcmd_query_new_redpacket",GameStatusInfo.commFlagBits||(GameStatusInfo.commFlagBits=0),BK.Script.log(1,1,"redPackage commonFlagBits : "+GameStatusInfo.commFlagBits),this.isUserInRedPackageActivity=function(){var t=GameStatusInfo.commFlagBits>>1&1;return t=t&&310!==GameStatusInfo.src,BK.Script.log(1,1,"redPackage isUserInRedPackageActivity: "+t),t},this.isOpenActivityPage=function(){var t=GameStatusInfo.commFlagBits>>2&1;return t=t&&310!==GameStatusInfo.src,BK.Script.log(1,1,"redPackage isOpenActivityPage: "+t),t},this.showRedPackageActivityPage=function(){BK.Director.ticker.setTimeout(function(){var t="http://cmshow.qq.com/act_apollo/h5_act/gameRedPacket/html/popup.html?game_id="+GameStatusInfo.gameId+"&page=ad&_cwv=1&wv=3&adtag=engine";BK.MQQ.Webview.openTransparent(t)}.bind(this),100,this)},this.checkNewRedPackage=function(){if(this.isUserInRedPackageActivity()){var t={cmd:CMSHOW_SRV_CHECK_NEW_RED_PACKAGE,gameId:GameStatusInfo.gameId.toString()};BK.Script.log(1,1,"redPackage 发送新红包检查:"+JSON.stringify(t)),BK.MQQ.SsoRequest.send(t,CMSHOW_SRV_CHECK_NEW_RED_PACKAGE)}},this.onNewRedPackage=function(t,e,i){if(BK.Script.log(0,0,"BK.QQ.onNewRedPackage redPackage errCode = "+t+" cmd = "+e+" data = "+JSON.stringify(i)),0==t)if(i.data&&i.data.redPacket&&i.data.redPacket.actId&&i.data.redPacket.taskId){var r=i.data.redPacket,n="http://cmshow.qq.com/act_apollo/h5_act/gameRedPacket/html/popup.html?game_id="+GameStatusInfo.gameId+"&page=task&task_id="+r.taskId+"&_cwv=1&wv=3&adtag=engine";BK.MQQ.Webview.openTransparent(n)}else BK.Script.log(1,1,"request new red package redPackage ,没有新红包任务触发");else BK.Script.log(1,1,"request new red package Failed! redPackage ErrCode:"+t)}}}()}(BK)),BK.Room=function(){this.roomId,this.gameId,this.mId,this.ownerId,this.createTs,this.status,this.playerNum,this.ip0,this.ip1,this.msgSeq=1,this.ackSeq,this.lastFrame=0,this.startGameTs=0,this.createRoomCallBack,this.queryRoomInfoCallBack,this.joinRoomCallBack,this.leaveRoomCallBack,this.startGameCallBack,this.broadcastDataCallBack,this.sensitiveWordCallBack,this.setUserDataCallBack,this.getUserDataCallBack,this.sendSyncOptCallBack,this.forceStopGameCallBack,this.frameSyncListener,this.queryFrameDataCallBack,this.matchGameCallBack,this.queryMatchGameCallBack,this.quitMatchGameCallBack,this.disconnectNetCallBack,this.reJoinRoomCallBack,this.socket=new BK.Socket,this.reqArray=new Array,this.newJoinPlayers=[],this.currentPlayers=[],this.isCreator=1==GameStatusInfo.isMaster,this.gameStatusInfo=GameStatusInfo,this.serverConnected,this._environment=GameStatusInfo.isWhiteUser,this.headerVersion=769,this.recommandRoomSvrHost=NormalRecommandRoomSvrHost,this.recommandRoomSvrPort=NormalRecommandRoomSvrPort,this.netTimeOutTs=0,this.options=null,this.setArkData=function(t){BK.QQ.setArkData(t)},this.setRoomVol=function(t){BK.QQ.roomVol=t},this.read32BytesToString=function(t){for(var e="",i=0;i<32;i++){var r=t.readUint8Buffer();e+=String.fromCharCode(r)}return e},this.writeOpenIdIntoBuffer=function(t,e){var i=new BK.Buffer(32);if(32==e.length)for(n=0;n<32;n++){var r=e.charCodeAt(n);i.writeUint8Buffer(r)}else{for(var n=0;n<32;n++)i.writeUint8Buffer(0);BK.Script.log(0,0,"writeOpenIdIntoBuffer.length is not 32 bytes,Write empty data")}t.writeBuffer(i)},this.addHeader=function(t,e,i){t.writeUint16Buffer(4660),t.writeUint16Buffer(this.headerVersion),t.writeUint16Buffer(0),t.writeUint16Buffer(i),t.writeUint32Buffer(e)},this.addFixedHeader=function(t,e,i,r,n,o,a,s,h){void 0==o&&(o=""),void 0==a&&(a=0),void 0==s&&(s=0),void 0==h&&(h=0),t.writeUint16Buffer(72),t.writeUint16Buffer(e),t.writeUint32Buffer(0),t.writeUint64Buffer(1111),t.writeUint64Buffer(i),t.writeUint64Buffer(r),this.writeOpenIdIntoBuffer(t,n),this.writeOpenIdIntoBuffer(t,o),t.writeUint64Buffer(a),t.writeUint64Buffer(s),t.writeUint64Buffer(h)},this.getHeader=function(t){var e=t.readUint16Buffer(),i=t.readUint16Buffer(),r=t.readUint16Buffer(),n=t.readUint16Buffer(),o=t.readUint32Buffer(),a=new Object;return a.magic=e,a.ver=i,a.stlen=n,a.bodyLen=o,a.seq=r,a},this.getFixedHeader=function(t){var e=t.readUint16Buffer(),i=t.readUint16Buffer(),r=t.readUint32Buffer(),n=t.readUint64Buffer(),o=t.readUint64Buffer(),a=t.readUint64Buffer(),s="",h="";s=this.read32BytesToString(t),h=this.read32BytesToString(t);var c=t.readUint64Buffer(),l=t.readUint64Buffer(),u=t.readUint64Buffer(),d=new Object;return d.fixLen=e,d.cmd=i,d.ret=r,d.date=n,d.gameId=o,d.roomId=a,d.fromId=s,d.toId=h,d.token=c,d.appId=l,d.accessToken=u,d},this.getRequestCommonBuffer=function(t,e,i,r,n,o,a){var s,h,c=0;if(a&&(a.rewind(),c=a.length),h=new BK.Stream(BK.Security.getST()),s=new BK.Stream(fixedHeaderLen+c+n,1),this.addFixedHeader(s,t,e,i,r),c>0)for(u=0;u0)for(var l=new BK.Stream(o.bkJSTLVGetBuffer()),u=0;u=0&&(BK.Script.log(0,0,"rejoinroom send"),this.joinRoom(1,function(t,e){BK.Script.log(0,0,"rejoinroom statusCode:"+t+" roomid is "+e.roomId),this.reJoinRoomCallBack&&this.reJoinRoomCallBack(t,this)}))},this.leaveRoom=function(t,e){void 0==e&&(e=-1);var i=new Object;i.cmd=4,i.arg0=e,this.reqArray.push(i),this.leaveRoomCallBack=t,BK.Script.log(0,0,"leaveRoom push")},this.setLeaveRoomCallback=function(t){this.leaveRoomCallBack=t},this.requestLeaveRoom=function(t){var e=new BK.TLV(44),i=new BK.Buffer(40,1);this.writeOpenIdIntoBuffer(i,this.mId),i.writeUint64Buffer(t),e.bkJSTLVWriteBuffer(i,TLVType.Byte,201);var r=new BK.Buffer(fixedHeaderLen+e.bkJSTLVGetLength(),1);this.addFixedHeader(r,4,this.gameId,this.roomId,this.mId),r.writeBuffer(e.bkJSTLVGetBuffer());var n=BK.Security.getST(),o=n.bufferLength();return BK.Security.encrypt(r),buff=new BK.Buffer(HeaderLen+r.bufferLength()+o,1),this.addHeader(buff,r.bufferLength(),o),buff.writeBuffer(n),buff.writeBuffer(r),BK.Script.log(0,0,"leave room buffer : "+buff.bufferLength()+" body len:"+r.bufferLength()),buff},this._startGame=function(t){this.startGameCallBack=t;var e=new Object;e.cmd=8,this.reqArray.push(e),BK.Script.log(0,0,"startGame push")},this.startGame=function(t){GameStatusInfo.devPlatform?(BK.Script.log(0,0,"startGame dev:"),this._startGame(t)):1==BK.QQ.hasJoinRoomSucc?(BK.Script.log(0,0,"startGame qq:cmsrv confirm joinRoom response"),this._startGame(t)):(BK.Script.log(0,0,"startGame qq:waiting cmsvr joiroom response"),BK.QQ.delegate.onJoinRoomEvent=function(e,i,r){BK.Script.log(0,0,"startGame qq:wait finish.start Game"),this._startGame(t)}.bind(this))},this.setStartGameCallback=function(t){this.startGameCallBack=t},this.requestStartGame=function(){var t=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(t,8,this.gameId,this.roomId,this.mId);var e=BK.Security.getST();BK.Security.encrypt(t);var i=e.bufferLength(),r=new BK.Buffer(HeaderLen+t.bufferLength()+i,1);return this.addHeader(r,t.bufferLength(),i),r.writeBuffer(e),r.writeBuffer(t),r},this.setBroadcastDataCallBack=function(t){this.broadcastDataCallBack=t},this.sendBroadcastData=function(t){var e=new Object;e.cmd=1,e.arg0=t,this.reqArray.push(e)},this.requestsendBroadcastData=function(t){var e=t.capacity?t.capacity:t.bufferLength(),i=new BK.Buffer(fixedHeaderLen+e,1);this.addFixedHeader(i,1,this.gameId,this.roomId,this.mId),i.writeBuffer(t);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),o},this.setSensitiveWordCallBack=function(t){this.sensitiveWordCallBack=t},this.sendSensitiveWordData=function(t){var e=new Object;e.cmd=50,e.arg0=t,this.reqArray.push(e)},this.requestSendSendSensitiveWordData=function(t){var e=t.capacity?t.capacity:t.bufferLength(),i=new BK.Buffer(fixedHeaderLen+e,1);this.addFixedHeader(i,50,this.gameId,this.roomId,this.mId),i.writeBuffer(t);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),o},this.setUserData=function(t,e){BK.Script.log(0,0,"setUserData call"),this.setUserDataCallBack=e;var i=new Object;i.cmd=32,i.arg0=t,this.reqArray.push(i),BK.Script.log(0,0,"setUserData push")},this.requestSetUserData=function(t){var e=t.capacity?t.capacity:t.bufferLength(),i=new BK.Buffer(fixedHeaderLen+e,1);this.addFixedHeader(i,32,this.gameId,this.roomId,this.mId),i.writeBuffer(t);var r=BK.Security.getST();BK.Security.encrypt(i);var n=r.bufferLength(),o=new BK.Buffer(HeaderLen+i.bufferLength()+n,1);return this.addHeader(o,i.bufferLength(),n),o.writeBuffer(r),o.writeBuffer(i),o},this.getUserData=function(t,e){void 0==t&&(t=0),this.getUserDataCallBack=e;var i=new Object;i.cmd=34,i.arg0=t,this.reqArray.push(i),BK.Script.log(0,0,"getUserData push roomId = "+t)},this.requestGetUserData=function(t){var e=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(e,34,this.gameId,this.roomId,this.mId);var i=BK.Security.getST();BK.Security.encrypt(e);var r=i.bufferLength(),n=new BK.Buffer(HeaderLen+e.bufferLength()+r,1);return this.addHeader(n,e.bufferLength(),r),n.writeBuffer(i),n.writeBuffer(e),n},this.syncOpt=function(t,e,i,r,n){this.sendSyncOptCallBack=n;var o=new Object;o.cmd=14,o.arg0=t,o.arg1=e,o.arg2=i,o.arg3=r,this.reqArray.push(o)},this.sendSyncOpt=function(t,e){var i=new BK.Buffer(1,1);i.writeUint8Buffer(0);var r=new BK.Buffer(1,1);r.writeUint8Buffer(0),this.syncOpt(i,t,r,void 0,e)},this.requestSyncOpt=function(t,e,i,r){var n=20+(t.capacity?t.capacity:t.bufferLength())+4+(e.capacity?e.capacity:e.bufferLength())+4+(i.capacity?i.capacity:i.bufferLength());if(r){var o=r.capacity?r.capacity:r.bufferLength();n=n+4+o,BK.Script.log(0,0,"requestSyncOpt with item len"+o)}var a=new BK.TLV(n);a.bkJSTLVWriteUInt32(this.msgSeq,TLVType.Uint32,201),a.bkJSTLVWriteUInt32(this.lastFrame,TLVType.Uint32,202),a.bkJSTLVWriteBuffer(t,TLVType.Byte,203),a.bkJSTLVWriteBuffer(e,TLVType.Byte,204),a.bkJSTLVWriteBuffer(i,TLVType.Byte,205),r&&a.bkJSTLVWriteBuffer(r,TLVType.Byte,206),BK.Script.log(0,0,"requestSyncOpt this.msgSeq:"+this.msgSeq+" this.lastFrame:"+this.lastFrame);a.bkJSParseTLV();BK.Script.log(0,0,"requestSyncOpt tlv len:"+a.bkJSTLVGetLength()+" fix header:"+fixedHeaderLen);var s=new BK.Buffer(fixedHeaderLen+a.bkJSTLVGetLength(),1);this.addFixedHeader(s,14,this.gameId,this.roomId,this.mId),s.writeBuffer(a.bkJSTLVGetBuffer());var h=BK.Security.getST();BK.Security.encrypt(s);var c=h.bufferLength(),l=new BK.Buffer(HeaderLen+s.bufferLength()+c,1);return this.addHeader(l,s.bufferLength(),c),l.writeBuffer(h),l.writeBuffer(s),this.msgSeq+=1,l},this.setFrameSyncListener=function(t){this.frameSyncListener=t},this.queryFrameData=function(t,e,i){this.queryFrameDataCallBack=i;var r=new Object;r.cmd=18,r.arg0=t,r.arg1=e,this.reqArray.push(r)},this.requestQueryFrameData=function(t,e){var i=new BK.TLV(22);i.bkJSTLVWriteUInt32(this.lastFrame,TLVType.Uint32,201),i.bkJSTLVWriteUInt32(t,TLVType.Uint32,202),i.bkJSTLVWriteUInt16(e,TLVType.Uint16,203);var r=new BK.Buffer(fixedHeaderLen+i.bkJSTLVGetLength(),1);this.addFixedHeader(r,18,this.gameId,this.roomId,this.mId),r.writeBuffer(i.bkJSTLVGetBuffer());var n=BK.Security.getST();BK.Security.encrypt(r);var o=n.bufferLength(),a=new BK.Buffer(HeaderLen+r.bufferLength()+o,1);return this.addHeader(a,r.bufferLength(),o),a.writeBuffer(n),a.writeBuffer(r),a},this.sendControlCommand=function(t,e,i,r){var n=new Object;n.cmd=48,n.arg0=t,n.arg1=e,n.arg2=i,this.reqArray.push(n),this.controlCommandCallback=r},this.requestControlCommand=function(t,e,i){var r=new BK.TLV(14+e.bufferLength()+i.bufferLength());r.bkJSTLVWriteBuffer(e,TLVType.Byte,201),r.bkJSTLVWriteUInt16(t,TLVType.Uint16,202),r.bkJSTLVWriteBuffer(i,TLVType.Byte,203);var n=new BK.Buffer(fixedHeaderLen+r.bkJSTLVGetLength(),1);this.addFixedHeader(n,48,this.gameId,this.roomId,this.mId),n.writeBuffer(r.bkJSTLVGetBuffer()),BK.Security.encrypt(n);var o=BK.Security.getST(),a=o.bufferLength(),s=new BK.Buffer(HeaderLen+n.bufferLength()+a,1);return this.addHeader(s,n.bufferLength(),a),s.writeBuffer(o),s.writeBuffer(n),s},this.sendKeepAlive=function(){var t=new Object;t.cmd=12,this.reqArray.push(t),0!=this.netTimeOutTs&&BK.Time.timestamp-this.netTimeOutTs>5&&this.disconnectNetCallBack&&this.disconnectNetCallBack()},this.requestSendKeepAlive=function(){var t=new BK.Buffer(fixedHeaderLen,1);this.addFixedHeader(t,12,this.gameId,this.roomId,this.mId);var e=BK.Security.getST();BK.Security.encrypt(t);var i=e.bufferLength(),r=new BK.Buffer(HeaderLen+t.bufferLength()+i,1);return this.addHeader(r,t.bufferLength(),i),r.writeBuffer(e),r.writeBuffer(t),r},this.recvCreateRoom=function(t,e){BK.Script.log(0,0,"recvCreateRoom bodyLen="+e);var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV();if(r){var n=r.tag202,o=n.readUint8Buffer(),a=n.readUint8Buffer(),s=n.readUint16Buffer();n.readUint64Buffer(),n.readUint32Buffer();var h=n.readUint8Buffer(),c=n.readUint8Buffer(),l=n.readUint8Buffer(),u=n.readUint8Buffer(),d=r.tag201,_=d.readUint8Buffer(),f=d.readUint8Buffer(),g=d.readUint16Buffer();d.readUint64Buffer(),d.readUint32Buffer();var p=d.readUint8Buffer(),m=d.readUint8Buffer(),v=d.readUint8Buffer(),S=d.readUint8Buffer(),b=new Object;return b.ipType_1=o,b.resServe_1=a,b.ipType_2=_,b.resServe_2=f,b.port_1=s,b.ip_1=h+"."+c+"."+l+"."+u,b.port_2=g,b.ip_2=p+"."+m+"."+v+"."+S,this.ip0=b.ip_1,this.ip1=b.ip_2,b}return void BK.Script.log(0,0,"recvCreateRoom parse failed.")},this.recvQueryRoom=function(t,e){BK.Script.log(0,0,"recvQueryRoom bodyLen:"+e);var i=t.readBuffer(e),r=new BK.TLV(i).bkJSParseTLV();if(r){var n=r.tag202,o=n.readUint8Buffer(),a=n.readUint8Buffer(),s=n.readUint16Buffer();n.readUint64Buffer(),n.readUint32Buffer();var h=n.readUint8Buffer(),c=n.readUint8Buffer(),l=n.readUint8Buffer(),u=n.readUint8Buffer(),d=r.tag201,_=d.readUint8Buffer(),f=d.readUint8Buffer(),g=d.readUint16Buffer();d.readUint64Buffer(),d.readUint32Buffer();var p=d.readUint8Buffer(),m=d.readUint8Buffer(),v=d.readUint8Buffer(),S=d.readUint8Buffer(),b=r.tag203,B=this.read32BytesToString(b),T=b.readUint64Buffer(),y=b.readUint8Buffer(),E=b.readUint8Buffer(),x=r.tag205;void 0==x&&(x=0);for(var C=[],R=0;R0){var e=this.reqArray.pop();void 0!=e&&null!=e&&this.requestSocket(e)}return 3!=t&&1!=t||this.seperatePackHandle(),t},this.createAndJoinRoom=function(t,e,i,r,n){this.createRoom(t,e,function(t,e,o){0==t?(BK.Script.log(0,0,"创建游戏 statusCode:"+t+" roomId:"+o),this.gameSvrIp=e.ip_2,this.gameSvrPort=e.port_2,this.roomSvrIp=e.ip_1,this.roomSvrPort=e.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(0,function(t,e){BK.Script.log(0,0,"加入房间 statusCode:"+t+" roomid is "+e.roomId),0==t&&(GameStatusInfo.roomId=e.roomId,BK.QQ.gameCfg.roomId=e.roomId),n?1==BK.QQ.hasJoinRoomSucc?i(t,this):BK.QQ.delegate.onJoinRoomEvent=function(e,r,n){i(t,this)}.bind(this):i(t,this)},r,n)):i(t,this)})},this.queryAndJoinRoom=function(t,e,i,r,n,o){1!=this.serverConnected&&(this.socket.close(),this.socket.connect(this.recommandRoomSvrHost,this.recommandRoomSvrPort)),this.queryRoom(t,e,i,function(t,e){0==t?(this.gameSvrIp=e.ip_2,this.gameSvrPort=e.port_2,this.roomSvrIp=e.ip_1,this.roomSvrPort=e.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(0,function(t,e){BK.QQ.hasJoinRoomSucc=!0,BK.Script.log(0,0,"加入房间 statusCode:"+t+" roomid is "+e.roomId),r(t,this)},n,o)):r(t,void 0)})},this.socialMatch=function(t){this.roomId=Number(GameStatusInfo.roomId),BK.Script.log(1,1,"1v1匹配 玩家来源:"+GameStatusInfo.src+" 房间号:"+GameStatusInfo.roomId),this.createRoom(GameStatusInfo.gameId,GameStatusInfo.openId,function(e,i,r){BK.Script.log(1,1,"1v1匹配 创建房间 statusCode:"+e+" roomid:"+r),0==e?(this.isCreator=!0,this.gameSvrIp=i.ip_2,this.gameSvrPort=i.port_2,this.roomSvrIp=i.ip_1,this.roomSvrPort=i.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(GameStatusInfo.src,function(e,i){BK.Script.log(1,1,"1v1匹配 加入房间 statusCode:"+e+" roomid:"+i.roomId),0==e?(BK.Script.log(1,1,"1v1匹配 加入房间成功"),t(e,i)):(BK.Script.log(1,1,"1v1匹配 加入房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))},!0,!0)):2007==e?(this.isCreator=!1,this.queryRoom(GameStatusInfo.gameId,GameStatusInfo.roomId,GameStatusInfo.openId,function(e,i){BK.Script.log(1,1,"1v1匹配 查询房间 statusCode:"+e+" roomId:"+r+" 房间中玩家数:"+i.playerNum),0==e&&i?(this.gameSvrIp=i.ip_2,this.gameSvrPort=i.port_2,this.roomSvrIp=i.ip_1,this.roomSvrPort=i.port_1,this.socket.close(),this.socket.connect(this.gameSvrIp,this.gameSvrPort),this.joinRoom(GameStatusInfo.src,function(e,i){BK.Script.log(1,1,"1v1匹配 加入房间 statusCode:"+e+" roomid:"+i.roomId),0==e?(BK.Script.log(1,1,"1v1匹配 加入房间成功"),t(e,i)):(BK.Script.log(1,1,"1v1匹配 加入房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))},!0,!0)):(BK.Script.log(1,1,"1v1匹配 查询房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))})):(BK.Script.log(1,1,"1v1匹配 创建房间失败 statusCode:"+e+" 具体错误码参见http://hudong.qq.com/docs/engine/api/BK.MQQ.ErrorCode.html"),t(e,this))})},this.showOneMorePage=function(t,e){var i=[],r=0;if(e&&2==e.length)for(var n=0;n=0;e--)if(this.records[e].hostname===t){this.records.splice(e,1);break}},t.prototype.start=function(){if(!this.running){this.running=!0;var t=this;BK.Director.ticker.add(function(e,i){t.records.length&&BK.Misc.handleDNSQueryResult()})}},t.prototype.queryIPAddress=function(t,e,i,r){var n=!this.exists(t);if(void 0==i&&(i=2),void 0==r&&(r=0),this.update(t,e,i,r),n){var o=this;o.start(),BK.Misc.queryIPAddress(t,function(e,i,r){var n=o.query(t,i);if(n)for(var a=n.callbacks,s=0;s0&&BK.Script.log(1,0,"processHdrLine!extra = "+n)}else{var o=l[1],a=l[2];switch(o.toLowerCase()){case"connection":"close"===(s=a.toLowerCase()).substring(0,5)?this._flags|=4:"keep-alive"===s.substring(0,10)?this._flags|=2:"upgrade"===s.substring(0,7)&&(this._flags|=8);break;case"transfer-encoding":var s=a.toLowerCase();"chunked"===s.substring(0,7)&&(this._flags|=1);break;case"upgrade":this._flags|=32;break;case"content-length":var h=parseInt(a,10);if(isNaN(h)||h>524288)return this.execute=this._executeError,this._err=new Error("Bad Content-Length: "+inspect(h)),this.execute(this._err),this._err;this._contentLen=h}var c=this.maxHeaderPairs;(c<=0||++this._nhdrpairs0)return this.onComplete&&this.onComplete(),void this.reinitialize(this.type);if(this.onHeaders){var o=this.headers;!0===this.onHeaders(this.httpMajor,this.httpMinor,o,this.method,this.url,this.statusCode,this.statusText,i,r)&&(t=this._flags|=64)}i?(this.onComplete&&this.onComplete(),this._state=3):(0===n||(64&t)>0||0==(1&t)&&void 0===n&&!this._needsEOF())&&(this.onComplete&&this.onComplete(),this.reinitialize(this.type))},t.prototype._executeHeader=function(t){for(var e,i,r,n=0,o=t.length,a=this._seenCR,s=this._buf,h=this._nhdrbytes;n81920)return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;if(!((e=t.indexOf("\r\n",n))>-1)){var c;if(13===t.charCodeAt(o-1)?(a=!0,c=o-1):c=o,(h+=c-n)>81920)return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;s+=t.substring(n,c);break}if((r=e-n)>0){if((h+=r)>81920)return this.execute=this._executeError,this._err=new Error("Header size limit exceeded (81920)"),this.execute(this._err),this._err;s+=t.substring(n,e)}if(n=e+2,i=this._processHdrLine(s),s="","object"==typeof i)return this._err=i,this.execute(this._err),i;if(void 0===i){var l=this._state;if(2!==l)return l<3&&n=0&&(this._wsArray.splice(e,1),BK.Script.log(1,0,"SocketEventMgr.del!so = "+t))},t.prototype.dispatchEvent=function(){this._wsArray.forEach(function(t,e,i){t&&t.update()})},t.Instance=new t,t}(),e=function(){function e(t,e){this.ip=t,this.port=e,this.__nativeObj=new BK.Socket,this.prevConnTs=0,this.curConnRetrys=0,this.curConnTimeout=0,this.prevNetState=0,this.prevNetStateUpdateFlag=!1,this.options={ConnectRetryCount:3,ConnectTimeoutInterval:3e3}}return e.prototype.__internalClose=function(){return this.__nativeObj?this.__nativeObj.close():-2},e.prototype.__internalSend=function(t){return this.__nativeObj?this.__nativeObj.send(t):-2},e.prototype.__internalRecv=function(t){if(this.__nativeObj)return this.__nativeObj.receive(t)},e.prototype.__internalUpdate=function(){return this.__nativeObj?this.__nativeObj.update():-2},e.prototype.__internalConnect=function(){if(this.__nativeObj){var t=this.__nativeObj.connect(this.ip,this.port),e=this.curNetState();switch(this.prevNetState){case 3:this.onReconnectEvent(this);case 0:switch(e){case 3:this.onErrorEvent(this);break;case 1:case 4:this.prevConnTs=BK.Time.clock,this.curConnTimeout||(this.curConnTimeout=this.options.ConnectTimeoutInterval),this.onConnectingEvent(this),t=0;break;case 2:case 5:this.onConnectedEvent(this),t=0}}return this.prevNetState=e,this.prevNetStateUpdateFlag=!0,t}return-2},e.prototype.__internalCanReadLength=function(){return this.__nativeObj?this.__nativeObj.canReadLength():0},e.prototype.__internalIsEnableSSL=function(){return!!this.__nativeObj&&this.__nativeObj.getSSLEnable()},e.prototype.__internalEnableSSL=function(t){this.__nativeObj&&this.__nativeObj.setSSLEnable(t)},e.prototype.__internalUpdateSSL=function(){var t=this.__internalUpdate(),e=this.curNetState();if(-1!=t)switch(this.prevNetState){case 1:switch(e){case 2:BK.Script.log(1,0,"BK.Socket.update.ssl!connected, ip = "+this.ip+", port = "+this.port);break;case 4:case 5:break;default:i=BK.Time.clock;return 1e3*(r=BK.Time.diffTime(this.prevConnTs,i))>=this.curConnTimeout&&(this.curConnRetrys=this.curConnRetrys+1,this.curConnRetrys=this.curConnTimeout&&(this.curConnRetrys=this.curConnRetrys+1,this.curConnRetrys=this.curConnTimeout&&(this.curConnRetrys=this.curConnRetrys+1,this.curConnRetrys=0&&t<=9)return t.toString();switch(t){case 10:return"A";case 11:return"B";case 12:return"C";case 13:return"D";case 14:return"E";case 15:return"F"}return"u"},e.prototype.bufferToHexString=function(t){var e="";for(t.rewind();!t.eof;){var i=t.readUint8Buffer();e=e.concat("x"+this.toHex((240&i)>>4)+this.toHex(15&i)+" ")}return e},e.prototype.startPhaseTimeout=function(t){if(6==t)this.phaseTimeout=t,this.prevPhaseTickCount=0;else switch(this.state){case 2:1==t&&(this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock);break;case 3:2==t&&(this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock);break;case 1:3==t&&(this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock);break;case 4:switch(t){case 4:this.options.PingPongTimeout=Math.min(this.options.PingPongTimeout,this.options.PingPongInterval)}this.phaseTimeout=t,this.prevPhaseTickCount=BK.Time.clock}},e.prototype.handlePhaseTimeout=function(){if(6!=this.phaseTimeout){var e=BK.Time.diffTime(this.prevPhaseTickCount,BK.Time.clock);switch(this.phaseTimeout){case 1:1e3*e>this.options.HandleShakeRequestTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!handshake request timeout"),this.prevPhaseTickCount=BK.Time.clock,this.state=-1,this.errcode=4096,this.message="handshake request timeout",t.prototype.close.call(this),this.delegate.onError&&this.delegate.onError(this));break;case 2:1e3*e>this.options.HandleShakeResponseTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!handshake response timeout"),this.prevPhaseTickCount=BK.Time.clock,this.state=-1,this.errcode=4097,this.message="handshake response timeout",t.prototype.close.call(this),this.delegate.onError&&this.delegate.onError(this));break;case 3:1e3*e>this.options.CloseAckTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!close ack timeout"),this.prevPhaseTickCount=BK.Time.clock,t.prototype.close.call(this),1==this.state?this.peerClosed?this.delegate.onClose&&this.delegate.onClose(this):(this.errcode=1006,this.message="abnormal close",this.delegate.onError&&this.delegate.onError(this),this.startPhaseTimeout(6)):this.delegate.onError&&this.delegate.onError(this));break;case 4:1e3*e>this.options.PingPongTimeout&&(BK.Script.log(1,0,"BK.WebSocket.handlePhaseTimeout!receive pong timeout"),this.prevPhaseTickCount=BK.Time.clock)}}},e.prototype.restartPingPongTimer=function(){4==this.state&&this.options.PingPongInterval>0&&(this.prevPingPongTickCount=BK.Time.clock)},e.prototype.handlePingPongTimer=function(){4==this.state&&this.options.PingPongInterval>0&&1e3*BK.Time.diffTime(this.prevPingPongTickCount,BK.Time.clock)>this.options.PingPongInterval&&(this.inPingFrame=!1,this.txPingData=this.randomN(16),this.sendPingFrame(this.txPingData),this.restartPingPongTimer())},e.prototype.doHandshakePhase=function(){var e="",i=this.query?"?"+this.query:"";e=e.concat("GET "+this.path+i+" HTTP/"+this.httpVer+"\r\n"),e=(e=(e=80==this.port||443==this.port?e.concat("Host: "+this.host+"\r\n"):e.concat("Host: "+this.host+":"+this.port+"\r\n")).concat("Upgrade: websocket\r\n")).concat("Connection: Upgrade\r\n"),e=this.isEnableSSL()?e.concat("Origin: https://"+this.host+"\r\n"):e.concat("Origin: http://"+this.host+"\r\n");var r=this.randomN(16),n=BK.Misc.encodeBase64FromBuffer(r);if(e=e.concat("Sec-WebSocket-Key: "+n+"\r\n"),e=e.concat("Sec-WebSocket-Version: "+this.version+"\r\n"),this.query)for(var o=this.query.split("&"),a=0;a0&&(e=e.concat(s[0]+": "+s[1]+"\r\n"))}e=e.concat("\r\n");var h=BK.Misc.sha1(n.concat("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"));this.handshakeSig=BK.Misc.encodeBase64FromBuffer(h);var c=new BK.Buffer(e.length,!1);c.writeAsString(e,!1),0>8),a.writeUint8Buffer(255&o)):(a.writeUint8Buffer(255&o),a.writeUint8Buffer((65280&o)>>8))):BK.Script.log(1,0,"BK.WebSocket.doFrameDataPhase!js don't support 64bit data type"),h){var l=this.randomN(4);BK.Misc.encodeBufferXorMask4(t,l),a.writeBuffer(l)}return a.writeBuffer(t),a},e.prototype.doSvrFrameDataPhase=function(t){if(!t)return!0;for(;!t.eof;){switch(this.parseState){case 0:this.mask4.rewind(),this.rxbuf=new BK.Buffer(this.options.DefaultSegmentSize,!0),this.maskBit=0,this.rxbuflen=0,this.isFinalSeg=!1,this.parseState=1;case 1:var i=t.readUint8Buffer();switch(this.isFinalSeg=!!(128&i),this.opcode=15&i,this.version){case 13:switch(this.opcode){case 3:case 4:case 5:case 6:case 7:case 11:case 12:case 13:case 14:case 15:return this.errcode=1002,this.message="protocol error",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!unknown opcode = "+this.opcode),!1}}switch(this.opcode){case 8:case 9:case 10:case 0:break;default:if(!this.isFinalSeg&&1!=this.opcode&&2!=this.opcode)return this.errcode=1003,this.message="unsupported data",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!illegal opcode = "+this.opcode),!1;if(-1==this.rxFrameType)this.rxFrameType=this.opcode;else if(this.rxFrameType!=this.opcode)return this.errcode=1002,this.message="protocol error",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!rxFrameType = "+this.rxFrameType+", illegal opcode = "+this.opcode),!1}if(this.parseState=2,t.eof)return!0;case 2:var r=t.readUint8Buffer();switch(this.maskBit=(128&r)>>7,127&r){case 126:if(this.parseState=3,t.eof)return!0;break;case 127:if(this.parseState=5,t.eof)return!0;break;default:if(this.rxbuflen=127&r,1==this.maskBit?this.parseState=13:this.parseState=17,this.rxbuflen>0&&t.eof)return!0}}switch(this.parseState){case 3:n=t.readUint8Buffer();if(e.isLittleEndian?this.rxbuflen|=(255&n)<<8:this.rxbuflen|=255&n,t.eof)return!0;case 4:var n=t.readUint8Buffer();if(e.isLittleEndian?this.rxbuflen|=255&n:this.rxbuflen|=(255&n)<<8,1==this.maskBit?this.parseState=13:this.parseState=17,this.rxbuflen>0&&t.eof)return!0;break;case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:return this.errcode=1002,this.message="protocol errors",BK.Script.log(1,0,"BK.WebSocket.doSvrFrameDataPhase!js don't support 64bit data type"),!1}switch(this.parseState){case 13:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=14,t.eof)return!0;case 14:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=15,t.eof)return!0;case 15:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=16,t.eof)return!0;case 16:if(this.mask4.writeUint8Buffer(t.readUint8Buffer()),this.parseState=17,t.eof)return!0}if(17==this.parseState){var o=t.length-t.pointer;if(o<=this.rxbuflen-this.rxbuf.length?this.rxbuf.writeBuffer(t.readBuffer(o)):this.rxbuf.writeBuffer(t.readBuffer(this.rxbuflen-this.rxbuf.length)),this.rxbuf.length==this.rxbuflen)if(this.rxSegCount=this.rxSegCount+1,this.parseState=0,this.isFinalSeg)switch(this.rxbuf.rewind(),this.opcode){case 8:BK.Script.log(0,0,"BK.WebSocket.doSvrFrameDataPhase!receive close frame"),this.handleCloseFrame();break;case 9:BK.Script.log(0,0,"BK.WebSocket.doSvrFrameDataPhase!receive ping frame"),this.handlePingFrame();break;case 10:BK.Script.log(0,0,"BK.WebSocket.doSvrFrameDataPhase!receive pong frame"),this.handlePongFrame();break;default:this.rxbufQue.push(this.rxbuf),this.recvFrameFromRxQ(this.rxFrameType),this.rxSegCount=0,this.rxFrameType=-1}else this.rxbuf.rewind(),this.rxbufQue.push(this.rxbuf)}}return!0},e.prototype.handleCloseFrame=function(){if(this.peerClosed=!0,4==this.state){var t=this.rxbuf.readUint16Buffer(),e=this.rxbuf.readBuffer(this.rxbuflen-2);if(t?(this.errcode=t,this.message=e.readAsString()):(this.errcode=1005,this.message="no status recv"),BK.Script.log(1,0,"BK.WebSocket.handleCloseFrame!errcode = "+this.errcode+", msg = "+this.message),this.sendCloseFrame(this.errcode,this.message?this.message:""),BK.Script.log(1,0,"BK.WebSocket.handleCloseFrame! closed by romote peer"),this.close(),this.state=0,this.delegate.onMessage)for(;this.udataQue.length>0;){i=this.udataQue.shift();this.delegate.onMessage(this,i)}this.delegate.onClose&&this.delegate.onClose(this)}else if(1==this.state){if(BK.Script.log(1,0,"BK.WebSocket.handleCloseFrame!normal closed"),this.close(),this.state=0,this.delegate.onMessage)for(;this.udataQue.length>0;){var i=this.udataQue.shift();this.delegate.onMessage(this,i)}this.delegate.onClose&&this.delegate.onClose(this)}},e.prototype.handlePingFrame=function(){if(4==this.state){if(this.rxbuflen>125)return this.errcode=4099,void(this.message="ping packet large");if(this.inPongFrame)return void BK.Script.log(1,0,"BK.WebSocket.handlePingFrame!already recv ping, drop it.");this.rxPongData=new BK.Buffer(this.rxbuflen,!0),this.rxPongData.writeBuffer(this.rxbuf.readBuffer(this.rxbuflen)),this.sendPongFrame(this.rxPongData)}},e.prototype.handlePongFrame=function(){if(4==this.state){var t=new BK.Buffer(this.rxbuflen,!0);t.writeBuffer(this.rxbuf.readBuffer(this.rxbuflen)),this.startPhaseTimeout(6),BK.Script.log(0,0,"BK.WebSocket.handlePongFrame!pong data = "+this.bufferToHexString(t))}},e.prototype.sendFrameFromTxQ=function(e){if(4==this.state&&this.packageSendCheck()){if(this.inPartialTxbuf){if(!((l=t.prototype.send.call(this,this.txbuf))>0))return BK.Script.log(1,l,"BK.WebSocket.sendFrameFromTxQ!partial send failed, data type = "+e),!1;if(this.restartPingPongTimer(),l0;){var s=a.shift(),h=a.length>0,c=this.doFrameDataPhase(s,e,h),l=t.prototype.send.call(this,c);if(!(l>0)){n=!1,BK.Script.log(1,l,"BK.WebSocket.sendFrameFromTxQ!send failed, data type = "+e);break}if(this.restartPingPongTimer(),l0){var i=this.recv(o),r=this.phaseBufferCheck(i);if(i.rewind(),r0;){h=this.udataQue.shift();this.delegate.onMessage(this,h)}this.txMsgQue.length>0&&this.sendFrameFromTxQ(this.txFrameType),this.delegate.onSendComplete&&this.delegate.onSendComplete(this),this.inPongFrame=!1,this.handlePhaseTimeout(),this.handlePingPongTimer()}else void 0!=i&&this.doSvrHandshakePhase1(i.readAsString(!0)),this.handlePhaseTimeout()}break;case 4:for(var o=e.canRecvLength();o>0;){var a=o,s=this.recv(o);if(void 0!=s)for(;!s.eof;){if(!this.doSvrFrameDataPhase(s)){this.sendCloseFrame(this.errcode,this.message?this.message:""),this.delegate.onError&&this.delegate.onError(this);break}if(0==this.state)return}if((o=e.canRecvLength())==a)break}if(this.delegate.onMessage)for(;this.udataQue.length>0;){h=this.udataQue.shift();this.delegate.onMessage(this,h)}this.txMsgQue.length>0&&this.sendFrameFromTxQ(this.txFrameType),this.delegate.onSendComplete&&this.delegate.onSendComplete(this),this.inPongFrame=!1,this.handlePhaseTimeout(),this.handlePingPongTimer();break;case 1:if((o=e.canRecvLength())>0&&this.doSvrFrameDataPhase(this.recv(o))&&this.delegate.onMessage)for(;this.udataQue.length>0;){var h=this.udataQue.shift();this.delegate.onMessage(this,h)}this.handlePhaseTimeout()}return 0},e.isLittleEndian=BK.Misc.isLittleEndian(),e}(e),n=function(){function t(t,e){this.data=t,this.isBinary=e}return t}();return function(){function t(t){var e=this;this.__url=t,this.options=null,this.inTrans=!1,this.isPendingConn=!0,this.txdataQ=new Array;var i=BK.URL("{}",t);this.scheme=i.protocol,this.port=i.port,this.path=i.path,this.query=i.query,this.host=i.hostname,BK.DNS.queryIPAddress(i.hostname,function(t,i,n){switch(n=e.ipListFilter(n),t){case 0:BK.Script.log(1,0,"BK.WebSocket.queryIPAddress!iplist = "+JSON.stringify(n)),e.iplist=n,e.__nativeObj=new r(n[0],e.port,e.host,e.path,e.query),BK.Notification.on("game_network_change",e,function(t){this.__nativeObj.close(),this.__nativeObj.delegate.onClose(this.__nativeObj)}.bind(e),!0),"wss"==e.scheme&&e.__nativeObj.enableSSL(!0),e.options&&(e.setOptions(e.options),e.options=null),e.isPendingConn&&(e.connect(),e.isPendingConn=!1),e.__nativeObj.delegate.onOpen=function(t){e.txdataQ.length>0&&e.send(e.txdataQ.shift()),e.onOpen?e.onOpen(e):e.onopen&&e.onopen.call(e)},e.__nativeObj.delegate.onClose=function(t){var i={};i.code=e.getErrorCode(),i.reason=e.getErrorString(),e.onClose?e.onClose(e,i):e.onclose&&e.onclose.call(e,i)},e.__nativeObj.delegate.onError=function(t){var i={};i.code=e.getErrorCode(),i.reason=e.getErrorString(),e.onError?e.onError(e,i):e.onerror&&e.onerror.call(e,i)},e.__nativeObj.delegate.onMessage=function(t,i){if(e.onMessage)e.onMessage(e,i);else if(e.onmessage){if(1==i.isBinary){var r=i.data;r.rewind();for(var n=new ArrayBuffer(r.length),o=new DataView(n);!r.eof;)o.setUint8(r.pointer,r.readUint8Buffer());i.data=n}e.onmessage.call(e,i)}},e.__nativeObj.delegate.onSendComplete=function(t){for(var i=e.txdataQ.length;i>0&&e.__nativeObj.packageSendCheck();i--){var r=e.txdataQ.shift();r.isBinary?e.__sendBinaryFrame(r.data):e.__nativeObj.sendTextFrame(r.data)}}}})}return Object.defineProperty(t.prototype,"url",{get:function(){return this.__url},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readyState",{get:function(){return this.getReadyState()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bufferedAmount",{get:function(){for(var t=0,e=0;e0){var e=this.textureInfoArr[t];if(e){this.currDisplayIdx=t;var i=e.texture,r=e.frameInfo;if(1==e.frameInfo.trimmed){var n=e.frameInfo.spriteSourceSize.x,o=e.frameInfo.spriteSourceSize.y,a=e.frameInfo.spriteSourceSize.w,s=e.frameInfo.spriteSourceSize.h,h=e.frameInfo.sourceSize,c=this.__nativeObj.contentSize;n=c.width*n/h.w,o=c.height*o/h.h,a=c.width*a/h.w,s=c.height*s/h.h,this.contentSprite.position={x:n,y:o},this.contentSprite.contentSize={width:a,height:s}}else this.contentSprite.contentSize=this.__nativeObj.contentSize;this.currTexturePath&&this.currTexturePath==e.texturePath||(BK.Script.log(1,-1,"this.currTexture != tex"),this.currTexturePath=e.texturePath,this.contentSprite.setTexture(i)),this.contentSprite.adjustTexturePosition(r.frame.x,r.frame.y,r.frame.w,r.frame.h,r.rotated)}else BK.Script.log(1,-1,"displayFrame failed! textureInfo is null. index is "+t)}else BK.Script.log(1,-1,"displayFrame failed! textureInfoArr.length is 0")},t.prototype.render=function(){this.tmpPlayingIdx>this.textureInfoArr.length-1&&(this.tmpPlayingIdx=0),this.displayFrame(this.tmpPlayingIdx),this.tmpPlayingIdx++,this.currDisplaySum++,this.updateCallback()},t.prototype.update=function(t,e){0==this.paused&&(this.previousTs<0?(this.previousTs=t,this.render()):t-this.previousTs>1e3*this.delayUnits&&(this.previousTs=t,this.render()))},t.prototype.play=function(t,e){void 0===t&&(t=0),void 0===e&&(e=-1),t>this.textureInfoArr.length-1?this.tmpPlayingIdx=0:this.tmpPlayingIdx=t,this.paused=!1,this.repeatCount=e,this.currDisplaySum=0,this.playedCount=0},t.prototype.stop=function(t){void 0===t&&(t=-1),this.paused=!0,t>-1&&this.displayFrame(t)},t.prototype.updateCallback=function(){var t=this.textureInfoArr.length;this.currDisplaySum%t==0&&(this.playedCount=parseInt(String(this.currDisplaySum/t)),this.completeCallback&&this.completeCallback(this,this.playedCount),this.repeatCount>0&&this.repeatCount<=this.playedCount&&(this.endCallback&&this.endCallback(this,this.playedCount),this.stop()))},t.prototype.setCompleteCallback=function(t){this.completeCallback=t},t.prototype.setEndCallback=function(t){this.endCallback=t},t}()}),Canvas.prototype.setImagePath=function(t){if(t){this.imagePath=t;var e=new BK.Texture(t);this.__nativeObj.setTexture(e)}},Canvas.prototype.getImagePath=function(){return this.imagePath},Canvas.prototype.setTexture=function(t){this.__nativeObj.setTexture(t)},Canvas.prototype.setFlipXY=function(t,e){this.__nativeObj.setUVFlip(t,e)},Canvas.prototype.setUVFlip=function(t,e){this.__nativeObj.setUVFlip(t,e)},Canvas.prototype.setUVWrap=function(t,e){this.__nativeObj.setUVWrap(t,e)},Canvas.prototype.setXYStretch=function(t,e){this.__nativeObj.setXYStretch(t,e)},Canvas.prototype.adjustTexturePosition=function(t,e,i,r,n){this.__nativeObj.adjustTexturePosition(t,e,i,r,n)},Canvas.prototype.addChild=function(t){return this.__nativeObj.addChild(t)},Canvas.prototype.dispose=function(){return this.__nativeObj.dispose()},Canvas.prototype.removeChild=function(t){return this.__nativeObj.removeChild(t)},Canvas.prototype.removeChildById=function(t){return this.__nativeObj.removeChildById(t)},Canvas.prototype.removeChildByName=function(t){return this.__nativeObj.removeChildByName(t)},Canvas.prototype.removeChildByTag=function(t){return this.__nativeObj.removeChildByTag(t)},Canvas.prototype.queryChildAtIndex=function(t){return this.__nativeObj.queryChildAtIndex(t)},Canvas.prototype.queryChildById=function(t){return this.__nativeObj.queryChildById(t)},Canvas.prototype.queryChildByName=function(t){return this.__nativeObj.queryChildByName(t)},Canvas.prototype.queryChildByTag=function(t){return this.__nativeObj.queryChildByTag(t)},Canvas.prototype.getChildCount=function(){return this.__nativeObj.getChildCount()},Canvas.prototype.removeFromParent=function(){return this.__nativeObj.removeFromParent()},Canvas.prototype.attachComponent=function(t){return this.__nativeObj.attachComponent(t)},Canvas.prototype.detachComponent=function(t){return this.__nativeObj.detachComponent(t)},Canvas.prototype.queryComponent=function(t){return this.__nativeObj.queryComponent(t)},Canvas.prototype.queryComponentList=function(t){return this.__nativeObj.queryComponentList(t)},Canvas.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},Canvas.prototype.isEqual=function(t){return this.__nativeObj.isEqual(t)},Canvas.prototype.convertToWorldSpace=function(t){return this.__nativeObj.convertToWorldSpace(t)},Canvas.prototype.convertToNodeSpace=function(t){return this.__nativeObj.convertToNodeSpace(t)},Canvas.prototype.setAtlas=function(t,e){if(this.__nativeObj){BK.CanvasSheetCache.loadSheet(t);var i=BK.CanvasSheetCache.getTexturePathByFilename(e),r=new BK.Texture(i);this.__nativeObj.setTexture(r);var n=BK.CanvasSheetCache.getFrameInfoByFilename(e);this.__nativeObj.adjustTexturePosition(n.frame.x,n.frame.y,n.frame.w,n.frame.h,n.rotated)}return 0},Canvas.prototype.useH5Mode=function(){return this.__nativeObj?(this._useH5Mode=1,1==arguments.length?(this._useH5Mode=arguments[0],this.__nativeObj.useH5Mode(arguments[0])):this.__nativeObj.useH5Mode()):0},Canvas.prototype.drawCircle=function(){return this.__nativeObj?this.__nativeObj.drawCircle(arguments[0],arguments[1],arguments[2]):0},Canvas.prototype.drawEllipse=function(){return this.__nativeObj?this.__nativeObj.drawEllipse(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.drawImage=function(){if(this.__nativeObj){var t=arguments.length;if(9==t)this.__nativeObj.drawImage(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);else if(5==t)this.__nativeObj.drawImage(arguments[0],0,0,0,0,arguments[1],arguments[2],arguments[3],arguments[4]);else{if(3!=t)return;this.__nativeObj.drawImage(arguments[0],0,0,0,0,arguments[1],arguments[2],0,0)}this._innerSetTransform()}return 0},Canvas.prototype.fill=function(){return this.__nativeObj?this.__nativeObj.fill():0},Canvas.prototype.stroke=function(){return this.__nativeObj?this.__nativeObj.stroke():0},Canvas.prototype.rect=function(){return this.__nativeObj?this.__nativeObj.rect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.fillRect=function(){return this.__nativeObj?this.__nativeObj.fillRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.strokeRect=function(){return this.__nativeObj?this.__nativeObj.strokeRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.clearRect=function(){return this.__nativeObj?this.__nativeObj.clearRect(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.beginPath=function(){return this.__nativeObj?this.__nativeObj.beginPath():0},Canvas.prototype.closePath=function(){return this.__nativeObj?this.__nativeObj.closePath():0},Canvas.prototype.moveTo=function(){return this.__nativeObj?this.__nativeObj.moveTo(arguments[0],arguments[1]):0},Canvas.prototype.lineTo=function(){return this.__nativeObj?this.__nativeObj.lineTo(arguments[0],arguments[1]):0},Canvas.prototype.arcTo=function(){return this.__nativeObj?this.__nativeObj.arcTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]):0},Canvas.prototype.arc=function(){if(this.__nativeObj){var t=arguments.length;if(5==t)return this.__nativeObj.arc(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]);if(6==t)return this.__nativeObj.arc(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}return 0},Canvas.prototype.quadraticCurveTo=function(){return this.__nativeObj?this.__nativeObj.quadraticCurveTo(arguments[0],arguments[1],arguments[2],arguments[3]):0},Canvas.prototype.bezierCurveTo=function(){return this.__nativeObj?this.__nativeObj.bezierCurveTo(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]):0},Canvas.prototype.save=function(){return this.__nativeObj?this.__nativeObj.save():0},Canvas.prototype.restore=function(){return this.__nativeObj?this.__nativeObj.restore():0},Canvas.prototype.fillText=function(){if(3==arguments.length){var t=this.measureText(arguments[0],2048,1024),e=arguments[1],i=arguments[2];switch(1==this._useH5Mode?2-this._textBaseLine:this._textBaseLine){case 1:i-=.5*t.height;break;case 2:i-=1*t.height}switch(this._textAlign){case 1:e-=.5*t.width;break;case 2:e-=1*t.width}this.__nativeObj.fillText(arguments[0],e,i,Math.min(2048,t.width),Math.min(1024,t.height)),this._innerSetTransform()}return 0},Canvas.prototype.clip=function(){return this.__nativeObj?this.__nativeObj.clip():0},Canvas.prototype.isPointInPath=function(){if(this.__nativeObj)return this.__nativeObj.isPointInPath(arguments[0],arguments[1])},Canvas.prototype.createImageData=function(){var t=arguments.length;if(this.__nativeObj&&2==t){var e=new BK.Buffer(arguments[0]*arguments[1]*4);return e.__inner_image_width=arguments[0],e.__inner_image_height=arguments[1],e}},Canvas.prototype.getImageData=function(){var t=arguments.length;if(this.__nativeObj&&4==t){var e=this.__nativeObj.getImageData(arguments[0],arguments[1],arguments[2],arguments[3]);return e.__inner_image_width=arguments[2],e.__inner_image_height=arguments[3],e}},Canvas.prototype.putImageData=function(){var t=arguments.length;if(this.__nativeObj&&3==t){var e=arguments[0],i=arguments[1],r=arguments[2],n=e.__inner_image_width,o=e.__inner_image_height;return this.__nativeObj.putImageData(arguments[0],i,r,n,o)}},Canvas.prototype.scale=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. scale :"+arguments[0]+" , "+arguments[1]),this.__nativeObj.scales(arguments[0],arguments[1])},Canvas.prototype.scales=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. scales :"+arguments[0]+" , "+arguments[1]),this.__nativeObj.scales(arguments[0],arguments[1])},Canvas.prototype.rotate=function(){if(this.__nativeObj)return BK.Script.log(0,0,"bk.canvas. rotate :"+arguments[0]),this.__nativeObj.rotate(arguments[0])},Canvas.prototype.translate=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");7==Number(t[0])&&Number(7==t[1]&&Number(t[2])<=5)?(this._tx=arguments[0],this._ty=arguments[1],this._innerSetTransform()):this.__nativeObj.translate(arguments[0],arguments[1])}},Canvas.prototype.transform=function(){if(this.__nativeObj)return this.__nativeObj.transforms(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},Canvas.prototype.transforms=function(){return this.setTransform(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},Canvas.prototype.setTransform=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");if(Number(t[0])<7||7==Number(t[0])&&Number(t[1])<7){if("ios"==GameStatusInfo.platform){var e=inverseMatrix(this._a,this._b,this._c,this._d,this._tx,this._ty);this.__nativeObj.transforms(e[0],e[1],e[2],e[3],e[4],e[5])}return this._a=arguments[0],this._b=arguments[1],this._c=arguments[2],this._d=arguments[3],this._tx=arguments[4],this._ty=arguments[5],this.__nativeObj.transforms(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}return this._a=arguments[0],this._b=arguments[1],this._c=arguments[2],this._d=arguments[3],this._tx=arguments[4],this._ty=arguments[5],this.__nativeObj.setTransform(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}},Canvas.prototype._innerSetTransform=function(){if(this.__nativeObj){var t=GameStatusInfo.QQVer.split(".");if(7==Number(t[0])&&Number(7==t[1]&&Number(t[2])<=5))return this.__nativeObj.setTransform(this._a,this._b,this._c,this._d,this._tx,this._ty)}},Canvas.prototype.shadowColor=function(){if(this._shadowColor=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.shadowRadius=function(){if(this._shadowRadius=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.shadowOffsetX=function(){if(this._shadowOffset.x=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.shadowOffsetY=function(){if(this._shadowOffset.y=arguments[0],this.__nativeObj)return this.__nativeObj.setTextShadow(this._shadowOffset.x,this._shadowOffset.y,this._shadowRadius,this._shadowColor)},Canvas.prototype.clear=function(){if(this.__nativeObj)return this.__nativeObj.clear()},Canvas.prototype.getTexture=function(){return this.__nativeObj?this.__nativeObj.getTexture():null},Canvas.prototype.drawText=function(){return this.__nativeObj&&(this.__nativeObj.drawText(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),this._innerSetTransform()),null},Canvas.prototype.setTextSize=function(){return this.__nativeObj?this.__nativeObj.setTextSize(arguments[0]):null},Canvas.prototype.setTextAlign=function(){if(this.__nativeObj){switch(arguments[0]){case 0:case 1:case 2:this._textAlign=arguments[0];break;case"left":this._textAlign=0;break;case"center":this._textAlign=1;break;case"right":this._textAlign=2}return this.__nativeObj.setTextAlign(this._textAlign)}return null},Canvas.prototype.setTextBold=function(){return this.__nativeObj?this.__nativeObj.setTextBold(arguments[0]):null},Canvas.prototype.setTextItalic=function(){return this.__nativeObj?this.__nativeObj.setTextItalic(arguments[0]):null},Canvas.prototype.measureText=function(){return this.__nativeObj?this.__nativeObj.measureText(arguments[0],arguments[1],arguments[2]):null},Canvas.prototype.updateCanvasTexture=function(){return this.__nativeObj?this.__nativeObj.updateCanvasTexture():null},Canvas.prototype.saveTo=function(){var t=arguments.length;return this.__nativeObj&&1==t&&this.__nativeObj.saveTo(arguments[0]),null},Canvas.prototype.toDataUrl=function(){if(this.__nativeObj){var t="GameSandBox://cmdataUrltest.png";this.__nativeObj.saveTo(t);var e=BK.FileUtil.readFile(t);BK.FileUtil.deleteFile(t);var i=BK.Misc.encodeBase64FromBuffer(e);return i&&(i="data:image/png;base64,"+i),i}return""},BK.Canvas=Canvas,BK.Script.log(0,0,"Load Canvas.js succeed."),BK.Sprite.__proto__.setImagePath=function(t){if(t){this.imagePath=t;var e=new BK.Texture(t);this.setTexture(e)}},BK.Sprite.__proto__.getImagePath=function(){return this.imagePath},BK.Sprite.__proto__.setAtlas=function(t,e){BK.SpriteSheetCache.loadSheet(t);var i=BK.SpriteSheetCache.getTexturePathByFilename(e),r=new BK.Texture(i);this.setTexture(r);var n=BK.SpriteSheetCache.getFrameInfoByFilename(e);return this.adjustTexturePosition(n.frame.x,n.frame.y,n.frame.w,n.frame.h,n.rotated),0},BK.Script.log(0,0,"Load Sprite.js succeed.");var gl;BK.ScreenShot=function(){function t(){if(void 0==o){"android"==GameStatusInfo.platform&&(o=!0);var t=BK.Director.queryDeviceInfo(),e=t.version.split(".");"ios"==t.platform&&Number(e[0])>=10||"android"==t.platform?o=!0:(BK.Script.log(1,0,"Current Device dont supoort TypedArray.[info = "+JSON.stringify(t)+"]"),o=!1)}return o}function e(e){if(Object.prototype.hasOwnProperty.call(e,"__rawBKData"))return e.__rawBKData;if(Object.prototype.hasOwnProperty.call(e,"__nativeObj"))return e.__nativeObj;if(0==t()){if(e instanceof Uint16Array==1){for(var i=new BK.Buffer(e.byteLength,!1),r=0;r-1?t.playMusic(this._type,this.path,this._loopCount):(null!=i&&void 0!=i?this.__nativeObj.startMusic(i):this.__nativeObj.startMusic(),0==this._type&&e.addBackgroundToArray(this.__nativeObj,this._type,this._loopCount))},e.prototype.pauseMusic=function(){"ios"===GameStatusInfo.platform&&GameStatusInfo.QQVer.indexOf("7.5.8")>-1||(this.__nativeObj.pauseMusic(),0==this._type&&e.removeBackgrounFromArray(this.__nativeObj))},e.prototype.resumeMusic=function(){"ios"===GameStatusInfo.platform&&GameStatusInfo.QQVer.indexOf("7.5.8")>-1||(this.__nativeObj.resumeMusic(),0==this._type&&e.addBackgroundToArray(this.__nativeObj,this._type,this._loopCount))},e.prototype.stopMusic=function(){"ios"===GameStatusInfo.platform&&GameStatusInfo.QQVer.indexOf("7.5.8")>-1||(0==this._type&&e.removeBackgrounFromArray(this.__nativeObj),this.__nativeObj.stopMusic())},e.prototype.seekTo=function(t){1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")&&this.__nativeObj.seekTo(t)},e}();return Object.defineProperty(e,"switch",{get:function(){return t.switch},set:function(e){t.switch=e},enumerable:!0,configurable:!0}),e}),BK.MQQ&&BK.MQQ.Account){var headCacheDir_1="GameSandBox://_head/";BK.FileUtil.isFileExist(headCacheDir_1)||BK.FileUtil.makeDir(headCacheDir_1),BK.MQQ.Account.getHeadEx||(BK.MQQ.Account.getHeadEx=function(t,e){BK.MQQ.Account.getHead(t,function(i,r){if(r&&r.buffer&&r.width&&r.height)if(BK.Image.saveImage)BK.Image.saveImage(r.buffer,r.width,r.height,headCacheDir_1+i,"jpg"),e(i,headCacheDir_1+i+".jpg");else{var n=new BK.Texture(r.buffer,r.width,r.height),o=new BK.Sprite(r.width,r.height,n,0,0,1,1),a=new BK.RenderTexture(r.width,r.height);BK.Render.renderToTexture(o.__nativeObj?o.__nativeObj:o,a),a.saveTo(headCacheDir_1+i),e(t,headCacheDir_1+i)}else e(t,"")})}),BK.MQQ.Account.getUserInfo=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_user_info.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.getFriends=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_app_friends.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.getLocation=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_location.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.getCity=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var e="cs.get_city.local";t&&(BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){t(e,r)}),BK.MQQ.SsoRequest.send(null,e))}else t(-1,null)},BK.MQQ.Account.preloadUserInfoList=function(t,e){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.7.5")){var i="cs.preload_userInfoList.local";if(e){var r={openIdList:t};BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,function(t,i,r){e(t)}),BK.MQQ.SsoRequest.send(r,i)}}else e(-1)},BK.MQQ.Account.queryNick=function(t,e,i,r,n){var o=new BK.QQNickCanvas(t,e,i,r,function(t,e){n(o.__nativeObj,e)})},BK.MQQ.Account.queryHead=function(t,e,i,r,n){var o=new BK.QQAvatarCanvas(t,e,i,r,null,function(t,e){n(o.__nativeObj,e)})},BK.MQQ.Account.login=function(t){if(1!=BK.Misc.qqVerLessthan(GameStatusInfo.QQVer,"7.8.0")){var e="cs.xy_login.local";BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,function(e,i,r){r&&r.type&&("complete"==r.type&&t&&t.complete&&t.complete(r),"unauthorized"==r.type&&t&&t.fail&&t.fail(r),"failure"==r.type&&t&&t.fail&&t.fail(r),"success"==r.type&&t&&t.success&&t.success(r))}),BK.MQQ.SsoRequest.send(null,e)}else t&&t.fail&&t.fail({ret:1,type:"verionErr"})}}BK.Misc.compQQVersion||(BK.Misc.compQQVersion=function(t,e){for(var i=t.split("."),r=e.split("."),n=Math.min(3,Math.min(i.length,r.length)),o=0;or[o])return!1}return!1}),function(t,e){"object"==typeof t&&(t.TouchEventDispatch=function(){var t=BK.TouchEvent.getAllTouchEvent,e=BK.TouchEvent.getTouchEvent,i=BK.TouchEvent.updateTouchStatus;return{TouchEventDispatch:function(){function r(){}return r.listenAllTouch=function(t,e){void 0===this.listenerInfos&&(this.listenerInfos=[]);var i={obj:t,callback:e};this.listenerInfos.push(i)},r.remove=function(t){for(var e=-1,i=0;i1024?1024:t.length,o=new Uint8Array(n),a=0;a0?BK.FileUtil.uploadFromBuff(i,e):(BK.Script.log(1,1,"uploadFromFile failed.file is empty!"),e(-1,""))},BK.FileUtil.uploadFromBuff=function(e,i){BK.QQ.queryCloudSignature(function(r,n){t(e,n,i)})},BK.FileUtil.uploadFromNode=function(e,i){var r=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(e,r),r.writeToDiskWithXY("GameSandBox://temp.png",e.position.x,e.position.y,e.contentSize.width,e.contentSize.height);var n=BK.FileUtil.readFile("GameSandBox://temp.png");BK.QQ.queryCloudSignature(function(e,r){t(n,r,i)})},BK.FileUtil.uploadNode=function(e,i,r,n,o,a){var s=new BK.RenderTexture(BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height);BK.Render.renderToTexture(e,s),s.writeToDiskWithXY("GameSandBox://temp.png",i,r,n,o);var h=BK.FileUtil.readFile("GameSandBox://temp.png");BK.QQ.queryCloudSignature(function(e,i){t(h,i,a)})},t}()}(BK),BK.QQ.shareToArkFromFile=function(t,e,i,r){BK.FileUtil.uploadFromFile(r,function(r,n){BK.QQ.shareToArk(t,e,n,!0,i)})},BK.QQ.shareToArkFromBuff=function(t,e,i,r){BK.FileUtil.uploadFromBuff(r,function(r,n){200==r&&BK.QQ.shareToArk(t,e,n,!0,i)})},BK.QQ.shareToArkFromNode=function(t,e,i,r){BK.FileUtil.uploadFromNode(r,function(r,n){200==r&&BK.QQ.shareToArk(t,e,n,!0,i)})},BK.QQ.shareToArkFromGLShot=function(t,e,i,r){var n=new BK.ScreenShot;n.origin={x:r.x,y:r.y},n.size={width:r.width,height:r.height};var o="GameSandBox://"+BK.Time.timestamp;n.shotToFileFromGL(void 0,o,"png",function(r){BK.FileUtil.uploadFromFile(r,function(r,n){200==r&&BK.QQ.shareToArk(t,e,n,!0,i),BK.FileUtil.isFileExist(o)&&BK.FileUtil.deleteFile(o)})})},function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.UIEventHandler=e())}(this,function(){function t(){this.eveFuncTb=[],this._eventMap={1:[],2:[],3:[]},this.rootNode=BK.Director.root,this.nodeTreeHittest=function(t,e){if(1==t.canUserInteract&&0==t.hidden){if(t.children)for(var i=t.children,r=i.length-1;r>=0;r--){var n=i[r],o=this.nodeTreeHittest(n,e);if(void 0!=o)return o}return 1==t.hittest(e)?t:void 0}},this.treeHittest=function(t){return this.nodeTreeHittest(this.rootNode,t)},this.setRootNode=function(t){this.rootNode=t},this.addNodeEvent=function(t,e,i){var r={};r.obj=t,r.func=i;for(var n=!1,o=0;o=0&&(this._eventMap[e].splice(i,1),BK.Script.log(1,0,"Remove Node Event Succeed!"))},this.triggerEvent=function(t,e,i,r){for(var n=0;n=1?1.570796:Math.asin(l),Math.abs(l)>.9999?(i=0,t=Math.atan2(-o,r)):(t=Math.atan2(s,c),i=Math.atan2(n,a));var u=new Float32Array(3);return u[0]=e,u[1]=t,u[2]=i,u},e.fromScale=function(t,i,r){var n=new e;return n.data[0]=t,n.data[5]=i,n.data[10]=r,n},e.fromTranslate=function(t,i,r){var n=new e;return n.data[12]=t,n.data[13]=i,n.data[14]=r,n},e.fromEulerAngle=function(i,r,n){var o=-t(i),a=-t(r),s=-t(n),h=Math.cos(o),c=Math.sin(o),l=Math.cos(a),u=Math.sin(a),d=Math.cos(s),_=Math.sin(s);return new e(h*d+c*u*_,-h*_+c*u*d,c*l,0,_*l,d*l,-u,0,-c*d+h*u*_,_*c+h*u*d,h*l,0,0,0,0,1)},e.fromViewport=function(t,i,r,n,o,a){var s=new e;return s.data[0]=(i-t)/2,s.data[5]=(n-r)/2,s.data[10]=(a-o)/2,s.data[12]=(t+i)/2,s.data[13]=(n+r)/2,s.data[14]=(o+a)/2,s.data[15]=1,s},e.fromOrthographic=function(t,i,r,n,o,a){var s=new e;return s.data[0]=2/(i-t),s.data[5]=2/(n-r),s.data[10]=2/(o-a),s.data[12]=(t+i)/(t-i),s.data[13]=(n+r)/(r-n),s.data[14]=(o+a)/(o-a),s.data[15]=1,s},e}()}}();t.JSMatrix=i.Matrix}}(BK),function(t,e){"object"==typeof t&&(t.JSTransform=function(){return function(){function t(e){if(void 0==e)this.transform=new Float32Array(19),this.transform[2]=1,this.transform[3]=1,this.transform[4]=1,this._localAnchorOrPivot=void 0,this._parentAnchorOrPivot=void 0,this._needUpdate=!0;else{if(e instanceof t!=1)throw new Error("BK.Transform.constructor!paramater error");this.transform=new Float32Array(19),this._localAnchorOrPivot=e._localAnchorOrPivot,this._parentAnchorOrPivot=e._parentAnchorOrPivot,this._needUpdate=e._needUpdate;for(var i=0;i<19;i++)this.transform[i]=e.transform[i]}this.matrix={get:function(){return null},set:function(t,e,i,r,n,o){this._needUpdate=!0,this.transform[2]=t,this.transform[3]=r,this.transform[4]=1,this.transform[5]=i,this.transform[6]=e,this.transform[7]=0,this.transform[8]=n,this.transform[9]=o,this.transform[10]=0}}}return Object.defineProperty(t.prototype,"needUpdate",{get:function(){return this._needUpdate},set:function(t){this._needUpdate=t},enumerable:!0,configurable:!0}),t.prototype.getNeedUpdate=function(){return this._needUpdate},t.prototype.setNeedUpdate=function(t){this._needUpdate=t},Object.defineProperty(t.prototype,"scale",{get:function(){return{x:this.transform[2],y:this.transform[3],z:this.transform[4]}},set:function(t){this.transform[2]==t.x&&this.transform[3]==t.y&&this.transform[4]==t.z||(this._needUpdate=!0,this.transform[2]=void 0==t.x?1:t.x,this.transform[3]=void 0==t.y?1:t.y,this.transform[4]=void 0==t.z?1:t.z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return{x:this.transform[5],y:this.transform[6],z:this.transform[7]}},set:function(t){this.transform[5]==t.x&&this.transform[6]==t.y&&this.transform[7]==t.z||(this._needUpdate=!0,this.transform[5]=void 0==t.x?0:t.x,this.transform[6]=void 0==t.y?0:t.y,this.transform[7]=void 0==t.z?0:t.z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return{x:this.transform[8],y:this.transform[9],z:this.transform[10]}},set:function(t){this.transform[8]==t.x&&this.transform[9]==t.y&&this.transform[10]==t.z||(this._needUpdate=!0,this.transform[8]=void 0==t.x?0:t.x,this.transform[9]=void 0==t.y?0:t.y,this.transform[10]=void 0==t.z?0:t.z)},enumerable:!0,configurable:!0}),t.prototype.getPosition=function(){return{x:this.transform[8],y:this.transform[9],z:this.transform[10]}},t.prototype.setPosition=function(t,e,i){this.transform[8]==t&&this.transform[9]==e&&this.transform[10]==i||(this._needUpdate=!0,this.transform[8]=void 0==t?0:t,this.transform[9]=void 0==e?0:e,this.transform[10]=void 0==i?0:i)},Object.defineProperty(t.prototype,"localPivot",{get:function(){if(void 0!=this._localAnchorOrPivot&&0!=this._localAnchorOrPivot)throw new Error("BK.Transform.localPivot!current mode is localAnchor!!");return this._localAnchorOrPivot=0,{x:this.transform[11],y:this.transform[12]}},set:function(t){0==this._localAnchorOrPivot&&this.transform[11]==t.x&&this.transform[12]==t.y||(this._needUpdate=!0,this._localAnchorOrPivot=0,this.transform[11]=void 0==t.x?0:t.x,this.transform[12]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"localAnchor",{get:function(){if(void 0!=this._localAnchorOrPivot&&1!=this._localAnchorOrPivot)throw new Error("BK.Transform.localAnchor!current mode is localPivot!!");return this._localAnchorOrPivot=1,{x:this.transform[13],y:this.transform[14]}},set:function(t){1==this._localAnchorOrPivot&&this.transform[13]==t.x&&this.transform[14]==t.y||(this._needUpdate=!0,this._localAnchorOrPivot=1,this.transform[13]=void 0==t.x?0:t.x,this.transform[14]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pivotParent",{get:function(){if(void 0!=this._parentAnchorOrPivot&&0!=this._parentAnchorOrPivot)throw new Error("BK.Transform.pivotParent!current mode is anchorParent!!");return this._parentAnchorOrPivot=0,{x:this.transform[15],y:this.transform[16]}},set:function(t){0==this._parentAnchorOrPivot&&this.transform[15]==t.x&&this.transform[16]==t.y||(this._needUpdate=!0,this._parentAnchorOrPivot=0,this.transform[15]=void 0==t.x?0:t.x,this.transform[16]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"anchorParent",{get:function(){if(void 0!=this._parentAnchorOrPivot&&1!=this._parentAnchorOrPivot)throw new Error("BK.Transform.anchorParent!current mode is pivotParent!!");return this._parentAnchorOrPivot=1,{x:this.transform[17],y:this.transform[18]}},set:function(t){1==this._parentAnchorOrPivot&&this.transform[17]==t.x&&this.transform[18]==t.y||(this._needUpdate=!0,this._parentAnchorOrPivot=1,this.transform[17]=void 0==t.x?0:t.x,this.transform[18]=void 0==t.y?0:t.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentSize",{get:function(){return{width:this.transform[0],height:this.transform[1]}},set:function(t){this.transform[0]==t.width&&this.transform[1]==t.height||(this._needUpdate=!0,this.transform[0]=void 0==t.width?0:t.width,this.transform[1]=void 0==t.height?0:t.height)},enumerable:!0,configurable:!0}),t.prototype.getContentSize=function(){return{width:this.transform[0],height:this.transform[1]}},t.prototype.setContentSize=function(t,e){this.transform[0]==t&&this.transform[1]==e||(this._needUpdate=!0,this.transform[0]=void 0==t?0:t,this.transform[1]=void 0==e?0:e)},t.prototype.update=function(t,e){return 1==this._needUpdate&&(1==this._localAnchorOrPivot&&(this.transform[11]=this.transform[13]*this.transform[0],this.transform[12]=this.transform[14]*this.transform[1]),1==this._parentAnchorOrPivot&&(this.transform[15]=this.transform[17]*t,this.transform[16]=this.transform[18]*e),this._needUpdate=!1),this.transform},t}()}())}(BK);var __extends=this&&this.__extends||function(){var t=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])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();!function(t,e){if("object"==typeof t){var i=function(){var t=function(){function t(){this.getTypeSize=function(t){return this._gl.BYTE==t?1:this._gl.UNSIGNED_BYTE==t?1:this._gl.SHORT==t?2:this._gl.UNSIGNED_SHORT==t?2:this._gl.INT==t?4:this._gl.UNSIGNED_INT==t?4:this._gl.FLOAT==t?4:void 0},this._ibo=0,this._vbo=0,this._program=0,this._hasLoadShader=!1,this._gl=bkWebGLGetInstance()}return t.__hookGlCommit=function(){var t=bkWebGLGetInstance();BK.GLRenderContext.__updataCallback(t),t.oldGlCommit()},t.hookGLCommit=function(t){this.__updataCallback=t,this.__gl=bkWebGLGetInstance(),this.__oldGlCommit=this.__gl.glCommit,this.__gl.glCommit=this.__hookGlCommit,this.__gl.oldGlCommit=this.__oldGlCommit,this.__hookGlCommit.bind(this.__gl)},t.exit=function(){this.__gl=bkWebGLGetInstance(),this.__oldGlCommit&&(this.__gl.glCommit=this.__oldGlCommit)},Object.defineProperty(t.prototype,"gl",{get:function(){return this._gl},enumerable:!0,configurable:!0}),t.prototype.__loadShader=function(t,e){var i,r=t||"uniform mat4 worldMat; uniform mat4 projMat; attribute vec2 pos; attribute vec2 inUVs; varying lowp vec2 outUVs; void main() { gl_Position = projMat * worldMat * vec4(pos, 0, 1); outUVs = inUVs; }",n=e||"varying lowp vec2 outUVs; uniform sampler2D uSampler; void main() { gl_FragColor = texture2D(uSampler, outUVs); }",o=this._gl.createShader(this._gl.VERTEX_SHADER);t&&(this._gl.enable(this._gl.BLEND),this._gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA)),0!=o&&(this._gl.shaderSource(o,r),this._gl.compileShader(o));var a=this._gl.createShader(this._gl.FRAGMENT_SHADER);0!=a&&(this._gl.shaderSource(a,n),this._gl.compileShader(a));var s=this._gl.createProgram();return this._gl.attachShader(s,o),this._gl.attachShader(s,a),this._gl.linkProgram(s),this._gl.deleteShader(o),this._gl.deleteShader(a),this._gl.getError()==this._gl.NO_ERROR?(this._program=s,this._gl.useProgram(this._program)):(i=this._gl.getProgramInfoLog(s),BK.Script.log(1,-1,"link program fail, err = "+i)),this.calculateProjection(),this._program},t.prototype.getProgram=function(){return this._program},t.prototype.__loadArrayBuffer=function(){var t=this._gl.getAttribLocation(this._program,"pos"),e=this._gl.getAttribLocation(this._program,"inUVs");0==this._vbo&&(this._vbo=this._gl.createBuffer()),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,this._vbo),this._gl.enableVertexAttribArray(t),this._gl.enableVertexAttribArray(e),this._gl.glVertexAttribPointer(t,2,this._gl.FLOAT,!1,16,0,!0),this._gl.glVertexAttribPointer(e,2,this._gl.FLOAT,!1,16,8,!0),0==this._ibo&&(this._ibo=this._gl.createBuffer())},t.prototype.dispose=function(){0!=this._vbo&&this._gl.deleteBuffer(this._vbo),0!=this._ibo&&this._gl.deleteBuffer(this._ibo),0!=this._program&&this._gl.deleteProgram(this._program),this._gl=null},t.prototype.save=function(){this._prevVP=this._gl.glGetParameterInt(this._gl.VIEWPORT,4),this._prevVBO=this._gl.glGetParameterInt(this._gl.ARRAY_BUFFER_BINDING,1),this._prevIBO=this._gl.glGetParameterInt(this._gl.ELEMENT_ARRAY_BUFFER_BINDING,1),this._prevProgram=this._gl.glGetParameterInt(this._gl.CURRENT_PROGRAM,1),this._prevTextureID=this._gl.glGetParameterInt(this._gl.TEXTURE_BINDING_2D,1),this._prevTextureUnit=this._gl.glGetParameterInt(this._gl.ACTIVE_TEXTURE,1),this._prevFrameBuffer=this._gl.glGetParameterInt(this._gl.FRAMEBUFFER_BINDING,1),this._prevRenderBuffer=this._gl.glGetParameterInt(this._gl.RENDERBUFFER_BINDING,1),this._activeAttribusInfo=[];for(var t=this._gl.glGetProgramParameter(this._prevProgram,gl.ACTIVE_ATTRIBUTES),e=0;e0){this._activeAttribusInfo[0].stride;for(var t=0;t=n.x&&t.x<=o.x&&t.y>=n.y&&t.y<=o.y},t}(),GLRenderContext:t}}();t.GLRenderNode=i.GLRenderNode,t.GLRenderContext=i.GLRenderContext}}(BK),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.GLRenderButton=e())}(BK,function(){return function(t){function e(e,i,r){var n=t.call(this,e)||this;return n.updateTexture=function(t){},n.__nativeObj=new BK.GLRenderNode(e),n.contentSize={width:i,height:r},n.isCancelClick=void 0,n.touchStatus=0,n.canUserInteract=!0,n.enable=!0,n.canClick=!0,n.addTouchListener(),n}return __extends(e,t),e.prototype.addTouchListener=function(){"undefined"!=typeof UIEventHandler?(UIEventHandler.addNodeEvent(this,1,function(t,e,i,r){t.isCancelClick=!1,t.enable?t.changeStatus(1):t.changeStatus(2)}.bind(this)),UIEventHandler.addNodeEvent(this,2,function(t,e,i,r){var n={x:i,y:r};0==t.hittest(n)&&(t.isCancelClick=!0)}.bind(this)),UIEventHandler.addNodeEvent(this,3,function(t,e,i,r){t.enable?t.changeStatus(0):t.changeStatus(2),0==t.isCancelClick&&t.touchInsideCallback&&1==this.canClick&&t.touchInsideCallback(t)}.bind(this))):BK.Script.log(1,1,"UIEventHandler is undefined")},e.prototype.dispose=function(){UIEventHandler.removeNodeEvent(this,1),UIEventHandler.removeNodeEvent(this,2),UIEventHandler.removeNodeEvent(this,3),t.prototype.dispose.call(this)},e.prototype.changeStatus=function(t){this.touchStatus=t,this.updateTexture(t)},e.prototype.setTouchInsideCallback=function(t){this.touchInsideCallback=t},e}(BK.GLRenderNode)}),function(t,e){"object"==typeof t&&("object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PlusTips=e())}(BK,function(){return function(){function t(t){if(this.useWebGl=!0,1==arguments.length&&(this.useWebGl=t),this.screenWidth=BK.Director.screenPixelSize.width,this.screenHeight=BK.Director.screenPixelSize.height,this.screenMode=0,this.createNum=0,this.node=new Array(3),this.maskUrl="https://i.hudongcdn.com/plusRes/mask.png",this.tipsUrl_v="https://i.hudongcdn.com/plusRes/plusTips_v.png",this.tipsUrl_h="https://i.hudongcdn.com/plusRes/plusTips_h.png",this.sureBtnUrl="https://i.hudongcdn.com/plusRes/button.png",this.screenWidth>this.screenHeight){this.screenMode=1,this.scale_x=this.screenWidth/1334,this.scale_y=this.screenHeight/750;e=this.scale_x>this.scale_y?this.scale_y:this.scale_x;this.tipsWidth=700*e/BK.Director.root.scale.x,this.tipsHeight=524*e/BK.Director.root.scale.y,this.tips_x=(this.screenWidth/BK.Director.root.scale.x-this.tipsWidth)/2,this.tips_y=162*this.scale_y/BK.Director.root.scale.y,this.buttonWidth=260*e/BK.Director.root.scale.x,this.buttonHeight=81*e/BK.Director.root.scale.y,this.button_x=(this.screenWidth/BK.Director.root.scale.x-this.buttonWidth)/2,this.button_y=41*this.scale_x/BK.Director.root.scale.y}else{this.scale_x=this.screenWidth/750,this.scale_y=this.screenHeight/1334;var e=this.scale_x>this.scale_y?this.scale_y:this.scale_x;this.tipsWidth=452*e/BK.Director.root.scale.x,this.tipsHeight=820*e/BK.Director.root.scale.y,this.tips_x=(this.screenWidth/BK.Director.root.scale.x-this.tipsWidth)/2,this.tips_y=362*this.scale_y/BK.Director.root.scale.y,this.buttonWidth=260*e/BK.Director.root.scale.x,this.buttonHeight=79*e/BK.Director.root.scale.y,this.button_x=(this.screenWidth/BK.Director.root.scale.x-this.buttonWidth)/2,this.button_y=197*this.scale_y/BK.Director.root.scale.y}this.tipsUrl=1==this.screenMode?this.tipsUrl_h:this.tipsUrl_v,this.screenWidth=this.screenWidth/BK.Director.root.scale.x,this.screenHeight=this.screenHeight/BK.Director.root.scale.y}return t.prototype.showTips=function(t){this.useWebGl?this.showTipsWebGL(t):this.showTipsBK(t)},t.prototype.showTipsWebGL=function(t){this.context=new BK.GLRenderContext;var e=BK.JSMatrix.fromOrthographic(0,BK.Director.screenPixelSize.width,0,BK.Director.screenPixelSize.height,-1,1);this.context.setProjection(e),this.node[0]=new BK.GLRenderNode(this.context,{vs:"uniform mat4 worldMat; uniform mat4 projMat; attribute vec2 pos; attribute vec2 inUVs; varying lowp vec2 outUVs; void main() { gl_Position = projMat * worldMat * vec4(pos, 0, 1); outUVs = inUVs; }",fs:"precision mediump float; uniform sampler2D uSampler; void main() { gl_FragColor = texture2D(uSampler,vec2(0,0)); gl_FragColor.a = 0.8; }"}),this.node[0].setUrlPath(this.maskUrl),this.node[0].contentSize={width:this.screenWidth,height:this.screenHeight},this.node[0].position={x:0,y:0},this.node[0].canUserInteract=!0,this.node[1]=new BK.GLRenderNode(this.context),this.node[1].setUrlPath(this.tipsUrl),this.node[1].path=1==this.screenMode?"GameRes://resource/plusTips_h.png":"GameRes://resource/plusTips_v.png",this.node[1].contentSize={width:this.tipsWidth,height:this.tipsHeight},this.node[1].position={x:this.tips_x,y:this.tips_y},this.node[0].addChild(this.node[1]),this.node[2]=new BK.GLRenderButton(this.context,this.buttonWidth,this.buttonHeight),this.node[2].setUrlPath(this.sureBtnUrl),this.node[2].position={x:this.button_x,y:this.button_y},this.node[2].canUserInteract=!0,this.node[2].setTouchInsideCallback(t),this.node[0].addChild(this.node[2]),UIEventHandler&&UIEventHandler.setRootNode(this.node[0]);var i=this;BK.GLRenderContext.hookGLCommit(function(){i.context.save(),gl.viewport(0,0,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),i.context.gl.useProgram(i.context.getProgram()),i.node[0].render(),i.context.restore()})},t.prototype.showTipsBK=function(t){this.callback=t;var e={x:0,y:0},i={r:0,g:0,b:0,a:.8};this.bkCreateSprite(0,this.maskUrl,this.screenWidth,this.screenHeight,e,i);var r={x:this.tips_x,y:this.tips_y},n={r:1,g:1,b:1,a:1.25};this.bkCreateSprite(1,this.tipsUrl,this.tipsWidth,this.tipsHeight,r,n);var o={x:this.button_x,y:this.button_y},a={r:1,g:1,b:1,a:1.25};this.bkCreateSprite(2,this.sureBtnUrl,this.buttonWidth,this.buttonHeight,o,a),BK.Script.getTouchModeAll=1,BK.Director.ticker.add(function(t,e){BK.TouchEvent.getAllTouchEvent();BK.TouchEvent.updateTouchStatus()}.bind(this))},t.prototype.bkCreateSprite=function(t,e,i,r,n,o){var a=this;new BK.HttpUtil(e).requestAsync(function(s,h){if(200==h){var c=e.split("/"),l=c[c.length-1],u="GameSandBox://plusRes/"+l;if(BK.Script.log(0,0," picName = "+l+" path == "+u),BK.FileUtil.writeBufferToFile(u,s),t<2){var d=new BK.Texture(u);a.node[t]=new BK.Sprite(i,r,d,0,1,1,1)}else a.node[t]=new BK.Button(i,r,u,a.callback);a.node[t].zOrder=0,a.node[t].position=n,a.node[t].canUserInteract=!0,a.node[t].color=o,3==++a.createNum&&(BK.Director.root.addChild(a.node[0]),a.node[0].addChild(a.node[1]),a.node[0].addChild(a.node[2]))}else a.callback()})},t}()}),function(t,e){if("object"==typeof t){var i=function(){var t="attribute vec3 Position; attribute vec2 TexCoordIn; attribute vec4 SourceColor; uniform mat4 ModelView; uniform mat4 Projection; varying vec4 DestColor; varying vec2 TexCoordOut; void main() { mat4 gWVP = Projection * ModelView; gl_Position = gWVP * vec4(Position, 1); DestColor = SourceColor; TexCoordOut = TexCoordIn; }",e="varying lowp vec2 TexCoordOut; uniform int formatYUV; uniform sampler2D samplerY; uniform sampler2D samplerU; uniform sampler2D samplerV; uniform sampler2D samplerUV; const lowp vec3 defyuv = vec3(-0.0/255.0, -128.0/255.0, -128.0/255.0); void main(void) { lowp vec3 yuv = vec3(0.0); if (formatYUV == 0) { yuv.x = texture2D(samplerY, TexCoordOut).r; yuv.y = texture2D(samplerU, TexCoordOut).r; yuv.z = texture2D(samplerV, TexCoordOut).r; yuv += defyuv; } else if (formatYUV == 1) { yuv.x = texture2D(samplerY, TexCoordOut).r; yuv.y = texture2D(samplerUV, TexCoordOut).a; yuv.z = texture2D(samplerUV, TexCoordOut).r; yuv += defyuv; } else if (formatYUV == 3) { yuv.x = texture2D(samplerY, TexCoordOut).r; yuv.y = texture2D(samplerUV, TexCoordOut).r; yuv.z = texture2D(samplerUV, TexCoordOut).a; yuv += defyuv; } lowp vec3 rgb = mat3(1.0, 1.0, 1.0, 0.0, -.34414, 1.772, 1.402, -.71414, 0.0) * yuv; gl_FragColor = vec4(rgb, 1.0); }",i=(function(){function t(){}}(),function(){function t(){}}(),function(){function t(){this.videoViews=new Array,void 0!==BK.Director.setQAVDelegate&&BK.Director.setQAVDelegate(this)}return t.prototype.addView=function(t){var e=this.videoViews.filter(function(e){return t==e});return e.length||this.videoViews.push(t),0==e.length},t.prototype.delView=function(t){var e=this.videoViews.length;return this.videoViews=this.videoViews.filter(function(e){return t!=e}),e!=this.videoViews.length},t.prototype.onRemoveVideoPreview=function(t){this.videoViews.forEach(function(e){e.identifier==t.identifier&&e.render(t)})},t.prototype.onLocalVideoPreview=function(t){this.videoViews.forEach(function(e){if(e.identifier==t.identifier){var i=t,r=e;r.onPrePreview&&(i=r.onPrePreview.call(r,t)),e.render(i)}})},t.prototype.onLocalVideoPreProcess=function(t){this.videoViews.forEach(function(e){if(e.identifier==t.identifier){var i=e;i.onPreProcess&&i.onPreProcess.call(i,t)}})},t.Instance=new t,t}()),r=function(){function r(t,e,r,n,o,a,s){this.identifier=t,this.__nativeObj=new BK.Sprite(e,r,null,0,0,1,1),this._innerBindMethods4NativeObj(),null!=n&&void 0!=n||(n=!0),a&&(this.position=a),o?o.addChild(this):BK.Director.root.addChild(this),s&&(this.zOrder=s),1==n&&i.Instance.addView(this)}return r.prototype._innerBindMethods4NativeObj=function(t){var e=this;Object.getOwnPropertyNames(this.__nativeObj).forEach(function(i,r,n){var o=i;t&&-1!=t.indexOf(o)||Object.defineProperty(e,o,{get:function(){return this.__nativeObj[o]},set:function(t){this.__nativeObj[o]=t},enumerable:!0,configurable:!0})})},r.prototype.addChild=function(t){this.__nativeObj&&this.__nativeObj.addChild(t)},r.prototype._restartRenderTimer=function(){this.__renderTimeoutCallback&&this.__renderTimeoutThreshold>0&&(BK.Director.ticker.removeTimeout(this),BK.Director.ticker.setTimeout(function(t,e,i){this.__renderTimeoutCallback&&this.__renderTimeoutCallback.call(this)},this.__renderTimeoutThreshold,this))},r.prototype._innerUseRGBA=function(t,e){if(this.__bitmap){var i=this.__bitmap.size;i.width==t&&i.height==e||(BK.Script.log(0,0,"BK.QAVView.useRGBA!size change, ow = "+i.width+", oh = "+i.height+", nw = "+t+", nh = "+e),this.__bitmap=BK.Texture.createBitmapTexture(t,e),this.__nativeObj.setTexture(this.__bitmap))}else this.__bitmap=BK.Texture.createBitmapTexture(t,e),this.__nativeObj.setTexture(this.__bitmap)},r.prototype._innerUseYUVMaterial_I420=function(i,r){if(this.__yuvMaterial||(this.__yuvMaterial=new BK.Render.Material(t,e,!0),this.__nativeObj.attachComponent(this.__yuvMaterial),this.__yuvMaterial.uniforms.samplerY=0,this.__yuvMaterial.uniforms.samplerU=1,this.__yuvMaterial.uniforms.samplerV=2,this.__yuvMaterial.uniforms.samplerUV=3),this.__bitmapY){var n=this.__bitmapY.size;n.width==i&&n.height==r||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!Y size change, ow = "+n.width+", oh = "+n.height+", nw = "+i+", nh = "+r),this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY))}else this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY);if(this.__bitmapU){var o=this.__bitmapU.size;o.width==i/2&&o.height==r/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!U size change, ow = "+o.width+", oh = "+o.height+", nw = "+i+", nh = "+r),this.__bitmapU=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(1,this.__bitmapU))}else this.__bitmapU=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(1,this.__bitmapU);if(this.__bitmapV){var a=this.__bitmapV.size;a.width==i/2&&a.height==r/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_I420!V size change, ow = "+a.width+", oh = "+a.height+", nw = "+i+", nh = "+r),this.__bitmapV=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(2,this.__bitmapV))}else this.__bitmapV=BK.Texture.createBitmapTexture(i/2,r/2,7),this.__yuvMaterial.setTexture(2,this.__bitmapV)},r.prototype._innerUseYUVMaterial_NVxx=function(i,r){if(this.__yuvMaterial||(this.__yuvMaterial=new BK.Render.Material(t,e,!0),this.__nativeObj.attachComponent(this.__yuvMaterial),this.__yuvMaterial.uniforms.samplerY=0,this.__yuvMaterial.uniforms.samplerU=1,this.__yuvMaterial.uniforms.samplerV=2,this.__yuvMaterial.uniforms.samplerUV=3),this.__bitmapY){var n=this.__bitmapY.size;n.width==i&&n.height==r||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_NVxx!Y size change, ow = "+n.width+", oh = "+n.height+", nw = "+i+", nh = "+r),this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY))}else this.__bitmapY=BK.Texture.createBitmapTexture(i,r,7),this.__yuvMaterial.setTexture(0,this.__bitmapY);if(this.__bitmapUV){var o=this.__bitmapUV.size;o.width==i/2&&o.height==r/2||(BK.Script.log(0,0,"BK.QAVView.useYUVMaterial_NVxx!UV size change, ow = "+o.width+", oh = "+o.height+", nw = "+i+", nh = "+r),this.__bitmapUV=BK.Texture.createBitmapTexture(i/2,r/2,2),this.__yuvMaterial.setTexture(3,this.__bitmapUV))}else this.__bitmapUV=BK.Texture.createBitmapTexture(i/2,r/2,2),this.__yuvMaterial.setTexture(3,this.__bitmapUV)},r.prototype.render=function(t){var e=t.frameDesc.width,i=t.frameDesc.height;if(this.__nativeObj){switch(this._restartRenderTimer(),t.frameDesc.rotate){case 0:this.cameraPos&&1==this.cameraPos?this.__nativeObj.setUVFlip(1,0):this.__nativeObj.setUVFlip(1,1);break;case 1:case 2:this.cameraPos&&1==this.cameraPos?(this.__nativeObj.setUVFlip(0,1),this.__nativeObj.setUVRotate(1)):(this.__nativeObj.setUVFlip(0,0),this.__nativeObj.setUVRotate(1));break;case 3:this.cameraPos&&1==this.cameraPos?(this.__nativeObj.setUVFlip(0,1),this.__nativeObj.setUVRotate(3)):(this.__nativeObj.setUVFlip(0,0),this.__nativeObj.setUVRotate(3))}switch(t.frameDesc.colorFormat){case 10:this._innerUseRGBA(e,i),this.__bitmap.uploadSubData(0,0,e,i,t.extraData.buffer);break;case 0:this._innerUseYUVMaterial_I420(e,i),this.__yuvMaterial.uniforms.formatYUV=t.frameDesc.colorFormat,this.__bitmapY.uploadSubData(0,0,e,i,t.extraData.Y),this.__bitmapU.uploadSubData(0,0,e/2,i/2,t.extraData.U),this.__bitmapV.uploadSubData(0,0,e/2,i/2,t.extraData.V);break;case 3:case 1:this._innerUseYUVMaterial_NVxx(e,i),this.__yuvMaterial.uniforms.formatYUV=t.frameDesc.colorFormat,this.__bitmapY.uploadSubData(0,0,e,i,t.extraData.Y),this.__bitmapUV.uploadSubData(0,0,e/2,i/2,t.extraData.UV);break;default:BK.Script.log(1,-1,"BK.QAVView.render!unknown format = "+t.frameDesc.colorFormat)}}},r.prototype.renderAsCache=function(t,e,i,r,n,o,a,s){switch(o){case 0:this._innerUseYUVMaterial_I420(t,e),this.__yuvMaterial.uniforms.formatYUV=o,this.__bitmapY.uploadSubData(0,0,t,e,s.Y),this.__bitmapU.uploadSubData(0,0,t/2,e/2,s.U),this.__bitmapV.uploadSubData(0,0,t/2,e/2,s.V);break;case 3:case 1:this._innerUseYUVMaterial_NVxx(t,e),this.__yuvMaterial.uniforms.formatYUV=o,this.__bitmapY.uploadSubData(0,0,t,e,s.Y),this.__bitmapUV.uploadSubData(0,0,t/2,e/2,s.UV);break;default:return BK.Script.log(1,-1,"BK.QAVView.renderAsCache!unknown format = "+o),null}if(this.__graphic||(this.__graphic=new BK.Graphics),this.__cacheTexture){var h=this.__cacheTexture.size;h.width==i&&h.height==r||(BK.Script.log(0,0,"BK.QAVView.renderAsCache!cache tex size change, ow = "+h.width+", oh = "+h.height+", nw = "+i+", nh = "+r),this.__cacheTexture=new BK.RenderTexture(i,r,a))}else this.__cacheTexture=new BK.RenderTexture(i,r,a);if(this.__cacheSprite){var c=this.__cacheSprite.size;c.width==i&&c.height==r||(this.__cacheSprite.size={width:i,height:r})}else this.__cacheSprite=new BK.Sprite(i,r,null,0,0,1,1),this.__cacheSprite.attachComponent(this.__yuvMaterial);switch(n){case 0:this.__cacheSprite.setUVFlip(1,0),this.__cacheSprite.setUVRotate(0);break;case 1:this.__cacheSprite.setUVFlip(1,0),this.__cacheSprite.setUVRotate(1);break;case 2:this.__cacheSprite.setUVFlip(0,1),this.__cacheSprite.setUVRotate(0);break;case 3:this.__cacheSprite.setUVFlip(1,0),this.__cacheSprite.setUVRotate(4)}var l=this;return this.__graphic.drawRenderTexture(this.__cacheTexture,function(){this.drawSprite(l.__cacheSprite)}),this.__cacheTexture.readPixels(0,0,i,r,a)},r.prototype.renderAsTexture=function(){var t=new BK.RenderTexture(this.__nativeObj.size.width,this.__nativeObj.size.height,6);return BK.Render.renderToTexture(this.__nativeObj,t),t},r.prototype.hittest=function(t){return this.__nativeObj.hittest(t)},r.prototype.removeFromParent=function(){this.__nativeObj&&this.__nativeObj.removeFromParent()},r.prototype.setRenderTimeout=function(t,e){this.__renderTimeoutCallback=e,this.__renderTimeoutThreshold=t,this.__renderTimeoutThreshold>0&&this._restartRenderTimer()},r}(),n=function(){function t(){this.skipNum=-1}return t.prototype.start=function(t){function e(t,e,i){if(BK.Script.log(0,0,"BK.Camera.switchCameraEvent222!data = "+JSON.stringify(i)),0==t){BK.Script.log(0,0,"BK.Camera.switchCameraEvent!data = "+JSON.stringify(i));var r=this;BK.Director.ticker.removeTimeout(this),BK.Director.ticker.setTimeout(function(t,e,n){r.view.cameraPos=i.cameraPos,r=null},160,this)}}var n=t.identifier?t.identifier:"";if(t.width&&t.height){BK.Script.log(1,0,"BK.Camera!options = "+JSON.stringify(t)),this.options=t,this.identifier=n,this.view=new r(n,t.width,t.height,!1,t.parent,t.position),i.Instance.addView(this),this.options.needFaceTracker&&(this.detector=new BK.AI.FaceDetector(!0,!0));return BK.MQQ.SsoRequest.addListener("cs.audioRoom_camera_switch.local",this,e.bind(this)),this.isStart=!1,this}},t.prototype.configCamera=function(t){if(t&&(BK.Script.log(0,0,"configCamera"),BK.Script.log(0,0,"configCamera BK.Room ok1"),t.beauty&&(BK.Script.log(0,0,"configCamera BK.Room audioRoomSetBeauty1"),this.setBeauty(t.beauty)),t.cameraPos)){BK.Script.log(0,0,"configCamera BK.Room cameraPos");t.onSwitchCamera&&t.onSwitchCamera.bind(this);this.switchCamera(t.cameraPos,function(t,e,i){BK.Script.log(0,0,"configCamera BK.Room cameraPos errCode:"+t+" cmd:"+e+" data:"+i),this.options.onSwitchCamera&&this.options.onSwitchCamera(t,e,i)})}},t.prototype.switchCamera=function(t,e){var i={cameraPos:t},r="cs.audioRoom_cameraswitch.local";BK.MQQ.SsoRequest.addListener(r,this,e.bind(this)),BK.MQQ.SsoRequest.send(i,r)},t.prototype.setBeauty=function(t){var e={beauty:t};BK.MQQ.SsoRequest.send(e,"cs.audioRoom_set_beauty.local")},t.prototype.setSpeaker=function(t){var e={speaker:t};BK.MQQ.SsoRequest.send(e,"cs.audioRoom_set_speaker.local")},t.prototype.close=function(){},t.prototype._innerConvertRGBA=function(t){var e=this.options.scaleSample?this.options.scaleSample:1,i=t.frameDesc.width,r=t.frameDesc.height,n=function(t,e,i){var r={width:t,height:e};switch(i){case 1:case 3:r.width=e,r.height=t}return r}(t.frameDesc.width,t.frameDesc.height,t.frameDesc.rotate),o={};return o.frameDesc={},o.extraData={},o.frameDesc.width=n.width*e,o.frameDesc.height=n.height*e,o.frameDesc.rotate=0,o.frameDesc.colorFormat=10,o.frameDesc.videoSrcType=t.frameDesc.videoSrcType,o.extraData.buffer=this.view.renderAsCache(i,r,n.width*e,n.height*e,t.frameDesc.rotate,t.frameDesc.colorFormat,6,t.extraData),o},t.prototype.onPrePreview=function(t){if(this.options.onPrePreview){var e=t;if(this.detector){e=this._innerConvertRGBA(t);var i=this._innerExtractBitmap(e);(this.hasFace||-1==this.skipNum)&&(this.skipNum=0,e.faceFeatures=this.detector.detectForBitmapSync(i)),void 0==e.faceFeatures||e.faceFeatures.length<=0?(this.hasFace=!1,this.skipNum=this.skipNum+1,(this.skipNum>this.options.skipFaceTrackerNum||this.skipNum==this.options.skipFaceTrackerNum)&&(e.faceFeatures=this.detector.detectForBitmapSync(i),this.skipNum=0,e.faceFeatures&&(this.hasFace=!0))):this.hasFace=!0}this.options.onPrePreview.call(this,e)}return 0==this.isStart&&(this.configCamera(this.options),this.isStart=!0),t},t.prototype.onPreProcess=function(t){return this.options.onPreProcess?this.options.onPreProcess.call(this,t):t},t.prototype.render=function(t){this.view&&this.view.render(t)},t.prototype.renderAsTexture=function(){return this.view?this.view.renderAsTexture():null},t.prototype._innerExtractBitmap=function(t){var e={};switch(e.width=t.frameDesc.width,e.height=t.frameDesc.height,e.format=t.frameDesc.colorFormat,t.frameDesc.colorFormat){case 7:e.format=3;break;case 10:e.buffer=t.extraData.buffer,e.format=6;break;default:BK.Script.log(1,-1,"BK.QAVCamera.extractBitmap!unknown format = "+t.frameDesc.colorFormat)}switch(t.frameDesc.rotate){case 0:e.oreintation=0;break;case 1:e.oreintation=1;break;case 2:e.oreintation=5;break;case 3:e.oreintation=6}return e},t.Instance=new t,t}();return{QAVView:r,QAVCamera:new n}}();t.QAVView=i.QAVView,t.AVCamera=i.QAVCamera}}(BK),function(t,e){"object"==typeof t&&(BK.QQAVManager=function(){return new(function(){function t(){this._hasInitFlag=!1,this._hasSuccEnter=!1,this._iosHasInitFlag=!1,this._isFrontCamera=!1,this._hasStartQAVRoomFlag=!1,this._callbackQueue=[],BK.MQQ.SsoRequest.addListener("cs.audioRoom_disconnect.local",this,this.__handleRoomDisconnect.bind(this)),BK.MQQ.SsoRequest.addListener("cs.audioRoom_update_userinfo.local",this,this.__handleUserUpdate.bind(this))}return t.prototype.log=function(t){BK.Script.log(0,0,"QQAVManager:"+t)},t.prototype.errorLog=function(t){BK.Script.log(1,1,"QQAVManager Error:"+t)},t.prototype.setQAVCfg=function(t){this.qavCfg=t},t.prototype.setUpdateUserInfoCallback=function(t){var e="cs.audioRoom_update_userinfo.local";BK.MQQ.SsoRequest.removeListener(e,this),BK.MQQ.SsoRequest.addListener(e,this,t)},t.prototype.setEventCallbackConfig=function(t){this.eventCallbackConfig=t},t.prototype.initQAV=function(t,e){this.setQAVCfg(t),this.__startQAVRoom(e)},t.prototype.setMic=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={switch:t},n="cs.audioRoom_set_mic.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,e),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("setMic failed!start qav room failed")}.bind(this))},t.prototype.setSpeaker=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={switch:t},n="cs.audioRoom_set_speaker.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,e),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("setSpeaker failed!start qav room failed")}.bind(this))},t.prototype.switchCamera=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={cameraPos:t},n="cs.audioRoom_camera_switch.local";BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,function(i,r,n){0==i&&(this._isFrontCamera=0==t),e(i,r,n)}.bind(this)),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("switchCamera failed!start qav room failed")}.bind(this))},t.prototype.enableCamera=function(t,e){this.__enterQAVRoomIfNeed(function(i){if(0==i){var r={switch:t},n="cs.audioRoom_camera_enable.local";this._isFrontCamera=!0,BK.MQQ.SsoRequest.removeListener(n,this),BK.MQQ.SsoRequest.addListener(n,this,e),BK.MQQ.SsoRequest.send(r,n)}else this.errorLog("enableCamera failed!start qav room failed")}.bind(this))},t.prototype.setBeauty=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){var i={beauty:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_set_beauty.local")}else this.errorLog("setBeauty failed!start qav room failed")}.bind(this))},t.prototype.setLocalVideo=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){var i={switch:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_set_local_video.local")}else this.errorLog("setLocalVideo failed!start qav room failed")}.bind(this))},t.prototype.watchRemoteVideo=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){this.log("watchRemoteVideo ok1");var i={openIdList:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_watch_remote_video.local"),this.log("watchRemoteVideo ok2")}else this.errorLog("watchRemoteVideo failed!start qav room failed")}.bind(this))},t.prototype.setRemoteVideo=function(t){this.__enterQAVRoomIfNeed(function(e){if(0==e){var i={switch:t};BK.MQQ.SsoRequest.send(i,"cs.audioRoom_set_remote_video.local")}else this.errorLog("setMic failed!start qav room failed")}.bind(this))},t.prototype.exitRoom=function(t){this._hasInitFlag=!1,this.__exitQAVRoom(function(e,i,r){this.log("exit qav room errCode:"+e),t(e,i,r)}.bind(this))},t.prototype.getEndpointList=function(t){var e={},i="cs.audioRoom_get_endpointList.local";t&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,t)),BK.MQQ.SsoRequest.send(e,i)},t.prototype.isFrontCamera=function(){return this._isFrontCamera},t.prototype.getFluidCtrlCfg=function(t,e){var i="cs.audioRoom_get_fluid_ctrl_cfg.local";e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(t,i)},t.prototype.changeAudioCategory=function(t,e){var i="cs.audioRoom_change_audio_category.local",r={category:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},t.prototype.changeQAVRole=function(t,e){var i="cs.audioRoom_change_qav_role.local",r={role:t};e&&(BK.MQQ.SsoRequest.removeListener(i,this),BK.MQQ.SsoRequest.addListener(i,this,e)),BK.MQQ.SsoRequest.send(r,i)},t.prototype.__enterQAVRoomIfNeed=function(t){this._hasSuccEnter?t(0):(this.log("__enterQAVRoomIfNeed entering qav room."),this._callbackQueue.push(t),0==this._hasStartQAVRoomFlag&&(this._hasStartQAVRoomFlag=!0,this.__startQAVRoom(function(t,e,i){for(var r=0;r65536?(r[0]=240|(1835008&n)>>>18,r[1]=128|(258048&n)>>>12,r[2]=128|(4032&n)>>>6,r[3]=128|63&n):n>2048?(r[0]=224|(61440&n)>>>12,r[1]=128|(4032&n)>>>6,r[2]=128|63&n):n>128?(r[0]=192|(1984&n)>>>6,r[1]=128|63&n):r[0]=n,this.parsedData.push(r)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function e(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(t,e){if(void 0==t.length)throw new Error(t.length+"/"+e);for(var i=0;i_.length)throw new Error("Too long data");return i}function a(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}t.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,i=this.parsedData.length;e=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,i)},setupPositionProbePattern:function(t,e){for(var i=-1;i<=7;i++)if(!(t+i<=-1||this.moduleCount<=t+i))for(var r=-1;r<=7;r++)e+r<=-1||this.moduleCount<=e+r||(this.modules[t+i][e+r]=0<=i&&i<=6&&(0==r||6==r)||0<=r&&r<=6&&(0==i||6==i)||2<=i&&i<=4&&2<=r&&r<=4)},getBestMaskPattern:function(){for(var t=0,e=0,i=0;i<8;i++){this.makeImpl(!0,i);var r=l.getLostPoint(this);(0==i||t>r)&&(t=r,e=i)}return e},createMovieClip:function(t,e,i){var r=t.createEmptyMovieClip(e,i);this.make();for(var n=0;n>i&1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=r}for(i=0;i<18;i++){var r=!t&&1==(e>>i&1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=r}},setupTypeInfo:function(t,e){for(var i=this.errorCorrectLevel<<3|e,r=l.getBCHTypeInfo(i),n=0;n<15;n++){o=!t&&1==(r>>n&1);n<6?this.modules[n][8]=o:n<8?this.modules[n+1][8]=o:this.modules[this.moduleCount-15+n][8]=o}for(n=0;n<15;n++){var o=!t&&1==(r>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=o:n<9?this.modules[8][15-n-1+1]=o:this.modules[8][15-n-1]=o}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var i=-1,r=this.moduleCount-1,n=7,o=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[r][a-s]){var h=!1;o>>n&1)),l.getMask(e,r,a-s)&&(h=!h),this.modules[r][a-s]=h,-1==--n&&(o++,n=7)}if((r+=i)<0||this.moduleCount<=r){r-=i,i=-i;break}}}},e.PAD0=236,e.PAD1=17,e.createData=function(t,i,o){for(var a=r.getRSBlocks(t,i),s=new n,h=0;h8*u)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+8*u+")");for(s.getLengthInBits()+4<=8*u&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;;){if(s.getLengthInBits()>=8*u)break;if(s.put(e.PAD0,8),s.getLengthInBits()>=8*u)break;s.put(e.PAD1,8)}return e.createBytes(s,a)},e.createBytes=function(t,e){for(var r=0,n=0,o=0,a=new Array(e.length),s=new Array(e.length),h=0;h=0?_.get(f):0}}for(var g=0,p=0;p=0;)e^=l.G15<=0;)e^=l.G18<>>=1;return e},getPatternPosition:function(t){return l.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,i){switch(t){case c.PATTERN000:return(e+i)%2==0;case c.PATTERN001:return e%2==0;case c.PATTERN010:return i%3==0;case c.PATTERN011:return(e+i)%3==0;case c.PATTERN100:return(Math.floor(e/2)+Math.floor(i/3))%2==0;case c.PATTERN101:return e*i%2+e*i%3==0;case c.PATTERN110:return(e*i%2+e*i%3)%2==0;case c.PATTERN111:return(e*i%3+(e+i)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new i([1],0),r=0;r5&&(i+=3+n-5)}for(r=0;r=256;)t-=255;return u.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},d=0;d<8;d++)u.EXP_TABLE[d]=1<>>7-t%8&1)},put:function(t,e){for(var i=0;i>>e-i-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var _=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],f=function(){};return f.createQRModel=function(t,i){var r,n=new e(o(t,(r=void 0===i?{width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2}:i).correctLevel),r.correctLevel);return n.addData(t),n.make(),n},f.createQRCodeNode=function(t,e){var i;i=void 0===e?{width:256,height:256,colorDark:{r:0,g:0,b:0,a:1},colorLight:{r:1,g:1,b:1,a:1},correctLevel:2}:e;for(var r=new BK.Canvas(i.width,i.height),n=f.createQRModel(t,e),o=n.getModuleCount(),a=i.width/o,s=i.height/o,h=Math.round(a),c=Math.round(s),l=0;l0&&(t[h].jsonInfo=n)}else{var u=(l=c.atlas).substring(l.indexOf("://")+3,l.length);o.indexOf(u)>0&&(t[h].atlasInfo=n)}}}e(0,t)}})}function n(t,e,i){var r=[t];this.loadJsonAtlasArray(r,function(r,n){if(0==r){var o=n[0],a=o.jsonInfo,s=o.atlasInfo,h=a.data,c=s.data,l=a.path,u=s.path,d=this.loadAccessoryAnimation(h,l,c,u,e);i(d,e,t)}else i(-1,e,null)}.bind(this))}return{setAccessoryAsync:t,loadJsonAtlas:i,loadSkeletonAsync:e,setAccessoryAnimationAsync:n,loadJsonAtlasArray:r}}();t.SkeletonAnimation.__proto__.setAccessoryAsync=i.setAccessoryAsync,t.SkeletonAnimation.__proto__.loadJsonAtlas=i.loadJsonAtlas,t.SkeletonAnimation.__proto__.loadSkeletonAsync=i.loadSkeletonAsync,t.SkeletonAnimation.__proto__.setAccessoryAnimationAsync=i.setAccessoryAnimationAsync,t.SkeletonAnimation.__proto__.loadJsonAtlasArray=i.loadJsonAtlasArray}(BK),function(t,e){"object"==typeof t&&(t.AdBannerHandler=function(){return{AdBannerHandler:function(){function t(t,e){this.closeUrl="https://i.hudongcdn.com/game_cdn/ad_close.png",this.adIconUrl="https://i.hudongcdn.com/game_cdn/ad_icon.png",this.pos_id=t,this.event={},this.adInfo=e,this.sizeW=.78*BK.Director.screenPixelSize.width;var i=BK.Director.screenPixelSize.width;i>BK.Director.screenPixelSize.height&&(this.sizeW=.44*i),this.sizeH=166*this.sizeW/582,this.closeBtnW=46*this.sizeW/582,this.clsoeBtnH=46*this.sizeH/166,this.btnSpace=14*this.sizeH/166,BK.Script.log(1,1," constructor: "+this.btnSpace),this.adIconW=74*this.sizeW/582,this.adIconH=46*this.sizeH/166}return t.prototype.isUseWebGL=function(){return void 0!==gl},t.prototype.onClickContent=function(t){this.event.onClickContent=t},t.prototype.onClickClose=function(t){this.event.onClickClose=t},t.prototype.show=function(t){this.isUseWebGL()?this.showWebGLNode(t):this.showBKNode(t)},t.prototype._onLoadBackgroundCallback=function(t,e,i){200==e?(this.exposeureReport(),i(0,"OK",this)):(i(-1,"load image failed!",this),this.close())},t.prototype._jumpToDestPage=function(){BK.MQQ.Webview.open(this.adInfo.report_info.click_url)},t.prototype._emmitClickEvent=function(){this.event.onClickContent&&this.event.onClickContent()},t.prototype._onClickContentBtn=function(){this._emmitClickEvent(),this._jumpToDestPage()},t.prototype._reportClick=function(){this.clickReport(),this.cmshowReport(3)},t.prototype._onClickCloseBtn=function(){this.event.onClickClose&&this.event.onClickClose(),this.closeReport(),this.close()},t.prototype.showBKNode=function(t){this.rootNode=new BK.Node,this.rootNode.canUserInteract=!0,this.backgound=new BK.Button(this.sizeW,this.sizeH),this.backgound.setNormalTextureFromUrl(this.adInfo.display_info.basic_info.img,function(e,i){this._onLoadBackgroundCallback(e,i,t)}.bind(this)),this.rootNode.addChild(this.backgound),this.closeBtn=new BK.Button(this.closeBtnW,this.clsoeBtnH),this.closeBtn.position={x:this.sizeW-this.closeBtnW-this.btnSpace,y:this.sizeH-this.clsoeBtnH-this.btnSpace},this.closeBtn.setNormalTextureFromUrl(this.closeUrl,function(t,e){}.bind(this)),this.rootNode.addChild(this.closeBtn),this.adIconBtn=new BK.Button(this.adIconW,this.adIconH),this.adIconBtn.position={x:this.btnSpace,y:this.btnSpace},this.adIconBtn.setNormalTextureFromUrl(this.adIconUrl,function(t,e){200!=e&&BK.Script.log(1,1,"")}.bind(this)),this.rootNode.addChild(this.adIconBtn),this.backgound.setTouchInsideCallback(function(t){this._onClickContentBtn()}.bind(this)),this.closeBtn.setTouchInsideCallback(function(t){this._onClickCloseBtn()}.bind(this)),this.renderBKNode()},t.prototype.renderBKNode=function(){var t=BK.Director.screenPixelSize.width/BK.Director.root.scale.x,e=this.sizeW*(1/BK.Director.root.scale.x);this.rootNode.position={x:(t-e)/2,y:0},this.rootNode.scale={x:1/BK.Director.root.scale.x,y:1/BK.Director.root.scale.y},BK.Director.root.addChild(this.rootNode)},t.prototype.closeBKNode=function(){this.rootNode.removeFromParent()},t.prototype.showWebGLNode=function(t){this.context=new BK.GLRenderContext;var e=BK.JSMatrix.fromOrthographic(0,BK.Director.screenPixelSize.width,0,BK.Director.screenPixelSize.height,-1,1);this.context.setProjection(e);var i=BK.Director.screenPixelSize.width;BK.Director.screenPixelSize.height;this.glRootNode=new BK.GLRenderButton(this.context,this.sizeW,this.sizeH),this.glRootNode.canUserInteract=!0,this.glRootNode.canClick=!1,this.glRootNode.setUrlPath(this.adInfo.display_info.basic_info.img,function(e,i){this.glRootNode.canClick=!0,this._onLoadBackgroundCallback(e,i,t)}.bind(this)),this.glRootNode.position={x:(i-this.sizeW)/2,y:0},this.glCloseBtn=new BK.GLRenderButton(this.context,this.closeBtnW,this.clsoeBtnH),this.glCloseBtn.setUrlPath(this.closeUrl),this.glCloseBtn.position={x:this.sizeW-this.closeBtnW-this.btnSpace,y:this.sizeH-this.clsoeBtnH-this.btnSpace},this.glRootNode.addChild(this.glCloseBtn),this.glAdIconBtn=new BK.GLRenderButton(this.context,this.adIconW,this.adIconH),this.glAdIconBtn.setUrlPath(this.adIconUrl),this.glAdIconBtn.position={x:this.btnSpace,y:this.btnSpace},this.glRootNode.addChild(this.glAdIconBtn),this.glRootNode.setTouchInsideCallback(function(t){this._onClickContentBtn(),this._reportClick()}.bind(this)),this.glCloseBtn.setTouchInsideCallback(function(t){this._onClickCloseBtn()}.bind(this)),this.renderWebGLNode()},t.prototype.renderWebGLNode=function(){UIEventHandler.setRootNode(this.glRootNode),BK.GLRenderContext.hookGLCommit(function(t){if(this.context&&this.glRootNode){if(0==t.methodWorking)return;this.context.save(),t.viewport(0,0,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),t.disable(t.DEPTH_TEST),t.useProgram(this.context.getProgram()),this.glRootNode.render(),this.context.restore()}}.bind(this))},t.prototype.closeWebGLNode=function(){this.glRootNode&&this.glRootNode.dispose(),this.context&&this.context.dispose(),this.glRootNode=null,this.context=null,BK.GLRenderContext.exit()},t.prototype.close=function(){this.isUseWebGL()?this.closeWebGLNode():this.closeBKNode()},t.prototype.exposeureReport=function(t,e,i){if(this.adInfo.report_info&&this.adInfo.report_info.exposure_url){var r=this.adInfo.report_info.exposure_url,n=new BK.HttpUtil(r);BK.Script.log(0,0,"exposeureReport param:"+t+" exposure_url:"+r),n.requestAsync(function(t,e){200==e?BK.Script.log(1,1,"exposeureReport succ."):BK.Script.log(1,1,"exposeureReport failed.statuscode:"+e)}.bind(this)),this.cmshowReport(0,t,e,i)}else BK.Script.log(1,1,"exposeureReport failed. no report_info ")},t.prototype.clickReport=function(){},t.prototype.closeReport=function(t,e,i){if(this.adInfo.report_info&&this.adInfo.report_info.negative_feedback_url){var r=this.adInfo.report_info.negative_feedback_url;r=r.replace("__ACT_TYPE__","2001"),new BK.HttpUtil(r).requestAsync(function(t,e){200==e?BK.Script.log(1,1,"negative_feedback succ."):BK.Script.log(1,1,"negative_feedback failed.statuscode:"+e)}.bind(this)),this.cmshowReport(3,t,e,i)}else BK.Script.log(1,1,"closeReport failed.can not find the negative_feedback_url")},t.prototype.cmshowReport=function(t,e,i,r){var n=this.pos_id,o=t.toString(),a="",s="",h="";e&&(a=e),i&&(s=i),r&&(h=r),BK.QQ.uploadData("banner_SPA",n,o,a,s,h)},t.prototype.reportParamToString=function(){var t=this.adInfo.report_info.trace_info,e="";if("object"==typeof t){for(var i in t)e=e+i+"="+t[i]+"&";e=e.substring(0,e.length-1)}return e},t}()}}().AdBannerHandler)}(BK),function(t,e){"object"==typeof t&&(t.AdAnimateBanner=function(){function t(){return IS_IPHONE_X}function e(){return!!t()}function i(){return t()?BK.Director.screenPixelSize.height>BK.Director.screenPixelSize.width?.015*BK.Director.screenPixelSize.height:.035*BK.Director.screenPixelSize.height:0}function r(t,e,i,r,n,o,a,s,h,c,l,u,d,_,f,g){this._data=void 0!==t?[t,e,i,r,n,o,a,s,h,c,l,u,d,_,f,g]:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function n(t,e,i,n,o,a){return new r(2/(e-t),0,0,0,0,2/(n-i),0,0,0,0,2/(o-a),0,(t+e)/(t-e),(n+i)/(i-n),(o+a)/(o-a),1)}function o(t){return new r(1,0,0,0,0,1,0,0,0,0,1,0,t.x,t.y,t.z,1)}function s(t){return new r(t.x,0,0,0,0,t.y,0,0,0,0,1,0,0,0,0,1)}function h(t){return.01745329251994*t}function c(t){var e=h(-t.y),i=h(-t.x),n=h(-t.z),o=Math.cos(e),a=Math.sin(e),s=Math.cos(i),c=Math.sin(i),l=Math.cos(n),u=Math.sin(n);return new r(o*l+a*c*u,-o*u+a*c*l,a*s,0,u*s,l*s,-c,0,-a*l+o*c*u,u*a+o*c*l,o*s,0,0,0,0,1)}function l(t,e){this._gl=t;var i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,e.vs_source),t.compileShader(i);var r=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(r,e.fs_source),t.compileShader(r),this._shader_program=t.createProgram(),t.attachShader(this._shader_program,i),t.attachShader(this._shader_program,r),t.linkProgram(this._shader_program),this._attributes=[];for(a=0;a>>0}function g(r){this._ad_final_size=[],this._clickInsideCallback=void 0;for(var n=0;nBK.Director.screenPixelSize.width?.1*BK.Director.screenPixelSize.height:.2*BK.Director.screenPixelSize.height:BK.Director.screenPixelSize.height*(BK.Director.screenPixelSize.height>BK.Director.screenPixelSize.width?.12:.22)}(),STANDARD_SCALE=STANDARD_HEIGHT/AD_DESIGN_SIZE[AD_BANNER_TYPE_RESERVED_1_1].height,NODE_TWEEN_ATTR_TYPE_NONE=0,NODE_TWEEN_ATTR_TYPE_SCALE=1,NODE_TWEEN_ATTR_TYPE_SCALE_X=2,NODE_TWEEN_ATTR_TYPE_SCALE_Y=3,NODE_TWEEN_ATTR_TYPE_POSITION_X=4,NODE_TWEEN_ATTR_TYPE_POSITION_Y=5,NODE_TWEEN_ATTR_TYPE_OPACITY=6,NODE_TWEEN_ATTR_TYPE_ROTATION_X=7,NODE_TWEEN_ATTR_TYPE_ROTATION_Y=8,NODE_TWEEN_ATTR_TYPE_ROTATION_Z=9,r.prototype={constructor:r,is_identity:function(){return 1===this._data[0]&&0===this._data[1]&&0===this._data[2]&&0===this._data[3]&&0===this._data[4]&&1===this._data[5]&&0===this._data[6]&&0===this._data[7]&&0===this._data[8]&&0===this._data[9]&&1===this._data[10]&&0===this._data[11]&&0===this._data[12]&&0===this._data[13]&&0===this._data[14]&&1===this._data[15]},set_translation:function(t,e,i){this._data[12]=t,this._data[13]=e,this._data[14]=i},set_scale:function(t,e,i){this._data[0]=t,this._data[5]=e,this._data[10]=i},set:function(t,e,i,r,n,o,a,s,h,c,l,u,d,_,f,g){this._data[0]=t,this._data[1]=e,this._data[2]=i,this._data[3]=r,this._data[4]=n,this._data[5]=o,this._data[6]=a,this._data[7]=s,this._data[8]=h,this._data[9]=c,this._data[10]=l,this._data[11]=u,this._data[12]=d,this._data[13]=_,this._data[14]=f,this._data[15]=g},setTo:function(t){return this._data=t._data.slice(0),this},multiply:function(t){if(this.is_identity())return this.setTo(t);if(t.is_identity())return this;var e=this._data[0]*t._data[0]+this._data[4]*t._data[1]+this._data[8]*t._data[2]+this._data[12]*t._data[3],i=this._data[1]*t._data[0]+this._data[5]*t._data[1]+this._data[9]*t._data[2]+this._data[13]*t._data[3],r=this._data[2]*t._data[0]+this._data[6]*t._data[1]+this._data[10]*t._data[2]+this._data[14]*t._data[3],n=this._data[3]*t._data[0]+this._data[7]*t._data[1]+this._data[11]*t._data[2]+this._data[15]*t._data[3],o=this._data[0]*t._data[4]+this._data[4]*t._data[5]+this._data[8]*t._data[6]+this._data[12]*t._data[7],a=this._data[1]*t._data[4]+this._data[5]*t._data[5]+this._data[9]*t._data[6]+this._data[13]*t._data[7],s=this._data[2]*t._data[4]+this._data[6]*t._data[5]+this._data[10]*t._data[6]+this._data[14]*t._data[7],h=this._data[3]*t._data[4]+this._data[7]*t._data[5]+this._data[11]*t._data[6]+this._data[15]*t._data[7],c=this._data[0]*t._data[8]+this._data[4]*t._data[9]+this._data[8]*t._data[10]+this._data[12]*t._data[11],l=this._data[1]*t._data[8]+this._data[5]*t._data[9]+this._data[9]*t._data[10]+this._data[13]*t._data[11],u=this._data[2]*t._data[8]+this._data[6]*t._data[9]+this._data[10]*t._data[10]+this._data[14]*t._data[11],d=this._data[3]*t._data[8]+this._data[7]*t._data[9]+this._data[11]*t._data[10]+this._data[15]*t._data[11],_=this._data[0]*t._data[12]+this._data[4]*t._data[13]+this._data[8]*t._data[14]+this._data[12]*t._data[15],f=this._data[1]*t._data[12]+this._data[5]*t._data[13]+this._data[9]*t._data[14]+this._data[13]*t._data[15],g=this._data[2]*t._data[12]+this._data[6]*t._data[13]+this._data[10]*t._data[14]+this._data[14]*t._data[15],p=this._data[3]*t._data[12]+this._data[7]*t._data[13]+this._data[11]*t._data[14]+this._data[15]*t._data[15];return this.set(e,i,r,n,o,a,s,h,c,l,u,d,_,f,g,p),this},multiplyXY:function(t){return{x:t.x*this._data[0]+t.y*this._data[4]+this._data[12],y:t.x*this._data[1]+t.y*this._data[5]+this._data[13]}}},SHADER_UNIFORM_TYPE_FLOAT1=1,SHADER_UNIFORM_TYPE_FLOAT2=2,SHADER_UNIFORM_TYPE_FLOAT3=3,SHADER_UNIFORM_TYPE_FLOAT4=4,SHADER_UNIFORM_TYPE_INT1=5,SHADER_UNIFORM_TYPE_INT2=6,SHADER_UNIFORM_TYPE_INT3=7,SHADER_UNIFORM_TYPE_INT4=8,SHADER_UNIFORM_TYPE_FLOATV1=9,SHADER_UNIFORM_TYPE_FLOATV2=10,SHADER_UNIFORM_TYPE_FLOATV3=11,SHADER_UNIFORM_TYPE_FLOATV4=12,SHADER_UNIFORM_TYPE_INTV1=13,SHADER_UNIFORM_TYPE_INTV2=14,SHADER_UNIFORM_TYPE_INTV3=15,SHADER_UNIFORM_TYPE_INTV4=16,SHADER_UNIFORM_TYPE_MATRIX2=17,SHADER_UNIFORM_TYPE_MATRIX3=18,SHADER_UNIFORM_TYPE_MATRIX4=19,SHADER_UNIFORM_TYPE_TEXTURE0=20,SHADER_UNIFORM_TYPE_TEXTURE1=21,SHADER_UNIFORM_TYPE_TEXTURE2=22,SHADER_UNIFORM_TYPE_TEXTURE3=23,SHADER_UNIFORM_TYPE_TEXTURE4=24,SHADER_UNIFORM_TYPE_TEXTURE5=25,SHADER_UNIFORM_TYPE_TEXTURE6=26,SHADER_UNIFORM_TYPE_TEXTURE7=27,l.prototype={set_uniform:function(t,e,i){for(var r=0;r=i.x&&t.x<=r.x&&t.y>=i.y&&t.y<=r.y},_.prototype=Object.create(d.prototype),_.prototype.constructor=_,_.prototype.addTouchListener=function(){"undefined"!=typeof UIEventHandler?(UIEventHandler.addNodeEvent(this,1,function(t,e,i,r){t.isCancelClick=!1,t.enable?t.changeStatus(1):t.changeStatus(2)}.bind(this)),UIEventHandler.addNodeEvent(this,2,function(t,e,i,r){var n={x:i,y:r};0==t.hittest(n)&&(t.isCancelClick=!0)}.bind(this)),UIEventHandler.addNodeEvent(this,3,function(t,e,i,r){t.enable?t.changeStatus(0):t.changeStatus(2),0==t.isCancelClick&&t.touchInsideCallback&&1==this.canClick&&t.touchInsideCallback(t)}.bind(this))):BK.Script.log(1,1,"UIEventHandler is undefined")},_.prototype.setTouchInsideCallback=function(t){this.touchInsideCallback=t},_.prototype.dispose=function(){UIEventHandler.removeNodeEvent(this,1),UIEventHandler.removeNodeEvent(this,2),UIEventHandler.removeNodeEvent(this,3),d.prototype.dispose.call(this)},_.prototype.changeStatus=function(t){this.touchStatus=t,this.updateTexture(t)},_.prototype.updateTexture=function(t){},g.prototype={constructor:g,setHidden:function(t){this._root_node?this._root_node.hidden=t:BK.Script.log(1,1,"set hidden error.root_node is null")},dispose:function(){this._is_webgl?(this._root_node.dispose(),this._root_node=void 0,this.webGL_exit()):this._root_node.removeFromParent()},_onTouchInside:function(){BK.Script.log(1,1,"_onTouchInside"),this._clickInsideCallback&&this._clickInsideCallback()},setClickContentCallback:function(t){this._clickInsideCallback=t},create_texture:function(t,e){if(this._is_webgl){var i=this._gl,r=i.RGBA,n=i.RGBA,o=i.UNSIGNED_BYTE,a=BK.Image.loadImage(t,6),s=i.createTexture();return i.bindTexture(i.TEXTURE_2D,s),i.texImage2D(i.TEXTURE_2D,0,r,n,o,a),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),{width:a.width,height:a.height,texture:s,tex_file:t,need_delete:e}}return new BK.Texture(t)},create_clip_node:function(t,r){if(this._is_webgl){e()&&(r.x+=.5*BK.Director.screenPixelSize.width,r.y=i());var n=new u;return this._clip_rect=r,t.addChild(n),n}return(n=new BK.ClipRectNode(r.x,r.y,r.width,r.height)).enableClip=!0,t.addChild(n),n},create_node:function(t){if(this._is_webgl){e=new u;return void 0!==t?t.addChild(e):this._gl_root_node.addChild(e),e}var e=new BK.Node;return void 0!==t?t.addChild(e):BK.Director.root.addChild(e),e},create_sprite:function(t,e,i,r){var n=this.create_texture(e,r);return this.create_sprite_with_texture(t,n,i)},create_button:function(t,e,i,r){if(this._is_webgl){var n=new _(i.width,i.height,e,0,1,1,1);return r&&n.setTouchInsideCallback(r),void 0!==t?t.addChild(n):this._gl_root_node.addChild(n),n}return(n=new BK.Button(i.width,i.height)).setNormalTexture(e),n.updateTexture=function(){},r&&n.setTouchInsideCallback(r),void 0!==t?t.addChild(n):BK.Director.root.addChild(n),n},create_sprite_with_texture:function(t,e,i){if(this._is_webgl){r=new d(i.width,i.height,e,0,1,1,1);return void 0!==t?t.addChild(r):this._gl_root_node.addChild(r),r}var r=new BK.Sprite(i.width,i.height,e,0,1,1,1);return void 0!==t?t.addChild(r):BK.Director.root.addChild(r),r},create_text:function(t,e){if(this._is_webgl){var i=new BK.CanvasNode(t.maxWidth,t.maxHeight);i.fillColor=t.textColor,i.strokeColor=t.strokeColor,i.setTextAlign(t.textAlign),i.setTextSize(t.fontSize),i.setTextItalic(t.italic),i.setTextBold(t.bold),i.setTextShadow(t.shadowDx,t.shadowDy,t.shadowRadius,t.shadowColor);var r=i.measureText(e,t.maxWidth,t.maxHeight);i.drawText(e,0,0,r.width,r.height);var n=i.getBitmap(),o=this._gl,a=o.RGBA,s=o.RGBA,h=o.UNSIGNED_BYTE,c=o.createTexture();o.bindTexture(o.TEXTURE_2D,c),o.texImage2D(o.TEXTURE_2D,0,a,s,h,n),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR);var l={width:n.width,height:n.height,texture:c,tex_file:e,need_delete:!0},u=new d(n.width,n.height,l,0,1,1,1);return u.anchor={x:0,y:0},u.width=r.width,u.height=r.height,u}return t.textColor=f(t.textColor),t.strokeColor=f(t.strokeColor),t.shadowColor=f(t.shadowColor),new BK.TextNode(t,e)},show:function(t){if(!this._is_webgl){var i=BK.Director.root.scale;this._root_node.scale={x:1/i.x,y:1/i.y,z:1/i.z},this._root_node.enableClip=e()}void 0!==this._real_content_node&&this._content_node.removeChild(this._real_content_node),this._real_content_node=this.create_node(this._content_node),void 0!==t.content&&t.content.length>20&&(t.content=t.content.substring(0,20),t.content=t.content+"...");var r=this._ad_final_size[t.ad_type];switch(t.ad_type){case AD_BANNER_TYPE_DYNAMIC_193_582_166:case AD_BANNER_TYPE_STATIC_193_582_166:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};break;case AD_BANNER_TYPE_DYNAMIC_194_147_147:case AD_BANNER_TYPE_STATIC_194_147_147:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};var n=15*STANDARD_SCALE,o=0;o=t.ad_type===AD_BANNER_TYPE_DYNAMIC_194_147_147?(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-80*STANDARD_SCALE-n:(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-r.width-2*n;var a=26,s=this.create_text({fontSize:a*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:o,maxHeight:30*STANDARD_SCALE,width:o,height:30*STANDARD_SCALE,textAlign:0,bold:1,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.title);s.position={x:r.width+n,y:-50*STANDARD_SCALE},this._real_content_node.addChild(s),(m=this.create_text({fontSize:a*STANDARD_SCALE,textColor:{r:.4,g:.4,b:.4,a:1},maxWidth:o,maxHeight:60*STANDARD_SCALE,width:o,height:60*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:0,y:1},m.position={x:r.width+n,y:-65*STANDARD_SCALE},this._real_content_node.addChild(m);break;case AD_BANNER_TYPE_DYNAMIC_184_240_180:case AD_BANNER_TYPE_STATIC_184_240_180:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};var n=15*STANDARD_SCALE,o=0;o=t.ad_type===AD_BANNER_TYPE_DYNAMIC_184_240_180?(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-60*STANDARD_SCALE-n:(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-r.width-2*n;a=26;(m=this.create_text({fontSize:a*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:o,maxHeight:60*STANDARD_SCALE,width:o,height:60*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:0,y:1},m.position={x:r.width+n,y:.5*(m.height-r.height)},this._real_content_node.addChild(m);break;case AD_BANNER_TYPE_DYNAMIC_285_240_180_3:case AD_BANNER_TYPE_STATIC_285_240_180_3:var h=23*STANDARD_SCALE,c=0,l=0,u=3*STANDARD_SCALE;t.ad_type===AD_BANNER_TYPE_STATIC_285_240_180_3&&(h=11*STANDARD_SCALE,c=11*STANDARD_SCALE,l=-6*STANDARD_SCALE,u=4*STANDARD_SCALE);var d=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0);d.anchor={x:0,y:1},d.position={x:c,y:l};var _=this.create_sprite(this._real_content_node,t.tex_files[1],r,!0);_.anchor={x:0,y:1},_.position={x:c+r.width+h,y:l};var f=this.create_sprite(this._real_content_node,t.tex_files[2],r,!0);f.anchor={x:0,y:1},f.position={x:c+2*(r.width+h),y:l};o=0;o=t.ad_type===AD_BANNER_TYPE_DYNAMIC_285_240_180_3?(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-40*STANDARD_SCALE:(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-40*STANDARD_SCALE;a=24;(m=this.create_text({fontSize:a*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:o,maxHeight:30*STANDARD_SCALE,width:o,height:30*STANDARD_SCALE,textAlign:1,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:.5,y:1},m.position={x:.5*o,y:-r.height-u},this._real_content_node.addChild(m);break;case AD_BANNER_TYPE_DYNAMIC_210_640_288:case AD_BANNER_TYPE_STATIC_210_640_288:(g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0)).anchor={x:0,y:1};var n=10*STANDARD_SCALE,o=0;o=t.ad_type===AD_BANNER_TYPE_DYNAMIC_210_640_288?(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-50*STANDARD_SCALE-n:(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)-r.width-2*n;a=24;(m=this.create_text({fontSize:a*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:o,maxHeight:120*STANDARD_SCALE,width:o,height:120*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content)).anchor={x:0,y:.5},m.position={x:r.width+n,y:.5*-r.height},this._real_content_node.addChild(m);break;case AD_BANNER_TYPE_DYNAMIC_65_1000_560:case AD_BANNER_TYPE_STATIC_65_1000_560:var g=this.create_sprite(this._real_content_node,t.tex_files[0],r,!0);g.anchor={x:0,y:1};var n=10*STANDARD_SCALE,o=0;if(t.ad_type===AD_BANNER_TYPE_DYNAMIC_65_1000_560)o=(p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width)-r.width-50*STANDARD_SCALE-n;else{var p=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width;o=p-r.width-2*n}var a=26,m=this.create_text({fontSize:a*STANDARD_SCALE,textColor:{r:.2,g:.2,b:.2,a:1},maxWidth:o,maxHeight:120*STANDARD_SCALE,width:o,height:120*STANDARD_SCALE,textAlign:0,bold:0,italic:0,strokeColor:{r:1,g:1,b:1,a:1},strokeSize:0,shadowRadius:0,shadowDx:0,shadowDy:0,shadowColor:{r:1,g:1,b:1,a:1}},t.content);m.anchor={x:0,y:.5},m.position={x:r.width+n,y:.5*-r.height},this._real_content_node.addChild(m)}var v=t.ad_type>=AD_BANNER_TYPE_DYNAMIC_193_582_166&&t.ad_type<=AD_BANNER_TYPE_DYNAMIC_65_1000_560;this.anim_node_1(v),this.anim_node_2(v,t.ad_type===AD_BANNER_TYPE_STATIC_285_240_180_3?11*STANDARD_SCALE:0,t.ad_type===AD_BANNER_TYPE_STATIC_285_240_180_3?25*STANDARD_SCALE:0),this.anim_node_3(v)},update:function(t){this._node_1.update_tweens(t),this._node_2.update_tweens(t),this._node_3.update_tweens(t)},node_extend:function(t){return t._next_tween_handler=0,t._all_tween_data=[],t.tween_from_to=function(t,e,i,r,n,o,a){var s=this._next_tween_handler;return this._next_tween_handler+=1,this._all_tween_data.push({attr_type:t,duration:e,delay:i,interval:r,from:n,to:o,loop_count:a,pass_time:-i,handler:s,is_stop:!1}),s},t.remove_tween=function(t){for(;0=i.duration)i.pass_time-=i.duration,-1===i.loop_count?(i.pass_time-=i.interval,this.update_tween_value(i,i.to)):(i.loop_count-=1,i.loop_count>=0?(i.pass_time-=i.interval,this.update_tween_value(i,i.to)):(this.update_tween_value(i,i.to),i.is_stop=!0));else if(i.pass_time>0){var r=(i.to-i.from)*(i.pass_time/i.duration)+i.from;this.update_tween_value(i,r)}++e}}},t.update_tween_value=function(t,e){switch(t.attr_type){case NODE_TWEEN_ATTR_TYPE_SCALE:this.scale={x:e,y:e};break;case NODE_TWEEN_ATTR_TYPE_SCALE_X:this.scale={x:e,y:this.scale.y};break;case NODE_TWEEN_ATTR_TYPE_SCALE_Y:this.scale={x:this.scale.x,y:e};break;case NODE_TWEEN_ATTR_TYPE_POSITION_X:this.position={x:e,y:this.position.y};break;case NODE_TWEEN_ATTR_TYPE_POSITION_Y:this.position={x:this.position.x,y:e};break;case NODE_TWEEN_ATTR_TYPE_OPACITY:this.opacity=e;break;case NODE_TWEEN_ATTR_TYPE_ROTATION_X:this.rotation={x:e,y:this.rotation.y,z:this.rotation.z};break;case NODE_TWEEN_ATTR_TYPE_ROTATION_Y:this.rotation={x:this.rotation.x,y:e,z:this.rotation.z};break;case NODE_TWEEN_ATTR_TYPE_ROTATION_Z:this.rotation={x:this.rotation.x,y:this.rotation.y,z:e}}},t},anim_node_1:function(t){if(t){var e={x:.8,y:.2},i=.5*-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width+.4*this._ad_final_size[AD_BANNER_TYPE_RESERVED_0].width,r=0-.7*this._ad_final_size[AD_BANNER_TYPE_RESERVED_0].height;this._node_1.anchor=e,this._node_1.visible=!0,this._node_1.position={x:i,y:r},this._node_1.rotation={x:0,y:0,z:120},this._node_1.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.1,.2,0,r,0,0),this._node_1.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.3,.2,0,120,10,0)}else this._node_1.visible=!1},anim_node_2:function(t,e,i){var r={x:.8,y:0},n=(t?this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width)*(r.x-.5);this._node_2.position={x:n,y:0},t?(this._node_2.rotation={x:0,y:0,z:120},this._node_2.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.3,0,0,120,0,0),this._node_2_1.anchor={x:.5,y:.5},this._node_2_1.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1],this._node_2_1.setTexture(this._tex_bg_bg_1),this._node_2_1.position={x:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width*(.5-r.x),y:.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height},this._content_node.position={x:20*STANDARD_SCALE-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width*r.x,y:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height-6*STANDARD_SCALE},this._node_2_2.anchor={x:.5,y:.5},this._node_2_2.setTexture(this._tex_bg_fg_1),this._node_2_2.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1],this._node_2_2.position={x:this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1].width*(.5-r.x),y:.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_1].height}):(this._node_2.rotation={x:0,y:0,z:0},this._node_2_1.anchor={x:.5,y:.5},this._node_2_1.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2],this._node_2_1.setTexture(this._tex_bg_bg_2),this._node_2_1.position={x:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width*(.5-r.x),y:.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].height},this._content_node.position={x:-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width*r.x,y:this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].height},this._node_2_2.anchor={x:0,y:0},this._node_2_2.size=this._ad_final_size[AD_BANNER_TYPE_RESERVED_2_2],this._node_2_2.setTexture(this._tex_bg_fg_2),this._node_2_2.position={x:5*STANDARD_SCALE+this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_2].width*-r.x+e,y:5*STANDARD_SCALE+i})},anim_node_3:function(t){if(t){var e={x:.5,y:.5},i=.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width+.15*this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width,r=.5*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height-.1*this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height,n=.3*this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].width,o=-this._ad_final_size[AD_BANNER_TYPE_RESERVED_1_1].height,a=Math.sqrt((i-n)*(i-n)+(r-o)*(r-o)),s={x:(i-n)/a,y:(r-o)/a},h=i+this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width*s.x*.2,c=r+this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height*s.y*.2,l=i-this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].width*s.x*.1,u=r-this._ad_final_size[AD_BANNER_TYPE_RESERVED_3].height*s.y*.1;this._node_3.anchor=e,this._node_3.visible=!0,this._node_3.position={x:n,y:o},this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.3,.1,0,n,h,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.3,.1,0,o,c,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.15,.4,0,h,l,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.15,.4,0,c,u,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.15,.4,0,0,5,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_X,.08,.55,0,l,i,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_POSITION_Y,.08,.55,0,u,r,0),this._node_3.tween_from_to(NODE_TWEEN_ATTR_TYPE_ROTATION_Z,.08,.55,0,5,0,0)}else this._node_3.visible=!1},gl_commit:function(t){var e=t._gl;UIEventHandler&&UIEventHandler.setRootNode(t._root_node),t.webGL_save(),e.viewport(0,0,BK.Director.screenPixelSize.width,BK.Director.screenPixelSize.height),e.disable(e.DEPTH_TEST),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);var i=n(0,BK.Director.screenPixelSize.width,0,BK.Director.screenPixelSize.height,-1,1);t._webgl_shader.set_uniform("Projection",i);var o=new r;t._webgl_shader.set_uniform("ModelView",o),t._gl_root_node.render(e,t._webgl_shader,!0),t.webGL_restore(),e.superGLCommit()},webGL_init:function(){this._gl=bkWebGLGetInstance(),this._gl_root_node=new u,this._webgl_shader=this.webGL_load_shader(),this._gl.superGLCommit=this._gl.glCommit,this._gl.glCommit=this.gl_commit.bind(this._gl,this)},webGL_load_shader:function(){var t=new r,e={vs_source:"attribute vec3 Position;attribute vec4 SourceColor;varying vec4 DestinationColor;uniform mat4 Projection;uniform mat4 ModelView;attribute vec2 TexCoordIn;varying vec2 TexCoordOut;void main(void) { DestinationColor = SourceColor; mat4 mp = Projection * ModelView; gl_Position = mp * vec4(Position, 1.0); TexCoordOut = TexCoordIn;}",fs_source:"varying lowp vec4 DestinationColor;varying lowp vec2 TexCoordOut;uniform sampler2D Texture;void main(void) { lowp vec4 tc = texture2D(Texture, TexCoordOut); gl_FragColor = DestinationColor * tc;}",attributes:[{name:"Position",size:3},{name:"SourceColor",size:4},{name:"TexCoordIn",size:2}],uniforms:[{name:"Projection",type:SHADER_UNIFORM_TYPE_MATRIX4,default_value:t},{name:"ModelView",type:SHADER_UNIFORM_TYPE_MATRIX4,default_value:t},{name:"Texture",type:SHADER_UNIFORM_TYPE_TEXTURE0,default_value:0}]};return new l(this._gl,e)},webGL_exit:function(){void 0!==this._gl.superGLCommit&&(this._gl.glCommit=this._gl.superGLCommit,this._gl.superGLCommit=void 0),this._tex_bg_left&&(this._gl.deleteTexture(this._tex_bg_left.texture),this._gl.deleteTexture(this._tex_bg_bg_1.texture),this._gl.deleteTexture(this._tex_bg_bg_2.texture),this._gl.deleteTexture(this._tex_bg_fg_1.texture),this._gl.deleteTexture(this._tex_bg_fg_2.texture),this._gl.deleteTexture(this._tex_bg_right.texture))},webGL_save:function(){e()&&(this._is_clip_enabled=this._gl.glIsEnabled(this._gl.SCISSOR_TEST),this._is_clip_enabled?this._old_scissor=this._gl.glGetParameterInt(this._gl.SCISSOR_BOX,4):this._gl.glEnable(this._gl.SCISSOR_TEST),this._gl.glScissor(this._clip_rect.x,this._clip_rect.y,this._clip_rect.width,this._clip_rect.height)),this._is_enable_blend=this._gl.glIsEnabled(this._gl.BLEND),this._is_enable_blend&&(this._blend_color=this._gl.glGetParameterFloat(this._gl.BLEND_COLOR,4),this._blend_equation_rgb=this._gl.getParameter(this._gl.BLEND_EQUATION_RGB),this._blend_equation_alpha=this._gl.getParameter(this._gl.BLEND_EQUATION_ALPHA),this._blend_src_rgb=this._gl.getParameter(this._gl.BLEND_SRC_RGB),this._blend_src_alpha=this._gl.getParameter(this._gl.BLEND_SRC_ALPHA),this._blend_dst_rgb=this._gl.getParameter(this._gl.BLEND_DST_RGB),this._blend_dst_alpha=this._gl.getParameter(this._gl.BLEND_DST_ALPHA)),this._prevVP=this._gl.glGetParameterInt(this._gl.VIEWPORT,4),this._prevVBO=this._gl.glGetParameterInt(this._gl.ARRAY_BUFFER_BINDING,1),this._prevIBO=this._gl.glGetParameterInt(this._gl.ELEMENT_ARRAY_BUFFER_BINDING,1),this._prevProgram=this._gl.glGetParameterInt(this._gl.CURRENT_PROGRAM,1),this._prevTextureID=this._gl.glGetParameterInt(this._gl.TEXTURE_BINDING_2D,1),this._prevTextureUnit=this._gl.glGetParameterInt(this._gl.ACTIVE_TEXTURE,1),this._prevFrameBuffer=this._gl.glGetParameterInt(this._gl.FRAMEBUFFER_BINDING,1),this._prevRenderBuffer=this._gl.glGetParameterInt(this._gl.RENDERBUFFER_BINDING,1),this._activeAttribusInfo=[];for(var t=this._gl.glGetProgramParameter(this._prevProgram,gl.ACTIVE_ATTRIBUTES),i=0;i0){this._activeAttribusInfo[0].stride;for(var t=0;t