var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};var _p=window,_p=Object.prototype,_p=null;cc._drawingUtil=null;cc._renderContext=null;cc._supportRender=!1;cc._canvas=null;cc.container=null;cc._gameDiv=null;window.ENABLE_IMAEG_POOL=!0;cc.each=function(a,b,c){if(a)if(a instanceof Array)for(var d=0,e=a.length;d=a._limit)){var b=a._pool.shift(),c=b.value,d=b.index;a._workingSize++;a._iterator.call(a._iteratorTarget,c,d,function(b,c){if(!a._finished)if(b?a._errors[this.index]=b:a._results[this.index]=c,a.finishedSize++,a._workingSize--,a.finishedSize===a.size)a.onEnd(0===a._errors.length?null:a._errors,a._results);else a._handleItem()}.bind(b),a)}};f.flow=function(){if(0===this._pool.length)this._onEnd&&this._onEnd.call(this._onEndTarget,null,[]);else for(var a= 0;ac?a+b+d:a.substring(0,c)+b+d},changeBasename:function(a,b,c){if(0===b.indexOf("."))return this.changeExtname(a,b);var d=a.indexOf("?"),e="";c=c?this.extname(a):"";0=d?0:d+1)+b+c+e},_normalize:function(a){var b=a=String(a);do b=a,a=a.replace(this.normalizeRE,"");while(b.length!==a.length);return a}}; var imagePool={_pool:Array(10),_MAX:10,_smallImg:"data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA\x3d",count:0,get:function(){if(0=b.length)d&&d();else{var e=this;e._createScript(cc.path.join(a,b[c]),!1,function(f){if(f)return d(f);e._loadJs4Dependency(a,b,c+1,d)})}},_loadJsImg:function(){var a=document,b=a.getElementById("cocos2d_loadJsImg");if(!b){b=document.createElement("img");cc._loadingImage&&(b.src=cc._loadingImage);a=a.getElementById(cc.game.config.id); a.style.backgroundColor="transparent";a.parentNode.appendChild(b);var c=getComputedStyle?getComputedStyle(a):a.currentStyle;c||(c={width:a.width,height:a.height});b.style.left=a.offsetLeft+(parseFloat(c.width)-b.width)/2+"px";b.style.top=a.offsetTop+(parseFloat(c.height)-b.height)/2+"px";b.style.position="absolute"}return b},loadTxt:function(a,b){if(cc._isNodeJs)require("fs").readFile(a,function(a,c){a?b(a):b(null,c.toString())});else{var c=this.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET", a,!0);if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent))c.setRequestHeader("Accept-Charset","utf-8"),c.onreadystatechange=function(){4===c.readyState&&(200===c.status||0===c.status?b(null,c.responseText):b({status:c.status,errorMessage:d},null))};else{c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8");var e=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout", r);4===c.readyState&&(200===c.status||0===c.status?b(null,c.responseText):b({status:c.status,errorMessage:d},null))},f=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",r);b({status:c.status,errorMessage:d},null)},r=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",r);b({status:c.status,errorMessage:"Request timeout: "+ d},null)};c.addEventListener("load",e);c.addEventListener("error",f);void 0===c.ontimeout?c._timeoutId=setTimeout(function(){r()},c.timeout):c.addEventListener("timeout",r)}c.send(null)}},loadCsb:function(a,b){var c=cc.loader.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET",a,!0);c.responseType="arraybuffer";var e=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",r);var a=c.response;a&&(window.msg= a);4===c.readyState&&(200===c.status||0===c.status?b(null,c.response):b({status:c.status,errorMessage:d},null))},f=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",r);b({status:c.status,errorMessage:d},null)},r=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",r);b({status:c.status,errorMessage:"Request timeout: "+ d},null)};c.addEventListener("load",e);c.addEventListener("error",f);void 0===c.ontimeout?c._timeoutId=setTimeout(function(){r()},c.timeout):c.addEventListener("timeout",r);c.send(null)},loadJson:function(a,b){this.loadTxt(a,function(c,d){if(c)b(c);else{try{var e=JSON.parse(d)}catch(f){throw Error("parse json ["+a+"] failed : "+f);}b(null,e)}})},_checkIsImageURL:function(a){return null!=/(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(a)},loadImg:function(a,b,c,d){var f={isCrossOrigin:!0};void 0!== c?f.isCrossOrigin=void 0===b.isCrossOrigin?f.isCrossOrigin:b.isCrossOrigin:void 0!==b&&(c=b);if(b=this.getRes(a))return c&&c(null,b),null;if(b=e[a])return b.callbacks.push(c),b.img;d=d||imagePool.get();d.crossOrigin=f.isCrossOrigin&&"file://"!==location.origin?"Anonymous":null;var p=function(){this.removeEventListener("load",p,!1);this.removeEventListener("error",s,!1);var b=e[a];if(b){for(var c=b.callbacks,f=0;fb)return"";var c=a[0],d=!0;"object"===typeof c&&(d=!1);for(var e=1;ec)a[b.renderMode]=0;cc._renderType=cc.game.RENDER_TYPE_CANVAS;cc._supportRender=!1;0===c?cc.sys.capabilities.opengl?(cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0):cc.sys.capabilities.canvas&&(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender=!0):1===c&&cc.sys.capabilities.canvas?(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender=!0):2===c&&cc.sys.capabilities.opengl&& (cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0)}function b(a,c,d){if(h[c])return null;d=d||"";var e=[],f=a[c];if(!f)throw Error("can not find module ["+c+"]");c=cc.path;for(var g=0,k=f.length;gg.indexOf("base4webgl")?g.splice(0,0,"base4webgl"):0>g.indexOf("core")&&g.splice(0,0,"core");for(var m=0,s=g.length;mc.indexOf("core")&&c.splice(0,0,"core");c&&(a[b.modules]=c);this.config=a;this._configLoaded=!0},_initRenderer:function(a,b){if(!this._rendererInitialized){if(!cc._supportRender)throw Error("The renderer doesn't support the renderMode "+this.config[this.CONFIG_KEY.renderMode]);var c=this.config[cc.game.CONFIG_KEY.id],d=window,c=cc.$(c)||cc.$("#"+c),e,f;"CANVAS"===c.tagName?(a=a||c.width,b=b||c.height,this.canvas=cc._canvas=e=c,this.container=cc.container=f=document.createElement("DIV"),e.parentNode&& e.parentNode.insertBefore(f,e)):("DIV"!==c.tagName&&cc.log("Warning: target element is not a DIV or CANVAS"),a=a||c.clientWidth,b=b||c.clientHeight,this.canvas=cc._canvas=e=cc.$(document.createElement("CANVAS")),this.container=cc.container=f=document.createElement("DIV"),c.appendChild(f));f.setAttribute("id","Cocos2dGameContainer");f.appendChild(e);this.frame=f.parentNode===document.body?document.documentElement:f.parentNode;e.addClass("gameCanvas");e.setAttribute("width",a||480);e.setAttribute("height", b||320);e.setAttribute("tabindex",99);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._renderContext=cc._renderContext=cc.webglContext=cc.create3DContext(e,{stencil:!0,alpha:!1}));this._renderContext?(cc.renderer=cc.rendererWebGL,d.gl=this._renderContext,cc.renderer.init(),cc._drawingUtil=new cc.DrawingPrimitiveWebGL(this._renderContext),cc.textureCache._initializingRenderer(),cc.glExt={},cc.glExt.instanced_arrays=d.gl.getExtension("ANGLE_instanced_arrays"),cc.glExt.element_uint=d.gl.getExtension("OES_element_index_uint")): (cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc.renderer=cc.rendererCanvas,this._renderContext=cc._renderContext=new cc.CanvasContextWrapper(e.getContext("2d")),cc._drawingUtil=cc.DrawingPrimitiveCanvas?new cc.DrawingPrimitiveCanvas(this._renderContext):null);cc._gameDiv=f;cc.game.canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1};this.dispatchEvent(this.EVENT_RENDERER_INITED,!0);this._rendererInitialized=!0}},_initEvents:function(){var a=window,b;this._eventHide=this._eventHide|| new cc.EventCustom(this.EVENT_HIDE);this._eventHide.setUserData(this);this._eventShow=this._eventShow||new cc.EventCustom(this.EVENT_SHOW);this._eventShow.setUserData(this);this.config[this.CONFIG_KEY.registerSystemEvent]&&cc.inputManager.registerSystemEvent(this.canvas);cc.isUndefined(document.hidden)?cc.isUndefined(document.mozHidden)?cc.isUndefined(document.msHidden)?cc.isUndefined(document.webkitHidden)||(b="webkitHidden"):b="msHidden":b="mozHidden":b="hidden";var c=["visibilitychange","mozvisibilitychange", "msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],d=function(){cc.eventManager&&cc.game._eventHide&&cc.eventManager.dispatchEvent(cc.game._eventHide)},e=function(){cc.eventManager&&cc.game._eventShow&&cc.eventManager.dispatchEvent(cc.game._eventShow)};if(b)for(var f=0;fb.DEBUG_MODE_ERROR?(c=cc._logToWebPage.bind(cc),cc.error=function(){c("ERROR : "+cc.formatStr.apply(cc,arguments))},cc.assert=function(a,b){if(!a&&b){for(var f=2;fc;c++)for(var d=0;256>d;d++)b[String.fromCharCode(c+256*d)]=String.fromCharCode(c)+String.fromCharCode(d);c=IEBinaryToArray_ByteStr(a);a=IEBinaryToArray_ByteStr_Last(a);return c.replace(/[\s\S]/g,function(a){return b[a]})+a}};cc=cc||{};cc._loadingImage="data:image/gif;base64,R0lGODlhEAAQALMNAD8/P7+/vyoqKlVVVX9/fxUVFUBAQGBgYMDAwC8vL5CQkP///wAAAP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAANACwAAAAAEAAQAAAEO5DJSau9OOvNex0IMnDIsiCkiW6g6BmKYlBFkhSUEgQKlQCARG6nEBwOgl+QApMdCIRD7YZ5RjlGpCUCACH5BAUAAA0ALAAAAgAOAA4AAAQ6kLGB0JA4M7QW0hrngRllkYyhKAYqKUGguAws0ypLS8JxCLQDgXAIDg+FRKIA6v0SAECCBpXSkstMBAAh+QQFAAANACwAAAAACgAQAAAEOJDJORAac6K1kDSKYmydpASBUl0mqmRfaGTCcQgwcxDEke+9XO2WkxQSiUIuAQAkls0n7JgsWq8RACH5BAUAAA0ALAAAAAAOAA4AAAQ6kMlplDIzTxWC0oxwHALnDQgySAdBHNWFLAvCukc215JIZihVIZEogDIJACBxnCSXTcmwGK1ar1hrBAAh+QQFAAANACwAAAAAEAAKAAAEN5DJKc4RM+tDyNFTkSQF5xmKYmQJACTVpQSBwrpJNteZSGYoFWjIGCAQA2IGsVgglBOmEyoxIiMAIfkEBQAADQAsAgAAAA4ADgAABDmQSVZSKjPPBEDSGucJxyGA1XUQxAFma/tOpDlnhqIYN6MEAUXvF+zldrMBAjHoIRYLhBMqvSmZkggAIfkEBQAADQAsBgAAAAoAEAAABDeQyUmrnSWlYhMASfeFVbZdjHAcgnUQxOHCcqWylKEohqUEAYVkgEAMfkEJYrFA6HhKJsJCNFoiACH5BAUAAA0ALAIAAgAOAA4AAAQ3kMlJq704611SKloCAEk4lln3DQgyUMJxCBKyLAh1EMRR3wiDQmHY9SQslyIQUMRmlmVTIyRaIgA7"; cc._fpsImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAAgCAYAAAD9qabkAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ5jVxA+pDbyCAyivyKvEcxlIGyUQPUAnVAuagfGorGoHPRdDQPXYCWomvRGrQePYC2oqfRS+h1dAB9io5jgNExDmaM2WFcjIdFYIlYGibHFmPlWDVWjzVjHVg3dhUbwJ5h7wgkAouAE+wIXoQQwmyCkJBHWExYQ6gl7CO0EroIVwmDhDHCJyKTqE+0JXoS+cR4YjqxkFhGrCbuIR4hniVeJw4TX5NIJA7JkuROCiElkDJJC0lrSNtILaRTpD7SEGmcTCbrkG3J3uQIsoCsIJeRt5APkE+S+8nD5LcUOsWI4kwJoiRSpJQSSjVlP+UEpZ8yQpmgqlHNqZ7UCKqIOp9aSW2gdlAvU4epEzR1miXNmxZDy6Qto9XQmmlnafdoL+l0ugndgx5Fl9CX0mvoB+nn6YP0dwwNhg2Dx0hiKBlrGXsZpxi3GS+ZTKYF05eZyFQw1zIbmWeYD5hvVVgq9ip8FZHKEpU6lVaVfpXnqlRVc1U/1XmqC1SrVQ+rXlZ9pkZVs1DjqQnUFqvVqR1Vu6k2rs5Sd1KPUM9RX6O+X/2C+mMNsoaFRqCGSKNUY7fGGY0hFsYyZfFYQtZyVgPrLGuYTWJbsvnsTHYF+xt2L3tMU0NzqmasZpFmneZxzQEOxrHg8DnZnErOIc4NznstAy0/LbHWaq1mrX6tN9p62r7aYu1y7Rbt69rvdXCdQJ0snfU6bTr3dQm6NrpRuoW623XP6j7TY+t56Qn1yvUO6d3RR/Vt9KP1F+rv1u/RHzcwNAg2kBlsMThj8MyQY+hrmGm40fCE4agRy2i6kcRoo9FJoye4Ju6HZ+M1eBc+ZqxvHGKsNN5l3Gs8YWJpMtukxKTF5L4pzZRrmma60bTTdMzMyCzcrNisyeyOOdWca55hvtm82/yNhaVFnMVKizaLx5balnzLBZZNlvesmFY+VnlW9VbXrEnWXOss623WV2xQG1ebDJs6m8u2qK2brcR2m23fFOIUjynSKfVTbtox7PzsCuya7AbtOfZh9iX2bfbPHcwcEh3WO3Q7fHJ0dcx2bHC866ThNMOpxKnD6VdnG2ehc53zNRemS5DLEpd2lxdTbaeKp26fesuV5RruutK10/Wjm7ub3K3ZbdTdzD3Ffav7TS6bG8ldwz3vQfTw91jicczjnaebp8LzkOcvXnZeWV77vR5Ps5wmntYwbcjbxFvgvct7YDo+PWX6zukDPsY+Ap96n4e+pr4i3z2+I37Wfpl+B/ye+zv6y/2P+L/hefIW8U4FYAHBAeUBvYEagbMDawMfBJkEpQc1BY0FuwYvDD4VQgwJDVkfcpNvwBfyG/ljM9xnLJrRFcoInRVaG/owzCZMHtYRjobPCN8Qfm+m+UzpzLYIiOBHbIi4H2kZmRf5fRQpKjKqLupRtFN0cXT3LNas5Fn7Z72O8Y+pjLk722q2cnZnrGpsUmxj7Ju4gLiquIF4h/hF8ZcSdBMkCe2J5MTYxD2J43MC52yaM5zkmlSWdGOu5dyiuRfm6c7Lnnc8WTVZkHw4hZgSl7I/5YMgQlAvGE/lp25NHRPyhJuFT0W+oo2iUbG3uEo8kuadVpX2ON07fUP6aIZPRnXGMwlPUit5kRmSuSPzTVZE1t6sz9lx2S05lJyUnKNSDWmWtCvXMLcot09mKyuTDeR55m3KG5OHyvfkI/lz89sVbIVM0aO0Uq5QDhZML6greFsYW3i4SL1IWtQz32b+6vkjC4IWfL2QsFC4sLPYuHhZ8eAiv0W7FiOLUxd3LjFdUrpkeGnw0n3LaMuylv1Q4lhSVfJqedzyjlKD0qWlQyuCVzSVqZTJy26u9Fq5YxVhlWRV72qX1VtWfyoXlV+scKyorviwRrjm4ldOX9V89Xlt2treSrfK7etI66Trbqz3Wb+vSr1qQdXQhvANrRvxjeUbX21K3nShemr1js20zcrNAzVhNe1bzLas2/KhNqP2ep1/XctW/a2rt77ZJtrWv913e/MOgx0VO97vlOy8tSt4V2u9RX31btLugt2PGmIbur/mft24R3dPxZ6Pe6V7B/ZF7+tqdG9s3K+/v7IJbVI2jR5IOnDlm4Bv2pvtmne1cFoqDsJB5cEn36Z8e+NQ6KHOw9zDzd+Zf7f1COtIeSvSOr91rC2jbaA9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAgcQLxxUBNp/AAAQZ0lEQVR42u2be3QVVZbGv1N17829eRLyIKAEOiISEtPhJTJAYuyBDmhWjAEx4iAGBhxA4wABbVAMWUAeykMCM+HRTcBRWkNH2l5moS0LCCrQTkYeQWBQSCAIgYRXEpKbW/XNH5zS4noR7faPEeu31l0h4dSpvc+t/Z199jkFWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY/H9D/MR9qfKnLj/00U71aqfJn9+HCkCR/Wk36ddsgyJ/1wF4fkDfqqm9/gPsUeTnVr6a2xlQfnxdI7zs0W7irzD17Ytb2WT7EeNv/r4ox1O3Quf2QP2pgt9utwfout4FQE8AVBSlnaRmfvAURQkg2RlAbwB9AThlW5L0GaiKojhJhgOIBqDa7XaPrusdPtr5kQwF0BVAAoBIABRCKDd5aFUhRDAAw57eAOwAhKIoupft3zoqhB1AqLwuHIBut9uFt02qqvqRDJR2dAEQJj/BAOjn56dqmma+xiaECAEQAWAggLsB6A6HQ2iaZggBhBAqgEAAnQB0kzaEmT4hAITT6VQ8Ho/HJAKKECJQtr8LwD1y/A1/vcdfEUIEyfZ9AcQbYvZ942Px88L2UwlJR0dH0EMPPbRj5syZPUeNGrXR7Xb/641xIwJ1XY9NSUlZm52dfW+XLl1w8uRJzJ8//+OGhoYJqqqe1TSt1Wsm9NN1PSIqKmr12rVrR5WUlHy1bdu2AQCumWc3IYRD1/UwVVXnFRQUTIuNjUVzczN2797dWFJSkq8oymZd15sAGAEnFEUJ1nX9nzIzM1dnZmZGh4SE4OTJk5g5c+Zf29vbp9pstrMej6fVOyhIhgAYU1hY+B+hoaGoqKg4XVlZea+XTULTNFdCQsLGiRMnPuR2u3UhBOV9eeDAAWXTpk095DUe6WsoyRE5OTlr0tLSAux2O/bs2cO5c+e+pijKUpIXSHaQVAGkvPLKK++6XK4OksJLCFlXV2cvKSlJBFAjhU+x2WwhHo9nUHp6+urMzMy7wsLCUF9fjxdffPHjxsbGiTab7WuPx9NiEutOuq4PyMjI+M+srKyYqKgoHD58GDNmzNjq8XhyVFU9b/q+LH7hBAEYu3PnTlZVVRFAGgCX6f/tAHoOHDjwa0p27txp/JO9e/f+QM7cipw9nfL3kQBKt2zZQpJ87rnn6mQmoHilw2EACs+cOUOSrK+vZ1NTE0nyo48+IoBpxswoBcMJ4Ndjx471kOTFixe5d+9ekqTH42H//v13A4jyzpAURfEH0H/OnDnthu1z5sw558MmFUCPWbNmnaMP3nrrLZoyDmP8Hl68eDFJ8siRI9/Yc+zYMQKYKdtAztrTrl27xptRXV1NAKMAOAyBBBA/Y8aMdpLs6Ojgxx9//E37+++//29yvFXppwvAwMcee8xjtDHsuXLlCqOjo//ia3wsfpkoALqFhoZuIckJEyackimm3dQmEMDUmpoakmRISMhhAHOHDx/eQJIbN24kgKEyMAHAFRMTs2XXrl1saWkhSZ0kp0+ffhrAr3wEW/S8efOukORLL72kA1gKYMPWrVtJkk899dRJAHeYrgsEsIQkjx8/TgDvAPjd448/3kaSb7zxBmUa7vC6z53BwcFbSHL9+vU6Sc6aNes8gF5ewWAH0PfVV18lSQL4DMBGIcQ6AKtcLleBFC2jXtFt8ODBe0iyoqKCAJYByC8qKmJDQwOzsrK+MAmqo1OnTveHhoa+GRkZ+XZkZOSWiIiIvzgcjk9mzpypkWRmZuZpmbYbGV4AgPnNzc1sa2sjgN0A5iQmJtaSZHl5OQHcb/K3s81mW0uSTU1NBFAFYFbfvn1Pk+Tbb79NAA8IIVzW42/hByA+Pz/fLR/2ZXIda05NI/z9/TeR5J49ewhgqlxTrtI0jY2NjQQw3zTLuWJiYjaUlJToS5Ys6fjkk080kwDEeAmADcA9GzZsIElGRUW9CyAWwLApU6Y0kOSKFSsog9QICGdERMTGsrIyZmVlEcC9AB4IDw/fTpLbtm0jgN94CUAnAJmVlZVcs2aNZ/LkyRdJcvbs2b4EwAkgZfPmzTxw4AABFAN4BkC6vFeUSewcAO5duXIlSTIhIaEawGMAxgKYAmAGgCS73e5vrKVk/yGythANYEhCQsIhkly+fDkBpKqqGmL6DgIALDKN/3yZpVWQZGVlJQE8aPI3KiMjo5okV61aRQAjAPQBMPfIkSN0u90EUCBtsPiFEwpgbn19PdetW2fM5N4zQ9ekpKQqkty0aRMBpMjiWM6JEydIkoqirJUFJ6iq6pAPVy8A6cZMehMBUACEuVyuFwG8HBwcPEIWx367ZMkSjSQXLVrUJouTRorrkAHdA8BdQogsAOsKCwtJkmPGjDkvMw2bDDo/ADEjRoz4XylyFbm5uY0mAbjLyyZ/AOOrq6tZVlbWsWDBgo69e/eyoqKCgwcPPg4gSQaoIRbp27dvN7KF+tLSUr28vJwFBQXtMpvpYRIM7+wrAkDeqVOnePbsWQIoNKfzpiXPg8uXLydJJicnNwF4f+nSpW6STEtLq5fjYwhk1wkTJtSQ5Ouvv04AqTKj+N2xY8dIkgEBAW/Ie1v8wncRegwZMmQvSfbr12+3Ua33WqPfOWbMmP0kWVpaSgCDZAqcfejQIWNZsEGKgvnh9gfQb9myZd8nAEJVVZtMkUNk8CcNHTq0liR1XWdYWNhmH1mJIme80OnTp18x1rp5eXkEsNJms92Fb7e/IgEsvHz5Mp999tkmAI/l5uZeMC0B7vEqqAYAyL106RJJsra2lpWVld+sucePH38ZQG+5NncBeOrgwYMkqbe3t/Po0aOsra011wAWyl0H7x0JJ4DE+fPnu0kyPT29DsDdUrBuyNKEEAkAdpw/f/6GeoEM8GUmfwEgPCIiopwkGxsbabPZPgOw6L777vvm4p49e26VGYjFLxUhhD+ApLKyMp44ccIoVnXybgbgzkcfffRzklyzZg0BDJYCMMmoCwQFBXkLgLGWvvcWAgBToSsKwNPTp09vMR7UuLi4rwH0lgU8c/Db5ezbeeTIkRWzZ8++aMxu+fn5BPCADBwHgP4LFy701NXVEUAJgAnPP/98kyxMNgHo53A4zH77BQQETMvPz7+Um5vbBuAlAFMSExPPmdbVL0qh8Acw8fDhw5SCchVAEYAVb775JknyhRdeaJYztHfxMwLAaqNwCGC2FArv8x0hAHKNLGPKlCme5OTk/Zs3bzb7O0wKiiG8KXl5ed8IxenTp0mSR48e1UmyW7duWywBuD2xyQcgFECgoih+8H1gyJgZV5Lkyy+/3CbTRIePtl2HDBmyw1QBHyGDdXZdXR1JUghRKkXBjOMHCoBdpr0L3nvvPZLkF198wejo6O0A4lVVDTb74HQ6AwD8Wq7Jh8rgGgDgQ13XjVR8qaxJuADMbmlpYXl5uV5UVNRWUFDgfv/993Vj/ZydnU1c37eHXML4S3viAcQqitJD2l104cIFY8lTKsXSBWBMVVWVcd9yed2A1NTUQ6Zl00CvLMMOoHdubm6zFIlWOf5+PsY/Kj09vdrU11QAwwGsv3jxIk21m2DZr10I0RXAuAcffPBgaWkpV69eTYfDcdiwUxY0w6xw+flX8L1xApjevXv3lREREaW6rofB93aPDUDQpEmTMgHgtddeqwBwEd/utZvpqK6uPgEAcXFxkA94NwB9unfvjrNnz4LklwDcf08iIqv66Zs2bXrl4YcfxooVKxAbG7uqrq5uAYA2TdOEqqpGYIi2tjbl6aeffu/YsWPv5uTk7JaC1wHg4Pnz542MwoVvTx+21dbWYvjw4WLixIl+2dnZ9lGjRgmSTE1NRUpKCkwFTGiaxtTU1OXTpk3707Bhw/6g67pDipnT4biuj7qut+Lbk3Vf1tTUXI9qu91Pjq1QFEUBgJaWFgBo8yGOQ8eNGxcAAOvXr/8QwBUfYygAKL169eoCABcuXACAWtn2hOGv0+kMNO1KiPDw8F4A4rZv3/7R1KlTR0+bNu1ht9u9r1+/fqitrQXJgwDarRC6/QjPzs4+QJIffPCB9/aQmSAA43ft2mW0e1QGoi8CAPyLsZccExNTC2BlRkbGRdOyYJCP2csBIN6UAZzCd7cBbQCijYp/dXU1ExMTz6SmptaMHj36f9LS0vYlJCRsl6mxIWSdu3fv/g5J7t+/nwC2AShMTk6+SJKff/45AWRLYbD7+fndAeDf5BJnLoCCyZMnt5JkdnZ2C4B/F0KEm1Pu+Pj4rST55ZdfEsBWAK+mpaVdMo3raDn7KwDuSEpK+m+S3LBhAwG8DuCtHTt2UBbpjgC408vvcFVV15HkuXPnjMp+p5uMf0RcXNyHJNnQ0EBVVfcCWBQXF3fG+Jv0yxABPwB5LS0tRmFxN4BlTzzxxGWSXLx4sS5F3GGFy+1Hp5SUlJq6ujoWFxdTpsZ2H+0iIyMj/0iSWVlZX5mr5jfJFroPGzasxlhTnjp1iiTZ3NxMl8tlrCd9pfa9SkpKSJI5OTmnZOageLUZZqxvfVFWVkZcPwdgNwnSCKPqb17jkmR8fPzfZMDZ5CRsFBmNI7h95s2b1yhT7/MAYmStwCx4vy0uLqa3v5qmEcCfvSr1QQAeXb16NY3Cm3HQ55133iGAp+SxZTNhKSkpfzUddkrFjYevzAQCeGjp0qXfsYckY2NjTwD4leGDLCL2HTdunNtoY+zWSHFcIHdsFCtcfuZ1vO9Eqs3m7/F47sb1k2qX/f3997W2tl7BjWfpBYDOzzzzzIVJkyZh0KBBCwEsB3AJvl9AETabLcDj8dwRFRW1ctasWb8JCgpSzp07d62wsPC/Wltb8xRFadR1/ZqPXYbgAQMGbI2Pjw/+6quv9ldVVT0r01ezuPRJSUn5Y9euXXVd11WzDaqq6kePHm3+7LPPRgO4KlNuxWazhXo8nuTk5OSXMjIyEl0uFxoaGtqKior+dPXq1VdUVT0jj7r68ieoT58+vx8yZMjdx48fP1JVVTVF9m20VW02WyfZf97YsWPjXS4X6urqWvPy8jYCWCyEuEDS8FdVFKWzruv//OSTTy5OTk7uqWkaPv3007qysrJ8RVH+LI8ym8/rB3Tu3HnRI488knLo0KG2ffv2ZQI4C98vP6mqqoZqmpaclpa2cOTIkX39/f3R0NDQUVxc/G5TU9PLqqrWa5rWLH1QVFUN0TStX1JSUvH48eP7BwYG4uDBg1cKCgpeBbBe2u+2Qug2EwD5N5sMPuNtMe8XP4TT6Qxoa2sbIGeXvUKIK7d4IISiKC5d1wPljOfA9bPwzYqiXNV13dd6Uqiq6qdpml2mpe02m63d4/G4vcTF5fF47LJf71nJA6BZVVW3pmntuPHlmAD5wk6Q9NnbHp9vHaqq6tA0zU/64PZhk1FfCZB9G/23ALiqKEqzD39tpvbGUqoFwFUhRLP3yzpCCDtJpxyXDulfG27+pqRR3DXsUWVd4Yq0x/taVQjhIhksC8L+ABpM9ljBf5sKwI8pIBr75L5E4vvu+UNeG/a+hv+AL7yFH8qPtOfHjtOP6V/Bja8D6z/B2Nys/1u9Xv33tLf4GfF/LC4GCJwByWIAAAAASUVORK5CYII\x3d"; cc._loaderImage="data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAlAAD/4QMpaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjAtYzA2MCA2MS4xMzQ3NzcsIDIwMTAvMDIvMTItMTc6MzI6MDAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjM4MDBEMDY2QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjM4MDBEMDY1QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzUgV2luZG93cyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2RTk0OEM4OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU2RTk0OEM5OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+/+4ADkFkb2JlAGTAAAAAAf/bAIQADQkJCQoJDQoKDRMMCwwTFhENDREWGhUVFhUVGhkUFhUVFhQZGR0fIB8dGScnKionJzk4ODg5QEBAQEBAQEBAQAEODAwOEA4RDw8RFA4RDhQVERISERUfFRUXFRUfKB0ZGRkZHSgjJiAgICYjLCwoKCwsNzc1NzdAQEBAQEBAQEBA/8AAEQgAyACgAwEiAAIRAQMRAf/EALAAAAEFAQEAAAAAAAAAAAAAAAQAAgMFBgcBAQEAAwEBAAAAAAAAAAAAAAAAAQMEAgUQAAIBAgIEBwoLBgQGAwAAAAECAwAEEQUhMRIGQVFxsTITFGGBwdEiQlKSMzWRoeFicqKyI1NzFYJjJDQWB9KjVCbxwkNkJWXik3QRAAIBAgMFBQcDBQEAAAAAAAABAhEDIRIEMUFRcTJhwVIUBZGhsSJyEzOB0ULhYpIjUxX/2gAMAwEAAhEDEQA/AMJSpUqAVKlXuFAeUq9wpUB5XuFe4V6ooDzZHDox0CnGMinzwl7Z8NajaHeoO3vmTBZBtp9YUIqTEV5ROxHKnWRnaU8VRMhFBUjpV7hSoSeUq9pUB5Sr2lhQHlKvcK8oBV7hSFSRrtaKAZs07YNPM1pG2xJIAw1jSeandry/8X4m8VCKkWwaWwam7Xl/4v1W8VLtmX/i/VbxUoKkWwakSM407tmX/i/VbxUmzGwjQsjdY41IARie/U0IbZO0kNtCXnOCkEBeFu4KI3Bs7DNb27ya+jDx3kJeEnpJJEcQVbWDsk17u5urd591ucZkWhym2Vnd9RkCDEpFxDRpbw0bunu5mlp2De2FMLYXOD2wB2xbOeraUcYGJ72mlSUiqzzdzMd3Z3mixltA2yzcK/NlHM1DQyRXce1HocdNOEfJXZ88y9ZojOqhiBszIRiHQ8Y4cK5TvHuzLljHNMqxNoDjLFraHHnjPxcNCGVbxEUzYNTx5jZSxhpW6qTzlwJ+DCvO2Zf+L9VvFSgqyHYNLYNTdssPxfibxUu15f8Ai/VPiqCakOwa82DU/a8v/F+JvFTDdWPBL8R8VKCvYRYV5UzoMAy6QdIIqI0B4KJtxiRQwou16QoGUkntH5Tz0RbZbmF2hktraSVBo2lUkY8tDye0flPPXTslVUyiyVRsjqUOA4yMT8dW2ram2m6UVTNq9S7EIyUVJydMTn/6DnP+im9Wl+g5z/opvVrpteEhQWY4AaSTwAVf5WPiZh/9S5/zj7zltzlmYWkfWXNvJDGTgGcYDHirR7i7mSbwXParsFMrgb7w6jKw/wCmnc9I14kF3vpvCljbMyWMOJL4aEiB8qU/ObUK7HYWVrl1pFZWiCOCBQqKOLjPGTrNZZqKbUXVHq2nNwTuJRk1VpbgXN8s7Rk5ym0UQQzhIG2NAjhxHWbI+gCBVjBBFbwxwQqEiiUJGg1BVGAFe7dV28WYLYZFmF2Th1UD7JGjymGyn1iK5OyzIBGB1HgrLZhamzumQAGJwSqnSCh1q3GOCodxt4cxurdcpzuN4cyhiWaF5Bg09udUmnWw1H/jV9nFuJ7Quo+8h8peThFA+047vduyMtk7fYqTl07YFdfUufMPzT5p71UdtlmYXaGS2t3mQHAsgxANdadYJopLe4QS2867EsZ4QfCNYrCFbjdDPmgkYyWFxgVf04ifJf6ScNdRUW1XBb6FU5TjF5EpSSrGu/s5lN+g5z/opvVpfoOc/wCim9WtdHnatvObJXDW7xLGhB8nrPaY9/HCr+tEdPCVaSeDoYLnqF63lzW4/PFSW3ecxbI84VSzWUwUaSdg0DXXK5nvAipnd6qgKvWnQO7pri9ZUEmm3Vl2j1kr8pRlFRyquBNZjGxQ/S56Y1S2fu9OVueon11Szahoou06QoQUXadIVCD2FJJ7R+U89dMydv8Axdn+TH9muZye0flPPXQstlK5Tbka1gUjlC1q0vVLkeb6r+O3Tx9xcY1nt8c0NrZCyiOE1108NYjGv1joo7Js1jzKyScYLIvkzL6LDwHXVJksH9Sb49dKNq0tj1jA6uriOCL+02FWX7iVtZX1/AzaHTyeoauKn2MX9W79zebiZCuR5MjSrhfXuEtwTrUeZH+yNfdrRNcxI6IzhXlJEak6WIGJ2Rw4ChWnChndtlVBLMdQA0k1gbXNMzzDfDLs6mjaPKppJbWwJ1bOwwxw43OnHh71YT3DpfWUJmFlb5jHHDdeXBHIsrRea5TSqvxqG04cNN62vetoCS4tre5mgnkGE9q+3DKOkuI2WX6LDQRRHWDh1UCtwj7QRg2wdl8Djgw1qe7XvW0BQ3kfZ7mSLgU+T9E6RVbnuVrnWVSWqj+Lt8ZbRuHEdKPkYVcZ2MJY5fSGyeVar45+rkWQHAqccalPE5km1htWK5nK4Wnt5FuUBUwOMG4nGkA/BXUrW4S6torlOjMgcd/xVn7rLo7zKs0uEjCNeSvdwoBhgsZxX1l2j36k3Lu+uyprdj5Vs5A+i/lD48a0aaVJOPi7jB6lbzWozpjB48pf1NDXNN4vfl7+Z4BXS65pvF78vfzPAK71XTHmZ/S/yT+jvJ7L3fHytz1E+upbL+Qj5W56jfXWRnsIYKLtekKEFGWvSFQgyjk9o/Keet3YthlMP/5x9msJJ7R+U89biyb/AMXEv7gD6tadL1T+kwepRrC39ZkLDMbiwMvUHRPG0bjlGg8ore/23sxBldxfMPLupNhT8yL/AORNZbdzJ484scytxgLqJY5LZj6Q2sV5G1Vud1mjjyG0ij0NEGSZToKyhjtqw4waztuiXA3qKTbSxltfGhbZlE95ZtZqxVbgiOZhrER9ph3Svk9+pJILZ4Y4DGBFCUMKjRsGPobPFhUfW0NJmljE2xJcIrcI2vFUEln1lRXd6lrazXT9GCNpD+yNqoI7mOVduNw6nzlOIoPOUa6yye1XXcbMR5GdQ3xY0BSbj31/FcTQZirJ+q431q7anbHCTZ72Bw7lbPrKBMcBWNNgbMBBh+bsjBdni0VJ1lARZs6yWiupxCuMDy6KpS2IwOo6DTr3Mre3e5tZZVUM4ZBjqOOJoWO4jkXajcOOMHGgDISvWIrdAkKR80+TzVl908bPPL3LzxOuHdifxVfiTAg92qI/w+/8gGgSyN/mR7XPVlp0lF/3L3mbVKtu5Hjbk/8AHE2Fc03i9+Xv5ngFdKNc13i9+Xv5ngFaNV0x5nn+l/kn9HeEWXu+PlbnqJ9dS2Xu9OVueon11kZ7CGCjLXpCgxRlr0hUIPYUcntH5Tz1s8vb+Bt1/dqPirGSe0flPPWusG/g4Py15q06XqlyMWvVYQ+ruI9xJOqzO9hOto/sP8tbGOFIrmWeM7IuMDMnAXXQJOUjQeOsJk0nY96ip0CYunrjaHx1t+srPJUbXBm2LrFPikwTOb+T+VhbZxGMrDXp83x1QSy2tucJpUjPETp+Cn5/ftaRvKvtp3Kx48HG3erHMzOxZiWZtLMdJNQSbbL71Vk6yynViOkqnEEfOWtPbXi3EQkGg6mXiNckjeSJxJGxR10qw0GtxuxmvbImD4CZMFlA4fRfv0BqesqqzTMZNMEDbIHtHH2QeCiZJSqMQdOGiue53mz3czQwsRbIcNHnkec3c4qAMuriz68gTIToxwOOnlp0MjxMJYW741Gs3RVldtbygE/dMcHX/moDaxTiWNZB53B3arb8/wC+4SOF4sf/AKxU9kcBsfOGHfoUHtG/RbzY5Die5HHhXdvavqiZ9Q8Jdlq4/gbKua7xe/L38zwCuhpf2Uk/Zo50kmwJKIdogDjw1VzzeL35e/meAVp1LTgqY4nn+mRauzqmqwrjzCLL3fHytz1E+upLL+Qj5W56jfXWRnroYKLtekKEFF2vSFQg9hSSe0flPPWosm/hIfoLzVl5PaPynnrRWb/w0X0F5q06XqlyM2sVYx5gmbFre/t71NY2T+0h8VbSO5SWNJUOKSAMp7jDGspmMPaLRlXS6eWve1/FRO7WYdbZm1Y/eW/R7qHxHRXGojlm3ulid6aVbaW+OALvgCLq2Hm9WxHKWqjhj6xsK1e8dm15l4niG1LZkswGsxtrPeOmsvayBJA1VItlWjptLuTdPMo7LtjRDq9naK4+WF9IrUW7BaHOljGqVHB7w2hzVoZt87d8vaNYSLl02CcRsDEbJbj71Uu7UBkvJ7/D7q2QoDxySaAO8MTXdxRVMpRp5XZOWdF/ms7R5XdyKfKWJsO/5PhrG5XlNxmEywW6bTnTxAAcJNbGSMXkM1pjgbiNo1PziPJ+Os7u7m/6ReM00ZOgxSpqYYHT3wRXMKN4ll9zUG4bQfNshu8sZVuEA2hirA4qe/VOwwrVbzbww5mI44UKRRYkbWG0S3JWctbd7u5WFfOOLHiUdJqmaipfLsIsObhWe001lMkMVvJNjhghIALMcBxCs7fxXQmkupx1bXDswGPlaTidVaEyKNXkoo4eBV+Sq7L7Vs9zcBgeyQ4GQ/MB1crmoim2orezqcowTuSeEY48jQ7oZX2PLzdyLhNd6RjrEY6I7+uspvH78vfzPAK6UAAAFGAGgAcArmu8Xvy9/M8ArTfio24RW5nnaG67uou3H/KPuqT2X8hHytz1G+upLL3enK3PUb66ys9RDBRdr0hQgou06QqEGUkntH5Tz1e238vF9BeaqKT2j8p56vbb+Xi+gvNWjTdUuRn1XTHmTh8KrJTJlt8t1CPIY44cGnpJVjTJYkmjaN9Ib4u7V923njTethRauZJV3PaW1rfLIiXEDYg6R4VYc9CXW7thfOZbKdbGZtLW8uPVY/u3GrkNUkM9zlcxUjbhfWOA90cRq4gv4LhdqN+VToNYWmnRm9NNVWNTyHc6VWBv8wt4YeHqm6xyPmroq1Z7WGFLSxTq7WLSuPSdjrkfumq5yHXDUeA92oO2SKpVumNAaoJLMXH3myp0rpJ4uKhc3tbDM5BMri1zAj79j7KTiY8TcdBpcsith0286o+sPCagEX9Pzg4zXUCp6QYse8oouCG3tk6m1BYv05W6T+IdyolxbHDAAa2OgDlNCz3ryN2WxBd5PJMg1t81eId2ukqnLlTBbfcuY+9uJLiRcvtPvHdsHK+cfRHcHDWsyawjyy0WBcDI3lTP6TeIcFV+S5OmXx9bJg1048o8Cj0V8Jq2DVu09nL80up7OxHi+oal3P8AXB/IsZS8T/YOV65zvCcc7vfzPAK3ivWCz445zeH954BXOr6I8yfSfyz+jvCLP3fHytz1G+upLP3fHytz1E+usbPaQ0UXadIUIKLtekKhB7Ckk9o/Keer22/l4/oLzVRSe0flPPV7b/y8X0F5q0abqlyM+q6Y8yQsBTDMor1o8aiaE1pbluMqS3sbLLHIhSRQyngqukhaJ9uBjo+H5aOa3ao2t34qouRlLajTalGP8v0IY8ylXQ+PKPFU/bYXOLPge6CKia0LaxTOxHu1Q7cuBd9yPEJ7TbjXKO8CajbMIF6CNIeNvJHjqIWJ7tSpYkalqVblwIdyG+RGXur0hXYJFxal+Dhq5y3slkv3Y2pD0pTr+QUClpJRUdo9XW4OLrTHtM16cZLLWkeC7y4jvlNEpcRtw1Ux27Ci448NZrTFy3nn3IQWxlgGrDZ3pza7/M8ArZo+ArF5171uvp+CqdV0R5l/psUrs2vB3hdl7vTlbnqJ9dS2Xu+PlbnqJ9dY2eshooq16QoQUXa9IVCD2FLJ7RuU89WNtmUSQqkgYMgw0accKrpPaPynnrZWG4Vi+VWmY5tnMWXG+XrIYnA0rhj0mdcTgdNdwnKDqjmduM1SRR/qlr8/4KX6pa8T/BVzDuLZXudRZblmbxXcPUNPc3KqCIwrbOzgrHEnHjoyD+3eSXkht7DeKG4umDGOJVUklfouThXfmbnZ7Cvy1vt9pmv1W1+d8FL9VteJvgq5yrcOGfLmzHN80iyyETPbptAEFo2ZG8pmUa1OFNn3Ky6W/sbDKM5hv5bx2WTZA+7RF2y52WOPJTzE+z2Dy1vt9pT/AKpacTerS/U7Tib1a04/t7kDXPY03jhN0W6sQ7K7W3q2dnrMccaDy/8At80kuZfqWYxWNtlcvUPPhiGYhWDeUy7IwYU8xPs9g8tb7faUn6pacTerTxm9oOBvVq3v9z927aynuId44LiWKNnjhAXF2UYhRg516qpsryjLr21665zFLSTaK9U2GOA87SwqY37knRU+BzOzags0s1Oyr+BKM6sxwP6tSDPLMen6vy0rvdm3Sxlu7K/S7WDDrFUDUTxgnTU826eXW7KlxmqQuwDBXUKcD+1Xee/wXuKX5XDGWLapSVcOyhEM/seJ/V+WnjeGx4pPV+Wkm6kKZlFay3Jlt7iFpYZY8ASVK6DjtDDA0f8A0Tl340/1f8Ndx8xJVWXB0KbktFFpNzdVXAC/qOwA0CQni2flrO3Vwbm5lnI2TKxbDirX/wBE5d+NcfV/wVR7xZPa5U9utvI8nWhmbbw0YEAYYAVxfhfy5rlKR4Fulu6X7mW1mzT8S4Yis/5CPlbnqJ9dSWfu9OVueon11mZvQ2i7XpChKKtekKhBlNJ7R+U89bDfGTb3a3ZX0Lcj6kdY+T2j8p560288m1kWQr6MJ+ylSAr+2cnV5renjs3H1loX+3j9XvbbtxLN9lqW4UnV5jdnjtXHxihtyZNjeSBu5J9k1BJe7xy7W5CJ/wCzuD/mTVTf2+fq97LJuLrPsNRueS7W6aJ/38x+vLVXuY+xvHaNxbf2GoCezf8A36j/APsSf8w1sLnqczTefJluYoLm5uo5F61sBshItP1cNFYe1f8A3ir/APfE/wCZUe9bB94r5jwuPsrQFhmG4l/Z2M17HdW90tuu3IkTHaCjWdIw0VVZdks9/C06yJFEp2dp+E1bbqybGTZ8vpQD7L1XRv8A7blT96Oda7tpNuuNE37Cq9KSisjyuUoxrStKllHbLlWTXsMs8chuSuwEPDqwoLe5y+YRE/gLzmqRekvKKtd4327yM/ulHxmrHJStySWVRyrjxKI2XC/CTlnlPPKTpTdFbP0L1bgrf5Lp0G3dPhQHwV0S1lzBsns3sESR8Crh9WAJGjSOKuU3E+zdZQ3oJh8IArdZXFDmOTpHa3i2+YrI2KtKy4ricBsBuHHgFXSo440+Wa2qqxjvM9uMoy+WvzWpLCWWWE28HxL6e43ojgkeSCBY1Ri5BGIUDT51cl3vm276BBqSEH4WbxV0tlkyXJcxTMb+OW6uY9mGHrCzDQwwAbTp2uKuTZ9N1uYsfRRR8WPhrm419mSSjRyiqxVK7y23B/ftuTm2oSdJyzNVw3BFn7vTlbnqF9dS2fu9OVueon11lZuQ2iLdsGFD05H2dNQGV0ntG5Tz1dWm9N1b2kVq8EVwsI2UaQaQOKhmitZGLOmk68DhSFvY+gfWNSAg7z3Qvo7yKCKIohiaNR5LKxx8qpxvjcqS0VpbxvwOAcRQPZ7D0G9Y0uz2HoH1jUCpLY7zXlpbm3eKO5QuzjrBqZji3x17PvNcyT288VvDBJbMWUovS2hslW7mFQ9nsPQPrGl2ew9A+saCod/WNxtbYsrfb17WBxx5ddD2281xC88klvDcSXEnWuzrqOGGC9zRUPZ7D0G9Y0uzWHoH1jQVCLreq6ntZbaO3it1mGy7RjTs1X2mYy20ZiCq8ZOODcdEdmsPQb1jS7PYegfWNdJuLqnQiSUlRqpFLmryxtH1Ma7Qw2gNNPOdSt0oI27p007s9h6B9Y0uz2HoH1jXX3Z+I4+1b8IJdX89xLHKQFMXQUahpxoiPN5P+onfU+A0/s9h6DesaXZ7D0D6xpG7OLbUtu0StW5JJx2bBsmbtiSiEk+cxoCWWSaVpZOk2vDVo0VYdnsPQb1jSNvZcCH1jSd2c+p1XAmFqEOmOPEfaH+BQd1ueo211IzrgFUYKNAAqI1WztCpUqVCRUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoD/9k\x3d";cc=cc||{}; cc.defineGetterSetter=function(a,b,c,d,e,f){if(a.__defineGetter__)c&&a.__defineGetter__(b,c),d&&a.__defineSetter__(b,d);else if(Object.defineProperty){var g={enumerable:!1,configurable:!0};c&&(g.get=c);d&&(g.set=d);Object.defineProperty(a,b,g)}else throw Error("browser does not support getters");if(!e&&!f)for(var g=null!=c,h=void 0!=d,k=Object.getOwnPropertyNames(a),m=0;m=b.x||a.y>=b.y||a.x+a.width<=b.x+b.width||a.y+a.height<=b.y+b.height):!1};cc.rectGetMaxX=function(a){return a.x+a.width};cc.rectGetMidX=function(a){return a.x+a.width/2};cc.rectGetMinX=function(a){return a.x};cc.rectGetMaxY=function(a){return a.y+a.height};cc.rectGetMidY=function(a){return a.y+a.height/2};cc.rectGetMinY=function(a){return a.y}; cc.rectContainsPoint=function(a,b){return b.x>=cc.rectGetMinX(a)&&b.x<=cc.rectGetMaxX(a)&&b.y>=cc.rectGetMinY(a)&&b.y<=cc.rectGetMaxY(a)};cc.rectIntersectsRect=function(a,b){var c=a.y+a.height,d=b.x+b.width,e=b.y+b.height;return!(a.x+a.width>>0)+((b||0)<<16)+((c||0)<<8)+("number"===typeof d?d:255)};_p=cc.Color.prototype;_p._getR=function(){return(this._val&4278190080)>>>24};_p._setR=function(a){this._val=this._val&16777215|a<<24>>>0};_p._getG=function(){return(this._val&16711680)>>16};_p._setG=function(a){this._val=this._val&4278255615|a<<16};_p._getB=function(){return(this._val&65280)>>8};_p._setB=function(a){this._val=this._val&4294902015|a<<8};_p._getA=function(){return this._val&255}; _p._setA=function(a){this._val=this._val&4294967040|a};cc.defineGetterSetter(_p,"r",_p._getR,_p._setR);cc.defineGetterSetter(_p,"g",_p._getG,_p._setG);cc.defineGetterSetter(_p,"b",_p._getB,_p._setB);cc.defineGetterSetter(_p,"a",_p._getA,_p._setA);cc.color=function(a,b,c,d){return void 0===a?new cc.Color(0,0,0,255):"object"===typeof a?new cc.Color(a.r,a.g,a.b,null==a.a?255:a.a):"string"===typeof a?cc.hexToColor(a):new cc.Color(a,b,c,null==d?255:d)}; cc.colorEqual=function(a,b){return a.r===b.r&&a.g===b.g&&a.b===b.b};cc.Acceleration=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.timestamp=d||0};cc.Vertex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Vertex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Vertex2F.BYTES_PER_ELEMENT=8;_p=cc.Vertex2F.prototype;_p._getX=function(){return this._view[0]}; _p._setX=function(a){this._view[0]=a};_p._getY=function(){return this._view[1]};_p._setY=function(a){this._view[1]=a};cc.defineGetterSetter(_p,"x",_p._getX,_p._setX);cc.defineGetterSetter(_p,"y",_p._getY,_p._setY);cc.Vertex3F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Vertex3F.BYTES_PER_ELEMENT);this._offset=e||0;this._view=new Float32Array(this._arrayBuffer,this._offset,3);this._view[0]=a||0;this._view[1]=b||0;this._view[2]=c||0};cc.Vertex3F.BYTES_PER_ELEMENT=12;_p=cc.Vertex3F.prototype; _p._getX=function(){return this._view[0]};_p._setX=function(a){this._view[0]=a};_p._getY=function(){return this._view[1]};_p._setY=function(a){this._view[1]=a};_p._getZ=function(){return this._view[2]};_p._setZ=function(a){this._view[2]=a};cc.defineGetterSetter(_p,"x",_p._getX,_p._setX);cc.defineGetterSetter(_p,"y",_p._getY,_p._setY);cc.defineGetterSetter(_p,"z",_p._getZ,_p._setZ); cc.Tex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Tex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Tex2F.BYTES_PER_ELEMENT=8;_p=cc.Tex2F.prototype;_p._getU=function(){return this._view[0]};_p._setU=function(a){this._view[0]=a};_p._getV=function(){return this._view[1]};_p._setV=function(a){this._view[1]=a};cc.defineGetterSetter(_p,"u",_p._getU,_p._setU); cc.defineGetterSetter(_p,"v",_p._getV,_p._setV); cc.Quad2=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad2.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex2F.BYTES_PER_ELEMENT;this._tl=a?new cc.Vertex2F(a.x,a.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._tr=b?new cc.Vertex2F(b.x,b.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._bl=c?new cc.Vertex2F(c.x,c.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._br=d?new cc.Vertex2F(d.x,d.y,e,f):new cc.Vertex2F(0,0,e,f)};cc.Quad2.BYTES_PER_ELEMENT=32;_p=cc.Quad2.prototype; _p._getTL=function(){return this._tl};_p._setTL=function(a){this._tl._view[0]=a.x;this._tl._view[1]=a.y};_p._getTR=function(){return this._tr};_p._setTR=function(a){this._tr._view[0]=a.x;this._tr._view[1]=a.y};_p._getBL=function(){return this._bl};_p._setBL=function(a){this._bl._view[0]=a.x;this._bl._view[1]=a.y};_p._getBR=function(){return this._br};_p._setBR=function(a){this._br._view[0]=a.x;this._br._view[1]=a.y};cc.defineGetterSetter(_p,"tl",_p._getTL,_p._setTL); cc.defineGetterSetter(_p,"tr",_p._getTR,_p._setTR);cc.defineGetterSetter(_p,"bl",_p._getBL,_p._setBL);cc.defineGetterSetter(_p,"br",_p._getBR,_p._setBR); cc.Quad3=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad3.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex3F.BYTES_PER_ELEMENT;this.bl=a?new cc.Vertex3F(a.x,a.y,a.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.br=b?new cc.Vertex3F(b.x,b.y,b.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.tl=c?new cc.Vertex3F(c.x,c.y,c.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.tr=d?new cc.Vertex3F(d.x,d.y,d.z,e,f):new cc.Vertex3F(0,0,0,e,f)}; cc.Quad3.BYTES_PER_ELEMENT=48;cc.V3F_C4B_T2F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V3F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;this._vertices=a?new cc.Vertex3F(a.x,a.y,a.z,d,e):new cc.Vertex3F(0,0,0,d,e);e+=cc.Vertex3F.BYTES_PER_ELEMENT;this._colors=b?new cc._WebGLColor(b.r,b.g,b.b,b.a,d,e):new cc._WebGLColor(0,0,0,0,d,e);e+=cc._WebGLColor.BYTES_PER_ELEMENT;this._texCoords=c?new cc.Tex2F(c.u,c.v,d,e):new cc.Tex2F(0,0,d,e)}; cc.V3F_C4B_T2F.BYTES_PER_ELEMENT=24;_p=cc.V3F_C4B_T2F.prototype;_p._getVertices=function(){return this._vertices};_p._setVertices=function(a){var b=this._vertices;b._view[0]=a.x;b._view[1]=a.y;b._view[2]=a.z};_p._getColor=function(){return this._colors};_p._setColor=function(a){var b=this._colors;b._view[0]=a.r;b._view[1]=a.g;b._view[2]=a.b;b._view[3]=a.a};_p._getTexCoords=function(){return this._texCoords};_p._setTexCoords=function(a){this._texCoords._view[0]=a.u;this._texCoords._view[1]=a.v}; cc.defineGetterSetter(_p,"vertices",_p._getVertices,_p._setVertices);cc.defineGetterSetter(_p,"colors",_p._getColor,_p._setColor);cc.defineGetterSetter(_p,"texCoords",_p._getTexCoords,_p._setTexCoords); cc.V3F_C4B_T2F_Quad=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._tl=a?new cc.V3F_C4B_T2F(a.vertices,a.colors,a.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=g;this._bl=b?new cc.V3F_C4B_T2F(b.vertices,b.colors,b.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=g;this._tr=c?new cc.V3F_C4B_T2F(c.vertices,c.colors,c.texCoords,e,f):new cc.V3F_C4B_T2F(null, null,null,e,f);f+=g;this._br=d?new cc.V3F_C4B_T2F(d.vertices,d.colors,d.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f)};cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT=96;_p=cc.V3F_C4B_T2F_Quad.prototype;_p._getTL=function(){return this._tl};_p._setTL=function(a){var b=this._tl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getBL=function(){return this._bl};_p._setBL=function(a){var b=this._bl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getTR=function(){return this._tr}; _p._setTR=function(a){var b=this._tr;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getBR=function(){return this._br};_p._setBR=function(a){var b=this._br;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getArrayBuffer=function(){return this._arrayBuffer};cc.defineGetterSetter(_p,"tl",_p._getTL,_p._setTL);cc.defineGetterSetter(_p,"tr",_p._getTR,_p._setTR);cc.defineGetterSetter(_p,"bl",_p._getBL,_p._setBL);cc.defineGetterSetter(_p,"br",_p._getBR,_p._setBR); cc.defineGetterSetter(_p,"arrayBuffer",_p._getArrayBuffer,null);cc.V3F_C4B_T2F_QuadZero=function(){return new cc.V3F_C4B_T2F_Quad}; cc.V3F_C4B_T2F_QuadCopy=function(a){if(!a)return cc.V3F_C4B_T2F_QuadZero();var b=a.tl,c=a.bl,d=a.tr;a=a.br;return{tl:{vertices:{x:b.vertices.x,y:b.vertices.y,z:b.vertices.z},colors:{r:b.colors.r,g:b.colors.g,b:b.colors.b,a:b.colors.a},texCoords:{u:b.texCoords.u,v:b.texCoords.v}},bl:{vertices:{x:c.vertices.x,y:c.vertices.y,z:c.vertices.z},colors:{r:c.colors.r,g:c.colors.g,b:c.colors.b,a:c.colors.a},texCoords:{u:c.texCoords.u,v:c.texCoords.v}},tr:{vertices:{x:d.vertices.x,y:d.vertices.y,z:d.vertices.z}, colors:{r:d.colors.r,g:d.colors.g,b:d.colors.b,a:d.colors.a},texCoords:{u:d.texCoords.u,v:d.texCoords.v}},br:{vertices:{x:a.vertices.x,y:a.vertices.y,z:a.vertices.z},colors:{r:a.colors.r,g:a.colors.g,b:a.colors.b,a:a.colors.a},texCoords:{u:a.texCoords.u,v:a.texCoords.v}}}};cc.V3F_C4B_T2F_QuadsCopy=function(a){if(!a)return[];for(var b=[],c=0;c>16,(a>>8)%256,a%256)};cc.colorToHex=function(a){var b=a.r.toString(16),c=a.g.toString(16),d=a.b.toString(16);return"#"+(16>a.r?"0"+b:b)+(16>a.g?"0"+c:c)+(16>a.b?"0"+d:d)};cc.TEXT_ALIGNMENT_LEFT=0;cc.TEXT_ALIGNMENT_CENTER=1;cc.TEXT_ALIGNMENT_RIGHT=2;cc.VERTICAL_TEXT_ALIGNMENT_TOP=0;cc.VERTICAL_TEXT_ALIGNMENT_CENTER=1; cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM=2; cc._Dictionary=cc.Class.extend({_keyMapTb:null,_valueMapTb:null,__currId:0,ctor:function(){this._keyMapTb={};this._valueMapTb={};this.__currId=2<<(0|10*Math.random())},__getKey:function(){this.__currId++;return"key_"+this.__currId},setObject:function(a,b){if(null!=b){var c=this.__getKey();this._keyMapTb[c]=b;this._valueMapTb[c]=a}},objectForKey:function(a){if(null==a)return null;var b=this._keyMapTb,c;for(c in b)if(b[c]===a)return this._valueMapTb[c];return null},valueForKey:function(a){return this.objectForKey(a)}, removeObjectForKey:function(a){if(null!=a){var b=this._keyMapTb,c;for(c in b)if(b[c]===a){delete this._valueMapTb[c];delete b[c];break}}},removeObjectsForKeys:function(a){if(null!=a)for(var b=0;ba?0:a},_p._getG=function(){return this._view[1]},_p._setG=function(a){this._view[1]=0>a?0:a},_p._getB=function(){return this._view[2]},_p._setB=function(a){this._view[2]=0>a?0:a},_p._getA=function(){return this._view[3]},_p._setA=function(a){this._view[3]=0>a?0:a},cc.defineGetterSetter(_p,"r",_p._getR,_p._setR),cc.defineGetterSetter(_p,"g",_p._getG,_p._setG),cc.defineGetterSetter(_p,"b",_p._getB,_p._setB),cc.defineGetterSetter(_p,"a",_p._getA,_p._setA))});_p=cc.color; _p._getWhite=function(){return cc.color(255,255,255)};_p._getYellow=function(){return cc.color(255,255,0)};_p._getBlue=function(){return cc.color(0,0,255)};_p._getGreen=function(){return cc.color(0,255,0)};_p._getRed=function(){return cc.color(255,0,0)};_p._getMagenta=function(){return cc.color(255,0,255)};_p._getBlack=function(){return cc.color(0,0,0)};_p._getOrange=function(){return cc.color(255,127,0)};_p._getGray=function(){return cc.color(166,166,166)};cc.defineGetterSetter(_p,"WHITE",_p._getWhite); cc.defineGetterSetter(_p,"YELLOW",_p._getYellow);cc.defineGetterSetter(_p,"BLUE",_p._getBlue);cc.defineGetterSetter(_p,"GREEN",_p._getGreen);cc.defineGetterSetter(_p,"RED",_p._getRed);cc.defineGetterSetter(_p,"MAGENTA",_p._getMagenta);cc.defineGetterSetter(_p,"BLACK",_p._getBlack);cc.defineGetterSetter(_p,"ORANGE",_p._getOrange);cc.defineGetterSetter(_p,"GRAY",_p._getGray);cc.BlendFunc._disable=function(){return new cc.BlendFunc(cc.ONE,cc.ZERO)}; cc.BlendFunc._alphaPremultiplied=function(){return new cc.BlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA)};cc.BlendFunc._alphaNonPremultiplied=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA)};cc.BlendFunc._additive=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE)};cc.defineGetterSetter(cc.BlendFunc,"DISABLE",cc.BlendFunc._disable);cc.defineGetterSetter(cc.BlendFunc,"ALPHA_PREMULTIPLIED",cc.BlendFunc._alphaPremultiplied); cc.defineGetterSetter(cc.BlendFunc,"ALPHA_NON_PREMULTIPLIED",cc.BlendFunc._alphaNonPremultiplied);cc.defineGetterSetter(cc.BlendFunc,"ADDITIVE",cc.BlendFunc._additive);cc.Touches=[];cc.TouchesIntergerDict={};cc.DENSITYDPI_DEVICE="device-dpi";cc.DENSITYDPI_HIGH="high-dpi";cc.DENSITYDPI_MEDIUM="medium-dpi";cc.DENSITYDPI_LOW="low-dpi";var __BrowserGetter={init:function(){this.html=document.documentElement},availWidth:function(a){return a&&a!==this.html?a.clientWidth:window.innerWidth},availHeight:function(a){return a&&a!==this.html?a.clientHeight:window.innerHeight},meta:{width:"device-width"},adaptationType:cc.sys.browserType}; -1=c;!cc.sys.isMobile||d&&this._orientation&cc.ORIENTATION_LANDSCAPE||!d&&this._orientation&cc.ORIENTATION_PORTRAIT?(a.width=b,a.height=c,cc.container.style["-webkit-transform"]="rotate(0deg)",cc.container.style.transform="rotate(0deg)",this._isRotated=!1):(a.width=c,a.height=b,cc.container.style["-webkit-transform"]="rotate(90deg)",cc.container.style.transform= "rotate(90deg)",cc.container.style["-webkit-transform-origin"]="0px 0px 0px",cc.container.style.transformOrigin="0px 0px 0px",this._isRotated=!0)},_adjustSizeKeepCanvasSize:function(){var a=this._originalDesignResolutionSize.width,b=this._originalDesignResolutionSize.height;0Math.abs(a-c)&&(c=a);2>Math.abs(b-d)&&(d=b);a=cc.rect(Math.round((a-c)/2),Math.round((b-d)/2),c,d);this._result.scale=[e,f];this._result.viewport=a;return this._result},preApply:function(a){},apply:function(a,b){return{scale:[1,1]}},postApply:function(a){}}); (function(){var a=cc.ContainerStrategy.extend({apply:function(a){var b=a._frameSize.height,c=cc.container.style;this._setupContainer(a,a._frameSize.width,a._frameSize.height);c.margin=a._isRotated?"0 0 0 "+b+"px":"0px"}}),b=cc.ContainerStrategy.extend({apply:function(a,b){var c=a._frameSize.width,d=a._frameSize.height,e=cc.container.style,n=b.width,p=b.height,r=c/n,s=d/p,v,u;rthis.TOUCH_TIMEOUT)return this._removeUsedIndexBit(c), delete this._touchesIntegerDict[d.getID()],c}else return this._indexBitsUsed|=1<>=1}return-1},_removeUsedIndexBit:function(a){0>a||a>=this._maxTouches||(a=~(1<=c.length?c.push(a):(c[this._preTouchPoolPointer]= a,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(a,b,c){var d=this._preTouchPoint;a=this._glView.convertToLocationInView(a,b,c);b=new cc.Touch(a.x,a.y);b._setPrevPoint(d.x,d.y);d.x=a.x;d.y=a.y;return b},getMouseEvent:function(a,b,c){var d=this._prevMousePoint;this._glView._convertMouseToLocationInView(a,b);b=new cc.EventMouse(c);b.setLocation(a.x,a.y);b._setPrevCursor(d.x,d.y);d.x=a.x;d.y=a.y;return b},getPointByEvent:function(a,b){if(null!=a.pageX)return{x:a.pageX, y:a.pageY};b.left-=document.body.scrollLeft;b.top-=document.body.scrollTop;return{x:a.clientX,y:a.clientY}},getTouchesByEvent:function(a,b){for(var c=[],d=this._glView,e,f,g=this._preTouchPoint,h=a.changedTouches.length,k=0;kthis._accelInterval&&(this._accelCurTime-=this._accelInterval,cc.eventManager.dispatchEvent(new cc.EventAcceleration(this._acceleration)));this._accelCurTime+= a}};_p=cc.inputManager;_p.setAccelerometerEnabled=function(a){this._accelEnabled!==a&&(this._accelEnabled=a,a=cc.director.getScheduler(),this._accelEnabled?(this._accelCurTime=0,this._registerAccelerometerEvent(),a.scheduleUpdate(this)):(this._accelCurTime=0,this._unregisterAccelerometerEvent(),a.unscheduleUpdate(this)))};_p.setAccelerometerInterval=function(a){this._accelInterval!==a&&(this._accelInterval=a)}; _p._registerKeyboardEvent=function(){cc._canvas.addEventListener("keydown",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!0));a.stopPropagation();a.preventDefault()},!1);cc._canvas.addEventListener("keyup",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!1));a.stopPropagation();a.preventDefault()},!1)}; _p._registerAccelerometerEvent=function(){var a=window;this._acceleration=new cc.Acceleration;this._accelDeviceEvent=a.DeviceMotionEvent||a.DeviceOrientationEvent;cc.sys.browserType===cc.sys.BROWSER_TYPE_MOBILE_QQ&&(this._accelDeviceEvent=window.DeviceOrientationEvent);var b=this._accelDeviceEvent===a.DeviceMotionEvent?"devicemotion":"deviceorientation",c=navigator.userAgent;if(/Android/.test(c)||/Adr/.test(c)&&cc.sys.browserType===cc.BROWSER_TYPE_UC)this._minus=-1;this.didAccelerateCallback=this.didAccelerate.bind(this); a.addEventListener(b,this.didAccelerateCallback,!1)};_p._unregisterAccelerometerEvent=function(){this._acceleration=null;window.removeEventListener(this._accelDeviceEvent===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this.didAccelerateCallback,!1)}; _p.didAccelerate=function(a){var b=window;if(this._accelEnabled){var c=this._acceleration,d,e,f;this._accelDeviceEvent===window.DeviceMotionEvent?(f=a.accelerationIncludingGravity,d=this._accelMinus*f.x*0.1,e=this._accelMinus*f.y*0.1,f=0.1*f.z):(d=a.gamma/90*0.981,e=0.981*-(a.beta/90),f=a.alpha/90*0.981);c.x=d;c.y=e;c.z=f;c.timestamp=a.timeStamp||Date.now();a=c.x;b.orientation===cc.UIInterfaceOrientationLandscapeRight?(c.x=-c.y,c.y=a):b.orientation===cc.UIInterfaceOrientationLandscapeLeft?(c.x=c.y, c.y=-a):b.orientation===cc.UIInterfaceOrientationPortraitUpsideDown&&(c.x=-c.x,c.y=-c.y)}};delete _p;cc.AffineTransform=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.tx=e;this.ty=f};cc.affineTransformMake=function(a,b,c,d,e,f){return{a:a,b:b,c:c,d:d,tx:e,ty:f}};cc.pointApplyAffineTransform=function(a,b,c){var d;void 0===c?(c=b,d=a.x,a=a.y):(d=a,a=b);return{x:c.a*d+c.c*a+c.tx,y:c.b*d+c.d*a+c.ty}};cc._pointApplyAffineTransform=function(a,b,c){return cc.pointApplyAffineTransform(a,b,c)}; cc.sizeApplyAffineTransform=function(a,b){return{width:b.a*a.width+b.c*a.height,height:b.b*a.width+b.d*a.height}};cc.affineTransformMakeIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}};cc.affineTransformIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}; cc.rectApplyAffineTransform=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc.pointApplyAffineTransform(d,c,b),c=cc.pointApplyAffineTransform(e,c,b),d=cc.pointApplyAffineTransform(d,f,b),h=cc.pointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);return cc.rect(e,k,f-e,g-k)}; cc._rectApplyAffineTransformIn=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc.pointApplyAffineTransform(d,c,b),c=cc.pointApplyAffineTransform(e,c,b),d=cc.pointApplyAffineTransform(d,f,b),h=cc.pointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);a.x=e;a.y=k;a.width=f-e;a.height=g-k;return a}; cc.affineTransformTranslate=function(a,b,c){return{a:a.a,b:a.b,c:a.c,d:a.d,tx:a.tx+a.a*b+a.c*c,ty:a.ty+a.b*b+a.d*c}};cc.affineTransformScale=function(a,b,c){return{a:a.a*b,b:a.b*b,c:a.c*c,d:a.d*c,tx:a.tx,ty:a.ty}};cc.affineTransformRotate=function(a,b){var c=Math.sin(b),d=Math.cos(b);return{a:a.a*d+a.c*c,b:a.b*d+a.d*c,c:a.c*d-a.a*c,d:a.d*d-a.b*c,tx:a.tx,ty:a.ty}}; cc.affineTransformConcat=function(a,b){return{a:a.a*b.a+a.b*b.c,b:a.a*b.b+a.b*b.d,c:a.c*b.a+a.d*b.c,d:a.c*b.b+a.d*b.d,tx:a.tx*b.a+a.ty*b.c+b.tx,ty:a.tx*b.b+a.ty*b.d+b.ty}};cc.affineTransformConcatIn=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,g=a.tx,h=a.ty;a.a=c*b.a+d*b.c;a.b=c*b.b+d*b.d;a.c=e*b.a+f*b.c;a.d=e*b.b+f*b.d;a.tx=g*b.a+h*b.c+b.tx;a.ty=g*b.b+h*b.d+b.ty;return a};cc.affineTransformEqualToTransform=function(a,b){return a.a===b.a&&a.b===b.b&&a.c===b.c&&a.d===b.d&&a.tx===b.tx&&a.ty===b.ty}; cc.affineTransformInvert=function(a){var b=1/(a.a*a.d-a.b*a.c);return{a:b*a.d,b:-b*a.b,c:-b*a.c,d:b*a.a,tx:b*(a.c*a.ty-a.d*a.tx),ty:b*(a.b*a.tx-a.a*a.ty)}};cc.affineTransformInvertOut=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,g=1/(c*f-d*e);b.a=g*f;b.b=-g*d;b.c=-g*e;b.d=g*c;b.tx=g*(e*a.ty-f*a.tx);b.ty=g*(d*a.tx-c*a.ty)};cc.POINT_EPSILON=parseFloat("1.192092896e-07F");cc.pNeg=function(a){return cc.p(-a.x,-a.y)};cc.pAdd=function(a,b){return cc.p(a.x+b.x,a.y+b.y)};cc.pSub=function(a,b){return cc.p(a.x-b.x,a.y-b.y)};cc.pMult=function(a,b){return cc.p(a.x*b,a.y*b)};cc.pMidpoint=function(a,b){return cc.pMult(cc.pAdd(a,b),0.5)};cc.pDot=function(a,b){return a.x*b.x+a.y*b.y};cc.pCross=function(a,b){return a.x*b.y-a.y*b.x};cc.pPerp=function(a){return cc.p(-a.y,a.x)};cc.pRPerp=function(a){return cc.p(a.y,-a.x)}; cc.pProject=function(a,b){return cc.pMult(b,cc.pDot(a,b)/cc.pDot(b,b))};cc.pRotate=function(a,b){return cc.p(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x)};cc.pUnrotate=function(a,b){return cc.p(a.x*b.x+a.y*b.y,a.y*b.x-a.x*b.y)};cc.pLengthSQ=function(a){return cc.pDot(a,a)};cc.pDistanceSQ=function(a,b){return cc.pLengthSQ(cc.pSub(a,b))};cc.pLength=function(a){return Math.sqrt(cc.pLengthSQ(a))};cc.pDistance=function(a,b){return cc.pLength(cc.pSub(a,b))}; cc.pNormalize=function(a){var b=cc.pLength(a);return 0===b?cc.p(a):cc.pMult(a,1/b)};cc.pForAngle=function(a){return cc.p(Math.cos(a),Math.sin(a))};cc.pToAngle=function(a){return Math.atan2(a.y,a.x)};cc.clampf=function(a,b,c){if(b>c){var d=b;b=c;c=d}return a=e.x&&0<=e.y&&1>=e.y?!0:!1};cc.pIntersectPoint=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)?(c=cc.p(0,0),c.x=a.x+e.x*(b.x-a.x),c.y=a.y+e.x*(b.y-a.y),c):cc.p(0,0)};cc.pSameAs=function(a,b){return null!=a&&null!=b?a.x===b.x&&a.y===b.y:!1};cc.pZeroIn=function(a){a.x=0;a.y=0};cc.pIn=function(a,b){a.x=b.x;a.y=b.y};cc.pMultIn=function(a,b){a.x*=b;a.y*=b}; cc.pSubIn=function(a,b){a.x-=b.x;a.y-=b.y};cc.pAddIn=function(a,b){a.x+=b.x;a.y+=b.y};cc.pNormalizeIn=function(a){var b=Math.sqrt(a.x*a.x+a.y*a.y);0!==b&&cc.pMultIn(a,1/b)};cc.vertexLineToPolygon=function(a,b,c,d,e){e+=d;if(!(1>=e)){b*=0.5;for(var f,g=e-1,h=d;hb.value||1k.getLocalZOrder())this._visitTarget(k,!1);else break;null!=h[a.__instanceId]&&(g[a.getGlobalZOrder()]||(g[a.getGlobalZOrder()]=[]),g[a.getGlobalZOrder()].push(a.__instanceId));for(;e=c?(delete this._spaces[a],d>c&&(this._spaces[a+c]=d-c),!0):!1},requestBuffer:function(a){var c,d,e;for(c in this._spaces)if(d=parseInt(c),e=this._spaces[c],e>=a&&this.allocBuffer(d,a))return d;return-1},freeBuffer:function(a,c){var d=this._spaces,e,f;for(f in d){e=parseInt(f);if(e>a)break;if(e+d[f]>=a){c=c+a-e;a=e;break}}d=a+c;this._spaces[d]&&(c+=this._spaces[d],delete this._spaces[d]);this._spaces[a]=c},setDirty:function(){this._dirty=!0},update:function(){this._dirty&&(this.gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer),this.gl.bufferSubData(gl.ARRAY_BUFFER,0,this.dataArray),this._dirty=!1)},updateSubData:function(a,c){this.gl.bindBuffer(gl.ARRAY_BUFFER,this.vertexBuffer);this.gl.bufferSubData(gl.ARRAY_BUFFER,a,c)},destroy:function(){this.gl.deleteBuffer(this.vertexBuffer);this.vertexBuffer=this.texCoords=this.colors=this.positions=this.data=null}};return a}();cc.rendererCanvas={childrenOrderDirty:!0,assignedZ:0,assignedZStep:1E-4,_transformNodePool:[],_renderCmds:[],_isCacheToCanvasOn:!1,_cacheToCanvasCmds:{},_cacheInstanceIds:[],_currentID:0,_clearColor:cc.color(),_clearFillStyle:"rgb(0, 0, 0)",_dirtyRegion:null,_allNeedDraw:!0,_enableDirtyRegion:!1,_debugDirtyRegion:!1,_canUseDirtyRegion:!1,_dirtyRegionCountThreshold:10,getRenderCmd:function(a){return a._createRenderCmd()},enableDirtyRegion:function(a){this._enableDirtyRegion=a},isDirtyRegionEnabled:function(){return this._enableDirtyRegion}, setDirtyRegionCountThreshold:function(a){this._dirtyRegionCountThreshold=a},_collectDirtyRegion:function(){var a=this._renderCmds,b,c,d=this._dirtyRegion,e=0,f=!0,g=cc.Node.CanvasRenderCmd.RegionStatus;b=0;for(c=a.length;bg.NotDirty&&(++e,e>this._dirtyRegionCountThreshold&&(f=!1),f&&(!m.isEmpty()&&d.addRegion(m),h._regionFlag>g.Dirty&&!k.isEmpty()&&d.addRegion(k)),h._regionFlag=g.NotDirty)}return f},_beginDrawDirtyRegion:function(a){var b= a.getContext(),c=this._dirtyRegion.getDirtyRegions();b.save();a.setTransform({a:1,b:0,c:0,d:1,tx:0,ty:0},a._scaleX,a._scaleY);b.beginPath();a=0;for(var d=c.length;a=e&&this._batchRendering();var d=c._node,g=d._texture||d._spriteFrame&&d._spriteFrame._texture,h=d._blendFunc.src,d=d._blendFunc.dst,k=c._glProgramState;if(b||a.texture!==g||a.blendSrc!==h||a.blendDst!==d||a.glProgramState!==k)this._batchRendering(),a.texture=g,a.blendSrc=h,a.blendDst=d,a.glProgramState=k,b=!1;g=c.uploadData(m,n,6*f);00.5*e;k&&(k.apply(),k.getGLProgram()._updateProjectionUniform());cc.glBlendFunc(a.blendSrc,a.blendDst);cc.glBindTexture2DN(0,h);b.bindBuffer(b.ARRAY_BUFFER,d);n?b.bufferData(b.ARRAY_BUFFER,m,b.DYNAMIC_DRAW):(h=m.subarray(0,6*f),b.bufferData(b.ARRAY_BUFFER,h,b.DYNAMIC_DRAW));b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);b.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);b.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 3,b.FLOAT,!1,24,0);b.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,b.UNSIGNED_BYTE,!0,24,12);b.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,b.FLOAT,!1,24,16);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c);if(!r||!s||g>r)n?b.bufferData(b.ELEMENT_ARRAY_BUFFER,p,b.DYNAMIC_DRAW):b.bufferData(b.ELEMENT_ARRAY_BUFFER,p.subarray(0,g),b.DYNAMIC_DRAW);b.drawElements(b.TRIANGLES,g,b.UNSIGNED_SHORT,0);cc.g_NumberOfDraws++;s?r=g:(r=0,s=!0);g=f=0}},rendering:function(b,c){var d=c||this._renderCmds,e,g,h,k=b||cc._renderContext; k.bindBuffer(gl.ARRAY_BUFFER,null);e=0;for(g=d.length;e=this._width||0>=this._height?this.setTo(a._minX,a._minY,a._maxX,a._maxY):(this._minX>a._minX&&(this._minX=a._minX),this._minY>a._minY&&(this._minY=a._minY),this._maxX=this._width||0>=this._height}; regionProto.intersects=function(a){if(0>=this._width||0>=this._height||0>=a._width||0>=a._height)return!1;var b=this._minX>a._minX?this._minX:a._minX,c=this._maxXc)return!1;b=this._minY>a._minY?this._minY:a._minY;c=this._maxYv&&(p=r,r=v,v=p);u>g&&(p=u,u=g,g=p);r=(rg?v:g)+1;s>m&&(p=s,s=m,m=p);n>h&&(p=n,n=h,h=p);s=(sh?m:h)+1}this._minX=r;this._minY=s;this._maxX= v;this._maxY=m;this._width=v-r;this._height=m-s;this._area=this._width*this._height}};function unionArea(a,b){return((a._maxX>b._maxX?a._maxX:b._maxX)-(a._minXb._maxY?a._maxY:b._maxY)-(a._minYb&&(b=0),0>c&&(c=0),d>this.clipWidth&&(d=this.clipWidth),a>this.clipHeight&&(a=this.clipHeight));if(b>=d||c>=a)return!1;if(this.clipRectChanged)return!0;var e=this.dirtyList,f=regionCreate();e.push(f.setTo(b,c,d,a));this.mergeDirtyList(e);return!0};dirtyRegionProto.clear=function(){for(var a=this.dirtyList,b=a.length,c=0;cb)return!1;for(var c=this.hasClipRect,d=3n&&(e=h,f=m,d=n)}}c&&0.95=b.max)){var c=0,d,e,f,g,h,k=cc.Node._performStacks[cc.Node._performing];k||(k=[],cc.Node._performStacks.push(k));k.length=0;cc.Node._performing++;for(f=k[0]= this;f;){if((d=f._children)&&0f._localZOrder)f.visit(this);else break;for(a.pushRenderCommand(b);cd||c>d)return cc.log(cc._LogInfos.Texture2D_initWithImage_2,b,c,d,d),!1;this._textureLoaded=!0;return this._initPremultipliedATextureWithImage(a, b,c)},initWithElement:function(a){a&&(this._webTextureObj=cc._renderContext.createTexture(),this._htmlElementObj=a,this._hasPremultipliedAlpha=this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(a){a=void 0!==a?a:this._hasPremultipliedAlpha;if(cc.game._rendererInitialized&&this._htmlElementObj&&this._htmlElementObj.width&&this._htmlElementObj.height){var b=cc._renderContext;cc.glBindTexture2D(this); b.pixelStorei(b.UNPACK_ALIGNMENT,4);a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,this._htmlElementObj);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE);cc.glBindTexture2D(null); a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);b=this._htmlElementObj.height;this._pixelsWide=this._contentSize.width=this._htmlElementObj.width;this._pixelsHigh=this._contentSize.height=b;this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888;this.maxT=this.maxS=1;this._hasPremultipliedAlpha=a;this._hasMipmaps=!1;window.ENABLE_IMAEG_POOL&&(this._htmlElementObj=null);this.dispatchEvent("load")}},initWithString:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithString);return null},initWithETCFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithETCFile_2); return!1},initWithPVRFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithPVRFile_2);return!1},initWithPVRTCData:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData_2);return!1},setTexParameters:function(a,b,c,d){var e=cc._renderContext;void 0!==b&&(a={minFilter:a,magFilter:b,wrapS:c,wrapT:d});cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh)||a.wrapS===e.CLAMP_TO_EDGE&&a.wrapT===e.CLAMP_TO_EDGE,"WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures"); cc.glBindTexture2D(this);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a.minFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,a.magFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,a.wrapS);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,a.wrapT)},setAntiAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER,a.LINEAR)},setAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)},generateMipmap:function(){cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh),"Mimpap texture only works in POT textures"); cc.glBindTexture2D(this);cc._renderContext.generateMipmap(cc._renderContext.TEXTURE_2D);this._hasMipmaps=!0},stringForFormat:function(){return cc.Texture2D._M[this._pixelFormat]},bitsPerPixelForFormat:function(a){a=a||this._pixelFormat;var b=cc.Texture2D._B[a];if(null!=b)return b;cc.log(cc._LogInfos.Texture2D_bitsPerPixelForFormat,a);return-1},_initPremultipliedATextureWithImage:function(a,b,c){var d=cc.Texture2D,e=a.getData(),f=null,f=null,g=a.hasAlpha(),h=cc.size(a.getWidth(),a.getHeight()),k=d.defaultPixelFormat, m=a.getBitsPerComponent();g||(8<=m?k=d.PIXEL_FORMAT_RGB888:(cc.log(cc._LogInfos.Texture2D__initPremultipliedATextureWithImage),k=d.PIXEL_FORMAT_RGB565));var n=b*c;if(k===d.PIXEL_FORMAT_RGB565)if(g)for(e=new Uint16Array(b*c),f=a.getData(),m=0;m>0&255)>>3<<11|(f[m]>>8&255)>>2<<5|(f[m]>>16&255)>>3<<0;else for(e=new Uint16Array(b*c),f=a.getData(),m=0;m>3<<11|(f[m]&255)>>2<<5|(f[m]&255)>>3<<0;else if(k===d.PIXEL_FORMAT_RGBA4444)for(e=new Uint16Array(b*c),f=a.getData(), m=0;m>0&255)>>4<<12|(f[m]>>8&255)>>4<<8|(f[m]>>16&255)>>4<<4|(f[m]>>24&255)>>4<<0;else if(k===d.PIXEL_FORMAT_RGB5A1)for(e=new Uint16Array(b*c),f=a.getData(),m=0;m>0&255)>>3<<11|(f[m]>>8&255)>>3<<6|(f[m]>>16&255)>>3<<1|(f[m]>>24&255)>>7<<0;else if(k===d.PIXEL_FORMAT_A8)for(e=new Uint8Array(b*c),f=a.getData(),m=0;m>24&255;if(g&&k===d.PIXEL_FORMAT_RGB888)for(f=a.getData(),e=new Uint8Array(b*c*3),m=0;m>0&255,e[3*m+1]=f>>8&255,e[3*m+2]= f>>16&255;this.initWithData(e,k,b,c,h);a.getData();this._hasPremultipliedAlpha=a.isPremultipliedAlpha();return!0},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},removeLoadedEventListener:function(a){this.removeEventTarget("load",a)}})}; cc._tmp.WebGLTextureAtlas=function(){var a=cc.TextureAtlas.prototype;a._setupVBO=function(){var a=cc._renderContext;this._buffersVBO[0]=a.createBuffer();this._buffersVBO[1]=a.createBuffer();this._quadsWebBuffer=a.createBuffer();this._mapBuffers()};a._mapBuffers=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._quadsWebBuffer);a.bufferData(a.ARRAY_BUFFER,this._quadsArrayBuffer,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);a.bufferData(a.ELEMENT_ARRAY_BUFFER, this._indices,a.STATIC_DRAW)};a.drawNumberOfQuads=function(a,c){c=c||0;if(0!==a&&this.texture&&this.texture.isLoaded()){var d=cc._renderContext;cc.glBindTexture2D(this.texture);d.bindBuffer(d.ARRAY_BUFFER,this._quadsWebBuffer);this.dirty&&(d.bufferData(d.ARRAY_BUFFER,this._quadsArrayBuffer,d.DYNAMIC_DRAW),this.dirty=!1);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 3,d.FLOAT,!1,24,0);d.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,d.UNSIGNED_BYTE,!0,24,12);d.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,d.FLOAT,!1,24,16);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP?d.drawElements(d.TRIANGLE_STRIP,6*a,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT):d.drawElements(d.TRIANGLES,6*a,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT);cc.g_NumberOfDraws++}}}; cc._tmp.WebGLTextureCache=function(){var a=cc.textureCache;a.handleLoadedTexture=function(a,c){var d=this._textures,e;cc.game._rendererInitialized||(d=this._loadedTexturesBefore);e=d[a];e||(e=d[a]=new cc.Texture2D,e.url=a);e.initWithElement(c);".png"===cc.path.extname(a)?e.handleLoadedTexture(!0):e.handleLoadedTexture();return e};a.addImage=function(a,c,d){cc.assert(a,cc._LogInfos.Texture2D_addImage_2);var e=this._textures;cc.game._rendererInitialized||(e=this._loadedTexturesBefore);var f=e[a]||e[cc.loader._getAliase(a)]; if(f)return f.isLoaded()?c&&c.call(d,f):f.addEventListener("load",function(){c&&c.call(d,f)},d),f;f=e[a]=new cc.Texture2D;f.url=a;e=cc.loader.getBasePath?cc.loader.getBasePath():cc.loader.resPath;cc.loader.loadImg(cc.path.join(e||"",a),function(e,f){if(e)return c&&c.call(d,e);var k=cc.textureCache.handleLoadedTexture(a,f);c&&c.call(d,k)});return f};a.addImageAsync=a.addImage;a=null};cc._tmp.PrototypeTexture2D=function(){var a=cc.Texture2D;a.PVRImagesHavePremultipliedAlpha=function(a){cc.PVRHaveAlphaPremultiplied_=a};a.PIXEL_FORMAT_RGBA8888=2;a.PIXEL_FORMAT_RGB888=3;a.PIXEL_FORMAT_RGB565=4;a.PIXEL_FORMAT_A8=5;a.PIXEL_FORMAT_I8=6;a.PIXEL_FORMAT_AI88=7;a.PIXEL_FORMAT_RGBA4444=8;a.PIXEL_FORMAT_RGB5A1=7;a.PIXEL_FORMAT_PVRTC4=9;a.PIXEL_FORMAT_PVRTC2=10;a.PIXEL_FORMAT_DEFAULT=a.PIXEL_FORMAT_RGBA8888;a.defaultPixelFormat=a.PIXEL_FORMAT_DEFAULT;var b=cc.Texture2D._M={};b[a.PIXEL_FORMAT_RGBA8888]= "RGBA8888";b[a.PIXEL_FORMAT_RGB888]="RGB888";b[a.PIXEL_FORMAT_RGB565]="RGB565";b[a.PIXEL_FORMAT_A8]="A8";b[a.PIXEL_FORMAT_I8]="I8";b[a.PIXEL_FORMAT_AI88]="AI88";b[a.PIXEL_FORMAT_RGBA4444]="RGBA4444";b[a.PIXEL_FORMAT_RGB5A1]="RGB5A1";b[a.PIXEL_FORMAT_PVRTC4]="PVRTC4";b[a.PIXEL_FORMAT_PVRTC2]="PVRTC2";b=cc.Texture2D._B={};b[a.PIXEL_FORMAT_RGBA8888]=32;b[a.PIXEL_FORMAT_RGB888]=24;b[a.PIXEL_FORMAT_RGB565]=16;b[a.PIXEL_FORMAT_A8]=8;b[a.PIXEL_FORMAT_I8]=8;b[a.PIXEL_FORMAT_AI88]=16;b[a.PIXEL_FORMAT_RGBA4444]= 16;b[a.PIXEL_FORMAT_RGB5A1]=16;b[a.PIXEL_FORMAT_PVRTC4]=4;b[a.PIXEL_FORMAT_PVRTC2]=3;a=cc.Texture2D.prototype;cc.defineGetterSetter(a,"name",a.getName);cc.defineGetterSetter(a,"pixelFormat",a.getPixelFormat);cc.defineGetterSetter(a,"pixelsWidth",a.getPixelsWide);cc.defineGetterSetter(a,"pixelsHeight",a.getPixelsHigh);cc.defineGetterSetter(a,"width",a._getWidth);cc.defineGetterSetter(a,"height",a._getHeight)}; cc._tmp.PrototypeTextureAtlas=function(){var a=cc.TextureAtlas.prototype;cc.defineGetterSetter(a,"totalQuads",a.getTotalQuads);cc.defineGetterSetter(a,"capacity",a.getCapacity);cc.defineGetterSetter(a,"quads",a.getQuads,a.setQuads)};cc.ALIGN_CENTER=51;cc.ALIGN_TOP=19;cc.ALIGN_TOP_RIGHT=18;cc.ALIGN_RIGHT=50;cc.ALIGN_BOTTOM_RIGHT=34;cc.ALIGN_BOTTOM=35;cc.ALIGN_BOTTOM_LEFT=33;cc.ALIGN_LEFT=49;cc.ALIGN_TOP_LEFT=17;cc.PVRHaveAlphaPremultiplied_=!1; cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a={_contentSize:null,_textureLoaded:!1,_htmlElementObj:null,url:null,_pattern:null,ctor:function(){this._contentSize=cc.size(0,0);this._textureLoaded=!1;this._htmlElementObj=null;this._pattern="";this._pixelsHigh=this._pixelsWide=0},getPixelsWide:function(){return this._pixelsWide},getPixelsHigh:function(){return this._pixelsHigh},getContentSize:function(){var a=cc.contentScaleFactor(); return cc.size(this._contentSize.width/a,this._contentSize.height/a)},_getWidth:function(){return this._contentSize.width/cc.contentScaleFactor()},_getHeight:function(){return this._contentSize.height/cc.contentScaleFactor()},getContentSizeInPixels:function(){return this._contentSize},initWithElement:function(a){a&&(this._htmlElementObj=a,this._pixelsWide=this._contentSize.width=a.width,this._pixelsHigh=this._contentSize.height=a.height,this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj}, isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(){if(this._htmlElementObj){var a=this._htmlElementObj;this._pixelsWide=this._contentSize.width=a.width;this._pixelsHigh=this._contentSize.height=a.height;this.dispatchEvent("load")}},description:function(){return"\x3ccc.Texture2D | width \x3d "+this._contentSize.width+" height "+this._contentSize.height+"\x3e"},initWithData:function(a,c,d,e,f){return!1},initWithImage:function(a){return!1},initWithString:function(a,c,d,e, f,g){return!1},releaseTexture:function(){this._htmlElementObj=null;cc.loader.release(this.url)},getName:function(){return null},getMaxS:function(){return 1},setMaxS:function(a){},getMaxT:function(){return 1},setMaxT:function(a){},getPixelFormat:function(){return null},getShaderProgram:function(){return null},setShaderProgram:function(a){},hasPremultipliedAlpha:function(){return!1},hasMipmaps:function(){return!1},releaseData:function(a){},keepData:function(a,c){return a},drawAtPoint:function(a){}, drawInRect:function(a){},initWithETCFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithETCFile);return!1},initWithPVRFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithPVRFile);return!1},initWithPVRTCData:function(a,c,d,e,f,g){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData);return!1},setTexParameters:function(a,c,d,e){void 0!==c&&(a={minFilter:a,magFilter:c,wrapS:d,wrapT:e});this._pattern=a.wrapS===cc.REPEAT&&a.wrapT===cc.REPEAT?"repeat":a.wrapS===cc.REPEAT?"repeat-x":a.wrapT===cc.REPEAT? "repeat-y":""},setAntiAliasTexParameters:function(){},setAliasTexParameters:function(){},generateMipmap:function(){},stringForFormat:function(){return""},bitsPerPixelForFormat:function(a){return-1},addLoadedEventListener:function(a,c){this.addEventListener("load",a,c)},removeLoadedEventListener:function(a){this.removeEventTarget("load",a)},_generateColorTexture:function(){},_generateTextureCacheForColor:function(){if(this.channelCache)return this.channelCache;var a=[document.createElement("canvas"), document.createElement("canvas"),document.createElement("canvas"),document.createElement("canvas")],c=this._htmlElementObj,d=c.width,e=c.height;a[0].width=d;a[0].height=e;a[1].width=d;a[1].height=e;a[2].width=d;a[2].height=e;a[3].width=d;a[3].height=e;var f=a[3].getContext("2d");f.drawImage(c,0,0);for(var f=f.getImageData(0,0,d,e).data,g,h=0;4>h;h++){g=a[h].getContext("2d");for(var k=g.getImageData(0,0,d,e),m=k.data,n=0;nthis._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=b*c,e=(this._totalQuads- 1-b)*c;this._quads[this._totalQuads-1]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*c);this._quadsReader.set(this._quadsReader.subarray(d,d+e),d+c);this._setQuadToArray(a,b);this.dirty=!0}},insertQuads:function(a,b,c){c=c||a.length;cc.assert(b+c<=this._capacity,cc._LogInfos.TextureAtlas_insertQuads);var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads+=c;if(this._totalQuads>this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var e=b* d,f=(this._totalQuads-1-b-c)*d,g=this._totalQuads-1-c,h;for(h=0;hb?(f=b*c,d.set(d.subarray(f,f+(a-b)*c),f+c),d.set(e,f)):(f=(a+1)*c,d.set(d.subarray(f,f+(b-a)*c),f-c),d.set(e,b*c));this.dirty=!0}},removeQuadAtIndex:function(a){cc.assert(ac){f=[];g=new ArrayBuffer(b*d);for(a=0;ac?(b=new Uint16Array(6*d),b.set(this._indices,0),this._indices=b):this._indices=this._indices.subarray(0,6*d);this._setupIndices();this._mapBuffers(); return this.dirty=!0},increaseTotalQuadsWith:function(a){this._totalQuads+=a},moveQuadsFromIndex:function(a,b,c){if(void 0===c){if(c=b,b=this._totalQuads-a,cc.assert(c+(this._totalQuads-a)<=this._capacity,cc._LogInfos.TextureAtlas_moveQuadsFromIndex),0===b)return}else if(cc.assert(c+b<=this._totalQuads,cc._LogInfos.TextureAtlas_moveQuadsFromIndex_2),cc.assert(af._localZOrder)f.visit(this);else break;for(a.pushRenderCommand(b);cchild._localZOrder)child.visit(this);else break;for(a.pushRenderCommand(b);c=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchTo):(this.removeChild(this._layers[this._enabledLayer],!0),this._enabledLayer=a,this.addChild(this._layers[a]))},switchToAndReleaseMe:function(a){a>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchToAndReleaseMe):(this.removeChild(this._layers[this._enabledLayer],!0),this._layers[this._enabledLayer]=null,this._enabledLayer=a,this.addChild(this._layers[a]))},addLayer:function(a){a?this._layers.push(a): cc.log(cc._LogInfos.LayerMultiplex_addLayer)}});cc.LayerMultiplex.create=function(){return new cc.LayerMultiplex(Array.prototype.slice.call(arguments))};(function(){cc.Layer.CanvasRenderCmd=function(a){this._rootCtor(a);this._isBaked=!1;this._bakeSprite=null;this._canUseDirtyRegion=!0;this._updateCache=2};var a=cc.Layer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.Layer.CanvasRenderCmd;a._layerCmdCtor=cc.Layer.CanvasRenderCmd;a._setCacheDirty=function(a){a&&0===this._updateCache&&(this._updateCache=2);!1===this._cacheDirty&&(this._cacheDirty=!0,(a=this._cachedParent)&&a!==this&&a._setNodeDirtyForCache&& a._setNodeDirtyForCache())};a.updateStatus=function(){var a=cc.Node._dirtyFlags;this._dirtyFlag&a.orderDirty&&(this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~a.orderDirty);this.originUpdateStatus()};a._syncStatus=function(a){var c=cc.Node._dirtyFlags,d=this._dirtyFlag;if(this._isBaked||d&c.orderDirty)this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~c.orderDirty;this._originSyncStatus(a)};a.transform=function(a,c){this._worldTransform|| (this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._worldTransform,e=d.a,f=d.b,g=d.c,h=d.d;this.originTransform(a,c);d.a===e&&d.b===f&&d.c===g&&d.d===h||0!==this._updateCache||(this._updateCache=2)};a.bake=function(){if(!this._isBaked){this._needDraw=!0;this._isBaked=this._cacheDirty=cc.renderer.childrenOrderDirty=!0;0===this._updateCache&&(this._updateCache=2);for(var a=this._node._children,c=0,d=a.length;ch._localZOrder)h.visit(a);else break;for(cc.renderer.pushRenderCommand(this);ec;c++)a[4*c+3]=this._color[0];this._dataDirty=!0};a.rendering=function(a){a=a||cc._renderContext; var c=this._node;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._dataDirty&&(this._vertexBuffer||(this._vertexBuffer=a.createBuffer()),a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this._data,a.DYNAMIC_DRAW),this._dataDirty=!1);this._glProgramState.apply(this._matrix); cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,16,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,16,12);a.drawArrays(a.TRIANGLE_STRIP,0,4)};a.updateBlendFunc=function(a){}})(); (function(){cc.LayerGradient.WebGLRenderCmd=function(a){cc.LayerColor.WebGLRenderCmd.call(this,a);this._needDraw=!0;this._clipRect=new cc.Rect;this._clippingRectDirty=!1};var a=cc.LayerGradient.WebGLRenderCmd.prototype=Object.create(cc.LayerColor.WebGLRenderCmd.prototype);a.constructor=cc.LayerGradient.WebGLRenderCmd;a.updateStatus=function(){var a=cc.Node._dirtyFlags;this._dirtyFlag&a.gradientDirty&&(this._dirtyFlag|=a.colorDirty,this._updateVertex(),this._dirtyFlag&=~a.gradientDirty);this.originUpdateStatus()}; a._syncStatus=function(a){var c=cc.Node._dirtyFlags;this._dirtyFlag&c.gradientDirty&&(this._dirtyFlag|=c.colorDirty,this._updateVertex(),this._dirtyFlag&=~c.gradientDirty);this._originSyncStatus(a)};a.transform=function(a,c){this.originTransform(a,c);this._updateVertex()};a._updateVertex=function(){var a=this._node,c=a._colorStops;if(c&&!(2>c.length)){this._clippingRectDirty=!0;var d,e=c.length,f=2*e,g=a._contentSize;this._positionView.length/4d?(m=cc.p(-f.x,f.y),d=cc.p(f.x,f.y)):180>d?(m=cc.p(f.x,f.y),d=cc.p(f.x,-f.y)):270>d?(m=cc.p(f.x,-f.y),d=cc.p(-f.x,-f.y)):(m=cc.p(-f.x,-f.y),d=cc.p(-f.x,f.y));var n=Math.sin(h),h=Math.cos(h);m=Math.abs((m.x*h-m.y*n)/f.x);d=Math.abs((d.x*n+d.y*h)/f.y);k=cc.affineTransformScale(k,m,d);n=this._positionView;for(d=0;da.length)){var c=a.length,d,e=this._colorView,f=this._displayedOpacity/255;for(i=0;ia.width&&cc.error(cc._LogInfos.RectWidth,a.url),d>a.height&&cc.error(cc._LogInfos.RectHeight, a.url))};a.rendering=function(a,c,d){var e=this._node,f=this._textureCoord,g=this._displayedOpacity/255,h=this._textureToRender||e._texture;if((!h||0!==f.width&&0!==f.height&&h._textureLoaded)&&0!==g){a=a||cc._renderContext;var k=a.getContext(),m=e._offsetPosition.x,n=e._rect.height,p=e._rect.width,r=-e._offsetPosition.y-n;a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(g);(e._flippedX||e._flippedY)&&a.save();e._flippedX&&(m=-m-p,k.scale(-1,1)); e._flippedY&&(r=e._offsetPosition.y,k.scale(1,-1));var s,v,u;this._colorized?s=g=0:(g=f.renderX,s=f.renderY);v=f.width;u=f.height;h&&h._htmlElementObj?(c=h._htmlElementObj,""!==h._pattern?(a.setFillStyle(k.createPattern(c,h._pattern)),k.fillRect(m,r,p,n)):k.drawImage(c,g,s,v,u,m,r,p,n)):(h=e._contentSize,f.validRect&&(f=this._displayedColor,a.setFillStyle("rgba("+f.r+","+f.g+","+f.b+",1)"),k.fillRect(m,r,h.width*c,h.height*d)));(e._flippedX||e._flippedY)&&a.restore();cc.g_NumberOfDraws++}};a._updateColor= function(){var a=this._node._texture,c=this._textureCoord,d=this._displayedColor;a&&(255!==d.r||255!==d.g||255!==d.b?(this._textureToRender=a._generateColorTexture(d.r,d.g,d.b,c),this._colorized=!0):a&&(this._textureToRender=a,this._colorized=!1))};a._textureLoadedCallback=function(a){if(!this._textureLoaded){this._textureLoaded=!0;var c=this._rect,d=this._renderCmd;c?cc._rectEqualToZero(c)&&(c.width=a.width,c.height=a.height):c=cc.rect(0,0,a.width,a.height);this.texture=a;this.setTextureRect(c,this._rectRotated); a=d._displayedColor;255===a.r&&255===a.g&&255===a.b||d._updateColor();this.setBatchNode(this._batchNode);this.dispatchEvent("load")}};a._setTextureCoords=function(a,c){void 0===c&&(c=!0);var d=this._textureCoord,e=c?cc.contentScaleFactor():1;d.renderX=d.x=0|a.x*e;d.renderY=d.y=0|a.y*e;d.width=0|a.width*e;d.height=0|a.height*e;d.validRect=!(0===d.width||0===d.height||0>d.x||0>d.y)};cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas=function(a,c,d){if(!a)return null;if(!c)return a;d=null==d?!0:d;var e= document.createElement("canvas");e.width=c.width;e.height=c.height;var f=e.getContext("2d");f.translate(e.width/2,e.height/2);d?f.rotate(-1.5707963267948966):f.rotate(1.5707963267948966);f.drawImage(a,c.x,c.y,c.height,c.width,-c.height/2,-c.width/2,c.height,c.width);return e}})();(function(){cc.Sprite.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._vertices=[{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0}];this._color=new Uint32Array(1);this._recursiveDirty=this._dirty=!1;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};var a=cc.Sprite.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.Sprite.WebGLRenderCmd;a._spriteCmdCtor=cc.Sprite.WebGLRenderCmd; a.updateBlendFunc=function(a){};a.setDirtyFlag=function(a){cc.Node.WebGLRenderCmd.prototype.setDirtyFlag.call(this,a);this._dirty=!0};a.setDirtyRecursively=function(a){this._dirty=this._recursiveDirty=a;for(var c=this._node._children,d,e=c?c.length:0,f=0;fa.width&&cc.error(cc._LogInfos.RectWidth,a.url),c>a.height&&cc.error(cc._LogInfos.RectHeight,a.url))};a.transform=function(a,c){this.originTransform(a,c);var d=this._node,e=d._offsetPosition.x, f=e+d._rect.width,g=d._offsetPosition.y,h=g+d._rect.height,k=this._worldTransform,d=k.tx,m=k.ty,n=e*k.a,e=e*k.b,p=f*k.a,f=f*k.b,r=h*k.c,h=h*k.d,s=g*k.c,g=g*k.d,k=this._vertices;k[0].x=n+r+d;k[0].y=e+h+m;k[1].x=n+s+d;k[1].y=e+g+m;k[2].x=p+r+d;k[2].y=f+h+m;k[3].x=p+s+d;k[3].y=f+g+m};a.needDraw=function(){var a=this._node._texture;return this._needDraw&&a};a.uploadData=function(a,c,d){var e=this._node,f=e._texture;if(!(f&&f._textureLoaded&&e._rect.width&&e._rect.height&&this._displayedOpacity))return 0; var f=this._displayedOpacity,g=this._displayedColor.r,h=this._displayedColor.g,k=this._displayedColor.b;if(e._opacityModifyRGB)var m=f/255,g=g*m,h=h*m,k=k*m;this._color[0]=f<<24|k<<16|h<<8|g;e=e._vertexZ;f=this._vertices;g=f.length;k=d;for(d=0;da.getPixelsWide()&&cc.error(cc._LogInfos.RectWidth,a.url);g>a.getPixelsHigh()&&cc.error(cc._LogInfos.RectHeight,a.url)}this._offsetInPixels.x= d.x;this._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(d,this._offset);this._originalSizeInPixels.width=e.width;this._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(e,this._originalSize);this._rotated=c;return!0}});cc.EventHelper.prototype.apply(cc.SpriteFrame.prototype);cc.SpriteFrame.create=function(a,b,c,d,e){return new cc.SpriteFrame(a,b,c,d,e)};cc.SpriteFrame.createWithTexture=cc.SpriteFrame.create; cc.SpriteFrame._frameWithTextureForCanvas=function(a,b,c,d,e){var f=new cc.SpriteFrame;f._texture=a;f._rectInPixels=b;f._rect=cc.rectPixelsToPoints(b);f._offsetInPixels.x=d.x;f._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(f._offsetInPixels,f._offset);f._originalSizeInPixels.width=e.width;f._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(f._originalSizeInPixels,f._originalSize);f._rotated=c;return f};cc.spriteFrameCache={_CCNS_REG1:/^\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*$/,_CCNS_REG2:/^\s*\{\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*,\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*\}\s*$/,_spriteFrames:{},_spriteFramesAliases:{},_frameConfigCache:{},_rectFromString:function(a){return(a=this._CCNS_REG2.exec(a))?cc.rect(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]),parseFloat(a[4])):cc.rect(0,0,0,0)},_pointFromString:function(a){return(a=this._CCNS_REG1.exec(a))? cc.p(parseFloat(a[1]),parseFloat(a[2])):cc.p(0,0)},_sizeFromString:function(a){return(a=this._CCNS_REG1.exec(a))?cc.size(parseFloat(a[1]),parseFloat(a[2])):cc.size(0,0)},_getFrameConfig:function(a){var b=cc.loader.getRes(a);cc.assert(b,cc._LogInfos.spriteFrameCache__getFrameConfig_2,a);cc.loader.release(a);if(b._inited)return this._frameConfigCache[a]=b;this._frameConfigCache[a]=this._parseFrameConfig(b);return this._frameConfigCache[a]},_getFrameConfigByJsonObject:function(a,b){cc.assert(b,cc._LogInfos.spriteFrameCache__getFrameConfig_2, a);this._frameConfigCache[a]=this._parseFrameConfig(b);return this._frameConfigCache[a]},_parseFrameConfig:function(a){var b=a.frames,c=a.metadata||a.meta;a={};var d={},e=0;c&&(e=c.format,e=1>=e.length?parseInt(e):e,d.image=c.textureFileName||c.textureFileName||c.image);for(var f in b){var g=b[f];if(g){c={};if(0==e){c.rect=cc.rect(g.x,g.y,g.width,g.height);c.rotated=!1;c.offset=cc.p(g.offsetX,g.offsetY);var h=g.originalWidth,g=g.originalHeight;h&&g||cc.log(cc._LogInfos.spriteFrameCache__getFrameConfig); h=Math.abs(h);g=Math.abs(g);c.size=cc.size(h,g)}else if(1==e||2==e)c.rect=this._rectFromString(g.frame),c.rotated=g.rotated||!1,c.offset=this._pointFromString(g.offset),c.size=this._sizeFromString(g.sourceSize);else if(3==e){var h=this._sizeFromString(g.spriteSize),k=this._rectFromString(g.textureRect);h&&(k=cc.rect(k.x,k.y,h.width,h.height));c.rect=k;c.rotated=g.textureRotated||!1;c.offset=this._pointFromString(g.spriteOffset);c.size=this._sizeFromString(g.spriteSourceSize);c.aliases=g.aliases}else h= g.frame,k=g.sourceSize,f=g.filename||f,c.rect=cc.rect(h.x,h.y,h.w,h.h),c.rotated=g.rotated||!1,c.offset=cc.p(0,0),c.size=cc.size(k.w,k.h);a[f]=c}}return{_inited:!0,frames:a,meta:d}},_addSpriteFramesByObject:function(a,b,c){cc.assert(a,cc._LogInfos.spriteFrameCache_addSpriteFrames_2);b&&b.frames&&(b=this._frameConfigCache[a]||this._getFrameConfigByJsonObject(a,b),this._createSpriteFrames(a,b,c))},_createSpriteFrames:function(a,b,c){var d=b.frames;b=b.meta;c?c instanceof cc.Texture2D||(cc.isString(c)? c=cc.textureCache.addImage(c):cc.assert(0,cc._LogInfos.spriteFrameCache_addSpriteFrames_3)):(c=cc.path.changeBasename(a,b.image||".png"),c=cc.textureCache.addImage(c));a=this._spriteFramesAliases;b=this._spriteFrames;for(var e in d){var f=d[e],g=b[e];if(!g){g=new cc.SpriteFrame(c,cc.rect(f.rect),f.rotated,f.offset,f.size);if(f=f.aliases)for(var h=0,k=f.length;h=c)){for(;c>a;){var d=b.pop();d.running&&(d._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),d._performRecursive(cc.Node._stateCallbackType.onExit));d._performRecursive(cc.Node._stateCallbackType.cleanup);c--}this._nextScene=b[b.length-1];this._sendCleanupToScene=!0}},getScheduler:function(){return this._scheduler}, setScheduler:function(a){this._scheduler!==a&&(this._scheduler=a)},getActionManager:function(){return this._actionManager},setActionManager:function(a){this._actionManager!==a&&(this._actionManager=a)},getDeltaTime:function(){return this._deltaTime},_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3},isHidden:function(){return this._isHidden},setHidden:function(a){this._isHidden=a}});cc.Director.EVENT_PROJECTION_CHANGED="director_projection_changed"; cc.Director.EVENT_AFTER_UPDATE="director_after_update";cc.Director.EVENT_AFTER_VISIT="director_after_visit";cc.Director.EVENT_AFTER_DRAW="director_after_draw"; cc.DisplayLinkDirector=cc.Director.extend({invalid:!1,startAnimation:function(){this._nextDeltaTimeZero=!0;this.invalid=!1},mainLoop:function(){this._purgeDirectorInNextLoop?(this._purgeDirectorInNextLoop=!1,this.purgeDirector()):this.invalid||this.drawScene()},stopAnimation:function(){this.invalid=!0},setAnimationInterval:function(a){this._animationInterval=a;this.invalid||(this.stopAnimation(),this.startAnimation())}});cc.Director.sharedDirector=null;cc.Director.firstUseDirector=!0; cc.Director._getInstance=function(){cc.Director.firstUseDirector&&(cc.Director.firstUseDirector=!1,cc.Director.sharedDirector=new cc.DisplayLinkDirector,cc.Director.sharedDirector.init());return cc.Director.sharedDirector};cc.defaultFPS=60;cc.Director.PROJECTION_2D=0;cc.Director.PROJECTION_3D=1;cc.Director.PROJECTION_CUSTOM=3;cc.Director.PROJECTION_DEFAULT=cc.Director.PROJECTION_3D;cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.Director.prototype;a.getProjection=function(a){return this._projection};a.setProjection=function(a){this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged)};a.setDepthTest=function(){};a.setClearColor=function(a){cc.renderer._clearColor=a;cc.renderer._clearFillStyle="rgb("+a.r+","+a.g+","+a.b+")"};a.setOpenGLView=function(a){this._winSizeInPoints.width= cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;cc.eventManager&&cc.eventManager.setEnabled(!0)};a.getVisibleSize=function(){return this.getWinSize()};a.getVisibleOrigin=function(){return cc.p(0,0)}}else cc.Director._fpsImage=new Image,cc.Director._fpsImage.addEventListener("load",function(){cc.Director._fpsImageLoaded=!0}),cc._fpsImage&&(cc.Director._fpsImage.src=cc._fpsImage)});cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){cc.DirectorDelegate=cc.Class.extend({updateProjection:function(){}});var a=cc.Director.prototype,b=function(a){if(a&&a._renderCmd){a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);var d=a._children;for(a=0;ab.length&&b.push(a)};var c=function(a,b,c,d){this.list= a;this.entry=b;this.target=c;this.callback=d},d=[];c.get=function(a,b,e,f){var g=d.pop();g?(g.list=a,g.entry=b,g.target=e,g.callback=f):g=new c(a,b,e,f);return g};c.put=function(a){a.list=null;a.entry=null;a.target=null;a.callback=null;20>d.length&&d.push(a)};var e=function(a,b,c,d,e,f){this.timers=a;this.target=b;this.timerIndex=c;this.currentTimer=d;this.currentTimerSalvaged=e;this.paused=f},f=[];e.get=function(a,b,c,d,g,h){var v=f.pop();v?(v.timers=a,v.target=b,v.timerIndex=c,v.currentTimer=d, v.currentTimerSalvaged=g,v.paused=h):v=new e(a,b,c,d,g,h);return v};e.put=function(a){a.timers=null;a.target=null;a.timerIndex=0;a.currentTimer=null;a.currentTimerSalvaged=!1;a.paused=!1;20>f.length&&f.push(a)};var g=function(){this._scheduler=null;this._elapsed=-1;this._useDelay=this._runForever=!1;this._interval=this._delay=this._repeat=this._timesExecuted=0;this._key=this._callback=this._target=null};cc.inject({initWithCallback:function(a,b,c,d,e,f,g){this._scheduler=a;this._target=c;this._callback= b;g&&(this._key=g);this._elapsed=-1;this._interval=d;this._delay=f;this._useDelay=0=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(), this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},getCallback:function(){return this._callback},getKey:function(){return this._key},trigger:function(){this._target&&this._callback&&this._callback.call(this._target,this._elapsed)},cancel:function(){this._scheduler.unschedule(this._callback,this._target)}},g.prototype); var h=[];g.get=function(){return h.pop()||new g};g.put=function(a){a._scheduler=null;a._elapsed=-1;a._runForever=!1;a._useDelay=!1;a._timesExecuted=0;a._repeat=0;a._delay=0;a._interval=0;a._target=null;a._callback=null;a._key=null;20>h.length&&h.push(a)};cc.Scheduler=cc.Class.extend({_timeScale:1,_updatesNegList:null,_updates0List:null,_updatesPosList:null,_hashForTimers:null,_arrayForTimers:null,_hashForUpdates:null,_currentTarget:null,_currentTargetSalvaged:!1,_updateHashLocked:!1,ctor:function(){this._timeScale= 1;this._updatesNegList=[];this._updates0List=[];this._updatesPosList=[];this._hashForUpdates={};this._hashForTimers={};this._currentTarget=null;this._updateHashLocked=this._currentTargetSalvaged=!1;this._arrayForTimers=[]},_schedulePerFrame:function(a,b,c,d){var e=this._hashForUpdates[b.__instanceId];if(e&&e.entry)if(e.entry.priority!==c){if(this._updateHashLocked){cc.log("warning: you CANNOT change update priority in scheduled function");e.entry.markedForDeletion=!1;e.entry.paused=d;return}this.unscheduleUpdate(b)}else{e.entry.markedForDeletion= !1;e.entry.paused=d;return}0===c?this._appendIn(this._updates0List,a,b,d):0>c?this._priorityIn(this._updatesNegList,a,b,c,d):this._priorityIn(this._updatesPosList,a,b,c,d)},_removeHashElement:function(a){delete this._hashForTimers[a.target.__instanceId];for(var b=this._arrayForTimers,c=0,d=b.length;c=e&&c.timerIndex--;0===d.length&&(this._currentTarget===c?this._currentTargetSalvaged= !0:this._removeHashElement(c));break}}}},unscheduleUpdate:function(a){a&&(a=this._hashForUpdates[a.__instanceId])&&(this._updateHashLocked?a.entry.markedForDeletion=!0:this._removeUpdateFromHash(a.entry))},unscheduleAllForTarget:function(a){if(a){var b=this._hashForTimers[a.__instanceId];if(b){var c=b.timers;-1a)for(b=0;b=a&&this.unscheduleUpdate(c.target),d==this._updatesNegList.length&&b++;if(0>=a)for(b=0;b=a&&this.unscheduleUpdate(c.target),d==this._updatesPosList.length&&b++},isScheduled:function(a,b){cc.assert(a,"Argument callback must not be empty");cc.assert(b,"Argument target must be non-nullptr");var c=this._hashForTimers[b.__instanceId];if(!c)return!1;if(null!=c.timers)for(var c= c.timers,d=0;da)for(e=0;e=a&&(c.paused=!0,b.push(c.target));if(0>=a)for(e=0;e=a&&(c.paused=!0,b.push(c.target));return b},resumeTargets:function(a){if(a)for(var b=0;ba.length)throw Error("Polygon's point must greater than 2");var e=a[0];b=this._renderContext.getContext(); b.beginPath();b.moveTo(e.x,-e.y);for(var e=1,f=a.length;e\u3001\u2018\u201c\u300b\u00bb\uff1f\u3002\uff0c\uff01\u2010\u2032-\u2034\u203a\u203c\u2046\u2047-\u2049]/;cc.LabelTTF._lastWordRex=/([a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045]+|\S)$/; cc.LabelTTF._lastEnglish=/[a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045]+$/;cc.LabelTTF._firsrEnglish=/^[a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045]/; (function(){cc.LabelTTF.RenderCmd=function(){this._fontClientHeight=18;this._fontStyleStr="";this._shadowColorStr="rgba(128, 128, 128, 0.5)";this._strokeColorStr="";this._fillColorStr="rgba(255,255,255,1)";this._labelContext=this._labelCanvas=null;this._lineWidths=[];this._strings=[];this._isMultiLine=!1;this._status=[];this._renderingIndex=0;this._canUseDirtyRegion=!0};var a=cc.LabelTTF.RenderCmd.prototype;a.constructor=cc.LabelTTF.RenderCmd;a._labelCmdCtor=cc.LabelTTF.RenderCmd;a._setFontStyle= function(a,b,e,f){if(a instanceof cc.FontDefinition)this._fontStyleStr=a._getCanvasFontStr(),this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a);else{var g=b*cc.view.getDevicePixelRatio();this._fontStyleStr=e+" "+f+" "+g+"px '"+a+"'";this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a,b)}};a._getFontStyle=function(){return this._fontStyleStr};a._getFontClientHeight=function(){return this._fontClientHeight};a._updateColor=function(){this._setColorsString();this._updateTexture()};a._setColorsString= function(){var a=this._displayedColor,b=this._node,e=b._shadowColor||this._displayedColor,f=b._strokeColor,g=b._textFillColor,h=a.r/255,k=a.g/255,a=a.b/255;this._shadowColorStr="rgba("+(0|h*e.r)+","+(0|k*e.g)+","+(0|a*e.b)+","+b._shadowOpacity+")";this._fillColorStr="rgba("+(0|h*g.r)+","+(0|k*g.g)+","+(0|a*g.b)+", 1)";this._strokeColorStr="rgba("+(0|h*f.r)+","+(0|k*f.g)+","+(0|a*f.b)+", 1)"};var b=new cc.Rect;a.getLocalBB=function(){var a=this._node;b.x=b.y=0;var d=cc.view.getDevicePixelRatio();b.width= a._getWidth()*d;b.height=a._getHeight()*d;return b};a._updateTTF=function(){var a=this._node,b=cc.view.getDevicePixelRatio(),e=a._dimensions.width*b,f,g,h=this._lineWidths;h.length=0;this._isMultiLine=!1;this._measureConfig();var k={};if(0!==e)for(this._strings=a._string.split("\n"),f=0;fe&&1e&&100>r++;)h*=e/m,h|=0,k=f.substr(h), m=g-this._measure(k);for(r=0;mr++;)k&&(p=(n=cc.LabelTTF._wordRex.exec(k))?n[0].length:1,n=k),h+=p,k=f.substr(h),m=g-this._measure(k);h-=p;0===h&&(h=1,n=n.substr(1));e=f.substr(0,h);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(n||k)&&(g=cc.LabelTTF._lastWordRex.exec(e),h-=g?g[0].length:0,0===h&&(h=1),n=f.substr(h),e=f.substr(0,h));cc.LabelTTF._firsrEnglish.test(n)&&(g=cc.LabelTTF._lastEnglish.exec(e))&&e!==g[0]&&(h-=g[0].length,n=f.substr(h),e=f.substr(0,h));a[b]=n||k;a.splice(b, 0,e)}};a.updateStatus=function(){this._dirtyFlag&cc.Node._dirtyFlags.textDirty&&this._updateTexture();this.originUpdateStatus()};a._syncStatus=function(a){var b=cc.Node._dirtyFlags,e=this._dirtyFlag;e&b.textDirty&&this._updateTexture();this._originSyncStatus(a);(cc._renderType===cc.game.RENDER_TYPE_WEBGL||e&b.transformDirty)&&this.transform(a)};a.drawLabels=function(a,b,e){var f=this._node;if(f._shadowEnabled){var g=f._shadowOffset;a.shadowColor=this._shadowColorStr;a.shadowOffsetX=g.x;a.shadowOffsetY= -g.y;a.shadowBlur=f._shadowBlur}var g=f._hAlignment,h=f._vAlignment,k=f._strokeSize;a.font!==this._fontStyleStr&&(a.font=this._fontStyleStr);a.fillStyle=this._fillColorStr;if(f=f._strokeEnabled)a.lineWidth=2*k,a.strokeStyle=this._strokeColorStr;a.textBaseline=cc.LabelTTF._textBaseline[h];a.textAlign=cc.LabelTTF._textAlign[g];g=this._strings.length;for(h=0;h=this._status.length)){var g= this._renderingIndex>=this._status.length?this._renderingIndex-this._status.length:this._renderingIndex,h=this._status[g];this._renderingIndex=g+1;var k=f._offsetPosition.x,g=-f._offsetPosition.y-f._rect.height,m=this._displayedOpacity/255;a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(m);a.save();f._flippedX&&(k=-k-f._rect.width,e.scale(-1,1));f._flippedY&&(g=f._offsetPosition.y,e.scale(1,-1));c=h.xOffset+h.contextTransform.x+k*c;f=[];k=this._strings.length; for(m=0;m=c&&b.actionIndex--;break}}else cc.log(cc._LogInfos.ActionManager_removeAction)}},removeActionByTag:function(a,b){a===cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_addAction); cc.assert(b,cc._LogInfos.ActionManager_addAction);var c=this._hashTargets[b.__instanceId];if(c)for(var d=c.actions.length,e=0;e=a&&b.actionIndex--;0===b.actions.length&&this._deleteHashElement(b)},_deleteHashElement:function(a){var b=!1;if(a&&!a.lock&&this._hashTargets[a.target.__instanceId]){delete this._hashTargets[a.target.__instanceId];for(var b=this._arrayTargets,c=0,d=b.length;ct;++t){var z=w[t].style;z.color="rgb(0, 255, 255)";z.font="bold 12px Helvetica, Arial";z.lineHeight="20px";z.width="100%";n.appendChild(w[t])}var A=function(){e=cc.director.getSecondsPerFrame();c++;f+=cc.director.getDeltaTime();if(f>cc.DIRECTOR_FPS_INTERVAL){d=c/f;f=c=0;if(y.onFrameRateChange){var b=d,g=r.length-1,n=g,w=0;u++;for(x+=b;0<=n;n--)if(b>=r[n]){s[n]++;break}if(u>=p){w=x/p;for(n=g;0=r[n]){n!=v&&(v=n,y.onFrameRateChange&&y.onFrameRateChange(w.toFixed(2))); break}x=u=_changeCount=0;for(n=g;0b&&a-cc.math.EPSILONb.x-a.math.EPSILON&&this.yb.y-a.math.EPSILON}})(cc);(function(a){a.math.Vec3=a.kmVec3=function(a,b,e){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z):(this.x=a||0,this.y=b||0,this.z=e||0)};a.math.vec3=function(b,d,e){return new a.math.Vec3(b,d,e)};var b=a.math.Vec3.prototype;b.fill=function(a,b,e){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z):(this.x=a,this.y=b,this.z=e);return this};b.length=function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+ a.math.square(this.z)};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;this.z*=a;return this};b.cross=function(a){var b=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-b*a.z;this.z=b*a.y-e*a.x;return this};b.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z};b.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this};b.subtract=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this};b.transform=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b* a[0]+e*a[4]+f*a[8]+a[12];this.y=b*a[1]+e*a[5]+f*a[9]+a[13];this.z=b*a[2]+e*a[6]+f*a[10]+a[14];return this};b.transformNormal=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b*a[0]+e*a[4]+f*a[8];this.y=b*a[1]+e*a[5]+f*a[9];this.z=b*a[2]+e*a[6]+f*a[10];return this};b.transformCoord=function(b){var d=new a.math.Vec4(this.x,this.y,this.z,1);d.transform(b);this.x=d.x/d.w;this.y=d.y/d.w;this.z=d.z/d.w;return this};b.scale=function(a){this.x*=a;this.y*=a;this.z*=a;return this};b.equals=function(b){var d= a.math.EPSILON;return this.xb.x-d&&this.yb.y-d&&this.zb.z-d};b.inverseTransform=function(b){b=b.mat;var d=new a.math.Vec3(this.x-b[12],this.y-b[13],this.z-b[14]);this.x=d.x*b[0]+d.y*b[1]+d.z*b[2];this.y=d.x*b[4]+d.y*b[5]+d.z*b[6];this.z=d.x*b[8]+d.y*b[9]+d.z*b[10];return this};b.inverseTransformNormal=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b*a[0]+e*a[1]+f*a[2];this.y=b*a[4]+e*a[5]+f*a[6];this.z=b*a[8]+e*a[9]+f*a[10];return this};b.assignFrom= function(a){if(!a)return this;this.x=a.x;this.y=a.y;this.z=a.z;return this};a.math.Vec3.zero=function(a){a.x=a.y=a.z=0;return a};b.toTypeArray=function(){var a=new Float32Array(3);a[0]=this.x;a[1]=this.y;a[2]=this.z;return a}})(cc);(function(a){a.math.Vec4=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a||0,this.y=b||0,this.z=e||0,this.w=f||0)};a.kmVec4=a.math.Vec4;var b=a.math.Vec4.prototype;b.fill=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a,this.y=b,this.z=e,this.w=f)};b.add=function(a){if(!a)return this;this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this};b.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w};b.length= function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w)};b.lerp=function(a,b){return this};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this};b.scale=function(a){this.normalize();this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this};b.subtract=function(a){this.x-=a.x;this.y-= a.y;this.z-=a.z;this.w-=a.w};b.transform=function(a){var b=this.x,e=this.y,f=this.z,g=this.w;a=a.mat;this.x=b*a[0]+e*a[4]+f*a[8]+g*a[12];this.y=b*a[1]+e*a[5]+f*a[9]+g*a[13];this.z=b*a[2]+e*a[6]+f*a[10]+g*a[14];this.w=b*a[3]+e*a[7]+f*a[11]+g*a[15];return this};a.math.Vec4.transformArray=function(b,d){for(var e=[],f=0;fb.x-d&&this.yb.y-d&& this.zb.z-d&&this.wb.w-d};b.assignFrom=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};b.toTypeArray=function(){var a=new Float32Array(4);a[0]=this.x;a[1]=this.y;a[2]=this.z;a[3]=this.w;return a}})(cc);(function(a){function b(b,d,e){d=new a.math.Vec2(d);d.subtract(b);e.x=-d.y;e.y=d.x;e.normalize()}a.math.Ray2=function(b,d){this.start=b||new a.math.Vec2;this.dir=d||new a.math.Vec2};a.math.Ray2.prototype.fill=function(a,b,e,f){this.start.x=a;this.start.y=b;this.dir.x=e;this.dir.y=f};a.math.Ray2.prototype.intersectLineSegment=function(b,d,e){var f=this.start.x,g=this.start.y,h=this.start.x+this.dir.x,k=this.start.y+this.dir.y,m=b.x,n=b.y,p=d.x,r=d.y,s=(r-n)*(h-f)-(p-m)*(k-g);if(s>-a.math.EPSILON&& sMath.max(b.x,d.x)+a.math.EPSILON||nMath.max(b.y,d.y)+a.math.EPSILON||mMath.max(f,h)+a.math.EPSILON||nMath.max(g,k)+a.math.EPSILON)return!1;e.x=m;e.y=n;return!0};a.math.Ray2.prototype.intersectTriangle=function(c,d,e,f,g){var h=new a.math.Vec2,k=new a.math.Vec2,m=new a.math.Vec2, n=1E4,p=!1,r;this.intersectLineSegment(c,d,h)&&(p=!0,r=h.subtract(this.start).length(),rg;++g)if(!(f[g]+c>b[g]&&f[g]-cc;c++)b[c]=a[c];return this};a.kmMat4Identity=function(a){var b=a.mat;b[1]=b[2]=b[3]=b[4]=b[6]=b[7]=b[8]=b[9]=b[11]=b[12]=b[13]=b[14]=0;b[0]=b[5]=b[10]=b[15]=1;return a};b.identity=function(){var a=this.mat;a[1]=a[2]=a[3]=a[4]=a[6]=a[7]=a[8]=a[9]=a[11]=a[12]=a[13]=a[14]=0;a[0]=a[5]=a[10]=a[15]=1; return this};b.get=function(a,b){return this.mat[a+4*b]};b.set=function(a,b,c){this.mat[a+4*b]=c};b.swap=function(a,b,c,d){var k=this.mat,m=k[a+4*b];k[a+4*b]=k[c+4*d];k[c+4*d]=m};a.math.Matrix4._gaussj=function(a,b){var c,d=0,k=0,m,n,p,r,s=[0,0,0,0],v=[0,0,0,0],u=[0,0,0,0];for(c=0;4>c;c++){for(m=r=0;4>m;m++)if(1!==u[m])for(n=0;4>n;n++)0===u[n]&&(p=Math.abs(a.get(m,n)),p>=r&&(r=p,k=m,d=n));++u[d];if(k!==d){for(m=0;4>m;m++)a.swap(k,m,d,m);for(m=0;4>m;m++)b.swap(k,m,d,m)}v[c]=k;s[c]=d;if(0===a.get(d, d))return!1;n=1/a.get(d,d);a.set(d,d,1);for(m=0;4>m;m++)a.set(d,m,a.get(d,m)*n);for(m=0;4>m;m++)b.set(d,m,b.get(d,m)*n);for(n=0;4>n;n++)if(n!==d){p=a.get(n,d);a.set(n,d,0);for(m=0;4>m;m++)a.set(n,m,a.get(n,m)-a.get(d,m)*p);for(m=0;4>m;m++)b.set(n,m,a.get(n,m)-b.get(d,m)*p)}}for(m=3;0<=m;m--)if(v[m]!==s[m])for(n=0;4>n;n++)a.swap(n,v[m],n,s[m]);return!0};var c=(new a.math.Matrix4).identity();a.kmMat4Inverse=function(b,d){var g=new a.math.Matrix4(d),h=new a.math.Matrix4(c);if(!1===a.math.Matrix4._gaussj(g, h))return null;b.assignFrom(g);return b};b.inverse=function(){var b=new a.math.Matrix4(this),d=new a.math.Matrix4(c);return!1===a.math.Matrix4._gaussj(b,d)?null:b};b.isIdentity=function(){var a=this.mat;return 1===a[0]&&0===a[1]&&0===a[2]&&0===a[3]&&0===a[4]&&1===a[5]&&0===a[6]&&0===a[7]&&0===a[8]&&0===a[9]&&1===a[10]&&0===a[11]&&0===a[12]&&0===a[13]&&0===a[14]&&1===a[15]};b.transpose=function(){var a=this.mat,b=a[1],c=a[2],d=a[3],k=a[6],m=a[7],n=a[8],p=a[9],r=a[11],s=a[12],v=a[13],u=a[14];a[1]=a[4]; a[2]=n;a[3]=s;a[4]=b;a[6]=p;a[7]=v;a[8]=c;a[9]=k;a[11]=u;a[12]=d;a[13]=m;a[14]=r;return this};a.kmMat4Multiply=function(a,b,c){var d=a.mat,k=b.mat,m=c.mat;c=k[0];b=k[1];var n=k[2],p=k[3],r=k[4],s=k[5],v=k[6],u=k[7],x=k[8],w=k[9],t=k[10],z=k[11],A=k[12],y=k[13],C=k[14],k=k[15],B=m[0],D=m[1],I=m[2],F=m[3],G=m[4],K=m[5],H=m[6],L=m[7],E=m[8],M=m[9],N=m[10],O=m[11],P=m[12],R=m[13],Q=m[14],m=m[15];d[0]=B*c+D*r+I*x+F*A;d[1]=B*b+D*s+I*w+F*y;d[2]=B*n+D*v+I*t+F*C;d[3]=B*p+D*u+I*z+F*k;d[4]=G*c+K*r+H*x+L*A;d[5]= G*b+K*s+H*w+L*y;d[6]=G*n+K*v+H*t+L*C;d[7]=G*p+K*u+H*z+L*k;d[8]=E*c+M*r+N*x+O*A;d[9]=E*b+M*s+N*w+O*y;d[10]=E*n+M*v+N*t+O*C;d[11]=E*p+M*u+N*z+O*k;d[12]=P*c+R*r+Q*x+m*A;d[13]=P*b+R*s+Q*w+m*y;d[14]=P*n+R*v+Q*t+m*C;d[15]=P*p+R*u+Q*z+m*k;return a};b.multiply=function(a){var b=this.mat,c=a.mat;a=b[0];var d=b[1],k=b[2],m=b[3],n=b[4],p=b[5],r=b[6],s=b[7],v=b[8],u=b[9],x=b[10],w=b[11],t=b[12],z=b[13],A=b[14],y=b[15],C=c[0],B=c[1],D=c[2],I=c[3],F=c[4],G=c[5],K=c[6],H=c[7],L=c[8],E=c[9],M=c[10],N=c[11],O=c[12], P=c[13],R=c[14],c=c[15];b[0]=C*a+B*n+D*v+I*t;b[1]=C*d+B*p+D*u+I*z;b[2]=C*k+B*r+D*x+I*A;b[3]=C*m+B*s+D*w+I*y;b[4]=F*a+G*n+K*v+H*t;b[5]=F*d+G*p+K*u+H*z;b[6]=F*k+G*r+K*x+H*A;b[7]=F*m+G*s+K*w+H*y;b[8]=L*a+E*n+M*v+N*t;b[9]=L*d+E*p+M*u+N*z;b[10]=L*k+E*r+M*x+N*A;b[11]=L*m+E*s+M*w+N*y;b[12]=O*a+P*n+R*v+c*t;b[13]=O*d+P*p+R*u+c*z;b[14]=O*k+P*r+R*x+c*A;b[15]=O*m+P*s+R*w+c*y;return this};a.getMat4MultiplyValue=function(a,b){var c=a.mat,d=b.mat,k=new Float32Array(16);k[0]=c[0]*d[0]+c[4]*d[1]+c[8]*d[2]+c[12]*d[3]; k[1]=c[1]*d[0]+c[5]*d[1]+c[9]*d[2]+c[13]*d[3];k[2]=c[2]*d[0]+c[6]*d[1]+c[10]*d[2]+c[14]*d[3];k[3]=c[3]*d[0]+c[7]*d[1]+c[11]*d[2]+c[15]*d[3];k[4]=c[0]*d[4]+c[4]*d[5]+c[8]*d[6]+c[12]*d[7];k[5]=c[1]*d[4]+c[5]*d[5]+c[9]*d[6]+c[13]*d[7];k[6]=c[2]*d[4]+c[6]*d[5]+c[10]*d[6]+c[14]*d[7];k[7]=c[3]*d[4]+c[7]*d[5]+c[11]*d[6]+c[15]*d[7];k[8]=c[0]*d[8]+c[4]*d[9]+c[8]*d[10]+c[12]*d[11];k[9]=c[1]*d[8]+c[5]*d[9]+c[9]*d[10]+c[13]*d[11];k[10]=c[2]*d[8]+c[6]*d[9]+c[10]*d[10]+c[14]*d[11];k[11]=c[3]*d[8]+c[7]*d[9]+c[11]* d[10]+c[15]*d[11];k[12]=c[0]*d[12]+c[4]*d[13]+c[8]*d[14]+c[12]*d[15];k[13]=c[1]*d[12]+c[5]*d[13]+c[9]*d[14]+c[13]*d[15];k[14]=c[2]*d[12]+c[6]*d[13]+c[10]*d[14]+c[14]*d[15];k[15]=c[3]*d[12]+c[7]*d[13]+c[11]*d[14]+c[15]*d[15];return k};a.kmMat4Assign=function(b,c){if(b===c)return a.log("cc.kmMat4Assign(): pOut equals pIn"),b;var d=b.mat,h=c.mat;d[0]=h[0];d[1]=h[1];d[2]=h[2];d[3]=h[3];d[4]=h[4];d[5]=h[5];d[6]=h[6];d[7]=h[7];d[8]=h[8];d[9]=h[9];d[10]=h[10];d[11]=h[11];d[12]=h[12];d[13]=h[13];d[14]=h[14]; d[15]=h[15];return b};b.assignFrom=function(b){if(this===b)return a.log("cc.mat.Matrix4.assignFrom(): mat4 equals current matrix"),this;var c=this.mat;b=b.mat;c[0]=b[0];c[1]=b[1];c[2]=b[2];c[3]=b[3];c[4]=b[4];c[5]=b[5];c[6]=b[6];c[7]=b[7];c[8]=b[8];c[9]=b[9];c[10]=b[10];c[11]=b[11];c[12]=b[12];c[13]=b[13];c[14]=b[14];c[15]=b[15];return this};b.equals=function(b){if(this===b)return a.log("cc.kmMat4AreEqual(): pMat1 and pMat2 are same object."),!0;var c=this.mat;b=b.mat;for(var d=a.math.EPSILON,h=0;16> h;h++)if(!(c[h]+d>b[h]&&c[h]-db?a.math.Plane.POINT_BEHIND_PLANE:a.math.Plane.POINT_ON_PLANE}})(cc);(function(a){a.math.Quaternion=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a||0,this.y=b||0,this.z=e||0,this.w=f||0)};a.kmQuaternion=a.math.Quaternion;var b=a.math.Quaternion.prototype;b.conjugate=function(a){this.x=-a.x;this.y=-a.y;this.z=-a.z;this.w=a.w;return this};b.dot=function(a){return this.w*a.w+this.x*a.x+this.y*a.y+this.z*a.z};b.exponential=function(){return this};b.identity=function(){this.z=this.y=this.x=0;this.w=1;return this};b.inverse=function(){var b= this.length();if(Math.abs(b)>a.math.EPSILON)return this.w=this.z=this.y=this.x=0,this;this.conjugate(this).scale(1/b);return this};b.isIdentity=function(){return 0===this.x&&0===this.y&&0===this.z&&1===this.w};b.length=function(){return Math.sqrt(this.lengthSq())};b.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w};b.multiply=function(a){var b=this.x,e=this.y,f=this.z,g=this.w;this.w=g*a.w-b*a.x-e*a.y-f*a.z;this.x=g*a.x+b*a.w+e*a.z-f*a.y;this.y=g*a.y+e*a.w+f*a.x- b*a.z;this.z=g*a.z+f*a.w+b*a.y-e*a.x;return this};b.normalize=function(){var b=this.length();if(Math.abs(b)<=a.math.EPSILON)throw Error("current quaternion is an invalid value");this.scale(1/b);return this};b.rotationAxis=function(a,b){var e=0.5*b,f=Math.sin(e);this.w=Math.cos(e);this.x=a.x*f;this.y=a.y*f;this.z=a.z*f;return this};a.math.Quaternion.rotationMatrix=function(b){if(!b)return null;var d,e,f;d=[];e=b.mat;b=0;d[0]=e[0];d[1]=e[3];d[2]=e[6];d[4]=e[1];d[5]=e[4];d[6]=e[7];d[8]=e[2];d[9]=e[5]; d[10]=e[8];d[15]=1;var g=d[0];b=g[0]+g[5]+g[10]+1;b>a.math.EPSILON?(b=2*Math.sqrt(b),d=(g[9]-g[6])/b,e=(g[2]-g[8])/b,f=(g[4]-g[1])/b,b*=0.25):g[0]>g[5]&&g[0]>g[10]?(b=2*Math.sqrt(1+g[0]-g[5]-g[10]),d=0.25*b,e=(g[4]+g[1])/b,f=(g[2]+g[8])/b,b=(g[9]-g[6])/b):g[5]>g[10]?(b=2*Math.sqrt(1+g[5]-g[0]-g[10]),d=(g[4]+g[1])/b,e=0.25*b,f=(g[9]+g[6])/b,b=(g[2]-g[8])/b):(b=2*Math.sqrt(1+g[10]-g[0]-g[5]),d=(g[2]+g[8])/b,e=(g[9]+g[6])/b,f=0.25*b,b=(g[4]-g[1])/b);return new a.math.Quaternion(d,e,f,b)};a.math.Quaternion.rotationYawPitchRoll= function(b,d,e){var f,g,h,k,m;f=a.degreesToRadians(d)/2;g=a.degreesToRadians(b)/2;h=a.degreesToRadians(e)/2;e=Math.cos(f);b=Math.cos(g);d=Math.cos(h);f=Math.sin(f);g=Math.sin(g);h=Math.sin(h);k=b*d;m=g*h;var n=new a.math.Quaternion;n.w=e*k+f*m;n.x=f*k-e*m;n.y=e*g*d+f*b*h;n.z=e*b*h-f*g*d;n.normalize();return n};b.slerp=function(b,d){if(this.x===b.x&&this.y===b.y&&this.z===b.z&&this.w===b.w)return this;var e=this.dot(b),f=Math.acos(e),g=Math.sqrt(1-a.math.square(e)),e=Math.sin(d*f)/g,f=Math.sin((1- d)*f)/g,g=new a.math.Quaternion(b);this.scale(f);g.scale(e);this.add(g);return this};b.toAxisAndAngle=function(){var b,d,e=new a.math.Vec3;b=Math.acos(this.w);d=Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z));d>-a.math.EPSILON&&d2*Math.PI-a.math.EPSILON?(b=0,e.x=0,e.y=0,e.z=1):(b*=2,e.x=this.x/d,e.y=this.y/d,e.z=this.z/d,e.normalize());return{axis:e,angle:b}};b.scale=function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this}; b.assignFrom=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};b.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this};a.math.Quaternion.rotationBetweenVec3=function(b,d,e){var f=new a.math.Vec3(b),g=new a.math.Vec3(d);f.normalize();g.normalize();var h=f.dot(g);d=new a.math.Quaternion;if(1<=h)return d.identity(),d;-0.999999>h?Math.abs(e.lengthSq())=this.min.x&&a.x<=this.max.x&&a.y>=this.min.y&&a.y<=this.max.y&&a.z>=this.min.z&&a.z<=this.max.z};cc.math.AABB.containsPoint=function(a,b){return a.x>=b.min.x&&a.x<=b.max.x&&a.y>=b.min.y&&a.y<=b.max.y&&a.z>=b.min.z&&a.z<=b.max.z};cc.math.AABB.prototype.assignFrom=function(a){this.min.assignFrom(a.min);this.max.assignFrom(a.max)}; cc.math.AABB.assign=function(a,b){a.min.assignFrom(b.min);a.max.assignFrom(b.max);return a};(function(a){a.math.Matrix4Stack=function(a,b){this.top=a;this.stack=b||[];this.lastUpdated=0};a.km_mat4_stack=a.math.Matrix4Stack;var b=a.math.Matrix4Stack.prototype;b.initialize=function(){this.stack.length=0;this.top=null};a.km_mat4_stack_push=function(b,d){b.stack.push(b.top);b.top=new a.math.Matrix4(d)};a.km_mat4_stack_pop=function(a,b){a.top=a.stack.pop()};a.km_mat4_stack_release=function(a){a.stack=null;a.top=null};b.push=function(b){b=b||this.top;this.stack.push(this.top);this.top=new a.math.Matrix4(b)}; b.pop=function(){this.top=this.stack.pop()};b.release=function(){this._matrixPool=this.top=this.stack=null};b._getFromPool=function(b){var d=this._matrixPool;if(0===d.length)return new a.math.Matrix4(b);d=d.pop();d.assignFrom(b);return d};b._putInPool=function(a){this._matrixPool.push(a)}})(cc);(function(a){a.KM_GL_MODELVIEW=5888;a.KM_GL_PROJECTION=5889;a.KM_GL_TEXTURE=5890;a.modelview_matrix_stack=new a.math.Matrix4Stack;a.projection_matrix_stack=new a.math.Matrix4Stack;a.texture_matrix_stack=new a.math.Matrix4Stack;a.current_stack=null;a.lazyInitialize=function(){var b=new a.math.Matrix4;a.modelview_matrix_stack.initialize();a.projection_matrix_stack.initialize();a.texture_matrix_stack.initialize();a.current_stack=a.modelview_matrix_stack;a.initialized=!0;b.identity();a.modelview_matrix_stack.push(b); a.projection_matrix_stack.push(b);a.texture_matrix_stack.push(b)};a.lazyInitialize();a.kmGLFreeAll=function(){a.modelview_matrix_stack.release();a.modelview_matrix_stack=null;a.projection_matrix_stack.release();a.projection_matrix_stack=null;a.texture_matrix_stack.release();a.texture_matrix_stack=null;a.initialized=!1;a.current_stack=null};a.kmGLPushMatrix=function(){a.current_stack.push(a.current_stack.top)};a.kmGLPushMatrixWitMat4=function(b){a.current_stack.stack.push(a.current_stack.top);b.assignFrom(a.current_stack.top); a.current_stack.top=b};a.kmGLPopMatrix=function(){a.current_stack.top=a.current_stack.stack.pop()};a.kmGLMatrixMode=function(b){switch(b){case a.KM_GL_MODELVIEW:a.current_stack=a.modelview_matrix_stack;break;case a.KM_GL_PROJECTION:a.current_stack=a.projection_matrix_stack;break;case a.KM_GL_TEXTURE:a.current_stack=a.texture_matrix_stack;break;default:throw Error("Invalid matrix mode specified");}a.current_stack.lastUpdated=a.director.getTotalFrames()};a.kmGLLoadIdentity=function(){a.current_stack.top.identity()}; a.kmGLLoadMatrix=function(b){a.current_stack.top.assignFrom(b)};a.kmGLMultMatrix=function(b){a.current_stack.top.multiply(b)};var b=new a.math.Matrix4;a.kmGLTranslatef=function(c,e,f){c=a.math.Matrix4.createByTranslation(c,e,f,b);a.current_stack.top.multiply(c)};var c=new a.math.Vec3;a.kmGLRotatef=function(d,e,f,g){c.fill(e,f,g);d=a.math.Matrix4.createByAxisAndAngle(c,a.degreesToRadians(d),b);a.current_stack.top.multiply(d)};a.kmGLScalef=function(c,e,f){c=a.math.Matrix4.createByScale(c,e,f,b);a.current_stack.top.multiply(c)}; a.kmGLGetMatrix=function(b,c){switch(b){case a.KM_GL_MODELVIEW:c.assignFrom(a.modelview_matrix_stack.top);break;case a.KM_GL_PROJECTION:c.assignFrom(a.projection_matrix_stack.top);break;case a.KM_GL_TEXTURE:c.assignFrom(a.texture_matrix_stack.top);break;default:throw Error("Invalid matrix mode specified");}}})(cc);cc.SHADER_POSITION_UCOLOR_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor;\nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor; \n}\n";cc.SHADER_POSITION_UCOLOR_VERT="attribute vec4 a_position;\nuniform vec4 u_color;\nuniform float u_pointSize;\nvarying lowp vec4 v_fragmentColor; \nvoid main(void) \n{\n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n gl_PointSize \x3d u_pointSize; \n v_fragmentColor \x3d u_color; \n}"; cc.SHADER_POSITION_COLOR_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor; \n} ";cc.SHADER_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying lowp vec4 v_fragmentColor;\nvoid main()\n{\n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n}";cc.SHADER_SPRITE_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying lowp vec4 v_fragmentColor;\nvoid main()\n{\n gl_Position \x3d CC_PMatrix * a_position; \n v_fragmentColor \x3d a_color; \n}"; cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG="// #extension GL_OES_standard_derivatives : enable\nvarying mediump vec4 v_color;\nvarying mediump vec2 v_texcoord;\nvoid main()\t\n{ \n// #if defined GL_OES_standard_derivatives\t\n// gl_FragColor \x3d v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord)); \n// #else\t\ngl_FragColor \x3d v_color * step(0.0, 1.0 - length(v_texcoord)); \n// #endif \n}";cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT="attribute mediump vec4 a_position; \nattribute mediump vec2 a_texcoord; \nattribute mediump vec4 a_color;\t\nvarying mediump vec4 v_color; \nvarying mediump vec2 v_texcoord;\t\nvoid main() \n{ \n v_color \x3d a_color;//vec4(a_color.rgb * a_color.a, a_color.a); \n v_texcoord \x3d a_texcoord; \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n}"; cc.SHADER_POSITION_TEXTURE_FRAG="precision lowp float; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d texture2D(CC_Texture0, v_texCoord); \n}";cc.SHADER_POSITION_TEXTURE_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG="precision lowp float; \nuniform vec4 u_color; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d texture2D(CC_Texture0, v_texCoord) * u_color; \n}"; cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT="attribute vec4 a_position;\nattribute vec2 a_texCoord; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d vec4( v_fragmentColor.rgb, \n v_fragmentColor.a * texture2D(CC_Texture0, v_texCoord).a \n ); \n}"; cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor * texture2D(CC_Texture0, v_texCoord); \n}"; cc.SHADER_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d CC_PMatrix * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}"; cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n vec4 c \x3d texture2D(CC_Texture0, v_texCoord); \n gl_FragColor.xyz \x3d vec3(0.2126*c.r + 0.7152*c.g + 0.0722*c.b); \n gl_FragColor.w \x3d c.w ; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform float CC_alpha_value; \nvoid main() \n{ \n vec4 texColor \x3d texture2D(CC_Texture0, v_texCoord); \n if ( texColor.a \x3c\x3d CC_alpha_value ) \n discard; \n gl_FragColor \x3d texColor * v_fragmentColor; \n}"; cc.SHADEREX_SWITCHMASK_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform sampler2D u_texture; \nuniform sampler2D u_mask; \nvoid main() \n{ \n vec4 texColor \x3d texture2D(u_texture, v_texCoord); \n vec4 maskColor \x3d texture2D(u_mask, v_texCoord); \n vec4 finalColor \x3d vec4(texColor.r, texColor.g, texColor.b, maskColor.a * texColor.a); \n gl_FragColor \x3d v_fragmentColor * finalColor; \n}";cc.shaderCache={TYPE_POSITION_TEXTURECOLOR:0,TYPE_POSITION_TEXTURECOLOR_ALPHATEST:1,TYPE_POSITION_COLOR:2,TYPE_POSITION_TEXTURE:3,TYPE_POSITION_TEXTURE_UCOLOR:4,TYPE_POSITION_TEXTURE_A8COLOR:5,TYPE_POSITION_UCOLOR:6,TYPE_POSITION_LENGTH_TEXTURECOLOR:7,TYPE_SPRITE_POSITION_TEXTURECOLOR:8,TYPE_SPRITE_POSITION_TEXTURECOLOR_ALPHATEST:9,TYPE_SPRITE_POSITION_COLOR:10,TYPE_SPRITE_POSITION_TEXTURECOLOR_GRAY:11,TYPE_MAX:11,_keyMap:[cc.SHADER_POSITION_TEXTURECOLOR,cc.SHADER_POSITION_TEXTURECOLORALPHATEST,cc.SHADER_POSITION_COLOR, cc.SHADER_POSITION_TEXTURE,cc.SHADER_POSITION_TEXTURE_UCOLOR,cc.SHADER_POSITION_TEXTUREA8COLOR,cc.SHADER_POSITION_UCOLOR,cc.SHADER_POSITION_LENGTHTEXTURECOLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST,cc.SHADER_SPRITE_POSITION_COLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY],_programs:{},_init:function(){this.loadDefaultShaders();return!0},_loadDefaultShader:function(a,b){switch(b){case cc.SHADER_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT, cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR, cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT, cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION); a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_VERT,cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_SPRITE_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_COLOR_VERT, cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_POSITION_TEXTURE:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_VERT,cc.SHADER_POSITION_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURE_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT, cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTUREA8COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT,cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD, cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_UCOLOR_VERT,cc.SHADER_POSITION_UCOLOR_FRAG);a.addAttribute("aVertex",cc.VERTEX_ATTRIB_POSITION);break;case cc.SHADER_POSITION_LENGTHTEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT,cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS); a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;default:cc.log("cocos2d: cc.shaderCache._loadDefaultShader, error shader type");return}a.link();a.updateUniforms()},loadDefaultShaders:function(){for(var a=0;a arguments.length))switch(arguments.length){case 2:this.setUniformLocationWith1f(arguments[0],arguments[1]);break;case 3:this.setUniformLocationWith2f(arguments[0],arguments[1],arguments[2]);break;case 4:this.setUniformLocationWith3f(arguments[0],arguments[1],arguments[2],arguments[3]);break;case 5:this.setUniformLocationWith4f(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4])}},setUniformsForBuiltins:function(){var a=new cc.math.Matrix4,b=new cc.math.Matrix4,c=new cc.math.Matrix4; cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,a);cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,b);cc.kmMat4Multiply(c,a,b);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],a.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10, a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())},_setUniformsForBuiltinsForRenderer:function(a){if(a&&a._renderCmd){var b=new cc.math.Matrix4,c=new cc.math.Matrix4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION, b);cc.kmMat4Multiply(c,b,a._renderCmd._stackMatrix);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],a._renderCmd._stackMatrix.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S], a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())}},setUniformForModelViewProjectionMatrix:function(){this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],cc.getMat4MultiplyValue(cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top))}, setUniformForModelViewProjectionMatrixWithMat4:function(a){cc.kmMat4Multiply(a,cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],a.mat)},setUniformForModelViewAndProjectionMatrixWithMat4:function(){this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],cc.modelview_matrix_stack.top.mat);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],cc.projection_matrix_stack.top.mat)}, _setUniformForMVPMatrixWithMat4:function(a){if(!a)throw Error("modelView matrix is undefined.");this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],a.mat);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],cc.projection_matrix_stack.top.mat)},_updateProjectionUniform:function(){var a=cc.projection_matrix_stack;a.lastUpdated!==this._projectionUpdated&&(this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],!1,a.top.mat),this._projectionUpdated= a.lastUpdated)},vertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getVertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getFragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},fragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._fragShader)},programLog:function(){return this._glContext.getProgramInfoLog(this._programObj)},getProgramLog:function(){return this._glContext.getProgramInfoLog(this._programObj)}, reset:function(){this._fragShader=this._vertShader=null;0>1;a|=a>>2;a|=a>>4;a|=a>>8;return(a|a>>16)+1}; cc.RenderTexture=cc.Node.extend({sprite:null,clearFlags:0,clearDepthVal:0,autoDraw:!1,_texture:null,_pixelFormat:0,clearStencilVal:0,_clearColor:null,_className:"RenderTexture",ctor:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888;this._clearColor=new cc.Color(0,0,0,255);void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.initWithWidthAndHeight(a,b,c,d||0));this.setAnchorPoint(0, 0)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.RenderTexture.CanvasRenderCmd(this):new cc.RenderTexture.WebGLRenderCmd(this)},visit:function(a){var b=this._renderCmd;a=a?a._renderCmd:null;if(this._visible){var c=cc.renderer;b.visit(a);c.pushRenderCommand(b);this.sprite.visit(this);b._dirtyFlag=0}else b._propagateFlagsDown(a)},cleanup:function(){cc.Node.prototype.onExit.call(this);this._renderCmd.cleanup()},getSprite:function(){return this.sprite},setSprite:function(a){this.sprite= a},setVirtualViewport:function(a,b,c){this._renderCmd.setVirtualViewport(a,b,c)},initWithWidthAndHeight:function(a,b,c,d){return this._renderCmd.initWithWidthAndHeight(a,b,c,d)},begin:function(){cc.renderer._turnToCacheMode(this.__instanceId);this._renderCmd.begin()},beginWithClear:function(a,b,c,d,e,f){var g=cc._renderContext;e=e||g.COLOR_BUFFER_BIT;f=f||g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT;this._beginWithClear(a,b,c,d,e,f,g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT|g.STENCIL_BUFFER_BIT)},_beginWithClear:function(a, b,c,d,e,f,g){this.begin();this._renderCmd._beginWithClear(a,b,c,d,e,f,g)},end:function(){this._renderCmd.end()},clear:function(a,b,c,d){this.beginWithClear(a,b,c,d);this.end()},clearRect:function(a,b,c,d){this._renderCmd.clearRect(a,b,c,d)},clearDepth:function(a){this._renderCmd.clearDepth(a)},clearStencil:function(a){this._renderCmd.clearStencil(a)},getClearFlags:function(){return this.clearFlags},setClearFlags:function(a){this.clearFlags=a},getClearColor:function(){return this._clearColor},setClearColor:function(a){var b= this._clearColor;b.r=a.r;b.g=a.g;b.b=a.b;b.a=a.a;this._renderCmd.updateClearColor(a)},getClearDepth:function(){return this.clearDepthVal},setClearDepth:function(a){this.clearDepthVal=a},getClearStencil:function(){return this.clearStencilVal},setClearStencil:function(a){this.clearStencilVal=a},isAutoDraw:function(){return this.autoDraw},setAutoDraw:function(a){this.autoDraw=a},saveToFile:function(a,b){cc.log("saveToFile isn't supported on Cocos2d-Html5")},newCCImage:function(a){cc.log("saveToFile isn't supported on cocos2d-html5"); return null},listenToBackground:function(a){},listenToForeground:function(a){}});_p=cc.RenderTexture.prototype;cc.defineGetterSetter(_p,"clearColorVal",_p.getClearColor,_p.setClearColor);cc.RenderTexture.create=function(a,b,c,d){return new cc.RenderTexture(a,b,c,d)};(function(){cc.RenderTexture.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._clearColorStr="rgba(255,255,255,1)";this._cacheCanvas=document.createElement("canvas");this._cacheContext=new cc.CanvasContextWrapper(this._cacheCanvas.getContext("2d"))};var a=cc.RenderTexture.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.RenderTexture.CanvasRenderCmd;a.cleanup=function(){this._cacheCanvas=this._cacheContext=null};a.clearStencil=function(a){}; a.setVirtualViewport=function(a,c,d){};a.updateClearColor=function(a){this._clearColorStr="rgba("+(0|a.r)+","+(0|a.g)+","+(0|a.b)+","+a.a/255+")"};a.initWithWidthAndHeight=function(a,c,d,e){d=this._node;e=this._cacheCanvas;var f=cc.contentScaleFactor();e.width=0|a*f;e.height=0|c*f;a=new cc.Texture2D;a.initWithElement(e);a.handleLoadedTexture();a=d.sprite=new cc.Sprite(a);a.setBlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA);d.autoDraw=!1;d.addChild(a);return!0};a.begin=function(){};a._beginWithClear=function(a, c,d,e,f,g,h){a=a||0;c=c||0;d=d||0;e=isNaN(e)?255:e;f=this._cacheContext.getContext();g=this._cacheCanvas;f.setTransform(1,0,0,1,0,0);this._cacheContext.setFillStyle("rgba("+(0|a)+","+(0|c)+","+(0|d)+","+e/255+")");f.clearRect(0,0,g.width,g.height);f.fillRect(0,0,g.width,g.height)};a.end=function(){var a=this._node,c=cc.contentScaleFactor();cc.renderer._renderingToCacheCanvas(this._cacheContext,a.__instanceId,c,c);a=a.sprite._renderCmd;a._notifyRegionStatus&&a._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty)}; a.clearRect=function(a,c,d,e){this._cacheContext.clearRect(a,c,d,-e)};a.clearDepth=function(a){cc.log("clearDepth isn't supported on Cocos2d-Html5")}})();(function(){cc.RenderTexture.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._depthRenderBuffer=this._textureCopy=this._oldFBO=this._fBO=null;this._rtTextureRect=new cc.Rect;this._fullRect=new cc.Rect;this._fullViewport=new cc.Rect};var a=cc.RenderTexture.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.RenderTexture.WebGLRenderCmd;a.setVirtualViewport=function(a,c,d){this._rtTextureRect.x=a.x;this._rtTextureRect.y=a.y;this._fullRect=c; this._fullViewport=d};a.needDraw=function(){return this._needDraw&&this._node.autoDraw};a.rendering=function(a){var c=a||cc._renderContext;a=this._node;if(a.autoDraw){a.begin();var d=a.clearFlags;if(d){var e=[0,0,0,0],f=0,g=0;d&c.COLOR_BUFFER_BIT&&(e=c.getParameter(c.COLOR_CLEAR_VALUE),c.clearColor(a._clearColor.r/255,a._clearColor.g/255,a._clearColor.b/255,a._clearColor.a/255));d&c.DEPTH_BUFFER_BIT&&(f=c.getParameter(c.DEPTH_CLEAR_VALUE),c.clearDepth(a.clearDepthVal));d&c.STENCIL_BUFFER_BIT&&(g= c.getParameter(c.STENCIL_CLEAR_VALUE),c.clearStencil(a.clearStencilVal));c.clear(d);d&c.COLOR_BUFFER_BIT&&c.clearColor(e[0],e[1],e[2],e[3]);d&c.DEPTH_BUFFER_BIT&&c.clearDepth(f);d&c.STENCIL_BUFFER_BIT&&c.clearStencil(g)}a.sortAllChildren();c=a._children;for(d=0;d=b)return 0;var c=this.getChildByTag(a),d=this.getChildByTag(a+b);return this._getLetterPosXLeft(d)-this._getLetterPosXLeft(c)},_checkWarp:function(a,b,c,d){for(var e=a[b],f=0,g=0;gc&&1c&&100>p++;)d*=c/k,d|=0,g=e.substr(d),k=h-this._getCharsWidth(f+d,g.length-1);for(p=0;kp++;)g&&(n=(m=cc.LabelTTF._wordRex.exec(g))?m[0].length:1,m=g),this._lineBreakWithoutSpaces&&(n=0),d+=n,g=e.substr(d),k=h-this._getCharsWidth(f+d,g.length-1);d-=n;0===d&&(d=1,m=m.substr(1));c=e.substr(0,d);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(m||g)&&(n=(f=cc.LabelTTF._lastWordRex.exec(c))? f[0].length:0,this._lineBreakWithoutSpaces&&(n=0),d-=n,m=e.substr(d),c=e.substr(0,d));cc.LabelTTF._firsrEnglish.test(m)&&(f=cc.LabelTTF._lastEnglish.exec(c))&&c!==f[0]&&(n=f[0].length,this._lineBreakWithoutSpaces&&(n=0),d-=n,m=e.substr(d),c=e.substr(0,d));a[b]=m||g;a.splice(b,0,c)}},updateLabel:function(){this.string=this._initialString;var a,b,c;if(0c)){var k=this.getChildByTag(c);if(null!=k){b=k.getPositionX()+k._getWidth()/2;k=0;switch(this._alignment){case cc.TEXT_ALIGNMENT_CENTER:k=this.width/2-b/2;break;case cc.TEXT_ALIGNMENT_RIGHT:k=this.width-b}if(0!== k)for(b=0;bc||(c=this.getChildByTag(c))&&(c.x+=k);a+=h;d++;f.length=0}}}else f.push(this._string[a])},setAlignment:function(a){this._alignment=a;this.updateLabel()},_getAlignment:function(){return this._alignment},setBoundingWidth:function(a){this._width=a;this.updateLabel()},_getBoundingWidth:function(){return this._width},setLineBreakWithoutSpace:function(a){this._lineBreakWithoutSpaces=a;this.updateLabel()},setScale:function(a,b){cc.Node.prototype.setScale.call(this,a,b);this.updateLabel()}, setScaleX:function(a){cc.Node.prototype.setScaleX.call(this,a);this.updateLabel()},setScaleY:function(a){cc.Node.prototype.setScaleY.call(this,a);this.updateLabel()},setFntFile:function(a){if(null!=a&&a!==this._fntFile){var b=cc.loader.getRes(a);b?(this._fntFile=a,this._config=b,a=cc.textureCache.addImage(b.atlasName),(this._textureLoaded=b=a.isLoaded())?(this.setTexture(a),this._string&&0=a||32===a||133===a||160===a||5760===a||8192<=a&&8202>=a||8232===a||8233===a||8239===a||8287===a||12288===a},_utf8_trim_ws:function(a){var b=a.length;if(!(0>=b)&&(b-=1,this._isspace_unicode(a[b]))){for(var c=b-1;0<=c;--c)if(this._isspace_unicode(a[c]))b=c;else break;this._utf8_trim_from(a,b)}},_utf8_trim_from:function(a,b){var c=a.length;b>=c||0>b||a.splice(b,c)}}); (function(){var a=cc.LabelBMFont.prototype;cc.EventHelper.prototype.apply(a);cc.defineGetterSetter(a,"string",a.getString,a._setStringForSetter);cc.defineGetterSetter(a,"boundingWidth",a._getBoundingWidth,a.setBoundingWidth);cc.defineGetterSetter(a,"textAlign",a._getAlignment,a.setAlignment);cc.defineGetterSetter(a,"texture",a.getTexture,a.setTexture)})();cc.LabelBMFont.create=function(a,b,c,d,e){return new cc.LabelBMFont(a,b,c,d,e)};cc.FntFrameCache={}; var _fntLoader={FNT_HEAD:/fntframes [^\n]*(\n|$)/gi,FNT_FRAME_NAME:/fntframe [^\n]*(\n|$)/gi,INFO_EXP:/info [^\n]*(\n|$)/gi,COMMON_EXP:/common [^\n]*(\n|$)/gi,PAGE_EXP:/page [^\n]*(\n|$)/gi,CHAR_EXP:/char [^\n]*(\n|$)/gi,KERNING_EXP:/kerning [^\n]*(\n|$)/gi,ITEM_EXP:/\w+=[^ \r\n]+/gi,INT_EXP:/^[\-]?\d+$/,_parseStrToObj:function(a){a=a.match(this.ITEM_EXP);var b={};if(a)for(var c=0,d=a.length;cf.width||e.scaleH>f.height)&&cc.log("cc.LabelBMFont._parseCommonArguments(): page can't be larger than supported")}1!==e.pages&&cc.log("cc.LabelBMFont._parseCommonArguments(): only supports 1 page");e=this._parseStrToObj(b.match(this.PAGE_EXP)[0]); 0!==e.id&&cc.log("cc.LabelBMFont._parseImageFileName() : file could not be found");a.atlasName=d?cc.path.join(cc.path.dirname(d.path)+e.file):cc.path.changeBasename(c,e.file);e=b.match(this.CHAR_EXP);f=a.fontDefDictionary={};c=0;for(d=e.length;cn||0>m||(n=cc.rect(n*f,m*g,f,g),m=e._contentSize,0>n.x||0>n.y||n.x+n.width>m.width||n.y+n.height>m.height))){k++;var m=c.charCodeAt(h),p=a.getChildByTag(h);p?32===m?(p.init(),p.setTextureRect(cc.rect(0,0,10,10),!1,cc.size(0,0))):(p.initWithTexture(e,n),p.visible=!0):(p=new cc.Sprite,32===m?(p.init(),p.setTextureRect(cc.rect(0,0,10,10),!1,cc.size(0,0))):p.initWithTexture(e,n),cc.Node.prototype.addChild.call(a, p,0,h));p.setPosition(k*f+f/2,g/2)}}this.updateContentSize(h,k+1)};a.updateContentSize=function(a,c){var d=this._node,e=d._contentSize;a!==c&&a*d._itemWidth===e.width&&d._itemHeight===e.height&&d.setContentSize(c*d._itemWidth,d._itemHeight)};a.setString=function(a){a=this._node;if(a._children){a=a._children;for(var c=a.length,d=0;de.getCapacity()&&cc.log("cc.LabelAtlas._updateAtlasValues(): Invalid String length");for(var m=e.quads,n=a._itemWidth,p=a._itemHeight,r=0,s=-1;ru||0>x||u*n+n>g||x*p+p>f)){s++;var w;cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(u=(2*u*h+1)/(2*g),v=u+(2*h-2)/(2*g),x=(2*x*k+1)/(2*f),w=x+(2*k-2)/(2*f)):(u=u*h/g,v=u+h/g,x=x*k/f,w=x+k/f);var t=m[r],z=t.tl,A=t.tr,y=t.bl,t=t.br;z.texCoords.u=u;z.texCoords.v=x;A.texCoords.u=v;A.texCoords.v=x;y.texCoords.u=u;y.texCoords.v=w;t.texCoords.u=v;t.texCoords.v=w;y.vertices.x=s*n;y.vertices.y=0;y.vertices.z=0;t.vertices.x=s*n+n;t.vertices.y=0;t.vertices.z=0;z.vertices.x= s*n;z.vertices.y=a._itemHeight;z.vertices.z=0;A.vertices.x=s*n+n;A.vertices.y=a._itemHeight;A.vertices.z=0}}this._updateColor();this.updateContentSize(r,s+1);0a&&e.increaseTotalQuadsWith(d-a))};a.updateContentSize=function(a,c){var d=this._node,e=d._contentSize;a!==c&&a*d._itemWidth===e.width&&d._itemHeight===e.height&&d.setContentSize(c*d._itemWidth,d._itemHeight)};a.setString=function(a){a=a.length;a>this._textureAtlas.totalQuads&&this._textureAtlas.resizeCapacity(a)}; a._addChild=function(){}})();cc.MotionStreak=cc.Node.extend({texture:null,fastMode:!1,startingPositionInitialized:!1,_blendFunc:null,_stroke:0,_fadeDelta:0,_minSeg:0,_maxPoints:0,_nuPoints:0,_previousNuPoints:0,_pointVertexes:null,_pointState:null,_vertices:null,_colorPointer:null,_texCoords:null,_verticesBuffer:null,_colorPointerBuffer:null,_texCoordsBuffer:null,_className:"MotionStreak",ctor:function(a,b,c,d,e){cc.Node.prototype.ctor.call(this);this._positionR=cc.p(0,0);this._blendFunc=new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA); this.startingPositionInitialized=this.fastMode=!1;this.texture=null;this._previousNuPoints=this._nuPoints=this._maxPoints=this._minSeg=this._fadeDelta=this._stroke=0;this._texCoordsBuffer=this._colorPointerBuffer=this._verticesBuffer=this._texCoords=this._colorPointer=this._vertices=this._pointState=this._pointVertexes=null;void 0!==e&&this.initWithFade(a,b,c,d,e)},getTexture:function(){return this.texture},setTexture:function(a){this.texture!==a&&(this.texture=a)},getBlendFunc:function(){return this._blendFunc}, setBlendFunc:function(a,b){void 0===b?this._blendFunc=a:(this._blendFunc.src=a,this._blendFunc.dst=b)},getOpacity:function(){cc.log("cc.MotionStreak.getOpacity has not been supported.");return 0},setOpacity:function(a){cc.log("cc.MotionStreak.setOpacity has not been supported.")},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isFastMode:function(){return this.fastMode},setFastMode:function(a){this.fastMode=a},isStartingPositionInitialized:function(){return this.startingPositionInitialized}, setStartingPositionInitialized:function(a){this.startingPositionInitialized=a},getStroke:function(){return this._stroke},setStroke:function(a){this._stroke=a},initWithFade:function(a,b,c,d,e){if(!e)throw Error("cc.MotionStreak.initWithFade(): Invalid filename or texture");cc.isString(e)&&(e=cc.textureCache.addImage(e));cc.Node.prototype.setPosition.call(this,cc.p(0,0));this.anchorY=this.anchorX=0;this.ignoreAnchor=!0;this.startingPositionInitialized=!1;this.fastMode=!0;this._minSeg=-1===b?c/5:b;this._minSeg*= this._minSeg;this._stroke=c;this._fadeDelta=1/a;this._maxPoints=a=(0|60*a)+2;this._nuPoints=0;this._pointState=new Float32Array(a);this._pointVertexes=new Float32Array(2*a);this._vertices=new Float32Array(4*a);this._texCoords=new Float32Array(4*a);this._colorPointer=new Uint8Array(8*a);this._verticesBuffer=gl.createBuffer();this._texCoordsBuffer=gl.createBuffer();this._colorPointerBuffer=gl.createBuffer();this._blendFunc.src=gl.SRC_ALPHA;this._blendFunc.dst=gl.ONE_MINUS_SRC_ALPHA;this.texture=e;this.color= d;this.scheduleUpdate();gl.bindBuffer(gl.ARRAY_BUFFER,this._verticesBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._vertices,gl.DYNAMIC_DRAW);gl.bindBuffer(gl.ARRAY_BUFFER,this._texCoordsBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._texCoords,gl.DYNAMIC_DRAW);gl.bindBuffer(gl.ARRAY_BUFFER,this._colorPointerBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._colorPointer,gl.DYNAMIC_DRAW);return!0},tintWithColor:function(a){this.color=a;for(var b=this._colorPointer,c=0,d=2*this._nuPoints;c=h[b]?f++:(c=b-f,0=this._maxPoints?b=!1:0=b._nuPoints)&&b.texture&&b.texture.isLoaded()){a=a||cc._renderContext;var c=this._worldTransform;this._matrix.mat[0]=c.a;this._matrix.mat[4]=c.c;this._matrix.mat[12]=c.tx;this._matrix.mat[1]=c.b;this._matrix.mat[5]=c.d;this._matrix.mat[13]=c.ty;this._glProgramState.apply(this._matrix);cc.glBlendFunc(b._blendFunc.src,b._blendFunc.dst);cc.glBindTexture2D(b.texture);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION); a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);a.bindBuffer(a.ARRAY_BUFFER,b._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,b._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,b._texCoordsBuffer);a.bufferData(a.ARRAY_BUFFER,b._texCoords,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,b._colorPointerBuffer);a.bufferData(a.ARRAY_BUFFER, b._colorPointer,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,0,0);a.drawArrays(a.TRIANGLE_STRIP,0,2*b._nuPoints);cc.g_NumberOfDraws++}};cc.NodeGrid=cc.Node.extend({grid:null,_target:null,_gridRect:null,ctor:function(a){cc.Node.prototype.ctor.call(this);void 0===a&&(a=cc.rect());this._gridRect=a},getGrid:function(){return this.grid},setGrid:function(a){this.grid=a},setGridRect:function(a){this._gridRect=a},getGridRect:function(){return this._gridRect},setTarget:function(a){this._target=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.NodeGrid.WebGLRenderCmd(this):new cc.Node.CanvasRenderCmd(this)}}); _p=cc.NodeGrid.prototype;cc.defineGetterSetter(_p,"target",null,_p.setTarget);cc.NodeGrid.create=function(){return new cc.NodeGrid};(function(){cc.NodeGrid.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._gridBeginCommand=new cc.CustomRenderCmd(this,this.onGridBeginDraw);this._gridEndCommand=new cc.CustomRenderCmd(this,this.onGridEndDraw)};var a=cc.NodeGrid.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.NodeGrid.WebGLRenderCmd;a.visit=function(a){var c=this._node;if(c._visible){if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;var d=cc.current_stack;d.stack.push(d.top); this._syncStatus(a);d.top=this._stackMatrix;cc.renderer.pushRenderCommand(this._gridBeginCommand);c._target&&c._target.visit();if((a=c._children)&&0c||this._bufferCapacity>c){var e=Math.max(Math.min(c+c,200),b,this._bufferCapacity);0!==c&&(a.freeBuffer(d,20*c),this._occupiedSize=0);b=this._offset=a.requestBuffer(20*e);if(0<=b){this._occupiedSize=this._bufferCapacity=e;this._f32Buffer=new Float32Array(a.data,b,5*this._occupiedSize);this._ui32Buffer=new Uint32Array(a.data,b,5*this._occupiedSize);if(0!==c&&d!==b)for(c=d/4+5*c,b/=4,d/=4;dthis._offset||0>=this._vertexCount||(this._dirty? (a.updateSubData(this._offset,this._f32Buffer),this._dirty=!1):b.bindBuffer(b.ARRAY_BUFFER,a.vertexBuffer),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS),b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,20,0),b.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,b.UNSIGNED_BYTE,!0,20,8),b.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,b.FLOAT,!1,20,12),b.drawArrays(b.TRIANGLES,this._offset/ 20,this._vertexCount),cc.incrementGLDraws(1))},appendVertexData:function(a,b,c,d,f){var g=this._f32Buffer,h=5*this._vertexCount;g[h]=a;g[h+1]=b;e[0]=c.a<<24|c.b<<16|c.g<<8|c.r;this._ui32Buffer[h+2]=e[0];g[h+3]=d;g[h+4]=f;this._vertexCount++},drawDot:function(a,b,c){c=c||this._drawColor;null==c.a&&(c.a=255);var d=a.x-b,e=a.y-b,f=a.x+b;a=a.y+b;this._ensureCapacity(this._vertexCount+6)&&(this.appendVertexData(d,e,c,-1,-1),this.appendVertexData(d,a,c,-1,1),this.appendVertexData(f,a,c,1,1),this.appendVertexData(d, e,c,-1,-1),this.appendVertexData(f,a,c,1,1),this.appendVertexData(f,e,c,1,-1),this._dirty=!0)},drawSegment:function(a,b,c,d){d=d||this.getDrawColor();null==d.a&&(d.a=255);c=c||0.5*this._lineWidth;if(this._ensureCapacity(this._vertexCount+18)){f.x=a.y-b.y;f.y=b.x-a.x;cc.pNormalizeIn(f);g.x=-f.y;g.y=f.x;var e=c;h.x=f.x*e;h.y=f.y*e;k.x=g.x*c;k.y=g.y*c;c=b.x+h.x-k.x;var e=b.y+h.y-k.y,m=f.x-g.x,x=f.y-g.y,w=b.x-h.x,t=b.y-h.y,z=-f.x,A=-f.y,y=b.x+h.x,C=b.y+h.y,B=f.x,D=f.y,I=a.x-h.x,F=a.y-h.y,G=a.x+h.x,K= a.y+h.y,H=f.x,L=f.y,E=a.x-h.x+k.x,M=a.y-h.y+k.y,N=g.x-f.x,O=g.y-f.y,P=a.x+h.x+k.x;a=a.y+h.y+k.y;var R=f.x+g.x,Q=f.y+g.y;this.appendVertexData(b.x-h.x-k.x,b.y-h.y-k.y,d,-(f.x+g.x),-(f.y+g.y));this.appendVertexData(c,e,d,m,x);this.appendVertexData(w,t,d,z,A);this.appendVertexData(y,C,d,B,D);this.appendVertexData(c,e,d,m,x);this.appendVertexData(w,t,d,z,A);this.appendVertexData(y,C,d,B,D);this.appendVertexData(I,F,d,z,A);this.appendVertexData(w,t,d,z,A);this.appendVertexData(y,C,d,B,D);this.appendVertexData(I, F,d,z,A);this.appendVertexData(G,K,d,H,L);this.appendVertexData(E,M,d,N,O);this.appendVertexData(I,F,d,z,A);this.appendVertexData(G,K,d,H,L);this.appendVertexData(E,M,d,N,O);this.appendVertexData(P,a,d,R,Q);this.appendVertexData(G,K,d,H,L);this._dirty=!0}},drawPoly:function(a,c,d,e){if("object"===typeof a[0]){for(var g=b.length=0;g=b)){c=c||this._drawColor;null==c.a&&(c.a=255);b*=0.5;var e,g,k,w,t,z,A,y=a.length;for(A=m.length=0;A=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),cc.ClippingNode.WebGLRenderCmd._init_once=!1)};a.transform=function(a,c){var d=this._node;this.originTransform(a, c);d._stencil&&(d._stencil._renderCmd.transform(this,!0),d._stencil._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty)};a.clippingVisit=function(a){var c=this._node;a=a||this.getParentRenderCmd();this.visit(a);if(1>cc.stencilBits)c._visitChildren();else if(c._stencil&&c._stencil.visible)if(cc.ClippingNode.WebGLRenderCmd._layer+1===cc.stencilBits)cc.ClippingNode.WebGLRenderCmd._visit_once=!0,cc.ClippingNode.WebGLRenderCmd._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its children."), cc.ClippingNode.WebGLRenderCmd._visit_once=!1),c._visitChildren();else{cc.renderer.pushRenderCommand(this._beforeVisitCmd);c._stencil.visit(c);cc.renderer.pushRenderCommand(this._afterDrawStencilCmd);if((a=c._children)&&0a.alphaThreshold&&(c=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),cc.glUseProgram(c.getProgram()),c.setUniformLocationWith1f(cc.UNIFORM_ALPHA_TEST_VALUE_S,a.alphaThreshold),c.setUniformLocationWithMatrix4fv(cc.UNIFORM_MVMATRIX_S,cc.renderer.mat4Identity.mat),cc.setProgram(a._stencil,c))};a._onAfterDrawStencil=function(a){a=a||cc._renderContext;a.depthMask(!0);a.stencilFunc(this._node.inverted?a.NOTEQUAL:a.EQUAL,this._mask_layer_le, this._mask_layer_le);a.stencilOp(a.KEEP,a.KEEP,a.KEEP)};a._onAfterVisit=function(a){a=a||cc._renderContext;cc.ClippingNode.WebGLRenderCmd._layer--;if(this._currentStencilEnabled){var c=1<h;++h)p[r[h]]=A[h].x,p[r[h]+1]=A[h].y,p[r[h]+2]=A[h].z,m[x[h]]=s[h].x/b,m[x[h]+1]=n?(d-s[h].y)/c:s[h].y/c}this._originalVertices=new Float32Array(this._vertices);a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);a.bufferData(a.ELEMENT_ARRAY_BUFFER, this._indices,a.STATIC_DRAW);this._dirty=!0},setNeedDepthTestForBlit:function(a){this._needDepthTestForBlit=a},getNeedDepthTestForBlit:function(){return this._needDepthTestForBlit}});cc.Grid3D.create=function(a,b,c){return new cc.Grid3D(a,b,c)}; cc.TiledGrid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,ctor:function(a,b,c,d){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null;this._matrix=new cc.math.Matrix4;this._matrix.identity();void 0!==a&&this.initWithSize(a,b,c,d)},tile:function(a){return this.getTile(a)}, getTile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.tile() : Numbers must be integers");a=12*(this._gridSize.height*a.x+a.y);var b=this._vertices;return new cc.Quad3(new cc.Vertex3F(b[a],b[a+1],b[a+2]),new cc.Vertex3F(b[a+3],b[a+4],b[a+5]),new cc.Vertex3F(b[a+6],b[a+7],b[a+8]),new cc.Vertex3F(b[a+9],b[a+10],b[a+11]))},getOriginalTile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.originalTile() : Numbers must be integers");a=12*(this._gridSize.height*a.x+a.y); var b=this._originalVertices;return new cc.Quad3(new cc.Vertex3F(b[a],b[a+1],b[a+2]),new cc.Vertex3F(b[a+3],b[a+4],b[a+5]),new cc.Vertex3F(b[a+6],b[a+7],b[a+8]),new cc.Vertex3F(b[a+9],b[a+10],b[a+11]))},originalTile:function(a){return this.getOriginalTile(a)},setTile:function(a,b){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.setTile() : Numbers must be integers");var c=12*(this._gridSize.height*a.x+a.y),d=this._vertices;d[c]=b.bl.x;d[c+1]=b.bl.y;d[c+2]=b.bl.z;d[c+3]=b.br.x;d[c+4]=b.br.y;d[c+ 5]=b.br.z;d[c+6]=b.tl.x;d[c+7]=b.tl.y;d[c+8]=b.tl.z;d[c+9]=b.tr.x;d[c+10]=b.tr.y;d[c+11]=b.tr.z;this._dirty=!0},blit:function(a){var b=this._gridSize.width*this._gridSize.height;a=a._renderCmd._worldTransform;this._matrix.mat[0]=a.a;this._matrix.mat[4]=a.c;this._matrix.mat[12]=a.tx;this._matrix.mat[1]=a.b;this._matrix.mat[5]=a.d;this._matrix.mat[13]=a.ty;this._glProgramState.apply(this._matrix);a=cc._renderContext;var c=this._dirty;a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS); a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,0,this._vertices);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,this._texCoordinates);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);c&&a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices, a.STATIC_DRAW);a.drawElements(a.TRIANGLES,6*b,a.UNSIGNED_SHORT,0);c&&(this._dirty=!1);cc.incrementGLDraws(1)},reuse:function(){if(0=this._duration},_cloneDecoration:function(a){a._repeatForever=this._repeatForever;a._speed=this._speed;a._timesForRepeat=this._timesForRepeat;a._easeList=this._easeList;a._speedMethod=this._speedMethod;a._repeatMethod=this._repeatMethod},_reverseEaseList:function(a){if(this._easeList){a._easeList=[];for(var b=0;ba? a:1;this.update(0=a)return cc.log("The speed parameter error"),this;this._speedMethod=!0;this._speed*=a;return this},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a;return this},repeat:function(a){a=Math.round(a);if(isNaN(a)||1>a)return cc.log("The repeat parameter error"),this;this._repeatMethod=!0;this._timesForRepeat*=a;return this},repeatForever:function(){this._repeatMethod= !0;this._timesForRepeat=this.MAX_VALUE;this._repeatForever=!0;return this}});cc.actionInterval=function(a){return new cc.ActionInterval(a)};cc.ActionInterval.create=cc.actionInterval; cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._actions=[];var b=a instanceof Array?a:arguments,c=b.length-1;0<=c&&null==b[c]&&cc.log("parameters should not be ending with null in Javascript");if(0<=c){for(var d=b[0],e=1;e=e){for(;a>e&&this._totale?this._two=cc.Sequence._actionOneTwo(b,cc.delayTime(d-e)):dc&&(c+=360);this._startAngleX=b;this._diffAngleX=c;this._startAngleY=a.rotationY%360;a=this._dstAngleY-this._startAngleY;180a&&(a+=360);this._diffAngleY=a},reverse:function(){cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.")},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX= this._startAngleX+this._diffAngleX*a,this.target.rotationY=this._startAngleY+this._diffAngleY*a)}});cc.rotateTo=function(a,b,c){return new cc.RotateTo(a,b,c)};cc.RotateTo.create=cc.rotateTo; cc.RotateBy=cc.ActionInterval.extend({_angleX:0,_startAngleX:0,_angleY:0,_startAngleY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._angleX=b||0,this._angleY=c||this._angleX,!0):!1},clone:function(){var a=new cc.RotateBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._angleX,this._angleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._startAngleX=a.rotationX;this._startAngleY=a.rotationY},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX=this._startAngleX+this._angleX*a,this.target.rotationY=this._startAngleY+this._angleY*a)},reverse:function(){var a=new cc.RotateBy(this._duration,-this._angleX,-this._angleY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.rotateBy=function(a,b,c){return new cc.RotateBy(a,b,c)};cc.RotateBy.create=cc.rotateBy; cc.MoveBy=cc.ActionInterval.extend({_positionDelta:null,_startPosition:null,_previousPosition:null,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._positionDelta=cc.p(0,0);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0!==b.x&&(c=b.y,b=b.x),this._positionDelta.x=b,this._positionDelta.y=c,!0):!1},clone:function(){var a= new cc.MoveBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._positionDelta);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=this._positionDelta.x*a;a*=this._positionDelta.y;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d= this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;b+=c.x;a+=c.y;f.x=b;f.y=a;this.target.setPosition(b,a)}else this.target.setPosition(c.x+b,c.y+a)}},reverse:function(){var a=new cc.MoveBy(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y));this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.moveBy=function(a,b,c){return new cc.MoveBy(a,b,c)};cc.MoveBy.create=cc.moveBy; cc.MoveTo=cc.MoveBy.extend({_endPosition:null,ctor:function(a,b,c){cc.MoveBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.MoveBy.prototype.initWithDuration.call(this,a,b,c)?(void 0!==b.x&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},clone:function(){var a=new cc.MoveTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition);return a},startWithTarget:function(a){cc.MoveBy.prototype.startWithTarget.call(this, a);this._positionDelta.x=this._endPosition.x-a.getPositionX();this._positionDelta.y=this._endPosition.y-a.getPositionY()}});cc.moveTo=function(a,b,c){return new cc.MoveTo(a,b,c)};cc.MoveTo.create=cc.moveTo; cc.SkewTo=cc.ActionInterval.extend({_skewX:0,_skewY:0,_startSkewX:0,_startSkewY:0,_endSkewX:0,_endSkewY:0,_deltaX:0,_deltaY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.ActionInterval.prototype.initWithDuration.call(this,a)&&(this._endSkewX=b,this._endSkewY=c,d=!0);return d},clone:function(){var a=new cc.SkewTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endSkewX,this._endSkewY); return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startSkewX=a.skewX%180;this._deltaX=this._endSkewX-this._startSkewX;180this._deltaX&&(this._deltaX+=360);this._startSkewY=a.skewY%360;this._deltaY=this._endSkewY-this._startSkewY;180this._deltaY&&(this._deltaY+=360)},update:function(a){a=this._computeEaseTime(a);this.target.skewX=this._startSkewX+this._deltaX*a;this.target.skewY= this._startSkewY+this._deltaY*a}});cc.skewTo=function(a,b,c){return new cc.SkewTo(a,b,c)};cc.SkewTo.create=cc.skewTo; cc.SkewBy=cc.SkewTo.extend({ctor:function(a,b,c){cc.SkewTo.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.SkewTo.prototype.initWithDuration.call(this,a,b,c)&&(this._skewX=b,this._skewY=c,d=!0);return d},clone:function(){var a=new cc.SkewBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._skewX,this._skewY);return a},startWithTarget:function(a){cc.SkewTo.prototype.startWithTarget.call(this,a);this._deltaX=this._skewX; this._deltaY=this._skewY;this._endSkewX=this._startSkewX+this._deltaX;this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var a=new cc.SkewBy(this._duration,-this._skewX,-this._skewY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.skewBy=function(a,b,c){return new cc.SkewBy(a,b,c)};cc.SkewBy.create=cc.skewBy; cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(a,b,c,d,e){cc.ActionInterval.prototype.ctor.call(this);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);this._delta=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0===e&&(e=d,d=c,c=b.y,b=b.x),this._delta.x=b,this._delta.y=c,this._height=d,this._jumps= e,!0):!1},clone:function(){var a=new cc.JumpBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._delta,this._height,this._jumps);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=a*this._jumps%1,b=4*this._height*b*(1-b),b=b+this._delta.y* a;a*=this._delta.x;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;a+=c.x;b+=c.y;f.x=a;f.y=b;this.target.setPosition(a,b)}else this.target.setPosition(c.x+a,c.y+b)}},reverse:function(){var a=new cc.JumpBy(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.jumpBy=function(a,b,c,d,e){return new cc.JumpBy(a,b,c,d,e)};cc.JumpBy.create=cc.jumpBy; cc.JumpTo=cc.JumpBy.extend({_endPosition:null,ctor:function(a,b,c,d,e){cc.JumpBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.JumpBy.prototype.initWithDuration.call(this,a,b,c,d,e)?(void 0===e&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},startWithTarget:function(a){cc.JumpBy.prototype.startWithTarget.call(this,a);this._delta.x=this._endPosition.x-this._startPosition.x;this._delta.y= this._endPosition.y-this._startPosition.y},clone:function(){var a=new cc.JumpTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition,this._height,this._jumps);return a}});cc.jumpTo=function(a,b,c,d,e){return new cc.JumpTo(a,b,c,d,e)};cc.JumpTo.create=cc.jumpTo;cc.bezierAt=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d}; cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._config=[];this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._config=b,!0):!1},clone:function(){var a=new cc.BezierBy;this._cloneDecoration(a);for(var b=[],c=0;cb/2}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._originalState=a.visible},stop:function(){this.target.visible=this._originalState;cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var a=new cc.Blink(this._duration,this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.blink=function(a,b){return new cc.Blink(a,b)};cc.Blink.create=cc.blink; cc.FadeTo=cc.ActionInterval.extend({_toOpacity:0,_fromOpacity:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toOpacity=b,!0):!1},clone:function(){var a=new cc.FadeTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},update:function(a){a=this._computeEaseTime(a);var b=void 0!==this._fromOpacity?this._fromOpacity: 255;this.target.opacity=b+(this._toOpacity-b)*a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._fromOpacity=a.opacity}});cc.fadeTo=function(a,b){return new cc.FadeTo(a,b)};cc.FadeTo.create=cc.fadeTo; cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,255)},reverse:function(){var a=new cc.FadeOut;a.initWithDuration(this._duration,0);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeIn;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},startWithTarget:function(a){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity); cc.FadeTo.prototype.startWithTarget.call(this,a)}});cc.fadeIn=function(a){return new cc.FadeIn(a)};cc.FadeIn.create=cc.fadeIn; cc.FadeOut=cc.FadeTo.extend({ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,0)},reverse:function(){var a=new cc.FadeIn;a._reverseAction=this;a.initWithDuration(this._duration,255);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeOut;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a}});cc.fadeOut=function(a){return new cc.FadeOut(a)};cc.FadeOut.create=cc.fadeOut; cc.TintTo=cc.ActionInterval.extend({_to:null,_from:null,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);this._to=cc.color(0,0,0);this._from=cc.color(0,0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=cc.color(b,c,d),!0):!1},clone:function(){var a=new cc.TintTo;this._cloneDecoration(a);var b=this._to;a.initWithDuration(this._duration,b.r,b.g,b.b);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._from=this.target.color},update:function(a){a=this._computeEaseTime(a);var b=this._from,c=this._to;b&&this.target.setColor(cc.color(b.r+(c.r-b.r)*a,b.g+(c.g-b.g)*a,b.b+(c.b-b.b)*a))}});cc.tintTo=function(a,b,c,d){return new cc.TintTo(a,b,c,d)};cc.TintTo.create=cc.tintTo; cc.TintBy=cc.ActionInterval.extend({_deltaR:0,_deltaG:0,_deltaB:0,_fromR:0,_fromG:0,_fromB:0,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._deltaR=b,this._deltaG=c,this._deltaB=d,!0):!1},clone:function(){var a=new cc.TintBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB);return a}, startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);a=a.color;this._fromR=a.r;this._fromG=a.g;this._fromB=a.b},update:function(a){a=this._computeEaseTime(a);this.target.color=cc.color(this._fromR+this._deltaR*a,this._fromG+this._deltaG*a,this._fromB+this._deltaB*a)},reverse:function(){var a=new cc.TintBy(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.tintBy=function(a,b,c,d){return new cc.TintBy(a,b,c,d)};cc.TintBy.create=cc.tintBy;cc.DelayTime=cc.ActionInterval.extend({update:function(a){},reverse:function(){var a=new cc.DelayTime(this._duration);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.DelayTime;this._cloneDecoration(a);a.initWithDuration(this._duration);return a}});cc.delayTime=function(a){return new cc.DelayTime(a)};cc.DelayTime.create=cc.delayTime; cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._other=null;a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.ReverseTime.initWithAction(): action must be non null");if(a===this._other)throw Error("cc.ReverseTime.initWithAction(): the action was already passed in.");return cc.ActionInterval.prototype.initWithDuration.call(this,a._duration)?(this._other=a,!0):!1},clone:function(){var a=new cc.ReverseTime; this._cloneDecoration(a);a.initWithAction(this._other.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._other.startWithTarget(a)},update:function(a){a=this._computeEaseTime(a);this._other&&this._other.update(1-a)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop();cc.Action.prototype.stop.call(this)}});cc.reverseTime=function(a){return new cc.ReverseTime(a)};cc.ReverseTime.create=cc.reverseTime; cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,_currFrameIndex:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._splitTimes=[];a&&this.initWithAnimation(a)},getAnimation:function(){return this._animation},setAnimation:function(a){this._animation=a},getCurrentFrameIndex:function(){return this._currFrameIndex},initWithAnimation:function(a){if(!a)throw Error("cc.Animate.initWithAnimation(): animation must be non-NULL"); var b=a.getDuration();if(this.initWithDuration(b*a.getLoops())){this._nextFrame=0;this.setAnimation(a);this._origFrame=null;this._executedLoops=0;var c=this._splitTimes,d=c.length=0,e=b/a.getTotalDelayUnits();a=a.getFrames();cc.arrayVerifyType(a,cc.AnimationFrame);for(var f=0;fa&&(a*=this._animation.getLoops(),(0|a)>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),a%=1);for(var b=this._animation.getFrames(),c=b.length,d=this._splitTimes,e=this._nextFrame;ea?this._inner.update(0.5*Math.pow(a,this._rate)):this._inner.update(1-0.5*Math.pow(2-a,this._rate))},clone:function(){var a=new cc.EaseInOut;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseInOut(this._inner.reverse(),this._rate)}}); cc.EaseInOut.create=function(a,b){return new cc.EaseInOut(a,b)};cc.easeInOut=function(a){return{_rate:a,easing:function(a){a*=2;return 1>a?0.5*Math.pow(a,this._rate):1-0.5*Math.pow(2-a,this._rate)},reverse:function(){return cc.easeInOut(this._rate)}}}; cc.EaseExponentialIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a?0:Math.pow(2,10*(a-1)))},reverse:function(){return new cc.EaseExponentialOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialIn;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialIn.create=function(a){return new cc.EaseExponentialIn(a)};cc._easeExponentialInObj={easing:function(a){return 0===a?0:Math.pow(2,10*(a-1))},reverse:function(){return cc._easeExponentialOutObj}}; cc.easeExponentialIn=function(){return cc._easeExponentialInObj};cc.EaseExponentialOut=cc.ActionEase.extend({update:function(a){this._inner.update(1===a?1:-Math.pow(2,-10*a)+1)},reverse:function(){return new cc.EaseExponentialIn(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialOut.create=function(a){return new cc.EaseExponentialOut(a)}; cc._easeExponentialOutObj={easing:function(a){return 1===a?1:-Math.pow(2,-10*a)+1},reverse:function(){return cc._easeExponentialInObj}};cc.easeExponentialOut=function(){return cc._easeExponentialOutObj}; cc.EaseExponentialInOut=cc.ActionEase.extend({update:function(a){1!==a&&0!==a&&(a*=2,a=1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2));this._inner.update(a)},reverse:function(){return new cc.EaseExponentialInOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialInOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialInOut.create=function(a){return new cc.EaseExponentialInOut(a)}; cc._easeExponentialInOutObj={easing:function(a){return 1!==a&&0!==a?(a*=2,1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)):a},reverse:function(){return cc._easeExponentialInOutObj}};cc.easeExponentialInOut=function(){return cc._easeExponentialInOutObj}; cc.EaseSineIn=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1;this._inner.update(a)},reverse:function(){return new cc.EaseSineOut(this._inner.reverse())},clone:function(){var a=new cc.EaseSineIn;a.initWithAction(this._inner.clone());return a}});cc.EaseSineIn.create=function(a){return new cc.EaseSineIn(a)};cc._easeSineInObj={easing:function(a){return 0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1},reverse:function(){return cc._easeSineOutObj}};cc.easeSineIn=function(){return cc._easeSineInObj}; cc.EaseSineOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:Math.sin(a*Math.PI/2);this._inner.update(a)},reverse:function(){return new cc.EaseSineIn(this._inner.reverse())},clone:function(){var a=new cc.EaseSineOut;a.initWithAction(this._inner.clone());return a}});cc.EaseSineOut.create=function(a){return new cc.EaseSineOut(a)};cc._easeSineOutObj={easing:function(a){return 0===a||1===a?a:Math.sin(a*Math.PI/2)},reverse:function(){return cc._easeSineInObj}};cc.easeSineOut=function(){return cc._easeSineOutObj}; cc.EaseSineInOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1);this._inner.update(a)},clone:function(){var a=new cc.EaseSineInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseSineInOut(this._inner.reverse())}});cc.EaseSineInOut.create=function(a){return new cc.EaseSineInOut(a)};cc._easeSineInOutObj={easing:function(a){return 0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1)},reverse:function(){return cc._easeSineInOutObj}}; cc.easeSineInOut=function(){return cc._easeSineInOutObj}; cc.EaseElastic=cc.ActionEase.extend({_period:0.3,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);a&&this.initWithAction(a,b)},getPeriod:function(){return this._period},setPeriod:function(a){this._period=a},initWithAction:function(a,b){cc.ActionEase.prototype.initWithAction.call(this,a);this._period=null==b?0.3:b;return!0},reverse:function(){cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");return null},clone:function(){var a=new cc.EaseElastic;a.initWithAction(this._inner.clone(), this._period);return a}});cc.EaseElastic.create=function(a,b){return new cc.EaseElastic(a,b)};cc.EaseElasticIn=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,a-=1,b=-Math.pow(2,10*a)*Math.sin((a-b)*Math.PI*2/this._period));this._inner.update(b)},reverse:function(){return new cc.EaseElasticOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticIn;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticIn.create=function(a,b){return new cc.EaseElasticIn(a,b)};cc._easeElasticInObj={easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)},reverse:function(){return cc._easeElasticOutObj}};cc.easeElasticIn=function(a){return a&&0.3!==a?{_period:a,easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-this._period/4)*Math.PI*2/this._period)},reverse:function(){return cc.easeElasticOut(this._period)}}:cc._easeElasticInObj}; cc.EaseElasticOut=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,b=Math.pow(2,-10*a)*Math.sin((a-b)*Math.PI*2/this._period)+1);this._inner.update(b)},reverse:function(){return new cc.EaseElasticIn(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticOut;a.initWithAction(this._inner.clone(),this._period);return a}});cc.EaseElasticOut.create=function(a,b){return new cc.EaseElasticOut(a,b)}; cc._easeElasticOutObj={easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)+1},reverse:function(){return cc._easeElasticInObj}};cc.easeElasticOut=function(a){return a&&0.3!==a?{_period:a,easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-this._period/4)*Math.PI*2/this._period)+1},reverse:function(){return cc.easeElasticIn(this._period)}}:cc._easeElasticOutObj}; cc.EaseElasticInOut=cc.EaseElastic.extend({update:function(a){var b=0,b=this._period;if(0===a||1===a)b=a;else{b||(b=this._period=0.3*1.5);var c=b/4;a=2*a-1;b=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-c)*Math.PI*2/b):Math.pow(2,-10*a)*Math.sin((a-c)*Math.PI*2/b)*0.5+1}this._inner.update(b)},reverse:function(){return new cc.EaseElasticInOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticInOut;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticInOut.create=function(a,b){return new cc.EaseElasticInOut(a,b)};cc.easeElasticInOut=function(a){return{_period:a||0.3,easing:function(a){var c=0,c=this._period;if(0===a||1===a)c=a;else{c||(c=this._period=0.3*1.5);var d=c/4;a=2*a-1;c=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-d)*Math.PI*2/c):Math.pow(2,-10*a)*Math.sin((a-d)*Math.PI*2/c)*0.5+1}return c},reverse:function(){return cc.easeElasticInOut(this._period)}}}; cc.EaseBounce=cc.ActionEase.extend({bounceTime:function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375},clone:function(){var a=new cc.EaseBounce;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounce(this._inner.reverse())}});cc.EaseBounce.create=function(a){return new cc.EaseBounce(a)}; cc.EaseBounceIn=cc.EaseBounce.extend({update:function(a){a=1-this.bounceTime(1-a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceIn;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceIn.create=function(a){return new cc.EaseBounceIn(a)}; cc._bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};cc._easeBounceInObj={easing:function(a){return 1-cc._bounceTime(1-a)},reverse:function(){return cc._easeBounceOutObj}};cc.easeBounceIn=function(){return cc._easeBounceInObj}; cc.EaseBounceOut=cc.EaseBounce.extend({update:function(a){a=this.bounceTime(a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceOut.create=function(a){return new cc.EaseBounceOut(a)};cc._easeBounceOutObj={easing:function(a){return cc._bounceTime(a)},reverse:function(){return cc._easeBounceInObj}};cc.easeBounceOut=function(){return cc._easeBounceOutObj}; cc.EaseBounceInOut=cc.EaseBounce.extend({update:function(a){var b=0,b=0.5>a?0.5*(1-this.bounceTime(1-2*a)):0.5*this.bounceTime(2*a-1)+0.5;this._inner.update(b)},clone:function(){var a=new cc.EaseBounceInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounceInOut(this._inner.reverse())}});cc.EaseBounceInOut.create=function(a){return new cc.EaseBounceInOut(a)}; cc._easeBounceInOutObj={easing:function(a){return a=0.5>a?0.5*(1-cc._bounceTime(1-2*a)):0.5*cc._bounceTime(2*a-1)+0.5},reverse:function(){return cc._easeBounceInOutObj}};cc.easeBounceInOut=function(){return cc._easeBounceInOutObj};cc.EaseBackIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a||1===a?a:a*a*(2.70158*a-1.70158))},reverse:function(){return new cc.EaseBackOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBackIn;a.initWithAction(this._inner.clone());return a}}); cc.EaseBackIn.create=function(a){return new cc.EaseBackIn(a)};cc._easeBackInObj={easing:function(a){return 0===a||1===a?a:a*a*(2.70158*a-1.70158)},reverse:function(){return cc._easeBackOutObj}};cc.easeBackIn=function(){return cc._easeBackInObj}; cc.EaseBackOut=cc.ActionEase.extend({update:function(a){a-=1;this._inner.update(a*a*(2.70158*a+1.70158)+1)},reverse:function(){return new cc.EaseBackIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBackOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBackOut.create=function(a){return new cc.EaseBackOut(a)};cc._easeBackOutObj={easing:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},reverse:function(){return cc._easeBackInObj}};cc.easeBackOut=function(){return cc._easeBackOutObj}; cc.EaseBackInOut=cc.ActionEase.extend({update:function(a){a*=2;1>a?this._inner.update(a*a*(3.5949095*a-2.5949095)/2):(a-=2,this._inner.update(a*a*(3.5949095*a+2.5949095)/2+1))},clone:function(){var a=new cc.EaseBackInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBackInOut(this._inner.reverse())}});cc.EaseBackInOut.create=function(a){return new cc.EaseBackInOut(a)}; cc._easeBackInOutObj={easing:function(a){a*=2;if(1>a)return a*a*(3.5949095*a-2.5949095)/2;a-=2;return a*a*(3.5949095*a+2.5949095)/2+1},reverse:function(){return cc._easeBackInOutObj}};cc.easeBackInOut=function(){return cc._easeBackInOutObj}; cc.EaseBezierAction=cc.ActionEase.extend({_p0:null,_p1:null,_p2:null,_p3:null,ctor:function(a){cc.ActionEase.prototype.ctor.call(this,a)},_updateTime:function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d},update:function(a){a=this._updateTime(this._p0,this._p1,this._p2,this._p3,a);this._inner.update(a)},clone:function(){var a=new cc.EaseBezierAction;a.initWithAction(this._inner.clone());a.setBezierParamer(this._p0,this._p1,this._p2,this._p3);return a}, reverse:function(){var a=new cc.EaseBezierAction(this._inner.reverse());a.setBezierParamer(this._p3,this._p2,this._p1,this._p0);return a},setBezierParamer:function(a,b,c,d){this._p0=a||0;this._p1=b||0;this._p2=c||0;this._p3=d||0}});cc.EaseBezierAction.create=function(a){return new cc.EaseBezierAction(a)};cc.easeBezierAction=function(a,b,c,d){return{easing:function(e){return cc.EaseBezierAction.prototype._updateTime(a,b,c,d,e)},reverse:function(){return cc.easeBezierAction(d,c,b,a)}}}; cc.EaseQuadraticActionIn=cc.ActionEase.extend({_updateTime:function(a){return Math.pow(a,2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionIn(this._inner.reverse())}});cc.EaseQuadraticActionIn.create=function(a){return new cc.EaseQuadraticActionIn(a)};cc._easeQuadraticActionIn={easing:cc.EaseQuadraticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionIn}}; cc.easeQuadraticActionIn=function(){return cc._easeQuadraticActionIn};cc.EaseQuadraticActionOut=cc.ActionEase.extend({_updateTime:function(a){return-a*(a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionOut;a.initWithAction();return a},reverse:function(){return new cc.EaseQuadraticActionOut(this._inner.reverse())}});cc.EaseQuadraticActionOut.create=function(a){return new cc.EaseQuadraticActionOut(a)}; cc._easeQuadraticActionOut={easing:cc.EaseQuadraticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionOut}};cc.easeQuadraticActionOut=function(){return cc._easeQuadraticActionOut}; cc.EaseQuadraticActionInOut=cc.ActionEase.extend({_updateTime:function(a){var b=a;a*=2;1>a?b=a*a*0.5:(--a,b=-0.5*(a*(a-2)-1));return b},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionInOut(this._inner.reverse())}});cc.EaseQuadraticActionInOut.create=function(a){return new cc.EaseQuadraticActionInOut(a)}; cc._easeQuadraticActionInOut={easing:cc.EaseQuadraticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionInOut}};cc.easeQuadraticActionInOut=function(){return cc._easeQuadraticActionInOut};cc.EaseQuarticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionIn(this._inner.reverse())}}); cc.EaseQuarticActionIn.create=function(a){return new cc.EaseQuarticActionIn(a)};cc._easeQuarticActionIn={easing:cc.EaseQuarticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuarticActionIn}};cc.easeQuarticActionIn=function(){return cc._easeQuarticActionIn}; cc.EaseQuarticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return-(a*a*a*a-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionOut(this._inner.reverse())}});cc.EaseQuarticActionOut.create=function(a){return new cc.EaseQuarticActionOut(a)};cc._easeQuarticActionOut={easing:cc.EaseQuarticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionOut}}; cc.easeQuarticActionOut=function(){return cc._easeQuarticActionOut};cc.EaseQuarticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a;a-=2;return-0.5*(a*a*a*a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionInOut(this._inner.reverse())}});cc.EaseQuarticActionInOut.create=function(a){return new cc.EaseQuarticActionInOut(a)}; cc._easeQuarticActionInOut={easing:cc.EaseQuarticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionInOut}};cc.easeQuarticActionInOut=function(){return cc._easeQuarticActionInOut};cc.EaseQuinticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionIn(this._inner.reverse())}}); cc.EaseQuinticActionIn.create=function(a){return new cc.EaseQuinticActionIn(a)};cc._easeQuinticActionIn={easing:cc.EaseQuinticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuinticActionIn}};cc.easeQuinticActionIn=function(){return cc._easeQuinticActionIn}; cc.EaseQuinticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionOut(this._inner.reverse())}});cc.EaseQuinticActionOut.create=function(a){return new cc.EaseQuinticActionOut(a)};cc._easeQuinticActionOut={easing:cc.EaseQuinticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionOut}}; cc.easeQuinticActionOut=function(){return cc._easeQuinticActionOut};cc.EaseQuinticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a*a;a-=2;return 0.5*(a*a*a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionInOut(this._inner.reverse())}});cc.EaseQuinticActionInOut.create=function(a){return new cc.EaseQuinticActionInOut(a)}; cc._easeQuinticActionInOut={easing:cc.EaseQuinticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionInOut}};cc.easeQuinticActionInOut=function(){return cc._easeQuinticActionInOut};cc.EaseCircleActionIn=cc.ActionEase.extend({_updateTime:function(a){return-1*(Math.sqrt(1-a*a)-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionIn(this._inner.reverse())}}); cc.EaseCircleActionIn.create=function(a){return new cc.EaseCircleActionIn(a)};cc._easeCircleActionIn={easing:cc.EaseCircleActionIn.prototype._updateTime,reverse:function(){return cc._easeCircleActionIn}};cc.easeCircleActionIn=function(){return cc._easeCircleActionIn}; cc.EaseCircleActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return Math.sqrt(1-a*a)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionOut(this._inner.reverse())}});cc.EaseCircleActionOut.create=function(a){return new cc.EaseCircleActionOut(a)};cc._easeCircleActionOut={easing:cc.EaseCircleActionOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionOut}}; cc.easeCircleActionOut=function(){return cc._easeCircleActionOut};cc.EaseCircleActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return-0.5*(Math.sqrt(1-a*a)-1);a-=2;return 0.5*(Math.sqrt(1-a*a)+1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionInOut(this._inner.reverse())}});cc.EaseCircleActionInOut.create=function(a){return new cc.EaseCircleActionInOut(a)}; cc._easeCircleActionInOut={easing:cc.EaseCircleActionInOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionInOut}};cc.easeCircleActionInOut=function(){return cc._easeCircleActionInOut};cc.EaseCubicActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionIn(this._inner.reverse())}}); cc.EaseCubicActionIn.create=function(a){return new cc.EaseCubicActionIn(a)};cc._easeCubicActionIn={easing:cc.EaseCubicActionIn.prototype._updateTime,reverse:function(){return cc._easeCubicActionIn}};cc.easeCubicActionIn=function(){return cc._easeCubicActionIn}; cc.EaseCubicActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionOut(this._inner.reverse())}});cc.EaseCubicActionOut.create=function(a){return new cc.EaseCubicActionOut(a)};cc._easeCubicActionOut={easing:cc.EaseCubicActionOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionOut}}; cc.easeCubicActionOut=function(){return cc._easeCubicActionOut};cc.EaseCubicActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a;a-=2;return 0.5*(a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionInOut(this._inner.reverse())}});cc.EaseCubicActionInOut.create=function(a){return new cc.EaseCubicActionInOut(a)}; cc._easeCubicActionInOut={easing:cc.EaseCubicActionInOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionInOut}};cc.easeCubicActionInOut=function(){return cc._easeCubicActionInOut};cc.cardinalSplineAt=function(a,b,c,d,e,f,g){var h=f*f,k=h*f,m=(1-e)/2;e=m*(-k+2*h-f);var n=m*(-k+h)+(2*k-3*h+1);f=m*(k-2*h+f)+(-2*k+3*h);k=m*(k-h);h=a.x*e+b.x*n+c.x*f+d.x*k;a=a.y*e+b.y*n+c.y*f+d.y*k;if(void 0!==g)g.x=h,g.y=a;else return cc.p(h,a)};cc.reverseControlPoints=function(a){for(var b=[],c=a.length-1;0<=c;c--)b.push(cc.p(a[c].x,a[c].y));return b};cc.cloneControlPoints=function(a){for(var b=[],c=0;cg?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(h=cc.p(0,0),k=cc.p(0,1),e=cc.p(1,0),d=cc.p(1,1),f=g);b.x=f-f*c;b.z=Math.abs(parseFloat(f*a/4));a=this.originalVertex(e);a.x=b.x;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.x=b.x;a.z+=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.x-=b.x;a.z-=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.x-=b.x;a.z-=b.z;this.setVertex(k, a)}});cc.flipX3D=function(a){return new cc.FlipX3D(a)};cc.FlipX3D.create=cc.flipX3D; cc.FlipY3D=cc.FlipX3D.extend({ctor:function(a){void 0!==a?cc.GridAction.prototype.ctor.call(this,a,cc.size(1,1)):cc.GridAction.prototype.ctor.call(this)},update:function(a){var b=Math.PI*a;a=Math.sin(b);var c=Math.cos(b/2),b=new cc.Vertex3F,d=cc.p(0,0);d.x=d.y=1;var e=this.originalVertex(d);d.x=d.y=0;var d=this.originalVertex(d),f=e.y,g=d.y,h,k;f>g?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(d=cc.p(0,0),e=cc.p(0,1),k=cc.p(1,0),h=cc.p(1,1),f=g);b.y=f-f*c;b.z=Math.abs(parseFloat(f*a)/4);a=this.originalVertex(e); a.y=b.y;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.y-=b.y;a.z-=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.y=b.y;a.z+=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.y-=b.y;a.z-=b.z;this.setVertex(k,a)}});cc.flipY3D=function(a){return new cc.FlipY3D(a)};cc.FlipY3D.create=cc.flipY3D; cc.Lens3D=cc.Grid3DAction.extend({_position:null,_radius:0,_lensEffect:0,_concave:!1,_dirty:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},getLensEffect:function(){return this._lensEffect},setLensEffect:function(a){this._lensEffect=a},setConcave:function(a){this._concave=a},getPosition:function(){return this._position},setPosition:function(a){cc.pointEqualToPoint(a,this._position)||(this._position.x=a.x,this._position.y= a.y,this._dirty=!0)},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._radius=d,this._lensEffect=0.7,this._dirty=!0):!1},update:function(a){if(this._dirty){a=this._gridSize.width;for(var b=this._gridSize.height,c=this._radius,d=this._lensEffect,e=cc.p(0,0),f=cc.p(0,0),g,h,k,m=0;md?this.transformTile(c,d):this.turnOnTile(c)}});cc.fadeOutTRTiles=function(a,b){return new cc.FadeOutTRTiles(a,b)};cc.FadeOutTRTiles.create=cc.fadeOutTRTiles; cc.FadeOutBLTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){var c=this._gridSize.width*(1-b),d=this._gridSize.height*(1-b);return 0===c+d?0:0===a.x+a.y?1:Math.pow((c+d)/(a.x+a.y),6)}});cc.fadeOutBLTiles=function(a,b){return new cc.FadeOutBLTiles(a,b)};cc.FadeOutBLTiles.create=cc.fadeOutBLTiles; cc.FadeOutUpTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){var c=this._gridSize.height*b;return c===this._gridSize.height?0:0===c?1:Math.pow(a.y/c,6)},transformTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep();c.bl.y+=d.y/2*(1-b);c.br.y+=d.y/2*(1-b);c.tl.y-=d.y/2*(1-b);c.tr.y-=d.y/2*(1-b);this.setTile(a,c)}});cc.fadeOutUpTiles=function(a,b){return new cc.FadeOutUpTiles(a,b)};cc.FadeOutUpTiles.create=cc.fadeOutUpTiles; cc.FadeOutDownTiles=cc.FadeOutUpTiles.extend({testFunc:function(a,b){var c=this._gridSize.height*(1-b);return 0===c?0:0===a.y?1:Math.pow(c/a.y,6)}});cc.fadeOutDownTiles=function(a,b){return new cc.FadeOutDownTiles(a,b)};cc.FadeOutDownTiles.create=cc.fadeOutDownTiles; cc.TurnOffTiles=cc.TiledGrid3DAction.extend({_seed:null,_tilesCount:0,_tilesOrder:null,ctor:function(a,b,c){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._seed=c||0,this._tilesOrder.length=0,!0):!1},shuffle:function(a,b){for(var c=b-1;0<=c;c--){var d=0|cc.rand()%(c+1),e=a[c];a[c]=a[d];a[d]=e}},turnOnTile:function(a){this.setTile(a,this.originalTile(a))}, turnOffTile:function(a){this.setTile(a,new cc.Quad3)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._tilesCount=this._gridSize.width*this._gridSize.height;a=this._tilesOrder;for(var b=a.length=0;bk.z&&(k.z=0.5);k.x+=this.getGridRect().x;this.setVertex(f,k)}}});cc.pageTurn3D=function(a,b){return new cc.PageTurn3D(a,b)};cc.PageTurn3D.create=cc.pageTurn3D;cc.ProgressTimer=cc.Node.extend({_type:null,_percentage:0,_sprite:null,_midPoint:null,_barChangeRate:null,_reverseDirection:!1,_className:"ProgressTimer",ctor:function(a){cc.Node.prototype.ctor.call(this);this._type=cc.ProgressTimer.TYPE_RADIAL;this._percentage=0;this._midPoint=cc.p(0,0);this._barChangeRate=cc.p(0,0);this._reverseDirection=!1;this._sprite=null;a&&this.initWithSprite(a)},onEnter:function(){this._super();cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._renderCmd.initCmd(),this._renderCmd._updateProgress())}, cleanup:function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&this._renderCmd.releaseData();this._super()},getMidpoint:function(){return cc.p(this._midPoint.x,this._midPoint.y)},setMidpoint:function(a){this._midPoint=cc.pClamp(a,cc.p(0,0),cc.p(1,1))},getBarChangeRate:function(){return cc.p(this._barChangeRate.x,this._barChangeRate.y)},setBarChangeRate:function(a){this._barChangeRate=cc.pClamp(a,cc.p(0,0),cc.p(1,1))},getType:function(){return this._type},getPercentage:function(){return this._percentage}, getSprite:function(){return this._sprite},setPercentage:function(a){this._percentage!==a&&(this._percentage=cc.clampf(a,0,100),this._renderCmd._updateProgress())},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isReverseDirection:function(){return this._reverseDirection},setColor:function(a){this._sprite.color=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},setOpacity:function(a){this._sprite.opacity=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)}, getColor:function(){return this._sprite.color},getOpacity:function(){return this._sprite.opacity},setReverseProgress:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._renderCmd.resetVertexData())},setSprite:function(a){this._sprite!==a&&((this._sprite=a)?(this.setContentSize(a.width,a.height),a.ignoreAnchorPointForPosition(!0)):this.setContentSize(0,0),this._renderCmd.resetVertexData())},setType:function(a){a!==this._type&&(this._type=a,this._renderCmd.resetVertexData())},setReverseDirection:function(a){this._reverseDirection!== a&&(this._reverseDirection=a,this._renderCmd.resetVertexData())},initWithSprite:function(a){this.percentage=0;this.setAnchorPoint(0.5,0.5);this._type=cc.ProgressTimer.TYPE_RADIAL;this._reverseDirection=!1;this.midPoint=cc.p(0.5,0.5);this.barChangeRate=cc.p(1,1);this.setSprite(a);this._renderCmd.resetVertexData();return!0},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ProgressTimer.CanvasRenderCmd(this):new cc.ProgressTimer.WebGLRenderCmd(this)}});_p=cc.ProgressTimer.prototype; cc.defineGetterSetter(_p,"midPoint",_p.getMidpoint,_p.setMidpoint);cc.defineGetterSetter(_p,"barChangeRate",_p.getBarChangeRate,_p.setBarChangeRate);cc.defineGetterSetter(_p,"type",_p.getType,_p.setType);cc.defineGetterSetter(_p,"percentage",_p.getPercentage,_p.setPercentage);cc.defineGetterSetter(_p,"sprite",_p.getSprite,_p.setSprite);cc.defineGetterSetter(_p,"reverseDir",_p.isReverseDirection,_p.setReverseDirection);cc.ProgressTimer.create=function(a){return new cc.ProgressTimer(a)}; cc.ProgressTimer.TEXTURE_COORDS_COUNT=4;cc.ProgressTimer.TEXTURE_COORDS=75;cc.ProgressTimer.TYPE_RADIAL=0;cc.ProgressTimer.TYPE_BAR=1;cc.ProgressTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0;void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=b,!0):!1},clone:function(){var a=new cc.ProgressTo;a.initWithDuration(this._duration,this._to);return a},reverse:function(){cc.log("cc.ProgressTo.reverse(): reverse hasn't been supported.");return null},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._from=a.percentage},update:function(a){this.target instanceof cc.ProgressTimer&&(this.target.percentage=this._from+(this._to-this._from)*a)}});cc.progressTo=function(a,b){return new cc.ProgressTo(a,b)};cc.ProgressTo.create=cc.progressTo; cc.ProgressFromTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0;void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=c,this._from=b,!0):!1},clone:function(){var a=new cc.ProgressFromTo;a.initWithDuration(this._duration,this._from,this._to);return a},reverse:function(){return cc.progressFromTo(this._duration,this._to,this._from)}, startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a)},update:function(a){this.target instanceof cc.ProgressTimer&&(this.target.percentage=this._from+(this._to-this._from)*a)}});cc.progressFromTo=function(a,b,c){return new cc.ProgressFromTo(a,b,c)};cc.ProgressFromTo.create=cc.progressFromTo;(function(){cc.ProgressTimer.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._PI180=Math.PI/180;this._barRect=cc.rect(0,0,0,0);this._origin=cc.p(0,0);this._radius=0;this._endAngle=this._startAngle=270;this._counterClockWise=!1;this._canUseDirtyRegion=!0};var a=cc.ProgressTimer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ProgressTimer.CanvasRenderCmd;a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),f=this._node, g=f._sprite,h=g._renderCmd._textureCoord,k=g._renderCmd._displayedOpacity/255;if(0!==h.width&&0!==h.height&&g._texture&&h.validRect&&0!==k){a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(g._blendFuncStr);a.setGlobalAlpha(k);var m=g._rect,n=g._offsetPosition;c=n.x;d=-n.y-m.height;k=m.width;m=m.height;a.save();g._flippedX&&(c=-c-k,e.scale(-1,1));g._flippedY&&(d=n.y,e.scale(1,-1));f._type===cc.ProgressTimer.TYPE_BAR?(f=this._barRect,e.beginPath(),e.rect(f.x,f.y,f.width,f.height),e.clip(), e.closePath()):f._type===cc.ProgressTimer.TYPE_RADIAL&&(f=this._origin.x,n=this._origin.y,e.beginPath(),e.arc(f,n,this._radius,this._PI180*this._startAngle,this._PI180*this._endAngle,this._counterClockWise),e.lineTo(f,n),e.clip(),e.closePath());f=(g._renderCmd._textureToRender||g._texture).getHtmlElementObj();g._renderCmd._colorized?e.drawImage(f,0,0,h.width,h.height,c,d,k,m):e.drawImage(f,h.renderX,h.renderY,h.width,h.height,c,d,k,m);a.restore();cc.g_NumberOfDraws++}};a.releaseData=function(){}; a.resetVertexData=function(){};a._updateProgress=function(){this.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);var a=this._node,c=a._sprite,d=c.width,e=c.height,f=a._midPoint;if(a._type===cc.ProgressTimer.TYPE_RADIAL){this._radius=Math.round(Math.sqrt(d*d+e*e));var g,h=!1,k=this._origin;k.x=d*f.x;k.y=-e*f.y;a._reverseDirection?(g=270,f=270-3.6*a._percentage):(f=-90,g=-90+3.6*a._percentage);c._flippedX&&(k.x-=2*d*a._midPoint.x,f=-f-180,g=-g-180,h=!h);c._flippedY&&(k.y+=2*e*a._midPoint.y,h=!h,f=-f, g=-g);this._startAngle=f;this._endAngle=g;this._counterClockWise=h}else h=a._barChangeRate,k=a._percentage/100,a=this._barRect,h=cc.size(d*(1-h.x),e*(1-h.y)),k=cc.size((d-h.width)*k,(e-h.height)*k),h=cc.size(h.width+k.width,h.height+k.height),g=cc.p(d*f.x,e*f.y),k=g.x-h.width/2,0.5=d-g.x&&(k=d-h.width),d=g.y-h.height/2,0.5=e-g.y&&(d=e-h.height),a.x=0,e=1,c._flippedX&&(a.x-=h.width,e=-1),0c;c++)this._vertexData[c]=new cc.V3F_C4B_T2F(null,null,null,this._vertexArrayBuffer,c*a);gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexWebGLBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._float32View, gl.DYNAMIC_DRAW);this._vertexDataCount=0;this._vertexDataDirty=!0;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)}};a.resetVertexData=function(){this._vertexDataCount=0};a._updateProgressData=function(){var a=this._node._type;a===cc.ProgressTimer.TYPE_RADIAL?this._updateRadial():a===cc.ProgressTimer.TYPE_BAR&&this._updateBar();this._vertexDataDirty=!0};a._updateProgress=function(){this.setDirtyFlag(cc.Node._dirtyFlags.textureDirty)};a._updateBar=function(){var a= this._node;if(a._sprite){var c=a._percentage/100,d=a._barChangeRate,d=cc.pMult(cc.p(1-d.x+c*d.x,1-d.y+c*d.y),0.5),c=cc.pSub(a._midPoint,d),a=cc.pAdd(a._midPoint,d);0>c.x&&(a.x+=-c.x,c.x=0);1c.y&&(a.y+=-c.y,c.y=0);1=n.x)&&0<=n.y&&n.y>7-(a<<1)&1,c>>7-((a<<1)+1)&1):cc.p(c>>(a<<1)+1&1,c>>(a<<1)&1)}return cc.p(0,0)};a._textureCoordFromAlphaPoint=function(a,c,d){var e=this._node._sprite;if(e){var f=e._renderCmd._vertices,g=f[1],f=f[2],g=cc.p(g.u,g.v),f=cc.p(f.u,f.v);e.textureRectRotated&&(e=c,c=d,d=e);a.u=g.x*(1-c)+f.x*c;a.v=g.y*(1-d)+f.y*d}else a.u=0,a.v=0};a._vertexFromAlphaPoint=function(a,c,d){a.x=this._bl.x*(1-c)+this._tr.x*c;a.y=this._bl.y*(1-d)+this._tr.y* d;a.z=this._node._vertexZ};a._updateColor=function(){var a=this._node._sprite;if(this._vertexDataCount&&a){var c=this._displayedColor,d=a._renderCmd._displayedColor,e=d.r,f=d.g,d=d.b,g=a._renderCmd._displayedOpacity/255;a._opacityModifyRGB&&(e*=g,f*=g,d*=g);c.r=e;c.g=f;c.b=d;c.a=a._renderCmd._displayedOpacity;a=this._vertexData;e=0;for(f=this._vertexDataCount;ea.height?(a=16,b=12):(a=12,b=16);a=this.actionWithSize(cc.size(a,b));b=this._gridProxy;this._back?(b.setTarget(this._inScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),this._inScene.visible=!1,b.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid())),this._inScene.runAction(cc.show())):(b.setTarget(this._outScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),b.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid())))}, visit:function(){this._back?this._outScene.visit():this._inScene.visit();this._gridProxy.visit()},_sceneOrder:function(){this._isInSceneOnTop=this._back}});cc.TransitionPageTurn.create=function(a,b,c){return new cc.TransitionPageTurn(a,b,c)};cc.Codec={name:"Jacob__Codec"};cc.unzip=function(){return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,arguments)};cc.unzipBase64=function(){var a=cc.Codec.Base64.decode.apply(cc.Codec.Base64,arguments);return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,[a])};cc.unzipBase64AsArray=function(a,b){b=b||1;var c=this.unzipBase64(a),d=[],e,f,g;e=0;for(g=c.length/b;e>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,b.push(String.fromCharCode(c)),64!==f&&b.push(String.fromCharCode(d)),64!==g&&b.push(String.fromCharCode(e));return b=b.join("")}; cc.Codec.Base64.decodeAsArray=function(a,b){var c=this.decode(a),d=[],e,f,g;e=0;for(g=c.length/b;ea;++a)e.push(String.fromCharCode(this.data[this.pos++]));a=e.join("");switch(a){case "IHDR":this.width=this.readUInt32();this.height=this.readUInt32();this.bits=this.data[this.pos++];this.colorType=this.data[this.pos++];this.compressionMethod=this.data[this.pos++];this.filterMethod= this.data[this.pos++];this.interlaceMethod=this.data[this.pos++];break;case "acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||Infinity,frames:[]};break;case "PLTE":this.palette=this.read(b);break;case "fcTL":d&&this.animation.frames.push(d);this.pos+=4;d={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};a=this.readUInt16();b=this.readUInt16()||100;d.delay=1E3*a/b;d.disposeOp=this.data[this.pos++];d.blendOp=this.data[this.pos++]; d.data=[];break;case "IDAT":case "fdAT":"fdAT"===a&&(this.pos+=4,b-=4);a=(null!=d?d.data:void 0)||this.imgData;for(e=0;0<=b?eb;0<=b?++e:--e)a.push(this.data[this.pos++]);break;case "tRNS":this.transparency={};switch(this.colorType){case 3:this.transparency.indexed=this.read(b);b=255-this.transparency.indexed.length;if(0b;0<=b?++a:--a)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(b)[0];break;case 2:this.transparency.rgb=this.read(b)}break; case "tEXt":e=this.read(b);b=e.indexOf(0);a=String.fromCharCode.apply(String,e.slice(0,b));this.text[a]=String.fromCharCode.apply(String,e.slice(b+1));break;case "IEND":d&&this.animation.frames.push(d);a:{switch(this.colorType){case 0:case 3:case 4:d=1;break a;case 2:case 6:d=3;break a}d=void 0}this.colors=d;this.hasAlphaChannel=4===(c=this.colorType)||6===c;c=this.colors+(this.hasAlphaChannel?1:0);this.pixelBitlength=this.bits*c;a:{switch(this.colors){case 1:c="DeviceGray";break a;case 3:c="DeviceRGB"; break a}c=void 0}this.colorSpace=c;Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData));return;default:this.pos+=b}this.pos+=4;if(this.pos>this.data.length)throw Error("Incomplete or corrupt PNG file");}},read:function(a){var b,c;c=[];for(b=0;0<=a?ba;0<=a?++b:--b)c.push(this.data[this.pos++]);return c},readUInt32:function(){var a,b,c,d;a=this.data[this.pos++]<<24;b=this.data[this.pos++]<<16;c=this.data[this.pos++]<<8;d=this.data[this.pos++];return a|b|c|d},readUInt16:function(){var a, b;a=this.data[this.pos++]<<8;b=this.data[this.pos++];return a|b},decodePixels:function(a){var b,c,d,e,f,g,h,k,m,n,p,r,s,v,u;null==a&&(a=this.imgData);if(0===a.length)return new Uint8Array(0);a=(new Zlib.Inflate(a,{index:0,verify:!1})).decompress();k=this.pixelBitlength/8;r=k*this.width;m=new Uint8Array(r*this.height);g=a.length;for(c=n=p=0;n=e*c)!1===this.littleEndian?a.push(d>>>8*(4-e)):a.push(d);else for(var f=0;f=a)cc.log("No bytes requested");else{if(1>=a)return this.getUint8(b);if(2>=a)return this.getUint16(b);if(3>=a)return this.getUint32(b)>>>8;if(4>=a)return this.getUint32(b);cc.log("Too many bytes requested")}},getBits:function(a,b,c){c=c||0;b+=Math.floor(c/8);var d=c+a;a=32-a;var e,f;0>=d?console.log("No bits requested"):8>=d?(e=24+c,f=this.getUint8(b)):16>=d?(e=16+c,f=this.getUint16(b)):32>=d?(e=c,f=this.getUint32(b)):console.log("Too many bits requested"); return{bits:f<>>a,byteOffset:b+Math.floor(d/8),bitOffset:d%8}},parseFileDirectory:function(a){var b=this.getUint16(a),c=[];a+=2;for(var d=0;d=A?G=A+1:-127<=A&&-1>=A?K=-A+1:y=!0}else{for(var H=this.getUint8(x+t),A=0;A= this._totalParticles},updateQuadWithParticle:function(a,b){this._renderCmd.updateQuadWithParticle(a,b)},postStep:function(){this._renderCmd.postStep()},update:function(a){if(this._isActive&&this.emissionRate){var b=1/this.emissionRate;this.particleCountb;)this.addParticle(),this._emitCounter-=b;this._elapsed+=a;-1!==this.duration&&this.durationa?a:200};a.addParticle=function(){var a=this._node,c=a._particles;a.particleCountc._allocatedParticles){var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._indices=new Uint16Array(6*a);var e=new ArrayBuffer(a*d),f=c._particles;f.length=0;for(var g=this._quads, h=g.length=0;hd.getCapacity()&&(this._increaseAtlasCapacityTo(e+c),d.fillWithEmptyQuadsFromIndex(d.getCapacity()-c,c));a.getAtlasIndex()+c!==e&&d.moveQuadsFromIndex(b,b+c);d.increaseTotalQuadsWith(c);this._updateAllAtlasIndexes()},removeChild:function(a, b){if(null!=a){if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.removeChild(): only supports cc.ParticleSystem as children");if(-1===this._children.indexOf(a))cc.log("cc.ParticleBatchNode.removeChild(): doesn't contain the sprite. Can't remove it");else{cc.Node.prototype.removeChild.call(this,a,b);var c=this.textureAtlas;c.removeQuadsAtIndex(a.getAtlasIndex(),a.getTotalParticles());c.fillWithEmptyQuadsFromIndex(c.totalQuads,a.getTotalParticles());a.setBatchNode(null);this._updateAllAtlasIndexes()}}}, reorderChild:function(a,b){if(!a)throw Error("cc.ParticleBatchNode.reorderChild(): child should be non-null");if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.reorderChild(): only supports cc.QuadParticleSystems as children");if(-1===this._children.indexOf(a))cc.log("cc.ParticleBatchNode.reorderChild(): Child doesn't belong to batch");else{if(1a)return d;return c},_getCurrentIndex:function(a,b){for(var c=!1,d=!1,e=0,f=0,g=0,h=this._children,k=h.length,m=0;mb&&!d&&(e=m,d=!0,c&&d))break;if(a===n&&(f=m,c=!0,d||(g=-1),c&&d))break}d||(e=k);return{newIndex:e+g,oldIndex:f}},_addChildHelper:function(a, b,c){if(!a)throw Error("cc.ParticleBatchNode._addChildHelper(): child should be non-null");if(a.parent)return cc.log("cc.ParticleBatchNode._addChildHelper(): child already added. It can't be added again"),null;this._children||(this._children=[]);var d=this._searchNewPositionInChildrenForZ(b);this._children.splice(d,0,a);a.tag=c;a._setLocalZOrder(b);a.parent=this;this._running&&(a._performRecursive(cc.Node._stateCallbackType.onEnter),a._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)); return d},_updateBlendFunc:function(){this.textureAtlas.texture.hasPremultipliedAlpha()||(this._blendFunc.src=cc.SRC_ALPHA,this._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA)},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){this.textureAtlas=a}});_p=cc.ParticleBatchNode.prototype;cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);cc.ParticleBatchNode.create=function(a,b){return new cc.ParticleBatchNode(a,b)};(function(){cc.ParticleBatchNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=cc.ParticleBatchNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ParticleBatchNode.CanvasRenderCmd;a._initWithTexture=function(){}})();(function(){cc.ParticleBatchNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity()};var a=cc.ParticleBatchNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParticleBatchNode.WebGLRenderCmd;a.rendering=function(a){a=this._node;if(0!==a.textureAtlas.totalQuads){var c=this._worldTransform;this._matrix.mat[0]=c.a;this._matrix.mat[4]=c.c;this._matrix.mat[12]=c.tx;this._matrix.mat[1]=c.b;this._matrix.mat[5]= c.d;this._matrix.mat[13]=c.ty;this._glProgramState.apply(this._matrix);cc.glBlendFuncForParticle(a._blendFunc.src,a._blendFunc.dst);a.textureAtlas.drawQuads()}};a._initWithTexture=function(){this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)}})();cc.IMEKeyboardNotificationInfo=function(a,b,c){this.begin=a||cc.rect(0,0,0,0);this.end=b||cc.rect(0,0,0,0);this.duration=c||0}; cc.IMEDelegate=cc.Class.extend({ctor:function(){cc.imeDispatcher.addDelegate(this)},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},attachWithIME:function(){return cc.imeDispatcher.attachDelegateWithIME(this)},detachWithIME:function(){return cc.imeDispatcher.detachDelegateWithIME(this)},canAttachWithIME:function(){return!1},didAttachWithIME:function(){},canDetachWithIME:function(){return!1},didDetachWithIME:function(){},insertText:function(a,b){},deleteBackward:function(){},getContentText:function(){return""}, keyboardWillShow:function(a){},keyboardDidShow:function(a){},keyboardWillHide:function(a){},keyboardDidHide:function(a){}}); cc.IMEDispatcher=cc.Class.extend({_domInputControl:null,impl:null,_currentInputString:"",_lastClickPosition:null,ctor:function(){this.impl=new cc.IMEDispatcher.Impl;this._lastClickPosition=cc.p(0,0)},init:function(){if(!cc.sys.isMobile){this._domInputControl=cc.$("#imeDispatcherInput");this._domInputControl||(this._domInputControl=cc.$new("input"),this._domInputControl.setAttribute("type","text"),this._domInputControl.setAttribute("id","imeDispatcherInput"),this._domInputControl.resize(0,0),this._domInputControl.translates(0, 0),this._domInputControl.style.opacity="0",this._domInputControl.style.fontSize="1px",this._domInputControl.setAttribute("tabindex",2),this._domInputControl.style.position="absolute",this._domInputControl.style.top=0,this._domInputControl.style.left=0,document.body.appendChild(this._domInputControl));var a=this;this._domInputControl.addEventListener("input",function(){a._processDomInputString(a._domInputControl.value)},!1);this._domInputControl.addEventListener("keydown",function(b){b.keyCode===cc.KEY.tab? (b.stopPropagation(),b.preventDefault()):b.keyCode===cc.KEY.enter&&(a.dispatchInsertText("\n",1),b.stopPropagation(),b.preventDefault())},!1);/msie/i.test(navigator.userAgent)&&this._domInputControl.addEventListener("keyup",function(b){b.keyCode===cc.KEY.backspace&&a._processDomInputString(a._domInputControl.value)},!1);window.addEventListener("mousedown",function(b){var c=b.pageY||0;a._lastClickPosition.x=b.pageX||0;a._lastClickPosition.y=c},!1)}},_processDomInputString:function(a){var b,c;b=this._currentInputString.length< a.length?this._currentInputString.length:a.length;for(c=0;c=b||this.impl._delegateWithIme&&this.impl._delegateWithIme.insertText(a,b)},dispatchDeleteBackward:function(){this.impl&&this.impl._delegateWithIme&&this.impl._delegateWithIme.deleteBackward()}, getContentText:function(){if(this.impl&&this.impl._delegateWithIme){var a=this.impl._delegateWithIme.getContentText();return a?a:""}return""},dispatchKeyboardWillShow:function(a){if(this.impl)for(var b=0;ba?a===cc.KEY.backspace?this.dispatchDeleteBackward():a===cc.KEY.enter&&this.dispatchInsertText("\n",1):255>a&&this.dispatchInsertText(String.fromCharCode(a),1)}});cc.IMEDispatcher.Impl=cc.Class.extend({_delegateWithIme:null,_delegateList:null,ctor:function(){this._delegateList=[]},findDelegate:function(a){for(var b=0;b=a?(this._inputText="",this._charCount=0,cc.LabelTTF.prototype.setString.call(this,this._placeHolder),this.setColor(this.colorSpaceHolder)):this.string= this._inputText.substring(0,a-1))},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},_tipMessage:"please enter your word:",setTipMessage:function(a){null!=a&&(this._tipMessage=a)},getTipMessage:function(){return this._tipMessage},insertText:function(a,b){var c=a,d=c.indexOf("\n");-1=b.length||!(g=b[d])||(h=m[a].height,e=e>=h||isNaN(h)?e:h,++f,f>=g&&(c+=e+5,e=f=0,++d));var n=cc.director.getWinSize(),p=g=e=d=0,r=0,c=c/2;if(m&&0=h||isNaN(h)?e:h;s.setPosition(r-n.width/2,c-h/2);r+=p;++f;f>=g&&(c-=e+5,e=g=f=0,++d)}},alignItemsInRows:function(){0< arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");var a,b=[];for(a=0;a=b.length||!(m=b[g]))||(r=n.width,h=h>=r||isNaN(r)?h:r,f+=n.height+5,++k,k>=m&&(c.push(h),d.push(f),e+=h+10,h=k=0,f=-5,++g));f=cc.director.getWinSize();m=h=g=0;var e=-e/2,v=0;if(s&&0=r||isNaN(r)?h:r,n.setPosition(e+c[g]/2,v-f.height/2),v-=n.height+10,++k,k>=m&&(e+=h+5,h=m=k=0,++g)},removeChild:function(a,b){null!=a&&(a instanceof cc.MenuItem?(this._selectedItem===a&&(this._selectedItem=null),cc.Node.prototype.removeChild.call(this,a,b)):cc.log("cc.Menu.removeChild():Menu only supports MenuItem objects as children"))},_onTouchBegan:function(a,b){var c=b.getCurrentTarget();if(c._state!==cc.MENU_STATE_WAITING||!c._visible|| !c.enabled)return!1;for(var d=c.parent;null!=d;d=d.parent)if(!d.isVisible())return!1;c._selectedItem=c._itemForTouch(a);return c._selectedItem?(c._state=cc.MENU_STATE_TRACKING_TOUCH,c._selectedItem.selected(),c._selectedItem.setNodeDirty(),!0):!1},_onTouchEnded:function(a,b){var c=b.getCurrentTarget();c._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchEnded(): invalid state"):(c._selectedItem&&(c._selectedItem.unselected(),c._selectedItem.setNodeDirty(),c._selectedItem.activate()),c._state= cc.MENU_STATE_WAITING)},_onTouchCancelled:function(a,b){var c=b.getCurrentTarget();c._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchCancelled(): invalid state"):(c._selectedItem&&(c._selectedItem.unselected(),c._selectedItem.setNodeDirty()),c._state=cc.MENU_STATE_WAITING)},_onTouchMoved:function(a,b){var c=b.getCurrentTarget();if(c._state!==cc.MENU_STATE_TRACKING_TOUCH)cc.log("cc.Menu.onTouchMoved(): invalid state");else{var d=c._itemForTouch(a);d!==c._selectedItem&&(c._selectedItem&& (c._selectedItem.unselected(),c._selectedItem.setNodeDirty()),c._selectedItem=d,c._selectedItem&&(c._selectedItem.selected(),c._selectedItem.setNodeDirty()))}},onExit:function(){this._state===cc.MENU_STATE_TRACKING_TOUCH&&(this._selectedItem&&(this._selectedItem.unselected(),this._selectedItem=null),this._state=cc.MENU_STATE_WAITING);cc.Node.prototype.onExit.call(this)},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_itemForTouch:function(a){a=a.getLocation();var b=this._children, c;if(b&&0>=1;0===this.bb&&(this.bb=this.readByte(),a=this.bb&1,this.bb=this.bb>>1|128);return a}; cc.Codec.GZip.prototype.readBits=function(a){for(var b=0,c=a;c--;)b=b<<1|this.readBit();a&&(b=cc.Codec.GZip.bitReverse[b]>>8-a);return b};cc.Codec.GZip.prototype.flushBuffer=function(){this.bIdx=0};cc.Codec.GZip.prototype.addBuffer=function(a){this.buf32k[this.bIdx++]=a;this.outputArr.push(String.fromCharCode(a));32768===this.bIdx&&(this.bIdx=0)}; cc.Codec.GZip.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}}; cc.Codec.GZip.prototype.Rec=function(){var a=this.Places[this.treepos],b;if(17===this.len)return-1;this.treepos++;this.len++;b=this.IsPat();if(0<=b)a.b0=b;else if(a.b0=32768,this.Rec())return-1;b=this.IsPat();if(0<=b)a.b1=b,a.jump=null;else if(a.b1=32768,a.jump=this.Places[this.treepos],a.jumppos=this.treepos,this.Rec())return-1;this.len--;return 0}; cc.Codec.GZip.prototype.CreateTree=function(a,b,c,d){this.Places=a;this.treepos=0;this.flens=c;this.fmax=b;for(a=0;17>a;a++)this.fpos[a]=0;this.len=0;return this.Rec()?-1:0};cc.Codec.GZip.prototype.DecodeValue=function(a){for(var b,c,d=0,e=a[d];;)if(b=this.readBit()){if(!(e.b1&32768))return e.b1;e=e.jump;b=a.length;for(c=0;c>1,23c)this.addBuffer(c); else if(256===c)break;else{var f;c-=257;e=this.readBits(cc.Codec.GZip.cplext[c])+cc.Codec.GZip.cplens[c];c=cc.Codec.GZip.bitReverse[this.readBits(5)]>>3;8c;c++)g[c]= 0;for(c=0;cc)g[d++]=c;else if(16===c){var k;c=3+this.readBits(2);if(d+c>e)return this.flushBuffer(),1;for(k=d?g[d-1]:0;c--;)g[d++]=k}else{c=17===c?3+this.readBits(3):11+this.readBits(7);if(d+c>e)return this.flushBuffer(), 1;for(;c--;)g[d++]=0}e=this.literalTree.length;for(d=0;d>>0}b=1;c=0;for(var d=a.length,e,f=0;0>>0}function d(b,c){this.index="number"===typeof c?c:0; this.i=0;this.buffer=b instanceof(y?Uint8Array:Array)?b:new (y?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&a(Error("invalid index"));this.buffer.length<=this.index&&this.f()}function e(a){this.buffer=new (y?Uint16Array:Array)(2*a);this.length=0}function f(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,h,k,m,n,p,s;for(p=0;pc&&(c=a[p]),a[p]>=1;for(s=m;s=b:return[265,b-11,1];case 14>=b:return[266,b-13,1];case 16>=b:return[267,b-15,1];case 18>=b:return[268,b-17,1];case 22>=b:return[269,b-19,2];case 26>=b:return[270,b-23,2];case 30>=b:return[271,b-27,2];case 34>=b:return[272,b-31,2];case 42>=b:return[273,b-35,3];case 50>= b:return[274,b-43,3];case 58>=b:return[275,b-51,3];case 66>=b:return[276,b-59,3];case 82>=b:return[277,b-67,4];case 98>=b:return[278,b-83,4];case 114>=b:return[279,b-99,4];case 130>=b:return[280,b-115,4];case 162>=b:return[281,b-131,5];case 194>=b:return[282,b-163,5];case 226>=b:return[283,b-195,5];case 257>=b:return[284,b-227,5];case 258===b:return[285,b-258,0];default:a("invalid length: "+b)}}function m(b,c){function d(b,c){var e=b.G,f=[],g=0,h;h=E[b.length];f[g++]=h&65535;f[g++]=h>>16&255;f[g++]= h>>24;var k;switch(z){case 1===e:k=[0,e-1,0];break;case 2===e:k=[1,e-2,0];break;case 3===e:k=[2,e-3,0];break;case 4===e:k=[3,e-4,0];break;case 6>=e:k=[4,e-5,1];break;case 8>=e:k=[5,e-7,1];break;case 12>=e:k=[6,e-9,2];break;case 16>=e:k=[7,e-13,2];break;case 24>=e:k=[8,e-17,3];break;case 32>=e:k=[9,e-25,3];break;case 48>=e:k=[10,e-33,4];break;case 64>=e:k=[11,e-49,4];break;case 96>=e:k=[12,e-65,5];break;case 128>=e:k=[13,e-97,5];break;case 192>=e:k=[14,e-129,6];break;case 256>=e:k=[15,e-193,6];break; case 384>=e:k=[16,e-257,7];break;case 512>=e:k=[17,e-385,7];break;case 768>=e:k=[18,e-513,8];break;case 1024>=e:k=[19,e-769,8];break;case 1536>=e:k=[20,e-1025,9];break;case 2048>=e:k=[21,e-1537,9];break;case 3072>=e:k=[22,e-2049,10];break;case 4096>=e:k=[23,e-3073,10];break;case 6144>=e:k=[24,e-4097,11];break;case 8192>=e:k=[25,e-6145,11];break;case 12288>=e:k=[26,e-8193,12];break;case 16384>=e:k=[27,e-12289,12];break;case 24576>=e:k=[28,e-16385,13];break;case 32768>=e:k=[29,e-24577,13];break;default:a("invalid distance")}h= k;f[g++]=h[0];f[g++]=h[1];f[g++]=h[2];e=0;for(g=f.length;e=g;)v[g++]=0;for(g=0;29>=g;)x[g++]=0}v[256]=1;e=0;for(f=c.length;e=f){p&&d(p,-1);g=0; for(k=f-e;gC&&e+CB&&(m=k,B=C);if(258===C)break}k=new h(B,e-m);p?p.length2*k[x-1]+f[x]&&(k[x]=2*k[x-1]+f[x]),m[x]=Array(k[x]),s[x]=Array(k[x]);for(u=0;uh[u]?(m[x][v]=w,s[x][v]=n,t+=2):(m[x][v]=h[u], s[x][v]=u,++u);r[x]=0;1===f[x]&&c(x)}h=p;k=0;for(m=d.length;k1<f&&a("undercommitted");g=0;for(h=b.length;g>>=1;return c}function r(a,b){this.input=a;this.a=new (y?Uint8Array:Array)(32768);this.h= M.j;var c={},d;!b&&(b={})||"number"!==typeof b.compressionType||(this.h=b.compressionType);for(d in b)c[d]=b[d];c.outputBuffer=this.a;this.z=new g(this.input,c)}function s(b,c){this.k=[];this.l=32768;this.e=this.g=this.c=this.q=0;this.input=y?new Uint8Array(b):b;this.s=!1;this.m=O;this.B=!1;if(c||!(c={}))c.index&&(this.c=c.index),c.bufferSize&&(this.l=c.bufferSize),c.bufferType&&(this.m=c.bufferType),c.resize&&(this.B=c.resize);switch(this.m){case N:this.b=32768;this.a=new (y?Uint8Array:Array)(32768+ this.l+258);break;case O:this.b=0;this.a=new (y?Uint8Array:Array)(this.l);this.f=this.J;this.t=this.H;this.o=this.I;break;default:a(Error("invalid inflate mode"))}}function v(b,c){for(var d=b.g,e=b.e,f=b.input,g=b.c,h;e>>c;b.e=e-c;b.c=g;return d&(1<>>16;b.g=d>>h;b.e= e-h;b.c=g;return f&65535}function x(a){function b(a,c,d){var e,f,g,h;for(h=0;h>>8&255]<<16|G[a>>>16&255]<<8|G[a>>>24&255])>>32-b:G[a]>>8-b);if(8>b+f)g=g<>b-c-1&1,8===++f&&(f=0,d[e++]=G[g],g=0,e===d.length&&(d=this.f())); d[e]=g;this.buffer=d;this.i=f;this.index=e};d.prototype.finish=function(){var a=this.buffer,b=this.index,c;0B;++B){for(var D=B,I=D,F=7,D=D>>>1;D;D>>>=1)I<<=1,I|=D&1,--F;C[B]=(I<>>0}var G=C,C=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049, 498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275, 3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277, 2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143, 2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112, 2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746, 711928724,3020668471,3272380065,1510334235,755167117];y&&new Uint32Array(C);e.prototype.getParent=function(a){return 2*((a-2)/4|0)};e.prototype.push=function(a,b){var c,d,e=this.buffer,f;c=this.length;e[this.length++]=b;for(e[this.length++]=a;0e[d])f=e[c],e[c]=e[d],e[d]=f,f=e[c+1],e[c+1]=e[d+1],e[d+1]=f,c=d;else break;return this.length};e.prototype.pop=function(){var a,b,c=this.buffer,d,e,f;b=c[0];a=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f= 0;;){e=2*f+2;if(e>=this.length)break;e+2c[e]&&(e+=2);if(c[e]>c[f])d=c[f],c[f]=c[e],c[e]=d,d=c[f+1],c[f+1]=c[e+1],c[e+1]=d;else break;f=e}return{index:a,value:b,length:this.length}};var K=2,C={NONE:0,r:1,j:K,N:3},H=[];for(B=0;288>B;B++)switch(z){case 143>=B:H.push([B+48,8]);break;case 255>=B:H.push([B-144+400,9]);break;case 279>=B:H.push([B-256+0,7]);break;case 287>=B:H.push([B-280+192,8]);break;default:a("invalid literal: "+B)}g.prototype.n=function(){var b,c,e,f,g=this.input; switch(this.h){case 0:e=0;for(f=g.length;e>>8&255;r[u++]=s&255;r[u++]=s>>>8&255;if(y)r.set(c,u),u+=c.length,r=r.subarray(0,u);else{k=0;for(s=c.length;kE)for(;0E?E:138,J>E-3&&J=J?(G[I++]=17,G[I++]=J-3,C[17]++):(G[I++]=18,G[I++]=J-11,C[18]++),E-=J;else if(G[I++]= b[D],C[b[D]]++,E--,3>E)for(;0E?E:6,J>E-3&&JD;D++)k[D]=C[A[D]];for(w=19;4=L;L++)D=k(),B[L]=D[2]<<24|D[1]<<16|D[0];var E=y?new Uint32Array(B):B,M=C;r.prototype.n=function(){var b,d,e,f,g=0;f=this.a;b=W;switch(b){case W:d=Math.LOG2E*Math.log(32768)-8;break;default:a(Error("invalid compression method"))}d= d<<4|b;f[g++]=d;switch(b){case W:switch(this.h){case M.NONE:e=0;break;case M.r:e=1;break;case M.j:e=2;break;default:a(Error("unsupported compression type"))}break;default:a(Error("invalid compression method"))}b=e<<6|0;f[g++]=b|31-(256*d+b)%31;b=c(this.input);this.z.b=g;f=this.z.n();g=f.length;y&&(f=new Uint8Array(f.buffer),f.length<=g+4&&(this.a=new Uint8Array(f.length+4),this.a.set(f),f=this.a),f=f.subarray(0,g+4));f[g++]=b>>24&255;f[g++]=b>>16&255;f[g++]=b>>8&255;f[g++]=b&255;return f};b("Zlib.Deflate", r);b("Zlib.Deflate.compress",function(a,b){return(new r(a,b)).n()});b("Zlib.Deflate.CompressionType",M);b("Zlib.Deflate.CompressionType.NONE",M.NONE);b("Zlib.Deflate.CompressionType.FIXED",M.r);b("Zlib.Deflate.CompressionType.DYNAMIC",M.j);var N=0,O=1,C={D:N,C:O};s.prototype.p=function(){for(;!this.s;){var b=v(this,3);b&1&&(this.s=z);b>>>=1;switch(b){case 0:var b=this.input,c=this.c,d=this.a,e=this.b,f=t,g=t,h=t,k=d.length,f=t;this.e=this.g=0;f=b[c++];f===t&&a(Error("invalid uncompressed block header: LEN (first byte)")); g=f;f=b[c++];f===t&&a(Error("invalid uncompressed block header: LEN (second byte)"));g|=f<<8;f=b[c++];f===t&&a(Error("invalid uncompressed block header: NLEN (first byte)"));h=f;f=b[c++];f===t&&a(Error("invalid uncompressed block header: NLEN (second byte)"));h|=f<<8;g===~h&&a(Error("invalid uncompressed block header: length verify"));c+g>b.length&&a(Error("input buffer is broken"));switch(this.m){case N:for(;e+g>d.length;){f=k-e;g-=f;if(y)d.set(b.subarray(c,c+f),e),e+=f,c+=f;else for(;f--;)d[e++]= b[c++];this.b=e;d=this.f();e=this.b}break;case O:for(;e+g>d.length;)d=this.f({v:2});break;default:a(Error("invalid inflate mode"))}if(y)d.set(b.subarray(c,c+g),e),e+=g,c+=g;else for(;g--;)d[e++]=b[c++];this.c=c;this.b=e;this.a=d;break;case 1:this.o(J,V);break;case 2:x(this);break;default:a(Error("unknown BTYPE: "+b))}}return this.t()};B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var P=y?new Uint16Array(B):B;B=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227, 258,258,258];var R=y?new Uint16Array(B):B;B=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0];var Q=y?new Uint8Array(B):B;B=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];var U=y?new Uint16Array(B):B;B=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var T=y?new Uint8Array(B):B;B=new (y?Uint8Array:Array)(288);D=0;for(I=B.length;D=D?8:255>=D?9:279>=D?7:8;var J=f(B);B=new (y?Uint8Array: Array)(30);D=0;for(I=B.length;Df)d>=e&&(this.b=d,c=this.f(),d=this.b),c[d++]=f;else for(f-=257,h=R[f],0=e&&(this.b=d,c=this.f(),d=this.b);h--;)c[d]=c[d++-g];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};s.prototype.I=function(a,b){var c=this.a,d=this.b;this.u=a;for(var e=c.length,f,g,h;256!== (f=u(this,a));)if(256>f)d>=e&&(c=this.f(),e=c.length),c[d++]=f;else for(f-=257,h=R[f],0e&&(c=this.f(),e=c.length);h--;)c[d]=c[d++-g];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};s.prototype.f=function(){var a=new (y?Uint8Array:Array)(this.b-32768),b=this.b-32768,c,d,e=this.a;if(y)a.set(e.subarray(32768,a.length));else for(c=0,d=a.length;cc;++c)e[c]=e[b+c];this.b=32768;return e};s.prototype.J=function(a){var b,c=this.input.length/this.c+1|0,d,e,f,g=this.input,h=this.a;a&&("number"===typeof a.v&&(c=a.v),"number"===typeof a.F&&(c+=a.F));2>c?(d=(g.length-this.c)/this.u[2],f=d/2*258|0,e=fb&&(this.a.length=b),a=this.a);return this.buffer=a};w.prototype.p=function(){var b=this.input,d,e;d=this.A.p();this.c=this.A.c;this.M&&(e=(b[this.c++]<<24|b[this.c++]<< 16|b[this.c++]<<8|b[this.c++])>>>0,e!==c(d)&&a(Error("invalid adler-32 checksum")));return d};b("Zlib.Inflate",w);b("Zlib.Inflate.BufferType",C);C.ADAPTIVE=C.C;C.BLOCK=C.D;b("Zlib.Inflate.prototype.decompress",w.prototype.p);C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];y&&new Uint16Array(C);C=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258];y&&new Uint16Array(C);C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0];y&&new Uint8Array(C); C=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];y&&new Uint16Array(C);C=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];y&&new Uint8Array(C);C=new (y?Uint8Array:Array)(288);B=0;for(D=C.length;B=B?8:255>=B?9:279>=B?7:8;f(C);C=new (y?Uint8Array:Array)(30);B=0;for(D=C.length;Bb)return!1;a=new cc.BinaryStreamReader(a);a.setOffset(d);c.type=a.readByte();d+=10;if(d+4+1>b)return!1;a.setOffset(d);c.width=a.readUnsignedShort();c.height=a.readUnsignedInteger();c.pixelDepth=a.readByte();if(d+5+1>b)return!1;b=a.readByte();c.flipped=0;b&32&&(c.flipped=1);return!0}; cc.tgaLoadImageData=function(a,b,c){var d,e;d=0|c.pixelDepth/2;e=c.height*c.width*d;if(18+e>b)return!1;c.imageData=cc.__getSubArray(a,18,18+e);if(3<=d)for(a=0;ab)break;n=a[p];p+=1;(k=n&128)&&(n-=128);h=0}if(!h){if(p+d>b)break;m=cc.__getSubArray(a,p,p+d);p+=d;3<=d&&(h=m[0],m[0]=m[2],m[2]=h)}for(h=0;h>3;this._checkSize(c);var c=Math.pow(2,b-1)-1,e=this._readBits(a+b,1,d),f=this._readBits(a,b,d),g=0,h=2,k=0;do for(var m=this._readByte(++k, d),n=a%8||8,p=1<>=1;)m&p&&(g+=1/h),h*=2;while(a-=n);this._offset+=d;return f===(c<<1)+1?g?NaN:e?-Infinity:Infinity:(1+-2*e)*(f||g?f?Math.pow(2,f-c)*(1+g):Math.pow(2,-c+1)*g:0)},_readByte:function(a,b){return this._data[this._offset+b-a-1]},_decodeInt:function(a,b){var c=this._readBits(0,a,a/8),d=Math.pow(2,a);this._offset+=a/8;return b&&c>=d/2?c-d:c},_shl:function(a,b){for(++b;--b;a=1073741824===((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+2147483648);return a},_readBits:function(a,b,c){var d= (a+b)%8,e=a%8,f=c-(a>>3)-1;a=c+(-(a+b)>>3);var g=f-a;b=this._readByte(f,c)>>e&(1<<(g?8-e:b))-1;for(g&&d&&(b+=(this._readByte(a++,c)&(1<>>0>=f.firstGid)return f}}cc.log("cocos2d: Warning: TMX Layer "+a.name+" has no tiles");return null}});_p=cc.TMXTiledMap.prototype;cc.defineGetterSetter(_p,"mapWidth",_p._getMapWidth,_p._setMapWidth);cc.defineGetterSetter(_p,"mapHeight",_p._getMapHeight,_p._setMapHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight); cc.TMXTiledMap.create=function(a,b){return new cc.TMXTiledMap(a,b)};cc.TMX_PROPERTY_NONE=0;cc.TMX_PROPERTY_MAP=1;cc.TMX_PROPERTY_LAYER=2;cc.TMX_PROPERTY_OBJECTGROUP=3;cc.TMX_PROPERTY_OBJECT=4;cc.TMX_PROPERTY_TILE=5;cc.TMX_TILE_HORIZONTAL_FLAG=2147483648;cc.TMX_TILE_VERTICAL_FLAG=1073741824;cc.TMX_TILE_DIAGONAL_FLAG=536870912;cc.TMX_TILE_FLIPPED_ALL=(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_DIAGONAL_FLAG)>>>0;cc.TMX_TILE_FLIPPED_MASK=~cc.TMX_TILE_FLIPPED_ALL>>>0; cc.TMXLayerInfo=cc.Class.extend({properties:null,name:"",_layerSize:null,_tiles:null,visible:null,_opacity:null,ownTiles:!0,_minGID:1E5,_maxGID:0,offset:null,ctor:function(){this.properties=[];this.name="";this._tiles=this._layerSize=null;this.visible=!0;this._opacity=0;this.ownTiles=!0;this._minGID=1E5;this._maxGID=0;this.offset=cc.p(0,0)},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a}}); cc.TMXTilesetInfo=cc.Class.extend({name:"",firstGid:0,_tileSize:null,spacing:0,margin:0,sourceImage:"",imageSize:null,ctor:function(){this._tileSize=cc.size(0,0);this.imageSize=cc.size(0,0)},rectForGID:function(a,b){var c=b||cc.rect(0,0,0,0);c.width=this._tileSize.width;c.height=this._tileSize.height;a&=cc.TMX_TILE_FLIPPED_MASK;a-=parseInt(this.firstGid,10);var d=parseInt((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing),10);c.x=parseInt(a%d*(this._tileSize.width+ this.spacing)+this.margin,10);c.y=parseInt(parseInt(a/d,10)*(this._tileSize.height+this.spacing)+this.margin,10);return c}}); cc.TMXMapInfo=cc.SAXParser.extend({properties:null,orientation:null,parentElement:null,parentGID:null,layerAttrs:0,storingCharacters:!1,tmxFileName:null,currentString:null,_objectGroups:null,_mapSize:null,_tileSize:null,_layers:null,_tilesets:null,_tileProperties:null,_resources:"",_currentFirstGID:0,ctor:function(a,b){cc.SAXParser.prototype.ctor.apply(this);this._mapSize=cc.size(0,0);this._tileSize=cc.size(0,0);this._layers=[];this._tilesets=[];this._objectGroups=[];this.properties=[];this._tileProperties= {};this._currentFirstGID=0;void 0!==b?this.initWithXML(a,b):void 0!==a&&this.initWithTMXFile(a)},getOrientation:function(){return this.orientation},setOrientation:function(a){this.orientation=a},getMapSize:function(){return cc.size(this._mapSize.width,this._mapSize.height)},setMapSize:function(a){this._mapSize.width=a.width;this._mapSize.height=a.height},_getMapWidth:function(){return this._mapSize.width},_setMapWidth:function(a){this._mapSize.width=a},_getMapHeight:function(){return this._mapSize.height}, _setMapHeight:function(a){this._mapSize.height=a},getTileSize:function(){return cc.size(this._tileSize.width,this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},_getTileWidth:function(){return this._tileSize.width},_setTileWidth:function(a){this._tileSize.width=a},_getTileHeight:function(){return this._tileSize.height},_setTileHeight:function(a){this._tileSize.height=a},getLayers:function(){return this._layers},setLayers:function(a){this._layers.push(a)}, getTilesets:function(){return this._tilesets},setTilesets:function(a){this._tilesets.push(a)},getObjectGroups:function(){return this._objectGroups},setObjectGroups:function(a){this._objectGroups.push(a)},getParentElement:function(){return this.parentElement},setParentElement:function(a){this.parentElement=a},getParentGID:function(){return this.parentGID},setParentGID:function(a){this.parentGID=a},getLayerAttribs:function(){return this.layerAttrs},setLayerAttribs:function(a){this.layerAttrs=a},getStoringCharacters:function(){return this.storingCharacters}, setStoringCharacters:function(a){this.storingCharacters=a},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a},initWithTMXFile:function(a){this._internalInit(a,null);return this.parseXMLFile(a)},initWithXML:function(a,b){this._internalInit(null,b);return this.parseXMLString(a)},parseXMLFile:function(a,b){var c=(b=b||!1)?a:cc.loader.getRes(a);if(!c)throw Error("Please load the resource first : "+a);var d,e,c=this._parseXML(c).documentElement;d=c.getAttribute("version"); e=c.getAttribute("orientation");if("map"===c.nodeName&&("1.0"!==d&&null!==d&&cc.log("cocos2d: TMXFormat: Unsupported TMX version:"+d),"orthogonal"===e?this.orientation=cc.TMX_ORIENTATION_ORTHO:"isometric"===e?this.orientation=cc.TMX_ORIENTATION_ISO:"hexagonal"===e?this.orientation=cc.TMX_ORIENTATION_HEX:null!==e&&cc.log("cocos2d: TMXFomat: Unsupported orientation:"+e),d=cc.size(0,0),d.width=parseFloat(c.getAttribute("width")),d.height=parseFloat(c.getAttribute("height")),this.setMapSize(d),d=cc.size(0, 0),d.width=parseFloat(c.getAttribute("tilewidth")),d.height=parseFloat(c.getAttribute("tileheight")),this.setTileSize(d),e=c.querySelectorAll("map \x3e properties \x3e property"))){var f={};for(d=0;d=this._layerSize.width||b>=this._layerSize.height||0>c||0>b)throw Error("cc.TMXLayer.getTileAt(): invalid position");if(!this.tiles)return cc.log("cc.TMXLayer.getTileAt(): TMXLayer: the tiles map has been released"),null;var d=null,e=this.getTileGIDAt(c,b);if(0===e)return d;var f=0|c+b*this._layerSize.width,d=this._spriteTiles[f]; d||(d=this._texGrids[e],e=this._textures[d.texId],d=cc.rectPixelsToPoints(d),d=new cc.Sprite(e,d),d.setPosition(this.getPositionAt(c,b)),c=this._vertexZForPos(c,b),d.setVertexZ(c),d.setAnchorPoint(0,0),d.setOpacity(this._opacity),this.addChild(d,c,f));return d},getTileGIDAt:function(a,b){if(void 0===a)throw Error("cc.TMXLayer.getTileGIDAt(): pos should be non-null");var c=a;void 0===b&&(c=a.x,b=a.y);if(c>=this._layerSize.width||b>=this._layerSize.height||0>c||0>b)throw Error("cc.TMXLayer.getTileGIDAt(): invalid position"); return this.tiles?(this.tiles[0|c+b*this._layerSize.width]&cc.TMX_TILE_FLIPPED_MASK)>>>0:(cc.log("cc.TMXLayer.getTileGIDAt(): TMXLayer: the tiles map has been released"),null)},setTileGID:function(a,b,c,d){if(void 0===b)throw Error("cc.TMXLayer.setTileGID(): pos should be non-null");void 0!==d?b=cc.p(b,c):d=c;if(b.x>=this._layerSize.width||b.y>=this._layerSize.height||0>b.x||0>b.y)throw Error("cc.TMXLayer.setTileGID(): invalid position");if(this.tiles)if(0!==a&&a>>0,0===a)this.removeTileAt(b);else if(0===e)this._updateTileForGID(c,b);else{var e=b.x+b.y*this._layerSize.width,f=this.getChildByTag(e);if(f){a=this._texGrids[a];var g=this._textures[a.texId];a=cc.rectPixelsToPoints(a);f.setTexture(g);f.setTextureRect(a,!1);null!=d&&this._setupTileSprite(f,b,c);this.tiles[e]=c}else this._updateTileForGID(c,b)}}else cc.log("cc.TMXLayer.setTileGID(): TMXLayer: the tiles map has been released")}, addChild:function(a,b,c){cc.Node.prototype.addChild.call(this,a,b,c);void 0!==c&&(this._spriteTiles[c]=a,a._vertexZ=this._vertexZ+cc.renderer.assignedZStep*c/this.tiles.length)},removeChild:function(a,b){this._spriteTiles[a.tag]&&(this._spriteTiles[a.tag]=null);cc.Node.prototype.removeChild.call(this,a,b)},getTileFlagsAt:function(a,b){if(!a)throw Error("cc.TMXLayer.getTileFlagsAt(): pos should be non-null");void 0!==b&&(a=cc.p(a,b));if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x|| 0>a.y)throw Error("cc.TMXLayer.getTileFlagsAt(): invalid position");return this.tiles?(this.tiles[0|a.x+a.y*this._layerSize.width]&cc.TMX_TILE_FLIPPED_ALL)>>>0:(cc.log("cc.TMXLayer.getTileFlagsAt(): TMXLayer: the tiles map has been released"),null)},removeTileAt:function(a,b){if(!a)throw Error("cc.TMXLayer.removeTileAt(): pos should be non-null");void 0!==b&&(a=cc.p(a,b));if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw Error("cc.TMXLayer.removeTileAt(): invalid position"); if(!this.tiles)cc.log("cc.TMXLayer.removeTileAt(): TMXLayer: the tiles map has been released");else if(0!==this.getTileGIDAt(a)){var c=0|a.x+a.y*this._layerSize.width;this.tiles[c]=0;(c=this._spriteTiles[c])&&this.removeChild(c,!0)}},getPositionAt:function(a,b){void 0!==b&&(a=cc.p(a,b));var c=cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:c=this._positionForOrthoAt(a);break;case cc.TMX_ORIENTATION_ISO:c=this._positionForIsoAt(a);break;case cc.TMX_ORIENTATION_HEX:c=this._positionForHexAt(a)}return cc.pointPixelsToPoints(c)}, _positionForIsoAt:function(a){return cc.p(this._mapTileSize.width/2*(this._layerSize.width+a.x-a.y-1),this._mapTileSize.height/2*(2*this._layerSize.height-a.x-a.y-2))},_positionForOrthoAt:function(a){return cc.p(a.x*this._mapTileSize.width,(this._layerSize.height-a.y-1)*this._mapTileSize.height)},_positionForHexAt:function(a){return cc.p(a.x*this._mapTileSize.width*3/4,(this._layerSize.height-a.y-1)*this._mapTileSize.height+(1===a.x%2?-this._mapTileSize.height/2:0))},_calculateLayerOffset:function(a){var b= cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:b=cc.p(a.x*this._mapTileSize.width,-a.y*this._mapTileSize.height);break;case cc.TMX_ORIENTATION_ISO:b=cc.p(this._mapTileSize.width/2*(a.x-a.y),this._mapTileSize.height/2*(-a.x-a.y));break;case cc.TMX_ORIENTATION_HEX:0===a.x&&0===a.y||cc.log("offset for hexagonal map not implemented yet")}return b},_updateTileForGID:function(a,b){if(this._texGrids[a]){var c=0|b.x+b.y*this._layerSize.width;c>>0?(a.setAnchorPoint(0.5,0.5),a.setPosition(d.x+a.width/2,d.y+a.height/2),b=(c&(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG)>>>0)>>>0,b===cc.TMX_TILE_HORIZONTAL_FLAG?a.setRotation(90):b===cc.TMX_TILE_VERTICAL_FLAG?a.setRotation(270):(b===(cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_HORIZONTAL_FLAG)>>> 0?a.setRotation(90):a.setRotation(270),a.setFlippedX(!0))):((c&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0&&a.setFlippedX(!0),(c&cc.TMX_TILE_VERTICAL_FLAG)>>>0&&a.setFlippedY(!0))},_vertexZForPos:function(a,b){void 0===b&&(b=a.y,a=a.x);var c=0,d=0;if(this._useAutomaticVertexZ)switch(this.layerOrientation){case cc.TMX_ORIENTATION_ISO:d=this._layerSize.width+this._layerSize.height;c=-(d-(a+b));break;case cc.TMX_ORIENTATION_ORTHO:c=-(this._layerSize.height-b);break;case cc.TMX_ORIENTATION_HEX:cc.log("TMX Hexa zOrder not supported"); break;default:cc.log("TMX invalid value")}else c=this._vertexZvalue;return c}});_p=cc.TMXLayer.prototype;cc.defineGetterSetter(_p,"layerWidth",_p._getLayerWidth,_p._setLayerWidth);cc.defineGetterSetter(_p,"layerHeight",_p._getLayerHeight,_p._setLayerHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight);cc.TMXLayer.create=function(a,b,c){return new cc.TMXLayer(a,b,c)};(function(){cc.TMXLayer.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0};var a=cc.TMXLayer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.TMXLayer.CanvasRenderCmd;a.visit=function(a){var c=this._node,d=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;if(c._visible){isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=d.assignedZStep);this._syncStatus(a);a=c._children;var e=c._spriteTiles,f,g=a.length;if(0c._localZOrder)c._renderCmd.visit(this);else break;for(d.pushRenderCommand(this);f=h)){var k=e._mapTileSize.width,m=e._mapTileSize.height, n=e.tileset._tileSize.width/cc.director._contentScaleFactor,p=e.tileset._tileSize.height/cc.director._contentScaleFactor,r=n-k,s=p-m,v=cc.winSize.width,u=cc.winSize.height,x=e._layerSize.height,w=e._layerSize.width,t=e._texGrids,z=e._spriteTiles,A=this._worldTransform,y=-e._contentSize.width*e._anchorPoint.x,C=-e._contentSize.height*e._anchorPoint.y,B=A.a,D=A.d,I=y*B+C*A.c+A.tx,y=y*A.b+C*D+A.ty,C=a||cc._renderContext,F=C.getContext(),G=0,K=0,H=w,L=x;f||g!==cc.TMX_ORIENTATION_ORTHO||(G=Math.floor(-(I- r*B)/(k*B)),K=Math.floor((y-s*D+m*x*D-u)/(m*D)),H=Math.ceil((v-I+r*B)/(k*B)),L=x-Math.floor(-(y+s*D)/(m*D)),0>G&&(G=0),0>K&&(K=0),H>w&&(H=w),L>x&&(L=x));var E,M,r=K*w,N,O,P,R=cc.TMX_TILE_FLIPPED_MASK,Q,U,T,J,V=n*B,W=p*D,S,X,Z=!1,$=!1,s=r+G;for(E in z)if(E=s)break;C.setTransform(A,c,d);for(C.setGlobalAlpha(h);K>>0])&&(P=e._textures[O.texId])&&P._htmlElementObj){switch(g){case cc.TMX_ORIENTATION_ORTHO:U=M*k;T=-(x-K-1)*m;break;case cc.TMX_ORIENTATION_ISO:U=k/2*(w+M-K-1);T=-m/2*(2*x-M-K-2);break;case cc.TMX_ORIENTATION_HEX:U=M*k*3/4,T=-(x-K-1)*m+(1===M%2?-m/2:0)}J=U+n;Q=T-p;if(!f&&g===cc.TMX_ORIENTATION_ISO){S=-y+T*D;if(S<-u-W){M+=Math.floor(2*(-u-S)/W)-1;continue}S=I+J*B;if(S<-V){M+=Math.floor(2*-S/V)-1;continue}X=I+U*B;S=-y+ Q*D;if(X>v||0cc.TMX_TILE_DIAGONAL_FLAG&&(Z=(N&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0,$=(N&cc.TMX_TILE_VERTICAL_FLAG)>>>0);Z&&(U=-J,F.scale(-1,1));$&&(Q=-T,F.scale(1,-1));F.drawImage(P._htmlElementObj,O.x,O.y,O.width,O.height,U,Q,n,p);Z&&F.scale(-1,1);$&&F.scale(1,-1);cc.g_NumberOfDraws++}r+=w}for(E in z)E>s&&z[E]&&(N=z[E]._renderCmd,0===z[E]._localZOrder&&N.rendering&&N.rendering(a,c,d))}}})();(function(){cc.TMXLayer.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._vertices=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];this._color=new Uint32Array(1);this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST);a=90*Math.PI/180;this._sin90=Math.sin(a);this._cos90=Math.cos(a);a*=3;this._sin270=Math.sin(a);this._cos270=Math.cos(a)};var a=cc.TMXLayer.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.TMXLayer.WebGLRenderCmd; a.uploadData=function(a,c,d){var e=this._node,f=e._rotationX||e._rotationY,g=e.layerOrientation,h=e.tiles;if(!h)return 0;var k=e._mapTileSize.width,m=e._mapTileSize.height,n=e.tileset._tileSize.width/cc.director._contentScaleFactor,p=e.tileset._tileSize.height/cc.director._contentScaleFactor,r=n-k,s=p-m,v=cc.winSize.width,u=cc.winSize.height,x=e._layerSize.height,w=e._layerSize.width,t=e._texGrids,z=e._spriteTiles,A=this._worldTransform,y=A.a,C=A.b,B=A.c,D=A.d,I=A.tx,A=A.ty,F=-e._contentSize.width* e._anchorPoint.x,G=-e._contentSize.height*e._anchorPoint.y,K=F*y+G*B+I,F=F*C+G*D+A,G=e._opacity,H=this._displayedColor.r,L=this._displayedColor.g,E=this._displayedColor.b;if(e._opacityModifyRGB)var M=G/255,H=H*M,L=L*M,E=E*M;this._color[0]=G<<24|E<<16|L<<8|H;var N=G=0,H=w,L=x;f||g!==cc.TMX_ORIENTATION_ORTHO||(G=Math.floor(-(K-r*y)/(k*y)),N=Math.floor((F-s*D+m*x*D-u)/(m*D)),H=Math.ceil((v-K+r*y)/(k*y)),L=x-Math.floor(-(F+s*D)/(m*D)),0>G&&(G=0),0>N&&(N=0),H>w&&(H=w),L>x&&(L=x));for(var O,r=d,s=N*w,P, R,Q,E=cc.TMX_TILE_FLIPPED_MASK,U,T,J,V,M=n*y,W=p*D,S,X,Z=y,$=C,ca=B,da=D,ea=I,fa=A,ga=!1,aa=!1,ba=!1,Y=this._vertices;Na.length&&(cc.renderer._increaseBatchingSize((r-d)/6),cc.renderer._batchRendering(),r=d=0),P=s+O,!z[P]&&(R=e.tiles[P],Q=t[(R&E)>>>0])){switch(g){case cc.TMX_ORIENTATION_ORTHO:T=O*k;J=(x-N-1)*m;P=e._vertexZ+cc.renderer.assignedZStep*P/h.length;break;case cc.TMX_ORIENTATION_ISO:T=k/2*(w+O-N-1);J=m/2*(2*x-O-N-2);P=e._vertexZ+cc.renderer.assignedZStep* (e.height-J)/e.height;break;case cc.TMX_ORIENTATION_HEX:T=O*k*3/4,J=(x-N-1)*m+(1===O%2?-m/2:0),P=e._vertexZ+cc.renderer.assignedZStep*(e.height-J)/e.height}V=T+n;U=J+p;if(!f&&g===cc.TMX_ORIENTATION_ISO){S=F+J*D;if(S>u+W){O+=Math.floor(2*(S-u)/W)-1;continue}S=K+V*y;if(S<-M){O+=Math.floor(2*-S/M)-1;continue}X=K+T*y;S=F+U*D;if(X>v||0>S){O=H;continue}}R>cc.TMX_TILE_DIAGONAL_FLAG&&(ga=!0,aa=(R&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0,ba=(R&cc.TMX_TILE_VERTICAL_FLAG)>>>0);Y[0].x=T*Z+U*ca+ea;Y[0].y=T*$+U*da+fa; Y[1].x=T*Z+J*ca+ea;Y[1].y=T*$+J*da+fa;Y[2].x=V*Z+U*ca+ea;Y[2].y=V*$+U*da+fa;Y[3].x=V*Z+J*ca+ea;Y[3].y=V*$+J*da+fa;for(R=0;4>R;++R){a[r]=Y[R].x;a[r+1]=Y[R].y;a[r+2]=P;c[r+3]=this._color[0];switch(R){case 0:a[r+4]=aa?Q.r:Q.l;a[r+5]=ba?Q.b:Q.t;break;case 1:a[r+4]=aa?Q.r:Q.l;a[r+5]=ba?Q.t:Q.b;break;case 2:a[r+4]=aa?Q.l:Q.r;a[r+5]=ba?Q.b:Q.t;break;case 3:a[r+4]=aa?Q.l:Q.r,a[r+5]=ba?Q.t:Q.b}r+=6}ga&&(Z=y,$=C,ca=B,da=D,ea=I,fa=A,ga=ba=aa=!1)}s+=w}return(r-d)/6}})();cc.PointObject=cc.Class.extend({_ratio:null,_offset:null,_child:null,ctor:function(a,b){this.initWithCCPoint(a,b)},getRatio:function(){return this._ratio},setRatio:function(a){this._ratio=a},getOffset:function(){return this._offset},setOffset:function(a){this._offset=a},getChild:function(){return this._child},setChild:function(a){this._child=a},initWithCCPoint:function(a,b){this._ratio=a;this._offset=b;this._child=null;return!0}});cc.PointObject.create=function(a,b){return new cc.PointObject(a,b)}; cc.ParallaxNode=cc.Node.extend({parallaxArray:null,_lastPosition:null,_className:"ParallaxNode",getParallaxArray:function(){return this.parallaxArray},setParallaxArray:function(a){this.parallaxArray=a},ctor:function(){cc.Node.prototype.ctor.call(this);this.parallaxArray=[];this._lastPosition=cc.p(-100,-100)},addChild:function(a,b,c,d){if(3===arguments.length)cc.log("ParallaxNode: use addChild(child, z, ratio, offset) instead");else{if(!a)throw Error("cc.ParallaxNode.addChild(): child should be non-null"); var e=new cc.PointObject(c,d);e.setChild(a);this.parallaxArray.push(e);a.setPosition(this._position.x*c.x+d.x,this._position.y*c.y+d.y);cc.Node.prototype.addChild.call(this,a,b,a.tag)}},removeChild:function(a,b){for(var c=this.parallaxArray,d=0;dthis.buffer.duration},set paused(a){},get loop(){return this._loop},set loop(a){return this._loop=a},get volume(){return this._volume.gain.value},set volume(a){return this._volume.gain.value=a},get currentTime(){return this.playedLength},set currentTime(a){return this.playedLength=a},play:function(a){this._currentSource&& !this.paused&&(this._currentSource.stop(0),this.playedLength=0);var b=this.context.createBufferSource();b.buffer=this.buffer;b.connect(this._volume);b.loop=this._loop;this._startTime=this.context.currentTime;a=a||this.playedLength;var c=this.buffer.duration;this._loop?b.start?b.start(0):b.notoGrainOn?b.noteGrainOn(0):b.noteOn(0):b.start?b.start(0,a,c-a):b.notoGrainOn?b.noteGrainOn(0,a,c-a):b.noteOn(0,a,c-a);this._currentSource=b;if(0===this.context.currentTime){var d=this;clearTimeout(this._currextTimer); this._currextTimer=setTimeout(function(){0===d.context.currentTime&&cc.Audio.touchPlayList.push({offset:a,audio:d})},10)}},pause:function(){this.playedLength=this.context.currentTime-this._startTime;this.playedLength%=this.buffer.duration;var a=this._currentSource;this._currentSource=null;this._startTime=-1;a&&a.stop(0)}}; (function(a){var b=a.WEB_AUDIO,c=a.ONLY_ONE,d=[];(function(){var a=document.createElement("audio");if(a.canPlayType){var b=a.canPlayType('audio/ogg; codecs\x3d"vorbis"');b&&""!==b&&d.push(".ogg");(b=a.canPlayType("audio/mpeg"))&&""!==b&&d.push(".mp3");(b=a.canPlayType('audio/wav; codecs\x3d"1"'))&&""!==b&&d.push(".wav");(b=a.canPlayType("audio/mp4"))&&""!==b&&d.push(".mp4");(a=a.canPlayType("audio/x-m4a"))&&""!==a&&d.push(".m4a")}})();try{if(b){var e=new (window.AudioContext||window.webkitAudioContext|| window.mozAudioContext);cc.Audio._context=e;if(!(e.createBufferSource&&e.createGain&&e.destination&&e.decodeAudioData))throw"context is incomplete";a.DELAY_CREATE_CTX&&setTimeout(function(){e=new (window.AudioContext||window.webkitAudioContext||window.mozAudioContext);cc.Audio._context=e},0)}}catch(f){b=!1,cc.log("browser don't support web audio")}var g={cache:{},useWebAudio:!0,loadBuffer:function(a,c){if(b){var d=cc.loader.getXMLHttpRequest();d.open("GET",a,!0);d.responseType="arraybuffer";d.onload= function(){0<=d._timeoutId&&clearTimeout(d._timeoutId);e.decodeAudioData(d.response,function(a){c(null,a)},function(){c("decode error - "+a)})};d.onerror=function(){c("request error - "+a)};void 0===d.ontimeout&&(d._timeoutId=setTimeout(function(){d.ontimeout()},d.timeout));d.ontimeout=function(){c("request timeout - "+a)};d.send()}},load:function(a,b,c,e){if(0===d.length)return e("can not support audio!");var f=cc.loader.getRes(b);if(f)return e(null,f);cc.loader.audioPath&&(a=cc.path.join(cc.loader.audioPath, a));f=cc.path.extname(a);c=[f];for(var g=0;ga&&(a=0);this._musicVolume=a;var b=this._currMusic;b&&b.setVolume(a)},isMusicPlaying:function(){var a=this._currMusic;return a?a.getPlaying():!1},_audioPool:{},_maxAudioInstance:10,_effectVolume:1,playEffect:function(a,d){if(c&&this._currMusic&&this._currMusic.getPlaying())return cc.log("Browser is only allowed to play one audio"),null;var e=this._audioPool[a];e||(e=this._audioPool[a]=[]);for(var f=0;fthis._maxAudioInstance&&(f=e.shift(),f.stop(),e.push(f),f=e.length-1);var p;if(e[f])return p=e[f],p.setVolume(this._effectVolume),p.play(0,d||!1),p;(p=cc.loader.getRes(a))&&b&&"AUDIO"===p._AUDIO_TYPE&&(cc.loader.release(a),p=null);if(p)if(b&&"AUDIO"===p._AUDIO_TYPE)g.loadBuffer(a,function(a,b){p.setBuffer(b);p.setVolume(cc.audioEngine._effectVolume);p.getPlaying()||p.play(0,d||!1)});else return p=p.cloneNode(),p.setVolume(this._effectVolume),p.play(0,d||!1),e.push(p),p;f=g.useWebAudio;g.useWebAudio= !0;cc.loader.load(a,function(b){b=cc.loader.getRes(a);b=b.cloneNode();b.setVolume(cc.audioEngine._effectVolume);b.play(0,d||!1);e.push(b)});g.useWebAudio=f;return p},setEffectsVolume:function(a){a-=0;isNaN(a)&&(a=1);1a&&(a=0);this._effectVolume=a;var b=this._audioPool,c;for(c in b){var d=b[c];if(Array.isArray(d))for(var e=0;e=d.width&&(d.width=c.width),0>=d.height&&(d.height=c.height),a.setContentSize(d));c=b?b.getBoundingBox():cc.rect(0,0,0,0);d=a?a.getBoundingBox():cc.rect(0, 0,0,0);c=cc.rectUnion(c,d);this.setContentSize(c.width,c.height);c=this.getContentSize();b&&(b.setPosition(c.width/2,c.height/2),b.setVisible(!0));a&&(a.setPosition(c.width/2,c.height/2),a.setVisible(!0))}},initWithLabelAndBackgroundSprite:function(a,b){if(!a)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): label should be non-null");if(!b)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): backgroundSprite should be non-null");if(cc.Control.prototype.init.call(this, !0)){this._parentInited=!0;this._titleDispatchTable={};this._titleColorDispatchTable={};this._titleLabelDispatchTable={};this._backgroundSpriteDispatchTable={};this._isPushed=!1;this.zoomOnTouchDown=!0;this._currentTitle=null;this.setAdjustBackgroundImage(!0);this.setPreferredSize(cc.size(0,0));this.zoomOnTouchDown=!0;this.ignoreAnchorPointForPosition(!1);this.setAnchorPoint(0.5,0.5);this._titleLabel=a;this._backgroundSprite=b;this.setOpacity(255);this.setOpacityModifyRGB(!0);var c=a.getString(); this.setTitleForState(c,cc.CONTROL_STATE_NORMAL);this.setTitleColorForState(a.getColor(),cc.CONTROL_STATE_NORMAL);this.setTitleLabelForState(a,cc.CONTROL_STATE_NORMAL);this.setBackgroundSpriteForState(b,cc.CONTROL_STATE_NORMAL);this._state=cc.CONTROL_STATE_NORMAL;this._marginH=24;this._marginV=12;this._labelAnchorPoint=cc.p(0.5,0.5);this.setPreferredSize(cc.size(0,0));this.needsLayout();return!0}return!1},initWithTitleAndFontNameAndFontSize:function(a,b,c){a=new cc.LabelTTF(a,b,c);return this.initWithLabelAndBackgroundSprite(a, new cc.Scale9Sprite)},initWithBackgroundSprite:function(a){var b=new cc.LabelTTF("","Arial",30);return this.initWithLabelAndBackgroundSprite(b,a)},doesAdjustBackgroundImage:function(){return this._doesAdjustBackgroundImage},setAdjustBackgroundImage:function(a){this._doesAdjustBackgroundImage=a;this.needsLayout()},getZoomOnTouchDown:function(){return this.zoomOnTouchDown},setZoomOnTouchDown:function(a){return this.zoomOnTouchDown=a},getPreferredSize:function(){return this._preferredSize},setPreferredSize:function(a){if(0=== a.width&&0===a.height)this._doesAdjustBackgroundImage=!0;else{this._doesAdjustBackgroundImage=!1;var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setPreferredSize(a)}this._preferredSize=a;this.needsLayout()},getLabelAnchorPoint:function(){return this._labelAnchorPoint},setLabelAnchorPoint:function(a){this._labelAnchorPoint=a;this._titleLabel&&this._titleLabel.setAnchorPoint(a)},_getCurrentTitle:function(){return this._currentTitle},_getCurrentTitleColor:function(){return this._currentTitleColor}, getOpacity:function(){return this._opacity},setOpacity:function(a){cc.Control.prototype.setOpacity.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setOpacity(a)},setColor:function(a){cc.Control.prototype.setColor.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setColor(a)},getColor:function(){var a=this._realColor;return cc.color(a.r,a.g,a.b,a.a)},isPushed:function(){return this._isPushed},_getVerticalMargin:function(){return this._marginV},_getHorizontalOrigin:function(){return this._marginH}, setMargins:function(a,b){this._marginV=b;this._marginH=a;this.needsLayout()},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this.needsLayout()},setSelected:function(a){cc.Control.prototype.setSelected.call(this,a);this.needsLayout()},setHighlighted:function(a){this._state=a?cc.CONTROL_STATE_HIGHLIGHTED:cc.CONTROL_STATE_NORMAL;cc.Control.prototype.setHighlighted.call(this,a);(a=this.getActionByTag(cc.CONTROL_ZOOM_ACTION_TAG))&&this.stopAction(a);this.zoomOnTouchDown&&(a=this.isHighlighted()&& this.isEnabled()&&!this.isSelected()?1.1:1,a=cc.scaleTo(0.05,a),a.setTag(cc.CONTROL_ZOOM_ACTION_TAG),this.runAction(a))},onTouchBegan:function(a,b){if(!(this.isTouchInside(a)&&this.isEnabled()&&this.isVisible()&&this.hasVisibleParents()))return!1;this._isPushed=!0;this.setHighlighted(!0);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DOWN);return!0},onTouchMoved:function(a,b){if(this._enabled&&this._isPushed&&!this._selected){var c=this.isTouchInside(a);c&&!this._highlighted?(this.setHighlighted(!0), this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_ENTER)):c&&this._highlighted?this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE):!c&&this._highlighted?(this.setHighlighted(!1),this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_EXIT)):c||this._highlighted||this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE)}else this._highlighted&&this.setHighlighted(!1)},onTouchEnded:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.isTouchInside(a)? this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_INSIDE):this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_OUTSIDE)},onTouchCancelled:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_CANCEL)},getTitleForState:function(a){var b=this._titleDispatchTable;return b?b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]:""},setTitleForState:function(a,b){this._titleDispatchTable[b]=a||"";this.getState()===b&&this.needsLayout()},getTitleColorForState:function(a){return(a= this._titleColorDispatchTable[a])?a:(a=this._titleColorDispatchTable[cc.CONTROL_STATE_NORMAL])?a:cc.color.WHITE},setTitleColorForState:function(a,b){this._titleColorDispatchTable[b]=a;this.getState()===b&&this.needsLayout()},getTitleLabelForState:function(a){var b=this._titleLabelDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setTitleLabelForState:function(a,b){var c=this._titleLabelDispatchTable;if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(0.5, 0.5);this.addChild(a,1);this.getState()===b&&this.needsLayout()},setTitleTTFForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelTTF(c,a,12),b)},getTitleTTFForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelTTF?a.getFontName():""},setTitleTTFSizeForState:function(a,b){var c=this.getTitleLabelForState(b);null!=c&&c instanceof cc.LabelTTF&&c.setFontSize(a)},getTitleTTFSizeForState:function(a){a=this.getTitleLabelForState(a); return null!=a&&a instanceof cc.LabelTTF?a.getFontSize():0},setTitleBMFontForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelBMFont(c,a),b)},getTitleBMFontForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelBMFont?a.getFntFile():""},getBackgroundSpriteForState:function(a){var b=this._backgroundSpriteDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setBackgroundSpriteForState:function(a,b){var c=this._backgroundSpriteDispatchTable; if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(0.5,0.5);this.addChild(a);c=this._preferredSize;0===c.width&&0===c.height||a.setPreferredSize(c);this._state===b&&this.needsLayout()},setBackgroundSpriteFrameForState:function(a,b){var c=cc.Scale9Sprite.createWithSpriteFrame(a);this.setBackgroundSpriteForState(c,b)}});_p=cc.ControlButton.prototype;cc.defineGetterSetter(_p,"adjustBackground",_p.getAdjustBackgroundImage,_p.setAdjustBackgroundImage); cc.defineGetterSetter(_p,"preferredSize",_p.getPreferredSize,_p.setPreferredSize);cc.defineGetterSetter(_p,"labelAnchor",_p.getLabelAnchorPoint,_p.setLabelAnchorPoint);_p=null;cc.ControlButton.create=function(a,b,c){return new cc.ControlButton(a,b,c)};cc.RGBA=function(a,b,c,d){this.r=a;this.g=b;this.b=c;this.a=d};cc.HSV=function(a,b,c){this.h=a;this.s=b;this.v=c};cc.ControlUtils={};cc.ControlUtils.addSpriteToTargetWithPosAndAnchor=function(a,b,c,d){a=new cc.Sprite("#"+a);if(!a)return null;a.setPosition(c);a.setAnchorPoint(d);b.addChild(a);return a}; cc.ControlUtils.HSVfromRGB=function(a){var b=new cc.HSV,c,d;c=a.ra.g?a.r:a.g;d=d>a.b?d:a.b;b.v=d;c=d-c;if(0=d?(a.g-a.b)/c:a.g>=d?2+(a.b-a.r)/c:4+(a.r-a.g)/c;b.h*=60;0>b.h&&(b.h+=360);return b}; cc.ControlUtils.RGBfromHSV=function(a){var b,c,d,e,f=new cc.RGBA;f.a=1;if(0>=a.s){if(!a.h)return f.r=a.v,f.g=a.v,f.b=a.v,f;f.r=0;f.g=0;f.b=0;return f}b=a.h;360<=b&&(b=0);b/=60;e=0|b;d=b-e;b=a.v*(1-a.s);c=a.v*(1-a.s*d);d=a.v*(1-a.s*(1-d));switch(e){case 0:f.r=a.v;f.g=d;f.b=b;break;case 1:f.r=c;f.g=a.v;f.b=b;break;case 2:f.r=b;f.g=a.v;f.b=d;break;case 3:f.r=b;f.g=c;f.b=a.v;break;case 4:f.r=d;f.g=b;f.b=a.v;break;default:f.r=a.v,f.g=b,f.b=c}return f}; cc.ControlUtils.CCRectUnion=function(a,b){return cc.rectUnion(a,b)};cc.Invocation=cc.Class.extend({_action:null,_target:null,_controlEvent:null,ctor:function(a,b,c){this._target=a;this._action=b;this._controlEvent=c},getAction:function(){return this._action},getTarget:function(){return this._target},getControlEvent:function(){return this._controlEvent},invoke:function(a){if(this._target&&this._action)if(cc.isString(this._action))this._target[this._action](a,this._controlEvent);else this._action.call(this._target,a,this._controlEvent)}});cc.Spacer=cc.Layer.extend({});cc.Spacer.verticalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(0,a);return b};cc.Spacer.horizontalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(a,0);return b}; cc.MenuPassive=cc.Layer.extend({_color:null,_opacity:0,_className:"MenuPassive",ctor:function(){},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b;if(this._children&&0=b.length?cc.log("cc.MenuPassive.alignItemsInColumns(): invalid row index"):(h=b[e])?(k=this._children[c].getContentSize().height,f=0|(f>=k||null==k?f:k),++g,g>=h&&(d+=f+5,f=g=0,++e)):cc.log("cc.MenuPassive.alignItemsInColumns(): can not have zero columns on a row"));var m=cc.director.getWinSize(),n=h=f=e=0,p=0,d=d/2;if(this._children&&0=k||null==k?f:k),this._children[c].setPosition(p-m.width/2,d-this._children[c].getContentSize().height/2),p+=n,++g,g>=h&&(d-=f+5,f=h=g=0,++e))},alignItemsInRows:function(a){var b=[],c;for(c=1;c=b.length?cc.log("cc.MenuPassive.alignItemsInRows(): invalid row index"):(n=b[h])?(p=this._children[c].getContentSize().width, k=0|(k>=p||null==p?k:p),g+=0|this._children[c].getContentSize().height+5,++m,m>=n&&(d.push(k),e.push(g),f+=k+10,k=m=0,g=-5,++h)):cc.log("cc.MenuPassive.alignItemsInColumns(): can't have zero rows on a column"));g=cc.director.getWinSize();k=h=0;n=null;var f=-f/2,r=0;if(this._children&&0=p||null==p?k:p),this._children[c].setPosition(f+d[h]/2,r-g.height/ 2),r-=this._children[c].getContentSize().height+10,++m,m>=n&&(f+=k+5,k=n=m=0,++h))},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1}});cc.MenuPassive.create=function(a){a||(a=null);for(var b=[],c=1;ce&&(a.x=b+e*Math.cos(d),a.y=c+e*Math.sin(d));this._slider.setPosition(a);a.xthis._startPos.x+this._boxPos+this._boxSize-1&&(a.x=this._startPos.x+this._boxPos+this._boxSize-1);a.ythis._startPos.y+this._boxPos+this._boxSize&&(a.y=this._startPos.y+this._boxPos+this._boxSize);this._saturation=1-Math.abs((this._startPos.x+this._boxPos-a.x)/this._boxSize);this._brightness=Math.abs((this._startPos.y+this._boxPos-a.y)/this._boxSize)},_checkSliderPosition:function(a){var b=this._startPos.x+ 0.5*this._background.getBoundingBox().width,c=this._startPos.y+0.5*this._background.getBoundingBox().height,b=a.x-b,c=a.y-c;return Math.sqrt(b*b+c*c)<=0.5*this._background.getBoundingBox().width?(this._updateSliderPosition(a),this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED),!0):!1},onTouchBegan:function(a,b){if(!this.isEnabled()||!this.isVisible())return!1;var c=this.getTouchLocation(a);return this._checkSliderPosition(c)},onTouchMoved:function(a,b){var c=this.getTouchLocation(a);this._checkSliderPosition(c)}}); _p=cc.ControlSaturationBrightnessPicker.prototype;cc.defineGetterSetter(_p,"saturation",_p.getSaturation);cc.defineGetterSetter(_p,"brightness",_p.getBrightness);cc.defineGetterSetter(_p,"background",_p.getBackground);cc.defineGetterSetter(_p,"overlay",_p.getOverlay);cc.defineGetterSetter(_p,"shadow",_p.getShadow);cc.defineGetterSetter(_p,"slider",_p.getSlider);cc.defineGetterSetter(_p,"startPos",_p.getStartPos);_p=null; cc.ControlSaturationBrightnessPicker.create=function(a,b){return new cc.ControlSaturationBrightnessPicker(a,b)};cc.ControlHuePicker=cc.Control.extend({_hue:0,_huePercentage:0,_background:null,_slider:null,_startPos:null,_className:"ControlHuePicker",ctor:function(a,b){cc.Control.prototype.ctor.call(this);b&&this.initWithTargetAndPos(a,b)},getHue:function(){return this._hue},setHue:function(a){this._hue=a;this.setHuePercentage(this._hue/360)},getHuePercentage:function(){return this._huePercentage},setHuePercentage:function(a){this._huePercentage=a;this._hue=360*this._huePercentage;var b=this._background.getBoundingBox(), c=this._startPos.x+0.5*b.width;a=this._startPos.y+0.5*b.height;var b=0.5*b.width-15,d=cc.degreesToRadians(360*this._huePercentage-180),c=c+b*Math.cos(d);a+=b*Math.sin(d);this._slider.setPosition(c,a)},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._slider&&this._slider.setOpacity(a?255:128)},getBackground:function(){return this._background},getSlider:function(){return this._slider},getStartPos:function(){return this._startPos},initWithTargetAndPos:function(a,b){return cc.Control.prototype.init.call(this)? (this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("huePickerBackground.png",a,b,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",a,b,cc.p(0.5,0.5)),this._slider.setPosition(b.x,b.y+0.5*this._background.getBoundingBox().height),this._startPos=b,this._huePercentage=this._hue=0,!0):!1},_updateSliderPosition:function(a){var b=this._background.getBoundingBox();a=Math.atan2(a.y-(this._startPos.y+0.5*b.height),a.x-(this._startPos.x+0.5*b.width)); a=cc.radiansToDegrees(a)+180;this.setHue(a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},_checkSliderPosition:function(a){var b=Math.sqrt(Math.pow(a.x+10,2)+Math.pow(a.y,2));return 80>b&&59=this._maximumValue&&(this._maximumValue=this._minimumValue+1);this.setValue(this._value)},getMaximumValue:function(){return this._maximumValue},setMaximumValue:function(a){this._maximumAllowedValue=this._maximumValue=a;this._maximumValue<=this._minimumValue&&(this._minimumValue= this._maximumValue-1);this.setValue(this._value)},isTouchInside:function(a){a=a.getLocation();a=this.getParent().convertToNodeSpace(a);var b=this.getBoundingBox();b.width+=this._thumbSprite.getContentSize().width;b.x-=this._thumbSprite.getContentSize().width/2;return cc.rectContainsPoint(b,a)},locationFromTouch:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width&&(a.x=this._backgroundSprite.getContentSize().width);return a},getMinimumAllowedValue:function(){return this._minimumAllowedValue}, setMinimumAllowedValue:function(a){this._minimumAllowedValue=a},getMaximumAllowedValue:function(){return this._maximumAllowedValue},setMaximumAllowedValue:function(a){this._maximumAllowedValue=a},getThumbSprite:function(){return this._thumbSprite},getProgressSprite:function(){return this._progressSprite},getBackgroundSprite:function(){return this._backgroundSprite},initWithSprites:function(a,b,c){return cc.Control.prototype.init.call(this)?(this.ignoreAnchorPointForPosition(!1),this._backgroundSprite= a,this._progressSprite=b,this._thumbSprite=c,a=cc.ControlUtils.CCRectUnion(a.getBoundingBox(),c.getBoundingBox()),this.setContentSize(a.width,a.height),this._backgroundSprite.setAnchorPoint(0.5,0.5),this._backgroundSprite.setPosition(a.width/2,a.height/2),this.addChild(this._backgroundSprite),this._progressSprite.setAnchorPoint(0,0.5),this._progressSprite.setPosition(0,a.height/2),this.addChild(this._progressSprite),this._thumbSprite.setPosition(0,a.height/2),this.addChild(this._thumbSprite),this._minimumValue= 0,this._maximumValue=1,this.setValue(this._minimumValue),!0):!1},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._thumbSprite&&this._thumbSprite.setOpacity(a?255:128)},sliderBegan:function(a){this.setSelected(!0);this._thumbSprite.setColor(cc.color.GRAY);this.setValue(this.valueForLocation(a))},sliderMoved:function(a){this.setValue(this.valueForLocation(a))},sliderEnded:function(a){this.isSelected()&&this.setValue(this.valueForLocation(this._thumbSprite.getPosition()));this._thumbSprite.setColor(cc.color.WHITE); this.setSelected(!1)},getTouchLocationInControl:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H&&(a.x=this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H);return a},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;var c=this.locationFromTouch(a);this.sliderBegan(c);return!0},onTouchMoved:function(a,b){var c=this.locationFromTouch(a);this.sliderMoved(c)}, onTouchEnded:function(a,b){this.sliderEnded(cc.p(0,0))},needsLayout:function(){this._thumbSprite.setPositionX((this._value-this._minimumValue)/(this._maximumValue-this._minimumValue)*this._backgroundSprite.getContentSize().width);var a=this._progressSprite.getTextureRect(),a=cc.rect(a.x,a.y,this._thumbSprite.getPositionX(),a.height);this._progressSprite.setTextureRect(a,this._progressSprite.isTextureRectRotated());this._thumbSprite._renderCmd.transform(this._renderCmd)},valueForLocation:function(a){a= a.x/this._backgroundSprite.getContentSize().width;return Math.max(Math.min(this._minimumValue+a*(this._maximumValue-this._minimumValue),this._maximumAllowedValue),this._minimumAllowedValue)}});_p=cc.ControlSlider.prototype;cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue);cc.defineGetterSetter(_p,"minAllowedValue",_p.getMinimumAllowedValue,_p.setMinimumAllowedValue); cc.defineGetterSetter(_p,"maxAllowedValue",_p.getMaximumAllowedValue,_p.setMaximumAllowedValue);cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite);cc.defineGetterSetter(_p,"progressSprite",_p.getProgressSprite);cc.defineGetterSetter(_p,"backgroundSprite",_p.getBackgroundSprite);_p=null;cc.ControlSlider.create=function(a,b,c){return new cc.ControlSlider(a,b,c)};cc.ControlSwitch=cc.Control.extend({_switchSprite:null,_initialTouchXPosition:0,_moved:!1,_on:!1,_className:"ControlSwitch",ctor:function(a,b,c,d,e,f){cc.Control.prototype.ctor.call(this);f&&this.initWithMaskSprite(a,b,c,d,e,f)},initWithMaskSprite:function(a,b,c,d,e,f){if(!a)throw Error("cc.ControlSwitch.initWithMaskSprite(): maskSprite should be non-null.");if(!b)throw Error("cc.ControlSwitch.initWithMaskSprite(): onSprite should be non-null.");if(!c)throw Error("cc.ControlSwitch.initWithMaskSprite(): offSprite should be non-null."); if(!d)throw Error("cc.ControlSwitch.initWithMaskSprite(): thumbSprite should be non-null.");return this.init()?(this._on=!0,this._switchSprite=new cc.ControlSwitchSprite,this._switchSprite.initWithMaskSprite(a,b,c,d,e,f),this._switchSprite.setPosition(this._switchSprite.getContentSize().width/2,this._switchSprite.getContentSize().height/2),this.addChild(this._switchSprite),this.ignoreAnchorPointForPosition(!1),this.setAnchorPoint(0.5,0.5),this.setContentSize(this._switchSprite.getContentSize()),!0): !1},setOn:function(a,b){b=b||!1;var c=(this._on=a)?this._switchSprite.getOnPosition():this._switchSprite.getOffPosition();b?this._switchSprite.runAction(new cc.ActionTween(0.2,"sliderXPosition",this._switchSprite.getSliderXPosition(),c)):this._switchSprite.setSliderXPosition(c);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},isOn:function(){return this._on},hasMoved:function(){return this._moved},setEnabled:function(a){this._enabled=a;this._switchSprite.setOpacity(a?255:128)},locationFromTouch:function(a){a= a.getLocation();return a=this.convertToNodeSpace(a)},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;this._moved=!1;this._initialTouchXPosition=this.locationFromTouch(a).x-this._switchSprite.getSliderXPosition();this._switchSprite.getThumbSprite().setColor(cc.color.GRAY);this._switchSprite.needsLayout();return!0},onTouchMoved:function(a,b){var c=this.locationFromTouch(a),c=cc.p(c.x-this._initialTouchXPosition,0);this._moved=!0;this._switchSprite.setSliderXPosition(c.x)}, onTouchEnded:function(a,b){var c=this.locationFromTouch(a);this._switchSprite.getThumbSprite().setColor(cc.color.WHITE);this.hasMoved()?this.setOn(!(c.x=this._onPosition&&(a=this._onPosition);this._sliderXPosition=a;this.needsLayout()},getSliderXPosition:function(){return this._sliderXPosition},_getOnSideWidth:function(){return this._onSprite.getContentSize().width},_getOffSideWidth:function(){return this._offSprite.getContentSize().height},updateTweenAction:function(a,b){"sliderXPosition"===b&&this.setSliderXPosition(a)},setOnPosition:function(a){this._onPosition= a},getOnPosition:function(){return this._onPosition},setOffPosition:function(a){this._offPosition=a},getOffPosition:function(){return this._offPosition},setMaskTexture:function(a){this._stencil.setTexture(a)},getMaskTexture:function(){return this._stencil.getTexture()},setTextureLocation:function(a){this._textureLocation=a},getTextureLocation:function(){return this._textureLocation},setMaskLocation:function(a){this._maskLocation=a},getMaskLocation:function(){return this._maskLocation},setOnSprite:function(a){this._onSprite= a},getOnSprite:function(){return this._onSprite},setOffSprite:function(a){this._offSprite=a},getOffSprite:function(){return this._offSprite},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite},setOnLabel:function(a){this._onLabel=a},getOnLabel:function(){return this._onLabel},setOffLabel:function(a){this._offLabel=a},getOffLabel:function(){return this._offLabel}});_p=cc.ControlSwitchSprite.prototype; cc.defineGetterSetter(_p,"sliderX",_p.getSliderXPosition,_p.setSliderXPosition);cc.defineGetterSetter(_p,"onPos",_p.getOnPosition,_p.setOnPosition);cc.defineGetterSetter(_p,"offPos",_p.getOffPosition,_p.setOffPosition);cc.defineGetterSetter(_p,"maskTexture",_p.getMaskTexture,_p.setMaskTexture);cc.defineGetterSetter(_p,"maskPos",_p.getMaskLocation,_p.setMaskLocation);cc.defineGetterSetter(_p,"onSprite",_p.getOnSprite,_p.setOnSprite);cc.defineGetterSetter(_p,"offSprite",_p.getOffSprite,_p.setOffSprite); cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite,_p.setThumbSprite);cc.defineGetterSetter(_p,"onLabel",_p.getOnLabel,_p.setOnLabel);cc.defineGetterSetter(_p,"offLabel",_p.getOffLabel,_p.setOffLabel);cc.defineGetterSetter(_p,"onSideWidth",_p._getOnSideWidth);cc.defineGetterSetter(_p,"offSideWidth",_p._getOffSideWidth);_p=null;cc.CONTROL_STEPPER_PARTMINUS=0;cc.CONTROL_STEPPER_PARTPLUS=1;cc.CONTROL_STEPPER_PARTNONE=2;cc.CONTROL_STEPPER_LABELCOLOR_ENABLED=cc.color(55,55,55);cc.CONTROL_STEPPER_LABELCOLOR_DISABLED=cc.color(147,147,147);cc.CONTROL_STEPPER_LABELFONT="CourierNewPSMT";cc.AUTOREPEAT_DELTATIME=0.15;cc.AUTOREPEAT_INCREASETIME_INCREMENT=12; cc.ControlStepper=cc.Control.extend({_minusSprite:null,_plusSprite:null,_minusLabel:null,_plusLabel:null,_value:0,_continuous:!1,_autorepeat:!1,_wraps:!1,_minimumValue:0,_maximumValue:0,_stepValue:0,_touchInsideFlag:!1,_touchedPart:cc.CONTROL_STEPPER_PARTNONE,_autorepeatCount:0,_className:"ControlStepper",ctor:function(a,b){cc.Control.prototype.ctor.call(this);this._plusLabel=this._minusLabel=this._plusSprite=this._minusSprite=null;this._value=0;this._wraps=this._autorepeat=this._continuous=!1;this._stepValue= this._maximumValue=this._minimumValue=0;this._touchInsideFlag=!1;this._touchedPart=cc.CONTROL_STEPPER_PARTNONE;this._autorepeatCount=0;b&&this.initWithMinusSpriteAndPlusSprite(a,b)},initWithMinusSpriteAndPlusSprite:function(a,b){if(!a)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Minus sprite should be non-null.");if(!b)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Plus sprite should be non-null.");if(this.init()){this._continuous=this._autorepeat=!0;this._minimumValue= 0;this._maximumValue=100;this._value=0;this._stepValue=1;this._wraps=!1;this.ignoreAnchorPointForPosition(!1);this.setMinusSprite(a);this._minusSprite.setPosition(a.getContentSize().width/2,a.getContentSize().height/2);this.addChild(this._minusSprite);this.setMinusLabel(new cc.LabelTTF("-",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER));this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_DISABLED);this._minusLabel.setPosition(this._minusSprite.getContentSize().width/ 2,this._minusSprite.getContentSize().height/2);this._minusSprite.addChild(this._minusLabel);this.setPlusSprite(b);this._plusSprite.setPosition(a.getContentSize().width+b.getContentSize().width/2,a.getContentSize().height/2);this.addChild(this._plusSprite);this.setPlusLabel(new cc.LabelTTF("+",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER));this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED);this._plusLabel.setPosition(this._plusSprite.getContentSize().width/ 2,this._plusSprite.getContentSize().height/2);this._plusSprite.addChild(this._plusLabel);var c=cc.ControlUtils.CCRectUnion(this._minusSprite.getBoundingBox(),this._plusSprite.getBoundingBox());this.setContentSize(this._minusSprite.getContentSize().width+this._plusSprite.getContentSize().height,c.height);return!0}return!1},setWraps:function(a){if(this._wraps=a)this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED);this.setValue(this._value)}, getWraps:function(){return this._wraps},setMinimumValue:function(a){if(a>=this._maximumValue)throw Error("cc.ControlStepper.setMinimumValue(): minimumValue should be numerically less than maximumValue.");this._minimumValue=a;this.setValue(this._value)},getMinimumValue:function(){return this._minimumValue},setMaximumValue:function(a){if(a<=this._minimumValue)throw Error("cc.ControlStepper.setMaximumValue(): maximumValue should be numerically less than maximumValue.");this._maximumValue=a;this.setValue(this._value)}, getMaximumValue:function(){return this._maximumValue},setValue:function(a){this.setValueWithSendingEvent(a,!0)},getValue:function(){return this._value},setStepValue:function(a){if(0>=a)throw Error("cc.ControlStepper.setMaximumValue(): stepValue should be numerically greater than 0.");this._stepValue=a},getStepValue:function(){return this._stepValue},isContinuous:function(){return this._continuous},setValueWithSendingEvent:function(a,b){athis._maximumValue&&(a=this._wraps?this._minimumValue:this._maximumValue);this._value=a;this._wraps||(this._minusLabel.setColor(a===this._minimumValue?cc.CONTROL_STEPPER_LABELCOLOR_DISABLED:cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setColor(a===this._maximumValue?cc.CONTROL_STEPPER_LABELCOLOR_DISABLED:cc.CONTROL_STEPPER_LABELCOLOR_ENABLED));b&&this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},startAutorepeat:function(){this._autorepeatCount=-1;this.schedule(this.update, cc.AUTOREPEAT_DELTATIME,cc.REPEAT_FOREVER,3*cc.AUTOREPEAT_DELTATIME)},stopAutorepeat:function(){this.unschedule(this.update)},update:function(a){this._autorepeatCount++;this._autorepeatCountthis._minimumValue?(this._touchedPart=cc.CONTROL_STEPPER_PARTMINUS,this._minusSprite.setColor(cc.color.GRAY),this._plusSprite.setColor(cc.color.WHITE)):a.x>=this._minusSprite.getContentSize().width&&this._valuethis._maximumValue&&(a=this._maximumValue);this._value=a;a=(a-this._minimumValue)/(this._maximumValue- this._minimumValue);this._progressTimer.setPercentage(100*a);this._thumbSprite.setRotation(360*a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},getValue:function(){return this._value},setMinimumValue:function(a){this._minimumValue=a;this._minimumValue>=this._maximumValue&&(this._maximumValue=this._minimumValue+1);this.setValue(this._maximumValue)},getMinimumValue:function(){return this._minimumValue},setMaximumValue:function(a){this._maximumValue=a;this._maximumValue<=this._minimumValue&& (this._minimumValue=this._maximumValue-1);this.setValue(this._minimumValue)},getMaximumValue:function(){return this._maximumValue},isTouchInside:function(a){a=this.getTouchLocation(a);return this.distanceBetweenPointAndPoint(this._progressTimer.getPosition(),a)b&&(b+=360);this.setValue(this._value+b/360*(this._maximumValue-this._minimumValue));this._previousLocation=a},potentiometerEnded:function(a){this.getThumbSprite().setColor(cc.color.WHITE);this.setSelected(!1)},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite}, setProgressTimer:function(a){this._progressTimer=a},getProgressTimer:function(){return this._progressTimer},setPreviousLocation:function(a){this._previousLocation=a},getPreviousLocation:function(){return this._previousLocation}});_p=cc.ControlPotentiometer.prototype;cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue); cc.defineGetterSetter(_p,"progressTimer",_p.getProgressTimer,_p.setProgressTimer);cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite,_p.setThumbSprite);cc.defineGetterSetter(_p,"prevLocation",_p.getPreviousLocation,_p.setPreviousLocation);_p=null;cc.ControlPotentiometer.create=function(a,b,c){return new cc.ControlPotentiometer(a,b,c)};cc.SCROLLVIEW_DIRECTION_NONE=-1;cc.SCROLLVIEW_DIRECTION_HORIZONTAL=0;cc.SCROLLVIEW_DIRECTION_VERTICAL=1;cc.SCROLLVIEW_DIRECTION_BOTH=2;var SCROLL_DEACCEL_RATE=0.95,SCROLL_DEACCEL_DIST=1,BOUNCE_DURATION=0.15,INSET_RATIO=0.2,MOVE_INCH=0.04375,BOUNCE_BACK_FACTOR=0.35;cc.convertDistanceFromPointToInch=function(a){var b=cc.view,b=(b.getScaleX()+b.getScaleY())/2;return a*b/160};cc.ScrollViewDelegate=cc.Class.extend({scrollViewDidScroll:function(a){},scrollViewDidZoom:function(a){}}); cc.ScrollView=cc.Layer.extend({_zoomScale:0,_minZoomScale:0,_maxZoomScale:0,_delegate:null,_direction:cc.SCROLLVIEW_DIRECTION_BOTH,_dragging:!1,_contentOffset:null,_container:null,_touchMoved:!1,_maxInset:null,_minInset:null,_bounceable:!1,_clippingToBounds:!1,_scrollDistance:null,_touchPoint:null,_touchLength:0,_touches:null,_viewSize:null,_minScale:0,_maxScale:0,_parentScissorRect:null,_scissorRestored:!1,_tmpViewRect:null,_touchListener:null,_className:"ScrollView",ctor:function(a,b){cc.Layer.prototype.ctor.call(this); this._contentOffset=cc.p(0,0);this._maxInset=cc.p(0,0);this._minInset=cc.p(0,0);this._scrollDistance=cc.p(0,0);this._touchPoint=cc.p(0,0);this._touches=[];this._viewSize=cc.size(0,0);this._parentScissorRect=new cc.Rect(0,0,0,0);this._tmpViewRect=new cc.Rect(0,0,0,0);void 0!=b?this.initWithViewSize(a,b):this.initWithViewSize(cc.size(200,200),null)},init:function(){return this.initWithViewSize(cc.size(200,200),null)},initWithViewSize:function(a,b){var c=cc.p(0,0);return cc.Layer.prototype.init.call(this)? (b||this._container||(b=new cc.Layer),b&&this.setContainer(b),this.setViewSize(a),this.setTouchEnabled(!0),this._touches.length=0,this._delegate=null,this._clippingToBounds=this._bounceable=!0,this._direction=cc.SCROLLVIEW_DIRECTION_BOTH,this._container.setPosition(c),this._touchLength=0,this._minScale=this._maxScale=1,!0):!1},visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){a=cc.renderer;b.visit(c);this._clippingToBounds&&a.pushRenderCommand(b.startCmd);var d=this._children, e=d.length;if(0b.y||eb.x||dc&&(a.x+=b.width*c,c=-c);0>d&&(a.y+=b.height*d,d=-d);e=this._tmpViewRect;e.x=a.x;e.y=a.y;e.width=b.width*c;e.height=b.height*d;return e},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ScrollView.CanvasRenderCmd(this):new cc.ScrollView.WebGLRenderCmd(this)}});_p=cc.ScrollView.prototype; cc.defineGetterSetter(_p,"minOffset",_p.minContainerOffset);cc.defineGetterSetter(_p,"maxOffset",_p.maxContainerOffset);cc.defineGetterSetter(_p,"bounceable",_p.isBounceable,_p.setBounceable);cc.defineGetterSetter(_p,"viewSize",_p.getViewSize,_p.setViewSize);cc.defineGetterSetter(_p,"container",_p.getContainer,_p.setContainer);cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"delegate",_p.getDelegate,_p.setDelegate); cc.defineGetterSetter(_p,"clippingToBounds",_p.isClippingToBounds,_p.setClippingToBounds);_p=null;cc.ScrollView.create=function(a,b){return new cc.ScrollView(a,b)};(function(){cc.ScrollView.CanvasRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.startCmd._canUseDirtyRegion=!0;this.endCmd=new cc.CustomRenderCmd(this,this._endCmd);this.endCmd._canUseDirtyRegion=!0};var a=cc.ScrollView.CanvasRenderCmd.prototype=Object.create(cc.Layer.CanvasRenderCmd.prototype);a.constructor=cc.ScrollView.CanvasRenderCmd;a._startCmd=function(a,c,d){var e=this._node,f=a||cc._renderContext;a=f.getContext(); f.save();e._clippingToBounds&&(this._scissorRestored=!1,f.setTransform(this._worldTransform,c,d),d=e.getScaleX(),c=e.getScaleY(),d*=e._viewSize.width,e=e._viewSize.height*c,a.beginPath(),a.rect(0,0,d,-e),a.closePath(),a.clip())};a._endCmd=function(a){a=a||cc._renderContext;a.restore()}})();(function(){cc.ScrollView.WebGLRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.endCmd=new cc.CustomRenderCmd(this,this._endCmd)};var a=cc.ScrollView.WebGLRenderCmd.prototype=Object.create(cc.Layer.WebGLRenderCmd.prototype);a.constructor=cc.ScrollView.WebGLRenderCmd;a._startCmd=function(){var a=this._node,c=cc.view,d=a._getViewRect();if(c.isScissorEnabled()){if(a._scissorRestored=!0,a._parentScissorRect=c.getScissorRect(), cc.rectIntersection(d,a._parentScissorRect)){var e=a._parentScissorRect,a=Math.max(d.x,e.x),f=Math.max(d.y,e.y),g=Math.min(d.x+d.width,e.x+e.width),d=Math.min(d.y+d.height,e.y+e.height);c.setScissorInPoints(a,f,g-a,d-f)}}else a=cc._renderContext,a.enable(a.SCISSOR_TEST),c.setScissorInPoints(d.x,d.y,d.width,d.height)};a._endCmd=function(){var a=this._node;a._scissorRestored?(a=a._parentScissorRect,cc.view.setScissorInPoints(a.x,a.y,a.width,a.height)):(a=cc._renderContext,a.disable(a.SCISSOR_TEST))}})();cc.SortableObject=cc.Class.extend({setObjectID:function(a){},getObjectID:function(){return 0}});cc.SortedObject=cc.SortableObject.extend({_objectID:0,ctor:function(){this._objectID=0},setObjectID:function(a){this._objectID=a},getObjectID:function(){return this._objectID}});var _compareObject=function(a,b){return a.getObjectID()-b.getObjectID()}; cc.ArrayForObjectSorting=cc.Class.extend({_saveObjectArr:null,ctor:function(){this._saveObjectArr=[]},insertSortedObject:function(a){if(!a)throw Error("cc.ArrayForObjectSorting.insertSortedObject(): addObject should be non-null.");var b=this.indexOfSortedObject(a);this.insertObject(a,b)},removeSortedObject:function(a){if(0!==this.count()){var b=this.indexOfSortedObject(a);b=c&&a=b;){var e=0|b+(c-b)/2,f=d[e],g=d[e+1];if(a>=f&&a<=g)return e;a=b?0:-1},_indexFromOffset:function(a){var b={x:a.x,y:a.y};a=this._dataSource.numberOfCellsInTableView(this)-1;this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y);b=this.__indexFromOffset(b);-1!==b&&(b=Math.max(0,b),b>a&&(b=cc.INVALID_INDEX)); return b},__offsetFromIndex:function(a){switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=cc.p(this._cellsPositions[a],0);break;default:a=cc.p(0,this._cellsPositions[a])}return a},_offsetFromIndex:function(a){var b=this.__offsetFromIndex(a);a=this._dataSource.tableCellSizeForIndex(this,a);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y-a.height);return b},_updateCellPositions:function(){var a=this._dataSource.numberOfCellsInTableView(this), b=this._cellsPositions;if(0this._dataSource.numberOfCellsInTableView(this)-1)){var b=this.cellAtIndex(a);b&&this._moveCellOutOfSight(b);b=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,b);this._addCellIfNecessary(b)}},insertCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)- 1)){var b,c=this._cellsUsed;if(b=c.objectWithObjectID(a))for(var d=b=c.indexOfSortedObject(b);dthis._dataSource.numberOfCellsInTableView(this)-1)){var b=this.cellAtIndex(a);if(b){var c=this._cellsUsed,d=c.indexOfSortedObject(b); this._moveCellOutOfSight(b);cc.arrayRemoveObject(this._indices,a);this._updateCellPositions();for(a=c.count()-1;a>d;a--)b=c.objectAtIndex(a),this._setIndexForCell(b.getIdx()-1,b)}}},reloadData:function(){this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;for(var a=this._cellsUsed,b=this._cellsFreed,c=this.getContainer(),d=0,e=a.count();dd;)if(this._moveCellOutOfSight(b),0=d,h=c.readInt(!1),k=c.readCachedString(),m=!1,n=c._data[c._currentByte++]; if(n===CCB_PLATFORM_ALL||n===CCB_PLATFORM_IOS||n===CCB_PLATFORM_MAC)m=!0;g&&(a.ccbFileNode?(a=a.ccbFileNode,m=-1!==a.userObject.indexOf(k)):a===c._animationManager.getRootNode()&&(g=a.userObject,g||(g=[],a.userObject=g),g.push(k)));switch(h){case CCB_PROPTYPE_POSITION:h=this.parsePropTypePosition(a,b,c,k);if(m)this.onHandlePropTypePosition(a,b,k,h,c);break;case CCB_PROPTYPE_POINT:h=this.parsePropTypePoint(a,b,c);if(m)this.onHandlePropTypePoint(a,b,k,h,c);break;case CCB_PROPTYPE_POINTLOCK:h=this.parsePropTypePointLock(a, b,c);if(m)this.onHandlePropTypePointLock(a,b,k,h,c);break;case CCB_PROPTYPE_SIZE:h=this.parsePropTypeSize(a,b,c);if(m)this.onHandlePropTypeSize(a,b,k,h,c);break;case CCB_PROPTYPE_SCALELOCK:h=this.parsePropTypeScaleLock(a,b,c,k);if(m)this.onHandlePropTypeScaleLock(a,b,k,h,c);break;case CCB_PROPTYPE_FLOATXY:h=this.parsePropTypeFloatXY(a,b,c);if(m)this.onHandlePropTypeFloatXY(a,b,k,h,c);break;case CCB_PROPTYPE_FLOAT:h=this.parsePropTypeFloat(a,b,c);if(m)this.onHandlePropTypeFloat(a,b,k,h,c);break;case CCB_PROPTYPE_DEGREES:h= this.parsePropTypeDegrees(a,b,c,k);if(m)this.onHandlePropTypeDegrees(a,b,k,h,c);break;case CCB_PROPTYPE_FLOATSCALE:h=this.parsePropTypeFloatScale(a,b,c);if(m)this.onHandlePropTypeFloatScale(a,b,k,h,c);break;case CCB_PROPTYPE_INTEGER:h=this.parsePropTypeInteger(a,b,c);if(m)this.onHandlePropTypeInteger(a,b,k,h,c);break;case CCB_PROPTYPE_INTEGERLABELED:h=this.parsePropTypeIntegerLabeled(a,b,c);if(m)this.onHandlePropTypeIntegerLabeled(a,b,k,h,c);break;case CCB_PROPTYPE_FLOATVAR:h=this.parsePropTypeFloatVar(a, b,c);if(m)this.onHandlePropTypeFloatVar(a,b,k,h,c);break;case CCB_PROPTYPE_CHECK:h=this.parsePropTypeCheck(a,b,c,k);if(m)this.onHandlePropTypeCheck(a,b,k,h,c);break;case CCB_PROPTYPE_SPRITEFRAME:h=this.parsePropTypeSpriteFrame(a,b,c,k);if(m)this.onHandlePropTypeSpriteFrame(a,b,k,h,c);break;case CCB_PROPTYPE_ANIMATION:h=this.parsePropTypeAnimation(a,b,c);if(m)this.onHandlePropTypeAnimation(a,b,k,h,c);break;case CCB_PROPTYPE_TEXTURE:h=this.parsePropTypeTexture(a,b,c);if(m)this.onHandlePropTypeTexture(a, b,k,h,c);break;case CCB_PROPTYPE_BYTE:h=this.parsePropTypeByte(a,b,c,k);if(m)this.onHandlePropTypeByte(a,b,k,h,c);break;case CCB_PROPTYPE_COLOR3:h=this.parsePropTypeColor3(a,b,c,k);if(m)this.onHandlePropTypeColor3(a,b,k,h,c);break;case CCB_PROPTYPE_COLOR4VAR:h=this.parsePropTypeColor4FVar(a,b,c);if(m)this.onHandlePropTypeColor4FVar(a,b,k,h,c);break;case CCB_PROPTYPE_FLIP:h=this.parsePropTypeFlip(a,b,c);if(m)this.onHandlePropTypeFlip(a,b,k,h,c);break;case CCB_PROPTYPE_BLENDMODE:h=this.parsePropTypeBlendFunc(a, b,c);if(m)this.onHandlePropTypeBlendFunc(a,b,k,h,c);break;case CCB_PROPTYPE_FNTFILE:h=c.getCCBRootPath()+this.parsePropTypeFntFile(a,b,c);if(m)this.onHandlePropTypeFntFile(a,b,k,h,c);break;case CCB_PROPTYPE_FONTTTF:h=this.parsePropTypeFontTTF(a,b,c);if(m)this.onHandlePropTypeFontTTF(a,b,k,h,c);break;case CCB_PROPTYPE_STRING:h=this.parsePropTypeString(a,b,c);if(m)this.onHandlePropTypeString(a,b,k,h,c);break;case CCB_PROPTYPE_TEXT:h=this.parsePropTypeText(a,b,c);if(m)this.onHandlePropTypeText(a,b,k, h,c);break;case CCB_PROPTYPE_BLOCK:h=this.parsePropTypeBlock(a,b,c);if(m)this.onHandlePropTypeBlock(a,b,k,h,c);break;case CCB_PROPTYPE_BLOCKCCCONTROL:h=this.parsePropTypeBlockCCControl(a,b,c);if(m&&null!=h)this.onHandlePropTypeBlockCCControl(a,b,k,h,c);break;case CCB_PROPTYPE_CCBFILE:h=this.parsePropTypeCCBFile(a,b,c);if(m)this.onHandlePropTypeCCBFile(a,b,k,h,c);break;default:ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(h)}}},getCustomProperties:function(){return this._customProperties},_createCCNode:function(a, b){return new cc.Node},parsePropTypePosition:function(a,b,c,d){var e=c.readFloat(),f=c.readFloat(),g=c.readInt(!1);cc.getAbsolutePosition(e,f,g,b?b._contentSize:c._animationManager._rootContainerSize,d,this._pt);a.setPosition(this._pt);-1=e?0|255*e:e,f=0|255*c.readFloat(),g=0|255*c.readFloat(),h=0|255*c.readFloat();c=c.readFloat();this._arr2[0]={r:a,g:b,b:d,a:e};this._arr2[1]={r:f,g:g,b:h,a:1>=c?0|255*c:c};return this._arr2},parsePropTypeFlip:function(a,b,c){this._arr2[0]=!!c._data[c._currentByte++];this._arr2[1]=!!c._data[c._currentByte++];return this._arr2},parsePropTypeBlendFunc:function(a,b,c){a=c.readInt(!1);c=c.readInt(!1);return new cc.BlendFunc(a,c)},parsePropTypeFntFile:function(a,b,c){return c.readCachedString()}, parsePropTypeString:function(a,b,c){return c.readCachedString()},parsePropTypeText:function(a,b,c){return c.readCachedString()},parsePropTypeFontTTF:function(a,b,c){return c.readCachedString()},parsePropTypeBlock:function(a,b,c){b=c.readCachedString();var d=c.readInt(!1);if(d!==CCB_TARGETTYPE_NONE){var e=null;if(c._jsControlled)d===CCB_TARGETTYPE_DOCUMENTROOT?(c.addDocumentCallbackNode(a),c.addDocumentCallbackName(b),c.addDocumentCallbackControlEvents(0)):(c.addOwnerCallbackNode(a),c.addOwnerCallbackName(b), c.addOwnerCallbackControlEvents(0));else if(d===CCB_TARGETTYPE_DOCUMENTROOT?e=c._animationManager._rootNode:d===CCB_TARGETTYPE_OWNER&&(e=c._owner),null!==e)if(0this._data.length))throw Error("out of the data bound"); for(var e=0,f=b-1;0<=f;f--){d=!!(c&1<this._data.length))throw Error("out of the data bound");d&&(e|=1<>3;if(this._currentByte+c>=this._data.length)throw Error("Index out of bound");var d=Math.pow(2,b-1)-1,e=this._readBitsOnly(a+b,1,c),f=this._readBitsOnly(a,b,c),g=0,h=2,k=0;do for(var m=this._data[this._currentByte+c-++k-1],n=a%8||8,p=1<>=1;)m&p&&(g+=1/h),h*=2;while(a-=n);this._currentByte+= c;return f===(d<<1)+1?g?NaN:e?-Infinity:Infinity:(1+-2*e)*(f||g?f?Math.pow(2,f-d)*(1+g):Math.pow(2,-d+1)*g:0)},_readBitsOnly:function(a,b,c){var d=(a+b)%8,e=a%8,f=c-(a>>3)-1;a=c+(-(a+b)>>3);var g=f-a;b=this._data[this._currentByte+c-f-1]>>e&(1<<(g?8-e:b))-1;g&&d&&(b+=(this._data[this._currentByte+c-a-1]&(1<a.length||a.toLowerCase().lastIndexOf(".ccbi")!==a.length-5)a+=".ccbi";a=e.readNodeGraphFromFile(a,b,c);var f,g,h;if(b){d=e.getOwnerCallbackNames();var k=e.getOwnerCallbackNodes(),m=e.getOwnerCallbackControlEvents();for(c=0;c=b.length?0===a.lastIndexOf(b):!1};cc.BuilderReader.concat=function(a,b){return a+b};cc.loader.register(["ccbi"],cc._binaryLoader);cc.INT_VALUE=0;cc.FLOAT_VALUE=1;cc.POINTER_VALUE=2;cc.BOOL_VALUE=3;cc.UNSIGNEDCHAR_VALUE=4;cc.BuilderValue=cc.Class.extend({_value:null,_type:0,getIntValue:function(){},getFloatValue:function(){},getBoolValue:function(){},getByteValue:function(){},getPointer:function(){},getValue:function(){return this._value}});cc.BuilderValue.create=function(a){return new cc.BuilderValue};cc.BuilderKeyframe=cc.Class.extend({_value:null,_time:0,_easingType:0,_easingOpt:0,getValue:function(){return this._value},setValue:function(a){this._value=a},getTime:function(){return this._time},setTime:function(a){this._time=a},getEasingType:function(){return this._easingType},setEasingType:function(a){this._easingType=a},getEasingOpt:function(){return this._easingOpt},setEasingOpt:function(a){this._easingOpt=a}});cc.BuilderSequence=cc.Class.extend({_duration:0,_name:"",_sequenceId:0,_chainedSequenceId:0,_callbackChannel:null,_soundChannel:null,ctor:function(){this._name=""},getDuration:function(){return this._duration},setDuration:function(a){this._duration=a},getName:function(){return this._name},setName:function(a){this._name=a},getSequenceId:function(){return this._sequenceId},setSequenceId:function(a){this._sequenceId=a},getChainedSequenceId:function(){return this._chainedSequenceId},setChainedSequenceId:function(a){this._chainedSequenceId= a},getCallbackChannel:function(){return this._callbackChannel},setCallbackChannel:function(a){this._callbackChannel=a},getSoundChannel:function(){return this._soundChannel},setSoundChannel:function(a){this._soundChannel=a}}); cc.BuilderSequenceProperty=cc.Class.extend({_name:null,_type:0,_keyFrames:null,ctor:function(){this.init()},init:function(){this._keyFrames=[];this._name=""},getName:function(){return this._name},setName:function(a){this._name=a},getType:function(){return this._type},setType:function(a){this._type=a},getKeyframes:function(){return this._keyFrames}});cc.getAbsolutePosition=function(a,b,c,d,e,f){e=f||cc.p(0,0);c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT?(e.x=a,e.y=b):c===CCB_POSITIONTYPE_RELATIVE_TOP_LEFT?(e.x=a,e.y=d.height-b):c===CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT?(e.x=d.width-a,e.y=d.height-b):c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT?(e.x=d.width-a,e.y=b):c===CCB_POSITIONTYPE_PERCENT?(e.x=d.width*a/100,e.y=d.height*b/100):c===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(c=cc.BuilderReader.getResolutionScale(),e.x=a*c,e.y=b*c);return e}; cc.setRelativeScale=function(a,b,c,d,e){if(!a)throw Error("cc.setRelativeScale(): node should be non-null");d===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(d=cc.BuilderReader.getResolutionScale(),b*=d,c*=d);a.setScale(b,c)};(function(){var a=cc.p();cc.BuilderAnimationManagerDelegate=cc.Class.extend({completedAnimationSequenceNamed:function(a){}});cc.BuilderAnimationManager=cc.Class.extend({_sequences:null,_nodeSequences:null,_baseValues:null,_autoPlaySequenceId:0,_rootNode:null,_owner:null,_rootContainerSize:null,_delegate:null,_runningSequence:null,_documentOutletNames:null,_documentOutletNodes:null,_documentCallbackNames:null,_documentCallbackNodes:null,_documentCallbackControlEvents:null,_documentControllerName:"", _lastCompletedSequenceName:"",_keyframeCallbacks:null,_keyframeCallFuncs:null,_animationCompleteCallbackFunc:null,_target:null,_jsControlled:!1,ctor:function(){this._rootContainerSize=cc.size(0,0);this.init()},init:function(){this._sequences=[];this._nodeSequences=new cc._Dictionary;this._baseValues=new cc._Dictionary;this._documentOutletNames=[];this._documentOutletNodes=[];this._documentCallbackNames=[];this._documentCallbackNodes=[];this._documentCallbackControlEvents=[];this._keyframeCallbacks= [];this._keyframeCallFuncs={};return!0},getSequences:function(){return this._sequences},setSequences:function(a){this._sequences=a},getAutoPlaySequenceId:function(){return this._autoPlaySequenceId},setAutoPlaySequenceId:function(a){this._autoPlaySequenceId=a},getRootNode:function(){return this._rootNode},setRootNode:function(a){this._rootNode=a},getOwner:function(){return this._owner},setOwner:function(a){this._owner=a},addDocumentCallbackNode:function(a){this._documentCallbackNodes.push(a)},addDocumentCallbackName:function(a){this._documentCallbackNames.push(a)}, addDocumentCallbackControlEvents:function(a){this._documentCallbackControlEvents.push(a)},addDocumentOutletNode:function(a){this._documentOutletNodes.push(a)},addDocumentOutletName:function(a){this._documentOutletNames.push(a)},setDocumentControllerName:function(a){this._documentControllerName=a},getDocumentControllerName:function(){return this._documentControllerName},getDocumentCallbackNames:function(){return this._documentCallbackNames},getDocumentCallbackNodes:function(){return this._documentCallbackNodes}, getDocumentCallbackControlEvents:function(){return this._documentCallbackControlEvents},getDocumentOutletNames:function(){return this._documentOutletNames},getDocumentOutletNodes:function(){return this._documentOutletNodes},getLastCompletedSequenceName:function(){return this._lastCompletedSequenceName},getKeyframeCallbacks:function(){return this._keyframeCallbacks},getRootContainerSize:function(){return this._rootContainerSize},setRootContainerSize:function(a){this._rootContainerSize=cc.size(a.width, a.height)},getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},getRunningSequenceName:function(){return this._runningSequence?this._runningSequence.getName():null},getContainerSize:function(a){return a?a.getContentSize():this._rootContainerSize},addNode:function(a,c){this._nodeSequences.setObject(c,a)},setBaseValue:function(a,c,d){var e=this._baseValues.objectForKey(c);e||(e=new cc._Dictionary,this._baseValues.setObject(e,c));e.setObject(a,d)},moveAnimationsFromNode:function(a, c){var d=this._baseValues,e=d.objectForKey(a);null!==e&&(d.setObject(e,c),d.removeObjectForKey(a));d=this._nodeSequences;e=d.objectForKey(a);null!=e&&(d.setObject(e,c),d.removeObjectForKey(a))},getActionForCallbackChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;fd.length?null:cc.sequence(d)},getActionForSoundChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;fd.length?null:cc.sequence(d)},runAnimationsForSequenceNamed:function(a){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),0)},runAnimationsForSequenceNamedTweenDuration:function(a,c){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),c)},runAnimationsForSequenceIdTweenDuration:function(a, c){if(-1===a)throw Error("cc.BuilderAnimationManager.runAnimationsForSequenceIdTweenDuration(): Sequence id should not be -1");c=c||0;this._rootNode.stopAllActions();for(var d=this._nodeSequences.allKeys(),e=0,f=d.length;e=this._maxLength&&(a=a.slice(0,this._maxLength));this._text=a;this._renderCmd.setString(a)},setFontColor:function(a){this._textColor= a;this._renderCmd.setFontColor(a)},setMaxLength:function(a){isNaN(a)||(0>a&&(a=65535),this._maxLength=a,this._renderCmd.setMaxLength(a))},getMaxLength:function(){return this._maxLength},setPlaceHolder:function(a){null!==a&&(this._renderCmd.setPlaceHolder(a),this._placeholderText=a)},setPlaceholderFont:function(a,b){this._placeholderFontName=a;this._placeholderFontSize=b;this._renderCmd._updateDOMPlaceholderFontStyle()},_setPlaceholderFont:function(a){if(a=cc.LabelTTF._fontStyleRE.exec(a))this._placeholderFontName= a[2],this._placeholderFontSize=parseInt(a[1]),this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontName:function(a){this._placeholderFontName=a;this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontSize:function(a){this._placeholderFontSize=a;this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontColor:function(a){this._placeholderColor=a;this._renderCmd.setPlaceholderFontColor(a)},setInputFlag:function(a){this._editBoxInputFlag=a;this._renderCmd.setInputFlag(a)}, getString:function(){return this._text},initWithSizeAndBackgroundSprite:function(a,b){this._backgroundSprite&&this._backgroundSprite.removeFromParent();this._backgroundSprite=b;this.setContentSize(a);this._backgroundSprite&&!this._backgroundSprite.parent&&(this._backgroundSprite.setAnchorPoint(cc.p(0,0)),this.addChild(this._backgroundSprite),this._updateBackgroundSpriteSize(a.width,a.height));this.y=this.x=0;return!0},setDelegate:function(a){this._delegate=a},getPlaceHolder:function(){return this._placeholderText}, setInputMode:function(a){if(this._editBoxInputMode!==a){var b=this.getString();this._editBoxInputMode=a;this._renderCmd.setInputMode(a);this._renderCmd.transform();this.setString(b);this._renderCmd._updateLabelPosition(this.getContentSize())}},setReturnType:function(a){this._keyboardReturnType=a;this._renderCmd._updateDomInputType()},initWithBackgroundColor:function(a,b){this._edWidth=a.width;this.dom.style.width=this._edWidth.toString()+"px";this._edHeight=a.height;this.dom.style.height=this._edHeight.toString()+ "px";this.dom.style.backgroundColor=cc.colorToHex(b)}});_p=cc.EditBox.prototype;cc.defineGetterSetter(_p,"font",null,_p._setFont);cc.defineGetterSetter(_p,"fontName",null,_p.setFontName);cc.defineGetterSetter(_p,"fontSize",null,_p.setFontSize);cc.defineGetterSetter(_p,"fontColor",null,_p.setFontColor);cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"maxLength",_p.getMaxLength,_p.setMaxLength);cc.defineGetterSetter(_p,"placeholder",_p.getPlaceHolder,_p.setPlaceHolder); cc.defineGetterSetter(_p,"placeholderFont",null,_p._setPlaceholderFont);cc.defineGetterSetter(_p,"placeholderFontName",null,_p.setPlaceholderFontName);cc.defineGetterSetter(_p,"placeholderFontSize",null,_p.setPlaceholderFontSize);cc.defineGetterSetter(_p,"placeholderFontColor",null,_p.setPlaceholderFontColor);cc.defineGetterSetter(_p,"inputFlag",null,_p.setInputFlag);cc.defineGetterSetter(_p,"delegate",null,_p.setDelegate);cc.defineGetterSetter(_p,"inputMode",null,_p.setInputMode); cc.defineGetterSetter(_p,"returnType",null,_p.setReturnType);_p=null;cc.EditBox.create=function(a,b,c,d){return new cc.EditBox(a,b,c,d)};(function(a){a._polyfill={zoomInvalid:!1};cc.sys.OS_ANDROID!==cc.sys.os||cc.sys.browserType!==cc.sys.BROWSER_TYPE_SOUGOU&&cc.sys.browserType!==cc.sys.BROWSER_TYPE_360||(a._polyfill.zoomInvalid=!0)})(cc.EditBox); (function(a){function b(a){var b=a.convertToWorldSpace(cc.p(0,0)),e=cc.visibleRect.height,f=0.5;cc.visibleRect.width>e&&(f=0.7);setTimeout(function(){if(window.scrollYa&&(a=35);320this.maxLength&&(this.value=this.value.slice(0,this.maxLength));b._delegate&&b._delegate.editBoxTextChanged&&b._text!==this.value&&(b._text=this.value,a._updateDomTextCases(),b._delegate.editBoxTextChanged(b,b._text))});b.addEventListener("keypress",function(b){var c=a._editBox;b.keyCode===cc.KEY.enter&&(b.stopPropagation(),b.preventDefault(),""===this.value&&(this.style.fontSize=c._placeholderFontSize+"px",this.style.color= cc.colorToHex(c._placeholderColor)),c._text=this.value,a._updateDomTextCases(),a._endEditing(),c._delegate&&c._delegate.editBoxReturn&&c._delegate.editBoxReturn(c),cc._canvas.focus())});b.addEventListener("focus",function(){var b=a._editBox;this.style.fontSize=a._edFontSize+"px";this.style.color=cc.colorToHex(b._textColor);a._hiddenLabels();cc.sys.isMobile&&a._onFocusOnMobile(b);b._delegate&&b._delegate.editBoxEditingDidBegin&&b._delegate.editBoxEditingDidBegin(b)});b.addEventListener("blur",function(){var b= a._editBox;b._text=this.value;a._updateDomTextCases();b._delegate&&b._delegate.editBoxEditingDidEnd&&b._delegate.editBoxEditingDidEnd(b);""===this.value&&(this.style.fontSize=b._placeholderFontSize+"px",this.style.color=cc.colorToHex(b._placeholderColor));a._endEditing()});this._addDomToGameContainer();return b};f._createDomTextArea=function(){this._removeDomFromGameContainer();var a=this,b=this._edTxt=document.createElement("textarea");b.type="text";b.style.fontFamily=this._edFontName;b.style.fontSize= this._edFontSize+"px";b.style.color="#000000";b.style.border=0;b.style.background="transparent";b.style.width="100%";b.style.height="100%";b.style.active=0;b.style.outline="medium";b.style.padding="0";b.style.resize="none";b.style.textTransform="uppercase";b.style.overflow_y="scroll";b.style.display="none";b.style.position="absolute";b.style.bottom="0px";b.style.left="2px";b.style.className="cocosEditBox";this.setMaxLength(a._editBox._maxLength);b.addEventListener("input",function(){this.value.length> this.maxLength&&(this.value=this.value.slice(0,this.maxLength));var b=a._editBox;b._delegate&&b._delegate.editBoxTextChanged&&b._text.toLowerCase()!==this.value.toLowerCase()&&(b._text=this.value,a._updateDomTextCases(),b._delegate.editBoxTextChanged(b,b._text))});b.addEventListener("focus",function(){var b=a._editBox;a._hiddenLabels();this.style.fontSize=a._edFontSize+"px";this.style.color=cc.colorToHex(b._textColor);cc.sys.isMobile&&a._onFocusOnMobile(b);b._delegate&&b._delegate.editBoxEditingDidBegin&& b._delegate.editBoxEditingDidBegin(b)});b.addEventListener("keypress",function(b){var c=a._editBox;b.keyCode===cc.KEY.enter&&(b.stopPropagation(),c._delegate&&c._delegate.editBoxReturn&&c._delegate.editBoxReturn(c))});b.addEventListener("blur",function(){var b=a._editBox;b._text=this.value;a._updateDomTextCases();b._delegate&&b._delegate.editBoxEditingDidEnd&&b._delegate.editBoxEditingDidEnd(b);""===this.value&&(this.style.fontSize=b._placeholderFontSize+"px",this.style.color=cc.colorToHex(b._placeholderColor)); a._endEditing()});this._addDomToGameContainer();return b};f._createLabels=function(){var a=this._editBox.getContentSize();this._textLabel||(this._textLabel=new cc.LabelTTF,this._textLabel.setAnchorPoint(cc.p(0,1)),this._editBox.addChild(this._textLabel,100));this._placeholderLabel||(this._placeholderLabel=new cc.LabelTTF,this._placeholderLabel.setAnchorPoint(cc.p(0,1)),this._placeholderLabel.setColor(cc.color.GRAY),this._editBox.addChild(this._placeholderLabel,100));this._updateLabelPosition(a)}; f._removeLabels=function(){this._textLabel&&(this._editBox.removeChild(this._textLabel),this._textLabel=null)};f._updateLabelPosition=function(a){if(this._textLabel&&this._placeholderLabel){var b=cc.size(a.width-2,a.height);this._textLabel.setContentSize(b);this._textLabel.setDimensions(b);this._placeholderLabel.setLineHeight(a.height);b=this._placeholderLabel.getContentSize();this._editBox._editBoxInputMode===cc.EDITBOX_INPUT_MODE_ANY?(this._textLabel.setPosition(2,a.height),this._placeholderLabel.setPosition(2, a.height),this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP),this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP)):(this._textLabel.setPosition(2,a.height),this._placeholderLabel.setPosition(2,(a.height+b.height)/2),this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER))}};f.setLineHeight=function(a){this._textLabel&&this._textLabel.setLineHeight(a)};f._hiddenLabels= function(){this._textLabel&&this._textLabel.setVisible(!1);this._placeholderLabel&&this._placeholderLabel.setVisible(!1)};f._updateDomTextCases=function(){var a=this._editBox._editBoxInputFlag;if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS)this._editBox._text=this._editBox._text.toUpperCase();else if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD)this._editBox._text=e(this._editBox._text);else if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE){var a=this._editBox,b;b=this._editBox._text;b= b.charAt(0).toUpperCase()+b.slice(1);a._text=b}};f._updateLabelStringStyle=function(){if("password"===this._edTxt.type){for(var a="",b=this._editBox._text.length,c=0;cf._localZOrder)f.visit(this);else break;for(f=0;fk._localZOrder)b._changeProtectedChild(k),k.visit(this);else break;for(a.pushRenderCommand(b);c=a.width||0>=a.height?this._positionPercent.x=this._positionPercent.y=0:(this._positionPercent.x=b.x/a.width,this._positionPercent.y=b.y/a.height);break;case ccui.Widget.POSITION_PERCENT:b=cc.p(a.width*this._positionPercent.x,a.height*this._positionPercent.y)}if(this._parent instanceof ccui.ImageView&&(a=this._parent._imageRenderer)&& !a._textureLoaded)return;this.setPosition(b)},setSizeType:function(a){this._sizeType=a;this._usingLayoutComponent&&this._getOrCreateLayoutComponent().setUsingPercentContentSize(this._sizeType===ccui.SIZE_PERCENT)},getSizeType:function(){return this._sizeType},ignoreContentAdaptWithSize:function(a){this._unifySize?this.setContentSize(this._customSize):this._ignoreSize!==a&&(this._ignoreSize=a,this.setContentSize(a?this.getVirtualRendererSize():this._customSize))},isIgnoreContentAdaptWithSize:function(){return this._ignoreSize}, getCustomSize:function(){return cc.size(this._customSize)},getLayoutSize:function(){return cc.size(this._contentSize)},getSizePercent:function(){this._usingLayoutComponent&&(this._sizePercent=this._getOrCreateLayoutComponent().getPercentContentSize());return this._sizePercent},_getWidthPercent:function(){return this._sizePercent.x},_getHeightPercent:function(){return this._sizePercent.y},getWorldPosition:function(){return this.convertToWorldSpace(cc.p(this._anchorPoint.x*this._contentSize.width,this._anchorPoint.y* this._contentSize.height))},getVirtualRenderer:function(){return this},getVirtualRendererSize:function(){return cc.size(this._contentSize)},_onSizeChanged:function(){if(!this._usingLayoutComponent){for(var a=this.getChildren(),b=0,c=a.length;b=c.width||0>=c.height?(this._positionPercent.x=0,this._positionPercent.y=0):void 0===b?(this._positionPercent.x=a.x/c.width,this._positionPercent.y=a.y/c.height):(this._positionPercent.x=a/c.width,this._positionPercent.y=b/c.height))}cc.Node.prototype.setPosition.call(this,a,b)},setPositionX:function(a){if(this._running){var b=this.getWidgetParent(); b&&(b=b.width,this._positionPercent.x=0>=b?0:a/b)}cc.Node.prototype.setPositionX.call(this,a)},setPositionY:function(a){if(this._running){var b=this.getWidgetParent();b&&(b=b.height,this._positionPercent.y=0>=b?0:a/b)}cc.Node.prototype.setPositionY.call(this,a)},setPositionPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.setPositionPercentY(a.y);b.refreshLayout()}else this._setXPercent(a.x),this._setYPercent(a.y),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)}, _setXPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.refreshLayout()}else this._positionPercent.x=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},_setYPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentY(a.x);b.refreshLayout()}else this._positionPercent.y=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionPercent:function(){if(this._usingLayoutComponent){var a= this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return cc.p(this._positionPercent)},_getXPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.x},_getYPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x= a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.y},setPositionType:function(a){this._positionType=a;if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();a===ccui.POSITION_ABSOLUTE?(b.setPositionPercentXEnabled(!1),b.setPositionPercentYEnabled(!1)):(b.setPositionPercentXEnabled(!0),b.setPositionPercentYEnabled(!0))}this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionType:function(){return this._positionType}, setFlippedX:function(a){var b=this.getScaleX();this._flippedX=a;this.setScaleX(b)},isFlippedX:function(){return this._flippedX},setFlippedY:function(a){var b=this.getScaleY();this._flippedY=a;this.setScaleY(b)},isFlippedY:function(){return this._flippedY},_adaptRenderers:function(){},isBright:function(){return this._bright},isEnabled:function(){return this._enabled},getLeftBoundary:function(){return this.getPositionX()-this._getAnchorX()*this._contentSize.width},getBottomBoundary:function(){return this.getPositionY()- this._getAnchorY()*this._contentSize.height},getRightBoundary:function(){return this.getLeftBoundary()+this._contentSize.width},getTopBoundary:function(){return this.getBottomBoundary()+this._contentSize.height},getTouchBeganPosition:function(){return cc.p(this._touchBeganPosition)},getTouchMovePosition:function(){return cc.p(this._touchMovePosition)},getTouchEndPosition:function(){return cc.p(this._touchEndPosition)},getWidgetType:function(){return this._widgetType},setLayoutParameter:function(a){a&& (this._layoutParameterDictionary[a.getLayoutType()]=a,this._layoutParameterType=a.getLayoutType())},getLayoutParameter:function(a){a=a||this._layoutParameterType;return this._layoutParameterDictionary[a]},getDescription:function(){return"Widget"},clone:function(){var a=this._createCloneInstance();a._copyProperties(this);a._copyClonedWidgetChildren(this);return a},_createCloneInstance:function(){return new ccui.Widget},_copyClonedWidgetChildren:function(a){a=a.getChildren();for(var b=0;b=a){b=this._lengths[c];break}if(b)return this._pool[b].pop()}},b=cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL,c,d={_rebuildQuads_base:function(b,d,e,f){var g=b._vertices,r=b._renderCmd._worldTransform,s,v,u;if(f)v=s=0,u=e.width,e=e.height;else{s=d._originalSize; var x=d._rect,w=d._offset;u=e.width/s.width;f=e.height/s.height;var t=w.x-(s.width-x.width)/2;v=w.y+(s.height-x.height)/2;var z=w.y-(s.height-x.height)/2;s=(w.x+(s.width-x.width)/2)*u;v*=f;u=e.width+t*u;e=e.height+z*f}8>g.length&&(a.put(g),g=a.get(8)||new Float32Array(8),b._vertices=g);c?(g[0]=s*r.a+v*r.c+r.tx,g[1]=s*r.b+v*r.d+r.ty,g[2]=u*r.a+v*r.c+r.tx,g[3]=u*r.b+v*r.d+r.ty,g[4]=s*r.a+e*r.c+r.tx,g[5]=s*r.b+e*r.d+r.ty,g[6]=u*r.a+e*r.c+r.tx,g[7]=u*r.b+e*r.d+r.ty):(g[0]=s,g[1]=v,g[2]=u,g[3]=v,g[4]= s,g[5]=e,g[6]=u,g[7]=e);b._uvsDirty&&this._calculateUVs(b,d);b._vertCount=4},_calculateUVs:function(c,d){var e=c._uvs,f=d._texture._pixelsWide,g=d._texture._pixelsHigh,r=d._rect,r=cc.rectPointsToPixels(r);8>e.length&&(a.put(e),e=a.get(8)||new Float32Array(8),c._uvs=e);var s,v,u=b?0.5:0;d._rotated?(s=(r.x+u)/f,v=(r.y+r.width-u)/g,f=(r.x+r.height-u)/f,g=(r.y+u)/g,e[0]=s,e[1]=g,e[2]=s,e[3]=v,e[4]=f,e[5]=g,e[6]=f,e[7]=v):(s=(r.x+u)/f,v=(r.y+r.height-u)/g,f=(r.x+r.width-u)/f,g=(r.y+u)/g,e[0]=s,e[1]=v, e[2]=f,e[3]=v,e[4]=s,e[5]=g,e[6]=f,e[7]=g)}},e={x:Array(4),y:Array(4),_rebuildQuads_base:function(b,d,e,f,g,r,s){var v=b._vertices,u=b._renderCmd._worldTransform,x=e.width-f-g,w=e.height-r-s,t=e.width/(f+g),z=e.height/(r+s),A=this.x,y=this.y;A[0]=0;A[1]=f*(1x?0:x);A[3]=e.width;y[0]=0;y[1]=s*(1w?0:w);y[3]=e.height;32>v.length&&(a.put(v),v=a.get(32)||new Float32Array(32),b._vertices=v);e=0;if(c)for(x=0;4>x;x++)for(w=0;4>w;w++)v[e]=A[w]*u.a+y[x]*u.c+u.tx,v[e+ 1]=A[w]*u.b+y[x]*u.d+u.ty,e+=2;else for(x=0;4>x;x++)for(w=0;4>w;w++)v[e]=A[w],v[e+1]=y[x],e+=2;b._uvsDirty&&this._calculateUVs(b,d,f,g,r,s)},_calculateUVs:function(c,d,e,f,g,r){var s=c._uvs,v=d._rect,u=d._texture._pixelsWide,x=d._texture._pixelsHigh,w,t=d._rect,t=cc.rectPointsToPixels(t),v=cc.rectPointsToPixels(v),z=cc.contentScaleFactor();e*=z;f=v.width-e-f*z;g*=z;r*=z;w=v.height-g-r;32>s.length&&(a.put(s),s=a.get(32)||new Float32Array(32),c._uvs=s);c=this.x;var v=this.y,A=b?0.5:0,z=0;if(d._rotated)for(c[0]= (t.x+A)/u,c[1]=(r+t.x)/u,c[2]=(r+w+t.x)/u,c[3]=(t.x+t.height-A)/u,v[3]=(t.y+A)/x,v[2]=(e+t.y)/x,v[1]=(e+f+t.y)/x,v[0]=(t.y+t.width-A)/x,d=0;4>d;d++)for(u=0;4>u;u++)s[z]=c[d],s[z+1]=v[3-u],z+=2;else for(c[0]=(t.x+A)/u,c[1]=(e+t.x)/u,c[2]=(e+f+t.x)/u,c[3]=(t.x+t.width-A)/u,v[3]=(t.y+A)/x,v[2]=(g+t.y)/x,v[1]=(g+w+t.y)/x,v[0]=(t.y+t.height-A)/x,d=0;4>d;d++)for(u=0;4>u;u++)s[z]=c[u],s[z+1]=v[d],z+=2}};ccui.Scale9Sprite=cc.Scale9Sprite=cc.Node.extend({_spriteFrame:null,_scale9Image:null,_insetLeft:0,_insetRight:0, _insetTop:0,_insetBottom:0,_blendFunc:null,_renderingType:1,_brightState:0,_opacityModifyRGB:!1,_rawVerts:null,_rawUvs:null,_vertices:null,_uvs:null,_vertCount:0,_quadsDirty:!0,_uvsDirty:!0,_isTriangle:!1,_isTrimmedContentSize:!1,_textureLoaded:!1,_flippedX:!1,_flippedY:!1,_className:"Scale9Sprite",ctor:function(b,d,e){cc.Node.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;this._renderCmd.setState(this._brightState);this._blendFunc=cc.BlendFunc._alphaPremultiplied();this.setAnchorPoint(cc.p(0.5, 0.5));this._rawUvs=this._rawVerts=null;this._vertices=a.get(8)||new Float32Array(8);this._uvs=a.get(8)||new Float32Array(8);if(void 0!==b)if(b instanceof cc.SpriteFrame)this.initWithSpriteFrame(b,d);else{var f=cc.spriteFrameCache.getSpriteFrame(b);f?this.initWithSpriteFrame(f,d):this.initWithFile(b,d,e)}void 0===c&&(c=cc._renderType===cc.game.RENDER_TYPE_WEBGL)},textureLoaded:function(){return this._textureLoaded},getCapInsets:function(){return cc.rect(this._capInsetsInternal)},_asyncSetCapInsets:function(){this.removeEventListener("load", this._asyncSetCapInsets,this);this.setCapInsets(this._cacheCapInsets);this._cacheCapInsets=null},setCapInsets:function(a){if(!this.loaded())return this._cacheCapInsets=a,this.removeEventListener("load",this._asyncSetCapInsets,this),this.addEventListener("load",this._asyncSetCapInsets,this),!1;this._capInsetsInternal=a;this._updateCapInsets(this._spriteFrame._rect,this._capInsetsInternal)},_updateCapInsets:function(a,b){b&&a&&!cc._rectEqualToZero(b)?this._capInsetsInternal=b:(a=a||{x:0,y:0,width:this._contentSize.width, height:this._contentSize.height},this._capInsetsInternal=cc.rect(a.width/3,a.height/3,a.width/3,a.height/3));cc._rectEqualToZero(a)||(this._insetLeft=this._capInsetsInternal.x,this._insetTop=this._capInsetsInternal.y,this._insetRight=a.width-this._insetLeft-this._capInsetsInternal.width,this._insetBottom=a.height-this._insetTop-this._capInsetsInternal.height)},initWithFile:function(a,b,c){a instanceof cc.Rect?(c=a=b,b=cc.rect(0,0,0,0)):(b=b||cc.rect(0,0,0,0),c=c||cc.rect(0,0,0,0));if(!a)throw Error("ccui.Scale9Sprite.initWithFile(): file should be non-null"); var d=cc.textureCache.getTextureForKey(a);d||(d=cc.textureCache.addImage(a));var e=d.isLoaded();this._textureLoaded=e;this._loader.clear();if(!e)return this._loader.once(d,function(){this.initWithFile(a,b,c);this.dispatchEvent("load")},this),!1;cc._rectEqualToZero(b)&&(e=d.getContentSize(),b=cc.rect(0,0,e.width,e.height));this.setTexture(d,b);this._updateCapInsets(b,c);return!0},updateWithBatchNode:function(a,b,c,d){if(!a)return!1;var e=a.getTexture();this._loader.clear();if(!e.isLoaded())return this._loader.once(e, function(){this.updateWithBatchNode(a,b,c,d);this.dispatchEvent("load")},this),!1;this.setTexture(e,b);this._updateCapInsets(b,d);return!0},initWithSpriteFrame:function(a,b){this.setSpriteFrame(a);b=b||cc.rect(0,0,0,0);this._updateCapInsets(a._rect,b)},initWithSpriteFrameName:function(a,b){if(!a)throw Error("ccui.Scale9Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null");b=b||cc.rect(0,0,0,0);var c=cc.spriteFrameCache.getSpriteFrame(a);if(null==c)return cc.log("ccui.Scale9Sprite.initWithSpriteFrameName(): can't find the sprite frame by spriteFrameName"), !1;this.setSpriteFrame(c);b=b||cc.rect(0,0,0,0);this._updateCapInsets(c._rect,b)},loaded:function(){return null===this._spriteFrame?!1:this._spriteFrame.textureLoaded()},setTexture:function(a,b){var c=new cc.SpriteFrame(a,b);this.setSpriteFrame(c)},_updateBlendFunc:function(){var a=this._blendFunc;this._spriteFrame&&this._spriteFrame._texture.hasPremultipliedAlpha()?(a.src===cc.SRC_ALPHA&&a.dst===cc.BLEND_DST&&(a.src=cc.ONE),this._opacityModifyRGB=!0):(a.src===cc.ONE&&a.dst===cc.BLEND_DST&&(a.src= cc.SRC_ALPHA),this._opacityModifyRGB=!1)},setOpacityModifyRGB:function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this._renderCmd._setColorDirty())},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setSpriteFrame:function(a){if(a){this._spriteFrame=a;this._uvsDirty=this._quadsDirty=!0;var b=this,c=function(){cc.sizeEqualToSize(b._contentSize,cc.size(0,0))&&b.setContentSize(b._spriteFrame._rect);b._textureLoaded=!0;b._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty); cc.renderer.childrenOrderDirty=!0};b._textureLoaded=a.textureLoaded();b._textureLoaded?c():(this._loader.clear(),this._loader.once(a,function(){c();this.dispatchEvent("load")},this))}},setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src||cc.BLEND_SRC,this._blendFunc.dst=a.dst||cc.BLEND_DST):(this._blendFunc.src=a||cc.BLEND_SRC,this._blendFunc.dst=b||cc.BLEND_DST);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src, this._blendFunc.dst)},setPreferredSize:function(a){a&&!cc.sizeEqualToSize(this._contentSize,a)&&this.setContentSize(a)},getPreferredSize:function(){return this.getContentSize()},setContentSize:function(a,b){void 0===b&&(b=a.height,a=a.width);if(a!==this._contentSize.width||b!==this._contentSize.height)cc.Node.prototype.setContentSize.call(this,a,b),this._quadsDirty=!0},getContentSize:function(){return this._renderingType===ccui.Scale9Sprite.RenderingType.SIMPLE?this._spriteFrame?this._spriteFrame._originalSize: cc.size(this._contentSize):cc.size(this._contentSize)},_setWidth:function(a){cc.Node.prototype._setWidth.call(this,a);this._quadsDirty=!0},_setHeight:function(a){cc.Node.prototype._setHeight.call(this,a);this._quadsDirty=!0},setState:function(a){this._brightState=a;this._renderCmd.setState(a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getState:function(){return this._brightState},setRenderingType:function(a){this._renderingType!==a&&(this._renderingType=a,this._uvsDirty=this._quadsDirty= !0,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty))},getRenderingType:function(){return this._renderingType},setInsetLeft:function(a){this._insetLeft=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetLeft:function(){return this._insetLeft},setInsetTop:function(a){this._insetTop=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetTop:function(){return this._insetTop},setInsetRight:function(a){this._insetRight= a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetRight:function(){return this._insetRight},setInsetBottom:function(a){this._insetBottom=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetBottom:function(){return this._insetBottom},_rebuildQuads:function(){if(this._spriteFrame&&this._spriteFrame._textureLoaded){this._updateBlendFunc();this._isTriangle=!1;switch(this._renderingType){case g.SIMPLE:d._rebuildQuads_base(this, this._spriteFrame,this._contentSize,this._isTrimmedContentSize);break;case g.SLICED:e._rebuildQuads_base(this,this._spriteFrame,this._contentSize,this._insetLeft,this._insetRight,this._insetTop,this._insetBottom);break;default:this._uvsDirty=this._quadsDirty=!1;cc.error("Can not generate quad");return}this._uvsDirty=this._quadsDirty=!1}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccui.Scale9Sprite.CanvasRenderCmd(this):new ccui.Scale9Sprite.WebGLRenderCmd(this)}}); var f=ccui.Scale9Sprite.prototype;cc.EventHelper.prototype.apply(f);cc.defineGetterSetter(f,"preferredSize",f.getPreferredSize,f.setPreferredSize);cc.defineGetterSetter(f,"capInsets",f.getCapInsets,f.setCapInsets);cc.defineGetterSetter(f,"insetLeft",f.getInsetLeft,f.setInsetLeft);cc.defineGetterSetter(f,"insetTop",f.getInsetTop,f.setInsetTop);cc.defineGetterSetter(f,"insetRight",f.getInsetRight,f.setInsetRight);cc.defineGetterSetter(f,"insetBottom",f.getInsetBottom,f.setInsetBottom);f=null;ccui.Scale9Sprite.create= function(a,b,c){return new ccui.Scale9Sprite(a,b,c)};ccui.Scale9Sprite.createWithSpriteFrame=function(a,b){return new ccui.Scale9Sprite(a,b)};ccui.Scale9Sprite.createWithSpriteFrameName=function(a,b){return new ccui.Scale9Sprite(a,b)};ccui.Scale9Sprite.POSITIONS_CENTRE=0;ccui.Scale9Sprite.POSITIONS_TOP=1;ccui.Scale9Sprite.POSITIONS_LEFT=2;ccui.Scale9Sprite.POSITIONS_RIGHT=3;ccui.Scale9Sprite.POSITIONS_BOTTOM=4;ccui.Scale9Sprite.POSITIONS_TOPRIGHT=5;ccui.Scale9Sprite.POSITIONS_TOPLEFT=6;ccui.Scale9Sprite.POSITIONS_BOTTOMRIGHT= 7;ccui.Scale9Sprite.state={NORMAL:0,GRAY:1};var g=ccui.Scale9Sprite.RenderingType={SIMPLE:0,SLICED:1}})();(function(){ccui.Scale9Sprite.CanvasRenderCmd=function(a){cc.Node.CanvasRenderCmd.call(this,a);this._needDraw=!0;this._state=ccui.Scale9Sprite.state.NORMAL;this._originalTexture=this._textureToRender=null};var a=ccui.Scale9Sprite.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=ccui.Scale9Sprite.CanvasRenderCmd;a.transform=function(a,c){this.originTransform(a,c);this._node._rebuildQuads()};a.needDraw=function(){return this._needDraw&&this._node.loaded()};a._updateDisplayColor= function(a){cc.Node.RenderCmd.prototype._updateDisplayColor.call(this,a);this._originalTexture=this._textureToRender=null};a.setState=function(a){this._state!==a&&(this._state=a,this._originalTexture=this._textureToRender=null)};a._setColorDirty=function(){this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty)};a.rendering=function(a,c,d){var e=this._node,f=this._displayedOpacity,g=f/255,h=null;e._spriteFrame&&(h=e._spriteFrame._texture);if(e.loaded()&&0!==f){if(null=== this._textureToRender||this._originalTexture!==h)this._textureToRender=this._originalTexture=h,cc.Scale9Sprite.state.GRAY===this._state&&(this._textureToRender=this._textureToRender._generateGrayTexture()),f=e.getDisplayedColor(),!h||255===f.r&&255===f.g&&255===f.b||(this._textureToRender=this._textureToRender._generateColorTexture(f.r,f.g,f.b));h=a||cc._renderContext;a=h.getContext();h.setTransform(this._worldTransform,c,d);h.setCompositeOperation(cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(e._blendFunc)); h.setGlobalAlpha(g);if(this._textureToRender){e._quadsDirty&&e._rebuildQuads();var k,m,n,p,r,s,v;c=this._textureToRender._pixelsWide;d=this._textureToRender._pixelsHigh;var g=this._textureToRender._htmlElementObj,f=e._vertices,u=e._uvs,x=0,w=0;if(e._renderingType===cc.Scale9Sprite.RenderingType.SLICED){for(h=0;3>h;++h)for(x=0;3>x;++x)w=8*h+2*x,p=f[w],r=f[w+1],s=f[w+10]-p,v=f[w+11]-r,r=-r-v,e=u[w]*c,k=u[w+11]*d,m=(u[w+10]-u[w])*c,n=(u[w+1]-u[w+11])*d,0n;++n)for(var p=0;3>p;++p)m=8*n+2*p,g[k]=a[m],g[k+1]=a[m+1],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m],g[k+5]=b[m+1],k+=6,g[k]=a[m+2],g[k+1]=a[m+3],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m+2],g[k+5]=b[m+3],k+=6,g[k]=a[m+8],g[k+1]=a[m+9],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m+8],g[k+5]=b[m+9],k+=6,g[k]=a[m+10],g[k+1]=a[m+11],g[k+2]=f,h[k+3]=e[0],g[k+4]=b[m+10],g[k+5]=b[m+11],k+=6;return 36};b.transform=function(a,b){this.originTransform(a,b);this._node._rebuildQuads()}; b._setColorDirty=function(){};b.uploadData=function(b,d,e){var f=this._node;if(0===this._displayedOpacity)return 0;f._quadsDirty&&f._rebuildQuads();var g=this._displayedOpacity,h=this._displayedColor.r,k=this._displayedColor.g,m=this._displayedColor.b;if(f._opacityModifyRGB)var n=g/255,h=h*n,k=k*n,m=m*n;this._color[0]=g<<24|m<<16|k<<8|h;g=f._vertexZ;h=f._vertices;k=f._uvs;n=a.RenderingType;m=0;switch(f._renderingType){case n.SIMPLE:m=this._node._vertCount;for(n=f=0;fg._localZOrder)g.visit(this);else break;for(g=0;gm._localZOrder)b._changeProtectedChild(m),m.visit(this);else break;for(;cf&&(g=c,f=k));c++}return g}cc.log("invalid focus direction!!!");return 0},_calculateNearestDistance:function(a){for(var b=cc.FLT_MAX,c=this._getWorldCenterPoint(a),d=this._children,e=0,f=d.length;eb&&(b=g)}return b},_findProperSearchingFunctor:function(a,b){if(void 0!==b){var c=this._getWorldCenterPoint(b),d=this._getWorldCenterPoint(this._findFirstNonLayoutWidget());a===ccui.Widget.LEFT?this.onPassFocusToChild=c.x>d.x?this._findNearestChildWidgetIndex:this._findFarthestChildWidgetIndex:a===ccui.Widget.RIGHT?this.onPassFocusToChild=c.x>d.x?this._findFarthestChildWidgetIndex:this._findNearestChildWidgetIndex:a===ccui.Widget.DOWN?this.onPassFocusToChild=c.y>d.y?this._findNearestChildWidgetIndex: this._findFarthestChildWidgetIndex:a===ccui.Widget.UP?this.onPassFocusToChild=c.yb.width?a.width:b.width,a.height>b.height?a.height:b.height)}});_p=ccui.Button.prototype;cc.defineGetterSetter(_p,"titleText",_p.getTitleText,_p.setTitleText);cc.defineGetterSetter(_p,"titleFont",_p._getTitleFont,_p._setTitleFont);cc.defineGetterSetter(_p,"titleFontSize",_p.getTitleFontSize,_p.setTitleFontSize); cc.defineGetterSetter(_p,"titleFontName",_p.getTitleFontName,_p.setTitleFontName);cc.defineGetterSetter(_p,"titleColor",_p.getTitleColor,_p.setTitleColor);_p=null;ccui.Button.create=function(a,b,c,d){return new ccui.Button(a,b,c,d)};ccui.Button.NORMAL_RENDERER_ZORDER=-2;ccui.Button.PRESSED_RENDERER_ZORDER=-2;ccui.Button.DISABLED_RENDERER_ZORDER=-2;ccui.Button.TITLE_RENDERER_ZORDER=-1;ccui.Button.ZOOM_ACTION_TIME_STEP=0.05;ccui.Button.SYSTEM=0;ccui.Button.TTF=1;ccui.CheckBox=ccui.Widget.extend({_backGroundBoxRenderer:null,_backGroundSelectedBoxRenderer:null,_frontCrossRenderer:null,_backGroundBoxDisabledRenderer:null,_frontCrossDisabledRenderer:null,_isSelected:!0,_checkBoxEventListener:null,_checkBoxEventSelector:null,_backGroundTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundSelectedTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundDisabledTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossDisabledTexType:ccui.Widget.LOCAL_TEXTURE, _backGroundFileName:"",_backGroundSelectedFileName:"",_frontCrossFileName:"",_backGroundDisabledFileName:"",_frontCrossDisabledFileName:"",_className:"CheckBox",_zoomScale:0.1,_backgroundTextureScaleX:0.1,_backgroundTextureScaleY:0.1,_backGroundBoxRendererAdaptDirty:!0,_backGroundSelectedBoxRendererAdaptDirty:!0,_frontCrossRendererAdaptDirty:!0,_backGroundBoxDisabledRendererAdaptDirty:!0,_frontCrossDisabledRendererAdaptDirty:!0,ctor:function(a,b,c,d,e,f){ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0); for(var g=0,h=0;h=c.width||0>=c.height){a.setScale(1);this._backgroundTextureScaleX=this._backgroundTextureScaleY=1;return}var d=b.width/c.width,c=b.height/c.height;this._backgroundTextureScaleX=d;this._backgroundTextureScaleY=c;a.setScaleX(d);a.setScaleY(c)}a.setPosition(0.5*b.width,0.5*b.height)},_backGroundSelectedTextureScaleChangedWithSize:function(){var a=this._backGroundSelectedBoxRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1); return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_frontCrossTextureScaleChangedWithSize:function(){var a=this._frontCrossRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_backGroundDisabledTextureScaleChangedWithSize:function(){var a= this._backGroundBoxDisabledRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_frontCrossDisabledTextureScaleChangedWithSize:function(){var a=this._frontCrossDisabledRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1); return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},getDescription:function(){return"CheckBox"},_createCloneInstance:function(){return new ccui.CheckBox},_copySpecialProperties:function(a){a instanceof ccui.CheckBox&&(this.loadTextureBackGround(a._backGroundFileName,a._backGroundTexType),this.loadTextureBackGroundSelected(a._backGroundSelectedFileName,a._backGroundSelectedTexType),this.loadTextureFrontCross(a._frontCrossFileName,a._frontCrossTexType), this.loadTextureBackGroundDisabled(a._backGroundDisabledFileName,a._backGroundDisabledTexType),this.loadTextureFrontCrossDisabled(a._frontCrossDisabledFileName,a._frontCrossDisabledTexType),this.setSelected(a._isSelected),this._checkBoxEventListener=a._checkBoxEventListener,this._checkBoxEventSelector=a._checkBoxEventSelector,this._ccEventCallback=a._ccEventCallback,this._zoomScale=a._zoomScale,this._backgroundTextureScaleX=a._backgroundTextureScaleX,this._backgroundTextureScaleY=a._backgroundTextureScaleY)}, _adaptRenderers:function(){this._backGroundBoxRendererAdaptDirty&&(this._backGroundTextureScaleChangedWithSize(),this._backGroundBoxRendererAdaptDirty=!1);this._backGroundSelectedBoxRendererAdaptDirty&&(this._backGroundSelectedTextureScaleChangedWithSize(),this._backGroundSelectedBoxRendererAdaptDirty=!1);this._frontCrossRendererAdaptDirty&&(this._frontCrossTextureScaleChangedWithSize(),this._frontCrossRendererAdaptDirty=!1);this._backGroundBoxDisabledRendererAdaptDirty&&(this._backGroundDisabledTextureScaleChangedWithSize(), this._backGroundBoxDisabledRendererAdaptDirty=!1);this._frontCrossDisabledRendererAdaptDirty&&(this._frontCrossDisabledTextureScaleChangedWithSize(),this._frontCrossDisabledRendererAdaptDirty=!1)}});_p=ccui.CheckBox.prototype;cc.defineGetterSetter(_p,"selected",_p.isSelected,_p.setSelected);_p=null;ccui.CheckBox.create=function(a,b,c,d,e,f){return new ccui.CheckBox(a,b,c,d,e,f)};ccui.CheckBox.EVENT_SELECTED=0;ccui.CheckBox.EVENT_UNSELECTED=1;ccui.CheckBox.BOX_RENDERER_ZORDER=-1; ccui.CheckBox.BOX_SELECTED_RENDERER_ZORDER=-1;ccui.CheckBox.BOX_DISABLED_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_DISABLED_RENDERER_ZORDER=-1;ccui.ImageView=ccui.Widget.extend({_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_imageRenderer:null,_textureFile:"",_imageTexType:ccui.Widget.LOCAL_TEXTURE,_imageTextureSize:null,_className:"ImageView",_imageRendererAdaptDirty:!0,ctor:function(a,b){this._capInsets=cc.rect(0,0,0,0);this._imageTextureSize=cc.size(this._capInsets.width,this._capInsets.height);ccui.Widget.prototype.ctor.call(this);a?this.loadTexture(a,void 0===b?0:b):this._imageTexType=ccui.Widget.LOCAL_TEXTURE},_initRenderer:function(){this._imageRenderer= new ccui.Scale9Sprite;this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE);this.addProtectedChild(this._imageRenderer,ccui.ImageView.RENDERER_ZORDER,-1)},loadTexture:function(a,b){if(a&&(this._textureFile!=a||this._imageTexType!=b)){var c=this;b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._imageTexType=b;var d=c._imageRenderer;switch(c._imageTexType){case ccui.Widget.LOCAL_TEXTURE:c._scale9Enabled?(d.initWithFile(a),d.setCapInsets(c._capInsets)):d.initWithFile(a); break;case ccui.Widget.PLIST_TEXTURE:c._scale9Enabled?(d.initWithSpriteFrameName(a),d.setCapInsets(c._capInsets)):d.initWithSpriteFrameName(a)}if(!d._textureLoaded){var e=function(){d.removeEventListener("load",e);!c._ignoreSize&&cc.sizeEqualToSize(c._customSize,cc.size(0,0))&&(c._customSize=c._imageRenderer.getContentSize());c._imageTextureSize=d.getContentSize();c._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize)};d.addEventListener("load",e)}!this._ignoreSize&& cc.sizeEqualToSize(this._customSize,cc.size(0,0))&&(this._customSize=this._imageRenderer.getContentSize());c._imageTextureSize=d.getContentSize();this._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize);c._imageRendererAdaptDirty=!0;c._findLayout()}},setTextureRect:function(){cc.warn("ImageView.setTextureRect is deprecated!")},setScale9Enabled:function(a){this._scale9Enabled!==a&&((this._scale9Enabled=a)?this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SLICED): this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this._imageRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this, a),this._prevIgnoreSize=a},setCapInsets:function(a){if(a){var b=this._capInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._imageRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._imageRendererAdaptDirty=!0},_adaptRenderers:function(){this._imageRendererAdaptDirty&&(this._imageTextureScaleChangedWithSize(),this._imageRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return cc.size(this._imageTextureSize)}, getVirtualRenderer:function(){return this._imageRenderer},_imageTextureScaleChangedWithSize:function(){this._imageRenderer.setContentSize(this._contentSize);this._imageRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"ImageView"},_createCloneInstance:function(){return new ccui.ImageView},_copySpecialProperties:function(a){a instanceof ccui.ImageView&&(this._prevIgnoreSize=a._prevIgnoreSize,this._capInsets=a._capInsets,this.loadTexture(a._textureFile, a._imageTexType),this.setScale9Enabled(a._scale9Enabled))},setContentSize:function(a,b){b&&(a=cc.size(a,b));ccui.Widget.prototype.setContentSize.call(this,a);this._imageRenderer.setContentSize(a)}});ccui.ImageView.create=function(a,b){return new ccui.ImageView(a,b)};ccui.ImageView.RENDERER_ZORDER=-1;ccui.LoadingBar=ccui.Widget.extend({_direction:null,_percent:100,_totalLength:0,_barRenderer:null,_renderBarTexType:ccui.Widget.LOCAL_TEXTURE,_barRendererTextureSize:null,_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_textureFile:"",_isTextureLoaded:!1,_className:"LoadingBar",_barRendererAdaptDirty:!0,ctor:function(a,b){this._direction=ccui.LoadingBar.TYPE_LEFT;this._barRendererTextureSize=cc.size(0,0);this._capInsets=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);void 0!==a&&this.loadTexture(a); void 0!==b&&this.setPercent(b)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1);this._barRenderer.setAnchorPoint(0,0.5)},setDirection:function(a){if(this._direction!==a)switch(this._direction=a,this._direction){case ccui.LoadingBar.TYPE_LEFT:this._barRenderer.setAnchorPoint(0,0.5);this._barRenderer.setPosition(0,0.5*this._contentSize.height);this._scale9Enabled||this._barRenderer.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:this._barRenderer.setAnchorPoint(1, 0.5),this._barRenderer.setPosition(this._totalLength,0.5*this._contentSize.height),this._scale9Enabled||this._barRenderer.setFlippedX(!0)}},getDirection:function(){return this._direction},loadTexture:function(a,b){if(a){this._renderBarTexType=b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;var c=this._barRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadTexture(d._textureFile,d._renderBarTexType);d._setPercent(d._percent)});switch(this._renderBarTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a); break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}var e=c.getContentSize();this._barRendererTextureSize.width=e.width;this._barRendererTextureSize.height=e.height;switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:c.setAnchorPoint(0,0.5);this._scale9Enabled||c.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:c.setAnchorPoint(1,0.5),this._scale9Enabled||c.setFlippedX(!0)}this._scale9Enabled&&c.setCapInsets(this._capInsets);this._updateChildrenDisplayedRGBA();this._barRendererScaleChangedWithSize(); this._updateContentSizeWithTextureSize(this._barRendererTextureSize);this._barRendererAdaptDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer),this._barRenderer=this._scale9Enabled?new ccui.Scale9Sprite:new cc.Sprite,this.loadTexture(this._textureFile,this._renderBarTexType),this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1), this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this.setPercent(this._percent),this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},setCapInsets:function(a){if(a){var b=this._capInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},setPercent:function(a){100a&&(a=0);a!== this._percent&&(this._percent=a,this._setPercent(a))},_setPercent:function(){var a,b,c,d;0>=this._totalLength||(a=this._percent/100,this._scale9Enabled?this._setScale9Scale():(c=this._barRenderer,d=this._barRendererTextureSize,b=c.getTextureRect(),b.width=d.width*a,c.setTextureRect(cc.rect(b.x,b.y,d.width*a,d.height),c._rectRotated)))},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);this._totalLength=void 0===b?a.width:a},getPercent:function(){return this._percent}, _onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1)},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},getVirtualRendererSize:function(){return cc.size(this._barRendererTextureSize)},getVirtualRenderer:function(){return this._barRenderer}, _barRendererScaleChangedWithSize:function(){var a=this._barRenderer,b=this._contentSize;if(this._unifySize)this._totalLength=this._contentSize.width,this.setPercent(this._percent);else if(this._ignoreSize)this._scale9Enabled||(this._totalLength=this._barRendererTextureSize.width,a.setScale(1));else if(this._totalLength=b.width,this._scale9Enabled)this._setScale9Scale(),a.setScale(1);else{var c=this._barRendererTextureSize;if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/ c.width);a.setScaleY(d)}switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:a.setPosition(0,0.5*b.height);break;case ccui.LoadingBar.TYPE_RIGHT:a.setPosition(this._totalLength,0.5*b.height)}},_setScale9Scale:function(){this._barRenderer.setPreferredSize(cc.size(this._percent/100*this._totalLength,this._contentSize.height))},getDescription:function(){return"LoadingBar"},_createCloneInstance:function(){return new ccui.LoadingBar},_copySpecialProperties:function(a){a instanceof ccui.LoadingBar&&(this._prevIgnoreSize= a._prevIgnoreSize,this.setScale9Enabled(a._scale9Enabled),this.loadTexture(a._textureFile,a._renderBarTexType),this.setCapInsets(a._capInsets),this.setPercent(a._percent),this.setDirection(a._direction))}});_p=ccui.LoadingBar.prototype;cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"percent",_p.getPercent,_p.setPercent);_p=null;ccui.LoadingBar.create=function(a,b){return new ccui.LoadingBar(a,b)};ccui.LoadingBar.TYPE_LEFT=0; ccui.LoadingBar.TYPE_RIGHT=1;ccui.LoadingBar.RENDERER_ZORDER=-1;ccui.Slider=ccui.Widget.extend({_barRenderer:null,_progressBarRenderer:null,_barTextureSize:null,_progressBarTextureSize:null,_slidBallNormalRenderer:null,_slidBallPressedRenderer:null,_slidBallDisabledRenderer:null,_slidBallRenderer:null,_barLength:0,_percent:0,_scale9Enabled:!1,_prevIgnoreSize:!0,_textureFile:"",_progressBarTextureFile:"",_slidBallNormalTextureFile:"",_slidBallPressedTextureFile:"",_slidBallDisabledTextureFile:"",_capInsetsBarRenderer:null,_capInsetsProgressBarRenderer:null,_sliderEventListener:null, _sliderEventSelector:null,_barTexType:ccui.Widget.LOCAL_TEXTURE,_progressBarTexType:ccui.Widget.LOCAL_TEXTURE,_ballNTexType:ccui.Widget.LOCAL_TEXTURE,_ballPTexType:ccui.Widget.LOCAL_TEXTURE,_ballDTexType:ccui.Widget.LOCAL_TEXTURE,_isTextureLoaded:!1,_className:"Slider",_barRendererAdaptDirty:!0,_progressBarRendererDirty:!0,_unifySize:!1,_zoomScale:0.1,_sliderBallNormalTextureScaleX:1,_sliderBallNormalTextureScaleY:1,ctor:function(a,b,c){this._barTextureSize=cc.size(0,0);this._progressBarTextureSize= cc.size(0,0);this._capInsetsBarRenderer=cc.rect(0,0,0,0);this._capInsetsProgressBarRenderer=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);c=c||0;this.setTouchEnabled(!0);a&&this.loadBarTexture(a,c);b&&this.loadSlidBallTextures(b,c)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this._progressBarRenderer=new cc.Sprite;this._progressBarRenderer.setAnchorPoint(0,0.5);this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER,-1);this.addProtectedChild(this._progressBarRenderer, ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1);this._slidBallNormalRenderer=new cc.Sprite;this._slidBallPressedRenderer=new cc.Sprite;this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer=new cc.Sprite;this._slidBallDisabledRenderer.setVisible(!1);this._slidBallRenderer=new cc.Node;this._slidBallRenderer.addChild(this._slidBallNormalRenderer);this._slidBallRenderer.addChild(this._slidBallPressedRenderer);this._slidBallRenderer.addChild(this._slidBallDisabledRenderer);this._slidBallRenderer.setCascadeColorEnabled(!0); this._slidBallRenderer.setCascadeOpacityEnabled(!0);this.addProtectedChild(this._slidBallRenderer,ccui.Slider.BALL_RENDERER_ZORDER,-1)},loadBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._barTexType=b;var c=this._barRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadBarTexture(d._textureFile,d._barTexType)});switch(this._barTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._progressBarRendererDirty=this._barRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._barRenderer.getContentSize());this._findLayout();this._barTextureSize=this._barRenderer.getContentSize()}},loadProgressBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._progressBarTextureFile=a;this._progressBarTexType=b;var c=this._progressBarRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadProgressBarTexture(d._progressBarTextureFile,d._progressBarTexType)}); switch(this._progressBarTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._progressBarRenderer.setAnchorPoint(cc.p(0,0.5));c=this._progressBarRenderer.getContentSize();this._progressBarTextureSize={width:c.width,height:c.height};this._progressBarRendererDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer, !0),this.removeProtectedChild(this._progressBarRenderer,!0),this._progressBarRenderer=this._barRenderer=null,this._scale9Enabled?(this._barRenderer=new ccui.Scale9Sprite,this._progressBarRenderer=new ccui.Scale9Sprite):(this._barRenderer=new cc.Sprite,this._progressBarRenderer=new cc.Sprite),this.loadBarTexture(this._textureFile,this._barTexType),this.loadProgressBarTexture(this._progressBarTextureFile,this._progressBarTexType),this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER, -1),this.addProtectedChild(this._progressBarRenderer,ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsetsBarRenderer(this._capInsetsBarRenderer),this.setCapInsetProgressBarRenderer(this._capInsetsProgressBarRenderer),this._progressBarRendererDirty=this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled|| this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},setCapInsets:function(a){this.setCapInsetsBarRenderer(a);this.setCapInsetProgressBarRenderer(a)},setCapInsetsBarRenderer:function(a){if(a){var b=this._capInsetsBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsetsBarRenderer:function(){return cc.rect(this._capInsetsBarRenderer)},setCapInsetProgressBarRenderer:function(a){if(a){var b= this._capInsetsProgressBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._progressBarRenderer.setCapInsets(a)}},getCapInsetsProgressBarRenderer:function(){return cc.rect(this._capInsetsProgressBarRenderer)},loadSlidBallTextures:function(a,b,c,d){this.loadSlidBallTextureNormal(a,d);this.loadSlidBallTexturePressed(b,d);this.loadSlidBallTextureDisabled(c,d)},loadSlidBallTextureNormal:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallNormalTextureFile= a;this._ballNTexType=b;var c=this;this._slidBallNormalRenderer._textureLoaded||this._slidBallNormalRenderer.addEventListener("load",function(){c.loadSlidBallTextureNormal(c._slidBallNormalTextureFile,c._ballNTexType)});switch(this._ballNTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallNormalRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallNormalRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._findLayout()}},loadSlidBallTexturePressed:function(a, b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallPressedTextureFile=a;this._ballPTexType=b;var c=this;this._slidBallPressedRenderer._textureLoaded||this._slidBallPressedRenderer.addEventListener("load",function(){c.loadSlidBallTexturePressed(c._slidBallPressedTextureFile,c._ballPTexType)});switch(this._ballPTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallPressedRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallPressedRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._findLayout()}},loadSlidBallTextureDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallDisabledTextureFile=a;this._ballDTexType=b;var c=this;this._slidBallDisabledRenderer._textureLoaded||this._slidBallDisabledRenderer.addEventListener("load",function(){c.loadSlidBallTextureDisabled(c._slidBallDisabledTextureFile,c._ballDTexType)});switch(this._ballDTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallDisabledRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallDisabledRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._findLayout()}},setPercent:function(a){100a&&(a=0);this._percent=a;a=a/100*this._barLength;this._slidBallRenderer.setPosition(a,this._contentSize.height/2);if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(cc.size(a,this._contentSize.height));else{var b=this._progressBarRenderer,c=b.getTextureRect();b.setTextureRect(cc.rect(c.x,c.y,a/b._scaleX,c.height),b.isTextureRectRotated())}},hitTest:function(a){a=this._slidBallNormalRenderer.convertToNodeSpace(a);var b=this._slidBallNormalRenderer.getContentSize(), b=cc.rect(0,0,b.width,b.height);return a.x>=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height},onTouchBegan:function(a,b){var c=ccui.Widget.prototype.onTouchBegan.call(this,a,b);if(this._hit){var d=this.convertToNodeSpace(this._touchBeganPosition);this.setPercent(this._getPercentWithBallPos(d.x));this._percentChangedEvent()}return c},onTouchMoved:function(a,b){var c=a.getLocation(),c=this.convertToNodeSpace(c);this.setPercent(this._getPercentWithBallPos(c.x));this._percentChangedEvent()},onTouchEnded:function(a, b){ccui.Widget.prototype.onTouchEnded.call(this,a,b)},onTouchCancelled:function(a,b){ccui.Widget.prototype.onTouchCancelled.call(this,a,b)},_getPercentWithBallPos:function(a){return a/this._barLength*100},addEventListenerSlider:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._sliderEventSelector=a;this._sliderEventListener=b},_percentChangedEvent:function(){this._sliderEventSelector&&(this._sliderEventListener?this._sliderEventSelector.call(this._sliderEventListener, this,ccui.Slider.EVENT_PERCENT_CHANGED):this._sliderEventSelector(this,ccui.Slider.EVENT_PERCENT_CHANGED));this._ccEventCallback&&this._ccEventCallback(this,ccui.Slider.EVENT_PERCENT_CHANGED)},getPercent:function(){return this._percent},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._progressBarRendererDirty=this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1); this._progressBarRendererDirty&&(this._progressBarRendererScaleChangedWithSize(),this._progressBarRendererDirty=!1)},getVirtualRendererSize:function(){return this._barRenderer.getContentSize()},getVirtualRenderer:function(){return this._barRenderer},_barRendererScaleChangedWithSize:function(){if(this._unifySize)this._barLength=this._contentSize.width,this._barRenderer.setPreferredSize(this._contentSize);else if(this._ignoreSize)this._barRenderer.setScale(1),this._barLength=this._contentSize.width; else if(this._barLength=this._contentSize.width,this._scale9Enabled)this._barRenderer.setPreferredSize(this._contentSize),this._barRenderer.setScale(1);else{var a=this._barTextureSize;if(0>=a.width||0>=a.height)this._barRenderer.setScale(1);else{var b=this._contentSize.height/a.height;this._barRenderer.setScaleX(this._contentSize.width/a.width);this._barRenderer.setScaleY(b)}}this._barRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2);this.setPercent(this._percent)},_progressBarRendererScaleChangedWithSize:function(){if(this._unifySize)this._progressBarRenderer.setPreferredSize(this._contentSize); else if(this._ignoreSize){if(!this._scale9Enabled){var a=this._progressBarTextureSize,b=this._contentSize.width/a.width,a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}}else if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(this._contentSize),this._progressBarRenderer.setScale(1);else{a=this._progressBarTextureSize;if(0>=a.width||0>=a.height){this._progressBarRenderer.setScale(1);return}b=this._contentSize.width/a.width; a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}this._progressBarRenderer.setPosition(0,this._contentSize.height/2);this.setPercent(this._percent)},_onPressStateChangedToNormal:function(){this._slidBallNormalRenderer.setVisible(!0);this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer.setVisible(!1);this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY);cc._renderType=== cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToPressed:function(){this._slidBallPressedTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallPressedRenderer.setVisible(!0),this._slidBallDisabledRenderer.setVisible(!1)):this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX+this._zoomScale,this._sliderBallNormalTextureScaleY+this._zoomScale);cc._renderType===cc.game.RENDER_TYPE_WEBGL&& (this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToDisabled:function(){this._slidBallDisabledTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallDisabledRenderer.setVisible(!0)):(this._slidBallNormalRenderer.setVisible(!0),cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getGrayGLProgram()));this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY); this._slidBallPressedRenderer.setVisible(!1)},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},getSlidBallNormalRenderer:function(){return this._slidBallNormalRenderer},getSlidBallPressedRenderer:function(){return this._slidBallPressedRenderer},getSlidBallDisabledRenderer:function(){return this._slidBallDisabledRenderer},getSlidBallRenderer:function(){return this._slidBallRenderer},getDescription:function(){return"Slider"},_createCloneInstance:function(){return new ccui.Slider}, _copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this.setScale9Enabled(a._scale9Enabled);this.loadBarTexture(a._textureFile,a._barTexType);this.loadProgressBarTexture(a._progressBarTextureFile,a._progressBarTexType);this.loadSlidBallTextureNormal(a._slidBallNormalTextureFile,a._ballNTexType);this.loadSlidBallTexturePressed(a._slidBallPressedTextureFile,a._ballPTexType);this.loadSlidBallTextureDisabled(a._slidBallDisabledTextureFile,a._ballDTexType);this.setPercent(a.getPercent()); this._sliderEventListener=a._sliderEventListener;this._sliderEventSelector=a._sliderEventSelector;this._zoomScale=a._zoomScale;this._ccEventCallback=a._ccEventCallback}});_p=ccui.Slider.prototype;cc.defineGetterSetter(_p,"percent",_p.getPercent,_p.setPercent);_p=null;ccui.Slider.create=function(a,b,c){return new ccui.Slider(a,b,c)};ccui.Slider.EVENT_PERCENT_CHANGED=0;ccui.Slider.BASEBAR_RENDERER_ZORDER=-3;ccui.Slider.PROGRESSBAR_RENDERER_ZORDER=-2;ccui.Slider.BALL_RENDERER_ZORDER=-1;ccui.Text=ccui.Widget.extend({_touchScaleChangeEnabled:!1,_normalScaleValueX:1,_normalScaleValueY:1,_fontName:"Arial",_fontSize:16,_onSelectedScaleOffset:0.5,_labelRenderer:null,_textAreaSize:null,_textVerticalAlignment:0,_textHorizontalAlignment:0,_className:"Text",_type:null,_labelRendererAdaptDirty:!0,ctor:function(a,b,c){this._type=ccui.Text.Type.SYSTEM;this._textAreaSize=cc.size(0,0);ccui.Widget.prototype.ctor.call(this);void 0!==c?(this.setFontName(b),this.setFontSize(c),this.setString(a)): this.setFontName(this._fontName)},_initRenderer:function(){this._labelRenderer=new cc.LabelTTF;this.addProtectedChild(this._labelRenderer,ccui.Text.RENDERER_ZORDER,-1)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){a!==this._labelRenderer.getString()&&(this._setString(a),this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize()))},_setString:function(a){this._labelRenderer.setString(a);this._labelRendererAdaptDirty=!0},getStringValue:function(){cc.log("Please use the getString"); return this._labelRenderer.getString()},getString:function(){return this._labelRenderer.getString()},getStringLength:function(){return this._labelRenderer.getStringLength()},setFontSize:function(a){this._setFontSize(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setFontSize:function(a){this._labelRenderer.setFontSize(a);this._fontSize=a;this._labelRendererAdaptDirty=!0},getFontSize:function(){return this._fontSize},setFontName:function(a){this._setFontName(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())}, _setFontName:function(a){this._fontName=a;this._labelRenderer.setFontName(a);this._labelRendererAdaptDirty=!0},_updateUITextContentSize:function(){this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},getFontName:function(){return this._fontName},_setFont:function(a){var b=cc.LabelTTF._fontStyleRE.exec(a);b&&(this._fontSize=parseInt(b[1]),this._fontName=b[2],this._labelRenderer._setFont(a),this._labelScaleChangedWithSize())},_getFont:function(){return this._labelRenderer._getFont()}, getType:function(){return this._type},setTextAreaSize:function(a){this._setTextAreaSize(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setTextAreaSize:function(a){this._labelRenderer.setDimensions(a);this._ignoreSize||(this._customSize=a);this._labelRendererAdaptDirty=!0},getTextAreaSize:function(){return this._labelRenderer.getDimensions()},setTextHorizontalAlignment:function(a){this._setTextHorizontalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())}, _setTextHorizontalAlignment:function(a){this._labelRenderer.setHorizontalAlignment(a);this._labelRendererAdaptDirty=!0},getTextHorizontalAlignment:function(){return this._labelRenderer.getHorizontalAlignment()},setTextVerticalAlignment:function(a){this._setTextVerticalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setTextVerticalAlignment:function(a){this._labelRenderer.setVerticalAlignment(a);this._labelRendererAdaptDirty=!0},getTextVerticalAlignment:function(){return this._labelRenderer.getVerticalAlignment()}, setTouchScaleChangeEnabled:function(a){this._touchScaleChangeEnabled=a},isTouchScaleChangeEnabled:function(){return this._touchScaleChangeEnabled},_onPressStateChangedToNormal:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX),this._labelRenderer.setScaleY(this._normalScaleValueY))},_onPressStateChangedToPressed:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX+this._onSelectedScaleOffset),this._labelRenderer.setScaleY(this._normalScaleValueY+ this._onSelectedScaleOffset))},_onPressStateChangedToDisabled:function(){},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelRendererAdaptDirty&&(this._labelScaleChangedWithSize(),this._labelRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelRenderer},getAutoRenderSize:function(){var a=this._labelRenderer.getContentSize(); this._ignoreSize||(this._labelRenderer.setDimensions(0,0),a=this._labelRenderer.getContentSize(),this._labelRenderer.setDimensions(this._contentSize.width,this._contentSize.height));return a},_labelScaleChangedWithSize:function(){var a=this._contentSize;if(this._ignoreSize)this._labelRenderer.setScale(1),this._normalScaleValueX=this._normalScaleValueY=1;else{this._labelRenderer.setDimensions(cc.size(a.width,a.height));var b=this._labelRenderer.getContentSize();if(0>=b.width||0>=b.height){this._labelRenderer.setScale(1); return}var c=a.width/b.width,b=a.height/b.height;this._labelRenderer.setScaleX(c);this._labelRenderer.setScaleY(b);this._normalScaleValueX=c;this._normalScaleValueY=b}this._labelRenderer.setPosition(a.width/2,a.height/2)},getDescription:function(){return"Label"},enableShadow:function(a,b,c){this._labelRenderer.enableShadow(a,b,c)},enableOutline:function(a,b){this._labelRenderer.enableStroke(a,b)},enableGlow:function(a){this._type===ccui.Text.Type.TTF&&this._labelRenderer.enableGlow(a)},disableEffect:function(){this._labelRenderer.disableEffect&& this._labelRenderer.disableEffect()},_createCloneInstance:function(){return new ccui.Text},_copySpecialProperties:function(a){a instanceof ccui.Text&&(this.setFontName(a._fontName),this.setFontSize(a.getFontSize()),this.setString(a.getString()),this.setTouchScaleChangeEnabled(a.touchScaleEnabled),this.setTextAreaSize(a._textAreaSize),this.setTextHorizontalAlignment(a._labelRenderer.getHorizontalAlignment()),this.setTextVerticalAlignment(a._labelRenderer.getVerticalAlignment()),this.setContentSize(a.getContentSize()), this.setTextColor(a.getTextColor()))},_setBoundingWidth:function(a){this._textAreaSize.width=a;this._labelRenderer._setBoundingWidth(a);this._labelScaleChangedWithSize()},_setBoundingHeight:function(a){this._textAreaSize.height=a;this._labelRenderer._setBoundingHeight(a);this._labelScaleChangedWithSize()},_getBoundingWidth:function(){return this._textAreaSize.width},_getBoundingHeight:function(){return this._textAreaSize.height},_changePosition:function(){this._adaptRenderers()},setColor:function(a){cc.ProtectedNode.prototype.setColor.call(this, a);this._labelRenderer.setColor(a)},setTextColor:function(a){this._labelRenderer.setFontFillColor(a)},getTextColor:function(){return this._labelRenderer._getFillStyle()}});_p=ccui.Text.prototype;cc.defineGetterSetter(_p,"boundingWidth",_p._getBoundingWidth,_p._setBoundingWidth);cc.defineGetterSetter(_p,"boundingHeight",_p._getBoundingHeight,_p._setBoundingHeight);cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"stringLength",_p.getStringLength); cc.defineGetterSetter(_p,"font",_p._getFont,_p._setFont);cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.defineGetterSetter(_p,"textAlign",_p.getTextHorizontalAlignment,_p.setTextHorizontalAlignment);cc.defineGetterSetter(_p,"verticalAlign",_p.getTextVerticalAlignment,_p.setTextVerticalAlignment);_p=null;ccui.Label=ccui.Text.create=function(a,b,c){return new ccui.Text(a,b,c)};ccui.Text.RENDERER_ZORDER=-1; ccui.Text.Type={SYSTEM:0,TTF:1};ccui.TextAtlas=ccui.Widget.extend({_labelAtlasRenderer:null,_stringValue:"",_charMapFileName:"",_itemWidth:0,_itemHeight:0,_startCharMap:"",_className:"TextAtlas",_labelAtlasRendererAdaptDirty:null,ctor:function(a,b,c,d,e){ccui.Widget.prototype.ctor.call(this);void 0!==e&&this.setProperty(a,b,c,d,e)},_initRenderer:function(){this._labelAtlasRenderer=new cc.LabelAtlas;this._labelAtlasRenderer.setAnchorPoint(cc.p(0.5,0.5));this.addProtectedChild(this._labelAtlasRenderer,ccui.TextAtlas.RENDERER_ZORDER, -1);this._labelAtlasRenderer.addEventListener("load",function(){this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize());this._findLayout()},this)},setProperty:function(a,b,c,d,e){this._stringValue=a;this._charMapFileName=b;this._itemWidth=c;this._itemHeight=d;this._startCharMap=e;this._labelAtlasRenderer.initWithString(a,this._charMapFileName,this._itemWidth,this._itemHeight,this._startCharMap[0]);this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize()); this._labelAtlasRendererAdaptDirty=!0},setString:function(a){a!==this._labelAtlasRenderer.getString()&&(this._stringValue=a,this._labelAtlasRenderer.setString(a),this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize()),this._labelAtlasRendererAdaptDirty=!0)},setStringValue:function(a){cc.log("Please use the setString");this.setString(a)},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._labelAtlasRenderer.getString()}, getStringLength:function(){return this._labelAtlasRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelAtlasRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelAtlasRendererAdaptDirty&&(this._labelAtlasScaleChangedWithSize(),this._labelAtlasRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelAtlasRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelAtlasRenderer},_labelAtlasScaleChangedWithSize:function(){var a= this._labelAtlasRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"LabelAtlas"},_copySpecialProperties:function(a){a&&this.setProperty(a._stringValue,a._charMapFileName,a._itemWidth,a._itemHeight,a._startCharMap)},_createCloneInstance:function(){return new ccui.TextAtlas}}); _p=ccui.TextAtlas.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);_p=null;ccui.TextAtlas.create=function(a,b,c,d,e){return new ccui.TextAtlas(a,b,c,d,e)};ccui.TextAtlas.RENDERER_ZORDER=-1;ccui.LabelBMFont=ccui.TextBMFont=ccui.Widget.extend({_labelBMFontRenderer:null,_fntFileHasInit:!1,_fntFileName:"",_stringValue:"",_className:"TextBMFont",_labelBMFontRendererAdaptDirty:!0,ctor:function(a,b){ccui.Widget.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;void 0!==b&&(this.setFntFile(b),this.setString(a))},_initRenderer:function(){this._labelBMFontRenderer=new cc.LabelBMFont;this.addProtectedChild(this._labelBMFontRenderer,ccui.TextBMFont.RENDERER_ZORDER,-1)},setFntFile:function(a){if(a){this._fntFileName= a;this._fntFileHasInit=!0;this._labelBMFontRenderer.initWithString(this._stringValue,a);this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize());this._labelBMFontRendererAdaptDirty=!0;var b=this;a=b._labelBMFontRenderer;a._textureLoaded||a.addEventListener("load",function(){b.setFntFile(b._fntFileName)})}},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){this._loader.clear();this._labelBMFontRenderer._textureLoaded?a!==this._labelBMFontRenderer.getString()&& (this._stringValue=a,this._labelBMFontRenderer.setString(a),this._fntFileHasInit&&(this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize()),this._labelBMFontRendererAdaptDirty=!0)):this._loader.add(this._labelBMFontRenderer,function(){this.setString(a)},this)},getString:function(){return this._stringValue},getStringLength:function(){return this._labelBMFontRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelBMFontRendererAdaptDirty= !0},_adaptRenderers:function(){this._labelBMFontRendererAdaptDirty&&(this._labelBMFontScaleChangedWithSize(),this._labelBMFontRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelBMFontRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelBMFontRenderer},_labelBMFontScaleChangedWithSize:function(){var a=this._labelBMFontRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/ b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"TextBMFont"},_createCloneInstance:function(){return new ccui.TextBMFont},_copySpecialProperties:function(a){this.setFntFile(a._fntFileName);this.setString(a._stringValue)}});_p=ccui.TextBMFont.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);_p=null;ccui.TextBMFont.create=function(a,b){return new ccui.TextBMFont(a,b)}; ccui.TextBMFont.RENDERER_ZORDER=-1;ccui._TextFieldRenderer=cc.TextFieldTTF.extend({_maxLengthEnabled:!1,_maxLength:0,_passwordEnabled:!1,_passwordStyleText:"",_attachWithIME:!1,_detachWithIME:!1,_insertText:!1,_deleteBackward:!1,_className:"_TextFieldRenderer",ctor:function(){cc.TextFieldTTF.prototype.ctor.call(this);this._maxLengthEnabled=!1;this._maxLength=0;this._passwordEnabled=!1;this._passwordStyleText="*";this._deleteBackward=this._insertText=this._detachWithIME=this._attachWithIME=!1},onEnter:function(){cc.TextFieldTTF.prototype.onEnter.call(this); cc.TextFieldTTF.prototype.setDelegate.call(this,this)},onTextFieldAttachWithIME:function(a){this.setAttachWithIME(!0);return!1},onTextFieldInsertText:function(a,b,c){if(1===c&&"\n"===b)return!1;this.setInsertText(!0);return this._maxLengthEnabled&&cc.TextFieldTTF.prototype.getCharCount.call(this)>=this._maxLength},onTextFieldDeleteBackward:function(a,b,c){this.setDeleteBackward(!0);return!1},onTextFieldDetachWithIME:function(a){this.setDetachWithIME(!0);return!1},insertText:function(a,b){"\n"!==a&& this._maxLengthEnabled&&this.getString().length>=this._maxLength?this._passwordEnabled&&this.setPasswordText(this.getString()):(cc.TextFieldTTF.prototype.insertText.call(this,a,b),this._passwordEnabled&&0b||126this._maxLength&&(a=this._maxLength);for(c=0;c=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height}return ccui.Widget.prototype.hitTest.call(this,a)},getTouchSize:function(){return cc.size(this._touchWidth,this._touchHeight)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){null!=a&&(a=String(a),this.isMaxLengthEnabled()&&(a=a.substr(0,this.getMaxLength())),this.isPasswordEnabled()?(this._textFieldRenderer.setPasswordText(a),this._textFieldRenderer.setString(""),this._textFieldRenderer.insertText(a, a.length)):this._textFieldRenderer.setString(a),this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()))},setPlaceHolder:function(a){this._textFieldRenderer.setPlaceHolder(a);this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getPlaceHolder:function(){return this._textFieldRenderer.getPlaceHolder()},getPlaceHolderColor:function(){return this._textFieldRenderer.getPlaceHolderColor()}, setPlaceHolderColor:function(a){this._textFieldRenderer.setColorSpaceHolder(a)},setTextColor:function(a){this._textFieldRenderer.setTextColor(a)},setFontSize:function(a){this._textFieldRenderer.setFontSize(a);this._fontSize=a;this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontSize:function(){return this._fontSize},setFontName:function(a){this._textFieldRenderer.setFontName(a);this._fontName=a;this._textFieldRendererAdaptDirty= !0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontName:function(){return this._fontName},didNotSelectSelf:function(){this._textFieldRenderer.detachWithIME()},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._textFieldRenderer.getString()},getStringLength:function(){return this._textFieldRenderer.getStringLength()},onTouchBegan:function(a,b){var c=this,d=ccui.Widget.prototype.onTouchBegan.call(c, a,b);c._hit?setTimeout(function(){c._textFieldRenderer.attachWithIME()},0):setTimeout(function(){c._textFieldRenderer.detachWithIME()},0);return d},setMaxLengthEnabled:function(a){this._textFieldRenderer.setMaxLengthEnabled(a)},isMaxLengthEnabled:function(){return this._textFieldRenderer.isMaxLengthEnabled()},setMaxLength:function(a){this._textFieldRenderer.setMaxLength(a);this.setString(this.getString())},getMaxLength:function(){return this._textFieldRenderer.getMaxLength()},setPasswordEnabled:function(a){this._textFieldRenderer.setPasswordEnabled(a)}, isPasswordEnabled:function(){return this._textFieldRenderer.isPasswordEnabled()},setPasswordStyleText:function(a){this._textFieldRenderer.setPasswordStyleText(a);this._passwordStyleText=a;this.setString(this.getString())},getPasswordStyleText:function(){return this._passwordStyleText},update:function(a){this.getDetachWithIME()&&(this._detachWithIMEEvent(),this.setDetachWithIME(!1));this.getAttachWithIME()&&(this._attachWithIMEEvent(),this.setAttachWithIME(!1));this.getInsertText()&&(this._textFieldRendererAdaptDirty= !0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._insertTextEvent(),this.setInsertText(!1));this.getDeleteBackward()&&(this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._deleteBackwardEvent(),this.setDeleteBackward(!1))},getAttachWithIME:function(){return this._textFieldRenderer.getAttachWithIME()},setAttachWithIME:function(a){this._textFieldRenderer.setAttachWithIME(a)},getDetachWithIME:function(){return this._textFieldRenderer.getDetachWithIME()}, setDetachWithIME:function(a){this._textFieldRenderer.setDetachWithIME(a)},getInsertText:function(){return this._textFieldRenderer.getInsertText()},setInsertText:function(a){this._textFieldRenderer.setInsertText(a)},getDeleteBackward:function(){return this._textFieldRenderer.getDeleteBackward()},setDeleteBackward:function(a){this._textFieldRenderer.setDeleteBackward(a)},_attachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener, this,ccui.TextField.EVENT_ATTACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_ATTACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_ATTACH_WITH_IME)},_detachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_DETACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_DETACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this, ccui.TextField.EVENT_DETACH_WITH_IME)},_insertTextEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_INSERT_TEXT):this._textFieldEventSelector(this,ccui.TextField.EVENT_INSERT_TEXT));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_INSERT_TEXT)},_deleteBackwardEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener, this,ccui.TextField.EVENT_DELETE_BACKWARD):this._textFieldEventSelector(this,ccui.TextField.EVENT_DELETE_BACKWARD));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_DELETE_BACKWARD)},addEventListenerTextField:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._textFieldEventSelector=a;this._textFieldEventListener=b},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._textFieldRendererAdaptDirty=!0},_adaptRenderers:function(){this._textFieldRendererAdaptDirty&& (this._textfieldRendererScaleChangedWithSize(),this._textFieldRendererAdaptDirty=!1)},_textfieldRendererScaleChangedWithSize:function(){this._ignoreSize||this._textFieldRenderer.setDimensions(this._contentSize);this._textFieldRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getAutoRenderSize:function(){var a=this._textFieldRenderer.getContentSize();this._ignoreSize||(this._textFieldRenderer.setDimensions(0,0),a=this._textFieldRenderer.getContentSize(),this._textFieldRenderer.setDimensions(this._contentSize.width, this._contentSize.height));return a},getVirtualRendererSize:function(){return this._textFieldRenderer.getContentSize()},getVirtualRenderer:function(){return this._textFieldRenderer},getDescription:function(){return"TextField"},attachWithIME:function(){this._textFieldRenderer.attachWithIME()},_createCloneInstance:function(){return new ccui.TextField},_copySpecialProperties:function(a){this.setString(a._textFieldRenderer.getString());this.setPlaceHolder(a.getString());this.setFontSize(a._textFieldRenderer.getFontSize()); this.setFontName(a._textFieldRenderer.getFontName());this.setMaxLengthEnabled(a.isMaxLengthEnabled());this.setMaxLength(a.getMaxLength());this.setPasswordEnabled(a.isPasswordEnabled());this.setPasswordStyleText(a._passwordStyleText);this.setAttachWithIME(a.getAttachWithIME());this.setDetachWithIME(a.getDetachWithIME());this.setInsertText(a.getInsertText());this.setDeleteBackward(a.getDeleteBackward());this._ccEventCallback=a._ccEventCallback;this._textFieldEventListener=a._textFieldEventListener; this._textFieldEventSelector=a._textFieldEventSelector},setTextAreaSize:function(a){this.setContentSize(a)},setTextHorizontalAlignment:function(a){this._textFieldRenderer.setHorizontalAlignment(a)},setTextVerticalAlignment:function(a){this._textFieldRenderer.setVerticalAlignment(a)},_setFont:function(a){this._textFieldRenderer._setFont(a);this._textFieldRendererAdaptDirty=!0},_getFont:function(){return this._textFieldRenderer._getFont()},_changePosition:function(){this._adaptRenderers()}}); ccui.TextField.create=function(a,b,c){return new ccui.TextField(a,b,c)};_p=ccui.TextField.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"placeHolder",_p.getPlaceHolder,_p.setPlaceHolder);cc.defineGetterSetter(_p,"font",_p._getFont,_p._setFont);cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.defineGetterSetter(_p,"maxLengthEnabled",_p.isMaxLengthEnabled,_p.setMaxLengthEnabled); cc.defineGetterSetter(_p,"maxLength",_p.getMaxLength,_p.setMaxLength);cc.defineGetterSetter(_p,"passwordEnabled",_p.isPasswordEnabled,_p.setPasswordEnabled);_p=null;ccui.TextField.EVENT_ATTACH_WITH_IME=0;ccui.TextField.EVENT_DETACH_WITH_IME=1;ccui.TextField.EVENT_INSERT_TEXT=2;ccui.TextField.EVENT_DELETE_BACKWARD=3;ccui.TextField.RENDERER_ZORDER=-1;ccui.VideoPlayer=ccui.Widget.extend({_played:!1,_playing:!1,_stopped:!0,ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.setURL(a)},_createRenderCmd:function(){return new ccui.VideoPlayer.RenderCmd(this)},visit:function(){var a=this._renderCmd,b=cc.container,c=cc.eventManager;if(this._visible)b.appendChild(a._video),null===this._listener&&(this._listener=cc.eventManager.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var d=!1;(d="contains"in b? b.contains(a._video):b.compareDocumentPosition(a._video)%16)&&b.removeChild(a._video);c.removeListener(a._listener);a._listener=null}a.updateStatus();a.resize()},setURL:function(a){this._renderCmd.updateURL(a)},getURL:function(){return this._renderCmd._url},play:function(){var a=this,b=this._renderCmd._video;if(b){this._played=!0;b.pause();if(!1!==this._stopped||!1!==this._playing||!0!==this._played)b.currentTime=0;ccui.VideoPlayer._polyfill.autoplayAfterOperation?setTimeout(function(){b.play();a._playing= !0;a._stopped=!1},20):(b.play(),this._playing=!0,this._stopped=!1)}},pause:function(){var a=this._renderCmd._video;a&&!0===this._playing&&!1===this._stopped&&(a.pause(),this._playing=!1)},resume:function(){!1===this._stopped&&!1===this._playing&&!0===this._played&&this.play()},stop:function(){var a=this,b=this._renderCmd._video;b&&(b.pause(),b.currentTime=0,this._playing=!1,this._stopped=!0);setTimeout(function(){a._dispatchEvent(ccui.VideoPlayer.EventType.STOPPED)},0)},seekTo:function(a){var b=this._renderCmd._video; b&&(b.currentTime=a,ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this.isPlaying()&&setTimeout(function(){b.play()},20))},isPlaying:function(){ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this._playing&&setTimeout(function(){video.play()},20);return this._playing},setKeepAspectRatioEnabled:function(a){cc.log("On the web is always keep the aspect ratio")},isKeepAspectRatioEnabled:function(){return!1},setFullScreenEnabled:function(a){var b=this._renderCmd._video;b&&(a?cc.screen.requestFullScreen(b): cc.screen.exitFullScreen(b))},isFullScreenEnabled:function(){cc.log("Can't know status")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null},_dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._video.src)},onPlayEvent:function(){var a=this._EventList[ccui.VideoPlayer.EventType.PLAYING];if(a)for(var b=0;bthis._leftSpaceWidth){var e=a.length*(1- -this._leftSpaceWidth/f),f=a.substr(0,e),g=a.substr(e,a.length-1),h=0this._leftSpaceWidth?(this._addNewLine(),this._pushToContainer(a), this._leftSpaceWidth-=b.width):this._pushToContainer(a)},_addNewLine:function(){this._leftSpaceWidth=this._customSize.width;this._elementRenders.push([])},formatRenderers:function(){var a=0,b=this._elementRenderersContainer,c=this._elementRenders,d,e,f,g,h,k;if(this._ignoreSize){d=0;f=c[0];for(e=g=0;e=this._elementRenders.length||this._elementRenders[this._elementRenders.length-1].push(a)},_adaptRenderers:function(){this.formatText()},setVerticalSpace:function(a){this._verticalSpace=a},setAnchorPoint:function(a){ccui.Widget.prototype.setAnchorPoint.call(this,a);this._elementRenderersContainer.setAnchorPoint(a)},_setAnchorX:function(a){ccui.Widget.prototype._setAnchorX.call(this,a);this._elementRenderersContainer._setAnchorX(a)}, _setAnchorY:function(a){ccui.Widget.prototype._setAnchorY.call(this,a);this._elementRenderersContainer._setAnchorY(a)},getVirtualRendererSize:function(){return this._elementRenderersContainer.getContentSize()},ignoreContentAdaptWithSize:function(a){this._ignoreSize!==a&&(this._formatTextDirty=!0,ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a))},getContentSize:function(){this.formatText();return cc.Node.prototype.getContentSize.call(this)},_getWidth:function(){this.formatText();return cc.Node.prototype._getWidth.call(this)}, _getHeight:function(){this.formatText();return cc.Node.prototype._getHeight.call(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,void 0===b?a.width:a,void 0===b?a.height:b);this._formatTextDirty=!0},getDescription:function(){return"RichText"},setCascadeOpacityEnabled:function(a){ccui.Widget.prototype.setCascadeOpacityEnabled.call(this,a);this._elementRenderersContainer.setCascadeOpacityEnabled(a)},setLineBreakOnSpace:function(a){this._lineBreakOnSpace=a;this._formatTextDirty= !0;this.formatText()},setTextHorizontalAlignment:function(a){a!==this._textHorizontalAlignment&&(this._textHorizontalAlignment=a,this.formatText())},setTextVerticalAlignment:function(a){a!==this._textVerticalAlignment&&(this._textVerticalAlignment=a,this.formatText())}});ccui.RichText.create=function(){return new ccui.RichText};ccui.RichElement.TEXT=0;ccui.RichElement.IMAGE=1;ccui.RichElement.CUSTOM=2;ccui.WebView=ccui.Widget.extend({ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.loadURL(a)},visit:function(){var a=this._renderCmd,b=a._div,c=cc.container,d=cc.eventManager;if(this._visible)c.appendChild(b),null===this._listener&&(this._listener=d.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var e=!1;(e="contains"in c?c.contains(b):c.compareDocumentPosition(b)%16)&&c.removeChild(b);b=d._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners(); d._removeListenerInVector(b,a._listener);a._listener=null}a.updateStatus();a.resize(cc.view)},setJavascriptInterfaceScheme:function(a){},loadData:function(a,b,c,d){},loadHTMLString:function(a,b){},loadURL:function(a){this._renderCmd.updateURL(a);this._dispatchEvent(ccui.WebView.EventType.LOADING)},stopLoading:function(){cc.log("Web does not support loading")},reload:function(){var a=this._renderCmd._iframe;a&&(a=a.contentWindow)&&a.location&&a.location.reload()},canGoBack:function(){cc.log("Web does not support query history"); return!0},canGoForward:function(){cc.log("Web does not support query history");return!0},goBack:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoBack");var a=this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.back.call(b)}catch(c){b.history.back()}}}catch(d){cc.log(d)}},goForward:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoForward");var a= this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.forward.call(b)}catch(c){b.history.forward()}}}catch(d){cc.log(d)}},evaluateJS:function(a){var b=this._renderCmd._iframe;if(b){b=b.contentWindow;try{b.eval(a),this._dispatchEvent(ccui.WebView.EventType.JS_EVALUATED)}catch(c){console.error(c)}}},setScalesPageToFit:function(){cc.log("Web does not support zoom")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null}, _dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._iframe.src)},_createRenderCmd:function(){return new ccui.WebView.RenderCmd(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);void 0===b&&(b=a.height,a=a.width);this._renderCmd.changeSize(a,b)},cleanup:function(){this._renderCmd.removeDom();this.stopAllActions();this.unscheduleAllCallbacks()}});ccui.WebView.EventType={LOADING:"loading",LOADED:"load",ERROR:"error",JS_EVALUATED:"js"}; (function(){var a=ccui.WebView._polyfill={devicePixelRatio:!1,enableDiv:!1};cc.sys.os===cc.sys.OS_IOS&&(a.enableDiv=!0);cc.sys.isMobile?cc.sys.browserType===cc.sys.BROWSER_TYPE_FIREFOX&&(a.enableBG=!0):cc.sys.browserType===cc.sys.BROWSER_TYPE_IE&&(a.closeHistory=!0)})(); (function(a){var b=null,b=cc._renderType===cc.game.RENDER_TYPE_WEBGL?cc.Node.WebGLRenderCmd:cc.Node.CanvasRenderCmd;ccui.WebView.RenderCmd=function(b){this._rootCtor(b);this._iframe=this._div=null;a.enableDiv?(this._div=document.createElement("div"),this._div.style["-webkit-overflow"]="auto",this._div.style["-webkit-overflow-scrolling"]="touch",this._iframe=document.createElement("iframe"),this._iframe.style.width="100%",this._iframe.style.height="100%",this._div.appendChild(this._iframe)):this._div= this._iframe=document.createElement("iframe");a.enableBG&&(this._div.style.background="#FFF");this._iframe.addEventListener("load",function(){b._dispatchEvent(ccui.WebView.EventType.LOADED)});this._iframe.addEventListener("error",function(){b._dispatchEvent(ccui.WebView.EventType.ERROR)});this._div.style.background="#FFF";this._div.style.height="200px";this._div.style.width="300px";this._div.style.overflow="scroll";this._div.style.border="none";this._listener=null;this.initStyle()};b=ccui.WebView.RenderCmd.prototype= Object.create(b.prototype);b.constructor=ccui.WebView.RenderCmd;b.transform=function(a,b){this.originTransform(a,b);this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY)};b.updateStatus=function(){a.devicePixelRatio=cc.view.isRetinaEnabled();var b=cc.Node._dirtyFlags,d=this._dirtyFlag;d&b.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty); d&b.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&b.orderDirty)};b.resize=function(a){a=a||cc.view;var b=this._node,e=cc.eventManager;b._parent&&b._visible?this.updateMatrix(this._worldTransform,a._scaleX,a._scaleY):(a=e._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners(),e._removeListenerInVector(a,this._listener),this._listener=null)};b.updateMatrix=function(b,d,e){var f=this._node;if(a.devicePixelRatio){var g=cc.view.getDevicePixelRatio();d/=g;e/=g}if(!1!==this._loaded){var h=cc.game.container.style, g=parseInt(h.paddingLeft),h=parseInt(h.paddingBottom),k=f._contentSize.width,m=f._contentSize.height;b="matrix("+b.a*d+","+b.b+","+b.c+","+b.d*e+","+(g+b.tx*d-k/2+k*f._scaleX/2*d)+","+-(h+b.ty*e-m/2+m*f._scaleY/2*e)+")";this._div.style.transform=b;this._div.style["-webkit-transform"]=b}};b.initStyle=function(){if(this._div){var a=this._div;a.style.position="absolute";a.style.bottom="0px";a.style.left="0px"}};b.updateURL=function(a){var b=this._iframe;b.src=a;var e=this,f=function(){e._loaded=!0;b.removeEventListener("load", f)};b.addEventListener("load",f)};b.changeSize=function(a,b){var e=this._div;e&&(e.style.width=a+"px",e.style.height=b+"px")};b.removeDom=function(){var a=this._div;if(a){var b=!1;(b="contains"in cc.container?cc.container.contains(a):cc.container.compareDocumentPosition(a)%16)&&cc.container.removeChild(a)}}})(ccui.WebView._polyfill);ccui.ScrollViewBar=ccui.ProtectedNode.extend({_parentScroll:null,_direction:null,_upperHalfCircle:null,_lowerHalfCircle:null,_body:null,_opacity:255,_marginFromBoundary:0,_marginForLength:0,_touching:!1,_autoHideEnabled:!0,autoHideTime:0,_autoHideRemainingTime:0,_className:"ScrollViewBar",ctor:function(a,b){cc.ProtectedNode.prototype.ctor.call(this);this._direction=b;this._parentScroll=a;this._marginForLength=this._marginFromBoundary=ccui.ScrollViewBar.DEFAULT_MARGIN;this.opacity=255*ccui.ScrollViewBar.DEFAULT_SCROLLBAR_OPACITY; this.autoHideTime=ccui.ScrollViewBar.DEFAULT_AUTO_HIDE_TIME;this._autoHideEnabled=!0;ccui.ScrollViewBar.prototype.init.call(this);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0)},init:function(){this._upperHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY);this._upperHalfCircle.setAnchorPoint(cc.p(0.5,0));this._lowerHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY); this._lowerHalfCircle.setAnchorPoint(cc.p(0.5,0));this._lowerHalfCircle.setScaleY(-1);this.addProtectedChild(this._upperHalfCircle);this.addProtectedChild(this._lowerHalfCircle);this._body=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT,ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT_KEY);this._body.setAnchorPoint(cc.p(0.5,0));this.addProtectedChild(this._body);this.setColor(ccui.ScrollViewBar.DEFAULT_COLOR);this.onScrolled(cc.p(0,0));cc.ProtectedNode.prototype.setOpacity.call(this, 0);this._autoHideRemainingTime=0;this._direction===ccui.ScrollView.DIR_HORIZONTAL&&this.setRotation(90)},setPositionFromCorner:function(a){this._direction===ccui.ScrollView.DIR_VERTICAL?(this._marginForLength=a.y,this._marginFromBoundary=a.x):(this._marginForLength=a.x,this._marginFromBoundary=a.y)},onEnter:function(){cc.ProtectedNode.prototype.onEnter.call(this);this.scheduleUpdate()},getPositionFromCorner:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?cc.p(this._marginFromBoundary, this._marginForLength):cc.p(this._marginForLength,this._marginFromBoundary)},setWidth:function(a){a/=this._body.width;this._body.setScaleX(a);this._upperHalfCircle.setScale(a);this._lowerHalfCircle.setScale(-a)},getWidth:function(){return this._body.getBoundingBox().width},setAutoHideEnabled:function(a){this._autoHideEnabled=a;!this._autoHideEnabled&&!this._touching&&0>=this._autoHideRemainingTime?cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity):cc.ProtectedNode.prototype.setOpacity.call(this, 0)},isAutoHideEnabled:function(){return this._autoHideEnabled},setOpacity:function(a){this._opacity=a},getOpacity:function(){return this._opacity},_updateLength:function(a){var b=a/this._body.getTextureRect().height;this._body.setScaleY(b);this._upperHalfCircle.setPositionY(this._body.getPositionY()+a)},_processAutoHide:function(a){!this._autoHideEnabled||0>=this._autoHideRemainingTime||this._touching||(this._autoHideRemainingTime-=a,this._autoHideRemainingTime<=this.autoHideTime&&(this._autoHideRemainingTime= Math.max(0,this._autoHideRemainingTime),cc.ProtectedNode.prototype.setOpacity.call(this,this._autoHideRemainingTime/this.autoHideTime*this._opacity)))},update:function(a){this._processAutoHide(a)},onTouchBegan:function(){this._autoHideEnabled&&(this._touching=!0)},onTouchEnded:function(){this._autoHideEnabled&&(this._touching=!1,0>=this._autoHideRemainingTime||(this._autoHideRemainingTime=this.autoHideTime))},onScrolled:function(a){this._autoHideEnabled&&(this._autoHideRemainingTime=this.autoHideTime, cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity));var b=this._parentScroll.getInnerContainer(),c=0,d=0,e=0,f=0;this._direction===ccui.ScrollView.DIR_VERTICAL?(c=b.height,d=this._parentScroll.height,e=a.y,f=-b.getPositionY()):this._direction===ccui.ScrollView.DIR_HORIZONTAL&&(c=b.width,d=this._parentScroll.width,e=a.x,f=-b.getPositionX());a=this._calculateLength(c,d,e);c=this._calculatePosition(c,d,f,e,a);this._updateLength(a);this.setPosition(c)},_calculateLength:function(a,b,c){0!== c&&(a+=20*(0=d.height-e.y||f+c.height<=-e.y||(g=b.x-a.x*c.width)>=d.width-e.x||g+c.width<=-e.x?!1:!0},updateChildren:function(){var a, b,c,d=this._innerContainer._children;b=0;for(c=d.length;bthis._leftBoundary?b.x=this._leftBoundary-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.xthis._bottomBoundary&&(b.y=this._bottomBoundary-(this._innerContainer.getBottomBoundary()+a.y));0===a.x&&0===a.y&&(this._outOfBoundaryAmount=b,this._outOfBoundaryAmountDirty=!1);return b},_isOutOfBoundary:function(a){var b=this._getHowMuchOutOfBoundary();if(void 0!==a)switch(a){case ccui.ScrollView.MOVEDIR_TOP:return 0b.y;case ccui.ScrollView.MOVEDIR_LEFT:return 0> b.x;case ccui.ScrollView.MOVEDIR_RIGHT:return 0=this._touchTotalTimeThreshold)return cc.p(0,0);for(var c=cc.p(0,0),b=0;b=Math.abs(a.x)&&1E-4>=Math.abs(a.y)},_processAutoScrolling:function(a){var b=this._isNecessaryAutoScrollBrake()?0.05:1;this._autoScrollAccumulatedTime+=1/b*a;var c=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(c-=1,c=c*c*c*c*c+1);a=cc.pAdd(this._autoScrollStartPosition, cc.pMult(this._autoScrollTargetDelta,c));c=Math.abs(c-1)<=this._getAutoScrollStopEpsilon();this.bounceEnabled?a=cc.pAdd(this._autoScrollBrakingStartPosition,cc.pMult(cc.pSub(a,this._autoScrollBrakingStartPosition),b)):(b=cc.pSub(a,this.getInnerContainerPosition()),b=this._getHowMuchOutOfBoundary(b),this._fltEqualZero(b)||(a.x+=b.x,a.y+=b.y,c=!0));c&&(this._autoScrolling=!1,this._dispatchEvent(ccui.ScrollView.EVENT_AUTOSCROLL_ENDED));this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()), c)},_jumpToDestination:function(a,b){void 0===a.x&&(a=cc.p(a,b));this._autoScrolling=!1;this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()),!0)},_scrollChildren:function(a){if(this.bounceEnabled){var b=this._getHowMuchOutOfBoundary();a.x*=0==b.x?1:0.5;a.y*=0==b.y?1:0.5}this.bounceEnabled||(b=this._getHowMuchOutOfBoundary(a),a.x+=b.x,a.y+=b.y);var c=b=!1,d=!1,e=!1;0=this._bottomBoundary&&(e=!0):0>a.y&&this._innerContainer.getTopBoundary()+ a.y<=this._topBoundary&&(d=!0);0>a.x?this._innerContainer.getRightBoundary()+a.x<=this._rightBoundary&&(c=!0):0=this._leftBoundary&&(b=!0);this._moveInnerContainer(a,!1);0==a.x&&0==a.y||this._processScrollingEvent();e&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_BOTTOM,!1);d&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_TOP,!1);b&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_LEFT,!1);c&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_RIGHT, !1)},scrollToBottom:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),0),a,b)},scrollToTop:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToLeft:function(a,b){this._startAutoScrollToDestination(cc.p(0,this._innerContainer.getPositionY()),a,b)},scrollToRight:function(a,b){this._startAutoScrollToDestination(cc.p(this._contentSize.width- this._innerContainer.getContentSize().width,this._innerContainer.getPositionY()),a,b)},scrollToTopLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToTopRight:function(a,b){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll direction is not both!");else{var c=this._innerContainer.getContentSize();this._startAutoScrollToDestination(cc.p(this._contentSize.width- c.width,this._contentSize.height-c.height),a,b)}},scrollToBottomLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,0),a,b)},scrollToBottomRight:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(this._contentSize.width-this._innerContainer.getContentSize().width,0),a,b)},scrollToPercentVertical:function(a,b,c){var d=this._contentSize.height- this._innerContainer.getContentSize().height,e=-d;this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),d+a*e/100),b,c)},scrollToPercentHorizontal:function(a,b,c){var d=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a*d/100),this._innerContainer.getPositionY()),b,c)},scrollToPercentBothDirection:function(a,b,c){if(this._direction===ccui.ScrollView.DIR_BOTH){var d=this._contentSize.height-this._innerContainer.getContentSize().height, e=-d,f=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a.x*f/100),d+a.y*e/100),b,c)}},jumpToBottom:function(){this._jumpToDestination(this._innerContainer.getPositionX(),0)},jumpToTop:function(){this._jumpToDestination(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToLeft:function(){this._jumpToDestination(0,this._innerContainer.getPositionY())},jumpToRight:function(){this._jumpToDestination(this._contentSize.width- this._innerContainer.getContentSize().width,this._innerContainer.getPositionY())},jumpToTopLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToTopRight:function(){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll _direction is not both!");else{var a=this._innerContainer.getContentSize();this._jumpToDestination(this._contentSize.width-a.width, this._contentSize.height-a.height)}},jumpToBottomLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,0)},jumpToBottomRight:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(this._contentSize.width-this._innerContainer.getContentSize().width,0)},jumpToPercentVertical:function(a){var b=this._contentSize.height-this._innerContainer.getContentSize().height,c=-b; this._jumpToDestination(this._innerContainer.getPositionX(),b+a*c/100)},jumpToPercentHorizontal:function(a){var b=this._innerContainer.getContentSize().width-this._contentSize.width;this._jumpToDestination(-(a*b/100),this._innerContainer.getPositionY())},jumpToPercentBothDirection:function(a){if(this._direction===ccui.ScrollView.DIR_BOTH){var b=this._innerContainer.getContentSize(),c=this._contentSize.height-b.height;this._jumpToDestination(-(a.x*(b.width-this._contentSize.width)/100),c+a.y*-c/100)}}, _gatherTouchMove:function(a){for(;5<=this._touchMoveDisplacements.length;)this._touchMoveDisplacements.splice(0,1),this._touchMoveTimeDeltas.splice(0,1);this._touchMoveDisplacements.push(a);a=(new Date).getTime();this._touchMoveTimeDeltas.push((a-this._touchMovePreviousTimestamp)/1E3);this._touchMovePreviousTimestamp=a},_handlePressLogic:function(a){this._bePressed=!0;this._autoScrolling=!1;this._touchMovePreviousTimestamp=(new Date).getTime();this._touchMoveDisplacements.length=0;this._touchMoveTimeDeltas.length= 0;if(this._verticalScrollBar)this._verticalScrollBar.onTouchBegan();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchBegan()},_handleMoveLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._scrollChildren(b);this._gatherTouchMove(b)},_handleReleaseLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._gatherTouchMove(b); this._bePressed=!1;!this._startBounceBackIfNeeded()&&this.inertiaScrollEnabled&&(b=this._calculateTouchMoveVelocity(),0===b.x&&0===b.y||this._startInertiaScroll(b));if(this._verticalScrollBar)this._verticalScrollBar.onTouchEnded();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchEnded()},onTouchBegan:function(a,b){var c=ccui.Layout.prototype.onTouchBegan.call(this,a,b);this._isInterceptTouch||this._hit&&this._handlePressLogic(a);return c},onTouchMoved:function(a,b){ccui.Layout.prototype.onTouchMoved.call(this, a,b);this._isInterceptTouch||this._handleMoveLogic(a)},onTouchEnded:function(a,b){ccui.Layout.prototype.onTouchEnded.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},onTouchCancelled:function(a,b){ccui.Layout.prototype.onTouchCancelled.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},update:function(a){this._autoScrolling&&this._processAutoScrolling(a)},interceptTouchEvent:function(a,b,c){if(!this._touchEnabled)ccui.Layout.prototype.interceptTouchEvent.call(this, a,b,c);else if(this._direction!==ccui.ScrollView.DIR_NONE){var d=c.getLocation();switch(a){case ccui.Widget.TOUCH_BEGAN:this._isInterceptTouch=!0;this._touchBeganPosition.x=d.x;this._touchBeganPosition.y=d.y;this._handlePressLogic(c);break;case ccui.Widget.TOUCH_MOVED:a=cc.pLength(cc.pSub(b.getTouchBeganPosition(),d));this._touchMovePosition.x=d.x;this._touchMovePosition.y=d.y;a>this._childFocusCancelOffset&&(b.setHighlighted(!1),this._handleMoveLogic(c));break;case ccui.Widget.TOUCH_CANCELED:case ccui.Widget.TOUCH_ENDED:this._touchEndPosition.x= d.x,this._touchEndPosition.y=d.y,this._handleReleaseLogic(c),b.isSwallowTouches()&&(this._isInterceptTouch=!1)}}},_processScrollEvent:function(a,b){var c=0;switch(a){case ccui.ScrollView.MOVEDIR_TOP:c=b?ccui.ScrollView.EVENT_BOUNCE_TOP:ccui.ScrollView.EVENT_SCROLL_TO_TOP;break;case ccui.ScrollView.MOVEDIR_BOTTOM:c=b?ccui.ScrollView.EVENT_BOUNCE_BOTTOM:ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM;break;case ccui.ScrollView.MOVEDIR_LEFT:c=b?ccui.ScrollView.EVENT_BOUNCE_LEFT:ccui.ScrollView.EVENT_SCROLL_TO_LEFT; break;case ccui.ScrollView.MOVEDIR_RIGHT:c=b?ccui.ScrollView.EVENT_BOUNCE_RIGHT:ccui.ScrollView.EVENT_SCROLL_TO_RIGHT}this._dispatchEvent(c)},_processScrollingEvent:function(){this._dispatchEvent(ccui.ScrollView.EVENT_SCROLLING)},_dispatchEvent:function(a){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,a):this._scrollViewEventSelector(this,a));this._ccEventCallback&&this._ccEventCallback(this,a)},addEventListenerScrollView:function(a, b){this._scrollViewEventSelector=a;this._scrollViewEventListener=b},addEventListener:function(a){this._ccEventCallback=a},setDirection:function(a){this._direction=a;this._scrollBarEnabled&&(this._removeScrollBar(),this._initScrollBar())},getDirection:function(){return this._direction},setBounceEnabled:function(a){this.bounceEnabled=a},isBounceEnabled:function(){return this.bounceEnabled},setInertiaScrollEnabled:function(a){this.inertiaScrollEnabled=a},isInertiaScrollEnabled:function(){return this.inertiaScrollEnabled}, setScrollBarEnabled:function(a){this._scrollBarEnabled!==a&&(this._scrollBarEnabled&&this._removeScrollBar(),(this._scrollBarEnabled=a)&&this._initScrollBar())},isScrollBarEnabled:function(){return this._scrollBarEnabled},setScrollBarPositionFromCorner:function(a){this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a);this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a)},setScrollBarPositionFromCornerForVertical:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");this._verticalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForVertical:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");return this._verticalScrollBar.getPositionFromCorner()},setScrollBarPositionFromCornerForHorizontal:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");this._horizontalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForHorizontal:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");return this._horizontalScrollBar.getPositionFromCorner()},setScrollBarWidth:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.setWidth(a);this._horizontalScrollBar&&this._horizontalScrollBar.setWidth(a)},getScrollBarWidth:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.getWidth():this._horizontalScrollBar?this._horizontalScrollBar.getWidth():0},setScrollBarColor:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&& this._verticalScrollBar.setColor(a);this._horizontalScrollBar&&this._horizontalScrollBar.setColor(a)},getScrollBarColor:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.getColor();this._horizontalScrollBar&&this._horizontalScrollBar.getColor();return cc.color.WHITE},setScrollBarOpacity:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.opacity=a); this._horizontalScrollBar&&(this._horizontalScrollBar.opacity=a)},getScrollBarOpacity:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.opacity:this._horizontalScrollBar?this._horizontalScrollBar.opacity:-1},setScrollBarAutoHideEnabled:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideEnabled=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideEnabled= a)},isScrollBarAutoHideEnabled:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideEnabled:this._horizontalScrollBar?this._horizontalScrollBar.autoHideEnabled:!1},setScrollBarAutoHideTime:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideTime=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideTime=a)},getScrollBarAutoHideTime:function(){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideTime:this._horizontalScrollBar?this._horizontalScrollBar.autoHideTime:0},getInnerContainer:function(){return this._innerContainer},setLayoutType:function(a){this._innerContainer.setLayoutType(a)},getLayoutType:function(){return this._innerContainer.getLayoutType()},_doLayout:function(){this._doLayoutDirty&&(this._doLayoutDirty=!1)},getDescription:function(){return"ScrollView"},_createCloneInstance:function(){return new ccui.ScrollView}, _copyClonedWidgetChildren:function(a){ccui.Layout.prototype._copyClonedWidgetChildren.call(this,a)},_copySpecialProperties:function(a){a instanceof ccui.ScrollView&&(ccui.Layout.prototype._copySpecialProperties.call(this,a),this.setInnerContainerSize(a.getInnerContainerSize()),this.setInnerContainerPosition(a.getInnerContainerPosition()),this.setDirection(a._direction),this._topBoundary=a._topBoundary,this._bottomBoundary=a._bottomBoundary,this._leftBoundary=a._leftBoundary,this._rightBoundary=a._rightBoundary, this._bePressed=a._bePressed,this._childFocusCancelOffset=a._childFocusCancelOffset,this._touchMoveDisplacements=a._touchMoveDisplacements,this._touchMoveTimeDeltas=a._touchMoveTimeDeltas,this._touchMovePreviousTimestamp=a._touchMovePreviousTimestamp,this._autoScrolling=a._autoScrolling,this._autoScrollAttenuate=a._autoScrollAttenuate,this._autoScrollStartPosition=a._autoScrollStartPosition,this._autoScrollTargetDelta=a._autoScrollTargetDelta,this._autoScrollTotalTime=a._autoScrollTotalTime,this._autoScrollAccumulatedTime= a._autoScrollAccumulatedTime,this._autoScrollCurrentlyOutOfBoundary=a._autoScrollCurrentlyOutOfBoundary,this._autoScrollBraking=a._autoScrollBraking,this._autoScrollBrakingStartPosition=a._autoScrollBrakingStartPosition,this.setBounceEnabled(a.bounceEnabled),this.setInertiaScrollEnabled(a.inertiaScrollEnabled),this._scrollViewEventListener=a._scrollViewEventListener,this._scrollViewEventSelector=a._scrollViewEventSelector,this._ccEventCallback=a._ccEventCallback,this.setScrollBarEnabled(a.isScrollBarEnabled()), this.isScrollBarEnabled()&&(this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a.getScrollBarPositionFromCornerForVertical()),this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a.getScrollBarPositionFromCornerForHorizontal()),this.setScrollBarWidth(a.getScrollBarWidth()),this.setScrollBarColor(a.getScrollBarColor()),this.setScrollBarAutoHideEnabled(a.isScrollBarAutoHideEnabled()),this.setScrollBarAutoHideTime(a.getScrollBarAutoHideTime())))}, _initScrollBar:function(){this._direction===ccui.ScrollView.DIR_HORIZONTAL||this._verticalScrollBar||(this._verticalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_VERTICAL),this.addProtectedChild(this._verticalScrollBar,2));this._direction===ccui.ScrollView.DIR_VERTICAL||this._horizontalScrollBar||(this._horizontalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_HORIZONTAL),this.addProtectedChild(this._horizontalScrollBar,2))},_removeScrollBar:function(){this._verticalScrollBar&& (this.removeProtectedChild(this._verticalScrollBar),this._verticalScrollBar=null);this._horizontalScrollBar&&(this.removeProtectedChild(this._horizontalScrollBar),this._horizontalScrollBar=null)},getNodeByTag:function(a){return this._innerContainer.getNodeByTag(a)},getNodes:function(){return this._innerContainer.getNodes()},removeNode:function(a){this._innerContainer.removeNode(a)},removeNodeByTag:function(a){this._innerContainer.removeNodeByTag(a)},removeAllNodes:function(){this._innerContainer.removeAllNodes()}, addNode:function(a,b,c){this._innerContainer.addNode(a,b,c)}});_p=ccui.ScrollView.prototype;cc.defineGetterSetter(_p,"innerWidth",_p._getInnerWidth,_p._setInnerWidth);cc.defineGetterSetter(_p,"innerHeight",_p._getInnerHeight,_p._setInnerHeight);cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"touchTotalTimeThreshold",_p.getTouchTotalTimeThreshold,_p.setTouchTotalTimeThreshold);_p=null;ccui.ScrollView.create=function(){return new ccui.ScrollView}; ccui.ScrollView.DIR_NONE=0;ccui.ScrollView.DIR_VERTICAL=1;ccui.ScrollView.DIR_HORIZONTAL=2;ccui.ScrollView.DIR_BOTH=3;ccui.ScrollView.EVENT_SCROLL_TO_TOP=0;ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM=1;ccui.ScrollView.EVENT_SCROLL_TO_LEFT=2;ccui.ScrollView.EVENT_SCROLL_TO_RIGHT=3;ccui.ScrollView.EVENT_SCROLLING=4;ccui.ScrollView.EVENT_BOUNCE_TOP=5;ccui.ScrollView.EVENT_BOUNCE_BOTTOM=6;ccui.ScrollView.EVENT_BOUNCE_LEFT=7;ccui.ScrollView.EVENT_BOUNCE_RIGHT=8;ccui.ScrollView.EVENT_CONTAINER_MOVED=9; ccui.ScrollView.EVENT_AUTOSCROLL_ENDED=10;ccui.ScrollView.MOVEDIR_TOP=0;ccui.ScrollView.MOVEDIR_BOTTOM=1;ccui.ScrollView.MOVEDIR_LEFT=2;ccui.ScrollView.MOVEDIR_RIGHT=3;ccui.ListView=ccui.ScrollView.extend({_model:null,_items:null,_gravity:null,_itemsMargin:0,_curSelectedIndex:0,_refreshViewDirty:!0,_listViewEventListener:null,_listViewEventSelector:null,_ccListViewEventCallback:null,_magneticAllowedOutOfBoundary:!0,_magneticType:0,_className:"ListView",ctor:function(){this._items=[];ccui.ScrollView.prototype.ctor.call(this);this._gravity=ccui.ListView.GRAVITY_CENTER_VERTICAL;this.setTouchEnabled(!0);this.setDirection(ccui.ScrollView.DIR_VERTICAL)},setItemModel:function(a){a? this._model=a:cc.log("Can't set a null to item model!")},_handleReleaseLogic:function(a){ccui.ScrollView.prototype._handleReleaseLogic.call(this,a);this._autoScrolling||this._startMagneticScroll()},_onItemListChanged:function(){this._outOfBoundaryAmountDirty=!0},_updateInnerContainerSize:function(){var a,b=this._items,c;switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:c=b.length;var d=(c-1)*this._itemsMargin;for(a=0;aa||a>=this._items.length? null:this._items[a]},getItems:function(){return this._items},getIndex:function(a){return null==a?-1:this._items.indexOf(a)},setGravity:function(a){this._gravity!==a&&(this._gravity=a,this._refreshViewDirty=!0)},setMagneticType:function(a){this._magneticType=a;this._onItemListChanged();this._startMagneticScroll()},getMagneticType:function(){return this._magneticType},setMagneticAllowedOutOfBoundary:function(a){this._magneticAllowedOutOfBoundary=a},getMagneticAllowedOutOfBoundary:function(){return this._magneticAllowedOutOfBoundary}, setItemsMargin:function(a){this._itemsMargin!==a&&(this._itemsMargin=a,this._refreshViewDirty=!0)},getItemsMargin:function(){return this._itemsMargin},setDirection:function(a){switch(a){case ccui.ScrollView.DIR_VERTICAL:this.setLayoutType(ccui.Layout.LINEAR_VERTICAL);break;case ccui.ScrollView.DIR_HORIZONTAL:this.setLayoutType(ccui.Layout.LINEAR_HORIZONTAL);break;case ccui.ScrollView.DIR_BOTH:return;default:return}ccui.ScrollView.prototype.setDirection.call(this,a)},_getHowMuchOutOfBoundary:function(a){void 0=== a&&(a=cc.p(0,0));if(this._magneticAllowedOutOfBoundary&&0!==this._items.length){if(this._magneticType===ccui.ListView.MAGNETIC_NONE||this._magneticType===ccui.ListView.MAGNETIC_BOTH_END)return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);if(0===a.x&&0===a.y&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount}else return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);var b=this._leftBoundary,c=this._rightBoundary,d=this._topBoundary,e=this._bottomBoundary, f=this._items.length-1,g=this.getContentSize(),h=cc.p(0,0),k=cc.p(0,0);switch(this._magneticType){case ccui.ListView.MAGNETIC_CENTER:h.x=(g.width-this._items[0].width)/2;h.y=(g.height-this._items[0].height)/2;k.x=(g.width-this._items[f].width)/2;k.y=(g.height-this._items[f].height)/2;break;case ccui.ListView.MAGNETIC_LEFT:case ccui.ListView.MAGNETIC_TOP:k.x=g.width-this._items[f].width;k.y=g.height-this._items[f].height;break;case ccui.ListView.MAGNETIC_RIGHT:case ccui.ListView.MAGNETIC_BOTTOM:h.x= g.width-this._items[0].width,h.y=g.height-this._items[0].height}b+=h.x;c-=k.x;d-=h.y;e+=k.y;f=cc.p(0,0);this._innerContainer.getLeftBoundary()+a.x>b?f.x=b-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.xe&&(f.y=e-(this._innerContainer.getBottomBoundary()+a.y));0=== a.x&&0===a.y&&(this._outOfBoundaryAmount=f,this._outOfBoundaryAmountDirty=!1);return f},_calculateItemPositionWithAnchor:function(a,b){var c=cc.p(a.getLeftBoundary(),a.getBottomBoundary()),d=a.getContentSize();return cc.p(c.x+d.width*b.x,c.y+d.height*b.y)},_findClosestItem:function(a,b,c,d,e,f,g){cc.assert(0<=d&&f=this._items.length))if(a=this._flattenVectorByDirection(this._calculateTouchMoveVelocity()),500>cc.pLength(a))this._startMagneticScroll();else{var b=this.getItem(this._curPageIdx),b=this._calculateItemDestination(cc.p(0.5,0.5),b,cc.p(0.5,0.5)),b=cc.pSub(b,this.getInnerContainerPosition()),b=this._flattenVectorByDirection(b);0a.x||0a;)this._decreaseNumberOfPages();this._rearrange();this._currentIndexNode.setVisible(0< this._indexNodes.length)},indicate:function(a){0>a||a>=this._indexNodes.length||this._currentIndexNode.setPosition(this._indexNodes[a].getPosition())},_rearrange:function(){if(0!==this._indexNodes.length)for(var a=this._direction===ccui.ScrollView.DIR_HORIZONTAL,b=this._indexNodes[0].getContentSize(),c=a?b.width:b.height,d=this._indexNodes.length,d=-((c*d+this._spaceBetweenIndexNodes*(d-1))/2)+c/2,e=0;ed.width&&(d.width=0),e.x=this._leftMargin+c.x*d.width):(this._usingPercentWidth&&(d.width=a.width*this._percentWidth),e.x=a.width*this._positionPercentX)}switch(this._verticalEdge){case ccui.LayoutComponent.verticalEdge.NONE:this._usingStretchHeight&& !this._isPercentOnly?(d.height=a.height*this._percentHeight,e.y=this._bottomMargin+c.y*d.height):(this._usingPositionPercentY&&(e.y=a.height*this._positionPercentY),this._usingPercentHeight&&(d.height=a.height*this._percentHeight));break;case ccui.LayoutComponent.verticalEdge.BOTTOM:if(this._isPercentOnly)break;if(this._usingPercentHeight||this._usingStretchHeight)d.height=a.height*this._percentHeight;e.y=this._bottomMargin+c.y*d.height;break;case ccui.LayoutComponent.verticalEdge.TOP:if(this._isPercentOnly)break; if(this._usingPercentHeight||this._usingStretchHeight)d.height=a.height*this._percentHeight;e.y=a.height-(this._topMargin+(1-c.y)*d.height);break;case ccui.LayoutComponent.verticalEdge.CENTER:if(this._isPercentOnly)break;this._usingStretchHeight?(d.height=a.height-this._topMargin-this._bottomMargin,0>d.height&&(d.height=0),e.y=this._bottomMargin+c.y*d.height):(this._usingPercentHeight&&(d.height=a.height*this._percentHeight),e.y=a.height*this._positionPercentY)}b.setPosition(e);b.setContentSize(d); if(b instanceof ccui.PageView)for(b.forceDoLayout(),a=b.getPages(),b=0;b=f+h:1);)k=m[n], f+=h,h=parseFloat(k.getAttribute(ccs.CONST_A_DURATION)),n++;s=this.decodeFrame(s,k,c,d);e.addFrameData(s);s.frameID=p;p+=s.duration;e.duration=p}b=e.frameList;c=Math.PI;for(g=b.length-1;0<=g;g--)if(0c)b[g-1].skewX=0>d?b[g-1].skewX-2*c:b[g-1].skewX+2*c;if(f<-c||f>c)b[g-1].skewY=0>f?b[g-1].skewY-2*c:b[g-1].skewY+2*c}b=new ccs.FrameData;b.copy(e.frameList[e.frameList.length-1]);b.frameID=e.duration;e.addFrameData(b);return e},decodeMovementBoneFromJson:function(a, b){var c=new ccs.MovementBoneData;c.init();c.delay=a[ccs.CONST_A_MOVEMENT_DELAY]||0;var d=a[ccs.CONST_A_NAME];d&&(c.name=d);for(var e=(a[ccs.CONST_FRAME_DATA]||[]).length,d=0;df)e[d-1].skewX=0>g?e[d-1].skewX-2*f:e[d-1].skewX+2*f;if(h<-f||h>f)e[d-1].skewY=0>h?e[d-1].skewY-2*f:e[d-1].skewY+2*f}b.cocoStudioVersion=ccs.CONST_VERSION_2_0){if(e=a.getAttribute(ccs.CONST_A_COCOS2DX_X))c.x=parseFloat(e),c.x*=this._positionReadScale;e=a.getAttribute(ccs.CONST_A_COCOS2DX_Y)}else{if(e=a.getAttribute(ccs.CONST_A_X))c.x= parseFloat(e),c.x*=this._positionReadScale;e=a.getAttribute(ccs.CONST_A_Y)}e&&(c.y=-parseFloat(e),c.y*=this._positionReadScale);e=a.getAttribute(ccs.CONST_A_SCALE_X);null!=e&&(c.scaleX=parseFloat(e));e=a.getAttribute(ccs.CONST_A_SCALE_Y);null!=e&&(c.scaleY=parseFloat(e));e=a.getAttribute(ccs.CONST_A_SKEW_X);null!=e&&(c.skewX=cc.degreesToRadians(parseFloat(e)));e=a.getAttribute(ccs.CONST_A_SKEW_Y);null!=e&&(c.skewY=cc.degreesToRadians(-parseFloat(e)));e=a.getAttribute(ccs.CONST_A_DURATION);null!=e&& (c.duration=parseFloat(e));e=a.getAttribute(ccs.CONST_A_DISPLAY_INDEX);null!=e&&(c.displayIndex=parseFloat(e));e=a.getAttribute(ccs.CONST_A_Z);null!=e&&(c.zOrder=parseInt(e));e=a.getAttribute(ccs.CONST_A_TWEEN_ROTATE);null!=e&&(c.tweenRotate=parseFloat(e));e=a.getAttribute(ccs.CONST_A_BLEND_TYPE);if(null!=e){var f=c.blendFunc;switch(e){case ccs.BLEND_TYPE_NORMAL:f.src=cc.BLEND_SRC;f.dst=cc.BLEND_DST;break;case ccs.BLEND_TYPE_ADD:f.src=cc.SRC_ALPHA;f.dst=cc.ONE;break;case ccs.BLEND_TYPE_MULTIPLY:f.src= cc.DST_COLOR;f.dst=cc.ONE_MINUS_SRC_ALPHA;break;case ccs.BLEND_TYPE_SCREEN:f.src=cc.ONE;f.dst=cc.ONE_MINUS_DST_COLOR;break;default:c.blendFunc.src=cc.BLEND_SRC,c.blendFunc.dst=cc.BLEND_DST}}var g=a.querySelectorAll(ccs.CONST_FRAME+" \x3e "+ccs.CONST_A_COLOR_TRANSFORM);if(g&&0=ccs.CONST_VERSION_2_0?(a.x=parseFloat(b.getAttribute(ccs.CONST_A_COCOS2DX_X)),a.y=parseFloat(b.getAttribute(ccs.CONST_A_COCOS2DX_Y))):(a.x=parseFloat(b.getAttribute(ccs.CONST_A_X)),a.y=parseFloat(b.getAttribute(ccs.CONST_A_Y))),a.skewX=parseFloat(b.getAttribute(ccs.CONST_A_SKEW_X)),a.skewY=parseFloat(b.getAttribute(ccs.CONST_A_SKEW_Y)),a.y=-a.y,a.skewX=cc.degreesToRadians(a.skewX),a.skewY=cc.degreesToRadians(-a.skewY),ccs.TransformHelp.transformFromParent(c, a));return c},decodeFrameFromJson:function(a,b){var c=new ccs.FrameData;this.decodeNodeFromJson(c,a,b);c.tweenEasing=a[ccs.CONST_A_TWEEN_EASING]||ccs.TweenType.LINEAR;c.displayIndex=a[ccs.CONST_A_DISPLAY_INDEX];var d=null==a[ccs.CONST_A_BLEND_DST]?cc.BLEND_DST:a[ccs.CONST_A_BLEND_DST];c.blendFunc.src=null==a[ccs.CONST_A_BLEND_SRC]?cc.BLEND_SRC:a[ccs.CONST_A_BLEND_SRC];c.blendFunc.dst=d;c.isTween=null==a[ccs.CONST_A_TWEEN_FRAME]?!0:a[ccs.CONST_A_TWEEN_FRAME];d=a[ccs.CONST_A_EVENT];null!=d&&(c.strEvent= d,c.event=d);b.cocoStudioVersion=ccs.CONST_VERSION_2_0?(d=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_X))|| 0,e=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_Y))||0):(d=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_X))||0,e=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_Y))||0);var f=parseFloat(a.getAttribute(ccs.CONST_A_WIDTH))||0,g=parseFloat(a.getAttribute(ccs.CONST_A_HEIGHT))||0;c.pivotX=d/f;c.pivotY=(g-e)/g;d=a.querySelectorAll(ccs.CONST_SUB_TEXTURE+" \x3e "+ccs.CONST_CONTOUR);for(e=0;ea)return 0.5*a*a;--a;return-0.5*(a*(a-2)-1)};ccs.TweenFunction.cubicEaseIn=function(a){return a*a*a};ccs.TweenFunction.cubicEaseOut=function(a){a-=1;return a*a*a+1};ccs.TweenFunction.cubicEaseInOut=function(a){a*=2;if(1>a)return 0.5*a*a*a;a-=2;return 0.5*(a*a*a+2)};ccs.TweenFunction.quartEaseIn=function(a){return a*a*a*a}; ccs.TweenFunction.quartEaseOut=function(a){a-=1;return-(a*a*a*a-1)};ccs.TweenFunction.quartEaseInOut=function(a){a*=2;if(1>a)return 0.5*a*a*a*a;a-=2;return-0.5*(a*a*a*a-2)};ccs.TweenFunction.quintEaseIn=function(a){return a*a*a*a*a};ccs.TweenFunction.quintEaseOut=function(a){a-=1;return a*a*a*a*a+1};ccs.TweenFunction.quintEaseInOut=function(a){a*=2;if(1>a)return 0.5*a*a*a*a*a;a-=2;return 0.5*(a*a*a*a*a+2)};ccs.TweenFunction.expoEaseIn=function(a){return 0===a?0:Math.pow(2,10*(a-1))-0.001}; ccs.TweenFunction.expoEaseOut=function(a){return 1===a?1:-Math.pow(2,-10*a)+1};ccs.TweenFunction.expoEaseInOut=function(a){a/=0.5;return a=1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)};ccs.TweenFunction.circEaseIn=function(a){return-1*(Math.sqrt(1-a*a)-1)};ccs.TweenFunction.circEaseOut=function(a){a-=1;return Math.sqrt(1-a*a)};ccs.TweenFunction.circEaseInOut=function(a){a*=2;if(1>a)return-0.5*(Math.sqrt(1-a*a)-1);a-=2;return 0.5*(Math.sqrt(1-a*a)+1)}; ccs.TweenFunction.elasticEaseIn=function(a,b){var c=0.3;0a?-0.5*Math.pow(2,10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c):Math.pow(2,-10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c)*0.5+1);return d};ccs.TweenFunction.backEaseIn=function(a){return a*a*(2.70158*a-1.70158)};ccs.TweenFunction.backEaseOut=function(a){a-=1;return a*a*(2.70158*a+1.70158)+1}; ccs.TweenFunction.backEaseInOut=function(a){a*=2;if(1>a)return a*a*(3.5949095*a-2.5949095)/2;a-=2;return a*a*(3.5949095*a+2.5949095)/2+1};ccs.bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};ccs.TweenFunction.bounceEaseIn=function(a){return 1-ccs.bounceTime(1-a)};ccs.TweenFunction.bounceEaseOut=function(a){return ccs.bounceTime(a)}; ccs.TweenFunction.bounceEaseInOut=function(a){var b=0;return b=0.5>a?0.5*(1-ccs.bounceTime(1-2*a)):0.5*ccs.bounceTime(2*a-1)+0.5};ccs.TweenFunction.customEase=function(a,b){if(0a?0.5*Math.pow(a,b):1-0.5*Math.pow(2-a,b)}; ccs.TweenFunction.quadraticIn=function(a){return Math.pow(a,2)};ccs.TweenFunction.quadraticOut=function(a){return-a*(a-2)};ccs.TweenFunction.bezieratFunction=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d};var ENABLE_PHYSICS_DETECT=!1;ccs.fmodf=function(a,b){for(;a>b;)a-=b;return a};var CC_SAFE_RELEASE=function(a){a&&a.release&&a.release()};ccs.isSpriteContainPoint=function(a,b,c){b=a.convertToNodeSpace(b);c&&(c.x=b.x,c.y=b.y);a=a.getContentSize();return cc.rectContainsPoint(cc.rect(0,0,a.width,a.height),b)};ccs.SPRITE_CONTAIN_POINT=ccs.isSpriteContainPoint;ccs.SPRITE_CONTAIN_POINT_WITH_RETURN=ccs.isSpriteContainPoint; ccs.extBezierTo=function(a,b,c,d,e){var f=cc.p(0,0);d&&!e&&(f.x=Math.pow(1-a,2)*b.x+2*a*(1-a)*c.x+Math.pow(a,2)*d.x,f.y=Math.pow(1-a,2)*b.y+2*a*(1-a)*c.y+Math.pow(a,2)*d.y);e&&(f.x=b.x*Math.pow(1-a,3)+3*a*c.x*Math.pow(1-a,2)+3*d.x*Math.pow(a,2)*(1-a)+e.x*Math.pow(a,3),f.y=b.y*Math.pow(1-a,3)+3*a*c.y*Math.pow(1-a,2)+3*d.y*Math.pow(a,2)*(1-a)+e.y*Math.pow(a,3));return f};ccs.extCircleTo=function(a,b,c,d,e){var f=cc.p(0,0);f.x=b.x+c*Math.cos(d+e*a);f.y=b.y+c*Math.sin(d+e*a);return f};ccs.RelativeData=function(){this.plistFiles=[];this.armatures=[];this.animations=[];this.textures=[]}; ccs.armatureDataManager={_animationDatas:{},_armatureDatas:{},_textureDatas:{},_autoLoadSpriteFile:!1,_relativeDatas:{},s_sharedArmatureDataManager:null,removeArmatureFileInfo:function(a){var b=this.getRelativeData(a);if(b){var c,d;for(c=0;cccs.M_PI&&(this.skewX-=ccs.DOUBLE_PI),this.skewX<-ccs.M_PI&&(this.skewX+=ccs.DOUBLE_PI),this.skewY>ccs.M_PI&&(this.skewY-=ccs.DOUBLE_PI),this.skewY<-ccs.M_PI&&(this.skewY+=ccs.DOUBLE_PI));b.tweenRotate&&(this.skewX+=b.tweenRotate*ccs.PI*2,this.skewY-=b.tweenRotate*ccs.PI*2)}}); ccs.DisplayData=ccs.Class.extend({displayType:ccs.DISPLAY_TYPE_MAX,displayName:"",ctor:function(){this.displayType=ccs.DISPLAY_TYPE_MAX},changeDisplayToTexture:function(a){var b=a.lastIndexOf(".");-1!==b&&(a=a.substring(0,b));return a},copy:function(a){this.displayName=a.displayName;this.displayType=a.displayType}}); ccs.SpriteDisplayData=ccs.DisplayData.extend({skinData:null,ctor:function(){this.skinData=new ccs.BaseData;this.displayType=ccs.DISPLAY_TYPE_SPRITE},copy:function(a){ccs.DisplayData.prototype.copy.call(this,a);this.skinData=a.skinData}});ccs.ArmatureDisplayData=ccs.DisplayData.extend({ctor:function(){this.displayName="";this.displayType=ccs.DISPLAY_TYPE_ARMATURE}});ccs.ParticleDisplayData=ccs.DisplayData.extend({ctor:function(){this.displayType=ccs.DISPLAY_TYPE_PARTICLE}}); ccs.BoneData=ccs.BaseData.extend({displayDataList:null,name:"",parentName:"",boneDataTransform:null,ctor:function(){this.displayDataList=[];this.parentName=this.name="";this.boneDataTransform=null},init:function(){this.displayDataList.length=0;return!0},addDisplayData:function(a){this.displayDataList.push(a)},getDisplayData:function(a){return this.displayDataList[a]}}); ccs.ArmatureData=ccs.Class.extend({boneDataDic:null,name:"",dataVersion:0.1,ctor:function(){this.boneDataDic={};this.name="";this.dataVersion=0.1},init:function(){return!0},addBoneData:function(a){this.boneDataDic[a.name]=a},getBoneDataDic:function(){return this.boneDataDic},getBoneData:function(a){return this.boneDataDic[a]}}); ccs.FrameData=ccs.BaseData.extend({duration:0,tweenEasing:0,easingParamNumber:0,easingParams:null,displayIndex:-1,movement:"",event:"",sound:"",soundEffect:"",blendFunc:null,frameID:0,isTween:!0,ctor:function(){ccs.BaseData.prototype.ctor.call(this);this.duration=1;this.tweenEasing=ccs.TweenType.LINEAR;this.easingParamNumber=0;this.easingParams=[];this.displayIndex=0;this.soundEffect=this.sound=this.event=this.movement="";this.blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this.frameID=0;this.isTween= !0},copy:function(a){ccs.BaseData.prototype.copy.call(this,a);this.duration=a.duration;this.displayIndex=a.displayIndex;this.tweenEasing=a.tweenEasing;this.easingParamNumber=a.easingParamNumber;if(0!==this.easingParamNumber)for(var b=this.easingParams.length=0;b=ccs.CONST_VERSION_COMBINED?c.setSkinData(d.skinData):c.setSkinData(a.boneData))},initSpriteDisplay:function(a,b,c,d){var e=c.lastIndexOf("."); -1!==e&&(c=c.substring(0,e));(c=ccs.armatureDataManager.getTextureData(c))&&d.setAnchorPoint(cc.p(c.pivotX,c.pivotY));(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&c&&0=this._decoDisplayList.length?cc.log("the index value is out of range"):(this._forceChangeDisplay=b,this._displayIndex!==a&&(this._displayIndex=a,0>a?this._displayRenderNode&&(this._displayRenderNode.removeFromParent(!0),this.setCurrentDecorativeDisplay(null)):this.setCurrentDecorativeDisplay(this._decoDisplayList[a])))},changeDisplayWithName:function(a,b){for(var c=this._decoDisplayList, d=0;dthis._displayIndex)return!1;void 0!==b&&(a=cc.p(a,b));if(this._currentDecoDisplay.getDisplayData().displayType===ccs.DISPLAY_TYPE_SPRITE){var c=this._currentDecoDisplay.getDisplay(),c=c.getChildByTag(0);return ccs.SPRITE_CONTAIN_POINT_WITH_RETURN(c,a)}return!1}, setVisible:function(a){this._displayRenderNode&&(this._visible=a,this._displayRenderNode.setVisible(a))},isVisible:function(){return this._visible},getContentSize:function(){return this._displayRenderNode?this._displayRenderNode.getContentSize():cc.size(0,0)},getBoundingBox:function(){return this._displayRenderNode?this._displayRenderNode.getBoundingBox():cc.rect(0,0,0,0)},getAnchorPoint:function(){return this._displayRenderNode?this._displayRenderNode.getAnchorPoint():cc.p(0,0)},getAnchorPointInPoints:function(){return this._displayRenderNode? this._displayRenderNode.getAnchorPointInPoints():cc.p(0,0)},getForceChangeDisplay:function(){return this._forceChangeDisplay},release:function(){this._decoDisplayList=null;this._displayRenderNode&&(this._displayRenderNode.removeFromParent(!0),this._displayRenderNode=null)}});ccs.DisplayManager.create=function(a){return new ccs.DisplayManager(a)};ccs.Skin=ccs.Sprite.extend({_skinData:null,bone:null,_skinTransform:null,_displayName:"",_armature:null,_className:"Skin",ctor:function(a,b){cc.Sprite.prototype.ctor.call(this);this.bone=this._skinData=null;this._displayName="";this._skinTransform=cc.affineTransformIdentity();this._armature=null;null==a||""===a?ccs.Skin.prototype.init.call(this):"#"===a[0]?ccs.Skin.prototype.initWithSpriteFrameName.call(this,a.substr(1)):ccs.Skin.prototype.initWithFile.call(this,a,b)},initWithSpriteFrameName:function(a){if(""=== a)return!1;var b=cc.spriteFrameCache.getSpriteFrame(a),c=!0;b?this.initWithSpriteFrame(b):(cc.log("Can't find CCSpriteFrame with %s. Please check your .plist file",a),c=!1);this._displayName=a;return c},initWithFile:function(a,b){var c=b?cc.Sprite.prototype.initWithFile.call(this,a,b):cc.Sprite.prototype.initWithFile.call(this,a);this._displayName=a;return c},setSkinData:function(a){this._skinData=a;this.setScaleX(a.scaleX);this.setScaleY(a.scaleY);this.setRotationX(cc.radiansToDegrees(a.skewX)); this.setRotationY(cc.radiansToDegrees(-a.skewY));this.setPosition(a.x,a.y);this._renderCmd.transform()},getSkinData:function(){return this._skinData},updateArmatureTransform:function(){this._renderCmd.transform()},getNodeToWorldTransform:function(){return this._renderCmd.getNodeToWorldTransform()},getNodeToWorldTransformAR:function(){return this._renderCmd.getNodeToWorldTransformAR()},setBone:function(a){this.bone=a;if(a=this.bone.getArmature())this._armature=a},getBone:function(){return this.bone}, getDisplayName:function(){return this._displayName},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccs.Skin.CanvasRenderCmd(this):new ccs.Skin.WebGLRenderCmd(this)}});_p=ccs.Skin.prototype;cc.defineGetterSetter(_p,"skinData",_p.getSkinData,_p.setSkinData);cc.defineGetterSetter(_p,"displayName",_p.getDisplayName);_p=null;ccs.Skin.create=function(a,b){return new ccs.Skin(a,b)};ccs.Skin.createWithSpriteFrameName=function(a){return new ccs.Skin("#"+a)};(function(){ccs.Skin.RenderCmd={_realWorldTM:null,transform:function(a,c){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._node,e=a?a._worldTransform:null,f=this._transform,g=this._worldTransform;if(this._dirtyFlag&cc.Node._dirtyFlags.transformDirty||e)this.originTransform(),cc.affineTransformConcatIn(this._transform,d.bone.getNodeToArmatureTransform()),this._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty;if(e){if(g.a=f.a* e.a+f.b*e.c,g.b=f.a*e.b+f.b*e.d,g.c=f.c*e.a+f.d*e.c,g.d=f.c*e.b+f.d*e.d,g.tx=f.tx*e.a+f.ty*e.c+e.tx,g.ty=f.tx*e.b+f.ty*e.d+e.ty,e=this._vertices){var h=d._offsetPosition.x,k=h+d._rect.width,m=d._offsetPosition.y,d=m+d._rect.height;e[0].x=h*g.a+d*g.c+g.tx;e[0].y=h*g.b+d*g.d+g.ty;e[1].x=h*g.a+m*g.c+g.tx;e[1].y=h*g.b+m*g.d+g.ty;e[2].x=k*g.a+d*g.c+g.tx;e[2].y=k*g.b+d*g.d+g.ty;e[3].x=k*g.a+m*g.c+g.tx;e[3].y=k*g.b+m*g.d+g.ty}}else g.a=f.a,g.b=f.b,g.c=f.c,g.d=f.d,g.tx=f.tx,g.ty=f.ty;if(g=this._realWorldTM)g.a= f.a,g.b=f.b,g.c=f.c,g.d=f.d,g.tx=f.tx,g.ty=f.ty,cc.affineTransformConcatIn(g,this._node.bone.getArmature()._renderCmd._worldTransform)},getNodeToWorldTransform:function(){return cc.affineTransformConcat(this._transform,this._node.bone.getArmature().getNodeToWorldTransform())},getNodeToWorldTransformAR:function(){var a=this._transform,c=this._node;this._anchorPointInPoints=cc.pointApplyAffineTransform(this._anchorPointInPoints,a);a.tx=this._anchorPointInPoints.x;a.ty=this._anchorPointInPoints.y;return cc.affineTransformConcat(a, c.bone.getArmature().getNodeToWorldTransform())}};ccs.Skin.CanvasRenderCmd=function(a){this._spriteCmdCtor(a);this._realWorldTM={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a=ccs.Skin.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.CanvasRenderCmd;a._updateCurrentRegions=function(){var a=this._currentRegion;this._currentRegion=this._oldRegion;this._oldRegion=a;cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble!==this._regionFlag|| this._currentRegion.isEmpty()||this._oldRegion.union(this._currentRegion);this._currentRegion.updateRegion(this.getLocalBB(),this._realWorldTM)};ccs.Skin.WebGLRenderCmd=function(a){this._spriteCmdCtor(a)};a=ccs.Skin.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.WebGLRenderCmd})();ccs.ANIMATION_TYPE_SINGLE_FRAME=-4;ccs.ANIMATION_TYPE_NO_LOOP=-3;ccs.ANIMATION_TYPE_TO_LOOP_FRONT=-2;ccs.ANIMATION_TYPE_TO_LOOP_BACK=-1;ccs.ANIMATION_TYPE_LOOP_FRONT=0;ccs.ANIMATION_TYPE_LOOP_BACK=1;ccs.ANIMATION_TYPE_MAX=2; ccs.ProcessBase=ccs.Class.extend({_processScale:1,_isComplete:!0,_isPause:!0,_isPlaying:!1,_currentPercent:0,_rawDuration:0,_loopType:0,_tweenEasing:0,animationInternal:null,_currentFrame:0,_durationTween:0,_nextFrameIndex:0,_curFrameIndex:null,_isLoopBack:!1,ctor:function(){this._processScale=1;this._isPause=this._isComplete=!0;this._isPlaying=!1;this._rawDuration=this._durationTween=this._currentPercent=this._currentFrame=0;this._loopType=ccs.ANIMATION_TYPE_LOOP_BACK;this._tweenEasing=ccs.TweenType.LINEAR; this.animationInternal=1/60;this._durationTween=this._curFrameIndex=0;this._isLoopBack=!1},pause:function(){this._isPause=!0;this._isPlaying=!1},resume:function(){this._isPause=!1;this._isPlaying=!0},stop:function(){this._isComplete=!0;this._isPlaying=!1},play:function(a,b,c,d){this._isPause=this._isComplete=!1;this._isPlaying=!0;this._currentFrame=0;this._nextFrameIndex=a;this._tweenEasing=d},update:function(a){if(!(this._isComplete||this._isPause||0>=this._rawDuration||1=b?(this._currentPercent=1,c=0):(c+=a/this.animationInternal*this._processScale,this._currentPercent=c/b,c=ccs.fmodf(c,b));this._currentFrame=c;this.updateHandler()}},gotoFrame:function(a){var b=this._loopType;b===ccs.ANIMATION_TYPE_NO_LOOP?b=ccs.ANIMATION_TYPE_MAX:b===ccs.ANIMATION_TYPE_TO_LOOP_FRONT&&(b=ccs.ANIMATION_TYPE_LOOP_FRONT);this._loopType=b;this._curFrameIndex=a;this._nextFrameIndex=this._durationTween},getCurrentFrameIndex:function(){return this._curFrameIndex= (this._rawDuration-1)*this._currentPercent},updateHandler:function(){},isPause:function(){return this._isPause},isComplete:function(){return this._isComplete},getCurrentPercent:function(){return this._currentPercent},getRawDuration:function(){return this._rawDuration},getLoop:function(){return this._loopType},getTweenEasing:function(){return this._tweenEasing},getAnimationInternal:function(){return this.animationInternal},setAnimationInternal:function(a){this.animationInternal=a},getProcessScale:function(){return this._processScale}, setProcessScale:function(a){this._processScale=a},isPlaying:function(){return this._isPlaying}});_p=ccs.ProcessBase.prototype;cc.defineGetterSetter(_p,"currentFrameIndex",_p.getCurrentFrameIndex);cc.defineGetterSetter(_p,"paused",_p.isPause);cc.defineGetterSetter(_p,"completed",_p.isComplete);cc.defineGetterSetter(_p,"currentPercent",_p.getCurrentPercent);cc.defineGetterSetter(_p,"rawDuration",_p.getRawDuration);cc.defineGetterSetter(_p,"loop",_p.getLoop);cc.defineGetterSetter(_p,"tweenEasing",_p.getTweenEasing); cc.defineGetterSetter(_p,"playing",_p.isPlaying);_p=null;ccs.MovementEventType={start:0,complete:1,loopComplete:2};ccs.AnimationEvent=ccs.Class.extend({_arguments:null,_callFunc:null,_selectorTarget:null,ctor:function(a,b,c){this._data=c;this._callFunc=a;this._selectorTarget=b},call:function(){this._callFunc&&this._callFunc.apply(this._selectorTarget,this._arguments)},setArguments:function(a){this._arguments=a}});ccs.MovementEvent=function(){this.armature=null;this.movementType=ccs.MovementEventType.start;this.movementID=""}; ccs.FrameEvent=function(){this.bone=null;this.frameEventName="";this.currentFrameIndex=this.originFrameIndex=0}; ccs.ArmatureAnimation=ccs.ProcessBase.extend({_animationData:null,_movementData:null,_armature:null,_movementID:"",_toIndex:0,_tweenList:null,_speedScale:1,_ignoreFrameEvent:!1,_frameEventQueue:null,_movementEventQueue:null,_movementList:null,_onMovementList:!1,_movementListLoop:!1,_movementIndex:0,_movementListDurationTo:-1,_movementEventCallFunc:null,_frameEventCallFunc:null,_movementEventTarget:null,_frameEventTarget:null,_movementEventListener:null,_frameEventListener:null,ctor:function(a){ccs.ProcessBase.prototype.ctor.call(this); this._tweenList=[];this._movementList=[];this._frameEventQueue=[];this._movementEventQueue=[];this._armature=null;a&&ccs.ArmatureAnimation.prototype.init.call(this,a)},init:function(a){this._armature=a;this._tweenList.length=0;return!0},pause:function(){for(var a=this._tweenList,b=0;bc?this._movementData.loop:c;this._onMovementList=!1;ccs.ProcessBase.prototype.play.call(this,b,a,c,d);0===this._rawDuration?this._loopType=ccs.ANIMATION_TYPE_SINGLE_FRAME:(this._loopType=c?ccs.ANIMATION_TYPE_TO_LOOP_FRONT:ccs.ANIMATION_TYPE_NO_LOOP,this._durationTween=a);this._tweenList.length=0;var e,f=this._armature.getBoneDic(),g;for(g in f){var h= f[g];e=this._movementData.movBoneDataDic[h.getName()];var k=h.getTween();e&&0a||a>=this._movementData.duration)cc.log("Please ensure you have played a movement, and the frameIndex is in the range.");else{var b=this._ignoreFrameEvent;this._isPlaying= this._ignoreFrameEvent=!0;this._isComplete=this._isPause=!1;ccs.ProcessBase.prototype.gotoFrame.call(this,a);this._currentPercent=this._curFrameIndex/(this._movementData.duration-1);this._currentFrame=this._nextFrameIndex*this._currentPercent;for(var c=this._tweenList,d=0;da){this._nextFrameIndex=this._durationTween;this.movementEvent(this._armature, ccs.MovementEventType.start,this._movementID);break}break;case ccs.ANIMATION_TYPE_MAX:case ccs.ANIMATION_TYPE_SINGLE_FRAME:a=1;this._isComplete=!0;this._isPlaying=!1;this.movementEvent(this._armature,ccs.MovementEventType.complete,this._movementID);this.updateMovementList();break;case ccs.ANIMATION_TYPE_TO_LOOP_FRONT:this._loopType=ccs.ANIMATION_TYPE_LOOP_FRONT;a=ccs.fmodf(a,1);this._currentFrame=0===this._nextFrameIndex?0:ccs.fmodf(this._currentFrame,this._nextFrameIndex);this._nextFrameIndex=0< this._durationTween?this._durationTween:1;this.movementEvent(this,ccs.MovementEventType.start,this._movementID);break;default:this._currentFrame=ccs.fmodf(this._currentFrame,this._nextFrameIndex),this._toIndex=0,this.movementEvent(this._armature,ccs.MovementEventType.loopComplete,this._movementID)}this._currentPercent=a}},getCurrentMovementID:function(){return this._isComplete?"":this._movementID},setMovementEventCallFunc:function(a,b){1===arguments.length?this._movementEventListener=a:2===arguments.length&& (this._movementEventTarget=b,this._movementEventCallFunc=a)},setFrameEventCallFunc:function(a,b){1===arguments.length?this._frameEventListener=a:2===arguments.length&&(this._frameEventTarget=b,this._frameEventCallFunc=a)},setUserObject:function(a){this._userObject=a},frameEvent:function(a,b,c,d){if(this._frameEventTarget&&this._frameEventCallFunc||this._frameEventListener){var e=new ccs.FrameEvent;e.bone=a;e.frameEventName=b;e.originFrameIndex=c;e.currentFrameIndex=d;this._frameEventQueue.push(e)}}, movementEvent:function(a,b,c){if(this._movementEventTarget&&this._movementEventCallFunc||this._movementEventListener){var d=new ccs.MovementEvent;d.armature=a;d.movementType=b;d.movementID=c;this._movementEventQueue.push(d)}},updateMovementList:function(){if(this._onMovementList){var a,b=this._movementList;this._movementListLoop?(a=b[this._movementIndex],this.play(a,a.durationTo,0),this._movementIndex++,this._movementIndex>=b.length&&(this._movementIndex=0)):this._movementIndex=ccs.CONST_VERSION_COMBINED&&(ccs.TransformHelp.nodeSub(this._tweenData,this._bone.getBoneData()),this._tweenData.scaleX+=1,this._tweenData.scaleY+=1);0===this._rawDuration?(this._loopType=ccs.ANIMATION_TYPE_SINGLE_FRAME,0===b?this.setBetween(a,a):this.setBetween(this._tweenData,a),this._frameTweenEasing=ccs.TweenType.LINEAR):1=this._durationTween?1:(a-1)*this._nextFrameIndex/this._durationTween;1<=a?(a=1,this._isComplete=!0,this._isPlaying= !1):(this._nextFrameIndex=this._durationTween,this._currentFrame=a*this._nextFrameIndex,this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0);break;case ccs.ANIMATION_TYPE_TO_LOOP_FRONT:b=ccs.ANIMATION_TYPE_LOOP_FRONT;this._nextFrameIndex=0a&&bccs.ANIMATION_TYPE_TO_LOOP_BACK&&(a=this.updateFrameData(a));this._frameTweenEasing!==ccs.TweenType.TWEEN_EASING_MAX&&this.tweenNodeTo(a)},setBetween:function(a,b,c){void 0===c&&(c=!0);0>a.displayIndex&& 0<=b.displayIndex?(this._from.copy(b),this._between.subtract(b,b,c)):0>b.displayIndex&&0<=a.displayIndex?(this._from.copy(a),this._between.subtract(b,b,c)):(this._from.copy(a),this._between.subtract(a,b,c));a.isTween||(this._tweenData.copy(a),this._tweenData.isTween=!0);this.arriveKeyFrame(a)},arriveKeyFrame:function(a){if(a){var b=this._bone,c=b.getDisplayManager(),d=a.displayIndex;c.getForceChangeDisplay()||c.changeDisplayWithIndex(d,!1);this._tweenData.zOrder=a.zOrder;b.updateZOrder();this._bone.setBlendFunc(a.blendFunc); (b=b.getChildArmature())&&""!==a.movement&&b.getAnimation().play(a.movement)}},tweenNodeTo:function(a,b){b||(b=this._tweenData);var c=this._from,d=this._between;c.isTween||(a=0);b.x=c.x+a*d.x;b.y=c.y+a*d.y;b.scaleX=c.scaleX+a*d.scaleX;b.scaleY=c.scaleY+a*d.scaleY;b.skewX=c.skewX+a*d.skewX;b.skewY=c.skewY+a*d.skewY;this._bone.setTransformDirty(!0);b&&d.isUseColorInfo&&this.tweenColorTo(a,b);return b},tweenColorTo:function(a,b){var c=this._from,d=this._between;b.a=c.a+a*d.a;b.r=c.r+a*d.r;b.g=c.g+a* d.g;b.b=c.b+a*d.b;this._bone.updateColor()},updateFrameData:function(a){1=d+e){var e=this._movementBoneData.frameList,g=e.length;if(a=e[g-1].frameID){if(this._passLastFrame)return b=c=e[g-1],this.setBetween(b,c),this._currentPercent;this._passLastFrame=!0}else this._passLastFrame= !1;do if(this._fromIndex=f,b=e[this._fromIndex],d=b.frameID,f=this._fromIndex+1,f>=g&&(f=0),c=e[f],b.strEvent&&!this._animation.isIgnoreFrameEvent()&&this._animation.frameEvent(this._bone,b.strEvent,b.frameID,a),a===b.frameID||this._passLastFrame&&this._fromIndex===g-1)break;while(a=c.frameID);e=c.frameID-b.frameID;this._frameTweenEasing=b.tweenEasing;this.setBetween(b,c,!1);this._totalDuration=d;this._betweenDuration=e;this._toIndex=f}a=0===e?0:(a-this._totalDuration)/this._betweenDuration; b=this._frameTweenEasing!==ccs.TweenType.LINEAR?this._frameTweenEasing:this._tweenEasing;b===ccs.TweenType.TWEEN_EASING_MAX||b===ccs.TweenType.LINEAR||this._passLastFrame||(a=ccs.TweenFunction.tweenTo(a,b,this._from.easingParams));return a},setAnimation:function(a){this._animation=a},getAnimation:function(){return this._animation},setMovementBoneData:function(a){this._movementBoneData=a}});_p=ccs.Tween.prototype;cc.defineGetterSetter(_p,"animation",_p.getAnimation,_p.setAnimation);_p=null; ccs.Tween.create=function(a){return new ccs.Tween(a)};ccs.PT_RATIO=32;ccs.ColliderFilter=ccs.Class.extend({_collisionType:0,_group:0,_categoryBits:0,_groupIndex:0,_maskBits:0,ctor:function(a,b){this._collisionType=a||0;this._group=b||0},updateShape:function(a){if(a instanceof cp.Shape)a.collision_type=this._collisionType,a.group=this._group;else if(a instanceof Box2D.b2FilterData){var b=new Box2D.b2FilterData;b.categoryBits=this._categoryBits;b.groupIndex=this._groupIndex;b.maskBits=this._maskBits;a.SetFilterData(b)}}}); ccs.ColliderBody=ccs.Class.extend({shape:null,coutourData:null,colliderFilter:null,_calculatedVertexList:null,ctor:function(a){this.shape=null;this.coutourData=a;this.colliderFilter=new ccs.ColliderFilter;ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX&&(this._calculatedVertexList=[])},getContourData:function(){return this.coutourData},setColliderFilter:function(a){this.colliderFilter=a},getCalculatedVertexList:function(){return this._calculatedVertexList},setB2Fixture:function(a){this._fixture=a},getB2Fixture:function(){return this._fixture}, setShape:function(a){this.shape=a},getShape:function(){return this.shape},setContourData:function(a){this.coutourData=a},getColliderFilter:function(){return this.colliderFilter}}); ccs.ColliderDetector=ccs.Class.extend({_colliderBodyList:null,_bone:null,_body:null,_active:!1,_filter:null,helpPoint:cc.p(0,0),ctor:function(a){this._colliderBodyList=[];this._body=this._bone=null;this._active=!1;this._filter=null;ccs.ColliderDetector.prototype.init.call(this,a)},init:function(a){this._colliderBodyList.length=0;a&&(this._bone=a);this._filter=new ccs.ColliderFilter;return!0},addContourData:function(a){var b=new ccs.ColliderBody(a);this._colliderBodyList.push(b);if(ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX){b= b.getCalculatedVertexList();a=a.vertexList;for(var c=0;c=f.frameList.length)&&(f=f.getFrameData(0))&&(c.getTweenData().copy(f),c.changeDisplayWithIndex(f.displayIndex,!1))}this.update(0);this.updateOffsetPoint()}else a="new_armature",this.armatureData=new ccs.ArmatureData,this.armatureData.name=a,d=new ccs.AnimationData,d.name=a,c.addArmatureData(a,this.armatureData),c.addAnimationData(a,d),this.animation.setAnimationData(d);this._renderCmd.initShaderCache();this.setCascadeOpacityEnabled(!0);this.setCascadeColorEnabled(!0); return!0},visit:function(a){var b=this._renderCmd;a=a?a._renderCmd:null;this._visible?(b.visit(a),b._dirtyFlag=0):b._propagateFlagsDown(a)},addChild:function(a,b,c){a instanceof ccui.Widget?cc.log("Armature doesn't support to add Widget as its child, it will be fix soon."):cc.Node.prototype.addChild.call(this,a,b,c)},createBone:function(a){var b=this.getBone(a);if(b)return b;var b=this.armatureData.getBoneData(a),c=b.parentName,d=null;c?(this.createBone(c),d=new ccs.Bone(a),this.addBone(d,c)):(d= new ccs.Bone(a),this.addBone(d,""));d.setBoneData(b);d.getDisplayManager().changeDisplayWithIndex(-1,!1);return d},addBone:function(a,b){cc.assert(a,"Argument must be non-nil");var c=this._boneDic;a.getName()&&cc.assert(!c[a.getName()],"bone already added. It can't be added again");if(b){var d=c[b];d?d.addChildBone(a):this._topBoneList.push(a)}else this._topBoneList.push(a);a.setArmature(this);c[a.getName()]=a;this.addChild(a)},removeBone:function(a,b){cc.assert(a,"bone must be added to the bone dictionary!"); a.setArmature(null);a.removeFromParent(b);cc.arrayRemoveObject(this._topBoneList,a);delete this._boneDic[a.getName()];this.removeChild(a,!0)},getBone:function(a){return this._boneDic[a]},changeBoneParent:function(a,b){cc.assert(a,"bone must be added to the bone dictionary!");var c=a.getParentBone();c&&(cc.arrayRemoveObject(c.getChildren(),a),a.setParentBone(null));b&&((c=this._boneDic[b])?(c.addChildBone(a),cc.arrayRemoveObject(this._topBoneList,a)):this._topBoneList.push(a))},getBoneDic:function(){return this._boneDic}, updateOffsetPoint:function(){var a=this.getBoundingBox();this.setContentSize(a);var b=this._offsetPoint;b.x=-a.x;b.y=-a.y;0!==a.width&&0!==a.height&&this.setAnchorPoint(b.x/a.width,b.y/a.height)},getOffsetPoints:function(){return{x:this._offsetPoint.x,y:this._offsetPoint.y}},setAnimation:function(a){this.animation=a},getAnimation:function(){return this.animation},getArmatureTransformDirty:function(){return this._armatureTransformDirty},update:function(a){this.animation.update(a);for(var b=this._topBoneList, c=0;cf.x+f.width?d.x+d.width:f.x+f.width,d=d.y+d.height>f.y+f.height?d.y+d.height:f.y+f.height),f.x=a,f.y=b,f.width=c-a,f.height=d-b;return cc.rectApplyAffineTransform(f,this.getNodeToParentTransform())},getBoneAtPoint:function(a,b){for(var c=this._children,d=c.length-1;0<=d;d--){var e=c[d];if(e instanceof ccs.Bone&&e.getDisplayManager().containPoint(a,b))return e}return null},setParentBone:function(a){this._parentBone=a;a=this._boneDic;for(var b in a)a[b].setArmature(this)}, getParentBone:function(){return this._parentBone},drawContour:function(){cc._drawingUtil.setDrawColor(255,255,255,255);cc._drawingUtil.setLineWidth(1);var a=this._boneDic,b;for(b in a){var c=a[b].getColliderDetector();if(c)for(var c=c.getColliderBodyList(),d=0;df._localZOrder)f.visit(a);else break;for(cc.renderer.pushRenderCommand(c);d< g;d++)e[d].visit(a)}else cc.renderer.pushRenderCommand(c);this._dirtyFlag=0}}};a.visit=function(a){var c=this._node;c._visible&&(this._syncStatus(a),c.sortAllChildren(),cc.renderer.pushRenderCommand(this._startRenderCmd),this.rendering(),cc.renderer.pushRenderCommand(this._RestoreRenderCmd),this._cacheDirty=!1)}})();(function(){ccs.Armature.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._parentCmd=null;this._realAnchorPointInPoints=new cc.Point(0,0);this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0};this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a=ccs.Armature.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(ccs.Armature.RenderCmd,a);a.constructor=ccs.Armature.WebGLRenderCmd;a.uploadData=function(a,c,d){a=this._node;d=this._parentCmd||this;for(var e=a._children, f=cc.BlendFunc.ALPHA_PREMULTIPLIED,g=cc.BlendFunc.ALPHA_NON_PREMULTIPLIED,h=0,k=e.length;hc._localZOrder)isNaN(c._customZ)&&(c._vertexZ=a.assignedZ,a.assignedZ+= a.assignedZStep);else break;for(a.pushRenderCommand(this);e=ccs.CONST_VERSION_COMBINED&&(ccs.TransformHelp.nodeConcat(b,this._boneData),b.scaleX-=1,b.scaleY-=1);var c=this._worldInfo;c.copy(b);c.x=b.x+this._position.x;c.y=b.y+this._position.y; c.scaleX=b.scaleX*this._scaleX;c.scaleY=b.scaleY*this._scaleY;c.skewX=b.skewX+this._skewX+cc.degreesToRadians(this._rotationX);c.skewY=b.skewY+this._skewY-cc.degreesToRadians(this._rotationY);this._parentBone?this._applyParentTransform(this._parentBone):this._armatureParentBone&&this._applyParentTransform(this._armatureParentBone);ccs.TransformHelp.nodeToMatrix(c,this._worldTransform);this._armatureParentBone&&cc.affineTransformConcatIn(this._worldTransform,this._armature.getNodeToParentTransform())}ccs.displayFactory.updateDisplay(this, a,this._boneTransformDirty||this._armature.getArmatureTransformDirty());for(b=0;b=ccs.CONST_VERSION_COMBINED?this.setLocalZOrder(this._tweenData.zOrder+this._boneData.zOrder): this.setLocalZOrder(this._tweenData.zOrder)},addChildBone:function(a){cc.assert(a,"Argument must be non-nil");cc.assert(!a.parentBone,"child already added. It can't be added again");0>this._children.indexOf(a)&&(this._children.push(a),a.setParentBone(this))},removeChildBone:function(a,b){if(0=c.length)){for(var d=[],e=0;e=f.length||(b=!0,f=f[0].frameIndex,a=a>f?f:a)}b||(a=0);return a},getLastFrameIndex:function(){for(var a=-1,b=!1,c=this._frameArray,d=0,e=this._frameArrayNum;d=f.length||(b=!0,f=f[f.length-1].frameIndex,a=aa){0===f?(this._easingToFrame(1,1,g),b=!1):(b=e[f-1],e=(g.frameIndex-b.frameIndex)*c,f=a-b.frameIndex*c,this._easingToFrame(e,1,b),this._easingToFrame(e,f/e,g),b=!0);break}}}return b},_easingToFrame:function(a,b,c){a=c.getAction(a);c=this.getActionNode();null!=a&&null!=c&&(a.startWithTarget(c),a.update(b))},isActionDoneOnce:function(){return this._action?this._action.isDone():!0}});ccs.ActionObject=ccs.Class.extend({_actionNodeList:null,_name:"",_loop:!1,_pause:!1,_playing:!1,_unitTime:0,_currentTime:0,_scheduler:null,_callback:null,_fTotalTime:0,ctor:function(){this._actionNodeList=[];this._name="";this._playing=this._pause=this._loop=!1;this._unitTime=0.1;this._fTotalTime=this._currentTime=0;this._scheduler=cc.director.getScheduler()},setName:function(a){this._name=a},getName:function(){return this._name},setLoop:function(a){this._loop=a},getLoop:function(){return this._loop}, setUnitTime:function(a){this._unitTime=a;a=this._actionNodeList.length;for(var b=0;bd&&(d=f)}this._fTotalTime=d*this._unitTime},addActionNode:function(a){a&&(this._actionNodeList.push(a),a.setUnitTime(this._unitTime))},removeActionNode:function(a){null!=a&&cc.arrayRemoveObject(this._actionNodeList,a)},play:function(a){this.stop();this.updateToFrameByTime(0);for(var b=this._actionNodeList,c=b.length, d=0;d=this._eventTriggers.length},addArmatureMovementCallBack:function(a,b,c){if(null!=a&&null!=c&&null!=b){for(var d,e=!1,f=0;fd||this._vInt.push(d)},getId:function(){return this._id},setEnable:function(a){this._enable=a},getEvents:function(){return this._vInt}});ccs.TriggerObj.create=function(){return new ccs.TriggerObj};ccs.ActionTimelineData=ccs.Class.extend({_actionTag:0,ctor:function(a){this._init(a)},_init:function(a){this._actionTag=a;return!0},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag}});ccs.AnimationInfo=function(a,b,c){this.name=a;this.startIndex=b;this.endIndex=c}; ccs.ComExtensionData=ccs.Component.extend({_customProperty:null,_timelineData:null,_name:"ComExtensionData",ctor:function(){this._customProperty="";this._timelineData=new ccs.ActionTimelineData(0);return!0},setActionTag:function(a){this._timelineData.setActionTag(a)},getActionTag:function(){return this._timelineData.getActionTag()},setCustomProperty:function(a){this._customProperty=a},getCustomProperty:function(){return this._customProperty}});ccs.ComExtensionData.create=function(){return new ccs.ComExtensionData}; ccs.ActionTimelineData.create=function(a){return new ccs.ActionTimelineData(a)}; ccs.ActionTimeline=cc.Action.extend({_timelineMap:null,_timelineList:null,_duration:0,_time:null,_timeSpeed:1,_frameInternal:1/60,_playing:!1,_currentFrame:0,_startFrame:0,_endFrame:0,_loop:null,_frameEventListener:null,_animationInfos:null,_lastFrameListener:null,ctor:function(){cc.Action.prototype.ctor.call(this);this._timelineMap={};this._timelineList=[];this._animationInfos={};this.init()},_gotoFrame:function(a){for(var b=this._timelineList.length,c=0;c=this._startFrame&&a<=this._endFrame?(this._currentFrame=a,this._time=this._currentFrame*this._frameInternal):cc.log("frame index is not between start frame and end frame")},getCurrentFrame:function(){return this._currentFrame},addTimeline:function(a){var b=a.getActionTag();this._timelineMap[b]||(this._timelineMap[b]=[]);-1=== this._timelineMap[b].indexOf(a)&&(this._timelineList.push(a),this._timelineMap[b].push(a),a.setActionTimeline(this))},removeTimeline:function(a){var b=a.getActionTag();this._timelineMap[b]&&this._timelineMap[b].some(function(b){if(b===a)return!0})&&(cc.arrayRemoveObject(this._timelineMap[b],a),cc.arrayRemoveObject(this._timelineList,a),a.setActionTimeline(null))},getTimelines:function(){return this._timelineList},setFrameEventCallFunc:function(a){this._frameEventListener=a},clearFrameEventCallFunc:function(){this._frameEventListener= null},clone:function(){var a=new ccs.ActionTimeline;a.setDuration(this._duration);a.setTimeSpeed(this._timeSpeed);for(var b in this._timelineMap){var c=this._timelineMap[b],d;for(d in c){var e=c[d].clone();a.addTimeline(e)}}return a},reverse:function(){return null},step:function(a){this._playing&&0!==this._timelineMap.length&&0!==this._duration&&(this._time+=a*this._timeSpeed,a=this._time-this._endFrame*this._frameInternal,ad&&(c+=d);ccs.InnerActionType.NoLoopAction===this._innerActionType?a.gotoFrameAndPlay(b,c,!1):ccs.InnerActionType.LoopAction=== this._innerActionType&&a.gotoFrameAndPlay(b,c,!0)}},setAnimationName:function(a){this._animationName=a},setSingleFrameIndex:function(a){this._singleFrameIndex=a},getSingleFrameIndex:function(){return this._startFrameIndex},setEnterWithName:function(a){this._enterWithName=a},getEnterWithName:function(){return this._enterWithName},clone:function(){var a=new ccs.InnerActionFrame;a.setInnerActionType(this._innerActionType);a.setStartFrameIndex(this._startFrameIndex);a.setEnterWithName(this._enterWithName); a.setAnimationName(this._animationName);a.setSingleFrameIndex(this._singleFrameIndex);a._cloneProperty(this);return a},setInnerActionType:function(a){this._innerActionType=a},getInnerActionType:function(){return this._innerActionType},setStartFrameIndex:function(a){this._startFrameIndex=a},getStartFrameIndex:function(){return this._startFrameIndex}});ccs.InnerActionFrame.create=function(){return new ccs.InnerActionFrame}; ccs.ColorFrame=ccs.Frame.extend({_alpha:null,_color:null,_betweenAlpha:null,_betweenRed:null,_betweenGreen:null,_betweenBlue:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._color=cc.color(255,255,255)},onEnter:function(a){this._node&&(this._node.setColor(this._color),this._tween&&(a=a._color,this._betweenRed=a.r-this._color.r,this._betweenGreen=a.g-this._color.g,this._betweenBlue=a.b-this._color.b))},_onApply:function(a){if(this._node&&this._tween&&(0!==this._betweenAlpha||0!==this._betweenRed|| 0!==this._betweenGreen||0!==this._betweenBlue)){var b=cc.color(255,255,255);b.r=this._color.r+this._betweenRed*a;b.g=this._color.g+this._betweenGreen*a;b.b=this._color.b+this._betweenBlue*a;this._node.setColor(b);null!==this._alpha&&this._node.setOpacity(this._alpha+this._betweenAlpha*a)}},clone:function(){var a=new ccs.ColorFrame;a.setColor(this._color);a._cloneProperty(this);return a},setColor:function(a){this._color=a},getColor:function(){return this._color}});ccs.ColorFrame.create=function(){return new ccs.ColorFrame}; ccs.AlphaFrame=ccs.Frame.extend({_alpha:null,_betweenAlpha:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._alpha=255},onEnter:function(a){this._node&&(this._node.setOpacity(this._alpha),this._tween&&(this._betweenAlpha=a._alpha-this._alpha))},_onApply:function(a){this._node&&this._node.setOpacity(this._alpha+this._betweenAlpha*a)},setAlpha:function(a){this._alpha=a},getAlpha:function(){return this._alpha},clone:function(){var a=new ccs.AlphaFrame;a.setAlpha(this._alpha);a._cloneProperty(this); return a}});ccs.EventFrame=ccs.Frame.extend({_event:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._event="";this._enterWhenPassed=!0},onEnter:function(a){this._emitEvent()},clone:function(){var a=new ccs.EventFrame;a.setEvent(this._event);a._cloneProperty(this);return a},setEvent:function(a){this._event=a},getEvent:function(){return this._event}});ccs.EventFrame.create=function(){return new ccs.EventFrame}; ccs.ZOrderFrame=ccs.Frame.extend({_zorder:0,onEnter:function(a){this._node&&this._node.setLocalZOrder(this._zorder)},clone:function(){var a=new ccs.ZOrderFrame;a.setZOrder(this._zorder);a._cloneProperty(this);return a},setZOrder:function(a){this._zorder=a},getZOrder:function(){return this._zorder}});ccs.ZOrderFrame.create=function(){return new ccs.ZOrderFrame}; ccs.BlendFuncFrame=ccs.Frame.extend({ctor:function(){this._super();this._blendFunc=null},onEnter:function(a,b){this._node&&this._blendFunc&&this._node.setBlendFunc(this._blendFunc)},clone:function(){var a=new ccs.BlendFuncFrame;a.setBlendFunc(this._blendFunc);a._cloneProperty(this);return a},setBlendFunc:function(a){a&&a.src&&a.dst&&(this._blendFunc=a)},getBlendFunc:function(){return this._blendFunc}});ccs.BlendFuncFrame.create=function(){return new ccs.BlendFuncFrame};ccs.Timeline=ccs.Class.extend({_frames:null,_currentKeyFrame:null,_currentKeyFrameIndex:null,_fromIndex:null,_toIndex:null,_betweenDuration:null,_actionTag:null,_ActionTimeline:null,_node:null,ctor:function(){this._frames=[];this._currentKeyFrame=null;this._actionTag=this._betweenDuration=this._toIndex=this._fromIndex=this._currentKeyFrameIndex=0;this._node=this._ActionTimeline=null},_gotoFrame:function(a){0!==this._frames.length&&(this._binarySearchKeyFrame(a),this._apply(a))},_stepToFrame:function(a){0!== this._frames.length&&(this._updateCurrentKeyFrame(a),this._apply(a))},getFrames:function(){return this._frames},addFrame:function(a){this._frames.push(a);a.setTimeline(this)},insertFrame:function(a,b){this._frames.splice(b,0,a);a.setTimeline(this)},removeFrame:function(a){cc.arrayRemoveObject(this._frames,a);a.setTimeline(null)},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},setNode:function(a){for(var b=0;b=this._betweenDuration?0:(a-this._currentKeyFrameIndex)/this._betweenDuration)},_binarySearchKeyFrame:function(a){var b= null,c=null,d=this._frames.length,e=!1;do if(a=this._frames[0].getFrameIndex()&&(e=!0),this._toIndex=this._fromIndex=0,b=c=this._frames[0],this._currentKeyFrameIndex=0,this._betweenDuration=this._frames[0].getFrameIndex();else if(a>=this._frames[d-1].getFrameIndex())this._fromIndex=d-1,this._toIndex=0,b=c=this._frames[d-1],this._currentKeyFrameIndex=this._frames[d-1].getFrameIndex(),this._betweenDuration=0;else{for(var f=-1,b=0,c=d-1,g=0;b<= c;){g=Math.ceil((b+c)/2);if(a>=this._frames[g].getFrameIndex()&&aa?c=g-1:b=g+1}this._fromIndex=f;this._toIndex=1=this._currentKeyFrameIndex+this._betweenDuration){var b=null,c=null;do{var d=this._frames.length;if(a=this._frames[d-1].getFrameIndex()&&(a=this._frames[d-1].getFrameIndex(),this._currentKeyFrameIndex>=a))return;do{this._fromIndex=this._toIndex;b=this._frames[this._fromIndex];this._currentKeyFrameIndex= b.getFrameIndex();this._toIndex=this._fromIndex+1;this._toIndex>=d&&(this._toIndex=0);c=this._frames[this._toIndex];if(a===b.getFrameIndex())break;if(a>b.getFrameIndex()&&ad._localZOrder)d.visit(this);else break;for(;b>>1;;){a[(f+1)*c]<=b?d=f+1:e=f;if(d==e)return(d+1)*c;f=d+e>>>1}};a.linearSearch=function(a,b,c){for(var d=0,e=a.length-c;d<=e;d+=c)if(a[d]>b)return d;return-1};return a}();a.Animation=b;var c;(function(a){a[a.setup=0]="setup";a[a.current=1]="current";a[a.currentLayered=2]="currentLayered"})(c=a.MixPose||(a.MixPose={}));var d;(function(a){a[a["in"]=0]="in";a[a.out=1]="out"})(d=a.MixDirection||(a.MixDirection={}));var e;(function(a){a[a.rotate=0]="rotate";a[a.translate=1]="translate"; a[a.scale=2]="scale";a[a.shear=3]="shear";a[a.attachment=4]="attachment";a[a.color=5]="color";a[a.deform=6]="deform";a[a.event=7]="event";a[a.drawOrder=8]="drawOrder";a[a.ikConstraint=9]="ikConstraint";a[a.transformConstraint=10]="transformConstraint";a[a.pathConstraintPosition=11]="pathConstraintPosition";a[a.pathConstraintSpacing=12]="pathConstraintSpacing";a[a.pathConstraintMix=13]="pathConstraintMix";a[a.twoColor=14]="twoColor"})(e=a.TimelineType||(a.TimelineType={}));var f=function(){function b(c){if(0>= c)throw Error("frameCount must be \x3e 0: "+c);this.curves=a.Utils.newFloatArray((c-1)*b.BEZIER_SIZE)}b.prototype.getFrameCount=function(){return this.curves.length/b.BEZIER_SIZE+1};b.prototype.setLinear=function(a){this.curves[a*b.BEZIER_SIZE]=b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a==b.STEPPED?b.STEPPED:b.BEZIER}; b.prototype.setCurve=function(a,c,d,e,f){var g=0.03*(2*-c+e),h=0.03*(2*-d+f);e=0.006*(3*(c-e)+1);f=0.006*(3*(d-f)+1);var k=2*g+e,t=2*h+f;c=0.3*c+g+0.16666667*e;d=0.3*d+h+0.16666667*f;a*=b.BEZIER_SIZE;h=this.curves;h[a++]=b.BEZIER;for(var g=c,z=d,A=a+b.BEZIER_SIZE-1;a=d){var w=k=void 0;f==h?w=k=0:(k=e[f-2],w=e[f-1]);return w+(e[f+1]-w)*(d-k)/(g-k)}e=e[f-1];return e+(1-e)*(d-g)/(1-g)};return b}();f.LINEAR=0;f.STEPPED=1;f.BEZIER=2;f.BEZIER_SIZE=19;a.CurveTimeline=f;var g=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b<<1);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.rotate<<24)+this.boneIndex};f.prototype.setFrame=function(a,b,c){a<<=1;this.frames[a]=b;this.frames[a+ f.ROTATION]=c};f.prototype.apply=function(a,d,e,g,h,k,m){d=this.frames;a=a.bones[this.boneIndex];if(e=d[d.length-f.ENTRIES])k==c.setup?a.rotation=a.data.rotation+d[d.length+f.PREV_ROTATION]*h:(k=a.data.rotation+d[d.length+f.PREV_ROTATION]-a.rotation,a.rotation+=(k-360*(16384-(16384.499999999996-k/360|0)))*h);else{m=b.binarySearch(d, e,f.ENTRIES);g=d[m+f.PREV_ROTATION];var t=d[m];e=this.getCurvePercent((m>>1)-1,1-(e-t)/(d[m+f.PREV_TIME]-t));d=d[m+f.ROTATION]-g;d=g+(d-360*(16384-(16384.499999999996-d/360|0)))*e;k==c.setup?(d-=360*(16384-(16384.499999999996-d/360|0)),a.rotation=a.data.rotation+d*h):(d=a.data.rotation+d-a.rotation,d-=360*(16384-(16384.499999999996-d/360|0)),a.rotation+=d*h)}};return f}(f);g.ENTRIES=2;g.PREV_TIME=-2;g.PREV_ROTATION=-1;g.ROTATION=1;a.RotateTimeline=g;g=function(d){function f(b){var c=d.call(this,b)|| this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.translate<<24)+this.boneIndex};f.prototype.setFrame=function(a,b,c,d){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.X]=c;this.frames[a+f.Y]=d};f.prototype.apply=function(a,d,e,g,h,k,m){d=this.frames;a=a.bones[this.boneIndex];if(e=d[d.length-f.ENTRIES])g= d[d.length+f.PREV_X],m=d[d.length+f.PREV_Y];else{var t=b.binarySearch(d,e,f.ENTRIES);g=d[t+f.PREV_X];m=d[t+f.PREV_Y];var z=d[t];e=this.getCurvePercent(t/f.ENTRIES-1,1-(e-z)/(d[t+f.PREV_TIME]-z));g+=(d[t+f.X]-g)*e;m+=(d[t+f.Y]-m)*e}k==c.setup?(a.x=a.data.x+g*h,a.y=a.data.y+m*h):(a.x+=(a.data.x+g-a.x)*h,a.y+=(a.data.y+m-a.y)*h)}};return f}(f);g.ENTRIES=3;g.PREV_TIME=-3;g.PREV_X=-2;g.PREV_Y=-1;g.X=1;g.Y=2;a.TranslateTimeline=g;var h=function(f){function g(a){return f.call(this,a)||this}__extends(g,f); g.prototype.getPropertyId=function(){return(e.scale<<24)+this.boneIndex};g.prototype.apply=function(e,f,h,k,m,x,w){var t=this.frames;e=e.bones[this.boneIndex];if(h=t[t.length-g.ENTRIES])f=t[t.length+g.PREV_X]*e.data.scaleX,k=t[t.length+g.PREV_Y]*e.data.scaleY;else{var z=b.binarySearch(t,h,g.ENTRIES);f=t[z+g.PREV_X]; k=t[z+g.PREV_Y];var A=t[z];h=this.getCurvePercent(z/g.ENTRIES-1,1-(h-A)/(t[z+g.PREV_TIME]-A));f=(f+(t[z+g.X]-f)*h)*e.data.scaleX;k=(k+(t[z+g.Y]-k)*h)*e.data.scaleY}1==m?(e.scaleX=f,e.scaleY=k):(t=h=0,x==c.setup?(h=e.data.scaleX,t=e.data.scaleY):(h=e.scaleX,t=e.scaleY),w==d.out?(f=Math.abs(f)*a.MathUtils.signum(h),k=Math.abs(k)*a.MathUtils.signum(t)):(h=Math.abs(h)*a.MathUtils.signum(f),t=Math.abs(t)*a.MathUtils.signum(k)),e.scaleX=h+(f-h)*m,e.scaleY=t+(k-t)*m)}};return g}(g);a.ScaleTimeline=h;g=function(a){function d(b){return a.call(this, b)||this}__extends(d,a);d.prototype.getPropertyId=function(){return(e.shear<<24)+this.boneIndex};d.prototype.apply=function(a,e,f,g,h,k,m){e=this.frames;a=a.bones[this.boneIndex];if(f=e[e.length-d.ENTRIES])g=e[e.length+d.PREV_X],m=e[e.length+d.PREV_Y];else{var t=b.binarySearch(e,f,d.ENTRIES);g=e[t+d.PREV_X];m=e[t+ d.PREV_Y];var z=e[t];f=this.getCurvePercent(t/d.ENTRIES-1,1-(f-z)/(e[t+d.PREV_TIME]-z));g+=(e[t+d.X]-g)*f;m+=(e[t+d.Y]-m)*f}k==c.setup?(a.shearX=a.data.shearX+g*h,a.shearY=a.data.shearY+m*h):(a.shearX+=(a.data.shearX+g-a.shearX)*h,a.shearY+=(a.data.shearY+m-a.shearY)*h)}};return d}(g);a.ShearTimeline=g;g=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.color<<24)+this.slotIndex};f.prototype.setFrame= function(a,b,c,d,e,g){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.R]=c;this.frames[a+f.G]=d;this.frames[a+f.B]=e;this.frames[a+f.A]=g};f.prototype.apply=function(a,d,e,g,h,k,m){a=a.slots[this.slotIndex];var t=this.frames;if(e=t[t.length-f.ENTRIES])e=t.length,d=t[e+f.PREV_R],g=t[e+f.PREV_G],m=t[e+f.PREV_B],z=t[e+ f.PREV_A];else{var A=b.binarySearch(t,e,f.ENTRIES);d=t[A+f.PREV_R];g=t[A+f.PREV_G];m=t[A+f.PREV_B];var z=t[A+f.PREV_A],y=t[A];e=this.getCurvePercent(A/f.ENTRIES-1,1-(e-y)/(t[A+f.PREV_TIME]-y));d+=(t[A+f.R]-d)*e;g+=(t[A+f.G]-g)*e;m+=(t[A+f.B]-m)*e;z+=(t[A+f.A]-z)*e}1==h?a.color.set(d,g,m,z):(e=a.color,k==c.setup&&e.setFromColor(a.data.color),e.add((d-e.r)*h,(g-e.g)*h,(m-e.b)*h,(z-e.a)*h))}};return f}(f);g.ENTRIES=5;g.PREV_TIME=-5;g.PREV_R=-4;g.PREV_G=-3;g.PREV_B=-2;g.PREV_A=-1;g.R=1;g.G=2;g.B=3;g.A= 4;a.ColorTimeline=g;g=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.twoColor<<24)+this.slotIndex};f.prototype.setFrame=function(a,b,c,d,e,g,h,k,m){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.R]=c;this.frames[a+f.G]=d;this.frames[a+f.B]=e;this.frames[a+f.A]=g;this.frames[a+f.R2]=h;this.frames[a+f.G2]=k;this.frames[a+f.B2]=m};f.prototype.apply=function(a,d,e,g,h,k,m){a=a.slots[this.slotIndex]; var t=this.frames;if(e=t[t.length-f.ENTRIES])e=t.length,d=t[e+f.PREV_R],g=t[e+f.PREV_G],m=t[e+f.PREV_B],z=t[e+f.PREV_A],A=t[e+f.PREV_R2],y=t[e+f.PREV_G2],C=t[e+f.PREV_B2];else{var B= b.binarySearch(t,e,f.ENTRIES);d=t[B+f.PREV_R];g=t[B+f.PREV_G];m=t[B+f.PREV_B];var z=t[B+f.PREV_A],A=t[B+f.PREV_R2],y=t[B+f.PREV_G2],C=t[B+f.PREV_B2],D=t[B];e=this.getCurvePercent(B/f.ENTRIES-1,1-(e-D)/(t[B+f.PREV_TIME]-D));d+=(t[B+f.R]-d)*e;g+=(t[B+f.G]-g)*e;m+=(t[B+f.B]-m)*e;z+=(t[B+f.A]-z)*e;A+=(t[B+f.R2]-A)*e;y+=(t[B+f.G2]-y)*e;C+=(t[B+f.B2]-C)*e}1==h?(a.color.set(d,g,m,z),a.darkColor.set(A,y,C,1)):(e=a.color,t=a.darkColor,k==c.setup&&(e.setFromColor(a.data.color),t.setFromColor(a.data.darkColor)), e.add((d-e.r)*h,(g-e.g)*h,(m-e.b)*h,(z-e.a)*h),t.add((A-t.r)*h,(y-t.g)*h,(C-t.b)*h,0))}};return f}(f);g.ENTRIES=8;g.PREV_TIME=-8;g.PREV_R=-7;g.PREV_G=-6;g.PREV_B=-5;g.PREV_A=-4;g.PREV_R2=-3;g.PREV_G2=-2;g.PREV_B2=-1;g.R=1;g.G=2;g.B=3;g.A=4;g.R2=5;g.G2=6;g.B2=7;a.TwoColorTimeline=g;g=function(){function f(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}f.prototype.getPropertyId=function(){return(e.attachment<<24)+this.slotIndex};f.prototype.getFrameCount=function(){return this.frames.length}; f.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};f.prototype.apply=function(a,e,f,g,h,k,m){e=a.slots[this.slotIndex];m==d.out&&k==c.setup?(f=e.data.attachmentName,e.setAttachment(null==f?null:a.getAttachment(this.slotIndex,f))):(m=this.frames,f=m[m.length-1]?m.length-1:b.binarySearch(m,f,1)-1,f=this.attachmentNames[k],a.slots[this.slotIndex].setAttachment(null== f?null:a.getAttachment(this.slotIndex,f))))};return f}();a.AttachmentTimeline=g;var k=null,g=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b);c.frameVertices=Array(b);null==k&&(k=a.Utils.newFloatArray(64));return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.deform<<27)+ +this.attachment.id+this.slotIndex};f.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};f.prototype.apply=function(d,e,f,g,h,m,n){e=d.slots[this.slotIndex]; var t=e.getAttachment();if(t instanceof a.VertexAttachment&&t.applyDeform(this.attachment)){n=this.frameVertices;d=n[0].length;e=a.Utils.setArraySize(e.attachmentVertices,d);var z=this.frames;if(f=z[z.length-1])if(g=n[z.length- 1],1==h)a.Utils.arrayCopy(g,0,e,0,d);else if(m==c.setup)if(null==t.bones)for(n=t.vertices,f=0;fd)this.apply(a,c,Number.MAX_VALUE, e,f,g,h),c=-1;else if(c>=k[m-1])return;if(!(d=k[a];a++)e.push(this.events[a])}}};return c}();a.EventTimeline=g;g=function(){function f(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}f.prototype.getPropertyId=function(){return e.drawOrder<<24};f.prototype.getFrameCount=function(){return this.frames.length};f.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};f.prototype.apply= function(e,f,g,h,k,m,x){f=e.drawOrder;h=e.slots;if(x==d.out&&m==c.setup)a.Utils.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else if(x=this.frames,g=x[x.length-1]?x.length-1:b.binarySearch(x,g)-1,g=this.drawOrders[e],null==g)a.Utils.arrayCopy(h,0,f,0,h.length);else for(e=0,m=g.length;e=e[e.length-g.ENTRIES])m==c.setup?(a.mix=a.data.mix+(e[e.length+g.PREV_MIX]-a.data.mix)*k,a.bendDirection=w==d.out?a.data.bendDirection:e[e.length+g.PREV_BEND_DIRECTION]):(a.mix+=(e[e.length+g.PREV_MIX]-a.mix)*k,w==d["in"]&&(a.bendDirection=e[e.length+g.PREV_BEND_DIRECTION]));else{h=b.binarySearch(e,f,g.ENTRIES);var t=e[h+g.PREV_MIX],z=e[h];f=this.getCurvePercent(h/g.ENTRIES-1,1-(f-z)/(e[h+g.PREV_TIME]-z));m==c.setup?(a.mix=a.data.mix+(t+(e[h+g.MIX]- t)*f-a.data.mix)*k,a.bendDirection=w==d.out?a.data.bendDirection:e[h+g.PREV_BEND_DIRECTION]):(a.mix+=(t+(e[h+g.MIX]-t)*f-a.mix)*k,w==d["in"]&&(a.bendDirection=e[h+g.PREV_BEND_DIRECTION]))}};return g}(f);g.ENTRIES=3;g.PREV_TIME=-3;g.PREV_MIX=-2;g.PREV_BEND_DIRECTION=-1;g.MIX=1;g.BEND_DIRECTION=2;a.IkConstraintTimeline=g;g=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.transformConstraint<< 24)+this.transformConstraintIndex};f.prototype.setFrame=function(a,b,c,d,e,g){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.ROTATE]=c;this.frames[a+f.TRANSLATE]=d;this.frames[a+f.SCALE]=e;this.frames[a+f.SHEAR]=g};f.prototype.apply=function(a,d,e,g,h,k,m){d=this.frames;a=a.transformConstraints[this.transformConstraintIndex];if(e=d[d.length-f.ENTRIES])e=d.length,g=d[e+f.PREV_ROTATE],m=d[e+f.PREV_TRANSLATE],t=d[e+f.PREV_SCALE],z=d[e+f.PREV_SHEAR];else{var A=b.binarySearch(d,e,f.ENTRIES);g=d[A+f.PREV_ROTATE];m=d[A+f.PREV_TRANSLATE];var t=d[A+f.PREV_SCALE],z=d[A+f.PREV_SHEAR],y=d[A];e=this.getCurvePercent(A/f.ENTRIES-1,1-(e-y)/(d[A+f.PREV_TIME]-y));g+=(d[A+f.ROTATE]- g)*e;m+=(d[A+f.TRANSLATE]-m)*e;t+=(d[A+f.SCALE]-t)*e;z+=(d[A+f.SHEAR]-z)*e}k==c.setup?(e=a.data,a.rotateMix=e.rotateMix+(g-e.rotateMix)*h,a.translateMix=e.translateMix+(m-e.translateMix)*h,a.scaleMix=e.scaleMix+(t-e.scaleMix)*h,a.shearMix=e.shearMix+(z-e.shearMix)*h):(a.rotateMix+=(g-a.rotateMix)*h,a.translateMix+=(m-a.translateMix)*h,a.scaleMix+=(t-a.scaleMix)*h,a.shearMix+=(z-a.shearMix)*h)}};return f}(f);g.ENTRIES=5;g.PREV_TIME=-5;g.PREV_ROTATE=-4;g.PREV_TRANSLATE=-3;g.PREV_SCALE=-2;g.PREV_SHEAR= -1;g.ROTATE=1;g.TRANSLATE=2;g.SCALE=3;g.SHEAR=4;a.TransformConstraintTimeline=g;g=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.pathConstraintPosition<<24)+this.pathConstraintIndex};f.prototype.setFrame=function(a,b,c){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.VALUE]=c};f.prototype.apply=function(a,d,e,g,h,k,m){d=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(e< d[0])switch(k){case c.setup:a.position=a.data.position;break;case c.current:a.position+=(a.data.position-a.position)*h}else{g=0;if(e>=d[d.length-f.ENTRIES])g=d[d.length+f.PREV_VALUE];else{m=b.binarySearch(d,e,f.ENTRIES);g=d[m+f.PREV_VALUE];var t=d[m];e=this.getCurvePercent(m/f.ENTRIES-1,1-(e-t)/(d[m+f.PREV_TIME]-t));g+=(d[m+f.VALUE]-g)*e}a.position=k==c.setup?a.data.position+(g-a.data.position)*h:a.position+(g-a.position)*h}};return f}(f);g.ENTRIES=2;g.PREV_TIME=-2;g.PREV_VALUE=-1;g.VALUE=1;a.PathConstraintPositionTimeline= g;g=function(a){function d(b){return a.call(this,b)||this}__extends(d,a);d.prototype.getPropertyId=function(){return(e.pathConstraintSpacing<<24)+this.pathConstraintIndex};d.prototype.apply=function(a,e,f,g,h,k,m){e=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f=e[e.length-d.ENTRIES])g=e[e.length+d.PREV_VALUE];else{m=b.binarySearch(e,f,d.ENTRIES);g=e[m+d.PREV_VALUE]; var t=e[m];f=this.getCurvePercent(m/d.ENTRIES-1,1-(f-t)/(e[m+d.PREV_TIME]-t));g+=(e[m+d.VALUE]-g)*f}a.spacing=k==c.setup?a.data.spacing+(g-a.data.spacing)*h:a.spacing+(g-a.spacing)*h}};return d}(g);a.PathConstraintSpacingTimeline=g;f=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.pathConstraintMix<<24)+this.pathConstraintIndex};f.prototype.setFrame=function(a,b,c,d){a*=f.ENTRIES; this.frames[a]=b;this.frames[a+f.ROTATE]=c;this.frames[a+f.TRANSLATE]=d};f.prototype.apply=function(a,d,e,g,h,k,m){d=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(e=d[d.length-f.ENTRIES])g=d[d.length+f.PREV_ROTATE],m=d[d.length+f.PREV_TRANSLATE];else{var t= b.binarySearch(d,e,f.ENTRIES);g=d[t+f.PREV_ROTATE];m=d[t+f.PREV_TRANSLATE];var z=d[t];e=this.getCurvePercent(t/f.ENTRIES-1,1-(e-z)/(d[t+f.PREV_TIME]-z));g+=(d[t+f.ROTATE]-g)*e;m+=(d[t+f.TRANSLATE]-m)*e}k==c.setup?(a.rotateMix=a.data.rotateMix+(g-a.data.rotateMix)*h,a.translateMix=a.data.translateMix+(m-a.data.translateMix)*h):(a.rotateMix+=(g-a.rotateMix)*h,a.translateMix+=(m-a.translateMix)*h)}};return f}(f);f.ENTRIES=3;f.PREV_TIME=-3;f.PREV_ROTATE=-2;f.PREV_TRANSLATE=-1;f.ROTATE=1;f.TRANSLATE=2; a.PathConstraintMixTimeline=f})(spine||(spine={})); (function(a){var b=function(){function b(e){this.tracks=[];this.events=[];this.listeners=[];this.queue=new d(this);this.propertyIDs=new a.IntSet;this.mixingTo=[];this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new c});this.data=e}b.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,d=b.length;c=e.trackEnd&&null==e.mixingFrom){b[c]=null;this.queue.end(e);this.disposeNext(e);continue}if(null!=e.mixingFrom&&this.updateMixingFrom(e,a))for(g=e.mixingFrom,e.mixingFrom=null;null!=g;)this.queue.end(g),g=g.mixingFrom;e.trackTime+=f}}this.queue.drain()}; b.prototype.updateMixingFrom=function(a,b){var c=a.mixingFrom;if(null==c)return!0;var d=this.updateMixingFrom(c,b);if(0=a.mixDuration||0==a.timeScale)){if(0==c.totalAlpha||0==a.mixDuration)a.mixingFrom=c.mixingFrom,a.interruptAlpha=c.interruptAlpha,this.queue.end(c);return d}c.animationLast=c.nextAnimationLast;c.trackLast=c.nextTrackLast;c.trackTime+=b*c.timeScale;a.mixTime+=b*a.timeScale;return!1};b.prototype.apply=function(c){if(null==c)throw Error("skeleton cannot be null."); this.animationsChanged&&this._animationsChanged();for(var d=this.events,e=this.tracks,f=!1,p=0,r=e.length;p=s.trackEnd&&null==s.next&&(u=0);var x=s.animationLast,w=s.getAnimationTime(),t=s.animation.timelines.length,z=s.animation.timelines;if(1==u)for(var A=0;A=b.FIRST?a.MixPose.setup:v;D instanceof a.RotateTimeline?this.applyRotateTimeline(D,c,w,u,I,B,A<<1,C):D.apply(c,x,w,d,u,I,a.MixDirection["in"])}}this.queueEvents(s,w);d.length=0;s.nextAnimationLast=w;s.nextTrackLast=s.trackTime}}this.queue.drain();return f};b.prototype.applyMixingFrom=function(c,d,e){var f=c.mixingFrom;null!= f.mixingFrom&&this.applyMixingFrom(f,d,e);var p=0;0==c.mixDuration?p=1:(p=c.mixTime/c.mixDuration,1=u[u.length-a.RotateTimeline.ENTRIES])x=c.data.rotation+u[u.length+a.RotateTimeline.PREV_ROTATION];else{var x=a.Animation.binarySearch(u,d,a.RotateTimeline.ENTRIES),w=u[x+a.RotateTimeline.PREV_ROTATION], t=u[x];b=b.getCurvePercent((x>>1)-1,1-(d-t)/(u[x+a.RotateTimeline.PREV_TIME]-t));x=u[x+a.RotateTimeline.ROTATION]-w;x=w+(x-360*(16384-(16384.499999999996-x/360|0)))*b+c.data.rotation;x-=360*(16384-(16384.499999999996-x/360|0))}f=f==a.MixPose.setup?c.data.rotation:c.rotation;u=0;b=x-f;0==b?u=g[s]:(b-=360*(16384-(16384.499999999996-b/360|0)),u=d=0,v?(d=0,u=b):(d=g[s],u=g[s+1]),v=0=Math.abs(u)&&(180d||this.queue.event(a,x)}for((a.loop?f>a.trackTime%e:b>=d&&a.animationLast=this.tracks.length)&&(a=this.tracks[a],null!=a)){this.queue.end(a);this.disposeNext(a);for(var b=a;;){var c=b.mixingFrom;if(null==c)break;this.queue.end(c);b.mixingFrom=null;b=c}this.tracks[a.trackIndex]=null;this.queue.drain()}};b.prototype.setCurrent=function(a,b,c){var d=this.expandToIndex(a); this.tracks[a]=b;null!=d&&(c&&this.queue.interrupt(d),b.mixingFrom=d,b.mixTime=0,null!=d.mixingFrom&&0=d&&(a=e.animationEnd-e.animationStart,d=0!=a?d+(a*(1+(e.trackTime/a|0))-this.data.getMix(e.animation,b)):0));c.delay=d;return c};b.prototype.setEmptyAnimation=function(a,c){var d=this.setAnimationWith(a,b.emptyAnimation,!1);d.mixDuration=c;d.trackEnd=c;return d};b.prototype.addEmptyAnimation=function(a, c,d){0>=d&&(d-=c);a=this.addAnimationWith(a,b.emptyAnimation,!1,d);a.mixDuration=c;a.trackEnd=c;return a};b.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,d=this.tracks.length;c=this.tracks.length?null:this.tracks[a]};b.prototype.addListener=function(a){if(null==a)throw Error("listener cannot be null."); this.listeners.push(a)};b.prototype.removeListener=function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};b.prototype.clearListeners=function(){this.listeners.length=0};b.prototype.clearListenerNotifications=function(){this.queue.clear()};return b}();b.emptyAnimation=new a.Animation("\x3cempty\x3e",[],0);b.SUBSEQUENT=0;b.FIRST=1;b.DIP=2;b.DIP_MIX=3;a.AnimationState=b;var c=function(){function c(){this.timelineData=[];this.timelineDipMix=[];this.timelinesRotation=[]}c.prototype.reset= function(){this.listener=this.animation=this.mixingFrom=this.next=null;this.timelineData.length=0;this.timelineDipMix.length=0;this.timelinesRotation.length=0};c.prototype.setTimelineData=function(c,d,e){null!=c&&d.push(c);var f=null!=this.mixingFrom?this.mixingFrom.setTimelineData(this,d,e):this;null!=c&&d.pop();var g=d.length-1,r=this.animation.timelines,s=this.animation.timelines.length,v=a.Utils.setArraySize(this.timelineData,s);this.timelineDipMix.length=0;var u=a.Utils.setArraySize(this.timelineDipMix, s),x=0;a:for(;x=this.animationEnd-this.animationStart};c.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0};return c}();a.TrackEntry=c;var d=function(){function a(b){this.objects=[];this.drainDisabled=!1;this.animState= b}a.prototype.start=function(a){this.objects.push(e.start);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.interrupt=function(a){this.objects.push(e.interrupt);this.objects.push(a)};a.prototype.end=function(a){this.objects.push(e.end);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.dispose=function(a){this.objects.push(e.dispose);this.objects.push(a)};a.prototype.complete=function(a){this.objects.push(e.complete);this.objects.push(a)};a.prototype.event= function(a,b){this.objects.push(e.event);this.objects.push(a);this.objects.push(b)};a.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var a=this.objects,b=this.animState.listeners,c=0;ch.status?(g.assets[a]=h.responseText,b&&b(a,h.responseText)):(g.errors[a]="Couldn't load text "+a+": status "+ h.status+", "+h.responseText,c&&c(a,"Couldn't load text "+a+": status "+h.status+", "+h.responseText)),g.toLoad--,g.loaded++)};h.open("GET",a,!0);h.send()};a.prototype.loadTexture=function(a,b,c){var g=this;void 0===b&&(b=null);void 0===c&&(c=null);a=this.pathPrefix+a;this.toLoad++;var h=new Image;h.crossOrigin="anonymous";h.onload=function(c){c=g.textureLoader(h);g.assets[a]=c;g.toLoad--;g.loaded++;b&&b(a,h)};h.onerror=function(b){g.errors[a]="Couldn't load image "+a;g.toLoad--;g.loaded++;c&&c(a, "Couldn't load image "+a)};h.src=a};a.prototype.loadTextureData=function(a,b,c,g){var h=this;void 0===c&&(c=null);void 0===g&&(g=null);a=this.pathPrefix+a;this.toLoad++;var k=new Image;k.onload=function(b){b=h.textureLoader(k);h.assets[a]=b;h.toLoad--;h.loaded++;c&&c(a,k)};k.onerror=function(b){h.errors[a]="Couldn't load image "+a;h.toLoad--;h.loaded++;g&&g(a,"Couldn't load image "+a)};k.src=b};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a= this.pathPrefix+a;var b=this.assets[a];b.dispose&&b.dispose();this.assets[a]=null};a.prototype.removeAll=function(){for(var a in this.assets){var b=this.assets[a];b.dispose&&b.dispose()}this.assets={}};a.prototype.isLoadingComplete=function(){return 0==this.toLoad};a.prototype.getToLoad=function(){return this.toLoad};a.prototype.getLoaded=function(){return this.loaded};a.prototype.dispose=function(){this.removeAll()};a.prototype.hasErrors=function(){return 0r*u-s*v:this.skeleton.flipX!=this.skeleton.flipY)c=-c,x=-x;this.a=f*n+c*g;this.b=f*p+c*h;this.c=b*n+x*g;this.d=b*p+x*h;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};b.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};b.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*a.MathUtils.radDeg}; b.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};b.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};b.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};b.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var b=this.parent;if(null==b)this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c* this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var c=b.a,f=b.b,g=b.c,h=b.d,k=1/(c*h-f*g),m=this.worldX-b.worldX,b=this.worldY-b.worldY;this.ax=m*h*k-b*f*k;this.ay=b*c*k-m*g*k;h*=k;c*=k;f*=k;k*=g;g=h*this.a-f*this.c;f=h*this.b-f*this.d;h=c*this.c-k*this.a;k=c*this.d-k*this.b;this.ashearX=0;this.ascaleX=Math.sqrt(g*g+h*h);1E-4a)throw Error("index must be \x3e\x3d 0.");if(null==b)throw Error("name cannot be null.");this.index=a;this.name=b;this.parent=f}}();a.BoneData=b;var c;(function(a){a[a.Normal=0]="Normal";a[a.OnlyTranslation=1]="OnlyTranslation";a[a.NoRotationOrReflection=2]="NoRotationOrReflection";a[a.NoScale=3]="NoScale";a[a.NoScaleOrReflection= 4]="NoScaleOrReflection"})(c=a.TransformMode||(a.TransformMode={}))})(spine||(spine={}));(function(a){var b=function(){return function(a,b){if(null==b)throw Error("data cannot be null.");this.time=a;this.data=b}}();a.Event=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.name=a}}();a.EventData=b})(spine||(spine={})); (function(a){var b=function(){function b(a,c){this.mix=1;this.bendDirection=0;if(null==a)throw Error("data cannot be null.");if(null==c)throw Error("skeleton cannot be null.");this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var f=0;fb.ascaleX&&(h+=180);180h&&(h+=360);b.updateWorldTransformWith(b.ax,b.ay, b.arotation+h*g,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};b.prototype.apply2=function(b,c,f,g,h,k){if(0==k)c.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();c.appliedValid||c.updateAppliedTransform();var m=b.ax,n=b.ay,p=b.ascaleX,r=b.ascaleY,s=c.ascaleX,v=0,u=0,x=0;0>p?(p=-p,v=180,x=-1):(v=0,x=1);0>r&&(r=-r,x=-x);0>s?(s=-s,u=180):u=0;var w=c.ax,t=0,z=0,A=0,y=b.a,C=b.b,B=b.c,D=b.d,I=1E-4>=Math.abs(p-r);I?(t=c.ay,z=y*w+C*t+b.worldX,A=B*w+D*t+b.worldY):(t=0,z=y*w+b.worldX,A=B* w+b.worldY);var F=b.parent,y=F.a,C=F.b,B=F.c,D=F.d,G=1/(y*D-C*B);f-=F.worldX;g-=F.worldY;var K=(f*D-g*C)*G-m,H=(g*y-f*B)*G-n;f=z-F.worldX;g=A-F.worldY;C=(f*D-g*C)*G-m;y=(g*y-f*B)*G-n;f=Math.sqrt(C*C+y*y);C=c.data.length*s;B=y=0;a:if(I)C*=p,y=(K*K+H*H-f*f-C*C)/(2*f*C),-1>y?y=-1:1H&&(D=-D),D=-(H+ D)/2,H=D/G,B/=D,B=Math.abs(H)=B&&(B=Math.acos(B),f=y*Math.cos(B)+f,g=C*Math.sin(B),D=f*f+g*g,DF&&(r=B,F=D,A=f,L=g));I<=(G+F)/2?(y=K-Math.atan2(z*h,H),B=p*h):(y=K-Math.atan2(L*h,A),B=r*h)}h=Math.atan2(t,w)*x;C=b.arotation;y=(y-h)*a.MathUtils.radDeg+v-C;180y&&(y+=360);b.updateWorldTransformWith(m, n,C+y*k,b.ascaleX,b.ascaleY,0,0);C=c.arotation;B=((B+h)*a.MathUtils.radDeg-c.ashearX)*x+u-C;180B&&(B+=360);c.updateWorldTransformWith(w,t,C+B*k,c.ascaleX,c.ascaleY,c.ashearX,c.ashearY)}};return b}();a.IkConstraint=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=b})(spine||(spine={})); (function(a){var b=function(){function b(a,c){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==a)throw Error("data cannot be null.");if(null==c)throw Error("skeleton cannot be null.");this.data=a;this.bones=[];for(var f=0,g=a.bones.length;fa.MathUtils.PI?F-=a.MathUtils.PI2:F<-a.MathUtils.PI&&(F+=a.MathUtils.PI2);F*=c;G=Math.cos(F);K=Math.sin(F);y.a=G*B-K*C;y.b=G*D-K*I;y.c=K*B+G*C;y.d=K*D+G*I}y.appliedValid=!1}}}};b.prototype.computeWorldPositions= function(d,e,f,g,h){var k=this.target,m=this.position,n=this.spaces,p=a.Utils.setArraySize(this.positions,3*e+2),r=null,s=d.closed,v=d.worldVerticesLength,u=v/6,x=b.NONE;if(!d.constantSpeed){var w=d.lengths,u=u-(s?1:2),t=w[u];g&&(m*=t);if(h)for(var z=0;zy&&(y+=t),h=0;else if(0>y){x!=b.BEFORE&&(x=b.BEFORE,d.computeWorldVertices(k,2,4,r,0,2));this.addBeforePosition(y,r,0,p,g);continue}else if(y> t){x!=b.AFTER&&(x=b.AFTER,d.computeWorldVertices(k,v-6,4,r,0,2));this.addAfterPosition(y-t,r,0,p,g);continue}for(;;h++){var C=w[h];if(!(y>C)){if(0==h)y/=C;else var B=w[h-1],y=(y-B)/(C-B);break}}h!=x&&(x=h,s&&h==u?(d.computeWorldVertices(k,v-4,4,r,0,2),d.computeWorldVertices(k,0,4,r,4,2)):d.computeWorldVertices(k,6*h+2,8,r,0,2));this.addCurvePosition(y,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],p,g,f||0y&&(y+=k),h=0;else if(0>y){this.addBeforePosition(y,r,0,p,g);continue}else if(y>k){this.addAfterPosition(y-k,r,v-4,p,g);continue}for(;;h++)if(M=d[h],!(y>M)){0==h?y/=M:(B=d[h-1],y=(y-B)/(M-B));break}if(h!=x){var x=h,P=6*h,w=r[P],t=r[P+1],C=r[P+2],D=r[P+ 3],I=r[P+4],F=r[P+5],G=r[P+6],K=r[P+7],H=0.03*(w-2*C+I),L=0.03*(t-2*D+F),B=0.006*(3*(C-I)-w+G),E=0.006*(3*(D-F)-t+K),M=2*H+B,N=2*L+E,H=0.3*(C-w)+H+0.16666667*B,L=0.3*(D-t)+L+0.16666667*E,O=Math.sqrt(H*H+L*L);u[0]=O;for(P=1;8>P;P++)H+=M,L+=N,M+=B,N+=E,O+=Math.sqrt(H*H+L*L),u[P]=O;H+=M;L+=N;O+=Math.sqrt(H*H+L*L);u[8]=O;H+=M+B;L+=N+E;O+=Math.sqrt(H*H+L*L);u[9]=O;E=0}for(y*=O;;E++)if(M=u[E],!(y>M)){0==E?y/=M:(B=u[E-1],y=E+(y-B)/(M-B));break}this.addCurvePosition(0.1*y,w,t,C,D,I,F,G,K,p,g,f||0d.status?c.rawAssets[b]=d.responseText:c.errors[b]="Couldn't load text "+b+": status "+d.status+", "+d.responseText)};d.open("GET",b,!0);d.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var d= new XMLHttpRequest;d.onreadystatechange=function(){d.readyState==XMLHttpRequest.DONE&&(200<=d.status&&300>d.status?c.rawAssets[b]=JSON.parse(d.responseText):c.errors[b]="Couldn't load text "+b+": status "+d.status+", "+d.responseText)};d.open("GET",b,!0);d.send()}};a.prototype.loadTexture=function(a,b,c){var d=this;c=this.pathPrefix+c;if(this.queueAsset(a,b,c)){var k=new Image;k.src=c;k.crossOrigin="anonymous";k.onload=function(a){d.rawAssets[c]=k};k.onerror=function(a){d.errors[c]="Couldn't load image "+ c}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;var c=this.clientAssets[a];return null===c||void 0===c?!0:c.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;b=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY};b.prototype.aabbIntersectsSegment=function(a,b,c,g){var h=this.minX,k=this.minY,m=this.maxX,n=this.maxY;if(a<=h&&c<=h||b<=k&&g<=k||a>=m&&c>=m||b>=n&&g>=n)return!1;c=(g-b)/(c-a);g=c*(h-a)+b;if(g>k&&gk&&g h&&kh&&ka.minX&&this.minYa.minY};b.prototype.containsPoint=function(a,b){for(var c=this.polygons,g=0,h=c.length;g=c||p=c){var r=a[m];r+(c- n)/(p-n)*(a[h]-r)=r&&t<=u||t>=u&&t<=r)&&(t>=b&&t<=g||t>=g&&t<=b)&&(r=(p*z-n*w)/A,(r>=s&&r<= x||r>=x&&r<=s)&&(r>=c&&r<=h||r>=h&&r<=c)))return!0;r=u;s=x}return!1};b.prototype.getPolygon=function(a){if(null==a)throw Error("boundingBox cannot be null.");a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};b.prototype.getWidth=function(){return this.maxX-this.minX};b.prototype.getHeight=function(){return this.maxY-this.minY};return b}();a.SkeletonBounds=b})(spine||(spine={})); (function(a){var b=function(){function b(){this.triangulator=new a.Triangulator;this.clippingPolygon=[];this.clipOutput=[];this.clippedVertices=[];this.clippedTriangles=[];this.scratch=[]}b.prototype.clipStart=function(d,e){if(null!=this.clipAttachment)return 0;this.clipAttachment=e;var f=e.worldVerticesLength,g=a.Utils.setArraySize(this.clippingPolygon,f);e.computeWorldVertices(d,0,f,g,0,2);f=this.clippingPolygon;b.makeClockwise(f);for(var f=this.clippingPolygons=this.triangulator.decompose(f,this.triangulator.triangulate(f)), g=0,h=f.length;g>1,T=this.clipOutput, J=a.Utils.setArraySize(p,E+U*u),V=0;Vc))for(n=0,c=b-2,p=b>>1;n=g.length&&(g.length=a+1);g[a]||(g[a]={});g[a][b]=c};a.prototype.getAttachment=function(a,b){var c=this.attachments[a];return c?c[b]:null};a.prototype.attachAll=function(a,b){for(var c=0,g=0;gb)throw Error("index must be \x3e\x3d 0.");if(null==d)throw Error("name cannot be null.");if(null==e)throw Error("boneData cannot be null.");this.index=b;this.name=d;this.boneData=e}}();a.SlotData=b})(spine||(spine={})); (function(a){var b=function(){function a(b){this._image=b}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case "nearest":return c.Nearest;case "linear":return c.Linear;case "mipmap":return c.MipMap;case "mipmapnearestnearest":return c.MipMapNearestNearest;case "mipmaplinearnearest":return c.MipMapLinearNearest;case "mipmapnearestlinear":return c.MipMapNearestLinear;case "mipmaplinearlinear":return c.MipMapLinearLinear;default:throw Error("Unknown texture filter "+ a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case "mirroredtepeat":return d.MirroredRepeat;case "clamptoedge":return d.ClampToEdge;case "repeat":return d.Repeat;default:throw Error("Unknown texture wrap "+a);}};return a}();a.Texture=b;var c;(function(a){a[a.Nearest=9728]="Nearest";a[a.Linear=9729]="Linear";a[a.MipMap=9987]="MipMap";a[a.MipMapNearestNearest=9984]="MipMapNearestNearest";a[a.MipMapLinearNearest=9985]="MipMapLinearNearest";a[a.MipMapNearestLinear=9986]="MipMapNearestLinear"; a[a.MipMapLinearLinear=9987]="MipMapLinearLinear"})(c=a.TextureFilter||(a.TextureFilter={}));var d;(function(a){a[a.MirroredRepeat=33648]="MirroredRepeat";a[a.ClampToEdge=33071]="ClampToEdge";a[a.Repeat=10497]="Repeat"})(d=a.TextureWrap||(a.TextureWrap={}));b=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=b})(spine||(spine={})); (function(a){var b=function(){function b(a,c){this.pages=[];this.regions=[];this.load(a,c)}b.prototype.load=function(b,f){if(null==f)throw Error("textureLoader cannot be null.");for(var k=new c(b),m=Array(4),n=null;;){var p=k.readLine();if(null==p)break;p=p.trim();if(0==p.length)n=null;else if(n){var r=new e;r.name=p;r.page=n;r.rotate="true"==k.readValue();k.readTuple(m);var p=parseInt(m[0]),s=parseInt(m[1]);k.readTuple(m);var v=parseInt(m[0]),u=parseInt(m[1]);r.u=p/n.width;r.v=s/n.height;r.rotate? (r.u2=(p+u)/n.width,r.v2=(s+v)/n.height):(r.u2=(p+v)/n.width,r.v2=(s+u)/n.height);r.x=p;r.y=s;r.width=Math.abs(v);r.height=Math.abs(u);4==k.readTuple(m)&&4==k.readTuple(m)&&k.readTuple(m);r.originalWidth=parseInt(m[0]);r.originalHeight=parseInt(m[1]);k.readTuple(m);r.offsetX=parseInt(m[0]);r.offsetY=parseInt(m[1]);r.index=parseInt(k.readValue());r.texture=n.texture;this.regions.push(r)}else n=new d,n.name=p,2==k.readTuple(m)&&(n.width=parseInt(m[0]),n.height=parseInt(m[1]),k.readTuple(m)),k.readTuple(m), n.minFilter=a.Texture.filterFromString(m[0]),n.magFilter=a.Texture.filterFromString(m[1]),r=k.readValue(),n.uWrap=a.TextureWrap.ClampToEdge,n.vWrap=a.TextureWrap.ClampToEdge,"x"==r?n.uWrap=a.TextureWrap.Repeat:"y"==r?n.vWrap=a.TextureWrap.Repeat:"xy"==r&&(n.uWrap=n.vWrap=a.TextureWrap.Repeat),n.texture=f(p),n.texture.setFilters(n.minFilter,n.magFilter),n.texture.setWraps(n.uWrap,n.vWrap),n.width=n.texture.getImage().width,n.height=n.texture.getImage().height,this.pages.push(n)}};b.prototype.findRegion= function(a){for(var b=0;b=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(":");if(-1==b)throw Error("Invalid line: "+ a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(":");if(-1==c)throw Error("Invalid line: "+b);for(var d=0,c=c+1;3>d;d++){var e=b.indexOf(",",c);if(-1==e)break;a[d]=b.substr(c,e-c).trim();c=e+1}a[d]=b.substring(c).trim();return d+1};return a}(),d=function(){return function(){}}();a.TextureAtlasPage=d;var e=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=e})(spine|| (spine={})); (function(a){var b=function(){function b(c,e){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==c)throw Error("data cannot be null.");if(null==e)throw Error("skeleton cannot be null.");this.data=c;this.rotateMix=c.rotateMix;this.translateMix=c.translateMix;this.scaleMix=c.scaleMix;this.shearMix=c.shearMix;this.bones=[];for(var f=0;fa.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2);var C=C*b,B=Math.cos(C),C=Math.sin(C);w.a=B*z-C*A;w.b=B*t-C*y;w.c=C*z+B*A;w.d=C*t+B*y;t=!0}0!=c&&(t=this.temp,h.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),w.worldX+=(t.x-w.worldX)*c,w.worldY+=(t.y-w.worldY)*c,t=!0);0a.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2),C=z+(C+r)*g,t=Math.sqrt(t*t+y*y),w.b=Math.cos(C)*t,w.d=Math.sin(C)*t,t=!0);t&&(w.appliedValid=!1)}};b.prototype.applyRelativeWorld=function(){for(var b=this.rotateMix,c=this.translateMix,f=this.scaleMix,g=this.shearMix, h=this.target,k=h.a,m=h.b,n=h.c,p=h.d,r=0a.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2);var C=C*b,B=Math.cos(C),C=Math.sin(C);w.a=B*t-C*A;w.b=B*z-C*y;w.c=C*t+B*A;w.d=C*z+B*y;t=!0}0!=c&&(t=this.temp,h.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),w.worldX+= t.x*c,w.worldY+=t.y*c,t=!0);0a.MathUtils.PI?C-=a.MathUtils.PI2:C<-a.MathUtils.PI&&(C+=a.MathUtils.PI2),z=w.b,y=w.d,C=Math.atan2(y,z)+(C-a.MathUtils.PI/2+r)*g,t=Math.sqrt(z*z+y*y),w.b=Math.cos(C)*t,w.d=Math.sin(C)*t,t=!0);t&&(w.appliedValid=!1)}};b.prototype.applyAbsoluteLocal=function(){var a=this.rotateMix,b=this.translateMix, c=this.scaleMix,g=this.shearMix,h=this.target;h.appliedValid||h.updateAppliedTransform();for(var k=this.bones,m=0,n=k.length;m>1,f=this.indicesArray,g=f.length=0;gthis.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1c?c:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b* a.degRad)};a.signum=function(a){return 0a?-1:0};a.toInt=function(a){return 0a?-b:b};a.randomTriangular=function(b,e){return a.randomTriangularWith(b,e,0.5*(b+e))};a.randomTriangularWith=function(a,b,c){var g=Math.random(),h=b-a;return g<=(c-a)/h?a+Math.sqrt(g*h*(c-a)):b-Math.sqrt((1-g)*h*(b-c))};return a}();b.PI=3.1415927;b.PI2=2*b.PI;b.radiansToDegrees=180/b.PI;b.radDeg=b.radiansToDegrees;b.degreesToRadians= b.PI/180;b.degRad=b.degreesToRadians;a.MathUtils=b;b=function(){function a(){}a.prototype.apply=function(a,b,c){return a+(b-a)*this.applyInternal(c)};return a}();a.Interpolation=b;b=function(a){function b(d){var f=a.call(this)||this;f.power=2;f.power=d;return f}__extends(b,a);b.prototype.applyInternal=function(a){return 0.5>=a?Math.pow(2*a,this.power)/2:Math.pow(2*(a-1),this.power)/(0==this.power%2?-2:2)+1};return b}(b);a.Pow=b;b=function(a){function b(d){return a.call(this,d)||this}__extends(b,a); b.prototype.applyInternal=function(a){return Math.pow(a-1,this.power)*(0==this.power%2?-1:1)+1};return b}(b);a.PowOut=b;b=function(){function a(){}a.arrayCopy=function(a,b,c,g,h){for(var k=b;k=e?b:a.setArraySize(b,e,f)};a.newArray=function(a,b){for(var c=Array(a),g=0;gthis.maxDelta&&(this.delta=this.maxDelta);this.lastTime=a;this.frameCount++;1=this.values.length};a.prototype.addValue=function(a){this.addedValuesthis.values.length-1&&(this.lastValue=0);this.dirty=!0};a.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var a=0,b=0;b>1)*m;var n=a.bone.skeleton,p=a.attachmentVertices,r=this.vertices,s=this.bones;if(null==s){00.5*(cc.BATCH_VERTEX_COUNT-200);!v&&u&&(cc.renderer._batchRendering(),v=!0);v&&(e=0);v=null;if(k instanceof a.RegionAttachment)v=this._uploadRegionAttachmentData(k,m,p,b,d,e);else if(k instanceof a.MeshAttachment)this._uploadMeshAttachmentData(k,m,p,b,d,e);else continue;this._node._debugSlots&&(r[g]=v);k instanceof a.RegionAttachment?cc.renderer._increaseBatchingSize(s,cc.renderer.VertexType.TRIANGLE): cc.renderer._increaseBatchingSize(s,cc.renderer.VertexType.CUSTOM,k.triangles);e+=6*s}}if(f._debugBones||f._debugSlots){cc.renderer._batchRendering();g=this._worldTransform;n=this._matrix.mat;n[0]=g.a;n[4]=g.c;n[12]=g.tx;n[1]=g.b;n[5]=g.d;n[13]=g.ty;cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.current_stack.stack.push(cc.current_stack.top);cc.current_stack.top=this._matrix;b=cc._drawingUtil;if(f._debugSlots&&r&&0z;z++){var A=4>z?z%3:z-2,y=k[2*A],C=k[2*A+1],B=y*e+C*u+w,D=b.a*r<<24|b.b*p<<16|b.g*n<<8|b.r*m;f[h]=y*v+C*d+x;f[h+1]=B;f[h+2]=t;g[h+3]=D;f[h+4]=s[2*A];f[h+5]=s[2*A+1];h+=6}if(this._node._debugSlots)return f= a.RegionAttachment,[cc.p(k[f.OX1],k[f.OY1]),cc.p(k[f.OX2],k[f.OY2]),cc.p(k[f.OX3],k[f.OY3]),cc.p(k[f.OX4],k[f.OY4])]};b._uploadMeshAttachmentData=function(b,d,e,f,g,h){var k=this._worldTransform,m=k.a,n=k.b,p=k.c,r=k.d,s=k.tx,k=k.ty,v=this._node.vertexZ,u=b.worldVerticesLength,x=a.Utils.setArraySize([],u,0);b.computeWorldVertices(d,0,u,x,0,2);var u=b.uvs,w=d.bone.skeleton.color;d=d.color;var t=b.color,z=w.a*d.a*t.a;e=e?z:1;b=b.tempColor;b.set(w.r*d.r*t.r*e,w.g*d.g*t.g*e,w.b*d.b*t.b*e,z);d=this._displayedColor; e=d.r;w=d.g;d=d.b;for(var t=this._displayedOpacity,z=0,A=x.length;zwindow.innerHeight;Math.max(screen.width,screen.height);Math.min(screen.width,screen.height);a?document.getElementById("orienttip").style.display="block":document.getElementById("orienttip").style.display="none";document.getElementById("orientationswipe").style.display="none"},500)};var NKG=NKG||{},GAME_CONFIG={severIP:serverUrl,gameId:"9KG-00013",version:"1.0.2",centerX:0,centerY:0,language:0,isHidden:!1},LANGUAGE=["cn","tai","en","en"],USER_INFO={memberId:"",name:"",avatar:"",credit:0,tableId:"",bet:0,totalBet:0,gsn:"",maxbet:1E5,minbet:1E3,nobetroundcount:0,volumeswitch:1,chipselectindex:0,chiplist:[],historyurl:"",tablelist:[],gamecredit:0,cardlist:{},playingflag:!1,sidinfo:[],point:0,tag:0,laststate:"idel",hallid:1,totalbettime:15,insuretotalbettime:15,selfsidlist:[],selfRealBetAmountList:[0, 0,0,0,0],hitsid:0,hitmode:0,hitsubhitindex:0,dealercardlist:[],dealerpoint:[],selfInsureBetAmountList:[0,0,0,0,0]},GAME_STATUS=0,BANKER_ID=0,ERROR_CODE={success:0,disconnect:1,memberError:2,balanceError:3,requestError:4},ERROR_TXT=["Success:0","Disconnect:1","NoLogin:2","BalanceError:3","RequestFail:4"],COMMAND_ID={login:1000001,loginBack:2000001,game:1000003,gameBack:2000003,updateBetInfo:3001,updateAllPlayerSeatInfo:3002,updatePlayerSplit:3003,updatePlayerStand:3004,updatePlayerHit:3005,updatePlayerDouble:3006, updateDealerHit:3007,updatePlayerTakeSeat:3008,updatePlayerLeaveSeat:3009,updatePlayerInsureBet:3010,newGameStartStage:4001,bettingStage:4002,shuffleStage:4003,dealingStage:4004,insureStage:4005,hitStandStage:4006,dealerOpenStage:4007,dealerHitStandStage:4008,resultStage:4009,gameFinishStage:4010,hitStandAgentStage:4011,gameErrorStage:4099,updatebalance:5001},GAME_COMMAND={enterTable:1001,enterTableBack:2001,goToLobby:1002,goToLobbyBack:2002,seat:1003,seatback:2003,bet:1004,betback:2004,split:1005, splitback:2005,double:1006,doubleback:2006,hit:1007,hitback:2007,stand:1008,standback:2008,betinsure:1009,betinsureback:2009,leaveseat:1010,leaveseatback:2010},BROADCASTEVENT="broadcast_event",EVENT_ID={login:1,enterTable:2,changeTable:3,setSeat:4,callCard:5,stopCard:6,bet:7,setBanker:8,goToLobby:9,incash:10,openCard:14,gameStatus:15,maxminbeterror:16,openhelp:17,seat:18,split:19,double:20,hit:21,stand:22,betinsure:23,leaveseat:24,setLanguage:96,setSmallBetChip:97,showGameInfoMsg:98,showErrorMsg:99, game_hide:101,game_show:102,ws_closed:103,selfseated:104,selfunseated:105,stopbettime:107,enterTableError:108,loginError:109,betTimeZero:110,openhelpUI:111,newGameStartStage:114,bettingStage:115,shuffleStage:116,dealingStage:117,insureStage:118,hitStandStage:119,dealerOpenStage:120,dealerHitStandStage:121,resultStage:122,gameFinishStage:123,gameErrorStage:124,hitStandAgentStage:125,updateBetInfo:3001,updateAllPlayerSeatInfo:3002,updatePlayerSplit:3003,updatePlayerStand:3004,updatePlayerHit:3005,updatePlayerDouble:3006, updateDealerHit:3007,updatePlayerTakeSeat:3008,updatePlayerLeaveSeat:3009,updatePlayerInsureBet:3010,updatebalance:5001},EVENTDATA=cc.Class.extend({_layerId:"all",_eventId:"",_int:0,_string:"",_userData:null,addInt:function(a){this._int=a},addString:function(a){this._string=a},setLayerID:function(a){this._layerId=a},setEventID:function(a){this._eventId=a},setUserData:function(a){this._userData=a}}),FORMAT_NAME=function(a,b,c){var d=new ccui.Text(a,"Arial",b),e=d.width;delete d;if(e>c){a=a.split(""); d=a.length;for(e=0;ec?"0"+c:c)},CHIP_CREDIT=[1,2,5,10,20,25,50,100,250,500,1E3,2E3, 5E3,1E4,5E4,1E5],GET_CHIP_BG=function(a){return CHIP_CREDIT.indexOf(a)},GET_SMALL_CHIP=function(a){for(var b=0;ba?""+Math.floor(a/1E3)+"K":1E6<=a?""+Math.floor(a/1E6)+"M":""+a},GET_KMBT_NUM2=function(a){var b="";return b=1E6<=a&&1E8>a?""+ADD_COMMA(Math.floor(a/1E3))+"K":1E8<=a?""+ADD_COMMA(Math.floor(a/1E6))+"M":""+ADD_COMMA(a)},ISEMPTYOBJECT=function(a){for(var b in a)return!1;return!0},GET_TAG_STRING=function(a){return{0:"other",1:"flush", 2:"straight",3:"sam_lueang",4:"straight_flush",5:"tong"}[a]};var Scene=cc.Scene.extend({_layer:[],_bg_sound:null,onEnter:function(){this._super();cc.log("Scene ctor");GAME_CONFIG.centerX=cc.winSize.width/2;GAME_CONFIG.centerY=640;CreateWebSocket();this._ly_background=new Ly_Background;this._ly_background.setVisible(!1);this.addChild(this._ly_background);this._layer.push(this._ly_background);this._ly_bottomUI=new Ly_BottomUI;this._ly_bottomUI.setVisible(!1);this.addChild(this._ly_bottomUI);this._layer.push(this._ly_bottomUI);this._ly_topUI=new Ly_TopUI;this._ly_topUI.setVisible(!1); this.addChild(this._ly_topUI);this._layer.push(this._ly_topUI);this._ly_helpUI=new Ly_HelpUI;this._ly_helpUI.setVisible(!1);this.addChild(this._ly_helpUI);this._layer.push(this._ly_helpUI);this._ly_winUI=new Ly_WinUI;this._ly_winUI.setVisible(!1);this.addChild(this._ly_winUI);this._layer.push(this._ly_winUI);this._ly_lobby=new Ly_Lobby;this._ly_lobby.setVisible(!0);this.addChild(this._ly_lobby);this._layer.push(this._ly_lobby);this._ly_loading=new Ly_Loading;this._ly_loading.setVisible(!0);this.addChild(this._ly_loading); this._ly_message=new Ly_Message;this._ly_message.setVisible(!0);this.addChild(this._ly_message);this._listener=cc.EventListener.create({event:cc.EventListener.CUSTOM,eventName:BROADCASTEVENT,callback:function(a){a.getCurrentTarget().handleBroadcast(a.getUserData())}});cc.eventManager.addListener(this._listener,this);cc.eventManager.addCustomListener(cc.game.EVENT_HIDE,function(){GAME_CONFIG.isHidden=!0;var a=new EVENTDATA;a.setEventID(EVENT_ID.game_hide);var b=new cc.EventCustom(BROADCASTEVENT);b.setUserData(a); cc.eventManager.dispatchEvent(b);cc.audioEngine.setMusicVolume(0);cc.audioEngine.setEffectsVolume(0)});cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){GAME_CONFIG.isHidden=!1;var a=new EVENTDATA;a.setEventID(EVENT_ID.game_show);var b=new cc.EventCustom(BROADCASTEVENT);b.setUserData(a);cc.eventManager.dispatchEvent(b);USER_INFO.volumeswitch&&(cc.audioEngine.setMusicVolume(1),cc.audioEngine.setEffectsVolume(1))});this.scheduleUpdate()},onExit:function(){this._super()},update:function(a){this._ly_loading&& this._ly_loading.getLoadingisFinish()&&(this.removeChild(this._ly_loading),this._ly_loading=null);cc.audioEngine.isMusicPlaying()||(this._bg_sound=cc.audioEngine.playMusic(res.bg))},handleBroadcast:function(a){if(a._eventId===EVENT_ID.login)for(var b=0;bb;b++){var c=new cc.Sprite(res["gme_spotlight_"+b]);c.setAnchorPoint(0.5,0.5);c.setPosition(GAME_CONFIG.centerX+this._spotlight_pos[b-1][0],GAME_CONFIG.centerY+this._spotlight_pos[b-1][1]);c.setName("spotlight_"+b);c.setVisible(!1);this.addChild(c)}this.avatar=new cc.Sprite(res.avatar_01);this.avatar.setAnchorPoint(0.5,0.5);this.avatar.setPosition(GAME_CONFIG.centerX-300,GAME_CONFIG.centerY- 579);this.avatar.setScale(0.818);this.avatar.setVisible(!0);this.addChild(this.avatar);this.gme_ui=new cc.Sprite(res.gme_ui);this.gme_ui.setAnchorPoint(0.5,0.5);this.gme_ui.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-508);this.gme_ui.setVisible(!0);this.addChild(this.gme_ui);this.min_bet_str=new cc.Sprite(res.gme_min_bet_cn);this.min_bet_str.setAnchorPoint(0.5,0.5);this.min_bet_str.setPosition(GAME_CONFIG.centerX-175,GAME_CONFIG.centerY-541);this.min_bet_str.setVisible(!0);this.addChild(this.min_bet_str); this.max_bet_str=new cc.Sprite(res.gme_max_bet_cn);this.max_bet_str.setAnchorPoint(0.5,0.5);this.max_bet_str.setPosition(GAME_CONFIG.centerX-175,GAME_CONFIG.centerY-571);this.max_bet_str.setVisible(!0);this.addChild(this.max_bet_str);this.minbet_nbr=new SW.NumberAtlas(0,res.gme_nbr_bet,7,24);this.minbet_nbr.setAnchorPoint(0.5,0.5);this.minbet_nbr.setPosition(GAME_CONFIG.centerX-61,GAME_CONFIG.centerY-541);this.minbet_nbr.setVisible(!0);this.minbet_nbr.setNumber(ADD_COMMA(1E4));this.addChild(this.minbet_nbr); this.maxbet_nbr=new SW.NumberAtlas(0,res.gme_nbr_bet,7,24);this.maxbet_nbr.setAnchorPoint(0.5,0.5);this.maxbet_nbr.setPosition(GAME_CONFIG.centerX-61,GAME_CONFIG.centerY-571);this.maxbet_nbr.setVisible(!0);this.maxbet_nbr.setNumber(ADD_COMMA(1E4));this.addChild(this.maxbet_nbr);this.balance=new SW.NumberAtlas(0,res.gme_nbr_total,9,32);this.balance.setAnchorPoint(1,0.5);this.balance.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-608);this.balance.setVisible(!0);this.balance.setScale(0.75);this.balance.setNumber(ADD_COMMA(1E4)); this.addChild(this.balance);this.addAvatars();this.bettime=new SW.NumberAtlas(0,res.gme_nbr_time,18,66);this.bettime.setAnchorPoint(0.5,0.5);this.bettime.setPosition(GAME_CONFIG.centerX+159,GAME_CONFIG.centerY-533);this.bettime.setVisible(!1);this.bettime.setNumber(60);this.addChild(this.bettime);this.selfcdsec=sp.SkeletonAnimation.createWithJsonFile(res.countdown_json,res.countdown_atlas);this.selfcdsec.setAnchorPoint(0,0);this.selfcdsec.setPosition(GAME_CONFIG.centerX+159,GAME_CONFIG.centerY-533); this.selfcdsec.setName("cdsec_self"+(b+1));this.selfcdsec.setAnimation(0,"countdiwn",!1);this.selfcdsec.setScale(1.21505376344086);this.selfcdsec.setVisible(!1);this.selfcdsec.setTimeScale(3);this.addChild(this.selfcdsec);this.selfcdsec.setToSetupPose();this.selfcdsec.clearTracks();this.insurebettime=new SW.NumberAtlas(0,res.gme_nbr_time,18,66);this.insurebettime.setAnchorPoint(0.5,0.5);this.insurebettime.setPosition(GAME_CONFIG.centerX+159,GAME_CONFIG.centerY-533);this.insurebettime.setVisible(!1); this.insurebettime.setNumber(60);this.addChild(this.insurebettime);this.insurecdsec=sp.SkeletonAnimation.createWithJsonFile(res.countdown_json,res.countdown_atlas);this.insurecdsec.setAnchorPoint(0,0);this.insurecdsec.setPosition(GAME_CONFIG.centerX+159,GAME_CONFIG.centerY-533);this.insurecdsec.setName("cdsec_insure"+(b+1));this.insurecdsec.setAnimation(0,"countdiwn",!1);this.insurecdsec.setScale(1.21505376344086);this.insurecdsec.setVisible(!1);this.insurecdsec.setTimeScale(3);this.addChild(this.insurecdsec); this.insurecdsec.setToSetupPose();this.insurecdsec.clearTracks();for(b=0;6>b;b++)c=sp.SkeletonAnimation.createWithJsonFile(res.licensing_json,res.licensing_atlas),c.setToSetupPose(),c.clearTracks(),c.setAnchorPoint(0,0),c.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY),c.setName("licensing_"+b),c.setAnimation(0,this._licensingAnmIndex[b],!1),c.setVisible(!1),c.setTimeScale(1),this.addChild(c,999),c.update(0),c.setAnimationListener(c,function(a,b,c,g,h){c===sp.ANIMATION_EVENT_TYPE.COMPLETE&&b.animation&& a.visible&&a.setVisible(!1)});for(b=0;25>b;b++)c=new cc.Sprite(res.gme_back),c.setAnchorPoint(0.5,0.5),c.setPosition(GAME_CONFIG.centerX+this._dealer2CardsPos[0][0],GAME_CONFIG.centerY+this._dealer2CardsPos[0][1]),c.setName("dealercard_"+b),c.setScale(0.6),c.setVisible(!1),this.addChild(c);this.dealerOpenCardAnm=sp.SkeletonAnimation.createWithJsonFile(res.open_card_json,res.open_card_atlas);this.dealerOpenCardAnm.setToSetupPose();this.dealerOpenCardAnm.clearTracks();this.dealerOpenCardAnm.setAnchorPoint(0, 0);this.dealerOpenCardAnm.setPosition(GAME_CONFIG.centerX+200,GAME_CONFIG.centerY+6);this.dealerOpenCardAnm.setAnimation(0,"open",!1);this.dealerOpenCardAnm.setVisible(!1);this.dealerOpenCardAnm.setTimeScale(1);this.addChild(this.dealerOpenCardAnm);this.dealerOpenCardAnm.update(0);this.dealerOpenCardAnm.setAnimationListener(this.dealerOpenCardAnm,function(a,b,c,g,h){c===sp.ANIMATION_EVENT_TYPE.COMPLETE&&b.animation&&a.visible&&a.setVisible(!1)});this.dealerBJAnm=sp.SkeletonAnimation.createWithJsonFile(res.BJ_button_json, res.BJ_button_atlas);this.dealerBJAnm.setToSetupPose();this.dealerBJAnm.clearTracks();this.dealerBJAnm.setAnchorPoint(0,0);this.dealerBJAnm.setPosition(GAME_CONFIG.centerX+this._dealerPointTagStartPos[0],GAME_CONFIG.centerY+this._dealerPointTagStartPos[1]);this.dealerBJAnm.setAnimation(0,"start",!1);this.dealerBJAnm.setVisible(!1);this.addChild(this.dealerBJAnm);this.dealerBJAnm.update(0);this.dealerBJAnm.setAnimationListener(this.dealerBJAnm,function(a,b,c,g,h){});this.dealerPointTag=new cc.Sprite(res.gme_notice_blue); this.dealerPointTag.setAnchorPoint(0.5,0.5);this.dealerPointTag.setPosition(GAME_CONFIG.centerX+this._dealerPointTagStartPos[0],GAME_CONFIG.centerY+this._dealerPointTagStartPos[1]);this.dealerPointTag.setVisible(!1);this.addChild(this.dealerPointTag);b=new SW.NumberAtlas(0,res.gme_nbr_points,8,30);b.setAnchorPoint(0.5,0.5);b.setPosition(this.dealerPointTag.width/2,this.dealerPointTag.height/2);b.setVisible(!0);b.setName("dealerpointnbr");b.setNumber(12);this.dealerPointTag.addChild(b);b=sp.SkeletonAnimation.createWithJsonFile(res.shuffle_json, res.shuffle_atlas);b.setToSetupPose();b.clearTracks();b.setAnchorPoint(0,0);b.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);b.setName("shuffleAnm");b.setAnimation(0,"animation",!1);b.setVisible(!1);b.setTimeScale(1);this.addChild(b);b.update(0);b.setAnimationListener(b,function(b,c,f,g,h){f===sp.ANIMATION_EVENT_TYPE.COMPLETE&&c.animation&&b.visible&&(b.setVisible(!1),a.showStaticCardBack())});this.gme_back=new cc.Sprite(res.gme_back);this.gme_back.setAnchorPoint(0.5,0.5);this.gme_back.setPosition(GAME_CONFIG.centerX+ 218,GAME_CONFIG.centerY-240);this.gme_back.setVisible(!1);this.addChild(this.gme_back);for(b=1;6>b;b++)c=new cc.Sprite(res.gme_chip_small_15),c.setAnchorPoint(0.5,0.5),c.setPosition(0,0),c.setName("playerloosechip_"+b),c.setVisible(!1),this.addChild(c);this.scheduleUpdate();return!0},hideAllDiamondAnm:function(){for(var a=1;6>a;a++)for(var b=1;2>=b;b++)this.getChildByName("mask_"+a).getChildByName("betbox_"+b+"_"+a).getChildByName("pointTag_"+a+"_"+b).getChildByName("diamond_"+a+"_"+b).setVisible(!1)}, showDiamondAnm:function(a,b){this.hideAllDiamondAnm();0===b?b=1:1===b&&(b=0);this.getChildByName("mask_"+a).getChildByName("betbox_"+(b+1)+"_"+a).getChildByName("pointTag_"+a+"_"+(b+1)).getChildByName("diamond_"+a+"_"+(b+1)).setVisible(!0)},showDealerPointTag:function(a,b){var c=this.dealerPointTag.getChildByName("dealerpointnbr");99===a[0]?this.dealerBJAnm.runAction(cc.sequence(cc.delayTime(0.5),cc.callFunc(function(a){a.clearTracks();a.setToSetupPose();a.setAnimation(0,"start",!1);a.setVisible(!0); a.update(0)}),cc.delayTime(1),cc.callFunc(function(a){a.clearTracks();a.setToSetupPose();a.setAnimation(0,"loop",!0);a.setVisible(!0);a.update(0)}))):(0===a[1]?c.setNumber(a[0],3):c.setNumber(""+a[0]+"/"+a[1],3),0===b?this.dealerPointTag.setPosition(GAME_CONFIG.centerX+this._dealerPointTagStartPos[0],GAME_CONFIG.centerY+this._dealerPointTagStartPos[1]):this.dealerPointTag.setPosition(GAME_CONFIG.centerX+this._dealerPointTagStartPosHit[b-1][0],GAME_CONFIG.centerY+this._dealerPointTagStartPosHit[b- 1][1]),this.dealerPointTag.setVisible(!0))},hideDealerPointTag:function(){this.dealerPointTag.setVisible(!1);this.dealerBJAnm.stopAllActions();this.dealerBJAnm.clearTracks();this.dealerBJAnm.setToSetupPose();this.dealerBJAnm.setVisible(!1)},showStaticCardBack:function(){this.gme_back.setVisible(!0)},hideStaticCardBack:function(){this.gme_back.setVisible(!1)},showShuffleAnm:function(){var a=this.getChildByName("shuffleAnm");a.clearTracks();a.setToSetupPose();a.setAnimation(0,"animation",!1);a.setVisible(!0); a.update(0)},hideResetAllLicensing:function(){for(var a=0;6>a;a++){var b=this.getChildByName("licensing_"+a);b.clearTracks();b.setToSetupPose();b.setVisible(!1)}},showNoticePoint:function(a){},showAllDealing:function(){for(var a=this,b=0;b=a;a++)for(var b=0;2>=b;b++)this.hideOnePlayerAllCards(a,b)},hideOnePlayerAllCards:function(a,b){var c=this.getChildByName("mask_"+a),d="_0_";2===b?d="_1_":1===b&& (d="_2_");for(var c=c.getChildByName("betbox"+d+a),e=0;25>e;e++)c.getChildByName("card_"+a+d+e).setVisible(!1)},hideDealerAllCards:function(){for(var a=0;25>a;a++)this.getChildByName("dealercard_"+a).setVisible(!1)},showDealerStaticCards:function(a,b){this.hideDealerAllCards();for(var c=this._dealercardlist,d=0;d<=a;d++){var e=this.getChildByName("dealercard_"+d);1===b?e.setPosition(GAME_CONFIG.centerX+this._dealer321CardsPos[d][0],GAME_CONFIG.centerY+this._dealer321CardsPos[d][1]):e.setPosition(GAME_CONFIG.centerX+ this._dealer2CardsPos[d][0],GAME_CONFIG.centerY+this._dealer2CardsPos[d][1]);-1===c[d]?(e.setTexture(res.gme_back),e.setScale(0.6)):(e.setTexture(res["gme_card_"+c[d]]),e.setScale(0.95));e.setVisible(!0)}},showOnePlayerStaticCards:function(a,b,c){this.hideOnePlayerAllCards(a,c);var d=this._playercardlist["sid"+a];if(1=c.length)for(var d=this._cardpos_2345.scale,g=this._cardpos_2345.leftpos,h=this._cardpos_2345.rightpos,k=Math.ceil((h[0]-g[0])/4),h=0;h<=b;h++){var m=f.getChildByName("card_"+a+e+h);m.setScale(d);m.setTexture(res["gme_card_"+c[h]]);m.setVisible(!0);m.setPosition(f.width/2+g[0]+k*h,f.height/2+g[1]);h===b&&m.runAction(cc.sequence(cc.scaleTo(0,1.2,1.2),cc.delayTime(0.2),cc.scaleTo(0.2,d,d)))}else for(d=this._cardpos_6_22.scale,h=0;h<=b;h++)m=f.getChildByName("card_"+a+e+h),g=this._cardpos_6_22.pos[h], m.setTexture(res["gme_card_"+c[h]]),m.setPosition(f.width/2+g[0],f.height/2+g[1]),m.setVisible(!0),h===b?m.runAction(cc.sequence(cc.scaleTo(0,1.2,1.2),cc.delayTime(0.1),cc.scaleTo(0.1,d,d))):m.setScale(d);f.setVisible(!0)}else if(c=d[0].cardlist,e=this.getChildByName("mask_"+a),f=e.getChildByName("betbox_0_"+a),e=e.getChildByName("opencard_"+a),f.getPosition(),e.getPosition(),5>=c.length)for(d=this._cardpos_2345.scale,g=this._cardpos_2345.leftpos,h=this._cardpos_2345.rightpos,k=Math.ceil((h[0]-g[0])/ 4),h=0;h<=b;h++)m=f.getChildByName("card_"+a+"_0_"+h),m.setScale(d),m.setTexture(res["gme_card_"+c[h]]),m.setVisible(!0),m.setPosition(f.width/2+g[0]+k*h,f.height/2+g[1]),h===b&&m.runAction(cc.sequence(cc.scaleTo(0,1.2,1.2),cc.delayTime(0.2),cc.scaleTo(0.2,d,d)));else for(d=this._cardpos_6_22.scale,h=0;h<=b;h++)m=f.getChildByName("card_"+a+"_0_"+h),g=this._cardpos_6_22.pos[h],m.setTexture(res["gme_card_"+c[h]]),m.setPosition(f.width/2+g[0],f.height/2+g[1]),m.setVisible(!0),h===b?m.runAction(cc.sequence(cc.scaleTo(0, 1.2,1.2),cc.delayTime(0.1),cc.scaleTo(0.1,d,d))):m.setScale(d)},showOneLicensing:function(a){var b=this.getChildByName("licensing_"+a);b.setToSetupPose();b.clearTracks();b.setAnimation(a,this._licensingAnmIndex[a],!1);b.setVisible(!0)},hideAllSpotLight:function(){for(var a=1;6>a;a++)this.getChildByName("spotlight_"+a).setVisible(!1)},showOneSpotLight:function(a){this.hideAllSpotLight();this.getChildByName("spotlight_"+a).setVisible(!0)},addAvatars:function(){for(var a=this,b=1;6>b;b++){var c=new cc.Sprite(res.gme_vacancy); c.setAnchorPoint(0.5,0.5);c.setPosition(GAME_CONFIG.centerX+this._player_avatar_pos[b-1][0],GAME_CONFIG.centerY+this._player_avatar_pos[b-1][1]);c.setVisible(!0);c.setName("avatar_"+b);this.addChild(c);var d=new cc.Sprite(this._sidlabelres[b-1]);d.setAnchorPoint(0.5,0.5);d.setPosition(c.getPositionX()+100,c.getPositionY());d.setScale(1.5);d.setName("sidlabel_"+b);d.setVisible(!0);this.addChild(d);c=new ccui.Button(res["gme_gold_circle_"+b],res["gme_gold_circle_"+b],res["gme_gold_circle_"+b]);c.setAnchorPoint(0.5, 0.5);c.setPosition(GAME_CONFIG.centerX+this._player_avatar_pos[b-1][0],GAME_CONFIG.centerY+this._player_avatar_pos[b-1][1]);c.setName("mask_"+b);c.setVisible(!0);this.addChild(c);c.addTouchEventListener(function(b,c){if(c===ccui.Widget.TOUCH_ENDED){var d=parseInt(b.getName().split("_")[1]);!1===a._seatplayerflag[d-1]&&(cc.audioEngine.playEffect(res.click,!1),d={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.seat,args:{gsn:USER_INFO.gsn,sid:d}},NKG.GameController.getInstance().sendMsg(COMMAND_ID.game, d))}},this);d=sp.SkeletonAnimation.createWithJsonFile(res.countdown_json,res.countdown_atlas);d.setToSetupPose();d.clearTracks();d.setAnchorPoint(0,0);d.setPosition(c.width/2,c.height/2);d.setName("countdown_"+b);d.setAnimation(0,"countdiwn",!1);d.setVisible(!1);d.setTimeScale(1);d.setScale(1.1);c.addChild(d);d.update(0);d.setAnimationListener(d,function(a,b,c,d,e){c===sp.ANIMATION_EVENT_TYPE.COMPLETE&&b.animation&&a.visible&&a.setVisible(!1)});d=new ccui.Button(res.gme_btn_back_normal,res.gme_btn_back_pressed, res.gme_btn_back_pressed);d.setAnchorPoint(0.5,0.5);d.setPosition(c.width/2+50,c.height/2+46);d.setVisible(!1);d.setName("leaveBtn_"+b);c.addChild(d);d.addTouchEventListener(function(b,c){if(c===ccui.Widget.TOUCH_ENDED){var d=parseInt(b.getName().split("_")[1]);!0===a._seatplayerflag[d-1]&&0===USER_INFO.selfRealBetAmountList[d-1]&&0===USER_INFO.selfInsureBetAmountList[d-1]&&(d={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.leaveseat,args:{gsn:USER_INFO.gsn,sid:d}},NKG.GameController.getInstance().sendMsg(COMMAND_ID.game, d))}},this);var e=new cc.Sprite(res.gme_bet_box);e.setAnchorPoint(0.5,0.5);e.setPosition(c.width/2+123,c.height/2+29);e.setVisible(!1);e.setName("betbox_0_"+b);c.addChild(e);d=new cc.LabelTTF("0","Arial",16);d.setAnchorPoint(1,0.5);d.setPosition(e.width/2+45,e.height/2);d.setColor(cc.color("#ffffff"));d.setString(ADD_COMMA(1E3));d.setName("betamount_0_"+b);d.setVisible(!0);e.addChild(d);d=new cc.Sprite(res.gme_bet_box);d.setAnchorPoint(0.5,0.5);d.setPosition(c.width/2+123,c.height/2+77);d.setVisible(!1); d.setName("betbox_1_"+b);c.addChild(d);var f=new cc.LabelTTF("0","Arial",16);f.setAnchorPoint(1,0.5);f.setPosition(d.width/2+45,d.height/2);f.setColor(cc.color("#ffffff"));f.setString(ADD_COMMA(1E3));f.setName("betamount_1_"+b);f.setVisible(!0);d.addChild(f);f=new cc.Sprite(res.gme_bet_box);f.setAnchorPoint(0.5,0.5);f.setPosition(c.width/2+123,c.height/2-22);f.setVisible(!1);f.setName("betbox_2_"+b);c.addChild(f);var g=new cc.LabelTTF("0","Arial",16);g.setAnchorPoint(1,0.5);g.setPosition(f.width/ 2+45,f.height/2);g.setColor(cc.color("#ffffff"));g.setString(ADD_COMMA(1E3));g.setName("betamount_2_"+b);g.setVisible(!0);f.addChild(g);f=sp.SkeletonAnimation.createWithJsonFile(res.open_card_json,res.open_card_atlas);f.setToSetupPose();f.clearTracks();f.setAnchorPoint(0,0);f.setPosition(c.width/2+116,c.height/2-21);f.setName("opencard_"+b);f.setAnimation(0,"open",!1);f.setVisible(!0);f.setTimeScale(1);c.addChild(f);f.update(0);f.setAnimationListener(f,function(a,b,c,d,e){c===sp.ANIMATION_EVENT_TYPE.COMPLETE&& b.animation&&a.visible&&(b=a.getName(),parseInt(b.split("_")[1]),a.setVisible(!1))});f=new cc.Sprite(res.gme_insurance_black);f.setAnchorPoint(0.5,0.5);f.setPosition(e.width/2+160,e.height/2-32);f.setName("insurebg_"+b);f.setVisible(!1);e.addChild(f,-1);g=new cc.Sprite(res.gme_insurance_cn);g.setAnchorPoint(0.5,0.5);g.setPosition(f.width/2+37,f.height/2+28);g.setName("insure_title");g.setVisible(!0);f.addChild(g);g=new ccui.Button(res.gme_btn_yes_normal,res.gme_btn_yes_pressed,res.gme_btn_yes_pressed); g.setAnchorPoint(0.5,0.5);g.setPosition(f.width/2-5,f.height/2-14);g.setVisible(!0);g.setName("insureYesBtn_"+b);f.addChild(g);g.addTouchEventListener(function(b,c){if(c===ccui.Widget.TOUCH_ENDED&&4005==GAME_STATUS&&!1!==b.visible){var d=parseInt(b.getName().split("_")[1]);a.sendInsureBet(d)}},this);g=new ccui.Button(res.gme_btn_no_normal,res.gme_btn_no_pressed);g.setAnchorPoint(0.5,0.5);g.setPosition(f.width/2+88,f.height/2-14);g.setVisible(!0);g.setName("insureNoBtn_"+b);f.addChild(g);g.addTouchEventListener(function(a, b){b===ccui.Widget.TOUCH_ENDED&&4005==GAME_STATUS&&!1!==a.visible&&(cc.audioEngine.playEffect(res.clickback,!1),a.getParent().setVisible(!1))},this);for(f=0;3>f;f++){for(var g=c.getChildByName("betbox_"+f+"_"+b),h=0;25>h;h++){var k=new cc.Sprite(res.cmn_card_back);k.setAnchorPoint(0.5,0.5);k.setPosition(g.width/2+100,g.height/2+10);k.setName("card_"+b+"_"+f+"_"+h);k.setVisible(!1);g.addChild(k)}h=sp.SkeletonAnimation.createWithJsonFile(res.BJ_button_json,res.BJ_button_atlas);h.setToSetupPose();h.clearTracks(); h.setAnchorPoint(0,0);h.setPosition(g.width/2+this._noticebgpos_2[0],g.height/2+this._noticebgpos_2[1]);h.setName("bjTag_"+b+"_"+f);h.setAnimation(0,"start",!1);h.setVisible(!1);h.setTimeScale(1);g.addChild(h);h.update(0);h.setAnimationListener(h,function(a,b,c,d,e){});h=new cc.Sprite(res.gme_notice_blue);h.setAnchorPoint(0.5,0.5);h.setPosition(g.width/2,g.height/2);h.setVisible(!1);h.setName("pointTag_"+b+"_"+f);g.addChild(h);g=new SW.NumberAtlas(0,res.gme_nbr_points,8,30);g.setAnchorPoint(0.5,0.5); g.setPosition(h.width/2,h.height/2);g.setVisible(!0);g.setName("pointNbr_"+b+"_"+f);g.setNumber(12);h.addChild(g);g=new cc.Sprite(res.gme_bust_small_cn);g.setAnchorPoint(0.5,0.5);g.setPosition(h.width/2,h.height/2);g.setVisible(!0);g.setName("bustTag_"+b+"_"+f);h.addChild(g);0!=f&&(g=sp.SkeletonAnimation.createWithJsonFile(res.rotating_diamond_json,res.rotating_diamond_atlas),g.setToSetupPose(),g.clearTracks(),g.setAnchorPoint(0,0),g.setPosition(h.width/2+50,h.height/2),g.setName("diamond_"+b+"_"+ f),g.setAnimation(0,"animation",!0),g.setVisible(!1),g.setTimeScale(1),h.addChild(g),g.update(0))}c=new cc.Sprite(res.gme_insurance_tag);c.setAnchorPoint(0.5,0.5);c.setPosition(e.width/2+109,e.height/2);c.setVisible(!1);c.setName("insureTag0_"+b);e.addChild(c);e=new cc.LabelTTF("0","Arial",16);e.setAnchorPoint(0,0.5);e.setPosition(c.width/2-13,c.height/2);e.setColor(cc.color("#ffffff"));e.setString(ADD_COMMA(1E5));e.setName("insureAmount0_"+b);e.setVisible(!0);c.addChild(e);c=new cc.Sprite(res.gme_insurance_tag); c.setAnchorPoint(0.5,0.5);c.setPosition(d.width/2+109,d.height/2);c.setVisible(!1);c.setName("insureTag1_"+b);d.addChild(c);d=new cc.LabelTTF("0","Arial",16);d.setAnchorPoint(0,0.5);d.setPosition(c.width/2-13,c.height/2);d.setColor(cc.color("#ffffff"));d.setString(ADD_COMMA(1E5));d.setName("insureAmount1_"+b);d.setVisible(!0);c.addChild(d)}},hideAllInsureTag:function(){for(sid=1;6>sid;sid++)this.getChildByName("mask_"+sid).getChildByName("betbox_0_"+sid).getChildByName("insureTag0_"+sid).setVisible(!1), this.getChildByName("mask_"+sid).getChildByName("betbox_1_"+sid).getChildByName("insureTag1_"+sid).setVisible(!1)},showAllSidLables:function(){for(var a=1;6>a;a++)this.getChildByName("sidlabel_"+a).setVisible(!0)},showOnePlayerInsureTag:function(a,b){var c=this.getChildByName("mask_"+a).getChildByName("betbox_0_"+a).getChildByName("insureTag0_"+a);c.getChildByName("insureAmount0_"+a).setString(ADD_COMMA(b));c.setVisible(!0);c=this.getChildByName("mask_"+a).getChildByName("betbox_1_"+a).getChildByName("insureTag1_"+ a);c.getChildByName("insureAmount1_"+a).setString(ADD_COMMA(b));c.setVisible(!0)},sendInsureBet:function(a){a={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.betinsure,args:{gsn:USER_INFO.gsn,sid:a}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,a)},hideAllInsureButton:function(){for(var a=1;6>a;a++)this.getChildByName("mask_"+a).getChildByName("betbox_0_"+a).getChildByName("insurebg_"+a).setVisible(!1)},hideOneSidInsureBtn:function(a){this.getChildByName("mask_"+a).getChildByName("betbox_0_"+ a).getChildByName("insurebg_"+a).setVisible(!1)},showSelfInsureButton:function(a){for(var b=0;b=a;a++)for(var b=0;2>=b;b++)this.hideOnePlayerPointTag(a,b)},hideOnePlayerPointTag:function(a,b){2===b?b=1:1===b&&(b=2);this.getChildByName("mask_"+a).getChildByName("betbox_"+b+"_"+a).getChildByName("pointTag_"+ a+"_"+b).setVisible(!1)},showPlayerPointTag:function(a,b,c,d){2===b?b=1:1===b&&(b=2);var e=this.getChildByName("mask_"+a).getChildByName("betbox_"+b+"_"+a),f=e.getChildByName("betamount_"+b+"_"+a),g=e.getChildByName("pointTag_"+a+"_"+b),h=g.getChildByName("pointNbr_"+a+"_"+b);a=g.getChildByName("bustTag_"+a+"_"+b);2===c?g.setPosition(e.width/2+this._noticebgpos_2[0],e.height/2+this._noticebgpos_2[1]):3===c?g.setPosition(e.width/2+this._noticebgpos_3[0],e.height/2+this._noticebgpos_3[1]):4===c?g.setPosition(e.width/ 2+this._noticebgpos_4[0],e.height/2+this._noticebgpos_4[1]):5===c?g.setPosition(e.width/2+this._noticebgpos_5[0],e.height/2+this._noticebgpos_5[1]):6<=c&&g.setPosition(e.width/2+this._cardpos_6_22.pos[c-1][0]+65,e.height/2+this._noticebgpos_5[1]);0!==d[1]?(h.setNumber(""+d[0]+"/"+d[1],3),h.setVisible(!0),a.setVisible(!1)):21>=d[0]?(h.setNumber(""+d[0],3),h.setVisible(!0),a.setVisible(!1)):(h.setVisible(!1),a.setVisible(!0),e.setOpacity(0),f.setOpacity(0));g.setVisible(!0)},hideAllBJTagAnm:function(){for(var a= 1;6>a;a++)for(var b=0;3>b;b++){var c=this.getChildByName("mask_"+a).getChildByName("betbox_"+b+"_"+a).getChildByName("bjTag_"+a+"_"+b);c.stopAllActions();c.clearTracks();c.setToSetupPose();c.setVisible(!1)}},showDealingStageBJorNotice:function(a){this.runAction(cc.sequence(cc.delayTime(0.4*(a.length+1)+0.5),cc.callFunc(function(b){for(var c=0;ca;a++){var b=this.getChildByName("mask_"+a);b.getChildByName("betbox_0_"+a).setVisible(!1);b.getChildByName("betbox_1_"+a).setVisible(!1);b.getChildByName("betbox_2_"+a).setVisible(!1)}}, hideOnePlayerAllBetBox:function(a){var b=this.getChildByName("mask_"+a);b.getChildByName("betbox_0_"+a).setVisible(!1);b.getChildByName("betbox_1_"+a).setVisible(!1);b.getChildByName("betbox_2_"+a).setVisible(!1)},hideOnePlayerBetBox0:function(a){this.getChildByName("mask_"+a).getChildByName("betbox_0_"+a).setVisible(!1)},showAllPlayersBet:function(a){for(var b=0;b=a;a++)0<=USER_INFO.selfsidlist.indexOf(a)&&this.getChildByName("mask_"+a).getChildByName("leaveBtn_"+a).setVisible(!0)},showPlayerLeaveBtn:function(a){this.getChildByName("mask_"+a).getChildByName("leaveBtn_"+a).setVisible(!0)},hidePlayerLeaveBtn:function(a){this.getChildByName("mask_"+a).getChildByName("leaveBtn_"+a).setVisible(!1)},hideAllPlayerLeaveBtn:function(){for(var a=1;6>a;a++)this.getChildByName("mask_"+ a).getChildByName("leaveBtn_"+a).setVisible(!1)},showFakeAvatar:function(a){this.getChildByName("avatar_"+a).setTexture(res.gme_vacancy)},showInsureBettime:function(a){this.insurebettime.setVisible(!0);this.insurebettime.setNumber(Math.ceil(a));this._insurebetendtime=(new Date).getTime()+1E3*a;var b=10/this._insuretotalbettimesec;this.insurecdsec.clearTracks();this.insurecdsec.setAnimation(0,"countdiwn",!1);this.insurecdsec.setToSetupPose();this.insurecdsec.setTimeScale(b);this.insurecdsec.setVisible(!0); this.insurecdsec.update(0);this.insurecdsec.update(this._insuretotalbettimesec-a);this._insurebettimeflag=!0},hideInsureBettime:function(){this._insurebettimeflag=!1;this.insurebettime.setVisible(!1);this.insurecdsec.setVisible(!1)},showBettime:function(a){this.bettime.setVisible(!0);this.bettime.setNumber(Math.ceil(a));this._betendtime=(new Date).getTime()+1E3*a;var b=10/this._totalbettimesec;this.selfcdsec.clearTracks();this.selfcdsec.setAnimation(0,"countdiwn",!1);this.selfcdsec.setToSetupPose(); this.selfcdsec.setTimeScale(b);this.selfcdsec.setVisible(!0);this.selfcdsec.update(0);this.selfcdsec.update(this._totalbettimesec-a);this._bettimeflag=!0},hideBettime:function(){this._bettimeflag=!1;this.bettime.setVisible(!1);this.selfcdsec.setVisible(!1)},broadcastEventBettimeZero:function(){var a=new EVENTDATA;a.setEventID(EVENT_ID.betTimeZero);a.setUserData({});var b=new cc.EventCustom(BROADCASTEVENT);b.setUserData(a);cc.eventManager.dispatchEvent(b)},update:function(a){if(this._bettimeflag){a= new Date;a=a.getTime();a=(this._betendtime-a)/1E3;if(0>=a){this.hideBettime();this.broadcastEventBettimeZero();return}this.bettime.setNumber(Math.ceil(a))}this._insurebettimeflag&&(a=new Date,a=a.getTime(),a=(this._insurebetendtime-a)/1E3,0>=a?this.hideInsureBettime():this.insurebettime.setNumber(Math.ceil(a)))},setSelfAvatar:function(){this.avatar.setTexture(res["avatar_"+USER_INFO.avatar])},setMinMaxBetNbr:function(){var a=USER_INFO.maxbet;this.minbet_nbr.setNumber(ADD_COMMA(USER_INFO.minbet)); this.maxbet_nbr.setNumber(ADD_COMMA(a))},setPlayerSidInfo:function(a){a=a.sidinfo;for(var b=0;5>b;b++){var c=this.getChildByName("avatar_"+(b+1)),d=this.getChildByName("sidlabel_"+(b+1));0===Object.keys(a[b]).length?(this._seatplayerflag[b]=!1,c.setTexture(res.gme_vacancy),d.setVisible(!0)):(this._seatplayerflag[b]=!0,c.setTexture(res["avatar_"+a[b].avatar]),d.setVisible(!1))}},updatePlayerTakeSeat:function(a){var b=a.avatar;a=a.sid;this.getChildByName("avatar_"+a).setTexture(res["avatar_"+b]);this.getChildByName("sidlabel_"+ a).setVisible(!1)},updatePlayerLeaveSeat:function(a){for(var b=0;ba;a++){var b=this.getChildByName("mask_"+a).getChildByName("countdown_"+a);b.clearTracks();b.setToSetupPose();b.setVisible(!1)}},showPlayerhitStandCountDown:function(a){var b=a.sid;a=a.cdsec;b=this.getChildByName("mask_"+b).getChildByName("countdown_"+b);b.clearTracks();b.setToSetupPose();b.setAnimation(0,"countdiwn",!1);b.setVisible(!0);b.setTimeScale(10/a);b.update(0)},updateSelfBalance:function(){this.balance.runAction(cc.sequence(cc.callFunc(function(a){a.setNumber(ADD_COMMA(USER_INFO.gamecredit))}), cc.scaleTo(0.1,1.3,1.3),cc.delayTime(0.1),cc.scaleTo(0.1,1,1)))},dealPlayerHitCard:function(a,b,c,d,e,f){var g=this;c=this.getChildByName("licensing_"+a);var h=this.getChildByName("mask_"+a).getChildByName("opencard_"+a),k=0,k=0===b?0:1+e;this.hideOnePlayerPointTag(a,k);c.runAction(cc.sequence(cc.callFunc(function(b){b.clearTracks();b.setToSetupPose();b.setAnimation(0,g._licensingAnmIndex[a],!1);b.setVisible(!0);b.update(0)})));h.runAction(cc.sequence(cc.delayTime(0.4),cc.callFunc(function(a){a.clearTracks(); a.setToSetupPose();a.setAnimation(0,"open",!1);a.setVisible(!0);a.update(0)})));this.runAction(cc.sequence(cc.delayTime(0.7),cc.callFunc(function(b){b.showOnePlayerStaticCards(a,d.length-1,k)}),cc.delayTime(0.2),cc.callFunc(function(b){b.showPlayerPointTag(a,k,d.length,f)})))},showPlayerLoseChipAnm:function(a,b){var c=this.getChildByName("mask_"+a).getChildByName("betbox_"+b+"_"+a),d=this.getChildByName("mask_"+a),e=cc.p(d.getPosition().x+c.getPosition().x-d.width/2,d.getPosition().y+c.getPosition().y- d.height/2),c=cc.p(730,640);this.getChildByName("playerloosechip_"+a).runAction(cc.sequence(cc.delayTime(1),cc.callFunc(function(a){cc.audioEngine.playEffect(res.collectcoin,!1);a.setPosition(e.x,e.y);a.setScale(0.6);a.setVisible(!0)}),cc.moveTo(0.3,c),cc.delayTime(0.3),cc.callFunc(function(a){a.setVisible(!1)})))},showOnePlayerSplitAnm:function(a){var b=this,c=this._playercardlist["sid"+a],d=c[0].point,e=c[1].point,c=this.getChildByName("mask_"+a),f=this.getChildByName("mask_"+a).getChildByName("betbox_1_"+ a),g=this.getChildByName("mask_"+a).getChildByName("betbox_2_"+a),h=f.getChildByName("betamount_1_"+a),k=g.getChildByName("betamount_2_"+a);f.setOpacity(255);g.setOpacity(255);h.setOpacity(255);k.setOpacity(255);this.showOnePlayerStaticCards(a,0,1);this.showOnePlayerStaticCards(a,0,2);c.runAction(cc.sequence(cc.callFunc(function(a){a=parseInt(a.getName().split("_")[1]);b.showOneLicensing(a);cc.audioEngine.playEffect(res.dealcard,!1)}),cc.delayTime(0.3333),cc.callFunc(function(a){a=parseInt(a.getName().split("_")[1]); b.showOneLicensing(a);cc.audioEngine.playEffect(res.dealcard,!1)}),cc.callFunc(function(a){a=parseInt(a.getName().split("_")[1]);b.showOpenCardAnm(a)}),cc.delayTime(0.24),cc.callFunc(function(a){a=parseInt(a.getName().split("_")[1]);b.showOnePlayerStaticCards(a,1,1);99===d[0]?b.showBJTagAnm(a,1):b.showPlayerPointTag(a,1,2,d)}),cc.delayTime(0.1),cc.callFunc(function(a){a=parseInt(a.getName().split("_")[1]);b.showOpenCardAnm(a)}),cc.delayTime(0.24),cc.callFunc(function(a){a=parseInt(a.getName().split("_")[1]); b.showOnePlayerStaticCards(a,1,2);99===e[0]?b.showBJTagAnm(a,2):b.showPlayerPointTag(a,2,2,e)})))},showDealerHitStandAnm:function(a,b){a=this._dealercardlist;this.showDealerStaticCards(0,1);this.showDealerStaticCards(1,1);for(var c=2;c=c?1:11>=c?2:3)},this,c)))},getPointList:function(a){for(var b=[2,3,4,5,6,7,8,9,10,10,10,10,1,2,3,4,5,6,7,8,9,10,10,10,10,1,2,3,4,5,6,7,8,9,10,10,10,10,1,2,3,4,5,6,7,8,9,10,10,10,10,1],c=0,d=0,e=0;eb;b++){this.getChildByName("mask_"+b).getChildByName("betbox_0_"+b).getChildByName("insurebg_"+b).getChildByName("insure_title").setTexture(res["gme_insurance_"+a]);for(var c=0;3>c;c++)this.getChildByName("mask_"+b).getChildByName("betbox_"+c+"_"+b).getChildByName("pointTag_"+b+"_"+ c).getChildByName("bustTag_"+b+"_"+c).setTexture(res["gme_bust_small_"+a])}},setRoomID:function(){var a=GAME_CONFIG.version+" "+USER_INFO.tableId;""!==USER_INFO.gsn&&void 0!==USER_INFO.gsn&&(a=a+" "+USER_INFO.gsn);this._room.setString(a)}});var Ly_Loading=cc.Layer.extend({_loadProgress:50,_startProgress:50,_finishProgress:50,_endProgress:100,_time:0,_displayTime:1,_loadingFinish:!1,ctor:function(){cc.log("Ly_Loading ctor");this._super();this._time=Math.ceil(this._loadProgress/this._endProgress*100);var a=new cc.Sprite(res.lod_bg);a.setAnchorPoint(0,0);a.setPosition(0,0);this.addChild(a);a=new cc.Sprite(res.lod_loading_box_1);a.setAnchorPoint(0.5,0.5);a.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-283);this.addChild(a);this.lod_loading_bar= new cc.Sprite(res.lod_loading_bar);this.lod_loading_bar.setAnchorPoint(0,0.5);this.lod_loading_bar.setPosition(GAME_CONFIG.centerX-334,GAME_CONFIG.centerY-283);this.lod_loading_bar.setScaleX(0.5);this.addChild(this.lod_loading_bar);a=new cc.Sprite(res.lod_loading_box_0);a.setAnchorPoint(0.5,0.5);a.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-283);this.addChild(a);this._label=new cc.LabelTTF("0%","Arial",26);this._label.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-283);this._label.setColor(cc.color("#ffffff")); this.addChild(this._label,10);a=new ccui.Text("Loading...","Arial",26);a.setAnchorPoint(0.5,0.5);a.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-329);a.setColor(cc.color("#ffffff"));this.addChild(a);a=new ccui.Text("v"+GAME_CONFIG.version,"Arial",16);a.setAnchorPoint(0.5,0.5);a.setPosition(GAME_CONFIG.centerX+568,GAME_CONFIG.centerY-338);a.setColor(cc.color("#ffffff"));this.addChild(a);this.scheduleUpdate();return!0},update:function(a){this._loadProgress>=this._startProgress&&this._loadProgress<= this._finishProgress&&(this._time+=a,a=Math.ceil(this._time/this._displayTime*100),athis._finishProgress&&(a=this._finishProgress),this._loadProgress>=this._endProgress&&a>=this._endProgress&&(this.unscheduleUpdate(),this.setLoadingFinish()),this._loadProgress++,this._loadProgress>a&&(this._loadProgress=a),this.lod_loading_bar.setScaleX(this._loadProgress/100),this._label.setString(this._loadProgress+"%"))},setLoadingFinish:function(){var a=this;this.scheduleOnce(function(){a._loadingFinish= !0},0.5)},getLoadingisFinish:function(){return this._loadingFinish},setFinishProgress:function(a,b){this._finishProgress=Math.ceil(a/b*50)+50}});var Ly_Lobby=cc.Layer.extend({_selecthallid:0,_incashbtn_xy:[[0,180],[0,26],[0,-128],[0,-282]],ctor:function(){cc.log("Ly_Lobby ctor");this._super();var a=this,b=new cc.Sprite(res.hal_bg);b.setAnchorPoint(0,0);b.setPosition(0,0);b.setVisible(!0);this.addChild(b);b=sp.SkeletonAnimation.createWithJsonFile(res.hal_logo_bg_json,res.hal_logo_bg_atlas);b.setAnchorPoint(0,0);b.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);b.setToSetupPose();b.clearTracks();b.setAnimation(0,"animation",!0);b.setVisible(!0); this.addChild(b);b.update(0);b=new cc.Sprite(res.hal_flag_box_0);b.setAnchorPoint(0.5,0.5);b.setPosition(GAME_CONFIG.centerX-280,GAME_CONFIG.centerY+399);this.addChild(b,10);this._hal_flag=new ccui.Button(res.hal_flag_0,res.hal_flag_0,res.hal_flag_0);this._hal_flag.addTouchEventListener(function(b,d){d===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.click,!1),a._hal_flag_disable.setVisible(!0),a._hal_flag_box_1.setVisible(!0),a._hal_flag.setEnabled(!1))},this);this._hal_flag.setAnchorPoint(0.5, 0.5);this._hal_flag.setPosition(GAME_CONFIG.centerX-280,GAME_CONFIG.centerY+399);this.addChild(this._hal_flag,10);this._hal_flag_disable=new cc.Sprite(res.hal_flag_disable);this._hal_flag_disable.setAnchorPoint(0.5,0.5);this._hal_flag_disable.setPosition(GAME_CONFIG.centerX-280,GAME_CONFIG.centerY+399);this._hal_flag_disable.setVisible(!1);this.addChild(this._hal_flag_disable,10);this._hal_flag_box_1=new cc.Sprite(res.hal_flag_box_1);this._hal_flag_box_1.setAnchorPoint(0.5,0.5);this._hal_flag_box_1.setPosition(b.width/ 2,b.height/2-97);this._hal_flag_box_1.setVisible(!1);b.addChild(this._hal_flag_box_1);this._scrollView_flag=new ccui.ScrollView;this._scrollView_flag.setDirection(ccui.ScrollView.DIR_VERTICAL);this._scrollView_flag.setTouchEnabled(!0);this._scrollView_flag.setBounceEnabled(!0);this._scrollView_flag.setContentSize(cc.size(100,192));this._scrollView_flag.setInnerContainerSize(cc.size(100,192));this._scrollView_flag.setAnchorPoint(0.5,0);this._scrollView_flag.setPosition(this._hal_flag_box_1.width/2, 3);this._scrollView_flag.setScrollBarColor(cc.color(255,255,255,255));this._scrollView_flag.setScrollBarWidth(0);this._scrollView_flag.setScrollBarOpacity(255);this._scrollView_flag.setScrollBarAutoHideEnabled(!0);this._hal_flag_box_1.addChild(this._scrollView_flag);for(b=0;3>b;b++)this.setFlagBtn(b);this.avatar=new cc.Sprite(res.avatar_01);this.avatar.setAnchorPoint(0.5,0.5);this.avatar.setPosition(GAME_CONFIG.centerX-143,GAME_CONFIG.centerY+392);this.avatar.setScale(0.9);this.avatar.setVisible(!0); this.addChild(this.avatar);this.hal_bg1=new cc.Sprite(res.hal_bg1);this.hal_bg1.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-90);this.hal_bg1.setAnchorPoint(0.5,0.5);this.hal_bg1.setVisible(!0);this.addChild(this.hal_bg1);this.credit=new SW.NumberAtlas(0,res.gme_nbr_total,9,32);this.credit.setAnchorPoint(1,0.5);this.credit.setPosition(GAME_CONFIG.centerX+177,GAME_CONFIG.centerY+391);this.credit.setVisible(!0);this.credit.setNumber(ADD_COMMA(0));this.addChild(this.credit);this.hal_btn_history= new ccui.Button(res.hal_btn_history_normal,res.hal_btn_history_pressed,res.hal_btn_history_normal);this.hal_btn_history.addTouchEventListener(function(a,b){b===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.click,!1),window.open(USER_INFO.historyurl+"\x26lang\x3d"+LANGUAGE[GAME_CONFIG.language]))},this);this.hal_btn_history.setAnchorPoint(0.5,0.5);this.hal_btn_history.setPosition(GAME_CONFIG.centerX+277,GAME_CONFIG.centerY+398);this.addChild(this.hal_btn_history);this._versionlb=new cc.LabelTTF("0.0.0", "Arial",30);this._versionlb.setAnchorPoint(0,0.5);this._versionlb.setPosition(GAME_CONFIG.centerX+236,GAME_CONFIG.centerY-580);this._versionlb.setColor(cc.color("#ffffff"));this._versionlb.setString(GAME_CONFIG.version);this.addChild(this._versionlb);b=sp.SkeletonAnimation.createWithJsonFile(res.room_button_0_json,res.room_button_0_atlas);b.setAnchorPoint(0,0);b.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY+181);b.setToSetupPose();b.clearTracks();b.setAnimation(0,"button_0",!0);b.setSkin("cn"); b.setVisible(!0);b.setName("room_0");b.update(0);this.addChild(b);b=sp.SkeletonAnimation.createWithJsonFile(res.room_button_1_json,res.room_button_1_atlas);b.setAnchorPoint(0,0);b.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-18);b.setToSetupPose();b.clearTracks();b.setAnimation(0,"button_0",!0);b.setSkin("cn");b.setName("room_1");b.setVisible(!0);b.update(-0.2);this.addChild(b);b=sp.SkeletonAnimation.createWithJsonFile(res.room_button_2_json,res.room_button_2_atlas);b.setAnchorPoint(0,0);b.setPosition(GAME_CONFIG.centerX, GAME_CONFIG.centerY-217);b.setToSetupPose();b.clearTracks();b.setAnimation(0,"button_0",!0);b.setSkin("cn");b.setName("room_2");b.setVisible(!0);b.update(-0.4);this.addChild(b);b=sp.SkeletonAnimation.createWithJsonFile(res.room_button_3_json,res.room_button_3_atlas);b.setAnchorPoint(0,0);b.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-416);b.setToSetupPose();b.clearTracks();b.setAnimation(0,"button_0",!0);b.setSkin("cn");b.setVisible(!0);b.setName("room_3");b.update(-0.6);this.addChild(b);this.hal_button_0= new ccui.Button(res.hal_btn_0,res.hal_btn_0,res.hal_btn_0);this.hal_button_0.setAnchorPoint(0.5,0.5);this.hal_button_0.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY+181);this.hal_button_0.setOpacity(0);this.hal_button_0.setVisible(!0);this.hal_button_0.setName("btn_0");this.addChild(this.hal_button_0);this.hal_button_0.addTouchEventListener(function(a,b){if(b===ccui.Widget.TOUCH_ENDED){cc.audioEngine.playEffect(res.clickback,!1);a.setOpacity(0);var e={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.enterTable, args:{hallid:1}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,e)}else b===ccui.Widget.TOUCH_BEGAN?a.setOpacity(120):b===ccui.Widget.TOUCH_CANCELED&&a.setOpacity(0)},this);b=new SW.NumberAtlas(0,res.gme_nbr_allowed,11,38);b.setAnchorPoint(0.5,0.5);b.setPosition(this.hal_button_0.width/2+176,this.hal_button_0.height/2-23);b.setVisible(!0);b.setName("btn_0_nbr");b.setNumber(GET_KMBT_NUM(10)+"/"+GET_KMBT_NUM(1E5),2);this.hal_button_0.addChild(b);this.hal_button_1=new ccui.Button(res.hal_btn_1, res.hal_btn_1,res.hal_btn_1);this.hal_button_1.setAnchorPoint(0.5,0.5);this.hal_button_1.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-18);this.hal_button_1.setOpacity(0);this.hal_button_1.setVisible(!0);this.hal_button_1.setName("btn_1");this.addChild(this.hal_button_1);this.hal_button_1.addTouchEventListener(function(a,b){if(b===ccui.Widget.TOUCH_ENDED){cc.audioEngine.playEffect(res.clickback,!1);a.setOpacity(0);var e={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.enterTable,args:{hallid:2}}; NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,e)}else b===ccui.Widget.TOUCH_BEGAN?a.setOpacity(120):b===ccui.Widget.TOUCH_CANCELED&&a.setOpacity(0)},this);b=new SW.NumberAtlas(0,res.gme_nbr_allowed,11,38);b.setAnchorPoint(0.5,0.5);b.setPosition(this.hal_button_0.width/2+176,this.hal_button_0.height/2-23);b.setVisible(!0);b.setName("btn_1_nbr");b.setNumber(GET_KMBT_NUM(10)+"/"+GET_KMBT_NUM(1E5),2);this.hal_button_1.addChild(b);this.hal_button_2=new ccui.Button(res.hal_btn_2,res.hal_btn_2, res.hal_btn_2);this.hal_button_2.setAnchorPoint(0.5,0.5);this.hal_button_2.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-217);this.hal_button_2.setOpacity(0);this.hal_button_2.setVisible(!0);this.hal_button_2.setName("btn_2");this.addChild(this.hal_button_2);this.hal_button_2.addTouchEventListener(function(a,b){if(b===ccui.Widget.TOUCH_ENDED){cc.audioEngine.playEffect(res.clickback,!1);a.setOpacity(0);var e={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.enterTable,args:{hallid:3}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game, e)}else b===ccui.Widget.TOUCH_BEGAN?a.setOpacity(120):b===ccui.Widget.TOUCH_CANCELED&&a.setOpacity(0)},this);b=new SW.NumberAtlas(0,res.gme_nbr_allowed,11,38);b.setAnchorPoint(0.5,0.5);b.setPosition(this.hal_button_0.width/2+176,this.hal_button_0.height/2-23);b.setVisible(!0);b.setName("btn_2_nbr");b.setNumber(GET_KMBT_NUM(10)+"/"+GET_KMBT_NUM(1E5),2);this.hal_button_2.addChild(b);this.hal_button_3=new ccui.Button(res.hal_btn_3,res.hal_btn_3,res.hal_btn_3);this.hal_button_3.setAnchorPoint(0.5,0.5); this.hal_button_3.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-416);this.hal_button_3.setOpacity(0);this.hal_button_3.setVisible(!0);this.hal_button_3.setName("btn_3");this.addChild(this.hal_button_3);this.hal_button_3.addTouchEventListener(function(a,b){if(b===ccui.Widget.TOUCH_ENDED){cc.audioEngine.playEffect(res.clickback,!1);a.setOpacity(0);var e={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.enterTable,args:{hallid:4}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,e)}else b=== ccui.Widget.TOUCH_BEGAN?a.setOpacity(120):b===ccui.Widget.TOUCH_CANCELED&&a.setOpacity(0)},this);b=new SW.NumberAtlas(0,res.gme_nbr_allowed,11,38);b.setAnchorPoint(0.5,0.5);b.setPosition(this.hal_button_0.width/2+176,this.hal_button_0.height/2-23);b.setVisible(!0);b.setName("btn_3_nbr");b.setNumber(GET_KMBT_NUM(10)+"/"+GET_KMBT_NUM(1E5),2);this.hal_button_3.addChild(b);return!0},setFlagBtn:function(a){var b=new ccui.Button(res["hal_flag_"+a],res["hal_flag_"+a],res["hal_flag_"+a]);b.addTouchEventListener(function(b, d){d===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.click,!1),NKG.GameController.getInstance().setLanguage(a))},this);b.setAnchorPoint(0.5,1);b.setPosition(this._hal_flag_box_1.width/2,192-63*a);this._scrollView_flag.addChild(b)},setPlayerCredit:function(){this.credit.setNumber(ADD_COMMA(USER_INFO.credit))},setMinMaxNbr:function(){for(var a=USER_INFO.tablelist,b=0;4>b;b++){var c=a[b].minbet,d=a[b].maxbet;this.getChildByName("btn_"+b).getChildByName("btn_"+b+"_nbr").setNumber(GET_KMBT_NUM(c)+ "/"+GET_KMBT_NUM(d),2)}},handleBroadcast:function(a){switch(a._eventId){case EVENT_ID.login:this.setPlayerCredit();this.setLanguage();this.setMinMaxNbr();break;case EVENT_ID.setLanguage:this.setLanguage();break;case EVENT_ID.goToLobby:this.setPlayerCredit();break;case EVENT_ID.updatebalance:this.setPlayerCredit()}},setLanguage:function(){var a=LANGUAGE[GAME_CONFIG.language];this._hal_flag.setEnabled(!0);this._hal_flag_box_1.setVisible(!1);this._hal_flag_disable.setVisible(!1);this._hal_flag.loadTextures(res["hal_flag_"+ GAME_CONFIG.language],res["hal_flag_"+GAME_CONFIG.language],res["hal_flag_"+GAME_CONFIG.language]);for(var b=0;4>b;b++)this.getChildByName("room_"+b).setSkin(a)}});var Ly_Message=cc.Layer.extend({ctor:function(){cc.log("Ly_Message ctor");this._super();this._gme_restrict_area_box=new cc.Sprite(res.gme_black1pixel);this._gme_restrict_area_box.setAnchorPoint(0.5,0.5);this._gme_restrict_area_box.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY+250);this._gme_restrict_area_box.setScaleY(200);this._gme_restrict_area_box.setScaleX(720);this._gme_restrict_area_box.setOpacity(210);this._gme_restrict_area_box.setVisible(!1);this.addChild(this._gme_restrict_area_box); this._gme_restrict_area_msg=new ccui.Text("Restrict Area, connect failed !!\r\n\u9650\u5236\u533a\u57df\u65e0\u6cd5\u8fde\u7ebf","Arial",36);this._gme_restrict_area_msg.setAnchorPoint(0.5,0.5);this._gme_restrict_area_msg.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY+250);this._gme_restrict_area_msg.setColor(cc.color("#ffffff"));this._gme_restrict_area_msg.setVisible(!1);this.addChild(this._gme_restrict_area_msg);this._gme_disconnect_box=new cc.Sprite(res.gme_black1pixel);this._gme_disconnect_box.setAnchorPoint(0.5, 0.5);this._gme_disconnect_box.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);this._gme_disconnect_box.setScaleY(300);this._gme_disconnect_box.setScaleX(720);this._gme_disconnect_box.setOpacity(210);this._gme_disconnect_box.setVisible(!1);this.addChild(this._gme_disconnect_box);this._gme_disconnect_msg=new ccui.Text("\u5df2\u65ad\u7ebf !! \u8bf7\u91cd\u65b0\u767b\u5165 !!\r\n\r\n\u0e01\u0e32\u0e23\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e15\u0e48\u0e2d\u0e16\u0e39\u0e01\u0e15\u0e31\u0e14\u0e02\u0e32\u0e14\r\n\u0e01\u0e23\u0e38\u0e13\u0e32\u0e40\u0e02\u0e49\u0e32\u0e2a\u0e39\u0e48\u0e23\u0e30\u0e1a\u0e1a\u0e2d\u0e35\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07 !!\r\n\r\nDisconnected !! , Please re-login !!", "Arial",36);this._gme_disconnect_msg.setAnchorPoint(0.5,0.5);this._gme_disconnect_msg.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);this._gme_disconnect_msg.setColor(cc.color("#ffffff"));this._gme_disconnect_msg.setVisible(!1);this.addChild(this._gme_disconnect_msg);this._emptyframe=new ccui.Button(res.gme_bg_0,res.gme_bg_0,res.gme_bg_0);this._emptyframe.setAnchorPoint(0.5,0.5);this._emptyframe.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);this._emptyframe.setRotation(0);this._emptyframe.setOpacity(0); this._emptyframe.setVisible(!1);this.addChild(this._emptyframe);this.scheduleUpdate();return!0},setLanguage:function(){},handleBroadcast:function(a){switch(a._eventId){case EVENT_ID.loginError:2==a._userData.data.result&&this.showRestrictAreaMsg();break;case EVENT_ID.enterTable:this.setLanguage();break;case EVENT_ID.setLanguage:this.setLanguage();break;case EVENT_ID.showGameInfoMsg:case EVENT_ID.enterTableError:this.showGameInfoMsg(a._userData);break;case EVENT_ID.maxminbeterror:this.showGameInfoMsg(a._userData); break;case EVENT_ID.ws_closed:this.showDisconnectMsg();break;case EVENT_ID.bebankered:this.showGameInfoMsg(a._userData)}},showGameInfoMsg:function(a){cc.audioEngine.playEffect(res.clickerror,!1)},showRestrictAreaMsg:function(){this._gme_restrict_area_box.setVisible(!0);this._gme_restrict_area_msg.setVisible(!0)},showDisconnectMsg:function(){USER_INFO.volumeswitch=0;cc.audioEngine.setEffectsVolume(0);cc.audioEngine.setMusicVolume(0);this._gme_disconnect_msg.setVisible(!0);this._gme_disconnect_box.setVisible(!0); this._emptyframe.setVisible(!0)},hideDisconnectMsg:function(){this._gme_disconnect_msg.setVisible(!1);this._gme_disconnect_box.setVisible(!1);this._emptyframe.setVisible(!1)}});var Ly_TopUI=cc.Layer.extend({_incashbtn_xy:[[0,180],[0,26],[0,-128],[0,-282]],_soundflag:!0,ctor:function(){cc.log("Ly_TopUI ctor");this._super();var a=this;this.menu_bg=new cc.Sprite(res.gme_btn_setting_box);this.menu_bg.setAnchorPoint(0.5,0.5);this.menu_bg.setPosition(GAME_CONFIG.centerX+310,GAME_CONFIG.centerY+411);this.menu_bg.setVisible(!1);this.addChild(this.menu_bg);this.button_menu=new ccui.Button(res.gme_btn_setting_normal,res.gme_btn_setting_pressed,res.gme_btn_setting_pressed);this.button_menu.setAnchorPoint(0.5, 0.5);this.button_menu.setPosition(GAME_CONFIG.centerX+310,GAME_CONFIG.centerY+596);this.button_menu.setVisible(!0);this.addChild(this.button_menu);this.button_menu.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.click,!1),a.menu_bg.setVisible(!a.menu_bg.visible))},this);this.gme_btn_audio=new ccui.Button(res.gme_btn_audio_normal,res.gme_btn_audio_pressed,res.gme_btn_audio_pressed);this.gme_btn_audio.setAnchorPoint(0.5,0.5);this.gme_btn_audio.setPosition(this.menu_bg.width/ 2,this.menu_bg.height/2+98);this.gme_btn_audio.setVisible(!0);this.gme_btn_audio.setName("btn_auido");this.menu_bg.addChild(this.gme_btn_audio);this.gme_btn_audio.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(a._soundflag?(a.gme_btn_audio.loadTextures(res.gme_btn_mute_normal,res.gme_btn_mute_pressed,res.gme_btn_mute_pressed),cc.audioEngine.setMusicVolume(0),cc.audioEngine.setEffectsVolume(0),USER_INFO.volumeswitch=0):(cc.audioEngine.playEffect(res.click,!1),a.gme_btn_audio.loadTextures(res.gme_btn_audio_normal, res.gme_btn_audio_pressed,res.gme_btn_audio_pressed),cc.audioEngine.setMusicVolume(1),cc.audioEngine.setEffectsVolume(1),USER_INFO.volumeswitch=1),a._soundflag=!a._soundflag)},this);this.gme_btn_home=new ccui.Button(res.gme_btn_hall_normal,res.gme_btn_hall_pressed,res.gme_btn_hall_pressed);this.gme_btn_home.setAnchorPoint(0.5,0.5);this.gme_btn_home.setPosition(this.menu_bg.width/2,this.menu_bg.height/2+10);this.gme_btn_home.setVisible(!0);this.menu_bg.addChild(this.gme_btn_home);this.gme_btn_home.addTouchEventListener(function(b, c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.clickback,!1),a.gotoLobby())},this);this.gme_btn_help=new ccui.Button(res.gme_btn_help_normal,res.gme_btn_help_pressed,res.gme_btn_help_pressed);this.gme_btn_help.setAnchorPoint(0.5,0.5);this.gme_btn_help.setPosition(this.menu_bg.width/2,this.menu_bg.height/2-78);this.gme_btn_help.setVisible(!0);this.menu_bg.addChild(this.gme_btn_help);this.gme_btn_help.addTouchEventListener(function(a,c){if(c===ccui.Widget.TOUCH_ENDED){cc.audioEngine.playEffect(res.click, !1);var d=EVENT_ID.openhelpUI;NKG.GameController.getInstance().dispatchEvent(d,"")}},this);return!0},hideMenuBtn:function(){this.menu_bg.setVisible(!1)},handleBroadcast:function(a){switch(a._eventId){case EVENT_ID.login:this.setLanguage();break;case EVENT_ID.setLanguage:this.setLanguage();break;case EVENT_ID.goToLobby:this.hideMenuBtn()}},gotoLobby:function(){var a={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.goToLobby,args:{}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,a)},setLanguage:function(){}});var Ly_HelpUI=cc.Layer.extend({_page:0,ctor:function(){cc.log("Ly_HelpUI ctor");this._super();var a=this;this._helpblackbg=new ccui.Button(res.gme_black1pixel,res.gme_black1pixel,res.gme_black1pixel);this._helpblackbg.setAnchorPoint(0.5,0.5);this._helpblackbg.setPosition(cc.winSize.width/2,cc.winSize.height/2);this._helpblackbg.setScaleX(cc.winSize.width);this._helpblackbg.setScaleY(cc.winSize.height);this._helpblackbg.setOpacity(150);this._helpblackbg.setVisible(!1);this.addChild(this._helpblackbg); this._helpblackbg.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.clickback,!1),a.closeHelp())},this);this._help_bg=new ccui.Button(res.gme_help_btn,res.gme_help_btn,res.gme_help_btn);this._help_bg.setAnchorPoint(0.5,0.5);this._help_bg.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY+523);this._help_bg.setVisible(!1);this.addChild(this._help_bg);this._help_bg.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.clickback, !1),a.closeHelp())},this);this._help_0=new ccui.Button(res.gme_help_bg_1_cn,res.gme_help_bg_1_cn,res.gme_help_bg_1_cn);this._help_0.setAnchorPoint(0.5,0.5);this._help_0.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);this._help_0.setVisible(!1);this.addChild(this._help_0);this._help_0.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.clickback,!1),a.closeHelp())},this);this._help_1=new ccui.Button(res.gme_help_bg_2_cn,res.gme_help_bg_2_cn,res.gme_help_bg_2_cn); this._help_1.setAnchorPoint(0.5,0.5);this._help_1.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);this._help_1.setVisible(!1);this.addChild(this._help_1);this._help_1.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.clickback,!1),a.closeHelp())},this);this._help_l_btn=new ccui.Button(res.gme_btn_arrow_l_normal,res.gme_btn_arrow_l_pressed,res.gme_btn_arrow_l_pressed);this._help_l_btn.setAnchorPoint(0.5,0.5);this._help_l_btn.setPosition(GAME_CONFIG.centerX- 324,GAME_CONFIG.centerY);this._help_l_btn.setVisible(!1);this.addChild(this._help_l_btn);this._help_l_btn.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.click,!1),a.changePage(-1))},this);this._help_r_btn=new ccui.Button(res.gme_btn_arrow_r_normal,res.gme_btn_arrow_r_pressed,res.gme_btn_arrow_r_pressed);this._help_r_btn.setAnchorPoint(0.5,0.5);this._help_r_btn.setPosition(GAME_CONFIG.centerX+324,GAME_CONFIG.centerY);this._help_r_btn.setVisible(!1); this.addChild(this._help_r_btn);this._help_r_btn.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&&(cc.audioEngine.playEffect(res.click,!1),a.changePage(1))},this)},changePage:function(a){this._page+=a;this._page=Math.abs(this._page)%2;0===this._page?(this._help_0.setVisible(!0),this._help_1.setVisible(!1)):(this._help_0.setVisible(!1),this._help_1.setVisible(!0))},openHelp:function(){this._page=0;this._helpblackbg.setVisible(!0);this._help_bg.setVisible(!0);this._help_0.setVisible(!0); this._help_1.setVisible(!1);this._help_l_btn.setVisible(!0);this._help_r_btn.setVisible(!0)},closeHelp:function(){this._help_bg.setVisible(!1);this._helpblackbg.setVisible(!1);this._help_0.setVisible(!1);this._help_1.setVisible(!1);this._help_l_btn.setVisible(!1);this._help_r_btn.setVisible(!1)},update:function(a){},handleBroadcast:function(a){switch(a._eventId){case EVENT_ID.login:this.setLanguage();break;case EVENT_ID.setLanguage:this.setLanguage();break;case EVENT_ID.openhelpUI:this.openHelp()}}, setLanguage:function(){var a=LANGUAGE[GAME_CONFIG.language];this._help_0.loadTextures(res["gme_help_bg_1_"+a],res["gme_help_bg_1_"+a],res["gme_help_bg_1_"+a]);this._help_1.loadTextures(res["gme_help_bg_2_"+a],res["gme_help_bg_2_"+a],res["gme_help_bg_2_"+a])}});var Ly_BottomUI=cc.Layer.extend({_chippos:[[10,166],[10,44],[10,-78],[10,-200]],_chipSelected:0,_tempBetAmount:[0,0,0,0,0],_realBetAmount:[0,0,0,0,0],_bet_circle_pos:[[21,-326],[-97,-186],[-144,18],[-97,224],[21,365]],ctor:function(){cc.log("Ly_bottomUI ctor");this._super();var a=this;this.button_bg=new cc.Sprite(res.gme_choose_box);this.button_bg.setAnchorPoint(0.5,0.5);this.button_bg.setPosition(GAME_CONFIG.centerX+298,GAME_CONFIG.centerY-348);this.button_bg.setVisible(!1);this.addChild(this.button_bg); this.btn_hit=new ccui.Button(res.gme_btn_hit_normal_cn,res.gme_btn_hit_pressed_cn,res.gme_btn_hit_pressed_cn);this.btn_hit.setAnchorPoint(0.5,0.5);this.btn_hit.setPosition(this.button_bg.width/2+10,this.button_bg.height/2+166);this.btn_hit.setVisible(!0);this.button_bg.addChild(this.btn_hit);this.btn_hit.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED?(a.hideFunctionBtn(),4006===GAME_STATUS&&-1!==USER_INFO.selfsidlist.indexOf(USER_INFO.hitsid)&&(cc.audioEngine.playEffect(res.click, !1),a.sendHit())):c===ccui.Widget.TOUCH_CANCELED?b.setEnabled(!0):c===ccui.Widget.TOUCH_BEGAN&&b.setEnabled(!1)},this);this.btn_stand=new ccui.Button(res.gme_btn_stand_normal_cn,res.gme_btn_stand_pressed_cn,res.gme_btn_stand_pressed_cn);this.btn_stand.setAnchorPoint(0.5,0.5);this.btn_stand.setPosition(this.button_bg.width/2+10,this.button_bg.height/2+44);this.btn_stand.setVisible(!0);this.button_bg.addChild(this.btn_stand);this.btn_stand.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED? (a.hideFunctionBtn(),4006===GAME_STATUS&&-1!==USER_INFO.selfsidlist.indexOf(USER_INFO.hitsid)&&(cc.audioEngine.playEffect(res.click,!1),a.sendStand())):c===ccui.Widget.TOUCH_CANCELED?b.setEnabled(!0):c===ccui.Widget.TOUCH_BEGAN&&b.setEnabled(!1)},this);this.btn_double=new ccui.Button(res.gme_btn_double_normal_cn,res.gme_btn_double_pressed_cn,res.gme_btn_double_pressed_cn);this.btn_double.setAnchorPoint(0.5,0.5);this.btn_double.setPosition(this.button_bg.width/2+10,this.button_bg.height/2-78);this.btn_double.setVisible(!0); this.button_bg.addChild(this.btn_double);this.btn_double.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED?(a.hideFunctionBtn(),4006===GAME_STATUS&&-1!==USER_INFO.selfsidlist.indexOf(USER_INFO.hitsid)&&(cc.audioEngine.playEffect(res.click,!1),a.sendDouble())):c===ccui.Widget.TOUCH_CANCELED?b.setEnabled(!0):c===ccui.Widget.TOUCH_BEGAN&&b.setEnabled(!1)},this);this.btn_split=new ccui.Button(res.gme_btn_split_normal_cn,res.gme_btn_split_pressed_cn,res.gme_btn_split_pressed_cn);this.btn_split.setAnchorPoint(0.5, 0.5);this.btn_split.setPosition(this.button_bg.width/2+10,this.button_bg.height/2-200);this.btn_split.setVisible(!0);this.button_bg.addChild(this.btn_split);this.btn_split.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED?(a.hideFunctionBtn(),4006===GAME_STATUS&&-1!==USER_INFO.selfsidlist.indexOf(USER_INFO.hitsid)&&(cc.audioEngine.playEffect(res.click,!1),a.sendSplit())):c===ccui.Widget.TOUCH_CANCELED?b.setEnabled(!0):c===ccui.Widget.TOUCH_BEGAN&&b.setEnabled(!1)},this);this.chip_bg= new cc.Sprite(res.gme_choose_box);this.chip_bg.setAnchorPoint(0.5,0.5);this.chip_bg.setPosition(GAME_CONFIG.centerX+298,GAME_CONFIG.centerY-348);this.chip_bg.setVisible(!0);this.addChild(this.chip_bg);for(var b=0;4>b;b++){var c=new cc.Sprite(res.gme_chip_big_shadow);c.setAnchorPoint(0.5,0.5);c.setPosition(this.chip_bg.width/2+this._chippos[b][0],this.chip_bg.height/2+this._chippos[b][1]);c.setVisible(!0);c.setScale(1.1);c.setName("chipback_"+b);this.chip_bg.addChild(c);c=new ccui.Button(res.gme_chip_big_0, res.gme_chip_big_0,res.gme_chip_big_0);c.setAnchorPoint(0.5,0.5);c.setPosition(this.chip_bg.width/2+this._chippos[b][0],this.chip_bg.height/2+this._chippos[b][1]);c.setVisible(!0);c.setName("chip_"+b);this.chip_bg.addChild(c);c.addTouchEventListener(function(b,c){if(c===ccui.Widget.TOUCH_ENDED){var f=b.getName().split("_")[1];f!=a._chipSelected&&(cc.audioEngine.playEffect(res.click,!1),a.selectChip(f))}},this)}for(b=0;5>b;b++)c=new ccui.Button(res.gme_bet_circle),c.setAnchorPoint(0.5,0.5),c.setPosition(GAME_CONFIG.centerX+ this._bet_circle_pos[b][0],GAME_CONFIG.centerY+this._bet_circle_pos[b][1]),c.setVisible(!0),c.setName("betcircle_"+(b+1)),this.addChild(c),c.addTouchEventListener(function(b,c){if(c===ccui.Widget.TOUCH_ENDED&&4002==GAME_STATUS){var f=parseInt(b.getName().split("_")[1]);a.BetTempChips(f)}},this);this.selectChip(0);this._confirm_cancel_bg=new cc.Sprite(res.gme_bettime_black);this._confirm_cancel_bg.setAnchorPoint(0.5,0.5);this._confirm_cancel_bg.setPosition(GAME_CONFIG.centerX+180,GAME_CONFIG.centerY- 2);this._confirm_cancel_bg.setVisible(!0);this.addChild(this._confirm_cancel_bg);this._confirm_btn=new ccui.Button(res.gme_btn_confirm_normal_cn,res.gme_btn_confirm_pressed_cn,res.gme_btn_confirm_pressed_cn);this._confirm_btn.setAnchorPoint(0.5,0.5);this._confirm_btn.setPosition(this._confirm_cancel_bg.width/2-52,this._confirm_cancel_bg.height/2);this._confirm_btn.setVisible(!0);this._confirm_cancel_bg.addChild(this._confirm_btn);this._confirm_btn.addTouchEventListener(function(b,c){c===ccui.Widget.TOUCH_ENDED&& 4002==GAME_STATUS&&!1!==b.visible&&(cc.audioEngine.playEffect(res.click,!1),a.sendBetToServer())},this);this._cancel_btn=new ccui.Button(res.gme_btn_cancel_normal_cn,res.gme_btn_cancel_pressed_cn,res.gme_btn_cancel_pressed_cn);this._cancel_btn.setAnchorPoint(0.5,0.5);this._cancel_btn.setPosition(this._confirm_cancel_bg.width/2+82,this._confirm_cancel_bg.height/2);this._cancel_btn.setVisible(!0);this._confirm_cancel_bg.addChild(this._cancel_btn);this._cancel_btn.addTouchEventListener(function(b,c){c=== ccui.Widget.TOUCH_ENDED&&4002==GAME_STATUS&&!1!==b.visible&&(a._tempBetAmount=[0,0,0,0,0],a.hideConfirmCancelBtn(),a.reBuildRealBetChips(),cc.audioEngine.playEffect(res.clickback,!1))},this);return!0},sendSplit:function(){var a={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.split,args:{gsn:USER_INFO.gsn,sid:USER_INFO.hitsid}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,a)},sendDouble:function(){var a={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.double,args:{gsn:USER_INFO.gsn,sid:USER_INFO.hitsid, subhitindex:USER_INFO.hitsubhitindex}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,a)},sendStand:function(){var a={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.stand,args:{gsn:USER_INFO.gsn,sid:USER_INFO.hitsid,subhitindex:USER_INFO.hitsubhitindex}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game,a)},sendHit:function(){var a={game_id:GAME_CONFIG.gameId,gcmd:GAME_COMMAND.hit,args:{gsn:USER_INFO.gsn,sid:USER_INFO.hitsid,subhitindex:USER_INFO.hitsubhitindex}};NKG.GameController.getInstance().sendMsg(COMMAND_ID.game, a)},sendBetToServer:function(){for(var a=[],b=0,c=0;5>c;c++)0b;b++){var c=this.chip_bg.getChildByName("chipback_"+b);c.setTexture(res.gme_chip_big_shadow)}c= this.chip_bg.getChildByName("chipback_"+a);c.setTexture(res.gme_chip_big_light)},resetChips:function(){for(var a=USER_INFO.chiplist,b=0;4>b;b++){var c=GET_CHIP_BG(a[b]);this.chip_bg.getChildByName("chip_"+b).loadTextures(res["gme_chip_big_"+c],res["gme_chip_big_"+c],res["gme_chip_big_"+c])}},showConfirmCancelBtn:function(){this._confirm_cancel_bg.setVisible(!0)},hideConfirmCancelBtn:function(){this._confirm_cancel_bg.setVisible(!1)},showFunctionBtn:function(a,b,c){var d=USER_INFO.cardlist["sid"+a][c].cardlist; a=USER_INFO.cardlist["sid"+a][c].point;99!==a[0]&&(0==b?(21>=a[0]&&0a[0]&&0USER_INFO.maxbet)){for(var e=0;5>e;e++)d+=this._tempBetAmount[e];c+d<=b&&(this.removeOnePlayerChips(a),cc.audioEngine.playEffect(res.collectcoin_small,!1),this._tempBetAmount[a-1]+=c,this.showOnePlayerChips(a,this._tempBetAmount[a-1]+this._realBetAmount[a-1]),this.showConfirmCancelBtn())}},reBuildRealBetChips:function(){this.removeAllChips();for(var a=0;5>a;a++){var b=a+1,c=this._realBetAmount[a];0a;a++)this.getChildByName("betcircle_"+ a).removeAllChildren(!0)},removeOnePlayerChips:function(a){this.getChildByName("betcircle_"+a).removeAllChildren(!0)},showOnePlayerChips:function(a,b){for(var c=this.getChildByName("betcircle_"+a),d=GET_TOTAL_SMALL_CHIP(b),e=0;ea;a++)this.getChildByName("betcircle_"+a).setVisible(!1)},showRealBettingArea:function(a){a=a.seatinfo;for(var b=0;ba;a++){var b=new cc.Sprite(this._spotlight_res[a]),c=this._spotlight_flipflag[a],d=this._spotlight_pos[a][0],e=this._spotlight_pos[a][1];b.setName("spotlight_"+ a);b.setAnchorPoint(0.5,0.5);b.setPosition(GAME_CONFIG.centerX+d,GAME_CONFIG.centerY+e);c&&b.setFlippedX(!0);b.setVisible(!1);this.addChild(b)}return!0},removeAllMovingChips:function(){var a=this.getChildByName("blinds_self_chip");a&&(a.stopAllActions(),a.removeAllChildren(!0),this.removeChild(a,!0));for(a=1;7>=a;a++){var b=this.getChildByName("blinds_player_chip_"+a);b&&(b.stopAllActions(),b.removeAllChildren(!0),this.removeChild(b,!0))}if(a=this.getChildByName("chips_self"))a.stopAllActions(),a.removeAllChildren(!0), this.removeChild(a,!0);for(a=1;7>=a;a++)if(b=this.getChildByName("chips_player_"+a))b.stopAllActions(),b.removeAllChildren(!0),this.removeChild(b,!0)},updatePoolChip:function(){for(var a=0;a=b)){var d= GET_TOTAL_SMALL_CHIP(b),e=new cc.Sprite(res.gme_chip_small_shadow);e.setAnchorPoint(0.5,0.5);e.setPosition(GAME_CONFIG.centerX+a,GAME_CONFIG.centerY+c);e.setVisible(!0);e.setName("poolchipbg");this.addChild(e);this._poolChiplist.push(e);for(a=0;a a;a++)this.getChildByName("spotlight_"+a).setVisible(!1)},showSpotlight:function(a){a=this._player_seat_mapping["selfseat"+USER_INFO.seatid][a._userData.data.sid];this.hideAllSpotlight();this.getChildByName("spotlight_"+a).setVisible(!0)},hideAllSpotlight:function(){for(var a=1;8>a;a++)this.getChildByName("spotlight_"+a).setVisible(!1)},handleBroadcast:function(a){switch(a._eventId){case EVENT_ID.login:this.setLanguage();break;case EVENT_ID.setLanguage:this.setLanguage();break;case EVENT_ID.enterTable:0< USER_INFO.poolamount&&this.updatePoolChip();break;case EVENT_ID.shuffleStage:this.updateBlindBets(a._userData.data);break;case EVENT_ID.dealingStage:this.removeAllMovingChips();this.updatePoolChip();break;case EVENT_ID.raise1Stage:cc.audioEngine.playEffect(res.callcardsound,!1);this.showSpotlight(a);break;case EVENT_ID.dealing2Stage:this.hideAllSpotlight();break;case EVENT_ID.raise2Stage:cc.audioEngine.playEffect(res.callcardsound,!1);this.showSpotlight(a);break;case EVENT_ID.openAllCardStage:this.hideAllSpotlight(); break;case EVENT_ID.resultStage:this.hideAllSpotlight();break;case EVENT_ID.gameFinishStage:this.gameFinishProcess();break;case EVENT_ID.updatePlayerAllIn:var b=a._userData.data.seatid,c=USER_INFO.poolamount;this.moveChipToPoolAction(b,a._userData.data.allinamount,c,!1);a=this._player_seat_mapping["selfseat"+USER_INFO.seatid][b];1===a&&cc.audioEngine.playEffect(res.collectcoin,!1);break;case EVENT_ID.updatePlayerRaise1:var b=a._userData.data.seatid,d=a._userData.data.raiseamount,c=a._userData.data.poolamount; this.moveChipToPoolAction(b,d,c,!1);a=this._player_seat_mapping["selfseat"+USER_INFO.seatid][b];1===a&&cc.audioEngine.playEffect(res.collectcoin,!1);break;case EVENT_ID.updatePlayerRaise2:b=a._userData.data.seatid;d=a._userData.data.raiseamount;c=a._userData.data.poolamount;this.moveChipToPoolAction(b,d,c,!1);a=this._player_seat_mapping["selfseat"+USER_INFO.seatid][b];1===a&&cc.audioEngine.playEffect(res.collectcoin,!1);break;case EVENT_ID.updatePlayerCall:b=a._userData.data.seatid;d=a._userData.data.callamount; c=a._userData.data.poolamount;this.moveChipToPoolAction(b,d,c,!1);a=this._player_seat_mapping["selfseat"+USER_INFO.seatid][b];1===a&&cc.audioEngine.playEffect(res.collectcoin,!1);break;case EVENT_ID.game_show:this.removeAllMovingChips(),this.updatePoolChip()}},setLanguage:function(){}});var Ly_WinUI=cc.Layer.extend({_sidlabeldata:[[res.gme_a,-279,203],[res.gme_b,-279,59],[res.gme_c,-279,-85],[res.gme_d,-279,-229],[res.gme_e,-279,-373]],_sidsplitlabledata:[["gme_split_a_cn",-279,131],["gme_split_b_cn",-279,-13],["gme_split_c_cn",-279,-157],["gme_split_d_cn",-279,-301],["gme_split_e_cn",-279,-445]],_dealercardpos:{leftx:-301,rightx:177,scale:0.67,cardwidth:71,areawidth:477},_playercardpost:{leftx:38,rightx:222,scale:0.9483,cardwidth:38,areawidth:184},_playercardpost_6:{leftx:38,rightx:222, scale:0.55172,cardwidth:22,areawidth:184},_actionObjectList:[],ctor:function(){cc.log("Ly_Win ctor");this._super();this.blackbg=new ccui.Button(res.gme_black1pixel,res.gme_black1pixel,res.gme_black1pixel);this.blackbg.setAnchorPoint(0.5,0.5);this.blackbg.setPosition(GAME_CONFIG.centerX,cc.winSize.height/2);this.blackbg.setOpacity(150);this.blackbg.setScaleX(720);this.blackbg.setScaleY(cc.winSize.height);this.blackbg.setVisible(!1);this.addChild(this.blackbg);this.gme_summary_bg=new cc.Sprite(res.gme_summary_bg); this.gme_summary_bg.setAnchorPoint(0.5,0.5);this.gme_summary_bg.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY-34);this.gme_summary_bg.setVisible(!1);this.addChild(this.gme_summary_bg);this.summaryLogo=new cc.Sprite(res.gme_summary_cn);this.summaryLogo.setAnchorPoint(0.5,0.5);this.summaryLogo.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY+503);this.summaryLogo.setVisible(!1);this.addChild(this.summaryLogo);this.gme_dealer=new cc.Sprite(res.gme_dealer_cn);this.gme_dealer.setAnchorPoint(0.5, 0.5);this.gme_dealer.setPosition(this.gme_summary_bg.width/2-154,this.gme_summary_bg.height/2+444);this.gme_dealer.setVisible(!0);this.gme_summary_bg.addChild(this.gme_dealer);this.gme_total_win=new cc.Sprite(res.gme_total_win_cn);this.gme_total_win.setAnchorPoint(0.5,0.5);this.gme_total_win.setPosition(this.gme_summary_bg.width/2-183,this.gme_summary_bg.height/2+269);this.gme_total_win.setVisible(!0);this.gme_summary_bg.addChild(this.gme_total_win);this.dealer_point_nbr=new SW.NumberAtlas(0,res.gme_nbr_totals_0, 21,80);this.dealer_point_nbr.setAnchorPoint(0.5,0.5);this.dealer_point_nbr.setPosition(this.gme_summary_bg.width/2+244,this.gme_summary_bg.height/2+377);this.dealer_point_nbr.setVisible(!0);this.dealer_point_nbr.setNumber(20);this.gme_summary_bg.addChild(this.dealer_point_nbr);this.dealer_point_totals=new cc.Sprite(res.gme_totals_cn);this.dealer_point_totals.setAnchorPoint(0.5,0.5);this.dealer_point_totals.setPosition(this.gme_summary_bg.width/2+244,this.gme_summary_bg.height/2+328);this.dealer_point_totals.setVisible(!0); this.gme_summary_bg.addChild(this.dealer_point_totals);this.dealerBJAnm=sp.SkeletonAnimation.createWithJsonFile(res.BJ_button_json,res.BJ_button_atlas);this.dealerBJAnm.setToSetupPose();this.dealerBJAnm.clearTracks();this.dealerBJAnm.setAnchorPoint(0,0);this.dealerBJAnm.setPosition(this.gme_summary_bg.width/2+244,this.gme_summary_bg.height/2+328);this.dealerBJAnm.setAnimation(0,"loop",!0);this.dealerBJAnm.setVisible(!1);this.gme_summary_bg.addChild(this.dealerBJAnm);this.dealerBJAnm.update(0);this.dealerBJAnm.setAnimationListener(this.dealerBJAnm, function(a,b,c,d,k){});this.gme_bust_small=new cc.Sprite(res.gme_bust_small_cn);this.gme_bust_small.setAnchorPoint(0.5,0.5);this.gme_bust_small.setPosition(this.gme_summary_bg.width/2+244,this.gme_summary_bg.height/2+328);this.gme_bust_small.setScale(1.5);this.gme_bust_small.setVisible(!1);this.gme_summary_bg.addChild(this.gme_bust_small);this.selfTotalWinNbr=new SW.NumberAtlas(0,res.gme_nbr_total,9,32);this.selfTotalWinNbr.setAnchorPoint(1,0.5);this.selfTotalWinNbr.setPosition(this.gme_summary_bg.width/ 2+276,this.gme_summary_bg.height/2+269);this.selfTotalWinNbr.setVisible(!0);this.selfTotalWinNbr.setNumber(ADD_COMMA(1E4));this.gme_summary_bg.addChild(this.selfTotalWinNbr);for(var a=0;25>a;a++){var b=new cc.Sprite(res.cmn_card_0);b.setAnchorPoint(0.5,0.5);b.setPosition(this.gme_summary_bg.width/2,this.gme_summary_bg.height/2+361);b.setScale(0.67);b.setName("dealerCard_"+a);b.setVisible(!1);this.gme_summary_bg.addChild(b)}for(a=0;5>a;a++){b=new cc.Sprite(this._sidlabeldata[a][0]);b.setAnchorPoint(0.5, 0.5);b.setPosition(this.gme_summary_bg.width/2+this._sidlabeldata[a][1],this.gme_summary_bg.height/2+this._sidlabeldata[a][2]);b.setName("sidlabel_"+(a+1)+"_0");b.setVisible(!0);this.gme_summary_bg.addChild(b);for(var c=0;25>c;c++){var d=new cc.Sprite(res.gme_card_0);d.setAnchorPoint(0.5,0.5);d.setName("card_"+(a+1)+"_0_"+c);d.setPosition(b.width/2,b.height/2);d.setVisible(!1);b.addChild(d)}c=new SW.NumberAtlas(0,res.gme_nbr_totals_0,21,80);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/2+245,b.height/ 2+20);c.setScale(0.38);c.setVisible(!0);c.setName("playerpoint_"+(a+1)+"_0");c.setNumber(20);b.addChild(c);c=sp.SkeletonAnimation.createWithJsonFile(res.BJ_button_json,res.BJ_button_atlas);c.setToSetupPose();c.clearTracks();c.setAnchorPoint(0,0);c.setPosition(b.width/2+245,b.height/2-16);c.setAnimation(0,"loop",!0);c.setScale(0.8);c.setVisible(!1);c.setName("playerbjanm_"+(a+1)+"_0");b.addChild(c);c.update(0);c=new cc.Sprite(res.gme_bust_small_cn);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/2+ 245,b.height/2-20);c.setName("playerbust_"+(a+1)+"_0");c.setVisible(!0);b.addChild(c);c=new cc.Sprite(res.gme_draw_small_cn);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/2+245,b.height/2-20);c.setName("playerdraw_"+(a+1)+"_0");c.setVisible(!1);b.addChild(c);c=new cc.Sprite(res.gme_bet_win_cn);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/2+325,b.height/2);c.setName("betwin_"+(a+1)+"_0");c.setScale(0.9);c.setVisible(!0);b.addChild(c);c=new cc.Sprite(res.gme_lns_bet_win);c.setAnchorPoint(0.5,0.5); c.setPosition(b.width/2+325,b.height/2);c.setName("insbetwin_"+(a+1)+"_0");c.setScale(0.8);c.setVisible(!1);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_total,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2+16);c.setScale(0.75);c.setVisible(!0);c.setName("playerbetnbr_"+(a+1)+"_0");c.setNumber(20);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_win1,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2-16);c.setVisible(!0);c.setScale(0.75);c.setName("playerwinnbr_"+ (a+1)+"_0");c.setNumber(20);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_total,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2+16);c.setScale(0.75);c.setVisible(!0);c.setName("playerinsbetnbr_"+(a+1)+"_0");c.setNumber(20);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_win1,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2-16);c.setVisible(!0);c.setScale(0.75);c.setName("playerinswinnbr_"+(a+1)+"_0");c.setNumber(20);b.addChild(c);b=new cc.Sprite(res[this._sidsplitlabledata[a][0]]); b.setAnchorPoint(0.5,0.5);b.setPosition(this.gme_summary_bg.width/2+this._sidsplitlabledata[a][1],this.gme_summary_bg.height/2+this._sidsplitlabledata[a][2]);b.setName("sidlabel_"+(a+1)+"_1");b.setVisible(!0);this.gme_summary_bg.addChild(b);for(c=0;25>c;c++)d=new cc.Sprite(res.gme_card_0),d.setAnchorPoint(0.5,0.5),d.setName("card_"+(a+1)+"_1_"+c),d.setPosition(b.width/2,b.height/2),d.setVisible(!1),b.addChild(d);c=new SW.NumberAtlas(0,res.gme_nbr_totals_0,21,80);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/ 2+245,b.height/2+20);c.setScale(0.38);c.setName("playerpoint_"+(a+1)+"_1");c.setVisible(!0);c.setNumber(20);b.addChild(c);c=sp.SkeletonAnimation.createWithJsonFile(res.BJ_button_json,res.BJ_button_atlas);c.setToSetupPose();c.clearTracks();c.setAnchorPoint(0,0);c.setPosition(b.width/2+245,b.height/2-16);c.setAnimation(0,"loop",!0);c.setScale(0.8);c.setVisible(!1);c.setName("playerbjanm_"+(a+1)+"_1");b.addChild(c);c.update(0);c=new cc.Sprite(res.gme_bust_small_cn);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/ 2+245,b.height/2-20);c.setName("playerbust_"+(a+1)+"_1");c.setVisible(!0);b.addChild(c);c=new cc.Sprite(res.gme_draw_small_cn);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/2+245,b.height/2-20);c.setName("playerdraw_"+(a+1)+"_1");c.setVisible(!1);b.addChild(c);c=new cc.Sprite(res.gme_bet_win_cn);c.setAnchorPoint(0.5,0.5);c.setPosition(b.width/2+325,b.height/2);c.setName("betwin_"+(a+1)+"_1");c.setScale(0.9);c.setVisible(!0);b.addChild(c);c=new cc.Sprite(res.gme_lns_bet_win);c.setAnchorPoint(0.5, 0.5);c.setPosition(b.width/2+325,b.height/2);c.setName("insbetwin_"+(a+1)+"_1");c.setScale(0.8);c.setVisible(!1);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_total,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2+16);c.setScale(0.75);c.setVisible(!0);c.setName("playerbetnbr_"+(a+1)+"_1");c.setNumber(20);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_win1,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2-16);c.setVisible(!0);c.setScale(0.75);c.setName("playerwinnbr_"+ (a+1)+"_1");c.setNumber(20);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_total,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2+16);c.setScale(0.75);c.setVisible(!0);c.setName("playerinsbetnbr_"+(a+1)+"_1");c.setNumber(20);b.addChild(c);c=new SW.NumberAtlas(0,res.gme_nbr_win1,9,32);c.setAnchorPoint(1,0.5);c.setPosition(b.width/2+585,b.height/2-16);c.setVisible(!0);c.setScale(0.75);c.setName("playerinswinnbr_"+(a+1)+"_1");c.setNumber(20);b.addChild(c)}this.winner=sp.SkeletonAnimation.createWithJsonFile(res.winner_json, res.winner_atlas);this.winner.setToSetupPose();this.winner.clearTracks();this.winner.setAnchorPoint(0,0);this.winner.setPosition(GAME_CONFIG.centerX,GAME_CONFIG.centerY);this.winner.setAnimation(0,"start",!1);this.winner.setVisible(!1);this.addChild(this.winner);this.winner.update(0);this.winner.setAnimationListener(this.winner,function(a,b,c,d,k){});return!0},showWinnerAnm:function(){this.winner.runAction(cc.sequence(cc.callFunc(function(a){a.clearTracks();a.setToSetupPose();a.setAnimation(0,"start", !1);a.setVisible(!0)}),cc.delayTime(1),cc.callFunc(function(a){a.clearTracks();a.setToSetupPose();a.setAnimation(0,"loop",!1);a.setVisible(!0)}),cc.delayTime(2),cc.callFunc(function(a){a.clearTracks();a.setToSetupPose();a.setAnimation(0,"end",!1);a.setVisible(!0)}),cc.delayTime(0.34),cc.callFunc(function(a){a.clearTracks();a.setToSetupPose();a.setVisible(!1)})))},update:function(a){},showDealerBJTag:function(){this.dealerBJAnm.setVisible(!0)},hideAllDealerTag:function(){this.dealerBJAnm.setVisible(!1); this.dealer_point_totals.setVisible(!1);this.gme_bust_small.setVisible(!1)},setDealerPointNbr:function(a){99===a?this.dealer_point_nbr.setNumber(21):this.dealer_point_nbr.setNumber(a)},setTotalWin:function(a){this.selfTotalWinNbr.setNumber(ADD_COMMA(a))},showDealerCards:function(a){for(var b=a.length,c=this._dealercardpos.cardwidth,d=this._dealercardpos.areawidth,e=this._dealercardpos.leftx,f=0;fa;a++)this.gme_summary_bg.getChildByName("dealerCard_"+a).setVisible(!1)},showDealerTag:function(a){99===a?this.dealerBJAnm.setVisible(!0):21=a;a++){for(var b=this.gme_summary_bg.getChildByName("sidlabel_"+ a+"_0"),c=0;25>c;c++){var d=b.getChildByName("card_"+a+"_0_"+c);d.setVisible(!1)}c=b.getChildByName("playerpoint_"+a+"_0");c.setVisible(!1);c=b.getChildByName("playerbjanm_"+a+"_0");c.setVisible(!1);c=b.getChildByName("playerbust_"+a+"_0");c.setVisible(!1);c=b.getChildByName("playerdraw_"+a+"_0");c.setVisible(!1);c=b.getChildByName("betwin_"+a+"_0");c.setVisible(!1);c=b.getChildByName("insbetwin_"+a+"_0");c.setVisible(!1);c=b.getChildByName("playerbetnbr_"+a+"_0");c.setVisible(!1);c=b.getChildByName("playerwinnbr_"+ a+"_0");c.setVisible(!1);c=b.getChildByName("playerinsbetnbr_"+a+"_0");c.setVisible(!1);b=b.getChildByName("playerinswinnbr_"+a+"_0");b.setVisible(!1);b=this.gme_summary_bg.getChildByName("sidlabel_"+a+"_1");for(c=0;25>c;c++)d=b.getChildByName("card_"+a+"_1_"+c),d.setVisible(!1);c=b.getChildByName("playerpoint_"+a+"_1");c.setVisible(!1);c=b.getChildByName("playerbjanm_"+a+"_1");c.setVisible(!1);c=b.getChildByName("playerbust_"+a+"_1");c.setVisible(!1);c=b.getChildByName("playerdraw_"+a+"_1");c.setVisible(!1); c=b.getChildByName("betwin_"+a+"_1");c.setVisible(!1);c=b.getChildByName("insbetwin_"+a+"_1");c.setVisible(!1);c=b.getChildByName("playerbetnbr_"+a+"_1");c.setVisible(!1);c=b.getChildByName("playerwinnbr_"+a+"_1");c.setVisible(!1);c=b.getChildByName("playerinsbetnbr_"+a+"_1");c.setVisible(!1);b=b.getChildByName("playerinswinnbr_"+a+"_1");b.setVisible(!1)}},showSwapObject:function(a,b){var c=new cc.FadeOut(0.5),d=new cc.FadeIn(0.5),e=new cc.FadeOut(0.5),f=new cc.FadeIn(0.5),c=cc.sequence(cc.callFunc(function(a){a.setOpacity(0); a.setVisible(!0)}),d,cc.delayTime(1),c,cc.callFunc(function(a){a.setOpacity(0);a.setVisible(!1)}),cc.delayTime(2)),c=cc.repeatForever(c);a.runAction(c);this._actionObjectList.push(a);e=cc.sequence(cc.callFunc(function(a){a.setOpacity(0);a.setVisible(!1)}),cc.delayTime(2),cc.callFunc(function(a){a.setOpacity(0);a.setVisible(!0)}),f,cc.delayTime(1),e);e=cc.repeatForever(e);b.runAction(e);this._actionObjectList.push(b)},removeAllActionsFromActionList:function(){for(var a=0;ad?(y.setScale(h),C=f+g/2+Math.floor(A/2)*g,B=0===A%2?16:-16):(y.setScale(e),C=f+c/2+A*c,B=0),y.setPosition(y.getParent().width/2+C,y.getParent().height/2+B),y.setVisible(!0);I.setNumber(ADD_COMMA(w)); F.setNumber(ADD_COMMA(t));G.setNumber(ADD_COMMA(p));z.setNumber(ADD_COMMA(r));I.setVisible(!0);F.setVisible(!0);m.setVisible(!0);this.showSwapObject(m,D);this.showSwapObject(I,G);this.showSwapObject(F,z);if(0!==s){p=v[1].cardlist;s=v[1].point;r=v[1].bet;v=v[1].win;z=this.gme_summary_bg.getChildByName("sidlabel_"+n+"_1");A=z.getChildByName("playerpoint_"+n+"_1");y=z.getChildByName("playerbjanm_"+n+"_1");C=z.getChildByName("playerbust_"+n+"_1");B=z.getChildByName("playerdraw_"+n+"_1");m=z.getChildByName("betwin_"+ n+"_1");I=z.getChildByName("playerbetnbr_"+n+"_1");F=z.getChildByName("playerwinnbr_"+n+"_1");99===s?(A.setNumber(21),A.setPositionY(A.getParent().height/2+20),99===b?B.setVisible(!0):y.setVisible(!0)):21d?(y.setScale(h),C=f+g/2+Math.floor(A/2)*g,B=0===A%2?16:-16):(y.setScale(e),C=f+c/2+A*c,B=0),y.setPosition(y.getParent().width/2+C,y.getParent().height/2+B),y.setVisible(!0);m.setVisible(!0);I.setNumber(ADD_COMMA(r));I.setVisible(!0);F.setNumber(ADD_COMMA(v));F.setVisible(!0)}}},showSummary:function(a){var b=a.dealercardlist,c=a.dealerpoint;this.hideAllDealerCards();this.hideAllDealerTag();this.hideAllPlayerData();for(var d=a.seatinfo,e=0,f=0;fb;b++)reslist=this._sidsplitlabledata[b][0].split("_"),reslist[reslist.length-1]=a,this.gme_summary_bg.getChildByName("sidlabel_"+(b+1)+"_1").setTexture(res[reslist.join("_")]), this.gme_summary_bg.getChildByName("sidlabel_"+(b+1)+"_0").getChildByName("playerbust_"+(b+1)+"_0").setTexture(res["gme_bust_small_"+a]),this.gme_summary_bg.getChildByName("sidlabel_"+(b+1)+"_1").getChildByName("playerbust_"+(b+1)+"_1").setTexture(res["gme_bust_small_"+a]),this.gme_summary_bg.getChildByName("sidlabel_"+(b+1)+"_0").getChildByName("betwin_"+(b+1)+"_0").setTexture(res["gme_bet_win_"+a]),this.gme_summary_bg.getChildByName("sidlabel_"+(b+1)+"_1").getChildByName("betwin_"+(b+1)+"_1").setTexture(res["gme_bet_win_"+ a]),this.gme_summary_bg.getChildByName("sidlabel_"+(b+1)+"_0").getChildByName("playerdraw_"+(b+1)+"_0").setTexture(res["gme_draw_small_"+a]),this.gme_summary_bg.getChildByName("sidlabel_"+(b+1)+"_1").getChildByName("playerdraw_"+(b+1)+"_1").setTexture(res["gme_draw_small_"+a])}});cc.game.onStart=function(){var a=cc.sys;!a.isNative&&document.getElementById("cocosLoading")&&document.body.removeChild(document.getElementById("cocosLoading"));cc.view.enableRetina(!0);a.isMobile&&a.browserType!==a.BROWSER_TYPE_BAIDU&&a.browserType!==a.BROWSER_TYPE_WECHAT&&cc.view.enableAutoFullScreen(!1);cc.view.adjustViewPort(!0);a=Math.min(window.innerHeight,window.innerWidth);a=Math.max(window.innerHeight,window.innerWidth)/a;cc.log("ratio:"+a);a=Math.floor(720*a);cc.log("config_height:"+a); 1280>a?a=1280:1500