gusucode.com > gqtz游戏微信朋友圈小游戏源码程序 > gqtz游戏微信朋友圈小游戏源码程序/gqtz/src/Cocos2d-html5-v2.2.3.min.js

    var cc=cc||{},ClassManager={id:0|998*Math.random(),instanceId:0|998*Math.random(),compileSuper:function(a,c,d){a=a.toString();var e=a.indexOf("("),f=a.indexOf(")"),e=a.substring(e+1,f),e=e.trim(),f=a.indexOf("{"),g=a.lastIndexOf("}");for(a=a.substring(f+1,g);-1!=a.indexOf("this._super");){var f=a.indexOf("this._super"),g=a.indexOf("(",f),h=a.indexOf(")",g),h=a.substring(g+1,h),h=(h=h.trim())?",":"";a=a.substring(0,f)+"ClassManager["+d+"]."+c+".call(this"+h+a.substring(g+1)}return Function(e,a)},getNewID:function(){return this.id++},
getNewInstanceId:function(){return this.instanceId++}};ClassManager.compileSuper.ClassManager=ClassManager;
(function(){var a=/\b_super\b/,c=document.ccConfig&&document.ccConfig.CLASS_RELEASE_MODE?document.ccConfig.CLASS_RELEASE_MODE:null;c&&console.log("release Mode");cc.Class=function(){};cc.Class.extend=function(d){function e(){this.__instanceId=ClassManager.getNewInstanceId();this.ctor&&this.ctor.apply(this,arguments)}var f=this.prototype,g=Object.create(f),h=ClassManager.getNewID();ClassManager[h]=f;var k={writable:!0,enumerable:!1,configurable:!0},m;for(m in d)c&&"function"==typeof d[m]&&"function"==
typeof f[m]&&a.test(d[m])?(k.value=ClassManager.compileSuper(d[m],m,h),Object.defineProperty(g,m,k)):"function"==typeof d[m]&&"function"==typeof f[m]&&a.test(d[m])?(k.value=function(a,c){return function(){var d=this._super;this._super=f[a];var e=c.apply(this,arguments);this._super=d;return e}}(m,d[m]),Object.defineProperty(g,m,k)):"function"==typeof d[m]?(k.value=d[m],Object.defineProperty(g,m,k)):g[m]=d[m];g.__instanceId=null;e.id=h;k.value=h;Object.defineProperty(g,"__pid",k);e.prototype=g;k.value=
e;Object.defineProperty(e.prototype,"constructor",k);e.extend=cc.Class.extend;e.implement=function(a){for(var c in a)g[c]=a[c]};return e};Function.prototype.bind=Function.prototype.bind||function(a){var c=this,f=Array.prototype.slice.call(arguments,1);return function(){return c.apply(a||null,f.concat(Array.prototype.slice.call(arguments)))}}})();cc.inherits=function(a,c){function d(){}d.prototype=c.prototype;a.superClass_=c.prototype;a.prototype=new d;a.prototype.constructor=a};
cc.base=function(a,c,d){var e=arguments.callee.caller;if(e.superClass_)return ret=e.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var f=Array.prototype.slice.call(arguments,2),g=!1,h=a.constructor;h;h=h.superClass_&&h.superClass_.constructor)if(h.prototype[c]===e)g=!0;else if(g)return h.prototype[c].apply(a,f);if(a[c]===e)return a.constructor.prototype[c].apply(a,f);throw Error("cc.base called from a method of one name to a method of a different name");};
cc.concatObjectProperties=function(a,c){a||(a={});for(var d in c)a[d]=c[d];return a};cc.Point=function(a,c){void 0!==a&&void 0===c?(this.x=a.x,this.y=a.y):(this.x=a||0,this.y=c||0)};cc.PointMake=function(a,c){cc.log("cc.PointMake will be deprecated sooner or later. Use cc.p instead.");return new cc.Point(a,c)};cc.p=function(a,c){return void 0===a?{x:0,y:0}:void 0===c?{x:a.x,y:a.y}:{x:a||0,y:c||0}};cc._p=cc.p;cc.PointZero=function(){return cc.p(0,0)};cc.pointEqualToPoint=function(a,c){return a&&c?a.x===c.x&&a.y===c.y:!1};
cc.Size=function(a,c){void 0!==a&&void 0===c?(this.width=a.width,this.height=a.height):(this.width=a||0,this.height=c||0)};cc.SizeMake=function(a,c){cc.log("cc.SizeMake will be deprecated sooner or later. Use cc.size instead.");return cc.size(a,c)};cc.size=function(a,c){return void 0===a?{width:0,height:0}:void 0===c?{width:a.width,height:a.height}:{width:a||0,height:c||0}};cc._size=cc.size;cc.SizeZero=function(){return cc.size(0,0)};
Object.defineProperties(cc,{POINT_ZERO:{get:function(){return cc.p()}},SIZE_ZERO:{get:function(){return cc.size(0,0)}},RECT_ZERO:{get:function(){return cc.rect(0,0,0,0)}}});cc.sizeEqualToSize=function(a,c){return a&&c?a.width==c.width&&a.height==c.height:!1};
cc.Rect=function(a,c,d,e){var f=arguments.length;if(4===f)this._origin=new cc.Point(a||0,c||0),this._size=new cc.Size(d||0,e||0);else if(1===f)this._origin=new cc.Point(a._origin.x,a._origin.y),this._size=new cc.Size(a._size.width,a._size.height);else if(0===f)this._origin=new cc.Point(0,0),this._size=new cc.Size(0,0);else if(2===f)this._origin=new cc.Point(a.x,a.y),this._size=new cc.Size(c.width,c.height);else throw"unknown argument type";};
cc.RectMake=function(a,c,d,e){cc.log("cc.RectMake will be deprecated sooner or later. Use cc.rect instead.");return cc.rect(a,c,d,e)};cc.rect=function(a,c,d,e){var f=arguments.length;if(0===f)return new cc.Rect(0,0,0,0);if(1===f)return new cc.Rect(a.x,a.y,a.width,a.height);if(2===f)return new cc.Rect(a.x,a.y,c.width,c.height);if(4===f)return new cc.Rect(a,c,d,e);throw"unknown argument type";};cc._rect=cc.rect;cc.RectZero=function(){return cc.rect(0,0,0,0)};
cc.rectEqualToRect=function(a,c){return a&&c?cc.pointEqualToPoint(a._origin,c._origin)&&cc.sizeEqualToSize(a._size,c._size):!1};cc._rectEqualToZero=function(a){return a?0===a.x&&0===a.y&&0===a.width&&0===a.height:!1};cc.rectContainsRect=function(a,c){return a&&c?!(a.x>=c.x||a.y>=c.y||a.x+a.width<=c.x+c.width||a.y+a.height<=c.y+c.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,c){return c.x>=cc.rectGetMinX(a)&&c.x<=cc.rectGetMaxX(a)&&c.y>=cc.rectGetMinY(a)&&c.y<=cc.rectGetMaxY(a)};cc.rectIntersectsRect=function(a,c){return!(cc.rectGetMaxX(a)<cc.rectGetMinX(c)||cc.rectGetMaxX(c)<cc.rectGetMinX(a)||cc.rectGetMaxY(a)<cc.rectGetMinY(c)||cc.rectGetMaxY(c)<cc.rectGetMinY(a))};
cc.rectOverlapsRect=function(a,c){return!(a.x+a.width<c.x||c.x+c.width<a.x||a.y+a.height<c.y||c.y+c.height<a.y)};cc.rectUnion=function(a,c){var d=cc.rect(0,0,0,0);d.x=Math.min(a.x,c.x);d.y=Math.min(a.y,c.y);d.width=Math.max(a.x+a.width,c.x+c.width)-d.x;d.height=Math.max(a.y+a.height,c.y+c.height)-d.y;return d};
cc.rectIntersection=function(a,c){var d=cc.rect(Math.max(cc.rectGetMinX(a),cc.rectGetMinX(c)),Math.max(cc.rectGetMinY(a),cc.rectGetMinY(c)),0,0);d.width=Math.min(cc.rectGetMaxX(a),cc.rectGetMaxX(c))-cc.rectGetMinX(d);d.height=Math.min(cc.rectGetMaxY(a),cc.rectGetMaxY(c))-cc.rectGetMinY(d);return d};cc.Rect.prototype.getX=function(){return this._origin.x};cc.Rect.prototype.setX=function(a){this._origin.x=a};cc.Rect.prototype.getY=function(){return this._origin.y};
cc.Rect.prototype.setY=function(a){this._origin.y=a};cc.Rect.prototype.getWidth=function(){return this._size.width};cc.Rect.prototype.setWidth=function(a){this._size.width=a};cc.Rect.prototype.getHeight=function(){return this._size.height};cc.Rect.prototype.setHeight=function(a){this._size.height=a};
Object.defineProperties(cc.Rect.prototype,{x:{get:function(){return this.getX()},set:function(a){this.setX(a)},enumerable:!0,configurable:!0},y:{get:function(){return this.getY()},set:function(a){this.setY(a)},enumerable:!0,configurable:!0},width:{get:function(){return this.getWidth()},set:function(a){this.setWidth(a)},enumerable:!0,configurable:!0},height:{get:function(){return this.getHeight()},set:function(a){this.setHeight(a)},enumerable:!0,configurable:!0}});var sys=sys||{};try{sys.localStorage=window.localStorage,window.localStorage.setItem("storage",""),window.localStorage.removeItem("storage")}catch(e$$12){"SECURITY_ERR"!==e$$12.name&&"QuotaExceededError"!==e$$12.name||console.log("Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option"),sys.localStorage=function(){}}
Object.defineProperties(sys,{capabilities:{get:function(){var a={canvas:!0};cc.Browser.supportWebGL&&(a.opengl=!0);void 0!==document.documentElement.ontouchstart||window.navigator.msPointerEnabled?a.touches=!0:void 0!==document.documentElement.onmouseup&&(a.mouse=!0);void 0!==document.documentElement.onkeyup&&(a.keyboard=!0);if(window.DeviceMotionEvent||window.DeviceOrientationEvent)a.accelerometer=!0;return a},enumerable:!0,configurable:!0},os:{get:function(){var a=navigator.userAgent.match(/(iPad|iPhone|iPod)/i)?
!0:!1,c=navigator.userAgent.match(/android/i)||navigator.platform.match(/android/i)?!0:!1,d=navigator.appVersion;-1!=navigator.appVersion.indexOf("Win")?d="Windows":a?d="iOS":-1!=navigator.appVersion.indexOf("Mac")?d="OS X":-1!=navigator.appVersion.indexOf("X11")?d="UNIX":-1!=navigator.appVersion.indexOf("Linux")?d="Linux":c&&(d="Android");return d},enumerable:!0,configurable:!0},platform:{get:function(){return"browser"},enumerable:!0,configurable:!0},version:{get:function(){return cc.ENGINE_VERSION},
enumerable:!0,configurable:!0}});sys.garbageCollect=function(){};sys.dumpRoot=function(){};sys.restartVM=function(){};cc.ENGINE_VERSION="Cocos2d-html5-v2.2.3";cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL=0;cc.DIRECTOR_STATS_POSITION=cc.p(0,0);cc.DIRECTOR_FPS_INTERVAL=0.5;cc.COCOSNODE_RENDER_SUBPIXEL=1;cc.SPRITEBATCHNODE_RENDER_SUBPIXEL=1;cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA=0;cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP=0;cc.TEXTURE_ATLAS_USE_VAO=0;cc.TEXTURE_NPOT_SUPPORT=0;cc.RETINA_DISPLAY_SUPPORT=1;cc.RETINA_DISPLAY_FILENAME_SUFFIX="-hd";cc.USE_LA88_LABELS=1;cc.SPRITE_DEBUG_DRAW=0;cc.SPRITEBATCHNODE_DEBUG_DRAW=0;
cc.LABELBMFONT_DEBUG_DRAW=0;cc.LABELATLAS_DEBUG_DRAW=0;cc.IS_RETINA_DISPLAY_SUPPORTED=1;cc.DEFAULT_ENGINE=cc.ENGINE_VERSION+"-canvas";cc.config={platform:sys.platform};cc.dumpConfig=function(){for(var a in sys)cc.log(a+" \x3d "+sys[a])};cc.ENABLE_STACKABLE_ACTIONS=1;cc.ENABLE_GL_STATE_CACHE=1;cc.create3DContext=function(a,c){for(var d=["webgl","experimental-webgl","webkit-3d","moz-webgl"],e=null,f=0;f<d.length;++f){try{e=a.getContext(d[f],c)}catch(g){}if(e)break}return e};cc.Browser={};cc.Browser.webglWhiteList=["baidubrowser","opera","firefox","chrome","safari"];cc.Browser.multipleAudioWhiteList="baidubrowser opera firefox chrome safari ucbrowser qqbrowser mqqbrowser ie".split(" ");
(function(){cc.Browser.ua=navigator.userAgent.toLowerCase();cc.Browser.platform=navigator.platform.toLowerCase();cc.Browser.isMobile=-1!=cc.Browser.ua.indexOf("mobile")||-1!=cc.Browser.ua.indexOf("android");cc.Browser.type=function(){var a=cc.Browser.ua.match(/micromessenger|qqbrowser|mqqbrowser|ucbrowser|360browser|baiduboxapp|baidubrowser|maxthon|ie|opera|miuibrowser|firefox/)||cc.Browser.ua.match(/chrome|safari/);return a&&0<a.length?(a=a[0],"micromessenger"==a?"wechat":"safari"===a&&null!=cc.Browser.ua.match(/android.*applewebkit/)?
"androidbrowser":a):"unknow"}();cc.Browser.mode="ie"==cc.Browser.type&&document.documentMode;document.ccConfig||(document.ccConfig={});cc._userRenderMode=parseInt(document.ccConfig.renderMode)||0;var a=-1==cc.Browser.webglWhiteList.indexOf(cc.Browser.type);1===cc._userRenderMode||0===cc._userRenderMode&&(cc.Browser.isMobile||a)?cc.Browser.supportWebGL=!1:(cc.Browser.supportWebGL=null!=window.WebGLRenderingContext,a=document.createElement("Canvas"),a=cc.create3DContext(a,{stencil:!0,preserveDrawingBuffer:!0}),
cc.Browser.supportWebGL=null!=a);2!==cc._userRenderMode||cc.Browser.supportWebGL||(cc.__renderDoesnotSupport=!0);var a=cc.Browser,c;try{c=new (window.AudioContext||window.webkitAudioContext||window.mozAudioContext)?!0:!1}catch(d){c=!1}a.supportWebAudio=c;cc.Browser.openURL=function(a){if(this.isMobile){var c=cc.Director.getInstance().getWinSize(),d=c.width+"px",c=c.height+"px",h=cc.$new("div");h.style.backgroundColor="#ffffff";h.style.width=d;h.style.height=c;h.style.zindex=1E3;h.style.position="absolute";
h.style.top="0px";h.style.left="0px";h.id="cocos2d-browser";var k=cc.$new("iframe");k.src=a;k.style.width=d;k.style.height=c;k.setAttribute("frameborder","no");k.setAttribute("scrolling","no");h.appendChild(k);k.onload=function(){var a=document.createElement("img");a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhCAYAAABX5MJvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo5OERBMEM3OUQzRTMxMUUyODg2Q0RFNjU1QkU1RjlFQSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5OERBMEM3QUQzRTMxMUUyODg2Q0RFNjU1QkU1RjlFQSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjk4REEwQzc3RDNFMzExRTI4ODZDREU2NTVCRTVGOUVBIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjk4REEwQzc4RDNFMzExRTI4ODZDREU2NTVCRTVGOUVBIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+NwBuoAAAA/tJREFUeNrEWF0sW3EUb6+28zFhbGadsBaNhazV+kpDYhFWKRGWbHvwFV5IvPiIFw9evElEPEiWSUgsIWoIglhmUomPxj6aKC0zKVJjtPU5o9j5J7dLdbf33jKc5Jfc3v+v5/+755x7/j1lMoiNBRDh4AO88HvO2m+ACbAC+AJQAyz2JCbBFyMBWQA/xv+3DUAXLuivudhcY4BMwCuAB+NqDPmNAnAAOsCZvQgk4BnjeiwEwAbM2YoQA14yrteQEANgDcML7gXjZgw9OAuJkADu3JAIb7Q/hr+GtCwuLs6LDq+iooLvhBAREhFEl11ZWRne0tIiIeNIpVKv4uJi4dTUVApNt0EY3ohILSIiwqO7u1sql8vD8vLyJJ2dnXH2HDabzczPz3/Y1taWzOfz78XExDxSq9Vyd3d3jMK9F2pWr6lEtLa2RmVnZ4tt7w0NDWlTU1OVtkK7urqSQ0NDzzW5hYWFjcTExAGDwXDkyD+VSkZ7e3tsWlpamP19mUwWplQqk9B1UlKST3NzczxE4K49D4mCiDwn24PyPMjIyHjs6urKIVpLSEgInp6eZsM6Kzw8nEvEMZvNBxC1BbI9KCMhkUgUy8vLRpL1QIFA4EcSyZmcnJzpS4mYnZ3dj46O7p2fn193xIGi/CeiFovlFIp5pqGhYZ5qD1qFiQxCjk1OTsqEQmEAFReloL+/X0sVAadFWE2n02VA+O+TcVZXV01QkO8ODw9P6fjEnO2zvb2936g4XC7XG4rWm65P2iL8/f05kN8nBQUFQkqnGMYcGBjIys3N5dLxjY7ydDrE6urqsNLSUqmbmxuH1tOBkMzMTIHRaNxSqVTmS4soKyvjFRUViTw9PV2dTR901WAOh7M/MjKyeeHCbGpqEhcWFkY5Wl9aWtpUKBRaONziSbsii/Xm5OTk7EIdU6/X7zpaW1xc/Al5HxkfH9/e2dk5rqmpeUrE6+vr06ADzpEIlI5kMjFwPhh5PB5DJBKdK7KDg4Oj2tpaVUdHxw/0eWxszIjyj8Jvy4N60FdVVX2Grnt4dkaowYJESAG3yaLR09Oz5uvrexwbGxuAR2erpKTkI6RqxW5DM6RnLT09PQQV5vDwsDYlJWUU+I4EIDMhEQLAA6q0DA4OrqMCg/c/qL6+XtXY2Kgn4sGJuavRaFbFYrFPeXn5FIj6ReFa64KnIpJOpaMK39vbM9XV1X13lF9kc3Nz+xMTEwZo89s03A4ycRE1N/RjF/WPKgyfDRU39Gu7w1qYyNYAtwDB1yhgGPDBfgzU4bMi7xoEjAI6iWZRdGMGH80Cr2goRlP5W8B7qwBHfw1YO6kEH4yC8EnJ5QKbnuDFh17nr4BPRP9P/BFgAHo7ZNgI9EbHAAAAAElFTkSuQmCC";
h.appendChild(a);a.style.zindex=1E3;a.style.position="absolute";a.style.bottom="10px";a.style.right="10px";a.onclick=function(){h.remove()}};(a=document.getElementById(document.ccConfig.tag).parentNode)&&a.appendChild(h)}else window.open(a)}})();cc.RenderDoesnotSupport=function(){return"undefined"===cc.__renderDoesnotSupport?!1:cc.__renderDoesnotSupport};
cc.$=function(a){var c=this==cc?document:this;if(a=a instanceof HTMLElement?a:c.querySelector(a))a.find=a.find||cc.$,a.hasClass=a.hasClass||function(a){return this.className.match(RegExp("(\\s|^)"+a+"(\\s|$)"))},a.addClass=a.addClass||function(a){this.hasClass(a)||(this.className&&(this.className+=" "),this.className+=a);return this},a.removeClass=a.removeClass||function(a){this.hasClass(a)&&(this.className=this.className.replace(a,""));return this},a.remove=a.remove||function(){this.parentNode&&
this.parentNode.removeChild(this);return this},a.appendTo=a.appendTo||function(a){a.appendChild(this);return this},a.prependTo=a.prependTo||function(a){a.childNodes[0]?a.insertBefore(this,a.childNodes[0]):a.appendChild(this);return this},a.transforms=a.transforms||function(){this.style[cc.$.trans]=cc.$.translate(this.position)+cc.$.rotate(this.rotation)+cc.$.scale(this.scale)+cc.$.skew(this.skew);return this},a.position=a.position||{x:0,y:0},a.rotation=a.rotation||0,a.scale=a.scale||{x:1,y:1},a.skew=
a.skew||{x:0,y:0},a.translates=function(a,c){this.position.x=a;this.position.y=c;this.transforms();return this},a.rotate=function(a){this.rotation=a;this.transforms();return this},a.resize=function(a,c){this.scale.x=a;this.scale.y=c;this.transforms();return this},a.setSkew=function(a,c){this.skew.x=a;this.skew.y=c;this.transforms();return this};return a};
switch(cc.Browser.type){case "firefox":cc.$.pfx="Moz";cc.$.hd=!0;break;case "chrome":case "safari":cc.$.pfx="webkit";cc.$.hd=!0;break;case "opera":cc.$.pfx="O";cc.$.hd=!1;break;case "ie":cc.$.pfx="ms";cc.$.hd=!1;break;default:cc.$.pfx="webkit",cc.$.hd=!0}cc.$.trans=cc.$.pfx+"Transform";cc.$.translate=cc.$.hd?function(a){return"translate3d("+a.x+"px, "+a.y+"px, 0) "}:function(a){return"translate("+a.x+"px, "+a.y+"px) "};
cc.$.rotate=cc.$.hd?function(a){return"rotateZ("+a+"deg) "}:function(a){return"rotate("+a+"deg) "};cc.$.scale=function(a){return"scale("+a.x+", "+a.y+") "};cc.$.skew=function(a){return"skewX("+-a.x+"deg) skewY("+a.y+"deg)"};cc.$new=function(a){return cc.$(document.createElement(a))};cc.$.findpos=function(a){var c=0,d=0;do c+=a.offsetLeft,d+=a.offsetTop;while(a=a.offsetParent);return{x:c,y:d}};cc.clone=function(a){var c=a.constructor?new a.constructor:{},d;for(d in a){var e=a[d];c[d]="object"!=typeof e||!e||e instanceof cc.Node||e instanceof HTMLElement?e:cc.clone(e)}return c};cc.associateWithNative=function(a,c){};cc.IS_SHOW_DEBUG_ON_PAGE=cc.IS_SHOW_DEBUG_ON_PAGE||!1;
cc._logToWebPage=function(a){var c=document.getElementById("logInfoList");if(!c){var d=document.createElement("Div");d.setAttribute("id","logInfoDiv");cc.canvas.parentNode.appendChild(d);d.setAttribute("width","200");d.setAttribute("height",cc.canvas.height);d.style.zIndex="99999";d.style.position="absolute";d.style.top="0";d.style.left="0";c=document.createElement("ul");d.appendChild(c);c.setAttribute("id","logInfoList");c.style.height=cc.canvas.height+"px";c.style.color="#fff";c.style.textAlign=
"left";c.style.listStyle="disc outside";c.style.fontSize="12px";c.style.fontFamily="arial";c.style.padding="0 0 0 20px";c.style.margin="0";c.style.textShadow="0 0 3px #000";c.style.zIndex="99998";c.style.position="absolute";c.style.top="0";c.style.left="0";c.style.overflowY="hidden";var e=document.createElement("Div");d.appendChild(e);e.style.width="200px";e.style.height=cc.canvas.height+"px";e.style.opacity="0.1";e.style.background="#fff";e.style.border="1px solid #dfdfdf";e.style.borderRadius="8px"}d=
document.createElement("li");d.innerHTML=a;0==c.childNodes.length?c.appendChild(d):c.insertBefore(d,c.childNodes[0])};cc.log=function(a){cc.IS_SHOW_DEBUG_ON_PAGE?cc._logToWebPage(a):console.log.apply(console,arguments)};cc.MessageBox=function(a){console.log(a)};cc.Assert=function(a,c){console.assert?console.assert(a,c):a||c&&alert(c)};
cc.initDebugSetting=function(){0==cc.COCOS2D_DEBUG?(cc.log=function(){},cc.logINFO=function(){},cc.logERROR=function(){},cc.Assert=function(){}):1==cc.COCOS2D_DEBUG?(cc.logINFO=cc.log,cc.logERROR=function(){}):1<cc.COCOS2D_DEBUG&&(cc.logINFO=cc.log,cc.logERROR=cc.log)};cc.LANGUAGE_ENGLISH=0;cc.LANGUAGE_CHINESE=1;cc.LANGUAGE_FRENCH=2;cc.LANGUAGE_ITALIAN=3;cc.LANGUAGE_GERMAN=4;cc.LANGUAGE_SPANISH=5;cc.LANGUAGE_RUSSIAN=6;cc.LANGUAGE_KOREAN=7;cc.LANGUAGE_JAPANESE=8;cc.LANGUAGE_HUNGARIAN=9;
cc.LANGUAGE_PORTUGUESE=10;cc.LANGUAGE_ARABIC=11;cc.LANGUAGE_NORWEGIAN=12;cc.LANGUAGE_POLISH=13;
cc.KEY={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,"-":109,numdel:110,"/":111,f1:112,f2:113,
f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,semicolon:186,",":186,equal:187,"\x3d":187,";":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,"]":221,closebracket:221,backslash:220,quote:222,space:32};cc.FMT_JPG=0;cc.FMT_PNG=1;cc.FMT_TIFF=2;cc.FMT_RAWDATA=3;cc.FMT_WEBP=4;cc.FMT_UNKNOWN=5;
cc.getImageFormatByData=function(a){return 8<a.length&&137==a[0]&&80==a[1]&&78==a[2]&&71==a[3]&&13==a[4]&&10==a[5]&&26==a[6]&&10==a[7]?cc.FMT_PNG:2<a.length&&(73==a[0]&&73==a[1]||77==a[0]&&77==a[1]||255==a[0]&&216==a[1])?cc.FMT_TIFF:cc.FMT_UNKNOWN};var 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*$/;
cc.RectFromString=function(a){return(a=CCNS_REG2.exec(a))?cc.rect(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]),parseFloat(a[4])):cc.RectZero()};cc.PointFromString=function(a){return(a=CCNS_REG1.exec(a))?cc.p(parseFloat(a[1]),parseFloat(a[2])):cc.PointZero()};cc.SizeFromString=function(a){return(a=CCNS_REG1.exec(a))?cc.size(parseFloat(a[1]),parseFloat(a[2])):cc.SizeZero()};cc.doCallback=function(a,c,d){if(a)if(c&&"string"==typeof a)c[a](d);else c&&"function"==typeof a?a.call(c,d):a(d)};cc.INVALID_INDEX=-1;cc.PI=Math.PI;cc.FLT_MAX=parseFloat("3.402823466e+38F");cc.RAD=cc.PI/180;cc.DEG=180/cc.PI;cc.UINT_MAX=4294967295;cc.SWAP=function(a,c,d){if("object"==typeof d&&"undefined"!=typeof d.x&&"undefined"!=typeof d.y){var e=d[a];d[a]=d[c];d[c]=e}else cc.log("cc.SWAP is being modified from original macro, please check usage")};cc.lerp=function(a,c,d){return a+(c-a)*d};cc.RANDOM_MINUS1_1=function(){return 2*(Math.random()-0.5)};cc.RANDOM_0_1=function(){return Math.random()};
cc.DEGREES_TO_RADIANS=function(a){return a*cc.RAD};cc.RADIANS_TO_DEGREES=function(a){return a*cc.DEG};cc.REPEAT_FOREVER=Number.MAX_VALUE-1;cc.BLEND_SRC=cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA?1:770;cc.BLEND_DST=771;cc.NODE_DRAW_SETUP=function(a){a._shaderProgram&&(a._shaderProgram.use(),a._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4())};cc.ENABLE_DEFAULT_GL_STATES=function(){};cc.DISABLE_DEFAULT_GL_STATES=function(){};
cc.INCREMENT_GL_DRAWS=function(a){cc.g_NumberOfDraws+=a};cc.FLT_EPSILON=1.192092896E-7;cc.CONTENT_SCALE_FACTOR=cc.IS_RETINA_DISPLAY_SUPPORTED?function(){return cc.Director.getInstance().getContentScaleFactor()}:function(){return 1};cc.POINT_POINTS_TO_PIXELS=function(a){var c=cc.CONTENT_SCALE_FACTOR();return cc.p(a.x*c,a.y*c)};cc.SIZE_POINTS_TO_PIXELS=function(a){var c=cc.CONTENT_SCALE_FACTOR();return cc.size(a.width*c,a.height*c)};
cc.SIZE_PIXELS_TO_POINTS=function(a){var c=cc.CONTENT_SCALE_FACTOR();return cc.size(a.width/c,a.height/c)};cc.POINT_PIXELS_TO_POINTS=function(a){var c=cc.CONTENT_SCALE_FACTOR();return cc.p(a.x/c,a.y/c)};cc.RECT_PIXELS_TO_POINTS=cc.IS_RETINA_DISPLAY_SUPPORTED?function(a){var c=cc.CONTENT_SCALE_FACTOR();return cc.rect(a.x/c,a.y/c,a.width/c,a.height/c)}:function(a){return a};
cc.RECT_POINTS_TO_PIXELS=cc.IS_RETINA_DISPLAY_SUPPORTED?function(a){var c=cc.CONTENT_SCALE_FACTOR();return cc.rect(a.x*c,a.y*c,a.width*c,a.height*c)}:function(a){return a};if(!cc.Browser.supportWebGL){var gl=gl||{};gl.ONE=1;gl.ZERO=0;gl.SRC_ALPHA=770;gl.ONE_MINUS_SRC_ALPHA=771;gl.ONE_MINUS_DST_COLOR=775}cc.CHECK_GL_ERROR_DEBUG=function(){if(cc.renderMode==cc.WEBGL){var a=cc.renderContext.getError();a&&cc.log("WebGL error "+a)}};cc.SAX_NONE=0;cc.SAX_KEY=1;cc.SAX_DICT=2;cc.SAX_INT=3;cc.SAX_REAL=4;cc.SAX_STRING=5;cc.SAX_ARRAY=6;var Uint8Array=Uint8Array||Array;
if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){var IEBinaryToArray_ByteStr_Script='\x3c!-- IEBinaryToArray_ByteStr --\x3e\r\nFunction IEBinaryToArray_ByteStr(Binary)\r\n   IEBinaryToArray_ByteStr \x3d CStr(Binary)\r\nEnd Function\r\nFunction IEBinaryToArray_ByteStr_Last(Binary)\r\n   Dim lastIndex\r\n   lastIndex \x3d LenB(Binary)\r\n   if lastIndex mod 2 Then\r\n       IEBinaryToArray_ByteStr_Last \x3d Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\r\n   Else\r\n       IEBinaryToArray_ByteStr_Last \x3d ""\r\n   End If\r\nEnd Function\r\n',myVBScript=
document.createElement("script");myVBScript.type="text/vbscript";myVBScript.textContent=IEBinaryToArray_ByteStr_Script;document.body.appendChild(myVBScript);cc._convertResponseBodyToText=function(a){for(var c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+256*e)]=String.fromCharCode(d)+String.fromCharCode(e);d=IEBinaryToArray_ByteStr(a);a=IEBinaryToArray_ByteStr_Last(a);return d.replace(/[\s\S]/g,function(a){return c[a]})+a}}
cc.FileUtils=cc.Class.extend({_fileDataCache:null,_textFileCache:null,_directory:null,_filenameLookupDict:null,_searchResolutionsOrderArray:null,_searchPathArray:null,_defaultResRootPath:"",ctor:function(){this._fileDataCache={};this._textFileCache={};this._searchPathArray=[];this._searchPathArray.push(this._defaultResRootPath);this._searchResolutionsOrderArray=[];this._searchResolutionsOrderArray.push("")},purgeCachedEntries:function(){this._searchPathArray.length=0},getByteArrayFromFile:function(a,
c,d){a=this.fullPathForFilename(a);return this._fileDataCache[a]?this._fileDataCache[a]:this._loadBinaryFileData(a)},_getXMLHttpRequest:function(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP")},unloadBinaryFileData:function(a){this._fileDataCache[a]&&delete this._fileDataCache[a]},preloadBinaryFileData:function(a,c,d){a=this.fullPathForFilename(a);var e=this,f=this._getXMLHttpRequest();f.open("GET",a,!0);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?
(f.setRequestHeader("Accept-Charset","x-user-defined"),f.onreadystatechange=function(g){4==f.readyState&&(200==f.status?(g=cc._convertResponseBodyToText(f.responseBody))&&(e._fileDataCache[a]=e._stringConvertToArray(g)):cc.doCallback(c,d,a),cc.doCallback(c,d))}):(f.overrideMimeType&&f.overrideMimeType("text/plain; charset\x3dx-user-defined"),f.onload=function(g){(g=f.responseText)?e._fileDataCache[a]=e._stringConvertToArray(g):cc.doCallback(c,d,a);cc.doCallback(c,d)});f.send(null)},_loadBinaryFileData:function(a){var c=
this._getXMLHttpRequest();c.open("GET",a,!1);var d=null;if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){c.setRequestHeader("Accept-Charset","x-user-defined");c.send(null);if(200!=c.status)return cc.log("cocos2d: Unable to load file: "+a),null;if(c=cc._convertResponseBodyToText(c.responseBody))d=this._stringConvertToArray(c),this._fileDataCache[a]=d}else{c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dx-user-defined");c.send(null);if(200!=c.status)return cc.log("cocos2d: Unable to load file: "+
a),null;d=this._stringConvertToArray(c.responseText);this._fileDataCache[a]=d}return d},_stringConvertToArray:function(a){if(!a)return null;for(var c=new Uint8Array(a.length),d=0;d<a.length;d++)c[d]=a.charCodeAt(d)&255;return c},unloadTextFileData:function(a){a=this.fullPathForFilename(a);this._textFileCache[a]&&delete this._textFileCache[a]},preloadTextFileData:function(a,c,d){a=this.fullPathForFilename(a);var e=this,f=this._getXMLHttpRequest();f.open("GET",a,!0);/msie/i.test(navigator.userAgent)&&
!/opera/i.test(navigator.userAgent)?(f.setRequestHeader("Accept-Charset","utf-8"),f.onreadystatechange=function(g){4==f.readyState&&(200==f.status?(g=f.responseText)&&(e._textFileCache[a]=g):cc.doCallback(c,d,a),cc.doCallback(c,d))}):(f.overrideMimeType&&f.overrideMimeType("text/plain; charset\x3dutf-8"),f.onload=function(g){f.responseText?e._textFileCache[a]=f.responseText:cc.doCallback(c,d,a);cc.doCallback(c,d)});f.send(null)},_loadTextFileData:function(a){var c=this._getXMLHttpRequest();c.open("GET",
a,!1);var d=null;/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?c.setRequestHeader("Accept-Charset","utf-8"):c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8");c.send(null);if(200!=c.status)return null;(d=c.responseText)&&(this._textFileCache[a]=d);return d},getTextFileData:function(a){a=this.fullPathForFilename(a);return this._textFileCache[a]?this._textFileCache[a]:this._loadTextFileData(a)},getFileDataFromZip:function(a,c,d){},removeSuffixFromFile:function(a){},
popupNotify:!0,fullPathFromRelativePath:function(a){return a},fullPathForFilename:function(a){if(0<a.indexOf("://"))return a;var c=!1;a=this._getNewFilename(a);for(var d,e=0;e<this._searchPathArray.length;e++){for(var f=this._searchPathArray[e],g=0;g<this._searchResolutionsOrderArray.length;g++)if(d=this._getPathForFilename(a,this._searchResolutionsOrderArray[g],f)){c=!0;break}if(c)break}return c?d:a},loadFilenameLookup:function(a){var c=this.fullPathForFilename(a);if(0<c.length){var c=cc.SAXParser.getInstance().parse(c),
d=parseInt(c.metadata.version);1!=d?cc.log("cocos2d: ERROR: Invalid filenameLookup dictionary version: "+d+". Filename: "+a):this.setFilenameLookupDictionary(c.filenames)}},setFilenameLookupDictionary:function(a){this._filenameLookupDict=a},fullPathFromRelativeFile:function(a,c){var d;if(a)return d=c.substring(0,c.lastIndexOf("/")+1),d+a;d=c.substring(0,c.lastIndexOf("."));return d+".png"},setSearchResolutionsOrder:function(a){this._searchResolutionsOrderArray=a},getSearchResolutionsOrder:function(){return this._searchResolutionsOrderArray},
setSearchPath:function(a){this._searchPathArray=a},getSearchPath:function(){return this._searchPathArray},getResourceDirectory:function(){return this._directory},setResourcePath:function(a){},dictionaryWithContentsOfFile:function(a){cc.log("dictionaryWithContentsOfFile is deprecated. Use createDictionaryWithContentsOfFile instead");return this.createDictionaryWithContentsOfFile(a)},createDictionaryWithContentsOfFile:function(a){return cc.SAXParser.getInstance().parse(a)},getStringFromFile:function(a){return this.getTextFileData(a)},
dictionaryWithContentsOfFileThreadSafe:function(a){return cc.SAXParser.getInstance().parse(a)},getWritablePath:function(){return""},setPopupNotify:function(a){cc.popupNotify=a},isPopupNotify:function(){return cc.popupNotify},_resourceRootPath:"",getResourceRootPath:function(){return this._resourceRootPath},setResourceRootPath:function(a){this._resourceRootPath=a},_getNewFilename:function(a){var c=null;(c=this._filenameLookupDict?this._filenameLookupDict[a]:null)&&0!==c.length?cc.log("FOUND NEW FILE NAME: "+
c):c=a;return c},_getPathForFilename:function(a,c,d){var e;e=this.getResourceRootPath();a&&0<a.length&&(0===a.indexOf("/")||0===a.indexOf("\\"))?e="":0<e.length&&"\\"!=e[e.length-1]&&"/"!=e[e.length-1]&&(e+="/");var f=a,g="",h=a.lastIndexOf("/");-1!=h&&(g=a.substr(0,h+1),f=a.substr(h+1));a=d;0<a.length&&a.lastIndexOf("/")!==a.length-1&&(a+="/");c&&""!=c&&(a+=c+"/");a+=g;0<a.length&&a.lastIndexOf("/")!==a.length-1&&(a+="/");return e+=a+f},_getFullPathForDirectoryAndFilename:function(a,c){},setSearchPaths:function(a){for(var c=
!1,d=this._searchPathArray,e=d.length=0;e<a.length;e++){var f=a[e],g;this.isAbsolutePath(f)||(g=this._defaultResRootPath);f=g+f;0<f.length&&"/"!=f[f.length-1]&&(f+="/");c||f!=this._defaultResRootPath||(c=!0);d.push(f)}c||d.push(this._defaultResRootPath)},addSearchPath:function(a){var c;this.isAbsolutePath(a)||(c=this._defaultResRootPath);a=c+a;0<a.length&&"/"!=a[a.length-1]&&(a+="/");this._searchPathArray.push(a)},getSearchPaths:function(){},isAbsolutePath:function(a){return"/"==a[0]}});
cc.s_SharedFileUtils=null;cc.FileUtils.getInstance=function(){null==cc.s_SharedFileUtils&&(cc.s_SharedFileUtils=new cc.FileUtils);return cc.s_SharedFileUtils};cc.Color3B=function(a,c,d){switch(arguments.length){case 0:this.b=this.g=this.r=0;break;case 1:a&&a instanceof cc.Color3B?(this.r=0|a.r||0,this.g=0|a.g||0,this.b=0|a.b||0):this.b=this.g=this.r=0;break;case 3:this.r=0|a||0;this.g=0|c||0;this.b=0|d||0;break;default:throw"unknown argument type";}};cc.c3b=function(a,c,d){return new cc.Color3B(a,c,d)};cc.integerToColor3B=function(a){a=a||0;var c=new cc.Color3B;c.r=a&255;c.g=a>>8&255;c.b=a>>16&255;return c};cc.c3=cc.c3b;
cc.c3BEqual=function(a,c){return a.r===c.r&&a.g===c.g&&a.b===c.b};
Object.defineProperties(cc,{WHITE:{get:function(){return cc.c3b(255,255,255)}},YELLOW:{get:function(){return cc.c3b(255,255,0)}},BLUE:{get:function(){return cc.c3b(0,0,255)}},GREEN:{get:function(){return cc.c3b(0,255,0)}},RED:{get:function(){return cc.c3b(255,0,0)}},MAGENTA:{get:function(){return cc.c3b(255,0,255)}},BLACK:{get:function(){return cc.c3b(0,0,0)}},ORANGE:{get:function(){return cc.c3b(255,127,0)}},GRAY:{get:function(){return cc.c3b(166,166,166)}}});
cc.white=function(){return new cc.Color3B(255,255,255)};cc.yellow=function(){return new cc.Color3B(255,255,0)};cc.blue=function(){return new cc.Color3B(0,0,255)};cc.green=function(){return new cc.Color3B(0,255,0)};cc.red=function(){return new cc.Color3B(255,0,0)};cc.magenta=function(){return new cc.Color3B(255,0,255)};cc.black=function(){return new cc.Color3B(0,0,0)};cc.orange=function(){return new cc.Color3B(255,127,0)};cc.gray=function(){return new cc.Color3B(166,166,166)};
cc.Color4B=function(a,c,d,e){this.r=0|a;this.g=0|c;this.b=0|d;this.a=0|e};cc.c4b=function(a,c,d,e){return new cc.Color4B(a,c,d,e)};cc.c4=cc.c4b;cc.Color4F=function(a,c,d,e){this.r=a;this.g=c;this.b=d;this.a=e};cc.c4f=function(a,c,d,e){return new cc.Color4F(a,c,d,e)};cc.c4FFromccc3B=function(a){return new cc.Color4F(a.r/255,a.g/255,a.b/255,1)};cc.c4FFromccc4B=function(a){return new cc.Color4F(a.r/255,a.g/255,a.b/255,a.a/255)};
cc.c4BFromccc4F=function(a){return new cc.Color4B(0|255*a.r,0|255*a.g,0|255*a.b,0|255*a.a)};cc.c4FEqual=function(a,c){return a.r==c.r&&a.g==c.g&&a.b==c.b&&a.a==c.a};cc.Vertex2F=function(a,c){this.x=a||0;this.y=c||0};cc.Vertex2=function(a,c){return new cc.Vertex2F(a,c)};cc.Vertex3F=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0};cc.vertex3=function(a,c,d){return new cc.Vertex3F(a,c,d)};cc.Tex2F=function(a,c){this.u=a||0;this.v=c||0};cc.tex2=function(a,c){return new cc.Tex2F(a,c)};
cc.PointSprite=function(a,c,d){this.pos=a||new cc.Vertex2F(0,0);this.color=c||new cc.Color4B(0,0,0,0);this.size=d||0};cc.Quad2=function(a,c,d,e){this.tl=a||new cc.Vertex2F(0,0);this.tr=c||new cc.Vertex2F(0,0);this.bl=d||new cc.Vertex2F(0,0);this.br=e||new cc.Vertex2F(0,0)};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.GridSize=function(a,c){this.x=a;this.y=c};
cc.g=function(a,c){return new cc.GridSize(a,c)};cc.V2F_C4B_T2F=function(a,c,d){this.vertices=a||new cc.Vertex2F(0,0);this.colors=c||new cc.Color4B(0,0,0,0);this.texCoords=d||new cc.Tex2F(0,0)};cc.V2F_C4F_T2F=function(a,c,d){this.vertices=a||new cc.Vertex2F(0,0);this.colors=c||new cc.Color4F(0,0,0,0);this.texCoords=d||new cc.Tex2F(0,0)};cc.V3F_C4B_T2F=function(a,c,d){this.vertices=a||new cc.Vertex3F(0,0,0);this.colors=c||new cc.Color4B(0,0,0,0);this.texCoords=d||new cc.Tex2F(0,0)};
cc.V2F_C4B_T2F_Triangle=function(a,c,d){this.a=a||new cc.V2F_C4B_T2F;this.b=c||new cc.V2F_C4B_T2F;this.c=d||new cc.V2F_C4B_T2F};cc.V2F_C4B_T2F_Quad=function(a,c,d,e){this.bl=a||new cc.V2F_C4B_T2F;this.br=c||new cc.V2F_C4B_T2F;this.tl=d||new cc.V2F_C4B_T2F;this.tr=e||new cc.V2F_C4B_T2F};
cc.V2F_C4B_T2F_QuadZero=function(){return new cc.V2F_C4B_T2F_Quad(new cc.V2F_C4B_T2F(new cc.Vertex2F(0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)),new cc.V2F_C4B_T2F(new cc.Vertex2F(0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)),new cc.V2F_C4B_T2F(new cc.Vertex2F(0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)),new cc.V2F_C4B_T2F(new cc.Vertex2F(0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)))};
cc.V3F_C4B_T2F_Quad=function(a,c,d,e){this.tl=a||new cc.V3F_C4B_T2F;this.bl=c||new cc.V3F_C4B_T2F;this.tr=d||new cc.V3F_C4B_T2F;this.br=e||new cc.V3F_C4B_T2F};
cc.V3F_C4B_T2F_QuadZero=function(){return new cc.V3F_C4B_T2F_Quad(new cc.V3F_C4B_T2F(new cc.Vertex3F(0,0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)),new cc.V3F_C4B_T2F(new cc.Vertex3F(0,0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)),new cc.V3F_C4B_T2F(new cc.Vertex3F(0,0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)),new cc.V3F_C4B_T2F(new cc.Vertex3F(0,0,0),new cc.Color4B(0,0,0,255),new cc.Tex2F(0,0)))};
cc.V3F_C4B_T2F_QuadCopy=function(a){return a?new cc.V3F_C4B_T2F_Quad(new cc.V3F_C4B_T2F(new cc.Vertex3F(a.tl.vertices.x,a.tl.vertices.y,a.tl.vertices.z),new cc.Color4B(a.tl.colors.r,a.tl.colors.g,a.tl.colors.b,a.tl.colors.a),new cc.Tex2F(a.tl.texCoords.u,a.tl.texCoords.v)),new cc.V3F_C4B_T2F(new cc.Vertex3F(a.bl.vertices.x,a.bl.vertices.y,a.bl.vertices.z),new cc.Color4B(a.bl.colors.r,a.bl.colors.g,a.bl.colors.b,a.bl.colors.a),new cc.Tex2F(a.bl.texCoords.u,a.bl.texCoords.v)),new cc.V3F_C4B_T2F(new cc.Vertex3F(a.tr.vertices.x,
a.tr.vertices.y,a.tr.vertices.z),new cc.Color4B(a.tr.colors.r,a.tr.colors.g,a.tr.colors.b,a.tr.colors.a),new cc.Tex2F(a.tr.texCoords.u,a.tr.texCoords.v)),new cc.V3F_C4B_T2F(new cc.Vertex3F(a.br.vertices.x,a.br.vertices.y,a.br.vertices.z),new cc.Color4B(a.br.colors.r,a.br.colors.g,a.br.colors.b,a.br.colors.a),new cc.Tex2F(a.br.texCoords.u,a.br.texCoords.v))):cc.V3F_C4B_T2F_QuadZero()};
cc.V3F_C4B_T2F_QuadsCopy=function(a){if(!a)return[];for(var c=[],d=0;d<a.length;d++)c.push(cc.V3F_C4B_T2F_QuadCopy(a[d]));return c};cc.V2F_C4F_T2F_Quad=function(a,c,d,e){this.bl=a||new cc.V2F_C4F_T2F;this.br=c||new cc.V2F_C4F_T2F;this.tl=d||new cc.V2F_C4F_T2F;this.tr=e||new cc.V2F_C4F_T2F};cc.BlendFunc=function(a,c){this.src=a;this.dst=c};cc.BlendFuncDisable=function(){return new cc.BlendFunc(gl.ONE,gl.ZERO)};cc.T2F_Quad=function(a,c,d,e){this.bl=a;this.br=c;this.tl=d;this.tr=e};
cc.AnimationFrameData=function(a,c,d){this.texCoords=a;this.delay=c;this.size=d};cc.convertColor3BtoHexString=function(a){var c=a.r.toString(16),d=a.g.toString(16),e=a.b.toString(16);return"#"+(16>a.r?"0"+c:c)+(16>a.g?"0"+d:d)+(16>a.b?"0"+e:e)};
cc.Browser.supportWebGL&&(cc.Color4B=function(a,c,d,e,f,g){this._arrayBuffer=f||new ArrayBuffer(cc.Color4B.BYTES_PER_ELEMENT);this._offset=g||0;f=this._arrayBuffer;g=this._offset;var h=Uint8Array.BYTES_PER_ELEMENT;this._rU8=new Uint8Array(f,g,1);this._gU8=new Uint8Array(f,g+h,1);this._bU8=new Uint8Array(f,g+2*h,1);this._aU8=new Uint8Array(f,g+3*h,1);this._rU8[0]=a||0;this._gU8[0]=c||0;this._bU8[0]=d||0;this._aU8[0]=e||0},cc.Color4B.BYTES_PER_ELEMENT=4,Object.defineProperties(cc.Color4B.prototype,
{r:{get:function(){return this._rU8[0]},set:function(a){this._rU8[0]=a},enumerable:!0},g:{get:function(){return this._gU8[0]},set:function(a){this._gU8[0]=a},enumerable:!0},b:{get:function(){return this._bU8[0]},set:function(a){this._bU8[0]=a},enumerable:!0},a:{get:function(){return this._aU8[0]},set:function(a){this._aU8[0]=a},enumerable:!0}}),cc.Color4F=function(a,c,d,e,f,g){this._arrayBuffer=f||new ArrayBuffer(cc.Color4F.BYTES_PER_ELEMENT);this._offset=g||0;f=this._arrayBuffer;g=this._offset;var h=
Float32Array.BYTES_PER_ELEMENT;this._rF32=new Float32Array(f,g,1);this._rF32[0]=a||0;this._gF32=new Float32Array(f,g+h,1);this._gF32[0]=c||0;this._bF32=new Float32Array(f,g+2*h,1);this._bF32[0]=d||0;this._aF32=new Float32Array(f,g+3*h,1);this._aF32[0]=e||0},cc.Color4F.BYTES_PER_ELEMENT=16,Object.defineProperties(cc.Color4F.prototype,{r:{get:function(){return this._rF32[0]},set:function(a){this._rF32[0]=a},enumerable:!0},g:{get:function(){return this._gF32[0]},set:function(a){this._gF32[0]=a},enumerable:!0},
b:{get:function(){return this._bF32[0]},set:function(a){this._bF32[0]=a},enumerable:!0},a:{get:function(){return this._aF32[0]},set:function(a){this._aF32[0]=a},enumerable:!0}}),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,Object.defineProperties(cc.Vertex2F.prototype,
{x:{get:function(){return this._xF32[0]},set:function(a){this._xF32[0]=a},enumerable:!0},y:{get:function(){return this._yF32[0]},set:function(a){this._yF32[0]=a},enumerable:!0}}),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,Object.defineProperties(cc.Vertex3F.prototype,{x:{get:function(){return this._xF32[0]},set:function(a){this._xF32[0]=a},enumerable:!0},y:{get:function(){return this._yF32[0]},set:function(a){this._yF32[0]=a},enumerable:!0},z:{get:function(){return this._zF32[0]},set:function(a){this._zF32[0]=a},enumerable:!0}}),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,Object.defineProperties(cc.Tex2F.prototype,{u:{get:function(){return this._uF32[0]},set:function(a){this._uF32[0]=a},enumerable:!0},v:{get:function(){return this._vF32[0]},set:function(a){this._vF32[0]=a},enumerable:!0}}),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,Object.defineProperties(cc.Quad2.prototype,{tl:{get:function(){return this._tl},set:function(a){this._tl.x=a.x;this._tl.y=a.y},enumerable:!0},
tr:{get:function(){return this._tr},set:function(a){this._tr.x=a.x;this._tr.y=a.y},enumerable:!0},bl:{get:function(){return this._bl},set:function(a){this._bl.x=a.x;this._bl.y=a.y},enumerable:!0},br:{get:function(){return this._br},set:function(a){this._br.x=a.x;this._br.y=a.y},enumerable:!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?new cc.Color4B(c.r,c.g,c.b,c.a,e,f+g):new cc.Color4B(0,0,0,0,e,f+g);this._texCoords=d?new cc.Tex2F(d.u,d.v,e,f+g+cc.Color4B.BYTES_PER_ELEMENT):new cc.Tex2F(0,0,e,f+g+cc.Color4B.BYTES_PER_ELEMENT)},cc.V3F_C4B_T2F.BYTES_PER_ELEMENT=24,Object.defineProperties(cc.V3F_C4B_T2F.prototype,{vertices:{get:function(){return this._vertices},set:function(a){var c=this._vertices;c.x=a.x;c.y=a.y;c.z=a.z},enumerable:!0},colors:{get:function(){return this._colors},
set:function(a){var c=this._colors;c.r=a.r;c.g=a.g;c.b=a.b;c.a=a.a},enumerable:!0},texCoords:{get:function(){return this._texCoords},set:function(a){this._texCoords.u=a.u;this._texCoords.v=a.v},enumerable:!0}}),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,Object.defineProperties(cc.V3F_C4B_T2F_Quad.prototype,{tl:{get:function(){return this._tl},set:function(a){var c=
this._tl;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},bl:{get:function(){return this._bl},set:function(a){var c=this._bl;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},tr:{get:function(){return this._tr},set:function(a){var c=this._tr;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},br:{get:function(){return this._br},set:function(a){var c=this._br;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=
a.texCoords},enumerable:!0},arrayBuffer:{get:function(){return this._arrayBuffer},enumerable:!0}}),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.V2F_C4B_T2F=function(a,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V2F_C4B_T2F.BYTES_PER_ELEMENT);
this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex2F.BYTES_PER_ELEMENT;this._vertices=a?new cc.Vertex2F(a.x,a.y,e,f):new cc.Vertex2F(0,0,e,f);this._colors=c?new cc.Color4B(c.r,c.g,c.b,c.a,e,f+g):new cc.Color4B(0,0,0,0,e,f+g);this._texCoords=d?new cc.Tex2F(d.u,d.v,e,f+g+cc.Color4B.BYTES_PER_ELEMENT):new cc.Tex2F(0,0,e,f+g+cc.Color4B.BYTES_PER_ELEMENT)},cc.V2F_C4B_T2F.BYTES_PER_ELEMENT=20,Object.defineProperties(cc.V2F_C4B_T2F.prototype,{vertices:{get:function(){return this._vertices},
set:function(a){this._vertices.x=a.x;this._vertices.y=a.y},enumerable:!0},colors:{get:function(){return this._colors},set:function(a){var c=this._colors;c.r=a.r;c.g=a.g;c.b=a.b;c.a=a.a},enumerable:!0},texCoords:{get:function(){return this._texCoords},set:function(a){this._texCoords.u=a.u;this._texCoords.v=a.v},enumerable:!0}}),cc.V2F_C4B_T2F_Triangle=function(a,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;
var g=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;this._a=a?new cc.V2F_C4B_T2F(a.vertices,a.colors,a.texCoords,e,f):new cc.V2F_C4B_T2F(null,null,null,e,f);this._b=c?new cc.V2F_C4B_T2F(c.vertices,c.colors,c.texCoords,e,f+g):new cc.V2F_C4B_T2F(null,null,null,e,f+g);this._c=d?new cc.V2F_C4B_T2F(d.vertices,d.colors,d.texCoords,e,f+2*g):new cc.V2F_C4B_T2F(null,null,null,e,f+2*g)},cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT=60,Object.defineProperties(cc.V2F_C4B_T2F_Triangle.prototype,{a:{get:function(){return this._a},
set:function(a){var c=this._a;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},b:{get:function(){return this._b},set:function(a){var c=this._b;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},c:{get:function(){return this._c},set:function(a){var c=this._c;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0}}));
cc.convertHexNumToColor3B=function(a){var c=a.substr(1).split("");a=parseInt("0x"+c[0]+c[1]);var d=parseInt("0x"+c[2]+c[3]),c=parseInt("0x"+c[4]+c[5]);return new cc.Color3B(a,d,c)};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,c){if(null!=c){var d=this.__getKey();this._keyMapTb[d]=c;this._valueMapTb[d]=a}},objectForKey:function(a){if(null==a)return null;var c=this._keyMapTb,d;for(d in c)if(c[d]===a)return this._valueMapTb[d];return null},valueForKey:function(a){return this.objectForKey(a)},
removeObjectForKey:function(a){if(null!=a){var c=this._keyMapTb,d;for(d in c)if(c[d]===a){delete this._valueMapTb[d];delete c[d];break}}},removeObjectsForKeys:function(a){if(null!=a)for(var c=0;c<a.length;c++)this.removeObjectForKey(a[c])},allKeys:function(){var a=[],c=this._keyMapTb,d;for(d in c)a.push(c[d]);return a},removeAllObjects:function(){this._keyMapTb={};this._valueMapTb={}},count:function(){return this.allKeys().length}});
cc.FontDefinition=function(){this.fontName="Arial";this.fontSize=12;this.fontAlignmentH=cc.TEXT_ALIGNMENT_CENTER;this.fontAlignmentV=cc.VERTICAL_TEXT_ALIGNMENT_TOP;this.fontFillColor=cc.white();this.fontDimensions=cc.size(0,0);this.strokeEnabled=!1;this.strokeColor=cc.white();this.strokeSize=1;this.shadowEnabled=!1;this.shadowOffset=cc.size(0,0);this.shadowBlur=0;this.shadowOpacity=1};cc.RESOLUTION_POLICY={EXACT_FIT:0,NO_BORDER:1,SHOW_ALL:2,FIXED_HEIGHT:3,FIXED_WIDTH:4,UNKNOWN:5};cc.Touches=[];cc.TouchesIntergerDict={};
cc.EGLView=cc.Class.extend({_delegate:null,_frameSize:null,_designResolutionSize:null,_originalDesignResolutionSize:null,_viewPortRect:null,_visibleRect:null,_devicePixelRatio:1,_viewName:"",_resizeCallback:null,_scaleX:1,_originalScaleX:1,_scaleY:1,_originalScaleY:1,_indexBitsUsed:0,_maxTouches:5,_resolutionPolicy:null,_rpExactFit:null,_rpShowAll:null,_rpNoBorder:null,_rpFixedHeight:null,_rpFixedWidth:null,_initialized:!1,_captured:!1,_wnd:null,_hDC:null,_hRC:null,_accelerometerKeyHook:null,_supportTouch:!1,
_contentTranslateLeftTop:null,_menu:null,_frame:null,_frameZoomFactor:1,__resizeWithBrowserSize:!1,_isAdjustViewPort:!0,ctor:function(){this._frame=cc.container.parentNode===document.body?document.documentElement:cc.container.parentNode;this._frameSize=cc.size(0,0);this._initFrameSize();var a=cc.canvas.width,c=cc.canvas.height;this._designResolutionSize=cc.size(a,c);this._originalDesignResolutionSize=cc.size(a,c);this._viewPortRect=cc.rect(0,0,a,c);this._visibleRect=cc.rect(0,0,a,c);this._delegate=
cc.Director.getInstance().getTouchDispatcher();this._contentTranslateLeftTop={left:0,top:0};this._viewName="Cocos2dHTML5";cc.VisibleRect.init(this._designResolutionSize);this._rpExactFit=new cc.ResolutionPolicy(cc.ContainerStrategy.EQUAL_TO_FRAME,cc.ContentStrategy.EXACT_FIT);this._rpShowAll=new cc.ResolutionPolicy(cc.ContainerStrategy.PROPORTION_TO_FRAME,cc.ContentStrategy.SHOW_ALL);this._rpNoBorder=new cc.ResolutionPolicy(cc.ContainerStrategy.EQUAL_TO_FRAME,cc.ContentStrategy.NO_BORDER);this._rpFixedHeight=
new cc.ResolutionPolicy(cc.ContainerStrategy.EQUAL_TO_FRAME,cc.ContentStrategy.FIXED_HEIGHT);this._rpFixedWidth=new cc.ResolutionPolicy(cc.ContainerStrategy.EQUAL_TO_FRAME,cc.ContentStrategy.FIXED_WIDTH);this._hDC=cc.canvas;this._hRC=cc.renderContext},_resizeEvent:function(){var a=this._originalDesignResolutionSize.width,c=this._originalDesignResolutionSize.height;this._resizeCallback&&(this._initFrameSize(),this._resizeCallback.call());0<a&&this.setDesignResolutionSize(a,c,this._resolutionPolicy)},
resizeWithBrowserSize:function(a){a?this.__resizeWithBrowserSize||(this.__resizeWithBrowserSize=!0,a=this._resizeEvent.bind(this),window.addEventListener("resize",a,!1)):this.__resizeWithBrowserSize&&(this.__resizeWithBrowserSize=!0,a=this._resizeEvent.bind(this),window.removeEventListener("resize",a,!1))},setResizeCallback:function(a){if("function"==typeof a||null==a)this._resizeCallback=a},_initFrameSize:function(){var a=this._frameSize;a.width=this._frame.clientWidth;a.height=this._frame.clientHeight},
_adjustSizeKeepCanvasSize:function(a,c){var d=this._originalDesignResolutionSize.width,e=this._originalDesignResolutionSize.height;0<d&&this.setDesignResolutionSize(d,e,this._resolutionPolicy)},_setViewPortMeta:function(a,c){if(this._isAdjustViewPort){var d={"user-scalable":"no","maximum-scale":"1.0","initial-scale":"1.0"},e=document.getElementsByName("viewport"),f;0==e.length?(e=document.createElement("meta"),e.name="viewport",e.content="",document.head.appendChild(e)):e=e[0];if(cc.Browser.isMobile&&
"firefox"==cc.Browser.type)e.content="initial-scale:1";else{f=e.content;for(var g in d)RegExp(g).test(f)||(f+=(""==f?"":",")+g+"\x3d"+d[g]);e.content=f}}},_setScaleXYForRenderTexture:function(){var a=cc.CONTENT_SCALE_FACTOR();this._scaleY=this._scaleX=a},_resetScale:function(){this._scaleX=this._originalScaleX;this._scaleY=this._originalScaleY},_getUnUsedIndex:function(){var a,c=this._indexBitsUsed;for(a=0;a<this._maxTouches;a++){if(!(c&1))return this._indexBitsUsed|=1<<a,a;c>>=1}return-1},_removeUsedIndexBit:function(a){0>
a||a>=this._maxTouches||(a=~(1<<a),this._indexBitsUsed&=a)},_adjustSizeToBrowser:function(){},initialize:function(){this._initialized=!0},adjustViewPort:function(a){this._isAdjustViewPort=a},end:function(){},isOpenGLReady:function(){return null!=this._hDC&&null!=this._hRC},setFrameZoomFactor:function(a){this._frameZoomFactor=a;this.centerWindow();cc.Director.getInstance().setProjection(cc.Director.getInstance().getProjection())},swapBuffers:function(){},setIMEKeyboardState:function(a){},setContentTranslateLeftTop:function(a,
c){this._contentTranslateLeftTop={left:a,top:c}},getContentTranslateLeftTop:function(){return this._contentTranslateLeftTop},getFrameSize:function(){return cc.size(this._frameSize.width,this._frameSize.height)},setFrameSize:function(a,c){this._frameSize.width=a;this._frameSize.height=c;this._frame.style.width=a+"px";this._frame.style.height=c+"px";this._resizeEvent();cc.Director.getInstance().setProjection(cc.Director.getInstance().getProjection())},centerWindow:function(){},setAccelerometerKeyHook:function(a){this._accelerometerKeyHook=
a},getVisibleSize:function(){return this._visibleRect._size},getVisibleOrigin:function(){return this._visibleRect._origin},canSetContentScaleFactor:function(){return!0},getResolutionPolicy:function(){return this._resolutionPolicy},setResolutionPolicy:function(a){if(a instanceof cc.ResolutionPolicy)this._resolutionPolicy=a;else switch(a){case cc.RESOLUTION_POLICY.EXACT_FIT:this._resolutionPolicy=this._rpExactFit;break;case cc.RESOLUTION_POLICY.SHOW_ALL:this._resolutionPolicy=this._rpShowAll;break;
case cc.RESOLUTION_POLICY.NO_BORDER:this._resolutionPolicy=this._rpNoBorder;break;case cc.RESOLUTION_POLICY.FIXED_HEIGHT:this._resolutionPolicy=this._rpFixedHeight;break;case cc.RESOLUTION_POLICY.FIXED_WIDTH:this._resolutionPolicy=this._rpFixedWidth}},setDesignResolutionSize:function(a,c,d){if(isNaN(a)||0==a||isNaN(c)||0==c)cc.log("Resolution not valid");else{this.setResolutionPolicy(d);var e=this._resolutionPolicy;if(e){e.preApply(this);var f=this._frameSize.width,g=this._frameSize.height;cc.Browser.isMobile&&
this._setViewPortMeta(this._frameSize.width,this._frameSize.height);this._initFrameSize();if(d!=this._resolutionPolicy||a!=this._originalDesignResolutionSize.width||c!=this._originalDesignResolutionSize.height||f!=this._frameSize.width||g!=this._frameSize.height)this._designResolutionSize=cc.size(a,c),this._originalDesignResolutionSize=cc.size(a,c),a=e.apply(this,this._designResolutionSize),a.scale&&2==a.scale.length&&(this._scaleX=a.scale[0],this._scaleY=a.scale[1]),a.viewport instanceof cc.Rect&&
(a=this._viewPortRect=a.viewport,c=this._visibleRect,c._size.width=cc.canvas.width/this._scaleX,c._size.height=cc.canvas.height/this._scaleY,c._origin.x=-a.x/this._scaleX,c._origin.y=-a.y/this._scaleY),a=cc.Director.getInstance(),a._winSizeInPoints=this.getDesignResolutionSize(),e.postApply(this),cc.renderContextType==cc.WEBGL&&(a._createStatsLabel(),a.setGLDefaultValues()),this._originalScaleX=this._scaleX,this._originalScaleY=this._scaleY,cc.DOM&&cc.DOM._resetEGLViewDiv(),cc.VisibleRect.init(this.getVisibleSize())}else cc.log("should set resolutionPolicy")}},
getDesignResolutionSize:function(){return cc.size(this._designResolutionSize.width,this._designResolutionSize.height)},setTouchDelegate:function(a){this._delegate=a},setViewPortInPoints:function(a,c,d,e){var f=this._frameZoomFactor,g=this._scaleX,h=this._scaleY;cc.renderContext.viewport(a*g*f+this._viewPortRect.x*f,c*h*f+this._viewPortRect.y*f,d*g*f,e*h*f)},setScissorInPoints:function(a,c,d,e){var f=this._frameZoomFactor,g=this._scaleX,h=this._scaleY;cc.renderContext.scissor(a*g*f+this._viewPortRect.x*
f,c*h*f+this._viewPortRect.y*f,d*g*f,e*h*f)},isScissorEnabled:function(){var a=cc.renderContext;return a.isEnabled(a.SCISSOR_TEST)},getScissorRect:function(){var a=cc.renderContext,c=this._scaleX,d=this._scaleY,a=a.getParameter(a.SCISSOR_BOX);return cc.rect((a[0]-this._viewPortRect.x)/c,(a[1]-this._viewPortRect.y)/d,a[2]/c,a[3]/d)},setViewName:function(a){null!=a&&0<a.length&&(this._viewName=a)},getViewName:function(){return this._viewName},getViewPortRect:function(){return this._viewPortRect},getScaleX:function(){return this._scaleX},
getScaleY:function(){return this._scaleY},getDevicePixelRatio:function(){return this._devicePixelRatio},convertToLocationInView:function(a,c,d){return{x:this._devicePixelRatio*(a-d.left),y:this._devicePixelRatio*(d.top+d.height-c)}},handleTouchesBegin:function(a,c,d,e){for(var f=[],g=this._viewPortRect,h=this._scaleX,k=this._scaleY,m=0;m<a;++m){var n=c[m],p=d[m],q=e[m],s=0;if(null==cc.TouchesIntergerDict[n])if(s=this._getUnUsedIndex(),-1==s)cc.log("The touches is more than MAX_TOUCHES, nUnusedIndex \x3d "+
s);else{var r=cc.Touches[s]=new cc.Touch;r.setTouchInfo(s,(p-g.x)/h,(q-g.y)/k);cc.TouchesIntergerDict[n]=0|s;f.push(r)}}0!==f.length&&this._delegate.touchesBegan(f,null)},handleTouchesMove:function(a,c,d,e){for(var f=[],g=this._scaleX,h=this._scaleY,k=this._viewPortRect.x,m=this._viewPortRect.y,n=0;n<a;++n){var p=d[n],q=e[n],s=cc.TouchesIntergerDict[c[n]];if(null!=s){var r=cc.Touches[s];if(r)r.setTouchInfo(s,(p-k)/g,(q-m)/h),f.push(r);else return}}0!=f.length&&this._delegate.touchesMoved(f,null)},
handleTouchesEnd:function(a,c,d,e){var f=[];this.getSetOfTouchesEndOrCancel(f,a,c,d,e);this._delegate.touchesEnded(f,null)},handleTouchesCancel:function(a,c,d,e){var f=[];this.getSetOfTouchesEndOrCancel(f,a,c,d,e);this._delegate.touchesCancelled(f,null)},getSetOfTouchesEndOrCancel:function(a,c,d,e,f){for(var g=this._scaleX,h=this._scaleY,k=this._viewPortRect,m=0;m<c;++m){var n=d[m],p=e[m],q=f[m],s=cc.TouchesIntergerDict[n];if(null!=s){var r=cc.Touches[s];if(r)r.setTouchInfo(s,(p-k.x)/g,(q-k.y)/h),
a.push(r),cc.Touches[s]=null,this._removeUsedIndexBit(s),delete cc.TouchesIntergerDict[n];else break}}},touchesBegan:function(a,c){for(var d=[],e=[],f=[],g=0,h,k=0;k<a.length;k++)h=a[k],d[g]=h.getId()||k,e[g]=h.getLocation().x,f[g]=h.getLocation().y,++g;this.handleTouchesBegin(g,d,e,f)},touchesMoved:function(a,c){for(var d=[],e=[],f=[],g=0,h,k=0;k<a.length;k++)h=a[k],d[g]=h.getId()||k,e[g]=h.getLocation().x,f[g]=h.getLocation().y,++g;this.handleTouchesMove(g,d,e,f)},touchesEnded:function(a,c){for(var d=
[],e=[],f=[],g=0,h,k=0;k<a.length;k++)h=a[k],d[g]=h.getId()||k,e[g]=h.getLocation().x,f[g]=h.getLocation().y,++g;this.handleTouchesEnd(g,d,e,f)},touchesCancelled:function(a,c){for(var d=[],e=[],f=[],g=0,h,k=0;k<a.length;k++)h=a[k],d[g]=h.getId()||k,e[g]=h.getLocation().x,f[g]=h.getLocation().y,++g;this.handleTouchesCancel(g,d,e,f)}});cc.EGLView.getInstance=function(){this._instance||(cc.Director.getInstance(),this._instance=this._instance||new cc.EGLView,this._instance.initialize());return this._instance};
cc.ContainerStrategy=cc.Class.extend({_adjustRetina:!1,preApply:function(a){if("iOS"==sys.os||"OS X"==sys.os)this._adjustRetina=!0},apply:function(a,c){},postApply:function(a){},_setupContainer:function(a,c,d){var e=a._frame;cc.Browser.isMobile&&e==document.documentElement&&cc.Screen.getInstance().autoFullScreen(e);var e=cc.canvas,f=cc.container;f.style.width=e.style.width=c+"px";f.style.height=e.style.height=d+"px";f=a._devicePixelRatio=1;this._adjustRetina&&(f=a._devicePixelRatio=window.devicePixelRatio||
1);e.width=c*f;e.height=d*f;a=document.body;var g;a&&(g=a.style)&&(g.paddingTop=g.paddingTop||"0px",g.paddingRight=g.paddingRight||"0px",g.paddingBottom=g.paddingBottom||"0px",g.paddingLeft=g.paddingLeft||"0px",g.borderTop=g.borderTop||"0px",g.borderRight=g.borderRight||"0px",g.borderBottom=g.borderBottom||"0px",g.borderLeft=g.borderLeft||"0px",g.marginTop=g.marginTop||"0px",g.marginRight=g.marginRight||"0px",g.marginBottom=g.marginBottom||"0px",g.marginLeft=g.marginLeft||"0px")},_fixContainer:function(){document.body.insertBefore(cc.container,
document.body.firstChild);var a=document.body.style;a.width=window.innerWidth+"px";a.height=window.innerHeight+"px";a.overflow="hidden";a=cc.container.style;a.position="fixed";a.left=a.top="0px";document.body.scrollTop=0}});
cc.ContentStrategy=cc.Class.extend({_result:{scale:[1,1],viewport:null},_buildResult:function(a,c,d,e,f,g){2>Math.abs(a-d)&&(d=a);2>Math.abs(c-e)&&(e=c);a=cc.rect(Math.round((a-d)/2),Math.round((c-e)/2),d,e);cc.renderContextType==cc.CANVAS&&cc.renderContext.translate(a.x,a.y+e);this._result.scale=[f,g];this._result.viewport=a;return this._result},preApply:function(a){},apply:function(a,c){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)}}),c=cc.ContainerStrategy.extend({apply:function(a,c){var d=a._frameSize.width,e=a._frameSize.height,f=cc.container.style,p=c.width,q=c.height,s=d/p,r=e/q,t,u;s<r?(t=d,u=q*s):(t=p*r,u=e);p=Math.round((d-t)/2);u=Math.round((e-u)/2);this._setupContainer(a,d-2*p,e-2*u);f.marginLeft=p+"px";f.marginRight=p+"px";f.marginTop=u+"px";f.marginBottom=u+"px"}});a.extend({preApply:function(a){this._super(a);
a._frame=document.documentElement},apply:function(a){this._super(a);this._fixContainer()}});c.extend({preApply:function(a){this._super(a);a._frame=document.documentElement},apply:function(a,c){this._super(a,c);this._fixContainer()}});var d=cc.ContainerStrategy.extend({apply:function(a){this._setupContainer(a,cc.canvas.width,cc.canvas.height)}});cc.ContainerStrategy.EQUAL_TO_FRAME=new a;cc.ContainerStrategy.PROPORTION_TO_FRAME=new c;cc.ContainerStrategy.ORIGINAL_CONTAINER=new d;var a=cc.ContentStrategy.extend({apply:function(a,
c){var d=cc.canvas.width,e=cc.canvas.height;return this._buildResult(d,e,d,e,d/c.width,e/c.height)}}),c=cc.ContentStrategy.extend({apply:function(a,c){var d=cc.canvas.width,e=cc.canvas.height,f=c.width,p=c.height,q=d/f,s=e/p,r=0,t,u;q<s?(r=q,t=d,u=p*r):(r=s,t=f*r,u=e);return this._buildResult(d,e,t,u,r,r)}}),d=cc.ContentStrategy.extend({apply:function(a,c){var d=cc.canvas.width,e=cc.canvas.height,f=c.width,p=c.height,q=d/f,s=e/p,r,t,u;q<s?(r=s,t=f*r,u=e):(r=q,t=d,u=p*r);return this._buildResult(d,
e,t,u,r,r)}}),e=cc.ContentStrategy.extend({apply:function(a,c){var d=cc.canvas.width,e=cc.canvas.height,f=e/c.height;return this._buildResult(d,e,d,e,f,f)},postApply:function(a){cc.Director.getInstance()._winSizeInPoints=a.getVisibleSize()}}),f=cc.ContentStrategy.extend({apply:function(a,c){var d=cc.canvas.width,e=cc.canvas.height,f=d/c.width;return this._buildResult(d,e,d,e,f,f)},postApply:function(a){cc.Director.getInstance()._winSizeInPoints=a.getVisibleSize()}});cc.ContentStrategy.EXACT_FIT=new a;
cc.ContentStrategy.SHOW_ALL=new c;cc.ContentStrategy.NO_BORDER=new d;cc.ContentStrategy.FIXED_HEIGHT=new e;cc.ContentStrategy.FIXED_WIDTH=new f})();
cc.ResolutionPolicy=cc.Class.extend({_containerStrategy:null,_contentStrategy:null,ctor:function(a,c){this.setContainerStrategy(a);this.setContentStrategy(c)},preApply:function(a){this._containerStrategy.preApply(a);this._contentStrategy.preApply(a)},apply:function(a,c){this._containerStrategy.apply(a,c);return this._contentStrategy.apply(a,c)},postApply:function(a){this._containerStrategy.postApply(a);this._contentStrategy.postApply(a)},setContainerStrategy:function(a){a instanceof cc.ContainerStrategy&&
(this._containerStrategy=a)},setContentStrategy:function(a){a instanceof cc.ContentStrategy&&(this._contentStrategy=a)}});cc.Screen=cc.Class.extend({_supportsFullScreen:!1,_preOnFullScreenChange:null,_touchEvent:"",_fn:null,_fnMap:[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange",
"mozFullScreen","mozFullScreenElement"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement"]],init:function(){this._fn={};var a,c,d=this._fnMap,e;a=0;for(l=d.length;a<l;a++)if((c=d[a])&&c[1]in document){a=0;for(e=c.length;a<e;a++)this._fn[d[0][a]]=c[a];break}this._supportsFullScreen=void 0!=this._fn.requestFullscreen;this._touchEvent="ontouchstart"in window?"touchstart":"mousedown"},fullScreen:function(){return this._supportsFullScreen&&document[this._fn.fullscreenEnabled]},
requestFullScreen:function(a,c){if(this._supportsFullScreen){a=a||document.documentElement;a[this._fn.requestFullscreen]();if(c){var d=this._fn.fullscreenchange;this._preOnFullScreenChange&&document.removeEventListener(d,this._preOnFullScreenChange);this._preOnFullScreenChange=c;document.addEventListener(d,c,!1)}return a[this._fn.requestFullscreen]()}},exitFullScreen:function(){return this._supportsFullScreen?document[this._fn.exitFullscreen]():!0},autoFullScreen:function(a,c){function d(){f.requestFullScreen(a,
c);e.removeEventListener(f._touchEvent,d)}a=a||document.body;var e=cc.canvas||a,f=this;this.requestFullScreen(a,c);e.addEventListener(this._touchEvent,d)}});cc.Screen.getInstance=function(){if(!this._instance){var a=new cc.Screen;a.init();this._instance=a}return this._instance};cc.VisibleRect={_topLeft:cc.p(0,0),_topRight:cc.p(0,0),_top:cc.p(0,0),_bottomLeft:cc.p(0,0),_bottomRight:cc.p(0,0),_bottom:cc.p(0,0),_center:cc.p(0,0),_left:cc.p(0,0),_right:cc.p(0,0),_width:0,_height:0,init:function(a){this._width=a.width;this._height=a.height;a=this._width;var c=this._height;this._topLeft.y=c;this._topRight.x=a;this._topRight.y=c;this._top.x=a/2;this._top.y=c;this._bottomRight.x=a;this._bottom.x=a/2;this._center.x=a/2;this._center.y=c/2;this._left.y=c/2;this._right.x=a;this._right.y=
c/2},getWidth:function(){return this._width},getHeight:function(){return this._height},topLeft:function(){return cc.p(this._topLeft)},topRight:function(){return cc.p(this._topRight)},top:function(){return cc.p(this._top)},bottomLeft:function(){return cc.p(this._bottomLeft)},bottomRight:function(){return cc.p(this._bottomRight)},bottom:function(){return cc.p(this._bottom)},center:function(){return cc.p(this._center)},left:function(){return cc.p(this._left)},right:function(){return cc.p(this._right)}};cc.AffineTransform=function(a,c,d,e,f,g){this.a=a;this.b=c;this.c=d;this.d=e;this.tx=f;this.ty=g};cc.__AffineTransformMake=function(a,c,d,e,f,g){return{a:a,b:c,c:d,d:e,tx:f,ty:g}};cc.AffineTransformMake=function(a,c,d,e,f,g){return{a:a,b:c,c:d,d:e,tx:f,ty:g}};cc.__PointApplyAffineTransform=function(a,c){return{x:c.a*a.x+c.c*a.y+c.tx,y:c.b*a.x+c.d*a.y+c.ty}};cc.PointApplyAffineTransform=function(a,c){return{x:c.a*a.x+c.c*a.y+c.tx,y:c.b*a.x+c.d*a.y+c.ty}};
cc._PointApplyAffineTransform=function(a,c,d){return{x:d.a*a+d.c*c+d.tx,y:d.b*a+d.d*c+d.ty}};cc.__SizeApplyAffineTransform=function(a,c){return{width:c.a*a.width+c.c*a.height,height:c.b*a.width+c.d*a.height}};cc.SizeApplyAffineTransform=function(a,c){return{width:c.a*a.width+c.c*a.height,height:c.b*a.width+c.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,c){var d=cc.rectGetMinY(a),e=cc.rectGetMinX(a),f=cc.rectGetMaxX(a),g=cc.rectGetMaxY(a),h=cc._PointApplyAffineTransform(e,d,c),d=cc._PointApplyAffineTransform(f,d,c),e=cc._PointApplyAffineTransform(e,g,c),k=cc._PointApplyAffineTransform(f,g,c),f=Math.min(h.x,d.x,e.x,k.x),g=Math.max(h.x,d.x,e.x,k.x),m=Math.min(h.y,d.y,e.y,k.y),h=Math.max(h.y,d.y,e.y,k.y);return cc.rect(f,m,g-f,h-m)};
cc._RectApplyAffineTransformIn=function(a,c){var d=cc.rectGetMinY(a),e=cc.rectGetMinX(a),f=cc.rectGetMaxX(a),g=cc.rectGetMaxY(a),h=cc._PointApplyAffineTransform(e,d,c),d=cc._PointApplyAffineTransform(f,d,c),e=cc._PointApplyAffineTransform(e,g,c),k=cc._PointApplyAffineTransform(f,g,c),f=Math.min(h.x,d.x,e.x,k.x),g=Math.max(h.x,d.x,e.x,k.x),m=Math.min(h.y,d.y,e.y,k.y),h=Math.max(h.y,d.y,e.y,k.y);a.x=f;a.y=m;a.width=g-f;a.height=h-m;return a};
cc.AffineTransformTranslate=function(a,c,d){return{a:a.a,b:a.b,c:a.c,d:a.d,tx:a.tx+a.a*c+a.c*d,ty:a.ty+a.b*c+a.d*d}};cc.AffineTransformScale=function(a,c,d){return{a:a.a*c,b:a.b*c,c:a.c*d,d:a.d*d,tx:a.tx,ty:a.ty}};cc.AffineTransformRotate=function(a,c){var d=Math.sin(c),e=Math.cos(c);return{a:a.a*e+a.c*d,b:a.b*e+a.d*d,c:a.c*e-a.a*d,d:a.d*e-a.b*d,tx:a.tx,ty:a.ty}};
cc.AffineTransformConcat=function(a,c){return{a:a.a*c.a+a.b*c.c,b:a.a*c.b+a.b*c.d,c:a.c*c.a+a.d*c.c,d:a.c*c.b+a.d*c.d,tx:a.tx*c.a+a.ty*c.c+c.tx,ty:a.tx*c.b+a.ty*c.d+c.ty}};cc.AffineTransformEqualToTransform=function(a,c){return a.a===c.a&&a.b===c.b&&a.c===c.c&&a.d===c.d&&a.tx===c.tx&&a.ty===c.ty};cc.AffineTransformInvert=function(a){var c=1/(a.a*a.d-a.b*a.c);return{a:c*a.d,b:-c*a.b,c:-c*a.c,d:c*a.a,tx:c*(a.c*a.ty-a.d*a.tx),ty:c*(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,c){return cc.p(a.x+c.x,a.y+c.y)};cc.pSub=function(a,c){return cc.p(a.x-c.x,a.y-c.y)};cc.pMult=function(a,c){return cc.p(a.x*c,a.y*c)};cc.pMidpoint=function(a,c){return cc.pMult(cc.pAdd(a,c),0.5)};cc.pDot=function(a,c){return a.x*c.x+a.y*c.y};cc.pCross=function(a,c){return a.x*c.y-a.y*c.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,c){return cc.pMult(c,cc.pDot(a,c)/cc.pDot(c,c))};cc.pRotate=function(a,c){return cc.p(a.x*c.x-a.y*c.y,a.x*c.y+a.y*c.x)};cc.pUnrotate=function(a,c){return cc.p(a.x*c.x+a.y*c.y,a.y*c.x-a.x*c.y)};cc.pLengthSQ=function(a){return cc.pDot(a,a)};cc.pDistanceSQ=function(a,c){return cc.pLengthSQ(cc.pSub(a,c))};cc.pLength=function(a){return Math.sqrt(cc.pLengthSQ(a))};cc.pDistance=function(a,c){return cc.pLength(cc.pSub(a,c))};cc.pNormalize=function(a){return cc.pMult(a,1/cc.pLength(a))};
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,c,d){if(c>d){var e=c;c=d;d=e}return a<c?c:a<d?a:d};cc.pClamp=function(a,c,d){return cc.p(cc.clampf(a.x,c.x,d.x),cc.clampf(a.y,c.y,d.y))};cc.pFromSize=function(a){return cc.p(a.width,a.height)};cc.pCompOp=function(a,c){return cc.p(c(a.x),c(a.y))};cc.pLerp=function(a,c,d){return cc.pAdd(cc.pMult(a,1-d),cc.pMult(c,d))};
cc.pFuzzyEqual=function(a,c,d){return a.x-d<=c.x&&c.x<=a.x+d&&a.y-d<=c.y&&c.y<=a.y+d?!0:!1};cc.pCompMult=function(a,c){return cc.p(a.x*c.x,a.y*c.y)};cc.pAngleSigned=function(a,c){var d=cc.pNormalize(a),e=cc.pNormalize(c),d=Math.atan2(d.x*e.y-d.y*e.x,cc.pDot(d,e));return Math.abs(d)<cc.POINT_EPSILON?0:d};cc.pAngle=function(a,c){var d=Math.acos(cc.pDot(cc.pNormalize(a),cc.pNormalize(c)));return Math.abs(d)<cc.POINT_EPSILON?0:d};
cc.pRotateByAngle=function(a,c,d){a=cc.pSub(a,c);var e=Math.cos(d);d=Math.sin(d);var f=a.x;a.x=f*e-a.y*d+c.x;a.y=f*d+a.y*e+c.y;return a};cc.pLineIntersect=function(a,c,d,e,f){if(a.x==c.x&&a.y==c.y||d.x==e.x&&d.y==e.y)return!1;var g=c.x-a.x;c=c.y-a.y;var h=e.x-d.x;e=e.y-d.y;var k=a.x-d.x;a=a.y-d.y;d=e*g-h*c;f.x=h*a-e*k;f.y=g*a-c*k;if(0==d)return 0==f.x||0==f.y?!0:!1;f.x/=d;f.y/=d;return!0};
cc.pSegmentIntersect=function(a,c,d,e){var f=cc.p(0,0);return cc.pLineIntersect(a,c,d,e,f)&&0<=f.x&&1>=f.x&&0<=f.y&&1>=f.y?!0:!1};cc.pIntersectPoint=function(a,c,d,e){var f=cc.p(0,0);return cc.pLineIntersect(a,c,d,e,f)?(d=cc.p(0,0),d.x=a.x+f.x*(c.x-a.x),d.y=a.y+f.x*(c.y-a.y),d):cc.PointZero()};cc.pSameAs=function(a,c){return null!=a&&null!=c?a.x==c.x&&a.y==c.y:!1};cc.pZeroIn=function(a){a.x=0;a.y=0};cc.pIn=function(a,c){a.x=c.x;a.y=c.y};cc.pMultIn=function(a,c){a.x*=c;a.y*=c};
cc.pSubIn=function(a,c){a.x-=c.x;a.y-=c.y};cc.pAddIn=function(a,c){a.x+=c.x;a.y+=c.y};cc.pNormalizeIn=function(a){cc.pMultIn(a,1/Math.sqrt(a.x*a.x+a.y*a.y))};cc.vertexLineToPolygon=function(a,c,d,e,f){f+=e;if(!(1>=f)){c*=0.5;for(var g,h=f-1,k=e;k<f;k++){g=2*k;var m=cc.p(a[2*k],a[2*k+1]),n;if(0===k)n=cc.pPerp(cc.pNormalize(cc.pSub(m,cc.p(a[2*(k+1)],a[2*(k+1)+1]))));else if(k===h)n=cc.pPerp(cc.pNormalize(cc.pSub(cc.p(a[2*(k-1)],a[2*(k-1)+1]),m)));else{n=cc.p(a[2*(k-1)],a[2*(k-1)+1]);var p=cc.p(a[2*(k+1)],a[2*(k+1)+1]),q=cc.pNormalize(cc.pSub(p,m)),s=cc.pNormalize(cc.pSub(n,m)),r=Math.acos(cc.pDot(q,s));n=r<cc.DEGREES_TO_RADIANS(70)?cc.pPerp(cc.pNormalize(cc.pMidpoint(q,
s))):r<cc.DEGREES_TO_RADIANS(170)?cc.pNormalize(cc.pMidpoint(q,s)):cc.pPerp(cc.pNormalize(cc.pSub(p,n)))}n=cc.pMult(n,c);d[2*g]=m.x+n.x;d[2*g+1]=m.y+n.y;d[2*(g+1)]=m.x-n.x;d[2*(g+1)+1]=m.y-n.y}for(k=0==e?0:e-1;k<h;k++)g=2*k,a=g+2,c=cc.Vertex2(d[2*g],d[2*g+1]),f=cc.Vertex2(d[2*(g+1)],d[2*(g+1)+1]),g=cc.Vertex2(d[2*a],d[2*a]),e=cc.Vertex2(d[2*(a+1)],d[2*(a+1)+1]),c=!cc.vertexLineIntersect(c.x,c.y,e.x,e.y,f.x,f.y,g.x,g.y),!c.isSuccess&&(0>c.value||1<c.value)&&(c.isSuccess=!0),c.isSuccess&&(d[2*a]=e.x,
d[2*a+1]=e.y,d[2*(a+1)]=g.x,d[2*(a+1)+1]=g.y)}};cc.vertexLineIntersect=function(a,c,d,e,f,g,h,k){if(a==d&&c==e||f==h&&g==k)return{isSuccess:!1,value:0};d-=a;e-=c;f-=a;g-=c;h-=a;k-=c;a=Math.sqrt(d*d+e*e);d/=a;e/=a;c=f*d+g*e;g=g*d-f*e;f=c;c=h*d+k*e;k=k*d-h*e;h=c;return g==k?{isSuccess:!1,value:0}:{isSuccess:!0,value:(h+(f-h)*k/(k-g))/a}};cc.CGAffineToGL=function(a,c){c[2]=c[3]=c[6]=c[7]=c[8]=c[9]=c[11]=c[14]=0;c[10]=c[15]=1;c[0]=a.a;c[4]=a.c;c[12]=a.tx;c[1]=a.b;c[5]=a.d;c[13]=a.ty};cc.GLToCGAffine=function(a,c){c.a=a[0];c.c=a[4];c.tx=a[12];c.b=a[1];c.d=a[5];c.ty=a[13]};cc.NODE_TAG_INVALID=-1;cc.NODE_ON_ENTER=null;cc.NODE_ON_EXIT=null;cc.s_globalOrderOfArrival=1;
cc.Node=cc.Class.extend({_zOrder:0,_vertexZ:0,_rotationX:0,_rotationY:0,_scaleX:1,_scaleY:1,_position:null,_skewX:0,_skewY:0,_children:null,_visible:!0,_anchorPoint:null,_anchorPointInPoints:null,_contentSize:null,_running:!1,_parent:null,_ignoreAnchorPointForPosition:!1,_tag:cc.NODE_TAG_INVALID,_userData:null,_userObject:null,_transformDirty:!0,_inverseDirty:!0,_cacheDirty:!0,_transformGLDirty:null,_transform:null,_inverse:null,_reorderChildDirty:!1,_shaderProgram:null,_orderOfArrival:0,_actionManager:null,
_scheduler:null,_initializedNode:!1,_additionalTransformDirty:!1,_additionalTransform:null,_componentContainer:null,_isTransitionFinished:!1,_rotationRadiansX:0,_rotationRadiansY:0,_initNode:function(){this._anchorPoint=cc.p(0,0);this._anchorPointInPoints=cc.p(0,0);this._contentSize=cc.size(0,0);this._position=cc.p(0,0);this._children=[];this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0};var a=cc.Director.getInstance();this._actionManager=a.getActionManager();this._scheduler=a.getScheduler();this._initializedNode=
!0;this._additionalTransform=cc.AffineTransformMakeIdentity();cc.ComponentContainer&&(this._componentContainer=new cc.ComponentContainer(this))},init:function(){!1===this._initializedNode&&this._initNode();return!0},_arrayMakeObjectsPerformSelector:function(a,c){if(a&&0!==a.length){var d,e=a.length,f;d=cc.Node.StateCallbackType;switch(c){case d.onEnter:for(d=0;d<e;d++)if(f=a[d])f.onEnter();break;case d.onExit:for(d=0;d<e;d++)if(f=a[d])f.onExit();break;case d.onEnterTransitionDidFinish:for(d=0;d<e;d++)if(f=
a[d])f.onEnterTransitionDidFinish();break;case d.cleanup:for(d=0;d<e;d++)(f=a[d])&&f.cleanup();break;case d.updateTransform:for(d=0;d<e;d++)(f=a[d])&&f.updateTransform();break;case d.onExitTransitionDidStart:for(d=0;d<e;d++)if(f=a[d])f.onExitTransitionDidStart();break;case d.sortAllChildren:for(d=0;d<e;d++)(f=a[d])&&f.sortAllChildren();break;default:throw"Unknown callback function";}}},setNodeDirty:null,_setNodeDirtyForCanvas:function(){this._setNodeDirtyForCache();!1===this._transformDirty&&(this._transformDirty=
this._inverseDirty=!0)},_setNodeDirtyForWebGL:function(){!1===this._transformDirty&&(this._transformDirty=this._inverseDirty=!0)},getSkewX:function(){return this._skewX},setSkewX:function(a){this._skewX=a;this.setNodeDirty()},getSkewY:function(){return this._skewY},setSkewY:function(a){this._skewY=a;this.setNodeDirty()},getZOrder:function(){return this._zOrder},_setZOrder:function(a){this._zOrder=a},setZOrder:function(a){this._parent?this._parent.reorderChild(this,a):this._setZOrder(a)},getVertexZ:function(){return this._vertexZ},
setVertexZ:function(a){this._vertexZ=a},getRotation:function(){this._rotationX!==this._rotationY&&cc.log("cc.Node.rotation(): RotationX !\x3d RotationY. Don't know which one to return");return this._rotationX},setRotation:function(a){this._rotationX=this._rotationY=a;this._rotationRadiansX=0.017453292519943295*this._rotationX;this._rotationRadiansY=0.017453292519943295*this._rotationY;this.setNodeDirty()},getRotationX:function(){return this._rotationX},setRotationX:function(a){this._rotationX=a;this._rotationRadiansX=
0.017453292519943295*this._rotationX;this.setNodeDirty()},getRotationY:function(){return this._rotationY},setRotationY:function(a){this._rotationY=a;this._rotationRadiansY=0.017453292519943295*this._rotationY;this.setNodeDirty()},getScale:function(){this._scaleX!==this._scaleY&&cc.log("cc.Node.getScale(): ScaleX !\x3d ScaleY. Don't know which one to return");return this._scaleX},setScale:function(a,c){this._scaleX=a;this._scaleY=c||0===c?c:a;this.setNodeDirty()},getScaleX:function(){return this._scaleX},
setScaleX:function(a){this._scaleX=a;this.setNodeDirty()},getScaleY:function(){return this._scaleY},setScaleY:function(a){this._scaleY=a;this.setNodeDirty()},setPosition:function(a,c){var d=this._position;void 0===c?(d.x=a.x,d.y=a.y):(d.x=a,d.y=c);this.setNodeDirty()},getPosition:function(){return cc.p(this._position)},getPositionX:function(){return this._position.x},setPositionX:function(a){this._position.x=a;this.setNodeDirty()},getPositionY:function(){return this._position.y},setPositionY:function(a){this._position.y=
a;this.setNodeDirty()},getChildrenCount:function(){return this._children.length},getChildren:function(){return this._children},isVisible:function(){return this._visible},setVisible:function(a){this._visible=a;this.setNodeDirty()},getAnchorPoint:function(){return cc.p(this._anchorPoint)},setAnchorPoint:function(a,c){var d=this._anchorPoint;if(void 0===c){if(a.x===d.x&&a.y===d.y)return;d.x=a.x;d.y=a.y}else{if(a===d.x&&c===d.y)return;d.x=a;d.y=c}var e=this._anchorPointInPoints,f=this._contentSize;e.x=
f.width*d.x;e.y=f.height*d.y;this.setNodeDirty()},getAnchorPointInPoints:function(){return cc.p(this._anchorPointInPoints)},getContentSize:function(){return cc.size(this._contentSize)},setContentSize:function(a,c){var d=this._contentSize;if(void 0===c){if(a.width===d.width&&a.height===d.height)return;d.width=a.width;d.height=a.height}else{if(a===d.width&&c===d.height)return;d.width=a;d.height=c}var e=this._anchorPointInPoints,f=this._anchorPoint;e.x=d.width*f.x;e.y=d.height*f.y;this.setNodeDirty()},
isRunning:function(){return this._running},getParent:function(){return this._parent},setParent:function(a){this._parent=a},isIgnoreAnchorPointForPosition:function(){return this._ignoreAnchorPointForPosition},ignoreAnchorPointForPosition:function(a){a!=this._ignoreAnchorPointForPosition&&(this._ignoreAnchorPointForPosition=a,this.setNodeDirty())},getTag:function(){return this._tag},setTag:function(a){this._tag=a},getUserData:function(){return this._userData},setUserData:function(a){this._userData=
a},getUserObject:function(){return this._userObject},setUserObject:function(a){this._userObject!=a&&(this._userObject=a)},getOrderOfArrival:function(){return this._orderOfArrival},setOrderOfArrival:function(a){this._orderOfArrival=a},getActionManager:function(){this._actionManager||(this._actionManager=cc.Director.getInstance().getActionManager());return this._actionManager},setActionManager:function(a){this._actionManager!=a&&(this.stopAllActions(),this._actionManager=a)},getScheduler:function(){this._scheduler||
(this._scheduler=cc.Director.getInstance().getScheduler());return this._scheduler},setScheduler:function(a){this._scheduler!=a&&(this.unscheduleAllCallbacks(),this._scheduler=a)},getBoundingBox:function(){var a=cc.rect(0,0,this._contentSize.width,this._contentSize.height);return cc._RectApplyAffineTransformIn(a,this.nodeToParentTransform())},cleanup:function(){this.stopAllActions();this.unscheduleAllCallbacks();this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.cleanup)},
description:function(){return"\x3ccc.Node | Tag \x3d"+this._tag+"\x3e"},getChildByTag:function(a){var c=this._children;if(null!=c)for(var d=0;d<c.length;d++){var e=c[d];if(e&&e._tag==a)return e}return null},addChild:function(a,c,d){if(!a)throw"cc.Node.addChild(): child must be non-null";if(a===this)cc.log("cc.Node.addChild(): An Node can't be added as a child of itself.");else if(null!==a._parent)cc.log("cc.Node.addChild(): child already added. It can't be added again");else if(c=null!=c?c:a._zOrder,
a._tag=null!=d?d:a._tag,this._insertChild(a,c),a._parent=this,this._running&&(a.onEnter(),this._isTransitionFinished))a.onEnterTransitionDidFinish()},removeFromParent:function(a){this._parent&&(null==a&&(a=!0),this._parent.removeChild(this,a))},removeFromParentAndCleanup:function(a){cc.log("removeFromParentAndCleanup is deprecated. Use removeFromParent instead");this.removeFromParent(a)},removeChild:function(a,c){0!==this._children.length&&(null==c&&(c=!0),-1<this._children.indexOf(a)&&this._detachChild(a,
c),this.setNodeDirty())},removeChildByTag:function(a,c){a===cc.NODE_TAG_INVALID&&cc.log("cc.Node.removeChildByTag(): argument tag is an invalid tag");var d=this.getChildByTag(a);null==d?cc.log("cocos2d: removeChildByTag(tag \x3d "+a+"): child not found!"):this.removeChild(d,c)},removeAllChildrenWithCleanup:function(a){cc.log("removeAllChildrenWithCleanup is deprecated. Use removeAllChildren instead");this.removeAllChildren(a)},removeAllChildren:function(a){var c=this._children;if(null!=c){null==a&&
(a=!0);for(var d=0;d<c.length;d++){var e=c[d];e&&(this._running&&(e.onExitTransitionDidStart(),e.onExit()),a&&e.cleanup(),e.setParent(null))}this._children.length=0}},_detachChild:function(a,c){this._running&&(a.onExitTransitionDidStart(),a.onExit());c&&a.cleanup();a.setParent(null);cc.ArrayRemoveObject(this._children,a)},_insertChild:function(a,c){this._reorderChildDirty=!0;this._children.push(a);a._setZOrder(c)},reorderChild:function(a,c){if(!a)throw"cc.Node.reorderChild(): child must be non-null";
this._reorderChildDirty=!0;a.setOrderOfArrival(cc.s_globalOrderOfArrival++);a._setZOrder(c);this.setNodeDirty()},sortAllChildren:function(){if(this._reorderChildDirty){var a=this._children,c,d,e=a.length,f;for(c=0;c<e;c++){var g=a[c];d=c-1;for(f=a[d];0<=d&&(g._zOrder<f._zOrder||g._zOrder==f._zOrder&&g._orderOfArrival<f._orderOfArrival);)a[d+1]=f,d-=1,f=a[d];a[d+1]=g}this._reorderChildDirty=!1}},draw:function(a){},transformAncestors:function(){null!=this._parent&&(this._parent.transformAncestors(),
this._parent.transform())},onEnter:function(){this._isTransitionFinished=!1;this._running=!0;this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onEnter);this.resumeSchedulerAndActions()},onEnterTransitionDidFinish:function(){this._isTransitionFinished=!0;this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onEnterTransitionDidFinish)},onExitTransitionDidStart:function(){this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onExitTransitionDidStart)},
onExit:function(){this._running=!1;this.pauseSchedulerAndActions();this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.onExit);this._componentContainer&&this._componentContainer.removeAll()},runAction:function(a){if(!a)throw"cc.Node.runAction(): action must be non-null";this.getActionManager().addAction(a,this,!this._running);return a},stopAllActions:function(){this.getActionManager().removeAllActionsFromTarget(this)},stopAction:function(a){this.getActionManager().removeAction(a)},
stopActionByTag:function(a){a===cc.ACTION_TAG_INVALID?cc.log("cc.Node.stopActionBy(): argument tag an invalid tag"):this.getActionManager().removeActionByTag(a,this)},getActionByTag:function(a){return a===cc.ACTION_TAG_INVALID?(cc.log("cc.Node.getActionByTag(): argument tag is an invalid tag"),null):this.getActionManager().getActionByTag(a,this)},getNumberOfRunningActions:function(){return this.getActionManager().numberOfRunningActionsInTarget(this)},scheduleUpdate:function(){this.scheduleUpdateWithPriority(0)},
scheduleUpdateWithPriority:function(a){this.getScheduler().scheduleUpdateForTarget(this,a,!this._running)},unscheduleUpdate:function(){this.getScheduler().unscheduleUpdateForTarget(this)},schedule:function(a,c,d,e){c=c||0;if(!a)throw"cc.Node.schedule(): callback function must be non-null";if(0>c)throw"cc.Node.schedule(): interval must be positive";d=null==d?cc.REPEAT_FOREVER:d;e=e||0;this.getScheduler().scheduleCallbackForTarget(this,a,c,d,e,!this._running)},scheduleOnce:function(a,c){this.schedule(a,
0,0,c)},unschedule:function(a){a&&this.getScheduler().unscheduleCallbackForTarget(this,a)},unscheduleAllCallbacks:function(){this.getScheduler().unscheduleAllCallbacksForTarget(this)},resumeSchedulerAndActions:function(){this.getScheduler().resumeTarget(this);this.getActionManager().resumeTarget(this)},pauseSchedulerAndActions:function(){this.getScheduler().pauseTarget(this);this.getActionManager().pauseTarget(this)},setAdditionalTransform:function(a){this._additionalTransform=a;this._additionalTransformDirty=
this._transformDirty=!0},parentToNodeTransform:function(){this._inverseDirty&&(this._inverse=cc.AffineTransformInvert(this.nodeToParentTransform()),this._inverseDirty=!1);return this._inverse},nodeToWorldTransform:function(){for(var a=this.nodeToParentTransform(),c=this._parent;null!=c;c=c.getParent())a=cc.AffineTransformConcat(a,c.nodeToParentTransform());return a},worldToNodeTransform:function(){return cc.AffineTransformInvert(this.nodeToWorldTransform())},convertToNodeSpace:function(a){return cc.PointApplyAffineTransform(a,
this.worldToNodeTransform())},convertToWorldSpace:function(a){return cc.PointApplyAffineTransform(a,this.nodeToWorldTransform())},convertToNodeSpaceAR:function(a){return cc.pSub(this.convertToNodeSpace(a),this._anchorPointInPoints)},convertToWorldSpaceAR:function(a){a=cc.pAdd(a,this._anchorPointInPoints);return this.convertToWorldSpace(a)},_convertToWindowSpace:function(a){a=this.convertToWorldSpace(a);return cc.Director.getInstance().convertToUI(a)},convertTouchToNodeSpace:function(a){a=a.getLocation();
return this.convertToNodeSpace(a)},convertTouchToNodeSpaceAR:function(a){a=a.getLocation();a=cc.Director.getInstance().convertToGL(a);return this.convertToNodeSpaceAR(a)},update:function(a){this._componentContainer&&!this._componentContainer.isEmpty()&&this._componentContainer.visit(a)},updateTransform:function(){this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.updateTransform)},retain:function(){},release:function(){},getComponent:function(a){return this._componentContainer.getComponent(a)},
addComponent:function(a){this._componentContainer.add(a)},removeComponent:function(a){return this._componentContainer.remove(a)},removeAllComponents:function(){this._componentContainer.removeAll()},_transform4x4:null,_stackMatrix:null,_glServerState:null,_camera:null,_grid:null,ctor:null,_ctorForCanvas:function(){this._initNode()},_ctorForWebGL:function(){this._initNode();var a=new cc.kmMat4;a.mat[2]=a.mat[3]=a.mat[6]=a.mat[7]=a.mat[8]=a.mat[9]=a.mat[11]=a.mat[14]=0;a.mat[10]=a.mat[15]=1;this._transform4x4=
a;this._glServerState=0;this._stackMatrix=new cc.kmMat4},visit:null,_visitForCanvas:function(a){if(this._visible){a=a||cc.renderContext;var c,d=this._children,e;a.save();this.transform(a);var f=d.length;if(0<f){this.sortAllChildren();for(c=0;c<f;c++)if(e=d[c],0>e._zOrder)e.visit(a);else break;for(this.draw(a);c<f;c++)d[c].visit(a)}else this.draw(a);this._orderOfArrival=0;a.restore()}},_visitForWebGL:function(){if(this._visible){var a=cc.renderContext,c,d=cc.current_stack;d.stack.push(d.top);cc.kmMat4Assign(this._stackMatrix,
d.top);d.top=this._stackMatrix;var e=this._grid;e&&e._active&&e.beforeDraw();this.transform();var f=this._children;if(f&&0<f.length){var g=f.length;this.sortAllChildren();for(c=0;c<g;c++)if(f[c]&&0>f[c]._zOrder)f[c].visit();else break;for(this.draw(a);c<g;c++)f[c]&&f[c].visit()}else this.draw(a);this._orderOfArrival=0;e&&e._active&&e.afterDraw(this);d.top=d.stack.pop()}},transform:null,_transformForCanvas:function(a){a=a||cc.renderContext;var c=cc.EGLView.getInstance(),d=this.nodeToParentTransform();
a.transform(d.a,d.c,d.b,d.d,d.tx*c.getScaleX(),-d.ty*c.getScaleY())},_transformForWebGL:function(){var a=this._transform4x4,c=cc.current_stack.top,d=this.nodeToParentTransform(),e=a.mat;e[0]=d.a;e[4]=d.c;e[12]=d.tx;e[1]=d.b;e[5]=d.d;e[13]=d.ty;e[14]=this._vertexZ;cc.kmMat4Multiply(c,c,a);null==this._camera||null!=this._grid&&this._grid.isActive()||(a=this._anchorPointInPoints.x,c=this._anchorPointInPoints.y,0!==a||0!==c?(cc.kmGLTranslatef(cc.RENDER_IN_SUBPIXEL(a),cc.RENDER_IN_SUBPIXEL(c),0),this._camera.locate(),
cc.kmGLTranslatef(cc.RENDER_IN_SUBPIXEL(-a),cc.RENDER_IN_SUBPIXEL(-c),0)):this._camera.locate())},nodeToParentTransform:null,_nodeToParentTransformForCanvas:function(){if(this._transformDirty){var a=this._transform;a.tx=this._position.x;a.ty=this._position.y;var c=1,d=0;this._rotationX&&(c=Math.cos(this._rotationRadiansX),d=Math.sin(this._rotationRadiansX));a.a=a.d=c;a.b=-d;a.c=d;var e=this._scaleX,f=this._scaleY,g=this._anchorPointInPoints.x,h=this._anchorPointInPoints.y,k=1E-6>e&&-1E-6<e?1E-6:e,
m=1E-6>f&&-1E-6<f?1E-6:f;if(this._skewX||this._skewY){var n=Math.tan(-this._skewX*Math.PI/180),p=Math.tan(-this._skewY*Math.PI/180),q=h*n*k,s=g*p*m;a.a=c+-d*p;a.b=c*n+-d;a.c=d+c*p;a.d=d*n+c;a.tx+=c*q+-d*s;a.ty+=d*q+c*s}if(1!==e||1!==f)a.a*=k,a.c*=k,a.b*=m,a.d*=m;a.tx+=c*-g*k+-d*h*m;a.ty-=d*-g*k+c*h*m;this._ignoreAnchorPointForPosition&&(a.tx+=g,a.ty+=h);this._additionalTransformDirty&&(this._transform=cc.AffineTransformConcat(a,this._additionalTransform),this._additionalTransformDirty=!1);this._transformDirty=
!1}return this._transform},_nodeToParentTransformForWebGL:function(){if(this._transformDirty){var a=this._position.x,c=this._position.y,d=this._anchorPointInPoints.x,e=-d,f=this._anchorPointInPoints.y,g=-f,h=this._scaleX,k=this._scaleY;this._ignoreAnchorPointForPosition&&(a+=d,c+=f);var m=1,n=0,p=1,q=0;if(0!==this._rotationX||0!==this._rotationY)m=Math.cos(-this._rotationRadiansX),n=Math.sin(-this._rotationRadiansX),p=Math.cos(-this._rotationRadiansY),q=Math.sin(-this._rotationRadiansY);var s=this._skewX||
this._skewY;s||0===d&&0===f||(a+=p*e*h+-n*g*k,c+=q*e*h+m*g*k);var r=this._transform;r.a=p*h;r.b=q*h;r.c=-n*k;r.d=m*k;r.tx=a;r.ty=c;s&&(r=cc.AffineTransformConcat({a:1,b:Math.tan(cc.DEGREES_TO_RADIANS(this._skewY)),c:Math.tan(cc.DEGREES_TO_RADIANS(this._skewX)),d:1,tx:0,ty:0},r),0!==d||0!==f)&&(r=cc.AffineTransformTranslate(r,e,g));this._additionalTransformDirty&&(r=cc.AffineTransformConcat(r,this._additionalTransform),this._additionalTransformDirty=!1);this._transform=r;this._transformDirty=!1}return this._transform},
_setNodeDirtyForCache:function(){this._cacheDirty=!0;this._parent&&this._parent._setNodeDirtyForCache()},getCamera:function(){this._camera||(this._camera=new cc.Camera);return this._camera},getGrid:function(){return this._grid},setGrid:function(a){this._grid=a},getShaderProgram:function(){return this._shaderProgram},setShaderProgram:function(a){this._shaderProgram=a},getGLServerState:function(){return this._glServerState},setGLServerState:function(a){this._glServerState=a},getBoundingBoxToWorld:function(){var a=
cc.rect(0,0,this._contentSize.width,this._contentSize.height),c=this.nodeToWorldTransform(),a=cc.RectApplyAffineTransform(a,this.nodeToWorldTransform());if(!this._children)return a;for(var d=this._children,e=0;e<d.length;e++){var f=d[e];f&&f._visible&&(f=f._getBoundingBoxToCurrentNode(c))&&(a=cc.rectUnion(a,f))}return a},_getBoundingBoxToCurrentNode:function(a){var c=cc.rect(0,0,this._contentSize.width,this._contentSize.height);a=null==a?this.nodeToParentTransform():cc.AffineTransformConcat(this.nodeToParentTransform(),
a);c=cc.RectApplyAffineTransform(c,a);if(!this._children)return c;for(var d=this._children,e=0;e<d.length;e++){var f=d[e];f&&f._visible&&(f=f._getBoundingBoxToCurrentNode(a))&&(c=cc.rectUnion(c,f))}return c}});
cc.Browser.supportWebGL?(cc.Node.prototype.ctor=cc.Node.prototype._ctorForWebGL,cc.Node.prototype.setNodeDirty=cc.Node.prototype._setNodeDirtyForWebGL,cc.Node.prototype.visit=cc.Node.prototype._visitForWebGL,cc.Node.prototype.transform=cc.Node.prototype._transformForWebGL,cc.Node.prototype.nodeToParentTransform=cc.Node.prototype._nodeToParentTransformForWebGL):(cc.Node.prototype.ctor=cc.Node.prototype._ctorForCanvas,cc.Node.prototype.setNodeDirty=cc.Node.prototype._setNodeDirtyForCanvas,cc.Node.prototype.visit=
cc.Node.prototype._visitForCanvas,cc.Node.prototype.transform=cc.Node.prototype._transformForCanvas,cc.Node.prototype.nodeToParentTransform=cc.Node.prototype._nodeToParentTransformForCanvas);cc.Node.create=function(){return new cc.Node};cc.Node.StateCallbackType={onEnter:1,onExit:2,cleanup:3,onEnterTransitionDidFinish:4,updateTransform:5,onExitTransitionDidStart:6,sortAllChildren:7};
cc.NodeRGBA=cc.Node.extend({RGBAProtocol:!0,_displayedOpacity:255,_realOpacity:255,_displayedColor:null,_realColor:null,_cascadeColorEnabled:!1,_cascadeOpacityEnabled:!1,ctor:function(){cc.Node.prototype.ctor.call(this);this._realOpacity=this._displayedOpacity=255;this._displayedColor=cc.white();this._realColor=cc.white();this._cascadeOpacityEnabled=this._cascadeColorEnabled=!1},getOpacity:function(){return this._realOpacity},getDisplayedOpacity:function(){return this._displayedOpacity},setOpacity:function(a){this._displayedOpacity=
this._realOpacity=a;a=255;var c=this._parent;c&&c.RGBAProtocol&&c.isCascadeOpacityEnabled()&&(a=c.getDisplayedOpacity());this.updateDisplayedOpacity(a)},updateDisplayedOpacity:function(a){this._displayedOpacity=this._realOpacity*a/255;if(this._cascadeOpacityEnabled){a=this._children;for(var c=0;c<a.length;c++){var d=a[c];d&&d.RGBAProtocol&&d.updateDisplayedOpacity(this._displayedOpacity)}}},isCascadeOpacityEnabled:function(){return this._cascadeOpacityEnabled},setCascadeOpacityEnabled:function(a){this._cascadeOpacityEnabled!==
a&&((this._cascadeOpacityEnabled=a)?this._enableCascadeOpacity():this._disableCascadeOpacity())},_enableCascadeOpacity:function(){var a=255,c=this._parent;c&&c.RGBAProtocol&&c.isCascadeOpacityEnabled()&&(a=c.getDisplayedOpacity());this.updateDisplayedOpacity(a)},_disableCascadeOpacity:function(){this._displayedOpacity=this._realOpacity;for(var a=this._children,c=0;c<a.length;c++){var d=a[c];d&&d.RGBAProtocol&&d.updateDisplayedOpacity(255)}},getColor:function(){var a=this._realColor;return new cc.Color3B(a.r,
a.g,a.b)},getDisplayedColor:function(){return this._displayedColor},setColor:function(a){var c=this._displayedColor,d=this._realColor;c.r=d.r=a.r;c.g=d.g=a.g;c.b=d.b=a.b;a=(a=this._parent)&&a.RGBAProtocol&&a.isCascadeColorEnabled()?a.getDisplayedColor():cc.white();this.updateDisplayedColor(a)},updateDisplayedColor:function(a){var c=this._displayedColor,d=this._realColor;c.r=0|d.r*a.r/255;c.g=0|d.g*a.g/255;c.b=0|d.b*a.b/255;if(this._cascadeColorEnabled)for(a=this._children,d=0;d<a.length;d++){var e=
a[d];e&&e.RGBAProtocol&&e.updateDisplayedColor(c)}},isCascadeColorEnabled:function(){return this._cascadeColorEnabled},setCascadeColorEnabled:function(a){this._cascadeColorEnabled!==a&&((this._cascadeColorEnabled=a)?this._enableCascadeColor():this._disableCascadeColor())},_enableCascadeColor:function(){var a;a=(a=this._parent)&&a.RGBAProtocol&&a.isCascadeColorEnabled()?a.getDisplayedColor():cc.white();this.updateDisplayedColor(a)},_disableCascadeColor:function(){var a=this._displayedColor,c=this._realColor;
a.r=c.r;a.g=c.g;a.b=c.b;for(var a=this._children,c=cc.white(),d=0;d<a.length;d++){var e=a[d];e&&e.RGBAProtocol&&e.updateDisplayedColor(c)}},addChild:function(a,c,d){cc.Node.prototype.addChild.call(this,a,c,d);this._cascadeColorEnabled&&this._enableCascadeColor();this._cascadeOpacityEnabled&&this._enableCascadeOpacity()},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1}});cc.NodeRGBA.create=function(){var a=new cc.NodeRGBA;a.init();return a};cc.AtlasNode=cc.NodeRGBA.extend({RGBAProtocol:!0,_itemsPerRow:0,_itemsPerColumn:0,_itemWidth:0,_itemHeight:0,_colorUnmodified:null,_textureAtlas:null,_opacityModifyRGB:!1,_blendFunc:null,_quadsToDraw:0,_ignoreContentScaleFactor:!1,ctor:function(){cc.NodeRGBA.prototype.ctor.call(this);this._colorUnmodified=cc.white();this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._ignoreContentScaleFactor=!1},updateAtlasValues:function(){cc.log("cc.AtlasNode.updateAtlasValues(): Shall be overridden in subclasses")},
getColor:function(){return this._opacityModifyRGB?this._colorUnmodified:cc.NodeRGBA.prototype.getColor.call(this)},setOpacityModifyRGB:function(a){var c=this.getColor();this._opacityModifyRGB=a;this.setColor(c)},isOpacityModifyRGB:function(){return this._opacityModifyRGB},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,c){this._blendFunc=void 0===c?a:{src:a,dst:c}},setTextureAtlas:function(a){this._textureAtlas=a},getTextureAtlas:function(){return this._textureAtlas},getQuadsToDraw:function(){return this._quadsToDraw},
setQuadsToDraw:function(a){this._quadsToDraw=a},_textureForCanvas:null,_originalTexture:null,_uniformColor:null,_colorF32Array:null,initWithTileFile:function(a,c,d,e){if(!a)throw"cc.AtlasNode.initWithTileFile(): title should not be null";a=cc.TextureCache.getInstance().addImage(a);return this.initWithTexture(a,c,d,e)},initWithTexture:null,_initWithTextureForCanvas:function(a,c,d,e){this._itemWidth=c;this._itemHeight=d;this._opacityModifyRGB=!0;this._originalTexture=a;if(!this._originalTexture)return cc.log("cocos2d: Could not initialize cc.AtlasNode. Invalid Texture."),
!1;this._textureForCanvas=this._originalTexture;this._calculateMaxItems();this._quadsToDraw=e;return!0},_initWithTextureForWebGL:function(a,c,d,e){this._itemWidth=c;this._itemHeight=d;this._colorUnmodified=cc.white();this._opacityModifyRGB=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;c=this._realColor;this._colorF32Array=new Float32Array([c.r/255,c.g/255,c.b/255,this._realOpacity/255]);this._textureAtlas=new cc.TextureAtlas;this._textureAtlas.initWithTexture(a,e);if(!this._textureAtlas)return cc.log("cocos2d: Could not initialize cc.AtlasNode. Invalid Texture."),
!1;this._updateBlendFunc();this._updateOpacityModifyRGB();this._calculateMaxItems();this._quadsToDraw=e;this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR));this._uniformColor=cc.renderContext.getUniformLocation(this.getShaderProgram().getProgram(),"u_color");return!0},draw:null,_drawForWebGL:function(a){a=a||cc.renderContext;cc.NODE_DRAW_SETUP(this);cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst);a.uniform4fv(this._uniformColor,this._colorF32Array);
this._textureAtlas.drawNumberOfQuads(this._quadsToDraw,0)},setColor:null,_setColorForCanvas:function(a){var c=this._realColor;if(c.r!=a.r||c.g!=a.g||c.b!=a.b){c=new cc.Color3B(a.r,a.g,a.b);this._colorUnmodified=a;if(this._opacityModifyRGB){var d=this._displayedOpacity;c.r=c.r*d/255;c.g=c.g*d/255;c.b=c.b*d/255}cc.NodeRGBA.prototype.setColor.call(this,a);this.getTexture()&&(a=this._originalTexture.getHtmlElementObj())&&(c=cc.TextureCache.getInstance().getTextureColors(a))&&(d=cc.rect(0,0,a.width,a.height),
a=cc.generateTintImage(a,c,this._realColor,d),c=new cc.Texture2D,c.initWithElement(a),c.handleLoadedTexture(),this.setTexture(c))}},_setColorForWebGL:function(a){var c=cc.Color3B(a.r,a.g,a.b);this._colorUnmodified=a;var d=this._displayedOpacity;this._opacityModifyRGB&&(c.r=c.r*d/255,c.g=c.g*d/255,c.b=c.b*d/255);cc.NodeRGBA.prototype.setColor.call(this,a);a=this._displayedColor;this._colorF32Array=new Float32Array([a.r/255,a.g/255,a.b/255,d/255])},setOpacity:null,_setOpacityForCanvas:function(a){cc.NodeRGBA.prototype.setOpacity.call(this,
a);this._opacityModifyRGB&&this.setColor(this._colorUnmodified)},_setOpacityForWebGL:function(a){cc.NodeRGBA.prototype.setOpacity.call(this,a);this._opacityModifyRGB?this.setColor(this._colorUnmodified):(a=this._displayedColor,this._colorF32Array=new Float32Array([a.r/255,a.g/255,a.b/255,this._displayedOpacity/255]))},getTexture:null,_getTextureForCanvas:function(){return this._textureForCanvas},_getTextureForWebGL:function(){return this._textureAtlas.getTexture()},setTexture:null,_setTextureForCanvas:function(a){this._textureForCanvas=
a},_setTextureForWebGL:function(a){this._textureAtlas.setTexture(a);this._updateBlendFunc();this._updateOpacityModifyRGB()},_calculateMaxItems:null,_calculateMaxItemsForCanvas:function(){var a=this.getTexture().getContentSize();this._itemsPerColumn=0|a.height/this._itemHeight;this._itemsPerRow=0|a.width/this._itemWidth},_calculateMaxItemsForWebGL:function(){var a=this.getTexture(),c=a.getContentSize();this._ignoreContentScaleFactor&&(c=a.getContentSizeInPixels());this._itemsPerColumn=0|c.height/this._itemHeight;
this._itemsPerRow=0|c.width/this._itemWidth},_updateBlendFunc:function(){this._textureAtlas.getTexture().hasPremultipliedAlpha()||(this._blendFunc.src=gl.SRC_ALPHA,this._blendFunc.dst=gl.ONE_MINUS_SRC_ALPHA)},_updateOpacityModifyRGB:function(){this._opacityModifyRGB=this._textureAtlas.getTexture().hasPremultipliedAlpha()},_setIgnoreContentScaleFactor:function(a){this._ignoreContentScaleFactor=a}});
cc.Browser.supportWebGL?(cc.AtlasNode.prototype.initWithTexture=cc.AtlasNode.prototype._initWithTextureForWebGL,cc.AtlasNode.prototype.draw=cc.AtlasNode.prototype._drawForWebGL,cc.AtlasNode.prototype.setColor=cc.AtlasNode.prototype._setColorForWebGL,cc.AtlasNode.prototype.setOpacity=cc.AtlasNode.prototype._setOpacityForWebGL,cc.AtlasNode.prototype.getTexture=cc.AtlasNode.prototype._getTextureForWebGL,cc.AtlasNode.prototype.setTexture=cc.AtlasNode.prototype._setTextureForWebGL,cc.AtlasNode.prototype._calculateMaxItems=
cc.AtlasNode.prototype._calculateMaxItemsForWebGL):(cc.AtlasNode.prototype.initWithTexture=cc.AtlasNode.prototype._initWithTextureForCanvas,cc.AtlasNode.prototype.draw=cc.Node.prototype.draw,cc.AtlasNode.prototype.setColor=cc.AtlasNode.prototype._setColorForCanvas,cc.AtlasNode.prototype.setOpacity=cc.AtlasNode.prototype._setOpacityForCanvas,cc.AtlasNode.prototype.getTexture=cc.AtlasNode.prototype._getTextureForCanvas,cc.AtlasNode.prototype.setTexture=cc.AtlasNode.prototype._setTextureForCanvas,cc.AtlasNode.prototype._calculateMaxItems=
cc.AtlasNode.prototype._calculateMaxItemsForCanvas);cc.AtlasNode.create=function(a,c,d,e){var f=new cc.AtlasNode;return f.initWithTileFile(a,c,d,e)?f:null};cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888=0;cc.TEXTURE_2D_PIXEL_FORMAT_RGB888=1;cc.TEXTURE_2D_PIXEL_FORMAT_RGB565=2;cc.TEXTURE_2D_PIXEL_FORMAT_A8=3;cc.TEXTURE_2D_PIXEL_FORMAT_I8=4;cc.TEXTURE_2D_PIXEL_FORMAT_AI88=5;cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444=6;cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1=7;cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC4=8;cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC2=9;cc.TEXTURE_2D_PIXEL_FORMAT_DEFAULT=cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888;cc._defaultAlphaPixelFormat=cc.TEXTURE_2D_PIXEL_FORMAT_DEFAULT;
cc.PVRHaveAlphaPremultiplied_=!1;cc._texParams=function(a,c,d,e){this.minFilter=a||0;this.magFilter=c||0;this.wrapS=d||0;this.wrapT=e||0};
cc.Texture2DWebGL=cc.Class.extend({_pVRHaveAlphaPremultiplied:null,_pixelFormat:null,_pixelsWide:null,_pixelsHigh:null,_name:null,_contentSize:null,_maxS:null,_maxT:null,_hasPremultipliedAlpha:null,_hasMipmaps:!1,_shaderProgram:null,_isLoaded:!1,_htmlElementObj:null,_webTextureObj:null,_loadedEventListeners:null,ctor:function(){this._pixelsHigh=this._pixelsWide=0;this._name="";this._maxT=this._maxS=0;this._hasPremultipliedAlpha=!1;this._contentSize=cc.size(0,0);this._hasMipmaps=!1;this._pVRHaveAlphaPremultiplied=
!0;this._pixelFormat=cc.Texture2D.defaultAlphaPixelFormat();this._shaderProgram=null;this._isLoaded=!1;this._webTextureObj=this._htmlElementObj=null},releaseTexture:function(){this._webTextureObj&&cc.renderContext.deleteTexture(this._webTextureObj)},getPixelFormat:function(){return this._pixelFormat},getPixelsWide:function(){return this._pixelsWide},getPixelsHigh:function(){return this._pixelsHigh},getName:function(){return this._webTextureObj},getContentSize:function(){return cc.size(this._contentSize.width/
cc.CONTENT_SCALE_FACTOR(),this._contentSize.height/cc.CONTENT_SCALE_FACTOR())},getContentSizeInPixels:function(){return cc.size(this._contentSize)},getMaxS:function(){return this._maxS},setMaxS:function(a){this._maxS=a},getMaxT:function(){return this._maxT},setMaxT:function(a){this._maxT=a},getShaderProgram:function(){return this._shaderProgram},setShaderProgram:function(a){this._shaderProgram=a},hasPremultipliedAlpha:function(){return this._hasPremultipliedAlpha},hasMipmaps:function(){return this._hasMipmaps},
description:function(){return"\x3ccc.Texture2D | Name \x3d "+this._name+" | Dimensions \x3d "+this._pixelsWide+" x "+this._pixelsHigh+" | Coordinates \x3d ("+this._maxS+", "+this._maxT+")\x3e"},releaseData:function(a){},keepData:function(a,c){return a},initWithData:function(a,c,d,e,f){var g=cc.renderContext,h=0,h=c===cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888?24:this.bitsPerPixelForFormat(c),h=d*h/8;0===h%8?g.pixelStorei(g.UNPACK_ALIGNMENT,8):0===h%4?g.pixelStorei(g.UNPACK_ALIGNMENT,4):0===h%2?g.pixelStorei(g.UNPACK_ALIGNMENT,
2):g.pixelStorei(g.UNPACK_ALIGNMENT,1);this._webTextureObj=g.createTexture();cc.glBindTexture2D(this);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);switch(c){case cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888:g.texImage2D(g.TEXTURE_2D,0,g.RGBA,d,e,0,g.RGBA,g.UNSIGNED_BYTE,a);break;case cc.TEXTURE_2D_PIXEL_FORMAT_RGB888:g.texImage2D(g.TEXTURE_2D,
0,g.RGB,d,e,0,g.RGB,g.UNSIGNED_BYTE,a);break;case cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444:g.texImage2D(g.TEXTURE_2D,0,g.RGBA,d,e,0,g.RGBA,g.UNSIGNED_SHORT_4_4_4_4,a);break;case cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1:g.texImage2D(g.TEXTURE_2D,0,g.RGBA,d,e,0,g.RGBA,g.UNSIGNED_SHORT_5_5_5_1,a);break;case cc.TEXTURE_2D_PIXEL_FORMAT_RGB565:g.texImage2D(g.TEXTURE_2D,0,g.RGB,d,e,0,g.RGB,g.UNSIGNED_SHORT_5_6_5,a);break;case cc.TEXTURE_2D_PIXEL_FORMAT_AI88:g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE_ALPHA,d,e,0,g.LUMINANCE_ALPHA,
g.UNSIGNED_BYTE,a);break;case cc.TEXTURE_2D_PIXEL_FORMAT_A8:g.texImage2D(g.TEXTURE_2D,0,g.ALPHA,d,e,0,g.ALPHA,g.UNSIGNED_BYTE,a);break;case cc.TEXTURE_2D_PIXEL_FORMAT_I8:g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,d,e,0,g.LUMINANCE,g.UNSIGNED_BYTE,a);break;default:throw"NSInternalInconsistencyException";}this._contentSize.width=f.width;this._contentSize.height=f.height;this._pixelsWide=d;this._pixelsHigh=e;this._pixelFormat=c;this._maxS=f.width/d;this._maxT=f.height/e;this._hasMipmaps=this._hasPremultipliedAlpha=
!1;this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURE));return this._isLoaded=!0},drawAtPoint:function(a){var c=[0,this._maxT,this._maxS,this._maxT,0,0,this._maxS,0],d=this._pixelsWide*this._maxS,e=this._pixelsHigh*this._maxT;a=[a.x,a.y,0,d+a.x,a.y,0,a.x,e+a.y,0,d+a.x,e+a.y,0];cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS);this._shaderProgram.use();this._shaderProgram.setUniformsForBuiltins();cc.glBindTexture2D(this);
d=cc.renderContext;d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,d.FLOAT,!1,0,a);d.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,d.FLOAT,!1,0,c);d.drawArrays(d.TRIANGLE_STRIP,0,4)},drawInRect:function(a){var c=[0,this._maxT,this._maxS,this._maxT,0,0,this._maxS,0];a=[a.x,a.y,a.x+a.width,a.y,a.x,a.y+a.height,a.x+a.width,a.y+a.height];cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS);this._shaderProgram.use();this._shaderProgram.setUniformsForBuiltins();
cc.glBindTexture2D(this);var d=cc.renderContext;d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,d.FLOAT,!1,0,a);d.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,d.FLOAT,!1,0,c);d.drawArrays(d.TRIANGLE_STRIP,0,4)},initWithImage:function(a){if(null==a)return cc.log("cocos2d: cc.Texture2D. Can't create Texture. UIImage is nil"),!1;var c=a.getWidth(),d=a.getHeight(),e=cc.Configuration.getInstance().getMaxTextureSize();if(c>e||d>e)return cc.log("cocos2d: WARNING: Image ("+c+" x "+d+") is bigger than the supported "+
e+" x "+e),!1;this._isLoaded=!0;return this._initPremultipliedATextureWithImage(a,c,d)},initWithElement:function(a){a&&(this._webTextureObj=cc.renderContext.createTexture(),this._htmlElementObj=a)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._isLoaded},handleLoadedTexture:function(){this._isLoaded=!0;var a=cc.renderContext;cc.glBindTexture2D(this);a.pixelStorei(a.UNPACK_ALIGNMENT,4);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,this._htmlElementObj);
a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURE));cc.glBindTexture2D(null);a=this._htmlElementObj.height;this._pixelsWide=this._contentSize.width=this._htmlElementObj.width;this._pixelsHigh=this._contentSize.height=
a;this._pixelFormat=cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888;this._maxT=this._maxS=1;this._hasMipmaps=this._hasPremultipliedAlpha=!1;this._callLoadedEventCallbacks()},initWithString:function(a,c,d,e,f,g){3==arguments.length&&(c=arguments[1],d=arguments[2],e=cc.size(0,0),f=cc.TEXT_ALIGNMENT_CENTER,g=cc.VERTICAL_TEXT_ALIGNMENT_TOP);var h=new cc.Image,k;if(cc.VERTICAL_TEXT_ALIGNMENT_TOP===g)k=cc.TEXT_ALIGNMENT_CENTER===f?cc.ALIGN_TOP:cc.TEXT_ALIGNMENT_LEFT===f?cc.ALIGN_TOP_LEFT:cc.ALIGN_TOP_RIGHT;else if(cc.VERTICAL_TEXT_ALIGNMENT_CENTER===
g)k=cc.TEXT_ALIGNMENT_CENTER===f?cc.ALIGN_CENTER:cc.TEXT_ALIGNMENT_LEFT===f?cc.ALIGN_LEFT:cc.ALIGN_RIGHT;else if(cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM===g)k=cc.TEXT_ALIGNMENT_CENTER===f?cc.ALIGN_BOTTOM:cc.TEXT_ALIGNMENT_LEFT===f?cc.ALIGN_BOTTOM_LEFT:cc.ALIGN_BOTTOM_RIGHT;else return cc.log("Not supported alignment format!"),!1;return h.initWithString(a,e.width,e.height,k,c,d)?this.initWithImage(h):!1},initWithETCFile:function(a){return!1},initWithPVRFile:function(a){var c=!1,d=new cc.TexturePVR;(c=d.initWithContentsOfFile(a))?
(d.setRetainName(!0),this._name=d.getName(),this._maxT=this._maxS=1,this._pixelsWide=d.getWidth(),this._pixelsHigh=d.getHeight(),this._contentSize.width=this._pixelsWide,this._contentSize.height=this._pixelsHigh,this._hasPremultipliedAlpha=cc.PVRHaveAlphaPremultiplied_,this._pixelFormat=d.getFormat(),this.setAntiAliasTexParameters()):cc.log("cocos2d: Couldn't load PVR image "+a);return c},initWithPVRTCData:function(a,c,d,e,f,g){return cc.Configuration.getInstance().supportsPVRTC()?!0:(cc.log("cocos2d: WARNING: PVRTC images is not supported."),
!1)},setTexParameters:function(a){var c=cc.renderContext;cc.Assert(this._pixelsWide==cc.NextPOT(this._pixelsWide)&&this._pixelsHigh==cc.NextPOT(this._pixelsHigh)||a.wrapS==c.CLAMP_TO_EDGE&&a.wrapT==c.CLAMP_TO_EDGE,"WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures");cc.glBindTexture2D(this);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.minFilter);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,a.magFilter);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,a.wrapS);c.texParameteri(c.TEXTURE_2D,
c.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.NEAREST)},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(){switch(this._pixelFormat){case cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888:return"RGBA8888";case cc.TEXTURE_2D_PIXEL_FORMAT_RGB888:return"RGB888";
case cc.TEXTURE_2D_PIXEL_FORMAT_RGB565:return"RGB565";case cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444:return"RGBA4444";case cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1:return"RGB5A1";case cc.TEXTURE_2D_PIXEL_FORMAT_AI88:return"AI88";case cc.TEXTURE_2D_PIXEL_FORMAT_A8:return"A8";case cc.TEXTURE_2D_PIXEL_FORMAT_I8:return"I8";case cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC4:return"PVRTC4";case cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC2:return"PVRTC2";default:cc.log("stringForFormat: "+this._pixelFormat+", cannot give useful result, it's a unrecognized pixel format")}return""},
bitsPerPixelForFormat:function(a){a=a||this._pixelFormat;switch(a){case cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888:return 32;case cc.TEXTURE_2D_PIXEL_FORMAT_RGB888:return 32;case cc.TEXTURE_2D_PIXEL_FORMAT_RGB565:return 16;case cc.TEXTURE_2D_PIXEL_FORMAT_A8:return 8;case cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444:return 16;case cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1:return 16;case cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC4:return 4;case cc.TEXTURE_2D_PIXEL_FORMAT_PVRTC2:return 2;case cc.TEXTURE_2D_PIXEL_FORMAT_I8:return 8;case cc.TEXTURE_2D_PIXEL_FORMAT_AI88:return 16;
default:return cc.log("bitsPerPixelForFormat: "+this._pixelFormat+", cannot give useful result, it's a illegal pixel format"),-1}},_initPremultipliedATextureWithImage:function(a,c,d){var e=a.getData(),f=null,f=null,g=a.hasAlpha(),h=cc.size(a.getWidth(),a.getHeight()),k=cc.TEXTURE_2D_PIXEL_FORMAT_DEFAULT,m=a.getBitsPerComponent();g||(8<=m?k=cc.TEXTURE_2D_PIXEL_FORMAT_RGB888:(cc.log("cocos2d: cc.Texture2D: Using RGB565 texture since image has no alpha"),k=cc.TEXTURE_2D_PIXEL_FORMAT_RGB565));var n=c*
d;if(k==cc.TEXTURE_2D_PIXEL_FORMAT_RGB565)if(g)for(e=new Uint16Array(c*d),f=a.getData(),m=0;m<n;++m)e[m]=(f[m]>>0&255)>>3<<11|(f[m]>>8&255)>>2<<5|(f[m]>>16&255)>>3<<0;else for(e=new Uint16Array(c*d),f=a.getData(),m=0;m<n;++m)e[m]=(f[m]&255)>>3<<11|(f[m]&255)>>2<<5|(f[m]&255)>>3<<0;else if(k==cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444)for(e=new Uint16Array(c*d),f=a.getData(),m=0;m<n;++m)e[m]=(f[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==cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1)for(e=
new Uint16Array(c*d),f=a.getData(),m=0;m<n;++m)e[m]=(f[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==cc.TEXTURE_2D_PIXEL_FORMAT_A8)for(e=new Uint8Array(c*d),f=a.getData(),m=0;m<n;++m)e[m]=f>>24&255;if(g&&k==cc.TEXTURE_2D_PIXEL_FORMAT_RGB888)for(f=a.getData(),e=new Uint8Array(c*d*3),m=0;m<n;++m)e[3*m]=f>>0&255,e[3*m+1]=f>>8&255,e[3*m+2]=f>>16&255;this.initWithData(e,k,c,d,h);a.getData();this._hasPremultipliedAlpha=a.isPremultipliedAlpha();return!0},addLoadedEventListener:function(a,
c){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:a,eventTarget:c})},removeLoadedEventListener:function(a){if(this._loadedEventListeners)for(var c=this._loadedEventListeners,d=0;d<c.length;d++)c[d].eventTarget==a&&c.splice(d,1)},_callLoadedEventCallbacks:function(){if(this._loadedEventListeners){for(var a=this._loadedEventListeners,c=0,d=a.length;c<d;c++){var e=a[c];cc.doCallback(e.eventCallback,e.eventTarget,this)}a.length=0}}});
cc.Texture2DCanvas=cc.Class.extend({_contentSize:null,_isLoaded:!1,_htmlElementObj:null,_loadedEventListeners:null,ctor:function(){this._contentSize=cc.size(0,0);this._isLoaded=!1;this._htmlElementObj=null},getPixelsWide:function(){return this._contentSize.width},getPixelsHigh:function(){return this._contentSize.height},getContentSize:function(){var a=cc.CONTENT_SCALE_FACTOR();return cc.size(this._contentSize.width/a,this._contentSize.height/a)},getContentSizeInPixels:function(){return cc.size(this._contentSize)},
initWithElement:function(a){a&&(this._htmlElementObj=a)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._isLoaded},handleLoadedTexture:function(){this._isLoaded=!0;var a=this._htmlElementObj;this._contentSize.width=a.width;this._contentSize.height=a.height;this._callLoadedEventCallbacks()},description:function(){return"\x3ccc.Texture2D | width \x3d "+this._contentSize.width+" height "+this._contentSize.height+"\x3e"},initWithData:function(a,c,d,e,f){return!1},
initWithImage:function(a){return!1},initWithString:function(a,c,d,e,f,g){return!1},releaseTexture:function(){},getName:function(){return null},getMaxS:function(){return 1},setMaxS:function(a){},getMaxT:function(){return 1},setMaxT:function(a){},getShaderProgram:function(){return null},setShaderProgram:function(a){},hasPremultipliedAlpha:function(){return!1},hasMipmaps:function(){return!1},releaseData:function(a){},keepData:function(a,c){return a},drawAtPoint:function(a){},drawInRect:function(a){},
initWithETCFile:function(a){return!1},initWithPVRFile:function(a){return!1},initWithPVRTCData:function(a,c,d,e,f,g){return!0},setTexParameters:function(a){},setAntiAliasTexParameters:function(){},setAliasTexParameters:function(){},generateMipmap:function(){},stringForFormat:function(){return""},bitsPerPixelForFormat:function(a){return-1},addLoadedEventListener:function(a,c){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:a,eventTarget:c})},
removeLoadedEventListener:function(a){if(this._loadedEventListeners)for(var c=this._loadedEventListeners,d=0;d<c.length;d++)c[d].eventTarget==a&&c.splice(d,1)},_callLoadedEventCallbacks:function(){if(this._loadedEventListeners){for(var a=this._loadedEventListeners,c=0,d=a.length;c<d;c++){var e=a[c];cc.doCallback(e.eventCallback,e.eventTarget,this)}a.length=0}}});cc.Texture2D=cc.Browser.supportWebGL?cc.Texture2DWebGL:cc.Texture2DCanvas;
cc.Texture2D.setDefaultAlphaPixelFormat=function(a){cc._defaultAlphaPixelFormat=a};cc.Texture2D.defaultAlphaPixelFormat=function(){return cc._defaultAlphaPixelFormat};cc.Texture2D.getDefaultAlphaPixelFormat=function(){return cc._defaultAlphaPixelFormat};cc.Texture2D.PVRImagesHavePremultipliedAlpha=function(a){cc.PVRHaveAlphaPremultiplied_=a};cc.g_sharedTextureCache=null;cc.loadImage=function(a){if(cc.computeImageFormatType(a)==cc.FMT_UNKNOWN)cc.log("unsupported format:"+a);else{var c=new Image;c.src=a;c.addEventListener("load",cc.loadImage.handler,!1)}};cc.loadImage.handler=function(){cc.TextureCache.getInstance().cacheImage(this.src,this);this.removeEventListener("load",cc.loadImage.handler,!1)};
cc.computeImageFormatType=function(a){return 0<a.toLowerCase().indexOf(".jpg")||0<a.toLowerCase().indexOf(".jpeg")?cc.FMT_JPG:0<a.toLowerCase().indexOf(".png")?cc.FMT_PNG:0<a.toLowerCase().indexOf(".webp")?cc.FMT_WEBP:cc.FMT_UNKNOWN};
cc.TextureCache=cc.Class.extend({_textures:null,_textureColorsCache:null,_textureKeySeq:null,_rendererInitialized:!1,_loadedTexturesBefore:null,_loadingTexturesBefore:null,ctor:function(){if(cc.g_sharedTextureCache)throw"Attempted to allocate a second instance of a singleton.";this._textureKeySeq+=0|1E3*Math.random();this._textures={};this._textureColorsCache={};cc.renderContextType===cc.WEBGL&&(this._loadedTexturesBefore={},this._loadingTexturesBefore={})},_addImageAsyncCallBack:function(a,c){cc.doCallback(c,
a)},_initializingRenderer:function(){this._rendererInitialized=!0;var a,c=this._loadedTexturesBefore,d=this._textures;for(a in c){var e=c[a],f=new cc.Texture2D;f.initWithElement(e);f.handleLoadedTexture();d[a]=f}this._loadedTexturesBefore={}},addPVRTCImage:function(a){cc.log("TextureCache:addPVRTCImage does not support on HTML5")},addETCImage:function(a){cc.log("TextureCache:addPVRTCImage does not support on HTML5")},description:function(){return"\x3cTextureCache | Number of textures \x3d "+this._textures.length+
"\x3e"},textureForKey:function(a){a=cc.FileUtils.getInstance().fullPathForFilename(a);return this._textures[a]?this._textures[a]:null},getKeyByTexture:function(a){for(var c in this._textures)if(this._textures[c]==a)return c;return null},_generalTextureKey:function(){this._textureKeySeq++;return"_textureKey_"+this._textureKeySeq},getTextureColors:function(a){var c=this.getKeyByTexture(a);c||(c=a instanceof HTMLImageElement?a.src:this._generalTextureKey());this._textureColorsCache[c]||(this._textureColorsCache[c]=
cc.generateTextureCacheForColor(a));return this._textureColorsCache[c]},addPVRImage:function(a){if(!a)throw"cc.TextureCache.addPVRImage(): path should be non-null";a=cc.FileUtils.getInstance().fullPathForFilename(a);if(null!=this._textures[a])return this._textures[a];var c=new cc.Texture2D;c.initWithPVRFile(a)?this._textures[a]=c:cc.log("cocos2d: Couldn't add PVRImage:"+a+" in TextureCache");return c},removeAllTextures:function(){var a=this._textures,c;for(c in a)a[c]&&a[c].releaseTexture();this._textures=
{}},removeTexture:function(a){if(a){var c=this._textures,d;for(d in c)c[d]==a&&(c[d].releaseTexture(),delete c[d])}},removeTextureForKey:function(a){null!=a&&(a=cc.FileUtils.getInstance().fullPathForFilename(a),this._textures[a]&&delete this._textures[a])},_loadErrorHandler:function(a,c,d){d[a]&&delete d[a];this.removeEventListener("error",c._loadErrorHandler,!1)},_clientLoadHandler:function(a,c,d,e){a instanceof cc.Texture2D?a.handleLoadedTexture():c._textures[a]&&c._textures[a].handleLoadedTexture();
c._addImageAsyncCallBack(e,d);this.removeEventListener("load",c._addAsyncLoadHandler,!1)},_preloadHandler:function(a,c){a instanceof cc.Texture2D?a.handleLoadedTexture():c._textures[a]&&c._textures[a].handleLoadedTexture();this.removeEventListener("load",c._addAsyncLoadHandler,!1)},_beforeRendererLoadHandler:function(a,c){var d=c._loadingTexturesBefore;d[a]&&(c._loadedTexturesBefore[a]=d[a],delete d[a]);this.removeEventListener("load",c._beforeRendererLoadHandler,!1)},addImageAsync:function(a,c,d){if(!a)throw"cc.TextureCache.addImageAsync(): path should be non-null";
a=cc.FileUtils.getInstance().fullPathForFilename(a);var e=this._textures[a],f;e?e.isLoaded()?this._addImageAsyncCallBack(d,c):(f=e.getHtmlElementObj(),f.addEventListener("load",this._clientLoadHandler.bind(f,e,this,c,d))):(f=new Image,f.crossOrigin="Anonymous",f.addEventListener("load",this._clientLoadHandler.bind(f,a,this,c,d)),f.addEventListener("error",this._loadErrorHandler.bind(f,a,this,this._textures)),f.src=a,c=new cc.Texture2D,c.initWithElement(f),this._textures[a]=c);return this._textures[a]},
_addImageBeforeRenderer:function(a){var c=new Image;c.crossOrigin="Anonymous";c.addEventListener("load",this._beforeRendererLoadHandler.bind(c,a,this));c.addEventListener("error",this._loadErrorHandler.bind(c,a,this,this._loadingTexturesBefore));c.src=a;this._loadingTexturesBefore[a]=c},addImage:function(a){if(!a)throw"cc.Texture.addImage(): path should be non-null";if(cc.renderContextType===cc.WEBGL&&!this._rendererInitialized)return this._addImageBeforeRenderer(a);a=cc.FileUtils.getInstance().fullPathForFilename(a);
var c=this._textures[a],d;c?c.isLoaded()||(d=c.getHtmlElementObj(),d.addEventListener("load",this._preloadHandler.bind(d,c,this))):(d=new Image,d.crossOrigin="Anonymous",d.addEventListener("load",this._preloadHandler.bind(d,a,this)),d.addEventListener("error",this._loadErrorHandler.bind(d,a,this,this._textures)),d.src=a,c=new cc.Texture2D,c.initWithElement(d),this._textures[a]=c);return this._textures[a]},cacheImage:function(a,c){if(c instanceof cc.Texture2D)this._textures[a]=c;else{var d=new cc.Texture2D;
d.initWithElement(c);d.handleLoadedTexture();this._textures[a]=d}},addUIImage:function(a,c){if(!a)throw"cc.Texture.addUIImage(): image should be non-null";if(c&&this._textures[c])return this._textures[c];var d=new cc.Texture2D;d.initWithImage(a);null!=c&&null!=d?this._textures[c]=d:cc.log("cocos2d: Couldn't add UIImage in TextureCache");return d},dumpCachedTextureInfo:function(){var a=0,c=0,d=this._textures,e;for(e in d){var f=d[e];a++;f.getHtmlElementObj()instanceof HTMLImageElement?cc.log("cocos2d: '"+
e+"' id\x3d"+f.getHtmlElementObj().src+" "+f.getPixelsWide()+" x "+f.getPixelsHigh()):cc.log("cocos2d: '"+e+"' id\x3d HTMLCanvasElement "+f.getPixelsWide()+" x "+f.getPixelsHigh());c+=f.getPixelsWide()*f.getPixelsHigh()*4}d=this._textureColorsCache;for(e in d){var f=d[e],g;for(g in f){var h=f[g];a++;cc.log("cocos2d: '"+e+"' id\x3d HTMLCanvasElement "+h.width+" x "+h.height);c+=h.width*h.height*4}}cc.log("cocos2d: TextureCache dumpDebugInfo: "+a+" textures, HTMLCanvasElement for "+c/1024+" KB ("+(c/
1048576).toFixed(2)+" MB)")}});cc.TextureCache.getInstance=function(){cc.g_sharedTextureCache||(cc.g_sharedTextureCache=new cc.TextureCache);return cc.g_sharedTextureCache};cc.TextureCache.purgeSharedTextureCache=function(){cc.g_sharedTextureCache=null};cc.TextureAtlas=cc.Class.extend({_indices:null,_buffersVBO:null,_dirty:!1,_capacity:0,_texture:null,_quads:null,_quadsArrayBuffer:null,_quadsWebBuffer:null,_quadsReader:null,ctor:function(){this._buffersVBO=[]},getTotalQuads:function(){return this._totalQuads},getCapacity:function(){return this._capacity},getTexture:function(){return this._texture},setTexture:function(a){this._texture=a},setDirty:function(a){this._dirty=a},isDirty:function(){return this._dirty},getQuads:function(){return this._quads},
setQuads:function(a){this._quads=a},_copyQuadsToTextureAtlas:function(a,c){if(a)for(var d=0;d<a.length;d++)this._setQuadToArray(a[d],c+d)},_setQuadToArray:function(a,c){var d=this._quads;d[c]?(d[c].bl=a.bl,d[c].br=a.br,d[c].tl=a.tl,d[c].tr=a.tr):d[c]=new cc.V3F_C4B_T2F_Quad(a.tl,a.bl,a.tr,a.br,this._quadsArrayBuffer,c*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT)},description:function(){return"\x3ccc.TextureAtlas | totalQuads \x3d"+this._totalQuads+"\x3e"},_setupIndices:function(){if(0!==this._capacity)for(var a=
this._indices,c=this._capacity,d=0;d<c;d++)cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP?(a[6*d+0]=4*d+0,a[6*d+1]=4*d+0,a[6*d+2]=4*d+2,a[6*d+3]=4*d+1,a[6*d+4]=4*d+3,a[6*d+5]=4*d+3):(a[6*d+0]=4*d+0,a[6*d+1]=4*d+1,a[6*d+2]=4*d+2,a[6*d+3]=4*d+3,a[6*d+4]=4*d+2,a[6*d+5]=4*d+1)},_setupVBO:function(){var a=cc.renderContext;this._buffersVBO[0]=a.createBuffer();this._buffersVBO[1]=a.createBuffer();this._quadsWebBuffer=a.createBuffer();this._mapBuffers()},_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)},initWithFile:function(a,c){var d=cc.TextureCache.getInstance().addImage(a);if(d)return this.initWithTexture(d,c);cc.log("cocos2d: Could not open file: "+a);return!1},initWithTexture:function(a,c){if(!a)throw"cc.TextureAtlas.initWithTexture():texture should be non-null";this._capacity=c|=0;
this._totalQuads=0;this._texture=a;this._quads=[];this._indices=new Uint16Array(6*c);var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._quadsArrayBuffer=new ArrayBuffer(d*c);this._quadsReader=new Uint8Array(this._quadsArrayBuffer);if((!this._quads||!this._indices)&&0<c)return!1;for(var e=this._quads,f=0;f<c;f++)e[f]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,f*d);this._setupIndices();this._setupVBO();return this._dirty=!0},updateQuad:function(a,c){if(!a)throw"cc.TextureAtlas.updateQuad(): quad should be non-null";
if(0>c||c>=this._capacity)throw"cc.TextureAtlas.updateQuad(): Invalid index";this._totalQuads=Math.max(c+1,this._totalQuads);this._setQuadToArray(a,c);this._dirty=!0},insertQuad:function(a,c){if(c>=this._capacity)throw"cc.TextureAtlas.insertQuad(): Invalid index";this._totalQuads++;if(this._totalQuads>this._capacity)cc.log("cc.TextureAtlas.insertQuad(): invalid totalQuads");else{var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,e=c*d,f=(this._totalQuads-1-c)*d;this._quads[this._totalQuads-1]=new cc.V3F_C4B_T2F_Quad(null,
null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*d);this._quadsReader.set(this._quadsReader.subarray(e,e+f),e+d);this._setQuadToArray(a,c);this._dirty=!0}},insertQuads:function(a,c,d){d=d||a.length;if(c+d>this._capacity)throw"cc.TextureAtlas.insertQuad(): Invalid index + amount";var e=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads+=d;if(this._totalQuads>this._capacity)cc.log("cc.TextureAtlas.insertQuad(): invalid totalQuads");else{var f=c*e,g=(this._totalQuads-1-c-d)*e,h=this._totalQuads-
1-d,k;for(k=0;k<d;k++)this._quads[h+k]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*e);this._quadsReader.set(this._quadsReader.subarray(f,f+g),f+e*d);for(k=0;k<d;k++)this._setQuadToArray(a[k],c+k);this._dirty=!0}},insertQuadFromIndex:function(a,c){if(a!==c){if(0>c&&c>=this._totalQuads)throw"cc.TextureAtlas.insertQuadFromIndex(): Invalid newIndex";if(0>a&&a>=this._totalQuads)throw"cc.TextureAtlas.insertQuadFromIndex(): Invalid fromIndex";var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,
e=this._quadsReader,f=e.subarray(a*d,d),g;a>c?(g=c*d,e.set(e.subarray(g,g+(a-c)*d),g+d),e.set(f,g)):(g=(a+1)*d,e.set(e.subarray(g,g+(c-a)*d),g-d),e.set(f,c*d));this._dirty=!0}},removeQuadAtIndex:function(a){if(a>=this._totalQuads)throw"cc.TextureAtlas.removeQuadAtIndex(): Invalid index";var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads--;this._quads.length=this._totalQuads;if(a!==this._totalQuads){var d=(a+1)*c;this._quadsReader.set(this._quadsReader.subarray(d,d+(this._totalQuads-a)*c),
d-c)}this._dirty=!0},removeQuadsAtIndex:function(a,c){if(a+c>this._totalQuads)throw"cc.TextureAtlas.removeQuadsAtIndex(): index + amount out of bounds";this._totalQuads-=c;if(a!==this._totalQuads){var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,e=(a+c)*d,f=a*d;this._quadsReader.set(this._quadsReader.subarray(e,e+(this._totalQuads-a)*d),f)}this._dirty=!0},removeAllQuads:function(){this._totalQuads=this._quads.length=0},_setDirty:function(a){this._dirty=a},resizeCapacity:function(a){if(a==this._capacity)return!0;
var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=this._capacity;this._totalQuads=Math.min(this._totalQuads,a);var e=this._capacity=0|a,f=this._totalQuads;if(null==this._quads)for(this._quads=[],this._quadsArrayBuffer=new ArrayBuffer(c*e),this._quadsReader=new Uint8Array(this._quadsArrayBuffer),a=0;a<e;a++)this._quads=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,a*c);else{var g,h,k=this._quads;if(e>d){g=[];h=new ArrayBuffer(c*e);for(a=0;a<f;a++)g[a]=new cc.V3F_C4B_T2F_Quad(k[a].tl,
k[a].bl,k[a].tr,k[a].br,h,a*c);for(;a<e;a++)g[a]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,h,a*c)}else for(f=Math.max(f,e),g=[],h=new ArrayBuffer(c*e),a=0;a<f;a++)g[a]=new cc.V3F_C4B_T2F_Quad(k[a].tl,k[a].bl,k[a].tr,k[a].br,h,a*c);this._quadsReader=new Uint8Array(h);this._quads=g;this._quadsArrayBuffer=h}null==this._indices?this._indices=new Uint16Array(6*e):e>d?(c=new Uint16Array(6*e),c.set(this._indices,0),this._indices=c):this._indices=this._indices.subarray(0,6*e);this._setupIndices();this._mapBuffers();
return this._dirty=!0},increaseTotalQuadsWith:function(a){this._totalQuads+=a},moveQuadsFromIndex:function(a,c,d){if(void 0===d){d=c;c=this._totalQuads-a;if(d+(this._totalQuads-a)>this._capacity)throw"cc.TextureAtlas.moveQuadsFromIndex(): move is out of bounds";if(0===c)return}else{if(d+c>this._totalQuads)throw"cc.TextureAtlas.moveQuadsFromIndex(): Invalid newIndex";if(a>=this._totalQuads)throw"cc.TextureAtlas.moveQuadsFromIndex(): Invalid oldIndex";if(a==d)return}var e=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,
f=a*e,g=c*e,h=this._quadsReader,k=h.subarray(f,f+g),m=d*e;d<a?(c=d*e,h.set(h.subarray(c,c+(a-d)*e),c+g)):(c=(a+c)*e,h.set(h.subarray(c,c+(d-a)*e),f));h.set(k,m);this._dirty=!0},fillWithEmptyQuadsFromIndex:function(a,c){for(var d=c*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,e=new Uint8Array(this._quadsArrayBuffer,a*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d),f=0;f<d;f++)e[f]=0},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);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);this._dirty&&(this._dirty=!1);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++}},drawQuads:function(){this.drawNumberOfQuads(this._totalQuads,0)},_releaseBuffer:function(){var a=cc.renderContext;this._buffersVBO&&(this._buffersVBO[0]&&a.deleteBuffer(this._buffersVBO[0]),this._buffersVBO[1]&&a.deleteBuffer(this._buffersVBO[1]));this._quadsWebBuffer&&a.deleteBuffer(this._quadsWebBuffer)}});
cc.TextureAtlas.create=function(a,c){var d=new cc.TextureAtlas;return d&&d.initWithFile(a,c)?d:null};cc.TextureAtlas.createWithTexture=function(a,c){var d=new cc.TextureAtlas;return d&&d.initWithTexture(a,c)?d:null};cc.Scene=cc.Node.extend({ctor:function(){cc.Node.prototype.ctor.call(this);this._ignoreAnchorPointForPosition=!0;this.setAnchorPoint(0.5,0.5);this.setContentSize(cc.Director.getInstance().getWinSize())}});cc.Scene.create=function(){return new cc.Scene};cc.TOUCH_ALL_AT_ONCE=0;cc.TOUCH_ONE_BY_ONE=1;
cc.Layer=cc.Node.extend({_isTouchEnabled:!1,_isAccelerometerEnabled:!1,_isKeyboardEnabled:!1,_touchPriority:0,_touchMode:cc.TOUCH_ALL_AT_ONCE,_isMouseEnabled:!1,_mousePriority:0,_swallowTouch:!0,ctor:function(){cc.Node.prototype.ctor.call(this);this._isKeyboardEnabled=this._isAccelerometerEnabled=this._isTouchEnabled=!1;this._touchPriority=0;this._touchMode=cc.TOUCH_ALL_AT_ONCE;this._isMouseEnabled=!1;this._mousePriority=0},_initLayer:function(){this.setAnchorPoint(0.5,0.5);this._ignoreAnchorPointForPosition=
!0;var a=cc.Director.getInstance();this.setContentSize(a.getWinSize())},init:function(){cc.Node.prototype.init.call(this);this._initLayer();return!0},setKeypadEnabled:function(a){},registerWithTouchDispatcher:function(){this._touchMode===cc.TOUCH_ALL_AT_ONCE?cc.registerStandardDelegate(this,this._touchPriority):cc.registerTargetedDelegate(this._touchPriority,this._swallowTouch,this)},isMouseEnabled:function(){return this._isMouseEnabled},setMouseEnabled:function(a){if(!cc.MouseDispatcher)throw"cc.MouseDispatcher is undefined, maybe it has been removed from js loading list.";
this._isMouseEnabled!=a&&(this._isMouseEnabled=a,this._running&&(a?cc.Director.getInstance().getMouseDispatcher().addMouseDelegate(this,this._mousePriority):cc.Director.getInstance().getMouseDispatcher().removeMouseDelegate(this)))},setMousePriority:function(a){if(!cc.MouseDispatcher)throw"cc.MouseDispatcher is undefined, maybe it has been removed from js loading list.";this._mousePriority!==a&&(this._mousePriority=a,this._isMouseEnabled&&(this.setMouseEnabled(!1),this.setMouseEnabled(!0)))},getMousePriority:function(){return this._mousePriority},
isTouchEnabled:function(){return this._isTouchEnabled},setTouchEnabled:function(a,c){this._isTouchEnabled!==a&&(this._isTouchEnabled=a,this._swallowTouch=!1===c?!1:!0,this._running&&(a?this.registerWithTouchDispatcher():cc.unregisterTouchDelegate(this)))},getTouchPriority:function(){return this._touchPriority},setTouchPriority:function(a){this._touchPriority!==a&&(this._touchPriority=a,this._isTouchEnabled&&(this.setTouchEnabled(!1),this.setTouchEnabled(!0)))},getTouchMode:function(){return this._touchMode},
setTouchMode:function(a){this._touchMode!==a&&(this._touchMode=a,this._isTouchEnabled&&(this.setTouchEnabled(!1),this.setTouchEnabled(!0)))},isAccelerometerEnabled:function(){return this._isAccelerometerEnabled},setAccelerometerEnabled:function(a){if(!cc.Accelerometer)throw"cc.Accelerometer is undefined, maybe it has been removed from js loading list.";if(a!==this._isAccelerometerEnabled&&(this._isAccelerometerEnabled=a,this._running)){var c=cc.Director.getInstance();a?c.getAccelerometer().setDelegate(this):
c.getAccelerometer().setDelegate(null)}},setAccelerometerInterval:function(a){this._isAccelerometerEnabled&&cc.Accelerometer&&cc.Director.getInstance().getAccelerometer().setAccelerometerInterval(a)},onAccelerometer:function(a){cc.log("onAccelerometer event should be handled.")},isKeyboardEnabled:function(){return this._isKeyboardEnabled},setKeyboardEnabled:function(a){if(!cc.KeyboardDispatcher)throw"cc.KeyboardDispatcher is undefined, maybe it has been removed from js loading list.";if(a!==this._isKeyboardEnabled&&
(this._isKeyboardEnabled=a,this._running)){var c=cc.Director.getInstance();a?c.getKeyboardDispatcher().addDelegate(this):c.getKeyboardDispatcher().removeDelegate(this)}},onEnter:function(){var a=cc.Director.getInstance();this._isTouchEnabled&&this.registerWithTouchDispatcher();cc.Node.prototype.onEnter.call(this);this._isAccelerometerEnabled&&cc.Accelerometer&&a.getAccelerometer().setDelegate(this);this._isKeyboardEnabled&&cc.KeyboardDispatcher&&a.getKeyboardDispatcher().addDelegate(this);this._isMouseEnabled&&
cc.MouseDispatcher&&a.getMouseDispatcher().addMouseDelegate(this,this._mousePriority)},onExit:function(){var a=cc.Director.getInstance();this._isTouchEnabled&&cc.unregisterTouchDelegate(this);this._isAccelerometerEnabled&&cc.Accelerometer&&a.getAccelerometer().setDelegate(null);this._isKeyboardEnabled&&cc.KeyboardDispatcher&&a.getKeyboardDispatcher().removeDelegate(this);this._isMouseEnabled&&cc.MouseDispatcher&&a.getMouseDispatcher().removeMouseDelegate(this);cc.Node.prototype.onExit.call(this)},
onEnterTransitionDidFinish:function(){this._isAccelerometerEnabled&&cc.Accelerometer&&cc.Director.getInstance().getAccelerometer().setDelegate(this);cc.Node.prototype.onEnterTransitionDidFinish.call(this)},onTouchBegan:function(a,c){cc.log("onTouchBegan event should be handled.");return!0},onTouchMoved:function(a,c){},onTouchEnded:function(a,c){},onTouchCancelled:function(a,c){},onTouchesBegan:function(a,c){},onTouchesMoved:function(a,c){},onTouchesEnded:function(a,c){},onTouchesCancelled:function(a,
c){},onMouseDown:function(a){return!1},onMouseDragged:function(a){return!1},onMouseMoved:function(a){return!1},onMouseUp:function(a){return!1},onRightMouseDown:function(a){return!1},onRightMouseDragged:function(a){return!1},onRightMouseUp:function(a){return!1},onOtherMouseDown:function(a){return!1},onOtherMouseDragged:function(a){return!1},onOtherMouseUp:function(a){return!1},onScrollWheel:function(a){return!1},onMouseEntered:function(a){return!1},onMouseExited:function(a){return!1},onKeyDown:function(a){},
onKeyUp:function(a){}});cc.Layer.create=function(){var a=new cc.Layer;return a&&a.init()?a:null};
cc.LayerRGBA=cc.Layer.extend({RGBAProtocol:!0,_displayedOpacity:0,_realOpacity:0,_displayedColor:null,_realColor:null,_cascadeOpacityEnabled:!1,_cascadeColorEnabled:!1,ctor:function(){cc.Layer.prototype.ctor.call(this);this.RGBAProtocol=!0;this._realOpacity=this._displayedOpacity=255;this._displayedColor=cc.white();this._realColor=cc.white();this._cascadeColorEnabled=this._cascadeOpacityEnabled=!1},init:function(){return cc.Layer.prototype.init.call(this)?(this.setCascadeOpacityEnabled(!1),this.setCascadeColorEnabled(!1),
!0):!1},getOpacity:function(){return this._realOpacity},getDisplayedOpacity:function(){return this._displayedOpacity},setOpacity:function(a){this._displayedOpacity=this._realOpacity=a;a=255;var c=this._parent;c&&c.RGBAProtocol&&c.isCascadeOpacityEnabled()&&(a=c.getDisplayedOpacity());this.updateDisplayedOpacity(a)},updateDisplayedOpacity:function(a){this._displayedOpacity=0|this._realOpacity*a/255;if(this._cascadeOpacityEnabled){a=this._children;for(var c=0;c<a.length;c++){var d=a[c];d&&d.RGBAProtocol&&
d.updateDisplayedOpacity(this._displayedOpacity)}}},isCascadeOpacityEnabled:function(){return this._cascadeOpacityEnabled},setCascadeOpacityEnabled:function(a){this._cascadeOpacityEnabled!==a&&((this._cascadeOpacityEnabled=a)?this._enableCascadeOpacity():this._disableCascadeOpacity())},_enableCascadeOpacity:function(){var a=255,c=this._parent;c&&c.RGBAProtocol&&c.isCascadeOpacityEnabled()&&(a=c.getDisplayedOpacity());this.updateDisplayedOpacity(a)},_disableCascadeOpacity:function(){this._displayedOpacity=
this._realOpacity;for(var a=this._children,c=0;c<a.length;c++){var d=a[c];d&&d.RGBAProtocol&&d.updateDisplayedOpacity(255)}},getColor:function(){var a=this._realColor;return cc.c3b(a.r,a.g,a.b)},getDisplayedColor:function(){var a=this._displayedColor;return cc.c3b(a.r,a.g,a.b)},setColor:function(a){var c=this._displayedColor,d=this._realColor;c.r=d.r=a.r;c.g=d.g=a.g;c.b=d.b=a.b;a=(a=this._parent)&&a.RGBAProtocol&&a.isCascadeColorEnabled()?a.getDisplayedColor():cc.white();this.updateDisplayedColor(a)},
updateDisplayedColor:function(a){var c=this._displayedColor,d=this._realColor;c.r=0|d.r*a.r/255;c.g=0|d.g*a.g/255;c.b=0|d.b*a.b/255;if(this._cascadeColorEnabled)for(a=this._children,d=0;d<a.length;d++){var e=a[d];e&&e.RGBAProtocol&&e.updateDisplayedColor(c)}},isCascadeColorEnabled:function(){return this._cascadeColorEnabled},setCascadeColorEnabled:function(a){this._cascadeColorEnabled!==a&&((this._cascadeColorEnabled=a)?this._enableCascadeColor():this._disableCascadeColor())},_enableCascadeColor:function(){var a;
a=(a=this._parent)&&a.RGBAProtocol&&a.isCascadeColorEnabled()?a.getDisplayedColor():cc.white();this.updateDisplayedColor(a)},_disableCascadeColor:function(){var a=this._displayedColor,c=this._realColor;a.r=c.r;a.g=c.g;a.b=c.b;for(var a=this._children,c=cc.white(),d=0;d<a.length;d++){var e=a[d];e&&e.RGBAProtocol&&e.updateDisplayedColor(c)}},addChild:function(a,c,d){cc.Node.prototype.addChild.call(this,a,c,d);this._cascadeColorEnabled&&this._enableCascadeColor();this._cascadeOpacityEnabled&&this._enableCascadeOpacity()},
setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1}});
cc.LayerColor=cc.LayerRGBA.extend({_blendFunc:null,getBlendFunc:function(){return this._blendFunc},changeWidthAndHeight:function(a,c){this.setContentSize(a,c)},changeWidth:function(a){this.setContentSize(a,this._contentSize.height)},changeHeight:function(a){this.setContentSize(this._contentSize.width,a)},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},setColor:function(a){cc.LayerRGBA.prototype.setColor.call(this,a);this._updateColor()},setOpacity:function(a){cc.LayerRGBA.prototype.setOpacity.call(this,
a);this._updateColor()},_isLighterMode:!1,_squareVertices:null,_squareColors:null,_verticesFloat32Buffer:null,_colorsUint8Buffer:null,_squareVerticesAB:null,_squareColorsAB:null,_ctorForCanvas:function(){cc.LayerRGBA.prototype.ctor.call(this);this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST)},_ctorForWebGL:function(){cc.LayerRGBA.prototype.ctor.call(this);this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this._squareVerticesAB=new ArrayBuffer(32);this._squareColorsAB=new ArrayBuffer(64);
var a=this._squareVerticesAB,c=this._squareColorsAB,d=cc.Vertex2F.BYTES_PER_ELEMENT,e=cc.Color4F.BYTES_PER_ELEMENT;this._squareVertices=[new cc.Vertex2F(0,0,a,0),new cc.Vertex2F(0,0,a,d),new cc.Vertex2F(0,0,a,2*d),new cc.Vertex2F(0,0,a,3*d)];this._squareColors=[new cc.Color4F(0,0,0,1,c,0),new cc.Color4F(0,0,0,1,c,e),new cc.Color4F(0,0,0,1,c,2*e),new cc.Color4F(0,0,0,1,c,3*e)];this._verticesFloat32Buffer=cc.renderContext.createBuffer();this._colorsUint8Buffer=cc.renderContext.createBuffer()},setBlendFunc:function(a,
c){this._blendFunc=void 0===c?a:{src:a,dst:c};cc.renderContextType===cc.CANVAS&&(this._isLighterMode=this._blendFunc&&1==this._blendFunc.src&&771==this._blendFunc.dst)},init:function(a,c,d){if(!cc.Layer.prototype.init.call(this))return!1;cc.renderContextType!==cc.CANVAS&&this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_COLOR));var e=cc.Director.getInstance().getWinSize();a=a||new cc.Color4B(0,0,0,255);c=c||e.width;d=d||e.height;e=this._displayedColor;e.r=a.r;e.g=
a.g;e.b=a.b;e=this._realColor;e.r=a.r;e.g=a.g;e.b=a.b;this._realOpacity=this._displayedOpacity=a.a;this.setContentSize(c,d);this._updateColor();return!0},setContentSize:null,_setContentSizeForWebGL:function(a,c){var d=this._squareVertices;void 0===c?(d[1].x=a.width,d[2].y=a.height,d[3].x=a.width,d[3].y=a.height):(d[1].x=a,d[2].y=c,d[3].x=a,d[3].y=c);this._bindLayerVerticesBufferData();cc.Layer.prototype.setContentSize.call(this,a,c)},_updateColor:null,_updateColorForCanvas:function(){},_updateColorForWebGL:function(){for(var a=
this._displayedColor,c=this._displayedOpacity,d=this._squareColors,e=0;4>e;e++)d[e].r=a.r/255,d[e].g=a.g/255,d[e].b=a.b/255,d[e].a=c/255;this._bindLayerColorsBufferData()},updateDisplayedColor:function(a){cc.LayerRGBA.prototype.updateDisplayedColor.call(this,a);this._updateColor()},updateDisplayedOpacity:function(a){cc.LayerRGBA.prototype.updateDisplayedOpacity.call(this,a);this._updateColor()},_bindLayerVerticesBufferData:function(){var a=cc.renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._verticesFloat32Buffer);
a.bufferData(a.ARRAY_BUFFER,this._squareVerticesAB,a.STATIC_DRAW)},_bindLayerColorsBufferData:function(){var a=cc.renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._colorsUint8Buffer);a.bufferData(a.ARRAY_BUFFER,this._squareColorsAB,a.STATIC_DRAW)},draw:null,_drawForCanvas:function(a){a=a||cc.renderContext;var c=this.getContentSize(),d=cc.EGLView.getInstance(),e=this._displayedColor;a.fillStyle="rgba("+(0|e.r)+","+(0|e.g)+","+(0|e.b)+","+this._displayedOpacity/255+")";a.fillRect(0,0,c.width*d.getScaleX(),
-c.height*d.getScaleY());cc.g_NumberOfDraws++},_drawForWebGL:function(a){a=a||cc.renderContext;cc.NODE_DRAW_SETUP(this);cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_COLOR);a.bindBuffer(a.ARRAY_BUFFER,this._verticesFloat32Buffer);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,this._colorsUint8Buffer);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.FLOAT,!1,0,0);cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst);a.drawArrays(a.TRIANGLE_STRIP,
0,4)}});
cc.Browser.supportWebGL?(cc.LayerColor.prototype.ctor=cc.LayerColor.prototype._ctorForWebGL,cc.LayerColor.prototype.setContentSize=cc.LayerColor.prototype._setContentSizeForWebGL,cc.LayerColor.prototype._updateColor=cc.LayerColor.prototype._updateColorForWebGL,cc.LayerColor.prototype.draw=cc.LayerColor.prototype._drawForWebGL):(cc.LayerColor.prototype.ctor=cc.LayerColor.prototype._ctorForCanvas,cc.LayerColor.prototype.setContentSize=cc.LayerRGBA.prototype.setContentSize,cc.LayerColor.prototype._updateColor=cc.LayerColor.prototype._updateColorForCanvas,
cc.LayerColor.prototype.draw=cc.LayerColor.prototype._drawForCanvas);cc.LayerColor.create=function(a,c,d){var e=new cc.LayerColor;switch(arguments.length){case 0:e.init();break;case 1:e.init(a);break;case 3:e.init(a,c,d);break;default:e.init()}return e};
cc.LayerGradient=cc.LayerColor.extend({_startColor:null,_endColor:null,_startOpacity:null,_endOpacity:null,_alongVector:null,_compressedInterpolation:!1,_gradientStartPoint:null,_gradientEndPoint:null,ctor:function(){cc.LayerColor.prototype.ctor.call(this);this._startColor=new cc.Color3B(0,0,0);this._endColor=new cc.Color3B(0,0,0);this._alongVector=cc.p(0,-1);this._endOpacity=this._startOpacity=255;this._gradientStartPoint=cc.p(0,0);this._gradientEndPoint=cc.p(0,0)},setContentSize:function(a,c){cc.LayerColor.prototype.setContentSize.call(this,
a,c);this._updateColor()},getStartColor:function(){return this._realColor},setStartColor:function(a){this.setColor(a)},setEndColor:function(a){this._endColor=a;this._updateColor()},getEndColor:function(){return this._endColor},setStartOpacity:function(a){this._startOpacity=a;this._updateColor()},getStartOpacity:function(){return this._startOpacity},setEndOpacity:function(a){this._endOpacity=a;this._updateColor()},getEndOpacity:function(){return this._endOpacity},setVector:function(a){this._alongVector.x=
a.x;this._alongVector.y=a.y;this._updateColor()},getVector:function(){return cc.p(this._alongVector.x,this._alongVector.y)},isCompressedInterpolation:function(){return this._compressedInterpolation},setCompressedInterpolation:function(a){this._compressedInterpolation=a;this._updateColor()},init:function(a,c,d){a=a||cc.c4(0,0,0,255);c=c||cc.c4(0,0,0,255);d=d||cc.p(0,-1);var e=this._startColor,f=this._endColor;e.r=a.r;e.g=a.g;e.b=a.b;this._startOpacity=a.a;f.r=c.r;f.g=c.g;f.b=c.b;this._endOpacity=c.a;
this._alongVector=d;this._compressedInterpolation=!0;cc.LayerColor.prototype.init.call(this,cc.c4b(a.r,a.g,a.b,255));return!0},draw:function(a){if(cc.renderContextType===cc.WEBGL)cc.LayerColor.prototype.draw.call(this,a);else{a=a||cc.renderContext;this._isLighterMode&&(a.globalCompositeOperation="lighter");a.save();var c=cc.EGLView.getInstance(),d=this._displayedOpacity/255,e=this.getContentSize().width*c.getScaleX(),c=this.getContentSize().height*c.getScaleY(),f=a.createLinearGradient(this._gradientStartPoint.x,
this._gradientStartPoint.y,this._gradientEndPoint.x,this._gradientEndPoint.y),g=this._displayedColor,h=this._endColor;f.addColorStop(0,"rgba("+Math.round(g.r)+","+Math.round(g.g)+","+Math.round(g.b)+","+(this._startOpacity/255*d).toFixed(4)+")");f.addColorStop(1,"rgba("+Math.round(h.r)+","+Math.round(h.g)+","+Math.round(h.b)+","+(this._endOpacity/255*d).toFixed(4)+")");a.fillStyle=f;a.fillRect(0,0,e,-c);0!=this._rotation&&a.rotate(this._rotationRadians);a.restore()}},_updateColor:function(){var a=
this._alongVector;if(cc.renderContextType===cc.CANVAS){var c=0.5*this.getContentSize().width,d=0.5*this.getContentSize().height;this._gradientStartPoint.x=c*-a.x+c;this._gradientStartPoint.y=d*a.y-d;this._gradientEndPoint.x=c*a.x+c;this._gradientEndPoint.y=d*-a.y-d}else if(d=cc.pLength(a),0!==d){c=Math.sqrt(2);a=cc.p(a.x/d,a.y/d);this._compressedInterpolation&&(d=1/(Math.abs(a.x)+Math.abs(a.y)),a=cc.pMult(a,d*c));var e=this._displayedOpacity/255,f=this._displayedColor,g=this._endColor,d=f.r/255,h=
f.g/255,f=f.b/255,k=this._startOpacity*e/255,m=g.r/255,n=g.g/255,g=g.b/255,e=this._endOpacity*e/255,p=this._squareColors,q=p[0],s=p[1],r=p[2],p=p[3];q.r=m+(c+a.x+a.y)/(2*c)*(d-m);q.g=n+(c+a.x+a.y)/(2*c)*(h-n);q.b=g+(c+a.x+a.y)/(2*c)*(f-g);q.a=e+(c+a.x+a.y)/(2*c)*(k-e);s.r=m+(c-a.x+a.y)/(2*c)*(d-m);s.g=n+(c-a.x+a.y)/(2*c)*(h-n);s.b=g+(c-a.x+a.y)/(2*c)*(f-g);s.a=e+(c-a.x+a.y)/(2*c)*(k-e);r.r=m+(c+a.x-a.y)/(2*c)*(d-m);r.g=n+(c+a.x-a.y)/(2*c)*(h-n);r.b=g+(c+a.x-a.y)/(2*c)*(f-g);r.a=e+(c+a.x-a.y)/(2*c)*
(k-e);p.r=m+(c-a.x-a.y)/(2*c)*(d-m);p.g=n+(c-a.x-a.y)/(2*c)*(h-n);p.b=g+(c-a.x-a.y)/(2*c)*(f-g);p.a=e+(c-a.x-a.y)/(2*c)*(k-e);this._bindLayerColorsBufferData()}}});cc.LayerGradient.create=function(a,c,d){var e=new cc.LayerGradient;switch(arguments.length){case 2:if(e&&e.init(a,c))return e;break;case 3:if(e&&e.init(a,c,d))return e;break;case 0:if(e&&e.init())return e;break;default:throw"Arguments error ";}return null};
cc.LayerMultiplex=cc.Layer.extend({_enabledLayer:0,_layers:null,initWithLayer:function(a){this._layers=[];this._layers.push(a);this._enabledLayer=0;this.addChild(a);return!0},initWithLayers:function(a){this._layers=a;this._enabledLayer=0;this.addChild(this._layers[this._enabledLayer]);return!0},switchTo:function(a){a>=this._layers.length?cc.log("cc.LayerMultiplex.switchTo():Invalid index in MultiplexLayer switchTo message"):(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.LayerMultiplex.switchToAndReleaseMe():Invalid index in MultiplexLayer switchTo message"):(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.Layer.addLayer(): layer should be non-null")}});
cc.LayerMultiplex.create=function(){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");var a=new cc.LayerMultiplex;return a.initWithLayers(arguments)?a:null};cc.SPRITE_INDEX_NOT_INITIALIZED=-1;
cc.generateTextureCacheForColor=function(a){function c(){var c=cc.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),q=p.data,s=0;s<k.length;s+=4)q[s]=0===m?k[s]:0,q[s+1]=1===m?k[s+1]:0,q[s+2]=2===m?k[s+2]:0,q[s+3]=k[s+3];n.putImageData(p,0,0)}a.onload=null}if(a.channelCache)return a.channelCache;var d=[document.createElement("canvas"),document.createElement("canvas"),document.createElement("canvas"),document.createElement("canvas")];try{c()}catch(e){a.onload=c}return a.channelCache=d};cc.generateTextureCacheForColor.canvas=document.createElement("canvas");cc.generateTextureCacheForColor.tempCanvas=document.createElement("canvas");
cc.generateTextureCacheForColor.tempCtx=cc.generateTextureCacheForColor.tempCanvas.getContext("2d");
cc.generateTintImage2=function(a,c,d){d||(d=cc.rect(0,0,a.width,a.height),d=cc.RECT_PIXELS_TO_POINTS(d));c=c instanceof cc.Color4F?cc.c4b(255*c.r,255*c.g,255*c.b,255*c.a):cc.c4b(c.r,c.g,c.b,50);var e=document.createElement("canvas"),f=e.getContext("2d");e.width!=d.width&&(e.width=d.width);e.height!=d.height&&(e.height=d.height);f.save();f.drawImage(a,d.x,d.y,d.width,d.height,0,0,d.width,d.height);f.globalCompositeOperation="source-in";f.globalAlpha=c.a/255;f.fillStyle="rgb("+c.r+","+c.g+","+c.b+")";
f.fillRect(0,0,d.width,d.height);f.restore();return e};
cc.generateTintImage=function(a,c,d,e,f){e||(e=cc.rect(0,0,a.width,a.height));a=null==d.a?cc.c4f(d.r/255,d.g/255,d.b/255,1):d;d=Math.min(e.width,c[0].width);var g=Math.min(e.height,c[0].height),h;f?(h=f.getContext("2d"),h.clearRect(0,0,d,g)):(f=document.createElement("canvas"),f.width=d,f.height=g,h=f.getContext("2d"));h.save();h.globalCompositeOperation="lighter";var k=h.globalAlpha;0<a.r&&(h.globalAlpha=a.r*k,h.drawImage(c[0],e.x,e.y,d,g,0,0,d,g));0<a.g&&(h.globalAlpha=a.g*k,h.drawImage(c[1],e.x,
e.y,d,g,0,0,d,g));0<a.b&&(h.globalAlpha=a.b*k,h.drawImage(c[2],e.x,e.y,d,g,0,0,d,g));1>a.r+a.g+a.b&&(h.globalAlpha=k,h.drawImage(c[3],e.x,e.y,d,g,0,0,d,g));h.restore();return f};cc.cutRotateImageToCanvas=function(a,c){if(!a)return null;if(!c)return a;var d=document.createElement("canvas");d.width=c.width;d.height=c.height;var e=d.getContext("2d");e.translate(d.width/2,d.height/2);e.rotate(-1.5707963267948966);e.drawImage(a,c.x,c.y,c.height,c.width,-c.height/2,-c.width/2,c.height,c.width);return d};
cc.TransformValues=function(a,c,d,e,f,g){this.pos=a;this.scale=c;this.rotation=d;this.skew=e;this.ap=f;this.visible=g};cc.RENDER_IN_SUBPIXEL=function(a){return 0|a};cc.SPRITEBATCHNODE_RENDER_SUBPIXEL&&(cc.RENDER_IN_SUBPIXEL=function(a){return a});
cc.Sprite=cc.NodeRGBA.extend({RGBAProtocol:!0,_textureAtlas:null,_atlasIndex:0,_batchNode:null,_dirty:!1,_recursiveDirty:null,_hasChildren:null,_shouldBeHidden:!1,_transformToBatch:null,_blendFunc:null,_texture:null,_rect:null,_rectRotated:!1,_offsetPosition:null,_unflippedOffsetPositionFromCenter:null,_opacityModifyRGB:!1,_flippedX:!1,_flippedY:!1,_textureLoaded:!1,_loadedEventListeners:null,_newTextureWhenChangeColor:null,textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,
c){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:a,eventTarget:c})},_callLoadedEventCallbacks:function(){if(this._loadedEventListeners){for(var a=this._loadedEventListeners,c=0,d=a.length;c<d;c++){var e=a[c];cc.doCallback(e.eventCallback,e.eventTarget,this)}a.length=0}},isDirty:function(){return this._dirty},setDirty:function(a){this._dirty=a},isTextureRectRotated:function(){return this._rectRotated},getAtlasIndex:function(){return this._atlasIndex},
setAtlasIndex:function(a){this._atlasIndex=a},getTextureRect:function(){return cc.rect(this._rect.x,this._rect.y,this._rect.width,this._rect.height)},getTextureAtlas:function(){return this._textureAtlas},setTextureAtlas:function(a){this._textureAtlas=a},getSpriteBatchNode:function(){return this._batchNode},setSpriteBatchNode:function(a){this._batchNode=a},getOffsetPosition:function(){return cc.p(this._offsetPosition)},getBlendFunc:function(){return this._blendFunc},initWithSpriteFrame:function(a){if(!a)throw"cc.Sprite.initWithSpriteFrame(): spriteFrame should be non-null";
a.textureLoaded()||(this._textureLoaded=!1,a.addLoadedEventListener(this._spriteFrameLoadedCallback,this));var c=this.initWithTexture(a.getTexture(),a.getRect());this.setDisplayFrame(a);return c},_spriteFrameLoadedCallback:null,_spriteFrameLoadedCallbackForWebGL:function(a){this.setNodeDirty();this.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize());this._callLoadedEventCallbacks()},_spriteFrameLoadedCallbackForCanvas:function(a){this.setNodeDirty();this.setTextureRect(a.getRect(),a.isRotated(),
a.getOriginalSize());a=this.getColor();255===a.r&&255===a.g&&255===a.b||this._changeTextureColor();this._callLoadedEventCallbacks()},initWithSpriteFrameName:function(a){if(!a)throw"cc.Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null";var c=cc.SpriteFrameCache.getInstance().getSpriteFrame(a);if(!c)throw a+" is null, please check.";return this.initWithSpriteFrame(c)},useBatchNode:function(a){this._textureAtlas=a.getTextureAtlas();this._batchNode=a},setVertexRect:function(a){this._rect.x=
a.x;this._rect.y=a.y;this._rect.width=a.width;this._rect.height=a.height},sortAllChildren:function(){if(this._reorderChildDirty){for(var a,c,d=this._children,e,f=1;f<d.length;f++){c=d[f];a=f-1;for(e=d[a];0<=a&&(c._zOrder<e._zOrder||c._zOrder==e._zOrder&&c._orderOfArrival<e._orderOfArrival);)d[a+1]=e,a-=1,e=d[a];d[a+1]=c}this._batchNode&&this._arrayMakeObjectsPerformSelector(d,cc.Node.StateCallbackType.sortAllChildren);this._reorderChildDirty=!1}},reorderChild:function(a,c){if(!a)throw"cc.Sprite.reorderChild(): child should be non-null";
-1===this._children.indexOf(a)?cc.log("cc.Sprite.reorderChild(): this child is not in children list"):c!==a.getZOrder()&&(this._batchNode&&!this._reorderChildDirty&&(this._setReorderChildDirtyRecursively(),this._batchNode.reorderBatch(!0)),cc.Node.prototype.reorderChild.call(this,a,c))},removeChild:function(a,c){this._batchNode&&this._batchNode.removeSpriteFromAtlas(a);cc.Node.prototype.removeChild.call(this,a,c)},removeAllChildren:function(a){var c=this._children,d=this._batchNode;if(d&&null!=c)for(var e=
0,f=c.length;e<f;e++)d.removeSpriteFromAtlas(c[e]);cc.Node.prototype.removeAllChildren.call(this,a);this._hasChildren=!1},setDirtyRecursively:function(a){this._recursiveDirty=a;this.setDirty(a);a=this._children;if(null!=a)for(var c=0;c<a.length;c++)a[c]instanceof cc.Sprite&&a[c].setDirtyRecursively(!0)},SET_DIRTY_RECURSIVELY:function(){this._batchNode&&!this._recursiveDirty&&(this._dirty=this._recursiveDirty=!0,this._hasChildren&&this.setDirtyRecursively(!0))},setPosition:function(a,c){2<=arguments.length?
cc.Node.prototype.setPosition.call(this,a,arguments[1]):cc.Node.prototype.setPosition.call(this,a);this.SET_DIRTY_RECURSIVELY()},setRotation:function(a){cc.Node.prototype.setRotation.call(this,a);this.SET_DIRTY_RECURSIVELY()},setRotationX:function(a){cc.Node.prototype.setRotationX.call(this,a);this.SET_DIRTY_RECURSIVELY()},setRotationY:function(a){cc.Node.prototype.setRotationY.call(this,a);this.SET_DIRTY_RECURSIVELY()},setSkewX:function(a){cc.Node.prototype.setSkewX.call(this,a);this.SET_DIRTY_RECURSIVELY()},
setSkewY:function(a){cc.Node.prototype.setSkewY.call(this,a);this.SET_DIRTY_RECURSIVELY()},setScaleX:function(a){cc.Node.prototype.setScaleX.call(this,a);this.SET_DIRTY_RECURSIVELY()},setScaleY:function(a){cc.Node.prototype.setScaleY.call(this,a);this.SET_DIRTY_RECURSIVELY()},setScale:function(a,c){cc.Node.prototype.setScale.call(this,a,c);this.SET_DIRTY_RECURSIVELY()},setVertexZ:function(a){cc.Node.prototype.setVertexZ.call(this,a);this.SET_DIRTY_RECURSIVELY()},setAnchorPoint:function(a,c){cc.Node.prototype.setAnchorPoint.call(this,
a,c);this.SET_DIRTY_RECURSIVELY()},setVisible:function(a){cc.Node.prototype.setVisible.call(this,a);this.SET_DIRTY_RECURSIVELY()},ignoreAnchorPointForPosition:function(a){this._batchNode?cc.log("cc.Sprite.ignoreAnchorPointForPosition(): it is invalid in cc.Sprite when using SpriteBatchNode"):cc.Node.prototype.ignoreAnchorPointForPosition.call(this,a)},setFlippedX:function(a){this._flippedX!=a&&(this._flippedX=a,this.setTextureRect(this._rect,this._rectRotated,this._contentSize),this.setNodeDirty())},
setFlippedY:function(a){this._flippedY!=a&&(this._flippedY=a,this.setTextureRect(this._rect,this._rectRotated,this._contentSize),this.setNodeDirty())},isFlippedX:function(){return this._flippedX},isFlippedY:function(){return this._flippedY},setOpacityModifyRGB:null,_setOpacityModifyRGBForWebGL:function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this.updateColor())},_setOpacityModifyRGBForCanvas:function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this.setNodeDirty())},isOpacityModifyRGB:function(){return this._opacityModifyRGB},
updateDisplayedOpacity:null,_updateDisplayedOpacityForWebGL:function(a){cc.NodeRGBA.prototype.updateDisplayedOpacity.call(this,a);this.updateColor()},_updateDisplayedOpacityForCanvas:function(a){cc.NodeRGBA.prototype.updateDisplayedOpacity.call(this,a);this._setNodeDirtyForCache()},setDisplayFrameWithAnimationName:function(a,c){if(!a)throw"cc.Sprite.setDisplayFrameWithAnimationName(): animationName must be non-null";var d=cc.AnimationCache.getInstance().getAnimation(a);d?(d=d.getFrames()[c])?this.setDisplayFrame(d.getSpriteFrame()):
cc.log("cc.Sprite.setDisplayFrameWithAnimationName(): Invalid frame index"):cc.log("cc.Sprite.setDisplayFrameWithAnimationName(): Frame not found")},getBatchNode:function(){return this._batchNode},_setReorderChildDirtyRecursively:function(){if(!this._reorderChildDirty){this._reorderChildDirty=!0;for(var a=this._parent;a&&a!=this._batchNode;)a._setReorderChildDirtyRecursively(),a=a.getParent()}},getTexture:function(){return this._texture},_quad:null,_quadWebBuffer:null,_quadDirty:!1,_colorized:!1,
_isLighterMode:!1,_originalTexture:null,_textureRect_Canvas:null,_drawSize_Canvas:null,ctor:null,_ctorForWebGL:function(a){cc.NodeRGBA.prototype.ctor.call(this);this._shouldBeHidden=!1;this._offsetPosition=cc.p(0,0);this._unflippedOffsetPositionFromCenter=cc.p(0,0);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._rect=cc.rect(0,0,0,0);this._quad=new cc.V3F_C4B_T2F_Quad;this._quadWebBuffer=cc.renderContext.createBuffer();this._textureLoaded=this._quadDirty=!0;if(a)if("string"===typeof a)a=
cc.SpriteFrameCache.getInstance().getSpriteFrame(a),this.initWithSpriteFrame(a);else if("object"===typeof a)if(a instanceof cc.SpriteFrame)this.initWithSpriteFrame(a);else if(a instanceof HTMLImageElement||a instanceof HTMLCanvasElement){var c=new cc.Texture2D;c.initWithElement(a);c.handleLoadedTexture();this.initWithTexture(c)}else a instanceof cc.Texture2D&&this.initWithTexture(a)},_ctorForCanvas:function(a){cc.NodeRGBA.prototype.ctor.call(this);this._shouldBeHidden=!1;this._offsetPosition=cc.p(0,
0);this._unflippedOffsetPositionFromCenter=cc.p(0,0);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._rect=cc.rect(0,0,0,0);this._newTextureWhenChangeColor=!1;this._textureLoaded=!0;this._textureRect_Canvas={x:0,y:0,width:0,height:0,validRect:!1};this._drawSize_Canvas=cc.size(0,0);if(a)if("string"===typeof a)a=cc.SpriteFrameCache.getInstance().getSpriteFrame(a),this.initWithSpriteFrame(a);else if("object"===typeof a)if(a instanceof cc.SpriteFrame)this.initWithSpriteFrame(a);else if(a instanceof
HTMLImageElement||a instanceof HTMLCanvasElement){var c=new cc.Texture2D;c.initWithElement(a);c.handleLoadedTexture();this.initWithTexture(c)}else a instanceof cc.Texture2D&&this.initWithTexture(a)},getQuad:function(){return this._quad},setBlendFunc:null,_setBlendFuncForWebGL:function(a,c){var d=this._blendFunc;void 0===c?(d.src=a.src,d.dst=a.dst):(d.src=a,d.dst=c)},_setBlendFuncForCanvas:function(a,c){var d=this._blendFunc;void 0===c?(d.src=a.src,d.dst=a.dst):(d.src=a,d.dst=c);this._isLighterMode=
d&&(d.src==gl.SRC_ALPHA&&d.dst==gl.ONE||d.src==gl.ONE&&d.dst==gl.ONE)},init:null,_initForWebGL:function(){if(0<arguments.length)return this.initWithFile(arguments[0],arguments[1]);cc.NodeRGBA.prototype.init.call(this);this._dirty=this._recursiveDirty=!1;this._opacityModifyRGB=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this.setTexture(null);this._textureLoaded=!0;this._flippedX=this._flippedY=!1;this.setAnchorPoint(0.5,0.5);this._offsetPosition.x=0;this._offsetPosition.y=
0;this._hasChildren=!1;var a={r:255,g:255,b:255,a:255};this._quad.bl.colors=a;this._quad.br.colors=a;this._quad.tl.colors=a;this._quad.tr.colors=a;this._quadDirty=!0;this.setTextureRect(cc.RectZero(),!1,cc.SizeZero());return!0},_initForCanvas:function(){if(0<arguments.length)return this.initWithFile(arguments[0],arguments[1]);cc.NodeRGBA.prototype.init.call(this);this._dirty=this._recursiveDirty=!1;this._opacityModifyRGB=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this.setTexture(null);
this._textureLoaded=!0;this._flippedX=this._flippedY=!1;this.setAnchorPoint(0.5,0.5);this._offsetPosition.x=0;this._offsetPosition.y=0;this._hasChildren=!1;this.setTextureRect(cc.RectZero(),!1,cc.SizeZero());return!0},initWithFile:function(a,c){if(!a)throw"cc.Sprite.initWithFile(): filename should be non-null";var d=cc.TextureCache.getInstance().textureForKey(a);if(!d)d=cc.TextureCache.getInstance().addImage(a);else if(!c){var e=d.getContentSize();c=cc.rect(0,0,e.width,e.height)}return this.initWithTexture(d,
c)},initWithTexture:null,_initWithTextureForWebGL:function(a,c,d){if(0==arguments.length)throw"Sprite.initWithTexture(): Argument must be non-nil ";d=d||!1;if(!cc.NodeRGBA.prototype.init.call(this))return!1;this._batchNode=null;this._dirty=this._recursiveDirty=!1;this._opacityModifyRGB=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this._flippedX=this._flippedY=!1;this.setAnchorPoint(0.5,0.5);this._offsetPosition.x=0;this._offsetPosition.y=0;this._hasChildren=!1;var e=new cc.Color4B(255,
255,255,255),f=this._quad;f.bl.colors=e;f.br.colors=e;f.tl.colors=e;f.tr.colors=e;this._textureLoaded=e=a.isLoaded();if(!e)return this._rectRotated=d||!1,c&&(e=this._rect,e.x=c.x,e.y=c.y,e.width=c.width,e.height=c.height),a.addLoadedEventListener(this._textureLoadedCallback,this),!0;c||(e=a.getContentSize(),c=cc.rect(0,0,e.width,e.height));this.setTexture(a);this.setTextureRect(c,d,c._size);this.setBatchNode(null);return this._quadDirty=!0},_initWithTextureForCanvas:function(a,c,d){if(0==arguments.length)throw"Sprite.initWithTexture(): Argument must be non-nil ";
d=d||!1;if(!cc.NodeRGBA.prototype.init.call(this))return!1;this._batchNode=null;this._dirty=this._recursiveDirty=!1;this._opacityModifyRGB=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this._flippedX=this._flippedY=!1;this.setAnchorPoint(0.5,0.5);this._offsetPosition.x=0;this._offsetPosition.y=0;this._hasChildren=!1;var e=a.isLoaded();this._textureLoaded=e;if(!e)return this._rectRotated=d||!1,c&&(this._rect.x=c.x,this._rect.y=c.y,this._rect.width=c.width,this._rect.height=c.height),
a.addLoadedEventListener(this._textureLoadedCallback,this),!0;c||(e=a.getContentSize(),c=cc.rect(0,0,e.width,e.height));this._originalTexture=a;this.setTexture(a);this.setTextureRect(c,d,c._size);this.setBatchNode(null);return!0},_textureLoadedCallback:null,_textureLoadedCallbackForWebGL:function(a){if(!this._textureLoaded){this._textureLoaded=!0;var c=this._rect;if(!c)c=a.getContentSize(),c=cc.rect(0,0,c.width,c.height);else if(cc._rectEqualToZero(c)){var d=a.getContentSize();c.width=d.width;c.height=
d.height}this.setTexture(a);this.setTextureRect(c,this._rectRotated,c._size);this.setBatchNode(this._batchNode);this._quadDirty=!0;this._callLoadedEventCallbacks()}},_textureLoadedCallbackForCanvas:function(a){if(!this._textureLoaded){this._textureLoaded=!0;var c=this._rect;if(!c)c=a.getContentSize(),c=cc.rect(0,0,c.width,c.height);else if(cc._rectEqualToZero(c)){var d=a.getContentSize();c.width=d.width;c.height=d.height}this._originalTexture=a;this.setTexture(a);this.setTextureRect(c,this._rectRotated,
c._size);this.setBatchNode(this._batchNode);this._callLoadedEventCallbacks()}},setTextureRect:null,_setTextureRectForWebGL:function(a,c,d){this._rectRotated=c||!1;d=d||a._size;this.setContentSize(d);this.setVertexRect(a);this._setTextureCoords(a);a=this._unflippedOffsetPositionFromCenter;this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);var e=this._rect;this._offsetPosition.x=a.x+(this._contentSize.width-e.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-e.height)/2;if(this._batchNode)this._dirty=
!0;else{a=0+this._offsetPosition.x;c=0+this._offsetPosition.y;d=a+e.width;var e=c+e.height,f=this._quad;f.bl.vertices={x:a,y:c,z:0};f.br.vertices={x:d,y:c,z:0};f.tl.vertices={x:a,y:e,z:0};f.tr.vertices={x:d,y:e,z:0};this._quadDirty=!0}},_setTextureRectForCanvas:function(a,c,d){this._rectRotated=c||!1;d=d||a._size;this.setContentSize(d);this.setVertexRect(a);c=this._textureRect_Canvas;d=cc.CONTENT_SCALE_FACTOR();c.x=0|a.x*d;c.y=0|a.y*d;c.width=0|a.width*d;c.height=0|a.height*d;c.validRect=!(0===c.width||
0===c.height||0>c.x||0>c.y);a=this._unflippedOffsetPositionFromCenter;this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);this._offsetPosition.x=a.x+(this._contentSize.width-this._rect.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-this._rect.height)/2;this._batchNode&&(this._dirty=!0)},updateTransform:null,_updateTransformForWebGL:function(){if(this.isDirty()){var a=this._quad,c=this._parent;if(!this._visible||c&&c!=this._batchNode&&c._shouldBeHidden)a.br.vertices={x:0,y:0,z:0},
a.tl.vertices={x:0,y:0,z:0},a.tr.vertices={x:0,y:0,z:0},a.bl.vertices={x:0,y:0,z:0},this._shouldBeHidden=!0;else{this._shouldBeHidden=!1;var d=this._transformToBatch=c&&c!=this._batchNode?cc.AffineTransformConcat(this.nodeToParentTransform(),c._transformToBatch):this.nodeToParentTransform(),e=this._rect._size,c=this._offsetPosition.x,f=this._offsetPosition.y,g=c+e.width,h=f+e.height,e=d.tx,k=d.ty,m=d.a,n=d.b,p=d.d,d=-d.c,q=c*n+f*p+k,s=g*m-f*d+e,r=g*n+f*p+k,t=g*m-h*d+e,g=g*n+h*p+k,u=c*m-h*d+e,h=c*
n+h*p+k,k=this._vertexZ;a.bl.vertices={x:cc.RENDER_IN_SUBPIXEL(c*m-f*d+e),y:cc.RENDER_IN_SUBPIXEL(q),z:k};a.br.vertices={x:cc.RENDER_IN_SUBPIXEL(s),y:cc.RENDER_IN_SUBPIXEL(r),z:k};a.tl.vertices={x:cc.RENDER_IN_SUBPIXEL(u),y:cc.RENDER_IN_SUBPIXEL(h),z:k};a.tr.vertices={x:cc.RENDER_IN_SUBPIXEL(t),y:cc.RENDER_IN_SUBPIXEL(g),z:k}}this._textureAtlas.updateQuad(a,this._atlasIndex);this._recursiveDirty=!1;this.setDirty(!1)}this._hasChildren&&this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.updateTransform);
cc.SPRITE_DEBUG_DRAW&&(a=[cc.p(this._quad.bl.vertices.x,this._quad.bl.vertices.y),cc.p(this._quad.br.vertices.x,this._quad.br.vertices.y),cc.p(this._quad.tr.vertices.x,this._quad.tr.vertices.y),cc.p(this._quad.tl.vertices.x,this._quad.tl.vertices.y)],cc.drawingUtil.drawPoly(a,4,!0))},_updateTransformForCanvas:function(){if(this._dirty){var a=this._parent;!this._visible||a&&a!=this._batchNode&&a._shouldBeHidden?this._shouldBeHidden=!0:(this._shouldBeHidden=!1,this._transformToBatch=a&&a!=this._batchNode?
cc.AffineTransformConcat(this.nodeToParentTransform(),a._transformToBatch):this.nodeToParentTransform());this._dirty=this._recursiveDirty=!1}this._hasChildren&&this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.updateTransform)},addChild:null,_addChildForWebGL:function(a,c,d){if(!a)throw"cc.Sprite.addChild(): child should be non-null";null==c&&(c=a._zOrder);null==d&&(d=a._tag);if(this._batchNode){if(!(a instanceof cc.Sprite)){cc.log("cc.Sprite.addChild(): cc.Sprite only supports cc.Sprites as children when using cc.SpriteBatchNode");
return}a.getTexture()._webTextureObj!==this._textureAtlas.getTexture()._webTextureObj&&cc.log("cc.Sprite.addChild(): cc.Sprite only supports a sprite using same texture as children when using cc.SpriteBatchNode");this._batchNode.appendChild(a);this._reorderChildDirty||this._setReorderChildDirtyRecursively()}cc.NodeRGBA.prototype.addChild.call(this,a,c,d);this._hasChildren=!0},_addChildForCanvas:function(a,c,d){if(!a)throw"cc.Sprite.addChild(): child should be non-null";null==c&&(c=a._zOrder);null==
d&&(d=a._tag);cc.NodeRGBA.prototype.addChild.call(this,a,c,d);this._hasChildren=!0},updateColor:function(){var a=this._displayedColor,c=this._displayedOpacity,a={r:a.r,g:a.g,b:a.b,a:c};this._opacityModifyRGB&&(a.r*=c/255,a.g*=c/255,a.b*=c/255);c=this._quad;c.bl.colors=a;c.br.colors=a;c.tl.colors=a;c.tr.colors=a;this._batchNode&&(this._atlasIndex!=cc.SPRITE_INDEX_NOT_INITIALIZED?this._textureAtlas.updateQuad(c,this._atlasIndex):this._dirty=!0);this._quadDirty=!0},setOpacity:null,_setOpacityForWebGL:function(a){cc.NodeRGBA.prototype.setOpacity.call(this,
a);this.updateColor()},_setOpacityForCanvas:function(a){cc.NodeRGBA.prototype.setOpacity.call(this,a);this._setNodeDirtyForCache()},setColor:null,_setColorForWebGL:function(a){cc.NodeRGBA.prototype.setColor.call(this,a);this.updateColor()},_setColorForCanvas:function(a){var c=this.getColor();if(c.r!==a.r||c.g!==a.g||c.b!==a.b)cc.NodeRGBA.prototype.setColor.call(this,a),this._changeTextureColor(),this._setNodeDirtyForCache()},updateDisplayedColor:null,_updateDisplayedColorForWebGL:function(a){cc.NodeRGBA.prototype.updateDisplayedColor.call(this,
a);this.updateColor()},_updateDisplayedColorForCanvas:function(a){var c=this.getColor();cc.NodeRGBA.prototype.updateDisplayedColor.call(this,a);a=this._displayedColor;if(c.r!==a.r||c.g!==a.g||c.b!==a.b)this._changeTextureColor(),this._setNodeDirtyForCache()},setDisplayFrame:null,_setDisplayFrameForWebGL:function(a){this.setNodeDirty();var c=a.getOffset();this._unflippedOffsetPositionFromCenter.x=c.x;this._unflippedOffsetPositionFromCenter.y=c.y;c=a.getTexture();a.textureLoaded()||(this._textureLoaded=
!1,a.addLoadedEventListener(function(a){this._textureLoaded=!0;var c=a.getTexture();c!=this._texture&&this.setTexture(c);this.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize());this._callLoadedEventCallbacks()},this));c!=this._texture&&this.setTexture(c);this._rectRotated=a.isRotated();this.setTextureRect(a.getRect(),this._rectRotated,a.getOriginalSize())},_setDisplayFrameForCanvas:function(a){this.setNodeDirty();var c=a.getOffset();this._unflippedOffsetPositionFromCenter.x=c.x;this._unflippedOffsetPositionFromCenter.y=
c.y;this._rectRotated=a.isRotated();var c=a.getTexture(),d=a.textureLoaded();d||(this._textureLoaded=!1,a.addLoadedEventListener(function(a){this._textureLoaded=!0;var c=a.getTexture();c!=this._texture&&this.setTexture(c);this.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize());this._callLoadedEventCallbacks()},this));c!=this._texture&&this.setTexture(c);this._rectRotated&&(this._originalTexture=c);this.setTextureRect(a.getRect(),this._rectRotated,a.getOriginalSize());this._colorized=!1;
d&&(a=this.getColor(),255===a.r&&255===a.g&&255===a.b||this._changeTextureColor())},isFrameDisplayed:null,_isFrameDisplayedForWebGL:function(a){return cc.rectEqualToRect(a.getRect(),this._rect)&&a.getTexture().getName()==this._texture.getName()&&cc.pointEqualToPoint(a.getOffset(),this._unflippedOffsetPositionFromCenter)},_isFrameDisplayedForCanvas:function(a){return a.getTexture()!=this._texture?!1:cc.rectEqualToRect(a.getRect(),this._rect)},displayFrame:function(){return cc.SpriteFrame.createWithTexture(this._texture,
cc.RECT_POINTS_TO_PIXELS(this._rect),this._rectRotated,cc.POINT_POINTS_TO_PIXELS(this._unflippedOffsetPositionFromCenter),cc.SIZE_POINTS_TO_PIXELS(this._contentSize))},setBatchNode:null,_setBatchNodeForWebGL:function(a){if(this._batchNode=a)this._transformToBatch=cc.AffineTransformIdentity(),this.setTextureAtlas(this._batchNode.getTextureAtlas());else{this._atlasIndex=cc.SPRITE_INDEX_NOT_INITIALIZED;this.setTextureAtlas(null);this._recursiveDirty=!1;this.setDirty(!1);a=this._offsetPosition.x;var c=
this._offsetPosition.y,d=a+this._rect.width,e=c+this._rect.height,f=this._quad;f.bl.vertices={x:a,y:c,z:0};f.br.vertices={x:d,y:c,z:0};f.tl.vertices={x:a,y:e,z:0};f.tr.vertices={x:d,y:e,z:0};this._quadDirty=!0}},_setBatchNodeForCanvas:function(a){(this._batchNode=a)?(this._transformToBatch=cc.AffineTransformIdentity(),this.setTextureAtlas(this._batchNode.getTextureAtlas())):(this._atlasIndex=cc.SPRITE_INDEX_NOT_INITIALIZED,this.setTextureAtlas(null),this._recursiveDirty=!1,this.setDirty(!1))},setTexture:null,
_setTextureForWebGL:function(a){if(a&&!(a instanceof cc.Texture2D))throw"cc.Sprite.setTexture(): setTexture expects a CCTexture2D. Invalid argument";this._batchNode&&this._batchNode.getTexture()!=a?cc.log("cc.Sprite.setTexture(): Batched sprites should use the same texture as the batchnode"):(a?this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR)):this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_COLOR)),this._batchNode||
this._texture==a||(this._texture=a,this._updateBlendFunc()))},_setTextureForCanvas:function(a){if(a&&!(a instanceof cc.Texture2D))throw"cc.Sprite.setTexture(): setTexture expects a CCTexture2D. Invalid argument";this._texture!=a&&(a&&a.getHtmlElementObj()instanceof HTMLImageElement&&(this._originalTexture=a),this._texture=a)},_updateBlendFunc:function(){this._batchNode?cc.log("cc.Sprite._updateBlendFunc(): _updateBlendFunc doesn't work when the sprite is rendered using a cc.CCSpriteBatchNode"):this._texture&&
this._texture.hasPremultipliedAlpha()?(this._blendFunc.src=cc.BLEND_SRC,this._blendFunc.dst=cc.BLEND_DST,this.setOpacityModifyRGB(!0)):(this._blendFunc.src=gl.SRC_ALPHA,this._blendFunc.dst=gl.ONE_MINUS_SRC_ALPHA,this.setOpacityModifyRGB(!1))},_changeTextureColor:function(){var a,c=this._texture,d=this._textureRect_Canvas;c&&d.validRect&&this._originalTexture&&(a=c.getHtmlElementObj())&&(c=cc.TextureCache.getInstance().getTextureColors(this._originalTexture.getHtmlElementObj()))&&(this._colorized=
!0,a instanceof HTMLCanvasElement&&!this._rectRotated&&!this._newTextureWhenChangeColor?cc.generateTintImage(a,c,this._displayedColor,d,a):(a=cc.generateTintImage(a,c,this._displayedColor,d),c=new cc.Texture2D,c.initWithElement(a),c.handleLoadedTexture(),this.setTexture(c)))},_setTextureCoords:function(a){a=cc.RECT_POINTS_TO_PIXELS(a);var c=this._batchNode?this._textureAtlas.getTexture():this._texture;if(c){var d=c.getPixelsWide(),e=c.getPixelsHigh(),f,g=this._quad;this._rectRotated?(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?
(c=(2*a.x+1)/(2*d),d=c+(2*a.height-2)/(2*d),f=(2*a.y+1)/(2*e),a=f+(2*a.width-2)/(2*e)):(c=a.x/d,d=(a.x+a.height)/d,f=a.y/e,a=(a.y+a.width)/e),this._flippedX&&(e=f,f=a,a=e),this._flippedY&&(e=c,c=d,d=e),g.bl.texCoords.u=c,g.bl.texCoords.v=f,g.br.texCoords.u=c,g.br.texCoords.v=a,g.tl.texCoords.u=d,g.tl.texCoords.v=f,g.tr.texCoords.u=d,g.tr.texCoords.v=a):(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(c=(2*a.x+1)/(2*d),d=c+(2*a.width-2)/(2*d),f=(2*a.y+1)/(2*e),a=f+(2*a.height-2)/(2*e)):(c=a.x/d,d=(a.x+a.width)/
d,f=a.y/e,a=(a.y+a.height)/e),this._flippedX&&(e=c,c=d,d=e),this._flippedY&&(e=f,f=a,a=e),g.bl.texCoords.u=c,g.bl.texCoords.v=a,g.br.texCoords.u=d,g.br.texCoords.v=a,g.tl.texCoords.u=c,g.tl.texCoords.v=f,g.tr.texCoords.u=d,g.tr.texCoords.v=f);this._quadDirty=!0}},draw:null,_drawForWebGL:function(){if(this._textureLoaded){var a=cc.renderContext,c=this._texture;c?c._isLoaded&&(this._shaderProgram.use(),this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4(),cc.glBlendFunc(this._blendFunc.src,
this._blendFunc.dst),cc.glBindTexture2DN(0,c),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.setUniformForModelViewAndProjectionMatrixWithMat4(),
cc.glBlendFunc(this._blendFunc.src,this._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&&(cc.renderContext.bufferData(cc.renderContext.ARRAY_BUFFER,this._quad.arrayBuffer,cc.renderContext.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&&(1===cc.SPRITE_DEBUG_DRAW?(a=this._quad,a=[cc.p(a.tl.vertices.x,a.tl.vertices.y),cc.p(a.bl.vertices.x,a.bl.vertices.y),cc.p(a.br.vertices.x,a.br.vertices.y),cc.p(a.tr.vertices.x,a.tr.vertices.y)],cc.drawingUtil.drawPoly(a,4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(a=this.getTextureRect()._size,c=this.getOffsetPosition(),a=[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(a,
4,!0)))}},_drawForCanvas:function(a){if(this._textureLoaded){a=a||cc.renderContext;this._isLighterMode&&(a.globalCompositeOperation="lighter");var c=cc.EGLView.getInstance().getScaleX(),d=cc.EGLView.getInstance().getScaleY();a.globalAlpha=this._displayedOpacity/255;var e=this._rect,f=this._contentSize,g=this._offsetPosition,h=this._drawSize_Canvas,k=0|g.x,m=-g.y-e.height,n=this._textureRect_Canvas;h.width=e.width*c;h.height=e.height*d;if(this._flippedX||this._flippedY)a.save(),this._flippedX&&(k=
-g.x-e.width,a.scale(-1,1)),this._flippedY&&(m=g.y,a.scale(1,-1));k*=c;m*=d;this._texture&&n.validRect?(f=this._texture.getHtmlElementObj(),this._colorized?a.drawImage(f,0,0,n.width,n.height,k,m,h.width,h.height):a.drawImage(f,n.x,n.y,n.width,n.height,k,m,h.width,h.height)):0!==f.width&&(h=this.getColor(),a.fillStyle="rgba("+h.r+","+h.g+","+h.b+",1)",a.fillRect(k,m,f.width*c,f.height*d));1===cc.SPRITE_DEBUG_DRAW?(a.strokeStyle="rgba(0,255,0,1)",k/=c,m=-(m/d),k=[cc.p(k,m),cc.p(k+e.width,m),cc.p(k+
e.width,m-e.height),cc.p(k,m-e.height)],cc.drawingUtil.drawPoly(k,4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(a.strokeStyle="rgba(0,255,0,1)",c=this._rect._size,m=-m,k=[cc.p(k,m),cc.p(k+c.width,m),cc.p(k+c.width,m-c.height),cc.p(k,m-c.height)],cc.drawingUtil.drawPoly(k,4,!0));(this._flippedX||this._flippedY)&&a.restore();cc.g_NumberOfDraws++}}});
cc.Browser.supportWebGL?(cc.Sprite.prototype._spriteFrameLoadedCallback=cc.Sprite.prototype._spriteFrameLoadedCallbackForWebGL,cc.Sprite.prototype.setOpacityModifyRGB=cc.Sprite.prototype._setOpacityModifyRGBForWebGL,cc.Sprite.prototype.updateDisplayedOpacity=cc.Sprite.prototype._updateDisplayedOpacityForWebGL,cc.Sprite.prototype.ctor=cc.Sprite.prototype._ctorForWebGL,cc.Sprite.prototype.setBlendFunc=cc.Sprite.prototype._setBlendFuncForWebGL,cc.Sprite.prototype.init=cc.Sprite.prototype._initForWebGL,
cc.Sprite.prototype.initWithTexture=cc.Sprite.prototype._initWithTextureForWebGL,cc.Sprite.prototype._textureLoadedCallback=cc.Sprite.prototype._textureLoadedCallbackForWebGL,cc.Sprite.prototype.setTextureRect=cc.Sprite.prototype._setTextureRectForWebGL,cc.Sprite.prototype.updateTransform=cc.Sprite.prototype._updateTransformForWebGL,cc.Sprite.prototype.addChild=cc.Sprite.prototype._addChildForWebGL,cc.Sprite.prototype.setOpacity=cc.Sprite.prototype._setOpacityForWebGL,cc.Sprite.prototype.setColor=
cc.Sprite.prototype._setColorForWebGL,cc.Sprite.prototype.updateDisplayedColor=cc.Sprite.prototype._updateDisplayedColorForWebGL,cc.Sprite.prototype.setDisplayFrame=cc.Sprite.prototype._setDisplayFrameForWebGL,cc.Sprite.prototype.isFrameDisplayed=cc.Sprite.prototype._isFrameDisplayedForWebGL,cc.Sprite.prototype.setBatchNode=cc.Sprite.prototype._setBatchNodeForWebGL,cc.Sprite.prototype.setTexture=cc.Sprite.prototype._setTextureForWebGL,cc.Sprite.prototype.draw=cc.Sprite.prototype._drawForWebGL):(cc.Sprite.prototype._spriteFrameLoadedCallback=
cc.Sprite.prototype._spriteFrameLoadedCallbackForCanvas,cc.Sprite.prototype.setOpacityModifyRGB=cc.Sprite.prototype._setOpacityModifyRGBForCanvas,cc.Sprite.prototype.updateDisplayedOpacity=cc.Sprite.prototype._updateDisplayedOpacityForCanvas,cc.Sprite.prototype.ctor=cc.Sprite.prototype._ctorForCanvas,cc.Sprite.prototype.setBlendFunc=cc.Sprite.prototype._setBlendFuncForCanvas,cc.Sprite.prototype.init=cc.Sprite.prototype._initForCanvas,cc.Sprite.prototype.initWithTexture=cc.Sprite.prototype._initWithTextureForCanvas,
cc.Sprite.prototype._textureLoadedCallback=cc.Sprite.prototype._textureLoadedCallbackForCanvas,cc.Sprite.prototype.setTextureRect=cc.Sprite.prototype._setTextureRectForCanvas,cc.Sprite.prototype.updateTransform=cc.Sprite.prototype._updateTransformForCanvas,cc.Sprite.prototype.addChild=cc.Sprite.prototype._addChildForCanvas,cc.Sprite.prototype.setOpacity=cc.Sprite.prototype._setOpacityForCanvas,cc.Sprite.prototype.setColor=cc.Sprite.prototype._setColorForCanvas,cc.Sprite.prototype.updateDisplayedColor=
cc.Sprite.prototype._updateDisplayedColorForCanvas,cc.Sprite.prototype.setDisplayFrame=cc.Sprite.prototype._setDisplayFrameForCanvas,cc.Sprite.prototype.isFrameDisplayed=cc.Sprite.prototype._isFrameDisplayedForCanvas,cc.Sprite.prototype.setBatchNode=cc.Sprite.prototype._setBatchNodeForCanvas,cc.Sprite.prototype.setTexture=cc.Sprite.prototype._setTextureForCanvas,cc.Sprite.prototype.draw=cc.Sprite.prototype._drawForCanvas);
cc.Sprite.createWithTexture=function(a,c){var d=arguments.length,e=new cc.Sprite;switch(d){case 1:return e&&e.initWithTexture(a)?e:null;case 2:return e&&e.initWithTexture(a,c)?e:null;default:throw"Sprite.createWithTexture(): Argument must be non-nil ";}};cc.Sprite.create=function(a,c){var d=arguments.length,e=new cc.Sprite;if(0===d){if(e.init())return e}else if(e&&e.init(a,c))return e;return null};
cc.Sprite.createWithSpriteFrameName=function(a){var c=null;if("string"==typeof a){if(c=cc.SpriteFrameCache.getInstance().getSpriteFrame(a),!c)return cc.log("Invalid spriteFrameName: "+a),null}else return cc.log("Invalid argument. Expecting string."),null;return(a=new cc.Sprite)&&a.initWithSpriteFrame(c)?a:null};cc.Sprite.createWithSpriteFrame=function(a){var c=new cc.Sprite;return c&&c.initWithSpriteFrame(a)?c:null};cc.AnimationFrame=cc.Class.extend({_spriteFrame:null,_delayPerUnit:0,_userInfo:null,ctor:function(){this._delayPerUnit=0},clone:function(){var a=new cc.AnimationFrame;a.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return a},copyWithZone:function(a){return cc.clone(this)},copy:function(a){a=new cc.AnimationFrame;a.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return a},initWithSpriteFrame:function(a,c,d){this._spriteFrame=a;this._delayPerUnit=
c;this._userInfo=d;return!0},getSpriteFrame:function(){return this._spriteFrame},setSpriteFrame:function(a){this._spriteFrame=a},getDelayUnits:function(){return this._delayPerUnit},setDelayUnits:function(a){this._delayPerUnit=a},getUserInfo:function(){return this._userInfo},setUserInfo:function(a){this._userInfo=a}});
cc.Animation=cc.Class.extend({_frames:null,_loops:0,_restoreOriginalFrame:!1,_duration:0,_delayPerUnit:0,_totalDelayUnits:0,ctor:function(){this._frames=[]},getFrames:function(){return this._frames},setFrames:function(a){this._frames=a},addSpriteFrame:function(a){var c=new cc.AnimationFrame;c.initWithSpriteFrame(a,1,null);this._frames.push(c);this._totalDelayUnits++},addSpriteFrameWithFile:function(a){a=cc.TextureCache.getInstance().addImage(a);var c=cc.RectZero();c._size=a.getContentSize();a=cc.SpriteFrame.createWithTexture(a,
c);this.addSpriteFrame(a)},addSpriteFrameWithTexture:function(a,c){var d=cc.SpriteFrame.createWithTexture(a,c);this.addSpriteFrame(d)},initWithAnimationFrames:function(a,c,d){cc.ArrayVerifyType(a,cc.AnimationFrame);this._delayPerUnit=c;this._loops=d;this._totalDelayUnits=0;c=this._frames;for(d=c.length=0;d<a.length;d++){var e=a[d];c.push(e);this._totalDelayUnits+=e.getDelayUnits()}return!0},clone:function(){var a=new cc.Animation;a.initWithAnimationFrames(this._copyFrames(),this._delayPerUnit,this._loops);
a.setRestoreOriginalFrame(this._restoreOriginalFrame);return a},copyWithZone:function(a){a=new cc.Animation;a.initWithAnimationFrames(this._copyFrames(),this._delayPerUnit,this._loops);a.setRestoreOriginalFrame(this._restoreOriginalFrame);return a},_copyFrames:function(){for(var a=[],c=0;c<this._frames.length;c++)a.push(this._frames[c].clone());return a},copy:function(a){return this.copyWithZone(null)},getLoops:function(){return this._loops},setLoops:function(a){this._loops=a},setRestoreOriginalFrame:function(a){this._restoreOriginalFrame=
a},getRestoreOriginalFrame:function(){return this._restoreOriginalFrame},getDuration:function(){return this._totalDelayUnits*this._delayPerUnit},getDelayPerUnit:function(){return this._delayPerUnit},setDelayPerUnit:function(a){this._delayPerUnit=a},getTotalDelayUnits:function(){return this._totalDelayUnits},initWithSpriteFrames:function(a,c){cc.ArrayVerifyType(a,cc.SpriteFrame);this._loops=1;this._delayPerUnit=c||0;this._totalDelayUnits=0;var d=this._frames;d.length=0;if(a){for(var e=0;e<a.length;e++){var f=
a[e],g=new cc.AnimationFrame;g.initWithSpriteFrame(f,1,null);d.push(g)}this._totalDelayUnits+=a.length}return!0},retain:function(){},release:function(){}});cc.Animation.create=function(a,c,d){var e=arguments.length,f=new cc.Animation;0==e?f.initWithSpriteFrames(null,0):2==e?f.initWithSpriteFrames(a,c||0):3==e&&f.initWithAnimationFrames(a,c,d);return f};cc.Animation.createWithAnimationFrames=function(a,c,d){var e=new cc.Animation;e.initWithAnimationFrames(a,c,d);return e};cc.AnimationCache=cc.Class.extend({addAnimation:function(a,c){this._animations[c]=a},removeAnimation:function(a){a&&this._animations[a]&&delete this._animations[a]},getAnimation:function(a){return this._animations[a]?this._animations[a]:null},_addAnimationsWithDictionary:function(a,c){var d=a.animations;if(d){var e=1,f=a.properties;if(f)for(var e=null!=f.format?parseInt(f.format):e,f=f.spritesheets,g=cc.SpriteFrameCache.getInstance(),h=cc.FileUtils.getInstance(),k,m=0;m<f.length;m++)k=h.fullPathFromRelativeFile(f[m],
c),g.addSpriteFrames(k);switch(e){case 1:this._parseVersion1(d);break;case 2:this._parseVersion2(d);break;default:cc.log("cc.AnimationCache. Invalid animation format")}}else cc.log("cocos2d: cc.AnimationCache: No animations were found in provided dictionary.")},addAnimations:function(a){if(!a)throw"cc.AnimationCache.addAnimations(): Invalid texture file name";var c=cc.FileUtils.getInstance(),d=c.fullPathForFilename(a);(c=c.dictionaryWithContentsOfFileThreadSafe(d))?this._addAnimationsWithDictionary(c,
a):cc.log("cc.AnimationCache.addAnimations(): File could not be found")},_parseVersion1:function(a){var c=cc.SpriteFrameCache.getInstance(),d;for(d in a){var e=a[d],f=e.frames,e=parseFloat(e.delay)||0,g=null;if(f){for(var g=[],h=0;h<f.length;h++){var k=c.getSpriteFrame(f[h]);if(k){var m=new cc.AnimationFrame;m.initWithSpriteFrame(k,1,null);g.push(m)}else cc.log("cocos2d: cc.AnimationCache: Animation '"+d+"' refers to frame '"+f[h]+"' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.")}0===
g.length?cc.log("cocos2d: cc.AnimationCache: None of the frames for animation '"+d+"' were found in the cc.SpriteFrameCache. Animation is not being added to the Animation Cache."):(g.length!=f.length&&cc.log("cocos2d: cc.AnimationCache: An animation in your dictionary refers to a frame which is not in the cc.SpriteFrameCache. Some or all of the frames for the animation '"+d+"' may be missing."),g=cc.Animation.createWithAnimationFrames(g,e,1),cc.AnimationCache.getInstance().addAnimation(g,d))}else cc.log("cocos2d: cc.AnimationCache: Animation '"+
d+"' found in dictionary without any frames - cannot add to animation cache.")}},_parseVersion2:function(a){var c=cc.SpriteFrameCache.getInstance(),d;for(d in a){var e=a[d],f=e.loop,g=parseInt(e.loops),f=f?cc.REPEAT_FOREVER:isNaN(g)?1:g,g=e.restoreOriginalFrame&&!0==e.restoreOriginalFrame?!0:!1,h=e.frames;if(h){for(var k=[],m=0;m<h.length;m++){var n=h[m],p=n.spriteframe,q=c.getSpriteFrame(p);if(q){var p=parseFloat(n.delayUnits)||0,n=n.notification,s=new cc.AnimationFrame;s.initWithSpriteFrame(q,p,
n);k.push(s)}else cc.log("cocos2d: cc.AnimationCache: Animation '"+d+"' refers to frame '"+p+"' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.")}e=parseFloat(e.delayPerUnit)||0;h=new cc.Animation;h.initWithAnimationFrames(k,e,f);h.setRestoreOriginalFrame(g);cc.AnimationCache.getInstance().addAnimation(h,d)}else cc.log("cocos2d: CCAnimationCache: Animation '"+d+"' found in dictionary without any frames - cannot add to animation cache.")}},init:function(){this._animations=
{};return!0},_animations:null});cc.AnimationCache.purgeSharedAnimationCache=function(){cc.s_sharedAnimationCache&&(cc.s_sharedAnimationCache._animations=null,cc.s_sharedAnimationCache=null)};cc.AnimationCache.getInstance=function(){null===cc.s_sharedAnimationCache&&(cc.s_sharedAnimationCache=new cc.AnimationCache,cc.s_sharedAnimationCache.init());return cc.s_sharedAnimationCache};cc.s_sharedAnimationCache=null;cc.SpriteFrame=cc.Class.extend({_offset:null,_originalSize:null,_rectInPixels:null,_rotated:!1,_rect:null,_offsetInPixels:null,_originalSizeInPixels:null,_texture:null,_textureFilename:"",_textureLoaded:!1,_eventListeners:null,ctor:function(){this._offset=cc.p(0,0);this._offsetInPixels=cc.p(0,0);this._originalSize=cc.size(0,0);this._rotated=!1;this._originalSizeInPixels=cc.size(0,0);this._textureFilename="";this._texture=null;this._textureLoaded=!1},textureLoaded:function(){return this._textureLoaded},
addLoadedEventListener:function(a,c){null==this._eventListeners&&(this._eventListeners=[]);this._eventListeners.push({eventCallback:a,eventTarget:c})},_callLoadedEventCallbacks:function(){var a=this._eventListeners;if(a){for(var c=0,d=a.length;c<d;c++){var e=a[c];cc.doCallback(e.eventCallback,e.eventTarget,this)}a.length=0}},getRectInPixels:function(){var a=this._rectInPixels;return cc.rect(a.x,a.y,a.width,a.height)},setRectInPixels:function(a){this._rectInPixels||(this._rectInPixels=cc.rect(0,0,
0,0));this._rectInPixels.x=a.x;this._rectInPixels.y=a.y;this._rectInPixels.width=a.width;this._rectInPixels.height=a.height;this._rect=cc.RECT_PIXELS_TO_POINTS(a)},isRotated:function(){return this._rotated},setRotated:function(a){this._rotated=a},getRect:function(){var a=this._rect;return cc.rect(a.x,a.y,a.width,a.height)},setRect:function(a){this._rect||(this._rect=cc.rect(0,0,0,0));this._rect.x=a.x;this._rect.y=a.y;this._rect.width=a.width;this._rect.height=a.height;this._rectInPixels=cc.RECT_POINTS_TO_PIXELS(this._rect)},
getOffsetInPixels:function(){return cc.p(this._offsetInPixels)},setOffsetInPixels:function(a){this._offsetInPixels.x=a.x;this._offsetInPixels.y=a.y;this._offset=cc.POINT_PIXELS_TO_POINTS(this._offsetInPixels)},getOriginalSizeInPixels:function(){return cc.size(this._originalSizeInPixels)},setOriginalSizeInPixels:function(a){this._originalSizeInPixels.width=a.width;this._originalSizeInPixels.height=a.height},getOriginalSize:function(){return cc.size(this._originalSize)},setOriginalSize:function(a){this._originalSize.width=
a.width;this._originalSize.height=a.height},getTexture:function(){if(this._texture)return this._texture;if(""!==this._textureFilename){var a=cc.TextureCache.getInstance().addImage(this._textureFilename);a&&(this._textureLoaded=a.isLoaded());return a}return null},setTexture:function(a){if(this._texture!=a){var c=a.isLoaded();this._textureLoaded=c;this._texture=a;c||a.addLoadedEventListener(function(a){this._textureLoaded=!0;if(this._rotated&&cc.renderContextType===cc.CANVAS){var c=a.getHtmlElementObj(),
c=cc.cutRotateImageToCanvas(c,this.getRect()),f=new cc.Texture2D;f.initWithElement(c);f.handleLoadedTexture();this.setTexture(f);c=this.getRect();this.setRect(cc.rect(0,0,c.width,c.height))}c=this._rect;0===c.width&&0===c.height&&(a=a.getContentSize(),this._rect.width=a.width,this._rect.height=a.height,this._rectInPixels=cc.RECT_POINTS_TO_PIXELS(this._rect),this._originalSizeInPixels.width=this._rectInPixels.width,this._originalSizeInPixels.height=this._rectInPixels.height,this._originalSize.width=
a.width,this._originalSize.height=a.height);this._callLoadedEventCallbacks()},this)}},getOffset:function(){return cc.p(this._offset)},setOffset:function(a){this._offset.x=a.x;this._offset.y=a.y},clone:function(){var a=new cc.SpriteFrame;a.initWithTextureFilename(this._textureFilename,this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels);a.setTexture(this._texture);return a},copyWithZone:function(){var a=new cc.SpriteFrame;a.initWithTextureFilename(this._textureFilename,
this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels);a.setTexture(this._texture);return a},copy:function(){return this.copyWithZone()},initWithTexture:function(a,c,d,e,f){2===arguments.length&&(c=cc.RECT_POINTS_TO_PIXELS(c));e=e||cc.p(0,0);f=f||c._size;this.setTexture(a);this._rectInPixels=c;this._rect=cc.RECT_PIXELS_TO_POINTS(c);this._offsetInPixels.x=e.x;this._offsetInPixels.y=e.y;this._offset=cc.POINT_PIXELS_TO_POINTS(e);this._originalSizeInPixels.width=f.width;this._originalSizeInPixels.height=
f.height;this._originalSize=cc.SIZE_PIXELS_TO_POINTS(f);this._rotated=d||!1;return!0},initWithTextureFilename:function(a,c,d,e,f){2===arguments.length&&(c=cc.RECT_POINTS_TO_PIXELS(c));e=e||cc.p(0,0);f=f||c._size;this._texture=null;this._textureFilename=a;this._rectInPixels=c;this._rect=cc.RECT_PIXELS_TO_POINTS(c);this._rotated=d||!1;this._offsetInPixels.x=e.x;this._offsetInPixels.y=e.y;this._offset=cc.POINT_PIXELS_TO_POINTS(e);this._originalSizeInPixels.width=f.width;this._originalSizeInPixels.height=
f.height;this._originalSize=cc.SIZE_PIXELS_TO_POINTS(f);return!0}});cc.SpriteFrame.create=function(a,c,d,e,f){var g=new cc.SpriteFrame;switch(arguments.length){case 2:g.initWithTextureFilename(a,c);break;case 5:g.initWithTextureFilename(a,c,d,e,f);break;default:throw"Argument must be non-nil ";}return g};
cc.SpriteFrame.createWithTexture=function(a,c,d,e,f){var g=new cc.SpriteFrame;switch(arguments.length){case 2:g.initWithTexture(a,c);break;case 5:g.initWithTexture(a,c,d,e,f);break;default:throw"Argument must be non-nil ";}return g};
cc.SpriteFrame._frameWithTextureForCanvas=function(a,c,d,e,f){var g=new cc.SpriteFrame;g._texture=a;g._rectInPixels=c;g._rect=cc.RECT_PIXELS_TO_POINTS(c);g._offsetInPixels.x=e.x;g._offsetInPixels.y=e.y;g._offset=cc.POINT_PIXELS_TO_POINTS(g._offsetInPixels);g._originalSizeInPixels.width=f.width;g._originalSizeInPixels.height=f.height;g._originalSize=cc.SIZE_PIXELS_TO_POINTS(g._originalSizeInPixels);g._rotated=d;return g};cc.SpriteFrameCache=cc.Class.extend({_spriteFrames:null,_spriteFramesAliases:null,_loadedFileNames:null,ctor:function(){this._spriteFrames={};this._spriteFramesAliases={};this._loadedFileNames=[]},_addSpriteFramesWithDictionary:function(a,c){var d=a.metadata||a.meta,e=a.frames,f=0;d&&(f=d.format,f=1>=f.length?parseInt(f):f);if(0>f||3<f)cc.log("format is not supported for cc.SpriteFrameCache.addSpriteFramesWithDictionary");else for(var g in e)if(d=e[g]){var h=this._spriteFrames[g];if(!h){if(0==f){var h=
parseFloat(d.x),k=parseFloat(d.y),m=parseFloat(d.width),n=parseFloat(d.height),p=parseFloat(d.offsetX),q=parseFloat(d.offsetY),s=parseInt(d.originalWidth),d=parseInt(d.originalHeight);s&&d||cc.log("cocos2d: WARNING: originalWidth/Height not found on the cc.SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist");s=Math.abs(s);d=Math.abs(d);h=cc.SpriteFrame.createWithTexture(c,cc.rect(h,k,m,n),!1,cc.p(p,q),cc.size(s,d))}else if(1==f||2==f)h=cc.RectFromString(d.frame),k=!1,2==f&&(k=d.rotated),
m=cc.PointFromString(d.offset),d=cc.SizeFromString(d.sourceSize),h=cc.SpriteFrame.createWithTexture(c,h,k,m,d);else if(3==f){var h=cc.SizeFromString(d.spriteSize),k=cc.PointFromString(d.spriteOffset),m=cc.SizeFromString(d.spriteSourceSize),n=cc.RectFromString(d.textureRect),p=d.textureRotated,q=d.aliases,s=g.toString(),r;for(r in q){var t=q[r];this._spriteFramesAliases[t]&&cc.log("cocos2d: WARNING: an alias with name "+r+" already exists");this._spriteFramesAliases[t]=s}void 0!==d.spriteSize&&(n=
cc.rect(n.x,n.y,h.width,h.height));h=cc.SpriteFrame.createWithTexture(c,n,p,k,m)}else var u=d.filename,k=d.frame,h=d.sourceSize,k=cc.rect(k.x,k.y,k.w,k.h),d=d.rotated,m=cc.p(0,0),h=cc.size(h.w,h.h),h=cc.SpriteFrame.createWithTexture(c,k,d,m,h);cc.renderContextType===cc.CANVAS&&h.isRotated()&&h.getTexture().isLoaded()&&(d=h.getTexture().getHtmlElementObj(),d=cc.cutRotateImageToCanvas(d,h.getRectInPixels()),k=new cc.Texture2D,k.initWithElement(d),k.handleLoadedTexture(),h.setTexture(k),d=h._rect,h.setRect(cc.rect(0,
0,d.width,d.height)));this._spriteFrames[null!=u?u:g]=h}}},addSpriteFrames:function(a,c){if(!a)throw"cc.SpriteFrameCache.addSpriteFrames(): plist should be non-null";var d=cc.FileUtils.getInstance(),e;"plist"==a.substr(a.lastIndexOf(".",a.length)+1,a.length)?(e=d.fullPathForFilename(a),e=d.dictionaryWithContentsOfFileThreadSafe(e)):e=JSON.parse(d.getTextFileData(a));switch(arguments.length){case 1:if(!cc.ArrayContainsObject(this._loadedFileNames,a)){var f="",g=e.metadata||e.meta;g&&(f=g.textureFileName||
g.image);""!=f?f=d.fullPathFromRelativeFile(f,a):(f=a,d=f.lastIndexOf(".",f.length),f=f.substr(0,d),f+=".png");(d=cc.TextureCache.getInstance().addImage(f))?(this._addSpriteFramesWithDictionary(e,d),this._loadedFileNames.push(a)):cc.log("cocos2d: cc.SpriteFrameCache: Couldn't load texture")}break;case 2:if(c instanceof cc.Texture2D)-1===this._loadedFileNames.indexOf(a)&&this._checkConflict(e),this._addSpriteFramesWithDictionary(e,c);else{if(!c)throw"cc.SpriteFrameCache.addSpriteFrames(): texture name should not be null";
(d=cc.TextureCache.getInstance().addImage(c))?(-1===this._loadedFileNames.indexOf(a)&&(this._checkConflict(e),this._loadedFileNames.push(a)),this._addSpriteFramesWithDictionary(e,d)):cc.log("cocos2d: cc.SpriteFrameCache: couldn't load texture file. File not found "+c)}break;default:throw"Argument must be non-nil ";}},_checkConflict:function(a){a=a.frames;for(var c in a)this._spriteFrames[c]&&cc.log("cocos2d: WARNING: Sprite frame: "+c+" has already been added by another source, please fix name conflit")},
addSpriteFrame:function(a,c){this._spriteFrames[c]=a},removeSpriteFrames:function(){this._spriteFrames={};this._spriteFramesAliases={};this._loadedFileNames.length=0},removeSpriteFrameByName:function(a){a&&(this._spriteFramesAliases[a]&&delete this._spriteFramesAliases[a],this._spriteFrames[a]&&delete this._spriteFrames[a],this._loadedFileNames.length=0)},removeSpriteFramesFromFile:function(a){var c=cc.FileUtils.getInstance(),d=c.fullPathForFilename(a),c=c.dictionaryWithContentsOfFileThreadSafe(d);
this._removeSpriteFramesFromDictionary(c);cc.ArrayContainsObject(this._loadedFileNames,a)&&cc.ArrayRemoveObject(this._loadedFileNames,a)},_removeSpriteFramesFromDictionary:function(a){a=a.frames;for(var c in a)this._spriteFrames[c]&&delete this._spriteFrames[c]},removeSpriteFramesFromTexture:function(a){for(var c in this._spriteFrames){var d=this._spriteFrames[c];d&&d.getTexture()==a&&delete this._spriteFrames[c]}},getSpriteFrame:function(a){var c;this._spriteFrames[a]&&(c=this._spriteFrames[a]);
if(!c){var d;this._spriteFramesAliases[a]&&(d=this._spriteFramesAliases[a]);d&&(d=d.toString(),this._spriteFrames[d]&&(c=this._spriteFrames[d]),c||cc.log("cocos2d: cc.SpriteFrameCahce: Frame "+a+" not found"))}return c}});cc.s_sharedSpriteFrameCache=null;cc.SpriteFrameCache.getInstance=function(){cc.s_sharedSpriteFrameCache||(cc.s_sharedSpriteFrameCache=new cc.SpriteFrameCache);return cc.s_sharedSpriteFrameCache};
cc.SpriteFrameCache.purgeSharedSpriteFrameCache=function(){cc.s_sharedSpriteFrameCache=null};cc.DEFAULT_SPRITE_BATCH_CAPACITY=29;
cc.SpriteBatchNode=cc.Node.extend({_textureAtlas:null,_blendFunc:null,_descendants:null,addSpriteWithoutQuad:function(a,c,d){if(!a)throw"cc.SpriteBatchNode.addQuadFromSprite(): child should be non-null";if(!(a instanceof cc.Sprite))return cc.log("cc.SpriteBatchNode.addQuadFromSprite(): SpriteBatchNode only supports cc.Sprites as children"),null;a.setAtlasIndex(c);var e=0,f=this._descendants;if(f&&0<f.length)for(var g=0;g<f.length;g++){var h=f[g];if(h&&h.getAtlasIndex()>=c)break;++e}this._descendants=
cc.ArrayAppendObjectToIndex(f,a,e);cc.Node.prototype.addChild.call(this,a,c,d);this.reorderBatch(!1);return this},getTextureAtlas:function(){return this._textureAtlas},setTextureAtlas:function(a){a!=this._textureAtlas&&(this._textureAtlas=a)},getDescendants:function(){return this._descendants},initWithFile:function(a,c){var d=cc.TextureCache.getInstance().textureForKey(a);d||(d=cc.TextureCache.getInstance().addImage(a));return this.initWithTexture(d,c)},_setNodeDirtyForCache:function(){this._cacheDirty=
!0},init:function(a,c){var d=cc.TextureCache.getInstance().textureForKey(a);d||(d=cc.TextureCache.getInstance().addImage(a));return this.initWithTexture(d,c)},increaseAtlasCapacity:function(){var a=this._textureAtlas.getCapacity(),c=Math.floor(4*(a+1)/3);cc.log("cocos2d: CCSpriteBatchNode: resizing TextureAtlas capacity from "+a+" to "+c+".");this._textureAtlas.resizeCapacity(c)||cc.log("cocos2d: WARNING: Not enough memory to resize the atlas")},removeChildAtIndex:function(a,c){this.removeChild(this._children[a],
c)},rebuildIndexInOrder:function(a,c){var d=a.getChildren();if(d&&0<d.length)for(var e=0;e<d.length;e++){var f=d[e];f&&0>f.getZOrder()&&(c=this.rebuildIndexInOrder(f,c))}!a==this&&(a.setAtlasIndex(c),c++);if(d&&0<d.length)for(e=0;e<d.length;e++)(f=d[e])&&0<=f.getZOrder()&&(c=this.rebuildIndexInOrder(f,c));return c},highestAtlasIndexInChild:function(a){var c=a.getChildren();return c&&0!=c.length?this.highestAtlasIndexInChild(c[c.length-1]):a.getAtlasIndex()},lowestAtlasIndexInChild:function(a){var c=
a.getChildren();return c&&0!=c.length?this.lowestAtlasIndexInChild(c[c.length-1]):a.getAtlasIndex()},atlasIndexForChild:function(a,c){var d=a.getParent().getChildren(),e=cc.ArrayGetIndexOfObject(d,a),f=a.getParent()==this,g=null;0<e&&e<cc.UINT_MAX&&(g=d[e-1]);if(f)return 0==e?0:this.highestAtlasIndexInChild(g)+1;if(0==e)return d=a.getParent(),0>c?d.getAtlasIndex():d.getAtlasIndex()+1;if(0>g.getZOrder()&&0>c||0<=g.getZOrder()&&0<=c)return this.highestAtlasIndexInChild(g)+1;d=a.getParent();return d.getAtlasIndex()+
1},reorderBatch:function(a){this._reorderChildDirty=a},setBlendFunc:function(a,c){this._blendFunc=void 0===c?a:{src:a,dst:c}},getBlendFunc:function(){return this._blendFunc},reorderChild:function(a,c){if(!a)throw"cc.SpriteBatchNode.addChild():child should be non-null";-1===this._children.indexOf(a)?cc.log("cc.SpriteBatchNode.addChild(): Child doesn't belong to Sprite"):c!==a.getZOrder()&&(cc.Node.prototype.reorderChild.call(this,a,c),this.setNodeDirty())},removeChild:function(a,c){null!=a&&(-1===
this._children.indexOf(a)?cc.log("cc.SpriteBatchNode.addChild(): sprite batch node should contain the child"):(this.removeSpriteFromAtlas(a),cc.Node.prototype.removeChild.call(this,a,c)))},_mvpMatrix:null,_textureForCanvas:null,_useCache:!1,_originalTexture:null,ctor:null,_ctorForCanvas:function(a){cc.Node.prototype.ctor.call(this);a&&this.init(a,cc.DEFAULT_SPRITE_BATCH_CAPACITY)},_ctorForWebGL:function(a){cc.Node.prototype.ctor.call(this);this._mvpMatrix=new cc.kmMat4;a&&this.init(a,cc.DEFAULT_SPRITE_BATCH_CAPACITY)},
updateQuadFromSprite:null,_updateQuadFromSpriteForCanvas:function(a,c){if(!a)throw"cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null";a instanceof cc.Sprite?(a.setBatchNode(this),a.setAtlasIndex(c),a.setDirty(!0),a.updateTransform()):cc.log("cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children")},_updateQuadFromSpriteForWebGL:function(a,c){if(!a)throw"cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null";if(a instanceof
cc.Sprite){for(var d=this._textureAtlas.getCapacity();c>=d||d==this._textureAtlas.getTotalQuads();)this.increaseAtlasCapacity();a.setBatchNode(this);a.setAtlasIndex(c);a.setDirty(!0);a.updateTransform()}else cc.log("cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children")},_swap:function(a,c){var d=this._descendants,e=this._textureAtlas,f=e.getQuads(),g=d[a],h=cc.V3F_C4B_T2F_QuadCopy(f[a]);d[c].setAtlasIndex(a);d[a]=d[c];e.updateQuad(f[c],a);d[c]=g;e.updateQuad(h,
c)},insertQuadFromSprite:null,_insertQuadFromSpriteForCanvas:function(a,c){if(!a)throw"cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null";a instanceof cc.Sprite?(a.setBatchNode(this),a.setAtlasIndex(c),a.setDirty(!0),a.updateTransform(),this._children=cc.ArrayAppendObjectToIndex(this._children,a,c)):cc.log("cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children")},_insertQuadFromSpriteForWebGL:function(a,c){if(!a)throw"cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null";
if(a instanceof cc.Sprite){for(var d=this._textureAtlas;c>=d.getCapacity()||d.getCapacity()===d.getTotalQuads();)this.increaseAtlasCapacity();a.setBatchNode(this);a.setAtlasIndex(c);d.insertQuad(a.getQuad(),c);a.setDirty(!0);a.updateTransform()}else cc.log("cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children")},_updateAtlasIndex:function(a,c){var d=0,e=a.getChildren();e&&(d=e.length);var f=0;if(0===d)f=a.getAtlasIndex(),a.setAtlasIndex(c),a.setOrderOfArrival(0),
f!=c&&this._swap(f,c),c++;else{f=!0;0<=e[0].getZOrder()&&(f=a.getAtlasIndex(),a.setAtlasIndex(c),a.setOrderOfArrival(0),f!=c&&this._swap(f,c),c++,f=!1);for(d=0;d<e.length;d++){var g=e[d];f&&0<=g.getZOrder()&&(f=a.getAtlasIndex(),a.setAtlasIndex(c),a.setOrderOfArrival(0),f!=c&&this._swap(f,c),c++,f=!1);c=this._updateAtlasIndex(g,c)}f&&(f=a.getAtlasIndex(),a.setAtlasIndex(c),a.setOrderOfArrival(0),f!=c&&this._swap(f,c),c++)}return c},_updateBlendFunc:function(){this._textureAtlas.getTexture().hasPremultipliedAlpha()||
(this._blendFunc.src=gl.SRC_ALPHA,this._blendFunc.dst=gl.ONE_MINUS_SRC_ALPHA)},initWithTexture:null,_initWithTextureForCanvas:function(a,c){this._children=[];this._descendants=[];this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this._textureForCanvas=this._originalTexture=a;return!0},_initWithTextureForWebGL:function(a,c){this._children=[];this._descendants=[];this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);c=c||cc.DEFAULT_SPRITE_BATCH_CAPACITY;this._textureAtlas=new cc.TextureAtlas;
this._textureAtlas.initWithTexture(a,c);this._updateBlendFunc();this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR));return!0},insertChild:function(a,c){a.setBatchNode(this);a.setAtlasIndex(c);a.setDirty(!0);var d=this._textureAtlas;d.getTotalQuads()>=d.getCapacity()&&this.increaseAtlasCapacity();d.insertQuad(a.getQuad(),c);this._descendants=cc.ArrayAppendObjectToIndex(this._descendants,a,c);var d=c+1,e=this._descendants;if(e&&0<e.length)for(;d<e.length;d++)e[d].setAtlasIndex(e[d].getAtlasIndex()+
1);if((e=a.getChildren())&&0<e.length)for(d=0;d<e.length;d++)if(e[d]){var f=this.atlasIndexForChild(e[d],e[d].getZOrder());this.insertChild(e[d],f)}},appendChild:null,_appendChildForCanvas:function(a){this._reorderChildDirty=!0;a.setBatchNode(this);a.setDirty(!0);this._descendants.push(a);a.setAtlasIndex(this._descendants.length-1);a=a.getChildren();for(var c=0;c<a.length;c++)this.appendChild(a[c])},_appendChildForWebGL:function(a){this._reorderChildDirty=!0;a.setBatchNode(this);a.setDirty(!0);this._descendants.push(a);
var c=this._descendants.length-1;a.setAtlasIndex(c);var d=this._textureAtlas;d.getTotalQuads()==d.getCapacity()&&this.increaseAtlasCapacity();d.insertQuad(a.getQuad(),c);a=a.getChildren();for(c=0;c<a.length;c++)this.appendChild(a[c])},removeSpriteFromAtlas:null,_removeSpriteFromAtlasForCanvas:function(a){a.setBatchNode(null);var c=this._descendants,d=cc.ArrayGetIndexOfObject(c,a);if(-1!=d){cc.ArrayRemoveObjectAtIndex(c,d);for(var e=c.length;d<e;++d){var f=c[d];f.setAtlasIndex(f.getAtlasIndex()-1)}}if((a=
a.getChildren())&&0<a.length)for(c=0;c<a.length;c++)a[c]&&this.removeSpriteFromAtlas(a[c])},_removeSpriteFromAtlasForWebGL:function(a){this._textureAtlas.removeQuadAtIndex(a.getAtlasIndex());a.setBatchNode(null);var c=this._descendants,d=cc.ArrayGetIndexOfObject(c,a);if(-1!=d){cc.ArrayRemoveObjectAtIndex(c,d);for(var e=c.length;d<e;++d){var f=c[d];f.setAtlasIndex(f.getAtlasIndex()-1)}}if((a=a.getChildren())&&0<a.length)for(c=0;c<a.length;c++)a[c]&&this.removeSpriteFromAtlas(a[c])},getTexture:null,
_getTextureForCanvas:function(){return this._textureForCanvas},_getTextureForWebGL:function(){return this._textureAtlas.getTexture()},setTexture:null,_setTextureForCanvas:function(a){this._textureForCanvas=a;for(var c=this._children,d=0;d<c.length;d++)c[d].setTexture(a)},_setTextureForWebGL:function(a){this._textureAtlas.setTexture(a);this._updateBlendFunc()},visit:null,_visitForCanvas:function(a){var c=a||cc.renderContext;if(this._visible){c.save();this.transform(a);var d=this._children;if(d)for(this.sortAllChildren(),
a=0;a<d.length;a++)d[a]&&d[a].visit(c);c.restore()}},_visitForWebGL:function(a){a=a||cc.renderContext;if(this._visible){cc.kmGLPushMatrix();var c=this._grid;c&&c.isActive()&&(c.beforeDraw(),this.transformAncestors());this.sortAllChildren();this.transform(a);this.draw(a);c&&c.isActive()&&c.afterDraw(this);cc.kmGLPopMatrix();this.setOrderOfArrival(0)}},addChild:null,_addChildForCanvas:function(a,c,d){if(null==a)throw"cc.SpriteBatchNode.addChild(): child should be non-null";a instanceof cc.Sprite?(c=
null==c?a.getZOrder():c,d=null==d?a.getTag():d,cc.Node.prototype.addChild.call(this,a,c,d),this.appendChild(a),this.setNodeDirty()):cc.log("cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children")},_addChildForWebGL:function(a,c,d){if(null==a)throw"cc.SpriteBatchNode.addChild(): child should be non-null";a instanceof cc.Sprite?a.getTexture()!=this._textureAtlas.getTexture()?cc.log("cc.SpriteBatchNode.addChild(): cc.Sprite is not using the same texture"):(c=null==c?
a.getZOrder():c,d=null==d?a.getTag():d,cc.Node.prototype.addChild.call(this,a,c,d),this.appendChild(a),this.setNodeDirty()):cc.log("cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children")},removeAllChildren:null,_removeAllChildrenForCanvas:function(a){var c=this._descendants;if(c&&0<c.length)for(var d=0,e=c.length;d<e;d++)c[d]&&c[d].setBatchNode(null);cc.Node.prototype.removeAllChildren.call(this,a);this._descendants.length=0},_removeAllChildrenForWebGL:function(a){var c=
this._descendants;if(c&&0<c.length)for(var d=0,e=c.length;d<e;d++)c[d]&&c[d].setBatchNode(null);cc.Node.prototype.removeAllChildren.call(this,a);this._descendants.length=0;this._textureAtlas.removeAllQuads()},sortAllChildren:null,_sortAllChildrenForCanvas:function(){if(this._reorderChildDirty){var a,c=0,d=this._children,e=d.length,f;for(a=1;a<e;a++){var g=d[a],c=a-1;for(f=d[c];0<=c&&(g._zOrder<f._zOrder||g._zOrder==f._zOrder&&g._orderOfArrival<f._orderOfArrival);)d[c+1]=f,c-=1,f=d[c];d[c+1]=g}0<d.length&&
this._arrayMakeObjectsPerformSelector(d,cc.Node.StateCallbackType.sortAllChildren);this._reorderChildDirty=!1}},_sortAllChildrenForWebGL:function(){if(this._reorderChildDirty){var a=this._children,c,d=0,e=a.length,f;for(c=1;c<e;c++){var g=a[c],d=c-1;for(f=a[d];0<=d&&(g._zOrder<f._zOrder||g._zOrder==f._zOrder&&g._orderOfArrival<f._orderOfArrival);)a[d+1]=f,d-=1,f=a[d];a[d+1]=g}if(0<a.length)for(this._arrayMakeObjectsPerformSelector(a,cc.Node.StateCallbackType.sortAllChildren),c=d=0;c<a.length;c++)d=
this._updateAtlasIndex(a[c],d);this._reorderChildDirty=!1}},draw:null,_drawForWebGL:function(){0!==this._textureAtlas.getTotalQuads()&&(this._shaderProgram.use(),this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4(),this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.updateTransform),cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst),this._textureAtlas.drawQuads())}});
cc.Browser.supportWebGL?(cc.SpriteBatchNode.prototype.ctor=cc.SpriteBatchNode.prototype._ctorForWebGL,cc.SpriteBatchNode.prototype.updateQuadFromSprite=cc.SpriteBatchNode.prototype._updateQuadFromSpriteForWebGL,cc.SpriteBatchNode.prototype.insertQuadFromSprite=cc.SpriteBatchNode.prototype._insertQuadFromSpriteForWebGL,cc.SpriteBatchNode.prototype.initWithTexture=cc.SpriteBatchNode.prototype._initWithTextureForWebGL,cc.SpriteBatchNode.prototype.appendChild=cc.SpriteBatchNode.prototype._appendChildForWebGL,
cc.SpriteBatchNode.prototype.removeSpriteFromAtlas=cc.SpriteBatchNode.prototype._removeSpriteFromAtlasForWebGL,cc.SpriteBatchNode.prototype.getTexture=cc.SpriteBatchNode.prototype._getTextureForWebGL,cc.SpriteBatchNode.prototype.setTexture=cc.SpriteBatchNode.prototype._setTextureForWebGL,cc.SpriteBatchNode.prototype.visit=cc.SpriteBatchNode.prototype._visitForWebGL,cc.SpriteBatchNode.prototype.addChild=cc.SpriteBatchNode.prototype._addChildForWebGL,cc.SpriteBatchNode.prototype.removeAllChildren=cc.SpriteBatchNode.prototype._removeAllChildrenForWebGL,
cc.SpriteBatchNode.prototype.sortAllChildren=cc.SpriteBatchNode.prototype._sortAllChildrenForWebGL,cc.SpriteBatchNode.prototype.draw=cc.SpriteBatchNode.prototype._drawForWebGL):(cc.SpriteBatchNode.prototype.ctor=cc.SpriteBatchNode.prototype._ctorForCanvas,cc.SpriteBatchNode.prototype.updateQuadFromSprite=cc.SpriteBatchNode.prototype._updateQuadFromSpriteForCanvas,cc.SpriteBatchNode.prototype.insertQuadFromSprite=cc.SpriteBatchNode.prototype._insertQuadFromSpriteForCanvas,cc.SpriteBatchNode.prototype.initWithTexture=
cc.SpriteBatchNode.prototype._initWithTextureForCanvas,cc.SpriteBatchNode.prototype.appendChild=cc.SpriteBatchNode.prototype._appendChildForCanvas,cc.SpriteBatchNode.prototype.removeSpriteFromAtlas=cc.SpriteBatchNode.prototype._removeSpriteFromAtlasForCanvas,cc.SpriteBatchNode.prototype.getTexture=cc.SpriteBatchNode.prototype._getTextureForCanvas,cc.SpriteBatchNode.prototype.setTexture=cc.SpriteBatchNode.prototype._setTextureForCanvas,cc.SpriteBatchNode.prototype.visit=cc.SpriteBatchNode.prototype._visitForCanvas,
cc.SpriteBatchNode.prototype.removeAllChildren=cc.SpriteBatchNode.prototype._removeAllChildrenForCanvas,cc.SpriteBatchNode.prototype.addChild=cc.SpriteBatchNode.prototype._addChildForCanvas,cc.SpriteBatchNode.prototype.sortAllChildren=cc.SpriteBatchNode.prototype._sortAllChildrenForCanvas,cc.SpriteBatchNode.prototype.draw=cc.Node.prototype.draw);cc.SpriteBatchNode.create=function(a,c){c=c||cc.DEFAULT_SPRITE_BATCH_CAPACITY;var d=new cc.SpriteBatchNode;d.init(a,c);return d};
cc.SpriteBatchNode.createWithTexture=function(a,c){c=c||cc.DEFAULT_SPRITE_BATCH_CAPACITY;var d=new cc.SpriteBatchNode;d.initWithTexture(a,c);return d};cc.ConfigurationType={ConfigurationError:0,ConfigurationString:1,ConfigurationInt:2,ConfigurationDouble:3,ConfigurationBoolean:4};
cc.Configuration=cc.Class.extend({_maxTextureSize:0,_maxModelviewStackDepth:0,_supportsPVRTC:!1,_supportsNPOT:!1,_supportsBGRA8888:!1,_supportsDiscardFramebuffer:!1,_supportsShareableVAO:!1,_maxSamplesAllowed:0,_maxTextureUnits:0,_GlExtensions:"",_valueDict:null,ctor:function(){this._maxModelviewStackDepth=this._maxTextureSize=0;this._supportsShareableVAO=this._supportsDiscardFramebuffer=this._supportsBGRA8888=this._supportsNPOT=this._supportsPVRTC=!1;this._maxTextureUnits=this._maxSamplesAllowed=
0;this._GlExtensions="";this._valueDict={}},getMaxTextureSize:function(){return this._maxTextureSize},getMaxModelviewStackDepth:function(){return this._maxModelviewStackDepth},getMaxTextureUnits:function(){return this._maxTextureUnits},supportsNPOT:function(){return this._supportsNPOT},supportsPVRTC:function(){return this._supportsPVRTC},supportsBGRA8888:function(){return this._supportsBGRA8888},supportsDiscardFramebuffer:function(){return this._supportsDiscardFramebuffer},supportsShareableVAO:function(){return this._supportsShareableVAO},
checkForGLExtension:function(a){return-1<this._GlExtensions.indexOf(a)},init:function(){var a=this._valueDict;a["cocos2d.x.version"]=cc.ENGINE_VERSION;a["cocos2d.x.compiled_with_profiler"]=!1;a["cocos2d.x.compiled_with_gl_state_cache"]=cc.ENABLE_GL_STATE_CACHE;return!0},getCString:function(a,c){var d=this._valueDict;return d[a]?d[a]:c},getBool:function(a,c){null==c&&(c=!1);var d=this._valueDict;return d[a]?d[a]:c},getNumber:function(a,c){null==c&&(c=0);var d=this._valueDict;return d[a]?d[a]:c},getObject:function(a){var c=
this._valueDict;return c[a]?c[a]:null},setObject:function(a,c){this._valueDict[a]=c},dumpInfo:function(){0===cc.ENABLE_GL_STATE_CACHE&&(cc.log(""),cc.log("cocos2d: **** WARNING **** CC_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from ccConfig.js)"),cc.log(""))},gatherGPUInfo:function(){if(cc.renderContextType!==cc.CANVAS){var a=cc.renderContext,c=this._valueDict;c["gl.vendor"]=a.getParameter(a.VENDOR);c["gl.renderer"]=a.getParameter(a.RENDERER);c["gl.version"]=a.getParameter(a.VERSION);
this._GlExtensions="";for(var d=a.getSupportedExtensions(),e=0;e<d.length;e++)this._GlExtensions+=d[e]+" ";this._maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE);c["gl.max_texture_size"]=this._maxTextureSize;this._maxTextureUnits=a.getParameter(a.MAX_COMBINED_TEXTURE_IMAGE_UNITS);c["gl.max_texture_units"]=this._maxTextureUnits;this._supportsPVRTC=this.checkForGLExtension("GL_IMG_texture_compression_pvrtc");c["gl.supports_PVRTC"]=this._supportsPVRTC;this._supportsNPOT=!1;c["gl.supports_NPOT"]=this._supportsNPOT;
this._supportsBGRA8888=this.checkForGLExtension("GL_IMG_texture_format_BGRA888");c["gl.supports_BGRA8888"]=this._supportsBGRA8888;this._supportsDiscardFramebuffer=this.checkForGLExtension("GL_EXT_discard_framebuffer");c["gl.supports_discard_framebuffer"]=this._supportsDiscardFramebuffer;this._supportsShareableVAO=this.checkForGLExtension("vertex_array_object");c["gl.supports_vertex_array_object"]=this._supportsShareableVAO;cc.CHECK_GL_ERROR_DEBUG()}},loadConfigFile:function(a){var c=cc.FileUtils.getInstance(),
d=c.fullPathForFilename(a),c=c.dictionaryWithContentsOfFileThreadSafe(d);if(null!=c)if(c=c.data)for(var e in c)this._valueDict[e]=c[e];else cc.log("Expected 'data' dict, but not found. Config file: "+a)}});cc.Configuration._sharedConfiguration=null;cc.Configuration.getInstance=function(){cc.Configuration._sharedConfiguration||(cc.Configuration._sharedConfiguration=new cc.Configuration,cc.Configuration._sharedConfiguration.init());return cc.Configuration._sharedConfiguration};
cc.Configuration.purgeConfiguration=function(){cc.Configuration._sharedConfiguration=null};cc.g_NumberOfDraws=0;cc.DIRECTOR_PROJECTION_2D=0;cc.DIRECTOR_PROJECTION_3D=1;cc.DIRECTOR_PROJECTION_CUSTOM=3;cc.DIRECTOR_PROJECTION_DEFAULT=cc.DIRECTOR_PROJECTION_3D;cc.DEVICE_ORIENTATION_PORTRAIT=0;cc.DEVICE_ORIENTATION_LANDSCAPE_LEFT=1;cc.DEVICE_ORIENTATION_PORTRAIT_UPSIDE_DOWN=2;cc.DEVICE_ORIENTATION_LANDSCAPE_RIGHT=3;cc.DEVICE_MAX_ORIENTATIONS=2;cc.DirectorDelegate=cc.Class.extend({updateProjection:function(){}});
cc.GLToClipTransform=function(a){var c=new cc.kmMat4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,c);var d=new cc.kmMat4;cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,d);cc.kmMat4Multiply(a,c,d)};
cc.Director=cc.Class.extend({_landscape:!1,_nextDeltaTimeZero:!1,_paused:!1,_purgeDirecotorInNextLoop:!1,_sendCleanupToScene:!1,_animationInterval:0,_oldAnimationInterval:0,_projection:0,_accumDt:0,_contentScaleFactor:1,_displayStats:!1,_deltaTime:0,_frameRate:0,_FPSLabel:null,_SPFLabel:null,_drawsLabel:null,_winSizeInPoints:null,_lastUpdate:null,_nextScene:null,_notificationNode:null,_openGLView:null,_scenesStack:null,_projectionDelegate:null,_runningScene:null,_frames:0,_totalFrames:0,_secondsPerFrame:0,
_dirtyRegion:null,_scheduler:null,_actionManager:null,_touchDispatcher:null,_keyboardDispatcher:null,_accelerometer:null,_mouseDispatcher:null,_isBlur:!1,ctor:function(){this._lastUpdate=Date.now();if(!cc.isAddedHiddenEvent){var a=this;window.addEventListener("focus",function(){a._lastUpdate=Date.now()},!1)}},_resetLastUpdate:function(){this._lastUpdate=Date.now()},init:function(){this._oldAnimationInterval=this._animationInterval=1/cc.defaultFPS;this._scenesStack=[];this._projection=cc.DIRECTOR_PROJECTION_DEFAULT;
this._projectionDelegate=null;this._frameRate=this._accumDt=0;this._displayStats=!1;this._totalFrames=this._frames=0;this._lastUpdate=Date.now();this._purgeDirecotorInNextLoop=this._paused=!1;this._winSizeInPoints=cc.size(0,0);this._openGLView=null;this._contentScaleFactor=1;this._scheduler=new cc.Scheduler;this._actionManager=new cc.ActionManager;this._scheduler.scheduleUpdateForTarget(this._actionManager,cc.PRIORITY_SYSTEM,!1);cc.TouchDispatcher&&(this._touchDispatcher=new cc.TouchDispatcher,this._touchDispatcher.init());
cc.KeyboardDispatcher&&(this._keyboardDispatcher=cc.KeyboardDispatcher.getInstance());cc.Accelerometer&&(this._accelerometer=new cc.Accelerometer);cc.MouseDispatcher&&(this._mouseDispatcher=new cc.MouseDispatcher,this._mouseDispatcher.init());return!0},calculateDeltaTime:function(){var a=Date.now();this._nextDeltaTimeZero?(this._deltaTime=0,this._nextDeltaTimeZero=!1):this._deltaTime=(a-this._lastUpdate)/1E3;0<cc.COCOS2D_DEBUG&&0.2<this._deltaTime&&(this._deltaTime=1/60);this._lastUpdate=a},convertToGL:function(a){var c=
new cc.kmMat4;cc.GLToClipTransform(c);var d=new cc.kmMat4;cc.kmMat4Inverse(d,c);var c=c.mat[14]/c.mat[15],e=this._openGLView.getDesignResolutionSize();a=new cc.kmVec3(2*a.x/e.width-1,1-2*a.y/e.height,c);c=new cc.kmVec3;cc.kmVec3TransformCoord(c,a,d);return cc.p(c.x,c.y)},convertToUI:function(a){var c=new cc.kmMat4;cc.GLToClipTransform(c);var d=new cc.kmVec3;a=new cc.kmVec3(a.x,a.y,0);cc.kmVec3TransformCoord(d,a,c);c=this._openGLView.getDesignResolutionSize();return cc.p(c.width*(0.5*d.x+0.5),c.height*
(0.5*-d.y+0.5))},drawScene:function(){this.calculateDeltaTime();this._paused||this._scheduler.update(this._deltaTime);this._clear();this._nextScene&&this.setNextScene();this._beforeVisitScene&&this._beforeVisitScene();this._runningScene&&this._runningScene.visit();this._notificationNode&&this._notificationNode.visit();this._displayStats&&this._showStats();this._afterVisitScene&&this._afterVisitScene();this._totalFrames++;this._displayStats&&this._calculateMPF()},_clearCanvas:function(){var a=this._openGLView.getViewPortRect();
cc.renderContext.clearRect(-a.x,a.y,a.width,-a.height)},_clearWebGL:function(){var a=cc.renderContext;a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT)},_beforeVisitScene:null,_afterVisitScene:null,_beforeVisitSceneWebGL:function(){cc.kmGLPushMatrix()},_afterVisitSceneWebGL:function(){cc.kmGLPopMatrix()},end:function(){this._purgeDirecotorInNextLoop=!0},getContentScaleFactor:function(){return this._contentScaleFactor},getNotificationNode:function(){return this._notificationNode},getWinSize:function(){return cc.size(this._winSizeInPoints)},
getWinSizeInPixels:function(){return cc.size(this._winSizeInPoints.width*this._contentScaleFactor,this._winSizeInPoints.height*this._contentScaleFactor)},getVisibleSize:function(){return this._openGLView?this._openGLView.getVisibleSize():this.getWinSize()},getVisibleOrigin:function(){return this._openGLView?this._openGLView.getVisibleOrigin():cc.POINT_ZERO},getZEye:function(){return this._winSizeInPoints.height/1.1566},pause:function(){this._paused||(this._oldAnimationInterval=this._animationInterval,
this.setAnimationInterval(0.25),this._paused=!0)},popScene:function(){if(!this._runningScene)throw"running scene should not null";this._scenesStack.pop();var a=this._scenesStack.length;0==a?this.end():(this._sendCleanupToScene=!0,this._nextScene=this._scenesStack[a-1])},purgeCachedData:function(){cc.LabelBMFont.purgeCachedData()},purgeDirector:function(){this.getScheduler().unscheduleAllCallbacks();this._touchDispatcher&&this._touchDispatcher.removeAllDelegates();this._runningScene&&(this._runningScene.onExitTransitionDidStart(),
this._runningScene.onExit(),this._runningScene.cleanup());this._nextScene=this._runningScene=null;this._scenesStack.length=0;this.stopAnimation();cc.LabelBMFont.purgeCachedData();cc.AnimationCache.purgeSharedAnimationCache();cc.SpriteFrameCache.purgeSharedSpriteFrameCache();cc.TextureCache.purgeSharedTextureCache();cc.CHECK_GL_ERROR_DEBUG()},pushScene:function(a){if(!a)throw"the scene should not null";this._sendCleanupToScene=!1;this._scenesStack.push(a);this._nextScene=a},replaceScene:function(a){if(!this._runningScene)throw"Use runWithScene: instead to start the director";
if(!a)throw"the scene should not be null";var c=this._scenesStack.length;0===c?(this._sendCleanupToScene=!0,this._scenesStack[c]=a):(this._sendCleanupToScene=!0,this._scenesStack[c-1]=a);this._nextScene=a},resume:function(){this._paused&&(this.setAnimationInterval(this._oldAnimationInterval),(this._lastUpdate=Date.now())||cc.log("cocos2d: Director: Error in gettimeofday"),this._paused=!1,this._deltaTime=0)},runWithScene:function(a){if(!a)throw"This command can only be used to start the CCDirector. There is already a scene present.";
if(this._runningScene)throw"_runningScene should be null";this.pushScene(a);this.startAnimation()},setAlphaBlending:function(a){a?cc.glBlendFunc(cc.BLEND_SRC,cc.BLEND_DST):cc.glBlendFunc(cc.renderContext.ONE,cc.renderContext.ZERO)},setContentScaleFactor:function(a){a!=this._contentScaleFactor&&(this._contentScaleFactor=a,this._createStatsLabel())},setDepthTest:function(a){if(cc.renderContextType!==cc.CANVAS){var c=cc.renderContext;a?(c.clearDepth(1),c.enable(c.DEPTH_TEST),c.depthFunc(c.LEQUAL)):c.disable(c.DEPTH_TEST)}},
setDefaultValues:function(){},setGLDefaultValues:function(){this.setAlphaBlending(!0);this.setDepthTest(!1);this.setProjection(this._projection);cc.renderContext.clearColor(0,0,0,1)},setNextDeltaTimeZero:function(a){this._nextDeltaTimeZero=a},setNextScene:function(){var a=!1,c=!1;cc.TransitionScene&&(a=this._runningScene?this._runningScene instanceof cc.TransitionScene:!1,c=this._nextScene?this._nextScene instanceof cc.TransitionScene:!1);if(!c){if(c=this._runningScene)c.onExitTransitionDidStart(),
c.onExit();this._sendCleanupToScene&&c&&c.cleanup()}this._runningScene=this._nextScene;this._nextScene=null;a||null==this._runningScene||(this._runningScene.onEnter(),this._runningScene.onEnterTransitionDidFinish())},setNotificationNode:function(a){this._notificationNode=a},getDelegate:function(){return this._projectionDelegate},setDelegate:function(a){this._projectionDelegate=a},setOpenGLView:function(a){this._winSizeInPoints.width=cc.canvas.width;this._winSizeInPoints.height=cc.canvas.height;this._openGLView=
a||cc.EGLView.getInstance();cc.renderContextType!==cc.CANVAS&&(a=cc.Configuration.getInstance(),a.gatherGPUInfo(),a.dumpInfo(),this._createStatsLabel(),this.setGLDefaultValues(),this._touchDispatcher&&this._touchDispatcher.setDispatchEvents(!0))},setViewport:function(){if(this._openGLView){var a=this._winSizeInPoints;this._openGLView.setViewPortInPoints(0,0,a.width,a.height)}},setProjection:function(a){var c=this._winSizeInPoints;if(cc.renderContextType===cc.WEBGL){this.setViewport();switch(a){case cc.DIRECTOR_PROJECTION_2D:cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);
cc.kmGLLoadIdentity();var d=new cc.kmMat4;cc.kmMat4OrthographicProjection(d,0,c.width,0,c.height,-1024,1024);cc.kmGLMultMatrix(d);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();break;case cc.DIRECTOR_PROJECTION_3D:var e=this.getZEye(),f=new cc.kmMat4,d=new cc.kmMat4;cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();cc.kmMat4PerspectiveProjection(f,60,c.width/c.height,0.1,2*e);cc.kmGLMultMatrix(f);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();e=cc.kmVec3Fill(null,
c.width/2,c.height/2,e);c=cc.kmVec3Fill(null,c.width/2,c.height/2,0);f=cc.kmVec3Fill(null,0,1,0);cc.kmMat4LookAt(d,e,c,f);cc.kmGLMultMatrix(d);break;case cc.DIRECTOR_PROJECTION_CUSTOM:this._projectionDelegate&&this._projectionDelegate.updateProjection();break;default:cc.log("cocos2d: Director: unrecognized projection")}this._projection=a;cc.setProjectionMatrixDirty()}else this._projection=a},_showStats:function(){this._frames++;this._accumDt+=this._deltaTime;this._FPSLabel&&this._SPFLabel&&this._drawsLabel?
(this._accumDt>cc.DIRECTOR_FPS_INTERVAL&&(this._SPFLabel.setString(this._secondsPerFrame.toFixed(3)),this._frameRate=this._frames/this._accumDt,this._accumDt=this._frames=0,this._FPSLabel.setString(this._frameRate.toFixed(1)),this._drawsLabel.setString((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},getOpenGLView:function(){return this._openGLView},isNextDeltaTimeZero:function(){return this._nextDeltaTimeZero},isPaused:function(){return this._paused},getTotalFrames:function(){return this._totalFrames},getProjection:function(){return this._projection},popToRootScene:function(){this.popToSceneStackLevel(1)},
popToSceneStackLevel:function(a){if(!this._runningScene)throw"A running Scene is needed";var c=this._scenesStack,d=c.length;if(0==d)this.end();else if(!(a>d)){for(;d>a;){var e=c.pop();e.isRunning()&&(e.onExitTransitionDidStart(),e.onExit());e.cleanup();d--}this._nextScene=c[c.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)},getTouchDispatcher:function(){return this._touchDispatcher},setTouchDispatcher:function(a){this._touchDispatcher!=a&&(this._touchDispatcher=a)},getKeyboardDispatcher:function(){if(!cc.KeyboardDispatcher)throw"cc.KeyboardDispatcher is undefined, maybe it has been removed from js loading list.";return this._keyboardDispatcher},setKeyboardDispatcher:function(a){if(!cc.KeyboardDispatcher)throw"cc.KeyboardDispatcher is undefined, maybe it has been removed from js loading list.";
this._keyboardDispatcher=a},getAccelerometer:function(){if(!cc.Accelerometer)throw"cc.Accelerometer is undefined, maybe it has been removed from js loading list.";return this._accelerometer},setAccelerometer:function(a){if(!cc.Accelerometer)throw"cc.Accelerometer is undefined, maybe it has been removed from js loading list.";this._accelerometer!=a&&(this._accelerometer=a)},getDeltaTime:function(){return this._deltaTime},getMouseDispatcher:function(){if(!cc.MouseDispatcher)throw"cc.MouseDispatcher is undefined, maybe it has been removed from js loading list.";
return this._mouseDispatcher},setMouseDispatcher:function(a){if(!cc.MouseDispatcher)throw"cc.MouseDispatcher is undefined, maybe it has been removed from js loading list.";this._mouseDispatcher!=a&&(this._mouseDispatcher=a)},_createStatsLabel:null,_createStatsLabelForWebGL:function(){if(!cc.LabelAtlas)return this._createStatsLabelForCanvas();if(null!=cc.Director._fpsImageLoaded&&!1!=cc.Director._fpsImageLoaded){var a=new cc.Texture2D;a.initWithElement(cc.Director._fpsImage);a.handleLoadedTexture();
var c=cc.EGLView.getInstance().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.setScale(c);this._FPSLabel=d;d=new cc.LabelAtlas;d._setIgnoreContentScaleFactor(!0);d.initWithString("0.000",a,12,32,".");d.setScale(c);this._SPFLabel=d;d=new cc.LabelAtlas;d._setIgnoreContentScaleFactor(!0);d.initWithString("000",a,12,32,".");d.setScale(c);this._drawsLabel=d;a=cc.DIRECTOR_STATS_POSITION;
this._drawsLabel.setPosition(cc.pAdd(cc.p(0,34*c),a));this._SPFLabel.setPosition(cc.pAdd(cc.p(0,17*c),a));this._FPSLabel.setPosition(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=cc.LabelTTF.create("000.0","Arial",a);this._SPFLabel=cc.LabelTTF.create("0.000","Arial",a);this._drawsLabel=cc.LabelTTF.create("0000","Arial",a);var a=cc.DIRECTOR_STATS_POSITION,
c=this._drawsLabel.getContentSize();this._drawsLabel.setPosition(cc.pAdd(cc.p(c.width/2,5*c.height/2),a));c=this._SPFLabel.getContentSize();this._SPFLabel.setPosition(cc.pAdd(cc.p(c.width/2,3*c.height/2),a));c=this._FPSLabel.getContentSize();this._FPSLabel.setPosition(cc.pAdd(cc.p(c.width/2,c.height/2),a))},_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3}});
cc.Browser.supportWebGL?(cc.Director.prototype._clear=cc.Director.prototype._clearWebGL,cc.Director.prototype._beforeVisitScene=cc.Director.prototype._beforeVisitSceneWebGL,cc.Director.prototype._afterVisitScene=cc.Director.prototype._afterVisitSceneWebGL,cc.Director.prototype._createStatsLabel=cc.Director.prototype._createStatsLabelForWebGL):(cc.Director.prototype._clear=cc.Director.prototype._clearCanvas,cc.Director.prototype._createStatsLabel=cc.Director.prototype._createStatsLabelForCanvas);
cc.DisplayLinkDirector=cc.Director.extend({invalid:!1,startAnimation:function(){this._nextDeltaTimeZero=!0;this.invalid=!1;cc.Application.getInstance().setAnimationInterval(this._animationInterval)},mainLoop:function(){this._purgeDirecotorInNextLoop?(this._purgeDirecotorInNextLoop=!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.s_SharedDirector=null;cc.firstUseDirector=!0;cc.Director.getInstance=function(){cc.firstUseDirector&&(cc.firstUseDirector=!1,cc.s_SharedDirector=new cc.DisplayLinkDirector,cc.s_SharedDirector.init(),cc.s_SharedDirector.setOpenGLView(cc.EGLView.getInstance()));return cc.s_SharedDirector};Object.defineProperties(cc,{windowSize:{get:function(){return cc.director.getWinSize()},enumerable:!0}});cc.firstRun=!0;cc.defaultFPS=60;cc.Director._fpsImage=new Image;
cc.Director._fpsImage.addEventListener("load",function(){cc.Director._fpsImageLoaded=!0});cc.Director._fpsImage.src="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.Camera=cc.Class.extend({_eyeX:null,_eyeY:null,_eyeZ:null,_centerX:null,_centerY:null,_centerZ:null,_upX:null,_upY:null,_upZ:null,_dirty:null,_lookupMatrix:null,ctor:function(){this._lookupMatrix=new cc.kmMat4;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;cc.kmMat4Identity(this._lookupMatrix);this._dirty=!1},locate:function(){if(this._dirty){var a=new cc.kmVec3,c=new cc.kmVec3,d=new cc.kmVec3;cc.kmVec3Fill(a,this._eyeX,this._eyeY,this._eyeZ);cc.kmVec3Fill(c,this._centerX,this._centerY,this._centerZ);cc.kmVec3Fill(d,this._upX,this._upY,this._upZ);cc.kmMat4LookAt(this._lookupMatrix,a,c,d);this._dirty=!1}cc.kmGLMultMatrix(this._lookupMatrix)},setEyeXYZ:function(a,c,d){this.setEye(a,c,
d)},setEye:function(a,c,d){this._eyeX=a;this._eyeY=c;this._eyeZ=d;this._dirty=!0},setCenterXYZ:function(a,c,d){this.setCenter(a,c,d)},setCenter:function(a,c,d){this._centerX=a;this._centerY=c;this._centerZ=d;this._dirty=!0},setUpXYZ:function(a,c,d){this.setUp(a,c,d)},setUp:function(a,c,d){this._upX=a;this._upY=c;this._upZ=d;this._dirty=!0},getEyeXYZ:function(a,c,d){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,
c,d){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,c,d){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_SYSTEM=-2147483648;cc.PRIORITY_NON_SYSTEM=cc.PRIORITY_SYSTEM+1;cc.ArrayVerifyType=function(a,c){if(a&&0<a.length)for(var d=0;d<a.length;d++)if(!(a[d]instanceof c))return cc.log("element type is wrong!"),!1;return!0};cc.ArrayRemoveObjectAtIndex=function(a,c){a.splice(c,1)};cc.ArrayRemoveObject=function(a,c){for(var d=0,e=a.length;d<e;d++)if(a[d]==c){a.splice(d,1);break}};cc.ArrayRemoveArray=function(a,c){for(var d=0,e=c.length;d<e;d++)cc.ArrayRemoveObject(a,c[d])};
cc.ArrayGetIndexOfValue=function(a,c){return a.indexOf(c)};cc.ArrayAppendObject=function(a,c){a.push(c)};cc.ArrayAppendObjectToIndex=function(a,c,d){a.splice(d,0,c);return a};cc.ArrayAppendObjectsToIndex=function(a,c,d){a.splice.apply(a,[d,0].concat(c));return a};cc.ArrayGetIndexOfObject=function(a,c){for(var d=0,e=a.length;d<e;d++)if(a[d]==c)return d;return-1};cc.ArrayContainsObject=function(a,c){return-1!=a.indexOf(c)};
cc.HASH_FIND_INT=function(a,c){if(null==a)return null;for(var d=0;d<a.length;d++)if(a[d].target===c)return a[d];return null};cc.ListEntry=function(a,c,d,e,f,g){this.prev=a;this.next=c;this.target=d;this.priority=e;this.paused=f;this.markedForDeletion=g};cc.HashUpdateEntry=function(a,c,d,e){this.list=a;this.entry=c;this.target=d;this.hh=e};cc.HashTimerEntry=function(a,c,d,e,f,g,h){this.timers=a;this.target=c;this.timerIndex=d;this.currentTimer=e;this.currentTimerSalvaged=f;this.paused=g;this.hh=h};
cc.Timer=cc.Class.extend({_interval:0,_selector:null,_target:null,_elapsed:0,_runForever:!1,_useDelay:!1,_timesExecuted:0,_repeat:0,_delay:0,ctor:function(){},getInterval:function(){return this._interval},setInterval:function(a){},getSelector:function(){return this._selector},initWithTarget:function(a,c,d,e,f){this._target=a;this._selector=c;this._elapsed=-1;this._interval=d||0;this._delay=f||0;this._useDelay=0<this._delay;this._repeat=null==e?cc.REPEAT_FOREVER:e;this._runForever=this._repeat==cc.REPEAT_FOREVER;
return!0},_callSelector:function(){cc.doCallback(this._selector,this._target,this._elapsed)},update:function(a){if(-1==this._elapsed)this._timesExecuted=this._elapsed=0;else{var c=this._target,d=this._selector;this._runForever&&!this._useDelay?(this._elapsed+=a,this._elapsed>=this._interval&&(c&&d&&this._callSelector(),this._elapsed=0)):(this._elapsed+=a,this._useDelay?this._elapsed>=this._delay&&(c&&d&&this._callSelector(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=
this._interval&&(c&&d&&this._callSelector(),this._elapsed=0,this._timesExecuted+=1),this._timesExecuted>this._repeat&&cc.Director.getInstance().getScheduler().unscheduleCallbackForTarget(c,d))}}});cc.Timer.timerWithTarget=function(a,c,d){if(2>arguments.length)throw Error("timerWithTarget'argument can't is null");var e=new cc.Timer;e.initWithTarget(a,c,d||0,cc.REPEAT_FOREVER,0);return e};cc._sharedScheduler=null;
cc.Scheduler=cc.Class.extend({_timeScale:1,_updatesNegList:null,_updates0List:null,_updatesPosList:null,_hashForUpdates:null,_arrayForUpdates:null,_hashForTimers:null,_arrayForTimes:null,_currentTarget:null,_currentTargetSalvaged:!1,_updateHashLocked:!1,ctor:function(){this._timeScale=1;this._updatesNegList=[];this._updates0List=[];this._updatesPosList=[];this._hashForUpdates={};this._arrayForUpdates=[];this._hashForTimers={};this._arrayForTimers=[];this._currentTarget=null;this._updateHashLocked=
this._currentTargetSalvaged=!1},_removeHashElement:function(a){delete this._hashForTimers[a.target.__instanceId];cc.ArrayRemoveObject(this._arrayForTimers,a);a.Timer=null;a.target=null},_findElementFromArray:function(a,c){for(var d=0;d<a.length;d++)if(a[d].target==c)return a[d];return null},_removeUpdateFromHash:function(a){if(a=this._hashForUpdates[a.target.__instanceId])cc.ArrayRemoveObject(a.list,a.entry),delete this._hashForUpdates[a.target.__instanceId],cc.ArrayRemoveObject(this._arrayForUpdates,
a),a.entry=null,a.target=null},_priorityIn:function(a,c,d,e){e=new cc.ListEntry(null,null,c,d,e,!1);if(a){for(var f=!1,g=0;g<a.length;g++)if(d<a[g].priority){a=cc.ArrayAppendObjectToIndex(a,e,g);f=!0;break}f||a.push(e)}else a=[],a.push(e);d=new cc.HashUpdateEntry(a,e,c,null);this._arrayForUpdates.push(d);this._hashForUpdates[c.__instanceId]=d;return a},_appendIn:function(a,c,d){d=new cc.ListEntry(null,null,c,0,d,!1);a.push(d);a=new cc.HashUpdateEntry(a,d,c,null);this._arrayForUpdates.push(a);this._hashForUpdates[c.__instanceId]=
a},setTimeScale:function(a){this._timeScale=a},getTimeScale:function(){return this._timeScale},update:function(a){this._updateHashLocked=!0;1!=this._timeScale&&(a*=this._timeScale);var c,d;for(d=0;d<this._updatesNegList.length;d++)c=this._updatesNegList[d],c.paused||c.markedForDeletion||c.target.update(a);for(d=0;d<this._updates0List.length;d++)c=this._updates0List[d],c.paused||c.markedForDeletion||c.target.update(a);for(d=0;d<this._updatesPosList.length;d++)c=this._updatesPosList[d],c.paused||c.markedForDeletion||
c.target.update(a);for(d=0;d<this._arrayForTimers.length;d++){c=this._currentTarget=this._arrayForTimers[d];this._currentTargetSalvaged=!1;if(!this._currentTarget.paused)for(c.timerIndex=0;c.timerIndex<c.timers.length;c.timerIndex++)c.currentTimer=c.timers[c.timerIndex],c.currentTimerSalvaged=!1,c.currentTimer.update(a),c.currentTimer=null;this._currentTargetSalvaged&&0==this._currentTarget.timers.length&&this._removeHashElement(this._currentTarget)}for(d=0;d<this._updatesNegList.length;d++)this._updatesNegList[d].markedForDeletion&&
this._removeUpdateFromHash(this._updatesNegList[d]);for(d=0;d<this._updates0List.length;d++)this._updates0List[d].markedForDeletion&&this._removeUpdateFromHash(this._updates0List[d]);for(d=0;d<this._updatesPosList.length;d++)this._updatesPosList[d].markedForDeletion&&this._removeUpdateFromHash(this._updatesPosList[d]);this._updateHashLocked=!1;this._currentTarget=null},scheduleCallbackForTarget:function(a,c,d,e,f,g){if(!c)throw"cc.scheduler.scheduleCallbackForTarget(): callback_fn should be non-null.";
if(!a)throw"cc.scheduler.scheduleCallbackForTarget(): target should be non-null.";d=d||0;e=null==e?cc.REPEAT_FOREVER:e;f=f||0;g=g||!1;var h=this._hashForTimers[a.__instanceId];h||(h=new cc.HashTimerEntry(null,a,0,null,null,g,null),this._arrayForTimers.push(h),this._hashForTimers[a.__instanceId]=h);if(null==h.timers)h.timers=[];else for(var k=0;k<h.timers.length;k++)if(g=h.timers[k],c==g._selector){cc.log("CCSheduler#scheduleCallback. Callback already scheduled. Updating interval from:"+g.getInterval().toFixed(4)+
" to "+d.toFixed(4));g._interval=d;return}g=new cc.Timer;g.initWithTarget(a,c,d,e,f);h.timers.push(g)},scheduleUpdateForTarget:function(a,c,d){var e=this._hashForUpdates[a.__instanceId];e?e.entry.markedForDeletion=!1:0==c?this._appendIn(this._updates0List,a,d):0>c?this._updatesNegList=this._priorityIn(this._updatesNegList,a,c,d):this._updatesPosList=this._priorityIn(this._updatesPosList,a,c,d)},unscheduleCallbackForTarget:function(a,c){if(null!=a&&null!=c){var d=this._hashForTimers[a.__instanceId];
if(null!=d)for(var e=0;e<d.timers.length;e++){var f=d.timers[e];if(c==f._selector){f!=d.currentTimer||d.currentTimerSalvaged||(d.currentTimerSalvaged=!0);cc.ArrayRemoveObjectAtIndex(d.timers,e);d.timerIndex>=e&&d.timerIndex--;0==d.timers.length&&(this._currentTarget==d?this._currentTargetSalvaged=!0:this._removeHashElement(d));break}}}},unscheduleUpdateForTarget:function(a){null!=a&&(a=this._hashForUpdates[a.__instanceId],null!=a&&(this._updateHashLocked?a.entry.markedForDeletion=!0:this._removeUpdateFromHash(a.entry)))},
unscheduleAllCallbacksForTarget:function(a){if(null!=a){var c=this._hashForTimers[a.__instanceId];c&&(!c.currentTimerSalvaged&&cc.ArrayContainsObject(c.timers,c.currentTimer)&&(c.currentTimerSalvaged=!0),c.timers.length=0,this._currentTarget==c?this._currentTargetSalvaged=!0:this._removeHashElement(c));this.unscheduleUpdateForTarget(a)}},unscheduleAllCallbacks:function(){this.unscheduleAllCallbacksWithMinPriority(cc.PRIORITY_SYSTEM)},unscheduleAllCallbacksWithMinPriority:function(a){var c;for(c=0;c<
this._arrayForTimers.length;c++)this.unscheduleAllCallbacksForTarget(this._arrayForTimers[c].target);if(0>a)for(c=0;c<this._updatesNegList.length;c++)this.unscheduleUpdateForTarget(this._updatesNegList[c].target);if(0>=a)for(c=0;c<this._updates0List.length;c++)this.unscheduleUpdateForTarget(this._updates0List[c].target);for(c=0;c<this._updatesPosList.length;c++)this._updatesPosList[c].priority>=a&&this.unscheduleUpdateForTarget(this._updatesPosList[c].target)},pauseAllTargets:function(){return this.pauseAllTargetsWithMinPriority(cc.PRIORITY_SYSTEM)},
pauseAllTargetsWithMinPriority:function(a){var c=[],d,e;for(d=0;d<this._arrayForTimers.length;d++)if(e=this._arrayForTimers[d])e.paused=!0,c.push(e.target);if(0>a)for(d=0;d<this._updatesNegList.length;d++)if(e=this._updatesNegList[d])e.paused=!0,c.push(e.target);if(0>=a)for(d=0;d<this._updates0List.length;d++)if(e=this._updates0List[d])e.paused=!0,c.push(e.target);for(d=0;d<this._updatesPosList.length;d++)if(e=this._updatesPosList[d])e.paused=!0,c.push(e.target);return c},resumeTargets:function(a){if(a)for(var c=
0;c<a.length;c++)this.resumeTarget(a[c])},pauseTarget:function(a){if(!a)throw"cc.Scheduler.pauseTarget():target should be non-null";var c=this._hashForTimers[a.__instanceId];c&&(c.paused=!0);if(a=this._hashForUpdates[a.__instanceId])a.entry.paused=!0},resumeTarget:function(a){if(!a)throw"cc.Scheduler.resumeTarget():target should be non-null";var c=this._hashForTimers[a.__instanceId];c&&(c.paused=!1);if(a=this._hashForUpdates[a.__instanceId])a.entry.paused=!1},isTargetPaused:function(a){if(!a)throw"cc.Scheduler.isTargetPaused():target should be non-null";
return(a=this._hashForTimers[a.__instanceId])?a.paused:!1}});cc.RESOURCE_TYPE={IMAGE:["png","jpg","bmp","jpeg","gif"],SOUND:["mp3","ogg","wav","mp4","m4a"],XML:["plist","xml","fnt","tmx","tsx"],BINARY:["ccbi"],FONT:"FONT",TEXT:["txt","vsh","fsh","json","ExportJson"],UNKNOW:[]};cc.ResData=function(a,c,d){this.resList=a||[];this.selector=c;this.target=d;this.loadedNumber=this.curNumber=0;this.totalNumber=this.resList.length};
cc.Loader=cc.Class.extend({_curData:null,_resQueue:null,_isAsync:!1,_scheduler:null,_running:!1,_regisiterLoader:!1,ctor:function(){this._scheduler=cc.Director.getInstance().getScheduler();this._resQueue=[]},initWithResources:function(a,c,d){a?(a=a.concat([]),c=new cc.ResData(a,c,d),this._resQueue.push(c),this._running||(this._running=!0,this._curData=this._resQueue.shift(),this._scheduler.scheduleUpdateForTarget(this))):cc.log("cocos2d:resources should not null")},setAsync:function(a){this._isAsync=
a},onResLoaded:function(a){null!=a&&cc.log("cocos2d:Failed loading resource: "+a);this._curData.loadedNumber++},getPercentage:function(){var a=0,a=this._curData;return a=0==a.totalNumber?100:0|a.loadedNumber/a.totalNumber*100},releaseResources:function(a){if(a&&0<a.length)for(var c=cc.TextureCache.getInstance(),d=cc.AudioEngine?cc.AudioEngine.getInstance():null,e=cc.SAXParser.getInstance(),f=cc.FileUtils.getInstance(),g,h,k,m=0;m<a.length;m++)switch(g=a[m],h="string"==typeof g?g:g.src,k=this._getResType(g,
h),k){case "IMAGE":c.removeTextureForKey(h);break;case "SOUND":if(!d)throw"Can not find AudioEngine! Install it, please.";d.unloadEffect(h);break;case "XML":e.unloadPlist(h);break;case "BINARY":f.unloadBinaryFileData(h);break;case "TEXT":f.unloadTextFileData(h);break;case "FONT":this._unregisterFaceFont(g);break;default:throw"cocos2d:unknown filename extension: "+k;}},update:function(){if(this._isAsync){var a=cc.Director.getInstance()._frameRate;if(null!=a&&20>a){cc.log("cocos2d: frame rate less than 20 fps, skip frame.");
return}}(a=this._curData)&&a.curNumber<a.totalNumber&&(this._loadRes(),a.curNumber++);100<=this.getPercentage()&&(this._complete(),0<this._resQueue.length?(this._running=!0,this._curData=this._resQueue.shift()):(this._running=!1,this._scheduler.unscheduleUpdateForTarget(this)))},_loadRes:function(){var a=cc.TextureCache.getInstance(),c=cc.AudioEngine?cc.AudioEngine.getInstance():null,d=cc.SAXParser.getInstance(),e=cc.FileUtils.getInstance(),f=this._curData.resList.shift(),g=this._getResPath(f),h=
this._getResType(f,g);switch(h){case "IMAGE":a.addImageAsync(g,this.onResLoaded,this);break;case "SOUND":if(!c)throw"Can not find AudioEngine! Install it, please.";c.preloadSound(g,this.onResLoaded,this);break;case "XML":d.preloadPlist(g,this.onResLoaded,this);break;case "BINARY":e.preloadBinaryFileData(g,this.onResLoaded,this);break;case "TEXT":e.preloadTextFileData(g,this.onResLoaded,this);break;case "FONT":this._registerFaceFont(f,this.onResLoaded,this);break;default:throw"cocos2d:unknown filename extension: "+
h;}},_getResPath:function(a){return"string"==typeof a?a:a.src},_getResType:function(a,c){if(null!=a.fontName)return cc.RESOURCE_TYPE.FONT;var d=c.substring(c.lastIndexOf(".")+1,c.length),e=d.indexOf("?");0<e&&(d=d.substring(0,e));for(var f in cc.RESOURCE_TYPE)if(-1!=cc.RESOURCE_TYPE[f].indexOf(d))return f;return d},_complete:function(){cc.doCallback(this._curData.selector,this._curData.target)},_registerFaceFont:function(a,c,d){var e=a.src,f=cc.FileUtils.getInstance();if(e&&0<e.length){var g=document.createElement("style");
g.type="text/css";document.body.appendChild(g);for(var h="@font-face { font-family:"+a.fontName+"; src:",k=0;k<e.length;k++)h+="url('"+f.fullPathForFilename(encodeURI(e[k].src))+"') format('"+e[k].type+"')",h+=k==e.length-1?";":",";g.textContent+=h+"};";e=document.createElement("div");e.style.fontFamily=a.fontName;e.innerHTML=".";e.style.position="absolute";e.style.left="-100px";e.style.top="-100px";document.body.appendChild(e)}cc.doCallback(c,d)},_unregisterFaceFont:function(a){}});
cc.Loader.preload=function(a,c,d){this._instance||(this._instance=new cc.Loader);this._instance.initWithResources(a,c,d);return this._instance};cc.Loader.preloadAsync=function(a,c,d){this._instance||(this._instance=new cc.Loader);this._instance.setAsync(!0);this._instance.initWithResources(a,c,d);return this._instance};cc.Loader.purgeCachedData=function(a){this._instance&&this._instance.releaseResources(a)};cc.Loader.getInstance=function(){this._instance||(this._instance=new cc.Loader);return this._instance};
cc.Loader._instance=null;
cc.LoaderScene=cc.Scene.extend({_logo:null,_logoTexture:null,_texture2d:null,_bgLayer:null,_label:null,_winSize:null,ctor:function(){cc.Scene.prototype.ctor.call(this);this._winSize=cc.Director.getInstance().getWinSize()},init:function(){cc.Scene.prototype.init.call(this);var a=cc.p(this._winSize.width/2,this._winSize.height/2);this._logoTexture=new Image;var c=this,d;this._logoTexture.addEventListener("load",d=function(){c._initStage(a);this.removeEventListener("load",d,!1)});this._logoTexture.src=
"data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAlAAD/4QMpaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjAtYzA2MCA2MS4xMzQ3NzcsIDIwMTAvMDIvMTItMTc6MzI6MDAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjM4MDBEMDY2QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjM4MDBEMDY1QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzUgV2luZG93cyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2RTk0OEM4OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU2RTk0OEM5OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+/+4ADkFkb2JlAGTAAAAAAf/bAIQADQkJCQoJDQoKDRMMCwwTFhENDREWGhUVFhUVGhkUFhUVFhQZGR0fIB8dGScnKionJzk4ODg5QEBAQEBAQEBAQAEODAwOEA4RDw8RFA4RDhQVERISERUfFRUXFRUfKB0ZGRkZHSgjJiAgICYjLCwoKCwsNzc1NzdAQEBAQEBAQEBA/8AAEQgAyACgAwEiAAIRAQMRAf/EALAAAAEFAQEAAAAAAAAAAAAAAAQAAgMFBgcBAQEAAwEBAAAAAAAAAAAAAAAAAQMEAgUQAAIBAgIEBwoLBgQGAwAAAAECAwAEEQUhMRIGQVFxsTITFGGBwdEiQlKSMzWRoeFicqKyI1NzFYJjJDQWB9KjVCbxwkNkJWXik3QRAAIBAgMFBQcDBQEAAAAAAAABAhEDIRIEMUFRcTJhwVIUBZGhsSJyEzOB0ULhYpIjUxX/2gAMAwEAAhEDEQA/AMJSpUqAVKlXuFAeUq9wpUB5XuFe4V6ooDzZHDox0CnGMinzwl7Z8NajaHeoO3vmTBZBtp9YUIqTEV5ROxHKnWRnaU8VRMhFBUjpV7hSoSeUq9pUB5Sr2lhQHlKvcK8oBV7hSFSRrtaKAZs07YNPM1pG2xJIAw1jSeandry/8X4m8VCKkWwaWwam7Xl/4v1W8VLtmX/i/VbxUoKkWwakSM407tmX/i/VbxUmzGwjQsjdY41IARie/U0IbZO0kNtCXnOCkEBeFu4KI3Bs7DNb27ya+jDx3kJeEnpJJEcQVbWDsk17u5urd591ucZkWhym2Vnd9RkCDEpFxDRpbw0bunu5mlp2De2FMLYXOD2wB2xbOeraUcYGJ72mlSUiqzzdzMd3Z3mixltA2yzcK/NlHM1DQyRXce1HocdNOEfJXZ88y9ZojOqhiBszIRiHQ8Y4cK5TvHuzLljHNMqxNoDjLFraHHnjPxcNCGVbxEUzYNTx5jZSxhpW6qTzlwJ+DCvO2Zf+L9VvFSgqyHYNLYNTdssPxfibxUu15f8Ai/VPiqCakOwa82DU/a8v/F+JvFTDdWPBL8R8VKCvYRYV5UzoMAy6QdIIqI0B4KJtxiRQwou16QoGUkntH5Tz0RbZbmF2hktraSVBo2lUkY8tDye0flPPXTslVUyiyVRsjqUOA4yMT8dW2ram2m6UVTNq9S7EIyUVJydMTn/6DnP+im9Wl+g5z/opvVrpteEhQWY4AaSTwAVf5WPiZh/9S5/zj7zltzlmYWkfWXNvJDGTgGcYDHirR7i7mSbwXParsFMrgb7w6jKw/wCmnc9I14kF3vpvCljbMyWMOJL4aEiB8qU/ObUK7HYWVrl1pFZWiCOCBQqKOLjPGTrNZZqKbUXVHq2nNwTuJRk1VpbgXN8s7Rk5ym0UQQzhIG2NAjhxHWbI+gCBVjBBFbwxwQqEiiUJGg1BVGAFe7dV28WYLYZFmF2Th1UD7JGjymGyn1iK5OyzIBGB1HgrLZhamzumQAGJwSqnSCh1q3GOCodxt4cxurdcpzuN4cyhiWaF5Bg09udUmnWw1H/jV9nFuJ7Quo+8h8peThFA+047vduyMtk7fYqTl07YFdfUufMPzT5p71UdtlmYXaGS2t3mQHAsgxANdadYJopLe4QS2867EsZ4QfCNYrCFbjdDPmgkYyWFxgVf04ifJf6ScNdRUW1XBb6FU5TjF5EpSSrGu/s5lN+g5z/opvVpfoOc/wCim9WtdHnatvObJXDW7xLGhB8nrPaY9/HCr+tEdPCVaSeDoYLnqF63lzW4/PFSW3ecxbI84VSzWUwUaSdg0DXXK5nvAipnd6qgKvWnQO7pri9ZUEmm3Vl2j1kr8pRlFRyquBNZjGxQ/S56Y1S2fu9OVueon11Szahoou06QoQUXadIVCD2FJJ7R+U89dMydv8Axdn+TH9muZye0flPPXQstlK5Tbka1gUjlC1q0vVLkeb6r+O3Tx9xcY1nt8c0NrZCyiOE1108NYjGv1joo7Js1jzKyScYLIvkzL6LDwHXVJksH9Sb49dKNq0tj1jA6uriOCL+02FWX7iVtZX1/AzaHTyeoauKn2MX9W79zebiZCuR5MjSrhfXuEtwTrUeZH+yNfdrRNcxI6IzhXlJEak6WIGJ2Rw4ChWnChndtlVBLMdQA0k1gbXNMzzDfDLs6mjaPKppJbWwJ1bOwwxw43OnHh71YT3DpfWUJmFlb5jHHDdeXBHIsrRea5TSqvxqG04cNN62vetoCS4tre5mgnkGE9q+3DKOkuI2WX6LDQRRHWDh1UCtwj7QRg2wdl8Djgw1qe7XvW0BQ3kfZ7mSLgU+T9E6RVbnuVrnWVSWqj+Lt8ZbRuHEdKPkYVcZ2MJY5fSGyeVar45+rkWQHAqccalPE5km1htWK5nK4Wnt5FuUBUwOMG4nGkA/BXUrW4S6torlOjMgcd/xVn7rLo7zKs0uEjCNeSvdwoBhgsZxX1l2j36k3Lu+uyprdj5Vs5A+i/lD48a0aaVJOPi7jB6lbzWozpjB48pf1NDXNN4vfl7+Z4BXS65pvF78vfzPAK71XTHmZ/S/yT+jvJ7L3fHytz1E+upbL+Qj5W56jfXWRnsIYKLtekKEFGWvSFQgyjk9o/Keet3YthlMP/5x9msJJ7R+U89biyb/AMXEv7gD6tadL1T+kwepRrC39ZkLDMbiwMvUHRPG0bjlGg8ore/23sxBldxfMPLupNhT8yL/AORNZbdzJ484scytxgLqJY5LZj6Q2sV5G1Vud1mjjyG0ij0NEGSZToKyhjtqw4waztuiXA3qKTbSxltfGhbZlE95ZtZqxVbgiOZhrER9ph3Svk9+pJILZ4Y4DGBFCUMKjRsGPobPFhUfW0NJmljE2xJcIrcI2vFUEln1lRXd6lrazXT9GCNpD+yNqoI7mOVduNw6nzlOIoPOUa6yye1XXcbMR5GdQ3xY0BSbj31/FcTQZirJ+q431q7anbHCTZ72Bw7lbPrKBMcBWNNgbMBBh+bsjBdni0VJ1lARZs6yWiupxCuMDy6KpS2IwOo6DTr3Mre3e5tZZVUM4ZBjqOOJoWO4jkXajcOOMHGgDISvWIrdAkKR80+TzVl908bPPL3LzxOuHdifxVfiTAg92qI/w+/8gGgSyN/mR7XPVlp0lF/3L3mbVKtu5Hjbk/8AHE2Fc03i9+Xv5ngFdKNc13i9+Xv5ngFaNV0x5nn+l/kn9HeEWXu+PlbnqJ9dS2Xu9OVueon11kZ7CGCjLXpCgxRlr0hUIPYUcntH5Tz1s8vb+Bt1/dqPirGSe0flPPWusG/g4Py15q06XqlyMWvVYQ+ruI9xJOqzO9hOto/sP8tbGOFIrmWeM7IuMDMnAXXQJOUjQeOsJk0nY96ip0CYunrjaHx1t+srPJUbXBm2LrFPikwTOb+T+VhbZxGMrDXp83x1QSy2tucJpUjPETp+Cn5/ftaRvKvtp3Kx48HG3erHMzOxZiWZtLMdJNQSbbL71Vk6yynViOkqnEEfOWtPbXi3EQkGg6mXiNckjeSJxJGxR10qw0GtxuxmvbImD4CZMFlA4fRfv0BqesqqzTMZNMEDbIHtHH2QeCiZJSqMQdOGiue53mz3czQwsRbIcNHnkec3c4qAMuriz68gTIToxwOOnlp0MjxMJYW741Gs3RVldtbygE/dMcHX/moDaxTiWNZB53B3arb8/wC+4SOF4sf/AKxU9kcBsfOGHfoUHtG/RbzY5Die5HHhXdvavqiZ9Q8Jdlq4/gbKua7xe/L38zwCuhpf2Uk/Zo50kmwJKIdogDjw1VzzeL35e/meAVp1LTgqY4nn+mRauzqmqwrjzCLL3fHytz1E+upLL+Qj5W56jfXWRnroYKLtekKEFF2vSFQg9hSSe0flPPWosm/hIfoLzVl5PaPynnrRWb/w0X0F5q06XqlyM2sVYx5gmbFre/t71NY2T+0h8VbSO5SWNJUOKSAMp7jDGspmMPaLRlXS6eWve1/FRO7WYdbZm1Y/eW/R7qHxHRXGojlm3ulid6aVbaW+OALvgCLq2Hm9WxHKWqjhj6xsK1e8dm15l4niG1LZkswGsxtrPeOmsvayBJA1VItlWjptLuTdPMo7LtjRDq9naK4+WF9IrUW7BaHOljGqVHB7w2hzVoZt87d8vaNYSLl02CcRsDEbJbj71Uu7UBkvJ7/D7q2QoDxySaAO8MTXdxRVMpRp5XZOWdF/ms7R5XdyKfKWJsO/5PhrG5XlNxmEywW6bTnTxAAcJNbGSMXkM1pjgbiNo1PziPJ+Os7u7m/6ReM00ZOgxSpqYYHT3wRXMKN4ll9zUG4bQfNshu8sZVuEA2hirA4qe/VOwwrVbzbww5mI44UKRRYkbWG0S3JWctbd7u5WFfOOLHiUdJqmaipfLsIsObhWe001lMkMVvJNjhghIALMcBxCs7fxXQmkupx1bXDswGPlaTidVaEyKNXkoo4eBV+Sq7L7Vs9zcBgeyQ4GQ/MB1crmoim2orezqcowTuSeEY48jQ7oZX2PLzdyLhNd6RjrEY6I7+uspvH78vfzPAK6UAAAFGAGgAcArmu8Xvy9/M8ArTfio24RW5nnaG67uou3H/KPuqT2X8hHytz1G+upLL3enK3PUb66ys9RDBRdr0hQgou06QqEGUkntH5Tz1e238vF9BeaqKT2j8p56vbb+Xi+gvNWjTdUuRn1XTHmTh8KrJTJlt8t1CPIY44cGnpJVjTJYkmjaN9Ib4u7V923njTethRauZJV3PaW1rfLIiXEDYg6R4VYc9CXW7thfOZbKdbGZtLW8uPVY/u3GrkNUkM9zlcxUjbhfWOA90cRq4gv4LhdqN+VToNYWmnRm9NNVWNTyHc6VWBv8wt4YeHqm6xyPmroq1Z7WGFLSxTq7WLSuPSdjrkfumq5yHXDUeA92oO2SKpVumNAaoJLMXH3myp0rpJ4uKhc3tbDM5BMri1zAj79j7KTiY8TcdBpcsith0286o+sPCagEX9Pzg4zXUCp6QYse8oouCG3tk6m1BYv05W6T+IdyolxbHDAAa2OgDlNCz3ryN2WxBd5PJMg1t81eId2ukqnLlTBbfcuY+9uJLiRcvtPvHdsHK+cfRHcHDWsyawjyy0WBcDI3lTP6TeIcFV+S5OmXx9bJg1048o8Cj0V8Jq2DVu09nL80up7OxHi+oal3P8AXB/IsZS8T/YOV65zvCcc7vfzPAK3ivWCz445zeH954BXOr6I8yfSfyz+jvCLP3fHytz1G+upLP3fHytz1E+usbPaQ0UXadIUIKLtekKhB7Ckk9o/Keer22/l4/oLzVRSe0flPPV7b/y8X0F5q0abqlyM+q6Y8yQsBTDMor1o8aiaE1pbluMqS3sbLLHIhSRQyngqukhaJ9uBjo+H5aOa3ao2t34qouRlLajTalGP8v0IY8ylXQ+PKPFU/bYXOLPge6CKia0LaxTOxHu1Q7cuBd9yPEJ7TbjXKO8CajbMIF6CNIeNvJHjqIWJ7tSpYkalqVblwIdyG+RGXur0hXYJFxal+Dhq5y3slkv3Y2pD0pTr+QUClpJRUdo9XW4OLrTHtM16cZLLWkeC7y4jvlNEpcRtw1Ux27Ci448NZrTFy3nn3IQWxlgGrDZ3pza7/M8ArZo+ArF5171uvp+CqdV0R5l/psUrs2vB3hdl7vTlbnqJ9dS2Xu+PlbnqJ9dY2eshooq16QoQUXa9IVCD2FLJ7RuU89WNtmUSQqkgYMgw0accKrpPaPynnrZWG4Vi+VWmY5tnMWXG+XrIYnA0rhj0mdcTgdNdwnKDqjmduM1SRR/qlr8/4KX6pa8T/BVzDuLZXudRZblmbxXcPUNPc3KqCIwrbOzgrHEnHjoyD+3eSXkht7DeKG4umDGOJVUklfouThXfmbnZ7Cvy1vt9pmv1W1+d8FL9VteJvgq5yrcOGfLmzHN80iyyETPbptAEFo2ZG8pmUa1OFNn3Ky6W/sbDKM5hv5bx2WTZA+7RF2y52WOPJTzE+z2Dy1vt9pT/AKpacTerS/U7Tib1a04/t7kDXPY03jhN0W6sQ7K7W3q2dnrMccaDy/8At80kuZfqWYxWNtlcvUPPhiGYhWDeUy7IwYU8xPs9g8tb7faUn6pacTerTxm9oOBvVq3v9z927aynuId44LiWKNnjhAXF2UYhRg516qpsryjLr21665zFLSTaK9U2GOA87SwqY37knRU+BzOzags0s1Oyr+BKM6sxwP6tSDPLMen6vy0rvdm3Sxlu7K/S7WDDrFUDUTxgnTU826eXW7KlxmqQuwDBXUKcD+1Xee/wXuKX5XDGWLapSVcOyhEM/seJ/V+WnjeGx4pPV+Wkm6kKZlFay3Jlt7iFpYZY8ASVK6DjtDDA0f8A0Tl340/1f8Ndx8xJVWXB0KbktFFpNzdVXAC/qOwA0CQni2flrO3Vwbm5lnI2TKxbDirX/wBE5d+NcfV/wVR7xZPa5U9utvI8nWhmbbw0YEAYYAVxfhfy5rlKR4Fulu6X7mW1mzT8S4Yis/5CPlbnqJ9dSWfu9OVueon11mZvQ2i7XpChKKtekKhBlNJ7R+U89bDfGTb3a3ZX0Lcj6kdY+T2j8p560288m1kWQr6MJ+ylSAr+2cnV5renjs3H1loX+3j9XvbbtxLN9lqW4UnV5jdnjtXHxihtyZNjeSBu5J9k1BJe7xy7W5CJ/wCzuD/mTVTf2+fq97LJuLrPsNRueS7W6aJ/38x+vLVXuY+xvHaNxbf2GoCezf8A36j/APsSf8w1sLnqczTefJluYoLm5uo5F61sBshItP1cNFYe1f8A3ir/APfE/wCZUe9bB94r5jwuPsrQFhmG4l/Z2M17HdW90tuu3IkTHaCjWdIw0VVZdks9/C06yJFEp2dp+E1bbqybGTZ8vpQD7L1XRv8A7blT96Oda7tpNuuNE37Cq9KSisjyuUoxrStKllHbLlWTXsMs8chuSuwEPDqwoLe5y+YRE/gLzmqRekvKKtd4327yM/ulHxmrHJStySWVRyrjxKI2XC/CTlnlPPKTpTdFbP0L1bgrf5Lp0G3dPhQHwV0S1lzBsns3sESR8Crh9WAJGjSOKuU3E+zdZQ3oJh8IArdZXFDmOTpHa3i2+YrI2KtKy4ricBsBuHHgFXSo440+Wa2qqxjvM9uMoy+WvzWpLCWWWE28HxL6e43ojgkeSCBY1Ri5BGIUDT51cl3vm276BBqSEH4WbxV0tlkyXJcxTMb+OW6uY9mGHrCzDQwwAbTp2uKuTZ9N1uYsfRRR8WPhrm419mSSjRyiqxVK7y23B/ftuTm2oSdJyzNVw3BFn7vTlbnqF9dS2fu9OVueon11lZuQ2iLdsGFD05H2dNQGV0ntG5Tz1dWm9N1b2kVq8EVwsI2UaQaQOKhmitZGLOmk68DhSFvY+gfWNSAg7z3Qvo7yKCKIohiaNR5LKxx8qpxvjcqS0VpbxvwOAcRQPZ7D0G9Y0uz2HoH1jUCpLY7zXlpbm3eKO5QuzjrBqZji3x17PvNcyT288VvDBJbMWUovS2hslW7mFQ9nsPQPrGl2ew9A+saCod/WNxtbYsrfb17WBxx5ddD2281xC88klvDcSXEnWuzrqOGGC9zRUPZ7D0G9Y0uzWHoH1jQVCLreq6ntZbaO3it1mGy7RjTs1X2mYy20ZiCq8ZOODcdEdmsPQb1jS7PYegfWNdJuLqnQiSUlRqpFLmryxtH1Ma7Qw2gNNPOdSt0oI27p007s9h6B9Y0uz2HoH1jXX3Z+I4+1b8IJdX89xLHKQFMXQUahpxoiPN5P+onfU+A0/s9h6DesaXZ7D0D6xpG7OLbUtu0StW5JJx2bBsmbtiSiEk+cxoCWWSaVpZOk2vDVo0VYdnsPQb1jSNvZcCH1jSd2c+p1XAmFqEOmOPEfaH+BQd1ueo211IzrgFUYKNAAqI1WztCpUqVCRUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoD/9k\x3d";
this._logoTexture.width=160;this._logoTexture.height=200;this._bgLayer=cc.LayerColor.create(cc.c4(32,32,32,255));this._bgLayer.setPosition(0,0);this.addChild(this._bgLayer,0);this._label=cc.LabelTTF.create("Loading... 0%","Arial",14);this._label.setColor(cc.c3(180,180,180));this._label.setPosition(cc.pAdd(a,cc.p(0,-110)));this._bgLayer.addChild(this._label,10)},_initStage:function(a){this._texture2d=new cc.Texture2D;this._texture2d.initWithElement(this._logoTexture);this._texture2d.handleLoadedTexture();
this._logo=cc.Sprite.createWithTexture(this._texture2d);this._logo.setScale(cc.CONTENT_SCALE_FACTOR());this._logo.setPosition(a);this._bgLayer.addChild(this._logo,10)},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.schedule(this._startLoading,0.3)},onExit:function(){cc.Node.prototype.onExit.call(this);this._label.setString("Loading... 0%")},initWithResources:function(a,c,d){this.resources=a;this.selector=c;this.target=d},_startLoading:function(){this.unschedule(this._startLoading);cc.Loader.preload(this.resources,
this.selector,this.target);this.schedule(this._updatePercent)},_updatePercent:function(){var a=cc.Loader.getInstance().getPercentage();this._label.setString("Loading... "+a+"%");100<=a&&this.unschedule(this._updatePercent)}});cc.LoaderScene.preload=function(a,c,d){this._instance||(this._instance=new cc.LoaderScene,this._instance.init());this._instance.initWithResources(a,c,d);a=cc.Director.getInstance();a.getRunningScene()?a.replaceScene(this._instance):a.runWithScene(this._instance);return this._instance};cc.DrawingPrimitive=cc.Class.extend({_renderContext:null,setRenderContext:function(a){this._renderContext=a},getRenderContext:function(){return this._renderContext},ctor:function(a){this._renderContext=a},drawPoint:function(a){cc.log("DrawingPrimitive.drawPoint() not implement!")},drawPoints:function(a,c){cc.log("DrawingPrimitive.drawPoints() not implement!")},drawLine:function(a,c){cc.log("DrawingPrimitive.drawLine() not implement!")},drawRect:function(a,c){cc.log("DrawingPrimitive.drawRect() not implement!")},
drawSolidRect:function(a,c,d){cc.log("DrawingPrimitive.drawSolidRect() not implement!")},drawPoly:function(a,c,d,e){cc.log("DrawingPrimitive.drawPoly() not implement!")},drawSolidPoly:function(a,c,d){cc.log("DrawingPrimitive.drawSolidPoly() not implement!")},drawCircle:function(a,c,d,e,f){cc.log("DrawingPrimitive.drawCircle() not implement!")},drawQuadBezier:function(a,c,d,e){cc.log("DrawingPrimitive.drawQuadBezier() not implement!")},drawCubicBezier:function(a,c,d,e,f){cc.log("DrawingPrimitive.drawCubicBezier() not implement!")},
drawCatmullRom:function(a,c){cc.log("DrawingPrimitive.drawCardinalSpline() not implement!")},drawCardinalSpline:function(a,c,d){cc.log("DrawingPrimitive.drawCardinalSpline() not implement!")}});
cc.DrawingPrimitiveCanvas=cc.DrawingPrimitive.extend({_cacheArray:[],drawPoint:function(a,c){c||(c=1);var d=cc.EGLView.getInstance().getScaleX(),e=cc.EGLView.getInstance().getScaleY(),e=cc.p(a.x*d,a.y*e);this._renderContext.beginPath();this._renderContext.arc(e.x,-e.y,c*d,0,2*Math.PI,!1);this._renderContext.closePath();this._renderContext.fill()},drawPoints:function(a,c,d){if(null!=a){d||(d=1);c=this._renderContext;var e=cc.EGLView.getInstance().getScaleX(),f=cc.EGLView.getInstance().getScaleY();
c.beginPath();for(var g=0,h=a.length;g<h;g++)c.arc(a[g].x*e,-a[g].y*f,d*e,0,2*Math.PI,!1);c.closePath();c.fill()}},drawLine:function(a,c){var d=this._renderContext,e=cc.EGLView.getInstance().getScaleX(),f=cc.EGLView.getInstance().getScaleY();d.beginPath();d.moveTo(a.x*e,-a.y*f);d.lineTo(c.x*e,-c.y*f);d.closePath();d.stroke()},drawRect:function(a,c){this.drawLine(cc.p(a.x,a.y),cc.p(c.x,a.y));this.drawLine(cc.p(c.x,a.y),cc.p(c.x,c.y));this.drawLine(cc.p(c.x,c.y),cc.p(a.x,c.y));this.drawLine(cc.p(a.x,
c.y),cc.p(a.x,a.y))},drawSolidRect:function(a,c,d){a=[a,cc.p(c.x,a.y),c,cc.p(a.x,c.y)];this.drawSolidPoly(a,4,d)},drawPoly:function(a,c,d,e){e=e||!1;if(null!=a){if(3>a.length)throw Error("Polygon's point must greater than 2");var f=a[0];c=this._renderContext;var g=cc.EGLView.getInstance().getScaleX(),h=cc.EGLView.getInstance().getScaleY();c.beginPath();c.moveTo(f.x*g,-f.y*h);for(var f=1,k=a.length;f<k;f++)c.lineTo(a[f].x*g,-a[f].y*h);d&&c.closePath();e?c.fill():c.stroke()}},drawSolidPoly:function(a,
c,d){this.setDrawColor4F(d.r,d.g,d.b,d.a);this.drawPoly(a,c,!0,!0)},drawCircle:function(a,c,d,e,f){f=f||!1;e=this._renderContext;var g=cc.EGLView.getInstance().getScaleX(),h=cc.EGLView.getInstance().getScaleY();e.beginPath();e.arc(0|a.x*g,0|-(a.y*h),c*g,-d,-(d-2*Math.PI),!1);f&&e.lineTo(0|a.x*g,0|-(a.y*h));e.stroke()},drawQuadBezier:function(a,c,d,e){for(var f=this._cacheArray,g=f.length=0,h=0;h<e;h++){var k=Math.pow(1-g,2)*a.x+2*(1-g)*g*c.x+g*g*d.x,m=Math.pow(1-g,2)*a.y+2*(1-g)*g*c.y+g*g*d.y;f.push(cc.p(k,
m));g+=1/e}f.push(cc.p(d.x,d.y));this.drawPoly(f,e+1,!1,!1)},drawCubicBezier:function(a,c,d,e,f){for(var g=this._cacheArray,h=g.length=0,k=0;k<f;k++){var m=Math.pow(1-h,3)*a.x+3*Math.pow(1-h,2)*h*c.x+3*(1-h)*h*h*d.x+h*h*h*e.x,n=Math.pow(1-h,3)*a.y+3*Math.pow(1-h,2)*h*c.y+3*(1-h)*h*h*d.y+h*h*h*e.y;g.push(cc.p(m,n));h+=1/f}g.push(cc.p(e.x,e.y));this.drawPoly(g,f+1,!1,!1)},drawCatmullRom:function(a,c){this.drawCardinalSpline(a,0.5,c)},drawCardinalSpline:function(a,c,d){cc.renderContext.strokeStyle="rgba(255,255,255,1)";
var e=this._cacheArray;e.length=0;for(var f,g,h=1/a.length,k=0;k<d+1;k++)g=k/d,1==g?(f=a.length-1,g=1):(f=0|g/h,g=(g-h*f)/h),f=cc.CardinalSplineAt(cc.getControlPointAt(a,f-1),cc.getControlPointAt(a,f-0),cc.getControlPointAt(a,f+1),cc.getControlPointAt(a,f+2),c,g),e.push(f);this.drawPoly(e,d+1,!1,!1)},drawImage:function(a,c,d,e,f){switch(arguments.length){case 2:this._renderContext.drawImage(a,c.x,-(c.y+a.height));break;case 3:this._renderContext.drawImage(a,c.x,-(c.y+d.height),d.width,d.height);break;
case 5:this._renderContext.drawImage(a,c.x,c.y,d.width,d.height,e.x,-(e.y+f.height),f.width,f.height);break;default:throw Error("Argument must be non-nil");}},drawStar:function(a,c,d){a=a||this._renderContext;c*=cc.EGLView.getInstance().getScaleX();d instanceof cc.Color4F&&(d=new cc.Color3B(0|255*d.r,0|255*d.g,0|255*d.b));d="rgba("+d.r+","+d.g+","+d.b;a.fillStyle=d+",1)";var e=c/10;a.beginPath();a.moveTo(-c,c);a.lineTo(0,e);a.lineTo(c,c);a.lineTo(e,0);a.lineTo(c,-c);a.lineTo(0,-e);a.lineTo(-c,-c);
a.lineTo(-e,0);a.lineTo(-c,c);a.closePath();a.fill();var f=a.createRadialGradient(0,0,e,0,0,c);f.addColorStop(0,d+", 1)");f.addColorStop(0.3,d+", 0.8)");f.addColorStop(1,d+", 0.0)");a.fillStyle=f;a.beginPath();a.arc(0,0,c-e,0,cc.PI2,!1);a.closePath();a.fill()},drawColorBall:function(a,c,d){a=a||this._renderContext;c*=cc.EGLView.getInstance().getScaleX();d instanceof cc.Color4F&&(d=new cc.Color3B(0|255*d.r,0|255*d.g,0|255*d.b));d="rgba("+d.r+","+d.g+","+d.b;var e=a.createRadialGradient(0,0,c/10,0,
0,c);e.addColorStop(0,d+", 1)");e.addColorStop(0.3,d+", 0.8)");e.addColorStop(0.6,d+", 0.4)");e.addColorStop(1,d+", 0.0)");a.fillStyle=e;a.beginPath();a.arc(0,0,c,0,cc.PI2,!1);a.closePath();a.fill()},fillText:function(a,c,d){this._renderContext.fillText(a,c,-d)},setDrawColor4B:function(a,c,d,e){this._renderContext.fillStyle="rgba("+a+","+c+","+d+","+e/255+")";this._renderContext.strokeStyle="rgba("+a+","+c+","+d+","+e/255+")"},setDrawColor4F:function(a,c,d,e){this._renderContext.fillStyle="rgba("+
(0|255*a)+","+(0|255*c)+","+(0|255*d)+","+e+")";this._renderContext.strokeStyle="rgba("+(0|255*a)+","+(0|255*c)+","+(0|255*d)+","+e+")"},setPointSize:function(a){},setLineWidth:function(a){this._renderContext.lineWidth=a*cc.EGLView.getInstance().getScaleX()}});
cc.DrawingPrimitiveWebGL=cc.DrawingPrimitive.extend({_initialized:!1,_shader:null,_colorLocation:-1,_color:null,_pointSizeLocation:-1,_pointSize:-1,ctor:function(a){null==a&&(a=cc.renderContext);if(!a instanceof WebGLRenderingContext)throw"Can't initialise DrawingPrimitiveWebGL. context need is WebGLRenderingContext";cc.DrawingPrimitive.prototype.ctor.call(this,a);this._color=new cc.Color4F(1,1,1,1)},lazy_init:function(){this._initialized||(this._shader=cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_UCOLOR),
this._colorLocation=this._renderContext.getUniformLocation(this._shader.getProgram(),"u_color"),this._pointSizeLocation=this._renderContext.getUniformLocation(this._shader.getProgram(),"u_pointSize"),this._initialized=!0)},drawInit:function(){this._initialized=!1},drawPoint:function(a){this.lazy_init();this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,
new Float32Array(this._color._arrayBuffer,0,4),1);this._shader.setUniformLocationWith1f(this._pointSizeLocation,this._pointSize);var c=this._renderContext,d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d);c.bufferData(c.ARRAY_BUFFER,new Float32Array([a.x,a.y]),c.STATIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,0);c.drawArrays(c.POINTS,0,1);c.deleteBuffer(d);cc.INCREMENT_GL_DRAWS(1)},drawPoints:function(a,c){if(a&&0!=a.length){this.lazy_init();this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();
cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,new Float32Array(this._color._arrayBuffer,0,4),1);this._shader.setUniformLocationWith1f(this._pointSizeLocation,this._pointSize);var d=this._renderContext,e=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,e);d.bufferData(d.ARRAY_BUFFER,this._pointsToTypeArray(a),d.STATIC_DRAW);d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,d.FLOAT,!1,0,0);d.drawArrays(d.POINTS,0,a.length);d.deleteBuffer(e);
cc.INCREMENT_GL_DRAWS(1)}},_pointsToTypeArray:function(a){for(var c=new Float32Array(2*a.length),d=0;d<a.length;d++)c[2*d]=a[d].x,c[2*d+1]=a[d].y;return c},drawLine:function(a,c){this.lazy_init();this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,new Float32Array(this._color._arrayBuffer,0,4),1);var d=this._renderContext,e=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,
e);d.bufferData(d.ARRAY_BUFFER,this._pointsToTypeArray([a,c]),d.STATIC_DRAW);d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,d.FLOAT,!1,0,0);d.drawArrays(d.LINES,0,2);d.deleteBuffer(e);cc.INCREMENT_GL_DRAWS(1)},drawRect:function(a,c){this.drawLine(cc.p(a.x,a.y),cc.p(c.x,a.y));this.drawLine(cc.p(c.x,a.y),cc.p(c.x,c.y));this.drawLine(cc.p(c.x,c.y),cc.p(a.x,c.y));this.drawLine(cc.p(a.x,c.y),cc.p(a.x,a.y))},drawSolidRect:function(a,c,d){a=[a,cc.p(c.x,a.y),c,cc.p(a.x,c.y)];this.drawSolidPoly(a,4,d)},
drawPoly:function(a,c,d){this.lazy_init();this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,new Float32Array(this._color._arrayBuffer,0,4),1);c=this._renderContext;var e=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,e);c.bufferData(c.ARRAY_BUFFER,this._pointsToTypeArray(a),c.STATIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,
0);d?c.drawArrays(c.LINE_LOOP,0,a.length):c.drawArrays(c.LINE_STRIP,0,a.length);c.deleteBuffer(e);cc.INCREMENT_GL_DRAWS(1)},drawSolidPoly:function(a,c,d){this.lazy_init();d||(d=this._color);this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,new Float32Array(d._arrayBuffer,0,4),1);c=this._renderContext;d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d);
c.bufferData(c.ARRAY_BUFFER,this._pointsToTypeArray(a),c.STATIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,0);c.drawArrays(c.TRIANGLE_FAN,0,a.length);c.deleteBuffer(d);cc.INCREMENT_GL_DRAWS(1)},drawCircle:function(a,c,d,e,f){this.lazy_init();var g=1;f&&g++;var h=2*Math.PI/e;if(f=new Float32Array(2*(e+2))){for(var k=0;k<=e;k++){var m=k*h,n=c*Math.cos(m+d)+a.x,m=c*Math.sin(m+d)+a.y;f[2*k]=n;f[2*k+1]=m}f[2*(e+1)]=a.x;f[2*(e+1)+1]=a.y;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();
cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,new Float32Array(this._color._arrayBuffer,0,4),1);a=this._renderContext;c=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,c);a.bufferData(a.ARRAY_BUFFER,f,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,e+g);a.deleteBuffer(c);cc.INCREMENT_GL_DRAWS(1)}},drawQuadBezier:function(a,c,d,e){this.lazy_init();for(var f=new Float32Array(2*
(e+1)),g=0,h=0;h<e;h++)f[2*h]=Math.pow(1-g,2)*a.x+2*(1-g)*g*c.x+g*g*d.x,f[2*h+1]=Math.pow(1-g,2)*a.y+2*(1-g)*g*c.y+g*g*d.y,g+=1/e;f[2*e]=d.x;f[2*e+1]=d.y;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,new Float32Array(this._color._arrayBuffer,0,4),1);a=this._renderContext;c=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,c);a.bufferData(a.ARRAY_BUFFER,
f,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,e+1);a.deleteBuffer(c);cc.INCREMENT_GL_DRAWS(1)},drawCubicBezier:function(a,c,d,e,f){this.lazy_init();for(var g=new Float32Array(2*(f+1)),h=0,k=0;k<f;k++)g[2*k]=Math.pow(1-h,3)*a.x+3*Math.pow(1-h,2)*h*c.x+3*(1-h)*h*h*d.x+h*h*h*e.x,g[2*k+1]=Math.pow(1-h,3)*a.y+3*Math.pow(1-h,2)*h*c.y+3*(1-h)*h*h*d.y+h*h*h*e.y,h+=1/f;g[2*f]=e.x;g[2*f+1]=e.y;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();
cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,new Float32Array(this._color._arrayBuffer,0,4),1);a=this._renderContext;c=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,c);a.bufferData(a.ARRAY_BUFFER,g,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,f+1);a.deleteBuffer(c);cc.INCREMENT_GL_DRAWS(1)},drawCatmullRom:function(a,c){this.drawCardinalSpline(a,0.5,c)},drawCardinalSpline:function(a,
c,d){this.lazy_init();for(var e=new Float32Array(2*(d+1)),f,g,h=1/a.length,k=0;k<d+1;k++)g=k/d,1==g?(f=a.length-1,g=1):(f=0|g/h,g=(g-h*f)/h),f=cc.CardinalSplineAt(cc.getControlPointAt(a,f-1),cc.getControlPointAt(a,f),cc.getControlPointAt(a,f+1),cc.getControlPointAt(a,f+2),c,g),e[2*k]=f.x,e[2*k+1]=f.y;this._shader.use();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,
new Float32Array(this._color._arrayBuffer,0,4),1);a=this._renderContext;c=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,c);a.bufferData(a.ARRAY_BUFFER,e,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,d+1);a.deleteBuffer(c);cc.INCREMENT_GL_DRAWS(1)},setDrawColor4B:function(a,c,d,e){this._color.r=a/255;this._color.g=c/255;this._color.b=d/255;this._color.a=e/255},setDrawColor4F:function(a,c,d,e){this._color.r=a;this._color.g=c;this._color.b=
d;this._color.a=e},setPointSize:function(a){this._pointSize=a*cc.CONTENT_SCALE_FACTOR()},setLineWidth:function(a){this._renderContext.lineWidth&&this._renderContext.lineWidth(a)}});cc.PI2=2*Math.PI;cc.TARGET_PLATFORM={WINDOWS:0,LINUX:1,MACOS:2,ANDROID:3,IPHONE:4,IPAD:5,BLACKBERRY:6,NACL:7,EMSCRIPTEN:8,MOBILE_BROWSER:100,PC_BROWSER:101};cc.ORIENTATION_PORTRAIT=0;cc.ORIENTATION_PORTRAIT_UPSIDE_DOWN=1;cc.ORIENTATION_LANDSCAPE_LEFT=2;cc.ORIENTATION_LANDSCAPE_RIGHT=3;cc.CANVAS=0;cc.WEBGL=1;cc.drawingUtil=null;cc.renderContext=null;cc.canvas=null;cc.gameDiv=null;cc.renderContextType=cc.CANVAS;cc.originalCanvasSize=cc.size(0,0);
window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame}();window.console||(window.console={},window.console.log=function(){},window.console.assert=function(){});cc.isAddedHiddenEvent=!1;
cc.setup=function(a,c,d){function e(){if(cc.AudioEngine&&n){n=!1;var a=cc.AudioEngine.getInstance();a.resumeAllEffects();a.resumeMusic()}}function f(){if(cc.AudioEngine&&!n){n=!0;var a=cc.AudioEngine.getInstance();a.pauseAllEffects();a.pauseMusic()}}function g(){document[p]?f():e()}a=cc.$(a)||cc.$("#"+a);var h,k,m;"CANVAS"==a.tagName?(c=c||a.width,d=d||a.height,k=cc.container=cc.$new("DIV"),m=k.style,h=cc.canvas=a,h.parentNode.insertBefore(k,h),h.appendTo(k),m.width=(c||480)+"px",m.height=(d||320)+
"px",k.setAttribute("id","Cocos2dGameContainer"),m.margin="0 auto",h.setAttribute("width",c||480),h.setAttribute("height",d||320)):("DIV"!=a.tagName&&cc.log("Warning: target element is not a DIV or CANVAS"),c=c||a.clientWidth,d=d||a.clientHeight,h=cc.canvas=cc.$new("CANVAS"),h.addClass("gameCanvas"),h.setAttribute("width",c||480),h.setAttribute("height",d||320),k=cc.container=a,m=k.style,a.appendChild(h),m.width=(c||480)+"px",m.height=(d||320)+"px",m.margin="0 auto");m.position="relative";m.overflow=
"hidden";k.top="100%";if(!cc.__renderDoesnotSupport){cc.Browser.supportWebGL&&(cc.renderContext=cc.webglContext=cc.create3DContext(h,{stencil:!0,preserveDrawingBuffer:!0,antialias:!cc.Browser.isMobile,alpha:!1}));cc.renderContext?(cc.renderContextType=cc.WEBGL,window.gl=cc.renderContext,cc.drawingUtil=new cc.DrawingPrimitiveWebGL(cc.renderContext),cc.TextureCache.getInstance()._initializingRenderer()):(cc.renderContext=h.getContext("2d"),cc.mainRenderContextBackup=cc.renderContext,cc.renderContextType=
cc.CANVAS,cc.renderContext.translate(0,h.height),cc.drawingUtil=cc.DrawingPrimitiveCanvas?new cc.DrawingPrimitiveCanvas(cc.renderContext):null);cc.originalCanvasSize=cc.size(h.width,h.height);cc.gameDiv=k;cc.log(cc.ENGINE_VERSION);cc.Configuration.getInstance();cc.setContextMenuEnable(!1);cc.Browser.isMobile&&cc._addUserSelectStatus();var n=!1,p,q;"undefined"!==typeof document.hidden?(p="hidden",q="visibilitychange"):"undefined"!==typeof document.mozHidden?(p="mozHidden",q="mozvisibilitychange"):
"undefined"!==typeof document.msHidden?(p="msHidden",q="msvisibilitychange"):"undefined"!==typeof document.webkitHidden&&(p="webkitHidden",q="webkitvisibilitychange");"undefined"===typeof document.addEventListener||"undefined"===typeof p?(cc.isAddedHiddenEvent=!1,window.addEventListener("focus",e,!1),window.addEventListener("blur",f,!1)):(cc.isAddedHiddenEvent=!0,document.addEventListener(q,g,!1));"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pageshow",e,!1),window.addEventListener("pagehide",
f,!1))}};cc._addUserSelectStatus=function(){var a=document.createElement("style");a.type="text/css";document.body.appendChild(a);a.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._isContextMenuEnable=!1;cc.setContextMenuEnable=function(a){cc._isContextMenuEnable=a;cc.canvas.oncontextmenu=cc._isContextMenuEnable?function(){}:function(){return!1}};
cc.Application=cc.Class.extend({_animationInterval:null,ctor:function(){this._animationInterval=0;if(cc._sharedApplication)throw"Application has been initialized";cc._sharedApplication=this},setAnimationInterval:function(a){this._animationInterval=a},statusBarFrame:function(a){a&&cc.rect(0,0,0,0)},getTargetPlatform:function(){return cc.Browser.isMobile?cc.TARGET_PLATFORM.MOBILE_BROWSER:cc.TARGET_PLATFORM.PC_BROWSER},run:function(){if(!this.applicationDidFinishLaunching())return 0;var a,c=cc.Director.getInstance(),
d=window;cc.director=c;d.requestAnimFrame&&this._animationInterval==1/60?(a=function(){c.mainLoop();d.requestAnimFrame(a)},d.requestAnimFrame(a)):(a=function(){c.mainLoop()},setInterval(a,1E3*this._animationInterval));return 0}});cc.Application.getInstance=function(){return cc._sharedApplication};
cc.Application.getCurrentLanguage=function(){var a=cc.LANGUAGE_ENGLISH,c=navigator.language;c||(c=navigator.browserLanguage||navigator.userLanguage);if(!c)return a;c=c.substring(0,2).toLowerCase();switch(c){case "cn":case "zh":a=cc.LANGUAGE_CHINESE;break;case "fr":a=cc.LANGUAGE_FRENCH;break;case "it":a=cc.LANGUAGE_ITALIAN;break;case "de":a=cc.LANGUAGE_GERMAN;break;case "es":a=cc.LANGUAGE_SPANISH;break;case "ru":a=cc.LANGUAGE_RUSSIAN;break;case "ko":a=cc.LANGUAGE_KOREAN;break;case "ja":a=cc.LANGUAGE_JAPANESE;
break;case "hu":a=cc.LANGUAGE_HUNGARIAN;break;case "pt":a=cc.LANGUAGE_PORTUGUESE;break;case "ar":a=cc.LANGUAGE_ARABIC;break;case "no":a=cc.LANGUAGE_NORWEGIAN;break;case "pl":a=cc.LANGUAGE_POLISH}return a};cc._sharedApplication=null;cc.SAXParser=cc.Class.extend({xmlDoc:null,_parser:null,_xmlDict:null,_isSupportDOMParser:null,ctor:function(){this._xmlDict={};window.DOMParser?(this._isSupportDOMParser=!0,this._parser=new DOMParser):this._isSupportDOMParser=!1},parse:function(a){var c=a;a=this.getList(a);a=this._parserXML(a,c).documentElement;if("plist"!=a.tagName)throw"cocos2d: "+c+" is not a plist file or you forgot to preload the plist file";for(var c=null,d=0,e=a.childNodes.length;d<e&&(c=a.childNodes[d],1!=c.nodeType);d++);
return this._parseNode(c)},tmxParse:function(a,c){if(null==c||!1===c)a=this.getList(a);return this._parserXML(a)},_parserXML:function(a,c){var d;this._isSupportDOMParser?d=this._parser.parseFromString(a,"text/xml"):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(a));null==d&&cc.log("cocos2d:xml "+c+" not found!");return d},_parseNode:function(a){var c=null;switch(a.tagName){case "dict":c=this._parseDict(a);break;case "array":c=this._parseArray(a);break;case "string":if(1==a.childNodes.length)c=
a.firstChild.nodeValue;else for(var c="",d=0;d<a.childNodes.length;d++)c+=a.childNodes[d].nodeValue;break;case "false":c=!1;break;case "true":c=!0;break;case "real":c=parseFloat(a.firstChild.nodeValue);break;case "integer":c=parseInt(a.firstChild.nodeValue,10)}return c},_parseArray:function(a){for(var c=[],d=0,e=a.childNodes.length;d<e;d++){var f=a.childNodes[d];1==f.nodeType&&c.push(this._parseNode(f))}return c},_parseDict:function(a){for(var c={},d=null,e=0,f=a.childNodes.length;e<f;e++){var g=
a.childNodes[e];1==g.nodeType&&("key"==g.tagName?d=g.firstChild.nodeValue:c[d]=this._parseNode(g))}return c},preloadPlist:function(a,c,d){var e=cc.FileUtils.getInstance().fullPathForFilename(a);if(window.XMLHttpRequest){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml")}if(null!=f){var g=this;f.onreadystatechange=function(){4==f.readyState&&(f.responseText?(g._xmlDict[e]=f.responseText,f=null,cc.doCallback(c,d)):cc.doCallback(c,d,a))};f.open("GET",e,!0);f.send(null)}else throw"cocos2d:Your browser does not support XMLHTTP.";
},unloadPlist:function(a){this._xmlDict[a]&&delete this._xmlDict[a]},getName:function(a){var c=a.lastIndexOf("/",a.length)+1,d=a.lastIndexOf(".",a.length);return a.substring(c,d)},getExt:function(a){var c=a.lastIndexOf(".",a.length)+1;return a.substring(c,a.length)},getList:function(a){return null!=this._xmlDict?this._xmlDict[a]:null}});cc.SAXParser.getInstance=function(){this._instance||(this._instance=new cc.SAXParser);return this._instance};cc.SAXParser._instance=null;cc.AppController=cc.Class.extend({didFinishLaunchingWithOptions:function(){cc.Application.getInstance().run();return!0},applicationWillResignActive:function(){cc.Director.getInstance().pause()},applicationDidBecomeActive:function(){cc.Director.getInstance().resume()},applicationDidEnterBackground:function(){cc.Application.getInstance().applicationDidEnterBackground()},applicationWillEnterForeground:function(){cc.Application.getInstance().applicationWillEnterForeground()},applicationWillTerminate:function(){}});
cc.AppController.shareAppController=function(){null==cc.sharedAppController&&(cc.sharedAppController=new cc.AppController);if(!cc.sharedAppController)throw"Application initialize failure";return cc.sharedAppController};cc.sharedAppController=null;cc.LabelTTF=cc.Sprite.extend({_dimensions:null,_hAlignment:cc.TEXT_ALIGNMENT_CENTER,_vAlignment:cc.VERTICAL_TEXT_ALIGNMENT_TOP,_fontName:null,_fontSize:0,_string:"",_originalText:null,_isMultiLine:!1,_fontStyleStr:null,_shadowEnabled:!1,_shadowOffset:null,_shadowOpacity:0,_shadowBlur:0,_shadowColorStr:null,_strokeEnabled:!1,_strokeColor:null,_strokeSize:0,_strokeColorStr:null,_textFillColor:null,_fillColorStr:null,_strokeShadowOffsetX:0,_strokeShadowOffsetY:0,_needUpdateTexture:!1,_labelCanvas:null,
_labelContext:null,_lineWidths:null,ctor:function(){cc.Sprite.prototype.ctor.call(this);this._dimensions=cc.SizeZero();this._hAlignment=cc.TEXT_ALIGNMENT_LEFT;this._vAlignment=cc.VERTICAL_TEXT_ALIGNMENT_TOP;this._opacityModifyRGB=!1;this._fontStyleStr="";this._fontName="Arial";this._shadowEnabled=this._isMultiLine=!1;this._shadowOffset=cc.SizeZero();this._shadowBlur=this._shadowOpacity=0;this._shadowColorStr="rgba(128, 128, 128, 0.5)";this._strokeEnabled=!1;this._strokeColor=cc.white();this._strokeSize=
0;this._strokeColorStr="";this._textFillColor=cc.white();this._fillColorStr="rgba(255,255,255,1)";this._strokeShadowOffsetY=this._strokeShadowOffsetX=0;this._needUpdateTexture=!1;this._lineWidths=[];this._setColorsString()},init:function(){return this.initWithString(" ",this._fontName,this._fontSize)},_measureConfig:function(){this._getLabelContext().font=this._fontStyleStr},_measure:function(a){return this._getLabelContext().measureText(a).width},_checkNextline:function(a,c){var d=this._measure(a),
e=Math.floor(a.length*c/d),f=a.indexOf("\n");if(0.8*e>=f&&0<f)return f+1;if(d<c)return a.length;for(var d=!1,g=c+1,f=-1,h=e,k,m=cc.LabelTTF._checkRegEx,n=cc.LabelTTF._reverseCheckRegEx,p=cc.LabelTTF._checkEnRegEx,q=a.substr(e);k=m.exec(q);){h+=k[0].length;g=a.substr(0,h);g=this._measure(g);if("\n"==k[2]&&g<c){d=!0;f=h;break}if(g>c){-1!=f&&(d=!0);break}f=h;q=a.substr(h)}if(d)return f;q=a.substr(0,e);for(f=e;k=n.exec(q);)if(f=k[1].length,q=k[1],g=this._measure(q),g<c){p.test(k[2])&&f++;break}return f||
1},description:function(){return"\x3ccc.LabelTTF | FontName \x3d"+this._fontName+" FontSize \x3d "+this._fontSize.toFixed(1)+"\x3e"},setColor:null,_setColorForCanvas:function(a){cc.NodeRGBA.prototype.setColor.call(this,a);this._setColorsStringForCanvas()},_setColorsString:null,_setColorsStringForCanvas:function(){this._needUpdateTexture=!0;var a=this._displayedColor,c=this._displayedOpacity,d=this._strokeColor,e=this._textFillColor;this._shadowColorStr="rgba("+(0|0.5*a.r)+","+(0|0.5*a.g)+","+(0|0.5*
a.b)+","+this._shadowOpacity+")";this._fillColorStr="rgba("+(0|a.r/255*e.r)+","+(0|a.g/255*e.g)+","+(0|a.b/255*e.b)+", "+c/255+")";this._strokeColorStr="rgba("+(0|a.r/255*d.r)+","+(0|a.g/255*d.g)+","+(0|a.b/255*d.b)+", "+c/255+")"},_setColorsStringForWebGL:function(){this._needUpdateTexture=!0;var a=this._strokeColor,c=this._textFillColor;this._shadowColorStr="rgba(128,128,128,"+this._shadowOpacity+")";this._fillColorStr="rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b)+", 1)";this._strokeColorStr="rgba("+
(0|a.r)+","+(0|a.g)+","+(0|a.b)+", 1)"},updateDisplayedColor:null,_updateDisplayedColorForCanvas:function(a){cc.NodeRGBA.prototype.updateDisplayedColor.call(this,a);this._setColorsString()},setOpacity:null,_setOpacityForCanvas:function(a){this._opacity!==a&&(cc.Sprite.prototype.setOpacity.call(this,a),this._setColorsString(),this._needUpdateTexture=!0)},updateDisplayedOpacity:null,updateDisplayedOpacityForCanvas:function(a){cc.NodeRGBA.prototype.updateDisplayedOpacity.call(this,a);this._setColorsString()},
getString:function(){return this._string},getHorizontalAlignment:function(){return this._hAlignment},getVerticalAlignment:function(){return this._vAlignment},getDimensions:function(){return cc.size(this._dimensions.width,this._dimensions.height)},getFontSize:function(){return this._fontSize},getFontName:function(){return this._fontName},initWithString:function(a,c,d,e,f,g){a=a?a+"":"";d=d||16;e=e||cc.size(0,d);f=f||cc.TEXT_ALIGNMENT_LEFT;g=g||cc.VERTICAL_TEXT_ALIGNMENT_TOP;return cc.Sprite.prototype.init.call(this)?
(this._opacityModifyRGB=!1,this._dimensions=cc.size(e.width,e.height),this._fontName=c||"Arial",this._hAlignment=f,this._vAlignment=g,this._fontSize=d,this._fontStyleStr=this._fontSize+"px '"+c+"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(c,this._fontSize),this.setString(a),this._setColorsString(),this._updateTexture(),this._needUpdateTexture=!1,!0):!1},initWithStringAndTextDefinition:null,_initWithStringAndTextDefinitionForCanvas:function(a,c){if(!cc.Sprite.prototype.init.call(this))return!1;
this._updateWithTextDefinition(c,!1);this.setString(a);return!0},_initWithStringAndTextDefinitionForWebGL:function(a,c){if(!cc.Sprite.prototype.init.call(this))return!1;this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.LabelTTF._SHADER_PROGRAM));this._updateWithTextDefinition(c,!1);this.setString(a);return!0},setTextDefinition:function(a){a&&this._updateWithTextDefinition(a,!0)},getTextDefinition:function(){return this._prepareTextDefinition(!1)},enableShadow:function(a,c,d,e){c=
c||0.5;!1===this._shadowEnabled&&(this._shadowEnabled=!0);if((e=this._shadowOffset)&&e.width!=a.width||e.height!=a.height)e.width=a.width,e.height=a.height;this._shadowOpacity!=c&&(this._shadowOpacity=c);this._setColorsString();this._shadowBlur!=d&&(this._shadowBlur=d);this._needUpdateTexture=!0},disableShadow:function(a){this._shadowEnabled&&(this._shadowEnabled=!1,this._needUpdateTexture=!0)},enableStroke:function(a,c,d){!1===this._strokeEnabled&&(this._strokeEnabled=!0);d=this._strokeColor;if(d.r!==
a.r||d.g!==a.g||d.b!==a.b)d.r=a.r,d.g=a.g,d.b=a.b,this._setColorsString();this._strokeSize!==c&&(this._strokeSize=c||0);this._needUpdateTexture=!0},disableStroke:function(a){this._strokeEnabled&&(this._strokeEnabled=!1,this._needUpdateTexture=!0)},setFontFillColor:null,_setFontFillColorForCanvas:function(a,c){var d=this._textFillColor;if(d.r!=a.r||d.g!=a.g||d.b!=a.b)d.r=a.r,d.g=a.g,d.b=a.b,this._setColorsString(),this._needUpdateTexture=!0},_setFontFillColorForWebGL:function(a,c){var d=this._textFillColor;
if(d.r!=a.r||d.g!=a.g||d.b!=a.b)d.r=a.r,d.g=a.g,d.b=a.b,this._setColorsString(),this._needUpdateTexture=!0},_updateWithTextDefinition:function(a,c){a.fontDimensions?(this._dimensions.width=a.fontDimensions.width,this._dimensions.height=a.fontDimensions.height):(this._dimensions.width=0,this._dimensions.height=0);this._hAlignment=a.fontAlignmentH;this._vAlignment=a.fontAlignmentV;this._fontName=a.fontName;this._fontSize=a.fontSize||12;this._fontStyleStr=this._fontSize+"px '"+this._fontName+"'";this._fontClientHeight=
cc.LabelTTF.__getFontHeightByDiv(this._fontName,this._fontSize);a.shadowEnabled&&this.enableShadow(a.shadowOffset,a.shadowOpacity,a.shadowBlur,!1);a.strokeEnabled&&this.enableStroke(a.strokeColor,a.strokeSize,!1);this.setFontFillColor(a.fontFillColor,!1);c&&this._updateTexture()},_prepareTextDefinition:function(a){var c=new cc.FontDefinition;a?(c.fontSize=this._fontSize,c.fontDimensions=cc.SIZE_POINTS_TO_PIXELS(this._dimensions)):(c.fontSize=this._fontSize,c.fontDimensions=cc.size(this._dimensions.width,
this._dimensions.height));c.fontName=this._fontName;c.fontAlignmentH=this._hAlignment;c.fontAlignmentV=this._vAlignment;if(this._strokeEnabled){c.strokeEnabled=!0;var d=this._strokeColor;c.strokeColor=new cc.Color3B(d.r,d.g,d.b);c.strokeSize=this._strokeSize}else c.strokeEnabled=!1;this._shadowEnabled?(c.shadowEnabled=!0,c.shadowBlur=this._shadowBlur,c.shadowOpacity=this._shadowOpacity,c.shadowOffset=a?cc.SIZE_POINTS_TO_PIXELS(this._shadowOffset):cc.size(this._shadowOffset.width,this._shadowOffset.height)):
c._shadowEnabled=!1;a=this._textFillColor;c.fontFillColor=new cc.Color3B(a.r,a.g,a.b);return c},_fontClientHeight:18,setString:function(a){a=String(a);this._originalText!=a&&(this._originalText=a+"",this._updateString(),this._needUpdateTexture=!0)},_updateString:function(){this._string=this._originalText},setHorizontalAlignment:function(a){a!==this._hAlignment&&(this._hAlignment=a,this._needUpdateTexture=!0)},setVerticalAlignment:function(a){a!=this._vAlignment&&(this._vAlignment=a,this._needUpdateTexture=
!0)},setDimensions:function(a){if(a.width!=this._dimensions.width||a.height!=this._dimensions.height)this._dimensions=a,this._updateString(),this._needUpdateTexture=!0},setFontSize:function(a){this._fontSize!==a&&(this._fontSize=a,this._fontStyleStr=a+"px '"+this._fontName+"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(this._fontName,a),this._needUpdateTexture=!0)},setFontName:function(a){this._fontName&&this._fontName!=a&&(this._fontName=a,this._fontStyleStr=this._fontSize+"px '"+a+
"'",this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a,this._fontSize),this._needUpdateTexture=!0)},_drawTTFInCanvas:function(a){if(a){var c=this._strokeShadowOffsetX,d=this._strokeShadowOffsetY,e=this._contentSize.height-d,f=this._vAlignment,g=this._hAlignment,h=this._fontClientHeight,k=this._strokeSize;a.setTransform(1,0,0,1,0+0.5*c,e+0.5*d);a.font!=this._fontStyleStr&&(a.font=this._fontStyleStr);a.fillStyle=this._fillColorStr;var m=d=0,n=this._strokeEnabled;n&&(a.lineWidth=2*k,a.strokeStyle=
this._strokeColorStr);this._shadowEnabled&&(k=this._shadowOffset,a.shadowColor=this._shadowColorStr,a.shadowOffsetX=k.width,a.shadowOffsetY=-k.height,a.shadowBlur=this._shadowBlur);a.textBaseline=cc.LabelTTF._textBaseline[f];a.textAlign=cc.LabelTTF._textAlign[g];c=this._contentSize.width-c;d=g===cc.TEXT_ALIGNMENT_RIGHT?d+c:g===cc.TEXT_ALIGNMENT_CENTER?d+c/2:d+0;if(this._isMultiLine)for(g=this._strings.length,f===cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?m=h+e-h*g:f===cc.VERTICAL_TEXT_ALIGNMENT_CENTER&&(m=
h/2+(e-h*g)/2),f=0;f<g;f++)c=this._strings[f],k=-e+h*f+m,n&&a.strokeText(c,d,k),a.fillText(c,d,k);else f!==cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM&&(m=f===cc.VERTICAL_TEXT_ALIGNMENT_TOP?m-e:m-0.5*e),n&&a.strokeText(this._string,d,m),a.fillText(this._string,d,m)}},_getLabelContext:function(){if(this._labelContext)return this._labelContext;if(!this._labelCanvas){var a=document.createElement("canvas"),c=new cc.Texture2D;c.initWithElement(a);this.setTexture(c);this._labelCanvas=a}return this._labelContext=
this._labelCanvas.getContext("2d")},_updateTTF:function(){var a=this._dimensions.width,c,d,e=this._lineWidths;e.length=0;this._isMultiLine=!1;this._measureConfig();if(0!==a){var f=this._string;this._strings=[];c=0;for(d=this._string.length;c<d;){var g=this._checkNextline(f.substr(c),a),h=f.substr(c,g);this._strings.push(h);c+=g}}else for(this._strings=this._string.split("\n"),c=0,d=this._strings.length;c<d;c++)e.push(this._measure(this._strings[c]));0<this._strings.length&&(this._isMultiLine=!0);
d=c=0;this._strokeEnabled&&(c=d=2*this._strokeSize);this._shadowEnabled&&(f=this._shadowOffset,c+=2*Math.abs(f.width),d+=2*Math.abs(f.height));a=0===a?this._isMultiLine?cc.size(0|Math.max.apply(Math,e)+c,0|this._fontClientHeight*this._strings.length+d):cc.size(0|this._measure(this._string)+c,0|this._fontClientHeight+d):0===this._dimensions.height?this._isMultiLine?cc.size(0|a+c,0|this._fontClientHeight*this._strings.length+d):cc.size(0|a+c,0|this._fontClientHeight+d):cc.size(0|a+c,0|this._dimensions.height+
d);this.setContentSize(a);this._strokeShadowOffsetX=c;this._strokeShadowOffsetY=d;e=this._anchorPoint;this._anchorPointInPoints.x=0.5*c+(a.width-c)*e.x;this._anchorPointInPoints.y=0.5*d+(a.height-d)*e.y},getContentSize:function(){this._needUpdateTexture&&this._updateTTF();return cc.Sprite.prototype.getContentSize.call(this)},_updateTexture:function(){var a=this._getLabelContext(),c=this._labelCanvas,d=this._contentSize;if(0===this._string.length)return c.width=1,c.height=d.height,this.setTextureRect(cc.rect(0,
0,1,d.height)),!0;a.font=this._fontStyleStr;this._updateTTF();var e=d.width,d=d.height,f=c.width==e&&c.height==d;c.width=e;c.height=d;f&&a.clearRect(0,0,e,d);this._drawTTFInCanvas(a);this._texture.handleLoadedTexture();this.setTextureRect(cc.rect(0,0,e,d));return!0},visit:function(a){this._string&&""!=this._string&&(this._needUpdateTexture&&(this._needUpdateTexture=!1,this._updateTexture()),cc.Sprite.prototype.visit.call(this,a||cc.renderContext))},draw:null,_drawForWebGL:function(a){if(this._string&&
""!=this._string){a=a||cc.renderContext;var c=this._texture;c&&c._isLoaded&&(this._shaderProgram.use(),this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4(),cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst),cc.glBindTexture2D(c),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.STATIC_DRAW),this._quadDirty=!1),a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,
3,a.FLOAT,!1,24,0),a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,24,16),a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,24,12),a.drawArrays(a.TRIANGLE_STRIP,0,4));1===cc.SPRITE_DEBUG_DRAW?(a=this._quad,a=[cc.p(a.tl.vertices.x,a.tl.vertices.y),cc.p(a.bl.vertices.x,a.bl.vertices.y),cc.p(a.br.vertices.x,a.br.vertices.y),cc.p(a.tr.vertices.x,a.tr.vertices.y)],cc.drawingUtil.drawPoly(a,4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(a=this.getTextureRect()._size,c=this.getOffsetPosition(),
a=[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(a,4,!0));cc.g_NumberOfDraws++}},_setTextureRectForCanvas:function(a,c,d){this._rectRotated=c||!1;d=d||a._size;this.setContentSize(d);this.setVertexRect(a);c=this._textureRect_Canvas;c.x=a.x;c.y=a.y;c.width=a.width;c.height=a.height;c.validRect=!(0===c.width||0===c.height||0>c.x||0>c.y);a=this._unflippedOffsetPositionFromCenter;this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);
this._offsetPosition.x=a.x+(this._contentSize.width-this._rect.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-this._rect.height)/2;this._batchNode&&(this._dirty=!0)},_setTextureCoords:function(a){var c=this._batchNode?this._textureAtlas.getTexture():this._texture;if(c){var d=c.getPixelsWide(),e=c.getPixelsHigh(),f,g=this._quad;this._rectRotated?(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(c=(2*a.x+1)/(2*d),d=c+(2*a.height-2)/(2*d),f=(2*a.y+1)/(2*e),a=f+(2*a.width-2)/(2*e)):(c=a.x/d,d=(a.x+
a.height)/d,f=a.y/e,a=(a.y+a.width)/e),this._flippedX&&(e=f,f=a,a=e),this._flippedY&&(e=c,c=d,d=e),g.bl.texCoords.u=c,g.bl.texCoords.v=f,g.br.texCoords.u=c,g.br.texCoords.v=a,g.tl.texCoords.u=d,g.tl.texCoords.v=f,g.tr.texCoords.u=d,g.tr.texCoords.v=a):(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(c=(2*a.x+1)/(2*d),d=c+(2*a.width-2)/(2*d),f=(2*a.y+1)/(2*e),a=f+(2*a.height-2)/(2*e)):(c=a.x/d,d=(a.x+a.width)/d,f=a.y/e,a=(a.y+a.height)/e),this._flippedX&&(e=c,c=d,d=e),this._flippedY&&(e=f,f=a,a=e),g.bl.texCoords.u=
c,g.bl.texCoords.v=a,g.br.texCoords.u=d,g.br.texCoords.v=a,g.tl.texCoords.u=c,g.tl.texCoords.v=f,g.tr.texCoords.u=d,g.tr.texCoords.v=f);this._quadDirty=!0}}});
cc.Browser.supportWebGL?(cc.LabelTTF.prototype.setColor=cc.Sprite.prototype.setColor,cc.LabelTTF.prototype._setColorsString=cc.LabelTTF.prototype._setColorsStringForWebGL,cc.LabelTTF.prototype.updateDisplayedColor=cc.Sprite.prototype.updateDisplayedColor,cc.LabelTTF.prototype.setOpacity=cc.Sprite.prototype.setOpacity,cc.LabelTTF.prototype.updateDisplayedOpacity=cc.Sprite.prototype.updateDisplayedOpacity,cc.LabelTTF.prototype.initWithStringAndTextDefinition=cc.LabelTTF.prototype._initWithStringAndTextDefinitionForWebGL,
cc.LabelTTF.prototype.setFontFillColor=cc.LabelTTF.prototype._setFontFillColorForWebGL,cc.LabelTTF.prototype.draw=cc.LabelTTF.prototype._drawForWebGL,cc.LabelTTF.prototype.setTextureRect=cc.Sprite.prototype._setTextureRectForWebGL):(cc.LabelTTF.prototype.setColor=cc.LabelTTF.prototype._setColorForCanvas,cc.LabelTTF.prototype._setColorsString=cc.LabelTTF.prototype._setColorsStringForCanvas,cc.LabelTTF.prototype.updateDisplayedColor=cc.LabelTTF.prototype._updateDisplayedColorForCanvas,cc.LabelTTF.prototype.setOpacity=
cc.LabelTTF.prototype._setOpacityForCanvas,cc.LabelTTF.prototype.updateDisplayedOpacity=cc.LabelTTF.prototype._updateDisplayedOpacityForCanvas,cc.LabelTTF.prototype.initWithStringAndTextDefinition=cc.LabelTTF.prototype._initWithStringAndTextDefinitionForCanvas,cc.LabelTTF.prototype.setFontFillColor=cc.LabelTTF.prototype._setFontFillColorForCanvas,cc.LabelTTF.prototype.draw=cc.Sprite.prototype.draw,cc.LabelTTF.prototype.setTextureRect=cc.LabelTTF.prototype._setTextureRectForCanvas);
cc.LabelTTF._textAlign=["left","center","right"];cc.LabelTTF._textBaseline=["top","middle","bottom"];cc.LabelTTF._checkRegEx=/(.+?)([\s\n\r\-\/\\\:]|[\u4E00-\u9FA5]|[\uFE30-\uFFA0])/;cc.LabelTTF._reverseCheckRegEx=/(.*)([\s\n\r\-\/\\\:]|[\u4E00-\u9FA5]|[\uFE30-\uFFA0])/;cc.LabelTTF._checkEnRegEx=/[\s\-\/\\\:]/;cc.LabelTTF.create=function(a,c,d,e,f,g){var h=new cc.LabelTTF;return h.initWithString(a,c,d,e,f,g)?h:null};
cc.LabelTTF.createWithFontDefinition=function(a,c){var d=new cc.LabelTTF;return d&&d.initWithStringAndTextDefinition(a,c)?d:null};cc.LabelTTF._SHADER_PROGRAM=cc.USE_LA88_LABELS?cc.SHADER_POSITION_TEXTURECOLOR:cc.SHADER_POSITION_TEXTUREA8COLOR;cc.LabelTTF.__labelHeightDiv=document.createElement("div");cc.LabelTTF.__labelHeightDiv.style.fontFamily="Arial";cc.LabelTTF.__labelHeightDiv.style.position="absolute";cc.LabelTTF.__labelHeightDiv.style.left="-100px";cc.LabelTTF.__labelHeightDiv.style.top="-100px";
cc.LabelTTF.__labelHeightDiv.style.lineHeight="normal";document.body.appendChild(cc.LabelTTF.__labelHeightDiv);cc.LabelTTF.__getFontHeightByDiv=function(a,c){var d=cc.LabelTTF.__fontHeightCache[a+"."+c];if(0<d)return d;var e=cc.LabelTTF.__labelHeightDiv;e.innerHTML="ajghl~!";e.style.fontFamily=a;e.style.fontSize=c+"px";d=e.clientHeight;cc.LabelTTF.__fontHeightCache[a+"."+c]=d;e.innerHTML="";return d};cc.LabelTTF.__fontHeightCache={};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,c){for(var d=0;d<a.length;d++)if(c==a[d].target)return a[d];return null},ctor:function(){this._hashTargets={};this._arrayTargets=[];this._currentTarget=null;this._currentTargetSalvaged=!1},addAction:function(a,c,d){if(!a)throw"cc.ActionManager.addAction(): action must be non-null";if(!c)throw"cc.ActionManager.addAction(): action must be non-null";var e=
this._hashTargets[c.__instanceId];e||(e=new cc.HashElement,e.paused=d,e.target=c,this._hashTargets[c.__instanceId]=e,this._arrayTargets.push(e));this._actionAllocWithHashElement(e);e.actions.push(a);a.startWithTarget(c)},removeAllActions:function(){for(var a=this._arrayTargets,c=0;c<a.length;c++){var d=a[c];d&&this.removeAllActionsFromTarget(d.target,!0)}},removeAllActionsFromTarget:function(a,c){if(null!=a){var d=this._hashTargets[a.__instanceId];d&&(-1===d.actions.indexOf(d.currentAction)||d.currentActionSalvaged||
(d.currentActionSalvaged=!0),d.actions.length=0,this._currentTarget!=d||c?this._deleteHashElement(d):this._currentTargetSalvaged=!0)}},removeAction:function(a){if(null!=a){var c=a.getOriginalTarget();if(c=this._hashTargets[c.__instanceId])for(var d=0;d<c.actions.length;d++){if(c.actions[d]==a){c.actions.splice(d,1);break}}else cc.log("cocos2d: removeAction: Target not found")}},removeActionByTag:function(a,c){a==cc.ACTION_TAG_INVALID&&cc.log("cc.ActionManager.removeActionByTag(): an invalid tag");
if(!c)throw"cc.ActionManager.removeActionByTag(): target must be non-null";var d=this._hashTargets[c.__instanceId];if(d)for(var e=d.actions.length,f=0;f<e;++f){var g=d.actions[f];if(g&&g.getTag()===a&&g.getOriginalTarget()==c){this._removeActionAtIndex(f,d);break}}},getActionByTag:function(a,c){a==cc.ACTION_TAG_INVALID&&cc.log("cc.ActionManager.getActionByTag(): an invalid tag");var d=this._hashTargets[c.__instanceId];if(d){if(null!=d.actions)for(var e=0;e<d.actions.length;++e){var f=d.actions[e];
if(f&&f.getTag()===a)return f}cc.log("cocos2d : getActionByTag(tag \x3d"+a+"): Action not found")}return null},numberOfRunningActionsInTarget:function(a){return(a=this._hashTargets[a.__instanceId])?a.actions?a.actions.length:0:0},pauseTarget:function(a){if(a=this._hashTargets[a.__instanceId])a.paused=!0},resumeTarget:function(a){if(a=this._hashTargets[a.__instanceId])a.paused=!1},pauseAllRunningActions:function(){for(var a=[],c=this._arrayTargets,d=0;d<c.length;d++){var e=c[d];e&&!e.paused&&(e.paused=
!0,a.push(e.target))}return a},resumeTargets:function(a){if(a)for(var c=0;c<a.length;c++)a[c]&&this.resumeTarget(a[c])},purgeSharedManager:function(){cc.Director.getInstance().getScheduler().unscheduleUpdateForTarget(this)},_removeActionAtIndex:function(a,c){c.actions[a]!=c.currentAction||c.currentActionSalvaged||(c.currentActionSalvaged=!0);cc.ArrayRemoveObjectAtIndex(c.actions,a);c.actionIndex>=a&&c.actionIndex--;0==c.actions.length&&(this._currentTarget==c?this._currentTargetSalvaged=!0:this._deleteHashElement(c))},
_deleteHashElement:function(a){a&&(delete this._hashTargets[a.target.__instanceId],cc.ArrayRemoveObject(this._arrayTargets,a),a.actions=null,a.target=null)},_actionAllocWithHashElement:function(a){null==a.actions&&(a.actions=[])},update:function(a){for(var c=this._arrayTargets,d,e=0;e<c.length;e++){d=this._currentTarget=c[e];if(!d.paused)for(d.actionIndex=0;d.actionIndex<d.actions.length;d.actionIndex++)if(d.currentAction=d.actions[d.actionIndex],d.currentAction){d.currentActionSalvaged=!1;d.currentAction.step(a);
if(d.currentActionSalvaged)d.currentAction=null;else if(d.currentAction.isDone()){d.currentAction.stop();var f=d.currentAction;d.currentAction=null;this.removeAction(f)}d.currentAction=null}this._currentTargetSalvaged&&0===d.actions.length&&this._deleteHashElement(d)}}});cc.kmScalar=Number;cc.kmBool=Number;cc.kmEnum=Number;cc.KM_FALSE=0;cc.KM_TRUE=1;cc.kmPI=3.141592;cc.kmPIOver180=0.017453;cc.kmPIUnder180=57.295779;cc.kmEpsilon=0.015625;cc.kmSQR=function(a){return a*a};cc.kmDegreesToRadians=function(a){return a*cc.kmPIOver180};cc.kmRadiansToDegrees=function(a){return a*cc.kmPIUnder180};cc.kmMin=function(a,c){return a<c?a:c};cc.kmMax=function(a,c){return a>c?a:c};cc.kmAlmostEqual=function(a,c){return a+cc.kmEpsilon>c&&a-cc.kmEpsilon<c};cc.kmVec2=function(a,c){this.x=a||0;this.y=c||0};cc.kmVec2Fill=function(a,c,d){a.x=c;a.y=d;return a};cc.kmVec2Length=function(a){return Math.sqrt(cc.kmSQR(a.x)+cc.kmSQR(a.y))};cc.kmVec2LengthSq=function(a){return cc.kmSQR(a.x)+cc.kmSQR(a.y)};cc.kmVec2Normalize=function(a,c){var d=1/cc.kmVec2Length(c),e=new cc.kmVec2;e.x=c.x*d;e.y=c.y*d;a.x=e.x;a.y=e.y;return a};cc.kmVec2Add=function(a,c,d){a.x=c.x+d.x;a.y=c.y+d.y;return a};cc.kmVec2Dot=function(a,c){return a.x*c.x+a.y*c.y};
cc.kmVec2Subtract=function(a,c,d){a.x=c.x-d.x;a.y=c.y-d.y;return a};cc.kmVec2Transform=function(a,c,d){var e=new cc.kmVec2;e.x=c.x*d.mat[0]+c.y*d.mat[3]+d.mat[6];e.y=c.x*d.mat[1]+c.y*d.mat[4]+d.mat[7];a.x=e.x;a.y=e.y;return a};cc.kmVec2TransformCoord=function(a,c,d){return null};cc.kmVec2Scale=function(a,c,d){a.x=c.x*d;a.y=c.y*d;return a};cc.kmVec2AreEqual=function(a,c){return a.x<c.x+cc.kmEpsilon&&a.x>c.x-cc.kmEpsilon&&a.y<c.y+cc.kmEpsilon&&a.y>c.y-cc.kmEpsilon};cc.kmVec3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0};cc.kmVec3Fill=function(a,c,d,e){if(!a)return new cc.kmVec3(c,d,e);a.x=c;a.y=d;a.z=e;return a};cc.kmVec3Length=function(a){return Math.sqrt(cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z))};cc.kmVec3LengthSq=function(a){return cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z)};cc.kmVec3Normalize=function(a,c){var d=1/cc.kmVec3Length(c);a.x=c.x*d;a.y=c.y*d;a.z=c.z*d;return a};
cc.kmVec3Cross=function(a,c,d){a.x=c.y*d.z-c.z*d.y;a.y=c.z*d.x-c.x*d.z;a.z=c.x*d.y-c.y*d.x;return a};cc.kmVec3Dot=function(a,c){return a.x*c.x+a.y*c.y+a.z*c.z};cc.kmVec3Add=function(a,c,d){a.x=c.x+d.x;a.y=c.y+d.y;a.z=c.z+d.z;return a};cc.kmVec3Subtract=function(a,c,d){a.x=c.x-d.x;a.y=c.y-d.y;a.z=c.z-d.z;return a};
cc.kmVec3Transform=function(a,c,d){a.x=c.x*d.mat[0]+c.y*d.mat[4]+c.z*d.mat[8]+d.mat[12];a.y=c.x*d.mat[1]+c.y*d.mat[5]+c.z*d.mat[9]+d.mat[13];a.z=c.x*d.mat[2]+c.y*d.mat[6]+c.z*d.mat[10]+d.mat[14];return a};cc.kmVec3TransformNormal=function(a,c,d){a.x=c.x*d.mat[0]+c.y*d.mat[4]+c.z*d.mat[8];a.y=c.x*d.mat[1]+c.y*d.mat[5]+c.z*d.mat[9];a.z=c.x*d.mat[2]+c.y*d.mat[6]+c.z*d.mat[10];return a};
cc.kmVec3TransformCoord=function(a,c,d){var e=new cc.kmVec4,f=new cc.kmVec4;cc.kmVec4Fill(f,c.x,c.y,c.z,1);cc.kmVec4Transform(e,f,d);a.x=e.x/e.w;a.y=e.y/e.w;a.z=e.z/e.w;return a};cc.kmVec3Scale=function(a,c,d){a.x=c.x*d;a.y=c.y*d;a.z=c.z*d;return a};cc.kmVec3AreEqual=function(a,c){return a.x<c.x+cc.kmEpsilon&&a.x>c.x-cc.kmEpsilon&&a.y<c.y+cc.kmEpsilon&&a.y>c.y-cc.kmEpsilon&&a.z<c.z+cc.kmEpsilon&&a.z>c.z-cc.kmEpsilon?1:0};
cc.kmVec3InverseTransform=function(a,c,d){c=new cc.kmVec3(c.x-d.mat[12],c.y-d.mat[13],c.z-d.mat[14]);a.x=c.x*d.mat[0]+c.y*d.mat[1]+c.z*d.mat[2];a.y=c.x*d.mat[4]+c.y*d.mat[5]+c.z*d.mat[6];a.z=c.x*d.mat[8]+c.y*d.mat[9]+c.z*d.mat[10];return a};cc.kmVec3InverseTransformNormal=function(a,c,d){a.x=c.x*d.mat[0]+c.y*d.mat[1]+c.z*d.mat[2];a.y=c.x*d.mat[4]+c.y*d.mat[5]+c.z*d.mat[6];a.z=c.x*d.mat[8]+c.y*d.mat[9]+c.z*d.mat[10];return a};cc.kmVec3Assign=function(a,c){if(a==c)return a;a.x=c.x;a.y=c.y;a.z=c.z;return a};
cc.kmVec3Zero=function(a){a.x=0;a.y=0;a.z=0;return a};cc.kmVec3ToTypeArray=function(a){if(!a)return null;var c=new Float32Array(3);c[0]=a.x;c[1]=a.y;c[2]=a.z;return c};cc.kmVec4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||0};cc.kmVec4Fill=function(a,c,d,e,f){a.x=c;a.y=d;a.z=e;a.w=f;return a};cc.kmVec4Add=function(a,c,d){a.x=c.x+d.x;a.y=c.y+d.y;a.z=c.z+d.z;a.w=c.w+d.w;return a};cc.kmVec4Dot=function(a,c){return a.x*c.x+a.y*c.y+a.z*c.z+a.w*c.w};cc.kmVec4Length=function(a){return Math.sqrt(cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z)+cc.kmSQR(a.w))};cc.kmVec4LengthSq=function(a){return cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z)+cc.kmSQR(a.w)};
cc.kmVec4Lerp=function(a,c,d,e){return a};cc.kmVec4Normalize=function(a,c){var d=1/cc.kmVec4Length(c);a.x*=d;a.y*=d;a.z*=d;a.w*=d;return a};cc.kmVec4Scale=function(a,c,d){cc.kmVec4Normalize(a,c);a.x*=d;a.y*=d;a.z*=d;a.w*=d;return a};cc.kmVec4Subtract=function(a,c,d){a.x=c.x-d.x;a.y=c.y-d.y;a.z=c.z-d.z;a.w=c.w-d.w;return a};
cc.kmVec4Transform=function(a,c,d){a.x=c.x*d.mat[0]+c.y*d.mat[4]+c.z*d.mat[8]+c.w*d.mat[12];a.y=c.x*d.mat[1]+c.y*d.mat[5]+c.z*d.mat[9]+c.w*d.mat[13];a.z=c.x*d.mat[2]+c.y*d.mat[6]+c.z*d.mat[10]+c.w*d.mat[14];a.w=c.x*d.mat[3]+c.y*d.mat[7]+c.z*d.mat[11]+c.w*d.mat[15];return a};cc.kmVec4TransformArray=function(a,c,d,e,f,g){for(var h=0;h<g;)cc.kmVec4Transform(a+h*c,d+h*e,f),++h;return a};
cc.kmVec4AreEqual=function(a,c){return a.x<c.x+cc.kmEpsilon&&a.x>c.x-cc.kmEpsilon&&a.y<c.y+cc.kmEpsilon&&a.y>c.y-cc.kmEpsilon&&a.z<c.z+cc.kmEpsilon&&a.z>c.z-cc.kmEpsilon&&a.w<c.w+cc.kmEpsilon&&a.w>c.w-cc.kmEpsilon};cc.kmVec4Assign=function(a,c){if(a==c)return cc.log("destVec and srcVec are same object"),a;a.x=c.x;a.y=c.y;a.z=c.z;a.w=c.w;return a};cc.kmVec4ToTypeArray=function(a){if(!a)return null;var c=new Float32Array(4);c[0]=a.x;c[1]=a.y;c[2]=a.z;c[3]=a.w;return c};cc.kmRay2=function(a,c){this.start=a||new cc.kmVec2;this.start=a||new cc.kmVec2};cc.kmRay2Fill=function(a,c,d,e,f){a.start.x=c;a.start.y=d;a.dir.x=e;a.dir.y=f};
cc.kmRay2IntersectLineSegment=function(a,c,d,e){var f=a.start.x,g=a.start.y,h=a.start.x+a.dir.x;a=a.start.y+a.dir.y;var k=c.x,m=c.y,n=d.x,p=d.y,q=(p-m)*(h-f)-(n-k)*(a-g);if(q>-cc.kmEpsilon&&q<cc.kmEpsilon)return cc.KM_FALSE;m=((n-k)*(g-m)-(p-m)*(f-k))/q;k=f+m*(h-f);m=g+m*(a-g);if(k<cc.kmMin(c.x,d.x)-cc.kmEpsilon||k>cc.kmMax(c.x,d.x)+cc.kmEpsilon||m<cc.kmMin(c.y,d.y)-cc.kmEpsilon||m>cc.kmMax(c.y,d.y)+cc.kmEpsilon||k<cc.kmMin(f,h)-cc.kmEpsilon||k>cc.kmMax(f,h)+cc.kmEpsilon||m<cc.kmMin(g,a)-cc.kmEpsilon||
m>cc.kmMax(g,a)+cc.kmEpsilon)return cc.KM_FALSE;e.x=k;e.y=m;return cc.KM_TRUE};cc.calculate_line_normal=function(a,c,d){var e=new cc.kmVec2;cc.kmVec2Subtract(e,c,a);d.x=-e.y;d.y=e.x;cc.kmVec2Normalize(d,d)};
cc.kmRay2IntersectTriangle=function(a,c,d,e,f,g){var h=new cc.kmVec2,k=new cc.kmVec2,m=new cc.kmVec2,n=1E4,p=cc.KM_FALSE,q;cc.kmRay2IntersectLineSegment(a,c,d,h)&&(q=new cc.kmVec2,p=cc.KM_TRUE,q=cc.kmVec2Length(cc.kmVec2Subtract(q,h,a.start)),q<n&&(k.x=h.x,k.y=h.y,n=q,cc.calculate_line_normal(c,d,m)));cc.kmRay2IntersectLineSegment(a,d,e,h)&&(q=new cc.kmVec2,p=cc.KM_TRUE,q=cc.kmVec2Length(cc.kmVec2Subtract(q,h,a.start)),q<n&&(k.x=h.x,k.y=h.y,n=q,cc.calculate_line_normal(d,e,m)));cc.kmRay2IntersectLineSegment(a,
e,c,h)&&(q=new cc.kmVec2,p=cc.KM_TRUE,q=cc.kmVec2Length(cc.kmVec2Subtract(q,h,a.start)),q<n&&(k.x=h.x,k.y=h.y,cc.calculate_line_normal(e,c,m)));p&&(f.x=k.x,f.y=k.y,g&&(g.x=m.x,g.y=m.y));return p};cc.kmRay2IntersectCircle=function(a,c,d,e){cc.log("cc.kmRay2IntersectCircle() has not been implemented.")};var Float32Array=Float32Array||Array;cc.kmMat3=function(){this.mat=new Float32Array([0,0,0,0,0,0,0,0,0])};cc.kmMat3Fill=function(a,c){for(var d=0;9>d;d++)a.mat[d]=c;return a};
cc.kmMat3Adjugate=function(a,c){a.mat[0]=c.mat[4]*c.mat[8]-c.mat[5]*c.mat[7];a.mat[1]=c.mat[2]*c.mat[7]-c.mat[1]*c.mat[8];a.mat[2]=c.mat[1]*c.mat[5]-c.mat[2]*c.mat[4];a.mat[3]=c.mat[5]*c.mat[6]-c.mat[3]*c.mat[8];a.mat[4]=c.mat[0]*c.mat[8]-c.mat[2]*c.mat[6];a.mat[5]=c.mat[2]*c.mat[3]-c.mat[0]*c.mat[5];a.mat[6]=c.mat[3]*c.mat[7]-c.mat[4]*c.mat[6];a.mat[8]=c.mat[0]*c.mat[4]-c.mat[1]*c.mat[3];return a};
cc.kmMat3Identity=function(a){a.mat[1]=a.mat[2]=a.mat[3]=a.mat[5]=a.mat[6]=a.mat[7]=0;a.mat[0]=a.mat[4]=a.mat[8]=1;return a};cc.kmMat3Inverse=function(a,c,d){var e=new cc.kmMat3;if(0===c)return null;c=1/c;cc.kmMat3Adjugate(e,d);cc.kmMat3ScalarMultiply(a,e,c);return a};cc.kmMat3._identity=new Float32Array([1,0,0,0,1,0,0,0,1]);cc.kmMat3IsIdentity=function(a){for(var c=0;9>c;c++)if(cc.kmMat3._identity[c]!==a.mat[c])return!1;return!0};
cc.kmMat3Transpose=function(a,c){var d,e;for(d=0;3>d;++d)for(e=0;3>e;++e)a.mat[3*d+e]=c.mat[3*e+d];return a};cc.kmMat3Determinant=function(a){var c;c=a.mat[0]*a.mat[4]*a.mat[8]+a.mat[1]*a.mat[5]*a.mat[6]+a.mat[2]*a.mat[3]*a.mat[7];return c-=a.mat[2]*a.mat[4]*a.mat[6]+a.mat[0]*a.mat[5]*a.mat[7]+a.mat[1]*a.mat[3]*a.mat[8]};
cc.kmMat3Multiply=function(a,c,d){c=c.mat;d=d.mat;a.mat[0]=c[0]*d[0]+c[3]*d[1]+c[6]*d[2];a.mat[1]=c[1]*d[0]+c[4]*d[1]+c[7]*d[2];a.mat[2]=c[2]*d[0]+c[5]*d[1]+c[8]*d[2];a.mat[3]=c[0]*d[3]+c[3]*d[4]+c[6]*d[5];a.mat[4]=c[1]*d[3]+c[4]*d[4]+c[7]*d[5];a.mat[5]=c[2]*d[3]+c[5]*d[4]+c[8]*d[5];a.mat[6]=c[0]*d[6]+c[3]*d[7]+c[6]*d[8];a.mat[7]=c[1]*d[6]+c[4]*d[7]+c[7]*d[8];a.mat[8]=c[2]*d[6]+c[5]*d[7]+c[8]*d[8];return a};cc.kmMat3ScalarMultiply=function(a,c,d){for(var e=0;9>e;e++)a.mat[e]=c.mat[e]*d;return a};
cc.kmMat3RotationAxisAngle=function(a,c,d){var e=Math.cos(d);d=Math.sin(d);a.mat[0]=e+c.x*c.x*(1-e);a.mat[1]=c.z*d+c.y*c.x*(1-e);a.mat[2]=-c.y*d+c.z*c.x*(1-e);a.mat[3]=-c.z*d+c.x*c.y*(1-e);a.mat[4]=e+c.y*c.y*(1-e);a.mat[5]=c.x*d+c.z*c.y*(1-e);a.mat[6]=c.y*d+c.x*c.z*(1-e);a.mat[7]=-c.x*d+c.y*c.z*(1-e);a.mat[8]=e+c.z*c.z*(1-e);return a};cc.kmMat3Assign=function(a,c){if(a==c)return cc.log("cc.kmMat3Assign(): pOut equals pIn"),a;for(var d=0;9>d;d++)a.mat[d]=c.mat[d];return a};
cc.kmMat3AreEqual=function(a,c){if(a==c)return!0;for(var d=0;9>d;++d)if(!(a.mat[d]+cc.kmEpsilon>c.mat[d]&&a.mat[d]-cc.kmEpsilon<c.mat[d]))return!1;return!0};cc.kmMat3RotationX=function(a,c){a.mat[0]=1;a.mat[1]=0;a.mat[2]=0;a.mat[3]=0;a.mat[4]=Math.cos(c);a.mat[5]=Math.sin(c);a.mat[6]=0;a.mat[7]=-Math.sin(c);a.mat[8]=Math.cos(c);return a};
cc.kmMat3RotationY=function(a,c){a.mat[0]=Math.cos(c);a.mat[1]=0;a.mat[2]=-Math.sin(c);a.mat[3]=0;a.mat[4]=1;a.mat[5]=0;a.mat[6]=Math.sin(c);a.mat[7]=0;a.mat[8]=Math.cos(c);return a};cc.kmMat3RotationZ=function(a,c){a.mat[0]=Math.cos(c);a.mat[1]=-Math.sin(c);a.mat[2]=0;a.mat[3]=Math.sin(c);a.mat[4]=Math.cos(c);a.mat[5]=0;a.mat[6]=0;a.mat[7]=0;a.mat[8]=1;return a};
cc.kmMat3Rotation=function(a,c){a.mat[0]=Math.cos(c);a.mat[1]=Math.sin(c);a.mat[2]=0;a.mat[3]=-Math.sin(c);a.mat[4]=Math.cos(c);a.mat[5]=0;a.mat[6]=0;a.mat[7]=0;a.mat[8]=1;return a};cc.kmMat3Scaling=function(a,c,d){cc.kmMat3Identity(a);a.mat[0]=c;a.mat[4]=d;return a};cc.kmMat3Translation=function(a,c,d){cc.kmMat3Identity(a);a.mat[6]=c;a.mat[7]=d;return a};
cc.kmMat3RotationQuaternion=function(a,c){if(!c||!a)return null;a.mat[0]=1-2*(c.y*c.y+c.z*c.z);a.mat[1]=2*(c.x*c.y-c.w*c.z);a.mat[2]=2*(c.x*c.z+c.w*c.y);a.mat[3]=2*(c.x*c.y+c.w*c.z);a.mat[4]=1-2*(c.x*c.x+c.z*c.z);a.mat[5]=2*(c.y*c.z-c.w*c.x);a.mat[6]=2*(c.x*c.z-c.w*c.y);a.mat[7]=2*(c.y*c.z+c.w*c.x);a.mat[8]=1-2*(c.x*c.x+c.y*c.y);return a};cc.kmMat3RotationToAxisAngle=function(a,c,d){cc.kmQuaternionRotationMatrix(void 0,d);cc.kmQuaternionToAxisAngle(void 0,a,c);return a};cc.kmMat4=function(){this.mat=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])};cc.kmMat4Fill=function(a,c){a.mat[0]=a.mat[1]=a.mat[2]=a.mat[3]=a.mat[4]=a.mat[5]=a.mat[6]=a.mat[7]=a.mat[8]=a.mat[9]=a.mat[10]=a.mat[11]=a.mat[12]=a.mat[13]=a.mat[14]=a.mat[15]=c};cc.kmMat4Identity=function(a){a.mat[1]=a.mat[2]=a.mat[3]=a.mat[4]=a.mat[6]=a.mat[7]=a.mat[8]=a.mat[9]=a.mat[11]=a.mat[12]=a.mat[13]=a.mat[14]=0;a.mat[0]=a.mat[5]=a.mat[10]=a.mat[15]=1;return a};
cc.kmMat4._get=function(a,c,d){return a.mat[c+4*d]};cc.kmMat4._set=function(a,c,d,e){a.mat[c+4*d]=e};cc.kmMat4._swap=function(a,c,d,e,f){var g=cc.kmMat4._get(a,c,d);cc.kmMat4._set(a,c,d,cc.kmMat4._get(a,e,f));cc.kmMat4._set(a,e,f,g)};
cc.kmMat4._gaussj=function(a,c){var d,e=0,f=0,g,h,k,m=[0,0,0,0],n=[0,0,0,0],p=[0,0,0,0];for(d=0;4>d;d++){for(g=k=0;4>g;g++)if(1!=p[g])for(h=0;4>h;h++)0==p[h]&&Math.abs(cc.kmMat4._get(a,g,h))>=k&&(k=Math.abs(cc.kmMat4._get(a,g,h)),f=g,e=h);++p[e];if(f!=e){for(g=0;4>g;g++)cc.kmMat4._swap(a,f,g,e,g);for(g=0;4>g;g++)cc.kmMat4._swap(c,f,g,e,g)}n[d]=f;m[d]=e;if(0==cc.kmMat4._get(a,e,e))return cc.KM_FALSE;h=1/cc.kmMat4._get(a,e,e);cc.kmMat4._set(a,e,e,1);for(g=0;4>g;g++)cc.kmMat4._set(a,e,g,cc.kmMat4._get(a,
e,g)*h);for(g=0;4>g;g++)cc.kmMat4._set(c,e,g,cc.kmMat4._get(c,e,g)*h);for(h=0;4>h;h++)if(h!=e){k=cc.kmMat4._get(a,h,e);cc.kmMat4._set(a,h,e,0);for(g=0;4>g;g++)cc.kmMat4._set(a,h,g,cc.kmMat4._get(a,h,g)-cc.kmMat4._get(a,e,g)*k);for(g=0;4>g;g++)cc.kmMat4._set(c,h,g,cc.kmMat4._get(a,h,g)-cc.kmMat4._get(c,e,g)*k)}}for(g=3;0<=g;g--)if(n[g]!=m[g])for(h=0;4>h;h++)cc.kmMat4._swap(a,h,n[g],h,m[g]);return cc.KM_TRUE};cc.kmMat4._identity=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);
cc.kmMat4Inverse=function(a,c){var d=new cc.kmMat4,e=new cc.kmMat4;cc.kmMat4Assign(d,c);cc.kmMat4Identity(e);if(cc.kmMat4._gaussj(d,e)==cc.KM_FALSE)return null;cc.kmMat4Assign(a,d);return a};cc.kmMat4IsIdentity=function(a){for(var c=0;16>c;c++)if(cc.kmMat4._identity[c]!=a.mat[c])return!1;return!0};cc.kmMat4Transpose=function(a,c){var d,e,f=a.mat,g=c.mat;for(e=0;4>e;++e)for(d=0;4>d;++d)f[4*e+d]=g[4*d+e];return a};
cc.kmMat4Multiply=function(a,c,d){var e=a.mat,f=c.mat[0],g=c.mat[1],h=c.mat[2],k=c.mat[3],m=c.mat[4],n=c.mat[5],p=c.mat[6],q=c.mat[7],s=c.mat[8],r=c.mat[9],t=c.mat[10],u=c.mat[11],v=c.mat[12],z=c.mat[13],B=c.mat[14];c=c.mat[15];var E=d.mat[0],x=d.mat[1],y=d.mat[2],C=d.mat[3],w=d.mat[4],A=d.mat[5],F=d.mat[6],G=d.mat[7],D=d.mat[8],J=d.mat[9],L=d.mat[10],K=d.mat[11],M=d.mat[12],H=d.mat[13],I=d.mat[14];d=d.mat[15];e[0]=E*f+x*m+y*s+C*v;e[1]=E*g+x*n+y*r+C*z;e[2]=E*h+x*p+y*t+C*B;e[3]=E*k+x*q+y*u+C*c;e[4]=
w*f+A*m+F*s+G*v;e[5]=w*g+A*n+F*r+G*z;e[6]=w*h+A*p+F*t+G*B;e[7]=w*k+A*q+F*u+G*c;e[8]=D*f+J*m+L*s+K*v;e[9]=D*g+J*n+L*r+K*z;e[10]=D*h+J*p+L*t+K*B;e[11]=D*k+J*q+L*u+K*c;e[12]=M*f+H*m+I*s+d*v;e[13]=M*g+H*n+I*r+d*z;e[14]=M*h+H*p+I*t+d*B;e[15]=M*k+H*q+I*u+d*c;return a};
cc.getMat4MultiplyValue=function(a,c){var d=a.mat,e=c.mat,f=new Float32Array(16);f[0]=d[0]*e[0]+d[4]*e[1]+d[8]*e[2]+d[12]*e[3];f[1]=d[1]*e[0]+d[5]*e[1]+d[9]*e[2]+d[13]*e[3];f[2]=d[2]*e[0]+d[6]*e[1]+d[10]*e[2]+d[14]*e[3];f[3]=d[3]*e[0]+d[7]*e[1]+d[11]*e[2]+d[15]*e[3];f[4]=d[0]*e[4]+d[4]*e[5]+d[8]*e[6]+d[12]*e[7];f[5]=d[1]*e[4]+d[5]*e[5]+d[9]*e[6]+d[13]*e[7];f[6]=d[2]*e[4]+d[6]*e[5]+d[10]*e[6]+d[14]*e[7];f[7]=d[3]*e[4]+d[7]*e[5]+d[11]*e[6]+d[15]*e[7];f[8]=d[0]*e[8]+d[4]*e[9]+d[8]*e[10]+d[12]*e[11];
f[9]=d[1]*e[8]+d[5]*e[9]+d[9]*e[10]+d[13]*e[11];f[10]=d[2]*e[8]+d[6]*e[9]+d[10]*e[10]+d[14]*e[11];f[11]=d[3]*e[8]+d[7]*e[9]+d[11]*e[10]+d[15]*e[11];f[12]=d[0]*e[12]+d[4]*e[13]+d[8]*e[14]+d[12]*e[15];f[13]=d[1]*e[12]+d[5]*e[13]+d[9]*e[14]+d[13]*e[15];f[14]=d[2]*e[12]+d[6]*e[13]+d[10]*e[14]+d[14]*e[15];f[15]=d[3]*e[12]+d[7]*e[13]+d[11]*e[14]+d[15]*e[15];return f};
cc.getMat4MultiplyWithMat4=function(a,c,d){a=a.mat;c=c.mat;var e=d.mat;e[0]=a[0]*c[0]+a[4]*c[1]+a[8]*c[2]+a[12]*c[3];e[1]=a[1]*c[0]+a[5]*c[1]+a[9]*c[2]+a[13]*c[3];e[2]=a[2]*c[0]+a[6]*c[1]+a[10]*c[2]+a[14]*c[3];e[3]=a[3]*c[0]+a[7]*c[1]+a[11]*c[2]+a[15]*c[3];e[4]=a[0]*c[4]+a[4]*c[5]+a[8]*c[6]+a[12]*c[7];e[5]=a[1]*c[4]+a[5]*c[5]+a[9]*c[6]+a[13]*c[7];e[6]=a[2]*c[4]+a[6]*c[5]+a[10]*c[6]+a[14]*c[7];e[7]=a[3]*c[4]+a[7]*c[5]+a[11]*c[6]+a[15]*c[7];e[8]=a[0]*c[8]+a[4]*c[9]+a[8]*c[10]+a[12]*c[11];e[9]=a[1]*
c[8]+a[5]*c[9]+a[9]*c[10]+a[13]*c[11];e[10]=a[2]*c[8]+a[6]*c[9]+a[10]*c[10]+a[14]*c[11];e[11]=a[3]*c[8]+a[7]*c[9]+a[11]*c[10]+a[15]*c[11];e[12]=a[0]*c[12]+a[4]*c[13]+a[8]*c[14]+a[12]*c[15];e[13]=a[1]*c[12]+a[5]*c[13]+a[9]*c[14]+a[13]*c[15];e[14]=a[2]*c[12]+a[6]*c[13]+a[10]*c[14]+a[14]*c[15];e[15]=a[3]*c[12]+a[7]*c[13]+a[11]*c[14]+a[15]*c[15];return d.mat};
cc.kmMat4Assign=function(a,c){if(a==c)return cc.log("cc.kmMat4Assign(): pOut equals pIn"),a;var d=a.mat,e=c.mat;d[0]=e[0];d[1]=e[1];d[2]=e[2];d[3]=e[3];d[4]=e[4];d[5]=e[5];d[6]=e[6];d[7]=e[7];d[8]=e[8];d[9]=e[9];d[10]=e[10];d[11]=e[11];d[12]=e[12];d[13]=e[13];d[14]=e[14];d[15]=e[15];return a};
cc.kmMat4AreEqual=function(a,c){if(a==c)return cc.log("cc.kmMat4AreEqual(): pMat1 and pMat2 are same object."),!0;for(var d=0;16>d;d++)if(!(a.mat[d]+cc.kmEpsilon>c.mat[d]&&a.mat[d]-cc.kmEpsilon<c.mat[d]))return!1;return!0};cc.kmMat4RotationX=function(a,c){a.mat[0]=1;a.mat[1]=0;a.mat[2]=0;a.mat[3]=0;a.mat[4]=0;a.mat[5]=Math.cos(c);a.mat[6]=Math.sin(c);a.mat[7]=0;a.mat[8]=0;a.mat[9]=-Math.sin(c);a.mat[10]=Math.cos(c);a.mat[11]=0;a.mat[12]=0;a.mat[13]=0;a.mat[14]=0;a.mat[15]=1;return a};
cc.kmMat4RotationY=function(a,c){a.mat[0]=Math.cos(c);a.mat[1]=0;a.mat[2]=-Math.sin(c);a.mat[3]=0;a.mat[4]=0;a.mat[5]=1;a.mat[6]=0;a.mat[7]=0;a.mat[8]=Math.sin(c);a.mat[9]=0;a.mat[10]=Math.cos(c);a.mat[11]=0;a.mat[12]=0;a.mat[13]=0;a.mat[14]=0;a.mat[15]=1;return a};
cc.kmMat4RotationZ=function(a,c){a.mat[0]=Math.cos(c);a.mat[1]=Math.sin(c);a.mat[2]=0;a.mat[3]=0;a.mat[4]=-Math.sin(c);a.mat[5]=Math.cos(c);a.mat[6]=0;a.mat[7]=0;a.mat[8]=0;a.mat[9]=0;a.mat[10]=1;a.mat[11]=0;a.mat[12]=0;a.mat[13]=0;a.mat[14]=0;a.mat[15]=1;return a};
cc.kmMat4RotationPitchYawRoll=function(a,c,d,e){var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);var k=c*d,m=f*d;a.mat[0]=g*h;a.mat[4]=g*e;a.mat[8]=-d;a.mat[1]=k*h-f*e;a.mat[5]=k*e+f*h;a.mat[9]=c*g;a.mat[2]=m*h+c*e;a.mat[6]=m*e-c*h;a.mat[10]=f*g;a.mat[3]=a.mat[7]=a.mat[11]=0;a.mat[15]=1;return a};
cc.kmMat4RotationQuaternion=function(a,c){a.mat[0]=1-2*(c.y*c.y+c.z*c.z);a.mat[1]=2*(c.x*c.y+c.z*c.w);a.mat[2]=2*(c.x*c.z-c.y*c.w);a.mat[3]=0;a.mat[4]=2*(c.x*c.y-c.z*c.w);a.mat[5]=1-2*(c.x*c.x+c.z*c.z);a.mat[6]=2*(c.z*c.y+c.x*c.w);a.mat[7]=0;a.mat[8]=2*(c.x*c.z+c.y*c.w);a.mat[9]=2*(c.y*c.z-c.x*c.w);a.mat[10]=1-2*(c.x*c.x+c.y*c.y);a.mat[11]=0;a.mat[12]=0;a.mat[13]=0;a.mat[14]=0;a.mat[15]=1;return a};
cc.kmMat4RotationTranslation=function(a,c,d){a.mat[0]=c.mat[0];a.mat[1]=c.mat[1];a.mat[2]=c.mat[2];a.mat[3]=0;a.mat[4]=c.mat[3];a.mat[5]=c.mat[4];a.mat[6]=c.mat[5];a.mat[7]=0;a.mat[8]=c.mat[6];a.mat[9]=c.mat[7];a.mat[10]=c.mat[8];a.mat[11]=0;a.mat[12]=d.x;a.mat[13]=d.y;a.mat[14]=d.z;a.mat[15]=1;return a};
cc.kmMat4Scaling=function(a,c,d,e){a.mat[0]=c;a.mat[5]=d;a.mat[10]=e;a.mat[15]=1;a.mat[1]=a.mat[2]=a.mat[3]=a.mat[4]=a.mat[6]=a.mat[7]=a.mat[8]=a.mat[9]=a.mat[11]=a.mat[12]=a.mat[13]=a.mat[14]=0;return a};cc.kmMat4Translation=function(a,c,d,e){a.mat[0]=a.mat[5]=a.mat[10]=a.mat[15]=1;a.mat[1]=a.mat[2]=a.mat[3]=a.mat[4]=a.mat[6]=a.mat[7]=a.mat[8]=a.mat[9]=a.mat[11]=0;a.mat[12]=c;a.mat[13]=d;a.mat[14]=e;return a};
cc.kmMat4GetUpVec3=function(a,c){a.x=c.mat[4];a.y=c.mat[5];a.z=c.mat[6];cc.kmVec3Normalize(a,a);return a};cc.kmMat4GetRightVec3=function(a,c){a.x=c.mat[0];a.y=c.mat[1];a.z=c.mat[2];cc.kmVec3Normalize(a,a);return a};cc.kmMat4GetForwardVec3=function(a,c){a.x=c.mat[8];a.y=c.mat[9];a.z=c.mat[10];cc.kmVec3Normalize(a,a);return a};
cc.kmMat4PerspectiveProjection=function(a,c,d,e,f){var g=cc.kmDegreesToRadians(c/2);c=f-e;var h=Math.sin(g);if(0==c||0==h||0==d)return null;g=Math.cos(g)/h;cc.kmMat4Identity(a);a.mat[0]=g/d;a.mat[5]=g;a.mat[10]=-(f+e)/c;a.mat[11]=-1;a.mat[14]=-2*e*f/c;a.mat[15]=0;return a};cc.kmMat4OrthographicProjection=function(a,c,d,e,f,g,h){cc.kmMat4Identity(a);a.mat[0]=2/(d-c);a.mat[5]=2/(f-e);a.mat[10]=-2/(h-g);a.mat[12]=-((d+c)/(d-c));a.mat[13]=-((f+e)/(f-e));a.mat[14]=-((h+g)/(h-g));return a};
cc.kmMat4LookAt=function(a,c,d,e){var f=new cc.kmVec3,g=new cc.kmVec3,h=new cc.kmVec3,k=new cc.kmVec3,m=new cc.kmMat4;cc.kmVec3Subtract(f,d,c);cc.kmVec3Normalize(f,f);cc.kmVec3Assign(g,e);cc.kmVec3Normalize(g,g);cc.kmVec3Cross(h,f,g);cc.kmVec3Normalize(h,h);cc.kmVec3Cross(k,h,f);cc.kmVec3Normalize(h,h);cc.kmMat4Identity(a);a.mat[0]=h.x;a.mat[4]=h.y;a.mat[8]=h.z;a.mat[1]=k.x;a.mat[5]=k.y;a.mat[9]=k.z;a.mat[2]=-f.x;a.mat[6]=-f.y;a.mat[10]=-f.z;cc.kmMat4Translation(m,-c.x,-c.y,-c.z);cc.kmMat4Multiply(a,
a,m);return a};cc.kmMat4RotationAxisAngle=function(a,c,d){var e=Math.cos(d);d=Math.sin(d);var f=new cc.kmVec3;cc.kmVec3Normalize(f,c);a.mat[0]=e+f.x*f.x*(1-e);a.mat[1]=f.z*d+f.y*f.x*(1-e);a.mat[2]=-f.y*d+f.z*f.x*(1-e);a.mat[3]=0;a.mat[4]=-f.z*d+f.x*f.y*(1-e);a.mat[5]=e+f.y*f.y*(1-e);a.mat[6]=f.x*d+f.z*f.y*(1-e);a.mat[7]=0;a.mat[8]=f.y*d+f.x*f.z*(1-e);a.mat[9]=-f.x*d+f.y*f.z*(1-e);a.mat[10]=e+f.z*f.z*(1-e);a.mat[11]=0;a.mat[12]=0;a.mat[13]=0;a.mat[14]=0;a.mat[15]=1;return a};
cc.kmMat4ExtractRotation=function(a,c){a.mat[0]=c.mat[0];a.mat[1]=c.mat[1];a.mat[2]=c.mat[2];a.mat[3]=c.mat[4];a.mat[4]=c.mat[5];a.mat[5]=c.mat[6];a.mat[6]=c.mat[8];a.mat[7]=c.mat[9];a.mat[8]=c.mat[10];return a};
cc.kmMat4ExtractPlane=function(a,c,d){switch(d){case cc.KM_PLANE_RIGHT:a.a=c.mat[3]-c.mat[0];a.b=c.mat[7]-c.mat[4];a.c=c.mat[11]-c.mat[8];a.d=c.mat[15]-c.mat[12];break;case cc.KM_PLANE_LEFT:a.a=c.mat[3]+c.mat[0];a.b=c.mat[7]+c.mat[4];a.c=c.mat[11]+c.mat[8];a.d=c.mat[15]+c.mat[12];break;case cc.KM_PLANE_BOTTOM:a.a=c.mat[3]+c.mat[1];a.b=c.mat[7]+c.mat[5];a.c=c.mat[11]+c.mat[9];a.d=c.mat[15]+c.mat[13];break;case cc.KM_PLANE_TOP:a.a=c.mat[3]-c.mat[1];a.b=c.mat[7]-c.mat[5];a.c=c.mat[11]-c.mat[9];a.d=c.mat[15]-
c.mat[13];break;case cc.KM_PLANE_FAR:a.a=c.mat[3]-c.mat[2];a.b=c.mat[7]-c.mat[6];a.c=c.mat[11]-c.mat[10];a.d=c.mat[15]-c.mat[14];break;case cc.KM_PLANE_NEAR:a.a=c.mat[3]+c.mat[2];a.b=c.mat[7]+c.mat[6];a.c=c.mat[11]+c.mat[10];a.d=c.mat[15]+c.mat[14];break;default:cc.log("cc.kmMat4ExtractPlane(): Invalid plane index")}c=Math.sqrt(a.a*a.a+a.b*a.b+a.c*a.c);a.a/=c;a.b/=c;a.c/=c;a.d/=c;return a};
cc.kmMat4RotationToAxisAngle=function(a,c,d){var e=new cc.kmQuaternion,f=new cc.kmMat3;cc.kmMat4ExtractRotation(f,d);cc.kmQuaternionRotationMatrix(e,f);cc.kmQuaternionToAxisAngle(e,a,c);return a};cc.KM_PLANE_LEFT=0;cc.KM_PLANE_RIGHT=1;cc.KM_PLANE_BOTTOM=2;cc.KM_PLANE_TOP=3;cc.KM_PLANE_NEAR=4;cc.KM_PLANE_FAR=5;cc.kmPlane=function(a,c,d,e){this.a=a||0;this.b=c||0;this.c=d||0;this.d=e||0};cc.POINT_INFRONT_OF_PLANE=0;cc.POINT_BEHIND_PLANE=1;cc.POINT_ON_PLANE=2;cc.kmPlaneDot=function(a,c){return a.a*c.x+a.b*c.y+a.c*c.z+a.d*c.w};cc.kmPlaneDotCoord=function(a,c){return a.a*c.x+a.b*c.y+a.c*c.z+a.d};cc.kmPlaneDotNormal=function(a,c){return a.a*c.x+a.b*c.y+a.c*c.z};
cc.kmPlaneFromPointNormal=function(a,c,d){a.a=d.x;a.b=d.y;a.c=d.z;a.d=-cc.kmVec3Dot(d,c);return a};cc.kmPlaneFromPoints=function(a,c,d,e){var f=new cc.kmVec3,g=new cc.kmVec3,h=new cc.kmVec3;cc.kmVec3Subtract(g,d,c);cc.kmVec3Subtract(h,e,c);cc.kmVec3Cross(f,g,h);cc.kmVec3Normalize(f,f);a.a=f.x;a.b=f.y;a.c=f.z;a.d=cc.kmVec3Dot(cc.kmVec3Scale(f,f,-1),c);return a};cc.kmPlaneIntersectLine=function(a,c,d,e){throw"cc.kmPlaneIntersectLine() hasn't been implemented.";};
cc.kmPlaneNormalize=function(a,c){var d=new cc.kmVec3;d.x=c.a;d.y=c.b;d.z=c.c;var e=1/cc.kmVec3Length(d);cc.kmVec3Normalize(d,d);a.a=d.x;a.b=d.y;a.c=d.z;a.d=c.d*e;return a};cc.kmPlaneScale=function(a,c,d){cc.log("cc.kmPlaneScale() has not been implemented.")};cc.kmPlaneClassifyPoint=function(a,c){var d=a.a*c.x+a.b*c.y+a.c*c.z+a.d;return 0.001<d?cc.POINT_INFRONT_OF_PLANE:-0.001>d?cc.POINT_BEHIND_PLANE:cc.POINT_ON_PLANE};cc.kmQuaternion=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||0};cc.kmQuaternionConjugate=function(a,c){a.x=-c.x;a.y=-c.y;a.z=-c.z;a.w=c.w;return a};cc.kmQuaternionDot=function(a,c){return a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z};cc.kmQuaternionExp=function(a,c){return a};cc.kmQuaternionIdentity=function(a){a.x=0;a.y=0;a.z=0;a.w=1;return a};
cc.kmQuaternionInverse=function(a,c){var d=cc.kmQuaternionLength(c),e=new cc.kmQuaternion;if(Math.abs(d)>cc.kmEpsilon)return a.x=0,a.y=0,a.z=0,a.w=0,a;cc.kmQuaternionScale(a,cc.kmQuaternionConjugate(e,c),1/d);return a};cc.kmQuaternionIsIdentity=function(a){return 0==a.x&&0==a.y&&0==a.z&&1==a.w};cc.kmQuaternionLength=function(a){return Math.sqrt(cc.kmQuaternionLengthSq(a))};cc.kmQuaternionLengthSq=function(a){return a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w};cc.kmQuaternionLn=function(a,c){return a};
cc.kmQuaternionMultiply=function(a,c,d){a.w=c.w*d.w-c.x*d.x-c.y*d.y-c.z*d.z;a.x=c.w*d.x+c.x*d.w+c.y*d.z-c.z*d.y;a.y=c.w*d.y+c.y*d.w+c.z*d.x-c.x*d.z;a.z=c.w*d.z+c.z*d.w+c.x*d.y-c.y*d.x;return a};cc.kmQuaternionNormalize=function(a,c){var d=cc.kmQuaternionLength(c);if(Math.abs(d)<=cc.kmEpsilon)throw"cc.kmQuaternionNormalize(): pIn is an invalid value";cc.kmQuaternionScale(a,c,1/d);return a};
cc.kmQuaternionRotationAxis=function(a,c,d){d*=0.5;var e=Math.sin(d);a.w=Math.cos(d);a.x=c.x*e;a.y=c.y*e;a.z=c.z*e;return a};
cc.kmQuaternionRotationMatrix=function(a,c){var d,e,f,g;d=[];e=g=0;if(!c)return null;d[0]=c.mat[0];d[1]=c.mat[3];d[2]=c.mat[6];d[4]=c.mat[1];d[5]=c.mat[4];d[6]=c.mat[7];d[8]=c.mat[2];d[9]=c.mat[5];d[10]=c.mat[8];d[15]=1;var h=d[0];e=h[0]+h[5]+h[10]+1;e>cc.kmEpsilon?(g=2*Math.sqrt(e),d=(h[9]-h[6])/g,e=(h[2]-h[8])/g,f=(h[4]-h[1])/g,g*=0.25):h[0]>h[5]&&h[0]>h[10]?(g=2*Math.sqrt(1+h[0]-h[5]-h[10]),d=0.25*g,e=(h[4]+h[1])/g,f=(h[2]+h[8])/g,g=(h[9]-h[6])/g):h[5]>h[10]?(g=2*Math.sqrt(1+h[5]-h[0]-h[10]),d=
(h[4]+h[1])/g,e=0.25*g,f=(h[9]+h[6])/g,g=(h[2]-h[8])/g):(g=2*Math.sqrt(1+h[10]-h[0]-h[5]),d=(h[2]+h[8])/g,e=(h[9]+h[6])/g,f=0.25*g,g=(h[4]-h[1])/g);a.x=d;a.y=e;a.z=f;a.w=g;return a};
cc.kmQuaternionRotationYawPitchRoll=function(a,c,d,e){var f,g,h,k,m;f=cc.kmDegreesToRadians(d)/2;g=cc.kmDegreesToRadians(c)/2;h=cc.kmDegreesToRadians(e)/2;e=Math.cos(f);c=Math.cos(g);d=Math.cos(h);f=Math.sin(f);g=Math.sin(g);h=Math.sin(h);k=c*d;m=g*h;a.w=e*k+f*m;a.x=f*k-e*m;a.y=e*g*d+f*c*h;a.z=e*c*h-f*g*d;cc.kmQuaternionNormalize(a,a);return a};
cc.kmQuaternionSlerp=function(a,c,d,e){if(c.x==d.x&&c.y==d.y&&c.z==d.z&&c.w==d.w)return a.x=c.x,a.y=c.y,a.z=c.z,a.w=c.w,a;var f=cc.kmQuaternionDot(c,d),g=Math.acos(f),h=Math.sqrt(1-cc.kmSQR(f)),f=Math.sin(e*g)/h;e=Math.sin((1-e)*g)/h;g=new cc.kmQuaternion;h=new cc.kmQuaternion;cc.kmQuaternionScale(g,c,e);cc.kmQuaternionScale(h,d,f);cc.kmQuaternionAdd(a,g,h);return a};
cc.kmQuaternionToAxisAngle=function(a,c,d){Math.acos(a.w);d=Math.sqrt(cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z));d>-cc.kmEpsilon&&d<cc.kmEpsilon||d<2*cc.kmPI+cc.kmEpsilon&&d>2*cc.kmPI-cc.kmEpsilon?(c.x=0,c.y=0,c.z=1):(c.x=a.x/d,c.y=a.y/d,c.z=a.z/d,cc.kmVec3Normalize(c,c))};cc.kmQuaternionScale=function(a,c,d){a.x=c.x*d;a.y=c.y*d;a.z=c.z*d;a.w=c.w*d;return a};cc.kmQuaternionAssign=function(a,c){a.x=c.x;a.y=c.y;a.z=c.z;a.w=c.w;return a};
cc.kmQuaternionAdd=function(a,c,d){a.x=c.x+d.x;a.y=c.y+d.y;a.z=c.z+d.z;a.w=c.w+d.w;return a};
cc.kmQuaternionRotationBetweenVec3=function(a,c,d,e){var f=new cc.kmVec3,g=new cc.kmVec3;cc.kmVec3Assign(f,c);cc.kmVec3Assign(g,d);cc.kmVec3Normalize(f,f);cc.kmVec3Normalize(g,g);d=cc.kmVec3Dot(f,g);if(1<=d)return cc.kmQuaternionIdentity(a),a;-0.999999>d?Math.abs(cc.kmVec3LengthSq(e))<cc.kmEpsilon?cc.kmQuaternionRotationAxis(a,e,cc.kmPI):(f=new cc.kmVec3,g=new cc.kmVec3,g.x=1,g.y=0,g.z=0,cc.kmVec3Cross(f,g,c),Math.abs(cc.kmVec3LengthSq(f))<cc.kmEpsilon&&(g=new cc.kmVec3,g.x=0,g.y=1,g.z=0,cc.kmVec3Cross(f,
g,c)),cc.kmVec3Normalize(f,f),cc.kmQuaternionRotationAxis(a,f,cc.kmPI)):(c=Math.sqrt(2*(1+d)),e=1/c,d=new cc.kmVec3,cc.kmVec3Cross(d,f,g),a.x=d.x*e,a.y=d.y*e,a.z=d.z*e,a.w=0.5*c,cc.kmQuaternionNormalize(a,a));return a};cc.kmQuaternionMultiplyVec3=function(a,c,d){var e=new cc.kmVec3,f=new cc.kmVec3,g=new cc.kmVec3;g.x=c.x;g.y=c.y;g.z=c.z;cc.kmVec3Cross(e,g,d);cc.kmVec3Cross(f,g,e);cc.kmVec3Scale(e,e,2*c.w);cc.kmVec3Scale(f,f,2);cc.kmVec3Add(a,d,e);cc.kmVec3Add(a,a,f);return a};cc.kmAABB=function(a,c){this.min=a||new cc.kmVec3;this.max=c||new cc.kmVec3};cc.kmAABBContainsPoint=function(a,c){return a.x>=c.min.x&&a.x<=c.max.x&&a.y>=c.min.y&&a.y<=c.max.y&&a.z>=c.min.z&&a.z<=c.max.z?cc.KM_TRUE:cc.KM_FALSE};cc.kmAABBAssign=function(a,c){cc.kmVec3Assign(a.min,c.min);cc.kmVec3Assign(a.max,c.max);return a};cc.kmAABBScale=function(a,c,d){cc.log("cc.kmAABBScale hasn't been supported.")};cc.km_mat4_stack=function(a,c,d,e){this.top=d;this.stack=e};cc.km_mat4_stack.INITIAL_SIZE=30;cc.km_mat4_stack_initialize=function(a){a.stack=[];a.top=null};cc.km_mat4_stack_push=function(a,c){a.stack.push(a.top);a.top=new cc.kmMat4;cc.kmMat4Assign(a.top,c)};cc.km_mat4_stack_pop=function(a,c){a.top=a.stack.pop()};cc.km_mat4_stack_release=function(a){a.stack=null;a.top=null};cc.KM_GL_MODELVIEW=5888;cc.KM_GL_PROJECTION=5889;cc.KM_GL_TEXTURE=5890;cc.modelview_matrix_stack=new cc.km_mat4_stack;cc.projection_matrix_stack=new cc.km_mat4_stack;cc.texture_matrix_stack=new cc.km_mat4_stack;cc.current_stack=null;cc.initialized=!1;
cc.lazyInitialize=function(){if(!cc.initialized){var a=new cc.kmMat4;cc.km_mat4_stack_initialize(cc.modelview_matrix_stack);cc.km_mat4_stack_initialize(cc.projection_matrix_stack);cc.km_mat4_stack_initialize(cc.texture_matrix_stack);cc.current_stack=cc.modelview_matrix_stack;cc.initialized=!0;cc.kmMat4Identity(a);cc.km_mat4_stack_push(cc.modelview_matrix_stack,a);cc.km_mat4_stack_push(cc.projection_matrix_stack,a);cc.km_mat4_stack_push(cc.texture_matrix_stack,a)}};cc.lazyInitialize();
cc.kmGLFreeAll=function(){cc.km_mat4_stack_release(cc.modelview_matrix_stack);cc.km_mat4_stack_release(cc.projection_matrix_stack);cc.km_mat4_stack_release(cc.texture_matrix_stack);cc.initialized=!1;cc.current_stack=null};cc.kmGLPushMatrix=function(){cc.km_mat4_stack_push(cc.current_stack,cc.current_stack.top)};cc.kmGLPushMatrixWitMat4=function(a){cc.current_stack.stack.push(cc.current_stack.top);cc.kmMat4Assign(a,cc.current_stack.top);cc.current_stack.top=a};
cc.kmGLPopMatrix=function(){cc.current_stack.top=cc.current_stack.stack.pop()};cc.kmGLMatrixMode=function(a){switch(a){case cc.KM_GL_MODELVIEW:cc.current_stack=cc.modelview_matrix_stack;break;case cc.KM_GL_PROJECTION:cc.current_stack=cc.projection_matrix_stack;break;case cc.KM_GL_TEXTURE:cc.current_stack=cc.texture_matrix_stack;break;default:throw"Invalid matrix mode specified";}};cc.kmGLLoadIdentity=function(){cc.kmMat4Identity(cc.current_stack.top)};
cc.kmGLLoadMatrix=function(a){cc.kmMat4Assign(cc.current_stack.top,a)};cc.kmGLMultMatrix=function(a){cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,a)};cc.kmGLTranslatef=function(a,c,d){var e=new cc.kmMat4;cc.kmMat4Translation(e,a,c,d);cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,e)};
cc.kmGLRotatef=function(a,c,d,e){c=new cc.kmVec3(c,d,e);d=new cc.kmMat4;cc.kmMat4RotationAxisAngle(d,c,cc.kmDegreesToRadians(a));cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,d)};cc.kmGLScalef=function(a,c,d){var e=new cc.kmMat4;cc.kmMat4Scaling(e,a,c,d);cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,e)};
cc.kmGLGetMatrix=function(a,c){switch(a){case cc.KM_GL_MODELVIEW:cc.kmMat4Assign(c,cc.modelview_matrix_stack.top);break;case cc.KM_GL_PROJECTION:cc.kmMat4Assign(c,cc.projection_matrix_stack.top);break;case cc.KM_GL_TEXTURE:cc.kmMat4Assign(c,cc.texture_matrix_stack.top);break;default:throw"Invalid matrix mode specified";}};cc.SHADER_POSITION_UCOLOR_FRAG="                                           \nprecision lowp float;                    \n                                         \nvarying vec4 v_fragmentColor;            \n                                         \nvoid main()                              \n{                                        \n    gl_FragColor \x3d v_fragmentColor;      \n}                                        \n";cc.SHADER_POSITION_UCOLOR_VERT="                                               \nattribute vec4 a_position;               \nuniform    vec4 u_color;                 \nuniform float u_pointSize;               \n                                         \nvarying lowp vec4 v_fragmentColor;       \n                                         \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="                                        \nprecision lowp float;                 \nvarying vec4 v_fragmentColor;         \n                                      \nvoid main()                           \n{                                     \n     gl_FragColor \x3d v_fragmentColor;       \n} ";cc.SHADER_POSITION_COLOR_VERT="                                                \nattribute vec4 a_position;                \nattribute vec4 a_color;                   \n                                          \nvarying lowp vec4 v_fragmentColor;        \n                                          \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="                                               \n// #extension GL_OES_standard_derivatives : enable\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\nvarying mediump vec4 v_color;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\nvarying mediump vec2 v_texcoord;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    \n\nvoid main()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n// #if defined GL_OES_standard_derivatives\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n// gl_FragColor \x3d v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord));\t\t\t\t\t\t\t    \n// #else\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ngl_FragColor \x3d v_color * step(0.0, 1.0 - length(v_texcoord));\t\t\t\t\t\t\t\t\t\t\t\t\t\t        \n// #endif\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n}";
cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT="\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t        \nattribute mediump vec4 a_position;\t\t\t\t\t\t\t\t\t\nattribute mediump vec2 a_texcoord;\t\t\t\t\t\t\t\t\t\nattribute mediump vec4 a_color;\t\t\t\t\t\t\t\t\t\t\n\nvarying mediump vec4 v_color;\t\t\t\t\t\t\t\t\t\t\nvarying mediump vec2 v_texcoord;\t\t\t\t\t\t\t\t\t    \n\nvoid main()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n     v_color \x3d a_color;//vec4(a_color.rgb * a_color.a, a_color.a);\t\t\t\t\n     v_texcoord \x3d a_texcoord;\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t        \n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n}";
cc.SHADER_POSITION_TEXTURE_FRAG="                                             \nprecision lowp float;                      \n                                           \nvarying vec2 v_texCoord;                   \nuniform sampler2D CC_Texture0;             \n                                           \nvoid main()                                \n{                                          \n    gl_FragColor \x3d  texture2D(CC_Texture0, v_texCoord);   \n}";cc.SHADER_POSITION_TEXTURE_VERT="                                                   \nattribute vec4 a_position;                   \nattribute vec2 a_texCoord;                  \n                                            \nvarying mediump vec2 v_texCoord;           \n                                           \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="                                                \nprecision lowp float;                        \n                                             \nuniform vec4 u_color;                        \nvarying vec2 v_texCoord;                     \n                                             \nuniform sampler2D CC_Texture0;               \n                                             \nvoid main()                                  \n{                                            \n    gl_FragColor \x3d  texture2D(CC_Texture0, v_texCoord) * u_color;    \n}";
cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT="                                               \nattribute vec4 a_position;                   \nattribute vec2 a_texCoord;                   \n                                             \nvarying mediump vec2 v_texCoord;             \n                                             \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="                                               \nprecision lowp float;                        \n                                             \nvarying vec4 v_fragmentColor;                \nvarying vec2 v_texCoord;                     \nuniform sampler2D CC_Texture0;                 \n                                             \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="                                               \nattribute vec4 a_position;                   \nattribute vec2 a_texCoord;                   \nattribute vec4 a_color;                      \n                                             \nvarying lowp vec4 v_fragmentColor;           \nvarying mediump vec2 v_texCoord;             \n                                             \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="                                               \nprecision lowp float;                        \n                                             \nvarying vec4 v_fragmentColor;                \nvarying vec2 v_texCoord;                     \nuniform sampler2D CC_Texture0;               \n                                             \nvoid main()                                  \n{                                            \n    gl_FragColor \x3d v_fragmentColor * texture2D(CC_Texture0, v_texCoord);         \n}";
cc.SHADER_POSITION_TEXTURE_COLOR_VERT="                                               \nattribute vec4 a_position;                   \nattribute vec2 a_texCoord;                   \nattribute vec4 a_color;                      \n                                             \nvarying lowp vec4 v_fragmentColor;           \nvarying mediump vec2 v_texCoord;             \n                                             \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="                                                  \nprecision lowp float;                           \n                                                \nvarying vec4 v_fragmentColor;                   \nvarying vec2 v_texCoord;                        \nuniform sampler2D CC_Texture0;                  \nuniform float CC_alpha_value;                   \n                                                \nvoid main()                                     \n{                                               \n    vec4 texColor \x3d texture2D(CC_Texture0, v_texCoord);          \n                                                \n    // mimic: glAlphaFunc(GL_GREATER)           \n    //pass if ( incoming_pixel \x3e\x3d CC_alpha_value ) \x3d\x3e fail if incoming_pixel \x3c CC_alpha_value         \n                                                \n    if ( texColor.a \x3c\x3d CC_alpha_value )          \n        discard;                                \n                                                \n    gl_FragColor \x3d texColor * v_fragmentColor;  \n}";
cc.SHADEREX_SWITCHMASK_FRAG="                                                   \nprecision lowp float;                            \n                                                 \nvarying vec4 v_fragmentColor;                    \nvarying vec2 v_texCoord;                         \nuniform sampler2D u_texture;                     \nuniform sampler2D   u_mask;                      \n                                                 \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.SHADERTYPE_POSITION_TEXTURECOLOR=0;cc.SHADERTYPE_POSITION_TEXTURECOLOR_ALPHATEST=1;cc.SHADERTYPE_POSITION_COLOR=2;cc.SHADERTYPE_POSITION_TEXTURE=3;cc.SHADERTYPE_POSITION_TEXTURE_UCOLOR=4;cc.SHADERTYPE_POSITION_TEXTURE_A8COLOR=5;cc.SHADERTYPE_POSITION_UCOLOR=6;cc.SHADERTYPE_POSITION_LENGTH_TEXTURECOLOR=7;cc.SHADERTYPE_MAX=8;cc._sharedShaderCache=null;
cc.ShaderCache=cc.Class.extend({_programs:null,_init:function(){this.loadDefaultShaders();return!0},_loadDefaultShader:function(a,c){switch(c){case cc.SHADERTYPE_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;
case cc.SHADERTYPE_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 cc.SHADERTYPE_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_VERT,cc.SHADER_POSITION_COLOR_FRAG);
a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADERTYPE_POSITION_TEXTURE:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_VERT,cc.SHADER_POSITION_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADERTYPE_POSITION_TEXTURE_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT,
cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADERTYPE_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 cc.SHADERTYPE_POSITION_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_UCOLOR_VERT,cc.SHADER_POSITION_UCOLOR_FRAG);a.addAttribute("aVertex",cc.VERTEX_ATTRIB_POSITION);break;case cc.SHADERTYPE_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()},ctor:function(){this._programs={}},loadDefaultShaders:function(){var a=new cc.GLProgram;this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_TEXTURECOLOR);this._programs[cc.SHADER_POSITION_TEXTURECOLOR]=a;this._programs.ShaderPositionTextureColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,
cc.SHADERTYPE_POSITION_TEXTURECOLOR_ALPHATEST);this._programs[cc.SHADER_POSITION_TEXTURECOLORALPHATEST]=a;this._programs.ShaderPositionTextureColorAlphaTest=a;a=new cc.GLProgram;this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_COLOR);this._programs[cc.SHADER_POSITION_COLOR]=a;this._programs.ShaderPositionColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_TEXTURE);this._programs[cc.SHADER_POSITION_TEXTURE]=a;this._programs.ShaderPositionTexture=a;a=new cc.GLProgram;this._loadDefaultShader(a,
cc.SHADERTYPE_POSITION_TEXTURE_UCOLOR);this._programs[cc.SHADER_POSITION_TEXTURE_UCOLOR]=a;this._programs.ShaderPositionTextureUColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_TEXTURE_A8COLOR);this._programs[cc.SHADER_POSITION_TEXTUREA8COLOR]=a;this._programs.ShaderPositionTextureA8Color=a;a=new cc.GLProgram;this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_UCOLOR);this._programs[cc.SHADER_POSITION_UCOLOR]=a;this._programs.ShaderPositionUColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,
cc.SHADERTYPE_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,cc.SHADERTYPE_POSITION_TEXTURECOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST);a.reset();this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_TEXTURECOLOR_ALPHATEST);a=this.programForKey(cc.SHADER_POSITION_COLOR);
a.reset();this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_COLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURE);a.reset();this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_TEXTURE);a=this.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);a.reset();this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_TEXTURE_UCOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTUREA8COLOR);a.reset();this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_TEXTURE_A8COLOR);a=this.programForKey(cc.SHADER_POSITION_UCOLOR);a.reset();
this._loadDefaultShader(a,cc.SHADERTYPE_POSITION_UCOLOR)},programForKey:function(a){return this._programs[a]},getProgram:function(a){return this._programs[a]},addProgram:function(a,c){this._programs[c]=a}});cc.ShaderCache.getInstance=function(){cc._sharedShaderCache||(cc._sharedShaderCache=new cc.ShaderCache,cc._sharedShaderCache._init());return cc._sharedShaderCache};cc.ShaderCache.purgeSharedShaderCache=function(){cc._sharedShaderCache=null};cc.VERTEX_ATTRIB_POSITION=0;cc.VERTEX_ATTRIB_COLOR=1;cc.VERTEX_ATTRIB_TEX_COORDS=2;cc.VERTEX_ATTRIB_MAX=3;cc.UNIFORM_PMATRIX=0;cc.UNIFORM_MVMATRIX=1;cc.UNIFORM_MVPMATRIX=2;cc.UNIFORM_TIME=3;cc.UNIFORM_SINTIME=4;cc.UNIFORM_COSTIME=5;cc.UNIFORM_RANDOM01=6;cc.UNIFORM_SAMPLER=7;cc.UNIFORM_MAX=8;cc.SHADER_POSITION_TEXTURECOLOR="ShaderPositionTextureColor";cc.SHADER_POSITION_TEXTURECOLORALPHATEST="ShaderPositionTextureColorAlphaTest";cc.SHADER_POSITION_COLOR="ShaderPositionColor";
cc.SHADER_POSITION_TEXTURE="ShaderPositionTexture";cc.SHADER_POSITION_TEXTURE_UCOLOR="ShaderPositionTexture_uColor";cc.SHADER_POSITION_TEXTUREA8COLOR="ShaderPositionTextureA8Color";cc.SHADER_POSITION_UCOLOR="ShaderPosition_uColor";cc.SHADER_POSITION_LENGTHTEXTURECOLOR="ShaderPositionLengthTextureColor";cc.UNIFORM_PMATRIX_S="CC_PMatrix";cc.UNIFORM_MVMATRIX_S="CC_MVMatrix";cc.UNIFORM_MVPMATRIX_S="CC_MVPMatrix";cc.UNIFORM_TIME_S="CC_Time";cc.UNIFORM_SINTIME_S="CC_SinTime";cc.UNIFORM_COSTIME_S="CC_CosTime";
cc.UNIFORM_RANDOM01_S="CC_Random01";cc.UNIFORM_SAMPLER_S="CC_Texture0";cc.UNIFORM_ALPHA_TEST_VALUE_S="CC_alpha_value";cc.ATTRIBUTE_NAME_COLOR="a_color";cc.ATTRIBUTE_NAME_POSITION="a_position";cc.ATTRIBUTE_NAME_TEX_COORD="a_texCoord";cc.HashUniformEntry=function(a,c,d){this.value=a;this.location=c;this.hh=d||{}};
cc.GLProgram=cc.Class.extend({_glContext:null,_programObj:null,_vertShader:null,_fragShader:null,_uniforms:null,_hashForUniforms:null,_usesTime:!1,_updateUniformLocation:function(a,c,d){if(null==a)return!1;d=!0;for(var e=null,f=0;f<this._hashForUniforms.length;f++)this._hashForUniforms[f].location==a&&(e=this._hashForUniforms[f]);e?e.value==c?d=!1:e.value=c:(e=new cc.HashUniformEntry,e.location=a,e.value=c,this._hashForUniforms.push(e));return d},_description:function(){return"\x3cCCGLProgram \x3d "+
this.toString()+" | Program \x3d "+this._programObj.toString()+", VertexShader \x3d "+this._vertShader.toString()+", FragmentShader \x3d "+this._fragShader.toString()+"\x3e"},_compileShader:function(a,c,d){if(!d||!a)return!1;this._glContext.shaderSource(a,"precision highp float;        \nuniform mat4 CC_PMatrix;         \nuniform mat4 CC_MVMatrix;        \nuniform mat4 CC_MVPMatrix;       \nuniform vec4 CC_Time;            \nuniform vec4 CC_SinTime;         \nuniform vec4 CC_CosTime;         \nuniform vec4 CC_Random01;        \n//CC INCLUDES END                \n  \n"+
d);this._glContext.compileShader(a);d=this._glContext.getShaderParameter(a,this._glContext.COMPILE_STATUS);d||(cc.log("cocos2d: ERROR: Failed to compile shader:\n"+this._glContext.getShaderSource(a)),c==this._glContext.VERTEX_SHADER?cc.log("cocos2d: \n"+this.vertexShaderLog()):cc.log("cocos2d: \n"+this.fragmentShaderLog()));return 1==d},ctor:function(a){this._fragShader=this._vertShader=this._programObj=null;this._uniforms=[];this._hashForUniforms=[];this._glContext=a||cc.renderContext},destroyProgram:function(){this._hashForUniforms=
this._uniforms=this._fragShader=this._vertShader=null;this._glContext.deleteProgram(this._programObj)},initWithVertexShaderByteArray:function(a,c){var d=this._glContext;this._programObj=d.createProgram();this._fragShader=this._vertShader=null;a&&(this._vertShader=d.createShader(d.VERTEX_SHADER),this._compileShader(this._vertShader,d.VERTEX_SHADER,a)||cc.log("cocos2d: ERROR: Failed to compile vertex shader"));c&&(this._fragShader=d.createShader(d.FRAGMENT_SHADER),this._compileShader(this._fragShader,
d.FRAGMENT_SHADER,c)||cc.log("cocos2d: ERROR: Failed to compile fragment shader"));this._vertShader&&d.attachShader(this._programObj,this._vertShader);cc.CHECK_GL_ERROR_DEBUG();this._fragShader&&d.attachShader(this._programObj,this._fragShader);this._hashForUniforms.length=0;cc.CHECK_GL_ERROR_DEBUG();return!0},initWithString:function(a,c){return this.initWithVertexShaderByteArray(a,c)},initWithVertexShaderFilename:function(a,c){var d=cc.FileUtils.getInstance(),e=d.getTextFileData(a),d=d.getTextFileData(c);
return this.initWithVertexShaderByteArray(e,d)},init:function(a,c){return this.initWithVertexShaderFilename(a,c)},addAttribute:function(a,c){this._glContext.bindAttribLocation(this._programObj,c,a)},link:function(){if(!this._programObj)return cc.log("cc.GLProgram.link(): Cannot link invalid program"),!1;this._glContext.linkProgram(this._programObj);this._vertShader&&this._glContext.deleteShader(this._vertShader);this._fragShader&&this._glContext.deleteShader(this._fragShader);this._fragShader=this._vertShader=
null;return cc.COCOS2D_DEBUG&&!this._glContext.getProgramParameter(this._programObj,this._glContext.LINK_STATUS)?(cc.log("cocos2d: ERROR: Failed to link program: "+this._glContext.getProgramInfoLog(this._programObj)),cc.glDeleteProgram(this._programObj),this._programObj=null,!1):!0},use:function(){cc.glUseProgram(this._programObj)},updateUniforms:function(){this._uniforms[cc.UNIFORM_PMATRIX]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_PMATRIX_S);this._uniforms[cc.UNIFORM_MVMATRIX]=
this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_MVMATRIX_S);this._uniforms[cc.UNIFORM_MVPMATRIX]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_MVPMATRIX_S);this._uniforms[cc.UNIFORM_TIME]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_TIME_S);this._uniforms[cc.UNIFORM_SINTIME]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_SINTIME_S);this._uniforms[cc.UNIFORM_COSTIME]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_COSTIME_S);
this._usesTime=null!=this._uniforms[cc.UNIFORM_TIME]||null!=this._uniforms[cc.UNIFORM_SINTIME]||null!=this._uniforms[cc.UNIFORM_COSTIME];this._uniforms[cc.UNIFORM_RANDOM01]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_RANDOM01_S);this._uniforms[cc.UNIFORM_SAMPLER]=this._glContext.getUniformLocation(this._programObj,cc.UNIFORM_SAMPLER_S);this.use();this.setUniformLocationWith1i(this._uniforms[cc.UNIFORM_SAMPLER],0)},getUniformLocationForName:function(a){if(!a)throw"cc.GLProgram.getUniformLocationForName(): uniform name should be non-null";
if(!this._programObj)throw"cc.GLProgram.getUniformLocationForName(): Invalid operation. Cannot get uniform location when program is not initialized";return this._glContext.getUniformLocation(this._programObj,a)},getUniformMVPMatrix:function(){return this._uniforms[cc.UNIFORM_MVPMATRIX]},getUniformSampler:function(){return this._uniforms[cc.UNIFORM_SAMPLER]},setUniformLocationWith1i:function(a,c){this._updateUniformLocation(a,c)&&this._glContext.uniform1i(a,c)},setUniformLocationWith2i:function(a,
c,d){this._updateUniformLocation(a,[c,d])&&this._glContext.uniform2i(a,c,d)},setUniformLocationWith3i:function(a,c,d,e){this._updateUniformLocation(a,[c,d,e])&&this._glContext.uniform3i(a,c,d,e)},setUniformLocationWith4i:function(a,c,d,e,f){this._updateUniformLocation(a,[c,d,e,f])&&this._glContext.uniform4i(a,c,d,e,f)},setUniformLocationWith2iv:function(a,c,d){this._updateUniformLocation(a,c)&&this._glContext.uniform2iv(a,c)},setUniformLocationWith3iv:function(a,c,d){this._updateUniformLocation(a,
c)&&this._glContext.uniform3iv(a,c)},setUniformLocationWith4iv:function(a,c,d){this._updateUniformLocation(a,c)&&this._glContext.uniform4iv(a,c)},setUniformLocationI32:function(a,c){this.setUniformLocationWith1i(a,c)},setUniformLocationWith1f:function(a,c){this._updateUniformLocation(a,c)&&this._glContext.uniform1f(a,c)},setUniformLocationWith2f:function(a,c,d){this._updateUniformLocation(a,[c,d])&&this._glContext.uniform2f(a,c,d)},setUniformLocationWith3f:function(a,c,d,e){this._updateUniformLocation(a,
[c,d,e])&&this._glContext.uniform3f(a,c,d,e)},setUniformLocationWith4f:function(a,c,d,e,f){this._updateUniformLocation(a,[c,d,e,f])&&this._glContext.uniform4f(a,c,d,e,f)},setUniformLocationWith2fv:function(a,c,d){this._updateUniformLocation(a,c)&&this._glContext.uniform2fv(a,c)},setUniformLocationWith3fv:function(a,c,d){this._updateUniformLocation(a,c)&&this._glContext.uniform3fv(a,c)},setUniformLocationWith4fv:function(a,c,d){this._updateUniformLocation(a,c)&&this._glContext.uniform4fv(a,c)},setUniformLocationWithMatrix4fv:function(a,
c,d){this._updateUniformLocation(a,c)&&this._glContext.uniformMatrix4fv(a,!1,c)},setUniformLocationF32:function(){if(!(2>arguments.length))switch(arguments.length){case 2:this.setUniformLocationWith1f(arguments[0],arguments[1]);break;case 3:this.setUniformLocationWith2f(arguments[0],arguments[1],arguments[2]);break;case 4:this.setUniformLocationWith3f(arguments[0],arguments[1],arguments[2],arguments[3]);break;case 5:this.setUniformLocationWith4f(arguments[0],arguments[1],arguments[2],arguments[3],
arguments[4])}},setUniformsForBuiltins:function(){var a=new cc.kmMat4,c=new cc.kmMat4,d=new cc.kmMat4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,a);cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,c);cc.kmMat4Multiply(d,a,c);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX],a.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX],c.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX],d.mat,1);this._usesTime&&(a=cc.Director.getInstance(),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)},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<this._hashForUniforms.length;a++)this._hashForUniforms[a].value=null,this._hashForUniforms[a]=null;this._hashForUniforms.length=0},getProgram:function(){return this._programObj},retain:function(){},release:function(){}});cc.GLProgram.create=function(a,c){var d=new cc.GLProgram;return d.init(a,c)?d:null};cc.VERTEX_ATTRIB_FLAG_NONE=0;cc.VERTEX_ATTRIB_FLAG_POSITION=1;cc.VERTEX_ATTRIB_FLAG_COLOR=2;cc.VERTEX_ATTRIB_FLAG_TEX_COORDS=4;cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX=cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_COLOR|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS;cc.GL_ALL=0;cc._currentProjectionMatrix=-1;cc._vertexAttribPosition=!1;cc._vertexAttribColor=!1;cc._vertexAttribTexCoords=!1;
cc.ENABLE_GL_STATE_CACHE&&(cc.MAX_ACTIVETEXTURE=16,cc._currentShaderProgram=-1,cc._currentBoundTexture=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],cc._blendingSource=-1,cc._blendingDest=-1,cc._GLServerState=0,cc.TEXTURE_ATLAS_USE_VAO&&(cc._uVAO=0));
cc.glInvalidateStateCache=function(){cc.kmGLFreeAll();cc._currentProjectionMatrix=-1;cc._vertexAttribPosition=!1;cc._vertexAttribColor=!1;cc._vertexAttribTexCoords=!1;if(cc.ENABLE_GL_STATE_CACHE){cc._currentShaderProgram=-1;for(var a=0;a<cc.MAX_ACTIVETEXTURE;a++)cc._currentBoundTexture[a]=-1;cc._blendingSource=-1;cc._blendingDest=-1;cc._GLServerState=0}};cc.glUseProgram=function(a){a!==cc._currentShaderProgram&&(cc._currentShaderProgram=a,cc.renderContext.useProgram(a))};
cc.ENABLE_GL_STATE_CACHE||(cc.glUseProgram=function(a){cc.renderContext.useProgram(a)});cc.glDeleteProgram=function(a){cc.ENABLE_GL_STATE_CACHE&&a===cc._currentShaderProgram&&(cc._currentShaderProgram=-1);gl.deleteProgram(a)};cc.glBlendFunc=function(a,c){if(a!==cc._blendingSource||c!==cc._blendingDest)cc._blendingSource=a,cc._blendingDest=c,cc.setBlending(a,c)};
cc.setBlending=function(a,c){var d=cc.renderContext;a===d.ONE&&c===d.ZERO?d.disable(d.BLEND):(d.enable(d.BLEND),cc.renderContext.blendFunc(a,c))};cc.glBlendFuncForParticle=function(a,c){if(a!==cc._blendingSource||c!==cc._blendingDest){cc._blendingSource=a;cc._blendingDest=c;var d=cc.renderContext;a===d.ONE&&c===d.ZERO?d.disable(d.BLEND):(d.enable(d.BLEND),d.blendFuncSeparate(d.SRC_ALPHA,c,a,c))}};cc.ENABLE_GL_STATE_CACHE||(cc.glBlendFunc=cc.setBlending);
cc.glBlendResetToCache=function(){var a=cc.renderContext;a.blendEquation(a.FUNC_ADD);cc.ENABLE_GL_STATE_CACHE?cc.setBlending(cc._blendingSource,cc._blendingDest):cc.setBlending(a.BLEND_SRC,a.BLEND_DST)};cc.setProjectionMatrixDirty=function(){cc._currentProjectionMatrix=-1};
cc.glEnableVertexAttribs=function(a){var c=cc.renderContext,d=a&cc.VERTEX_ATTRIB_FLAG_POSITION;d!==cc._vertexAttribPosition&&(d?c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION):c.disableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION),cc._vertexAttribPosition=d);d=a&cc.VERTEX_ATTRIB_FLAG_COLOR;d!==cc._vertexAttribColor&&(d?c.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR):c.disableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR),cc._vertexAttribColor=d);a&=cc.VERTEX_ATTRIB_FLAG_TEX_COORDS;a!==cc._vertexAttribTexCoords&&
(a?c.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS):c.disableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS),cc._vertexAttribTexCoords=a)};cc.glBindTexture2D=function(a){cc.glBindTexture2DN(0,a)};cc.glBindTexture2DN=function(a,c){if(cc._currentBoundTexture[a]!=c){cc._currentBoundTexture[a]=c;var d=cc.renderContext;d.activeTexture(d.TEXTURE0+a);c?d.bindTexture(d.TEXTURE_2D,c._webTextureObj):d.bindTexture(d.TEXTURE_2D,null)}};
cc.ENABLE_GL_STATE_CACHE||(cc.glBindTexture2DN=function(a,c){var d=cc.renderContext;d.activeTexture(d.TEXTURE0+a);c?d.bindTexture(d.TEXTURE_2D,c._webTextureObj):d.bindTexture(d.TEXTURE_2D,null)});cc.glDeleteTexture=function(a){cc.glDeleteTextureN(0,a)};cc.glDeleteTextureN=function(a,c){cc.ENABLE_GL_STATE_CACHE&&c==cc._currentBoundTexture[a]&&(cc._currentBoundTexture[a]=-1);cc.renderContext.deleteTexture(c)};
cc.glBindVAO=function(a){cc.TEXTURE_ATLAS_USE_VAO&&cc.ENABLE_GL_STATE_CACHE&&cc._uVAO!=a&&(cc._uVAO=a)};cc.glEnable=function(a){};cc.IMAGE_FORMAT_JPEG=0;cc.IMAGE_FORMAT_PNG=1;cc.IMAGE_FORMAT_RAWDATA=2;cc.NextPOT=function(a){a-=1;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;return(a|a>>16)+1};
cc.RenderTexture=cc.Node.extend({_cacheCanvas:null,_cacheContext:null,_fBO:0,_depthRenderBuffer:0,_oldFBO:0,_texture:null,_textureCopy:null,_uITextureImage:null,_pixelFormat:cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888,_sprite:null,_clearFlags:0,_clearColor:null,_clearDepth:0,_clearStencil:0,_autoDraw:!1,_clearColorStr:null,ctor:null,_ctorForCanvas:function(){cc.Node.prototype.ctor.call(this);this._clearColor=cc.c4f(1,1,1,1);this._clearColorStr="rgba(255,255,255,1)";this._cacheCanvas=document.createElement("canvas");
this._cacheContext=this._cacheCanvas.getContext("2d");this.setAnchorPoint(0,0)},_ctorForWebGL:function(){cc.Node.prototype.ctor.call(this);this._clearColor=cc.c4f(0,0,0,0)},cleanup:null,_cleanupForCanvas:function(){cc.Node.prototype.onExit.call(this);this._cacheCanvas=this._cacheContext=null},_cleanupForWebGL:function(){cc.Node.prototype.onExit.call(this);this._textureCopy=null;var a=cc.renderContext;a.deleteFramebuffer(this._fBO);this._depthRenderBuffer&&a.deleteRenderbuffer(this._depthRenderBuffer);
this._uITextureImage=null},getSprite:function(){return this._sprite},setSprite:function(a){this._sprite=a},initWithWidthAndHeight:null,_initWithWidthAndHeightForCanvas:function(a,c,d,e){d=this._cacheCanvas;e=cc.CONTENT_SCALE_FACTOR();d.width=0|a*e;d.height=0|c*e;this._cacheContext.translate(0,d.height);a=new cc.Texture2D;a.initWithElement(d);a.handleLoadedTexture();this._sprite=cc.Sprite.createWithTexture(a);return!0},_initWithWidthAndHeightForWebGL:function(a,c,d,e){d==cc.TEXTURE_2D_PIXEL_FORMAT_A8&&
cc.log("cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;");var f=cc.renderContext,g=cc.CONTENT_SCALE_FACTOR();a=0|a*g;c=0|c*g;this._oldFBO=f.getParameter(f.FRAMEBUFFER_BINDING);var h;cc.Configuration.getInstance().supportsNPOT()?(g=a,h=c):(g=cc.NextPOT(a),h=cc.NextPOT(c));for(var k=new Uint8Array(g*h*4),m=0;m<g*h*4;m++)k[m]=0;this._pixelFormat=d;this._texture=new cc.Texture2D;if(!this._texture)return!1;m=this._texture;m.initWithData(k,
this._pixelFormat,g,h,cc.size(a,c));d=f.getParameter(f.RENDERBUFFER_BINDING);if(cc.Configuration.getInstance().checkForGLExtension("GL_QCOM")){this._textureCopy=new cc.Texture2D;if(!this._textureCopy)return!1;this._textureCopy.initWithData(k,this._pixelFormat,g,h,cc.size(a,c))}this._fBO=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,this._fBO);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,m._webTextureObj,0);0!=e&&(this._depthRenderBuffer=f.createRenderbuffer(),f.bindRenderbuffer(f.RENDERBUFFER,
this._depthRenderBuffer),f.renderbufferStorage(f.RENDERBUFFER,e,g,h),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,this._depthRenderBuffer));f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE&&cc.log("Could not attach texture to the framebuffer");m.setAliasTexParameters();a=this._sprite=cc.Sprite.createWithTexture(m);a.setScaleY(-1);a.setBlendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.bindRenderbuffer(f.RENDERBUFFER,d);f.bindFramebuffer(f.FRAMEBUFFER,this._oldFBO);
this._autoDraw=!1;this.addChild(a);return!0},begin:null,_beginForCanvas:function(){cc.renderContext=this._cacheContext;cc.EGLView.getInstance()._setScaleXYForRenderTexture()},_beginForWebGL:function(){cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPushMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLPushMatrix();var a=cc.Director.getInstance();a.setProjection(a.getProjection());var c=this._texture.getContentSizeInPixels(),d=cc.Director.getInstance().getWinSizeInPixels(),a=d.width/c.width,d=d.height/
c.height,e=cc.renderContext;e.viewport(0,0,c.width,c.height);c=new cc.kmMat4;cc.kmMat4OrthographicProjection(c,-1/a,1/a,-1/d,1/d,-1,1);cc.kmGLMultMatrix(c);this._oldFBO=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,this._fBO);cc.Configuration.getInstance().checkForGLExtension("GL_QCOM")&&(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._textureCopy._webTextureObj,0),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),e.framebufferTexture2D(e.FRAMEBUFFER,
e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._texture._webTextureObj,0))},beginWithClear:function(a,c,d,e,f,g){var h=cc.renderContext;f=f||h.COLOR_BUFFER_BIT;g=g||h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT;this._beginWithClear(a,c,d,e,f,g,h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)},_beginWithClear:null,_beginWithClearForCanvas:function(a,c,d,e,f,g,h){this.begin();a=a||0;c=c||0;d=d||0;e=isNaN(e)?1:e;f=this._cacheContext;g=this._cacheCanvas;f.save();f.fillStyle="rgba("+(0|255*a)+","+(0|255*c)+
","+(0|255*d)+","+e+")";f.clearRect(0,0,g.width,-g.height);f.fillRect(0,0,g.width,-g.height);f.restore()},_beginWithClearForWebGL:function(a,c,d,e,f,g,h){this.begin();var k=cc.renderContext,m=[0,0,0,0],n=0,p=0;h&k.COLOR_BUFFER_BIT&&(m=k.getParameter(k.COLOR_CLEAR_VALUE),k.clearColor(a,c,d,e));h&k.DEPTH_BUFFER_BIT&&(n=k.getParameter(k.DEPTH_CLEAR_VALUE),k.clearDepth(f));h&k.STENCIL_BUFFER_BIT&&(p=k.getParameter(k.STENCIL_CLEAR_VALUE),k.clearStencil(g));k.clear(h);h&k.COLOR_BUFFER_BIT&&k.clearColor(m[0],
m[1],m[2],m[3]);h&k.DEPTH_BUFFER_BIT&&k.clearDepth(n);h&k.STENCIL_BUFFER_BIT&&k.clearStencil(p)},end:null,_endForCanvas:function(){cc.renderContext=cc.mainRenderContextBackup;cc.EGLView.getInstance()._resetScale()},_endForWebGL:function(){var a=cc.renderContext,c=cc.Director.getInstance();a.bindFramebuffer(a.FRAMEBUFFER,this._oldFBO);c.setViewport();cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPopMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLPopMatrix()},clear:function(a,c,d,e){this.beginWithClear(a,
c,d,e);this.end()},clearRect:null,_clearRectForCanvas:function(a,c,d,e){this._cacheContext.clearRect(a,c,d,-e)},_clearRectForWebGL:function(a,c,d,e){},clearDepth:null,_clearDepthForCanvas:function(a){cc.log("clearDepth isn't supported on Cocos2d-Html5")},_clearDepthForWebGL:function(a){this.begin();var c=cc.renderContext,d=c.getParameter(c.DEPTH_CLEAR_VALUE);c.clearDepth(a);c.clear(c.DEPTH_BUFFER_BIT);c.clearDepth(d);this.end()},clearStencil:null,_clearStencilForCanvas:function(a){cc.log("clearDepth isn't supported on Cocos2d-Html5")},
_clearStencilForWebGL:function(a){var c=cc.renderContext,d=c.getParameter(c.STENCIL_CLEAR_VALUE);c.clearStencil(a);c.clear(c.STENCIL_BUFFER_BIT);c.clearStencil(d)},visit:null,_visitForCanvas:function(a){this._visible&&(a=a||cc.renderContext,a.save(),this.draw(a),this.transform(a),this._sprite.visit(),a.restore(),this._orderOfArrival=0)},_visitForWebGL:function(a){if(this._visible){cc.kmGLPushMatrix();var c=this._grid;c&&c.isActive()&&(c.beforeDraw(),this.transformAncestors());this.transform(a);this._sprite.visit();
this.draw(a);c&&c.isActive()&&c.afterDraw(this);cc.kmGLPopMatrix();this._orderOfArrival=0}},draw:null,_drawForCanvas:function(a){a=a||cc.renderContext;if(this._autoDraw){this.begin();if(this._clearFlags){var c=this._cacheCanvas;a.save();a.fillStyle=this._clearColorStr;a.clearRect(0,0,c.width,-c.height);a.fillRect(0,0,c.width,-c.height);a.restore()}this.sortAllChildren();a=this._children;for(var c=a.length,d=this._sprite,e=0;e<c;e++){var f=a[e];f!=d&&f.visit()}this.end()}},_drawForWebGL:function(a){a=
cc.renderContext;if(this._autoDraw){this.begin();var c=this._clearFlags;if(c){var d=[0,0,0,0],e=0,f=0;c&a.COLOR_BUFFER_BIT&&(d=a.getParameter(a.COLOR_CLEAR_VALUE),a.clearColor(this._clearColor.r,this._clearColor.g,this._clearColor.b,this._clearColor.a));c&a.DEPTH_BUFFER_BIT&&(e=a.getParameter(a.DEPTH_CLEAR_VALUE),a.clearDepth(this._clearDepth));c&a.STENCIL_BUFFER_BIT&&(f=a.getParameter(a.STENCIL_CLEAR_VALUE),a.clearStencil(this._clearStencil));a.clear(c);c&a.COLOR_BUFFER_BIT&&a.clearColor(d[0],d[1],
d[2],d[3]);c&a.DEPTH_BUFFER_BIT&&a.clearDepth(e);c&a.STENCIL_BUFFER_BIT&&a.clearStencil(f)}this.sortAllChildren();a=this._children;for(c=0;c<a.length;c++)d=a[c],d!=this._sprite&&d.visit();this.end()}},newCCImage:null,_newCCImageForCanvas:function(a){cc.log("saveToFile isn't supported on Cocos2d-Html5");return null},_newCCImageForWebGL:function(a){cc.log("saveToFile isn't supported on Cocos2d-Html5");cc.Assert(this._pixelFormat==cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888,"only RGBA8888 can be saved as image");
if(!this._texture)return null;var c=this._texture.getContentSizeInPixels();a=c.width;var c=c.height,d=new cc.Image,e=cc.renderContext,f=new Uint8Array(a*c*4);if(!f)return d;var g=new Uint8Array(a*c*4);if(!g)return null;this.begin();e.pixelStorei(e.PACK_ALIGNMENT,1);e.readPixels(0,0,a,c,e.RGBA,e.UNSIGNED_BYTE,g);this.end();for(e=0;e<c;++e)this._memcpy(f,e*a*4,g,(c-e-1)*a*4,4*a);d.initWithImageData(f,a*c*4,cc.FMT_RAWDATA,a,c,8);return d},_memcpy:function(a,c,d,e,f){for(var g=0;g<f;g++)a[c+g]=d[e+g]},
saveToFile:function(a,c){cc.log("saveToFile isn't supported on Cocos2d-Html5")},listenToBackground:function(a){cc.log("listenToBackground isn't supported on Cocos2d-Html5")},listenToForeground:function(a){cc.log("listenToForeground isn't supported on Cocos2d-Html5")},getClearFlags:function(){return this._clearFlags},setClearFlags:function(a){this._clearFlags=a},getClearColor:function(){return this._clearColor},setClearColor:null,_setClearColorForCanvas:function(a){var c=this._clearColor;c.r=a.r;c.g=
a.g;c.b=a.b;c.a=a.a;this._clearColorStr="rgba("+(0|255*a.r)+","+(0|255*a.g)+","+(0|255*a.b)+","+a.a+")"},_setClearColorForWebGL:function(a){var c=this._clearColor;c.r=a.r;c.g=a.g;c.b=a.b;c.a=a.a},getClearDepth:function(){return this._clearDepth},setClearDepth:function(a){this._clearDepth=a},getClearStencil:function(){return this._clearStencil},setClearStencil:function(a){this._clearStencil=a},isAutoDraw:function(){return this._autoDraw},setAutoDraw:function(a){this._autoDraw=a}});
cc.Browser.supportWebGL?(cc.RenderTexture.prototype.ctor=cc.RenderTexture.prototype._ctorForWebGL,cc.RenderTexture.prototype.cleanup=cc.RenderTexture.prototype._cleanupForWebGL,cc.RenderTexture.prototype.initWithWidthAndHeight=cc.RenderTexture.prototype._initWithWidthAndHeightForWebGL,cc.RenderTexture.prototype.begin=cc.RenderTexture.prototype._beginForWebGL,cc.RenderTexture.prototype._beginWithClear=cc.RenderTexture.prototype._beginWithClearForWebGL,cc.RenderTexture.prototype.end=cc.RenderTexture.prototype._endForWebGL,
cc.RenderTexture.prototype.clearRect=cc.RenderTexture.prototype._clearRectForWebGL,cc.RenderTexture.prototype.clearDepth=cc.RenderTexture.prototype._clearDepthForWebGL,cc.RenderTexture.prototype.clearStencil=cc.RenderTexture.prototype._clearStencilForWebGL,cc.RenderTexture.prototype.visit=cc.RenderTexture.prototype._visitForWebGL,cc.RenderTexture.prototype.draw=cc.RenderTexture.prototype._drawForWebGL,cc.RenderTexture.prototype.newCCImage=cc.RenderTexture.prototype._newCCImageForWebGL,cc.RenderTexture.prototype.setClearColor=
cc.RenderTexture.prototype._setClearColorForWebGL):(cc.RenderTexture.prototype.ctor=cc.RenderTexture.prototype._ctorForCanvas,cc.RenderTexture.prototype.cleanup=cc.RenderTexture.prototype._cleanupForCanvas,cc.RenderTexture.prototype.initWithWidthAndHeight=cc.RenderTexture.prototype._initWithWidthAndHeightForCanvas,cc.RenderTexture.prototype.begin=cc.RenderTexture.prototype._beginForCanvas,cc.RenderTexture.prototype._beginWithClear=cc.RenderTexture.prototype._beginWithClearForCanvas,cc.RenderTexture.prototype.end=
cc.RenderTexture.prototype._endForCanvas,cc.RenderTexture.prototype.clearRect=cc.RenderTexture.prototype._clearRectForCanvas,cc.RenderTexture.prototype.clearDepth=cc.RenderTexture.prototype._clearDepthForCanvas,cc.RenderTexture.prototype.clearStencil=cc.RenderTexture.prototype._clearStencilForCanvas,cc.RenderTexture.prototype.visit=cc.RenderTexture.prototype._visitForCanvas,cc.RenderTexture.prototype.draw=cc.RenderTexture.prototype._drawForCanvas,cc.RenderTexture.prototype.newCCImage=cc.RenderTexture.prototype._newCCImageForCanvas,
cc.RenderTexture.prototype.setClearColor=cc.RenderTexture.prototype._setClearColorForCanvas);cc.RenderTexture.create=function(a,c,d,e){d=d||cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888;e=e||0;var f=new cc.RenderTexture;return f&&f.initWithWidthAndHeight(a,c,d,e)?f:null};cc.MotionStreak=cc.NodeRGBA.extend({_fastMode:!1,_startingPositionInitialized:!1,_texture:null,_blendFunc:null,_positionR:null,_stroke:0,_fadeDelta:0,_minSeg:0,_maxPoints:0,_nuPoints:0,_previousNuPoints:0,_pointVertexes:null,_pointState:null,_vertices:null,_colorPointer:null,_texCoords:null,_verticesBuffer:null,_colorPointerBuffer:null,_texCoordsBuffer:null,ctor:function(){cc.NodeRGBA.prototype.ctor.call(this);this._positionR=cc.p(0,0);this._blendFunc=new cc.BlendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA);
this._vertexWebGLBuffer=cc.renderContext.createBuffer();this._startingPositionInitialized=this._fastMode=!1;this._texture=null;this._previousNuPoints=this._nuPoints=this._maxPoints=this._minSeg=this._fadeDelta=this._stroke=0;this._texCoordsBuffer=this._colorPointerBuffer=this._verticesBuffer=this._texCoords=this._colorPointer=this._vertices=this._pointState=this._pointVertexes=null},getTexture:function(){return this._texture},setTexture:function(a){this._texture!=a&&(this._texture=a)},getBlendFunc:function(){return this._blendFunc},
setBlendFunc:function(a,c){void 0===c?this._blendFunc=a:(this._blendFunc.src=a,this._blendFunc.dst=c)},getOpacity:function(){cc.log("cc.MotionStreak.getOpacity has not been supported.");return 0},setOpacity:function(a){cc.log("cc.MotionStreak.setOpacity has not been supported.")},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},onExit:function(){cc.Node.prototype.onExit.call(this);this._verticesBuffer&&cc.renderContext.deleteBuffer(this._verticesBuffer);this._texCoordsBuffer&&
cc.renderContext.deleteBuffer(this._texCoordsBuffer);this._colorPointerBuffer&&cc.renderContext.deleteBuffer(this._colorPointerBuffer)},isFastMode:function(){return this._fastMode},setFastMode:function(a){this._fastMode=a},isStartingPositionInitialized:function(){return this._startingPositionInitialized},setStartingPositionInitialized:function(a){this._startingPositionInitialized=a},initWithFade:function(a,c,d,e,f){if(!f)throw"cc.MotionStreak.initWithFade(): Invalid filename or texture";"string"===
typeof f&&(f=cc.TextureCache.getInstance().addImage(f));cc.Node.prototype.setPosition.call(this,cc.PointZero());this.setAnchorPoint(0,0);this.ignoreAnchorPointForPosition(!0);this._startingPositionInitialized=!1;this._fastMode=!0;this._minSeg=-1==c?d/5:c;this._minSeg*=this._minSeg;this._stroke=d;this._fadeDelta=1/a;a=(0|60*a)+2;this._nuPoints=0;this._pointState=new Float32Array(a);this._pointVertexes=new Float32Array(2*a);this._vertices=new Float32Array(4*a);this._texCoords=new Float32Array(4*a);
this._colorPointer=new Uint8Array(8*a);this._maxPoints=a;a=cc.renderContext;this._verticesBuffer=a.createBuffer();this._texCoordsBuffer=a.createBuffer();this._colorPointerBuffer=a.createBuffer();this._blendFunc.src=a.SRC_ALPHA;this._blendFunc.dst=a.ONE_MINUS_SRC_ALPHA;this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR));this.setTexture(f);this.setColor(e);this.scheduleUpdate();a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,
this._vertices,a.DYNAMIC_DRAW);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordsBuffer);a.bufferData(a.ARRAY_BUFFER,this._texCoords,a.DYNAMIC_DRAW);a.bindBuffer(a.ARRAY_BUFFER,this._colorPointerBuffer);a.bufferData(a.ARRAY_BUFFER,this._colorPointer,a.DYNAMIC_DRAW);return!0},tintWithColor:function(a){this.setColor(a);for(var c=this._colorPointer,d=0,e=2*this._nuPoints;d<e;d++)c[4*d]=a.r,c[4*d+1]=a.g,c[4*d+2]=a.b},reset:function(){this._nuPoints=0},setPosition:function(a,c){this._startingPositionInitialized=
!0;void 0===c?(this._positionR.x=a.x,this._positionR.y=a.y):(this._positionR.x=a,this._positionR.y=c)},draw:function(a){1>=this._nuPoints||!this._texture||!this._texture.isLoaded()||(a=a||cc.renderContext,cc.NODE_DRAW_SETUP(this),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX),cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst),cc.glBindTexture2D(this._texture),a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer),a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW),a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,
2,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,this._texCoordsBuffer),a.bufferData(a.ARRAY_BUFFER,this._texCoords,a.DYNAMIC_DRAW),a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,this._colorPointerBuffer),a.bufferData(a.ARRAY_BUFFER,this._colorPointer,a.DYNAMIC_DRAW),a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,0,0),a.drawArrays(a.TRIANGLE_STRIP,0,2*this._nuPoints),cc.g_NumberOfDraws++)},update:function(a){if(this._startingPositionInitialized){a*=
this._fadeDelta;var c,d,e,f,g=0,h=this._nuPoints,k=this._pointState,m=this._pointVertexes,n=this._vertices,p=this._colorPointer;for(e=0;e<h;e++)k[e]-=a,0>=k[e]?g++:(c=e-g,0<g?(k[c]=k[e],m[2*c]=m[2*e],m[2*c+1]=m[2*e+1],f=2*e,d=2*c,n[2*d]=n[2*f],n[2*d+1]=n[2*f+1],n[2*(d+1)]=n[2*(f+1)],n[2*(d+1)+1]=n[2*(f+1)+1],f*=4,d*=4,p[d+0]=p[f+0],p[d+1]=p[f+1],p[d+2]=p[f+2],p[d+4]=p[f+4],p[d+5]=p[f+5],p[d+6]=p[f+6]):d=8*c,c=255*k[c],p[d+3]=c,p[d+7]=c);h-=g;e=!0;h>=this._maxPoints?e=!1:0<h&&(a=cc.pDistanceSQ(cc.p(m[2*
(h-1)],m[2*(h-1)+1]),this._positionR)<this._minSeg,d=1==h?!1:cc.pDistanceSQ(cc.p(m[2*(h-2)],m[2*(h-2)+1]),this._positionR)<2*this._minSeg,a||d)&&(e=!1);e&&(m[2*h]=this._positionR.x,m[2*h+1]=this._positionR.y,k[h]=1,k=8*h,e=this._displayedColor,p[k]=e.r,p[k+1]=e.g,p[k+2]=e.b,p[k+4]=e.r,p[k+5]=e.g,p[k+6]=e.b,p[k+3]=255,p[k+7]=255,0<h&&this._fastMode&&(1<h?cc.vertexLineToPolygon(m,this._stroke,this._vertices,h,1):cc.vertexLineToPolygon(m,this._stroke,this._vertices,0,2)),h++);this._fastMode||cc.vertexLineToPolygon(m,
this._stroke,this._vertices,0,h);if(h&&this._previousNuPoints!=h){m=1/h;p=this._texCoords;for(e=0;e<h;e++)p[4*e]=0,p[4*e+1]=m*e,p[2*(2*e+1)]=1,p[2*(2*e+1)+1]=m*e;this._previousNuPoints=h}this._nuPoints=h}}});cc.MotionStreak.create=function(a,c,d,e,f){var g=new cc.MotionStreak;return g&&g.initWithFade(a,c,d,e,f)?g:null};cc.stencilBits=-1;cc.setProgram=function(a,c){a.setShaderProgram(c);var d=a.getChildren();if(d)for(var e=0;e<d.length;e++)cc.setProgram(d[e],c)};
cc.ClippingNode=cc.Node.extend({_stencil:null,_alphaThreshold:0,_inverted:!1,_godhelpme:!1,ctor:function(){cc.Node.prototype.ctor.call(this);this._stencil=null;this._alphaThreshold=0;this._inverted=!1},init:null,_initForWebGL:function(a){this._stencil=a;this._alphaThreshold=1;this._inverted=!1;cc.ClippingNode._init_once=!0;cc.ClippingNode._init_once&&(cc.stencilBits=cc.renderContext.getParameter(cc.renderContext.STENCIL_BITS),0>=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),cc.ClippingNode._init_once=
!1);return!0},_initForCanvas:function(a){this._stencil=a;this._alphaThreshold=1;this._inverted=!1},onEnter:function(){cc.Node.prototype.onEnter.call(this);this._stencil.onEnter()},onEnterTransitionDidFinish:function(){cc.Node.prototype.onEnterTransitionDidFinish.call(this);this._stencil.onEnterTransitionDidFinish()},onExitTransitionDidStart:function(){this._stencil.onExitTransitionDidStart();cc.Node.prototype.onExitTransitionDidStart.call(this)},onExit:function(){this._stencil.onExit();cc.Node.prototype.onExit.call(this)},
visit:null,_visitForWebGL:function(a){var c=a||cc.renderContext;if(1>cc.stencilBits)cc.Node.prototype.visit.call(this,a);else if(this._stencil&&this._stencil.isVisible())if(cc.ClippingNode._layer=-1,cc.ClippingNode._layer+1==cc.stencilBits)cc.ClippingNode._visit_once=!0,cc.ClippingNode._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its childs."),cc.ClippingNode._visit_once=!1),cc.Node.prototype.visit.call(this,
a);else{cc.ClippingNode._layer++;var d=1<<cc.ClippingNode._layer,e=d|d-1,f=c.isEnabled(c.STENCIL_TEST),g=c.getParameter(c.STENCIL_WRITEMASK),h=c.getParameter(c.STENCIL_FUNC),k=c.getParameter(c.STENCIL_REF),m=c.getParameter(c.STENCIL_VALUE_MASK),n=c.getParameter(c.STENCIL_FAIL),p=c.getParameter(c.STENCIL_PASS_DEPTH_FAIL),q=c.getParameter(c.STENCIL_PASS_DEPTH_PASS);c.enable(c.STENCIL_TEST);c.stencilMask(d);var s=c.getParameter(c.DEPTH_WRITEMASK);c.depthMask(!1);c.stencilFunc(c.NEVER,d,d);c.stencilOp(this._inverted?
c.REPLACE:c.ZERO,c.KEEP,c.KEEP);cc.drawingUtil.drawSolidRect(cc.PointZero(),cc.pFromSize(cc.Director.getInstance().getWinSize()),cc.c4f(1,1,1,1));c.stencilFunc(c.NEVER,d,d);c.stencilOp(this._inverted?c.ZERO:c.REPLACE,c.KEEP,c.KEEP);if(1>this._alphaThreshold){var d=cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),r=c.getUniformLocation(d.getProgram(),cc.UNIFORM_ALPHA_TEST_VALUE_S);cc.glUseProgram(d.getProgram());d.setUniformLocationWith1f(r,this._alphaThreshold);
cc.setProgram(this._stencil,d)}cc.kmGLPushMatrix();this.transform();this._stencil.visit();cc.kmGLPopMatrix();c.depthMask(s);c.stencilFunc(c.EQUAL,e,e);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);cc.Node.prototype.visit.call(this,a);c.stencilFunc(h,k,m);c.stencilOp(n,p,q);c.stencilMask(g);f||c.disable(c.STENCIL_TEST);cc.ClippingNode._layer--}else this._inverted&&cc.Node.prototype.visit.call(this,a)},_visitForCanvas:function(a){if(this._stencil&&this._stencil.isVisible()){if(this._cangodhelpme()||this._stencil instanceof
cc.Sprite){a=a||cc.renderContext;var c=a.canvas,d=cc.ClippingNode._getSharedCache();d.width=c.width;d.height=c.height;d.getContext("2d").drawImage(c,0,0);a.save();this._super(a);a.globalCompositeOperation=this._inverted?"destination-out":"destination-in";this.transform(a);this._stencil.visit();a.restore();a.save();a.setTransform(1,0,0,1,0,0);a.globalCompositeOperation="destination-over";a.drawImage(d,0,0)}else{a=a||cc.renderContext;var d=this._children,e;a.save();this.transform(a);this._stencil.visit(a);
a.clip();this._cangodhelpme(!0);var f=d.length;if(0<f){this.sortAllChildren();for(c=0;c<f;c++)if(e=d[c],0>e._zOrder)e.visit(a);else break;for(this.draw(a);c<f;c++)d[c].visit(a)}else this.draw(a);this._cangodhelpme(!1)}a.restore()}else this._inverted&&cc.Node.prototype.visit.call(this,a)},getStencil:function(){return this._stencil},setStencil:null,_setStencilForWebGL:function(a){this._stencil=a},_setStencilForCanvas:function(a){this._stencil=a;var c=cc.EGLView.getInstance().getScaleX(),d=cc.EGLView.getInstance().getScaleY(),
e=cc.renderContext;!(a instanceof cc.Sprite)&&a instanceof cc.DrawNode&&(a.draw=function(){for(var f=0;f<a._buffer.length;f++){var g=a._buffer[f].verts,h=g[0];e.beginPath();e.moveTo(h.x*c,-h.y*d);for(var h=1,k=g.length;h<k;h++)e.lineTo(g[h].x*c,-g[h].y*d)}})},getAlphaThreshold:function(){return this._alphaThreshold},setAlphaThreshold:function(a){this._alphaThreshold=a},isInverted:function(){return this._inverted},setInverted:function(a){this._inverted=a},_cangodhelpme:function(a){if(!0===a||!1===
a)cc.ClippingNode.prototype._godhelpme=a;return cc.ClippingNode.prototype._godhelpme}});
cc.Browser.supportWebGL?(cc.ClippingNode.prototype.init=cc.ClippingNode.prototype._initForWebGL,cc.ClippingNode.prototype.visit=cc.ClippingNode.prototype._visitForWebGL,cc.ClippingNode.prototype.setStencil=cc.ClippingNode.prototype._setStencilForWebGL):(cc.ClippingNode.prototype.init=cc.ClippingNode.prototype._initForCanvas,cc.ClippingNode.prototype.visit=cc.ClippingNode.prototype._visitForCanvas,cc.ClippingNode.prototype.setStencil=cc.ClippingNode.prototype._setStencilForCanvas);
cc.ClippingNode._init_once=null;cc.ClippingNode._visit_once=null;cc.ClippingNode._layer=null;cc.ClippingNode._sharedCache=null;cc.ClippingNode._getSharedCache=function(){return cc.ClippingNode._sharedCache||(cc.ClippingNode._sharedCache=document.createElement("canvas"))};cc.ClippingNode.create=function(a){var c=new cc.ClippingNode;c.init(a);return c};cc.GridBase=cc.Class.extend({_active:!1,_reuseGrid:0,_gridSize:null,_texture:null,_step:null,_grabber:null,_isTextureFlipped:!1,_shaderProgram:null,_directorProjection:0,_dirty:!1,ctor:function(){this._active=!1;this._reuseGrid=0;this._texture=this._gridSize=null;this._step=cc.p(0,0);this._grabber=null;this._isTextureFlipped=!1;this._shaderProgram=null;this._directorProjection=0;this._dirty=!1},isActive:function(){return this._active},setActive:function(a){this._active=a;if(!a){a=cc.Director.getInstance();
var c=a.getProjection();a.setProjection(c)}},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)},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,c,d){if(!c){var e=cc.Director.getInstance().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;c=new cc.Texture2D;c.initWithData(h,cc.TEXTURE_2D_PIXEL_FORMAT_RGBA8888,f,g,e);if(!c)return cc.log("cocos2d: CCGrid: error creating texture"),!1}this._active=!1;this._reuseGrid=0;this._gridSize=a;this._texture=c;this._isTextureFlipped=
d||!1;c=this._texture.getContentSize();this._step.x=c.width/a.width;this._step.y=c.height/a.height;this._grabber=new cc.Grabber;if(!this._grabber)return!1;this._grabber.grab(this._texture);this._shaderProgram=cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURE);this.calculateVertexPoints();return!0},beforeDraw:function(){this._directorProjection=cc.Director.getInstance().getProjection();this.set2DProjection();this._grabber.beforeRender(this._texture)},afterDraw:function(a){this._grabber.afterRender(this._texture);
cc.Director.getInstance().setProjection(this._directorProjection);if(a.getCamera().isDirty()){var c=a.getAnchorPointInPoints();cc.kmGLTranslatef(c.x,c.y,0);a.getCamera().locate();cc.kmGLTranslatef(-c.x,-c.y,0)}cc.glBindTexture2D(this._texture);this.blit()},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.getInstance().getWinSizeInPixels();cc.renderContext.viewport(0,0,a.width,a.height);cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();var c=new cc.kmMat4;cc.kmMat4OrthographicProjection(c,0,a.width,0,a.height,-1,1);cc.kmGLMultMatrix(c);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();cc.setProjectionMatrixDirty()}});cc.GridBase.create=function(a,c,d){var e=new cc.GridBase;return e&&e.initWithSize(a,c,d)?e:null};
cc.Grid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,ctor:function(){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null},vertex: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 c=this._vertices;return new cc.Vertex3F(c[a],c[a+1],c[a+2])},originalVertex: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 c=this._originalVertices;return new cc.Vertex3F(c[a],c[a+1],c[a+2])},setVertex:function(a,c){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.setVertex() : Numbers must be integers");var d=0|3*(a.x*(this._gridSize.height+1)+a.y),e=this._vertices;e[d]=c.x;e[d+1]=
c.y;e[d+2]=c.z;this._dirty=!0},blit:function(){var a=this._gridSize.width*this._gridSize.height;cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS);this._shaderProgram.use();this._shaderProgram.setUniformsForBuiltins();var c=cc.renderContext,d=this._dirty;c.bindBuffer(c.ARRAY_BUFFER,this._verticesBuffer);d&&c.bufferData(c.ARRAY_BUFFER,this._vertices,c.DYNAMIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,this._texCoordinateBuffer);
d&&c.bufferData(c.ARRAY_BUFFER,this._texCoordinates,c.DYNAMIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);d&&c.bufferData(c.ELEMENT_ARRAY_BUFFER,this._indices,c.STATIC_DRAW);c.drawElements(c.TRIANGLES,6*a,c.UNSIGNED_SHORT,0);d&&(this._dirty=!1);cc.INCREMENT_GL_DRAWS(1)},reuse:function(){if(0<this._reuseGrid){for(var a=this._originalVertices,c=this._vertices,d=0,e=this._vertices.length;d<e;d++)a[d]=c[d];--this._reuseGrid}},
calculateVertexPoints:function(){var a=cc.renderContext,c=this._texture.getPixelsWide(),d=this._texture.getPixelsHigh(),e=this._texture.getContentSizeInPixels().height,f=this._gridSize,g=(f.width+1)*(f.height+1);this._vertices=new Float32Array(3*g);this._texCoordinates=new Float32Array(2*g);this._indices=new Uint16Array(f.width*f.height*6);this._verticesBuffer&&a.deleteBuffer(this._verticesBuffer);this._verticesBuffer=a.createBuffer();this._texCoordinateBuffer&&a.deleteBuffer(this._texCoordinateBuffer);
this._texCoordinateBuffer=a.createBuffer();this._indicesBuffer&&a.deleteBuffer(this._indicesBuffer);this._indicesBuffer=a.createBuffer();for(var h,k,m=this._indices,n=this._texCoordinates,p=this._isTextureFlipped,q=this._vertices,g=0;g<f.width;++g)for(h=0;h<f.height;++h){var s=h*f.width+g;k=g*this._step.x;var r=k+this._step.x,t=h*this._step.y,u=t+this._step.y,v=g*(f.height+1)+h,z=(g+1)*(f.height+1)+h,B=(g+1)*(f.height+1)+(h+1),E=g*(f.height+1)+(h+1);m[6*s]=v;m[6*s+1]=z;m[6*s+2]=E;m[6*s+3]=z;m[6*s+
4]=B;m[6*s+5]=E;var s=[3*v,3*z,3*B,3*E],x=[{x:k,y:t,z:0},{x:r,y:t,z:0},{x:r,y:u,z:0},{x:k,y:u,z:0}],v=[2*v,2*z,2*B,2*E],r=[cc.p(k,t),cc.p(r,t),cc.p(r,u),cc.p(k,u)];for(k=0;4>k;++k)q[s[k]]=x[k].x,q[s[k]+1]=x[k].y,q[s[k]+2]=x[k].z,n[v[k]]=r[k].x/c,n[v[k]+1]=p?(e-r[k].y)/d:r[k].y/d}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}});cc.Grid3D.create=function(a,c,d){var e=new cc.Grid3D;return e&&e.initWithSize(a,c,d)?e:null};
cc.TiledGrid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,ctor:function(){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null},tile: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 c=this._vertices;return new cc.Quad3(new cc.Vertex3F(c[a],c[a+1],c[a+2]),new cc.Vertex3F(c[a+3],c[a+4],c[a+5]),new cc.Vertex3F(c[a+6],c[a+7],c[a+8]),new cc.Vertex3F(c[a+9],c[a+10],c[a+11]))},originalTile: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 c=this._originalVertices;return new cc.Quad3(new cc.Vertex3F(c[a],c[a+1],c[a+2]),new cc.Vertex3F(c[a+3],c[a+4],c[a+5]),new cc.Vertex3F(c[a+
6],c[a+7],c[a+8]),new cc.Vertex3F(c[a+9],c[a+10],c[a+11]))},setTile:function(a,c){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.setTile() : Numbers must be integers");var d=12*(this._gridSize.height*a.x+a.y),e=this._vertices;e[d]=c.bl.x;e[d+1]=c.bl.y;e[d+2]=c.bl.z;e[d+3]=c.br.x;e[d+4]=c.br.y;e[d+5]=c.br.z;e[d+6]=c.tl.x;e[d+7]=c.tl.y;e[d+8]=c.tl.z;e[d+9]=c.tr.x;e[d+10]=c.tr.y;e[d+11]=c.tr.z;this._dirty=!0},blit:function(){var a=this._gridSize.width*this._gridSize.height;this._shaderProgram.use();
this._shaderProgram.setUniformsForBuiltins();var c=cc.renderContext,d=this._dirty;cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS);c.bindBuffer(c.ARRAY_BUFFER,this._verticesBuffer);d&&c.bufferData(c.ARRAY_BUFFER,this._vertices,c.DYNAMIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,c.FLOAT,!1,0,this._vertices);c.bindBuffer(c.ARRAY_BUFFER,this._texCoordinateBuffer);d&&c.bufferData(c.ARRAY_BUFFER,this._texCoordinates,c.DYNAMIC_DRAW);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,
2,c.FLOAT,!1,0,this._texCoordinates);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);d&&c.bufferData(c.ELEMENT_ARRAY_BUFFER,this._indices,c.STATIC_DRAW);c.drawElements(c.TRIANGLES,6*a,c.UNSIGNED_SHORT,0);d&&(this._dirty=!1);cc.INCREMENT_GL_DRAWS(1)},reuse:function(){if(0<this._reuseGrid){for(var a=this._vertices,c=this._originalVertices,d=0;d<a.length;d++)c[d]=a[d];--this._reuseGrid}},calculateVertexPoints:function(){var a=this._texture.getPixelsWide(),c=this._texture.getPixelsHigh(),d=this._texture.getContentSizeInPixels().height,
e=this._gridSize,f=e.width*e.height;this._vertices=new Float32Array(12*f);this._texCoordinates=new Float32Array(8*f);this._indices=new Uint16Array(6*f);var g=cc.renderContext;this._verticesBuffer&&g.deleteBuffer(this._verticesBuffer);this._verticesBuffer=g.createBuffer();this._texCoordinateBuffer&&g.deleteBuffer(this._texCoordinateBuffer);this._texCoordinateBuffer=g.createBuffer();this._indicesBuffer&&g.deleteBuffer(this._indicesBuffer);this._indicesBuffer=g.createBuffer();var h,k,m=0,n=this._step,
p=this._vertices,q=this._texCoordinates,s=this._isTextureFlipped;for(h=0;h<e.width;h++)for(k=0;k<e.height;k++){var r=h*n.x,t=r+n.x,u=k*n.y,v=u+n.y;p[12*m]=r;p[12*m+1]=u;p[12*m+2]=0;p[12*m+3]=t;p[12*m+4]=u;p[12*m+5]=0;p[12*m+6]=r;p[12*m+7]=v;p[12*m+8]=0;p[12*m+9]=t;p[12*m+10]=v;p[12*m+11]=0;var z=u,B=v;s&&(z=d-u,B=d-v);q[8*m]=r/a;q[8*m+1]=z/c;q[8*m+2]=t/a;q[8*m+3]=z/c;q[8*m+4]=r/a;q[8*m+5]=B/c;q[8*m+6]=t/a;q[8*m+7]=B/c;m++}a=this._indices;for(h=0;h<f;h++)a[6*h+0]=4*h+0,a[6*h+1]=4*h+1,a[6*h+2]=4*h+
2,a[6*h+3]=4*h+1,a[6*h+4]=4*h+2,a[6*h+5]=4*h+3;this._originalVertices=new Float32Array(this._vertices);g.bindBuffer(g.ARRAY_BUFFER,this._verticesBuffer);g.bufferData(g.ARRAY_BUFFER,this._vertices,g.DYNAMIC_DRAW);g.bindBuffer(g.ARRAY_BUFFER,this._texCoordinateBuffer);g.bufferData(g.ARRAY_BUFFER,this._texCoordinates,g.DYNAMIC_DRAW);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,this._indices,g.DYNAMIC_DRAW);this._dirty=!0}});
cc.TiledGrid3D.create=function(a,c,d){var e=new cc.TiledGrid3D;e.initWithSize(a,c,d);return e};cc.Grabber=cc.Class.extend({_FBO:null,_oldFBO:null,_oldClearColor:null,_gl:null,ctor:function(){this._gl=cc.renderContext;this._oldClearColor=[0,0,0,0];this._oldFBO=null;this._FBO=this._gl.createFramebuffer()},grab:function(a){var c=this._gl;this._oldFBO=c.getParameter(c.FRAMEBUFFER_BINDING);c.bindFramebuffer(c.FRAMEBUFFER,this._FBO);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,a._webTextureObj,0);c.checkFramebufferStatus(c.FRAMEBUFFER)!=c.FRAMEBUFFER_COMPLETE&&cc.log("Frame Grabber: could not attach texture to frmaebuffer");
c.bindFramebuffer(c.FRAMEBUFFER,this._oldFBO)},beforeRender:function(a){a=this._gl;this._oldFBO=a.getParameter(a.FRAMEBUFFER_BINDING);a.bindFramebuffer(a.FRAMEBUFFER,this._FBO);this._oldClearColor=a.getParameter(a.COLOR_CLEAR_VALUE);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT)},afterRender:function(a){a=this._gl;a.bindFramebuffer(a.FRAMEBUFFER,this._oldFBO);a.colorMask(!0,!0,!0,!0)},destroy:function(){this._gl.deleteFramebuffer(this._FBO)}});cc.v2fzero=function(){return{x:0,y:0}};cc.v2f=function(a,c){return{x:a,y:c}};cc.v2fadd=function(a,c){return cc.v2f(a.x+c.x,a.y+c.y)};cc.v2fsub=function(a,c){return cc.v2f(a.x-c.x,a.y-c.y)};cc.v2fmult=function(a,c){return cc.v2f(a.x*c,a.y*c)};cc.v2fperp=function(a){return cc.v2f(-a.y,a.x)};cc.v2fneg=function(a){return cc.v2f(-a.x,-a.y)};cc.v2fdot=function(a,c){return a.x*c.x+a.y*c.y};cc.v2fforangle=function(a){return cc.v2f(Math.cos(a),Math.sin(a))};
cc.v2fnormalize=function(a){a=cc.pNormalize(cc.p(a.x,a.y));return cc.v2f(a.x,a.y)};cc.__v2f=function(a){return cc.v2f(a.x,a.y)};cc.__t=function(a){return{u:a.x,v:a.y}};
cc.DrawNodeCanvas=cc.Node.extend({_buffer:null,_blendFunc:null,_lineWidth:0,_drawColor:null,ctor:function(){cc.Node.prototype.ctor.call(this);this._buffer=[];this._lineWidth=1;this._drawColor=new cc.Color4F(255,255,255,255);this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST)},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a){this._blendFunc=a},setLineWidth:function(a){this._lineWidth=a},getLineWidth:function(){return this._lineWidth},setDrawColor:function(a){this._drawColor.r=
a.r;this._drawColor.g=a.g;this._drawColor.b=a.b;this._drawColor.a=a.a},getDrawColor:function(){return new cc.Color4F(this._drawColor.r,this._drawColor.g,this._drawColor.b,this._drawColor.a)},drawRect:function(a,c,d,e,f){e=e||this._lineWidth;f=f||this.getDrawColor();a=[a,cc.p(c.x,a.y),c,cc.p(a.x,c.y)];c=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);c.verts=a;c.lineWidth=e;c.lineColor=f;c.isClosePolygon=!0;c.isStroke=!0;c.lineCap="butt";if(c.fillColor=d)c.isFill=!0;this._buffer.push(c)},drawCircle:function(a,
c,d,e,f,g,h){g=g||this._lineWidth;h=h||this.getDrawColor();for(var k=2*Math.PI/e,m=[],n=0;n<=e;n++){var p=n*k,q=c*Math.cos(p+d)+a.x,p=c*Math.sin(p+d)+a.y;m.push(cc.p(q,p))}f&&m.push(cc.p(a.x,a.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=m;a.lineWidth=g;a.lineColor=h;a.isClosePolygon=!0;a.isStroke=!0;this._buffer.push(a)},drawQuadBezier:function(a,c,d,e,f,g){f=f||this._lineWidth;g=g||this.getDrawColor();for(var h=[],k=0,m=0;m<e;m++){var n=Math.pow(1-k,2)*a.x+2*(1-k)*k*c.x+k*k*d.x,
p=Math.pow(1-k,2)*a.y+2*(1-k)*k*c.y+k*k*d.y;h.push(cc.p(n,p));k+=1/e}h.push(cc.p(d.x,d.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=h;a.lineWidth=f;a.lineColor=g;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawCubicBezier:function(a,c,d,e,f,g,h){g=g||this._lineWidth;h=h||this.getDrawColor();for(var k=[],m=0,n=0;n<f;n++){var p=Math.pow(1-m,3)*a.x+3*Math.pow(1-m,2)*m*c.x+3*(1-m)*m*m*d.x+m*m*m*e.x,q=Math.pow(1-m,3)*a.y+3*Math.pow(1-m,2)*m*c.y+3*(1-m)*m*m*d.y+m*m*m*e.y;k.push(cc.p(p,
q));m+=1/f}k.push(cc.p(e.x,e.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=k;a.lineWidth=g;a.lineColor=h;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawCatmullRom:function(a,c,d,e){this.drawCardinalSpline(a,0.5,c,d,e)},drawCardinalSpline:function(a,c,d,e,f){e=e||this._lineWidth;f=f||this.getDrawColor();for(var g=[],h,k,m=1/a.length,n=0;n<d+1;n++)k=n/d,1==k?(h=a.length-1,k=1):(h=0|k/m,k=(k-m*h)/m),h=cc.CardinalSplineAt(cc.getControlPointAt(a,h-1),cc.getControlPointAt(a,h-
0),cc.getControlPointAt(a,h+1),cc.getControlPointAt(a,h+2),c,k),g.push(h);a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=g;a.lineWidth=e;a.lineColor=f;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawDot:function(a,c,d){d=d||this.getDrawColor();var e=new cc._DrawNodeElement(cc.DrawNode.TYPE_DOT);e.verts=[a];e.lineWidth=c;e.fillColor=d;this._buffer.push(e)},drawSegment:function(a,c,d,e){d=d||this._lineWidth;e=e||this.getDrawColor();var f=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);
f.verts=[a,c];f.lineWidth=d;f.lineColor=e;f.isStroke=!0;f.lineCap="round";this._buffer.push(f)},drawPoly_:function(a,c,d,e){d=d||this._lineWidth;e=e||this.getDrawColor();var f=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);f.verts=a;f.fillColor=c;f.lineWidth=d;f.lineColor=e;f.isClosePolygon=!0;f.isStroke=!0;f.lineCap="round";c&&(f.isFill=!0);this._buffer.push(f)},drawPoly:function(a,c,d,e){for(var f=[],g=0;g<a.length;g++)f.push(cc.p(a[g].x,a[g].y));return this.drawPoly_(f,c,d,e)},draw:function(a){a=
a||cc.renderContext;this._blendFunc&&this._blendFunc.src==gl.SRC_ALPHA&&this._blendFunc.dst==gl.ONE&&(a.globalCompositeOperation="lighter");for(var c=0;c<this._buffer.length;c++){var d=this._buffer[c];switch(d.type){case cc.DrawNode.TYPE_DOT:this._drawDot(a,d);break;case cc.DrawNode.TYPE_SEGMENT:this._drawSegment(a,d);break;case cc.DrawNode.TYPE_POLY:this._drawPoly(a,d)}}},_drawDot:function(a,c){var d=c.fillColor,e=c.verts[0],f=c.lineWidth,g=cc.EGLView.getInstance().getScaleX(),h=cc.EGLView.getInstance().getScaleY();
a.fillStyle="rgba("+(0|255*d.r)+","+(0|255*d.g)+","+(0|255*d.b)+","+d.a+")";a.beginPath();a.arc(e.x*g,-e.y*h,f*g,0,2*Math.PI,!1);a.closePath();a.fill()},_drawSegment:function(a,c){var d=c.lineColor,e=c.verts[0],f=c.verts[1],g=c.lineWidth,h=c.lineCap,k=cc.EGLView.getInstance().getScaleX(),m=cc.EGLView.getInstance().getScaleY();a.strokeStyle="rgba("+(0|255*d.r)+","+(0|255*d.g)+","+(0|255*d.b)+","+d.a+")";a.lineWidth=g*k;a.beginPath();a.lineCap=h;a.moveTo(e.x*k,-e.y*m);a.lineTo(f.x*k,-f.y*m);a.stroke()},
_drawPoly:function(a,c){var d=c.verts,e=c.lineCap,f=c.fillColor,g=c.lineWidth,h=c.lineColor,k=c.isClosePolygon,m=c.isFill,n=c.isStroke;if(null!=d){var p=d[0],q=cc.EGLView.getInstance().getScaleX(),s=cc.EGLView.getInstance().getScaleY();a.lineCap=e;f&&(a.fillStyle="rgba("+(0|255*f.r)+","+(0|255*f.g)+","+(0|255*f.b)+","+f.a+")");g&&(a.lineWidth=g*q);h&&(a.strokeStyle="rgba("+(0|255*h.r)+","+(0|255*h.g)+","+(0|255*h.b)+","+h.a+")");a.beginPath();a.moveTo(p.x*q,-p.y*s);e=1;for(f=d.length;e<f;e++)a.lineTo(d[e].x*
q,-d[e].y*s);k&&a.closePath();m&&a.fill();n&&a.stroke()}},clear:function(){this._buffer.length=0}});
cc.DrawNodeWebGL=cc.Node.extend({_bufferCapacity:0,_buffer:null,_trianglesArrayBuffer:null,_trianglesWebBuffer:null,_trianglesReader:null,_blendFunc:null,_dirty:!1,getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a){this._blendFunc=a},ctor:function(){cc.Node.prototype.ctor.call(this);this._buffer=[];this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST)},init:function(){return cc.Node.prototype.init.call(this)?(this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_LENGTHTEXTURECOLOR)),
this._ensureCapacity(512),this._trianglesWebBuffer=cc.renderContext.createBuffer(),this._dirty=!0):!1},_render:function(){var a=cc.renderContext;cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);a.bindBuffer(a.ARRAY_BUFFER,this._trianglesWebBuffer);this._dirty&&(a.bufferData(a.ARRAY_BUFFER,this._trianglesArrayBuffer,a.STREAM_DRAW),this._dirty=!1);var c=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,c,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,
4,a.UNSIGNED_BYTE,!0,c,8);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,c,12);a.drawArrays(a.TRIANGLES,0,3*this._buffer.length);cc.INCREMENT_GL_DRAWS(1)},_ensureCapacity:function(a){if(this._buffer.length+a>this._bufferCapacity){var c=cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT;this._bufferCapacity+=Math.max(this._bufferCapacity,a);if(null==this._buffer||0===this._buffer.length)this._buffer=[],this._trianglesArrayBuffer=new ArrayBuffer(c*this._bufferCapacity),this._trianglesReader=
new Uint8Array(this._trianglesArrayBuffer);else{a=this._buffer;a.length=0;for(var d=new ArrayBuffer(c*this._bufferCapacity),e=0;e<this._buffer.length;e++)a[e]=new cc.V2F_C4B_T2F_Triangle(this._buffer[e].a,this._buffer[e].b,this._buffer[e].c,d,e*c);this._trianglesReader=new Uint8Array(d);this._trianglesArrayBuffer=d}}},draw:function(){cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst);this._shaderProgram.use();this._shaderProgram.setUniformsForBuiltins();this._render()},drawDot:function(a,c,d){d=
{r:0|255*d.r,g:0|255*d.g,b:0|255*d.b,a:0|255*d.a};var e={vertices:{x:a.x-c,y:a.y-c},colors:d,texCoords:{u:-1,v:-1}},f={vertices:{x:a.x+c,y:a.y+c},colors:d,texCoords:{u:1,v:1}},g={vertices:{x:a.x+c,y:a.y-c},colors:d,texCoords:{u:1,v:-1}};this._buffer.push(new cc.V2F_C4B_T2F_Triangle(e,{vertices:{x:a.x-c,y:a.y+c},colors:d,texCoords:{u:-1,v:1}},f,this._trianglesArrayBuffer,this._buffer.length*cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT));this._buffer.push(new cc.V2F_C4B_T2F_Triangle(e,f,g,this._trianglesArrayBuffer,
this._buffer.length*cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT));this._dirty=!0},drawSegment:function(a,c,d,e){this._ensureCapacity(18);e={r:0|255*e.r,g:0|255*e.g,b:0|255*e.b,a:0|255*e.a};var f=cc.__v2f(a),g=cc.__v2f(c);c=cc.v2fnormalize(cc.v2fperp(cc.v2fsub(g,f)));a=cc.v2fperp(c);var h=cc.v2fmult(c,d),k=cc.v2fmult(a,d);d=cc.v2fsub(g,cc.v2fadd(h,k));var m=cc.v2fadd(g,cc.v2fsub(h,k)),n=cc.v2fsub(g,h),g=cc.v2fadd(g,h),p=cc.v2fsub(f,h),q=cc.v2fadd(f,h),s=cc.v2fsub(f,cc.v2fsub(h,k)),f=cc.v2fadd(f,cc.v2fadd(h,
k)),h=cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT,k=this._trianglesArrayBuffer;this._buffer.push(new cc.V2F_C4B_T2F_Triangle({vertices:d,colors:e,texCoords:cc.__t(cc.v2fneg(cc.v2fadd(c,a)))},{vertices:m,colors:e,texCoords:cc.__t(cc.v2fsub(c,a))},{vertices:n,colors:e,texCoords:cc.__t(cc.v2fneg(c))},k,this._buffer.length*h));this._buffer.push(new cc.V2F_C4B_T2F_Triangle({vertices:g,colors:e,texCoords:cc.__t(c)},{vertices:m,colors:e,texCoords:cc.__t(cc.v2fsub(c,a))},{vertices:n,colors:e,texCoords:cc.__t(cc.v2fneg(c))},
k,this._buffer.length*h));this._buffer.push(new cc.V2F_C4B_T2F_Triangle({vertices:g,colors:e,texCoords:cc.__t(c)},{vertices:p,colors:e,texCoords:cc.__t(cc.v2fneg(c))},{vertices:n,colors:e,texCoords:cc.__t(cc.v2fneg(c))},k,this._buffer.length*h));this._buffer.push(new cc.V2F_C4B_T2F_Triangle({vertices:g,colors:e,texCoords:cc.__t(c)},{vertices:p,colors:e,texCoords:cc.__t(cc.v2fneg(c))},{vertices:q,colors:e,texCoords:cc.__t(c)},k,this._buffer.length*h));this._buffer.push(new cc.V2F_C4B_T2F_Triangle({vertices:s,
colors:e,texCoords:cc.__t(cc.v2fsub(a,c))},{vertices:p,colors:e,texCoords:cc.__t(cc.v2fneg(c))},{vertices:q,colors:e,texCoords:cc.__t(c)},k,this._buffer.length*h));this._buffer.push(new cc.V2F_C4B_T2F_Triangle({vertices:s,colors:e,texCoords:cc.__t(cc.v2fsub(a,c))},{vertices:f,colors:e,texCoords:cc.__t(cc.v2fadd(c,a))},{vertices:q,colors:e,texCoords:cc.__t(c)},k,this._buffer.length*h));this._dirty=!0},drawPoly:function(a,c,d,e){c={r:0|255*c.r,g:0|255*c.g,b:0|255*c.b,a:0|255*c.a};e={r:0|255*e.r,g:0|
255*e.g,b:0|255*e.b,a:0|255*e.a};var f=[],g,h,k,m,n=a.length;for(g=0;g<n;g++){h=cc.__v2f(a[(g-1+n)%n]);k=cc.__v2f(a[g]);m=cc.__v2f(a[(g+1)%n]);var p=cc.v2fnormalize(cc.v2fperp(cc.v2fsub(k,h)));k=cc.v2fnormalize(cc.v2fperp(cc.v2fsub(m,k)));p=cc.v2fmult(cc.v2fadd(p,k),1/(cc.v2fdot(p,k)+1));f[g]={offset:p,n:k}}p=0<d;this._ensureCapacity(3*(3*n-2));var q=cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT,s=this._trianglesArrayBuffer,r=this._buffer,t=!1==p?0.5:0;for(g=0;g<n-2;g++)h=cc.v2fsub(cc.__v2f(a[0]),cc.v2fmult(f[0].offset,
t)),k=cc.v2fsub(cc.__v2f(a[g+1]),cc.v2fmult(f[g+1].offset,t)),m=cc.v2fsub(cc.__v2f(a[g+2]),cc.v2fmult(f[g+2].offset,t)),r.push(new cc.V2F_C4B_T2F_Triangle({vertices:h,colors:c,texCoords:cc.__t(cc.v2fzero())},{vertices:k,colors:c,texCoords:cc.__t(cc.v2fzero())},{vertices:m,colors:c,texCoords:cc.__t(cc.v2fzero())},s,r.length*q));for(g=0;g<n;g++){t=(g+1)%n;h=cc.__v2f(a[g]);k=cc.__v2f(a[t]);m=f[g].n;var u=f[g].offset,v=f[t].offset,t=p?cc.v2fsub(h,cc.v2fmult(u,d)):cc.v2fsub(h,cc.v2fmult(u,0.5)),z=p?cc.v2fsub(k,
cc.v2fmult(v,d)):cc.v2fsub(k,cc.v2fmult(v,0.5));h=p?cc.v2fadd(h,cc.v2fmult(u,d)):cc.v2fadd(h,cc.v2fmult(u,0.5));k=p?cc.v2fadd(k,cc.v2fmult(v,d)):cc.v2fadd(k,cc.v2fmult(v,0.5));p?(r.push(new cc.V2F_C4B_T2F_Triangle({vertices:t,colors:e,texCoords:cc.__t(cc.v2fneg(m))},{vertices:z,colors:e,texCoords:cc.__t(cc.v2fneg(m))},{vertices:k,colors:e,texCoords:cc.__t(m)},s,r.length*q)),r.push(new cc.V2F_C4B_T2F_Triangle({vertices:t,colors:e,texCoords:cc.__t(cc.v2fneg(m))},{vertices:h,colors:e,texCoords:cc.__t(m)},
{vertices:k,colors:e,texCoords:cc.__t(m)},s,r.length*q))):(r.push(new cc.V2F_C4B_T2F_Triangle({vertices:t,colors:c,texCoords:cc.__t(cc.v2fzero())},{vertices:z,colors:c,texCoords:cc.__t(cc.v2fzero())},{vertices:k,colors:c,texCoords:cc.__t(m)},s,r.length*q)),r.push(new cc.V2F_C4B_T2F_Triangle({vertices:t,colors:c,texCoords:cc.__t(cc.v2fzero())},{vertices:h,colors:c,texCoords:cc.__t(m)},{vertices:k,colors:c,texCoords:cc.__t(m)},s,r.length*q)))}this._dirty=!0},clear:function(){this._buffer.length=0;this._dirty=
!0}});cc.DrawNode=cc.Browser.supportWebGL?cc.DrawNodeWebGL:cc.DrawNodeCanvas;cc.DrawNode.create=function(){var a=new cc.DrawNode;return a&&a.init()?a:null};cc._DrawNodeElement=function(a,c,d,e,f,g,h,k,m){this.type=a;this.verts=c||null;this.fillColor=d||null;this.lineWidth=e||0;this.lineColor=f||null;this.lineCap=g||"butt";this.isClosePolygon=h||!1;this.isFill=k||!1;this.isStroke=m||!1};cc.DrawNode.TYPE_DOT=0;cc.DrawNode.TYPE_SEGMENT=1;cc.DrawNode.TYPE_POLY=2;cc.ACTION_TAG_INVALID=-1;
cc.Action=cc.Class.extend({_originalTarget:null,_target:null,_tag:cc.ACTION_TAG_INVALID,ctor:function(){this._target=this._originalTarget=null;this._tag=cc.ACTION_TAG_INVALID},description:function(){return"\x3ccc.Action | Tag \x3d "+this._tag+"\x3e"},copy:function(){return this.clone()},clone:function(){var a=new cc.Action;a._originalTarget=null;a._target=null;a._tag=this._tag;return a},isDone:function(){return!0},startWithTarget:function(a){this._target=this._originalTarget=a},stop:function(){this._target=
null},step:function(a){cc.log("[Action step]. override me")},update:function(a){cc.log("[Action update]. override me")},getTarget:function(){return this._target},setTarget:function(a){this._target=a},getOriginalTarget:function(){return this._originalTarget},setOriginalTarget:function(a){this._originalTarget=a},getTag:function(){return this._tag},setTag:function(a){this._tag=a},retain:function(){},release:function(){}});cc.Action.create=function(){return new cc.Action};
cc.FiniteTimeAction=cc.Action.extend({_duration:0,ctor:function(){cc.Action.prototype.ctor.call(this);this._duration=0},getDuration:function(){return this._duration},setDuration:function(a){this._duration=a},reverse:function(){cc.log("cocos2d: FiniteTimeAction#reverse: Implement me");return null},clone:function(){return new cc.FiniteTimeAction}});
cc.Speed=cc.Action.extend({_speed:0,_innerAction:null,ctor:function(){cc.Action.prototype.ctor.call(this);this._speed=0;this._innerAction=null},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a},initWithAction:function(a,c){if(!a)throw"cc.Speed.initWithAction(): action must be non nil";this._innerAction=a;this._speed=c;return!0},clone:function(){var a=new cc.Speed;a.initWithAction(this._innerAction.clone(),this._speed);return a},startWithTarget:function(a){cc.Action.prototype.startWithTarget.call(this,
a);this._innerAction.startWithTarget(a)},stop:function(){this._innerAction.stop();cc.Action.prototype.stop.call(this)},step:function(a){this._innerAction.step(a*this._speed)},isDone:function(){return this._innerAction.isDone()},reverse:function(){return cc.Speed.create(this._innerAction.reverse(),this._speed)},setInnerAction:function(a){this._innerAction!=a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});
cc.Speed.create=function(a,c){var d=new cc.Speed;return d&&d.initWithAction(a,c)?d:null};
cc.Follow=cc.Action.extend({_followedNode:null,_boundarySet:!1,_boundaryFullyCovered:!1,_halfScreenSize:null,_fullScreenSize:null,leftBoundary:0,rightBoundary:0,topBoundary:0,bottomBoundary:0,_worldRect:null,ctor:function(){cc.Action.prototype.ctor.call(this);this._followedNode=null;this._boundaryFullyCovered=this._boundarySet=!1;this._fullScreenSize=this._halfScreenSize=null;this.bottomBoundary=this.topBoundary=this.rightBoundary=this.leftBoundary=0;this._worldRect=cc.RectZero()},clone:function(){var a=
new cc.Follow,c=this._worldRect,c=new cc.Rect(c.x,c.y,c.width,c.height);a.initWithTarget(this._followedNode,c);return a},isBoundarySet:function(){return this._boundarySet},setBoudarySet:function(a){this._boundarySet=a},initWithTarget:function(a,c){if(!a)throw"cc.Follow.initWithAction(): followedNode must be non nil";c=c||cc.RectZero();this._followedNode=a;this._worldRect=c;this._boundarySet=!cc._rectEqualToZero(c);this._boundaryFullyCovered=!1;var d=cc.Director.getInstance().getWinSize();this._fullScreenSize=
cc.p(d.width,d.height);this._halfScreenSize=cc.pMult(this._fullScreenSize,0.5);this._boundarySet&&(this.leftBoundary=-(c.x+c.width-this._fullScreenSize.x),this.rightBoundary=-c.x,this.topBoundary=-c.y,this.bottomBoundary=-(c.y+c.height-this._fullScreenSize.y),this.rightBoundary<this.leftBoundary&&(this.rightBoundary=this.leftBoundary=(this.leftBoundary+this.rightBoundary)/2),this.topBoundary<this.bottomBoundary&&(this.topBoundary=this.bottomBoundary=(this.topBoundary+this.bottomBoundary)/2),this.topBoundary==
this.bottomBoundary&&this.leftBoundary==this.rightBoundary&&(this._boundaryFullyCovered=!0));return!0},step:function(a){a=this._followedNode.getPositionX();var c=this._followedNode.getPositionY();a=this._halfScreenSize.x-a;c=this._halfScreenSize.y-c;this._boundarySet?this._boundaryFullyCovered||this._target.setPosition(cc.clampf(a,this.leftBoundary,this.rightBoundary),cc.clampf(c,this.bottomBoundary,this.topBoundary)):this._target.setPosition(a,c)},isDone:function(){return!this._followedNode.isRunning()},
stop:function(){this._target=null;cc.Action.prototype.stop.call(this)}});cc.Follow.create=function(a,c){c=c||new cc.RectZero;var d=new cc.Follow;return null!=c&&d&&d.initWithTarget(a,c)||d&&d.initWithTarget(a)?d:null};cc.ActionInterval=cc.FiniteTimeAction.extend({_elapsed:0,_firstTick:!1,ctor:function(){cc.FiniteTimeAction.prototype.ctor.call(this);this._elapsed=0;this._firstTick=!1},getElapsed:function(){return this._elapsed},initWithDuration:function(a){this._duration=0===a?cc.FLT_EPSILON:a;this._elapsed=0;return this._firstTick=!0},isDone:function(){return this._elapsed>=this._duration},clone:function(){var a=new cc.ActionInterval;a.initWithDuration(this._duration);return a},step:function(a){this._firstTick?
(this._firstTick=!1,this._elapsed=0):this._elapsed+=a;a=this._elapsed/(1.192092896E-7<this._duration?this._duration:1.192092896E-7);a=1>a?a:1;this.update(0<a?a:0)},startWithTarget:function(a){cc.Action.prototype.startWithTarget.call(this,a);this._elapsed=0;this._firstTick=!0},reverse:function(){cc.log("cc.IntervalAction: reverse not implemented.");return null},setAmplitudeRate:function(a){cc.log("cc.ActionInterval.setAmplitudeRate(): it should be overridden in subclass.")},getAmplitudeRate:function(){cc.log("cc.ActionInterval.getAmplitudeRate(): it should be overridden in subclass.")}});
cc.ActionInterval.create=function(a){var c=new cc.ActionInterval;c.initWithDuration(a);return c};
cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._actions=[];this._split=null;this._last=0},initWithTwoActions:function(a,c){if(!a||!c)throw"cc.Sequence.initWithTwoActions(): arguments must all be non nil";var d=a.getDuration()+c.getDuration();this.initWithDuration(d);this._actions[0]=a;this._actions[1]=c;return!0},clone:function(){var a=new cc.Sequence;a.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone());
return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._split=this._actions[0].getDuration()/this._duration;this._last=-1},stop:function(){-1!==this._last&&this._actions[this._last].stop();cc.Action.prototype.stop.call(this)},update:function(a){var c=0,d=this._split,e=this._actions,f=this._last;a<d?(a=0!==d?a/d:1,0===c&&1===f&&(e[1].update(0),e[1].stop())):(c=1,a=1===d?1:(a-d)/(1-d),-1===f&&(e[0].startWithTarget(this._target),e[0].update(1),e[0].stop()),
f||(e[0].update(1),e[0].stop()));f===c&&e[c].isDone()||(f!==c&&e[c].startWithTarget(this._target),e[c].update(a),this._last=c)},reverse:function(){return cc.Sequence._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse())},copy:function(){return this.clone()}});
cc.Sequence.create=function(a){var c=a instanceof Array?a:arguments;0<c.length&&null==c[c.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var d=c[0],e=1;e<c.length;e++)c[e]&&(d=cc.Sequence._actionOneTwo(d,c[e]));return d};cc.Sequence._actionOneTwo=function(a,c){var d=new cc.Sequence;d.initWithTwoActions(a,c);return d};
cc.Repeat=cc.ActionInterval.extend({_times:0,_total:0,_nextDt:0,_actionInstant:!1,_innerAction:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._nextDt=this._total=this._times=0;this._actionInstant=!1;this._innerAction=null},initWithAction:function(a,c){var d=a.getDuration()*c;return this.initWithDuration(d)?(this._times=c,this._innerAction=a,a instanceof cc.ActionInstant&&(this._times-=1),this._total=0,!0):!1},clone:function(){var a=new cc.Repeat;a.initWithAction(this._innerAction.clone(),
this._times);return a},startWithTarget:function(a){this._total=0;this._nextDt=this._innerAction.getDuration()/this._duration;cc.ActionInterval.prototype.startWithTarget.call(this,a);this._innerAction.startWithTarget(a)},stop:function(){this._innerAction.stop();cc.Action.prototype.stop.call(this)},update:function(a){var c=this._innerAction,d=this._duration,e=this._times,f=this._nextDt;if(a>=f){for(;a>f&&this._total<e;)c.update(1),this._total++,c.stop(),c.startWithTarget(this._target),this._nextDt=
f+=c.getDuration()/d;1<=a&&this._total<e&&this._total++;this._actionInstant&&(this._total==e?(c.update(1),c.stop()):c.update(a-(f-c.getDuration()/d)))}else c.update(a*e%1)},isDone:function(){return this._total==this._times},reverse:function(){return cc.Repeat.create(this._innerAction.reverse(),this._times)},setInnerAction:function(a){this._innerAction!=a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});
cc.Repeat.create=function(a,c){var d=new cc.Repeat;d.initWithAction(a,c);return d};
cc.RepeatForever=cc.ActionInterval.extend({_innerAction:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._innerAction=null},initWithAction:function(a){if(!a)throw"cc.RepeatForever.initWithAction(): action must be non null";this._innerAction=a;return!0},clone:function(){var a=new cc.RepeatForever;a.initWithAction(this._innerAction.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._innerAction.startWithTarget(a)},step:function(a){var c=
this._innerAction;c.step(a);c.isDone()&&(c.startWithTarget(this._target),c.step(c.getElapsed()-c.getDuration()))},isDone:function(){return!1},reverse:function(){return cc.RepeatForever.create(this._innerAction.reverse())},setInnerAction:function(a){this._innerAction!=a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});cc.RepeatForever.create=function(a){var c=new cc.RepeatForever;return c&&c.initWithAction(a)?c:null};
cc.Spawn=cc.ActionInterval.extend({_one:null,_two:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._two=this._one=null},initWithTwoActions:function(a,c){if(!a||!c)throw"cc.Spawn.initWithTwoActions(): arguments must all be non null";var d=!1,e=a.getDuration(),f=c.getDuration();this.initWithDuration(Math.max(e,f))&&(this._one=a,this._two=c,e>f?this._two=cc.Sequence._actionOneTwo(c,cc.DelayTime.create(e-f)):e<f&&(this._one=cc.Sequence._actionOneTwo(a,cc.DelayTime.create(f-e))),d=
!0);return d},clone:function(){var a=new cc.Spawn;a.initWithTwoActions(this._one.clone(),this._two.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._one.startWithTarget(a);this._two.startWithTarget(a)},stop:function(){this._one.stop();this._two.stop();cc.Action.prototype.stop.call(this)},update:function(a){this._one&&this._one.update(a);this._two&&this._two.update(a)},reverse:function(){return cc.Spawn._actionOneTwo(this._one.reverse(),this._two.reverse())}});
cc.Spawn.create=function(a){var c=a instanceof Array?a:arguments;0<c.length&&null==c[c.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var d=c[0],e=1;e<c.length;e++)null!=c[e]&&(d=this._actionOneTwo(d,c[e]));return d};cc.Spawn._actionOneTwo=function(a,c){var d=new cc.Spawn;d.initWithTwoActions(a,c);return d};
cc.RotateTo=cc.ActionInterval.extend({_dstAngleX:0,_startAngleX:0,_diffAngleX:0,_dstAngleY:0,_startAngleY:0,_diffAngleY:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._diffAngleY=this._startAngleY=this._dstAngleY=this._diffAngleX=this._startAngleX=this._dstAngleX=0},initWithDuration:function(a,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._dstAngleX=c||0,this._dstAngleY=d||this._dstAngleX,!0):!1},clone:function(){var a=new cc.RotateTo;a.initWithDuration(this._duration,
this._dstAngleX,this._dstAngleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var c=a.getRotationX()%360,d=this._dstAngleX-c;180<d&&(d-=360);-180>d&&(d+=360);this._startAngleX=c;this._diffAngleX=d;this._startAngleY=a.getRotationY()%360;a=this._dstAngleY-this._startAngleY;180<a&&(a-=360);-180>a&&(a+=360);this._diffAngleY=a},reverse:function(){cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.")},update:function(a){this._target&&(this._target.setRotationX(this._startAngleX+
this._diffAngleX*a),this._target.setRotationY(this._startAngleY+this._diffAngleY*a))}});cc.RotateTo.create=function(a,c,d){var e=new cc.RotateTo;e.initWithDuration(a,c,d);return e};
cc.RotateBy=cc.ActionInterval.extend({_angleX:0,_startAngleX:0,_angleY:0,_startAngleY:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._startAngleY=this._angleY=this._startAngleX=this._angleX=0},initWithDuration:function(a,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._angleX=c||0,this._angleY=d||this._angleX,!0):!1},clone:function(){var a=new cc.RotateBy;a.initWithDuration(this._duration,this._angleX,this._angleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,
a);this._startAngleX=a.getRotationX();this._startAngleY=a.getRotationY()},update:function(a){this._target&&(this._target.setRotationX(this._startAngleX+this._angleX*a),this._target.setRotationY(this._startAngleY+this._angleY*a))},reverse:function(){return cc.RotateBy.create(this._duration,-this._angleX,-this._angleY)}});cc.RotateBy.create=function(a,c,d){var e=new cc.RotateBy;e.initWithDuration(a,c,d);return e};
cc.MoveBy=cc.ActionInterval.extend({_positionDelta:null,_startPosition:null,_previousPosition:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._positionDelta=cc.p(0,0);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0)},initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._positionDelta.x=c.x,this._positionDelta.y=c.y,!0):!1},clone:function(){var a=new cc.MoveBy;a.initWithDuration(this._duration,this._positionDelta);
return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var c=a.getPositionX();a=a.getPositionY();this._previousPosition.x=c;this._previousPosition.y=a;this._startPosition.x=c;this._startPosition.y=a},update:function(a){if(this._target){var c=this._positionDelta.x*a;a*=this._positionDelta.y;var d=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var e=this._target.getPositionX(),f=this._target.getPositionY(),g=this._previousPosition;d.x=d.x+e-g.x;d.y=d.y+f-
g.y;c+=d.x;a+=d.y;this._target.setPosition(c,a);g.x=c;g.y=a}else this._target.setPosition(d.x+c,d.y+a)}},reverse:function(){return cc.MoveBy.create(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y))}});cc.MoveBy.create=function(a,c){var d=new cc.MoveBy;d.initWithDuration(a,c);return d};
cc.MoveTo=cc.MoveBy.extend({_endPosition:null,ctor:function(){cc.MoveBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0)},initWithDuration:function(a,c){return cc.MoveBy.prototype.initWithDuration.call(this,a,c)?(this._endPosition.x=c.x,this._endPosition.y=c.y,!0):!1},clone:function(){var a=new cc.MoveTo;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.create=function(a,c){var d=new cc.MoveTo;d.initWithDuration(a,c);return d};
cc.SkewTo=cc.ActionInterval.extend({_skewX:0,_skewY:0,_startSkewX:0,_startSkewY:0,_endSkewX:0,_endSkewY:0,_deltaX:0,_deltaY:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._deltaY=this._deltaX=this._endSkewY=this._endSkewX=this._startSkewY=this._startSkewX=this._skewY=this._skewX=0},initWithDuration:function(a,c,d){var e=!1;cc.ActionInterval.prototype.initWithDuration.call(this,a)&&(this._endSkewX=c,this._endSkewY=d,e=!0);return e},clone:function(){var a=new cc.SkewTo;a.initWithDuration(this._duration,
this._endSkewX,this._endSkewY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startSkewX=a.getSkewX()%180;this._deltaX=this._endSkewX-this._startSkewX;180<this._deltaX&&(this._deltaX-=360);-180>this._deltaX&&(this._deltaX+=360);this._startSkewY=a.getSkewY()%360;this._deltaY=this._endSkewY-this._startSkewY;180<this._deltaY&&(this._deltaY-=360);-180>this._deltaY&&(this._deltaY+=360)},update:function(a){this._target.setSkewX(this._startSkewX+this._deltaX*
a);this._target.setSkewY(this._startSkewY+this._deltaY*a)}});cc.SkewTo.create=function(a,c,d){var e=new cc.SkewTo;e&&e.initWithDuration(a,c,d);return e};
cc.SkewBy=cc.SkewTo.extend({initWithDuration:function(a,c,d){var e=!1;cc.SkewTo.prototype.initWithDuration.call(this,a,c,d)&&(this._skewX=c,this._skewY=d,e=!0);return e},clone:function(){var a=new cc.SkewBy;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(){return cc.SkewBy.create(this._duration,
-this._skewX,-this._skewY)}});cc.SkewBy.create=function(a,c,d){var e=new cc.SkewBy;e&&e.initWithDuration(a,c,d);return e};
cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);this._delta=cc.p(0,0);this._jumps=this._height=0},initWithDuration:function(a,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._delta.x=c.x,this._delta.y=c.y,this._height=d,this._jumps=e,!0):!1},clone:function(){var a=new cc.JumpBy;a.initWithDuration(this._duration,
this._delta,this._height,this._jumps);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var c=a.getPositionX();a=a.getPositionY();this._previousPosition.x=c;this._previousPosition.y=a;this._startPosition.x=c;this._startPosition.y=a},update:function(a){if(this._target){var c=a*this._jumps%1,c=4*this._height*c*(1-c),c=c+this._delta.y*a;a*=this._delta.x;var d=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var e=this._target.getPositionX(),f=this._target.getPositionY(),
g=this._previousPosition;d.x=d.x+e-g.x;d.y=d.y+f-g.y;a+=d.x;c+=d.y;this._target.setPosition(a,c);g.x=a;g.y=c}else this._target.setPosition(d.x+a,d.y+c)}},reverse:function(){return cc.JumpBy.create(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps)}});cc.JumpBy.create=function(a,c,d,e){var f=new cc.JumpBy;f.initWithDuration(a,c,d,e);return f};
cc.JumpTo=cc.JumpBy.extend({startWithTarget:function(a){cc.JumpBy.prototype.startWithTarget.call(this,a);this._delta.x-=this._startPosition.x;this._delta.y-=this._startPosition.y},clone:function(){var a=new cc.JumpTo;a.initWithDuration(this._duration,this._delta,this._height,this._jumps);return a}});cc.JumpTo.create=function(a,c,d,e){var f=new cc.JumpTo;f.initWithDuration(a,c,d,e);return f};
cc.bezierAt=function(a,c,d,e,f){return Math.pow(1-f,3)*a+3*f*Math.pow(1-f,2)*c+3*Math.pow(f,2)*(1-f)*d+Math.pow(f,3)*e};
cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._config=[];this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0)},initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._config=c,!0):!1},clone:function(){for(var a=new cc.BezierBy,c=[],d=0;d<this._config.length;d++){var e=this._config[d];c.push(cc.p(e.x,e.y))}a.initWithDuration(this._duration,
c);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var c=a.getPositionX();a=a.getPositionY();this._previousPosition.x=c;this._previousPosition.y=a;this._startPosition.x=c;this._startPosition.y=a},update:function(a){if(this._target){var c=this._config,d=c[0].y,e=c[1].y,f=c[2].y,c=cc.bezierAt(0,c[0].x,c[1].x,c[2].x,a);a=cc.bezierAt(0,d,e,f,a);d=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var e=this._target.getPositionX(),f=this._target.getPositionY(),
g=this._previousPosition;d.x=d.x+e-g.x;d.y=d.y+f-g.y;c+=d.x;a+=d.y;this._target.setPosition(c,a);g.x=c;g.y=a}else this._target.setPosition(d.x+c,d.y+a)}},reverse:function(){var a=this._config,a=[cc.pAdd(a[1],cc.pNeg(a[2])),cc.pAdd(a[0],cc.pNeg(a[2])),cc.pNeg(a[2])];return cc.BezierBy.create(this._duration,a)}});cc.BezierBy.create=function(a,c){var d=new cc.BezierBy;d.initWithDuration(a,c);return d};
cc.BezierTo=cc.BezierBy.extend({_toConfig:null,ctor:function(){cc.BezierBy.prototype.ctor.call(this);this._toConfig=[]},initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toConfig=c,!0):!1},clone:function(){var a=new cc.BezierTo;a.initWithDuration(this._duration,this._toConfig);return a},startWithTarget:function(a){cc.BezierBy.prototype.startWithTarget.call(this,a);a=this._startPosition;var c=this._toConfig,d=this._config;d[0]=cc.pSub(c[0],a);d[1]=
cc.pSub(c[1],a);d[2]=cc.pSub(c[2],a)}});cc.BezierTo.create=function(a,c){var d=new cc.BezierTo;d.initWithDuration(a,c);return d};
cc.ScaleTo=cc.ActionInterval.extend({_scaleX:1,_scaleY:1,_startScaleX:1,_startScaleY:1,_endScaleX:0,_endScaleY:0,_deltaX:0,_deltaY:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._startScaleY=this._startScaleX=this._scaleY=this._scaleX=1;this._deltaY=this._deltaX=this._endScaleY=this._endScaleX=0},initWithDuration:function(a,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._endScaleX=c,this._endScaleY=null!=d?d:c,!0):!1},clone:function(){var a=new cc.ScaleTo;
a.initWithDuration(this._duration,this._endScaleX,this._endScaleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startScaleX=a.getScaleX();this._startScaleY=a.getScaleY();this._deltaX=this._endScaleX-this._startScaleX;this._deltaY=this._endScaleY-this._startScaleY},update:function(a){this._target&&this._target.setScale(this._startScaleX+this._deltaX*a,this._startScaleY+this._deltaY*a)}});
cc.ScaleTo.create=function(a,c,d){var e=new cc.ScaleTo;e.initWithDuration(a,c,d);return e};
cc.ScaleBy=cc.ScaleTo.extend({startWithTarget:function(a){cc.ScaleTo.prototype.startWithTarget.call(this,a);this._deltaX=this._startScaleX*this._endScaleX-this._startScaleX;this._deltaY=this._startScaleY*this._endScaleY-this._startScaleY},reverse:function(){return cc.ScaleBy.create(this._duration,1/this._endScaleX,1/this._endScaleY)},clone:function(){var a=new cc.ScaleBy;a.initWithDuration(this._duration,this._endScaleX,this._endScaleY);return a}});
cc.ScaleBy.create=function(a,c,d){var e=new cc.ScaleBy;e.initWithDuration(a,c,d);return e};
cc.Blink=cc.ActionInterval.extend({_times:0,_originalState:!1,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._times=0;this._originalState=!1},initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._times=c,!0):!1},clone:function(){var a=new cc.Blink;a.initWithDuration(this._duration,this._times);return a},update:function(a){if(this._target&&!this.isDone()){var c=1/this._times;this._target.setVisible(a%c>c/2)}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,
a);this._originalState=a.isVisible()},stop:function(){this._target.setVisible(this._originalState);cc.ActionInterval.prototype.stop.call(this)},reverse:function(){return cc.Blink.create(this._duration,this._times)}});cc.Blink.create=function(a,c){var d=new cc.Blink;d.initWithDuration(a,c);return d};
cc.FadeTo=cc.ActionInterval.extend({_toOpacity:null,_fromOpacity:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._fromOpacity=this._toOpacity=0},initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toOpacity=c,!0):!1},clone:function(){var a=new cc.FadeTo;a.initWithDuration(this._duration,this._toOpacity);return a},update:function(a){if(this._target.RGBAProtocol){var c=this._fromOpacity;this._target.setOpacity(c+(this._toOpacity-
c)*a)}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._target.RGBAProtocol&&(this._fromOpacity=a.getOpacity())}});cc.FadeTo.create=function(a,c){var d=new cc.FadeTo;d.initWithDuration(a,c);return d};
cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,reverse:function(){var a=new cc.FadeOut;a.initWithDuration(this._duration,0);return a},clone:function(){var a=new cc.FadeIn;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.create=function(a,c){null==c&&(c=255);var d=new cc.FadeIn;d.initWithDuration(a,c);return d};
cc.FadeOut=cc.FadeTo.extend({reverse:function(){var a=new cc.FadeIn;a._reverseAction=this;a.initWithDuration(this._duration,255);return a},clone:function(){var a=new cc.FadeOut;a.initWithDuration(this._duration,this._toOpacity);return a}});cc.FadeOut.create=function(a){var c=new cc.FadeOut;c.initWithDuration(a,0);return c};
cc.TintTo=cc.ActionInterval.extend({_to:null,_from:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._to=cc.c3b(0,0,0);this._from=cc.c3b(0,0,0)},initWithDuration:function(a,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=cc.c3b(c,d,e),!0):!1},clone:function(){var a=new cc.TintTo,c=this._to;a.initWithDuration(this._duration,c.r,c.g,c.b);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._target.RGBAProtocol&&
(this._from=this._target.getColor())},update:function(a){var c=this._from,d=this._to;this._target.RGBAProtocol&&this._target.setColor(cc.c3b(c.r+(d.r-c.r)*a,c.g+(d.g-c.g)*a,c.b+(d.b-c.b)*a))}});cc.TintTo.create=function(a,c,d,e){var f=new cc.TintTo;f.initWithDuration(a,c,d,e);return f};
cc.TintBy=cc.ActionInterval.extend({_deltaR:0,_deltaG:0,_deltaB:0,_fromR:0,_fromG:0,_fromB:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._fromB=this._fromG=this._fromR=this._deltaB=this._deltaG=this._deltaR=0},initWithDuration:function(a,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._deltaR=c,this._deltaG=d,this._deltaB=e,!0):!1},clone:function(){var a=new cc.TintBy;a.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB);return a},
startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);a.RGBAProtocol&&(a=a.getColor(),this._fromR=a.r,this._fromG=a.g,this._fromB=a.b)},update:function(a){this._target.RGBAProtocol&&this._target.setColor(cc.c3b(this._fromR+this._deltaR*a,this._fromG+this._deltaG*a,this._fromB+this._deltaB*a))},reverse:function(){return cc.TintBy.create(this._duration,-this._deltaR,-this._deltaG,-this._deltaB)}});
cc.TintBy.create=function(a,c,d,e){var f=new cc.TintBy;f.initWithDuration(a,c,d,e);return f};cc.DelayTime=cc.ActionInterval.extend({update:function(a){},reverse:function(){return cc.DelayTime.create(this._duration)},clone:function(){var a=new cc.DelayTime;a.initWithDuration(this._duration);return a}});cc.DelayTime.create=function(a){var c=new cc.DelayTime;c.initWithDuration(a);return c};
cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._other=null},initWithAction:function(a){if(!a)throw"cc.ReverseTime.initWithAction(): action must be non null";if(a==this._other)throw"cc.ReverseTime.initWithAction(): the action was already passed in.";return cc.ActionInterval.prototype.initWithDuration.call(this,a.getDuration())?(this._other=a,!0):!1},clone:function(){var a=new cc.ReverseTime;a.initWithAction(this._other.clone());
return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._other.startWithTarget(a)},update:function(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.create=function(a){var c=new cc.ReverseTime;c.initWithAction(a);return c};
cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._animation=null;this._nextFrame=0;this._origFrame=null;this._executedLoops=0;this._splitTimes=[]},getAnimation:function(){return this._animation},setAnimation:function(a){this._animation=a},initWithAnimation:function(a){if(!a)throw"cc.Animate.initWithAnimation(): animation must be non-NULL";var c=a.getDuration();if(this.initWithDuration(c*
a.getLoops())){this._nextFrame=0;this.setAnimation(a);this._origFrame=null;this._executedLoops=0;var d=this._splitTimes,e=d.length=0,f=c/a.getTotalDelayUnits();a=a.getFrames();cc.ArrayVerifyType(a,cc.AnimationFrame);for(var g=0;g<a.length;g++){var h=e*f/c,e=e+a[g].getDelayUnits();d.push(h)}return!0}return!1},clone:function(){var a=new cc.Animate;a.initWithAnimation(this._animation.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._animation.getRestoreOriginalFrame()&&
(this._origFrame=a.displayFrame());this._executedLoops=this._nextFrame=0},update:function(a){1>a&&(a*=this._animation.getLoops(),(0|a)>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),a%=1);for(var c=this._animation.getFrames(),d=c.length,e=this._splitTimes,f=this._nextFrame;f<d;f++)if(e[f]<=a)this._target.setDisplayFrame(c[f].getSpriteFrame()),this._nextFrame=f+1;else break},reverse:function(){var a=this._animation,c=a.getFrames(),d=[];cc.ArrayVerifyType(c,cc.AnimationFrame);if(0<c.length)for(var e=
c.length-1;0<=e;e--){var f=c[e];if(!f)break;d.push(f.clone())}c=cc.Animation.createWithAnimationFrames(d,a.getDelayPerUnit(),a.getLoops());c.setRestoreOriginalFrame(a.getRestoreOriginalFrame());return cc.Animate.create(c)},stop:function(){this._animation.getRestoreOriginalFrame()&&this._target&&this._target.setDisplayFrame(this._origFrame);cc.Action.prototype.stop.call(this)}});cc.Animate.create=function(a){var c=new cc.Animate;c.initWithAnimation(a);return c};
cc.TargetedAction=cc.ActionInterval.extend({_action:null,_forcedTarget:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._forcedTarget=this._action=null},initWithTarget:function(a,c){return this.initWithDuration(c.getDuration())?(this._forcedTarget=a,this._action=c,!0):!1},clone:function(){var a=new cc.TargetedAction;a.initWithTarget(this._forcedTarget,this._action.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._action.startWithTarget(this._forcedTarget)},
stop:function(){this._action.stop()},update:function(a){this._action.update(a)},getForcedTarget:function(){return this._forcedTarget},setForcedTarget:function(a){this._forcedTarget!=a&&(this._forcedTarget=a)}});cc.TargetedAction.create=function(a,c){var d=new cc.TargetedAction;d.initWithTarget(a,c);return d};cc.ActionInstant=cc.FiniteTimeAction.extend({isDone:function(){return!0},step:function(a){this.update(1)},update:function(a){},reverse:function(){return this.clone()},clone:function(){return new cc.ActionInstant}});cc.Show=cc.ActionInstant.extend({update:function(a){this._target.setVisible(!0)},reverse:function(){return cc.Hide.create()},clone:function(){return new cc.Show}});cc.Show.create=function(){return new cc.Show};
cc.Hide=cc.ActionInstant.extend({update:function(a){this._target.setVisible(!1)},reverse:function(){return cc.Show.create()},clone:function(){return new cc.Hide}});cc.Hide.create=function(){return new cc.Hide};cc.ToggleVisibility=cc.ActionInstant.extend({update:function(a){this._target.setVisible(!this._target.isVisible())},reverse:function(){return new cc.ToggleVisibility},clone:function(){return new cc.ToggleVisibility}});cc.ToggleVisibility.create=function(){return new cc.ToggleVisibility};
cc.RemoveSelf=cc.ActionInstant.extend({_isNeedCleanUp:!0,ctor:function(){cc.FiniteTimeAction.prototype.ctor.call(this);this._isNeedCleanUp=!0},update:function(a){this._target.removeFromParent(this._isNeedCleanUp)},init:function(a){this._isNeedCleanUp=a;return!0},reverse:function(){return new cc.RemoveSelf(this._isNeedCleanUp)},clone:function(){return new cc.RemoveSelf(this._isNeedCleanUp)}});cc.RemoveSelf.create=function(a){null==a&&(a=!0);var c=new cc.RemoveSelf;c&&c.init(a);return c};
cc.FlipX=cc.ActionInstant.extend({_flippedX:!1,ctor:function(){cc.FiniteTimeAction.prototype.ctor.call(this);this._flippedX=!1},initWithFlipX:function(a){this._flippedX=a;return!0},update:function(a){this._target.setFlippedX(this._flippedX)},reverse:function(){return cc.FlipX.create(!this._flippedX)},clone:function(){var a=new cc.FlipX;a.initWithFlipX(this._flippedX);return a}});cc.FlipX.create=function(a){var c=new cc.FlipX;return c.initWithFlipX(a)?c:null};
cc.FlipY=cc.ActionInstant.extend({_flippedY:!1,ctor:function(){cc.FiniteTimeAction.prototype.ctor.call(this);this._flippedY=!1},initWithFlipY:function(a){this._flippedY=a;return!0},update:function(a){this._target.setFlippedY(this._flippedY)},reverse:function(){return cc.FlipY.create(!this._flippedY)},clone:function(){var a=new cc.FlipY;a.initWithFlipY(this._flippedY);return a}});cc.FlipY.create=function(a){var c=new cc.FlipY;return c.initWithFlipY(a)?c:null};
cc.Place=cc.ActionInstant.extend({_position:null,ctor:function(){cc.FiniteTimeAction.prototype.ctor.call(this);this._position=cc.p(0,0)},initWithPosition:function(a){this._position.x=a.x;this._position.y=a.y;return!0},update:function(a){this._target.setPosition(this._position)},clone:function(){var a=new cc.Place;a.initWithPosition(this._position);return a}});cc.Place.create=function(a){var c=new cc.Place;c.initWithPosition(a);return c};
cc.CallFunc=cc.ActionInstant.extend({_selectorTarget:null,_callFunc:null,_function:null,_data:null,ctor:function(){cc.FiniteTimeAction.prototype.ctor.call(this);this._data=this._function=this._callFunc=this._selectorTarget=null},initWithTarget:function(a,c,d){this._data=d;this._callFunc=a;this._selectorTarget=c;return!0},initWithFunction:function(a){this._function=a;return!0},execute:function(){null!=this._callFunc?this._callFunc.call(this._selectorTarget,this._target,this._data):this._function&&
this._function.call(null,this._target)},update:function(a){this.execute()},getTargetCallback:function(){return this._selectorTarget},setTargetCallback:function(a){a!=this._selectorTarget&&(this._selectorTarget&&(this._selectorTarget=null),this._selectorTarget=a)},copy:function(){var a=new cc.CallFunc;this._selectorTarget?a.initWithTarget(this._callFunc,this._selectorTarget,this._data):this._function&&a.initWithFunction(this._function);return a},clone:function(){var a=new cc.CallFunc;this._selectorTarget?
a.initWithTarget(this._callFunc,this._selectorTarget,this._data):this._function&&a.initWithFunction(this._function);return a}});cc.CallFunc.create=function(a,c,d){var e=new cc.CallFunc;if(void 0===c){if(e&&e.initWithFunction(a))return e}else if(e&&e.initWithTarget(a,c,d))return e._callFunc=a,e;return null};cc.ActionCamera=cc.ActionInterval.extend({_centerXOrig:0,_centerYOrig:0,_centerZOrig:0,_eyeXOrig:0,_eyeYOrig:0,_eyeZOrig:0,_upXOrig:0,_upYOrig:0,_upZOrig:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._upZOrig=this._upYOrig=this._upXOrig=this._eyeZOrig=this._eyeYOrig=this._eyeXOrig=this._centerZOrig=this._centerYOrig=this._centerXOrig=0},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);a=a.getCamera();var c=a.getCenter();this._centerXOrig=c.x;
this._centerYOrig=c.y;this._centerZOrig=c.z;c=a.getEye();this._eyeXOrig=c.x;this._eyeYOrig=c.y;this._eyeZOrig=c.z;a=a.getUp();this._upXOrig=a.x;this._upYOrig=a.y;this._upZOrig=a.z},clone:function(){return new cc.ActionCamera},reverse:function(){return cc.ReverseTime.create(this)}});
cc.OrbitCamera=cc.ActionCamera.extend({_radius:0,_deltaRadius:0,_angleZ:0,_deltaAngleZ:0,_angleX:0,_deltaAngleX:0,_radZ:0,_radDeltaZ:0,_radX:0,_radDeltaX:0,ctor:function(){cc.ActionCamera.prototype.ctor.call(this);this._radDeltaX=this._radX=this._radDeltaZ=this._radZ=this._deltaAngleX=this._angleX=this._deltaAngleZ=this._angleZ=this._deltaRadius=this._radius=0},initWithDuration:function(a,c,d,e,f,g,h){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._radius=c,this._deltaRadius=
d,this._angleZ=e,this._deltaAngleZ=f,this._angleX=g,this._deltaAngleX=h,this._radDeltaZ=cc.DEGREES_TO_RADIANS(f),this._radDeltaX=cc.DEGREES_TO_RADIANS(h),!0):!1},sphericalRadius:function(){var a,c;c=this._target.getCamera();var d=c.getEye();a=c.getCenter();c=d.x-a.x;var e=d.y-a.y;a=d.z-a.z;var d=Math.sqrt(Math.pow(c,2)+Math.pow(e,2)+Math.pow(a,2)),f=Math.sqrt(Math.pow(c,2)+Math.pow(e,2));0===f&&(f=cc.FLT_EPSILON);0===d&&(d=cc.FLT_EPSILON);a=Math.acos(a/d);c=0>c?Math.PI-Math.asin(e/f):Math.asin(e/
f);return{newRadius:d/cc.Camera.getZEye(),zenith:a,azimuth:c}},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.RADIANS_TO_DEGREES(a.zenith));isNaN(this._angleX)&&(this._angleX=cc.RADIANS_TO_DEGREES(a.azimuth));this._radZ=cc.DEGREES_TO_RADIANS(this._angleZ);this._radX=cc.DEGREES_TO_RADIANS(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){var c=(this._radius+this._deltaRadius*a)*cc.Camera.getZEye(),d=this._radZ+this._radDeltaZ*a,e=this._radX+this._radDeltaX*a;a=Math.sin(d)*Math.cos(e)*c+this._centerXOrig;e=Math.sin(d)*Math.sin(e)*c+this._centerYOrig;c=Math.cos(d)*c+this._centerZOrig;this._target.getCamera().setEye(a,e,c)}});
cc.OrbitCamera.create=function(a,c,d,e,f,g,h){var k=new cc.OrbitCamera;return k.initWithDuration(a,c,d,e,f,g,h)?k:null};cc.ActionEase=cc.ActionInterval.extend({_inner:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._inner=null},initWithAction:function(a){if(!a)throw"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 cc.ActionEase.create(this._inner.reverse())},getInnerAction:function(){return this._inner}});cc.ActionEase.create=function(a){var c=new cc.ActionEase;c&&c.initWithAction(a);return c};
cc.EaseRateAction=cc.ActionEase.extend({_rate:0,ctor:function(){cc.ActionEase.prototype.ctor.call(this);this._rate=0},setRate:function(a){this._rate=a},getRate:function(){return this._rate},initWithAction:function(a,c){return cc.ActionEase.prototype.initWithAction.call(this,a)?(this._rate=c,!0):!1},clone:function(){var a=new cc.EaseRateAction;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return cc.EaseRateAction.create(this._inner.reverse(),1/this._rate)}});
cc.EaseRateAction.create=function(a,c){var d=new cc.EaseRateAction;d&&d.initWithAction(a,c);return d};cc.EaseIn=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,this._rate))},reverse:function(){return cc.EaseIn.create(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,c){var d=new cc.EaseIn;d&&d.initWithAction(a,c);return d};
cc.EaseOut=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,1/this._rate))},reverse:function(){return cc.EaseOut.create(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,c){var d=new cc.EaseOut;d&&d.initWithAction(a,c);return d};
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 cc.EaseInOut.create(this._inner.reverse(),this._rate)}});cc.EaseInOut.create=function(a,c){var d=new cc.EaseInOut;d&&d.initWithAction(a,c);return d};
cc.EaseExponentialIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a?0:Math.pow(2,10*(a-1)))},reverse:function(){return cc.EaseExponentialOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialIn;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialIn.create=function(a){var c=new cc.EaseExponentialIn;c&&c.initWithAction(a);return c};
cc.EaseExponentialOut=cc.ActionEase.extend({update:function(a){this._inner.update(1==a?1:-Math.pow(2,-10*a)+1)},reverse:function(){return cc.EaseExponentialIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialOut.create=function(a){var c=new cc.EaseExponentialOut;c&&c.initWithAction(a);return c};
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 cc.EaseExponentialInOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialInOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialInOut.create=function(a){var c=new cc.EaseExponentialInOut;c&&c.initWithAction(a);return c};
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 cc.EaseSineOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseSineIn;a.initWithAction(this._inner.clone());return a}});cc.EaseSineIn.create=function(a){var c=new cc.EaseSineIn;c&&c.initWithAction(a);return c};
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 cc.EaseSineIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseSineOut;a.initWithAction(this._inner.clone());return a}});cc.EaseSineOut.create=function(a){var c=new cc.EaseSineOut;c&&c.initWithAction(a);return c};
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 cc.EaseSineInOut.create(this._inner.reverse())}});cc.EaseSineInOut.create=function(a){var c=new cc.EaseSineInOut;c&&c.initWithAction(a);return c};
cc.EaseElastic=cc.ActionEase.extend({_period:null,ctor:function(){cc.ActionEase.prototype.ctor.call(this);this._period=0.3},getPeriod:function(){return this._period},setPeriod:function(a){this._period=a},initWithAction:function(a,c){cc.ActionEase.prototype.initWithAction.call(this,a);this._period=null==c?0.3:c;return!0},reverse:function(){cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.")},clone:function(){var a=new cc.EaseElastic;a.initWithAction(this._inner.clone(),this._period);
return a}});cc.EaseElastic.create=function(a,c){var d=new cc.EaseElastic;return d&&d.initWithAction(a,c)?d:null};cc.EaseElasticIn=cc.EaseElastic.extend({update:function(a){var c=0;0===a||1===a?c=a:(c=this._period/4,a-=1,c=-Math.pow(2,10*a)*Math.sin((a-c)*Math.PI*2/this._period));this._inner.update(c)},reverse:function(){return cc.EaseElasticOut.create(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,c){var d=new cc.EaseElasticIn;return d&&d.initWithAction(a,c)?d:null};cc.EaseElasticOut=cc.EaseElastic.extend({update:function(a){var c=0;0===a||1==a?c=a:(c=this._period/4,c=Math.pow(2,-10*a)*Math.sin((a-c)*Math.PI*2/this._period)+1);this._inner.update(c)},reverse:function(){return cc.EaseElasticIn.create(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,c){var d=new cc.EaseElasticOut;d&&d.initWithAction(a,c);return d};
cc.EaseElasticInOut=cc.EaseElastic.extend({update: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}this._inner.update(c)},reverse:function(){return cc.EaseElasticInOut.create(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,c){var d=new cc.EaseElasticInOut;d&&d.initWithAction(a,c);return d};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 cc.EaseBounce.create(this._inner.reverse())}});
cc.EaseBounce.create=function(a){var c=new cc.EaseBounce;c&&c.initWithAction(a);return c};cc.EaseBounceIn=cc.EaseBounce.extend({update:function(a){a=1-this.bounceTime(1-a);this._inner.update(a)},reverse:function(){return cc.EaseBounceOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceIn;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceIn.create=function(a){var c=new cc.EaseBounceIn;c&&c.initWithAction(a);return c};
cc.EaseBounceOut=cc.EaseBounce.extend({update:function(a){a=this.bounceTime(a);this._inner.update(a)},reverse:function(){return cc.EaseBounceIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceOut.create=function(a){var c=new cc.EaseBounceOut;c&&c.initWithAction(a);return c};
cc.EaseBounceInOut=cc.EaseBounce.extend({update:function(a){var c=0,c=0.5>a?0.5*(1-this.bounceTime(1-2*a)):0.5*this.bounceTime(2*a-1)+0.5;this._inner.update(c)},clone:function(){var a=new cc.EaseBounceInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseBounceInOut.create(this._inner.reverse())}});cc.EaseBounceInOut.create=function(a){var c=new cc.EaseBounceInOut;c&&c.initWithAction(a);return c};
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 cc.EaseBackOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBackIn;a.initWithAction(this._inner.clone());return a}});cc.EaseBackIn.create=function(a){var c=new cc.EaseBackIn;c&&c.initWithAction(a);return c};
cc.EaseBackOut=cc.ActionEase.extend({update:function(a){a-=1;this._inner.update(a*a*(2.70158*a+1.70158)+1)},reverse:function(){return cc.EaseBackIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBackOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBackOut.create=function(a){var c=new cc.EaseBackOut;c&&c.initWithAction(a);return c};
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 cc.EaseBackInOut.create(this._inner.reverse())}});cc.EaseBackInOut.create=function(a){var c=new cc.EaseBackInOut;c&&c.initWithAction(a);return c};cc.CardinalSplineAt=function(a,c,d,e,f,g){var h=g*g,k=h*g,m=(1-f)/2;f=m*(-k+2*h-g);var n=m*(-k+h)+(2*k-3*h+1);g=m*(k-2*h+g)+(-2*k+3*h);h=m*(k-h);return cc.p(a.x*f+c.x*n+d.x*g+e.x*h,a.y*f+c.y*n+d.y*g+e.y*h)};cc.reverseControlPoints=function(a){for(var c=[],d=a.length-1;0<=d;d--)c.push(cc.p(a[d].x,a[d].y));return c};cc.copyControlPoints=function(a){for(var c=[],d=0;d<a.length;d++)c.push(cc.p(a[d].x,a[d].y));return c};cc.getControlPointAt=function(a,c){var d=Math.min(a.length-1,Math.max(c,0));return a[d]};
cc.reverseControlPointsInline=function(a){for(var c=a.length,d=0|c/2,e=0;e<d;++e){var f=a[e];a[e]=a[c-e-1];a[c-e-1]=f}};
cc.CardinalSplineTo=cc.ActionInterval.extend({_points:null,_deltaT:0,_tension:0,_previousPosition:null,_accumulatedDiff:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._points=[];this._tension=this._deltaT=0;this._accumulatedDiff=this._previousPosition=null},initWithDuration:function(a,c,d){if(!c||0==c.length)throw"Invalid configuration. It must at least have one control point";return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this.setPoints(c),this._tension=
d,!0):!1},clone:function(){var a=new cc.CardinalSplineTo;a.initWithDuration(this._duration,cc.copyControlPoints(this._points),this._tension);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._deltaT=1/(this._points.length-1);a=this._target.getPosition();this._previousPosition=cc.p(a.x,a.y);this._accumulatedDiff=cc.p(0,0)},update:function(a){var c,d=this._points;if(1==a)c=d.length-1,a=1;else{var e=this._deltaT;c=0|a/e;a=(a-e*c)/e}c=cc.CardinalSplineAt(cc.getControlPointAt(d,
c-1),cc.getControlPointAt(d,c-0),cc.getControlPointAt(d,c+1),cc.getControlPointAt(d,c+2),this._tension,a);cc.ENABLE_STACKABLE_ACTIONS&&(d=this._target.getPositionX()-this._previousPosition.x,a=this._target.getPositionY()-this._previousPosition.y,0!=d||0!=a)&&(e=this._accumulatedDiff,d=e.x+d,a=e.y+a,e.x=d,e.y=a,c.x+=d,c.y+=a);this.updatePosition(c)},reverse:function(){var a=cc.reverseControlPoints(this._points);return cc.CardinalSplineTo.create(this._duration,a,this._tension)},updatePosition:function(a){this._target.setPosition(a);
this._previousPosition=a},getPoints:function(){return this._points},setPoints:function(a){this._points=a}});cc.CardinalSplineTo.create=function(a,c,d){var e=new cc.CardinalSplineTo;return e.initWithDuration(a,c,d)?e:null};
cc.CardinalSplineBy=cc.CardinalSplineTo.extend({_startPosition:null,ctor:function(){cc.CardinalSplineTo.prototype.ctor.call(this);this._startPosition=cc.p(0,0)},startWithTarget:function(a){cc.CardinalSplineTo.prototype.startWithTarget.call(this,a);a=a.getPosition();this._startPosition.x=a.x;this._startPosition.y=a.y},reverse:function(){for(var a=this._points.slice(),c,d=a[0],e=1;e<a.length;++e)c=a[e],a[e]=cc.pSub(c,d),d=c;a=cc.reverseControlPoints(a);d=a[a.length-1];a.pop();d.x=-d.x;d.y=-d.y;a.unshift(d);
for(e=1;e<a.length;++e)c=a[e],c.x=-c.x,c.y=-c.y,c.x+=d.x,c.y+=d.y,d=a[e]=c;return cc.CardinalSplineBy.create(this._duration,a,this._tension)},updatePosition:function(a){var c=this._startPosition,d=a.x+c.x;a=a.y+c.y;this._target.setPosition(d,a);this._previousPosition.x=d;this._previousPosition.y=a},clone:function(){var a=new cc.CardinalSplineBy;a.initWithDuration(this._duration,cc.copyControlPoints(this._points),this._tension);return a}});
cc.CardinalSplineBy.create=function(a,c,d){var e=new cc.CardinalSplineBy;return e.initWithDuration(a,c,d)?e:null};cc.CatmullRomTo=cc.CardinalSplineTo.extend({initWithDuration:function(a,c){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,a,c,0.5)},clone:function(){var a=new cc.CatmullRomTo;a.initWithDuration(this._duration,cc.copyControlPoints(this._points));return a}});cc.CatmullRomTo.create=function(a,c){var d=new cc.CatmullRomTo;return d.initWithDuration(a,c)?d:null};
cc.CatmullRomBy=cc.CardinalSplineBy.extend({initWithDuration:function(a,c){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,a,c,0.5)},clone:function(){var a=new cc.CatmullRomBy;a.initWithDuration(this._duration,cc.copyControlPoints(this._points));return a}});cc.CatmullRomBy.create=function(a,c){var d=new cc.CatmullRomBy;return d.initWithDuration(a,c)?d:null};cc.ActionTweenDelegate=cc.Class.extend({updateTweenAction:function(a,c){}});
cc.ActionTween=cc.ActionInterval.extend({key:"",from:0,to:0,delta:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this.key="";this.delta=this.to=this.from=0},initWithDuration:function(a,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this.key=c,this.to=e,this.from=d,!0):!1},startWithTarget:function(a){if(!a||!a.updateTweenAction)throw"cc.ActionTween.startWithTarget(): target must be non-null, and target must implement updateTweenAction function";cc.ActionInterval.prototype.startWithTarget.call(this,
a);this.delta=this.to-this.from},update:function(a){this._target.updateTweenAction(this.to-this.delta*(1-a),this.key)},reverse:function(){return cc.ActionTween.create(this.duration,this.key,this.to,this.from)},clone:function(){var a=new cc.ActionTween;a.initWithDuration(this._duration,this.key,this.from,this.to);return a}});cc.ActionTween.create=function(a,c,d,e){var f=new cc.ActionTween;return f.initWithDuration(a,c,d,e)?f:null};cc.GridAction=cc.ActionInterval.extend({_gridSize:null,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._gridSize=cc.size(0,0)},clone:function(){var a=new cc.GridAction,c=this._gridSize;a.initWithDuration(this._duration,cc.size(c.width,c.height));return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var c=this.getGrid(),d=this._target;(a=d.getGrid())&&0<a.getReuseGrid()?(c=a.getGridSize(),a.isActive()&&c.width==this._gridSize.width&&c.height==
this._gridSize.height&&a.reuse()):(a&&a.isActive()&&a.setActive(!1),d.setGrid(c),d.getGrid().setActive(!0))},reverse:function(){return cc.ReverseTime.create(this)},initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._gridSize.width=c.width,this._gridSize.height=c.height,!0):!1},getGrid:function(){cc.log("cc.GridAction.getGrid(): it should be overridden in subclass.")}});
cc.GridAction.create=function(a,c){var d=new cc.GridAction;d.initWithDuration(a,c);return d};cc.Grid3DAction=cc.GridAction.extend({getGrid:function(){return cc.Grid3D.create(this._gridSize)},vertex:function(a){return this._target.getGrid().vertex(a)},originalVertex:function(a){return this._target.getGrid().originalVertex(a)},setVertex:function(a,c){this._target.getGrid().setVertex(a,c)}});cc.Grid3DAction.create=function(a,c){var d=new cc.Grid3DAction;d.initWithDuration(a,c);return d};
cc.TiledGrid3DAction=cc.GridAction.extend({tile:function(a){return this._target.getGrid().tile(a)},originalTile:function(a){return this._target.getGrid().originalTile(a)},setTile:function(a,c){this._target.getGrid().setTile(a,c)},getGrid:function(){return cc.TiledGrid3D.create(this._gridSize)}});cc.TiledGrid3DAction.create=function(a,c){var d=new cc.TiledGrid3DAction;d.initWithDuration(a,c);return d};
cc.StopGrid=cc.ActionInstant.extend({startWithTarget:function(a){cc.ActionInstant.prototype.startWithTarget.call(this,a);(a=this._target.getGrid())&&a.isActive()&&a.setActive(!1)}});cc.StopGrid.create=function(){return new cc.StopGrid};
cc.ReuseGrid=cc.ActionInstant.extend({_times:null,initWithTimes:function(a){this._times=a;return!0},startWithTarget:function(a){cc.ActionInstant.prototype.startWithTarget.call(this,a);this._target.getGrid()&&this._target.getGrid().isActive()&&this._target.getGrid().setReuseGrid(this._target.getGrid().getReuseGrid()+this._times)}});cc.ReuseGrid.create=function(a){return new cc.ReuseGrid};cc.RAND_MAX=16777215;cc.rand=function(){return Math.random()*cc.RAND_MAX};
cc.Waves3D=cc.Grid3DAction.extend({_waves:null,_amplitude:null,_amplitudeRate:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._amplitudeRate=this._amplitude=this._waves=0},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,c,d,e){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,c)?(this._waves=
d,this._amplitude=e,this._amplitudeRate=1,!0):!1},update:function(a){for(var c=this._gridSize,d=this._amplitude,e=cc.p(0,0),f=this._amplitudeRate,g=this._waves,h=0;h<c.width+1;++h)for(var k=0;k<c.height+1;++k){e.x=h;e.y=k;var m=this.originalVertex(e);m.z+=Math.sin(Math.PI*a*g*2+0.01*(m.y+m.x))*d*f;this.setVertex(e,m)}}});cc.Waves3D.create=function(a,c,d,e){var f=new cc.Waves3D;f.initWithDuration(a,c,d,e);return f};
cc.FlipX3D=cc.Grid3DAction.extend({initWithDuration:function(a){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,cc.size(1,1))},initWithSize:function(a,c){return 1!=a.width||1!=a.height?(cc.log("Grid size must be (1,1)"),!1):cc.Grid3DAction.prototype.initWithDuration.call(this,c,a)},update:function(a){var c=Math.PI*a;a=Math.sin(c);var d=Math.cos(c/2),c=new cc.Vertex3F,e=cc.p(0,0);e.x=e.y=1;var f=this.originalVertex(e);e.x=e.y=0;var e=this.originalVertex(e),g=f.x,h=e.x,k,m;g>h?(f=cc.p(0,
0),e=cc.p(0,1),k=cc.p(1,0),m=cc.p(1,1)):(k=cc.p(0,0),m=cc.p(0,1),f=cc.p(1,0),e=cc.p(1,1),g=h);c.x=g-g*d;c.z=Math.abs(parseFloat(g*a/4));a=this.originalVertex(f);a.x=c.x;a.z+=c.z;this.setVertex(f,a);a=this.originalVertex(e);a.x=c.x;a.z+=c.z;this.setVertex(e,a);a=this.originalVertex(k);a.x-=c.x;a.z-=c.z;this.setVertex(k,a);a=this.originalVertex(m);a.x-=c.x;a.z-=c.z;this.setVertex(m,a)}});cc.FlipX3D.create=function(a){var c=new cc.FlipX3D;c.initWithDuration(a);return c};
cc.FlipY3D=cc.FlipX3D.extend({update:function(a){var c=Math.PI*a;a=Math.sin(c);var d=Math.cos(c/2),c=new cc.Vertex3F,e=cc.p(0,0);e.x=e.y=1;var f=this.originalVertex(e);e.x=e.y=0;var e=this.originalVertex(e),g=f.y,h=e.y,k,m;g>h?(f=cc.p(0,0),e=cc.p(0,1),k=cc.p(1,0),m=cc.p(1,1)):(e=cc.p(0,0),f=cc.p(0,1),m=cc.p(1,0),k=cc.p(1,1),g=h);c.y=g-g*d;c.z=Math.abs(parseFloat(g*a)/4);a=this.originalVertex(f);a.y=c.y;a.z+=c.z;this.setVertex(f,a);a=this.originalVertex(e);a.y-=c.y;a.z-=c.z;this.setVertex(e,a);a=this.originalVertex(k);
a.y=c.y;a.z+=c.z;this.setVertex(k,a);a=this.originalVertex(m);a.y-=c.y;a.z-=c.z;this.setVertex(m,a)}});cc.FlipY3D.create=function(a){var c=new cc.FlipY3D;c.initWithDuration(a);return c};
cc.Lens3D=cc.Grid3DAction.extend({_position:null,_radius:0,_lensEffect:0,_concave:!1,_dirty:!1,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);this._lensEffect=this._radius=0;this._dirty=this._concave=!1},getLensEffect:function(){return this._lensEffect},setLensEffect:function(a){this._lensEffect=a},setConcave:function(a){this._concave=a},getPosition:function(){return cc.p(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,c,d,e){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,c)?(this.setPosition(d),this._radius=e,this._lensEffect=0.7,this._dirty=!0):!1},update:function(a){if(this._dirty){a=this._gridSize.width;for(var c=this._gridSize.height,d=this._radius,e=this._lensEffect,f=cc.p(0,0),g=cc.p(0,0),h,k,m,n=0;n<a+1;++n)for(var p=0;p<c+1;++p)f.x=n,f.y=p,h=this.originalVertex(f),g.x=this._position.x-h.x,g.y=this._position.y-h.y,k=cc.pLength(g),
k<d&&(k=d-k,k/=d,0==k&&(k=0.001),k=Math.log(k)*e,m=Math.exp(k)*d,k=cc.pLength(g),0<k&&(g.x/=k,g.y/=k,g.x*=m,g.y*=m,h.z+=cc.pLength(g)*e)),this.setVertex(f,h);this._dirty=!1}}});cc.Lens3D.create=function(a,c,d,e){var f=new cc.Lens3D;f.initWithDuration(a,c,d,e);return f};
cc.Ripple3D=cc.Grid3DAction.extend({_position:null,_radius:null,_waves:null,_amplitude:null,_amplitudeRate:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);this._amplitudeRate=this._amplitude=this._waves=this._radius=0},getPosition:function(){return cc.p(this._position)},setPosition:function(a){this._position.x=a.x;this._position.y=a.y},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},
setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,c,d,e,f,g){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,c)?(this.setPosition(d),this._radius=e,this._waves=f,this._amplitude=g,this._amplitudeRate=1,!0):!1},update:function(a){for(var c=this._gridSize.width,d=this._gridSize.height,e=cc.p(0,0),f=this._radius,g=this._waves,h=this._amplitude,k=this._amplitudeRate,m,n,p=cc.p(0,0),q=0;q<c+1;++q)for(var s=0;s<d+1;++s){e.x=q;e.y=s;m=this.originalVertex(e);p.x=
this._position.x-m.x;p.y=this._position.y-m.y;n=cc.pLength(p);if(n<f){n=f-n;var r=Math.pow(n/f,2);m.z+=Math.sin(a*Math.PI*g*2+0.1*n)*h*k*r}this.setVertex(e,m)}}});cc.Ripple3D.create=function(a,c,d,e,f,g){var h=new cc.Ripple3D;h.initWithDuration(a,c,d,e,f,g);return h};
cc.Shaky3D=cc.Grid3DAction.extend({_randRange:null,_shakeZ:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._randRange=0;this._shakeZ=!1},initWithDuration:function(a,c,d,e){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,c)?(this._randRange=d,this._shakeZ=e,!0):!1},update:function(a){a=this._gridSize.width;for(var c=this._gridSize.height,d=this._randRange,e=this._shakeZ,f=cc.p(0,0),g,h=0;h<a+1;++h)for(var k=0;k<c+1;++k)f.x=h,f.y=k,g=this.originalVertex(f),g.x+=cc.rand()%
(2*d)-d,g.y+=cc.rand()%(2*d)-d,e&&(g.z+=cc.rand()%(2*d)-d),this.setVertex(f,g)}});cc.Shaky3D.create=function(a,c,d,e){var f=new cc.Shaky3D;f.initWithDuration(a,c,d,e);return f};
cc.Liquid=cc.Grid3DAction.extend({_waves:null,_amplitude:null,_amplitudeRate:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._amplitudeRate=this._amplitude=this._waves=0},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,c,d,e){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,c)?(this._waves=
d,this._amplitude=e,this._amplitudeRate=1,!0):!1},update:function(a){for(var c=this._gridSize.width,d=this._gridSize.height,e=cc.p(0,0),f=this._waves,g=this._amplitude,h=this._amplitudeRate,k,m=1;m<c;++m)for(var n=1;n<d;++n)e.x=m,e.y=n,k=this.originalVertex(e),k.x+=Math.sin(a*Math.PI*f*2+0.01*k.x)*g*h,k.y+=Math.sin(a*Math.PI*f*2+0.01*k.y)*g*h,this.setVertex(e,k)}});cc.Liquid.create=function(a,c,d,e){var f=new cc.Liquid;f.initWithDuration(a,c,d,e);return f};
cc.Waves=cc.Grid3DAction.extend({_waves:null,_amplitude:null,_amplitudeRate:null,_vertical:null,_horizontal:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._amplitudeRate=this._amplitude=this._waves=0;this._horizontal=this._vertical=!1},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,c,d,e,f,g){return cc.Grid3DAction.prototype.initWithDuration.call(this,
a,c)?(this._waves=d,this._amplitude=e,this._amplitudeRate=1,this._horizontal=f,this._vertical=g,!0):!1},update:function(a){for(var c=this._gridSize.width,d=this._gridSize.height,e=cc.p(0,0),f=this._vertical,g=this._horizontal,h=this._waves,k=this._amplitude,m=this._amplitudeRate,n,p=0;p<c+1;++p)for(var q=0;q<d+1;++q)e.x=p,e.y=q,n=this.originalVertex(e),f&&(n.x+=Math.sin(a*Math.PI*h*2+0.01*n.y)*k*m),g&&(n.y+=Math.sin(a*Math.PI*h*2+0.01*n.x)*k*m),this.setVertex(e,n)}});
cc.Waves.create=function(a,c,d,e,f,g){var h=new cc.Waves;h.initWithDuration(a,c,d,e,f,g);return h};
cc.Twirl=cc.Grid3DAction.extend({_position:null,_twirls:null,_amplitude:null,_amplitudeRate:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);this._amplitudeRate=this._amplitude=this._twirls=0},getPosition:function(){return cc.p(this._position)},setPosition:function(a){this._position.x=a.x;this._position.y=a.y},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=
a},initWithDuration:function(a,c,d,e,f){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,c)?(this.setPosition(d),this._twirls=e,this._amplitude=f,this._amplitudeRate=1,!0):!1},update:function(a){for(var c=this._position,d=this._gridSize.width,e=this._gridSize.height,f=cc.p(0,0),g=0.1*this._amplitude*this._amplitudeRate,h=this._twirls,k,m,n,p=cc.p(0,0),q=0;q<d+1;++q)for(var s=0;s<e+1;++s)f.x=q,f.y=s,k=this.originalVertex(f),p.x=q-d/2,p.y=s-e/2,m=cc.pLength(p)*Math.cos(Math.PI/2+a*Math.PI*
h*2)*g,n=Math.sin(m)*(k.y-c.y)+Math.cos(m)*(k.x-c.x),m=Math.cos(m)*(k.y-c.y)-Math.sin(m)*(k.x-c.x),k.x=c.x+n,k.y=c.y+m,this.setVertex(f,k)}});cc.Twirl.create=function(a,c,d,e,f){var g=new cc.Twirl;g.initWithDuration(a,c,d,e,f);return g};cc.ShakyTiles3D=cc.TiledGrid3DAction.extend({_randRange:0,_shakeZ:!1,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._randRange=0;this._shakeZ=!1},initWithDuration:function(a,c,d,e){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,c)?(this._randRange=d,this._shakeZ=e,!0):!1},update:function(a){a=this._gridSize;for(var c=this._randRange,d=cc.p(0,0),e=0;e<a.width;++e)for(var f=0;f<a.height;++f){d.x=e;d.y=f;var g=this.originalTile(d);g.bl.x+=cc.rand()%(2*c)-c;g.br.x+=cc.rand()%
(2*c)-c;g.tl.x+=cc.rand()%(2*c)-c;g.tr.x+=cc.rand()%(2*c)-c;g.bl.y+=cc.rand()%(2*c)-c;g.br.y+=cc.rand()%(2*c)-c;g.tl.y+=cc.rand()%(2*c)-c;g.tr.y+=cc.rand()%(2*c)-c;this._shakeZ&&(g.bl.z+=cc.rand()%(2*c)-c,g.br.z+=cc.rand()%(2*c)-c,g.tl.z+=cc.rand()%(2*c)-c,g.tr.z+=cc.rand()%(2*c)-c);this.setTile(d,g)}}});cc.ShakyTiles3D.create=function(a,c,d,e){var f=new cc.ShakyTiles3D;f.initWithDuration(a,c,d,e);return f};
cc.ShatteredTiles3D=cc.TiledGrid3DAction.extend({_randRange:0,_once:!1,_shatterZ:!1,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._randRange=0;this._once=this._shakeZ=!1},initWithDuration:function(a,c,d,e){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,c)?(this._once=!1,this._randRange=d,this._shatterZ=e,!0):!1},update:function(a){if(!1===this._once){a=this._gridSize;for(var c=this._randRange,d,e=cc.p(0,0),f=0;f<a.width;++f)for(var g=0;g<a.height;++g)e.x=f,e.y=g,
d=this.originalTile(e),d.bl.x+=cc.rand()%(2*c)-c,d.br.x+=cc.rand()%(2*c)-c,d.tl.x+=cc.rand()%(2*c)-c,d.tr.x+=cc.rand()%(2*c)-c,d.bl.y+=cc.rand()%(2*c)-c,d.br.y+=cc.rand()%(2*c)-c,d.tl.y+=cc.rand()%(2*c)-c,d.tr.y+=cc.rand()%(2*c)-c,this._shatterZ&&(d.bl.z+=cc.rand()%(2*c)-c,d.br.z+=cc.rand()%(2*c)-c,d.tl.z+=cc.rand()%(2*c)-c,d.tr.z+=cc.rand()%(2*c)-c),this.setTile(e,d);this._once=!0}}});cc.ShatteredTiles3D.create=function(a,c,d,e){var f=new cc.ShatteredTiles3D;f.initWithDuration(a,c,d,e);return f};
cc.Tile=function(a,c,d){this.position=a||cc.POINT_ZERO;this.startPosition=c||cc.POINT_ZERO;this.delta=d||cc.POINT_ZERO};
cc.ShuffleTiles=cc.TiledGrid3DAction.extend({_seed:0,_tilesCount:0,_tilesOrder:null,_tiles:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];this._tiles=[];this._tilesCount=this._seed=0},initWithDuration:function(a,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,c)?(this._seed=d,this._tilesOrder.length=0,this._tiles.length=0,!0):!1},shuffle:function(a,c){for(var d=c-1;0<=d;d--){var e=0|cc.rand()%(d+1),f=a[d];a[d]=a[e];a[e]=f}},getDelta:function(a){var c=
this._gridSize,d=a.width*c.height+a.height;return cc.size(this._tilesOrder[d]/c.height-a.width,this._tilesOrder[d]%c.height-a.height)},placeTile:function(a,c){var d=this.originalTile(a),e=this._target.getGrid().getStep(),f=c.position;d.bl.x+=f.x*e.x;d.bl.y+=f.y*e.y;d.br.x+=f.x*e.x;d.br.y+=f.y*e.y;d.tl.x+=f.x*e.x;d.tl.y+=f.y*e.y;d.tr.x+=f.x*e.x;d.tr.y+=f.y*e.y;this.setTile(a,d)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);a=this._gridSize;this._tilesCount=
a.width*a.height;for(var c=this._tilesOrder,d=c.length=0;d<this._tilesCount;++d)c[d]=d;this.shuffle(c,this._tilesCount);for(var c=this._tiles,d=c.length=0,e=cc.size(0,0),f=0;f<a.width;++f)for(var g=0;g<a.height;++g)c[d]=new cc.Tile,c[d].position=cc.p(f,g),c[d].startPosition=cc.p(f,g),e.width=f,e.height=g,c[d].delta=this.getDelta(e),++d},update:function(a){for(var c=0,d=this._gridSize,e=this._tiles,f,g=cc.p(0,0),h=0;h<d.width;++h)for(var k=0;k<d.height;++k)g.x=h,g.y=k,f=e[c],f.position.x=f.delta.width*
a,f.position.y=f.delta.height*a,this.placeTile(g,f),++c}});cc.ShuffleTiles.create=function(a,c,d){var e=new cc.ShuffleTiles;e.initWithDuration(a,c,d);return e};
cc.FadeOutTRTiles=cc.TiledGrid3DAction.extend({testFunc:function(a,c){var d=this._gridSize.width*c,e=this._gridSize.height*c;return 0==d+e?1:Math.pow((a.width+a.height)/(d+e),6)},turnOnTile:function(a){this.setTile(a,this.originalTile(a))},turnOffTile:function(a){this.setTile(a,new cc.Quad3)},transformTile:function(a,c){var d=this.originalTile(a),e=this._target.getGrid().getStep();d.bl.x+=e.x/2*(1-c);d.bl.y+=e.y/2*(1-c);d.br.x-=e.x/2*(1-c);d.br.y+=e.y/2*(1-c);d.tl.x+=e.x/2*(1-c);d.tl.y-=e.y/2*(1-
c);d.tr.x-=e.x/2*(1-c);d.tr.y-=e.y/2*(1-c);this.setTile(a,d)},update:function(a){for(var c=this._gridSize,d=cc.p(0,0),e=cc.size(0,0),f,g=0;g<c.width;++g)for(var h=0;h<c.height;++h)d.x=g,d.y=h,e.width=g,e.height=h,f=this.testFunc(e,a),0==f?this.turnOffTile(d):1>f?this.transformTile(d,f):this.turnOnTile(d)}});cc.FadeOutTRTiles.create=function(a,c){var d=new cc.FadeOutTRTiles;d.initWithDuration(a,c);return d};
cc.FadeOutBLTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,c){return 0==a.width+a.height?1:Math.pow((this._gridSize.width*(1-c)+this._gridSize.height*(1-c))/(a.width+a.height),6)}});cc.FadeOutBLTiles.create=function(a,c){var d=new cc.FadeOutBLTiles;d.initWithDuration(a,c);return d};
cc.FadeOutUpTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,c){var d=this._gridSize.height*c;return 0==d?1:Math.pow(a.height/d,6)},transformTile:function(a,c){var d=this.originalTile(a),e=this._target.getGrid().getStep();d.bl.y+=e.y/2*(1-c);d.br.y+=e.y/2*(1-c);d.tl.y-=e.y/2*(1-c);d.tr.y-=e.y/2*(1-c);this.setTile(a,d)}});cc.FadeOutUpTiles.create=function(a,c){var d=new cc.FadeOutUpTiles;d.initWithDuration(a,c);return d};
cc.FadeOutDownTiles=cc.FadeOutUpTiles.extend({testFunc:function(a,c){return 0==a.height?1:Math.pow(this._gridSize.height*(1-c)/a.height,6)}});cc.FadeOutDownTiles.create=function(a,c){var d=new cc.FadeOutDownTiles;d.initWithDuration(a,c);return d};
cc.TurnOffTiles=cc.TiledGrid3DAction.extend({_seed:null,_tilesCount:0,_tilesOrder:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];this._seed=null;this._tilesCount=0},initWithDuration:function(a,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,c)?(this._seed=d,this._tilesOrder.length=0,!0):!1},shuffle:function(a,c){for(var d=c-1;0<=d;d--){var e=0|cc.rand()%(d+1),f=a[d];a[d]=a[e];a[e]=f}},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 c=a.length=0;c<this._tilesCount;++c)a[c]=c;this.shuffle(a,this._tilesCount)},update:function(a){a=0|a*this._tilesCount;for(var c=this._gridSize,d,e=cc.p(0,0),f=this._tilesOrder,g=0;g<this._tilesCount;g++)d=f[g],e.x=0|d/c.height,e.y=d%(0|c.height),g<a?this.turnOffTile(e):this.turnOnTile(e)}});
cc.TurnOffTiles.create=function(a,c,d){d=d||0;var e=new cc.TurnOffTiles;e.initWithDuration(a,c,d);return e};
cc.WavesTiles3D=cc.TiledGrid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._amplitudeRate=this._amplitude=this._waves=0},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,c,d,e){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,c)?(this._waves=
d,this._amplitude=e,this._amplitudeRate=1,!0):!1},update:function(a){for(var c=this._gridSize,d=this._waves,e=this._amplitude,f=this._amplitudeRate,g=cc.p(0,0),h,k=0;k<c.width;k++)for(var m=0;m<c.height;m++)g.x=k,g.y=m,h=this.originalTile(g),h.bl.z=Math.sin(a*Math.PI*d*2+0.01*(h.bl.y+h.bl.x))*e*f,h.br.z=h.bl.z,h.tl.z=h.bl.z,h.tr.z=h.bl.z,this.setTile(g,h)}});cc.WavesTiles3D.create=function(a,c,d,e){var f=new cc.WavesTiles3D;f.initWithDuration(a,c,d,e);return f};
cc.JumpTiles3D=cc.TiledGrid3DAction.extend({_jumps:0,_amplitude:0,_amplitudeRate:0,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._amplitudeRate=this._amplitude=this._jumps=0},getAmplitude:function(){return this._amplitude},setAmplitude:function(a){this._amplitude=a},getAmplitudeRate:function(){return this._amplitudeRate},setAmplitudeRate:function(a){this._amplitudeRate=a},initWithDuration:function(a,c,d,e){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,c)?(this._jumps=
d,this._amplitude=e,this._amplitudeRate=1,!0):!1},update:function(a){var c=Math.sin(Math.PI*a*this._jumps*2)*this._amplitude*this._amplitudeRate;a=Math.sin(Math.PI*(a*this._jumps*2+1))*this._amplitude*this._amplitudeRate;for(var d=this._gridSize,e=this._target.getGrid(),f,g=cc.p(0,0),h=0;h<d.width;h++)for(var k=0;k<d.height;k++)g.x=h,g.y=k,f=e.originalTile(g),0==(h+k)%2?(f.bl.z+=c,f.br.z+=c,f.tl.z+=c,f.tr.z+=c):(f.bl.z+=a,f.br.z+=a,f.tl.z+=a,f.tr.z+=a),e.setTile(g,f)}});
cc.JumpTiles3D.create=function(a,c,d,e){var f=new cc.JumpTiles3D;f.initWithDuration(a,c,d,e);return f};
cc.SplitRows=cc.TiledGrid3DAction.extend({_rows:0,_winSize:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._rows=0;this._winSize=null},initWithDuration:function(a,c){this._rows=c;return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,cc.size(1,c))},update:function(a){for(var c=this._gridSize,d=this._winSize.width,e,f,g=cc.p(0,0),h=0;h<c.height;++h)g.y=h,e=this.originalTile(g),f=1,0==h%2&&(f=-1),e.bl.x+=f*d*a,e.br.x+=f*d*a,e.tl.x+=f*d*a,e.tr.x+=f*d*a,this.setTile(g,e)},
startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._winSize=cc.Director.getInstance().getWinSizeInPixels()}});cc.SplitRows.create=function(a,c){var d=new cc.SplitRows;d.initWithDuration(a,c);return d};
cc.SplitCols=cc.TiledGrid3DAction.extend({_cols:0,_winSize:null,ctor:function(){cc.GridAction.prototype.ctor.call(this);this._cols=0;this._winSize=null},initWithDuration:function(a,c){this._cols=c;return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,cc.size(c,1))},update:function(a){for(var c=this._gridSize.width,d=this._winSize.height,e,f,g=cc.p(0,0),h=0;h<c;++h)g.x=h,e=this.originalTile(g),f=1,0==h%2&&(f=-1),e.bl.y+=f*d*a,e.br.y+=f*d*a,e.tl.y+=f*d*a,e.tr.y+=f*d*a,this.setTile(g,e)},
startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._winSize=cc.Director.getInstance().getWinSizeInPixels()}});cc.SplitCols.create=function(a,c){var d=new cc.SplitCols;d.initWithDuration(a,c);return d};cc.PageTurn3D=cc.Grid3DAction.extend({update:function(a){var c=Math.max(0,a-0.25),c=-100-c*c*500;a=-Math.PI/2*Math.sqrt(a);var d=+Math.PI/2+a;a=Math.sin(d);for(var d=Math.cos(d),e=this._gridSize,f=cc.p(0,0),g=0;g<=e.width;++g)for(var h=0;h<=e.height;++h){f.x=g;f.y=h;var k=this.originalVertex(f),m=Math.sqrt(k.x*k.x+(k.y-c)*(k.y-c)),n=m*a,p=Math.asin(k.x/m)/a,q=Math.cos(p);k.x=p<=Math.PI?n*Math.sin(p):0;k.y=m+c-n*(1-q)*a;k.z=n*(1-q)*d/7;0.5>k.z&&(k.z=0.5);this.setVertex(f,k)}}});
cc.PageTurn3D.create=function(a,c){var d=new cc.PageTurn3D;d.initWithDuration(a,c);return d};cc.PROGRESS_TIMER_TYPE_RADIAL=0;cc.PROGRESS_TIMER_TYPE_BAR=1;cc.PROGRESS_TEXTURE_COORDS_COUNT=4;cc.PROGRESS_TEXTURE_COORDS=75;
cc.ProgressTimer=cc.NodeRGBA.extend({_type:null,_percentage:0,_sprite:null,_midPoint:null,_barChangeRate:null,_reverseDirection:!1,getMidpoint:function(){return cc.p(this._midPoint.x,this._midPoint)},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._updateProgress())},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isReverseDirection:function(){return this._reverseDirection},_boundaryTexCoord:function(a){if(a<cc.PROGRESS_TEXTURE_COORDS_COUNT){var c=cc.PROGRESS_TEXTURE_COORDS;return this._reverseDirection?cc.p(c>>7-(a<<1)&1,c>>7-((a<<1)+1)&1):cc.p(c>>(a<<1)+1&1,c>>(a<<1)&1)}return cc.PointZero()},
_origin:null,_startAngle:270,_endAngle:270,_radius:0,_counterClockWise:!1,_barRect:null,_vertexDataCount:0,_vertexData:null,_vertexArrayBuffer:null,_vertexWebGLBuffer:null,_vertexDataDirty:!1,ctor:null,_ctorForCanvas:function(){cc.NodeRGBA.prototype.ctor.call(this);this._type=cc.PROGRESS_TIMER_TYPE_RADIAL;this._percentage=0;this._midPoint=cc.p(0,0);this._barChangeRate=cc.p(0,0);this._reverseDirection=!1;this._sprite=null;this._origin=cc.PointZero();this._endAngle=this._startAngle=270;this._radius=
0;this._counterClockWise=!1;this._barRect=cc.RectZero()},_ctorForWebGL:function(){cc.NodeRGBA.prototype.ctor.call(this);this._type=cc.PROGRESS_TIMER_TYPE_RADIAL;this._percentage=0;this._midPoint=cc.p(0,0);this._barChangeRate=cc.p(0,0);this._reverseDirection=!1;this._sprite=null;this._vertexWebGLBuffer=cc.renderContext.createBuffer();this._vertexDataCount=0;this._vertexArrayBuffer=this._vertexData=null;this._vertexDataDirty=!1},setColor:function(a){this._sprite.setColor(a);this._updateColor()},setOpacity:function(a){this._sprite.setOpacity(a);
this._updateColor()},getColor:function(){return this._sprite.getColor()},getOpacity:function(){return this._sprite.getOpacity()},setReverseProgress:null,_setReverseProgressForCanvas:function(a){this._reverseDirection!==a&&(this._reverseDirection=a)},_setReverseProgressForWebGL:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0)},setSprite:null,_setSpriteForCanvas:function(a){this._sprite!=a&&(this._sprite=a,this.setContentSize(this._sprite.getContentSize()))},
_setSpriteForWebGL:function(a){a&&this._sprite!=a&&(this._sprite=a,this.setContentSize(a.getContentSize()),this._vertexData&&(this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0))},setType:null,_setTypeForCanvas:function(a){a!==this._type&&(this._type=a)},_setTypeForWebGL:function(a){a!==this._type&&(this._vertexData&&(this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0),this._type=a)},setReverseDirection:null,_setReverseDirectionForCanvas:function(a){this._reverseDirection!==
a&&(this._reverseDirection=a)},_setReverseDirectionForWebGL:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0)},_textureCoordFromAlphaPoint:function(a){var c=this._sprite;if(!c)return{u:0,v:0};var d=c.getQuad(),e=cc.p(d.bl.texCoords.u,d.bl.texCoords.v),d=cc.p(d.tr.texCoords.u,d.tr.texCoords.v);c.isTextureRectRotated()&&(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}},_vertexFromAlphaPoint:function(a){if(!this._sprite)return{x:0,
y:0};var c=this._sprite.getQuad(),d=cc.p(c.bl.vertices.x,c.bl.vertices.y),c=cc.p(c.tr.vertices.x,c.tr.vertices.y);return{x:d.x*(1-a.x)+c.x*a.x,y:d.y*(1-a.y)+c.y*a.y}},initWithSprite:null,_initWithSpriteForCanvas:function(a){this.setPercentage(0);this.setAnchorPoint(0.5,0.5);this._type=cc.PROGRESS_TIMER_TYPE_RADIAL;this._reverseDirection=!1;this.setMidpoint(cc.p(0.5,0.5));this.setBarChangeRate(cc.p(1,1));this.setSprite(a);return!0},_initWithSpriteForWebGL:function(a){this.setPercentage(0);this._vertexArrayBuffer=
this._vertexData=null;this._vertexDataCount=0;this.setAnchorPoint(0.5,0.5);this._type=cc.PROGRESS_TIMER_TYPE_RADIAL;this._reverseDirection=!1;this.setMidpoint(cc.p(0.5,0.5));this.setBarChangeRate(cc.p(1,1));this.setSprite(a);this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR));return!0},draw:null,_drawForCanvas:function(a){a=a||cc.renderContext;var c=this._sprite;c._isLighterMode&&(a.globalCompositeOperation="lighter");var d=cc.EGLView.getInstance().getScaleX(),
e=cc.EGLView.getInstance().getScaleY();a.globalAlpha=c._displayedOpacity/255;var f=c._rect,g=c._contentSize,h=c._offsetPosition,k=c._drawSize_Canvas,m=0|h.x,n=-h.y-f.height,p=c._textureRect_Canvas;k.width=f.width*d;k.height=f.height*e;a.save();c._flippedX&&(m=-h.x-f.width,a.scale(-1,1));c._flippedY&&(n=h.y,a.scale(1,-1));m*=d;n*=e;this._type==cc.PROGRESS_TIMER_TYPE_BAR?(f=this._barRect,a.beginPath(),a.rect(f.x*d,f.y*e,f.width*d,f.height*e),a.clip(),a.closePath()):this._type==cc.PROGRESS_TIMER_TYPE_RADIAL&&
(f=this._origin.x*d,h=this._origin.y*e,a.beginPath(),a.arc(f,h,this._radius*e,Math.PI/180*this._startAngle,Math.PI/180*this._endAngle,this._counterClockWise),a.lineTo(f,h),a.clip(),a.closePath());c._texture&&p.validRect?(d=c._texture.getHtmlElementObj(),this._colorized?a.drawImage(d,0,0,p.width,p.height,m,n,k.width,k.height):a.drawImage(d,p.x,p.y,p.width,p.height,m,n,k.width,k.height)):0!==g.width&&(k=this.getColor(),a.fillStyle="rgba("+k.r+","+k.g+","+k.b+",1)",a.fillRect(m,n,g.width*d,g.height*
e));a.restore();cc.INCREMENT_GL_DRAWS(1)},_drawForWebGL:function(a){a=a||cc.renderContext;if(this._vertexData&&this._sprite){cc.NODE_DRAW_SETUP(this);var c=this._sprite.getBlendFunc();cc.glBlendFunc(c.src,c.dst);cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);this._sprite.getTexture()?cc.glBindTexture2D(this._sprite.getTexture()):cc.glBindTexture2D(null);a.bindBuffer(a.ARRAY_BUFFER,this._vertexWebGLBuffer);this._vertexDataDirty&&(a.bufferData(a.ARRAY_BUFFER,this._vertexArrayBuffer,a.DYNAMIC_DRAW),
this._vertexDataDirty=!1);c=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,c,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,c,8);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,c,12);this._type===cc.PROGRESS_TIMER_TYPE_RADIAL?a.drawArrays(a.TRIANGLE_FAN,0,this._vertexDataCount):this._type==cc.PROGRESS_TIMER_TYPE_BAR&&(this._reverseDirection?(a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount/2),a.drawArrays(a.TRIANGLE_STRIP,
4,this._vertexDataCount/2),cc.g_NumberOfDraws++):a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount));cc.g_NumberOfDraws++}},_updateRadial:function(){if(this._sprite){var a,c=this._midPoint;a=this._percentage/100;var d=2*cc.PI*(this._reverseDirection?a:1-a),e=cc.p(c.x,1),f=cc.pRotateByAngle(e,c,d),d=0;if(0==a)f=e,d=0;else if(1==a)f=e,d=4;else{var g=cc.FLT_MAX,h=cc.PROGRESS_TEXTURE_COORDS_COUNT;for(a=0;a<=h;++a){var k=(a+(h-1))%h,m=this._boundaryTexCoord(a%h),k=this._boundaryTexCoord(k);0==a?k=
cc.pLerp(m,k,1-c.x):4==a&&(m=cc.pLerp(m,k,1-c.x));var n=cc.p(0,0);cc.pLineIntersect(m,k,c,f,n)&&(0!=a&&4!=a||0<=n.x&&1>=n.x)&&0<=n.y&&n.y<g&&(g=n.y,d=a)}f=cc.pAdd(c,cc.pMult(cc.pSub(f,c),g))}g=!0;this._vertexDataCount!=d+3&&(g=!1,this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0);if(!this._vertexData){h=this._vertexDataCount=d+3;m=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;this._vertexArrayBuffer=new ArrayBuffer(h*m);k=[];for(a=0;a<h;a++)k[a]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,
a*m);this._vertexData=k;if(!this._vertexData){cc.log("cc.ProgressTimer._updateRadial() : Not enough memory");return}}this._updateColor();h=this._vertexData;if(!g)for(h[0].texCoords=this._textureCoordFromAlphaPoint(c),h[0].vertices=this._vertexFromAlphaPoint(c),h[1].texCoords=this._textureCoordFromAlphaPoint(e),h[1].vertices=this._vertexFromAlphaPoint(e),a=0;a<d;a++)c=this._boundaryTexCoord(a),h[a+2].texCoords=this._textureCoordFromAlphaPoint(c),h[a+2].vertices=this._vertexFromAlphaPoint(c);h[this._vertexDataCount-
1].texCoords=this._textureCoordFromAlphaPoint(f);h[this._vertexDataCount-1].vertices=this._vertexFromAlphaPoint(f)}},_updateBar:function(){if(this._sprite){var a,c=this._percentage/100,d=this._barChangeRate,d=cc.pMult(cc.p(1-d.x+c*d.x,1-d.y+c*d.y),0.5),c=cc.pSub(this._midPoint,d),d=cc.pAdd(this._midPoint,d);0>c.x&&(d.x+=-c.x,c.x=0);1<d.x&&(c.x-=d.x-1,d.x=1);0>c.y&&(d.y+=-c.y,c.y=0);1<d.y&&(c.y-=d.y-1,d.y=1);if(this._reverseDirection){if(!this._vertexData){this._vertexDataCount=8;var e=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;
this._vertexArrayBuffer=new ArrayBuffer(8*e);var f=[];for(a=0;8>a;a++)f[a]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,a*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}a=this._vertexData;a[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,d.y));a[2].vertices=this._vertexFromAlphaPoint(cc.p(c.x,d.y));a[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,c.y));a[3].vertices=this._vertexFromAlphaPoint(cc.p(c.x,c.y));a[4].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,d.y));a[4].vertices=this._vertexFromAlphaPoint(cc.p(d.x,d.y));a[5].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,
c.y));a[5].vertices=this._vertexFromAlphaPoint(cc.p(d.x,c.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=[],a=0;4>a;a++)this._vertexData[a]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,a*e);a=this._vertexData;a[0].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,d.y));a[0].vertices=this._vertexFromAlphaPoint(cc.p(c.x,d.y));a[1].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,
c.y));a[1].vertices=this._vertexFromAlphaPoint(cc.p(c.x,c.y));a[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,d.y));a[2].vertices=this._vertexFromAlphaPoint(cc.p(d.x,d.y));a[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(d.x,c.y));a[3].vertices=this._vertexFromAlphaPoint(cc.p(d.x,c.y))}this._updateColor()}},_updateColor:function(){if(this._sprite&&this._vertexData){for(var a=this._sprite.getQuad().tl.colors,c=this._vertexData,d=0,e=this._vertexDataCount;d<e;++d)c[d].colors=a;this._vertexDataDirty=
!0}},_updateProgress:null,_updateProgressForCanvas:function(){var a=this._sprite,c=a.getContentSize(),d=this._midPoint;if(this._type==cc.PROGRESS_TIMER_TYPE_RADIAL){this._radius=Math.round(Math.sqrt(c.width*c.width+c.height*c.height));var e,f=!1,g=this._origin;g.x=c.width*d.x;g.y=-c.height*d.y;this._reverseDirection?(e=270,d=270-3.6*this._percentage):(d=-90,e=-90+3.6*this._percentage);a._flippedX&&(g.x-=2*c.width*this._midPoint.x,d=-d-180,e=-e-180,f=!f);a._flippedY&&(g.y+=2*c.height*this._midPoint.y,
f=!f,d=-d,e=-e);this._startAngle=d;this._endAngle=e;this._counterClockWise=f}else{e=this._barChangeRate;g=this._percentage/100;f=this._barRect;e=cc.size(c.width*(1-e.x),c.height*(1-e.y));var g=cc.size((c.width-e.width)*g,(c.height-e.height)*g),g=cc.size(e.width+g.width,e.height+g.height),h=cc.p(c.width*d.x,c.height*d.y),k=h.x-g.width/2;0.5<d.x&&g.width/2>=c.width-h.x&&(k=c.width-g.width);e=h.y-g.height/2;0.5<d.y&&g.height/2>=c.height-h.y&&(e=c.height-g.height);f.x=0;c=1;a._flippedX&&(f.x-=g.width,
c=-1);0<k&&(f.x+=k*c);f.y=0;c=1;a._flippedY&&(f.y+=g.height,c=-1);0<e&&(f.y-=e*c);f.width=g.width;f.height=-g.height}},_updateProgressForWebGL:function(){var a=this._type;a===cc.PROGRESS_TIMER_TYPE_RADIAL?this._updateRadial():a===cc.PROGRESS_TIMER_TYPE_BAR&&this._updateBar();this._vertexDataDirty=!0}});
cc.Browser.supportWebGL?(cc.ProgressTimer.prototype.ctor=cc.ProgressTimer.prototype._ctorForWebGL,cc.ProgressTimer.prototype.setReverseProgress=cc.ProgressTimer.prototype._setReverseProgressForWebGL,cc.ProgressTimer.prototype.setSprite=cc.ProgressTimer.prototype._setSpriteForWebGL,cc.ProgressTimer.prototype.setType=cc.ProgressTimer.prototype._setTypeForWebGL,cc.ProgressTimer.prototype.setReverseDirection=cc.ProgressTimer.prototype._setReverseDirectionForWebGL,cc.ProgressTimer.prototype.initWithSprite=
cc.ProgressTimer.prototype._initWithSpriteForWebGL,cc.ProgressTimer.prototype.draw=cc.ProgressTimer.prototype._drawForWebGL,cc.ProgressTimer.prototype._updateProgress=cc.ProgressTimer.prototype._updateProgressForWebGL):(cc.ProgressTimer.prototype.ctor=cc.ProgressTimer.prototype._ctorForCanvas,cc.ProgressTimer.prototype.setReverseProgress=cc.ProgressTimer.prototype._setReverseProgressForCanvas,cc.ProgressTimer.prototype.setSprite=cc.ProgressTimer.prototype._setSpriteForCanvas,cc.ProgressTimer.prototype.setType=
cc.ProgressTimer.prototype._setTypeForCanvas,cc.ProgressTimer.prototype.setReverseDirection=cc.ProgressTimer.prototype._setReverseDirectionForCanvas,cc.ProgressTimer.prototype.initWithSprite=cc.ProgressTimer.prototype._initWithSpriteForCanvas,cc.ProgressTimer.prototype.draw=cc.ProgressTimer.prototype._drawForCanvas,cc.ProgressTimer.prototype._updateProgress=cc.ProgressTimer.prototype._updateProgressForCanvas);
cc.ProgressTimer.create=function(a){var c=new cc.ProgressTimer;return c.initWithSprite(a)?c:null};cc.ProgressTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0},initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=c,!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.getPercentage();100==this._from&&(this._from=0)},update:function(a){this._target instanceof cc.ProgressTimer&&this._target.setPercentage(this._from+(this._to-this._from)*a)}});cc.ProgressTo.create=function(a,c){var d=new cc.ProgressTo;d.initWithDuration(a,c);return d};
cc.ProgressFromTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0},initWithDuration:function(a,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=d,this._from=c,!0):!1},clone:function(){var a=new cc.ProgressFromTo;a.initWithDuration(this._duration,this._from,this._to);return a},reverse:function(){return cc.ProgressFromTo.create(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.setPercentage(this._from+(this._to-this._from)*a)}});cc.ProgressFromTo.create=function(a,c,d){var e=new cc.ProgressFromTo;e.initWithDuration(a,c,d);return e};cc.SCENE_FADE=4208917214;cc.TransitionEaseScene=cc.Class.extend({easeActionWithAction:function(){}});cc.TRANSITION_ORIENTATION_LEFT_OVER=0;cc.TRANSITION_ORIENTATION_RIGHT_OVER=1;cc.TRANSITION_ORIENTATION_UP_OVER=0;cc.TRANSITION_ORIENTATION_DOWN_OVER=1;
cc.TransitionScene=cc.Scene.extend({_inScene:null,_outScene:null,_duration:null,_isInSceneOnTop:!1,_isSendCleanupToScene:!1,_setNewScene:function(a){this.unschedule(this._setNewScene);a=cc.Director.getInstance();this._isSendCleanupToScene=a.isSendCleanupToScene();a.replaceScene(this._inScene);cc.TouchDispatcher&&a.getTouchDispatcher().setDispatchEvents(!0);this._outScene.setVisible(!0)},_sceneOrder:function(){this._isInSceneOnTop=!0},draw:function(){this._isInSceneOnTop?(this._outScene.visit(),this._inScene.visit()):
(this._inScene.visit(),this._outScene.visit())},onEnter:function(){cc.Node.prototype.onEnter.call(this);cc.TouchDispatcher&&cc.Director.getInstance().getTouchDispatcher().setDispatchEvents(!1);this._outScene.onExitTransitionDidStart();this._inScene.onEnter()},onExit:function(){cc.Node.prototype.onExit.call(this);cc.TouchDispatcher&&cc.Director.getInstance().getTouchDispatcher().setDispatchEvents(!0);this._outScene.onExit();this._inScene.onEnterTransitionDidFinish()},cleanup:function(){cc.Node.prototype.cleanup.call(this);
this._isSendCleanupToScene&&this._outScene.cleanup()},initWithDuration:function(a,c){if(!c)throw"cc.TransitionScene.initWithDuration(): Argument scene must be non-nil";if(this.init()){this._duration=a;this.setAnchorPoint(0,0);this.setPosition(0,0);this._inScene=c;this._outScene=cc.Director.getInstance().getRunningScene();this._outScene||(this._outScene=cc.Scene.create(),this._outScene.init());if(this._inScene==this._outScene)throw"cc.TransitionScene.initWithDuration(): Incoming scene must be different from the outgoing scene";
this._sceneOrder();return!0}return!1},finish:function(){this._inScene.setVisible(!0);this._inScene.setPosition(0,0);this._inScene.setScale(1);this._inScene.setRotation(0);cc.renderContextType===cc.WEBGL&&this._inScene.getCamera().restore();this._outScene.setVisible(!1);this._outScene.setPosition(0,0);this._outScene.setScale(1);this._outScene.setRotation(0);cc.renderContextType===cc.WEBGL&&this._outScene.getCamera().restore();this.schedule(this._setNewScene,0)},hideOutShowIn:function(){this._inScene.setVisible(!0);
this._outScene.setVisible(!1)}});cc.TransitionScene.create=function(a,c){var d=new cc.TransitionScene;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionSceneOriented=cc.TransitionScene.extend({_orientation:0,initWithDuration:function(a,c,d){cc.TransitionScene.prototype.initWithDuration.call(this,a,c)&&(this._orientation=d);return!0}});cc.TransitionSceneOriented.create=function(a,c,d){var e=new cc.TransitionSceneOriented;e.initWithDuration(a,c,d);return e};
cc.TransitionRotoZoom=cc.TransitionScene.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._inScene.setScale(0.001);this._outScene.setScale(1);this._inScene.setAnchorPoint(0.5,0.5);this._outScene.setAnchorPoint(0.5,0.5);var a=cc.Sequence.create(cc.Spawn.create(cc.ScaleBy.create(this._duration/2,0.001),cc.RotateBy.create(this._duration/2,720)),cc.DelayTime.create(this._duration/2));this._outScene.runAction(a);this._inScene.runAction(cc.Sequence.create(a.reverse(),cc.CallFunc.create(this.finish,
this)))}});cc.TransitionRotoZoom.create=function(a,c){var d=new cc.TransitionRotoZoom;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionJumpZoom=cc.TransitionScene.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.Director.getInstance().getWinSize();this._inScene.setScale(0.5);this._inScene.setPosition(a.width,0);this._inScene.setAnchorPoint(0.5,0.5);this._outScene.setAnchorPoint(0.5,0.5);var c=cc.JumpBy.create(this._duration/4,cc.p(-a.width,0),a.width/4,2),d=cc.ScaleTo.create(this._duration/4,1),a=cc.ScaleTo.create(this._duration/4,0.5),a=cc.Sequence.create(a,c),c=cc.Sequence.create(c,
d),d=cc.DelayTime.create(this._duration/2);this._outScene.runAction(a);this._inScene.runAction(cc.Sequence.create(d,c,cc.CallFunc.create(this.finish,this)))}});cc.TransitionJumpZoom.create=function(a,c){var d=new cc.TransitionJumpZoom;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionMoveInL=cc.TransitionScene.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this.initScenes();var a=this.action();this._inScene.runAction(cc.Sequence.create(this.easeActionWithAction(a),cc.CallFunc.create(this.finish,this)))},initScenes:function(){this._inScene.setPosition(-cc.Director.getInstance().getWinSize().width,0)},action:function(){return cc.MoveTo.create(this._duration,cc.p(0,0))},easeActionWithAction:function(a){return cc.EaseOut.create(a,2)}});
cc.TransitionMoveInL.create=function(a,c){var d=new cc.TransitionMoveInL;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionMoveInR=cc.TransitionMoveInL.extend({initScenes:function(){this._inScene.setPosition(cc.Director.getInstance().getWinSize().width,0)}});cc.TransitionMoveInR.create=function(a,c){var d=new cc.TransitionMoveInR;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionMoveInT=cc.TransitionMoveInL.extend({initScenes:function(){this._inScene.setPosition(0,cc.Director.getInstance().getWinSize().height)}});
cc.TransitionMoveInT.create=function(a,c){var d=new cc.TransitionMoveInT;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionMoveInB=cc.TransitionMoveInL.extend({initScenes:function(){this._inScene.setPosition(0,-cc.Director.getInstance().getWinSize().height)}});cc.TransitionMoveInB.create=function(a,c){var d=new cc.TransitionMoveInB;return null!=d&&d.initWithDuration(a,c)?d:null};cc.ADJUST_FACTOR=0.5;
cc.TransitionSlideInL=cc.TransitionScene.extend({_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this.initScenes();var a=this.action(),c=this.action(),a=this.easeActionWithAction(a),c=cc.Sequence.create(this.easeActionWithAction(c),cc.CallFunc.create(this.finish,this));this._inScene.runAction(a);this._outScene.runAction(c)},initScenes:function(){this._inScene.setPosition(-(cc.Director.getInstance().getWinSize().width-cc.ADJUST_FACTOR),
0)},action:function(){return cc.MoveBy.create(this._duration,cc.p(cc.Director.getInstance().getWinSize().width-cc.ADJUST_FACTOR,0))},easeActionWithAction:function(a){return cc.EaseOut.create(a,2)}});cc.TransitionSlideInL.create=function(a,c){var d=new cc.TransitionSlideInL;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionSlideInR=cc.TransitionSlideInL.extend({_sceneOrder:function(){this._isInSceneOnTop=!0},initScenes:function(){this._inScene.setPosition(cc.Director.getInstance().getWinSize().width-cc.ADJUST_FACTOR,0)},action:function(){return cc.MoveBy.create(this._duration,cc.p(-(cc.Director.getInstance().getWinSize().width-cc.ADJUST_FACTOR),0))}});cc.TransitionSlideInR.create=function(a,c){var d=new cc.TransitionSlideInR;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionSlideInB=cc.TransitionSlideInL.extend({_sceneOrder:function(){this._isInSceneOnTop=!1},initScenes:function(){this._inScene.setPosition(0,cc.Director.getInstance().getWinSize().height-cc.ADJUST_FACTOR)},action:function(){return cc.MoveBy.create(this._duration,cc.p(0,-(cc.Director.getInstance().getWinSize().height-cc.ADJUST_FACTOR)))}});cc.TransitionSlideInB.create=function(a,c){var d=new cc.TransitionSlideInB;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionSlideInT=cc.TransitionSlideInL.extend({_sceneOrder:function(){this._isInSceneOnTop=!0},initScenes:function(){this._inScene.setPosition(0,-(cc.Director.getInstance().getWinSize().height-cc.ADJUST_FACTOR))},action:function(){return cc.MoveBy.create(this._duration,cc.p(0,cc.Director.getInstance().getWinSize().height-cc.ADJUST_FACTOR))}});cc.TransitionSlideInT.create=function(a,c){var d=new cc.TransitionSlideInT;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionShrinkGrow=cc.TransitionScene.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._inScene.setScale(0.001);this._outScene.setScale(1);this._inScene.setAnchorPoint(2/3,0.5);this._outScene.setAnchorPoint(1/3,0.5);var a=cc.ScaleTo.create(this._duration,0.01),c=cc.ScaleTo.create(this._duration,1);this._inScene.runAction(this.easeActionWithAction(c));this._outScene.runAction(cc.Sequence.create(this.easeActionWithAction(a),cc.CallFunc.create(this.finish,this)))},
easeActionWithAction:function(a){return cc.EaseOut.create(a,2)}});cc.TransitionShrinkGrow.create=function(a,c){var d=new cc.TransitionShrinkGrow;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionFlipX=cc.TransitionSceneOriented.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a,c;this._inScene.setVisible(!1);var d;this._orientation===cc.TRANSITION_ORIENTATION_RIGHT_OVER?(a=90,d=270,c=90):(a=-90,d=90,c=-90);a=cc.Sequence.create(cc.DelayTime.create(this._duration/2),cc.Show.create(),cc.OrbitCamera.create(this._duration/2,1,0,d,a,0,0),cc.CallFunc.create(this.finish,this));c=cc.Sequence.create(cc.OrbitCamera.create(this._duration/2,1,0,0,c,0,0),cc.Hide.create(),
cc.DelayTime.create(this._duration/2));this._inScene.runAction(a);this._outScene.runAction(c)}});cc.TransitionFlipX.create=function(a,c,d){null==d&&(d=cc.TRANSITION_ORIENTATION_RIGHT_OVER);var e=new cc.TransitionFlipX;e.initWithDuration(a,c,d);return e};
cc.TransitionFlipY=cc.TransitionSceneOriented.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a,c;this._inScene.setVisible(!1);var d;this._orientation==cc.TRANSITION_ORIENTATION_UP_OVER?(a=90,d=270,c=90):(a=-90,d=90,c=-90);a=cc.Sequence.create(cc.DelayTime.create(this._duration/2),cc.Show.create(),cc.OrbitCamera.create(this._duration/2,1,0,d,a,90,0),cc.CallFunc.create(this.finish,this));c=cc.Sequence.create(cc.OrbitCamera.create(this._duration/2,1,0,0,c,90,0),cc.Hide.create(),
cc.DelayTime.create(this._duration/2));this._inScene.runAction(a);this._outScene.runAction(c)}});cc.TransitionFlipY.create=function(a,c,d){null==d&&(d=cc.TRANSITION_ORIENTATION_UP_OVER);var e=new cc.TransitionFlipY;e.initWithDuration(a,c,d);return e};
cc.TransitionFlipAngular=cc.TransitionSceneOriented.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a,c;this._inScene.setVisible(!1);var d;this._orientation===cc.TRANSITION_ORIENTATION_RIGHT_OVER?(a=90,d=270,c=90):(a=-90,d=90,c=-90);a=cc.Sequence.create(cc.DelayTime.create(this._duration/2),cc.Show.create(),cc.OrbitCamera.create(this._duration/2,1,0,d,a,-45,0),cc.CallFunc.create(this.finish,this));c=cc.Sequence.create(cc.OrbitCamera.create(this._duration/2,1,0,0,c,45,
0),cc.Hide.create(),cc.DelayTime.create(this._duration/2));this._inScene.runAction(a);this._outScene.runAction(c)}});cc.TransitionFlipAngular.create=function(a,c,d){null==d&&(d=cc.TRANSITION_ORIENTATION_RIGHT_OVER);var e=new cc.TransitionFlipAngular;e.initWithDuration(a,c,d);return e};
cc.TransitionZoomFlipX=cc.TransitionSceneOriented.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a,c;this._inScene.setVisible(!1);var d;this._orientation===cc.TRANSITION_ORIENTATION_RIGHT_OVER?(a=90,d=270,c=90):(a=-90,d=90,c=-90);a=cc.Sequence.create(cc.DelayTime.create(this._duration/2),cc.Spawn.create(cc.OrbitCamera.create(this._duration/2,1,0,d,a,0,0),cc.ScaleTo.create(this._duration/2,1),cc.Show.create()),cc.CallFunc.create(this.finish,this));c=cc.Sequence.create(cc.Spawn.create(cc.OrbitCamera.create(this._duration/
2,1,0,0,c,0,0),cc.ScaleTo.create(this._duration/2,0.5)),cc.Hide.create(),cc.DelayTime.create(this._duration/2));this._inScene.setScale(0.5);this._inScene.runAction(a);this._outScene.runAction(c)}});cc.TransitionZoomFlipX.create=function(a,c,d){null==d&&(d=cc.TRANSITION_ORIENTATION_RIGHT_OVER);var e=new cc.TransitionZoomFlipX;e.initWithDuration(a,c,d);return e};
cc.TransitionZoomFlipY=cc.TransitionSceneOriented.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a,c;this._inScene.setVisible(!1);var d;this._orientation===cc.TRANSITION_ORIENTATION_UP_OVER?(a=90,d=270,c=90):(a=-90,d=90,c=-90);a=cc.Sequence.create(cc.DelayTime.create(this._duration/2),cc.Spawn.create(cc.OrbitCamera.create(this._duration/2,1,0,d,a,90,0),cc.ScaleTo.create(this._duration/2,1),cc.Show.create()),cc.CallFunc.create(this.finish,this));c=cc.Sequence.create(cc.Spawn.create(cc.OrbitCamera.create(this._duration/
2,1,0,0,c,90,0),cc.ScaleTo.create(this._duration/2,0.5)),cc.Hide.create(),cc.DelayTime.create(this._duration/2));this._inScene.setScale(0.5);this._inScene.runAction(a);this._outScene.runAction(c)}});cc.TransitionZoomFlipY.create=function(a,c,d){null==d&&(d=cc.TRANSITION_ORIENTATION_UP_OVER);var e=new cc.TransitionZoomFlipY;e.initWithDuration(a,c,d);return e};
cc.TransitionZoomFlipAngular=cc.TransitionSceneOriented.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a,c;this._inScene.setVisible(!1);var d;this._orientation===cc.TRANSITION_ORIENTATION_RIGHT_OVER?(a=90,d=270,c=90):(a=-90,d=90,c=-90);a=cc.Sequence.create(cc.DelayTime.create(this._duration/2),cc.Spawn.create(cc.OrbitCamera.create(this._duration/2,1,0,d,a,-45,0),cc.ScaleTo.create(this._duration/2,1),cc.Show.create()),cc.Show.create(),cc.CallFunc.create(this.finish,
this));c=cc.Sequence.create(cc.Spawn.create(cc.OrbitCamera.create(this._duration/2,1,0,0,c,45,0),cc.ScaleTo.create(this._duration/2,0.5)),cc.Hide.create(),cc.DelayTime.create(this._duration/2));this._inScene.setScale(0.5);this._inScene.runAction(a);this._outScene.runAction(c)}});cc.TransitionZoomFlipAngular.create=function(a,c,d){null==d&&(d=cc.TRANSITION_ORIENTATION_RIGHT_OVER);var e=new cc.TransitionZoomFlipAngular;e.initWithDuration(a,c,d);return e};
cc.TransitionFade=cc.TransitionScene.extend({_color:null,ctor:function(){cc.TransitionScene.prototype.ctor.call(this);this._color=new cc.Color4B},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.LayerColor.create(this._color);this._inScene.setVisible(!1);this.addChild(a,2,cc.SCENE_FADE);var a=this.getChildByTag(cc.SCENE_FADE),c=cc.Sequence.create(cc.FadeIn.create(this._duration/2),cc.CallFunc.create(this.hideOutShowIn,this),cc.FadeOut.create(this._duration/2),cc.CallFunc.create(this.finish,
this));a.runAction(c)},onExit:function(){cc.TransitionScene.prototype.onExit.call(this);this.removeChildByTag(cc.SCENE_FADE,!1)},initWithDuration:function(a,c,d){d=d||cc.black();cc.TransitionScene.prototype.initWithDuration.call(this,a,c)&&(this._color.r=d.r,this._color.g=d.g,this._color.b=d.b,this._color.a=0);return!0}});cc.TransitionFade.create=function(a,c,d){var e=new cc.TransitionFade;e.initWithDuration(a,c,d);return e};
cc.TransitionCrossFade=cc.TransitionScene.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=new cc.Color4B(0,0,0,0),c=cc.Director.getInstance().getWinSize(),a=cc.LayerColor.create(a),d=cc.RenderTexture.create(c.width,c.height);if(null!=d){d.getSprite().setAnchorPoint(0.5,0.5);d.setPosition(c.width/2,c.height/2);d.setAnchorPoint(0.5,0.5);d.begin();this._inScene.visit();d.end();var e=cc.RenderTexture.create(c.width,c.height);e.getSprite().setAnchorPoint(0.5,0.5);e.setPosition(c.width/
2,c.height/2);e.setAnchorPoint(0.5,0.5);e.begin();this._outScene.visit();e.end();d.getSprite().setBlendFunc(gl.ONE,gl.ONE);e.getSprite().setBlendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA);a.addChild(d);a.addChild(e);d.getSprite().setOpacity(255);e.getSprite().setOpacity(255);c=cc.Sequence.create(cc.FadeTo.create(this._duration,0),cc.CallFunc.create(this.hideOutShowIn,this),cc.CallFunc.create(this.finish,this));e.getSprite().runAction(c);this.addChild(a,2,cc.SCENE_FADE)}},onExit:function(){this.removeChildByTag(cc.SCENE_FADE,
!1);cc.TransitionScene.prototype.onExit.call(this)},draw:function(){}});cc.TransitionCrossFade.create=function(a,c){var d=new cc.TransitionCrossFade;d.initWithDuration(a,c);return d};
cc.TransitionTurnOffTiles=cc.TransitionScene.extend({_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.Director.getInstance().getWinSize(),a=cc.TurnOffTiles.create(this._duration,cc.size(0|a.width/a.height*12,12)),a=this.easeActionWithAction(a);this._outScene.runAction(cc.Sequence.create(a,cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))},easeActionWithAction:function(a){return a}});
cc.TransitionTurnOffTiles.create=function(a,c){var d=new cc.TransitionTurnOffTiles;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionSplitCols=cc.TransitionScene.extend({onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._inScene.setVisible(!1);var a=this.action(),a=cc.Sequence.create(a,cc.CallFunc.create(this.hideOutShowIn,this),a.reverse());this.runAction(cc.Sequence.create(this.easeActionWithAction(a),cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))},easeActionWithAction:function(a){return cc.EaseInOut.create(a,3)},action:function(){return cc.SplitCols.create(this._duration/2,3)}});
cc.TransitionSplitCols.create=function(a,c){var d=new cc.TransitionSplitCols;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionSplitRows=cc.TransitionSplitCols.extend({action:function(){return cc.SplitRows.create(this._duration/2,3)}});cc.TransitionSplitRows.create=function(a,c){var d=new cc.TransitionSplitRows;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionFadeTR=cc.TransitionScene.extend({_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.Director.getInstance().getWinSize(),a=this.actionWithSize(cc.size(0|a.width/a.height*12,12));this._outScene.runAction(cc.Sequence.create(this.easeActionWithAction(a),cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))},easeActionWithAction:function(a){return a},actionWithSize:function(a){return cc.FadeOutTRTiles.create(this._duration,
a)}});cc.TransitionFadeTR.create=function(a,c){var d=new cc.TransitionFadeTR;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionFadeBL=cc.TransitionFadeTR.extend({actionWithSize:function(a){return cc.FadeOutBLTiles.create(this._duration,a)}});cc.TransitionFadeBL.create=function(a,c){var d=new cc.TransitionFadeBL;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionFadeUp=cc.TransitionFadeTR.extend({actionWithSize:function(a){return cc.FadeOutUpTiles.create(this._duration,a)}});
cc.TransitionFadeUp.create=function(a,c){var d=new cc.TransitionFadeUp;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionFadeDown=cc.TransitionFadeTR.extend({actionWithSize:function(a){return cc.FadeOutDownTiles.create(this._duration,a)}});cc.TransitionFadeDown.create=function(a,c){var d=new cc.TransitionFadeDown;return null!=d&&d.initWithDuration(a,c)?d:null};cc.SCENE_RADIAL=49153;
cc.TransitionProgress=cc.TransitionScene.extend({_to:0,_from:0,_sceneToBeModified:null,onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._setupTransition();var a=cc.Director.getInstance().getWinSize(),c=cc.RenderTexture.create(a.width,a.height);c.getSprite().setAnchorPoint(0.5,0.5);c.setPosition(a.width/2,a.height/2);c.setAnchorPoint(0.5,0.5);c.clear(0,0,0,1);c.begin();this._sceneToBeModified.visit();c.end();this._sceneToBeModified==this._outScene&&this.hideOutShowIn();a=this._progressTimerNodeWithRenderTexture(c);
c=cc.Sequence.create(cc.ProgressFromTo.create(this._duration,this._from,this._to),cc.CallFunc.create(this.finish,this));a.runAction(c);this.addChild(a,2,cc.SCENE_RADIAL)},onExit:function(){this.removeChildByTag(cc.SCENE_RADIAL,!0);cc.TransitionScene.prototype.onExit.call(this)},_setupTransition:function(){this._sceneToBeModified=this._outScene;this._from=100;this._to=0},_progressTimerNodeWithRenderTexture:function(a){cc.log("cc.TransitionProgress._progressTimerNodeWithRenderTexture(): should be overridden in subclass");
return null},_sceneOrder:function(){this._isInSceneOnTop=!1}});cc.TransitionProgress.create=function(a,c){var d=new cc.TransitionProgress;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionProgressRadialCCW=cc.TransitionProgress.extend({_progressTimerNodeWithRenderTexture:function(a){var c=cc.Director.getInstance().getWinSize();a=cc.ProgressTimer.create(a.getSprite());cc.renderContextType===cc.WEBGL&&a.getSprite().setFlippedY(!0);a.setType(cc.PROGRESS_TIMER_TYPE_RADIAL);a.setReverseDirection(!1);a.setPercentage(100);a.setPosition(c.width/2,c.height/2);a.setAnchorPoint(0.5,0.5);return a}});
cc.TransitionProgressRadialCCW.create=function(a,c){var d=new cc.TransitionProgressRadialCCW;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionProgressRadialCW=cc.TransitionProgress.extend({_progressTimerNodeWithRenderTexture:function(a){var c=cc.Director.getInstance().getWinSize();a=cc.ProgressTimer.create(a.getSprite());cc.renderContextType===cc.WEBGL&&a.getSprite().setFlippedY(!0);a.setType(cc.PROGRESS_TIMER_TYPE_RADIAL);a.setReverseDirection(!0);a.setPercentage(100);a.setPosition(c.width/2,c.height/2);a.setAnchorPoint(0.5,0.5);return a}});
cc.TransitionProgressRadialCW.create=function(a,c){var d=new cc.TransitionProgressRadialCW;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionProgressHorizontal=cc.TransitionProgress.extend({_progressTimerNodeWithRenderTexture:function(a){var c=cc.Director.getInstance().getWinSize();a=cc.ProgressTimer.create(a.getSprite());cc.renderContextType===cc.WEBGL&&a.getSprite().setFlippedY(!0);a.setType(cc.PROGRESS_TIMER_TYPE_BAR);a.setMidpoint(cc.p(1,0));a.setBarChangeRate(cc.p(1,0));a.setPercentage(100);a.setPosition(c.width/2,c.height/2);a.setAnchorPoint(0.5,0.5);return a}});
cc.TransitionProgressHorizontal.create=function(a,c){var d=new cc.TransitionProgressHorizontal;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionProgressVertical=cc.TransitionProgress.extend({_progressTimerNodeWithRenderTexture:function(a){var c=cc.Director.getInstance().getWinSize();a=cc.ProgressTimer.create(a.getSprite());cc.renderContextType===cc.WEBGL&&a.getSprite().setFlippedY(!0);a.setType(cc.PROGRESS_TIMER_TYPE_BAR);a.setMidpoint(cc.p(0,0));a.setBarChangeRate(cc.p(0,1));a.setPercentage(100);a.setPosition(c.width/2,c.height/2);a.setAnchorPoint(0.5,0.5);return a}});
cc.TransitionProgressVertical.create=function(a,c){var d=new cc.TransitionProgressVertical;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionProgressInOut=cc.TransitionProgress.extend({_progressTimerNodeWithRenderTexture:function(a){var c=cc.Director.getInstance().getWinSize();a=cc.ProgressTimer.create(a.getSprite());cc.renderContextType===cc.WEBGL&&a.getSprite().setFlippedY(!0);a.setType(cc.PROGRESS_TIMER_TYPE_BAR);a.setMidpoint(cc.p(0.5,0.5));a.setBarChangeRate(cc.p(1,1));a.setPercentage(0);a.setPosition(c.width/2,c.height/2);a.setAnchorPoint(0.5,0.5);return a},_sceneOrder:function(){this._isInSceneOnTop=!1},_setupTransition:function(){this._sceneToBeModified=
this._inScene;this._from=0;this._to=100}});cc.TransitionProgressInOut.create=function(a,c){var d=new cc.TransitionProgressInOut;return null!=d&&d.initWithDuration(a,c)?d:null};
cc.TransitionProgressOutIn=cc.TransitionProgress.extend({_progressTimerNodeWithRenderTexture:function(a){var c=cc.Director.getInstance().getWinSize();a=cc.ProgressTimer.create(a.getSprite());cc.renderContextType===cc.WEBGL&&a.getSprite().setFlippedY(!0);a.setType(cc.PROGRESS_TIMER_TYPE_BAR);a.setMidpoint(cc.p(0.5,0.5));a.setBarChangeRate(cc.p(1,1));a.setPercentage(100);a.setPosition(c.width/2,c.height/2);a.setAnchorPoint(0.5,0.5);return a}});
cc.TransitionProgressOutIn.create=function(a,c){var d=new cc.TransitionProgressOutIn;return null!=d&&d.initWithDuration(a,c)?d:null};cc.TransitionPageTurn=cc.TransitionScene.extend({_back:!0,initWithDuration:function(a,c,d){this._back=d;cc.TransitionScene.prototype.initWithDuration.call(this,a,c);return!0},actionWithSize:function(a){return this._back?cc.ReverseTime.create(cc.PageTurn3D.create(this._duration,a)):cc.PageTurn3D.create(this._duration,a)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.Director.getInstance().getWinSize(),c;a.width>a.height?(a=16,c=12):(a=12,c=16);a=this.actionWithSize(cc.size(a,
c));this._back?(this._inScene.setVisible(!1),this._inScene.runAction(cc.Sequence.create(cc.Show.create(),a,cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))):this._outScene.runAction(cc.Sequence.create(a,cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))},_sceneOrder:function(){this._isInSceneOnTop=this._back}});cc.TransitionPageTurn.create=function(a,c,d){var e=new cc.TransitionPageTurn;e.initWithDuration(a,c,d);return e};cc.LabelAtlas=cc.AtlasNode.extend({_string:null,_mapStartChar:null,_textureLoaded:!1,_loadedEventListeners:null,ctor:function(){cc.AtlasNode.prototype.ctor.call(this)},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,c){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:a,eventTarget:c})},_callLoadedEventCallbacks:function(){if(this._loadedEventListeners){this._textureLoaded=!0;for(var a=this._loadedEventListeners,
c=0,d=a.length;c<d;c++){var e=a[c];cc.doCallback(e.eventCallback,e.eventTarget,this)}a.length=0}},initWithString:function(a,c,d,e,f){var g=a+"",h,k,m,n;if(2===arguments.length){n=cc.FileUtils.getInstance();var p=n.fullPathForFilename(c);h=p.substr(0,p.lastIndexOf("/"))+"/";n=n.dictionaryWithContentsOfFileThreadSafe(p);if(1!==parseInt(n.version,10))return cc.log("cc.LabelAtlas.initWithString(): Unsupported version. Upgrade cocos2d version"),!1;h+=n.textureFilename;p=cc.CONTENT_SCALE_FACTOR();k=parseInt(n.itemWidth,
10)/p;m=parseInt(n.itemHeight,10)/p;n=String.fromCharCode(parseInt(n.firstChar,10))}else h=c,k=d||0,m=e||0,n=f||" ";var q=null,q=h instanceof cc.Texture2D?h:cc.TextureCache.getInstance().addImage(h);(this._textureLoaded=h=q.isLoaded())||q.addLoadedEventListener(function(a){this.initWithTexture(q,k,m,g.length);this.setString(g);this._callLoadedEventCallbacks()},this);return this.initWithTexture(q,k,m,g.length)?(this._mapStartChar=n,this.setString(g),!0):!1},setColor:function(a){cc.AtlasNode.prototype.setColor.call(this,
a);this.updateAtlasValues()},getString:function(){return this._string},draw:function(a){cc.AtlasNode.prototype.draw.call(this,a);cc.LABELATLAS_DEBUG_DRAW&&(a=this.getContentSize(),a=[cc.p(0,0),cc.p(a.width,0),cc.p(a.width,a.height),cc.p(0,a.height)],cc.drawingUtil.drawPoly(a,4,!0))},updateAtlasValues:null,_updateAtlasValuesForCanvas:function(){for(var a=this._string,c=a.length,d=this.getTexture(),e=this._itemWidth,f=this._itemHeight,g=0;g<c;g++){var h=a.charCodeAt(g)-this._mapStartChar.charCodeAt(0),
k=parseInt(h%this._itemsPerRow,10),h=parseInt(h/this._itemsPerRow,10),k=cc.rect(k*e,h*f,e,f),h=a.charCodeAt(g),m=this.getChildByTag(g);m?32==h?(m.init(),m.setTextureRect(cc.rect(0,0,10,10),!1,cc.SizeZero())):(m.initWithTexture(d,k),m.setVisible(!0),m.setOpacity(this._displayedOpacity)):(m=new cc.Sprite,32==h?(m.init(),m.setTextureRect(cc.rect(0,0,10,10),!1,cc.SizeZero())):m.initWithTexture(d,k),this.addChild(m,0,g));m.setPosition(g*e+e/2,f/2)}},_updateAtlasValuesForWebGL:function(){var a=this._string,
c=a.length,d=this._textureAtlas,e=d.getTexture(),f=e.getPixelsWide(),e=e.getPixelsHigh(),g=this._itemWidth,h=this._itemHeight;this._ignoreContentScaleFactor||(g=this._itemWidth*cc.CONTENT_SCALE_FACTOR(),h=this._itemHeight*cc.CONTENT_SCALE_FACTOR());c>d.getCapacity()&&cc.log("cc.LabelAtlas._updateAtlasValues(): Invalid String length");for(var k=d.getQuads(),m=this._displayedColor,m={r:m.r,g:m.g,b:m.b,a:this._displayedOpacity},n=this._itemWidth,p=0;p<c;p++){var q=a.charCodeAt(p)-this._mapStartChar.charCodeAt(0),
s=q%this._itemsPerRow,r=0|q/this._itemsPerRow,t;cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(s=(2*s*g+1)/(2*f),q=s+(2*g-2)/(2*f),r=(2*r*h+1)/(2*e),t=r+(2*h-2)/(2*e)):(s=s*g/f,q=s+g/f,r=r*h/e,t=r+h/e);var u=k[p],v=u.tl,z=u.tr,B=u.bl,u=u.br;v.texCoords.u=s;v.texCoords.v=r;z.texCoords.u=q;z.texCoords.v=r;B.texCoords.u=s;B.texCoords.v=t;u.texCoords.u=q;u.texCoords.v=t;B.vertices.x=p*n;B.vertices.y=0;B.vertices.z=0;u.vertices.x=p*n+n;u.vertices.y=0;u.vertices.z=0;v.vertices.x=p*n;v.vertices.y=this._itemHeight;
v.vertices.z=0;z.vertices.x=p*n+n;z.vertices.y=this._itemHeight;z.vertices.z=0;v.colors=m;z.colors=m;B.colors=m;u.colors=m}0<c&&(d.setDirty(!0),a=d.getTotalQuads(),c>a&&d.increaseTotalQuadsWith(c-a))},setString:null,_setStringForCanvas:function(a){a=String(a);var c=a.length;this._string=a;this.setContentSize(c*this._itemWidth,this._itemHeight);if(this._children){a=this._children;for(var c=a.length,d=0;d<c;d++){var e=a[d];e&&e.setVisible(!1)}}this.updateAtlasValues();this._quadsToDraw=c},_setStringForWebGL:function(a){a=
String(a);var c=a.length;c>this._textureAtlas.getTotalQuads()&&this._textureAtlas.resizeCapacity(c);this._string=a;this.setContentSize(c*this._itemWidth,this._itemHeight);this.updateAtlasValues();this._quadsToDraw=c},setOpacity:null,_setOpacityForCanvas:function(a){if(this._displayedOpacity!==a){cc.AtlasNode.prototype.setOpacity.call(this,a);for(var c=this._children,d=0,e=c.length;d<e;d++)c[d]&&c[d].setOpacity(a)}},_setOpacityForWebGL:function(a){this._opacity!==a&&cc.AtlasNode.prototype.setOpacity.call(this,
a)}});cc.Browser.supportWebGL?(cc.LabelAtlas.prototype.updateAtlasValues=cc.LabelAtlas.prototype._updateAtlasValuesForWebGL,cc.LabelAtlas.prototype.setString=cc.LabelAtlas.prototype._setStringForWebGL,cc.LabelAtlas.prototype.setOpacity=cc.LabelAtlas.prototype._setOpacityForWebGL):(cc.LabelAtlas.prototype.updateAtlasValues=cc.LabelAtlas.prototype._updateAtlasValuesForCanvas,cc.LabelAtlas.prototype.setString=cc.LabelAtlas.prototype._setStringForCanvas,cc.LabelAtlas.prototype.setOpacity=cc.LabelAtlas.prototype._setOpacityForCanvas);
cc.LabelAtlas.create=function(a,c,d,e,f){var g=new cc.LabelAtlas;return g&&cc.LabelAtlas.prototype.initWithString.apply(g,arguments)?g:null};cc.LABEL_AUTOMATIC_WIDTH=-1;cc.KerningHashElement=function(a,c){this.key=a||0;this.amount=c||0};cc.FontDefHashElement=function(a,c){this.key=a||0;this.fontDef=c||new cc.BMFontDef};cc.BMFontDef=function(a,c,d,e,f){this.charID=a||0;this.rect=c||cc.rect(0,0,0.1,0.1);this.xOffset=d||0;this.yOffset=e||0;this.xAdvance=f||0};cc.BMFontPadding=function(a,c,d,e){this.left=a||0;this.top=c||0;this.right=d||0;this.bottom=e||0};
cc.BMFontConfiguration=cc.Class.extend({commonHeight:0,padding:null,atlasName:null,kerningDictionary:null,fontDefDictionary:null,characterSet:null,ctor:function(){this.padding=new cc.BMFontPadding;this.atlasName="";this.kerningDictionary=new cc.KerningHashElement;this.fontDefDictionary={};this.characterSet=[]},description:function(){return"\x3ccc.BMFontConfiguration | Kernings:"+this.kerningDictionary.amount+" | Image \x3d "+this.atlasName.toString()+"\x3e"},getAtlasName:function(){return this.atlasName},
setAtlasName:function(a){this.atlasName=a},getCharacterSet:function(){return this.characterSet},initWithFNTfile:function(a){if(!a||0==a.length)throw"cc.BMFontConfiguration.initWithFNTfile(): FNTfile must be non-null and must not be a empty string";this.characterSet=this._parseConfigFile(a);return null!=this.characterSet},_parseConfigFile:function(a){var c=cc.FileUtils.getInstance().fullPathForFilename(a),c=cc.SAXParser.getInstance().getList(c);if(!c)return cc.log("cc.BMFontConfiguration._parseConfigFile(): Error parsing FNTfile "+
a),null;var d=[],e;e=/padding+[a-z0-9\-= ",]+/gi;(e=e.exec(c)[0])&&this._parseInfoArguments(e);e=/common lineHeight+[a-z0-9\-= ",]+/gi;(e=e.exec(c)[0])&&this._parseCommonArguments(e);e=/page id=[0-9]+ file="[\w\-\.]+/gi;(e=e.exec(c)[0])&&this._parseImageFileName(e,a);e=/chars c+[a-z0-9\-= ",]+/gi;e.exec(c);e=/char id=\w[a-z0-9\-= ]+/gi;if(e=c.match(e))for(a=0;a<e.length;a++){var f=new cc.FontDefHashElement;this._parseCharacterDefinition(e[a],f.fontDef);f.key=f.fontDef.charID;this.fontDefDictionary[f.key]=
f;d.push(f.fontDef.charID)}e=/kerning first=\w[a-z0-9\-= ]+/gi;if(e=c.match(e))for(a=0;a<e.length;a++)this._parseKerningEntry(e[a]);return d},_parseCharacterDefinition:function(a,c){var d=/id=(\d+)/gi.exec(a)[1];c.charID=d.toString();d=/x=([\-\d]+)/gi.exec(a)[1];c.rect.x=parseInt(d);d=/y=([\-\d]+)/gi.exec(a)[1];c.rect.y=parseInt(d);d=/width=([\-\d]+)/gi.exec(a)[1];c.rect.width=parseInt(d);d=/height=([\-\d]+)/gi.exec(a)[1];c.rect.height=parseInt(d);d=/xoffset=([\-\d]+)/gi.exec(a)[1];c.xOffset=parseInt(d);
d=/yoffset=([\-\d]+)/gi.exec(a)[1];c.yOffset=parseInt(d);d=/xadvance=([\-\d]+)/gi.exec(a)[1];c.xAdvance=parseInt(d)},_parseInfoArguments:function(a){a=/padding=(\d+)[,](\d+)[,](\d+)[,](\d+)/gi.exec(a);this.padding.left=a[1];this.padding.top=a[2];this.padding.right=a[3];this.padding.bottom=a[4];cc.log("cocos2d: padding: "+this.padding.left+","+this.padding.top+","+this.padding.right+","+this.padding.bottom)},_parseCommonArguments:function(a){this.commonHeight=parseInt(/lineHeight=(\d+)/gi.exec(a)[1]);
if(cc.renderContextType===cc.WEBGL){var c=cc.Configuration.getInstance().getMaxTextureSize(),d=parseInt(/scaleW=(\d+)/gi.exec(a)[1]),e=parseInt(/scaleH=(\d+)/gi.exec(a)[1]);(d>c.width||e>c.height)&&cc.log("cc.LabelBMFont._parseCommonArguments(): page can't be larger than supported")}a=/pages=(\d+)/gi.exec(a)[1];1!==parseInt(a)&&cc.log("cc.LabelBMFont._parseCommonArguments(): only supports 1 page")},_parseImageFileName:function(a,c){var d;d=/id=(\d+)/gi.exec(a)[1];0!==parseInt(d)&&cc.log("cc.LabelBMFont._parseImageFileName() : file could not be found");
d=/file="([a-zA-Z0-9\-\._]+)/gi.exec(a)[1];this.atlasName=cc.FileUtils.getInstance().fullPathFromRelativeFile(d,c)},_parseKerningCapacity:function(a){},_parseKerningEntry:function(a){var c=/first=([\-\d]+)/gi.exec(a)[1],d=parseInt(c),c=/second=([\-\d]+)/gi.exec(a)[1],e=parseInt(c),c=/amount=([\-\d]+)/gi.exec(a)[1];a=parseInt(c);c=new cc.KerningHashElement;c.amount=a;c.key=d<<16|e&65535;this.kerningDictionary[c.key]=c},_purgeKerningDictionary:function(){this.kerningDictionary=null},_purgeFontDefDictionary:function(){this.fontDefDictionary=
null}});cc.BMFontConfiguration.create=function(a){var c=new cc.BMFontConfiguration;return c.initWithFNTfile(a)?c:null};
cc.LabelBMFont=cc.SpriteBatchNode.extend({RGBAProtocol:!0,_opacityModifyRGB:!1,_string:null,_configuration:null,_fntFile:null,_initialString:"",_alignment:null,_width:0,_lineBreakWithoutSpaces:!1,_imageOffset:null,_reusedChar:null,_displayedOpacity:255,_realOpacity:255,_displayedColor:null,_realColor:null,_cascadeColorEnabled:!1,_cascadeOpacityEnabled:!1,_textureLoaded:!1,_loadedEventListeners:null,_setString:function(a,c){c?this._initialString=a:this._string=a;var d=this._children;if(d)for(var e=
0;e<d.length;e++){var f=d[e];f&&f.setVisible(!1)}this._textureLoaded&&(this.createFontChars(),c&&this.updateLabel())},ctor:function(){cc.SpriteBatchNode.prototype.ctor.call(this);this._imageOffset=cc.PointZero();this._initialString=this._string="";this._alignment=cc.TEXT_ALIGNMENT_CENTER;this._width=-1;this._configuration=null;this._lineBreakWithoutSpaces=!1;this._realOpacity=this._displayedOpacity=255;this._displayedColor=cc.white();this._realColor=cc.white();this._cascadeOpacityEnabled=this._cascadeColorEnabled=
!0;this._opacityModifyRGB=!1;this._fntFile="";this._reusedChar=[]},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,c){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:a,eventTarget:c})},_callLoadedEventCallbacks:function(){if(this._loadedEventListeners){for(var a=this._loadedEventListeners,c=0,d=a.length;c<d;c++){var e=a[c];cc.doCallback(e.eventCallback,e.eventTarget,this)}a.length=0}},draw:function(a){cc.SpriteBatchNode.prototype.draw.call(this,
a);if(cc.LABELBMFONT_DEBUG_DRAW){a=this.getContentSize();var c=cc.p(0|-this._anchorPointInPoints.x,0|-this._anchorPointInPoints.y);a=[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.setDrawColor4B(0,255,0,255);cc.drawingUtil.drawPoly(a,4,!0)}},setColor:function(a){if(this._realColor.r!=a.r||this._realColor.g!=a.g||this._realColor.b!=a.b)if(this._displayedColor={r:a.r,g:a.g,b:a.b},this._realColor={r:a.r,g:a.g,b:a.b},this._textureLoaded&&this._cascadeColorEnabled){a=
cc.white();var c=this._parent;c&&c.RGBAProtocol&&c.isCascadeColorEnabled()&&(a=c.getDisplayedColor());this.updateDisplayedColor(a)}},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setOpacityModifyRGB:function(a){this._opacityModifyRGB=a;if(a=this._children)for(var c=0;c<a.length;c++){var d=a[c];d&&d.RGBAProtocol&&d.setOpacityModifyRGB(this._opacityModifyRGB)}},getOpacity:function(){return this._realOpacity},getDisplayedOpacity:function(){return this._displayedOpacity},setOpacity:function(a){this._displayedOpacity=
this._realOpacity=a;if(this._cascadeOpacityEnabled){a=255;var c=this._parent;c&&c.RGBAProtocol&&c.isCascadeOpacityEnabled()&&(a=c.getDisplayedOpacity());this.updateDisplayedOpacity(a)}},updateDisplayedOpacity:function(a){this._displayedOpacity=this._realOpacity*a/255;a=this._children;for(var c=0;c<a.length;c++){var d=a[c];cc.Browser.supportWebGL?d.updateDisplayedOpacity(this._displayedOpacity):(cc.NodeRGBA.prototype.updateDisplayedOpacity.call(d,this._displayedOpacity),d.setNodeDirty())}this._changeTextureColor()},
isCascadeOpacityEnabled:function(){return!1},setCascadeOpacityEnabled:function(a){this._cascadeOpacityEnabled=a},getColor:function(){return this._realColor},getDisplayedColor:function(){return this._displayedColor},updateDisplayedColor:function(a){var c=this._displayedColor,d=this._realColor;c.r=d.r*a.r/255;c.g=d.g*a.g/255;c.b=d.b*a.b/255;a=this._children;for(c=0;c<a.length;c++)d=a[c],cc.Browser.supportWebGL?d.updateDisplayedColor(this._displayedColor):(cc.NodeRGBA.prototype.updateDisplayedColor.call(d,
this._displayedColor),d.setNodeDirty());this._changeTextureColor()},_changeTextureColor:function(){if(!cc.Browser.supportWebGL){var a,c=this.getTexture();c&&0<c.getContentSize().width&&(a=c.getHtmlElementObj())&&(c=cc.TextureCache.getInstance().getTextureColors(this._originalTexture.getHtmlElementObj()))&&(a instanceof HTMLCanvasElement&&!this._rectRotated?cc.generateTintImage(a,c,this._displayedColor,null,a):(a=cc.generateTintImage(a,c,this._displayedColor),c=new cc.Texture2D,c.initWithElement(a),
c.handleLoadedTexture(),this.setTexture(c)))}},isCascadeColorEnabled:function(){return!1},setCascadeColorEnabled:function(a){this._cascadeColorEnabled=a},init:function(){return this.initWithString(null,null,null,null,null)},initWithString:function(a,c,d,e,f){a=a||"";this._configuration&&cc.log("cc.LabelBMFont.initWithString(): re-init is no longer supported");if(c){var g=cc.FNTConfigLoadFile(c);if(!g)return cc.log("cc.LabelBMFont.initWithString(): Impossible to create font. Please check file"),!1;
this._configuration=g;this._fntFile=c;c=cc.TextureCache.getInstance().addImage(this._configuration.getAtlasName());(this._textureLoaded=g=c.isLoaded())||c.addLoadedEventListener(function(a){this._textureLoaded=!0;this.initWithTexture(a,this._initialString.length);this.setString(this._initialString,!0);this._callLoadedEventCallbacks()},this)}else c=new cc.Texture2D,g=new Image,c.initWithElement(g),this._textureLoaded=!1;return this.initWithTexture(c,a.length)?(this._alignment=e||cc.TEXT_ALIGNMENT_LEFT,
this._imageOffset=f||cc.PointZero(),this._width=null==d?-1:d,this._displayedOpacity=this._realOpacity=255,this._displayedColor=cc.white(),this._realColor=cc.white(),this._cascadeColorEnabled=this._cascadeOpacityEnabled=!0,this._contentSize.width=0,this._contentSize.height=0,this.setAnchorPoint(0.5,0.5),cc.renderContextType===cc.WEBGL&&(d=this._textureAtlas.getTexture(),this._opacityModifyRGB=d.hasPremultipliedAlpha(),this._reusedChar=new cc.Sprite,this._reusedChar.initWithTexture(d,cc.rect(0,0,0,
0),!1),this._reusedChar.setBatchNode(this)),this.setString(a,!0),!0):!1},createFontChars:function(){var a=cc.renderContextType,c=a===cc.CANVAS?this.getTexture():this._textureAtlas.getTexture(),d=0,e=-1,f=0,g=cc.SizeZero(),h=0,f=1,k=this._string?this._string.length:0;if(0!==k){var m,n=this._configuration.getCharacterSet();for(m=0;m<k-1;m++)10==this._string.charCodeAt(m)&&f++;var p=this._configuration.commonHeight*f,q=-(this._configuration.commonHeight-this._configuration.commonHeight*f);for(m=0;m<
k;m++){var s=this._string.charCodeAt(m);if(10===s)d=0,q-=this._configuration.commonHeight;else if(null===n[s])cc.log("cc.LabelBMFont: Attempted to use character not defined in this bitmap: "+this._string[m]);else{var f=this._kerningAmountForFirst(e,s),r=this._configuration.fontDefDictionary[s];if(r){var e=r.fontDef,t=cc.rect(e.rect.x,e.rect.y,e.rect.width,e.rect.height),t=cc.RECT_PIXELS_TO_POINTS(t);t.x+=this._imageOffset.x;t.y+=this._imageOffset.y;(r=this.getChildByTag(m))?32===s&&a===cc.CANVAS?
r.setTextureRect(t,!1,cc.SizeZero()):(r.setTextureRect(t,!1,t._size),r.setVisible(!0)):(r=new cc.Sprite,32===s&&a===cc.CANVAS?r.initWithTexture(c,cc.RectZero(),!1):r.initWithTexture(c,t,!1),r._newTextureWhenChangeColor=!0,this.addChild(r,0,m));r.setOpacityModifyRGB(this._opacityModifyRGB);cc.Browser.supportWebGL?(r.updateDisplayedColor(this._displayedColor),r.updateDisplayedOpacity(this._displayedOpacity)):(cc.NodeRGBA.prototype.updateDisplayedColor.call(r,this._displayedColor),cc.NodeRGBA.prototype.updateDisplayedOpacity.call(r,
this._displayedOpacity),r.setNodeDirty());t=cc.p(d+e.xOffset+0.5*e.rect.width+f,q+(this._configuration.commonHeight-e.yOffset)-0.5*t.height*cc.CONTENT_SCALE_FACTOR());r.setPosition(cc.POINT_PIXELS_TO_POINTS(t));d+=e.xAdvance+f;e=s;h<d&&(h=d)}else 0!==s&&10!==s&&cc.log("cocos2d: LabelBMFont: character not found "+this._string[m])}}g.width=h;g.height=p;this.setContentSize(cc.SIZE_PIXELS_TO_POINTS(g))}},updateString:function(a){var c=this._children;if(c)for(var d=0;d<c.length;d++){var e=c[d];e&&e.setVisible(!1)}this._configuration&&
this.createFontChars();a||this.updateLabel()},getString:function(){return this._initialString},setString:function(a,c){a=String(a);null==c&&(c=!0);if(null==a||"string"!=typeof a)a+="";this._initialString=a;this._setString(a,c)},setCString:function(a){this.setString(a,!0)},updateLabel:function(){this.setString(this._initialString,!1);if(0<this._width){var a=this._string.length,c=[],d=[],e=1,f=0,g=!1,h=!1,k=-1,m=-1,n=0,p,q;for(p=0;p<this._children.length;p++){for(var s=0;!(q=this.getChildByTag(p+n+
s));)s++;n+=s;if(f>=a)break;var r=this._string[f];h||(m=this._getLetterPosXLeft(q),h=!0);g||(k=m,g=!0);if(10==r.charCodeAt(0)){d.push("\n");c=c.concat(d);d.length=0;g=h=!1;k=m=-1;p--;n-=s;e++;if(f>=a)break;m||(m=this._getLetterPosXLeft(q),h=!0);k||(k=m,g=!0);f++}else if(cc.isspace_unicode(r))d.push(r),c=c.concat(d),d.length=0,h=!1,m=-1,f++;else if(this._getLetterPosXRight(q)-k>this._width)if(this._lineBreakWithoutSpaces){cc.utf8_trim_ws(d);d.push("\n");c=c.concat(d);d.length=0;g=h=!1;k=m=-1;e++;if(f>=
a)break;m||(m=this._getLetterPosXLeft(q),h=!0);k||(k=m,g=!0);p--}else d.push(r),-1!=c.lastIndexOf(" ")?cc.utf8_trim_ws(c):c=[],0<c.length&&c.push("\n"),e++,g=!1,k=-1,f++;else d.push(r),f++}c=c.concat(d);p=c.length;q="";for(f=0;f<p;++f)q+=c[f];q+=String.fromCharCode(0);this._setString(q,!1)}if(this._alignment!=cc.TEXT_ALIGNMENT_LEFT)for(c=f=0,a=this._string.length,d=[],e=0;e<a;e++)if(10==this._string[e].charCodeAt(0)||0==this._string[e].charCodeAt(0))if(p=0,g=d.length,0==g)c++;else{if(q=f+g-1+c,!(0>
q)&&(p=this.getChildByTag(q),null!=p)){p=p.getPositionX()+p.getContentSize().width/2;h=0;switch(this._alignment){case cc.TEXT_ALIGNMENT_CENTER:h=this.getContentSize().width/2-p/2;break;case cc.TEXT_ALIGNMENT_RIGHT:h=this.getContentSize().width-p}if(0!=h)for(p=0;p<g;p++)q=f+p+c,0>q||(q=this.getChildByTag(q))&&q.setPosition(cc.pAdd(q.getPosition(),cc.p(h,0)));f+=g;c++;d.length=0}}else d.push(this._string[f])},setAlignment:function(a){this._alignment=a;this.updateLabel()},setWidth:function(a){this._width=
a;this.updateLabel()},setLineBreakWithoutSpace:function(a){this._lineBreakWithoutSpaces=a;this.updateLabel()},setScale:function(a,c){cc.Node.prototype.setScale.call(this,a,c);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 c=cc.FNTConfigLoadFile(a);c?(this._fntFile=a,this._configuration=c,a=cc.TextureCache.getInstance().addImage(this._configuration.getAtlasName()),
this._textureLoaded=c=a.isLoaded(),this.setTexture(a),cc.renderContextType===cc.CANVAS&&(this._originalTexture=this.getTexture()),c?this.createFontChars():a.addLoadedEventListener(function(a){this._textureLoaded=!0;this.setTexture(a);this.createFontChars();this._changeTextureColor();this.updateLabel();this._callLoadedEventCallbacks()},this)):cc.log("cc.LabelBMFont.setFntFile() : Impossible to create font. Please check file")}},getFntFile:function(){return this._fntFile},setAnchorPoint:function(a,
c){cc.Node.prototype.setAnchorPoint.call(this,a,c);this.updateLabel()},_atlasNameFromFntFile:function(a){},_kerningAmountForFirst:function(a,c){var d=0;if(this._configuration.kerningDictionary){var e=this._configuration.kerningDictionary[(a<<16|c&65535).toString()];e&&(d=e.amount)}return d},_getLetterPosXLeft:function(a){return a.getPositionX()*this._scaleX-a.getContentSize().width*this._scaleX*a.getAnchorPoint().x},_getLetterPosXRight:function(a){return a.getPositionX()*this._scaleX+a.getContentSize().width*
this._scaleX*(1-a.getAnchorPoint().x)}});cc.LabelBMFont.create=function(a,c,d,e,f){var g=new cc.LabelBMFont;return void 0===a?g&&g.init()?g:null:g&&g.initWithString(a,c,d,e,f)?g:null};cc.LabelBMFont._configurations=null;cc.FNTConfigLoadFile=function(a){cc.LabelBMFont._configurations||(cc.LabelBMFont._configurations={});var c=cc.LabelBMFont._configurations[a];c||(c=cc.BMFontConfiguration.create(a),cc.LabelBMFont._configurations[a]=c);return c};cc.LabelBMFont.purgeCachedData=function(){cc.FNTConfigRemoveCache()};
cc.FNTConfigRemoveCache=function(){cc.LabelBMFont._configurations&&(cc.LabelBMFont._configurations=null)};cc.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};cc.utf8_trim_ws=function(a){var c=a.length;if(!(0>=c)&&(c-=1,cc.isspace_unicode(a[c]))){for(var d=c-1;0<=d;--d)if(cc.isspace_unicode(a[d]))c=d;else break;cc.utf8_trim_from(a,c)}};
cc.utf8_trim_from=function(a,c){var d=a.length;c>=d||0>c||a.splice(c,d)};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,c){c=c||1;var d=this.unzipBase64(a),e=[],f,g,h;f=0;for(h=d.length/c;f<h;f++)for(e[f]=0,g=c-1;0<=g;--g)e[f]+=d.charCodeAt(f*c+g)<<8*g;return e};
cc.unzipAsArray=function(a,c){c=c||1;var d=this.unzip(a),e=[],f,g,h;f=0;for(h=d.length/c;f<h;f++)for(e[f]=0,g=c-1;0<=g;--g)e[f]+=d.charCodeAt(f*c+g)<<8*g;return e};cc.StringToArray=function(a){a=a.split(",");var c=[],d;for(d=0;d<a.length;d++)c.push(parseInt(a[d]));return c};cc.Codec.Base64={name:"Jacob__Codec__Base64"};cc.Codec.Base64._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d";
cc.Codec.Base64.decode=function(a){var c=[],d,e,f,g,h,k=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)d=this._keyStr.indexOf(a.charAt(k++)),e=this._keyStr.indexOf(a.charAt(k++)),g=this._keyStr.indexOf(a.charAt(k++)),h=this._keyStr.indexOf(a.charAt(k++)),d=d<<2|e>>4,e=(e&15)<<4|g>>2,f=(g&3)<<6|h,c.push(String.fromCharCode(d)),64!=g&&c.push(String.fromCharCode(e)),64!=h&&c.push(String.fromCharCode(f));return c=c.join("")};
cc.Codec.Base64.decodeAsArray=function(a,c){var d=this.decode(a),e=[],f,g,h;f=0;for(h=d.length/c;f<h;f++)for(e[f]=0,g=c-1;0<=g;--g)e[f]+=d.charCodeAt(f*c+g)<<8*g;return e};cc.uint8ArrayToUint32Array=function(a){if(0!=a.length%4)return null;for(var c=a.length/4,d=window.Uint32Array?new Uint32Array(c):[],e=0;e<c;e++){var f=4*e;d[e]=a[f]+256*a[f+1]+65536*a[f+2]+16777216*a[f+3]}return d};cc.Codec.GZip=function(a){this.data=a;this.debug=!1;this.gpflags=void 0;this.files=0;this.unzipped=[];this.buf32k=Array(32768);this.bIdx=0;this.modeZIP=!1;this.bytepos=0;this.bb=1;this.bits=0;this.nameBuf=[];this.fileout=void 0;this.literalTree=Array(cc.Codec.GZip.LITERALS);this.distanceTree=Array(32);this.treepos=0;this.Places=null;this.len=0;this.fpos=Array(17);this.fpos[0]=0;this.fmax=this.flens=void 0};cc.Codec.GZip.gunzip=function(a){return(new cc.Codec.GZip(a)).gunzip()[0][0]};
cc.Codec.GZip.HufNode=function(){this.b1=this.b0=0;this.jump=null;this.jumppos=-1};cc.Codec.GZip.LITERALS=288;cc.Codec.GZip.NAMEMAX=256;
cc.Codec.GZip.bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,
97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255];
cc.Codec.GZip.cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];cc.Codec.GZip.cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99];cc.Codec.GZip.cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];cc.Codec.GZip.cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];cc.Codec.GZip.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];
cc.Codec.GZip.prototype.gunzip=function(){this.outputArr=[];this.nextFile();return this.unzipped};cc.Codec.GZip.prototype.readByte=function(){this.bits+=8;return this.bytepos<this.data.length?this.data.charCodeAt(this.bytepos++):-1};cc.Codec.GZip.prototype.byteAlign=function(){this.bb=1};cc.Codec.GZip.prototype.readBit=function(){var a;this.bits++;a=this.bb&1;this.bb>>=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 c=0,d=a;d--;)c=c<<1|this.readBit();a&&(c=cc.Codec.GZip.bitReverse[c]>>8-a);return c};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],c;if(17==this.len)return-1;this.treepos++;this.len++;c=this.IsPat();if(0<=c)a.b0=c;else if(a.b0=32768,this.Rec())return-1;c=this.IsPat();if(0<=c)a.b1=c,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,c,d,e){this.Places=a;this.treepos=0;this.flens=d;this.fmax=c;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 c,d,e=0,f=a[e];;)if(c=this.readBit()){if(!(f.b1&32768))return f.b1;f=f.jump;c=a.length;for(d=0;d<c;d++)if(a[d]===f){e=d;break}}else{if(!(f.b0&32768))return f.b0;e++;f=a[e]}return-1};
cc.Codec.GZip.prototype.DeflateLoop=function(){var a,c,d,e,f;do if(a=this.readBit(),d=this.readBits(2),0==d)for(this.byteAlign(),d=this.readByte(),d|=this.readByte()<<8,c=this.readByte(),c|=this.readByte()<<8,(d^~c)&65535&&document.write("BlockLen checksum mismatch\n");d--;)c=this.readByte(),this.addBuffer(c);else if(1==d)for(;;)if(d=cc.Codec.GZip.bitReverse[this.readBits(7)]>>1,23<d?(d=d<<1|this.readBit(),199<d?(d-=128,d=d<<1|this.readBit()):(d-=48,143<d&&(d+=136))):d+=256,256>d)this.addBuffer(d);
else if(256==d)break;else{var g;d-=257;f=this.readBits(cc.Codec.GZip.cplext[d])+cc.Codec.GZip.cplens[d];d=cc.Codec.GZip.bitReverse[this.readBits(5)]>>3;8<cc.Codec.GZip.cpdext[d]?(g=this.readBits(8),g|=this.readBits(cc.Codec.GZip.cpdext[d]-8)<<8):g=this.readBits(cc.Codec.GZip.cpdext[d]);g+=cc.Codec.GZip.cpdist[d];for(d=0;d<f;d++)c=this.buf32k[this.bIdx-g&32767],this.addBuffer(c)}else if(2==d){var h=Array(320);c=257+this.readBits(5);g=1+this.readBits(5);e=4+this.readBits(4);for(d=0;19>d;d++)h[d]=0;
for(d=0;d<e;d++)h[cc.Codec.GZip.border[d]]=this.readBits(3);f=this.distanceTree.length;for(e=0;e<f;e++)this.distanceTree[e]=new cc.Codec.GZip.HufNode;if(this.CreateTree(this.distanceTree,19,h,0))return this.flushBuffer(),1;f=c+g;e=0;for(var k=-1;e<f;)if(k++,d=this.DecodeValue(this.distanceTree),16>d)h[e++]=d;else if(16==d){var m;d=3+this.readBits(2);if(e+d>f)return this.flushBuffer(),1;for(m=e?h[e-1]:0;d--;)h[e++]=m}else{d=17==d?3+this.readBits(3):11+this.readBits(7);if(e+d>f)return this.flushBuffer(),
1;for(;d--;)h[e++]=0}f=this.literalTree.length;for(e=0;e<f;e++)this.literalTree[e]=new cc.Codec.GZip.HufNode;if(this.CreateTree(this.literalTree,c,h,0))return this.flushBuffer(),1;f=this.literalTree.length;for(e=0;e<f;e++)this.distanceTree[e]=new cc.Codec.GZip.HufNode;d=[];for(e=c;e<h.length;e++)d[e-c]=h[e];if(this.CreateTree(this.distanceTree,g,d,0))return this.flushBuffer(),1;for(;;)if(d=this.DecodeValue(this.literalTree),256<=d){d-=256;if(0==d)break;d--;f=this.readBits(cc.Codec.GZip.cplext[d])+
cc.Codec.GZip.cplens[d];d=this.DecodeValue(this.distanceTree);8<cc.Codec.GZip.cpdext[d]?(g=this.readBits(8),g|=this.readBits(cc.Codec.GZip.cpdext[d]-8)<<8):g=this.readBits(cc.Codec.GZip.cpdext[d]);for(g+=cc.Codec.GZip.cpdist[d];f--;)c=this.buf32k[this.bIdx-g&32767],this.addBuffer(c)}else this.addBuffer(d)}while(!a);this.flushBuffer();this.byteAlign();return 0};cc.Codec.GZip.prototype.unzipFile=function(a){var c;this.gunzip();for(c=0;c<this.unzipped.length;c++)if(this.unzipped[c][1]==a)return this.unzipped[c][0]};
cc.Codec.GZip.prototype.nextFile=function(){this.outputArr=[];this.modeZIP=!1;var a=[];a[0]=this.readByte();a[1]=this.readByte();120==a[0]&&218==a[1]&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),"geonext.gxt"],this.files++);31==a[0]&&139==a[1]&&(this.skipdir(),this.unzipped[this.files]=[this.outputArr.join(""),"file"],this.files++);if(80==a[0]&&75==a[1]&&(this.modeZIP=!0,a[2]=this.readByte(),a[3]=this.readByte(),3==a[2]&&4==a[3])){a[0]=this.readByte();a[1]=this.readByte();
this.gpflags=this.readByte();this.gpflags|=this.readByte()<<8;a=this.readByte();a|=this.readByte()<<8;this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();var c=this.readByte(),c=c|this.readByte()<<8,d=this.readByte(),d=d|this.readByte()<<8,e=0;for(this.nameBuf=[];c--;){var f=this.readByte();"/"==f|":"==f?e=0:e<cc.Codec.GZip.NAMEMAX-1&&(this.nameBuf[e++]=String.fromCharCode(f))}this.fileout||
(this.fileout=this.nameBuf);for(var e=0;e<d;)this.readByte(),e++;8==a&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),this.nameBuf.join("")],this.files++);this.skipdir()}};
cc.Codec.GZip.prototype.skipdir=function(){var a=[],c;this.gpflags&8&&(a[0]=this.readByte(),a[1]=this.readByte(),a[2]=this.readByte(),a[3]=this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte());this.modeZIP&&this.nextFile();a[0]=this.readByte();if(8!=a[0])return 0;this.gpflags=this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();this.readByte();if(this.gpflags&4)for(a[0]=
this.readByte(),a[2]=this.readByte(),this.len=a[0]+256*a[1],a=0;a<this.len;a++)this.readByte();if(this.gpflags&8)for(a=0,this.nameBuf=[];c=this.readByte();){if("7"==c||":"==c)a=0;a<cc.Codec.GZip.NAMEMAX-1&&(this.nameBuf[a++]=c)}if(this.gpflags&16)for(;this.readByte(););this.gpflags&2&&(this.readByte(),this.readByte());this.DeflateLoop();this.readByte();this.readByte();this.readByte();this.readByte();this.modeZIP&&this.nextFile()};/*
 zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */
(function(){function a(a){throw a;}function c(a,c){var d=a.split("."),e=x;d[0]in e||!e.execScript||e.execScript("var "+d[0]);for(var f;d.length&&(f=d.shift());)d.length||c===B?e=e[f]?e[f]:e[f]={}:e[f]=c}function d(a){if("string"===typeof a){a=a.split("");var c,d;c=0;for(d=a.length;c<d;c++)a[c]=(a[c].charCodeAt(0)&255)>>>0}c=1;d=0;for(var e=a.length,f,g=0;0<e;){f=1024<e?1024:e;e-=f;do c+=a[g++],d+=c;while(--f);c%=65521;d%=65521}return(d<<16|c)>>>0}function e(c,d){this.index="number"===typeof d?d:0;
this.i=0;this.buffer=c instanceof(y?Uint8Array:Array)?c:new (y?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&a(Error("invalid index"));this.buffer.length<=this.index&&this.f()}function f(a){this.buffer=new (y?Uint16Array:Array)(2*a);this.length=0}function g(a){var c=a.length,d=0,e=Number.POSITIVE_INFINITY,f,g,h,k,m,n,p,q,r;for(q=0;q<c;++q)a[q]>d&&(d=a[q]),a[q]<e&&(e=a[q]);f=1<<d;g=new (y?Uint32Array:Array)(f);h=1;k=0;for(m=2;h<=d;){for(q=0;q<c;++q)if(a[q]===h){n=0;p=k;for(r=0;r<h;++r)n=
n<<1|p&1,p>>=1;for(r=n;r<f;r+=m)g[r]=h<<16|q;++k}++h;k<<=1;m<<=1}return[g,d,e]}function h(a,c){this.h=J;this.w=0;this.input=a;this.b=0;c&&(c.lazy&&(this.w=c.lazy),"number"===typeof c.compressionType&&(this.h=c.compressionType),c.outputBuffer&&(this.a=y&&c.outputBuffer instanceof Array?new Uint8Array(c.outputBuffer):c.outputBuffer),"number"===typeof c.outputIndex&&(this.b=c.outputIndex));this.a||(this.a=new (y?Uint8Array:Array)(32768))}function k(a,c){this.length=a;this.G=c}function m(){var c=K;switch(E){case 3===
c:return[257,c-3,0];case 4===c:return[258,c-4,0];case 5===c:return[259,c-5,0];case 6===c:return[260,c-6,0];case 7===c:return[261,c-7,0];case 8===c:return[262,c-8,0];case 9===c:return[263,c-9,0];case 10===c:return[264,c-10,0];case 12>=c:return[265,c-11,1];case 14>=c:return[266,c-13,1];case 16>=c:return[267,c-15,1];case 18>=c:return[268,c-17,1];case 22>=c:return[269,c-19,2];case 26>=c:return[270,c-23,2];case 30>=c:return[271,c-27,2];case 34>=c:return[272,c-31,2];case 42>=c:return[273,c-35,3];case 50>=
c:return[274,c-43,3];case 58>=c:return[275,c-51,3];case 66>=c:return[276,c-59,3];case 82>=c:return[277,c-67,4];case 98>=c:return[278,c-83,4];case 114>=c:return[279,c-99,4];case 130>=c:return[280,c-115,4];case 162>=c:return[281,c-131,5];case 194>=c:return[282,c-163,5];case 226>=c:return[283,c-195,5];case 257>=c:return[284,c-227,5];case 258===c:return[285,c-258,0];default:a("invalid length: "+c)}}function n(c,d){function e(c,d){var f=c.G,g=[],h=0,k;k=M[c.length];g[h++]=k&65535;g[h++]=k>>16&255;g[h++]=
k>>24;var m;switch(E){case 1===f:m=[0,f-1,0];break;case 2===f:m=[1,f-2,0];break;case 3===f:m=[2,f-3,0];break;case 4===f:m=[3,f-4,0];break;case 6>=f:m=[4,f-5,1];break;case 8>=f:m=[5,f-7,1];break;case 12>=f:m=[6,f-9,2];break;case 16>=f:m=[7,f-13,2];break;case 24>=f:m=[8,f-17,3];break;case 32>=f:m=[9,f-25,3];break;case 48>=f:m=[10,f-33,4];break;case 64>=f:m=[11,f-49,4];break;case 96>=f:m=[12,f-65,5];break;case 128>=f:m=[13,f-97,5];break;case 192>=f:m=[14,f-129,6];break;case 256>=f:m=[15,f-193,6];break;
case 384>=f:m=[16,f-257,7];break;case 512>=f:m=[17,f-385,7];break;case 768>=f:m=[18,f-513,8];break;case 1024>=f:m=[19,f-769,8];break;case 1536>=f:m=[20,f-1025,9];break;case 2048>=f:m=[21,f-1537,9];break;case 3072>=f:m=[22,f-2049,10];break;case 4096>=f:m=[23,f-3073,10];break;case 6144>=f:m=[24,f-4097,11];break;case 8192>=f:m=[25,f-6145,11];break;case 12288>=f:m=[26,f-8193,12];break;case 16384>=f:m=[27,f-12289,12];break;case 24576>=f:m=[28,f-16385,13];break;case 32768>=f:m=[29,f-24577,13];break;default:a("invalid distance")}k=
m;g[h++]=k[0];g[h++]=k[1];g[h++]=k[2];f=0;for(h=g.length;f<h;++f)r[s++]=g[f];u[g[0]]++;v[g[3]]++;t=c.length+d-1;q=null}var f,g,h,m,n,p={},q,r=y?new Uint16Array(2*d.length):[],s=0,t=0,u=new (y?Uint32Array:Array)(286),v=new (y?Uint32Array:Array)(30),w=c.w,z;if(!y){for(h=0;285>=h;)u[h++]=0;for(h=0;29>=h;)v[h++]=0}u[256]=1;f=0;for(g=d.length;f<g;++f){h=n=0;for(m=3;h<m&&f+h!==g;++h)n=n<<8|d[f+h];p[n]===B&&(p[n]=[]);h=p[n];if(!(0<t--)){for(;0<h.length&&32768<f-h[0];)h.shift();if(f+3>=g){q&&e(q,-1);h=0;
for(m=g-f;h<m;++h)z=d[f+h],r[s++]=z,++u[z];break}if(0<h.length){n=m=B;var C=0,A=B,x=B,D=A=B,H=d.length,x=0,D=h.length;a:for(;x<D;x++){m=h[D-x-1];A=3;if(3<C){for(A=C;3<A;A--)if(d[m+A-1]!==d[f+A-1])continue a;A=C}for(;258>A&&f+A<H&&d[m+A]===d[f+A];)++A;A>C&&(n=m,C=A);if(258===A)break}m=new k(C,f-n);q?q.length<m.length?(z=d[f-1],r[s++]=z,++u[z],e(m,0)):e(q,-1):m.length<w?q=m:e(m,0)}else q?e(q,-1):(z=d[f],r[s++]=z,++u[z])}h.push(f)}r[s++]=256;u[256]++;c.L=u;c.K=v;return y?r.subarray(0,s):r}function p(a,
c){function d(a){var c=r[a][s[a]];c===p?(d(a+1),d(a+1)):--q[c];++s[a]}var e=a.length,g=new f(572),h=new (y?Uint8Array:Array)(e),k,m,n;if(!y)for(m=0;m<e;m++)h[m]=0;for(m=0;m<e;++m)0<a[m]&&g.push(m,a[m]);e=Array(g.length/2);k=new (y?Uint32Array:Array)(g.length/2);if(1===e.length)return h[g.pop().index]=1,h;m=0;for(n=g.length/2;m<n;++m)e[m]=g.pop(),k[m]=e[m].value;var p=k.length;m=new (y?Uint16Array:Array)(c);var g=new (y?Uint8Array:Array)(c),q=new (y?Uint8Array:Array)(p);n=Array(c);var r=Array(c),s=
Array(c),t=(1<<c)-p,u=1<<c-1,v,w,z;m[c-1]=p;for(v=0;v<c;++v)t<u?g[v]=0:(g[v]=1,t-=u),t<<=1,m[c-2-v]=(m[c-1-v]/2|0)+p;m[0]=g[0];n[0]=Array(m[0]);r[0]=Array(m[0]);for(v=1;v<c;++v)m[v]>2*m[v-1]+g[v]&&(m[v]=2*m[v-1]+g[v]),n[v]=Array(m[v]),r[v]=Array(m[v]);for(t=0;t<p;++t)q[t]=c;for(u=0;u<m[c-1];++u)n[c-1][u]=k[u],r[c-1][u]=u;for(t=0;t<c;++t)s[t]=0;1===g[c-1]&&(--q[0],++s[c-1]);for(v=c-2;0<=v;--v){w=t=0;z=s[v+1];for(u=0;u<m[v];u++)w=n[v+1][z]+n[v+1][z+1],w>k[t]?(n[v][u]=w,r[v][u]=p,z+=2):(n[v][u]=k[t],
r[v][u]=t,++t);s[v]=0;1===g[v]&&d(v)}k=q;m=0;for(n=e.length;m<n;++m)h[e[m].index]=k[m];return h}function q(c){var d=new (y?Uint16Array:Array)(c.length),e=[],f=[],g=0,h,k,m;h=0;for(k=c.length;h<k;h++)e[c[h]]=(e[c[h]]|0)+1;h=1;for(k=16;h<=k;h++)f[h]=g,g+=e[h]|0,g>1<<h&&a("overcommitted"),g<<=1;65536>g&&a("undercommitted");h=0;for(k=c.length;h<k;h++)for(g=f[c[h]],f[c[h]]+=1,e=d[h]=0,m=c[h];e<m;e++)d[h]=d[h]<<1|g&1,g>>>=1;return d}function s(a,c){this.input=a;this.a=new (y?Uint8Array:Array)(32768);this.h=
H.j;var d={},e;!c&&(c={})||"number"!==typeof c.compressionType||(this.h=c.compressionType);for(e in c)d[e]=c[e];d.outputBuffer=this.a;this.z=new h(this.input,d)}function r(c,d){this.k=[];this.l=32768;this.e=this.g=this.c=this.q=0;this.input=y?new Uint8Array(c):c;this.s=!1;this.m=O;this.B=!1;if(d||!(d={}))d.index&&(this.c=d.index),d.bufferSize&&(this.l=d.bufferSize),d.bufferType&&(this.m=d.bufferType),d.resize&&(this.B=d.resize);switch(this.m){case I:this.b=32768;this.a=new (y?Uint8Array:Array)(32768+
this.l+258);break;case O:this.b=0;this.a=new (y?Uint8Array:Array)(this.l);this.f=this.J;this.t=this.H;this.o=this.I;break;default:a(Error("invalid inflate mode"))}}function t(c,d){for(var e=c.g,f=c.e,g=c.input,h=c.c,k;f<d;)k=g[h++],k===B&&a(Error("input buffer is broken")),e|=k<<f,f+=8;c.g=e>>>d;c.e=f-d;c.c=h;return e&(1<<d)-1}function u(c,d){for(var e=c.g,f=c.e,g=c.input,h=c.c,k=d[0],m=d[1],n;f<m;)n=g[h++],n===B&&a(Error("input buffer is broken")),e|=n<<f,f+=8;g=k[e&(1<<m)-1];k=g>>>16;c.g=e>>k;c.e=
f-k;c.c=h;return g&65535}function v(a){function c(a,d,e){var f,g,h,k;for(k=0;k<a;)switch(f=u(this,d),f){case 16:for(h=3+t(this,2);h--;)e[k++]=g;break;case 17:for(h=3+t(this,3);h--;)e[k++]=0;g=0;break;case 18:for(h=11+t(this,7);h--;)e[k++]=0;g=0;break;default:g=e[k++]=f}return e}var d=t(a,5)+257,e=t(a,5)+1,f=t(a,4)+4,h=new (y?Uint8Array:Array)(R.length),k;for(k=0;k<f;++k)h[R[k]]=t(a,3);f=g(h);h=new (y?Uint8Array:Array)(d);k=new (y?Uint8Array:Array)(e);a.o(g(c.call(a,d,f,h)),g(c.call(a,e,f,k)))}function z(c,
d){var e,f;this.input=c;this.c=0;if(d||!(d={}))d.index&&(this.c=d.index),d.verify&&(this.M=d.verify);e=c[this.c++];f=c[this.c++];switch(e&15){case N:this.method=N;break;default:a(Error("unsupported compression method"))}0!==((e<<8)+f)%31&&a(Error("invalid fcheck flag:"+((e<<8)+f)%31));f&32&&a(Error("fdict flag is not supported"));this.A=new r(c,{index:this.c,bufferSize:d.bufferSize,bufferType:d.bufferType,resize:d.resize})}var B=void 0,E=!0,x=this,y="undefined"!==typeof Uint8Array&&"undefined"!==
typeof Uint16Array&&"undefined"!==typeof Uint32Array;e.prototype.f=function(){var a=this.buffer,c,d=a.length,e=new (y?Uint8Array:Array)(d<<1);if(y)e.set(a);else for(c=0;c<d;++c)e[c]=a[c];return this.buffer=e};e.prototype.d=function(a,c,d){var e=this.buffer,f=this.index,g=this.i,h=e[f];d&&1<c&&(a=8<c?(D[a&255]<<24|D[a>>>8&255]<<16|D[a>>>16&255]<<8|D[a>>>24&255])>>32-c:D[a]>>8-c);if(8>c+g)h=h<<c|a,g+=c;else for(d=0;d<c;++d)h=h<<1|a>>c-d-1&1,8===++g&&(g=0,e[f++]=D[h],h=0,f===e.length&&(e=this.f()));
e[f]=h;this.buffer=e;this.i=g;this.index=f};e.prototype.finish=function(){var a=this.buffer,c=this.index,d;0<this.i&&(a[c]<<=8-this.i,a[c]=D[a[c]],c++);y?d=a.subarray(0,c):(a.length=c,d=a);return d};var C=new (y?Uint8Array:Array)(256),w;for(w=0;256>w;++w){for(var A=w,F=A,G=7,A=A>>>1;A;A>>>=1)F<<=1,F|=A&1,--G;C[w]=(F<<G&255)>>>0}var D=C,C=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,
498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,
3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,
2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,
2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,
2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,
711928724,3020668471,3272380065,1510334235,755167117];y&&new Uint32Array(C);f.prototype.getParent=function(a){return 2*((a-2)/4|0)};f.prototype.push=function(a,c){var d,e,f=this.buffer,g;d=this.length;f[this.length++]=c;for(f[this.length++]=a;0<d;)if(e=this.getParent(d),f[d]>f[e])g=f[d],f[d]=f[e],f[e]=g,g=f[d+1],f[d+1]=f[e+1],f[e+1]=g,d=e;else break;return this.length};f.prototype.pop=function(){var a,c,d=this.buffer,e,f,g;c=d[0];a=d[1];this.length-=2;d[0]=d[this.length];d[1]=d[this.length+1];for(g=
0;;){f=2*g+2;if(f>=this.length)break;f+2<this.length&&d[f+2]>d[f]&&(f+=2);if(d[f]>d[g])e=d[g],d[g]=d[f],d[f]=e,e=d[g+1],d[g+1]=d[f+1],d[f+1]=e;else break;g=f}return{index:a,value:c,length:this.length}};var J=2,C={NONE:0,r:1,j:J,N:3},L=[];for(w=0;288>w;w++)switch(E){case 143>=w:L.push([w+48,8]);break;case 255>=w:L.push([w-144+400,9]);break;case 279>=w:L.push([w-256+0,7]);break;case 287>=w:L.push([w-280+192,8]);break;default:a("invalid literal: "+w)}h.prototype.n=function(){var c,d,f,g,h=this.input;
switch(this.h){case 0:f=0;for(g=h.length;f<g;){d=y?h.subarray(f,f+65535):h.slice(f,f+65535);f+=d.length;var k=f===g,m=B,r=m=B,r=m=B,s=this.a,t=this.b;if(y){for(s=new Uint8Array(this.a.buffer);s.length<=t+d.length+5;)s=new Uint8Array(s.length<<1);s.set(this.a)}m=k?1:0;s[t++]=m|0;m=d.length;r=~m+65536&65535;s[t++]=m&255;s[t++]=m>>>8&255;s[t++]=r&255;s[t++]=r>>>8&255;if(y)s.set(d,t),t+=d.length,s=s.subarray(0,t);else{m=0;for(r=d.length;m<r;++m)s[t++]=d[m];s.length=t}this.b=t;this.a=s}break;case 1:f=
new e(new Uint8Array(this.a.buffer),this.b);f.d(1,1,E);f.d(1,2,E);h=n(this,h);d=0;for(k=h.length;d<k;d++)if(g=h[d],e.prototype.d.apply(f,L[g]),256<g)f.d(h[++d],h[++d],E),f.d(h[++d],5),f.d(h[++d],h[++d],E);else if(256===g)break;this.a=f.finish();this.b=this.a.length;break;case J:g=new e(new Uint8Array(this.a),this.b);var u,v,w,z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],C,A,m=Array(19),x,s=J;g.d(1,1,E);g.d(s,2,E);h=n(this,h);r=p(this.L,15);C=q(r);s=p(this.K,7);t=q(s);for(u=286;257<u&&0===r[u-
1];u--);for(v=30;1<v&&0===s[v-1];v--);var D=u,H=v;c=new (y?Uint32Array:Array)(D+H);var F=new (y?Uint32Array:Array)(316),G,I;A=new (y?Uint8Array:Array)(19);for(x=w=0;x<D;x++)c[w++]=r[x];for(x=0;x<H;x++)c[w++]=s[x];if(!y)for(x=0,H=A.length;x<H;++x)A[x]=0;x=G=0;for(H=c.length;x<H;x+=w){for(w=1;x+w<H&&c[x+w]===c[x];++w);D=w;if(0===c[x])if(3>D)for(;0<D--;)F[G++]=0,A[0]++;else for(;0<D;)I=138>D?D:138,I>D-3&&I<D&&(I=D-3),10>=I?(F[G++]=17,F[G++]=I-3,A[17]++):(F[G++]=18,F[G++]=I-11,A[18]++),D-=I;else if(F[G++]=
c[x],A[c[x]]++,D--,3>D)for(;0<D--;)F[G++]=c[x],A[c[x]]++;else for(;0<D;)I=6>D?D:6,I>D-3&&I<D&&(I=D-3),F[G++]=16,F[G++]=I-3,A[16]++,D-=I}c=y?F.subarray(0,G):F.slice(0,G);A=p(A,7);for(x=0;19>x;x++)m[x]=A[z[x]];for(w=19;4<w&&0===m[w-1];w--);z=q(A);g.d(u-257,5,E);g.d(v-1,5,E);g.d(w-4,4,E);for(x=0;x<w;x++)g.d(m[x],3,E);x=0;for(m=c.length;x<m;x++)if(d=c[x],g.d(z[d],A[d],E),16<=d){x++;switch(d){case 16:k=2;break;case 17:k=3;break;case 18:k=7;break;default:a("invalid code: "+d)}g.d(c[x],k,E)}k=[C,r];t=[t,
s];d=k[0];k=k[1];s=t[0];C=t[1];t=0;for(m=h.length;t<m;++t)if(f=h[t],g.d(d[f],k[f],E),256<f)g.d(h[++t],h[++t],E),r=h[++t],g.d(s[r],C[r],E),g.d(h[++t],h[++t],E);else if(256===f)break;this.a=g.finish();this.b=this.a.length;break;default:a("invalid compression type")}return this.a};w=[];var K;for(K=3;258>=K;K++)A=m(),w[K]=A[2]<<24|A[1]<<16|A[0];var M=y?new Uint32Array(w):w,H=C;s.prototype.n=function(){var c,e,f,g,h=0;g=this.a;c=N;switch(c){case N:e=Math.LOG2E*Math.log(32768)-8;break;default:a(Error("invalid compression method"))}e=
e<<4|c;g[h++]=e;switch(c){case N:switch(this.h){case H.NONE:f=0;break;case H.r:f=1;break;case H.j:f=2;break;default:a(Error("unsupported compression type"))}break;default:a(Error("invalid compression method"))}c=f<<6|0;g[h++]=c|31-(256*e+c)%31;c=d(this.input);this.z.b=h;g=this.z.n();h=g.length;y&&(g=new Uint8Array(g.buffer),g.length<=h+4&&(this.a=new Uint8Array(g.length+4),this.a.set(g),g=this.a),g=g.subarray(0,h+4));g[h++]=c>>24&255;g[h++]=c>>16&255;g[h++]=c>>8&255;g[h++]=c&255;return g};c("Zlib.Deflate",
s);c("Zlib.Deflate.compress",function(a,c){return(new s(a,c)).n()});c("Zlib.Deflate.CompressionType",H);c("Zlib.Deflate.CompressionType.NONE",H.NONE);c("Zlib.Deflate.CompressionType.FIXED",H.r);c("Zlib.Deflate.CompressionType.DYNAMIC",H.j);var I=0,O=1,C={D:I,C:O};r.prototype.p=function(){for(;!this.s;){var c=t(this,3);c&1&&(this.s=E);c>>>=1;switch(c){case 0:var c=this.input,d=this.c,e=this.a,f=this.b,g=B,h=B,k=B,m=e.length,g=B;this.e=this.g=0;g=c[d++];g===B&&a(Error("invalid uncompressed block header: LEN (first byte)"));
h=g;g=c[d++];g===B&&a(Error("invalid uncompressed block header: LEN (second byte)"));h|=g<<8;g=c[d++];g===B&&a(Error("invalid uncompressed block header: NLEN (first byte)"));k=g;g=c[d++];g===B&&a(Error("invalid uncompressed block header: NLEN (second byte)"));k|=g<<8;h===~k&&a(Error("invalid uncompressed block header: length verify"));d+h>c.length&&a(Error("input buffer is broken"));switch(this.m){case I:for(;f+h>e.length;){g=m-f;h-=g;if(y)e.set(c.subarray(d,d+g),f),f+=g,d+=g;else for(;g--;)e[f++]=
c[d++];this.b=f;e=this.f();f=this.b}break;case O:for(;f+h>e.length;)e=this.f({v:2});break;default:a(Error("invalid inflate mode"))}if(y)e.set(c.subarray(d,d+h),f),f+=h,d+=h;else for(;h--;)e[f++]=c[d++];this.c=d;this.b=f;this.a=e;break;case 1:this.o(U,V);break;case 2:v(this);break;default:a(Error("unknown BTYPE: "+c))}}return this.t()};w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var R=y?new Uint16Array(w):w;w=[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 S=y?new Uint16Array(w):w;w=[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 P=y?new Uint8Array(w):w;w=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];var T=y?new Uint16Array(w):w;w=[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 Q=y?new Uint8Array(w):w;w=new (y?Uint8Array:Array)(288);A=0;for(F=w.length;A<F;++A)w[A]=143>=A?8:255>=A?9:279>=A?7:8;var U=g(w);w=new (y?Uint8Array:
Array)(30);A=0;for(F=w.length;A<F;++A)w[A]=5;var V=g(w);r.prototype.o=function(a,c){var d=this.a,e=this.b;this.u=a;for(var f=d.length-258,g,h,k;256!==(g=u(this,a));)if(256>g)e>=f&&(this.b=e,d=this.f(),e=this.b),d[e++]=g;else for(g-=257,k=S[g],0<P[g]&&(k+=t(this,P[g])),g=u(this,c),h=T[g],0<Q[g]&&(h+=t(this,Q[g])),e>=f&&(this.b=e,d=this.f(),e=this.b);k--;)d[e]=d[e++-h];for(;8<=this.e;)this.e-=8,this.c--;this.b=e};r.prototype.I=function(a,c){var d=this.a,e=this.b;this.u=a;for(var f=d.length,g,h,k;256!==
(g=u(this,a));)if(256>g)e>=f&&(d=this.f(),f=d.length),d[e++]=g;else for(g-=257,k=S[g],0<P[g]&&(k+=t(this,P[g])),g=u(this,c),h=T[g],0<Q[g]&&(h+=t(this,Q[g])),e+k>f&&(d=this.f(),f=d.length);k--;)d[e]=d[e++-h];for(;8<=this.e;)this.e-=8,this.c--;this.b=e};r.prototype.f=function(){var a=new (y?Uint8Array:Array)(this.b-32768),c=this.b-32768,d,e,f=this.a;if(y)a.set(f.subarray(32768,a.length));else for(d=0,e=a.length;d<e;++d)a[d]=f[d+32768];this.k.push(a);this.q+=a.length;if(y)f.set(f.subarray(c,c+32768));
else for(d=0;32768>d;++d)f[d]=f[c+d];this.b=32768;return f};r.prototype.J=function(a){var c,d=this.input.length/this.c+1|0,e,f,g,h=this.input,k=this.a;a&&("number"===typeof a.v&&(d=a.v),"number"===typeof a.F&&(d+=a.F));2>d?(e=(h.length-this.c)/this.u[2],g=e/2*258|0,f=g<k.length?k.length+g:k.length<<1):f=k.length*d;y?(c=new Uint8Array(f),c.set(k)):c=k;return this.a=c};r.prototype.t=function(){var a=0,c=this.a,d=this.k,e,f=new (y?Uint8Array:Array)(this.q+(this.b-32768)),g,h,k,m;if(0===d.length)return y?
this.a.subarray(32768,this.b):this.a.slice(32768,this.b);g=0;for(h=d.length;g<h;++g)for(e=d[g],k=0,m=e.length;k<m;++k)f[a++]=e[k];g=32768;for(h=this.b;g<h;++g)f[a++]=c[g];this.k=[];return this.buffer=f};r.prototype.H=function(){var a,c=this.b;y?this.B?(a=new Uint8Array(c),a.set(this.a.subarray(0,c))):a=this.a.subarray(0,c):(this.a.length>c&&(this.a.length=c),a=this.a);return this.buffer=a};z.prototype.p=function(){var c=this.input,e,f;e=this.A.p();this.c=this.A.c;this.M&&(f=(c[this.c++]<<24|c[this.c++]<<
16|c[this.c++]<<8|c[this.c++])>>>0,f!==d(e)&&a(Error("invalid adler-32 checksum")));return e};c("Zlib.Inflate",z);c("Zlib.Inflate.BufferType",C);C.ADAPTIVE=C.C;C.BLOCK=C.D;c("Zlib.Inflate.prototype.decompress",z.prototype.p);C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];y&&new Uint16Array(C);C=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258];y&&new Uint16Array(C);C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0];y&&new Uint8Array(C);
C=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];y&&new Uint16Array(C);C=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];y&&new Uint8Array(C);C=new (y?Uint8Array:Array)(288);w=0;for(A=C.length;w<A;++w)C[w]=143>=w?8:255>=w?9:279>=w?7:8;g(C);C=new (y?Uint8Array:Array)(30);w=0;for(A=C.length;w<A;++w)C[w]=5;g(C);var N=8}).call(this);cc.PNGReader=cc.Class.extend({ctor:function(a){var c,d,e,f;this.data=a;this.pos=8;this.palette=[];this.imgData=[];this.transparency={};this.animation=null;this.text={};for(e=null;;){c=this.readUInt32();f=a=void 0;f=[];for(a=0;4>a;++a)f.push(String.fromCharCode(this.data[this.pos++]));a=f.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(c);break;case "fcTL":e&&this.animation.frames.push(e);this.pos+=4;e={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};a=this.readUInt16();c=this.readUInt16()||100;e.delay=1E3*a/c;e.disposeOp=this.data[this.pos++];e.blendOp=this.data[this.pos++];
e.data=[];break;case "IDAT":case "fdAT":"fdAT"===a&&(this.pos+=4,c-=4);a=(null!=e?e.data:void 0)||this.imgData;for(f=0;0<=c?f<c:f>c;0<=c?++f:--f)a.push(this.data[this.pos++]);break;case "tRNS":this.transparency={};switch(this.colorType){case 3:this.transparency.indexed=this.read(c);c=255-this.transparency.indexed.length;if(0<c)for(a=0;0<=c?a<c:a>c;0<=c?++a:--a)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(c)[0];break;case 2:this.transparency.rgb=this.read(c)}break;
case "tEXt":f=this.read(c);c=f.indexOf(0);a=String.fromCharCode.apply(String,f.slice(0,c));this.text[a]=String.fromCharCode.apply(String,f.slice(c+1));break;case "IEND":e&&this.animation.frames.push(e);a:{switch(this.colorType){case 0:case 3:case 4:e=1;break a;case 2:case 6:e=3;break a}e=void 0}this.colors=e;this.hasAlphaChannel=4===(d=this.colorType)||6===d;d=this.colors+(this.hasAlphaChannel?1:0);this.pixelBitlength=this.bits*d;a:{switch(this.colors){case 1:d="DeviceGray";break a;case 3:d="DeviceRGB";
break a}d=void 0}this.colorSpace=d;Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData));return;default:this.pos+=c}this.pos+=4;if(this.pos>this.data.length)throw Error("Incomplete or corrupt PNG file");}},read:function(a){var c,d;d=[];for(c=0;0<=a?c<a:c>a;0<=a?++c:--c)d.push(this.data[this.pos++]);return d},readUInt32:function(){var a,c,d,e;a=this.data[this.pos++]<<24;c=this.data[this.pos++]<<16;d=this.data[this.pos++]<<8;e=this.data[this.pos++];return a|c|d|e},readUInt16:function(){var a,
c;a=this.data[this.pos++]<<8;c=this.data[this.pos++];return a|c},decodePixels:function(a){var c,d,e,f,g,h,k,m,n,p,q,s,r,t,u;null==a&&(a=this.imgData);if(0===a.length)return new Uint8Array(0);a=(new Zlib.Inflate(a,{index:0,verify:!1})).decompress();m=this.pixelBitlength/8;s=m*this.width;n=new Uint8Array(s*this.height);h=a.length;for(d=p=q=0;p<h;){switch(a[p++]){case 0:for(c=0;c<s;c+=1)n[d++]=a[p++];break;case 1:for(f=r=0;r<s;f=r+=1)c=a[p++],g=f<m?0:n[d-m],n[d++]=(c+g)%256;break;case 2:for(f=g=0;g<
s;f=g+=1)c=a[p++],e=(f-f%m)/m,r=q&&n[(q-1)*s+e*m+f%m],n[d++]=(r+c)%256;break;case 3:for(f=u=0;u<s;f=u+=1)c=a[p++],e=(f-f%m)/m,g=f<m?0:n[d-m],r=q&&n[(q-1)*s+e*m+f%m],n[d++]=(c+Math.floor((g+r)/2))%256;break;case 4:for(f=u=0;u<s;f=u+=1)c=a[p++],e=(f-f%m)/m,g=f<m?0:n[d-m],0===q?r=t=0:(r=n[(q-1)*s+e*m+f%m],t=e&&n[(q-1)*s+(e-1)*m+f%m]),k=g+r-t,f=Math.abs(k-g),e=Math.abs(k-r),k=Math.abs(k-t),g=f<=e&&f<=k?g:e<=k?r:t,n[d++]=(c+g)%256;break;default:throw Error("Invalid filter algorithm: "+a[p-1]);}q++}return n},
copyToImageData:function(a,c){var d,e,f,g,h,k,m,n;e=this.colors;n=null;d=this.hasAlphaChannel;this.palette.length&&(n=null!=(f=this._decodedPalette)?f:this._decodedPalette=this.decodePalette(),e=4,d=!0);f=a.data||a;m=f.length;h=n||c;g=k=0;if(1===e)for(;g<m;)e=n?4*c[g/4]:k,k=h[e++],f[g++]=k,f[g++]=k,f[g++]=k,f[g++]=d?h[e++]:255,k=e;else for(;g<m;)e=n?4*c[g/4]:k,f[g++]=h[e++],f[g++]=h[e++],f[g++]=h[e++],f[g++]=d?h[e++]:255,k=e},decodePalette:function(){var a,c,d,e,f,g,h,k,m;d=this.palette;g=this.transparency.indexed||
[];f=new Uint8Array((g.length||0)+d.length);c=h=a=e=0;for(k=d.length;h<k;c=h+=3)f[e++]=d[c],f[e++]=d[c+1],f[e++]=d[c+2],f[e++]=null!=(m=g[a++])?m:255;return f},render:function(a){var c;a.width=this.width;a.height=this.height;a=a.getContext("2d");c=a.createImageData(this.width,this.height);this.copyToImageData(c,this.decodePixels());return a.putImageData(c,0,0)}});cc.TIFFReader=cc.Class.extend({_littleEndian:!1,_tiffData:null,_fileDirectories:null,ctor:function(){this._fileDirectories=[]},getUint8:function(a){return this._tiffData[a]},getUint16:function(a){return this._littleEndian?this._tiffData[a+1]<<8|this._tiffData[a]:this._tiffData[a]<<8|this._tiffData[a+1]},getUint32:function(a){var c=this._tiffData;return this._littleEndian?c[a+3]<<24|c[a+2]<<16|c[a+1]<<8|c[a]:c[a]<<24|c[a+1]<<16|c[a+2]<<8|c[a+3]},checkLittleEndian:function(){var a=this.getUint16(0);
if(18761===a)this.littleEndian=!0;else if(19789===a)this.littleEndian=!1;else throw console.log(a),TypeError("Invalid byte order value.");return this.littleEndian},hasTowel:function(){if(42!==this.getUint16(2))throw RangeError("You forgot your towel!");return!0},getFieldTypeName:function(a){var c=this.fieldTypeNames;return a in c?c[a]:null},getFieldTagName:function(a){var c=this.fieldTagNames;if(a in c)return c[a];console.log("Unknown Field Tag:",a);return"Tag"+a},getFieldTypeLength:function(a){return-1!==
["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(a)?1:-1!==["SHORT","SSHORT"].indexOf(a)?2:-1!==["LONG","SLONG","FLOAT"].indexOf(a)?4:-1!==["RATIONAL","SRATIONAL","DOUBLE"].indexOf(a)?8:null},getFieldValues:function(a,c,d,e){a=[];var f=this.getFieldTypeLength(c);if(4>=f*d)!1===this.littleEndian?a.push(e>>>8*(4-f)):a.push(e);else for(var g=0;g<d;g++){var h=f*g;8<=f?-1!==["RATIONAL","SRATIONAL"].indexOf(c)?(a.push(this.getUint32(e+h)),a.push(this.getUint32(e+h+4))):cc.log("Can't handle this field type or size"):
a.push(this.getBytes(f,e+h))}"ASCII"===c&&a.forEach(function(a,c,d){d[c]=String.fromCharCode(a)});return a},getBytes:function(a,c){if(0>=a)cc.log("No bytes requested");else{if(1>=a)return this.getUint8(c);if(2>=a)return this.getUint16(c);if(3>=a)return this.getUint32(c)>>>8;if(4>=a)return this.getUint32(c);cc.log("Too many bytes requested")}},getBits:function(a,c,d){d=d||0;c+=Math.floor(d/8);var e=d+a;a=32-a;var f,g;0>=e?console.log("No bits requested"):8>=e?(f=24+d,g=this.getUint8(c)):16>=e?(f=16+
d,g=this.getUint16(c)):32>=e?(f=d,g=this.getUint32(c)):console.log("Too many bits requested");return{bits:g<<f>>>a,byteOffset:c+Math.floor(e/8),bitOffset:e%8}},parseFileDirectory:function(a){var c=this.getUint16(a),d=[];a+=2;for(var e=0;e<c;a+=12,e++){var f=this.getUint16(a),g=this.getUint16(a+2),h=this.getUint32(a+4),k=this.getUint32(a+8),f=this.getFieldTagName(f),g=this.getFieldTypeName(g),h=this.getFieldValues(f,g,h,k);d[f]={type:g,values:h}}this.fileDirectories.push(d);c=this.getUint32(a);0!==
c&&this.parseFileDirectory(c)},clampColorSample:function(a,c){var d=Math.pow(2,8-c);return Math.floor(a*d+(d-1))},parseTIFF:function(a,c){c=c||document.createElement("canvas");this._tiffData=a;this.canvas=c;this.checkLittleEndian();if(this.hasTowel()){var d=this.getUint32(4);this.fileDirectories=[];this.parseFileDirectory(d);var e=this.fileDirectories[0],d=e.ImageWidth.values[0],f=e.ImageLength.values[0];this.canvas.width=d;this.canvas.height=f;var g=[],h=e.Compression?e.Compression.values[0]:1,k=
e.SamplesPerPixel.values[0],m=[],n=0,p=!1;e.BitsPerSample.values.forEach(function(a,c,d){m[c]={bitsPerSample:a,hasBytesPerSample:!1,bytesPerSample:void 0};0===a%8&&(m[c].hasBytesPerSample=!0,m[c].bytesPerSample=a/8);n+=a},this);if(0===n%8)var p=!0,q=n/8;var s=e.StripOffsets.values,r=s.length;if(e.StripByteCounts)var t=e.StripByteCounts.values;else if(cc.log("Missing StripByteCounts!"),1===r)t=[Math.ceil(d*f*n/8)];else throw Error("Cannot recover from missing StripByteCounts");for(var u=0;u<r;u++){var v=
s[u];g[u]=[];for(var z=t[u],B=0,E=0,x=1,y=!0,C=[],w=0,A=0,F=0;B<z;B+=x)switch(h){case 1:x=0;for(C=[];x<k;x++)if(m[x].hasBytesPerSample)C.push(this.getBytes(m[x].bytesPerSample,v+B+m[x].bytesPerSample*x));else{var G=this.getBits(m[x].bitsPerSample,v+B,E);C.push(G.bits);B=G.byteOffset-v;E=G.bitOffset;throw RangeError("Cannot handle sub-byte bits per sample");}g[u].push(C);if(p)x=q;else throw x=0,RangeError("Cannot handle sub-byte bits per pixel");break;case 32773:if(y){var y=!1,D=1,J=1,x=this.getInt8(v+
B);0<=x&&127>=x?D=x+1:-127<=x&&-1>=x?J=-x+1:y=!0}else{for(var L=this.getUint8(v+B),x=0;x<J;x++){if(m[A].hasBytesPerSample)F=F<<8*w|L,w++,w===m[A].bytesPerSample&&(C.push(F),F=w=0,A++);else throw RangeError("Cannot handle sub-byte bits per sample");A===k&&(g[u].push(C),C=[],A=0)}D--;0===D&&(y=!0)}x=1}}if(c.getContext){q=this.canvas.getContext("2d");q.fillStyle="rgba(255, 255, 255, 0)";u=e.RowsPerStrip?e.RowsPerStrip.values[0]:f;v=g.length;f%=u;f=0===f?u:f;B=u;h=0;C=e.PhotometricInterpretation.values[0];
D=[];J=0;e.ExtraSamples&&(D=e.ExtraSamples.values,J=D.length);if(e.ColorMap)var G=e.ColorMap.values,K=Math.pow(2,m[0].bitsPerSample);for(u=0;u<v;u++){u+1===v&&(B=f);e=g[u].length;h*=u;for(p=k=0;k<B,p<e;k++)for(s=0;s<d;s++,p++){t=g[u][p];y=E=z=0;r=1;if(0<J)for(z=0;z<J;z++)if(1===D[z]||2===D[z]){r=t[3+z]/256;break}switch(C){case 0:if(m[0].hasBytesPerSample)var M=Math.pow(16,2*m[0].bytesPerSample);t.forEach(function(a,c,d){d[c]=M-a});case 1:z=E=y=this.clampColorSample(t[0],m[0].bitsPerSample);break;
case 2:z=this.clampColorSample(t[0],m[0].bitsPerSample);E=this.clampColorSample(t[1],m[1].bitsPerSample);y=this.clampColorSample(t[2],m[2].bitsPerSample);break;case 3:if(void 0===G)throw Error("Palette image missing color map");t=t[0];z=this.clampColorSample(G[t],16);E=this.clampColorSample(G[K+t],16);y=this.clampColorSample(G[2*K+t],16);break;default:throw RangeError("Unknown Photometric Interpretation:",C);}q.fillStyle="rgba("+z+", "+E+", "+y+", "+r+")";q.fillRect(s,h+k,1,1)}h=B}}return this.canvas}},
fieldTagNames:{315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",
296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",
559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",
40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop"},fieldTypeNames:{1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE"}});cc.TIFFReader.__instance=null;
cc.TIFFReader.getInstance=function(){cc.TIFFReader.__instance||(cc.TIFFReader.__instance=new cc.TIFFReader);return cc.TIFFReader.__instance};cc.PARTICLE_SHAPE_MODE=0;cc.PARTICLE_TEXTURE_MODE=1;cc.PARTICLE_STAR_SHAPE=0;cc.PARTICLE_BALL_SHAPE=1;cc.PARTICLE_DURATION_INFINITY=-1;cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE=-1;cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS=-1;cc.PARTICLE_MODE_GRAVITY=0;cc.PARTICLE_MODE_RADIUS=1;cc.PARTICLE_TYPE_FREE=0;cc.PARTICLE_TYPE_RELATIVE=1;cc.PARTICLE_TYPE_GROUPED=2;
cc.Particle=function(a,c,d,e,f,g,h,k,m,n,p,q){this.pos=a?a:cc.PointZero();this.startPos=c?c:cc.PointZero();this.color=d?d:new cc.Color4F(0,0,0,1);this.deltaColor=e?e:new cc.Color4F(0,0,0,1);this.size=f||0;this.deltaSize=g||0;this.rotation=h||0;this.deltaRotation=k||0;this.timeToLive=m||0;this.atlasIndex=n||0;this.modeA=p?p:new cc.Particle.ModeA;this.modeB=q?q:new cc.Particle.ModeB;this.isChangeColor=!1;this.drawPos=cc.p(0,0)};
cc.Particle.ModeA=function(a,c,d){this.dir=a?a:cc.PointZero();this.radialAccel=c||0;this.tangentialAccel=d||0};cc.Particle.ModeB=function(a,c,d,e){this.angle=a||0;this.degreesPerSecond=c||0;this.radius=d||0;this.deltaRadius=e||0};cc.Particle.TemporaryPoints=[cc.p(),cc.p(),cc.p(),cc.p()];
cc.ParticleSystem=cc.Node.extend({_plistFile:"",_elapsed:0,_dontTint:!1,modeA:null,modeB:null,_pointZeroForParticle:cc.p(0,0),_particles:null,_emitCounter:0,_particleIdx:0,_batchNode:null,_atlasIndex:0,_transformSystemDirty:!1,_allocatedParticles:0,_drawMode:cc.PARTICLE_SHAPE_MODE,_shapeType:cc.PARTICLE_BALL_SHAPE,_isActive:!1,_particleCount:0,_duration:0,_sourcePosition:null,_posVar:null,_life:0,_lifeVar:0,_angle:0,_angleVar:0,_startSize:0,_startSizeVar:0,_endSize:0,_endSizeVar:0,_startColor:null,
_startColorVar:null,_endColor:null,_endColorVar:null,_startSpin:0,_startSpinVar:0,_endSpin:0,_endSpinVar:0,_emissionRate:0,_totalParticles:0,_texture:null,_blendFunc:null,_opacityModifyRGB:!1,_positionType:cc.PARTICLE_TYPE_FREE,_isAutoRemoveOnFinish:!1,_emitterMode:0,_quads:null,_indices:null,_buffersVBO:null,_pointRect:null,_textureLoaded:null,_quadsArrayBuffer:null,ctor:function(){cc.Node.prototype.ctor.call(this);this._emitterMode=cc.PARTICLE_MODE_GRAVITY;this.modeA=new cc.ParticleSystem.ModeA;
this.modeB=new cc.ParticleSystem.ModeB;this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._particles=[];this._sourcePosition=new cc.Point(0,0);this._posVar=new cc.Point(0,0);this._startColor=new cc.Color4F(1,1,1,1);this._startColorVar=new cc.Color4F(1,1,1,1);this._endColor=new cc.Color4F(1,1,1,1);this._endColorVar=new cc.Color4F(1,1,1,1);this._plistFile="";this._elapsed=0;this._dontTint=!1;this._pointZeroForParticle=cc.p(0,0);this._particleIdx=this._emitCounter=0;this._batchNode=null;this._atlasIndex=
0;this._transformSystemDirty=!1;this._allocatedParticles=0;this._drawMode=cc.PARTICLE_SHAPE_MODE;this._shapeType=cc.PARTICLE_BALL_SHAPE;this._isActive=!1;this._totalParticles=this._emissionRate=this._endSpinVar=this._endSpin=this._startSpinVar=this._startSpin=this._endSizeVar=this._endSize=this._startSizeVar=this._startSize=this._angleVar=this._angle=this._lifeVar=this._life=this._duration=this._particleCount=0;this._texture=null;this._opacityModifyRGB=!1;this._positionType=cc.PARTICLE_TYPE_FREE;
this._isAutoRemoveOnFinish=!1;this._buffersVBO=[0,0];this._quads=[];this._indices=[];this._pointRect=cc.RectZero();this._textureLoaded=!0;cc.renderContextType===cc.WEBGL&&(this._quadsArrayBuffer=null)},initIndices:function(){for(var a=this._indices,c=0,d=this._totalParticles;c<d;++c){var e=6*c,f=4*c;a[e+0]=f+0;a[e+1]=f+1;a[e+2]=f+2;a[e+5]=f+1;a[e+4]=f+2;a[e+3]=f+3}},initTexCoordsWithRect:function(a){var c=cc.CONTENT_SCALE_FACTOR(),d=cc.rect(a.x*c,a.y*c,a.width*c,a.height*c),e=a.width,f=a.height;this._texture&&
(e=this._texture.getPixelsWide(),f=this._texture.getPixelsHigh());if(cc.renderContextType!==cc.CANVAS){cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(a=(2*d.x+1)/(2*e),c=(2*d.y+1)/(2*f),e=a+(2*d.width-2)/(2*e),d=c+(2*d.height-2)/(2*f)):(a=d.x/e,c=d.y/f,e=a+d.width/e,d=c+d.height/f);var f=d,d=c,c=f,g=0,h=0;this._batchNode?(f=this._batchNode.getTextureAtlas().getQuads(),g=this._atlasIndex,h=this._atlasIndex+this._totalParticles):(f=this._quads,g=0,h=this._totalParticles);for(;g<h;g++){f[g]||(f[g]=cc.V3F_C4B_T2F_QuadZero());
var k=f[g];k.bl.texCoords.u=a;k.bl.texCoords.v=c;k.br.texCoords.u=e;k.br.texCoords.v=c;k.tl.texCoords.u=a;k.tl.texCoords.v=d;k.tr.texCoords.u=e;k.tr.texCoords.v=d}}},getBatchNode:function(){return this._batchNode},setBatchNode:function(a){if(this._batchNode!=a){var c=this._batchNode;if(this._batchNode=a)for(var d=this._particles,e=0;e<this._totalParticles;e++)d[e].atlasIndex=e;a?c||(this._batchNode.getTextureAtlas()._copyQuadsToTextureAtlas(this._quads,this._atlasIndex),cc.renderContext.deleteBuffer(this._buffersVBO[1])):
(this._allocMemory(),this.initIndices(),this.setTexture(c.getTexture()),this._setupVBO())}},getAtlasIndex:function(){return this._atlasIndex},setAtlasIndex:function(a){this._atlasIndex=a},getDrawMode:function(){return this._drawMode},setDrawMode:function(a){this._drawMode=a},getShapeType:function(){return this._shapeType},setShapeType:function(a){this._shapeType=a},isActive:function(){return this._isActive},getParticleCount:function(){return this._particleCount},setParticleCount:function(a){this._particleCount=
a},getDuration:function(){return this._duration},setDuration:function(a){this._duration=a},getSourcePosition:function(){return{x:this._sourcePosition.x,y:this._sourcePosition.y}},setSourcePosition:function(a){this._sourcePosition=a},getPosVar:function(){return{x:this._posVar.x,y:this._posVar.y}},setPosVar:function(a){this._posVar=a},getLife:function(){return this._life},setLife:function(a){this._life=a},getLifeVar:function(){return this._lifeVar},setLifeVar:function(a){this._lifeVar=a},getAngle:function(){return this._angle},
setAngle:function(a){this._angle=a},getAngleVar:function(){return this._angleVar},setAngleVar:function(a){this._angleVar=a},getGravity:function(){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getGravity() : Particle Mode should be Gravity");var a=this.modeA.gravity;return cc.p(a.x,a.y)},setGravity:function(a){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setGravity() : Particle Mode should be Gravity");this.modeA.gravity=a},getSpeed:function(){this._emitterMode!==
cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getSpeed() : Particle Mode should be Gravity");return this.modeA.speed},setSpeed:function(a){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setSpeed() : Particle Mode should be Gravity");this.modeA.speed=a},getSpeedVar:function(){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getSpeedVar() : Particle Mode should be Gravity");return this.modeA.speedVar},setSpeedVar:function(a){this._emitterMode!==
cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setSpeedVar() : Particle Mode should be Gravity");this.modeA.speedVar=a},getTangentialAccel:function(){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getTangentialAccel() : Particle Mode should be Gravity");return this.modeA.tangentialAccel},setTangentialAccel:function(a){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setTangentialAccel() : Particle Mode should be Gravity");this.modeA.tangentialAccel=
a},getTangentialAccelVar:function(){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getTangentialAccelVar() : Particle Mode should be Gravity");return this.modeA.tangentialAccelVar},setTangentialAccelVar:function(a){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setTangentialAccelVar() : Particle Mode should be Gravity");this.modeA.tangentialAccelVar=a},getRadialAccel:function(){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRadialAccel() : Particle Mode should be Gravity");
return this.modeA.radialAccel},setRadialAccel:function(a){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRadialAccel() : Particle Mode should be Gravity");this.modeA.radialAccel=a},getRadialAccelVar:function(){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRadialAccelVar() : Particle Mode should be Gravity");return this.modeA.radialAccelVar},setRadialAccelVar:function(a){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRadialAccelVar() : Particle Mode should be Gravity");
this.modeA.radialAccelVar=a},getRotationIsDir:function(){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRotationIsDir() : Particle Mode should be Gravity");return this.modeA.rotationIsDir},setRotationIsDir:function(a){this._emitterMode!==cc.PARTICLE_MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRotationIsDir() : Particle Mode should be Gravity");this.modeA.rotationIsDir=a},getStartRadius:function(){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getStartRadius() : Particle Mode should be Radius");
return this.modeB.startRadius},setStartRadius:function(a){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setStartRadius() : Particle Mode should be Radius");this.modeB.startRadius=a},getStartRadiusVar:function(){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getStartRadiusVar() : Particle Mode should be Radius");return this.modeB.startRadiusVar},setStartRadiusVar:function(a){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setStartRadiusVar() : Particle Mode should be Radius");
this.modeB.startRadiusVar=a},getEndRadius:function(){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getEndRadius() : Particle Mode should be Radius");return this.modeB.endRadius},setEndRadius:function(a){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setEndRadius() : Particle Mode should be Radius");this.modeB.endRadius=a},getEndRadiusVar:function(){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getEndRadiusVar() : Particle Mode should be Radius");
return this.modeB.endRadiusVar},setEndRadiusVar:function(a){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setEndRadiusVar() : Particle Mode should be Radius");this.modeB.endRadiusVar=a},getRotatePerSecond:function(){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getRotatePerSecond() : Particle Mode should be Radius");return this.modeB.rotatePerSecond},setRotatePerSecond:function(a){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setRotatePerSecond() : Particle Mode should be Radius");
this.modeB.rotatePerSecond=a},getRotatePerSecondVar:function(){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getRotatePerSecondVar() : Particle Mode should be Radius");return this.modeB.rotatePerSecondVar},setRotatePerSecondVar:function(a){this._emitterMode!==cc.PARTICLE_MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setRotatePerSecondVar() : Particle Mode should be Radius");this.modeB.rotatePerSecondVar=a},setScale:function(a,c){this._transformSystemDirty=!0;cc.Node.prototype.setScale.call(this,
a,c)},setRotation:function(a){this._transformSystemDirty=!0;cc.Node.prototype.setRotation.call(this,a)},setScaleX:function(a){this._transformSystemDirty=!0;cc.Node.prototype.setScaleX.call(this,a)},setScaleY:function(a){this._transformSystemDirty=!0;cc.Node.prototype.setScaleY.call(this,a)},getStartSize:function(){return this._startSize},setStartSize:function(a){this._startSize=a},getStartSizeVar:function(){return this._startSizeVar},setStartSizeVar:function(a){this._startSizeVar=a},getEndSize:function(){return this._endSize},
setEndSize:function(a){this._endSize=a},getEndSizeVar:function(){return this._endSizeVar},setEndSizeVar:function(a){this._endSizeVar=a},getStartColor:function(){return this._startColor},setStartColor:function(a){a instanceof cc.Color3B&&(a=cc.c4FFromccc3B(a));this._startColor=a},getStartColorVar:function(){return this._startColorVar},setStartColorVar:function(a){a instanceof cc.Color3B&&(a=cc.c4FFromccc3B(a));this._startColorVar=a},getEndColor:function(){return this._endColor},setEndColor:function(a){a instanceof
cc.Color3B&&(a=cc.c4FFromccc3B(a));this._endColor=a},getEndColorVar:function(){return this._endColorVar},setEndColorVar:function(a){a instanceof cc.Color3B&&(a=cc.c4FFromccc3B(a));this._endColorVar=a},getStartSpin:function(){return this._startSpin},setStartSpin:function(a){this._startSpin=a},getStartSpinVar:function(){return this._startSpinVar},setStartSpinVar:function(a){this._startSpinVar=a},getEndSpin:function(){return this._endSpin},setEndSpin:function(a){this._endSpin=a},getEndSpinVar:function(){return this._endSpinVar},
setEndSpinVar:function(a){this._endSpinVar=a},getEmissionRate:function(){return this._emissionRate},setEmissionRate:function(a){this._emissionRate=a},getTotalParticles:function(){return this._totalParticles},setTotalParticles:function(a){if(cc.renderContextType===cc.CANVAS)this._totalParticles=200>a?a:200;else{if(a>this._allocatedParticles){var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._indices=new Uint16Array(6*a);var d=new ArrayBuffer(a*c),e=this._particles;e.length=0;for(var f=this._quads,g=
f.length=0;g<a;g++)e[g]=new cc.Particle,f[g]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,d,g*c);this._totalParticles=this._allocatedParticles=a;if(this._batchNode)for(c=0;c<a;c++)e[c].atlasIndex=c;this._quadsArrayBuffer=d;this.initIndices();this._setupVBO();this._texture&&(a=this._texture.getContentSize(),this.initTexCoordsWithRect(cc.rect(0,0,a.width,a.height)))}else this._totalParticles=a;this.resetSystem()}},getTexture:function(){return this._texture},setTexture:function(a){if(a.isLoaded()){var c=
a.getContentSize();this.setTextureWithRect(a,cc.rect(0,0,c.width,c.height))}else this._textureLoaded=!1,a.addLoadedEventListener(function(a){this._textureLoaded=!0;var c=a.getContentSize();this.setTextureWithRect(a,cc.rect(0,0,c.width,c.height))},this)},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,c){if(void 0===c)this._blendFunc!=a&&(this._blendFunc=a,this._updateBlendFunc());else if(this._blendFunc.src!=a||this._blendFunc.dst!=c)this._blendFunc={src:a,dst:c},this._updateBlendFunc()},
getOpacityModifyRGB:function(){return this._opacityModifyRGB},setOpacityModifyRGB:function(a){this._opacityModifyRGB=a},isBlendAdditive:function(){return this._blendFunc.src==gl.SRC_ALPHA&&this._blendFunc.dst==gl.ONE||this._blendFunc.src==gl.ONE&&this._blendFunc.dst==gl.ONE},setBlendAdditive:function(a){var c=this._blendFunc;a?(c.src=gl.SRC_ALPHA,c.dst=gl.ONE):cc.renderContextType===cc.WEBGL?this._texture&&!this._texture.hasPremultipliedAlpha()?(c.src=gl.SRC_ALPHA,c.dst=gl.ONE_MINUS_SRC_ALPHA):(c.src=
cc.BLEND_SRC,c.dst=cc.BLEND_DST):(c.src=cc.BLEND_SRC,c.dst=cc.BLEND_DST)},getPositionType:function(){return this._positionType},setPositionType:function(a){this._positionType=a},isAutoRemoveOnFinish:function(){return this._isAutoRemoveOnFinish},setAutoRemoveOnFinish:function(a){this._isAutoRemoveOnFinish=a},getEmitterMode:function(){return this._emitterMode},setEmitterMode:function(a){this._emitterMode=a},init:function(){return this.initWithTotalParticles(150)},initWithFile:function(a){this._plistFile=
a;var c=cc.FileUtils.getInstance();a=c.fullPathForFilename(a);c=c.dictionaryWithContentsOfFileThreadSafe(a);return c?this.initWithDictionary(c,""):(cc.log("cc.ParticleSystem.initWithFile(): Particles: file not found"),!1)},getBoundingBoxToWorld:function(){return cc.rect(0,0,cc.canvas.width,cc.canvas.height)},initWithDictionary:function(a,c){var d=!1,e=null,e=this._valueForKey,f=parseInt(e("maxParticles",a));if(this.initWithTotalParticles(f)){this._angle=parseFloat(e("angle",a));this._angleVar=parseFloat(e("angleVariance",
a));this._duration=parseFloat(e("duration",a));this._blendFunc.src=parseInt(e("blendFuncSource",a));this._blendFunc.dst=parseInt(e("blendFuncDestination",a));d=this._startColor;d.r=parseFloat(e("startColorRed",a));d.g=parseFloat(e("startColorGreen",a));d.b=parseFloat(e("startColorBlue",a));d.a=parseFloat(e("startColorAlpha",a));d=this._startColorVar;d.r=parseFloat(e("startColorVarianceRed",a));d.g=parseFloat(e("startColorVarianceGreen",a));d.b=parseFloat(e("startColorVarianceBlue",a));d.a=parseFloat(e("startColorVarianceAlpha",
a));d=this._endColor;d.r=parseFloat(e("finishColorRed",a));d.g=parseFloat(e("finishColorGreen",a));d.b=parseFloat(e("finishColorBlue",a));d.a=parseFloat(e("finishColorAlpha",a));d=this._endColorVar;d.r=parseFloat(e("finishColorVarianceRed",a));d.g=parseFloat(e("finishColorVarianceGreen",a));d.b=parseFloat(e("finishColorVarianceBlue",a));d.a=parseFloat(e("finishColorVarianceAlpha",a));this._startSize=parseFloat(e("startParticleSize",a));this._startSizeVar=parseFloat(e("startParticleSizeVariance",a));
this._endSize=parseFloat(e("finishParticleSize",a));this._endSizeVar=parseFloat(e("finishParticleSizeVariance",a));d=parseFloat(e("sourcePositionx",a));f=parseFloat(e("sourcePositiony",a));this.setPosition(d,f);this._posVar.x=parseFloat(e("sourcePositionVariancex",a));this._posVar.y=parseFloat(e("sourcePositionVariancey",a));this._startSpin=parseFloat(e("rotationStart",a));this._startSpinVar=parseFloat(e("rotationStartVariance",a));this._endSpin=parseFloat(e("rotationEnd",a));this._endSpinVar=parseFloat(e("rotationEndVariance",
a));this._emitterMode=parseInt(e("emitterType",a));if(this._emitterMode==cc.PARTICLE_MODE_GRAVITY)d=this.modeA,d.gravity.x=parseFloat(e("gravityx",a)),d.gravity.y=parseFloat(e("gravityy",a)),d.speed=parseFloat(e("speed",a)),d.speedVar=parseFloat(e("speedVariance",a)),f=e("radialAcceleration",a),d.radialAccel=f?parseFloat(f):0,f=e("radialAccelVariance",a),d.radialAccelVar=f?parseFloat(f):0,f=e("tangentialAcceleration",a),d.tangentialAccel=f?parseFloat(f):0,f=e("tangentialAccelVariance",a),d.tangentialAccelVar=
f?parseFloat(f):0,f=e("rotationIsDir",a).toLowerCase(),d.rotationIsDir=null!=f&&("true"===f||"1"===f);else if(this._emitterMode==cc.PARTICLE_MODE_RADIUS)d=this.modeB,d.startRadius=parseFloat(e("maxRadius",a)),d.startRadiusVar=parseFloat(e("maxRadiusVariance",a)),d.endRadius=parseFloat(e("minRadius",a)),d.endRadiusVar=0,d.rotatePerSecond=parseFloat(e("rotatePerSecond",a)),d.rotatePerSecondVar=parseFloat(e("rotatePerSecondVariance",a));else return cc.log("cc.ParticleSystem.initWithDictionary(): Invalid emitterType in config file"),
!1;this._life=parseFloat(e("particleLifespan",a));this._lifeVar=parseFloat(e("particleLifespanVariance",a));this._emissionRate=this._totalParticles/this._life;if(!this._batchNode){this._opacityModifyRGB=!1;var f=e("textureFileName",a),d=cc.FileUtils.getInstance(),f=d.fullPathFromRelativeFile(f,this._plistFile),g=cc.TextureCache.getInstance().textureForKey(f);if(g)this.setTexture(g);else if((e=e("textureImageData",a))&&0==e.length){g=cc.TextureCache.getInstance().addImage(f);if(!g)return!1;this.setTexture(g)}else{e=
cc.unzipBase64AsArray(e,1);if(!e)return cc.log("cc.ParticleSystem: error decoding or ungzipping textureImageData"),!1;var h=cc.getImageFormatByData(e);if(h!==cc.FMT_TIFF&&h!==cc.FMT_PNG)return cc.log("cc.ParticleSystem: unknown image format with Data"),!1;g=document.createElement("canvas");h===cc.FMT_PNG?(new cc.PNGReader(e)).render(g):cc.TIFFReader.getInstance().parseTIFF(e,g);e=d.fullPathForFilename(f);cc.TextureCache.getInstance().cacheImage(e,g);(e=cc.TextureCache.getInstance().textureForKey(f))||
cc.log("cc.ParticleSystem.initWithDictionary() : error loading the texture");this.setTexture(e)}}d=!0}return d},initWithTotalParticles:function(a){this._totalParticles=a;var c,d=this._particles;for(c=d.length=0;c<a;c++)d[c]=new cc.Particle;if(!d)return cc.log("Particle system: not enough memory"),!1;this._allocatedParticles=a;if(this._batchNode)for(c=0;c<this._totalParticles;c++)d[c].atlasIndex=c;this._isActive=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this._positionType=
cc.PARTICLE_TYPE_FREE;this._emitterMode=cc.PARTICLE_MODE_GRAVITY;this._transformSystemDirty=this._isAutoRemoveOnFinish=!1;this.scheduleUpdateWithPriority(1);if(cc.renderContextType===cc.WEBGL){if(!this._allocMemory())return!1;this.initIndices();this._setupVBO();this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR))}return!0},destroyParticleSystem:function(){this.unscheduleUpdate()},addParticle:function(){if(this.isFull())return!1;var a,c=this._particles;
cc.renderContextType===cc.CANVAS?this._particleCount<c.length?a=c[this._particleCount]:(a=new cc.Particle,c.push(a)):a=c[this._particleCount];this.initParticle(a);++this._particleCount;return!0},initParticle:function(a){var c=cc.RANDOM_MINUS1_1;a.timeToLive=this._life+this._lifeVar*c();a.timeToLive=Math.max(0,a.timeToLive);a.pos.x=this._sourcePosition.x+this._posVar.x*c();a.pos.y=this._sourcePosition.y+this._posVar.y*c();var d,e;d=this._startColor;var f=this._startColorVar,g=this._endColor;e=this._endColorVar;
cc.renderContextType===cc.CANVAS?(d=new cc.Color4F(cc.clampf(d.r+f.r*c(),0,1),cc.clampf(d.g+f.g*c(),0,1),cc.clampf(d.b+f.b*c(),0,1),cc.clampf(d.a+f.a*c(),0,1)),e=new cc.Color4F(cc.clampf(g.r+e.r*c(),0,1),cc.clampf(g.g+e.g*c(),0,1),cc.clampf(g.b+e.b*c(),0,1),cc.clampf(g.a+e.a*c(),0,1))):(d={r:cc.clampf(d.r+f.r*c(),0,1),g:cc.clampf(d.g+f.g*c(),0,1),b:cc.clampf(d.b+f.b*c(),0,1),a:cc.clampf(d.a+f.a*c(),0,1)},e={r:cc.clampf(g.r+e.r*c(),0,1),g:cc.clampf(g.g+e.g*c(),0,1),b:cc.clampf(g.b+e.b*c(),0,1),a:cc.clampf(g.a+
e.a*c(),0,1)});a.color=d;f=a.deltaColor;g=a.timeToLive;f.r=(e.r-d.r)/g;f.g=(e.g-d.g)/g;f.b=(e.b-d.b)/g;f.a=(e.a-d.a)/g;d=this._startSize+this._startSizeVar*c();d=Math.max(0,d);a.size=d;this._endSize===cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE?a.deltaSize=0:(e=this._endSize+this._endSizeVar*c(),e=Math.max(0,e),a.deltaSize=(e-d)/g);d=this._startSpin+this._startSpinVar*c();e=this._endSpin+this._endSpinVar*c();a.rotation=d;a.deltaRotation=(e-d)/g;this._positionType==cc.PARTICLE_TYPE_FREE?a.startPos=this.convertToWorldSpace(this._pointZeroForParticle):
this._positionType==cc.PARTICLE_TYPE_RELATIVE&&(a.startPos.x=this._position.x,a.startPos.y=this._position.y);d=cc.DEGREES_TO_RADIANS(this._angle+this._angleVar*c());if(this._emitterMode===cc.PARTICLE_MODE_GRAVITY)g=this.modeA,e=a.modeA,f=g.speed+g.speedVar*c(),e.dir.x=Math.cos(d),e.dir.y=Math.sin(d),cc.pMultIn(e.dir,f),e.radialAccel=g.radialAccel+g.radialAccelVar*c(),e.tangentialAccel=g.tangentialAccel+g.tangentialAccelVar*c(),g.rotationIsDir&&(a.rotation=-cc.RADIANS_TO_DEGREES(cc.pToAngle(e.dir)));
else{e=this.modeB;a=a.modeB;var f=e.startRadius+e.startRadiusVar*c(),h=e.endRadius+e.endRadiusVar*c();a.radius=f;a.deltaRadius=e.endRadius===cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS?0:(h-f)/g;a.angle=d;a.degreesPerSecond=cc.DEGREES_TO_RADIANS(e.rotatePerSecond+e.rotatePerSecondVar*c())}},stopSystem:function(){this._isActive=!1;this._elapsed=this._duration;this._emitCounter=0},resetSystem:function(){this._isActive=!0;this._elapsed=0;var a=this._particles;for(this._particleIdx=0;this._particleIdx<
this._particleCount;++this._particleIdx)a[this._particleIdx].timeToLive=0},isFull:function(){return this._particleCount>=this._totalParticles},updateQuadWithParticle:function(a,c){var d=null;this._batchNode?(d=this._batchNode.getTextureAtlas().getQuads()[this._atlasIndex+a.atlasIndex],this._batchNode.getTextureAtlas()._dirty=!0):d=this._quads[this._particleIdx];var e,f,g,h;this._opacityModifyRGB?(e=0|a.color.r*a.color.a*255,f=0|a.color.g*a.color.a*255,g=0|a.color.b*a.color.a*255):(e=0|255*a.color.r,
f=0|255*a.color.g,g=0|255*a.color.b);h=0|255*a.color.a;var k=d.bl.colors;k.r=e;k.g=f;k.b=g;k.a=h;k=d.br.colors;k.r=e;k.g=f;k.b=g;k.a=h;k=d.tl.colors;k.r=e;k.g=f;k.b=g;k.a=h;k=d.tr.colors;k.r=e;k.g=f;k.b=g;k.a=h;e=a.size/2;if(a.rotation){f=-e;g=-e;h=c.x;var k=c.y,m=-cc.DEGREES_TO_RADIANS(a.rotation),n=Math.cos(m),m=Math.sin(m);d.bl.vertices.x=f*n-g*m+h;d.bl.vertices.y=f*m+g*n+k;d.br.vertices.x=e*n-g*m+h;d.br.vertices.y=e*m+g*n+k;d.tl.vertices.x=f*n-e*m+h;d.tl.vertices.y=f*m+e*n+k;d.tr.vertices.x=e*
n-e*m+h;d.tr.vertices.y=e*m+e*n+k}else d.bl.vertices.x=c.x-e,d.bl.vertices.y=c.y-e,d.br.vertices.x=c.x+e,d.br.vertices.y=c.y-e,d.tl.vertices.x=c.x-e,d.tl.vertices.y=c.y+e,d.tr.vertices.x=c.x+e,d.tr.vertices.y=c.y+e},postStep:function(){if(cc.renderContextType===cc.WEBGL){var a=cc.renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]);a.bufferData(a.ARRAY_BUFFER,this._quadsArrayBuffer,a.DYNAMIC_DRAW)}},update:function(a){if(this._isActive&&this._emissionRate){var c=1/this._emissionRate;this._particleCount<
this._totalParticles&&(this._emitCounter+=a);for(;this._particleCount<this._totalParticles&&this._emitCounter>c;)this.addParticle(),this._emitCounter-=c;this._elapsed+=a;-1!=this._duration&&this._duration<this._elapsed&&this.stopSystem()}this._particleIdx=0;c=cc.Particle.TemporaryPoints[0];this._positionType==cc.PARTICLE_TYPE_FREE?cc.pIn(c,this.convertToWorldSpace(this._pointZeroForParticle)):this._positionType==cc.PARTICLE_TYPE_RELATIVE&&(c.x=this._position.x,c.y=this._position.y);if(this._visible){for(var d=
cc.Particle.TemporaryPoints[1],e=cc.Particle.TemporaryPoints[2],f=cc.Particle.TemporaryPoints[3],g=this._particles;this._particleIdx<this._particleCount;){cc.pZeroIn(d);cc.pZeroIn(e);cc.pZeroIn(f);var h=g[this._particleIdx];h.timeToLive-=a;if(0<h.timeToLive){if(this._emitterMode==cc.PARTICLE_MODE_GRAVITY){var k=f,m=d,n=e;h.pos.x||h.pos.y?(cc.pIn(m,h.pos),cc.pNormalizeIn(m)):cc.pZeroIn(m);cc.pIn(n,m);cc.pMultIn(m,h.modeA.radialAccel);var p=n.x;n.x=-n.y;n.y=p;cc.pMultIn(n,h.modeA.tangentialAccel);cc.pIn(k,
m);cc.pAddIn(k,n);cc.pAddIn(k,this.modeA.gravity);cc.pMultIn(k,a);cc.pAddIn(h.modeA.dir,k);cc.pIn(k,h.modeA.dir);cc.pMultIn(k,a);cc.pAddIn(h.pos,k)}else k=h.modeB,k.angle+=k.degreesPerSecond*a,k.radius+=k.deltaRadius*a,h.pos.x=-Math.cos(k.angle)*k.radius,h.pos.y=-Math.sin(k.angle)*k.radius;this._dontTint||(h.color.r+=h.deltaColor.r*a,h.color.g+=h.deltaColor.g*a,h.color.b+=h.deltaColor.b*a,h.color.a+=h.deltaColor.a*a,h.isChangeColor=!0);h.size+=h.deltaSize*a;h.size=Math.max(0,h.size);h.rotation+=h.deltaRotation*
a;k=d;this._positionType==cc.PARTICLE_TYPE_FREE||this._positionType==cc.PARTICLE_TYPE_RELATIVE?(m=e,cc.pIn(m,c),cc.pSubIn(m,h.startPos),cc.pIn(k,h.pos),cc.pSubIn(k,m)):cc.pIn(k,h.pos);this._batchNode&&(k.x+=this._position.x,k.y+=this._position.y);cc.renderContextType==cc.WEBGL?this.updateQuadWithParticle(h,k):cc.pIn(h.drawPos,k);++this._particleIdx}else if(h=h.atlasIndex,this._particleIdx!==this._particleCount-1&&(k=g[this._particleIdx],g[this._particleIdx]=g[this._particleCount-1],g[this._particleCount-
1]=k),this._batchNode&&(this._batchNode.disableParticle(this._atlasIndex+h),g[this._particleCount-1].atlasIndex=h),--this._particleCount,0==this._particleCount&&this._isAutoRemoveOnFinish){this.unscheduleUpdate();this._parent.removeChild(this,!0);return}}this._transformSystemDirty=!1}this._batchNode||this.postStep()},updateWithNoTime:function(){this.update(0)},_valueForKey:function(a,c){if(c){var d=c[a];return null!=d?d:""}return""},_updateBlendFunc:function(){if(this._batchNode)cc.log("Can't change blending functions when the particle is being batched");
else{var a=this._texture;if(a&&a instanceof cc.Texture2D){this._opacityModifyRGB=!1;var c=this._blendFunc;c.src==cc.BLEND_SRC&&c.dst==cc.BLEND_DST&&(a.hasPremultipliedAlpha()?this._opacityModifyRGB=!0:(c.src=gl.SRC_ALPHA,c.dst=gl.ONE_MINUS_SRC_ALPHA))}}},clone:function(){var a=new cc.ParticleSystem;if(a.initWithTotalParticles(this._totalParticles)){a._angle=this._angle;a._angleVar=this._angleVar;a._duration=this._duration;a._blendFunc.src=this._blendFunc.src;a._blendFunc.dst=this._blendFunc.dst;var c=
a._startColor,d=this._startColor;c.r=d.r;c.g=d.g;c.b=d.b;c.a=d.a;c=a._startColorVar;d=this._startColorVar;c.r=d.r;c.g=d.g;c.b=d.b;c.a=d.a;c=a._endColor;d=this._endColor;c.r=d.r;c.g=d.g;c.b=d.b;c.a=d.a;c=a._endColorVar;d=this._endColorVar;c.r=d.r;c.g=d.g;c.b=d.b;c.a=d.a;a._startSize=this._startSize;a._startSizeVar=this._startSizeVar;a._endSize=this._endSize;a._endSizeVar=this._endSizeVar;a.setPosition(this._position.x,this._position.y);a._posVar.x=this._posVar.x;a._posVar.y=this._posVar.y;a._startSpin=
this._startSpin;a._startSpinVar=this._startSpinVar;a._endSpin=this._endSpin;a._endSpinVar=this._endSpinVar;a._emitterMode=this._emitterMode;this._emitterMode==cc.PARTICLE_MODE_GRAVITY?(c=a.modeA,d=this.modeA,c.gravity.x=d.gravity.x,c.gravity.y=d.gravity.y,c.speed=d.speed,c.speedVar=d.speedVar,c.radialAccel=d.radialAccel,c.radialAccelVar=d.radialAccelVar,c.tangentialAccel=d.tangentialAccel,c.tangentialAccelVar=d.tangentialAccelVar):this._emitterMode==cc.PARTICLE_MODE_RADIUS&&(c=a.modeB,d=this.modeB,
c.startRadius=d.startRadius,c.startRadiusVar=d.startRadiusVar,c.endRadius=d.endRadius,c.endRadiusVar=d.endRadiusVar,c.rotatePerSecond=d.rotatePerSecond,c.rotatePerSecondVar=d.rotatePerSecondVar);a._life=this._life;a._lifeVar=this._lifeVar;a._emissionRate=this._emissionRate;this._batchNode||(a._opacityModifyRGB=this._opacityModifyRGB,a._texture=this._texture)}return a},setDisplayFrame:function(a){var c=a.getOffsetInPixels();0==c.x&&0==c.y||cc.log("cc.ParticleSystem.setDisplayFrame(): QuadParticle only supports SpriteFrames with no offsets");
cc.renderContextType===cc.WEBGL&&(this._texture&&a.getTexture()._webTextureObj==this._texture._webTextureObj||this.setTexture(a.getTexture()))},setTextureWithRect:function(a,c){var d=this._texture;cc.renderContextType===cc.WEBGL?d&&a._webTextureObj==d._webTextureObj||d==a||(this._texture=a,this._updateBlendFunc()):d&&a==d||d==a||(this._texture=a,this._updateBlendFunc());this._pointRect=c;this.initTexCoordsWithRect(c)},draw:function(a){this._textureLoaded&&!this._batchNode&&(cc.renderContextType===
cc.CANVAS?this._drawForCanvas(a):this._drawForWebGL(a),cc.g_NumberOfDraws++)},_drawForCanvas:function(a){a=a||cc.renderContext;a.save();this.isBlendAdditive()?a.globalCompositeOperation="lighter":a.globalCompositeOperation="source-over";for(var c=0;c<this._particleCount;c++){var d=this._particles[c],e=0|0.5*d.size;if(this._drawMode==cc.PARTICLE_TEXTURE_MODE){if(e=this._texture.getHtmlElementObj(),e.width&&e.height){a.save();a.globalAlpha=d.color.a;a.translate(0|d.drawPos.x,-(0|d.drawPos.y));var f=
4*Math.floor(d.size/4),g=this._pointRect.width,h=this._pointRect.height;a.scale(Math.max(1/g*f,1E-6),Math.max(1/h*f,1E-6));d.rotation&&a.rotate(cc.DEGREES_TO_RADIANS(d.rotation));a.translate(-(0|g/2),-(0|h/2));d.isChangeColor&&(f=cc.TextureCache.getInstance().getTextureColors(e))&&(f.tintCache||(f.tintCache=document.createElement("canvas"),f.tintCache.width=e.width,f.tintCache.height=e.height),cc.generateTintImage(e,f,d.color,this._pointRect,f.tintCache),e=f.tintCache);a.drawImage(e,0,0);a.restore()}}else a.save(),
a.globalAlpha=d.color.a,a.translate(0|d.drawPos.x,-(0|d.drawPos.y)),this._shapeType==cc.PARTICLE_STAR_SHAPE?(d.rotation&&a.rotate(cc.DEGREES_TO_RADIANS(d.rotation)),cc.drawingUtil.drawStar(a,e,d.color)):cc.drawingUtil.drawColorBall(a,e,d.color),a.restore()}a.restore()},_drawForWebGL:function(a){this._texture&&(a=a||cc.renderContext,this._shaderProgram.use(),this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4(),cc.glBindTexture2D(this._texture),cc.glBlendFuncForParticle(this._blendFunc.src,
this._blendFunc.dst),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX),a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]),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.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,24,16),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]),a.drawElements(a.TRIANGLES,6*this._particleIdx,a.UNSIGNED_SHORT,0))},listenBackToForeground:function(a){cc.TEXTURE_ATLAS_USE_VAO?
this._setupVBOandVAO():this._setupVBO()},_setupVBOandVAO:function(){},_setupVBO:function(){if(cc.renderContextType!=cc.CANVAS){var a=cc.renderContext;this._buffersVBO[0]=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]);a.bufferData(a.ARRAY_BUFFER,this._quadsArrayBuffer,a.DYNAMIC_DRAW);this._buffersVBO[1]=a.createBuffer();a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,a.STATIC_DRAW)}},_allocMemory:function(){if(cc.renderContextType===
cc.CANVAS)return!0;if(this._batchNode)return cc.log("cc.ParticleSystem._allocMemory(): Memory should not be allocated when not using batchNode"),!1;var a=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,c=this._totalParticles,d=this._quads;d.length=0;this._indices=new Uint16Array(6*c);for(var e=new ArrayBuffer(a*c),f=0;f<c;f++)d[f]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,e,f*a);if(!d||!this._indices)return cc.log("cocos2d: Particle system: not enough memory"),!1;this._quadsArrayBuffer=e;return!0}});
cc.ParticleSystem.create=function(a){var c=new cc.ParticleSystem;return a&&"number"!==typeof a?c&&c.initWithFile(a)?c:null:(a=a||100,c.setDrawMode(cc.PARTICLE_TEXTURE_MODE),c.initWithTotalParticles(a),c)};cc.ParticleSystem.createWithTotalParticles=function(a){var c=new cc.ParticleSystem;return c&&c.initWithTotalParticles(a)?c:null};
cc.ParticleSystem.ModeA=function(a,c,d,e,f,g,h,k){this.gravity=a?a:cc.PointZero();this.speed=c||0;this.speedVar=d||0;this.tangentialAccel=e||0;this.tangentialAccelVar=f||0;this.radialAccel=g||0;this.radialAccelVar=h||0;this.rotationIsDir=k||!1};cc.ParticleSystem.ModeB=function(a,c,d,e,f,g){this.startRadius=a||0;this.startRadiusVar=c||0;this.endRadius=d||0;this.endRadiusVar=e||0;this.rotatePerSecond=f||0;this.rotatePerSecondVar=g||0};cc.ParticleFire=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?300:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(60),this.setSpeedVar(20),this.setAngle(90),this.setAngleVar(10),a=cc.Director.getInstance().getWinSize(),
this.setPosition(a.width/2,60),this.setPosVar(cc.p(40,20)),this.setLife(3),this.setLifeVar(0.25),this.setStartSize(54),this.setStartSizeVar(10),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.76,0.25,0.12,1)),this.setStartColorVar(cc.c4f(0,0,0,0)),this.setEndColor(cc.c4f(0,0,0,1)),this.setEndColorVar(cc.c4f(0,0,0,0)),this.setBlendAdditive(!0),!0):!1}});
cc.ParticleFire.create=function(){var a=new cc.ParticleFire;return a.init()?a:null};
cc.ParticleFireworks=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?1500:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,-90)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(180),this.setSpeedVar(50),a=cc.Director.getInstance().getWinSize(),
this.setPosition(a.width/2,a.height/2),this.setAngle(90),this.setAngleVar(20),this.setLife(3.5),this.setLifeVar(1),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.5,0.5,0.5,1)),this.setStartColorVar(cc.c4f(0.5,0.5,0.5,1)),this.setEndColor(cc.c4f(0.1,0.1,0.1,0.2)),this.setEndColorVar(cc.c4f(0.1,0.1,0.1,0.2)),this.setStartSize(8),this.setStartSizeVar(2),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setBlendAdditive(!1),!0):!1}});
cc.ParticleFireworks.create=function(){var a=new cc.ParticleFireworks;return a.init()?a:null};
cc.ParticleSun=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?350:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setBlendAdditive(!0),this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(20),this.setSpeedVar(5),this.setAngle(90),this.setAngleVar(360),
a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.PointZero()),this.setLife(1),this.setLifeVar(0.5),this.setStartSize(30),this.setStartSizeVar(10),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.76,0.25,0.12,1)),this.setStartColorVar(cc.c4f(0,0,0,0)),this.setEndColor(cc.c4f(0,0,0,1)),this.setEndColorVar(cc.c4f(0,0,0,0)),!0):!1}});
cc.ParticleSun.create=function(){var a=new cc.ParticleSun;return a.init()?a:null};
cc.ParticleGalaxy=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?200:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(60),this.setSpeedVar(10),this.setRadialAccel(-80),this.setRadialAccelVar(0),this.setTangentialAccel(80),this.setTangentialAccelVar(0),
this.setAngle(90),this.setAngleVar(360),a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.PointZero()),this.setLife(4),this.setLifeVar(1),this.setStartSize(37),this.setStartSizeVar(10),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.12,0.25,0.76,1)),this.setStartColorVar(cc.c4f(0,0,0,0)),this.setEndColor(cc.c4f(0,0,0,1)),this.setEndColorVar(cc.c4f(0,0,
0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleGalaxy.create=function(){var a=new cc.ParticleGalaxy;return a.init()?a:null};
cc.ParticleFlower=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?250:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(80),this.setSpeedVar(10),this.setRadialAccel(-60),this.setRadialAccelVar(0),this.setTangentialAccel(15),this.setTangentialAccelVar(0),
this.setAngle(90),this.setAngleVar(360),a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.PointZero()),this.setLife(4),this.setLifeVar(1),this.setStartSize(30),this.setStartSizeVar(10),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.5,0.5,0.5,1)),this.setStartColorVar(cc.c4f(0.5,0.5,0.5,0.5)),this.setEndColor(cc.c4f(0,0,0,1)),this.setEndColorVar(cc.c4f(0,
0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleFlower.create=function(){var a=new cc.ParticleFlower;return a.init()?a:null};
cc.ParticleMeteor=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?150:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(-200,200)),this.setSpeed(15),this.setSpeedVar(5),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setTangentialAccel(0),this.setTangentialAccelVar(0),
this.setAngle(90),this.setAngleVar(360),a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.PointZero()),this.setLife(2),this.setLifeVar(1),this.setStartSize(60),this.setStartSizeVar(10),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.2,0.4,0.7,1)),this.setStartColorVar(cc.c4f(0,0,0.2,0.1)),this.setEndColor(cc.c4f(0,0,0,1)),this.setEndColorVar(cc.c4f(0,
0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleMeteor.create=function(){var a=new cc.ParticleMeteor;return a.init()?a:null};
cc.ParticleSpiral=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?500:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(150),this.setSpeedVar(0),this.setRadialAccel(-380),this.setRadialAccelVar(0),this.setTangentialAccel(45),this.setTangentialAccelVar(0),
this.setAngle(90),this.setAngleVar(0),a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.PointZero()),this.setLife(12),this.setLifeVar(0),this.setStartSize(20),this.setStartSizeVar(0),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.5,0.5,0.5,1)),this.setStartColorVar(cc.c4f(0.5,0.5,0.5,0)),this.setEndColor(cc.c4f(0.5,0.5,0.5,1)),this.setEndColorVar(cc.c4f(0.5,
0.5,0.5,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleSpiral.create=function(){var a=new cc.ParticleSpiral;return a.init()?a:null};
cc.ParticleExplosion=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?700:300)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(0.1),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setSpeed(70),this.setSpeedVar(40),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setTangentialAccel(0),this.setTangentialAccelVar(0),this.setAngle(90),
this.setAngleVar(360),a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.PointZero()),this.setLife(5),this.setLifeVar(2),this.setStartSize(15),this.setStartSizeVar(10),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getDuration()),this.setStartColor(cc.c4f(0.7,0.1,0.2,1)),this.setStartColorVar(cc.c4f(0.5,0.5,0.5,0)),this.setEndColor(cc.c4f(0.5,0.5,0.5,0)),this.setEndColorVar(cc.c4f(0.5,0.5,
0.5,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleExplosion.create=function(){var a=new cc.ParticleExplosion;return a.init()?a:null};
cc.ParticleSmoke=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?200:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,0)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(25),this.setSpeedVar(10),this.setAngle(90),this.setAngleVar(5),a=cc.Director.getInstance().getWinSize(),
this.setPosition(a.width/2,0),this.setPosVar(cc.p(20,0)),this.setLife(4),this.setLifeVar(1),this.setStartSize(60),this.setStartSizeVar(10),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.c4f(0.8,0.8,0.8,1)),this.setStartColorVar(cc.c4f(0.02,0.02,0.02,0)),this.setEndColor(cc.c4f(0,0,0,1)),this.setEndColorVar(cc.c4f(0,0,0,0)),this.setBlendAdditive(!1),!0):!1}});
cc.ParticleSmoke.create=function(){var a=new cc.ParticleSmoke;return a.init()?a:null};
cc.ParticleSnow=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?700:250)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(0,-1)),this.setSpeed(5),this.setSpeedVar(1),this.setRadialAccel(0),this.setRadialAccelVar(1),this.setTangentialAccel(0),this.setTangentialAccelVar(1),
a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height+10),this.setPosVar(cc.p(a.width/2,0)),this.setAngle(-90),this.setAngleVar(5),this.setLife(45),this.setLifeVar(15),this.setStartSize(10),this.setStartSizeVar(5),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(10),this.setStartColor(cc.c4f(1,1,1,1)),this.setStartColorVar(cc.c4f(0,0,0,0)),this.setEndColor(cc.c4f(1,1,1,0)),this.setEndColorVar(cc.c4f(0,0,0,0)),this.setBlendAdditive(!1),!0):!1}});
cc.ParticleSnow.create=function(){var a=new cc.ParticleSnow;return a.init()?a:null};
cc.ParticleRain=cc.ParticleSystem.extend({init:function(){return this.initWithTotalParticles(cc.renderContextType===cc.WEBGL?1E3:300)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.PARTICLE_DURATION_INFINITY),this.setEmitterMode(cc.PARTICLE_MODE_GRAVITY),this.setGravity(cc.p(10,-10)),this.setRadialAccel(0),this.setRadialAccelVar(1),this.setTangentialAccel(0),this.setTangentialAccelVar(1),this.setSpeed(130),this.setSpeedVar(30),
this.setAngle(-90),this.setAngleVar(5),a=cc.Director.getInstance().getWinSize(),this.setPosition(a.width/2,a.height),this.setPosVar(cc.p(a.width/2,0)),this.setLife(4.5),this.setLifeVar(0),this.setStartSize(4),this.setStartSizeVar(2),this.setEndSize(cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(20),this.setStartColor(cc.c4f(0.7,0.8,1,1)),this.setStartColorVar(cc.c4f(0,0,0,0)),this.setEndColor(cc.c4f(0.7,0.8,1,0.5)),this.setEndColorVar(cc.c4f(0,0,0,0)),this.setBlendAdditive(!1),!0):
!1}});cc.ParticleRain.create=function(){var a=new cc.ParticleRain;return a.init()?a:null};cc.PARTICLE_DEFAULT_CAPACITY=500;
cc.ParticleBatchNode=cc.Node.extend({TextureProtocol:!0,_blendFunc:null,_textureAtlas:null,ctor:function(){cc.Node.prototype.ctor.call(this);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST}},initWithTexture:function(a,c){this._textureAtlas=new cc.TextureAtlas;this._textureAtlas.initWithTexture(a,c);this._children.length=0;cc.renderContextType===cc.WEBGL&&this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR));return!0},initWithFile:function(a,c){var d=
cc.TextureCache.getInstance().addImage(a);return this.initWithTexture(d,c)},init:function(a,c){var d=cc.TextureCache.getInstance().addImage(a);return this.initWithTexture(d,c)},addChild:function(a,c,d){if(!a)throw"cc.ParticleBatchNode.addChild() : child should be non-null";if(!(a instanceof cc.ParticleSystem))throw"cc.ParticleBatchNode.addChild() : only supports cc.ParticleSystem as children";c=null==c?a.getZOrder():c;d=null==d?a.getTag():d;if(a.getTexture()!=this._textureAtlas.getTexture())throw"cc.ParticleSystem.addChild() : the child is not using the same texture id";
var e=a.getBlendFunc();if(0===this._children.length)this.setBlendFunc(e);else if(e.src!=this._blendFunc.src||e.dst!=this._blendFunc.dst){cc.log("cc.ParticleSystem.addChild() : Can't add a ParticleSystem that uses a different blending function");return}c=this._addChildHelper(a,c,d);d=0;0!=c?(c=this._children[c-1],d=c.getAtlasIndex()+c.getTotalParticles()):d=0;this.insertChild(a,d);a.setBatchNode(this)},insertChild:function(a,c){var d=a.getTotalParticles(),e=this._textureAtlas,f=e.getTotalQuads();a.setAtlasIndex(c);
f+d>e.getCapacity()&&(this._increaseAtlasCapacityTo(f+d),e.fillWithEmptyQuadsFromIndex(e.getCapacity()-d,d));a.getAtlasIndex()+d!=f&&e.moveQuadsFromIndex(c,c+d);e.increaseTotalQuadsWith(d);this._updateAllAtlasIndexes()},removeChild:function(a,c){if(null!=a){if(!(a instanceof cc.ParticleSystem))throw"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,c);var d=this._textureAtlas;d.removeQuadsAtIndex(a.getAtlasIndex(),a.getTotalParticles());d.fillWithEmptyQuadsFromIndex(d.getTotalQuads(),a.getTotalParticles());a.setBatchNode(null);this._updateAllAtlasIndexes()}}},reorderChild:function(a,c){if(!a)throw"cc.ParticleBatchNode.reorderChild(): child should be non-null";if(!(a instanceof cc.ParticleSystem))throw"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(c!=a.getZOrder()){if(1<this._children.length){var d=this._getCurrentIndex(a,c);if(d.oldIndex!=d.newIndex){cc.ArrayRemoveObjectAtIndex(this._children,d.oldIndex);this._children=cc.ArrayAppendObjectToIndex(this._children,a,d.newIndex);d=a.getAtlasIndex();this._updateAllAtlasIndexes();for(var e=0,f=this._children,g=0;g<f.length;g++)if(f[g]==a){e=a.getAtlasIndex();break}this._textureAtlas.moveQuadsFromIndex(d,
a.getTotalParticles(),e);a.updateWithNoTime()}}a._setZOrder(c)}},removeChildAtIndex:function(a,c){this.removeChild(this._children[i],c)},removeAllChildren:function(a){for(var c=this._children,d=0;d<c.length;d++)c[d].setBatchNode(null);cc.Node.prototype.removeAllChildren.call(this,a);this._textureAtlas.removeAllQuads()},disableParticle:function(a){a=this._textureAtlas.getQuads()[a];a.br.vertices.x=a.br.vertices.y=a.tr.vertices.x=a.tr.vertices.y=a.tl.vertices.x=a.tl.vertices.y=a.bl.vertices.x=a.bl.vertices.y=
0;this._textureAtlas._setDirty(!0)},draw:function(a){cc.renderContextType!==cc.CANVAS&&0!=this._textureAtlas.getTotalQuads()&&(cc.NODE_DRAW_SETUP(this),cc.glBlendFuncForParticle(this._blendFunc.src,this._blendFunc.dst),this._textureAtlas.drawQuads())},getTexture:function(){return this._textureAtlas.getTexture()},setTexture:function(a){this._textureAtlas.setTexture(a);var c=this._blendFunc;a&&!a.hasPremultipliedAlpha()&&c.src==gl.BLEND_SRC&&c.dst==gl.BLEND_DST&&(c.src=gl.SRC_ALPHA,c.dst=gl.ONE_MINUS_SRC_ALPHA)},
setBlendFunc:function(a,c){void 0===c?(this._blendFunc.src=a.src,this._blendFunc.dst=a.dst):(this._blendFunc.src=a,this._blendFunc.src=c)},getBlendFunc:function(){return{src:this._blendFunc.src,dst:this._blendFunc.dst}},visit:function(a){cc.renderContextType!==cc.CANVAS&&this._visible&&(cc.kmGLPushMatrix(),this._grid&&this._grid.isActive()&&(this._grid.beforeDraw(),this.transformAncestors()),this.transform(a),this.draw(a),this._grid&&this._grid.isActive()&&this._grid.afterDraw(this),cc.kmGLPopMatrix())},
_updateAllAtlasIndexes:function(){for(var a=0,c=this._children,d=0;d<c.length;d++){var e=c[d];e.setAtlasIndex(a);a+=e.getTotalParticles()}},_increaseAtlasCapacityTo:function(a){cc.log("cocos2d: cc.ParticleBatchNode: resizing TextureAtlas capacity from ["+this._textureAtlas.getCapacity()+"] to ["+a+"].");this._textureAtlas.resizeCapacity(a)||cc.log("cc.ParticleBatchNode._increaseAtlasCapacityTo() : WARNING: Not enough memory to resize the atlas")},_searchNewPositionInChildrenForZ:function(a){for(var c=
this._children,d=c.length,e=0;e<d;e++)if(c[e].getZOrder()>a)return e;return d},_getCurrentIndex:function(a,c){for(var d=!1,e=!1,f=0,g=0,h=0,k=this._children,m=k.length,n=0;n<m;n++){var p=k[n];if(p.getZOrder()>c&&!e&&(f=n,e=!0,d&&e))break;if(a==p&&(g=n,d=!0,e||(h=-1),d&&e))break}e||(f=m);return{newIndex:f+h,oldIndex:g}},_addChildHelper:function(a,c,d){if(!a)throw"cc.ParticleBatchNode._addChildHelper(): child should be non-null";if(a.getParent())return cc.log("cc.ParticleBatchNode._addChildHelper(): child already added. It can't be added again"),
null;this._children||(this._children=[]);var e=this._searchNewPositionInChildrenForZ(c);this._children=cc.ArrayAppendObjectToIndex(this._children,a,e);a.setTag(d);a._setZOrder(c);a.setParent(this);this._running&&(a.onEnter(),a.onEnterTransitionDidFinish());return e},_updateBlendFunc:function(){this._textureAtlas.getTexture().hasPremultipliedAlpha()||(this._blendFunc.src=gl.SRC_ALPHA,this._blendFunc.dst=gl.ONE_MINUS_SRC_ALPHA)},getTextureAtlas:function(){return this._textureAtlas},setTextureAtlas:function(a){this._textureAtlas=
a}});cc.ParticleBatchNode.createWithTexture=function(a,c){var d=new cc.ParticleBatchNode;return d&&d.initWithTexture(a,c)?d:null};cc.ParticleBatchNode.create=function(a,c){var d=new cc.ParticleBatchNode;return d&&d.init(a,c)?d:null};cc.__convertVerts=function(a){for(var c=[],d=0;d<a.length/2;d++)c[d]={x:a[2*d],y:a[2*d+1]};return c};cc.ColorForBody=function(a){return a.isRogue()||a.isSleeping()?cc.c4f(0.5,0.5,0.5,0.5):a.nodeIdleTime>a.space.sleepTimeThreshold?cc.c4f(0.33,0.33,0.33,0.5):cc.c4f(1,0,0,0.5)};
cc.DrawShape=function(a,c){var d=a.body,e=cc.ColorForBody(d);switch(a.collisionCode){case cp.CircleShape.prototype.collisionCode:this.drawDot(a.tc,Math.max(a.r,1),e);this.drawSegment(a.tc,cp.v.add(a.tc,cp.v.mult(d.rot,a.r)),1,e);break;case cp.SegmentShape.prototype.collisionCode:this.drawSegment(a.ta,a.tb,Math.max(a.r,2),e);break;case cp.PolyShape.prototype.collisionCode:d=cc.c4f(e.r,e.g,e.b,cc.lerp(e.a,1,0.5));this.drawPoly(cc.__convertVerts(a.tVerts),e,1,d);break;default:cc.log("cc.DrawShape(): Bad assertion in DrawShape()")}};
cc.DrawConstraint=function(a,c){var d=a.a,e=a.b,f;a instanceof cp.PinJoint?(f=d.local2World(a.anchr1),d=e.local2World(a.anchr2),this.drawDot(f,3,cc.CONSTRAINT_COLOR),this.drawDot(d,3,cc.CONSTRAINT_COLOR),this.drawSegment(f,d,1,cc.CONSTRAINT_COLOR)):a instanceof cp.SlideJoint?(f=d.local2World(a.anchr1),d=e.local2World(a.anchr2),this.drawDot(f,3,cc.CONSTRAINT_COLOR),this.drawDot(d,3,cc.CONSTRAINT_COLOR),this.drawSegment(f,d,1,cc.CONSTRAINT_COLOR)):a instanceof cp.PivotJoint?(f=d.local2World(a.anchr1),
d=e.local2World(a.anchr2),this.drawDot(f,3,cc.CONSTRAINT_COLOR),this.drawDot(d,3,cc.CONSTRAINT_COLOR)):a instanceof cp.GrooveJoint&&(f=d.local2World(a.grv_a),d=d.local2World(a.grv_b),e=e.local2World(a.anchr2),this.drawDot(e,3,cc.CONSTRAINT_COLOR),this.drawSegment(f,d,1,cc.CONSTRAINT_COLOR))};cc.CONSTRAINT_COLOR=cc.c4f(0,1,0,0.5);
cc.PhysicsDebugNode=cc.DrawNode.extend({_spaceObj:null,_spacePtr:null,getSpace:function(){return this._spacePtr},setSpace:function(a){this._spacePtr=a},draw:function(a){this._spacePtr&&(this._spacePtr.eachShape(cc.DrawShape.bind(this)),this._spacePtr.eachConstraint(cc.DrawConstraint.bind(this)),cc.DrawNode.prototype.draw.call(this),this.clear())}});cc.PhysicsDebugNode.debugNodeForChipmunkSpace=function(a){var c=new cc.PhysicsDebugNode;return c.init()?(c._spaceObj=a,c._spacePtr=a.space,c):null};
cc.PhysicsDebugNode.debugNodeForCPSpace=function(a){var c=new cc.PhysicsDebugNode;return c.init()?(c._spacePtr=a,c):null};cc.PhysicsDebugNode.create=cc.PhysicsDebugNode.debugNodeForCPSpace;(function(){cc.PhysicsSprite=cc.Sprite.extend({_ignoreBodyRotation:!1,_body:null,_rotation:1,setBody:function(a){this._body=a},getBody:function(){return this._body},getPosition:function(){var a=this._body;return{x:a.p.x,y:a.p.y}},getPositionX:function(){return this._body.p.x},getPositionY:function(){return this._body.p.y},setPosition:function(a,c){2==arguments.length?(this._body.p.x=a,this._body.p.y=c):(this._body.p.x=a.x,this._body.p.y=a.y)},_syncPosition:function(){var a=this._position,c=this._body;
a.x==c.p.x&&a.y==c.p.y||cc.Sprite.prototype.setPosition.call(this,c.p.x,c.p.y)},getRotation:function(){return this._ignoreBodyRotation?cc.RADIANS_TO_DEGREES(this._rotationRadiansX):-cc.RADIANS_TO_DEGREES(this._body.a)},setRotation:function(a){this._ignoreBodyRotation?cc.Sprite.prototype.setRotation.call(this,a):this._body.a=-cc.DEGREES_TO_RADIANS(a)},_syncRotation:function(){this._rotationRadiansX!=-this._body.a&&cc.Sprite.prototype.setRotation.call(this,-cc.RADIANS_TO_DEGREES(this._body.a))},nodeToParentTransform:function(){if(cc.renderContextType===
cc.CANVAS)return this._nodeToParentTransformForCanvas();var a=this._body,c=this._anchorPointInPoints,d=this._scaleX,e=this._scaleY,f=a.p.x,g=a.p.y;this._ignoreAnchorPointForPosition&&(f+=c.x,g+=c.y);var h=a.a,a=Math.cos(h),h=Math.sin(h);cc._rectEqualToZero(c)||(f+=a*-c.x*d+-h*-c.y*e,g+=h*-c.x*d+a*-c.y*e);return this._transform=cc.AffineTransformMake(a*d,h*d,-h*e,a*e,f,g)},_nodeToParentTransformForCanvas:function(){if(this.isDirty()){var a=this._transform,c=this._body,d=this._scaleX,e=this._scaleY,
f=this._anchorPointInPoints;a.tx=c.p.x;a.ty=c.p.y;var c=-c.a,g=1,h=0;c&&(g=Math.cos(c),h=Math.sin(c));a.a=a.d=g;a.b=-h;a.c=h;if(1!==d||1!==e)a.a*=d,a.c*=d,a.b*=e,a.d*=e;a.tx+=g*-f.x*d+-h*f.y*e;a.ty-=h*-f.x*d+g*f.y*e;this._ignoreAnchorPointForPosition&&(a.tx+=f.x,a.ty+=f.y);this._transformDirty=!1}return this._transform},isDirty:function(){return!this._body.isSleeping()},setIgnoreBodyRotation:function(a){this._ignoreBodyRotation=a}});cc.PhysicsSprite.create=function(a,c){var d=arguments.length,e=new cc.PhysicsSprite;
return 0===d?e.init()?e:null:2>d?e&&e.initWithFile(a)?e:null:e&&e.initWithFile(a,c)?e:null};cc.PhysicsSprite.createWithSpriteFrameName=function(a){var c=null;if("string"==typeof a){if(c=cc.SpriteFrameCache.getInstance().getSpriteFrame(a),!c)return cc.log("Invalid spriteFrameName: "+a),null}else return cc.log("Invalid argument. Expecting string."),null;return(a=new cc.PhysicsSprite)&&a.initWithSpriteFrame(c)?a:null};cc.PhysicsSprite.createWithSpriteFrame=function(a){var c=new cc.PhysicsSprite;return c&&
c.initWithSpriteFrame(a)?c:null}})();cc.Touch=cc.Class.extend({_point:null,_prevPoint:cc.PointZero(),_id:0,ctor:function(a,c,d){this._point=cc.p(a||0,c||0);this._id=d||0},getLocation:function(){return this._point},getPreviousLocation:function(){return this._prevPoint},getDelta:function(){return cc.pSub(this._point,this._prevPoint)},getID:function(){return this._id},getId:function(){return this._id},setTouchInfo:function(a,c,d){this._prevPoint=this._point;this._point=cc.p(c||0,d||0);this._id=a},_setPrevPoint:function(a,c){this._prevPoint=
cc.p(a||0,c||0)}});cc.TouchDelegate=cc.Class.extend({_eventTypeFuncMap:null,onTouchBegan:function(a,c){return!1},onTouchMoved:function(a,c){},onTouchEnded:function(a,c){},onTouchCancelled:function(a,c){},onTouchesBegan:function(a,c){},onTouchesMoved:function(a,c){},onTouchesEnded:function(a,c){},onTouchesCancelled:function(a,c){},touchDelegateRetain:function(){},touchDelegateRelease:function(){}});
cc.TargetedTouchDelegate=cc.TouchDelegate.extend({onTouchBegan:function(a,c){return!1},onTouchMoved:function(a,c){},onTouchEnded:function(a,c){},onTouchCancelled:function(a,c){}});cc.StandardTouchDelegate=cc.TouchDelegate.extend({onTouchesBegan:function(a,c){},onTouchesMoved:function(a,c){},onTouchesEnded:function(a,c){},onTouchesCancelled:function(a,c){}});cc.TouchHandler=cc.Class.extend({_delegate:null,_priority:0,_enabledSelectors:0,getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},getPriority:function(){return this._priority},setPriority:function(a){this._priority=a},getEnabledSelectors:function(){return this._enabledSelectors},setEnalbedSelectors:function(a){this._enabledSelectors=a},initWithDelegate:function(a,c){if(!a)throw"cc.TouchHandler.initWithDelegate(): touch delegate should not be null";this._delegate=
a;this._priority=c;this._enabledSelectors=0;return!0}});cc.TouchHandler.create=function(a,c){var d=new cc.TouchHandler;d&&d.initWithDelegate(a,c);return d};cc.StandardTouchHandler=cc.TouchHandler.extend({initWithDelegate:function(a,c){return cc.TouchHandler.prototype.initWithDelegate.call(this,a,c)}});cc.StandardTouchHandler.create=function(a,c){var d=new cc.StandardTouchHandler;d&&d.initWithDelegate(a,c);return d};
cc.TargetedTouchHandler=cc.TouchHandler.extend({_swallowsTouches:!1,_claimedTouches:null,isSwallowsTouches:function(){return this._swallowsTouches},setSwallowsTouches:function(a){this._swallowsTouches=a},getClaimedTouches:function(){return this._claimedTouches},initWithDelegate:function(a,c,d){return cc.TouchHandler.prototype.initWithDelegate.call(this,a,c)?(this._claimedTouches=[],this._swallowsTouches=d,!0):!1}});
cc.TargetedTouchHandler.create=function(a,c,d){var e=new cc.TargetedTouchHandler;e&&e.initWithDelegate(a,c,d);return e};cc.TouchSelectorBeganBit=1;cc.TouchSelectorMovedBit=2;cc.TouchSelectorEndedBit=4;cc.TouchSelectorCancelledBit=8;cc.TouchSelectorAllBits=cc.TouchSelectorBeganBit|cc.TouchSelectorMovedBit|cc.TouchSelectorEndedBit|cc.TouchSelectorCancelledBit;cc.TOUCH_BEGAN=0;cc.TOUCH_MOVED=1;cc.TOUCH_ENDED=2;cc.TOUCH_CANCELLED=3;cc.TouchMax=4;cc.less=function(a,c){return a.getPriority()>c.getPriority()};cc.TouchHandlerHelperData=function(a){this.type=a};
cc.TouchDispatcher=cc.Class.extend({_mousePressed:!1,_targetedHandlers:null,_standardHandlers:null,_locked:!1,_toAdd:!1,_toRemove:!1,_handlersToAdd:null,_handlersToRemove:null,_toQuit:!1,_dispatchEvents:!1,_handlerHelperData:[new cc.TouchHandlerHelperData(cc.TOUCH_BEGAN),new cc.TouchHandlerHelperData(cc.TOUCH_MOVED),new cc.TouchHandlerHelperData(cc.TOUCH_ENDED),new cc.TouchHandlerHelperData(cc.TOUCH_CANCELLED)],init:function(){this._dispatchEvents=!0;this._targetedHandlers=[];this._standardHandlers=
[];this._handlersToAdd=[];this._handlersToRemove=[];this._mousePressed=this._locked=this._toQuit=this._toAdd=this._toRemove=!1;cc.TouchDispatcher.registerHtmlElementEvent(cc.canvas);return!0},_setMousePressed:function(a){this._mousePressed=a},_getMousePressed:function(){return this._mousePressed},isDispatchEvents:function(){return this._dispatchEvents},setDispatchEvents:function(a){this._dispatchEvents=a},_addStandardDelegate:function(a,c){var d=cc.StandardTouchHandler.create(a,c||0);this._locked?
-1!=this._handlersToRemove.indexOf(a)?cc.ArrayRemoveObject(this._handlersToRemove,a):(this._handlersToAdd.push(d),this._toAdd=!0):this._standardHandlers=this.forceAddHandler(d,this._standardHandlers)},_addTargetedDelegate:function(a,c,d){c=cc.TargetedTouchHandler.create(a,c,d);this._locked?-1!=this._handlersToRemove.indexOf(a)?cc.ArrayRemoveObject(this._handlersToRemove,a):(this._handlersToAdd.push(c),this._toAdd=!0):this._targetedHandlers=this.forceAddHandler(c,this._targetedHandlers)},forceAddHandler:function(a,
c){for(var d=0,e,f=0;f<c.length;f++)if(e=c[f])if(e.getPriority()<a.getPriority()&&++d,e.getDelegate()==a.getDelegate())return cc.log("cc.TouchDispatcher.forceAddHandler(): The handler has been added."),c;return cc.ArrayAppendObjectToIndex(c,a,d)},forceRemoveAllDelegates:function(){this._standardHandlers.length=0;this._targetedHandlers.length=0},_removeDelegate:function(a){if(null!=a)if(this._locked){var c=this.findHandler(this._handlersToAdd,a);c?cc.ArrayRemoveObject(this._handlersToAdd,c):(this._handlersToRemove.push(a),
this._toRemove=!0)}else this.forceRemoveDelegate(a)},removeAllDelegates:function(){this._locked?this._toQuit=!0:this.forceRemoveAllDelegates()},setPriority:function(a,c){if(!c)throw"cc.TouchDispatcher.setPriority(): delegate should be non-null.";var d=this.findHandler(c);d?d.getPriority()!=a&&(d.setPriority(a),this.rearrangeHandlers(this._targetedHandlers),this.rearrangeHandlers(this._standardHandlers)):cc.log("cc.TouchDispatcher.setPriority(): Can't find TouchHandler.")},touches:function(a,c,d){if(0>
d||4<=d)throw"cc.TouchDispatcher.touches(): invalid index";this._locked=!0;var e=this._targetedHandlers.length,f=this._standardHandlers.length,g=e&&f,h=g?a.slice():a,k=this._handlerHelperData[d];if(0<e)for(var m,n,p=0;p<a.length;p++)for(var e=a[p],q=0;q<this._targetedHandlers.length;q++){m=this._targetedHandlers[q];if(!m)break;n=!1;if(d==cc.TOUCH_BEGAN)m.getDelegate().onTouchBegan&&(n=m.getDelegate().onTouchBegan(e,c))&&m.getClaimedTouches().push(e);else if(0<m.getClaimedTouches().length)switch(n=
!0,k.type){case cc.TOUCH_MOVED:if(cc.Browser.isMobile){if(m.getDelegate().onTouchMoved)m.getDelegate().onTouchMoved(e,c)}else if(this._mousePressed&&m.getDelegate().onTouchMoved)m.getDelegate().onTouchMoved(e,c);break;case cc.TOUCH_ENDED:if(m.getDelegate().onTouchEnded)m.getDelegate().onTouchEnded(e,c);m.getClaimedTouches().length=0;break;case cc.TOUCH_CANCELLED:if(m.getDelegate().onTouchCancelled)m.getDelegate().onTouchCancelled(e,c);m.getClaimedTouches().length=0}if(n&&m.isSwallowsTouches()){g&&
cc.ArrayRemoveObject(h,e);break}}if(0<f)for(p=0;p<this._standardHandlers.length;p++){m=this._standardHandlers[p];if(!m)break;switch(k.type){case cc.TOUCH_BEGAN:if(0<h.length&&m.getDelegate().onTouchesBegan)m.getDelegate().onTouchesBegan(h,c);break;case cc.TOUCH_MOVED:if(0<h.length)if(cc.Browser.isMobile){if(m.getDelegate().onTouchesMoved)m.getDelegate().onTouchesMoved(h,c)}else if(this._mousePressed&&m.getDelegate().onTouchesMoved)m.getDelegate().onTouchesMoved(h,c);break;case cc.TOUCH_ENDED:if(m.getDelegate().onTouchesEnded&&
0<h.length)m.getDelegate().onTouchesEnded(h,c);break;case cc.TOUCH_CANCELLED:if(m.getDelegate().onTouchesCancelled)m.getDelegate().onTouchesCancelled(h,c)}}this._locked=!1;if(this._toRemove){this._toRemove=!1;for(p=0;p<this._handlersToRemove.length;p++)this.forceRemoveDelegate(this._handlersToRemove[p]);this._handlersToRemove.length=0}if(this._toAdd){this._toAdd=!1;for(p=0;p<this._handlersToAdd.length;p++){m=this._handlersToAdd[p];if(!m)break;m instanceof cc.TargetedTouchHandler?this._targetedHandlers=
this.forceAddHandler(m,this._targetedHandlers):this._standardHandlers=this.forceAddHandler(m,this._standardHandlers)}this._handlersToAdd.length=0}this._toQuit&&(this._toQuit=!1,this.forceRemoveAllDelegates())},touchesBegan:function(a,c){this._dispatchEvents&&this.touches(a,c,cc.TOUCH_BEGAN)},touchesMoved:function(a,c){this._dispatchEvents&&this.touches(a,c,cc.TOUCH_MOVED)},touchesEnded:function(a,c){this._dispatchEvents&&this.touches(a,c,cc.TOUCH_ENDED)},touchesCancelled:function(a,c){this._dispatchEvents&&
this.touches(a,c,cc.TOUCH_CANCELLED)},findHandler:function(a,c){switch(arguments.length){case 1:c=arguments[0];if(!c)throw"cc.TouchDispatcher.findHandler(): delegate should be non-null.";for(var d=0;d<this._targetedHandlers.length;d++)if(this._targetedHandlers[d].getDelegate()==c)return this._targetedHandlers[d];for(d=0;d<this._standardHandlers.length;d++)if(this._standardHandlers[d].getDelegate()==c)return this._standardHandlers[d];return null;case 2:if(!a)throw"cc.TouchDispatcher.findHandler(): array should be non-null.";
if(!c)throw"cc.TouchDispatcher.findHandler(): delegate should be non-null.";for(d=0;d<a.length;d++)if(a[d].getDelegate()==c)return a[d];return null;default:throw"Argument must be non-nil ";}},forceRemoveDelegate:function(a){for(var c,d=0;d<this._standardHandlers.length;d++)if((c=this._standardHandlers[d])&&c.getDelegate()==a){cc.ArrayRemoveObject(this._standardHandlers,c);break}for(d=0;d<this._targetedHandlers.length;d++)if((c=this._targetedHandlers[d])&&c.getDelegate()==a){cc.ArrayRemoveObject(this._targetedHandlers,
c);break}},rearrangeHandlers:function(a){a.sort(cc.less)}});cc.TouchDispatcher.preTouchPoint=cc.p(0,0);cc.TouchDispatcher.isRegisterEvent=!1;
cc.getHTMLElementPosition=function(a){var c=document.documentElement,d=window,e=null,e="function"===typeof a.getBoundingClientRect?a.getBoundingClientRect():a instanceof HTMLCanvasElement?{left:0,top:0,width:a.width,height:a.height}:{left:0,top:0,width:parseInt(a.style.width),height:parseInt(a.style.height)};return{left:e.left+d.pageXOffset-c.clientLeft,top:e.top+d.pageYOffset-c.clientTop,width:e.width,height:e.height}};
cc.ProcessMouseupEvent=function(a,c){var d=cc.getHTMLElementPosition(a),e,f;null!=c.pageX?(e=c.pageX,f=c.pageY):(d.left-=document.body.scrollLeft,d.top-=document.body.scrollTop,e=c.clientX,f=c.clientY);e=cc.EGLView.getInstance().convertToLocationInView(e,f,d);d=new cc.Touch(e.x,e.y);d._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y);cc.TouchDispatcher.preTouchPoint.x=e.x;cc.TouchDispatcher.preTouchPoint.y=e.y;e=[];e.push(d);cc.EGLView.getInstance().touchesEnded(e,
null)};
cc.TouchDispatcher.registerHtmlElementEvent=function(a){if(!cc.TouchDispatcher.isRegisterEvent){if(cc.Browser.isMobile)if(window.navigator.msPointerEnabled){var c={MSPointerDown:"touchesBegan",MSPointerMove:"touchesMoved",MSPointerUp:"touchesEnded",MSPointerCancel:"touchesCancelled"},d;for(d in c)(function(c,d){a.addEventListener(c,function(c){var e=cc.getHTMLElementPosition(a);e.left-=document.body.scrollLeft;e.top-=document.body.scrollTop;var k,m;k=c.clientX;m=c.clientY;k=cc.EGLView.getInstance().convertToLocationInView(k,m,
e);e=new cc.Touch(k.x,k.y);e._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y);cc.TouchDispatcher.preTouchPoint.x=k.x;cc.TouchDispatcher.preTouchPoint.y=k.y;cc.Director.getInstance().getTouchDispatcher()[d]([e],null);c.stopPropagation();c.preventDefault()},!1)})(d,c[d])}else a.addEventListener("touchstart",function(c){if(c.changedTouches){var d=[],g=cc.getHTMLElementPosition(a);g.left-=document.body.scrollLeft;g.top-=document.body.scrollTop;for(var h,k,m,n=c.changedTouches.length,
p=0;p<n;p++)if(h=c.changedTouches[p])k=h.clientX,m=h.clientY,k=cc.EGLView.getInstance().convertToLocationInView(k,m,g),h.identifier?(h=new cc.Touch(k.x,k.y,h.identifier),m=cc.TouchDispatcher._getPreTouch(h).getLocation(),h._setPrevPoint(m.x,m.y),cc.TouchDispatcher._setPreTouch(h)):(h=new cc.Touch(k.x,k.y),h._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y)),cc.TouchDispatcher.preTouchPoint.x=k.x,cc.TouchDispatcher.preTouchPoint.y=k.y,d.push(h);cc.EGLView.getInstance().touchesBegan(d,
null);c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("touchmove",function(c){if(c.changedTouches){var d=[],g=cc.getHTMLElementPosition(a);g.left-=document.body.scrollLeft;g.top-=document.body.scrollTop;for(var h,k,m,n=c.changedTouches.length,p=0;p<n;p++)if(h=c.changedTouches[p])k=h.clientX,m=h.clientY,k=cc.EGLView.getInstance().convertToLocationInView(k,m,g),h.identifier?(h=new cc.Touch(k.x,k.y,h.identifier),m=cc.TouchDispatcher._getPreTouch(h).getLocation(),h._setPrevPoint(m.x,m.y),
cc.TouchDispatcher._setPreTouch(h)):(h=new cc.Touch(k.x,k.y),h._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y)),cc.TouchDispatcher.preTouchPoint.x=k.x,cc.TouchDispatcher.preTouchPoint.y=k.y,d.push(h);cc.EGLView.getInstance().touchesMoved(d,null);c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("touchend",function(c){if(c.changedTouches){var d=[],g=cc.getHTMLElementPosition(a);g.left-=document.body.scrollLeft;g.top-=document.body.scrollTop;for(var h,
k,m,n=c.changedTouches.length,p=0;p<n;p++)if(h=c.changedTouches[p])k=h.clientX,m=h.clientY,k=cc.EGLView.getInstance().convertToLocationInView(k,m,g),h.identifier?(h=new cc.Touch(k.x,k.y,h.identifier),m=cc.TouchDispatcher._getPreTouch(h).getLocation(),h._setPrevPoint(m.x,m.y),cc.TouchDispatcher._deletePreTouchWithSameId(h)):(h=new cc.Touch(k.x,k.y),h._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y)),cc.TouchDispatcher.preTouchPoint.x=k.x,cc.TouchDispatcher.preTouchPoint.y=
k.y,d.push(h);cc.EGLView.getInstance().touchesEnded(d,null);c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("touchcancel",function(c){if(c.changedTouches){var d=[],g=cc.getHTMLElementPosition(a);g.left-=document.body.scrollLeft;g.top-=document.body.scrollTop;for(var h,k,m,n=c.changedTouches.length,p=0;p<n;p++)if(h=c.changedTouches[p])k=h.clientX,m=h.clientY,k=cc.EGLView.getInstance().convertToLocationInView(k,m,g),h.identifier?(h=new cc.Touch(k.x,k.y,h.identifier),m=cc.TouchDispatcher._getPreTouch(h).getLocation(),
h._setPrevPoint(m.x,m.y),cc.TouchDispatcher._deletePreTouchWithSameId(h)):(h=new cc.Touch(k.x,k.y),h._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y)),cc.TouchDispatcher.preTouchPoint.x=k.x,cc.TouchDispatcher.preTouchPoint.y=k.y,d.push(h);cc.EGLView.getInstance().touchesCancelled(d,null);c.stopPropagation();c.preventDefault()}},!1);else window.addEventListener("mousedown",function(a){cc.Director.getInstance().getTouchDispatcher()._setMousePressed(!0)}),window.addEventListener("mouseup",
function(c){cc.Director.getInstance().getTouchDispatcher()._setMousePressed(!1);var d=cc.getHTMLElementPosition(a),g;null!=c.pageX?(g=c.pageX,c=c.pageY):(d.left-=document.body.scrollLeft,d.top-=document.body.scrollTop,g=c.clientX,c=c.clientY);cc.rectContainsPoint(new cc.Rect(d.left,d.top,d.width,d.height),cc.p(g,c))||(g=cc.EGLView.getInstance().convertToLocationInView(g,c,d),d=new cc.Touch(g.x,g.y),d._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y),cc.TouchDispatcher.preTouchPoint.x=
g.x,cc.TouchDispatcher.preTouchPoint.y=g.y,g=[],g.push(d),cc.EGLView.getInstance().touchesEnded(g,null))}),a.addEventListener("mousedown",function(c){var d=cc.getHTMLElementPosition(a),g;null!=c.pageX?(g=c.pageX,c=c.pageY):(d.left-=document.body.scrollLeft,d.top-=document.body.scrollTop,g=c.clientX,c=c.clientY);g=cc.EGLView.getInstance().convertToLocationInView(g,c,d);d=new cc.Touch(g.x,g.y);d._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,cc.TouchDispatcher.preTouchPoint.y);cc.TouchDispatcher.preTouchPoint.x=
g.x;cc.TouchDispatcher.preTouchPoint.y=g.y;g=[];g.push(d);cc.EGLView.getInstance().touchesBegan(g,null)}),a.addEventListener("mouseup",function(c){cc.ProcessMouseupEvent(a,c)}),a.addEventListener("mousemove",function(c){var d=cc.getHTMLElementPosition(a),g;null!=c.pageX?(g=c.pageX,c=c.pageY):(d.left-=document.body.scrollLeft,d.top-=document.body.scrollTop,g=c.clientX,c=c.clientY);g=cc.EGLView.getInstance().convertToLocationInView(g,c,d);d=new cc.Touch(g.x,g.y);d._setPrevPoint(cc.TouchDispatcher.preTouchPoint.x,
cc.TouchDispatcher.preTouchPoint.y);cc.TouchDispatcher.preTouchPoint.x=g.x;cc.TouchDispatcher.preTouchPoint.y=g.y;g=[];g.push(d);cc.EGLView.getInstance().touchesMoved(g,null)});cc.TouchDispatcher.isRegisterEvent=!0}};cc.TouchDispatcher._getPreTouch=function(a){for(var c=null,d=cc.TouchDispatcher._preTouchPool,e=a.getId(),f=d.length-1;0<=f;f--)if(d[f].getId()==e){c=d[f];break}c||(c=a);return c};
cc.TouchDispatcher._setPreTouch=function(a){for(var c=!1,d=cc.TouchDispatcher._preTouchPool,e=a.getId(),f=d.length-1;0<=f;f--)if(d[f].getId()==e){d[f]=a;c=!0;break}c||(50>=d.length?d.push(a):(d[cc.TouchDispatcher._preTouchPoolPointer]=a,cc.TouchDispatcher._preTouchPoolPointer=(cc.TouchDispatcher._preTouchPoolPointer+1)%50))};
cc.TouchDispatcher._deletePreTouchWithSameId=function(a){var c,d=cc.TouchDispatcher._preTouchPool;c=a.getId();for(a=d.length-1;0<=a;a--)if(d[a].getId()==c){c=d.pop();a!=d.length&&(d[a]=c);break}};cc.TouchDispatcher._preTouchPool=[];cc.TouchDispatcher._preTouchPoolPointer=0;cc.registerTargetedDelegate=function(a,c,d){cc.Director.getInstance().getTouchDispatcher()._addTargetedDelegate(d,a,c)};
cc.registerStandardDelegate=function(a,c){cc.Director.getInstance().getTouchDispatcher()._addStandardDelegate(a,c)};cc.unregisterTouchDelegate=function(a){cc.Director.getInstance().getTouchDispatcher()._removeDelegate(a)};cc.MOUSE_DOWN=1;cc.MOUSE_MOVED=2;cc.MOUSE_DRAGGED=4;cc.MOUSE_UP=8;cc.RIGHT_MOUSE_DOWN=16;cc.RIGHT_MOUSE_DRAGGED=32;cc.RIGHT_MOUSE_UP=64;cc.OTHER_MOUSE_DOWN=128;cc.OTHER_MOUSE_DRAGGED=256;cc.OTHER_MOUSE_UP=512;cc.SCROLL_WHEEL=1024;cc.MOUSE_ENTERED=2048;cc.MOUSE_EXITED=4096;cc.MOUSE_LEFTBUTTON=0;cc.MOUSE_MIDDLEBUTTON=1;cc.MOUSE_RIGHTBUTTON=2;
cc.MouseEventDelegate=cc.Class.extend({onMouseDown:function(a){return!1},onMouseDragged:function(a){return!1},onMouseMoved:function(a){return!1},onMouseUp:function(a){return!1},onRightMouseDown:function(a){return!1},onRightMouseDragged:function(a){return!1},onRightMouseUp:function(a){return!1},onOtherMouseDown:function(a){return!1},onOtherMouseDragged:function(a){return!1},onOtherMouseUp:function(a){return!1},onScrollWheel:function(a){return!1},onMouseEntered:function(a){return!1},onMouseExited:function(a){return!1}});
cc.Mouse=cc.Touch.extend({_wheelDelta:0,_button:cc.MOUSE_LEFTBUTTON,getWheelDelta:function(){return this._wheelDelta},setWheelDelta:function(a){this._wheelDelta=a},getButton:function(){return this._button},setButton:function(a){this._button=a}});
cc.MouseHandler=cc.Class.extend({_delegate:null,_priority:0,_enabledSelectors:0,getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},getPriority:function(){return this._priority},setPriority:function(a){this._priority=a},getEnabledSelectors:function(){return this._enabledSelectors},setEnalbedSelectors:function(a){this._enabledSelectors=a},initWithDelegate:function(a,c){this._delegate=a;this._priority=c}});
cc.MouseHandler.create=function(a,c){var d=new cc.MouseHandler;d.initWithDelegate(a,c);return d};
cc.MouseDispatcher=cc.Class.extend({_mousePressed:!1,_rightMousePressed:!1,_mouseDelegateHandlers:null,_dispatchEvents:!1,init:function(){this._dispatchEvents=!0;this._mouseDelegateHandlers=[];this._rightMousePressed=this._mousePressed=!1;cc.MouseDispatcher._registerHtmlElementEvent(cc.canvas);return!0},_setMousePressed:function(a){this._mousePressed=a},_getMousePressed:function(){return this._mousePressed},_setRightMousePressed:function(a){this._rightMousePressed=a},_getRightMousePressed:function(){return this._rightMousePressed},
addMouseDelegate:function(a,c){var d=cc.MouseHandler.create(a,c);this._mouseDelegateHandlers=this.forceAddHandler(d,this._mouseDelegateHandlers)},forceAddHandler:function(a,c){for(var d=0,e=0;e<c.length;e++){var f=c[e];if(f&&(f.getPriority()<a.getPriority()&&++d,f.getDelegate()==a.getDelegate()))return cc.log("cc.MouseDispatcher.forceAddHandler(): handler has been added."),c}return cc.ArrayAppendObjectToIndex(c,a,d)},removeMouseDelegate:function(a){if(null!=a)for(var c=0;c<this._mouseDelegateHandlers.length;c++){var d=
this._mouseDelegateHandlers[c];if(d&&d.getDelegate()==a){cc.ArrayRemoveObject(this._mouseDelegateHandlers,d);break}}},_findHandler:function(a){for(var c=0;c<this._mouseDelegateHandlers.length;c++)if(this._mouseDelegateHandlers[c]&&this._mouseDelegateHandlers[c].getDelegate()==a)return this._mouseDelegateHandlers[c];return null},setPriority:function(a,c){if(!c)throw"cc.MouseDispatcher.setPriority(): delegate should be non-null";var d=this._findHandler(c);d?d.getPriority()!=a&&(d.setPriority(a),this._mouseDelegateHandlers.sort(cc.less)):
cc.log("cc.MouseDispatcher.setPriority(): Can't find MouseHandler in array")},removeAllMouseDelegates:function(){this._mouseDelegateHandlers.length=0},mouseHandle:function(a,c,d){for(c=0;c<this._mouseDelegateHandlers.length;c++){var e=this._mouseDelegateHandlers[c];switch(d){case cc.MOUSE_DOWN:if(a.getButton()==cc.MOUSE_RIGHTBUTTON){if(e.getDelegate().onRightMouseDown)e.getDelegate().onRightMouseDown(a)}else if(e.getDelegate().onMouseDown)e.getDelegate().onMouseDown(a);break;case cc.MOUSE_UP:if(a.getButton()==
cc.MOUSE_RIGHTBUTTON){if(e.getDelegate().onRightMouseUp)e.getDelegate().onRightMouseUp(a)}else if(e.getDelegate().onMouseUp)e.getDelegate().onMouseUp(a);break;case cc.MOUSE_MOVED:if(this._mousePressed){if(e.getDelegate().onMouseDragged)e.getDelegate().onMouseDragged(a)}else if(this._rightMousePressed){if(e.getDelegate().onRightMouseDragged)e.getDelegate().onRightMouseDragged(a)}else if(e.getDelegate().onMouseMoved)e.getDelegate().onMouseMoved(a);break;case cc.MOUSE_ENTERED:if(e.getDelegate().onMouseEntered)e.getDelegate().onMouseEntered(a);
break;case cc.MOUSE_EXITED:if(e.getDelegate().onMouseExited)e.getDelegate().onMouseExited(a);break;case cc.SCROLL_WHEEL:if(e.getDelegate().onScrollWheel)e.getDelegate().onScrollWheel(a)}}}});cc.MouseDispatcher._preMousePoint=cc.p(0,0);cc.MouseDispatcher._isRegisterEvent=!1;
cc.MouseDispatcher._registerHtmlElementEvent=function(a){function c(c){var e=cc.getHTMLElementPosition(a),f=c.pageX,g=c.pageY,h=cc.EGLView.getInstance(),k=h.getDevicePixelRatio(),f=(f-e.left)*k/h.getScaleX(),e=(e.height-(g-e.top))*k/h.getScaleY(),g=new cc.Mouse(f,e);g._setPrevPoint(cc.MouseDispatcher._preMousePoint.x,cc.MouseDispatcher._preMousePoint.y);g.setButton(c.button);cc.MouseDispatcher._preMousePoint.x=f;cc.MouseDispatcher._preMousePoint.y=e;return g}cc.MouseDispatcher._isRegisterEvent||(window.addEventListener("mousedown",
function(a){a.button==cc.MOUSE_RIGHTBUTTON?cc.Director.getInstance().getMouseDispatcher()._setRightMousePressed(!0):cc.Director.getInstance().getMouseDispatcher()._setMousePressed(!0)}),window.addEventListener("mouseup",function(a){a.button==cc.MOUSE_RIGHTBUTTON?cc.Director.getInstance().getMouseDispatcher()._setRightMousePressed(!1):cc.Director.getInstance().getMouseDispatcher()._setMousePressed(!1)}),a.addEventListener("mousedown",function(a){cc.Director.getInstance().getMouseDispatcher().mouseHandle(c(a),
a,cc.MOUSE_DOWN)}),a.addEventListener("mouseup",function(a){cc.Director.getInstance().getMouseDispatcher().mouseHandle(c(a),a,cc.MOUSE_UP)}),a.addEventListener("mousemove",function(a){cc.Director.getInstance().getMouseDispatcher().mouseHandle(c(a),a,cc.MOUSE_MOVED)}),a.addEventListener("mousewheel",function(a){var e=c(a);e.setWheelDelta(a.wheelDelta);cc.Director.getInstance().getMouseDispatcher().mouseHandle(e,a,cc.SCROLL_WHEEL)},!1),a.addEventListener("DOMMouseScroll",function(a){var e=c(a);e.setWheelDelta(-120*
a.detail);cc.Director.getInstance().getMouseDispatcher().mouseHandle(e,a,cc.SCROLL_WHEEL)}),a.addEventListener("mouseout",function(a){cc.Director.getInstance().getMouseDispatcher().mouseHandle(c(a),a,cc.MOUSE_EXITED)},!1),a.addEventListener("mouseover",function(a){cc.Director.getInstance().getMouseDispatcher().mouseHandle(c(a),a,cc.MOUSE_ENTERED)},!1))};cc.KeyboardDelegate=cc.Class.extend({onKeyDown:function(a){},onKeyUp:function(a){}});cc.KeyboardHandler=cc.Class.extend({getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},initWithDelegate:function(a){if(!a)throw"cc.KeyboardHandler.initWithDelegate(): delegate must be non-null";this._delegate=a;return!0},_delegate:null});cc.KeyboardHandler.create=function(a){var c=new cc.KeyboardHandler;c.initWithDelegate(a);return c};cc.TYPE_BACK_CLICKED=1;cc.TYPE_MENU_CLICKED=2;
cc.KeyboardDispatcher=cc.Class.extend({addDelegate:function(a){a&&(this._locked?(this._handlersToAdd.push(a),this._toAdd=!0):this.forceAddDelegate(a))},removeDelegate:function(a){a&&(this._locked?(this._handlersToRemove.push(a),this._toRemove=!0):this.forceRemoveDelegate(a))},forceAddDelegate:function(a){if(a=cc.KeyboardHandler.create(a)){for(var c=this._delegates,d=0,e=c.length;d<e;d++)if(c[d].getDelegate()==a.getDelegate()){cc.log("cc.KeyboardDispatcher.forceAddDelegate(): the delegate has been added.");return}this._delegates.push(a)}},
forceRemoveDelegate:function(a){for(var c=this._delegates,d=0,e=c.length;d<e;d++)if(c[d].getDelegate()==a){c.splice(d,1);break}},dispatchKeyboardMSG:function(a,c){this._locked=!0;a.stopPropagation();a.preventDefault();var d=0;if(c&&a)for(d=0;d<this._delegates.length;d++){if(this._delegates[d].getDelegate()&&this._delegates[d].getDelegate().onKeyDown)this._delegates[d].getDelegate().onKeyDown(a.keyCode)}else if(!c&&a)for(d=0;d<this._delegates.length;d++)if(this._delegates[d].getDelegate()&&this._delegates[d].getDelegate().onKeyUp)this._delegates[d].getDelegate().onKeyUp(a.keyCode);
this._locked=!1;if(this._toRemove){this._toRemove=!1;for(var e=this._handlersToRemove,d=0;d<e.length;++d)this.forceRemoveDelegate(e[d]);e.length=0}if(this._toAdd){this._toAdd=!1;e=this._handlersToAdd;for(d=0;d<e.length;++d)this.forceAddDelegate(e[d]);e.length=0}return!0},_delegates:[],_locked:!1,_toAdd:!1,_toRemove:!1,_handlersToAdd:[],_handlersToRemove:[]});
cc.KeyboardDispatcher.getInstance=function(){cc.keyboardDispatcher||(cc.keyboardDispatcher=new cc.KeyboardDispatcher,cc.canvas.setAttribute("tabindex",1),cc.canvas.style.outline="none",cc.canvas.style.cursor="default",cc.canvas.addEventListener("keydown",function(a){cc.keyboardDispatcher.dispatchKeyboardMSG(a,!0)}),cc.canvas.addEventListener("keyup",function(a){cc.keyboardDispatcher.dispatchKeyboardMSG(a,!1)}));return cc.keyboardDispatcher};
cc.KeyboardDispatcher.purgeSharedDispatcher=function(){cc.keyboardDispatcher&&(delete cc.keyboardDispatcher,cc.keyboardDispatcher=null)};cc.UIInterfaceOrientationLandscapeLeft=-90;cc.UIInterfaceOrientationLandscapeRight=90;cc.UIInterfaceOrientationPortraitUpsideDown=180;cc.UIInterfaceOrientationPortrait=0;cc.Acceleration=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.timestamp=e||0};cc.Accelerometer=cc.Class.extend({setDelegate:function(a){cc.AccelerometerDispatcher.getInstance().addDelegate(a)},setAccelerometerInterval:function(a){cc.AccelerometerDispatcher.getInstance().setAccelerometerInterval(a)}});
cc.AccelerometerDispatcher=cc.Class.extend({_delegate:null,_acceleration:null,_deviceEvent:null,_interval:1/30,_minus:1,_curTime:0,init:function(){this._acceleration=new cc.Acceleration;var a=window;this._deviceEvent=a.DeviceMotionEvent||a.DeviceOrientationEvent;"mqqbrowser"==cc.Browser.type&&(this._deviceEvent=window.DeviceOrientationEvent);this._deviceEventType=this._deviceEvent==a.DeviceMotionEvent?"devicemotion":"deviceorientation";a=navigator.userAgent;if(/Android/.test(a)||/Adr/.test(a)&&"ucbrowser"==
cc.Browser.type)this._minus=-1},getDelegate:function(){return this._delegate},addDelegate:function(a){this._delegate=a;a=this.didAccelerate.bind(this);var c=window,d=cc.Director.getInstance().getScheduler();this._delegate?(c.addEventListener(this._deviceEventType,a,!1),d.scheduleUpdateForTarget(this)):(c.removeEventListener(this._deviceEventType,a),d.unscheduleUpdateForTarget(this))},setAccelerometerInterval:function(a){this._interval!==a&&(this._interval=a)},didAccelerate:function(a){if(this._delegate){var c=
this._acceleration;if(this._deviceEvent==window.DeviceMotionEvent){var d=a.accelerationIncludingGravity;c.x=this._minus*d.x*0.1;c.y=this._minus*d.y*0.1;c.z=0.1*d.z}else c.x=a.gamma/90*0.981,c.y=0.981*-(a.beta/90),c.z=a.alpha/90*0.981;c.timestamp=a.timeStamp||Date.now();a=c.x;switch(window.orientation){case cc.UIInterfaceOrientationLandscapeRight:c.x=-c.y;c.y=a;break;case cc.UIInterfaceOrientationLandscapeLeft:c.x=c.y;c.y=-a;break;case cc.UIInterfaceOrientationPortraitUpsideDown:c.x=-c.x,c.y=-c.y}}},
update:function(a){this._curTime>this._interval&&(this._curTime-=this._interval,this._delegate.onAccelerometer(this._acceleration));this._curTime+=a}});cc.AccelerometerDispatcher.getInstance=function(){this._instance||(this._instance=new cc.AccelerometerDispatcher,this._instance.init());return this._instance};cc.IMEKeyboardNotificationInfo=function(a,c,d){this.begin=a||cc.RectZero();this.end=c||cc.RectZero();this.duration=d||0};
cc.IMEDelegate=cc.Class.extend({ctor:function(){cc.IMEDispatcher.getInstance().addDelegate(this)},removeDelegate:function(){cc.IMEDispatcher.getInstance().removeDelegate(this)},attachWithIME:function(){return cc.IMEDispatcher.getInstance().attachDelegateWithIME(this)},detachWithIME:function(){return cc.IMEDispatcher.getInstance().detachDelegateWithIME(this)},canAttachWithIME:function(){return!1},didAttachWithIME:function(){},canDetachWithIME:function(){return!1},didDetachWithIME:function(){},insertText:function(a,
c){},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.Browser.isMobile){this._domInputControl=cc.$("#imeDispatcherInput");this._domInputControl||(this._domInputControl=cc.$new("input"),this._domInputControl.setAttribute("type","text"),this._domInputControl.setAttribute("id","imeDispatcherInput"),this._domInputControl.resize(0,0),this._domInputControl.translates(0,
0),this._domInputControl.style.opacity="0",this._domInputControl.style.fontSize="1px",this._domInputControl.setAttribute("tabindex",2),this._domInputControl.style.position="absolute",this._domInputControl.style.top=0,this._domInputControl.style.left=0,document.body.appendChild(this._domInputControl));var a=this;this._domInputControl.addEventListener("input",function(){a._processDomInputString(a._domInputControl.value)},!1);this._domInputControl.addEventListener("keydown",function(c){c.keyCode===cc.KEY.tab?
(c.stopPropagation(),c.preventDefault()):c.keyCode==cc.KEY.enter&&(a.dispatchInsertText("\n",1),c.stopPropagation(),c.preventDefault())},!1);/msie/i.test(navigator.userAgent)&&this._domInputControl.addEventListener("keyup",function(c){c.keyCode==cc.KEY.backspace&&a._processDomInputString(a._domInputControl.value)},!1);window.addEventListener("mousedown",function(c){var d=c.pageY||0;a._lastClickPosition.x=c.pageX||0;a._lastClickPosition.y=d},!1)}},_processDomInputString:function(a){var c,d;c=this._currentInputString.length<
a.length?this._currentInputString.length:a.length;for(d=0;d<c&&a[d]===this._currentInputString[d];d++);var e=this._currentInputString.length-d,f=a.length-d;for(c=0;c<e;c++)this.dispatchDeleteBackward();for(c=0;c<f;c++)this.dispatchInsertText(a[d+c],1);this._currentInputString=a},dispatchInsertText:function(a,c){!this.impl||!a||0>=c||this.impl._delegateWithIme&&this.impl._delegateWithIme.insertText(a,c)},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 c=0;c<this.impl._delegateList.length;c++){var d=this.impl._delegateList[c];d&&d.keyboardWillShow(a)}},dispatchKeyboardDidShow:function(a){if(this.impl)for(var c=0;c<this.impl._delegateList.length;c++){var d=this.impl._delegateList[c];d&&d.keyboardDidShow(a)}},dispatchKeyboardWillHide:function(a){if(this.impl)for(var c=
0;c<this.impl._delegateList.length;c++){var d=this.impl._delegateList[c];d&&d.keyboardWillHide(a)}},dispatchKeyboardDidHide:function(a){if(this.impl)for(var c=0;c<this.impl._delegateList.length;c++){var d=this.impl._delegateList[c];d&&d.keyboardDidHide(a)}},addDelegate:function(a){!a||!this.impl||-1<this.impl._delegateList.indexOf(a)||(this.impl._delegateList=cc.ArrayAppendObjectToIndex(this.impl._delegateList,a,0))},attachDelegateWithIME:function(a){if(!this.impl||!a||-1==this.impl._delegateList.indexOf(a))return!1;
if(this.impl._delegateWithIme){if(!this.impl._delegateWithIme.canDetachWithIME()||!a.canAttachWithIME())return!1;var c=this.impl._delegateWithIme;this.impl._delegateWithIme=null;c.didDetachWithIME();this._focusDomInput(a);return!0}if(!a.canAttachWithIME())return!1;this._focusDomInput(a);return!0},_focusDomInput:function(a){cc.Browser.isMobile?(this.impl._delegateWithIme=a,a.didAttachWithIME(),this._currentInputString=a.getString?a.getString():"",a=prompt("请输入你的个人信息:",this._currentInputString),
null!=a&&this._processDomInputString(a),this.dispatchInsertText("\n",1)):(this.impl._delegateWithIme=a,this._currentInputString=a.getString?a.getString():"",a.didAttachWithIME(),this._domInputControl.focus(),this._domInputControl.value=this._currentInputString,this._domInputControlTranslate())},_domInputControlTranslate:function(){/msie/i.test(navigator.userAgent)?(this._domInputControl.style.left=this._lastClickPosition.x+"px",this._domInputControl.style.top=this._lastClickPosition.y+"px"):this._domInputControl.translates(this._lastClickPosition.x,
this._lastClickPosition.y)},detachDelegateWithIME:function(a){if(!this.impl||!a||this.impl._delegateWithIme!=a||!a.canDetachWithIME())return!1;this.impl._delegateWithIme=null;a.didDetachWithIME();cc.canvas.focus();return!0},removeDelegate:function(a){this.impl&&a&&-1!=this.impl._delegateList.indexOf(a)&&(this.impl._delegateWithIme&&a==this.impl._delegateWithIme&&(this.impl._delegateWithIme=null),cc.ArrayRemoveObject(this.impl._delegateList,a))},processKeycode:function(a){32>a?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 c=0;c<this._delegateList.length;c++)if(this._delegateList[c]==a)return c;return null}});
cc.IMEDispatcher.getInstance=function(){cc.IMEDispatcher.instance||(cc.IMEDispatcher.instance=new cc.IMEDispatcher,cc.IMEDispatcher.instance.init());return cc.IMEDispatcher.instance};cc.IMEDispatcher.instance=null;cc.TextFieldDelegate=cc.Class.extend({onTextFieldAttachWithIME:function(a){return!1},onTextFieldDetachWithIME:function(a){return!1},onTextFieldInsertText:function(a,c,d){return!1},onTextFieldDeleteBackward:function(a,c,d){return!1},onDraw:function(a){return!1}});
cc.TextFieldTTF=cc.LabelTTF.extend({_lens:null,_inputText:"",_placeHolder:"",_charCount:0,_delegate:null,_ColorSpaceHolder:null,ctor:function(){this._ColorSpaceHolder=new cc.Color3B(127,127,127);cc.IMEDispatcher.getInstance().addDelegate(this);cc.LabelTTF.prototype.ctor.call(this)},getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},getCharCount:function(){return this._charCount},getColorSpaceHolder:function(){return this._ColorSpaceHolder},setColorSpaceHolder:function(a){this._ColorSpaceHolder=
a},initWithPlaceHolder:function(a,c,d,e,f){switch(arguments.length){case 5:return a&&(this._placeHolder=a),this.initWithString(this._placeHolder,e,f,c,d);case 3:return a&&(this._placeHolder=a),e=arguments[1],f=arguments[2],this.initWithString(this._placeHolder,e,f);default:throw"Argument must be non-nil ";}},setString:function(a){this._inputText=(a=String(a))||"";this._inputText.length?cc.LabelTTF.prototype.setString.call(this,this._inputText):cc.LabelTTF.prototype.setString.call(this,this._placeHolder);
this._charCount=this._inputText.length},getString:function(){return this._inputText},setPlaceHolder:function(a){this._placeHolder=a||"";this._inputText.length||cc.LabelTTF.prototype.setString.call(this,this._placeHolder)},getPlaceHolder:function(){return this._placeHolder},draw:function(a){a=a||cc.renderContext;if(!this._delegate||!this._delegate.onDraw(this))if(this._inputText&&0<this._inputText.length)cc.LabelTTF.prototype.draw.call(this,a);else{var c=this.getColor();this.setColor(this._ColorSpaceHolder);
cc.renderContextType===cc.CANVAS&&this._updateTexture();cc.LabelTTF.prototype.draw.call(this,a);this.setColor(c)}},attachWithIME:function(){return cc.IMEDispatcher.getInstance().attachDelegateWithIME(this)},detachWithIME:function(){return cc.IMEDispatcher.getInstance().detachDelegateWithIME(this)},canAttachWithIME:function(){return this._delegate?!this._delegate.onTextFieldAttachWithIME(this):!0},didAttachWithIME:function(){},canDetachWithIME:function(){return this._delegate?!this._delegate.onTextFieldDetachWithIME(this):
!0},didDetachWithIME:function(){},deleteBackward:function(){var a=this._inputText.length;0==a||this._delegate&&this._delegate.onTextFieldDeleteBackward(this,this._inputText[a-1],1)||(1>=a?(this._inputText="",this._charCount=0,cc.LabelTTF.prototype.setString.call(this,this._placeHolder)):(a=this._inputText.substring(0,a-1),this.setString(a)))},removeDelegate:function(){cc.IMEDispatcher.getInstance().removeDelegate(this)},insertText:function(a,c){var d=a,e=d.indexOf("\n");-1<e&&(d=d.substring(0,e));
if(0<d.length){if(this._delegate&&this._delegate.onTextFieldInsertText(this,d,d.length))return;d=this._inputText+d;this._charCount=d.length;this.setString(d)}-1!=e&&(this._delegate&&this._delegate.onTextFieldInsertText(this,"\n",1)||this.detachWithIME())},getContentText:function(){return this._inputText},keyboardWillShow:function(a){},keyboardDidShow:function(a){},keyboardWillHide:function(a){},keyboardDidHide:function(a){}});
cc.TextFieldTTF.create=function(a,c,d,e,f){var g;switch(arguments.length){case 5:return(g=new cc.TextFieldTTF)&&g.initWithPlaceHolder("",c,d,e,f)?(a&&g.setPlaceHolder(a),g):null;case 3:return(g=new cc.TextFieldTTF)&&g.initWithString("",arguments[1],arguments[2])?(a&&g.setPlaceHolder(a),g):null;default:throw"Argument must be non-nil ";}};cc.ITEM_SIZE=32;cc._globalFontSize=cc.ITEM_SIZE;cc._globalFontName="Arial";cc._globalFontNameRelease=!1;cc.CURRENT_ITEM=3233828865;cc.ZOOM_ACTION_TAG=3233828866;cc.NORMAL_TAG=8801;cc.SELECTED_TAG=8802;cc.DISABLE_TAG=8803;
cc.MenuItem=cc.NodeRGBA.extend({_target:null,_callback:null,_isSelected:!1,_isEnabled:!1,ctor:function(){cc.NodeRGBA.prototype.ctor.call(this);this._callback=this._target=null;this._isEnabled=this._isSelected=!1},isSelected:function(){return this._isSelected},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},setTarget:function(a,c){this._target=c;this._callback=a},isEnabled:function(){return this._isEnabled},setEnabled:function(a){this._isEnabled=a},initWithCallback:function(a,
c){this.setAnchorPoint(0.5,0.5);this._target=c;this._callback=a;this._isEnabled=!0;this._isSelected=!1;return!0},rect:function(){var a=this._position,c=this._contentSize,d=this._anchorPoint;return cc.rect(a.x-c.width*d.x,a.y-c.height*d.y,c.width,c.height)},selected:function(){this._isSelected=!0},unselected:function(){this._isSelected=!1},setCallback:function(a,c){this._target=c;this._callback=a},activate:function(){this._isEnabled&&cc.doCallback(this._callback,this._target,this)}});
cc.MenuItem.create=function(a,c){var d=new cc.MenuItem;d.initWithCallback(a,c);return d};
cc.MenuItemLabel=cc.MenuItem.extend({_disabledColor:null,_label:null,_orginalScale:0,_colorBackup:null,ctor:function(){cc.MenuItem.prototype.ctor.call(this);this._label=this._disabledColor=null;this._orginalScale=0;this._colorBackup=null},getDisabledColor:function(){return this._disabledColor},setDisabledColor:function(a){this._disabledColor=a},getLabel:function(){return this._label},setLabel:function(a){a&&(this.addChild(a),a.setAnchorPoint(0,0),this.setContentSize(a.getContentSize()));this._label&&
this.removeChild(this._label,!0);this._label=a},setEnabled:function(a){if(this._isEnabled!=a){var c=this._label;a?c.setColor(this._colorBackup):(this._colorBackup=c.getColor(),c.setColor(this._disabledColor))}cc.MenuItem.prototype.setEnabled.call(this,a)},setOpacity:function(a){this._label.setOpacity(a)},getOpacity:function(){return this._label.getOpacity()},setColor:function(a){this._label.setColor(a)},getColor:function(){return this._label.getColor()},initWithLabel:function(a,c,d){this.initWithCallback(c,
d);this._originalScale=1;this._colorBackup=cc.white();this._disabledColor=cc.c3b(126,126,126);this.setLabel(a);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},setString:function(a){this._label.setString(a);this.setContentSize(this._label.getContentSize())},activate:function(){this._isEnabled&&(this.stopAllActions(),this.setScale(this._originalScale),cc.MenuItem.prototype.activate.call(this))},selected:function(){if(this._isEnabled){cc.MenuItem.prototype.selected.call(this);
var a=this.getActionByTag(cc.ZOOM_ACTION_TAG);a?this.stopAction(a):this._originalScale=this.getScale();a=cc.ScaleTo.create(0.1,1.2*this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}},unselected:function(){if(this._isEnabled){cc.MenuItem.prototype.unselected.call(this);this.stopActionByTag(cc.ZOOM_ACTION_TAG);var a=cc.ScaleTo.create(0.1,this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}}});
cc.MenuItemLabel.create=function(a,c,d){var e=new cc.MenuItemLabel;e.initWithLabel(a,c,d);return e};cc.MenuItemAtlasFont=cc.MenuItemLabel.extend({initWithString:function(a,c,d,e,f,g,h){if(!a||0==a.length)throw"cc.MenuItemAtlasFont.initWithString(): value should be non-null and its length should be greater than 0";var k=new cc.LabelAtlas;k.initWithString(a,c,d,e,f);this.initWithLabel(k,g,h);return!0}});
cc.MenuItemAtlasFont.create=function(a,c,d,e,f,g,h){var k=new cc.MenuItemAtlasFont;k.initWithString(a,c,d,e,f,g,h);return k};
cc.MenuItemFont=cc.MenuItemLabel.extend({_fontSize:null,_fontName:null,ctor:function(){cc.MenuItemLabel.prototype.ctor.call(this);this._fontSize=0;this._fontName=""},initWithString:function(a,c,d){if(!a||0==a.length)throw"Value should be non-null and its length should be greater than 0";this._fontName=cc._globalFontName;this._fontSize=cc._globalFontSize;a=cc.LabelTTF.create(a,this._fontName,this._fontSize);this.initWithLabel(a,c,d);return!0},setFontSize:function(a){this._fontSize=a;this._recreateLabel()},
fontSize:function(){return this._fontSize},setFontName:function(a){this._fontName=a;this._recreateLabel()},fontName:function(){return this._fontName},_recreateLabel:function(){var a=cc.LabelTTF.create(this._label.getString(),this._fontName,this._fontSize);this.setLabel(a)}});cc.MenuItemFont.setFontSize=function(a){cc._globalFontSize=a};cc.MenuItemFont.fontSize=function(){return cc._globalFontSize};
cc.MenuItemFont.setFontName=function(a){cc._globalFontNameRelease&&(cc._globalFontName="");cc._globalFontName=a;cc._globalFontNameRelease=!0};cc.MenuItemFont.fontName=function(){return cc._globalFontName};cc.MenuItemFont.create=function(a,c,d){var e=new cc.MenuItemFont;e.initWithString(a,c,d);return e};
cc.MenuItemSprite=cc.MenuItem.extend({_normalImage:null,_selectedImage:null,_disabledImage:null,ctor:function(){cc.MenuItem.prototype.ctor.call(this);this._disabledImage=this._selectedImage=this._normalImage=null},getNormalImage:function(){return this._normalImage},setNormalImage:function(a){this._normalImage!=a&&(a&&(this.addChild(a,0,cc.NORMAL_TAG),a.setAnchorPoint(0,0)),this._normalImage&&this.removeChild(this._normalImage,!0),this._normalImage=a,this.setContentSize(this._normalImage.getContentSize()),
this._updateImagesVisibility(),a.textureLoaded&&!a.textureLoaded()&&a.addLoadedEventListener(function(a){this.setContentSize(a.getContentSize())},this))},getSelectedImage:function(){return this._selectedImage},setSelectedImage:function(a){this._selectedImage!=a&&(a&&(this.addChild(a,0,cc.SELECTED_TAG),a.setAnchorPoint(0,0)),this._selectedImage&&this.removeChild(this._selectedImage,!0),this._selectedImage=a,this._updateImagesVisibility())},getDisabledImage:function(){return this._disabledImage},setDisabledImage:function(a){this._disabledImage!=
a&&(a&&(this.addChild(a,0,cc.DISABLE_TAG),a.setAnchorPoint(0,0)),this._disabledImage&&this.removeChild(this._disabledImage,!0),this._disabledImage=a,this._updateImagesVisibility())},initWithNormalSprite:function(a,c,d,e,f){this.initWithCallback(e,f);this.setNormalImage(a);this.setSelectedImage(c);this.setDisabledImage(d);if(a=this._normalImage)this.setContentSize(a.getContentSize()),a.textureLoaded&&!a.textureLoaded()&&a.addLoadedEventListener(function(a){this.setContentSize(a.getContentSize());this.setCascadeColorEnabled(!0);
this.setCascadeOpacityEnabled(!0)},this);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},setColor:function(a){this._normalImage.setColor(a);this._selectedImage&&this._selectedImage.setColor(a);this._disabledImage&&this._disabledImage.setColor(a)},getColor:function(){return this._normalImage.getColor()},setOpacity:function(a){this._normalImage.setOpacity(a);this._selectedImage&&this._selectedImage.setOpacity(a);this._disabledImage&&this._disabledImage.setOpacity(a)},getOpacity:function(){return this._normalImage.getOpacity()},
selected:function(){cc.MenuItem.prototype.selected.call(this);this._normalImage&&(this._disabledImage&&this._disabledImage.setVisible(!1),this._selectedImage?(this._normalImage.setVisible(!1),this._selectedImage.setVisible(!0)):this._normalImage.setVisible(!0))},unselected:function(){cc.MenuItem.prototype.unselected.call(this);this._normalImage&&(this._normalImage.setVisible(!0),this._selectedImage&&this._selectedImage.setVisible(!1),this._disabledImage&&this._disabledImage.setVisible(!1))},setEnabled:function(a){this._isEnabled!=
a&&(cc.MenuItem.prototype.setEnabled.call(this,a),this._updateImagesVisibility())},_updateImagesVisibility:function(){var a=this._normalImage,c=this._selectedImage,d=this._disabledImage;this._isEnabled?(a&&a.setVisible(!0),c&&c.setVisible(!1),d&&d.setVisible(!1)):d?(a&&a.setVisible(!1),c&&c.setVisible(!1),d&&d.setVisible(!0)):(a&&a.setVisible(!0),c&&c.setVisible(!1))}});
cc.MenuItemSprite.create=function(a,c,d,e,f){var g=arguments.length;a=arguments[0];c=arguments[1];var h,k,m,n=new cc.MenuItemSprite;5==g?(h=arguments[2],m=arguments[3],k=arguments[4]):4==g&&"function"===typeof arguments[3]?(h=arguments[2],m=arguments[3]):4==g&&"function"===typeof arguments[2]?(k=arguments[3],m=arguments[2]):2>=g&&(h=arguments[2]);n.initWithNormalSprite(a,c,h,m,k);return n};
cc.MenuItemImage=cc.MenuItemSprite.extend({setNormalSpriteFrame:function(a){this.setNormalImage(cc.Sprite.createWithSpriteFrame(a))},setSelectedSpriteFrame:function(a){this.setSelectedImage(cc.Sprite.createWithSpriteFrame(a))},setDisabledSpriteFrame:function(a){this.setDisabledImage(cc.Sprite.createWithSpriteFrame(a))},initWithNormalImage:function(a,c,d,e,f){var g=null,h=null,k=null;a&&(g=cc.Sprite.create(a));c&&(h=cc.Sprite.create(c));d&&(k=cc.Sprite.create(d));return this.initWithNormalSprite(g,
h,k,e,f)}});cc.MenuItemImage.create=function(a,c,d,e,f){if(void 0===a)return cc.MenuItemImage.create(null,null,null,null,null);if(void 0===e)return cc.MenuItemImage.create(a,c,null,d,null);if(void 0===f)return cc.MenuItemImage.create(a,c,null,d,e);var g=new cc.MenuItemImage;return g.initWithNormalImage(a,c,d,e,f)?g:null};
cc.MenuItemToggle=cc.MenuItem.extend({_selectedIndex:0,_subItems:null,_opacity:null,_color:null,ctor:function(){cc.MenuItem.prototype.ctor.call(this);this._selectedIndex=0;this._subItems=[];this._opacity=0;this._color=cc.white()},getOpacity:function(){return this._opacity},setOpacity:function(a){this._opacity=a;if(this._subItems&&0<this._subItems.length)for(var c=0;c<this._subItems.length;c++)this._subItems[c].setOpacity(a)},getColor:function(){return this._color},setColor:function(a){this._color=
a;if(this._subItems&&0<this._subItems.length)for(var c=0;c<this._subItems.length;c++)this._subItems[c].setColor(a)},getSelectedIndex:function(){return this._selectedIndex},setSelectedIndex:function(a){if(a!=this._selectedIndex){this._selectedIndex=a;(a=this.getChildByTag(cc.CURRENT_ITEM))&&a.removeFromParent(!1);a=this._subItems[this._selectedIndex];this.addChild(a,0,cc.CURRENT_ITEM);var c=a.getContentSize();this.setContentSize(c);a.setPosition(c.width/2,c.height/2)}},getSubItems:function(){return this._subItems},
setSubItems:function(a){this._subItems=a},initWithItems:function(a){var c=a.length;"function"===typeof a[a.length-2]?(this.initWithCallback(a[a.length-2],a[a.length-1]),c-=2):"function"===typeof a[a.length-1]?(this.initWithCallback(a[a.length-1],null),c-=1):this.initWithCallback(null,null);for(var d=this._subItems,e=d.length=0;e<c;e++)a[e]&&d.push(a[e]);this._selectedIndex=cc.UINT_MAX;this.setSelectedIndex(0);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},addSubItem:function(a){this._subItems.push(a)},
activate:function(){this._isEnabled&&this.setSelectedIndex((this._selectedIndex+1)%this._subItems.length);cc.MenuItem.prototype.activate.call(this)},selected:function(){cc.MenuItem.prototype.selected.call(this);this._subItems[this._selectedIndex].selected()},unselected:function(){cc.MenuItem.prototype.unselected.call(this);this._subItems[this._selectedIndex].unselected()},setEnabled:function(a){if(this._isEnabled!=a){cc.MenuItem.prototype.setEnabled.call(this,a);var c=this._subItems;if(c&&0<c.length)for(var d=
0;d<c.length;d++)c[d].setEnabled(a)}},selectedItem:function(){return this._subItems[this._selectedIndex]},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.setSelectedIndex(this._selectedIndex)}});cc.MenuItemToggle.create=function(){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");var a=new cc.MenuItemToggle;a.initWithItems(arguments);return a};cc.MENU_STATE_WAITING=0;cc.MENU_STATE_TRACKING_TOUCH=1;cc.MENU_HANDLER_PRIORITY=-128;cc.DEFAULT_PADDING=5;
cc.Menu=cc.LayerRGBA.extend({_color:null,_enabled:!1,_opacity:0,_selectedItem:null,_state:-1,ctor:function(){cc.LayerRGBA.prototype.ctor.call(this);this._color=cc.white();this._enabled=!1;this._opacity=255;this._selectedItem=null;this._state=-1},getColor:function(){return this._color},setColor:function(a){this._color=a;var c=this._children;if(c&&0<c.length)for(var d=0;d<c.length;d++)c[d].setColor(a)},getOpacity:function(){return this._opacity},setOpacity:function(a){this._opacity=a;var c=this._children;
if(c&&0<c.length)for(var d=0;d<c.length;d++)c[d].setOpacity(a)},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a},initWithItems:function(a){var c=[];if(a)for(var d=0;d<a.length;d++)a[d]&&c.push(a[d]);return this.initWithArray(c)},initWithArray:function(a){if(this.init()){this.setTouchPriority(cc.MENU_HANDLER_PRIORITY);this.setTouchMode(cc.TOUCH_ONE_BY_ONE);this.setTouchEnabled(!0);this._enabled=!0;var c=cc.Director.getInstance().getWinSize();this.ignoreAnchorPointForPosition(!0);
this.setAnchorPoint(0.5,0.5);this.setContentSize(c);this.setPosition(c.width/2,c.height/2);if(a)for(c=0;c<a.length;c++)this.addChild(a[c],c);this._selectedItem=null;this._state=cc.MENU_STATE_WAITING;this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0}return!1},addChild:function(a,c,d){if(!(a instanceof cc.MenuItem))throw"cc.Menu.addChild() : Menu only supports MenuItem objects as children";cc.Layer.prototype.addChild.call(this,a,c,d)},alignItemsVertically:function(){this.alignItemsVerticallyWithPadding(cc.DEFAULT_PADDING)},
alignItemsVerticallyWithPadding:function(a){var c=-a,d=this._children,e,f,g,h;if(d&&0<d.length){f=0;for(e=d.length;f<e;f++)c+=d[f].getContentSize().height*d[f].getScaleY()+a;var k=c/2;f=0;for(e=d.length;f<e;f++)h=d[f],g=h.getContentSize().height,c=h.getScaleY(),h.setPosition(0,k-g*c/2),k-=g*c+a}},alignItemsHorizontally:function(){this.alignItemsHorizontallyWithPadding(cc.DEFAULT_PADDING)},alignItemsHorizontallyWithPadding:function(a){var c=-a,d=this._children,e,f,g,h;if(d&&0<d.length){e=0;for(f=d.length;e<
f;e++)c+=d[e].getContentSize().width*d[e].getScaleX()+a;var k=-c/2;e=0;for(f=d.length;e<f;e++)h=d[e],c=h.getScaleX(),g=d[e].getContentSize().width,h.setPosition(k+g*c/2,0),k+=g*c+a}},alignItemsInColumns:function(){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var a=[],c=0;c<arguments.length;c++)a.push(arguments[c]);var d=-5,e=0,f=0,g=0,h,k,m,n=this._children;if(n&&0<n.length)for(c=0,m=n.length;c<m;c++)e>=a.length||!(h=
a[e])||(k=n[c].getContentSize().height,f=f>=k||isNaN(k)?f:k,++g,g>=h&&(d+=f+5,f=g=0,++e));var p=cc.Director.getInstance().getWinSize(),q=h=f=e=0,s=0,d=d/2;if(n&&0<n.length)for(c=0,m=n.length;c<m;c++){var r=n[c];0==h&&(h=a[e],s=q=p.width/(1+h));k=r.getContentSize().height;f=f>=k||isNaN(k)?f:k;r.setPosition(s-p.width/2,d-k/2);s+=q;++g;g>=h&&(d-=f+5,f=h=g=0,++e)}},alignItemsInRows:function(){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");
var a=[],c;for(c=0;c<arguments.length;c++)a.push(arguments[c]);var d=[],e=[],f=-10,g=-5,h=0,k=0,m=0,n,p,q,s,r,t=this._children;if(t&&0<t.length)for(c=0,q=t.length;c<q;c++)(p=t[c],h>=a.length||!(n=a[h]))||(r=p.getContentSize(),s=r.width,k=k>=s||isNaN(s)?k:s,g+=r.height+5,++m,m>=n&&(d.push(k),e.push(g),f+=k+10,k=m=0,g=-5,++h));g=cc.Director.getInstance().getWinSize();n=k=h=0;var f=-f/2,u=0;if(t&&0<t.length)for(c=0,q=t.length;c<q;c++)p=t[c],0==n&&(n=a[h],u=e[h]),r=p.getContentSize(),s=r.width,k=k>=s||
isNaN(s)?k:s,p.setPosition(f+d[h]/2,u-g.height/2),u-=r.height+10,++m,m>=n&&(f+=k+5,k=n=m=0,++h)},registerWithTouchDispatcher:function(){cc.registerTargetedDelegate(this.getTouchPriority(),!0,this)},removeChild:function(a,c){null!=a&&(a instanceof cc.MenuItem?(this._selectedItem==a&&(this._selectedItem=null),cc.Node.prototype.removeChild.call(this,a,c)):cc.log("cc.Menu.removeChild():Menu only supports MenuItem objects as children"))},onTouchBegan:function(a,c){if(this._state!=cc.MENU_STATE_WAITING||
!this._visible||!this._enabled)return!1;for(var d=this._parent;null!=d;d=d.getParent())if(!d.isVisible())return!1;return(this._selectedItem=this._itemForTouch(a))?(this._state=cc.MENU_STATE_TRACKING_TOUCH,this._selectedItem.selected(),!0):!1},onTouchEnded:function(a,c){this._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchEnded(): invalid state"):(this._selectedItem&&(this._selectedItem.unselected(),this._selectedItem.activate()),this._state=cc.MENU_STATE_WAITING)},onTouchCancelled:function(a,
c){this._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchCancelled(): invalid state"):(this._selectedItem&&this._selectedItem.unselected(),this._state=cc.MENU_STATE_WAITING)},onTouchMoved:function(a,c){if(this._state!==cc.MENU_STATE_TRACKING_TOUCH)cc.log("cc.Menu.onTouchMoved(): invalid state");else{var d=this._itemForTouch(a);d!=this._selectedItem&&(this._selectedItem&&this._selectedItem.unselected(),(this._selectedItem=d)&&this._selectedItem.selected())}},onExit:function(){this._state==
cc.MENU_STATE_TRACKING_TOUCH&&(this._selectedItem&&(this._selectedItem.unselected(),this._selectedItem=null),this._state=cc.MENU_STATE_WAITING);cc.Layer.prototype.onExit.call(this)},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_itemForTouch:function(a){a=a.getLocation();var c=this._children,d;if(c&&0<c.length)for(var e=0;e<c.length;e++)if(d=c[e],d.isVisible()&&d.isEnabled()){var f=d.convertToNodeSpace(a),g=d.rect();g.x=0;g.y=0;if(cc.rectContainsPoint(g,f))return d}return null},
setHandlerPriority:function(a){cc.Director.getInstance().getTouchDispatcher().setPriority(a,this)}});cc.Menu.create=function(a){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");var c=new cc.Menu;if(0==arguments.length)c.initWithItems(null,null);else if(1==arguments.length&&arguments[0]instanceof Array)return c.initWithArray(arguments[0]),c;c.initWithItems(arguments);return c};cc.TGA_OK=0;cc.TGA_ERROR_FILE_OPEN=1;cc.TGA_ERROR_READING_FILE=2;cc.TGA_ERROR_INDEXED_COLOR=3;cc.TGA_ERROR_MEMORY=4;cc.TGA_ERROR_COMPRESSED_FILE=5;cc.ImageTGA=function(a,c,d,e,f,g,h){this.status=a||0;this.type=c||0;this.pixelDepth=d||0;this.width=e||0;this.height=f||0;this.imageData=g||[];this.flipped=h||0};
cc.tgaLoadHeader=function(a,c,d){var e=2;if(e+1>c)return!1;a=new cc.BinaryStreamReader(a);a.setOffset(e);d.type=a.readByte();e+=10;if(e+4+1>c)return!1;a.setOffset(e);d.width=a.readUnsignedShort();d.height=a.readUnsignedInteger();d.pixelDepth=a.readByte();if(e+5+1>c)return!1;c=a.readByte();d.flipped=0;c&32&&(d.flipped=1);return!0};
cc.tgaLoadImageData=function(a,c,d){var e,f;e=0|d.pixelDepth/2;f=d.height*d.width*e;if(18+f>c)return!1;d.imageData=cc.__getSubArray(a,18,18+f);if(3<=e)for(a=0;a<f;a+=e)c=d.imageData[a],d.imageData[a]=d.imageData[a+2],d.imageData[a+2]=c;return!0};
cc.tgaLoad=function(a){a=cc.FileUtils.getInstance().getFileData(a,"rb");var c=a.length;if(null==a)return null;var d=new cc.ImageTGA;if(!cc.tgaLoadHeader(a,c,d))return d.status=cc.TGA_ERROR_MEMORY,d;if(1===d.type)return d.status=cc.TGA_ERROR_INDEXED_COLOR,d;if(2!=d.type&&3!=d.type&&10!=d.type)return d.status=cc.TGA_ERROR_COMPRESSED_FILE,d;var e=!1,e=10==d.type?cc.tgaLoadRLEImageData(a,c,d):cc.tgaLoadImageData(a,c,d);if(!e)return d.status=cc.TGA_ERROR_READING_FILE,d;d.status=cc.TGA_OK;d.flipped&&(cc.tgaFlipImage(d),
d.flipped&&(d.status=cc.TGA_ERROR_MEMORY));return d};cc.tgaRGBtogreyscale=function(a){var c,d;if(8!==a.pixelDepth){var e=a.pixelDepth/8,f=new Uint8Array(a.height*a.width);if(null!==f){for(d=c=0;d<a.width*a.height;c+=e,d++)f[d]=0.3*a.imageData[c]+0.59*a.imageData[c+1]+0.11*a.imageData[c+2];a.pixelDepth=8;a.type=3;a.imageData=f}}};cc.tgaDestroy=function(a){a&&(a.imageData=null)};
cc.tgaLoadRLEImageData=function(a,c,d){var e,f,g,h=0,k=0,m=0,n=[],p=0,q=18;e=d.pixelDepth/8;f=d.height*d.width;for(g=0;g<f;g++){if(0!=p)p--,k=0!=m;else{if(q+1>c)break;p=a[q];q+=1;(m=p&128)&&(p-=128);k=0}if(!k){if(q+e>c)break;n=cc.__getSubArray(a,q,q+e);q+=e;3<=e&&(k=n[0],n[0]=n[2],n[2]=k)}for(k=0;k<e;k++)d.imageData[h+k]=n[k];h+=e}return!0};
cc.tgaFlipImage=function(a){for(var c=a.pixelDepth/8*a.width,d=0;d<a.height/2;d++){var e=cc.__getSubArray(a.imageData,d*c,d*c+c);cc.__setDataToArray(cc.__getSubArray(a.imageData,(a.height-(d+1))*c,c),a.imageData,d*c);cc.__setDataToArray(e,a.imageData,(a.height-(d+1))*c)}a.flipped=0};cc.__getSubArray=function(a,c,d){return a instanceof Array?a.slice(c,d):a.subarray(c,d)};cc.__setDataToArray=function(a,c,d){for(var e=0;e<a.length;e++)c[d+e]=a[e]};
cc.BinaryStreamReader=cc.Class.extend({_binaryData:null,_offset:0,ctor:function(a){this._binaryData=a},setBinaryData:function(a){this._binaryData=a;this._offset=0},getBinaryData:function(){return this._binaryData},_checkSize:function(a){if(!(this._offset+Math.ceil(a/8)<this._data.length))throw Error("Index out of bound");},_decodeFloat:function(a,c){var d=a+c+1,e=d>>3;this._checkSize(d);var d=Math.pow(2,c-1)-1,f=this._readBits(a+c,1,e),g=this._readBits(a,c,e),h=0,k=2,m=0;do for(var n=this._readByte(++m,
e),p=a%8||8,q=1<<p;q>>=1;)n&q&&(h+=1/k),k*=2;while(a-=p);this._offset+=e;return g==(d<<1)+1?h?NaN:f?-Infinity:Infinity:(1+-2*f)*(g||h?g?Math.pow(2,g-d)*(1+h):Math.pow(2,-d+1)*h:0)},_readByte:function(a,c){return this._data[this._offset+c-a-1]},_decodeInt:function(a,c){var d=this._readBits(0,a,a/8),e=Math.pow(2,a);this._offset+=a/8;return c&&d>=e/2?d-e:d},_shl:function(a,c){for(++c;--c;a=1073741824==((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+2147483648);return a},_readBits:function(a,c,d){var e=
(a+c)%8,f=a%8,g=d-(a>>3)-1;a=d+(-(a+c)>>3);var h=g-a;c=this._readByte(g,d)>>f&(1<<(h?8-f:c))-1;for(h&&e&&(c+=(this._readByte(a++,d)&(1<<e)-1)<<(h--<<3)-f);h;)c+=this._shl(this._readByte(a++,d),(h--<<3)-f);return c},readInteger:function(){return this._decodeInt(32,!0)},readUnsignedInteger:function(){return this._decodeInt(32,!1)},readSingle:function(){return this._decodeFloat(23,8)},readShort:function(){return this._decodeInt(16,!0)},readUnsignedShort:function(){return this._decodeInt(16,!1)},readByte:function(){var a=
this._data[this._offset];this._offset+=1;return a},readData:function(a,c){return this._binaryData instanceof Array?this._binaryData.slice(a,c):this._binaryData.subarray(a,c)},setOffset:function(a){this._offset=a},getOffset:function(){return this._offset}});cc.TMX_ORIENTATION_ORTHO=0;cc.TMX_ORIENTATION_HEX=1;cc.TMX_ORIENTATION_ISO=2;
cc.TMXTiledMap=cc.NodeRGBA.extend({_mapSize:null,_tileSize:null,_properties:null,_objectGroups:null,_mapOrientation:null,_tileProperties:null,ctor:function(){cc.Node.prototype.ctor.call(this);this._mapSize=cc.SizeZero();this._tileSize=cc.SizeZero();this._tileProperties=this._mapOrientation=this._objectGroups=this._properties=null},getMapSize:function(){return cc.size(this._mapSize.width,this._mapSize.height)},setMapSize:function(a){this._mapSize.width=a.width;this._mapSize.height=a.height},getTileSize:function(){return cc.size(this._tileSize.width,
this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},getMapOrientation:function(){return this._mapOrientation},setMapOrientation:function(a){this._mapOrientation=a},getObjectGroups:function(){return this._objectGroups},setObjectGroups:function(a){this._objectGroups=a},getProperties:function(){return this._properties},setProperties:function(a){this._properties=a},initWithTMXFile:function(a,c){if(!a||0==a.length)throw"cc.TMXTiledMap.initWithTMXFile(): tmxFile should be non-null or non-empty string.";
this.setContentSize(0,0);var d=cc.TMXMapInfo.create(a,c);if(!d)return!1;var e=d.getTilesets();e&&0!==e.length||cc.log("cc.TMXTiledMap.initWithTMXFile(): Map not found. Please check the filename.");this._buildWithMapInfo(d);return!0},initWithXML:function(a,c){this.setContentSize(0,0);var d=cc.TMXMapInfo.createWithXML(a,c),e=d.getTilesets();e&&0!==e.length||cc.log("cc.TMXTiledMap.initWithXML(): Map not found. Please check the filename.");this._buildWithMapInfo(d);return!0},_buildWithMapInfo:function(a){this._mapSize=
a.getMapSize();this._tileSize=a.getTileSize();this._mapOrientation=a.getOrientation();this._objectGroups=a.getObjectGroups();this._properties=a.getProperties();this._tileProperties=a.getTileProperties();var c=0,d=a.getLayers();if(d)for(var e=null,f=0,g=d.length;f<g;f++)if((e=d[f])&&e.visible){e=this._parseLayer(e,a);this.addChild(e,c,c);var e=e.getContentSize(),h=this.getContentSize();this.setContentSize(cc.size(Math.max(h.width,e.width),Math.max(h.height,e.height)));c++}},allLayers:function(){for(var a=
[],c=this._children,d=0,e=c.length;d<e;d++){var f=c[d];f&&f instanceof cc.TMXLayer&&a.push(f)}return a},getLayer:function(a){if(!a||0===a.length)throw"cc.TMXTiledMap.getLayer(): layerName should be non-null or non-empty string.";for(var c=this._children,d=0;d<c.length;d++){var e=c[d];if(e&&e.getLayerName()==a)return e}return null},getObjectGroup:function(a){if(!a||0===a.length)throw"cc.TMXTiledMap.getObjectGroup(): groupName should be non-null or non-empty string.";if(this._objectGroups)for(var c=
0;c<this._objectGroups.length;c++){var d=this._objectGroups[c];if(d&&d.getGroupName()==a)return d}return null},getProperty:function(a){return this._properties[a.toString()]},propertiesForGID:function(a){return this._tileProperties[a]},_parseLayer:function(a,c){var d=this._tilesetForLayer(a,c),d=cc.TMXLayer.create(d,a,c);a.ownTiles=!1;d.setupTiles();return d},_tilesetForLayer:function(a,c){var d=a._layerSize,e=c.getTilesets();if(e)for(var f=e.length-1;0<=f;f--){var g=e[f];if(g)for(var h=0;h<d.height;h++)for(var k=
0;k<d.width;k++){var m=a._tiles[k+d.width*h];if(0!=m&&(m&cc.TMX_TILE_FLIPPED_MASK)>>>0>=g.firstGid)return g}}cc.log("cocos2d: Warning: TMX Layer "+a.name+" has no tiles");return null}});cc.TMXTiledMap.create=function(a,c){var d=new cc.TMXTiledMap;return d.initWithTMXFile(a,c)?d:null};cc.TMXTiledMap.createWithXML=function(a,c){var d=new cc.TMXTiledMap;return d.initWithXML(a,c)?d:null};cc.TMX_LAYER_ATTRIB_NONE=1;cc.TMX_LAYER_ATTRIB_BASE64=2;cc.TMX_LAYER_ATTRIB_GZIP=4;cc.TMX_LAYER_ATTRIB_ZLIB=8;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.PointZero()},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.SizeZero();this.imageSize=cc.SizeZero()},rectForGID:function(a){var c=cc.RectZero();c._size=this._tileSize;a&=cc.TMX_TILE_FLIPPED_MASK;a-=parseInt(this.firstGid,10);var d=parseInt((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing),10);c._origin.x=parseInt(a%d*(this._tileSize.width+this.spacing)+this.margin,10);c._origin.y=
parseInt(parseInt(a/d,10)*(this._tileSize.height+this.spacing)+this.margin,10);return c}});
cc.TMXMapInfo=cc.SAXParser.extend({_orientation:null,_mapSize:null,_tileSize:null,_layers:null,_tileSets:null,_objectGroups:null,_parentElement:null,_parentGID:null,_layerAttribs:0,_storingCharacters:!1,_properties:null,_TMXFileName:null,_currentString:null,_tileProperties:null,_resources:"",_currentFirstGID:0,ctor:function(){this._mapSize=cc.SizeZero();this._tileSize=cc.SizeZero();this._layers=[];this._tileSets=[];this._objectGroups=[];this._properties=[];this._tileProperties={};this._currentFirstGID=
0},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},getTileSize:function(){return cc.size(this._tileSize.width,this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},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._layerAttribs},setLayerAttribs:function(a){this._layerAttribs=
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,c){this._internalInit(a,c);return this.parseXMLFile(this._TMXFileName)},initWithXML:function(a,c){this._internalInit(null,c);return this.parseXMLString(a)},parseXMLFile:function(a,c){c=c||!1;a=cc.FileUtils.getInstance().fullPathForFilename(a);var d,e,
f=cc.SAXParser.getInstance().tmxParse(a,c).documentElement;d=f.getAttribute("version");e=f.getAttribute("orientation");if("map"==f.nodeName&&("1.0"!=d&&null!==d&&cc.log("cocos2d: TMXFormat: Unsupported TMX version:"+d),"orthogonal"==e?this.setOrientation(cc.TMX_ORIENTATION_ORTHO):"isometric"==e?this.setOrientation(cc.TMX_ORIENTATION_ISO):"hexagonal"==e?this.setOrientation(cc.TMX_ORIENTATION_HEX):null!==e&&cc.log("cocos2d: TMXFomat: Unsupported orientation:"+this.getOrientation()),d=cc.size(0,0),d.width=
parseFloat(f.getAttribute("width")),d.height=parseFloat(f.getAttribute("height")),this.setMapSize(d),d=cc.size(0,0),d.width=parseFloat(f.getAttribute("tilewidth")),d.height=parseFloat(f.getAttribute("tileheight")),this.setTileSize(d),e=f.querySelectorAll("map \x3e properties \x3e  property"))){var g={};for(d=0;d<e.length;d++)g[e[d].getAttribute("name")]=e[d].getAttribute("value");this.setProperties(g)}e=f.getElementsByTagName("tileset");"map"!==f.nodeName&&(e=[],e.push(f));for(d=0;d<e.length;d++){var h=
e[d];if(g=h.getAttribute("source"))this.parseXMLFile(cc.FileUtils.getInstance().fullPathFromRelativeFile(g,c?this._resources+"/":a));else{g=new cc.TMXTilesetInfo;g.name=h.getAttribute("name")||"";g.firstGid=parseInt(h.getAttribute("firstgid"))||0;g.spacing=parseInt(h.getAttribute("spacing"))||0;g.margin=parseInt(h.getAttribute("margin"))||0;var k=cc.size(0,0);k.width=parseFloat(h.getAttribute("tilewidth"));k.height=parseFloat(h.getAttribute("tileheight"));g._tileSize=k;h=h.getElementsByTagName("image")[0].getAttribute("source");
k=-1;this._TMXFileName&&(k=this._TMXFileName.lastIndexOf("/"));-1!==k?(k=this._TMXFileName.substr(0,k+1),g.sourceImage=k+h):g.sourceImage=this._resources+(this._resources?"/":"")+h;this.setTilesets(g)}}if(g=f.querySelectorAll("tile"))for(d=0;d<g.length;d++)if(e=g[d],this.setParentGID(parseInt(this._tileSets[0].firstGid)+parseInt(e.getAttribute("id")||0)),h=e.querySelectorAll("properties \x3e property")){k={};for(e=0;e<h.length;e++){var m=h[e].getAttribute("name");k[m]=h[e].getAttribute("value")}this._tileProperties[this.getParentGID()]=
k}if(g=f.getElementsByTagName("layer"))for(d=0;d<g.length;d++){k=g[d];m=k.getElementsByTagName("data")[0];h=new cc.TMXLayerInfo;h.name=k.getAttribute("name");e=cc.size(0,0);e.width=parseFloat(k.getAttribute("width"));e.height=parseFloat(k.getAttribute("height"));h._layerSize=e;e=k.getAttribute("visible");h.visible="0"!=e;e=k.getAttribute("opacity")||1;h._opacity=e?parseInt(255*parseFloat(e)):255;h.offset=cc.p(parseFloat(k.getAttribute("x"))||0,parseFloat(k.getAttribute("y"))||0);var n="";for(e=0;e<
m.childNodes.length;e++)n+=m.childNodes[e].nodeValue;n=n.trim();e=m.getAttribute("compression");var p=m.getAttribute("encoding");if(e&&"gzip"!==e&&"zlib"!==e)return cc.log("cc.TMXMapInfo.parseXMLFile(): unsupported compression method"),null;switch(e){case "gzip":h._tiles=cc.unzipBase64AsArray(n,4);break;case "zlib":e=new Zlib.Inflate(cc.Codec.Base64.decodeAsArray(n,1));h._tiles=cc.uint8ArrayToUint32Array(e.decompress());break;case null:case "":if("base64"==p)h._tiles=cc.Codec.Base64.decodeAsArray(n,
4);else if("csv"===p)for(h._tiles=[],e=n.split(","),m=0;m<e.length;m++)h._tiles.push(parseInt(e[m]));else for(e=m.getElementsByTagName("tile"),h._tiles=[],m=0;m<e.length;m++)h._tiles.push(parseInt(e[m].getAttribute("gid")));break;default:this.getLayerAttribs()==cc.TMX_LAYER_ATTRIB_NONE&&cc.log("cc.TMXMapInfo.parseXMLFile(): Only base64 and/or gzip/zlib maps are supported")}if(k=k.querySelectorAll("properties \x3e property")){m={};for(e=0;e<k.length;e++)m[k[e].getAttribute("name")]=k[e].getAttribute("value");
h.setProperties(m)}this.setLayers(h)}if(g=f.getElementsByTagName("objectgroup"))for(d=0;d<g.length;d++){k=g[d];h=new cc.TMXObjectGroup;h.setGroupName(k.getAttribute("name"));h.setPositionOffset(cc.p(parseFloat(k.getAttribute("x"))*this.getTileSize().width||0,parseFloat(k.getAttribute("y"))*this.getTileSize().height||0));if(m=k.querySelectorAll("objectgroup \x3e properties \x3e property"))for(e=0;e<m.length;e++)n={},n[m[e].getAttribute("name")]=m[e].getAttribute("value"),h.setProperties(n);if(k=k.querySelectorAll("object"))for(e=
0;e<k.length;e++){n=k[e];m={};m.name=n.getAttribute("name")||"";m.type=n.getAttribute("type")||"";m.x=parseInt(n.getAttribute("x")||0)+h.getPositionOffset().x;p=parseInt(n.getAttribute("y")||0)+h.getPositionOffset().y;m.width=parseInt(n.getAttribute("width"))||0;m.height=parseInt(n.getAttribute("height"))||0;m.y=parseInt(this.getMapSize().height*this.getTileSize().height)-p-m.height;if(p=n.querySelectorAll("properties \x3e property"))for(var q=0;q<p.length;q++)m[p[q].getAttribute("name")]=p[q].getAttribute("value");
(p=n.querySelectorAll("polygon"))&&0<p.length&&(p=p[0].getAttribute("points"))&&(m.polygonPoints=this._parsePointsString(p));(n=n.querySelectorAll("polyline"))&&0<n.length&&(n=n[0].getAttribute("points"))&&(m.polylinePoints=this._parsePointsString(n));h.setObjects(m)}this.setObjectGroups(h)}return f},_parsePointsString:function(a){if(!a)return null;var c=[];a=a.split(" ");for(var d=0;d<a.length;d++){var e=a[d].split(",");c.push({x:e[0],y:e[1]})}return c},parseXMLString:function(a){return this.parseXMLFile(a,
!0)},getTileProperties:function(){return this._tileProperties},setTileProperties:function(a){this._tileProperties.push(a)},getCurrentString:function(){return this._currentString},setCurrentString:function(a){this._currentString=a},getTMXFileName:function(){return this._TMXFileName},setTMXFileName:function(a){this._TMXFileName=a},_internalInit:function(a,c){this._tileSets.length=0;this._layers.length=0;this._TMXFileName=a;c&&(this._resources=c);this._objectGroups.length=0;this._properties.length=0;
this._tileProperties.length=0;this._currentString="";this._storingCharacters=!1;this._layerAttribs=cc.TMX_LAYER_ATTRIB_NONE;this._parentElement=cc.TMX_PROPERTY_NONE;this._currentFirstGID=0}});cc.TMXMapInfo.create=function(a,c){var d=new cc.TMXMapInfo;return d.initWithTMXFile(a,c)?d:null};cc.TMXMapInfo.createWithXML=function(a,c){var d=new cc.TMXMapInfo;return d.initWithXML(a,c)?d:null};cc.TMXObjectGroup=cc.Class.extend({_groupName:null,_positionOffset:null,_properties:null,_objects:null,ctor:function(){this._groupName="";this._positionOffset=cc.p(0,0);this._properties=[];this._objects=[]},getPositionOffset:function(){return cc.p(this._positionOffset)},setPositionOffset:function(a){this._positionOffset.x=a.x;this._positionOffset.y=a.y},getProperties:function(){return this._properties},setProperties:function(a){this._properties.push(a)},getGroupName:function(){return this._groupName.toString()},
setGroupName:function(a){this._groupName=a},propertyNamed:function(a){return this._properties[a]},objectNamed:function(a){if(this._objects&&0<this._objects.length)for(var c=this._objects,d=0,e=c.length;d<e;d++){var f=c[d].name;if(f&&f==a)return c[d]}return null},getObjects:function(){return this._objects},setObjects:function(a){this._objects.push(a)}});cc.TMXLayer=cc.SpriteBatchNode.extend({_layerSize:null,_mapTileSize:null,_tiles:null,_tileSet:null,_layerOrientation:null,_properties:null,_layerName:"",_opacity:255,_minGID:null,_maxGID:null,_vertexZvalue:null,_useAutomaticVertexZ:null,_alphaFuncValue:null,_reusedTile:null,_atlasIndexArray:null,_contentScaleFactor:null,_cacheCanvas:null,_cacheContext:null,_cacheTexture:null,_subCacheCanvas:null,_subCacheContext:null,_subCacheCount:0,_subCacheWidth:0,_maxCachePixel:1E7,ctor:function(){cc.SpriteBatchNode.prototype.ctor.call(this);
this._descendants=[];this._layerSize=cc.SizeZero();this._mapTileSize=cc.SizeZero();if(cc.renderContextType===cc.CANVAS){var a=cc.canvas,c=document.createElement("canvas");c.width=a.width;c.height=a.height;this._cacheCanvas=c;this._cacheContext=this._cacheCanvas.getContext("2d");var d=new cc.Texture2D;d.initWithElement(c);d.handleLoadedTexture();this._cacheTexture=d;this.setContentSize(a.width,a.height)}},setContentSize:function(a,c){var d=this._contentSize;cc.Node.prototype.setContentSize.call(this,
a,c);if(cc.renderContextType===cc.CANVAS){var e=this._cacheCanvas,f=cc.CONTENT_SCALE_FACTOR();e.width=0|1.5*d.width*f;e.height=0|1.5*d.height*f;this._cacheContext.translate(0,e.height);d=this._cacheTexture._contentSize;d.width=e.width;d.height=e.height;d=e.width*e.height;if(d>this._maxCachePixel){this._subCacheCanvas||(this._subCacheCanvas=[]);this._subCacheContext||(this._subCacheContext=[]);this._subCacheCount=Math.ceil(d/this._maxCachePixel);d=this._subCacheCanvas;for(f=0;f<this._subCacheCount;f++){d[f]||
(d[f]=document.createElement("canvas"),this._subCacheContext[f]=d[f].getContext("2d"));var g=d[f];g.width=this._subCacheWidth=Math.round(e.width/this._subCacheCount);g.height=e.height}for(f=this._subCacheCount;f<d.length;f++)g.width=0,g.height=0}else this._subCacheCount=0}},getTexture:function(){return cc.renderContextType===cc.CANVAS?this._cacheTexture:cc.SpriteBatchNode.prototype.getTexture.call(this)},visit:null,_visitForCanvas:function(a){var c=a||cc.renderContext;if(this._visible){c.save();this.transform(a);
var d,e=this._children;if(this._cacheDirty){var f=cc.EGLView.getInstance();f._setScaleXYForRenderTexture();var g=this._cacheContext,h=this._cacheCanvas;g.clearRect(0,0,h.width,-h.height);g.save();g.translate(this._anchorPointInPoints.x,-this._anchorPointInPoints.y);if(e)for(this.sortAllChildren(),d=0;d<e.length;d++)e[d]&&e[d].visit(g);g.restore();if(0<this._subCacheCount)for(e=this._subCacheWidth,g=h.height,d=0;d<this._subCacheCount;d++)this._subCacheContext[d].drawImage(h,d*e,0,e,g,0,0,e,g);f._resetScale();
this._cacheDirty=!1}this.draw(a);c.restore()}},draw:null,_drawForCanvas:function(a){a=a||cc.renderContext;var c=0|-this._anchorPointInPoints.x,d=0|-this._anchorPointInPoints.y,e=cc.EGLView.getInstance(),f=this._cacheCanvas;if(f){var g=this._subCacheCount,h=f.height*e._scaleY;if(0<g)for(var f=this._subCacheCanvas,k=0;k<g;k++){var m=f[k];a.drawImage(f[k],0,0,m.width,m.height,c+k*this._subCacheWidth,-(d+h),m.width*e._scaleX,h)}else a.drawImage(f,0,0,f.width,f.height,c,-(d+h),f.width*e._scaleX,h)}},getLayerSize:function(){return cc.size(this._layerSize.width,
this._layerSize.height)},setLayerSize:function(a){this._layerSize.width=a.width;this._layerSize.height=a.height},getMapTileSize:function(){return cc.size(this._mapTileSize.width,this._mapTileSize.height)},setMapTileSize:function(a){this._mapTileSize.width=a.width;this._mapTileSize.height=a.height},getTiles:function(){return this._tiles},setTiles:function(a){this._tiles=a},getTileSet:function(){return this._tileSet},setTileSet:function(a){this._tileSet=a},getLayerOrientation:function(){return this._layerOrientation},
setLayerOrientation:function(a){this._layerOrientation=a},getProperties:function(){return this._properties},setProperties:function(a){this._properties=a},initWithTilesetInfo:function(a,c,d){var e=c._layerSize,f=0.35*parseInt(e.width*e.height)+1,g;a&&(g=cc.TextureCache.getInstance().addImage(a.sourceImage));return this.initWithTexture(g,f)?(this._layerName=c.name,this._layerSize=e,this._tiles=c._tiles,this._minGID=c._minGID,this._maxGID=c._maxGID,this._opacity=c._opacity,this.setProperties(c.getProperties()),
this._contentScaleFactor=cc.Director.getInstance().getContentScaleFactor(),this._tileSet=a,this._mapTileSize=d.getTileSize(),this._layerOrientation=d.getOrientation(),a=this._calculateLayerOffset(c.offset),this.setPosition(cc.POINT_PIXELS_TO_POINTS(a)),this._atlasIndexArray=[],this.setContentSize(cc.SIZE_PIXELS_TO_POINTS(cc.size(this._layerSize.width*this._mapTileSize.width,this._layerSize.height*this._mapTileSize.height))),this._useAutomaticVertexZ=!1,this._vertexZvalue=0,!0):!1},releaseMap:function(){this._tiles&&
(this._tiles=null);this._atlasIndexArray&&(this._atlasIndexArray=null)},getTileAt:function(a){if(!a)throw"cc.TMXLayer.getTileAt(): pos should be non-null";if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw"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.RECT_PIXELS_TO_POINTS(d),c=new cc.Sprite,c.initWithTexture(this.getTexture(),d),c.setBatchNode(this),c.setPosition(this.getPositionAt(a)),c.setVertexZ(this._vertexZForPos(a)),c.setAnchorPoint(0,0),c.setOpacity(this._opacity),a=this._atlasIndexForExistantZ(e),this.addSpriteWithoutQuad(c,a,e));return c},getTileGIDAt:function(a){if(!a)throw"cc.TMXLayer.getTileGIDAt(): pos should be non-null";if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw"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){if(!a)throw"cc.TMXLayer.getTileFlagsAt(): pos should be non-null";if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw"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,c,d){if(!c)throw"cc.TMXLayer.setTileGID(): pos should be non-null";if(c.x>=this._layerSize.width||c.y>=this._layerSize.height||0>c.x||0>c.y)throw"cc.TMXLayer.setTileGID(): invalid position";if(!this._tiles||!this._atlasIndexArray)return cc.log("cc.TMXLayer.setTileGID(): TMXLayer: the tiles map has been released"),null;if(0!==a&&a<this._tileSet.firstGid)return cc.log("cc.TMXLayer.setTileGID(): invalid gid:"+
a),null;d=d||0;this._setNodeDirtyForCache();var e=this.getTileFlagsAt(c),f=this.getTileGIDAt(c);if(f!=a||e!=d)if(e=(a|d)>>>0,0===a)this.removeTileAt(c);else if(0===f)this._insertTileForGID(e,c);else{var f=c.x+c.y*this._layerSize.width,g=this.getChildByTag(f);g?(a=this._tileSet.rectForGID(a),a=cc.RECT_PIXELS_TO_POINTS(a),g.setTextureRect(a,!1,a._size),null!=d&&this._setupTileSprite(g,c,e),this._tiles[f]=e):this._updateTileForGID(e,c)}},removeTileAt:function(a){if(!a)throw"cc.TMXLayer.removeTileAt(): pos should be non-null";
if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw"cc.TMXLayer.removeTileAt(): invalid position";if(!this._tiles||!this._atlasIndexArray)return cc.log("cc.TMXLayer.removeTileAt(): TMXLayer: the tiles map has been released"),null;if(0!==this.getTileGIDAt(a)){cc.renderContextType===cc.CANVAS&&this._setNodeDirtyForCache();var c=0|a.x+a.y*this._layerSize.width;a=this._atlasIndexForExistantZ(c);this._tiles[c]=0;cc.ArrayRemoveObjectAtIndex(this._atlasIndexArray,a);if(c=this.getChildByTag(c))cc.SpriteBatchNode.prototype.removeChild.call(this,
c,!0);else if(cc.renderContextType===cc.WEBGL&&this._textureAtlas.removeQuadAtIndex(a),this._children)for(var c=this._children,d=0,e=c.length;d<e;d++){var f=c[d];if(f){var g=f.getAtlasIndex();g>=a&&f.setAtlasIndex(g-1)}}}},getPositionAt:function(a){var c=cc.PointZero();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.POINT_PIXELS_TO_POINTS(c)},
getProperty:function(a){return this._properties[a]},setupTiles:function(){cc.renderContextType===cc.CANVAS?this._tileSet.imageSize=this._originalTexture.getContentSizeInPixels():(this._tileSet.imageSize=this._textureAtlas.getTexture().getContentSizeInPixels(),this._textureAtlas.getTexture().setAliasTexParameters());this._parseInternalProperties();cc.renderContextType===cc.CANVAS&&this._setNodeDirtyForCache();for(var a=this._layerSize.height,c=this._layerSize.width,d=0;d<a;d++)for(var e=0;e<c;e++){var f=
this._tiles[e+c*d];0!==f&&(this._appendTileForGID(f,cc.p(e,d)),this._minGID=Math.min(f,this._minGID),this._maxGID=Math.max(f,this._maxGID))}this._maxGID>=this._tileSet.firstGid&&this._minGID>=this._tileSet.firstGid||cc.log("cocos2d:TMX: Only 1 tileset per layer is supported")},addChild:function(a,c,d){cc.log("addChild: is not supported on cc.TMXLayer. Instead use setTileGID or tileAt.")},removeChild:function(a,c){if(a)if(-1===this._children.indexOf(a))cc.log("cc.TMXLayer.removeChild(): Tile does not belong to TMXLayer");
else{cc.renderContextType===cc.CANVAS&&this._setNodeDirtyForCache();var d=a.getAtlasIndex();this._tiles[this._atlasIndexArray[d]]=0;cc.ArrayRemoveObjectAtIndex(this._atlasIndexArray,d);cc.SpriteBatchNode.prototype.removeChild.call(this,a,c)}},getLayerName:function(){return this._layerName.toString()},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 c=cc.PointZero();switch(this._layerOrientation){case cc.TMX_ORIENTATION_ORTHO:c=cc.p(a.x*this._mapTileSize.width,-a.y*this._mapTileSize.height);break;
case cc.TMX_ORIENTATION_ISO:c=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 c},_appendTileForGID:function(a,c){var d=this._tileSet.rectForGID(a),d=cc.RECT_PIXELS_TO_POINTS(d),e=0|c.x+c.y*this._layerSize.width,d=this._reusedTileWithRect(d);this._setupTileSprite(d,c,a);var f=this._atlasIndexArray.length;this.insertQuadFromSprite(d,f);this._atlasIndexArray=
cc.ArrayAppendObjectToIndex(this._atlasIndexArray,e,f);return d},_insertTileForGID:function(a,c){var d=this._tileSet.rectForGID(a),d=cc.RECT_PIXELS_TO_POINTS(d),e=0|c.x+c.y*this._layerSize.width,d=this._reusedTileWithRect(d);this._setupTileSprite(d,c,a);var f=this._atlasIndexForNewZ(e);this.insertQuadFromSprite(d,f);this._atlasIndexArray=cc.ArrayAppendObjectToIndex(this._atlasIndexArray,e,f);if(this._children)for(var g=this._children,h=0,k=g.length;h<k;h++){var m=g[h];if(m){var n=m.getAtlasIndex();
n>=f&&m.setAtlasIndex(n+1)}}this._tiles[e]=a;return d},_updateTileForGID:function(a,c){var d=this._tileSet.rectForGID(a),e=this._contentScaleFactor,d=cc.rect(d.x/e,d.y/e,d.width/e,d.height/e),e=c.x+c.y*this._layerSize.width,d=this._reusedTileWithRect(d);this._setupTileSprite(d,c,a);var f=this._atlasIndexForExistantZ(e);d.setAtlasIndex(f);d.setDirty(!0);d.updateTransform();this._tiles[e]=a;return d},_parseInternalProperties:function(){var a=this.getProperty("cc_vertexz");if(a)if("automatic"==a){this._useAutomaticVertexZ=
!0;var c=this.getProperty("cc_alpha_func"),a=0;c&&(a=parseFloat(c));cc.renderContextType===cc.WEBGL&&(this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST)),c=cc.renderContext.getUniformLocation(this.getShaderProgram().getProgram(),cc.UNIFORM_ALPHA_TEST_VALUE_S),this.getShaderProgram().use(),this.getShaderProgram().setUniformLocationWith1f(c,a))}else this._vertexZvalue=parseInt(a,10)},_setupTileSprite:function(a,c,d){var e=c.x+c.y*this._layerSize.width;
a.setPosition(this.getPositionAt(c));cc.renderContextType===cc.WEBGL?a.setVertexZ(this._vertexZForPos(c)):a.setTag(e);a.setAnchorPoint(0,0);a.setOpacity(this._opacity);cc.renderContextType===cc.WEBGL&&a.setRotation(0);a.setFlippedX(!1);a.setFlippedY(!1);(d&cc.TMX_TILE_DIAGONAL_FLAG)>>>0?(a.setAnchorPoint(0.5,0.5),a.setPosition(this.getPositionAt(c).x+a.getContentSize().height/2,this.getPositionAt(c).y+a.getContentSize().width/2),c=(d&(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG)>>>0)>>>
0,c==cc.TMX_TILE_HORIZONTAL_FLAG?a.setRotation(90):c==cc.TMX_TILE_VERTICAL_FLAG?a.setRotation(270):(c==(cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_HORIZONTAL_FLAG)>>>0?a.setRotation(90):a.setRotation(270),a.setFlippedX(!0))):((d&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0&&a.setFlippedX(!0),(d&cc.TMX_TILE_VERTICAL_FLAG)>>>0&&a.setFlippedY(!0))},_reusedTileWithRect:function(a){cc.renderContextType===cc.WEBGL?(this._reusedTile?(this._reusedTile.setBatchNode(null),this._reusedTile.setTextureRect(a,!1,a._size)):(this._reusedTile=
new cc.Sprite,this._reusedTile.initWithTexture(this.getTexture(),a,!1)),this._reusedTile.setBatchNode(this)):(this._reusedTile=new cc.Sprite,this._reusedTile.initWithTexture(this._textureForCanvas,a,!1),this._reusedTile.setBatchNode(this),this._reusedTile.setParent(this));return this._reusedTile},_vertexZForPos:function(a){var c=0,d=0;if(this._useAutomaticVertexZ)switch(this._layerOrientation){case cc.TMX_ORIENTATION_ISO:d=this._layerSize.width+this._layerSize.height;c=-(d-(a.x+a.y));break;case cc.TMX_ORIENTATION_ORTHO:c=
-(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 c=this._vertexZvalue;return c},_atlasIndexForExistantZ:function(a){var c;if(this._atlasIndexArray)for(var d=this._atlasIndexArray,e=0,f=d.length;e<f&&(c=d[e],c!=a);e++);c||cc.log("cc.TMXLayer._atlasIndexForExistantZ(): TMX atlas index not found. Shall not happen");return e},_atlasIndexForNewZ:function(a){for(var c=this._atlasIndexArray,d=0,e=c.length;d<
e&&!(a<c[d]);d++);return d}});cc.Browser.supportWebGL?(cc.TMXLayer.prototype.draw=cc.SpriteBatchNode.prototype.draw,cc.TMXLayer.prototype.visit=cc.SpriteBatchNode.prototype.visit):(cc.TMXLayer.prototype.draw=cc.TMXLayer.prototype._drawForCanvas,cc.TMXLayer.prototype.visit=cc.TMXLayer.prototype._visitForCanvas);cc.TMXLayer.create=function(a,c,d){var e=new cc.TMXLayer;return e.initWithTilesetInfo(a,c,d)?e:null};cc.PointObject=cc.Class.extend({_ratio:null,_offset:null,_child:null,getRatio:function(){return this._ratio},setRatio:function(a){this._ratio=a},getOffset:function(){return this._offset},setOffset:function(a){this._offset=a},getChild:function(){return this._child},setChild:function(a){this._child=a},initWithCCPoint:function(a,c){this._ratio=a;this._offset=c;this._child=null;return!0}});cc.PointObject.create=function(a,c){var d=new cc.PointObject;d.initWithCCPoint(a,c);return d};
cc.ParallaxNode=cc.NodeRGBA.extend({_lastPosition:null,_parallaxArray:null,getParallaxArray:function(){return this._parallaxArray},setParallaxArray:function(a){this._parallaxArray=a},ctor:function(){cc.NodeRGBA.prototype.ctor.call(this);this._parallaxArray=[];this._lastPosition=cc.p(-100,-100)},addChild:function(a,c,d,e){if(3===arguments.length)cc.log("ParallaxNode: use addChild(child, z, ratio, offset) instead");else{if(!a)throw"cc.ParallaxNode.addChild(): child should be non-null";var f=cc.PointObject.create(d,
e);f.setChild(a);this._parallaxArray.push(f);f=cc.p(this._position.x,this._position.y);f.x=f.x*d.x+e.x;f.y=f.y*d.y+e.y;a.setPosition(f);cc.NodeRGBA.prototype.addChild.call(this,a,c,a.getTag())}},removeChild:function(a,c){for(var d=this._parallaxArray,e=0;e<d.length;e++)if(d[e].getChild()==a){d.splice(e,1);break}cc.NodeRGBA.prototype.removeChild.call(this,a,c)},removeAllChildren:function(a){this._parallaxArray.length=0;cc.NodeRGBA.prototype.removeAllChildren.call(this,a)},visit:function(){var a=this._absolutePosition();
if(!cc.pointEqualToPoint(a,this._lastPosition)){for(var c=this._parallaxArray,d=0,e=c.length;d<e;d++){var f=c[d],g=-a.x+a.x*f.getRatio().x+f.getOffset().x,h=-a.y+a.y*f.getRatio().y+f.getOffset().y;f.getChild().setPosition(g,h)}this._lastPosition=a}cc.NodeRGBA.prototype.visit.call(this)},_absolutePosition:function(){for(var a=this._position,c=this;null!=c.getParent();)c=c.getParent(),a=cc.pAdd(a,c.getPosition());return a}});cc.ParallaxNode.create=function(){return new cc.ParallaxNode};cc=cc||{};
cc.AudioEngine=cc.Class.extend({_audioID:0,_audioIDList:null,_supportedFormat:null,_soundSupported:!1,_effectsVolume:1,_playingMusic:null,_resPath:"",_pausedPlayings:null,ctor:function(){this._audioIDList={};this._supportedFormat=[];this._pausedPlayings=[]},setResPath:function(a){a&&0!=a.length&&(this._resPath="/"==a.substring(a.length-1)?a:a+"/")},_checkCanPlay:function(a){var c=document.createElement("audio");if(c.canPlayType){var d=function(a){a=c.canPlayType(a);return"no"!=a&&""!=a};a.mp3=d("audio/mpeg");
a.mp4=d("audio/mp4");a.m4a=d("audio/x-m4a")||d("audio/aac");a.ogg=d('audio/ogg; codecs\x3d"vorbis"');a.wav=d('audio/wav; codecs\x3d"1"')}else{var d=["mp3","mp4","m4a","ogg","wav"],e;for(e in d)a[d[e]]=!1}},_getPathWithoutExt:function(a){if("string"!=typeof a)return null;var c=a.lastIndexOf(".");return-1!==c?a.substring(0,c):a},_getExtFromFullPath:function(a){var c=a.lastIndexOf(".");return-1!==c?a.substring(c+1,a.length):-1},willPlayMusic:function(){return!1},preloadMusic:function(a,c,d){this.preloadSound(a,
c,d)},preloadEffect:function(a,c,d){this.preloadSound(a,c,d)},isFormatSupported:function(a){for(var c=this._supportedFormat,d=0,e=c.length;d<e;d++)if(c[d]==a)return!0;return!1},getEffectsVolume:function(){return this._effectsVolume}});cc.SimpleSFX=function(a,c){this.audio=a;this.ext=c||".ogg"};
cc.SimpleAudioEngine=cc.AudioEngine.extend({_effectList:null,_soundList:null,_maxAudioInstance:5,_canPlay:!0,_musicListenerBound:null,_musicIsStopped:!1,ctor:function(){cc.AudioEngine.prototype.ctor.call(this);this._effectList={};this._soundList={};this._musicListenerBound=this._musicListener.bind(this);var a=navigator.userAgent;if(/Mobile/.test(a)&&(/iPhone OS/.test(a)||/iPad/.test(a)||/Firefox/.test(a))||/MSIE/.test(a))this._canPlay=!1},init:function(){var a={};this._checkCanPlay(a);var c=["ogg",
"mp3","wav","mp4","m4a"],d=this._supportedFormat,e;for(e in c){var f=c[e];a[f]&&d.push(f)}return this._soundSupported=0<d.length},preloadSound:function(a,c,d){if(this._soundSupported){var e=this._resPath+a,f=this._getExtFromFullPath(a);a=this._getPathWithoutExt(a);if(!this._soundList[a]&&this.isFormatSupported(f)&&this._canPlay){var g=new cc.SimpleSFX;g.ext=f;g.audio=new Audio(e);g.audio.preload="auto";var h=function(){cc.doCallback(c,d);this.removeEventListener("canplaythrough",h,!1);this.removeEventListener("error",
k,!1)},k=function(a){cc.doCallback(c,d,a.srcElement.src);this.removeEventListener("canplaythrough",h,!1);this.removeEventListener("error",k,!1)};g.audio.addEventListener("canplaythrough",h,!1);g.audio.addEventListener("error",k,!1);this._soundList[a]=g;g.audio.load();return}}cc.doCallback(c,d)},playMusic:function(a,c){if(this._soundSupported){var d=this._getPathWithoutExt(a),e=this._getExtFromFullPath(a),f=this._soundList;f[this._playingMusic]&&f[this._playingMusic].audio.pause();this._playingMusic=
d;if(f[this._playingMusic])e=f[this._playingMusic].audio;else{var g=new cc.SimpleSFX;g.ext=e;e=g.audio=new Audio(a);g.audio.preload="auto";f[d]=g;g.audio.load()}e.addEventListener("pause",this._musicListenerBound,!1);e.loop=c||!1;e.play();cc.AudioEngine.isMusicPlaying=!0;this._musicIsStopped=!1}},_musicListener:function(a){cc.AudioEngine.isMusicPlaying=!1;this._soundList[this._playingMusic]&&this._soundList[this._playingMusic].audio.removeEventListener("pause",this._musicListener,!1)},stopMusic:function(a){var c=
this._soundList,d=this._playingMusic;if(c[d]){var e=c[d].audio;e.pause();e.duration&&(e.currentTime=e.duration);a&&delete c[d];cc.AudioEngine.isMusicPlaying=!1;this._musicIsStopped=!0}},pauseMusic:function(){!this._musicIsStopped&&this._soundList[this._playingMusic]&&(this._soundList[this._playingMusic].audio.pause(),cc.AudioEngine.isMusicPlaying=!1)},resumeMusic:function(){if(!this._musicIsStopped&&this._soundList[this._playingMusic]){var a=this._soundList[this._playingMusic].audio;a.play();a.addEventListener("pause",
this._musicListenerBound,!1);cc.AudioEngine.isMusicPlaying=!0}},rewindMusic:function(){if(this._soundList[this._playingMusic]){var a=this._soundList[this._playingMusic].audio;a.currentTime=0;a.play();a.addEventListener("pause",this._musicListenerBound,!1);cc.AudioEngine.isMusicPlaying=!0;this._musicIsStopped=!1}},getMusicVolume:function(){return this._soundList[this._playingMusic]?this._soundList[this._playingMusic].audio.volume:0},setMusicVolume:function(a){this._soundList[this._playingMusic]&&(this._soundList[this._playingMusic].audio.volume=
1<a?1:0>a?0:a)},isMusicPlaying:function(){return cc.AudioEngine.isMusicPlaying},playEffect:function(a,c){if(!this._soundSupported)return null;var d=this._getPathWithoutExt(a),e;e=this._soundList[d]?this._soundList[d].ext:this._getExtFromFullPath(a);var f=this._getEffectList(d),g;if(0<f.length)for(var h=0;h<f.length;h++)if(f[h].ended){g=f[h];g.currentTime=0;window.chrome&&g.load();break}if(!g){if(f.length>=this._maxAudioInstance)return cc.log("Error: "+a+" greater than "+this._maxAudioInstance),null;
g=new Audio(d+"."+e);g.volume=this._effectsVolume;f.push(g)}c&&(g.loop=c);g.play();d=this._audioID++;this._audioIDList[d]=g;return d},setEffectsVolume:function(a){this._effectsVolume=1<a?1:0>a?0:a;var c,d=this._effectList,e;for(e in d)if(a=d[e],0<a.length)for(var f=0;f<a.length;f++)c=a[f],c.volume=this._effectsVolume},pauseEffect:function(a){null!=a&&this._audioIDList[a]&&(a=this._audioIDList[a],a.ended||a.pause())},pauseAllEffects:function(){var a,c,d=this._effectList,e;for(e in d){a=d[e];for(var f=
0;f<a.length;f++)c=a[f],c.ended||c.pause()}},resumeEffect:function(a){null!=a&&this._audioIDList[a]&&(a=this._audioIDList[a],a.ended||a.play())},resumeAllEffects:function(){var a,c,d=this._effectList,e;for(e in d)if(a=d[e],0<a.length)for(var f=0;f<a.length;f++)c=a[f],c.ended||c.play()},stopEffect:function(a){null!=a&&this._audioIDList[a]&&(a=this._audioIDList[a],a.ended||(a.loop=!1,a.duration&&(a.currentTime=a.duration)))},stopAllEffects:function(){var a,c,d=this._effectList,e;for(e in d){a=d[e];
for(var f=0;f<a.length;f++)c=a[f],c.ended||(c.loop=!1,c.duration&&(c.currentTime=c.duration))}},unloadEffect:function(a){if(a){a=this._getPathWithoutExt(a);this._effectList[a]&&delete this._effectList[a];var c,d=this._audioIDList,e;for(e in d)c=d[e],c=this._getPathWithoutExt(c.src),-1<c.indexOf(a)&&(this.stopEffect(e),delete d[e])}},_getEffectList:function(a){var c=this._effectList;c[a]||(c[a]=[]);return c[a]},_pausePlaying:function(){var a=this._pausedPlayings,c=this._soundList,d;!this._musicIsStopped&&
c[this._playingMusic]&&(d=c[this._playingMusic].audio,d.paused||(d.pause(),cc.AudioEngine.isMusicPlaying=!1,a.push(d)));var e=this._effectList,f;for(f in e)for(var c=e[f],g=0;g<c.length;g++)d=c[g],d.ended||d.paused||(d.pause(),a.push(d))},_resumePlaying:function(){var a=this._pausedPlayings,c=this._soundList,d;!this._musicIsStopped&&c[this._playingMusic]&&(d=c[this._playingMusic].audio,-1!==a.indexOf(d)&&(d.play(),d.addEventListener("pause",this._musicListenerBound,!1),cc.AudioEngine.isMusicPlaying=
!0));var e=this._effectList,f;for(f in e)for(var c=e[f],g=0;g<c.length;g++)d=c[g],d.ended||-1===a.indexOf(d)||d.play();a.length=0}});cc.PlayingTask=function(a,c,d,e){this.id=a;this.audio=c;this.isLoop=d||!1;this.status=e||cc.PlayingTaskStatus.stop};cc.PlayingTaskStatus={playing:1,pause:2,stop:3,waiting:4};
cc.SimpleAudioEngineForMobile=cc.SimpleAudioEngine.extend({_playingList:null,_currentTask:null,_isPauseForList:!1,_checkFlag:!0,_audioEndedCallbackBound:null,ctor:function(){cc.SimpleAudioEngine.prototype.ctor.call(this);this._maxAudioInstance=2;this._playingList=[];this._isPauseForList=!1;this._checkFlag=!0;this._audioEndedCallbackBound=this._audioEndCallback.bind(this)},_stopAllEffectsForList:function(){var a,c,d=this._effectList,e;for(e in d){a=d[e];for(var f=0;f<a.length;f++)c=a[f],c.ended||(c.removeEventListener("ended",
this._audioEndedCallbackBound,!1),c.loop=!1,c.duration&&(c.currentTime=c.duration))}this._playingList.length=0;this._currentTask=null},playMusic:function(a,c){if(this._soundSupported){this._stopAllEffectsForList();var d=this._getPathWithoutExt(a),e=this._getExtFromFullPath(a),f=this._soundList;if(f[this._playingMusic]){var g=f[this._playingMusic];g.audio.removeEventListener("pause",this._musicListenerBound,!1);g.audio.pause()}this._playingMusic=d;f[this._playingMusic]?e=f[this._playingMusic].audio:
(g=new cc.SimpleSFX,g.ext=e,e=g.audio=new Audio(a),g.audio.preload="auto",f[d]=g,g.audio.load());e.addEventListener("pause",this._musicListenerBound,!1);e.loop=c||!1;e.play();cc.AudioEngine.isMusicPlaying=!0;this._musicIsStopped=!1}},isMusicPlaying:function(){var a=this._soundList,c=this._playingMusic;return a[c]?(a=a[c].audio,!a.paused&&!a.ended):!1},_musicListener:function(){cc.AudioEngine.isMusicPlaying=!1;this._soundList[this._playingMusic]&&this._soundList[this._playingMusic].audio.removeEventListener("pause",
this._musicListener,!1);this._checkFlag?this._isPauseForList=!1:this._checkFlag=!0},_stopExpiredTask:function(a){for(var c=this._playingList,d=this._audioIDList,e=0;e<c.length;){var f=c[e];if(f.status===cc.PlayingTaskStatus.waiting)if(f.audio.currentTime+a>=f.audio.duration){c.splice(e,1);d[f.id]&&(f=d[f.id],f.ended||(f.removeEventListener("ended",this._audioEndedCallbackBound,!1),f.loop=!1,f.duration&&(f.currentTime=f.duration)));continue}else f.audio.currentTime+=a;e++}},_audioEndCallback:function(){var a=
this._currentTask;this._stopExpiredTask(a.audio.currentTime);a.isLoop?a.audio.play():(a.audio.removeEventListener("ended",this._audioEndedCallbackBound,!1),cc.ArrayRemoveObject(this._playingList,a),(a=this._getNextTaskToPlay())?(this._currentTask=a,a.status=cc.PlayingTaskStatus.playing,a.audio.play()):(this._currentTask=null,this._isPauseForList&&(this._isPauseForList=!1,this.resumeMusic())))},_pushingPlayingTask:function(a){if(!a)throw"cc.SimpleAudioEngineForMobile._pushingPlayingTask(): playingTask should be non-null.";
var c=this._playingList;this._currentTask?(this._currentTask.status=cc.PlayingTaskStatus.waiting,this._currentTask.audio.pause()):this.isMusicPlaying()&&(this._checkFlag=!1,this.pauseMusic(),this._isPauseForList=!0);c.push(a);this._currentTask=a;this._playingAudioTask(a)},_playingAudioTask:function(a){a.audio.addEventListener("ended",this._audioEndedCallbackBound,!1);a.audio.play();a.status=cc.PlayingTaskStatus.playing},_getPlayingTaskFromList:function(a){for(var c=this._playingList,d=0,e=c.length;d<
e;d++)if(c[d].id===a)return c[d];return null},_getNextTaskToPlay:function(){for(var a=this._playingList,c=a.length-1;0<=c;c--){var d=a[c];if(d.status===cc.PlayingTaskStatus.waiting)return d}return null},_playingNextTask:function(){var a=this._currentTask=this._getNextTaskToPlay();a?(a.status=cc.PlayingTaskStatus.playing,a.audio.play()):this._isPauseForList&&(this._isPauseForList=!1,this.resumeMusic())},_deletePlayingTaskFromList:function(a){for(var c=this._playingList,d=0,e=c.length;d<e;d++){var f=
c[d];if(f.id===a){c.splice(d,1);f==this._currentTask&&this._playingNextTask();break}}},_pausePlayingTaskFromList:function(a){for(var c=this._playingList,d=0,e=c.length;d<e;d++){var f=c[d];if(f.id===a){f.status=cc.PlayingTaskStatus.pause;f==this._currentTask&&this._playingNextTask();break}}},_resumePlayingTaskFromList:function(a){for(var c=this._playingList,d=0,e=c.length;d<e;d++){var f=c[d];if(f.id===a){f.status=cc.PlayingTaskStatus.waiting;!this._currentTask&&(a=this._getNextTaskToPlay())&&(this.isMusicPlaying()&&
(this._checkFlag=!1,this.pauseMusic(),this._isPauseForList=!0),a.status=cc.PlayingTaskStatus.playing,a.audio.play());break}}},playEffect:function(a,c){if(!this._soundSupported)return null;var d=this._getPathWithoutExt(a),e;e=this._soundList[d]?this._soundList[d].ext:this._getExtFromFullPath(a);var f=this._getEffectList(d),g;if(0<f.length)for(var h=0;h<f.length;h++)if(f[h].ended){g=f[h];g.currentTime=0;window.chrome&&g.load();break}if(!g){if(f.length>=this._maxAudioInstance)return cc.log("Error: "+
a+" greater than "+this._maxAudioInstance),null;g=new Audio(d+"."+e);g.volume=this._effectsVolume;f.push(g)}d=new cc.PlayingTask(this._audioID++,g,c);this._pushingPlayingTask(d);this._audioIDList[d.id]=g;return d.id},pauseEffect:function(a){if(null!=a){var c=a.toString();this._audioIDList[c]&&(c=this._audioIDList[c],c.ended||c.pause());this._pausePlayingTaskFromList(a)}},pauseAllEffects:function(){var a,c,d=this._effectList,e;for(e in d){a=d[e];for(var f=0;f<a.length;f++)c=a[f],c.ended||c.pause()}a=
this._playingList;c=0;for(d=a.length;c<d;c++)a[c].status=cc.PlayingTaskStatus.pause;this._currentTask=null;this._isPauseForList&&(this._isPauseForList=!1,this.resumeMusic())},resumeEffect:function(a){if(null!=a){if(this._audioIDList[a]){var c=this._audioIDList[a];c.ended||c.play()}this._resumePlayingTaskFromList(a)}},resumeAllEffects:function(){var a,c,d=this._effectList,e;for(e in d)if(a=d[e],0<a.length)for(var f=0;f<a.length;f++)c=a[f],c.ended||c.play();a=this._playingList;c=0;for(d=a.length;c<
d;c++)e=a[c],e.status===cc.PlayingTaskStatus.pause&&(e.status=cc.PlayingTaskStatus.waiting);null==this._currentTask&&(a=this._getNextTaskToPlay())&&(this.isMusicPlaying()&&(this._checkFlag=!1,this.pauseMusic(),this._isPauseForList=!0),a.status=cc.PlayingTaskStatus.playing,a.audio.play())},stopEffect:function(a){if(null!=a){if(this._audioIDList[a]){var c=this._audioIDList[a];c.ended||(c.removeEventListener("ended",this._audioEndedCallbackBound,!1),c.loop=!1,c.duration&&(c.currentTime=c.duration))}this._deletePlayingTaskFromList(a)}},
stopAllEffects:function(){var a,c,d=this._effectList,e;for(e in d){a=d[e];for(var f=0;f<a.length;f++)c=a[f],c.ended||(c.removeEventListener("ended",this._audioEndedCallbackBound,!1),c.loop=!1,c.duration&&(c.currentTime=c.duration))}this._playingList.length=0;this._currentTask=null;this._isPauseForList&&(this._isPauseForList=!1,this.resumeMusic())},_pausePlaying:function(){var a=this._pausedPlayings,c=this._soundList;!this._musicIsStopped&&c[this._playingMusic]&&(c=c[this._playingMusic].audio,c.paused||
(c.pause(),cc.AudioEngine.isMusicPlaying=!1,a.push(c)));this.stopAllEffects()},_resumePlaying:function(){var a=this._pausedPlayings,c=this._soundList;!this._musicIsStopped&&c[this._playingMusic]&&(c=c[this._playingMusic].audio,-1!==a.indexOf(c)&&(c.play(),c.addEventListener("pause",this._musicListenerBound,!1),cc.AudioEngine.isMusicPlaying=!0));a.length=0}});cc.WebAudioSFX=function(a,c,d,e,f){this.key=a;this.sourceNode=c;this.volumeNode=d;this.startTime=e||0;this.pauseTime=f||0;this.isPaused=!1};
cc.WebAudioEngine=cc.AudioEngine.extend({_ctx:null,_audioData:null,_audiosLoading:null,_musicVolume:1,_effects:null,ctor:function(){cc.AudioEngine.prototype.ctor.call(this);this._audioData={};this._audiosLoading={};this._effects={}},init:function(){this._ctx=new (window.AudioContext||window.webkitAudioContext||window.mozAudioContext);var a={};this._checkCanPlay(a);var c=["ogg","mp3","wav","mp4","m4a"],d=this._supportedFormat,e;for(e in c){var f=c[e];a[f]&&d.push(f)}return this._soundSupported=0<d.length},
_fetchData:function(a,c,d){var e=new window.XMLHttpRequest;e.open("GET",this._resPath+a,!0);e.responseType="arraybuffer";var f=this;e.onload=function(){f._ctx.decodeAudioData(e.response,c,d)};e.onerror=d;e.send()},preloadSound:function(a,c,d){if(this._soundSupported){var e=this._getExtFromFullPath(a),f=this._getPathWithoutExt(a);if(this._audioData[f]||this._audiosLoading[f]||!this.isFormatSupported(e))cc.doCallback(c,d);else{this._audiosLoading[f]=!0;var g=this;this._fetchData(a,function(a){g._audioData[f]=
a;delete g._audiosLoading[f];cc.doCallback(c,d)},function(){delete g._audiosLoading[f];cc.doCallback(c,d,a)})}}},_beginSound:function(a,c,d,e){var f=new cc.WebAudioSFX;c=null==c?!1:c;d=null==d?1:d;e=e||0;var g=this._ctx;f.key=a;f.sourceNode=this._ctx.createBufferSource();f.sourceNode.buffer=this._audioData[a];f.sourceNode.loop=c;f.volumeNode=g.createGain?this._ctx.createGain():this._ctx.createGainNode();f.volumeNode.gain.value=d;f.sourceNode.connect(f.volumeNode);f.volumeNode.connect(this._ctx.destination);
f.sourceNode.start?f.sourceNode.start(0,e):f.sourceNode.noteGrainOn?(a=f.sourceNode.buffer.duration,c?f.sourceNode.noteGrainOn(0,e,a):f.sourceNode.noteGrainOn(0,e,a-e)):f.sourceNode.noteOn(0);f.startTime=this._ctx.currentTime-e;f.pauseTime=f.startTime;f.isPaused=!1;return f},_isSoundPlaying:function(a){return 2==a.sourceNode.playbackState},_isSoundPaused:function(a){return this._isSoundPlaying(a)?!1:a.isPaused},isMusicPlaying:function(){return this._playingMusic?this._isSoundPlaying(this._playingMusic):
!1},playMusic:function(a,c){var d=this._getPathWithoutExt(a),e=this._getExtFromFullPath(a);c=c||!1;this._playingMusic&&this.stopMusic();if(this._audioData[d])this._playingMusic=this._beginSound(d,c,this._musicVolume);else if(!this._audiosLoading[d]&&this.isFormatSupported(e)){this._audiosLoading[d]=!0;var f=this;this._fetchData(a,function(e){f._audioData[d]=e;delete f._audiosLoading[d];f.playMusic(a,c)},function(){delete f._audiosLoading[d]})}},_endSound:function(a){a.sourceNode.playbackState&&3==
a.sourceNode.playbackState||(a.sourceNode.stop?a.sourceNode.stop(0):a.sourceNode.noteOff(0))},stopMusic:function(a){var c=this._playingMusic;if(c){var d=c.key;this._endSound(c);this._playingMusic=null;a&&delete this._audioData[d]}},_pauseSound:function(a){a.pauseTime=this._ctx.currentTime;a.isPaused=!0;this._endSound(a)},pauseMusic:function(){this.isMusicPlaying()&&this._pauseSound(this._playingMusic)},_resumeSound:function(a,c){return this._beginSound(a.key,a.sourceNode.loop,c,(a.pauseTime-a.startTime)%
a.sourceNode.buffer.duration)},resumeMusic:function(){var a=this._playingMusic;a&&this._isSoundPaused(a)&&(this._playingMusic=this._resumeSound(a,this.getMusicVolume()))},rewindMusic:function(){var a=this._playingMusic;if(a){var c=a.key,d=a.sourceNode.loop,e=this.getMusicVolume();this._endSound(a);this._playingMusic=this._beginSound(c,d,e)}},getMusicVolume:function(){return this._musicVolume},_setSoundVolume:function(a,c){a.volumeNode.gain.value=c},setMusicVolume:function(a){1<a?a=1:0>a&&(a=0);this.getMusicVolume()!=
a&&(this._musicVolume=a,this._playingMusic&&this._setSoundVolume(this._playingMusic,a))},playEffect:function(a,c){var d=this._getPathWithoutExt(a),e=this._getExtFromFullPath(a),f;c=c||!1;if(this._audioData[d]){e=this._effects;e[d]||(e[d]=[]);for(var e=e[d],g=0,h=e.length;g<h;g++){var k=e[g];if(!this._isSoundPlaying(k)&&!this._isSoundPaused(k))return e[g]=this._beginSound(d,c,this.getEffectsVolume()),f=this._audioID++,this._audioIDList[f]=e[g],f}g=this._beginSound(d,c,this.getEffectsVolume());e.push(g);
f=this._audioID++;this._audioIDList[f]=g;return f}if(!this._audiosLoading[d]&&this.isFormatSupported(e)){this._audiosLoading[d]=!0;var m=this;f=this._audioID++;this._audioIDList[f]=null;this._fetchData(a,function(a){m._audioData[d]=a;delete m._audiosLoading[d];a=m._beginSound(d,c,m.getEffectsVolume());m._audioIDList[f]=a;var e=m._effects;e[d]||(e[d]=[]);e[d].push(a)},function(){delete m._audiosLoading[d];delete m._audioIDList[f]});return f}return null},setEffectsVolume:function(a){1<a?a=1:0>a&&(a=
0);if(this._effectsVolume!=a){this._effectsVolume=a;var c=this._effects,d;for(d in c)for(var e=c[d],f=0,g=e.length;f<g;f++)this._setSoundVolume(e[f],a)}},_pauseSoundList:function(a){for(var c=0,d=a.length;c<d;c++){var e=a[c];e&&this._isSoundPlaying(e)&&this._pauseSound(e)}},pauseEffect:function(a){null!=a&&this._audioIDList[a]&&(a=this._audioIDList[a])&&this._isSoundPlaying(a)&&this._pauseSound(a)},pauseAllEffects:function(){for(var a in this._effects)this._pauseSoundList(this._effects[a])},_resumeSoundList:function(a,
c){for(var d=0,e=a.length;d<e;d++){var f=a[d];this._isSoundPaused(f)&&(a[d]=this._resumeSound(f,c),this._updateEffectsList(f,a[d]))}},resumeEffect:function(a){if(null!=a&&this._audioIDList[a]){var c=this._audioIDList[a];c&&this._isSoundPaused(c)&&(this._audioIDList[a]=this._resumeSound(c,this.getEffectsVolume()),this._updateEffectsList(c,this._audioIDList[a]))}},_updateEffectsList:function(a,c){var d=this._effects,e,f;for(f in d){e=d[f];for(var g=0;g<e.length;g++)e[g]==a&&(e[g]=c)}},resumeAllEffects:function(){var a=
this._effects,c;for(c in a)this._resumeSoundList(a[c],this.getEffectsVolume())},stopEffect:function(a){if(null!=a){var c=this._audioIDList;c[a]&&this._endSound(c[a])}},stopAllEffects:function(){var a=this._effects,c;for(c in a){for(var d=a[c],e=0,f=d.length;e<f;e++)this._endSound(d[e]);delete a[c]}},unloadEffect:function(a){if(a){a=this._getPathWithoutExt(a);if(this._effects[a]){var c=this._effects[a];delete this._effects[a];var d=this._audioIDList,e;for(e in d)-1<c.indexOf(d[e])&&(this.stopEffect(e),
delete d[e])}this._audioData[a]&&delete this._audioData[a]}},_pausePlaying:function(){var a=this._pausedPlayings;this.isMusicPlaying()&&(a.push(this._playingMusic),this._pauseSound(this._playingMusic));var c=this._effects,d;for(d in c)for(var e=c[d],f=0,g=e.length;f<g;f++){var h=e[f];h&&this._isSoundPlaying(h)&&(a.push(h),this._pauseSound(h))}},_resumePlaying:function(){var a=this._pausedPlayings,c=this.getMusicVolume(),d=this._playingMusic;d&&this._isSoundPaused(d)&&-1!=a.indexOf(d)&&(this._playingMusic=
this._resumeSound(d,c));var d=this._effects,e;for(e in d)for(var f=d[e],g=0,h=f.length;g<h;g++){var k=f[g];this._isSoundPaused(k)&&-1!=a.indexOf(k)&&(f[g]=this._resumeSound(k,c),this._updateEffectsList(k,f[g]))}a.length=0}});cc.AudioEngine._instance=null;cc.AudioEngine.isMusicPlaying=!1;
cc.AudioEngine.getInstance=function(){this._instance||(cc.Browser.supportWebAudio?this._instance=new cc.WebAudioEngine:-1!==cc.Browser.multipleAudioWhiteList.indexOf(cc.Browser.type)?this._instance=new cc.SimpleAudioEngine:this._instance=new cc.SimpleAudioEngineForMobile,this._instance.init());return this._instance};cc.AudioEngine.end=function(){this._instance&&(this._instance.stopMusic(),this._instance.stopAllEffects());this._instance=null};cc.UserDefault=cc.Class.extend({_db:null,init:function(){this._db=this._getLocalStorage();return!0},_getLocalStorage:function(){try{if(sys.localStorage)return sys.localStorage}catch(a){}},_getWebSqlDatabase:function(){},getBoolForKey:function(a,c){cc.log("getBoolForKey is deprecated. Use sys.localStorage.getItem instead.");var d=this._getValueForKey(a);return"true"==d?!0:"false"==d?!1:d?Boolean(d):c||!1},getIntegerForKey:function(a,c){cc.log("getIntegerForKey is deprecated. Use sys.localStorage.getItem instead.");
var d=this._getValueForKey(a),e=c||0;return d?parseInt(d):e},getFloatForKey:function(a,c){cc.log("getFloatForKey is deprecated. Use sys.localStorage.getItem instead.");var d=this._getValueForKey(a),e=c||0;return d?parseFloat(d):e},getDoubleForKey:function(a,c){cc.log("getDoubleForKey is deprecated. Use sys.localStorage.getItem instead.");return this.getFloatForKey(a,c)},getStringForKey:function(a,c){cc.log("getStringForKey is deprecated. Use sys.localStorage.getItem instead.");var d=this._getValueForKey(a);
return d?String(d):c||""},_getValueForKey:function(a){var c;this._db&&(c=this._db.getItem(a));return c},setBoolForKey:function(a,c){cc.log("setBoolForKey is deprecated. Use sys.localStorage.setItem instead.");this.setStringForKey(a,String(c))},setIntegerForKey:function(a,c){cc.log("setIntegerForKey is deprecated. Use sys.localStorage.setItem instead.");a&&this._setValueForKey(a,parseInt(c))},setFloatForKey:function(a,c){cc.log("setFloatForKey is deprecated. Use sys.localStorage.setItem instead.");
a&&this._setValueForKey(a,parseFloat(c))},setDoubleForKey:function(a,c){cc.log("setDoubleForKey is deprecated. Use sys.localStorage.setItem instead.");return this.setFloatForKey(a,c)},setStringForKey:function(a,c){cc.log("setStringForKey is deprecated. Use sys.localStorage.setItem instead.");a&&this._setValueForKey(a,String(c))},_setValueForKey:function(a,c){this._db&&this._db.setItem(a,c)}});
cc.UserDefault.getInstance=function(){cc.log("cc.UserDefault is deprecated. Use sys.localStorage instead.");this._sUserDefault||(this._sUserDefault=new cc.UserDefault,this._sUserDefault.init());return this._sUserDefault};cc.UserDefault.purgeInstanceUserDefault=function(){cc.Browser&&this._db&&this._db.clear()};cc.UserDefault._sUserDefault=null;cc.UserDefault._isFilePathInitialized=!1;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.RGB_PREMULTIPLY_APLHA=function(a,c,d,e){return a*(e+1)>>8|c*(e+1)>>8<<8|d*(e+1)>>8<<16|e<<24};cc.tImageSource=function(a,c,d){this.data=a;this.size=c||0;this.offset=d||0};
cc.pngReadCallback=function(a,c,d){var e=new cc.tImageSource,e=cc.png_get_io_ptr(a);e.offset+d<=e.size?(cc.memcpy(c,e.data+e.offset,d),e.offset+=d):cc.png_error(a,"pngReaderCallback failed")};
cc.Image=cc.Class.extend({_width:0,_height:0,_bitsPerComponent:0,_data:0,_hasAlpha:!1,_preMulti:!1,initWithImageFile:function(a,c){var d=cc.FileUtils.getInstance().getFileData(a,"rb");return null!=d&&0<d.length?this.initWithImageData(d,d.length,c):!1},initWithImageFileThreadSafe:function(a,c){return this.initWithImageFile(a,c)},initWithImageData:function(a,c,d,e,f,g){g=g||8;e=e||0;f=f||0;d=d||cc.FMT_UNKNOWN;return!a||0>=c?!1:cc.FMT_PNG==d?this._initWithPngData(a,c):cc.FMT_JPG==d?this._initWithJpgData(a,
c):cc.FMT_TIFF==d?this._initWithTiffData(a,c):cc.FMT_RAWDATA==d?this._initWithRawData(a,c,e,f,g):8<c&&137==a[0]&&80==a[1]&&78==a[2]&&71==a[3]&&13==a[4]&&10==a[5]&&26==a[6]&&10==a[7]?this._initWithPngData(a,c):2<c&&(73==a[0]&&73==a[1]||77==a[0]&&77==a[1]||255==a[0]&&216==a[1])?this._initWithTiffData(a,c):!1},getData:function(){return this._data},getDataLen:function(){return this._width*this._height},hasAlpha:function(){return this._hasAlpha},isPremultipliedAlpha:function(){return this._preMulti},getWidth:function(){return this._width},
getHeight:function(){return this._height},getBitsPerComponent:function(){return this._bitsPerComponent},saveToFile:function(a,c){cc.log("doesn't support saveToFile on Cocos2d-Html5");return!1},_initWithJpgData:function(a,c){return!1},_initWithPngData:function(a,c){return!1},_initWithTiffData:function(a,c){return!1},_initWithRawData:function(a,c,d,e,f){return!1},_saveImageToPNG:function(a,c){return!1},_saveImageToJPG:function(a){return!1},initWithString:function(a,c,d,e,f,g){return!1}});(function(){var a="core/platform/CCClass.js core/cocoa/CCGeometry.js core/platform/Sys.js core/platform/CCConfig.js core/platform/miniFramework.js core/platform/CCCommon.js core/platform/CCMacro.js core/platform/CCFileUtils.js core/platform/CCTypes.js core/platform/CCEGLView.js core/platform/CCScreen.js core/platform/CCVisibleRect.js core/cocoa/CCAffineTransform.js core/support/CCPointExtension.js core/support/CCVertex.js core/support/TransformUtils.js core/base_nodes/CCNode.js core/base_nodes/CCAtlasNode.js core/textures/CCTexture2D.js core/textures/CCTextureCache.js core/textures/CCTextureAtlas.js core/scenes_nodes/CCScene.js core/layers_nodes/CCLayer.js core/sprite_nodes/CCSprite.js core/sprite_nodes/CCAnimation.js core/sprite_nodes/CCAnimationCache.js core/sprite_nodes/CCSpriteFrame.js core/sprite_nodes/CCSpriteFrameCache.js core/sprite_nodes/CCSpriteBatchNode.js core/CCConfiguration.js core/CCDirector.js core/CCCamera.js core/CCScheduler.js core/CCLoader.js core/CCDrawingPrimitives.js core/platform/CCApplication.js core/platform/CCSAXParser.js core/platform/AppControl.js core/labelTTF/CCLabelTTF.js core/CCActionManager.js kazmath/utility.js kazmath/vec2.js kazmath/vec3.js kazmath/vec4.js kazmath/ray2.js kazmath/mat3.js kazmath/mat4.js kazmath/plane.js kazmath/quaternion.js kazmath/aabb.js kazmath/GL/mat4stack.js kazmath/GL/matrix.js shaders/CCShaders.js shaders/CCShaderCache.js shaders/CCGLProgram.js shaders/CCGLStateCache.js render_texture/CCRenderTexture.js motion_streak/CCMotionStreak.js clipping_nodes/CCClippingNode.js effects/CCGrid.js effects/CCGrabber.js shape_nodes/CCDrawNode.js actions/CCAction.js actions/CCActionInterval.js actions/CCActionInstant.js actions/CCActionCamera.js actions/CCActionEase.js actions/CCActionCatmullRom.js actions/CCActionTween.js actions3d/CCActionGrid.js actions3d/CCActionGrid3D.js actions3d/CCActionTiledGrid.js actions3d/CCActionPageTurn3D.js progress_timer/CCProgressTimer.js progress_timer/CCActionProgressTimer.js transitions_nodes/CCTransition.js transitions_nodes/CCTransitionProgress.js transitions_nodes/CCTransitionPageTurn.js label_nodes/CCLabelAtlas.js label_nodes/CCLabelBMFont.js compress/ZipUtils.js compress/base64.js compress/gzip.js compress/zlib.min.js particle_nodes/CCPNGReader.js particle_nodes/CCTIFFReader.js particle_nodes/CCParticleSystem.js particle_nodes/CCParticleExamples.js particle_nodes/CCParticleBatchNode.js touch_dispatcher/CCTouchDelegateProtocol.js touch_dispatcher/CCTouchHandler.js touch_dispatcher/CCTouchDispatcher.js touch_dispatcher/CCMouseDispatcher.js keyboard_dispatcher/CCKeyboardDelegate.js keyboard_dispatcher/CCKeyboardDispatcher.js accelerometer/CCAccelerometer.js text_input_node/CCIMEDispatcher.js text_input_node/CCTextFieldTTF.js menu_nodes/CCMenuItem.js menu_nodes/CCMenu.js tileMap_nodes/CCTGAlib.js tileMap_nodes/CCTMXTiledMap.js tileMap_nodes/CCTMXXMLParser.js tileMap_nodes/CCTMXObjectGroup.js tileMap_nodes/CCTMXLayer.js parallax_nodes/CCParallaxNode.js audio/SimpleAudioEngine.js CCUserDefault.js CCImage.js".split(" "),
c=document,d=c.ccConfig;null!=d.loadExtension&&!0==d.loadExtension&&(a=a.concat("../extensions/GUI/CCControlExtension/CCControl.js ../extensions/GUI/CCControlExtension/CCControlButton.js ../extensions/GUI/CCControlExtension/CCControlUtils.js ../extensions/GUI/CCControlExtension/CCInvocation.js ../extensions/GUI/CCControlExtension/CCScale9Sprite.js ../extensions/GUI/CCControlExtension/CCMenuPassive.js ../extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.js ../extensions/GUI/CCControlExtension/CCControlHuePicker.js ../extensions/GUI/CCControlExtension/CCControlColourPicker.js ../extensions/GUI/CCControlExtension/CCControlSlider.js ../extensions/GUI/CCControlExtension/CCControlSwitch.js ../extensions/GUI/CCControlExtension/CCControlStepper.js ../extensions/GUI/CCControlExtension/CCControlPotentiometer.js ../extensions/GUI/CCScrollView/CCScrollView.js ../extensions/GUI/CCScrollView/CCSorting.js ../extensions/GUI/CCScrollView/CCTableView.js ../extensions/CCBReader/CCNodeLoader.js ../extensions/CCBReader/CCBReaderUtil.js ../extensions/CCBReader/CCControlLoader.js ../extensions/CCBReader/CCSpriteLoader.js ../extensions/CCBReader/CCNodeLoaderLibrary.js ../extensions/CCBReader/CCBReader.js ../extensions/CCBReader/CCBValue.js ../extensions/CCBReader/CCBKeyframe.js ../extensions/CCBReader/CCBSequence.js ../extensions/CCBReader/CCBRelativePositioning.js ../extensions/CCBReader/CCBAnimationManager.js ../extensions/CCEditBox/CCdomNode.js ../extensions/CCEditBox/CCEditBox.js ../extensions/CocoStudio/Components/CCComponent.js ../extensions/CocoStudio/Components/CCComponentContainer.js ../extensions/CocoStudio/CocoStudio.js ../extensions/CocoStudio/Armature/utils/CCArmatureDefine.js ../extensions/CocoStudio/Armature/utils/CCDataReaderHelper.js ../extensions/CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.js ../extensions/CocoStudio/Armature/utils/CCTransformHelp.js ../extensions/CocoStudio/Armature/utils/CCTweenFunction.js ../extensions/CocoStudio/Armature/utils/CCUtilMath.js ../extensions/CocoStudio/Armature/utils/CCArmatureDataManager.js ../extensions/CocoStudio/Armature/datas/CCDatas.js ../extensions/CocoStudio/Armature/display/CCDecorativeDisplay.js ../extensions/CocoStudio/Armature/display/CCDisplayFactory.js ../extensions/CocoStudio/Armature/display/CCDisplayManager.js ../extensions/CocoStudio/Armature/display/CCSkin.js ../extensions/CocoStudio/Armature/animation/CCProcessBase.js ../extensions/CocoStudio/Armature/animation/CCArmatureAnimation.js ../extensions/CocoStudio/Armature/animation/CCTween.js ../extensions/CocoStudio/Armature/physics/CCColliderDetector.js ../extensions/CocoStudio/Armature/CCArmature.js ../extensions/CocoStudio/Armature/CCBone.js ../extensions/CocoStudio/Action/CCActionFrame.js ../extensions/CocoStudio/Action/CCActionManager.js ../extensions/CocoStudio/Action/CCActionNode.js ../extensions/CocoStudio/Action/CCActionObject.js ../extensions/CocoStudio/Components/CCComAttribute.js ../extensions/CocoStudio/Components/CCComAudio.js ../extensions/CocoStudio/Components/CCComController.js ../extensions/CocoStudio/Components/CCComRender.js ../extensions/CocoStudio/Trigger/ObjectFactory.js ../extensions/CocoStudio/Trigger/TriggerBase.js ../extensions/CocoStudio/Trigger/TriggerMng.js ../extensions/CocoStudio/Trigger/TriggerObj.js ../extensions/CocoStudio/GUI/BaseClasses/UIWidget.js ../extensions/CocoStudio/GUI/Layouts/UILayout.js ../extensions/CocoStudio/GUI/Layouts/UILayoutParameter.js ../extensions/CocoStudio/GUI/Layouts/UILayoutDefine.js ../extensions/CocoStudio/GUI/System/CocosGUI.js ../extensions/CocoStudio/GUI/System/UIHelper.js ../extensions/CocoStudio/GUI/System/UILayer.js ../extensions/CocoStudio/GUI/UIWidgets/UIButton.js ../extensions/CocoStudio/GUI/UIWidgets/UICheckBox.js ../extensions/CocoStudio/GUI/UIWidgets/UIImageView.js ../extensions/CocoStudio/GUI/UIWidgets/UILabel.js ../extensions/CocoStudio/GUI/UIWidgets/UILabelAtlas.js ../extensions/CocoStudio/GUI/UIWidgets/UILabelBMFont.js ../extensions/CocoStudio/GUI/UIWidgets/UILoadingBar.js ../extensions/CocoStudio/GUI/UIWidgets/UIRichText.js ../extensions/CocoStudio/GUI/UIWidgets/UISlider.js ../extensions/CocoStudio/GUI/UIWidgets/UISwitch.js ../extensions/CocoStudio/GUI/UIWidgets/UITextField.js ../extensions/CocoStudio/GUI/UIWidgets/Compatible/CompatibleClasses.js ../extensions/CocoStudio/GUI/UIWidgets/ScrollWidget/UIScrollView.js ../extensions/CocoStudio/GUI/UIWidgets/ScrollWidget/UIListView.js ../extensions/CocoStudio/GUI/UIWidgets/ScrollWidget/UIPageView.js ../extensions/CocoStudio/Reader/GUIReader.js ../extensions/CocoStudio/Reader/SceneReader.js".split(" ")));
null!=d.loadPluginx&&!0==d.loadPluginx&&(a=a.concat("../extensions/PluginX/protocols/Config.js ../extensions/PluginX/protocols/PluginUtils.js ../extensions/PluginX/protocols/PluginProtocol.js ../extensions/PluginX/protocols/ProtocolSocial.js ../extensions/PluginX/protocols/ProtocolAds.js ../extensions/PluginX/protocols/ProtocolAnalytics.js ../extensions/PluginX/protocols/PluginFactory.js ../extensions/PluginX/protocols/PluginManager.js ../extensions/PluginX/plugins/SocialWeibo.js ../extensions/PluginX/plugins/SocialQQWeibo.js ../extensions/PluginX/plugins/SocialQzone.js ../extensions/PluginX/plugins/SocialTwitter.js ../extensions/PluginX/plugins/SocialFacebook.js ../extensions/PluginX/plugins/AnalyticsFlurry.js".split(" ")));
if(d.engineDir){if(d.box2d||d.chipmunk)a.push("physics_nodes/CCPhysicsSprite.js"),a.push("physics_nodes/CCPhysicsDebugNode.js"),!0===d.box2d&&a.push("../external/box2d/box2d.js"),!0===d.chipmunk&&a.push("../external/chipmunk/chipmunk.js");a.forEach(function(c,e){a[e]=d.engineDir+c})}else a=[];"string"===typeof d.box2d&&a.push(d.box2d);"string"===typeof d.chipmunk&&a.push(d.chipmunk);var e=document.getElementById("cocos2d_loadJsImg");if(!e){e=document.createElement("img");e.src="data:image/gif;base64,R0lGODlhEAAQALMNAD8/P7+/vyoqKlVVVX9/fxUVFUBAQGBgYMDAwC8vL5CQkP///wAAAP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAANACwAAAAAEAAQAAAEO5DJSau9OOvNex0IMnDIsiCkiW6g6BmKYlBFkhSUEgQKlQCARG6nEBwOgl+QApMdCIRD7YZ5RjlGpCUCACH5BAUAAA0ALAAAAgAOAA4AAAQ6kLGB0JA4M7QW0hrngRllkYyhKAYqKUGguAws0ypLS8JxCLQDgXAIDg+FRKIA6v0SAECCBpXSkstMBAAh+QQFAAANACwAAAAACgAQAAAEOJDJORAac6K1kDSKYmydpASBUl0mqmRfaGTCcQgwcxDEke+9XO2WkxQSiUIuAQAkls0n7JgsWq8RACH5BAUAAA0ALAAAAAAOAA4AAAQ6kMlplDIzTxWC0oxwHALnDQgySAdBHNWFLAvCukc215JIZihVIZEogDIJACBxnCSXTcmwGK1ar1hrBAAh+QQFAAANACwAAAAAEAAKAAAEN5DJKc4RM+tDyNFTkSQF5xmKYmQJACTVpQSBwrpJNteZSGYoFWjIGCAQA2IGsVgglBOmEyoxIiMAIfkEBQAADQAsAgAAAA4ADgAABDmQSVZSKjPPBEDSGucJxyGA1XUQxAFma/tOpDlnhqIYN6MEAUXvF+zldrMBAjHoIRYLhBMqvSmZkggAIfkEBQAADQAsBgAAAAoAEAAABDeQyUmrnSWlYhMASfeFVbZdjHAcgnUQxOHCcqWylKEohqUEAYVkgEAMfkEJYrFA6HhKJsJCNFoiACH5BAUAAA0ALAIAAgAOAA4AAAQ3kMlJq704611SKloCAEk4lln3DQgyUMJxCBKyLAh1EMRR3wiDQmHY9SQslyIQUMRmlmVTIyRaIgA7";
var f=document.getElementById(d.tag);f.style.backgroundColor="black";f.parentNode.appendChild(e);var g=getComputedStyle?getComputedStyle(f):f.currentStyle;e.style.left=f.offsetLeft+(parseFloat(g.width)-e.width)/2+"px";e.style.top=f.offsetTop+(parseFloat(g.height)-e.height)/2+"px";e.style.position="absolute"}var h=function(a){1<=a&&e.parentNode.removeChild(e)},k=0,m=a.concat(d.appFiles);m.push("main.js");var n=function(a){p();h(a/m.length);this.removeEventListener("load",n,!1)},p=function(){s++;if(s<
m.length){var a=c.createElement("script");a.src=m[s];a.addEventListener("load",n.bind(a,k),!1);c.body.appendChild(a)}h(s/(m.length-1))},q=function(){k++;h(k/m.length);this.removeEventListener("load",q,!1)};if(-1<navigator.userAgent.indexOf("Trident/5")){var s=-1;p()}else m.forEach(function(a,d){var e=c.createElement("script");e.async=!1;e.src=a;e.addEventListener("load",q,!1);c.body.appendChild(e)})})();cc.NodeLoaderListener=cc.Class.extend({onNodeLoaded:function(a,c){}});cc.BuilderSelectorResolver=cc.Class.extend({onResolveCCBCCMenuItemSelector:function(a,c){},onResolveCCBCCCallFuncSelector:function(a,c){},onResolveCCBCCControlSelector:function(a,c){}});cc.BuilderScriptOwnerProtocol=cc.Class.extend({createNew:function(){}});cc.BuilderMemberVariableAssigner=cc.Class.extend({onAssignCCBMemberVariable:function(a,c,d){return!1},onAssignCCBCustomProperty:function(a,c,d){return!1}});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=new cc.Color3B(0,0,0)},getColor:function(){return this._color}});cc.Color3BWapper.create=function(a){var c=new cc.Color3BWapper;c&&(c._color.r=a.r,c._color.g=a.g,c._color.b=a.b);return c};
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}});var PROPERTY_POSITION="position",PROPERTY_CONTENTSIZE="contentSize",PROPERTY_SKEW="skew",PROPERTY_ANCHORPOINT="anchorPoint",PROPERTY_SCALE="scale",PROPERTY_ROTATION="rotation",PROPERTY_TAG="tag",PROPERTY_IGNOREANCHORPOINTFORPOSITION="ignoreAnchorPointForPosition",PROPERTY_VISIBLE="visible",ASSERT_FAIL_UNEXPECTED_PROPERTY=function(a){cc.log("Unexpected property: '"+a+"'!")},ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE=function(a){cc.log("Unexpected property type: '"+a+"'!")};
function BlockData(a,c){this.selMenuHander=a;this.target=c}function BlockCCControlData(a,c,d){this.selCCControlHandler=a;this.target=c;this.controlEvents=d}
cc.NodeLoader=cc.Class.extend({_customProperties:null,ctor:function(){this._customProperties=new cc._Dictionary},loadCCNode:function(a,c){return this._createCCNode(a,c)},parseProperties:function(a,c,d){for(var e=d.readInt(!1),f=d.readInt(!1),f=e+f,g=0;g<f;g++){var h=g>=e,k=d.readInt(!1),m=d.readCachedString(),n=!1,p=d.readByte();if(p===CCB_PLATFORM_ALL||p===CCB_PLATFORM_IOS||p===CCB_PLATFORM_MAC)n=!0;a instanceof cc.BuilderFile?a.getCCBFileNode()&&h&&(a=a.getCCBFileNode(),n=a.getUserObject(),n=cc.ArrayContainsObject(n,
m)):h&&a==d.getAnimationManager().getRootNode()&&(h=a.getUserObject(),h||(h=[],a.setUserObject(h)),h.push(m));switch(k){case CCB_PROPTYPE_POSITION:k=this.parsePropTypePosition(a,c,d,m);if(n)this.onHandlePropTypePosition(a,c,m,k,d);break;case CCB_PROPTYPE_POINT:k=this.parsePropTypePoint(a,c,d);if(n)this.onHandlePropTypePoint(a,c,m,k,d);break;case CCB_PROPTYPE_POINTLOCK:k=this.parsePropTypePointLock(a,c,d);if(n)this.onHandlePropTypePointLock(a,c,m,k,d);break;case CCB_PROPTYPE_SIZE:k=this.parsePropTypeSize(a,
c,d);if(n)this.onHandlePropTypeSize(a,c,m,k,d);break;case CCB_PROPTYPE_SCALELOCK:k=this.parsePropTypeScaleLock(a,c,d,m);if(n)this.onHandlePropTypeScaleLock(a,c,m,k,d);break;case CCB_PROPTYPE_FLOATXY:k=this.parsePropTypeFloatXY(a,c,d);if(n)this.onHandlePropTypeFloatXY(a,c,m,k,d);break;case CCB_PROPTYPE_FLOAT:k=this.parsePropTypeFloat(a,c,d);if(n)this.onHandlePropTypeFloat(a,c,m,k,d);break;case CCB_PROPTYPE_DEGREES:k=this.parsePropTypeDegrees(a,c,d,m);if(n)this.onHandlePropTypeDegrees(a,c,m,k,d);break;
case CCB_PROPTYPE_FLOATSCALE:k=this.parsePropTypeFloatScale(a,c,d);if(n)this.onHandlePropTypeFloatScale(a,c,m,k,d);break;case CCB_PROPTYPE_INTEGER:k=this.parsePropTypeInteger(a,c,d);if(n)this.onHandlePropTypeInteger(a,c,m,k,d);break;case CCB_PROPTYPE_INTEGERLABELED:k=this.parsePropTypeIntegerLabeled(a,c,d);if(n)this.onHandlePropTypeIntegerLabeled(a,c,m,k,d);break;case CCB_PROPTYPE_FLOATVAR:k=this.parsePropTypeFloatVar(a,c,d);if(n)this.onHandlePropTypeFloatVar(a,c,m,k,d);break;case CCB_PROPTYPE_CHECK:k=
this.parsePropTypeCheck(a,c,d,m);if(n)this.onHandlePropTypeCheck(a,c,m,k,d);break;case CCB_PROPTYPE_SPRITEFRAME:k=this.parsePropTypeSpriteFrame(a,c,d,m);if(n)this.onHandlePropTypeSpriteFrame(a,c,m,k,d);break;case CCB_PROPTYPE_ANIMATION:k=this.parsePropTypeAnimation(a,c,d);if(n)this.onHandlePropTypeAnimation(a,c,m,k,d);break;case CCB_PROPTYPE_TEXTURE:k=this.parsePropTypeTexture(a,c,d);if(n)this.onHandlePropTypeTexture(a,c,m,k,d);break;case CCB_PROPTYPE_BYTE:k=this.parsePropTypeByte(a,c,d,m);if(n)this.onHandlePropTypeByte(a,
c,m,k,d);break;case CCB_PROPTYPE_COLOR3:k=this.parsePropTypeColor3(a,c,d,m);if(n)this.onHandlePropTypeColor3(a,c,m,k,d);break;case CCB_PROPTYPE_COLOR4VAR:k=this.parsePropTypeColor4FVar(a,c,d);if(n)this.onHandlePropTypeColor4FVar(a,c,m,k,d);break;case CCB_PROPTYPE_FLIP:k=this.parsePropTypeFlip(a,c,d);if(n)this.onHandlePropTypeFlip(a,c,m,k,d);break;case CCB_PROPTYPE_BLENDMODE:k=this.parsePropTypeBlendFunc(a,c,d);if(n)this.onHandlePropTypeBlendFunc(a,c,m,k,d);break;case CCB_PROPTYPE_FNTFILE:k=d.getCCBRootPath()+
this.parsePropTypeFntFile(a,c,d);if(n)this.onHandlePropTypeFntFile(a,c,m,k,d);break;case CCB_PROPTYPE_FONTTTF:k=this.parsePropTypeFontTTF(a,c,d);if(n)this.onHandlePropTypeFontTTF(a,c,m,k,d);break;case CCB_PROPTYPE_STRING:k=this.parsePropTypeString(a,c,d);if(n)this.onHandlePropTypeString(a,c,m,k,d);break;case CCB_PROPTYPE_TEXT:k=this.parsePropTypeText(a,c,d);if(n)this.onHandlePropTypeText(a,c,m,k,d);break;case CCB_PROPTYPE_BLOCK:k=this.parsePropTypeBlock(a,c,d);if(n)this.onHandlePropTypeBlock(a,c,
m,k,d);break;case CCB_PROPTYPE_BLOCKCCCONTROL:k=this.parsePropTypeBlockCCControl(a,c,d);if(n&&null!=k)this.onHandlePropTypeBlockCCControl(a,c,m,k,d);break;case CCB_PROPTYPE_CCBFILE:k=this.parsePropTypeCCBFile(a,c,d);if(n)this.onHandlePropTypeCCBFile(a,c,m,k,d);break;default:ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(k)}}},getCustomProperties:function(){return this._customProperties},_createCCNode:function(a,c){return cc.Node.create()},parsePropTypePosition:function(a,c,d,e){var f=d.readFloat(),g=d.readFloat(),
h=d.readInt(!1),k=d.getAnimationManager().getContainerSize(c);c=cc._getAbsolutePosition(f,g,h,k,e);a.setPosition(cc.getAbsolutePosition(c,h,k,e));-1<d.getAnimatedProperties().indexOf(e)&&(f=[f,g,h],d.getAnimationManager().setBaseValue(f,a,e));return c},parsePropTypePoint:function(a,c,d){a=d.readFloat();d=d.readFloat();return new cc.Point(a,d)},parsePropTypePointLock:function(a,c,d){a=d.readFloat();d=d.readFloat();return new cc.Point(a,d)},parsePropTypeSize:function(a,c,d){a=d.readFloat();var e=d.readFloat(),
f=d.readInt(!1);c=d.getAnimationManager().getContainerSize(c);switch(f){case CCB_SIZETYPE_ABSOLUTE:break;case CCB_SIZETYPE_RELATIVE_CONTAINER:a=c.width-a;e=c.height-e;break;case CCB_SIZETYPE_PERCENT:a=c.width*a/100;e=c.height*e/100;break;case CCB_SIZETYPE_HORIZONTAL_PERCENT:a=c.width*a/100;break;case CCB_SIZETYPE_VERTICAL_PERCENT:e=c.height*e/100;break;case CCB_SIZETYPE_MULTIPLY_RESOLUTION:c=cc.BuilderReader.getResolutionScale();a*=c;e*=c;break;default:cc.log("Unknown CCB type.")}return new cc.Size(a,
e)},parsePropTypeScaleLock:function(a,c,d,e){c=d.readFloat();var f=d.readFloat(),g=d.readInt(!1);cc.setRelativeScale(a,c,f,g,e);-1<d.getAnimatedProperties().indexOf(e)&&d.getAnimationManager().setBaseValue([c,f,g],a,e);g==CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(c*=cc.BuilderReader.getResolutionScale(),f*=cc.BuilderReader.getResolutionScale());return[c,f]},parsePropTypeFloat:function(a,c,d){return d.readFloat()},parsePropTypeDegrees:function(a,c,d,e){c=d.readFloat();-1<d.getAnimatedProperties().indexOf(e)&&
d.getAnimationManager().setBaseValue(c,a,e);return c},parsePropTypeFloatScale:function(a,c,d){a=d.readFloat();d.readInt(!1)==CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(a*=cc.BuilderReader.getResolutionScale());return a},parsePropTypeInteger:function(a,c,d){return d.readInt(!0)},parsePropTypeIntegerLabeled:function(a,c,d){return d.readInt(!0)},parsePropTypeFloatVar:function(a,c,d){a=d.readFloat();d=d.readFloat();return[a,d]},parsePropTypeCheck:function(a,c,d,e){c=d.readBool();-1<d.getAnimatedProperties().indexOf(e)&&
d.getAnimationManager().setBaseValue(c,a,e);return c},parsePropTypeSpriteFrame:function(a,c,d,e){c=d.readCachedString();var f=d.readCachedString(),g;null!=f&&0!=f.length&&(0==c.length?(f=d.getCCBRootPath()+f,c=cc.TextureCache.getInstance().addImage(f),f=c.getContentSize(),f=cc.rect(0,0,f.width,f.height),g=cc.SpriteFrame.createWithTexture(c,f)):(g=cc.SpriteFrameCache.getInstance(),c=d.getCCBRootPath()+c,-1==d.getLoadedSpriteSheet().indexOf(c)&&(g.addSpriteFrames(c),d.getLoadedSpriteSheet().push(c)),
g=g.getSpriteFrame(f)),-1<d.getAnimatedProperties().indexOf(e)&&d.getAnimationManager().setBaseValue(g,a,e));return g},parsePropTypeAnimation:function(a,c,d){a=d.getCCBRootPath()+d.readCachedString();d=d.readCachedString();c=null;d=cc.BuilderReader.lastPathComponent(d);a=cc.BuilderReader.lastPathComponent(a);null!=d&&""!=d&&(c=cc.AnimationCache.getInstance(),c.addAnimations(a),c=c.getAnimation(d));return c},parsePropTypeTexture:function(a,c,d){a=d.getCCBRootPath()+d.readCachedString();return""!=a?
cc.TextureCache.getInstance().addImage(a):null},parsePropTypeByte:function(a,c,d,e){c=d.readByte();-1<d.getAnimatedProperties().indexOf(e)&&d.getAnimationManager().setBaseValue(c,a,e);return c},parsePropTypeColor3:function(a,c,d,e){c=d.readByte();var f=d.readByte(),g=d.readByte();c={r:c,g:f,b:g};-1<d.getAnimatedProperties().indexOf(e)&&d.getAnimationManager().setBaseValue(cc.Color3BWapper.create(c),a,e);return c},parsePropTypeColor4FVar:function(a,c,d){a=d.readFloat();c=d.readFloat();var e=d.readFloat(),
f=d.readFloat(),g=d.readFloat(),h=d.readFloat(),k=d.readFloat();d=d.readFloat();var m=[];m[0]={r:a,g:c,b:e,a:f};m[1]={r:g,g:h,b:k,a:d};return m},parsePropTypeFlip:function(a,c,d){a=d.readBool();d=d.readBool();return[a,d]},parsePropTypeBlendFunc:function(a,c,d){a=d.readInt(!1);d=d.readInt(!1);return new cc.BlendFunc(a,d)},parsePropTypeFntFile:function(a,c,d){return d.readCachedString()},parsePropTypeString:function(a,c,d){return d.readCachedString()},parsePropTypeText:function(a,c,d){return d.readCachedString()},
parsePropTypeFontTTF:function(a,c,d){return d.readCachedString()},parsePropTypeBlock:function(a,c,d){c=d.readCachedString();var e=d.readInt(!1);if(e!==CCB_TARGETTYPE_NONE){var f=null;if(d.isJSControlled())e===CCB_TARGETTYPE_DOCUMENTROOT?(d.addDocumentCallbackNode(a),d.addDocumentCallbackName(c),d.addDocumentCallbackControlEvents(0)):(d.addOwnerCallbackNode(a),d.addOwnerCallbackName(c),d.addOwnerCallbackControlEvents(0));else if(e===CCB_TARGETTYPE_DOCUMENTROOT?f=d.getAnimationManager().getRootNode():
e===CCB_TARGETTYPE_OWNER&&(f=d.getOwner()),null!=f)if(0<c.length)if(a=0,null!=f&&f.onResolveCCBCCMenuItemSelector&&(a=f.onResolveCCBCCMenuItemSelector(f,c)),0==a&&(d=d.getCCBSelectorResolver(),null!=d&&(a=d.onResolveCCBCCMenuItemSelector(f,c))),0==a)cc.log("Skipping selector '"+c+"' since no CCBSelectorResolver is present.");else return new BlockData(a,f);else cc.log("Unexpected empty selector.");else cc.log("Unexpected NULL target for selector.")}return null},parsePropTypeBlockCCControl:function(a,
c,d){c=d.readCachedString();var e=d.readInt(!1),f=d.readInt(!1);if(e!==CCB_TARGETTYPE_NONE)if(d.isJSControlled())e==CCB_TARGETTYPE_DOCUMENTROOT?(d.addDocumentCallbackNode(a),d.addDocumentCallbackName(c),d.addDocumentCallbackControlEvents(f)):(d.addOwnerCallbackNode(a),d.addOwnerCallbackName(c),d.addOwnerCallbackControlEvents(f));else if(a=null,e==CCB_TARGETTYPE_DOCUMENTROOT?a=d.getAnimationManager().getRootNode():e==CCB_TARGETTYPE_OWNER&&(a=d.getOwner()),null!=a)if(0<c.length)if(e=0,null!=a&&a.onResolveCCBCCControlSelector&&
(e=a.onResolveCCBCCControlSelector(a,c)),0==e&&(d=d.getCCBSelectorResolver(),null!=d&&(e=d.onResolveCCBCCControlSelector(a,c))),0==e)cc.log("Skipping selector '"+c+"' since no CCBSelectorResolver is present.");else return new BlockCCControlData(e,a,f);else cc.log("Unexpected empty selector.");else cc.log("Unexpected NULL target for selector.");return null},parsePropTypeCCBFile:function(a,c,d){a=d.getCCBRootPath()+d.readCachedString();a=cc.BuilderReader.deletePathExtension(a)+".ccbi";var e=cc.FileUtils.getInstance(),
f=e.fullPathFromRelativePath(a);a=new cc.BuilderReader(d);e=e.getByteArrayFromFile(f,"rb",void 0);a.initWithData(e,d.getOwner());a.getAnimationManager().setRootContainerSize(c.getContentSize());a.setAnimationManagers(d.getAnimationManagers());a.getAnimationManager().setOwner(d.getOwner());c=a.readFileWithCleanUp(!1);d.setAnimationManagers(a.getAnimationManagers());c&&-1!=a.getAnimationManager().getAutoPlaySequenceId()&&a.getAnimationManager().runAnimations(a.getAnimationManager().getAutoPlaySequenceId(),
0);return c},parsePropTypeFloatXY:function(a,c,d){a=d.readFloat();d=d.readFloat();return[a,d]},onHandlePropTypePosition:function(a,c,d,e,f){d===PROPERTY_POSITION?a.setPosition(e):ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypePoint:function(a,c,d,e,f){d===PROPERTY_ANCHORPOINT?a.setAnchorPoint(e):ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypePointLock:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeSize:function(a,c,d,e,f){d===PROPERTY_CONTENTSIZE?a.setContentSize(e):
ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeScaleLock:function(a,c,d,e,f){d===PROPERTY_SCALE?(a.setScaleX(e[0]),a.setScaleY(e[1])):ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeFloatXY:function(a,c,d,e,f){d===PROPERTY_SKEW?(a.setSkewX(e[0]),a.setSkewY(e[1])):(c=d+"X",f=d+"Y",a[c]&&a[f]||ASSERT_FAIL_UNEXPECTED_PROPERTY(d),a[c](e[0]),a[f](e[1]))},onHandlePropTypeFloat:function(a,c,d,e,f){this._customProperties.setObject(e,d)},onHandlePropTypeDegrees:function(a,c,d,e,f){d===PROPERTY_ROTATION?
a.setRotation(e):ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeFloatScale:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeInteger:function(a,c,d,e,f){d===PROPERTY_TAG?a.setTag(e):ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeIntegerLabeled:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeFloatVar:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeCheck:function(a,c,d,e,f){d===PROPERTY_VISIBLE?a.setVisible(e):d===PROPERTY_IGNOREANCHORPOINTFORPOSITION?
a.ignoreAnchorPointForPosition(e):ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeSpriteFrame:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeAnimation:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeTexture:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeByte:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeColor3:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeColor4FVar:function(a,
c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeFlip:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeFntFile:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeString:function(a,c,d,e,f){this._customProperties.setObject(e,d)},onHandlePropTypeText:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeFontTTF:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},
onHandlePropTypeBlock:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeBlockCCControl:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)},onHandlePropTypeCCBFile:function(a,c,d,e,f){ASSERT_FAIL_UNEXPECTED_PROPERTY(d)}});cc.NodeLoader.loader=function(){return new cc.NodeLoader};var CCB_VERSION=5,CCB_PROPTYPE_POSITION=0,CCB_PROPTYPE_SIZE=1,CCB_PROPTYPE_POINT=2,CCB_PROPTYPE_POINTLOCK=3,CCB_PROPTYPE_SCALELOCK=4,CCB_PROPTYPE_DEGREES=5,CCB_PROPTYPE_INTEGER=6,CCB_PROPTYPE_FLOAT=7,CCB_PROPTYPE_FLOATVAR=8,CCB_PROPTYPE_CHECK=9,CCB_PROPTYPE_SPRITEFRAME=10,CCB_PROPTYPE_TEXTURE=11,CCB_PROPTYPE_BYTE=12,CCB_PROPTYPE_COLOR3=13,CCB_PROPTYPE_COLOR4VAR=14,CCB_PROPTYPE_FLIP=15,CCB_PROPTYPE_BLENDMODE=16,CCB_PROPTYPE_FNTFILE=17,CCB_PROPTYPE_TEXT=18,CCB_PROPTYPE_FONTTTF=19,CCB_PROPTYPE_INTEGERLABELED=
20,CCB_PROPTYPE_BLOCK=21,CCB_PROPTYPE_ANIMATION=22,CCB_PROPTYPE_CCBFILE=23,CCB_PROPTYPE_STRING=24,CCB_PROPTYPE_BLOCKCCCONTROL=25,CCB_PROPTYPE_FLOATSCALE=26,CCB_PROPTYPE_FLOATXY=27,CCB_FLOAT0=0,CCB_FLOAT1=1,CCB_FLOAT_MINUS1=2,CCB_FLOAT05=3,CCB_FLOAT_INTEGER=4,CCB_FLOAT_FULL=5,CCB_PLATFORM_ALL=0,CCB_PLATFORM_IOS=1,CCB_PLATFORM_MAC=2,CCB_TARGETTYPE_NONE=0,CCB_TARGETTYPE_DOCUMENTROOT=1,CCB_TARGETTYPE_OWNER=2,CCB_KEYFRAME_EASING_INSTANT=0,CCB_KEYFRAME_EASING_LINEAR=1,CCB_KEYFRAME_EASING_CUBIC_IN=2,CCB_KEYFRAME_EASING_CUBIC_OUT=
3,CCB_KEYFRAME_EASING_CUBIC_INOUT=4,CCB_KEYFRAME_EASING_ELASTIC_IN=5,CCB_KEYFRAME_EASING_ELASTIC_OUT=6,CCB_KEYFRAME_EASING_ELASTIC_INOUT=7,CCB_KEYFRAME_EASING_BOUNCE_IN=8,CCB_KEYFRAME_EASING_BOUNCE_OUT=9,CCB_KEYFRAME_EASING_BOUNCE_INOUT=10,CCB_KEYFRAME_EASING_BACK_IN=11,CCB_KEYFRAME_EASING_BACK_OUT=12,CCB_KEYFRAME_EASING_BACK_INOUT=13,CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT=0,CCB_POSITIONTYPE_RELATIVE_TOP_LEFT=1,CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT=2,CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT=3,CCB_POSITIONTYPE_PERCENT=
4,CCB_POSITIONTYPE_MULTIPLY_RESOLUTION=5,CCB_SIZETYPE_ABSOLUTE=0,CCB_SIZETYPE_PERCENT=1,CCB_SIZETYPE_RELATIVE_CONTAINER=2,CCB_SIZETYPE_HORIZONTAL_PERCENT=3,CCB_SIZETYPE_VERTICAL_PERCENT=4,CCB_SIZETYPE_MULTIPLY_RESOLUTION=5,CCB_SCALETYPE_ABSOLUTE=0,CCB_SCALETYPE_MULTIPLY_RESOLUTION=1,_ccbGlobalContext=_ccbGlobalContext||window;cc.BuilderFile=cc.Node.extend({_ccbFileNode:null,getCCBFileNode:function(){return this._ccbFileNode},setCCBFileNode:function(a){this._ccbFileNode=a}});
cc.BuilderFile.create=function(){return new cc.BuilderFile};
cc.BuilderReader=cc.Class.extend({_jsControlled:!1,_data:null,_ccbRootPath:"",_bytes:0,_currentByte:0,_currentBit:0,_stringCache:null,_loadedSpriteSheets:null,_owner:null,_animationManager:null,_animationManagers:null,_animatedProps:null,_ccNodeLoaderLibrary:null,_ccNodeLoaderListener:null,_ccbMemberVariableAssigner:null,_ccbSelectorResolver:null,_ownerOutletNames:null,_ownerOutletNodes:null,_nodesWithAnimationManagers:null,_animationManagerForNodes:null,_ownerCallbackNames:null,_ownerCallbackNodes:null,
_ownerCallbackEvents:null,_readNodeGraphFromData:!1,ctor:function(a,c,d,e){this._stringCache=[];this._loadedSpriteSheets=[];this._currentByte=this._currentBit=-1;0!=arguments.length&&(a instanceof cc.BuilderReader?(this._loadedSpriteSheets=a._loadedSpriteSheets,this._ccNodeLoaderLibrary=a._ccNodeLoaderLibrary,this._ccbMemberVariableAssigner=a._ccbMemberVariableAssigner,this._ccbSelectorResolver=a._ccbSelectorResolver,this._ccNodeLoaderListener=a._ccNodeLoaderListener,this._ownerCallbackNames=a._ownerCallbackNames,
this._ownerCallbackNodes=a._ownerCallbackNodes,this._ownerCallbackEvents=a._ownerCallbackEvents,this._ownerOutletNames=a._ownerOutletNames,this._ownerOutletNodes=a._ownerOutletNodes,this._ccbRootPath=a._ccbRootPath):(this._ccNodeLoaderLibrary=a,this._ccbMemberVariableAssigner=c,this._ccbSelectorResolver=d,this._ccNodeLoaderListener=e))},getCCBRootPath:function(){return this._ccbRootPath},setCCBRootPath:function(a){this._ccbRootPath=a},initWithData:function(a,c){this._animationManager=new cc.BuilderAnimationManager;
this._data=a;this._bytes=a.length;this._currentByte=this._currentBit=0;this._owner=c;this._animationManager.setRootContainerSize(cc.Director.getInstance().getWinSize());return!0},readNodeGraphFromFile:function(a,c,d,e){null==d?d=cc.Director.getInstance().getWinSize():d instanceof cc.BuilderAnimationManager&&(e=d,d=cc.Director.getInstance().getWinSize());var f=cc.FileUtils.getInstance();a=f.fullPathFromRelativePath(a);f=f.getByteArrayFromFile(a);return this.readNodeGraphFromData(f,c,d,e)},readNodeGraphFromData:function(a,
c,d){this.initWithData(a,c);a=this._animationManager;a.setRootContainerSize(d);a.setOwner(c);this._ownerOutletNames=[];this._ownerOutletNodes=[];this._ownerCallbackNames=[];this._ownerCallbackNodes=[];this._ownerCallbackEvents=[];this._animationManagers=new cc._Dictionary;(c=this.readFileWithCleanUp(!0))&&-1!=a.getAutoPlaySequenceId()&&a.runAnimations(a.getAutoPlaySequenceId(),0);if(this._jsControlled){d=[];a=[];for(var e=this._animationManagers,f=e.allKeys(),g=0;g<f.length;g++)d.push(f[g]),a.push(e.objectForKey(f[g]));
this._nodesWithAnimationManagers=d;this._animationManagerForNodes=a}return c},createSceneWithNodeGraphFromFile:function(a,c,d,e){a=this.readNodeGraphFromFile(a,c,d,e);c=cc.Scene.create();c.addChild(a);return c},getCCBMemberVariableAssigner:function(){return this._ccbMemberVariableAssigner},getCCBSelectorResolver:function(){return this._ccbSelectorResolver},getAnimationManager:function(){return this._animationManager},setAnimationManager:function(a){this._animationManager=a},getAnimatedProperties:function(){return this._animatedProps},
getLoadedSpriteSheet:function(){return this._loadedSpriteSheets},getOwner:function(){return this._owner},readInt:function(a){for(var c=0;!this._getBit();)c++;for(var d=0,e=c-1;0<=e;e--)this._getBit()&&(d|=1<<e);d|=1<<c;a=a?d%2?0|d/2:0|-d/2:d-1;this._alignBits();return a},readByte:function(){var a=this._data[this._currentByte];this._currentByte++;return a},readBool:function(){return 0!=this.readByte()},readFloat:function(){switch(this.readByte()){case CCB_FLOAT0:return 0;case CCB_FLOAT1:return 1;case CCB_FLOAT_MINUS1:return-1;
case CCB_FLOAT05:return 0.5;case CCB_FLOAT_INTEGER:return this.readInt(!0);default:return this._decodeFloat(23,8)}},_decodeFloat:function(a,c){var d=a+c+1,e=d>>3;this._checkSize(d);var d=Math.pow(2,c-1)-1,f=this._readBitsOnly(a+c,1,e),g=this._readBitsOnly(a,c,e),h=0,k=2,m=0;do for(var n=this._readByteOnly(++m,e),p=a%8||8,q=1<<p;q>>=1;)n&q&&(h+=1/k),k*=2;while(a-=p);this._currentByte+=e;return g==(d<<1)+1?h?NaN:f?-Infinity:Infinity:(1+-2*f)*(g||h?g?Math.pow(2,g-d)*(1+h):Math.pow(2,-d+1)*h:0)},_readBitsOnly:function(a,
c,d){var e=(a+c)%8,f=a%8,g=d-(a>>3)-1;a=d+(-(a+c)>>3);var h=g-a;c=this._readByteOnly(g,d)>>f&(1<<(h?8-f:c))-1;for(h&&e&&(c+=(this._readByteOnly(a++,d)&(1<<e)-1)<<(h--<<3)-f);h;)c+=this._shl(this._readByteOnly(a++,d),(h--<<3)-f);return c},_readByteOnly:function(a,c){return this._data[this._currentByte+c-a-1]},_shl:function(a,c){for(++c;--c;a=1073741824==((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+2147483648);return a},_checkSize:function(a){if(!(this._currentByte+Math.ceil(a/8)<this._data.length))throw Error("Index out of bound");
},readCachedString:function(){return this._stringCache[this.readInt(!1)]},isJSControlled:function(){return this._jsControlled},getOwnerCallbackNames:function(){return this._ownerCallbackNames},getOwnerCallbackNodes:function(){return this._ownerCallbackNodes},getOwnerCallbackControlEvents:function(){return this._ownerCallbackEvents},getOwnerOutletNames:function(){return this._ownerOutletNames},getOwnerOutletNodes:function(){return this._ownerOutletNodes},getNodesWithAnimationManagers:function(){return this._nodesWithAnimationManagers},
getAnimationManagersForNodes:function(){return this._animationManagerForNodes},getAnimationManagers:function(){return this._animationManagers},setAnimationManagers:function(a){this._animationManagers=a},addOwnerCallbackName:function(a){this._ownerCallbackNames.push(a)},addOwnerCallbackNode:function(a){this._ownerCallbackNodes.push(a)},addOwnerCallbackControlEvents:function(a){this._ownerCallbackEvents.push(a)},addDocumentCallbackName:function(a){this._animationManager.addDocumentCallbackName(a)},
addDocumentCallbackNode:function(a){this._animationManager.addDocumentCallbackNode(a)},addDocumentCallbackControlEvents:function(a){this._animationManager.addDocumentCallbackControlEvents(a)},readFileWithCleanUp:function(a){if(!this._readHeader()||!this._readStringCache()||!this._readSequences())return null;var c=this._readNodeGraph();this._animationManagers.setObject(this._animationManager,c);a&&this._cleanUpNodeGraph(c);return c},addOwnerOutletName:function(a){this._ownerOutletNames.push(a)},addOwnerOutletNode:function(a){null!=
a&&this._ownerOutletNodes.push(a)},_cleanUpNodeGraph:function(a){a.setUserObject(null);a=a.getChildren();for(var c=0,d=a.length;c<d;c++)this._cleanUpNodeGraph(a[c])},_readCallbackKeyframesForSeq:function(a){var c=this.readInt(!1);if(!c)return!0;for(var d=new cc.BuilderSequenceProperty,e=this._jsControlled,f=this._animationManager,g=d.getKeyframes(),h=0;h<c;h++){var k=this.readFloat(),m=this.readCachedString(),n=this.readInt(!1),p=[m,n],q=new cc.BuilderKeyframe;q.setTime(k);q.setValue(p);e&&f.getKeyframeCallbacks().push(n+
":"+m);g.push(q)}a.setCallbackChannel(d);return!0},_readSoundKeyframesForSeq:function(a){var c=this.readInt(!1);if(!c)return!0;for(var d=new cc.BuilderSequenceProperty,e=d.getKeyframes(),f=0;f<c;f++){var g=this.readFloat(),h=this.readCachedString(),k=this.readFloat(),m=this.readFloat(),n=this.readFloat(),h=[h,k,m,n],k=new cc.BuilderKeyframe;k.setTime(g);k.setValue(h);e.push(k)}a.setSoundChannel(d);return!0},_readSequences:function(){for(var a=this._animationManager.getSequences(),c=this.readInt(!1),
d=0;d<c;d++){var e=new cc.BuilderSequence;e.setDuration(this.readFloat());e.setName(this.readCachedString());e.setSequenceId(this.readInt(!1));e.setChainedSequenceId(this.readInt(!0));if(!this._readCallbackKeyframesForSeq(e)||!this._readSoundKeyframesForSeq(e))return!1;a.push(e)}this._animationManager.setAutoPlaySequenceId(this.readInt(!0));return!0},readKeyframe:function(a){var c=new cc.BuilderKeyframe;c.setTime(this.readFloat());var d=this.readInt(!1),e=0,f=null;if(d===CCB_KEYFRAME_EASING_CUBIC_IN||
d===CCB_KEYFRAME_EASING_CUBIC_OUT||d===CCB_KEYFRAME_EASING_CUBIC_INOUT||d===CCB_KEYFRAME_EASING_ELASTIC_IN||d===CCB_KEYFRAME_EASING_ELASTIC_OUT||d===CCB_KEYFRAME_EASING_ELASTIC_INOUT)e=this.readFloat();c.setEasingType(d);c.setEasingOpt(e);a==CCB_PROPTYPE_CHECK?f=this.readBool():a==CCB_PROPTYPE_BYTE?f=this.readByte():a==CCB_PROPTYPE_COLOR3?(a=cc.c3(this.readByte(),this.readByte(),this.readByte()),f=cc.Color3BWapper.create(a)):a==CCB_PROPTYPE_FLOATXY?f=[this.readFloat(),this.readFloat()]:a==CCB_PROPTYPE_DEGREES?
f=this.readFloat():a==CCB_PROPTYPE_SCALELOCK||a==CCB_PROPTYPE_POSITION||a==CCB_PROPTYPE_FLOATXY?f=[this.readFloat(),this.readFloat()]:a==CCB_PROPTYPE_SPRITEFRAME&&(a=this.readCachedString(),d=this.readCachedString(),""==a?(d=this._ccbRootPath+d,a=cc.TextureCache.getInstance().addImage(d),d=a.getContentSize(),d=cc.rect(0,0,d.width,d.height),f=cc.SpriteFrame.createWithTexture(a,d)):(a=this._ccbRootPath+a,e=cc.SpriteFrameCache.getInstance(),-1==this._loadedSpriteSheets.indexOf(a)&&(e.addSpriteFrames(a),
this._loadedSpriteSheets.push(a)),f=e.getSpriteFrame(d)));c.setValue(f);return c},_readHeader:function(){if(null==this._data)return!1;var a=this._readStringFromBytes(this._currentByte,4,!0);this._currentByte+=4;if("ccbi"!=a)return!1;a=this.readInt(!1);if(a!=CCB_VERSION)return cc.log("WARNING! Incompatible ccbi file version (file: "+a+" reader: "+CCB_VERSION+")"),!1;this._jsControlled=this.readBool();this._animationManager._jsControlled=this._jsControlled;return!0},_readStringFromBytes:function(a,
c,d){a="";var e=this._data,f=this._currentByte;if(d)for(d=c-1;0<=d;d--)a+=String.fromCharCode(e[f+d]);else for(d=0;d<c;d++)a+=String.fromCharCode(e[f+d]);return a},_readStringCache:function(){for(var a=this.readInt(!1),c=0;c<a;c++)this._readStringCacheEntry();return!0},_readStringCacheEntry:function(){for(var a=this.readByte(),c=this.readByte(),a=a<<8|c,c="",d=this._data,e=this._currentByte,f=0;f<a;f++)var g=d[e+f].toString("16").toUpperCase(),g=1<g.length?g:"0"+g,c=c+("%"+g);c=decodeURIComponent(c);
this._currentByte+=a;this._stringCache.push(c)},_readNodeGraph:function(a){var c=this.readCachedString(),d,e=this._jsControlled,f=this._animationManager;e&&(d=this.readCachedString());var g=this.readInt(!1),h;g!=CCB_TARGETTYPE_NONE&&(h=this.readCachedString());(c=this._ccNodeLoaderLibrary.getCCNodeLoader(c))||(c=this._ccNodeLoaderLibrary.getCCNodeLoader("CCNode"));var k=c.loadCCNode(a,this);f.getRootNode()||f.setRootNode(k);e&&k==f.getRootNode()&&f.setDocumentControllerName(d);var m=new cc._Dictionary,
n=this._animatedProps=[],p=this.readInt(!1);for(d=0;d<p;++d){for(var q=this.readInt(!1),s=new cc._Dictionary,r=this.readInt(!1),t=0;t<r;++t){var u=new cc.BuilderSequenceProperty;u.setName(this.readCachedString());u.setType(this.readInt(!1));n.push(u.getName());for(var v=this.readInt(!1),z=u.getKeyframes(),B=0;B<v;++B){var E=this.readKeyframe(u.getType());z.push(E)}s.setObject(u,u.getName())}m.setObject(s,q)}0<m.count()&&f.addNode(k,m);c.parseProperties(k,a,this);if(a=k instanceof cc.BuilderFile)d=
k.getCCBFileNode(),d.setPosition(k.getPosition()),d.setRotation(k.getRotation()),d.setScaleX(k.getScaleX()),d.setScaleY(k.getScaleY()),d.setTag(k.getTag()),d.setVisible(!0),f.moveAnimationsFromNode(k,d),k.setCCBFileNode(null),k=d;n=m=null;if(g!=CCB_TARGETTYPE_NONE)if(e)g==CCB_TARGETTYPE_DOCUMENTROOT?(f.addDocumentOutletName(h),f.addDocumentOutletNode(k)):(this._ownerOutletNames.push(h),this._ownerOutletNodes.push(k));else if(g===CCB_TARGETTYPE_DOCUMENTROOT?m=f.getRootNode():g===CCB_TARGETTYPE_OWNER&&
(m=this._owner),null!=m&&(d=!1,null!=m&&m.onAssignCCBMemberVariable&&(d=m.onAssignCCBMemberVariable(m,h,k)),n=this._ccbMemberVariableAssigner,!d&&null!=n&&n.onAssignCCBMemberVariable))n.onAssignCCBMemberVariable(m,h,k);if(0<c.getCustomProperties().length&&(h=!1,!e&&(m=k,null!=m&&null!=m.onAssignCCBCustomProperty)))for(e=c.getCustomProperties(),f=e.allKeys(),d=0;d<f.length;d++)if(g=e.objectForKey(f[d]),h=m.onAssignCCBCustomProperty(m,f[d],g),n=this._ccbMemberVariableAssigner,!h&&null!=n&&null!=n.onAssignCCBCustomProperty)n.onAssignCCBCustomProperty(m,
f[d],g);this._animatedProps=null;e=this.readInt(!1);for(d=0;d<e;d++)h=this._readNodeGraph(k),k.addChild(h);if(!a)if(null!=k&&k.onNodeLoaded)k.onNodeLoaded(k,c);else if(null!=this._ccNodeLoaderListener)this._ccNodeLoaderListener.onNodeLoaded(k,c);return k},_getBit:function(){var a=0!=(this._data[this._currentByte]&1<<this._currentBit);this._currentBit++;8<=this._currentBit&&(this._currentBit=0,this._currentByte++);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,c,d,e){e=e||cc.BuilderReader.getResourcePath();a=cc.BuilderReader.load(a,c,d,e);c=cc.Scene.create();c.addChild(a);return c};
cc.BuilderReader.load=function(a,c,d,e){e=e||cc.BuilderReader.getResourcePath();var f=new cc.BuilderReader(cc.NodeLoaderLibrary.newDefaultCCNodeLoaderLibrary());f.setCCBRootPath(e);if(5>a.length||a.toLowerCase().lastIndexOf(".ccbi")!=a.length-5)a+=".ccbi";a=f.readNodeGraphFromFile(a,c,d);var g,h,k;if(c){e=f.getOwnerCallbackNames();var m=f.getOwnerCallbackNodes(),n=f.getOwnerCallbackControlEvents();for(d=0;d<e.length;d++)g=e[d],h=m[d],k=n[d],h instanceof cc.ControlButton?h.addTargetWithActionForControlEvents(c,
c[g],k):h.setCallback(c[g],c);e=f.getOwnerOutletNames();m=f.getOwnerOutletNodes();for(d=0;d<e.length;d++)g=e[d],h=m[d],c[g]=h}e=f.getNodesWithAnimationManagers();f=f.getAnimationManagersForNodes();if(!e||!f)return a;for(d=0;d<e.length;d++){var p=e[d],m=f[d];p.animationManager=m;if(g=m.getDocumentControllerName()){if(-1<g.indexOf(".")){h=g.split(".");n=_ccbGlobalContext[h[0]];k=1;for(var q=h.length-1;k<q;k++)n=n[h[k]];n=new n[h[h.length-1]]}else n=new _ccbGlobalContext[g];n.controllerName=g;p.controller=
n;n.rootNode=p;for(var q=m.getDocumentCallbackNames(),s=m.getDocumentCallbackNodes(),r=m.getDocumentCallbackControlEvents(),p=0;p<q.length;p++)g=q[p],h=s[p],k=r[p],h instanceof cc.ControlButton?h.addTargetWithActionForControlEvents(n,n[g],k):h.setCallback(n[g],n);k=m.getDocumentOutletNames();q=m.getDocumentOutletNodes();for(p=0;p<k.length;p++)g=k[p],h=q[p],n[g]=h;if(n.onDidLoadFromCCB&&"function"==typeof n.onDidLoadFromCCB)n.onDidLoadFromCCB();g=m.getKeyframeCallbacks();for(p=0;p<g.length;p++)k=g[p].split(":"),
h=k[0],k=k[1],1==h?m.setCallFunc(cc.CallFunc.create(n[k],n),g[p]):2==h&&c&&m.setCallFunc(cc.CallFunc.create(c[k],c),g[p])}}return a};cc.BuilderReader._resourcePath="";cc.BuilderReader.setResourcePath=function(a){cc.BuilderReader._resourcePath=a};cc.BuilderReader.getResourcePath=function(){return cc.BuilderReader._resourcePath};cc.BuilderReader.lastPathComponent=function(a){var c=a.lastIndexOf("/");return-1!=c?a.substring(c+1,a.length-c):a};
cc.BuilderReader.deletePathExtension=function(a){var c=a.lastIndexOf(".");return-1!=c?a.substring(0,c):a};cc.BuilderReader.toLowerCase=function(a){return a.toLowerCase()};cc.BuilderReader.endsWith=function(a,c){return a.length>=c.length?0==a.lastIndexOf(c):!1};cc.BuilderReader.concat=function(a,c){return a+c};var PROPERTY_CCBFILE="ccbFile";cc.BuilderFileLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){return cc.BuilderFile.create()},onHandlePropTypeCCBFile:function(a,c,d,e,f){d==PROPERTY_CCBFILE?a.setCCBFileNode(e):cc.NodeLoader.prototype.onHandlePropTypeCCBFile.call(this,a,c,d,e,f)}});cc.BuilderFileLoader.loader=function(){return new cc.BuilderFileLoader};var PROPERTY_ENABLED="enabled",PROPERTY_SELECTED="selected",PROPERTY_CCCONTROL="ccControl";
cc.ControlLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){},onHandlePropTypeBlockCCControl:function(a,c,d,e,f){d==PROPERTY_CCCONTROL?a.addTargetWithActionForControlEvents(e.target,e.selCCControlHandler,e.controlEvents):cc.NodeLoader.prototype.onHandlePropTypeBlockCCControl.call(this,a,c,d,e,f)},onHandlePropTypeCheck:function(a,c,d,e,f){d==PROPERTY_ENABLED?a.setEnabled(e):d==PROPERTY_SELECTED?a.setSelected(e):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,c,d,e,f)}});
var PROPERTY_ZOOMONTOUCHDOWN="zoomOnTouchDown",PROPERTY_TITLE_NORMAL="title|1",PROPERTY_TITLE_HIGHLIGHTED="title|2",PROPERTY_TITLE_DISABLED="title|3",PROPERTY_TITLECOLOR_NORMAL="titleColor|1",PROPERTY_TITLECOLOR_HIGHLIGHTED="titleColor|2",PROPERTY_TITLECOLOR_DISABLED="titleColor|3",PROPERTY_TITLETTF_NORMAL="titleTTF|1",PROPERTY_TITLETTF_HIGHLIGHTED="titleTTF|2",PROPERTY_TITLETTF_DISABLED="titleTTF|3",PROPERTY_TITLETTFSIZE_NORMAL="titleTTFSize|1",PROPERTY_TITLETTFSIZE_HIGHLIGHTED="titleTTFSize|2",
PROPERTY_TITLETTFSIZE_DISABLED="titleTTFSize|4",PROPERTY_LABELANCHORPOINT="labelAnchorPoint",PROPERTY_PREFEREDSIZE="preferedSize",PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL="backgroundSpriteFrame|1",PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED="backgroundSpriteFrame|2",PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED="backgroundSpriteFrame|3";
cc.ControlButtonLoader=cc.ControlLoader.extend({_createCCNode:function(a,c){return cc.ControlButton.create()},onHandlePropTypeCheck:function(a,c,d,e,f){d==PROPERTY_ZOOMONTOUCHDOWN?a.setZoomOnTouchDown(e):cc.ControlLoader.prototype.onHandlePropTypeCheck.call(this,a,c,d,e,f)},onHandlePropTypeString:function(a,c,d,e,f){d==PROPERTY_TITLE_NORMAL?a.setTitleForState(e,cc.CONTROL_STATE_NORMAL):d==PROPERTY_TITLE_HIGHLIGHTED?a.setTitleForState(e,cc.CONTROL_STATE_HIGHLIGHTED):d==PROPERTY_TITLE_DISABLED?a.setTitleForState(e,
cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeString.call(this,a,c,d,e,f)},onHandlePropTypeFontTTF:function(a,c,d,e,f){d==PROPERTY_TITLETTF_NORMAL?a.setTitleTTFForState(e,cc.CONTROL_STATE_NORMAL):d==PROPERTY_TITLETTF_HIGHLIGHTED?a.setTitleTTFForState(e,cc.CONTROL_STATE_HIGHLIGHTED):d==PROPERTY_TITLETTF_DISABLED?a.setTitleTTFForState(e,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeFontTTF.call(this,a,c,d,e,f)},onHandlePropTypeFloatScale:function(a,c,
d,e,f){d==PROPERTY_TITLETTFSIZE_NORMAL?a.setTitleTTFSizeForState(e,cc.CONTROL_STATE_NORMAL):d==PROPERTY_TITLETTFSIZE_HIGHLIGHTED?a.setTitleTTFSizeForState(e,cc.CONTROL_STATE_HIGHLIGHTED):d==PROPERTY_TITLETTFSIZE_DISABLED?a.setTitleTTFSizeForState(e,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeFloatScale.call(this,a,c,d,e,f)},onHandlePropTypePoint:function(a,c,d,e,f){d==PROPERTY_LABELANCHORPOINT?a.setLabelAnchorPoint(e):cc.ControlLoader.prototype.onHandlePropTypePoint.call(this,
a,c,d,e,f)},onHandlePropTypeSize:function(a,c,d,e,f){d==PROPERTY_PREFEREDSIZE?a.setPreferredSize(e):cc.ControlLoader.prototype.onHandlePropTypeSize.call(this,a,c,d,e,f)},onHandlePropTypeSpriteFrame:function(a,c,d,e,f){d==PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL?null!=e&&a.setBackgroundSpriteFrameForState(e,cc.CONTROL_STATE_NORMAL):d==PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED?null!=e&&a.setBackgroundSpriteFrameForState(e,cc.CONTROL_STATE_HIGHLIGHTED):d==PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED?null!=
e&&a.setBackgroundSpriteFrameForState(e,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,c,d,e,f)},onHandlePropTypeColor3:function(a,c,d,e,f){d==PROPERTY_TITLECOLOR_NORMAL?a.setTitleColorForState(e,cc.CONTROL_STATE_NORMAL):d==PROPERTY_TITLECOLOR_HIGHLIGHTED?a.setTitleColorForState(e,cc.CONTROL_STATE_HIGHLIGHTED):d==PROPERTY_TITLECOLOR_DISABLED?a.setTitleColorForState(e,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeColor3.call(this,
a,c,d,e,f)}});cc.ControlButtonLoader.loader=function(){return new cc.ControlButtonLoader};var PROPERTY_CONTAINER="container",PROPERTY_DIRECTION="direction",PROPERTY_CLIPSTOBOUNDS="clipsToBounds",PROPERTY_BOUNCES="bounces",PROPERTY_SCALE="scale";
cc.ScrollViewLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){return cc.ScrollView.create()},onHandlePropTypeSize:function(a,c,d,e,f){d==PROPERTY_CONTENTSIZE?a.setViewSize(e):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,c,d,e,f)},onHandlePropTypeCCBFile:function(a,c,d,e,f){d==PROPERTY_CONTAINER?(a.setContainer(e),a.updateInset()):cc.NodeLoader.prototype.onHandlePropTypeCCBFile.call(this,a,c,d,e,f)},onHandlePropTypeCheck:function(a,c,d,e,f){d==PROPERTY_CLIPSTOBOUNDS?a.setClippingToBounds(e):
d==PROPERTY_BOUNCES?a.setBounceable(e):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,c,d,e,f)},onHandlePropTypeFloat:function(a,c,d,e,f){d==PROPERTY_SCALE?a.setScale(e):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,c,d,e,f)},onHandlePropTypeIntegerLabeled:function(a,c,d,e,f){d==PROPERTY_DIRECTION?a.setDirection(e):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,c,d,e,f)}});cc.ScrollViewLoader.loader=function(){return new cc.ScrollViewLoader};
var PROPERTY_CONTENTSIZE="contentSize",PROPERTY_SPRITEFRAME="spriteFrame",PROPERTY_COLOR="color",PROPERTY_OPACITY="opacity",PROPERTY_BLENDFUNC="blendFunc",PROPERTY_INSETLEFT="insetLeft",PROPERTY_INSETTOP="insetTop",PROPERTY_INSETRIGHT="insetRight",PROPERTY_INSETBOTTOM="insetBottom";
cc.Scale9SpriteLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){var d=cc.Scale9Sprite.create();d.setAnchorPoint(0,0);return d},onHandlePropTypeColor3:function(a,c,d,e,f){d==PROPERTY_COLOR?255===e.r&&255===e.g&&255===e.b||a.setColor(e):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,c,d,e,f)},onHandlePropTypeByte:function(a,c,d,e,f){d==PROPERTY_OPACITY?a.setOpacity(e):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,c,d,e,f)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){d!=
PROPERTY_BLENDFUNC&&cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,c,d,e,f)},onHandlePropTypeSpriteFrame:function(a,c,d,e,f){d==PROPERTY_SPRITEFRAME?a.setSpriteFrame(e):cc.NodeLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,c,d,e,f)},onHandlePropTypeSize:function(a,c,d,e,f){d!=PROPERTY_CONTENTSIZE&&(d==PROPERTY_PREFEREDSIZE?a.setPreferredSize(e):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,c,d,e,f))},onHandlePropTypeFloat:function(a,c,d,e,f){d==PROPERTY_INSETLEFT?
a.setInsetLeft(e):d==PROPERTY_INSETTOP?a.setInsetTop(e):d==PROPERTY_INSETRIGHT?a.setInsetRight(e):d==PROPERTY_INSETBOTTOM?a.setInsetBottom(e):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,c,d,e,f)}});cc.Scale9SpriteLoader.loader=function(){return new cc.Scale9SpriteLoader};var PROPERTY_FLIP="flip",PROPERTY_DISPLAYFRAME="displayFrame",PROPERTY_COLOR="color",PROPERTY_OPACITY="opacity",PROPERTY_BLENDFUNC="blendFunc";
cc.SpriteLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){return cc.Sprite.create()},onHandlePropTypeColor3:function(a,c,d,e,f){d===PROPERTY_COLOR?255===e.r&&255===e.g&&255===e.b||a.setColor(e):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,c,d,e,f)},onHandlePropTypeByte:function(a,c,d,e,f){d===PROPERTY_OPACITY?a.setOpacity(e):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,c,d,e,f)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){d===PROPERTY_BLENDFUNC?a.setBlendFunc(e):
cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,c,d,e,f)},onHandlePropTypeSpriteFrame:function(a,c,d,e,f){d===PROPERTY_DISPLAYFRAME?e?a.setDisplayFrame(e):cc.log("ERROR: SpriteFrame is null"):cc.NodeLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,c,d,e,f)},onHandlePropTypeFlip:function(a,c,d,e,f){d===PROPERTY_FLIP?(a.setFlippedX(e[0]),a.setFlippedY(e[1])):cc.NodeLoader.prototype.onHandlePropTypeFlip.call(this,a,c,d,e,f)}});cc.SpriteLoader.loader=function(){return new cc.SpriteLoader};
var PROPERTY_TOUCH_ENABLED="touchEnabled",PROPERTY_IS_TOUCH_ENABLED="isTouchEnabled",PROPERTY_ACCELEROMETER_ENABLED="accelerometerEnabled",PROPERTY_IS_ACCELEROMETER_ENABLED="isAccelerometerEnabled",PROPERTY_IS_MOUSE_ENABLED="isMouseEnabled",PROPERTY_MOUSE_ENABLED="mouseEnabled",PROPERTY_KEYBOARD_ENABLED="keyboardEnabled",PROPERTY_IS_KEYBOARD_ENABLED="isKeyboardEnabled";
cc.LayerLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){var d=cc.Layer.create();d.setContentSize(0,0);return d},onHandlePropTypeCheck:function(a,c,d,e,f){d===PROPERTY_TOUCH_ENABLED||d===PROPERTY_IS_TOUCH_ENABLED?a.setTouchEnabled(e):d===PROPERTY_ACCELEROMETER_ENABLED||d===PROPERTY_IS_ACCELEROMETER_ENABLED?a.setAccelerometerEnabled(e):d===PROPERTY_MOUSE_ENABLED||d===PROPERTY_IS_MOUSE_ENABLED?a.setMouseEnabled(e):d===PROPERTY_KEYBOARD_ENABLED||d===PROPERTY_IS_KEYBOARD_ENABLED?a.setKeyboardEnabled&&
"browser"===sys.platform?a.setKeyboardEnabled(e):cc.log("The property '"+PROPERTY_IS_KEYBOARD_ENABLED+"' is not supported!"):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,c,d,e,f)}});cc.LayerLoader.loader=function(){return new cc.LayerLoader};
cc.LayerColorLoader=cc.LayerLoader.extend({_createCCNode:function(a,c){return cc.LayerColor.create()},onHandlePropTypeColor3:function(a,c,d,e,f){d===PROPERTY_COLOR?a.setColor(e):cc.LayerLoader.prototype.onHandlePropTypeColor3.call(this,a,c,d,e,f)},onHandlePropTypeByte:function(a,c,d,e,f){d===PROPERTY_OPACITY?a.setOpacity(e):cc.LayerLoader.prototype.onHandlePropTypeByte.call(this,a,c,d,e,f)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){d===PROPERTY_BLENDFUNC?a.setBlendFunc(e):cc.LayerLoader.prototype.onHandlePropTypeBlendFunc.call(this,
a,c,d,e,f)}});cc.LayerColorLoader.loader=function(){return new cc.LayerColorLoader};var PROPERTY_STARTCOLOR="startColor",PROPERTY_ENDCOLOR="endColor",PROPERTY_STARTOPACITY="startOpacity",PROPERTY_ENDOPACITY="endOpacity",PROPERTY_VECTOR="vector";
cc.LayerGradientLoader=cc.LayerLoader.extend({_createCCNode:function(a,c){return cc.LayerGradient.create()},onHandlePropTypeColor3:function(a,c,d,e,f){d===PROPERTY_STARTCOLOR?a.setStartColor(e):d==PROPERTY_ENDCOLOR?a.setEndColor(e):cc.LayerLoader.prototype.onHandlePropTypeColor3.call(this,a,c,d,e,f)},onHandlePropTypeByte:function(a,c,d,e,f){d===PROPERTY_STARTOPACITY?a.setStartOpacity(e):d===PROPERTY_ENDOPACITY?a.setEndOpacity(e):cc.LayerLoader.prototype.onHandlePropTypeByte.call(this,a,c,d,e,f)},
onHandlePropTypePoint:function(a,c,d,e,f){d===PROPERTY_VECTOR?a.setVector(e):cc.LayerLoader.prototype.onHandlePropTypePoint.call(this,a,c,d,e,f)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){d===PROPERTY_BLENDFUNC?a.setBlendFunc(e):cc.LayerLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,c,d,e,f)}});cc.LayerGradientLoader.loader=function(){return new cc.LayerGradientLoader};cc.MenuLoader=cc.LayerLoader.extend({_createCCNode:function(a,c){var d=cc.Menu.create();d.setContentSize(0,0);return d}});
cc.MenuLoader.loader=function(){return new cc.MenuLoader};var PROPERTY_BLOCK="block",PROPERTY_ISENABLED="isEnabled";
cc.MenuItemLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){return null},onHandlePropTypeBlock:function(a,c,d,e,f){d===PROPERTY_BLOCK?null!=e&&a.setTarget(e.selMenuHander,e.target):cc.NodeLoader.prototype.onHandlePropTypeBlock.call(this,a,c,d,e,f)},onHandlePropTypeCheck:function(a,c,d,e,f){d===PROPERTY_ISENABLED?a.setEnabled(e):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,c,d,e,f)}});
var PROPERTY_NORMALDISPLAYFRAME="normalSpriteFrame",PROPERTY_SELECTEDDISPLAYFRAME="selectedSpriteFrame",PROPERTY_DISABLEDDISPLAYFRAME="disabledSpriteFrame";
cc.MenuItemImageLoader=cc.MenuItemLoader.extend({_createCCNode:function(a,c){return cc.MenuItemImage.create()},onHandlePropTypeSpriteFrame:function(a,c,d,e,f){d===PROPERTY_NORMALDISPLAYFRAME?null!=e&&a.setNormalSpriteFrame(e):d===PROPERTY_SELECTEDDISPLAYFRAME?null!=e&&a.setSelectedSpriteFrame(e):d===PROPERTY_DISABLEDDISPLAYFRAME?null!=e&&a.setDisabledSpriteFrame(e):cc.MenuItemLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,c,d,e,f)}});cc.MenuItemImageLoader.loader=function(){return new cc.MenuItemImageLoader};
var PROPERTY_FONTNAME="fontName",PROPERTY_FONTSIZE="fontSize",PROPERTY_HORIZONTALALIGNMENT="horizontalAlignment",PROPERTY_VERTICALALIGNMENT="verticalAlignment",PROPERTY_STRING="string",PROPERTY_DIMENSIONS="dimensions";
cc.LabelTTFLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){return cc.LabelTTF.create()},onHandlePropTypeColor3:function(a,c,d,e,f){d===PROPERTY_COLOR?255===e.r&&255===e.g&&255===e.b||a.setColor(e):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,c,d,e,f)},onHandlePropTypeByte:function(a,c,d,e,f){d===PROPERTY_OPACITY?a.setOpacity(e):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,c,d,e,f)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){d===PROPERTY_BLENDFUNC?a.setBlendFunc(e):
cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,c,d,e,f)},onHandlePropTypeFontTTF:function(a,c,d,e,f){d===PROPERTY_FONTNAME?a.setFontName(e):cc.NodeLoader.prototype.onHandlePropTypeFontTTF.call(this,a,c,d,e,f)},onHandlePropTypeText:function(a,c,d,e,f){d===PROPERTY_STRING?a.setString(e):cc.NodeLoader.prototype.onHandlePropTypeText.call(this,a,c,d,e,f)},onHandlePropTypeFloatScale:function(a,c,d,e,f){d===PROPERTY_FONTSIZE?a.setFontSize(e):cc.NodeLoader.prototype.onHandlePropTypeFloatScale.call(this,
a,c,d,e,f)},onHandlePropTypeIntegerLabeled:function(a,c,d,e,f){d===PROPERTY_HORIZONTALALIGNMENT?a.setHorizontalAlignment(e):d===PROPERTY_VERTICALALIGNMENT?a.setVerticalAlignment(e):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,c,d,e,f)},onHandlePropTypeSize:function(a,c,d,e,f){d===PROPERTY_DIMENSIONS?a.setDimensions(e):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,c,d,e,f)}});cc.LabelTTFLoader.loader=function(){return new cc.LabelTTFLoader};var PROPERTY_FNTFILE="fntFile";
cc.LabelBMFontLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){return cc.LabelBMFont.create()},onHandlePropTypeColor3:function(a,c,d,e,f){d===PROPERTY_COLOR?255===e.r&&255===e.g&&255===e.b||a.setColor(e):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,c,d,e,f)},onHandlePropTypeByte:function(a,c,d,e,f){d===PROPERTY_OPACITY?a.setOpacity(e):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,c,d,e,f)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){d===PROPERTY_BLENDFUNC?a.setBlendFunc(e):
cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,c,d,e,f)},onHandlePropTypeFntFile:function(a,c,d,e,f){d===PROPERTY_FNTFILE?a.setFntFile(e):cc.NodeLoader.prototype.onHandlePropTypeFntFile.call(this,a,c,d,e,f)},onHandlePropTypeText:function(a,c,d,e,f){d===PROPERTY_STRING?a.setString(e):cc.NodeLoader.prototype.onHandlePropTypeText.call(this,a,c,d,e,f)}});cc.LabelBMFontLoader.loader=function(){return new cc.LabelBMFontLoader};
var PROPERTY_EMITERMODE="emitterMode",PROPERTY_POSVAR="posVar",PROPERTY_EMISSIONRATE="emissionRate",PROPERTY_DURATION="duration",PROPERTY_TOTALPARTICLES="totalParticles",PROPERTY_LIFE="life",PROPERTY_STARTSIZE="startSize",PROPERTY_ENDSIZE="endSize",PROPERTY_STARTSPIN="startSpin",PROPERTY_ENDSPIN="endSpin",PROPERTY_ANGLE="angle",PROPERTY_GRAVITY="gravity",PROPERTY_SPEED="speed",PROPERTY_TANGENTIALACCEL="tangentialAccel",PROPERTY_RADIALACCEL="radialAccel",PROPERTY_TEXTURE="texture",PROPERTY_STARTRADIUS=
"startRadius",PROPERTY_ENDRADIUS="endRadius",PROPERTY_ROTATEPERSECOND="rotatePerSecond";
cc.ParticleSystemLoader=cc.NodeLoader.extend({_createCCNode:function(a,c){return cc.ParticleSystem.create()},onHandlePropTypeIntegerLabeled:function(a,c,d,e,f){d===PROPERTY_EMITERMODE?a.setEmitterMode(e):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,c,d,e,f)},onHandlePropTypePoint:function(a,c,d,e,f){d===PROPERTY_POSVAR?a.setPosVar(e):d===PROPERTY_GRAVITY?a.setGravity(e):cc.NodeLoader.prototype.onHandlePropTypePoint.call(this,a,c,d,e,f)},onHandlePropTypeFloat:function(a,c,d,e,
f){d===PROPERTY_EMISSIONRATE?a.setEmissionRate(e):d===PROPERTY_DURATION?a.setDuration(e):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,c,d,e,f)},onHandlePropTypeInteger:function(a,c,d,e,f){d===PROPERTY_TOTALPARTICLES?a.setTotalParticles(e):cc.NodeLoader.prototype.onHandlePropTypeInteger.call(this,a,c,d,e,f)},onHandlePropTypeFloatVar:function(a,c,d,e,f){d===PROPERTY_LIFE?(a.setLife(e[0]),a.setLifeVar(e[1])):d===PROPERTY_STARTSIZE?(a.setStartSize(e[0]),a.setStartSizeVar(e[1])):d===PROPERTY_ENDSIZE?
(a.setEndSize(e[0]),a.setEndSizeVar(e[1])):d===PROPERTY_STARTSPIN?(a.setStartSpin(e[0]),a.setStartSpinVar(e[1])):d===PROPERTY_ENDSPIN?(a.setEndSpin(e[0]),a.setEndSpinVar(e[1])):d===PROPERTY_ANGLE?(a.setAngle(e[0]),a.setAngleVar(e[1])):d===PROPERTY_SPEED?(a.setSpeed(e[0]),a.setSpeedVar(e[1])):d===PROPERTY_TANGENTIALACCEL?(a.setTangentialAccel(e[0]),a.setTangentialAccelVar(e[1])):d===PROPERTY_RADIALACCEL?(a.setRadialAccel(e[0]),a.setRadialAccelVar(e[1])):d===PROPERTY_STARTRADIUS?(a.setStartRadius(e[0]),
a.setStartRadiusVar(e[1])):d===PROPERTY_ENDRADIUS?(a.setEndRadius(e[0]),a.setEndRadiusVar(e[1])):d===PROPERTY_ROTATEPERSECOND?(a.setRotatePerSecond(e[0]),a.setRotatePerSecondVar(e[1])):cc.NodeLoader.prototype.onHandlePropTypeFloatVar.call(this,a,c,d,e,f)},onHandlePropTypeColor4FVar:function(a,c,d,e,f){d===PROPERTY_STARTCOLOR?(a.setStartColor(e[0]),a.setStartColorVar(e[1])):d===PROPERTY_ENDCOLOR?(a.setEndColor(e[0]),a.setEndColorVar(e[1])):cc.NodeLoader.prototype.onHandlePropTypeColor4FVar.call(this,
a,c,d,e,f)},onHandlePropTypeBlendFunc:function(a,c,d,e,f){d===PROPERTY_BLENDFUNC?a.setBlendFunc(e):cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,c,d,e,f)},onHandlePropTypeTexture:function(a,c,d,e,f){d===PROPERTY_TEXTURE?a.setTexture(e):cc.NodeLoader.prototype.onHandlePropTypeTexture.call(this,a,c,d,e,f)}});cc.ParticleSystemLoader.loader=function(){return new cc.ParticleSystemLoader};cc.NodeLoaderLibrary=cc.Class.extend({_ccNodeLoaders:null,ctor:function(){this._ccNodeLoaders={}},registerDefaultCCNodeLoaders:function(){this.registerCCNodeLoader("CCNode",cc.NodeLoader.loader());this.registerCCNodeLoader("CCLayer",cc.LayerLoader.loader());this.registerCCNodeLoader("CCLayerColor",cc.LayerColorLoader.loader());this.registerCCNodeLoader("CCLayerGradient",cc.LayerGradientLoader.loader());this.registerCCNodeLoader("CCSprite",cc.SpriteLoader.loader());this.registerCCNodeLoader("CCLabelBMFont",
cc.LabelBMFontLoader.loader());this.registerCCNodeLoader("CCLabelTTF",cc.LabelTTFLoader.loader());this.registerCCNodeLoader("CCScale9Sprite",cc.Scale9SpriteLoader.loader());this.registerCCNodeLoader("CCScrollView",cc.ScrollViewLoader.loader());this.registerCCNodeLoader("CCBFile",cc.BuilderFileLoader.loader());this.registerCCNodeLoader("CCMenu",cc.MenuLoader.loader());this.registerCCNodeLoader("CCMenuItemImage",cc.MenuItemImageLoader.loader());this.registerCCNodeLoader("CCControlButton",cc.ControlButtonLoader.loader());
this.registerCCNodeLoader("CCParticleSystemQuad",cc.ParticleSystemLoader.loader())},registerCCNodeLoader:function(a,c){this._ccNodeLoaders[a]=c},unregisterCCNodeLoader:function(a){this._ccNodeLoaders[a]&&delete this._ccNodeLoaders[a]},getCCNodeLoader:function(a){return this._ccNodeLoaders[a]?this._ccNodeLoaders[a]:null},purge:function(a){if(a)for(var c in this._ccNodeLoaders)delete this._ccNodeLoaders[c];this._ccNodeLoaders={}}});cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary=null;
cc.NodeLoaderLibrary.library=function(){return new cc.NodeLoaderLibrary};cc.NodeLoaderLibrary.sharedCCNodeLoaderLibrary=function(){null==cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary&&(cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary=new cc.NodeLoaderLibrary,cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary.registerDefaultCCNodeLoaders());return cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary};
cc.NodeLoaderLibrary.purgeSharedCCNodeLoaderLibrary=function(){cc.NodeLoaderLibrary.sSharedCCNodeLoaderLibrary=null};cc.NodeLoaderLibrary.newDefaultCCNodeLoaderLibrary=function(){var a=cc.NodeLoaderLibrary.library();a.registerDefaultCCNodeLoaders();return a};cc.getAbsolutePosition=function(a,c,d,e){e=cc.p(0,0);c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT?e=a:c===CCB_POSITIONTYPE_RELATIVE_TOP_LEFT?(e.x=a.x,e.y=d.height-a.y):c===CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT?(e.x=d.width-a.x,e.y=d.height-a.y):c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT?(e.x=d.width-a.x,e.y=a.y):c===CCB_POSITIONTYPE_PERCENT?(e.x=d.width*a.x/100,e.y=d.height*a.y/100):c===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(c=cc.BuilderReader.getResolutionScale(),e.x=a.x*c,e.y=a.y*c);return e};
cc._getAbsolutePosition=function(a,c,d,e,f){f=cc.p(0,0);d===CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT?(f.x=a,f.y=c):d===CCB_POSITIONTYPE_RELATIVE_TOP_LEFT?(f.x=a,f.y=e.height-c):d===CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT?(f.x=e.width-a,f.y=e.height-c):d===CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT?(f.x=e.width-a,f.y=c):d===CCB_POSITIONTYPE_PERCENT?(f.x=e.width*a/100,f.y=e.height*c/100):d===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(d=cc.BuilderReader.getResolutionScale(),f.x=a*d,f.y=c*d);return f};
cc.setRelativeScale=function(a,c,d,e,f){if(!a)throw"cc.setRelativeScale(): node should be non-null";e===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(e=cc.BuilderReader.getResolutionScale(),c*=e,d*=e);a.setScaleX(c);a.setScaleY(d)};cc.BuilderAnimationManagerDelegate=cc.Class.extend({completedAnimationSequenceNamed:function(a){}});
cc.BuilderAnimationManager=cc.Class.extend({_sequences:null,_nodeSequences:null,_baseValues:null,_autoPlaySequenceId:0,_rootNode:null,_owner:null,_rootContainerSize:null,_delegate:null,_runningSequence:null,_documentOutletNames:null,_documentOutletNodes:null,_documentCallbackNames:null,_documentCallbackNodes:null,_documentCallbackControlEvents:null,_documentControllerName:"",_lastCompletedSequenceName:"",_keyframeCallbacks:null,_keyframeCallFuncs:null,_animationCompleteCallbackFunc:null,_target:null,
_jsControlled:!1,ctor:function(){this._rootContainerSize=cc.size(0,0);this.init()},init:function(){this._sequences=[];this._nodeSequences=new cc._Dictionary;this._baseValues=new cc._Dictionary;this._documentOutletNames=[];this._documentOutletNodes=[];this._documentCallbackNames=[];this._documentCallbackNodes=[];this._documentCallbackControlEvents=[];this._keyframeCallbacks=[];this._keyframeCallFuncs={};return!0},getSequences:function(){return this._sequences},setSequences:function(a){this._sequences=
a},getAutoPlaySequenceId:function(){return this._autoPlaySequenceId},setAutoPlaySequenceId:function(a){this._autoPlaySequenceId=a},getRootNode:function(){return this._rootNode},setRootNode:function(a){this._rootNode=a},getOwner:function(){return this._owner},setOwner:function(a){this._owner=a},addDocumentCallbackNode:function(a){this._documentCallbackNodes.push(a)},addDocumentCallbackName:function(a){this._documentCallbackNames.push(a)},addDocumentCallbackControlEvents:function(a){this._documentCallbackControlEvents.push(a)},
addDocumentOutletNode:function(a){this._documentOutletNodes.push(a)},addDocumentOutletName:function(a){this._documentOutletNames.push(a)},setDocumentControllerName:function(a){this._documentControllerName=a},getDocumentControllerName:function(){return this._documentControllerName},getDocumentCallbackNames:function(){return this._documentCallbackNames},getDocumentCallbackNodes:function(){return this._documentCallbackNodes},getDocumentCallbackControlEvents:function(){return this._documentCallbackControlEvents},
getDocumentOutletNames:function(){return this._documentOutletNames},getDocumentOutletNodes:function(){return this._documentOutletNodes},getLastCompletedSequenceName:function(){return this._lastCompletedSequenceName},getKeyframeCallbacks:function(){return this._keyframeCallbacks},getRootContainerSize:function(){return this._rootContainerSize},setRootContainerSize:function(a){this._rootContainerSize=cc.size(a.width,a.height)},getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=
a},getRunningSequenceName:function(){return this._runningSequence?this._runningSequence.getName():null},getContainerSize:function(a){return a?a.getContentSize():this._rootContainerSize},addNode:function(a,c){this._nodeSequences.setObject(c,a)},setBaseValue:function(a,c,d){var e=this._baseValues.objectForKey(c);e||(e=new cc._Dictionary,this._baseValues.setObject(e,c));e.setObject(a,d)},moveAnimationsFromNode:function(a,c){var d=this._baseValues,e=d.objectForKey(a);null!=e&&(d.setObject(e,c),d.removeObjectForKey(a));
d=this._nodeSequences;e=d.objectForKey(a);null!=e&&(d.setObject(e,c),d.removeObjectForKey(a))},getActionForCallbackChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;f<e;++f){var g=a[f],h=g.getTime()-c,c=g.getTime();0<h&&d.push(cc.DelayTime.create(h));h=g.getValue();g=h[0];h=h[1];if(this._jsControlled)g=this._keyframeCallFuncs[h+":"+g],null!=g&&d.push(g);else{var k;h==CCB_TARGETTYPE_DOCUMENTROOT?k=this._rootNode:h==CCB_TARGETTYPE_OWNER&&(k=this._owner);if(null!=k)if(0<g.length){var h=
0,m=k;null!=k.onResolveCCBCCCallFuncSelector&&(h=m.onResolveCCBCCCallFuncSelector(k,g));0==h?cc.log("Skipping selector '"+g+"' since no CCBSelectorResolver is present."):d.push(cc.CallFunc.create(h,k))}else cc.log("Unexpected empty selector.")}}return 1>d.length?null:cc.Sequence.create(d)},getActionForSoundChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;f<e;++f){var g=a[f],h=g.getTime()-c,c=g.getTime();0<h&&d.push(cc.DelayTime.create(h));var k=g.getValue(),g=cc.BuilderReader.getResourcePath()+
k[0],h=parseFloat(k[1]),m=parseFloat(k[2]),k=parseFloat(k[3]);d.push(cc.BuilderSoundEffect.create(g,h,m,k))}return 1>d.length?null:cc.Sequence.create(d)},runAnimationsForSequenceNamed:function(a){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),0)},runAnimationsForSequenceNamedTweenDuration:function(a,c){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),c)},runAnimationsForSequenceIdTweenDuration:function(a,c){if(-1===a)throw"cc.BuilderAnimationManager.runAnimationsForSequenceIdTweenDuration(): Sequence id should not be -1";
c=c||0;this._rootNode.stopAllActions();for(var d=this._nodeSequences.allKeys(),e=0,f=d.length;e<f;e++){var g=d[e];g.stopAllActions();var h=this._nodeSequences.objectForKey(g).objectForKey(a),k,m=[];if(h){var n=h.allKeys();for(k=0;k<n.length;k++){var p=n[k],q=h.objectForKey(p);m.push(p);this._setFirstFrame(g,q,c);this._runAction(g,q,c)}}if(h=this._baseValues.objectForKey(g))for(n=h.allKeys(),k=0;k<n.length;k++)p=n[k],-1==m.indexOf(p)&&(q=h.objectForKey(p),null!=q&&this._setAnimatedProperty(p,g,q,c))}d=
this._getSequence(a);e=cc.Sequence.create(cc.DelayTime.create(d.getDuration()+c),cc.CallFunc.create(this._sequenceCompleted,this));this._rootNode.runAction(e);d.getCallbackChannel()&&(e=this.getActionForCallbackChannel(d.getCallbackChannel()))&&this._rootNode.runAction(e);d.getSoundChannel()&&(e=this.getActionForSoundChannel(d.getSoundChannel()))&&this._rootNode.runAction(e);this._runningSequence=this._getSequence(a)},runAnimations:function(a,c){c=c||0;var d;d="string"===typeof a?this._getSequenceId(a):
a;this.runAnimationsForSequenceIdTweenDuration(d,c)},setAnimationCompletedCallback:function(a,c){this._target=a;this._animationCompleteCallbackFunc=c},setCompletedAnimationCallback:function(a,c){this.setAnimationCompletedCallback(a,c)},setCallFunc:function(a,c){this._keyframeCallFuncs[c]=a},debug:function(){},_getBaseValue:function(a,c){var d=this._baseValues.objectForKey(a);return d?d.objectForKey(c):null},_getSequenceId:function(a){for(var c=null,d=this._sequences,e=0,f=d.length;e<f;e++)if((c=d[e])&&
c.getName()===a)return c.getSequenceId();return-1},_getSequence:function(a){for(var c=null,d=this._sequences,e=0,f=d.length;e<f;e++)if((c=d[e])&&c.getSequenceId()===a)return c;return null},_getAction:function(a,c,d,e){a=c.getTime()-(a?a.getTime():0);var f,g;if("rotation"===d)return cc.BuilderRotateTo.create(a,c.getValue());if("rotationX"===d)return cc.BuilderRotateXTo.create(a,c.getValue());if("rotationY"===d)return cc.BuilderRotateYTo.create(a,c.getValue());if("opacity"===d)return cc.FadeTo.create(a,
c.getValue());if("color"===d)return d=c.getValue().getColor(),cc.TintTo.create(a,d.r,d.g,d.b);if("visible"===d)return c.getValue()?cc.Sequence.create(cc.DelayTime.create(a),cc.Show.create()):cc.Sequence.create(cc.DelayTime.create(a),cc.Hide.create());if("displayFrame"===d)return cc.Sequence.create(cc.DelayTime.create(a),cc.BuilderSetSpriteFrame.create(c.getValue()));if("position"===d)return f=this._getBaseValue(e,d),f=f[2],g=c.getValue(),c=g[0],g=g[1],e=this.getContainerSize(e.getParent()),d=cc._getAbsolutePosition(c,
g,f,e,d),cc.MoveTo.create(a,d);if("scale"===d)return f=this._getBaseValue(e,d),f=f[2],g=c.getValue(),c=g[0],g=g[1],f===CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(d=cc.BuilderReader.getResolutionScale(),c*=d,g*=d),cc.ScaleTo.create(a,c,g);if("skew"===d)return g=c.getValue(),c=g[0],g=g[1],cc.SkewTo.create(a,c,g);cc.log("BuilderReader: Failed to create animation for property: "+d);return null},_setAnimatedProperty:function(a,c,d,e){if(0<e){var f=new cc.BuilderKeyframe;f.setValue(d);f.setTime(e);f.setEasingType(CCB_KEYFRAME_EASING_LINEAR);
a=this._getAction(null,f,a,c);c.runAction(a)}else"position"===a?(e=this._getBaseValue(c,a),e=e[2],f=d[0],d=d[1],c.setPosition(cc._getAbsolutePosition(f,d,e,this.getContainerSize(c.getParent()),a))):"scale"===a?(e=this._getBaseValue(c,a),e=e[2],f=d[0],d=d[1],cc.setRelativeScale(c,f,d,e,a)):"skew"===a?(f=d[0],d=d[1],c.setSkewX(f),c.setSkewY(d)):"rotation"===a?c.setRotation(d):"opacity"===a?c.setOpacity(d):"displayFrame"===a?c.setDisplayFrame(d):"color"===a?(a=d.getColor(),255===a.r&&255===a.g&&255===
a.b||c.setColor(a)):"visible"===a?c.setVisible(d||!1):cc.log("unsupported property name is "+a)},_setFirstFrame:function(a,c,d){var e=c.getKeyframes();0===e.length?((e=this._getBaseValue(a,c.getName()))||cc.log("cc.BuilderAnimationManager._setFirstFrame(): No baseValue found for property"),this._setAnimatedProperty(c.getName(),a,e,d)):(e=e[0],this._setAnimatedProperty(c.getName(),a,e.getValue(),d))},_getEaseAction:function(a,c,d){if(c===CCB_KEYFRAME_EASING_LINEAR||c===CCB_KEYFRAME_EASING_INSTANT)return a;
if(c===CCB_KEYFRAME_EASING_CUBIC_IN)return cc.EaseIn.create(a,d);if(c===CCB_KEYFRAME_EASING_CUBIC_OUT)return cc.EaseOut.create(a,d);if(c===CCB_KEYFRAME_EASING_CUBIC_INOUT)return cc.EaseInOut.create(a,d);if(c===CCB_KEYFRAME_EASING_BACK_IN)return cc.EaseBackIn.create(a);if(c===CCB_KEYFRAME_EASING_BACK_OUT)return cc.EaseBackOut.create(a);if(c===CCB_KEYFRAME_EASING_BACK_INOUT)return cc.EaseBackInOut.create(a);if(c===CCB_KEYFRAME_EASING_BOUNCE_IN)return cc.EaseBounceIn.create(a);if(c===CCB_KEYFRAME_EASING_BOUNCE_OUT)return cc.EaseBounceOut.create(a);
if(c===CCB_KEYFRAME_EASING_BOUNCE_INOUT)return cc.EaseBounceInOut.create(a);if(c===CCB_KEYFRAME_EASING_ELASTIC_IN)return cc.EaseElasticIn.create(a,d);if(c===CCB_KEYFRAME_EASING_ELASTIC_OUT)return cc.EaseElasticOut.create(a,d);if(c===CCB_KEYFRAME_EASING_ELASTIC_INOUT)return cc.EaseElasticInOut.create(a,d);cc.log("BuilderReader: Unkown easing type "+c);return a},_runAction:function(a,c,d){var e=c.getKeyframes(),f=e.length;if(1<f){var g=[];d=e[0].getTime()+d;0<d&&g.push(cc.DelayTime.create(d));for(d=
0;d<f-1;++d){var h=e[d],k=this._getAction(h,e[d+1],c.getName(),a);k&&(k=this._getEaseAction(k,h.getEasingType(),h.getEasingOpt()),g.push(k))}c=cc.Sequence.create(g);a.runAction(c)}},_sequenceCompleted:function(){var a=this._runningSequence,c=a.getName();this._lastCompletedSequenceName!=a.getName()&&(this._lastCompletedSequenceName=a.getName());a=a.getChainedSequenceId();this._runningSequence=null;-1!=a&&this.runAnimations(a,0);this._delegate&&this._delegate.completedAnimationSequenceNamed(c);this._target&&
this._animationCompleteCallbackFunc&&this._animationCompleteCallbackFunc.call(this._target)}});cc.BuilderSetSpriteFrame=cc.ActionInstant.extend({_spriteFrame:null,initWithSpriteFrame:function(a){this._spriteFrame=a;return!0},update:function(a){this._target.setDisplayFrame(this._spriteFrame)}});cc.BuilderSetSpriteFrame.create=function(a){var c=new cc.BuilderSetSpriteFrame;return c&&c.initWithSpriteFrame(a)?c:null};
cc.BuilderRotateTo=cc.ActionInterval.extend({_startAngle:0,_dstAngle:0,_diffAngle:0,initWithDuration:function(a,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._dstAngle=c,!0):!1},update:function(a){this._target.setRotation(this._startAngle+this._diffAngle*a)},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startAngle=this._target.getRotation();this._diffAngle=this._dstAngle-this._startAngle}});
cc.BuilderRotateTo.create=function(a,c){var d=new cc.BuilderRotateTo;return d&&d.initWithDuration(a,c)?d:null};cc.BuilderRotateXTo=cc.ActionInterval.extend({});cc.BuilderRotateXTo.create=function(a,c){throw"rotationX has not been implemented in cocos2d-html5";};cc.BuilderRotateYTo=cc.ActionInterval.extend({});cc.BuilderRotateYTo.create=function(a,c){throw"rotationY has not been implemented in cocos2d-html5";};cc.BuilderSoundEffect=cc.ActionInstant.extend({init:function(a){this._file=a;return!0},update:function(a){cc.AudioEngine.getInstance().playEffect(this._file)}});
cc.BuilderSoundEffect.create=function(a,c,d,e){return(c=new cc.BuilderSoundEffect)&&c.init(a)?c:null};cc.RGBA=function(a,c,d,e){this.r=a;this.g=c;this.b=d;this.a=e};cc.HSV=function(a,c,d){this.h=a;this.s=c;this.v=d};cc.ControlUtils={};cc.ControlUtils.addSpriteToTargetWithPosAndAnchor=function(a,c,d,e){a=cc.Sprite.createWithSpriteFrameName(a);if(!a)return null;a.setPosition(d);a.setAnchorPoint(e);c.addChild(a);return a};
cc.ControlUtils.HSVfromRGB=function(a){var c=new cc.HSV,d,e;d=a.r<a.g?a.r:a.g;d=d<a.b?d:a.b;e=a.r>a.g?a.r:a.g;e=e>a.b?e:a.b;c.v=e;d=e-d;if(0<e)c.s=d/e;else return c.s=0,c.h=-1,c;c.h=a.r>=e?(a.g-a.b)/d:a.g>=e?2+(a.b-a.r)/d:4+(a.r-a.g)/d;c.h*=60;0>c.h&&(c.h+=360);return c};
cc.ControlUtils.RGBfromHSV=function(a){var c,d,e,f,g=new cc.RGBA;g.a=1;if(0>=a.s){if(!a.h)return g.r=a.v,g.g=a.v,g.b=a.v,g;g.r=0;g.g=0;g.b=0;return g}c=a.h;360<=c&&(c=0);c/=60;f=0|c;e=c-f;c=a.v*(1-a.s);d=a.v*(1-a.s*e);e=a.v*(1-a.s*(1-e));switch(f){case 0:g.r=a.v;g.g=e;g.b=c;break;case 1:g.r=d;g.g=a.v;g.b=c;break;case 2:g.r=c;g.g=a.v;g.b=e;break;case 3:g.r=c;g.g=d;g.b=a.v;break;case 4:g.r=e;g.g=c;g.b=a.v;break;default:g.r=a.v,g.g=c,g.b=d}return g};
cc.ControlUtils.CCRectUnion=function(a,c){return cc.rectUnion(a,c)};cc.CONTROL_EVENT_TOTAL_NUMBER=9;cc.CONTROL_EVENT_TOUCH_DOWN=1;cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE=2;cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE=4;cc.CONTROL_EVENT_TOUCH_DRAG_ENTER=8;cc.CONTROL_EVENT_TOUCH_DRAG_EXIT=16;cc.CONTROL_EVENT_TOUCH_UP_INSIDE=32;cc.CONTROL_EVENT_TOUCH_UP_OUTSIDE=64;cc.CONTROL_EVENT_TOUCH_CANCEL=128;cc.CONTROL_EVENT_VALUECHANGED=256;cc.CONTROL_STATE_NORMAL=1;cc.CONTROL_STATE_HIGHLIGHTED=2;cc.CONTROL_STATE_DISABLED=4;cc.CONTROL_STATE_SELECTED=8;cc.CONTROL_STATE_INITIAL=8;
cc.Control=cc.LayerRGBA.extend({_isOpacityModifyRGB:!1,_hasVisibleParents:!1,isOpacityModifyRGB:function(){return this._isOpacityModifyRGB},setOpacityModifyRGB:function(a){this._isOpacityModifyRGB=a;for(var c=this.getChildren(),d=0,e=c.length;d<e;d++){var f=c[d];f&&f.RGBAProtocol&&f.setOpacityModifyRGB(a)}},_state:cc.CONTROL_STATE_NORMAL,getState:function(){return this._state},_enabled:!1,_selected:!1,_highlighted:!1,_dispatchTable:null,setEnabled:function(a){this._state=(this._enabled=a)?cc.CONTROL_STATE_NORMAL:
cc.CONTROL_STATE_DISABLED;this.needsLayout()},isEnabled:function(){return this._enabled},setSelected:function(a){this._selected=a;this.needsLayout()},isSelected:function(){return this._selected},setHighlighted:function(a){this._highlighted=a;this.needsLayout()},isHighlighted:function(){return this._highlighted},hasVisibleParents:function(){for(var a=this.getParent();null!=a;a=a.getParent())if(!a.isVisible())return!1;return!0},ctor:function(){cc.LayerRGBA.prototype.ctor.call(this);this._dispatchTable=
{};this._color=cc.white()},init:function(){return cc.LayerRGBA.prototype.init.call(this)?(this._state=cc.CONTROL_STATE_NORMAL,this._enabled=!0,this._highlighted=this._selected=!1,this._defaultTouchPriority=1,this.setTouchPriority(1),!0):!1},registerWithTouchDispatcher:function(){cc.registerTargetedDelegate(this.getTouchPriority(),!0,this)},sendActionsForControlEvents:function(a){for(var c=0,d=cc.CONTROL_EVENT_TOTAL_NUMBER;c<d;c++)if(a&1<<c)for(var e=this._dispatchListforControlEvent(1<<c),f=0,g=e.length;f<
g;f++)e[f].invoke(this)},addTargetWithActionForControlEvents:function(a,c,d){for(var e=0,f=cc.CONTROL_EVENT_TOTAL_NUMBER;e<f;e++)d&1<<e&&this._addTargetWithActionForControlEvent(a,c,1<<e)},removeTargetWithActionForControlEvents:function(a,c,d){for(var e=0,f=cc.CONTROL_EVENT_TOTAL_NUMBER;e<f;e++)d&1<<e&&this._removeTargetWithActionForControlEvent(a,c,1<<e)},getTouchLocation:function(a){a=a.getLocation();return this.convertToNodeSpace(a)},isTouchInside:function(a){a=a.getLocation();a=this.getParent().convertToNodeSpace(a);
return cc.rectContainsPoint(this.getBoundingBox(),a)},_invocationWithTargetAndActionForControlEvent:function(a,c,d){return null},_dispatchListforControlEvent:function(a){a=a.toString();this._dispatchTable[a]||(this._dispatchTable[a]=[]);return this._dispatchTable[a]},_addTargetWithActionForControlEvent:function(a,c,d){a=new cc.Invocation(a,c,d);this._dispatchListforControlEvent(d).push(a)},_removeTargetWithActionForControlEvent:function(a,c,d){d=this._dispatchListforControlEvent(d);if(a||c)for(var e=
0;e<d.length;){var f=d[e],g=!0;a&&(g=a==f.getTarget());c&&(g=g&&c==f.getAction());g?cc.ArrayRemoveObject(d,f):e++}else d.length=0},needsLayout:function(){}});cc.Control.create=function(){var a=new cc.Control;return a&&a.init()?a:null};cc.CONTROL_ZOOM_ACTION_TAG=3435855873;
cc.ControlButton=cc.Control.extend({_doesAdjustBackgroundImage:!1,_zoomOnTouchDown:!1,_preferredSize:null,_labelAnchorPoint:null,_currentTitle:null,_currentTitleColor:null,_titleLabel:null,_backgroundSprite:null,_opacity:0,_isPushed:!1,_titleDispatchTable:null,_titleColorDispatchTable:null,_titleLabelDispatchTable:null,_backgroundSpriteDispatchTable:null,_parentInited:!1,_marginV:0,_marginH:0,ctor:function(){cc.Control.prototype.ctor.call(this);this._preferredSize=new cc.Size(0,0);this._labelAnchorPoint=
new cc.Point(0,0);this._currentTitle="";this._currentTitleColor=cc.white();this._titleDispatchTable={};this._titleColorDispatchTable={};this._titleLabelDispatchTable={};this._backgroundSpriteDispatchTable={}},init:function(){return this.initWithLabelAndBackgroundSprite(cc.LabelTTF.create("","Arial",12),cc.Scale9Sprite.create())},needsLayout:function(){if(this._parentInited){this._titleLabel&&this._titleLabel.setVisible(!1);this._backgroundSprite&&this._backgroundSprite.setVisible(!1);this.setLabelAnchorPoint(this._labelAnchorPoint);
var a=this._state;this._currentTitle=this.getTitleForState(a);this._currentTitleColor=this.getTitleColorForState(a);var c=this._titleLabel=this.getTitleLabelForState(a);c&&c.setString&&c.setString(this._currentTitle);c&&c.RGBAProtocol&&c.setColor(this._currentTitleColor);var d=this.getContentSize();c&&c.setPosition(d.width/2,d.height/2);(a=this._backgroundSprite=this.getBackgroundSpriteForState(a))&&a.setPosition(d.width/2,d.height/2);d=c?c.getBoundingBox()._size:cc.size(0,0);if(this._doesAdjustBackgroundImage)a&&
a.setContentSize(d.width+2*this._marginH,d.height+2*this._marginV);else if(a){var e=a.getPreferredSize(),e=cc.size(e.width,e.height);0>=e.width&&(e.width=d.width);0>=e.height&&(e.height=d.height);a.setContentSize(e)}d=c?c.getBoundingBox():cc.rect(0,0,0,0);e=a?a.getBoundingBox():cc.rect(0,0,0,0);d=cc.rectUnion(d,e);this.setContentSize(d.width,d.height);d=this.getContentSize();c&&(c.setPosition(d.width/2,d.height/2),c.setVisible(!0));a&&(a.setPosition(d.width/2,d.height/2),a.setVisible(!0))}},initWithLabelAndBackgroundSprite:function(a,
c){if(!a||!a.RGBAProtocol)throw"cc.ControlButton.initWithLabelAndBackgroundSprite(): label should be non-null";if(!c)throw"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.setTouchEnabled(!0);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=c;this.setOpacity(255);this.setOpacityModifyRGB(!0);var d=a.getString();this.setTitleForState(d,cc.CONTROL_STATE_NORMAL);this.setTitleColorForState(a.getColor(),cc.CONTROL_STATE_NORMAL);this.setTitleLabelForState(a,cc.CONTROL_STATE_NORMAL);this.setBackgroundSpriteForState(c,cc.CONTROL_STATE_NORMAL);
this._state=cc.CONTROL_STATE_NORMAL;this._marginH=24;this._marginV=12;this._labelAnchorPoint=new cc.Point(0.5,0.5);this.setPreferredSize(cc.SizeZero());this.needsLayout();return!0}return!1},initWithTitleAndFontNameAndFontSize:function(a,c,d){a=cc.LabelTTF.create(a,c,d);return this.initWithLabelAndBackgroundSprite(a,cc.Scale9Sprite.create())},initWithBackgroundSprite:function(a){var c=cc.LabelTTF.create("","Arial",30);return this.initWithLabelAndBackgroundSprite(c,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 c=this._backgroundSpriteDispatchTable,d;for(d in c)c[d].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 c=this._backgroundSpriteDispatchTable,d;for(d in c)c[d].setOpacity(a)},
setColor:function(a){cc.Control.prototype.setColor.call(this,a);var c=this._backgroundSpriteDispatchTable,d;for(d in c)c[d].setColor(a)},getColor:function(){return this._realColor},isPushed:function(){return this._isPushed},_getVerticalMargin:function(){return this._marginV},_getHorizontalOrigin:function(){return this._marginH},setMargins:function(a,c){this._marginV=c;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.needsLayout();this._zoomOnTouchDown&&(a=this.isHighlighted()&&this.isEnabled()&&!this.isSelected()?1.1:1,a=cc.ScaleTo.create(0.05,a),a.setTag(cc.CONTROL_ZOOM_ACTION_TAG),this.runAction(a))},onTouchBegan:function(a,c){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,c){if(this._enabled&&this._isPushed&&!this._selected){var d=this.isTouchInside(a);d&&!this._highlighted?(this.setHighlighted(!0),this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_ENTER)):d&&this._highlighted?this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE):!d&&this._highlighted?
(this.setHighlighted(!1),this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_EXIT)):d||this._highlighted||this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE)}else this._highlighted&&this.setHighlighted(!1)},onTouchEnded:function(a,c){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,c){this._isPushed=
!1;this.setHighlighted(!1);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_CANCEL)},getTitleForState:function(a){var c=this._titleDispatchTable;return c?c[a]?c[a]:c[cc.CONTROL_STATE_NORMAL]:""},setTitleForState:function(a,c){this._titleDispatchTable[c]=a||"";this.getState()==c&&this.needsLayout()},getTitleColorForState:function(a){return(a=this._titleColorDispatchTable[a])?a:(a=this._titleColorDispatchTable[cc.CONTROL_STATE_NORMAL])?a:cc.white()},setTitleColorForState:function(a,c){this._titleColorDispatchTable[c]=
a;this.getState()==c&&this.needsLayout()},getTitleLabelForState:function(a){var c=this._titleLabelDispatchTable;return c[a]?c[a]:c[cc.CONTROL_STATE_NORMAL]},setTitleLabelForState:function(a,c){var d=this._titleLabelDispatchTable;if(d[c]){var e=d[c];e&&this.removeChild(e,!0)}d[c]=a;a.setVisible(!1);a.setAnchorPoint(0.5,0.5);this.addChild(a,1);this.getState()==c&&this.needsLayout()},setTitleTTFForState:function(a,c){var d=this.getTitleForState(c);d||(d="");this.setTitleLabelForState(cc.LabelTTF.create(d,
a,12),c)},getTitleTTFForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelTTF?a.getFontName():""},setTitleTTFSizeForState:function(a,c){var d=this.getTitleLabelForState(c);null!=d&&d instanceof cc.LabelTTF&&d.setFontSize(a)},getTitleTTFSizeForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelTTF?a.getFontSize():0},setTitleBMFontForState:function(a,c){var d=this.getTitleForState(c);d||(d="");this.setTitleLabelForState(cc.LabelBMFont.create(d,
a),c)},getTitleBMFontForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelBMFont?a.getFntFile():""},getBackgroundSpriteForState:function(a){var c=this._backgroundSpriteDispatchTable;return c[a]?c[a]:c[cc.CONTROL_STATE_NORMAL]},setBackgroundSpriteForState:function(a,c){var d=this._backgroundSpriteDispatchTable;if(d[c]){var e=d[c];e&&this.removeChild(e,!0)}d[c]=a;a.setVisible(!1);a.setAnchorPoint(0.5,0.5);this.addChild(a);d=this._preferredSize;0===d.width&&0===d.height||
a.setPreferredSize(d);this._state===c&&this.needsLayout()},setBackgroundSpriteFrameForState:function(a,c){var d=cc.Scale9Sprite.createWithSpriteFrame(a);this.setBackgroundSpriteForState(d,c)}});
cc.ControlButton.create=function(a,c){var d;if(0==arguments.length)return(d=new cc.ControlButton)&&d.init()?d:null;1==arguments.length?(d=new cc.ControlButton,d.initWithBackgroundSprite(arguments[0])):2==arguments.length?(d=new cc.ControlButton,d.initWithLabelAndBackgroundSprite(a,c)):3==arguments.length&&(d=new cc.ControlButton,d.initWithTitleAndFontNameAndFontSize(arguments[0],arguments[1],arguments[2]));return d};cc.Invocation=cc.Class.extend({_action:null,_target:null,_controlEvent:null,ctor:function(a,c,d){this._target=a;this._action=c;this._controlEvent=d},getAction:function(){return this._action},getTarget:function(){return this._target},getControlEvent:function(){return this._controlEvent},invoke:function(a){if(this._target&&this._action)if("string"==typeof this._action)this._target[this._action](a,this._controlEvent);else this._action.call(this._target,a,this._controlEvent)}});cc.POSITIONS_CENTRE=0;cc.POSITIONS_TOP=1;cc.POSITIONS_LEFT=2;cc.POSITIONS_RIGHT=3;cc.POSITIONS_BOTTOM=4;cc.POSITIONS_TOPRIGHT=5;cc.POSITIONS_TOPLEFT=6;cc.POSITIONS_BOTTOMRIGHT=7;cc.POSITIONS_BOTTOMLEFT=8;
cc.Scale9Sprite=cc.NodeRGBA.extend({RGBAProtocol:!0,_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,_colorUnmodified:null,_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,_loadedEventListeners:null,
textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,c){this._loadedEventListeners.push({eventCallback:a,eventTarget:c})},_callLoadedEventCallbacks:function(){this._textureLoaded=!0;for(var a=this._loadedEventListeners,c=0,d=a.length;c<d;c++){var e=a[c];e.eventCallback.call(e.eventTarget,this)}a.length=0},_updateCapInset:function(){var a;a=this._insetLeft;var c=this._insetTop,d=this._insetRight,e=this._spriteRect,f=this._insetBottom;a=0===a&&0===c&&0===d&&0===f?cc.RectZero():
this._spriteFrameRotated?cc.rect(f,a,e.width-d-a,e.height-c-f):cc.rect(a,c,e.width-a-d,e.height-c-f);this.setCapInsets(a)},_updatePositions:function(){if(this._topLeft&&this._topRight&&this._bottomRight&&this._bottomLeft&&this._centre){var a=this._contentSize,c=this._topLeft,d=this._topRight,e=this._bottomRight,f=this._bottomLeft,g=this._centre,h=this._centre.getContentSize(),k=c.getContentSize(),m=f.getContentSize(),n=a.width-k.width-d.getContentSize().width,a=a.height-k.height-e.getContentSize().height,
n=n/h.width,a=a/h.height,k=h.width*n,p=h.height*a,q=m.width,m=m.height;if(!cc.Browser.supportWebGL){var s=Math.round(k);k!=s&&(k=s,n=k/h.width);s=Math.round(p);p!=s&&(p=s,a=p/h.height)}g.setScaleX(n);g.setScaleY(a);var h=this._left,s=this._right,r=this._top,t=this._bottom,u=cc.p(0,0);f.setAnchorPoint(u);e.setAnchorPoint(u);c.setAnchorPoint(u);d.setAnchorPoint(u);h.setAnchorPoint(u);s.setAnchorPoint(u);r.setAnchorPoint(u);t.setAnchorPoint(u);g.setAnchorPoint(u);f.setPosition(0,0);e.setPosition(q+k,
0);c.setPosition(0,m+p);d.setPosition(q+k,m+p);h.setPosition(0,m);h.setScaleY(a);s.setPosition(q+k,m);s.setScaleY(a);t.setPosition(q,0);t.setScaleX(n);r.setPosition(q,m+p);r.setScaleX(n);g.setPosition(q,m)}},ctor:function(){cc.NodeRGBA.prototype.ctor.call(this);this._spriteRect=cc.RectZero();this._capInsetsInternal=cc.RectZero();this._colorUnmodified=cc.white();this._originalSize=new cc.Size(0,0);this._preferredSize=new cc.Size(0,0);this._color=cc.white();this._opacity=255;this._capInsets=cc.RectZero();
this._loadedEventListeners=[]},getOriginalSize:function(){return this._originalSize},getPreferredSize:function(){return this._preferredSize},setPreferredSize:function(a){this.setContentSize(a);this._preferredSize=a},getOpacity:function(){return this._opacity},setOpacity:function(a){if(this._scale9Image){this._opacity=a;for(var c=this._scale9Image.getChildren(),d=0;d<c.length;d++){var e=c[d];e&&e.RGBAProtocol&&e.setOpacity(a)}}},updateDisplayedOpacity:function(a){cc.NodeRGBA.prototype.updateDisplayedOpacity.call(this,
a);this.setOpacity(this._displayedOpacity)},getColor:function(){return this._color},setColor:function(a){if(this._scale9Image){this._color=a;for(var c=this._scale9Image.getChildren(),d=0;d<c.length;d++){var e=c[d];e&&e.RGBAProtocol&&e.setColor(a)}}},updateDisplayedColor:function(a){cc.NodeRGBA.prototype.updateDisplayedColor.call(this,a);this.setColor(this._displayedColor)},getCapInsets:function(){return this._capInsets},setCapInsets:function(a){if(this._scale9Image){var c=this._contentSize,d=c.width,
c=c.height;this.updateWithBatchNode(this._scale9Image,this._spriteRect,this._spriteFrameRotated,a);this.setContentSize(d,c)}},getInsetLeft:function(){return this._insetLeft},setInsetLeft:function(a){this._insetLeft=a;this._updateCapInset()},getInsetTop:function(){return this._insetTop},setInsetTop:function(a){this._insetTop=a;this._updateCapInset()},getInsetRight:function(){return this._insetRight},setInsetRight:function(a){this._insetRight=a;this._updateCapInset()},getInsetBottom:function(){return this._insetBottom},
setInsetBottom:function(a){this._insetBottom=a;this._updateCapInset()},setContentSize:function(a,c){cc.Node.prototype.setContentSize.call(this,a,c);this._positionsAreDirty=!0},visit:function(a){this._positionsAreDirty&&(this._updatePositions(),this._positionsAreDirty=!1);cc.NodeRGBA.prototype.visit.call(this,a)},init:function(){return this.initWithBatchNode(null,cc.RectZero(),!1,cc.RectZero())},initWithBatchNode:function(a,c,d,e){void 0===e&&(e=d,d=!1);a&&this.updateWithBatchNode(a,c,d,e);this.setAnchorPoint(0.5,
0.5);return this._positionsAreDirty=!0},initWithFile:function(a,c,d){a instanceof cc.Rect?(d=a=c,c=cc.RectZero()):(c=c||cc.RectZero(),d=d||cc.RectZero());if(!a)throw"cc.Scale9Sprite.initWithFile(): file should be non-null";var e=cc.TextureCache.getInstance().textureForKey(a);if(!e){var e=cc.TextureCache.getInstance().addImage(a),f=e.isLoaded();(this._textureLoaded=f)||e.addLoadedEventListener(function(a){var c=this._preferredSize,c=cc.size(c.width,c.height);a=a.getContentSize();this.updateWithBatchNode(this._scale9Image,
cc.rect(0,0,a.width,a.height),!1,this._capInsets);this.setPreferredSize(c);this._positionsAreDirty=!0;this._callLoadedEventCallbacks()},this)}a=cc.SpriteBatchNode.create(a,9);return this.initWithBatchNode(a,c,!1,d)},initWithSpriteFrame:function(a,c){if(!a||!a.getTexture())throw"cc.Scale9Sprite.initWithSpriteFrame(): spriteFrame should be non-null and its texture should be non-null";c=c||cc.RectZero();var d=a.textureLoaded();(this._textureLoaded=d)||a.addLoadedEventListener(function(a){var c=this._preferredSize,
c=cc.size(c.width,c.height);this.updateWithBatchNode(this._scale9Image,a.getRect(),cc.Browser.supportWebGL?a.isRotated():!1,this._capInsets);this.setPreferredSize(c);this._positionsAreDirty=!0;this._callLoadedEventCallbacks()},this);d=cc.SpriteBatchNode.createWithTexture(a.getTexture(),9);return this.initWithBatchNode(d,a.getRect(),cc.Browser.supportWebGL?a.isRotated():!1,c)},initWithSpriteFrameName:function(a,c){if(!a)throw"cc.Scale9Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null";
c=c||cc.RectZero();var d=cc.SpriteFrameCache.getInstance().getSpriteFrame(a);return null==d?(cc.log("cc.Scale9Sprite.initWithSpriteFrameName(): can't find the sprite frame by spriteFrameName"),!1):this.initWithSpriteFrame(d,c)},resizableSpriteWithCapInsets:function(a){var c=new cc.Scale9Sprite;return c&&c.initWithBatchNode(this._scale9Image,this._spriteRect,!1,a)?c:null},setOpacityModifyRGB:function(a){if(this._scale9Image){this._opacityModifyRGB=a;var c=this._scale9Image.getChildren();if(c)for(var d=
0,e=c.length;d<e;d++)c[d].setOpacityModifyRGB(a)}},isOpacityModifyRGB:function(){return this._opacityModifyRGB},updateWithBatchNode:function(a,c,d,e){var f=this.getOpacity(),g=this.getColor();c=cc.rect(c.x,c.y,c.width,c.height);this.removeAllChildren(!0);this._scale9Image!=a&&(this._scale9Image=a);a=a.getTexture();var h=a.isLoaded();if(this._textureLoaded=h){a=this._scale9Image;a.removeAllChildren(!0);h=this._capInsets;h.x=e.x;h.y=e.y;h.width=e.width;h.height=e.height;this._spriteFrameRotated=d;h=
a.getTexture();cc._rectEqualToZero(c)&&(c=h.getContentSize(),c=cc.rect(0,0,c.width,c.height));var k=this._spriteRect=c;k.x=c.x;k.y=c.y;k.width=c.width;k.height=c.height;var m=c._size;this._originalSize.width=m.width;this._originalSize.height=m.height;k=this._preferredSize;0===k.width&&0===k.height&&(k.width=m.width,k.height=m.height);k=this._capInsetsInternal;e&&(k.x=e.x,k.y=e.y,k.width=e.width,k.height=e.height);var n=m.width;e=m.height;cc._rectEqualToZero(k)&&(k.x=n/3,k.y=e/3,k.width=n/3,k.height=
e/3);var p=k.x,q=k.width,s=n-(p+q),r=k.y,t=k.height,u=e-(r+t),v=0,z=0;e=cc.rect(v,z,p,r);var v=v+p,k=cc.rect(v,z,q,r),n=cc.rect(v+q,z,s,r),v=0,z=0+r,m=cc.rect(v,z,p,t),v=v+p,B=cc.rect(v,z,q,t),v=v+q,E=cc.rect(v,z,s,t),v=0,z=0+r+t,r=cc.rect(v,z,p,u),v=v+p,p=cc.rect(v,z,q,u),v=v+q,q=cc.rect(v,z,s,u),s=cc.AffineTransformMakeIdentity();if(d){d=B;var u=q,v=r,z=n,t=e,x=E,y=m,C=p,w=k,s=cc.AffineTransformTranslate(s,c.height+c.x,c.y),s=cc.AffineTransformRotate(s,1.57079633),B=cc.RectApplyAffineTransform(B,
s),q=cc.RectApplyAffineTransform(q,s),r=cc.RectApplyAffineTransform(r,s),n=cc.RectApplyAffineTransform(n,s);e=cc.RectApplyAffineTransform(e,s);E=cc.RectApplyAffineTransform(E,s);m=cc.RectApplyAffineTransform(m,s);p=cc.RectApplyAffineTransform(p,s);k=cc.RectApplyAffineTransform(k,s);d.x=B.x;d.y=B.y;u.x=q.x;u.y=q.y;v.x=r.x;v.y=r.y;z.x=n.x;z.y=n.y;t.x=e.x;t.y=e.y;x.x=E.x;x.y=E.y;y.x=m.x;y.y=m.y;C.x=p.x;C.y=p.y;w.x=k.x;w.y=k.y;this._centre=new cc.Sprite;this._centre.initWithTexture(h,d,!0);a.addChild(this._centre,
0,cc.POSITIONS_CENTRE);this._top=new cc.Sprite;this._top.initWithTexture(h,w,!0);a.addChild(this._top,1,cc.POSITIONS_TOP);this._bottom=new cc.Sprite;this._bottom.initWithTexture(h,C,!0);a.addChild(this._bottom,1,cc.POSITIONS_BOTTOM);this._left=new cc.Sprite;this._left.initWithTexture(h,y,!0);a.addChild(this._left,1,cc.POSITIONS_LEFT);this._right=new cc.Sprite;this._right.initWithTexture(h,x,!0);a.addChild(this._right,1,cc.POSITIONS_RIGHT);this._topLeft=new cc.Sprite;this._topLeft.initWithTexture(h,
t,!0);a.addChild(this._topLeft,2,cc.POSITIONS_TOPLEFT);this._topRight=new cc.Sprite;this._topRight.initWithTexture(h,z,!0);a.addChild(this._topRight,2,cc.POSITIONS_TOPRIGHT);this._bottomLeft=new cc.Sprite;this._bottomLeft.initWithTexture(h,v,!0);a.addChild(this._bottomLeft,2,cc.POSITIONS_BOTTOMLEFT);this._bottomRight=new cc.Sprite;this._bottomRight.initWithTexture(h,u,!0)}else s=cc.AffineTransformTranslate(s,c.x,c.y),cc._RectApplyAffineTransformIn(B,s),cc._RectApplyAffineTransformIn(q,s),cc._RectApplyAffineTransformIn(r,
s),cc._RectApplyAffineTransformIn(n,s),cc._RectApplyAffineTransformIn(e,s),cc._RectApplyAffineTransformIn(E,s),cc._RectApplyAffineTransformIn(m,s),cc._RectApplyAffineTransformIn(p,s),cc._RectApplyAffineTransformIn(k,s),this._centre=new cc.Sprite,this._centre.initWithTexture(h,B),a.addChild(this._centre,0,cc.POSITIONS_CENTRE),this._top=new cc.Sprite,this._top.initWithTexture(h,k),a.addChild(this._top,1,cc.POSITIONS_TOP),this._bottom=new cc.Sprite,this._bottom.initWithTexture(h,p),a.addChild(this._bottom,
1,cc.POSITIONS_BOTTOM),this._left=new cc.Sprite,this._left.initWithTexture(h,m),a.addChild(this._left,1,cc.POSITIONS_LEFT),this._right=new cc.Sprite,this._right.initWithTexture(h,E),a.addChild(this._right,1,cc.POSITIONS_RIGHT),this._topLeft=new cc.Sprite,this._topLeft.initWithTexture(h,e),a.addChild(this._topLeft,2,cc.POSITIONS_TOPLEFT),this._topRight=new cc.Sprite,this._topRight.initWithTexture(h,n),a.addChild(this._topRight,2,cc.POSITIONS_TOPRIGHT),this._bottomLeft=new cc.Sprite,this._bottomLeft.initWithTexture(h,
r),a.addChild(this._bottomLeft,2,cc.POSITIONS_BOTTOMLEFT),this._bottomRight=new cc.Sprite,this._bottomRight.initWithTexture(h,q);a.addChild(this._bottomRight,2,cc.POSITIONS_BOTTOMRIGHT);this.setContentSize(c._size);this.addChild(a);this._spritesGenerated&&(this.setOpacity(f),255===g.r&&255===g.g&&255===g.b||this.setColor(g));return this._spritesGenerated=!0}a.addLoadedEventListener(function(a){this._positionsAreDirty=!0;this._callLoadedEventCallbacks()},this)},setSpriteFrame:function(a){var c=cc.SpriteBatchNode.createWithTexture(a.getTexture(),
9),d=a.textureLoaded();(this._textureLoaded=d)||a.addLoadedEventListener(function(a){var c=this._preferredSize,c=cc.size(c.width,c.height);this.updateWithBatchNode(this._scale9Image,a.getRect(),cc.Browser.supportWebGL?a.isRotated():!1,this._capInsets);this.setPreferredSize(c);this._positionsAreDirty=!0;this._callLoadedEventCallbacks()},this);this.updateWithBatchNode(c,a.getRect(),cc.Browser.supportWebGL?a.isRotated():!1,cc.RectZero());this._insetBottom=this._insetRight=this._insetTop=this._insetLeft=
0}});cc.Scale9Sprite.create=function(a,c,d){var e;if(2===arguments.length)if("string"==typeof a){if((e=new cc.Scale9Sprite)&&e.initWithFile(a,c))return e}else{if(a instanceof cc.Rect&&(e=new cc.Scale9Sprite)&&e.initWithFile(a,d))return e}else if(3===arguments.length){if((e=new cc.Scale9Sprite)&&e.initWithFile(a,c,d))return e}else if(1===arguments.length){if((e=new cc.Scale9Sprite)&&e.initWithFile(a))return e}else if(0===arguments.length&&(e=new cc.Scale9Sprite)&&e.init())return e;return null};
cc.Scale9Sprite.createWithSpriteFrame=function(a,c){var d=new cc.Scale9Sprite;return d&&d.initWithSpriteFrame(a,c)?d:null};cc.Scale9Sprite.createWithSpriteFrameName=function(a,c){if(!a)throw"cc.Scale9Sprite.createWithSpriteFrameName(): spriteFrameName should be non-null";var d=new cc.Scale9Sprite;return d&&d.initWithSpriteFrameName(a,c)?d:null};cc.SLIDER_MARGIN_H=24;cc.SLIDER_MARGIN_V=8;
cc.ControlSlider=cc.Control.extend({_value:0,_minimumValue:0,_maximumValue:0,_minimumAllowedValue:0,_maximumAllowedValue:0,_thumbSprite:null,_progressSprite:null,_backgroundSprite:null,getValue:function(){return this._value},setValue:function(a){a=Math.max(a,this._minimumValue);this._value=a=Math.min(a,this._maximumValue);this.needsLayout();this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},getMinimumValue:function(){return this._minimumValue},setMinimumValue:function(a){this._minimumAllowedValue=
this._minimumValue=a;this._minimumValue>=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 c=this.getBoundingBox();c._size.width+=this._thumbSprite.getContentSize().width;
c._origin.x-=this._thumbSprite.getContentSize().width/2;return cc.rectContainsPoint(c,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,c,d){return cc.Control.prototype.init.call(this)?(this.ignoreAnchorPointForPosition(!1),this.setTouchEnabled(!0),this._backgroundSprite=a,this._progressSprite=c,this._thumbSprite=d,a=cc.ControlUtils.CCRectUnion(a.getBoundingBox(),d.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.getThumbSprite().setColor(cc.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.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,c){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;var d=this.locationFromTouch(a);this.sliderBegan(d);return!0},onTouchMoved:function(a,c){var d=this.locationFromTouch(a);this.sliderMoved(d)},onTouchEnded:function(a,c){this.sliderEnded(cc.PointZero())},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(),a._size)},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)}});
cc.ControlSlider.create=function(a,c,d){"string"==typeof a&&(a=cc.Sprite.create(a),c=cc.Sprite.create(c),d=cc.Sprite.create(d));var e=new cc.ControlSlider;e.initWithSprites(a,c,d);return e};cc.ControlSwitch=cc.Control.extend({_switchSprite:null,_initialTouchXPosition:0,_moved:!1,_on:!1,ctor:function(){cc.Control.prototype.ctor.call(this)},initWithMaskSprite:function(a,c,d,e,f,g){if(!a)throw"cc.ControlSwitch.initWithMaskSprite(): maskSprite should be non-null.";if(!c)throw"cc.ControlSwitch.initWithMaskSprite(): onSprite should be non-null.";if(!d)throw"cc.ControlSwitch.initWithMaskSprite(): offSprite should be non-null.";if(!e)throw"cc.ControlSwitch.initWithMaskSprite(): thumbSprite should be non-null.";
return this.init()?(this.setTouchEnabled(!0),this._on=!0,this._switchSprite=new cc.ControlSwitchSprite,this._switchSprite.initWithMaskSprite(a,c,d,e,f,g),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,c){c=c||!1;var d=(this._on=a)?this._switchSprite.getOnPosition():
this._switchSprite.getOffPosition();c?this._switchSprite.runAction(cc.ActionTween.create(0.2,"sliderXPosition",this._switchSprite.getSliderXPosition(),d)):this._switchSprite.setSliderXPosition(d);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,
c){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.gray());this._switchSprite.needsLayout();return!0},onTouchMoved:function(a,c){var d=this.locationFromTouch(a),d=cc.p(d.x-this._initialTouchXPosition,0);this._moved=!0;this._switchSprite.setSliderXPosition(d.x)},onTouchEnded:function(a,c){var d=this.locationFromTouch(a);
this._switchSprite.getThumbSprite().setColor(cc.white());this.hasMoved()?this.setOn(!(d.x<this._switchSprite.getContentSize().width/2),!0):this.setOn(!this._on,!0)},onTouchCancelled:function(a,c){var d=this.locationFromTouch(a);this._switchSprite.getThumbSprite().setColor(cc.white());this.hasMoved()?this.setOn(!(d.x<this._switchSprite.getContentSize().width/2),!0):this.setOn(!this._on,!0)}});
cc.ControlSwitch.create=function(a,c,d,e,f,g){var h=new cc.ControlSwitch;return h&&h.initWithMaskSprite(a,c,d,e,f,g)?h:null};
cc.ControlSwitchSprite=cc.Sprite.extend({_sliderXPosition:0,_onPosition:0,_offPosition:0,_textureLocation:0,_maskLocation:0,_maskSize:null,_onSprite:null,_offSprite:null,_thumbSprite:null,_onLabel:null,_offLabel:null,_clipper:null,_stencil:null,_backRT:null,ctor:function(){cc.Sprite.prototype.ctor.call(this);this._maskLocation=this._offPosition=this._onPosition=this._sliderXPosition=0;this._maskSize=cc.size(0,0);this._offLabel=this._onLabel=this._thumbSprite=this._offSprite=this._onSprite=null},initWithMaskSprite:function(a,
c,d,e,f,g){return cc.Sprite.prototype.initWithTexture.call(this,a.getTexture())?(this._onPosition=0,this._offPosition=-c.getContentSize().width+e.getContentSize().width/2,this._sliderXPosition=this._onPosition,this.setOnSprite(c),this.setOffSprite(d),this.setThumbSprite(e),this.setOnLabel(f),this.setOffLabel(g),this._stencil=a,a=this._maskSize=this._stencil.getContentSize(),this._stencil.setPosition(0,0),this._clipper=cc.ClippingNode.create(),this._clipper.setAnchorPoint(0.5,0.5),this._clipper.setPosition(a.width/
2,a.height/2),this._clipper.setStencil(this._stencil),this._backRT=cc.RenderTexture.create(a.width,a.height),this._clipper.addChild(this._backRT.getSprite()),this.addChild(this._clipper),this.addChild(this._thumbSprite),this.needsLayout(),!0):!1},needsLayout:function(){this._onSprite.setPosition(this._onSprite.getContentSize().width/2+this._sliderXPosition,this._onSprite.getContentSize().height/2);this._offSprite.setPosition(this._onSprite.getContentSize().width+this._offSprite.getContentSize().width/
2+this._sliderXPosition,this._offSprite.getContentSize().height/2);this._onLabel&&this._onLabel.setPosition(this._onSprite.getPosition().x-this._thumbSprite.getContentSize().width/6,this._onSprite.getContentSize().height/2);this._offLabel&&this._offLabel.setPosition(this._offSprite.getPosition().x+this._thumbSprite.getContentSize().width/6,this._offSprite.getContentSize().height/2);this._thumbSprite.setPosition(this._onSprite.getContentSize().width+this._sliderXPosition,this._maskSize.height/2);this._backRT.begin();
this._onSprite.visit();this._offSprite.visit();this._onLabel&&this._onLabel.visit();this._offLabel&&this._offLabel.visit();this._backRT.end()},setSliderXPosition:function(a){a<=this._offPosition?a=this._offPosition:a>=this._onPosition&&(a=this._onPosition);this._sliderXPosition=a;this.needsLayout()},getSliderXPosition:function(){return this._sliderXPosition},onSideWidth:function(){return this._onSprite.getContentSize().width},offSideWidth:function(){return this._offSprite.getContentSize().height},
updateTweenAction:function(a,c){cc.log("key \x3d "+c+", value \x3d "+a);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}});cc.ControlColourPicker=cc.Control.extend({_hsv:null,_colourPicker:null,_huePicker:null,_background:null,hueSliderValueChanged:function(a,c){this._hsv.h=a.getHue();var d=cc.ControlUtils.RGBfromHSV(this._hsv);cc.Control.prototype.setColor.call(this,cc.c3(0|255*d.r,0|255*d.g,0|255*d.b));this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED);this._updateControlPicker()},colourSliderValueChanged:function(a,c){this._hsv.s=a.getSaturation();this._hsv.v=a.getBrightness();var d=cc.ControlUtils.RGBfromHSV(this._hsv);
cc.Control.prototype.setColor.call(this,cc.c3(0|255*d.r,0|255*d.g,0|255*d.b));this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},setColor:function(a){cc.Control.prototype.setColor.call(this,a);var c=new cc.RGBA;c.r=a.r/255;c.g=a.g/255;c.b=a.b/255;c.a=1;this._hsv=cc.ControlUtils.HSVfromRGB(c);this._updateHueAndControlPicker()},getBackground:function(){return this._background},init:function(){if(cc.Control.prototype.init.call(this)){this.setTouchEnabled(!0);cc.SpriteFrameCache.getInstance().addSpriteFrames(res.CCControlColourPickerSpriteSheet_plist);
var a=cc.SpriteBatchNode.create(res.CCControlColourPickerSpriteSheet_png);this.addChild(a);this._hsv=new cc.HSV(0,0,0);this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png",a,cc.PointZero(),cc.p(0.5,0.5));var c=cc.pSub(this._background.getPosition(),cc.p(this._background.getContentSize().width/2,this._background.getContentSize().height/2));this._huePicker=cc.ControlHuePicker.create(a,cc.p(c.x+8,c.y+8));this._colourPicker=cc.ControlSaturationBrightnessPicker.create(a,
cc.p(c.x+28,c.y+28));this._huePicker.addTargetWithActionForControlEvents(this,this.hueSliderValueChanged,cc.CONTROL_EVENT_VALUECHANGED);this._colourPicker.addTargetWithActionForControlEvents(this,this.colourSliderValueChanged,cc.CONTROL_EVENT_VALUECHANGED);this._updateHueAndControlPicker();this.addChild(this._huePicker);this.addChild(this._colourPicker);this.setContentSize(this._background.getContentSize());return!0}return!1},_updateControlPicker:function(){this._huePicker.setHue(this._hsv.h);this._colourPicker.updateWithHSV(this._hsv)},
_updateHueAndControlPicker:function(){this._huePicker.setHue(this._hsv.h);this._colourPicker.updateWithHSV(this._hsv);this._colourPicker.updateDraggerWithHSV(this._hsv)},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);null!=this._huePicker&&this._huePicker.setEnabled(a);this._colourPicker&&this._colourPicker.setEnabled(a)},onTouchBegan:function(){return!1}});cc.ControlColourPicker.create=function(){var a=new cc.ControlColourPicker;a.init();return a};var res=res||{};
res.CCControlColourPickerSpriteSheet_plist=res.CCControlColourPickerSpriteSheet_plist||"res/extensions/CCControlColourPickerSpriteSheet.plist";res.CCControlColourPickerSpriteSheet_png=res.CCControlColourPickerSpriteSheet_png||"res/extensions/CCControlColourPickerSpriteSheet.png";cc.ControlHuePicker=cc.Control.extend({_hue:0,_huePercentage:0,_background:null,_slider:null,_startPos:null,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 c=this._background.getBoundingBox(),d=this._startPos.x+0.5*c.width;a=this._startPos.y+0.5*c.height;var c=0.5*c.width-15,e=cc.DEGREES_TO_RADIANS(360*
this._huePercentage-180),d=d+c*Math.cos(e);a+=c*Math.sin(e);this._slider.setPosition(d,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,c){return cc.Control.prototype.init.call(this)?(this.setTouchEnabled(!0),this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("huePickerBackground.png",
a,c,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",a,c,cc.p(0.5,0.5)),this._slider.setPosition(c.x,c.y+0.5*this._background.getBoundingBox().height),this._startPos=c,this._huePercentage=this._hue=0,!0):!1},_updateSliderPosition:function(a){var c=this._background.getBoundingBox();a=Math.atan2(a.y-(this._startPos.y+0.5*c.height),a.x-(this._startPos.x+0.5*c.width));a=cc.RADIANS_TO_DEGREES(a)+180;this.setHue(a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},
_checkSliderPosition:function(a){var c=Math.sqrt(Math.pow(a.x+10,2)+Math.pow(a.y,2));return 80>c&&59<c?(this._updateSliderPosition(a),!0):!1},onTouchBegan:function(a,c){if(!this.isEnabled()||!this.isVisible())return!1;var d=this.getTouchLocation(a);return this._checkSliderPosition(d)},onTouchMoved:function(a,c){var d=this.getTouchLocation(a);this._checkSliderPosition(d)}});cc.ControlHuePicker.create=function(a,c){var d=new cc.ControlHuePicker;d.initWithTargetAndPos(a,c);return d};cc.ControlSaturationBrightnessPicker=cc.Control.extend({_saturation:0,_brightness:0,_background:null,_overlay:null,_shadow:null,_slider:null,_startPos:null,_boxPos:0,_boxSize:0,getSaturation:function(){return this._saturation},getBrightness:function(){return this._brightness},getBackground:function(){return this._background},getOverlay:function(){return this._brightness},getShadow:function(){return this._shadow},getSlider:function(){return this._slider},getStartPos:function(){return this._startPos},
initWithTargetAndPos:function(a,c){return cc.Control.prototype.init.call(this)?(this.setTouchEnabled(!0),this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerBackground.png",a,c,cc.p(0,0)),this._overlay=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerOverlay.png",a,c,cc.p(0,0)),this._shadow=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerShadow.png",a,c,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",
a,c,cc.p(0.5,0.5)),this._startPos=c,this._boxPos=35,this._boxSize=this._background.getContentSize().width/2,!0):!1},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._slider&&this._slider.setOpacity(a?255:128)},updateWithHSV:function(a){var c=new cc.HSV;c.s=1;c.h=a.h;c.v=1;a=cc.ControlUtils.RGBfromHSV(c);this._background.setColor(cc.c3(0|255*a.r,0|255*a.g,0|255*a.b))},updateDraggerWithHSV:function(a){a=cc.p(this._startPos.x+this._boxPos+this._boxSize*(1-a.s),this._startPos.y+
this._boxPos+this._boxSize*a.v);this._updateSliderPosition(a)},_updateSliderPosition:function(a){var c=this._startPos.x+0.5*this._background.getBoundingBox().width,d=this._startPos.y+0.5*this._background.getBoundingBox().height,e=a.x-c,f=a.y-d,g=Math.sqrt(e*e+f*f),e=Math.atan2(f,e),f=0.5*this._background.getBoundingBox().width;g>f&&(a.x=c+f*Math.cos(e),a.y=d+f*Math.sin(e));this._slider.setPosition(a);a.x<this._startPos.x+this._boxPos?a.x=this._startPos.x+this._boxPos:a.x>this._startPos.x+this._boxPos+
this._boxSize-1&&(a.x=this._startPos.x+this._boxPos+this._boxSize-1);a.y<this._startPos.y+this._boxPos?a.y=this._startPos.y+this._boxPos:a.y>this._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 c=this._startPos.x+0.5*this._background.getBoundingBox().width,d=this._startPos.y+
0.5*this._background.getBoundingBox().height,c=a.x-c,d=a.y-d;return Math.sqrt(c*c+d*d)<=0.5*this._background.getBoundingBox().width?(this._updateSliderPosition(a),this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED),!0):!1},onTouchBegan:function(a,c){if(!this.isEnabled()||!this.isVisible())return!1;var d=this.getTouchLocation(a);return this._checkSliderPosition(d)},onTouchMoved:function(a,c){var d=this.getTouchLocation(a);this._checkSliderPosition(d)}});
cc.ControlSaturationBrightnessPicker.create=function(a,c){var d=new cc.ControlSaturationBrightnessPicker;d.initWithTargetAndPos(a,c);return d};cc.CONTROL_STEPPER_PARTMINUS=0;cc.CONTROL_STEPPER_PARTPLUS=1;cc.CONTROL_STEPPER_PARTNONE=2;cc.CONTROL_STEPPER_LABELCOLOR_ENABLED=cc.c3b(55,55,55);cc.CONTROL_STEPPER_LABELCOLOR_DISABLED=cc.c3b(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,ctor:function(){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},initWithMinusSpriteAndPlusSprite:function(a,c){if(!a)throw"cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Minus sprite should be non-null.";if(!c)throw"cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Plus sprite should be non-null.";if(this.init()){this.setTouchEnabled(!0);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(cc.LabelTTF.create("-",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(c);this._plusSprite.setPosition(a.getContentSize().width+c.getContentSize().width/2,a.getContentSize().height/2);this.addChild(this._plusSprite);this.setPlusLabel(cc.LabelTTF.create("+",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 d=cc.ControlUtils.CCRectUnion(this._minusSprite.getBoundingBox(),this._plusSprite.getBoundingBox());this.setContentSize(this._minusSprite.getContentSize().width+this._plusSprite.getContentSize().height,d._size.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)},setMinimumValue:function(a){if(a>=
this._maximumValue)throw"cc.ControlStepper.setMinimumValue(): minimumValue should be numerically less than maximumValue.";this._minimumValue=a;this.setValue(this._value)},setMaximumValue:function(a){if(a<=this._minimumValue)throw"cc.ControlStepper.setMaximumValue(): maximumValue should be numerically less than maximumValue.";this._maximumValue=a;this.setValue(this._value)},setValue:function(a){this.setValueWithSendingEvent(a,!0)},getValue:function(){return this._value},setStepValue:function(a){if(0>=
a)throw"cc.ControlStepper.setMaximumValue(): stepValue should be numerically greater than 0.";this._stepValue=a},isContinuous:function(){return this._continuous},setValueWithSendingEvent:function(a,c){a<this._minimumValue?a=this._wraps?this._maximumValue:this._minimumValue:a>this._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));c&&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._autorepeatCount<cc.AUTOREPEAT_INCREASETIME_INCREMENT&&
0!=this._autorepeatCount%3||(this._touchedPart==cc.CONTROL_STEPPER_PARTMINUS?this.setValueWithSendingEvent(this._value-this._stepValue,this._continuous):this._touchedPart==cc.CONTROL_STEPPER_PARTPLUS&&this.setValueWithSendingEvent(this._value+this._stepValue,this._continuous))},updateLayoutUsingTouchLocation:function(a){a.x<this._minusSprite.getContentSize().width&&this._value>this._minimumValue?(this._touchedPart=cc.CONTROL_STEPPER_PARTMINUS,this._minusSprite.setColor(cc.gray()),this._plusSprite.setColor(cc.white())):
a.x>=this._minusSprite.getContentSize().width&&this._value<this._maximumValue?(this._touchedPart=cc.CONTROL_STEPPER_PARTPLUS,this._minusSprite.setColor(cc.white()),this._plusSprite.setColor(cc.gray())):(this._touchedPart=cc.CONTROL_STEPPER_PARTNONE,this._minusSprite.setColor(cc.white()),this._plusSprite.setColor(cc.white()))},onTouchBegan:function(a,c){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;var d=this.getTouchLocation(a);this.updateLayoutUsingTouchLocation(d);this._touchInsideFlag=
!0;this._autorepeat&&this.startAutorepeat();return!0},onTouchMoved:function(a,c){if(this.isTouchInside(a)){var d=this.getTouchLocation(a);this.updateLayoutUsingTouchLocation(d);this._touchInsideFlag||(this._touchInsideFlag=!0,this._autorepeat&&this.startAutorepeat())}else this._touchInsideFlag=!1,this._touchedPart=cc.CONTROL_STEPPER_PARTNONE,this._minusSprite.setColor(cc.white()),this._plusSprite.setColor(cc.white()),this._autorepeat&&this.stopAutorepeat()},onTouchEnded:function(a,c){this._minusSprite.setColor(cc.white());
this._plusSprite.setColor(cc.white());this._autorepeat&&this.stopAutorepeat();if(this.isTouchInside(a)){var d=this.getTouchLocation(a);this.setValue(this._value+(d.x<this._minusSprite.getContentSize().width?0-this._stepValue:this._stepValue))}},setMinusSprite:function(a){this._minusSprite=a},getMinusSprite:function(){return this._minusSprite},setPlusSprite:function(a){this._plusSprite=a},getPlusSprite:function(){return this._plusSprite},setMinusLabel:function(a){this._minusLabel=a},getMinusLabel:function(){return this._minusLabel},
setPlusLabel:function(a){this._plusLabel=a},getPlusLabel:function(){return this._plusLabel}});cc.ControlStepper.create=function(a,c){var d=new cc.ControlStepper;return d&&d.initWithMinusSpriteAndPlusSprite(a,c)?d:null};cc.ControlPotentiometer=cc.Control.extend({_thumbSprite:null,_progressTimer:null,_previousLocation:null,_value:0,_minimumValue:0,_maximumValue:1,initWithTrackSprite_ProgressTimer_ThumbSprite:function(a,c,d){return this.init()?(this.setTouchEnabled(!0),this.setProgressTimer(c),this.setThumbSprite(d),this._thumbSprite.setPosition(c.getPosition()),this.addChild(d,2),this.addChild(c,1),this.addChild(a),this.setContentSize(a.getContentSize()),this._minimumValue=0,this._maximumValue=1,this.setValue(this._minimumValue),
!0):!1},setEnabled:function(a){this.setEnabled(a);this._thumbSprite!=NULL&&this._thumbSprite.setOpacity(a?255:128)},setValue:function(a){a<this._minimumValue&&(a=this._minimumValue);a>this._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)<Math.min(this.getContentSize().width/2,this.getContentSize().height/2)},onTouchBegan:function(a,c){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;this._previousLocation=this.getTouchLocation(a);this.potentiometerBegan(this._previousLocation);return!0},onTouchMoved:function(a,c){var d=this.getTouchLocation(a);this.potentiometerMoved(d)},onTouchEnded:function(a,c){this.potentiometerEnded(cc.p(0,0))},distanceBetweenPointAndPoint:function(a,c){var d=a.x-c.x,e=a.y-c.y;return Math.sqrt(d*
d+e*e)},angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint:function(a,c,d,e){var f=e.x-d.x;d=e.y-d.y;a=Math.atan2(c.x-a.x,c.y-a.y);f=Math.atan2(f,d);return 180*(a-f)/Math.PI},potentiometerBegan:function(a){this.setSelected(!0);this.getThumbSprite().setColor(cc.gray())},potentiometerMoved:function(a){var c=this.angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(this._progressTimer.getPosition(),a,this._progressTimer.getPosition(),this._previousLocation);180<c?c-=360:
-180>c&&(c+=360);this.setValue(this._value+c/360*(this._maximumValue-this._minimumValue));this._previousLocation=a},potentiometerEnded:function(a){this.getThumbSprite().setColor(cc.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}});
cc.ControlPotentiometer.create=function(a,c,d){var e=new cc.ControlPotentiometer;return e&&(a=cc.Sprite.create(a),d=cc.Sprite.create(d),c=cc.ProgressTimer.create(cc.Sprite.create(c)),e.initWithTrackSprite_ProgressTimer_ThumbSprite(a,c,d))?e:null};cc.Spacer=cc.Layer.extend({});cc.Spacer.verticalSpacer=function(a){var c=new cc.Spacer;c.init();c.setContentSize(0,a);return c};cc.Spacer.horizontalSpacer=function(a){var c=new cc.Spacer;c.init();c.setContentSize(a,0);return c};
cc.MenuPassive=cc.Layer.extend({RGBAProtocol:!0,_color:null,_opacity:0,ctor:function(){},getColor:function(){return this._color},setColor:function(a){this._color=a;if(this._children&&0<this._children.length)for(var c=0;c<this._children.length;c++)this._children[c]&&this._children[c].RGBAProtocol&&this._children[c].setColor(a)},getOpacity:function(){return this._opacity},setOpacity:function(a){this._opacity=a;if(this._children&&0<this._children.length)for(var c=0;c<this._children.length;c++)this._children[c]&&
this._children[c].RGBAProtocol&&this._children[c].setOpacity(a)},initWithItems:function(a,c){if(this.init()){var d=cc.Director.getInstance().getWinSize();this.ignoreAnchorPointForPosition(!0);this.setAnchorPoint(0.5,0.5);this.setContentSize(d);this.setPosition(d.width/2,d.height/2);d=0;if(a){this.addChild(a,d);for(var e=0;e<c.length;e++)c[e]&&(d++,this.addChild(c[e],d))}return!0}return!1},alignItemsVertically:function(){this.alignItemsVerticallyWithPadding(cc.DEFAULT_PADDING)},alignItemsVerticallyWithPadding:function(a){var c=
-a,d;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(c+=this._children[d].getContentSize().height*this._children[d].getScaleY()+a);var e=0,f=c/2;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(e=Math.max(e,this._children[d].getContentSize().width),this._children[d].setPosition(0,f-this._children[d].getContentSize().height*this._children[d].getScaleY()/2),f-=this._children[d].getContentSize().height*
this._children[d].getScaleY()+a);this.setContentSize(e,c)},alignItemsHorizontally:function(){this.alignItemsHorizontallyWithPadding(cc.DEFAULT_PADDING)},alignItemsHorizontallyWithPadding:function(a){var c=-a,d;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(c+=this._children[d].getContentSize().width*this._children[d].getScaleX()+a);var e=0,f=-c/2;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(e=
Math.max(e,this._children[d].getContentSize().height),this._children[d].setPosition(f+this._children[d].getContentSize().width*this._children[d].getScaleX()/2,0),f+=this._children[d].getContentSize().width*this._children[d].getScaleX()+a);this.setContentSize(c,e)},alignItemsInColumns:function(a){var c=[],d;for(d=1;d<arguments.length;d++)c.push(arguments[d]);var e=-5,f=0,g=0,h=0,k,m;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(f>=c.length?cc.log("cc.MenuPassive.alignItemsInColumns(): invalid row index"):
(k=c[f])?(m=this._children[d].getContentSize().height,g=0|(g>=m||null==m?g:m),++h,h>=k&&(e+=g+5,g=h=0,++f)):cc.log("cc.MenuPassive.alignItemsInColumns(): can not have zero columns on a row"));var n=cc.Director.getInstance().getWinSize(),p=k=g=f=0,q=0,e=e/2;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(0==k&&(k=c[f],q=p=n.width/(1+k)),m=this._children[d].getContentSize().height,g=0|(g>=m||null==m?g:m),this._children[d].setPosition(q-n.width/2,e-
this._children[d].getContentSize().height/2),q+=p,++h,h>=k&&(e-=g+5,g=k=h=0,++f))},alignItemsInRows:function(a){var c=[],d;for(d=1;d<arguments.length;d++)c.push(arguments[d]);var e=[],f=[],g=-10,h=-5,k=0,m=0,n=0,p,q;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(k>=c.length?cc.log("cc.MenuPassive.alignItemsInRows(): invalid row index"):(p=c[k])?(q=this._children[d].getContentSize().width,m=0|(m>=q||null==q?m:q),h+=0|this._children[d].getContentSize().height+
5,++n,n>=p&&(e.push(m),f.push(h),g+=m+10,m=n=0,h=-5,++k)):cc.log("cc.MenuPassive.alignItemsInColumns(): can't have zero rows on a column"));h=cc.Director.getInstance().getWinSize();m=k=0;p=null;var g=-g/2,s=0;if(this._children&&0<this._children.length)for(d=0;d<this._children.length;d++)this._children[d]&&(null==p&&(p=c[k],s=f[k]),q=this._children[d].getContentSize().width,m=0|(m>=q||null==q?m:q),this._children[d].setPosition(g+e[k]/2,s-h.height/2),s-=this._children[d].getContentSize().height+10,
++n,n>=p&&(g+=m+5,m=p=n=0,++k))},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1}});cc.MenuPassive.create=function(a){a||(a=null);for(var c=[],d=1;d<arguments.length;d++)c.push(arguments[d]);return(d=new cc.MenuPassive)&&d.initWithItems(a,c)?d:null};cc.MenuPassive.createWithItem=function(a){return cc.MenuPassive.create(a,null)};cc.SortableObject=cc.Class.extend({setObjectID:function(a){},getObjectID:function(){return 0}});cc.SortedObject=cc.SortableObject.extend({_objectID:0,ctor:function(){this._objectID=0},setObjectID:function(a){this._objectID=a},getObjectID:function(){return this._objectID}});var _compareObject=function(a,c){return a.getObjectID()-c.getObjectID()};
cc.ArrayForObjectSorting=cc.Class.extend({_saveObjectArr:null,ctor:function(){this._saveObjectArr=[]},insertSortedObject:function(a){if(!a)throw"cc.ArrayForObjectSorting.insertSortedObject(): addObject should be non-null.";var c=this.indexOfSortedObject(a);this.insertObject(a,c)},removeSortedObject:function(a){if(0!=this.count()){var c=this.indexOfSortedObject(a);c<this.count()&&c!=cc.INVALID_INDEX&&this.objectAtIndex(c).getObjectID()==a.getObjectID()&&this.removeObjectAtIndex(c)}},setObjectID_ofSortedObject:function(a,
c){var d=this.indexOfSortedObject(c);if(d<this.count()&&d!=cc.INVALID_INDEX){var e=this.objectAtIndex(d);e.getObjectID()==c.getObjectID()&&(this.removeObjectAtIndex(d),e.setObjectID(a),this.insertSortedObject(e))}},objectWithObjectID:function(a){if(0==this.count())return null;var c=new cc.SortedObject;c.setObjectID(a);var d=this.indexOfSortedObject(c);d<this.count()&&d!=cc.INVALID_INDEX&&(c=this.objectAtIndex(d),c.getObjectID()!=a&&(c=null));return c},getObjectWithObjectID:function(a){return null},
indexOfSortedObject:function(a){var c=0;if(a){var d=0;a=a.getObjectID();for(var e=this._saveObjectArr,f=0;f<e.length;f++){var g=e[f].getObjectID();if(a==g||a>=d&&a<g)break;d=g;c++}}else c=cc.INVALID_INDEX;return c},count:function(){return this._saveObjectArr.length},lastObject:function(){var a=this._saveObjectArr;return 0==a.length?null:a[a.length-1]},objectAtIndex:function(a){return this._saveObjectArr[a]},addObject:function(a){this._saveObjectArr.push(a);this._saveObjectArr.sort(_compareObject)},
removeObjectAtIndex:function(a){cc.ArrayRemoveObjectAtIndex(this._saveObjectArr,a);this._saveObjectArr.sort(_compareObject)},insertObject:function(a,c){this._saveObjectArr=cc.ArrayAppendObjectToIndex(this._saveObjectArr,a,c);this._saveObjectArr.sort(_compareObject)}});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;cc.convertDistanceFromPointToInch=function(a){var c=cc.EGLView.getInstance(),c=(c.getScaleX()+c.getScaleY())/2;return a*c/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,ctor:function(){cc.Layer.prototype.ctor.call(this);this._contentOffset=new cc.Point(0,
0);this._maxInset=new cc.Point(0,0);this._minInset=new cc.Point(0,0);this._scrollDistance=new cc.Point(0,0);this._touchPoint=new cc.Point(0,0);this._touches=[];this._viewSize=new cc.Size(0,0);this._parentScissorRect=new cc.Rect(0,0,0,0);this._tmpViewRect=new cc.Rect(0,0,0,0)},init:function(){return this.initWithViewSize(cc.size(200,200),null)},registerWithTouchDispatcher:function(){cc.registerTargetedDelegate(this.getTouchPriority(),!1,this)},initWithViewSize:function(a,c){var d=cc.p(0,0);return cc.Layer.prototype.init.call(this)?
(this._container=c,this._container||(this._container=cc.Layer.create(),this._container.ignoreAnchorPointForPosition(!1),this._container.setAnchorPoint(d)),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(d),this._touchLength=0,this.addChild(this._container),this._minScale=this._maxScale=1,!0):!1},setContentOffset:function(a,c){if(c)this.setContentOffsetInDuration(a,
BOUNCE_DURATION);else{if(!this._bounceable){var d=this.minContainerOffset(),e=this.maxContainerOffset();a.x=Math.max(d.x,Math.min(e.x,a.x));a.y=Math.max(d.y,Math.min(e.y,a.y))}this._container.setPosition(a);d=this._delegate;null!=d&&d.scrollViewDidScroll&&d.scrollViewDidScroll(this)}},getContentOffset:function(){var a=this._container.getPosition();return cc.p(a.x,a.y)},setContentOffsetInDuration:function(a,c){var d=cc.MoveTo.create(c,a),e=cc.CallFunc.create(this._stoppedAnimatedScroll,this);this._container.runAction(cc.Sequence.create(d,
e));this.schedule(this._performedAnimatedScroll)},setZoomScale:function(a,c){if(c)this.setZoomScaleInDuration(a,BOUNCE_DURATION);else{var d=this._container;if(d.getScale()!=a){var e,f;0==this._touchLength?(f=this._viewSize,f=cc.p(0.5*f.width,0.5*f.height),f=this.convertToWorldSpace(f)):f=this._touchPoint;e=d.convertToNodeSpace(f);d.setScale(Math.max(this._minScale,Math.min(this._maxScale,a)));e=d.convertToWorldSpace(e);f=cc.pSub(f,e);this._delegate&&this._delegate.scrollViewDidZoom&&this._delegate.scrollViewDidZoom(this);
this.setContentOffset(cc.pAdd(d.getPosition(),f))}}},getZoomScale:function(){return this._container.getScale()},setZoomScaleInDuration:function(a,c){if(0<c){var d=this._container.getScale();d!=a&&(d=cc.ActionTween.create(c,"zoomScale",d,a),this.runAction(d))}else this.setZoomScale(a)},minContainerOffset:function(){var a=this._container,c=a.getContentSize(),d=this._viewSize;return cc.p(d.width-c.width*a.getScaleX(),d.height-c.height*a.getScaleY())},maxContainerOffset:function(){return cc.p(0,0)},isNodeVisible:function(a){var c=
this.getContentOffset(),d=this.getViewSize(),e=this.getZoomScale(),c=cc.rect(-c.x/e,-c.y/e,d.width/e,d.height/e);return cc.rectIntersectsRect(c,a.getBoundingBox())},pause:function(a){this._container.pauseSchedulerAndActions();a=this._container.getChildren();for(var c=0;c<a.length;c++)a[c].pauseSchedulerAndActions()},resume:function(a){a=this._container.getChildren();for(var c=0,d=a.length;c<d;c++)a[c].resumeSchedulerAndActions();this._container.resumeSchedulerAndActions()},isDragging:function(){return this._dragging},
isTouchMoved:function(){return this._touchMoved},isBounceable:function(){return this._bounceable},setBounceable:function(a){this._bounceable=a},getViewSize:function(){return this._viewSize},setViewSize:function(a){this._viewSize=a;cc.Node.prototype.setContentSize.call(this,a)},getContainer:function(){return this._container},setContainer:function(a){a&&(this.removeAllChildren(!0),this._container=a,a.ignoreAnchorPointForPosition(!1),a.setAnchorPoint(0,0),this.addChild(a),this.setViewSize(this._viewSize))},
getDirection:function(){return this._direction},setDirection:function(a){this._direction=a},getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},onTouchBegan:function(a,c){if(!this.isVisible())return!1;var d=this._getViewRect(),e=this._container,f=e.convertToWorldSpace(e.convertTouchToNodeSpace(a)),g=this._touches;if(2<g.length||this._touchMoved||!cc.rectContainsPoint(d,f))return!1;g.push(a);1===g.length?(this._touchPoint=this.convertTouchToNodeSpace(a),this._touchMoved=
!1,this._dragging=!0,this._scrollDistance.x=0,this._touchLength=this._scrollDistance.y=0):2==g.length&&(this._touchPoint=cc.pMidpoint(this.convertTouchToNodeSpace(g[0]),this.convertTouchToNodeSpace(g[1])),this._touchLength=cc.pDistance(e.convertTouchToNodeSpace(g[0]),e.convertTouchToNodeSpace(g[1])),this._dragging=!1);return!0},onTouchMoved:function(a,c){if(this.isVisible())if(1===this._touches.length&&this._dragging){this._touchMoved=!0;var d=this._getViewRect(),e=this.convertTouchToNodeSpace(a),
f=cc.pSub(e,this._touchPoint),g=0,h=this._direction,g=h===cc.SCROLLVIEW_DIRECTION_VERTICAL?f.y:h===cc.SCROLLVIEW_DIRECTION_HORIZONTAL?f.x:Math.sqrt(f.x*f.x+f.y*f.y);if(this._touchMoved||!(Math.abs(cc.convertDistanceFromPointToInch(g))<MOVE_INCH))if(this._touchMoved||(f.x=0,f.y=0),this._touchPoint=e,this._touchMoved=!0,cc.rectContainsPoint(d,this.convertToWorldSpace(e))){switch(h){case cc.SCROLLVIEW_DIRECTION_VERTICAL:f.x=0;break;case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:f.y=0}e=this._container.getPosition();
d=e.x+f.x;e=e.y+f.y;this._scrollDistance=f;this.setContentOffset(cc.p(d,e))}}else 2!==this._touches.length||this._dragging||(f=cc.pDistance(this._container.convertTouchToNodeSpace(this._touches[0]),this._container.convertTouchToNodeSpace(this._touches[1])),this.setZoomScale(this.getZoomScale()*f/this._touchLength))},onTouchEnded:function(a,c){this.isVisible()&&(1==this._touches.length&&this._touchMoved&&this.schedule(this._deaccelerateScrolling),this._touches.length=0,this._touchMoved=this._dragging=
!1)},onTouchCancelled:function(a,c){this.isVisible()&&(this._touches.length=0,this._touchMoved=this._dragging=!1)},setContentSize:function(a,c){null!=this.getContainer()&&(void 0===c?this.getContainer().setContentSize(a):this.getContainer().setContentSize(a,c),this.updateInset())},getContentSize:function(){return this._container.getContentSize()},updateInset:function(){if(null!=this.getContainer()){var a=this._viewSize,c=this.maxContainerOffset();this._maxInset.x=c.x+a.width*INSET_RATIO;this._maxInset.y=
c.y+a.height*INSET_RATIO;c=this.minContainerOffset();this._minInset.x=c.x-a.width*INSET_RATIO;this._minInset.y=c.y-a.height*INSET_RATIO}},isClippingToBounds:function(){return this._clippingToBounds},setClippingToBounds:function(a){this._clippingToBounds=a},visit:function(a){if(this.isVisible()){a=a||cc.renderContext;var c,d=this._children,e,f;if(cc.renderContextType===cc.CANVAS){a.save();this.transform(a);this._beforeDraw(a);if(d&&0<d.length){f=d.length;this.sortAllChildren();for(c=0;c<f;c++)if((e=
d[c])&&0>e._zOrder)e.visit(a);else break;for(this.draw(a);c<f;c++)d[c].visit(a)}else this.draw(a);this._afterDraw();a.restore()}else{cc.kmGLPushMatrix();var g=this._grid;g&&g.isActive()&&(g.beforeDraw(),this.transformAncestors());this.transform(a);this._beforeDraw(a);if(d&&0<d.length){f=d.length;for(c=0;c<f;c++)if((e=d[c])&&0>e._zOrder)e.visit();else break;for(this.draw(a);c<f;c++)d[c].visit()}else this.draw(a);this._afterDraw(a);g&&g.isActive()&&g.afterDraw(this);cc.kmGLPopMatrix()}}},addChild:function(a,
c,d){if(!a)throw Error("child must not nil!");c=c||a.getZOrder();d=d||a.getTag();a.ignoreAnchorPointForPosition(!1);a.setAnchorPoint(0,0);this._container!=a?this._container.addChild(a,c,d):cc.Layer.prototype.addChild.call(this,a,c,d)},setTouchEnabled:function(a){cc.Layer.prototype.setTouchEnabled.call(this,a);a||(this._touchMoved=this._dragging=!1,this._touches.length=0)},_initWithViewSize:function(a){return null},_relocateContainer:function(a){var c=this.minContainerOffset(),d=this.maxContainerOffset(),
e=this._direction,f=this._container.getPosition(),g=f.x,h=f.y;if(e===cc.SCROLLVIEW_DIRECTION_BOTH||e===cc.SCROLLVIEW_DIRECTION_HORIZONTAL)g=Math.max(g,c.x),g=Math.min(g,d.x);if(e==cc.SCROLLVIEW_DIRECTION_BOTH||e==cc.SCROLLVIEW_DIRECTION_VERTICAL)h=Math.min(h,d.y),h=Math.max(h,c.y);h==f.y&&g==f.x||this.setContentOffset(cc.p(g,h),a)},_deaccelerateScrolling:function(a){if(this._dragging)this.unschedule(this._deaccelerateScrolling);else{var c,d;c=this._container.getPosition();a=this._scrollDistance;this._container.setPosition(c.x+
a.x,c.y+a.y);this._bounceable?(c=this._maxInset,d=this._minInset):(c=this.maxContainerOffset(),d=this.minContainerOffset());var e=this._container.getPositionX(),f=this._container.getPositionY();a.x*=SCROLL_DEACCEL_RATE;a.y*=SCROLL_DEACCEL_RATE;this.setContentOffset(cc.p(e,f));if(Math.abs(a.x)<=SCROLL_DEACCEL_DIST&&Math.abs(a.y)<=SCROLL_DEACCEL_DIST||f>c.y||f<d.y||e>c.x||e<d.x||e==c.x||e==d.x||f==c.y||f==d.y)this.unschedule(this._deaccelerateScrolling),this._relocateContainer(!0)}},_performedAnimatedScroll:function(a){this._dragging?
this.unschedule(this._performedAnimatedScroll):this._delegate&&this._delegate.scrollViewDidScroll&&this._delegate.scrollViewDidScroll(this)},_stoppedAnimatedScroll:function(a){this.unschedule(this._performedAnimatedScroll);this._delegate&&this._delegate.scrollViewDidScroll&&this._delegate.scrollViewDidScroll(this)},_beforeDraw:function(a){if(this._clippingToBounds){this._scissorRestored=!1;var c=this._getViewRect(),d=cc.EGLView.getInstance(),e=this.getScaleX(),f=this.getScaleY();a=a||cc.renderContext;
if(cc.renderContextType===cc.CANVAS)c=this._viewSize.width*e*d.getScaleX(),d=this._viewSize.height*f*d.getScaleY(),a.beginPath(),a.rect(0,0,c,-d),a.clip(),a.closePath();else if(d=cc.EGLView.getInstance(),d.isScissorEnabled()){if(this._scissorRestored=!0,this._parentScissorRect=d.getScissorRect(),cc.rectIntersection(c,this._parentScissorRect)){var g=this._parentScissorRect;a=Math.max(c.x,g.x);f=Math.max(c.y,g.y);e=Math.min(c.x+c.width,g.x+g.width);c=Math.min(c.y+c.height,g.y+g.height);d.setScissorInPoints(a,
f,e-a,c-f)}}else a.enable(a.SCISSOR_TEST),d.setScissorInPoints(c.x,c.y,c.width,c.height)}},_afterDraw:function(a){this._clippingToBounds&&cc.renderContextType===cc.WEBGL&&(this._scissorRestored?(a=this._parentScissorRect,cc.EGLView.getInstance().setScissorInPoints(a.x,a.y,a.width,a.height)):(a=a||cc.renderContext,a.disable(a.SCISSOR_TEST)))},_handleZoom:function(){},_getViewRect:function(){for(var a=this.convertToWorldSpace(cc.PointZero()),c=this._viewSize,d=this.getScaleX(),e=this.getScaleY(),f=
this._parent;null!=f;f=f.getParent())d*=f.getScaleX(),e*=f.getScaleY();0>d&&(a.x+=c.width*d,d=-d);0>e&&(a.y+=c.height*e,e=-e);f=this._tmpViewRect;f.x=a.x;f.y=a.y;f.width=c.width*d;f.height=c.height*e;return f}});cc.ScrollView.create=function(a,c){var d=new cc.ScrollView;if(2==arguments.length){if(d&&d.initWithViewSize(a,c))return d}else if(d&&d.init())return d;return null};cc.TABLEVIEW_FILL_TOPDOWN=0;cc.TABLEVIEW_FILL_BOTTOMUP=1;cc.TableViewCell=cc.Node.extend({_idx:0,getIdx:function(){return this._idx},setIdx:function(a){this._idx=a},reset:function(){this._idx=cc.INVALID_INDEX},setObjectID:function(a){this._idx=a},getObjectID:function(){return this._idx}});cc.TableViewDelegate=cc.ScrollViewDelegate.extend({tableCellTouched:function(a,c){},tableCellHighlight:function(a,c){},tableCellUnhighlight:function(a,c){},tableCellWillRecycle:function(a,c){}});
cc.TableViewDataSource=cc.Class.extend({tableCellSizeForIndex:function(a,c){return this.cellSizeForTable(a)},cellSizeForTable:function(a){return cc.SIZE_ZERO},tableCellAtIndex:function(a,c){return null},numberOfCellsInTableView:function(a){return 0}});
cc.TableView=cc.ScrollView.extend({_vOrdering:null,_indices:null,_cellsFreed:null,_dataSource:null,_tableViewDelegate:null,_oldDirection:null,_cellsPositions:null,_touchedCell:null,ctor:function(){cc.ScrollView.prototype.ctor.call(this);this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;this._cellsPositions=[]},__indexFromOffset:function(a){var c=0,d=this._dataSource.numberOfCellsInTableView(this)-1;switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=a.x;break;default:a=a.y}for(var e=
this._cellsPositions;d>=c;){var f=0|c+(d-c)/2,g=e[f],h=e[f+1];if(a>=g&&a<=h)return f;a<g?d=f-1:c=f+1}return 0>=c?0:-1},_indexFromOffset:function(a){var c={x:a.x,y:a.y};a=this._dataSource.numberOfCellsInTableView(this)-1;this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(c.y=this.getContainer().getContentSize().height-c.y);c=this.__indexFromOffset(c);-1!=c&&(c=Math.max(0,c),c>a&&(c=cc.INVALID_INDEX));return c},__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 c=this.__offsetFromIndex(a);a=this._dataSource.tableCellSizeForIndex(this,a);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(c.y=this.getContainer().getContentSize().height-c.y-a.height);return c},_updateCellPositions:function(){var a=this._dataSource.numberOfCellsInTableView(this),c=this._cellsPositions;if(0<a){for(var d=0,e,f=this._dataSource,g=0;g<a;g++)switch(c[g]=d,e=f.tableCellSizeForIndex(this,
g),this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:d+=e.width;break;default:d+=e.height}this._cellsPositions[a]=d}},_updateContentSize:function(){var a=cc.SizeZero(),c=this._dataSource.numberOfCellsInTableView(this);if(0<c)switch(a=this._cellsPositions[c],this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=cc.size(a,this._viewSize.height);break;default:a=cc.size(this._viewSize.width,a)}this.setContentSize(a);this._oldDirection!=this._direction&&(this._direction==cc.SCROLLVIEW_DIRECTION_HORIZONTAL?
this.setContentOffset(cc.p(0,0)):this.setContentOffset(cc.p(0,this.minContainerOffset().y)),this._oldDirection=this._direction)},_moveCellOutOfSight:function(a){this._tableViewDelegate&&this._tableViewDelegate.tableCellWillRecycle&&this._tableViewDelegate.tableCellWillRecycle(this,a);this._cellsFreed.addObject(a);this._cellsUsed.removeSortedObject(a);cc.ArrayRemoveObject(this._indices,a.getIdx());a.reset();a.getParent()==this.getContainer()&&this.getContainer().removeChild(a,!0)},_setIndexForCell:function(a,
c){c.setAnchorPoint(0,0);c.setPosition(this._offsetFromIndex(a));c.setIdx(a)},_addCellIfNecessary:function(a){a.getParent()!=this.getContainer()&&this.getContainer().addChild(a);this._cellsUsed.insertSortedObject(a);var c=this._indices;a=a.getIdx();-1==c.indexOf(a)&&(c.push(a),c.sort(function(a,c){return a-c}))},getDataSource:function(){return this._dataSource},setDataSource:function(a){this._dataSource=a},getDelegate:function(){return this._tableViewDelegate},setDelegate:function(a){this._tableViewDelegate=
a},setVerticalFillOrder:function(a){this._vOrdering!=a&&(this._vOrdering=a,0<this._cellsUsed.count()&&this.reloadData())},getVerticalFillOrder:function(){return this._vOrdering},initWithViewSize:function(a,c){return cc.ScrollView.prototype.initWithViewSize.call(this,a,c)?(this._cellsUsed=new cc.ArrayForObjectSorting,this._cellsFreed=new cc.ArrayForObjectSorting,this._indices=[],this._tableViewDelegate=null,this._vOrdering=cc.TABLEVIEW_FILL_BOTTOMUP,this.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL),
cc.ScrollView.prototype.setDelegate.call(this,this),!0):!1},updateCellAtIndex:function(a){if(!(a==cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-1)){var c=this.cellAtIndex(a);c&&this._moveCellOutOfSight(c);c=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,c);this._addCellIfNecessary(c)}},insertCellAtIndex:function(a){if(!(a==cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-1)){var c,d=this._cellsUsed;if(c=d.objectWithObjectID(a))for(var e=
c=d.indexOfSortedObject(c);e<d.count();e++)c=d.objectAtIndex(e),this._setIndexForCell(c.getIdx()+1,c);c=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,c);this._addCellIfNecessary(c);this._updateCellPositions();this._updateContentSize()}},removeCellAtIndex:function(a){if(!(a==cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-1)){var c=this.cellAtIndex(a);if(c){var d=this._cellsUsed,e=d.indexOfSortedObject(c);this._moveCellOutOfSight(c);cc.ArrayRemoveObject(this._indices,
a);this._updateCellPositions();for(a=d.count()-1;a>e;a--)c=d.objectAtIndex(a),this._setIndexForCell(c.getIdx()-1,c)}}},reloadData:function(){this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;for(var a=this._cellsUsed,c=this._cellsFreed,d=this.getContainer(),e=0,f=a.count();e<f;e++){var g=a.objectAtIndex(e);this._tableViewDelegate&&this._tableViewDelegate.tableCellWillRecycle&&this._tableViewDelegate.tableCellWillRecycle(this,g);c.addObject(g);g.reset();g.getParent()==d&&d.removeChild(g,!0)}this._indices=
[];this._cellsUsed=new cc.ArrayForObjectSorting;this._updateCellPositions();this._updateContentSize();0<this._dataSource.numberOfCellsInTableView(this)&&this.scrollViewDidScroll(this)},dequeueCell:function(){if(0===this._cellsFreed.count())return null;var a=this._cellsFreed.objectAtIndex(0);this._cellsFreed.removeObjectAtIndex(0);return a},cellAtIndex:function(a){return-1==this._indices.indexOf(a)?null:this._cellsUsed.objectWithObjectID(a)},scrollViewDidScroll:function(a){var c=this._dataSource.numberOfCellsInTableView(this);
if(0!==c){null!=this._tableViewDelegate&&this._tableViewDelegate.scrollViewDidScroll&&this._tableViewDelegate.scrollViewDidScroll(this);var d=0,e=this._viewSize,d=this.getContainer(),f=this.getContentOffset();f.x*=-1;f.y*=-1;var g=Math.max(c-1,0);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(f.y+=e.height/d.getScaleY());a=this._indexFromOffset(f);a===cc.INVALID_INDEX&&(a=c-1);f.y=this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN?f.y-e.height/d.getScaleY():f.y+e.height/d.getScaleY();f.x+=e.width/d.getScaleX();
e=this._indexFromOffset(f);e===cc.INVALID_INDEX&&(e=c-1);f=this._cellsUsed;if(0<f.count())for(c=f.objectAtIndex(0),d=c.getIdx();d<a;)if(this._moveCellOutOfSight(c),0<f.count())c=f.objectAtIndex(0),d=c.getIdx();else break;if(0<f.count())for(c=f.lastObject(),d=c.getIdx();d<=g&&d>e;)if(this._moveCellOutOfSight(c),0<f.count())c=f.lastObject(),d=c.getIdx();else break;for(g=this._indices;a<=e;a++)-1==g.indexOf(a)&&this.updateCellAtIndex(a)}},scrollViewDidZoom:function(a){},onTouchEnded:function(a,c){if(this.isVisible()){if(this._touchedCell){var d=
this.getBoundingBox();d._origin=this._parent.convertToWorldSpace(d._origin);var e=this._tableViewDelegate;cc.rectContainsPoint(d,a.getLocation())&&null!=e&&(e.tableCellUnhighlight&&e.tableCellUnhighlight(this,this._touchedCell),e.tableCellTouched&&e.tableCellTouched(this,this._touchedCell));this._touchedCell=null}cc.ScrollView.prototype.onTouchEnded.call(this,a,c)}},onTouchBegan:function(a,c){if(!this.isVisible())return!1;var d=cc.ScrollView.prototype.onTouchBegan.call(this,a,c);if(1===this._touches.length){var e;
e=this.getContainer().convertTouchToNodeSpace(a);e=this._indexFromOffset(e);(this._touchedCell=e===cc.INVALID_INDEX?null:this.cellAtIndex(e))&&null!=this._tableViewDelegate&&this._tableViewDelegate.tableCellHighlight&&this._tableViewDelegate.tableCellHighlight(this,this._touchedCell)}else this._touchedCell&&(null!=this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null);return d},onTouchMoved:function(a,
c){cc.ScrollView.prototype.onTouchMoved.call(this,a,c);this._touchedCell&&this.isTouchMoved()&&(null!=this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null)},onTouchCancelled:function(a,c){cc.ScrollView.prototype.onTouchCancelled.call(this,a,c);this._touchedCell&&(null!=this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,
this._touchedCell),this._touchedCell=null)}});cc.TableView.create=function(a,c,d){var e=new cc.TableView;e.initWithViewSize(c,d);e.setDataSource(a);e._updateCellPositions();e._updateContentSize();return e};cc.DOM={};cc.DOM.addMethods=function(a){for(var c in cc.DOM.methods)a[c]=cc.DOM.methods[c]};
cc.DOM.methods={setPosition:function(a,c){void 0===c?(this._position.x=a.x,this._position.y=a.y):(this._position.x=a,this._position.y=c);this.setNodeDirty();this.dom.translates(this._position.x,-this._position.y)},setPositionY:function(a){this._position.y=a;this.setNodeDirty();this.dom.translates(this._position.x,-this._position.y)},setPositionX:function(a){this._position.x=a;this.setNodeDirty();this.dom.translates(this._position.x,-this._position.y)},setScale:function(a,c){this._scaleX=a;this._scaleY=
c||a;this.setNodeDirty();this.dom.resize(this._scaleX,this._scaleY)},setScaleX:function(a){this._scaleX=a;this.setNodeDirty();this.dom.resize(this._scaleX,this._scaleY)},setScaleY:function(a){this._scaleY=a;this.setNodeDirty();this.dom.resize(this._scaleX,this._scaleY)},setAnchorPoint:function(a,c){var d=this._anchorPoint;void 0===c?(d.x=a.x,d.y=a.y):(d.x=a,d.y=c);var e=this._anchorPointInPoints,f=this._contentSize;e.x=f.width*d.x;e.y=f.height*d.y;this.dom.style[cc.$.pfx+"TransformOrigin"]=""+e.x+
"px "+-e.y+"px";this.isIgnoreAnchorPointForPosition()?(this.dom.style.marginLeft=0,this.dom.style.marginBottom=0):(this.dom.style.marginLeft=this.isToggler?0:-e.x+"px",this.dom.style.marginBottom=-e.y+"px");this.setNodeDirty()},setContentSize:function(a,c){var d=this._contentSize;void 0===c?(d.width=a.width,d.height=a.height):(d.width=a,d.height=c);var e=this._anchorPointInPoints,f=this._anchorPoint;e.x=d.width*f.x;e.y=d.height*f.y;this.dom.width=d.width;this.dom.height=d.height;this.setAnchorPoint(this.getAnchorPoint());
this.canvas&&(this.canvas.width=d.width,this.canvas.height=d.height);this.setNodeDirty();this.redraw()},setRotation:function(a){this._rotation!=a&&(this._rotationX=this._rotationY=a,this._rotationRadiansX=Math.PI/180*this._rotationX,this._rotationRadiansY=Math.PI/180*this._rotationY,this.setNodeDirty(),this.dom.rotate(a))},setSkewX:function(a){this._skewX=a;this.setNodeDirty();this.dom.setSkew(this._skewX,this._skewY)},setSkewY:function(a){this._skewY=a;this.setNodeDirty();this.dom.setSkew(this._skewX,
this._skewY)},setVisible:function(a){this._visible=a;this.setNodeDirty();this.dom&&(this.dom.style.display=a?"block":"none")},_setZOrder:function(a){this._zOrder=a;this.setNodeDirty();this.dom&&(this.dom.zIndex=a)},setParent:function(a){this._parent=a;null!==a&&(a.setAnchorPoint(a.getAnchorPoint()),this.setNodeDirty(),cc.DOM.parentDOM(this))},resumeSchedulerAndActions:function(){this.getScheduler().resumeTarget(this);this.getActionManager().resumeTarget(this);this.dom&&!this.dom.parentNode&&(this.getParent()?
cc.DOM.parentDOM(this):this.dom.appendTo(cc.container));this.dom&&(this.dom.style.visibility="visible")},pauseSchedulerAndActions:function(){this.getScheduler().pauseTarget(this);this.getActionManager().pauseTarget(this);this.dom&&(this.dom.style.visibility="hidden")},cleanup:function(){this.stopAllActions();this.unscheduleAllCallbacks();this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.cleanup);this.dom&&this.dom.remove()},removeFromParentAndCleanup:function(){this.dom.remove()},
setOpacity:function(a){this._opacity=a;this.dom.style.opacity=a/255},redraw:function(){if(this.isSprite){var a=this._children;this._children=[];cc.Sprite.prototype.visit.call(this,this.ctx);this._children=a}else cc.Sprite.prototype.visit.call(this,this.ctx)}};
cc.DOM._resetEGLViewDiv=function(){var a=cc.$("#EGLViewDiv");if(a){var c=cc.EGLView.getInstance(),d=c.getDesignResolutionSize(),e=c.getViewPortRect(),f=c.getFrameSize(),g=d.width,h=d.height;0===d.width&&0===d.height&&(g=f.width,h=f.height);d=e._size.width;0===e._size.width&&0===e._size.height&&(d=f.width);a.style.position="absolute";a.style.width=g+"px";a.style.maxHeight=h+"px";a.style.margin=0;a.resize(c.getScaleX(),c.getScaleY());a.style.left=(d-g)/2+"px";a.style.bottom="0px"}};
cc.DOM.parentDOM=function(a){var c=a.getParent();if(!c||!a.dom)return!1;c.dom||(cc.DOM.placeHolder(c),c.setParent=cc.DOM.methods.setParent);a.dom.appendTo(c.dom);c.setAnchorPoint(c.getAnchorPoint());if(c.getParent())cc.DOM.parentDOM(c);else if(c.isRunning())if(a=cc.$("#EGLViewDiv"))c.dom.appendTo(a);else{a=cc.$new("div");a.id="EGLViewDiv";var d=cc.EGLView.getInstance(),e=d.getDesignResolutionSize(),f=d.getViewPortRect(),g=d.getFrameSize(),h=e.width,k=e.height;0===e.width&&0===e.height&&(h=g.width,
k=g.height);e=f._size.width;0===f._size.width&&0===f._size.height&&(e=g.width);a.style.position="absolute";a.style.width=h+"px";a.style.maxHeight=k+"px";a.style.margin=0;a.resize(d.getScaleX(),d.getScaleY());a.style.left=(e-h)/2+"px";a.style.bottom="0px";c.dom.appendTo(a);a.appendTo(cc.container)}return!0};
cc.DOM.setTransform=function(a){if(a.ctx)if(a.ctx.translate(a.getAnchorPointInPoints().x,a.getAnchorPointInPoints().y),a.isSprite){var c=a._children;a._children=[];cc.Sprite.prototype.visit.call(a,a.ctx);a._children=c}else cc.Sprite.prototype.visit.call(a,a.ctx);a.dom&&(a.dom.position.x=a.getPosition().x,a.dom.position.y=-a.getPosition().y,a.dom.rotation=a.getRotation(),a.dom.scale={x:a.getScaleX(),y:a.getScaleY()},a.dom.skew={x:a.getSkewX(),y:a.getSkewY()},a.setAnchorPoint&&a.setAnchorPoint(a.getAnchorPoint()),
a.dom.transforms())};cc.DOM.forSprite=function(a){a.dom=cc.$new("div");a.canvas=cc.$new("canvas");var c=a.getContentSize();a.canvas.width=c.width;a.canvas.height=c.height;a.dom.style.position="absolute";a.dom.style.bottom=0;a.ctx=a.canvas.getContext("2d");a.dom.appendChild(a.canvas);a.getParent()&&cc.DOM.parentDOM(a);a.isSprite=!0};
cc.DOM.placeHolder=function(a){a.dom=cc.$new("div");a.placeholder=!0;a.dom.style.position="absolute";a.dom.style.bottom=0;a.dom.style.width=(a.getContentSize().width||cc.Director.getInstance().getWinSize().width)+"px";a.dom.style.maxHeight=(a.getContentSize().height||cc.Director.getInstance().getWinSize().height)+"px";a.dom.style.margin=0;cc.DOM.setTransform(a);a.dom.transforms();cc.DOM.addMethods(a)};
cc.DOM.convert=function(a){if(1<arguments.length)cc.DOM.convert(arguments);else if(1!=arguments.length||arguments[0].length)for(var c=arguments[0],d=0;d<c.length;d++)c[d]instanceof cc.Sprite?c[d].dom||cc.DOM.forSprite(c[d]):cc.log("DOM converter only supports sprite and menuitems yet"),cc.DOM.addMethods(c[d]),c[d].visit=function(){},c[d].transform=function(){},cc.DOM.setTransform(c[d]),c[d].setVisible(c[d].isVisible());else cc.DOM.convert([arguments[0]])};cc.KEYBOARD_RETURNTYPE_DEFAULT=0;cc.KEYBOARD_RETURNTYPE_DONE=1;cc.KEYBOARD_RETURNTYPE_SEND=2;cc.KEYBOARD_RETURNTYPE_SEARCH=3;cc.KEYBOARD_RETURNTYPE_GO=4;cc.EDITBOX_INPUT_MODE_ANY=0;cc.EDITBOX_INPUT_MODE_EMAILADDR=1;cc.EDITBOX_INPUT_MODE_NUMERIC=2;cc.EDITBOX_INPUT_MODE_PHONENUMBER=3;cc.EDITBOX_INPUT_MODE_URL=4;cc.EDITBOX_INPUT_MODE_DECIMAL=5;cc.EDITBOX_INPUT_MODE_SINGLELINE=6;cc.EDITBOX_INPUT_FLAG_PASSWORD=0;cc.EDITBOX_INPUT_FLAG_SENSITIVE=1;cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD=2;
cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE=3;cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS=4;cc.EditBoxDelegate=cc.Class.extend({editBoxEditingDidBegin:function(a){},editBoxEditingDidEnd:function(a){},editBoxTextChanged:function(a,c){},editBoxReturn:function(a){}});
cc.EditBox=cc.ControlButton.extend({_domInputSprite:null,_delegate:null,_editBoxInputMode:cc.EDITBOX_INPUT_MODE_ANY,_editBoxInputFlag:cc.EDITBOX_INPUT_FLAG_SENSITIVE,_keyboardReturnType:cc.KEYBOARD_RETURNTYPE_DEFAULT,_text:"",_placeholderText:"",_textColor:null,_placeholderColor:null,_maxLength:50,_adjustHeight:18,_edTxt:null,_edFontSize:14,_edFontName:"Arial",_placeholderFontName:"",_placeholderFontSize:14,_tooltip:!1,ctor:function(a){cc.ControlButton.prototype.ctor.call(this);this._textColor=cc.white();
this._placeholderColor=cc.gray();this.setContentSize(a);this._domInputSprite=new cc.Sprite;this._domInputSprite.draw=function(){};this.addChild(this._domInputSprite);var c=this;this._edTxt=document.createElement("input");this._edTxt.type="text";this._edTxt.style.fontSize=this._edFontSize+"px";this._edTxt.style.color="#000000";this._edTxt.style.border=0;this._edTxt.style.background="transparent";this._edTxt.style.width="100%";this._edTxt.style.height="100%";this._edTxt.style.active=0;this._edTxt.style.outline=
"medium";this._edTxt.addEventListener("input",function(){c._delegate&&c._delegate.editBoxTextChanged&&c._delegate.editBoxTextChanged(c,this.value)});this._edTxt.addEventListener("keypress",function(a){a.keyCode===cc.KEY.enter&&(a.stopPropagation(),a.preventDefault(),cc.canvas.focus())});this._edTxt.addEventListener("focus",function(){this.value==c._placeholderText&&(this.value="",this.style.fontSize=c._edFontSize+"px",this.style.color=cc.convertColor3BtoHexString(c._textColor));c._delegate&&c._delegate.editBoxEditingDidBegin&&
c._delegate.editBoxEditingDidBegin(c)});this._edTxt.addEventListener("blur",function(){""==this.value&&(this.value=c._placeholderText,this.style.fontSize=c._placeholderFontSize+"px",this.style.color=cc.convertColor3BtoHexString(c._placeholderColor));c._delegate&&c._delegate.editBoxEditingDidEnd&&c._delegate.editBoxEditingDidEnd(c);c._delegate&&c._delegate.editBoxReturn&&c._delegate.editBoxReturn(c)});cc.DOM.convert(this._domInputSprite);this._domInputSprite.dom.appendChild(this._edTxt);this._domInputSprite.dom.showTooltipDiv=
!1;this._domInputSprite.dom.style.width=a.width-6+"px";this._domInputSprite.dom.style.height=a.height-6+"px";this._domInputSprite.canvas.remove()},setFont:function(a,c){this._edFontSize=c;this._edFontName=a;this._setFontToEditBox()},setFontName:function(a){this._edFontName=a;this._setFontToEditBox()},setFontSize:function(a){this._edFontSize=a;this._setFontToEditBox()},_setFontToEditBox:function(){this._edTxt.value!=this._placeholderText&&(this._edTxt.style.fontFamily=this._edFontName,this._edTxt.style.fontSize=
this._edFontSize+"px")},setText:function(a){null!=a&&(""==a?(this._edTxt.value=this._placeholderText,this._edTxt.style.color=cc.convertColor3BtoHexString(this._placeholderColor)):(this._edTxt.value=a,this._edTxt.style.color=cc.convertColor3BtoHexString(this._textColor)))},setFontColor:function(a){this._textColor=a;this._edTxt.value!=this._placeholderText&&(this._edTxt.style.color=cc.convertColor3BtoHexString(a))},setMaxLength:function(a){!isNaN(a)&&0<a&&(this._maxLength=a,this._edTxt.maxLength=a)},
getMaxLength:function(){return this._maxLength},setPlaceHolder:function(a){if(null!=a){var c=this._placeholderText;this._placeholderText=a;this._edTxt.value==c&&(this._edTxt.value=a,this._edTxt.style.color=cc.convertColor3BtoHexString(this._placeholderColor),this._setPlaceholderFontToEditText())}},setPlaceholderFont:function(a,c){this._placeholderFontName=a;this._placeholderFontSize=c;this._setPlaceholderFontToEditText()},setPlaceholderFontName:function(a){this._placeholderFontName=a;this._setPlaceholderFontToEditText()},
setPlaceholderFontSize:function(a){this._placeholderFontSize=a;this._setPlaceholderFontToEditText()},_setPlaceholderFontToEditText:function(){this._edTxt.value==this._placeholderText&&(this._edTxt.style.fontFamily=this._placeholderFontName,this._edTxt.style.fontSize=this._placeholderFontSize+"px")},setPlaceholderFontColor:function(a){this._placeholderColor=a;this._edTxt.value==this._placeholderText&&(this._edTxt.style.color=cc.convertColor3BtoHexString(a))},setInputFlag:function(a){this._editBoxInputFlag=
a;this._edTxt.type=a==cc.EDITBOX_INPUT_FLAG_PASSWORD?"password":"text"},getText:function(){return this._edTxt.value},initWithSizeAndBackgroundSprite:function(a,c){return this.initWithBackgroundSprite(c)?(this._domInputSprite.setPosition(3,3),this.setZoomOnTouchDown(!1),this.setPreferredSize(a),this.setPosition(0,0),this._addTargetWithActionForControlEvent(this,this.touchDownAction,cc.CONTROL_EVENT_TOUCH_UP_INSIDE),!0):!1},setDelegate:function(a){this._delegate=a},getPlaceHolder:function(){return this._placeholderText},
setInputMode:function(a){this._editBoxInputMode=a},setReturnType:function(a){this._keyboardReturnType=a},keyboardWillShow:function(a){var c=cc.EditBox.getRect(this);c.y-=4;c.intersectsRect(a.end)?this._adjustHeight=a.end.getMaxY()-c.getMinY():cc.log("needn't to adjust view layout.")},keyboardDidShow:function(a){},keyboardWillHide:function(a){},keyboardDidHide:function(a){},touchDownAction:function(a,c){},initWithBackgroundColor:function(a,c){this._edWidth=a.width;this.dom.style.width=this._edWidth.toString()+
"px";this._edHeight=a.height;this.dom.style.height=this._edHeight.toString()+"px";this.dom.style.backgroundColor=cc.convertColor3BtoHexString(c)}});cc.EditBox.getRect=function(a){var c=a.getContentSize(),c=cc.rect(0,0,c.width,c.height);return cc.RectApplyAffineTransform(c,a.nodeToWorldTransform())};
cc.EditBox.create=function(a,c,d,e){var f=new cc.EditBox(a);c instanceof cc.Color3B?f.setBackgroundColor(c):f.initWithSizeAndBackgroundSprite(a,c)&&(d&&f.setBackgroundSpriteForState(d,cc.CONTROL_STATE_HIGHLIGHTED),e&&f.setBackgroundSpriteForState(e,cc.CONTROL_STATE_DISABLED));return f};cc.Component=cc.Class.extend({_owner:null,_name:null,_enabled:null,ctor:function(){this._owner=null;this._name="";this._enabled=!0},init:function(){return!0},onEnter:function(){},onExit:function(){},update:function(a){},serialize:function(a){},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a},getName:function(){return this._name},setName:function(a){this._name=a},setOwner:function(a){this._owner=a},getOwner:function(){return this._owner}});cc.Component.create=function(){return new cc.Component};cc.ComponentContainer=cc.Class.extend({_components:null,_owner:null,ctor:function(a){this._components=null;this._owner=a},getComponent:function(a){if(!a)throw"cc.ComponentContainer.getComponent(): name should be non-null";a=a.trim();return this._components[a]},add:function(a){if(!a)throw"cc.ComponentContainer.add(): component should be non-null";if(a.getOwner())return cc.log("cc.ComponentContainer.add(): Component already added. It can't be added again"),!1;null==this._components&&(this._components=
{},this._owner.scheduleUpdate());if(this._components[a.getName()])return cc.log("cc.ComponentContainer.add(): Component already added. It can't be added again"),!1;a.setOwner(this._owner);this._components[a.getName()]=a;a.onEnter();return!0},remove:function(a){if(!a)throw"cc.ComponentContainer.remove(): name should be non-null";if(!this._components)return!1;if(a instanceof cc.Component)return this._removeByComponent(a);a=a.trim();return this._removeByComponent(this._components[a])},_removeByComponent:function(a){if(a)return!1;
a.onExit();a.setOwner(null);delete this._components[a.getName()];return!0},removeAll:function(){if(this._components){var a=this._components,c;for(c in a){var d=a[c];d.onExit();d.setOwner(null);delete a[c]}this._owner.unscheduleUpdate();this._components=null}},_alloc:function(){this._components={}},visit:function(a){if(this._components){var c=this._components,d;for(d in c)c[d].update(a)}},isEmpty:function(){if(!this._components)return!0;for(var a in this._components)return!1;return!0}});var ccs=ccs||{};ccs.Class=ccs.Class||cc.Class;ccs.Class.extend=ccs.Class.extend||cc.Class.extend;ccs.Node=ccs.Node||cc.Node;ccs.Node.extend=ccs.Node.extend||cc.Node.extend;ccs.NodeRGBA=ccs.NodeRGBA||cc.NodeRGBA;ccs.NodeRGBA.extend=ccs.NodeRGBA.extend||cc.NodeRGBA.extend;ccs.Sprite=ccs.Sprite||cc.Sprite;ccs.Sprite.extend=ccs.Sprite.extend||cc.Sprite.extend;ccs.Component=ccs.Component||cc.Component;ccs.Component.extend=ccs.Component.extend||cc.Component.extend;ccs.CocoStudioVersion="1.3";ccs.VERSION_COMBINED=0.3;ccs.VERSION_CHANGE_ROTATION_RANGE=1;ccs.VERSION_COLOR_READING=1.1;ccs.MAX_VERTEXZ_VALUE=5E6;ccs.ARMATURE_MAX_CHILD=50;ccs.ARMATURE_MAX_ZORDER=100;ccs.ARMATURE_MAX_COUNT=ccs.MAX_VERTEXZ_VALUE/ccs.ARMATURE_MAX_CHILD/ccs.ARMATURE_MAX_ZORDER;ccs.AUTO_ADD_SPRITE_FRAME_NAME_PREFIX=!1;ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT=!1;ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX=!1;ccs.armatureVersion=function(){return"v1.1.0.0"};ccs.CONST_VERSION="version";ccs.CONST_VERSION_2_0=2;ccs.CONST_VERSION_COMBINED=0.3;ccs.CONST_SKELETON="skeleton";ccs.CONST_ARMATURES="armatures";ccs.CONST_ARMATURE="armature";ccs.CONST_BONE="b";ccs.CONST_DISPLAY="d";ccs.CONST_ANIMATIONS="animations";ccs.CONST_ANIMATION="animation";ccs.CONST_MOVEMENT="mov";ccs.CONST_FRAME="f";ccs.CONST_TEXTURE_ATLAS="TextureAtlas";ccs.CONST_SUB_TEXTURE="SubTexture";ccs.CONST_A_NAME="name";ccs.CONST_A_DURATION="dr";ccs.CONST_A_FRAME_INDEX="fi";
ccs.CONST_A_DURATION_TO="to";ccs.CONST_A_DURATION_TWEEN="drTW";ccs.CONST_A_LOOP="lp";ccs.CONST_A_MOVEMENT_SCALE="sc";ccs.CONST_A_MOVEMENT_DELAY="dl";ccs.CONST_A_DISPLAY_INDEX="dI";ccs.CONST_A_VERT="vert";ccs.CONST_A_FRAG="frag";ccs.CONST_A_PLIST="plist";ccs.CONST_A_PARENT="parent";ccs.CONST_A_SKEW_X="kX";ccs.CONST_A_SKEW_Y="kY";ccs.CONST_A_SCALE_X="cX";ccs.CONST_A_SCALE_Y="cY";ccs.CONST_A_Z="z";ccs.CONST_A_EVENT="evt";ccs.CONST_A_SOUND="sd";ccs.CONST_A_SOUND_EFFECT="sdE";
ccs.CONST_A_TWEEN_EASING="twE";ccs.CONST_A_TWEEN_ROTATION="twR";ccs.CONST_A_EASING_PARAM="twEP";ccs.CONST_A_IS_ARMATURE="isArmature";ccs.CONST_A_DISPLAY_TYPE="displayType";ccs.CONST_A_MOVEMENT="mov";ccs.CONST_A_BLEND_TYPE="bd";ccs.CONST_A_BLEND_SRC="bd_src";ccs.CONST_A_BLEND_DST="bd_dst";ccs.CONST_A_X="x";ccs.CONST_A_Y="y";ccs.CONST_A_COCOS2DX_X="cocos2d_x";ccs.CONST_A_COCOS2DX_Y="cocos2d_y";ccs.CONST_A_WIDTH="width";ccs.CONST_A_HEIGHT="height";ccs.CONST_A_PIVOT_X="pX";ccs.CONST_A_PIVOT_Y="pY";
ccs.CONST_A_COCOS2D_PIVOT_X="cocos2d_pX";ccs.CONST_A_COCOS2D_PIVOT_Y="cocos2d_pY";ccs.CONST_A_ALPHA="a";ccs.CONST_A_RED="r";ccs.CONST_A_GREEN="g";ccs.CONST_A_BLUE="b";ccs.CONST_A_ALPHA_OFFSET="aM";ccs.CONST_A_RED_OFFSET="rM";ccs.CONST_A_GREEN_OFFSET="gM";ccs.CONST_A_BLUE_OFFSET="bM";ccs.CONST_A_COLOR_TRANSFORM="colorTransform";ccs.CONST_A_TWEEN_FRAME="tweenFrame";ccs.CONST_A_ROTATION="rotation";ccs.CONST_A_USE_COLOR_INFO="uci";ccs.CONST_CONTOUR="con";ccs.CONST_CONTOUR_VERTEX="con_vt";
ccs.CONST_MOVEMENT_EVENT_FRAME="movementEventFrame";ccs.CONST_SOUND_FRAME="soundFrame";ccs.CONST_FL_NAN="NaN";ccs.CONST_FRAME_DATA="frame_data";ccs.CONST_MOVEMENT_BONE_DATA="mov_bone_data";ccs.CONST_MOVEMENT_FRAME_DATA="mov_frame_data";ccs.CONST_MOVEMENT_DATA="mov_data";ccs.CONST_ANIMATION_DATA="animation_data";ccs.CONST_DISPLAY_DATA="display_data";ccs.CONST_SKIN_DATA="skin_data";ccs.CONST_BONE_DATA="bone_data";ccs.CONST_ARMATURE_DATA="armature_data";ccs.CONST_CONTOUR_DATA="contour_data";
ccs.CONST_TEXTURE_DATA="texture_data";ccs.CONST_VERTEX_POINT="vertex";ccs.CONST_COLOR_INFO="color";ccs.CONST_CONFIG_FILE_PATH="config_file_path";ccs.CONST_CONTENT_SCALE="content_scale";ccs.DataReaderHelper=ccs.DataReaderHelper||ccs.Class.extend({});ccs.DataReaderHelper._configFileList=[];ccs.DataReaderHelper._flashToolVersion=ccs.CONST_VERSION_2_0;ccs.DataReaderHelper._cocoStudioVersion=ccs.CONST_VERSION_COMBINED;ccs.DataReaderHelper._positionReadScale=1;ccs.DataReaderHelper._asyncRefCount=0;
ccs.DataReaderHelper._asyncRefTotalCount=0;ccs.DataInfo=function(){this.asyncStruct=null;this.configFileQueue=[];this.contentScale=1;this.baseFilePath=this.filename="";this.cocoStudioVersion=this.flashToolVersion=0};ccs.DataReaderHelper.setPositionReadScale=function(a){this._positionReadScale=a};ccs.DataReaderHelper.getPositionReadScale=function(){return this._positionReadScale};ccs.DataReaderHelper.purge=function(){this._configFileList=[];this._asyncRefTotalCount=this._asyncRefCount=0};
ccs.DataReaderHelper.addDataFromFile=function(a,c){var d=cc.FileUtils.getInstance().fullPathForFilename(a);if(!cc.ArrayContainsObject(this._configFileList,d)){this._configFileList.push(d);this._initBaseFilePath(a);var e=d.lastIndexOf("."),e=d.substring(e,d.length),f=new ccs.DataInfo;f.filename=a;f.basefilePath=this._initBaseFilePath(a);".xml"==e?this.addDataFromXML(d,f):".json"!=e&&".ExportJson"!=e||this.addDataFromJson(a,f,c)}};
ccs.DataReaderHelper.addDataFromFileAsync=function(a,c,d,e){var f=cc.FileUtils.getInstance().fullPathForFilename(a);if(cc.ArrayContainsObject(this._configFileList,f))c&&d&&(0==this._asyncRefTotalCount&&0==this._asyncRefCount?this._asyncCallBack(c,d,1):this._asyncCallBack(c,d,(this._asyncRefTotalCount-this._asyncRefCount)/this._asyncRefTotalCount));else{this._asyncRefTotalCount++;this._asyncRefCount++;var g=this;cc.Director.getInstance().getScheduler().scheduleCallbackForTarget(this,function(){g.addDataFromFile(a,
e);g._asyncRefCount--;g._asyncCallBack(c,d,(g._asyncRefTotalCount-g._asyncRefCount)/g._asyncRefTotalCount)},0.1,!1)}};ccs.DataReaderHelper._asyncCallBack=function(a,c,d){if(a&&"string"==typeof c)a[c](d);else a&&"function"==typeof c&&c.call(a,d)};ccs.DataReaderHelper._initBaseFilePath=function(a){var c=a.lastIndexOf("/");return a=-1<c?a.substr(0,c+1):""};ccs.DataReaderHelper.addDataFromXML=function(a,c){var d=cc.SAXParser.getInstance().tmxParse(a).documentElement;d&&this.addDataFromCache(d,c)};
ccs.DataReaderHelper.addDataFromCache=function(a,c){if(a){c.flashToolVersion=parseFloat(a.getAttribute(ccs.CONST_VERSION));for(var d=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_ARMATURES+" \x3e  "+ccs.CONST_ARMATURE+""),e=ccs.ArmatureDataManager.getInstance(),f=0;f<d.length;f++){var g=this.decodeArmature(d[f],c);e.addArmatureData(g.name,g,c.filename)}d=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_ANIMATIONS+" \x3e  "+ccs.CONST_ANIMATION+"");for(f=0;f<d.length;f++)g=this.decodeAnimation(d[f],
c),e.addAnimationData(g.name,g,c.filename);d=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_TEXTURE_ATLAS+" \x3e  "+ccs.CONST_SUB_TEXTURE+"");for(f=0;f<d.length;f++)g=this.decodeTexture(d[f],c),e.addTextureData(g.name,g,c.filename)}else cc.log("XML error  or  XML is empty.")};
ccs.DataReaderHelper.decodeArmature=function(a,c){var d=a.getAttribute(ccs.CONST_A_NAME),e=new ccs.ArmatureData;e.name=d;for(var d=a.querySelectorAll(ccs.CONST_ARMATURE+" \x3e "+ccs.CONST_BONE),f=0;f<d.length;f++){var g=d[f],h=g.getAttribute(ccs.CONST_A_PARENT),k=null;if(h)for(var m=0;m<d.length&&(k=d[m],h!=d[m].getAttribute(ccs.CONST_A_NAME));m++);g=this.decodeBone(g,k,c);e.addBoneData(g)}return e};
ccs.DataReaderHelper.decodeBone=function(a,c,d){var e=a.getAttribute(ccs.CONST_A_NAME);if(""!=e){c=new ccs.BoneData;c.name=e;c.parentName=a.getAttribute(ccs.CONST_A_PARENT)||"";c.zOrder=parseInt(a.getAttribute(ccs.CONST_A_Z))||0;a=a.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_DISPLAY);for(var f,e=0;e<a.length;e++)f=a[e],f=this.decodeBoneDisplay(f,d),c.addDisplayData(f);return c}};
ccs.DataReaderHelper.decodeBoneDisplay=function(a,c){var d=null;1==(parseFloat(a.getAttribute(ccs.CONST_A_IS_ARMATURE))||0)?(d=new ccs.ArmatureDisplayData,d.displayType=ccs.DisplayType.armature):(d=new ccs.SpriteDisplayData,d.displayType=ccs.DisplayType.sprite);var e=a.getAttribute(ccs.CONST_A_NAME)||"";e&&(d.displayName=e);return d};
ccs.DataReaderHelper.decodeAnimation=function(a,c){var d=a.getAttribute(ccs.CONST_A_NAME),e=new ccs.AnimationData,f=ccs.ArmatureDataManager.getInstance().getArmatureData(d);e.name=d;for(var d=a.querySelectorAll(ccs.CONST_ANIMATION+" \x3e "+ccs.CONST_MOVEMENT),g=null,h=0;h<d.length;h++)g=d[h],g=this.decodeMovement(g,f,c),e.addMovement(g);return e};
ccs.DataReaderHelper.decodeMovement=function(a,c,d){var e=a.getAttribute(ccs.CONST_A_NAME),f=new ccs.MovementData;f.name=e;e=e=0;e=parseFloat(a.getAttribute(ccs.CONST_A_DURATION))||0;f.duration=e;e=parseFloat(a.getAttribute(ccs.CONST_A_DURATION_TO))||0;f.durationTo=e;e=parseFloat(a.getAttribute(ccs.CONST_A_DURATION_TWEEN))||0;f.durationTween=e;e=a.getAttribute(ccs.CONST_A_LOOP);f.loop=e?Boolean(parseFloat(e)):!0;if(e=a.getAttribute(ccs.CONST_A_TWEEN_EASING))e!=ccs.CONST_FL_NAN?(e=parseFloat(e)||0,
f.tweenEasing=2==e?ccs.TweenType.sineEaseInOut:e):f.tweenEasing=ccs.TweenType.linear;a=a.querySelectorAll(ccs.CONST_MOVEMENT+" \x3e "+ccs.CONST_BONE);for(var g=null,e=0;e<a.length;e++){var g=a[e],h=g.getAttribute(ccs.CONST_A_NAME);if(!f.getMovementBoneData(h)){var h=c.getBoneData(h),k=h.parentName,m=null;if(""!=k)for(var n=0;n<a.length&&(m=a[n],k!=m.getAttribute(ccs.CONST_A_NAME));n++);g=this.decodeMovementBone(g,m,h,d);f.addMovementBoneData(g)}}return f};
ccs.DataReaderHelper.decodeMovementBone=function(a,c,d,e){var f=new ccs.MovementBoneData,g;a&&(g=parseFloat(a.getAttribute(ccs.CONST_A_MOVEMENT_SCALE))||0,f.scale=g,g=parseFloat(a.getAttribute(ccs.CONST_A_MOVEMENT_DELAY))||0,0<g&&(g-=1),f.delay=g);var h=0,k=g=0,m=null,n=[];if(null!=c){for(var p=c.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_FRAME),h=0;h<p.length;h++)n.push(p[h]);h=n.length}var p=0,q=a.getAttribute(ccs.CONST_A_NAME);f.name=q;a=a.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_FRAME);
for(var s=q=0;s<a.length;s++){var r=a[s];if(c)for(;q<h&&(m?p<g||p>=g+k:1);)m=n[q],g+=k,k=parseFloat(m.getAttribute(ccs.CONST_A_DURATION)),q++;r=this.decodeFrame(r,m,d,e);f.addFrameData(r);r.frameID=p;p+=r.duration;f.duration=p}c=f.frameList;d=Math.PI;for(h=c.length-1;0<=h;h--)if(0<h){e=c[h].skewX-c[h-1].skewX;g=c[h].skewY-c[h-1].skewY;if(e<-d||e>d)c[h-1].skewX=0>e?c[h-1].skewX-2*d:c[h-1].skewX+2*d;if(g<-d||g>d)c[h-1].skewY=0>g?c[h-1].skewY-2*d:c[h-1].skewY+2*d}0<f.frameList.length&&(r=new ccs.FrameData,
r.copy(f.frameList[f.frameList.length-1]),r.frameID=f.duration,f.addFrameData(r));return f};
ccs.DataReaderHelper.decodeFrame=function(a,c,d,e){d=new ccs.FrameData;d.movement=a.getAttribute(ccs.CONST_A_MOVEMENT)||"";d.event=a.getAttribute(ccs.CONST_A_EVENT)||"";d.blendType=parseInt(a.getAttribute(ccs.CONST_A_BLEND_TYPE))||ccs.BlendType.normal;var f=d.blendFunc;switch(d.blendType){case ccs.BlendType.normal:f.src=cc.BLEND_SRC;f.dst=cc.BLEND_DST;break;case ccs.BlendType.add:f.src=gl.SRC_ALPHA;f.dst=gl.ONE;break;case ccs.BlendType.multiply:f.src=gl.ONE_MINUS_SRC_ALPHA;f.dst=gl.ONE_MINUS_DST_COLOR;
break;case ccs.BlendType.screen:f.src=gl.ONE,f.dst=gl.ONE_MINUS_DST_COLOR}d.sound=a.getAttribute(ccs.CONST_A_SOUND)||"";d.soundEffect=a.getAttribute(ccs.CONST_A_SOUND_EFFECT)||"";f=a.getAttribute(ccs.CONST_A_TWEEN_FRAME);null==f&&(f=!0);d.isTween=Boolean(f);e.flashToolVersion>=ccs.CONST_VERSION_2_0?(d.x=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2DX_X))||0,d.y=-parseFloat(a.getAttribute(ccs.CONST_A_COCOS2DX_Y))||0):(d.x=parseFloat(a.getAttribute(ccs.CONST_A_X))||0,d.y=-parseFloat(a.getAttribute(ccs.CONST_A_Y))||
0);d.x*=this._positionReadScale;d.y*=this._positionReadScale;d.scaleX=parseFloat(a.getAttribute(ccs.CONST_A_SCALE_X))||0;d.scaleY=parseFloat(a.getAttribute(ccs.CONST_A_SCALE_Y))||0;d.skewX=cc.DEGREES_TO_RADIANS(parseFloat(a.getAttribute(ccs.CONST_A_SKEW_X))||0);d.skewY=cc.DEGREES_TO_RADIANS(-parseFloat(a.getAttribute(ccs.CONST_A_SKEW_Y))||0);d.duration=parseFloat(a.getAttribute(ccs.CONST_A_DURATION))||0;d.displayIndex=parseFloat(a.getAttribute(ccs.CONST_A_DISPLAY_INDEX))||0;d.zOrder=parseFloat(a.getAttribute(ccs.CONST_A_Z))||
0;d.tweenRotate=parseFloat(a.getAttribute(ccs.CONST_A_TWEEN_ROTATION))||0;f=a.querySelectorAll(ccs.CONST_FRAME+" \x3e "+ccs.CONST_A_COLOR_TRANSFORM);if(0<f.length){var g=f[0],h=f=0,k=0,m=0,n=0,p=0,q=0,s=100,f=parseFloat(g.getAttribute(ccs.CONST_A_ALPHA))||f,h=parseFloat(g.getAttribute(ccs.CONST_A_RED))||h,k=parseFloat(g.getAttribute(ccs.CONST_A_GREEN))||k,m=parseFloat(g.getAttribute(ccs.CONST_A_BLUE))||m,r=g.getAttribute(ccs.CONST_A_ALPHA_OFFSET);r&&(n=parseFloat(r));(r=g.getAttribute(ccs.CONST_A_RED_OFFSET))&&
(p=parseFloat(r));var t=g.getAttribute(ccs.CONST_A_GREEN_OFFSET);r&&(q=parseFloat(t));(g=g.getAttribute(ccs.CONST_A_BLUE_OFFSET))&&(s=parseFloat(g));d.a=2.55*n+f;d.r=2.55*p+h;d.g=2.55*q+k;d.b=2.55*s+m;d.isUseColorInfo=!0}-1==d.displayIndex&&(d.a=0);if(a=a.getAttribute(ccs.CONST_A_TWEEN_EASING))d.tweenEasing=a!=ccs.CONST_FL_NAN?2==a?ccs.TweenType.sineEaseInOut:a:ccs.TweenType.linear;c&&(a=new ccs.BaseData,e.flashToolVersion>=ccs.CONST_VERSION_2_0?(a.x=parseFloat(c.getAttribute(ccs.CONST_A_COCOS2DX_X))||
0,a.y=parseFloat(c.getAttribute(ccs.CONST_A_COCOS2DX_Y))||0):(a.x=parseFloat(c.getAttribute(ccs.CONST_A_X))||0,a.y=parseFloat(c.getAttribute(ccs.CONST_A_Y))||0),a.skewX=parseFloat(c.getAttribute(ccs.CONST_A_SKEW_X))||0,a.skewY=parseFloat(c.getAttribute(ccs.CONST_A_SKEW_Y))||0,a.y=-a.y,a.skewX=cc.DEGREES_TO_RADIANS(a.skewX),a.skewY=cc.DEGREES_TO_RADIANS(-a.skewY),ccs.TransformHelp.transformFromParent(d,a));return d};
ccs.DataReaderHelper.decodeTexture=function(a,c){var d=new ccs.TextureData;a.getAttribute(ccs.CONST_A_NAME)&&(d.name=a.getAttribute(ccs.CONST_A_NAME));var e,f,g,h=0;c.flashToolVersion>=ccs.CONST_VERSION_2_0?(e=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_X))||0,f=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_Y))||0):(e=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_X))||0,f=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_Y))||0);g=parseFloat(a.getAttribute(ccs.CONST_A_WIDTH))||0;h=parseFloat(a.getAttribute(ccs.CONST_A_HEIGHT))||
0;d.pivotX=e/g;d.pivotY=(h-f)/h;e=a.querySelectorAll(ccs.CONST_SUB_TEXTURE+" \x3e "+ccs.CONST_CONTOUR);for(f=0;f<e.length;f++)this.decodeContour(e[f],c);return d};ccs.DataReaderHelper.decodeContour=function(a,c){for(var d=new ccs.ContourData,e=a.querySelectorAll(ccs.CONST_CONTOUR+" \x3e "+ccs.CONST_CONTOUR_VERTEX),f,g=0;g<e.length;g++){f=e[g];var h=cc.p(0,0);h.x=parseFloat(f.getAttribute(ccs.CONST_A_X))||0;h.y=parseFloat(f.getAttribute(ccs.CONST_A_Y))||0;d.vertexList.push(h)}return d};
ccs.DataReaderHelper.addDataFromJson=function(a,c,d){a=cc.FileUtils.getInstance().getTextFileData(a);this.addDataFromJsonCache(a,c,d)};
ccs.DataReaderHelper.addDataFromJsonCache=function(a,c,d){var e=JSON.parse(a);c.contentScale=e[ccs.CONST_CONTENT_SCALE]||1;var f=e[ccs.CONST_ARMATURE_DATA]||[],g;for(a=0;a<f.length;a++)g=this.decodeArmatureFromJSON(f[a],c),ccs.ArmatureDataManager.getInstance().addArmatureData(g.name,g,c.filename);f=e[ccs.CONST_ANIMATION_DATA]||[];for(a=0;a<f.length;a++)g=this.decodeAnimationFromJson(f[a],c),ccs.ArmatureDataManager.getInstance().addAnimationData(g.name,g,c.filename);f=e[ccs.CONST_TEXTURE_DATA]||[];
for(a=0;a<f.length;a++)g=this.decodeTextureFromJson(f[a],c),ccs.ArmatureDataManager.getInstance().addTextureData(g.name,g,c.filename);if(d)for(d=e[ccs.CONST_CONFIG_FILE_PATH]||[],a=0;a<d.length;a++)e=d[a],f=e.lastIndexOf("."),e=e.substring(0,f),f=c.basefilePath+e+".plist",e=c.basefilePath+e+".png",ccs.ArmatureDataManager.getInstance().addSpriteFrameFromFile(f,e,c.filename)};
ccs.DataReaderHelper.decodeArmatureFromJSON=function(a,c){var d=new ccs.ArmatureData,e=a[ccs.CONST_A_NAME];e&&(d.name=e);c.cocoStudioVersion=d.dataVersion=a[ccs.CONST_VERSION]||0.1;for(var e=a[ccs.CONST_BONE_DATA],f=0;f<e.length;f++)d.addBoneData(this.decodeBoneFromJson(e[f],c));return d};
ccs.DataReaderHelper.decodeBoneFromJson=function(a,c){var d=new ccs.BoneData;this.decodeNodeFromJson(d,a,c);d.name=a[ccs.CONST_A_NAME]||"";d.parentName=a[ccs.CONST_A_PARENT]||"";for(var e=a[ccs.CONST_DISPLAY_DATA]||[],f=0;f<e.length;f++){var g=this.decodeBoneDisplayFromJson(e[f],c);d.addDisplayData(g)}return d};
ccs.DataReaderHelper.decodeBoneDisplayFromJson=function(a,c){var d=a[ccs.CONST_A_DISPLAY_TYPE]||ccs.DisplayType.sprite,e=null;switch(d){case ccs.DisplayType.sprite:e=new ccs.SpriteDisplayData;e.displayName=a[ccs.CONST_A_NAME]||"";var f=(a[ccs.CONST_SKIN_DATA]||[])[0];if(f){var g=e.skinData;g.x=(f[ccs.CONST_A_X]||0)*this._positionReadScale;g.y=(f[ccs.CONST_A_Y]||0)*this._positionReadScale;void 0!==f[ccs.CONST_A_SCALE_X]&&(g.scaleX=f[ccs.CONST_A_SCALE_X]);void 0!==f[ccs.CONST_A_SCALE_Y]&&(g.scaleY=
f[ccs.CONST_A_SCALE_Y]);g.skewX=f[ccs.CONST_A_SKEW_X]||0;g.skewY=f[ccs.CONST_A_SKEW_Y]||0;g.x*=c.contentScale;g.y*=c.contentScale}break;case ccs.DisplayType.armature:e=new ccs.ArmatureDisplayData;e.displayName=a[ccs.CONST_A_NAME]||"";break;case ccs.DisplayType.particle:e=new ccs.ParticleDisplayData;e.displayName=c.basefilePath+a[ccs.CONST_A_PLIST]||"";break;default:e=new ccs.SpriteDisplayData}e.displayType=d;return e};
ccs.DataReaderHelper.decodeAnimationFromJson=function(a,c){var d=new ccs.AnimationData;d.name=a[ccs.CONST_A_NAME]||"";for(var e=a[ccs.CONST_MOVEMENT_DATA]||[],f=0;f<e.length;f++){var g=this.decodeMovementFromJson(e[f],c);d.addMovement(g)}return d};
ccs.DataReaderHelper.decodeMovementFromJson=function(a,c){var d=new ccs.MovementData;d.loop=a[ccs.CONST_A_LOOP]||!1;d.durationTween=a[ccs.CONST_A_DURATION_TWEEN]||0;d.durationTo=a[ccs.CONST_A_DURATION_TO]||0;d.duration=a[ccs.CONST_A_DURATION]||0;void 0!==a[ccs.CONST_A_MOVEMENT_SCALE]&&(d.scale=a[ccs.CONST_A_MOVEMENT_SCALE]);d.tweenEasing=a[ccs.CONST_A_TWEEN_EASING]||ccs.TweenType.linear;d.name=a[ccs.CONST_A_NAME]||"";for(var e=a[ccs.CONST_MOVEMENT_BONE_DATA]||[],f=0;f<e.length;f++){var g=this.decodeMovementBoneFromJson(e[f],
c);d.addMovementBoneData(g)}return d};
ccs.DataReaderHelper.decodeMovementBoneFromJson=function(a,c){var d=new ccs.MovementBoneData;d.delay=a[ccs.CONST_A_MOVEMENT_DELAY]||0;void 0!==a[ccs.CONST_A_MOVEMENT_SCALE]&&(d.scale=a[ccs.CONST_A_MOVEMENT_SCALE]);d.name=a[ccs.CONST_A_NAME]||"";for(var e=a[ccs.CONST_FRAME_DATA]||[],f=0;f<e.length;f++){var g=this.decodeFrameFromJson(e[f],c);d.addFrameData(g);c.cocoStudioVersion<ccs.CONST_VERSION_COMBINED&&(g.frameID=d.duration,d.duration+=g.duration)}if(c.cocoStudioVersion<ccs.VERSION_CHANGE_ROTATION_RANGE)for(e=
d.frameList,g=Math.PI,f=e.length-1;0<=f;f--)if(0<f){var h=e[f].skewX-e[f-1].skewX,k=e[f].skewY-e[f-1].skewY;if(h<-g||h>g)e[f-1].skewX=0>h?e[f-1].skewX-2*g:e[f-1].skewX+2*g;if(k<-g||k>g)e[f-1].skewY=0>k?e[f-1].skewY-2*g:e[f-1].skewY+2*g}c.cocoStudioVersion<ccs.CONST_VERSION_COMBINED&&0<d.frameList.length&&(g=new ccs.FrameData,g.copy(d.frameList[d.frameList.length-1]),d.addFrameData(g),g.frameID=d.duration);return d};
ccs.DataReaderHelper.decodeFrameFromJson=function(a,c){var d=new ccs.FrameData;this.decodeNodeFromJson(d,a,c);d.duration=a[ccs.CONST_A_DURATION]||0;d.tweenEasing=a[ccs.CONST_A_TWEEN_EASING]||ccs.TweenType.linear;d.displayIndex=a[ccs.CONST_A_DISPLAY_INDEX]||0;var e=a[ccs.CONST_A_BLEND_DST]||cc.BLEND_DST;d.blendFunc.src=a[ccs.CONST_A_BLEND_SRC]||cc.BLEND_SRC;d.blendFunc.dst=e;d.event=a[ccs.CONST_A_EVENT]||null;void 0!==a[ccs.CONST_A_TWEEN_FRAME]&&(d.isTween=a[ccs.CONST_A_TWEEN_FRAME]);c.cocoStudioVersion<
ccs.CONST_VERSION_COMBINED?d.duration=a[ccs.CONST_A_DURATION]||0:d.frameID=a[ccs.CONST_A_FRAME_INDEX]||0;for(var e=a[ccs.CONST_A_EASING_PARAM]||[],f=0;f<e.length;f++)d.easingParams[f]=e[f];return d};
ccs.DataReaderHelper.decodeTextureFromJson=function(a){var c=new ccs.TextureData;c.name=a[ccs.CONST_A_NAME]||"";c.width=a[ccs.CONST_A_WIDTH]||0;c.height=a[ccs.CONST_A_HEIGHT]||0;c.pivotX=a[ccs.CONST_A_PIVOT_X]||0;c.pivotY=a[ccs.CONST_A_PIVOT_Y]||0;a=a[ccs.CONST_CONTOUR_DATA]||[];for(var d=0;d<a.length;d++){var e=this.decodeContourFromJson(a[d]);c.contourDataList.push(e)}return c};
ccs.DataReaderHelper.decodeContourFromJson=function(a){var c=new ccs.ContourData;a=a[ccs.CONST_VERTEX_POINT]||[];for(var d=0;d<a.length;d++){var e=a[d],f=cc.p(0,0);f.x=e[ccs.CONST_A_X]||0;f.y=e[ccs.CONST_A_Y]||0;c.vertexList.push(f)}return c};
ccs.DataReaderHelper.decodeNodeFromJson=function(a,c,d){a.x=c[ccs.CONST_A_X]||0;a.y=c[ccs.CONST_A_Y]||0;a.x*=d.contentScale;a.y*=d.contentScale;a.zOrder=c[ccs.CONST_A_Z]||0;a.skewX=c[ccs.CONST_A_SKEW_X]||0;a.skewY=c[ccs.CONST_A_SKEW_Y]||0;void 0!==c[ccs.CONST_A_SCALE_X]&&(a.scaleX=c[ccs.CONST_A_SCALE_X]);void 0!==c[ccs.CONST_A_SCALE_Y]&&(a.scaleY=c[ccs.CONST_A_SCALE_Y]);if(c=c[ccs.CONST_COLOR_INFO]||null)d.cocoStudioVersion<ccs.VERSION_COLOR_READING&&(c=c[0]),a.a=c[ccs.CONST_A_ALPHA],a.r=c[ccs.CONST_A_RED],
a.g=c[ccs.CONST_A_GREEN],a.b=c[ccs.CONST_A_BLUE],a.isUseColorInfo=!0,delete c};ccs.DataReaderHelper.removeConfigFile=function(a){cc.ArrayRemoveObject(this._configFileList,a)};ccs.SpriteFrameCacheHelper=ccs.Class.extend({_textureAtlasDic:null,_imagePaths:[],ctor:function(){this._textureAtlasDic={};this._imagePaths=[]},addSpriteFrameFromFile:function(a,c){cc.SpriteFrameCache.getInstance().addSpriteFrames(a,c)},getTexureAtlasWithTexture:function(a){return null}});ccs.SpriteFrameCacheHelper.getInstance=function(){this._instance||(this._instance=new ccs.SpriteFrameCacheHelper);return this._instance};ccs.SpriteFrameCacheHelper.purge=function(){this._instance=null};ccs.TransformHelp=ccs.TransformHelp||ccs.Class.extend({});ccs.TransformHelp.helpMatrix1=cc.AffineTransformMake(1,0,0,1,0,0);ccs.TransformHelp.helpMatrix2=cc.AffineTransformMake(1,0,0,1,0,0);ccs.TransformHelp.helpPoint1=cc.p(0,0);ccs.TransformHelp.helpPoint2=cc.p(0,0);
ccs.TransformHelp.transformFromParent=function(a,c){this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(c,this.helpMatrix2);this.helpMatrix2=cc.AffineTransformInvert(this.helpMatrix2);this.helpMatrix1=cc.AffineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)};
ccs.TransformHelp.nodeToMatrix=function(a,c){if(a.skewX==-a.skewY){var d=Math.sin(a.skewX),e=Math.cos(a.skewX);c.a=a.scaleX*e;c.b=a.scaleX*-d;c.c=a.scaleY*d;c.d=a.scaleY*e}else c.a=a.scaleX*Math.cos(a.skewY),c.b=a.scaleX*Math.sin(a.skewY),c.c=a.scaleY*Math.sin(a.skewX),c.d=a.scaleY*Math.cos(a.skewY);c.tx=a.x;c.ty=a.y};
ccs.TransformHelp.matrixToNode=function(a,c){this.helpPoint1.x=0;this.helpPoint1.y=1;this.helpPoint1=cc.PointApplyAffineTransform(this.helpPoint1,a);this.helpPoint1.x-=a.tx;this.helpPoint1.y-=a.ty;this.helpPoint2.x=1;this.helpPoint2.y=0;this.helpPoint2=cc.PointApplyAffineTransform(this.helpPoint2,a);this.helpPoint2.x-=a.tx;this.helpPoint2.y-=a.ty;c.skewX=-(Math.atan2(this.helpPoint1.y,this.helpPoint1.x)-1.5707964);c.skewY=Math.atan2(this.helpPoint2.y,this.helpPoint2.x);c.scaleX=Math.sqrt(a.a*a.a+
a.b*a.b);c.scaleY=Math.sqrt(a.c*a.c+a.d*a.d);c.x=a.tx;c.y=a.ty};ccs.TransformHelp.nodeConcat=function(a,c){a.x+=c.x;a.y+=c.y;a.skewX+=c.skewX;a.skewY+=c.skewY;a.scaleX+=c.scaleX;a.scaleY+=c.scaleY};ccs.TransformHelp.nodeSub=function(a,c){a.x-=c.x;a.y-=c.y;a.skewX-=c.skewX;a.skewY-=c.skewY;a.scaleX-=c.scaleX;a.scaleY-=c.scaleY};ccs.TweenType={customEasing:-1,linear:0,sineEaseIn:1,sineEaseOut:2,sineEaseInOut:3,quadEaseIn:4,quadEaseOut:5,quadEaseInOut:6,cubicEaseIn:7,cubicEaseOut:8,cubicEaseInOut:9,quartEaseIn:10,quartEaseOut:11,quartEaseInOut:12,quintEaseIn:13,quintEaseOut:14,quintEaseInOut:15,expoEaseIn:16,expoEaseOut:17,expoEaseInOut:18,circEaseIn:19,eircEaseOut:20,circEaseInOut:21,elasticEaseIn:22,elasticEaseOut:23,elasticEaseInOut:24,backEaseIn:25,backEaseOut:26,backEaseInOut:27,bounceEaseIn:28,bounceEaseOut:29,bounceEaseInOut:30,
tweenEasingMax:1E4};ccs.TweenFunction=ccs.TweenFunction||ccs.Class.extend({});ccs.M_PI_X_2=2*Math.PI;ccs.M_PI_2=Math.PI/2;ccs.M_PI=Math.PI;
ccs.TweenFunction.tweenTo=function(a,c,d){var e=0;switch(c){case ccs.TweenType.customEasing:e=this.customEase(a,d);break;case ccs.TweenType.linear:e=this.linear(a);break;case ccs.TweenType.sineEaseIn:e=this.sineEaseIn(a);break;case ccs.TweenType.sineEaseOut:e=this.sineEaseOut(a);break;case ccs.TweenType.sineEaseInOut:e=this.sineEaseInOut(a);break;case ccs.TweenType.quadEaseIn:e=this.quadEaseIn(a);break;case ccs.TweenType.quadEaseOut:e=this.quadEaseOut(a);break;case ccs.TweenType.quadEaseInOut:e=this.quadEaseInOut(a);
break;case ccs.TweenType.cubicEaseIn:e=this.cubicEaseIn(a);break;case ccs.TweenType.cubicEaseOut:e=this.cubicEaseOut(a);break;case ccs.TweenType.cubicEaseInOut:e=this.cubicEaseInOut(a);break;case ccs.TweenType.quartEaseIn:e=this.quartEaseIn(a);break;case ccs.TweenType.quartEaseOut:e=this.quartEaseOut(a);break;case ccs.TweenType.quartEaseInOut:e=this.quartEaseInOut(a);break;case ccs.TweenType.quintEaseIn:e=this.quintEaseIn(a);break;case ccs.TweenType.quintEaseOut:e=this.quintEaseOut(a);break;case ccs.TweenType.quintEaseInOut:e=
this.quintEaseInOut(a);break;case ccs.TweenType.expoEaseIn:e=this.expoEaseIn(a);break;case ccs.TweenType.expoEaseOut:e=this.expoEaseOut(a);break;case ccs.TweenType.expoEaseInOut:e=this.expoEaseInOut(a);break;case ccs.TweenType.circEaseIn:e=this.circEaseIn(a);break;case ccs.TweenType.eircEaseOut:e=this.circEaseOut(a);break;case ccs.TweenType.circEaseInOut:e=this.circEaseInOut(a);break;case ccs.TweenType.elasticEaseIn:e=this.elasticEaseIn(a,d);break;case ccs.TweenType.elasticEaseOut:e=this.elasticEaseOut(a,
d);break;case ccs.TweenType.elasticEaseInOut:e=this.elasticEaseInOut(a,d);break;case ccs.TweenType.backEaseIn:e=this.backEaseIn(a);break;case ccs.TweenType.backEaseOut:e=this.backEaseOut(a);break;case ccs.TweenType.backEaseInOut:e=this.backEaseInOut(a);break;case ccs.TweenType.bounceEaseIn:e=this.bounceEaseIn(a);break;case ccs.TweenType.bounceEaseOut:e=this.bounceEaseOut(a);break;case ccs.TweenType.bounceEaseInOut:e=this.bounceEaseInOut(a);break;default:e=this.sineEaseInOut(a)}return e};
ccs.TweenFunction.linear=function(a){return a};ccs.TweenFunction.sineEaseIn=function(a){return-1*Math.cos(a*ccs.M_PI_2)+1};ccs.TweenFunction.sineEaseOut=function(a){return Math.sin(a*ccs.M_PI_2)};ccs.TweenFunction.sineEaseInOut=function(a){return-0.5*(Math.cos(ccs.M_PI*a)-1)};ccs.TweenFunction.quadEaseIn=function(a){return a*a};ccs.TweenFunction.quadEaseOut=function(a){return-1*a*(a-2)};ccs.TweenFunction.quadEaseInOut=function(a){a*=2;if(1>a)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,c){var d=0.3;0<c.length&&(d=c[0]);var e=0;0==a||1==a?e=a:(e=d/4,a-=1,e=-Math.pow(2,10*a)*Math.sin((a-e)*ccs.M_PI_X_2/d));return e};ccs.TweenFunction.elasticEaseOut=function(a,c){var d=0.3;0<c.length&&(d=c[0]);var e=0;0==a||1==a?e=a:(e=d/4,e=Math.pow(2,-10*a)*Math.sin((a-e)*ccs.M_PI_X_2/d)+1);return e};
ccs.TweenFunction.elasticEaseInOut=function(a,c){var d=0.3;0<c.length&&(d=c[0]);var e=0;0==a||1==a?e=a:(d||(d=0.3*1.5),e=d/4,a=2*a-1,e=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-e)*ccs.M_PI_X_2/d):Math.pow(2,-10*a)*Math.sin((a-e)*ccs.M_PI_X_2/d)*0.5+1);return e};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 c=0;return c=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,c){if(0<c.length){var d=1-a;return c[1]*d*d*d+3*c[3]*a*d*d+3*c[5]*a*a*d+c[7]*a*a*a}return a};var ENABLE_PHYSICS_DETECT=!1;ccs.fmodf=function(a,c){for(;a>c;)a-=c;return a};var CC_SAFE_RELEASE=function(a){a&&a.release&&a.release()};ccs.isSpriteContainPoint=function(a,c,d){var e=cc.p(0,0);d&&(e=a.convertToNodeSpace(c));a=a.getContentSize();a=cc.rect(0,0,a.width,a.height);return cc.rectContainsPoint(a,e)};ccs.SPRITE_CONTAIN_POINT=ccs.isSpriteContainPoint;ccs.SPRITE_CONTAIN_POINT_WITH_RETURN=ccs.isSpriteContainPoint;
ccs.extBezierTo=function(a,c,d,e,f){var g=cc.p(0,0);e&&!f&&(g.x=Math.pow(1-a,2)*c.x+2*a*(1-a)*d.x+Math.pow(a,2)*e.x,g.y=Math.pow(1-a,2)*c.y+2*a*(1-a)*d.y+Math.pow(a,2)*e.y);f&&(g.x=c.x*Math.pow(1-a,3)+3*a*d.x*Math.pow(1-a,2)+3*e.x*Math.pow(a,2)*(1-a)+f.x*Math.pow(a,3),g.y=c.y*Math.pow(1-a,3)+3*a*d.y*Math.pow(1-a,2)+3*e.y*Math.pow(a,2)*(1-a)+f.y*Math.pow(a,3));return g};ccs.extCircleTo=function(a,c,d,e,f){var g=cc.p(0,0);g.x=c.x+d*Math.cos(e+f*a);g.y=c.y+d*Math.sin(e+f*a);return g};ccs.RelativeData=function(){this.plistFiles=[];this.armatures=[];this.animations=[];this.textures=[]};
ccs.ArmatureDataManager=ccs.Class.extend({_animationDatas:null,_armarureDatas:null,_textureDatas:null,_autoLoadSpriteFile:null,_relativeDatas:null,ctor:function(){this._animationDatas={};this._armarureDatas={};this._textureDatas={};this._autoLoadSpriteFile=!1;this._relativeDatas={}},init:function(){},removeArmatureFileInfo:function(a){for(var c=this.getRelativeData(a),d=0;d<c.armatures.length;d++){var e=c.armatures[d];this.removeArmatureData(e)}for(d=0;d<c.animations.length;d++)e=c.animations[d],
this.removeAnimationData(e);for(d=0;d<c.textures.length;d++)e=c.textures[d],this.removeTextureData(e);for(d=0;d<c.plistFiles.length;d++)e=c.plistFiles[d],cc.SpriteFrameCache.getInstance().removeSpriteFramesFromFile(e);delete this._relativeDatas[a];ccs.DataReaderHelper.removeConfigFile(a)},addArmatureData:function(a,c,d){this._armarureDatas&&(this.getRelativeData(d).armatures.push(a),this._armarureDatas[a]=c)},removeArmatureData:function(a){this._armarureDatas[a]&&delete this._armarureDatas[a]},getArmatureData:function(a){var c=
null;this._armarureDatas&&(c=this._armarureDatas[a]);return c},getArmatureDatas:function(){return this._armarureDatas},addAnimationData:function(a,c,d){this._animationDatas&&(this.getRelativeData(d).animations.push(a),this._animationDatas[a]=c)},removeAnimationData:function(a){this._animationDatas[a]&&delete this._animationDatas[a]},getAnimationData:function(a){var c=null;this._animationDatas[a]&&(c=this._animationDatas[a]);return c},getAnimationDatas:function(){return this._animationDatas},addTextureData:function(a,
c,d){this._textureDatas&&(this.getRelativeData(d).textures.push(a),this._textureDatas[a]=c)},removeTextureData:function(a){this._textureDatas[a]&&delete this._textureDatas[a]},getTextureData:function(a){var c=null;this._textureDatas&&(c=this._textureDatas[a]);return c},getTextureDatas:function(){return this._textureDatas},addArmatureFileInfo:function(){var a,c,d,e=!1;1==arguments.length?(d=arguments[0],e=!0,this.addRelativeData(d)):3==arguments.length&&(a=arguments[0],c=arguments[1],d=arguments[2],
this.addRelativeData(d),this.addSpriteFrameFromFile(c,a,d));ccs.DataReaderHelper.addDataFromFile(d,e)},addArmatureFileInfoAsync:function(){var a,c,d,e,f,g=!1;3==arguments.length?(d=arguments[0],f=arguments[1],e=arguments[2],g=!0,this.addRelativeData(d)):5==arguments.length&&(a=arguments[0],c=arguments[1],d=arguments[2],f=arguments[3],e=arguments[4],this.addRelativeData(d),this.addSpriteFrameFromFile(c,a,d));ccs.DataReaderHelper.addDataFromFileAsync(d,e,f,g)},addSpriteFrameFromFile:function(a,c,d){this.getRelativeData(d).plistFiles.push(a);
ccs.SpriteFrameCacheHelper.getInstance().addSpriteFrameFromFile(a,c)},isAutoLoadSpriteFile:function(){return this._autoLoadSpriteFile},addRelativeData:function(a){this._relativeDatas[a]||(this._relativeDatas[a]=new ccs.RelativeData)},getRelativeData:function(a){return this._relativeDatas[a]},removeAll:function(){this._textureDatas=this._armarureDatas=this._animationDatas=null;ccs.DataReaderHelper.purge()}});ccs.ArmatureDataManager._instance=null;
ccs.ArmatureDataManager.getInstance=function(){this._instance||(this._instance=new ccs.ArmatureDataManager,this._instance.init());return this._instance};ccs.ArmatureDataManager.purge=function(){ccs.SpriteFrameCacheHelper.purge();ccs.DataReaderHelper.purge();this._instance=null};ccs.BlendType={normal:0,layer:1,darken:2,multiply:3,lighten:4,screen:5,overlay:6,highlight:7,add:8,subtract:9,difference:10,invert:11,alpha:12,erase:13};ccs.DisplayType={sprite:0,armature:1,particle:2,max:3};
ccs.BaseData=ccs.Class.extend({x:0,y:0,zOrder:0,skewX:0,skewY:0,scaleX:1,scaleY:1,tweenRotate:0,isUseColorInfo:!1,r:255,g:255,b:255,a:255,ctor:function(){this.skewY=this.skewX=this.zOrder=this.y=this.x=0;this.scaleY=this.scaleX=1;this.tweenRotate=0;this.isUseColorInfo=!1;this.color=cc.c4f(1,1,1,1)},copy:function(a){this.x=a.x;this.y=a.y;this.zOrder=a.zOrder;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.skewX=a.skewX;this.skewY=a.skewY;this.tweenRotate=a.tweenRotate;this.isUseColorInfo=a.isUseColorInfo;
this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a},setColor:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a},getColor:function(){return cc.c4b(this.r,this.g,this.b,this.a)},subtract:function(a,c,d){this.x=c.x-a.x;this.y=c.y-a.y;this.scaleX=c.scaleX-a.scaleX;this.scaleY=c.scaleY-a.scaleY;this.skewX=c.skewX-a.skewX;this.skewY=c.skewY-a.skewY;this.isUseColorInfo||a.isUseColorInfo||c.isUseColorInfo?(this.a=c.a-a.a,this.r=c.r-a.r,this.g=c.g-a.g,this.b=c.b-a.b,this.isUseColorInfo=!0):(this.a=this.r=this.g=
this.b=0,this.isUseColorInfo=!1);d&&(this.skewX>cc.PI&&(this.skewX-=ccs.M_PI_X_2),this.skewX<-cc.PI&&(this.skewX+=ccs.M_PI_X_2),this.skewY>cc.PI&&(this.skewY-=ccs.M_PI_X_2),this.skewY<-cc.PI&&(this.skewY+=ccs.M_PI_X_2));c.tweenRotate&&(this.skewX+=c.tweenRotate*ccs.M_PI_X_2,this.skewY-=c.tweenRotate*ccs.M_PI_X_2)}});
ccs.DisplayData=ccs.Class.extend({displayType:ccs.DisplayType.max,displayName:"",ctor:function(){this.displayType=ccs.DisplayType.max},changeDisplayToTexture:function(a){var c=a.lastIndexOf(".");-1!=c&&(a=a.substring(0,c));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.DisplayType.sprite},copy:function(a){ccs.DisplayData.prototype.copy.call(this,a);this.skinData=a.skinData}});ccs.ArmatureDisplayData=ccs.DisplayData.extend({displayName:"",ctor:function(){this.displayName="";this.displayType=ccs.DisplayType.armature}});ccs.ParticleDisplayData=ccs.DisplayData.extend({ctor:function(){this.displayType=ccs.DisplayType.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(){},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:0,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.tweenEasing=a.tweenEasing;this.displayIndex=a.displayIndex;this.movement=a.movement;this.event=a.event;this.sound=a.sound;this.soundEffect=a.soundEffect;this.blendFunc=a.blendFunc;this.isTween=a.isTween;this.easingParamNumber=a.easingParamNumber;this.easingParams=[];if(0!=this.easingParamNumber)for(var c=0;c<this.easingParamNumber;c++)this.easingParams[c]=a.easingParams[c]}});
ccs.MovementBoneData=ccs.Class.extend({delay:0,scale:1,duration:0,frameList:null,name:"",ctor:function(){this.delay=0;this.scale=1;this.duration=0;this.frameList=[];this.name=""},init:function(){this.frameList=[]},addFrameData:function(a){this.frameList.push(a)},getFrameData:function(a){return this.frameList[a]}});
ccs.MovementData=ccs.Class.extend({movBoneDataDic:null,duration:0,scale:1,durationTo:0,durationTween:ccs.TweenType.linear,loop:!0,tweenEasing:2,name:"",ctor:function(){this.name="";this.duration=0;this.scale=1;this.durationTween=this.durationTo=0;this.loop=!0;this.tweenEasing=ccs.TweenType.linear;this.movBoneDataDic={}},addMovementBoneData:function(a){this.movBoneDataDic[a.name]=a},getMovementBoneData:function(a){return this.movBoneDataDic[a]}});
ccs.AnimationData=ccs.Class.extend({moveDataDic:null,movementNames:null,name:"",ctor:function(){this.moveDataDic={};this.movementNames=[]},addMovement:function(a){this.moveDataDic[a.name]=a;this.movementNames.push(a.name)},getMovement:function(a){return this.moveDataDic[a]},getMovementCount:function(){return Object.keys(this.moveDataDic).length}});ccs.ContourVertex2=function(a,c){this.x=a||0;this.y=c||0};
ccs.ContourData=ccs.Class.extend({vertexList:null,ctor:function(){this.vertexList=[]},init:function(){this.vertexList=[];return!0},addVertex:function(a){a=ccs.ContourVertex2(a.x,a.y);this.vertexList.push(a)}});
ccs.TextureData=ccs.Class.extend({height:0,width:0,pivotX:0,pivotY:0,name:"",contourDataList:null,ctor:function(){this.width=this.height=0;this.pivotY=this.pivotX=0.5;this.name="";this.contourDataList=[]},init:function(){this.contourDataList=[]},addContourData:function(a){this.contourDataList.push(a)},getContourData:function(a){return this.contourDataList[a]}});ccs.DecotativeDisplay=ccs.Class.extend({_display:null,_colliderDetector:null,_displayData:null,ctor:function(){this._displayData=this._colliderDetector=this._display=null},init:function(){return!0},setDisplay:function(a){this._display=a},getDisplay:function(){return this._display},setColliderDetector:function(a){this._colliderDetector=a},getColliderDetector:function(){return this._colliderDetector},setDisplayData:function(a){this._displayData=a},getDisplayData:function(){return this._displayData},
release:function(){CC_SAFE_RELEASE(this._display);this._display=null;CC_SAFE_RELEASE(this._displayData);this._displayData=null;CC_SAFE_RELEASE(this._colliderDetector);this._colliderDetector=null}});ccs.DecotativeDisplay.create=function(){var a=new ccs.DecotativeDisplay;return a&&a.init()?a:null};ccs.DisplayFactory=ccs.DisplayFactory||ccs.Class.extend({});ccs.DisplayFactory.addDisplay=function(a,c,d){switch(d.displayType){case ccs.DisplayType.sprite:this.addSpriteDisplay(a,c,d);break;case ccs.DisplayType.particle:this.addParticleDisplay(a,c,d);break;case ccs.DisplayType.armature:this.addArmatureDisplay(a,c,d)}};
ccs.DisplayFactory.createDisplay=function(a,c){switch(c.getDisplayData().displayType){case ccs.DisplayType.sprite:this.createSpriteDisplay(a,c);break;case ccs.DisplayType.particle:this.createParticleDisplay(a,c);break;case ccs.DisplayType.armature:this.createArmatureDisplay(a,c)}};ccs.DisplayFactory._helpTransform={a:1,b:0,c:0,d:1,tx:0,ty:0};
ccs.DisplayFactory.updateDisplay=function(a,c,d){var e=a.getDisplayRenderNode();if(e){switch(a.getDisplayRenderNodeType()){case ccs.DisplayType.sprite:d&&e.updateArmatureTransform();break;case ccs.DisplayType.particle:this.updateParticleDisplay(a,e,c);break;case ccs.DisplayType.armature:this.updateArmatureDisplay(a,e,c);break;default:e.setAdditionalTransform(a.nodeToArmatureTransform())}if((ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&d&&(d=a.getDisplayManager().getCurrentDecorativeDisplay(),
c=d.getColliderDetector())){var e=d.getDisplay(),f=e.nodeToParentTransform();d=this._helpTransform;d.a=f.a;d.b=f.b;d.c=f.c;d.d=f.d;d.tx=f.tx;d.ty=f.ty;e=e.getAnchorPointInPoints();e=cc.PointApplyAffineTransform(e,d);d.tx=e.x;d.ty=e.y;a=cc.AffineTransformConcat(d,a.getArmature().nodeToParentTransform());c.updateTransform(a)}}};ccs.DisplayFactory.addSpriteDisplay=function(a,c,d){var e=new ccs.SpriteDisplayData;e.copy(d);c.setDisplayData(e);this.createSpriteDisplay(a,c)};
ccs.DisplayFactory.createSpriteDisplay=function(a,c){var d=null,e=c.getDisplayData(),d=e.displayName,f=d.lastIndexOf(".");-1!=f&&(d=d.substring(0,f));d=""==d?ccs.Skin.create():ccs.Skin.createWithSpriteFrameName(d+".png");c.setDisplay(d);d.setBone(a);this.initSpriteDisplay(a,c,e.displayName,d);(f=a.getArmature())&&(f.getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED?d.setSkinData(e.skinData):d.setSkinData(a.getBoneData()))};
ccs.DisplayFactory.initSpriteDisplay=function(a,c,d,e){var f=d.lastIndexOf(".");-1!=f&&(d=d.substring(0,f));(d=ccs.ArmatureDataManager.getInstance().getTextureData(d))&&e.setAnchorPoint(d.pivotX,d.pivotY);(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&d&&0<d.contourDataList.length&&(a=ccs.ColliderDetector.create(a),a.addContourDataList(d.contourDataList),c.setColliderDetector(a))};
ccs.DisplayFactory.addArmatureDisplay=function(a,c,d){var e=new ccs.ArmatureDisplayData;e.copy(d);c.setDisplayData(e);this.createArmatureDisplay(a,c)};ccs.DisplayFactory.createArmatureDisplay=function(a,c){var d=c.getDisplayData(),d=ccs.Armature.create(d.displayName,a);c.setDisplay(d)};ccs.DisplayFactory.updateArmatureDisplay=function(a,c,d){c&&(c.sortAllChildren(),c.update(d))};
ccs.DisplayFactory.addParticleDisplay=function(a,c,d){var e=new ccs.ParticleDisplayData;e.copy(d);c.setDisplayData(e);this.createParticleDisplay(a,c)};ccs.DisplayFactory.createParticleDisplay=function(a,c){var d=c.getDisplayData(),d=cc.ParticleSystem.create(d.displayName);a.getArmature()&&d.setParent(a.getArmature());c.setDisplay(d)};
ccs.DisplayFactory.updateParticleDisplay=function(a,c,d){var e=new ccs.BaseData;ccs.TransformHelp.matrixToNode(a.nodeToArmatureTransform(),e);c.setPosition(e.x,e.y);c.setScaleX(e.scaleX);c.setScaleY(e.scaleY);c.update(d)};ccs.DisplayManager=ccs.Class.extend({_decoDisplayList:null,_currentDecoDisplay:null,_displayRenderNode:null,_displayIndex:-1,_forceChangeDisplay:!1,_bone:null,_visible:!0,_displayType:null,ctor:function(){this._decoDisplayList=[];this._displayRenderNode=this._currentDecoDisplay=null;this._displayIndex=-1;this._forceChangeDisplay=!1;this._bone=null;this._visible=!0;this._displayType=ccs.DisplayType.max},init:function(a){this._bone=a;this.initDisplayList(a.getBoneData());return!0},addDisplay:function(a,
c){var d=null;0<=c&&c<this._decoDisplayList.length?d=this._decoDisplayList[c]:(d=ccs.DecotativeDisplay.create(),this._decoDisplayList.push(d));a instanceof ccs.DisplayData?ccs.DisplayFactory.addDisplay(this._bone,d,a):this._addDisplayOther(d,a);c==this._displayIndex&&(this._displayIndex=-1,this.changeDisplayWithIndex(c,!1))},_addDisplayOther:function(a,c){var d=null;if(c instanceof ccs.Skin){c.setBone(this._bone);d=new ccs.SpriteDisplayData;d.displayName=c.getDisplayName();ccs.DisplayFactory.initSpriteDisplay(this._bone,
a,c.getDisplayName(),c);var e=a.getDisplayData();if(e instanceof ccs.SpriteDisplayData)c.setSkinData(e.skinData);else{for(var e=!1,f=this._decoDisplayList.length-2;0<=f;f--){var g=this._decoDisplayList[f].getDisplayData();if(g){e=!0;c.setSkinData(g.skinData);d.skinData=g.skinData;break}}e||c.setSkinData(new ccs.BaseData);c.setSkinData(new ccs.BaseData)}}else c instanceof cc.ParticleSystem?(d=new ccs.ParticleDisplayData,d.displayName=c._plistFile):c instanceof ccs.Armature?(d=new ccs.ArmatureDisplayData,
d.displayName=c.getName(),c.setParentBone(this._bone)):d=new ccs.DisplayData;a.setDisplay(c);a.setDisplayData(d)},removeDisplay:function(a){cc.ArrayRemoveObjectAtIndex(this._decoDisplayList,a);a==this._displayIndex&&this.setCurrentDecorativeDisplay(null)},getDecorativeDisplayList:function(){return this._decoDisplayList},changeDisplayWithIndex:function(a,c){if(a>=this._decoDisplayList.length)cc.log("the index value is out of range");else if(this._forceChangeDisplay=c,0>a)this._displayIndex=a,this._displayRenderNode&&
(this._displayRenderNode.removeFromParent(!0),this.setCurrentDecorativeDisplay(null),this._displayRenderNode=null);else if(this._displayIndex!=a){this._displayIndex=a;var d=this._decoDisplayList[this._displayIndex];d&&this.setCurrentDecorativeDisplay(d)}},changeDisplayWithName:function(a,c){for(var d=0;d<this._decoDisplayList.length;d++)if(this._decoDisplayList[d].getDisplayData().displayName==a){this.changeDisplayWithIndex(d,c);break}},setCurrentDecorativeDisplay:function(a){var c=this._currentDecoDisplay;
(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&c&&c.getColliderDetector()&&c.getColliderDetector().setActive(!1);c=this._currentDecoDisplay=a;(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&c&&c.getColliderDetector()&&c.getColliderDetector().setActive(!0);a=null==c?null:c.getDisplay();this._displayRenderNode&&(this._displayRenderNode instanceof ccs.Armature&&this._bone.setChildArmature(null),this._displayRenderNode.removeFromParent(!0),
this._displayRenderNode=null);(this._displayRenderNode=a)?(a instanceof ccs.Armature?this._bone.setChildArmature(a):a instanceof cc.ParticleSystem&&a.resetSystem(),a.RGBAProtocol&&(a.setColor(this._bone.getDisplayedColor()),a.setOpacity(this._bone.getDisplayedOpacity())),a.retain(),this._displayType=this._currentDecoDisplay.getDisplayData().displayType):this._displayType=ccs.DisplayType.max},getDisplayRenderNode:function(){return this._displayRenderNode},getDisplayRenderNodeType:function(){return this._displayType},
getCurrentDisplayIndex:function(){return this._displayIndex},getCurrentDecorativeDisplay:function(){return this._currentDecoDisplay},getDecorativeDisplayByIndex:function(a){return this._decoDisplayList[a]},initDisplayList:function(a){this._decoDisplayList=[];if(a){a=a.displayDataList;for(var c=0;c<a.length;c++){var d=a[c],e=ccs.DecotativeDisplay.create();e.setDisplayData(d);ccs.DisplayFactory.createDisplay(this._bone,e);this._decoDisplayList.push(e)}}},containPoint:function(a,c){var d=cc.p(0,0);void 0===
c?(d.x=a.x,d.y=a.y):(d.x=a,d.y=c);if(!this._visible||0>this._displayIndex)return!1;var e=!1;switch(this._currentDecoDisplay.getDisplayData().displayType){case ccs.DisplayType.sprite:var e=cc.p(0,0),f=this._currentDecoDisplay.getDisplay(),f=f.getChildByTag(0),e=ccs.SPRITE_CONTAIN_POINT_WITH_RETURN(f,d,e)}return e},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=
[];this._displayRenderNode&&(this._displayRenderNode.removeFromParent(!0),this._displayRenderNode=null)}});ccs.DisplayManager.create=function(a){var c=new ccs.DisplayManager;return c&&c.init(a)?c:null};ccs.Skin=ccs.Sprite.extend({_skinData:null,_bone:null,_skinTransform:null,_displayName:"",_armature:null,ctor:function(){cc.Sprite.prototype.ctor.call(this);this._bone=this._skinData=null;this._displayName="";this._skinTransform=cc.AffineTransformIdentity();this._armature=null},initWithSpriteFrameName:function(a){var c=cc.Sprite.prototype.initWithSpriteFrameName.call(this,a);this._displayName=a;return c},initWithFile:function(a){var c=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.RADIANS_TO_DEGREES(a.skewX));this.setRotationY(cc.RADIANS_TO_DEGREES(-a.skewY));this.setPosition(a.x,a.y);a=this.nodeToParentTransform();var c=this._skinTransform;c.a=a.a;c.b=a.b;c.c=a.c;c.d=a.d;c.tx=a.tx;c.ty=a.ty;this.updateArmatureTransform()},getSkinData:function(){return this._skinData},setBone:function(a){this._bone=a},getBone:function(){return this._bone},updateArmatureTransform:function(){var a=
this._transform=cc.AffineTransformConcat(this._skinTransform,this._bone.nodeToArmatureTransform()),c=this._armature;c&&c.getBatchNode()&&(this._transform=cc.AffineTransformConcat(a,c.nodeToParentTransform()));cc.renderContextType===cc.CANVAS&&(a=this._transform,a.b*=-1,a.c*=-1,c=a.b,a.b=a.c,a.c=c)},getBoundingBox:function(){var a=cc.rect(0,0,this._contentSize.width,this._contentSize.height),c=this.nodeToParentTransform();return cc.RectApplyAffineTransform(a,c)},getDisplayName:function(){return this._displayName},
nodeToWorldTransform:function(){return cc.AffineTransformConcat(this._transform,this._bone.getArmature().nodeToWorldTransform())},nodeToWorldTransformAR:function(){var a=this._transform,c=this._anchorPointInPoints,c=cc.PointApplyAffineTransform(c,a);a.tx=c.x;a.ty=c.y;return cc.AffineTransformConcat(a,this._bone.getArmature().nodeToWorldTransform())}});ccs.Skin.prototype.nodeToParentTransform=cc.Node.prototype._nodeToParentTransformForWebGL;
ccs.Skin.create=function(a,c){var d=arguments.length,e=new ccs.Skin;if(0===d){if(e.init())return e}else if(e&&e.initWithFile(a,c))return e;return null};ccs.Skin.createWithSpriteFrameName=function(a){var c=new ccs.Skin;return c&&c.initWithSpriteFrameName(a)?c:null};CC_ANIMATION_TYPE_SINGLE_FRAME=-4;CC_ANIMATION_TYPE_NO_LOOP=-3;CC_ANIMATION_TYPE_TO_LOOP_FRONT=-2;CC_ANIMATION_TYPE_TO_LOOP_BACK=-1;CC_ANIMATION_TYPE_LOOP_FRONT=0;CC_ANIMATION_TYPE_LOOP_BACK=1;CC_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=CC_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,c){this._isPause=this._isComplete=!1;this._isPlaying=!0;this._currentFrame=0;this._nextFrameIndex=a;this._tweenEasing=c},update:function(a){if(this._isComplete||this._isPause||0>=this._rawDuration)return!1;var c=this._nextFrameIndex,
d=this._currentFrame;0>=c?(this._currentPercent=1,d=0):(d+=a/this._animationInternal*this._processScale,this._currentPercent=d/c,d=ccs.fmodf(d,c));this._currentFrame=d;this.updateHandler();return!0},updateHandler:function(){},gotoFrame:function(a){var c=this._loopType;c==CC_ANIMATION_TYPE_NO_LOOP?c=CC_ANIMATION_TYPE_MAX:c==CC_ANIMATION_TYPE_TO_LOOP_FRONT&&(c=CC_ANIMATION_TYPE_LOOP_FRONT);this._loopType=c;this._curFrameIndex=a;this._nextFrameIndex=this._durationTween},getCurrentFrameIndex:function(){return this._curFrameIndex=
(this._rawDuration-1)*this._currentPercent},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}});ccs.MovementEventType={start:0,complete:1,loopComplete:2};ccs.AnimationEvent=ccs.Class.extend({_arguments:null,_callFunc:null,_selectorTarget:null,ctor:function(a,c,d){this._data=d;this._callFunc=c;this._selectorTarget=a},call:function(){this._callFunc&&this._callFunc.apply(this._selectorTarget,this._arguments)},setArguments:function(a){this._arguments=a}});ccs.MovementEvent=function(){this.armature=null;this.movementID=this.movementType=""};
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:"",_prevFrameIndex:0,_toIndex:0,_tweenList:null,_frameEvent:null,_movementEvent:null,_speedScale:1,_ignoreFrameEvent:!1,_frameEventQueue:null,_movementEventQueue:null,_userObject:null,_movementList:null,_onMovementList:!1,_movementListLoop:!1,_movementIndex:0,ctor:function(){ccs.ProcessBase.prototype.ctor.call(this);this._movementData=this._animationData=null;this._movementID="";this._armature=
null;this._toIndex=this._prevFrameIndex=0;this._tweenList=[];this._movementEvent=this._frameEvent=null;this._speedScale=1;this._ignoreFrameEvent=!1;this._frameEventQueue=[];this._movementEventQueue=[];this._userObject=null;this._movementList=[];this._movementListLoop=this._onMovementList=!1;this._movementIndex=0},init:function(a){this._armature=a;this._tweenList=[];return!0},pause:function(){for(var a=0;a<this._tweenList.length;a++)this._tweenList[a].pause();ccs.ProcessBase.prototype.pause.call(this)},
resume:function(){for(var a=0;a<this._tweenList.length;a++)this._tweenList[a].resume();ccs.ProcessBase.prototype.resume.call(this)},stop:function(){for(var a=0;a<this._tweenList.length;a++)this._tweenList[a].stop();this._tweenList=[];ccs.ProcessBase.prototype.stop.call(this)},setSpeedScale:function(a){if(a!=this._speedScale){this._speedScale=a;this._processScale=this._movementData?this._speedScale*this._movementData.scale:this._speedScale;a=this._armature.getBoneDic();for(var c in a){var d=a[c];d.getTween().setProcessScale(this._processScale);
d.getChildArmature()&&d.getChildArmature().getAnimation().setProcessScale(this._processScale)}}},getSpeedScale:function(){return this._speedScale},getAnimationScale:function(){return this.getSpeedScale()},setAnimationScale:function(a){return this.setSpeedScale(a)},play:function(a,c,d,e,f){if(null==this._animationData)cc.log("this._animationData can not be null");else if(this._movementData=this._animationData.getMovement(a),null==this._movementData)cc.log("this._movementData can not be null");else{"undefined"==
typeof c&&(c=-1);"undefined"==typeof e&&(e=-1);var g=this._movementData;this._rawDuration=g.duration;this._movementID=a;this._processScale=this._speedScale*g.scale;c=-1==c?g.durationTo:c;d=g.durationTween;d=0==d?g.duration:d;f=g.tweenEasing;e=0>e?g.loop:Boolean(e);this._onMovementList=!1;ccs.ProcessBase.prototype.play.call(this,c,f);0==this._rawDuration?this._loopType=CC_ANIMATION_TYPE_SINGLE_FRAME:(this._loopType=e?CC_ANIMATION_TYPE_TO_LOOP_FRONT:CC_ANIMATION_TYPE_NO_LOOP,this._durationTween=d);
this._tweenList=[];var h=this._armature.getBoneDic(),k;for(k in h){var m=h[k];a=g.getMovementBoneData(m.getName());var n=m.getTween();a&&0<a.frameList.length?(this._tweenList.push(n),a.duration=g.duration,n.play(a,c,d,e,f),n.setProcessScale(this._processScale),m.getChildArmature()&&m.getChildArmature().getAnimation().setProcessScale(this._processScale)):m.getIgnoreMovementBoneData()||(m.getDisplayManager().changeDisplayWithIndex(-1,!1),n.stop())}this._armature.update(0)}},playWithNames:function(a,
c,d){this._movementList=[];this._movementListLoop=d;this._onMovementList=!0;for(d=this._movementIndex=0;d<a.length;d++)this._movementList.push({name:a[d],durationTo:c});this.updateMovementList()},updateMovementList:function(){if(this._onMovementList){if(this._movementListLoop){var a=this._movementList[this._movementIndex];this.play(a.name,a.durationTo,-1,0);this._movementIndex++;this._movementIndex>=this._movementList.length&&(this._movementIndex=0)}else this._movementIndex<this._movementList.length?
(a=this._movementList[this._movementIndex],this.play(a.name,a.durationTo,-1,0),this._movementIndex++):this._onMovementList=!1;this._onMovementList=!0}},gotoAndPlay:function(a){if(!this._movementData||0>a||a>=this._movementData.duration)cc.log("Please ensure you have played a movement, and the frameIndex is in the range.");else{var c=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 d=0;d<this._tweenList.length;d++)this._tweenList[d].gotoAndPlay(a);this._armature.update(0);this._ignoreFrameEvent=c}},gotoAndPause:function(a){this.gotoAndPlay(a);this.pause()},playWithIndex:function(a,c,d,e,f){"undefined"==typeof c&&(c=-1);"undefined"==typeof e&&(e=-1);d=this._animationData.movementNames;-1>a||a>=d.length||this.play(d[a],c,-1,e,0)},playByIndex:function(a,c,d,
e,f){cc.log("playByIndex is deprecated. Use playWithIndex instead.");this.playWithIndex(a,c,d,e,f)},playWithIndexes:function(a,c,d){this._movementList=[];this._movementListLoop=d;this._onMovementList=!0;this._movementIndex=0;d=this._animationData.movementNames;for(var e=0;e<a.length;e++)this._movementList.push({name:d[a[e]],durationTo:c});this.updateMovementList()},getMovementCount:function(){return this._animationData.getMovementCount()},update:function(a){if(ccs.ProcessBase.prototype.update.call(this,
a))for(var c=0;c<this._tweenList.length;c++)this._tweenList[c].update(a);for(a=this._frameEventQueue;0<a.length;)c=a.shift(),this._ignoreFrameEvent=!0,this.callFrameEvent([c.bone,c.frameEventName,c.originFrameIndex,c.currentFrameIndex]),this._ignoreFrameEvent=!1;for(a=this._movementEventQueue;0<a.length;)c=a.shift(),this.callMovementEvent([c.armature,c.movementType,c.movementID])},updateHandler:function(){var a=this._currentPercent;if(1<=a){switch(this._loopType){case CC_ANIMATION_TYPE_NO_LOOP:if(this._loopType=
CC_ANIMATION_TYPE_MAX,this._currentFrame=(a-1)*this._nextFrameIndex,a=this._currentFrame/this._durationTween,1>a){this._nextFrameIndex=this._durationTween;this.movementEvent(this._armature,ccs.MovementEventType.start,this._movementID);break}case CC_ANIMATION_TYPE_MAX:case CC_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 CC_ANIMATION_TYPE_TO_LOOP_FRONT:this._loopType=
CC_ANIMATION_TYPE_LOOP_FRONT;a=ccs.fmodf(a,1);this._currentFrame=0==this._nextFrameIndex?0:ccs.fmodf(this._currentFrame,this._nextFrameIndex);this._nextFrameIndex=0<this._durationTween?this._durationTween:1;this.movementEvent(this,ccs.MovementEventType.start,this._movementID);break;default:this._currentFrame=ccs.fmodf(this._currentFrame,this._nextFrameIndex),this._toIndex=0,this.movementEvent(this._armature,ccs.MovementEventType.loopComplete,this._movementID)}this._currentPercent=a}},getCurrentMovementID:function(){return this._isComplete?
"":this._movementID},setMovementEventCallFunc:function(a,c){this._movementEvent=new ccs.AnimationEvent(c,a)},callMovementEvent:function(a){this._movementEvent&&(this._movementEvent.setArguments(a),this._movementEvent.call())},setFrameEventCallFunc:function(a,c){this._frameEvent=new ccs.AnimationEvent(c,a)},callFrameEvent:function(a){this._frameEvent&&(this._frameEvent.setArguments(a),this._frameEvent.call())},movementEvent:function(a,c,d){if(this._movementEvent){var e=new ccs.MovementEvent;e.armature=
a;e.movementType=c;e.movementID=d;this._movementEventQueue.push(e)}},frameEvent:function(a,c,d,e){if(this._frameEvent){var f=new ccs.FrameEvent;f.bone=a;f.frameEventName=c;f.originFrameIndex=d;f.currentFrameIndex=e;this._frameEventQueue.push(f)}},setAnimationData:function(a){this._animationData=a},getAnimationData:function(){return this._animationData},setUserObject:function(a){this._userObject=a},getUserObject:function(){return this._userObject},isIgnoreFrameEvent:function(){return this._ignoreFrameEvent},
setIgnoreFrameEvent:function(a){this._ignoreFrameEvent=a}});ccs.ArmatureAnimation.create=function(a){var c=new ccs.ArmatureAnimation;return c&&c.init(a)?c:null};ccs.Tween=ccs.ProcessBase.extend({_tweenData:null,_to:null,_from:null,_between:null,_movementBoneData:null,_bone:null,_frameTweenEasing:0,_betweenDuration:0,_totalDuration:0,_toIndex:0,_fromIndex:0,_animation:null,_passLastFrame:!1,ctor:function(){ccs.ProcessBase.prototype.ctor.call(this);this._movementBoneData=this._bone=this._between=this._from=this._to=this._tweenData=null;this._frameTweenEasing=ccs.TweenType.linear;this._fromIndex=this._toIndex=0;this._animation=null;this._passLastFrame=!1},init:function(a){this._from=
new ccs.FrameData;this._between=new ccs.FrameData;this._bone=a;this._tweenData=this._bone.getTweenData();this._tweenData.displayIndex=-1;if(a=a.getArmature())this._animation=a.getAnimation();return!0},play:function(a,c,d,e,f){ccs.ProcessBase.prototype.play.call(this,c,f);this._loopType=e?CC_ANIMATION_TYPE_TO_LOOP_FRONT:CC_ANIMATION_TYPE_NO_LOOP;this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0;f=a!=this._movementBoneData;this._movementBoneData=a;this._rawDuration=this._movementBoneData.duration;
a=this._movementBoneData.getFrameData(0);this._tweenData.displayIndex=a.displayIndex;this._bone.getArmature().getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED&&(ccs.TransformHelp.nodeSub(this._tweenData,this._bone.getBoneData()),this._tweenData.scaleX+=1,this._tweenData.scaleY+=1);0==this._rawDuration||1==this._movementBoneData.frameList.length?(this._loopType=CC_ANIMATION_TYPE_SINGLE_FRAME,0==c?this.setBetween(a,a):this.setBetween(this._tweenData,a),this._frameTweenEasing=ccs.TweenType.linear):
1<this._movementBoneData.frameList.length&&(this._durationTween=d*this._movementBoneData.scale,e&&0!=this._movementBoneData.delay?this.setBetween(this._tweenData,this.tweenNodeTo(this.updateFrameData(1-this._movementBoneData.delay),this._between)):f&&0!=c?this.setBetween(this._tweenData,a):this.setBetween(a,a));this.tweenNodeTo(0)},gotoAndPlay:function(a){ccs.ProcessBase.prototype.gotoFrame.call(this,a);this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0;this._isPlaying=!0;this._isComplete=
this._isPause=!1;this._currentPercent=this._curFrameIndex/(this._rawDuration-1);this._currentFrame=this._nextFrameIndex*this._currentPercent},gotoAndPause:function(a){this.gotoAndPlay(a);this.pause()},updateHandler:function(){var a=this._currentPercent,c=this._loopType;if(1<=a)switch(c){case CC_ANIMATION_TYPE_SINGLE_FRAME:a=1;this._isComplete=!0;this._isPlaying=!1;break;case CC_ANIMATION_TYPE_NO_LOOP:c=CC_ANIMATION_TYPE_MAX;a=0>=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 CC_ANIMATION_TYPE_TO_LOOP_FRONT:c=CC_ANIMATION_TYPE_LOOP_FRONT;this._nextFrameIndex=0<this._durationTween?this._durationTween:1;0!=this._movementBoneData.delay?(this._currentFrame=(1-this._movementBoneData.delay)*this._nextFrameIndex,a=this._currentFrame/this._nextFrameIndex):this._currentFrame=
a=0;this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0;break;case CC_ANIMATION_TYPE_MAX:a=1;this._isComplete=!0;this._isPlaying=!1;break;default:this._currentFrame=ccs.fmodf(this._currentFrame,this._nextFrameIndex),this._betweenDuration=this._totalDuration=0}1>a&&c<CC_ANIMATION_TYPE_TO_LOOP_BACK&&(a=Math.sin(a*cc.PI/2));this._currentPercent=a;this._loopType=c;c>CC_ANIMATION_TYPE_TO_LOOP_BACK&&(a=this.updateFrameData(a));this._frameTweenEasing!=ccs.TweenType.tweenEasingMax&&
this.tweenNodeTo(a)},setBetween:function(a,c,d){"undefined"==typeof d&&(d=!0);0>a.displayIndex&&0<=c.displayIndex?(this._from.copy(c),this._between.subtract(c,c,d)):0>c.displayIndex&&0<=a.displayIndex?(this._from.copy(a),this._between.subtract(c,c,d)):(this._from.copy(a),this._between.subtract(a,c,d));a.isTween||(this._tweenData.copy(a),this._tweenData.isTween=!0);this.arriveKeyFrame(a)},arriveKeyFrame:function(a){if(a){var c=this._bone,d=a.displayIndex,e=c.getDisplayManager();e.getForceChangeDisplay()||
(e.changeDisplayWithIndex(d,!1),(d=e.getDisplayRenderNode())&&d.setBlendFunc(a.blendFunc));this._tweenData.zOrder=a.zOrder;c.updateZOrder();(c=c.getChildArmature())&&""!=a.movement&&c.getAnimation().play(a.movement)}},tweenNodeTo:function(a,c){c||(c=this._tweenData);var d=this._from,e=this._between;d.isTween||(a=0);c.x=d.x+a*e.x;c.y=d.y+a*e.y;c.scaleX=d.scaleX+a*e.scaleX;c.scaleY=d.scaleY+a*e.scaleY;c.skewX=d.skewX+a*e.skewX;c.skewY=d.skewY+a*e.skewY;this._bone.setTransformDirty(!0);c&&e.isUseColorInfo&&
this.tweenColorTo(a,c);return c},tweenColorTo:function(a,c){var d=this._from,e=this._between;c.a=d.a+a*e.a;c.r=d.r+a*e.r;c.g=d.g+a*e.g;c.b=d.b+a*e.b;this._bone.updateColor()},updateFrameData:function(a){1<a&&0!=this._movementBoneData.delay&&(a=ccs.fmodf(a,1));var c=(this._rawDuration-1)*a,d,e,f=this._totalDuration,g=this._betweenDuration,h=this._toIndex;if(c<f||c>=f+g){var g=this._movementBoneData.frameList.length,k=this._movementBoneData.frameList;if(c<k[0].frameID)return d=e=k[0],this.setBetween(d,
e),a;if(c>=k[g-1].frameID){if(this._passLastFrame)return d=e=k[g-1],this.setBetween(d,e),a;this._passLastFrame=!0}else this._passLastFrame=!1;do if(this._fromIndex=h,d=k[this._fromIndex],f=d.frameID,h=this._fromIndex+1,h>=g&&(h=0),e=k[h],d.event&&!this._animation.isIgnoreFrameEvent()&&this._animation.frameEvent(this._bone,d.event,d.frameID,c),c==d.frameID||this._passLastFrame&&this._fromIndex==g-1)break;while(c<d.frameID||c>=e.frameID);g=e.frameID-d.frameID;this._frameTweenEasing=d.tweenEasing;this.setBetween(d,
e,!1);this._totalDuration=f;this._betweenDuration=g;this._toIndex=h}a=0==g?0:(c-f)/g;c=this._frameTweenEasing!=ccs.TweenType.linear?this._frameTweenEasing:this._tweenEasing;c==ccs.TweenType.tweenEasingMax||c==ccs.TweenType.linear||this._passLastFrame||(a=ccs.TweenFunction.tweenTo(a,c,this._from.easingParams));return a},setAnimation:function(a){this._animation=a},getAnimation:function(){return this._animation},release:function(){this._between=this._from=null}});
ccs.Tween.create=function(a){var c=new ccs.Tween;return c&&c.init(a)?c:null};ccs.PT_RATIO=32;ccs.ColliderFilter=ccs.Class.extend({_collisionType:0,_group:0,ctor:function(a,c){this._collisionType=a||0;this._group=c||0},updateShape:function(a){a.collision_type=this._collisionType;a.group=this._group}});
ccs.ColliderBody=ccs.Class.extend({_shape:null,_contourData:null,_filter:null,_calculatedVertexList:null,ctor:function(a){this._shape=null;this._contourData=a;this._filter=new ccs.ColliderFilter;ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX&&(this._calculatedVertexList=[])},getContourData:function(){return this._contourData},setContourData:function(a){this._contourData=a},getShape:function(){return this._shape},setShape:function(a){this._shape=a},getColliderFilter:function(){return this._filter},setColliderFilter:function(a){this._filter=
a},getCalculatedVertexList:function(){return this._calculatedVertexList}});
ccs.ColliderDetector=ccs.Class.extend({_colliderBodyList:null,_bone:null,_body:null,_active:!1,_filter:null,ctor:function(){this._colliderBodyList=[];this._body=this._bone=null;this._active=!1;this._filter=null},init:function(a){this._colliderBodyList=[];a&&(this._bone=a);this._filter=new ccs.ColliderFilter;return!0},addContourData:function(a){var c=new ccs.ColliderBody(a);this._colliderBodyList.push(c);if(ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX){c=c.getCalculatedVertexList();a=a.vertexList;for(var d=
0;d<a.length;d++){var e=new ccs.ContourVertex2(0,0);c.push(e)}}},addContourDataList:function(a){for(var c=0;c<a.length;c++)this.addContourData(a[c])},removeContourData:function(a){for(var c=this._colliderBodyList,d=0;d<c.length;d++)if(c[d].getContourData()==a){c.splice(d,1);break}},removeAll:function(){this._colliderBodyList=[]},setColliderFilter:function(a){this._filter=a;for(var c=0;c<this._colliderBodyList.length;c++){var d=this._colliderBodyList[c];d.setColliderFilter(a);ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT&&
d.getShape()&&d.getColliderFilter().updateShape(d.getShape())}},getColliderFilter:function(){return this._filter},setActive:function(a){if(this._active!=a){this._active=a;a=this._body;var c;if(a)if(c=null,this._active)for(var d=0;d<this._colliderBodyList.length;d++)c=this._colliderBodyList[d],c=c.getShape(),a.space.addShape(c);else for(d=0;d<this._colliderBodyList.length;d++)c=this._colliderBodyList[d],c=c.getShape(),a.space.removeShape(c)}},getActive:function(){return this._active},getColliderBodyList:function(){return this._colliderBodyList},
helpPoint:cc.p(0,0),updateTransform:function(a){if(this._active)for(var c=null,d=this._body,e=this.helpPoint,f=0;f<this._colliderBodyList.length;f++){var c=this._colliderBodyList[f],g=c.getContourData(),h=null;d&&(h=c.getShape());for(var g=g.vertexList,k=c.getCalculatedVertexList(),c=0;c<g.length;c++)if(e.x=g[c].x,e.y=g[c].y,e=cc.PointApplyAffineTransform(e,a),h&&(h.verts[2*c]=e.x,h.verts[2*c+1]=e.y),ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX){var m=cc.p(0,0);m.x=e.x;m.y=e.y;k[c]=m}if(h)for(c=0;c<
g.length;c++)k=cp.v.normalize(cp.v.perp(cp.v.sub(h.verts[(c+1)%h.verts.length],h.verts[c]))),h.axes[c].n=k,h.axes[c].d=cp.v.dot(k,h.verts[c])}},getBody:function(){return this._body},setBody:function(a){this._body=a;for(var c=0;c<this._colliderBodyList.length;c++){a=this._colliderBodyList[c];for(var d=[],e=a.getContourData().vertexList,c=0;c<e.length;c++){var f=e[c];d.push(f.x);d.push(f.y)}d=new cp.PolyShape(this._body,d,cp.vzero);d.sensor=!0;d.data=this._bone;this._active&&this._body.space.addShape(d);
a.setShape(d);a.getColliderFilter().updateShape(d)}}});ccs.ColliderDetector.create=function(a){var c=new ccs.ColliderDetector;return c&&c.init(a)?c:null};ccs.Armature=ccs.NodeRGBA.extend({_animation:null,_armatureData:null,_batchNode:null,_name:"",_textureAtlas:null,_parentBone:null,_boneDic:null,_topBoneList:null,_armatureIndexDic:null,_offsetPoint:null,_version:0,_armatureTransformDirty:!0,_body:null,_textureAtlasDic:null,_blendFunc:null,ctor:function(){cc.NodeRGBA.prototype.ctor.call(this);this._batchNode=this._armatureData=this._animation=null;this._name="";this._topBoneList=this._boneDic=this._parentBone=this._textureAtlas=null;this._armatureIndexDic=
{};this._offsetPoint=cc.p(0,0);this._version=0;this._armatureTransformDirty=!0;this._blendFunc=this._textureAtlasDic=this._body=null},init:function(a,c){cc.NodeRGBA.prototype.init.call(this);c&&(this._parentBone=c);this.removeAllChildren();this._animation=new ccs.ArmatureAnimation;this._animation.init(this);this._boneDic={};this._topBoneList=[];this._textureAtlasDic={};this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._name=a?a:"";var d=ccs.ArmatureDataManager.getInstance();if(""!=a){var e=
d.getAnimationData(a);if(!e)return cc.log("AnimationData of "+a+" not exist! "),!1;this._animation.setAnimationData(e);this._armatureData=d=d.getArmatureData(a);var d=d.getBoneDataDic(),f;for(f in d){var d=this.createBone(String(f)),g=e.getMovement(e.movementNames[0]);g&&(g=g.getMovementBoneData(d.getName()))&&!(0>=g.frameList.length)&&(g=g.getFrameData(0))&&(d.getTweenData().copy(g),d.changeDisplayWithIndex(g.displayIndex,!1))}this.update(0);this.updateOffsetPoint()}else this._name="new_armature",
this._armatureData=new ccs.ArmatureData,this._armatureData.name=this._name,e=new ccs.AnimationData,e.name=this._name,d.addArmatureData(this._name,this._armatureData),d.addAnimationData(this._name,e),this._animation.setAnimationData(e);cc.renderContextType===cc.WEBGL&&this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR));this.setCascadeOpacityEnabled(!0);this.setCascadeColorEnabled(!0);return!0},onEnter:function(){cc.NodeRGBA.prototype.onEnter.call(this);
this.scheduleUpdate()},onExit:function(){cc.NodeRGBA.prototype.onExit.call(this);this.unscheduleUpdate()},createBone:function(a){var c=this.getBone(a);if(c)return c;var c=this._armatureData.getBoneData(a),d=c.parentName,e=null;""!=d?(this.createBone(d),e=ccs.Bone.create(a),this.addBone(e,d)):(e=ccs.Bone.create(a),this.addBone(e,""));e.setBoneData(c);e.getDisplayManager().changeDisplayWithIndex(-1,!1);return e},addBone:function(a,c){if(a)if(this._boneDic[a.getName()])cc.log("bone already added. It can't be added again");
else{if(c){var d=this._boneDic[c];d?d.addChildBone(a):this._topBoneList.push(a)}else this._topBoneList.push(a);a.setArmature(this);this._boneDic[a.getName()]=a;this.addChild(a)}else cc.log("Argument must be non-nil")},removeBone:function(a,c){a?(a.setArmature(null),a.removeFromParent(c),cc.ArrayRemoveObject(this._topBoneList,a),delete this._boneDic[a.getName()],this.removeChild(a,!0)):cc.log("bone must be added to the bone dictionary!")},getBone:function(a){return this._boneDic[a]},changeBoneParent:function(a,
c){if(a){var d=a.getParentBone();d&&(cc.ArrayRemoveObject(d.getChildrenBone(),a),a.setParentBone(null));c&&((d=this._boneDic[c])?(d.addChildBone(a),cc.ArrayRemoveObject(this._topBoneList,a)):this._topBoneList.push(a))}else cc.log("bone must be added to the bone dictionary!")},getBoneDic:function(){return this._boneDic},updateOffsetPoint:function(){var a=this.boundingBox();this.setContentSize(a._size);var c=this._offsetPoint;c.x=-a.x;c.y=-a.y;0!=a.width&&0!=a.height&&this.setAnchorPoint(c.x/a.width,
c.y/a.height)},update:function(a){this._animation.update(a);for(var c=this._topBoneList,d=0;d<c.length;d++)c[d].update(a);this._armatureTransformDirty=!1},nodeToParentTransform:null,_nodeToParentTransformForWebGL:function(){if(this._transformDirty){this._armatureTransformDirty=!0;var a=this._position.x,c=this._position.y,d=this._anchorPointInPoints.x,e=-d,f=this._anchorPointInPoints.y,g=-f,h=this._scaleX,k=this._scaleY;this._ignoreAnchorPointForPosition&&(a+=d,c+=f);var m=1,n=0,p=1,q=0;if(0!==this._rotationX||
0!==this._rotationY)m=Math.cos(-this._rotationRadiansX),n=Math.sin(-this._rotationRadiansX),p=Math.cos(-this._rotationRadiansY),q=Math.sin(-this._rotationRadiansY);var a=a+(p*this._offsetPoint.x*this._scaleX+-n*this._offsetPoint.y*this._scaleY),c=c+(q*this._offsetPoint.x*this._scaleX+m*this._offsetPoint.y*this._scaleY),s=this._skewX||this._skewY;s||0===d&&0===f||(a+=p*e*h+-n*g*k,c+=q*e*h+m*g*k);a={a:p*h,b:q*h,c:-n*k,d:m*k,tx:a,ty:c};s&&(a=cc.AffineTransformConcat({a:1,b:Math.tan(cc.DEGREES_TO_RADIANS(this._skewY)),
c:Math.tan(cc.DEGREES_TO_RADIANS(this._skewX)),d:1,tx:0,ty:0},a),0!==d||0!==f)&&(a=cc.AffineTransformTranslate(a,e,g));this._additionalTransformDirty&&(a=cc.AffineTransformConcat(a,this._additionalTransform),this._additionalTransformDirty=!1);this._transform=a;this._transformDirty=!1}return this._transform},_nodeToParentTransformForCanvas:function(){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0});if(this._transformDirty){this._armatureTransformDirty=!0;var a=this._transform;a.tx=this._position.x;
a.ty=this._position.y;var c=1,d=0;this._rotationX&&(c=Math.cos(-this._rotationRadiansX),d=Math.sin(-this._rotationRadiansX));a.a=a.d=c;a.c=-d;a.b=d;var e=this._scaleX,f=this._scaleY,g=this._anchorPointInPoints.x,h=this._anchorPointInPoints.y,k=1E-6>e&&-1E-6<e?1E-6:e,m=1E-6>f&&-1E-6<f?1E-6:f;a.tx+=c*this._offsetPoint.x*e+-d*this._offsetPoint.y*f;a.ty+=d*this._offsetPoint.x*e+c*this._offsetPoint.y*f;if(this._skewX||this._skewY){var n=Math.tan(-this._skewX*Math.PI/180),p=Math.tan(-this._skewY*Math.PI/
180),q=h*n*k,s=g*p*m;a.a=c+-d*p;a.c=c*n+-d;a.b=d+c*p;a.d=d*n+c;a.tx+=c*q+-d*s;a.ty+=d*q+c*s}if(1!==e||1!==f)a.a*=k,a.b*=k,a.c*=m,a.d*=m;a.tx+=c*-g*k+-d*-h*m;a.ty+=d*-g*k+c*-h*m;this._ignoreAnchorPointForPosition&&(a.tx+=g,a.ty+=h);this._additionalTransformDirty&&(this._transform=cc.AffineTransformConcat(this._transform,this._additionalTransform),this._additionalTransformDirty=!1);a.tx|=0;a.ty|=0;this._transformDirty=!1}return this._transform},draw:function(){},setBlendFunc:function(a){this._blendFunc=
a},getBlendFunc:function(){return this._blendFunc},boundingBox:function(){for(var a=0,c=0,d=0,e=0,f=!0,e=cc.rect(0,0,0,0),g=0;g<this._children.length;g++)if(a=this._children[g],a instanceof ccs.Bone){var h=a.getDisplayManager().getBoundingBox();f?(a=cc.rectGetMinX(h),c=cc.rectGetMinY(h),d=cc.rectGetMaxX(h),e=cc.rectGetMaxY(h),f=!1):(a=cc.rectGetMinX(h)<cc.rectGetMinX(e)?cc.rectGetMinX(h):cc.rectGetMinX(e),c=cc.rectGetMinY(h)<cc.rectGetMinY(e)?cc.rectGetMinY(h):cc.rectGetMinY(e),d=cc.rectGetMaxX(h)>
cc.rectGetMaxX(e)?cc.rectGetMaxX(h):cc.rectGetMaxX(e),e=cc.rectGetMaxY(h)>cc.rectGetMaxY(e)?cc.rectGetMaxY(h):cc.rectGetMaxY(e));e=cc.rect(a,c,d-a,e-c)}return cc.RectApplyAffineTransform(e,this.nodeToParentTransform())},getBoneAtPoint:function(a,c){for(var d=this._children.length-1;0<=d;d--){var e=this._children[d];if(e instanceof ccs.Bone&&e.getDisplayManager().containPoint(a,c))return e}return null},getTexureAtlasWithTexture:function(){return null},setParentBone:function(a){this._parentBone=a;for(var c in this._boneDic)this._boneDic[c].setArmature(this)},
setColliderFilter:function(a){for(var c in this._boneDic)this._boneDic[c].setColliderFilter(a)},drawContour:function(){cc.drawingUtil.setDrawColor4B(255,255,255,255);cc.drawingUtil.setLineWidth(1);for(var a in this._boneDic)for(var c=this._boneDic[a].getColliderBodyList(),d=0;d<c.length;d++){var e=c[d].getCalculatedVertexList();cc.drawingUtil.drawPoly(e,e.length,!0)}},getParentBone:function(){return this._parentBone},getAnimation:function(){return this._animation},setAnimation:function(a){this._animation=
a},getArmatureData:function(){return this._armatureData},setArmatureData:function(a){this._armatureData=a},getName:function(){return this._name},setName:function(a){this._name=a},getBatchNode:function(){return this._batchNode},setBatchNode:function(a){this._batchNode=a},getVersion:function(){return this._version},setVersion:function(a){this._version=a},getArmatureTransformDirty:function(){return this._armatureTransformDirty},getBody:function(){return this._body},setBody:function(a){if(this._body!=
a){this._body=a;this._body.data=this;var c,d;for(a=0;a<this._children.length;a++)if(c=this._children[a],c instanceof ccs.Bone){c=c.getDisplayManager().getDecorativeDisplayList();for(var e=0;e<c.length;e++)d=c[e],(d=d.getColliderDetector())&&d.setBody(this._body)}}},getShapeList:function(){return this._body?this._body.shapeList:[]}});ccs.Armature.prototype.nodeToParentTransform=cc.Browser.supportWebGL?ccs.Armature.prototype._nodeToParentTransformForWebGL:ccs.Armature.prototype._nodeToParentTransformForCanvas;
ccs.Armature.create=function(a,c){var d=new ccs.Armature;return d&&d.init(a,c)?d:null};ccs.Bone=ccs.NodeRGBA.extend({_boneData:null,_armature:null,_childArmature:null,_displayManager:null,_ignoreMovementBoneData:!1,_tween:null,_tweenData:null,_name:"",_childrenBone:null,_parentBone:null,_boneTransformDirty:!1,_worldTransform:null,_blendFunc:0,_blendDirty:!1,_worldInfo:null,_armatureParentBone:null,_dataVersion:0,ctor:function(){cc.NodeRGBA.prototype.ctor.call(this);this._displayManager=this._childArmature=this._armature=this._boneData=null;this._ignoreMovementBoneData=!1;this._tweenData=
this._tween=null;this._name="";this._childrenBone=[];this._parentBone=null;this._boneTransformDirty=!0;this._worldTransform=cc.AffineTransformMake(1,0,0,1,0,0);this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this._blendDirty=!1},release:function(){CC_SAFE_RELEASE(this._tweenData);for(var a=0;a<this._childrenBone.length;a++)CC_SAFE_RELEASE(this._childrenBone[a]);this._childrenBone=[];CC_SAFE_RELEASE(this._tween);CC_SAFE_RELEASE(this._displayManager);CC_SAFE_RELEASE(this._boneData);CC_SAFE_RELEASE(this._childArmature)},
init:function(a){cc.NodeRGBA.prototype.init.call(this);a&&(this._name=a);this._tweenData=new ccs.FrameData;this._tween=new ccs.Tween;this._tween.init(this);this._displayManager=new ccs.DisplayManager;this._displayManager.init(this);this._worldInfo=new ccs.BaseData;this._boneData=new ccs.BaseData;return!0},setBoneData:function(a){a?(this._boneData=a,this._name=this._boneData.name,this._zOrder=this._boneData.zOrder,this._displayManager.initDisplayList(a)):cc.log("boneData must not be null")},getBoneData:function(){return this._boneData},
setArmature:function(a){(this._armature=a)?(this._tween.setAnimation(this._armature.getAnimation()),this._dataVersion=this._armature.getArmatureData().dataVersion,this._armatureParentBone=this._armature.getParentBone()):this._armatureParentBone=null},getArmature:function(){return this._armature},update:function(a){var c=this._parentBone,d=this._armature,e=this._tweenData,f=this._worldTransform,g=this._worldInfo,h=this._armatureParentBone;c&&(this._boneTransformDirty=this._boneTransformDirty||c.isTransformDirty());
h&&!this._boneTransformDirty&&(this._boneTransformDirty=h.isTransformDirty());this._boneTransformDirty&&(this._dataVersion>=ccs.CONST_VERSION_COMBINED&&(c=this._boneData,e.x+=c.x,e.y+=c.y,e.skewX+=c.skewX,e.skewY+=c.skewY,e.scaleX+=c.scaleX,e.scaleY+=c.scaleY,e.scaleX-=1,e.scaleY-=1),g.x=e.x+this._position.x,g.y=e.y+this._position.y,g.scaleX=e.scaleX*this._scaleX,g.scaleY=e.scaleY*this._scaleY,g.skewX=e.skewX+this._skewX+this._rotationX,g.skewY=e.skewY+this._skewY-this._rotationY,this._parentBone?
this.applyParentTransform(this._parentBone):h&&this.applyParentTransform(h),ccs.TransformHelp.nodeToMatrix(g,f),h&&(this._worldTransform=cc.AffineTransformConcat(f,d.nodeToParentTransform())));ccs.DisplayFactory.updateDisplay(this,a,this._boneTransformDirty||d.getArmatureTransformDirty());d=this._childrenBone;for(e=0;e<d.length;e++)d[e].update(a);this._boneTransformDirty=!1},applyParentTransform:function(a){var c=this._worldInfo,d=a._worldTransform;a=a._worldInfo;var e=c.x,f=c.y;c.x=e*d.a+f*d.c+a.x;
c.y=e*d.b+f*d.d+a.y;c.scaleX*=a.scaleX;c.scaleY*=a.scaleY;c.skewX+=a.skewX;c.skewY+=a.skewY},visit:function(a){var c=this.getDisplayManager().getDisplayRenderNode();c&&c.visit(a)},updateDisplayedColor:function(a){this._realColor=cc.c3b(255,255,255);cc.NodeRGBA.prototype.updateDisplayedColor.call(this,a);this.updateColor()},updateDisplayedOpacity:function(a){this._realOpacity=255;cc.NodeRGBA.prototype.updateDisplayedOpacity.call(this,a);this.updateColor()},setColor:function(a){cc.NodeRGBA.prototype.setColor.call(this,
a);this.updateColor()},setOpacity:function(a){cc.NodeRGBA.prototype.setOpacity.call(this,a);this.updateColor()},updateColor:function(){var a=this._displayManager.getDisplayRenderNode();if(a&&a.RGBAProtocol){var c=this._displayedColor,d=this._tweenData,e=this._displayedOpacity*d.a/255,c=cc.c3b(c.r*d.r/255,c.g*d.g/255,c.b*d.b/255);a.setOpacity(e);a.setColor(c)}},updateZOrder:function(){this._armature.getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED?this.setZOrder(this._tweenData.zOrder+this._boneData.zOrder):
this.setZOrder(this._tweenData.zOrder)},addChildBone:function(a){a?a._parentBone?cc.log("child already added. It can't be added again"):0>cc.ArrayGetIndexOfObject(this._childrenBone,a)&&(this._childrenBone.push(a),a.setParentBone(this)):cc.log("Argument must be non-nil")},removeChildBone:function(a,c){for(var d=0;d<this._childrenBone.length;d++)if(this._childrenBone[d]==a){if(c)for(var e=a._childrenBone,f=0;f<e.length;f++)a.removeChildBone(e[f],c);a.setParentBone(null);a.getDisplayManager().setCurrentDecorativeDisplay(null);
cc.ArrayRemoveObject(this._childrenBone,a)}},removeFromParent:function(a){this._parentBone&&this._parentBone.removeChildBone(this,a)},setParentBone:function(a){this._parentBone=a},getParentBone:function(){return this._parentBone},setChildArmature:function(a){this._childArmature!=a&&(null==a&&this._childArmature&&this._childArmature.setParentBone(null),this._childArmature=a)},getChildArmature:function(){return this._childArmature},getChildrenBone:function(){return this._childrenBone},getTween:function(){return this._tween},
setZOrder:function(a){this._zOrder!=a&&cc.Node.prototype.setZOrder.call(this,a)},setTransformDirty:function(a){this._boneTransformDirty=a},isTransformDirty:function(){return this._boneTransformDirty},nodeToArmatureTransform:function(){return this._worldTransform},nodeToWorldTransform:function(){return cc.AffineTransformConcat(this._worldTransform,this._armature.nodeToWorldTransform())},getDisplayRenderNode:function(){return this._displayManager.getDisplayRenderNode()},getDisplayRenderNodeType:function(){return this._displayManager.getDisplayRenderNodeType()},
addDisplay:function(a,c){return this._displayManager.addDisplay(a,c||0)},removeDisplay:function(a){this._displayManager.removeDisplay(a)},addSkin:function(a,c){return this._displayManager.addSkin(a,c||0)},changeDisplayByIndex:function(a,c){cc.log("changeDisplayByIndex is deprecated. Use changeDisplayWithIndex instead.");this.changeDisplayWithIndex(a,c)},changeDisplayWithIndex:function(a,c){this._displayManager.changeDisplayWithIndex(a,c)},changeDisplayWithName:function(a,c){this._displayManager.changeDisplayWithName(a,
c)},getColliderBodyList:function(){var a=this._displayManager.getCurrentDecorativeDisplay();return a&&(a=a.getColliderDetector())?a.getColliderBodyList():[]},setColliderFilter:function(a){for(var c=this._displayManager.getDecorativeDisplayList(),d=0;d<c.length;d++){var e=c[d].getColliderDetector();e&&e.setColliderFilter(a)}},getColliderFilter:function(){var a=this._displayManager.getCurrentDecorativeDisplay();return a&&(a=a.getColliderDetector())?a.getColliderFilter():null},setDisplayManager:function(a){this._displayManager=
a},getDisplayManager:function(){return this._displayManager},setIgnoreMovementBoneData:function(a){this._ignoreMovementBoneData=a},getIgnoreMovementBoneData:function(){return this._ignoreMovementBoneData},getTweenData:function(){return this._tweenData},setName:function(a){this._name=a},getName:function(){return this._name},setBlendFunc:function(a){if(this._blendFunc.src!=a.src||this._blendFunc.dst!=a.dst)this._blendFunc=a,this._blendDirty=!0},getBlendFunc:function(){return this._blendFunc},setBlendDirty:function(a){this._blendDirty=
a},isBlendDirty:function(){return this._blendDirty}});ccs.Bone.create=function(a){var c=new ccs.Bone;return c&&c.init(a)?c:null};ccs.FrameType={move:0,scale:1,rotate:2,tint:3,fade:4,max:5};
ccs.ActionFrame=ccs.Class.extend({_frameType:0,_easingType:0,_frameIndex:0,_time:0,ctor:function(){this._time=this._frameIndex=this._easingType=this._frameType=0},setFrameIndex:function(a){this._frameIndex=a},getFrameIndex:function(){return this._frameIndex},setFrameTime:function(a){this._time=a},getFrameTime:function(){return this._time},setFrameType:function(a){this._frameType=a},getFrameType:function(){return this._frameType},setEasingType:function(a){this._easingType=a},getEasingType:function(){return this._easingType},
getAction:function(a){return null}});ccs.ActionMoveFrame=ccs.ActionFrame.extend({_position:null,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._position=cc.p(0,0);this._frameType=ccs.FrameType.move},setPosition:function(a){this._position=a},getPosition:function(){return this._position},getAction:function(a){return cc.MoveTo.create(a,this._position)}});
ccs.ActionScaleFrame=ccs.ActionFrame.extend({_scaleX:1,_scaleY:1,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._scaleY=this._scaleX=1;this._frameType=ccs.FrameType.scale},setScaleX:function(a){this._scaleX=a},getScaleX:function(){return this._scaleX},setScaleY:function(a){this._scaleY=a},getScaleY:function(){return this._scaleY},getAction:function(a){return cc.ScaleTo.create(a,this._scaleX,this._scaleY)}});
ccs.ActionRotationFrame=ccs.ActionFrame.extend({_rotation:0,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._rotation=0;this._frameType=ccs.FrameType.rotate},setRotation:function(a){this._rotation=a},getRotation:function(){return this._rotation},getAction:function(a){return cc.RotateTo.create(a,this._rotation)}});
ccs.ActionFadeFrame=ccs.ActionFrame.extend({_opacity:255,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._opacity=255;this._frameType=ccs.FrameType.fade},setOpacity:function(a){this._opacity=a},getOpacity:function(){return this._opacity},getAction:function(a){return cc.FadeTo.create(a,this._opacity)}});
ccs.ActionTintFrame=ccs.ActionFrame.extend({_color:255,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._color=255;this._frameType=ccs.FrameType.tint},setColor:function(a){this._color=a},getColor:function(){return this._color},getAction:function(a){return cc.TintTo.create(a,this._color.r,this._color.g,this._color.b)}});ccs.ActionManager=ccs.Class.extend({_actionDic:null,ctor:function(){this._actionDic={}},initWithDictionary:function(a,c,d){var e=a.lastIndexOf("/");a=a.substr(e+1,a.length);c=c.actionlist;for(var e=[],f=0;f<c.length;f++){var g=new ccs.ActionObject;g.initWithDictionary(c[f],d);e.push(g)}this._actionDic[a]=e},getActionByName:function(a,c){var d=this._actionDic[a];if(!d)return null;for(var e=0;e<d.length;e++){var f=d[e];if(c==f.getName())return f}return null},playActionByName:function(a,c,d){(a=this.getActionByName(a,
c))&&a.play(d)},releaseActions:function(){this._actionDic={}}});ccs.ActionManager._instance=null;ccs.ActionManager.getInstance=function(){this._instance||(this._instance=new ccs.ActionManager);return this._instance};ccs.ActionManager.purge=function(){this._instance=null};ccs.ActionNode=ccs.Class.extend({_currentFrameIndex:0,_destFrameIndex:0,_unitTime:0,_actionTag:0,_bject:null,_actionSpawn:null,_action:null,_frameArray:null,_frameArrayNum:0,ctor:function(){this._destFrameIndex=this._currentFrameIndex=0;this._unitTime=0.1;this._actionTag=0;this._action=this._actionSpawn=this._bject=null;this._frameArray=[];this._frameArrayNum=ccs.FrameType.max;for(var a=0;a<this._frameArrayNum;a++)this._frameArray.push([])},initWithDictionary:function(a,c){this.setActionTag(a.ActionTag);
for(var d=a.actionframelist,e=0;e<d.length;e++){var f=d[e],g=f.frameid;if(void 0!==f.positionx){var h=f.positionx,k=f.positiony,m=new ccs.ActionMoveFrame;m.setFrameIndex(g);m.setPosition(cc.p(h,k));h=this._frameArray[ccs.FrameType.move];h.push(m)}void 0!==f.scalex&&(h=f.scalex,k=f.scaley,m=new ccs.ActionScaleFrame,m.setFrameIndex(g),m.setScaleX(h),m.setScaleY(k),h=this._frameArray[ccs.FrameType.scale],h.push(m));void 0!==f.rotation&&(h=f.rotation,m=new ccs.ActionRotationFrame,m.setFrameIndex(g),m.setRotation(h),
h=this._frameArray[ccs.FrameType.rotate],h.push(m));void 0!==f.opacity&&(h=f.opacity,m=new ccs.ActionFadeFrame,m.setFrameIndex(g),m.setOpacity(h),h=this._frameArray[ccs.FrameType.fade],h.push(m));void 0!==f.colorr&&(h=f.colorr,k=f.colorg,f=f.colorb,m=new ccs.ActionTintFrame,m.setFrameIndex(g),m.setColor(cc.c3b(h,k,f)),h=this._frameArray[ccs.FrameType.tint],h.push(m))}this.initActionNodeFromRoot(c)},initActionNodeFromRoot:function(a){a instanceof ccs.Widget&&(a=ccs.UIHelper.seekActionWidgetByActionTag(a,
this.getActionTag()))&&this.setObject(a)},setUnitTime:function(a){this._unitTime=a;this.refreshActionProperty()},getUnitTime:function(){return this._unitTime},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},setObject:function(a){this._object=a},getObject:function(){return this._object},getActionNode:function(){return this._object instanceof cc.Node||this._object instanceof ccs.Widget?this._object:null},insertFrame:function(a,c){if(null!=c){var d=c.getFrameType();
this._frameArray[d].splice(a,0,c)}},addFrame:function(a){if(a){var c=a.getFrameType();this._frameArray[c].push(a)}},deleteFrame:function(a){if(null!=a){var c=a.getFrameType();cc.ArrayRemoveObject(this._frameArray[c],a)}},clearAllFrame:function(){for(var a=0;a<this._frameArrayNum;a++)this._frameArray[a]=[]},refreshActionProperty:function(){if(null==this._object)return null;for(var a=[],c=0;c<this._frameArrayNum;c++){var d=this._frameArray[c];if(!(0>=d.length)){for(var e=[],f=0;f<d.length;f++){var g=
d[f];if(0!=f){var h=d[f-1],h=(g.getFrameIndex()-h.getFrameIndex())*this.getUnitTime(),g=g.getAction(h);e.push(g)}}d=cc.Sequence.create(e);null!=d&&a.push(d)}}this._action=null;return this._actionSpawn=cc.Spawn.create(a)},playAction:function(a){null!=this._object&&null!=this._actionSpawn&&(this._action=a?cc.Sequence.create(this._actionSpawn,a):cc.Sequence.create(this._actionSpawn),this.runAction())},runAction:function(){var a=this.getActionNode();null!=a&&null!=this._action&&a.runAction(this._action)},
stopAction:function(){var a=this.getActionNode();null!=a&&null!=this._action&&(this._action.isDone()||a.stopAction(this._action))},getFirstFrameIndex:function(){for(var a=99999,c=!1,d=0;d<this._frameArrayNum;d++){var e=this._frameArray[d];0>=e.length||(c=!0,e=e[0].getFrameIndex(),a=a>e?e:a)}c||(a=0);return a},getLastFrameIndex:function(){for(var a=-1,c=!1,d=0;d<this._frameArrayNum;d++){var e=this._frameArray[d];0>=e.length||(c=!0,e=e[e.length-1].getFrameIndex(),a=a<e?e:a)}c||(a=0);return a},updateActionToTimeLine:function(a){for(var c=
!1,d=this.getUnitTime(),e=0;e<this._frameArrayNum;e++){var f=this._frameArray[e];if(null!=f)for(var g=0;g<f.length;g++){var h=f[g];if(h.getFrameIndex()*d==a){this.easingToFrame(1,1,h);c=!0;break}else if(h.getFrameIndex()*d>a){0==g?(this.easingToFrame(1,1,h),c=!1):(c=f[g-1],f=(h.getFrameIndex()-c.getFrameIndex())*d,g=a-c.getFrameIndex()*d,this.easingToFrame(f,1,c),this.easingToFrame(f,g/f,h),c=!0);break}}}return c},easingToFrame:function(a,c,d){a=d.getAction(a);d=this.getActionNode();null!=a&&null!=
d&&(a.startWithTarget(d),a.update(c))},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,ctor:function(){this._actionNodeList=[];this._name="";this._playing=this._pause=this._loop=!1;this._unitTime=0.1;this._currentTime=0;this._scheduler=new cc.Scheduler;cc.Director.getInstance().getScheduler().scheduleUpdateForTarget(this._scheduler,0,!1)},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 c=0;c<a;c++)this._actionNodeList[c].setUnitTime(this._unitTime)},getUnitTime:function(){return this._unitTime},getCurrentTime:function(){return this._currentTime},setCurrentTime:function(a){this._currentTime=a},isPlaying:function(){return this._playing},initWithDictionary:function(a,c){this.setName(a.name);this.setLoop(a.loop);this.setUnitTime(a.unittime);for(var d=a.actionnodelist,e=0;e<d.length;e++){var f=new ccs.ActionNode;
f.initWithDictionary(d[e],c);f.setUnitTime(this.getUnitTime());this._actionNodeList.push(f)}},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 c=this._actionNodeList.length,d=0;d<c;d++)this._actionNodeList[d].playAction(a);this._loop&&this._scheduler.scheduleCallbackForTarget(this,this.simulationActionUpdate,
0,cc.REPEAT_FOREVER,0,!1)},pause:function(){this._pause=!0},stop:function(){for(var a=0;a<this._actionNodeList.length;a++)this._actionNodeList[a].stopAction();this._scheduler.unscheduleCallbackForTarget(this,this.simulationActionUpdate);this._pause=!1},updateToFrameByTime:function(a){this._currentTime=a;for(var c=0;c<this._actionNodeList.length;c++)this._actionNodeList[c].updateActionToTimeLine(a)},simulationActionUpdate:function(a){if(this._loop){a=!0;for(var c=this._actionNodeList,d=0;d<c.length;d++)if(!1==
c[d].isActionDoneOnce()){a=!1;break}a&&this.play()}}});ccs.ComAttribute=ccs.Component.extend({_jsonDict:null,_filePath:"",ctor:function(){cc.Component.prototype.ctor.call(this);this._jsonDict={};this._filePath="";this._name="CCComAttribute"},init:function(){this._jsonDict={};return!0},setInt:function(a,c){a?this._jsonDict[a]=c:cc.log("Argument must be non-nil")},setDouble:function(a,c){a?this._jsonDict[a]=c:cc.log("Argument must be non-nil")},setFloat:function(a,c){a?this._jsonDict[a]=c:cc.log("Argument must be non-nil")},setBool:function(a,c){a?this._jsonDict[a]=
c:cc.log("Argument must be non-nil")},setCString:function(a,c){a?this._jsonDict[a]=c:cc.log("Argument must be non-nil")},setObject:function(a,c){a?this._jsonDict[a]=c:cc.log("Argument must be non-nil")},getInt:function(a){return parseInt(this._jsonDict[a]||0)},getDouble:function(a){return parseFloat(this._jsonDict[a]||0)},getFloat:function(a){return parseFloat(this._jsonDict[a]||0)},getBool:function(a){return Boolean(this._jsonDict[a]||!1)},getCString:function(a){return this._jsonDict[a]||""},getObject:function(a){return this._jsonDict[a]},
parse:function(a){if(a=cc.FileUtils.getInstance().getTextFileData(a))this._jsonDict=JSON.parse(a)}});ccs.ComAttribute.create=function(){var a=new ccs.ComAttribute;return a&&a.init()?a:null};ccs.ComAudio=ccs.Component.extend({_filePath:"",_loop:!1,ctor:function(){cc.Component.prototype.ctor.call(this);this._name="Audio"},init:function(){return!0},onEnter:function(){},onExit:function(){this.stopBackgroundMusic(!0);this.stopAllEffects()},end:function(){cc.AudioEngine.end()},preloadBackgroundMusic:function(a){cc.AudioEngine.getInstance().preloadMusic(a)},playBackgroundMusic:function(a,c){a?cc.AudioEngine.getInstance().playMusic(a,c):cc.AudioEngine.getInstance().playMusic(this._filePath,
this._loop)},stopBackgroundMusic:function(a){cc.AudioEngine.getInstance().stopMusic(a)},pauseBackgroundMusic:function(){cc.AudioEngine.getInstance().pauseMusic()},resumeBackgroundMusic:function(){cc.AudioEngine.getInstance().resumeMusic()},rewindBackgroundMusic:function(){cc.AudioEngine.getInstance().rewindMusic()},willPlayBackgroundMusic:function(){return cc.AudioEngine.getInstance().willPlayMusic()},isBackgroundMusicPlaying:function(){return cc.AudioEngine.getInstance().isMusicPlaying()},getBackgroundMusicVolume:function(){return cc.AudioEngine.getInstance().getMusicVolume()},
setBackgroundMusicVolume:function(a){cc.AudioEngine.getInstance().setMusicVolume(a)},getEffectsVolume:function(){return cc.AudioEngine.getInstance().getEffectsVolume()},setEffectsVolume:function(a){cc.AudioEngine.getInstance().setEffectsVolume(a)},playEffect:function(a,c){return a?cc.AudioEngine.getInstance().playEffect(a,c):cc.AudioEngine.getInstance().playEffect(this._filePath,this._loop)},pauseEffect:function(a){cc.AudioEngine.getInstance().pauseEffect(a)},pauseAllEffects:function(){cc.AudioEngine.getInstance().pauseAllEffects()},
resumeEffect:function(a){cc.AudioEngine.getInstance().resumeEffect(a)},resumeAllEffects:function(){cc.AudioEngine.getInstance().resumeAllEffects()},stopEffect:function(a){cc.AudioEngine.getInstance().stopEffect(a)},stopAllEffects:function(){cc.AudioEngine.getInstance().stopAllEffects()},preloadEffect:function(a){cc.AudioEngine.getInstance().preloadEffect(a);this.setFile(a);this.setLoop(!1)},unloadEffect:function(a){cc.AudioEngine.getInstance().unloadEffect(a)},setFile:function(a){this._filePath=a},
setLoop:function(a){this._loop=a},getFile:function(){return this._filePath},isLoop:function(){return this._loop}});ccs.ComAudio.create=function(){var a=new ccs.ComAudio;return a&&a.init()?a:null};ccs.ComController=ccs.Component.extend({ctor:function(){cc.Component.prototype.ctor.call(this);this._name="ComController"},init:function(){return!0},onEnter:function(){},onExit:function(){var a=cc.Director.getInstance();this._isTouchEnabled&&cc.unregisterTouchDelegate(this);this._isAccelerometerEnabled&&cc.Accelerometer&&a.getAccelerometer().setDelegate(null);this._isKeyboardEnabled&&cc.KeyboardDispatcher&&a.getKeyboardDispatcher().removeDelegate(this);this._isMouseEnabled&&cc.MouseDispatcher&&a.getMouseDispatcher().removeMouseDelegate(this)},
update:function(a){},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=b},registerWithTouchDispatcher:function(){this._touchMode===cc.TOUCH_ALL_AT_ONCE?cc.registerStandardDelegate(this,this._touchPriority):cc.registerTargetedDelegate(this._touchPriority,!0,this)},isMouseEnabled:function(){return this._isMouseEnabled},setMouseEnabled:function(a){if(!cc.MouseDispatcher)throw"cc.MouseDispatcher is undefined, maybe it has been removed from js loading list.";this._isMouseEnabled!=
a&&(this._isMouseEnabled=a,this._running&&(a?cc.Director.getInstance().getMouseDispatcher().addMouseDelegate(this,this._mousePriority):cc.Director.getInstance().getMouseDispatcher().removeMouseDelegate(this)))},setMousePriority:function(a){if(!cc.MouseDispatcher)throw"cc.MouseDispatcher is undefined, maybe it has been removed from js loading list.";this._mousePriority!==a&&(this._mousePriority=a,this._isMouseEnabled&&(this.setMouseEnabled(!1),this.setMouseEnabled(!0)))},getMousePriority:function(){return this._mousePriority},
isTouchEnabled:function(){return this._isTouchEnabled},setTouchEnabled:function(a){this._isTouchEnabled!==a&&((this._isTouchEnabled=a)?this.registerWithTouchDispatcher():cc.unregisterTouchDelegate(this))},getTouchPriority:function(){return this._touchPriority},setTouchPriority:function(a){this._touchPriority!==a&&(this._touchPriority=a,this._isTouchEnabled&&(this.setTouchEnabled(!1),this.setTouchEnabled(!0)))},getTouchMode:function(){return this._touchMode},setTouchMode:function(a){this._touchMode!==
a&&(this._touchMode=a,this._isTouchEnabled&&(this.setTouchEnabled(!1),this.setTouchEnabled(!0)))},isAccelerometerEnabled:function(){return this._isAccelerometerEnabled},setAccelerometerEnabled:function(a){if(!cc.Accelerometer)throw"cc.Accelerometer is undefined, maybe it has been removed from js loading list.";if(a!==this._isAccelerometerEnabled&&(this._isAccelerometerEnabled=a,this._running)){var c=cc.Director.getInstance();a?c.getAccelerometer().setDelegate(this):c.getAccelerometer().setDelegate(null)}},
setAccelerometerInterval:function(a){this._isAccelerometerEnabled&&cc.Accelerometer&&cc.Director.getInstance().getAccelerometer().setAccelerometerInterval(a)},onAccelerometer:function(a){cc.log("ccs.ComController.onAccelerometer(): should override me.")},isKeyboardEnabled:function(){return this._isKeyboardEnabled},setKeyboardEnabled:function(a){if(!cc.KeyboardDispatcher)throw"cc.KeyboardDispatcher is undefined, maybe it has been removed from js loading list.";if(a!==this._isKeyboardEnabled&&(this._isKeyboardEnabled=
a,this._running)){var c=cc.Director.getInstance();a?c.getKeyboardDispatcher().addDelegate(this):c.getKeyboardDispatcher().removeDelegate(this)}},onTouchBegan:function(a,c){return!0},onTouchMoved:function(a,c){},onTouchEnded:function(a,c){},onTouchCancelled:function(a,c){},onTouchesBegan:function(a,c){},onTouchesMoved:function(a,c){},onTouchesEnded:function(a,c){},onTouchesCancelled:function(a,c){},onMouseDown:function(a){return!1},onMouseDragged:function(a){return!1},onMouseMoved:function(a){return!1},
onMouseUp:function(a){return!1},onRightMouseDown:function(a){return!1},onRightMouseDragged:function(a){return!1},onRightMouseUp:function(a){return!1},onOtherMouseDown:function(a){return!1},onOtherMouseDragged:function(a){return!1},onOtherMouseUp:function(a){return!1},onScrollWheel:function(a){return!1},onMouseEntered:function(a){return!1},onMouseExited:function(a){return!1},onKeyDown:function(a){},onKeyUp:function(a){}});
ccs.ComController.create=function(){var a=new ccs.ComController;return a&&a.init()?a:null};ccs.ComRender=ccs.Component.extend({_render:null,ctor:function(a,c){cc.Component.prototype.ctor.call(this);this._render=a;this._name=c},onEnter:function(){this._owner&&this._owner.addChild(this._render)},onExit:function(){this._owner&&(this._owner.removeChild(this._render,!0),this._render=null)},getNode:function(){return this._render},setNode:function(a){this._render=a}});ccs.ComRender.create=function(a,c){var d=new ccs.ComRender(a,c);return d&&d.init()?d:null};ccs.BrightStyle={none:-1,normal:0,highlight:1};ccs.WidgetType={widget:0,container:1};ccs.TextureResType={local:0,plist:1};ccs.TouchEventType={began:0,moved:1,ended:2,canceled:3};ccs.SizeType={absolute:0,percent:1};ccs.PositionType={absolute:0,percent:1};
ccs.Widget=ccs.Node.extend({_enabled:!0,_bright:!0,_touchEnabled:!1,_touchPassedEnabled:!1,_focus:!1,_brightStyle:null,_updateEnabled:!1,_touchStartPos:null,_touchMovePos:null,_touchEndPos:null,_touchEventListener:null,_touchEventSelector:null,_name:"default",_widgetType:null,_actionTag:0,_size:null,_customSize:null,_layoutParameterDictionary:null,_ignoreSize:!1,_widgetChildren:null,_affectByClipping:!1,_sizeType:null,_sizePercent:null,_positionType:null,_positionPercent:null,_reorderWidgetChildDirty:!1,
_hitted:!1,_nodes:null,_color:null,_opacity:0,_flippedX:!1,_flippedY:!1,ctor:function(){cc.Node.prototype.ctor.call(this);this._bright=this._enabled=!0;this._focus=this._touchPassedEnabled=this._touchEnabled=!1;this._brightStyle=ccs.BrightStyle.none;this._updateEnabled=!1;this._touchStartPos=cc.PointZero();this._touchMovePos=cc.PointZero();this._touchEndPos=cc.PointZero();this._touchEventSelector=this._touchEventListener=null;this._name="default";this._widgetType=ccs.WidgetType.widget;this._actionTag=
0;this._size=cc.SizeZero();this._customSize=cc.SizeZero();this._layoutParameterDictionary={};this._ignoreSize=!1;this._widgetChildren=[];this._affectByClipping=!1;this._sizeType=ccs.SizeType.absolute;this._sizePercent=cc.PointZero();this._positionType=ccs.PositionType.absolute;this._positionPercent=cc.PointZero();this._hitted=this._reorderWidgetChildDirty=!1;this._nodes=[];this._color=cc.c3b(255,255,255);this._opacity=255;this._flippedY=this._flippedX=!1},init:function(){cc.Node.prototype.init.call(this)&&
(this._layoutParameterDictionary={},this._widgetChildren=[],this.initRenderer(),this.setBright(!0),this.ignoreContentAdaptWithSize(!0),this.setAnchorPoint(cc.p(0.5,0.5)));return!0},onEnter:function(){this.updateSizeAndPosition();cc.Node.prototype.onEnter.call(this)},visit:function(a){this._enabled&&cc.Node.prototype.visit.call(this,a)},sortAllChildren:function(){this._reorderWidgetChildDirty=this._reorderChildDirty;cc.Node.prototype.sortAllChildren.call(this);if(this._reorderWidgetChildDirty){var a=
this._widgetChildren,c,d,e=a.length,f;for(c=0;c<e;c++){var g=a[c];d=c-1;for(f=a[d];0<=d&&(g._zOrder<f._zOrder||g._zOrder==f._zOrder&&g._orderOfArrival<f._orderOfArrival);)a[d+1]=f,d-=1,f=a[d];a[d+1]=g}this._reorderWidgetChildDirty=!1}},addChild:function(a,c,d){a instanceof ccs.Widget?(cc.Node.prototype.addChild.call(this,a,c,d),this._widgetChildren.push(a)):a instanceof cc.Node&&cc.log("Please use addNode to add a CCNode.")},getChildByTag:function(a){var c=this._widgetChildren;if(null!=c)for(var d=
0;d<c.length;d++){var e=c[d];if(e&&e._tag==a)return e}return null},getChildren:function(){return this._widgetChildren},getChildrenCount:function(){return this._widgetChildren.length},getWidgetParent:function(){var a=this.getParent();return a instanceof ccs.Widget?a:null},removeChild:function(a,c){a instanceof ccs.Widget?(cc.Node.prototype.removeChild.call(this,a,c),cc.ArrayRemoveObject(this._widgetChildren,a)):cc.log("child must a type of ccs.Widget")},removeChildByTag:function(a,c){var d=this.getChildByTag(a);
null==d?cc.log("cocos2d: removeChildByTag(tag \x3d "+a+"): child not found!"):this.removeChild(d,c)},removeAllChildren:function(a){for(var c=0;c<this._widgetChildren.length;c++)cc.Node.prototype.removeChild.call(this,this._widgetChildren[c],a);this._widgetChildren.length=0},setEnabled:function(a){this._enabled=a;for(var c=this._widgetChildren,d=c.length,e=0;e<d;e++)c[e].setEnabled(a)},getChildByName:function(a){for(var c=this._widgetChildren,d=c.length,e=0;e<d;e++){var f=c[e];if(f.getName()==a)return f}},
initRenderer:function(){},addNode:function(a,c,d){a instanceof ccs.Widget?cc.log("Please use addChild to add a Widget."):(cc.Node.prototype.addChild.call(this,a,c,d),this._nodes.push(a))},getNodeByTag:function(a){for(var c=this._nodes,d=0;d<c.length;d++){var e=c[d];if(e&&e.getTag()==a)return e}return null},getNodes:function(){return this._nodes},removeNode:function(a,c){cc.Node.prototype.removeChild.call(this,a);cc.ArrayRemoveObject(this._nodes,a)},removeNodeByTag:function(a,c){var d=this.getNodeByTag(a);
d?this.removeNode(d):cc.log("cocos2d: removeNodeByTag(tag \x3d %d): child not found!",a)},removeAllNodes:function(){for(var a=0;a<this._nodes.length;a++)cc.Node.prototype.removeChild.call(this,this._nodes[a]);this._nodes.length=0},setSize:function(a){this._customSize.width=a.width;this._customSize.height=a.height;a=this._ignoreSize?this.getContentSize():a;this._size.width=a.width;this._size.height=a.height;this._running&&(a=(a=this.getWidgetParent())?a.getSize():this._parent.getContentSize(),this._sizePercent.x=
0,this._sizePercent.y=0,0<a.width&&(this._sizePercent.x=this._customSize.width/a.width),0<a.height&&(this._sizePercent.y=this._customSize.height/a.height));this.onSizeChanged()},setSizePercent:function(a){this._sizePercent=a;var c=cc.size(this._customSize.width,this._customSize.height);if(this._running){var d=this.getWidgetParent();d?(c.width=d.getSize().width*a.x,c.height=d.getSize().height*a.y):(c.width=this._parent.getContentSize().width*a.x,c.height=this._parent.getContentSize().height*a.y)}a=
this._ignoreSize?this.getContentSize():c;this._size.width=a.width;this._size.height=a.height;this._customSize.width=c.width;this._customSize.height=c.height;this.onSizeChanged()},updateSizeAndPosition:function(){switch(this._sizeType){case ccs.SizeType.absolute:var a;a=this._ignoreSize?this.getContentSize():this._customSize;this._size.width=a.width;this._size.height=a.height;var c=spy=0;a=(a=this.getWidgetParent())?a.getSize():this._parent.getContentSize();0<a.width&&(c=this._customSize.width/a.width);
0<a.height&&(spy=this._customSize.height/a.height);this._sizePercent.x=c;this._sizePercent.y=spy;break;case ccs.SizeType.percent:a=this.getWidgetParent(),c=cc.size(0,0),a?(c.width=a.getSize().width*this._sizePercent.x,c.height=a.getSize().height*this._sizePercent.x):(c.width=this._parent.getContentSize().width*this._sizePercent.x,c.height=this._parent.getContentSize().height*this._sizePercent.y),a=this._ignoreSize?this.getContentSize():c,this._size.width=a.width,this._size.height=a.height,this._customSize.width=
c.width,this._customSize.height=c.height}this.onSizeChanged();c=this.getPosition();switch(this._positionType){case ccs.PositionType.absolute:a=(a=this.getWidgetParent())?a.getSize():this._parent.getContentSize();0>=a.width||0>=a.height?(this._positionPercent.x=0,this._positionPercent.y=0):(this._positionPercent.x=c.x/a.width,this._positionPercent.y=c.y/a.height);break;case ccs.PositionType.percent:a=(a=this.getWidgetParent())?a.getSize():this._parent.getContentSize(),c=cc.p(a.width*this._positionPercent.x,
a.height*this._positionPercent.y)}this.setPosition(c)},setSizeType:function(a){this._sizeType=a},getSizeType:function(){return this._sizeType},ignoreContentAdaptWithSize:function(a){a=(this._ignoreSize=a)?this.getContentSize():this._customSize;this._size.width=a.width;this._size.height=a.height;this.onSizeChanged()},isIgnoreContentAdaptWithSize:function(){return this._ignoreSize},getSize:function(){return this._size},getCustomSize:function(){return this._customSize},getSizePercent:function(){return this._sizePercent},
getWorldPosition:function(){return this.convertToWorldSpace(cc.PointZero())},getVirtualRenderer:function(){return this},onSizeChanged:function(){for(var a=0;a<this._widgetChildren.length;a++)this._widgetChildren[a].updateSizeAndPosition()},getContentSize:function(){return this._size},setTouchEnabled:function(a){this._touchEnabled=a},isTouchEnabled:function(){return this._touchEnabled},setUpdateEnabled:function(a){this._updateEnabled!=a&&((this._updateEnabled=a)?this.scheduleUpdate():this.unscheduleUpdate())},
isUpdateEnabled:function(){return this._updateEnabled},isFocused:function(){return this._focus},setFocused:function(a){if(a!=this._focus)if(this._focus=a,this._bright)this._focus?this.setBrightStyle(ccs.BrightStyle.highlight):this.setBrightStyle(ccs.BrightStyle.normal);else this.onPressStateChangedToDisabled()},setBright:function(a,c){if(this._bright=a)this._brightStyle=ccs.BrightStyle.none,this.setBrightStyle(ccs.BrightStyle.normal);else this.onPressStateChangedToDisabled()},setBrightStyle:function(a){if(this._brightStyle!=
a)switch(this._brightStyle=a=a||ccs.BrightStyle.normal,this._brightStyle){case ccs.BrightStyle.normal:this.onPressStateChangedToNormal();break;case ccs.BrightStyle.highlight:this.onPressStateChangedToPressed()}},onPressStateChangedToNormal:function(){},onPressStateChangedToPressed:function(){},onPressStateChangedToDisabled:function(){},didNotSelectSelf:function(){},onTouchBegan:function(a,c){var d=a.getLocation();this._touchStartPos.x=d.x;this._touchStartPos.y=d.y;this._hitted=this.isEnabled()&&this.isTouchEnabled()&&
this.hitTest(d)&&this.clippingParentAreaContainPoint(d);if(!this._hitted)return!1;this.setFocused(!0);var e=this.getWidgetParent();e&&e.checkChildInfo(0,this,d);this.pushDownEvent();return!this._touchPassedEnabled},onTouchMoved:function(a,c){var d=a.getLocation();this._touchMovePos.x=d.x;this._touchMovePos.y=d.y;this.setFocused(this.hitTest(d));var e=this.getWidgetParent();e&&e.checkChildInfo(1,this,d);this.moveEvent()},onTouchEnded:function(a,c){var d=a.getLocation();this._touchEndPos.x=d.x;this._touchEndPos.y=
d.y;var e=this._focus;this.setFocused(!1);var f=this.getWidgetParent();f&&f.checkChildInfo(2,this,d);e?this.releaseUpEvent():this.cancelUpEvent()},onTouchCancelled:function(a){this.setFocused(!1);this.cancelUpEvent()},onTouchLongClicked:function(a){this.longClickEvent()},pushDownEvent:function(){this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccs.TouchEventType.began)},moveEvent:function(){this._touchEventListener&&
this._touchEventSelector&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccs.TouchEventType.moved)},releaseUpEvent:function(){this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccs.TouchEventType.ended)},cancelUpEvent:function(){this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccs.TouchEventType.canceled)},longClickEvent:function(){},addTouchEventListener:function(a,
c){this._touchEventSelector=a;this._touchEventListener=c},hitTest:function(a){a=this.convertToNodeSpace(a);var c=cc.rect(-this._size.width*this._anchorPoint.x,-this._size.height*this._anchorPoint.y,this._size.width,this._size.height);return a.x>=c.x&&a.x<=c.x+c.width&&a.y>=c.y&&a.y<=c.y+c.height?!0:!1},clippingParentAreaContainPoint:function(a){this._affectByClipping=!1;for(var c=this.getParent(),d=null;c;){if(c instanceof ccs.Layout&&c.isClippingEnabled()){this._affectByClipping=!0;d=c;break}c=c.getParent()}return this._affectByClipping?
d?(c=!1,d.hitTest(a)&&(c=!0),c?d.clippingParentAreaContainPoint(a):!1):!0:!0},checkChildInfo:function(a,c,d){var e=this.getWidgetParent();e&&e.checkChildInfo(a,c,d)},setPosition:function(a,c){if(this._running){var d=this.getWidgetParent();d&&(d=d.getSize(),0>=d.width||0>=d.height?(this._positionPercent.x=0,this._positionPercent.y=0):c?(this._positionPercent.x=a/d.width,this._positionPercent.y=c/d.height):(this._positionPercent.x=a.x/d.width,this._positionPercent.y=a.y/d.height))}cc.Node.prototype.setPosition.apply(this,
arguments)},setPositionPercent:function(a){this._positionPercent=a;this._running&&(a=this.getWidgetParent())&&(a=a.getSize(),a=cc.p(a.width*this._positionPercent.x,a.height*this._positionPercent.y),this.setPosition(a))},updateAnchorPoint:function(){this.setAnchorPoint(this.getAnchorPoint())},getPositionPercent:function(){return this._positionPercent},setPositionType:function(a){this._positionType=a},getPositionType:function(){return this._positionType},setFlippedX:function(a){this._flippedX=a;this.updateFlippedX()},
isFlippedX:function(){return this._flippedX},setFlippedY:function(a){this._flippedY=a;this.updateFlippedY()},isFlippedY:function(){return this._flippedY},updateFlippedX:function(){},updateFlippedY:function(){},isBright:function(){return this._bright},isEnabled:function(){return this._enabled},getLeftInParent:function(){return this.getPosition().x-this.getAnchorPoint().x*this._size.width},getBottomInParent:function(){return this.getPosition().y-this.getAnchorPoint().y*this._size.height},getRightInParent:function(){return this.getLeftInParent()+
this._size.width},getTopInParent:function(){return this.getBottomInParent()+this._size.height},getTouchStartPos:function(){return this._touchStartPos},getTouchMovePos:function(){return this._touchMovePos},getTouchEndPos:function(){return this._touchEndPos},setName:function(a){this._name=a},getName:function(){return this._name},getWidgetType:function(){return this._widgetType},setLayoutParameter:function(a){this._layoutParameterDictionary[a.getLayoutType()]=a},getLayoutParameter:function(a){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 ccs.Widget.create()},copyClonedWidgetChildren:function(a){a=a.getChildren();for(var c=0;c<a.length;c++){var d=a[c];d instanceof ccs.Widget&&this.addChild(d.clone())}},copySpecialProperties:function(a){},copyProperties:function(a){this.setEnabled(a.isEnabled());this.setVisible(a.isVisible());this.setBright(a.isBright());
this.setTouchEnabled(a.isTouchEnabled());this._touchPassedEnabled=!1;this.setZOrder(a.getZOrder());this.setUpdateEnabled(a.isUpdateEnabled());this.setTag(a.getTag());this.setName(a.getName());this.setActionTag(a.getActionTag());this._ignoreSize=a._ignoreSize;this._size=cc.size(a._size.width,a._size.height);this._customSize=cc.size(a._customSize.width,a._customSize.height);this.copySpecialProperties(a);this._sizeType=a.getSizeType();this._sizePercent=cc.p(a._sizePercent.x,a._sizePercent.y);this._positionType=
a._positionType;this._positionPercent=cc.p(a._positionPercent.x,a._positionPercent.y);this.setPosition(a.getPosition());this.setAnchorPoint(a.getAnchorPoint());this.setScaleX(a.getScaleX());this.setScaleY(a.getScaleY());this.setRotation(a.getRotation());this.setRotationX(a.getRotationX());this.setRotationY(a.getRotationY());this.setFlippedX(a.isFlippedX());this.setFlippedY(a.isFlippedY());this.setColor(a.getColor());this.setOpacity(a.getOpacity());for(var c in a._layoutParameterDictionary){var d=
a._layoutParameterDictionary[c];d&&this.setLayoutParameter(d.clone())}this.onSizeChanged()},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},setColor:function(a){this._color.r=a.r;this._color.g=a.g;this._color.b=a.b;this.updateTextureColor()},getColor:function(){return cc.c3b(this._color.r,this._color.g,this._color.b)},setOpacity:function(a){this._opacity=a;this.updateTextureOpacity()},getOpacity:function(){return this._opacity},updateTextureColor:function(){},
updateTextureOpacity:function(){},updateTextureRGBA:function(){},updateColorToRenderer:function(a){a.RGBAProtocol&&a.setColor(this._color)},updateOpacityToRenderer:function(a){a.RGBAProtocol&&a.setOpacity(this._opacity)},updateRGBAToRenderer:function(a){a.RGBAProtocol&&(a.setColor(this._color),a.setOpacity(this._opacity))}});ccs.Widget.create=function(){var a=new ccs.Widget;return a&&a.init()?a:null};ccs.LayoutBackGroundColorType={none:0,solid:1,gradient:2};ccs.LayoutType={absolute:0,linearVertical:1,linearHorizontal:2,relative:3};ccs.LayoutClippingType={stencil:0,scissor:1};ccs.BACKGROUNDIMAGEZ=-2;ccs.BACKGROUNDCOLORRENDERERZ=-2;
ccs.Layout=ccs.Widget.extend({_clippingEnabled:null,_backGroundScale9Enabled:null,_backGroundImage:null,_backGroundImageFileName:null,_backGroundImageCapInsets:null,_colorType:null,_bgImageTexType:null,_colorRender:null,_gradientRender:null,_color:null,_startColor:null,_endColor:null,_alongVector:null,_opacity:null,_backGroundImageTextureSize:null,_layoutType:null,_doLayoutDirty:!1,_clippingRectDirty:!1,_clippingType:null,_clippingStencil:null,_handleScissor:!1,_scissorRectDirty:!1,_clippingRect:null,
_clippingParent:null,_backGroundImageColor:null,_backGroundImageOpacity:null,ctor:function(){ccs.Widget.prototype.ctor.call(this);this._backGroundScale9Enabled=this._clippingEnabled=!1;this._backGroundImage=null;this._backGroundImageFileName="";this._backGroundImageCapInsets=cc.RectZero();this._colorType=ccs.LayoutBackGroundColorType.none;this._bgImageTexType=ccs.TextureResType.local;this._gradientRender=this._colorRender=null;this._color=cc.white();this._startColor=cc.white();this._endColor=cc.white();
this._alongVector=cc.p(0,-1);this._opacity=255;this._backGroundImageTextureSize=cc.SizeZero();this._layoutType=ccs.LayoutType.absolute;this._widgetType=ccs.WidgetType.container;this._clippingRectDirty=this._doLayoutDirty=!0;this._clippingType=ccs.LayoutClippingType.stencil;this._clippingStencil=null;this._scissorRectDirty=this._handleScissor=!1;this._clippingRect=cc.rect(0,0,0,0);this._clippingParent=null;this._backGroundImageColor=cc.c3b(255,255,255);this._backGroundImageOpacity=255},init:function(){return cc.Node.prototype.init.call(this)?
(this._layoutParameterDictionary={},this._widgetChildren=[],this.initRenderer(),this.ignoreContentAdaptWithSize(!1),this.setSize(cc.SizeZero()),this.setBright(!0),this.setAnchorPoint(0,0),this.initStencil(),!0):!1},initStencil:null,_initStencilForWebGL:function(){this._clippingStencil=cc.DrawNode.create();ccs.Layout._init_once=!0;ccs.Layout._init_once&&(cc.stencilBits=cc.renderContext.getParameter(cc.renderContext.STENCIL_BITS),0>=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),ccs.Layout._init_once=
!1)},_initStencilForCanvas:function(){this._clippingStencil=cc.DrawNode.create();var a=cc.EGLView.getInstance().getScaleX(),c=cc.EGLView.getInstance().getScaleY(),d=cc.renderContext,e=this._clippingStencil;e.draw=function(){for(var f=0;f<e._buffer.length;f++){var g=e._buffer[f].verts,h=g[0];d.beginPath();d.moveTo(h.x*a,-h.y*c);for(var h=1,k=g.length;h<k;h++)d.lineTo(g[h].x*a,-g[h].y*c)}}},addChild:function(a,c,d){if(!(a instanceof ccs.Widget))throw"the child add to Layout  must a type of cc.Widget";
this.supplyTheLayoutParameterLackToChild(a);ccs.Widget.prototype.addChild.call(this,a,c,d);this._doLayoutDirty=!0},removeChild:function(a,c){ccs.Widget.prototype.removeChild.call(this,a,c);this._doLayoutDirty=!0},removeAllChildren:function(a){ccs.Widget.prototype.removeAllChildren.call(this,a);this._doLayoutDirty=!0},isClippingEnabled:function(){return this._clippingEnabled},visit:function(a){if(this._enabled)if(this._clippingEnabled)switch(this._clippingType){case ccs.LayoutClippingType.stencil:this.stencilClippingVisit(a);
break;case ccs.LayoutClippingType.scissor:this.scissorClippingVisit(a)}else cc.Node.prototype.visit.call(this,a)},sortAllChildren:function(){ccs.Widget.prototype.sortAllChildren.call(this);this.doLayout()},stencilClippingVisit:null,_stencilClippingVisitForWebGL:function(a){var c=a||cc.renderContext;if(1>cc.stencilBits)cc.Node.prototype.visit.call(this,a);else if(this._clippingStencil&&this._clippingStencil.isVisible())if(ccs.Layout._layer=-1,ccs.Layout._layer+1==cc.stencilBits)ccs.Layout._visit_once=
!0,ccs.Layout._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its childs."),ccs.Layout._visit_once=!1),cc.Node.prototype.visit.call(this,a);else{ccs.Layout._layer++;var d=1<<ccs.Layout._layer,e=d|d-1,f=c.isEnabled(c.STENCIL_TEST),g=c.getParameter(c.STENCIL_WRITEMASK),h=c.getParameter(c.STENCIL_FUNC),k=c.getParameter(c.STENCIL_REF),m=c.getParameter(c.STENCIL_VALUE_MASK),n=c.getParameter(c.STENCIL_FAIL),
p=c.getParameter(c.STENCIL_PASS_DEPTH_FAIL),q=c.getParameter(c.STENCIL_PASS_DEPTH_PASS);c.enable(c.STENCIL_TEST);c.stencilMask(d);var s=c.getParameter(c.DEPTH_WRITEMASK);c.depthMask(!1);c.stencilFunc(c.NEVER,d,d);c.stencilOp(c.ZERO,c.KEEP,c.KEEP);cc.drawingUtil.drawSolidRect(cc.PointZero(),cc.pFromSize(cc.Director.getInstance().getWinSize()),cc.c4f(1,1,1,1));c.stencilFunc(c.NEVER,d,d);c.stencilOp(c.REPLACE,c.KEEP,c.KEEP);cc.kmGLPushMatrix();this.transform();this._clippingStencil.visit();cc.kmGLPopMatrix();
c.depthMask(s);c.stencilFunc(c.EQUAL,e,e);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);cc.Node.prototype.visit.call(this,a);c.stencilFunc(h,k,m);c.stencilOp(n,p,q);c.stencilMask(g);f||c.disable(c.STENCIL_TEST);ccs.Layout._layer--}},_stencilClippingVisitForCanvas:function(a){if(this._clippingStencil&&this._clippingStencil.isVisible()){if(this._cangodhelpme()||this._clippingStencil instanceof cc.Sprite){a=a||cc.renderContext;var c=a.canvas,d=ccs.Layout._getSharedCache();d.width=c.width;d.height=c.height;d.getContext("2d").drawImage(c,
0,0);a.save();cc.Node.prototype.visit.call(this,a);a.globalCompositeOperation="destination-in";this.transform(a);this._clippingStencil.visit();a.restore();a.save();a.setTransform(1,0,0,1,0,0);a.globalCompositeOperation="destination-over";a.drawImage(d,0,0)}else{a=a||cc.renderContext;var d=this._children,e;a.save();this.transform(a);this._clippingStencil.visit(a);a.clip();this._cangodhelpme(!0);var f=d.length;if(0<f){this.sortAllChildren();for(c=0;c<f;c++)if(e=d[c],0>e._zOrder)e.visit(a);else break;
for(this.draw(a);c<f;c++)d[c].visit(a)}else this.draw(a);this._cangodhelpme(!1)}a.restore()}},_godhelpme:!1,_cangodhelpme:function(a){if(!0===a||!1===a)cc.ClippingNode.prototype._godhelpme=a;return cc.ClippingNode.prototype._godhelpme},scissorClippingVisit:null,_scissorClippingVisitForWebGL:function(a){var c=this.getClippingRect();a=a||cc.renderContext;this._handleScissor&&a.enable(a.SCISSOR_TEST);cc.EGLView.getInstance().setScissorInPoints(c.x,c.y,c.width,c.height);cc.Node.prototype.visit.call(this);
this._handleScissor&&a.disable(a.SCISSOR_TEST)},setClippingEnabled:function(a){if(a!=this._clippingEnabled)switch(this._clippingEnabled=a,this._clippingType){case ccs.LayoutClippingType.stencil:a?this.setStencilClippingSize(this._size):this._clippingStencil=null}},setClippingType:function(a){if(a!=this._clippingType){var c=this.isClippingEnabled();this.setClippingEnabled(!1);this._clippingType=a;this.setClippingEnabled(c)}},getClippingType:function(){return this._clippingType},setStencilClippingSize:function(a){if(this._clippingEnabled&&
this._clippingType==ccs.LayoutClippingType.stencil){var c=[];c[0]=cc.p(0,0);c[1]=cc.p(a.width,0);c[2]=cc.p(a.width,a.height);c[3]=cc.p(0,a.height);a=cc.c4f(0,1,0,1);this._clippingStencil.clear();this._clippingStencil.drawPoly(c,4,a,0,a)}},rendererVisitCallBack:function(){this.doLayout()},getClippingRect:function(){if(this._clippingRectDirty){this._handleScissor=!0;var a=this.convertToWorldSpace(cc.p(0,0)),c=this.nodeToWorldTransform(),d=this._size.width*c.a,c=this._size.height*c.d,e;e=this;for(var f=
!1;e;)if((e=e.getParent())&&e instanceof ccs.Layout&&e.isClippingEnabled()&&(f||(this._clippingParent=e,f=!0),e._clippingType==ccs.LayoutClippingType.scissor)){this._handleScissor=!1;break}if(this._clippingParent){e=this._clippingParent.getClippingRect();var f=a.x-d*this._anchorPoint.x,g=a.y-c*this._anchorPoint.y,h=d,k=c,m=a.x-e.x;0>m&&(f=e.x,h+=m);d=a.x+d-(e.x+e.width);0<d&&(h-=d);d=a.y+c-(e.y+e.height);0<d&&(k-=d);a=a.y-e.y;0>a&&(g=e.x,k+=a);0>h&&(h=0);0>k&&(k=0);this._clippingRect.x=f;this._clippingRect.y=
g;this._clippingRect.width=h;this._clippingRect.height=k}else this._clippingRect.x=a.x-d*this._anchorPoint.x,this._clippingRect.y=a.y-c*this._anchorPoint.y,this._clippingRect.width=d,this._clippingRect.height=c;this._clippingRectDirty=!1}return this._clippingRect},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.setContentSize(this._size);this.setStencilClippingSize(this._size);this._clippingRectDirty=this._doLayoutDirty=!0;this._backGroundImage&&(this._backGroundImage.setPosition(this._size.width/
2,this._size.height/2),this._backGroundScale9Enabled&&this._backGroundImage instanceof cc.Scale9Sprite&&this._backGroundImage.setPreferredSize(this._size));this._colorRender&&this._colorRender.setContentSize(this._size);this._gradientRender&&this._gradientRender.setContentSize(this._size)},setBackGroundImageScale9Enabled:function(a){this._backGroundScale9Enabled!=a&&(cc.Node.prototype.removeChild.call(this,this._backGroundImage,!0),this._backGroundImage=null,this._backGroundImage=(this._backGroundScale9Enabled=
a)?cc.Scale9Sprite.create():cc.Sprite.create(),cc.Node.prototype.addChild.call(this,this._backGroundImage,ccs.BACKGROUNDIMAGEZ,-1),this.setBackGroundImage(this._backGroundImageFileName,this._bgImageTexType),this.setBackGroundImageCapInsets(this._backGroundImageCapInsets))},isBackGroundImageScale9Enabled:function(){return this._backGroundScale9Enabled},setBackGroundImage:function(a,c){if(a){c=c||ccs.TextureResType.local;null==this._backGroundImage&&this.addBackGroundImage();this._backGroundImageFileName=
a;this._bgImageTexType=c;switch(this._bgImageTexType){case ccs.TextureResType.local:this._backGroundImage.initWithFile(a);break;case ccs.TextureResType.plist:this._backGroundImage.initWithSpriteFrameName(a)}this._backGroundScale9Enabled&&this._backGroundImage.setPreferredSize(this._size);this.updateBackGroundImageRGBA();this._backGroundImageTextureSize=this._backGroundImage.getContentSize();this._backGroundImage.setPosition(this._size.width/2,this._size.height/2)}},setBackGroundImageCapInsets:function(a){this._backGroundImageCapInsets=
a;this._backGroundScale9Enabled&&this._backGroundImage.setCapInsets(a)},getBackGroundImageCapInsets:function(){return this._backGroundImageCapInsets},supplyTheLayoutParameterLackToChild:function(a){if(a)switch(this._layoutType){case ccs.LayoutType.linearHorizontal:case ccs.LayoutType.linearVertical:var c=a.getLayoutParameter(ccs.LayoutParameterType.linear);c||a.setLayoutParameter(ccs.LinearLayoutParameter.create());break;case ccs.LayoutType.relative:(c=a.getLayoutParameter(ccs.LayoutParameterType.relative))||
a.setLayoutParameter(ccs.RelativeLayoutParameter.create())}},addBackGroundImage:function(){this._backGroundScale9Enabled?(this._backGroundImage=cc.Scale9Sprite.create(),this._backGroundImage.setPreferredSize(this._size)):this._backGroundImage=cc.Sprite.create();cc.Node.prototype.addChild.call(this,this._backGroundImage,ccs.BACKGROUNDIMAGEZ,-1);this._backGroundImage.setPosition(this._size.width/2,this._size.height/2)},removeBackGroundImage:function(){this._backGroundImage&&(cc.Node.prototype.removeChild.call(this,
this._backGroundImage,!0),this._backGroundImage=null,this._backGroundImageFileName="",this._backGroundImageTextureSize=cc.SizeZero())},setBackGroundColorType:function(a){if(this._colorType!=a){switch(this._colorType){case ccs.LayoutBackGroundColorType.none:this._colorRender&&(cc.Node.prototype.removeChild.call(this,this._colorRender,!0),this._colorRender=null);this._gradientRender&&(cc.Node.prototype.removeChild.call(this,this._gradientRender,!0),this._gradientRender=null);break;case ccs.LayoutBackGroundColorType.solid:this._colorRender&&
(cc.Node.prototype.removeChild.call(this,this._colorRender,!0),this._colorRender=null);break;case ccs.LayoutBackGroundColorType.gradient:this._gradientRender&&(cc.Node.prototype.removeChild.call(this,this._gradientRender,!0),this._gradientRender=null)}this._colorType=a;switch(this._colorType){case ccs.LayoutBackGroundColorType.solid:this._colorRender=cc.LayerColor.create();this._colorRender.setContentSize(this._size);this._colorRender.setOpacity(this._opacity);this._colorRender.setColor(this._color);
cc.Node.prototype.addChild.call(this,this._colorRender,ccs.BACKGROUNDCOLORRENDERERZ,-1);break;case ccs.LayoutBackGroundColorType.gradient:this._gradientRender=cc.LayerGradient.create(cc.c4b(255,0,0,255),cc.c4b(0,255,0,255)),this._gradientRender.setContentSize(this._size),this._gradientRender.setOpacity(this._opacity),this._gradientRender.setStartColor(this._startColor),this._gradientRender.setEndColor(this._endColor),this._gradientRender.setVector(this._alongVector),cc.Node.prototype.addChild.call(this,
this._gradientRender,ccs.BACKGROUNDCOLORRENDERERZ,-1)}}},getBackGroundColorType:function(){return this._colorType},setBackGroundColor:function(a,c){c?(this._startColor.r=a.r,this._startColor.g=a.g,this._startColor.b=a.b,this._gradientRender&&this._gradientRender.setStartColor(a),this._endColor=c,this._gradientRender&&this._gradientRender.setEndColor(c)):(this._color.r=a.r,this._color.g=a.g,this._color.b=a.b,this._colorRender&&this._colorRender.setColor(a))},getBackGroundColor:function(){return this._color},
getBackGroundStartColor:function(){return this._startColor},getBackGroundEndColor:function(){return this._endColor},setBackGroundColorOpacity:function(a){this._opacity=a;switch(this._colorType){case ccs.LayoutBackGroundColorType.solid:this._colorRender.setOpacity(a);break;case ccs.LayoutBackGroundColorType.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._backGroundImageOpacity=a;this.getBackGroundImageColor()},getBackGroundImageColor:function(){var a=this._backGroundImageColor;return cc.color(a.r,a.g,a.b)},getBackGroundImageOpacity:function(){return this._backGroundImageOpacity},
updateBackGroundImageColor:function(){this._backGroundImage.setColor(this._backGroundImageColor)},updateBackGroundImageOpacity:function(){this._backGroundImage.setOpacity(this._backGroundImageOpacity)},updateBackGroundImageRGBA:function(){this.updateBackGroundImageColor();this.updateBackGroundImageOpacity()},getBackGroundImageTextureSize:function(){return this._backGroundImageTextureSize},setLayoutType:function(a){this._layoutType=a;a=this._widgetChildren;for(var c=null,d=0;d<a.length;d++)c=a[d],
this.supplyTheLayoutParameterLackToChild(c);this._doLayoutDirty=!0},getLayoutType:function(){return this._layoutType},requestDoLayout:function(){this._doLayoutDirty=!0},doLayout_LINEAR_VERTICAL:function(){for(var a=this._widgetChildren,c=this.getSize(),d=c.height,e=0;e<a.length;++e){var f=a[e],g=f.getLayoutParameter(ccs.LayoutParameterType.linear);if(g){var h=g.getGravity(),k=f.getAnchorPoint(),m=f.getSize(),n=k.x*m.width,d=d-(1-k.y)*m.height;switch(h){case ccs.LinearGravity.right:n=c.width-(1-k.x)*
m.width;break;case ccs.LinearGravity.centerHorizontal:n=c.width/2-m.width*(0.5-k.x)}g=g.getMargin();n+=g.left;d-=g.top;f.setPosition(cc.p(n,d));d=f.getBottomInParent()-g.bottom}}},doLayout_LINEAR_HORIZONTAL:function(){for(var a=this._widgetChildren,c=this.getSize(),d=0,e=0;e<a.length;++e){var f=a[e],g=f.getLayoutParameter(ccs.LayoutParameterType.linear);if(g){var h=g.getGravity(),k=f.getAnchorPoint(),m=f.getSize(),d=d+k.x*m.width,n=c.height-(1-k.y)*m.height;switch(h){case ccs.LinearGravity.bottom:n=
k.y*m.height;break;case ccs.LinearGravity.centerVertical:n=c.height/2-m.height*(0.5-k.y)}g=g.getMargin();d+=g.left;n-=g.top;f.setPosition(cc.p(d,n));d=f.getRightInParent()+g.right}}},doLayout_RELATIVE:function(){for(var a=this._widgetChildren,c=a.length,d=c,e=this.getSize(),f=0;f<c;f++){var g=a[f],h=g.getLayoutParameter(ccs.LayoutParameterType.relative);h._put=!1}for(;0<d;)for(f=0;f<c;f++)if(g=a[f],(h=g.getLayoutParameter(ccs.LayoutParameterType.relative))&&!h._put){var k=g.getAnchorPoint(),m=g.getSize(),
n=h.getAlign(),p=h.getRelativeToWidgetName(),q=null,s=null,r=0,t=0;p&&(q=ccs.UIHelper.seekWidgetByRelativeName(this,p))&&(s=q.getLayoutParameter(ccs.LayoutParameterType.relative));switch(n){case ccs.RelativeAlign.alignNone:case ccs.RelativeAlign.alignParentTopLeft:r=k.x*m.width;t=e.height-(1-k.y)*m.height;break;case ccs.RelativeAlign.alignParentTopCenterHorizontal:r=0.5*e.width-m.width*(0.5-k.x);t=e.height-(1-k.y)*m.height;break;case ccs.RelativeAlign.alignParentTopRight:r=e.width-(1-k.x)*m.width;
t=e.height-(1-k.y)*m.height;break;case ccs.RelativeAlign.alignParentLeftCenterVertical:r=k.x*m.width;t=0.5*e.height-m.height*(0.5-k.y);break;case ccs.RelativeAlign.centerInParent:r=0.5*e.width-m.width*(0.5-k.x);t=0.5*e.height-m.height*(0.5-k.y);break;case ccs.RelativeAlign.alignParentRightCenterVertical:r=e.width-(1-k.x)*m.width;t=0.5*e.height-m.height*(0.5-k.y);break;case ccs.RelativeAlign.alignParentLeftBottom:r=k.x*m.width;t=k.y*m.height;break;case ccs.RelativeAlign.alignParentBottomCenterHorizontal:r=
0.5*e.width-m.width*(0.5-k.x);t=k.y*m.height;break;case ccs.RelativeAlign.alignParentRightBottom:r=e.width-(1-k.x)*m.width;t=k.y*m.height;break;case ccs.RelativeAlign.locationAboveLeftAlign:if(q){if(s&&!s._put)continue;t=q.getTopInParent();r=q.getLeftInParent();t+=k.y*m.height;r+=k.x*m.width}break;case ccs.RelativeAlign.locationAboveCenter:if(q){if(s&&!s._put)continue;p=q.getSize();t=q.getTopInParent();t+=k.y*m.height;r=q.getLeftInParent()+0.5*p.width+k.x*m.width-0.5*m.width}break;case ccs.RelativeAlign.locationAboveRightAlign:if(q){if(s&&
!s._put)continue;t=q.getTopInParent();r=q.getRightInParent();t+=k.y*m.height;r-=(1-k.x)*m.width}break;case ccs.RelativeAlign.locationLeftOfTopAlign:if(q){if(s&&!s._put)continue;t=q.getTopInParent();r=q.getLeftInParent();t-=(1-k.y)*m.height;r-=(1-k.x)*m.width}break;case ccs.RelativeAlign.locationLeftOfCenter:if(q){if(s&&!s._put)continue;p=q.getSize();r=q.getLeftInParent();r-=(1-k.x)*m.width;t=q.getBottomInParent()+0.5*p.height+k.y*m.height-0.5*m.height}break;case ccs.RelativeAlign.locationLeftOfBottomAlign:if(q){if(s&&
!s._put)continue;t=q.getBottomInParent();r=q.getLeftInParent();t+=k.y*m.height;r-=(1-k.x)*m.width}break;case ccs.RelativeAlign.locationRightOfTopAlign:if(q){if(s&&!s._put)continue;t=q.getTopInParent();r=q.getRightInParent();t-=(1-k.y)*m.height;r+=k.x*m.width}break;case ccs.RelativeAlign.locationRightOfCenter:if(q){if(s&&!s._put)continue;p=q.getSize();r=q.getRightInParent();r+=k.x*m.width;t=q.getBottomInParent()+0.5*p.height+k.y*m.height-0.5*m.height}break;case ccs.RelativeAlign.locationRightOfBottomAlign:if(q){if(s&&
!s._put)continue;t=q.getBottomInParent();r=q.getRightInParent();t+=k.y*m.height;r+=k.x*m.width}break;case ccs.RelativeAlign.locationBelowLeftAlign:if(q){if(s&&!s._put)continue;t=q.getBottomInParent();r=q.getLeftInParent();t-=(1-k.y)*m.height;r+=k.x*m.width}break;case ccs.RelativeAlign.locationBelowCenter:if(q){if(s&&!s._put)continue;p=q.getSize();t=q.getBottomInParent();t-=(1-k.y)*m.height;r=q.getLeftInParent()+0.5*p.width+k.x*m.width-0.5*m.width}break;case ccs.RelativeAlign.locationBelowRightAlign:if(q){if(s&&
!s._put)continue;t=q.getBottomInParent();r=q.getRightInParent();t-=(1-k.y)*m.height;r-=(1-k.x)*m.width}}var u,v,k=h.getMargin();s&&(u=s.getMargin(),v=s.getAlign());switch(n){case ccs.RelativeAlign.alignNone:case ccs.RelativeAlign.alignParentTopLeft:r+=k.left;t-=k.top;break;case ccs.RelativeAlign.alignParentTopCenterHorizontal:t-=k.top;break;case ccs.RelativeAlign.alignParentTopRight:r-=k.right;t-=k.top;break;case ccs.RelativeAlign.alignParentLeftCenterVertical:r+=k.left;break;case ccs.RelativeAlign.alignParentRightCenterVertical:r-=
k.right;break;case ccs.RelativeAlign.alignParentLeftBottom:r+=k.left;t+=k.bottom;break;case ccs.RelativeAlign.alignParentBottomCenterHorizontal:t+=k.bottom;break;case ccs.RelativeAlign.alignParentRightBottom:r-=k.right;t+=k.bottom;break;case ccs.RelativeAlign.locationAboveLeftAlign:t+=k.bottom;v!=ccs.RelativeAlign.alignParentTopCenterHorizontal&&v!=ccs.RelativeAlign.alignParentTopLeft&&v!=ccs.RelativeAlign.alignNone&&v!=ccs.RelativeAlign.alignParentTopRight&&(t+=u.top);t+=k.left;break;case ccs.RelativeAlign.locationAboveCenter:t+=
k.bottom;v!=ccs.RelativeAlign.alignParentTopCenterHorizontal&&v!=ccs.RelativeAlign.alignParentTopLeft&&v!=ccs.RelativeAlign.alignNone&&v!=ccs.RelativeAlign.alignParentTopRight&&(t+=u.top);break;case ccs.RelativeAlign.locationAboveRightAlign:t+=k.bottom;v!=ccs.RelativeAlign.alignParentTopCenterHorizontal&&v!=ccs.RelativeAlign.alignParentTopLeft&&v!=ccs.RelativeAlign.alignNone&&v!=ccs.RelativeAlign.alignParentTopRight&&(t+=u.top);r-=k.right;break;case ccs.RelativeAlign.locationLeftOfTopAlign:r-=k.right;
v!=ccs.RelativeAlign.alignParentTopLeft&&v!=ccs.RelativeAlign.alignNone&&v!=ccs.RelativeAlign.alignParentLeftBottom&&v!=ccs.RelativeAlign.alignParentLeftCenterVertical&&(r-=u.left);t-=k.top;break;case ccs.RelativeAlign.locationLeftOfCenter:r-=k.right;v!=ccs.RelativeAlign.alignParentTopLeft&&v!=ccs.RelativeAlign.alignNone&&v!=ccs.RelativeAlign.alignParentLeftBottom&&v!=ccs.RelativeAlign.alignParentLeftCenterVertical&&(r-=u.left);break;case ccs.RelativeAlign.locationLeftOfBottomAlign:r-=k.right;v!=
ccs.RelativeAlign.alignParentTopLeft&&v!=ccs.RelativeAlign.alignNone&&v!=ccs.RelativeAlign.alignParentLeftBottom&&v!=ccs.RelativeAlign.alignParentLeftCenterVertical&&(r-=u.left);t+=k.bottom;break;case ccs.RelativeAlign.locationRightOfTopAlign:r+=k.left;v!=ccs.RelativeAlign.alignParentTopRight&&v!=ccs.RelativeAlign.alignParentRightBottom&&v!=ccs.RelativeAlign.alignParentRightCenterVertical&&(r+=u.right);t-=k.top;break;case ccs.RelativeAlign.locationRightOfCenter:r+=k.left;v!=ccs.RelativeAlign.alignParentTopRight&&
v!=ccs.RelativeAlign.alignParentRightBottom&&v!=ccs.RelativeAlign.alignParentRightCenterVertical&&(r+=u.right);break;case ccs.RelativeAlign.locationRightOfBottomAlign:r+=k.left;v!=ccs.RelativeAlign.alignParentTopRight&&v!=ccs.RelativeAlign.alignParentRightBottom&&v!=ccs.RelativeAlign.alignParentRightCenterVertical&&(r+=u.right);t+=k.bottom;break;case ccs.RelativeAlign.locationBelowLeftAlign:t-=k.top;v!=ccs.RelativeAlign.alignParentLeftBottom&&v!=ccs.RelativeAlign.alignParentRightBottom&&v!=ccs.RelativeAlign.alignParentBottomCenterHorizontal&&
(t-=u.bottom);r+=k.left;break;case ccs.RelativeAlign.locationBelowCenter:t-=k.top;v!=ccs.RelativeAlign.alignParentLeftBottom&&v!=ccs.RelativeAlign.alignParentRightBottom&&v!=ccs.RelativeAlign.alignParentBottomCenterHorizontal&&(t-=u.bottom);break;case ccs.RelativeAlign.locationBelowRightAlign:t-=k.top,v!=ccs.RelativeAlign.alignParentLeftBottom&&v!=ccs.RelativeAlign.alignParentRightBottom&&v!=ccs.RelativeAlign.alignParentBottomCenterHorizontal&&(t-=u.bottom),r-=k.right}g.setPosition(cc.p(r,t));h._put=
!0;d--}},doLayout:function(){if(this._doLayoutDirty){switch(this._layoutType){case ccs.LayoutType.linearVertical:this.doLayout_LINEAR_VERTICAL();break;case ccs.LayoutType.linearHorizontal:this.doLayout_LINEAR_HORIZONTAL();break;case ccs.LayoutType.relative:this.doLayout_RELATIVE()}this._doLayoutDirty=!1}},getDescription:function(){return"Layout"},createCloneInstance:function(){return ccs.Layout.create()},copyClonedWidgetChildren:function(a){ccs.Widget.prototype.copyClonedWidgetChildren.call(this,
a)},copySpecialProperties:function(a){this.setBackGroundImageScale9Enabled(a._backGroundScale9Enabled);this.setBackGroundImage(a._backGroundImageFileName,a._bgImageTexType);this.setBackGroundImageCapInsets(a._backGroundImageCapInsets);this.setBackGroundColorType(a._colorType);this.setBackGroundColor(a._color);this.setBackGroundColor(a._startColor,a._endColor);this.setBackGroundColorOpacity(a._opacity);this.setBackGroundColorVector(a._alongVector);this.setLayoutType(a._layoutType);this.setClippingEnabled(a._clippingEnabled);
this.setClippingType(a._clippingType)}});ccs.Layout._init_once=null;ccs.Layout._visit_once=null;ccs.Layout._layer=null;ccs.Layout._sharedCache=null;
cc.Browser.supportWebGL?(ccs.Layout.prototype.initStencil=ccs.Layout.prototype._initStencilForWebGL,ccs.Layout.prototype.stencilClippingVisit=ccs.Layout.prototype._stencilClippingVisitForWebGL,ccs.Layout.prototype.scissorClippingVisit=ccs.Layout.prototype._scissorClippingVisitForWebGL):(ccs.Layout.prototype.initStencil=ccs.Layout.prototype._initStencilForCanvas,ccs.Layout.prototype.stencilClippingVisit=ccs.Layout.prototype._stencilClippingVisitForCanvas,ccs.Layout.prototype.scissorClippingVisit=ccs.Layout.prototype._stencilClippingVisitForCanvas);
ccs.Layout._getSharedCache=function(){return cc.ClippingNode._sharedCache||(cc.ClippingNode._sharedCache=document.createElement("canvas"))};ccs.Layout.create=function(){var a=new ccs.Layout;return a&&a.init()?a:null};ccs.LayoutParameterType={none:0,linear:1,relative:2};
ccs.LayoutParameter=ccs.Class.extend({_margin:null,_layoutParameterType:null,ctor:function(){this._margin=new ccs.Margin;this._layoutParameterType=ccs.LayoutParameterType.none},setMargin:function(a){this._margin.left=a.left;this._margin.top=a.top;this._margin.right=a.right;this._margin.bottom=a.bottom},getMargin:function(){return this._margin},getLayoutType:function(){return this._layoutParameterType},clone:function(){var a=this.createCloneInstance();a.copyProperties(this);return a},createCloneInstance:function(){return ccs.LayoutParameter.create()},
copyProperties:function(a){this._margin.left=a._margin.left;this._margin.top=a._margin.top;this._margin.right=a._margin.right;this._margin.bottom=a._margin.bottom}});ccs.LayoutParameter.create=function(){return new ccs.LayoutParameter};
ccs.LinearLayoutParameter=ccs.LayoutParameter.extend({_linearGravity:null,ctor:function(){ccs.LayoutParameter.prototype.ctor.call(this);this._linearGravity=ccs.LinearGravity.none;this._layoutParameterType=ccs.LayoutParameterType.linear},setGravity:function(a){this._linearGravity=a},getGravity:function(){return this._linearGravity},createCloneInstance:function(){return ccs.LinearLayoutParameter.create()},copyProperties:function(a){ccs.LayoutParameter.prototype.copyProperties.call(this,a);this.setGravity(a._linearGravity)}});
ccs.LinearLayoutParameter.create=function(){return new ccs.LinearLayoutParameter};
ccs.RelativeLayoutParameter=ccs.LayoutParameter.extend({_relativeAlign:null,_relativeWidgetName:"",_relativeLayoutName:"",_put:!1,ctor:function(){ccs.LayoutParameter.prototype.ctor.call(this);this._relativeAlign=ccs.RelativeAlign.alignNone;this._relativeLayoutName=this._relativeWidgetName="";this._put=!1;this._layoutParameterType=ccs.LayoutParameterType.relative},setAlign:function(a){this._relativeAlign=a},getAlign:function(){return this._relativeAlign},setRelativeToWidgetName:function(a){this._relativeWidgetName=
a},getRelativeToWidgetName:function(){return this._relativeWidgetName},setRelativeName:function(a){this._relativeLayoutName=a},getRelativeName:function(){return this._relativeLayoutName},createCloneInstance:function(){return ccs.LinearLayoutParameter.create()},copyProperties:function(a){ccs.LayoutParameter.prototype.copyProperties.call(this,a);this.setAlign(a._relativeAlign);this.setRelativeToWidgetName(a._relativeWidgetName);this.setRelativeName(a._relativeLayoutName)}});
ccs.RelativeLayoutParameter.create=function(){return new ccs.RelativeLayoutParameter};ccs.LinearGravity={none:0,left:1,top:2,right:3,bottom:4,centerVertical:5,centerHorizontal:6};
ccs.RelativeAlign={alignNone:0,alignParentTopLeft:1,alignParentTopCenterHorizontal:2,alignParentTopRight:3,alignParentLeftCenterVertical:4,centerInParent:5,alignParentRightCenterVertical:6,alignParentLeftBottom:7,alignParentBottomCenterHorizontal:8,alignParentRightBottom:9,locationAboveLeftAlign:10,locationAboveCenter:11,locationAboveRightAlign:12,locationLeftOfTopAlign:13,locationLeftOfCenter:14,locationLeftOfBottomAlign:15,locationRightOfTopAlign:16,locationRightOfCenter:17,locationRightOfBottomAlign:18,
locationBelowLeftAlign:19,locationBelowCenter:20,locationBelowRightAlign:21};ccs.Margin=ccs.Class.extend({left:0,top:0,right:0,bottom:0,ctor:function(a,c,d,e){a&&void 0===c&&(this.left=a.left,this.top=a.top,this.right=a.right,this.bottom=a.bottom);void 0!==e&&(this.left=a,this.top=c,this.right=d,this.bottom=e)},setMargin:function(a,c,d,e){this.left=a;this.top=c;this.right=d;this.bottom=e},equals:function(a){return this.left==a.left&&this.top==a.top&&this.right==a.right&&this.bottom==a.bottom}});
ccs.MarginZero=function(){return new ccs.Margin(0,0,0,0)};ccs.CocosGUIVersion=function(){return"CocosGUI v1.0.0.0"};ccs.UIHelper=ccs.UIHelper||ccs.Class.extend({});ccs.UIHelper.seekWidgetByTag=function(a,c){if(!a)return null;if(a.getTag()==c)return a;for(var d=a.getChildren(),e=d.length,f=0;f<e;f++){var g=this.seekWidgetByTag(d[f],c);if(null!=g)return g}return null};ccs.UIHelper.seekWidgetByName=function(a,c){if(!a)return null;if(a.getName()==c)return a;for(var d=a.getChildren(),e=d.length,f=0;f<e;f++){var g=this.seekWidgetByName(d[f],c);if(null!=g)return g}return null};
ccs.UIHelper.seekWidgetByRelativeName=function(a,c){if(!a)return null;for(var d=a.getChildren(),e=d.length,f=0;f<e;f++){var g=d[f],h=g.getLayoutParameter(ccs.LayoutParameterType.relative);if(h&&h.getRelativeName()==c)return g}return null};ccs.UIHelper.seekActionWidgetByActionTag=function(a,c){if(!a)return null;if(a.getActionTag()==c)return a;for(var d=a.getChildren(),e=0;e<d.length;e++){var f=this.seekActionWidgetByActionTag(d[e],c);if(null!=f)return f}return null};ccs.UILayer=cc.Layer.extend({_rootWidget:null,_selectedWidgets:null,_touchBeganedPoint:null,_touchMovedPoint:null,_touchEndedPoint:null,_touchCanceledPoint:null,ctor:function(){cc.Layer.prototype.ctor.call(this);this._selectedWidgets=[];this._touchBeganedPoint=cc.p(0,0);this._touchMovedPoint=cc.p(0,0);this._touchEndedPoint=cc.p(0,0);this._touchCanceledPoint=cc.p(0,0)},init:function(){return cc.Layer.prototype.init.call(this)?(this._rootWidget=ccs.Widget.create(),this.addChild(this._rootWidget),!0):
!1},onEnter:function(){this.setTouchMode(cc.TOUCH_ONE_BY_ONE);this.setTouchEnabled(!0);cc.Layer.prototype.onEnter.call(this)},onExit:function(){this.setTouchEnabled(!1);cc.Layer.prototype.onExit.call(this)},checkTouchEvent:function(a,c,d){for(var e=a.getChildren(),f=e.length-1;0<=f;f--)if(this.checkTouchEvent(e[f],c,d))return!0;c=a.onTouchBegan(c,d);return a._hitted?(this._selectedWidgets.push(a),!0):c},checkEventWidget:function(a,c){this.checkTouchEvent(this._rootWidget,a,c);return 0<this._selectedWidgets.length},
addWidget:function(a){this._rootWidget.addChild(a)},removeWidget:function(a){this._rootWidget.removeChild(a)},getWidgetByTag:function(a){return this._rootWidget?ccs.UIHelper.seekWidgetByTag(this._rootWidget,a):null},getWidgetByName:function(a){return this._rootWidget?ccs.UIHelper.seekWidgetByName(this._rootWidget,a):null},getRootWidget:function(){return this._rootWidget},getInputManager:function(){return this._inputManager},clear:function(){this._rootWidget.removeAllChildren()},onTouchBegan:function(a,
c){return this.checkEventWidget(a,c)},onTouchMoved:function(a,c){for(var d=this._selectedWidgets,e=0;e<d.length;++e)d[e].onTouchMoved(a,c)},onTouchEnded:function(a,c){for(var d=this._selectedWidgets,e=0;e<d.length;++e)d[e].onTouchEnded(a,c);this._selectedWidgets=[]},onTouchCancelled:function(a,c){for(var d=this._selectedWidgets,e=0;e<d.length;++e)d[e].onTouchCancelled(a,c);this._selectedWidgets=[]}});ccs.UILayer.create=function(){var a=new ccs.UILayer;return a&&a.init()?a:null};var NORMAL_RENDERER_ZORDER=-2,PRESSED_RENDERER_ZORDER=-2,DISABLED_RENDERER_ZORDER=-2,TITLE_RENDERER_ZORDER=-1;
ccs.Button=ccs.Widget.extend({_buttonNormalRenderer:null,_buttonClickedRenderer:null,_buttonDisableRenderer:null,_titleRenderer:null,_normalFileName:"",_clickedFileName:"",_disabledFileName:"",_prevIgnoreSize:!0,_scale9Enabled:!1,_capInsetsNormal:null,_capInsetsPressed:null,_capInsetsDisabled:null,_normalTexType:null,_pressedTexType:null,_disabledTexType:null,_normalTextureSize:null,_pressedTextureSize:null,_disabledTextureSize:null,_pressedActionEnabled:!1,_titleColor:null,_normalTextureScaleXInSize:1,
_normalTextureScaleYInSize:1,_pressedTextureScaleXInSize:1,_pressedTextureScaleYInSize:1,_normalTextureLoaded:!1,_pressedTextureLoaded:!1,_disabledTextureLoaded:!1,ctor:function(){ccs.Widget.prototype.ctor.call(this);this._titleRenderer=this._buttonDisableRenderer=this._buttonClickedRenderer=this._buttonNormalRenderer=null;this._disabledFileName=this._clickedFileName=this._normalFileName="";this._prevIgnoreSize=!0;this._scale9Enabled=!1;this._capInsetsNormal=cc.RectZero();this._capInsetsPressed=cc.RectZero();
this._capInsetsDisabled=cc.RectZero();this._disabledTexType=this._pressedTexType=this._normalTexType=ccs.TextureResType.local;var a=this._size;this._normalTextureSize=cc.size(a.width,a.height);this._pressedTextureSize=cc.size(a.width,a.height);this._disabledTextureSize=cc.size(a.width,a.height);this._pressedActionEnabled=!1;this._titleColor=cc.white();this._pressedTextureScaleYInSize=this._pressedTextureScaleXInSize=this._normalTextureScaleYInSize=this._normalTextureScaleXInSize=1;this._disabledTextureLoaded=
this._pressedTextureLoaded=this._normalTextureLoaded=!1},init:function(){return ccs.Widget.prototype.init.call(this)?(this.setTouchEnabled(!0),!0):!1},initRenderer:function(){this._buttonNormalRenderer=cc.Sprite.create();this._buttonClickedRenderer=cc.Sprite.create();this._buttonDisableRenderer=cc.Sprite.create();this._titleRenderer=cc.LabelTTF.create("");cc.Node.prototype.addChild.call(this,this._buttonNormalRenderer,NORMAL_RENDERER_ZORDER);cc.Node.prototype.addChild.call(this,this._buttonClickedRenderer,
PRESSED_RENDERER_ZORDER);cc.Node.prototype.addChild.call(this,this._buttonDisableRenderer,DISABLED_RENDERER_ZORDER);cc.Node.prototype.addChild.call(this,this._titleRenderer,TITLE_RENDERER_ZORDER)},setScale9Enabled:function(a){this._scale9Enabled!=a&&(this._brightStyle=ccs.BrightStyle.none,this._scale9Enabled=a,cc.Node.prototype.removeChild.call(this,this._buttonNormalRenderer,!0),cc.Node.prototype.removeChild.call(this,this._buttonClickedRenderer,!0),cc.Node.prototype.removeChild.call(this,this._buttonDisableRenderer,
!0),this._scale9Enabled?(this._buttonNormalRenderer=cc.Scale9Sprite.create(),this._buttonClickedRenderer=cc.Scale9Sprite.create(),this._buttonDisableRenderer=cc.Scale9Sprite.create()):(this._buttonNormalRenderer=cc.Sprite.create(),this._buttonClickedRenderer=cc.Sprite.create(),this._buttonDisableRenderer=cc.Sprite.create()),this.loadTextureNormal(this._normalFileName,this._normalTexType),this.loadTexturePressed(this._clickedFileName,this._pressedTexType),this.loadTextureDisabled(this._disabledFileName,
this._disabledTexType),cc.Node.prototype.addChild.call(this,this._buttonNormalRenderer,NORMAL_RENDERER_ZORDER),cc.Node.prototype.addChild.call(this,this._buttonClickedRenderer,PRESSED_RENDERER_ZORDER),cc.Node.prototype.addChild.call(this,this._buttonDisableRenderer,DISABLED_RENDERER_ZORDER),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsetsNormalRenderer(this._capInsetsNormal),
this.setCapInsetsPressedRenderer(this._capInsetsPressed),this.setCapInsetsDisabledRenderer(this._capInsetsDisabled),this.setBright(this._bright))},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccs.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},loadTextures:function(a,c,d,e){this.loadTextureNormal(a,e);this.loadTexturePressed(c,e);this.loadTextureDisabled(d,e)},loadTextureNormal:function(a,
c){if(a){c=c||ccs.TextureResType.local;this._normalFileName=a;this._normalTexType=c;var d=this._buttonNormalRenderer;switch(this._normalTexType){case ccs.TextureResType.local:d.initWithFile(a);break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}var e=d.getContentSize();d.textureLoaded()?(this._normalTextureSize.width=e.width,this._normalTextureSize.height=e.height):(d.addLoadedEventListener(function(){this._normalTextureSize=d.getContentSize();d.setCapInsets&&d.setCapInsets(this._capInsetsNormal);
this.normalTextureScaleChangedWithSize()},this),this._normalTextureSize.width=this._customSize.width,this._normalTextureSize.height=this._customSize.height);this._scale9Enabled&&d.setCapInsets(this._capInsetsNormal);this.updateRGBAToRenderer(d);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();this.normalTextureScaleChangedWithSize();this._normalTextureLoaded=!0}},loadTexturePressed:function(a,c){if(a){c=c||ccs.TextureResType.local;this._clickedFileName=a;this._pressedTexType=c;
var d=this._buttonClickedRenderer;switch(this._pressedTexType){case ccs.TextureResType.local:d.initWithFile(a);break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}d.textureLoaded()?this._pressedTextureSize=d.getContentSize():(d.addLoadedEventListener(function(){this._pressedTextureSize=d.getContentSize();d.setCapInsets&&d.setCapInsets(this._capInsetsNormal);this.pressedTextureScaleChangedWithSize()},this),this._pressedTextureSize.width=this._customSize.width,this._pressedTextureSize.height=
this._customSize.height);this._scale9Enabled&&d.setCapInsets(this._capInsetsNormal);this.updateRGBAToRenderer(d);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();this.pressedTextureScaleChangedWithSize();this._pressedTextureLoaded=!0}},loadTextureDisabled:function(a,c){if(a){c=c||ccs.TextureResType.local;this._disabledFileName=a;this._disabledTexType=c;var d=this._buttonDisableRenderer;switch(this._disabledTexType){case ccs.TextureResType.local:d.initWithFile(a);break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}d.textureLoaded()?
this._disabledTextureSize=d.getContentSize():(d.addLoadedEventListener(function(){this._disabledTextureSize=d.getContentSize();d.setCapInsets&&d.setCapInsets(this._capInsetsNormal);this.disabledTextureScaleChangedWithSize()},this),this._disabledTextureSize.width=this._customSize.width,this._disabledTextureSize.height=this._customSize.height);this._scale9Enabled&&d.setCapInsets(this._capInsetsNormal);this.updateRGBAToRenderer(d);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();
this.disabledTextureScaleChangedWithSize();this._disabledTextureLoaded=!0}},setCapInsets:function(a){this.setCapInsetsNormalRenderer(a);this.setCapInsetsPressedRenderer(a);this.setCapInsetsDisabledRenderer(a)},setCapInsetsNormalRenderer:function(a){this._capInsetsNormal=a;this._scale9Enabled&&this._buttonNormalRenderer.setCapInsets(a)},getCapInsetNormalRenderer:function(){return this._capInsetsNormal},setCapInsetsPressedRenderer:function(a){this._capInsetsPressed=a;this._scale9Enabled&&this._buttonClickedRenderer.setCapInsets(a)},
getCapInsetPressedRenderer:function(){return this._capInsetsPressed},setCapInsetsDisabledRenderer:function(a){this._capInsetsDisabled=a;this._scale9Enabled&&this._buttonDisableRenderer.setCapInsets(a)},getCapInsetDisabledRenderer:function(){return this._capInsetsDisabled},onPressStateChangedToNormal:function(){this._buttonNormalRenderer.setVisible(!0);this._buttonClickedRenderer.setVisible(!1);this._buttonDisableRenderer.setVisible(!1);if(this._pressedTextureLoaded){if(this._pressedActionEnabled){this._buttonNormalRenderer.stopAllActions();
this._buttonClickedRenderer.stopAllActions();this._buttonDisableRenderer.stopAllActions();var a=cc.ScaleTo.create(0.05,1),c=cc.ScaleTo.create(0.05,1),d=cc.ScaleTo.create(0.05,1);this._buttonNormalRenderer.runAction(a);this._buttonClickedRenderer.runAction(c);this._buttonDisableRenderer.runAction(d)}}else this._buttonNormalRenderer.stopAllActions(),this._buttonNormalRenderer.setScale(this._normalTextureScaleXInSize,this._normalTextureScaleYInSize)},onPressStateChangedToPressed:function(){if(this._pressedTextureLoaded){if(this._buttonNormalRenderer.setVisible(!1),
this._buttonClickedRenderer.setVisible(!0),this._buttonDisableRenderer.setVisible(!1),this._pressedActionEnabled){this._buttonNormalRenderer.stopAllActions();this._buttonClickedRenderer.stopAllActions();this._buttonDisableRenderer.stopAllActions();var a=cc.ScaleTo.create(0.05,1.1),c=cc.ScaleTo.create(0.05,1.1),d=cc.ScaleTo.create(0.05,1.1);this._buttonNormalRenderer.runAction(a);this._buttonClickedRenderer.runAction(c);this._buttonDisableRenderer.runAction(d)}}else this._buttonNormalRenderer.setVisible(!0),
this._buttonClickedRenderer.setVisible(!0),this._buttonDisableRenderer.setVisible(!1),this._buttonNormalRenderer.stopAllActions(),this._buttonNormalRenderer.setScale(this._normalTextureScaleXInSize+0.1,this._normalTextureScaleYInSize+0.1)},onPressStateChangedToDisabled:function(){this._buttonNormalRenderer.setVisible(!1);this._buttonClickedRenderer.setVisible(!1);this._buttonDisableRenderer.setVisible(!0);this._buttonNormalRenderer.setScale(this._normalTextureScaleXInSize,this._normalTextureScaleYInSize);
this._buttonClickedRenderer.setScale(this._pressedTextureScaleXInSize,this._pressedTextureScaleYInSize)},updateFlippedX:function(){this._titleRenderer.setFlippedX(this._flippedX);this._scale9Enabled?this._flippedX?(this._buttonNormalRenderer.setScaleX(-1),this._buttonClickedRenderer.setScaleX(-1),this._buttonDisableRenderer.setScaleX(-1)):(this._buttonNormalRenderer.setScaleX(1),this._buttonClickedRenderer.setScaleX(1),this._buttonDisableRenderer.setScaleX(1)):(this._buttonNormalRenderer.setFlippedX(this._flippedX),
this._buttonClickedRenderer.setFlippedX(this._flippedX),this._buttonDisableRenderer.setFlippedX(this._flippedX))},updateFlippedY:function(){this._titleRenderer.setFlippedY(this._flippedY);this._scale9Enabled?this._flippedX?(this._buttonNormalRenderer.setScaleY(-1),this._buttonClickedRenderer.setScaleX(-1),this._buttonDisableRenderer.setScaleX(-1)):(this._buttonNormalRenderer.setScaleY(1),this._buttonClickedRenderer.setScaleY(1),this._buttonDisableRenderer.setScaleY(1)):(this._buttonNormalRenderer.setFlippedY(this._flippedY),
this._buttonClickedRenderer.setFlippedY(this._flippedY),this._buttonDisableRenderer.setFlippedY(this._flippedY))},setAnchorPoint:function(a,c){void 0===c?(ccs.Widget.prototype.setAnchorPoint.call(this,a),this._buttonNormalRenderer.setAnchorPoint(a),this._buttonClickedRenderer.setAnchorPoint(a),this._buttonDisableRenderer.setAnchorPoint(a)):(ccs.Widget.prototype.setAnchorPoint.call(this,a,c),this._buttonNormalRenderer.setAnchorPoint(a,c),this._buttonClickedRenderer.setAnchorPoint(a,c),this._buttonDisableRenderer.setAnchorPoint(a,
c));this._titleRenderer.setPosition(this._size.width*(0.5-this._anchorPoint.x),this._size.height*(0.5-this._anchorPoint.y))},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.normalTextureScaleChangedWithSize();this.pressedTextureScaleChangedWithSize();this.disabledTextureScaleChangedWithSize()},getContentSize:function(){return this._normalTextureSize},getVirtualRenderer:function(){if(this._bright)switch(this._brightStyle){case ccs.BrightStyle.normal:return this._buttonNormalRenderer;
case ccs.BrightStyle.highlight:return this._buttonClickedRenderer;default:return null}else return this._buttonDisableRenderer},normalTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._scale9Enabled||(this._buttonNormalRenderer.setScale(1),this._normalTextureScaleXInSize=this._normalTextureScaleYInSize=1,this._size.width=this._normalTextureSize.width,this._size.height=this._normalTextureSize.height);else if(this._scale9Enabled)this._buttonNormalRenderer.setPreferredSize(this._size),this._normalTextureScaleXInSize=
this._normalTextureScaleYInSize=1;else{var a=this._normalTextureSize;if(0>=a.width||0>=a.height)this._buttonNormalRenderer.setScale(1);else{var c=this._size.width/a.width,a=this._size.height/a.height;this._buttonNormalRenderer.setScaleX(c);this._buttonNormalRenderer.setScaleY(a);this._normalTextureScaleXInSize=c;this._normalTextureScaleYInSize=a}}},pressedTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._scale9Enabled||(this._buttonClickedRenderer.setScale(1),this._pressedTextureScaleXInSize=
this._pressedTextureScaleYInSize=1);else if(this._scale9Enabled)this._buttonClickedRenderer.setPreferredSize(this._size),this._pressedTextureScaleXInSize=this._pressedTextureScaleYInSize=1;else{var a=this._pressedTextureSize;if(0>=a.width||0>=a.height)this._buttonClickedRenderer.setScale(1);else{var c=this._size.width/a.width,a=this._size.height/a.height;this._buttonClickedRenderer.setScaleX(c);this._buttonClickedRenderer.setScaleY(a);this._pressedTextureScaleXInSize=c;this._pressedTextureScaleYInSize=
a}}},disabledTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._scale9Enabled||this._buttonDisableRenderer.setScale(1);else if(this._scale9Enabled)this._buttonDisableRenderer.setPreferredSize(this._size);else{var a=this._disabledTextureSize;if(0>=a.width||0>=a.height)this._buttonDisableRenderer.setScale(1);else{var c=this._size.height/a.height;this._buttonDisableRenderer.setScaleX(this._size.width/a.width);this._buttonDisableRenderer.setScaleY(c)}}},setPressedActionEnabled:function(a){this._pressedActionEnabled=
a},setTitleText:function(a){this._titleRenderer.setString(a)},getTitleText:function(){return this._titleRenderer.getString()},setTitleColor:function(a){this._titleColor.r=a.r;this._titleColor.g=a.g;this._titleColor.b=a.b;this._titleRenderer.setColor(a)},getTitleColor:function(){return this._titleRenderer.getColor()},setTitleFontSize:function(a){this._titleRenderer.setFontSize(a)},getTitleFontSize:function(){return this._titleRenderer.getFontSize()},setTitleFontName:function(a){this._titleRenderer.setFontName(a)},
getTitleFontName:function(){return this._titleRenderer.getFontName()},updateTextureColor:function(){this.updateColorToRenderer(this._buttonNormalRenderer);this.updateColorToRenderer(this._buttonClickedRenderer);this.updateColorToRenderer(this._buttonDisableRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._buttonNormalRenderer);this.updateOpacityToRenderer(this._buttonClickedRenderer);this.updateOpacityToRenderer(this._buttonDisableRenderer)},updateTextureRGBA:function(){this.updateRGBAToRenderer(this._buttonNormalRenderer);
this.updateRGBAToRenderer(this._buttonClickedRenderer);this.updateRGBAToRenderer(this._buttonDisableRenderer)},getDescription:function(){return"Button"},createCloneInstance:function(){return ccs.Button.create()},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)}});ccs.Button.create=function(){var a=new ccs.Button;return a&&a.init()?a:null};ccs.CheckBoxEventType={selected:0,unselected:1};ccs.BACKGROUNDBOXRENDERERZ=-1;ccs.BACKGROUNDBOXSELECTEDRENDERERZ=-1;ccs.FRONTCROSSRENDERERZ=-1;ccs.BACKGROUNDBOXDISABLEDRENDERER=-1;ccs.FRONTCROSSDISABLEDRENDERER=-1;
ccs.CheckBox=ccs.Widget.extend({_backGroundBoxRenderer:null,_backGroundSelectedBoxRenderer:null,_frontCrossRenderer:null,_backGroundBoxDisabledRenderer:null,_frontCrossDisabledRenderer:null,_isSelected:!0,_checkBoxEventListener:null,_checkBoxEventSelector:null,_backGroundTexType:null,_backGroundSelectedTexType:null,_frontCrossTexType:null,_backGroundDisabledTexType:null,_frontCrossDisabledTexType:null,_backGroundFileName:"",_backGroundSelectedFileName:"",_frontCrossFileName:"",_backGroundDisabledFileName:"",
_frontCrossDisabledFileName:"",ctor:function(){ccs.Widget.prototype.ctor.call(this);this._frontCrossDisabledRenderer=this._backGroundBoxDisabledRenderer=this._frontCrossRenderer=this._backGroundSelectedBoxRenderer=this._backGroundBoxRenderer=null;this._isSelected=!0;this._checkBoxEventSelector=this._checkBoxEventListener=null;this._frontCrossDisabledTexType=this._backGroundDisabledTexType=this._frontCrossTexType=this._backGroundSelectedTexType=this._backGroundTexType=ccs.TextureResType.local;this._frontCrossDisabledFileName=
this._backGroundDisabledFileName=this._frontCrossFileName=this._backGroundSelectedFileName=this._backGroundFileName=""},init:function(){return ccs.Widget.prototype.init.call(this)?(this.setTouchEnabled(!0),this.setSelectedState(!1),!0):!1},initRenderer:function(){this._backGroundBoxRenderer=cc.Sprite.create();this._backGroundSelectedBoxRenderer=cc.Sprite.create();this._frontCrossRenderer=cc.Sprite.create();this._backGroundBoxDisabledRenderer=cc.Sprite.create();this._frontCrossDisabledRenderer=cc.Sprite.create();
cc.Node.prototype.addChild.call(this,this._backGroundBoxRenderer,ccs.BACKGROUNDBOXRENDERERZ,-1);cc.Node.prototype.addChild.call(this,this._backGroundSelectedBoxRenderer,ccs.BACKGROUNDBOXSELECTEDRENDERERZ,-1);cc.Node.prototype.addChild.call(this,this._frontCrossRenderer,ccs.FRONTCROSSRENDERERZ,-1);cc.Node.prototype.addChild.call(this,this._backGroundBoxDisabledRenderer,ccs.BACKGROUNDBOXDISABLEDRENDERER,-1);cc.Node.prototype.addChild.call(this,this._frontCrossDisabledRenderer,ccs.FRONTCROSSDISABLEDRENDERER,
-1)},loadTextures:function(a,c,d,e,f,g){this.loadTextureBackGround(a,g);this.loadTextureBackGroundSelected(c,g);this.loadTextureFrontCross(d,g);this.loadTextureBackGroundDisabled(e,g);this.loadTextureFrontCrossDisabled(f,g)},loadTextureBackGround:function(a,c){if(a){c=c||ccs.TextureResType.local;this._backGroundFileName=a;this._backGroundTexType=c;var d=this._backGroundBoxRenderer;switch(this._backGroundTexType){case ccs.TextureResType.local:d.initWithFile(a);break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(d);
this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();d.textureLoaded()||(this._backGroundBoxRenderer.setContentSize(this._customSize),d.addLoadedEventListener(function(){this.backGroundTextureScaleChangedWithSize()},this));this.backGroundTextureScaleChangedWithSize()}},loadTextureBackGroundSelected:function(a,c){if(a){c=c||ccs.TextureResType.local;this._backGroundSelectedFileName=a;this._backGroundSelectedTexType=c;switch(this._backGroundSelectedTexType){case ccs.TextureResType.local:this._backGroundSelectedBoxRenderer.initWithFile(a);
break;case ccs.TextureResType.plist:this._backGroundSelectedBoxRenderer.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(this._backGroundSelectedBoxRenderer);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();this.backGroundSelectedTextureScaleChangedWithSize()}},loadTextureFrontCross:function(a,c){if(a){c=c||ccs.TextureResType.local;this._frontCrossFileName=a;this._frontCrossTexType=c;switch(this._frontCrossTexType){case ccs.TextureResType.local:this._frontCrossRenderer.initWithFile(a);
break;case ccs.TextureResType.plist:this._frontCrossRenderer.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(this._frontCrossRenderer);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();this.frontCrossTextureScaleChangedWithSize()}},loadTextureBackGroundDisabled:function(a,c){if(a){c=c||ccs.TextureResType.local;this._backGroundDisabledFileName=a;this._backGroundDisabledTexType=c;switch(this._backGroundDisabledTexType){case ccs.TextureResType.local:this._backGroundBoxDisabledRenderer.initWithFile(a);
break;case ccs.TextureResType.plist:this._backGroundBoxDisabledRenderer.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(this._backGroundBoxDisabledRenderer);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();this.backGroundDisabledTextureScaleChangedWithSize()}},loadTextureFrontCrossDisabled:function(a,c){if(a){c=c||ccs.TextureResType.local;this._frontCrossDisabledFileName=a;this._frontCrossDisabledTexType=c;switch(this._frontCrossDisabledTexType){case ccs.TextureResType.local:this._frontCrossDisabledRenderer.initWithFile(a);
break;case ccs.TextureResType.plist:this._frontCrossDisabledRenderer.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(this._frontCrossDisabledRenderer);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();this.frontCrossDisabledTextureScaleChangedWithSize()}},onTouchEnded:function(a,c){var d=a.getLocation();this._touchEndPos.x=d.x;this._touchEndPos.y=d.y;this._focus&&(this.releaseUpEvent(),this._isSelected?(this.setSelectedState(!1),this.unSelectedEvent()):(this.setSelectedState(!0),
this.selectedEvent()));this.setFocused(!1);var e=this.getWidgetParent();e&&e.checkChildInfo(2,this,d)},onPressStateChangedToNormal:function(){this._backGroundBoxRenderer.setVisible(!0);this._backGroundSelectedBoxRenderer.setVisible(!1);this._backGroundBoxDisabledRenderer.setVisible(!1);this._frontCrossDisabledRenderer.setVisible(!1)},onPressStateChangedToPressed:function(){this._backGroundBoxRenderer.setVisible(!1);this._backGroundSelectedBoxRenderer.setVisible(!0);this._backGroundBoxDisabledRenderer.setVisible(!1);
this._frontCrossDisabledRenderer.setVisible(!1)},onPressStateChangedToDisabled:function(){this._backGroundBoxRenderer.setVisible(!1);this._backGroundSelectedBoxRenderer.setVisible(!1);this._backGroundBoxDisabledRenderer.setVisible(!0);this._frontCrossRenderer.setVisible(!1);this._isSelected&&this._frontCrossDisabledRenderer.setVisible(!0)},setSelectedState:function(a){a!=this._isSelected&&(this._isSelected=a,this._frontCrossRenderer.setVisible(this._isSelected))},getSelectedState:function(){return this._isSelected},
selectedEvent:function(){this._checkBoxEventListener&&this._checkBoxEventSelector&&this._checkBoxEventSelector.call(this._checkBoxEventListener,this,ccs.CheckBoxEventType.selected)},unSelectedEvent:function(){this._checkBoxEventListener&&this._checkBoxEventSelector&&this._checkBoxEventSelector.call(this._checkBoxEventListener,this,ccs.CheckBoxEventType.unselected)},addEventListenerCheckBox:function(a,c){this._checkBoxEventSelector=a;this._checkBoxEventListener=c},updateFlippedX:function(){this._backGroundBoxRenderer.setFlippedX(this._flippedX);
this._backGroundSelectedBoxRenderer.setFlippedX(this._flippedX);this._frontCrossRenderer.setFlippedX(this._flippedX);this._backGroundBoxDisabledRenderer.setFlippedX(this._flippedX);this._frontCrossDisabledRenderer.setFlippedX(this._flippedX)},updateFlippedY:function(){this._backGroundBoxRenderer.setFlippedY(this._flippedY);this._backGroundSelectedBoxRenderer.setFlippedY(this._flippedY);this._frontCrossRenderer.setFlippedY(this._flippedY);this._backGroundBoxDisabledRenderer.setFlippedY(this._flippedY);
this._frontCrossDisabledRenderer.setFlippedY(this._flippedY)},setAnchorPoint:function(a,c){void 0===c?(ccs.Widget.prototype.setAnchorPoint.call(this,a),this._backGroundBoxRenderer.setAnchorPoint(a),this._backGroundSelectedBoxRenderer.setAnchorPoint(a),this._backGroundBoxDisabledRenderer.setAnchorPoint(a),this._frontCrossRenderer.setAnchorPoint(a),this._frontCrossDisabledRenderer.setAnchorPoint(a)):(ccs.Widget.prototype.setAnchorPoint.call(this,a,c),this._backGroundBoxRenderer.setAnchorPoint(a,c),
this._backGroundSelectedBoxRenderer.setAnchorPoint(a,c),this._backGroundBoxDisabledRenderer.setAnchorPoint(a,c),this._frontCrossRenderer.setAnchorPoint(a,c),this._frontCrossDisabledRenderer.setAnchorPoint(a,c))},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.backGroundTextureScaleChangedWithSize();this.backGroundSelectedTextureScaleChangedWithSize();this.frontCrossTextureScaleChangedWithSize();this.backGroundDisabledTextureScaleChangedWithSize();this.frontCrossDisabledTextureScaleChangedWithSize()},
getContentSize:function(){return this._backGroundBoxRenderer.getContentSize()},getVirtualRenderer:function(){return this._backGroundBoxRenderer},backGroundTextureScaleChangedWithSize:function(){if(this._ignoreSize){this._backGroundBoxRenderer.setScale(1);var a=this._backGroundBoxRenderer.getContentSize();this._size.width=a.width;this._size.height=a.height}else if(a=this._backGroundBoxRenderer.getContentSize(),0>=a.width||0>=a.height)this._backGroundBoxRenderer.setScale(1);else{var c=this._size.height/
a.height;this._backGroundBoxRenderer.setScaleX(this._size.width/a.width);this._backGroundBoxRenderer.setScaleY(c)}},backGroundSelectedTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._backGroundSelectedBoxRenderer.setScale(1);else{var a=this._backGroundSelectedBoxRenderer.getContentSize();if(0>=a.width||0>=a.height)this._backGroundSelectedBoxRenderer.setScale(1);else{var c=this._size.height/a.height;this._backGroundSelectedBoxRenderer.setScaleX(this._size.width/a.width);this._backGroundSelectedBoxRenderer.setScaleY(c)}}},
frontCrossTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._frontCrossRenderer.setScale(1);else{var a=this._frontCrossRenderer.getContentSize();if(0>=a.width||0>=a.height)this._frontCrossRenderer.setScale(1);else{var c=this._size.height/a.height;this._frontCrossRenderer.setScaleX(this._size.width/a.width);this._frontCrossRenderer.setScaleY(c)}}},backGroundDisabledTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._backGroundBoxDisabledRenderer.setScale(1);else{var a=this._backGroundBoxDisabledRenderer.getContentSize();
if(0>=a.width||0>=a.height)this._backGroundBoxDisabledRenderer.setScale(1);else{var c=this._size.height/a.height;this._backGroundBoxDisabledRenderer.setScaleX(this._size.width/a.width);this._backGroundBoxDisabledRenderer.setScaleY(c)}}},frontCrossDisabledTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._frontCrossDisabledRenderer.setScale(1);else{var a=this._frontCrossDisabledRenderer.getContentSize();if(0>=a.width||0>=a.height)this._frontCrossDisabledRenderer.setScale(1);else{var c=
this._size.height/a.height;this._frontCrossDisabledRenderer.setScaleX(this._size.width/a.width);this._frontCrossDisabledRenderer.setScaleY(c)}}},updateTextureColor:function(){this.updateColorToRenderer(this._backGroundBoxRenderer);this.updateColorToRenderer(this._backGroundSelectedBoxRenderer);this.updateColorToRenderer(this._frontCrossRenderer);this.updateColorToRenderer(this._backGroundBoxDisabledRenderer);this.updateColorToRenderer(this._frontCrossDisabledRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._backGroundBoxRenderer);
this.updateOpacityToRenderer(this._backGroundSelectedBoxRenderer);this.updateOpacityToRenderer(this._frontCrossRenderer);this.updateOpacityToRenderer(this._backGroundBoxDisabledRenderer);this.updateOpacityToRenderer(this._frontCrossDisabledRenderer)},updateTextureRGBA:function(){this.updateRGBAToRenderer(this._backGroundBoxRenderer);this.updateRGBAToRenderer(this._backGroundSelectedBoxRenderer);this.updateRGBAToRenderer(this._frontCrossRenderer);this.updateRGBAToRenderer(this._backGroundBoxDisabledRenderer);
this.updateRGBAToRenderer(this._frontCrossDisabledRenderer)},getDescription:function(){return"CheckBox"},createCloneInstance:function(){return ccs.CheckBox.create()},copySpecialProperties:function(a){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.setSelectedState(a._isSelected)}});ccs.CheckBox.create=function(){var a=new ccs.CheckBox;return a&&a.init()?a:null};ccs.IMAGERENDERERZ=-1;
ccs.ImageView=ccs.Widget.extend({_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_imageRenderer:null,_textureFile:"",_imageTexType:null,_imageTextureSize:null,ctor:function(){ccs.Widget.prototype.ctor.call(this);this._scale9Enabled=!1;this._prevIgnoreSize=!0;this._capInsets=cc.rect(0,0,0,0);this._imageRenderer=null;this._textureFile="";this._imageTexType=ccs.TextureResType.local;this._imageTextureSize=cc.size(this._size.width,this._size.height)},initRenderer:function(){this._imageRenderer=cc.Sprite.create();
cc.Node.prototype.addChild.call(this,this._imageRenderer,ccs.IMAGERENDERERZ,-1)},loadTexture:function(a,c){if(a){c=c||ccs.TextureResType.local;this._textureFile=a;this._imageTexType=c;var d=this._imageRenderer;switch(this._imageTexType){case ccs.TextureResType.local:d.initWithFile(a);break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}var e=d.getContentSize();d.textureLoaded()?(this._imageTextureSize.width=e.width,this._imageTextureSize.height=e.height):(d.addLoadedEventListener(function(){var a=
d.getContentSize();this._imageTextureSize.width=a.width;this._imageTextureSize.height=a.height;d.setCapInsets&&d.setCapInsets(this._capInsets);this.imageTextureScaleChangedWithSize()},this),this._imageTextureSize.width=this._customSize.width,this._imageTextureSize.height=this._customSize.height);this._scale9Enabled&&d.setCapInsets(this._capInsets);this.updateRGBAToRenderer(d);this.updateAnchorPoint();this.updateFlippedX();this.updateFlippedY();this.imageTextureScaleChangedWithSize()}},setTextureRect:function(a){this._scale9Enabled||
(this._imageRenderer.setTextureRect(a),a=this._imageRenderer.getContentSize(),this._imageTextureSize.width=a.width,this._imageTextureSize.height=a.height,this.imageTextureScaleChangedWithSize())},updateFlippedX:function(){this._scale9Enabled?this._imageRenderer.setScaleX(this._flippedX?-1:1):this._imageRenderer.setFlippedX(this._flippedX)},updateFlippedY:function(){this._scale9Enabled?this._imageRenderer.setScaleY(this._flippedY?-1:1):this._imageRenderer.setFlippedY(this._flippedY)},setScale9Enabled:function(a){this._scale9Enabled!=
a&&(this._scale9Enabled=a,cc.Node.prototype.removeChild.call(this,this._imageRenderer,!0),this._imageRenderer=null,this._imageRenderer=this._scale9Enabled?cc.Scale9Sprite.create():cc.Sprite.create(),this.loadTexture(this._textureFile,this._imageTexType),cc.Node.prototype.addChild.call(this,this._imageRenderer,ccs.IMAGERENDERERZ,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets))},
isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccs.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},setCapInsets:function(a){this._capInsets=a;this._scale9Enabled&&this._imageRenderer.setCapInsets(a)},getCapInsets:function(){return this._capInsets},setAnchorPoint:function(a,c){void 0===c?(ccs.Widget.prototype.setAnchorPoint.call(this,a),this._imageRenderer.setAnchorPoint(a)):
(ccs.Widget.prototype.setAnchorPoint.call(this,a,c),this._imageRenderer.setAnchorPoint(a,c))},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.imageTextureScaleChangedWithSize()},getContentSize:function(){return this._imageTextureSize},getVirtualRenderer:function(){return this._imageRenderer},imageTextureScaleChangedWithSize:function(){if(this._ignoreSize)this._scale9Enabled||(this._imageRenderer.setScale(1),this._size=this._imageTextureSize);else if(this._scale9Enabled)this._imageRenderer.setPreferredSize(this._size);
else{var a=this._imageRenderer.getContentSize();if(0>=a.width||0>=a.height)this._imageRenderer.setScale(1);else{var c=this._size.height/a.height;this._imageRenderer.setScaleX(this._size.width/a.width);this._imageRenderer.setScaleY(c)}}},updateTextureColor:function(){this.updateColorToRenderer(this._imageRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._imageRenderer)},updateTextureRGBA:function(){this.updateRGBAToRenderer(this._imageRenderer)},getDescription:function(){return"ImageView"},
createCloneInstance:function(){return ccs.ImageView.create()},copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this.setScale9Enabled(a._scale9Enabled);this.loadTexture(a._textureFile,a._imageTexType);this.setCapInsets(a._capInsets)}});ccs.ImageView.create=function(){var a=new ccs.ImageView;return a&&a.init()?a:null};ccs.LABELRENDERERZ=-1;
ccs.Label=ccs.Widget.extend({_touchScaleChangeEnabled:!1,_normalScaleValueX:0,_normalScaleValueY:0,_fontName:"",_fontSize:0,_onSelectedScaleOffset:0,_labelRenderer:"",_textAreaSize:null,_textVerticalAlignment:0,_textHorizontalAlignment:0,ctor:function(){ccs.Widget.prototype.ctor.call(this);this._touchScaleChangeEnabled=!1;this._normalScaleValueY=this._normalScaleValueX=0;this._fontName="Thonburi";this._fontSize=10;this._onSelectedScaleOffset=0.5;this._labelRenderer="";this._textAreaSize=cc.size(0,
0);this._textHorizontalAlignment=this._textVerticalAlignment=0},init:function(){return ccs.Widget.prototype.init.call(this)?!0:!1},initRenderer:function(){this._labelRenderer=cc.LabelTTF.create();cc.Node.prototype.addChild.call(this,this._labelRenderer,ccs.LABELRENDERERZ,-1)},setText:function(a){this._labelRenderer.setString(a);this.labelScaleChangedWithSize()},getStringValue:function(){return this._labelRenderer.getString()},getStringLength:function(){return this._labelRenderer.getString().length},
setFontSize:function(a){this._fontSize=a;this._labelRenderer.setFontSize(a);this.labelScaleChangedWithSize()},getFontSize:function(){return this._fontSize},setFontName:function(a){this._fontName=a;this._labelRenderer.setFontName(a);this.labelScaleChangedWithSize()},getFontName:function(){return this._fontName},setTextAreaSize:function(a){this._textAreaSize.width=a.width;this._textAreaSize.height=a.height;this._labelRenderer.setDimensions(a);this.labelScaleChangedWithSize()},getTextAreaSize:function(){return this._labelRenderer.getDimensions()},
setTextHorizontalAlignment:function(a){this._textHorizontalAlignment=a;this._labelRenderer.setHorizontalAlignment(a);this.labelScaleChangedWithSize()},getTextHorizontalAlignment:function(){return this._labelRenderer.getHorizontalAlignment()},setTextVerticalAlignment:function(a){this._textVerticalAlignment=a;this._labelRenderer.setVerticalAlignment(a);this.labelScaleChangedWithSize()},getTextVerticalAlignment:function(){return this._labelRenderer.getVerticalAlignment()},getTouchScaleChangeAble:function(){return this.isTouchScaleChangeEnabled()},
setTouchScaleChangeEnabled:function(a){this._touchScaleChangeEnabled=a},isTouchScaleChangeEnabled:function(){return this._touchScaleChangeEnabled},onPressStateChangedToNormal:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX),this._labelRenderer.setScaleY(this._normalScaleValueY))},onPressStateChangedToPressed:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX+this._onSelectedScaleOffset),this._labelRenderer.setScaleY(this._normalScaleValueY+
this._onSelectedScaleOffset))},onPressStateChangedToDisabled:function(){},updateFlippedX:function(){this._labelRenderer.setFlippedX(this._flippedX)},updateFlippedY:function(){this._labelRenderer.setFlippedY(this._flippedY)},setAnchorPoint:function(a,c){void 0===c?(ccs.Widget.prototype.setAnchorPoint.call(this,a),this._labelRenderer.setAnchorPoint(a)):(ccs.Widget.prototype.setAnchorPoint.call(this,a,c),this._labelRenderer.setAnchorPoint(a,c))},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);
this.labelScaleChangedWithSize()},getContentSize:function(){return this._labelRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelRenderer},labelScaleChangedWithSize:function(){if(this._ignoreSize){this._labelRenderer.setScale(1);var a=this._labelRenderer.getContentSize();this._size.width=a.width;this._size.height=a.height;this._normalScaleValueX=this._normalScaleValueY=1}else{var c=this._labelRenderer.getContentSize();0>=c.width||0>=c.height?this._labelRenderer.setScale(1):
(a=this._size.width/c.width,c=this._size.height/c.height,this._labelRenderer.setScaleX(a),this._labelRenderer.setScaleY(c),this._normalScaleValueX=a,this._normalScaleValueY=c)}},updateTextureColor:function(){this.updateColorToRenderer(this._labelRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._labelRenderer)},updateTextureRGBA:function(){this.updateRGBAToRenderer(this._labelRenderer)},getDescription:function(){return"Label"},createCloneInstance:function(){return ccs.Label.create()},
copySpecialProperties:function(a){this.setFontName(a._fontName);this.setFontSize(a._labelRenderer.getFontSize());this.setText(a.getStringValue());this.setTouchScaleChangeEnabled(a._touchScaleChangeEnabled);this.setTextAreaSize(a._size);this.setTextHorizontalAlignment(a._textHorizontalAlignment);this.setTextVerticalAlignment(a._textVerticalAlignment)}});ccs.Label.create=function(){var a=new ccs.Label;return a&&a.init()?a:null};ccs.LABELATLASRENDERERZ=-1;ccs.UICCLabelAtlas=cc.LabelAtlas.extend({setProperty:function(a,c,d,e,f){this.initWithString(a,c,d,e,f)},draw:function(){this._textureAtlas&&cc.AtlasNode.prototype.draw.call(this)},updateDisplayedOpacity:function(a){cc.AtlasNode.prototype.updateDisplayedOpacity.call(this,a)}});ccs.UICCLabelAtlas.create=function(){var a=new ccs.UICCLabelAtlas;return a&&a.init()?a:null};
ccs.LabelAtlas=ccs.Widget.extend({_labelAtlasRenderer:null,_stringValue:"",_charMapFileName:"",_itemWidth:0,_itemHeight:0,_startCharMap:"",ctor:function(){ccs.Widget.prototype.ctor.call(this);this._labelAtlasRenderer=null},initRenderer:function(){this._labelAtlasRenderer=ccs.UICCLabelAtlas.create();cc.Node.prototype.addChild.call(this,this._labelAtlasRenderer,ccs.LABELATLASRENDERERZ,-1)},setProperty:function(a,c,d,e,f){this._stringValue=a;this._charMapFileName=c;this._itemWidth=d;this._itemHeight=
e;this._startCharMap=f;var g=this._labelAtlasRenderer;g.setProperty(a,c,d,e,f[0]);this.updateAnchorPoint();this.labelAtlasScaleChangedWithSize();g.textureLoaded()||g.addLoadedEventListener(function(){this.labelAtlasScaleChangedWithSize()},this)},setStringValue:function(a){this._stringValue=a;this._labelAtlasRenderer.setString(a);this.labelAtlasScaleChangedWithSize()},getStringValue:function(){return this._labelAtlasRenderer.getString()},setAnchorPoint:function(a,c){void 0===c?(ccs.Widget.prototype.setAnchorPoint.call(this,
a),this._labelAtlasRenderer.setAnchorPoint(a)):(ccs.Widget.prototype.setAnchorPoint.call(this,a,c),this._labelAtlasRenderer.setAnchorPoint(a,c))},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.labelAtlasScaleChangedWithSize()},getContentSize:function(){return this._labelAtlasRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelAtlasRenderer},labelAtlasScaleChangedWithSize:function(){if(this._ignoreSize){this._labelAtlasRenderer.setScale(1);var a=
this._labelAtlasRenderer.getContentSize();this._size.width=a.width;this._size.height=a.height}else if(a=this._labelAtlasRenderer.getContentSize(),0>=a.width||0>=a.height)this._labelAtlasRenderer.setScale(1);else{var c=this._size.height/a.height;this._labelAtlasRenderer.setScaleX(this._size.width/a.width);this._labelAtlasRenderer.setScaleY(c)}},updateTextureColor:function(){this.updateColorToRenderer(this._labelAtlasRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._labelAtlasRenderer)},
updateTextureRGBA:function(){this.updateRGBAToRenderer(this._labelAtlasRenderer)},getDescription:function(){return"LabelAtlas"},createCloneInstance:function(){return ccs.LabelAtlas.create()},copySpecialProperties:function(a){this.setProperty(a._stringValue,a._charMapFileName,a._itemWidth,a._itemHeight,a._startCharMap)}});ccs.LabelAtlas.create=function(){var a=new ccs.LabelAtlas;return a&&a.init()?a:null};ccs.LABELBMFONTRENDERERZ=-1;
ccs.LabelBMFont=ccs.Widget.extend({_labelBMFontRenderer:null,_fileHasInit:!1,_fntFileName:"",_stringValue:"",ctor:function(){ccs.Widget.prototype.ctor.call(this);this._labelBMFontRenderer=null;this._fileHasInit=!1},initRenderer:function(){this._labelBMFontRenderer=cc.LabelBMFont.create();cc.Node.prototype.addChild.call(this,this._labelBMFontRenderer,ccs.LABELBMFONTRENDERERZ,-1)},setFntFile:function(a){a&&(this._fntFileName=a,this._labelBMFontRenderer.initWithString("",a),this.updateAnchorPoint(),
this.labelBMFontScaleChangedWithSize(),this._fileHasInit=!0,this.setText(this._stringValue),this._labelBMFontRenderer.textureLoaded()||this._labelBMFontRenderer.addLoadedEventListener(function(){this.labelBMFontScaleChangedWithSize()},this))},setText:function(a){a&&(this._stringValue=a,this._labelBMFontRenderer.setString(a),this.labelBMFontScaleChangedWithSize())},getStringValue:function(){return this._stringValue},setAnchorPoint:function(a,c){void 0===c?(ccs.Widget.prototype.setAnchorPoint.call(this,
a),this._labelBMFontRenderer.setAnchorPoint(a)):(ccs.Widget.prototype.setAnchorPoint.call(this,a,c),this._labelBMFontRenderer.setAnchorPoint(a,c))},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.labelBMFontScaleChangedWithSize()},getContentSize:function(){return this._labelBMFontRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelBMFontRenderer},labelBMFontScaleChangedWithSize:function(){if(this._ignoreSize){this._labelBMFontRenderer.setScale(1);
var a=this._labelBMFontRenderer.getContentSize();this._size.width=a.width;this._size.height=a.height}else if(a=this._labelBMFontRenderer.getContentSize(),0>=a.width||0>=a.height)this._labelBMFontRenderer.setScale(1);else{var c=this._size.height/a.height;this._labelBMFontRenderer.setScaleX(this._size.width/a.width);this._labelBMFontRenderer.setScaleY(c)}},updateTextureColor:function(){this.updateColorToRenderer(this._labelBMFontRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._labelBMFontRenderer)},
updateTextureRGBA:function(){this.updateRGBAToRenderer(this._labelBMFontRenderer)},getDescription:function(){return"LabelBMFont"},createCloneInstance:function(){return ccs.LabelBMFont.create()},copySpecialProperties:function(a){this.setFntFile(a._fntFileName);this.setText(a._stringValue)}});ccs.LabelBMFont.create=function(){var a=new ccs.LabelBMFont;return a&&a.init()?a:null};ccs.LoadingBarType={left:0,right:1};ccs.BARRENDERERZ=-1;
ccs.LoadingBar=ccs.Widget.extend({_barType:null,_percent:100,_totalLength:0,_barRenderer:null,_renderBarTexType:null,_barRendererTextureSize:null,_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_textureFile:"",_isTextureLoaded:!1,ctor:function(){ccs.Widget.prototype.ctor.call(this);this._barType=ccs.LoadingBarType.left;this._percent=100;this._totalLength=0;this._barRenderer=null;this._renderBarTexType=ccs.TextureResType.local;this._barRendererTextureSize=cc.size(0,0);this._scale9Enabled=!1;this._prevIgnoreSize=
!0;this._capInsets=cc.rect(0,0,0,0);this._textureFile=""},initRenderer:function(){this._barRenderer=cc.Sprite.create();cc.Node.prototype.addChild.call(this,this._barRenderer,ccs.BARRENDERERZ,-1);this._barRenderer.setAnchorPoint(0,0.5)},setDirection:function(a){if(this._barType!=a)switch(this._barType=a,this._barType){case ccs.LoadingBarType.left:this._barRenderer.setAnchorPoint(0,0.5);this._barRenderer.setPosition(0.5*-this._totalLength,0);this._scale9Enabled||this._barRenderer.setFlippedX(!1);break;
case ccs.LoadingBarType.right:this._barRenderer.setAnchorPoint(1,0.5),this._barRenderer.setPosition(0.5*this._totalLength,0),this._scale9Enabled||this._barRenderer.setFlippedX(!0)}},getDirection:function(){return this._barType},loadTexture:function(a,c){if(a){this._renderBarTexType=c=c||ccs.TextureResType.local;this._textureFile=a;var d=this._barRenderer;switch(this._renderBarTexType){case ccs.TextureResType.local:d.initWithFile(a);break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}this._scale9Enabled&&
d.setCapInsets(this._capInsets);this.updateRGBAToRenderer(d);var e=d.textureLoaded();(this._isTextureLoaded=e)?(e=d.getContentSize(),this._barRendererTextureSize.width=e.width,this._barRendererTextureSize.height=e.height):(this._barRendererTextureSize.width=this._customSize.width,this._barRendererTextureSize.height=this._customSize.height,d.addLoadedEventListener(function(){this._isTextureLoaded=!0;d.setCapInsets&&d.setCapInsets(this._capInsets);var a=d.getContentSize();this._barRendererTextureSize.width=
a.width;this._barRendererTextureSize.height=a.height;this.barRendererScaleChangedWithSize();this.setPercent(this._percent)},this));switch(this._barType){case ccs.LoadingBarType.left:d.setAnchorPoint(0,0.5);this._scale9Enabled||d.setFlippedX(!1);break;case ccs.LoadingBarType.right:d.setAnchorPoint(1,0.5),this._scale9Enabled||d.setFlippedX(!0)}this.barRendererScaleChangedWithSize()}},setScale9Enabled:function(a){this._scale9Enabled!=a&&(this._scale9Enabled=a,cc.Node.prototype.removeChild.call(this,
this._barRenderer,!0),this._barRenderer=null,this._barRenderer=this._scale9Enabled?cc.Scale9Sprite.create():cc.Sprite.create(),this.loadTexture(this._textureFile,this._renderBarTexType),cc.Node.prototype.addChild.call(this,this._barRenderer,ccs.BARRENDERERZ,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this.setPercent(this._percent))},isScale9Enabled:function(){return this._scale9Enabled},
setCapInsets:function(a){this._capInsets=a;this._scale9Enabled&&this._barRenderer.setCapInsets(a)},getCapInsets:function(){return this._capInsets},setPercent:function(a){if(!(0>a||100<a||0>=this._totalLength)&&(this._percent=a,this._isTextureLoaded)){a=this._percent/100;var c=0,d=0;if(this._renderBarTexType==ccs.TextureResType.plist){var e=this._barRenderer;e&&(d=e.getTextureRect()._origin,c=d.x,d=d.y)}this._scale9Enabled?this.setScale9Scale():this._barRenderer.setTextureRect(cc.rect(c,d,this._barRendererTextureSize.width*
a,this._barRendererTextureSize.height))}},getPercent:function(){return this._percent},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.barRendererScaleChangedWithSize()},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccs.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},getContentSize:function(){return this._barRendererTextureSize},getVirtualRenderer:function(){return this._barRenderer},barRendererScaleChangedWithSize:function(){if(this._ignoreSize)this._scale9Enabled||
(this._totalLength=this._barRendererTextureSize.width,this._barRenderer.setScale(1),this._size.width=this._barRendererTextureSize);else if(this._totalLength=this._size.width,this._scale9Enabled)this.setScale9Scale();else{var a=this._barRendererTextureSize;if(0>=a.width||0>=a.height){this._barRenderer.setScale(1);return}var c=this._size.height/a.height;this._barRenderer.setScaleX(this._size.width/a.width);this._barRenderer.setScaleY(c)}switch(this._barType){case ccs.LoadingBarType.left:this._barRenderer.setPosition(0.5*
-this._totalLength,0);break;case ccs.LoadingBarType.right:this._barRenderer.setPosition(0.5*this._totalLength,0)}},setScale9Scale:function(){this._barRenderer.setPreferredSize(cc.size(this._percent/100*this._totalLength,this._size.height))},updateTextureColor:function(){this.updateColorToRenderer(this._barRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._barRenderer)},updateTextureRGBA:function(){this.updateRGBAToRenderer(this._barRenderer)},getDescription:function(){return"LoadingBar"},
createCloneInstance:function(){return ccs.LoadingBar.create()},copySpecialProperties:function(a){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._barType)}});ccs.LoadingBar.create=function(){var a=new ccs.LoadingBar;return a&&a.init()?a:null};ccs.RICH_ELEMENT_TYPE_TEXT=0;ccs.RICH_ELEMENT_TYPE_IMAGE=1;ccs.RICH_ELEMENT_TYPE_CUSTOM=2;ccs.RichElement=ccs.Class.extend({type:0,tag:0,color:null,opacity:0,ctor:function(){this.tag=0;this.color=cc.c3b(255,255,255);this.opacity=0},init:function(a,c,d){this.tag=a;this.color.r=c.r;this.color.g=c.g;this.color.b=c.b;this.opacity=d}});
ccs.RichElementText=ccs.RichElement.extend({text:"",fontName:"",fontSize:0,ctor:function(){ccs.RichElement.prototype.ctor.call(this);this.type=ccs.RICH_ELEMENT_TYPE_TEXT;this.fontName=this.text="";this.fontSize=0},init:function(a,c,d,e,f,g){ccs.RichElement.prototype.init.call(this,a,c,d);this.text=e;this.fontName=f;this.fontSize=g}});ccs.RichElementText.create=function(a,c,d,e,f,g){var h=new ccs.RichElementText;h.init(a,c,d,e,f,g);return h};
ccs.RichElementImage=ccs.RichElement.extend({filePath:"",textureRect:null,textureType:0,ctor:function(){ccs.RichElement.prototype.ctor.call(this);this.type=ccs.RICH_ELEMENT_TYPE_IMAGE;this.filePath="";this.textureRect=cc.rect(0,0,0,0);this.textureType=0},init:function(a,c,d,e){ccs.RichElement.prototype.init.call(this,a,c,d);this.filePath=e}});ccs.RichElementImage.create=function(a,c,d,e){var f=new ccs.RichElementImage;f.init(a,c,d,e);return f};
ccs.RichElementCustomNode=ccs.RichElement.extend({customNode:null,ctor:function(){ccs.RichElement.prototype.ctor.call(this);this.type=ccs.RICH_ELEMENT_TYPE_CUSTOM;this.customNode=null},init:function(a,c,d,e){ccs.RichElement.prototype.init.call(this,a,c,d);this.customNode=e}});ccs.RichElementCustomNode.create=function(a,c,d,e){var f=new ccs.RichElementCustomNode;f.init(a,c,d,e);return f};
ccs.RichText=ccs.Widget.extend({_formatTextDirty:!1,_richElements:null,_elementRenders:null,_leftSpaceWidth:0,_verticalSpace:0,_elementRenderersContainer:null,ctor:function(){ccs.Widget.prototype.ctor.call(this);this._formatTextDirty=!1;this._richElements=[];this._elementRenders=[];this._verticalSpace=this._leftSpaceWidth=0;this._elementRenderersContainer=null},initRenderer:function(){this._elementRenderersContainer=cc.Node.create();this._elementRenderersContainer.setAnchorPoint(cc.p(0.5,0.5));cc.Node.prototype.addChild.call(this,
this._elementRenderersContainer,0,-1)},insertElement:function(a,c){this._richElements.splice(c,0,a);this._formatTextDirty=!0},pushBackElement:function(a){this._richElements.push(a);this._formatTextDirty=!0},removeElement:function(a){"number"===typeof a?this._richElements.splice(a,1):cc.ArrayRemoveObject(this._richElements,a);this._formatTextDirty=!0},formatText:function(){if(this._formatTextDirty){this._elementRenderersContainer.removeAllChildren();this._elementRenders.length=0;if(this._ignoreSize){this.addNewLine();
for(var a=0;a<this._richElements.length;a++){var c=this._richElements[a],d=null;switch(c.type){case ccs.RICH_ELEMENT_TYPE_TEXT:d=cc.LabelTTF.create(c.text,c.fontName,c.fontSize);break;case ccs.RICH_ELEMENT_TYPE_IMAGE:d=cc.Sprite.create(c.filePath);break;case ccs.RICH_ELEMENT_TYPE_CUSTOM:d=c.customNode}d.setColor(c.color);d.setOpacity(c.opacity);this.pushToContainer(d)}}else for(this.addNewLine(),a=0;a<this._richElements.length;a++)switch(c=this._richElements[a],c.type){case ccs.RICH_ELEMENT_TYPE_TEXT:this.handleTextRenderer(c.text,
c.fontName,c.fontSize,c.color,c.opacity);break;case ccs.RICH_ELEMENT_TYPE_IMAGE:this.handleImageRenderer(c.filePath,c.color);break;case ccs.RICH_ELEMENT_TYPE_CUSTOM:this.handleCustomRenderer(c.customNode)}this.formatRenderers();this._formatTextDirty=!1}},handleTextRenderer:function(a,c,d,e,f){var g=cc.LabelTTF.create(a,c,d),h=g.getContentSize().width;this._leftSpaceWidth-=h;if(0>this._leftSpaceWidth){var h=a.length*(1- -this._leftSpaceWidth/h),k=a.substr(0,h);a=a.substr(h,a.length-1);0<h&&(h=cc.LabelTTF.create(k.substr(0,
h),c,d),h.setColor(e),g.setOpacity(f),this.pushToContainer(h));this.addNewLine();this.handleTextRenderer(a,c,d,e,f)}else g.setColor(e),g.setOpacity(f),this.pushToContainer(g)},handleImageRenderer:function(a,c,d){a=cc.Sprite.create(a);this.handleCustomRenderer(a)},handleCustomRenderer:function(a){var c=a.getContentSize();this._leftSpaceWidth-=c.width;0>this._leftSpaceWidth?(this.addNewLine(),this.pushToContainer(a),this._leftSpaceWidth-=c.width):this.pushToContainer(a)},addNewLine:function(){this._leftSpaceWidth=
this._customSize.width;this._elementRenders.push([])},formatRenderers:function(){if(this._ignoreSize){for(var a=0,c=0,d=this._elementRenders[0],e=0,f=0;f<d.length;f++){var g=d[f];g.setAnchorPoint(cc.p(0,0));g.setPosition(cc.p(e,0));this._elementRenderersContainer.addChild(g,1,f);g=g.getContentSize();a+=g.width;c=Math.max(c,g.height);e+=g.width}this._elementRenderersContainer.setContentSize(cc.size(a,c))}else{for(var c=0,a=[],h=0;h<this._elementRenders.length;h++){d=this._elementRenders[h];for(f=e=
0;f<d.length;f++)g=d[f],e=Math.max(g.getContentSize().height,e);a[h]=e;c+=a[h]}c=this._customSize.height;for(h=0;h<this._elementRenders.length;h++)for(d=this._elementRenders[h],e=0,c-=a[h]+this._verticalSpace,f=0;f<d.length;f++)g=d[f],g.setAnchorPoint(cc.p(0,0)),g.setPosition(cc.p(e,c)),this._elementRenderersContainer.addChild(g,1,10*h+f),e+=g.getContentSize().width;this._elementRenderersContainer.setContentSize(this._size)}this._elementRenders.length=0;this._ignoreSize?(d=this.getContentSize(),this._size.width=
d.width,this._size.height=d.height):(this._size.width=this._customSize.width,this._size.height=this._customSize.height)},pushToContainer:function(a){0>=this._elementRenders.length||this._elementRenders[this._elementRenders.length-1].push(a)},visit:function(a){this._enabled&&(this.formatText(),ccs.Widget.prototype.visit.call(this,a))},setVerticalSpace:function(a){this._verticalSpace=a},setAnchorPoint:function(a){ccs.Widget.prototype.setAnchorPoint.call(this,a);this._elementRenderersContainer.setAnchorPoint(a)},
getContentSize:function(){return this._elementRenderersContainer.getContentSize()},ignoreContentAdaptWithSize:function(a){this._ignoreSize!=a&&(this._formatTextDirty=!0,ccs.Widget.prototype.ignoreContentAdaptWithSize.call(this,a))}});ccs.RichText.create=function(){var a=new ccs.RichText;a.init();return a};ccs.SliderEventType={percent_changed:0};ccs.BASEBARRENDERERZ=-3;ccs.PROGRESSBARRENDERERZ=-2;ccs.SLIDBALLRENDERERZ=-1;
ccs.Slider=ccs.Widget.extend({_barRenderer:null,_progressBarRenderer: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:null,_progressBarTexType:null,_ballNTexType:null,_ballPTexType:null,_ballDTexType:null,_isTextureLoaded:!1,ctor:function(){ccs.Widget.prototype.ctor.call(this);this._progressBarRenderer=this._barRenderer=null;this._progressBarTextureSize=cc.size(0,0);this._slidBallRenderer=this._slidBallDisabledRenderer=this._slidBallPressedRenderer=this._slidBallNormalRenderer=null;this._percent=this._barLength=0;this._scale9Enabled=!1;this._prevIgnoreSize=!0;this._slidBallDisabledTextureFile=
this._slidBallPressedTextureFile=this._slidBallNormalTextureFile=this._progressBarTextureFile=this._textureFile="";this._capInsetsBarRenderer=cc.RectZero();this._capInsetsProgressBarRenderer=cc.RectZero();this._sliderEventSelector=this._sliderEventListener=null;this._ballDTexType=this._ballPTexType=this._ballNTexType=this._progressBarTexType=this._barTexType=ccs.TextureResType.local;this._isTextureLoaded=!1},init:function(){return ccs.Widget.prototype.init.call(this)?(this.setTouchEnabled(!0),!0):
!1},initRenderer:function(){this._barRenderer=cc.Sprite.create();this._progressBarRenderer=cc.Sprite.create();this._progressBarRenderer.setAnchorPoint(0,0.5);cc.Node.prototype.addChild.call(this,this._barRenderer,ccs.BASEBARRENDERERZ,-1);cc.Node.prototype.addChild.call(this,this._progressBarRenderer,ccs.PROGRESSBARRENDERERZ,-1);this._slidBallNormalRenderer=cc.Sprite.create();this._slidBallPressedRenderer=cc.Sprite.create();this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer=
cc.Sprite.create();this._slidBallDisabledRenderer.setVisible(!1);this._slidBallRenderer=cc.Node.create();this._slidBallRenderer.addChild(this._slidBallNormalRenderer);this._slidBallRenderer.addChild(this._slidBallPressedRenderer);this._slidBallRenderer.addChild(this._slidBallDisabledRenderer);cc.Node.prototype.addChild.call(this,this._slidBallRenderer,ccs.SLIDBALLRENDERERZ,-1)},loadBarTexture:function(a,c){if(a){c=c||ccs.TextureResType.local;this._textureFile=a;this._barTexType=c;var d=this._barRenderer;
switch(this._barTexType){case ccs.TextureResType.local:d.initWithFile(a);break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(d);this.barRendererScaleChangedWithSize();d.textureLoaded()||d.addLoadedEventListener(function(){this.barRendererScaleChangedWithSize()},this)}},loadProgressBarTexture:function(a,c){if(a){c=c||ccs.TextureResType.local;this._progressBarTextureFile=a;this._progressBarTexType=c;var d=this._progressBarRenderer;switch(this._progressBarTexType){case ccs.TextureResType.local:d.initWithFile(a);
break;case ccs.TextureResType.plist:d.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(d);d.setAnchorPoint(0,0.5);var e=d.getContentSize();this._progressBarTextureSize.width=e.width;this._progressBarTextureSize.height=e.height;this.progressBarRendererScaleChangedWithSize();(this._isTextureLoaded=e=d.textureLoaded())||d.addLoadedEventListener(function(){this._isTextureLoaded=!0;var a=d.getContentSize();this._progressBarTextureSize.width=a.width;this._progressBarTextureSize.height=a.height;this.progressBarRendererScaleChangedWithSize()},
this)}},setScale9Enabled:function(a){this._scale9Enabled!=a&&(this._scale9Enabled=a,cc.Node.prototype.removeChild.call(this,this._barRenderer,!0),cc.Node.prototype.removeChild.call(this,this._progressBarRenderer,!0),this._progressBarRenderer=this._barRenderer=null,this._scale9Enabled?(this._barRenderer=cc.Scale9Sprite.create(),this._progressBarRenderer=cc.Scale9Sprite.create()):(this._barRenderer=cc.Sprite.create(),this._progressBarRenderer=cc.Sprite.create()),this.loadBarTexture(this._textureFile,
this._barTexType),this.loadProgressBarTexture(this._progressBarTextureFile,this._progressBarTexType),cc.Node.prototype.addChild.call(this,this._barRenderer,ccs.BASEBARRENDERERZ,-1),cc.Node.prototype.addChild.call(this,this._progressBarRenderer,ccs.PROGRESSBARRENDERERZ,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsetsBarRenderer(this._capInsetsBarRenderer),this.setCapInsetProgressBarRebderer(this._capInsetsProgressBarRenderer))},
isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccs.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},setCapInsets:function(a){this.setCapInsetsBarRenderer(a);this.setCapInsetProgressBarRebderer(a)},setCapInsetsBarRenderer:function(a){this._capInsetsBarRenderer=a;this._scale9Enabled&&this._barRenderer.setCapInsets(a)},getCapInsetBarRenderer:function(){return this._capInsetsBarRenderer},
setCapInsetProgressBarRebderer:function(a){this._capInsetsProgressBarRenderer=a;this._scale9Enabled&&this._progressBarRenderer.setCapInsets(a)},getCapInsetProgressBarRebderer:function(){return this._capInsetsProgressBarRenderer},loadSlidBallTextures:function(a,c,d,e){this.loadSlidBallTextureNormal(a,e);this.loadSlidBallTexturePressed(c,e);this.loadSlidBallTextureDisabled(d,e)},loadSlidBallTextureNormal:function(a,c){if(a){c=c||ccs.TextureResType.local;this._slidBallNormalTextureFile=a;this._ballNTexType=
c;switch(this._ballNTexType){case ccs.TextureResType.local:this._slidBallNormalRenderer.initWithFile(a);break;case ccs.TextureResType.plist:this._slidBallNormalRenderer.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(this._slidBallNormalRenderer)}},loadSlidBallTexturePressed:function(a,c){if(a){c=c||ccs.TextureResType.local;this._slidBallPressedTextureFile=a;this._ballPTexType=c;switch(this._ballPTexType){case ccs.TextureResType.local:this._slidBallPressedRenderer.initWithFile(a);break;case ccs.TextureResType.plist:this._slidBallPressedRenderer.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(this._slidBallPressedRenderer)}},
loadSlidBallTextureDisabled:function(a,c){if(a){c=c||ccs.TextureResType.local;this._slidBallDisabledTextureFile=a;this._ballDTexType=c;switch(this._ballDTexType){case ccs.TextureResType.local:this._slidBallDisabledRenderer.initWithFile(a);break;case ccs.TextureResType.plist:this._slidBallDisabledRenderer.initWithSpriteFrameName(a)}this.updateRGBAToRenderer(this._slidBallDisabledRenderer)}},setPercent:function(a){100<a&&(a=100);0>a&&(a=0);this._percent=a;if(this._isTextureLoaded){var c=a/100*this._barLength;
this._slidBallRenderer.setPosition(cc.p(-this._barLength/2+c,0));if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(cc.size(c,this._progressBarTextureSize.height));else{var d=c=0;if(this._progressBarTexType==ccs.TextureResType.plist){var e=this._progressBarRenderer;e&&(d=e.getTextureRect()._origin,c=d.x,d=d.y)}this._progressBarRenderer.setTextureRect(cc.rect(c,d,a/100*this._progressBarTextureSize.width,this._progressBarTextureSize.height))}}},onTouchBegan:function(a,c){var d=ccs.Widget.prototype.onTouchBegan.call(this,
a,c);if(this._hitted){var e=this.convertToNodeSpace(this._touchStartPos);this.setPercent(this.getPercentWithBallPos(e.x));this.percentChangedEvent()}return d},onTouchMoved:function(a,c){var d=a.getLocation();this._touchMovePos.x=d.x;this._touchMovePos.y=d.y;d=this.convertToNodeSpace(d);this._slidBallRenderer.setPosition(cc.p(d.x,0));this.setPercent(this.getPercentWithBallPos(d.x));this.percentChangedEvent()},onTouchEnded:function(a,c){ccs.Widget.prototype.onTouchEnded.call(this,a,c)},onTouchCancelled:function(a,
c){ccs.Widget.prototype.onTouchCancelled.call(this,a,c)},getPercentWithBallPos:function(a){return(a- -this._barLength/2)/this._barLength*100},addEventListenerSlider:function(a,c){this._sliderEventSelector=a;this._sliderEventListener=c},percentChangedEvent:function(){this._sliderEventListener&&this._sliderEventSelector&&this._sliderEventSelector.call(this._sliderEventListener,this,ccs.SliderEventType.percent_changed)},getPercent:function(){return this._percent},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);
this.barRendererScaleChangedWithSize();this.progressBarRendererScaleChangedWithSize()},getContentSize:function(){var a=this._barRenderer.getContentSize();return cc.size(a.width,a.height)},getVirtualRenderer:function(){return this._barRenderer},barRendererScaleChangedWithSize:function(){if(this._ignoreSize){this._barRenderer.setScale(1);var a=this._barRenderer.getContentSize();this._size.width=a.width;this._size.height=a.height;this._barLength=a.width}else if(this._barLength=this._size.width,this._scale9Enabled)this._barRenderer.setPreferredSize(cc.size(this._size.width,
this._size.height));else{a=this._barRenderer.getContentSize();if(0>=a.width||0>=a.height){this._barRenderer.setScale(1);return}var c=this._size.height/a.height;this._barRenderer.setScaleX(this._size.width/a.width);this._barRenderer.setScaleY(c)}this.setPercent(this._percent)},progressBarRendererScaleChangedWithSize:function(){if(this._ignoreSize){if(!this._scale9Enabled){var a=this._progressBarTextureSize,c=this._size.width/a.width,a=this._size.height/a.height;this._progressBarRenderer.setScaleX(c);
this._progressBarRenderer.setScaleY(a)}}else if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(cc.size(this._size.width,this._size.height));else{a=this._progressBarTextureSize;if(0>=a.width||0>=a.height){this._progressBarRenderer.setScale(1);return}c=this._size.width/a.width;a=this._size.height/a.height;this._progressBarRenderer.setScaleX(c);this._progressBarRenderer.setScaleY(a)}this._progressBarRenderer.setPosition(cc.p(0.5*-this._barLength,0));this.setPercent(this._percent)},onPressStateChangedToNormal:function(){this._slidBallNormalRenderer.setVisible(!0);
this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer.setVisible(!1)},onPressStateChangedToPressed:function(){this._slidBallNormalRenderer.setVisible(!1);this._slidBallPressedRenderer.setVisible(!0);this._slidBallDisabledRenderer.setVisible(!1)},onPressStateChangedToDisabled:function(){this._slidBallNormalRenderer.setVisible(!1);this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer.setVisible(!0)},updateTextureColor:function(){this.updateColorToRenderer(this._barRenderer);
this.updateColorToRenderer(this._progressBarRenderer);this.updateColorToRenderer(this._slidBallNormalRenderer);this.updateColorToRenderer(this._slidBallPressedRenderer);this.updateColorToRenderer(this._slidBallDisabledRenderer)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._barRenderer);this.updateOpacityToRenderer(this._progressBarRenderer);this.updateOpacityToRenderer(this._slidBallNormalRenderer);this.updateOpacityToRenderer(this._slidBallPressedRenderer);this.updateOpacityToRenderer(this._slidBallDisabledRenderer)},
updateTextureRGBA:function(){this.updateRGBAToRenderer(this._barRenderer);this.updateRGBAToRenderer(this._progressBarRenderer);this.updateRGBAToRenderer(this._slidBallNormalRenderer);this.updateRGBAToRenderer(this._slidBallPressedRenderer);this.updateRGBAToRenderer(this._slidBallDisabledRenderer)},getDescription:function(){return"Slider"},createCloneInstance:function(){return ccs.Slider.create()},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())}});ccs.Slider.create=function(){var a=new ccs.Slider;return a&&a.init()?a:null};ccs.UISwitch=ccs.Widget.extend({});ccs.TextFiledEventType={attach_with_me:0,detach_with_ime:1,insert_text:2,delete_backward:3};ccs.TEXTFIELDRENDERERZ=-1;
ccs.UICCTextField=cc.TextFieldTTF.extend({_maxLengthEnabled:!1,_maxLength:0,_passwordEnabled:!1,_passwordStyleText:"",_attachWithIME:!1,_detachWithIME:!1,_insertText:!1,_deleteBackward:!1,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},init:function(){return ccs.Widget.prototype.init.call(this)?(this.setTouchEnabled(!0),
!0):!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,c,d){if(1==d&&"\n"==c)return!1;this.setInsertText(!0);return this._maxLengthEnabled&&cc.TextFieldTTF.prototype.getCharCount.call(this)>=this._maxLength?!0:!1},onTextFieldDeleteBackward:function(a,c,d){this.setDeleteBackward(!0);return!1},onTextFieldDetachWithIME:function(a){this.setDetachWithIME(!0);
return!1},insertText:function(a,c){var d=a,e=cc.TextFieldTTF.prototype.getString.call(this).length,f,g;if("\n"!=a&&this._maxLengthEnabled){f=1;g=a.charCodeAt(0);if(0>g||127<g)f=3;e+c>this._maxLength*f&&(d=d.substr(0,this._maxLength*f),c=this._maxLength*f)}cc.TextFieldTTF.prototype.insertText.call(this,d,c);this._passwordEnabled&&0<cc.TextFieldTTF.prototype.getCharCount.call(this)&&this.setPasswordText(this._inputText)},deleteBackward:function(){cc.TextFieldTTF.prototype.deleteBackward.call(this);
0<cc.TextFieldTTF.prototype.getCharCount.call(this)&&this._passwordEnabled&&this.setPasswordText(this._inputText)},openIME:function(){cc.TextFieldTTF.prototype.attachWithIME.call(this)},closeIME:function(){cc.TextFieldTTF.prototype.detachWithIME.call(this)},onDraw:function(a){return!1},setMaxLengthEnabled:function(a){this._maxLengthEnabled=a},isMaxLengthEnabled:function(){return this._maxLengthEnabled},setMaxLength:function(a){this._maxLength=a},getMaxLength:function(){return this._maxLength},getCharCount:function(){return cc.TextFieldTTF.prototype.getCharCount.call(this)},
setPasswordEnabled:function(a){this._passwordEnabled=a},isPasswordEnabled:function(){return this._passwordEnabled},setPasswordStyleText:function(a){if(!(1<a.length)){var c=a.charCodeAt(0);33>c||126<c||(this._passwordStyleText=a)}},setPasswordText:function(a){for(var c="",d=0;d<a.length;++d)c+=this._passwordStyleText;cc.LabelTTF.prototype.setString.call(this,c)},setAttachWithIME:function(a){this._attachWithIME=a},getAttachWithIME:function(){return this._attachWithIME},setDetachWithIME:function(a){this._detachWithIME=
a},getDetachWithIME:function(){return this._detachWithIME},setInsertText:function(a){this._insertText=a},getInsertText:function(){return this._insertText},setDeleteBackward:function(a){this._deleteBackward=a},getDeleteBackward:function(){return this._deleteBackward}});ccs.UICCTextField.create=function(a,c,d){var e=new ccs.UICCTextField;return e&&e.initWithString("",c,d)?(a&&e.setPlaceHolder(a),e):null};
ccs.TextField=ccs.Widget.extend({_textFieldRender:null,_touchWidth:0,_touchHeight:0,_useTouchArea:!1,_textFieldEventListener:null,_textFieldEventSelector:null,_attachWithIMEListener:null,_detachWithIMEListener:null,_insertTextListener:null,_deleteBackwardListener:null,_attachWithIMESelector:null,_detachWithIMESelector:null,_insertTextSelector:null,_deleteBackwardSelector:null,_passwordStyleText:"",ctor:function(){ccs.Widget.prototype.ctor.call(this);this._textFieldRender=null;this._touchHeight=this._touchWidth=
0;this._useTouchArea=!1;this._deleteBackwardSelector=this._insertTextSelector=this._detachWithIMESelector=this._attachWithIMESelector=this._deleteBackwardListener=this._insertTextListener=this._detachWithIMEListener=this._attachWithIMEListener=this._textFieldEventSelector=this._textFieldEventListener=null},onEnter:function(){ccs.Widget.prototype.onEnter.call(this);this.setUpdateEnabled(!0)},initRenderer:function(){this._textFieldRender=ccs.UICCTextField.create("input words here","Thonburi",20);cc.Node.prototype.addChild.call(this,
this._textFieldRender,ccs.TEXTFIELDRENDERERZ,-1)},setTouchSize:function(a){this._useTouchArea=!0;this._touchWidth=a.width;this._touchHeight=a.height},getTouchSize:function(){return cc.size(this._touchWidth,this._touchHeight)},setText:function(a){a&&(a=String(a),this.isMaxLengthEnabled()&&(a=a.substr(0,this.getMaxLength())),this.isPasswordEnabled()?(this._textFieldRender.setPasswordText(a),this._textFieldRender.insertText(a,a.length)):this._textFieldRender.setString(a),this._textFieldRender.setString(a),
this.textfieldRendererScaleChangedWithSize())},setPlaceHolder:function(a){this._textFieldRender.setPlaceHolder(a);this.textfieldRendererScaleChangedWithSize()},getPlaceHolder:function(){return this._textFieldRender.getPlaceHolder()},setFontSize:function(a){this._textFieldRender.setFontSize(a);this.textfieldRendererScaleChangedWithSize()},getFontSize:function(){return this._textFieldRender.getFontSize()},setFontName:function(a){this._textFieldRender.setFontName(a);this.textfieldRendererScaleChangedWithSize()},
getFontName:function(){return this._textFieldRender.getFontName()},didNotSelectSelf:function(){this._textFieldRender.detachWithIME()},getStringValue:function(){return this._textFieldRender.getString()},onTouchBegan:function(a){return ccs.Widget.prototype.onTouchBegan.call(this,a)},onTouchEnded:function(a){ccs.Widget.prototype.onTouchEnded.call(this,a);this._textFieldRender.attachWithIME()},setMaxLengthEnabled:function(a){this._textFieldRender.setMaxLengthEnabled(a)},isMaxLengthEnabled:function(){return this._textFieldRender.isMaxLengthEnabled()},
setMaxLength:function(a){this._textFieldRender.setMaxLength(a)},getMaxLength:function(){return this._textFieldRender.getMaxLength()},setPasswordEnabled:function(a){this._textFieldRender.setPasswordEnabled(a)},isPasswordEnabled:function(){return this._textFieldRender.isPasswordEnabled()},setPasswordStyleText:function(a){this._textFieldRender.setPasswordStyleText(a);this._passwordStyleText=a},getPasswordStyleText:function(){return this._passwordStyleText},update:function(a){this.getAttachWithIME()&&
(this.attachWithIMEEvent(),this.setAttachWithIME(!1));this.getDetachWithIME()&&(this.detachWithIMEEvent(),this.setDetachWithIME(!1));this.getInsertText()&&(this.insertTextEvent(),this.setInsertText(!1),this.textfieldRendererScaleChangedWithSize());this.getDeleteBackward()&&(this.deleteBackwardEvent(),this.setDeleteBackward(!1))},getAttachWithIME:function(){return this._textFieldRender.getAttachWithIME()},setAttachWithIME:function(a){this._textFieldRender.setAttachWithIME(a)},getDetachWithIME:function(){return this._textFieldRender.getDetachWithIME()},
setDetachWithIME:function(a){this._textFieldRender.setDetachWithIME(a)},getInsertText:function(){return this._textFieldRender.getInsertText()},setInsertText:function(a){this._textFieldRender.setInsertText(a)},getDeleteBackward:function(){return this._textFieldRender.getDeleteBackward()},setDeleteBackward:function(a){this._textFieldRender.setDeleteBackward(a)},attachWithIMEEvent:function(){this._textFieldEventListener&&this._textFieldEventSelector&&this._textFieldEventSelector.call(this._textFieldEventListener,
this,ccs.TextFiledEventType.attach_with_me)},detachWithIMEEvent:function(){this._textFieldEventListener&&this._textFieldEventSelector&&this._textFieldEventSelector.call(this._textFieldEventListener,this,ccs.TextFiledEventType.detach_with_ime)},insertTextEvent:function(){this._textFieldEventListener&&this._textFieldEventSelector&&this._textFieldEventSelector.call(this._textFieldEventListener,this,ccs.TextFiledEventType.insert_text)},deleteBackwardEvent:function(){this._textFieldEventListener&&this._textFieldEventSelector&&
this._textFieldEventSelector.call(this._textFieldEventListener,this,ccs.TextFiledEventType.delete_backward)},addEventListenerTextField:function(a,c){this._textFieldEventSelector=a;this._textFieldEventListener=c},hitTest:function(a){a=this.convertToNodeSpace(a);var c=this._textFieldRender.getContentSize(),c=cc.rect(-c.width*this._anchorPoint.x,-c.height*this._anchorPoint.y,c.width,c.height);return a.x>=c.x&&a.x<=c.x+c.width&&a.y>=c.y&&a.y<=c.y+c.height},setAnchorPoint:function(a,c){void 0===c?(ccs.Widget.prototype.setAnchorPoint.call(this,
a),this._textFieldRender.setAnchorPoint(a)):(ccs.Widget.prototype.setAnchorPoint.call(this,a,c),this._textFieldRender.setAnchorPoint(a,c))},onSizeChanged:function(){ccs.Widget.prototype.onSizeChanged.call(this);this.textfieldRendererScaleChangedWithSize()},textfieldRendererScaleChangedWithSize:function(){if(this._ignoreSize){this._textFieldRender.setScale(1);var a=this.getContentSize();this._size.width=a.width;this._size.height=a.height}else if(a=this.getContentSize(),0>=a.width||0>=a.height)this._textFieldRender.setScale(1);
else{var c=this._size.height/a.height;this._textFieldRender.setScaleX(this._size.width/a.width);this._textFieldRender.setScaleY(c)}},getContentSize:function(){return this._textFieldRender.getContentSize()},getVirtualRenderer:function(){return this._textFieldRender},updateTextureColor:function(){this.updateColorToRenderer(this._textFieldRender)},updateTextureOpacity:function(){this.updateOpacityToRenderer(this._textFieldRender)},updateTextureRGBA:function(){this.updateRGBAToRenderer(this._textFieldRender)},
getDescription:function(){return"TextField"},attachWithIME:function(){this._textFieldRender.attachWithIME()},createCloneInstance:function(){return ccs.TextField.create()},copySpecialProperties:function(a){this.setText(a._textFieldRender.getString());this.setPlaceHolder(a.getStringValue());this.setFontSize(a._textFieldRender.getFontSize());this.setFontName(a._textFieldRender.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())}});ccs.TextField.create=function(){var a=new ccs.TextField;return a&&a.init()?a:null};ccs.UIPanel=ccs.Layout;ccs.UITextArea=ccs.Label;ccs.UIContainerWidget=ccs.Layout;ccs.UITextButton=ccs.Button;ccs.UINodeContainer=ccs.Widget;ccs.PanelColorType=ccs.LayoutBackGroundColorType;ccs.TouchGroup=ccs.UILayer;ccs.UILayout=ccs.Layout;ccs.UIWidget=ccs.Widget;ccs.UILayoutParameter=ccs.LayoutParameter;ccs.UILinearLayoutParameter=ccs.LinearLayoutParameter;ccs.UIRelativeLayoutParameter=ccs.RelativeLayoutParameter;ccs.UILinearGravity=ccs.LinearGravity;ccs.UIRelativeAlign=ccs.RelativeAlign;
ccs.UIMargin=ccs.Margin;ccs.UIMarginZero=ccs.MarginZero;ccs.UIListView=ccs.ListView;ccs.UIPageView=ccs.PageView;ccs.UIScrollView=ccs.ScrollView;ccs.UIButton=ccs.Button;ccs.UICheckBox=ccs.CheckBox;ccs.UIImageView=ccs.ImageView;ccs.UILabel=ccs.Label;ccs.UILabelAtlas=ccs.LabelAtlas;ccs.UILabelBMFont=ccs.LabelBMFont;ccs.UILoadingBar=ccs.LoadingBar;ccs.UISlider=ccs.Slider;ccs.UITextField=ccs.TextField;ccs.ScrollViewDir={none:0,vertical:1,horizontal:2,both:3};ccs.ScrollViewEventType={scrollToTop:0,scrollToBottom:1,scrollToLeft:2,scrollToRight:3,scrolling:4,bounceTop:5,bounceBottom:6,bounceLeft:7,bounceRight:8};ccs.AUTOSCROLLMAXSPEED=1E3;ccs.SCROLLDIR_UP=cc.p(0,1);ccs.SCROLLDIR_DOWN=cc.p(0,-1);ccs.SCROLLDIR_LEFT=cc.p(-1,0);ccs.SCROLLDIR_RIGHT=cc.p(1,0);
ccs.ScrollView=ccs.Layout.extend({_innerContainer:null,_direction:null,_touchBeganPoint:null,_touchMovedPoint:null,_touchEndedPoint:null,_touchMovingPoint: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,ctor:function(){ccs.Layout.prototype.ctor.call(this);this._innerContainer=null;this._direction=ccs.ScrollViewDir.none;this._touchBeganPoint=cc.p(0,0);this._touchMovedPoint=cc.p(0,0);this._touchEndedPoint=
cc.p(0,0);this._touchMovingPoint=cc.p(0,0);this._autoScrollDir=cc.p(0,0);this._bounceRightBoundary=this._bounceLeftBoundary=this._bounceBottomBoundary=this._bounceTopBoundary=this._rightBoundary=this._leftBoundary=this._bottomBoundary=this._topBoundary=0;this._autoScroll=!1;this._autoScrollOriginalSpeed=this._autoScrollAddUpTime=0;this._autoScrollAcceleration=-1E3;this._needCheckAutoScrollDestination=this._isAutoScrollSpeedAttenuated=!1;this._autoScrollDestination=cc.p(0,0);this._bePressed=!1;this._slidTime=
0;this._moveChildPoint=cc.p(0,0);this._childFocusCancelOffset=5;this._bouncing=this._bounceEnabled=this._bottomBounceNeeded=this._rightBounceNeeded=this._topBounceNeeded=this._leftBounceNeeded=!1;this._bounceDir=cc.p(0,0);this._bounceOriginalSpeed=0;this._inertiaScrollEnabled=!0;this._scrollViewEventSelector=this._scrollViewEventListener=null},init:function(){return ccs.Layout.prototype.init.call(this)?(this.setTouchEnabled(!0),this.setClippingEnabled(!0),this._innerContainer.setTouchEnabled(!1),
!0):!1},onEnter:function(){ccs.Layout.prototype.onEnter.call(this);this.setUpdateEnabled(!0)},initRenderer:function(){ccs.Layout.prototype.initRenderer.call(this);this._innerContainer=ccs.Layout.create();ccs.Layout.prototype.addChild.call(this,this._innerContainer)},onSizeChanged:function(){ccs.Layout.prototype.onSizeChanged.call(this);var a=this._size;this._topBoundary=a.height;this._rightBoundary=a.width;var c=a.width/3,d=a.height/3;this._bounceTopBoundary=a.height-d;this._bounceBottomBoundary=
d;this._bounceLeftBoundary=c;this._bounceRightBoundary=this._size.width-c;d=this._innerContainer.getSize();c=d.height;d=Math.max(d.width,a.width);c=Math.max(c,a.height);this._innerContainer.setSize(cc.size(d,c));this._innerContainer.setPosition(cc.p(0,a.height-this._innerContainer.getSize().height))},setInnerContainerSize:function(a){var c=this._size,d=c.width,e=c.height,f=this._innerContainer.getSize();a.width<c.width?cc.log("Inner width \x3c\x3d scrollview width, it will be force sized!"):d=a.width;
a.height<c.height?cc.log("Inner height \x3c\x3d scrollview height, it will be force sized!"):e=a.height;this._innerContainer.setSize(cc.size(d,e));switch(this._direction){case ccs.ScrollViewDir.vertical:a=this._innerContainer.getSize();f=f.height-a.height;this.scrollChildren(0,f);break;case ccs.ScrollViewDir.horizontal:this._innerContainer.getRightInParent()<=c.width&&(a=this._innerContainer.getSize(),f=f.width-a.width,this.scrollChildren(f,0));break;case ccs.ScrollViewDir.both:a=this._innerContainer.getSize(),
d=f.height-a.height,e=0,this._innerContainer.getRightInParent()<=c.width&&(e=f.width-a.width),this.scrollChildren(e,d)}f=this._innerContainer;a=f.getSize();d=f.getPosition();e=f.getAnchorPoint();0<f.getLeftInParent()&&f.setPosition(cc.p(e.x*a.width,d.y));f.getRightInParent()<c.width&&f.setPosition(cc.p(c.width-(1-e.x)*a.width,d.y));0<d.y&&f.setPosition(cc.p(d.x,e.y*a.height));f.getTopInParent()<c.height&&f.setPosition(cc.p(d.x,c.height-(1-e.y)*a.height))},getInnerContainerSize:function(){return this._innerContainer.getSize()},
addChild:function(a,c,d){return this._innerContainer.addChild(a,c,d)},removeAllChildren:function(a){this._innerContainer.removeAllChildren(a)},removeChild:function(a,c){return this._innerContainer.removeChild(a,c)},getChildren:function(){return this._innerContainer.getChildren()},getChildrenCount:function(){return this._innerContainer.getChildrenCount()},getChildByTag:function(a){return this._innerContainer.getChildByTag(a)},getChildByName:function(a){return this._innerContainer.getChildByName(a)},
addNode:function(a,c,d){this._innerContainer.addNode(a,c,d)},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()},moveChildren:function(a,c){var d=this._innerContainer.getPosition();this._moveChildPoint.x=d.x+a;this._moveChildPoint.y=
d.y+c;this._innerContainer.setPosition(this._moveChildPoint)},autoScrollChildren:function(a){var c=this._autoScrollAddUpTime;this._autoScrollAddUpTime+=a;if(this._isAutoScrollSpeedAttenuated)0>=this._autoScrollOriginalSpeed+this._autoScrollAcceleration*this._autoScrollAddUpTime?(this.stopAutoScrollChildren(),this.checkNeedBounce()):(c=(this._autoScrollOriginalSpeed+this._autoScrollAcceleration*(2*c+a)*0.5)*a,this.scrollChildren(c*this._autoScrollDir.x,c*this._autoScrollDir.y)||(this.stopAutoScrollChildren(),
this.checkNeedBounce()));else if(this._needCheckAutoScrollDestination){var c=this._autoScrollDir.x*a*this._autoScrollOriginalSpeed,d=this._autoScrollDir.y*a*this._autoScrollOriginalSpeed;a=this.checkCustomScrollDestination(c,d);c=this.scrollChildren(c,d);a&&c||(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 c=this._bounceOriginalSpeed,d=this._bounceDir;0>=c&&this.stopBounceChildren();this.bounceScrollChildren(d.x*a*c,d.y*a*c)||this.stopBounceChildren()},checkNeedBounce:function(){if(!this._bounceEnabled)return!1;this.checkBounceBoundary();if(this._topBounceNeeded||this._bottomBounceNeeded||this._leftBounceNeeded||this._rightBounceNeeded){if(this._topBounceNeeded&&this._leftBounceNeeded){var a=cc.pSub(cc.p(0,this._size.height),cc.p(this._innerContainer.getLeftInParent(),
this._innerContainer.getTopInParent())),c=cc.pLength(a)/0.2;this._bounceDir=cc.pNormalize(a);this.startBounceChildren(c)}else this._topBounceNeeded&&this._rightBounceNeeded?(a=cc.pSub(cc.p(this._size.width,this._size.height),cc.p(this._innerContainer.getRightInParent(),this._innerContainer.getTopInParent())),c=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this.startBounceChildren(c)):this._bottomBounceNeeded&&this._leftBounceNeeded?(a=cc.pSub(cc.p(0,0),cc.p(this._innerContainer.getLeftInParent(),
this._innerContainer.getBottomInParent())),c=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this.startBounceChildren(c)):this._bottomBounceNeeded&&this._rightBounceNeeded?(a=cc.pSub(cc.p(this._size.width,0),cc.p(this._innerContainer.getRightInParent(),this._innerContainer.getBottomInParent())),c=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this.startBounceChildren(c)):this._topBounceNeeded?(a=cc.pSub(cc.p(0,this._size.height),cc.p(0,this._innerContainer.getTopInParent())),c=cc.pLength(a)/
0.2,this._bounceDir=cc.pNormalize(a),this.startBounceChildren(c)):this._bottomBounceNeeded?(a=cc.pSub(cc.p(0,0),cc.p(0,this._innerContainer.getBottomInParent())),c=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this.startBounceChildren(c)):this._leftBounceNeeded?(a=cc.pSub(cc.p(0,0),cc.p(this._innerContainer.getLeftInParent(),0)),c=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this.startBounceChildren(c)):this._rightBounceNeeded&&(a=cc.pSub(cc.p(this._size.width,0),cc.p(this._innerContainer.getRightInParent(),
0)),c=cc.pLength(a)/0.2,this._bounceDir=cc.pNormalize(a),this.startBounceChildren(c));return!0}return!1},checkBounceBoundary:function(){this._innerContainer.getBottomInParent()>this._bottomBoundary?(this.scrollToBottomEvent(),this._bottomBounceNeeded=!0):this._bottomBounceNeeded=!1;this._innerContainer.getTopInParent()<this._topBoundary?(this.scrollToTopEvent(),this._topBounceNeeded=!0):this._topBounceNeeded=!1;this._innerContainer.getRightInParent()<this._rightBoundary?(this.scrollToRightEvent(),
this._rightBounceNeeded=!0):this._rightBounceNeeded=!1;this._innerContainer.getLeftInParent()>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,c,d,
e){this.stopAutoScrollChildren();this._autoScrollDir=a;this._isAutoScrollSpeedAttenuated=d;this._autoScrollOriginalSpeed=c;this._autoScroll=!0;this._autoScrollAcceleration=e},startAutoScrollChildrenWithDestination:function(a,c,d){this._needCheckAutoScrollDestination=!1;this._autoScrollDestination=a;var e=cc.pSub(a,this._innerContainer.getPosition());a=cc.pNormalize(e);var f=0,g=-1E3,e=cc.pLength(e);d?(g=-(2*e)/(c*c),f=2*e/c):(this._needCheckAutoScrollDestination=!0,f=e/c);this.startAutoScrollChildrenWithOriginalSpeed(a,
f,d,g)},jumpToDestination:function(a){var c=a.x,d=a.y;switch(this._direction){case ccs.ScrollViewDir.vertical:0>=a.y&&(d=Math.max(a.y,this._size.height-this._innerContainer.getSize().height));break;case ccs.ScrollViewDir.horizontal:0>=a.x&&(c=Math.max(a.x,this._size.width-this._innerContainer.getSize().width));break;case ccs.ScrollViewDir.both:0>=a.y&&(d=Math.max(a.y,this._size.height-this._innerContainer.getSize().height)),0>=a.x&&(c=Math.max(a.x,this._size.width-this._innerContainer.getSize().width))}this._innerContainer.setPosition(cc.p(c,
d))},stopAutoScrollChildren:function(){this._autoScroll=!1;this._autoScrollAddUpTime=this._autoScrollOriginalSpeed=0},bounceScrollChildren:function(a,c){var d=!0;if(0<a&&0<c){var e=a,f=c,g=this._innerContainer.getRightInParent();g+e>=this._rightBoundary&&(e=this._rightBoundary-g,this.bounceRightEvent(),d=!1);g=this._innerContainer.getTopInParent();g+c>=this._topBoundary&&(f=this._topBoundary-g,this.bounceTopEvent(),d=!1);this.moveChildren(e,f)}else 0>a&&0<c?(e=a,f=c,g=this._innerContainer.getLeftInParent(),
g+e<=this._leftBoundary&&(e=this._leftBoundary-g,this.bounceLeftEvent(),d=!1),g=this._innerContainer.getTopInParent(),g+c>=this._topBoundary&&(f=this._topBoundary-g,this.bounceTopEvent(),d=!1),this.moveChildren(e,f)):0>a&&0>c?(e=a,f=c,g=this._innerContainer.getLeftInParent(),g+e<=this._leftBoundary&&(e=this._leftBoundary-g,this.bounceLeftEvent(),d=!1),g=this._innerContainer.getBottomInParent(),g+c<=this._bottomBoundary&&(f=this._bottomBoundary-g,this.bounceBottomEvent(),d=!1),this.moveChildren(e,
f)):0<a&&0>c?(e=a,f=c,g=this._innerContainer.getRightInParent(),g+e>=this._rightBoundary&&(e=this._rightBoundary-g,this.bounceRightEvent(),d=!1),g=this._innerContainer.getBottomInParent(),g+c<=this._bottomBoundary&&(f=this._bottomBoundary-g,this.bounceBottomEvent(),d=!1),this.moveChildren(e,f)):0==a&&0<c?(f=c,g=this._innerContainer.getTopInParent(),g+c>=this._topBoundary&&(f=this._topBoundary-g,this.bounceTopEvent(),d=!1),this.moveChildren(0,f)):0==a&&0>c?(f=c,g=this._innerContainer.getBottomInParent(),
g+c<=this._bottomBoundary&&(f=this._bottomBoundary-g,this.bounceBottomEvent(),d=!1),this.moveChildren(0,f)):0<a&&0==c?(e=a,g=this._innerContainer.getRightInParent(),g+e>=this._rightBoundary&&(e=this._rightBoundary-g,this.bounceRightEvent(),d=!1),this.moveChildren(e,0)):0>a&&0==c&&(e=a,f=this._innerContainer.getLeftInParent(),f+e<=this._leftBoundary&&(e=this._leftBoundary-f,this.bounceLeftEvent(),d=!1),this.moveChildren(e,0));return d},checkCustomScrollDestination:function(a,c){var d=!0;switch(this._direction){case ccs.ScrollViewDir.vertical:if(0<
this._autoScrollDir.y){var e=this._innerContainer.getBottomInParent();e+c>=this._autoScrollDestination.y&&(d=!1)}else e=this._innerContainer.getBottomInParent(),e+c<=this._autoScrollDestination.y&&(d=!1);break;case ccs.ScrollViewDir.horizontal:0<this._autoScrollDir.x?(e=this._innerContainer.getLeftInParent(),e+a>=this._autoScrollDestination.x&&(d=!1)):(e=this._innerContainer.getLeftInParent(),e+a<=this._autoScrollDestination.x&&(d=!1));break;case ccs.ScrollViewDir.both:0<a&&0<c?(e=this._innerContainer.getLeftInParent(),
e+a>=this._autoScrollDestination.x&&(d=!1),e=this._innerContainer.getBottomInParent(),e+c>=this._autoScrollDestination.y&&(d=!1)):0>a&&0<c?(e=this._innerContainer.getRightInParent(),e+a<=this._autoScrollDestination.x&&(d=!1),e=this._innerContainer.getBottomInParent(),e+c>=this._autoScrollDestination.y&&(d=!1)):0>a&&0>c?(e=this._innerContainer.getRightInParent(),e+a<=this._autoScrollDestination.x&&(d=!1),e=this._innerContainer.getTopInParent(),e+c<=this._autoScrollDestination.y&&(d=!1)):0<a&&0>c?(e=
this._innerContainer.getLeftInParent(),e+a>=this._autoScrollDestination.x&&(d=!1),e=this._innerContainer.getTopInParent(),e+c<=this._autoScrollDestination.y&&(d=!1)):0==a&&0<c?(e=this._innerContainer.getBottomInParent(),e+c>=this._autoScrollDestination.y&&(d=!1)):0>a&&0==c?(e=this._innerContainer.getRightInParent(),e+a<=this._autoScrollDestination.x&&(d=!1)):0==a&&0>c?(e=this._innerContainer.getTopInParent(),e+c<=this._autoScrollDestination.y&&(d=!1)):0<a&&0==c&&(e=this._innerContainer.getLeftInParent(),
e+a>=this._autoScrollDestination.x&&(d=!1))}return d},getCurAutoScrollDistance:function(a){this._autoScrollOriginalSpeed-=this._autoScrollAcceleration*a;return this._autoScrollOriginalSpeed*a},scrollChildren:function(a,c){var d=!0;this.scrollingEvent();switch(this._direction){case ccs.ScrollViewDir.vertical:var e=c;if(this._bounceEnabled){var f=this._innerContainer.getBottomInParent();f+c>=this._bounceBottomBoundary&&(e=this._bounceBottomBoundary-f,this.scrollToBottomEvent(),d=!1);f=this._innerContainer.getTopInParent();
f+c<=this._bounceTopBoundary&&(e=this._bounceTopBoundary-f,this.scrollToTopEvent(),d=!1)}else f=this._innerContainer.getBottomInParent(),f+c>=this._bottomBoundary&&(e=this._bottomBoundary-f,this.scrollToBottomEvent(),d=!1),f=this._innerContainer.getTopInParent(),f+c<=this._topBoundary&&(e=this._topBoundary-f,this.scrollToTopEvent(),d=!1);this.moveChildren(0,e);break;case ccs.ScrollViewDir.horizontal:e=a;this._bounceEnabled?(f=this._innerContainer.getRightInParent(),f+a<=this._bounceRightBoundary&&
(e=this._bounceRightBoundary-f,this.scrollToRightEvent(),d=!1),f=this._innerContainer.getLeftInParent(),f+a>=this._bounceLeftBoundary&&(e=this._bounceLeftBoundary-f,this.scrollToLeftEvent(),d=!1)):(f=this._innerContainer.getRightInParent(),f+a<=this._rightBoundary&&(e=this._rightBoundary-f,this.scrollToRightEvent(),d=!1),f=this._innerContainer.getLeftInParent(),f+a>=this._leftBoundary&&(e=this._leftBoundary-f,this.scrollToLeftEvent(),d=!1));this.moveChildren(e,0);break;case ccs.ScrollViewDir.both:var e=
a,g=c;this._bounceEnabled?0<a&&0<c?(f=this._innerContainer.getLeftInParent(),f+a>=this._bounceLeftBoundary&&(e=this._bounceLeftBoundary-f,this.scrollToLeftEvent(),d=!1),f=this._innerContainer.getBottomInParent(),f+c>=this._bounceBottomBoundary&&(g=this._bounceBottomBoundary-f,this.scrollToBottomEvent(),d=!1)):0>a&&0<c?(f=this._innerContainer.getRightInParent(),f+a<=this._bounceRightBoundary&&(e=this._bounceRightBoundary-f,this.scrollToRightEvent(),d=!1),f=this._innerContainer.getBottomInParent(),
f+c>=this._bounceBottomBoundary&&(g=this._bounceBottomBoundary-f,this.scrollToBottomEvent(),d=!1)):0>a&&0>c?(f=this._innerContainer.getRightInParent(),f+a<=this._bounceRightBoundary&&(e=this._bounceRightBoundary-f,this.scrollToRightEvent(),d=!1),f=this._innerContainer.getTopInParent(),f+c<=this._bounceTopBoundary&&(g=this._bounceTopBoundary-f,this.scrollToTopEvent(),d=!1)):0<a&&0>c?(f=this._innerContainer.getLeftInParent(),f+a>=this._bounceLeftBoundary&&(e=this._bounceLeftBoundary-f,this.scrollToLeftEvent(),
d=!1),f=this._innerContainer.getTopInParent(),f+c<=this._bounceTopBoundary&&(g=this._bounceTopBoundary-f,this.scrollToTopEvent(),d=!1)):0==a&&0<c?(f=this._innerContainer.getBottomInParent(),f+c>=this._bounceBottomBoundary&&(g=this._bounceBottomBoundary-f,this.scrollToBottomEvent(),d=!1)):0>a&&0==c?(f=this._innerContainer.getRightInParent(),f+a<=this._bounceRightBoundary&&(e=this._bounceRightBoundary-f,this.scrollToRightEvent(),d=!1)):0==a&&0>c?(f=this._innerContainer.getTopInParent(),f+c<=this._bounceTopBoundary&&
(g=this._bounceTopBoundary-f,this.scrollToTopEvent(),d=!1)):0<a&&0==c&&(f=this._innerContainer.getLeftInParent(),f+a>=this._bounceLeftBoundary&&(e=this._bounceLeftBoundary-f,this.scrollToLeftEvent(),d=!1)):0<a&&0<c?(f=this._innerContainer.getLeftInParent(),f+a>=this._leftBoundary&&(e=this._leftBoundary-f,this.scrollToLeftEvent(),d=!1),f=this._innerContainer.getBottomInParent(),f+c>=this._bottomBoundary&&(g=this._bottomBoundary-f,this.scrollToBottomEvent(),d=!1)):0>a&&0<c?(f=this._innerContainer.getRightInParent(),
f+a<=this._rightBoundary&&(e=this._rightBoundary-f,this.scrollToRightEvent(),d=!1),f=this._innerContainer.getBottomInParent(),f+c>=this._bottomBoundary&&(g=this._bottomBoundary-f,this.scrollToBottomEvent(),d=!1)):0>a&&0>c?(f=this._innerContainer.getRightInParent(),f+a<=this._rightBoundary&&(e=this._rightBoundary-f,this.scrollToRightEvent(),d=!1),f=this._innerContainer.getTopInParent(),f+c<=this._topBoundary&&(g=this._topBoundary-f,this.scrollToTopEvent(),d=!1)):0<a&&0>c?(f=this._innerContainer.getLeftInParent(),
f+a>=this._leftBoundary&&(e=this._leftBoundary-f,this.scrollToLeftEvent(),d=!1),f=this._innerContainer.getTopInParent(),f+c<=this._topBoundary&&(g=this._topBoundary-f,this.scrollToTopEvent(),d=!1)):0==a&&0<c?(f=this._innerContainer.getBottomInParent(),f+c>=this._bottomBoundary&&(g=this._bottomBoundary-f,this.scrollToBottomEvent(),d=!1)):0>a&&0==c?(f=this._innerContainer.getRightInParent(),f+a<=this._rightBoundary&&(e=this._rightBoundary-f,this.scrollToRightEvent(),d=!1)):0==a&&0>c?(f=this._innerContainer.getTopInParent(),
f+c<=this._topBoundary&&(g=this._topBoundary-f,this.scrollToTopEvent(),d=!1)):0<a&&0==c&&(f=this._innerContainer.getLeftInParent(),f+a>=this._leftBoundary&&(e=this._leftBoundary-f,this.scrollToLeftEvent(),d=!1));this.moveChildren(e,g)}return d},scrollToBottom:function(a,c){this.startAutoScrollChildrenWithDestination(cc.p(this._innerContainer.getPosition().x,0),a,c)},scrollToTop:function(a,c){this.startAutoScrollChildrenWithDestination(cc.p(this._innerContainer.getPosition().x,this._size.height-this._innerContainer.getSize().height),
a,c)},scrollToLeft:function(a,c){this.startAutoScrollChildrenWithDestination(cc.p(0,this._innerContainer.getPosition().y),a,c)},scrollToRight:function(a,c){this.startAutoScrollChildrenWithDestination(cc.p(this._size.width-this._innerContainer.getSize().width,this._innerContainer.getPosition().y),a,c)},scrollToTopLeft:function(a,c){this._direction!=ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.startAutoScrollChildrenWithDestination(cc.p(0,this._size.height-this._innerContainer.getSize().height),
a,c)},scrollToTopRight:function(a,c){this._direction!=ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.startAutoScrollChildrenWithDestination(cc.p(this._size.width-this._innerContainer.getSize().width,this._size.height-this._innerContainer.getSize().height),a,c)},scrollToBottomLeft:function(a,c){this._direction!=ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.startAutoScrollChildrenWithDestination(cc.p(0,0),a,c)},scrollToBottomRight:function(a,c){this._direction!=
ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.startAutoScrollChildrenWithDestination(cc.p(this._size.width-this._innerContainer.getSize().width,0),a,c)},scrollToPercentVertical:function(a,c,d){var e=this._size.height-this._innerContainer.getSize().height,f=-e;this.startAutoScrollChildrenWithDestination(cc.p(this._innerContainer.getPosition().x,e+a*f/100),c,d)},scrollToPercentHorizontal:function(a,c,d){var e=this._innerContainer.getSize().width-this._size.width;this.startAutoScrollChildrenWithDestination(cc.p(-(a*
e/100),this._innerContainer.getPosition().y),c,d)},scrollToPercentBothDirection:function(a,c,d){if(this._direction==ccs.ScrollViewDir.both){var e=this._size.height-this._innerContainer.getSize().height,f=-e,g=this._innerContainer.getSize().width-this._size.width;this.startAutoScrollChildrenWithDestination(cc.p(-(a.x*g/100),e+a.y*f/100),c,d)}},jumpToBottom:function(){this.jumpToDestination(cc.p(this._innerContainer.getPosition().x,0))},jumpToTop:function(){this.jumpToDestination(cc.p(this._innerContainer.getPosition().x,
this._size.height-this._innerContainer.getSize().height))},jumpToLeft:function(){this.jumpToDestination(cc.p(0,this._innerContainer.getPosition().y))},jumpToRight:function(){this.jumpToDestination(cc.p(this._size.width-this._innerContainer.getSize().width,this._innerContainer.getPosition().y))},jumpToTopLeft:function(){this._direction!=ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.jumpToDestination(cc.p(0,this._size.height-this._innerContainer.getSize().height))},jumpToTopRight:function(){this._direction!=
ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.jumpToDestination(cc.p(this._size.width-this._innerContainer.getSize().width,this._size.height-this._innerContainer.getSize().height))},jumpToBottomLeft:function(){this._direction!=ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.jumpToDestination(cc.p(0,0))},jumpToBottomRight:function(){this._direction!=ccs.ScrollViewDir.both?cc.log("Scroll diretion is not both!"):this.jumpToDestination(cc.p(this._size.width-this._innerContainer.getSize().width,
0))},jumpToPercentVertical:function(a){var c=this._size.height-this._innerContainer.getSize().height,d=-c;this.jumpToDestination(cc.p(this._innerContainer.getPosition().x,c+a*d/100))},jumpToPercentHorizontal:function(a){var c=this._innerContainer.getSize().width-this._size.width;this.jumpToDestination(cc.p(-(a*c/100),this._innerContainer.getPosition().y))},jumpToPercentBothDirection:function(a){if(this._direction==ccs.ScrollViewDir.both){var c=this._size.height-this._innerContainer.getSize().height,
d=-c,e=this._innerContainer.getSize().width-this._size.width;this.jumpToDestination(cc.p(-(a.x*e/100),c+a.y*d/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,c;switch(this._direction){case ccs.ScrollViewDir.vertical:a=this._touchEndedPoint.y-this._touchBeganPoint.y;c=0>a?ccs.SCROLLDIR_DOWN:
ccs.SCROLLDIR_UP;break;case ccs.ScrollViewDir.horizontal:a=this._touchEndedPoint.x-this._touchBeganPoint.x;c=0>a?ccs.SCROLLDIR_LEFT:ccs.SCROLLDIR_RIGHT;break;case ccs.ScrollViewDir.both:c=cc.pSub(this._touchEndedPoint,this._touchBeganPoint),a=cc.pLength(c),c=cc.pNormalize(c)}a=Math.min(Math.abs(a)/this._slidTime,ccs.AUTOSCROLLMAXSPEED);this.startAutoScrollChildrenWithOriginalSpeed(c,a,!0,-1E3);this._slidTime=0}},handlePressLogic:function(a){this._touchMovingPoint=this._touchBeganPoint=this.convertToNodeSpace(a);
this.startRecordSlidAction();this._bePressed=!0},handleMoveLogic:function(a){this._touchMovedPoint=this.convertToNodeSpace(a);a=cc.pSub(this._touchMovedPoint,this._touchMovingPoint);this._touchMovingPoint=this._touchMovedPoint;switch(this._direction){case ccs.ScrollViewDir.vertical:this.scrollChildren(0,a.y);break;case ccs.ScrollViewDir.horizontal:this.scrollChildren(a.x,0);break;case ccs.ScrollViewDir.both:this.scrollChildren(a.x,a.y)}},handleReleaseLogic:function(a){this._touchEndedPoint=this.convertToNodeSpace(a);
this.endRecordSlidAction();this._bePressed=!1},onTouchBegan:function(a,c){var d=ccs.Layout.prototype.onTouchBegan.call(this,a,c);this._hitted&&this.handlePressLogic(this._touchStartPos);return d},onTouchMoved:function(a,c){ccs.Layout.prototype.onTouchMoved.call(this,a,c);this.handleMoveLogic(this._touchMovePos)},onTouchEnded:function(a,c){ccs.Layout.prototype.onTouchEnded.call(this,a,c);this.handleReleaseLogic(this._touchEndPos)},onTouchCancelled:function(a,c){ccs.Layout.prototype.onTouchCancelled.call(this,
a,c)},onTouchLongClicked:function(a){},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,c,d){switch(a){case 0:this.handlePressLogic(d);break;case 1:a=cc.pSub(c.getTouchStartPos(),d);cc.pLength(a)>this._childFocusCancelOffset&&(c.setFocused(!1),this.handleMoveLogic(d));break;case 2:this.handleReleaseLogic(d);break;case 3:this.handleReleaseLogic(d)}},
checkChildInfo:function(a,c,d){this._enabled&&this._touchEnabled&&this.interceptTouchEvent(a,c,d)},scrollToTopEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.scrollToTop)},scrollToBottomEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.scrollToBottom)},
scrollToLeftEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.scrollToLeft)},scrollToRightEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.scrollToRight)},scrollingEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,
this,ccs.ScrollViewEventType.scrolling)},bounceTopEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.bounceTop)},bounceBottomEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.bounceBottom)},bounceLeftEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&
this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.bounceLeft)},bounceRightEvent:function(){this._scrollViewEventListener&&this._scrollViewEventSelector&&this._scrollViewEventSelector.call(this._scrollViewEventListener,this,ccs.ScrollViewEventType.bounceRight)},addEventListenerScrollView:function(a,c){this._scrollViewEventSelector=a;this._scrollViewEventListener=c},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"},copyClonedWidgetChildren:function(a){ccs.Layout.prototype.copyClonedWidgetChildren.call(this,a)},copySpecialProperties:function(a){ccs.Layout.prototype.copySpecialProperties.call(this,a);this.setInnerContainerSize(a.getInnerContainerSize());this.setDirection(a._direction);this.setBounceEnabled(a._bounceEnabled);this.setInertiaScrollEnabled(a._inertiaScrollEnabled)}});ccs.ScrollView.create=function(){var a=new ccs.ScrollView;return a&&a.init()?a:null};ccs.ListViewEventType={listViewOnselectedItem:0};ccs.ListViewGravity={left:0,right:1,centerHorizontal:2,top:3,bottom:4,centerVertical:5};
ccs.ListView=ccs.ScrollView.extend({_model:null,_items:null,_gravity:null,_itemsMargin:0,_listViewEventListener:null,_listViewEventSelector:null,_curSelectedIndex:0,_refreshViewDirty:!0,ctor:function(){ccs.ScrollView.prototype.ctor.call(this);this._model=null;this._items=[];this._gravity=ccs.ListViewGravity.centerHorizontal;this._itemsMargin=0;this._listViewEventSelector=this._listViewEventListener=null;this._curSelectedIndex=0;this._refreshViewDirty=!0},init:function(){return ccs.ScrollView.prototype.init.call(this)?
(this._items=[],this.setLayoutType(ccs.LayoutType.linearVertical),!0):!1},setItemModel:function(a){a&&(this._model=a)},updateInnerContainerSize:function(){switch(this._direction){case ccs.ScrollViewDir.vertical:for(var a=this._items.length,c=(a-1)*this._itemsMargin,d=0;d<a;d++)var e=this._items[d],c=c+e.getSize().height;a=this._size.width;this.setInnerContainerSize(cc.size(a,c));break;case ccs.ScrollViewDir.horizontal:a=this._items.length;c=(a-1)*this._itemsMargin;for(d=0;d<a;d++)e=this._items[d],
c+=e.getSize().width;a=this._size.height;this.setInnerContainerSize(cc.size(c,a))}},remedyLayoutParameter:function(a){if(a)switch(this._direction){case ccs.ScrollViewDir.vertical:var c=a.getLayoutParameter(ccs.LayoutParameterType.linear);if(c)switch(0==this.getIndex(a)?c.setMargin(ccs.MarginZero()):c.setMargin(new ccs.Margin(0,this._itemsMargin,0,0)),this._gravity){case ccs.ListViewGravity.left:c.setGravity(ccs.LinearGravity.left);break;case ccs.ListViewGravity.right:c.setGravity(ccs.LinearGravity.right);
break;case ccs.ListViewGravity.centerHorizontal:c.setGravity(ccs.LinearGravity.centerHorizontal)}else{c=ccs.LinearLayoutParameter.create();switch(this._gravity){case ccs.ListViewGravity.left:c.setGravity(ccs.LinearGravity.left);break;case ccs.ListViewGravity.right:c.setGravity(ccs.LinearGravity.right);break;case ccs.ListViewGravity.centerHorizontal:c.setGravity(ccs.LinearGravity.centerHorizontal)}0==this.getIndex(a)?c.setMargin(ccs.MarginZero()):c.setMargin(new ccs.Margin(0,this._itemsMargin,0,0));
a.setLayoutParameter(c)}break;case ccs.ScrollViewDir.horizontal:if(c=a.getLayoutParameter(ccs.LayoutParameterType.linear))switch(0==this.getIndex(a)?c.setMargin(ccs.MarginZero()):c.setMargin(new ccs.Margin(this._itemsMargin,0,0,0)),this._gravity){case ccs.ListViewGravity.top:c.setGravity(ccs.LinearGravity.top);break;case ccs.ListViewGravity.bottom:c.setGravity(ccs.LinearGravity.bottom);break;case ccs.ListViewGravity.centerVertical:c.setGravity(ccs.LinearGravity.centerVertical)}else{c=ccs.LinearLayoutParameter.create();
switch(this._gravity){case ccs.ListViewGravity.top:c.setGravity(ccs.LinearGravity.top);break;case ccs.ListViewGravity.bottom:c.setGravity(ccs.LinearGravity.bottom);break;case ccs.ListViewGravity.centerVertical:c.setGravity(ccs.LinearGravity.centerVertical)}0==this.getIndex(a)?c.setMargin(ccs.MarginZero()):c.setMargin(new ccs.Margin(this._itemsMargin,0,0,0));a.setLayoutParameter(c)}}},pushBackDefaultItem:function(){if(this._model){var a=this._model.clone();this._items.push(a);this.remedyLayoutParameter(a);
this.addChild(a);this._refreshViewDirty=!0}},insertDefaultItem:function(a){if(this._model){var c=this._model.clone();cc.ArrayAppendObjectToIndex(this._items,c,a);this.remedyLayoutParameter(c);this.addChild(c);this._refreshViewDirty=!0}},pushBackCustomItem:function(a){this._items.push(a);this.remedyLayoutParameter(a);this.addChild(a);this._refreshViewDirty=!0},insertCustomItem:function(a,c){cc.ArrayAppendObjectToIndex(this._items,a,c);this.remedyLayoutParameter(a);this.addChild(a);this._refreshViewDirty=
!0},removeItem:function(a){if(a=this.getItem(a))cc.ArrayRemoveObject(this._items,a),this.removeChild(a),this._refreshViewDirty=!0},removeLastItem:function(){this.removeItem(this._items.length-1)},getItem:function(a){return 0>a||a>=this._items.length?null:this._items[a]},getItems:function(){return this._items},getIndex:function(a){return cc.ArrayGetIndexOfObject(this._items,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 ccs.ScrollViewDir.vertical:this.setLayoutType(ccs.LayoutType.linearVertical);break;case ccs.ScrollViewDir.horizontal:this.setLayoutType(ccs.LayoutType.linearHorizontal);break;case ccs.ScrollViewDir.both:return;default:return}ccs.ScrollView.prototype.setDirection.call(this,a)},addEventListenerListView:function(a,c){this._listViewEventListener=c;this._listViewEventSelector=
a},selectedItemEvent:function(){this._listViewEventSelector&&this._listViewEventListener&&this._listViewEventSelector.call(this._listViewEventListener,this,ccs.ListViewEventType.listViewOnselectedItem)},interceptTouchEvent:function(a,c,d){ccs.ScrollView.prototype.interceptTouchEvent.call(this,a,c,d);if(1!=a){for(a=c;a;){if(a&&a.getParent()==this._innerContainer){this._curSelectedIndex=this.getIndex(a);break}a=a.getParent()}this.selectedItemEvent()}},getCurSelectedIndex:function(){return this._curSelectedIndex},
requestRefreshView:function(){this._refreshViewDirty=!0},refreshView:function(){for(var a=0;a<this._items.length;a++){var c=this._items[a];c.setZOrder(a);this.remedyLayoutParameter(c)}this.updateInnerContainerSize()},sortAllChildren:function(){ccs.ScrollView.prototype.sortAllChildren.call(this);this._refreshViewDirty&&(this.refreshView(),this._refreshViewDirty=!1)},onSizeChanged:function(){ccs.ScrollView.prototype.onSizeChanged.call(this);this._refreshViewDirty=!0},getDescription:function(){return"ListView"},
createCloneInstance:function(){return ccs.ListView.create()},copyClonedWidgetChildren:function(a){a=a.getItems();for(var c=0;c<a.length;c++)this.pushBackCustomItem(a[c].clone())},copySpecialProperties:function(a){ccs.ScrollView.prototype.copySpecialProperties.call(this,a);this.setItemModel(a._model);this.setItemsMargin(a._itemsMargin);this.setGravity(a._gravity)}});ccs.ListView.create=function(){var a=new ccs.ListView;return a&&a.init()?a:null};ccs.PageViewEventType={turning:0};ccs.PVTouchDir={touchLeft:0,touchRight:1};
ccs.PageView=ccs.Layout.extend({_curPageIdx:0,_pages:null,_touchMoveDir:null,_touchStartLocation:0,_touchMoveStartLocation:0,_movePagePoint:null,_leftChild:null,_rightChild:null,_leftBoundary:0,_rightBoundary:0,_isAutoScrolling:!1,_autoScrollDistance:0,_autoScrollSpeed:0,_autoScrollDir:0,_childFocusCancelOffset:0,_pageViewEventListener:null,_pageViewEventSelector:null,ctor:function(){ccs.Layout.prototype.ctor.call(this);this._curPageIdx=0;this._pages=[];this._touchMoveDir=ccs.PVTouchDir.touchLeft;
this._touchMoveStartLocation=this._touchStartLocation=0;this._rightChild=this._leftChild=this._movePagePoint=null;this._rightBoundary=this._leftBoundary=0;this._isAutoScrolling=!1;this._autoScrollDir=this._autoScrollSpeed=this._autoScrollDistance=0;this._childFocusCancelOffset=5;this._pageViewEventSelector=this._pageViewEventListener=null},init:function(){return ccs.Layout.prototype.init.call(this)?(this._pages=[],this.setClippingEnabled(!0),this.setTouchEnabled(!0),!0):!1},onEnter:function(){ccs.Layout.prototype.onEnter.call(this);
this.setUpdateEnabled(!0)},addWidgetToPage:function(a,c,d){if(a&&!(0>c)){var e=this._pages.length;c>=e?d&&(c>e&&cc.log("pageIdx is %d, it will be added as page id [%d]",c,e),c=this.createPage(),c.addChild(a),this.addPage(c)):(c=this._pages[c])&&c.addChild(a)}},createPage:function(){var a=ccs.Layout.create();a.setSize(this.getSize());return a},addPage:function(a){if(a&&a.getWidgetType()==ccs.WidgetType.container&&!cc.ArrayContainsObject(this._pages,a)){var c=a.getSize(),d=this.getSize();if(c.width!=
d.width||c.height!=d.height)cc.log("page size does not match pageview size, it will be force sized!"),a.setSize(d);a.setPosition(cc.p(this.getPositionXByIndex(this._pages.length),0));this._pages.push(a);this.addChild(a);this.updateBoundaryPages()}},insertPage:function(a,c){if(!(0>c)&&a&&a.getWidgetType()==ccs.WidgetType.container&&!cc.ArrayContainsObject(this._pages,a))if(c>=this._pages.length)this.addPage(a);else{cc.ArrayAppendObjectToIndex(this._pages,a,c);a.setPosition(cc.p(this.getPositionXByIndex(c),
0));this.addChild(a);var d=a.getSize(),e=this.getSize();d.equals(e)||(cc.log("page size does not match pageview size, it will be force sized!"),a.setSize(e));for(var d=this._pages,e=d.length,f=c+1;f<e;f++){var g=d[f],h=g.getPosition();g.setPosition(cc.p(h.x+this.getSize().width,0))}this.updateBoundaryPages()}},removePage:function(a){a&&(this.removeChild(a),this.updateChildrenPosition(),this.updateBoundaryPages())},removePageAtIndex:function(a){0>a||a>=this._pages.length||(a=this._pages[a])&&this.removePage(a)},
updateBoundaryPages:function(){0>=this._pages.length?this._rightChild=this._leftChild=null:(this._leftChild=this._pages[0],this._rightChild=this._pages[this._pages.length-1])},getPositionXByIndex:function(a){return this.getSize().width*(a-this._curPageIdx)},addChild:function(a,c,d){return ccs.Layout.prototype.addChild.call(this,a,c,d)},removeChild:function(a,c){c&&cc.ArrayRemoveObject(this._pages,a);ccs.Layout.prototype.removeChild.call(this,a,c)},onSizeChanged:function(){ccs.Layout.prototype.onSizeChanged.call(this);
this._rightBoundary=this.getSize().width;this.updateChildrenSize();this.updateChildrenPosition()},updateChildrenSize:function(){if(!(0>=!this._pages.length))for(var a=this.getSize(),c=0;c<this._pages.length;c++)this._pages[c].setSize(a)},updateChildrenPosition:function(){if(this._pages){var a=this._pages.length;if(0>=a)this._curPageIdx=0;else{this._curPageIdx>=a&&(this._curPageIdx=a-1);for(var c=this.getSize().width,d=this._pages,e=0;e<a;e++)d[e].setPosition(cc.p((e-this._curPageIdx)*c,0))}}},removeAllChildren:function(a){a&&
(this._pages.length=0);ccs.Layout.prototype.removeAllChildren.call(this,a)},scrollToPage:function(a){0>a||a>=this._pages.length||(this._curPageIdx=a,this._autoScrollDistance=-this._pages[a].getPosition().x,this._autoScrollSpeed=Math.abs(this._autoScrollDistance)/0.2,this._autoScrollDir=0<this._autoScrollDistance?1:0,this._isAutoScrolling=!0)},update:function(a){if(this._isAutoScrolling)switch(this._autoScrollDir){case 0:a*=this._autoScrollSpeed;0<=this._autoScrollDistance+a?(a=-this._autoScrollDistance,
this._autoScrollDistance=0,this._isAutoScrolling=!1):this._autoScrollDistance+=a;this.scrollPages(-a);this._isAutoScrolling||this.pageTurningEvent();break;case 1:a*=this._autoScrollSpeed,0>=this._autoScrollDistance-a?(a=this._autoScrollDistance,this._autoScrollDistance=0,this._isAutoScrolling=!1):this._autoScrollDistance-=a,this.scrollPages(a),this._isAutoScrolling||this.pageTurningEvent()}},onTouchBegan:function(a,c){var d=ccs.Layout.prototype.onTouchBegan.call(this,a,c);this._hitted&&this.handlePressLogic(a.getLocation());
return d},onTouchMoved:function(a,c){var d=a.getLocation();this._touchMovePos.x=d.x;this._touchMovePos.y=d.y;this.handleMoveLogic(d);var e=this.getWidgetParent();e&&e.checkChildInfo(1,this,d);this.moveEvent();this.hitTest(d)||(this.setFocused(!1),this.onTouchEnded(a,c))},onTouchEnded:function(a,c){ccs.Layout.prototype.onTouchEnded.call(this,a,c);this.handleReleaseLogic(this._touchEndPos)},onTouchCancelled:function(a,c){var d=a.getLocation();ccs.Layout.prototype.onTouchCancelled.call(this,a,c);this.handleReleaseLogic(d)},
movePages:function(a){for(var c=this._pages,d=c.length,e=0;e<d;e++){var f=c[e],g=f.getPosition();f.setPosition(cc.p(g.x+a,g.y))}},scrollPages:function(a){if(0>=this._pages.length||!this._leftChild||!this._rightChild)return!1;var c=a;switch(this._touchMoveDir){case ccs.PVTouchDir.touchLeft:if(this._rightChild.getRightInParent()+a<=this._rightBoundary)return c=this._rightBoundary-this._rightChild.getRightInParent(),this.movePages(c),!1;break;case ccs.PVTouchDir.touchRight:if(this._leftChild.getLeftInParent()+
a>=this._leftBoundary)return c=this._leftBoundary-this._leftChild.getLeftInParent(),this.movePages(c),!1}this.movePages(c);return!0},handlePressLogic:function(a){a=this.convertToNodeSpace(a);this._touchStartLocation=this._touchMoveStartLocation=a.x},handleMoveLogic:function(a){var c=0;a=this.convertToNodeSpace(a).x;c=a-this._touchMoveStartLocation;this._touchMoveStartLocation=a;0>c?this._touchMoveDir=ccs.PVTouchDir.touchLeft:0<c&&(this._touchMoveDir=ccs.PVTouchDir.touchRight);this.scrollPages(c)},
handleReleaseLogic:function(a){if(!(0>=this._pages.length)&&(a=this._pages[this._curPageIdx])){var c=a.getPosition();a=this._pages.length;var c=c.x,d=this.getSize().width/2;c<=-d?this._curPageIdx>=a-1?this.scrollPages(-c):this.scrollToPage(this._curPageIdx+1):c>=d?0>=this._curPageIdx?this.scrollPages(-c):this.scrollToPage(this._curPageIdx-1):this.scrollToPage(this._curPageIdx)}},checkChildInfo:function(a,c,d){this._enabled&&this._touchEnabled&&this.interceptTouchEvent(a,c,d)},interceptTouchEvent:function(a,
c,d){switch(a){case 0:this.handlePressLogic(d);break;case 1:a=0;a=Math.abs(c.getTouchStartPos().x-d.x);a>this._childFocusCancelOffset&&(c.setFocused(!1),this.handleMoveLogic(d));break;case 2:this.handleReleaseLogic(d)}},pageTurningEvent:function(){this._pageViewEventListener&&this._pageViewEventSelector&&this._pageViewEventSelector.call(this._pageViewEventListener,this,ccs.PageViewEventType.turning)},addEventListenerPageView:function(a,c){this._pageViewEventSelector=a;this._pageViewEventListener=
c},getPages:function(){return this._pages},getCurPageIndex:function(){return this._curPageIdx},getDescription:function(){return"PageView"},createCloneInstance:function(){return ccs.PageView.create()},copyClonedWidgetChildren:function(a){a=a.getPages();for(var c=0;c<a.length;c++)this.addPage(a[c].clone())},copySpecialProperties:function(a){ccs.Layout.prototype.copySpecialProperties.call(this,a)},doLayout:function(){this._doLayoutDirty&&(this._doLayoutDirty=!1)}});
ccs.PageView.create=function(){var a=new ccs.PageView;return a&&a.init()?a:null};ccs.ObjectFactory=ccs.Class.extend({_typeMap:null,ctor:function(){this._typeMap={}},destroyInstance:function(){this._instance=null},createObject:function(a){var c=null;(a=this._typeMap[a])&&(c=new a._fun);return c},registerType:function(a){this._typeMap[a._className]=a}});ccs.ObjectFactory._instance=null;ccs.ObjectFactory.getInstance=function(){this._instance||(this._instance=new ccs.ObjectFactory);return this._instance};
ccs.TInfo=ccs.Class.extend({_className:"",_fun:null,ctor:function(a,c){c?(this._className=a,this._fun=c):(this._className=a._className,this._fun=a._fun);ccs.ObjectFactory.getInstance().registerType(this)}});ccs.sendEvent=function(a){a=ccs.TriggerMng.getInstance().get(a);if(null!=a)for(var c=0;c<a.length;c++){var d=a[c];null!=d&&d.detect()&&d.done()}};ccs.registerTriggerClass=function(a,c){new ccs.TInfo(a,c)};ccs.TriggerMng=ccs.Class.extend({_eventTriggers:null,_triggerObjs:null,_movementDispatches:null,ctor:function(){this._eventTriggers={};this._triggerObjs={};this._movementDispatches=[]},destroyInstance:function(){this.removeAll();this._instance=null},parse:function(a){for(var c=0;c<a.length;++c){var d=a[c],e=ccs.TriggerObj.create();e.serialize(d);for(var d=e.getEvents(),f=0;f<d.length;f++)this.add(d[f],e);this._triggerObjs[e.getId()]=e}},get:function(a){return this._eventTriggers[a]},getTriggerObj:function(a){return this._triggerObjs[a]},
add:function(a,c){var d=this._eventTriggers[a];d||(d=[]);cc.ArrayContainsObject(d,c)||(d.push(c),this._eventTriggers[a]=d)},removeAll:function(){for(var a in this._eventTriggers)for(var c=this._eventTriggers[a],d=0;d<c.length;d++)c[d].removeAll();this._eventTriggers={}},remove:function(a,c){if(c)return this._removeObj(a,c);var d=!1,e=this._eventTriggers[a];if(e){for(d=0;d<e.length;d++){var f=e[d];f&&f.removeAll()}delete this._eventTriggers[a];d=!0}return d},_removeObj:function(a,c){var d=!1;do{var e=
this._eventTriggers[a];if(e){for(d=0;d<e.length;d++){var f=e[d];if(f&&f==c){f.removeAll();e.splice(d,1);break}}d=!0}}while(0);return d},removeTriggerObj:function(a){a=this.getTriggerObj(a);if(!a)return!1;for(var c=a.getEvents(),d=0;d<c.length;d++)this.remove(c[d],a);return!0},isEmpty:function(){return!this._eventTriggers||0>=this._eventTriggers.length},addArmatureMovementCallBack:function(a,c,d){if(null!=a&&null!=d&&null!=c){for(var e,f=!1,g=0;g<this._movementDispatches.length;g++)(e=this._movementDispatches[g])&&
e[0]==a&&(e.addAnimationEventCallBack(c,d),f=!0);f||(e=new ccs.ArmatureMovementDispatcher,a.getAnimation().setMovementEventCallFunc(e.animationEvent,e),e.addAnimationEventCallBack(c,d),this._movementDispatches.push([a,e]))}},removeArmatureMovementCallBack:function(a,c,d){if(null!=a&&null!=c&&null!=d)for(var e,f=0;f<this._movementDispatches.length;f++)(e=this._movementDispatches[f])&&e[0]==a&&e.removeAnimationEventCallBack(d,c)},removeArmatureAllMovementCallBack:function(a){if(null!=a)for(var c,d=
0;d<this._movementDispatches.length;d++)if((c=this._movementDispatches[d])&&c[0]==a){this._movementDispatches.splice(d,1);break}},removeAllArmatureMovementCallBack:function(){this._movementDispatches=[]}});ccs.TriggerMng.triggerMngVersion=function(){return"1.2.0.0"};ccs.TriggerMng._instance=null;ccs.TriggerMng.getInstance=function(){null==this._instance&&(this._instance=new ccs.TriggerMng);return this._instance};
ccs.ArmatureMovementDispatcher=ccs.Class.extend({_mapEventAnimation:null,ctor:function(){this._mapEventAnimation=[]},animationEvent:function(a,c,d){for(var e,f,g=0;g<this._mapEventAnimation.length;g++)e=this._mapEventAnimation[g],f=e[0],(e=e[1])&&e.call(f,a,c,d)},addAnimationEventCallBack:function(a,c){this._mapEventAnimation.push([c,a])},removeAnimationEventCallBack:function(a,c){for(var d,e=0;e<this._mapEventAnimation.length;e++)d=this._mapEventAnimation[e],d[0]==c&&this._mapEventAnimation.splice(e,
1)}});ccs.BaseTriggerCondition=ccs.Class.extend({ctor:function(){},init:function(){return!0},detect:function(){return!0},serialize:function(a){},removeAll:function(){}});ccs.BaseTriggerAction=ccs.Class.extend({ctor:function(){},init:function(){return!0},done:function(){},serialize:function(a){},removeAll:function(){}});
ccs.TriggerObj=ccs.Class.extend({_cons:null,_acts:null,_id:0,_enable:!0,_vInt:null,ctor:function(){this._id=0;this._enable=!0},init:function(){this._cons=[];this._acts=[];this._vInt=[];return!0},detect:function(){if(!this._enable||0==this._cons.length)return!0;for(var a=!0,c=null,d=0;d<this._cons.length;d++)(c=this._cons[d])&&c.detect&&(a=a&&c.detect());return a},done:function(){if(this._enable&&0!=this._acts.length)for(var a,c=0;c<this._acts.length;c++)(a=this._acts[c])&&a.done&&a.done()},removeAll:function(){for(var a=
null,c=0;c<this._cons.length;c++)(a=this._cons[c])&&a.removeAll();this._cons=[];for(c=0;c<this._acts.length;c++)(a=this._acts[c])&&a.removeAll();this._acts=[]},serialize:function(a){this._id=a.id||0;for(var c=a.conditions||[],d=0;d<c.length;d++){var e=c[d],f=e.classname,g=ccs.ObjectFactory.getInstance().createObject(f);g?(g.serialize(e),g.init(),this._cons.push(g)):cc.log("class named classname("+f+") can not implement!")}c=a.actions||[];for(d=0;d<c.length;d++)e=c[d],f=e.classname,(g=ccs.ObjectFactory.getInstance().createObject(f))?
(g.serialize(e),g.init(),this._acts.push(g)):cc.log("class named classname("+f+") can not implement!");a=a.events||[];for(d=0;d<a.length;d++)e=a[d],e=e.id,0>e||this._vInt.push(e)},getId:function(){return this._id},setEnable:function(a){this._enable=a},getEvents:function(){return this._vInt}});ccs.TriggerObj.create=function(){var a=new ccs.TriggerObj;return a.init()?a:null};ccs.GUIReader=ccs.Class.extend({_filePath:"",_olderVersion:!1,_fileDesignSizes:{},ctor:function(){this._filePath="";this._olderVersion=!1;this._fileDesignSizes={}},getVersionInteger:function(a){if(!a)return 0;var c=a,d=c.length;if(7>d)return 0;var e=c.indexOf("."),f=c.substr(0,e),c=c.substr(e+1,d-1),e=c.indexOf("."),g=c.substr(0,e),c=c.substr(e+1,d-1),e=c.indexOf(".");a=c.substr(0,e);c=c.substr(e+1,d-1);e=c.indexOf(".");c=-1==e?c:c.substr(0,e);f=parseInt(f);g=parseInt(g);a=parseInt(a);c=parseInt(c);
return 1E3*f+100*g+10*a+c},storeFileDesignSize:function(a,c){this._fileDesignSizes[a]=c},getFileDesignSize:function(a){return this._fileDesignSizes[a]},widgetFromJsonFile:function(a){var c=a||"",d=c.lastIndexOf("/");this._filePath=c.substr(0,d+1);c=cc.FileUtils.getInstance().getTextFileData(c);if(!c)return cc.log("read json file["+a+"] error!"),null;var e=JSON.parse(c),c=e.version,d=this.getVersionInteger(c);a=(c?250>d?new ccs.WidgetPropertiesReader0250:new ccs.WidgetPropertiesReader0300:new ccs.WidgetPropertiesReader0250).createWidget(e,
this._filePath,a);if(!c||250>d)this._olderVersion=!0;return a}});ccs.WidgetPropertiesReader=ccs.Class.extend({_filePath:"",createWidget:function(a,c,d){},widgetFromJsonDictionary:function(a){}});
ccs.WidgetPropertiesReader0250=ccs.WidgetPropertiesReader.extend({createWidget:function(a,c,d){this._filePath=c;for(var e=a.textures,f=0;f<e.length;f++){var g=c,g=g+e[f];cc.SpriteFrameCache.getInstance().addSpriteFrames(g)}c=a.designWidth;e=a.designHeight;0>=c||0>=e?(cc.log("Read design size error!"),f=cc.Director.getInstance().getWinSize(),ccs.GUIReader.getInstance().storeFileDesignSize(d,f)):ccs.GUIReader.getInstance().storeFileDesignSize(d,cc.size(c,e));f=this.widgetFromJsonDictionary(a.widgetTree);
g=f.getContentSize();0==g.width&&0==g.height&&f.setSize(cc.size(c,e));a=a.animation;ccs.ActionManager.getInstance().initWithDictionary(d,a,f);return f},widgetFromJsonDictionary:function(a){var c=null,d=a.classname,e=a.options;"Button"==d?(c=ccs.Button.create(),this.setPropsForButtonFromJsonDictionary(c,e)):"CheckBox"==d?(c=ccs.CheckBox.create(),this.setPropsForCheckBoxFromJsonDictionary(c,e)):"Label"==d?(c=ccs.Label.create(),this.setPropsForLabelFromJsonDictionary(c,e)):"LabelAtlas"==d?(c=ccs.LabelAtlas.create(),
this.setPropsForLabelAtlasFromJsonDictionary(c,e)):"LoadingBar"==d?(c=ccs.LoadingBar.create(),this.setPropsForLoadingBarFromJsonDictionary(c,e)):"ScrollView"==d?(c=ccs.ScrollView.create(),this.setPropsForScrollViewFromJsonDictionary(c,e)):"TextArea"==d?(c=ccs.Label.create(),this.setPropsForLabelFromJsonDictionary(c,e)):"TextButton"==d?(c=ccs.Button.create(),this.setPropsForButtonFromJsonDictionary(c,e)):"TextField"==d?(c=ccs.TextField.create(),this.setPropsForTextFieldFromJsonDictionary(c,e)):"ImageView"==
d?(c=ccs.ImageView.create(),this.setPropsForImageViewFromJsonDictionary(c,e)):"Panel"==d?(c=ccs.Layout.create(),this.setPropsForLayoutFromJsonDictionary(c,e)):"Slider"==d?(c=ccs.Slider.create(),this.setPropsForSliderFromJsonDictionary(c,e)):"LabelBMFont"==d?(c=ccs.LabelBMFont.create(),this.setPropsForLabelBMFontFromJsonDictionary(c,e)):"DragPanel"==d&&(c=ccs.ScrollView.create(),this.setPropsForScrollViewFromJsonDictionary(c,e));a=a.children;for(d=0;d<a.length;d++)(e=this.widgetFromJsonDictionary(a[d]))&&
c.addChild(e);return c},setPropsForWidgetFromJsonDictionary:function(a,c){void 0!==c.ignoreSize&&a.ignoreContentAdaptWithSize(c.ignoreSize);a.setSize(cc.size(c.width,c.height));a.setTag(c.tag);a.setActionTag(c.actiontag);a.setTouchEnabled(c.touchAble);var d=c.name;a.setName(d?d:"default");a.setPosition(cc.p(c.x,c.y));void 0!==c.scaleX&&a.setScaleX(c.scaleX);void 0!==c.scaleY&&a.setScaleY(c.scaleY);void 0!==c.rotation&&a.setRotation(c.rotation);void 0!==c.visible&&a.setVisible(c.visible);a.setZOrder(c.ZOrder)},
setColorPropsForWidgetFromJsonDictionary:function(a,c){void 0!==c.opacity&&a.setOpacity(c.opacity);a.setColor(cc.c3b(void 0!==c.colorR?c.colorR:255,void 0!==c.colorG?c.colorG:255,void 0!==c.colorB?c.colorB:255));var d=void 0!==c.anchorPointX?c.anchorPointX:a.getWidgetType()==ccs.WidgetType.widget?0.5:0,e=void 0!==c.anchorPointY?c.anchorPointY:a.getWidgetType()==ccs.WidgetType.widget?0.5:0;a.setAnchorPoint(d,e);d=c.flipY;a.setFlippedX(c.flipX);a.setFlippedY(d)},setPropsForButtonFromJsonDictionary:function(a,
c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.scale9Enable;a.setScale9Enabled(d);var e=c.normal,f=c.pressed,g=c.disabled,h=e?this._filePath+e:null,k=f?this._filePath+f:null,m=g?this._filePath+g:null,n=c.useMergedTexture;d?(n?a.loadTextures(e,f,g,ccs.TextureResType.plist):a.loadTextures(h,k,m),void 0!==c.scale9Width&&void 0!==c.scale9Height&&a.setSize(cc.size(c.scale9Width,c.scale9Height))):n?a.loadTextures(e,f,g,ccs.TextureResType.plist):a.loadTextures(h,k,m);void 0!==c.text&&(d=c.text||
"")&&a.setTitleText(d);void 0!==c.fontSize&&a.setTitleFontSize(c.fontSize);void 0!==c.fontName&&a.setTitleFontName(c.fontName);d=cc.c3b(void 0!==c.textColorR?c.textColorR:255,void 0!==c.textColorG?c.textColorG:255,void 0!==c.textColorB?c.textColorB:255);a.setTitleColor(d);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForCheckBoxFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.backGroundBox,e=c.backGroundBoxSelected,f=c.frontCross,g=c.backGroundBoxDisabled,
h=c.frontCrossDisabled,k=this._filePath,m=d?k+d:null,n=e?k+e:null,p=f?k+f:null,q=g?k+g:null,k=h?k+h:null;c.useMergedTexture?a.loadTextures(d,e,f,g,h,ccs.TextureResType.plist):a.loadTextures(m,n,p,q,k);a.setSelectedState(c.selectedState||!1);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForImageViewFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.fileName,e=c.scale9Enable||!1;a.setScale9Enabled(e);var f=this._filePath,g=null;d&&(g=f+d);f=c.useMergedTexture;
e?(f?a.loadTexture(d,ccs.TextureResType.plist):a.loadTexture(g),void 0!==c.scale9Width&&void 0!==c.scale9Height&&a.setSize(cc.size(c.scale9Width,c.scale9Height)),a.setCapInsets(cc.rect(c.capInsetsX,c.capInsetsY,c.capInsetsWidth,c.capInsetsHeight))):f?a.loadTexture(d,ccs.TextureResType.plist):a.loadTexture(g);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForLabelFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);a.setTouchScaleChangeEnabled(c.touchScaleEnable);
a.setText(c.text);void 0!==c.fontSize&&a.setFontSize(c.fontSize);void 0!==c.fontName&&a.setFontName(c.fontName);if(void 0!==c.areaWidth&&void 0!==c.areaHeight){var d=cc.size(c.areaWidth,c.areaHeight);a.setTextAreaSize(d)}c.hAlignment&&a.setTextHorizontalAlignment(c.hAlignment);c.vAlignment&&a.setTextVerticalAlignment(c.vAlignment);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForLabelAtlasFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=void 0!==c.charMapFile,
e=void 0!==c.itemWidth,f=void 0!==c.itemHeight,g=void 0!==c.startCharMap;void 0!==c.stringValue&&d&&e&&f&&g&&c.charMapFile&&a.setProperty(c.stringValue,this._filePath+c.charMapFile,c.itemWidth,c.itemHeight,c.startCharMap);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForLayoutFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);a instanceof ccs.ScrollView||a instanceof ccs.ListView||a.setClippingEnabled(c.clipAble);var d=c.backGroundScale9Enable;a.setBackGroundImageScale9Enabled(d);
var e=c.bgColorR,f=c.bgColorG,g=c.bgColorB,h=c.bgStartColorR,k=c.bgStartColorG,m=c.bgStartColorB,n=c.bgEndColorR,p=c.bgEndColorG,q=c.bgEndColorB;a.setBackGroundColorVector(cc.p(c.vectorX,c.vectorY));var s=c.bgColorOpacity;a.setBackGroundColorType(c.colorType);a.setBackGroundColor(cc.c3b(h,k,m),cc.c3b(n,p,q));a.setBackGroundColor(cc.c3b(e,f,g));a.setBackGroundColorOpacity(s);f=(e=c.backGroundImage)?this._filePath+e:null;c.useMergedTexture?a.setBackGroundImage(e,ccs.TextureResType.plist):a.setBackGroundImage(f);
d&&a.setBackGroundImageCapInsets(cc.rect(c.capInsetsX,c.capInsetsY,c.capInsetsWidth,c.capInsetsHeight));this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForScrollViewFromJsonDictionary:function(a,c){this.setPropsForLayoutFromJsonDictionary(a,c);a.setInnerContainerSize(cc.size(c.innerWidth,c.innerHeight));a.setDirection(c.direction);a.setBounceEnabled(c.bounceEnable);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForContainerWidgetFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,
c);(a instanceof ccs.ScrollView||a instanceof ccs.ListView)&&a.setClippingEnabled(c.clipAble);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForSliderFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.barTextureScale9Enable||!1;a.setScale9Enabled(d);var e=c.length,f=c.useMergedTexture;if(void 0!==c.barFileName)if(d){var g=(d=c.barFileName)?this._filePath+d:null;f?a.loadBarTexture(d,ccs.TextureResType.plist):a.loadBarTexture(g);a.setSize(cc.size(e,a.getContentSize().height))}else g=
(d=c.barFileName)?this._filePath+d:null,f?a.loadBarTexture(d,ccs.TextureResType.plist):a.loadBarTexture(g);var e=c.ballNormal,d=c.ballPressed,g=c.ballDisabled,h=e?this._filePath+e:null,k=d?this._filePath+d:null,m=g?this._filePath+g:null;f?a.loadSlidBallTextures(e,d,g,ccs.TextureResType.plist):a.loadSlidBallTextures(h,k,m);a.setPercent(c.percent);g=(d=c.progressBarFileName)?this._filePath+d:null;f?a.loadProgressBarTexture(d,ccs.TextureResType.plist):a.loadProgressBarTexture(g);this.setColorPropsForWidgetFromJsonDictionary(a,
c)},setPropsForTextAreaFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);a.setText(c.text);void 0!==c.fontSize&&a.setFontSize(c.fontSize);a.setColor(cc.c3b(c.colorR,c.colorG,c.colorB));a.setFontName(c.fontName);if(void 0!==c.areaWidth&&void 0!==c.areaHeight){var d=cc.size(c.areaWidth,c.areaHeight);a.setTextAreaSize(d)}c.hAlignment&&a.setTextHorizontalAlignment(c.hAlignment);c.vAlignment&&a.setTextVerticalAlignment(c.vAlignment);this.setColorPropsForWidgetFromJsonDictionary(a,
c)},setPropsForTextButtonFromJsonDictionary:function(a,c){this.setPropsForButtonFromJsonDictionary(a,c);a.setTitleText(c.text||"");a.setTitleColor(cc.c3b(void 0!==c.textColorR?c.textColorR:255,void 0!==c.textColorG?c.textColorG:255,void 0!==c.textColorB?c.textColorB:255));void 0!==c.fontSize&&a.setTitleFontSize(c.fontSize);void 0!==c.fontName&&a.setTitleFontName(c.fontName);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForTextFieldFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,
c);void 0!==c.placeHolder&&a.setPlaceHolder(c.placeHolder);a.setText(c.text);void 0!==c.fontSize&&a.setFontSize(c.fontSize);void 0!==c.fontName&&a.setFontName(c.fontName);void 0!==c.touchSizeWidth&&void 0!==c.touchSizeHeight&&a.setTouchSize(cc.size(c.touchSizeWidth,c.touchSizeHeight));var d=c.maxLengthEnable;a.setMaxLengthEnabled(d);d&&a.setMaxLength(c.maxLength);d=c.passwordEnable;a.setPasswordEnabled(d);d&&a.setPasswordStyleText(c.passwordStyleText);this.setColorPropsForWidgetFromJsonDictionary(a,
c)},setPropsForLoadingBarFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.texture,e=d?this._filePath+d:null;c.useMergedTexture?a.loadTexture(d,ccs.TextureResType.plist):a.loadTexture(e);a.setDirection(c.direction);a.setPercent(c.percent);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForListViewFromJsonDictionary:function(a,c){this.setPropsForLayoutFromJsonDictionary(a,c)},setPropsForPageViewFromJsonDictionary:function(a,c){this.setPropsForLayoutFromJsonDictionary(a,
c)},setPropsForLabelBMFontFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);a.setFntFile(this._filePath+c.fileName);a.setText(c.text);this.setColorPropsForWidgetFromJsonDictionary(a,c)}});
ccs.WidgetPropertiesReader0300=ccs.WidgetPropertiesReader.extend({createWidget:function(a,c,d){this._filePath=c;for(var e=a.textures,f=0;f<e.length;f++){var g=c,g=g+e[f];cc.SpriteFrameCache.getInstance().addSpriteFrames(g)}c=a.designWidth;e=a.designHeight;0>=c||0>=e?(cc.log("Read design size error!"),f=cc.Director.getInstance().getWinSize(),ccs.GUIReader.getInstance().storeFileDesignSize(d,f)):ccs.GUIReader.getInstance().storeFileDesignSize(d,cc.size(c,e));f=this.widgetFromJsonDictionary(a.widgetTree);
g=f.getContentSize();0==g.width&&0==g.height&&f.setSize(cc.size(c,e));a=a.animation;ccs.ActionManager.getInstance().initWithDictionary(d,a,f);return f},widgetFromJsonDictionary:function(a){var c=null,d=a.classname,e=a.options;"Button"==d?(c=ccs.Button.create(),this.setPropsForButtonFromJsonDictionary(c,e)):"CheckBox"==d?(c=ccs.CheckBox.create(),this.setPropsForCheckBoxFromJsonDictionary(c,e)):"Label"==d?(c=ccs.Label.create(),this.setPropsForLabelFromJsonDictionary(c,e)):"LabelAtlas"==d?(c=ccs.LabelAtlas.create(),
this.setPropsForLabelAtlasFromJsonDictionary(c,e)):"LoadingBar"==d?(c=ccs.LoadingBar.create(),this.setPropsForLoadingBarFromJsonDictionary(c,e)):"ScrollView"==d?(c=ccs.ScrollView.create(),this.setPropsForScrollViewFromJsonDictionary(c,e)):"TextArea"==d?(c=ccs.Label.create(),this.setPropsForLabelFromJsonDictionary(c,e)):"TextButton"==d?(c=ccs.Button.create(),this.setPropsForButtonFromJsonDictionary(c,e)):"TextField"==d?(c=ccs.TextField.create(),this.setPropsForTextFieldFromJsonDictionary(c,e)):"ImageView"==
d?(c=ccs.ImageView.create(),this.setPropsForImageViewFromJsonDictionary(c,e)):"Panel"==d?(c=ccs.Layout.create(),this.setPropsForLayoutFromJsonDictionary(c,e)):"Slider"==d?(c=ccs.Slider.create(),this.setPropsForSliderFromJsonDictionary(c,e)):"LabelBMFont"==d?(c=ccs.LabelBMFont.create(),this.setPropsForLabelBMFontFromJsonDictionary(c,e)):"DragPanel"==d?(c=ccs.ScrollView.create(),this.setPropsForScrollViewFromJsonDictionary(c,e)):"ListView"==d?(c=ccs.ListView.create(),this.setPropsForListViewFromJsonDictionary(c,
e)):"PageView"==d&&(c=ccs.PageView.create(),this.setPropsForPageViewFromJsonDictionary(c,e));a=a.children;for(d=0;d<a.length;d++)(e=this.widgetFromJsonDictionary(a[d]))&&(c instanceof ccs.PageView&&e instanceof ccs.Layout?c.addPage(e):c instanceof ccs.ListView?c.pushBackCustomItem(e):c.addChild(e));return c},setPropsForWidgetFromJsonDictionary:function(a,c){void 0!==c.ignoreSize&&a.ignoreContentAdaptWithSize(c.ignoreSize);a.setSizeType(c.sizeType);a.setPositionType(c.positionType);a.setSizePercent(cc.p(c.sizePercentX,
c.sizePercentY));a.setPositionPercent(cc.p(c.positionPercentX,c.positionPercentY));a.setSize(cc.size(c.width,c.height));a.setTag(c.tag);a.setActionTag(c.actiontag);a.setTouchEnabled(c.touchAble);var d=c.name;a.setName(d?d:"default");a.setPosition(cc.p(c.x,c.y));void 0!==c.scaleX&&a.setScaleX(c.scaleX);void 0!==c.scaleY&&a.setScaleY(c.scaleY);void 0!==c.rotation&&a.setRotation(c.rotation);void 0!==c.visible&&a.setVisible(c.visible);a.setZOrder(c.ZOrder);if(d=c.layoutParameter){var e;switch(d.type){case 1:e=
ccs.LinearLayoutParameter.create();e.setGravity(d.gravity);break;case 2:e=ccs.RelativeLayoutParameter.create(),e.setRelativeName(d.relativeName),e.setRelativeToWidgetName(d.relativeToName),e.setAlign(d.align)}e.setMargin(new ccs.Margin(d.marginLeft,d.marginTop,d.marginRight,d.marginDown));a.setLayoutParameter(e)}},setColorPropsForWidgetFromJsonDictionary:function(a,c){void 0!==c.opacity&&a.setOpacity(c.opacity);a.setColor(cc.c3b(void 0!==c.colorR?c.colorR:255,void 0!==c.colorG?c.colorG:255,void 0!==
c.colorB?c.colorB:255));var d=void 0!==c.anchorPointX?c.anchorPointX:a.getWidgetType()==ccs.WidgetType.widget?0.5:0,e=void 0!==c.anchorPointY?c.anchorPointY:a.getWidgetType()==ccs.WidgetType.widget?0.5:0;a.setAnchorPoint(d,e);d=c.flipY;a.setFlippedX(c.flipX);a.setFlippedY(d)},setPropsForButtonFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.scale9Enable;a.setScale9Enabled(d);var e=c.normalData;switch(e.resourceType){case 0:e=e.path;a.loadTextureNormal(e?this._filePath+
e:null);break;case 1:e=e.path,a.loadTextureNormal(e,ccs.TextureResType.plist)}e=c.pressedData;switch(e.resourceType){case 0:e=e.path;a.loadTexturePressed(e?this._filePath+e:null);break;case 1:e=e.path,a.loadTexturePressed(e,ccs.TextureResType.plist)}e=c.disabledData;switch(e.resourceType){case 0:e=e.path;a.loadTextureDisabled(e?this._filePath+e:null);break;case 1:e=e.path,a.loadTextureDisabled(e,ccs.TextureResType.plist)}d&&(a.setCapInsets(cc.rect(c.capInsetsX,c.capInsetsY,c.capInsetsWidth,c.capInsetsHeight)),
void 0!==c.scale9Width&&void 0!==c.scale9Height&&a.setSize(cc.size(c.scale9Width,c.scale9Height)));void 0!==c.text&&(d=c.text||"")&&a.setTitleText(d);void 0!==c.fontSize&&a.setTitleFontSize(c.fontSize);void 0!==c.fontName&&a.setTitleFontName(c.fontName);d=cc.c3b(void 0!==c.textColorR?c.textColorR:255,void 0!==c.textColorG?c.textColorG:255,void 0!==c.textColorB?c.textColorB:255);a.setTitleColor(d);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForCheckBoxFromJsonDictionary:function(a,
c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.backGroundBoxData;switch(d.resourceType){case 0:d=d.path;a.loadTextureBackGround(d?this._filePath+d:null);break;case 1:d=d.path,a.loadTextureBackGround(d,ccs.TextureResType.plist)}d=c.backGroundBoxSelectedData;switch(d.resourceType){case 0:d=d.path;a.loadTextureBackGroundSelected(d?this._filePath+d:null);break;case 1:d=d.path,a.loadTextureBackGroundSelected(d,ccs.TextureResType.plist)}d=c.frontCrossData;switch(d.resourceType){case 0:d=d.path;
a.loadTextureFrontCross(d?this._filePath+d:null);break;case 1:d=d.path,a.loadTextureFrontCross(d,ccs.TextureResType.plist)}d=c.backGroundBoxDisabledData;switch(d.resourceType){case 0:d=d.path;a.loadTextureBackGroundDisabled(d?this._filePath+d:null);break;case 1:d=d.path,a.loadTextureBackGroundDisabled(d,ccs.TextureResType.plist)}switch(c.frontCrossDisabledData.resourceType){case 0:d=c.path;a.loadTextureFrontCrossDisabled(d?this._filePath+d:null);break;case 1:d=c.path,a.loadTextureFrontCrossDisabled(d,
ccs.TextureResType.plist)}a.setSelectedState(c.selectedState||!1);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForImageViewFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.fileNameData;switch(d.resourceType){case 0:var e=this._filePath;(d=d.path)&&a.loadTexture(e+d);break;case 1:d=d.path,a.loadTexture(d,ccs.TextureResType.plist)}e=c.scale9Enable||!1;a.setScale9Enabled(e);e&&(void 0!==c.scale9Width&&void 0!==c.scale9Height&&a.setSize(cc.size(c.scale9Width,
c.scale9Height)),a.setCapInsets(cc.rect(c.capInsetsX,c.capInsetsY,c.capInsetsWidth,c.capInsetsHeight)));this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForLabelFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);a.setTouchScaleChangeEnabled(c.touchScaleEnable);a.setText(c.text);void 0!==c.fontSize&&a.setFontSize(c.fontSize);void 0!==c.fontName&&a.setFontName(c.fontName);if(void 0!==c.areaWidth&&void 0!==c.areaHeight){var d=cc.size(c.areaWidth,c.areaHeight);a.setTextAreaSize(d)}c.hAlignment&&
a.setTextHorizontalAlignment(c.hAlignment);c.vAlignment&&a.setTextVerticalAlignment(c.vAlignment);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForLabelAtlasFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=void 0!==c.charMapFile,e=void 0!==c.itemWidth,f=void 0!==c.itemHeight,g=void 0!==c.startCharMap;if(void 0!==c.stringValue&&d&&e&&f&&g)switch(d=c.charMapFileData,d.resourceType){case 0:a.setProperty(c.stringValue,this._filePath+d.path,c.itemWidth,
c.itemHeight,c.startCharMap);break;case 1:cc.log("Wrong res type of LabelAtlas!")}this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForLayoutFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);a instanceof ccs.ScrollView||a instanceof ccs.ListView||a.setClippingEnabled(c.clipAble);var d=c.backGroundScale9Enable;a.setBackGroundImageScale9Enabled(d);var e=c.bgColorR,f=c.bgColorG,g=c.bgColorB,h=c.bgStartColorR,k=c.bgStartColorG,m=c.bgStartColorB,n=c.bgEndColorR,p=
c.bgEndColorG,q=c.bgEndColorB;a.setBackGroundColorVector(cc.p(c.vectorX,c.vectorY));var s=c.bgColorOpacity;a.setBackGroundColorType(c.colorType);a.setBackGroundColor(cc.c3b(h,k,m),cc.c3b(n,p,q));a.setBackGroundColor(cc.c3b(e,f,g));a.setBackGroundColorOpacity(s);e=c.backGroundImageData||{};switch(e.resourceType){case 0:e=e.path;a.setBackGroundImage(e?this._filePath+e:null);break;case 1:e=e.path,a.setBackGroundImage(e,ccs.TextureResType.plist)}d&&a.setBackGroundImageCapInsets(cc.rect(c.capInsetsX,c.capInsetsY,
c.capInsetsWidth,c.capInsetsHeight));a.setLayoutType(c.layoutType);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForScrollViewFromJsonDictionary:function(a,c){this.setPropsForLayoutFromJsonDictionary(a,c);a.setInnerContainerSize(cc.size(c.innerWidth,c.innerHeight));a.setDirection(c.direction);a.setBounceEnabled(c.bounceEnable);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForSliderFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.barTextureScale9Enable||
!1;a.setScale9Enabled(d);var e=c.length;if(void 0!==c.barFileName)if(d){var d=c.barFileNameData,f=d.resourceType;switch(f){case 0:d=(d=d.path)?this._filePath+d:null;a.loadBarTexture(d);break;case 1:d=d.path,a.loadBarTexture(d,ccs.TextureResType.plist)}a.setSize(cc.size(e,a.getContentSize().height))}else switch(d=c.barFileNameData,f=d.resourceType,f){case 0:d=(d=d.path)?this._filePath+d:null;a.loadBarTexture(d);break;case 1:d=d.path,a.loadBarTexture(d,ccs.TextureResType.plist)}e=c.ballNormalData;switch(e.resourceType){case 0:e=
e.path;a.loadSlidBallTextureNormal(e?this._filePath+e:null);break;case 1:e=e.path,a.loadSlidBallTextureNormal(e,ccs.TextureResType.plist)}e=c.ballPressedData;switch(e.resourceType){case 0:e=e.path;a.loadSlidBallTexturePressed(e?this._filePath+e:null);break;case 1:e=e.path,a.loadSlidBallTexturePressed(e,ccs.TextureResType.plist)}e=c.ballDisabledData;switch(e.resourceType){case 0:e=e.path;a.loadSlidBallTextureDisabled(e?this._filePath+e:null);break;case 1:e=e.path,a.loadSlidBallTextureDisabled(e,ccs.TextureResType.plist)}e=
c.progressBarData;switch(e.resourceType){case 0:d=(d=e.path)?this._filePath+d:null;a.loadProgressBarTexture(d);break;case 1:d=e.path,a.loadProgressBarTexture(d,ccs.TextureResType.plist)}this.setColorPropsForWidgetFromJsonDictionary(a,c);a.setPercent(c.percent)},setPropsForTextAreaFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);a.setText(c.text);void 0!==c.fontSize&&a.setFontSize(c.fontSize);a.setColor(cc.c3b(c.colorR,c.colorG,c.colorB));a.setFontName(c.fontName);if(void 0!==
c.areaWidth&&void 0!==c.areaHeight){var d=cc.size(c.areaWidth,c.areaHeight);a.setTextAreaSize(d)}c.hAlignment&&a.setTextHorizontalAlignment(c.hAlignment);c.vAlignment&&a.setTextVerticalAlignment(c.vAlignment);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForTextButtonFromJsonDictionary:function(a,c){this.setPropsForButtonFromJsonDictionary(a,c);a.setTitleText(c.text||"");a.setTitleColor(cc.c3b(void 0!==c.textColorR?c.textColorR:255,void 0!==c.textColorG?c.textColorG:255,void 0!==c.textColorB?
c.textColorB:255));void 0!==c.fontSize&&a.setTitleFontSize(c.fontSize);void 0!==c.fontName&&a.setTitleFontName(c.fontName);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForTextFieldFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);void 0!==c.placeHolder&&a.setPlaceHolder(c.placeHolder);a.setText(c.text);void 0!==c.fontSize&&a.setFontSize(c.fontSize);void 0!==c.fontName&&a.setFontName(c.fontName);void 0!==c.touchSizeWidth&&void 0!==c.touchSizeHeight&&a.setTouchSize(cc.size(c.touchSizeWidth,
c.touchSizeHeight));var d=c.maxLengthEnable;a.setMaxLengthEnabled(d);d&&a.setMaxLength(c.maxLength);d=c.passwordEnable;a.setPasswordEnabled(d);d&&a.setPasswordStyleText(c.passwordStyleText);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForLoadingBarFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.textureData;switch(d.resourceType){case 0:var e=this._filePath;(d=d.path)&&a.loadTexture(e+d);break;case 1:d=d.path,a.loadTexture(d,ccs.TextureResType.plist)}e=
c.scale9Enable;a.setScale9Enabled(e);e&&(a.setCapInsets(cc.rect(c.capInsetsX,c.capInsetsY,c.capInsetsWidth,c.capInsetsHeight)),a.setSize(cc.size(c.width,c.height)));a.setDirection(c.direction);a.setPercent(c.percent);this.setColorPropsForWidgetFromJsonDictionary(a,c)},setPropsForListViewFromJsonDictionary:function(a,c){this.setPropsForLayoutFromJsonDictionary(a,c);a.setInnerContainerSize(cc.size(c.innerWidth||0,c.innerHeight||0));a.setDirection(c.direction||0);a.setGravity(c.gravity||0);a.setItemsMargin(c.itemMargin||
0)},setPropsForPageViewFromJsonDictionary:function(a,c){this.setPropsForLayoutFromJsonDictionary(a,c)},setPropsForLabelBMFontFromJsonDictionary:function(a,c){this.setPropsForWidgetFromJsonDictionary(a,c);var d=c.fileNameData;switch(d.resourceType){case 0:a.setFntFile(this._filePath+d.path);break;case 1:cc.log("Wrong res type of LabelAtlas!")}a.setText(c.text);this.setColorPropsForWidgetFromJsonDictionary(a,c)}});ccs.GUIReader._instance=null;
ccs.GUIReader.getInstance=function(){this._instance||(this._instance=new ccs.GUIReader);return this._instance};ccs.GUIReader.purge=function(){this._instance=null};ccs.SceneReader=ccs.Class.extend({_baseBath:"",_listener:null,_selector:null,_node:null,ctor:function(){this._instance=null;this._baseBath="";this._selector=this._listener=null},createNodeWithSceneFile:function(a){var c=0,c=a.lastIndexOf("/");-1<c&&(this._baseBath=a.substr(0,c+1));if(c=cc.FileUtils.getInstance().getTextFileData(a))a=JSON.parse(c),this._node=this.createObject(a,null),ccs.TriggerMng.getInstance().parse(a.Triggers||[]);this._baseBath="";return this._node},createObject:function(a,c){var d=
a.classname;if("CCNode"==d){var e=null;c?(e=cc.Node.create(),c.addChild(e)):e=cc.Node.create();this.setPropertyFromJsonDict(e,a);for(var f=a.components,g=0;g<f.length;g++){var h=f[g];if(!h)break;var d=h.classname,k=h.name,m=h.fileData,n="",p="",q=0,n=n+this._baseBath;null!=m&&(q=void 0!==m.resourceType?m.resourceType:-1,n+=m.path,p+=m.plistFile,cc.FileUtils.getInstance().fullPathForFilename(n),cc.FileUtils.getInstance().fullPathForFilename(p));if("CCSprite"==d){d=null;if(0==q){d=n.lastIndexOf(".png");
if(-1>=d)continue;d=cc.Sprite.create(n)}else if(1==q){d=p.lastIndexOf(".plist");if(-1>=d)continue;d=p.lastIndexOf(".",p.length);n=p.substr(0,d);n+=".png";p=this._baseBath+p;n=this._baseBath+n;cc.SpriteFrameCache.getInstance().addSpriteFrames(p,n);d=cc.Sprite.createWithSpriteFrameName(m.path)}else continue;n=ccs.ComRender.create(d,"CCSprite");null!=k&&n.setName(k);e.addComponent(n);this._callSelector(d,h)}else if("CCTMXTiledMap"==d)m=null,0==q&&(d=n.lastIndexOf(".tmx"),-1>=d||(m=cc.TMXTiledMap.create(n),
n=ccs.ComRender.create(m,"CCTMXTiledMap"),null!=k&&n.setName(k),e.addComponent(n),this._callSelector(m,h)));else if("CCParticleSystemQuad"==d)d=n.lastIndexOf(".plist"),-1>=d||(m=null,0==q?m=cc.ParticleSystem.create(n):cc.log("unknown resourcetype on CCParticleSystemQuad!"),m.setPosition(0,0),n=ccs.ComRender.create(m,"CCParticleSystemQuad"),null!=k&&n.setName(k),e.addComponent(n),this._callSelector(m,h));else if("CCArmature"==d)0==q&&(q=n,m=q.lastIndexOf("/"),-1!=m&&q.substr(0,m+1),(q=cc.FileUtils.getInstance().getTextFileData(n))?
(q=JSON.parse(q).armature_data[0].name,ccs.ArmatureDataManager.getInstance().addArmatureFileInfo(n),q=ccs.Armature.create(q),n=ccs.ComRender.create(q,"CCArmature"),null!=k&&n.setName(k),e.addComponent(n),(k=h.selectedactionname)&&q.getAnimation()&&q.getAnimation().play(k),this._callSelector(q,h)):cc.log("read json file[%s] error!\n",n));else if("CCComAudio"==d){var s=null;0==q&&(s=ccs.ComAudio.create(),s.preloadEffect(n),k&&s.setName(k),e.addComponent(s),this._callSelector(s,h))}else"CCComAttribute"==
d?(m=null,0==q?(m=ccs.ComAttribute.create(),this._baseBath!=n&&m.parse(n),k&&m.setName(k),e.addComponent(m),this._callSelector(m,h)):cc.log("unknown resourcetype on CCComAttribute!")):"CCBackgroundAudio"==d?(s=null,0==q&&(s=ccs.ComAudio.create(),s.preloadBackgroundMusic(n),s.setFile(n),q=Boolean(h.loop||0),s.setLoop(q),k&&s.setName(k),e.addComponent(s),s.playBackgroundMusic(n,q),this._callSelector(s,h))):"GUIComponent"==d&&(q=ccs.UILayer.create(),q.scheduleUpdate(),n=ccs.GUIReader.getInstance().widgetFromJsonFile(n),
q.addWidget(n),n=ccs.ComRender.create(q,"GUIComponent"),null!=k&&n.setName(k),e.addComponent(n),this._callSelector(s,h))}f=a.gameobjects;for(g=0;g<f.length;g++){h=f[g];if(!h)break;this.createObject(h,e)}return e}return null},nodeByTag:function(a,c){if(null==a)return null;for(var d=null,e=a.getChildren(),f=0;f<e.length&&(!(d=e[f])||d.getTag()!=c)&&!(d=this.nodeByTag(d,c));f++);return d},getNodeByTag:function(a){return null==this._node?null:this._node.getTag()==a?this._node:this.nodeByTag(this._node,
a)},setPropertyFromJsonDict:function(a,c){a.setPosition(cc.p("undefined"===typeof c.x?0:c.x,"undefined"===typeof c.y?0:c.y));a.setVisible(Boolean("undefined"===typeof c.visible?1:c.visible));a.setTag("undefined"===typeof c.objecttag?-1:c.objecttag);a.setZOrder("undefined"===typeof c.zorder?0:c.zorder);var d="undefined"===typeof c.scaley?1:c.scaley;a.setScaleX("undefined"===typeof c.scalex?1:c.scalex);a.setScaleY(d);a.setRotation("undefined"===typeof c.rotation?0:c.rotation)},setTarget:function(a,
c){this._listener=c;this._selector=a},_callSelector:function(a,c){this._selector&&this._selector.call(this._listener,a,c)},purge:function(){cc.log("deprecated. purge is a static class now. Use 'ccs.SceneReader.purge()' instead.");this._instance=null}});ccs.SceneReader._instance=null;ccs.SceneReader.getInstance=function(){this._instance||(this._instance=new ccs.SceneReader);return this._instance};
ccs.SceneReader.purge=function(){ccs.TriggerMng.getInstance().destroyInstance();cc.AudioEngine.end();this._instance=null};ccs.SceneReader.sceneReaderVersion=function(){return"1.2.0.0"};