var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};_p=window;_p=Object.prototype;delete window._p;cc.newElement=function(a){return document.createElement(a)};cc._addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)};cc._isNodeJs="undefined"!==typeof require&&require("fs");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){a.finishedSize++;a._workingSize--;var c=Array.prototype.slice.call(arguments,1);a._results[this.index]=c[0];a.finishedSize===a.size?a._onEnd&&a._onEnd.call(a._onEndTarget,null,a._results):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}}; cc.loader={_jsCache:{},_register:{},_langPathCache:{},_aliases:{},resPath:"",audioPath:"",cache:{},getXMLHttpRequest:function(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP")},_getArgs4Js:function(a){var b=a[0],c=a[1],d=a[2],e=["",null,null];if(1===a.length)e[1]=b instanceof Array?b:[b];else if(2===a.length)"function"===typeof c?(e[1]=b instanceof Array?b:[b],e[2]=c):(e[0]=b||"",e[1]=c instanceof Array?c:[c]);else if(3===a.length)e[0]=b||"",e[1]=c instanceof Array?c:[c],e[2]=d;else throw Error("arguments error to load js!");return e},loadJs:function(a,b,c){var d=this,e=d._jsCache,f=d._getArgs4Js(arguments),g=f[0],h=f[1],f=f[2];-1=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=cc.newElement("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);/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?b(null,c.responseText):b({status:c.status,errorMessage:d},null))}):(c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8"),c.onload=function(){4===c.readyState&&(200===c.status?b(null,c.responseText):b({status:c.status,errorMessage:d},null))},c.onerror=function(){b({status:c.status,errorMessage:d},null)});c.send(null)}},_loadTxtSync:function(a){if(cc._isNodeJs)return require("fs").readFileSync(a).toString();var b=this.getXMLHttpRequest(); b.open("GET",a,!1);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?b.setRequestHeader("Accept-Charset","utf-8"):b.overrideMimeType&&b.overrideMimeType("text/plain; charset\x3dutf-8");b.send(null);return 4===!b.readyState||200!==b.status?null:b.responseText},loadCsb:function(a,b){var c=new XMLHttpRequest,d="load "+a+" failed!";c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(){var a=c.response;a&&(window.msg=a);4===c.readyState&&(200===c.status?b(null,c.response): b({status:c.status,errorMessage:d},null))};c.onerror=function(){b({status:c.status,errorMessage:d},null)};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){var d={isCrossOrigin:!0};void 0!==c?d.isCrossOrigin=null===b.isCrossOrigin?d.isCrossOrigin:b.isCrossOrigin: void 0!==b&&(c=b);var e=this.getRes(a);if(e)return c&&c(null,e),e;e=new Image;d.isCrossOrigin&&"file://"!==location.origin&&(e.crossOrigin="Anonymous");var f=function(){this.removeEventListener("load",f,!1);this.removeEventListener("error",h,!1);c&&c(null,e)},g=this,h=function(){this.removeEventListener("error",h,!1);e.crossOrigin&&"anonymous"===e.crossOrigin.toLowerCase()?(d.isCrossOrigin=!1,g.release(a),cc.loader.loadImg(a,d,c)):"function"===typeof c&&c("load image failed")};cc._addEventListener(e, "load",f);cc._addEventListener(e,"error",h);e.src=a;return e},_loadResIterator:function(a,b,c){var d=this,e=null,f=a.type;f?(f="."+f.toLowerCase(),e=a.src?a.src:a.name+f):(e=a,f=cc.path.extname(e));if(b=d.getRes(e))return c(null,b);b=null;f&&(b=d._register[f.toLowerCase()]);if(!b)return cc.error("loader for ["+f+"] not exists!"),c();f=e;cc._urlRegExp.test(e)||(f=b.getBasePath?b.getBasePath():d.resPath,f=d.getUrl(f,e));cc.game.config.noCache&&"string"===typeof f&&(f=d._noCacheRex.test(f)?f+("\x26_t\x3d"+ (new Date-0)):f+("?_t\x3d"+(new Date-0)));b.load(f,e,a,function(a,b){a?(cc.log(a),d.cache[e]=null,delete d.cache[e],c({status:520,errorMessage:a},null)):(d.cache[e]=b,c(null,b))})},_noCacheRex:/\?/,getUrl:function(a,b){var c=this._langPathCache,d=cc.path;if(void 0!==a&&void 0===b){b=a;var e=d.extname(b),e=e?e.toLowerCase():"";a=(e=this._register[e])?e.getBasePath?e.getBasePath():this.resPath:this.resPath}b=cc.path.join(a||"",b);if(b.match(/[\/(\\\\)]lang[\/(\\\\)]/i)){if(c[b])return c[b];d=d.extname(b)|| "";b=c[b]=b.substring(0,b.length-d.length)+"_"+cc.sys.language+d}return b},load:function(a,b,c){var d=this,e=arguments.length;if(0===e)throw Error("arguments error!");3===e?"function"===typeof b&&(b="function"===typeof c?{trigger:b,cb:c}:{cb:b,cbTarget:c}):2===e?"function"===typeof b&&(b={cb:b}):1===e&&(b={});a instanceof Array||(a=[a]);e=new cc.AsyncPool(a,0,function(a,c,e,k){d._loadResIterator(a,c,function(a){var c=Array.prototype.slice.call(arguments,1);b.trigger&&b.trigger.call(b.triggerTarget, c[0],k.size,k.finishedSize);e(a,c[0])})},b.cb,b.cbTarget);e.flow();return e},_handleAliases:function(a,b){var c=this._aliases,d=[],e;for(e in a){var f=a[e];c[e]=f;d.push(f)}this.load(d,b)},loadAliases:function(a,b){var c=this,d=c.getRes(a);d?c._handleAliases(d.filenames,b):c.load(a,function(a,d){c._handleAliases(d[0].filenames,b)})},register:function(a,b){if(a&&b){if("string"===typeof a)return this._register[a.trim().toLowerCase()]=b;for(var c=0,d=a.length;cb)return"";var c=a[0],d=!0;"object"===typeof c&&(d=!1);for(var e=1;ee)e=0;var f=[a.OS_ANDROID],g=[],h=cc.newElement("canvas");cc._renderType=cc._RENDER_TYPE_CANVAS;cc._supportRender=!1;var k=d.WebGLRenderingContext;if(2===e||0===e&&k&&-1===f.indexOf(a.os)&&-1===g.indexOf(a.browserType))try{cc.create3DContext(h,{stencil:!0,preserveDrawingBuffer:!0})&&(cc._renderType=cc._RENDER_TYPE_WEBGL,cc._supportRender=!0)}catch(m){}if(1===e||0===e&&!1===cc._supportRender)try{h.getContext("2d"),cc._renderType=cc._RENDER_TYPE_CANVAS, cc._supportRender=!0}catch(n){}})(c,a);c._canUseCanvasNewBlendModes=function(){var a=document.createElement("canvas");a.width=1;a.height=1;a=a.getContext("2d");a.fillStyle="#000";a.fillRect(0,0,1,1);a.globalCompositeOperation="multiply";var b=document.createElement("canvas");b.width=1;b.height=1;var c=b.getContext("2d");c.fillStyle="#fff";c.fillRect(0,0,1,1);a.drawImage(b,0,0,1,1);return 0===a.getImageData(0,0,1,1).data[0]};c._supportCanvasNewBlendModes=c._canUseCanvasNewBlendModes();try{var p=c.localStorage= d.localStorage;p.setItem("storage","");p.removeItem("storage");p=null}catch(t){p=function(){cc.warn("Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option")},c.localStorage={getItem:p,setItem:p,removeItem:p,clear:p}}p=c.capabilities={canvas:!0};cc._renderType===cc._RENDER_TYPE_WEBGL&&(p.opengl=!0);if(void 0!==g.ontouchstart||void 0!==f.ontouchstart||e.msPointerEnabled)p.touches=!0;void 0!==g.onmouseup&&(p.mouse=!0);void 0!==g.onkeyup&&(p.keyboard=!0);if(d.DeviceMotionEvent|| d.DeviceOrientationEvent)p.accelerometer=!0;c.garbageCollect=function(){};c.dumpRoot=function(){};c.restartVM=function(){};c.cleanScript=function(a){};c.isObjectValid=function(a){return a?!0:!1};c.dump=function(){var a;a=""+("isMobile : "+this.isMobile+"\r\n");a+="language : "+this.language+"\r\n";a+="browserType : "+this.browserType+"\r\n";a+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n";a+="os : "+this.os+"\r\n";a+="platform : "+this.platform+"\r\n";cc.log(a)};c.openURL=function(a){window.open(a)}}; cc.ORIENTATION_PORTRAIT=0;cc.ORIENTATION_PORTRAIT_UPSIDE_DOWN=1;cc.ORIENTATION_LANDSCAPE_LEFT=2;cc.ORIENTATION_LANDSCAPE_RIGHT=3;cc._drawingUtil=null;cc._renderContext=null;cc._canvas=null;cc._gameDiv=null;cc._rendererInitialized=!1;cc._setupCalled=!1; cc._setup=function(a,b,c){if(!cc._setupCalled){cc._setupCalled=!0;var d=window,e=cc.$(a)||cc.$("#"+a),f;cc.game._setAnimFrame();"CANVAS"===e.tagName?(b=b||e.width,c=c||e.height,f=cc.container=cc.newElement("DIV"),a=cc._canvas=e,a.parentNode.insertBefore(f,a),a.appendTo(f),f.setAttribute("id","Cocos2dGameContainer")):("DIV"!==e.tagName&&cc.log("Warning: target element is not a DIV or CANVAS"),b=b||e.clientWidth,c=c||e.clientHeight,f=cc.container=e,a=cc._canvas=cc.$(cc.newElement("CANVAS")),e.appendChild(a)); a.addClass("gameCanvas");a.setAttribute("width",b||480);a.setAttribute("height",c||320);a.setAttribute("tabindex",99);a.style.outline="none";e=f.style;e.width=(b||480)+"px";e.height=(c||320)+"px";e.margin="0 auto";e.position="relative";e.overflow="hidden";f.top="100%";cc._renderType===cc._RENDER_TYPE_WEBGL&&(cc._renderContext=cc.webglContext=cc.create3DContext(a,{stencil:!0,preserveDrawingBuffer:!0,antialias:!cc.sys.isMobile,alpha:!0}));cc._renderContext?(d.gl=cc._renderContext,cc._drawingUtil=new cc.DrawingPrimitiveWebGL(cc._renderContext), cc._rendererInitialized=!0,cc.textureCache._initializingRenderer(),cc.shaderCache._init()):(cc._renderContext=new cc.CanvasContextWrapper(a.getContext("2d")),cc._drawingUtil=cc.DrawingPrimitiveCanvas?new cc.DrawingPrimitiveCanvas(cc._renderContext):null);cc._gameDiv=f;cc.log(cc.ENGINE_VERSION);cc._setContextMenuEnable(!1);cc.sys.isMobile&&(b=cc.newElement("style"),b.type="text/css",document.body.appendChild(b),b.textContent="body,canvas,div{ -moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;-khtml-user-select: none;-webkit-tap-highlight-color:rgba(0,0,0,0);}"); cc.view=cc.EGLView._getInstance();cc.inputManager.registerSystemEvent(cc._canvas);cc.director=cc.Director._getInstance();cc.director.setOpenGLView&&cc.director.setOpenGLView(cc.view);cc.winSize=cc.director.getWinSize();cc.saxParser=new cc.SAXParser;cc.plistParser=new cc.PlistParser}};cc._checkWebGLRenderMode=function(){if(cc._renderType!==cc._RENDER_TYPE_WEBGL)throw Error("This feature supports WebGL render mode only.");};cc._isContextMenuEnable=!1; cc._setContextMenuEnable=function(a){cc._isContextMenuEnable=a;cc._canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1}}; cc.game={DEBUG_MODE_NONE:0,DEBUG_MODE_INFO:1,DEBUG_MODE_WARN:2,DEBUG_MODE_ERROR:3,DEBUG_MODE_INFO_FOR_WEB_PAGE:4,DEBUG_MODE_WARN_FOR_WEB_PAGE:5,DEBUG_MODE_ERROR_FOR_WEB_PAGE:6,EVENT_HIDE:"game_on_hide",EVENT_SHOW:"game_on_show",EVENT_RESIZE:"game_on_resize",_eventHide:null,_eventShow:null,_onBeforeStartArr:[],CONFIG_KEY:{engineDir:"engineDir",dependencies:"dependencies",debugMode:"debugMode",showFPS:"showFPS",frameRate:"frameRate",id:"id",renderMode:"renderMode",jsList:"jsList",classReleaseMode:"classReleaseMode"}, _prepareCalled:!1,_prepared:!1,_paused:!0,_intervalId:null,_lastTime:null,_frameTime:null,config:null,onStart:null,onStop:null,setFrameRate:function(a){this.config[this.CONFIG_KEY.frameRate]=a;this._intervalId&&window.cancelAnimationFrame(this._intervalId);this._paused=!0;this._setAnimFrame();this._runMainLoop()},_setAnimFrame:function(){this._lastTime=new Date;this._frameTime=1E3/cc.game.config[cc.game.CONFIG_KEY.frameRate];cc.sys.os===cc.sys.OS_IOS&&cc.sys.browserType===cc.sys.BROWSER_TYPE_WECHAT|| 60!==cc.game.config[cc.game.CONFIG_KEY.frameRate]?(window.requestAnimFrame=this._stTime,window.cancelAnimationFrame=this._ctTime):(window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime,window.cancelAnimationFrame=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame|| window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.oCancelAnimationFrame||this._ctTime)},_stTime:function(a){var b=(new Date).getTime(),c=Math.max(0,cc.game._frameTime-(b-cc.game._lastTime)),d=window.setTimeout(function(){a()},c);cc.game._lastTime=b+c;return d},_ctTime:function(a){window.clearTimeout(a)},_runMainLoop:function(){var a=this,b,c=cc.director;c.setDisplayStats(a.config[a.CONFIG_KEY.showFPS]); b=function(){a._paused||(c.mainLoop(),a._intervalId&&window.cancelAnimationFrame(a._intervalId),a._intervalId=window.requestAnimFrame(b))};window.requestAnimFrame(b);a._paused=!1},restart:function(){cc.director.popToSceneStackLevel(0);cc.audioEngine&&cc.audioEngine.end();cc.game.onStart()},run:function(a){var b=this,c=function(){a&&(b.config[b.CONFIG_KEY.id]=a);b._prepareCalled||b.prepare(function(){b._prepared=!0});cc._supportRender&&(b._checkPrepare=setInterval(function(){b._prepared&&(cc._setup(b.config[b.CONFIG_KEY.id]), b._runMainLoop(),b._eventHide=b._eventHide||new cc.EventCustom(b.EVENT_HIDE),b._eventHide.setUserData(b),b._eventShow=b._eventShow||new cc.EventCustom(b.EVENT_SHOW),b._eventShow.setUserData(b),b.onStart(),clearInterval(b._checkPrepare))},10))};document.body?c():cc._addEventListener(window,"load",function(){this.removeEventListener("load",arguments.callee,!1);c()},!1)},_initConfig:function(){var a=this.CONFIG_KEY,b=function(b){b[a.engineDir]=b[a.engineDir]||"frameworks/cocos2d-html5";null==b[a.debugMode]&& (b[a.debugMode]=0);b[a.frameRate]=b[a.frameRate]||60;null==b[a.renderMode]&&(b[a.renderMode]=1);return b};if(document.ccConfig)this.config=b(document.ccConfig);else try{for(var c=document.getElementsByTagName("script"),d=0;dh.indexOf("core")&&h.splice(0,0,"core");for(var v=0,s=h.length;vb.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/sABFEdWNreQABAAQAAAAeAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWFlaIAAAAAAAAPNRAAEAAAABFsxYWVogAAAAAAAAAAAAAAAAAAAAAFhZWiAAAAAAAABvogAAOPUAAAOQWFlaIAAAAAAAAGKZAAC3hQAAGNpYWVogAAAAAAAAJKAAAA+EAAC2z2Rlc2MAAAAAAAAAFklFQyBodHRwOi8vd3d3LmllYy5jaAAAAAAAAAAAAAAAFklFQyBodHRwOi8vd3d3LmllYy5jaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkZXNjAAAAAAAAAC5JRUMgNjE5NjYtMi4xIERlZmF1bHQgUkdCIGNvbG91ciBzcGFjZSAtIHNSR0IAAAAAAAAAAAAAAC5JRUMgNjE5NjYtMi4xIERlZmF1bHQgUkdCIGNvbG91ciBzcGFjZSAtIHNSR0IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZGVzYwAAAAAAAAAsUmVmZXJlbmNlIFZpZXdpbmcgQ29uZGl0aW9uIGluIElFQzYxOTY2LTIuMQAAAAAAAAAAAAAALFJlZmVyZW5jZSBWaWV3aW5nIENvbmRpdGlvbiBpbiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHZpZXcAAAAAABOk/gAUXy4AEM8UAAPtzAAEEwsAA1yeAAAAAVhZWiAAAAAAAEwJVgBQAAAAVx/nbWVhcwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAo8AAAACc2lnIAAAAABDUlQgY3VydgAAAAAAAAQAAAAABQAKAA8AFAAZAB4AIwAoAC0AMgA3ADsAQABFAEoATwBUAFkAXgBjAGgAbQByAHcAfACBAIYAiwCQAJUAmgCfAKQAqQCuALIAtwC8AMEAxgDLANAA1QDbAOAA5QDrAPAA9gD7AQEBBwENARMBGQEfASUBKwEyATgBPgFFAUwBUgFZAWABZwFuAXUBfAGDAYsBkgGaAaEBqQGxAbkBwQHJAdEB2QHhAekB8gH6AgMCDAIUAh0CJgIvAjgCQQJLAlQCXQJnAnECegKEAo4CmAKiAqwCtgLBAssC1QLgAusC9QMAAwsDFgMhAy0DOANDA08DWgNmA3IDfgOKA5YDogOuA7oDxwPTA+AD7AP5BAYEEwQgBC0EOwRIBFUEYwRxBH4EjASaBKgEtgTEBNME4QTwBP4FDQUcBSsFOgVJBVgFZwV3BYYFlgWmBbUFxQXVBeUF9gYGBhYGJwY3BkgGWQZqBnsGjAadBq8GwAbRBuMG9QcHBxkHKwc9B08HYQd0B4YHmQesB78H0gflB/gICwgfCDIIRghaCG4IggiWCKoIvgjSCOcI+wkQCSUJOglPCWQJeQmPCaQJugnPCeUJ+woRCicKPQpUCmoKgQqYCq4KxQrcCvMLCwsiCzkLUQtpC4ALmAuwC8gL4Qv5DBIMKgxDDFwMdQyODKcMwAzZDPMNDQ0mDUANWg10DY4NqQ3DDd4N+A4TDi4OSQ5kDn8Omw62DtIO7g8JDyUPQQ9eD3oPlg+zD88P7BAJECYQQxBhEH4QmxC5ENcQ9RETETERTxFtEYwRqhHJEegSBxImEkUSZBKEEqMSwxLjEwMTIxNDE2MTgxOkE8UT5RQGFCcUSRRqFIsUrRTOFPAVEhU0FVYVeBWbFb0V4BYDFiYWSRZsFo8WshbWFvoXHRdBF2UXiReuF9IX9xgbGEAYZRiKGK8Y1Rj6GSAZRRlrGZEZtxndGgQaKhpRGncanhrFGuwbFBs7G2MbihuyG9ocAhwqHFIcexyjHMwc9R0eHUcdcB2ZHcMd7B4WHkAeah6UHr4e6R8THz4faR+UH78f6iAVIEEgbCCYIMQg8CEcIUghdSGhIc4h+yInIlUigiKvIt0jCiM4I2YjlCPCI/AkHyRNJHwkqyTaJQklOCVoJZclxyX3JicmVyaHJrcm6CcYJ0kneierJ9woDSg/KHEooijUKQYpOClrKZ0p0CoCKjUqaCqbKs8rAis2K2krnSvRLAUsOSxuLKIs1y0MLUEtdi2rLeEuFi5MLoIuty7uLyQvWi+RL8cv/jA1MGwwpDDbMRIxSjGCMbox8jIqMmMymzLUMw0zRjN/M7gz8TQrNGU0njTYNRM1TTWHNcI1/TY3NnI2rjbpNyQ3YDecN9c4FDhQOIw4yDkFOUI5fzm8Ofk6Njp0OrI67zstO2s7qjvoPCc8ZTykPOM9Ij1hPaE94D4gPmA+oD7gPyE/YT+iP+JAI0BkQKZA50EpQWpBrEHuQjBCckK1QvdDOkN9Q8BEA0RHRIpEzkUSRVVFmkXeRiJGZ0arRvBHNUd7R8BIBUhLSJFI10kdSWNJqUnwSjdKfUrESwxLU0uaS+JMKkxyTLpNAk1KTZNN3E4lTm5Ot08AT0lPk0/dUCdQcVC7UQZRUFGbUeZSMVJ8UsdTE1NfU6pT9lRCVI9U21UoVXVVwlYPVlxWqVb3V0RXklfgWC9YfVjLWRpZaVm4WgdaVlqmWvVbRVuVW+VcNVyGXNZdJ114XcleGl5sXr1fD19hX7NgBWBXYKpg/GFPYaJh9WJJYpxi8GNDY5dj62RAZJRk6WU9ZZJl52Y9ZpJm6Gc9Z5Nn6Wg/aJZo7GlDaZpp8WpIap9q92tPa6dr/2xXbK9tCG1gbbluEm5rbsRvHm94b9FwK3CGcOBxOnGVcfByS3KmcwFzXXO4dBR0cHTMdSh1hXXhdj52m3b4d1Z3s3gReG54zHkqeYl553pGeqV7BHtje8J8IXyBfOF9QX2hfgF+Yn7CfyN/hH/lgEeAqIEKgWuBzYIwgpKC9INXg7qEHYSAhOOFR4Wrhg6GcobXhzuHn4gEiGmIzokziZmJ/opkisqLMIuWi/yMY4zKjTGNmI3/jmaOzo82j56QBpBukNaRP5GokhGSepLjk02TtpQglIqU9JVflcmWNJaflwqXdZfgmEyYuJkkmZCZ/JpomtWbQpuvnByciZz3nWSd0p5Anq6fHZ+Ln/qgaaDYoUehtqImopajBqN2o+akVqTHpTilqaYapoum/adup+CoUqjEqTepqaocqo+rAqt1q+msXKzQrUStuK4trqGvFq+LsACwdbDqsWCx1rJLssKzOLOutCW0nLUTtYq2AbZ5tvC3aLfguFm40blKucK6O7q1uy67p7whvJu9Fb2Pvgq+hL7/v3q/9cBwwOzBZ8Hjwl/C28NYw9TEUcTOxUvFyMZGxsPHQce/yD3IvMk6ybnKOMq3yzbLtsw1zLXNNc21zjbOts83z7jQOdC60TzRvtI/0sHTRNPG1EnUy9VO1dHWVdbY11zX4Nhk2OjZbNnx2nba+9uA3AXcit0Q3ZbeHN6i3ynfr+A24L3hROHM4lPi2+Nj4+vkc+T85YTmDeaW5x/nqegy6LzpRunQ6lvq5etw6/vshu0R7ZzuKO6070DvzPBY8OXxcvH/8ozzGfOn9DT0wvVQ9d72bfb794r4Gfio+Tj5x/pX+uf7d/wH/Jj9Kf26/kv+3P9t////7gAOQWRvYmUAZMAAAAAB/9sAhAAQCwsLDAsQDAwQFw8NDxcbFBAQFBsfFxcXFxcfHhcaGhoaFx4eIyUnJSMeLy8zMy8vQEBAQEBAQEBAQEBAQEBAAREPDxETERUSEhUUERQRFBoUFhYUGiYaGhwaGiYwIx4eHh4jMCsuJycnLis1NTAwNTVAQD9AQEBAQEBAQEBAQED/wAARCADIAKADASIAAhEBAxEB/8QAfgABAAMBAQEBAAAAAAAAAAAAAAQFBgMCAQcBAQAAAAAAAAAAAAAAAAAAAAAQAAIBAwIDBQMKAwcEAwAAAAECAwAEBRESITEGQVFhcROBkSLwobHBMkJSIxQVYnJD0eGCkqIzJPGyJTXCozQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AMfSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlTcbh8hk322kRZQdGlb4UXzb6hxoIVfVRnYKilmPIAamtCbHpvFf/vnbIXQ5wQcIwe5mB+v2V4fqyeFTHi7WGxj71UM/DvOgB91BBg6fzU/+3ZyjXtcemP8A7NtSV6Qzx5wKvnIn1MaiT53MTkmS8l48wrFB7k0FQ2nnc6vIzHxYmgt26Qzw5QK3lIn1sKiz4HMwa+pZy6DmVXePemtQ1uJ0OqSOp7wxFTIM9mbcgx3kp05B29Qe59woIDKykqwII5g8DXyr9eq3nUR5WzhvU003Fdkg8jxHuAr2MZ0/lv8A1dybK5blbXH2Se5W4/SfKgztKl5DFX+Nk9O7iKa/ZfmjfysOFRKBSlKBSlKBSlKBSlaSxs7bBWiZXJp6l7JxsrQ9h/G/y4efIOdng7Wyt1yOeYxRHjDaD/dl8xzHy10qNk+oru8T9NbgWdio0W3i4aj+IjTXy5VAvr+6yFw1zdPvkbl3KPwqOwVHoFKUoFKUoFKUoFKUoLnHdR3FvH+kvlF9YNwaKTiyj+Fj3d3u0rrkMFBNbHJYNzPac5YDxlh7xpzIHy151Q1Kx2Su8bci4tX2sODKfsuv4WFBFpWiyVha5W0bM4ldrrxvbQc0PMuo7vl31naBSlKBSld7K0lvbuK1h+3KwUeHeT5DjQW3T9hbxxyZrID/AIdp/tIf6svYB36H5/bVZkshcZK7e6uDqzcFXsRRyVfKrPqa8iWSLD2nC0sBtOn3pfvE+I+nWrPCYqyx62pvoRc3+QP5UJGojhI+NmB4fZPH3DtoMfSrTqSOyiy80dkqrEmgZV4KrgfEB7aq6BSlKBSlKBSlekR5HWONS7sdFVRqST2ACg81dY3pTJ5C3W5QxwxPxQyEgsO8BVPDzrvb9KNFELnMXUdjCeSEgufDnpr7/KuPUOcW9ljt7BnjsLZQka8VDFfvaeXLWg4XPTeXt7pbYwGQyHbHInGNv8XZ7dK8SdP5qONZGs5drAngNxGneq6ke2j5/KyWX6J7h2j3Ah9T6mgBG0sOJU69tcLbJX9rKk0E7q0Z1UEkr4jaeFB7xWTnxd4tzDxHKWPsdO1TU3qHGwR+llLDjj734lA/pv2p4f8AUdlM9BHPBaZq3jEcd6pE6KNFWZCQ2n82h91dem7iO6jnwV2fyLsEwMfuTDiNPPT5vGgoKV0uIJLaeS3lGkkTFHHip0rnQK0HTarZWl9m3Gpt09K31Go9V/8AqPfWfrQZT/h9NY2yHBrotcyd5H3dfYw91BT2cb3V/DGR6jzSqDr94s3HU1tshdpZDJZRdDLFssrUafYIVWOn+J/9NZfpVVbP2gbkC59ojcirPMSifpszj+rkJHb2mXT5tKDLszMxZjqxOpJ5kmvlKUClKUCvqI8jhEUs7EBVA1JJ5ACulvbXF1KsNtG0srclUamtBDfY3pyHZAq3mXIIll5xRE/cB7dO3T39lBHtek7xkE2Qljx8B7ZWG7/LqB7yKmDJYHAKVxafrr4jQ3L/AGV8jw4fy++s5dXdxeTNPcyGSRzqSfoHcK40Em+yF3kJzPdyGR+QHJVHco7KjUpQKUpQay8MV90ZBMrCD9IVBjUfC7qfT953bqy0UskMqTRnbJGwZGHYVOoNXdzKLXpa3spNRcXUpnVOWkQOgZh/FpwqhoL/AKpjjuDaZiEaJfRD1AOyRAAR9XsqgrQWp/W9JXUB4vYTLKg7lfh9bGs/QANToO2r/rDRMhb2q/ZtreOP28fq0qjgGs0YPIsv01b9XknPT+Cx/wDYtBCw1yLTK2twx0VJFDnuVvhb5jV3+meeyyeCAP6q1na5t07ZEHAgf4eI86y9auwkXMrDc2svo5+yTUlvs3CLw+I+R0P9nIMpStBlMbHkS99jU23K6m+x/wDVicHRmVe0a939wz5BB0PAigV3s7Oe+uY7W3XdLIdB3DvJ8BXFVZmCqNWY6ADmSa1B9LpaxYBg+Zu0HcRAh+XtPgKD5fZC3wFs2Ixmj3hGl3edoY81XxHzedZevrMWYsxJYnUk8SSa+UClKUClTrjFTwwwMFaSSaE3ThRqEhP2SfcahvHJGQJFKEgMAwI1B5HjQea2Nta4PDYe1u8nAst3MPURSNzMT8QGh4aAaa61SdMWcF7mIYrhVeJQztG2ujbVOg9/GvXVN813l5UHCK1/IjUchsPxfPQV17eT31zJcztukkOvgB2KPAVwpSgv+ldZRk7PsmtHOnivwj/vqgrQdFf+4ZexoXB8tVrP0H1G2srdxB91XvWSaZkyD7M0SOp7xoV/+NUNX/UQFxjcTkF474PRkP8AFH/fuoKCukE81tKs8DmOVDqrqdCK50oNRaZbHZSRJLyQ43KpoFvovhR+z4+zl3+/sq6/YIcijtkxDOx09G8tgY5HH4nA1Un31+e1MsMvkcc2tpOyL2xn4kPmp4UGjNn0307fiWeaae4i+KOErrt1GobXaFJHnWXvrya+upLqc6ySnU+A5ADyFaTH9YPcTR2uVhie3kO1pNv2deRZW1GlUmcxUmKvngIJhb4oH/Eh+scjQV9K9xSelKkmgbYwbaw1B0OuhFbTKPb2OLiy2FtYEMu0mX0wzxhhw2jTQaHgaCmyOBK4e3y0KmL8tFuYXGwhh+X6i6/iP061U2Fo97eQ2qa6yuFJA10BPFvYK0WSyNxkukYp5GLzLcbLhgAOW8rwXQdq1z6GimN/PMiaoISnqHkGLKVHt0oPea6lltrprHGshs4ESIBkDAPGddV3js0A4/314zY/cen7LNXGgvNxhYqNA673A4eG3X31QXsNzDdyx3alLgMTID3k66+2r+/imh6Lskm0BacPGO3Y4kca+/Wg69GWSRrcZmdgIoFaNfDQB3b2CsxcTG4uJZ24NK7OfNjurSX8n7X0paWS8Jr/APNk0/AdHP0qKy9ApSlBf9Hn07y7uDyhtZG18dV/sqgrQYbW16ey16f6oW2Q/wA3BtP84rP0CtDj/wDyPTN5Y85rFxcwjX7vHdp/q99Z6rLAZEY7JxTOfyX/AC5x2bG5n2HjQVtKsc9jTjclJCo/Jf8AMgPYY25e7lVdQKUpQKu7HKR3lo2Jyrgxkf8AEun4mCQDRQT+H5eUOzweWvQrW9s5RuIkYbEI7wz6A1dw9I2VqA+Zv0h3A6Royp7nk5/5aChyOLu8bKEuFG1xrHKh3RuO9WrR9IX8d1azYS64oysYhy1R/wDcQeWuvvq7sMXjJMX+hWb9fZ6naWZX2eCsgGmlYZ8PloL8wwW8yyK59JgpB0B4MHHD260Gmu8KuN6XvbWWUOA5mRxw7UCgjx0qBhYL6y6dvslAC0kwCQBdSVRWKyOAPlwqf1fOzYOJdw3idI7gKddHEbOVJHjpUebI32Ix2Gtccu4zxiV1K7jIX0fYO3m55UFLaZK2uFS0zKtNAOEdyp/PhH8x13L4H2Vcdaxx29tjLRGJSJWUanjtURqCdKjdQYxbrqKOzsI1SSZEaZVGgRySWZtP4dCatupcdb5S1kltJA93jQVkQHX4dNzKfEdntFBS9ZhhkoQNP04gQW5HFdup5Vn6vLMfu+HfH6a3mP3TWve8TH8yPz14iqOgUpVr05jhfZFTLoLW2HrXDH7O1eIB8z82tBMzQ/b8Hj8Vymk1urgdoLa7QfeR7Kz1TszkDksjNdfcY7YgexF4L/bUGgUpSg0tpt6gw/6BiP3KwG62J5yRfg+r3eNZtlZWKsCGU6EHgQRXS1up7O4jubdtksZ1U/UfA1oMjZwZ61OXxq6XaD/m2g56/jUfLXz1oM1UjHtapewPeAtbK6mUDjqoNR6UG5ydtnLyYZDB3oktSF9KCN9oGgGvA/AePf5VV2nTl7ezuuVjuY7iQ6rd6rInLk4118iDWfgurq2JNvNJCTzMbFNf8pFTIOoM1A25LyVvCRjIPc+tBb5LGW3TzJJEL5gwG64ilWJNfw6rGx99Rn6svI4DDZGRGc/FLPJ67+SaooHuqsyGXyGSYNdzFwAAEHwpw/hHCoqO0brIh2uhDKw5gjiDQbWfGrZ9IzJfaySt/wAhiPtLLIVC89eWuh9tTLKa7j6Zt7pLYy3sMO2GPb8WmvpqQOf2QG8aoU65ySxbXhheQADeQw18Sob6K8t1zlypAigUkaBgr6jx4uaCfDb5HHYK7yzqxytzxkd+DxRk6cu/t93dVN0vk3sssgckxXREUuvex+FvY311Euc1lbtPTnupHTtXXaD5hdKg6kHUc++g01zi8tjOoHucXatJGrl4tEPp6SD4k4acBqRXifD/AK6O+vHtnsZoUaZiHV7dnXi6KAuoJ48N3CqZMpkY3aRLmUO67XbedWXTboe/hUdWfQopOjc1HbQI43ldY41LO5Cqo4kk8ABWiybJg8UuHhYG9ugJL51+6p5R6/Lh516s7eLpu0GRvVDZOZSLS2P9MH77/Lw8s7PPLcTPPMxeWQlnY9pNBzpSlApSlAqTYX91jrlbm1fa68CPusO1WHaKjUoNNNZWHUaNdY3bbZMDdPZsQFkPayH5eOnOs7PBNbytDOjRypwZGGhFeY5JInWSJikinVWU6EEdoIq/i6gs8hEttn4PV0GiXkY0lTz0+r3Ggz1Kv5ulmnQ3GGuEv4PwAhZV8CDw+jyqluLW5tX9O5ieF/wupU/PQcqUpQKUpQKV2trO7u32W0LzN2hFLaeenKrqLphbZBPnLpLKLn6QIeVvAaa/NrQUlta3F3MsFtG0srclUa1oY4Mf0ygmutt3mCNYoBxSEnkzePyHfXC46it7OFrTAwfpYzwe5bjM/wBOny00qhZ2di7kszHVmJ1JJ7SaDteXlxfXDXNy5eV+ZPYO4DsFcKUoFKUoFKs8BPFDfgzxRzW+1jMsiK+iKNxZdwPEc/HlWjy+Mt7K6GStYYTaywSiRDGjRrIkTyROoI0G4qOX10GJpVz0zDDJkkmukSSAuISjqGUvMr7PhPDmtS8zFaYnqMzPAhtniMkcGwGPcY2jUbOX2xrQZulbK5itLfpm0vxawtMDC7sY0+PU/EG4dtdMHHj7uzyVyLaF0SeZrcvEhKoRvUcV7O6gxkM00EgkgkaKQcnQlSPaKuIOrcqielc+neRcis6A/Oumvt1qLFN/4a6BjjLevEokMabwJFlZgG01HGMVqLu0t/2rGXENpC1xM9uZNsKfHvXV9VC8qCl/eenbg63eICHtMDlf9K7K+GTo1+IivI/AFfrZq+dXQYyDIIlgERtv58cem1W14cBwB8Kt7LF2k/TdzB6MZvLdXUyhB6nqACbbu014bttBUiXo1OPo3kngSo+h1r7+9YC3JNph1Y9jTuX/ANLb/pqw6KtrW6trlbm3im9N12F41ZhuB1+IjXsrJSMXkZyACxJIUBRxPYF0AoLi46sy0qelAUtItNAkCheHmdSPZVPLLLM5kldpJG4s7EsT5k1qcDhYb7A3D2/p/r5WKCSRQ2wDT4RqDt1HaBrUe8mGOaJMhYxJdpFONwijMUrvsEUmgG06aceH00GcpW1yMVjY4TGXotYSwaAy6xoS6tGd4bhx1+mvWETG5jHXcKW0CXEZkSOT0k3BJN3pOfh7OXsoMRSr2GZVvsZjXhhLxSol0TDHuZnfYY2JXjtU6Hx8hUjrWC3trq2it4Y4UMZYiNFTUk6cSoHdQZqlbKG1hk6RjuY7aJr3RQjiJCzMJgi/d46jhx59tZ7OSBrpITDHBPbp6VwIVCI0is3xAL4EUHjFC39WY3E624MMiIWDHczqUA+BW76ucfn7V+nrrG37/mpEyW24Ft/wkoOAPFW7/CsxSgtre4trK2s3ilhln9b1ZUYS/ln4Nh4Bddm08tefbU/q6/xeRFvNZTrJLFuR12uCVbQg/EoHAg++s1Sg1V/ksbL0xFj47pWuYlj1Ta/ErzAJSuXTGYsLSyurG7k9EzElJCCV+Jdmh261mqUEx2ihsGtlkWWSaVZH2a6IIhIi8WA13b9eFaS+zON/Z7KCC7V7izMDMFEg3ekArbSUHz1j6UGtzl1gMnfWdwLtVVCPX/LfjGDu0JC8+wDSvvTuesrWS8F9NGnqSbhIiyEysS25zqDz9nlWRpQa/p3JYfFNerJdr6ckv5OiyalF10J+DxrPzxY+PGo0c6zX0km51UMPTj2n4dWABOvOoFKC5s7qO0sIJrC8FrkFZhPGQ22RC3wa/CUO3xrt1PmYMkLSGJhI1upM0ygqjSMF3bA3HThVBSg1WcyeNuen7eygukkuLf0tyhXG7Yuw7SyDv7aidI39nj7uee8nEKNHsVSGJYlgdfhU8tKoKUFu9xanqYXYnU2v6kT+ro2m0N6nLbu17OXOrbLXmDymXtZpbtf0cCfmgrJq53E7BovvrJUoNWuTxo6VXGfqkF0wA02vopaX1OJ2fdB46eyqPL/pTLE8Fx+rldN11MAyhpSza6BgOzSoFKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKBSlKD/2Q\x3d\x3d";var cc=cc||{},ClassManager={id:0|998*Math.random(),instanceId:0|998*Math.random(),compileSuper:function(a,b,c){a=a.toString();var d=a.indexOf("("),e=a.indexOf(")"),d=a.substring(d+1,e),d=d.trim(),e=a.indexOf("{"),f=a.lastIndexOf("}");for(a=a.substring(e+1,f);-1!==a.indexOf("this._super");){var e=a.indexOf("this._super"),f=a.indexOf("(",e),g=a.indexOf(")",f),g=a.substring(f+1,g),g=(g=g.trim())?",":"";a=a.substring(0,e)+"ClassManager["+c+"]."+b+".call(this"+g+a.substring(f+1)}return Function(d,a)}, getNewID:function(){return this.id++},getNewInstanceId:function(){return this.instanceId++}};ClassManager.compileSuper.ClassManager=ClassManager; (function(){var a=/\b_super\b/,b=cc.game.config[cc.game.CONFIG_KEY.classReleaseMode];b&&console.log("release Mode");cc.Class=function(){};cc.Class.extend=function(c){function d(){this.__instanceId=ClassManager.getNewInstanceId();this.ctor&&this.ctor.apply(this,arguments)}var e=this.prototype,f=Object.create(e),g=ClassManager.getNewID();ClassManager[g]=e;var h={writable:!0,enumerable:!1,configurable:!0};f.__instanceId=null;d.id=g;h.value=g;Object.defineProperty(f,"__pid",h);d.prototype=f;h.value=d; Object.defineProperty(d.prototype,"constructor",h);this.__getters__&&(d.__getters__=cc.clone(this.__getters__));this.__setters__&&(d.__setters__=cc.clone(this.__setters__));for(var k=0,m=arguments.length;k=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.widtha?0:a};a._getG=function(){return this._gU8[0]};a._setG=function(a){this._gU8[0]=0>a?0:a};a._getB=function(){return this._bU8[0]};a._setB=function(a){this._bU8[0]=0>a?0:a};a._getA= function(){return this._aU8[0]};a._setA=function(a){this._aU8[0]=0>a?0:a};cc.defineGetterSetter(a,"r",a._getR,a._setR);cc.defineGetterSetter(a,"g",a._getG,a._setG);cc.defineGetterSetter(a,"b",a._getB,a._setB);cc.defineGetterSetter(a,"a",a._getA,a._setA);cc.Vertex2F=function(a,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Vertex2F.BYTES_PER_ELEMENT);this._offset=e||0;this._xF32=new Float32Array(this._arrayBuffer,this._offset,1);this._yF32=new Float32Array(this._arrayBuffer,this._offset+4,1);this._xF32[0]= a||0;this._yF32[0]=c||0};cc.Vertex2F.BYTES_PER_ELEMENT=8;a=cc.Vertex2F.prototype;a._getX=function(){return this._xF32[0]};a._setX=function(a){this._xF32[0]=a};a._getY=function(){return this._yF32[0]};a._setY=function(a){this._yF32[0]=a};cc.defineGetterSetter(a,"x",a._getX,a._setX);cc.defineGetterSetter(a,"y",a._getY,a._setY);cc.Vertex3F=function(a,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Vertex3F.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;this._xF32=new Float32Array(e, f,1);this._xF32[0]=a||0;this._yF32=new Float32Array(e,f+Float32Array.BYTES_PER_ELEMENT,1);this._yF32[0]=c||0;this._zF32=new Float32Array(e,f+2*Float32Array.BYTES_PER_ELEMENT,1);this._zF32[0]=d||0};cc.Vertex3F.BYTES_PER_ELEMENT=12;a=cc.Vertex3F.prototype;a._getX=function(){return this._xF32[0]};a._setX=function(a){this._xF32[0]=a};a._getY=function(){return this._yF32[0]};a._setY=function(a){this._yF32[0]=a};a._getZ=function(){return this._zF32[0]};a._setZ=function(a){this._zF32[0]=a};cc.defineGetterSetter(a, "x",a._getX,a._setX);cc.defineGetterSetter(a,"y",a._getY,a._setY);cc.defineGetterSetter(a,"z",a._getZ,a._setZ);cc.Tex2F=function(a,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Tex2F.BYTES_PER_ELEMENT);this._offset=e||0;this._uF32=new Float32Array(this._arrayBuffer,this._offset,1);this._vF32=new Float32Array(this._arrayBuffer,this._offset+4,1);this._uF32[0]=a||0;this._vF32[0]=c||0};cc.Tex2F.BYTES_PER_ELEMENT=8;a=cc.Tex2F.prototype;a._getU=function(){return this._uF32[0]};a._setU=function(a){this._uF32[0]= a};a._getV=function(){return this._vF32[0]};a._setV=function(a){this._vF32[0]=a};cc.defineGetterSetter(a,"u",a._getU,a._setU);cc.defineGetterSetter(a,"v",a._getV,a._setV);cc.Quad2=function(a,c,d,e,f,g){this._arrayBuffer=f||new ArrayBuffer(cc.Quad2.BYTES_PER_ELEMENT);this._offset=g||0;f=this._arrayBuffer;g=cc.Vertex2F.BYTES_PER_ELEMENT;this._tl=a?new cc.Vertex2F(a.x,a.y,f,0):new cc.Vertex2F(0,0,f,0);this._tr=c?new cc.Vertex2F(c.x,c.y,f,g):new cc.Vertex2F(0,0,f,g);this._bl=d?new cc.Vertex2F(d.x,d.y, f,2*g):new cc.Vertex2F(0,0,f,2*g);this._br=e?new cc.Vertex2F(e.x,e.y,f,3*g):new cc.Vertex2F(0,0,f,3*g)};cc.Quad2.BYTES_PER_ELEMENT=32;a=cc.Quad2.prototype;a._getTL=function(){return this._tl};a._setTL=function(a){this._tl.x=a.x;this._tl.y=a.y};a._getTR=function(){return this._tr};a._setTR=function(a){this._tr.x=a.x;this._tr.y=a.y};a._getBL=function(){return this._bl};a._setBL=function(a){this._bl.x=a.x;this._bl.y=a.y};a._getBR=function(){return this._br};a._setBR=function(a){this._br.x=a.x;this._br.y= a.y};cc.defineGetterSetter(a,"tl",a._getTL,a._setTL);cc.defineGetterSetter(a,"tr",a._getTR,a._setTR);cc.defineGetterSetter(a,"bl",a._getBL,a._setBL);cc.defineGetterSetter(a,"br",a._getBR,a._setBR);cc.Quad3=function(a,c,d,e){this.bl=a||new cc.Vertex3F(0,0,0);this.br=c||new cc.Vertex3F(0,0,0);this.tl=d||new cc.Vertex3F(0,0,0);this.tr=e||new cc.Vertex3F(0,0,0)};cc.V3F_C4B_T2F=function(a,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V3F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer; f=this._offset;var g=cc.Vertex3F.BYTES_PER_ELEMENT;this._vertices=a?new cc.Vertex3F(a.x,a.y,a.z,e,f):new cc.Vertex3F(0,0,0,e,f);this._colors=c?cc.color(c.r,c.g,c.b,c.a,e,f+g):cc.color(0,0,0,0,e,f+g);this._texCoords=d?new cc.Tex2F(d.u,d.v,e,f+g+cc.Color.BYTES_PER_ELEMENT):new cc.Tex2F(0,0,e,f+g+cc.Color.BYTES_PER_ELEMENT)};cc.V3F_C4B_T2F.BYTES_PER_ELEMENT=24;a=cc.V3F_C4B_T2F.prototype;a._getVertices=function(){return this._vertices};a._setVertices=function(a){var c=this._vertices;c.x=a.x;c.y=a.y;c.z= a.z};a._getColor=function(){return this._colors};a._setColor=function(a){var c=this._colors;c.r=a.r;c.g=a.g;c.b=a.b;c.a=a.a};a._getTexCoords=function(){return this._texCoords};a._setTexCoords=function(a){this._texCoords.u=a.u;this._texCoords.v=a.v};cc.defineGetterSetter(a,"vertices",a._getVertices,a._setVertices);cc.defineGetterSetter(a,"colors",a._getColor,a._setColor);cc.defineGetterSetter(a,"texCoords",a._getTexCoords,a._setTexCoords);cc.V3F_C4B_T2F_Quad=function(a,c,d,e,f,g){this._arrayBuffer= f||new ArrayBuffer(cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT);this._offset=g||0;f=this._arrayBuffer;g=this._offset;var h=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._tl=a?new cc.V3F_C4B_T2F(a.vertices,a.colors,a.texCoords,f,g):new cc.V3F_C4B_T2F(null,null,null,f,g);this._bl=c?new cc.V3F_C4B_T2F(c.vertices,c.colors,c.texCoords,f,g+h):new cc.V3F_C4B_T2F(null,null,null,f,g+h);this._tr=d?new cc.V3F_C4B_T2F(d.vertices,d.colors,d.texCoords,f,g+2*h):new cc.V3F_C4B_T2F(null,null,null,f,g+2*h);this._br=e?new cc.V3F_C4B_T2F(e.vertices, e.colors,e.texCoords,f,g+3*h):new cc.V3F_C4B_T2F(null,null,null,f,g+3*h)};cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT=96;a=cc.V3F_C4B_T2F_Quad.prototype;a._getTL=function(){return this._tl};a._setTL=function(a){var c=this._tl;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords};a._getBL=function(){return this._bl};a._setBL=function(a){var c=this._bl;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords};a._getTR=function(){return this._tr};a._setTR=function(a){var c=this._tr;c.vertices= a.vertices;c.colors=a.colors;c.texCoords=a.texCoords};a._getBR=function(){return this._br};a._setBR=function(a){var c=this._br;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords};a._getArrayBuffer=function(){return this._arrayBuffer};cc.defineGetterSetter(a,"tl",a._getTL,a._setTL);cc.defineGetterSetter(a,"tr",a._getTR,a._setTR);cc.defineGetterSetter(a,"bl",a._getBL,a._setBL);cc.defineGetterSetter(a,"br",a._getBR,a._setBR);cc.defineGetterSetter(a,"arrayBuffer",a._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 c=a.tl,d=a.bl,e=a.tr;a=a.br;return{tl:{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}},bl:{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}}, tr:{vertices:{x:e.vertices.x,y:e.vertices.y,z:e.vertices.z},colors:{r:e.colors.r,g:e.colors.g,b:e.colors.b,a:e.colors.a},texCoords:{u:e.texCoords.u,v:e.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 c=[],d=0;d>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;bMath.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){this._setupContainer(a,a._frameSize.width,a._frameSize.height)}}),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,t=c/n,r=d/p,v,s;t>=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}};var _p=cc.inputManager;_p.setAccelerometerEnabled=function(a){this._accelEnabled!==a&&(this._accelEnabled=a,a=cc.director.getScheduler(),this._accelCurTime=0,a.scheduleUpdate(this))};_p.setAccelerometerInterval=function(a){this._accelInterval!==a&&(this._accelInterval=a)}; _p._registerKeyboardEvent=function(){cc._addEventListener(cc._canvas,"keydown",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!0));a.stopPropagation();a.preventDefault()},!1);cc._addEventListener(cc._canvas,"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;cc._addEventListener(a,b,this.didAccelerate.bind(this), !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);cc.sys.os===cc.sys.OS_ANDROID?(c.x=-d,c.y=-e):(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.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){cc.pMultIn(a,1/Math.sqrt(a.x*a.x+a.y*a.y))};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||1h.getLocalZOrder())this._visitTarget(h,!1);else break;null!=g[a.__instanceId]&&(f[a.getGlobalZOrder()]||(f[a.getGlobalZOrder()]=[]),f[a.getGlobalZOrder()].push(a.__instanceId));for(;dh&&-1E-6k&&-1E-6e._localZOrder)e._renderCmd.visit(this);else break;for(cc.renderer.pushRenderCommand(this);ca[c]._localZOrder)a[c]._renderCmd.visit(this);else break;for(cc.renderer.pushRenderCommand(this);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._textureLoaded= !0)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(a){a=void 0===a?!1:a;if(cc._rendererInitialized){if(!this._htmlElementObj){var b=cc.loader.getRes(this.url);if(!b)return;this.initWithElement(b)}this._htmlElementObj.width&&this._htmlElementObj.height&&(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,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.removeEventListener("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);cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);d.bindBuffer(d.ARRAY_BUFFER,this._quadsWebBuffer);this.dirty&&(d.bufferData(d.ARRAY_BUFFER,this._quadsArrayBuffer,d.DYNAMIC_DRAW),this.dirty=!1);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){var c=this._textures,d;cc._rendererInitialized||(c=this._loadedTexturesBefore);d=c[a];d||(d=c[a]=new cc.Texture2D,d.url=a);".png"===cc.path.extname(a)?d.handleLoadedTexture(!0):d.handleLoadedTexture()};a.addImage=function(a,c,d){cc.assert(a,cc._LogInfos.Texture2D_addImage_2);var e=this._textures;cc._rendererInitialized||(e=this._loadedTexturesBefore);var f=e[a]||e[cc.loader._aliases[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;(cc.loader._checkIsImageURL(a)?cc.loader.load:cc.loader.loadImg).call(cc.loader,a,function(f,h){if(f)return c&&c.call(d,f);cc.textureCache.handleLoadedTexture(a);var k=e[a];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._renderType===cc._RENDER_TYPE_CANVAS?(cc.Texture2D=cc.Class.extend({_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=""},getPixelsWide:function(){return this._contentSize.width},getPixelsHigh:function(){return this._contentSize.height},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._contentSize.width=a.width,this._contentSize.height=a.height,this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(){if(!this._textureLoaded){if(!this._htmlElementObj){var a= cc.loader.getRes(this.url);if(!a)return;this.initWithElement(a)}a=this._htmlElementObj;this._contentSize.width=a.width;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,b,c,d,e){return!1},initWithImage:function(a){return!1},initWithString:function(a,b,c,d,e,f){return!1},releaseTexture:function(){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,b){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,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData);return!1},setTexParameters:function(a,b,c,d){void 0!==b&&(a={minFilter:a,magFilter:b,wrapS:c,wrapT:d});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,b){this.addEventListener("load",a,b)},removeLoadedEventListener:function(a){this.removeEventListener("load",a)},_grayElementObj:null,_backupElement:null,_isGray:!1,_switchToGray:function(a){this._textureLoaded&&this._isGray!==a&&((this._isGray=a)?(this._backupElement=this._htmlElementObj,this._grayElementObj||(this._grayElementObj=cc.Texture2D._generateGrayTexture(this._htmlElementObj)),this._htmlElementObj=this._grayElementObj):null!==this._backupElement&&(this._htmlElementObj= this._backupElement))}}),cc.Texture2D._generateGrayTexture=function(a,b,c){if(null===a)return null;c=c||cc.newElement("canvas");b=b||cc.rect(0,0,a.width,a.height);c.width=b.width;c.height=b.height;var d=c.getContext("2d");d.drawImage(a,b.x,b.y,b.width,b.height,0,0,b.width,b.height);a=d.getImageData(0,0,b.width,b.height);b=a.data;for(var e=0,f=b.length;ethis._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(a=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){cc.Node.CanvasRenderCmd.call(this,a);this._isBaked=!1;this._bakeSprite=null;this._updateCache=2};var a=cc.Layer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=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.transform=function(a, c){var d=this._worldTransform,e=d.a,f=d.b,g=d.c,h=d.d;cc.Node.CanvasRenderCmd.prototype.transform.call(this,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;cf._localZOrder)f._renderCmd.visit(this);else break;for(cc.renderer.pushRenderCommand(this);ae;e++)d[e].r=a.r,d[e].g=a.g,d[e].b=a.b,d[e].a= c;this._bindLayerColorsBufferData()};a._bindLayerVerticesBufferData=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._verticesFloat32Buffer);a.bufferData(a.ARRAY_BUFFER,this._squareVerticesAB,a.STATIC_DRAW)};a._bindLayerColorsBufferData=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._colorsUint8Buffer);a.bufferData(a.ARRAY_BUFFER,this._squareColorsAB,a.STATIC_DRAW)};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);cc.inject(cc.LayerGradient.RenderCmd,a);a.constructor=cc.LayerGradient.WebGLRenderCmd;a._syncStatus=function(a){var c=cc.Node._dirtyFlags,d=this._dirtyFlag,e=a?a._node:null;e&&e._cascadeColorEnabled&&a._dirtyFlag&c.colorDirty&&(d|= c.colorDirty);e&&e._cascadeOpacityEnabled&&a._dirtyFlag&c.opacityDirty&&(d|=c.opacityDirty);a&&a._dirtyFlag&c.transformDirty&&(d|=c.transformDirty);var e=d&c.colorDirty,f=d&c.opacityDirty;this._dirtyFlag=d;e&&this._syncDisplayColor();f&&this._syncDisplayOpacity();this.transform(a);(e||f||d&c.gradientDirty)&&this._updateColor()};a._updateColor=function(){this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.gradientDirty;var a=this._node,c=a._colorStops;if(c&&!(2>c.length)){this._clippingRectDirty= !0;var d=c.length,e=2*d,f,g=a._contentSize;this._squareVerticesAB=new ArrayBuffer(8*e);this._squareColorsAB=new ArrayBuffer(4*e);var h=this._squareVertices,k=this._squareColors;h.length=0;k.length=0;var m=this._squareVerticesAB,n=this._squareColorsAB,p=cc.Vertex2F.BYTES_PER_ELEMENT,t=cc.Color.BYTES_PER_ELEMENT;for(f=0;ff?(p=cc.p(-a.x,a.y),f=cc.p(a.x,a.y)):180>f?(p=cc.p(a.x,a.y),f=cc.p(a.x,-a.y)):270>f?(p=cc.p(a.x,-a.y),f=cc.p(-a.x,-a.y)):(p=cc.p(-a.x,-a.y),f=cc.p(-a.x,a.y));m=Math.sin(n);n=Math.cos(n);p=Math.abs((p.x*n-p.y*m)/a.x);f=Math.abs((f.x*m+f.y*n)/a.y);e=cc.affineTransformScale(e,p,f);for(f=0;fa.width&&cc.error(cc._LogInfos.RectWidth,a.url),d>a.height&&cc.error(cc._LogInfos.RectHeight, a.url));this._node._originalTexture=a};a.rendering=function(a,c,d){var e=this._node,f=this._textureCoord,g=this._displayedOpacity/255;if((!e._texture||0!==f.width&&0!==f.height&&e._texture._textureLoaded)&&0!==g){a=a||cc._renderContext;var h=a.getContext(),k=e._offsetPosition.x,m=e._rect.height,n=e._rect.width,p=-e._offsetPosition.y-m;a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(g);(e._flippedX||e._flippedY)&&a.save();e._flippedX&&(k=-k-n,h.scale(-1, 1));e._flippedY&&(p=e._offsetPosition.y,h.scale(1,-1));e._texture?(g=e._texture._htmlElementObj,""!==e._texture._pattern?(a.setFillStyle(h.createPattern(g,e._texture._pattern)),h.fillRect(k*c,p*d,n*c,m*d)):this._colorized?h.drawImage(g,0,0,f.width,f.height,k*c,p*d,n*c,m*d):h.drawImage(g,f.renderX,f.renderY,f.width,f.height,k*c,p*d,n*c,m*d)):(g=e._contentSize,f.validRect&&(f=this._displayedColor,a.setFillStyle("rgba("+f.r+","+f.g+","+f.b+",1)"),h.fillRect(k*c,p*d,g.width*c,g.height*d)));(e._flippedX|| e._flippedY)&&a.restore();cc.g_NumberOfDraws++}};a._updateColor=cc.sys._supportCanvasNewBlendModes?function(){var a=this._node,c=this._displayedColor;if(255===c.r&&255===c.g&&255===c.b)this._setOriginalTexture();else{var d,e=a._texture,f=this._textureCoord;e&&f.validRect&&this._originalTexture&&(d=e.getHtmlElementObj())&&(this._colorized=!0,d instanceof HTMLCanvasElement&&!this._rectRotated&&!this._newTextureWhenChangeColor&&this._originalTexture._htmlElementObj!==d?cc.Sprite.CanvasRenderCmd._generateTintImageWithMultiply(this._originalTexture._htmlElementObj, c,f,d):(d=cc.Sprite.CanvasRenderCmd._generateTintImageWithMultiply(this._originalTexture._htmlElementObj,c,f),e=new cc.Texture2D,e.initWithElement(d),e.handleLoadedTexture(),a.setTexture(e)))}}:function(){var a=this._node,c=this._displayedColor;if(255===c.r&&255===c.g&&255===c.b)this._setOriginalTexture();else{var d,e=a._texture,f=this._textureCoord;e&&f.validRect&&this._originalTexture&&(d=e.getHtmlElementObj())&&(e=cc.textureCache.getTextureColors(this._originalTexture.getHtmlElementObj()))&&(this._colorized= !0,d instanceof HTMLCanvasElement&&!this._rectRotated&&!this._newTextureWhenChangeColor?cc.Sprite.CanvasRenderCmd._generateTintImage(d,e,c,f,d):(d=cc.Sprite.CanvasRenderCmd._generateTintImage(d,e,c,f),e=new cc.Texture2D,e.initWithElement(d),e.handleLoadedTexture(),a.texture=e))}};a._setOriginalTexture=function(){if(this._colorized){this._colorized=!1;var a=this._node,c=cc.rect(a._rect),d=cc.size(a._contentSize),e=a._rectRotated;a.setTexture(this._originalTexture);a.setTextureRect(c,e,d)}};a.getQuad= function(){return null};a._updateForSetSpriteFrame=function(a,c){this._originalTexture=a;this._colorized=!1;this._textureCoord.renderX=this._textureCoord.x;this._textureCoord.renderY=this._textureCoord.y;if(c=c||a._textureLoaded){var d=this._node.getColor();255===d.r&&255===d.g&&255===d.b||this._updateColor()}};a.updateTransform=function(){var a=this._node;if(a.dirty){var c=a._parent;!a._visible||c&&c!==a._batchNode&&c._shouldBeHidden?a._shouldBeHidden=!0:(a._shouldBeHidden=!1,a._transformToBatch= c&&c!==a._batchNode?cc.affineTransformConcat(this.getNodeToParentTransform(),c._transformToBatch):this.getNodeToParentTransform());a._recursiveDirty=!1;a.dirty=!1}a._hasChildren&&a._arrayMakeObjectsPerformSelector(a._children,cc.Node._stateCallbackType.updateTransform)};a._updateDisplayColor=function(a){cc.Node.CanvasRenderCmd.prototype._updateDisplayColor.call(this,a)};a._spriteFrameLoadedCallback=function(a){this.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize());this._renderCmd._updateColor(); this.dispatchEvent("load")};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=d._originalTexture=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._generateTintImageWithMultiply=function(a,c,d,e){e=e||cc.newElement("canvas");d=d||cc.rect(0,0,a.width,a.height);var f=e.getContext("2d");e.width!==d.width||e.height!==d.height?(e.width=d.width,e.height=d.height):f.globalCompositeOperation="source-over";f.fillStyle="rgb("+(0|c.r)+ ","+(0|c.g)+","+(0|c.b)+")";f.fillRect(0,0,d.width,d.height);f.globalCompositeOperation="multiply";f.drawImage(a,d.x,d.y,d.width,d.height,0,0,d.width,d.height);f.globalCompositeOperation="destination-atop";f.drawImage(a,d.x,d.y,d.width,d.height,0,0,d.width,d.height);return e};cc.Sprite.CanvasRenderCmd._generateTintImage=function(a,c,d,e,f){e||(e=cc.rect(0,0,a.width,a.height));a=d.r/255;var g=d.g/255;d=d.b/255;var h=Math.min(e.width,c[0].width),k=Math.min(e.height,c[0].height),m;f?(m=f.getContext("2d"), m.clearRect(0,0,h,k)):(f=cc.newElement("canvas"),f.width=h,f.height=k,m=f.getContext("2d"));m.save();m.globalCompositeOperation="lighter";var n=m.globalAlpha;0a+g+d&&(m.globalAlpha=n,m.drawImage(c[3],e.x,e.y,h,k,0,0,h,k));m.restore();return f};cc.Sprite.CanvasRenderCmd._generateTextureCacheForColor=function(a){function c(){var c= cc.Sprite.CanvasRenderCmd._generateTextureCacheForColor,e=a.width,h=a.height;d[0].width=e;d[0].height=h;d[1].width=e;d[1].height=h;d[2].width=e;d[2].height=h;d[3].width=e;d[3].height=h;c.canvas.width=e;c.canvas.height=h;var k=c.canvas.getContext("2d");k.drawImage(a,0,0);c.tempCanvas.width=e;c.tempCanvas.height=h;for(var k=k.getImageData(0,0,e,h).data,m=0;4>m;m++){var n=d[m].getContext("2d");n.getImageData(0,0,e,h).data;c.tempCtx.drawImage(a,0,0);for(var p=c.tempCtx.getImageData(0,0,e,h),t=p.data, r=0;ra.width&&cc.error(cc._LogInfos.RectWidth,a.url),c>a.height&&cc.error(cc._LogInfos.RectHeight,a.url))};a.rendering=function(a){var c=this._node,d=c._texture;d&&!d._textureLoaded||0===this._displayedOpacity||(a=a||cc._renderContext,d?d._textureLoaded&&(this._shaderProgram.use(),this._shaderProgram._setUniformForMVPMatrixWithMat4(this._stackMatrix), cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst),cc.glBindTexture2DN(0,d),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX),a.bindBuffer(a.ARRAY_BUFFER,this._quadWebBuffer),this._quadDirty&&(a.bufferData(a.ARRAY_BUFFER,this._quad.arrayBuffer,a.DYNAMIC_DRAW),this._quadDirty=!1),a.vertexAttribPointer(0,3,a.FLOAT,!1,24,0),a.vertexAttribPointer(1,4,a.UNSIGNED_BYTE,!0,24,12),a.vertexAttribPointer(2,2,a.FLOAT,!1,24,16),a.drawArrays(a.TRIANGLE_STRIP,0,4)):(this._shaderProgram.use(),this._shaderProgram._setUniformForMVPMatrixWithMat4(this._stackMatrix), cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst),cc.glBindTexture2D(null),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_COLOR),a.bindBuffer(a.ARRAY_BUFFER,this._quadWebBuffer),this._quadDirty&&(a.bufferData(a.ARRAY_BUFFER,this._quad.arrayBuffer,a.STATIC_DRAW),this._quadDirty=!1),a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,24,0),a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,24,12),a.drawArrays(a.TRIANGLE_STRIP,0,4)),cc.g_NumberOfDraws++, 0===cc.SPRITE_DEBUG_DRAW&&!c._showNode)||(cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW),cc.current_stack.stack.push(cc.current_stack.top),cc.current_stack.top=this._stackMatrix,1===cc.SPRITE_DEBUG_DRAW||c._showNode?(c=this._quad,c=[cc.p(c.tl.vertices.x,c.tl.vertices.y),cc.p(c.bl.vertices.x,c.bl.vertices.y),cc.p(c.br.vertices.x,c.br.vertices.y),cc.p(c.tr.vertices.x,c.tr.vertices.y)],cc._drawingUtil.drawPoly(c,4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(d=c.getTextureRect(),c=c.getOffsetPosition(),c=[cc.p(c.x,c.y),cc.p(c.x+ d.width,c.y),cc.p(c.x+d.width,c.y+d.height),cc.p(c.x,c.y+d.height)],cc._drawingUtil.drawPoly(c,4,!0)),cc.current_stack.top=cc.current_stack.stack.pop())}})();cc.SpriteBatchNode=cc.Node.extend({_blendFunc:null,_descendants:null,_className:"SpriteBatchNode",ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._descendants=[];this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);var c;b=b||cc.SpriteBatchNode.DEFAULT_CAPACITY;cc.isString(a)?(c=cc.textureCache.getTextureForKey(a))||(c=cc.textureCache.addImage(a)):a instanceof cc.Texture2D&&(c=a);c&&this.initWithTexture(c,b)},addSpriteWithoutQuad:function(a,b,c){cc.assert(a,cc._LogInfos.SpriteBatchNode_addSpriteWithoutQuad_2); if(!(a instanceof cc.Sprite))return cc.log(cc._LogInfos.SpriteBatchNode_addSpriteWithoutQuad),null;a.atlasIndex=b;var d=0,e,f=this._descendants;if(f&&0=b)break}f.splice(d,0,a);cc.Node.prototype.addChild.call(this,a,b,c);this.reorderBatch(!1);return this},getTextureAtlas:function(){return this._renderCmd.getTextureAtlas()},setTextureAtlas:function(a){this._renderCmd.getTextureAtlas(a)},getDescendants:function(){return this._descendants}, initWithFile:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},_setNodeDirtyForCache:function(){this._renderCmd&&this._renderCmd._setNodeDirtyForCache&&this._renderCmd._setNodeDirtyForCache()},init:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},increaseAtlasCapacity:function(){this._renderCmd.increaseAtlasCapacity()},removeChildAtIndex:function(a, b){this.removeChild(this._children[a],b)},rebuildIndexInOrder:function(a,b){var c=a.children;if(c&&0e.zIndex&&(b=this.rebuildIndexInOrder(e,b))}!a===this&&(a.atlasIndex=b,b++);if(c&&0b?c.atlasIndex:c.atlasIndex+1:0>f.zIndex&&0>b||0<=f.zIndex&&0<=b?this.highestAtlasIndexInChild(f)+1:c.atlasIndex+1},reorderBatch:function(a){this._reorderChildDirty=a},setBlendFunc:function(a,b){this._blendFunc=void 0===b?a:{src:a, dst:b}},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},reorderChild:function(a,b){cc.assert(a,cc._LogInfos.SpriteBatchNode_reorderChild_2);-1===this._children.indexOf(a)?cc.log(cc._LogInfos.SpriteBatchNode_reorderChild):b!==a.zIndex&&cc.Node.prototype.reorderChild.call(this,a,b)},removeChild:function(a,b){null!=a&&(-1===this._children.indexOf(a)?cc.log(cc._LogInfos.SpriteBatchNode_removeChild):(this.removeSpriteFromAtlas(a),cc.Node.prototype.removeChild.call(this, a,b)))},updateQuadFromSprite:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite_2);a instanceof cc.Sprite?(this._renderCmd.checkAtlasCapacity(),a.batchNode=this,a.atlasIndex=b,a.dirty=!0,a.updateTransform()):cc.log(cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite)},insertQuadFromSprite:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_insertQuadFromSprite_2);a instanceof cc.Sprite?(this._renderCmd.insertQuad(a,b),a.batchNode=this,a.atlasIndex=b,a.dirty=!0,a.updateTransform(), this._renderCmd.cutting(a,b)):cc.log(cc._LogInfos.CCSpriteBatchNode_insertQuadFromSprite)},initWithTexture:function(a,b){this._children.length=0;this._descendants.length=0;b=b||cc.SpriteBatchNode.DEFAULT_CAPACITY;this._renderCmd.initWithTexture(a,b);return!0},insertChild:function(a,b){a.batchNode=this;a.atlasIndex=b;a.dirty=!0;this._renderCmd.insertQuad(a,b);this._descendants.splice(b,0,a);var c=b+1,d=this._descendants;if(d&&0d[e]._localZOrder)c.push(d[e]);else break;for(c.push(a);e=c.capacity||c.capacity===c.totalQuads;)this.increaseAtlasCapacity()};a.increaseAtlasCapacity=function(){var a=this._textureAtlas.capacity,c=Math.floor(4*(a+1)/3);cc.log(cc._LogInfos.SpriteBatchNode_increaseAtlasCapacity,a,c);this._textureAtlas.resizeCapacity(c)|| cc.log(cc._LogInfos.SpriteBatchNode_increaseAtlasCapacity_2)};a.initWithTexture=function(a,c){this._textureAtlas=new cc.TextureAtlas;this._textureAtlas.initWithTexture(a,c);this._updateBlendFunc();this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)};a.insertQuad=function(a,c){var d=this._textureAtlas;d.totalQuads>=d.capacity&&this.increaseAtlasCapacity();d.insertQuad(a.quad,c)};a.removeQuadAtIndex=function(a){this._textureAtlas.removeQuadAtIndex(a)};a.getTexture=function(){return this._textureAtlas.texture}; a.setTexture=function(a){this._textureAtlas.setTexture(a);a&&this._updateBlendFunc()};a.removeAllQuads=function(){this._textureAtlas.removeAllQuads()};a._swap=function(a,c){var d=this._node._descendants,e=this._textureAtlas,f=e.quads,g=d[a],h=cc.V3F_C4B_T2F_QuadCopy(f[a]);d[c].atlasIndex=a;d[a]=d[c];e.updateQuad(f[c],a);d[c]=g;e.updateQuad(h,c)};a._updateAtlasIndex=function(a,c){var d=0,e=a.children;e&&(d=e.length);var f=0;if(0===d)f=a.atlasIndex,a.atlasIndex=c,a.arrivalOrder=0,f!==c&&this._swap(f, c),c++;else{f=!0;0<=e[0].zIndex&&(f=a.atlasIndex,a.atlasIndex=c,a.arrivalOrder=0,f!==c&&this._swap(f,c),c++,f=!1);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,f.rect,f.rotated,f.offset,f.size);if(f=f.aliases)for(var h=0,k=f.length;hcc.DIRECTOR_FPS_INTERVAL&&(this._SPFLabel.string=this._secondsPerFrame.toFixed(3),this._frameRate=this._frames/this._accumDt,this._accumDt=this._frames=0,this._FPSLabel.string=this._frameRate.toFixed(1),this._drawsLabel.string=(0|cc.g_NumberOfDraws).toString()),this._FPSLabel.visit(),this._SPFLabel.visit(),this._drawsLabel.visit()):this._createStatsLabel();cc.g_NumberOfDraws=0},isSendCleanupToScene:function(){return this._sendCleanupToScene}, getRunningScene:function(){return this._runningScene},getAnimationInterval:function(){return this._animationInterval},isDisplayStats:function(){return this._displayStats},setDisplayStats:function(a){this._displayStats=a},getSecondsPerFrame:function(){return this._secondsPerFrame},isNextDeltaTimeZero:function(){return this._nextDeltaTimeZero},isPaused:function(){return this._paused},getTotalFrames:function(){return this._totalFrames},popToRootScene:function(){this.popToSceneStackLevel(1)},popToSceneStackLevel:function(a){cc.assert(this._runningScene, cc._LogInfos.Director_popToSceneStackLevel_2);var b=this._scenesStack,c=b.length;if(0===c)this.end();else if(!(a>c)){for(;c>a;){var d=b.pop();d.running&&(d.onExitTransitionDidStart(),d.onExit());d.cleanup();c--}this._nextScene=b[b.length-1];this._sendCleanupToScene=!1}},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},_createStatsLabel:null,_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3}});cc.Director.EVENT_PROJECTION_CHANGED="director_projection_changed";cc.Director.EVENT_AFTER_DRAW="director_after_draw";cc.Director.EVENT_AFTER_VISIT="director_after_visit";cc.Director.EVENT_AFTER_UPDATE="director_after_update"; 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._renderType===cc._RENDER_TYPE_CANVAS?(_p=cc.Director.prototype,_p.setProjection=function(a){this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged)},_p.setDepthTest=function(){},_p.setClearColor=function(a){cc.renderer._clearColor=a;cc.renderer._clearFillStyle="rgb("+a.r+","+a.g+","+a.b+")"},_p.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)}, _p._createStatsLabel=function(){var a=0,a=this._winSizeInPoints.width>this._winSizeInPoints.height?0|this._winSizeInPoints.height/320*24:0|this._winSizeInPoints.width/320*24;this._FPSLabel=new cc.LabelTTF("000.0","Arial",a);this._SPFLabel=new cc.LabelTTF("0.000","Arial",a);this._drawsLabel=new cc.LabelTTF("0000","Arial",a);a=cc.DIRECTOR_STATS_POSITION;this._drawsLabel.setPosition(this._drawsLabel.width/2+a.x,5*this._drawsLabel.height/2+a.y);this._SPFLabel.setPosition(this._SPFLabel.width/2+a.x,3* this._SPFLabel.height/2+a.y);this._FPSLabel.setPosition(this._FPSLabel.width/2+a.x,this._FPSLabel.height/2+a.y)},_p.getVisibleSize=function(){return this.getWinSize()},_p.getVisibleOrigin=function(){return cc.p(0,0)}):(cc.Director._fpsImage=new Image,cc._addEventListener(cc.Director._fpsImage,"load",function(){cc.Director._fpsImageLoaded=!0}),cc._fpsImage&&(cc.Director._fpsImage.src=cc._fpsImage));cc._renderType===cc._RENDER_TYPE_WEBGL&&function(){cc.DirectorDelegate=cc.Class.extend({updateProjection:function(){}});var a=cc.Director.prototype;a.setProjection=function(a){var c=this._winSizeInPoints;this.setViewport();var d=this._openGLView,e=d._viewPortRect.x/d._scaleX,f=d._viewPortRect.y/d._scaleY;switch(a){case cc.Director.PROJECTION_2D:cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();d=cc.math.Matrix4.createOrthographicProjection(-e,c.width-e,-f,c.height-f,-1024,1024);cc.kmGLMultMatrix(d); cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();break;case cc.Director.PROJECTION_3D:var g=this.getZEye(),h=new cc.math.Matrix4,d=new cc.math.Matrix4;cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();h=cc.math.Matrix4.createPerspectiveProjection(60,c.width/c.height,0.1,2*g);cc.kmGLMultMatrix(h);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();g=new cc.math.Vec3(-e+c.width/2,-f+c.height/2,g);c=new cc.math.Vec3(-e+c.width/2,-f+c.height/2,0);e=new cc.math.Vec3(0,1,0); d.lookAt(g,c,e);cc.kmGLMultMatrix(d);break;case cc.Director.PROJECTION_CUSTOM:this._projectionDelegate&&this._projectionDelegate.updateProjection();break;default:cc.log(cc._LogInfos.Director_setProjection)}this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged);cc.setProjectionMatrixDirty();cc.renderer.childrenOrderDirty=!0};a.setDepthTest=function(a){cc.renderer.setDepthTest(a)};a.setClearColor=function(a){cc.renderer._clearColor=a};a.setOpenGLView=function(a){this._winSizeInPoints.width= cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;a=cc.configuration;a.gatherGPUInfo();a.dumpInfo();this._createStatsLabel();this.setGLDefaultValues();cc.eventManager&&cc.eventManager.setEnabled(!0)};a._clear=function(){var a=cc._renderContext;a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT)};a._beforeVisitScene=function(){cc.kmGLPushMatrix()};a._afterVisitScene=function(){cc.kmGLPopMatrix()};a._createStatsLabel=function(){if(!cc.LabelAtlas)this._createStatsLabelForCanvas(); else if(null!=cc.Director._fpsImageLoaded&&!1!==cc.Director._fpsImageLoaded){var a=new cc.Texture2D;a.initWithElement(cc.Director._fpsImage);a.handleLoadedTexture();var c=cc.view.getDesignResolutionSize().height/320;0===c&&(c=this._winSizeInPoints.height/320);var d=new cc.LabelAtlas;d._setIgnoreContentScaleFactor(!0);d.initWithString("00.0",a,12,32,".");d.scale=c;this._FPSLabel=d;d=new cc.LabelAtlas;d._setIgnoreContentScaleFactor(!0);d.initWithString("0.000",a,12,32,".");d.scale=c;this._SPFLabel= d;d=new cc.LabelAtlas;d._setIgnoreContentScaleFactor(!0);d.initWithString("000",a,12,32,".");d.scale=c;this._drawsLabel=d;a=cc.DIRECTOR_STATS_POSITION;this._drawsLabel.setPosition(a.x,34*c+a.y);this._SPFLabel.setPosition(a.x,17*c+a.y);this._FPSLabel.setPosition(a)}};a._createStatsLabelForCanvas=function(){var a=0,a=this._winSizeInPoints.width>this._winSizeInPoints.height?0|this._winSizeInPoints.height/320*24:0|this._winSizeInPoints.width/320*24;this._FPSLabel=new cc.LabelTTF("000.0","Arial",a);this._SPFLabel= new cc.LabelTTF("0.000","Arial",a);this._drawsLabel=new cc.LabelTTF("0000","Arial",a);a=cc.DIRECTOR_STATS_POSITION;this._drawsLabel.setPosition(this._drawsLabel.width/2+a.x,5*this._drawsLabel.height/2+a.y);this._SPFLabel.setPosition(this._SPFLabel.width/2+a.x,3*this._SPFLabel.height/2+a.y);this._FPSLabel.setPosition(this._FPSLabel.width/2+a.x,this._FPSLabel.height/2+a.y)};a.convertToGL=function(a){var c=new cc.math.Matrix4;cc.GLToClipTransform(c);var d=c.inverse(),c=c.mat[14]/c.mat[15],e=this._openGLView.getDesignResolutionSize(); a=new cc.math.Vec3(2*a.x/e.width-1,1-2*a.y/e.height,c);a.transformCoord(d);return cc.p(a.x,a.y)};a.convertToUI=function(a){var c=new cc.math.Matrix4;cc.GLToClipTransform(c);a=new cc.math.Vec3(a.x,a.y,0);a.transformCoord(c);c=this._openGLView.getDesignResolutionSize();return cc.p(c.width*(0.5*a.x+0.5),c.height*(0.5*-a.y+0.5))};a.getVisibleSize=function(){return this._openGLView.getVisibleSize()};a.getVisibleOrigin=function(){return this._openGLView.getVisibleOrigin()};a.getZEye=function(){return this._winSizeInPoints.height/ 1.1566};a.setViewport=function(){var a=this._openGLView;if(a){var c=this._winSizeInPoints;a.setViewPortInPoints(-a._viewPortRect.x/a._scaleX,-a._viewPortRect.y/a._scaleY,c.width,c.height)}};a.getOpenGLView=function(){return this._openGLView};a.getProjection=function(){return this._projection};a.setAlphaBlending=function(a){a?cc.glBlendFunc(cc.BLEND_SRC,cc.BLEND_DST):cc.glBlendFunc(cc._renderContext.ONE,cc._renderContext.ZERO)};a.setGLDefaultValues=function(){this.setAlphaBlending(!0);this.setDepthTest(!1); this.setProjection(this._projection);cc._renderContext.clearColor(0,0,0,0)}}();cc.Camera=cc.Class.extend({_eyeX:null,_eyeY:null,_eyeZ:null,_centerX:null,_centerY:null,_centerZ:null,_upX:null,_upY:null,_upZ:null,_dirty:!1,_lookupMatrix:null,ctor:function(){this._lookupMatrix=new cc.math.Matrix4;this.restore()},description:function(){return"\x3cCCCamera | center \x3d("+this._centerX+","+this._centerY+","+this._centerZ+")\x3e"},setDirty:function(a){this._dirty=a},isDirty:function(){return this._dirty},restore:function(){this._eyeX=this._eyeY=0;this._eyeZ=cc.Camera.getZEye();this._upX= this._centerX=this._centerY=this._centerZ=0;this._upY=1;this._upZ=0;this._lookupMatrix.identity();this._dirty=!1},locate:function(){if(this._dirty){var a=new cc.math.Vec3(this._eyeX,this._eyeY,this._eyeZ),b=new cc.math.Vec3(this._centerX,this._centerY,this._centerZ),c=new cc.math.Vec3(this._upX,this._upY,this._upZ);this._lookupMatrix.lookAt(a,b,c);this._dirty=!1}cc.kmGLMultMatrix(this._lookupMatrix)},_locateForRenderer:function(a){if(this._dirty){var b=new cc.math.Vec3(this._eyeX,this._eyeY,this._eyeZ), c=new cc.math.Vec3(this._centerX,this._centerY,this._centerZ),d=new cc.math.Vec3(this._upX,this._upY,this._upZ);this._lookupMatrix.lookAt(b,c,d);this._dirty=!1}a.multiply(this._lookupMatrix)},setEyeXYZ:function(a,b,c){this.setEye(a,b,c)},setEye:function(a,b,c){this._eyeX=a;this._eyeY=b;this._eyeZ=c;this._dirty=!0},setCenterXYZ:function(a,b,c){this.setCenter(a,b,c)},setCenter:function(a,b,c){this._centerX=a;this._centerY=b;this._centerZ=c;this._dirty=!0},setUpXYZ:function(a,b,c){this.setUp(a,b,c)}, setUp:function(a,b,c){this._upX=a;this._upY=b;this._upZ=c;this._dirty=!0},getEyeXYZ:function(a,b,c){return{x:this._eyeX,y:this._eyeY,z:this._eyeZ}},getEye:function(){return{x:this._eyeX,y:this._eyeY,z:this._eyeZ}},getCenterXYZ:function(a,b,c){return{x:this._centerX,y:this._centerY,z:this._centerZ}},getCenter:function(){return{x:this._centerX,y:this._centerY,z:this._centerZ}},getUpXYZ:function(a,b,c){return{x:this._upX,y:this._upY,z:this._upZ}},getUp:function(){return{x:this._upX,y:this._upY,z:this._upZ}}, _DISALLOW_COPY_AND_ASSIGN:function(a){}});cc.Camera.getZEye=function(){return cc.FLT_EPSILON};cc.PRIORITY_NON_SYSTEM=cc.PRIORITY_SYSTEM+1;cc.ListEntry=function(a,b,c,d,e,f,g){this.prev=a;this.next=b;this.callback=c;this.target=d;this.priority=e;this.paused=f;this.markedForDeletion=g};cc.HashUpdateEntry=function(a,b,c,d,e){this.list=a;this.entry=b;this.target=c;this.callback=d;this.hh=e};cc.HashTimerEntry=cc.hashSelectorEntry=function(a,b,c,d,e,f,g){this.timers=a;this.target=b;this.timerIndex=c;this.currentTimer=d;this.currentTimerSalvaged=e;this.paused=f;this.hh=g}; cc.Timer=cc.Class.extend({_scheduler:null,_elapsed:0,_runForever:!1,_useDelay:!1,_timesExecuted:0,_repeat:0,_delay:0,_interval:0,getInterval:function(){return this._interval},setInterval:function(a){this._interval=a},setupTimerWithInterval:function(a,b,c){this._elapsed=-1;this._interval=a;this._delay=c;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._runForever&&this._timesExecuted>this._repeat&&this.cancel()))}}); cc.TimerTargetSelector=cc.Timer.extend({_target:null,_selector:null,ctor:function(){this._selector=this._target=null},initWithSelector:function(a,b,c,d,e,f){this._scheduler=a;this._target=c;this._selector=b;this.setupTimerWithInterval(d,e,f);return!0},getSelector:function(){return this._selector},trigger:function(){this._target&&this._selector&&this._target.call(this._selector,this._elapsed)},cancel:function(){this._scheduler.unschedule(this._selector,this._target)}}); cc.TimerTargetCallback=cc.Timer.extend({_target:null,_callback:null,_key:null,ctor:function(){this._callback=this._target=null},initWithCallback:function(a,b,c,d,e,f,g){this._scheduler=a;this._target=c;this._callback=b;this._key=d;this.setupTimerWithInterval(e,f,g);return!0},getCallback:function(){return this._callback},getKey:function(){return this._key},trigger:function(){this._callback&&this._callback.call(this._target,this._elapsed)},cancel:function(){this._scheduler.unschedule(this._callback, this._target)}}); 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]; cc.arrayRemoveObject(this._arrayForTimers,a);a.Timer=null;a.target=null},_removeUpdateFromHash:function(a){if(a=this._hashForUpdates[a.target.__instanceId])cc.arrayRemoveObject(a.list,a.entry),delete this._hashForUpdates[a.target.__instanceId],a.entry=null,a.target=null},_priorityIn:function(a,b,c,d,e){b=new cc.ListEntry(null,null,b,c,d,e,!1);if(a){e=a.length-1;for(var f=0;f<=e&&!(d=e&&c.timerIndex--;0===d.length&&(this._currentTarget===c?this._currentTargetSalvaged=!0:this._removeHashElement(c));break}}}},unscheduleUpdate:function(a){null!=a&&(a=this._hashForUpdates[a.__instanceId])&&(this._updateHashLocked?a.entry.markedForDeletion=!0:this._removeUpdateFromHash(a.entry))},unscheduleAllForTarget:function(a){if(null!=a){var b=this._hashForTimers[a.__instanceId];b&&(-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 key must not be empty"); cc.assert(b,"Argument target must be non-nullptr");var c=this._hashForUpdates[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();var f=cc.view.getScaleX(),g=cc.view.getScaleY();b.beginPath();b.moveTo(e.x*f,-e.y*g);for(var e=1,h=a.length;e\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/;cc.LabelTTF._lastWordRex=/([a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+|\S)$/; cc.LabelTTF._lastEnglish=/[a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+$/;cc.LabelTTF._firsrEnglish=/^[a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]/; (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};var a=cc.LabelTTF.RenderCmd.prototype;a.constructor=cc.LabelTTF.RenderCmd;a._getLabelContext=function(){if(this._labelContext)return this._labelContext;var a=this._node;if(!this._labelCanvas){var c= cc.newElement("canvas");c.width=1;c.height=1;var d=new cc.Texture2D;d.initWithElement(c);a.setTexture(d);this._labelCanvas=c}return this._labelContext=this._labelCanvas.getContext("2d")};a._setFontStyle=function(a,c,d,e){a instanceof cc.FontDefinition?(this._fontStyleStr=a._getCanvasFontStr(),this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a)):(this._fontStyleStr=d+" "+e+" "+c+"px '"+a+"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a,c))};a._getFontStyle=function(){return this._fontStyleStr}; a._getFontClientHeight=function(){return this._fontClientHeight};a._updateTexture=function(){this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.textDirty;var a=this._node,c=this._getLabelContext(),d=this._labelCanvas,e=a._contentSize;if(0===a._string.length)return d.width=1,d.height=e.height||1,a._texture&&a._texture.handleLoadedTexture(),a.setTextureRect(cc.rect(0,0,1,e.height)),!0;c.font=this._fontStyleStr;this._updateTTF();var f=e.width,e=e.height,g=d.width===f&&d.height===e;d.width=f;d.height= e;g&&c.clearRect(0,0,f,e);this._drawTTFInCanvas(c);a._texture&&a._texture.handleLoadedTexture();a.setTextureRect(cc.rect(0,0,f,e));return!0};a._measureConfig=function(){this._getLabelContext().font=this._fontStyleStr};a._measure=function(a){return this._getLabelContext().measureText(a).width};a._updateTTF=function(){var a=this._node,c=a._dimensions.width,d,e,f=this._lineWidths;f.length=0;this._isMultiLine=!1;this._measureConfig();if(0!==c)for(this._strings=a._string.split("\n"),d=0;dd&&1d&&100>p++;)g*=d/k,g|=0,h=e.substr(g),k=f-this._measure(h);for(p=0;kp++;)h&&(n=(m=cc.LabelTTF._wordRex.exec(h))?m[0].length:1,m=h),g+=n,h=e.substr(g),k=f-this._measure(h);g-=n;0===g&&(g=1,m=m.substr(1));d=e.substr(0,g);cc.LabelTTF.wrapInspection&& cc.LabelTTF._symbolRex.test(m||h)&&(f=cc.LabelTTF._lastWordRex.exec(d),g-=f?f[0].length:0,m=e.substr(g),d=e.substr(0,g));cc.LabelTTF._firsrEnglish.test(m)&&(f=cc.LabelTTF._lastEnglish.exec(d))&&d!==f[0]&&(g-=f[0].length,m=e.substr(g),d=e.substr(0,g));a[c]=m||h;a.splice(c,0,d)}}})(); (function(){cc.LabelTTF.CanvasRenderCmd=function(a){cc.Sprite.CanvasRenderCmd.call(this,a);cc.LabelTTF.RenderCmd.call(this)};cc.LabelTTF.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(cc.LabelTTF.RenderCmd.prototype,cc.LabelTTF.CanvasRenderCmd.prototype);var a=cc.LabelTTF.CanvasRenderCmd.prototype;a.constructor=cc.LabelTTF.CanvasRenderCmd;a.updateStatus=function(){var a=cc.Node._dirtyFlags,c=this._dirtyFlag,d=c&a.colorDirty,e=c&a.opacityDirty;d&&this._updateDisplayColor(); e&&this._updateDisplayOpacity();d?this._updateColor():c&a.textDirty&&this._updateTexture();this._dirtyFlag&a.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty)};a._syncStatus=function(a){var c=cc.Node._dirtyFlags,d=this._dirtyFlag,e=a?a._node:null;e&&e._cascadeColorEnabled&&a._dirtyFlag&c.colorDirty&&(d|=c.colorDirty);e&&e._cascadeOpacityEnabled&&a._dirtyFlag&c.opacityDirty&&(d|=c.opacityDirty);a&&a._dirtyFlag&c.transformDirty&& (d|=c.transformDirty);var e=d&c.colorDirty,f=d&c.opacityDirty;this._dirtyFlag=d;e&&this._syncDisplayColor();f&&this._syncDisplayOpacity();e?this._updateColor():d&c.textDirty&&this._updateTexture();d&c.transformDirty&&this.transform(a)};a._setColorsString=function(){var a=this._displayedColor,c=this._node,d=c._shadowColor||this._displayedColor,e=c._strokeColor,f=c._textFillColor,g=a.r/255,h=a.g/255,a=a.b/255;this._shadowColorStr="rgba("+(0|g*d.r)+","+(0|h*d.g)+","+(0|a*d.b)+","+c._shadowOpacity+")"; this._fillColorStr="rgba("+(0|g*f.r)+","+(0|h*f.g)+","+(0|a*f.b)+", 1)";this._strokeColorStr="rgba("+(0|g*e.r)+","+(0|h*e.g)+","+(0|a*e.b)+", 1)"};a._updateColor=function(){this._setColorsString();this._updateTexture()}})();(function(){cc.LabelTTF.WebGLRenderCmd=function(a){cc.Sprite.WebGLRenderCmd.call(this,a);cc.LabelTTF.RenderCmd.call(this);this.setShaderProgram(cc.shaderCache.programForKey(cc.LabelTTF._SHADER_PROGRAM))};var a=cc.LabelTTF.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);cc.inject(cc.LabelTTF.RenderCmd.prototype,a);a.constructor=cc.LabelTTF.WebGLRenderCmd;a._setColorsString=function(){this.setDirtyFlag(cc.Node._dirtyFlags.textDirty);var a=this._node,c=a._strokeColor,d=a._textFillColor, e=a._shadowColor||this._displayedColor;this._shadowColorStr="rgba("+(0|e.r)+","+(0|e.g)+","+(0|e.b)+","+a._shadowOpacity+")";this._fillColorStr="rgba("+(0|d.r)+","+(0|d.g)+","+(0|d.b)+", 1)";this._strokeColorStr="rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b)+", 1)"};a.updateStatus=function(){var a=cc.Node._dirtyFlags,c=this._dirtyFlag,d=c&a.colorDirty,e=c&a.opacityDirty;d&&this._updateDisplayColor();e&&this._updateDisplayOpacity();d||e?(this._setColorsString(),this._updateColor(),this._updateTexture()): c&a.textDirty&&this._updateTexture();this._dirtyFlag&a.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty)};a._syncStatus=function(a){var c=cc.Node._dirtyFlags,d=this._dirtyFlag,e=a?a._node:null;e&&e._cascadeColorEnabled&&a._dirtyFlag&c.colorDirty&&(d|=c.colorDirty);e&&e._cascadeOpacityEnabled&&a._dirtyFlag&c.opacityDirty&&(d|=c.opacityDirty);a&&a._dirtyFlag&c.transformDirty&&(d|=c.transformDirty);var e=d&c.colorDirty, f=d&c.opacityDirty;this._dirtyFlag=d;e&&this._syncDisplayColor();f&&this._syncDisplayOpacity();e||f?(this._setColorsString(),this._updateColor(),this._updateTexture()):d&c.textDirty&&this._updateTexture();this.transform(a)}})();cc.HashElement=cc.Class.extend({actions:null,target:null,actionIndex:0,currentAction:null,currentActionSalvaged:!1,paused:!1,hh:null,ctor:function(){this.actions=[];this.target=null;this.actionIndex=0;this.currentAction=null;this.paused=this.currentActionSalvaged=!1;this.hh=null}}); cc.ActionManager=cc.Class.extend({_hashTargets:null,_arrayTargets:null,_currentTarget:null,_currentTargetSalvaged:!1,_searchElementByTarget:function(a,b){for(var c=0;c=a&&b.actionIndex--;0===b.actions.length&&(this._currentTarget===b?this._currentTargetSalvaged=!0:this._deleteHashElement(b))},_deleteHashElement:function(a){var b=!1;a&&(this._hashTargets[a.target.__instanceId]&&(delete this._hashTargets[a.target.__instanceId], cc.arrayRemoveObject(this._arrayTargets,a),b=!0),a.actions=null,a.target=null);return b},_actionAllocWithHashElement:function(a){null==a.actions&&(a.actions=[])},update:function(a){for(var b=this._arrayTargets,c,d=0;db&&a-cc.math.EPSILONb.x-a.math.EPSILON&&this.yb.y-a.math.EPSILON}})(cc);(function(a){a.kmVec3=a.math.Vec3=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,t=d.y,r=(t-n)*(h-f)-(p-m)*(k-g);if(r>-a.math.EPSILON&& rMath.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,t;this.intersectLineSegment(c,d,h)&&(p=!0,t=h.subtract(this.start).length(),tg;++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,t,r=[0,0,0,0],v=[0,0,0,0],s=[0,0,0,0];for(c=0;4>c;c++){for(m=t=0;4>m;m++)if(1!==s[m])for(n=0;4>n;n++)0===s[n]&&(p=Math.abs(a.get(m,n)),p>=t&&(t=p,k=m,d=n));++s[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;r[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]!==r[m])for(n=0;4>n;n++)a.swap(n,v[m],n,r[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],t=a[11],r=a[12],v=a[13],s=a[14];a[1]=a[4]; a[2]=n;a[3]=r;a[4]=b;a[6]=p;a[7]=v;a[8]=c;a[9]=k;a[11]=s;a[12]=d;a[13]=m;a[14]=t;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],t=k[4],r=k[5],v=k[6],s=k[7],u=k[8],w=k[9],z=k[10],F=k[11],x=k[12],y=k[13],A=k[14],k=k[15],C=m[0],I=m[1],D=m[2],M=m[3],J=m[4],E=m[5],G=m[6],L=m[7],P=m[8],K=m[9],U=m[10],Q=m[11],B=m[12],H=m[13],S=m[14],m=m[15];d[0]=C*c+I*t+D*u+M*x;d[1]=C*b+I*r+D*w+M*y;d[2]=C*n+I*v+D*z+M*A;d[3]=C*p+I*s+D*F+M*k;d[4]=J*c+E*t+G*u+L*x;d[5]= J*b+E*r+G*w+L*y;d[6]=J*n+E*v+G*z+L*A;d[7]=J*p+E*s+G*F+L*k;d[8]=P*c+K*t+U*u+Q*x;d[9]=P*b+K*r+U*w+Q*y;d[10]=P*n+K*v+U*z+Q*A;d[11]=P*p+K*s+U*F+Q*k;d[12]=B*c+H*t+S*u+m*x;d[13]=B*b+H*r+S*w+m*y;d[14]=B*n+H*v+S*z+m*A;d[15]=B*p+H*s+S*F+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],t=b[6],r=b[7],v=b[8],s=b[9],u=b[10],w=b[11],z=b[12],F=b[13],x=b[14],y=b[15],A=c[0],C=c[1],I=c[2],D=c[3],M=c[4],J=c[5],E=c[6],G=c[7],L=c[8],P=c[9],K=c[10],U=c[11],Q=c[12], B=c[13],H=c[14],c=c[15];b[0]=A*a+C*n+I*v+D*z;b[1]=A*d+C*p+I*s+D*F;b[2]=A*k+C*t+I*u+D*x;b[3]=A*m+C*r+I*w+D*y;b[4]=M*a+J*n+E*v+G*z;b[5]=M*d+J*p+E*s+G*F;b[6]=M*k+J*t+E*u+G*x;b[7]=M*m+J*r+E*w+G*y;b[8]=L*a+P*n+K*v+U*z;b[9]=L*d+P*p+K*s+U*F;b[10]=L*k+P*t+K*u+U*x;b[11]=L*m+P*r+K*w+U*y;b[12]=Q*a+B*n+H*v+c*z;b[13]=Q*d+B*p+H*s+c*F;b[14]=Q*k+B*t+H*u+c*x;b[15]=Q*m+B*r+H*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||[]};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.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_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_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_MAX:8,_programs:{},_init:function(){this.loadDefaultShaders();return!0},_loadDefaultShader:function(a,b){switch(b){case this.TYPE_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 this.TYPE_POSITION_TEXTURECOLOR_ALPHATEST: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 this.TYPE_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 this.TYPE_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 this.TYPE_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 this.TYPE_POSITION_TEXTURE_A8COLOR: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 this.TYPE_POSITION_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_UCOLOR_VERT,cc.SHADER_POSITION_UCOLOR_FRAG);a.addAttribute("aVertex",cc.VERTEX_ATTRIB_POSITION);break;case this.TYPE_POSITION_LENGTH_TEXTURECOLOR: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(){var a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR);this._programs[cc.SHADER_POSITION_TEXTURECOLOR]= a;this._programs.ShaderPositionTextureColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR_ALPHATEST);this._programs[cc.SHADER_POSITION_TEXTURECOLORALPHATEST]=a;this._programs.ShaderPositionTextureColorAlphaTest=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_COLOR);this._programs[cc.SHADER_POSITION_COLOR]=a;this._programs.ShaderPositionColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE);this._programs[cc.SHADER_POSITION_TEXTURE]= a;this._programs.ShaderPositionTexture=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_UCOLOR);this._programs[cc.SHADER_POSITION_TEXTURE_UCOLOR]=a;this._programs.ShaderPositionTextureUColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_A8COLOR);this._programs[cc.SHADER_POSITION_TEXTUREA8COLOR]=a;this._programs.ShaderPositionTextureA8Color=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_UCOLOR);this._programs[cc.SHADER_POSITION_UCOLOR]= a;this._programs.ShaderPositionUColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_LENGTH_TEXTURECOLOR);this._programs[cc.SHADER_POSITION_LENGTHTEXTURECOLOR]=a;this._programs.ShaderPositionLengthTextureColor=a},reloadDefaultShaders:function(){var a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR_ALPHATEST); a=this.programForKey(cc.SHADER_POSITION_COLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_COLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURE);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE);a=this.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_UCOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTUREA8COLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_A8COLOR);a=this.programForKey(cc.SHADER_POSITION_UCOLOR); a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_UCOLOR)},programForKey:function(a){return this._programs[a]},getProgram:function(a){return this._programs[a]},addProgram:function(a,b){this._programs[b]=a}};cc.HashUniformEntry=function(a,b,c){this.value=a;this.location=b;this.hh=c||{}}; cc.GLProgram=cc.Class.extend({_glContext:null,_programObj:null,_vertShader:null,_fragShader:null,_uniforms:null,_hashForUniforms:null,_usesTime:!1,_updateUniformLocation:function(a,b,c){if(null==a)return!1;c=!0;for(var d=null,e=0;earguments.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],a.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX], b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01], 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],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX],a._renderCmd._stackMatrix.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX], c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01],Math.random(),Math.random(),Math.random(),Math.random())}}, setUniformForModelViewProjectionMatrix:function(){this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX],!1,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._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX],!1,a.mat)},setUniformForModelViewAndProjectionMatrixWithMat4:function(){this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX], !1,cc.modelview_matrix_stack.top.mat);this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX],!1,cc.projection_matrix_stack.top.mat)},_setUniformForMVPMatrixWithMat4:function(a){if(!a)throw Error("modelView matrix is undefined.");this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX],!1,a.mat);this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX],!1,cc.projection_matrix_stack.top.mat)},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;this._uniforms.length= 0;this._glContext.deleteProgram(this._programObj);this._programObj=null;for(var a=0;a>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:cc.Texture2D.PIXEL_FORMAT_RGBA8888,clearStencilVal:0,_clearColor:null,_className:"RenderTexture",ctor:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;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._RENDER_TYPE_CANVAS?new cc.RenderTexture.CanvasRenderCmd(this):new cc.RenderTexture.WebGLRenderCmd(this)},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){cc.Node.CanvasRenderCmd.call(this,a);this._needDraw=!0;this._clearColorStr="rgba(255,255,255,1)";this._cacheCanvas=cc.newElement("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.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")};a.visit=function(a){var c=this._node;this._syncStatus(a);c.sprite.visit(this);this._dirtyFlag=0}})();(function(){cc.RenderTexture.WebGLRenderCmd=function(a){cc.Node.WebGLRenderCmd.call(this,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.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;dn||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=this._displayedColor, n={r:n.r,g:n.g,b:n.b,a:a._displayedOpacity},p=a._itemWidth,t=a._itemHeight,r=0,v=-1;ru||0>w||u*p+p>g||w*t+t>f)){v++;var z;cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(u=(2*u*h+1)/(2*g),s=u+(2*h-2)/(2*g),w=(2*w*k+1)/(2*f),z=w+(2*k-2)/(2*f)):(u=u*h/g,s=u+h/g,w=w*k/f,z=w+k/f);var F=m[r],x=F.tl,y=F.tr,A=F.bl,F=F.br;x.texCoords.u=u;x.texCoords.v=w;y.texCoords.u=s;y.texCoords.v=w;A.texCoords.u=u;A.texCoords.v= z;F.texCoords.u=s;F.texCoords.v=z;A.vertices.x=v*p;A.vertices.y=0;A.vertices.z=0;F.vertices.x=v*p+p;F.vertices.y=0;F.vertices.z=0;x.vertices.x=v*p;x.vertices.y=a._itemHeight;x.vertices.z=0;y.vertices.x=v*p+p;y.vertices.y=a._itemHeight;y.vertices.z=0;x.colors=n;y.colors=n;A.colors=n;F.colors=n}}this.updateContentSize(r,v+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.LABEL_AUTOMATIC_WIDTH=-1; cc.LabelBMFont=cc.SpriteBatchNode.extend({_opacityModifyRGB:!1,_string:"",_config:null,_fntFile:"",_initialString:"",_alignment:cc.TEXT_ALIGNMENT_CENTER,_width:-1,_lineBreakWithoutSpaces:!1,_imageOffset:null,_reusedChar:null,_textureLoaded:!1,_className:"LabelBMFont",_createRenderCmd:function(){return cc._renderType===cc._RENDER_TYPE_WEBGL?new cc.LabelBMFont.WebGLRenderCmd(this):new cc.LabelBMFont.CanvasRenderCmd(this)},_setString:function(a,b){b?this._initialString=a:this._string=a;var c=this._children; if(c)for(var 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.texture=a,this._renderCmd._updateFntFileTexture(),b?this.createFontChars():a.addEventListener("load",function(a){this._textureLoaded=!0;this.texture=a;this.createFontChars();this._changeTextureColor();this.updateLabel();this.dispatchEvent("load")},this)):cc.log("cc.LabelBMFont.setFntFile() : Impossible to create font. Please check file")}},getFntFile:function(){return this._fntFile},setTexture:function(a){this._renderCmd.setTexture(a)},setAnchorPoint:function(a,b){cc.Node.prototype.setAnchorPoint.call(this, a,b);this.updateLabel()},_setAnchorX:function(a){cc.Node.prototype._setAnchorX.call(this,a);this.updateLabel()},_setAnchorY:function(a){cc.Node.prototype._setAnchorY.call(this,a);this.updateLabel()},_atlasNameFromFntFile:function(a){},_kerningAmountForFirst:function(a,b){var c=0;if(this._configuration.kerningDictionary){var d=this._configuration.kerningDictionary[(a<<16|b&65535).toString()];d&&(c=d.amount)}return c},_getLetterPosXLeft:function(a){return a.getPositionX()*this._scaleX-a._getWidth()* this._scaleX*a._getAnchorX()},_getLetterPosXRight:function(a){return a.getPositionX()*this._scaleX+a._getWidth()*this._scaleX*a._getAnchorX()},_isspace_unicode:function(a){a=a.charCodeAt(0);return 9<=a&&13>=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.LabelBMFont.create=function(a,b,c,d,e){return new cc.LabelBMFont(a,b,c,d,e)}; cc._fntLoader={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;ce.width||d.scaleH>e.height)&&cc.log("cc.LabelBMFont._parseCommonArguments(): page can't be larger than supported")}1!==d.pages&&cc.log("cc.LabelBMFont._parseCommonArguments(): only supports 1 page"); d=this._parseStrToObj(a.match(this.PAGE_EXP)[0]);0!==d.id&&cc.log("cc.LabelBMFont._parseImageFileName() : file could not be found");c.atlasName=cc.path.changeBasename(b,d.file);for(var f=a.match(this.CHAR_EXP),g=c.fontDefDictionary={},d=0,e=f.length;d=h[d]?f++:(b=d-f,0=this._maxPoints?d=!1:0=b._nuPoints||!b.texture||!b.texture.isLoaded()||(a=a||cc._renderContext,this._shaderProgram.use(),this._shaderProgram._setUniformForMVPMatrixWithMat4(this._stackMatrix),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX),cc.glBlendFunc(b._blendFunc.src,b._blendFunc.dst),cc.glBindTexture2D(b.texture),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},_transformForWebGL:function(){var a=this._transform4x4,b=cc.current_stack.top,c=this.getNodeToParentTransform(),d=a.mat;d[0]=c.a;d[4]=c.c;d[12]= c.tx;d[1]=c.b;d[5]=c.d;d[13]=c.ty;d[14]=this._vertexZ;b.multiply(a);null===this._camera||this.grid&&this.grid.isActive()||(b=this._renderCmd._anchorPointInPoints,a=b.x,b=b.y,0!==a||0!==b?(cc.SPRITEBATCHNODE_RENDER_SUBPIXEL||(a|=0,b|=0),cc.kmGLTranslatef(a,b,0),this._camera.locate(),cc.kmGLTranslatef(-a,-b,0)):this._camera.locate())},_createRenderCmd:function(){return cc._renderType===cc._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){cc.Node.WebGLRenderCmd.call(this,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){a=a||this.getParentRenderCmd();c._parent&&c._parent._renderCmd&&(this._curLevel= c._parent._renderCmd._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)&&0this._bufferCapacity){var c=cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT;this._bufferCapacity+=Math.max(this._bufferCapacity,a);if(null==b||0===b.length)this._buffer= [],this._trianglesArrayBuffer=new ArrayBuffer(c*this._bufferCapacity),this._trianglesReader=new Uint8Array(this._trianglesArrayBuffer);else{a=[];for(var d=new ArrayBuffer(c*this._bufferCapacity),e=0;e=b)){c={r:0|c.r,g:0|c.g,b:0|c.b,a:0|c.a};var e=[],f,g,h,k,m=a.length;for(f=0;f=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),cc.ClippingNode.WebGLRenderCmd._init_once=!1)};a.transform=function(a,c){var d=this._node;cc.Node.WebGLRenderCmd.prototype.transform.call(this,a,c);d._stencil&&d._stencil._renderCmd.transform(this,c)};a.visit=function(a){var c=this._node;if(c._visible)if(c._parent&&c._parent._renderCmd&&(this._curLevel=c._parent._renderCmd._curLevel+1),1>cc.stencilBits)cc.Node.WebGLRenderCmd.prototype.visit.call(this, a);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),cc.Node.WebGLRenderCmd.prototype.visit.call(this,a);else{cc.renderer.pushRenderCommand(this._beforeVisitCmd);var d= cc.current_stack;d.stack.push(d.top);this._syncStatus(a);d.top=this._stackMatrix;c._stencil._renderCmd.visit(this);cc.renderer.pushRenderCommand(this._afterDrawStencilCmd);if((a=c._children)&&0a.alphaThreshold&&(d=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),c=c.getUniformLocation(d.getProgram(),cc.UNIFORM_ALPHA_TEST_VALUE_S),cc.glUseProgram(d.getProgram()),d.setUniformLocationWith1f(c, a.alphaThreshold),cc.setProgram(a._stencil,d))};a._onAfterDrawStencil=function(a){a=a||cc._renderContext;a.depthMask(this._currentDepthWriteMask);a.stencilFunc(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;a.stencilFunc(this._currentStencilFunc,this._currentStencilRef,this._currentStencilValueMask);a.stencilOp(this._currentStencilFail,this._currentStencilPassDepthFail,this._currentStencilPassDepthPass);a.stencilMask(this._currentStencilWriteMask); this._currentStencilEnabled||a.disable(a.STENCIL_TEST);cc.ClippingNode.WebGLRenderCmd._layer--}})();cc.GridBase=cc.Class.extend({_active:!1,_reuseGrid:0,_gridSize:null,_gridRect:null,_texture:null,_step:null,_grabber:null,_isTextureFlipped:!1,_shaderProgram:null,_directorProjection:0,_dirty:!1,ctor:function(a,b,c,d){cc._checkWebGLRenderMode();this._active=!1;this._reuseGrid=0;this._gridSize=null;this._gridRect=new cc.rect;this._texture=null;this._step=cc.p(0,0);this._grabber=null;this._isTextureFlipped=!1;this._shaderProgram=null;this._directorProjection=0;this._dirty=!1;void 0!==a&&this.initWithSize(a, b,c,d)},isActive:function(){return this._active},setActive:function(a){this._active=a;if(!a){a=cc.director;var b=a.getProjection();a.setProjection(b)}},getReuseGrid:function(){return this._reuseGrid},setReuseGrid:function(a){this._reuseGrid=a},getGridSize:function(){return cc.size(this._gridSize.width,this._gridSize.height)},setGridSize:function(a){this._gridSize.width=parseInt(a.width);this._gridSize.height=parseInt(a.height)},setGridRect:function(a){this._gridRect=a},getGridRect:function(){return this._gridRect}, getStep:function(){return cc.p(this._step.x,this._step.y)},setStep:function(a){this._step.x=a.x;this._step.y=a.y},isTextureFlipped:function(){return this._isTextureFlipped},setTextureFlipped:function(a){this._isTextureFlipped!==a&&(this._isTextureFlipped=a,this.calculateVertexPoints())},initWithSize:function(a,b,c,d){if(!b){var e=cc.director.getWinSizeInPixels(),f=cc.NextPOT(e.width),g=cc.NextPOT(e.height),h=new Uint8Array(f*g*4);if(!h)return cc.log("cocos2d: CCGrid: not enough memory."),!1;b=new cc.Texture2D; b.initWithData(h,cc.Texture2D.PIXEL_FORMAT_RGBA8888,f,g,e);if(!b)return cc.log("cocos2d: CCGrid: error creating texture"),!1}this._active=!1;this._reuseGrid=0;this._gridSize=a;this._texture=b;this._isTextureFlipped=c||!1;if(void 0===d||cc._rectEqualToZero(d))b=this._texture.getContentSize(),d=new cc.rect(0,0,b.width,b.height);this._gridRect=d;this._step.x=this._gridRect.width/a.width;this._step.y=this._gridRect.height/a.height;this._grabber=new cc.Grabber;if(!this._grabber)return!1;this._grabber.grab(this._texture); this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE);this.calculateVertexPoints();return!0},beforeDraw:function(){this._directorProjection=cc.director.getProjection();this._grabber.beforeRender(this._texture)},afterDraw:function(a){this._grabber.afterRender(this._texture);if(a&&a.getCamera().isDirty()){var b=a.getAnchorPointInPoints(),c=a._renderCmd._stackMatrix,d=cc.math.Matrix4.createByTranslation(b.x,b.y,0);c.multiply(d);a._camera._locateForRenderer(c);d=cc.math.Matrix4.createByTranslation(-b.x, -b.y,0,d);c.multiply(d)}cc.glBindTexture2D(this._texture);this.beforeBlit();this.blit(a);this.afterBlit()},beforeBlit:function(){},afterBlit:function(){},blit:function(){cc.log("cc.GridBase.blit(): Shall be overridden in subclass.")},reuse:function(){cc.log("cc.GridBase.reuse(): Shall be overridden in subclass.")},calculateVertexPoints:function(){cc.log("cc.GridBase.calculateVertexPoints(): Shall be overridden in subclass.")},set2DProjection:function(){var a=cc.director.getWinSizeInPixels();cc._renderContext.viewport(0, 0,a.width,a.height);cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();a=cc.math.Matrix4.createOrthographicProjection(0,a.width,0,a.height,-1,1);cc.kmGLMultMatrix(a);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();cc.setProjectionMatrixDirty()}});cc.GridBase.create=function(a,b,c,d){return new cc.GridBase(a,b,c,d)}; cc.Grid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,_needDepthTestForBlit:!1,_oldDepthTestValue:!1,_oldDepthWriteValue:!1,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;void 0!==a&&this.initWithSize(a,b,c,d)},vertex:function(a){return this.getVertex(a)}, getVertex:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.vertex() : Numbers must be integers");a=0|3*(a.x*(this._gridSize.height+1)+a.y);var b=this._vertices;return new cc.Vertex3F(b[a],b[a+1],b[a+2])},originalVertex:function(a){return this.getOriginalVertex(a)},getOriginalVertex:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.originalVertex() : Numbers must be integers");a=0|3*(a.x*(this._gridSize.height+1)+a.y);var b=this._originalVertices;return new cc.Vertex3F(b[a],b[a+ 1],b[a+2])},setVertex:function(a,b){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.setVertex() : Numbers must be integers");var c=0|3*(a.x*(this._gridSize.height+1)+a.y),d=this._vertices;d[c]=b.x;d[c+1]=b.y;d[c+2]=b.z;this._dirty=!0},beforeBlit:function(){if(this._needDepthTestForBlit){var a=cc._renderContext;this._oldDepthTestValue=a.isEnabled(a.DEPTH_TEST);this._oldDepthWriteValue=a.getParameter(a.DEPTH_WRITEMASK);a.enable(a.DEPTH_TEST);a.depthMask(!0)}},afterBlit:function(){if(this._needDepthTestForBlit){var a= cc._renderContext;this._oldDepthTestValue?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST);a.depthMask(this._oldDepthWriteValue)}},blit:function(a){var b=this._gridSize.width*this._gridSize.height;cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS);this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(a._renderCmd._stackMatrix);a=cc._renderContext;var c=this._dirty;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,0);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,0);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(0h;++h)p[t[h]]=x[h].x,p[t[h]+1]=x[h].y,p[t[h]+2]=x[h].z,m[u[h]]=r[h].x/b,m[u[h]+1]=n?(d-r[h].y)/c:r[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;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;this._shaderProgram.use();this._shaderProgram._setUniformForMVPMatrixWithMat4(a._renderCmd._stackMatrix);a=cc._renderContext;var c=this._dirty;cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_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;eb?Math.PI-Math.asin(d/e):Math.asin(d/e);return{newRadius:c/cc.Camera.getZEye(),zenith:a,azimuth:b}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);a=this.sphericalRadius();isNaN(this._radius)&&(this._radius=a.newRadius);isNaN(this._angleZ)&&(this._angleZ=cc.radiansToDegrees(a.zenith));isNaN(this._angleX)&&(this._angleX=cc.radiansToDegrees(a.azimuth));this._radZ=cc.degreesToRadians(this._angleZ);this._radX=cc.degreesToRadians(this._angleX)},clone:function(){var a=new cc.OrbitCamera;a.initWithDuration(this._duration,this._radius,this._deltaRadius,this._angleZ,this._deltaAngleZ,this._angleX,this._deltaAngleX);return a},update:function(a){a= this._computeEaseTime(a);var b=(this._radius+this._deltaRadius*a)*cc.Camera.getZEye(),c=this._radZ+this._radDeltaZ*a,d=this._radX+this._radDeltaX*a;a=Math.sin(c)*Math.cos(d)*b+this._centerXOrig;d=Math.sin(c)*Math.sin(d)*b+this._centerYOrig;b=Math.cos(c)*b+this._centerZOrig;this.target.getCamera().setEye(a,d,b);this.target.setNodeDirty()}});cc.orbitCamera=function(a,b,c,d,e,f,g){return new cc.OrbitCamera(a,b,c,d,e,f,g)};cc.OrbitCamera.create=cc.orbitCamera;cc.ActionEase=cc.ActionInterval.extend({_inner:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.ActionEase.initWithAction(): action must be non nil");return this.initWithDuration(a.getDuration())?(this._inner=a,!0):!1},clone:function(){var a=new cc.ActionEase;a.initWithAction(this._inner.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._inner.startWithTarget(this.target)}, stop:function(){this._inner.stop();cc.ActionInterval.prototype.stop.call(this)},update:function(a){this._inner.update(a)},reverse:function(){return new cc.ActionEase(this._inner.reverse())},getInnerAction:function(){return this._inner}});cc.actionEase=function(a){return new cc.ActionEase(a)};cc.ActionEase.create=cc.actionEase; cc.EaseRateAction=cc.ActionEase.extend({_rate:0,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);void 0!==b&&this.initWithAction(a,b)},setRate:function(a){this._rate=a},getRate:function(){return this._rate},initWithAction:function(a,b){return cc.ActionEase.prototype.initWithAction.call(this,a)?(this._rate=b,!0):!1},clone:function(){var a=new cc.EaseRateAction;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseRateAction(this._inner.reverse(), 1/this._rate)}});cc.easeRateAction=function(a,b){return new cc.EaseRateAction(a,b)};cc.EaseRateAction.create=cc.easeRateAction;cc.EaseIn=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,this._rate))},reverse:function(){return new cc.EaseIn(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseIn;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseIn.create=function(a,b){return new cc.EaseIn(a,b)}; cc.easeIn=function(a){return{_rate:a,easing:function(a){return Math.pow(a,this._rate)},reverse:function(){return cc.easeIn(1/this._rate)}}};cc.EaseOut=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,1/this._rate))},reverse:function(){return new cc.EaseOut(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseOut;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseOut.create=function(a,b){return new cc.EaseOut(a,b)}; cc.easeOut=function(a){return{_rate:a,easing:function(a){return Math.pow(a,1/this._rate)},reverse:function(){return cc.easeOut(1/this._rate)}}};cc.EaseInOut=cc.EaseRateAction.extend({update:function(a){a*=2;1>a?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){var g=f*f,h=g*f,k=(1-e)/2;e=k*(-h+2*g-f);var m=k*(-h+g)+(2*h-3*g+1);f=k*(h-2*g+f)+(-2*h+3*g);g=k*(h-g);return cc.p(a.x*e+b.x*m+c.x*f+d.x*g,a.y*e+b.y*m+c.y*f+d.y*g)};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)},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.releaseData())},setSprite:function(a){this._sprite!== a&&((this._sprite=a)?this.setContentSize(a.width,a.height):this.setContentSize(0,0),this._renderCmd.releaseData())},setType:function(a){a!==this._type&&(this._type=a,this._renderCmd.releaseData())},setReverseDirection:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._renderCmd.releaseData())},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.initCmd();return!0},_createRenderCmd:function(){return cc._renderType===cc._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){cc.Node.CanvasRenderCmd.call(this,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};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,k=n.x,p=-n.y-m.height,t=m.width,m=m.height;a.save();g._flippedX&&(k=-k-t,e.scale(-1,1));g._flippedY&&(p=n.y,e.scale(1,-1));f._type===cc.ProgressTimer.TYPE_BAR?(f=this._barRect,e.beginPath(),e.rect(f.x*c,f.y*d,f.width*c,f.height*d),e.clip(), e.closePath()):f._type===cc.ProgressTimer.TYPE_RADIAL&&(f=this._origin.x*c,n=this._origin.y*d,e.beginPath(),e.arc(f,n,this._radius*d,this._PI180*this._startAngle,this._PI180*this._endAngle,this._counterClockWise),e.lineTo(f,n),e.clip(),e.closePath());f=g._texture.getHtmlElementObj();g._renderCmd._colorized?e.drawImage(f,0,0,h.width,h.height,k*c,p*d,t*c,m*d):e.drawImage(f,h.renderX,h.renderY,h.width,h.height,k*c,p*d,t*c,m*d);a.restore();cc.g_NumberOfDraws++}};a.releaseData=function(){};a.initCmd=function(){}; a._updateProgress=function(){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),0d.x&&(a.x+=-d.x,d.x=0);1d.y&&(a.y+=-d.y,d.y=0);1c;c++)f[c]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,c*e);f[0].texCoords=this._textureCoordFromAlphaPoint(cc.p(0, 1));f[0].vertices=this._vertexFromAlphaPoint(cc.p(0,1));f[1].texCoords=this._textureCoordFromAlphaPoint(cc.p(0,0));f[1].vertices=this._vertexFromAlphaPoint(cc.p(0,0));f[6].texCoords=this._textureCoordFromAlphaPoint(cc.p(1,1));f[6].vertices=this._vertexFromAlphaPoint(cc.p(1,1));f[7].texCoords=this._textureCoordFromAlphaPoint(cc.p(1,0));f[7].vertices=this._vertexFromAlphaPoint(cc.p(1,0));this._vertexData=f}c=this._vertexData;c[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,a.y));c[2].vertices= this._vertexFromAlphaPoint(cc.p(d.x,a.y));c[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,d.y));c[3].vertices=this._vertexFromAlphaPoint(cc.p(d.x,d.y));c[4].texCoords=this._textureCoordFromAlphaPoint(cc.p(a.x,a.y));c[4].vertices=this._vertexFromAlphaPoint(cc.p(a.x,a.y));c[5].texCoords=this._textureCoordFromAlphaPoint(cc.p(a.x,d.y));c[5].vertices=this._vertexFromAlphaPoint(cc.p(a.x,d.y))}else{if(!this._vertexData)for(this._vertexDataCount=4,e=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT,this._vertexArrayBuffer= new ArrayBuffer(4*e),this._vertexData=[],c=0;4>c;c++)this._vertexData[c]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,c*e);c=this._vertexData;c[0].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,a.y));c[0].vertices=this._vertexFromAlphaPoint(cc.p(d.x,a.y));c[1].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,d.y));c[1].vertices=this._vertexFromAlphaPoint(cc.p(d.x,d.y));c[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(a.x,a.y));c[2].vertices=this._vertexFromAlphaPoint(cc.p(a.x, a.y));c[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(a.x,d.y));c[3].vertices=this._vertexFromAlphaPoint(cc.p(a.x,d.y))}this._updateColor()}};a._updateRadial=function(){var a=this._node;if(a._sprite){var c,d=a._midPoint;c=a._percentage/100;var e=2*cc.PI*(a._reverseDirection?c:1-c),a=cc.p(d.x,1),f=cc.pRotateByAngle(a,d,e),e=0;if(0===c)f=a,e=0;else if(1===c)f=a,e=4;else{var g=cc.FLT_MAX,h=cc.ProgressTimer.TEXTURE_COORDS_COUNT;for(c=0;c<=h;++c){var k=(c+(h-1))%h,m=this._boundaryTexCoord(c%h),k= this._boundaryTexCoord(k);0===c?k=cc.pLerp(m,k,1-d.x):4===c&&(m=cc.pLerp(m,k,1-d.x));var n=cc.p(0,0);cc.pLineIntersect(m,k,d,f,n)&&(0!==c&&4!==c||0<=n.x&&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){var c=this._node._sprite;if(!c)return{u:0,v:0};var d=c.quad,e=cc.p(d.bl.texCoords.u, d.bl.texCoords.v),d=cc.p(d.tr.texCoords.u,d.tr.texCoords.v);c.textureRectRotated&&(c=a.x,a.x=a.y,a.y=c);return{u:e.x*(1-a.x)+d.x*a.x,v:e.y*(1-a.y)+d.y*a.y}};a._vertexFromAlphaPoint=function(a){var c=this._node._sprite;if(!c)return{x:0,y:0};var d=c.quad,c=cc.p(d.bl.vertices.x,d.bl.vertices.y),d=cc.p(d.tr.vertices.x,d.tr.vertices.y);return{x:c.x*(1-a.x)+d.x*a.x,y:c.y*(1-a.y)+d.y*a.y}};a._updateColor=function(){var a=this._node;if(a._sprite&&this._vertexData){for(var a=a._sprite.quad.tl.colors,c=this._vertexData, d=0,e=this._vertexDataCount;da.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.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.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;e>=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,r,p;for(r=0;rc&&(c=a[r]),a[r]>=1;for(p=m;p=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=P[b.length];f[g++]=h&65535;f[g++]=h>>16&255;f[g++]= h>>24;var k;switch(F){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;)s[g++]=0;for(g=0;29>=g;)u[g++]=0}s[256]=1;e=0;for(f=c.length;e=f){r&&d(r,-1);g=0; for(k=f-e;gt&&e+tv&&(m=k,v=t);if(258===t)break}k=new h(v,e-m);r?r.length2*k[u-1]+f[u]&&(k[u]=2*k[u-1]+f[u]),m[u]=Array(k[u]),p[u]=Array(k[u]);for(N=0;Nh[N]?(m[u][s]=H,p[u][s]=n,E+=2):(m[u][s]=h[N], p[u][s]=N,++N);B[u]=0;1===f[u]&&c(u)}h=r;k=0;for(m=d.length;k1<f&&a("undercommitted");g=0;for(h=b.length;g>>=1;return c}function t(a,b){this.input=a;this.a=new (y?Uint8Array:Array)(32768);this.h= K.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 r(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=Q;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 U:this.b=32768;this.a=new (y?Uint8Array:Array)(32768+ this.l+258);break;case Q: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 u(a){function b(a,c,d){var e,f,g,h;for(h=0;h>>8&255]<<16|J[a>>>16&255]<<8|J[a>>>24&255])>>32-b:J[a]>>8-b);if(8>b+f)g=g<>b-c-1&1,8===++f&&(f=0,d[e++]=J[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;0C;++C){for(var I=C,D=I,M=7,I=I>>>1;I;I>>>=1)D<<=1,D|=I&1,--M;A[C]=(D<>>0}var J=A,A=[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(A);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 E=2,A={NONE:0,r:1,j:E,N:3},G=[];for(C=0;288>C;C++)switch(F){case 143>=C:G.push([C+48,8]);break;case 255>=C:G.push([C-144+400,9]);break;case 279>=C:G.push([C-256+0,7]);break;case 287>=C:G.push([C-280+192,8]);break;default:a("invalid literal: "+C)}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;B[N++]=r&255;B[N++]=r>>>8&255;if(y)B.set(c,N),N+=c.length,B=B.subarray(0,N);else{k=0;for(r=c.length;kS)for(;0S?S:138,Q>S-3&&Q=Q?(P[K++]=17,P[K++]=Q-3,T[17]++):(P[K++]=18,P[K++]=Q-11,T[18]++),S-=Q;else if(P[K++]= b[w],T[b[w]]++,S--,3>S)for(;0S?S:6,Q>S-3&&Qw;w++)k[w]=T[v[w]];for(H=19;4=L;L++)I=k(),C[L]=I[2]<<24|I[1]<<16|I[0];var P=y?new Uint32Array(C):C,K=A;t.prototype.n=function(){var b,d,e,f,g=0;f=this.a;b=ia;switch(b){case ia:d=Math.LOG2E*Math.log(32768)-8;break;default:a(Error("invalid compression method"))}d= d<<4|b;f[g++]=d;switch(b){case ia:switch(this.h){case K.NONE:e=0;break;case K.r:e=1;break;case K.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", t);b("Zlib.Deflate.compress",function(a,b){return(new t(a,b)).n()});b("Zlib.Deflate.CompressionType",K);b("Zlib.Deflate.CompressionType.NONE",K.NONE);b("Zlib.Deflate.CompressionType.FIXED",K.r);b("Zlib.Deflate.CompressionType.DYNAMIC",K.j);var U=0,Q=1,A={D:U,C:Q};r.prototype.p=function(){for(;!this.s;){var b=v(this,3);b&1&&(this.s=F);b>>>=1;switch(b){case 0:var b=this.input,c=this.c,d=this.a,e=this.b,f=z,g=z,h=z,k=d.length,f=z;this.e=this.g=0;f=b[c++];f===z&&a(Error("invalid uncompressed block header: LEN (first byte)")); g=f;f=b[c++];f===z&&a(Error("invalid uncompressed block header: LEN (second byte)"));g|=f<<8;f=b[c++];f===z&&a(Error("invalid uncompressed block header: NLEN (first byte)"));h=f;f=b[c++];f===z&&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 U: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 Q: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(ba,oa);break;case 2:u(this);break;default:a(Error("unknown BTYPE: "+b))}}return this.t()};C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var B=y?new Uint16Array(C):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];var H=y?new Uint16Array(C):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];var S=y?new Uint8Array(C):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];var N=y?new Uint16Array(C):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];var T=y?new Uint8Array(C):C;C=new (y?Uint8Array:Array)(288);I=0;for(D=C.length;I=I?8:255>=I?9:279>=I?7:8;var ba=f(C);C=new (y?Uint8Array: Array)(30);I=0;for(D=C.length;If)d>=e&&(this.b=d,c=this.f(),d=this.b),c[d++]=f;else for(f-=257,h=H[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};r.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=s(this,a));)if(256>f)d>=e&&(c=this.f(),e=c.length),c[d++]=f;else for(f-=257,h=H[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};r.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};r.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",A);A.ADAPTIVE=A.C;A.BLOCK=A.D;b("Zlib.Inflate.prototype.decompress",w.prototype.p);A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];y&&new Uint16Array(A);A=[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(A);A=[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(A); A=[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(A);A=[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(A);A=new (y?Uint8Array:Array)(288);C=0;for(I=A.length;C=C?8:255>=C?9:279>=C?7:8;f(A);A=new (y?Uint8Array:Array)(30);C=0;for(I=A.length;Ca;++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,t,r,v,s;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;t=k*this.width;m=new Uint8Array(t*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=x?J=x+1:-127<=x&&-1>=x?E=-x+1:y=!0}else{for(var G=this.getUint8(u+z),x=0;x=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.duration< this._elapsed&&this.stopSystem()}this._particleIdx=0;b=cc.Particle.TemporaryPoints[0];this.positionType===cc.ParticleSystem.TYPE_FREE?cc.pIn(b,this.convertToWorldSpace(this._pointZeroForParticle)):this.positionType===cc.ParticleSystem.TYPE_RELATIVE&&(b.x=this._position.x,b.y=this._position.y);if(this._visible){for(var c=cc.Particle.TemporaryPoints[1],d=cc.Particle.TemporaryPoints[2],e=cc.Particle.TemporaryPoints[3],f=this._particles;this._particleIdxa?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(b!==a.zIndex){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.onEnter(),a.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){cc.Node.CanvasRenderCmd.call(this,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){cc.Node.WebGLRenderCmd.call(this,a);this._needDraw=!0};var a=cc.ParticleBatchNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParticleBatchNode.WebGLRenderCmd;a.rendering=function(a){a=this._node;0!==a.textureAtlas.totalQuads&&(this._shaderProgram.use(),this._shaderProgram._setUniformForMVPMatrixWithMat4(this._stackMatrix),cc.glBlendFuncForParticle(a._blendFunc.src,a._blendFunc.dst),a.textureAtlas.drawQuads())}; a._initWithTexture=function(){this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)};a.visit=function(a){if(this._node._visible){var c=cc.current_stack;c.stack.push(c.top);this._syncStatus(a);c.top=this._stackMatrix;cc.renderer.pushRenderCommand(this);this._dirtyFlag=0;cc.kmGLPopMatrix()}}})();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;cc._addEventListener(this._domInputControl,"input",function(){a._processDomInputString(a._domInputControl.value)},!1);cc._addEventListener(this._domInputControl,"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)&&cc._addEventListener(this._domInputControl,"keyup",function(b){b.keyCode===cc.KEY.backspace&&a._processDomInputString(a._domInputControl.value)},!1);cc._addEventListener(window,"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=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=a.length||!(g=a[d])||(h=m[b].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,t=0,c=c/2;if(m&&0=h||isNaN(h)?e:h;r.setPosition(t-n.width/2,c-h/2);t+=p;++f;f>=g&&(c-=e+5,e=g=f=0,++d)}},alignItemsInRows:function(){0=a.length||!(m=a[g]))||(t=n.width,h=h>=t||isNaN(t)?h:t,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(r&&0=t||isNaN(t)?h:t,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&&0b)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._layerSize=null;this._tiles=[];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){var b=cc.rect(0,0,0,0);b.width=this._tileSize.width;b.height=this._tileSize.height;a&=cc.TMX_TILE_FLIPPED_MASK;a-=parseInt(this.firstGid,10);var c=parseInt((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing),10);b.x=parseInt(a%c*(this._tileSize.width+this.spacing)+ this.margin,10);b.y=parseInt(parseInt(a/c,10)*(this._tileSize.height+this.spacing)+this.margin,10);return b}}); 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||a.y>=this._layerSize.height|| 0>a.x||0>a.y)throw Error("cc.TMXLayer.getTileAt(): invalid position");if(!this.tiles||!this._atlasIndexArray)return cc.log("cc.TMXLayer.getTileAt(): TMXLayer: the tiles map has been released"),null;var c=null,d=this.getTileGIDAt(a);if(0===d)return c;var e=0|a.x+a.y*this._layerSize.width,c=this.getChildByTag(e);c||(d=this.tileset.rectForGID(d),d=cc.rectPixelsToPoints(d),c=new cc.Sprite,c.initWithTexture(this.texture,d),c.batchNode=this,c.setPosition(this.getPositionAt(a)),c.vertexZ=this._vertexZForPos(a), c.anchorX=0,c.anchorY=0,c.opacity=this._opacity,d=this._atlasIndexForExistantZ(e),this.addSpriteWithoutQuad(c,d,e));return c},getTileGIDAt:function(a,b){if(null==a)throw Error("cc.TMXLayer.getTileGIDAt(): 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.getTileGIDAt(): invalid position");return this.tiles&&this._atlasIndexArray?(this.tiles[0|a.x+a.y*this._layerSize.width]&cc.TMX_TILE_FLIPPED_MASK)>>> 0:(cc.log("cc.TMXLayer.getTileGIDAt(): TMXLayer: the tiles map has been released"),null)},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._atlasIndexArray?(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)},setTileGID:function(a,b,c,d){if(!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&&this._atlasIndexArray)if(0!==a&&a>>0,0===a)this.removeTileAt(b);else if(0===e)this._insertTileForGID(c,b);else{var e=b.x+b.y*this._layerSize.width,f=this.getChildByTag(e);f?(a=this.tileset.rectForGID(a),a=cc.rectPixelsToPoints(a),f.setTextureRect(a,!1),null!=d&&this._setupTileSprite(f,b,c),this.tiles[e]=c):this._updateTileForGID(c,b)}}else cc.log("cc.TMXLayer.setTileGID(): TMXLayer: the tiles map has been released")},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||!this._atlasIndexArray)cc.log("cc.TMXLayer.removeTileAt(): TMXLayer: the tiles map has been released");else if(0!==this.getTileGIDAt(a)){cc._renderType===cc._RENDER_TYPE_CANVAS&&this._setNodeDirtyForCache();var c=0|a.x+a.y*this._layerSize.width,d=this._atlasIndexForExistantZ(c);this.tiles[c]=0;this._atlasIndexArray.splice(d,1);if(c=this.getChildByTag(c))cc.SpriteBatchNode.prototype.removeChild.call(this, c,!0);else if(cc._renderType===cc._RENDER_TYPE_WEBGL&&this.textureAtlas.removeQuadAtIndex(d),this._children)for(var c=this._children,e=0,f=c.length;e=d&&(g.atlasIndex=h-1)}}}},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)}, getProperty:function(a){return this.properties[a]},setupTiles:function(){this._renderCmd.initImageSize();this._parseInternalProperties();cc._renderType===cc._RENDER_TYPE_CANVAS&&this._setNodeDirtyForCache();for(var a=this._layerSize.height,b=this._layerSize.width,c=0;c=this.tileset.firstGid&&this._minGID>=this.tileset.firstGid|| cc.log("cocos2d:TMX: Only 1 tileset per layer is supported")},addChild:function(a,b,c){cc.log("addChild: is not supported on cc.TMXLayer. Instead use setTileGID or tileAt.")},removeChild:function(a,b){if(a)if(-1===this._children.indexOf(a))cc.log("cc.TMXLayer.removeChild(): Tile does not belong to TMXLayer");else{cc._renderType===cc._RENDER_TYPE_CANVAS&&this._setNodeDirtyForCache();var c=a.atlasIndex;this.tiles[this._atlasIndexArray[c]]=0;this._atlasIndexArray.splice(c,1);cc.SpriteBatchNode.prototype.removeChild.call(this, a,b);cc.renderer.childrenOrderDirty=!0}},getLayerName:function(){return this.layerName},setLayerName:function(a){this.layerName=a},_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}, _appendTileForGID:function(a,b){var c=this.tileset.rectForGID(a),c=cc.rectPixelsToPoints(c),d=0|b.x+b.y*this._layerSize.width,c=this._renderCmd._reusedTileWithRect(c);this._setupTileSprite(c,b,a);var e=this._atlasIndexArray.length;this.insertQuadFromSprite(c,e);this._atlasIndexArray.splice(e,0,d);return c},_insertTileForGID:function(a,b){var c=this.tileset.rectForGID(a),c=cc.rectPixelsToPoints(c),d=0|b.x+b.y*this._layerSize.width,c=this._renderCmd._reusedTileWithRect(c);this._setupTileSprite(c,b, a);var e=this._atlasIndexForNewZ(d);this.insertQuadFromSprite(c,e);this._atlasIndexArray.splice(e,0,d);if(this._children)for(var f=this._children,g=0,h=f.length;g=e&&(k.atlasIndex=m+1)}}this.tiles[d]=a;return c},_updateTileForGID:function(a,b){var c=this.tileset.rectForGID(a),d=this._contentScaleFactor,c=cc.rect(c.x/d,c.y/d,c.width/d,c.height/d),d=b.x+b.y*this._layerSize.width,c=this._renderCmd._reusedTileWithRect(c);this._setupTileSprite(c,b,a);c.atlasIndex= this._atlasIndexForExistantZ(d);c.dirty=!0;c.updateTransform();this.tiles[d]=a;return c},_parseInternalProperties:function(){var a=this.getProperty("cc_vertexz");if(a)if("automatic"===a){this._useAutomaticVertexZ=!0;var b=this.getProperty("cc_alpha_func"),a=0;b&&(a=parseFloat(b));cc._renderType===cc._RENDER_TYPE_WEBGL&&(this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),b=cc._renderContext.getUniformLocation(this.shaderProgram.getProgram(),cc.UNIFORM_ALPHA_TEST_VALUE_S), this.shaderProgram.use(),this.shaderProgram.setUniformLocationWith1f(b,a))}else this._vertexZvalue=parseInt(a,10)},_setupTileSprite:function(a,b,c){var d=b.x+b.y*this._layerSize.width;a.setPosition(this.getPositionAt(b));cc._renderType===cc._RENDER_TYPE_WEBGL?a.vertexZ=this._vertexZForPos(b):a.tag=d;a.anchorX=0;a.anchorY=0;a.opacity=this._opacity;cc._renderType===cc._RENDER_TYPE_WEBGL&&(a.rotation=0);a.setFlippedX(!1);a.setFlippedY(!1);(c&cc.TMX_TILE_DIAGONAL_FLAG)>>>0?(a.anchorX=0.5,a.anchorY=0.5, a.x=this.getPositionAt(b).x+a.width/2,a.y=this.getPositionAt(b).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.rotation=90:b===cc.TMX_TILE_VERTICAL_FLAG?a.rotation=270:(a.rotation=b===(cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_HORIZONTAL_FLAG)>>>0?90: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){var b=0,c=0;if(this._useAutomaticVertexZ)switch(this.layerOrientation){case cc.TMX_ORIENTATION_ISO:c= this._layerSize.width+this._layerSize.height;b=-(c-(a.x+a.y));break;case cc.TMX_ORIENTATION_ORTHO:b=-(this._layerSize.height-a.y);break;case cc.TMX_ORIENTATION_HEX:cc.log("TMX Hexa zOrder not supported");break;default:cc.log("TMX invalid value")}else b=this._vertexZvalue;return b},_atlasIndexForExistantZ:function(a){var b;if(this._atlasIndexArray)for(var c=this._atlasIndexArray,d=0,e=c.length;d=e)){var f=this._node;this._renderingChildToCache();var g=a||cc._renderContext;a=g.getContext();g.setGlobalAlpha(e);(e=this._cacheCanvas)&&0!==e.width&&0!==e.height&&(g.setTransform(this._realWorldTransform,c,d),g=e.height*d,f.layerOrientation===cc.TMX_ORIENTATION_HEX?a.drawImage(e,0,0,e.width,e.height,0,-g+0.5*f._mapTileSize.height*d,e.width*c,g):a.drawImage(e,0,0,e.width,e.height,0,-g,e.width*c,g));cc.g_NumberOfDraws++}};a._updateCacheContext=function(a, c){var d=this._node,e=d._contentSize,f=this._cacheCanvas,g=cc.contentScaleFactor();f.width=0|1.5*e.width*g;f.height=0|1.5*e.height*g;d.layerOrientation===cc.TMX_ORIENTATION_HEX?this._cacheContext.setOffset(0,0.5*-d._mapTileSize.height):this._cacheContext.setOffset(0,0);d=this._cacheTexture._contentSize;d.width=f.width;d.height=f.height};a.getTexture=function(){return this._cacheTexture};a.visit=function(a){var c=this._node,d,e=c._children;if(c._visible&&e&&0!==e.length){if(a=a||this.getParentRenderCmd())this._curLevel= a._curLevel+1;this._syncStatus(a);if(this._cacheDirty){a=this._cacheContext;var f=this._cacheCanvas,g=a.getContext(),h=c.__instanceId,k=cc.renderer;k._turnToCacheMode(h);c.sortAllChildren();c=0;for(d=e.length;cb?window.__audioSupport={MULTI_CHANNEL:!1,WEB_AUDIO:!0,AUTOPLAY:!1}:42===b&&(window.__audioSupport.NEED_MANUAL_LOOP= !0);break;case a.BROWSER_TYPE_MIUI:cc.sys.isMobile&&(b=b.match(/\d+/g),2>b[0]||2===b[0]&&0===b[1]&&1>=b[2])&&(window.__audioSupport.AUTOPLAY=!1)}})(); cc.Audio=cc.Class.extend({volume:1,loop:!1,src:null,_touch:!1,_playing:!1,_AUDIO_TYPE:"AUDIO",_pause:!1,_buffer:null,_currentSource:null,_startTime:null,_currentTime:null,_context:null,_volume:null,_ignoreEnded:!1,_manualLoop:!1,_element:null,ctor:function(a,b,c){a&&(this._context=a);b&&(this._volume=b);a&&b&&(this._AUDIO_TYPE="WEBAUDIO");this.src=c},_setBufferCallback:null,setBuffer:function(a){if(a){var b=this._playing;this._AUDIO_TYPE="WEBAUDIO";this._buffer&&this._buffer!==a&&this.getPlaying()&& this.stop();this._buffer=a;b&&this.play();this._volume.gain.value=this.volume;this._setBufferCallback&&this._setBufferCallback(a)}},_setElementCallback:null,setElement:function(a){if(a){var b=this._playing;this._AUDIO_TYPE="AUDIO";this._element&&this._element!==a&&this.getPlaying()&&this.stop();this._element=a;b&&this.play();a.volume=this.volume;a.loop=this.loop;this._setElementCallback&&this._setElementCallback(a)}},play:function(a,b){this._playing=!0;this.loop=void 0===b?this.loop:b;"AUDIO"===this._AUDIO_TYPE? this._playOfAudio(a):this._playOfWebAudio(a)},getPlaying:function(){if(!this._playing)return!1;if("AUDIO"===this._AUDIO_TYPE){var a=this._element;return!a||this._pause||a.ended?this._playing=!1:!0}return(a=this._currentSource)&&a.playbackState?this._currentTime+this._context.currentTime-this._startTime b.buffer.duration)this._stopOfWebAudio();else return;b=this._context.createBufferSource();b.buffer=this._buffer;b.connect(this._volume);b.loop=this._manualLoop?!1:this.loop;this._startTime=this._context.currentTime;this._currentTime=a||0;this._ignoreEnded=!1;if(b.start)b.start(0,a||0);else if(b.noteGrainOn){var c=b.buffer.duration;this.loop?b.noteGrainOn(0,a,c):b.noteGrainOn(0,a,c-a)}else b.noteOn(0);this._currentSource=b;var d=this;b.onended=function(){d._manualLoop&&d._playing&&d.loop?(d.stop(), d.play()):d._ignoreEnded?d._ignoreEnded=!1:d._pause?d._playing=!1:d.stop()}}},_playOfAudio:function(){var a=this._element;a&&(a.loop=this.loop,a.play())},stop:function(){this._playing=!1;"AUDIO"===this._AUDIO_TYPE?this._stopOfAudio():this._stopOfWebAudio()},_stopOfWebAudio:function(){var a=this._currentSource;this._ignoreEnded=!0;a&&(a.stop(0),this._currentSource=null)},_stopOfAudio:function(){var a=this._element;a&&(a.pause(),a.duration&&Infinity!==a.duration&&(a.currentTime=0))},pause:function(){!1!== this.getPlaying()&&(this._playing=!1,this._pause=!0,"AUDIO"===this._AUDIO_TYPE?this._pauseOfAudio():this._pauseOfWebAudio())},_pauseOfWebAudio:function(){this._currentTime+=this._context.currentTime-this._startTime;var a=this._currentSource;a&&a.stop(0)},_pauseOfAudio:function(){var a=this._element;a&&a.pause()},resume:function(){this._pause&&("AUDIO"===this._AUDIO_TYPE?this._resumeOfAudio():this._resumeOfWebAudio(),this._pause=!1,this._playing=!0)},_resumeOfWebAudio:function(){var a=this._currentSource; a&&(this._startTime=this._context.currentTime,this._playOfWebAudio(this._currentTime%a.buffer.duration))},_resumeOfAudio:function(){var a=this._element;a&&a.play()},setVolume:function(a){1a&&(a=0);this.volume=a;"AUDIO"===this._AUDIO_TYPE?this._element&&(this._element.volume=a):this._volume&&(this._volume.gain.value=a)},getVolume:function(){return this.volume},cloneNode:function(){var a,b;if("AUDIO"===this._AUDIO_TYPE){a=new cc.Audio;var c=document.createElement("audio");c.src=this.src; a.setElement(c)}else c=this._context.createGain(),c.gain.value=1,c.connect(this._context.destination),a=new cc.Audio(this._context,c,this.src),this._buffer?a.setBuffer(this._buffer):(b=this,this._setBufferCallback=function(c){a.setBuffer(c);b._setBufferCallback=null}),a._manualLoop=this._manualLoop;a._AUDIO_TYPE=this._AUDIO_TYPE;return a}}); (function(a){var b=a.WEB_AUDIO,c=a.MULTI_CHANNEL,d=a.AUTOPLAY,e=[];(function(){var a=document.createElement("audio");if(a.canPlayType){var b=a.canPlayType('audio/ogg; codecs\x3d"vorbis"');b&&""!==b&&e.push(".ogg");(b=a.canPlayType("audio/mpeg"))&&""!==b&&e.push(".mp3");(b=a.canPlayType('audio/wav; codecs\x3d"1"'))&&""!==b&&e.push(".wav");(b=a.canPlayType("audio/mp4"))&&""!==b&&e.push(".mp4");(a=a.canPlayType("audio/x-m4a"))&&""!==a&&e.push(".m4a")}})();try{if(b){var f=new (window.AudioContext||window.webkitAudioContext|| window.mozAudioContext);a.DELAY_CREATE_CTX&&setTimeout(function(){f=new (window.AudioContext||window.webkitAudioContext||window.mozAudioContext)},0)}}catch(g){b=!1,cc.log("browser don't support web audio")}var h={cache:{},load:function(c,d,g,k){if(0===e.length)return k("can not support audio!");cc.loader.audioPath&&(c=cc.path.join(cc.loader.audioPath,c));var r=cc.path.extname(c),v=[r];for(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:5,_effectVolume:1,playEffect:function(a,d){if(!c)return null;var e=this._audioPool[a];e||(e=this._audioPool[a]=[]);var f;for(f=0;fthis._maxAudioInstance)cc.log("Error: %s greater than %d",a,this._maxAudioInstance);else{var g=h.cache[a];g||(cc.loader.load(a), g=h.cache[a]);g=g.cloneNode();g.setVolume(this._effectVolume);g.loop=d||!1;g.play();e.push(g)}return g},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.Scale9Sprite=cc.Node.extend({_spriteRect:null,_capInsetsInternal:null,_positionsAreDirty:!1,_scale9Image:null,_topLeft:null,_top:null,_topRight:null,_left:null,_centre:null,_right:null,_bottomLeft:null,_bottom:null,_bottomRight:null,_scale9Dirty:!0,_opacityModifyRGB:!1,_originalSize:null,_preferredSize:null,_opacity:0,_color:null,_capInsets:null,_insetLeft:0,_insetTop:0,_insetRight:0,_insetBottom:0,_spritesGenerated:!1,_spriteFrameRotated:!1,_textureLoaded:!1,_className:"Scale9Sprite",_flippedX:!1, _flippedY:!1,textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},_updateCapInset:function(){var a;a=this._insetLeft;var b=this._insetTop,c=this._insetRight,d=this._spriteRect,e=this._insetBottom;a=0===a&&0===b&&0===c&&0===e?cc.rect(0,0,0,0):this._spriteFrameRotated?cc.rect(e,a,d.width-c-a,d.height-b-e):cc.rect(a,b,d.width-a-c,d.height-b-e);this.setCapInsets(a)},_updatePositions:function(){if(this._topLeft&&this._topRight&&this._bottomRight&& this._bottomLeft&&this._centre){var a=this._contentSize,b=this._topLeft,c=this._topRight,d=this._bottomRight,e=this._bottomLeft,f=this._centre,g=this._centre.getContentSize(),h=b.getContentSize(),k=e.getContentSize(),m=a.width-h.width-c.getContentSize().width,a=a.height-h.height-d.getContentSize().height,m=m/g.width,a=a/g.height,h=g.width*m,n=g.height*a,p=k.width,k=k.height;if(cc._renderType===cc._RENDER_TYPE_WEBGL){var t=Math.round(h);h!==t&&(h=t,m=h/g.width);t=Math.round(n);n!==t&&(n=t,a=n/g.height)}f.setScaleX(m); f.setScaleY(a);var g=this._left,t=this._right,r=this._top,v=this._bottom,s=cc.p(0,0);e.setAnchorPoint(s);d.setAnchorPoint(s);b.setAnchorPoint(s);c.setAnchorPoint(s);g.setAnchorPoint(s);t.setAnchorPoint(s);r.setAnchorPoint(s);v.setAnchorPoint(s);f.setAnchorPoint(s);e.setPosition(0,0);d.setPosition(p+h,0);b.setPosition(0,k+n);c.setPosition(p+h,k+n);g.setPosition(0,k);g.setScaleY(a);t.setPosition(p+h,k);t.setScaleY(a);v.setPosition(p,0);v.setScaleX(m);r.setPosition(p,k+n);r.setScaleX(m);f.setPosition(p, k)}},ctor:function(a,b,c){cc.Node.prototype.ctor.call(this);this._spriteRect=cc.rect(0,0,0,0);this._capInsetsInternal=cc.rect(0,0,0,0);this._originalSize=cc.size(0,0);this._preferredSize=cc.size(0,0);this._capInsets=cc.rect(0,0,0,0);if(void 0!=a)if(a instanceof cc.SpriteFrame)this.initWithSpriteFrame(a,b);else{var d=cc.spriteFrameCache.getSpriteFrame(a);null!=d?this.initWithSpriteFrame(d,b):this.initWithFile(a,b,c)}else this.init()},getSprite:function(){return this._scale9Image},getOriginalSize:function(){return cc.size(this._originalSize)}, getPreferredSize:function(){return cc.size(this._preferredSize)},_getPreferredWidth:function(){return this._preferredSize.width},_getPreferredHeight:function(){return this._preferredSize.height},setPreferredSize:function(a){this.setContentSize(a);this._preferredSize=a;this._positionsAreDirty&&(this._updatePositions(),this._positionsAreDirty=!1,this._scale9Dirty=!0)},_setPreferredWidth:function(a){this._setWidth(a);this._preferredSize.width=a},_setPreferredHeight:function(a){this._setHeight(a);this._preferredSize.height= a},setOpacity:function(a){this._scale9Image&&(cc.Node.prototype.setOpacity.call(this,a),this._scale9Dirty=!0)},setColor:function(a){if(this._scale9Image){cc.Node.prototype.setColor.call(this,a);for(var b=this._scale9Image.getChildren(),c=0;c=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,t=0;if(this._children&&0=p||null==p?k:p),this._children[c].setPosition(f+d[h]/2,t-g.height/ 2),t-=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},setContentOffset:function(a,b){if(b)this.setContentOffsetInDuration(a,BOUNCE_DURATION);else{if(!this._bounceable){var c=this.minContainerOffset(),d=this.maxContainerOffset(); a.x=Math.max(c.x,Math.min(d.x,a.x));a.y=Math.max(c.y,Math.min(d.y,a.y))}this._container.setPosition(a);c=this._delegate;null!=c&&c.scrollViewDidScroll&&c.scrollViewDidScroll(this)}},getContentOffset:function(){var a=this._container.getPosition();return cc.p(a.x,a.y)},setContentOffsetInDuration:function(a,b){var c=cc.moveTo(b,a),d=cc.callFunc(this._stoppedAnimatedScroll,this);this._container.runAction(cc.sequence(c,d));this.schedule(this._performedAnimatedScroll)},setZoomScale:function(a,b){if(b)this.setZoomScaleInDuration(a, BOUNCE_DURATION);else{var c=this._container;if(c.getScale()!==a){var d,e;0===this._touchLength?(e=this._viewSize,e=cc.p(0.5*e.width,0.5*e.height),e=this.convertToWorldSpace(e)):e=this._touchPoint;d=c.convertToNodeSpace(e);c.setScale(Math.max(this._minScale,Math.min(this._maxScale,a)));d=c.convertToWorldSpace(d);e=cc.pSub(e,d);this._delegate&&this._delegate.scrollViewDidZoom&&this._delegate.scrollViewDidZoom(this);this.setContentOffset(cc.pAdd(c.getPosition(),e))}}},getZoomScale:function(){return this._container.getScale()}, setZoomScaleInDuration:function(a,b){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._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){cc.Layer.CanvasRenderCmd.call(this,a);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.endCmd=new cc.CustomRenderCmd(this,this._endCmd)};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();if(e._clippingToBounds){this._scissorRestored= !1;f.setTransform(this._worldTransform,c,d);var g=e.getScaleX(),f=e.getScaleY();c*=e._viewSize.width*g;d*=e._viewSize.height*f;a.beginPath();a.rect(0,0,c,-d);a.closePath();a.clip()}};a._endCmd=function(a){a=a||cc._renderContext;a.restore()};a.visit=function(a){var c=this._node,d=c._children;this.transform(a);cc.renderer.pushRenderCommand(this.startCmd);if(d&&0e._localZOrder)e._renderCmd.visit();else break;for(;a=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.readByte();if(n===CCB_PLATFORM_ALL||n===CCB_PLATFORM_IOS||n===CCB_PLATFORM_MAC)m=!0;a instanceof cc.BuilderFile?a.getCCBFileNode()&&g&&(a=a.getCCBFileNode(),m=-1!==a.userObject.indexOf(k)): g&&a===c.getAnimationManager().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),h=c.getAnimationManager().getContainerSize(b);b=cc._getAbsolutePosition(e,f,g,h,d);a.setPosition(cc.getAbsolutePosition(b,g,h,d));-1=e?0|255*e:e,f=0|255*c.readFloat(),g=0|255*c.readFloat(),h=0|255*c.readFloat();c=c.readFloat(); var k=[];k[0]={r:a,g:b,b:d,a:e};k[1]={r:f,g:g,b:h,a:1>=c?0|255*c:c};return k},parsePropTypeFlip:function(a,b,c){a=c.readBool();c=c.readBool();return[a,c]},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.isJSControlled())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.getAnimationManager().getRootNode():d===CCB_TARGETTYPE_OWNER&&(e=c.getOwner()),null!==e)if(0>3;this._checkSize(c);var c=Math.pow(2,b-1)-1,e=this._readBitsOnly(a+b,1,d),f=this._readBitsOnly(a,b,d),g=0,h=2,k=0;do for(var m=this._readByteOnly(++k,d),n=a%8||8,p=1<>=1;)m&p&&(g+=1/h),h*=2;while(a-= n);this._currentByte+=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)},_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._readByteOnly(f,c)>>e&(1<<(g?8-e:b))-1;for(g&&d&&(b+=(this._readByteOnly(a++,c)&(1<this._data.length))throw Error("out of the data bound");return a},_alignBits:function(){this._currentBit&&(this._currentBit=0,this._currentByte++)},_readUTF8:function(){}});cc.BuilderReader._ccbResolutionScale=1;cc.BuilderReader.setResolutionScale=function(a){cc.BuilderReader._ccbResolutionScale=a};cc.BuilderReader.getResolutionScale=function(){return cc.BuilderReader._ccbResolutionScale}; cc.BuilderReader.loadAsScene=function(a,b,c,d){d=d||cc.BuilderReader.getResourcePath();a=cc.BuilderReader.load(a,b,c,d);b=new cc.Scene;b.addChild(a);return b};cc.BuilderReader._controllerClassCache={};cc.BuilderReader.registerController=function(a,b){cc.BuilderReader._controllerClassCache[a]=cc.Class.extend(b)}; cc.BuilderReader.load=function(a,b,c,d){d=d||cc.BuilderReader.getResourcePath();var e=new cc.BuilderReader(cc.NodeLoaderLibrary.newDefaultCCNodeLoaderLibrary());e.setCCBRootPath(d);if(5>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.Color3BWapper=cc.Class.extend({_color:null,ctor:function(){this._color=cc.color(0,0,0)},getColor:function(){return this._color}});cc.Color3BWapper.create=function(a){var b=new cc.Color3BWapper;b&&(b._color.r=a.r,b._color.g=a.g,b._color.b=a.b);return b}; 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){d=cc.p(0,0);b===CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT?d=a:b===CCB_POSITIONTYPE_RELATIVE_TOP_LEFT?(d.x=a.x,d.y=c.height-a.y):b===CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT?(d.x=c.width-a.x,d.y=c.height-a.y):b===CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT?(d.x=c.width-a.x,d.y=a.y):b===CCB_POSITIONTYPE_PERCENT?(d.x=c.width*a.x/100,d.y=c.height*a.y/100):b===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(b=cc.BuilderReader.getResolutionScale(),d.x=a.x*b,d.y=a.y*b);return d}; cc._getAbsolutePosition=function(a,b,c,d,e){e=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.setScaleX(b);a.setScaleY(c)};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,b){this._nodeSequences.setObject(b,a)},setBaseValue:function(a,b,c){var d=this._baseValues.objectForKey(b);d||(d=new cc._Dictionary,this._baseValues.setObject(d,b));d.setObject(a,c)},moveAnimationsFromNode:function(a,b){var c=this._baseValues,d=c.objectForKey(a);null!==d&&(c.setObject(d,b),c.removeObjectForKey(a)); c=this._nodeSequences;d=c.objectForKey(a);null!=d&&(c.setObject(d,b),c.removeObjectForKey(a))},getActionForCallbackChannel:function(a){var b=0,c=[];a=a.getKeyframes();for(var d=a.length,e=0;ec.length?null:cc.sequence(c)},getActionForSoundChannel:function(a){var b=0,c=[];a=a.getKeyframes();for(var d=a.length,e=0;ec.length?null:cc.sequence(c)},runAnimationsForSequenceNamed:function(a){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),0)},runAnimationsForSequenceNamedTweenDuration:function(a,b){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),b)},runAnimationsForSequenceIdTweenDuration:function(a,b){if(-1===a)throw Error("cc.BuilderAnimationManager.runAnimationsForSequenceIdTweenDuration(): Sequence id should not be -1"); b=b||0;this._rootNode.stopAllActions();for(var c=this._nodeSequences.allKeys(),d=0,e=c.length;dc._localZOrder)c.visit(this);else break;for(c=0;ch._localZOrder)this._changeProtectedChild(h),h.visit(this);else break;for(cc.renderer.pushRenderCommand(this);ag[a]._localZOrder)g[a].visit(this);else break;for(d=0;dn._localZOrder)this._changeProtectedChild(n),n.visit(this);else break;for(cc.renderer.pushRenderCommand(this);a=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},_setYPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentY(a.x);b.refreshLayout()}else this._positionPercent.y=a},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;bk&&(e=b.x,g+=k);c=a.x+c-(b.x+b.width);0a&&(f=b.x,h+=a);0>g&&(g=0);0>h&&(h=0);this._clippingRect.x= e;this._clippingRect.y=f;this._clippingRect.width=g;this._clippingRect.height=h}else this._clippingRect.x=a.x-c*this._anchorPoint.x,this._clippingRect.y=a.y-d*this._anchorPoint.y,this._clippingRect.width=c,this._clippingRect.height=d;this._clippingRectDirty=!1}return this._clippingRect},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);var a=this._contentSize;this._setStencilClippingSize(a);this._clippingRectDirty=this._doLayoutDirty=!0;this._backGroundImage&&(this._backGroundImage.setPosition(0.5* a.width,0.5*a.height),this._backGroundScale9Enabled&&this._backGroundImage instanceof ccui.Scale9Sprite&&this._backGroundImage.setPreferredSize(a));this._colorRender&&this._colorRender.setContentSize(a);this._gradientRender&&this._gradientRender.setContentSize(a)},setBackGroundImageScale9Enabled:function(a){this._backGroundScale9Enabled!==a&&(this.removeProtectedChild(this._backGroundImage),this._backGroundImage=null,this._backGroundScale9Enabled=a,this._addBackGroundImage(),this.setBackGroundImage(this._backGroundImageFileName, this._bgImageTexType),this.setBackGroundImageCapInsets(this._backGroundImageCapInsets))},isBackGroundImageScale9Enabled:function(){return this._backGroundScale9Enabled},setBackGroundImage:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;null===this._backGroundImage&&(this._addBackGroundImage(),this.setBackGroundImageScale9Enabled(this._backGroundScale9Enabled));this._backGroundImageFileName=a;this._bgImageTexType=b;var c=this._backGroundImage;switch(this._bgImageTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a); break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._backGroundScale9Enabled&&c.setPreferredSize(this._contentSize);this._backGroundImageTextureSize=c.getContentSize();c.setPosition(0.5*this._contentSize.width,0.5*this._contentSize.height);this._updateBackGroundImageColor()}},setBackGroundImageCapInsets:function(a){if(a){var b=this._backGroundImageCapInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._backGroundScale9Enabled&&this._backGroundImage.setCapInsets(a)}},getBackGroundImageCapInsets:function(){return cc.rect(this._backGroundImageCapInsets)}, _supplyTheLayoutParameterLackToChild:function(a){if(a)switch(this._layoutType){case ccui.Layout.LINEAR_HORIZONTAL:case ccui.Layout.LINEAR_VERTICAL:var b=a.getLayoutParameter(ccui.LayoutParameter.LINEAR);b||a.setLayoutParameter(new ccui.LinearLayoutParameter);break;case ccui.Layout.RELATIVE:(b=a.getLayoutParameter(ccui.LayoutParameter.RELATIVE))||a.setLayoutParameter(new ccui.RelativeLayoutParameter)}},_addBackGroundImage:function(){var a=this._contentSize;this._backGroundScale9Enabled?(this._backGroundImage= new ccui.Scale9Sprite,this._backGroundImage.setPreferredSize(a)):this._backGroundImage=new cc.Sprite;this.addProtectedChild(this._backGroundImage,ccui.Layout.BACKGROUND_IMAGE_ZORDER,-1);this._backGroundImage.setPosition(0.5*a.width,0.5*a.height)},removeBackGroundImage:function(){this._backGroundImage&&(this.removeProtectedChild(this._backGroundImage),this._backGroundImage=null,this._backGroundImageFileName="",this._backGroundImageTextureSize.width=0,this._backGroundImageTextureSize.height=0)},setBackGroundColorType:function(a){if(this._colorType!== a){switch(this._colorType){case ccui.Layout.BG_COLOR_NONE:this._colorRender&&(this.removeProtectedChild(this._colorRender),this._colorRender=null);this._gradientRender&&(this.removeProtectedChild(this._gradientRender),this._gradientRender=null);break;case ccui.Layout.BG_COLOR_SOLID:this._colorRender&&(this.removeProtectedChild(this._colorRender),this._colorRender=null);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender&&(this.removeProtectedChild(this._gradientRender),this._gradientRender= null)}this._colorType=a;switch(this._colorType){case ccui.Layout.BG_COLOR_SOLID:this._colorRender=new cc.LayerColor;this._colorRender.setContentSize(this._contentSize);this._colorRender.setOpacity(this._opacity);this._colorRender.setColor(this._color);this.addProtectedChild(this._colorRender,ccui.Layout.BACKGROUND_RENDERER_ZORDER,-1);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender=new cc.LayerGradient(cc.color(255,0,0,255),cc.color(0,255,0,255)),this._gradientRender.setContentSize(this._contentSize), this._gradientRender.setOpacity(this._opacity),this._gradientRender.setStartColor(this._startColor),this._gradientRender.setEndColor(this._endColor),this._gradientRender.setVector(this._alongVector),this.addProtectedChild(this._gradientRender,ccui.Layout.BACKGROUND_RENDERER_ZORDER,-1)}}},getBackGroundColorType:function(){return this._colorType},setBackGroundColor:function(a,b){b?(this._startColor.r=a.r,this._startColor.g=a.g,this._startColor.b=a.b,this._gradientRender&&this._gradientRender.setStartColor(a), this._endColor.r=b.r,this._endColor.g=b.g,this._endColor.b=b.b,this._gradientRender&&this._gradientRender.setEndColor(b)):(this._color.r=a.r,this._color.g=a.g,this._color.b=a.b,this._colorRender&&this._colorRender.setColor(a))},getBackGroundColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundStartColor:function(){var a=this._startColor;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundEndColor:function(){var a=this._endColor;return cc.color(a.r,a.g,a.b,a.a)},setBackGroundColorOpacity:function(a){this._opacity= a;switch(this._colorType){case ccui.Layout.BG_COLOR_SOLID:this._colorRender.setOpacity(a);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender.setOpacity(a)}},getBackGroundColorOpacity:function(){return this._opacity},setBackGroundColorVector:function(a){this._alongVector.x=a.x;this._alongVector.y=a.y;this._gradientRender&&this._gradientRender.setVector(a)},getBackGroundColorVector:function(){return this._alongVector},setBackGroundImageColor:function(a){this._backGroundImageColor.r=a.r;this._backGroundImageColor.g= a.g;this._backGroundImageColor.b=a.b;this._updateBackGroundImageColor()},setBackGroundImageOpacity:function(a){this._backGroundImageColor.a=a;this.getBackGroundImageColor()},getBackGroundImageColor:function(){var a=this._backGroundImageColor;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundImageOpacity:function(){return this._backGroundImageColor.a},_updateBackGroundImageColor:function(){this._backGroundImage&&this._backGroundImage.setColor(this._backGroundImageColor)},getBackGroundImageTextureSize:function(){return this._backGroundImageTextureSize}, setLayoutType:function(a){this._layoutType=a;a=this._children;for(var b=null,c=0;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(null!=b){var c=this._getWorldCenterPoint(b),d=this._getWorldCenterPoint(this._findFirstNonLayoutWidget());a===ccui.Widget.LEFT?this.onPassFocusToChild=c.x>d.x?this._findNearestChildWidgetIndex.bind(this):this._findFarthestChildWidgetIndex.bind(this):a===ccui.Widget.RIGHT?this.onPassFocusToChild=c.x>d.x?this._findFarthestChildWidgetIndex.bind(this): this._findNearestChildWidgetIndex.bind(this):a===ccui.Widget.DOWN?this.onPassFocusToChild=c.y>d.y?this._findNearestChildWidgetIndex.bind(this):this._findFarthestChildWidgetIndex.bind(this):a===ccui.Widget.UP?this.onPassFocusToChild=c.yf.getLocalZOrder())f.visit(this);else break;for(;df.getLocalZOrder())f.visit(this);else break;for(;ek.getLocalZOrder())k.visit(this); else break;for(;ek.getLocalZOrder())k.visit(this);else break;for(;a=a.width||0>=a.height){this._buttonNormalRenderer.setScale(1);return}var b=this._contentSize.width/a.width,a=this._contentSize.height/a.height;this._buttonNormalRenderer.setScaleX(b);this._buttonNormalRenderer.setScaleY(a);this._normalTextureScaleXInSize=b;this._normalTextureScaleYInSize=a}this._buttonNormalRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/ 2)},_pressedTextureScaleChangedWithSize:function(){if(this._ignoreSize&&!this._unifySize)this._scale9Enabled||(this._buttonClickedRenderer.setScale(1),this._pressedTextureScaleXInSize=this._pressedTextureScaleYInSize=1);else if(this._scale9Enabled)this._buttonClickedRenderer.setPreferredSize(this._contentSize),this._pressedTextureScaleXInSize=this._pressedTextureScaleYInSize=1,this._buttonClickedRenderer.setScale(this._pressedTextureScaleXInSize,this._pressedTextureScaleYInSize);else{var a=this._pressedTextureSize; if(0>=a.width||0>=a.height){this._buttonClickedRenderer.setScale(1);return}var b=this._contentSize.width/a.width,a=this._contentSize.height/a.height;this._buttonClickedRenderer.setScaleX(b);this._buttonClickedRenderer.setScaleY(a);this._pressedTextureScaleXInSize=b;this._pressedTextureScaleYInSize=a}this._buttonClickedRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},_disabledTextureScaleChangedWithSize:function(){if(this._ignoreSize&&!this._unifySize)this._scale9Enabled&& this._buttonDisableRenderer.setScale(1);else if(this._scale9Enabled)this._buttonDisableRenderer.setScale(1),this._buttonDisableRenderer.setPreferredSize(this._contentSize);else{var a=this._disabledTextureSize;if(0>=a.width||0>=a.height){this._buttonDisableRenderer.setScale(1);return}var b=this._contentSize.height/a.height;this._buttonDisableRenderer.setScaleX(this._contentSize.width/a.width);this._buttonDisableRenderer.setScaleY(b)}this._buttonDisableRenderer.setPosition(this._contentSize.width/2, this._contentSize.height/2)},_adaptRenderers:function(){this._normalTextureAdaptDirty&&(this._normalTextureScaleChangedWithSize(),this._normalTextureAdaptDirty=!1);this._pressedTextureAdaptDirty&&(this._pressedTextureScaleChangedWithSize(),this._pressedTextureAdaptDirty=!1);this._disabledTextureAdaptDirty&&(this._disabledTextureScaleChangedWithSize(),this._disabledTextureAdaptDirty=!1)},_updateTitleLocation:function(){this._titleRenderer.setPosition(0.5*this._contentSize.width,0.5*this._contentSize.height)}, setPressedActionEnabled:function(a){this.pressedActionEnabled=a},setTitleText:function(a){a!==this.getTitleText()&&(this._titleRenderer.setString(a),this._ignoreSize?(a=this.getVirtualRendererSize(),this.setContentSize(a)):this._titleRenderer._renderCmd._updateTTF())},getTitleText:function(){return this._titleRenderer.getString()},setTitleColor:function(a){this._titleRenderer.setFontFillColor(a)},getTitleColor:function(){return this._titleRenderer._getFillStyle()},setTitleFontSize:function(a){this._titleRenderer.setFontSize(a); this._fontSize=a},getTitleFontSize:function(){return this._titleRenderer.getFontSize()},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},getNormalTextureSize:function(){return this._normalTextureSize},setTitleFontName:function(a){this._titleRenderer.setFontName(a);this._fontName=a},getTitleRenderer:function(){return this._titleRenderer},getTitleFontName:function(){return this._titleRenderer.getFontName()},_setTitleFont:function(a){this._titleRenderer.font= a},_getTitleFont:function(){return this._titleRenderer.font},getDescription:function(){return"Button"},_createCloneInstance:function(){return new ccui.Button},_copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this.setScale9Enabled(a._scale9Enabled);this.loadTextureNormal(a._normalFileName,a._normalTexType);this.loadTexturePressed(a._clickedFileName,a._pressedTexType);this.loadTextureDisabled(a._disabledFileName,a._disabledTexType);this.setCapInsetsNormalRenderer(a._capInsetsNormal); this.setCapInsetsPressedRenderer(a._capInsetsPressed);this.setCapInsetsDisabledRenderer(a._capInsetsDisabled);this.setTitleText(a.getTitleText());this.setTitleFontName(a.getTitleFontName());this.setTitleFontSize(a.getTitleFontSize());this.setTitleColor(a.getTitleColor());this.setPressedActionEnabled(a.pressedActionEnabled);this.setZoomScale(a._zoomScale)},setColor:function(a){cc.ProtectedNode.prototype.setColor.call(this,a);this._updateTexturesRGBA()},_getNormalSize:function(){var a;null!==this._titleRenderer&& (a=this._titleRenderer.getContentSize());var b;null!==this._buttonNormalRenderer&&(b=this._buttonNormalRenderer.getContentSize());return cc.size(a.width>b.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);this.init(a,void 0===b?0:b)},init:function(a,b){return ccui.Widget.prototype.init.call(this)?(void 0=== a?this._imageTexType=ccui.Widget.LOCAL_TEXTURE:this.loadTexture(a,b),!0):!1},_initRenderer:function(){this._imageRenderer=new cc.Sprite;this.addProtectedChild(this._imageRenderer,ccui.ImageView.RENDERER_ZORDER,-1)},setRotation:function(a){this._imageRenderer.setRotation(a)},loadTexture:function(a,b){if(a){var c=this;b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._imageTexType=b;var d=c._imageRenderer;d._textureLoaded||d.addEventListener("load",function(){c.loadTexture(c._textureFile,c._imageTexType)}); 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)}c._imageTextureSize=d.getContentSize();this._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize);c._imageRendererAdaptDirty=!0;c._findLayout()}},setTextureRect:function(a){this._scale9Enabled|| this._imageRenderer.setTextureRect(a)},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._imageRenderer),this._imageRenderer=null,this._imageRenderer=this._scale9Enabled?new ccui.Scale9Sprite:new cc.Sprite,this.loadTexture(this._textureFile,this._imageTexType),this.addProtectedChild(this._imageRenderer,ccui.ImageView.RENDERER_ZORDER,-1),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(){if(this._ignoreSize)this._scale9Enabled||this._imageRenderer.setScale(1);else if(this._scale9Enabled)this._imageRenderer.setPreferredSize(this._contentSize), this._imageRenderer.setScale(1);else{var a=this._imageTextureSize;if(0>=a.width||0>=a.height){this._imageRenderer.setScale(1);return}this._imageRenderer.setScaleX(this._contentSize.width/a.width);this._imageRenderer.setScaleY(this._contentSize.height/a.height)}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.setScale9Enabled(a._scale9Enabled),this.loadTexture(a._textureFile,a._imageTexType),this.setCapInsets(a._capInsets))},setContentSize:function(a,b){null!=b&&(a=cc.size(a,b));ccui.Widget.prototype.setContentSize.call(this,a);if(this._scale9Enabled)this._imageRenderer.setContentSize(a);else{var c=this._imageRenderer.getContentSize();this._imageRenderer.setScaleX(a.width/c.width);this._imageRenderer.setScaleY(a.height/c.height)}}}); 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=null==c?0:c;this.setTouchEnabled(!0);a&&this.loadBarTexture(a,c);b&&this.loadSlidBallTextures(b,c)},init:function(){return ccui.Widget.prototype.init.call(this)},_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)}, _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)},_onPressStateChangedToDisabled:function(){this._slidBallDisabledTextureFile&&(this._slidBallNormalRenderer.setVisible(!1),this._slidBallDisabledRenderer.setVisible(!0)); this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY);this._slidBallPressedRenderer.setVisible(!1)},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},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:"Thonburi",_fontSize:10,_onSelectedScaleOffset:0.5,_labelRenderer:"",_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.init(a,b,c)},init:function(a,b,c){return ccui.Widget.prototype.init.call(this)? (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()))},_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)},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);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){a!==this._labelBMFontRenderer.getString()&&(this._stringValue=a,this._labelBMFontRenderer.setString(a), this._fntFileHasInit&&(this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize()),this._labelBMFontRendererAdaptDirty=!0))},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)},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){this._super(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)},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;b&&b.location&&b.history.back.call(b)}}catch(c){cc.log(c)}},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;b&&b.location&&b.history.forward.call(b)}}catch(c){cc.log(c)}},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){ccui.WebView.RenderCmd=function(b){cc.Node.CanvasRenderCmd.call(this,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._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._listener=null;this.initStyle()};var b=ccui.WebView.RenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);b.constructor=ccui.WebView.RenderCmd;b.updateStatus=function(){a.devicePixelRatio=cc.view.isRetinaEnabled();this._dirtyFlag&cc.Node._dirtyFlags.transformDirty&& (this.transform(this.getParentRenderCmd(),!0),this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty)};b.visit=function(){var a=this,b=cc.container,e=cc.eventManager;if(this._node._visible)b.appendChild(this._div),null===this._listener&&(this._listener=e.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var f=!1;(f="contains"in b?b.contains(this._div):b.compareDocumentPosition(this._div)%16)&&b.removeChild(this._div); b=e._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners();e._removeListenerInVector(b,this._listener);this._listener=null}this.updateStatus();this.resize(cc.view)};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&&1!==d&&1!==d){var g=window.devicePixelRatio;d/=g;e/=g}if(!1!==this._loaded){var g=f._contentSize.width,h=f._contentSize.height;b="matrix("+b.a*d+","+b.b+","+b.c+","+b.d*e+","+(b.tx*d-g/2+g*f._scaleX/2*d)+","+-(b.ty*e-h/2+h*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.ScrollView=ccui.Layout.extend({_innerContainer:null,direction:null,_autoScrollDir:null,_topBoundary:0,_bottomBoundary:0,_leftBoundary:0,_rightBoundary:0,_bounceTopBoundary:0,_bounceBottomBoundary:0,_bounceLeftBoundary:0,_bounceRightBoundary:0,_autoScroll:!1,_autoScrollAddUpTime:0,_autoScrollOriginalSpeed:0,_autoScrollAcceleration:0,_isAutoScrollSpeedAttenuated:!1,_needCheckAutoScrollDestination:!1,_autoScrollDestination:null,_bePressed:!1,_slidTime:0,_moveChildPoint:null,_childFocusCancelOffset:0, _leftBounceNeeded:!1,_topBounceNeeded:!1,_rightBounceNeeded:!1,_bottomBounceNeeded:!1,bounceEnabled:!1,_bouncing:!1,_bounceDir:null,_bounceOriginalSpeed:0,inertiaScrollEnabled:!1,_scrollViewEventListener:null,_scrollViewEventSelector:null,_className:"ScrollView",ctor:function(){ccui.Layout.prototype.ctor.call(this);this.direction=ccui.ScrollView.DIR_NONE;this._autoScrollDir=cc.p(0,0);this._autoScrollAcceleration=-1E3;this._autoScrollDestination=cc.p(0,0);this._slidTime=0;this._moveChildPoint=cc.p(0, 0);this._childFocusCancelOffset=5;this._bounceDir=cc.p(0,0);this._bounceOriginalSpeed=0;this.inertiaScrollEnabled=!0;this.setTouchEnabled(!0)},init:function(){return ccui.Layout.prototype.init.call(this)?(this.setClippingEnabled(!0),this._innerContainer.setTouchEnabled(!1),!0):!1},onEnter:function(){ccui.Layout.prototype.onEnter.call(this);this.scheduleUpdate(!0)},findNextFocusedWidget:function(a,b){return this.getLayoutType()===ccui.Layout.LINEAR_VERTICAL||this.getLayoutType()===ccui.Layout.LINEAR_HORIZONTAL? this._innerContainer.findNextFocusedWidget(a,b):ccui.Widget.prototype.findNextFocusedWidget.call(this,a,b)},_initRenderer:function(){ccui.Layout.prototype._initRenderer.call(this);this._innerContainer=new ccui.Layout;this._innerContainer.setColor(cc.color(255,255,255));this._innerContainer.setOpacity(255);this._innerContainer.setCascadeColorEnabled(!0);this._innerContainer.setCascadeOpacityEnabled(!0);this.addProtectedChild(this._innerContainer,1,1)},_onSizeChanged:function(){ccui.Layout.prototype._onSizeChanged.call(this); var a=this._contentSize;this._topBoundary=a.height;this._rightBoundary=a.width;var b=a.width/3,c=a.height/3;this._bounceTopBoundary=a.height-c;this._bounceBottomBoundary=c;this._bounceLeftBoundary=b;this._bounceRightBoundary=a.width-b;b=this._innerContainer.getContentSize();this._innerContainer.setContentSize(cc.size(Math.max(b.width,a.width),Math.max(b.height,a.height)));this._innerContainer.setPosition(0,a.height-this._innerContainer.getContentSize().height)},setInnerContainerSize:function(a){var b= this._innerContainer,c=this._contentSize,d=c.width,e=c.height,f=b.getContentSize();a.width=this._autoScrollOriginalSpeed+this._autoScrollAcceleration* this._autoScrollAddUpTime?(this._stopAutoScrollChildren(),this._checkNeedBounce()):(b=(this._autoScrollOriginalSpeed+this._autoScrollAcceleration*(2*b+a)*0.5)*a,this._scrollChildren(b*this._autoScrollDir.x,b*this._autoScrollDir.y)||(this._stopAutoScrollChildren(),this._checkNeedBounce()));else if(this._needCheckAutoScrollDestination){var b=this._autoScrollDir.x*a*this._autoScrollOriginalSpeed,c=this._autoScrollDir.y*a*this._autoScrollOriginalSpeed;a=this._checkCustomScrollDestination(b,c);b=this._scrollChildren(b, c);a&&b||(this._stopAutoScrollChildren(),this._checkNeedBounce())}else this._scrollChildren(this._autoScrollDir.x*a*this._autoScrollOriginalSpeed,this._autoScrollDir.y*a*this._autoScrollOriginalSpeed)||(this._stopAutoScrollChildren(),this._checkNeedBounce())},_bounceChildren:function(a){var b=this._bounceOriginalSpeed,c=this._bounceDir;0>=b&&this._stopBounceChildren();this._bounceScrollChildren(c.x*a*b,c.y*a*b)||this._stopBounceChildren()},_checkNeedBounce:function(){if(!this.bounceEnabled)return!1; this._checkBounceBoundary();var a=this._topBounceNeeded,b=this._bottomBounceNeeded,c=this._leftBounceNeeded,d=this._rightBounceNeeded;if(a||b||c||d){var e=this._contentSize,f=this._innerContainer;a&&c?(a=cc.pSub(cc.p(0,e.height),cc.p(f.getLeftBoundary(),f.getTopBoundary())),b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b)):a&&d?(a=cc.pSub(cc.p(e.width,e.height),cc.p(f.getRightBoundary(),f.getTopBoundary())),b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b)): b&&c?(a=cc.pSub(cc.p(0,0),cc.p(f.getLeftBoundary(),f.getBottomBoundary())),b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b)):b&&d?(a=cc.pSub(cc.p(e.width,0),cc.p(f.getRightBoundary(),f.getBottomBoundary())),b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b)):a?(a=cc.pSub(cc.p(0,e.height),cc.p(0,f.getTopBoundary())),b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b)):b?(a=cc.pSub(cc.p(0,0),cc.p(0,f.getBottomBoundary())), b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b)):c?(a=cc.pSub(cc.p(0,0),cc.p(f.getLeftBoundary(),0)),b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b)):d&&(a=cc.pSub(cc.p(e.width,0),cc.p(f.getRightBoundary(),0)),b=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this._startBounceChildren(b));return!0}return!1},_checkBounceBoundary:function(){var a=this._innerContainer;a.getBottomBoundary()>this._bottomBoundary?(this._scrollToBottomEvent(), this._bottomBounceNeeded=!0):this._bottomBounceNeeded=!1;a.getTopBoundary()this._leftBoundary?(this._scrollToLeftEvent(),this._leftBounceNeeded=!0):this._leftBounceNeeded=!1},_startBounceChildren:function(a){this._bounceOriginalSpeed=a;this._bouncing=!0},_stopBounceChildren:function(){this._bouncing= !1;this._bounceOriginalSpeed=0;this._bottomBounceNeeded=this._topBounceNeeded=this._rightBounceNeeded=this._leftBounceNeeded=!1},_startAutoScrollChildrenWithOriginalSpeed:function(a,b,c,d){this._stopAutoScrollChildren();this._autoScrollDir.x=a.x;this._autoScrollDir.y=a.y;this._isAutoScrollSpeedAttenuated=c;this._autoScrollOriginalSpeed=b;this._autoScroll=!0;this._autoScrollAcceleration=d},_startAutoScrollChildrenWithDestination:function(a,b,c){this._needCheckAutoScrollDestination=!1;this._autoScrollDestination= a;var d=cc.pSub(a,this._innerContainer.getPosition());a=cc.pNormalize(d);var e=0,f=-1E3,d=cc.pLength(d);c?(f=-(2*d)/(b*b),e=2*d/b):(this._needCheckAutoScrollDestination=!0,e=d/b);this._startAutoScrollChildrenWithOriginalSpeed(a,e,c,f)},_jumpToDestination:function(a,b){void 0!==a.x&&(b=a.y,a=a.x);var c=a,d=b;switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:0>=b&&(d=Math.max(b,this._contentSize.height-this._innerContainer.getContentSize().height));break;case ccui.ScrollView.DIR_HORIZONTAL:0>= a&&(c=Math.max(a,this._contentSize.width-this._innerContainer.getContentSize().width));break;case ccui.ScrollView.DIR_BOTH:0>=b&&(d=Math.max(b,this._contentSize.height-this._innerContainer.getContentSize().height)),0>=a&&(c=Math.max(a,this._contentSize.width-this._innerContainer.getContentSize().width))}this._innerContainer.setPosition(c,d)},_stopAutoScrollChildren:function(){this._autoScroll=!1;this._autoScrollAddUpTime=this._autoScrollOriginalSpeed=0},_bounceScrollChildren:function(a,b){var c=!0, d,e,f,g;g=this._innerContainer;0=this._rightBoundary&&(d=this._rightBoundary-f,this._bounceRightEvent(),c=!1),g=g.getTopBoundary(),g+b>=this._topBoundary&&(e=this._topBoundary-g,this._bounceTopEvent(),c=!1),this._moveChildren(d,e)):0>a&&0=this._topBoundary&&(e=this._topBoundary-g,this._bounceTopEvent(),c=!1),this._moveChildren(d, e)):0>a&&0>b?(d=a,e=b,f=g.getLeftBoundary(),f+d<=this._leftBoundary&&(d=this._leftBoundary-f,this._bounceLeftEvent(),c=!1),g=g.getBottomBoundary(),g+b<=this._bottomBoundary&&(e=this._bottomBoundary-g,this._bounceBottomEvent(),c=!1),this._moveChildren(d,e)):0b?(d=a,e=b,f=g.getRightBoundary(),f+d>=this._rightBoundary&&(d=this._rightBoundary-f,this._bounceRightEvent(),c=!1),g=g.getBottomBoundary(),g+b<=this._bottomBoundary&&(e=this._bottomBoundary-g,this._bounceBottomEvent(),c=!1),this._moveChildren(d, e)):0===a&&0=this._topBoundary&&(e=this._topBoundary-g,this._bounceTopEvent(),c=!1),this._moveChildren(0,e)):0===a&&0>b?(e=b,g=g.getBottomBoundary(),g+b<=this._bottomBoundary&&(e=this._bottomBoundary-g,this._bounceBottomEvent(),c=!1),this._moveChildren(0,e)):0=this._rightBoundary&&(d=this._rightBoundary-f,this._bounceRightEvent(),c=!1),this._moveChildren(d,0)):0>a&&0===b&&(d=a,e=g.getLeftBoundary(),e+d<=this._leftBoundary&& (d=this._leftBoundary-e,this._bounceLeftEvent(),c=!1),this._moveChildren(d,0));return c},_checkCustomScrollDestination:function(a,b){var c=!0,d,e;d=this._innerContainer;var f=this._autoScrollDestination;switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:0=f.y&&(c=!1)):(d=d.getBottomBoundary(),d+b<=f.y&&(c=!1));break;case ccui.ScrollView.DIR_HORIZONTAL:0=f.x&&(c=!1)):(e=d.getLeftBoundary(),e+ a<=f.x&&(c=!1));break;case ccui.ScrollView.DIR_BOTH:0=f.x&&(c=!1),d=d.getBottomBoundary(),d+b>=f.y&&(c=!1)):0>a&&0=f.y&&(c=!1)):0>a&&0>b?(e=d.getRightBoundary(),e+a<=f.x&&(c=!1),d=d.getTopBoundary(),d+b<=f.y&&(c=!1)):0b?(e=d.getLeftBoundary(),e+a>=f.x&&(c=!1),d=d.getTopBoundary(),d+b<=f.y&&(c=!1)):0===a&&0=f.y&&(c=!1)):0>a&&0===b?(e=d.getRightBoundary(), e+a<=f.x&&(c=!1)):0===a&&0>b?(d=d.getTopBoundary(),d+b<=f.y&&(c=!1)):0=f.x&&(c=!1))}return c},_scrollChildren:function(a,b){var c=!0;this._scrollingEvent();switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:c=this._scrollChildrenVertical(a,b);break;case ccui.ScrollView.DIR_HORIZONTAL:c=this._scrollChildrenHorizontal(a,b);break;case ccui.ScrollView.DIR_BOTH:c=this._scrollChildrenBoth(a,b)}return c},_scrollChildrenVertical:function(a,b){var c=b,d=!0,e,f=this._innerContainer; this.bounceEnabled?(e=f.getBottomBoundary(),e+b>=this._bounceBottomBoundary&&(c=this._bounceBottomBoundary-e,this._scrollToBottomEvent(),d=!1),e=f.getTopBoundary(),e+b<=this._bounceTopBoundary&&(c=this._bounceTopBoundary-e,this._scrollToTopEvent(),d=!1)):(e=f.getBottomBoundary(),e+b>=this._bottomBoundary&&(c=this._bottomBoundary-e,this._scrollToBottomEvent(),d=!1),e=f.getTopBoundary(),e+b<=this._topBoundary&&(c=this._topBoundary-e,this._scrollToTopEvent(),d=!1));this._moveChildren(0,c);return d}, _scrollChildrenHorizontal:function(a,b){var c=!0,d=a,e,f=this._innerContainer;this.bounceEnabled?(e=f.getRightBoundary(),e+a<=this._bounceRightBoundary&&(d=this._bounceRightBoundary-e,this._scrollToRightEvent(),c=!1),e=f.getLeftBoundary(),e+a>=this._bounceLeftBoundary&&(d=this._bounceLeftBoundary-e,this._scrollToLeftEvent(),c=!1)):(e=f.getRightBoundary(),e+a<=this._rightBoundary&&(d=this._rightBoundary-e,this._scrollToRightEvent(),c=!1),e=f.getLeftBoundary(),e+a>=this._leftBoundary&&(d=this._leftBoundary- e,this._scrollToLeftEvent(),c=!1));this._moveChildren(d,0);return c},_scrollChildrenBoth:function(a,b){var c=!0,d=a,e=b,f,g;g=this._innerContainer;this.bounceEnabled?0=this._bounceLeftBoundary&&(d=this._bounceLeftBoundary-f,this._scrollToLeftEvent(),c=!1),g=g.getBottomBoundary(),g+b>=this._bounceBottomBoundary&&(e=this._bounceBottomBoundary-g,this._scrollToBottomEvent(),c=!1)):0>a&&0=this._bounceBottomBoundary&&(e=this._bounceBottomBoundary-g,this._scrollToBottomEvent(),c=!1)):0>a&&0>b?(f=g.getRightBoundary(),f+a<=this._bounceRightBoundary&&(d=this._bounceRightBoundary-f,this._scrollToRightEvent(),c=!1),g=g.getTopBoundary(),g+b<=this._bounceTopBoundary&&(e=this._bounceTopBoundary-g,this._scrollToTopEvent(),c=!1)):0b?(f=g.getLeftBoundary(),f+a>=this._bounceLeftBoundary&&(d=this._bounceLeftBoundary-f,this._scrollToLeftEvent(), c=!1),g=g.getTopBoundary(),g+b<=this._bounceTopBoundary&&(e=this._bounceTopBoundary-g,this._scrollToTopEvent(),c=!1)):0===a&&0=this._bounceBottomBoundary&&(e=this._bounceBottomBoundary-g,this._scrollToBottomEvent(),c=!1)):0>a&&0===b?(f=g.getRightBoundary(),f+a<=this._bounceRightBoundary&&(d=this._bounceRightBoundary-f,this._scrollToRightEvent(),c=!1)):0===a&&0>b?(g=g.getTopBoundary(),g+b<=this._bounceTopBoundary&&(e=this._bounceTopBoundary-g,this._scrollToTopEvent(), c=!1)):0=this._bounceLeftBoundary&&(d=this._bounceLeftBoundary-f,this._scrollToLeftEvent(),c=!1)):0=this._leftBoundary&&(d=this._leftBoundary-f,this._scrollToLeftEvent(),c=!1),g=g.getBottomBoundary(),g+b>=this._bottomBoundary&&(e=this._bottomBoundary-g,this._scrollToBottomEvent(),c=!1)):0>a&&0=this._bottomBoundary&&(e=this._bottomBoundary-g,this._scrollToBottomEvent(),c=!1)):0>a&&0>b?(f=g.getRightBoundary(),f+a<=this._rightBoundary&&(d=this._rightBoundary-f,this._scrollToRightEvent(),c=!1),g=g.getTopBoundary(),g+b<=this._topBoundary&&(e=this._topBoundary-g,this._scrollToTopEvent(),c=!1)):0b?(f=g.getLeftBoundary(),f+a>=this._leftBoundary&&(d=this._leftBoundary-f,this._scrollToLeftEvent(),c=!1),g=this._innerContainer.getTopBoundary(),g+b<=this._topBoundary&&(e=this._topBoundary- g,this._scrollToTopEvent(),c=!1)):0===a&&0=this._bottomBoundary&&(e=this._bottomBoundary-g,this._scrollToBottomEvent(),c=!1)):0>a&&0===b?(f=this._innerContainer.getRightBoundary(),f+a<=this._rightBoundary&&(d=this._rightBoundary-f,this._scrollToRightEvent(),c=!1)):0===a&&0>b?(g=this._innerContainer.getTopBoundary(),g+b<=this._topBoundary&&(e=this._topBoundary-g,this._scrollToTopEvent(),c=!1)):0=this._leftBoundary&&(d=this._leftBoundary-f,this._scrollToLeftEvent(),c=!1));this._moveChildren(d,e);return c},scrollToBottom:function(a,b){this._startAutoScrollChildrenWithDestination(cc.p(this._innerContainer.getPositionX(),0),a,b)},scrollToTop:function(a,b){this._startAutoScrollChildrenWithDestination(cc.p(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToLeft:function(a,b){this._startAutoScrollChildrenWithDestination(cc.p(0, this._innerContainer.getPositionY()),a,b)},scrollToRight:function(a,b){this._startAutoScrollChildrenWithDestination(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._startAutoScrollChildrenWithDestination(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._startAutoScrollChildrenWithDestination(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._startAutoScrollChildrenWithDestination(cc.p(0,0),a,b)},scrollToBottomRight:function(a,b){this.direction!==ccui.ScrollView.DIR_BOTH? cc.log("Scroll direction is not both!"):this._startAutoScrollChildrenWithDestination(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._startAutoScrollChildrenWithDestination(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._startAutoScrollChildrenWithDestination(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._startAutoScrollChildrenWithDestination(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)}},_startRecordSlidAction:function(){this._autoScroll&&this._stopAutoScrollChildren();this._bouncing&&this._stopBounceChildren();this._slidTime=0},_endRecordSlidAction:function(){if(!this._checkNeedBounce()&&this.inertiaScrollEnabled&&!(0.016>=this._slidTime)){var a= 0,b;b=this.convertToNodeSpace(this._touchEndPosition);var c=this.convertToNodeSpace(this._touchBeganPosition);switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:a=b.y-c.y;b=0>a?ccui.ScrollView.SCROLLDIR_DOWN:ccui.ScrollView.SCROLLDIR_UP;break;case ccui.ScrollView.DIR_HORIZONTAL:a=b.x-c.x;b=0>a?ccui.ScrollView.SCROLLDIR_LEFT:ccui.ScrollView.SCROLLDIR_RIGHT;break;case ccui.ScrollView.DIR_BOTH:b=cc.pSub(b,c);a=cc.pLength(b);b=cc.pNormalize(b);break;default:b=cc.p(0,0)}a=Math.min(Math.abs(a)/this._slidTime, ccui.ScrollView.AUTO_SCROLL_MAX_SPEED);this._startAutoScrollChildrenWithOriginalSpeed(b,a,!0,-1E3);this._slidTime=0}},_handlePressLogic:function(a){this._startRecordSlidAction();this._bePressed=!0},_handleMoveLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:this._scrollChildren(0,b.y);break;case ccui.ScrollView.DIR_HORIZONTAL:this._scrollChildren(b.x,0);break; case ccui.ScrollView.DIR_BOTH:this._scrollChildren(b.x,b.y)}},_handleReleaseLogic:function(a){this._endRecordSlidAction();this._bePressed=!1},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._autoScroll&&this._autoScrollChildren(a);this._bouncing&&this._bounceChildren(a);this._recordSlidTime(a)},_recordSlidTime:function(a){this._bePressed&&(this._slidTime+=a)},interceptTouchEvent:function(a,b,c){if(this._touchEnabled){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)}}else ccui.Layout.prototype.interceptTouchEvent.call(this,a,b,c)},_scrollToTopEvent:function(){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_SCROLL_TO_TOP):this._scrollViewEventSelector(this,ccui.ScrollView.EVENT_SCROLL_TO_TOP));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_SCROLL_TO_TOP)},_scrollToBottomEvent:function(){this._scrollViewEventSelector&&(this._scrollViewEventListener? this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM):this._scrollViewEventSelector(this,ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM)},_scrollToLeftEvent:function(){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_SCROLL_TO_LEFT):this._scrollViewEventSelector(this, ccui.ScrollView.EVENT_SCROLL_TO_LEFT));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_SCROLL_TO_LEFT)},_scrollToRightEvent:function(){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_SCROLL_TO_RIGHT):this._scrollViewEventSelector(this,ccui.ScrollView.EVENT_SCROLL_TO_RIGHT));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_SCROLL_TO_RIGHT)},_scrollingEvent:function(){this._scrollViewEventSelector&& (this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_SCROLLING):this._scrollViewEventSelector(this,ccui.ScrollView.EVENT_SCROLLING));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_SCROLLING)},_bounceTopEvent:function(){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_BOUNCE_TOP):this._scrollViewEventSelector(this, ccui.ScrollView.EVENT_BOUNCE_TOP));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_BOUNCE_TOP)},_bounceBottomEvent:function(){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_BOUNCE_BOTTOM):this._scrollViewEventSelector(this,ccui.ScrollView.EVENT_BOUNCE_BOTTOM));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_BOUNCE_BOTTOM)},_bounceLeftEvent:function(){this._scrollViewEventSelector&& (this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_BOUNCE_LEFT):this._scrollViewEventSelector(this,ccui.ScrollView.EVENT_BOUNCE_LEFT));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_BOUNCE_LEFT)},_bounceRightEvent:function(){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccui.ScrollView.EVENT_BOUNCE_RIGHT):this._scrollViewEventSelector(this, ccui.ScrollView.EVENT_BOUNCE_RIGHT));this._ccEventCallback&&this._ccEventCallback(this,ccui.ScrollView.EVENT_BOUNCE_RIGHT)},addEventListenerScrollView:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._scrollViewEventSelector=a;this._scrollViewEventListener=b},setDirection:function(a){this.direction=a},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},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.setDirection(a.direction),this.setBounceEnabled(a.bounceEnabled),this.setInertiaScrollEnabled(a.inertiaScrollEnabled),this._scrollViewEventListener=a._scrollViewEventListener,this._scrollViewEventSelector=a._scrollViewEventSelector,this._ccEventCallback=a._ccEventCallback)},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); _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.AUTO_SCROLL_MAX_SPEED=1E3;ccui.ScrollView.SCROLLDIR_UP=cc.p(0,1);ccui.ScrollView.SCROLLDIR_DOWN=cc.p(0,-1);ccui.ScrollView.SCROLLDIR_LEFT=cc.p(-1,0);ccui.ScrollView.SCROLLDIR_RIGHT=cc.p(1,0);ccui.ListView=ccui.ScrollView.extend({_model:null,_items:null,_gravity:null,_itemsMargin:0,_curSelectedIndex:0,_refreshViewDirty:!0,_listViewEventListener:null,_listViewEventSelector:null,ctor:function(){ccui.ScrollView.prototype.ctor.call(this);this._items=[];this._gravity=ccui.ListView.GRAVITY_CENTER_VERTICAL;this.setTouchEnabled(!0);this.init()},init:function(){return ccui.ScrollView.prototype.init.call(this)?(this.setLayoutType(ccui.Layout.LINEAR_VERTICAL),!0):!1},setItemModel:function(a){a?this._model= a:cc.log("Can't set a null to item model!")},_updateInnerContainerSize:function(){var a=this._items,b,c;switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:b=a.length;var d=(b-1)*this._itemsMargin;for(c=0;ca||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)},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)},requestRefreshView:function(){this._refreshViewDirty=!0},refreshView:function(){for(var a=this._items,b=0;bb)){var d=this._getPageCount(); 0>b||b>=d?c&&(b>d&&cc.log("pageIdx is %d, it will be added as page id [%d]",b,d),b=this._createPage(),b.addChild(a),this.addPage(b)):(b=this._pages[b])&&b.addChild(a)}},_createPage:function(){var a=new ccui.Layout;a.setContentSize(this.getContentSize());return a},addPage:function(a){a&&-1===this._pages.indexOf(a)&&(this.addChild(a),this._pages.push(a),this._doLayoutDirty=!0)},insertPage:function(a,b){if(!(0>b)&&a&&-1===this._pages.indexOf(a)){var c=this._getPageCount();b>=c?this.addPage(a):(this._pages[b]= a,this.addChild(a));this._doLayoutDirty=!0}},removePage:function(a){a&&(this.removeChild(a),a=this._pages.indexOf(a),-1a||a>=this._pages.length||(a=this._pages[a])&&this.removePage(a)},removeAllPages:function(){for(var a=this._pages,b=0,c=a.length;b=a.length?this._rightBoundaryChild=this._leftBoundaryChild=null: (this._leftBoundaryChild=a[0],this._rightBoundaryChild=a[a.length-1])},_getPageCount:function(){return this._pages.length},_getPositionXByIndex:function(a){return this.getContentSize().width*(a-this._curPageIdx)},_onSizeChanged:function(){ccui.Layout.prototype._onSizeChanged.call(this);this._rightBoundary=this.getContentSize().width;this._doLayoutDirty=!0},_updateAllPagesSize:function(){for(var a=this.getContentSize(),b=this._pages,c=0,d=b.length;c=a)this._curPageIdx=0;else{this._curPageIdx>=a&&(this._curPageIdx=a-1);for(var b=this.getContentSize().width,c=this._pages,d=0;da||a>=this._pages.length||(this._curPageIdx=a,this._autoScrollDistance=-this._pages[a].getPosition().x,this._autoScrollSpeed=Math.abs(this._autoScrollDistance)/0.2,this._autoScrollDirection=0=this._autoScrollDistance-a?(a=this._autoScrollDistance,this._autoScrollDistance=0,this._isAutoScrolling=!1):this._autoScrollDistance-=a,this._scrollPages(a),this._isAutoScrolling||this._pageTurningEvent()}},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},_doLayout:function(){this._doLayoutDirty&&(this._updateAllPagesPosition(),this._updateAllPagesSize(),this._updateBoundaryPages(),this._doLayoutDirty=!1)},_movePages:function(a){for(var b=this._pages,c=b.length,d=0;d=this._pages.length|| !this._leftBoundaryChild||!this._rightBoundaryChild)return!1;var b=a;switch(this._touchMoveDirection){case ccui.PageView.TOUCH_DIR_LEFT:var c=this._rightBoundaryChild.getRightBoundary();if(c+a<=this._rightBoundary)return b=this._rightBoundary-c,this._movePages(b),!1;break;case ccui.PageView.TOUCH_DIR_RIGHT:if(c=this._leftBoundaryChild.getLeftBoundary(),c+a>=this._leftBoundary)return b=this._leftBoundary-c,this._movePages(b),!1}this._movePages(b);return!0},_handleMoveLogic:function(a){a=a.getLocation().x- a.getPreviousLocation().x;0>a?this._touchMoveDirection=ccui.PageView.TOUCH_DIR_LEFT:0=this._pages.length)&&(a=this._pages[this._curPageIdx])){var b=a.getPosition();a=this._pages.length;var b=b.x,c=this.getSize().width;this._usingCustomScrollThreshold||(this._customScrollThreshold=c/2);c=this._customScrollThreshold;b<=-c?this._curPageIdx>=a-1?this._scrollPages(-b):this.scrollToPage(this._curPageIdx+1):b>=c?0>=this._curPageIdx?this._scrollPages(-b):this.scrollToPage(this._curPageIdx-1):this.scrollToPage(this._curPageIdx)}},interceptTouchEvent:function(a, b,c){if(this._touchEnabled){var d=c.getLocation();switch(a){case ccui.Widget.TOUCH_BEGAN:this._touchBeganPosition.x=d.x;this._touchBeganPosition.y=d.y;this._isInterceptTouch=!0;break;case ccui.Widget.TOUCH_MOVED:this._touchMovePosition.x=d.x;this._touchMovePosition.y=d.y;a=0;a=Math.abs(b.getTouchBeganPosition().x-d.x);a>this._childFocusCancelOffset&&(b.setHighlighted(!1),this._handleMoveLogic(c));break;case ccui.Widget.TOUCH_ENDED:case ccui.Widget.TOUCH_CANCELED:this._touchEndPosition.x=d.x,this._touchEndPosition.y= d.y,this._handleReleaseLogic(c),b.isSwallowTouches()&&(this._isInterceptTouch=!1)}}else ccui.Layout.prototype.interceptTouchEvent.call(this,a,b,c)},_pageTurningEvent:function(){this._pageViewEventSelector&&(this._pageViewEventListener?this._pageViewEventSelector.call(this._pageViewEventListener,this,ccui.PageView.EVENT_TURNING):this._pageViewEventSelector(this,ccui.PageView.EVENT_TURNING));this._ccEventCallback&&this._ccEventCallback(this,ccui.PageView.EVENT_TURNING)},addEventListenerPageView:function(a, b){this.addEventListener(a,b)},addEventListener:function(a,b){this._pageViewEventSelector=a;this._pageViewEventListener=b},getCurPageIndex:function(){return this._curPageIdx},getPages:function(){return this._pages},getPage:function(a){return 0>a||a>=this._pages.length?null:this._pages[a]},getDescription:function(){return"PageView"},_createCloneInstance:function(){return new ccui.PageView},_copyClonedWidgetChildren:function(a){a=a.getPages();for(var b=0;bd.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++;r=this.decodeFrame(r,k,c,d);e.addFrameData(r);r.frameID=p;p+=r.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);a=this.getNodeToParentTransform?this.getNodeToParentTransform():this.nodeToParentTransform();var b=this._skinTransform;b.a=a.a;b.b=a.b;b.c=a.c;b.d=a.d;b.tx=a.tx;b.ty=a.ty;this.updateArmatureTransform()},getSkinData:function(){return this._skinData},updateArmatureTransform:function(){this._renderCmd.updateArmatureTransform()},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._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={updateArmatureTransform:function(){var a=this._node;this._transform=cc.affineTransformConcat(a._skinTransform,a.bone.getNodeToArmatureTransform());this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty},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){cc.Sprite.CanvasRenderCmd.call(this,a);this._needDraw=!0};var a=ccs.Skin.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.CanvasRenderCmd})();(function(){ccs.Skin.WebGLRenderCmd=function(a){cc.Sprite.WebGLRenderCmd.call(this,a)};var a=ccs.Skin.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.WebGLRenderCmd;a.updateTransform=function(){var a=this._node,c=this._quad;if(a._visible){var d=this.getNodeToParentTransform(),e=a._rect,f=a._offsetPosition.x,g=a._offsetPosition.y,h=f+e.width,k=g+e.height,m=d.tx,n=d.ty,p=d.a,t=d.b,r=d.d,v=-d.c,d=f*p-g*v+m,e=f*t+g*r+n, s=h*p-g*v+m,g=h*t+g*r+n,u=h*p-k*v+m,h=h*t+k*r+n,m=f*p-k*v+m,f=f*t+k*r+n,k=a._vertexZ;cc.SPRITEBATCHNODE_RENDER_SUBPIXEL||(d|=0,e|=0,s|=0,g|=0,u|=0,h|=0,m|=0,f|=0);this.SET_VERTEX3F(c.bl.vertices,d,e,k);this.SET_VERTEX3F(c.br.vertices,s,g,k);this.SET_VERTEX3F(c.tl.vertices,m,f,k);this.SET_VERTEX3F(c.tr.vertices,u,h,k)}else c.br.vertices=c.tl.vertices=c.tr.vertices=c.bl.vertices={x:0,y:0,z:0};a.textureAtlas&&a.textureAtlas.updateQuad(c,a.textureAtlas.getTotalQuads());this._quadDirty=!0};a.SET_VERTEX3F= function(a,c,d,e){a.x=c;a.y=d;a.z=e};a.rendering=function(a){var c=this._node;if(c._textureLoaded){a=a||cc._renderContext;var d=c._texture;d&&d._textureLoaded&&(this._shaderProgram.use(),this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4(),cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst),cc.glBindTexture2DN(0,d),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX),a.bindBuffer(a.ARRAY_BUFFER,this._quadWebBuffer),this._quadDirty&&(a.bufferData(a.ARRAY_BUFFER,this._quad.arrayBuffer, a.DYNAMIC_DRAW),this._quadDirty=!1),a.vertexAttribPointer(0,3,a.FLOAT,!1,24,0),a.vertexAttribPointer(1,4,a.UNSIGNED_BYTE,!0,24,12),a.vertexAttribPointer(2,2,a.FLOAT,!1,24,16),a.drawArrays(a.TRIANGLE_STRIP,0,4));cc.g_NumberOfDraws++;if(0!==cc.SPRITE_DEBUG_DRAW||c._showNode)1===cc.SPRITE_DEBUG_DRAW||c._showNode?(c=this._quad,c=[cc.p(c.tl.vertices.x,c.tl.vertices.y),cc.p(c.bl.vertices.x,c.bl.vertices.y),cc.p(c.br.vertices.x,c.br.vertices.y),cc.p(c.tr.vertices.x,c.tr.vertices.y)],cc._drawingUtil.drawPoly(c, 4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(a=c.getTextureRect(),c=c.getOffsetPosition(),c=[cc.p(c.x,c.y),cc.p(c.x+a.width,c.y),cc.p(c.x+a.width,c.y+a.height),cc.p(c.x,c.y+a.height)],cc._drawingUtil.drawPoly(c,4,!0))}}})();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=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},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;de._localZOrder)e._renderCmd.visit(c);else break;for(cc.renderer.pushRenderCommand(c);a=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&&(this._worldTransform=cc.affineTransformConcat(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 null===this._action?!0:this._action.isDone()}});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:null,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({onEnter:function(a,b){this._node&&this._node.setBlendFunc(this._blendFunc)},clone:function(){var a=new ccs.BlendFuncFrame;a.setBlendFunc(this._blendFunc);a._cloneProperty(this);return a},setBlendFunc:function(a){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._renderCmd.visit(a);else break;for(;bp?b.rotationIK=g+(Math.atan2(d,c)*spine.radDeg-h-g)*f:(p= (c*c+d*d-m*m-n*n)/p,-1>p?p=-1:1c&&(c+=360),a.rotationIK=h+c*f,c=(e+k)*spine.radDeg-g,180c&&(c+=360),b.rotationIK=g+(c+a.worldRotation-b.parent.worldRotation)*f)}else b.rotationIK=g,a.rotationIK=h};spine.Skin=function(a){this.name=a;this.attachments={}}; spine.Skin.prototype={addAttachment:function(a,b,c){this.attachments[a+":"+b]=c},getAttachment:function(a,b){return this.attachments[a+":"+b]},_attachAll:function(a,b){for(var c in b.attachments){var d=c.indexOf(":"),e=parseInt(c.substring(0,d)),f=c.substring(d+1),d=a.slots[e];d.attachment&&d.attachment.name==f&&(e=this.getAttachment(e,f))&&d.setAttachment(e)}}};spine.Animation=function(a,b,c){this.name=a;this.timelines=b;this.duration=c}; spine.Animation.prototype={apply:function(a,b,c,d,e){d&&0!=this.duration&&(c%=this.duration,b%=this.duration);d=this.timelines;for(var f=0,g=d.length;f>>1;;){a[(f+1)*c]<=b?d=f+1:e=f;if(d==e)return(d+1)*c;f=d+e>>>1}};spine.Animation.binarySearch1=function(a,b){var c=0,d=a.length-2;if(!d)return 1;for(var e=d>>>1;;){a[e+1]<=b?c=e+1:d=e;if(c==d)return c+1;e=c+d>>>1}};spine.Animation.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};spine.Curves=function(a){this.curves=[]}; spine.Curves.prototype={setLinear:function(a){this.curves[19*a]=0},setStepped:function(a){this.curves[19*a]=1},setCurve:function(a,b,c,d,e){var f=0.1*0.1,g=0.1*f,h=3*0.1,k=3*f,m=6*f,f=6*g,n=2*-b+d,p=2*-c+e;d=3*(b-d)+1;e=3*(c-e)+1;b=b*h+n*k+d*g;c=c*h+p*k+e*g;g=n*m+d*f;m=p*m+e*f;p=d*f;f*=e;a*=19;d=this.curves;d[a++]=2;e=b;h=c;for(k=a+19-1;ab?0:1=b)return d==f?g=f=0:(f=c[d-2],g=c[d-1]),g+(c[d+1]-g)*(b-f)/(e-f);c=c[d-1];return c+(1-c)*(b-e)/(1-e)}};spine.RotateTimeline=function(a){this.curves=new spine.Curves(a);this.frames=[];this.frames.length=2*a}; spine.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2;this.frames[a]=b;this.frames[a+1]=c},apply:function(a,b,c,d,e){b=this.frames;if(!(c=b[b.length-2])b=a.data.rotation+b[b.length-1]-a.rotation;else{var f=spine.Animation.binarySearch(b,c,2);d=b[f-1];var g=b[f];c=1-(c-g)/(b[f-2]-g);c=this.curves.getCurvePercent(f/2-1,c);for(b=b[f+1]-d;180b;)b+=360;b=a.data.rotation+ (d+b*c)-a.rotation}for(;180b;)b+=360;a.rotation+=b*e}}};spine.TranslateTimeline=function(a){this.curves=new spine.Curves(a);this.frames=[];this.frames.length=3*a}; spine.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3;this.frames[a]=b;this.frames[a+1]=c;this.frames[a+2]=d},apply:function(a,b,c,d,e){b=this.frames;if(!(c=b[b.length-3])a.x+=(a.data.x+b[b.length-2]-a.x)*e,a.y+=(a.data.y+b[b.length-1]-a.y)*e;else{d=spine.Animation.binarySearch(b,c,3);var f=b[d-2],g=b[d-1],h=b[d];c=1-(c-h)/(b[d+-3]-h);c=this.curves.getCurvePercent(d/3-1,c);a.x+=(a.data.x+ f+(b[d+1]-f)*c-a.x)*e;a.y+=(a.data.y+g+(b[d+2]-g)*c-a.y)*e}}};spine.ScaleTimeline=function(a){this.curves=new spine.Curves(a);this.frames=[];this.frames.length=3*a}; spine.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3;this.frames[a]=b;this.frames[a+1]=c;this.frames[a+2]=d},apply:function(a,b,c,d,e){b=this.frames;if(!(c=b[b.length-3])a.scaleX+=(a.data.scaleX*b[b.length-2]-a.scaleX)*e,a.scaleY+=(a.data.scaleY*b[b.length-1]-a.scaleY)*e;else{d=spine.Animation.binarySearch(b,c,3);var f=b[d-2],g=b[d-1],h=b[d];c=1-(c-h)/(b[d+-3]-h);c=this.curves.getCurvePercent(d/ 3-1,c);a.scaleX+=(a.data.scaleX*(f+(b[d+1]-f)*c)-a.scaleX)*e;a.scaleY+=(a.data.scaleY*(g+(b[d+2]-g)*c)-a.scaleY)*e}}};spine.ColorTimeline=function(a){this.curves=new spine.Curves(a);this.frames=[];this.frames.length=5*a}; spine.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(a,b,c,d,e,f){a*=5;this.frames[a]=b;this.frames[a+1]=c;this.frames[a+2]=d;this.frames[a+3]=e;this.frames[a+4]=f},apply:function(a,b,c,d,e){b=this.frames;if(!(c=b[b.length-5])d=b.length-1,c=b[d-3],f=b[d-2],g=b[d-1],b=b[d];else{d=spine.Animation.binarySearch(b,c,5);var h=b[d-4];f=b[d-3];g=b[d-2];var k=b[d-1],m=b[d],m=1-(c-m)/(b[d-5]-m),m=this.curves.getCurvePercent(d/ 5-1,m);c=h+(b[d+1]-h)*m;f+=(b[d+2]-f)*m;g+=(b[d+3]-g)*m;b=k+(b[d+4]-k)*m}a=a.slots[this.slotIndex];1>e?(a.r+=(c-a.r)*e,a.g+=(f-a.g)*e,a.b+=(g-a.b)*e,a.a+=(b-a.a)*e):(a.r=c,a.g=f,a.b=g,a.a=b)}}};spine.AttachmentTimeline=function(a){this.curves=new spine.Curves(a);this.frames=[];this.frames.length=a;this.attachmentNames=[];this.attachmentNames.length=a}; spine.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c},apply:function(a,b,c,d,e){d=this.frames;cc&&this.apply(a,b,Number.MAX_VALUE,null,0):(b>c&&(b=-1),c=c>=d[d.length-1]?d.length-1:spine.Animation.binarySearch1(d,c)-1,d[c]c)this.apply(a,b,Number.MAX_VALUE,d,e),b=-1;else if(b>=f[g-1])return;if(!(c=f[a];a++)d.push(b[a])}}}}; spine.DrawOrderTimeline=function(a){this.frames=[];this.frames.length=a;this.drawOrders=[];this.drawOrders.length=a}; spine.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c},apply:function(a,b,c,d,e){b=this.frames;if(!(c=b[b.length-1]?b.length-1:spine.Animation.binarySearch1(b,c)-1,c=a.drawOrder,b=a.slots,d=this.drawOrders[d])for(e=0,f=d.length;e=f[f.length-1])if(c=d[f.length-1],1>e)for(d=0;dc?0:1e)for(d=0;d=b[b.length-3])a.mix+=(b[b.length-2]-a.mix)*e,a.bendDirection=b[b.length-1];else{d=spine.Animation.binarySearch(b,c,3);var f=b[d+-2],g=b[d];c=1-(c-g)/(b[d+-3]-g);c=this.curves.getCurvePercent(d/3-1,c); a.mix+=(f+(b[d+1]-f)*c-a.mix)*e;a.bendDirection=b[d+-1]}}};spine.FlipXTimeline=function(a){this.curves=new spine.Curves(a);this.frames=[];this.frames.length=2*a}; spine.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2;this.frames[a]=b;this.frames[a+1]=c?1:0},apply:function(a,b,c,d,e){d=this.frames;cc&&this.apply(a,b,Number.MAX_VALUE,null,0):(b>c&&(b=-1),c=(c>=d[d.length-2]?d.length:spine.Animation.binarySearch(d,c,2))-2,d[c]c&&this.apply(a,b,Number.MAX_VALUE,null,0):(b>c&&(b=-1),c=(c>=d[d.length-2]?d.length:spine.Animation.binarySearch(d,c,2))-2,d[c]c&&(d.length=c);for(var e=0,f=d.length;e=c.endTime&&this.clearTrack(b)}}},apply:function(a){for(var b=0;bf&&(d=f);var h=c.previous;if(h){var k=h.time;!h.loop&&k>h.endTime&&(k=h.endTime);h.animation.apply(a,k,k,h.loop,null);h=c.mixTime/c.mixDuration*c.mix;1<=h&&(h=1,c.previous=null);c.animation.mix(a,c.lastTime,d,g,this.events,h)}else 1==c.mix?c.animation.apply(a,c.lastTime,d,g,this.events):c.animation.mix(a,c.lastTime,d,g,this.events,c.mix);h=0;for(k=this.events.length;hd%f:e=f){d=Math.floor(d/f);if(c.onComplete)c.onComplete(b,d);if(this.onComplete)this.onComplete(b,d)}c.lastTime=c.time}}},clearTracks:function(){for(var a=0,b=this.tracks.length;a=this.tracks.length)){var b=this.tracks[a];if(b){if(b.onEnd)b.onEnd(a);if(this.onEnd)this.onEnd(a);this.tracks[a]=null}}},_expandToIndex:function(a){if(a=this.tracks.length;)this.tracks.push(null); return null},setCurrent:function(a,b){var c=this._expandToIndex(a);if(c){var d=c.previous;c.previous=null;if(c.onEnd)c.onEnd(a);if(this.onEnd)this.onEnd(a);b.mixDuration=this.data.getMix(c.animation,b.animation);0c.mixTime/c.mixDuration?d:c)}this.tracks[a]=b;if(b.onStart)b.onStart(a);if(this.onStart)this.onStart(a)},setAnimationByName:function(a,b,c){var d=this.data.skeletonData.findAnimation(b);if(!d)throw Error("Animation not found: "+b);return this.setAnimation(a, d,c)},setAnimation:function(a,b,c){var d=new spine.TrackEntry;d.animation=b;d.loop=c;d.endTime=b.duration;this.setCurrent(a,d);return d},addAnimationByName:function(a,b,c,d){var e=this.data.skeletonData.findAnimation(b);if(!e)throw Error("Animation not found: "+b);return this.addAnimation(a,e,c,d)},addAnimation:function(a,b,c,d){var e=new spine.TrackEntry;e.animation=b;e.loop=c;e.endTime=b.duration;if(c=this._expandToIndex(a)){for(;c.next;)c=c.next;c.next=e}else this.tracks[a]=e;0>=d&&(d=c?d+(c.endTime- this.data.getMix(c.animation,b)):0);e.delay=d;return e},getCurrent:function(a){return a>=this.tracks.length?null:this.tracks[a]}};spine.SkeletonJson=function(a){this.attachmentLoader=a}; spine.SkeletonJson.prototype={scale:1,readSkeletonData:function(a,b){var c=new spine.SkeletonData;c.name=b;var d=a.skeleton;d&&(c.hash=d.hash,c.version=d.spine,c.width=d.width||0,c.height=d.height||0);for(var e=a.bones,d=0,f=e.length;d=this.lines.length?null:this.lines[this.index++]},readValue:function(){var a=this.readLine(),b=a.indexOf(":");if(-1==b)throw Error("Invalid line: "+a);return this.trim(a.substring(b+1))},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]=this.trim(b.substr(c, e-c));c=e+1}a[d]=this.trim(b.substring(c));return d+1}};spine.AtlasAttachmentLoader=function(a){this.atlas=a}; spine.AtlasAttachmentLoader.prototype={newRegionAttachment:function(a,b,c){a=this.atlas.findRegion(c);if(!a)throw Error("Region not found in atlas: "+c+" (region attachment: "+b+")");b=new spine.RegionAttachment(b);b.rendererObject=a;b.setUVs(a.u,a.v,a.u2,a.v2,a.rotate);b.regionOffsetX=a.offsetX;b.regionOffsetY=a.offsetY;b.regionWidth=a.width;b.regionHeight=a.height;b.regionOriginalWidth=a.originalWidth;b.regionOriginalHeight=a.originalHeight;return b},newMeshAttachment:function(a,b,c){a=this.atlas.findRegion(c); if(!a)throw Error("Region not found in atlas: "+c+" (mesh attachment: "+b+")");b=new spine.MeshAttachment(b);b.rendererObject=a;b.regionU=a.u;b.regionV=a.v;b.regionU2=a.u2;b.regionV2=a.v2;b.regionRotate=a.rotate;b.regionOffsetX=a.offsetX;b.regionOffsetY=a.offsetY;b.regionWidth=a.width;b.regionHeight=a.height;b.regionOriginalWidth=a.originalWidth;b.regionOriginalHeight=a.originalHeight;return b},newSkinnedMeshAttachment:function(a,b,c){a=this.atlas.findRegion(c);if(!a)throw Error("Region not found in atlas: "+ c+" (skinned mesh attachment: "+b+")");b=new spine.SkinnedMeshAttachment(b);b.rendererObject=a;b.regionU=a.u;b.regionV=a.v;b.regionU2=a.u2;b.regionV2=a.v2;b.regionRotate=a.rotate;b.regionOffsetX=a.offsetX;b.regionOffsetY=a.offsetY;b.regionWidth=a.width;b.regionHeight=a.height;b.regionOriginalWidth=a.originalWidth;b.regionOriginalHeight=a.originalHeight;return b},newBoundingBoxAttachment:function(a,b){return new spine.BoundingBoxAttachment(b)}}; spine.SkeletonBounds=function(){this.polygonPool=[];this.polygons=[];this.boundingBoxes=[]}; spine.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(a,b){for(var c=a.slots,d=c.length,e=a.x,f=a.y,g=this.boundingBoxes,h=this.polygonPool,k=this.polygons,m=g.length=0,n=k.length;m=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY},aabbIntersectsSegment:function(a,b,c,d){var e=this.minX,f=this.minY,g=this.maxX,h=this.maxY;if(a<=e&&c<=e||b<=f&&d<=f||a>= g&&c>=g||b>=h&&d>=h)return!1;c=(d-b)/(c-a);d=c*(e-a)+b;if(d>f&&df&&de&&fe&&fa.minX&&this.minYa.minY},containsPoint:function(a,b){for(var c=this.polygons,d=0,e=c.length;d=c||k=c){var m=a[g];m+(c-h)/(k-h)*(a[e]-m)=m&&s<=t||s>=t&&s<=m)&&(s>= b&&s<=d||s>=d&&s<=b)&&(m=(k*u-h*v)/w,(m>=n&&m<=r||m>=r&&m<=n)&&(m>=c&&m<=e||m>=e&&m<=c)))return!0;m=t;n=r}return!1},getPolygon:function(a){a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}};var sp=sp||{};sp.VERTEX_INDEX={X1:0,Y1:1,X2:2,Y2:3,X3:4,Y3:5,X4:6,Y4:7};sp.ATTACHMENT_TYPE={REGION:0,BOUNDING_BOX:1,MESH:2,SKINNED_MESH:3}; sp.Skeleton=cc.Node.extend({_skeleton:null,_rootBone:null,_timeScale:1,_debugSlots:!1,_debugBones:!1,_premultipliedAlpha:!1,_ownsSkeletonData:null,_atlas:null,_blendFunc:null,ctor:function(a,b,c){cc.Node.prototype.ctor.call(this);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};0===arguments.length?this.init():this.initWithArgs(a,b,c)},_createRenderCmd:function(){return cc._renderType===cc._RENDER_TYPE_CANVAS?new sp.Skeleton.CanvasRenderCmd(this):new sp.Skeleton.WebGLRenderCmd(this)},init:function(){cc.Node.prototype.init.call(this); this._blendFunc.src=cc.ONE;this._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA;this.scheduleUpdate()},setDebugSolots:function(a){this._debugSlots=a},setDebugBones:function(a){this._debugBones=a},setDebugSlotsEnabled:function(a){this._debugSlots=a},getDebugSlotsEnabled:function(){return this._debugSlots},setDebugBonesEnabled:function(a){this._debugBones=a},getDebugBonesEnabled:function(){return this._debugBones},setTimeScale:function(a){this._timeScale=a},getTimeScale:function(){return this._timeScale},initWithArgs:function(a, b,c){if(cc.isString(a)){if(cc.isString(b)){var d=cc.loader.getRes(b);sp._atlasLoader.setAtlasFile(b);b=new spine.Atlas(d,sp._atlasLoader)}c=c||1/cc.director.getContentScaleFactor();d=new spine.AtlasAttachmentLoader(b);d=new spine.SkeletonJson(d);d.scale=c;a=cc.loader.getRes(a);a=d.readSkeletonData(a);b.dispose(d);c=!0}else c=b;this.setSkeletonData(a,c);this.init()},getBoundingBox:function(){for(var a=cc.FLT_MAX,b=cc.FLT_MAX,c=cc.FLT_MIN,d=cc.FLT_MIN,e=this.getScaleX(),f=this.getScaleY(),g=[],h=this._skeleton.slots, k=sp.VERTEX_INDEX,m=0,n=h.length;ma.space.sleepTimeThreshold?cc.color(84,84,84,128):cc.color(255,0,0,128)}; cc.DrawShape=function(a,b){var c=a.body,d=cc.ColorForBody(c);switch(a.collisionCode){case cp.CircleShape.prototype.collisionCode:this.drawDot(a.tc,Math.max(a.r,1),d);this.drawSegment(a.tc,cp.v.add(a.tc,cp.v.mult(c.rot,a.r)),1,d);break;case cp.SegmentShape.prototype.collisionCode:this.drawSegment(a.ta,a.tb,Math.max(a.r,2),d);break;case cp.PolyShape.prototype.collisionCode:c=cc.color(d.r,d.g,d.b,cc.lerp(d.a,255,0.5));this.drawPoly(cc.__convertVerts(a.tVerts),d,1,c);break;default:cc.log("cc.DrawShape(): Bad assertion in DrawShape()")}}; cc.DrawConstraint=function(a,b){var c=a.a,d=a.b,e;a instanceof cp.PinJoint?(e=c.local2World(a.anchr1),c=d.local2World(a.anchr2),this.drawDot(e,3,cc.CONSTRAINT_COLOR),this.drawDot(c,3,cc.CONSTRAINT_COLOR),this.drawSegment(e,c,1,cc.CONSTRAINT_COLOR)):a instanceof cp.SlideJoint?(e=c.local2World(a.anchr1),c=d.local2World(a.anchr2),this.drawDot(e,3,cc.CONSTRAINT_COLOR),this.drawDot(c,3,cc.CONSTRAINT_COLOR),this.drawSegment(e,c,1,cc.CONSTRAINT_COLOR)):a instanceof cp.PivotJoint?(e=c.local2World(a.anchr1), c=d.local2World(a.anchr2),this.drawDot(e,3,cc.CONSTRAINT_COLOR),this.drawDot(c,3,cc.CONSTRAINT_COLOR)):a instanceof cp.GrooveJoint&&(e=c.local2World(a.grv_a),c=c.local2World(a.grv_b),d=d.local2World(a.anchr2),this.drawDot(d,3,cc.CONSTRAINT_COLOR),this.drawSegment(e,c,1,cc.CONSTRAINT_COLOR))};cc.CONSTRAINT_COLOR=cc.color(0,255,0,128); cc.PhysicsDebugNode=cc.DrawNode.extend({_space:null,_className:"PhysicsDebugNode",ctor:function(a){cc.DrawNode.prototype.ctor.call(this);this._space=a},getSpace:function(){return this._space},setSpace:function(a){this._space=a},draw:function(a){this._space&&(this._space.eachShape(cc.DrawShape.bind(this)),this._space.eachConstraint(cc.DrawConstraint.bind(this)),cc.DrawNode.prototype.draw.call(this),this.clear())},_createRenderCmd:function(){return cc._renderType===cc._RENDER_TYPE_CANVAS?new cc.PhysicsDebugNode.CanvasRenderCmd(this): new cc.PhysicsDebugNode.WebGLRenderCmd(this)}});cc.PhysicsDebugNode.create=function(a){return new cc.PhysicsDebugNode(a)};(function(){cc.PhysicsDebugNode.CanvasRenderCmd=function(a){cc.Node.CanvasRenderCmd.call(this,a);this._buffer=a._buffer;this._needDraw=!0};var a=cc.PhysicsDebugNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.PhysicsDebugNode.CanvasRenderCmd;a.rendering=function(a,c,d){var e=this._node;e._space&&(e._space.eachShape(cc.DrawShape.bind(e)),e._space.eachConstraint(cc.DrawConstraint.bind(e)),cc.DrawNode.CanvasRenderCmd.prototype.rendering.call(this,a,c,d), e.clear())};a._drawDot=cc.DrawNode.CanvasRenderCmd.prototype._drawDot;a._drawSegment=cc.DrawNode.CanvasRenderCmd.prototype._drawSegment;a._drawPoly=cc.DrawNode.CanvasRenderCmd.prototype._drawPoly})();(function(){cc.PhysicsDebugNode.WebGLRenderCmd=function(a){cc.Node.WebGLRenderCmd.call(this,a);this._needDraw=!0};cc.PhysicsDebugNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.PhysicsDebugNode.WebGLRenderCmd.prototype.constructor=cc.PhysicsDebugNode.WebGLRenderCmd;cc.PhysicsDebugNode.WebGLRenderCmd.prototype.rendering=function(a){a=this._node;a._space&&(a._space.eachShape(cc.DrawShape.bind(a)),a._space.eachConstraint(cc.DrawConstraint.bind(a)),cc.glBlendFunc(a._blendFunc.src, a._blendFunc.dst),this._shaderProgram.use(),this._shaderProgram._setUniformForMVPMatrixWithMat4(this._stackMatrix),a._render(),a.clear())}})();(function(){cc.PhysicsSprite.CanvasRenderCmd=function(a){cc.Sprite.CanvasRenderCmd.call(this,a);this._needDraw=!0};var a=cc.PhysicsSprite.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);a.constructor=cc.PhysicsSprite.CanvasRenderCmd;a.rendering=function(a,c,d){var e=this._node;e._syncPosition();e._ignoreBodyRotation||e._syncRotation();this.transform(this.getParentRenderCmd());cc.Sprite.CanvasRenderCmd.prototype.rendering.call(this,a,c,d)};a.getNodeToParentTransform=function(){var a= this._node,c=this._transform,d=a._body,e=a._scaleX,f=a._scaleY,g=this._anchorPointInPoints;c.tx=d.p.x;c.ty=d.p.y;var d=-d.a,h=1,k=0;d&&!a._ignoreBodyRotation&&(h=Math.cos(d),k=Math.sin(d));c.a=c.d=h;c.b=-k;c.c=k;if(1!==e||1!==f)c.a*=e,c.c*=e,c.b*=f,c.d*=f;c.tx+=h*-g.x*e+-k*g.y*f;c.ty-=k*-g.x*e+h*g.y*f;this._ignoreAnchorPointForPosition&&(c.tx+=g.x,c.ty+=g.y);return this._transform}})();(function(){cc.PhysicsSprite.WebGLRenderCmd=function(a){cc.Sprite.WebGLRenderCmd.call(this,a);this._needDraw=!0};var a=cc.PhysicsSprite.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);a.constructor=cc.PhysicsSprite.WebGLRenderCmd;a.rendering=function(a){var c=this._node;c._syncPosition();c._ignoreBodyRotation||c._syncRotation();this.transform(this.getParentRenderCmd());cc.Sprite.WebGLRenderCmd.prototype.rendering.call(this,a)};a.getNodeToParentTransform=function(){var a= this._node,c=a._body,d=this._anchorPointInPoints,e=a._scaleX,f=a._scaleY,g=c.p.x,h=c.p.y;this._ignoreAnchorPointForPosition&&(g+=d.x,h+=d.y);var c=c.a,k=1,m=0;c&&!a._ignoreBodyRotation&&(k=Math.cos(c),m=Math.sin(c));cc._rectEqualToZero(d)||(g+=k*-d.x*e+-m*-d.y*f,h+=m*-d.x*e+k*-d.y*f);return this._transform=cc.affineTransformMake(k*e,m*e,-m*f,k*f,g,h)};a.updateTransform=function(){this._dirty=this._node.isDirty();cc.Sprite.WebGLRenderCmd.prototype.updateTransform.call(this)}})();var Box2D={}; (function(a,b){function c(){}!(Object.defineProperty instanceof Function)&&Object.prototype.__defineGetter__ instanceof Function&&Object.prototype.__defineSetter__ instanceof Function&&(Object.defineProperty=function(a,b,c){c.get instanceof Function&&a.__defineGetter__(b,c.get);c.set instanceof Function&&a.__defineSetter__(b,c.set)});a.inherit=function(a,b){c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};a.generateCallback=function(a,b){return function(){b.apply(a,arguments)}}; a.NVector=function(a){a===b&&(a=0);for(var c=Array(a||0),f=0;fB&&(H=p,p=B,B=H,H=1),p>c&&(n.x=H,n.y=0,c=p),d=Math.min(d,B),c>d)return!1;if(mB&&(H=p,p=B,B=H,H=1),p>c&&(n.y=H,n.x=0,c=p),d=Math.min(d,B),c>d)return!1; a.fraction=c;return!0};k.prototype.TestOverlap=function(a){var b=a.lowerBound.y-this.upperBound.y,c=this.lowerBound.y-a.upperBound.y;return 0=k&&a[f++].Set(b[0]);0>=e&&a[f++].Set(b[1]);0>k*e&&(c=k/(k-e),e=a[f],e=e.v,e.x=g.x+c*(h.x-g.x),e.y=g.y+c*(h.y-g.y),e=a[f],e.id=(0B&&(B=h,m=H);g=p.EdgeSeparation(b,c,m,d,e);h=parseInt(0<=m-1?m-1: f-1);k=p.EdgeSeparation(b,c,h,d,e);var n=parseInt(m+1g&&k>B)u=-1,H=h,E=k;else if(B>g)u=1,H=n,E=B;else return a[0]=m,g;for(;;)if(m=-1==u?0<=H-1?H-1:f-1:H+1E)H=m,E=g;else break;a[0]=H;return E};p.FindIncidentEdge=function(a,b,c,d,e,f){void 0===d&&(d=0);parseInt(b.m_vertexCount);var g=b.m_normals,h=parseInt(e.m_vertexCount);b=e.m_vertices;e=e.m_normals;var k;k=c.R;c=g[d];var g=k.col1.x*c.x+k.col2.x*c.y,m= k.col1.y*c.x+k.col2.y*c.y;k=f.R;c=k.col1.x*g+k.col1.y*m;m=k.col2.x*g+k.col2.y*m;g=c;k=0;for(var n=Number.MAX_VALUE,B=0;Bh)){var m;p.s_edgeBO[0]=0;var n=p.FindMaxSeparation(p.s_edgeBO,e,f,b,c);m=p.s_edgeBO[0];if(!(n>h)){var B=0,H=0;n>0.98*k+0.001?(k=e,e= b,b=f,B=m,a.m_type=A.e_faceB,H=1):(k=b,b=c,c=f,B=g,a.m_type=A.e_faceA,H=0);g=p.s_incidentEdge;p.FindIncidentEdge(g,k,b,B,e,c);m=parseInt(k.m_vertexCount);f=k.m_vertices;var k=f[B],E;E=B+1s||(s=p.ClipSegmentToLine(k,E,n,m),2>s))){a.m_localPlaneNormal.SetV(f);a.m_localPoint.SetV(e);for(e=f=0;ef*f||(a.m_type=A.e_circles,a.m_localPoint.SetV(b.m_p),a.m_localPlaneNormal.SetZero(),a.m_pointCount=1,a.m_points[0].m_localPoint.SetV(d.m_p),a.m_points[0].m_id.key=0)};p.CollidePolygonAndCircle=function(a,b,c,d,e){var f=a.m_pointCount=0,g=0,h,k;k=e.R;h=d.m_p;var m=e.position.y+(k.col1.y*h.x+k.col2.y*h.y),f=e.position.x+(k.col1.x*h.x+k.col2.x*h.y)-c.position.x,g=m-c.position.y;k=c.R;c=f*k.col1.x+g*k.col1.y;k=f*k.col2.x+g*k.col2.y;var n=0,m=-Number.MAX_VALUE;e=b.m_radius+d.m_radius;var B=parseInt(b.m_vertexCount), p=b.m_vertices;b=b.m_normals;for(var H=0;He)return;f>m&&(m=f,n=H)}f=parseInt(n);g=parseInt(f+1=(c-h.x)*(p.x-h.x)+(k-h.y)*(p.y-h.y)?(c-h.x)*(c-h.x)+(k-h.y)*(k-h.y)>e* e||(a.m_pointCount=1,a.m_type=A.e_faceA,a.m_localPlaneNormal.x=c-h.x,a.m_localPlaneNormal.y=k-h.y,a.m_localPlaneNormal.Normalize(),a.m_localPoint.SetV(h),a.m_points[0].m_localPoint.SetV(d.m_p),a.m_points[0].m_id.key=0):0>=m?(c-p.x)*(c-p.x)+(k-p.y)*(k-p.y)>e*e||(a.m_pointCount=1,a.m_type=A.e_faceA,a.m_localPlaneNormal.x=c-p.x,a.m_localPlaneNormal.y=k-p.y,a.m_localPlaneNormal.Normalize(),a.m_localPoint.SetV(p),a.m_points[0].m_localPoint.SetV(d.m_p),a.m_points[0].m_id.key=0):(n=0.5*(h.x+p.x),h=0.5*(h.y+ p.y),m=(c-n)*b[f].x+(k-h)*b[f].y,m>e||(a.m_pointCount=1,a.m_type=A.e_faceA,a.m_localPlaneNormal.x=b[f].x,a.m_localPlaneNormal.y=b[f].y,a.m_localPlaneNormal.Normalize(),a.m_localPoint.Set(n,h),a.m_points[0].m_localPoint.SetV(d.m_p),a.m_points[0].m_id.key=0)))};p.TestOverlap=function(a,b){var c=b.lowerBound,d=a.upperBound,e=c.x-d.x,f=c.y-d.y,c=a.lowerBound,d=b.upperBound,g=c.y-d.y;return 0>8&255;this.features._incidentVertex=(this._key&16711680)>>16&255;this.features._flip=(this._key&4278190080)>>24&255}});r.b2ContactPoint=function(){this.position=new h;this.velocity=new h;this.normal=new h;this.id=new t};v.b2Distance=function(){};v.Distance=function(a,b,c){++v.b2_gjkCalls;var f= c.proxyA,g=c.proxyB,k=c.transformA,m=c.transformB,n=v.s_simplex;n.ReadCache(b,f,k,g,m);var B=n.m_vertices,p=v.s_saveA,H=v.s_saveB,E=0;n.GetClosestPoint().LengthSquared();for(var u=0,r,s=0;20>s;){E=n.m_count;for(u=0;ub+g&&a.distance>Number.MIN_VALUE?(a.distance-=b+g,c=e.SubtractVV(a.pointB,a.pointA),c.Normalize(),a.pointA.x+=b*c.x,a.pointA.y+=b*c.y,a.pointB.x-=g*c.x,a.pointB.y-=g*c.y):(r=new h,r.x=0.5*(a.pointA.x+a.pointB.x),r.y=0.5*(a.pointA.y+a.pointB.y),a.pointA.x=a.pointB.x=r.x,a.pointA.y=a.pointB.y=r.y,a.distance=0))};Box2D.postDefs.push(function(){Box2D.Collision.b2Distance.s_simplex=new G;Box2D.Collision.b2Distance.s_saveA=new Vector_a2j_Number(3);Box2D.Collision.b2Distance.s_saveB= new Vector_a2j_Number(3)});s.b2DistanceInput=function(){};u.b2DistanceOutput=function(){this.pointA=new h;this.pointB=new h};w.b2DistanceProxy=function(){};w.prototype.Set=function(e){switch(e.GetType()){case c.e_circleShape:e=e instanceof a?e:null;this.m_vertices=new Vector(1,!0);this.m_vertices[0]=e.m_p;this.m_count=1;this.m_radius=e.m_radius;break;case c.e_polygonShape:e=e instanceof b?e:null;this.m_vertices=e.m_vertices;this.m_count=e.m_vertexCount;this.m_radius=e.m_radius;break;default:d.b2Assert(!1)}}; w.prototype.GetSupport=function(a){for(var b=0,c=this.m_vertices[0].x*a.x+this.m_vertices[0].y*a.y,d=1;dc&&(b=d,c=e)}return b};w.prototype.GetSupportVertex=function(a){for(var b=0,c=this.m_vertices[0].x*a.x+this.m_vertices[0].y*a.y,d=1;dc&&(b=d,c=e)}return this.m_vertices[b]};w.prototype.GetVertexCount=function(){return this.m_count};w.prototype.GetVertex= function(a){void 0===a&&(a=0);d.b2Assert(0<=a&&a>d&1?c.child2:c.child1,d=d+1&31;++this.m_path;this.RemoveLeaf(c);this.InsertLeaf(c)}};z.prototype.GetFatAABB=function(a){return a.aabb};z.prototype.GetUserData=function(a){return a.userData};z.prototype.Query=function(a,b){if(null!=this.m_root){var c=new Vector,d=0;for(c[d++]=this.m_root;0=d?a:d;++b.m_pairCount;return!0},e)}for(c=b.m_moveBuffer.length=0;ck){var n=e.x-this.p1.x,B=e.y-this.p1.y,e=n*c+B*h;if(0<=e&&e<=d*m&&(d=-f*B+g*n,-k*m<=d&&d<=m*(1+k)))return e/=m,d=Math.sqrt(c*c+h*h),a[0]=e,b.Set(c/d,h/d),!0}return!1};J.prototype.Extend=function(a){this.ExtendForward(a);this.ExtendBackward(a)};J.prototype.ExtendForward=function(a){var b=this.p2.x- this.p1.x,c=this.p2.y-this.p1.y;a=Math.min(0b?(a.lowerBound.x-this.p1.x)/b:Number.POSITIVE_INFINITY,0c?(a.lowerBound.y-this.p1.y)/c:Number.POSITIVE_INFINITY);this.p2.x=this.p1.x+b*a;this.p2.y=this.p1.y+c*a};J.prototype.ExtendBackward=function(a){var b=-this.p2.x+this.p1.x,c=-this.p2.y+this.p1.y;a=Math.min(0b?(a.lowerBound.x-this.p2.x)/b:Number.POSITIVE_INFINITY,0 c?(a.lowerBound.y-this.p2.y)/c:Number.POSITIVE_INFINITY);this.p1.x=this.p2.x+b*a;this.p1.y=this.p2.y+c*a};E.b2SeparationFunction=function(){this.m_localPoint=new h;this.m_axis=new h};E.prototype.Initialize=function(a,b,c,f,g){this.m_proxyA=b;this.m_proxyB=f;var k=parseInt(a.count);d.b2Assert(0k);var m,n,B,p,H=p=B=f=b=0,u=0,H=0;1==k?(this.m_type=E.e_points,m=this.m_proxyA.GetVertex(a.indexA[0]),n=this.m_proxyB.GetVertex(a.indexB[0]),k=m,a=c.R,b=c.position.x+(a.col1.x*k.x+a.col2.x*k.y),f=c.position.y+ (a.col1.y*k.x+a.col2.y*k.y),k=n,a=g.R,B=g.position.x+(a.col1.x*k.x+a.col2.x*k.y),p=g.position.y+(a.col1.y*k.x+a.col2.y*k.y),this.m_axis.x=B-b,this.m_axis.y=p-f,this.m_axis.Normalize()):(a.indexB[0]==a.indexB[1]?(this.m_type=E.e_faceA,b=this.m_proxyA.GetVertex(a.indexA[0]),f=this.m_proxyA.GetVertex(a.indexA[1]),n=this.m_proxyB.GetVertex(a.indexB[0]),this.m_localPoint.x=0.5*(b.x+f.x),this.m_localPoint.y=0.5*(b.y+f.y),this.m_axis=e.CrossVF(e.SubtractVV(f,b),1),this.m_axis.Normalize(),k=this.m_axis,a= c.R,H=a.col1.x*k.x+a.col2.x*k.y,u=a.col1.y*k.x+a.col2.y*k.y,k=this.m_localPoint,a=c.R,b=c.position.x+(a.col1.x*k.x+a.col2.x*k.y),f=c.position.y+(a.col1.y*k.x+a.col2.y*k.y),k=n,a=g.R,B=g.position.x+(a.col1.x*k.x+a.col2.x*k.y),p=g.position.y+(a.col1.y*k.x+a.col2.y*k.y),H=(B-b)*H+(p-f)*u):a.indexA[0]==a.indexA[0]?(this.m_type=E.e_faceB,B=this.m_proxyB.GetVertex(a.indexB[0]),p=this.m_proxyB.GetVertex(a.indexB[1]),m=this.m_proxyA.GetVertex(a.indexA[0]),this.m_localPoint.x=0.5*(B.x+p.x),this.m_localPoint.y= 0.5*(B.y+p.y),this.m_axis=e.CrossVF(e.SubtractVV(p,B),1),this.m_axis.Normalize(),k=this.m_axis,a=g.R,H=a.col1.x*k.x+a.col2.x*k.y,u=a.col1.y*k.x+a.col2.y*k.y,k=this.m_localPoint,a=g.R,B=g.position.x+(a.col1.x*k.x+a.col2.x*k.y),p=g.position.y+(a.col1.y*k.x+a.col2.y*k.y),k=m,a=c.R,b=c.position.x+(a.col1.x*k.x+a.col2.x*k.y),f=c.position.y+(a.col1.y*k.x+a.col2.y*k.y),H=(b-B)*H+(f-p)*u):(b=this.m_proxyA.GetVertex(a.indexA[0]),f=this.m_proxyA.GetVertex(a.indexA[1]),B=this.m_proxyB.GetVertex(a.indexB[0]), p=this.m_proxyB.GetVertex(a.indexB[1]),e.MulX(c,m),m=e.MulMV(c.R,e.SubtractVV(f,b)),e.MulX(g,n),H=e.MulMV(g.R,e.SubtractVV(p,B)),g=m.x*m.x+m.y*m.y,n=H.x*H.x+H.y*H.y,a=e.SubtractVV(H,m),c=m.x*a.x+m.y*a.y,a=H.x*a.x+H.y*a.y,m=m.x*H.x+m.y*H.y,u=g*n-m*m,H=0,0!=u&&(H=e.Clamp((m*a-c*n)/u,0,1)),0>(m*H+a)/n&&(H=e.Clamp((m-c)/g,0,1)),m=new h,m.x=b.x+H*(f.x-b.x),m.y=b.y+H*(f.y-b.y),n=new h,n.x=B.x+H*(p.x-B.x),n.y=B.y+H*(p.y-B.y),0==H||1==H?(this.m_type=E.e_faceB,this.m_axis=e.CrossVF(e.SubtractVV(p,B),1),this.m_axis.Normalize(), this.m_localPoint=n):(this.m_type=E.e_faceA,this.m_axis=e.CrossVF(e.SubtractVV(f,b),1),this.m_localPoint=m)),0>H&&this.m_axis.NegativeSelf())};E.prototype.Evaluate=function(a,b){var c,f,g=0;switch(this.m_type){case E.e_points:return c=e.MulTMV(a.R,this.m_axis),f=e.MulTMV(b.R,this.m_axis.GetNegative()),c=this.m_proxyA.GetSupportVertex(c),f=this.m_proxyB.GetSupportVertex(f),c=e.MulX(a,c),f=e.MulX(b,f),g=(f.x-c.x)*this.m_axis.x+(f.y-c.y)*this.m_axis.y;case E.e_faceA:return g=e.MulMV(a.R,this.m_axis), c=e.MulX(a,this.m_localPoint),f=e.MulTMV(b.R,g.GetNegative()),f=this.m_proxyB.GetSupportVertex(f),f=e.MulX(b,f),g=(f.x-c.x)*g.x+(f.y-c.y)*g.y;case E.e_faceB:return g=e.MulMV(b.R,this.m_axis),f=e.MulX(b,this.m_localPoint),c=e.MulTMV(a.R,g.GetNegative()),c=this.m_proxyA.GetSupportVertex(c),c=e.MulX(a,c),g=(c.x-f.x)*g.x+(c.y-f.y)*g.y;default:return d.b2Assert(!1),0}};Box2D.postDefs.push(function(){Box2D.Collision.b2SeparationFunction.e_points=1;Box2D.Collision.b2SeparationFunction.e_faceA=2;Box2D.Collision.b2SeparationFunction.e_faceB= 4});G.b2Simplex=function(){this.m_v1=new P;this.m_v2=new P;this.m_v3=new P;this.m_vertices=new Vector(3)};G.prototype.b2Simplex=function(){this.m_vertices[0]=this.m_v1;this.m_vertices[1]=this.m_v2;this.m_vertices[2]=this.m_v3};G.prototype.ReadCache=function(a,b,c,f,g){d.b2Assert(0<=a.count&&3>=a.count);var h,k;this.m_count=a.count;for(var m=this.m_vertices,n=0;n=a?this.m_count=this.m_v1.a=1:(b=b.x*c.x+b.y*c.y,0>=b?(this.m_count=this.m_v2.a=1,this.m_v1.Set(this.m_v2)):(c=1/(b+a),this.m_v1.a=b*c,this.m_v2.a=a*c,this.m_count=2))};G.prototype.Solve3=function(){var a=this.m_v1.w,b=this.m_v2.w,c=this.m_v3.w,d=e.SubtractVV(b,a),f=e.Dot(a,d),g=e.Dot(b,d),f=-f,h=e.SubtractVV(c,a),k=e.Dot(a,h),m=e.Dot(c,h),k=-k,n=e.SubtractVV(c,b),B=e.Dot(b,n),n=e.Dot(c,n),B=-B,h=e.CrossVV(d,h), d=h*e.CrossVV(b,c),c=h*e.CrossVV(c,a),a=h*e.CrossVV(a,b);0>=f&&0>=k?this.m_count=this.m_v1.a=1:0=a?(m=1/(g+f),this.m_v1.a=g*m,this.m_v2.a=f*m,this.m_count=2):0=c?(g=1/(m+k),this.m_v1.a=m*g,this.m_v3.a=k*g,this.m_count=2,this.m_v2.Set(this.m_v3)):0>=g&&0>=B?(this.m_count=this.m_v2.a=1,this.m_v1.Set(this.m_v2)):0>=m&&0>=n?(this.m_count=this.m_v3.a=1,this.m_v1.Set(this.m_v3)):0=d?(g=1/(n+B),this.m_v2.a=n*g,this.m_v3.a=B*g,this.m_count=2,this.m_v1.Set(this.m_v3)):(g=1/ (d+c+a),this.m_v1.a=d*g,this.m_v2.a=c*g,this.m_v3.a=a*g,this.m_count=3)};L.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3);this.indexB=new Vector_a2j_Number(3)};P.b2SimplexVertex=function(){};P.prototype.Set=function(a){this.wA.SetV(a.wA);this.wB.SetV(a.wB);this.w.SetV(a.w);this.a=a.a;this.indexA=a.indexA;this.indexB=a.indexB};K.b2TimeOfImpact=function(){};K.TimeOfImpact=function(a){++K.b2_toiCalls;var b=a.proxyA,c=a.proxyB,f=a.sweepA,g=a.sweepB;d.b2Assert(f.t0==g.t0);d.b2Assert(1- f.t0>Number.MIN_VALUE);var h=b.m_radius+c.m_radius;a=a.tolerance;var k=0,m=0,n=0;K.s_cache.count=0;for(K.s_distanceInput.useRadii=!1;;){f.GetTransform(K.s_xfA,k);g.GetTransform(K.s_xfB,k);K.s_distanceInput.proxyA=b;K.s_distanceInput.proxyB=c;K.s_distanceInput.transformA=K.s_xfA;K.s_distanceInput.transformB=K.s_xfB;v.Distance(K.s_distanceOutput,K.s_cache,K.s_distanceInput);if(0>=K.s_distanceOutput.distance){k=1;break}K.s_fcn.Initialize(K.s_cache,b,K.s_xfA,c,K.s_xfB);var B=K.s_fcn.Evaluate(K.s_xfA, K.s_xfB);if(0>=B){k=1;break}0==m&&(n=B>h?e.Max(h-a,0.75*h):e.Max(B-a,0.02*h));if(B-n<0.5*a){if(0==m){k=1;break}break}var p=k,H=k,E=1;f.GetTransform(K.s_xfA,E);g.GetTransform(K.s_xfB,E);var u=K.s_fcn.Evaluate(K.s_xfA,K.s_xfB);if(u>=n){k=1;break}for(var r=0;;){var s=0,s=r&1?H+(n-B)*(E-H)/(u-B):0.5*(H+E);f.GetTransform(K.s_xfA,s);g.GetTransform(K.s_xfB,s);var t=K.s_fcn.Evaluate(K.s_xfA,K.s_xfB);if(e.Abs(t-n)<0.025*a){p=s;break}t>n?(H=s,B=t):(E=s,u=t);++r;++K.b2_toiRootIters;if(50==r)break}K.b2_toiMaxRootIters= e.Max(K.b2_toiMaxRootIters,r);if(p<(1+100*Number.MIN_VALUE)*k)break;k=p;m++;++K.b2_toiIters;if(1E3==m)break}K.b2_toiMaxIters=e.Max(K.b2_toiMaxIters,m);return k};Box2D.postDefs.push(function(){Box2D.Collision.b2TimeOfImpact.b2_toiCalls=0;Box2D.Collision.b2TimeOfImpact.b2_toiIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiRootIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxRootIters=0;Box2D.Collision.b2TimeOfImpact.s_cache=new L;Box2D.Collision.b2TimeOfImpact.s_distanceInput= new s;Box2D.Collision.b2TimeOfImpact.s_xfA=new g;Box2D.Collision.b2TimeOfImpact.s_xfB=new g;Box2D.Collision.b2TimeOfImpact.s_fcn=new E;Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new u});U.b2TOIInput=function(){this.proxyA=new w;this.proxyB=new w;this.sweepA=new f;this.sweepB=new f};Q.b2WorldManifold=function(){this.m_normal=new h};Q.prototype.b2WorldManifold=function(){this.m_points=new Vector(d.b2_maxManifoldPoints);for(var a=0;aNumber.MIN_VALUE*Number.MIN_VALUE?(k=Math.sqrt(k),this.m_normal.x=g/k,this.m_normal.y=h/k):(this.m_normal.x= 1,this.m_normal.y=0);g=b+c*this.m_normal.y;d-=e*this.m_normal.y;this.m_points[0].x=0.5*(f+c*this.m_normal.x+(a-e*this.m_normal.x));this.m_points[0].y=0.5*(g+d);break;case A.e_faceA:h=b.R;g=a.m_localPlaneNormal;k=h.col1.x*g.x+h.col2.x*g.y;m=h.col1.y*g.x+h.col2.y*g.y;h=b.R;g=a.m_localPoint;n=b.position.x+h.col1.x*g.x+h.col2.x*g.y;B=b.position.y+h.col1.y*g.x+h.col2.y*g.y;this.m_normal.x=k;this.m_normal.y=m;for(f=0;fk||hthis.m_radius)return d.SetV(c),Math.PI*this.m_radius*this.m_radius;b=this.m_radius*this.m_radius;var f=e*e,e=b*(Math.asin(e/this.m_radius)+Math.PI/2)+e*Math.sqrt(b-f);b=-2/3*Math.pow(b-f,1.5)/e;d.x=c.x+a.x*b;d.y=c.y+a.y*b;return e};b.prototype.GetLocalPosition=function(){return this.m_p}; b.prototype.SetLocalPosition=function(a){this.m_p.SetV(a)};b.prototype.GetRadius=function(){return this.m_radius};b.prototype.SetRadius=function(a){void 0===a&&(a=0);this.m_radius=a};b.prototype.b2CircleShape=function(a){void 0===a&&(a=0);this.__super.b2Shape.call(this);this.m_type=g.e_circleShape;this.m_radius=a};c.b2EdgeChainDef=function(){};c.prototype.b2EdgeChainDef=function(){this.vertexCount=0;this.isALoop=!0;this.vertices=[]};Box2D.inherit(d,Box2D.Collision.Shapes.b2Shape);d.prototype.__super= Box2D.Collision.Shapes.b2Shape.prototype;d.b2EdgeShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.s_supportVec=new n;this.m_v1=new n;this.m_v2=new n;this.m_coreV1=new n;this.m_coreV2=new n;this.m_normal=new n;this.m_direction=new n;this.m_cornerDir1=new n;this.m_cornerDir2=new n};d.prototype.TestPoint=function(a,b){return!1};d.prototype.RayCast=function(a,b,c){var d,e=b.p2.x-b.p1.x,f=b.p2.y-b.p1.y;d=c.R;var g=c.position.x+(d.col1.x*this.m_v1.x+d.col2.x*this.m_v1.y), h=c.position.y+(d.col1.y*this.m_v1.x+d.col2.y*this.m_v1.y),k=c.position.y+(d.col1.y*this.m_v2.x+d.col2.y*this.m_v2.y)-h;c=-(c.position.x+(d.col1.x*this.m_v2.x+d.col2.x*this.m_v2.y)-g);d=100*Number.MIN_VALUE;var m=-(e*k+f*c);if(m>d){var g=b.p1.x-g,n=b.p1.y-h,h=g*k+n*c;if(0<=h&&h<=b.maxFraction*m&&(b=-e*n+f*g,-d*m<=b&&b<=m*(1+d)))return a.fraction=h/m,b=Math.sqrt(k*k+c*c),a.normal.x=k/b,a.normal.y=c/b,!0}return!1};d.prototype.ComputeAABB=function(a,b){var c=b.R,d=b.position.x+(c.col1.x*this.m_v1.x+ c.col2.x*this.m_v1.y),e=b.position.y+(c.col1.y*this.m_v1.x+c.col2.y*this.m_v1.y),f=b.position.x+(c.col1.x*this.m_v2.x+c.col2.x*this.m_v2.y),c=b.position.y+(c.col1.y*this.m_v2.x+c.col2.y*this.m_v2.y);dg*b+a*c?(this.s_supportVec.x=e,this.s_supportVec.y=f):(this.s_supportVec.x=g,this.s_supportVec.y=a);return this.s_supportVec};d.prototype.b2EdgeShape=function(b,c){this.__super.b2Shape.call(this);this.m_type=g.e_edgeShape;this.m_nextEdge=this.m_prevEdge=null;this.m_v1=b;this.m_v2=c;this.m_direction.Set(this.m_v2.x-this.m_v1.x,this.m_v2.y- this.m_v1.y);this.m_length=this.m_direction.Normalize();this.m_normal.Set(this.m_direction.y,-this.m_direction.x);this.m_coreV1.Set(-a.b2_toiSlop*(this.m_normal.x-this.m_direction.x)+this.m_v1.x,-a.b2_toiSlop*(this.m_normal.y-this.m_direction.y)+this.m_v1.y);this.m_coreV2.Set(-a.b2_toiSlop*(this.m_normal.x+this.m_direction.x)+this.m_v2.x,-a.b2_toiSlop*(this.m_normal.y+this.m_direction.y)+this.m_v2.y);this.m_cornerDir1=this.m_normal;this.m_cornerDir2.Set(-this.m_normal.x,-this.m_normal.y)};d.prototype.SetPrevEdge= function(a,b,c,d){this.m_prevEdge=a;this.m_coreV1=b;this.m_cornerDir1=c;this.m_cornerConvex1=d};d.prototype.SetNextEdge=function(a,b,c,d){this.m_nextEdge=a;this.m_coreV2=b;this.m_cornerDir2=c;this.m_cornerConvex2=d};e.b2MassData=function(){this.mass=0;this.center=new n(0,0);this.I=0};Box2D.inherit(f,Box2D.Collision.Shapes.b2Shape);f.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;f.b2PolygonShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments)};f.prototype.Copy= function(){var a=new f;a.Set(this);return a};f.prototype.Set=function(a){this.__super.Set.call(this,a);if(Box2D.is(a,f)){a=a instanceof f?a:null;this.m_centroid.SetV(a.m_centroid);this.m_vertexCount=a.m_vertexCount;this.Reserve(this.m_vertexCount);for(var b=0;bNumber.MIN_VALUE);this.m_normals[d].SetV(k.CrossVF(e, 1));this.m_normals[d].Normalize()}this.m_centroid=f.ComputeCentroid(this.m_vertices,this.m_vertexCount)};f.AsVector=function(a,b){void 0===b&&(b=0);var c=new f;c.SetAsVector(a,b);return c};f.prototype.SetAsBox=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-a,-b);this.m_vertices[1].Set(a,-b);this.m_vertices[2].Set(a,b);this.m_vertices[3].Set(-a,b);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1, 0);this.m_centroid.SetZero()};f.AsBox=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);var c=new f;c.SetAsBox(a,b);return c};f.prototype.SetAsOrientedBox=function(a,b,c,d){void 0===a&&(a=0);void 0===b&&(b=0);void 0===c&&(c=null);void 0===d&&(d=0);this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-a,-b);this.m_vertices[1].Set(a,-b);this.m_vertices[2].Set(a,b);this.m_vertices[3].Set(-a,b);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1, 0);this.m_centroid=c;a=new m;a.position=c;a.R.Set(d);for(c=0;cf)return!1}else 0>g&&fm?g:m,h=h>d?h:d;a.lowerBound.x=e-this.m_radius; a.lowerBound.y=f-this.m_radius;a.upperBound.x=g+this.m_radius;a.upperBound.y=h+this.m_radius};f.prototype.ComputeMass=function(a,b){void 0===b&&(b=0);if(2==this.m_vertexCount)a.center.x=0.5*(this.m_vertices[0].x+this.m_vertices[1].x),a.center.y=0.5*(this.m_vertices[0].y+this.m_vertices[1].y),a.mass=0,a.I=0;else{for(var c=0,d=0,e=0,f=0,g=1/3,h=0;hc&&(b=d,c=e)}return b};f.prototype.GetSupportVertex=function(a){for(var b=0,c=this.m_vertices[0].x*a.x+this.m_vertices[0].y*a.y,d=1;dc&&(b=d,c=e)}return this.m_vertices[b]};f.prototype.Validate=function(){return!1};f.prototype.b2PolygonShape=function(){this.__super.b2Shape.call(this);this.m_type=g.e_polygonShape;this.m_centroid=new n;this.m_vertices=new Vector;this.m_normals= new Vector};f.prototype.Reserve=function(a){void 0===a&&(a=0);for(var b=parseInt(this.m_vertices.length);bE&&(E=U);t>r&&(r=t)}s=(E-k)*(r-p);s<0.95*b&&(b=s,a.R.col1.x=g,a.R.col1.y=h,a.R.col2.x=m,a.R.col2.y=n,g=0.5*(k+E),h=0.5*(p+r),m=a.R,a.center.x=f.x+(m.col1.x*g+m.col2.x*h),a.center.y=f.y+(m.col1.y*g+m.col2.y* h),a.extents.x=0.5*(E-k),a.extents.y=0.5*(r-p))}};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2PolygonShape.s_mat=new h});g.b2Shape=function(){};g.prototype.Copy=function(){return null};g.prototype.Set=function(a){this.m_radius=a.m_radius};g.prototype.GetType=function(){return this.m_type};g.prototype.TestPoint=function(a,b){return!1};g.prototype.RayCast=function(a,b,c){return!1};g.prototype.ComputeAABB=function(a,b){};g.prototype.ComputeMass=function(a,b){};g.prototype.ComputeSubmergedArea= function(a,b,c,d){return 0};g.TestOverlap=function(a,b,c,d){var e=new t;e.proxyA=new v;e.proxyA.Set(a);e.proxyB=new v;e.proxyB.Set(c);e.transformA=b;e.transformB=d;e.useRadii=!0;a=new s;a.count=0;b=new r;p.Distance(b,a,e);return b.distance<10*Number.MIN_VALUE};g.prototype.b2Shape=function(){this.m_type=g.e_unknownShape;this.m_radius=a.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2Shape.e_unknownShape=-1;Box2D.Collision.Shapes.b2Shape.e_circleShape=0;Box2D.Collision.Shapes.b2Shape.e_polygonShape= 1;Box2D.Collision.Shapes.b2Shape.e_edgeShape=2;Box2D.Collision.Shapes.b2Shape.e_shapeTypeCount=3;Box2D.Collision.Shapes.b2Shape.e_hitCollide=1;Box2D.Collision.Shapes.b2Shape.e_missCollide=0;Box2D.Collision.Shapes.b2Shape.e_startsInsideCollide=-1})})(); (function(){var a=Box2D.Common.b2Color,b=Box2D.Common.b2Settings,c=Box2D.Common.Math.b2Math;a.b2Color=function(){this._b=this._g=this._r=0};a.prototype.b2Color=function(a,b,f){void 0===a&&(a=0);void 0===b&&(b=0);void 0===f&&(f=0);this._r=Box2D.parseUInt(255*c.Clamp(a,0,1));this._g=Box2D.parseUInt(255*c.Clamp(b,0,1));this._b=Box2D.parseUInt(255*c.Clamp(f,0,1))};a.prototype.Set=function(a,b,f){void 0===a&&(a=0);void 0===b&&(b=0);void 0===f&&(f=0);this._r=Box2D.parseUInt(255*c.Clamp(a,0,1));this._g= Box2D.parseUInt(255*c.Clamp(b,0,1));this._b=Box2D.parseUInt(255*c.Clamp(f,0,1))};Object.defineProperty(a.prototype,"r",{enumerable:!1,configurable:!0,set:function(a){void 0===a&&(a=0);this._r=Box2D.parseUInt(255*c.Clamp(a,0,1))}});Object.defineProperty(a.prototype,"g",{enumerable:!1,configurable:!0,set:function(a){void 0===a&&(a=0);this._g=Box2D.parseUInt(255*c.Clamp(a,0,1))}});Object.defineProperty(a.prototype,"b",{enumerable:!1,configurable:!0,set:function(a){void 0===a&&(a=0);this._b=Box2D.parseUInt(255* c.Clamp(a,0,1))}});Object.defineProperty(a.prototype,"color",{enumerable:!1,configurable:!0,get:function(){return this._r<<16|this._g<<8|this._b}});b.b2Settings=function(){};b.b2MixFriction=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);return Math.sqrt(a*b)};b.b2MixRestitution=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);return a>b?a:b};b.b2Assert=function(a){if(!a)throw"Assertion Failed";};Box2D.postDefs.push(function(){Box2D.Common.b2Settings.VERSION="2.1alpha";Box2D.Common.b2Settings.USHRT_MAX= 65535;Box2D.Common.b2Settings.b2_pi=Math.PI;Box2D.Common.b2Settings.b2_maxManifoldPoints=2;Box2D.Common.b2Settings.b2_aabbExtension=0.1;Box2D.Common.b2Settings.b2_aabbMultiplier=2;Box2D.Common.b2Settings.b2_polygonRadius=2*b.b2_linearSlop;Box2D.Common.b2Settings.b2_linearSlop=0.005;Box2D.Common.b2Settings.b2_angularSlop=2/180*b.b2_pi;Box2D.Common.b2Settings.b2_toiSlop=8*b.b2_linearSlop;Box2D.Common.b2Settings.b2_maxTOIContactsPerIsland=32;Box2D.Common.b2Settings.b2_maxTOIJointsPerIsland=32;Box2D.Common.b2Settings.b2_velocityThreshold= 1;Box2D.Common.b2Settings.b2_maxLinearCorrection=0.2;Box2D.Common.b2Settings.b2_maxAngularCorrection=8/180*b.b2_pi;Box2D.Common.b2Settings.b2_maxTranslation=2;Box2D.Common.b2Settings.b2_maxTranslationSquared=b.b2_maxTranslation*b.b2_maxTranslation;Box2D.Common.b2Settings.b2_maxRotation=0.5*b.b2_pi;Box2D.Common.b2Settings.b2_maxRotationSquared=b.b2_maxRotation*b.b2_maxRotation;Box2D.Common.b2Settings.b2_contactBaumgarte=0.2;Box2D.Common.b2Settings.b2_timeToSleep=0.5;Box2D.Common.b2Settings.b2_linearSleepTolerance= 0.01;Box2D.Common.b2Settings.b2_angularSleepTolerance=2/180*b.b2_pi})})(); (function(){var a=Box2D.Common.Math.b2Mat22,b=Box2D.Common.Math.b2Mat33,c=Box2D.Common.Math.b2Math,d=Box2D.Common.Math.b2Sweep,e=Box2D.Common.Math.b2Transform,f=Box2D.Common.Math.b2Vec2,g=Box2D.Common.Math.b2Vec3;a.b2Mat22=function(){this.col1=new f;this.col2=new f};a.prototype.b2Mat22=function(){this.SetIdentity()};a.FromAngle=function(b){void 0===b&&(b=0);var c=new a;c.Set(b);return c};a.FromVV=function(b,c){var d=new a;d.SetVV(b,c);return d};a.prototype.Set=function(a){void 0===a&&(a=0);var b= Math.cos(a);a=Math.sin(a);this.col1.x=b;this.col2.x=-a;this.col1.y=a;this.col2.y=b};a.prototype.SetVV=function(a,b){this.col1.SetV(a);this.col2.SetV(b)};a.prototype.Copy=function(){var b=new a;b.SetM(this);return b};a.prototype.SetM=function(a){this.col1.SetV(a.col1);this.col2.SetV(a.col2)};a.prototype.AddM=function(a){this.col1.x+=a.col1.x;this.col1.y+=a.col1.y;this.col2.x+=a.col2.x;this.col2.y+=a.col2.y};a.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col1.y=0;this.col2.y=1}; a.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col1.y=0;this.col2.y=0};a.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)};a.prototype.GetInverse=function(a){var b=this.col1.x,c=this.col2.x,d=this.col1.y,e=this.col2.y,f=b*e-c*d;0!=f&&(f=1/f);a.col1.x=f*e;a.col2.x=-f*c;a.col1.y=-f*d;a.col2.y=f*b;return a};a.prototype.Solve=function(a,b,c){void 0===b&&(b=0);void 0===c&&(c=0);var d=this.col1.x,e=this.col2.x,f=this.col1.y,g=this.col2.y,v=d*g-e*f;0!=v&&(v=1/v); a.x=v*(g*b-e*c);a.y=v*(d*c-f*b);return a};a.prototype.Abs=function(){this.col1.Abs();this.col2.Abs()};b.b2Mat33=function(){this.col1=new g;this.col2=new g;this.col3=new g};b.prototype.b2Mat33=function(a,b,c){void 0===a&&(a=null);void 0===b&&(b=null);void 0===c&&(c=null);a||b||c?(this.col1.SetV(a),this.col2.SetV(b),this.col3.SetV(c)):(this.col1.SetZero(),this.col2.SetZero(),this.col3.SetZero())};b.prototype.SetVVV=function(a,b,c){this.col1.SetV(a);this.col2.SetV(b);this.col3.SetV(c)};b.prototype.Copy= function(){return new b(this.col1,this.col2,this.col3)};b.prototype.SetM=function(a){this.col1.SetV(a.col1);this.col2.SetV(a.col2);this.col3.SetV(a.col3)};b.prototype.AddM=function(a){this.col1.x+=a.col1.x;this.col1.y+=a.col1.y;this.col1.z+=a.col1.z;this.col2.x+=a.col2.x;this.col2.y+=a.col2.y;this.col2.z+=a.col2.z;this.col3.x+=a.col3.x;this.col3.y+=a.col3.y;this.col3.z+=a.col3.z};b.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=1;this.col3.y=0; this.col1.z=0;this.col2.z=0;this.col3.z=1};b.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=0;this.col3.y=0;this.col1.z=0;this.col2.z=0;this.col3.z=0};b.prototype.Solve22=function(a,b,c){void 0===b&&(b=0);void 0===c&&(c=0);var d=this.col1.x,e=this.col2.x,f=this.col1.y,g=this.col2.y,v=d*g-e*f;0!=v&&(v=1/v);a.x=v*(g*b-e*c);a.y=v*(d*c-f*b);return a};b.prototype.Solve33=function(a,b,c,d){void 0===b&&(b=0);void 0===c&&(c=0);void 0===d&&(d=0);var e=this.col1.x, f=this.col1.y,g=this.col1.z,v=this.col2.x,s=this.col2.y,u=this.col2.z,w=this.col3.x,z=this.col3.y,F=this.col3.z,x=e*(s*F-u*z)+f*(u*w-v*F)+g*(v*z-s*w);0!=x&&(x=1/x);a.x=x*(b*(s*F-u*z)+c*(u*w-v*F)+d*(v*z-s*w));a.y=x*(e*(c*F-d*z)+f*(d*w-b*F)+g*(b*z-c*w));a.z=x*(e*(s*d-u*c)+f*(u*b-v*d)+g*(v*c-s*b));return a};c.b2Math=function(){};c.IsValid=function(a){void 0===a&&(a=0);return isFinite(a)};c.Dot=function(a,b){return a.x*b.x+a.y*b.y};c.CrossVV=function(a,b){return a.x*b.y-a.y*b.x};c.CrossVF=function(a, b){void 0===b&&(b=0);return new f(b*a.y,-b*a.x)};c.CrossFV=function(a,b){void 0===a&&(a=0);return new f(-a*b.y,a*b.x)};c.MulMV=function(a,b){return new f(a.col1.x*b.x+a.col2.x*b.y,a.col1.y*b.x+a.col2.y*b.y)};c.MulTMV=function(a,b){return new f(c.Dot(b,a.col1),c.Dot(b,a.col2))};c.MulX=function(a,b){var d=c.MulMV(a.R,b);d.x+=a.position.x;d.y+=a.position.y;return d};c.MulXT=function(a,b){var d=c.SubtractVV(b,a.position),e=d.x*a.R.col1.x+d.y*a.R.col1.y;d.y=d.x*a.R.col2.x+d.y*a.R.col2.y;d.x=e;return d}; c.AddVV=function(a,b){return new f(a.x+b.x,a.y+b.y)};c.SubtractVV=function(a,b){return new f(a.x-b.x,a.y-b.y)};c.Distance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)};c.DistanceSquared=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d};c.MulFV=function(a,b){void 0===a&&(a=0);return new f(a*b.x,a*b.y)};c.AddMM=function(b,d){return a.FromVV(c.AddVV(b.col1,d.col1),c.AddVV(b.col2,d.col2))};c.MulMM=function(b,d){return a.FromVV(c.MulMV(b,d.col1),c.MulMV(b,d.col2))};c.MulTMM=function(b, d){var e=new f(c.Dot(b.col1,d.col1),c.Dot(b.col2,d.col1)),g=new f(c.Dot(b.col1,d.col2),c.Dot(b.col2,d.col2));return a.FromVV(e,g)};c.Abs=function(a){void 0===a&&(a=0);return 0b?a:b};c.MaxV=function(a,b){return new f(c.Max(a.x,b.x),c.Max(a.y,b.y))};c.Clamp=function(a,b,c){void 0===a&&(a=0);void 0===b&&(b=0);void 0===c&&(c=0);return ac?c:a};c.ClampV=function(a,b,d){return c.MaxV(b,c.MinV(a,d))};c.Swap=function(a,b){var c=a[0];a[0]=b[0];b[0]=c};c.Random=function(){return 2*Math.random()-1};c.RandomRange=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);var c=Math.random();return(b-a)*c+a};c.NextPowerOfTwo=function(a){void 0===a&&(a=0);a|=a>>1&2147483647;a|= a>>2&1073741823;a|=a>>4&268435455;a|=a>>8&16777215;return(a|a>>16&65535)+1};c.IsPowerOfTwo=function(a){void 0===a&&(a=0);return 0Number.MIN_VALUE){var b=(a-this.t0)/(1-this.t0);this.c0.x=(1-b)*this.c0.x+b*this.c.x;this.c0.y=(1-b)*this.c0.y+b*this.c.y;this.a0=(1-b)*this.a0+b*this.a;this.t0=a}};e.b2Transform=function(){this.position=new f;this.R=new a};e.prototype.b2Transform=function(a,b){void 0===a&&(a=null);void 0===b&&(b=null);a&&(this.position.SetV(a),this.R.SetM(b))};e.prototype.Initialize=function(a, b){this.position.SetV(a);this.R.SetM(b)};e.prototype.SetIdentity=function(){this.position.SetZero();this.R.SetIdentity()};e.prototype.Set=function(a){this.position.SetV(a.position);this.R.SetM(a.R)};e.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)};f.b2Vec2=function(){};f.prototype.b2Vec2=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);this.x=a;this.y=b};f.prototype.SetZero=function(){this.y=this.x=0};f.prototype.Set=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0); this.x=a;this.y=b};f.prototype.SetV=function(a){this.x=a.x;this.y=a.y};f.prototype.GetNegative=function(){return new f(-this.x,-this.y)};f.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y};f.Make=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);return new f(a,b)};f.prototype.Copy=function(){return new f(this.x,this.y)};f.prototype.Add=function(a){this.x+=a.x;this.y+=a.y};f.prototype.Subtract=function(a){this.x-=a.x;this.y-=a.y};f.prototype.Multiply=function(a){void 0===a&&(a=0);this.x*= a;this.y*=a};f.prototype.MulM=function(a){var b=this.x;this.x=a.col1.x*b+a.col2.x*this.y;this.y=a.col1.y*b+a.col2.y*this.y};f.prototype.MulTM=function(a){var b=c.Dot(this,a.col1);this.y=c.Dot(this,a.col2);this.x=b};f.prototype.CrossVF=function(a){void 0===a&&(a=0);var b=this.x;this.x=a*this.y;this.y=-a*b};f.prototype.CrossFV=function(a){void 0===a&&(a=0);var b=this.x;this.x=-a*this.y;this.y=a*b};f.prototype.MinV=function(a){this.x=this.xa.x?this.x:a.x;this.y=this.y>a.y?this.y:a.y};f.prototype.Abs=function(){0>this.x&&(this.x=-this.x);0>this.y&&(this.y=-this.y)};f.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};f.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y};f.prototype.Normalize=function(){var a=Math.sqrt(this.x*this.x+this.y*this.y);if(a=this.m_mass&&(this.m_mass=1);this.m_invMass=1/this.m_mass;0f.b2_maxTranslationSquared&&(g.m_linearVelocity.Normalize(),g.m_linearVelocity.x=g.m_linearVelocity.x*f.b2_maxTranslation*b.inv_dt, g.m_linearVelocity.y=g.m_linearVelocity.y*f.b2_maxTranslation*b.inv_dt);k=b.dt*g.m_angularVelocity;k*k>f.b2_maxRotationSquared&&(g.m_angularVelocity=0>g.m_angularVelocity?-f.b2_maxRotation*b.inv_dt:f.b2_maxRotation*b.inv_dt);g.m_sweep.c0.SetV(g.m_sweep.c);g.m_sweep.a0=g.m_sweep.a;g.m_sweep.c.x+=b.dt*g.m_linearVelocity.x;g.m_sweep.c.y+=b.dt*g.m_linearVelocity.y;g.m_sweep.a+=b.dt*g.m_angularVelocity;g.SynchronizeTransform()}for(e=0;e k||a.Dot(g.m_linearVelocity,g.m_linearVelocity)>c?d=g.m_sleepTime=0:(g.m_sleepTime+=b.dt,d=a.Min(d,g.m_sleepTime)));if(d>=f.b2_timeToSleep)for(e=0;ef.b2_maxTranslationSquared&&(c.m_linearVelocity.Normalize(),c.m_linearVelocity.x=c.m_linearVelocity.x*f.b2_maxTranslation*a.inv_dt,c.m_linearVelocity.y=c.m_linearVelocity.y*f.b2_maxTranslation*a.inv_dt);e=a.dt*c.m_angularVelocity;e*e>f.b2_maxRotationSquared&&(c.m_angularVelocity= 0>c.m_angularVelocity?-f.b2_maxRotation*a.inv_dt:f.b2_maxRotation*a.inv_dt);c.m_sweep.c0.SetV(c.m_sweep.c);c.m_sweep.a0=c.m_sweep.a;c.m_sweep.c.x+=a.dt*c.m_linearVelocity.x;c.m_sweep.c.y+=a.dt*c.m_linearVelocity.y;c.m_sweep.a+=a.dt*c.m_angularVelocity;c.SynchronizeTransform()}for(b=0;b=b);0b&&(b=(1-b)*m+b,1-1.5*y.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold=new L;Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new z});Box2D.inherit(r,Box2D.Dynamics.Contacts.b2Contact);r.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;r.b2EdgeAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};r.Create=function(a){return new r};r.Destroy=function(a, b){};r.prototype.Reset=function(a,b){this.__super.Reset.call(this,a,b)};r.prototype.Evaluate=function(){var c=this.m_fixtureA.GetBody(),d=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof b?this.m_fixtureA.GetShape():null,c.m_xf,this.m_fixtureB.GetShape()instanceof a?this.m_fixtureB.GetShape():null,d.m_xf)};r.prototype.b2CollideEdgeAndCircle=function(a,b,c,d,e){};Box2D.inherit(v,Box2D.Dynamics.Contacts.b2Contact);v.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype; v.b2NullContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};v.prototype.b2NullContact=function(){this.__super.b2Contact.call(this)};v.prototype.Evaluate=function(){};Box2D.inherit(s,Box2D.Dynamics.Contacts.b2Contact);s.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;s.b2PolyAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};s.Create=function(a){return new s};s.Destroy=function(a,b){};s.prototype.Reset=function(a, b){this.__super.Reset.call(this,a,b);y.b2Assert(a.GetType()==d.e_polygonShape);y.b2Assert(b.GetType()==d.e_circleShape)};s.prototype.Evaluate=function(){var b=this.m_fixtureA.m_body,d=this.m_fixtureB.m_body;D.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof c?this.m_fixtureA.GetShape():null,b.m_xf,this.m_fixtureB.GetShape()instanceof a?this.m_fixtureB.GetShape():null,d.m_xf)};Box2D.inherit(u,Box2D.Dynamics.Contacts.b2Contact);u.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype; u.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};u.Create=function(a){return new u};u.Destroy=function(a,b){};u.prototype.Reset=function(a,b){this.__super.Reset.call(this,a,b);y.b2Assert(a.GetType()==d.e_polygonShape);y.b2Assert(b.GetType()==d.e_edgeShape)};u.prototype.Evaluate=function(){var a=this.m_fixtureA.GetBody(),d=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape()instanceof c?this.m_fixtureA.GetShape(): null,a.m_xf,this.m_fixtureB.GetShape()instanceof b?this.m_fixtureB.GetShape():null,d.m_xf)};u.prototype.b2CollidePolyAndEdge=function(a,b,c,d,e){};Box2D.inherit(w,Box2D.Dynamics.Contacts.b2Contact);w.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;w.b2PolygonContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};w.Create=function(a){return new w};w.Destroy=function(a,b){};w.prototype.Reset=function(a,b){this.__super.Reset.call(this,a,b)};w.prototype.Evaluate= function(){var a=this.m_fixtureA.GetBody(),b=this.m_fixtureB.GetBody();D.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape()instanceof c?this.m_fixtureA.GetShape():null,a.m_xf,this.m_fixtureB.GetShape()instanceof c?this.m_fixtureB.GetShape():null,b.m_xf)};z.b2PositionSolverManifold=function(){};z.prototype.b2PositionSolverManifold=function(){this.m_normal=new I;this.m_separations=new Vector_a2j_Number(y.b2_maxManifoldPoints);this.m_points=new Vector(y.b2_maxManifoldPoints);for(var a=0;aNumber.MIN_VALUE*Number.MIN_VALUE?(h=Math.sqrt(h),this.m_normal.x= d/h,this.m_normal.y=g/h):(this.m_normal.x=1,this.m_normal.y=0);this.m_points[0].x=0.5*(b+f);this.m_points[0].y=0.5*(c+e);this.m_separations[0]=d*this.m_normal.x+g*this.m_normal.y-a.radius;break;case J.e_faceA:e=a.bodyA.m_xf.R;d=a.localPlaneNormal;this.m_normal.x=e.col1.x*d.x+e.col2.x*d.y;this.m_normal.y=e.col1.y*d.x+e.col2.y*d.y;e=a.bodyA.m_xf.R;d=a.localPoint;f=a.bodyA.m_xf.position.x+(e.col1.x*d.x+e.col2.x*d.y);g=a.bodyA.m_xf.position.y+(e.col1.y*d.x+e.col2.y*d.y);e=a.bodyB.m_xf.R;for(b=0;bthis.maxTimestep&&0a.b2_linearSlop?this.m_u.Multiply(1/d):this.m_u.SetZero();c=g*this.m_u.y-h*this.m_u.x;var n=k*this.m_u.y-m*this.m_u.x;c=e.m_invMass+e.m_invI* c*c+f.m_invMass+f.m_invI*n*n;this.m_mass=0!=c?1/c:0;if(0b*b&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.Multiply(b));b=d.SubtractVV(this.m_linearImpulse,c);h.x-=p*b.x;h.y-=p*b.y;k-=s*(t*b.y-u*b.x);m.x+=r*b.x;m.y+=r*b.y;n+=v*(w*b.y-x*b.x);f.m_angularVelocity=k;g.m_angularVelocity=n};k.prototype.SolvePositionConstraints=function(a){return!0};Box2D.inherit(m,Box2D.Dynamics.Joints.b2JointDef);m.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;m.b2FrictionJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);this.localAnchorA=new e;this.localAnchorB=new e};m.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this);this.type=r.e_frictionJoint;this.maxTorque=this.maxForce=0};m.prototype.Initialize=function(a,b,c){this.bodyA=a;this.bodyB=b;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(c));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(c))};Box2D.inherit(n,Box2D.Dynamics.Joints.b2Joint);n.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;n.b2GearJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);this.m_groundAnchor1=new e;this.m_groundAnchor2=new e;this.m_localAnchor1=new e;this.m_localAnchor2=new e;this.m_J=new t};n.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};n.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};n.prototype.GetReactionForce=function(a){void 0===a&&(a=0);return new e(a*this.m_impulse*this.m_J.linearB.x,a*this.m_impulse*this.m_J.linearB.y)};n.prototype.GetReactionTorque=function(a){void 0=== a&&(a=0);var b=this.m_bodyB.m_xf.R,c=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,d=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,e=b.col1.x*c+b.col2.x*d,d=b.col1.y*c+b.col2.y*d;return a*(this.m_impulse*this.m_J.angularB-e*this.m_impulse*this.m_J.linearB.y+d*this.m_impulse*this.m_J.linearB.x)};n.prototype.GetRatio=function(){return this.m_ratio};n.prototype.SetRatio=function(a){void 0===a&&(a=0);this.m_ratio=a};n.prototype.b2GearJoint=function(a){this.__super.b2Joint.call(this, a);var b=parseInt(a.joint1.m_type),c=parseInt(a.joint2.m_type);this.m_prismatic2=this.m_revolute2=this.m_prismatic1=this.m_revolute1=null;var d=0,e=0;this.m_ground1=a.joint1.GetBodyA();this.m_bodyA=a.joint1.GetBodyB();b==r.e_revoluteJoint?(this.m_revolute1=a.joint1 instanceof I?a.joint1:null,this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1),this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2),d=this.m_revolute1.GetJointAngle()):(this.m_prismatic1=a.joint1 instanceof x?a.joint1:null, this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1),this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2),d=this.m_prismatic1.GetJointTranslation());this.m_ground2=a.joint2.GetBodyA();this.m_bodyB=a.joint2.GetBodyB();c==r.e_revoluteJoint?(this.m_revolute2=a.joint2 instanceof I?a.joint2:null,this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1),this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2),e=this.m_revolute2.GetJointAngle()):(this.m_prismatic2=a.joint2 instanceof x?a.joint2: null,this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1),this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2),e=this.m_prismatic2.GetJointTranslation());this.m_ratio=a.ratio;this.m_constant=d+this.m_ratio*e;this.m_impulse=0};n.prototype.InitVelocityConstraints=function(a){var b=this.m_ground1,c=this.m_ground2,d=this.m_bodyA,e=this.m_bodyB,f=0,g=0,h=0,k=0,m=h=0,n=0;this.m_J.SetZero();this.m_revolute1?(this.m_J.angularA=-1,n+=d.m_invI):(b=b.m_xf.R,g=this.m_prismatic1.m_localXAxis1,f=b.col1.x* g.x+b.col2.x*g.y,g=b.col1.y*g.x+b.col2.y*g.y,b=d.m_xf.R,h=this.m_localAnchor1.x-d.m_sweep.localCenter.x,k=this.m_localAnchor1.y-d.m_sweep.localCenter.y,m=b.col1.x*h+b.col2.x*k,k=b.col1.y*h+b.col2.y*k,h=m*g-k*f,this.m_J.linearA.Set(-f,-g),this.m_J.angularA=-h,n+=d.m_invMass+d.m_invI*h*h);this.m_revolute2?(this.m_J.angularB=-this.m_ratio,n+=this.m_ratio*this.m_ratio*e.m_invI):(b=c.m_xf.R,g=this.m_prismatic2.m_localXAxis1,f=b.col1.x*g.x+b.col2.x*g.y,g=b.col1.y*g.x+b.col2.y*g.y,b=e.m_xf.R,h=this.m_localAnchor2.x- e.m_sweep.localCenter.x,k=this.m_localAnchor2.y-e.m_sweep.localCenter.y,m=b.col1.x*h+b.col2.x*k,k=b.col1.y*h+b.col2.y*k,h=m*g-k*f,this.m_J.linearB.Set(-this.m_ratio*f,-this.m_ratio*g),this.m_J.angularB=-this.m_ratio*h,n+=this.m_ratio*this.m_ratio*(e.m_invMass+e.m_invI*h*h));this.m_mass=0Number.MIN_VALUE?1/this.m_motorMass:0;this.m_perp.SetV(d.MulMV(h.R,this.m_localYAxis1));this.m_s1=(f+k)*this.m_perp.y-(g+m)*this.m_perp.x;this.m_s2=n*this.m_perp.y-p*this.m_perp.x;h=this.m_invMassA;k=this.m_invMassB;m=this.m_invIA;n=this.m_invIB;this.m_K.col1.x=h+k+m*this.m_s1* this.m_s1+n*this.m_s2*this.m_s2;this.m_K.col1.y=m*this.m_s1*this.m_a1+n*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=h+k+m*this.m_a1*this.m_a1+n*this.m_a2*this.m_a2;this.m_enableLimit?(f=this.m_axis.x*f+this.m_axis.y*g,d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?this.m_limitState=r.e_equalLimits:f<=this.m_lowerTranslation?this.m_limitState!=r.e_atLowerLimit&&(this.m_limitState=r.e_atLowerLimit,this.m_impulse.y=0):f>=this.m_upperTranslation?this.m_limitState!= r.e_atUpperLimit&&(this.m_limitState=r.e_atUpperLimit,this.m_impulse.y=0):(this.m_limitState=r.e_inactiveLimit,this.m_impulse.y=0)):this.m_limitState=r.e_inactiveLimit;!1==this.m_enableMotor&&(this.m_motorImpulse=0);b.warmStarting?(this.m_impulse.x*=b.dtRatio,this.m_impulse.y*=b.dtRatio,this.m_motorImpulse*=b.dtRatio,b=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x,f=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y,g=this.m_impulse.x* this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1,h=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2,c.m_linearVelocity.x-=this.m_invMassA*b,c.m_linearVelocity.y-=this.m_invMassA*f,c.m_angularVelocity-=this.m_invIA*g,e.m_linearVelocity.x+=this.m_invMassB*b,e.m_linearVelocity.y+=this.m_invMassB*f,e.m_angularVelocity+=this.m_invIB*h):(this.m_impulse.SetZero(),this.m_motorImpulse=0)};u.prototype.SolveVelocityConstraints=function(a){var b=this.m_bodyA,c=this.m_bodyB, f=b.m_linearVelocity,g=b.m_angularVelocity,h=c.m_linearVelocity,k=c.m_angularVelocity,m=0,n=0,p=0,s=0;this.m_enableMotor&&this.m_limitState!=r.e_equalLimits&&(s=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(h.x-f.x)+this.m_axis.y*(h.y-f.y)+this.m_a2*k-this.m_a1*g)),m=this.m_motorImpulse,n=a.dt*this.m_maxMotorForce,this.m_motorImpulse=d.Clamp(this.m_motorImpulse+s,-n,n),s=this.m_motorImpulse-m,m=s*this.m_axis.x,n=s*this.m_axis.y,p=s*this.m_a1,s*=this.m_a2,f.x-=this.m_invMassA*m,f.y-=this.m_invMassA* n,g-=this.m_invIA*p,h.x+=this.m_invMassB*m,h.y+=this.m_invMassB*n,k+=this.m_invIB*s);n=this.m_perp.x*(h.x-f.x)+this.m_perp.y*(h.y-f.y)+this.m_s2*k-this.m_s1*g;this.m_enableLimit&&this.m_limitState!=r.e_inactiveLimit?(p=this.m_axis.x*(h.x-f.x)+this.m_axis.y*(h.y-f.y)+this.m_a2*k-this.m_a1*g,m=this.m_impulse.Copy(),a=this.m_K.Solve(new e,-n,-p),this.m_impulse.Add(a),this.m_limitState==r.e_atLowerLimit?this.m_impulse.y=d.Max(this.m_impulse.y,0):this.m_limitState==r.e_atUpperLimit&&(this.m_impulse.y= d.Min(this.m_impulse.y,0)),n=-n-(this.m_impulse.y-m.y)*this.m_K.col2.x,p=0,p=0!=this.m_K.col1.x?n/this.m_K.col1.x+m.x:m.x,this.m_impulse.x=p,a.x=this.m_impulse.x-m.x,a.y=this.m_impulse.y-m.y,m=a.x*this.m_perp.x+a.y*this.m_axis.x,n=a.x*this.m_perp.y+a.y*this.m_axis.y,p=a.x*this.m_s1+a.y*this.m_a1,s=a.x*this.m_s2+a.y*this.m_a2):(a=0,a=0!=this.m_K.col1.x?-n/this.m_K.col1.x:0,this.m_impulse.x+=a,m=a*this.m_perp.x,n=a*this.m_perp.y,p=a*this.m_s1,s=a*this.m_s2);f.x-=this.m_invMassA*m;f.y-=this.m_invMassA* n;g-=this.m_invIA*p;h.x+=this.m_invMassB*m;h.y+=this.m_invMassB*n;k+=this.m_invIB*s;b.m_linearVelocity.SetV(f);b.m_angularVelocity=g;c.m_linearVelocity.SetV(h);c.m_angularVelocity=k};u.prototype.SolvePositionConstraints=function(c){c=this.m_bodyA;var f=this.m_bodyB,g=c.m_sweep.c,h=c.m_sweep.a,k=f.m_sweep.c,m=f.m_sweep.a,n,p=0,r=0,s=0,v=0,t=n=0,u=0,r=!1,w=0,x=b.FromAngle(h),s=b.FromAngle(m);n=x;var u=this.m_localAnchor1.x-this.m_localCenterA.x,y=this.m_localAnchor1.y-this.m_localCenterA.y,p=n.col1.x* u+n.col2.x*y,y=n.col1.y*u+n.col2.y*y,u=p;n=s;s=this.m_localAnchor2.x-this.m_localCenterB.x;v=this.m_localAnchor2.y-this.m_localCenterB.y;p=n.col1.x*s+n.col2.x*v;v=n.col1.y*s+n.col2.y*v;s=p;n=k.x+s-g.x-u;p=k.y+v-g.y-y;if(this.m_enableLimit){this.m_axis=d.MulMV(x,this.m_localXAxis1);this.m_a1=(n+u)*this.m_axis.y-(p+y)*this.m_axis.x;this.m_a2=s*this.m_axis.y-v*this.m_axis.x;var A=this.m_axis.x*n+this.m_axis.y*p;d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?(w=d.Clamp(A,-a.b2_maxLinearCorrection, a.b2_maxLinearCorrection),t=d.Abs(A),r=!0):A<=this.m_lowerTranslation?(w=d.Clamp(A-this.m_lowerTranslation+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),t=this.m_lowerTranslation-A,r=!0):A>=this.m_upperTranslation&&(w=d.Clamp(A-this.m_upperTranslation+a.b2_linearSlop,0,a.b2_maxLinearCorrection),t=A-this.m_upperTranslation,r=!0)}this.m_perp=d.MulMV(x,this.m_localYAxis1);this.m_s1=(n+u)*this.m_perp.y-(p+y)*this.m_perp.x;this.m_s2=s*this.m_perp.y-v*this.m_perp.x;x=new e;y=this.m_perp.x*n+this.m_perp.y* p;t=d.Max(t,d.Abs(y));u=0;r?(r=this.m_invMassA,s=this.m_invMassB,v=this.m_invIA,n=this.m_invIB,this.m_K.col1.x=r+s+v*this.m_s1*this.m_s1+n*this.m_s2*this.m_s2,this.m_K.col1.y=v*this.m_s1*this.m_a1+n*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=r+s+v*this.m_a1*this.m_a1+n*this.m_a2*this.m_a2,this.m_K.Solve(x,-y,-w)):(r=this.m_invMassA,s=this.m_invMassB,v=this.m_invIA,n=this.m_invIB,w=r+s+v*this.m_s1*this.m_s1+n*this.m_s2*this.m_s2,x.x=0!=w?-y/w:0,x.y=0);w=x.x*this.m_perp.x+x.y* this.m_axis.x;r=x.x*this.m_perp.y+x.y*this.m_axis.y;y=x.x*this.m_s1+x.y*this.m_a1;x=x.x*this.m_s2+x.y*this.m_a2;g.x-=this.m_invMassA*w;g.y-=this.m_invMassA*r;h-=this.m_invIA*y;k.x+=this.m_invMassB*w;k.y+=this.m_invMassB*r;m+=this.m_invIB*x;c.m_sweep.a=h;f.m_sweep.a=m;c.SynchronizeTransform();f.SynchronizeTransform();return t<=a.b2_linearSlop&&u<=a.b2_angularSlop};Box2D.inherit(w,Box2D.Dynamics.Joints.b2JointDef);w.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;w.b2LineJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);this.localAnchorA=new e;this.localAnchorB=new e;this.localAxisA=new e};w.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this);this.type=r.e_lineJoint;this.localAxisA.Set(1,0);this.enableLimit=!1;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=!1;this.motorSpeed=this.maxMotorForce=0};w.prototype.Initialize=function(a,b,c,d){this.bodyA=a;this.bodyB=b;this.localAnchorA=this.bodyA.GetLocalPoint(c);this.localAnchorB=this.bodyB.GetLocalPoint(c);this.localAxisA= this.bodyA.GetLocalVector(d)};Box2D.inherit(z,Box2D.Dynamics.Joints.b2Joint);z.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;z.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new b;this.K1=new b;this.K2=new b;this.m_localAnchor=new e;this.m_target=new e;this.m_impulse=new e;this.m_mass=new b;this.m_C=new e};z.prototype.GetAnchorA=function(){return this.m_target};z.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)}; z.prototype.GetReactionForce=function(a){void 0===a&&(a=0);return new e(a*this.m_impulse.x,a*this.m_impulse.y)};z.prototype.GetReactionTorque=function(a){return 0};z.prototype.GetTarget=function(){return this.m_target};z.prototype.SetTarget=function(a){!1==this.m_bodyB.IsAwake()&&this.m_bodyB.SetAwake(!0);this.m_target=a};z.prototype.GetMaxForce=function(){return this.m_maxForce};z.prototype.SetMaxForce=function(a){void 0===a&&(a=0);this.m_maxForce=a};z.prototype.GetFrequency=function(){return this.m_frequencyHz}; z.prototype.SetFrequency=function(a){void 0===a&&(a=0);this.m_frequencyHz=a};z.prototype.GetDampingRatio=function(){return this.m_dampingRatio};z.prototype.SetDampingRatio=function(a){void 0===a&&(a=0);this.m_dampingRatio=a};z.prototype.b2MouseJoint=function(a){this.__super.b2Joint.call(this,a);this.m_target.SetV(a.target);var b=this.m_target.x-this.m_bodyB.m_xf.position.x,c=this.m_target.y-this.m_bodyB.m_xf.position.y,d=this.m_bodyB.m_xf.R;this.m_localAnchor.x=b*d.col1.x+c*d.col1.y;this.m_localAnchor.y= b*d.col2.x+c*d.col2.y;this.m_maxForce=a.maxForce;this.m_impulse.SetZero();this.m_frequencyHz=a.frequencyHz;this.m_dampingRatio=a.dampingRatio;this.m_gamma=this.m_beta=0};z.prototype.InitVelocityConstraints=function(a){var b=this.m_bodyB,c=b.GetMass(),d=2*Math.PI*this.m_frequencyHz,e=c*d*d;this.m_gamma=a.dt*(2*c*this.m_dampingRatio*d+a.dt*e);this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0;this.m_beta=a.dt*e*this.m_gamma;var e=b.m_xf.R,c=this.m_localAnchor.x-b.m_sweep.localCenter.x,d=this.m_localAnchor.y- b.m_sweep.localCenter.y,f=e.col1.x*c+e.col2.x*d,d=e.col1.y*c+e.col2.y*d,c=f,e=b.m_invMass,f=b.m_invI;this.K1.col1.x=e;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=e;this.K2.col1.x=f*d*d;this.K2.col2.x=-f*c*d;this.K2.col1.y=-f*c*d;this.K2.col2.y=f*c*c;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.col1.x+=this.m_gamma;this.K.col2.y+=this.m_gamma;this.K.GetInverse(this.m_mass);this.m_C.x=b.m_sweep.c.x+c-this.m_target.x;this.m_C.y=b.m_sweep.c.y+d-this.m_target.y;b.m_angularVelocity*=0.98;this.m_impulse.x*= a.dtRatio;this.m_impulse.y*=a.dtRatio;b.m_linearVelocity.x+=e*this.m_impulse.x;b.m_linearVelocity.y+=e*this.m_impulse.y;b.m_angularVelocity+=f*(c*this.m_impulse.y-d*this.m_impulse.x)};z.prototype.SolveVelocityConstraints=function(a){var b=this.m_bodyB,c,d=0,e=0;c=b.m_xf.R;var f=this.m_localAnchor.x-b.m_sweep.localCenter.x,g=this.m_localAnchor.y-b.m_sweep.localCenter.y,d=c.col1.x*f+c.col2.x*g,g=c.col1.y*f+c.col2.y*g,f=d,d=b.m_linearVelocity.x+-b.m_angularVelocity*g,h=b.m_linearVelocity.y+b.m_angularVelocity* f;c=this.m_mass;d=d+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x;e=h+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;h=-(c.col1.x*d+c.col2.x*e);e=-(c.col1.y*d+c.col2.y*e);c=this.m_impulse.x;d=this.m_impulse.y;this.m_impulse.x+=h;this.m_impulse.y+=e;a=a.dt*this.m_maxForce;this.m_impulse.LengthSquared()>a*a&&this.m_impulse.Multiply(a/this.m_impulse.Length());h=this.m_impulse.x-c;e=this.m_impulse.y-d;b.m_linearVelocity.x+=b.m_invMass*h;b.m_linearVelocity.y+=b.m_invMass*e;b.m_angularVelocity+= b.m_invI*(f*e-g*h)};z.prototype.SolvePositionConstraints=function(a){return!0};Box2D.inherit(F,Box2D.Dynamics.Joints.b2JointDef);F.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;F.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.target=new e};F.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this);this.type=r.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7};Box2D.inherit(x,Box2D.Dynamics.Joints.b2Joint); x.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;x.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new e;this.m_localAnchor2=new e;this.m_localXAxis1=new e;this.m_localYAxis1=new e;this.m_axis=new e;this.m_perp=new e;this.m_K=new c;this.m_impulse=new f};x.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};x.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)}; x.prototype.GetReactionForce=function(a){void 0===a&&(a=0);return new e(a*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),a*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))};x.prototype.GetReactionTorque=function(a){void 0===a&&(a=0);return a*this.m_impulse.y};x.prototype.GetJointTranslation=function(){var a=this.m_bodyA,b=this.m_bodyB,c=a.GetWorldPoint(this.m_localAnchor1),d=b.GetWorldPoint(this.m_localAnchor2),b=d.x-c.x, c=d.y-c.y,a=a.GetWorldVector(this.m_localXAxis1);return a.x*b+a.y*c};x.prototype.GetJointSpeed=function(){var a=this.m_bodyA,b=this.m_bodyB,c;c=a.m_xf.R;var d=this.m_localAnchor1.x-a.m_sweep.localCenter.x,e=this.m_localAnchor1.y-a.m_sweep.localCenter.y,f=c.col1.x*d+c.col2.x*e,e=c.col1.y*d+c.col2.y*e,d=f;c=b.m_xf.R;var g=this.m_localAnchor2.x-b.m_sweep.localCenter.x,h=this.m_localAnchor2.y-b.m_sweep.localCenter.y,f=c.col1.x*g+c.col2.x*h,h=c.col1.y*g+c.col2.y*h,g=f;c=b.m_sweep.c.x+g-(a.m_sweep.c.x+ d);var f=b.m_sweep.c.y+h-(a.m_sweep.c.y+e),k=a.GetWorldVector(this.m_localXAxis1),m=a.m_linearVelocity,n=b.m_linearVelocity,a=a.m_angularVelocity,b=b.m_angularVelocity;return c*-a*k.y+f*a*k.x+(k.x*(n.x+-b*h-m.x- -a*e)+k.y*(n.y+b*g-m.y-a*d))};x.prototype.IsLimitEnabled=function(){return this.m_enableLimit};x.prototype.EnableLimit=function(a){this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_enableLimit=a};x.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};x.prototype.GetUpperLimit= function(){return this.m_upperTranslation};x.prototype.SetLimits=function(a,b){void 0===a&&(a=0);void 0===b&&(b=0);this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_lowerTranslation=a;this.m_upperTranslation=b};x.prototype.IsMotorEnabled=function(){return this.m_enableMotor};x.prototype.EnableMotor=function(a){this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_enableMotor=a};x.prototype.SetMotorSpeed=function(a){void 0===a&&(a=0);this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0); this.m_motorSpeed=a};x.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};x.prototype.SetMaxMotorForce=function(a){void 0===a&&(a=0);this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_maxMotorForce=a};x.prototype.GetMotorForce=function(){return this.m_motorImpulse};x.prototype.b2PrismaticJoint=function(a){this.__super.b2Joint.call(this,a);this.m_localAnchor1.SetV(a.localAnchorA);this.m_localAnchor2.SetV(a.localAnchorB);this.m_localXAxis1.SetV(a.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y; this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_refAngle=a.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=a.lowerTranslation;this.m_upperTranslation=a.upperTranslation;this.m_maxMotorForce=a.maxMotorForce;this.m_motorSpeed=a.motorSpeed;this.m_enableLimit=a.enableLimit;this.m_enableMotor=a.enableMotor;this.m_limitState=r.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};x.prototype.InitVelocityConstraints=function(b){var c=this.m_bodyA, e=this.m_bodyB,f,g=0;this.m_localCenterA.SetV(c.GetLocalCenter());this.m_localCenterB.SetV(e.GetLocalCenter());var h=c.GetTransform();e.GetTransform();f=c.m_xf.R;var k=this.m_localAnchor1.x-this.m_localCenterA.x,m=this.m_localAnchor1.y-this.m_localCenterA.y,g=f.col1.x*k+f.col2.x*m,m=f.col1.y*k+f.col2.y*m,k=g;f=e.m_xf.R;var n=this.m_localAnchor2.x-this.m_localCenterB.x,p=this.m_localAnchor2.y-this.m_localCenterB.y,g=f.col1.x*n+f.col2.x*p,p=f.col1.y*n+f.col2.y*p,n=g;f=e.m_sweep.c.x+n-c.m_sweep.c.x- k;g=e.m_sweep.c.y+p-c.m_sweep.c.y-m;this.m_invMassA=c.m_invMass;this.m_invMassB=e.m_invMass;this.m_invIA=c.m_invI;this.m_invIB=e.m_invI;this.m_axis.SetV(d.MulMV(h.R,this.m_localXAxis1));this.m_a1=(f+k)*this.m_axis.y-(g+m)*this.m_axis.x;this.m_a2=n*this.m_axis.y-p*this.m_axis.x;this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2;this.m_motorMass>Number.MIN_VALUE&&(this.m_motorMass=1/this.m_motorMass);this.m_perp.SetV(d.MulMV(h.R,this.m_localYAxis1)); this.m_s1=(f+k)*this.m_perp.y-(g+m)*this.m_perp.x;this.m_s2=n*this.m_perp.y-p*this.m_perp.x;h=this.m_invMassA;k=this.m_invMassB;m=this.m_invIA;n=this.m_invIB;this.m_K.col1.x=h+k+m*this.m_s1*this.m_s1+n*this.m_s2*this.m_s2;this.m_K.col1.y=m*this.m_s1+n*this.m_s2;this.m_K.col1.z=m*this.m_s1*this.m_a1+n*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=m+n;this.m_K.col2.z=m*this.m_a1+n*this.m_a2;this.m_K.col3.x=this.m_K.col1.z;this.m_K.col3.y=this.m_K.col2.z;this.m_K.col3.z=h+k+m*this.m_a1* this.m_a1+n*this.m_a2*this.m_a2;this.m_enableLimit?(f=this.m_axis.x*f+this.m_axis.y*g,d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?this.m_limitState=r.e_equalLimits:f<=this.m_lowerTranslation?this.m_limitState!=r.e_atLowerLimit&&(this.m_limitState=r.e_atLowerLimit,this.m_impulse.z=0):f>=this.m_upperTranslation?this.m_limitState!=r.e_atUpperLimit&&(this.m_limitState=r.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=r.e_inactiveLimit,this.m_impulse.z=0)):this.m_limitState= r.e_inactiveLimit;!1==this.m_enableMotor&&(this.m_motorImpulse=0);b.warmStarting?(this.m_impulse.x*=b.dtRatio,this.m_impulse.y*=b.dtRatio,this.m_motorImpulse*=b.dtRatio,b=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x,f=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y,g=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,h=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+ this.m_impulse.z)*this.m_a2,c.m_linearVelocity.x-=this.m_invMassA*b,c.m_linearVelocity.y-=this.m_invMassA*f,c.m_angularVelocity-=this.m_invIA*g,e.m_linearVelocity.x+=this.m_invMassB*b,e.m_linearVelocity.y+=this.m_invMassB*f,e.m_angularVelocity+=this.m_invIB*h):(this.m_impulse.SetZero(),this.m_motorImpulse=0)};x.prototype.SolveVelocityConstraints=function(a){var b=this.m_bodyA,c=this.m_bodyB,g=b.m_linearVelocity,h=b.m_angularVelocity,k=c.m_linearVelocity,m=c.m_angularVelocity,n=0,p=0,s=0,v=0;this.m_enableMotor&& this.m_limitState!=r.e_equalLimits&&(v=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(k.x-g.x)+this.m_axis.y*(k.y-g.y)+this.m_a2*m-this.m_a1*h)),n=this.m_motorImpulse,a=a.dt*this.m_maxMotorForce,this.m_motorImpulse=d.Clamp(this.m_motorImpulse+v,-a,a),v=this.m_motorImpulse-n,n=v*this.m_axis.x,p=v*this.m_axis.y,s=v*this.m_a1,v*=this.m_a2,g.x-=this.m_invMassA*n,g.y-=this.m_invMassA*p,h-=this.m_invIA*s,k.x+=this.m_invMassB*n,k.y+=this.m_invMassB*p,m+=this.m_invIB*v);s=this.m_perp.x*(k.x-g.x)+this.m_perp.y* (k.y-g.y)+this.m_s2*m-this.m_s1*h;p=m-h;this.m_enableLimit&&this.m_limitState!=r.e_inactiveLimit?(a=this.m_axis.x*(k.x-g.x)+this.m_axis.y*(k.y-g.y)+this.m_a2*m-this.m_a1*h,n=this.m_impulse.Copy(),a=this.m_K.Solve33(new f,-s,-p,-a),this.m_impulse.Add(a),this.m_limitState==r.e_atLowerLimit?this.m_impulse.z=d.Max(this.m_impulse.z,0):this.m_limitState==r.e_atUpperLimit&&(this.m_impulse.z=d.Min(this.m_impulse.z,0)),s=-s-(this.m_impulse.z-n.z)*this.m_K.col3.x,p=-p-(this.m_impulse.z-n.z)*this.m_K.col3.y, p=this.m_K.Solve22(new e,s,p),p.x+=n.x,p.y+=n.y,this.m_impulse.x=p.x,this.m_impulse.y=p.y,a.x=this.m_impulse.x-n.x,a.y=this.m_impulse.y-n.y,a.z=this.m_impulse.z-n.z,n=a.x*this.m_perp.x+a.z*this.m_axis.x,p=a.x*this.m_perp.y+a.z*this.m_axis.y,s=a.x*this.m_s1+a.y+a.z*this.m_a1,v=a.x*this.m_s2+a.y+a.z*this.m_a2):(a=this.m_K.Solve22(new e,-s,-p),this.m_impulse.x+=a.x,this.m_impulse.y+=a.y,n=a.x*this.m_perp.x,p=a.x*this.m_perp.y,s=a.x*this.m_s1+a.y,v=a.x*this.m_s2+a.y);g.x-=this.m_invMassA*n;g.y-=this.m_invMassA* p;h-=this.m_invIA*s;k.x+=this.m_invMassB*n;k.y+=this.m_invMassB*p;m+=this.m_invIB*v;b.m_linearVelocity.SetV(g);b.m_angularVelocity=h;c.m_linearVelocity.SetV(k);c.m_angularVelocity=m};x.prototype.SolvePositionConstraints=function(c){c=this.m_bodyA;var g=this.m_bodyB,h=c.m_sweep.c,k=c.m_sweep.a,m=g.m_sweep.c,n=g.m_sweep.a,p,r=0,s=0,v=0,t=r=p=0,u=0,s=!1,x=0,w=b.FromAngle(k),y=b.FromAngle(n);p=w;var u=this.m_localAnchor1.x-this.m_localCenterA.x,A=this.m_localAnchor1.y-this.m_localCenterA.y,r=p.col1.x* u+p.col2.x*A,A=p.col1.y*u+p.col2.y*A,u=r;p=y;y=this.m_localAnchor2.x-this.m_localCenterB.x;v=this.m_localAnchor2.y-this.m_localCenterB.y;r=p.col1.x*y+p.col2.x*v;v=p.col1.y*y+p.col2.y*v;y=r;p=m.x+y-h.x-u;r=m.y+v-h.y-A;if(this.m_enableLimit){this.m_axis=d.MulMV(w,this.m_localXAxis1);this.m_a1=(p+u)*this.m_axis.y-(r+A)*this.m_axis.x;this.m_a2=y*this.m_axis.y-v*this.m_axis.x;var C=this.m_axis.x*p+this.m_axis.y*r;d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?(x=d.Clamp(C,-a.b2_maxLinearCorrection, a.b2_maxLinearCorrection),t=d.Abs(C),s=!0):C<=this.m_lowerTranslation?(x=d.Clamp(C-this.m_lowerTranslation+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),t=this.m_lowerTranslation-C,s=!0):C>=this.m_upperTranslation&&(x=d.Clamp(C-this.m_upperTranslation+a.b2_linearSlop,0,a.b2_maxLinearCorrection),t=C-this.m_upperTranslation,s=!0)}this.m_perp=d.MulMV(w,this.m_localYAxis1);this.m_s1=(p+u)*this.m_perp.y-(r+A)*this.m_perp.x;this.m_s2=y*this.m_perp.y-v*this.m_perp.x;w=new f;A=this.m_perp.x*p+this.m_perp.y* r;y=n-k-this.m_refAngle;t=d.Max(t,d.Abs(A));u=d.Abs(y);s?(s=this.m_invMassA,v=this.m_invMassB,p=this.m_invIA,r=this.m_invIB,this.m_K.col1.x=s+v+p*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2,this.m_K.col1.y=p*this.m_s1+r*this.m_s2,this.m_K.col1.z=p*this.m_s1*this.m_a1+r*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=p+r,this.m_K.col2.z=p*this.m_a1+r*this.m_a2,this.m_K.col3.x=this.m_K.col1.z,this.m_K.col3.y=this.m_K.col2.z,this.m_K.col3.z=s+v+p*this.m_a1*this.m_a1+r*this.m_a2*this.m_a2, this.m_K.Solve33(w,-A,-y,-x)):(s=this.m_invMassA,v=this.m_invMassB,p=this.m_invIA,r=this.m_invIB,x=p*this.m_s1+r*this.m_s2,C=p+r,this.m_K.col1.Set(s+v+p*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2,x,0),this.m_K.col2.Set(x,C,0),x=this.m_K.Solve22(new e,-A,-y),w.x=x.x,w.y=x.y,w.z=0);x=w.x*this.m_perp.x+w.z*this.m_axis.x;s=w.x*this.m_perp.y+w.z*this.m_axis.y;A=w.x*this.m_s1+w.y+w.z*this.m_a1;w=w.x*this.m_s2+w.y+w.z*this.m_a2;h.x-=this.m_invMassA*x;h.y-=this.m_invMassA*s;k-=this.m_invIA*A;m.x+=this.m_invMassB* x;m.y+=this.m_invMassB*s;n+=this.m_invIB*w;c.m_sweep.a=k;g.m_sweep.a=n;c.SynchronizeTransform();g.SynchronizeTransform();return t<=a.b2_linearSlop&&u<=a.b2_angularSlop};Box2D.inherit(y,Box2D.Dynamics.Joints.b2JointDef);y.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;y.b2PrismaticJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new e;this.localAnchorB=new e;this.localAxisA=new e};y.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this); this.type=r.e_prismaticJoint;this.localAxisA.Set(1,0);this.referenceAngle=0;this.enableLimit=!1;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=!1;this.motorSpeed=this.maxMotorForce=0};y.prototype.Initialize=function(a,b,c,d){this.bodyA=a;this.bodyB=b;this.localAnchorA=this.bodyA.GetLocalPoint(c);this.localAnchorB=this.bodyB.GetLocalPoint(c);this.localAxisA=this.bodyA.GetLocalVector(d);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(A,Box2D.Dynamics.Joints.b2Joint); A.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;A.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new e;this.m_groundAnchor2=new e;this.m_localAnchor1=new e;this.m_localAnchor2=new e;this.m_u1=new e;this.m_u2=new e};A.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};A.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};A.prototype.GetReactionForce=function(a){void 0=== a&&(a=0);return new e(a*this.m_impulse*this.m_u2.x,a*this.m_impulse*this.m_u2.y)};A.prototype.GetReactionTorque=function(a){return 0};A.prototype.GetGroundAnchorA=function(){var a=this.m_ground.m_xf.position.Copy();a.Add(this.m_groundAnchor1);return a};A.prototype.GetGroundAnchorB=function(){var a=this.m_ground.m_xf.position.Copy();a.Add(this.m_groundAnchor2);return a};A.prototype.GetLength1=function(){var a=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),b=a.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x), a=a.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y);return Math.sqrt(b*b+a*a)};A.prototype.GetLength2=function(){var a=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),b=a.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor2.x),a=a.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor2.y);return Math.sqrt(b*b+a*a)};A.prototype.GetRatio=function(){return this.m_ratio};A.prototype.b2PulleyJoint=function(a){this.__super.b2Joint.call(this,a);this.m_ground=this.m_bodyA.m_world.m_groundBody;this.m_groundAnchor1.x= a.groundAnchorA.x-this.m_ground.m_xf.position.x;this.m_groundAnchor1.y=a.groundAnchorA.y-this.m_ground.m_xf.position.y;this.m_groundAnchor2.x=a.groundAnchorB.x-this.m_ground.m_xf.position.x;this.m_groundAnchor2.y=a.groundAnchorB.y-this.m_ground.m_xf.position.y;this.m_localAnchor1.SetV(a.localAnchorA);this.m_localAnchor2.SetV(a.localAnchorB);this.m_ratio=a.ratio;this.m_constant=a.lengthA+this.m_ratio*a.lengthB;this.m_maxLength1=d.Min(a.maxLengthA,this.m_constant-this.m_ratio*A.b2_minPulleyLength); this.m_maxLength2=d.Min(a.maxLengthB,(this.m_constant-A.b2_minPulleyLength)/this.m_ratio);this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};A.prototype.InitVelocityConstraints=function(b){var c=this.m_bodyA,d=this.m_bodyB,e;e=c.m_xf.R;var f=this.m_localAnchor1.x-c.m_sweep.localCenter.x,g=this.m_localAnchor1.y-c.m_sweep.localCenter.y,h=e.col1.x*f+e.col2.x*g,g=e.col1.y*f+e.col2.y*g,f=h;e=d.m_xf.R;var k=this.m_localAnchor2.x-d.m_sweep.localCenter.x,m=this.m_localAnchor2.y-d.m_sweep.localCenter.y, h=e.col1.x*k+e.col2.x*m,m=e.col1.y*k+e.col2.y*m,k=h;e=d.m_sweep.c.x+k;var h=d.m_sweep.c.y+m,n=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,p=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(c.m_sweep.c.x+f-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x),c.m_sweep.c.y+g-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y));this.m_u2.Set(e-n,h-p);e=this.m_u1.Length();h=this.m_u2.Length();e>a.b2_linearSlop?this.m_u1.Multiply(1/e):this.m_u1.SetZero();h>a.b2_linearSlop? this.m_u2.Multiply(1/h):this.m_u2.SetZero();0a.b2_linearSlop?this.m_u1.Multiply(1/e):this.m_u1.SetZero(),v>a.b2_linearSlop?this.m_u2.Multiply(1/v):this.m_u2.SetZero(),e=this.m_constant-e-this.m_ratio*v,w=d.Max(w,-e),e=d.Clamp(e+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),u=-this.m_pulleyMass*e,e=-u*this.m_u1.x,v=-u*this.m_u1.y,t=-this.m_ratio*u*this.m_u2.x,u=-this.m_ratio*u*this.m_u2.y, b.m_sweep.c.x+=b.m_invMass*e,b.m_sweep.c.y+=b.m_invMass*v,b.m_sweep.a+=b.m_invI*(m*v-n*e),c.m_sweep.c.x+=c.m_invMass*t,c.m_sweep.c.y+=c.m_invMass*u,c.m_sweep.a+=c.m_invI*(p*u-s*t),b.SynchronizeTransform(),c.SynchronizeTransform());this.m_limitState1==r.e_atUpperLimit&&(e=b.m_xf.R,m=this.m_localAnchor1.x-b.m_sweep.localCenter.x,n=this.m_localAnchor1.y-b.m_sweep.localCenter.y,v=e.col1.x*m+e.col2.x*n,n=e.col1.y*m+e.col2.y*n,m=v,e=b.m_sweep.c.x+m,v=b.m_sweep.c.y+n,this.m_u1.Set(e-f,v-g),e=this.m_u1.Length(), e>a.b2_linearSlop?(this.m_u1.x*=1/e,this.m_u1.y*=1/e):this.m_u1.SetZero(),e=this.m_maxLength1-e,w=d.Max(w,-e),e=d.Clamp(e+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),u=-this.m_limitMass1*e,e=-u*this.m_u1.x,v=-u*this.m_u1.y,b.m_sweep.c.x+=b.m_invMass*e,b.m_sweep.c.y+=b.m_invMass*v,b.m_sweep.a+=b.m_invI*(m*v-n*e),b.SynchronizeTransform());this.m_limitState2==r.e_atUpperLimit&&(e=c.m_xf.R,p=this.m_localAnchor2.x-c.m_sweep.localCenter.x,s=this.m_localAnchor2.y-c.m_sweep.localCenter.y,v=e.col1.x*p+e.col2.x* s,s=e.col1.y*p+e.col2.y*s,p=v,t=c.m_sweep.c.x+p,u=c.m_sweep.c.y+s,this.m_u2.Set(t-h,u-k),v=this.m_u2.Length(),v>a.b2_linearSlop?(this.m_u2.x*=1/v,this.m_u2.y*=1/v):this.m_u2.SetZero(),e=this.m_maxLength2-v,w=d.Max(w,-e),e=d.Clamp(e+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),u=-this.m_limitMass2*e,t=-u*this.m_u2.x,u=-u*this.m_u2.y,c.m_sweep.c.x+=c.m_invMass*t,c.m_sweep.c.y+=c.m_invMass*u,c.m_sweep.a+=c.m_invI*(p*u-s*t),c.SynchronizeTransform());return w=this.m_upperAngle?(this.m_limitState!= r.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=r.e_atUpperLimit):(this.m_limitState=r.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=r.e_inactiveLimit;b.warmStarting?(this.m_impulse.x*=b.dtRatio,this.m_impulse.y*=b.dtRatio,this.m_motorImpulse*=b.dtRatio,b=this.m_impulse.x,v=this.m_impulse.y,c.m_linearVelocity.x-=f*b,c.m_linearVelocity.y-=f*v,c.m_angularVelocity-=p*(h*v-k*b+this.m_motorImpulse+this.m_impulse.z),e.m_linearVelocity.x+=g*b,e.m_linearVelocity.y+=g*v,e.m_angularVelocity+= s*(m*v-n*b+this.m_motorImpulse+this.m_impulse.z)):(this.m_impulse.SetZero(),this.m_motorImpulse=0)};I.prototype.SolveVelocityConstraints=function(a){var b=this.m_bodyA,c=this.m_bodyB,e=0,f=e=0,g=0,h=0,k=0,m=b.m_linearVelocity,n=b.m_angularVelocity,p=c.m_linearVelocity,s=c.m_angularVelocity,v=b.m_invMass,u=c.m_invMass,t=b.m_invI,w=c.m_invI;this.m_enableMotor&&this.m_limitState!=r.e_equalLimits&&(f=this.m_motorMass*-(s-n-this.m_motorSpeed),g=this.m_motorImpulse,h=a.dt*this.m_maxMotorTorque,this.m_motorImpulse= d.Clamp(this.m_motorImpulse+f,-h,h),f=this.m_motorImpulse-g,n-=t*f,s+=w*f);if(this.m_enableLimit&&this.m_limitState!=r.e_inactiveLimit){a=b.m_xf.R;f=this.m_localAnchor1.x-b.m_sweep.localCenter.x;g=this.m_localAnchor1.y-b.m_sweep.localCenter.y;e=a.col1.x*f+a.col2.x*g;g=a.col1.y*f+a.col2.y*g;f=e;a=c.m_xf.R;h=this.m_localAnchor2.x-c.m_sweep.localCenter.x;k=this.m_localAnchor2.y-c.m_sweep.localCenter.y;e=a.col1.x*h+a.col2.x*k;k=a.col1.y*h+a.col2.y*k;h=e;a=p.x+-s*k-m.x- -n*g;var x=p.y+s*h-m.y-n*f;this.m_mass.Solve33(this.impulse3, -a,-x,-(s-n));this.m_limitState==r.e_equalLimits?this.m_impulse.Add(this.impulse3):this.m_limitState==r.e_atLowerLimit?(e=this.m_impulse.z+this.impulse3.z,0>e&&(this.m_mass.Solve22(this.reduced,-a,-x),this.impulse3.x=this.reduced.x,this.impulse3.y=this.reduced.y,this.impulse3.z=-this.m_impulse.z,this.m_impulse.x+=this.reduced.x,this.m_impulse.y+=this.reduced.y,this.m_impulse.z=0)):this.m_limitState==r.e_atUpperLimit&&(e=this.m_impulse.z+this.impulse3.z,0x*x&&(v=1/(h+u),k=v*-k,m=v*-m,b.m_sweep.c.x-=0.5*h*k,b.m_sweep.c.y-=0.5*h*m,f.m_sweep.c.x+=0.5*u*k,f.m_sweep.c.y+=0.5*u*m,k=f.m_sweep.c.x+p-b.m_sweep.c.x- n,m=f.m_sweep.c.y+s-b.m_sweep.c.y-c);this.K1.col1.x=h+u;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=h+u;this.K2.col1.x=t*c*c;this.K2.col2.x=-t*n*c;this.K2.col1.y=-t*n*c;this.K2.col2.y=t*n*n;this.K3.col1.x=w*s*s;this.K3.col2.x=-w*p*s;this.K3.col1.y=-w*p*s;this.K3.col2.y=w*p*p;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Solve(I.tImpulse,-k,-m);k=I.tImpulse.x;m=I.tImpulse.y;b.m_sweep.c.x-=b.m_invMass*k;b.m_sweep.c.y-=b.m_invMass*m;b.m_sweep.a-=b.m_invI*(n*m-c*k);f.m_sweep.c.x+= f.m_invMass*k;f.m_sweep.c.y+=f.m_invMass*m;f.m_sweep.a+=f.m_invI*(p*m-s*k);b.SynchronizeTransform();f.SynchronizeTransform();return e<=a.b2_linearSlop&&g<=a.b2_angularSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new e});Box2D.inherit(D,Box2D.Dynamics.Joints.b2JointDef);D.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;D.b2RevoluteJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new e;this.localAnchorB= new e};D.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this);this.type=r.e_revoluteJoint;this.localAnchorA.Set(0,0);this.localAnchorB.Set(0,0);this.motorSpeed=this.maxMotorTorque=this.upperAngle=this.lowerAngle=this.referenceAngle=0;this.enableMotor=this.enableLimit=!1};D.prototype.Initialize=function(a,b,c){this.bodyA=a;this.bodyB=b;this.localAnchorA=this.bodyA.GetLocalPoint(c);this.localAnchorB=this.bodyB.GetLocalPoint(c);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}; Box2D.inherit(M,Box2D.Dynamics.Joints.b2Joint);M.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;M.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new e;this.m_localAnchorB=new e;this.m_impulse=new f;this.m_mass=new c};M.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};M.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};M.prototype.GetReactionForce=function(a){void 0=== a&&(a=0);return new e(a*this.m_impulse.x,a*this.m_impulse.y)};M.prototype.GetReactionTorque=function(a){void 0===a&&(a=0);return a*this.m_impulse.z};M.prototype.b2WeldJoint=function(a){this.__super.b2Joint.call(this,a);this.m_localAnchorA.SetV(a.localAnchorA);this.m_localAnchorB.SetV(a.localAnchorB);this.m_referenceAngle=a.referenceAngle;this.m_impulse.SetZero();this.m_mass=new c};M.prototype.InitVelocityConstraints=function(a){var b,c=0,d=this.m_bodyA,e=this.m_bodyB;b=d.m_xf.R;var f=this.m_localAnchorA.x- d.m_sweep.localCenter.x,g=this.m_localAnchorA.y-d.m_sweep.localCenter.y,c=b.col1.x*f+b.col2.x*g,g=b.col1.y*f+b.col2.y*g,f=c;b=e.m_xf.R;var h=this.m_localAnchorB.x-e.m_sweep.localCenter.x,k=this.m_localAnchorB.y-e.m_sweep.localCenter.y,c=b.col1.x*h+b.col2.x*k,k=b.col1.y*h+b.col2.y*k,h=c;b=d.m_invMass;var c=e.m_invMass,m=d.m_invI,n=e.m_invI;this.m_mass.col1.x=b+c+g*g*m+k*k*n;this.m_mass.col2.x=-g*f*m-k*h*n;this.m_mass.col3.x=-g*m-k*n;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=b+c+f*f* m+h*h*n;this.m_mass.col3.y=f*m+h*n;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=m+n;a.warmStarting?(this.m_impulse.x*=a.dtRatio,this.m_impulse.y*=a.dtRatio,this.m_impulse.z*=a.dtRatio,d.m_linearVelocity.x-=b*this.m_impulse.x,d.m_linearVelocity.y-=b*this.m_impulse.y,d.m_angularVelocity-=m*(f*this.m_impulse.y-g*this.m_impulse.x+this.m_impulse.z),e.m_linearVelocity.x+=c*this.m_impulse.x,e.m_linearVelocity.y+=c*this.m_impulse.y,e.m_angularVelocity+=n* (h*this.m_impulse.y-k*this.m_impulse.x+this.m_impulse.z)):this.m_impulse.SetZero()};M.prototype.SolveVelocityConstraints=function(a){var b,c=0;a=this.m_bodyA;var d=this.m_bodyB,e=a.m_linearVelocity,g=a.m_angularVelocity,h=d.m_linearVelocity,k=d.m_angularVelocity,m=a.m_invMass,n=d.m_invMass,p=a.m_invI,r=d.m_invI;b=a.m_xf.R;var s=this.m_localAnchorA.x-a.m_sweep.localCenter.x,v=this.m_localAnchorA.y-a.m_sweep.localCenter.y,c=b.col1.x*s+b.col2.x*v,v=b.col1.y*s+b.col2.y*v,s=c;b=d.m_xf.R;var u=this.m_localAnchorB.x- d.m_sweep.localCenter.x,t=this.m_localAnchorB.y-d.m_sweep.localCenter.y,c=b.col1.x*u+b.col2.x*t,t=b.col1.y*u+b.col2.y*t,u=c;b=h.x-k*t-e.x+g*v;var c=h.y+k*u-e.y-g*s,w=k-g,x=new f;this.m_mass.Solve33(x,-b,-c,-w);this.m_impulse.Add(x);e.x-=m*x.x;e.y-=m*x.y;g-=p*(s*x.y-v*x.x+x.z);h.x+=n*x.x;h.y+=n*x.y;k+=r*(u*x.y-t*x.x+x.z);a.m_angularVelocity=g;d.m_angularVelocity=k};M.prototype.SolvePositionConstraints=function(b){var c,e=0;b=this.m_bodyA;var g=this.m_bodyB;c=b.m_xf.R;var h=this.m_localAnchorA.x-b.m_sweep.localCenter.x, k=this.m_localAnchorA.y-b.m_sweep.localCenter.y,e=c.col1.x*h+c.col2.x*k,k=c.col1.y*h+c.col2.y*k,h=e;c=g.m_xf.R;var m=this.m_localAnchorB.x-g.m_sweep.localCenter.x,n=this.m_localAnchorB.y-g.m_sweep.localCenter.y,e=c.col1.x*m+c.col2.x*n,n=c.col1.y*m+c.col2.y*n,m=e;c=b.m_invMass;var e=g.m_invMass,p=b.m_invI,r=g.m_invI,s=g.m_sweep.c.x+m-b.m_sweep.c.x-h,v=g.m_sweep.c.y+n-b.m_sweep.c.y-k,u=g.m_sweep.a-b.m_sweep.a-this.m_referenceAngle,t=10*a.b2_linearSlop,w=Math.sqrt(s*s+v*v),x=d.Abs(u);w>t&&(p*=1,r*=1); this.m_mass.col1.x=c+e+k*k*p+n*n*r;this.m_mass.col2.x=-k*h*p-n*m*r;this.m_mass.col3.x=-k*p-n*r;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=c+e+h*h*p+m*m*r;this.m_mass.col3.y=h*p+m*r;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=p+r;t=new f;this.m_mass.Solve33(t,-s,-v,-u);b.m_sweep.c.x-=c*t.x;b.m_sweep.c.y-=c*t.y;b.m_sweep.a-=p*(h*t.y-k*t.x+t.z);g.m_sweep.c.x+=e*t.x;g.m_sweep.c.y+=e*t.y;g.m_sweep.a+=r*(m*t.y-n*t.x+t.z);b.SynchronizeTransform(); g.SynchronizeTransform();return w<=a.b2_linearSlop&&x<=a.b2_angularSlop};Box2D.inherit(J,Box2D.Dynamics.Joints.b2JointDef);J.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;J.b2WeldJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new e;this.localAnchorB=new e};J.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this);this.type=r.e_weldJoint;this.referenceAngle=0};J.prototype.Initialize=function(a,b,c){this.bodyA=a; this.bodyB=b;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(c));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(c));this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}})(); (function(){var a=Box2D.Dynamics.b2DebugDraw;a.b2DebugDraw=function(){this.m_xformScale=this.m_fillAlpha=this.m_alpha=this.m_lineThickness=this.m_drawScale=1;var a=this;this.m_sprite={graphics:{clear:function(){a.m_ctx.clearRect(0,0,a.m_ctx.canvas.width,a.m_ctx.canvas.height)}}}};a.prototype._color=function(a,c){return"rgba("+((a&16711680)>>16)+","+((a&65280)>>8)+","+(a&255)+","+c+")"};a.prototype.b2DebugDraw=function(){this.m_drawFlags=0};a.prototype.SetFlags=function(a){void 0===a&&(a=0);this.m_drawFlags= a};a.prototype.GetFlags=function(){return this.m_drawFlags};a.prototype.AppendFlags=function(a){void 0===a&&(a=0);this.m_drawFlags|=a};a.prototype.ClearFlags=function(a){void 0===a&&(a=0);this.m_drawFlags&=~a};a.prototype.SetSprite=function(a){this.m_ctx=a};a.prototype.GetSprite=function(){return this.m_ctx};a.prototype.SetDrawScale=function(a){void 0===a&&(a=0);this.m_drawScale=a};a.prototype.GetDrawScale=function(){return this.m_drawScale};a.prototype.SetLineThickness=function(a){void 0===a&&(a= 0);this.m_lineThickness=a;this.m_ctx.strokeWidth=a};a.prototype.GetLineThickness=function(){return this.m_lineThickness};a.prototype.SetAlpha=function(a){void 0===a&&(a=0);this.m_alpha=a};a.prototype.GetAlpha=function(){return this.m_alpha};a.prototype.SetFillAlpha=function(a){void 0===a&&(a=0);this.m_fillAlpha=a};a.prototype.GetFillAlpha=function(){return this.m_fillAlpha};a.prototype.SetXFormScale=function(a){void 0===a&&(a=0);this.m_xformScale=a};a.prototype.GetXFormScale=function(){return this.m_xformScale}; a.prototype.DrawPolygon=function(a,c,d){if(c){var e=this.m_ctx,f=this.m_drawScale;e.beginPath();e.strokeStyle=this._color(d.color,this.m_alpha);e.moveTo(a[0].x*f,a[0].y*f);for(d=1;db?a:b},f,g;"object"===typeof window&&-1>1,k=1;kf||m==f&&n>g)f=m,g=n,c=k}return[b,c]},n=function(a,b,c){var d=a[2*b];a[2*b]=a[2*c];a[2*c]=d;d=a[2* b+1];a[2*b+1]=a[2*c+1];a[2*c+1]=d},p=function(a,b,c,d,e,f){if(0===c)return 0;var g=0,h=b;e=y(e,d);f*=z(e);var k=b;for(c=b+c-1;k<=c;){var m=new s(a[2*k],a[2*k+1]),m=I(e,y(m,d));m>f?(m>g&&(g=m,h=k),k++):(n(a,k,c),c--)}h!=b&&n(a,b,h);return k-b},t=function(a,b,c,d,e,f,g,h){if(0>d)return 0;if(0==d)return b[2*h]=f.x,b[2*h+1]=f.y,1;var k=p(b,c,d,e,f,a),m=new s(b[2*c],b[2*c+1]);e=t(a,b,c+1,k-1,e,m,f,h);m=h+e++;b[2*m]=f.x;b[2*m+1]=f.y;d=p(b,c+k,d-k,f,g,a);m=new s(b[2*(c+k)],b[2*(c+k)+1]);return e+t(a,b,c+ k+1,d-1,f,m,g,h+e)};a.convexHull=function(a,b,d){if(b)for(var e=0;e>1)-2,e,f,e,1)+1;b.length=2*a;c(za(b),"Internal error: cpConvexHull() and cpPolyValidate() did not agree.Please report this error with as much info as you can.");return b};var r=function(a,b,c){return f(g(a,b),c)},v=function(a){return g(0,f(a,1))},s=a.Vect=function(a, b){this.x=a;this.y=b};a.v=function(a,b){return new s(a,b)};var u=a.vzero=new s(0,0),w=a.v.dot=function(a,b){return a.x*b.x+a.y*b.y},z=a.v.len=function(a){return Math.sqrt(w(a,a))},F=a.v.len2=function(a,b){return Math.sqrt(a*a+b*b)};a.v.eql=function(a,b){return a.x===b.x&&a.y===b.y};var x=a.v.add=function(a,b){return new s(a.x+b.x,a.y+b.y)};s.prototype.add=function(a){this.x+=a.x;this.y+=a.y;return this};var y=a.v.sub=function(a,b){return new s(a.x-b.x,a.y-b.y)};s.prototype.sub=function(a){this.x-= a.x;this.y-=a.y;return this};var A=a.v.neg=function(a){return new s(-a.x,-a.y)};s.prototype.neg=function(){this.x=-this.x;this.y=-this.y;return this};var C=a.v.mult=function(a,b){return new s(a.x*b,a.y*b)};s.prototype.mult=function(a){this.x*=a;this.y*=a;return this};var I=a.v.cross=function(a,b){return a.x*b.y-a.y*b.x},D=a.v.perp=function(a){return new s(-a.y,a.x)};a.v.pvrperp=function(a){return new s(a.y,-a.x)};var M=a.v.project=function(a,b){return C(b,w(a,b)/G(b))};s.prototype.project=function(a){this.mult(w(this, a)/G(a));return this};var J=a.v.rotate=function(a,b){return new s(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x)};s.prototype.rotate=function(a){this.x=this.x*a.x-this.y*a.y;this.y=this.x*a.y+this.y*a.x;return this};var E=a.v.unrotate=function(a,b){return new s(a.x*b.x+a.y*b.y,a.y*b.x-a.x*b.y)},G=a.v.lengthsq=function(a){return w(a,a)},L=a.v.lengthsq2=function(a,b){return a*a+b*b},P=a.v.lerp=function(a,b,c){return x(C(a,1-c),C(b,c))},K=a.v.normalize=function(a){return C(a,1/z(a))},U=a.v.normalize_safe=function(a){return 0=== a.x&&0===a.y?u:K(a)},Q=a.v.clamp=function(a,b){return w(a,a)>b*b?C(K(a),b):a};a.v.lerpconst=function(a,b,c){return x(a,Q(y(b,a),c))};var B=a.v.dist=function(a,b){return z(y(a,b))},H=a.v.distsq=function(a,b){return G(y(a,b))};a.v.near=function(a,b,c){return H(a,b)a.d)return a};Y.prototype.getBB=function(){return new T(this.bb_l,this.bb_b,this.bb_r,this.bb_t)};var qa=function(a,b,c){this.shape=a;this.p=b;this.d=c},ka=function(a,b,c){this.shape=a;this.t=b;this.n=c};ka.prototype.hitPoint=function(a,b){return P(a,b,this.t)};ka.prototype.hitDist=function(a,b){return B(a,b)*this.t};var la=a.CircleShape=function(a,b,c){this.c=this.tc=c;this.r=b;this.type="circle";Y.call(this,a)};la.prototype= Object.create(Y.prototype);la.prototype.cacheData=function(a,b){var c=this.tc=J(this.c,b).add(a),d=this.r;this.bb_l=c.x-d;this.bb_b=c.y-d;this.bb_r=c.x+d;this.bb_t=c.y+d};la.prototype.nearestPointQuery=function(a){var b=a.x-this.tc.x,c=a.y-this.tc.y;a=F(b,c);var d=this.r,b=new s(this.tc.x+b*d/a,this.tc.y+c*d/a);return new qa(this,b,a-d)};var ya=function(a,b,c,d,e,f){d=y(d,b);e=y(e,b);b=w(d,d)-2*w(d,e)+w(e,e);f=-2*w(d,d)+2*w(d,e);c=w(d,d)-c*c;c=f*f-4*b*c;if(0<=c&&(c=(-f-Math.sqrt(c))/(2*b),0<=c&&1>= c))return new ka(a,c,K(P(d,e,c)))};la.prototype.segmentQuery=function(a,b){return ya(this,this.tc,this.r,a,b)};var ha=a.SegmentShape=function(a,b,c,d){this.a=b;this.b=c;this.n=D(K(y(c,b)));this.ta=this.tb=this.tn=null;this.r=d;this.b_tangent=this.a_tangent=u;this.type="segment";Y.call(this,a)};ha.prototype=Object.create(Y.prototype);ha.prototype.cacheData=function(a,b){this.ta=x(a,J(this.a,b));this.tb=x(a,J(this.b,b));this.tn=J(this.n,b);var c,d,e,f;this.ta.x=I(g,h)*I(g,k)){if(e=d+(0d*c)return new ka(this,d/(d-c),f)}else if(0!==e)return f=ya(this,this.ta,this.r,a,b),c=ya(this,this.tb,this.r,a,b),f?c&&c.t>1;this.verts=Array(d);this.tVerts=Array(d);this.planes=Array(e);this.tPlanes=Array(e);for(e=0;e>1]=new Aa(h,h.x*f+h.y*g);this.tPlanes[e>>1]=new Aa(new s(0,0),0)}};a.BoxShape=function(a,b,c){b/=2;c/=2;return kb(a,new T(-b,-c,b,c))};var kb=a.BoxShape2=function(a,b){return new Z(a,[b.l,b.b,b.l,b.t,b.r,b.t,b.r,b.b],u)};Z.prototype.transformVerts=function(a, b){for(var c=this.verts,d=this.tVerts,e=Infinity,h=-Infinity,k=Infinity,m=-Infinity,n=0;nk)){var m=w(b,h),k=(c[g].d-k)/(m-k);if(!(0>k||1< k)){var m=P(a,b,k),m=-I(h,m),n=-(h.x*d[(2*g+3)%f]-h.y*d[(2*g+2)%f]);if(-(h.x*d[2*g+1]-h.y*d[2*g])<=m&&m<=n)return new ka(this,k,h)}}}};Z.prototype.valueOnAxis=function(a,b){for(var c=this.tVerts,d=a.x*c[0]+a.y*c[1],e=2;ew(f,c))&&0e*e?e/Math.sqrt(f):1;this.vx=d*e;this.vy=a*e;d=this.w_limit;this.w=r(this.w*b+this.t*this.i_inv*c,-d,d);this.sanityCheck()};R.prototype.position_func=function(a){this.p.x+=(this.vx+this.v_biasx)* a;this.p.y+=(this.vy+this.v_biasy)*a;this.setAngleInternal(this.a+(this.w+this.w_bias)*a);this.w_bias=this.v_biasx=this.v_biasy=0;this.sanityCheck()};R.prototype.resetForces=function(){this.activate();this.f=new s(0,0);this.t=0};R.prototype.applyForce=function(a,b){this.activate();this.f=x(this.f,a);this.t+=I(b,a)};R.prototype.applyImpulse=function(a,b){this.activate();nb(this,a.x,a.y,b)};R.prototype.getVelAtPoint=function(a){return x(new s(this.vx,this.vy),C(D(a),this.w))};R.prototype.getVelAtWorldPoint= function(a){return this.getVelAtPoint(y(a,this.p))};R.prototype.getVelAtLocalPoint=function(a){return this.getVelAtPoint(J(a,this.rot))};R.prototype.eachShape=function(a){for(var b=0,c=this.shapeList.length;b=d)?g(d,0):Infinity},ma=function(a,b,c,d,e){if(a.isLeaf)return e(a.obj);var g=Sa(a.A,b,c),h=Sa(a.B,b,c);g=a.bb_r&&this.bb_b<=a.bb_b&&this.bb_t>=a.bb_t};da.prototype.update=function(a){var b=a.root;return this.containsObj(this.obj)?!1:(a.getBB(this.obj,this),b=Wa(b,this,a),a.root=na(b,this,a),this.clearPairs(a),this.stamp=a.getStamp(),!0)};da.prototype.addPairs=function(a){var b=a.dynamicIndex;b?(a=b.root)&&a.markLeafQuery(this,!0,b,null):this.markSubtree(a,a.staticIndex.root,null)};W.prototype.insert=function(a,b){var c=new da(this,a);this.leaves[b]=c; this.root=na(this.root,c,this);this.count++;c.stamp=this.getStamp();c.addPairs(this);this.incrementStamp()};W.prototype.remove=function(a,b){var c=this.leaves[b];delete this.leaves[b];this.root=Wa(this.root,c,this);this.count--;c.clearPairs(this);c.recycle(this)};W.prototype.contains=function(a,b){return null!=this.leaves[b]};var mb=function(a,b){};W.prototype.reindexQuery=function(a){if(this.root){var b,c=this.leaves;for(b in c)c[b].update(this);c=(b=this.staticIndex)&&b.root;this.root.markSubtree(this, c,a);b&&!c&&this.collideStatic(this,b,a);this.incrementStamp()}};W.prototype.reindex=function(){this.reindexQuery(mb)};W.prototype.reindexObject=function(a,b){var c=this.leaves[b];c&&(c.update(this)&&c.addPairs(this),this.incrementStamp())};W.prototype.pointQuery=function(a,b){this.query(new T(a.x,a.y,a.x,a.y),b)};W.prototype.segmentQuery=function(a,b,c,d){this.root&&ma(this.root,a,b,c,d)};W.prototype.query=function(a,b){this.root&&Da(this.root,a,b)};W.prototype.count=function(){return this.count}; W.prototype.each=function(a){for(var b in this.leaves)a(this.leaves[b].obj)};var Ya=function(a,b,c,d,e){return(g(a.bb_r,d)-f(a.bb_l,b))*(g(a.bb_t,e)-f(a.bb_b,c))},Fa=function(a,b,c,d){if(1==d)return b[c];if(2==d)return a.makeNode(b[c],b[c+1]);for(var e=b[c],h=e.bb_l,k=e.bb_b,m=e.bb_r,n=e.bb_t,p=c+d,r=c+1;rn-k,s=Array(2*d);if(e)for(r=c;r=b&&(Ga(a.A, b+1),Ga(a.B,b+1));for(var c="",d=0;d=d*d))return e=Math.sqrt(e),new ea(x(a,C(b,0.5+(c-0.5*d)/(e?e:Infinity))),e?C(b,1/e):new s(1, 0),e-d,0)},Ja=0,Ka=function(a,b){var c=0,d=a.valueOnAxis(b[0].n,b[0].d);if(0d&&(d=f,c=e)}Ja=d;return c},La=function(a,b,c,d){for(var e=[],f=a.tVerts,g=0;g>1)))}f=b.tVerts;for(g=0;g>1)));if(!e.length){e=[];f=a.tVerts; for(g=0;g=v&&v>=g&&a.push(new ea(new s(p,r),k,d,h(c.hashid,n)))}}};la.prototype.collisionCode=0;ha.prototype.collisionCode=1;Z.prototype.collisionCode=2;la.prototype.collisionTable=[function(a,b){var c=fa(a.tc,b.tc,a.r,b.r);return c?[c]:$},function(a,b){var c=b.ta,d=a.tc,e=y(b.tb,c),f=v(w(e,y(d,c))/G(e)),c=x(c,C(e,f));return(d=fa(d,c,a.r,b.r))?(c=d.n,0===f&&0>w(c,b.a_tangent)||1===f&&0>w(c,b.b_tangent)?$:[d]):$},function(a,b){for(var c=b.tPlanes,d=0,e=w(c[0].n,a.tc)-c[0].d-a.r,f=0;fe&&(e=g,d=f)}var c=c[d].n,h=b.tVerts,k=h.length,m=d<<1,d=h[m],f=h[m+1],g=h[(m+2)%k],h=h[(m+3)%k],k=c.x*f-c.y*d,m=c.x*h-c.y*g,n=I(c,a.tc);if(nm&&(m=p,k=n)}d=A(d[k].n);n=x(a.ta,C(d,a.r));p=x(a.tb,C(d,a.r));b.containsVert(n.x,n.y)&&c.push(new ea(n,d,m,h(a.hashid,0)));b.containsVert(p.x,p.y)&&c.push(new ea(p,d,m,h(a.hashid,1)));if(g>=m||f>=m)g>f?Na(c,a,b,g,1):Na(c,a,b,f,-1);if(0===c.length){g=2*k;f=b.tVerts;m=new s(f[g],f[g+1]);if((k=fa(a.ta,m,a.r,0,c))||(k=fa(a.tb,m,a.r,0,c)))return[k];e*=2;e=new s(f[(g+ 2)%e],f[(g+3)%e]);if((k=fa(a.ta,e,a.r,0,c))||(k=fa(a.tb,e,a.r,0,c)))return[k]}return c}];Z.prototype.collisionTable=[null,null,function(a,b){var c=Ka(b,a.tPlanes);if(-1==c)return $;var d=Ja,e=Ka(a,b.tPlanes);if(-1==e)return $;var f=Ja;return d>f?La(a,b,a.tPlanes[c].n,d):La(a,b,A(b.tPlanes[e].n),f)}];var ua=a.collideShapes=function(a,c){b(a.collisionCode<=c.collisionCode,"Collided shapes must be sorted by type");return a.collisionTable[c.collisionCode](a,c)},Oa=new ja,O=a.Space=function(){this.curr_dt= this.stamp=0;this.bodies=[];this.rousedBodies=[];this.sleepingComponents=[];this.staticShapes=new W(null);this.activeShapes=new W(this.staticShapes);this.arbiters=[];this.contactBuffersHead=null;this.cachedArbiters={};this.constraints=[];this.locked=0;this.collisionHandlers={};this.defaultHandler=Oa;this.postStepCallbacks=[];this.iterations=10;this.gravity=u;this.damping=1;this.idleSpeedThreshold=0;this.sleepTimeThreshold=Infinity;this.collisionSlop=0.1;this.collisionBias=Math.pow(0.9,60);this.collisionPersistence= 3;this.enableContactGraph=!1;this.staticBody=new R(Infinity,Infinity);this.staticBody.nodeIdleTime=Infinity;this.collideShapes=this.makeCollideShapes()};O.prototype.getCurrentTimeStep=function(){return this.curr_dt};O.prototype.setIterations=function(a){this.iterations=a};O.prototype.isLocked=function(){return this.locked};var ca=function(a){b(!a.locked,"This addition/removal cannot be done safely during a call to cpSpaceStep() or during a query. Put these calls into a post-step callback.")};O.prototype.addCollisionHandler= function(a,b,c,d,e,f){ca(this);this.removeCollisionHandler(a,b);var g=new ja;g.a=a;g.b=b;c&&(g.begin=c);d&&(g.preSolve=d);e&&(g.postSolve=e);f&&(g.separate=f);this.collisionHandlers[h(a,b)]=g};O.prototype.removeCollisionHandler=function(a,b){ca(this);delete this.collisionHandlers[h(a,b)]};O.prototype.setDefaultCollisionHandler=function(a,b,c,d){ca(this);var e=new ja;a&&(e.begin=a);b&&(e.preSolve=b);c&&(e.postSolve=c);d&&(e.separate=d);this.defaultHandler=e};O.prototype.lookupHandler=function(a,b){return this.collisionHandlers[h(a, b)]||this.defaultHandler};O.prototype.addShape=function(a){var c=a.body;if(c.isStatic())return this.addStaticShape(a);b(!a.space,"This shape is already added to a space and cannot be added to another.");ca(this);c.activate();c.addShape(a);a.update(c.p,c.rot);this.activeShapes.insert(a,a.hashid);a.space=this;return a};O.prototype.addStaticShape=function(a){b(!a.space,"This shape is already added to a space and cannot be added to another.");ca(this);var c=a.body;c.addShape(a);a.update(c.p,c.rot);this.staticShapes.insert(a, a.hashid);a.space=this;return a};O.prototype.addBody=function(a){b(!a.isStatic(),"Static bodies cannot be added to a space as they are not meant to be simulated.");b(!a.space,"This body is already added to a space and cannot be added to another.");ca(this);this.bodies.push(a);a.space=this;return a};O.prototype.addConstraint=function(a){b(!a.space,"This shape is already added to a space and cannot be added to another.");ca(this);var c=a.a,d=a.b;c.activate();d.activate();this.constraints.push(a);a.next_a= c.constraintList;c.constraintList=a;a.next_b=d.constraintList;d.constraintList=a;a.space=this;return a};O.prototype.filterArbiters=function(a,b){for(var c in this.cachedArbiters){var d=this.cachedArbiters[c];if(a===d.body_a&&(b===d.a||null===b)||a===d.body_b&&(b===d.b||null===b))b&&"cached"!==d.state&&d.callSeparate(this),d.unthread(),k(this.arbiters,d),delete this.cachedArbiters[c]}};O.prototype.removeShape=function(a){var c=a.body;c.isStatic()?this.removeStaticShape(a):(b(this.containsShape(a), "Cannot remove a shape that was not added to the space. (Removed twice maybe?)"),ca(this),c.activate(),c.removeShape(a),this.filterArbiters(c,a),this.activeShapes.remove(a,a.hashid),a.space=null)};O.prototype.removeStaticShape=function(a){b(this.containsShape(a),"Cannot remove a static or sleeping shape that was not added to the space. (Removed twice maybe?)");ca(this);var c=a.body;c.isStatic()&&c.activateStatic(a);c.removeShape(a);this.filterArbiters(c,a);this.staticShapes.remove(a,a.hashid);a.space= null};O.prototype.removeBody=function(a){b(this.containsBody(a),"Cannot remove a body that was not added to the space. (Removed twice maybe?)");ca(this);a.activate();k(this.bodies,a);a.space=null};O.prototype.removeConstraint=function(a){b(this.containsConstraint(a),"Cannot remove a constraint that was not added to the space. (Removed twice maybe?)");ca(this);a.a.activate();a.b.activate();k(this.constraints,a);a.a.removeConstraint(a);a.b.removeConstraint(a);a.space=null};O.prototype.containsShape= function(a){return a.space===this};O.prototype.containsBody=function(a){return a.space==this};O.prototype.containsConstraint=function(a){return a.space==this};O.prototype.uncacheArbiter=function(a){delete this.cachedArbiters[h(a.a.hashid,a.b.hashid)];k(this.arbiters,a)};O.prototype.eachBody=function(a){this.lock();for(var b=this.bodies,c=0;ch?0:f.nodeIdleTime+a}g=this.arbiters;e=0;for(h=g.length;ec.collisionCode){var f=b;b=c;c=f}f=ua(b,c);if(0!==f.length){var g=h(b.hashid,c.hashid),k=a.cachedArbiters[g];k||(k=a.cachedArbiters[g]=new X(b,c));k.update(f,d,b,c);"first coll"!=k.state||d.begin(k,a)||k.ignore();"ignore"!==k.state&&d.preSolve(k,a)&&!e?a.arbiters.push(k):(k.contacts=null,"ignore"!== k.state&&(k.state="normal"));k.stamp=a.stamp}}}}};O.prototype.arbiterSetFilter=function(a){var b=this.stamp-a.stamp,c=a.body_a,d=a.body_b;if((c.isStatic()||c.isSleeping())&&(d.isStatic()||d.isSleeping()))return!0;1<=b&&"cached"!=a.state&&(a.callSeparate(this),a.state="cached");return b>=this.collisionPersistence?(a.contacts=null,!1):!0};var bb=function(a){var b=a.body;a.update(b.p,b.rot)};O.prototype.step=function(a){if(0!==a){b(0===u.x&&0===u.y,"vzero is invalid");this.stamp++;var c=this.curr_dt; this.curr_dt=a;var d,e,f=this.bodies,g=this.constraints,h=this.arbiters;for(d=0;dthis.max?(f=e-this.max,this.n=U(d)):e=I(e,f)?(this.clamp=-1,this.r1=y(e,b.p)):(this.clamp=0,this.r1=y(x(C(D(f),-h),C(f,g)),b.p));rb(b,c,this.r1,this.r2,this.k1,this.k2);this.jMaxLen=this.maxForce*a;b=y(x(c.p,this.r2),x(b.p,this.r1));this.bias=Q(C(b,-(1-Math.pow(this.errorBias,a))/a),this.maxBias)};pa.prototype.applyCachedImpulse=function(a){ga(this.a,this.b,this.r1,this.r2,this.jAcc.x*a,this.jAcc.y* a)};pa.prototype.grooveConstrain=function(a){var b=this.grv_tn;a=0this.max?e=this.max-d:dthis.bias?r(d+c,0,this.jMax):r(d+c,-this.jMax,0);c=this.jAcc-d;a.w-=c*a.i_inv;b.w+=c*b.i_inv}};hb.prototype.getImpulse=function(){return Math.abs(joint.jAcc)};var ib=a.RatchetJoint=function(a,b,c,d){V.call(this,a,b);this.angle=0;this.phase=c;this.ratchet=d;this.angle=(b?b.a:0)-(a?a.a:0);this.iSum=this.bias=this.jAcc=this.jMax=0};ib.prototype=Object.create(V.prototype);ib.prototype.preStep=function(a){var b=this.a,c=this.b,d=this.phase,e=this.ratchet,f=c.a-b.a,g=this.angle-f,h=0;0=this._reconnectionAttempts)n("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var c=this.backoff.duration();n("will wait %dms before reconnect attempt",c);this.reconnecting=!0;var d=setTimeout(function(){b.skipReconnect||(n("attempting reconnect"),b.emitAll("reconnect_attempt",b.backoff.attempts),b.emitAll("reconnecting",b.backoff.attempts),b.skipReconnect||b.open(function(c){c?(n("reconnect attempt error"),b.reconnecting= !1,b.reconnect(),b.emitAll("reconnect_error",c.data)):(n("reconnect success"),b.onreconnect())}))},c);this.subs.push({destroy:function(){clearTimeout(d)}})}};e.prototype.onreconnect=function(){var b=this.backoff.attempts;this.reconnecting=!1;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",b)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:42,"object-component":43,"socket.io-parser":46}],4:[function(b, c,d){c.exports=function(b,c,d){b.on(c,d);return{destroy:function(){b.removeListener(c,d)}}}},{}],5:[function(b,c,d){function e(b,c){this.io=b;this.nsp=c;this.json=this;this.ids=0;this.acks={};this.io.autoConnect&&this.open();this.receiveBuffer=[];this.sendBuffer=[];this.connected=!1;this.disconnected=!0}var f=b("socket.io-parser");d=b("component-emitter");var g=b("to-array"),h=b("./on"),k=b("component-bind"),m=b("debug")("socket.io-client:socket"),n=b("has-binary");c.exports=e;var p={connect:1,connect_error:1, connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},t=d.prototype.emit;d(e.prototype);e.prototype.subEvents=function(){if(!this.subs){var b=this.io;this.subs=[h(b,"open",k(this,"onopen")),h(b,"packet",k(this,"onpacket")),h(b,"close",k(this,"onclose"))]}};e.prototype.open=e.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();return this};e.prototype.send= function(){var b=g(arguments);b.unshift("message");this.emit.apply(this,b);return this};e.prototype.emit=function(b){if(p.hasOwnProperty(b))return t.apply(this,arguments),this;var c=g(arguments),d=f.EVENT;n(c)&&(d=f.BINARY_EVENT);d={type:d,data:c};"function"==typeof c[c.length-1]&&(m("emitting packet with ack id %d",this.ids),this.acks[this.ids]=c.pop(),d.id=this.ids++);this.connected?this.packet(d):this.sendBuffer.push(d);return this};e.prototype.packet=function(b){b.nsp=this.nsp;this.io.packet(b)}; e.prototype.onopen=function(){m("transport is open - connecting");"/"!=this.nsp&&this.packet({type:f.CONNECT})};e.prototype.onclose=function(b){m("close (%s)",b);this.connected=!1;this.disconnected=!0;delete this.id;this.emit("disconnect",b)};e.prototype.onpacket=function(b){if(b.nsp==this.nsp)switch(b.type){case f.CONNECT:this.onconnect();break;case f.EVENT:this.onevent(b);break;case f.BINARY_EVENT:this.onevent(b);break;case f.ACK:this.onack(b);break;case f.BINARY_ACK:this.onack(b);break;case f.DISCONNECT:this.ondisconnect(); break;case f.ERROR:this.emit("error",b.data)}};e.prototype.onevent=function(b){var c=b.data||[];m("emitting event %j",c);null!=b.id&&(m("attaching ack callback to event"),c.push(this.ack(b.id)));this.connected?t.apply(this,c):this.receiveBuffer.push(c)};e.prototype.ack=function(b){var c=this,d=!1;return function(){if(!d){d=!0;var e=g(arguments);m("sending ack %j",e);var h=n(e)?f.BINARY_ACK:f.ACK;c.packet({type:h,id:b,data:e})}}};e.prototype.onack=function(b){m("calling ack %s with %j",b.id,b.data); this.acks[b.id].apply(this,b.data);delete this.acks[b.id]};e.prototype.onconnect=function(){this.connected=!0;this.disconnected=!1;this.emit("connect");this.emitBuffered()};e.prototype.emitBuffered=function(){var b;for(b=0;b=b.jitter?b.jitter:0;this.attempts=0}c.exports=e;e.prototype.duration=function(){var b=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter)var c=Math.random(),d=Math.floor(c* this.jitter*b),b=0==(Math.floor(10*c)&1)?b-d:b+d;return Math.min(b,this.max)|0};e.prototype.reset=function(){this.attempts=0};e.prototype.setMin=function(b){this.ms=b};e.prototype.setMax=function(b){this.max=b};e.prototype.setJitter=function(b){this.jitter=b}},{}],8:[function(b,c,d){var e=[].slice;c.exports=function(b,c){"string"==typeof c&&(c=b[c]);if("function"!=typeof c)throw Error("bind() requires a function");var d=e.call(arguments,2);return function(){return c.apply(b,d.concat(e.call(arguments)))}}}, {}],9:[function(b,c,d){function e(b){if(b){for(var c in e.prototype)b[c]=e.prototype[c];return b}}c.exports=e;e.prototype.on=e.prototype.addEventListener=function(b,c){this._callbacks=this._callbacks||{};(this._callbacks[b]=this._callbacks[b]||[]).push(c);return this};e.prototype.once=function(b,c){function d(){e.off(b,d);c.apply(this,arguments)}var e=this;this._callbacks=this._callbacks||{};d.fn=c;this.on(b,d);return this};e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners= e.prototype.removeEventListener=function(b,c){this._callbacks=this._callbacks||{};if(0==arguments.length)return this._callbacks={},this;var d=this._callbacks[b];if(!d)return this;if(1==arguments.length)return delete this._callbacks[b],this;for(var e,m=0;m=m?Math.round(b/m)+"d":b>=k?Math.round(b/k)+"h":b>=h?Math.round(b/h)+"m":b>=g?Math.round(b/g)+"s":b+"ms"}},{}],25:[function(b,c,d){(function(c){function f(b,c,e){if(!c)return d.encodeBase64Packet(b,e);var f=new FileReader;f.onload=function(){b.data=f.result;d.encodePacket(b,c,!0,e)}; return f.readAsArrayBuffer(b.data)}function g(b,c,d){var e=Array(b.length);d=p(b.length,d);for(var f=function(b,d,f){c(d,function(c,d){e[b]=d;f(c,e)})},g=0;g=k.count)throw Error("after called too many times");--k.count;b?(m=!0,c(b),c= d):0!==k.count||m||c(null,e)}var m=!1;d=d||e;k.count=b;return 0===b?c():k}},{}],28:[function(b,c,d){c.exports=function(b,c,d){var h=b.byteLength;c=c||0;d=d||h;if(b.slice)return b.slice(c,d);0>c&&(c+=h);0>d&&(d+=h);d>h&&(d=h);if(c>=h||c>=d||0===h)return new ArrayBuffer(0);b=new Uint8Array(b);for(var h=new Uint8Array(d-c),k=0;c>2],k+=b[(c[d]& 3)<<4|c[d+1]>>4],k+=b[(c[d+1]&15)<<2|c[d+2]>>6],k+=b[c[d+2]&63];2===h%3?k=k.substring(0,k.length-1)+"\x3d":1===h%3&&(k=k.substring(0,k.length-2)+"\x3d\x3d");return k};d.decode=function(c){var d=0.75*c.length,h=c.length,k=0,m,n,p,t;"\x3d"===c[c.length-1]&&(d--,"\x3d"===c[c.length-2]&&d--);for(var r=new ArrayBuffer(d),v=new Uint8Array(r),d=0;d>4,v[k++]=(n&15)<<4|p>>2,v[k++]=(p&3)<<6|t&63;return r}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")}, {}],30:[function(b,c,d){(function(b){function d(b,c){c=c||{};for(var e=new g,f=0;f=f&&d=v)throw Error("Invalid byte index");var b=r[s]&255;s++;if(128==(b&192))return b&63;throw Error("Invalid continuation byte");}function k(){var b, c,d,e;if(s>v)throw Error("Invalid byte index");if(s==v)return!1;b=r[s]&255;s++;if(0==(b&128))return b;if(192==(b&224)){c=h();b=(b&31)<<6|c;if(128<=b)return b;throw Error("Invalid continuation byte");}if(224==(b&240)){c=h();d=h();b=(b&15)<<12|c<<6|d;if(2048<=b)return b;throw Error("Invalid continuation byte");}if(240==(b&248)&&(c=h(),d=h(),e=h(),b=(b&15)<<18|c<<12|d<<6|e,65536<=b&&1114111>=b))return b;throw Error("Invalid UTF-8 detected");}var m="object"==typeof d&&d,n="object"==typeof c&&c&&c.exports== m&&c,p="object"==typeof b&&b;if(p.global===p||p.window===p)f=p;var t=String.fromCharCode,r,v,s,p={version:"2.0.0",encode:function(b){b=g(b);for(var c=b.length,d=-1,e,f="";++d>6&31|192):0==(e&4294901760)?(h=t(e>>12&15|224),h+=t(e>>6&63|128)):0==(e&4292870144)&&(h=t(e>>18&7|240),h+=t(e>>12&63|128),h+=t(e>>6&63|128));e=h+=t(e&63|128)}f+=e}return f},decode:function(b){r=g(b);v=r.length;s=0;b=[];for(var c;!1!==(c=k());)b.push(c); c=b.length;for(var d=-1,e,f="";++d>>10&1023|55296),e=56320|e&1023),f+=t(e);return f}};if(m&&!m.nodeType)if(n)n.exports=p;else{f={}.hasOwnProperty;for(var u in p)f.call(p,u)&&(m[u]=p[u])}else f.utf8=p})(this)}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],34:[function(b,c,d){(function(b){var d=/^[\],:{}\s]*$/,g=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,h=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,k=/(?:^|:|,)(?:\s*\[)+/g, m=/^\s+/,n=/\s+$/;c.exports=function(c){if("string"!=typeof c||!c)return null;c=c.replace(m,"").replace(n,"");if(b.JSON&&JSON.parse)return JSON.parse(c);if(d.test(c.replace(g,"@").replace(h,"]").replace(k,"")))return(new Function("return "+c))()}}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],35:[function(b,c,d){d.encode=function(b){var c="",d;for(d in b)b.hasOwnProperty(d)&&(c.length&&(c+="\x26"),c+=encodeURIComponent(d)+"\x3d"+encodeURIComponent(b[d]));return c}; d.decode=function(b){var c={};b=b.split("\x26");for(var d=0,h=b.length;dh){c+="\\u00"+x(2,h.toString(16));break}c+=f?g[d]:v?b.charAt(d):b[d]}}return c+'"'},A=function(b,c,d,e,f,n,p){var r,t,u,v,z,C,D,F,E;try{r=c[b]}catch(G){}if("object"==typeof r&&r)if(t=g.call(r),"[object Date]"!=t||h.call(r,"toJSON"))"function"==typeof r.toJSON&&("[object Number]"!=t&&"[object String]"!=t&&"[object Array]"!=t||h.call(r,"toJSON"))&&(r=r.toJSON(b));else if(r>-1/0&&r<1/0){if(w){v=s(r/864E5);for(t=s(v/365.2425)+1970-1;w(t+1,0)<=v;t++);for(u=s((v-w(t,0))/30.42);w(t,u+1)<=v;u++); v=1+v-w(t,u);z=(r%864E5+864E5)%864E5;C=s(z/36E5)%24;D=s(z/6E4)%60;F=s(z/1E3)%60;z%=1E3}else t=r.getUTCFullYear(),u=r.getUTCMonth(),v=r.getUTCDate(),C=r.getUTCHours(),D=r.getUTCMinutes(),F=r.getUTCSeconds(),z=r.getUTCMilliseconds();r=(0>=t||1E4<=t?(0>t?"-":"+")+x(6,0>t?-t:t):x(4,t))+"-"+x(2,u+1)+"-"+x(2,v)+"T"+x(2,C)+":"+x(2,D)+":"+x(2,F)+"."+x(3,z)+"Z"}else r=null;d&&(r=d.call(c,b,r));if(null===r)return"null";t=g.call(r);if("[object Boolean]"==t)return""+r;if("[object Number]"==t)return r>-1/0&&r< 1/0?""+r:"null";if("[object String]"==t)return y(""+r);if("object"==typeof r){for(b=p.length;b--;)if(p[b]===r)throw TypeError();p.push(r);E=[];c=n;n+=f;if("[object Array]"==t){u=0;for(b=r.length;u=d.length?d:d.slice(0,10));return A("",(p={},p[""]=b,p),f,h,e,"",[])}}if(!c("json-parse")){var C=String.fromCharCode, I={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},D,M,J=function(){D=M=null;throw SyntaxError();},E=function(){for(var b=M,c=b.length,d,e,f,g,h;Dh)J();else if(92==h)switch(h=b.charCodeAt(++D),h){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:d+=I[h];D++; break;case 117:e=++D;for(f=D+4;D=h||97<=h&&102>=h||65<=h&&70>=h||J();d+=C("0x"+b.slice(e,D));break;default:J()}else{if(34==h)break;h=b.charCodeAt(D);for(e=D;32<=h&&92!=h&&34!=h;)h=b.charCodeAt(++D);d+=b.slice(e,D)}if(34==b.charCodeAt(D))return D++,d;J();default:e=D;45==h&&(g=!0,h=b.charCodeAt(++D));if(48<=h&&57>=h){for(48==h&&(h=b.charCodeAt(D+1),48<=h&&57>=h)&&J();D=h);D++);if(46==b.charCodeAt(D)){for(f=++D;f=h);f++);f==D&&J();D=f}h=b.charCodeAt(D);if(101==h||69==h){h=b.charCodeAt(++D);43!=h&&45!=h||D++;for(f=D;f=h);f++);f==D&&J();D=f}return+b.slice(e,D)}g&&J();if("true"==b.slice(D,D+4))return D+=4,!0;if("false"==b.slice(D,D+5))return D+=5,!1;if("null"==b.slice(D,D+4))return D+=4,null;J()}return"$"},G=function(b){var c,d;"$"==b&&J();if("string"==typeof b){if("@"==(v?b.charAt(0):b[0]))return b.slice(1);if("["==b){for(c=[];;d||(d=!0)){b=E();if("]"==b)break;d&& (","==b?(b=E(),"]"==b&&J()):J());","==b&&J();c.push(G(b))}return c}if("{"==b){for(c={};;d||(d=!0)){b=E();if("}"==b)break;d&&(","==b?(b=E(),"}"==b&&J()):J());","!=b&&"string"==typeof b&&"@"==(v?b.charAt(0):b[0])&&":"==E()||J();c[b.slice(1)]=G(E())}return c}J()}return b},L=function(b,c,d){d=P(b,c,d);d===m?delete b[c]:b[c]=d},P=function(b,c,d){var e=b[c],f;if("object"==typeof e&&e)if("[object Array]"==g.call(e))for(f=e.length;f--;)L(e,f,d);else k(e,function(b){L(e,b,d)});return d.call(b,c,e)};p.parse= function(b,c){var d,e;D=0;M=""+b;d=G(E());"$"!=E()&&J();D=M=null;return c&&"[object Function]"==g.call(c)?P((e={},e[""]=d,e),"",c):d}}}})(this)},{}],50:[function(b,c,d){c.exports=function(b,c){for(var d=[],h=(c=c||0)||0;hMath.abs(b-a))&&(this._usedAtlasScale=b)},createObject:function(){return this._instantiateGaf(this._gafData)},createObjectAndRun:function(a){cc.assert(1===arguments.length,"GAFAsset::createObjectAndRun should have one param");var b=this._instantiateGaf(this._gafData);b.setLooped(a,!0);b.start();return b},setTextureLoadDelegate:function(a){debugger},getSceneFps:function(){return this._sceneFps},getSceneWidth:function(){debugger},getSceneHeight:function(){debugger}, getSceneColor:function(){debugger},setSceneFps:function(a){this._sceneFps=a},setSceneWidth:function(a){debugger},setSceneHeight:function(a){debugger},setSceneColor:function(a){debugger},getHeader:function(){return this._header},getGAFFileName:function(){return this._gafName},ctor:function(){this._header={};this._timeLines=[];this._textFields=[];this._objects=[];this._masks=[];this._protos=[];this._atlases={};this._onLoadTasks=[];this._atlasScales={};this._atlasesToLoad={};0this._getMajorVerison()&&this._pushTimeLine(new gaf._TimeLineProto(this,this._header.framesCount, this._header.frameSize,this._header.pivot));gaf._AssetPreload.Tags(this,a.tags,this._rootTimeLine);this._objects.forEach(function(a){switch(a.type){case gaf.TYPE_TEXTURE:b._protos[a.objectId]||(b._protos[a.objectId]=new gaf._SpriteProto(b,b._atlasScales,a.elementAtlasIdRef));break;case gaf.TYPE_TIME_LINE:b._protos[a.objectId]=b._timeLines[a.elementAtlasIdRef];break;case gaf.TYPE_TEXT_FIELD:b._protos[a.objectId]=b._textFields[a.elementAtlasIdRef];break;default:cc.log("Unknown object type: "+a.type)}}); this._masks.forEach(function(a){if(!b._protos[a.objectId]){var d=null;switch(a.type){case gaf.TYPE_TEXTURE:d=new gaf._SpriteProto(b,b._atlasScales,a.elementAtlasIdRef);break;case gaf.TYPE_TIME_LINE:d=b._timeLines[a.elementAtlasIdRef];break;case gaf.TYPE_TEXT_FIELD:d=b._textFields[a.elementAtlasIdRef]}b._protos[a.objectId]=new gaf._MaskProto(b,d,a.elementAtlasIdRef)}});this.setDesiredAtlasScale(this._desiredAtlasScale);0===Object.keys(this._atlasesToLoad).length&&(this._textureLoaded=!0,this.dispatchEvent("load"))}, _pushTimeLine:function(a){this._timeLines[a.getId()]=a;0===a.getId()&&this._setRootTimeline(a)},_instantiateGaf:function(){var a=null;return a=this._rootTimeLine._gafConstruct()},_onAtlasLoaded:function(a,b){this._atlases[a]=b;delete this._atlasesToLoad[a];0===Object.keys(this._atlasesToLoad).length&&(this._onLoadTasks.forEach(function(a){a()}),this._onLoadTasks.length=0,this._textureLoaded=!0,this.dispatchEvent("load"))},isLoaded:function(){return this._textureLoaded},_getSearchPaths:function(a){var b= this.getGAFFileName().split("/");b[b.length-1]=a;b=b.join("/");return[a,b]}});gaf.Asset.create=function(a,b){return new gaf.Asset(a,b)};gaf.Asset.createWithBundle=function(a,b,c){var d=new gaf.Asset;d.initWithGAFBundle(a,b,c);return d};cc.EventHelper.prototype.apply(gaf.Asset.prototype);gaf=gaf||{};gaf._stateHasCtx=function(a){if(a.hasColorTransform&&(0this._totalFrameCount},getSequences:function(){return this._gafproto.getSequences()},playSequence:function(a,b){var c=this.getStartFrame(a),d=this.getEndFrame(a);if(gaf.IDNONE===c||gaf.IDNONE===d)return!1;this._currentSequenceStart=c;this._currentSequenceEnd=d;this._currentFrame=this._currentSequenceStart;this.setLooped(b,!1);this.resumeAnimation();return!0},isReversed:function(){return this._isReversed},setSequenceDelegate:function(a){this._sequenceDelegate= a},setFrame:function(a){return a>=gaf.FIRST_FRAME_INDEX&&a=this._frameTime;)this._timeDelta-=this._frameTime,this._step()},_step:function(){this._showingFrame=this._currentFrame;if(this.getIsAnimationRunning()){if(this._sequenceDelegate){var a;(a=this._isReversed?this._getSequenceByFirstFrame(this._currentFrame+1):this._getSequenceByLastFrame(this._currentFrame))&&this._sequenceDelegate(this,a)}this._isCurrentFrameLastInSequence()&&(this._isLooped?this._animationStartedNextLoopDelegate&&this._animationStartedNextLoopDelegate(this):(this.setAnimationRunning(!1, !1),this._animationFinishedPlayDelegate&&this._animationFinishedPlayDelegate(this)));this._processAnimation();this._currentFrame=this._nextFrame()}else this._processAnimation()},_isCurrentFrameLastInSequence:function(){return this._isReversed?this._currentFrame==this._currentSequenceStart:this._currentFrame==this._currentSequenceEnd-1},_nextFrame:function(){return this._isCurrentFrameLastInSequence()?this._isLooped?this._isReversed?this._currentSequenceEnd-1:this._currentSequenceStart:this._currentFrame: this._currentFrame+(this._isReversed?-1:1)},_processAnimation:function(){this._realizeFrame(this._container,this._currentFrame);this._framePlayedDelegate&&this._framePlayedDelegate(this,this._currentFrame)},_realizeFrame:function(a,b){var c=this._objects,d=this._gafproto.getFrames();if(!(b>d.length)&&(d=d[b]))for(var d=d.states,e=0,f=d.length;eg.alpha&&h._resetState();h._updateVisibility(g,this);if(h.isVisible()){h._applyState(g,this);var k=a;g.hasMask&& (k=c[g.maskObjectIdRef]._getNode(),cc.assert(k,"Error! Mask not found."));h._lastVisibleInFrame=1+b;gaf.TimeLine.rearrangeSubobject(k,h,g.depth);h._step&&h._step()}}},setAnimationRunning:function(a,b){this._isRunning=a;b&&this._objects.forEach(function(c){c&&c.setAnimationRunning&&c.setAnimationRunning(a,b)})},_getSequenceByLastFrame:function(){var a=this._gafproto.getSequences(),b;for(b in a)if(a.hasOwnProperty(b)&&a[b].end===frame+1)return b;return""},_resetState:function(){this._super();this._currentFrame= this._currentSequenceStart},_getSequenceByFirstFrame:function(){var a=this._gafproto.getSequences(),b;for(b in a)if(a.hasOwnProperty(b)&&a[b].start===frame)return b;return""}});gaf.TimeLine.rearrangeSubobject=function(a,b,c){b.getParent()!==a?(b.removeFromParent(!1),a.addChild(b,c)):b.setLocalZOrder(c)};gaf.TextField=gaf.Object.extend({_className:"GAFTextField"});gaf.Sprite=gaf.Object.extend({_className:"GAFSprite",_hasCtx:!1,_hasFilter:!1,ctor:function(a,b){this._super(b);cc.assert(a,"Error! Missing mandatory parameter.");this._gafproto=a},_init:function(){var a=this._gafproto.getFrame();cc.assert(a instanceof cc.SpriteFrame,"Error. Wrong object type.");this._sprite=new cc.Sprite;this._sprite._renderCmd=this._gafCreateRenderCmd(this._sprite);this._sprite.initWithSpriteFrame(a);this._sprite.setAnchorPoint(this._gafproto.getAnchor());this.addChild(this._sprite); this._sprite.setOpacityModifyRGB(!0);cc._renderType===cc._RENDER_TYPE_WEBGL&&this._sprite.setBlendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA)},_applyState:function(a,b){this._applyStateSuper(a,b);this._needsCtx?(this._hasCtx||(this._enableCtx(),this._hasCtx=!0),this._applyCtxState(a)):(this._hasCtx&&(this._disableCtx(),this._hasCtx=!1),cc.colorEqual(this._sprite._realColor,this._cascadeColorMult)||this._sprite.setColor(this._cascadeColorMult),this._sprite.getOpacity()!=this._cascadeColorMult.a&&this._sprite.setOpacity(this._cascadeColorMult.a))}, _enableCtx:function(){this._sprite._renderCmd._enableCtx()},_disableCtx:function(){this._sprite._renderCmd._disableCtx()},_applyCtxState:function(a){this._sprite._renderCmd._applyCtxState(this)},getBoundingBoxForCurrentFrame:function(){var a=this._sprite.getBoundingBox();return cc._rectApplyAffineTransformIn(a,this.getNodeToParentTransform())},_gafCreateRenderCmd:function(a){return cc._renderType===cc._RENDER_TYPE_CANVAS?new gaf.Sprite.CanvasRenderCmd(a):new gaf.Sprite.WebGLRenderCmd(a)}});gaf.Mask=gaf.Object.extend({_className:"GAFMask",_clippingNode:null,ctor:function(a){this._super();cc.assert(a,"Error! Missing mandatory parameter.");this._gafproto=a},_init:function(){var a=this._gafproto.getMaskNodeProto();cc.assert(a,"Error. Mask node for id ref "+this._gafproto.getIdRef()+" not found.");this._maskNode=a._gafConstruct();this._clippingNode=cc.ClippingNode.create(this._maskNode);this._clippingNode.setAlphaThreshold(0.5);this.addChild(this._clippingNode)},setExternalTransform:function(a){cc.affineTransformEqualToTransform(this._maskNode._additionalTransform, a)||this._maskNode.setAdditionalTransform(a)},_getNode:function(){return this._clippingNode}});(function(){gaf.Sprite.CanvasRenderCmd=function(a){cc.Sprite.CanvasRenderCmd.call(this,a);this._hasCtx=this._hasTintOffset=this._hasTintMult=!1;this._tintMult=cc.color(255,255,255,255);this._tintOffset=cc.color(0,0,0,0);this._textureDirty=!1};var a=gaf.Sprite.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);a.constructor=gaf.Sprite.CanvasRenderCmd;a._disableCtx=function(){this._hasCtx=this._hasTintOffset=!1;this._textureDirty=!0;this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty); this._tintMult=cc.color(255,255,255,255);this._tintOffset=cc.color(0,0,0,0)};a._enableCtx=function(){};a._applyCtxState=function(a){var c=a._cascadeColorMult,d=a._cascadeColorOffset,e=c.a;this._node.getOpacity()!=e&&this._node.setOpacity(e);if(e=!cc.colorEqual(this._tintMult,c))this._node.setColor(c),this._tintMult=c,this._hasTintMult=255!==c.r||255!==c.g||255!==c.b;if(c=this._tintOffset.r!=d.r||this._tintOffset.g!=d.g||this._tintOffset.b!=d.b||this._tintOffset.a!=d.a)this._tintOffset=d,this._hasTintOffset= 0!==d.r||0!==d.g||0!==d.b||0!==d.a;(this._textureDirty=e||c)&&this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);this._hasCtx=0b.versionMajor)c=a,b.framesCount=c.Ushort(),b.frameSize=c.Rect(),b.pivot=c.Point();else{var c=a,d=c.Uint();b.scaleValues=[];for(var e=0;ethis.maxOffset())throw Error("GAF format error");return this.offset[this.offset.length-1]-a};gaf.DataReader.prototype.maxOffset=function(){return 1==this.offset.length?this.buf.byteLength:this.offset[this.offset.length-2]}; gaf.DataReader.prototype.getOffset=function(a){return this.offset[this.offset.length-1]};gaf.DataReader.prototype.Ubyte=function(){return this.buf.getUint8(this.newOffset(1))};gaf.DataReader.prototype.Boolean=function(){var a=this.buf.getUint8(this.newOffset(1));if(1