var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};var _p=window,_p=Object.prototype,_p=null;cc._drawingUtil=null;cc._renderContext=null;cc._supportRender=!1;cc._canvas=null;cc.container=null;cc._gameDiv=null;window.ENABLE_IMAEG_POOL=!0;cc.each=function(a,b,c){if(a)if(a instanceof Array)for(var d=0,e=a.length;d<e&&!1!==b.call(c,a[d],d);d++);else for(d in a)if(!1===b.call(c,a[d],d))break};
cc.extend=function(a){var b=2<=arguments.length?Array.prototype.slice.call(arguments,1):[];cc.each(b,function(b){for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d])});return a};cc.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};cc.isFunction=function(a){return"function"===typeof a};cc.isNumber=function(a){return"number"===typeof a||"[object Number]"===Object.prototype.toString.call(a)};
cc.isString=function(a){return"string"===typeof a||"[object String]"===Object.prototype.toString.call(a)};cc.isArray=function(a){return Array.isArray(a)||"object"===typeof a&&"[object Array]"===Object.prototype.toString.call(a)};cc.isUndefined=function(a){return"undefined"===typeof a};cc.isObject=function(a){return"object"===typeof a&&"[object Object]"===Object.prototype.toString.call(a)};
cc.isCrossOrigin=function(a){if(!a)return cc.log("invalid URL"),!1;var b=a.indexOf("://");if(-1===b)return!1;b=a.indexOf("/",b+3);return(-1===b?a:a.substring(0,b))!==location.origin};
cc.AsyncPool=function(a,b,c,d,e){var f=this;f._finished=!1;f._srcObj=a;f._limit=b;f._pool=[];f._iterator=c;f._iteratorTarget=e;f._onEnd=d;f._onEndTarget=e;f._results=a instanceof Array?[]:{};f._errors=a instanceof Array?[]:{};cc.each(a,function(a,b){f._pool.push({index:b,value:a})});f.size=f._pool.length;f.finishedSize=0;f._workingSize=0;f._limit=f._limit||f.size;f.onIterator=function(a,b){f._iterator=a;f._iteratorTarget=b};f.onEnd=function(a,b){f._onEnd=a;f._onEndTarget=b};f._handleItem=function(){var a=
this;if(!(0===a._pool.length||a._workingSize>=a._limit)){var b=a._pool.shift(),c=b.value,d=b.index;a._workingSize++;a._iterator.call(a._iteratorTarget,c,d,function(b,c){if(!a._finished)if(b?a._errors[this.index]=b:a._results[this.index]=c,a.finishedSize++,a._workingSize--,a.finishedSize===a.size)a.onEnd(0===a._errors.length?null:a._errors,a._results);else a._handleItem()}.bind(b),a)}};f.flow=function(){if(0===this._pool.length)this._onEnd&&this._onEnd.call(this._onEndTarget,null,[]);else for(var a=
0;a<this._limit;a++)this._handleItem()};f.onEnd=function(a,b){f._finished=!0;if(f._onEnd){var c=f._onEnd,d=f._onEndTarget;f._onEnd=null;f._onEndTarget=null;c.call(d,a,b)}}};
cc.async={series:function(a,b,c){a=new cc.AsyncPool(a,1,function(a,b,f){a.call(c,f)},b,c);a.flow();return a},parallel:function(a,b,c){a=new cc.AsyncPool(a,0,function(a,b,f){a.call(c,f)},b,c);a.flow();return a},waterfall:function(a,b,c){var d=[],e=[null],f=new cc.AsyncPool(a,1,function(b,f,m){d.push(function(b){d=Array.prototype.slice.call(arguments,1);a.length-1===f&&(e=e.concat(d));m.apply(null,arguments)});b.apply(c,d)},function(a){if(b){if(a)return b.call(c,a);b.apply(c,e)}});f.flow();return f},
map:function(a,b,c,d){var e=b;"object"===typeof b&&(c=b.cb,d=b.iteratorTarget,e=b.iterator);a=new cc.AsyncPool(a,0,e,c,d);a.flow();return a},mapLimit:function(a,b,c,d,e){a=new cc.AsyncPool(a,b,c,d,e);a.flow();return a}};
cc.path={normalizeRE:/[^\.\/]+\/\.\.\//,join:function(){for(var a=arguments.length,b="",c=0;c<a;c++)b=(b+(""===b?"":"/")+arguments[c]).replace(/(\/|\\\\)$/,"");return b},extname:function(a){return(a=/(\.[^\.\/\?\\]*)(\?.*)?$/.exec(a))?a[1]:null},mainFileName:function(a){if(a){var b=a.lastIndexOf(".");if(-1!==b)return a.substring(0,b)}return a},basename:function(a,b){var c=a.indexOf("?");0<c&&(a=a.substring(0,c));c=/(\/|\\\\)([^(\/|\\\\)]+)$/g.exec(a.replace(/(\/|\\\\)$/,""));if(!c)return null;c=c[2];
return b&&a.substring(a.length-b.length).toLowerCase()===b.toLowerCase()?c.substring(0,c.length-b.length):c},dirname:function(a){return a.replace(/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,"$2")},changeExtname:function(a,b){b=b||"";var c=a.indexOf("?"),d="";0<c&&(d=a.substring(c),a=a.substring(0,c));c=a.lastIndexOf(".");return 0>c?a+b+d:a.substring(0,c)+b+d},changeBasename:function(a,b,c){if(0===b.indexOf("."))return this.changeExtname(a,b);var d=a.indexOf("?"),e="";c=c?this.extname(a):"";0<d&&(e=a.substring(d),
a=a.substring(0,d));d=a.lastIndexOf("/");return a.substring(0,0>=d?0:d+1)+b+c+e},_normalize:function(a){var b=a=String(a);do b=a,a=a.replace(this.normalizeRE,"");while(b.length!==a.length);return a}};
var imagePool={_pool:Array(10),_MAX:10,_smallImg:"data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA\x3d",count:0,get:function(){if(0<this.count){this.count--;var a=this._pool[this.count];this._pool[this.count]=null;return a}return new Image},put:function(a){var b=this._pool;a instanceof HTMLImageElement&&this.count<this._MAX&&(a.src=this._smallImg,b[this.count]=a,this.count++)}};
cc.loader=function(){var a={},b={},c={},d={},e={},f=/^(?:https?|ftp):\/\/\S*$/i;return{resPath:"",audioPath:"",cache:{},getXMLHttpRequest:function(){var a=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP");a.timeout=1E4;void 0===a.ontimeout&&(a._timeoutId=-1);return a},_getArgs4Js:function(a){var b=a[0],c=a[1],d=a[2],e=["",null,null];if(1===a.length)e[1]=b instanceof Array?b:[b];else if(2===a.length)"function"===typeof c?(e[1]=b instanceof Array?b:[b],e[2]=c):(e[0]=
b||"",e[1]=c instanceof Array?c:[c]);else if(3===a.length)e[0]=b||"",e[1]=c instanceof Array?c:[c],e[2]=d;else throw Error("arguments error to load js!");return e},isLoading:function(a){return void 0!==e[a]},loadJs:function(b,c,d){var e=this,f=e._getArgs4Js(arguments),r=f[0],s=f[1],f=f[2];-1<navigator.userAgent.indexOf("Trident/5")?e._loadJs4Dependency(r,s,0,f):cc.async.map(s,function(b,c,d){b=cc.path.join(r,b);if(a[b])return d(null);e._createScript(b,!1,d)},f)},loadJsWithImg:function(a,b,c){var d=
this._loadJsImg(),e=this._getArgs4Js(arguments);this.loadJs(e[0],e[1],function(a){if(a)throw Error(a);d.parentNode.removeChild(d);if(e[2])e[2]()})},_createScript:function(b,c,d){var e=document,f=document.createElement("script");f.async=c;a[b]=!0;cc.game.config.noCache&&"string"===typeof b?this._noCacheRex.test(b)?f.src=b+"\x26_t\x3d"+(new Date-0):f.src=b+"?_t\x3d"+(new Date-0):f.src=b;f.addEventListener("load",function(){f.parentNode.removeChild(f);this.removeEventListener("load",arguments.callee,
!1);d()},!1);f.addEventListener("error",function(){f.parentNode.removeChild(f);d("Load "+b+" failed!")},!1);e.body.appendChild(f)},_loadJs4Dependency:function(a,b,c,d){if(c>=b.length)d&&d();else{var e=this;e._createScript(cc.path.join(a,b[c]),!1,function(f){if(f)return d(f);e._loadJs4Dependency(a,b,c+1,d)})}},_loadJsImg:function(){var a=document,b=a.getElementById("cocos2d_loadJsImg");if(!b){b=document.createElement("img");cc._loadingImage&&(b.src=cc._loadingImage);a=a.getElementById(cc.game.config.id);
a.style.backgroundColor="transparent";a.parentNode.appendChild(b);var c=getComputedStyle?getComputedStyle(a):a.currentStyle;c||(c={width:a.width,height:a.height});b.style.left=a.offsetLeft+(parseFloat(c.width)-b.width)/2+"px";b.style.top=a.offsetTop+(parseFloat(c.height)-b.height)/2+"px";b.style.position="absolute"}return b},loadTxt:function(a,b){if(cc._isNodeJs)require("fs").readFile(a,function(a,c){a?b(a):b(null,c.toString())});else{var c=this.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET",
a,!0);if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent))c.setRequestHeader("Accept-Charset","utf-8"),c.onreadystatechange=function(){4===c.readyState&&(200===c.status||0===c.status?b(null,c.responseText):b({status:c.status,errorMessage:d},null))};else{c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8");var e=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",
s);4===c.readyState&&(200===c.status||0===c.status?b(null,c.responseText):b({status:c.status,errorMessage:d},null))},f=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",s);b({status:c.status,errorMessage:d},null)},s=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",s);b({status:c.status,errorMessage:"Request timeout: "+
d},null)};c.addEventListener("load",e);c.addEventListener("error",f);void 0===c.ontimeout?c._timeoutId=setTimeout(function(){s()},c.timeout):c.addEventListener("timeout",s)}c.send(null)}},loadCsb:function(a,b){var c=cc.loader.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET",a,!0);c.responseType="arraybuffer";var e=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",s);var a=c.response;a&&(window.msg=
a);4===c.readyState&&(200===c.status||0===c.status?b(null,c.response):b({status:c.status,errorMessage:d},null))},f=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",s);b({status:c.status,errorMessage:d},null)},s=function(){c.removeEventListener("load",e);c.removeEventListener("error",f);0<=c._timeoutId?clearTimeout(c._timeoutId):c.removeEventListener("timeout",s);b({status:c.status,errorMessage:"Request timeout: "+
d},null)};c.addEventListener("load",e);c.addEventListener("error",f);void 0===c.ontimeout?c._timeoutId=setTimeout(function(){s()},c.timeout):c.addEventListener("timeout",s);c.send(null)},loadJson:function(a,b){this.loadTxt(a,function(c,d){if(c)b(c);else{try{var e=JSON.parse(d)}catch(f){throw Error("parse json ["+a+"] failed : "+f);}b(null,e)}})},_checkIsImageURL:function(a){return null!=/(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(a)},loadImg:function(a,b,c,d){var f={isCrossOrigin:!0};void 0!==
c?f.isCrossOrigin=void 0===b.isCrossOrigin?f.isCrossOrigin:b.isCrossOrigin:void 0!==b&&(c=b);if(b=this.getRes(a))return c&&c(null,b),null;if(b=e[a])return b.callbacks.push(c),b.img;d=d||imagePool.get();d.crossOrigin=f.isCrossOrigin&&"file://"!==location.origin?"Anonymous":null;var r=function(){this.removeEventListener("load",r,!1);this.removeEventListener("error",t,!1);var b=e[a];if(b){for(var c=b.callbacks,f=0;f<c.length;++f){var k=c[f];k&&k(null,d)}b.img=null;delete e[a]}window.ENABLE_IMAEG_POOL&&
cc._renderType===cc.game.RENDER_TYPE_WEBGL&&imagePool.put(d)},s=this,t=function(){this.removeEventListener("load",r,!1);this.removeEventListener("error",t,!1);if("https:"!==window.location.protocol&&d.crossOrigin&&"anonymous"===d.crossOrigin.toLowerCase())f.isCrossOrigin=!1,s.release(a),cc.loader.loadImg(a,f,c,d);else{var b=e[a];if(b){for(var k=b.callbacks,y=0;y<k.length;++y){var x=k[y];x&&x("load image failed")}b.img=null;delete e[a]}cc._renderType===cc.game.RENDER_TYPE_WEBGL&&imagePool.put(d)}};
e[a]={img:d,callbacks:c?[c]:[]};d.addEventListener("load",r);d.addEventListener("error",t);d.src=a;return d},_loadResIterator:function(a,c,d){var e=this,p=null,r=a.type;r?(r="."+r.toLowerCase(),p=a.src?a.src:a.name+r):(p=a,r=cc.path.extname(p));if(c=e.getRes(p))return d(null,c);c=null;r&&(c=b[r.toLowerCase()]);if(!c)return cc.error("loader for ["+r+"] doesn't exist!"),d();r=p;f.test(p)||(r=c.getBasePath?c.getBasePath():e.resPath,r=e.getUrl(r,p));cc.game.config.noCache&&"string"===typeof r&&(r=e._noCacheRex.test(r)?
r+("\x26_t\x3d"+(new Date-0)):r+("?_t\x3d"+(new Date-0)));c.load(r,p,a,function(a,b){a?(cc.log(a),e.cache[p]=null,delete e.cache[p],d({status:520,errorMessage:a},null)):(e.cache[p]=b,d(null,b))})},_noCacheRex:/\?/,getUrl:function(a,d){var e=cc.path;if(void 0!==a&&void 0===d){d=a;var f=e.extname(d),f=f?f.toLowerCase():"";a=(f=b[f])?f.getBasePath?f.getBasePath():this.resPath:this.resPath}d=cc.path.join(a||"",d);if(d.match(/[\/(\\\\)]lang[\/(\\\\)]/i)){if(c[d])return c[d];e=e.extname(d)||"";d=c[d]=d.substring(0,
d.length-e.length)+"_"+cc.sys.language+e}return d},load:function(a,b,c){var d=this,e=arguments.length;if(0===e)throw Error("arguments error!");3===e?"function"===typeof b&&(b="function"===typeof c?{trigger:b,cb:c}:{cb:b,cbTarget:c}):2===e?"function"===typeof b&&(b={cb:b}):1===e&&(b={});a instanceof Array||(a=[a]);e=new cc.AsyncPool(a,cc.CONCURRENCY_HTTP_REQUEST_COUNT,function(a,c,e,f){d._loadResIterator(a,c,function(a){var c=Array.prototype.slice.call(arguments,1);b.trigger&&b.trigger.call(b.triggerTarget,
c[0],f.size,f.finishedSize);e(a,c[0])})},b.cb,b.cbTarget);e.flow();return e},_handleAliases:function(a,b){var c=[],e;for(e in a){var f=a[e];d[e]=f;c.push(f)}this.load(c,b)},loadAliases:function(a,b){var c=this,d=c.getRes(a);d?c._handleAliases(d.filenames,b):c.load(a,function(a,d){c._handleAliases(d[0].filenames,b)})},register:function(a,c){if(a&&c){if("string"===typeof a)return b[a.trim().toLowerCase()]=c;for(var d=0,e=a.length;d<e;d++)b["."+a[d].trim().toLowerCase()]=c}},getRes:function(a){return this.cache[a]||
this.cache[d[a]]},_getAliase:function(a){return d[a]},release:function(a){var b=this.cache,c=e[a];c&&(c.img=null,delete e[a]);delete b[a];delete b[d[a]];delete d[a]},releaseAll:function(){var a=this.cache,b;for(b in a)delete a[b];for(b in d)delete d[b]}}}();
cc.formatStr=function(){var a=arguments,b=a.length;if(1>b)return"";var c=a[0],d=!0;"object"===typeof c&&(d=!1);for(var e=1;e<b;++e){var f=a[e];if(d)for(;;){var h=null;if("number"===typeof f&&(h=c.match(/(%d)|(%s)/))){c=c.replace(/(%d)|(%s)/,f);break}c=(h=c.match(/%s/))?c.replace(/%s/,f):c+("    "+f);break}else c+="    "+f}return c};
(function(){function a(a){var b=cc.game.CONFIG_KEY,c=parseInt(a[b.renderMode])||0;if(isNaN(c)||2<c||0>c)a[b.renderMode]=0;cc._renderType=cc.game.RENDER_TYPE_CANVAS;cc._supportRender=!1;0===c?cc.sys.capabilities.opengl?(cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0):cc.sys.capabilities.canvas&&(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender=!0):1===c&&cc.sys.capabilities.canvas?(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender=!0):2===c&&cc.sys.capabilities.opengl&&
(cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0)}function b(a,c,d){if(k[c])return null;d=d||"";var e=[],f=a[c];if(!f)throw Error("can not find module ["+c+"]");c=cc.path;for(var h=0,m=f.length;h<m;h++){var n=f[h];if(!k[n]){var u=c.extname(n);u?".js"===u.toLowerCase()&&e.push(c.join(d,n)):(u=b(a,n,d))&&(e=e.concat(u));k[n]=1}}return e}function c(a){cc._initDebugSetting&&cc._initDebugSetting(a[cc.game.CONFIG_KEY.debugMode]);cc._engineLoaded=!0;console.log(cc.ENGINE_VERSION);n&&n()}function d(a){var d=
a[cc.game.CONFIG_KEY.engineDir],e=cc.loader;if(cc.Class)c(a);else{var f=cc.path.join(d,"moduleConfig.json");e.loadJson(f,function(e,f){if(e)throw Error(e);var h=a.modules||[],k=f.module,m=[];cc.sys.capabilities.opengl&&0>h.indexOf("base4webgl")?h.splice(0,0,"base4webgl"):0>h.indexOf("core")&&h.splice(0,0,"core");for(var n=0,t=h.length;n<t;n++){var s=b(k,h[n],d);s&&(m=m.concat(s))}cc.loader.loadJsWithImg(m,function(b){if(b)throw b;c(a)})})}}function e(){this.removeEventListener("load",e,!1);d(cc.game.config)}
var f=document.createElement("canvas"),h=document.createElement("canvas");cc.create3DContext=function(a,b){for(var c=["webgl","experimental-webgl","webkit-3d","moz-webgl"],d=null,e=0;e<c.length;++e){try{d=a.getContext(c[e],b)}catch(f){}if(d)break}return d};(function(){cc.sys={};var a=cc.sys;a.LANGUAGE_ENGLISH="en";a.LANGUAGE_CHINESE="zh";a.LANGUAGE_FRENCH="fr";a.LANGUAGE_ITALIAN="it";a.LANGUAGE_GERMAN="de";a.LANGUAGE_SPANISH="es";a.LANGUAGE_DUTCH="du";a.LANGUAGE_RUSSIAN="ru";a.LANGUAGE_KOREAN="ko";
a.LANGUAGE_JAPANESE="ja";a.LANGUAGE_HUNGARIAN="hu";a.LANGUAGE_PORTUGUESE="pt";a.LANGUAGE_ARABIC="ar";a.LANGUAGE_NORWEGIAN="no";a.LANGUAGE_POLISH="pl";a.LANGUAGE_UNKNOWN="unkonwn";a.OS_IOS="iOS";a.OS_ANDROID="Android";a.OS_WINDOWS="Windows";a.OS_MARMALADE="Marmalade";a.OS_LINUX="Linux";a.OS_BADA="Bada";a.OS_BLACKBERRY="Blackberry";a.OS_OSX="OS X";a.OS_WP8="WP8";a.OS_WINRT="WINRT";a.OS_UNKNOWN="Unknown";a.UNKNOWN=-1;a.WIN32=0;a.LINUX=1;a.MACOS=2;a.ANDROID=3;a.IPHONE=4;a.IPAD=5;a.BLACKBERRY=6;a.NACL=
7;a.EMSCRIPTEN=8;a.TIZEN=9;a.WINRT=10;a.WP8=11;a.MOBILE_BROWSER=100;a.DESKTOP_BROWSER=101;a.BROWSER_TYPE_WECHAT="wechat";a.BROWSER_TYPE_ANDROID="androidbrowser";a.BROWSER_TYPE_IE="ie";a.BROWSER_TYPE_QQ_APP="qq";a.BROWSER_TYPE_QQ="qqbrowser";a.BROWSER_TYPE_MOBILE_QQ="mqqbrowser";a.BROWSER_TYPE_UC="ucbrowser";a.BROWSER_TYPE_360="360browser";a.BROWSER_TYPE_BAIDU_APP="baiduboxapp";a.BROWSER_TYPE_BAIDU="baidubrowser";a.BROWSER_TYPE_MAXTHON="maxthon";a.BROWSER_TYPE_OPERA="opera";a.BROWSER_TYPE_OUPENG="oupeng";
a.BROWSER_TYPE_MIUI="miuibrowser";a.BROWSER_TYPE_FIREFOX="firefox";a.BROWSER_TYPE_SAFARI="safari";a.BROWSER_TYPE_CHROME="chrome";a.BROWSER_TYPE_LIEBAO="liebao";a.BROWSER_TYPE_QZONE="qzone";a.BROWSER_TYPE_SOUGOU="sogou";a.BROWSER_TYPE_UNKNOWN="unknown";a.isNative=!1;var b=window,c=b.navigator,d=document,e=d.documentElement,k=c.userAgent.toLowerCase();a.isMobile=/mobile|android|iphone|ipad/.test(k);a.platform=a.isMobile?a.MOBILE_BROWSER:a.DESKTOP_BROWSER;var m=c.language,m=(m=m?m:c.browserLanguage)?
m.split("-")[0]:a.LANGUAGE_ENGLISH;a.language=m;var n=!1,m=!1,u="",z=0,A=/android (\d+(?:\.\d+)+)/i.exec(k)||/android (\d+(?:\.\d+)+)/i.exec(c.platform);A&&(n=!0,u=A[1]||"",z=parseInt(u)||0);(A=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(k))?(m=!0,u=A[2]||"",z=parseInt(u)||0):/(iPhone|iPad|iPod)/.exec(c.platform)&&(m=!0,u="",z=0);A=a.OS_UNKNOWN;-1!==c.appVersion.indexOf("Win")?A=a.OS_WINDOWS:m?A=a.OS_IOS:-1!==c.appVersion.indexOf("Mac")?A=a.OS_OSX:-1!==c.appVersion.indexOf("X11")&&-1===c.appVersion.indexOf("Linux")?
A=a.OS_UNIX:n?A=a.OS_ANDROID:-1!==c.appVersion.indexOf("Linux")&&(A=a.OS_LINUX);a.os=A;a.osVersion=u;a.osMainVersion=z;a.browserType=a.BROWSER_TYPE_UNKNOWN;(function(){var b=/qqbrowser|qq|chrome|safari|firefox|opr|oupeng|opera/i,c=/micromessenger|mqqbrowser|sogou|qzone|liebao|ucbrowser|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|trident|miuibrowser/i.exec(k);c||(c=b.exec(k));b=c?c[0]:a.BROWSER_TYPE_UNKNOWN;"micromessenger"===b?b=a.BROWSER_TYPE_WECHAT:"safari"===b&&n?b=a.BROWSER_TYPE_ANDROID:
"trident"===b?b=a.BROWSER_TYPE_IE:"360 aphone"===b?b=a.BROWSER_TYPE_360:"mxbrowser"===b?b=a.BROWSER_TYPE_MAXTHON:"opr"===b&&(b=a.BROWSER_TYPE_OPERA);a.browserType=b})();a.browserVersion="";(function(){var b=/(msie |rv:|firefox|chrome|ucbrowser|qq|oupeng|opera|opr|safari|miui)(mobile)?(browser)?\/?([\d.]+)/i,c=k.match(/(mqqbrowser|micromessenger|sogou|qzone|liebao|maxthon|mxbrowser|baidu)(mobile)?(browser)?\/?([\d.]+)/i);c||(c=k.match(b));a.browserVersion=c?c[4]:""})();m=window.devicePixelRatio||1;
a.windowPixelResolution={width:m*(window.innerWidth||document.documentElement.clientWidth),height:m*(window.innerHeight||document.documentElement.clientHeight)};a._checkWebGLRenderMode=function(){if(cc._renderType!==cc.game.RENDER_TYPE_WEBGL)throw Error("This feature supports WebGL render mode only.");};a._supportCanvasNewBlendModes=function(){var a=f;a.width=1;a.height=1;a=a.getContext("2d");a.fillStyle="#000";a.fillRect(0,0,1,1);a.globalCompositeOperation="multiply";var b=h;b.width=1;b.height=1;
var c=b.getContext("2d");c.fillStyle="#fff";c.fillRect(0,0,1,1);a.drawImage(b,0,0,1,1);return 0===a.getImageData(0,0,1,1).data[0]}();cc.sys.isMobile&&(m=document.createElement("style"),m.type="text/css",document.body.appendChild(m),m.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);}");try{var B=a.localStorage=b.localStorage;B.setItem("storage","");B.removeItem("storage");B=null}catch(D){B=
function(){cc.warn("Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option")},a.localStorage={getItem:B,setItem:B,removeItem:B,clear:B}}B=!!f.getContext("2d");m=!1;if(b.WebGLRenderingContext){u=document.createElement("CANVAS");try{if(cc.create3DContext(u)&&(m=!0),m&&a.os===a.OS_IOS&&9===a.osMainVersion&&(window.indexedDB||(m=!1)),m&&a.os===a.OS_ANDROID){var C=parseFloat(a.browserVersion);switch(a.browserType){case a.BROWSER_TYPE_MOBILE_QQ:case a.BROWSER_TYPE_BAIDU:case a.BROWSER_TYPE_BAIDU_APP:m=
6.2<=C?!0:!1;break;case a.BROWSER_TYPE_CHROME:m=30<=C?!0:!1;break;case a.BROWSER_TYPE_ANDROID:a.osMainVersion&&5<=a.osMainVersion&&(m=!0);break;case a.BROWSER_TYPE_UNKNOWN:case a.BROWSER_TYPE_360:case a.BROWSER_TYPE_MIUI:case a.BROWSER_TYPE_UC:m=!1}}}catch(E){}u=null}C=a.capabilities={canvas:B,opengl:m};if(void 0!==e.ontouchstart||void 0!==d.ontouchstart||c.msPointerEnabled)C.touches=!0;void 0!==e.onmouseup&&(C.mouse=!0);void 0!==e.onkeyup&&(C.keyboard=!0);if(b.DeviceMotionEvent||b.DeviceOrientationEvent)C.accelerometer=
!0;a.garbageCollect=function(){};a.dumpRoot=function(){};a.restartVM=function(){};a.cleanScript=function(a){};a.isObjectValid=function(a){return a?!0:!1};a.dump=function(){var a;a=""+("isMobile : "+this.isMobile+"\r\n");a+="language : "+this.language+"\r\n";a+="browserType : "+this.browserType+"\r\n";a+="browserVersion : "+this.browserVersion+"\r\n";a+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n";a+="os : "+this.os+"\r\n";a+="osVersion : "+this.osVersion+"\r\n";a+="platform : "+this.platform+
"\r\n";a+="Using "+(cc._renderType===cc.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n";cc.log(a)};a.openURL=function(a){window.open(a)};a.now=function(){return Date.now?Date.now():+new Date}})();h=f=null;cc.log=cc.warn=cc.error=cc.assert=function(){};var k={},m=!1,n=null;cc._engineLoaded=!1;cc.initEngine=function(b,c){if(m){var f=n;n=function(){f&&f();c&&c()}}else n=c,!cc.game.config&&b?cc.game.config=b:cc.game.config||cc.game._loadConfig(),b=cc.game.config,a(b),document.body?d(b):cc._addEventListener(window,
"load",e,!1),m=!0}})();
cc.game={DEBUG_MODE_NONE:0,DEBUG_MODE_INFO:1,DEBUG_MODE_WARN:2,DEBUG_MODE_ERROR:3,DEBUG_MODE_INFO_FOR_WEB_PAGE:4,DEBUG_MODE_WARN_FOR_WEB_PAGE:5,DEBUG_MODE_ERROR_FOR_WEB_PAGE:6,EVENT_HIDE:"game_on_hide",EVENT_SHOW:"game_on_show",EVENT_RESIZE:"game_on_resize",EVENT_RENDERER_INITED:"renderer_inited",RENDER_TYPE_CANVAS:0,RENDER_TYPE_WEBGL:1,RENDER_TYPE_OPENGL:2,_eventHide:null,_eventShow:null,CONFIG_KEY:{width:"width",height:"height",engineDir:"engineDir",modules:"modules",debugMode:"debugMode",exposeClassName:"exposeClassName",
showFPS:"showFPS",frameRate:"frameRate",id:"id",renderMode:"renderMode",jsList:"jsList"},_paused:!0,_configLoaded:!1,_prepareCalled:!1,_prepared:!1,_rendererInitialized:!1,_renderContext:null,_intervalId:null,_lastTime:null,_frameTime:null,frame:null,container:null,canvas:null,config:null,onStart:null,onStop:null,setFrameRate:function(a){this.config[this.CONFIG_KEY.frameRate]=a;this._intervalId&&window.cancelAnimationFrame(this._intervalId);this._intervalId=0;this._paused=!0;this._setAnimFrame();
this._runMainLoop()},step:function(){cc.director.mainLoop()},pause:function(){this._paused||(this._paused=!0,cc.audioEngine&&cc.audioEngine._pausePlaying(),this._intervalId&&window.cancelAnimationFrame(this._intervalId),this._intervalId=0)},resume:function(){this._paused&&(this._paused=!1,cc.audioEngine&&cc.audioEngine._resumePlaying(),this._runMainLoop())},isPaused:function(){return this._paused},restart:function(){cc.director.popToSceneStackLevel(0);cc.audioEngine&&cc.audioEngine.end();cc.game.onStart()},
end:function(){close()},prepare:function(a){var b=this,c=b.config,d=b.CONFIG_KEY;this._configLoaded?this._prepared?a&&a():this._prepareCalled||(cc._engineLoaded?(this._prepareCalled=!0,this._initRenderer(c[d.width],c[d.height]),cc.view=cc.EGLView._getInstance(),cc.director=cc.Director._getInstance(),cc.director.setOpenGLView&&cc.director.setOpenGLView(cc.view),cc.winSize=cc.director.getWinSize(),this._initEvents(),this._setAnimFrame(),this._runMainLoop(),(c=c[d.jsList])?cc.loader.loadJsWithImg(c,
function(c){if(c)throw Error(c);b._prepared=!0;a&&a()}):a&&a()):cc.initEngine(this.config,function(){b.prepare(a)})):this._loadConfig(function(){b.prepare(a)})},run:function(a,b){"function"===typeof a?cc.game.onStart=a:(a&&("string"===typeof a?(cc.game.config||this._loadConfig(),cc.game.config[cc.game.CONFIG_KEY.id]=a):cc.game.config=a),"function"===typeof b&&(cc.game.onStart=b));this.prepare(cc.game.onStart&&cc.game.onStart.bind(cc.game))},_setAnimFrame:function(){this._lastTime=new Date;var a=cc.game.config[cc.game.CONFIG_KEY.frameRate];
this._frameTime=1E3/a;60!==a&&30!==a?(window.requestAnimFrame=this._stTime,window.cancelAnimationFrame=this._ctTime):(window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime,window.cancelAnimationFrame=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||
window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.oCancelAnimationFrame||this._ctTime)},_stTime:function(a){var b=(new Date).getTime(),c=Math.max(0,cc.game._frameTime-(b-cc.game._lastTime)),d=window.setTimeout(function(){a()},c);cc.game._lastTime=b+c;return d},_ctTime:function(a){window.clearTimeout(a)},_runMainLoop:function(){var a=this,b,c=a.config,d=a.CONFIG_KEY,e=cc.director,f=!0,h=c[d.frameRate];
e.setDisplayStats(c[d.showFPS]);b=function(){a._paused||(30===h&&(f=!f)||e.mainLoop(),a._intervalId=window.requestAnimFrame(b))};a._intervalId=window.requestAnimFrame(b);a._paused=!1},_loadConfig:function(a){var b=this.config||document.ccConfig;if(b)this._initConfig(b),a&&a();else{for(var c=document.getElementsByTagName("script"),d=0;d<c.length&&(b=c[d].getAttribute("cocos"),""!==b&&!b);d++);var e=this,b=function(b,c){var d=JSON.parse(c);e._initConfig(d);a&&a()};if(d<c.length){if(c=c[d].src)c=/(.*)\//.exec(c)[0],
cc.loader.resPath=c,c=cc.path.join(c,"project.json");cc.loader.loadTxt(c,b)}cc.loader.loadTxt("project.json",b)}},_initConfig:function(a){var b=this.CONFIG_KEY,c=a[b.modules];a[b.showFPS]="undefined"===typeof a[b.showFPS]?!0:a[b.showFPS];a[b.engineDir]=a[b.engineDir]||"frameworks/cocos2d-html5";null==a[b.debugMode]&&(a[b.debugMode]=0);a[b.exposeClassName]=!!a[b.exposeClassName];a[b.frameRate]=a[b.frameRate]||60;null==a[b.renderMode]&&(a[b.renderMode]=0);null==a[b.registerSystemEvent]&&(a[b.registerSystemEvent]=
!0);c&&0>c.indexOf("core")&&c.splice(0,0,"core");c&&(a[b.modules]=c);this.config=a;this._configLoaded=!0},_initRenderer:function(a,b){if(!this._rendererInitialized){if(!cc._supportRender)throw Error("The renderer doesn't support the renderMode "+this.config[this.CONFIG_KEY.renderMode]);var c=this.config[cc.game.CONFIG_KEY.id],d=window,c=cc.$(c)||cc.$("#"+c),e,f;"CANVAS"===c.tagName?(a=a||c.width,b=b||c.height,this.canvas=cc._canvas=e=c,this.container=cc.container=f=document.createElement("DIV"),e.parentNode&&
e.parentNode.insertBefore(f,e)):("DIV"!==c.tagName&&cc.log("Warning: target element is not a DIV or CANVAS"),a=a||c.clientWidth,b=b||c.clientHeight,this.canvas=cc._canvas=e=cc.$(document.createElement("CANVAS")),this.container=cc.container=f=document.createElement("DIV"),c.appendChild(f));f.setAttribute("id","Cocos2dGameContainer");f.appendChild(e);this.frame=f.parentNode===document.body?document.documentElement:f.parentNode;e.addClass("gameCanvas");e.setAttribute("width",a||480);e.setAttribute("height",
b||320);e.setAttribute("tabindex",99);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._renderContext=cc._renderContext=cc.webglContext=cc.create3DContext(e,{stencil:!0,alpha:!1}));this._renderContext?(cc.renderer=cc.rendererWebGL,d.gl=this._renderContext,cc.renderer.init(),cc._drawingUtil=new cc.DrawingPrimitiveWebGL(this._renderContext),cc.textureCache._initializingRenderer(),cc.glExt={},cc.glExt.instanced_arrays=d.gl.getExtension("ANGLE_instanced_arrays"),cc.glExt.element_uint=d.gl.getExtension("OES_element_index_uint")):
(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc.renderer=cc.rendererCanvas,this._renderContext=cc._renderContext=new cc.CanvasContextWrapper(e.getContext("2d")),cc._drawingUtil=cc.DrawingPrimitiveCanvas?new cc.DrawingPrimitiveCanvas(this._renderContext):null);cc._gameDiv=f;cc.game.canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1};this.dispatchEvent(this.EVENT_RENDERER_INITED,!0);this._rendererInitialized=!0}},_initEvents:function(){var a=window,b;this._eventHide=this._eventHide||
new cc.EventCustom(this.EVENT_HIDE);this._eventHide.setUserData(this);this._eventShow=this._eventShow||new cc.EventCustom(this.EVENT_SHOW);this._eventShow.setUserData(this);this.config[this.CONFIG_KEY.registerSystemEvent]&&cc.inputManager.registerSystemEvent(this.canvas);cc.isUndefined(document.hidden)?cc.isUndefined(document.mozHidden)?cc.isUndefined(document.msHidden)?cc.isUndefined(document.webkitHidden)||(b="webkitHidden"):b="msHidden":b="mozHidden":b="hidden";var c=["visibilitychange","mozvisibilitychange",
"msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],d=function(){cc.eventManager&&cc.game._eventHide&&cc.eventManager.dispatchEvent(cc.game._eventHide)},e=function(){cc.eventManager&&cc.game._eventShow&&cc.eventManager.dispatchEvent(cc.game._eventShow)};if(b)for(var f=0;f<c.length;f++)document.addEventListener(c[f],function(a){var c=document[b];(c=c||a.hidden)?d():e()},!1);else a.addEventListener("blur",d,!1),a.addEventListener("focus",e,!1);-1<navigator.userAgent.indexOf("MicroMessenger")&&
(a.onfocus=function(){e()});"onpageshow"in window&&"onpagehide"in window&&(a.addEventListener("pagehide",d,!1),a.addEventListener("pageshow",e,!1));cc.eventManager.addCustomListener(cc.game.EVENT_HIDE,function(){cc.game.pause()});cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){cc.game.resume()})}};
Function.prototype.bind=Function.prototype.bind||function(a){if(!cc.isFunction(this))throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};d.prototype=this.prototype;e.prototype=new d;return e};cc.EventHelper=function(){};
cc.EventHelper.prototype={constructor:cc.EventHelper,apply:function(a){a.addEventListener=cc.EventHelper.prototype.addEventListener;a.hasEventListener=cc.EventHelper.prototype.hasEventListener;a.removeEventListener=cc.EventHelper.prototype.removeEventListener;a.dispatchEvent=cc.EventHelper.prototype.dispatchEvent},addEventListener:function(a,b,c){if("load"===a&&this._textureLoaded)setTimeout(function(){b.call(c)},0);else{void 0===this._listeners&&(this._listeners={});var d=this._listeners;void 0===
d[a]&&(d[a]=[]);this.hasEventListener(a,b,c)||d[a].push({callback:b,eventTarget:c})}},hasEventListener:function(a,b,c){if(void 0===this._listeners)return!1;var d=this._listeners;if(void 0!==d[a]){a=0;for(var e=d.length;a<e;a++){var f=d[a];if(f.callback===b&&f.eventTarget===c)return!0}}return!1},removeEventListener:function(a,b,c){if(void 0!==this._listeners&&(a=this._listeners[a],void 0!==a))for(var d=0;d<a.length;){var e=a[d];e.eventTarget===c&&e.callback===b?a.splice(d,1):d++}},removeEventTarget:function(a,
b,c){if(void 0!==this._listeners&&(a=this._listeners[a],void 0!==a))for(b=0;b<a.length;)a[b].eventTarget===c?a.splice(b,1):b++},dispatchEvent:function(a,b){if(void 0!==this._listeners){null==b&&(b=!0);var c=this._listeners[a];if(void 0!==c){for(var d=[],e=c.length,f=0;f<e;f++)d[f]=c[f];for(f=0;f<e;f++)d[f].callback.call(d[f].eventTarget,this);b&&(c.length=0)}}}};cc.EventHelper.prototype.apply(cc.game);cc._LogInfos={ActionManager_addAction:"cc.ActionManager.addAction(): action must be non-null",ActionManager_removeAction:"cocos2d: removeAction: Target not found",ActionManager_removeActionByTag:"cc.ActionManager.removeActionByTag(): an invalid tag",ActionManager_removeActionByTag_2:"cc.ActionManager.removeActionByTag(): target must be non-null",ActionManager_getActionByTag:"cc.ActionManager.getActionByTag(): an invalid tag",ActionManager_getActionByTag_2:"cocos2d : getActionByTag(tag \x3d %s): Action not found",
configuration_dumpInfo:"cocos2d: **** WARNING **** CC_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from ccConfig.js)",configuration_loadConfigFile:"Expected 'data' dict, but not found. Config file: %s",configuration_loadConfigFile_2:"Please load the resource first : %s",Director_resume:"cocos2d: Director: Error in gettimeofday",Director_setProjection:"cocos2d: Director: unrecognized projection",Director_popToSceneStackLevel:"cocos2d: Director: unrecognized projection",Director_popToSceneStackLevel_2:"cocos2d: Director: Error in gettimeofday",
Director_popScene:"running scene should not null",Director_pushScene:"the scene should not null",arrayVerifyType:"element type is wrong!",Scheduler_scheduleCallbackForTarget:"CCSheduler#scheduleCallback. Callback already scheduled. Updating interval from:%s to %s",Scheduler_scheduleCallbackForTarget_2:"cc.scheduler.scheduleCallbackForTarget(): callback_fn should be non-null.",Scheduler_scheduleCallbackForTarget_3:"cc.scheduler.scheduleCallbackForTarget(): target should be non-null.",Scheduler_pauseTarget:"cc.Scheduler.pauseTarget():target should be non-null",
Scheduler_resumeTarget:"cc.Scheduler.resumeTarget():target should be non-null",Scheduler_isTargetPaused:"cc.Scheduler.isTargetPaused():target should be non-null",Node_getZOrder:"getZOrder is deprecated. Please use getLocalZOrder instead.",Node_setZOrder:"setZOrder is deprecated. Please use setLocalZOrder instead.",Node_getRotation:"RotationX !\x3d RotationY. Don't know which one to return",Node_getScale:"ScaleX !\x3d ScaleY. Don't know which one to return",Node_addChild:"An Node can't be added as a child of itself.",
Node_addChild_2:"child already added. It can't be added again",Node_addChild_3:"child must be non-null",Node_removeFromParentAndCleanup:"removeFromParentAndCleanup is deprecated. Use removeFromParent instead",Node_boundingBox:"boundingBox is deprecated. Use getBoundingBox instead",Node_removeChildByTag:"argument tag is an invalid tag",Node_removeChildByTag_2:"cocos2d: removeChildByTag(tag \x3d %s): child not found!",Node_removeAllChildrenWithCleanup:"removeAllChildrenWithCleanup is deprecated. Use removeAllChildren instead",
Node_stopActionByTag:"cc.Node.stopActionBy(): argument tag an invalid tag",Node_getActionByTag:"cc.Node.getActionByTag(): argument tag is an invalid tag",Node_resumeSchedulerAndActions:"resumeSchedulerAndActions is deprecated, please use resume instead.",Node_pauseSchedulerAndActions:"pauseSchedulerAndActions is deprecated, please use pause instead.",Node__arrayMakeObjectsPerformSelector:"Unknown callback function",Node_reorderChild:"cc.Node.reorderChild(): child must be non-null",Node_reorderChild_2:"cc.Node.reorderChild(): this child is not in children list",
Node_runAction:"cc.Node.runAction(): action must be non-null",Node_schedule:"callback function must be non-null",Node_schedule_2:"interval must be positive",Node_initWithTexture:"cocos2d: Could not initialize cc.AtlasNode. Invalid Texture.",AtlasNode_updateAtlasValues:"cc.AtlasNode.updateAtlasValues(): Shall be overridden in subclasses",AtlasNode_initWithTileFile:"",AtlasNode__initWithTexture:"cocos2d: Could not initialize cc.AtlasNode. Invalid Texture.",_EventListenerKeyboard_checkAvailable:"cc._EventListenerKeyboard.checkAvailable(): Invalid EventListenerKeyboard!",
_EventListenerTouchOneByOne_checkAvailable:"cc._EventListenerTouchOneByOne.checkAvailable(): Invalid EventListenerTouchOneByOne!",_EventListenerTouchAllAtOnce_checkAvailable:"cc._EventListenerTouchAllAtOnce.checkAvailable(): Invalid EventListenerTouchAllAtOnce!",_EventListenerAcceleration_checkAvailable:"cc._EventListenerAcceleration.checkAvailable(): _onAccelerationEvent must be non-nil",EventListener_create:"Invalid parameter.",__getListenerID:"Don't call this method if the event is for touch.",
eventManager__forceAddEventListener:"Invalid scene graph priority!",eventManager_addListener:"0 priority is forbidden for fixed priority since it's used for scene graph based priority.",eventManager_removeListeners:"Invalid listener type!",eventManager_setPriority:"Can't set fixed priority with scene graph based listener.",eventManager_addListener_2:"Invalid parameters.",eventManager_addListener_3:"listener must be a cc.EventListener object when adding a fixed priority listener",eventManager_addListener_4:"The listener has been registered, please don't register it again.",
LayerMultiplex_initWithLayers:"parameters should not be ending with null in Javascript",LayerMultiplex_switchTo:"Invalid index in MultiplexLayer switchTo message",LayerMultiplex_switchToAndReleaseMe:"Invalid index in MultiplexLayer switchTo message",LayerMultiplex_addLayer:"cc.Layer.addLayer(): layer should be non-null",EGLView_setDesignResolutionSize:"Resolution not valid",EGLView_setDesignResolutionSize_2:"should set resolutionPolicy",inputManager_handleTouchesBegin:"The touches is more than MAX_TOUCHES, nUnusedIndex \x3d %s",
swap:"cc.swap is being modified from original macro, please check usage",checkGLErrorDebug:"WebGL error %s",animationCache__addAnimationsWithDictionary:"cocos2d: cc.AnimationCache: No animations were found in provided dictionary.",animationCache__addAnimationsWithDictionary_2:"cc.AnimationCache. Invalid animation format",animationCache_addAnimations:"cc.AnimationCache.addAnimations(): File could not be found",animationCache__parseVersion1:"cocos2d: cc.AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
animationCache__parseVersion1_2:"cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",animationCache__parseVersion1_3:"cocos2d: cc.AnimationCache: None of the frames for animation '%s' were found in the cc.SpriteFrameCache. Animation is not being added to the Animation Cache.",animationCache__parseVersion1_4:"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 '%s' may be missing.",
animationCache__parseVersion2:"cocos2d: CCAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",animationCache__parseVersion2_2:"cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",animationCache_addAnimations_2:"cc.AnimationCache.addAnimations(): Invalid texture file name",Sprite_ignoreAnchorPointForPosition:"cc.Sprite.ignoreAnchorPointForPosition(): it is invalid in cc.Sprite when using SpriteBatchNode",
Sprite_setDisplayFrameWithAnimationName:"cc.Sprite.setDisplayFrameWithAnimationName(): Frame not found",Sprite_setDisplayFrameWithAnimationName_2:"cc.Sprite.setDisplayFrameWithAnimationName(): Invalid frame index",Sprite_setDisplayFrame:"setDisplayFrame is deprecated, please use setSpriteFrame instead.",Sprite__updateBlendFunc:"cc.Sprite._updateBlendFunc(): _updateBlendFunc doesn't work when the sprite is rendered using a cc.CCSpriteBatchNode",Sprite_initWithSpriteFrame:"cc.Sprite.initWithSpriteFrame(): spriteFrame should be non-null",
Sprite_initWithSpriteFrameName:"cc.Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null",Sprite_initWithSpriteFrameName1:" is null, please check.",Sprite_initWithFile:"cc.Sprite.initWithFile(): filename should be non-null",Sprite_setDisplayFrameWithAnimationName_3:"cc.Sprite.setDisplayFrameWithAnimationName(): animationName must be non-null",Sprite_addChild:"cc.Sprite.addChild(): cc.Sprite only supports cc.Sprites as children when using cc.SpriteBatchNode",Sprite_addChild_2:"cc.Sprite.addChild(): cc.Sprite only supports a sprite using same texture as children when using cc.SpriteBatchNode",
Sprite_addChild_3:"cc.Sprite.addChild(): child should be non-null",Sprite_setTexture:"cc.Sprite.texture setter: Batched sprites should use the same texture as the batchnode",Sprite_updateQuadFromSprite:"cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",Sprite_insertQuadFromSprite:"cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",Sprite_addChild_4:"cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children",
Sprite_addChild_5:"cc.SpriteBatchNode.addChild(): cc.Sprite is not using the same texture",Sprite_initWithTexture:"Sprite.initWithTexture(): Argument must be non-nil ",Sprite_setSpriteFrame:"Invalid spriteFrameName",Sprite_setTexture_2:"Invalid argument: cc.Sprite.texture setter expects a CCTexture2D.",Sprite_updateQuadFromSprite_2:"cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null",Sprite_insertQuadFromSprite_2:"cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null",
SpriteBatchNode_addSpriteWithoutQuad:"cc.SpriteBatchNode.addQuadFromSprite(): SpriteBatchNode only supports cc.Sprites as children",SpriteBatchNode_increaseAtlasCapacity:"cocos2d: CCSpriteBatchNode: resizing TextureAtlas capacity from %s to %s.",SpriteBatchNode_increaseAtlasCapacity_2:"cocos2d: WARNING: Not enough memory to resize the atlas",SpriteBatchNode_reorderChild:"cc.SpriteBatchNode.addChild(): Child doesn't belong to Sprite",SpriteBatchNode_removeChild:"cc.SpriteBatchNode.addChild(): sprite batch node should contain the child",
SpriteBatchNode_addSpriteWithoutQuad_2:"cc.SpriteBatchNode.addQuadFromSprite(): child should be non-null",SpriteBatchNode_reorderChild_2:"cc.SpriteBatchNode.addChild(): child should be non-null",spriteFrameCache__getFrameConfig:"cocos2d: WARNING: originalWidth/Height not found on the cc.SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist",spriteFrameCache_addSpriteFrames:"cocos2d: WARNING: an alias with name %s already exists",spriteFrameCache__checkConflict:"cocos2d: WARNING: Sprite frame: %s has already been added by another source, please fix name conflit",
spriteFrameCache_getSpriteFrame:"cocos2d: cc.SpriteFrameCahce: Frame %s not found",spriteFrameCache__getFrameConfig_2:"Please load the resource first : %s",spriteFrameCache_addSpriteFrames_2:"cc.SpriteFrameCache.addSpriteFrames(): plist should be non-null",spriteFrameCache_addSpriteFrames_3:"Argument must be non-nil",CCSpriteBatchNode_updateQuadFromSprite:"cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",CCSpriteBatchNode_insertQuadFromSprite:"cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",
CCSpriteBatchNode_addChild:"cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children",CCSpriteBatchNode_initWithTexture:"Sprite.initWithTexture(): Argument must be non-nil ",CCSpriteBatchNode_addChild_2:"cc.Sprite.addChild(): child should be non-null",CCSpriteBatchNode_setSpriteFrame:"Invalid spriteFrameName",CCSpriteBatchNode_setTexture:"Invalid argument: cc.Sprite texture setter expects a CCTexture2D.",CCSpriteBatchNode_updateQuadFromSprite_2:"cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null",
CCSpriteBatchNode_insertQuadFromSprite_2:"cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null",CCSpriteBatchNode_addChild_3:"cc.SpriteBatchNode.addChild(): child should be non-null",TextureAtlas_initWithFile:"cocos2d: Could not open file: %s",TextureAtlas_insertQuad:"cc.TextureAtlas.insertQuad(): invalid totalQuads",TextureAtlas_initWithTexture:"cc.TextureAtlas.initWithTexture():texture should be non-null",TextureAtlas_updateQuad:"cc.TextureAtlas.updateQuad(): quad should be non-null",
TextureAtlas_updateQuad_2:"cc.TextureAtlas.updateQuad(): Invalid index",TextureAtlas_insertQuad_2:"cc.TextureAtlas.insertQuad(): Invalid index",TextureAtlas_insertQuads:"cc.TextureAtlas.insertQuad(): Invalid index + amount",TextureAtlas_insertQuadFromIndex:"cc.TextureAtlas.insertQuadFromIndex(): Invalid newIndex",TextureAtlas_insertQuadFromIndex_2:"cc.TextureAtlas.insertQuadFromIndex(): Invalid fromIndex",TextureAtlas_removeQuadAtIndex:"cc.TextureAtlas.removeQuadAtIndex(): Invalid index",TextureAtlas_removeQuadsAtIndex:"cc.TextureAtlas.removeQuadsAtIndex(): index + amount out of bounds",
TextureAtlas_moveQuadsFromIndex:"cc.TextureAtlas.moveQuadsFromIndex(): move is out of bounds",TextureAtlas_moveQuadsFromIndex_2:"cc.TextureAtlas.moveQuadsFromIndex(): Invalid newIndex",TextureAtlas_moveQuadsFromIndex_3:"cc.TextureAtlas.moveQuadsFromIndex(): Invalid oldIndex",textureCache_addPVRTCImage:"TextureCache:addPVRTCImage does not support on HTML5",textureCache_addETCImage:"TextureCache:addPVRTCImage does not support on HTML5",textureCache_textureForKey:"textureForKey is deprecated. Please use getTextureForKey instead.",
textureCache_addPVRImage:"addPVRImage does not support on HTML5",textureCache_addUIImage:"cocos2d: Couldn't add UIImage in TextureCache",textureCache_dumpCachedTextureInfo:"cocos2d: '%s' id\x3d%s %s x %s",textureCache_dumpCachedTextureInfo_2:"cocos2d: '%s' id\x3d HTMLCanvasElement %s x %s",textureCache_dumpCachedTextureInfo_3:"cocos2d: TextureCache dumpDebugInfo: %s textures, HTMLCanvasElement for %s KB (%s MB)",textureCache_addUIImage_2:"cc.Texture.addUIImage(): image should be non-null",Texture2D_initWithETCFile:"initWithETCFile does not support on HTML5",
Texture2D_initWithPVRFile:"initWithPVRFile does not support on HTML5",Texture2D_initWithPVRTCData:"initWithPVRTCData does not support on HTML5",Texture2D_addImage:"cc.Texture.addImage(): path should be non-null",Texture2D_initWithImage:"cocos2d: cc.Texture2D. Can't create Texture. UIImage is nil",Texture2D_initWithImage_2:"cocos2d: WARNING: Image (%s x %s) is bigger than the supported %s x %s",Texture2D_initWithString:"initWithString isn't supported on cocos2d-html5",Texture2D_initWithETCFile_2:"initWithETCFile does not support on HTML5",
Texture2D_initWithPVRFile_2:"initWithPVRFile does not support on HTML5",Texture2D_initWithPVRTCData_2:"initWithPVRTCData does not support on HTML5",Texture2D_bitsPerPixelForFormat:"bitsPerPixelForFormat: %s, cannot give useful result, it's a illegal pixel format",Texture2D__initPremultipliedATextureWithImage:"cocos2d: cc.Texture2D: Using RGB565 texture since image has no alpha",Texture2D_addImage_2:"cc.Texture.addImage(): path should be non-null",Texture2D_initWithData:"NSInternalInconsistencyException",
MissingFile:"Missing file: %s",radiansToDegress:"cc.radiansToDegress() should be called cc.radiansToDegrees()",RectWidth:"Rect width exceeds maximum margin: %s",RectHeight:"Rect height exceeds maximum margin: %s",EventManager__updateListeners:"If program goes here, there should be event in dispatch.",EventManager__updateListeners_2:"_inDispatch should be 1 here."};
cc._logToWebPage=function(a){if(cc._canvas){var b=cc._logList,c=document;if(!b){var d=c.createElement("Div"),b=d.style;d.setAttribute("id","logInfoDiv");cc._canvas.parentNode.appendChild(d);d.setAttribute("width","200");d.setAttribute("height",cc._canvas.height);b.zIndex="99999";b.position="absolute";b.top="0";b.left="0";b=cc._logList=c.createElement("textarea");c=b.style;b.setAttribute("rows","20");b.setAttribute("cols","30");b.setAttribute("disabled",!0);d.appendChild(b);c.backgroundColor="transparent";
c.borderBottom="1px solid #cccccc";c.borderRightWidth="0px";c.borderLeftWidth="0px";c.borderTopWidth="0px";c.borderTopStyle="none";c.borderRightStyle="none";c.borderLeftStyle="none";c.padding="0px";c.margin=0}b.value=b.value+a+"\r\n";b.scrollTop=b.scrollHeight}};cc._formatString=function(a){if(cc.isObject(a))try{return JSON.stringify(a)}catch(b){return""}else return a};
cc._initDebugSetting=function(a){var b=cc.game;if(a!==b.DEBUG_MODE_NONE){var c;a>b.DEBUG_MODE_ERROR?(c=cc._logToWebPage.bind(cc),cc.error=function(){c("ERROR :  "+cc.formatStr.apply(cc,arguments))},cc.assert=function(a,b){if(!a&&b){for(var f=2;f<arguments.length;f++)b=b.replace(/(%s)|(%d)/,cc._formatString(arguments[f]));c("Assert: "+b)}},a!==b.DEBUG_MODE_ERROR_FOR_WEB_PAGE&&(cc.warn=function(){c("WARN :  "+cc.formatStr.apply(cc,arguments))}),a===b.DEBUG_MODE_INFO_FOR_WEB_PAGE&&(cc.log=function(){c(cc.formatStr.apply(cc,
arguments))})):console&&console.log.apply&&(cc.error=Function.prototype.bind.call(console.error,console),cc.assert=console.assert?Function.prototype.bind.call(console.assert,console):function(a,b){if(!a&&b){for(var c=2;c<arguments.length;c++)b=b.replace(/(%s)|(%d)/,cc._formatString(arguments[c]));throw Error(b);}},a!==b.DEBUG_MODE_ERROR&&(cc.warn=Function.prototype.bind.call(console.warn,console)),a===b.DEBUG_MODE_INFO&&(cc.log=Function.prototype.bind.call(console.log,console)))}};cc.loader.loadBinary=function(a,b){var c=this,d=this.getXMLHttpRequest(),e="load "+a+" failed!";d.open("GET",a,!0);d.responseType="arraybuffer";cc.loader.loadBinary._IEFilter?(d.setRequestHeader("Accept-Charset","x-user-defined"),d.onreadystatechange=function(){if(4===d.readyState&&200===d.status){var a=cc._convertResponseBodyToText(d.responseBody);b(null,c._str2Uint8Array(a))}else b(e)}):(d.overrideMimeType&&d.overrideMimeType("text/plain; charset\x3dx-user-defined"),d.onload=function(){4===d.readyState&&
200===d.status?b(null,new Uint8Array(d.response)):b(e)});d.send(null)};cc.loader.loadBinary._IEFilter=/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)&&window.IEBinaryToArray_ByteStr&&window.IEBinaryToArray_ByteStr_Last;cc.loader._str2Uint8Array=function(a){if(!a)return null;for(var b=new Uint8Array(a.length),c=0;c<a.length;c++)b[c]=a.charCodeAt(c)&255;return b};
cc.loader.loadBinarySync=function(a){var b=this.getXMLHttpRequest();b.timeout=0;var c="load "+a+" failed!";b.open("GET",a,!1);a=null;if(cc.loader.loadBinary._IEFilter){b.setRequestHeader("Accept-Charset","x-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;(b=cc._convertResponseBodyToText(b.responseBody))&&(a=this._str2Uint8Array(b))}else{b.overrideMimeType&&b.overrideMimeType("text/plain; charset\x3dx-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;a=this._str2Uint8Array(b.responseText)}return a};
window.Uint8Array=window.Uint8Array||window.Array;
if(cc.loader.loadBinary._IEFilter){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 b={},c=0;256>c;c++)for(var d=0;256>d;d++)b[String.fromCharCode(c+256*d)]=String.fromCharCode(c)+String.fromCharCode(d);c=IEBinaryToArray_ByteStr(a);a=IEBinaryToArray_ByteStr_Last(a);return c.replace(/[\s\S]/g,function(a){return b[a]})+a}};cc=cc||{};cc._loadingImage="data:image/gif;base64,R0lGODlhEAAQALMNAD8/P7+/vyoqKlVVVX9/fxUVFUBAQGBgYMDAwC8vL5CQkP///wAAAP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAANACwAAAAAEAAQAAAEO5DJSau9OOvNex0IMnDIsiCkiW6g6BmKYlBFkhSUEgQKlQCARG6nEBwOgl+QApMdCIRD7YZ5RjlGpCUCACH5BAUAAA0ALAAAAgAOAA4AAAQ6kLGB0JA4M7QW0hrngRllkYyhKAYqKUGguAws0ypLS8JxCLQDgXAIDg+FRKIA6v0SAECCBpXSkstMBAAh+QQFAAANACwAAAAACgAQAAAEOJDJORAac6K1kDSKYmydpASBUl0mqmRfaGTCcQgwcxDEke+9XO2WkxQSiUIuAQAkls0n7JgsWq8RACH5BAUAAA0ALAAAAAAOAA4AAAQ6kMlplDIzTxWC0oxwHALnDQgySAdBHNWFLAvCukc215JIZihVIZEogDIJACBxnCSXTcmwGK1ar1hrBAAh+QQFAAANACwAAAAAEAAKAAAEN5DJKc4RM+tDyNFTkSQF5xmKYmQJACTVpQSBwrpJNteZSGYoFWjIGCAQA2IGsVgglBOmEyoxIiMAIfkEBQAADQAsAgAAAA4ADgAABDmQSVZSKjPPBEDSGucJxyGA1XUQxAFma/tOpDlnhqIYN6MEAUXvF+zldrMBAjHoIRYLhBMqvSmZkggAIfkEBQAADQAsBgAAAAoAEAAABDeQyUmrnSWlYhMASfeFVbZdjHAcgnUQxOHCcqWylKEohqUEAYVkgEAMfkEJYrFA6HhKJsJCNFoiACH5BAUAAA0ALAIAAgAOAA4AAAQ3kMlJq704611SKloCAEk4lln3DQgyUMJxCBKyLAh1EMRR3wiDQmHY9SQslyIQUMRmlmVTIyRaIgA7";
cc._fpsImage="data:image/png;base64, \x3d";
cc._loaderImage="data:image/jpeg;base64, \x3d";cc=cc||{};
cc.defineGetterSetter=function(a,b,c,d,e,f){if(a.__defineGetter__)c&&a.__defineGetter__(b,c),d&&a.__defineSetter__(b,d);else if(Object.defineProperty){var h={enumerable:!1,configurable:!0};c&&(h.get=c);d&&(h.set=d);Object.defineProperty(a,b,h)}else throw Error("browser does not support getters");if(!e&&!f)for(var h=null!=c,k=void 0!=d,m=Object.getOwnPropertyNames(a),n=0;n<m.length;n++){var p=m[n];if((a.__lookupGetter__?!a.__lookupGetter__(p):!Object.getOwnPropertyDescriptor(a,p))&&"function"===typeof a[p]){var r=
a[p];if(h&&r===c&&(e=p,!k||f))break;if(k&&r===d&&(f=p,!h||e))break}}a=a.constructor;e&&(a.__getters__||(a.__getters__={}),a.__getters__[e]=b);f&&(a.__setters__||(a.__setters__={}),a.__setters__[f]=b)};cc.clone=function(a){var b=a.constructor?new a.constructor:{},c;for(c in a){var d=a[c];b[c]="object"!==typeof d||!d||d instanceof cc.Node||d instanceof HTMLElement?d:cc.clone(d)}return b};cc.inject=function(a,b){for(var c in a)b[c]=a[c]};
var ClassManager=function(){var a=0|998*Math.random(),b=0|998*Math.random();this.getNewID=function(){return a++};this.getNewInstanceId=function(){return b++}},classManager=new ClassManager;
(function(){var a=/\b_super\b/;cc.Class=function(){};cc.Class.extend=function(b){var c=this.prototype,d=Object.create(c),e={writable:!0,enumerable:!1,configurable:!0},f;cc.game.config&&cc.game.config[cc.game.CONFIG_KEY.exposeClassName]?(f="(function "+(b._className||"Class")+" (arg0, arg1, arg2, arg3, arg4, arg5) {\n",f+="    this.__instanceId \x3d classManager.getNewInstanceId();\n    if (this.ctor) {\n",f+="        switch (arguments.length) {\n",f+="        case 0: this.ctor(); break;\n",f+="        case 1: this.ctor(arg0); break;\n",
f+="        case 3: this.ctor(arg0, arg1, arg2); break;\n",f+="        case 4: this.ctor(arg0, arg1, arg2, arg3); break;\n",f+="        case 5: this.ctor(arg0, arg1, arg2, arg3, arg4); break;\n",f+="        default: this.ctor.apply(this, arguments);\n",f+="        }\n",f+="    }\n",f+="})",f=eval(f)):f=function(a,b,c,d,e){this.__instanceId=classManager.getNewInstanceId();if(this.ctor)switch(arguments.length){case 0:this.ctor();break;case 1:this.ctor(a);break;case 2:this.ctor(a,b);break;case 3:this.ctor(a,
b,c);break;case 4:this.ctor(a,b,c,d);break;case 5:this.ctor(a,b,c,d,e);break;default:this.ctor.apply(this,arguments)}};e.value=classManager.getNewID();Object.defineProperty(d,"__pid",e);f.prototype=d;e.value=f;Object.defineProperty(d,"constructor",e);this.__getters__&&(f.__getters__=cc.clone(this.__getters__));this.__setters__&&(f.__setters__=cc.clone(this.__setters__));for(var h=0,k=arguments.length;h<k;++h){var m=arguments[h],n;for(n in m){var p="function"===typeof m[n],r="function"===typeof c[n],
s=a.test(m[n]);p&&r&&s?(e.value=function(a,b){return function(){var d=this._super;this._super=c[a];var e=b.apply(this,arguments);this._super=d;return e}}(n,m[n]),Object.defineProperty(d,n,e)):p?(e.value=m[n],Object.defineProperty(d,n,e)):d[n]=m[n];if(p){var t,w;if(this.__getters__&&this.__getters__[n]){var p=this.__getters__[n],v;for(v in this.__setters__)if(this.__setters__[v]===p){w=v;break}cc.defineGetterSetter(d,p,m[n],m[w]?m[w]:d[w],n,w)}if(this.__setters__&&this.__setters__[n]){p=this.__setters__[n];
for(v in this.__getters__)if(this.__getters__[v]===p){t=v;break}cc.defineGetterSetter(d,p,m[t]?m[t]:d[t],m[n],t,n)}}}}f.extend=cc.Class.extend;f.implement=function(a){for(var b in a)d[b]=a[b]};return f}})();cc=cc||{};cc._tmp=cc._tmp||{};cc.associateWithNative=function(a,b){};
cc.KEY={none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,
"-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"\x3d":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1E3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005};cc.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};cc.Point=function(a,b){this.x=a||0;this.y=b||0};cc.p=function(a,b){return void 0===a?{x:0,y:0}:void 0===b?{x:a.x,y:a.y}:{x:a,y:b}};cc.pointEqualToPoint=function(a,b){return a&&b&&a.x===b.x&&a.y===b.y};cc.Size=function(a,b){this.width=a||0;this.height=b||0};cc.size=function(a,b){return void 0===a?{width:0,height:0}:void 0===b?{width:a.width,height:a.height}:{width:a,height:b}};cc.sizeEqualToSize=function(a,b){return a&&b&&a.width===b.width&&a.height===b.height};
cc.Rect=function(a,b,c,d){this.x=a||0;this.y=b||0;this.width=c||0;this.height=d||0};cc.rect=function(a,b,c,d){return void 0===a?{x:0,y:0,width:0,height:0}:void 0===b?{x:a.x,y:a.y,width:a.width,height:a.height}:{x:a,y:b,width:c,height:d}};cc.rectEqualToRect=function(a,b){return a&&b&&a.x===b.x&&a.y===b.y&&a.width===b.width&&a.height===b.height};cc._rectEqualToZero=function(a){return a&&0===a.x&&0===a.y&&0===a.width&&0===a.height};
cc.rectContainsRect=function(a,b){return a&&b?!(a.x>=b.x||a.y>=b.y||a.x+a.width<=b.x+b.width||a.y+a.height<=b.y+b.height):!1};cc.rectGetMaxX=function(a){return a.x+a.width};cc.rectGetMidX=function(a){return a.x+a.width/2};cc.rectGetMinX=function(a){return a.x};cc.rectGetMaxY=function(a){return a.y+a.height};cc.rectGetMidY=function(a){return a.y+a.height/2};cc.rectGetMinY=function(a){return a.y};
cc.rectContainsPoint=function(a,b){return b.x>=cc.rectGetMinX(a)&&b.x<=cc.rectGetMaxX(a)&&b.y>=cc.rectGetMinY(a)&&b.y<=cc.rectGetMaxY(a)};cc.rectIntersectsRect=function(a,b){var c=a.y+a.height,d=b.x+b.width,e=b.y+b.height;return!(a.x+a.width<b.x||d<a.x||c<b.y||e<a.y)};cc.rectOverlapsRect=function(a,b){return!(a.x+a.width<b.x||b.x+b.width<a.x||a.y+a.height<b.y||b.y+b.height<a.y)};
cc.rectUnion=function(a,b){var c=cc.rect(0,0,0,0);c.x=Math.min(a.x,b.x);c.y=Math.min(a.y,b.y);c.width=Math.max(a.x+a.width,b.x+b.width)-c.x;c.height=Math.max(a.y+a.height,b.y+b.height)-c.y;return c};cc.rectIntersection=function(a,b){var c=cc.rect(Math.max(cc.rectGetMinX(a),cc.rectGetMinX(b)),Math.max(cc.rectGetMinY(a),cc.rectGetMinY(b)),0,0);c.width=Math.min(cc.rectGetMaxX(a),cc.rectGetMaxX(b))-cc.rectGetMinX(c);c.height=Math.min(cc.rectGetMaxY(a),cc.rectGetMaxY(b))-cc.rectGetMinY(c);return c};cc.SAXParser=cc.Class.extend({_parser:null,_isSupportDOMParser:null,ctor:function(){window.DOMParser?(this._isSupportDOMParser=!0,this._parser=new DOMParser):this._isSupportDOMParser=!1},parse:function(a){return this._parseXML(a)},_parseXML:function(a){var b;this._isSupportDOMParser?b=this._parser.parseFromString(a,"text/xml"):(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a));return b}});
cc.PlistParser=cc.SAXParser.extend({parse:function(a){a=this._parseXML(a).documentElement;if("plist"!==a.tagName)return cc.warn("Not a plist file!"),{};for(var b=null,c=0,d=a.childNodes.length;c<d&&(b=a.childNodes[c],1!==b.nodeType);c++);return this._parseNode(b)},_parseNode:function(a){var b=null,c=a.tagName;if("dict"===c)b=this._parseDict(a);else if("array"===c)b=this._parseArray(a);else if("string"===c)if(1===a.childNodes.length)b=a.firstChild.nodeValue;else for(b="",c=0;c<a.childNodes.length;c++)b+=
a.childNodes[c].nodeValue;else"false"===c?b=!1:"true"===c?b=!0:"real"===c?b=parseFloat(a.firstChild.nodeValue):"integer"===c&&(b=parseInt(a.firstChild.nodeValue,10));return b},_parseArray:function(a){for(var b=[],c=0,d=a.childNodes.length;c<d;c++){var e=a.childNodes[c];1===e.nodeType&&b.push(this._parseNode(e))}return b},_parseDict:function(a){for(var b={},c=null,d=0,e=a.childNodes.length;d<e;d++){var f=a.childNodes[d];1===f.nodeType&&("key"===f.tagName?c=f.firstChild.nodeValue:b[c]=this._parseNode(f))}return b}});
cc.saxParser=new cc.SAXParser;cc.plistParser=new cc.PlistParser;cc._txtLoader={load:function(a,b,c,d){cc.loader.loadTxt(a,d)}};cc.loader.register(["txt","xml","vsh","fsh","atlas"],cc._txtLoader);cc._jsonLoader={load:function(a,b,c,d){cc.loader.loadJson(a,d)}};cc.loader.register(["json","ExportJson"],cc._jsonLoader);cc._jsLoader={load:function(a,b,c,d){cc.loader.loadJs(a,d)}};cc.loader.register(["js"],cc._jsLoader);
cc._imgLoader={load:function(a,b,c,d){c=cc.loader.isLoading(a)?function(a,c){if(a)return d(a);var h=cc.textureCache.getTextureForKey(b)||cc.textureCache.handleLoadedTexture(b,c);d(null,h)}:function(a,c){if(a)return d(a);var h=cc.textureCache.handleLoadedTexture(b,c);d(null,h)};cc.loader.loadImg(a,c)}};cc.loader.register("png jpg bmp jpeg gif ico tiff webp".split(" "),cc._imgLoader);cc._serverImgLoader={load:function(a,b,c,d){cc._imgLoader.load(c.src,b,c,d)}};cc.loader.register(["serverImg"],cc._serverImgLoader);
cc._plistLoader={load:function(a,b,c,d){cc.loader.loadTxt(a,function(a,b){if(a)return d(a);d(null,cc.plistParser.parse(b))})}};cc.loader.register(["plist"],cc._plistLoader);
cc._fontLoader={TYPE:{".eot":"embedded-opentype",".ttf":"truetype",".ttc":"truetype",".woff":"woff",".svg":"svg"},_loadFont:function(a,b,c){var d=document,e=cc.path,f=this.TYPE,h=document.createElement("style");h.type="text/css";d.body.appendChild(h);var k="",k=isNaN(a-0)?k+("@font-face { font-family:"+a+"; src:"):k+("@font-face { font-family:'"+a+"'; src:");if(b instanceof Array)for(var m=0,n=b.length;m<n;m++)c=e.extname(b[m]).toLowerCase(),k+="url('"+b[m]+"') format('"+f[c]+"')",k+=m===n-1?";":
",";else c=c.toLowerCase(),k+="url('"+b+"') format('"+f[c]+"');";h.textContent+=k+"}";b=document.createElement("div");c=b.style;c.fontFamily=a;b.innerHTML=".";c.position="absolute";c.left="-100px";c.top="-100px";d.body.appendChild(b)},load:function(a,b,c,d){b=c.type;a=c.name;b=c.srcs;cc.isString(c)?(b=cc.path.extname(c),a=cc.path.basename(c,b),this._loadFont(a,c,b)):this._loadFont(a,b);document.fonts?document.fonts.load("1em "+a).then(function(){d(null,!0)},function(a){d(a)}):d(null,!0)}};
cc.loader.register("font eot ttf woff svg ttc".split(" "),cc._fontLoader);cc._binaryLoader={load:function(a,b,c,d){cc.loader.loadBinary(a,d)}};cc._csbLoader={load:function(a,b,c,d){cc.loader.loadCsb(a,d)}};cc.loader.register(["csb"],cc._csbLoader);window.CocosEngine=cc.ENGINE_VERSION="Cocos2d-JS v3.17";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=1;cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP=0;cc.TEXTURE_ATLAS_USE_VAO=0;cc.TEXTURE_NPOT_SUPPORT=0;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.DRAWNODE_TOTAL_VERTICES=2E4;cc.DEFAULT_ENGINE=cc.ENGINE_VERSION+"-canvas";cc.ENABLE_STACKABLE_ACTIONS=1;cc.ENABLE_GL_STATE_CACHE=1;cc.$=function(a){var b=this===cc?document:this;if(a=a instanceof HTMLElement?a:b.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,b){this.position.x=a;this.position.y=b;this.transforms();return this},a.rotate=function(a){this.rotation=a;this.transforms();return this},a.resize=function(a,b){this.scale.x=a;this.scale.y=b;this.transforms();return this},a.setSkew=function(a,b){this.skew.x=a;this.skew.y=b;this.transforms();return this};return a};
switch(cc.sys.browserType){case cc.sys.BROWSER_TYPE_FIREFOX:cc.$.pfx="Moz";cc.$.hd=!0;break;case cc.sys.BROWSER_TYPE_CHROME:case cc.sys.BROWSER_TYPE_SAFARI:cc.$.pfx="webkit";cc.$.hd=!0;break;case cc.sys.BROWSER_TYPE_OPERA:cc.$.pfx="O";cc.$.hd=!1;break;case cc.sys.BROWSER_TYPE_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 b=0,c=0;do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{x:b,y:c}};cc.INVALID_INDEX=-1;cc.PI=Math.PI;cc.FLT_MAX=parseFloat("3.402823466e+38F");cc.FLT_MIN=parseFloat("1.175494351e-38F");cc.RAD=cc.PI/180;cc.DEG=180/cc.PI;cc.UINT_MAX=4294967295;cc.swap=function(a,b,c){if(!cc.isObject(c)||cc.isUndefined(c.x)||cc.isUndefined(c.y))cc.log(cc._LogInfos.swap);else{var d=c[a];c[a]=c[b];c[b]=d}};cc.lerp=function(a,b,c){return a+(b-a)*c};cc.rand=function(){return 16777215*Math.random()};cc.randomMinus1To1=function(){return 2*(Math.random()-0.5)};cc.random0To1=Math.random;
cc.degreesToRadians=function(a){return a*cc.RAD};cc.radiansToDegrees=function(a){return a*cc.DEG};cc.radiansToDegress=function(a){cc.log(cc._LogInfos.radiansToDegress);return a*cc.DEG};cc.REPEAT_FOREVER=Number.MAX_VALUE-1;cc.nodeDrawSetup=function(a){a._shaderProgram&&(a._glProgramState.apply(),a._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4())};cc.enableDefaultGLStates=function(){};cc.disableDefaultGLStates=function(){};cc.incrementGLDraws=function(a){cc.g_NumberOfDraws+=a};
cc.FLT_EPSILON=1.192092896E-7;cc.contentScaleFactor=function(){return cc.director._contentScaleFactor};cc.pointPointsToPixels=function(a){var b=cc.contentScaleFactor();return cc.p(a.x*b,a.y*b)};cc.pointPixelsToPoints=function(a){var b=cc.contentScaleFactor();return cc.p(a.x/b,a.y/b)};cc._pointPixelsToPointsOut=function(a,b){var c=cc.contentScaleFactor();b.x=a.x/c;b.y=a.y/c};cc.sizePointsToPixels=function(a){var b=cc.contentScaleFactor();return cc.size(a.width*b,a.height*b)};
cc.sizePixelsToPoints=function(a){var b=cc.contentScaleFactor();return cc.size(a.width/b,a.height/b)};cc._sizePixelsToPointsOut=function(a,b){var c=cc.contentScaleFactor();b.width=a.width/c;b.height=a.height/c};cc.rectPixelsToPoints=function(a){var b=cc.contentScaleFactor();return cc.rect(a.x/b,a.y/b,a.width/b,a.height/b)};cc.rectPointsToPixels=function(a){var b=cc.contentScaleFactor();return cc.rect(a.x*b,a.y*b,a.width*b,a.height*b)};cc.ONE=1;cc.ZERO=0;cc.SRC_ALPHA=770;cc.SRC_ALPHA_SATURATE=776;
cc.SRC_COLOR=768;cc.DST_ALPHA=772;cc.DST_COLOR=774;cc.ONE_MINUS_SRC_ALPHA=771;cc.ONE_MINUS_SRC_COLOR=769;cc.ONE_MINUS_DST_ALPHA=773;cc.ONE_MINUS_DST_COLOR=775;cc.ONE_MINUS_CONSTANT_ALPHA=32772;cc.ONE_MINUS_CONSTANT_COLOR=32770;cc.LINEAR=9729;cc.REPEAT=10497;cc.CLAMP_TO_EDGE=33071;cc.MIRRORED_REPEAT=33648;cc.BLEND_SRC=cc.SRC_ALPHA;
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA&&(cc.BLEND_SRC=cc.ONE)});cc.BLEND_DST=cc.ONE_MINUS_SRC_ALPHA;cc.checkGLErrorDebug=function(){if(cc.renderMode===cc.game.RENDER_TYPE_WEBGL){var a=cc._renderContext.getError();a&&cc.log(cc._LogInfos.checkGLErrorDebug,a)}};cc.ORIENTATION_PORTRAIT=1;cc.ORIENTATION_LANDSCAPE=2;cc.ORIENTATION_AUTO=3;
cc.CONCURRENCY_HTTP_REQUEST_COUNT=cc.sys.isMobile?20:0;cc.BATCH_VERTEX_COUNT=2E3;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.VERTEX_ATTRIB_POSITION=0;cc.VERTEX_ATTRIB_COLOR=1;cc.VERTEX_ATTRIB_TEX_COORDS=2;cc.VERTEX_ATTRIB_MAX=7;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_SPRITE_POSITION_TEXTURECOLOR="ShaderSpritePositionTextureColor";cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY="ShaderSpritePositionTextureColorGray";cc.SHADER_POSITION_TEXTURECOLORALPHATEST="ShaderPositionTextureColorAlphaTest";cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST="ShaderSpritePositionTextureColorAlphaTest";
cc.SHADER_POSITION_COLOR="ShaderPositionColor";cc.SHADER_SPRITE_POSITION_COLOR="ShaderSpritePositionColor";cc.SHADER_POSITION_TEXTURE="ShaderPositionTexture";cc.SHADER_POSITION_TEXTURE_UCOLOR="ShaderPositionTextureUColor";cc.SHADER_POSITION_TEXTUREA8COLOR="ShaderPositionTextureA8Color";cc.SHADER_POSITION_UCOLOR="ShaderPositionUColor";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.ATTRIBUTE_NAME_MVMAT="a_mvMatrix";cc.ITEM_SIZE=32;cc.CURRENT_ITEM=3233828865;cc.ZOOM_ACTION_TAG=3233828866;cc.NORMAL_TAG=8801;
cc.SELECTED_TAG=8802;cc.DISABLE_TAG=8803;cc.arrayVerifyType=function(a,b){if(a&&0<a.length)for(var c=0;c<a.length;c++)if(!(a[c]instanceof b))return cc.log("element type is wrong!"),!1;return!0};cc.arrayRemoveObject=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b){a.splice(c,1);break}};cc.arrayRemoveArray=function(a,b){for(var c=0,d=b.length;c<d;c++)cc.arrayRemoveObject(a,b[c])};cc.arrayAppendObjectsToIndex=function(a,b,c){a.splice.apply(a,[c,0].concat(b));return a};
cc.copyArray=function(a){var b,c=a.length,d=Array(c);for(b=0;b<c;b+=1)d[b]=a[b];return d};cc.Color=function(a,b,c,d){this._val=((a||0)<<24>>>0)+((b||0)<<16)+((c||0)<<8)+("number"===typeof d?d:255)};_p=cc.Color.prototype;_p._getR=function(){return(this._val&4278190080)>>>24};_p._setR=function(a){this._val=this._val&16777215|a<<24>>>0};_p._getG=function(){return(this._val&16711680)>>16};_p._setG=function(a){this._val=this._val&4278255615|a<<16};_p._getB=function(){return(this._val&65280)>>8};_p._setB=function(a){this._val=this._val&4294902015|a<<8};_p._getA=function(){return this._val&255};
_p._setA=function(a){this._val=this._val&4294967040|a};cc.defineGetterSetter(_p,"r",_p._getR,_p._setR);cc.defineGetterSetter(_p,"g",_p._getG,_p._setG);cc.defineGetterSetter(_p,"b",_p._getB,_p._setB);cc.defineGetterSetter(_p,"a",_p._getA,_p._setA);cc.color=function(a,b,c,d){return void 0===a?new cc.Color(0,0,0,255):"object"===typeof a?new cc.Color(a.r,a.g,a.b,null==a.a?255:a.a):"string"===typeof a?cc.hexToColor(a):new cc.Color(a,b,c,null==d?255:d)};
cc.colorEqual=function(a,b){return a.r===b.r&&a.g===b.g&&a.b===b.b};cc.Acceleration=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.timestamp=d||0};cc.Vertex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Vertex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Vertex2F.BYTES_PER_ELEMENT=8;_p=cc.Vertex2F.prototype;_p._getX=function(){return this._view[0]};
_p._setX=function(a){this._view[0]=a};_p._getY=function(){return this._view[1]};_p._setY=function(a){this._view[1]=a};cc.defineGetterSetter(_p,"x",_p._getX,_p._setX);cc.defineGetterSetter(_p,"y",_p._getY,_p._setY);cc.Vertex3F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Vertex3F.BYTES_PER_ELEMENT);this._offset=e||0;this._view=new Float32Array(this._arrayBuffer,this._offset,3);this._view[0]=a||0;this._view[1]=b||0;this._view[2]=c||0};cc.Vertex3F.BYTES_PER_ELEMENT=12;_p=cc.Vertex3F.prototype;
_p._getX=function(){return this._view[0]};_p._setX=function(a){this._view[0]=a};_p._getY=function(){return this._view[1]};_p._setY=function(a){this._view[1]=a};_p._getZ=function(){return this._view[2]};_p._setZ=function(a){this._view[2]=a};cc.defineGetterSetter(_p,"x",_p._getX,_p._setX);cc.defineGetterSetter(_p,"y",_p._getY,_p._setY);cc.defineGetterSetter(_p,"z",_p._getZ,_p._setZ);
cc.Tex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Tex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Tex2F.BYTES_PER_ELEMENT=8;_p=cc.Tex2F.prototype;_p._getU=function(){return this._view[0]};_p._setU=function(a){this._view[0]=a};_p._getV=function(){return this._view[1]};_p._setV=function(a){this._view[1]=a};cc.defineGetterSetter(_p,"u",_p._getU,_p._setU);
cc.defineGetterSetter(_p,"v",_p._getV,_p._setV);
cc.Quad2=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad2.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var h=cc.Vertex2F.BYTES_PER_ELEMENT;this._tl=a?new cc.Vertex2F(a.x,a.y,e,f):new cc.Vertex2F(0,0,e,f);f+=h;this._tr=b?new cc.Vertex2F(b.x,b.y,e,f):new cc.Vertex2F(0,0,e,f);f+=h;this._bl=c?new cc.Vertex2F(c.x,c.y,e,f):new cc.Vertex2F(0,0,e,f);f+=h;this._br=d?new cc.Vertex2F(d.x,d.y,e,f):new cc.Vertex2F(0,0,e,f)};cc.Quad2.BYTES_PER_ELEMENT=32;_p=cc.Quad2.prototype;
_p._getTL=function(){return this._tl};_p._setTL=function(a){this._tl._view[0]=a.x;this._tl._view[1]=a.y};_p._getTR=function(){return this._tr};_p._setTR=function(a){this._tr._view[0]=a.x;this._tr._view[1]=a.y};_p._getBL=function(){return this._bl};_p._setBL=function(a){this._bl._view[0]=a.x;this._bl._view[1]=a.y};_p._getBR=function(){return this._br};_p._setBR=function(a){this._br._view[0]=a.x;this._br._view[1]=a.y};cc.defineGetterSetter(_p,"tl",_p._getTL,_p._setTL);
cc.defineGetterSetter(_p,"tr",_p._getTR,_p._setTR);cc.defineGetterSetter(_p,"bl",_p._getBL,_p._setBL);cc.defineGetterSetter(_p,"br",_p._getBR,_p._setBR);
cc.Quad3=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad3.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var h=cc.Vertex3F.BYTES_PER_ELEMENT;this.bl=a?new cc.Vertex3F(a.x,a.y,a.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=h;this.br=b?new cc.Vertex3F(b.x,b.y,b.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=h;this.tl=c?new cc.Vertex3F(c.x,c.y,c.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=h;this.tr=d?new cc.Vertex3F(d.x,d.y,d.z,e,f):new cc.Vertex3F(0,0,0,e,f)};
cc.Quad3.BYTES_PER_ELEMENT=48;cc.V3F_C4B_T2F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V3F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;this._vertices=a?new cc.Vertex3F(a.x,a.y,a.z,d,e):new cc.Vertex3F(0,0,0,d,e);e+=cc.Vertex3F.BYTES_PER_ELEMENT;this._colors=b?new cc._WebGLColor(b.r,b.g,b.b,b.a,d,e):new cc._WebGLColor(0,0,0,0,d,e);e+=cc._WebGLColor.BYTES_PER_ELEMENT;this._texCoords=c?new cc.Tex2F(c.u,c.v,d,e):new cc.Tex2F(0,0,d,e)};
cc.V3F_C4B_T2F.BYTES_PER_ELEMENT=24;_p=cc.V3F_C4B_T2F.prototype;_p._getVertices=function(){return this._vertices};_p._setVertices=function(a){var b=this._vertices;b._view[0]=a.x;b._view[1]=a.y;b._view[2]=a.z};_p._getColor=function(){return this._colors};_p._setColor=function(a){var b=this._colors;b._view[0]=a.r;b._view[1]=a.g;b._view[2]=a.b;b._view[3]=a.a};_p._getTexCoords=function(){return this._texCoords};_p._setTexCoords=function(a){this._texCoords._view[0]=a.u;this._texCoords._view[1]=a.v};
cc.defineGetterSetter(_p,"vertices",_p._getVertices,_p._setVertices);cc.defineGetterSetter(_p,"colors",_p._getColor,_p._setColor);cc.defineGetterSetter(_p,"texCoords",_p._getTexCoords,_p._setTexCoords);
cc.V3F_C4B_T2F_Quad=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var h=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._tl=a?new cc.V3F_C4B_T2F(a.vertices,a.colors,a.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=h;this._bl=b?new cc.V3F_C4B_T2F(b.vertices,b.colors,b.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=h;this._tr=c?new cc.V3F_C4B_T2F(c.vertices,c.colors,c.texCoords,e,f):new cc.V3F_C4B_T2F(null,
null,null,e,f);f+=h;this._br=d?new cc.V3F_C4B_T2F(d.vertices,d.colors,d.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f)};cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT=96;_p=cc.V3F_C4B_T2F_Quad.prototype;_p._getTL=function(){return this._tl};_p._setTL=function(a){var b=this._tl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getBL=function(){return this._bl};_p._setBL=function(a){var b=this._bl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getTR=function(){return this._tr};
_p._setTR=function(a){var b=this._tr;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getBR=function(){return this._br};_p._setBR=function(a){var b=this._br;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getArrayBuffer=function(){return this._arrayBuffer};cc.defineGetterSetter(_p,"tl",_p._getTL,_p._setTL);cc.defineGetterSetter(_p,"tr",_p._getTR,_p._setTR);cc.defineGetterSetter(_p,"bl",_p._getBL,_p._setBL);cc.defineGetterSetter(_p,"br",_p._getBR,_p._setBR);
cc.defineGetterSetter(_p,"arrayBuffer",_p._getArrayBuffer,null);cc.V3F_C4B_T2F_QuadZero=function(){return new cc.V3F_C4B_T2F_Quad};
cc.V3F_C4B_T2F_QuadCopy=function(a){if(!a)return cc.V3F_C4B_T2F_QuadZero();var b=a.tl,c=a.bl,d=a.tr;a=a.br;return{tl:{vertices:{x:b.vertices.x,y:b.vertices.y,z:b.vertices.z},colors:{r:b.colors.r,g:b.colors.g,b:b.colors.b,a:b.colors.a},texCoords:{u:b.texCoords.u,v:b.texCoords.v}},bl:{vertices:{x:c.vertices.x,y:c.vertices.y,z:c.vertices.z},colors:{r:c.colors.r,g:c.colors.g,b:c.colors.b,a:c.colors.a},texCoords:{u:c.texCoords.u,v:c.texCoords.v}},tr:{vertices:{x:d.vertices.x,y:d.vertices.y,z:d.vertices.z},
colors:{r:d.colors.r,g:d.colors.g,b:d.colors.b,a:d.colors.a},texCoords:{u:d.texCoords.u,v:d.texCoords.v}},br:{vertices:{x:a.vertices.x,y:a.vertices.y,z:a.vertices.z},colors:{r:a.colors.r,g:a.colors.g,b:a.colors.b,a:a.colors.a},texCoords:{u:a.texCoords.u,v:a.texCoords.v}}}};cc.V3F_C4B_T2F_QuadsCopy=function(a){if(!a)return[];for(var b=[],c=0;c<a.length;c++)b.push(cc.V3F_C4B_T2F_QuadCopy(a[c]));return b};
cc.V2F_C4B_T2F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V2F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;this._vertices=a?new cc.Vertex2F(a.x,a.y,d,e):new cc.Vertex2F(0,0,d,e);e+=cc.Vertex2F.BYTES_PER_ELEMENT;this._colors=b?new cc._WebGLColor(b.r,b.g,b.b,b.a,d,e):new cc._WebGLColor(0,0,0,0,d,e);e+=cc._WebGLColor.BYTES_PER_ELEMENT;this._texCoords=c?new cc.Tex2F(c.u,c.v,d,e):new cc.Tex2F(0,0,d,e)};cc.V2F_C4B_T2F.BYTES_PER_ELEMENT=20;_p=cc.V2F_C4B_T2F.prototype;
_p._getVertices=function(){return this._vertices};_p._setVertices=function(a){this._vertices._view[0]=a.x;this._vertices._view[1]=a.y};_p._getColor=function(){return this._colors};_p._setColor=function(a){var b=this._colors;b._view[0]=a.r;b._view[1]=a.g;b._view[2]=a.b;b._view[3]=a.a};_p._getTexCoords=function(){return this._texCoords};_p._setTexCoords=function(a){this._texCoords._view[0]=a.u;this._texCoords._view[1]=a.v};cc.defineGetterSetter(_p,"vertices",_p._getVertices,_p._setVertices);
cc.defineGetterSetter(_p,"colors",_p._getColor,_p._setColor);cc.defineGetterSetter(_p,"texCoords",_p._getTexCoords,_p._setTexCoords);
cc.V2F_C4B_T2F_Triangle=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;var f=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;this._a=a?new cc.V2F_C4B_T2F(a.vertices,a.colors,a.texCoords,d,e):new cc.V2F_C4B_T2F(null,null,null,d,e);e+=f;this._b=b?new cc.V2F_C4B_T2F(b.vertices,b.colors,b.texCoords,d,e):new cc.V2F_C4B_T2F(null,null,null,d,e);e+=f;this._c=c?new cc.V2F_C4B_T2F(c.vertices,c.colors,c.texCoords,d,e):
new cc.V2F_C4B_T2F(null,null,null,d,e)};cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT=60;_p=cc.V2F_C4B_T2F_Triangle.prototype;_p._getA=function(){return this._a};_p._setA=function(a){var b=this._a;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getB=function(){return this._b};_p._setB=function(a){var b=this._b;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};_p._getC=function(){return this._c};
_p._setC=function(a){var b=this._c;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};cc.defineGetterSetter(_p,"a",_p._getA,_p._setA);cc.defineGetterSetter(_p,"b",_p._getB,_p._setB);cc.defineGetterSetter(_p,"c",_p._getC,_p._setC);cc.vertex2=function(a,b){return new cc.Vertex2F(a,b)};cc.vertex3=function(a,b,c){return new cc.Vertex3F(a,b,c)};cc.tex2=function(a,b){return new cc.Tex2F(a,b)};cc.BlendFunc=function(a,b){this.src=a;this.dst=b};
cc.blendFuncDisable=function(){return new cc.BlendFunc(cc.ONE,cc.ZERO)};cc.hexToColor=function(a){a=a.replace(/^#?/,"0x");a=parseInt(a);return new cc.Color(a>>16,(a>>8)%256,a%256)};cc.colorToHex=function(a){var b=a.r.toString(16),c=a.g.toString(16),d=a.b.toString(16);return"#"+(16>a.r?"0"+b:b)+(16>a.g?"0"+c:c)+(16>a.b?"0"+d:d)};cc.TEXT_ALIGNMENT_LEFT=0;cc.TEXT_ALIGNMENT_CENTER=1;cc.TEXT_ALIGNMENT_RIGHT=2;cc.VERTICAL_TEXT_ALIGNMENT_TOP=0;cc.VERTICAL_TEXT_ALIGNMENT_CENTER=1;
cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM=2;
cc._Dictionary=cc.Class.extend({_keyMapTb:null,_valueMapTb:null,__currId:0,ctor:function(){this._keyMapTb={};this._valueMapTb={};this.__currId=2<<(0|10*Math.random())},__getKey:function(){this.__currId++;return"key_"+this.__currId},setObject:function(a,b){if(null!=b){var c=this.__getKey();this._keyMapTb[c]=b;this._valueMapTb[c]=a}},objectForKey:function(a){if(null==a)return null;var b=this._keyMapTb,c;for(c in b)if(b[c]===a)return this._valueMapTb[c];return null},valueForKey:function(a){return this.objectForKey(a)},
removeObjectForKey:function(a){if(null!=a){var b=this._keyMapTb,c;for(c in b)if(b[c]===a){delete this._valueMapTb[c];delete b[c];break}}},removeObjectsForKeys:function(a){if(null!=a)for(var b=0;b<a.length;b++)this.removeObjectForKey(a[b])},allKeys:function(){var a=[],b=this._keyMapTb,c;for(c in b)a.push(b[c]);return a},removeAllObjects:function(){this._keyMapTb={};this._valueMapTb={}},count:function(){return this.allKeys().length}});
cc.FontDefinition=function(a){this.fontName="Arial";this.fontSize=12;this.textAlign=cc.TEXT_ALIGNMENT_CENTER;this.verticalAlign=cc.VERTICAL_TEXT_ALIGNMENT_TOP;this.fillStyle=cc.color(255,255,255,255);this.boundingHeight=this.boundingWidth=0;this.strokeEnabled=!1;this.strokeStyle=cc.color(255,255,255,255);this.lineWidth=1;this.fontWeight=this.fontStyle=this.lineHeight="normal";this.shadowEnabled=!1;this.shadowBlur=this.shadowOffsetY=this.shadowOffsetX=0;this.shadowOpacity=1;if(a&&a instanceof Object)for(var b in a)this[b]=
a[b]};cc.FontDefinition.prototype._getCanvasFontStr=function(){return this.fontStyle+" "+this.fontWeight+" "+this.fontSize+"px/"+(this.lineHeight.charAt?this.lineHeight:this.lineHeight+"px")+" '"+this.fontName+"'"};
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc._WebGLColor=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc._WebGLColor.BYTES_PER_ELEMENT);this._offset=f||0;this._view=new Uint8Array(this._arrayBuffer,this._offset,4);this._view[0]=a||0;this._view[1]=b||0;this._view[2]=c||0;this._view[3]=null==d?255:d;void 0===d&&(this.a_undefined=!0)},cc._WebGLColor.BYTES_PER_ELEMENT=4,_p=cc._WebGLColor.prototype,_p._getR=function(){return this._view[0]},
_p._setR=function(a){this._view[0]=0>a?0:a},_p._getG=function(){return this._view[1]},_p._setG=function(a){this._view[1]=0>a?0:a},_p._getB=function(){return this._view[2]},_p._setB=function(a){this._view[2]=0>a?0:a},_p._getA=function(){return this._view[3]},_p._setA=function(a){this._view[3]=0>a?0:a},cc.defineGetterSetter(_p,"r",_p._getR,_p._setR),cc.defineGetterSetter(_p,"g",_p._getG,_p._setG),cc.defineGetterSetter(_p,"b",_p._getB,_p._setB),cc.defineGetterSetter(_p,"a",_p._getA,_p._setA))});_p=cc.color;
_p._getWhite=function(){return cc.color(255,255,255)};_p._getYellow=function(){return cc.color(255,255,0)};_p._getBlue=function(){return cc.color(0,0,255)};_p._getGreen=function(){return cc.color(0,255,0)};_p._getRed=function(){return cc.color(255,0,0)};_p._getMagenta=function(){return cc.color(255,0,255)};_p._getBlack=function(){return cc.color(0,0,0)};_p._getOrange=function(){return cc.color(255,127,0)};_p._getGray=function(){return cc.color(166,166,166)};cc.defineGetterSetter(_p,"WHITE",_p._getWhite);
cc.defineGetterSetter(_p,"YELLOW",_p._getYellow);cc.defineGetterSetter(_p,"BLUE",_p._getBlue);cc.defineGetterSetter(_p,"GREEN",_p._getGreen);cc.defineGetterSetter(_p,"RED",_p._getRed);cc.defineGetterSetter(_p,"MAGENTA",_p._getMagenta);cc.defineGetterSetter(_p,"BLACK",_p._getBlack);cc.defineGetterSetter(_p,"ORANGE",_p._getOrange);cc.defineGetterSetter(_p,"GRAY",_p._getGray);cc.BlendFunc._disable=function(){return new cc.BlendFunc(cc.ONE,cc.ZERO)};
cc.BlendFunc._alphaPremultiplied=function(){return new cc.BlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA)};cc.BlendFunc._alphaNonPremultiplied=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA)};cc.BlendFunc._additive=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE)};cc.defineGetterSetter(cc.BlendFunc,"DISABLE",cc.BlendFunc._disable);cc.defineGetterSetter(cc.BlendFunc,"ALPHA_PREMULTIPLIED",cc.BlendFunc._alphaPremultiplied);
cc.defineGetterSetter(cc.BlendFunc,"ALPHA_NON_PREMULTIPLIED",cc.BlendFunc._alphaNonPremultiplied);cc.defineGetterSetter(cc.BlendFunc,"ADDITIVE",cc.BlendFunc._additive);cc.Touches=[];cc.TouchesIntergerDict={};cc.DENSITYDPI_DEVICE="device-dpi";cc.DENSITYDPI_HIGH="high-dpi";cc.DENSITYDPI_MEDIUM="medium-dpi";cc.DENSITYDPI_LOW="low-dpi";var __BrowserGetter={init:function(){this.html=document.documentElement},availWidth:function(a){return a&&a!==this.html?a.clientWidth:window.innerWidth},availHeight:function(a){return a&&a!==this.html?a.clientHeight:window.innerHeight},meta:{width:"device-width"},adaptationType:cc.sys.browserType};
-1<window.navigator.userAgent.indexOf("OS 8_1_")&&(__BrowserGetter.adaptationType=cc.sys.BROWSER_TYPE_MIUI);cc.sys.os===cc.sys.OS_IOS&&(__BrowserGetter.adaptationType=cc.sys.BROWSER_TYPE_SAFARI);
switch(__BrowserGetter.adaptationType){case cc.sys.BROWSER_TYPE_SAFARI:__BrowserGetter.meta["minimal-ui"]="true";break;case cc.sys.BROWSER_TYPE_CHROME:__BrowserGetter.__defineGetter__("target-densitydpi",function(){return cc.view._targetDensityDPI});break;case cc.sys.BROWSER_TYPE_MIUI:__BrowserGetter.init=function(a){if(!a.__resizeWithBrowserSize){var b=function(){a.setDesignResolutionSize(a._designResolutionSize.width,a._designResolutionSize.height,a._resolutionPolicy);window.removeEventListener("resize",
b,!1)};window.addEventListener("resize",b,!1)}}}var _scissorRect=null;
cc.EGLView=cc.Class.extend({_delegate:null,_frameSize:null,_designResolutionSize:null,_originalDesignResolutionSize:null,_viewPortRect:null,_visibleRect:null,_retinaEnabled:!1,_autoFullScreen:!1,_devicePixelRatio:1,_viewName:"",_resizeCallback:null,_orientationChanging:!0,_resizing:!1,_scaleX:1,_originalScaleX:1,_scaleY:1,_originalScaleY:1,_isRotated:!1,_orientation:3,_resolutionPolicy:null,_rpExactFit:null,_rpShowAll:null,_rpNoBorder:null,_rpFixedHeight:null,_rpFixedWidth:null,_initialized:!1,_contentTranslateLeftTop:null,
_frame:null,_frameZoomFactor:1,__resizeWithBrowserSize:!1,_isAdjustViewPort:!0,_targetDensityDPI:null,ctor:function(){var a=document,b=cc.ContainerStrategy,c=cc.ContentStrategy;__BrowserGetter.init(this);this._frame=cc.container.parentNode===a.body?a.documentElement:cc.container.parentNode;this._frameSize=cc.size(0,0);this._initFrameSize();var a=cc._canvas.width,d=cc._canvas.height;this._designResolutionSize=cc.size(a,d);this._originalDesignResolutionSize=cc.size(a,d);this._viewPortRect=cc.rect(0,
0,a,d);this._visibleRect=cc.rect(0,0,a,d);this._contentTranslateLeftTop={left:0,top:0};this._viewName="Cocos2dHTML5";a=cc.sys;cc.visibleRect&&cc.visibleRect.init(this._visibleRect);this._rpExactFit=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME,c.EXACT_FIT);this._rpShowAll=new cc.ResolutionPolicy(b.PROPORTION_TO_FRAME,c.SHOW_ALL);this._rpNoBorder=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME,c.NO_BORDER);this._rpFixedHeight=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME,c.FIXED_HEIGHT);this._rpFixedWidth=new cc.ResolutionPolicy(b.EQUAL_TO_FRAME,
c.FIXED_WIDTH);this._targetDensityDPI=cc.DENSITYDPI_HIGH;a.isMobile?window.addEventListener("orientationchange",this._orientationChange):this._orientationChanging=!1},_resizeEvent:function(){var a;a=this.setDesignResolutionSize?this:cc.view;if(!a._orientationChanging){var b=a._frameSize.width,c=a._frameSize.height,d=a._isRotated;if(cc.sys.isMobile){var e=cc.game.container.style,f=e.margin;e.margin="0";e.display="none";a._initFrameSize();e.margin=f;e.display="block"}else a._initFrameSize();if(a._isRotated!==
d||a._frameSize.width!==b||a._frameSize.height!==c)b=a._originalDesignResolutionSize.width,c=a._originalDesignResolutionSize.height,a._resizing=!0,0<b&&a.setDesignResolutionSize(b,c,a._resolutionPolicy),a._resizing=!1,cc.eventManager.dispatchCustomEvent("canvas-resize"),a._resizeCallback&&a._resizeCallback.call()}},_orientationChange:function(){cc.view._orientationChanging=!0;cc.sys.isMobile&&(cc.game.container.style.display="none");setTimeout(function(){cc.view._orientationChanging=!1;cc.view._resizeEvent()},
300)},setTargetDensityDPI:function(a){this._targetDensityDPI=a;this._adjustViewportMeta()},getTargetDensityDPI:function(){return this._targetDensityDPI},resizeWithBrowserSize:function(a){a?this.__resizeWithBrowserSize||(this.__resizeWithBrowserSize=!0,window.addEventListener("resize",this._resizeEvent)):this.__resizeWithBrowserSize&&(this.__resizeWithBrowserSize=!1,window.removeEventListener("resize",this._resizeEvent))},setResizeCallback:function(a){if("function"===typeof a||null==a)this._resizeCallback=
a},setOrientation:function(a){(a&=cc.ORIENTATION_AUTO)&&this._orientation!==a&&(this._orientation=a,this._resolutionPolicy&&this.setDesignResolutionSize(this._originalDesignResolutionSize.width,this._originalDesignResolutionSize.height,this._resolutionPolicy))},setDocumentPixelWidth:function(a){this._setViewportMeta({width:a},!0);document.documentElement.style.width=a+"px";document.body.style.width="100%";this.setDesignResolutionSize(this._designResolutionSize.width,this._designResolutionSize.height,
this._resolutionPolicy)},_initFrameSize:function(){var a=this._frameSize,b=__BrowserGetter.availWidth(this._frame),c=__BrowserGetter.availHeight(this._frame),d=b>=c;!cc.sys.isMobile||d&&this._orientation&cc.ORIENTATION_LANDSCAPE||!d&&this._orientation&cc.ORIENTATION_PORTRAIT?(a.width=b,a.height=c,cc.container.style["-webkit-transform"]="rotate(0deg)",cc.container.style.transform="rotate(0deg)",this._isRotated=!1):(a.width=c,a.height=b,cc.container.style["-webkit-transform"]="rotate(90deg)",cc.container.style.transform=
"rotate(90deg)",cc.container.style["-webkit-transform-origin"]="0px 0px 0px",cc.container.style.transformOrigin="0px 0px 0px",this._isRotated=!0)},_adjustSizeKeepCanvasSize:function(){var a=this._originalDesignResolutionSize.width,b=this._originalDesignResolutionSize.height;0<a&&this.setDesignResolutionSize(a,b,this._resolutionPolicy)},_setViewportMeta:function(a,b){var c=document.getElementById("cocosMetaElement");c&&b&&document.head.removeChild(c);var d=document.getElementsByName("viewport"),d=
d?d[0]:null,e,f,h;e=d?d.content:"";c=c||document.createElement("meta");c.id="cocosMetaElement";c.name="viewport";c.content="";for(f in a)-1==e.indexOf(f)?e+=","+f+"\x3d"+a[f]:b&&(h=RegExp(f+"s*\x3ds*[^,]+"),e.replace(h,f+"\x3d"+a[f]));/^,/.test(e)&&(e=e.substr(1));c.content=e;d&&(d.content=e);document.head.appendChild(c)},_adjustViewportMeta:function(){this._isAdjustViewPort&&(this._setViewportMeta(__BrowserGetter.meta,!1),this._isAdjustViewPort=!1)},_setScaleXYForRenderTexture:function(){var a=cc.contentScaleFactor();
this._scaleY=this._scaleX=a},_resetScale:function(){this._scaleX=this._originalScaleX;this._scaleY=this._originalScaleY},_adjustSizeToBrowser:function(){},initialize:function(){this._initialized=!0},adjustViewPort:function(a){this._isAdjustViewPort=a},enableRetina:function(a){this._retinaEnabled=!!a},isRetinaEnabled:function(){return this._retinaEnabled},enableAutoFullScreen:function(a){a&&a!==this._autoFullScreen&&cc.sys.isMobile&&this._frame===document.documentElement?(this._autoFullScreen=!0,cc.screen.autoFullScreen(this._frame)):
this._autoFullScreen=!1},isAutoFullScreenEnabled:function(){return this._autoFullScreen},isOpenGLReady:function(){return cc.game.canvas&&cc._renderContext},setFrameZoomFactor:function(a){this._frameZoomFactor=a;this.centerWindow();cc.director.setProjection(cc.director.getProjection())},swapBuffers:function(){},setIMEKeyboardState:function(a){},setContentTranslateLeftTop:function(a,b){this._contentTranslateLeftTop={left:a,top:b}},getContentTranslateLeftTop:function(){return this._contentTranslateLeftTop},
getCanvasSize:function(){return cc.size(cc._canvas.width,cc._canvas.height)},getFrameSize:function(){return cc.size(this._frameSize.width,this._frameSize.height)},setFrameSize:function(a,b){this._frameSize.width=a;this._frameSize.height=b;this._frame.style.width=a+"px";this._frame.style.height=b+"px";this._resizeEvent();cc.director.setProjection(cc.director.getProjection())},getVisibleSize:function(){return cc.size(this._visibleRect.width,this._visibleRect.height)},getVisibleSizeInPixel:function(){return cc.size(this._visibleRect.width*
this._scaleX,this._visibleRect.height*this._scaleY)},getVisibleOrigin:function(){return cc.p(this._visibleRect.x,this._visibleRect.y)},getVisibleOriginInPixel:function(){return cc.p(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},canSetContentScaleFactor:function(){return!0},getResolutionPolicy:function(){return this._resolutionPolicy},setResolutionPolicy:function(a){if(a instanceof cc.ResolutionPolicy)this._resolutionPolicy=a;else{var b=cc.ResolutionPolicy;a===b.EXACT_FIT&&(this._resolutionPolicy=
this._rpExactFit);a===b.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll);a===b.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder);a===b.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight);a===b.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},setDesignResolutionSize:function(a,b,c){if(0<a||0<b)if(this.setResolutionPolicy(c),(c=this._resolutionPolicy)&&c.preApply(this),cc.sys.isMobile&&this._adjustViewportMeta(),this._resizing||this._initFrameSize(),c){this._originalDesignResolutionSize.width=
this._designResolutionSize.width=a;this._originalDesignResolutionSize.height=this._designResolutionSize.height=b;var d=c.apply(this,this._designResolutionSize);d.scale&&2===d.scale.length&&(this._scaleX=d.scale[0],this._scaleY=d.scale[1]);d.viewport&&(a=this._viewPortRect,b=this._visibleRect,d=d.viewport,a.x=d.x,a.y=d.y,a.width=d.width,a.height=d.height,b.x=-a.x/this._scaleX,b.y=-a.y/this._scaleY,b.width=cc._canvas.width/this._scaleX,b.height=cc._canvas.height/this._scaleY,cc._renderContext.setOffset&&
cc._renderContext.setOffset(a.x,-a.y));a=cc.director;a._winSizeInPoints.width=this._designResolutionSize.width;a._winSizeInPoints.height=this._designResolutionSize.height;c.postApply(this);cc.winSize.width=a._winSizeInPoints.width;cc.winSize.height=a._winSizeInPoints.height;cc._renderType===cc.game.RENDER_TYPE_WEBGL?a.setGLDefaultValues():cc._renderType===cc.game.RENDER_TYPE_CANVAS&&(cc.renderer._allNeedDraw=!0);this._originalScaleX=this._scaleX;this._originalScaleY=this._scaleY;cc.visibleRect&&cc.visibleRect.init(this._visibleRect)}else cc.log(cc._LogInfos.EGLView_setDesignResolutionSize_2);
else cc.log(cc._LogInfos.EGLView_setDesignResolutionSize)},getDesignResolutionSize:function(){return cc.size(this._designResolutionSize.width,this._designResolutionSize.height)},setRealPixelResolution:function(a,b,c){this._setViewportMeta({width:a},!0);document.documentElement.style.width=a+"px";document.body.style.width=a+"px";document.body.style.left="0px";document.body.style.top="0px";this.setDesignResolutionSize(a,b,c)},setViewPortInPoints:function(a,b,c,d){var e=this._frameZoomFactor,f=this._scaleX,
h=this._scaleY;cc._renderContext.viewport(a*f*e+this._viewPortRect.x*e,b*h*e+this._viewPortRect.y*e,c*f*e,d*h*e)},setScissorInPoints:function(a,b,c,d){var e=this._frameZoomFactor,f=this._scaleX,h=this._scaleY;a=Math.ceil(a*f*e+this._viewPortRect.x*e);b=Math.ceil(b*h*e+this._viewPortRect.y*e);c=Math.ceil(c*f*e);d=Math.ceil(d*h*e);_scissorRect||(e=gl.getParameter(gl.SCISSOR_BOX),_scissorRect=cc.rect(e[0],e[1],e[2],e[3]));if(_scissorRect.x!=a||_scissorRect.y!=b||_scissorRect.width!=c||_scissorRect.height!=
d)_scissorRect.x=a,_scissorRect.y=b,_scissorRect.width=c,_scissorRect.height=d,cc._renderContext.scissor(a,b,c,d)},isScissorEnabled:function(){return cc._renderContext.isEnabled(gl.SCISSOR_TEST)},getScissorRect:function(){if(!_scissorRect){var a=gl.getParameter(gl.SCISSOR_BOX);_scissorRect=cc.rect(a[0],a[1],a[2],a[3])}var a=1/this._scaleX,b=1/this._scaleY;return cc.rect((_scissorRect.x-this._viewPortRect.x)*a,(_scissorRect.y-this._viewPortRect.y)*b,_scissorRect.width*a,_scissorRect.height*b)},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,b,c){a=this._devicePixelRatio*(a-c.left);b=this._devicePixelRatio*(c.top+c.height-b);return this._isRotated?{x:this._viewPortRect.width-b,y:a}:{x:a,y:b}},_convertMouseToLocationInView:function(a,
b){var c=this._viewPortRect;a.x=(this._devicePixelRatio*(a.x-b.left)-c.x)/this._scaleX;a.y=(this._devicePixelRatio*(b.top+b.height-a.y)-c.y)/this._scaleY},_convertPointWithScale:function(a){var b=this._viewPortRect;a.x=(a.x-b.x)/this._scaleX;a.y=(a.y-b.y)/this._scaleY},_convertTouchesWithScale:function(a){for(var b=this._viewPortRect,c=this._scaleX,d=this._scaleY,e,f,h=0;h<a.length;h++)e=a[h],f=e._point,e=e._prevPoint,f.x=(f.x-b.x)/c,f.y=(f.y-b.y)/d,e.x=(e.x-b.x)/c,e.y=(e.y-b.y)/d}});
cc.EGLView._getInstance=function(){this._instance||(this._instance=this._instance||new cc.EGLView,this._instance.initialize());return this._instance};
cc.ContainerStrategy=cc.Class.extend({preApply:function(a){},apply:function(a,b){},postApply:function(a){},_setupContainer:function(a,b,c){var d=cc.game.canvas,e=cc.game.container;cc.sys.os===cc.sys.OS_ANDROID&&(document.body.style.width=(a._isRotated?c:b)+"px",document.body.style.height=(a._isRotated?b:c)+"px");e.style.width=d.style.width=b+"px";e.style.height=d.style.height=c+"px";e=a._devicePixelRatio=1;a.isRetinaEnabled()&&(e=a._devicePixelRatio=Math.min(2,window.devicePixelRatio||1));d.width=
b*e;d.height=c*e;cc._renderContext.resetCache&&cc._renderContext.resetCache()},_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,b,c,d,e,f){2>Math.abs(a-c)&&(c=a);2>Math.abs(b-d)&&(d=b);a=cc.rect(Math.round((a-c)/2),Math.round((b-d)/2),c,d);this._result.scale=[e,f];this._result.viewport=a;return this._result},preApply:function(a){},apply:function(a,b){return{scale:[1,1]}},postApply:function(a){}});
(function(){var a=cc.ContainerStrategy.extend({apply:function(a){var b=a._frameSize.height,c=cc.container.style;this._setupContainer(a,a._frameSize.width,a._frameSize.height);c.margin=a._isRotated?"0 0 0 "+b+"px":"0px"}}),b=cc.ContainerStrategy.extend({apply:function(a,b){var c=a._frameSize.width,d=a._frameSize.height,e=cc.container.style,p=b.width,r=b.height,s=c/p,t=d/r,w,v;s<t?(w=c,v=r*s):(w=p*t,v=d);p=Math.round((c-w)/2);v=Math.round((d-v)/2);this._setupContainer(a,c-2*p,d-2*v);e.margin=a._isRotated?
"0 0 0 "+d+"px":"0px";e.paddingLeft=p+"px";e.paddingRight=p+"px";e.paddingTop=v+"px";e.paddingBottom=v+"px"}});a.extend({preApply:function(a){this._super(a);a._frame=document.documentElement},apply:function(a){this._super(a);this._fixContainer()}});b.extend({preApply:function(a){this._super(a);a._frame=document.documentElement},apply:function(a,b){this._super(a,b);this._fixContainer()}});var c=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 b;cc.ContainerStrategy.ORIGINAL_CONTAINER=new c;var a=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height;return this._buildResult(c,d,c,d,c/b.width,d/b.height)}}),b=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height,e=b.width,p=b.height,r=c/e,s=d/p,t=0,w,v;r<s?(t=r,w=c,v=p*t):(t=s,w=e*t,v=d);return this._buildResult(c,d,w,v,t,t)}}),c=
cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height,e=b.width,p=b.height,r=c/e,s=d/p,t,w,v;r<s?(t=s,w=e*t,v=d):(t=r,w=c,v=p*t);return this._buildResult(c,d,w,v,t,t)}}),d=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height,e=d/b.height;return this._buildResult(c,d,c,d,e,e)},postApply:function(a){cc.director._winSizeInPoints=a.getVisibleSize()}}),e=cc.ContentStrategy.extend({apply:function(a,b){var c=cc._canvas.width,d=cc._canvas.height,
e=c/b.width;return this._buildResult(c,d,c,d,e,e)},postApply:function(a){cc.director._winSizeInPoints=a.getVisibleSize()}});cc.ContentStrategy.EXACT_FIT=new a;cc.ContentStrategy.SHOW_ALL=new b;cc.ContentStrategy.NO_BORDER=new c;cc.ContentStrategy.FIXED_HEIGHT=new d;cc.ContentStrategy.FIXED_WIDTH=new e})();
cc.ResolutionPolicy=cc.Class.extend({_containerStrategy:null,_contentStrategy:null,ctor:function(a,b){this.setContainerStrategy(a);this.setContentStrategy(b)},preApply:function(a){this._containerStrategy.preApply(a);this._contentStrategy.preApply(a)},apply:function(a,b){this._containerStrategy.apply(a,b);return this._contentStrategy.apply(a,b)},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.ResolutionPolicy.EXACT_FIT=0;cc.ResolutionPolicy.NO_BORDER=1;cc.ResolutionPolicy.SHOW_ALL=2;cc.ResolutionPolicy.FIXED_HEIGHT=3;cc.ResolutionPolicy.FIXED_WIDTH=4;cc.ResolutionPolicy.UNKNOWN=5;cc.screen={_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,b,c=this._fnMap,d;a=0;for(l=c.length;a<l;a++)if((b=c[a])&&b[1]in document){a=0;for(d=b.length;a<d;a++)this._fn[c[0][a]]=b[a];break}this._supportsFullScreen="undefined"!==typeof this._fn.requestFullscreen;this._touchEvent="ontouchstart"in window?"touchstart":"mousedown"},fullScreen:function(){return this._supportsFullScreen?void 0===
document[this._fn.fullscreenElement]||null===document[this._fn.fullscreenElement]?!1:!0:!1},requestFullScreen:function(a,b){if(this._supportsFullScreen){a=a||document.documentElement;if(b){var c=this._fn.fullscreenchange;this._preOnFullScreenChange&&document.removeEventListener(c,this._preOnFullScreenChange);this._preOnFullScreenChange=b;document.addEventListener(c,b,!1)}return a[this._fn.requestFullscreen]()}},exitFullScreen:function(){return this._supportsFullScreen?document[this._fn.exitFullscreen]():
!0},autoFullScreen:function(a,b){function c(){d.removeEventListener(e._touchEvent,c);e.requestFullScreen(a,b)}a=a||document.body;var d=cc.game.canvas||a,e=this;this.requestFullScreen(a,b);d.addEventListener(this._touchEvent,c)}};cc.screen.init();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){var b=this.width=a.width,c=this.height=a.height,d=a.x;a=a.y;var e=a+c,f=d+b;this.topLeft.x=d;this.topLeft.y=e;this.topRight.x=f;this.topRight.y=e;this.top.x=d+b/2;this.top.y=e;this.bottomLeft.x=d;this.bottomLeft.y=a;this.bottomRight.x=f;this.bottomRight.y=a;this.bottom.x=d+b/2;this.bottom.y=
a;this.center.x=d+b/2;this.center.y=a+c/2;this.left.x=d;this.left.y=a+c/2;this.right.x=f;this.right.y=a+c/2}};cc.UIInterfaceOrientationLandscapeLeft=-90;cc.UIInterfaceOrientationLandscapeRight=90;cc.UIInterfaceOrientationPortraitUpsideDown=180;cc.UIInterfaceOrientationPortrait=0;
cc.inputManager={TOUCH_TIMEOUT:5E3,_mousePressed:!1,_isRegisterEvent:!1,_preTouchPoint:cc.p(0,0),_prevMousePoint:cc.p(0,0),_preTouchPool:[],_preTouchPoolPointer:0,_touches:[],_touchesIntegerDict:{},_indexBitsUsed:0,_maxTouches:5,_accelEnabled:!1,_accelInterval:1/30,_accelMinus:1,_accelCurTime:0,_acceleration:null,_accelDeviceEvent:null,_getUnUsedIndex:function(){for(var a=this._indexBitsUsed,b=cc.sys.now(),c=0;c<this._maxTouches;c++){if(a&1){var d=this._touches[c];if(b-d._lastModified>this.TOUCH_TIMEOUT)return this._removeUsedIndexBit(c),
delete this._touchesIntegerDict[d.getID()],c}else return this._indexBitsUsed|=1<<c,c;a>>=1}return-1},_removeUsedIndexBit:function(a){0>a||a>=this._maxTouches||(a=~(1<<a),this._indexBitsUsed&=a)},_glView:null,handleTouchesBegin:function(a){for(var b,c,d,e=[],f=this._touchesIntegerDict,h=cc.sys.now(),k=0,m=a.length;k<m;k++)if(b=a[k],d=b.getID(),c=f[d],null==c){var n=this._getUnUsedIndex();-1===n?cc.log(cc._LogInfos.inputManager_handleTouchesBegin,n):(c=this._touches[n]=new cc.Touch(b._point.x,b._point.y,
b.getID()),c._lastModified=h,c._setPrevPoint(b._prevPoint),f[d]=n,e.push(c))}0<e.length&&(this._glView._convertTouchesWithScale(e),a=new cc.EventTouch(e),a._eventCode=cc.EventTouch.EventCode.BEGAN,cc.eventManager.dispatchEvent(a))},handleTouchesMove:function(a){for(var b,c,d=[],e=this._touches,f=cc.sys.now(),h=0,k=a.length;h<k;h++)b=a[h],c=b.getID(),c=this._touchesIntegerDict[c],null!=c&&e[c]&&(e[c]._setPoint(b._point),e[c]._setPrevPoint(b._prevPoint),e[c]._lastModified=f,d.push(e[c]));0<d.length&&
(this._glView._convertTouchesWithScale(d),a=new cc.EventTouch(d),a._eventCode=cc.EventTouch.EventCode.MOVED,cc.eventManager.dispatchEvent(a))},handleTouchesEnd:function(a){a=this.getSetOfTouchesEndOrCancel(a);0<a.length&&(this._glView._convertTouchesWithScale(a),a=new cc.EventTouch(a),a._eventCode=cc.EventTouch.EventCode.ENDED,cc.eventManager.dispatchEvent(a))},handleTouchesCancel:function(a){a=this.getSetOfTouchesEndOrCancel(a);0<a.length&&(this._glView._convertTouchesWithScale(a),a=new cc.EventTouch(a),
a._eventCode=cc.EventTouch.EventCode.CANCELLED,cc.eventManager.dispatchEvent(a))},getSetOfTouchesEndOrCancel:function(a){for(var b,c,d,e=[],f=this._touches,h=this._touchesIntegerDict,k=0,m=a.length;k<m;k++)b=a[k],d=b.getID(),c=h[d],null!=c&&f[c]&&(f[c]._setPoint(b._point),f[c]._setPrevPoint(b._prevPoint),e.push(f[c]),this._removeUsedIndexBit(c),delete h[d]);return e},getHTMLElementPosition:function(a){var b=document.documentElement,c=window,d=null,d=cc.isFunction(a.getBoundingClientRect)?a.getBoundingClientRect():
{left:0,top:0,width:parseInt(a.style.width),height:parseInt(a.style.height)};return{left:d.left+c.pageXOffset-b.clientLeft,top:d.top+c.pageYOffset-b.clientTop,width:d.width,height:d.height}},getPreTouch:function(a){for(var b=null,c=this._preTouchPool,d=a.getID(),e=c.length-1;0<=e;e--)if(c[e].getID()===d){b=c[e];break}b||(b=a);return b},setPreTouch:function(a){for(var b=!1,c=this._preTouchPool,d=a.getID(),e=c.length-1;0<=e;e--)if(c[e].getID()===d){c[e]=a;b=!0;break}b||(50>=c.length?c.push(a):(c[this._preTouchPoolPointer]=
a,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(a,b,c){var d=this._preTouchPoint;a=this._glView.convertToLocationInView(a,b,c);b=new cc.Touch(a.x,a.y);b._setPrevPoint(d.x,d.y);d.x=a.x;d.y=a.y;return b},getMouseEvent:function(a,b,c){var d=this._prevMousePoint;this._glView._convertMouseToLocationInView(a,b);b=new cc.EventMouse(c);b.setLocation(a.x,a.y);b._setPrevCursor(d.x,d.y);d.x=a.x;d.y=a.y;return b},getPointByEvent:function(a,b){if(null!=a.pageX)return{x:a.pageX,
y:a.pageY};b.left-=document.body.scrollLeft;b.top-=document.body.scrollTop;return{x:a.clientX,y:a.clientY}},getTouchesByEvent:function(a,b){for(var c=[],d=this._glView,e,f,h=this._preTouchPoint,k=a.changedTouches.length,m=0;m<k;m++)if(e=a.changedTouches[m]){var n;n=cc.sys.BROWSER_TYPE_FIREFOX===cc.sys.browserType?d.convertToLocationInView(e.pageX,e.pageY,b):d.convertToLocationInView(e.clientX,e.clientY,b);null!=e.identifier?(e=new cc.Touch(n.x,n.y,e.identifier),f=this.getPreTouch(e).getLocation(),
e._setPrevPoint(f.x,f.y),this.setPreTouch(e)):(e=new cc.Touch(n.x,n.y),e._setPrevPoint(h.x,h.y));h.x=n.x;h.y=n.y;c.push(e)}return c},registerSystemEvent:function(a){if(!this._isRegisterEvent){this._glView=cc.view;var b=this,c="mouse"in cc.sys.capabilities,d="touches"in cc.sys.capabilities,e=!1;cc.sys.isMobile&&(e=!0);c&&(window.addEventListener("mousedown",function(){b._mousePressed=!0},!1),window.addEventListener("mouseup",function(c){if(!e){var d=b._mousePressed;b._mousePressed=!1;if(d){var d=b.getHTMLElementPosition(a),
f=b.getPointByEvent(c,d);cc.rectContainsPoint(new cc.Rect(d.left,d.top,d.width,d.height),f)||(b.handleTouchesEnd([b.getTouchByXY(f.x,f.y,d)]),d=b.getMouseEvent(f,d,cc.EventMouse.UP),d.setButton(c.button),cc.eventManager.dispatchEvent(d))}}},!1),a.addEventListener("mousedown",function(c){if(!e){b._mousePressed=!0;var d=b.getHTMLElementPosition(a),f=b.getPointByEvent(c,d);b.handleTouchesBegin([b.getTouchByXY(f.x,f.y,d)]);d=b.getMouseEvent(f,d,cc.EventMouse.DOWN);d.setButton(c.button);cc.eventManager.dispatchEvent(d);
c.stopPropagation();c.preventDefault();a.focus()}},!1),a.addEventListener("mouseup",function(c){if(!e){b._mousePressed=!1;var d=b.getHTMLElementPosition(a),f=b.getPointByEvent(c,d);b.handleTouchesEnd([b.getTouchByXY(f.x,f.y,d)]);d=b.getMouseEvent(f,d,cc.EventMouse.UP);d.setButton(c.button);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("mousemove",function(c){if(!e){var d=b.getHTMLElementPosition(a),f=b.getPointByEvent(c,d);b.handleTouchesMove([b.getTouchByXY(f.x,
f.y,d)]);d=b.getMouseEvent(f,d,cc.EventMouse.MOVE);b._mousePressed?d.setButton(c.button):d.setButton(null);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("mousewheel",function(c){var d=b.getHTMLElementPosition(a),e=b.getPointByEvent(c,d),d=b.getMouseEvent(e,d,cc.EventMouse.SCROLL);d.setButton(c.button);d.setScrollData(0,c.wheelDelta);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()},!1),a.addEventListener("DOMMouseScroll",function(c){var d=
b.getHTMLElementPosition(a),e=b.getPointByEvent(c,d),d=b.getMouseEvent(e,d,cc.EventMouse.SCROLL);d.setButton(c.button);d.setScrollData(0,-120*c.detail);cc.eventManager.dispatchEvent(d);c.stopPropagation();c.preventDefault()},!1));if(window.navigator.msPointerEnabled){var c={MSPointerDown:b.handleTouchesBegin,MSPointerMove:b.handleTouchesMove,MSPointerUp:b.handleTouchesEnd,MSPointerCancel:b.handleTouchesCancel},f;for(f in c)(function(c,d){a.addEventListener(c,function(c){var e=b.getHTMLElementPosition(a);
e.left-=document.documentElement.scrollLeft;e.top-=document.documentElement.scrollTop;d.call(b,[b.getTouchByXY(c.clientX,c.clientY,e)]);c.stopPropagation()},!1)})(f,c[f])}d&&(a.addEventListener("touchstart",function(c){if(c.changedTouches){var d=b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesBegin(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault();a.focus()}},!1),a.addEventListener("touchmove",function(c){if(c.changedTouches){var d=
b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesMove(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("touchend",function(c){if(c.changedTouches){var d=b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesEnd(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault()}},!1),a.addEventListener("touchcancel",function(c){if(c.changedTouches){var d=
b.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;b.handleTouchesCancel(b.getTouchesByEvent(c,d));c.stopPropagation();c.preventDefault()}},!1));this._registerKeyboardEvent();this._isRegisterEvent=!0}},_registerKeyboardEvent:function(){},_registerAccelerometerEvent:function(){},update:function(a){this._accelCurTime>this._accelInterval&&(this._accelCurTime-=this._accelInterval,cc.eventManager.dispatchEvent(new cc.EventAcceleration(this._acceleration)));this._accelCurTime+=
a}};_p=cc.inputManager;_p.setAccelerometerEnabled=function(a){this._accelEnabled!==a&&(this._accelEnabled=a,a=cc.director.getScheduler(),this._accelEnabled?(this._accelCurTime=0,this._registerAccelerometerEvent(),a.scheduleUpdate(this)):(this._accelCurTime=0,this._unregisterAccelerometerEvent(),a.unscheduleUpdate(this)))};_p.setAccelerometerInterval=function(a){this._accelInterval!==a&&(this._accelInterval=a)};
_p._registerKeyboardEvent=function(){cc._canvas.addEventListener("keydown",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!0));a.stopPropagation();a.preventDefault()},!1);cc._canvas.addEventListener("keyup",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!1));a.stopPropagation();a.preventDefault()},!1)};
_p._registerAccelerometerEvent=function(){var a=window;this._acceleration=new cc.Acceleration;this._accelDeviceEvent=a.DeviceMotionEvent||a.DeviceOrientationEvent;cc.sys.browserType===cc.sys.BROWSER_TYPE_MOBILE_QQ&&(this._accelDeviceEvent=window.DeviceOrientationEvent);var b=this._accelDeviceEvent===a.DeviceMotionEvent?"devicemotion":"deviceorientation",c=navigator.userAgent;if(/Android/.test(c)||/Adr/.test(c)&&cc.sys.browserType===cc.BROWSER_TYPE_UC)this._minus=-1;this.didAccelerateCallback=this.didAccelerate.bind(this);
a.addEventListener(b,this.didAccelerateCallback,!1)};_p._unregisterAccelerometerEvent=function(){this._acceleration=null;window.removeEventListener(this._accelDeviceEvent===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this.didAccelerateCallback,!1)};
_p.didAccelerate=function(a){var b=window;if(this._accelEnabled){var c=this._acceleration,d,e,f;this._accelDeviceEvent===window.DeviceMotionEvent?(f=a.accelerationIncludingGravity,d=this._accelMinus*f.x*0.1,e=this._accelMinus*f.y*0.1,f=0.1*f.z):(d=a.gamma/90*0.981,e=0.981*-(a.beta/90),f=a.alpha/90*0.981);c.x=d;c.y=e;c.z=f;c.timestamp=a.timeStamp||Date.now();a=c.x;b.orientation===cc.UIInterfaceOrientationLandscapeRight?(c.x=-c.y,c.y=a):b.orientation===cc.UIInterfaceOrientationLandscapeLeft?(c.x=c.y,
c.y=-a):b.orientation===cc.UIInterfaceOrientationPortraitUpsideDown&&(c.x=-c.x,c.y=-c.y)}};delete _p;cc.AffineTransform=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.tx=e;this.ty=f};cc.affineTransformMake=function(a,b,c,d,e,f){return{a:a,b:b,c:c,d:d,tx:e,ty:f}};cc.pointApplyAffineTransform=function(a,b,c){var d;void 0===c?(c=b,d=a.x,a=a.y):(d=a,a=b);return{x:c.a*d+c.c*a+c.tx,y:c.b*d+c.d*a+c.ty}};cc._pointApplyAffineTransform=function(a,b,c){return cc.pointApplyAffineTransform(a,b,c)};
cc.sizeApplyAffineTransform=function(a,b){return{width:b.a*a.width+b.c*a.height,height:b.b*a.width+b.d*a.height}};cc.affineTransformMakeIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}};cc.affineTransformIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}};
cc.rectApplyAffineTransform=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),h=cc.pointApplyAffineTransform(d,c,b),c=cc.pointApplyAffineTransform(e,c,b),d=cc.pointApplyAffineTransform(d,f,b),k=cc.pointApplyAffineTransform(e,f,b),e=Math.min(h.x,c.x,d.x,k.x),f=Math.max(h.x,c.x,d.x,k.x),m=Math.min(h.y,c.y,d.y,k.y),h=Math.max(h.y,c.y,d.y,k.y);return cc.rect(e,m,f-e,h-m)};
cc._rectApplyAffineTransformIn=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),h=cc.pointApplyAffineTransform(d,c,b),c=cc.pointApplyAffineTransform(e,c,b),d=cc.pointApplyAffineTransform(d,f,b),k=cc.pointApplyAffineTransform(e,f,b),e=Math.min(h.x,c.x,d.x,k.x),f=Math.max(h.x,c.x,d.x,k.x),m=Math.min(h.y,c.y,d.y,k.y),h=Math.max(h.y,c.y,d.y,k.y);a.x=e;a.y=m;a.width=f-e;a.height=h-m;return a};
cc.affineTransformTranslate=function(a,b,c){return{a:a.a,b:a.b,c:a.c,d:a.d,tx:a.tx+a.a*b+a.c*c,ty:a.ty+a.b*b+a.d*c}};cc.affineTransformScale=function(a,b,c){return{a:a.a*b,b:a.b*b,c:a.c*c,d:a.d*c,tx:a.tx,ty:a.ty}};cc.affineTransformRotate=function(a,b){var c=Math.sin(b),d=Math.cos(b);return{a:a.a*d+a.c*c,b:a.b*d+a.d*c,c:a.c*d-a.a*c,d:a.d*d-a.b*c,tx:a.tx,ty:a.ty}};
cc.affineTransformConcat=function(a,b){return{a:a.a*b.a+a.b*b.c,b:a.a*b.b+a.b*b.d,c:a.c*b.a+a.d*b.c,d:a.c*b.b+a.d*b.d,tx:a.tx*b.a+a.ty*b.c+b.tx,ty:a.tx*b.b+a.ty*b.d+b.ty}};cc.affineTransformConcatIn=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,h=a.tx,k=a.ty;a.a=c*b.a+d*b.c;a.b=c*b.b+d*b.d;a.c=e*b.a+f*b.c;a.d=e*b.b+f*b.d;a.tx=h*b.a+k*b.c+b.tx;a.ty=h*b.b+k*b.d+b.ty;return a};cc.affineTransformEqualToTransform=function(a,b){return a.a===b.a&&a.b===b.b&&a.c===b.c&&a.d===b.d&&a.tx===b.tx&&a.ty===b.ty};
cc.affineTransformInvert=function(a){var b=1/(a.a*a.d-a.b*a.c);return{a:b*a.d,b:-b*a.b,c:-b*a.c,d:b*a.a,tx:b*(a.c*a.ty-a.d*a.tx),ty:b*(a.b*a.tx-a.a*a.ty)}};cc.affineTransformInvertOut=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,h=1/(c*f-d*e);b.a=h*f;b.b=-h*d;b.c=-h*e;b.d=h*c;b.tx=h*(e*a.ty-f*a.tx);b.ty=h*(d*a.tx-c*a.ty)};cc.POINT_EPSILON=parseFloat("1.192092896e-07F");cc.pNeg=function(a){return cc.p(-a.x,-a.y)};cc.pAdd=function(a,b){return cc.p(a.x+b.x,a.y+b.y)};cc.pSub=function(a,b){return cc.p(a.x-b.x,a.y-b.y)};cc.pMult=function(a,b){return cc.p(a.x*b,a.y*b)};cc.pMidpoint=function(a,b){return cc.pMult(cc.pAdd(a,b),0.5)};cc.pDot=function(a,b){return a.x*b.x+a.y*b.y};cc.pCross=function(a,b){return a.x*b.y-a.y*b.x};cc.pPerp=function(a){return cc.p(-a.y,a.x)};cc.pRPerp=function(a){return cc.p(a.y,-a.x)};
cc.pProject=function(a,b){return cc.pMult(b,cc.pDot(a,b)/cc.pDot(b,b))};cc.pRotate=function(a,b){return cc.p(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x)};cc.pUnrotate=function(a,b){return cc.p(a.x*b.x+a.y*b.y,a.y*b.x-a.x*b.y)};cc.pLengthSQ=function(a){return cc.pDot(a,a)};cc.pDistanceSQ=function(a,b){return cc.pLengthSQ(cc.pSub(a,b))};cc.pLength=function(a){return Math.sqrt(cc.pLengthSQ(a))};cc.pDistance=function(a,b){return cc.pLength(cc.pSub(a,b))};
cc.pNormalize=function(a){var b=cc.pLength(a);return 0===b?cc.p(a):cc.pMult(a,1/b)};cc.pForAngle=function(a){return cc.p(Math.cos(a),Math.sin(a))};cc.pToAngle=function(a){return Math.atan2(a.y,a.x)};cc.clampf=function(a,b,c){if(b>c){var d=b;b=c;c=d}return a<b?b:a<c?a:c};cc.pClamp=function(a,b,c){return cc.p(cc.clampf(a.x,b.x,c.x),cc.clampf(a.y,b.y,c.y))};cc.pFromSize=function(a){return cc.p(a.width,a.height)};cc.pCompOp=function(a,b){return cc.p(b(a.x),b(a.y))};
cc.pLerp=function(a,b,c){return cc.pAdd(cc.pMult(a,1-c),cc.pMult(b,c))};cc.pFuzzyEqual=function(a,b,c){return a.x-c<=b.x&&b.x<=a.x+c&&a.y-c<=b.y&&b.y<=a.y+c?!0:!1};cc.pCompMult=function(a,b){return cc.p(a.x*b.x,a.y*b.y)};cc.pAngleSigned=function(a,b){var c=cc.pNormalize(a),d=cc.pNormalize(b),c=Math.atan2(c.x*d.y-c.y*d.x,cc.pDot(c,d));return Math.abs(c)<cc.POINT_EPSILON?0:c};cc.pAngle=function(a,b){var c=Math.acos(cc.pDot(cc.pNormalize(a),cc.pNormalize(b)));return Math.abs(c)<cc.POINT_EPSILON?0:c};
cc.pRotateByAngle=function(a,b,c){a=cc.pSub(a,b);var d=Math.cos(c);c=Math.sin(c);var e=a.x;a.x=e*d-a.y*c+b.x;a.y=e*c+a.y*d+b.y;return a};cc.pLineIntersect=function(a,b,c,d,e){if(a.x===b.x&&a.y===b.y||c.x===d.x&&c.y===d.y)return!1;var f=b.x-a.x;b=b.y-a.y;var h=d.x-c.x;d=d.y-c.y;var k=a.x-c.x;a=a.y-c.y;c=d*f-h*b;e.x=h*a-d*k;e.y=f*a-b*k;if(0===c)return 0===e.x||0===e.y?!0:!1;e.x/=c;e.y/=c;return!0};
cc.pSegmentIntersect=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)&&0<=e.x&&1>=e.x&&0<=e.y&&1>=e.y?!0:!1};cc.pIntersectPoint=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)?(c=cc.p(0,0),c.x=a.x+e.x*(b.x-a.x),c.y=a.y+e.x*(b.y-a.y),c):cc.p(0,0)};cc.pSameAs=function(a,b){return null!=a&&null!=b?a.x===b.x&&a.y===b.y:!1};cc.pZeroIn=function(a){a.x=0;a.y=0};cc.pIn=function(a,b){a.x=b.x;a.y=b.y};cc.pMultIn=function(a,b){a.x*=b;a.y*=b};
cc.pSubIn=function(a,b){a.x-=b.x;a.y-=b.y};cc.pAddIn=function(a,b){a.x+=b.x;a.y+=b.y};cc.pNormalizeIn=function(a){var b=Math.sqrt(a.x*a.x+a.y*a.y);0!==b&&cc.pMultIn(a,1/b)};cc.vertexLineToPolygon=function(a,b,c,d,e){e+=d;if(!(1>=e)){b*=0.5;for(var f,h=e-1,k=d;k<e;k++){f=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]),r=cc.pNormalize(cc.pSub(p,m)),s=cc.pNormalize(cc.pSub(n,m)),t=Math.acos(cc.pDot(r,s));n=t<cc.degreesToRadians(70)?cc.pPerp(cc.pNormalize(cc.pMidpoint(r,
s))):t<cc.degreesToRadians(170)?cc.pNormalize(cc.pMidpoint(r,s)):cc.pPerp(cc.pNormalize(cc.pSub(p,n)))}n=cc.pMult(n,b);c[2*f]=m.x+n.x;c[2*f+1]=m.y+n.y;c[2*(f+1)]=m.x-n.x;c[2*(f+1)+1]=m.y-n.y}for(k=0===d?0:d-1;k<h;k++)f=2*k,a=f+2,b=cc.vertex2(c[2*f],c[2*f+1]),e=cc.vertex2(c[2*(f+1)],c[2*(f+1)+1]),f=cc.vertex2(c[2*a],c[2*a]),d=cc.vertex2(c[2*(a+1)],c[2*(a+1)+1]),b=!cc.vertexLineIntersect(b.x,b.y,d.x,d.y,e.x,e.y,f.x,f.y),!b.isSuccess&&(0>b.value||1<b.value)&&(b.isSuccess=!0),b.isSuccess&&(c[2*a]=d.x,
c[2*a+1]=d.y,c[2*(a+1)]=f.x,c[2*(a+1)+1]=f.y)}};cc.vertexLineIntersect=function(a,b,c,d,e,f,h,k){if(a===c&&b===d||e===h&&f===k)return{isSuccess:!1,value:0};c-=a;d-=b;e-=a;f-=b;h-=a;k-=b;a=Math.sqrt(c*c+d*d);c/=a;d/=a;b=e*c+f*d;f=f*c-e*d;e=b;b=h*c+k*d;k=k*c-h*d;h=b;return f===k?{isSuccess:!1,value:0}:{isSuccess:!0,value:(h+(e-h)*k/(k-f))/a}};cc.vertexListIsClockwise=function(a){for(var b=0,c=a.length;b<c;b++){var d=a[(b+1)%c],e=a[(b+2)%c];if(0<cc.pCross(cc.pSub(d,a[b]),cc.pSub(e,d)))return!1}return!0};cc.CGAffineToGL=function(a,b){b[2]=b[3]=b[6]=b[7]=b[8]=b[9]=b[11]=b[14]=0;b[10]=b[15]=1;b[0]=a.a;b[4]=a.c;b[12]=a.tx;b[1]=a.b;b[5]=a.d;b[13]=a.ty};cc.GLToCGAffine=function(a,b){b.a=a[0];b.c=a[4];b.tx=a[12];b.b=a[1];b.d=a[5];b.ty=a[13]};cc.Touch=cc.Class.extend({_lastModified:0,_point:null,_prevPoint:null,_id:0,_startPointCaptured:!1,_startPoint:null,ctor:function(a,b,c){this.setTouchInfo(c,a,b)},getLocation:function(){return{x:this._point.x,y:this._point.y}},getLocationX:function(){return this._point.x},getLocationY:function(){return this._point.y},getPreviousLocation:function(){return{x:this._prevPoint.x,y:this._prevPoint.y}},getStartLocation:function(){return{x:this._startPoint.x,y:this._startPoint.y}},getDelta:function(){return cc.pSub(this._point,
this._prevPoint)},getLocationInView:function(){return{x:this._point.x,y:this._point.y}},getPreviousLocationInView:function(){return{x:this._prevPoint.x,y:this._prevPoint.y}},getStartLocationInView:function(){return{x:this._startPoint.x,y:this._startPoint.y}},getID:function(){return this._id},getId:function(){cc.log("getId is deprecated. Please use getID instead.");return this._id},setTouchInfo:function(a,b,c){this._prevPoint=this._point;this._point=cc.p(b||0,c||0);this._id=a;this._startPointCaptured||
(this._startPoint=cc.p(this._point),cc.view._convertPointWithScale(this._startPoint),this._startPointCaptured=!0)},_setPoint:function(a,b){void 0===b?(this._point.x=a.x,this._point.y=a.y):(this._point.x=a,this._point.y=b)},_setPrevPoint:function(a,b){this._prevPoint=void 0===b?cc.p(a.x,a.y):cc.p(a||0,b||0)}});cc.Event=cc.Class.extend({_type:0,_isStopped:!1,_currentTarget:null,_setCurrentTarget:function(a){this._currentTarget=a},ctor:function(a){this._type=a},getType:function(){return this._type},stopPropagation:function(){this._isStopped=!0},isStopped:function(){return this._isStopped},getCurrentTarget:function(){return this._currentTarget}});cc.Event.TOUCH=0;cc.Event.KEYBOARD=1;cc.Event.ACCELERATION=2;cc.Event.MOUSE=3;cc.Event.FOCUS=4;cc.Event.CUSTOM=6;
cc.EventCustom=cc.Event.extend({_eventName:null,_userData:null,ctor:function(a){cc.Event.prototype.ctor.call(this,cc.Event.CUSTOM);this._eventName=a},setUserData:function(a){this._userData=a},getUserData:function(){return this._userData},getEventName:function(){return this._eventName}});
cc.EventMouse=cc.Event.extend({_eventType:0,_button:0,_x:0,_y:0,_prevX:0,_prevY:0,_scrollX:0,_scrollY:0,ctor:function(a){cc.Event.prototype.ctor.call(this,cc.Event.MOUSE);this._eventType=a},setScrollData:function(a,b){this._scrollX=a;this._scrollY=b},getScrollX:function(){return this._scrollX},getScrollY:function(){return this._scrollY},setLocation:function(a,b){this._x=a;this._y=b},getLocation:function(){return{x:this._x,y:this._y}},getLocationInView:function(){return{x:this._x,y:cc.view._designResolutionSize.height-
this._y}},_setPrevCursor:function(a,b){this._prevX=a;this._prevY=b},getDelta:function(){return{x:this._x-this._prevX,y:this._y-this._prevY}},getDeltaX:function(){return this._x-this._prevX},getDeltaY:function(){return this._y-this._prevY},setButton:function(a){this._button=a},getButton:function(){return this._button},getLocationX:function(){return this._x},getLocationY:function(){return this._y}});cc.EventMouse.NONE=0;cc.EventMouse.DOWN=1;cc.EventMouse.UP=2;cc.EventMouse.MOVE=3;
cc.EventMouse.SCROLL=4;cc.EventMouse.BUTTON_LEFT=0;cc.EventMouse.BUTTON_RIGHT=2;cc.EventMouse.BUTTON_MIDDLE=1;cc.EventMouse.BUTTON_4=3;cc.EventMouse.BUTTON_5=4;cc.EventMouse.BUTTON_6=5;cc.EventMouse.BUTTON_7=6;cc.EventMouse.BUTTON_8=7;
cc.EventTouch=cc.Event.extend({_eventCode:0,_touches:null,ctor:function(a){cc.Event.prototype.ctor.call(this,cc.Event.TOUCH);this._touches=a||[]},getEventCode:function(){return this._eventCode},getTouches:function(){return this._touches},_setEventCode:function(a){this._eventCode=a},_setTouches:function(a){this._touches=a}});cc.EventTouch.MAX_TOUCHES=5;cc.EventTouch.EventCode={BEGAN:0,MOVED:1,ENDED:2,CANCELLED:3};
cc.EventFocus=cc.Event.extend({_widgetGetFocus:null,_widgetLoseFocus:null,ctor:function(a,b){cc.Event.prototype.ctor.call(this,cc.Event.FOCUS);this._widgetGetFocus=b;this._widgetLoseFocus=a}});cc.EventListener=cc.Class.extend({_onEvent:null,_type:0,_listenerID:null,_registered:!1,_fixedPriority:0,_node:null,_paused:!0,_isEnabled:!0,ctor:function(a,b,c){this._onEvent=c;this._type=a||0;this._listenerID=b||""},_setPaused:function(a){this._paused=a},_isPaused:function(){return this._paused},_setRegistered:function(a){this._registered=a},_isRegistered:function(){return this._registered},_getType:function(){return this._type},_getListenerID:function(){return this._listenerID},_setFixedPriority:function(a){this._fixedPriority=
a},_getFixedPriority:function(){return this._fixedPriority},_setSceneGraphPriority:function(a){this._node=a},_getSceneGraphPriority:function(){return this._node},checkAvailable:function(){return null!==this._onEvent},clone:function(){return null},setEnabled:function(a){this._isEnabled=a},isEnabled:function(){return this._isEnabled},retain:function(){},release:function(){}});cc.EventListener.UNKNOWN=0;cc.EventListener.TOUCH_ONE_BY_ONE=1;cc.EventListener.TOUCH_ALL_AT_ONCE=2;
cc.EventListener.KEYBOARD=3;cc.EventListener.MOUSE=4;cc.EventListener.ACCELERATION=6;cc.EventListener.FOCUS=7;cc.EventListener.CUSTOM=8;
cc._EventListenerCustom=cc.EventListener.extend({_onCustomEvent:null,ctor:function(a,b,c){this._onCustomEvent=b;this._target=c;cc.EventListener.prototype.ctor.call(this,cc.EventListener.CUSTOM,a,this._callback)},_callback:function(a){null!==this._onCustomEvent&&this._onCustomEvent.call(this._target,a)},checkAvailable:function(){return cc.EventListener.prototype.checkAvailable.call(this)&&null!==this._onCustomEvent},clone:function(){return new cc._EventListenerCustom(this._listenerID,this._onCustomEvent)}});
cc._EventListenerCustom.create=function(a,b){return new cc._EventListenerCustom(a,b)};
cc._EventListenerMouse=cc.EventListener.extend({onMouseDown:null,onMouseUp:null,onMouseMove:null,onMouseScroll:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.MOUSE,cc._EventListenerMouse.LISTENER_ID,this._callback)},_callback:function(a){var b=cc.EventMouse;switch(a._eventType){case b.DOWN:if(this.onMouseDown)this.onMouseDown(a);break;case b.UP:if(this.onMouseUp)this.onMouseUp(a);break;case b.MOVE:if(this.onMouseMove)this.onMouseMove(a);break;case b.SCROLL:if(this.onMouseScroll)this.onMouseScroll(a)}},
clone:function(){var a=new cc._EventListenerMouse;a.onMouseDown=this.onMouseDown;a.onMouseUp=this.onMouseUp;a.onMouseMove=this.onMouseMove;a.onMouseScroll=this.onMouseScroll;return a},checkAvailable:function(){return!0}});cc._EventListenerMouse.LISTENER_ID="__cc_mouse";cc._EventListenerMouse.create=function(){return new cc._EventListenerMouse};
cc._EventListenerTouchOneByOne=cc.EventListener.extend({_claimedTouches:null,swallowTouches:!1,onTouchBegan:null,onTouchMoved:null,onTouchEnded:null,onTouchCancelled:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.TOUCH_ONE_BY_ONE,cc._EventListenerTouchOneByOne.LISTENER_ID,null);this._claimedTouches=[]},setSwallowTouches:function(a){this.swallowTouches=a},isSwallowTouches:function(){return this.swallowTouches},clone:function(){var a=new cc._EventListenerTouchOneByOne;
a.onTouchBegan=this.onTouchBegan;a.onTouchMoved=this.onTouchMoved;a.onTouchEnded=this.onTouchEnded;a.onTouchCancelled=this.onTouchCancelled;a.swallowTouches=this.swallowTouches;return a},checkAvailable:function(){return this.onTouchBegan?!0:(cc.log(cc._LogInfos._EventListenerTouchOneByOne_checkAvailable),!1)}});cc._EventListenerTouchOneByOne.LISTENER_ID="__cc_touch_one_by_one";cc._EventListenerTouchOneByOne.create=function(){return new cc._EventListenerTouchOneByOne};
cc._EventListenerTouchAllAtOnce=cc.EventListener.extend({onTouchesBegan:null,onTouchesMoved:null,onTouchesEnded:null,onTouchesCancelled:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.TOUCH_ALL_AT_ONCE,cc._EventListenerTouchAllAtOnce.LISTENER_ID,null)},clone:function(){var a=new cc._EventListenerTouchAllAtOnce;a.onTouchesBegan=this.onTouchesBegan;a.onTouchesMoved=this.onTouchesMoved;a.onTouchesEnded=this.onTouchesEnded;a.onTouchesCancelled=this.onTouchesCancelled;return a},
checkAvailable:function(){return null===this.onTouchesBegan&&null===this.onTouchesMoved&&null===this.onTouchesEnded&&null===this.onTouchesCancelled?(cc.log(cc._LogInfos._EventListenerTouchAllAtOnce_checkAvailable),!1):!0}});cc._EventListenerTouchAllAtOnce.LISTENER_ID="__cc_touch_all_at_once";cc._EventListenerTouchAllAtOnce.create=function(){return new cc._EventListenerTouchAllAtOnce};
cc.EventListener.create=function(a){cc.assert(a&&a.event,cc._LogInfos.EventListener_create);var b=a.event;delete a.event;var c=null;b===cc.EventListener.TOUCH_ONE_BY_ONE?c=new cc._EventListenerTouchOneByOne:b===cc.EventListener.TOUCH_ALL_AT_ONCE?c=new cc._EventListenerTouchAllAtOnce:b===cc.EventListener.MOUSE?c=new cc._EventListenerMouse:b===cc.EventListener.CUSTOM?(c=new cc._EventListenerCustom(a.eventName,a.callback),delete a.eventName,delete a.callback):b===cc.EventListener.KEYBOARD?c=new cc._EventListenerKeyboard:
b===cc.EventListener.ACCELERATION?(c=new cc._EventListenerAcceleration(a.callback),delete a.callback):b===cc.EventListener.FOCUS&&(c=new cc._EventListenerFocus);for(var d in a)c[d]=a[d];return c};
cc._EventListenerFocus=cc.EventListener.extend({clone:function(){var a=new cc._EventListenerFocus;a.onFocusChanged=this.onFocusChanged;return a},checkAvailable:function(){return this.onFocusChanged?!0:(cc.log("Invalid EventListenerFocus!"),!1)},onFocusChanged:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.FOCUS,cc._EventListenerFocus.LISTENER_ID,this._callback)},_callback:function(a){if(this.onFocusChanged)this.onFocusChanged(a._widgetLoseFocus,a._widgetGetFocus)}});
cc._EventListenerFocus.LISTENER_ID="__cc_focus_event";(function(){function a(a){var c=cc.Event,d=a._type;if(d===c.ACCELERATION)return cc._EventListenerAcceleration.LISTENER_ID;if(d===c.CUSTOM)return a._eventName;if(d===c.KEYBOARD)return cc._EventListenerKeyboard.LISTENER_ID;if(d===c.MOUSE)return cc._EventListenerMouse.LISTENER_ID;if(d===c.FOCUS)return cc._EventListenerFocus.LISTENER_ID;d===c.TOUCH&&cc.log(cc._LogInfos.__getListenerID);return""}cc._EventListenerVector=cc.Class.extend({_fixedListeners:null,_sceneGraphListeners:null,gt0Index:0,ctor:function(){this._fixedListeners=
[];this._sceneGraphListeners=[]},size:function(){return this._fixedListeners.length+this._sceneGraphListeners.length},empty:function(){return 0===this._fixedListeners.length&&0===this._sceneGraphListeners.length},push:function(a){0===a._getFixedPriority()?this._sceneGraphListeners.push(a):this._fixedListeners.push(a)},clearSceneGraphListeners:function(){this._sceneGraphListeners.length=0},clearFixedListeners:function(){this._fixedListeners.length=0},clear:function(){this._sceneGraphListeners.length=
0;this._fixedListeners.length=0},getFixedPriorityListeners:function(){return this._fixedListeners},getSceneGraphPriorityListeners:function(){return this._sceneGraphListeners}});cc.eventManager={DIRTY_NONE:0,DIRTY_FIXED_PRIORITY:1,DIRTY_SCENE_GRAPH_PRIORITY:2,DIRTY_ALL:3,_listenersMap:{},_priorityDirtyFlagMap:{},_nodeListenersMap:{},_nodePriorityMap:{},_globalZOrderNodeMap:{},_toAddedListeners:[],_toRemovedListeners:[],_dirtyNodes:[],_inDispatch:0,_isEnabled:!1,_nodePriorityIndex:0,_internalCustomListenerIDs:[cc.game.EVENT_HIDE,
cc.game.EVENT_SHOW],_setDirtyForNode:function(a){null!=this._nodeListenersMap[a.__instanceId]&&this._dirtyNodes.push(a);a=a.getChildren();for(var c=0,d=a.length;c<d;c++)this._setDirtyForNode(a[c])},pauseTarget:function(a,c){var d=this._nodeListenersMap[a.__instanceId],e,f;if(d)for(e=0,f=d.length;e<f;e++)d[e]._setPaused(!0);if(!0===c)for(d=a.getChildren(),e=0,f=d.length;e<f;e++)this.pauseTarget(d[e],!0)},resumeTarget:function(a,c){var d=this._nodeListenersMap[a.__instanceId],e,f;if(d)for(e=0,f=d.length;e<
f;e++)d[e]._setPaused(!1);this._setDirtyForNode(a);if(!0===c)for(d=a.getChildren(),e=0,f=d.length;e<f;e++)this.resumeTarget(d[e],!0)},_addListener:function(a){0===this._inDispatch?this._forceAddEventListener(a):this._toAddedListeners.push(a)},_forceAddEventListener:function(a){var c=a._getListenerID(),d=this._listenersMap[c];d||(d=new cc._EventListenerVector,this._listenersMap[c]=d);d.push(a);0===a._getFixedPriority()?(this._setDirty(c,this.DIRTY_SCENE_GRAPH_PRIORITY),c=a._getSceneGraphPriority(),
null===c&&cc.log(cc._LogInfos.eventManager__forceAddEventListener),this._associateNodeAndEventListener(c,a),c.isRunning()&&this.resumeTarget(c)):this._setDirty(c,this.DIRTY_FIXED_PRIORITY)},_getListeners:function(a){return this._listenersMap[a]},_updateDirtyFlagForSceneGraph:function(){if(0!==this._dirtyNodes.length){for(var a=this._dirtyNodes,c,d,e=this._nodeListenersMap,f=0,h=a.length;f<h;f++)if(c=e[a[f].__instanceId])for(var k=0,m=c.length;k<m;k++)(d=c[k])&&this._setDirty(d._getListenerID(),this.DIRTY_SCENE_GRAPH_PRIORITY);
this._dirtyNodes.length=0}},_removeAllListenersInVector:function(a){if(a)for(var c,d=0;d<a.length;)c=a[d],c._setRegistered(!1),null!=c._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(c._getSceneGraphPriority(),c),c._setSceneGraphPriority(null)),0===this._inDispatch?cc.arrayRemoveObject(a,c):++d},_removeListenersForListenerID:function(a){var c=this._listenersMap[a];if(c){var d=c.getFixedPriorityListeners(),e=c.getSceneGraphPriorityListeners();this._removeAllListenersInVector(e);this._removeAllListenersInVector(d);
delete this._priorityDirtyFlagMap[a];this._inDispatch||c.clear();delete this._listenersMap[a]}d=this._toAddedListeners;for(c=0;c<d.length;)(e=d[c])&&e._getListenerID()===a?cc.arrayRemoveObject(d,e):++c},_sortEventListeners:function(a){var c=this.DIRTY_NONE,d=this._priorityDirtyFlagMap;d[a]&&(c=d[a]);c!==this.DIRTY_NONE&&(d[a]=this.DIRTY_NONE,c&this.DIRTY_FIXED_PRIORITY&&this._sortListenersOfFixedPriority(a),c&this.DIRTY_SCENE_GRAPH_PRIORITY&&((c=cc.director.getRunningScene())?this._sortListenersOfSceneGraphPriority(a,
c):d[a]=this.DIRTY_SCENE_GRAPH_PRIORITY))},_sortListenersOfSceneGraphPriority:function(a,c){var d=this._getListeners(a);if(d){var e=d.getSceneGraphPriorityListeners();e&&0!==e.length&&(this._nodePriorityIndex=0,this._nodePriorityMap={},this._visitTarget(c,!0),d.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes))}},_sortEventListenersOfSceneGraphPriorityDes:function(a,c){var d=cc.eventManager._nodePriorityMap,e=a._getSceneGraphPriority(),f=c._getSceneGraphPriority();
return c&&f&&d[f.__instanceId]?a&&e&&d[e.__instanceId]?d[c._getSceneGraphPriority().__instanceId]-d[a._getSceneGraphPriority().__instanceId]:1:-1},_sortListenersOfFixedPriority:function(a){if(a=this._listenersMap[a]){var c=a.getFixedPriorityListeners();if(c&&0!==c.length){c.sort(this._sortListenersOfFixedPriorityAsc);for(var d=0,e=c.length;d<e&&!(0<=c[d]._getFixedPriority());)++d;a.gt0Index=d}}},_sortListenersOfFixedPriorityAsc:function(a,c){return a._getFixedPriority()-c._getFixedPriority()},_onUpdateListeners:function(a){var c=
a.getFixedPriorityListeners(),d=a.getSceneGraphPriorityListeners(),e,f,h=this._toRemovedListeners;if(d)for(e=0;e<d.length;)f=d[e],f._isRegistered()?++e:(cc.arrayRemoveObject(d,f),f=h.indexOf(f),-1!==f&&h.splice(f,1));if(c)for(e=0;e<c.length;)f=c[e],f._isRegistered()?++e:(cc.arrayRemoveObject(c,f),f=h.indexOf(f),-1!==f&&h.splice(f,1));d&&0===d.length&&a.clearSceneGraphListeners();c&&0===c.length&&a.clearFixedListeners()},frameUpdateListeners:function(){var a=this._listenersMap,c=this._priorityDirtyFlagMap,
d;for(d in a)a[d].empty()&&(delete c[d],delete a[d]);a=this._toAddedListeners;if(0!==a.length){c=0;for(d=a.length;c<d;c++)this._forceAddEventListener(a[c]);a.length=0}0!==this._toRemovedListeners.length&&this._cleanToRemovedListeners()},_updateTouchListeners:function(a){a=this._inDispatch;cc.assert(0<a,cc._LogInfos.EventManager__updateListeners);if(!(1<a)){var c;(c=this._listenersMap[cc._EventListenerTouchOneByOne.LISTENER_ID])&&this._onUpdateListeners(c);(c=this._listenersMap[cc._EventListenerTouchAllAtOnce.LISTENER_ID])&&
this._onUpdateListeners(c);cc.assert(1===a,cc._LogInfos.EventManager__updateListeners_2);a=this._toAddedListeners;if(0!==a.length){c=0;for(var d=a.length;c<d;c++)this._forceAddEventListener(a[c]);a.length=0}0!==this._toRemovedListeners.length&&this._cleanToRemovedListeners()}},_cleanToRemovedListeners:function(){for(var a=this._toRemovedListeners,c=0;c<a.length;c++){var d=a[c],e=this._listenersMap[d._getListenerID()];if(e){var f=e.getFixedPriorityListeners(),h=e.getSceneGraphPriorityListeners();h&&
(e=h.indexOf(d),-1!==e&&h.splice(e,1));f&&(e=f.indexOf(d),-1!==e&&f.splice(e,1))}}a.length=0},_onTouchEventCallback:function(a,c){if(!a._isRegistered)return!1;var d=c.event,e=c.selTouch;d._setCurrentTarget(a._node);var f=!1,h,k=d.getEventCode(),m=cc.EventTouch.EventCode;if(k===m.BEGAN)a.onTouchBegan&&(f=a.onTouchBegan(e,d))&&a._registered&&a._claimedTouches.push(e);else if(0<a._claimedTouches.length&&-1!==(h=a._claimedTouches.indexOf(e)))if(f=!0,k===m.MOVED&&a.onTouchMoved)a.onTouchMoved(e,d);else if(k===
m.ENDED){if(a.onTouchEnded)a.onTouchEnded(e,d);a._registered&&a._claimedTouches.splice(h,1)}else if(k===m.CANCELLED){if(a.onTouchCancelled)a.onTouchCancelled(e,d);a._registered&&a._claimedTouches.splice(h,1)}return d.isStopped()?(cc.eventManager._updateTouchListeners(d),!0):f&&a._registered&&a.swallowTouches?(c.needsMutableSet&&c.touches.splice(e,1),!0):!1},_dispatchTouchEvent:function(a){this._sortEventListeners(cc._EventListenerTouchOneByOne.LISTENER_ID);this._sortEventListeners(cc._EventListenerTouchAllAtOnce.LISTENER_ID);
var c=this._getListeners(cc._EventListenerTouchOneByOne.LISTENER_ID),d=this._getListeners(cc._EventListenerTouchAllAtOnce.LISTENER_ID);if(null!==c||null!==d){var e=a.getTouches(),f=cc.copyArray(e),h={event:a,needsMutableSet:c&&d,touches:f,selTouch:null};if(c)for(var k=0;k<e.length;k++)if(h.selTouch=e[k],this._dispatchEventToListeners(c,this._onTouchEventCallback,h),a.isStopped())return;if(d&&0<f.length&&(this._dispatchEventToListeners(d,this._onTouchesEventCallback,{event:a,touches:f}),a.isStopped()))return;
this._updateTouchListeners(a)}},_onTouchesEventCallback:function(a,c){if(!a._registered)return!1;var d=cc.EventTouch.EventCode,e=c.event,f=c.touches,h=e.getEventCode();e._setCurrentTarget(a._node);if(h===d.BEGAN&&a.onTouchesBegan)a.onTouchesBegan(f,e);else if(h===d.MOVED&&a.onTouchesMoved)a.onTouchesMoved(f,e);else if(h===d.ENDED&&a.onTouchesEnded)a.onTouchesEnded(f,e);else if(h===d.CANCELLED&&a.onTouchesCancelled)a.onTouchesCancelled(f,e);return e.isStopped()?(cc.eventManager._updateTouchListeners(e),
!0):!1},_associateNodeAndEventListener:function(a,c){var d=this._nodeListenersMap[a.__instanceId];d||(d=[],this._nodeListenersMap[a.__instanceId]=d);d.push(c)},_dissociateNodeAndEventListener:function(a,c){var d=this._nodeListenersMap[a.__instanceId];d&&(cc.arrayRemoveObject(d,c),0===d.length&&delete this._nodeListenersMap[a.__instanceId])},_dispatchEventToListeners:function(a,c,d){var e=!1,f=a.getFixedPriorityListeners(),h=a.getSceneGraphPriorityListeners(),k=0,m;if(f&&0!==f.length)for(;k<a.gt0Index;++k)if(m=
f[k],m.isEnabled()&&!m._isPaused()&&m._isRegistered()&&c(m,d)){e=!0;break}if(h&&!e)for(a=0;a<h.length;a++)if(m=h[a],m.isEnabled()&&!m._isPaused()&&m._isRegistered()&&c(m,d)){e=!0;break}if(f&&!e)for(;k<f.length&&(m=f[k],!m.isEnabled()||m._isPaused()||!m._isRegistered()||!c(m,d));++k);},_setDirty:function(a,c){var d=this._priorityDirtyFlagMap;d[a]=null==d[a]?c:c|d[a]},_visitTarget:function(a,c){var d=a.getChildren(),e=0,f=d.length,h=this._globalZOrderNodeMap,k=this._nodeListenersMap;if(0<f){for(var m;e<
f;e++)if((m=d[e])&&0>m.getLocalZOrder())this._visitTarget(m,!1);else break;null!=k[a.__instanceId]&&(h[a.getGlobalZOrder()]||(h[a.getGlobalZOrder()]=[]),h[a.getGlobalZOrder()].push(a.__instanceId));for(;e<f;e++)(m=d[e])&&this._visitTarget(m,!1)}else null!=k[a.__instanceId]&&(h[a.getGlobalZOrder()]||(h[a.getGlobalZOrder()]=[]),h[a.getGlobalZOrder()].push(a.__instanceId));if(c){var d=[],n;for(n in h)d.push(n);d.sort(this._sortNumberAsc);n=d.length;m=this._nodePriorityMap;for(e=0;e<n;e++)for(f=h[d[e]],
k=0;k<f.length;k++)m[f[k]]=++this._nodePriorityIndex;this._globalZOrderNodeMap={}}},_sortNumberAsc:function(a,c){return a-c},addListener:function(a,c){cc.assert(a&&c,cc._LogInfos.eventManager_addListener_2);if(!(a instanceof cc.EventListener))cc.assert(!cc.isNumber(c),cc._LogInfos.eventManager_addListener_3),a=cc.EventListener.create(a);else if(a._isRegistered()){cc.log(cc._LogInfos.eventManager_addListener_4);return}if(a.checkAvailable()){if(cc.isNumber(c)){if(0===c){cc.log(cc._LogInfos.eventManager_addListener);
return}a._setSceneGraphPriority(null);a._setFixedPriority(c);a._setRegistered(!0);a._setPaused(!1)}else a._setSceneGraphPriority(c),a._setFixedPriority(0),a._setRegistered(!0);this._addListener(a);return a}},addCustomListener:function(a,c,d){a=new cc._EventListenerCustom(a,c,d);this.addListener(a,1);return a},removeListener:function(a){if(null!=a){var c,d=this._listenersMap,e;for(e in d){var f=d[e],h=f.getFixedPriorityListeners();c=f.getSceneGraphPriorityListeners();(c=this._removeListenerInVector(c,
a))?this._setDirty(a._getListenerID(),this.DIRTY_SCENE_GRAPH_PRIORITY):(c=this._removeListenerInVector(h,a))&&this._setDirty(a._getListenerID(),this.DIRTY_FIXED_PRIORITY);f.empty()&&(delete this._priorityDirtyFlagMap[a._getListenerID()],delete d[e]);if(c)break}if(!c)for(d=this._toAddedListeners,e=0,f=d.length;e<f;e++)if(h=d[e],h===a){cc.arrayRemoveObject(d,h);h._setRegistered(!1);break}}},_removeListenerInCallback:function(a,c){if(null==a)return!1;for(var d=0,e=a.length;d<e;d++){var f=a[d];if(f._onCustomEvent===
c||f._onEvent===c)return f._setRegistered(!1),null!=f._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(f._getSceneGraphPriority(),f),f._setSceneGraphPriority(null)),0===this._inDispatch&&cc.arrayRemoveObject(a,f),!0}return!1},_removeListenerInVector:function(a,c){if(null==a)return!1;for(var d=0,e=a.length;d<e;d++){var f=a[d];if(f===c)return f._setRegistered(!1),null!=f._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(f._getSceneGraphPriority(),f),f._setSceneGraphPriority(null)),
0===this._inDispatch?cc.arrayRemoveObject(a,f):this._toRemovedListeners.push(f),!0}return!1},removeListeners:function(a,c){if(a instanceof cc.Node){delete this._nodePriorityMap[a.__instanceId];cc.arrayRemoveObject(this._dirtyNodes,a);var d=this._nodeListenersMap[a.__instanceId];if(d){for(var e=cc.copyArray(d),d=0;d<e.length;d++)this.removeListener(e[d]);e.length=0}e=this._toAddedListeners;for(d=0;d<e.length;){var f=e[d];f._getSceneGraphPriority()===a?(f._setSceneGraphPriority(null),f._setRegistered(!1),
e.splice(d,1)):++d}if(!0===c)for(e=a.getChildren(),d=0,f=e.length;d<f;d++)this.removeListeners(e[d],!0)}else a===cc.EventListener.TOUCH_ONE_BY_ONE?this._removeListenersForListenerID(cc._EventListenerTouchOneByOne.LISTENER_ID):a===cc.EventListener.TOUCH_ALL_AT_ONCE?this._removeListenersForListenerID(cc._EventListenerTouchAllAtOnce.LISTENER_ID):a===cc.EventListener.MOUSE?this._removeListenersForListenerID(cc._EventListenerMouse.LISTENER_ID):a===cc.EventListener.ACCELERATION?this._removeListenersForListenerID(cc._EventListenerAcceleration.LISTENER_ID):
a===cc.EventListener.KEYBOARD?this._removeListenersForListenerID(cc._EventListenerKeyboard.LISTENER_ID):cc.log(cc._LogInfos.eventManager_removeListeners)},removeCustomListeners:function(a){this._removeListenersForListenerID(a)},removeAllListeners:function(){var a=this._listenersMap,c=this._internalCustomListenerIDs,d;for(d in a)-1===c.indexOf(d)&&this._removeListenersForListenerID(d)},setPriority:function(a,c){if(null!=a){var d=this._listenersMap,e;for(e in d){var f=d[e].getFixedPriorityListeners();
if(f&&-1!==f.indexOf(a)){null!=a._getSceneGraphPriority()&&cc.log(cc._LogInfos.eventManager_setPriority);a._getFixedPriority()!==c&&(a._setFixedPriority(c),this._setDirty(a._getListenerID(),this.DIRTY_FIXED_PRIORITY));break}}}},setEnabled:function(a){this._isEnabled=a},isEnabled:function(){return this._isEnabled},dispatchEvent:function(b){if(this._isEnabled){this._updateDirtyFlagForSceneGraph();this._inDispatch++;if(!b||!b.getType)throw Error("event is undefined");if(b._type===cc.Event.TOUCH)this._dispatchTouchEvent(b);
else{var c=a(b);this._sortEventListeners(c);if(c=this._listenersMap[c])this._dispatchEventToListeners(c,this._onListenerCallback,b),this._onUpdateListeners(c)}this._inDispatch--}},_onListenerCallback:function(a,c){c._setCurrentTarget(a._getSceneGraphPriority());a._onEvent(c);return c.isStopped()},dispatchCustomEvent:function(a,c){var d=new cc.EventCustom(a);d.setUserData(c);this.dispatchEvent(d)}}})();cc.EventAcceleration=cc.Event.extend({_acc:null,ctor:function(a){cc.Event.prototype.ctor.call(this,cc.Event.ACCELERATION);this._acc=a}});cc.EventKeyboard=cc.Event.extend({_keyCode:0,_isPressed:!1,ctor:function(a,b){cc.Event.prototype.ctor.call(this,cc.Event.KEYBOARD);this._keyCode=a;this._isPressed=b}});
cc._EventListenerAcceleration=cc.EventListener.extend({_onAccelerationEvent:null,ctor:function(a){this._onAccelerationEvent=a;var b=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.ACCELERATION,cc._EventListenerAcceleration.LISTENER_ID,function(a){b._onAccelerationEvent(a._acc,a)})},checkAvailable:function(){cc.assert(this._onAccelerationEvent,cc._LogInfos._EventListenerAcceleration_checkAvailable);return!0},clone:function(){return new cc._EventListenerAcceleration(this._onAccelerationEvent)}});
cc._EventListenerAcceleration.LISTENER_ID="__cc_acceleration";cc._EventListenerAcceleration.create=function(a){return new cc._EventListenerAcceleration(a)};
cc._EventListenerKeyboard=cc.EventListener.extend({onKeyPressed:null,onKeyReleased:null,ctor:function(){var a=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.KEYBOARD,cc._EventListenerKeyboard.LISTENER_ID,function(b){if(b._isPressed){if(a.onKeyPressed)a.onKeyPressed(b._keyCode,b)}else if(a.onKeyReleased)a.onKeyReleased(b._keyCode,b)})},clone:function(){var a=new cc._EventListenerKeyboard;a.onKeyPressed=this.onKeyPressed;a.onKeyReleased=this.onKeyReleased;return a},checkAvailable:function(){return null===
this.onKeyPressed&&null===this.onKeyReleased?(cc.log(cc._LogInfos._EventListenerKeyboard_checkAvailable),!1):!0}});cc._EventListenerKeyboard.LISTENER_ID="__cc_keyboard";cc._EventListenerKeyboard.create=function(){return new cc._EventListenerKeyboard};var GlobalVertexBuffer=function(){var a=function(a,c){this.gl=a;this.vertexBuffer=a.createBuffer();this.size=888;this.byteLength=c||3552*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this.data=new ArrayBuffer(this.byteLength);this.dataArray=new Float32Array(this.data);a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer);a.bufferData(a.ARRAY_BUFFER,this.dataArray,a.DYNAMIC_DRAW);this._dirty=!1;this._spaces={0:this.byteLength}};a.prototype={constructor:a,allocBuffer:function(a,c){var d=this._spaces[a];return d&&
d>=c?(delete this._spaces[a],d>c&&(this._spaces[a+c]=d-c),!0):!1},requestBuffer:function(a){var c,d,e;for(c in this._spaces)if(d=parseInt(c),e=this._spaces[c],e>=a&&this.allocBuffer(d,a))return d;return-1},freeBuffer:function(a,c){var d=this._spaces,e,f;for(f in d){e=parseInt(f);if(e>a)break;if(e+d[f]>=a){c=c+a-e;a=e;break}}d=a+c;this._spaces[d]&&(c+=this._spaces[d],delete this._spaces[d]);this._spaces[a]=c},setDirty:function(){this._dirty=!0},update:function(){this._dirty&&(this.gl.bindBuffer(gl.ARRAY_BUFFER,
this.vertexBuffer),this.gl.bufferSubData(gl.ARRAY_BUFFER,0,this.dataArray),this._dirty=!1)},updateSubData:function(a,c){this.gl.bindBuffer(gl.ARRAY_BUFFER,this.vertexBuffer);this.gl.bufferSubData(gl.ARRAY_BUFFER,a,c)},destroy:function(){this.gl.deleteBuffer(this.vertexBuffer);this.vertexBuffer=this.texCoords=this.colors=this.positions=this.data=null}};return a}();cc.rendererCanvas={childrenOrderDirty:!0,assignedZ:0,assignedZStep:1E-4,_transformNodePool:[],_renderCmds:[],_isCacheToCanvasOn:!1,_cacheToCanvasCmds:{},_cacheInstanceIds:[],_currentID:0,_clearColor:cc.color(),_clearFillStyle:"rgb(0, 0, 0)",_dirtyRegion:null,_allNeedDraw:!0,_enableDirtyRegion:!1,_debugDirtyRegion:!1,_canUseDirtyRegion:!1,_dirtyRegionCountThreshold:10,getRenderCmd:function(a){return a._createRenderCmd()},enableDirtyRegion:function(a){this._enableDirtyRegion=a},isDirtyRegionEnabled:function(){return this._enableDirtyRegion},
setDirtyRegionCountThreshold:function(a){this._dirtyRegionCountThreshold=a},_collectDirtyRegion:function(){var a=this._renderCmds,b,c,d=this._dirtyRegion,e=0,f=!0,h=cc.Node.CanvasRenderCmd.RegionStatus;b=0;for(c=a.length;b<c;b++){var k=a[b],m=k._oldRegion,n=k._currentRegion;k._regionFlag>h.NotDirty&&(++e,e>this._dirtyRegionCountThreshold&&(f=!1),f&&(!n.isEmpty()&&d.addRegion(n),k._regionFlag>h.Dirty&&!m.isEmpty()&&d.addRegion(m)),k._regionFlag=h.NotDirty)}return f},_beginDrawDirtyRegion:function(a){var b=
a.getContext(),c=this._dirtyRegion.getDirtyRegions();b.save();a.setTransform({a:1,b:0,c:0,d:1,tx:0,ty:0},a._scaleX,a._scaleY);b.beginPath();a=0;for(var d=c.length;a<d;++a){var e=c[a];b.rect(e._minX,-e._maxY,e._width,e._height)}b.clip()},_endDrawDirtyRegion:function(a){a.restore()},_debugDrawDirtyRegion:function(a){if(this._debugDirtyRegion){var b=a.getContext(),c=this._dirtyRegion.getDirtyRegions();a.setTransform({a:1,b:0,c:0,d:1,tx:0,ty:0},a._scaleX,a._scaleY);b.beginPath();a=0;for(var d=c.length;a<
d;++a){var e=c[a];b.rect(e._minX,-e._maxY,e._width,e._height)}c=b.fillStyle;b.fillStyle="green";b.fill();b.fillStyle=c}},rendering:function(a){var b=this._dirtyRegion=this._dirtyRegion||new cc.DirtyRegion,c=cc._canvas;a=a||cc._renderContext;var d=a.getContext(),e=cc.view.getScaleX(),f=cc.view.getScaleY();a.setViewScale(e,f);a.computeRealOffsetY();var h=this._dirtyRegion.getDirtyRegions(),k=this._renderCmds,m,n=this._allNeedDraw||!this._enableDirtyRegion||!this._canUseDirtyRegion;m=!0;n||(m=this._collectDirtyRegion());
(n=n||!m)||this._beginDrawDirtyRegion(a);d.setTransform(1,0,0,1,0,0);d.clearRect(0,0,c.width,c.height);if(255!==this._clearColor.r||255!==this._clearColor.g||255!==this._clearColor.b)a.setFillStyle(this._clearFillStyle),a.setGlobalAlpha(this._clearColor.a),d.fillRect(0,0,c.width,c.height);c=0;for(m=k.length;c<m;c++){var p=k[c],r=!1,s=p._currentRegion;if(!s||n)r=!0;else for(var t=0,w=h.length;t<w;++t)if(h[t].intersects(s)){r=!0;break}r&&p.rendering(a,e,f)}n||(this._debugDrawDirtyRegion(a),this._endDrawDirtyRegion(d));
b.clear();this._allNeedDraw=!1},_renderingToCacheCanvas:function(a,b,c,d){a||cc.log("The context of RenderTexture is invalid.");c=cc.isUndefined(c)?1:c;d=cc.isUndefined(d)?1:d;b=b||this._currentID;var e,f=this._cacheToCanvasCmds[b],h;a.computeRealOffsetY();e=0;for(h=f.length;e<h;e++)f[e].rendering(a,c,d);this._removeCache(b);a=this._cacheInstanceIds;0===a.length?this._isCacheToCanvasOn=!1:this._currentID=a[a.length-1]},_turnToCacheMode:function(a){this._isCacheToCanvasOn=!0;a=a||0;this._cacheToCanvasCmds[a]=
[];-1===this._cacheInstanceIds.indexOf(a)&&this._cacheInstanceIds.push(a);this._currentID=a},_turnToNormalMode:function(){this._isCacheToCanvasOn=!1},_removeCache:function(a){a=a||this._currentID;var b=this._cacheToCanvasCmds[a];b&&(b.length=0,delete this._cacheToCanvasCmds[a]);cc.arrayRemoveObject(this._cacheInstanceIds,a)},resetFlag:function(){this.childrenOrderDirty=!1;this._transformNodePool.length=0},transform:function(){var a=this._transformNodePool;a.sort(this._sortNodeByLevelAsc);for(var b=
0,c=a.length;b<c;b++)0!==a[b]._dirtyFlag&&a[b].updateStatus();a.length=0},transformDirty:function(){return 0<this._transformNodePool.length},_sortNodeByLevelAsc:function(a,b){return a._curLevel-b._curLevel},pushDirtyNode:function(a){this._transformNodePool.push(a)},clear:function(){},clearRenderCommands:function(){this._renderCmds.length=0;this._cacheInstanceIds.length=0;this._isCacheToCanvasOn=!1;this._canUseDirtyRegion=this._allNeedDraw=!0},pushRenderCommand:function(a){if(a.needDraw())if(a._canUseDirtyRegion||
(this._canUseDirtyRegion=!1),this._isCacheToCanvasOn){var b=this._cacheToCanvasCmds[this._currentID];-1===b.indexOf(a)&&b.push(a)}else-1===this._renderCmds.indexOf(a)&&this._renderCmds.push(a)}};
(function(){cc.CanvasContextWrapper=function(a){this._context=a;this._saveCount=0;this._currentAlpha=a.globalAlpha;this._currentCompositeOperation=a.globalCompositeOperation;this._currentFillStyle=a.fillStyle;this._currentStrokeStyle=a.strokeStyle;this._offsetY=this._offsetX=0;this._realOffsetY=this.height;this._armatureMode=0};var a=cc.CanvasContextWrapper.prototype;a.resetCache=function(){var a=this._context;this._currentAlpha=a.globalAlpha;this._currentCompositeOperation=a.globalCompositeOperation;
this._currentFillStyle=a.fillStyle;this._currentStrokeStyle=a.strokeStyle;this._realOffsetY=this._context.canvas.height+this._offsetY};a.setOffset=function(a,c){this._offsetX=a;this._offsetY=c;this._realOffsetY=this._context.canvas.height+this._offsetY};a.computeRealOffsetY=function(){this._realOffsetY=this._context.canvas.height+this._offsetY};a.setViewScale=function(a,c){this._scaleX=a;this._scaleY=c};a.getContext=function(){return this._context};a.save=function(){this._context.save();this._saveCount++};
a.restore=function(){this._context.restore();this._saveCount--};a.setGlobalAlpha=function(a){0<this._saveCount?this._context.globalAlpha=a:this._currentAlpha!==a&&(this._currentAlpha=a,this._context.globalAlpha=a)};a.setCompositeOperation=function(a){0<this._saveCount?this._context.globalCompositeOperation=a:this._currentCompositeOperation!==a&&(this._currentCompositeOperation=a,this._context.globalCompositeOperation=a)};a.setFillStyle=function(a){0<this._saveCount?this._context.fillStyle=a:this._currentFillStyle!==
a&&(this._currentFillStyle=a,this._context.fillStyle=a)};a.setStrokeStyle=function(a){0<this._saveCount?this._context.strokeStyle=a:this._currentStrokeStyle!==a&&(this._currentStrokeStyle=a,this._context.strokeStyle=a)};a.setTransform=function(a,c,d){0<this._armatureMode?(this.restore(),this.save(),this._context.transform(a.a*c,-a.b*d,-a.c*c,a.d*d,a.tx*c,-(a.ty*d))):this._context.setTransform(a.a*c,-a.b*d,-a.c*c,a.d*d,this._offsetX+a.tx*c,this._realOffsetY-a.ty*d)};a._switchToArmatureMode=function(a,
c,d,e){a?(this._armatureMode++,this._context.setTransform(c.a,c.c,c.b,c.d,this._offsetX+c.tx*d,this._realOffsetY-c.ty*e),this.save()):(this._armatureMode--,this.restore())}})();cc.rendererWebGL=function(){var a={texture:null,blendSrc:null,blendDst:null,glProgramState:null},b=!1,c=null,d=null,e=0,f=0,h=0,k=null,m=0,n=null,p=null,r=null,s=0,t=!0,w={QUAD:0,TRIANGLE:1,CUSTOM:2};return{mat4Identity:null,childrenOrderDirty:!0,assignedZ:0,assignedZStep:0.01,VertexType:w,_transformNodePool:[],_renderCmds:[],_isCacheToBufferOn:!1,_cacheToBufferCmds:{},_cacheInstanceIds:[],_currentID:0,_clearColor:cc.color(0,0,0,255),init:function(){var a=cc._renderContext;a.disable(a.CULL_FACE);
a.disable(a.DEPTH_TEST);this.mat4Identity=new cc.math.Matrix4;this.mat4Identity.identity();var a=cc.BATCH_VERTEX_COUNT,b=cc._renderContext;null===c&&(d=b.createBuffer(),c=b.createBuffer());b=cc._renderContext;if(c){var f=6*Math.ceil(a/4);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c);r=new Uint16Array(f);for(var h=0,t=0;t<f;t+=6)r[t]=h+0,r[t+1]=h+1,r[t+2]=h+2,r[t+3]=h+1,r[t+4]=h+2,r[t+5]=h+3,h+=4;b.bufferData(b.ELEMENT_ARRAY_BUFFER,r,b.DYNAMIC_DRAW)}d&&(m=6*a,k=new ArrayBuffer(4*m),n=new Float32Array(k),
p=new Uint32Array(k),b.bindBuffer(b.ARRAY_BUFFER,d),b.bufferData(b.ARRAY_BUFFER,n,b.DYNAMIC_DRAW));e=a-200},getVertexSize:function(){return e},getRenderCmd:function(a){return a._createRenderCmd()},_turnToCacheMode:function(a){this._isCacheToBufferOn=!0;a=a||0;this._cacheToBufferCmds[a]?this._cacheToBufferCmds[a].length=0:this._cacheToBufferCmds[a]=[];-1===this._cacheInstanceIds.indexOf(a)&&this._cacheInstanceIds.push(a);this._currentID=a},_turnToNormalMode:function(){this._isCacheToBufferOn=!1},_removeCache:function(a){a=
a||this._currentID;var b=this._cacheToBufferCmds[a];b&&(b.length=0,delete this._cacheToBufferCmds[a]);cc.arrayRemoveObject(this._cacheInstanceIds,a)},_renderingToBuffer:function(a){a=a||this._currentID;this.rendering(cc._renderContext,this._cacheToBufferCmds[a]);this._removeCache(a);a=this._cacheInstanceIds;0===a.length?this._isCacheToBufferOn=!1:this._currentID=a[a.length-1]},resetFlag:function(){this.childrenOrderDirty&&(this.childrenOrderDirty=!1);this._transformNodePool.length=0},transform:function(){var a=
this._transformNodePool;a.sort(this._sortNodeByLevelAsc);var b,c,d;b=0;for(c=a.length;b<c;b++)d=a[b],d.updateStatus();a.length=0},transformDirty:function(){return 0<this._transformNodePool.length},_sortNodeByLevelAsc:function(a,b){return a._curLevel-b._curLevel},pushDirtyNode:function(a){this._transformNodePool.push(a)},clearRenderCommands:function(){this._renderCmds.length=0},clear:function(){var a=cc._renderContext;a.clearColor(this._clearColor.r/255,this._clearColor.g/255,this._clearColor.b/255,
this._clearColor.a/255);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT)},setDepthTest:function(a){var b=cc._renderContext;a?(b.clearDepth(1),b.enable(b.DEPTH_TEST),b.depthFunc(b.LEQUAL)):b.disable(b.DEPTH_TEST)},pushRenderCommand:function(a){if(a.rendering||a.uploadData)if(this._isCacheToBufferOn){var b=this._cacheToBufferCmds[this._currentID];-1===b.indexOf(a)&&b.push(a)}else-1===this._renderCmds.indexOf(a)&&this._renderCmds.push(a)},_increaseBatchingSize:function(a,b,c){b=b||w.QUAD;switch(b){case w.QUAD:for(b=
0;b<a;b+=4)c=f+b,r[h++]=c+0,r[h++]=c+1,r[h++]=c+2,r[h++]=c+1,r[h++]=c+2,r[h++]=c+3;break;case w.TRIANGLE:t=!1;for(b=0;b<a;b+=3)c=f+b,r[h++]=c+0,r[h++]=c+1,r[h++]=c+2;break;case w.CUSTOM:t=!1;var d=c.length;for(b=0;b<d;b++)r[h++]=f+c[b];break;default:return}f+=a},_updateBatchedInfo:function(b,c,d){return b!==a.texture||c.src!==a.blendSrc||c.dst!==a.blendDst||d!==a.glProgramState?(this._batchRendering(),a.texture=b,a.blendSrc=c.src,a.blendDst=c.dst,a.glProgramState=d,!0):!1},_breakBatch:function(){b=
!0},_uploadBufferData:function(c){f>=e&&this._batchRendering();var d=c._node,h=d._texture||d._spriteFrame&&d._spriteFrame._texture,k=d._blendFunc.src,d=d._blendFunc.dst,m=c._glProgramState;if(b||a.texture!==h||a.blendSrc!==k||a.blendDst!==d||a.glProgramState!==m)this._batchRendering(),a.texture=h,a.blendSrc=k,a.blendDst=d,a.glProgramState=m,b=!1;h=c.uploadData(n,p,6*f);0<h&&this._increaseBatchingSize(h,c.vertexType)},_batchRendering:function(){if(0!==f&&a.texture){var b=cc._renderContext,k=a.texture,
m=a.glProgramState,p=f>0.5*e;m&&(m.apply(),m.getGLProgram()._updateProjectionUniform());cc.glBlendFunc(a.blendSrc,a.blendDst);cc.glBindTexture2DN(0,k);b.bindBuffer(b.ARRAY_BUFFER,d);p?b.bufferData(b.ARRAY_BUFFER,n,b.DYNAMIC_DRAW):(k=n.subarray(0,6*f),b.bufferData(b.ARRAY_BUFFER,k,b.DYNAMIC_DRAW));b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);b.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);b.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,
3,b.FLOAT,!1,24,0);b.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,b.UNSIGNED_BYTE,!0,24,12);b.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,b.FLOAT,!1,24,16);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c);if(!s||!t||h>s)p?b.bufferData(b.ELEMENT_ARRAY_BUFFER,r,b.DYNAMIC_DRAW):b.bufferData(b.ELEMENT_ARRAY_BUFFER,r.subarray(0,h),b.DYNAMIC_DRAW);b.drawElements(b.TRIANGLES,h,b.UNSIGNED_SHORT,0);cc.g_NumberOfDraws++;t?s=h:(s=0,t=!0);h=f=0}},rendering:function(b,c){var d=c||this._renderCmds,e,h,k,m=b||cc._renderContext;
m.bindBuffer(gl.ARRAY_BUFFER,null);e=0;for(h=d.length;e<h;++e)k=d[e],k.needDraw()&&(k.uploadData?this._uploadBufferData(k):(0<f&&this._batchRendering(),k.rendering(m)));this._batchRendering();a.texture=null}}}();var Region=function(){this._area=this._height=this._width=this._maxY=this._maxX=this._minY=this._minX=0},regionProto=Region.prototype,regionPool=[];function regionCreate(){var a=regionPool.pop();a||(a=new Region);return a}function regionRelease(a){regionPool.push(a)}regionProto.setTo=function(a,b,c,d){this._minX=a;this._minY=b;this._maxX=c;this._maxY=d;this.updateArea();return this};
regionProto.intValues=function(){this._minX=Math.floor(this._minX);this._minY=Math.floor(this._minY);this._maxX=Math.ceil(this._maxX);this._maxY=Math.ceil(this._maxY);this.updateArea()};regionProto.updateArea=function(){this._width=this._maxX-this._minX;this._height=this._maxY-this._minY;this._area=this._width*this._height};
regionProto.union=function(a){0>=this._width||0>=this._height?this.setTo(a._minX,a._minY,a._maxX,a._maxY):(this._minX>a._minX&&(this._minX=a._minX),this._minY>a._minY&&(this._minY=a._minY),this._maxX<a._maxX&&(this._maxX=a._maxX),this._maxY<a._maxY&&(this._maxY=a._maxY),this.updateArea())};regionProto.setEmpty=function(){this._area=this._height=this._width=this._maxY=this._maxX=this._minY=this._minX=0};regionProto.isEmpty=function(){return 0>=this._width||0>=this._height};
regionProto.intersects=function(a){if(0>=this._width||0>=this._height||0>=a._width||0>=a._height)return!1;var b=this._minX>a._minX?this._minX:a._minX,c=this._maxX<a._maxX?this._maxX:a._maxX;if(b>c)return!1;b=this._minY>a._minY?this._minY:a._minY;c=this._maxY<a._maxY?this._maxY:a._maxY;return b<=c};
regionProto.updateRegion=function(a,b){if(0==a.width||0==a.height)this.setEmpty();else{var c=b.a,d=b.b,e=b.c,f=b.d,h=b.tx,k=b.ty,m=a.x,n=a.y,p=m+a.width,r=n+a.height,s,t,w;if(1==c&&0==d&&0==e&&1==f)s=m+h-1,t=n+k-1,w=p+h+1,n=r+k+1;else{s=c*m+e*n+h;t=d*m+f*n+k;w=c*p+e*n+h;var n=d*p+f*n+k,v=c*p+e*r+h,p=d*p+f*r+k,h=c*m+e*r+h,k=d*m+f*r+k,r=0;s>w&&(r=s,s=w,w=r);v>h&&(r=v,v=h,h=r);s=(s<v?s:v)-1;w=(w>h?w:h)+1;t>n&&(r=t,t=n,n=r);p>k&&(r=p,p=k,k=r);t=(t<p?t:p)-1;n=(n>k?n:k)+1}this._minX=s;this._minY=t;this._maxX=
w;this._maxY=n;this._width=w-s;this._height=n-t;this._area=this._width*this._height}};function unionArea(a,b){return((a._maxX>b._maxX?a._maxX:b._maxX)-(a._minX<b._minX?a._minX:b._minX))*((a._maxY>b._maxY?a._maxY:b._maxY)-(a._minY<b._minY?a._minY:b._minY))}var DirtyRegion=function(){this.dirtyList=[];this.hasClipRect=!1;this.clipArea=this.clipHeight=this.clipWidth=0;this.clipRectChanged=!1},dirtyRegionProto=DirtyRegion.prototype;
dirtyRegionProto.setClipRect=function(a,b){this.clipRectChanged=this.hasClipRect=!0;this.clipWidth=Math.ceil(a);this.clipHeight=Math.ceil(b);this.clipArea=this.clipWidth*this.clipHeight};
dirtyRegionProto.addRegion=function(a){var b=a._minX,c=a._minY,d=a._maxX;a=a._maxY;this.hasClipRect&&(0>b&&(b=0),0>c&&(c=0),d>this.clipWidth&&(d=this.clipWidth),a>this.clipHeight&&(a=this.clipHeight));if(b>=d||c>=a)return!1;if(this.clipRectChanged)return!0;var e=this.dirtyList,f=regionCreate();e.push(f.setTo(b,c,d,a));this.mergeDirtyList(e);return!0};dirtyRegionProto.clear=function(){for(var a=this.dirtyList,b=a.length,c=0;c<b;c++)regionRelease(a[c]);a.length=0};
dirtyRegionProto.getDirtyRegions=function(){var a=this.dirtyList;if(this.clipRectChanged){this.clipRectChanged=!1;this.clear();var b=regionCreate();a.push(b.setTo(0,0,this.clipWidth,this.clipHeight))}else for(;this.mergeDirtyList(a););a=this.dirtyList.length;if(0<a)for(b=0;b<a;b++)this.dirtyList[b].intValues();return this.dirtyList};
dirtyRegionProto.mergeDirtyList=function(a){var b=a.length;if(2>b)return!1;for(var c=this.hasClipRect,d=3<b?Number.POSITIVE_INFINITY:0,e=0,f=0,h=0,k=0;k<b-1;k++){var m=a[k];c&&(h+=m.area);for(var n=k+1;n<b;n++){var p=a[n],p=unionArea(m,p)-m.area-p.area;d>p&&(e=k,f=n,d=p)}}c&&0.95<h/this.clipArea&&(this.clipRectChanged=!0);return e!=f?(b=a[f],a[e].union(b),regionRelease(b),a.splice(f,1),!0):!1};cc.Region=Region;cc.DirtyRegion=DirtyRegion;cc._tmp.PrototypeCCNode=function(){var a=cc.Node.prototype;cc.defineGetterSetter(a,"x",a.getPositionX,a.setPositionX);cc.defineGetterSetter(a,"y",a.getPositionY,a.setPositionY);cc.defineGetterSetter(a,"width",a._getWidth,a._setWidth);cc.defineGetterSetter(a,"height",a._getHeight,a._setHeight);cc.defineGetterSetter(a,"anchorX",a._getAnchorX,a._setAnchorX);cc.defineGetterSetter(a,"anchorY",a._getAnchorY,a._setAnchorY);cc.defineGetterSetter(a,"skewX",a.getSkewX,a.setSkewX);cc.defineGetterSetter(a,"skewY",
a.getSkewY,a.setSkewY);cc.defineGetterSetter(a,"zIndex",a.getLocalZOrder,a.setLocalZOrder);cc.defineGetterSetter(a,"vertexZ",a.getVertexZ,a.setVertexZ);cc.defineGetterSetter(a,"rotation",a.getRotation,a.setRotation);cc.defineGetterSetter(a,"rotationX",a.getRotationX,a.setRotationX);cc.defineGetterSetter(a,"rotationY",a.getRotationY,a.setRotationY);cc.defineGetterSetter(a,"scale",a.getScale,a.setScale);cc.defineGetterSetter(a,"scaleX",a.getScaleX,a.setScaleX);cc.defineGetterSetter(a,"scaleY",a.getScaleY,
a.setScaleY);cc.defineGetterSetter(a,"children",a.getChildren);cc.defineGetterSetter(a,"childrenCount",a.getChildrenCount);cc.defineGetterSetter(a,"parent",a.getParent,a.setParent);cc.defineGetterSetter(a,"visible",a.isVisible,a.setVisible);cc.defineGetterSetter(a,"running",a.isRunning);cc.defineGetterSetter(a,"ignoreAnchor",a.isIgnoreAnchorPointForPosition,a.ignoreAnchorPointForPosition);cc.defineGetterSetter(a,"actionManager",a.getActionManager,a.setActionManager);cc.defineGetterSetter(a,"scheduler",
a.getScheduler,a.setScheduler);cc.defineGetterSetter(a,"shaderProgram",a.getShaderProgram,a.setShaderProgram);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"opacityModifyRGB",a.isOpacityModifyRGB);cc.defineGetterSetter(a,"cascadeOpacity",a.isCascadeOpacityEnabled,a.setCascadeOpacityEnabled);cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"cascadeColor",a.isCascadeColorEnabled,a.setCascadeColorEnabled)};cc.NODE_TAG_INVALID=-1;cc.s_globalOrderOfArrival=1;
cc.Node=cc.Class.extend({_localZOrder:0,_globalZOrder:0,_vertexZ:0,_customZ:NaN,_rotationX:0,_rotationY:0,_scaleX:1,_scaleY:1,_position:null,_normalizedPosition:null,_usingNormalizedPosition:!1,_normalizedPositionDirty:!1,_skewX:0,_skewY:0,_children:null,_visible:!0,_anchorPoint:null,_contentSize:null,_running:!1,_parent:null,_ignoreAnchorPointForPosition:!1,tag:cc.NODE_TAG_INVALID,userData:null,userObject:null,_reorderChildDirty:!1,arrivalOrder:0,_actionManager:null,_scheduler:null,_additionalTransformDirty:!1,
_additionalTransform:null,_componentContainer:null,_isTransitionFinished:!1,_className:"Node",_showNode:!1,_name:"",_realOpacity:255,_realColor:null,_cascadeColorEnabled:!1,_cascadeOpacityEnabled:!1,_renderCmd:null,ctor:function(){this._anchorPoint=cc.p(0,0);this._contentSize=cc.size(0,0);this._position=cc.p(0,0);this._normalizedPosition=cc.p(0,0);this._children=[];this._additionalTransform=cc.affineTransformMakeIdentity();cc.ComponentContainer&&(this._componentContainer=new cc.ComponentContainer(this));
this._realColor=cc.color(255,255,255,255);this._renderCmd=this._createRenderCmd()},init:function(){return!0},attr:function(a){for(var b in a)this[b]=a[b]},getSkewX:function(){return this._skewX},setSkewX:function(a){this._skewX=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getSkewY:function(){return this._skewY},setSkewY:function(a){this._skewY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setLocalZOrder:function(a){a!==this._localZOrder&&(this._parent?
this._parent.reorderChild(this,a):this._localZOrder=a,cc.eventManager._setDirtyForNode(this))},_setLocalZOrder:function(a){this._localZOrder=a},getLocalZOrder:function(){return this._localZOrder},getZOrder:function(){cc.log(cc._LogInfos.Node_getZOrder);return this.getLocalZOrder()},setZOrder:function(a){cc.log(cc._LogInfos.Node_setZOrder);this.setLocalZOrder(a)},setGlobalZOrder:function(a){this._globalZOrder!==a&&(this._globalZOrder=a,cc.eventManager._setDirtyForNode(this))},getGlobalZOrder:function(){return this._globalZOrder},
getVertexZ:function(){return this._vertexZ},setVertexZ:function(a){this._customZ=this._vertexZ=a},getRotation:function(){this._rotationX!==this._rotationY&&cc.log(cc._LogInfos.Node_getRotation);return this._rotationX},setRotation:function(a){this._rotationX=this._rotationY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getRotationX:function(){return this._rotationX},setRotationX:function(a){this._rotationX=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getRotationY:function(){return this._rotationY},
setRotationY:function(a){this._rotationY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScale:function(){this._scaleX!==this._scaleY&&cc.log(cc._LogInfos.Node_getScale);return this._scaleX},setScale:function(a,b){this._scaleX=a;this._scaleY=b||0===b?b:a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleX:function(){return this._scaleX},setScaleX:function(a){this._scaleX=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleY:function(){return this._scaleY},
setScaleY:function(a){this._scaleY=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setPosition:function(a,b){var c=this._position;if(void 0===b){if(c.x===a.x&&c.y===a.y)return;c.x=a.x;c.y=a.y}else{if(c.x===a&&c.y===b)return;c.x=a;c.y=b}this._usingNormalizedPosition=!1;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setNormalizedPosition:function(a,b){var c=this._normalizedPosition;void 0===b?(c.x=a.x,c.y=a.y):(c.x=a,c.y=b);this._normalizedPositionDirty=this._usingNormalizedPosition=
!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPosition:function(){return cc.p(this._position)},getNormalizedPosition:function(){return cc.p(this._normalizedPosition)},getPositionX:function(){return this._position.x},setPositionX:function(a){this._position.x=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionY:function(){return this._position.y},setPositionY:function(a){this._position.y=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},
getChildrenCount:function(){return this._children.length},getChildren:function(){return this._children},isVisible:function(){return this._visible},setVisible:function(a){this._visible!==a&&(this._visible=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty),cc.renderer.childrenOrderDirty=!0)},getAnchorPoint:function(){return cc.p(this._anchorPoint)},setAnchorPoint:function(a,b){var c=this._anchorPoint;if(void 0===b){if(a.x===c.x&&a.y===c.y)return;c.x=a.x;c.y=a.y}else{if(a===c.x&&b===
c.y)return;c.x=a;c.y=b}this._renderCmd._updateAnchorPointInPoint()},_getAnchorX:function(){return this._anchorPoint.x},_setAnchorX:function(a){this._anchorPoint.x!==a&&(this._anchorPoint.x=a,this._renderCmd._updateAnchorPointInPoint())},_getAnchorY:function(){return this._anchorPoint.y},_setAnchorY:function(a){this._anchorPoint.y!==a&&(this._anchorPoint.y=a,this._renderCmd._updateAnchorPointInPoint())},getAnchorPointInPoints:function(){return this._renderCmd.getAnchorPointInPoints()},_getWidth:function(){return this._contentSize.width},
_setWidth:function(a){this._contentSize.width=a;this._renderCmd._updateAnchorPointInPoint()},_getHeight:function(){return this._contentSize.height},_setHeight:function(a){this._contentSize.height=a;this._renderCmd._updateAnchorPointInPoint()},getContentSize:function(){return cc.size(this._contentSize)},setContentSize:function(a,b){var c=this._contentSize;if(void 0===b){if(a.width===c.width&&a.height===c.height)return;c.width=a.width;c.height=a.height}else{if(a===c.width&&b===c.height)return;c.width=
a;c.height=b}this._renderCmd._updateAnchorPointInPoint()},isRunning:function(){return this._running},getParent:function(){return this._parent},setParent:function(a){this._parent=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},isIgnoreAnchorPointForPosition:function(){return this._ignoreAnchorPointForPosition},ignoreAnchorPointForPosition:function(a){a!==this._ignoreAnchorPointForPosition&&(this._ignoreAnchorPointForPosition=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty))},
getTag:function(){return this.tag},setTag:function(a){this.tag=a},setName:function(a){this._name=a},getName:function(){return this._name},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.arrivalOrder},setOrderOfArrival:function(a){this.arrivalOrder=a},getActionManager:function(){return this._actionManager||
cc.director.getActionManager()},setActionManager:function(a){this._actionManager!==a&&(this.stopAllActions(),this._actionManager=a)},getScheduler:function(){return this._scheduler||cc.director.getScheduler()},setScheduler:function(a){this._scheduler!==a&&(this.unscheduleAllCallbacks(),this._scheduler=a)},boundingBox:function(){cc.log(cc._LogInfos.Node_boundingBox);return this.getBoundingBox()},getBoundingBox:function(){var a=cc.rect(0,0,this._contentSize.width,this._contentSize.height);return cc._rectApplyAffineTransformIn(a,
this.getNodeToParentTransform())},cleanup:function(){this.stopAllActions();this.unscheduleAllCallbacks();cc.eventManager.removeListeners(this)},getChildByTag:function(a){var b=this._children;if(null!==b)for(var c=0;c<b.length;c++){var d=b[c];if(d&&d.tag===a)return d}return null},getChildByName:function(a){if(!a)return cc.log("Invalid name"),null;for(var b=this._children,c=0,d=b.length;c<d;c++)if(b[c]._name===a)return b[c];return null},addChild:function(a,b,c){b=void 0===b?a._localZOrder:b;var d,e=
!1;void 0===c?d=a._name:"string"===typeof c?(d=c,c=void 0):"number"===typeof c&&(e=!0,d="");cc.assert(a,cc._LogInfos.Node_addChild_3);cc.assert(null===a._parent,"child already added. It can't be added again");this._addChildHelper(a,b,c,d,e)},_addChildHelper:function(a,b,c,d,e){this._children||(this._children=[]);this._insertChild(a,b);e?a.setTag(c):a.setName(d);a.setParent(this);a.setOrderOfArrival(cc.s_globalOrderOfArrival++);this._running&&(a._performRecursive(cc.Node._stateCallbackType.onEnter),
this._isTransitionFinished&&a._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish));a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._cascadeColorEnabled&&a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);this._cascadeOpacityEnabled&&a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},removeFromParent:function(a){this._parent&&(void 0===a&&(a=!0),this._parent.removeChild(this,a))},removeFromParentAndCleanup:function(a){cc.log(cc._LogInfos.Node_removeFromParentAndCleanup);
this.removeFromParent(a)},removeChild:function(a,b){0!==this._children.length&&(void 0===b&&(b=!0),-1<this._children.indexOf(a)&&this._detachChild(a,b),cc.renderer.childrenOrderDirty=!0)},removeChildByTag:function(a,b){a===cc.NODE_TAG_INVALID&&cc.log(cc._LogInfos.Node_removeChildByTag);var c=this.getChildByTag(a);c?this.removeChild(c,b):cc.log(cc._LogInfos.Node_removeChildByTag_2,a)},removeAllChildrenWithCleanup:function(a){this.removeAllChildren(a)},removeAllChildren:function(a){var b=this._children;
if(null!==b){void 0===a&&(a=!0);for(var c=0;c<b.length;c++){var d=b[c];d&&(this._running&&(d._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),d._performRecursive(cc.Node._stateCallbackType.onExit)),a&&d._performRecursive(cc.Node._stateCallbackType.cleanup),d.parent=null,d._renderCmd.detachFromParent())}this._children.length=0;cc.renderer.childrenOrderDirty=!0}},_detachChild:function(a,b){this._running&&(a._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),
a._performRecursive(cc.Node._stateCallbackType.onExit));b&&a._performRecursive(cc.Node._stateCallbackType.cleanup);a.parent=null;a._renderCmd.detachFromParent();cc.arrayRemoveObject(this._children,a)},_insertChild:function(a,b){cc.renderer.childrenOrderDirty=this._reorderChildDirty=!0;this._children.push(a);a._setLocalZOrder(b)},setNodeDirty:function(){this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},reorderChild:function(a,b){cc.assert(a,cc._LogInfos.Node_reorderChild);-1===this._children.indexOf(a)?
cc.log(cc._LogInfos.Node_reorderChild_2):(cc.renderer.childrenOrderDirty=this._reorderChildDirty=!0,a.arrivalOrder=cc.s_globalOrderOfArrival,cc.s_globalOrderOfArrival++,a._setLocalZOrder(b),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.orderDirty))},sortAllChildren:function(){if(this._reorderChildDirty){var a=this._children,b=a.length,c,d,e;for(c=1;c<b;c++){e=a[c];for(d=c-1;0<=d;){if(e._localZOrder<a[d]._localZOrder)a[d+1]=a[d];else if(e._localZOrder===a[d]._localZOrder&&e.arrivalOrder<a[d].arrivalOrder)a[d+
1]=a[d];else break;d--}a[d+1]=e}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.resume()},_performRecursive:function(a){var b=cc.Node._stateCallbackType;if(!(a>=b.max)){var c=0,d,e,f,h,k,m=cc.Node._performStacks[cc.Node._performing];m||(m=[],cc.Node._performStacks.push(m));m.length=0;cc.Node._performing++;for(f=m[0]=
this;f;){if((d=f._children)&&0<d.length)for(h=0,k=d.length;h<k;++h)e=d[h],m.push(e);if((d=f._protectedChildren)&&0<d.length)for(h=0,k=d.length;h<k;++h)e=d[h],m.push(e);c++;f=m[c]}for(h=m.length-1;0<=h;--h)if(f=m[h],m[h]=null,f)switch(a){case b.onEnter:f.onEnter();break;case b.onExit:f.onExit();break;case b.onEnterTransitionDidFinish:f.onEnterTransitionDidFinish();break;case b.cleanup:f.cleanup();break;case b.onExitTransitionDidStart:f.onExitTransitionDidStart()}cc.Node._performing--}},onEnterTransitionDidFinish:function(){this._isTransitionFinished=
!0},onExitTransitionDidStart:function(){},onExit:function(){this._running=!1;this.pause();this.removeAllComponents()},runAction:function(a){cc.assert(a,cc._LogInfos.Node_runAction);this.actionManager.addAction(a,this,!this._running);return a},stopAllActions:function(){this.actionManager&&this.actionManager.removeAllActionsFromTarget(this)},stopAction:function(a){this.actionManager.removeAction(a)},stopActionByTag:function(a){a===cc.ACTION_TAG_INVALID?cc.log(cc._LogInfos.Node_stopActionByTag):this.actionManager.removeActionByTag(a,
this)},getActionByTag:function(a){return a===cc.ACTION_TAG_INVALID?(cc.log(cc._LogInfos.Node_getActionByTag),null):this.actionManager.getActionByTag(a,this)},getNumberOfRunningActions:function(){return this.actionManager.numberOfRunningActionsInTarget(this)},scheduleUpdate:function(){this.scheduleUpdateWithPriority(0)},scheduleUpdateWithPriority:function(a){this.scheduler.scheduleUpdate(this,a,!this._running)},unscheduleUpdate:function(){this.scheduler.unscheduleUpdate(this)},schedule:function(a,
b,c,d,e){var f=arguments.length;"function"===typeof a?1===f?(b=0,c=cc.REPEAT_FOREVER,d=0,e=this.__instanceId):2===f?"number"===typeof b?(c=cc.REPEAT_FOREVER,d=0,e=this.__instanceId):(e=b,b=0,c=cc.REPEAT_FOREVER,d=0):3===f?("string"===typeof c?(e=c,c=cc.REPEAT_FOREVER):e=this.__instanceId,d=0):4===f&&(e=this.__instanceId):1===f?(b=0,c=cc.REPEAT_FOREVER,d=0):2===f&&(c=cc.REPEAT_FOREVER,d=0);cc.assert(a,cc._LogInfos.Node_schedule);cc.assert(0<=b,cc._LogInfos.Node_schedule_2);b=b||0;c=isNaN(c)?cc.REPEAT_FOREVER:
c;this.scheduler.schedule(a,this,b,c,d||0,!this._running,e)},scheduleOnce:function(a,b,c){void 0===c&&(c=this.__instanceId);this.schedule(a,0,0,b,c)},unschedule:function(a){a&&this.scheduler.unschedule(a,this)},unscheduleAllCallbacks:function(){this.scheduler.unscheduleAllForTarget(this)},resumeSchedulerAndActions:function(){cc.log(cc._LogInfos.Node_resumeSchedulerAndActions);this.resume()},resume:function(){this.scheduler.resumeTarget(this);this.actionManager&&this.actionManager.resumeTarget(this);
cc.eventManager.resumeTarget(this)},pauseSchedulerAndActions:function(){cc.log(cc._LogInfos.Node_pauseSchedulerAndActions);this.pause()},pause:function(){this.scheduler.pauseTarget(this);this.actionManager&&this.actionManager.pauseTarget(this);cc.eventManager.pauseTarget(this)},setAdditionalTransform:function(a){if(void 0===a)return this._additionalTransformDirty=!1;this._additionalTransform=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._additionalTransformDirty=!0},getParentToNodeTransform:function(){return this._renderCmd.getParentToNodeTransform()},
parentToNodeTransform:function(){return this.getParentToNodeTransform()},getNodeToWorldTransform:function(){for(var a=this.getNodeToParentTransform(),b=this._parent;null!==b;b=b.parent)a=cc.affineTransformConcat(a,b.getNodeToParentTransform());return a},nodeToWorldTransform:function(){return this.getNodeToWorldTransform()},getWorldToNodeTransform:function(){return cc.affineTransformInvert(this.getNodeToWorldTransform())},worldToNodeTransform:function(){return this.getWorldToNodeTransform()},convertToNodeSpace:function(a){return cc.pointApplyAffineTransform(a,
this.getWorldToNodeTransform())},convertToWorldSpace:function(a){a=a||cc.p(0,0);return cc.pointApplyAffineTransform(a,this.getNodeToWorldTransform())},convertToNodeSpaceAR:function(a){return cc.pSub(this.convertToNodeSpace(a),this._renderCmd.getAnchorPointInPoints())},convertToWorldSpaceAR:function(a){a=a||cc.p(0,0);a=cc.pAdd(a,this._renderCmd.getAnchorPointInPoints());return this.convertToWorldSpace(a)},_convertToWindowSpace:function(a){a=this.convertToWorldSpace(a);return cc.director.convertToUI(a)},
convertTouchToNodeSpace:function(a){a=a.getLocation();return this.convertToNodeSpace(a)},convertTouchToNodeSpaceAR:function(a){a=cc.director.convertToGL(a.getLocation());return this.convertToNodeSpaceAR(a)},update:function(a){this._componentContainer&&!this._componentContainer.isEmpty()&&this._componentContainer.visit(a)},updateTransform:function(){for(var a=this._children,b,c=0;c<a.length;c++)(b=a[c])&&b.updateTransform()},retain:function(){},release:function(){},getComponent:function(a){return this._componentContainer?
this._componentContainer.getComponent(a):null},addComponent:function(a){this._componentContainer&&this._componentContainer.add(a)},removeComponent:function(a){return this._componentContainer?this._componentContainer.remove(a):!1},removeAllComponents:function(){this._componentContainer&&this._componentContainer.removeAll()},grid:null,visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){a=cc.renderer;b.visit(c);var d=this._children,e=d.length,f;if(0<e){this._reorderChildDirty&&
this.sortAllChildren();for(c=0;c<e;c++)if(f=d[c],0>f._localZOrder)f.visit(this);else break;for(a.pushRenderCommand(b);c<e;c++)d[c].visit(this)}else a.pushRenderCommand(b);b._dirtyFlag=0}else b._propagateFlagsDown(c)},transform:function(a,b){this._renderCmd.transform(a,b)},nodeToParentTransform:function(){return this.getNodeToParentTransform()},getNodeToParentTransform:function(a){var b=this._renderCmd.getNodeToParentTransform();if(a)for(var b={a:b.a,b:b.b,c:b.c,d:b.d,tx:b.tx,ty:b.ty},c=this._parent;null!=
c&&c!=a;c=c.getParent())cc.affineTransformConcatIn(b,c.getNodeToParentTransform());return b},getNodeToParentAffineTransform:function(a){return this.getNodeToParentTransform(a)},getCamera:function(){return null},getGrid:function(){return this.grid},setGrid:function(a){this.grid=a},getShaderProgram:function(){return this._renderCmd.getShaderProgram()},setShaderProgram:function(a){this._renderCmd.setShaderProgram(a)},setGLProgramState:function(a){this._renderCmd.setGLProgramState(a)},getGLProgramState:function(){return this._renderCmd.getGLProgramState()},
getGLServerState:function(){return 0},setGLServerState:function(a){},getBoundingBoxToWorld:function(){var a=cc.rect(0,0,this._contentSize.width,this._contentSize.height),b=this.getNodeToWorldTransform(),a=cc.rectApplyAffineTransform(a,b);if(!this._children)return a;for(var c=this._children,d=0;d<c.length;d++){var e=c[d];e&&e._visible&&(e=e._getBoundingBoxToCurrentNode(b))&&(a=cc.rectUnion(a,e))}return a},_getBoundingBoxToCurrentNode:function(a){var b=cc.rect(0,0,this._contentSize.width,this._contentSize.height);
a=void 0===a?this.getNodeToParentTransform():cc.affineTransformConcat(this.getNodeToParentTransform(),a);b=cc.rectApplyAffineTransform(b,a);if(!this._children)return b;for(var c=this._children,d=0;d<c.length;d++){var e=c[d];e&&e._visible&&(e=e._getBoundingBoxToCurrentNode(a))&&(b=cc.rectUnion(b,e))}return b},getOpacity:function(){return this._realOpacity},getDisplayedOpacity:function(){return this._renderCmd.getDisplayedOpacity()},setOpacity:function(a){this._realOpacity=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},
updateDisplayedOpacity:function(a){this._renderCmd._updateDisplayOpacity(a)},isCascadeOpacityEnabled:function(){return this._cascadeOpacityEnabled},setCascadeOpacityEnabled:function(a){this._cascadeOpacityEnabled!==a&&(this._cascadeOpacityEnabled=a,this._renderCmd.setCascadeOpacityEnabledDirty())},getColor:function(){var a=this._realColor;return cc.color(a.r,a.g,a.b,a.a)},getDisplayedColor:function(){return this._renderCmd.getDisplayedColor()},setColor:function(a){var b=this._realColor;b.r=a.r;b.g=
a.g;b.b=a.b;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},updateDisplayedColor:function(a){this._renderCmd._updateDisplayColor(a)},isCascadeColorEnabled:function(){return this._cascadeColorEnabled},setCascadeColorEnabled:function(a){this._cascadeColorEnabled!==a&&(this._cascadeColorEnabled=a,this._renderCmd.setCascadeColorEnabledDirty())},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?
new cc.Node.CanvasRenderCmd(this):new cc.Node.WebGLRenderCmd(this)},enumerateChildren:function(a,b){cc.assert(a&&0!=a.length,"Invalid name");cc.assert(null!=b,"Invalid callback function");var c=a.length,d=0,e=c,f=!1;2<c&&"/"===a[0]&&"/"===a[1]&&(f=!0,d=2,e-=2);var h=!1;3<c&&"/"===a[c-3]&&"."===a[c-2]&&"."===a[c-1]&&(h=!0,e-=3);c=a.substr(d,e);h&&(c="[[:alnum:]]+/"+c);f?this.doEnumerateRecursive(this,c,b):this.doEnumerate(c,b)},doEnumerateRecursive:function(a,b,c){var d=!1;if(a.doEnumerate(b,c))d=
!0;else for(var e=a.getChildren(),f=e.length,h=0;h<f;h++)if(a=e[h],this.doEnumerateRecursive(a,b,c)){d=!0;break}return d},doEnumerate:function(a,b){var c=a.indexOf("/"),d=a,e=!1;-1!==c&&(d=a.substr(0,c),e=!0);for(var c=!1,f,h=this._children,k=h.length,m=0;m<k;m++)if(f=h[m],-1!==f._name.indexOf(d))if(e){if(c=f.doEnumerate(a,b))break}else if(b(f)){c=!0;break}return c}});cc.Node.create=function(){return new cc.Node};
cc.Node._stateCallbackType={onEnter:1,onExit:2,cleanup:3,onEnterTransitionDidFinish:4,onExitTransitionDidStart:5,max:6};cc.Node._performStacks=[[]];cc.Node._performing=0;cc.assert(cc.isFunction(cc._tmp.PrototypeCCNode),cc._LogInfos.MissingFile,"BaseNodesPropertyDefine.js");cc._tmp.PrototypeCCNode();delete cc._tmp.PrototypeCCNode;cc.CustomRenderCmd=function(a,b){this._needDraw=!0;this._target=a;this._callback=b};cc.CustomRenderCmd.prototype.rendering=function(a,b,c){this._callback&&this._callback.call(this._target,a,b,c)};cc.CustomRenderCmd.prototype.needDraw=function(){return this._needDraw};var dirtyFlags=cc.Node._dirtyFlags={transformDirty:1,visibleDirty:2,colorDirty:4,opacityDirty:8,cacheDirty:16,orderDirty:32,textDirty:64,gradientDirty:128,textureDirty:256,contentDirty:512,COUNT:10,all:1023},ONE_DEGREE=Math.PI/180;
function transformChildTree(a){var b=1,c,d,e,f,h,k=cc.Node._performStacks[cc.Node._performing];k||(k=[],cc.Node._performStacks.push(k));k.length=0;cc.Node._performing++;for(k[0]=a;b;)if(b--,d=k[b],k[b]=null,d){if((c=d._children)&&0<c.length)for(e=d._renderCmd,f=0,h=c.length;f<h;++f)a=c[f],k[b]=a,b++,a._renderCmd.transform(e);if((c=d._protectedChildren)&&0<c.length)for(e=d._renderCmd,f=0,h=c.length;f<h;++f)a=c[f],k[b]=a,b++,a._renderCmd.transform(e)}cc.Node._performing--}
cc.Node.RenderCmd=function(a){this._node=a;this._anchorPointInPoints={x:0,y:0};this._displayedColor=cc.color(255,255,255,255)};
cc.Node.RenderCmd.prototype={constructor:cc.Node.RenderCmd,_needDraw:!1,_dirtyFlag:1,_curLevel:-1,_displayedOpacity:255,_cascadeColorEnabledDirty:!1,_cascadeOpacityEnabledDirty:!1,_transform:null,_worldTransform:null,_inverse:null,needDraw:function(){return this._needDraw},getAnchorPointInPoints:function(){return cc.p(this._anchorPointInPoints)},getDisplayedColor:function(){var a=this._displayedColor;return cc.color(a.r,a.g,a.b,a.a)},getDisplayedOpacity:function(){return this._displayedOpacity},setCascadeColorEnabledDirty:function(){this._cascadeColorEnabledDirty=
!0;this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},setCascadeOpacityEnabledDirty:function(){this._cascadeOpacityEnabledDirty=!0;this.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},getParentToNodeTransform:function(){this._inverse||(this._inverse={a:1,b:0,c:0,d:1,tx:0,ty:0});this._dirtyFlag&cc.Node._dirtyFlags.transformDirty&&cc.affineTransformInvertOut(this.getNodeToParentTransform(),this._inverse);return this._inverse},detachFromParent:function(){},_updateAnchorPointInPoint:function(){var a=
this._anchorPointInPoints,b=this._node._contentSize,c=this._node._anchorPoint;a.x=b.width*c.x;a.y=b.height*c.y;this.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setDirtyFlag:function(a){0===this._dirtyFlag&&0!==a&&cc.renderer.pushDirtyNode(this);this._dirtyFlag|=a},getParentRenderCmd:function(){return this._node&&this._node._parent&&this._node._parent._renderCmd?this._node._parent._renderCmd:null},transform:function(a,b){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform=
{a:1,b:0,c:0,d:1,tx:0,ty:0});var c=this._node,d=a?a._worldTransform:null,e=this._transform,f=this._worldTransform;if(c._usingNormalizedPosition&&c._parent){var h=c._parent._contentSize;c._position.x=c._normalizedPosition.x*h.width;c._position.y=c._normalizedPosition.y*h.height;c._normalizedPositionDirty=!1}var k=c._rotationX||c._rotationY,m=c._skewX||c._skewY,n=c._scaleX,p=c._scaleY,h=this._anchorPointInPoints.x,r=this._anchorPointInPoints.y,s=1,t=0,w=0,v=1;if(k||m){e.tx=c._position.x;e.ty=c._position.y;
k&&(s=c._rotationX*ONE_DEGREE,w=Math.sin(s),v=Math.cos(s),c._rotationY===c._rotationX?(s=v,t=-w):(t=c._rotationY*ONE_DEGREE,s=Math.cos(t),t=-Math.sin(t)));e.a=s*=n;e.b=t*=n;e.c=w*=p;e.d=v*=p;m&&(m=Math.tan(c._skewX*ONE_DEGREE),n=Math.tan(c._skewY*ONE_DEGREE),Infinity===m&&(m=99999999),Infinity===n&&(n=99999999),e.a=s+w*n,e.b=t+v*n,e.c=w+s*m,e.d=v+t*m);if(h||r)e.tx-=e.a*h+e.c*r,e.ty-=e.b*h+e.d*r,c._ignoreAnchorPointForPosition&&(e.tx+=h,e.ty+=r);c._additionalTransformDirty&&cc.affineTransformConcatIn(e,
c._additionalTransform);d?(f.a=e.a*d.a+e.b*d.c,f.b=e.a*d.b+e.b*d.d,f.c=e.c*d.a+e.d*d.c,f.d=e.c*d.b+e.d*d.d,f.tx=d.a*e.tx+d.c*e.ty+d.tx,f.ty=d.d*e.ty+d.ty+d.b*e.tx):(f.a=e.a,f.b=e.b,f.c=e.c,f.d=e.d,f.tx=e.tx,f.ty=e.ty)}else{e.a=n;e.b=0;e.c=0;e.d=p;e.tx=c._position.x;e.ty=c._position.y;if(h||r)e.tx-=e.a*h,e.ty-=e.d*r,c._ignoreAnchorPointForPosition&&(e.tx+=h,e.ty+=r);c._additionalTransformDirty&&cc.affineTransformConcatIn(e,c._additionalTransform);d?(f.a=e.a*d.a+e.b*d.c,f.b=e.a*d.b+e.b*d.d,f.c=e.c*
d.a+e.d*d.c,f.d=e.c*d.b+e.d*d.d,f.tx=e.tx*d.a+e.ty*d.c+d.tx,f.ty=e.tx*d.b+e.ty*d.d+d.ty):(f.a=e.a,f.b=e.b,f.c=e.c,f.d=e.d,f.tx=e.tx,f.ty=e.ty)}this._updateCurrentRegions&&(this._updateCurrentRegions(),this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble));b&&transformChildTree(c);this._cacheDirty=!0},getNodeToParentTransform:function(){(!this._transform||this._dirtyFlag&cc.Node._dirtyFlags.transformDirty)&&this.transform();return this._transform},visit:function(a){var b=
this._node,c=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;isNaN(b._customZ)&&(b._vertexZ=c.assignedZ,c.assignedZ+=c.assignedZStep);this._syncStatus(a)},_updateDisplayColor:function(a){var b=this._node,c=this._displayedColor,d=b._realColor,e;this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty);if(this._cascadeColorEnabledDirty&&!b._cascadeColorEnabled){c.r=d.r;c.g=d.g;c.b=d.b;c=new cc.Color(255,255,255,255);a=b._children;b=0;for(d=
a.length;b<d;b++)(e=a[b])&&e._renderCmd&&e._renderCmd._updateDisplayColor(c);this._cascadeColorEnabledDirty=!1}else if(void 0===a&&(a=(a=b._parent)&&a._cascadeColorEnabled?a.getDisplayedColor():cc.color.WHITE),c.r=0|d.r*a.r/255,c.g=0|d.g*a.g/255,c.b=0|d.b*a.b/255,b._cascadeColorEnabled)for(a=b._children,b=0,d=a.length;b<d;b++)(e=a[b])&&e._renderCmd&&(e._renderCmd._updateDisplayColor(c),e._renderCmd._updateColor());this._dirtyFlag&=~dirtyFlags.colorDirty},_updateDisplayOpacity:function(a){var b=this._node,
c,d;this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty);if(this._cascadeOpacityEnabledDirty&&!b._cascadeOpacityEnabled){this._displayedOpacity=b._realOpacity;c=b._children;a=0;for(b=c.length;a<b;a++)(d=c[a])&&d._renderCmd&&d._renderCmd._updateDisplayOpacity(255);this._cascadeOpacityEnabledDirty=!1}else if(void 0===a&&(c=b._parent,a=255,c&&c._cascadeOpacityEnabled&&(a=c.getDisplayedOpacity())),this._displayedOpacity=b._realOpacity*a/255,b._cascadeOpacityEnabled)for(c=
b._children,a=0,b=c.length;a<b;a++)(d=c[a])&&d._renderCmd&&(d._renderCmd._updateDisplayOpacity(this._displayedOpacity),d._renderCmd._updateColor());this._dirtyFlag&=~dirtyFlags.opacityDirty},_syncDisplayColor:function(a){var b=this._node,c=this._displayedColor,d=b._realColor;void 0===a&&(a=(a=b._parent)&&a._cascadeColorEnabled?a.getDisplayedColor():cc.color.WHITE);c.r=0|d.r*a.r/255;c.g=0|d.g*a.g/255;c.b=0|d.b*a.b/255},_syncDisplayOpacity:function(a){var b=this._node;if(void 0===a){var c=b._parent;
a=255;c&&c._cascadeOpacityEnabled&&(a=c.getDisplayedOpacity())}this._displayedOpacity=b._realOpacity*a/255},_updateColor:function(){},_propagateFlagsDown:function(a){var b=this._dirtyFlag,c=a?a._node:null;c&&c._cascadeColorEnabled&&a._dirtyFlag&dirtyFlags.colorDirty&&(b|=dirtyFlags.colorDirty);c&&c._cascadeOpacityEnabled&&a._dirtyFlag&dirtyFlags.opacityDirty&&(b|=dirtyFlags.opacityDirty);a&&a._dirtyFlag&dirtyFlags.transformDirty&&(b|=dirtyFlags.transformDirty);this._dirtyFlag=b},updateStatus:function(){var a=
this._dirtyFlag,b=a&dirtyFlags.colorDirty,c=a&dirtyFlags.opacityDirty;a&dirtyFlags.contentDirty&&(this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty),this._dirtyFlag&=~dirtyFlags.contentDirty);b&&this._updateDisplayColor();c&&this._updateDisplayOpacity();(b||c)&&this._updateColor();a&dirtyFlags.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this._dirtyFlag&=~dirtyFlags.transformDirty);a&dirtyFlags.orderDirty&&(this._dirtyFlag&=~dirtyFlags.orderDirty)},
_syncStatus:function(a){var b=this._dirtyFlag,c=a?a._node:null;c&&c._cascadeColorEnabled&&a._dirtyFlag&dirtyFlags.colorDirty&&(b|=dirtyFlags.colorDirty);c&&c._cascadeOpacityEnabled&&a._dirtyFlag&dirtyFlags.opacityDirty&&(b|=dirtyFlags.opacityDirty);a&&a._dirtyFlag&dirtyFlags.transformDirty&&(b|=dirtyFlags.transformDirty);this._dirtyFlag=b;var c=b&dirtyFlags.colorDirty,d=b&dirtyFlags.opacityDirty;c&&this._syncDisplayColor();d&&this._syncDisplayOpacity();(c||d)&&this._updateColor();b&dirtyFlags.transformDirty&&
this.transform(a);b&dirtyFlags.orderDirty&&(this._dirtyFlag&=~dirtyFlags.orderDirty)},setShaderProgram:function(a){},getShaderProgram:function(){return null},getGLProgramState:function(){return null},setGLProgramState:function(a){}};cc.Node.RenderCmd.prototype.originTransform=cc.Node.RenderCmd.prototype.transform;cc.Node.RenderCmd.prototype.originUpdateStatus=cc.Node.RenderCmd.prototype.updateStatus;cc.Node.RenderCmd.prototype._originSyncStatus=cc.Node.RenderCmd.prototype._syncStatus;
(function(){cc.Node.CanvasRenderCmd=function(a){this._node=a;this._anchorPointInPoints={x:0,y:0};this._displayedColor=cc.color(255,255,255,255);this._cachedParent=null;this._cacheDirty=!1;this._currentRegion=new cc.Region;this._oldRegion=new cc.Region;this._regionFlag=0;this._canUseDirtyRegion=!1};cc.Node.CanvasRenderCmd.RegionStatus={NotDirty:0,Dirty:1,DirtyDouble:2};var a=cc.Node.CanvasRenderCmd.prototype=Object.create(cc.Node.RenderCmd.prototype);a.constructor=cc.Node.CanvasRenderCmd;a._rootCtor=
cc.Node.CanvasRenderCmd;a._notifyRegionStatus=function(a){this._needDraw&&this._regionFlag<a&&(this._regionFlag=a)};var b=new cc.Rect;a.getLocalBB=function(){var a=this._node;b.x=b.y=0;b.width=a._contentSize.width;b.height=a._contentSize.height;return b};a._updateCurrentRegions=function(){var a=this._currentRegion;this._currentRegion=this._oldRegion;this._oldRegion=a;cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble!==this._regionFlag||this._currentRegion.isEmpty()||this._oldRegion.union(this._currentRegion);
this._currentRegion.updateRegion(this.getLocalBB(),this._worldTransform)};a.setDirtyFlag=function(a,b){cc.Node.RenderCmd.prototype.setDirtyFlag.call(this,a,b);this._setCacheDirty(b);this._cachedParent&&this._cachedParent.setDirtyFlag(a,!0)};a._setCacheDirty=function(){if(!1===this._cacheDirty){this._cacheDirty=!0;var a=this._cachedParent;a&&a!==this&&a._setNodeDirtyForCache&&a._setNodeDirtyForCache()}};a._setCachedParent=function(a){if(this._cachedParent!==a){this._cachedParent=a;for(var b=this._node._children,
e=0,f=b.length;e<f;e++)b[e]._renderCmd._setCachedParent(a)}};a.detachFromParent=function(){this._cachedParent=null;for(var a=this._node._children,b,e=0,f=a.length;e<f;e++)(b=a[e])&&b._renderCmd&&b._renderCmd.detachFromParent()};cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc=function(a){return a?a.src===cc.SRC_ALPHA&&a.dst===cc.ONE||a.src===cc.ONE&&a.dst===cc.ONE?"lighter":a.src===cc.ZERO&&a.dst===cc.SRC_ALPHA?"destination-in":a.src===cc.ZERO&&a.dst===cc.ONE_MINUS_SRC_ALPHA?"destination-out":
"source-over":"source-over"}})();(function(){cc.Node.WebGLRenderCmd=function(a){this._node=a;this._anchorPointInPoints={x:0,y:0};this._displayedColor=cc.color(255,255,255,255);this._glProgramState=null};var a=cc.Node.WebGLRenderCmd.prototype=Object.create(cc.Node.RenderCmd.prototype);a.constructor=cc.Node.WebGLRenderCmd;a._rootCtor=cc.Node.WebGLRenderCmd;a._updateColor=function(){};a.setShaderProgram=function(a){this._glProgramState=cc.GLProgramState.getOrCreateWithGLProgram(a)};a.getShaderProgram=function(){return this._glProgramState?
this._glProgramState.getGLProgram():null};a.getGLProgramState=function(){return this._glProgramState};a.setGLProgramState=function(a){this._glProgramState=a};Object.defineProperty(a,"_shaderProgram",{set:function(a){this.setShaderProgram(a)},get:function(){return this.getShaderProgram()}})})();cc.AtlasNode=cc.Node.extend({textureAtlas:null,quadsToDraw:0,_itemsPerRow:0,_itemsPerColumn:0,_itemWidth:0,_itemHeight:0,_opacityModifyRGB:!1,_blendFunc:null,_ignoreContentScaleFactor:!1,_className:"AtlasNode",_texture:null,_textureForCanvas:null,ctor:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._ignoreContentScaleFactor=!1;void 0!==d&&this.initWithTileFile(a,b,c,d)},_createRenderCmd:function(){this._renderCmd=cc._renderType===cc.game.RENDER_TYPE_CANVAS?
new cc.AtlasNode.CanvasRenderCmd(this):new cc.AtlasNode.WebGLRenderCmd(this)},updateAtlasValues:function(){cc.log(cc._LogInfos.AtlasNode_updateAtlasValues)},getColor:function(){return this._opacityModifyRGB?this._renderCmd._colorUnmodified:cc.Node.prototype.getColor.call(this)},setOpacityModifyRGB:function(a){var b=this.color;this._opacityModifyRGB=a;this.setColor(b)},isOpacityModifyRGB:function(){return this._opacityModifyRGB},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,
b){this._blendFunc=void 0===b?a:{src:a,dst:b}},setTextureAtlas:function(a){this.textureAtlas=a},getTextureAtlas:function(){return this.textureAtlas},getQuadsToDraw:function(){return this.quadsToDraw},setQuadsToDraw:function(a){this.quadsToDraw=a},initWithTileFile:function(a,b,c,d){if(!a)throw Error("cc.AtlasNode.initWithTileFile(): title should not be null");a=cc.textureCache.addImage(a);return this.initWithTexture(a,b,c,d)},initWithTexture:function(a,b,c,d){return this._renderCmd.initWithTexture(a,
b,c,d)},setColor:function(a){this._renderCmd.setColor(a)},setOpacity:function(a){this._renderCmd.setOpacity(a)},getTexture:function(){return this._texture},setTexture:function(a){this._texture=a},_setIgnoreContentScaleFactor:function(a){this._ignoreContentScaleFactor=a}});_p=cc.AtlasNode.prototype;cc.defineGetterSetter(_p,"opacity",_p.getOpacity,_p.setOpacity);cc.defineGetterSetter(_p,"color",_p.getColor,_p.setColor);cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);cc.EventHelper.prototype.apply(_p);
cc.AtlasNode.create=function(a,b,c,d){return new cc.AtlasNode(a,b,c,d)};(function(){cc.AtlasNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._colorUnmodified=cc.color.WHITE;this._textureToRender=null};var a=cc.AtlasNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.AtlasNode.CanvasRenderCmd;a.initWithTexture=function(a,c,d,e){var f=this._node;f._itemWidth=c;f._itemHeight=d;f._opacityModifyRGB=!0;f._texture=a;if(!f._texture)return cc.log(cc._LogInfos.AtlasNode__initWithTexture),!1;this._textureToRender=
a;this._calculateMaxItems();f.quadsToDraw=e;return!0};a.setColor=function(a){var c=this._node._realColor;if(c.r!==a.r||c.g!==a.g||c.b!==a.b)this._colorUnmodified=a,this._changeTextureColor()};a._changeTextureColor=function(){var a=this._node._texture,c=this._colorUnmodified,d=a.getHtmlElementObj(),d=cc.rect(0,0,d.width,d.height);a===this._textureToRender?this._textureToRender=a._generateColorTexture(c.r,c.g,c.b,d):a._generateColorTexture(c.r,c.g,c.b,d,this._textureToRender.getHtmlElementObj())};a.setOpacity=
function(a){cc.Node.prototype.setOpacity.call(this._node,a)};a._calculateMaxItems=function(){var a=this._node,c=a._texture.getContentSize();a._itemsPerColumn=0|c.height/a._itemHeight;a._itemsPerRow=0|c.width/a._itemWidth}})();(function(){cc.AtlasNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._textureAtlas=null;this._colorUnmodified=cc.color.WHITE;this._uniformColor=this._colorF32Array=null;this._matrix=new cc.math.Matrix4;this._matrix.identity();this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);this._uniformColor=cc._renderContext.getUniformLocation(this._shaderProgram.getProgram(),"u_color")};var a=cc.AtlasNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);
a.constructor=cc.AtlasNode.WebGLRenderCmd;a._updateBlendFunc=function(){var a=this._node;this._textureAtlas.texture.hasPremultipliedAlpha()||(a._blendFunc.src=cc.SRC_ALPHA,a._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA)};a._updateOpacityModifyRGB=function(){this._node._opacityModifyRGB=this._textureAtlas.texture.hasPremultipliedAlpha()};a.rendering=function(a){a=a||cc._renderContext;var c=this._node,d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=
d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._glProgramState.apply(this._matrix);cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);this._uniformColor&&this._colorF32Array&&(a.uniform4fv(this._uniformColor,this._colorF32Array),this._textureAtlas.drawNumberOfQuads(c.quadsToDraw,0))};a.initWithTexture=function(a,c,d,e){var f=this._node;f._itemWidth=c;f._itemHeight=d;this._colorUnmodified=cc.color.WHITE;f._opacityModifyRGB=!0;f._blendFunc.src=cc.BLEND_SRC;f._blendFunc.dst=cc.BLEND_DST;c=
f._realColor;this._colorF32Array=new Float32Array([c.r/255,c.g/255,c.b/255,f._realOpacity/255]);this._textureAtlas=new cc.TextureAtlas;this._textureAtlas.initWithTexture(a,e);if(!this._textureAtlas)return cc.log(cc._LogInfos.AtlasNode__initWithTexture),!1;this._updateBlendFunc();this._updateOpacityModifyRGB();this._calculateMaxItems();f.quadsToDraw=e;return!0};a.setColor=function(a){var c=cc.color(a.r,a.g,a.b),d=this._node;this._colorUnmodified=a;a=this._displayedOpacity;d._opacityModifyRGB&&(c.r=
c.r*a/255,c.g=c.g*a/255,c.b=c.b*a/255);cc.Node.prototype.setColor.call(d,c)};a.setOpacity=function(a){var c=this._node;cc.Node.prototype.setOpacity.call(c,a);c._opacityModifyRGB&&(c.color=this._colorUnmodified)};a._updateColor=function(){if(this._colorF32Array){var a=this._displayedColor;this._colorF32Array[0]=a.r/255;this._colorF32Array[1]=a.g/255;this._colorF32Array[2]=a.b/255;this._colorF32Array[3]=this._displayedOpacity/255}};a.getTexture=function(){return this._textureAtlas.texture};a.setTexture=
function(a){this._textureAtlas.texture=a;this._updateBlendFunc();this._updateOpacityModifyRGB()};a._calculateMaxItems=function(){var a=this._node,c=this._textureAtlas.texture,d=c.getContentSize();a._ignoreContentScaleFactor&&(d=c.getContentSizeInPixels());a._itemsPerColumn=0|d.height/a._itemHeight;a._itemsPerRow=0|d.width/a._itemWidth}})();cc._tmp.WebGLTexture2D=function(){cc.Texture2D=cc.Class.extend({_pVRHaveAlphaPremultiplied:!0,_pixelFormat:null,_pixelsWide:0,_pixelsHigh:0,_name:"",_contentSize:null,maxS:0,maxT:0,_hasPremultipliedAlpha:!1,_hasMipmaps:!1,shaderProgram:null,_textureLoaded:!1,_htmlElementObj:null,_webTextureObj:null,url:null,ctor:function(){this._contentSize=cc.size(0,0);this._pixelFormat=cc.Texture2D.defaultPixelFormat},releaseTexture:function(){this._webTextureObj&&cc._renderContext.deleteTexture(this._webTextureObj);
this._htmlElementObj=null;cc.loader.release(this.url)},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.contentScaleFactor(),this._contentSize.height/cc.contentScaleFactor())},_getWidth:function(){return this._contentSize.width/cc.contentScaleFactor()},_getHeight:function(){return this._contentSize.height/
cc.contentScaleFactor()},getContentSizeInPixels:function(){return 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,b){return a},initWithData:function(a,b,c,d,e){var f=cc.Texture2D,h=cc._renderContext,k=h.RGBA,m=h.UNSIGNED_BYTE,n=c*cc.Texture2D._B[b]/8;0===n%8?h.pixelStorei(h.UNPACK_ALIGNMENT,8):0===n%4?h.pixelStorei(h.UNPACK_ALIGNMENT,4):0===n%2?h.pixelStorei(h.UNPACK_ALIGNMENT,2):h.pixelStorei(h.UNPACK_ALIGNMENT,1);this._webTextureObj=
h.createTexture();cc.glBindTexture2D(this);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);switch(b){case f.PIXEL_FORMAT_RGBA8888:k=h.RGBA;break;case f.PIXEL_FORMAT_RGB888:k=h.RGB;break;case f.PIXEL_FORMAT_RGBA4444:m=h.UNSIGNED_SHORT_4_4_4_4;break;case f.PIXEL_FORMAT_RGB5A1:m=h.UNSIGNED_SHORT_5_5_5_1;break;
case f.PIXEL_FORMAT_RGB565:m=h.UNSIGNED_SHORT_5_6_5;break;case f.PIXEL_FORMAT_AI88:k=h.LUMINANCE_ALPHA;break;case f.PIXEL_FORMAT_A8:k=h.ALPHA;break;case f.PIXEL_FORMAT_I8:k=h.LUMINANCE;break;default:cc.assert(0,cc._LogInfos.Texture2D_initWithData)}h.texImage2D(h.TEXTURE_2D,0,k,c,d,0,k,m,a);this._contentSize.width=e.width;this._contentSize.height=e.height;this._pixelsWide=c;this._pixelsHigh=d;this._pixelFormat=b;this.maxS=e.width/c;this.maxT=e.height/d;this._hasMipmaps=this._hasPremultipliedAlpha=
!1;this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE);return this._textureLoaded=!0},drawAtPoint:function(a){var b=[0,this.maxT,this.maxS,this.maxT,0,0,this.maxS,0],c=cc._renderContext,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];this._glProgramState.apply();this._glProgramState._glprogram.setUniformsForBuiltins();cc.glBindTexture2D(this);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);
c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,a);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,c.FLOAT,!1,0,b);c.drawArrays(c.TRIANGLE_STRIP,0,4)},drawInRect:function(a){var b=[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];this._glProgramState.apply();this._glProgramState._glprogram.setUniformsForBuiltins();cc.glBindTexture2D(this);var c=cc._renderContext;c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);
c.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,a);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,c.FLOAT,!1,0,b);c.drawArrays(c.TRIANGLE_STRIP,0,4)},initWithImage:function(a){if(null==a)return cc.log(cc._LogInfos.Texture2D_initWithImage),!1;var b=a.getWidth(),c=a.getHeight(),d=cc.configuration.getMaxTextureSize();if(b>d||c>d)return cc.log(cc._LogInfos.Texture2D_initWithImage_2,b,c,d,d),!1;this._textureLoaded=!0;return this._initPremultipliedATextureWithImage(a,
b,c)},initWithElement:function(a){a&&(this._webTextureObj=cc._renderContext.createTexture(),this._htmlElementObj=a,this._hasPremultipliedAlpha=this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(a){a=void 0!==a?a:this._hasPremultipliedAlpha;if(cc.game._rendererInitialized&&this._htmlElementObj&&this._htmlElementObj.width&&this._htmlElementObj.height){var b=cc._renderContext;cc.glBindTexture2D(this);
b.pixelStorei(b.UNPACK_ALIGNMENT,4);a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,this._htmlElementObj);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE);cc.glBindTexture2D(null);
a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);b=this._htmlElementObj.height;this._pixelsWide=this._contentSize.width=this._htmlElementObj.width;this._pixelsHigh=this._contentSize.height=b;this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888;this.maxT=this.maxS=1;this._hasPremultipliedAlpha=a;this._hasMipmaps=!1;window.ENABLE_IMAEG_POOL&&(this._htmlElementObj=null);this.dispatchEvent("load")}},initWithString:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithString);return null},initWithETCFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithETCFile_2);
return!1},initWithPVRFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithPVRFile_2);return!1},initWithPVRTCData:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData_2);return!1},setTexParameters:function(a,b,c,d){var e=cc._renderContext;void 0!==b&&(a={minFilter:a,magFilter:b,wrapS:c,wrapT:d});cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh)||a.wrapS===e.CLAMP_TO_EDGE&&a.wrapT===e.CLAMP_TO_EDGE,"WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures");
cc.glBindTexture2D(this);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a.minFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,a.magFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,a.wrapS);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,a.wrapT)},setAntiAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,
a.TEXTURE_MAG_FILTER,a.LINEAR)},setAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)},generateMipmap:function(){cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh),"Mimpap texture only works in POT textures");
cc.glBindTexture2D(this);cc._renderContext.generateMipmap(cc._renderContext.TEXTURE_2D);this._hasMipmaps=!0},stringForFormat:function(){return cc.Texture2D._M[this._pixelFormat]},bitsPerPixelForFormat:function(a){a=a||this._pixelFormat;var b=cc.Texture2D._B[a];if(null!=b)return b;cc.log(cc._LogInfos.Texture2D_bitsPerPixelForFormat,a);return-1},_initPremultipliedATextureWithImage:function(a,b,c){var d=cc.Texture2D,e=a.getData(),f=null,f=null,h=a.hasAlpha(),k=cc.size(a.getWidth(),a.getHeight()),m=d.defaultPixelFormat,
n=a.getBitsPerComponent();h||(8<=n?m=d.PIXEL_FORMAT_RGB888:(cc.log(cc._LogInfos.Texture2D__initPremultipliedATextureWithImage),m=d.PIXEL_FORMAT_RGB565));var p=b*c;if(m===d.PIXEL_FORMAT_RGB565)if(h)for(e=new Uint16Array(b*c),f=a.getData(),n=0;n<p;++n)e[n]=(f[n]>>0&255)>>3<<11|(f[n]>>8&255)>>2<<5|(f[n]>>16&255)>>3<<0;else for(e=new Uint16Array(b*c),f=a.getData(),n=0;n<p;++n)e[n]=(f[n]&255)>>3<<11|(f[n]&255)>>2<<5|(f[n]&255)>>3<<0;else if(m===d.PIXEL_FORMAT_RGBA4444)for(e=new Uint16Array(b*c),f=a.getData(),
n=0;n<p;++n)e[n]=(f[n]>>0&255)>>4<<12|(f[n]>>8&255)>>4<<8|(f[n]>>16&255)>>4<<4|(f[n]>>24&255)>>4<<0;else if(m===d.PIXEL_FORMAT_RGB5A1)for(e=new Uint16Array(b*c),f=a.getData(),n=0;n<p;++n)e[n]=(f[n]>>0&255)>>3<<11|(f[n]>>8&255)>>3<<6|(f[n]>>16&255)>>3<<1|(f[n]>>24&255)>>7<<0;else if(m===d.PIXEL_FORMAT_A8)for(e=new Uint8Array(b*c),f=a.getData(),n=0;n<p;++n)e[n]=f>>24&255;if(h&&m===d.PIXEL_FORMAT_RGB888)for(f=a.getData(),e=new Uint8Array(b*c*3),n=0;n<p;++n)e[3*n]=f>>0&255,e[3*n+1]=f>>8&255,e[3*n+2]=
f>>16&255;this.initWithData(e,m,b,c,k);a.getData();this._hasPremultipliedAlpha=a.isPremultipliedAlpha();return!0},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},removeLoadedEventListener:function(a){this.removeEventTarget("load",a)}})};
cc._tmp.WebGLTextureAtlas=function(){var a=cc.TextureAtlas.prototype;a._setupVBO=function(){var a=cc._renderContext;this._buffersVBO[0]=a.createBuffer();this._buffersVBO[1]=a.createBuffer();this._quadsWebBuffer=a.createBuffer();this._mapBuffers()};a._mapBuffers=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._quadsWebBuffer);a.bufferData(a.ARRAY_BUFFER,this._quadsArrayBuffer,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);a.bufferData(a.ELEMENT_ARRAY_BUFFER,
this._indices,a.STATIC_DRAW)};a.drawNumberOfQuads=function(a,c){c=c||0;if(0!==a&&this.texture&&this.texture.isLoaded()){var d=cc._renderContext;cc.glBindTexture2D(this.texture);d.bindBuffer(d.ARRAY_BUFFER,this._quadsWebBuffer);this.dirty&&(d.bufferData(d.ARRAY_BUFFER,this._quadsArrayBuffer,d.DYNAMIC_DRAW),this.dirty=!1);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,
3,d.FLOAT,!1,24,0);d.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,d.UNSIGNED_BYTE,!0,24,12);d.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,d.FLOAT,!1,24,16);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP?d.drawElements(d.TRIANGLE_STRIP,6*a,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT):d.drawElements(d.TRIANGLES,6*a,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT);cc.g_NumberOfDraws++}}};
cc._tmp.WebGLTextureCache=function(){var a=cc.textureCache;a.handleLoadedTexture=function(a,c){var d=this._textures,e;cc.game._rendererInitialized||(d=this._loadedTexturesBefore);e=d[a];e||(e=d[a]=new cc.Texture2D,e.url=a);e.initWithElement(c);".png"===cc.path.extname(a)?e.handleLoadedTexture(!0):e.handleLoadedTexture();return e};a.addImage=function(a,c,d){cc.assert(a,cc._LogInfos.Texture2D_addImage_2);var e=this._textures;cc.game._rendererInitialized||(e=this._loadedTexturesBefore);var f=e[a]||e[cc.loader._getAliase(a)];
if(f)return f.isLoaded()?c&&c.call(d,f):f.addEventListener("load",function(){c&&c.call(d,f)},d),f;f=e[a]=new cc.Texture2D;f.url=a;e=cc.loader.getBasePath?cc.loader.getBasePath():cc.loader.resPath;cc.loader.loadImg(cc.path.join(e||"",a),function(e,f){if(e)return c&&c.call(d,e);var m=cc.textureCache.handleLoadedTexture(a,f);c&&c.call(d,m)});return f};a.addImageAsync=a.addImage;a=null};cc._tmp.PrototypeTexture2D=function(){var a=cc.Texture2D;a.PVRImagesHavePremultipliedAlpha=function(a){cc.PVRHaveAlphaPremultiplied_=a};a.PIXEL_FORMAT_RGBA8888=2;a.PIXEL_FORMAT_RGB888=3;a.PIXEL_FORMAT_RGB565=4;a.PIXEL_FORMAT_A8=5;a.PIXEL_FORMAT_I8=6;a.PIXEL_FORMAT_AI88=7;a.PIXEL_FORMAT_RGBA4444=8;a.PIXEL_FORMAT_RGB5A1=7;a.PIXEL_FORMAT_PVRTC4=9;a.PIXEL_FORMAT_PVRTC2=10;a.PIXEL_FORMAT_DEFAULT=a.PIXEL_FORMAT_RGBA8888;a.defaultPixelFormat=a.PIXEL_FORMAT_DEFAULT;var b=cc.Texture2D._M={};b[a.PIXEL_FORMAT_RGBA8888]=
"RGBA8888";b[a.PIXEL_FORMAT_RGB888]="RGB888";b[a.PIXEL_FORMAT_RGB565]="RGB565";b[a.PIXEL_FORMAT_A8]="A8";b[a.PIXEL_FORMAT_I8]="I8";b[a.PIXEL_FORMAT_AI88]="AI88";b[a.PIXEL_FORMAT_RGBA4444]="RGBA4444";b[a.PIXEL_FORMAT_RGB5A1]="RGB5A1";b[a.PIXEL_FORMAT_PVRTC4]="PVRTC4";b[a.PIXEL_FORMAT_PVRTC2]="PVRTC2";b=cc.Texture2D._B={};b[a.PIXEL_FORMAT_RGBA8888]=32;b[a.PIXEL_FORMAT_RGB888]=24;b[a.PIXEL_FORMAT_RGB565]=16;b[a.PIXEL_FORMAT_A8]=8;b[a.PIXEL_FORMAT_I8]=8;b[a.PIXEL_FORMAT_AI88]=16;b[a.PIXEL_FORMAT_RGBA4444]=
16;b[a.PIXEL_FORMAT_RGB5A1]=16;b[a.PIXEL_FORMAT_PVRTC4]=4;b[a.PIXEL_FORMAT_PVRTC2]=3;a=cc.Texture2D.prototype;cc.defineGetterSetter(a,"name",a.getName);cc.defineGetterSetter(a,"pixelFormat",a.getPixelFormat);cc.defineGetterSetter(a,"pixelsWidth",a.getPixelsWide);cc.defineGetterSetter(a,"pixelsHeight",a.getPixelsHigh);cc.defineGetterSetter(a,"width",a._getWidth);cc.defineGetterSetter(a,"height",a._getHeight)};
cc._tmp.PrototypeTextureAtlas=function(){var a=cc.TextureAtlas.prototype;cc.defineGetterSetter(a,"totalQuads",a.getTotalQuads);cc.defineGetterSetter(a,"capacity",a.getCapacity);cc.defineGetterSetter(a,"quads",a.getQuads,a.setQuads)};cc.ALIGN_CENTER=51;cc.ALIGN_TOP=19;cc.ALIGN_TOP_RIGHT=18;cc.ALIGN_RIGHT=50;cc.ALIGN_BOTTOM_RIGHT=34;cc.ALIGN_BOTTOM=35;cc.ALIGN_BOTTOM_LEFT=33;cc.ALIGN_LEFT=49;cc.ALIGN_TOP_LEFT=17;cc.PVRHaveAlphaPremultiplied_=!1;
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a={_contentSize:null,_textureLoaded:!1,_htmlElementObj:null,url:null,_pattern:null,ctor:function(){this._contentSize=cc.size(0,0);this._textureLoaded=!1;this._htmlElementObj=null;this._pattern="";this._pixelsHigh=this._pixelsWide=0},getPixelsWide:function(){return this._pixelsWide},getPixelsHigh:function(){return this._pixelsHigh},getContentSize:function(){var a=cc.contentScaleFactor();
return cc.size(this._contentSize.width/a,this._contentSize.height/a)},_getWidth:function(){return this._contentSize.width/cc.contentScaleFactor()},_getHeight:function(){return this._contentSize.height/cc.contentScaleFactor()},getContentSizeInPixels:function(){return this._contentSize},initWithElement:function(a){a&&(this._htmlElementObj=a,this._pixelsWide=this._contentSize.width=a.width,this._pixelsHigh=this._contentSize.height=a.height,this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj},
isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(){if(this._htmlElementObj){var a=this._htmlElementObj;this._pixelsWide=this._contentSize.width=a.width;this._pixelsHigh=this._contentSize.height=a.height;this.dispatchEvent("load")}},description:function(){return"\x3ccc.Texture2D | width \x3d "+this._contentSize.width+" height "+this._contentSize.height+"\x3e"},initWithData:function(a,c,d,e,f){return!1},initWithImage:function(a){return!1},initWithString:function(a,c,d,e,
f,h){return!1},releaseTexture:function(){this._htmlElementObj=null;cc.loader.release(this.url)},getName:function(){return null},getMaxS:function(){return 1},setMaxS:function(a){},getMaxT:function(){return 1},setMaxT:function(a){},getPixelFormat:function(){return null},getShaderProgram:function(){return null},setShaderProgram:function(a){},hasPremultipliedAlpha:function(){return!1},hasMipmaps:function(){return!1},releaseData:function(a){},keepData:function(a,c){return a},drawAtPoint:function(a){},
drawInRect:function(a){},initWithETCFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithETCFile);return!1},initWithPVRFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithPVRFile);return!1},initWithPVRTCData:function(a,c,d,e,f,h){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData);return!1},setTexParameters:function(a,c,d,e){void 0!==c&&(a={minFilter:a,magFilter:c,wrapS:d,wrapT:e});this._pattern=a.wrapS===cc.REPEAT&&a.wrapT===cc.REPEAT?"repeat":a.wrapS===cc.REPEAT?"repeat-x":a.wrapT===cc.REPEAT?
"repeat-y":""},setAntiAliasTexParameters:function(){},setAliasTexParameters:function(){},generateMipmap:function(){},stringForFormat:function(){return""},bitsPerPixelForFormat:function(a){return-1},addLoadedEventListener:function(a,c){this.addEventListener("load",a,c)},removeLoadedEventListener:function(a){this.removeEventTarget("load",a)},_generateColorTexture:function(){},_generateTextureCacheForColor:function(){if(this.channelCache)return this.channelCache;var a=[document.createElement("canvas"),
document.createElement("canvas"),document.createElement("canvas"),document.createElement("canvas")],c=this._htmlElementObj,d=c.width,e=c.height;a[0].width=d;a[0].height=e;a[1].width=d;a[1].height=e;a[2].width=d;a[2].height=e;a[3].width=d;a[3].height=e;var f=a[3].getContext("2d");f.drawImage(c,0,0);for(var f=f.getImageData(0,0,d,e).data,h,k=0;4>k;k++){h=a[k].getContext("2d");for(var m=h.getImageData(0,0,d,e),n=m.data,p=0;p<f.length;p+=4)n[p]=0===k?f[p]:0,n[p+1]=1===k?f[p+1]:0,n[p+2]=2===k?f[p+2]:0,
n[p+3]=f[p+3];h.putImageData(m,0,0)}c.onload=null;return this.channelCache=a},_grayElementObj:null,_backupElement:null,_isGray:!1,_switchToGray:function(a){this._textureLoaded&&this._isGray!==a&&((this._isGray=a)?(this._backupElement=this._htmlElementObj,this._grayElementObj||(this._grayElementObj=cc.Texture2D._generateGrayTexture(this._htmlElementObj)),this._htmlElementObj=this._grayElementObj):null!==this._backupElement&&(this._htmlElementObj=this._backupElement))},_generateGrayTexture:function(){if(!this._textureLoaded)return null;
var a=cc.Texture2D._generateGrayTexture(this._htmlElementObj),c=new cc.Texture2D;c.initWithElement(a);c.handleLoadedTexture();return c}};a._generateColorTexture=cc.sys._supportCanvasNewBlendModes?function(a,c,d,e,f){var h=!1;f?h=!0:f=document.createElement("canvas");var k=this._htmlElementObj;e||(e=cc.rect(0,0,k.width,k.height));f.width=e.width;f.height=e.height;var m=f.getContext("2d");m.globalCompositeOperation="source-over";m.fillStyle="rgb("+(a|0)+","+(c|0)+","+(d|0)+")";m.fillRect(0,0,e.width,
e.height);m.globalCompositeOperation="multiply";m.drawImage(k,e.x,e.y,e.width,e.height,0,0,e.width,e.height);m.globalCompositeOperation="destination-atop";m.drawImage(k,e.x,e.y,e.width,e.height,0,0,e.width,e.height);if(h)return f;a=new cc.Texture2D;a.initWithElement(f);a.handleLoadedTexture();return a}:function(a,c,d,e,f){var h=!1;f?h=!0:f=document.createElement("canvas");var k=this._htmlElementObj;e||(e=cc.rect(0,0,k.width,k.height));var m,n,k=e.x;m=e.y;n=e.width;e=e.height;if(n&&e){f.width=n;f.height=
e;var p=f.getContext("2d"),r=cc.textureCache.getTextureColors(this);p.globalCompositeOperation="lighter";p.drawImage(r[3],k,m,n,e,0,0,n,e);0<a&&(p.globalAlpha=a/255,p.drawImage(r[0],k,m,n,e,0,0,n,e));0<c&&(p.globalAlpha=c/255,p.drawImage(r[1],k,m,n,e,0,0,n,e));0<d&&(p.globalAlpha=d/255,p.drawImage(r[2],k,m,n,e,0,0,n,e));if(h)return f;a=new cc.Texture2D;a.initWithElement(f);a.handleLoadedTexture();return a}};cc.Texture2D=cc.Class.extend(a);cc.Texture2D._generateGrayTexture=function(a,c,d){if(null===
a)return null;d=d||document.createElement("canvas");c=c||cc.rect(0,0,a.width,a.height);d.width=c.width;d.height=c.height;var e=d.getContext("2d");e.drawImage(a,c.x,c.y,c.width,c.height,0,0,c.width,c.height);a=e.getImageData(0,0,c.width,c.height);c=a.data;for(var f=0,h=c.length;f<h;f+=4)c[f]=c[f+1]=c[f+2]=0.34*c[f]+0.5*c[f+1]+0.16*c[f+2];e.putImageData(a,0,0);return d}}else cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc.assert(cc.isFunction(cc._tmp.WebGLTexture2D),cc._LogInfos.MissingFile,"TexturesWebGL.js"),
cc._tmp.WebGLTexture2D(),delete cc._tmp.WebGLTexture2D);cc.EventHelper.prototype.apply(cc.Texture2D.prototype);cc.assert(cc.isFunction(cc._tmp.PrototypeTexture2D),cc._LogInfos.MissingFile,"TexturesPropertyDefine.js");cc._tmp.PrototypeTexture2D();delete cc._tmp.PrototypeTexture2D});cc.textureCache={_textures:{},_textureColorsCache:{},_textureKeySeq:0|1E3*Math.random(),_loadedTexturesBefore:{},_initializingRenderer:function(){var a,b=this._loadedTexturesBefore,c=this._textures;for(a in b){var d=b[a];d.handleLoadedTexture();c[a]=d}this._loadedTexturesBefore={}},addPVRTCImage:function(a){cc.log(cc._LogInfos.textureCache_addPVRTCImage)},addETCImage:function(a){cc.log(cc._LogInfos.textureCache_addETCImage)},description:function(){return"\x3cTextureCache | Number of textures \x3d "+
this._textures.length+"\x3e"},textureForKey:function(a){cc.log(cc._LogInfos.textureCache_textureForKey);return this.getTextureForKey(a)},getTextureForKey:function(a){return this._textures[a]||this._textures[cc.loader._getAliase(a)]},getKeyByTexture:function(a){for(var b in this._textures)if(this._textures[b]===a)return b;return null},_generalTextureKey:function(a){return"_textureKey_"+a},getTextureColors:function(a){var b=a._htmlElementObj,c=this.getKeyByTexture(b);c||(c=b instanceof HTMLImageElement?
b.src:this._generalTextureKey(a.__instanceId));this._textureColorsCache[c]||(this._textureColorsCache[c]=a._generateTextureCacheForColor());return this._textureColorsCache[c]},addPVRImage:function(a){cc.log(cc._LogInfos.textureCache_addPVRImage)},removeAllTextures:function(){var a=this._textures,b;for(b in a)a[b]&&a[b].releaseTexture();this._textures={}},removeTexture:function(a){if(a){var b=this._textures,c;for(c in b)b[c]===a&&(b[c].releaseTexture(),delete b[c])}},removeTextureForKey:function(a){if(null!=
a){var b=this._textures[a];b&&(b.releaseTexture(),delete this._textures[a])}},cacheImage:function(a,b){if(b instanceof cc.Texture2D)this._textures[a]=b;else{var c=new cc.Texture2D;c.initWithElement(b);c.handleLoadedTexture();this._textures[a]=c}},addUIImage:function(a,b){cc.assert(a,cc._LogInfos.textureCache_addUIImage_2);if(b&&this._textures[b])return this._textures[b];var c=new cc.Texture2D;c.initWithImage(a);null!=b?this._textures[b]=c:cc.log(cc._LogInfos.textureCache_addUIImage);return c},dumpCachedTextureInfo:function(){var a=
0,b=0,c=this._textures,d;for(d in c){var e=c[d];a++;e.getHtmlElementObj()instanceof HTMLImageElement?cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo,d,e.getHtmlElementObj().src,e.getPixelsWide(),e.getPixelsHigh()):cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_2,d,e.getPixelsWide(),e.getPixelsHigh());b+=e.getPixelsWide()*e.getPixelsHigh()*4}c=this._textureColorsCache;for(d in c){var e=c[d],f;for(f in e){var h=e[f];a++;cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_2,d,h.width,
h.height);b+=h.width*h.height*4}}cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_3,a,b/1024,(b/1048576).toFixed(2))},_clear:function(){this._textures={};this._textureColorsCache={};this._textureKeySeq=0|1E3*Math.random();this._loadedTexturesBefore={}}};
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.textureCache;a.handleLoadedTexture=function(a,c){var d=this._textures,e=d[a];e||(e=d[a]=new cc.Texture2D,e.url=a);e.initWithElement(c);e.handleLoadedTexture();return e};a.addImage=function(a,c,d){cc.assert(a,cc._LogInfos.Texture2D_addImage);var e=this._textures,f=e[a]||e[cc.loader._getAliase(a)];if(f)return f.isLoaded()?c&&c.call(d,f):f.addEventListener("load",function(){c&&c.call(d,
f)},d),f;f=e[a]=new cc.Texture2D;f.url=a;e=cc.loader.getBasePath?cc.loader.getBasePath():cc.loader.resPath;cc.loader.loadImg(cc.path.join(e||"",a),function(e,f){if(e)return c&&c.call(d,e);var m=cc.textureCache.handleLoadedTexture(a,f);c&&c.call(d,m)});return f};a.addImageAsync=a.addImage;a=null}else cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc.assert(cc.isFunction(cc._tmp.WebGLTextureCache),cc._LogInfos.MissingFile,"TexturesWebGL.js"),cc._tmp.WebGLTextureCache(),delete cc._tmp.WebGLTextureCache)});cc.TextureAtlas=cc.Class.extend({dirty:!1,texture:null,_indices:null,_buffersVBO:null,_capacity:0,_quads:null,_quadsArrayBuffer:null,_quadsWebBuffer:null,_quadsReader:null,ctor:function(a,b){this._buffersVBO=[];cc.isString(a)?this.initWithFile(a,b):a instanceof cc.Texture2D&&this.initWithTexture(a,b)},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,b){if(a)for(var c=0;c<a.length;c++)this._setQuadToArray(a[c],b+c)},_setQuadToArray:function(a,b){var c=this._quads;c[b]?(c[b].bl=a.bl,c[b].br=a.br,c[b].tl=a.tl,c[b].tr=a.tr):c[b]=new cc.V3F_C4B_T2F_Quad(a.tl,a.bl,a.tr,a.br,this._quadsArrayBuffer,b*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,b=this._capacity,c=0;c<b;c++)cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP?(a[6*c+0]=4*c+0,a[6*c+1]=4*c+0,a[6*c+2]=4*c+2,a[6*c+3]=4*c+1,a[6*c+4]=4*c+3,a[6*c+5]=4*c+3):(a[6*c+0]=4*c+0,a[6*c+1]=4*c+1,a[6*c+2]=4*c+2,a[6*c+3]=4*c+3,a[6*c+4]=4*c+2,a[6*c+5]=4*c+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,b){var c=cc.textureCache.addImage(a);if(c)return this.initWithTexture(c,b);cc.log(cc._LogInfos.TextureAtlas_initWithFile,a);return!1},initWithTexture:function(a,b){cc.assert(a,
cc._LogInfos.TextureAtlas_initWithTexture);this._capacity=b|=0;this._totalQuads=0;this.texture=a;this._quads=[];this._indices=new Uint16Array(6*b);var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._quadsArrayBuffer=new ArrayBuffer(c*b);this._quadsReader=new Uint8Array(this._quadsArrayBuffer);if((!this._quads||!this._indices)&&0<b)return!1;for(var d=this._quads,e=0;e<b;e++)d[e]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,e*c);this._setupIndices();this._setupVBO();return this.dirty=
!0},updateQuad:function(a,b){cc.assert(a,cc._LogInfos.TextureAtlas_updateQuad);cc.assert(0<=b&&b<this._capacity,cc._LogInfos.TextureAtlas_updateQuad_2);this._totalQuads=Math.max(b+1,this._totalQuads);this._setQuadToArray(a,b);this.dirty=!0},insertQuad:function(a,b){cc.assert(b<this._capacity,cc._LogInfos.TextureAtlas_insertQuad_2);this._totalQuads++;if(this._totalQuads>this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=b*c,e=(this._totalQuads-
1-b)*c;this._quads[this._totalQuads-1]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*c);this._quadsReader.set(this._quadsReader.subarray(d,d+e),d+c);this._setQuadToArray(a,b);this.dirty=!0}},insertQuads:function(a,b,c){c=c||a.length;cc.assert(b+c<=this._capacity,cc._LogInfos.TextureAtlas_insertQuads);var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads+=c;if(this._totalQuads>this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var e=b*
d,f=(this._totalQuads-1-b-c)*d,h=this._totalQuads-1-c,k;for(k=0;k<c;k++)this._quads[h+k]=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*c);for(k=0;k<c;k++)this._setQuadToArray(a[k],b+k);this.dirty=!0}},insertQuadFromIndex:function(a,b){if(a!==b){cc.assert(0<=b||b<this._totalQuads,cc._LogInfos.TextureAtlas_insertQuadFromIndex);cc.assert(0<=a||a<this._totalQuads,cc._LogInfos.TextureAtlas_insertQuadFromIndex_2);
var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=this._quadsReader,e=d.subarray(a*c,c),f;a>b?(f=b*c,d.set(d.subarray(f,f+(a-b)*c),f+c),d.set(e,f)):(f=(a+1)*c,d.set(d.subarray(f,f+(b-a)*c),f-c),d.set(e,b*c));this.dirty=!0}},removeQuadAtIndex:function(a){cc.assert(a<this._totalQuads,cc._LogInfos.TextureAtlas_removeQuadAtIndex);var b=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads--;this._quads.length=this._totalQuads;if(a!==this._totalQuads){var c=(a+1)*b;this._quadsReader.set(this._quadsReader.subarray(c,
c+(this._totalQuads-a)*b),c-b)}this.dirty=!0},removeQuadsAtIndex:function(a,b){cc.assert(a+b<=this._totalQuads,cc._LogInfos.TextureAtlas_removeQuadsAtIndex);this._totalQuads-=b;if(a!==this._totalQuads){var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=(a+b)*c,e=a*c;this._quadsReader.set(this._quadsReader.subarray(d,d+(this._totalQuads-a)*c),e)}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 b=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,c=this._capacity;this._totalQuads=Math.min(this._totalQuads,a);var d=this._capacity=0|a,e=this._totalQuads;if(null===this._quads)for(this._quads=[],this._quadsArrayBuffer=new ArrayBuffer(b*d),this._quadsReader=new Uint8Array(this._quadsArrayBuffer),a=0;a<d;a++)this._quads=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,a*b);else{var f,h,k=this._quads;if(d>c){f=[];h=new ArrayBuffer(b*d);for(a=0;a<e;a++)f[a]=new cc.V3F_C4B_T2F_Quad(k[a].tl,
k[a].bl,k[a].tr,k[a].br,h,a*b);for(;a<d;a++)f[a]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,h,a*b)}else for(e=Math.max(e,d),f=[],h=new ArrayBuffer(b*d),a=0;a<e;a++)f[a]=new cc.V3F_C4B_T2F_Quad(k[a].tl,k[a].bl,k[a].tr,k[a].br,h,a*b);this._quadsReader=new Uint8Array(h);this._quads=f;this._quadsArrayBuffer=h}null===this._indices?this._indices=new Uint16Array(6*d):d>c?(b=new Uint16Array(6*d),b.set(this._indices,0),this._indices=b):this._indices=this._indices.subarray(0,6*d);this._setupIndices();this._mapBuffers();
return this.dirty=!0},increaseTotalQuadsWith:function(a){this._totalQuads+=a},moveQuadsFromIndex:function(a,b,c){if(void 0===c){if(c=b,b=this._totalQuads-a,cc.assert(c+(this._totalQuads-a)<=this._capacity,cc._LogInfos.TextureAtlas_moveQuadsFromIndex),0===b)return}else if(cc.assert(c+b<=this._totalQuads,cc._LogInfos.TextureAtlas_moveQuadsFromIndex_2),cc.assert(a<this._totalQuads,cc._LogInfos.TextureAtlas_moveQuadsFromIndex_3),a===c)return;var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,e=a*d,f=b*d,h=this._quadsReader,
k=h.subarray(e,e+f),m=c*d;c<a?(b=c*d,h.set(h.subarray(b,b+(a-c)*d),b+f)):(b=(a+b)*d,h.set(h.subarray(b,b+(c-a)*d),e));h.set(k,m);this.dirty=!0},fillWithEmptyQuadsFromIndex:function(a,b){for(var c=b*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=new Uint8Array(this._quadsArrayBuffer,a*cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,c),e=0;e<c;e++)d[e]=0},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)}});_p=cc.TextureAtlas.prototype;cc.defineGetterSetter(_p,"totalQuads",_p.getTotalQuads);cc.defineGetterSetter(_p,"capacity",_p.getCapacity);cc.defineGetterSetter(_p,"quads",_p.getQuads,_p.setQuads);cc.TextureAtlas.create=function(a,b){return new cc.TextureAtlas(a,b)};cc.TextureAtlas.createWithTexture=cc.TextureAtlas.create;
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc.assert(cc.isFunction(cc._tmp.WebGLTextureAtlas),cc._LogInfos.MissingFile,"TexturesWebGL.js"),cc._tmp.WebGLTextureAtlas(),delete cc._tmp.WebGLTextureAtlas)});cc.assert(cc.isFunction(cc._tmp.PrototypeTextureAtlas),cc._LogInfos.MissingFile,"TexturesPropertyDefine.js");cc._tmp.PrototypeTextureAtlas();delete cc._tmp.PrototypeTextureAtlas;cc.Scene=cc.Node.extend({_className:"Scene",ctor:function(){cc.Node.prototype.ctor.call(this);this._ignoreAnchorPointForPosition=!0;this.setAnchorPoint(0.5,0.5);this.setContentSize(cc.director.getWinSize())}});cc.Scene.create=function(){return new cc.Scene};cc.LoaderScene=cc.Scene.extend({_interval:null,_label:null,_logo:null,_className:"LoaderScene",cb:null,target:null,init:function(){var a=this,b=200,c=a._bgLayer=new cc.LayerColor(cc.color(32,32,32,255));a.addChild(c,0);var d=24,e=-b/2+100;cc._loaderImage&&(cc.loader.loadImg(cc._loaderImage,{isCrossOrigin:!1},function(c,d){b=d.height;a._initStage(d,cc.visibleRect.center)}),d=14,e=-b/2-10);d=a._label=new cc.LabelTTF("Loading... 0%","Arial",d);d.setPosition(cc.pAdd(cc.visibleRect.center,cc.p(0,e)));
d.setColor(cc.color(180,180,180));c.addChild(this._label,10);return!0},_initStage:function(a,b){var c=this._texture2d=new cc.Texture2D;c.initWithElement(a);c.handleLoadedTexture();c=this._logo=new cc.Sprite(c);c.setScale(cc.contentScaleFactor());c.x=b.x;c.y=b.y;this._bgLayer.addChild(c,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,
b,c){cc.isString(a)&&(a=[a]);this.resources=a||[];this.cb=b;this.target=c},_startLoading:function(){var a=this;a.unschedule(a._startLoading);cc.loader.load(a.resources,function(b,c,d){b=Math.min(d/c*100|0,100);a._label.setString("Loading... "+b+"%")},function(){a.cb&&a.cb.call(a.target)})},_updateTransform:function(){this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._bgLayer._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);this._label._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);
this._logo&&this._logo._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)}});cc.LoaderScene.preload=function(a,b,c){var d=cc;d.loaderScene||(d.loaderScene=new cc.LoaderScene,d.loaderScene.init(),cc.eventManager.addCustomListener(cc.Director.EVENT_PROJECTION_CHANGED,function(){d.loaderScene._updateTransform()}));d.loaderScene.initWithResources(a,b,c);cc.director.runScene(d.loaderScene);return d.loaderScene};cc.Layer=cc.Node.extend({_className:"Layer",ctor:function(){cc.Node.prototype.ctor.call(this);this._ignoreAnchorPointForPosition=!0;this.setAnchorPoint(0.5,0.5);this.setContentSize(cc.winSize);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!1},bake:function(){this._renderCmd.bake()},unbake:function(){this._renderCmd.unbake()},isBaked:function(){return this._renderCmd._isBaked},visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){a=cc.renderer;b.visit(c);if(b._isBaked)a.pushRenderCommand(b),
b._bakeSprite.visit(this);else{var d=this._children,e=d.length,f;if(0<e){this._reorderChildDirty&&this.sortAllChildren();for(c=0;c<e;c++)if(f=d[c],0>f._localZOrder)f.visit(this);else break;for(a.pushRenderCommand(b);c<e;c++)d[c].visit(this)}else a.pushRenderCommand(b)}b._dirtyFlag=0}else b._propagateFlagsDown(c)},addChild:function(a,b,c){cc.Node.prototype.addChild.call(this,a,b,c);this._renderCmd._bakeForAddChild(a)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.Layer.CanvasRenderCmd(this):
new cc.Layer.WebGLRenderCmd(this)}});cc.Layer.create=function(){return new cc.Layer};
cc.LayerColor=cc.Layer.extend({_blendFunc:null,_className:"LayerColor",getBlendFunc:function(){return this._blendFunc},changeWidthAndHeight:function(a,b){this.width=a;this.height=b},changeWidth:function(a){this.width=a},changeHeight:function(a){this.height=a},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},ctor:function(a,b,c){cc.Layer.prototype.ctor.call(this);this._blendFunc=cc.BlendFunc._alphaNonPremultiplied();cc.LayerColor.prototype.init.call(this,a,b,c)},init:function(a,
b,c){var d=cc.director.getWinSize();a=a||cc.color(0,0,0,255);b=void 0===b?d.width:b;c=void 0===c?d.height:c;d=this._realColor;d.r=a.r;d.g=a.g;d.b=a.b;this._realOpacity=a.a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty);cc.LayerColor.prototype.setContentSize.call(this,b,c);return!0},visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){a=cc.renderer;b.visit(c);if(b._isBaked)a.pushRenderCommand(b._bakeRenderCmd),b._bakeSprite._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty),
b._bakeSprite.visit(this);else{var d=this._children,e=d.length;if(0<e){this._reorderChildDirty&&this.sortAllChildren();for(c=0;c<e;c++)if(child=d[c],0>child._localZOrder)child.visit(this);else break;for(a.pushRenderCommand(b);c<e;c++)d[c].visit(this)}else a.pushRenderCommand(b)}b._dirtyFlag=0}else b._propagateFlagsDown(c)},setBlendFunc:function(a,b){var c=this._blendFunc;void 0===b?(c.src=a.src,c.dst=a.dst):(c.src=a,c.dst=b);this._renderCmd.updateBlendFunc(c)},_createRenderCmd:function(){return cc._renderType===
cc.game.RENDER_TYPE_CANVAS?new cc.LayerColor.CanvasRenderCmd(this):new cc.LayerColor.WebGLRenderCmd(this)}});cc.LayerColor.create=function(a,b,c){return new cc.LayerColor(a,b,c)};(function(){var a=cc.LayerColor.prototype;cc.defineGetterSetter(a,"width",a._getWidth,a._setWidth);cc.defineGetterSetter(a,"height",a._getHeight,a._setHeight)})();
cc.LayerGradient=cc.LayerColor.extend({_endColor:null,_startOpacity:255,_endOpacity:255,_alongVector:null,_compressedInterpolation:!1,_className:"LayerGradient",_colorStops:[],ctor:function(a,b,c,d){cc.LayerColor.prototype.ctor.call(this);this._endColor=cc.color(0,0,0,255);this._alongVector=cc.p(0,-1);this._endOpacity=this._startOpacity=255;d&&d instanceof Array?(this._colorStops=d,d.splice(0,0,{p:0,color:a||cc.color.BLACK}),d.push({p:1,color:b||cc.color.BLACK})):this._colorStops=[{p:0,color:a||cc.color.BLACK},
{p:1,color:b||cc.color.BLACK}];cc.LayerGradient.prototype.init.call(this,a,b,c,d)},init:function(a,b,c,d){a=a||cc.color(0,0,0,255);b=b||cc.color(0,0,0,255);c=c||cc.p(0,-1);d=this._endColor;this._startOpacity=a.a;d.r=b.r;d.g=b.g;d.b=b.b;this._endOpacity=b.a;this._alongVector=c;this._compressedInterpolation=!0;cc.LayerColor.prototype.init.call(this,cc.color(a.r,a.g,a.b,255));this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty|cc.Node._dirtyFlags.gradientDirty);
return!0},setContentSize:function(a,b){cc.LayerColor.prototype.setContentSize.call(this,a,b);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},_setWidth:function(a){cc.LayerColor.prototype._setWidth.call(this,a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},_setHeight:function(a){cc.LayerColor.prototype._setHeight.call(this,a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},getStartColor:function(){return cc.color(this._realColor)},setStartColor:function(a){this.color=
a;var b=this._colorStops;b&&0<b.length&&(b=b[0].color,b.r=a.r,b.g=a.g,b.b=a.b)},setEndColor:function(a){var b=this._endColor;b.r=a.r;b.g=a.g;b.b=a.b;(b=this._colorStops)&&0<b.length&&(b=b[b.length-1].color,b.r=a.r,b.g=a.g,b.b=a.b);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},getEndColor:function(){return cc.color(this._endColor)},setStartOpacity:function(a){this._startOpacity=a;var b=this._colorStops;b&&0<b.length&&(b[0].color.a=a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},
getStartOpacity:function(){return this._startOpacity},setEndOpacity:function(a){this._endOpacity=a;var b=this._colorStops;b&&0<b.length&&(b[b.length-1].color.a=a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},getEndOpacity:function(){return this._endOpacity},setVector:function(a){this._alongVector.x=a.x;this._alongVector.y=a.y;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},getVector:function(){return cc.p(this._alongVector.x,this._alongVector.y)},isCompressedInterpolation:function(){return this._compressedInterpolation},
setCompressedInterpolation:function(a){this._compressedInterpolation=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.gradientDirty)},getColorStops:function(){return this._colorStops},setColorStops:function(a){this._colorStops=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty|cc.Node._dirtyFlags.gradientDirty)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.LayerGradient.CanvasRenderCmd(this):new cc.LayerGradient.WebGLRenderCmd(this)}});
cc.LayerGradient.create=function(a,b,c,d){return new cc.LayerGradient(a,b,c,d)};
(function(){var a=cc.LayerGradient.prototype;cc.defineGetterSetter(a,"startColor",a.getStartColor,a.setStartColor);cc.defineGetterSetter(a,"endColor",a.getEndColor,a.setEndColor);cc.defineGetterSetter(a,"startOpacity",a.getStartOpacity,a.setStartOpacity);cc.defineGetterSetter(a,"endOpacity",a.getEndOpacity,a.setEndOpacity);cc.defineGetterSetter(a,"vector",a.getVector,a.setVector);cc.defineGetterSetter(a,"colorStops",a.getColorStops,a.setColorStops)})();
cc.LayerMultiplex=cc.Layer.extend({_enabledLayer:0,_layers:null,_className:"LayerMultiplex",ctor:function(a){cc.Layer.prototype.ctor.call(this);a instanceof Array?cc.LayerMultiplex.prototype.initWithLayers.call(this,a):cc.LayerMultiplex.prototype.initWithLayers.call(this,Array.prototype.slice.call(arguments))},initWithLayers:function(a){0<a.length&&null==a[a.length-1]&&cc.log(cc._LogInfos.LayerMultiplex_initWithLayers);this._layers=a;this._enabledLayer=0;this.addChild(this._layers[this._enabledLayer]);
return!0},switchTo:function(a){a>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchTo):(this.removeChild(this._layers[this._enabledLayer],!0),this._enabledLayer=a,this.addChild(this._layers[a]))},switchToAndReleaseMe:function(a){a>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchToAndReleaseMe):(this.removeChild(this._layers[this._enabledLayer],!0),this._layers[this._enabledLayer]=null,this._enabledLayer=a,this.addChild(this._layers[a]))},addLayer:function(a){a?this._layers.push(a):
cc.log(cc._LogInfos.LayerMultiplex_addLayer)}});cc.LayerMultiplex.create=function(){return new cc.LayerMultiplex(Array.prototype.slice.call(arguments))};(function(){cc.Layer.CanvasRenderCmd=function(a){this._rootCtor(a);this._isBaked=!1;this._bakeSprite=null;this._canUseDirtyRegion=!0;this._updateCache=2};var a=cc.Layer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.Layer.CanvasRenderCmd;a._layerCmdCtor=cc.Layer.CanvasRenderCmd;a._setCacheDirty=function(a){a&&0===this._updateCache&&(this._updateCache=2);!1===this._cacheDirty&&(this._cacheDirty=!0,(a=this._cachedParent)&&a!==this&&a._setNodeDirtyForCache&&
a._setNodeDirtyForCache())};a.updateStatus=function(){var a=cc.Node._dirtyFlags;this._dirtyFlag&a.orderDirty&&(this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~a.orderDirty);this.originUpdateStatus()};a._syncStatus=function(a){var c=cc.Node._dirtyFlags,d=this._dirtyFlag;if(this._isBaked||d&c.orderDirty)this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~c.orderDirty;this._originSyncStatus(a)};a.transform=function(a,c){this._worldTransform||
(this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._worldTransform,e=d.a,f=d.b,h=d.c,k=d.d;this.originTransform(a,c);d.a===e&&d.b===f&&d.c===h&&d.d===k||0!==this._updateCache||(this._updateCache=2)};a.bake=function(){if(!this._isBaked){this._needDraw=!0;this._isBaked=this._cacheDirty=cc.renderer.childrenOrderDirty=!0;0===this._updateCache&&(this._updateCache=2);for(var a=this._node._children,c=0,d=a.length;c<d;c++)a[c]._renderCmd._setCachedParent(this);this._bakeSprite||(this._bakeSprite=
new cc.BakeSprite,this._bakeSprite.setAnchorPoint(0,0))}};a.unbake=function(){if(this._isBaked){cc.renderer.childrenOrderDirty=!0;this._isBaked=this._needDraw=!1;this._cacheDirty=!0;0===this._updateCache&&(this._updateCache=2);for(var a=this._node._children,c=0,d=a.length;c<d;c++)a[c]._renderCmd._setCachedParent(null)}};a.isBaked=function(){return this._isBaked};a.rendering=function(){if(this._cacheDirty){var a=this._node,c=a._children,d=this._bakeSprite;this.transform(this.getParentRenderCmd(),!0);
var e=this._getBoundingBoxForBake();e.width=0|e.width+0.5;e.height=0|e.height+0.5;var f=d.getCacheContext(),h=f.getContext();d.setPosition(e.x,e.y);if(0<this._updateCache){d.resetCanvasSize(e.width,e.height);f.setOffset(0-e.x,h.canvas.height-e.height+e.y);a.sortAllChildren();cc.renderer._turnToCacheMode(this.__instanceId);a=0;for(e=c.length;a<e;a++)c[a].visit(this);cc.renderer._renderingToCacheCanvas(f,this.__instanceId);d.transform();this._updateCache--}this._cacheDirty=!1}};a._bakeForAddChild=function(a){a._parent===
this._node&&this._isBaked&&a._renderCmd._setCachedParent(this)};a._getBoundingBoxForBake=function(){var a=null,c=this._node;if(!c._children||0===c._children.length)return cc.rect(0,0,10,10);for(var d=c.getNodeToWorldTransform(),c=c._children,e=0,f=c.length;e<f;e++){var h=c[e];h&&h._visible&&(a?(h=h._getBoundingBoxToCurrentNode(d))&&(a=cc.rectUnion(a,h)):a=h._getBoundingBoxToCurrentNode(d))}return a}})();
(function(){cc.LayerColor.CanvasRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!0;this._blendFuncStr="source-over";this._bakeRenderCmd=new cc.CustomRenderCmd(this,this._bakeRendering)};var a=cc.LayerColor.CanvasRenderCmd.prototype=Object.create(cc.Layer.CanvasRenderCmd.prototype);a.constructor=cc.LayerColor.CanvasRenderCmd;a.unbake=function(){cc.Layer.CanvasRenderCmd.prototype.unbake.call(this);this._needDraw=!0};a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),
f=this._node,h=this._displayedColor,k=this._displayedOpacity/255,m=f._contentSize.width,f=f._contentSize.height;0!==k&&(a.setCompositeOperation(this._blendFuncStr),a.setGlobalAlpha(k),a.setFillStyle("rgba("+(0|h.r)+","+(0|h.g)+","+(0|h.b)+", 1)"),a.setTransform(this._worldTransform,c,d),e.fillRect(0,0,m,-f),cc.g_NumberOfDraws++)};a.updateBlendFunc=function(a){this._blendFuncStr=cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(a)};a._updateSquareVertices=a._updateSquareVerticesWidth=a._updateSquareVerticesHeight=
function(){};a._bakeRendering=function(){if(this._cacheDirty){var a=this._node,c=this._bakeSprite,d=a._children,e,f=d.length;this.transform(this.getParentRenderCmd(),!0);e=this._getBoundingBoxForBake();e.width=0|e.width+0.5;e.height=0|e.height+0.5;var h=c.getCacheContext(),k=h.getContext();c.setPosition(e.x,e.y);if(0<this._updateCache){k.fillStyle=h._currentFillStyle;c.resetCanvasSize(e.width,e.height);h.setOffset(0-e.x,k.canvas.height-e.height+e.y);cc.renderer._turnToCacheMode(this.__instanceId);
if(0<f){a.sortAllChildren();for(e=0;e<f;e++)if(k=d[e],0>k._localZOrder)k.visit(a);else break;for(cc.renderer.pushRenderCommand(this);e<f;e++)d[e].visit(a)}else cc.renderer.pushRenderCommand(this);cc.renderer._renderingToCacheCanvas(h,this.__instanceId);c.transform();this._updateCache--}this._cacheDirty=!1}};a._getBoundingBoxForBake=function(){var a=this._node,c=cc.rect(0,0,a._contentSize.width,a._contentSize.height),d=a.getNodeToWorldTransform(),c=cc.rectApplyAffineTransform(c,a.getNodeToWorldTransform());
if(!a._children||0===a._children.length)return c;for(var a=a._children,e=0;e<a.length;e++){var f=a[e];f&&f._visible&&(f=f._getBoundingBoxToCurrentNode(d),c=cc.rectUnion(c,f))}return c}})();
(function(){cc.LayerGradient.CanvasRenderCmd=function(a){cc.LayerColor.CanvasRenderCmd.call(this,a);this._needDraw=!0;this._startPoint=cc.p(0,0);this._endPoint=cc.p(0,0);this._endStopStr=this._startStopStr=null};var a=cc.LayerGradient.CanvasRenderCmd.prototype=Object.create(cc.LayerColor.CanvasRenderCmd.prototype);a.constructor=cc.LayerGradient.CanvasRenderCmd;a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),f=this._node,h=this._displayedOpacity/255;if(0!==h){var k=f._contentSize.width,
m=f._contentSize.height;a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(h);h=e.createLinearGradient(this._startPoint.x,this._startPoint.y,this._endPoint.x,this._endPoint.y);if(f._colorStops)for(var n=0;n<f._colorStops.length;n++)h.addColorStop(f._colorStops[n].p,this._colorStopsStr[n]);else h.addColorStop(0,this._startStopStr),h.addColorStop(1,this._endStopStr);a.setFillStyle(h);a.setTransform(this._worldTransform,c,d);e.fillRect(0,0,k,-m);cc.g_NumberOfDraws++}};a.updateStatus=function(){var a=
cc.Node._dirtyFlags;this._dirtyFlag&a.gradientDirty&&(this._dirtyFlag|=a.colorDirty,this._dirtyFlag&=~a.gradientDirty);this.originUpdateStatus()};a._syncStatus=function(a){var c=cc.Node._dirtyFlags;this._dirtyFlag&c.gradientDirty&&(this._dirtyFlag|=c.colorDirty,this._dirtyFlag&=~c.gradientDirty);this._originSyncStatus(a)};a._updateColor=function(){var a=this._node,c=a._contentSize,d=0.5*c.width,c=0.5*c.height,e=cc.pAngleSigned(cc.p(0,-1),a._alongVector),e=cc.pRotateByAngle(cc.p(0,-1),cc.p(0,0),e),
f=Math.min(Math.abs(1/e.x),Math.abs(1/e.y));this._startPoint.x=d*-e.x*f+d;this._startPoint.y=c*e.y*f-c;this._endPoint.x=d*e.x*f+d;this._endPoint.y=c*-e.y*f-c;d=this._displayedColor;c=a._endColor;e=a._startOpacity/255;f=a._endOpacity/255;this._startStopStr="rgba("+Math.round(d.r)+","+Math.round(d.g)+","+Math.round(d.b)+","+e.toFixed(4)+")";this._endStopStr="rgba("+Math.round(c.r)+","+Math.round(c.g)+","+Math.round(c.b)+","+f.toFixed(4)+")";if(a._colorStops)for(this._endOpacity=this._startOpacity=0,
this._colorStopsStr=[],d=0;d<a._colorStops.length;d++)c=a._colorStops[d].color,e=null==c.a?1:c.a/255,this._colorStopsStr.push("rgba("+Math.round(c.r)+","+Math.round(c.g)+","+Math.round(c.b)+","+e.toFixed(4)+")")}})();(function(){cc.Layer.WebGLRenderCmd=function(a){this._rootCtor(a);this._isBaked=!1};var a=cc.Layer.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.Layer.WebGLRenderCmd;a._layerCmdCtor=cc.Layer.WebGLRenderCmd;a.bake=function(){};a.unbake=function(){};a._bakeForAddChild=function(){}})();
(function(){cc.LayerColor.WebGLRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!0;this._matrix=null;this.initData(4);this._color=new Uint32Array(1);this._vertexBuffer=null;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_COLOR)};var a=cc.LayerColor.WebGLRenderCmd.prototype=Object.create(cc.Layer.WebGLRenderCmd.prototype);a.constructor=cc.LayerColor.WebGLRenderCmd;a.initData=function(a){this._data=new ArrayBuffer(16*a);this._positionView=new Float32Array(this._data);this._colorView=
new Uint32Array(this._data);this._dataDirty=!0};a.transform=function(a,c){this.originTransform(a,c);var d=this._node,e=d._contentSize.width,f=d._contentSize.height,h=this._positionView;h[4]=e;h[9]=f;h[12]=e;h[13]=f;h[2].z=h[6]=h[10]=h[14]=d._vertexZ;this._dataDirty=!0};a._updateColor=function(){var a=this._displayedColor;this._color[0]=this._displayedOpacity<<24|a.b<<16|a.g<<8|a.r;for(var a=this._colorView,c=0;4>c;c++)a[4*c+3]=this._color[0];this._dataDirty=!0};a.rendering=function(a){a=a||cc._renderContext;
var c=this._node;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._dataDirty&&(this._vertexBuffer||(this._vertexBuffer=a.createBuffer()),a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this._data,a.DYNAMIC_DRAW),this._dataDirty=!1);this._glProgramState.apply(this._matrix);
cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,16,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,16,12);a.drawArrays(a.TRIANGLE_STRIP,0,4)};a.updateBlendFunc=function(a){}})();
(function(){cc.LayerGradient.WebGLRenderCmd=function(a){cc.LayerColor.WebGLRenderCmd.call(this,a);this._needDraw=!0;this._clipRect=new cc.Rect;this._clippingRectDirty=!1};var a=cc.LayerGradient.WebGLRenderCmd.prototype=Object.create(cc.LayerColor.WebGLRenderCmd.prototype);a.constructor=cc.LayerGradient.WebGLRenderCmd;a.updateStatus=function(){var a=cc.Node._dirtyFlags;this._dirtyFlag&a.gradientDirty&&(this._dirtyFlag|=a.colorDirty,this._updateVertex(),this._dirtyFlag&=~a.gradientDirty);this.originUpdateStatus()};
a._syncStatus=function(a){var c=cc.Node._dirtyFlags;this._dirtyFlag&c.gradientDirty&&(this._dirtyFlag|=c.colorDirty,this._updateVertex(),this._dirtyFlag&=~c.gradientDirty);this._originSyncStatus(a)};a.transform=function(a,c){this.originTransform(a,c);this._updateVertex()};a._updateVertex=function(){var a=this._node,c=a._colorStops;if(c&&!(2>c.length)){this._clippingRectDirty=!0;var d,e=c.length,f=2*e,h=a._contentSize;this._positionView.length/4<f&&this.initData(f);var k=Math.PI+cc.pAngleSigned(cc.p(0,
-1),a._alongVector),f=cc.p(h.width/2,h.height/2);d=Math.round(cc.radiansToDegrees(k));var m=cc.affineTransformMake(1,0,0,1,f.x,f.y),m=cc.affineTransformRotate(m,k),n;90>d?(n=cc.p(-f.x,f.y),d=cc.p(f.x,f.y)):180>d?(n=cc.p(f.x,f.y),d=cc.p(f.x,-f.y)):270>d?(n=cc.p(f.x,-f.y),d=cc.p(-f.x,-f.y)):(n=cc.p(-f.x,-f.y),d=cc.p(-f.x,f.y));var p=Math.sin(k),k=Math.cos(k);n=Math.abs((n.x*k-n.y*p)/f.x);d=Math.abs((d.x*p+d.y*k)/f.y);m=cc.affineTransformScale(m,n,d);p=this._positionView;for(d=0;d<e;d++){n=c[d].p*h.height;
var r=cc.pointApplyAffineTransform(-f.x,n-f.y,m),k=8*d;p[k]=r.x;p[k+1]=r.y;p[k+2]=a._vertexZ;n=cc.pointApplyAffineTransform(h.width-f.x,n-f.y,m);k+=4;p[k]=n.x;p[k+1]=n.y;p[k+2]=a._vertexZ}this._dataDirty=!0}};a._updateColor=function(){var a=this._node._colorStops;if(a&&!(2>a.length)){var c=a.length,d,e=this._colorView,f=this._displayedOpacity/255;for(i=0;i<c;i++)d=a[i].color,this._color[0]=d.a*f<<24|d.b<<16|d.g<<8|d.r,d=8*i,e[d+3]=this._color[0],d+=4,e[d+3]=this._color[0];this._dataDirty=!0}};a.rendering=
function(a){a=a||cc._renderContext;var c=this._node;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._getClippingRect();a.enable(a.SCISSOR_TEST);cc.view.setScissorInPoints(d.x,d.y,d.width,d.height);d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._dataDirty&&(this._vertexBuffer||(this._vertexBuffer=gl.createBuffer()),gl.bindBuffer(gl.ARRAY_BUFFER,
this._vertexBuffer),gl.bufferData(gl.ARRAY_BUFFER,this._data,gl.DYNAMIC_DRAW),this._dataDirty=!1);this._glProgramState.apply(this._matrix);cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);gl.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);gl.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,gl.FLOAT,!1,16,0);gl.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,gl.UNSIGNED_BYTE,!0,16,12);gl.drawArrays(gl.TRIANGLE_STRIP,
0,4);a.disable(a.SCISSOR_TEST)};a._getClippingRect=function(){if(this._clippingRectDirty){var a=this._node,c=cc.rect(0,0,a._contentSize.width,a._contentSize.height),a=a.getNodeToWorldTransform();this._clipRect=cc._rectApplyAffineTransformIn(c,a)}return this._clipRect}})();cc._tmp.PrototypeSprite=function(){var a=cc.Sprite.prototype;cc.defineGetterSetter(a,"opacityModifyRGB",a.isOpacityModifyRGB,a.setOpacityModifyRGB);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"flippedX",a.isFlippedX,a.setFlippedX);cc.defineGetterSetter(a,"flippedY",a.isFlippedY,a.setFlippedY);cc.defineGetterSetter(a,"offsetX",a._getOffsetX);cc.defineGetterSetter(a,"offsetY",a._getOffsetY);cc.defineGetterSetter(a,
"texture",a.getTexture,a.setTexture);cc.defineGetterSetter(a,"textureRectRotated",a.isTextureRectRotated);cc.defineGetterSetter(a,"batchNode",a.getBatchNode,a.setBatchNode);cc.defineGetterSetter(a,"quad",a.getQuad)};cc.Sprite=cc.Node.extend({dirty:!1,atlasIndex:0,textureAtlas:null,_batchNode:null,_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,_className:"Sprite",ctor:function(a,b,c){cc.Node.prototype.ctor.call(this);this.setAnchorPoint(0.5,0.5);this._loader=new cc.Sprite.LoadManager;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._softInit(a,b,c)},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},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)},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){this.textureAtlas=a},getOffsetPosition:function(){return cc.p(this._offsetPosition)},_getOffsetX:function(){return this._offsetPosition.x},_getOffsetY:function(){return this._offsetPosition.y},getBlendFunc:function(){return this._blendFunc},initWithSpriteFrame:function(a){cc.assert(a,cc._LogInfos.Sprite_initWithSpriteFrame);return this.setSpriteFrame(a)},initWithSpriteFrameName:function(a){cc.assert(a,
cc._LogInfos.Sprite_initWithSpriteFrameName);var b=cc.spriteFrameCache.getSpriteFrame(a);cc.assert(b,a+cc._LogInfos.Sprite_initWithSpriteFrameName1);return this.initWithSpriteFrame(b)},useBatchNode:function(a){},setVertexRect:function(a){var b=this._rect;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setFlippedX:function(a){this._flippedX!==a&&(this._flippedX=a,this.setTextureRect(this._rect,this._rectRotated,this._contentSize),
this.setNodeDirty(!0))},setFlippedY:function(a){this._flippedY!==a&&(this._flippedY=a,this.setTextureRect(this._rect,this._rectRotated,this._contentSize),this.setNodeDirty(!0))},isFlippedX:function(){return this._flippedX},isFlippedY:function(){return this._flippedY},setOpacityModifyRGB:function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this._renderCmd._setColorDirty())},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setDisplayFrameWithAnimationName:function(a,b){cc.assert(a,
cc._LogInfos.Sprite_setDisplayFrameWithAnimationName_3);var c=cc.animationCache.getAnimation(a);c?(c=c.getFrames()[b])?this.setSpriteFrame(c.getSpriteFrame()):cc.log(cc._LogInfos.Sprite_setDisplayFrameWithAnimationName_2):cc.log(cc._LogInfos.Sprite_setDisplayFrameWithAnimationName)},getBatchNode:function(){return this._batchNode},getTexture:function(){return this._texture},_softInit:function(a,b,c){if(void 0===a)cc.Sprite.prototype.init.call(this);else if("string"===typeof a)"#"===a[0]?(b=a.substr(1,
a.length-1),(b=cc.spriteFrameCache.getSpriteFrame(b))?this.initWithSpriteFrame(b):cc.log("%s does not exist",a)):cc.Sprite.prototype.init.call(this,a,b);else if("object"===typeof a)if(a instanceof cc.Texture2D)this.initWithTexture(a,b,c);else if(a instanceof cc.SpriteFrame)this.initWithSpriteFrame(a);else if(a instanceof HTMLImageElement||a instanceof HTMLCanvasElement)b=new cc.Texture2D,b.initWithElement(a),b.handleLoadedTexture(),this.initWithTexture(b)},getQuad:function(){return null},setBlendFunc:function(a,
b){var c=this._blendFunc;void 0===b?(c.src=a.src,c.dst=a.dst):(c.src=a,c.dst=b);this._renderCmd.updateBlendFunc(c)},init:function(){if(0<arguments.length)return this.initWithFile(arguments[0],arguments[1]);cc.Node.prototype.init.call(this);this.dirty=this._recursiveDirty=!1;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this.texture=null;this._flippedX=this._flippedY=!1;this.anchorY=this.anchorX=0.5;this._offsetPosition.x=0;this._offsetPosition.y=0;this._hasChildren=!1;this.setTextureRect(cc.rect(0,
0,0,0),!1,cc.size(0,0));return!0},initWithFile:function(a,b){cc.assert(a,cc._LogInfos.Sprite_initWithFile);var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));if(!c.isLoaded())return this._loader.clear(),this._loader.once(c,function(){this.initWithFile(a,b);this.dispatchEvent("load")},this),!1;if(!b){var d=c.getContentSize();b=cc.rect(0,0,d.width,d.height)}return this.initWithTexture(c,b)},initWithTexture:function(a,b,c,d){cc.assert(0!==arguments.length,cc._LogInfos.CCSpriteBatchNode_initWithTexture);
this._loader.clear();this._textureLoaded=a.isLoaded();if(!this._textureLoaded)return this._loader.once(a,function(){this.initWithTexture(a,b,c,d);this.dispatchEvent("load")},this),!1;c=c||!1;a=this._renderCmd._handleTextureForRotatedTexture(a,b,c,d);if(!cc.Node.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._offsetPosition.x=
0;this._offsetPosition.y=0;this._hasChildren=!1;this._rectRotated=c;b&&(this._rect.x=b.x,this._rect.y=b.y,this._rect.width=b.width,this._rect.height=b.height);b||(b=cc.rect(0,0,a.width,a.height));this._renderCmd._checkTextureBoundary(a,b,c);this.setTexture(a);this.setTextureRect(b,c);this.setBatchNode(null);return!0},setTextureRect:function(a,b,c,d){this._rectRotated=b||!1;this.setContentSize(c||a);this.setVertexRect(a);this._renderCmd._setTextureCoords(a,d);a=this._unflippedOffsetPositionFromCenter.x;
b=this._unflippedOffsetPositionFromCenter.y;this._flippedX&&(a=-a);this._flippedY&&(b=-b);c=this._rect;this._offsetPosition.x=a+(this._contentSize.width-c.width)/2;this._offsetPosition.y=b+(this._contentSize.height-c.height)/2},addChild:function(a,b,c){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_addChild_2);null==b&&(b=a._localZOrder);null==c&&(c=a.tag);this._renderCmd._setBatchNodeForAddChild(a)&&(cc.Node.prototype.addChild.call(this,a,b,c),this._hasChildren=!0)},setSpriteFrame:function(a){"string"===
typeof a&&(a=cc.spriteFrameCache.getSpriteFrame(a),cc.assert(a,cc._LogInfos.Sprite_setSpriteFrame));this._loader.clear();this.setNodeDirty(!0);var b=a.getTexture();this._textureLoaded=a.textureLoaded();this._loader.clear();if(!this._textureLoaded)return this._loader.once(b,function(){this.setSpriteFrame(a);this.dispatchEvent("load")},this),!1;var c=a.getOffset();this._unflippedOffsetPositionFromCenter.x=c.x;this._unflippedOffsetPositionFromCenter.y=c.y;b!==this._texture&&(this._renderCmd._setTexture(b),
this.setColor(this._realColor));this.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize())},setDisplayFrame:function(a){cc.log(cc._LogInfos.Sprite_setDisplayFrame);this.setSpriteFrame(a)},isFrameDisplayed:function(a){return this._renderCmd.isFrameDisplayed(a)},displayFrame:function(){return this.getSpriteFrame()},getSpriteFrame:function(){return new cc.SpriteFrame(this._texture,cc.rectPointsToPixels(this._rect),this._rectRotated,cc.pointPointsToPixels(this._unflippedOffsetPositionFromCenter),
cc.sizePointsToPixels(this._contentSize))},setBatchNode:function(a){},setTexture:function(a){if(!a)return this._renderCmd._setTexture(null);var b="string"===typeof a;b&&(a=cc.textureCache.addImage(a));this._loader.clear();if(!a._textureLoaded)return this._loader.once(a,function(){this.setTexture(a);this.dispatchEvent("load")},this),!1;this._renderCmd._setTexture(a);b&&this._changeRectWithTexture(a);this.setColor(this._realColor);this._textureLoaded=!0},_changeRectWithTexture:function(a){a=a._contentSize;
a=cc.rect(0,0,a.width,a.height);this.setTextureRect(a)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.Sprite.CanvasRenderCmd(this):new cc.Sprite.WebGLRenderCmd(this)}});cc.Sprite.create=function(a,b,c){return new cc.Sprite(a,b,c)};cc.Sprite.createWithTexture=cc.Sprite.create;cc.Sprite.createWithSpriteFrameName=cc.Sprite.create;cc.Sprite.createWithSpriteFrame=cc.Sprite.create;cc.Sprite.INDEX_NOT_INITIALIZED=-1;cc.EventHelper.prototype.apply(cc.Sprite.prototype);
cc.assert(cc.isFunction(cc._tmp.PrototypeSprite),cc._LogInfos.MissingFile,"SpritesPropertyDefine.js");cc._tmp.PrototypeSprite();delete cc._tmp.PrototypeSprite;
(function(){var a=cc.Sprite.LoadManager=function(){this.list=[]};a.prototype.add=function(a,c,d){a&&a.addEventListener&&(a.addEventListener("load",c,d),this.list.push({source:a,listener:c,target:d}))};a.prototype.once=function(a,c,d){if(a&&a.addEventListener){var e=function(f){a.removeEventListener("load",e,d);c.call(d,f)};a.addEventListener("load",e,d);this.list.push({source:a,listener:e,target:d})}};a.prototype.clear=function(){for(;0<this.list.length;){var a=this.list.pop();a.source.removeEventListener("load",
a.listener,a.target)}}})();(function(){cc.Sprite.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._textureCoord={renderX:0,renderY:0,x:0,y:0,width:0,height:0,validRect:!1};this._blendFuncStr="source-over";this._colorized=!1;this._canUseDirtyRegion=!0;this._textureToRender=null};var a=cc.Sprite.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.Sprite.CanvasRenderCmd;a._spriteCmdCtor=cc.Sprite.CanvasRenderCmd;a.setDirtyRecursively=function(a){};a._setTexture=function(a){var c=
this._node;c._texture!==a&&(c._textureLoaded=a?a._textureLoaded:!1,c._texture=a,a=a._contentSize,a=cc.rect(0,0,a.width,a.height),c.setTextureRect(a),this._updateColor())};a._setColorDirty=function(){this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty)};a.isFrameDisplayed=function(a){var c=this._node;return a.getTexture()!==c._texture?!1:cc.rectEqualToRect(a.getRect(),c._rect)};a.updateBlendFunc=function(a){this._blendFuncStr=cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(a)};
a._setBatchNodeForAddChild=function(a){return!0};a._handleTextureForRotatedTexture=function(a,c,d,e){d&&a.isLoaded()&&(a=a.getHtmlElementObj(),a=cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(a,c,e),e=new cc.Texture2D,e.initWithElement(a),e.handleLoadedTexture(),a=e,c.x=c.y=0,this._node._rect=cc.rect(0,0,c.width,c.height));return a};a._checkTextureBoundary=function(a,c,d){a&&a.url&&(d=c.y+c.height,c.x+c.width>a.width&&cc.error(cc._LogInfos.RectWidth,a.url),d>a.height&&cc.error(cc._LogInfos.RectHeight,
a.url))};a.rendering=function(a,c,d){var e=this._node,f=this._textureCoord,h=this._displayedOpacity/255,k=this._textureToRender||e._texture;if((!k||0!==f.width&&0!==f.height&&k._textureLoaded)&&0!==h){a=a||cc._renderContext;var m=a.getContext(),n=e._offsetPosition.x,p=e._rect.height,r=e._rect.width,s=-e._offsetPosition.y-p;a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(h);(e._flippedX||e._flippedY)&&a.save();e._flippedX&&(n=-n-r,m.scale(-1,1));
e._flippedY&&(s=e._offsetPosition.y,m.scale(1,-1));var t,w,v;this._colorized?t=h=0:(h=f.renderX,t=f.renderY);w=f.width;v=f.height;k&&k._htmlElementObj?(c=k._htmlElementObj,""!==k._pattern?(a.setFillStyle(m.createPattern(c,k._pattern)),m.fillRect(n,s,r,p)):m.drawImage(c,h,t,w,v,n,s,r,p)):(k=e._contentSize,f.validRect&&(f=this._displayedColor,a.setFillStyle("rgba("+f.r+","+f.g+","+f.b+",1)"),m.fillRect(n,s,k.width*c,k.height*d)));(e._flippedX||e._flippedY)&&a.restore();cc.g_NumberOfDraws++}};a._updateColor=
function(){var a=this._node._texture,c=this._textureCoord,d=this._displayedColor;a&&(255!==d.r||255!==d.g||255!==d.b?(this._textureToRender=a._generateColorTexture(d.r,d.g,d.b,c),this._colorized=!0):a&&(this._textureToRender=a,this._colorized=!1))};a._textureLoadedCallback=function(a){if(!this._textureLoaded){this._textureLoaded=!0;var c=this._rect,d=this._renderCmd;c?cc._rectEqualToZero(c)&&(c.width=a.width,c.height=a.height):c=cc.rect(0,0,a.width,a.height);this.texture=a;this.setTextureRect(c,this._rectRotated);
a=d._displayedColor;255===a.r&&255===a.g&&255===a.b||d._updateColor();this.setBatchNode(this._batchNode);this.dispatchEvent("load")}};a._setTextureCoords=function(a,c){void 0===c&&(c=!0);var d=this._textureCoord,e=c?cc.contentScaleFactor():1;d.renderX=d.x=0|a.x*e;d.renderY=d.y=0|a.y*e;d.width=0|a.width*e;d.height=0|a.height*e;d.validRect=!(0===d.width||0===d.height||0>d.x||0>d.y)};cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas=function(a,c,d){if(!a)return null;if(!c)return a;d=null==d?!0:d;var e=
document.createElement("canvas");e.width=c.width;e.height=c.height;var f=e.getContext("2d");f.translate(e.width/2,e.height/2);d?f.rotate(-1.5707963267948966):f.rotate(1.5707963267948966);f.drawImage(a,c.x,c.y,c.height,c.width,-c.height/2,-c.width/2,c.height,c.width);return e}})();(function(){cc.Sprite.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._vertices=[{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0}];this._color=new Uint32Array(1);this._recursiveDirty=this._dirty=!1;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};var a=cc.Sprite.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.Sprite.WebGLRenderCmd;a._spriteCmdCtor=cc.Sprite.WebGLRenderCmd;
a.updateBlendFunc=function(a){};a.setDirtyFlag=function(a){cc.Node.WebGLRenderCmd.prototype.setDirtyFlag.call(this,a);this._dirty=!0};a.setDirtyRecursively=function(a){this._dirty=this._recursiveDirty=a;for(var c=this._node._children,d,e=c?c.length:0,f=0;f<e;f++)d=c[f],d instanceof cc.Sprite&&d._renderCmd.setDirtyRecursively(a)};a._setBatchNodeForAddChild=function(a){var c=this._node;if(c._batchNode){if(!(a instanceof cc.Sprite))return cc.log(cc._LogInfos.Sprite_addChild),!1;a.texture._webTextureObj!==
c.textureAtlas.texture._webTextureObj&&cc.log(cc._LogInfos.Sprite_addChild_2);c._batchNode.appendChild(a);c._reorderChildDirty||c._setReorderChildDirtyRecursively()}return!0};a._handleTextureForRotatedTexture=function(a){return a};a.isFrameDisplayed=function(a){var c=this._node;return cc.rectEqualToRect(a.getRect(),c._rect)&&a.getTexture().getName()===c._texture.getName()&&cc.pointEqualToPoint(a.getOffset(),c._unflippedOffsetPositionFromCenter)};a._textureLoadedCallback=function(a){if(!this._textureLoaded){this._textureLoaded=
!0;var c=this._rect;c?cc._rectEqualToZero(c)&&(c.width=a.width,c.height=a.height):c=cc.rect(0,0,a.width,a.height);this.texture=a;this.setTextureRect(c,this._rectRotated);this.setBatchNode(this._batchNode);this.dispatchEvent("load");cc.renderer.childrenOrderDirty=!0}};a._setTextureCoords=function(a,c){void 0===c&&(c=!0);c&&(a=cc.rectPointsToPixels(a));var d=this._node,e=d._batchNode?d.textureAtlas.texture:d._texture,f=this._vertices;if(e){var h=e.pixelsWidth,k=e.pixelsHeight,m,n;d._rectRotated?(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?
(e=(2*a.x+1)/(2*h),h=e+(2*a.height-2)/(2*h),m=(2*a.y+1)/(2*k),k=m+(2*a.width-2)/(2*k)):(e=a.x/h,h=(a.x+a.height)/h,m=a.y/k,k=(a.y+a.width)/k),d._flippedX&&(n=m,m=k,k=n),d._flippedY&&(n=e,e=h,h=n),f[0].u=h,f[0].v=m,f[1].u=e,f[1].v=m,f[2].u=h,f[2].v=k,f[3].u=e):(cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(e=(2*a.x+1)/(2*h),h=e+(2*a.width-2)/(2*h),m=(2*a.y+1)/(2*k),k=m+(2*a.height-2)/(2*k)):(e=a.x/h,h=(a.x+a.width)/h,m=a.y/k,k=(a.y+a.height)/k),d._flippedX&&(n=e,e=h,h=n),d._flippedY&&(n=m,m=k,k=n),f[0].u=e,
f[0].v=m,f[1].u=e,f[1].v=k,f[2].u=h,f[2].v=m,f[3].u=h);f[3].v=k}};a._setColorDirty=function(){};a._updateBlendFunc=function(){if(this._batchNode)cc.log(cc._LogInfos.Sprite__updateBlendFunc);else{var a=this._node,c=a._blendFunc;a._texture&&a._texture.hasPremultipliedAlpha()?(c.src===cc.SRC_ALPHA&&c.dst===cc.BLEND_DST&&(c.src=cc.ONE),a.opacityModifyRGB=!0):(c.src===cc.ONE&&c.dst===cc.BLEND_DST&&(c.src=cc.SRC_ALPHA),a.opacityModifyRGB=!1)}};a._setTexture=function(a){var c=this._node;if(c._texture!==
a){c._textureLoaded=a?a._textureLoaded:!1;if(c._texture=a)a=a._contentSize,a=cc.rect(0,0,a.width,a.height),c.setTextureRect(a),this._updateBlendFunc();c._textureLoaded&&(cc.renderer.childrenOrderDirty=!0)}};a._checkTextureBoundary=function(a,c,d){a&&a.url&&(d?(d=c.x+c.height,c=c.y+c.width):(d=c.x+c.width,c=c.y+c.height),d>a.width&&cc.error(cc._LogInfos.RectWidth,a.url),c>a.height&&cc.error(cc._LogInfos.RectHeight,a.url))};a.transform=function(a,c){this.originTransform(a,c);var d=this._node,e=d._offsetPosition.x,
f=e+d._rect.width,h=d._offsetPosition.y,k=h+d._rect.height,m=this._worldTransform,d=m.tx,n=m.ty,p=e*m.a,e=e*m.b,r=f*m.a,f=f*m.b,s=k*m.c,k=k*m.d,t=h*m.c,h=h*m.d,m=this._vertices;m[0].x=p+s+d;m[0].y=e+k+n;m[1].x=p+t+d;m[1].y=e+h+n;m[2].x=r+s+d;m[2].y=f+k+n;m[3].x=r+t+d;m[3].y=f+h+n};a.needDraw=function(){var a=this._node._texture;return this._needDraw&&a};a.uploadData=function(a,c,d){var e=this._node,f=e._texture;if(!(f&&f._textureLoaded&&e._rect.width&&e._rect.height&&this._displayedOpacity))return 0;
var f=this._displayedOpacity,h=this._displayedColor.r,k=this._displayedColor.g,m=this._displayedColor.b;if(e._opacityModifyRGB)var n=f/255,h=h*n,k=k*n,m=m*n;this._color[0]=f<<24|m<<16|k<<8|h;e=e._vertexZ;f=this._vertices;h=f.length;m=d;for(d=0;d<h;++d)k=f[d],a[m]=k.x,a[m+1]=k.y,a[m+2]=e,c[m+3]=this._color[0],a[m+4]=k.u,a[m+5]=k.v,m+=6;return h}})();cc.SpriteBatchNode=cc.Node.extend({_blendFunc:null,_texture:null,_className:"SpriteBatchNode",ctor:function(a){cc.Node.prototype.ctor.call(this);this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);var b;cc.isString(a)?(b=cc.textureCache.getTextureForKey(a))||(b=cc.textureCache.addImage(a)):a instanceof cc.Texture2D&&(b=a);b&&this.initWithTexture(b)},addSpriteWithoutQuad:function(a,b,c){this.addChild(a,b,c);return this},getTextureAtlas:function(){return null},setTextureAtlas:function(a){},
getDescendants:function(){return this._children},initWithFile:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},init:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},increaseAtlasCapacity:function(){},removeChildAtIndex:function(a,b){this.removeChild(this._children[a],b)},rebuildIndexInOrder:function(a,b){return b},highestAtlasIndexInChild:function(a){var b=
a.children;return b&&0!==b.length?this.highestAtlasIndexInChild(b[b.length-1]):a.zIndex},lowestAtlasIndexInChild:function(a){var b=a.children;return b&&0!==b.length?this.lowestAtlasIndexInChild(b[b.length-1]):a.zIndex},atlasIndexForChild:function(a){return a.zIndex},reorderBatch:function(a){this._reorderChildDirty=a},setBlendFunc:function(a,b){this._blendFunc=void 0===b?a:{src:a,dst:b}},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},updateQuadFromSprite:function(a,
b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite_2);a instanceof cc.Sprite?(a.dirty=!0,a._renderCmd.transform(this._renderCmd,!0)):cc.log(cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite)},insertQuadFromSprite:function(a,b){this.addChild(a,b)},insertChild:function(a,b){this.addChild(a,b)},appendChild:function(a){this.sortAllChildren();this.addChild(a.lastLocalZOrder+1)},removeSpriteFromAtlas:function(a,b){this.removeChild(a,b)},initWithTexture:function(a){this.setTexture(a);return!0},
getTexture:function(){return this._texture},setTexture:function(a){this._texture=a;if(a._textureLoaded){var b,c=this._children,d=c.length;for(b=0;b<d;++b)c[b].setTexture(a)}else a.addEventListener("load",function(){var b,c=this._children,d=c.length;for(b=0;b<d;++b)c[b].setTexture(a)},this)},setShaderProgram:function(a){this._renderCmd.setShaderProgram(a);var b,c=this._children,d=c.length;for(b=0;b<d;++b)c[b].setShaderProgram(a)},addChild:function(a,b,c){cc.assert(void 0!==a,cc._LogInfos.CCSpriteBatchNode_addChild_3);
this._isValidChild(a)&&(b=void 0===b?a.zIndex:b,c=void 0===c?a.tag:c,cc.Node.prototype.addChild.call(this,a,b,c),this._renderCmd._shaderProgram&&(a.shaderProgram=this._renderCmd._shaderProgram))},_isValidChild:function(a){return a instanceof cc.Sprite?a.texture!==this._texture?(cc.log(cc._LogInfos.Sprite_addChild_5),!1):!0:(cc.log(cc._LogInfos.Sprite_addChild_4),!1)}});_p=cc.SpriteBatchNode.prototype;cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);
cc.defineGetterSetter(_p,"shaderProgram",_p.getShaderProgram,_p.setShaderProgram);cc.SpriteBatchNode.create=function(a){return new cc.SpriteBatchNode(a)};cc.SpriteBatchNode.createWithTexture=cc.SpriteBatchNode.create;cc.BakeSprite=cc.Sprite.extend({_cacheCanvas:null,_cacheContext:null,ctor:function(){cc.Sprite.prototype.ctor.call(this);var a=document.createElement("canvas");a.width=a.height=10;this._cacheCanvas=a;this._cacheContext=new cc.CanvasContextWrapper(a.getContext("2d"));var b=new cc.Texture2D;b.initWithElement(a);b.handleLoadedTexture();this.setTexture(b)},getCacheContext:function(){return this._cacheContext},getCacheCanvas:function(){return this._cacheCanvas},resetCanvasSize:function(a,b){var c=this._cacheCanvas,
d=this._cacheContext,e=d._context.strokeStyle,f=d._context.fillStyle;void 0===b&&(b=a.height,a=a.width);c.width=a;c.height=b;e!==d._context.strokeStyle&&(d._context.strokeStyle=e);f!==d._context.fillStyle&&(d._context.fillStyle=f);this.getTexture().handleLoadedTexture();this.setTextureRect(cc.rect(0,0,a,b),!1,null,!1)}});cc.AnimationFrame=cc.Class.extend({_spriteFrame:null,_delayPerUnit:0,_userInfo:null,ctor:function(a,b,c){this._spriteFrame=a||null;this._delayPerUnit=b||0;this._userInfo=c||null},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,
b,c){this._spriteFrame=a;this._delayPerUnit=b;this._userInfo=c;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.AnimationFrame.create=function(a,b,c){return new cc.AnimationFrame(a,b,c)};
cc.Animation=cc.Class.extend({_frames:null,_loops:0,_restoreOriginalFrame:!1,_duration:0,_delayPerUnit:0,_totalDelayUnits:0,ctor:function(a,b,c){this._frames=[];if(void 0===a)this.initWithSpriteFrames(null,0);else{var d=a[0];d&&(d instanceof cc.SpriteFrame?this.initWithSpriteFrames(a,b,c):d instanceof cc.AnimationFrame&&this.initWithAnimationFrames(a,b,c))}},getFrames:function(){return this._frames},setFrames:function(a){this._frames=a},addSpriteFrame:function(a){var b=new cc.AnimationFrame;b.initWithSpriteFrame(a,
1,null);this._frames.push(b);this._totalDelayUnits++},addSpriteFrameWithFile:function(a){a=cc.textureCache.addImage(a);var b=cc.rect(0,0,0,0);b.width=a.width;b.height=a.height;a=new cc.SpriteFrame(a,b);this.addSpriteFrame(a)},addSpriteFrameWithTexture:function(a,b){var c=new cc.SpriteFrame(a,b);this.addSpriteFrame(c)},initWithAnimationFrames:function(a,b,c){cc.arrayVerifyType(a,cc.AnimationFrame);this._delayPerUnit=b;this._loops=void 0===c?1:c;this._totalDelayUnits=0;b=this._frames;for(c=b.length=
0;c<a.length;c++){var d=a[c];b.push(d);this._totalDelayUnits+=d.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=[],b=0;b<this._frames.length;b++)a.push(this._frames[b].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,b,c){cc.arrayVerifyType(a,cc.SpriteFrame);this._loops=void 0===c?1:c;this._delayPerUnit=b||0;this._totalDelayUnits=0;b=this._frames;b.length=0;if(a){for(c=0;c<a.length;c++){var d=a[c],e=new cc.AnimationFrame;e.initWithSpriteFrame(d,1,null);b.push(e)}this._totalDelayUnits+=a.length}return!0},retain:function(){},release:function(){}});cc.Animation.create=function(a,b,c){return new cc.Animation(a,b,c)};cc.Animation.createWithAnimationFrames=cc.Animation.create;cc.animationCache={_animations:{},addAnimation:function(a,b){this._animations[b]=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,b){var c=a.animations;if(c){var d=1,e=a.properties;if(e)for(var d=null!=e.format?parseInt(e.format):d,e=e.spritesheets,f=cc.spriteFrameCache,h=cc.path,k=0;k<e.length;k++)f.addSpriteFrames(h.changeBasename(b,e[k]));switch(d){case 1:this._parseVersion1(c);
break;case 2:this._parseVersion2(c);break;default:cc.log(cc._LogInfos.animationCache__addAnimationsWithDictionary_2)}}else cc.log(cc._LogInfos.animationCache__addAnimationsWithDictionary)},addAnimations:function(a){cc.assert(a,cc._LogInfos.animationCache_addAnimations_2);var b=cc.loader.getRes(a);b?this._addAnimationsWithDictionary(b,a):cc.log(cc._LogInfos.animationCache_addAnimations)},_parseVersion1:function(a){var b=cc.spriteFrameCache,c;for(c in a){var d=a[c],e=d.frames,d=parseFloat(d.delay)||
0,f=null;if(e){for(var f=[],h=0;h<e.length;h++){var k=b.getSpriteFrame(e[h]);if(k){var m=new cc.AnimationFrame;m.initWithSpriteFrame(k,1,null);f.push(m)}else cc.log(cc._LogInfos.animationCache__parseVersion1_2,c,e[h])}0===f.length?cc.log(cc._LogInfos.animationCache__parseVersion1_3,c):(f.length!==e.length&&cc.log(cc._LogInfos.animationCache__parseVersion1_4,c),f=new cc.Animation(f,d,1),cc.animationCache.addAnimation(f,c))}else cc.log(cc._LogInfos.animationCache__parseVersion1,c)}},_parseVersion2:function(a){var b=
cc.spriteFrameCache,c;for(c in a){var d=a[c],e=d.loop,f=parseInt(d.loops),e=e?cc.REPEAT_FOREVER:isNaN(f)?1:f,f=d.restoreOriginalFrame&&!0==d.restoreOriginalFrame?!0:!1,h=d.frames;if(h){for(var k=[],m=0;m<h.length;m++){var n=h[m],p=n.spriteframe,r=b.getSpriteFrame(p);if(r){var p=parseFloat(n.delayUnits)||0,n=n.notification,s=new cc.AnimationFrame;s.initWithSpriteFrame(r,p,n);k.push(s)}else cc.log(cc._LogInfos.animationCache__parseVersion2_2,c,p)}d=parseFloat(d.delayPerUnit)||0;h=new cc.Animation;h.initWithAnimationFrames(k,
d,e);h.setRestoreOriginalFrame(f);cc.animationCache.addAnimation(h,c)}else cc.log(cc._LogInfos.animationCache__parseVersion2,c)}},_clear:function(){this._animations={}}};cc.SpriteFrame=cc.Class.extend({_offset:null,_originalSize:null,_rectInPixels:null,_rotated:!1,_rect:null,_offsetInPixels:null,_originalSizeInPixels:null,_texture:null,_textureFilename:"",_textureLoaded:!1,ctor:function(a,b,c,d,e){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;void 0!==a&&void 0!==b&&(void 0===c||void 0===d||void 0===e?
this.initWithTexture(a,b):this.initWithTexture(a,b,c,d,e))},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},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.rectPixelsToPoints(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.rectPointsToPixels(this._rect)},getOffsetInPixels:function(){return cc.p(this._offsetInPixels)},setOffsetInPixels:function(a){this._offsetInPixels.x=a.x;this._offsetInPixels.y=
a.y;cc._pointPixelsToPointsOut(this._offsetInPixels,this._offset)},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.addImage(this._textureFilename);a&&(this._textureLoaded=a.isLoaded());return a}return null},setTexture:function(a){if(this._texture!==a){var b=a.isLoaded();this._textureLoaded=b;this._texture=a;b||a.addEventListener("load",function(a){this._textureLoaded=!0;if(this._rotated&&cc._renderType===cc.game.RENDER_TYPE_CANVAS){var b=a.getHtmlElementObj(),b=cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(b,this.getRect()),e=new cc.Texture2D;e.initWithElement(b);e.handleLoadedTexture();this.setTexture(e);
b=this.getRect();this.setRect(cc.rect(0,0,b.width,b.height))}b=this._rect;0===b.width&&0===b.height&&(b=a.width,a=a.height,this._rect.width=b,this._rect.height=a,this._rectInPixels=cc.rectPointsToPixels(this._rect),this._originalSizeInPixels.width=this._rectInPixels.width,this._originalSizeInPixels.height=this._rectInPixels.height,this._originalSize.width=b,this._originalSize.height=a);this.dispatchEvent("load")},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.initWithTexture(this._textureFilename,this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels);a.setTexture(this._texture);return a},copyWithZone:function(){var a=new cc.SpriteFrame;a.initWithTexture(this._textureFilename,this._rectInPixels,this._rotated,this._offsetInPixels,this._originalSizeInPixels);a.setTexture(this._texture);return a},copy:function(){return this.copyWithZone()},initWithTexture:function(a,
b,c,d,e){2===arguments.length&&(b=cc.rectPointsToPixels(b));d=d||cc.p(0,0);e=e||b;c=c||!1;"string"===typeof a?(this._texture=null,this._textureFilename=a):a instanceof cc.Texture2D&&this.setTexture(a);a=this.getTexture();this._rectInPixels=b;this._rect=cc.rectPixelsToPoints(b);if(a&&a.url&&a.isLoaded()){var f,h;c?(f=b.x+b.height,h=b.y+b.width):(f=b.x+b.width,h=b.y+b.height);f>a.getPixelsWide()&&cc.error(cc._LogInfos.RectWidth,a.url);h>a.getPixelsHigh()&&cc.error(cc._LogInfos.RectHeight,a.url)}this._offsetInPixels.x=
d.x;this._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(d,this._offset);this._originalSizeInPixels.width=e.width;this._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(e,this._originalSize);this._rotated=c;return!0}});cc.EventHelper.prototype.apply(cc.SpriteFrame.prototype);cc.SpriteFrame.create=function(a,b,c,d,e){return new cc.SpriteFrame(a,b,c,d,e)};cc.SpriteFrame.createWithTexture=cc.SpriteFrame.create;
cc.SpriteFrame._frameWithTextureForCanvas=function(a,b,c,d,e){var f=new cc.SpriteFrame;f._texture=a;f._rectInPixels=b;f._rect=cc.rectPixelsToPoints(b);f._offsetInPixels.x=d.x;f._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(f._offsetInPixels,f._offset);f._originalSizeInPixels.width=e.width;f._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(f._originalSizeInPixels,f._originalSize);f._rotated=c;return f};cc.spriteFrameCache={_CCNS_REG1:/^\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*$/,_CCNS_REG2:/^\s*\{\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*,\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*\}\s*$/,_spriteFrames:{},_spriteFramesAliases:{},_frameConfigCache:{},_rectFromString:function(a){return(a=this._CCNS_REG2.exec(a))?cc.rect(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]),parseFloat(a[4])):cc.rect(0,0,0,0)},_pointFromString:function(a){return(a=this._CCNS_REG1.exec(a))?
cc.p(parseFloat(a[1]),parseFloat(a[2])):cc.p(0,0)},_sizeFromString:function(a){return(a=this._CCNS_REG1.exec(a))?cc.size(parseFloat(a[1]),parseFloat(a[2])):cc.size(0,0)},_getFrameConfig:function(a){var b=cc.loader.getRes(a);cc.assert(b,cc._LogInfos.spriteFrameCache__getFrameConfig_2,a);cc.loader.release(a);if(b._inited)return this._frameConfigCache[a]=b;this._frameConfigCache[a]=this._parseFrameConfig(b);return this._frameConfigCache[a]},_getFrameConfigByJsonObject:function(a,b){cc.assert(b,cc._LogInfos.spriteFrameCache__getFrameConfig_2,
a);this._frameConfigCache[a]=this._parseFrameConfig(b);return this._frameConfigCache[a]},_parseFrameConfig:function(a){var b=a.frames,c=a.metadata||a.meta;a={};var d={},e=0;c&&(e=c.format,e=1>=e.length?parseInt(e):e,d.image=c.textureFileName||c.textureFileName||c.image);for(var f in b){var h=b[f];if(h){c={};if(0==e){c.rect=cc.rect(h.x,h.y,h.width,h.height);c.rotated=!1;c.offset=cc.p(h.offsetX,h.offsetY);var k=h.originalWidth,h=h.originalHeight;k&&h||cc.log(cc._LogInfos.spriteFrameCache__getFrameConfig);
k=Math.abs(k);h=Math.abs(h);c.size=cc.size(k,h)}else if(1==e||2==e)c.rect=this._rectFromString(h.frame),c.rotated=h.rotated||!1,c.offset=this._pointFromString(h.offset),c.size=this._sizeFromString(h.sourceSize);else if(3==e){var k=this._sizeFromString(h.spriteSize),m=this._rectFromString(h.textureRect);k&&(m=cc.rect(m.x,m.y,k.width,k.height));c.rect=m;c.rotated=h.textureRotated||!1;c.offset=this._pointFromString(h.spriteOffset);c.size=this._sizeFromString(h.spriteSourceSize);c.aliases=h.aliases}else k=
h.frame,m=h.sourceSize,f=h.filename||f,c.rect=cc.rect(k.x,k.y,k.w,k.h),c.rotated=h.rotated||!1,c.offset=cc.p(0,0),c.size=cc.size(m.w,m.h);a[f]=c}}return{_inited:!0,frames:a,meta:d}},_addSpriteFramesByObject:function(a,b,c){cc.assert(a,cc._LogInfos.spriteFrameCache_addSpriteFrames_2);b&&b.frames&&(b=this._frameConfigCache[a]||this._getFrameConfigByJsonObject(a,b),this._createSpriteFrames(a,b,c))},_createSpriteFrames:function(a,b,c){var d=b.frames;b=b.meta;c?c instanceof cc.Texture2D||(cc.isString(c)?
c=cc.textureCache.addImage(c):cc.assert(0,cc._LogInfos.spriteFrameCache_addSpriteFrames_3)):(c=cc.path.changeBasename(a,b.image||".png"),c=cc.textureCache.addImage(c));a=this._spriteFramesAliases;b=this._spriteFrames;for(var e in d){var f=d[e],h=b[e];if(!h){h=new cc.SpriteFrame(c,cc.rect(f.rect),f.rotated,f.offset,f.size);if(f=f.aliases)for(var k=0,m=f.length;k<m;k++){var n=f[k];a[n]&&cc.log(cc._LogInfos.spriteFrameCache_addSpriteFrames,n);a[n]=e}cc._renderType===cc.game.RENDER_TYPE_CANVAS&&h.isRotated()&&
h.getTexture().isLoaded()&&(f=h.getTexture().getHtmlElementObj(),f=cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(f,h.getRectInPixels()),k=new cc.Texture2D,k.initWithElement(f),k.handleLoadedTexture(),h.setTexture(k),h.setRotated(!1),f=h._rect,h.setRect(cc.rect(0,0,f.width,f.height)));b[e]=h}}},addSpriteFrames:function(a,b){cc.assert(a,cc._LogInfos.spriteFrameCache_addSpriteFrames_2);var c=this._frameConfigCache[a]||cc.loader.getRes(a);c&&c.frames&&(c=this._frameConfigCache[a]||this._getFrameConfig(a),
this._createSpriteFrames(a,c,b))},_checkConflict:function(a){a=a.frames;for(var b in a)this._spriteFrames[b]&&cc.log(cc._LogInfos.spriteFrameCache__checkConflict,b)},addSpriteFrame:function(a,b){this._spriteFrames[b]=a},removeSpriteFrames:function(){this._spriteFrames={};this._spriteFramesAliases={}},removeSpriteFrameByName:function(a){a&&(this._spriteFramesAliases[a]&&delete this._spriteFramesAliases[a],this._spriteFrames[a]&&delete this._spriteFrames[a])},removeSpriteFramesFromFile:function(a){var b=
this._spriteFrames,c=this._spriteFramesAliases;if(a=this._frameConfigCache[a]){a=a.frames;for(var d in a)if(b[d]){delete b[d];for(var e in c)c[e]===d&&delete c[e]}}},removeSpriteFramesFromTexture:function(a){var b=this._spriteFrames,c=this._spriteFramesAliases,d;for(d in b){var e=b[d];if(e&&e.getTexture()===a){delete b[d];for(var f in c)c[f]===d&&delete c[f]}}},getSpriteFrame:function(a){var b=this._spriteFrames[a];if(!b){var c=this._spriteFramesAliases[a];c&&((b=this._spriteFrames[c.toString()])||
delete this._spriteFramesAliases[a])}return b},_clear:function(){this._spriteFrames={};this._spriteFramesAliases={};this._frameConfigCache={}}};cc.configuration={ERROR:0,STRING:1,INT:2,DOUBLE:3,BOOLEAN:4,_maxTextureSize:0,_maxModelviewStackDepth:0,_supportsPVRTC:!1,_supportsNPOT:!1,_supportsBGRA8888:!1,_supportsDiscardFramebuffer:!1,_supportsShareableVAO:!1,_maxSamplesAllowed:0,_maxTextureUnits:0,_GlExtensions:"",_valueDict:{},_inited:!1,_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;this._inited=
!0},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},supportsETC:function(){return!1},supportsS3TC:function(){return!1},supportsATITC:function(){return!1},supportsBGRA8888:function(){return this._supportsBGRA8888},supportsDiscardFramebuffer:function(){return this._supportsDiscardFramebuffer},
supportsShareableVAO:function(){return this._supportsShareableVAO},checkForGLExtension:function(a){return-1<this._GlExtensions.indexOf(a)},getValue:function(a,b){this._inited||this._init();var c=this._valueDict;return c[a]?c[a]:b},setValue:function(a,b){this._valueDict[a]=b},dumpInfo:function(){0===cc.ENABLE_GL_STATE_CACHE&&(cc.log(""),cc.log(cc._LogInfos.configuration_dumpInfo),cc.log(""))},gatherGPUInfo:function(){if(cc._renderType!==cc.game.RENDER_TYPE_CANVAS){this._inited||this._init();var a=
cc._renderContext,b=this._valueDict;b["gl.vendor"]=a.getParameter(a.VENDOR);b["gl.renderer"]=a.getParameter(a.RENDERER);b["gl.version"]=a.getParameter(a.VERSION);this._GlExtensions="";for(var c=a.getSupportedExtensions(),d=0;d<c.length;d++)this._GlExtensions+=c[d]+" ";this._maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE);b["gl.max_texture_size"]=this._maxTextureSize;this._maxTextureUnits=a.getParameter(a.MAX_COMBINED_TEXTURE_IMAGE_UNITS);b["gl.max_texture_units"]=this._maxTextureUnits;this._supportsPVRTC=
this.checkForGLExtension("GL_IMG_texture_compression_pvrtc");b["gl.supports_PVRTC"]=this._supportsPVRTC;this._supportsNPOT=!1;b["gl.supports_NPOT"]=this._supportsNPOT;this._supportsBGRA8888=this.checkForGLExtension("GL_IMG_texture_format_BGRA888");b["gl.supports_BGRA8888"]=this._supportsBGRA8888;this._supportsDiscardFramebuffer=this.checkForGLExtension("GL_EXT_discard_framebuffer");b["gl.supports_discard_framebuffer"]=this._supportsDiscardFramebuffer;this._supportsShareableVAO=this.checkForGLExtension("vertex_array_object");
b["gl.supports_vertex_array_object"]=this._supportsShareableVAO;cc.checkGLErrorDebug()}},loadConfigFile:function(a){this._inited||this._init();var b=cc.loader.getRes(a);if(!b)throw Error("Please load the resource first : "+a);cc.assert(b,cc._LogInfos.configuration_loadConfigFile_2,a);if(b=b.data)for(var c in b)this._valueDict[c]=b[c];else cc.log(cc._LogInfos.configuration_loadConfigFile,a)}};cc.g_NumberOfDraws=0;
cc.Director=cc.Class.extend({_landscape:!1,_nextDeltaTimeZero:!1,_paused:!1,_purgeDirectorInNextLoop:!1,_sendCleanupToScene:!1,_animationInterval:0,_oldAnimationInterval:0,_projection:0,_contentScaleFactor:1,_deltaTime:0,_winSizeInPoints:null,_lastUpdate:null,_nextScene:null,_notificationNode:null,_openGLView:null,_scenesStack:null,_projectionDelegate:null,_runningScene:null,_totalFrames:0,_secondsPerFrame:0,_dirtyRegion:null,_scheduler:null,_actionManager:null,_eventProjectionChanged:null,_eventAfterUpdate:null,
_eventAfterVisit:null,_eventAfterDraw:null,ctor:function(){var a=this;a._lastUpdate=Date.now();cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){a._lastUpdate=Date.now()})},init:function(){this._oldAnimationInterval=this._animationInterval=1/cc.defaultFPS;this._scenesStack=[];this._projection=cc.Director.PROJECTION_DEFAULT;this._projectionDelegate=null;this._totalFrames=0;this._lastUpdate=Date.now();this._purgeDirectorInNextLoop=this._paused=!1;this._winSizeInPoints=cc.size(0,0);this._openGLView=
null;this._contentScaleFactor=1;this._scheduler=new cc.Scheduler;cc.ActionManager?(this._actionManager=new cc.ActionManager,this._scheduler.scheduleUpdate(this._actionManager,cc.Scheduler.PRIORITY_SYSTEM,!1)):this._actionManager=null;this._eventAfterUpdate=new cc.EventCustom(cc.Director.EVENT_AFTER_UPDATE);this._eventAfterUpdate.setUserData(this);this._eventAfterVisit=new cc.EventCustom(cc.Director.EVENT_AFTER_VISIT);this._eventAfterVisit.setUserData(this);this._eventAfterDraw=new cc.EventCustom(cc.Director.EVENT_AFTER_DRAW);
this._eventAfterDraw.setUserData(this);this._eventProjectionChanged=new cc.EventCustom(cc.Director.EVENT_PROJECTION_CHANGED);this._eventProjectionChanged.setUserData(this);return!0},calculateDeltaTime:function(){var a=Date.now();this._nextDeltaTimeZero?(this._deltaTime=0,this._nextDeltaTimeZero=!1):this._deltaTime=(a-this._lastUpdate)/1E3;0<cc.game.config[cc.game.CONFIG_KEY.debugMode]&&0.2<this._deltaTime&&(this._deltaTime=1/60);this._lastUpdate=a},convertToGL:function(a){var b=document.documentElement,
c=cc.view,d=b.getBoundingClientRect();d.left+=window.pageXOffset-b.clientLeft;d.top+=window.pageYOffset-b.clientTop;b=c._devicePixelRatio*(a.x-d.left);a=c._devicePixelRatio*(d.top+d.height-a.y);return c._isRotated?{x:c._viewPortRect.width-a,y:b}:{x:b,y:a}},convertToUI:function(a){var b=document.documentElement,c=cc.view,d=b.getBoundingClientRect();d.left+=window.pageXOffset-b.clientLeft;d.top+=window.pageYOffset-b.clientTop;b={x:0,y:0};c._isRotated?(b.x=d.left+a.y/c._devicePixelRatio,b.y=d.top+d.height-
(c._viewPortRect.width-a.x)/c._devicePixelRatio):(b.x=d.left+a.x/c._devicePixelRatio,b.y=d.top+d.height-a.y/c._devicePixelRatio);return b},drawScene:function(){var a=cc.renderer;this.calculateDeltaTime();this._paused||(this._scheduler.update(this._deltaTime),cc.eventManager.dispatchEvent(this._eventAfterUpdate));this._nextScene&&this.setNextScene();this._runningScene&&(a.childrenOrderDirty?(cc.renderer.clearRenderCommands(),cc.renderer.assignedZ=0,this._runningScene._renderCmd._curLevel=0,this._runningScene.visit(),
a.resetFlag()):a.transformDirty()&&a.transform());a.clear();this._notificationNode&&this._notificationNode.visit();cc.eventManager.dispatchEvent(this._eventAfterVisit);cc.g_NumberOfDraws=0;a.rendering(cc._renderContext);this._totalFrames++;cc.eventManager.dispatchEvent(this._eventAfterDraw);cc.eventManager.frameUpdateListeners();this._calculateMPF()},end:function(){this._purgeDirectorInNextLoop=!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:null,getVisibleOrigin:null,getZEye:null,pause:function(){this._paused||(this._oldAnimationInterval=this._animationInterval,this.setAnimationInterval(0.25),this._paused=!0)},popScene:function(){cc.assert(this._runningScene,cc._LogInfos.Director_popScene);this._scenesStack.pop();
var a=this._scenesStack.length;0===a?this.end():(this._sendCleanupToScene=!0,this._nextScene=this._scenesStack[a-1])},purgeCachedData:function(){cc.animationCache._clear();cc.spriteFrameCache._clear();cc.textureCache._clear()},purgeDirector:function(){this.getScheduler().unscheduleAll();cc.eventManager&&cc.eventManager.setEnabled(!1);this._runningScene&&(this._runningScene._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),this._runningScene._performRecursive(cc.Node._stateCallbackType.onExit),
this._runningScene._performRecursive(cc.Node._stateCallbackType.cleanup));this._nextScene=this._runningScene=null;this._scenesStack.length=0;this.stopAnimation();this.purgeCachedData();cc.checkGLErrorDebug()},pushScene:function(a){cc.assert(a,cc._LogInfos.Director_pushScene);this._sendCleanupToScene=!1;this._scenesStack.push(a);this._nextScene=a},runScene:function(a){cc.assert(a,cc._LogInfos.Director_pushScene);if(this._runningScene){var b=this._scenesStack.length;0===b?(this._sendCleanupToScene=
!0,this._scenesStack[b]=a):(this._sendCleanupToScene=!0,this._scenesStack[b-1]=a);this._nextScene=a}else this.pushScene(a),this.startAnimation()},resume:function(){this._paused&&(this.setAnimationInterval(this._oldAnimationInterval),(this._lastUpdate=Date.now())||cc.log(cc._LogInfos.Director_resume),this._paused=!1,this._deltaTime=0)},setContentScaleFactor:function(a){a!==this._contentScaleFactor&&(this._contentScaleFactor=a)},setDepthTest:null,setClearColor:null,setDefaultValues:function(){},setNextDeltaTimeZero:function(a){this._nextDeltaTimeZero=
a},setNextScene:function(){var a=!1,b=!1;cc.TransitionScene&&(a=this._runningScene?this._runningScene instanceof cc.TransitionScene:!1,b=this._nextScene?this._nextScene instanceof cc.TransitionScene:!1);if(!b){if(b=this._runningScene)b._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),b._performRecursive(cc.Node._stateCallbackType.onExit);this._sendCleanupToScene&&b&&b._performRecursive(cc.Node._stateCallbackType.cleanup)}this._runningScene=this._nextScene;cc.renderer.childrenOrderDirty=
!0;this._nextScene=null;a||null===this._runningScene||(this._runningScene._performRecursive(cc.Node._stateCallbackType.onEnter),this._runningScene._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish))},setNotificationNode:function(a){cc.renderer.childrenOrderDirty=!0;this._notificationNode&&(this._notificationNode._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),this._notificationNode._performRecursive(cc.Node._stateCallbackType.onExit),this._notificationNode._performRecursive(cc.Node._stateCallbackType.cleanup));
if(this._notificationNode=a)this._notificationNode._performRecursive(cc.Node._stateCallbackType.onEnter),this._notificationNode._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)},getDelegate:function(){return this._projectionDelegate},setDelegate:function(a){this._projectionDelegate=a},setOpenGLView:null,setProjection:null,setViewport:null,getOpenGLView:null,getProjection:null,setAlphaBlending:null,isSendCleanupToScene:function(){return this._sendCleanupToScene},getRunningScene:function(){return this._runningScene},
getAnimationInterval:function(){return this._animationInterval},isDisplayStats:function(){return cc.profiler?cc.profiler.isShowingStats():!1},setDisplayStats:function(a){cc.profiler&&(a?cc.profiler.showStats():cc.profiler.hideStats())},getSecondsPerFrame:function(){return this._secondsPerFrame},isNextDeltaTimeZero:function(){return this._nextDeltaTimeZero},isPaused:function(){return this._paused},getTotalFrames:function(){return this._totalFrames},popToRootScene:function(){this.popToSceneStackLevel(1)},
popToSceneStackLevel:function(a){cc.assert(this._runningScene,cc._LogInfos.Director_popToSceneStackLevel_2);var b=this._scenesStack,c=b.length;if(0===a)this.end();else if(!(a>=c)){for(;c>a;){var d=b.pop();d.running&&(d._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),d._performRecursive(cc.Node._stateCallbackType.onExit));d._performRecursive(cc.Node._stateCallbackType.cleanup);c--}this._nextScene=b[b.length-1];this._sendCleanupToScene=!0}},getScheduler:function(){return this._scheduler},
setScheduler:function(a){this._scheduler!==a&&(this._scheduler=a)},getActionManager:function(){return this._actionManager},setActionManager:function(a){this._actionManager!==a&&(this._actionManager=a)},getDeltaTime:function(){return this._deltaTime},_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3}});cc.Director.EVENT_PROJECTION_CHANGED="director_projection_changed";cc.Director.EVENT_AFTER_UPDATE="director_after_update";cc.Director.EVENT_AFTER_VISIT="director_after_visit";
cc.Director.EVENT_AFTER_DRAW="director_after_draw";cc.DisplayLinkDirector=cc.Director.extend({invalid:!1,startAnimation:function(){this._nextDeltaTimeZero=!0;this.invalid=!1},mainLoop:function(){this._purgeDirectorInNextLoop?(this._purgeDirectorInNextLoop=!1,this.purgeDirector()):this.invalid||this.drawScene()},stopAnimation:function(){this.invalid=!0},setAnimationInterval:function(a){this._animationInterval=a;this.invalid||(this.stopAnimation(),this.startAnimation())}});
cc.Director.sharedDirector=null;cc.Director.firstUseDirector=!0;cc.Director._getInstance=function(){cc.Director.firstUseDirector&&(cc.Director.firstUseDirector=!1,cc.Director.sharedDirector=new cc.DisplayLinkDirector,cc.Director.sharedDirector.init());return cc.Director.sharedDirector};cc.defaultFPS=60;cc.Director.PROJECTION_2D=0;cc.Director.PROJECTION_3D=1;cc.Director.PROJECTION_CUSTOM=3;cc.Director.PROJECTION_DEFAULT=cc.Director.PROJECTION_3D;cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.Director.prototype;a.getProjection=function(a){return this._projection};a.setProjection=function(a){this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged)};a.setDepthTest=function(){};a.setClearColor=function(a){cc.renderer._clearColor=a;cc.renderer._clearFillStyle="rgb("+a.r+","+a.g+","+a.b+")"};a.setOpenGLView=function(a){this._winSizeInPoints.width=
cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;cc.eventManager&&cc.eventManager.setEnabled(!0)};a.getVisibleSize=function(){return this.getWinSize()};a.getVisibleOrigin=function(){return cc.p(0,0)}}else cc.Director._fpsImage=new Image,cc.Director._fpsImage.addEventListener("load",function(){cc.Director._fpsImageLoaded=!0}),cc._fpsImage&&(cc.Director._fpsImage.src=cc._fpsImage)});cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){cc.DirectorDelegate=cc.Class.extend({updateProjection:function(){}});var a=cc.Director.prototype,b=function(a){if(a&&a._renderCmd){a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);var d=a._children;for(a=0;a<d.length;a++)b(d[a])}};cc.eventManager.addCustomListener(cc.Director.EVENT_PROJECTION_CHANGED,function(){for(var a=cc.director._scenesStack,d=0;d<a.length;d++)b(a[d])});
a.setProjection=function(a){var b=this._winSizeInPoints;this.setViewport();var e=this._openGLView,f=e._viewPortRect.x/e._scaleX,h=e._viewPortRect.y/e._scaleY;switch(a){case cc.Director.PROJECTION_2D:cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();e=cc.math.Matrix4.createOrthographicProjection(0,b.width,0,b.height,-1024,1024);cc.kmGLMultMatrix(e);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();break;case cc.Director.PROJECTION_3D:var k=this.getZEye(),m=new cc.math.Matrix4,
e=new cc.math.Matrix4;cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();m=cc.math.Matrix4.createPerspectiveProjection(60,b.width/b.height,0.1,2*k);cc.kmGLMultMatrix(m);k=new cc.math.Vec3(-f+b.width/2,-h+b.height/2,k);b=new cc.math.Vec3(-f+b.width/2,-h+b.height/2,0);f=new cc.math.Vec3(0,1,0);e.lookAt(k,b,f);cc.kmGLMultMatrix(e);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();break;case cc.Director.PROJECTION_CUSTOM:this._projectionDelegate&&this._projectionDelegate.updateProjection();
break;default:cc.log(cc._LogInfos.Director_setProjection)}this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged);cc.setProjectionMatrixDirty();cc.renderer.childrenOrderDirty=!0};a.setDepthTest=function(a){cc.renderer.setDepthTest(a)};a.setClearColor=function(a){cc.renderer._clearColor=a};a.setOpenGLView=function(a){this._winSizeInPoints.width=cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;a=cc.configuration;a.gatherGPUInfo();a.dumpInfo();
this.setGLDefaultValues();cc.eventManager&&cc.eventManager.setEnabled(!0)};a.getVisibleSize=function(){return this._openGLView.getVisibleSize()};a.getVisibleOrigin=function(){return this._openGLView.getVisibleOrigin()};a.getZEye=function(){return this._winSizeInPoints.height/1.1546999375};a.setViewport=function(){var a=this._openGLView;if(a){var b=this._winSizeInPoints;a.setViewPortInPoints(-a._viewPortRect.x/a._scaleX,-a._viewPortRect.y/a._scaleY,b.width,b.height)}};a.getOpenGLView=function(){return this._openGLView};
a.getProjection=function(){return this._projection};a.setAlphaBlending=function(a){a?cc.glBlendFunc(cc.BLEND_SRC,cc.BLEND_DST):cc.glBlendFunc(cc._renderContext.ONE,cc._renderContext.ZERO)};a.setGLDefaultValues=function(){this.setAlphaBlending(!0);this.setProjection(this._projection);cc._renderContext.clearColor(0,0,0,0)}}});(function(){var a=function(a,b,c,d,e,f,h){this.prev=a;this.next=b;this.callback=c;this.target=d;this.priority=e;this.paused=f;this.markedForDeletion=h},b=[];a.get=function(c,d,e,f,h,k,w){var v=b.pop();v?(v.prev=c,v.next=d,v.callback=e,v.target=f,v.priority=h,v.paused=k,v.markedForDeletion=w):v=new a(c,d,e,f,h,k,w);return v};a.put=function(a){a.prev=null;a.next=null;a.callback=null;a.target=null;a.priority=0;a.paused=!1;a.markedForDeletion=!1;20>b.length&&b.push(a)};var c=function(a,b,c,d){this.list=
a;this.entry=b;this.target=c;this.callback=d},d=[];c.get=function(a,b,e,f){var h=d.pop();h?(h.list=a,h.entry=b,h.target=e,h.callback=f):h=new c(a,b,e,f);return h};c.put=function(a){a.list=null;a.entry=null;a.target=null;a.callback=null;20>d.length&&d.push(a)};var e=function(a,b,c,d,e,f){this.timers=a;this.target=b;this.timerIndex=c;this.currentTimer=d;this.currentTimerSalvaged=e;this.paused=f},f=[];e.get=function(a,b,c,d,h,k){var w=f.pop();w?(w.timers=a,w.target=b,w.timerIndex=c,w.currentTimer=d,
w.currentTimerSalvaged=h,w.paused=k):w=new e(a,b,c,d,h,k);return w};e.put=function(a){a.timers=null;a.target=null;a.timerIndex=0;a.currentTimer=null;a.currentTimerSalvaged=!1;a.paused=!1;20>f.length&&f.push(a)};var h=function(){this._scheduler=null;this._elapsed=-1;this._useDelay=this._runForever=!1;this._interval=this._delay=this._repeat=this._timesExecuted=0;this._key=this._callback=this._target=null};cc.inject({initWithCallback:function(a,b,c,d,e,f,h){this._scheduler=a;this._target=c;this._callback=
b;h&&(this._key=h);this._elapsed=-1;this._interval=d;this._delay=f;this._useDelay=0<this._delay;this._repeat=e;this._runForever=this._repeat===cc.REPEAT_FOREVER;return!0},getInterval:function(){return this._interval},setInterval:function(a){this._interval=a},update:function(a){-1===this._elapsed?this._timesExecuted=this._elapsed=0:(this._elapsed+=a,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),
this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},getCallback:function(){return this._callback},getKey:function(){return this._key},trigger:function(){this._target&&this._callback&&this._callback.call(this._target,this._elapsed)},cancel:function(){this._scheduler.unschedule(this._callback,this._target)}},h.prototype);
var k=[];h.get=function(){return k.pop()||new h};h.put=function(a){a._scheduler=null;a._elapsed=-1;a._runForever=!1;a._useDelay=!1;a._timesExecuted=0;a._repeat=0;a._delay=0;a._interval=0;a._target=null;a._callback=null;a._key=null;20>k.length&&k.push(a)};cc.Scheduler=cc.Class.extend({_timeScale:1,_updatesNegList:null,_updates0List:null,_updatesPosList:null,_hashForTimers:null,_arrayForTimers:null,_hashForUpdates:null,_currentTarget:null,_currentTargetSalvaged:!1,_updateHashLocked:!1,ctor:function(){this._timeScale=
1;this._updatesNegList=[];this._updates0List=[];this._updatesPosList=[];this._hashForUpdates={};this._hashForTimers={};this._currentTarget=null;this._updateHashLocked=this._currentTargetSalvaged=!1;this._arrayForTimers=[]},_schedulePerFrame:function(a,b,c,d){var e=this._hashForUpdates[b.__instanceId];if(e&&e.entry)if(e.entry.priority!==c){if(this._updateHashLocked){cc.log("warning: you CANNOT change update priority in scheduled function");e.entry.markedForDeletion=!1;e.entry.paused=d;return}this.unscheduleUpdate(b)}else{e.entry.markedForDeletion=
!1;e.entry.paused=d;return}0===c?this._appendIn(this._updates0List,a,b,d):0>c?this._priorityIn(this._updatesNegList,a,b,c,d):this._priorityIn(this._updatesPosList,a,b,c,d)},_removeHashElement:function(a){delete this._hashForTimers[a.target.__instanceId];for(var b=this._arrayForTimers,c=0,d=b.length;c<d;c++)if(b[c]===a){b.splice(c,1);break}e.put(a)},_removeUpdateFromHash:function(b){if(b=this._hashForUpdates[b.target.__instanceId]){for(var d=b.list,e=b.entry,f=0,h=d.length;f<h;f++)if(d[f]===e){d.splice(f,
1);break}delete this._hashForUpdates[b.target.__instanceId];a.put(e);c.put(b)}},_priorityIn:function(b,d,e,f,h){d=a.get(null,null,d,e,f,h,!1);if(b){h=b.length-1;for(var k=0;k<=h&&!(f<b[k].priority);k++);b.splice(k,0,d)}else b=[],b.push(d);this._hashForUpdates[e.__instanceId]=c.get(b,d,e,null);return b},_appendIn:function(b,d,e,f){d=a.get(null,null,d,e,0,f,!1);b.push(d);this._hashForUpdates[e.__instanceId]=c.get(b,d,e,null,null)},setTimeScale:function(a){this._timeScale=a},getTimeScale:function(){return this._timeScale},
update:function(a){this._updateHashLocked=!0;1!==this._timeScale&&(a*=this._timeScale);var b,c,d,e;b=0;c=this._updatesNegList;for(d=c.length;b<d;b++)e=c[b],e.paused||e.markedForDeletion||e.callback(a);b=0;c=this._updates0List;for(d=c.length;b<d;b++)e=c[b],e.paused||e.markedForDeletion||e.callback(a);b=0;c=this._updatesPosList;for(d=c.length;b<d;b++)e=c[b],e.paused||e.markedForDeletion||e.callback(a);d=this._arrayForTimers;for(b=0;b<d.length;b++){this._currentTarget=c=d[b];this._currentTargetSalvaged=
!1;if(!c.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)}b=0;for(c=this._updatesNegList;b<c.length;)e=c[b],e.markedForDeletion?this._removeUpdateFromHash(e):b++;b=0;for(c=this._updates0List;b<c.length;)e=c[b],e.markedForDeletion?this._removeUpdateFromHash(e):
b++;b=0;for(c=this._updatesPosList;b<c.length;)e=c[b],e.markedForDeletion?this._removeUpdateFromHash(e):b++;this._updateHashLocked=!1;this._currentTarget=null},scheduleCallbackForTarget:function(a,b,c,d,e,f){this.schedule(b,a,c,d,e,f,a.__instanceId+"")},schedule:function(a,b,c,d,f,k,w){if("function"!==typeof a){var v=a;a=b;b=v}if(4===arguments.length||5===arguments.length)w=f,k=d,d=cc.REPEAT_FOREVER,f=0;void 0===w&&(w=b.__instanceId+"");cc.assert(b,cc._LogInfos.Scheduler_scheduleCallbackForTarget_3);
(v=this._hashForTimers[b.__instanceId])?cc.assert(v.paused===k,""):(v=e.get(null,b,0,null,null,k),this._arrayForTimers.push(v),this._hashForTimers[b.__instanceId]=v);var y,x;if(null==v.timers)v.timers=[];else for(x=0;x<v.timers.length;x++)if(y=v.timers[x],a===y._callback){cc.log(cc._LogInfos.Scheduler_scheduleCallbackForTarget,y.getInterval().toFixed(4),c.toFixed(4));y._interval=c;return}y=h.get();y.initWithCallback(this,a,b,c,d,f,w);v.timers.push(y)},scheduleUpdate:function(a,b,c){this._schedulePerFrame(function(b){a.update(b)},
a,b,c)},_getUnscheduleMark:function(a,b){switch(typeof a){case "number":case "string":return a===b._key;case "function":return a===b._callback}},unschedule:function(a,b){if(b&&a){var c=this._hashForTimers[b.__instanceId];if(c)for(var d=c.timers,e=0,f=d.length;e<f;e++){var k=d[e];if(this._getUnscheduleMark(a,k)){k!==c.currentTimer||c.currentTimerSalvaged||(c.currentTimerSalvaged=!0);d.splice(e,1);h.put(k);c.timerIndex>=e&&c.timerIndex--;0===d.length&&(this._currentTarget===c?this._currentTargetSalvaged=
!0:this._removeHashElement(c));break}}}},unscheduleUpdate:function(a){a&&(a=this._hashForUpdates[a.__instanceId])&&(this._updateHashLocked?a.entry.markedForDeletion=!0:this._removeUpdateFromHash(a.entry))},unscheduleAllForTarget:function(a){if(a){var b=this._hashForTimers[a.__instanceId];if(b){var c=b.timers;-1<c.indexOf(b.currentTimer)&&!b.currentTimerSalvaged&&(b.currentTimerSalvaged=!0);for(var d=0,e=c.length;d<e;d++)h.put(c[d]);c.length=0;this._currentTarget===b?this._currentTargetSalvaged=!0:
this._removeHashElement(b)}this.unscheduleUpdate(a)}},unscheduleAll:function(){this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},unscheduleAllWithMinPriority:function(a){var b,c,d=this._arrayForTimers;for(b=d.length-1;0<=b;b--)c=d[b],this.unscheduleAllForTarget(c.target);d=0;if(0>a)for(b=0;b<this._updatesNegList.length;)d=this._updatesNegList.length,(c=this._updatesNegList[b])&&c.priority>=a&&this.unscheduleUpdate(c.target),d==this._updatesNegList.length&&b++;if(0>=a)for(b=0;b<this._updates0List.length;)d=
this._updates0List.length,(c=this._updates0List[b])&&this.unscheduleUpdate(c.target),d==this._updates0List.length&&b++;for(b=0;b<this._updatesPosList.length;)d=this._updatesPosList.length,(c=this._updatesPosList[b])&&c.priority>=a&&this.unscheduleUpdate(c.target),d==this._updatesPosList.length&&b++},isScheduled:function(a,b){cc.assert(a,"Argument callback must not be empty");cc.assert(b,"Argument target must be non-nullptr");var c=this._hashForTimers[b.__instanceId];if(!c)return!1;if(null!=c.timers)for(var c=
c.timers,d=0;d<c.length;++d)if(a===c[d]._callback)return!0;return!1},pauseAllTargets:function(){return this.pauseAllTargetsWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},pauseAllTargetsWithMinPriority:function(a){var b=[],c,d=this._arrayForTimers,e,f;e=0;for(f=d.length;e<f;e++)if(c=d[e])c.paused=!0,b.push(c.target);if(0>a)for(e=0;e<this._updatesNegList.length;e++)(c=this._updatesNegList[e])&&c.priority>=a&&(c.paused=!0,b.push(c.target));if(0>=a)for(e=0;e<this._updates0List.length;e++)if(c=this._updates0List[e])c.paused=
!0,b.push(c.target);for(e=0;e<this._updatesPosList.length;e++)(c=this._updatesPosList[e])&&c.priority>=a&&(c.paused=!0,b.push(c.target));return b},resumeTargets:function(a){if(a)for(var b=0;b<a.length;b++)this.resumeTarget(a[b])},pauseTarget:function(a){cc.assert(a,cc._LogInfos.Scheduler_pauseTarget);var b=this._hashForTimers[a.__instanceId];b&&(b.paused=!0);(a=this._hashForUpdates[a.__instanceId])&&(a.entry.paused=!0)},resumeTarget:function(a){cc.assert(a,cc._LogInfos.Scheduler_resumeTarget);var b=
this._hashForTimers[a.__instanceId];b&&(b.paused=!1);(a=this._hashForUpdates[a.__instanceId])&&(a.entry.paused=!1)},isTargetPaused:function(a){cc.assert(a,cc._LogInfos.Scheduler_isTargetPaused);var b=this._hashForTimers[a.__instanceId];return b?b.paused:(a=this._hashForUpdates[a.__instanceId])?a.entry.paused:!1},scheduleUpdateForTarget:function(a,b,c){this.scheduleUpdate(a,b,c)},unscheduleCallbackForTarget:function(a,b){this.unschedule(b,a)},unscheduleUpdateForTarget:function(a){this.unscheduleUpdate(a)},
unscheduleAllCallbacksForTarget:function(a){this.unschedule(a.__instanceId+"",a)},unscheduleAllCallbacks:function(){this.unscheduleAllWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},unscheduleAllCallbacksWithMinPriority:function(a){this.unscheduleAllWithMinPriority(a)}});cc.Scheduler.PRIORITY_SYSTEM=-2147483648;cc.Scheduler.PRIORITY_NON_SYSTEM=cc.Scheduler.PRIORITY_SYSTEM+1})();cc.PI2=2*Math.PI;
cc.DrawingPrimitiveCanvas=cc.Class.extend({_cacheArray:[],_renderContext:null,ctor:function(a){this._renderContext=a},drawPoint:function(a,b){b||(b=1);var c=this._renderContext.getContext();c.beginPath();c.arc(a.x,-a.y,b,0,2*Math.PI,!1);c.closePath();c.fill()},drawPoints:function(a,b,c){if(null!=a){c||(c=1);b=this._renderContext.getContext();b.beginPath();for(var d=0,e=a.length;d<e;d++)b.arc(a[d].x,-a[d].y,c,0,2*Math.PI,!1);b.closePath();b.fill()}},drawLine:function(a,b){var c=this._renderContext.getContext();c.beginPath();
c.moveTo(a.x,-a.y);c.lineTo(b.x,-b.y);c.closePath();c.stroke()},drawRect:function(a,b){this.drawLine(cc.p(a.x,a.y),cc.p(b.x,a.y));this.drawLine(cc.p(b.x,a.y),cc.p(b.x,b.y));this.drawLine(cc.p(b.x,b.y),cc.p(a.x,b.y));this.drawLine(cc.p(a.x,b.y),cc.p(a.x,a.y))},drawSolidRect:function(a,b,c){a=[a,cc.p(b.x,a.y),b,cc.p(a.x,b.y)];this.drawSolidPoly(a,4,c)},drawPoly:function(a,b,c,d){d=d||!1;if(null!=a){if(3>a.length)throw Error("Polygon's point must greater than 2");var e=a[0];b=this._renderContext.getContext();
b.beginPath();b.moveTo(e.x,-e.y);for(var e=1,f=a.length;e<f;e++)b.lineTo(a[e].x,-a[e].y);c&&b.closePath();d?b.fill():b.stroke()}},drawSolidPoly:function(a,b,c){this.setDrawColor(c.r,c.g,c.b,c.a);this.drawPoly(a,b,!0,!0)},drawCircle:function(a,b,c,d,e){e=e||!1;d=this._renderContext.getContext();d.beginPath();d.arc(0|a.x,0|-a.y,b,-c,-(c-2*Math.PI),!1);e&&d.lineTo(0|a.x,0|-a.y);d.stroke()},drawQuadBezier:function(a,b,c,d){for(var e=this._cacheArray,f=e.length=0,h=0;h<d;h++){var k=Math.pow(1-f,2)*a.x+
2*(1-f)*f*b.x+f*f*c.x,m=Math.pow(1-f,2)*a.y+2*(1-f)*f*b.y+f*f*c.y;e.push(cc.p(k,m));f+=1/d}e.push(cc.p(c.x,c.y));this.drawPoly(e,d+1,!1,!1)},drawCubicBezier:function(a,b,c,d,e){for(var f=this._cacheArray,h=f.length=0,k=0;k<e;k++){var m=Math.pow(1-h,3)*a.x+3*Math.pow(1-h,2)*h*b.x+3*(1-h)*h*h*c.x+h*h*h*d.x,n=Math.pow(1-h,3)*a.y+3*Math.pow(1-h,2)*h*b.y+3*(1-h)*h*h*c.y+h*h*h*d.y;f.push(cc.p(m,n));h+=1/e}f.push(cc.p(d.x,d.y));this.drawPoly(f,e+1,!1,!1)},drawCatmullRom:function(a,b){this.drawCardinalSpline(a,
0.5,b)},drawCardinalSpline:function(a,b,c){cc._renderContext.setStrokeStyle("rgba(255,255,255,1)");var d=this._cacheArray;d.length=0;for(var e,f,h=1/a.length,k=0;k<c+1;k++)f=k/c,1===f?(e=a.length-1,f=1):(e=0|f/h,f=(f-h*e)/h),e=cc.CardinalSplineAt(cc.getControlPointAt(a,e-1),cc.getControlPointAt(a,e-0),cc.getControlPointAt(a,e+1),cc.getControlPointAt(a,e+2),b,f),d.push(e);this.drawPoly(d,c+1,!1,!1)},drawImage:function(a,b,c,d,e){var f=arguments.length,h=this._renderContext.getContext();switch(f){case 2:h.drawImage(a,
b.x,-(b.y+a.height));break;case 3:h.drawImage(a,b.x,-(b.y+c.height),c.width,c.height);break;case 5:h.drawImage(a,b.x,b.y,c.width,c.height,d.x,-(d.y+e.height),e.width,e.height);break;default:throw Error("Argument must be non-nil");}},drawStar:function(a,b,c){a=a||this._renderContext;var d=a.getContext();c="rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b);a.setFillStyle(c+",1)");var e=b/10;d.beginPath();d.moveTo(-b,b);d.lineTo(0,e);d.lineTo(b,b);d.lineTo(e,0);d.lineTo(b,-b);d.lineTo(0,-e);d.lineTo(-b,-b);d.lineTo(-e,
0);d.lineTo(-b,b);d.closePath();d.fill();var f=d.createRadialGradient(0,0,e,0,0,b);f.addColorStop(0,c+", 1)");f.addColorStop(0.3,c+", 0.8)");f.addColorStop(1,c+", 0.0)");a.setFillStyle(f);d.beginPath();d.arc(0,0,b-e,0,cc.PI2,!1);d.closePath();d.fill()},drawColorBall:function(a,b,c){a=a||this._renderContext;var d=a.getContext();c="rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b);var e=d.createRadialGradient(0,0,b/10,0,0,b);e.addColorStop(0,c+", 1)");e.addColorStop(0.3,c+", 0.8)");e.addColorStop(0.6,c+", 0.4)");
e.addColorStop(1,c+", 0.0)");a.setFillStyle(e);d.beginPath();d.arc(0,0,b,0,cc.PI2,!1);d.closePath();d.fill()},fillText:function(a,b,c){this._renderContext.getContext().fillText(a,b,-c)},setDrawColor:function(a,b,c,d){this._renderContext.setFillStyle("rgba("+a+","+b+","+c+","+d/255+")");this._renderContext.setStrokeStyle("rgba("+a+","+b+","+c+","+d/255+")")},setPointSize:function(a){},setLineWidth:function(a){this._renderContext.getContext().lineWidth=a}});cc.DrawingPrimitiveWebGL=cc.Class.extend({_renderContext:null,_initialized:!1,_shader:null,_colorLocation:"u_color",_colorArray:null,_pointSizeLocation:"u_pointSize",_pointSize:-1,ctor:function(a){null==a&&(a=cc._renderContext);if(!a instanceof WebGLRenderingContext)throw Error("Can't initialise DrawingPrimitiveWebGL. context need is WebGLRenderingContext");this._renderContext=a;this._colorArray=new Float32Array([1,1,1,1])},lazy_init:function(){this._initialized||(this._shader=cc.shaderCache.programForKey(cc.SHADER_POSITION_UCOLOR),
this._shader._addUniformLocation(this._colorLocation),this._shader._addUniformLocation(this._pointSizeLocation),this._glProgramState=cc.GLProgramState.getOrCreateWithGLProgram(this._shader),this._initialized=!0)},drawInit:function(){this._initialized=!1},drawPoint:function(a){this.lazy_init();var b=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,
this._colorArray);this._shader.setUniformLocationWith1f(this._pointSizeLocation,this._pointSize);var c=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,c);b.bufferData(b.ARRAY_BUFFER,new Float32Array([a.x,a.y]),b.STATIC_DRAW);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,0,0);b.drawArrays(b.POINTS,0,1);b.deleteBuffer(c);cc.incrementGLDraws(1)},drawPoints:function(a,b){if(a&&0!==a.length){this.lazy_init();var c=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();
c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);this._shader.setUniformLocationWith1f(this._pointSizeLocation,this._pointSize);var 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.POINTS,0,a.length);c.deleteBuffer(d);cc.incrementGLDraws(1)}},_pointsToTypeArray:function(a){for(var b=
new Float32Array(2*a.length),c=0;c<a.length;c++)b[2*c]=a[c].x,b[2*c+1]=a[c].y;return b},drawLine:function(a,b){this.lazy_init();var c=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);var d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d);c.bufferData(c.ARRAY_BUFFER,this._pointsToTypeArray([a,b]),c.STATIC_DRAW);
c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,0);c.drawArrays(c.LINES,0,2);c.deleteBuffer(d);cc.incrementGLDraws(1)},drawRect:function(a,b){this.drawLine(cc.p(a.x,a.y),cc.p(b.x,a.y));this.drawLine(cc.p(b.x,a.y),cc.p(b.x,b.y));this.drawLine(cc.p(b.x,b.y),cc.p(a.x,b.y));this.drawLine(cc.p(a.x,b.y),cc.p(a.x,a.y))},drawSolidRect:function(a,b,c){a=[a,cc.p(b.x,a.y),b,cc.p(a.x,b.y)];this.drawSolidPoly(a,4,c)},drawPoly:function(a,b,c){this.lazy_init();b=this._renderContext;this._glProgramState.apply();
this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);var d=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d);b.bufferData(b.ARRAY_BUFFER,this._pointsToTypeArray(a),b.STATIC_DRAW);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,0,0);c?b.drawArrays(b.LINE_LOOP,0,a.length):b.drawArrays(b.LINE_STRIP,0,a.length);b.deleteBuffer(d);cc.incrementGLDraws(1)},
drawSolidPoly:function(a,b,c){this.lazy_init();c&&this.setDrawColor(c.r,c.g,c.b,c.a);b=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);c=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,c);b.bufferData(b.ARRAY_BUFFER,this._pointsToTypeArray(a),b.STATIC_DRAW);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,
b.FLOAT,!1,0,0);b.drawArrays(b.TRIANGLE_FAN,0,a.length);b.deleteBuffer(c);cc.incrementGLDraws(1)},drawCircle:function(a,b,c,d,e){this.lazy_init();var f=1;e&&f++;var h=2*Math.PI/d;if(e=new Float32Array(2*(d+2))){for(var k=0;k<=d;k++){var m=k*h,n=b*Math.cos(m+c)+a.x,m=b*Math.sin(m+c)+a.y;e[2*k]=n;e[2*k+1]=m}e[2*(d+1)]=a.x;e[2*(d+1)+1]=a.y;a=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);
this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b);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+f);a.deleteBuffer(b);cc.incrementGLDraws(1)}},drawQuadBezier:function(a,b,c,d){this.lazy_init();for(var e=new Float32Array(2*(d+1)),f=0,h=0;h<d;h++)e[2*h]=Math.pow(1-f,2)*a.x+2*(1-f)*f*b.x+f*f*c.x,e[2*h+1]=Math.pow(1-f,2)*a.y+2*(1-f)*
f*b.y+f*f*c.y,f+=1/d;e[2*d]=c.x;e[2*d+1]=c.y;a=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b);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(b);
cc.incrementGLDraws(1)},drawCubicBezier:function(a,b,c,d,e){this.lazy_init();for(var f=new Float32Array(2*(e+1)),h=0,k=0;k<e;k++)f[2*k]=Math.pow(1-h,3)*a.x+3*Math.pow(1-h,2)*h*b.x+3*(1-h)*h*h*c.x+h*h*h*d.x,f[2*k+1]=Math.pow(1-h,3)*a.y+3*Math.pow(1-h,2)*h*b.y+3*(1-h)*h*h*c.y+h*h*h*d.y,h+=1/e;f[2*e]=d.x;f[2*e+1]=d.y;a=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,
this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b);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(b);cc.incrementGLDraws(1)},drawCatmullRom:function(a,b){this.drawCardinalSpline(a,0.5,b)},drawCardinalSpline:function(a,b,c){this.lazy_init();for(var d=new Float32Array(2*(c+1)),e,f,h=1/a.length,k=0;k<c+1;k++)f=k/c,1===f?(e=a.length-1,f=1):(e=0|f/h,f=(f-h*e)/h),e=cc.cardinalSplineAt(cc.getControlPointAt(a,
e-1),cc.getControlPointAt(a,e),cc.getControlPointAt(a,e+1),cc.getControlPointAt(a,e+2),b,f),d[2*k]=e.x,d[2*k+1]=e.y;a=this._renderContext;this._glProgramState.apply();this._shader.setUniformForModelViewAndProjectionMatrixWithMat4();a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);this._shader.setUniformLocationWith4fv(this._colorLocation,this._colorArray);b=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b);a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,
2,a.FLOAT,!1,0,0);a.drawArrays(a.LINE_STRIP,0,c+1);a.deleteBuffer(b);cc.incrementGLDraws(1)},setDrawColor:function(a,b,c,d){this._colorArray[0]=a/255;this._colorArray[1]=b/255;this._colorArray[2]=c/255;this._colorArray[3]=d/255},setPointSize:function(a){this._pointSize=a*cc.contentScaleFactor()},setLineWidth:function(a){this._renderContext.lineWidth&&this._renderContext.lineWidth(a)}});cc._tmp.PrototypeLabelTTF=function(){var a=cc.LabelTTF.prototype;cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"string",a.getString,a.setString);cc.defineGetterSetter(a,"textAlign",a.getHorizontalAlignment,a.setHorizontalAlignment);cc.defineGetterSetter(a,"verticalAlign",a.getVerticalAlignment,a.setVerticalAlignment);cc.defineGetterSetter(a,"fontSize",a.getFontSize,a.setFontSize);cc.defineGetterSetter(a,
"fontName",a.getFontName,a.setFontName);cc.defineGetterSetter(a,"font",a._getFont,a._setFont);cc.defineGetterSetter(a,"boundingWidth",a._getBoundingWidth,a._setBoundingWidth);cc.defineGetterSetter(a,"boundingHeight",a._getBoundingHeight,a._setBoundingHeight);cc.defineGetterSetter(a,"fillStyle",a._getFillStyle,a.setFontFillColor);cc.defineGetterSetter(a,"strokeStyle",a._getStrokeStyle,a._setStrokeStyle);cc.defineGetterSetter(a,"lineWidth",a._getLineWidth,a._setLineWidth);cc.defineGetterSetter(a,"shadowOffsetX",
a._getShadowOffsetX,a._setShadowOffsetX);cc.defineGetterSetter(a,"shadowOffsetY",a._getShadowOffsetY,a._setShadowOffsetY);cc.defineGetterSetter(a,"shadowOpacity",a._getShadowOpacity,a._setShadowOpacity);cc.defineGetterSetter(a,"shadowBlur",a._getShadowBlur,a._setShadowBlur)};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,_onCacheCanvasMode:!0,_shadowEnabled:!1,_shadowOffset:null,_shadowOpacity:0,_shadowBlur:0,_shadowColor:null,_strokeEnabled:!1,_strokeColor:null,_strokeSize:0,_textFillColor:null,_strokeShadowOffsetX:0,_strokeShadowOffsetY:0,_needUpdateTexture:!1,_lineWidths:null,_className:"LabelTTF",_fontStyle:"normal",_fontWeight:"normal",
_lineHeight:"normal",initWithString:function(a,b,c,d,e,f){a=a?a+"":"";c=c||16;d=d||cc.size(0,0);e=e||cc.TEXT_ALIGNMENT_LEFT;f=f||cc.VERTICAL_TEXT_ALIGNMENT_TOP;this._opacityModifyRGB=!1;this._dimensions=cc.size(d.width,d.height);this._fontName=b||"Arial";this._hAlignment=e;this._vAlignment=f;this._fontSize=c;this._renderCmd._setFontStyle(this._fontName,c,this._fontStyle,this._fontWeight);this.string=a;this._renderCmd._setColorsString();this._renderCmd._updateTexture();this._setUpdateTextureDirty();
this._scaleX=this._scaleY=1/cc.view.getDevicePixelRatio();return!0},_setUpdateTextureDirty:function(){this._needUpdateTexture=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.textDirty)},ctor:function(a,b,c,d,e,f){cc.Sprite.prototype.ctor.call(this);this._dimensions=cc.size(0,0);this._hAlignment=cc.TEXT_ALIGNMENT_LEFT;this._vAlignment=cc.VERTICAL_TEXT_ALIGNMENT_TOP;this._opacityModifyRGB=!1;this._fontName="Arial";this._shadowEnabled=!1;this._shadowOffset=cc.p(0,0);this._shadowBlur=this._shadowOpacity=
0;this._strokeEnabled=!1;this._strokeColor=cc.color(255,255,255,255);this._strokeSize=0;this._textFillColor=cc.color(255,255,255,255);this._strokeShadowOffsetY=this._strokeShadowOffsetX=0;this._needUpdateTexture=!1;this._lineWidths=[];this._renderCmd._setColorsString();this._textureLoaded=!0;b&&b instanceof cc.FontDefinition?this.initWithStringAndTextDefinition(a,b):cc.LabelTTF.prototype.initWithString.call(this,a,b,c,d,e,f)},init:function(){return this.initWithString(" ",this._fontName,this._fontSize)},
description:function(){return"\x3ccc.LabelTTF | FontName \x3d"+this._fontName+" FontSize \x3d "+this._fontSize.toFixed(1)+"\x3e"},getLineHeight:function(){return!this._lineHeight||this._lineHeight.charAt?this._renderCmd._getFontClientHeight():this._lineHeight||this._renderCmd._getFontClientHeight()},setLineHeight:function(a){this._lineHeight=a},getString:function(){return this._string},getHorizontalAlignment:function(){return this._hAlignment},getVerticalAlignment:function(){return this._vAlignment},
getDimensions:function(){return cc.size(this._dimensions)},getFontSize:function(){return this._fontSize},getFontName:function(){return this._fontName},initWithStringAndTextDefinition:function(a,b){this._updateWithTextDefinition(b,!1);this.string=a;return!0},setTextDefinition:function(a){a&&this._updateWithTextDefinition(a,!0)},getTextDefinition:function(){return this._prepareTextDefinition(!1)},enableShadow:function(a,b,c,d){null!=a.r&&null!=a.g&&null!=a.b&&null!=a.a?this._enableShadow(a,b,c):this._enableShadowNoneColor(a,
b,c,d)},_enableShadowNoneColor:function(a,b,c,d){c=c||0.5;!1===this._shadowEnabled&&(this._shadowEnabled=!0);var e=this._shadowOffset;if(e&&e.x!==a||e._y!==b)e.x=a,e.y=b;this._shadowOpacity!==c&&(this._shadowOpacity=c);this._renderCmd._setColorsString();this._shadowBlur!==d&&(this._shadowBlur=d);this._setUpdateTextureDirty()},_enableShadow:function(a,b,c){this._shadowColor||(this._shadowColor=cc.color(255,255,255,128));this._shadowColor.r=a.r;this._shadowColor.g=a.g;this._shadowColor.b=a.b;this._enableShadowNoneColor(b.width||
b.x||0,b.height||b.y||0,null!=a.a?a.a/255:0.5,c)},_getShadowOffsetX:function(){return this._shadowOffset.x},_setShadowOffsetX:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOffset.x!==a&&(this._shadowOffset.x=a,this._setUpdateTextureDirty())},_getShadowOffsetY:function(){return this._shadowOffset._y},_setShadowOffsetY:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOffset._y!==a&&(this._shadowOffset._y=a,this._setUpdateTextureDirty())},_getShadowOffset:function(){return cc.p(this._shadowOffset.x,
this._shadowOffset.y)},_setShadowOffset:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);if(this._shadowOffset.x!==a.x||this._shadowOffset.y!==a.y)this._shadowOffset.x=a.x,this._shadowOffset.y=a.y,this._setUpdateTextureDirty()},_getShadowOpacity:function(){return this._shadowOpacity},_setShadowOpacity:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOpacity!==a&&(this._shadowOpacity=a,this._renderCmd._setColorsString(),this._setUpdateTextureDirty())},_getShadowBlur:function(){return this._shadowBlur},
_setShadowBlur:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowBlur!==a&&(this._shadowBlur=a,this._setUpdateTextureDirty())},disableShadow:function(){this._shadowEnabled&&(this._shadowEnabled=!1,this._setUpdateTextureDirty())},enableStroke:function(a,b){!1===this._strokeEnabled&&(this._strokeEnabled=!0);var c=this._strokeColor;if(c.r!==a.r||c.g!==a.g||c.b!==a.b)c.r=a.r,c.g=a.g,c.b=a.b,this._renderCmd._setColorsString();this._strokeSize!==b&&(this._strokeSize=b||0);this._setUpdateTextureDirty()},
_getStrokeStyle:function(){return this._strokeColor},_setStrokeStyle:function(a){!1===this._strokeEnabled&&(this._strokeEnabled=!0);var b=this._strokeColor;if(b.r!==a.r||b.g!==a.g||b.b!==a.b)b.r=a.r,b.g=a.g,b.b=a.b,this._renderCmd._setColorsString(),this._setUpdateTextureDirty()},_getLineWidth:function(){return this._strokeSize},_setLineWidth:function(a){!1===this._strokeEnabled&&(this._strokeEnabled=!0);this._strokeSize!==a&&(this._strokeSize=a||0,this._setUpdateTextureDirty())},disableStroke:function(){this._strokeEnabled&&
(this._strokeEnabled=!1,this._setUpdateTextureDirty())},setFontFillColor:function(a){var b=this._textFillColor;if(b.r!==a.r||b.g!==a.g||b.b!==a.b)b.r=a.r,b.g=a.g,b.b=a.b,this._renderCmd._setColorsString(),this._needUpdateTexture=!0},_getFillStyle:function(){return this._textFillColor},_updateWithTextDefinition:function(a,b){a.fontDimensions?(this._dimensions.width=a.boundingWidth,this._dimensions.height=a.boundingHeight):(this._dimensions.width=0,this._dimensions.height=0);this._hAlignment=a.textAlign;
this._vAlignment=a.verticalAlign;this._fontName=a.fontName;this._fontSize=a.fontSize||12;this._lineHeight=a.lineHeight?a.lineHeight:this._fontSize;this._renderCmd._setFontStyle(a);a.shadowEnabled&&this.enableShadow(a.shadowOffsetX,a.shadowOffsetY,a.shadowOpacity,a.shadowBlur);a.strokeEnabled&&this.enableStroke(a.strokeStyle,a.lineWidth);this.setFontFillColor(a.fillStyle);b&&this._renderCmd._updateTexture();var c=cc.Node._dirtyFlags;this._renderCmd.setDirtyFlag(c.colorDirty|c.opacityDirty|c.textDirty)},
_prepareTextDefinition:function(a){var b=new cc.FontDefinition;a?(b.fontSize=this._fontSize,b.boundingWidth=cc.contentScaleFactor()*this._dimensions.width,b.boundingHeight=cc.contentScaleFactor()*this._dimensions.height):(b.fontSize=this._fontSize,b.boundingWidth=this._dimensions.width,b.boundingHeight=this._dimensions.height);b.fontName=this._fontName;b.textAlign=this._hAlignment;b.verticalAlign=this._vAlignment;if(this._strokeEnabled){b.strokeEnabled=!0;var c=this._strokeColor;b.strokeStyle=cc.color(c.r,
c.g,c.b);b.lineWidth=this._strokeSize}else b.strokeEnabled=!1;this._shadowEnabled?(b.shadowEnabled=!0,b.shadowBlur=this._shadowBlur,b.shadowOpacity=this._shadowOpacity,b.shadowOffsetX=(a?cc.contentScaleFactor():1)*this._shadowOffset.x,b.shadowOffsetY=(a?cc.contentScaleFactor():1)*this._shadowOffset.y):b._shadowEnabled=!1;a=this._textFillColor;b.fillStyle=cc.color(a.r,a.g,a.b);return b},getScale:function(){this._scaleX!==this._scaleY&&cc.log(cc._LogInfos.Node_getScale);return this._scaleX*cc.view.getDevicePixelRatio()},
setScale:function(a,b){var c=cc.view.getDevicePixelRatio();this._scaleX=a/c;this._scaleY=(b||0===b?b:a)/c;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleX:function(){return this._scaleX*cc.view.getDevicePixelRatio()},setScaleX:function(a){this._scaleX=a/cc.view.getDevicePixelRatio();this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleY:function(){return this._scaleY*cc.view.getDevicePixelRatio()},setScaleY:function(a){this._scaleY=a/cc.view.getDevicePixelRatio();
this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setString:function(a){a=String(a);this._originalText!==a&&(this._originalText=a+"",this._updateString(),this._setUpdateTextureDirty(),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty))},_updateString:function(){this._string&&""!==this._string||this._string===this._originalText||(cc.renderer.childrenOrderDirty=!0);this._string=this._originalText},setHorizontalAlignment:function(a){a!==this._hAlignment&&(this._hAlignment=
a,this._setUpdateTextureDirty())},setVerticalAlignment:function(a){a!==this._vAlignment&&(this._vAlignment=a,this._setUpdateTextureDirty())},setDimensions:function(a,b){var c;void 0===b?(c=a.width,b=a.height):c=a;if(c!==this._dimensions.width||b!==this._dimensions.height)this._dimensions.width=c,this._dimensions.height=b,this._updateString(),this._setUpdateTextureDirty()},_getBoundingWidth:function(){return this._dimensions.width},_setBoundingWidth:function(a){a!==this._dimensions.width&&(this._dimensions.width=
a,this._updateString(),this._setUpdateTextureDirty())},_getBoundingHeight:function(){return this._dimensions.height},_setBoundingHeight:function(a){a!==this._dimensions.height&&(this._dimensions.height=a,this._updateString(),this._setUpdateTextureDirty())},setFontSize:function(a){this._fontSize!==a&&(this._fontSize=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},setFontName:function(a){this._fontName&&this._fontName!==
a&&(this._fontName=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFont:function(){return this._renderCmd._getFontStyle()},_setFont:function(a){if(a=cc.LabelTTF._fontStyleRE.exec(a))this._fontSize=parseInt(a[1]),this._fontName=a[2],this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty()},getContentSize:function(){this._needUpdateTexture&&this._renderCmd._updateTTF();
var a=cc.view.getDevicePixelRatio();return cc.size(this._contentSize.width/a,this._contentSize.height/a)},_getWidth:function(){this._needUpdateTexture&&this._renderCmd._updateTTF();return this._contentSize.width/cc.view.getDevicePixelRatio()},_getHeight:function(){this._needUpdateTexture&&this._renderCmd._updateTTF();return this._contentSize.height/cc.view.getDevicePixelRatio()},setTextureRect:function(a,b,c){this._rectRotated=b||!1;this.setContentSize(c||a);b=this._rect;b.x=a.x;b.y=a.y;b.width=a.width;
b.height=a.height;this._renderCmd._setTextureCoords(a,!1);c=this._unflippedOffsetPositionFromCenter.x;var d=this._unflippedOffsetPositionFromCenter.y;this._flippedX&&(c=-c);this._flippedY&&(d=-d);this._offsetPosition.x=c+(a.width-b.width)/2;this._offsetPosition.y=d+(a.height-b.height)/2},setDrawMode:function(a){this._onCacheCanvasMode=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.LabelTTF.WebGLRenderCmd(this):this._onCacheCanvasMode?new cc.LabelTTF.CacheCanvasRenderCmd(this):
new cc.LabelTTF.CanvasRenderCmd(this)},_setFontStyle:function(a){this._fontStyle!==a&&(this._fontStyle=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFontStyle:function(){return this._fontStyle},_setFontWeight:function(a){this._fontWeight!==a&&(this._fontWeight=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFontWeight:function(){return this._fontWeight}});
cc.assert(cc.isFunction(cc._tmp.PrototypeLabelTTF),cc._LogInfos.MissingFile,"LabelTTFPropertyDefine.js");cc._tmp.PrototypeLabelTTF();delete cc._tmp.PrototypeLabelTTF;cc.LabelTTF._fontStyleRE=/^(\d+)px\s+['"]?([\w\s\d]+)['"]?$/;cc.LabelTTF.create=function(a,b,c,d,e,f){return new cc.LabelTTF(a,b,c,d,e,f)};cc.LabelTTF.createWithFontDefinition=cc.LabelTTF.create;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?document.body.appendChild(cc.LabelTTF.__labelHeightDiv):window.addEventListener("load",function(){this.removeEventListener("load",arguments.callee,!1);document.body.appendChild(cc.LabelTTF.__labelHeightDiv)},!1);
cc.LabelTTF.__getFontHeightByDiv=function(a,b){var c,d=cc.LabelTTF.__labelHeightDiv;if(a instanceof cc.FontDefinition){c=cc.LabelTTF.__fontHeightCache[a._getCanvasFontStr()];if(0<c)return c;d.innerHTML="ajghl~!";d.style.fontFamily=a.fontName;d.style.fontSize=a.fontSize+"px";d.style.fontStyle=a.fontStyle;d.style.fontWeight=a.fontWeight;c=d.clientHeight;cc.LabelTTF.__fontHeightCache[a._getCanvasFontStr()]=c}else{c=cc.LabelTTF.__fontHeightCache[a+"."+b];if(0<c)return c;d.innerHTML="ajghl~!";d.style.fontFamily=
a;d.style.fontSize=b+"px";c=d.clientHeight;cc.LabelTTF.__fontHeightCache[a+"."+b]=c}d.innerHTML="";return c};cc.LabelTTF.__fontHeightCache={};cc.LabelTTF._textAlign=["left","center","right"];cc.LabelTTF._textBaseline=["top","middle","bottom"];cc.LabelTTF.wrapInspection=!0;cc.LabelTTF._wordRex=/([a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045]+|\S)/;cc.LabelTTF._symbolRex=/^[!,.:;}\]%\?>\u3001\u2018\u201c\u300b\u00bb\uff1f\u3002\uff0c\uff01\u2010\u2032-\u2034\u203a\u203c\u2046\u2047-\u2049]/;cc.LabelTTF._lastWordRex=/([a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045]+|\S)$/;
cc.LabelTTF._lastEnglish=/[a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045]+$/;cc.LabelTTF._firsrEnglish=/^[a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045]/;
(function(){cc.LabelTTF.RenderCmd=function(){this._fontClientHeight=18;this._fontStyleStr="";this._shadowColorStr="rgba(128, 128, 128, 0.5)";this._strokeColorStr="";this._fillColorStr="rgba(255,255,255,1)";this._labelContext=this._labelCanvas=null;this._lineWidths=[];this._strings=[];this._isMultiLine=!1;this._status=[];this._renderingIndex=0;this._canUseDirtyRegion=!0};var a=cc.LabelTTF.RenderCmd.prototype;a.constructor=cc.LabelTTF.RenderCmd;a._labelCmdCtor=cc.LabelTTF.RenderCmd;a._setFontStyle=
function(a,b,e,f){if(a instanceof cc.FontDefinition)this._fontStyleStr=a._getCanvasFontStr(),this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a);else{var h=b*cc.view.getDevicePixelRatio();this._fontStyleStr=e+" "+f+" "+h+"px '"+a+"'";this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(a,b)}};a._getFontStyle=function(){return this._fontStyleStr};a._getFontClientHeight=function(){return this._fontClientHeight};a._updateColor=function(){this._setColorsString();this._updateTexture()};a._setColorsString=
function(){var a=this._displayedColor,b=this._node,e=b._shadowColor||this._displayedColor,f=b._strokeColor,h=b._textFillColor,k=a.r/255,m=a.g/255,a=a.b/255;this._shadowColorStr="rgba("+(0|k*e.r)+","+(0|m*e.g)+","+(0|a*e.b)+","+b._shadowOpacity+")";this._fillColorStr="rgba("+(0|k*h.r)+","+(0|m*h.g)+","+(0|a*h.b)+", 1)";this._strokeColorStr="rgba("+(0|k*f.r)+","+(0|m*f.g)+","+(0|a*f.b)+", 1)"};var b=new cc.Rect;a.getLocalBB=function(){var a=this._node;b.x=b.y=0;var d=cc.view.getDevicePixelRatio();b.width=
a._getWidth()*d;b.height=a._getHeight()*d;return b};a._updateTTF=function(){var a=this._node,b=cc.view.getDevicePixelRatio(),e=a._dimensions.width*b,f,h,k=this._lineWidths;k.length=0;this._isMultiLine=!1;this._measureConfig();var m={};if(0!==e)for(this._strings=a._string.split("\n"),f=0;f<this._strings.length;f++)this._checkWarp(this._strings,f,e);else for(this._strings=a._string.split("\n"),f=0,h=this._strings.length;f<h;f++)if(this._strings[f]){var n=this._measure(this._strings[f]);k.push(n);m[this._strings[f]]=
n}else k.push(0);1<this._strings.length&&(this._isMultiLine=!0);h=f=0;a._strokeEnabled&&(f=h=2*a._strokeSize);a._shadowEnabled&&(n=a._shadowOffset,f+=2*Math.abs(n.x),h+=2*Math.abs(n.y));0===e?this._isMultiLine?b=cc.size(Math.ceil(Math.max.apply(Math,k)+f),Math.ceil(this._fontClientHeight*b*this._strings.length+h)):(n=m[a._string],!n&&a._string&&(n=this._measure(a._string)),b=cc.size(Math.ceil((n?n:0)+f),Math.ceil(this._fontClientHeight*b+h))):b=0===a._dimensions.height?this._isMultiLine?cc.size(Math.ceil(e+
f),Math.ceil(a.getLineHeight()*b*this._strings.length+h)):cc.size(Math.ceil(e+f),Math.ceil(a.getLineHeight()*b+h)):cc.size(Math.ceil(e+f),Math.ceil(a._dimensions.height*b+h));"normal"!==a._getFontStyle()&&(b.width=Math.ceil(b.width+0.3*a._fontSize));a.setContentSize(b);a._strokeShadowOffsetX=f;a._strokeShadowOffsetY=h;a=a._anchorPoint;this._anchorPointInPoints.x=0.5*f+(b.width-f)*a.x;this._anchorPointInPoints.y=0.5*h+(b.height-h)*a.y};a._saveStatus=function(){var a=this._node,b=cc.view.getDevicePixelRatio(),
e=a._strokeShadowOffsetX,f=a._strokeShadowOffsetY,h=a._contentSize.height-f,k=a._vAlignment,m=a._hAlignment,n=0.5*e,f=h+0.5*f,p=0,r=0,s=[],e=a._contentSize.width-e,a=a.getLineHeight()*b,b=(a-this._fontClientHeight*b)/2,p=m===cc.TEXT_ALIGNMENT_RIGHT?p+e:m===cc.TEXT_ALIGNMENT_CENTER?p+e/2:p+0;if(this._isMultiLine)for(m=this._strings.length,k===cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?r=a-2*b+h-a*m:k===cc.VERTICAL_TEXT_ALIGNMENT_CENTER&&(r=(a-2*b)/2+(h-a*m)/2),k=0;k<m;k++)s.push(-h+(a*k+b)+r);else k!==cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM&&
(r=k===cc.VERTICAL_TEXT_ALIGNMENT_TOP?r-h:r-0.5*h),s.push(r);h={contextTransform:cc.p(n,f),xOffset:p,OffsetYArray:s};this._status.push(h)};a._drawTTFInCanvas=function(a){if(a){var b=this._status.pop();a.setTransform(1,0,0,1,b.contextTransform.x,b.contextTransform.y);this.drawLabels(a,b.xOffset,b.OffsetYArray)}};a._checkWarp=function(a,b,e){var f=a[b],h=this._measure(f);if(h>e&&1<f.length){for(var k=e/h*f.length|0,m=f.substr(k),n=h-this._measure(m),p,r=0,s=0;n>e&&100>s++;)k*=e/n,k|=0,m=f.substr(k),
n=h-this._measure(m);for(s=0;n<e&&100>s++;)m&&(r=(p=cc.LabelTTF._wordRex.exec(m))?p[0].length:1,p=m),k+=r,m=f.substr(k),n=h-this._measure(m);k-=r;0===k&&(k=1,p=p.substr(1));e=f.substr(0,k);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(p||m)&&(h=cc.LabelTTF._lastWordRex.exec(e),k-=h?h[0].length:0,0===k&&(k=1),p=f.substr(k),e=f.substr(0,k));cc.LabelTTF._firsrEnglish.test(p)&&(h=cc.LabelTTF._lastEnglish.exec(e))&&e!==h[0]&&(k-=h[0].length,p=f.substr(k),e=f.substr(0,k));a[b]=p||m;a.splice(b,
0,e)}};a.updateStatus=function(){this._dirtyFlag&cc.Node._dirtyFlags.textDirty&&this._updateTexture();this.originUpdateStatus()};a._syncStatus=function(a){var b=cc.Node._dirtyFlags,e=this._dirtyFlag;e&b.textDirty&&this._updateTexture();this._originSyncStatus(a);(cc._renderType===cc.game.RENDER_TYPE_WEBGL||e&b.transformDirty)&&this.transform(a)};a.drawLabels=function(a,b,e){var f=this._node;if(f._shadowEnabled){var h=f._shadowOffset;a.shadowColor=this._shadowColorStr;a.shadowOffsetX=h.x;a.shadowOffsetY=
-h.y;a.shadowBlur=f._shadowBlur}var h=f._hAlignment,k=f._vAlignment,m=f._strokeSize;a.font!==this._fontStyleStr&&(a.font=this._fontStyleStr);a.fillStyle=this._fillColorStr;if(f=f._strokeEnabled)a.lineWidth=2*m,a.strokeStyle=this._strokeColorStr;a.textBaseline=cc.LabelTTF._textBaseline[k];a.textAlign=cc.LabelTTF._textAlign[h];h=this._strings.length;for(k=0;k<h;k++)m=this._strings[k],f&&(a.lineJoin="round",a.strokeText(m,b,e[k])),a.fillText(m,b,e[k]);cc.g_NumberOfDraws++}})();
(function(){cc.LabelTTF.CacheRenderCmd=function(){this._labelCmdCtor();var a=this._labelCanvas=document.createElement("canvas");a.width=1;a.height=1;this._labelContext=a.getContext("2d")};cc.LabelTTF.CacheRenderCmd.prototype=Object.create(cc.LabelTTF.RenderCmd.prototype);cc.inject(cc.LabelTTF.RenderCmd.prototype,cc.LabelTTF.CacheRenderCmd.prototype);var a=cc.LabelTTF.CacheRenderCmd.prototype;a.constructor=cc.LabelTTF.CacheRenderCmd;a._cacheCmdCtor=cc.LabelTTF.CacheRenderCmd;a._updateTexture=function(){this._dirtyFlag^=
this._dirtyFlag&cc.Node._dirtyFlags.textDirty;var a=this._node;a._needUpdateTexture=!1;var c=a._contentSize;this._updateTTF();var d=c.width,e=c.height,f=this._labelContext,h=this._labelCanvas;if(!a._texture){var k=new cc.Texture2D;k.initWithElement(this._labelCanvas);a.setTexture(k)}if(0===a._string.length)return h.width=1,h.height=c.height||1,a._texture&&(a._texture._htmlElementObj=this._labelCanvas,a._texture.handleLoadedTexture()),a.setTextureRect(cc.rect(0,0,1,c.height)),!0;f.font=this._fontStyleStr;
c=h.width===d&&h.height===e;h.width=d;h.height=e;c&&f.clearRect(0,0,d,e);this._saveStatus();this._drawTTFInCanvas(f);a._texture&&(a._texture._htmlElementObj=this._labelCanvas,a._texture.handleLoadedTexture());a.setTextureRect(cc.rect(0,0,d,e));return!0};a._measureConfig=function(){this._labelContext.font=this._fontStyleStr};a._measure=function(a){return a?this._labelContext.measureText(a).width:0}})();
(function(){cc.LabelTTF.CacheCanvasRenderCmd=function(a){this._spriteCmdCtor(a);this._cacheCmdCtor()};var a=cc.LabelTTF.CacheCanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(cc.LabelTTF.CacheRenderCmd.prototype,a);a.constructor=cc.LabelTTF.CacheCanvasRenderCmd})();
(function(){cc.LabelTTF.CanvasRenderCmd=function(a){this._spriteCmdCtor(a);this._labelCmdCtor()};cc.LabelTTF.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(cc.LabelTTF.RenderCmd.prototype,cc.LabelTTF.CanvasRenderCmd.prototype);var a=cc.LabelTTF.CanvasRenderCmd.prototype;a.constructor=cc.LabelTTF.CanvasRenderCmd;a._measureConfig=function(){};a._measure=function(a){if(a){var c=cc._renderContext.getContext();c.font=this._fontStyleStr;return c.measureText(a).width}return 0};
a._updateTexture=function(){this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.textDirty;var a=this._node,c=a._contentSize;this._updateTTF();var d=c.width,e=c.height;if(0===a._string.length)return a.setTextureRect(cc.rect(0,0,1,c.height)),!0;this._saveStatus();a.setTextureRect(cc.rect(0,0,d,e));return!0};a.rendering=function(a){var c=cc.view.getScaleX(),d=cc.view.getScaleY();a=a||cc._renderContext;var e=a.getContext();if(e){var f=this._node;a.computeRealOffsetY();if(!(0>=this._status.length)){var h=
this._renderingIndex>=this._status.length?this._renderingIndex-this._status.length:this._renderingIndex,k=this._status[h];this._renderingIndex=h+1;var m=f._offsetPosition.x,h=-f._offsetPosition.y-f._rect.height,n=this._displayedOpacity/255;a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(this._blendFuncStr);a.setGlobalAlpha(n);a.save();f._flippedX&&(m=-m-f._rect.width,e.scale(-1,1));f._flippedY&&(h=f._offsetPosition.y,e.scale(1,-1));c=k.xOffset+k.contextTransform.x+m*c;f=[];m=this._strings.length;
for(n=0;n<m;n++)f.push(k.OffsetYArray[n]+k.contextTransform.y+h*d);this.drawLabels(e,c,f);a.restore()}}}})();(function(){cc.LabelTTF.WebGLRenderCmd=function(a){this._spriteCmdCtor(a);this._cacheCmdCtor()};var a=cc.LabelTTF.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);cc.inject(cc.LabelTTF.CacheRenderCmd.prototype,a);a.constructor=cc.LabelTTF.WebGLRenderCmd;a._updateColor=function(){}})();cc.HashElement=function(){this.actions=[];this.target=null;this.actionIndex=0;this.currentAction=null;this.lock=this.paused=!1};
cc.ActionManager=cc.Class.extend({_elementPool:[],_searchElementByTarget:function(a,b){for(var c=0;c<a.length;c++)if(b===a[c].target)return a[c];return null},ctor:function(){this._hashTargets={};this._arrayTargets=[];this._currentTarget=null},_getElement:function(a,b){var c=this._elementPool.pop();c||(c=new cc.HashElement);c.target=a;c.paused=!!b;return c},_putElement:function(a){a.actions.length=0;a.actionIndex=0;a.currentAction=null;a.paused=!1;a.target=null;a.lock=!1;this._elementPool.push(a)},
addAction:function(a,b,c){if(!a)throw Error("cc.ActionManager.addAction(): action must be non-null");if(!b)throw Error("cc.ActionManager.addAction(): target must be non-null");var d=this._hashTargets[b.__instanceId];d?d.actions||(d.actions=[]):(d=this._getElement(b,c),this._hashTargets[b.__instanceId]=d,this._arrayTargets.push(d));d.actions.push(a);a.startWithTarget(b)},removeAllActions:function(){for(var a=this._arrayTargets,b=0;b<a.length;b++){var c=a[b];c&&this.removeAllActionsFromTarget(c.target,
!0)}},removeAllActionsFromTarget:function(a,b){if(null!=a){var c=this._hashTargets[a.__instanceId];c&&(c.actions.length=0,this._deleteHashElement(c))}},removeAction:function(a){if(null!=a){var b=a.getOriginalTarget();if(b=this._hashTargets[b.__instanceId])for(var c=0;c<b.actions.length;c++){if(b.actions[c]===a){b.actions.splice(c,1);b.actionIndex>=c&&b.actionIndex--;break}}else cc.log(cc._LogInfos.ActionManager_removeAction)}},removeActionByTag:function(a,b){a===cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_addAction);
cc.assert(b,cc._LogInfos.ActionManager_addAction);var c=this._hashTargets[b.__instanceId];if(c)for(var d=c.actions.length,e=0;e<d;++e){var f=c.actions[e];if(f&&f.getTag()===a&&f.getOriginalTarget()===b){this._removeActionAtIndex(e,c);break}}},getActionByTag:function(a,b){a===cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_getActionByTag);var c=this._hashTargets[b.__instanceId];if(c){if(null!=c.actions)for(var d=0;d<c.actions.length;++d){var e=c.actions[d];if(e&&e.getTag()===a)return e}cc.log(cc._LogInfos.ActionManager_getActionByTag_2,
a)}return null},numberOfRunningActionsInTarget:function(a){return(a=this._hashTargets[a.__instanceId])?a.actions?a.actions.length:0:0},pauseTarget:function(a){(a=this._hashTargets[a.__instanceId])&&(a.paused=!0)},resumeTarget:function(a){(a=this._hashTargets[a.__instanceId])&&(a.paused=!1)},pauseAllRunningActions:function(){for(var a=[],b=this._arrayTargets,c=0;c<b.length;c++){var d=b[c];d&&!d.paused&&(d.paused=!0,a.push(d.target))}return a},resumeTargets:function(a){if(a)for(var b=0;b<a.length;b++)a[b]&&
this.resumeTarget(a[b])},purgeSharedManager:function(){cc.director.getScheduler().unscheduleUpdate(this)},_removeActionAtIndex:function(a,b){b.actions.splice(a,1);b.actionIndex>=a&&b.actionIndex--;0===b.actions.length&&this._deleteHashElement(b)},_deleteHashElement:function(a){var b=!1;if(a&&!a.lock&&this._hashTargets[a.target.__instanceId]){delete this._hashTargets[a.target.__instanceId];for(var b=this._arrayTargets,c=0,d=b.length;c<d;c++)if(b[c]===a){b.splice(c,1);break}this._putElement(a);b=!0}return b},
update:function(a){for(var b=this._arrayTargets,c,d=0;d<b.length;d++){c=this._currentTarget=b[d];if(!c.paused&&c.actions){c.lock=!0;for(c.actionIndex=0;c.actionIndex<c.actions.length;c.actionIndex++)if(c.currentAction=c.actions[c.actionIndex],c.currentAction){c.currentAction.step(a*(c.currentAction._speedMethod?c.currentAction._speed:1));if(c.currentAction&&c.currentAction.isDone()){c.currentAction.stop();var e=c.currentAction;c.currentAction=null;this.removeAction(e)}c.currentAction=null}c.lock=
!1}0===c.actions.length&&this._deleteHashElement(c)&&d--}}});cc.profiler=function(){var a=!1,b=!1,c=0,d=0,e=0,f=0,h=null,k=document.createElement("div"),m=document.createElement("div"),n=document.createElement("div"),p=document.createElement("div"),r=10,s=[0,10,20,30],t=[0,0,0,0],w=3,v=0,y=0;p.id="fps";p.style.position="absolute";p.style.padding="3px";p.style.textAlign="left";p.style.backgroundColor="rgb(0, 0, 34)";p.style.bottom=cc.DIRECTOR_STATS_POSITION.y+"0px";p.style.left=cc.DIRECTOR_STATS_POSITION.x+"px";p.style.width="45px";p.style.height="80px";for(var x=
[n,m,k],u=0;3>u;++u){var z=x[u].style;z.color="rgb(0, 255, 255)";z.font="bold 12px Helvetica, Arial";z.lineHeight="20px";z.width="100%";p.appendChild(x[u])}var A=function(){e=cc.director.getSecondsPerFrame();c++;f+=cc.director.getDeltaTime();if(f>cc.DIRECTOR_FPS_INTERVAL){d=c/f;f=c=0;if(B.onFrameRateChange){var b=d,h=s.length-1,p=h,x=0;v++;for(y+=b;0<=p;p--)if(b>=s[p]){t[p]++;break}if(v>=r){x=y/r;for(p=h;0<p;p--)if(b=t[p]/r,0.6<=b&&x>=s[p]){p!=w&&(w=p,B.onFrameRateChange&&B.onFrameRateChange(x.toFixed(2)));
break}y=v=_changeCount=0;for(p=h;0<p;p--)t[p]=0}}a&&(h=cc._renderType===cc.game.RENDER_TYPE_CANVAS?"\n canvas":"\n webgl",m.innerHTML=e.toFixed(3),k.innerHTML=d.toFixed(1).toString()+h,n.innerHTML=(0|cc.g_NumberOfDraws).toString())}},B={onFrameRateChange:null,getSecondsPerFrame:function(){return e},getFrameRate:function(){return d},setProfileDuration:function(a){!isNaN(a)&&0<a&&(r=a/cc.DIRECTOR_FPS_INTERVAL)},resumeProfiling:function(){cc.eventManager.addListener(h,1)},stopProfiling:function(){cc.eventManager.removeListener(h)},
isShowingStats:function(){return a},showStats:function(){b||this.init();null===p.parentElement&&cc.container.appendChild(p);a=!0},hideStats:function(){a=!1;p.parentElement===cc.container&&cc.container.removeChild(p)},init:function(){b||(h=cc.eventManager.addCustomListener(cc.Director.EVENT_AFTER_VISIT,A),b=!0)}};return B}();cc.math=cc.math||{};cc.math.EPSILON=0.015625;cc.math.square=function(a){return a*a};cc.math.almostEqual=function(a,b){return a+cc.math.EPSILON>b&&a-cc.math.EPSILON<b};(function(a){a.math.Vec2=function(a,b){void 0===b?(this.x=a.x,this.y=a.y):(this.x=a||0,this.y=b||0)};var b=a.math.Vec2.prototype;b.fill=function(a,b){this.x=a;this.y=b};b.length=function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;return this};a.math.Vec2.add=function(a,b,e){a.x=b.x+e.x;a.y=b.y+e.y;return a};b.add=function(a){this.x+=a.x;this.y+=
a.y;return this};b.dot=function(a){return this.x*a.x+this.y*a.y};a.math.Vec2.subtract=function(a,b,e){a.x=b.x-e.x;a.y=b.y-e.y;return a};b.subtract=function(a){this.x-=a.x;this.y-=a.y;return this};b.transform=function(a){var b=this.x,e=this.y;this.x=b*a.mat[0]+e*a.mat[3]+a.mat[6];this.y=b*a.mat[1]+e*a.mat[4]+a.mat[7];return this};a.math.Vec2.scale=function(a,b,e){a.x=b.x*e;a.y=b.y*e;return a};b.scale=function(a){this.x*=a;this.y*=a;return this};b.equals=function(b){return this.x<b.x+a.math.EPSILON&&
this.x>b.x-a.math.EPSILON&&this.y<b.y+a.math.EPSILON&&this.y>b.y-a.math.EPSILON}})(cc);(function(a){a.math.Vec3=a.kmVec3=function(a,b,e){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z):(this.x=a||0,this.y=b||0,this.z=e||0)};a.math.vec3=function(b,d,e){return new a.math.Vec3(b,d,e)};var b=a.math.Vec3.prototype;b.fill=function(a,b,e){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z):(this.x=a,this.y=b,this.z=e);return this};b.length=function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+
a.math.square(this.z)};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;this.z*=a;return this};b.cross=function(a){var b=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-b*a.z;this.z=b*a.y-e*a.x;return this};b.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z};b.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this};b.subtract=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this};b.transform=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b*
a[0]+e*a[4]+f*a[8]+a[12];this.y=b*a[1]+e*a[5]+f*a[9]+a[13];this.z=b*a[2]+e*a[6]+f*a[10]+a[14];return this};b.transformNormal=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b*a[0]+e*a[4]+f*a[8];this.y=b*a[1]+e*a[5]+f*a[9];this.z=b*a[2]+e*a[6]+f*a[10];return this};b.transformCoord=function(b){var d=new a.math.Vec4(this.x,this.y,this.z,1);d.transform(b);this.x=d.x/d.w;this.y=d.y/d.w;this.z=d.z/d.w;return this};b.scale=function(a){this.x*=a;this.y*=a;this.z*=a;return this};b.equals=function(b){var d=
a.math.EPSILON;return this.x<b.x+d&&this.x>b.x-d&&this.y<b.y+d&&this.y>b.y-d&&this.z<b.z+d&&this.z>b.z-d};b.inverseTransform=function(b){b=b.mat;var d=new a.math.Vec3(this.x-b[12],this.y-b[13],this.z-b[14]);this.x=d.x*b[0]+d.y*b[1]+d.z*b[2];this.y=d.x*b[4]+d.y*b[5]+d.z*b[6];this.z=d.x*b[8]+d.y*b[9]+d.z*b[10];return this};b.inverseTransformNormal=function(a){var b=this.x,e=this.y,f=this.z;a=a.mat;this.x=b*a[0]+e*a[1]+f*a[2];this.y=b*a[4]+e*a[5]+f*a[6];this.z=b*a[8]+e*a[9]+f*a[10];return this};b.assignFrom=
function(a){if(!a)return this;this.x=a.x;this.y=a.y;this.z=a.z;return this};a.math.Vec3.zero=function(a){a.x=a.y=a.z=0;return a};b.toTypeArray=function(){var a=new Float32Array(3);a[0]=this.x;a[1]=this.y;a[2]=this.z;return a}})(cc);(function(a){a.math.Vec4=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a||0,this.y=b||0,this.z=e||0,this.w=f||0)};a.kmVec4=a.math.Vec4;var b=a.math.Vec4.prototype;b.fill=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a,this.y=b,this.z=e,this.w=f)};b.add=function(a){if(!a)return this;this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this};b.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w};b.length=
function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w)};b.lerp=function(a,b){return this};b.normalize=function(){var a=1/this.length();this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this};b.scale=function(a){this.normalize();this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this};b.subtract=function(a){this.x-=a.x;this.y-=
a.y;this.z-=a.z;this.w-=a.w};b.transform=function(a){var b=this.x,e=this.y,f=this.z,h=this.w;a=a.mat;this.x=b*a[0]+e*a[4]+f*a[8]+h*a[12];this.y=b*a[1]+e*a[5]+f*a[9]+h*a[13];this.z=b*a[2]+e*a[6]+f*a[10]+h*a[14];this.w=b*a[3]+e*a[7]+f*a[11]+h*a[15];return this};a.math.Vec4.transformArray=function(b,d){for(var e=[],f=0;f<b.length;f++){var h=new a.math.Vec4(b[f]);h.transform(d);e.push(h)}return e};b.equals=function(b){var d=a.math.EPSILON;return this.x<b.x+d&&this.x>b.x-d&&this.y<b.y+d&&this.y>b.y-d&&
this.z<b.z+d&&this.z>b.z-d&&this.w<b.w+d&&this.w>b.w-d};b.assignFrom=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};b.toTypeArray=function(){var a=new Float32Array(4);a[0]=this.x;a[1]=this.y;a[2]=this.z;a[3]=this.w;return a}})(cc);(function(a){function b(b,d,e){d=new a.math.Vec2(d);d.subtract(b);e.x=-d.y;e.y=d.x;e.normalize()}a.math.Ray2=function(b,d){this.start=b||new a.math.Vec2;this.dir=d||new a.math.Vec2};a.math.Ray2.prototype.fill=function(a,b,e,f){this.start.x=a;this.start.y=b;this.dir.x=e;this.dir.y=f};a.math.Ray2.prototype.intersectLineSegment=function(b,d,e){var f=this.start.x,h=this.start.y,k=this.start.x+this.dir.x,m=this.start.y+this.dir.y,n=b.x,p=b.y,r=d.x,s=d.y,t=(s-p)*(k-f)-(r-n)*(m-h);if(t>-a.math.EPSILON&&
t<a.math.EPSILON)return!1;p=((r-n)*(h-p)-(s-p)*(f-n))/t;n=f+p*(k-f);p=h+p*(m-h);if(n<Math.min(b.x,d.x)-a.math.EPSILON||n>Math.max(b.x,d.x)+a.math.EPSILON||p<Math.min(b.y,d.y)-a.math.EPSILON||p>Math.max(b.y,d.y)+a.math.EPSILON||n<Math.min(f,k)-a.math.EPSILON||n>Math.max(f,k)+a.math.EPSILON||p<Math.min(h,m)-a.math.EPSILON||p>Math.max(h,m)+a.math.EPSILON)return!1;e.x=n;e.y=p;return!0};a.math.Ray2.prototype.intersectTriangle=function(c,d,e,f,h){var k=new a.math.Vec2,m=new a.math.Vec2,n=new a.math.Vec2,
p=1E4,r=!1,s;this.intersectLineSegment(c,d,k)&&(r=!0,s=k.subtract(this.start).length(),s<p&&(m.x=k.x,m.y=k.y,p=s,b(c,d,n)));this.intersectLineSegment(d,e,k)&&(r=!0,s=k.subtract(this.start).length(),s<p&&(m.x=k.x,m.y=k.y,p=s,b(d,e,n)));this.intersectLineSegment(e,c,k)&&(r=!0,s=k.subtract(this.start).length(),s<p&&(m.x=k.x,m.y=k.y,b(e,c,n)));r&&(f.x=m.x,f.y=m.y,h&&(h.x=n.x,h.y=n.y));return r}})(cc);window.Uint16Array=window.Uint16Array||window.Array;window.Float32Array=window.Float32Array||window.Array;
(function(a){a.math.Matrix3=function(a){this.mat=a&&a.mat?new Float32Array(a.mat):new Float32Array(9)};a.kmMat3=a.math.Matrix3;var b=a.math.Matrix3.prototype;b.fill=function(a){var b=this.mat;a=a.mat;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this};b.adjugate=function(){var a=this.mat,b=a[0],c=a[1],h=a[2],k=a[3],m=a[4],n=a[5],p=a[6],r=a[7],s=a[8];a[0]=m*s-n*r;a[1]=h*r-c*s;a[2]=c*n-h*m;a[3]=n*p-k*s;a[4]=b*s-h*p;a[5]=h*k-b*n;a[6]=k*r-m*p;a[8]=b*
m-c*k;return this};b.identity=function(){var a=this.mat;a[1]=a[2]=a[3]=a[5]=a[6]=a[7]=0;a[0]=a[4]=a[8]=1;return this};var c=new a.math.Matrix3;b.inverse=function(a){if(0===a)return this;c.assignFrom(this);a=1/a;this.adjugate();this.multiplyScalar(a);return this};b.isIdentity=function(){var a=this.mat;return 1===a[0]&&0===a[1]&&0===a[2]&&0===a[3]&&1===a[4]&&0===a[5]&&0===a[6]&&0===a[7]&&1===a[8]};b.transpose=function(){var a=this.mat,b=a[1],c=a[2],h=a[5],k=a[6],m=a[7];a[1]=a[3];a[2]=k;a[3]=b;a[5]=
m;a[6]=c;a[7]=h;return this};b.determinant=function(){var a=this.mat,b=a[0]*a[4]*a[8]+a[1]*a[5]*a[6]+a[2]*a[3]*a[7];return b-=a[2]*a[4]*a[6]+a[0]*a[5]*a[7]+a[1]*a[3]*a[8]};b.multiply=function(a){var b=this.mat,c=a.mat;a=b[0];var h=b[1],k=b[2],m=b[3],n=b[4],p=b[5],r=b[6],s=b[7],t=b[8],w=c[0],v=c[1],y=c[2],x=c[3],u=c[4],z=c[5],A=c[6],B=c[7],c=c[8];b[0]=a*w+m*v+r*y;b[1]=h*w+n*v+s*y;b[2]=k*w+p*v+t*y;b[3]=k*w+p*v+t*y;b[4]=h*x+n*u+s*z;b[5]=k*x+p*u+t*z;b[6]=a*A+m*B+r*c;b[7]=h*A+n*B+s*c;b[8]=k*A+p*B+t*c;
return this};b.multiplyScalar=function(a){var b=this.mat;b[0]*=a;b[1]*=a;b[2]*=a;b[3]*=a;b[4]*=a;b[5]*=a;b[6]*=a;b[7]*=a;b[8]*=a;return this};a.math.Matrix3.rotationAxisAngle=function(b,c){var f=Math.cos(c),h=Math.sin(c),k=new a.math.Matrix3,m=k.mat;m[0]=f+b.x*b.x*(1-f);m[1]=b.z*h+b.y*b.x*(1-f);m[2]=-b.y*h+b.z*b.x*(1-f);m[3]=-b.z*h+b.x*b.y*(1-f);m[4]=f+b.y*b.y*(1-f);m[5]=b.x*h+b.z*b.y*(1-f);m[6]=b.y*h+b.x*b.z*(1-f);m[7]=-b.x*h+b.y*b.z*(1-f);m[8]=f+b.z*b.z*(1-f);return k};b.assignFrom=function(b){if(this===
b)return a.log("cc.math.Matrix3.assign(): current matrix equals matIn"),this;var c=this.mat;b=b.mat;c[0]=b[0];c[1]=b[1];c[2]=b[2];c[3]=b[3];c[4]=b[4];c[5]=b[5];c[6]=b[6];c[7]=b[7];c[8]=b[8];return this};b.equals=function(b){if(this===b)return!0;var c=a.math.EPSILON,f=this.mat;b=b.mat;for(var h=0;9>h;++h)if(!(f[h]+c>b[h]&&f[h]-c<b[h]))return!1;return!0};a.math.Matrix3.createByRotationX=function(b){var c=new a.math.Matrix3,f=c.mat;f[0]=1;f[1]=0;f[2]=0;f[3]=0;f[4]=Math.cos(b);f[5]=Math.sin(b);f[6]=0;
f[7]=-Math.sin(b);f[8]=Math.cos(b);return c};a.math.Matrix3.createByRotationY=function(b){var c=new a.math.Matrix3,f=c.mat;f[0]=Math.cos(b);f[1]=0;f[2]=-Math.sin(b);f[3]=0;f[4]=1;f[5]=0;f[6]=Math.sin(b);f[7]=0;f[8]=Math.cos(b);return c};a.math.Matrix3.createByRotationZ=function(b){var c=new a.math.Matrix3,f=c.mat;f[0]=Math.cos(b);f[1]=-Math.sin(b);f[2]=0;f[3]=Math.sin(b);f[4]=Math.cos(b);f[5]=0;f[6]=0;f[7]=0;f[8]=1;return c};a.math.Matrix3.createByRotation=function(b){var c=new a.math.Matrix3,f=c.mat;
f[0]=Math.cos(b);f[1]=Math.sin(b);f[2]=0;f[3]=-Math.sin(b);f[4]=Math.cos(b);f[5]=0;f[6]=0;f[7]=0;f[8]=1;return c};a.math.Matrix3.createByScale=function(b,c){var f=new a.math.Matrix3;f.identity();f.mat[0]=b;f.mat[4]=c;return f};a.math.Matrix3.createByTranslation=function(b,c){var f=new a.math.Matrix3;f.identity();f.mat[6]=b;f.mat[7]=c;return f};a.math.Matrix3.createByQuaternion=function(b){if(!b)return null;var c=new a.math.Matrix3,f=c.mat;f[0]=1-2*(b.y*b.y+b.z*b.z);f[1]=2*(b.x*b.y-b.w*b.z);f[2]=2*
(b.x*b.z+b.w*b.y);f[3]=2*(b.x*b.y+b.w*b.z);f[4]=1-2*(b.x*b.x+b.z*b.z);f[5]=2*(b.y*b.z-b.w*b.x);f[6]=2*(b.x*b.z-b.w*b.y);f[7]=2*(b.y*b.z+b.w*b.x);f[8]=1-2*(b.x*b.x+b.y*b.y);return c};b.rotationToAxisAngle=function(){return a.math.Quaternion.rotationMatrix(this).toAxisAndAngle()}})(cc);(function(a){a.math.Matrix4=function(a){this.mat=a&&a.mat?new Float32Array(a.mat):new Float32Array(16)};a.kmMat4=a.math.Matrix4;var b=a.math.Matrix4.prototype;b.fill=function(a){for(var b=this.mat,c=0;16>c;c++)b[c]=a[c];return this};a.kmMat4Identity=function(a){var b=a.mat;b[1]=b[2]=b[3]=b[4]=b[6]=b[7]=b[8]=b[9]=b[11]=b[12]=b[13]=b[14]=0;b[0]=b[5]=b[10]=b[15]=1;return a};b.identity=function(){var a=this.mat;a[1]=a[2]=a[3]=a[4]=a[6]=a[7]=a[8]=a[9]=a[11]=a[12]=a[13]=a[14]=0;a[0]=a[5]=a[10]=a[15]=1;
return this};b.get=function(a,b){return this.mat[a+4*b]};b.set=function(a,b,c){this.mat[a+4*b]=c};b.swap=function(a,b,c,d){var m=this.mat,n=m[a+4*b];m[a+4*b]=m[c+4*d];m[c+4*d]=n};a.math.Matrix4._gaussj=function(a,b){var c,d=0,m=0,n,p,r,s,t=[0,0,0,0],w=[0,0,0,0],v=[0,0,0,0];for(c=0;4>c;c++){for(n=s=0;4>n;n++)if(1!==v[n])for(p=0;4>p;p++)0===v[p]&&(r=Math.abs(a.get(n,p)),r>=s&&(s=r,m=n,d=p));++v[d];if(m!==d){for(n=0;4>n;n++)a.swap(m,n,d,n);for(n=0;4>n;n++)b.swap(m,n,d,n)}w[c]=m;t[c]=d;if(0===a.get(d,
d))return!1;p=1/a.get(d,d);a.set(d,d,1);for(n=0;4>n;n++)a.set(d,n,a.get(d,n)*p);for(n=0;4>n;n++)b.set(d,n,b.get(d,n)*p);for(p=0;4>p;p++)if(p!==d){r=a.get(p,d);a.set(p,d,0);for(n=0;4>n;n++)a.set(p,n,a.get(p,n)-a.get(d,n)*r);for(n=0;4>n;n++)b.set(p,n,a.get(p,n)-b.get(d,n)*r)}}for(n=3;0<=n;n--)if(w[n]!==t[n])for(p=0;4>p;p++)a.swap(p,w[n],p,t[n]);return!0};var c=(new a.math.Matrix4).identity();a.kmMat4Inverse=function(b,d){var h=new a.math.Matrix4(d),k=new a.math.Matrix4(c);if(!1===a.math.Matrix4._gaussj(h,
k))return null;b.assignFrom(h);return b};b.inverse=function(){var b=new a.math.Matrix4(this),d=new a.math.Matrix4(c);return!1===a.math.Matrix4._gaussj(b,d)?null:b};b.isIdentity=function(){var a=this.mat;return 1===a[0]&&0===a[1]&&0===a[2]&&0===a[3]&&0===a[4]&&1===a[5]&&0===a[6]&&0===a[7]&&0===a[8]&&0===a[9]&&1===a[10]&&0===a[11]&&0===a[12]&&0===a[13]&&0===a[14]&&1===a[15]};b.transpose=function(){var a=this.mat,b=a[1],c=a[2],d=a[3],m=a[6],n=a[7],p=a[8],r=a[9],s=a[11],t=a[12],w=a[13],v=a[14];a[1]=a[4];
a[2]=p;a[3]=t;a[4]=b;a[6]=r;a[7]=w;a[8]=c;a[9]=m;a[11]=v;a[12]=d;a[13]=n;a[14]=s;return this};a.kmMat4Multiply=function(a,b,c){var d=a.mat,m=b.mat,n=c.mat;c=m[0];b=m[1];var p=m[2],r=m[3],s=m[4],t=m[5],w=m[6],v=m[7],y=m[8],x=m[9],u=m[10],z=m[11],A=m[12],B=m[13],D=m[14],m=m[15],C=n[0],E=n[1],J=n[2],G=n[3],H=n[4],L=n[5],I=n[6],M=n[7],F=n[8],N=n[9],O=n[10],P=n[11],Q=n[12],S=n[13],R=n[14],n=n[15];d[0]=C*c+E*s+J*y+G*A;d[1]=C*b+E*t+J*x+G*B;d[2]=C*p+E*w+J*u+G*D;d[3]=C*r+E*v+J*z+G*m;d[4]=H*c+L*s+I*y+M*A;d[5]=
H*b+L*t+I*x+M*B;d[6]=H*p+L*w+I*u+M*D;d[7]=H*r+L*v+I*z+M*m;d[8]=F*c+N*s+O*y+P*A;d[9]=F*b+N*t+O*x+P*B;d[10]=F*p+N*w+O*u+P*D;d[11]=F*r+N*v+O*z+P*m;d[12]=Q*c+S*s+R*y+n*A;d[13]=Q*b+S*t+R*x+n*B;d[14]=Q*p+S*w+R*u+n*D;d[15]=Q*r+S*v+R*z+n*m;return a};b.multiply=function(a){var b=this.mat,c=a.mat;a=b[0];var d=b[1],m=b[2],n=b[3],p=b[4],r=b[5],s=b[6],t=b[7],w=b[8],v=b[9],y=b[10],x=b[11],u=b[12],z=b[13],A=b[14],B=b[15],D=c[0],C=c[1],E=c[2],J=c[3],G=c[4],H=c[5],L=c[6],I=c[7],M=c[8],F=c[9],N=c[10],O=c[11],P=c[12],
Q=c[13],S=c[14],c=c[15];b[0]=D*a+C*p+E*w+J*u;b[1]=D*d+C*r+E*v+J*z;b[2]=D*m+C*s+E*y+J*A;b[3]=D*n+C*t+E*x+J*B;b[4]=G*a+H*p+L*w+I*u;b[5]=G*d+H*r+L*v+I*z;b[6]=G*m+H*s+L*y+I*A;b[7]=G*n+H*t+L*x+I*B;b[8]=M*a+F*p+N*w+O*u;b[9]=M*d+F*r+N*v+O*z;b[10]=M*m+F*s+N*y+O*A;b[11]=M*n+F*t+N*x+O*B;b[12]=P*a+Q*p+S*w+c*u;b[13]=P*d+Q*r+S*v+c*z;b[14]=P*m+Q*s+S*y+c*A;b[15]=P*n+Q*t+S*x+c*B;return this};a.getMat4MultiplyValue=function(a,b){var c=a.mat,d=b.mat,m=new Float32Array(16);m[0]=c[0]*d[0]+c[4]*d[1]+c[8]*d[2]+c[12]*d[3];
m[1]=c[1]*d[0]+c[5]*d[1]+c[9]*d[2]+c[13]*d[3];m[2]=c[2]*d[0]+c[6]*d[1]+c[10]*d[2]+c[14]*d[3];m[3]=c[3]*d[0]+c[7]*d[1]+c[11]*d[2]+c[15]*d[3];m[4]=c[0]*d[4]+c[4]*d[5]+c[8]*d[6]+c[12]*d[7];m[5]=c[1]*d[4]+c[5]*d[5]+c[9]*d[6]+c[13]*d[7];m[6]=c[2]*d[4]+c[6]*d[5]+c[10]*d[6]+c[14]*d[7];m[7]=c[3]*d[4]+c[7]*d[5]+c[11]*d[6]+c[15]*d[7];m[8]=c[0]*d[8]+c[4]*d[9]+c[8]*d[10]+c[12]*d[11];m[9]=c[1]*d[8]+c[5]*d[9]+c[9]*d[10]+c[13]*d[11];m[10]=c[2]*d[8]+c[6]*d[9]+c[10]*d[10]+c[14]*d[11];m[11]=c[3]*d[8]+c[7]*d[9]+c[11]*
d[10]+c[15]*d[11];m[12]=c[0]*d[12]+c[4]*d[13]+c[8]*d[14]+c[12]*d[15];m[13]=c[1]*d[12]+c[5]*d[13]+c[9]*d[14]+c[13]*d[15];m[14]=c[2]*d[12]+c[6]*d[13]+c[10]*d[14]+c[14]*d[15];m[15]=c[3]*d[12]+c[7]*d[13]+c[11]*d[14]+c[15]*d[15];return m};a.kmMat4Assign=function(b,c){if(b===c)return a.log("cc.kmMat4Assign(): pOut equals pIn"),b;var d=b.mat,k=c.mat;d[0]=k[0];d[1]=k[1];d[2]=k[2];d[3]=k[3];d[4]=k[4];d[5]=k[5];d[6]=k[6];d[7]=k[7];d[8]=k[8];d[9]=k[9];d[10]=k[10];d[11]=k[11];d[12]=k[12];d[13]=k[13];d[14]=k[14];
d[15]=k[15];return b};b.assignFrom=function(b){if(this===b)return a.log("cc.mat.Matrix4.assignFrom(): mat4 equals current matrix"),this;var c=this.mat;b=b.mat;c[0]=b[0];c[1]=b[1];c[2]=b[2];c[3]=b[3];c[4]=b[4];c[5]=b[5];c[6]=b[6];c[7]=b[7];c[8]=b[8];c[9]=b[9];c[10]=b[10];c[11]=b[11];c[12]=b[12];c[13]=b[13];c[14]=b[14];c[15]=b[15];return this};b.equals=function(b){if(this===b)return a.log("cc.kmMat4AreEqual(): pMat1 and pMat2 are same object."),!0;var c=this.mat;b=b.mat;for(var d=a.math.EPSILON,k=0;16>
k;k++)if(!(c[k]+d>b[k]&&c[k]-d<b[k]))return!1;return!0};a.math.Matrix4.createByRotationX=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=1;d[3]=d[2]=d[1]=0;d[4]=0;d[5]=Math.cos(b);d[6]=Math.sin(b);d[7]=0;d[8]=0;d[9]=-Math.sin(b);d[10]=Math.cos(b);d[11]=0;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByRotationY=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=Math.cos(b);d[1]=0;d[2]=-Math.sin(b);d[3]=0;d[7]=d[6]=d[4]=0;d[5]=1;d[8]=Math.sin(b);d[9]=0;d[10]=Math.cos(b);d[11]=
0;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByRotationZ=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=Math.cos(b);d[1]=Math.sin(b);d[3]=d[2]=0;d[4]=-Math.sin(b);d[5]=Math.cos(b);d[7]=d[6]=0;d[11]=d[9]=d[8]=0;d[10]=1;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByPitchYawRoll=function(b,c,d,k){k=k||new a.math.Matrix4;var m=Math.cos(b);b=Math.sin(b);var n=Math.cos(c);c=Math.sin(c);var p=Math.cos(d);d=Math.sin(d);var r=b*c,s=m*c,t=k.mat;t[0]=n*p;t[4]=n*d;t[8]=
-c;t[1]=r*p-m*d;t[5]=r*d+m*p;t[9]=b*n;t[2]=s*p+b*d;t[6]=s*d-b*p;t[10]=m*n;t[3]=t[7]=t[11]=0;t[15]=1;return k};a.math.Matrix4.createByQuaternion=function(b,c){c=c||new a.math.Matrix4;var d=c.mat;d[0]=1-2*(b.y*b.y+b.z*b.z);d[1]=2*(b.x*b.y+b.z*b.w);d[2]=2*(b.x*b.z-b.y*b.w);d[3]=0;d[4]=2*(b.x*b.y-b.z*b.w);d[5]=1-2*(b.x*b.x+b.z*b.z);d[6]=2*(b.z*b.y+b.x*b.w);d[7]=0;d[8]=2*(b.x*b.z+b.y*b.w);d[9]=2*(b.y*b.z-b.x*b.w);d[10]=1-2*(b.x*b.x+b.y*b.y);d[11]=0;d[14]=d[13]=d[12]=0;d[15]=1;return c};a.math.Matrix4.createByRotationTranslation=
function(b,c,d){d=d||new a.math.Matrix4;var k=d.mat;b=b.mat;k[0]=b[0];k[1]=b[1];k[2]=b[2];k[3]=0;k[4]=b[3];k[5]=b[4];k[6]=b[5];k[7]=0;k[8]=b[6];k[9]=b[7];k[10]=b[8];k[11]=0;k[12]=c.x;k[13]=c.y;k[14]=c.z;k[15]=1;return d};a.math.Matrix4.createByScale=function(b,c,d,k){k=k||new a.math.Matrix4;var m=k.mat;m[0]=b;m[5]=c;m[10]=d;m[15]=1;m[1]=m[2]=m[3]=m[4]=m[6]=m[7]=m[8]=m[9]=m[11]=m[12]=m[13]=m[14]=0;return k};a.kmMat4Translation=function(a,b,c,d){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]=b;a.mat[13]=c;a.mat[14]=d;return a};a.math.Matrix4.createByTranslation=function(b,c,d,k){k=k||new a.math.Matrix4;k.identity();k.mat[12]=b;k.mat[13]=c;k.mat[14]=d;return k};b.getUpVec3=function(){var b=this.mat;return(new a.math.Vec3(b[4],b[5],b[6])).normalize()};b.getRightVec3=function(){var b=this.mat;return(new a.math.Vec3(b[0],b[1],b[2])).normalize()};b.getForwardVec3=function(){var b=this.mat;return(new a.math.Vec3(b[8],
b[9],b[10])).normalize()};a.kmMat4PerspectiveProjection=function(b,c,d,k,m){var n=a.degreesToRadians(c/2);c=m-k;var p=Math.sin(n);if(0===c||0===p||0===d)return null;n=Math.cos(n)/p;b.identity();b.mat[0]=n/d;b.mat[5]=n;b.mat[10]=-(m+k)/c;b.mat[11]=-1;b.mat[14]=-2*k*m/c;b.mat[15]=0;return b};a.math.Matrix4.createPerspectiveProjection=function(b,c,d,k){var m=a.degreesToRadians(b/2);b=k-d;var n=Math.sin(m);if(0===b||0===n||0===c)return null;var m=Math.cos(m)/n,n=new a.math.Matrix4,p=n.mat;n.identity();
p[0]=m/c;p[5]=m;p[10]=-(k+d)/b;p[11]=-1;p[14]=-2*d*k/b;p[15]=0;return n};a.kmMat4OrthographicProjection=function(a,b,c,d,m,n,p){a.identity();a.mat[0]=2/(c-b);a.mat[5]=2/(m-d);a.mat[10]=-2/(p-n);a.mat[12]=-((c+b)/(c-b));a.mat[13]=-((m+d)/(m-d));a.mat[14]=-((p+n)/(p-n));return a};a.math.Matrix4.createOrthographicProjection=function(b,c,d,k,m,n){var p=new a.math.Matrix4,r=p.mat;p.identity();r[0]=2/(c-b);r[5]=2/(k-d);r[10]=-2/(n-m);r[12]=-((c+b)/(c-b));r[13]=-((k+d)/(k-d));r[14]=-((n+m)/(n-m));return p};
a.kmMat4LookAt=function(b,c,d,k){d=new a.math.Vec3(d);var m=new a.math.Vec3(k);d.subtract(c);d.normalize();m.normalize();k=new a.math.Vec3(d);k.cross(m);k.normalize();m=new a.math.Vec3(k);m.cross(d);k.normalize();b.identity();b.mat[0]=k.x;b.mat[4]=k.y;b.mat[8]=k.z;b.mat[1]=m.x;b.mat[5]=m.y;b.mat[9]=m.z;b.mat[2]=-d.x;b.mat[6]=-d.y;b.mat[10]=-d.z;c=a.math.Matrix4.createByTranslation(-c.x,-c.y,-c.z);b.multiply(c);return b};var d=new a.math.Matrix4;b.lookAt=function(b,c,h){c=new a.math.Vec3(c);var k=
new a.math.Vec3(h);h=this.mat;c.subtract(b);c.normalize();k.normalize();var m=new a.math.Vec3(c);m.cross(k);m.normalize();k=new a.math.Vec3(m);k.cross(c);m.normalize();this.identity();h[0]=m.x;h[4]=m.y;h[8]=m.z;h[1]=k.x;h[5]=k.y;h[9]=k.z;h[2]=-c.x;h[6]=-c.y;h[10]=-c.z;d=a.math.Matrix4.createByTranslation(-b.x,-b.y,-b.z,d);this.multiply(d);return this};a.kmMat4RotationAxisAngle=function(b,c,d){var k=Math.cos(d);d=Math.sin(d);c=new a.math.Vec3(c);c.normalize();b.mat[0]=k+c.x*c.x*(1-k);b.mat[1]=c.z*
d+c.y*c.x*(1-k);b.mat[2]=-c.y*d+c.z*c.x*(1-k);b.mat[3]=0;b.mat[4]=-c.z*d+c.x*c.y*(1-k);b.mat[5]=k+c.y*c.y*(1-k);b.mat[6]=c.x*d+c.z*c.y*(1-k);b.mat[7]=0;b.mat[8]=c.y*d+c.x*c.z*(1-k);b.mat[9]=-c.x*d+c.y*c.z*(1-k);b.mat[10]=k+c.z*c.z*(1-k);b.mat[11]=0;b.mat[12]=0;b.mat[13]=0;b.mat[14]=0;b.mat[15]=1;return b};a.math.Matrix4.createByAxisAndAngle=function(b,c,d){d=d||new a.math.Matrix4;var k=this.mat,m=Math.cos(c);c=Math.sin(c);b=new a.math.Vec3(b);b.normalize();k[0]=m+b.x*b.x*(1-m);k[1]=b.z*c+b.y*b.x*
(1-m);k[2]=-b.y*c+b.z*b.x*(1-m);k[3]=0;k[4]=-b.z*c+b.x*b.y*(1-m);k[5]=m+b.y*b.y*(1-m);k[6]=b.x*c+b.z*b.y*(1-m);k[7]=0;k[8]=b.y*c+b.x*b.z*(1-m);k[9]=-b.x*c+b.y*b.z*(1-m);k[10]=m+b.z*b.z*(1-m);k[11]=0;k[12]=k[13]=k[14]=0;k[15]=1;return d};b.extractRotation=function(){var b=new a.math.Matrix3,c=this.mat,d=b.mat;d[0]=c[0];d[1]=c[1];d[2]=c[2];d[3]=c[4];d[4]=c[5];d[5]=c[6];d[6]=c[8];d[7]=c[9];d[8]=c[10];return b};b.extractPlane=function(b){var c=new a.math.Plane,d=this.mat;switch(b){case a.math.Plane.RIGHT:c.a=
d[3]-d[0];c.b=d[7]-d[4];c.c=d[11]-d[8];c.d=d[15]-d[12];break;case a.math.Plane.LEFT:c.a=d[3]+d[0];c.b=d[7]+d[4];c.c=d[11]+d[8];c.d=d[15]+d[12];break;case a.math.Plane.BOTTOM:c.a=d[3]+d[1];c.b=d[7]+d[5];c.c=d[11]+d[9];c.d=d[15]+d[13];break;case a.math.Plane.TOP:c.a=d[3]-d[1];c.b=d[7]-d[5];c.c=d[11]-d[9];c.d=d[15]-d[13];break;case a.math.Plane.FAR:c.a=d[3]-d[2];c.b=d[7]-d[6];c.c=d[11]-d[10];c.d=d[15]-d[14];break;case a.math.Plane.NEAR:c.a=d[3]+d[2];c.b=d[7]+d[6];c.c=d[11]+d[10];c.d=d[15]+d[14];break;
default:a.log("cc.math.Matrix4.extractPlane: Invalid plane index")}b=Math.sqrt(c.a*c.a+c.b*c.b+c.c*c.c);c.a/=b;c.b/=b;c.c/=b;c.d/=b;return c};b.toAxisAndAngle=function(){var b=this.extractRotation();return a.math.Quaternion.rotationMatrix(b).toAxisAndAngle()}})(cc);(function(a){a.math.Plane=function(a,b,e,f){a&&void 0===b?(this.a=a.a,this.b=a.b,this.c=a.c,this.d=a.d):(this.a=a||0,this.b=b||0,this.c=e||0,this.d=f||0)};a.kmPlane=a.math.Plane;var b=a.math.Plane.prototype;a.math.Plane.LEFT=0;a.math.Plane.RIGHT=1;a.math.Plane.BOTTOM=2;a.math.Plane.TOP=3;a.math.Plane.NEAR=4;a.math.Plane.FAR=5;a.math.Plane.POINT_INFRONT_OF_PLANE=0;a.math.Plane.POINT_BEHIND_PLANE=1;a.math.Plane.POINT_ON_PLANE=2;b.dot=function(a){return this.a*a.x+this.b*a.y+this.c*a.z+this.d*a.w};b.dotCoord=
function(a){return this.a*a.x+this.b*a.y+this.c*a.z+this.d};b.dotNormal=function(a){return this.a*a.x+this.b*a.y+this.c*a.z};a.math.Plane.fromPointNormal=function(b,d){return new a.math.Plane(d.x,d.y,d.z,-d.dot(b))};a.math.Plane.fromPoints=function(b,d,e){d=new a.math.Vec3(d);e=new a.math.Vec3(e);var f=new a.math.Plane;d.subtract(b);e.subtract(b);d.cross(e);d.normalize();f.a=d.x;f.b=d.y;f.c=d.z;f.d=d.scale(-1).dot(b);return f};b.normalize=function(){var b=new a.math.Vec3(this.a,this.b,this.c),d=1/
b.length();b.normalize();this.a=b.x;this.b=b.y;this.c=b.z;this.d*=d;return this};b.classifyPoint=function(b){b=this.a*b.x+this.b*b.y+this.c*b.z+this.d;return 0.001<b?a.math.Plane.POINT_INFRONT_OF_PLANE:-0.001>b?a.math.Plane.POINT_BEHIND_PLANE:a.math.Plane.POINT_ON_PLANE}})(cc);(function(a){a.math.Quaternion=function(a,b,e,f){a&&void 0===b?(this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w):(this.x=a||0,this.y=b||0,this.z=e||0,this.w=f||0)};a.kmQuaternion=a.math.Quaternion;var b=a.math.Quaternion.prototype;b.conjugate=function(a){this.x=-a.x;this.y=-a.y;this.z=-a.z;this.w=a.w;return this};b.dot=function(a){return this.w*a.w+this.x*a.x+this.y*a.y+this.z*a.z};b.exponential=function(){return this};b.identity=function(){this.z=this.y=this.x=0;this.w=1;return this};b.inverse=function(){var b=
this.length();if(Math.abs(b)>a.math.EPSILON)return this.w=this.z=this.y=this.x=0,this;this.conjugate(this).scale(1/b);return this};b.isIdentity=function(){return 0===this.x&&0===this.y&&0===this.z&&1===this.w};b.length=function(){return Math.sqrt(this.lengthSq())};b.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w};b.multiply=function(a){var b=this.x,e=this.y,f=this.z,h=this.w;this.w=h*a.w-b*a.x-e*a.y-f*a.z;this.x=h*a.x+b*a.w+e*a.z-f*a.y;this.y=h*a.y+e*a.w+f*a.x-
b*a.z;this.z=h*a.z+f*a.w+b*a.y-e*a.x;return this};b.normalize=function(){var b=this.length();if(Math.abs(b)<=a.math.EPSILON)throw Error("current quaternion is an invalid value");this.scale(1/b);return this};b.rotationAxis=function(a,b){var e=0.5*b,f=Math.sin(e);this.w=Math.cos(e);this.x=a.x*f;this.y=a.y*f;this.z=a.z*f;return this};a.math.Quaternion.rotationMatrix=function(b){if(!b)return null;var d,e,f;d=[];e=b.mat;b=0;d[0]=e[0];d[1]=e[3];d[2]=e[6];d[4]=e[1];d[5]=e[4];d[6]=e[7];d[8]=e[2];d[9]=e[5];
d[10]=e[8];d[15]=1;var h=d[0];b=h[0]+h[5]+h[10]+1;b>a.math.EPSILON?(b=2*Math.sqrt(b),d=(h[9]-h[6])/b,e=(h[2]-h[8])/b,f=(h[4]-h[1])/b,b*=0.25):h[0]>h[5]&&h[0]>h[10]?(b=2*Math.sqrt(1+h[0]-h[5]-h[10]),d=0.25*b,e=(h[4]+h[1])/b,f=(h[2]+h[8])/b,b=(h[9]-h[6])/b):h[5]>h[10]?(b=2*Math.sqrt(1+h[5]-h[0]-h[10]),d=(h[4]+h[1])/b,e=0.25*b,f=(h[9]+h[6])/b,b=(h[2]-h[8])/b):(b=2*Math.sqrt(1+h[10]-h[0]-h[5]),d=(h[2]+h[8])/b,e=(h[9]+h[6])/b,f=0.25*b,b=(h[4]-h[1])/b);return new a.math.Quaternion(d,e,f,b)};a.math.Quaternion.rotationYawPitchRoll=
function(b,d,e){var f,h,k,m,n;f=a.degreesToRadians(d)/2;h=a.degreesToRadians(b)/2;k=a.degreesToRadians(e)/2;e=Math.cos(f);b=Math.cos(h);d=Math.cos(k);f=Math.sin(f);h=Math.sin(h);k=Math.sin(k);m=b*d;n=h*k;var p=new a.math.Quaternion;p.w=e*m+f*n;p.x=f*m-e*n;p.y=e*h*d+f*b*k;p.z=e*b*k-f*h*d;p.normalize();return p};b.slerp=function(b,d){if(this.x===b.x&&this.y===b.y&&this.z===b.z&&this.w===b.w)return this;var e=this.dot(b),f=Math.acos(e),h=Math.sqrt(1-a.math.square(e)),e=Math.sin(d*f)/h,f=Math.sin((1-
d)*f)/h,h=new a.math.Quaternion(b);this.scale(f);h.scale(e);this.add(h);return this};b.toAxisAndAngle=function(){var b,d,e=new a.math.Vec3;b=Math.acos(this.w);d=Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z));d>-a.math.EPSILON&&d<a.math.EPSILON||d<2*Math.PI+a.math.EPSILON&&d>2*Math.PI-a.math.EPSILON?(b=0,e.x=0,e.y=0,e.z=1):(b*=2,e.x=this.x/d,e.y=this.y/d,e.z=this.z/d,e.normalize());return{axis:e,angle:b}};b.scale=function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this};
b.assignFrom=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};b.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this};a.math.Quaternion.rotationBetweenVec3=function(b,d,e){var f=new a.math.Vec3(b),h=new a.math.Vec3(d);f.normalize();h.normalize();var k=f.dot(h);d=new a.math.Quaternion;if(1<=k)return d.identity(),d;-0.999999>k?Math.abs(e.lengthSq())<a.math.EPSILON?d.rotationAxis(e,Math.PI):(f=new a.math.Vec3(1,0,0),f.cross(b),Math.abs(f.lengthSq())<a.math.EPSILON&&
(f.fill(0,1,0),f.cross(b)),f.normalize(),d.rotationAxis(f,Math.PI)):(b=Math.sqrt(2*(1+k)),e=1/b,f.cross(h),d.x=f.x*e,d.y=f.y*e,d.z=f.z*e,d.w=0.5*b,d.normalize());return d};b.multiplyVec3=function(b){var d=this.x,e=this.y,f=this.z,h=new a.math.Vec3(b),k=new a.math.Vec3(d,e,f),d=new a.math.Vec3(d,e,f);k.cross(b);d.cross(k);k.scale(2*q.w);d.scale(2);h.add(k);h.add(d);return h}})(cc);cc.math.AABB=function(a,b){this.min=a||new cc.math.Vec3;this.max=b||new cc.math.Vec3};cc.math.AABB.prototype.containsPoint=function(a){return a.x>=this.min.x&&a.x<=this.max.x&&a.y>=this.min.y&&a.y<=this.max.y&&a.z>=this.min.z&&a.z<=this.max.z};cc.math.AABB.containsPoint=function(a,b){return a.x>=b.min.x&&a.x<=b.max.x&&a.y>=b.min.y&&a.y<=b.max.y&&a.z>=b.min.z&&a.z<=b.max.z};cc.math.AABB.prototype.assignFrom=function(a){this.min.assignFrom(a.min);this.max.assignFrom(a.max)};
cc.math.AABB.assign=function(a,b){a.min.assignFrom(b.min);a.max.assignFrom(b.max);return a};(function(a){a.math.Matrix4Stack=function(a,b){this.top=a;this.stack=b||[];this.lastUpdated=0};a.km_mat4_stack=a.math.Matrix4Stack;var b=a.math.Matrix4Stack.prototype;b.initialize=function(){this.stack.length=0;this.top=null};a.km_mat4_stack_push=function(b,d){b.stack.push(b.top);b.top=new a.math.Matrix4(d)};a.km_mat4_stack_pop=function(a,b){a.top=a.stack.pop()};a.km_mat4_stack_release=function(a){a.stack=null;a.top=null};b.push=function(b){b=b||this.top;this.stack.push(this.top);this.top=new a.math.Matrix4(b)};
b.pop=function(){this.top=this.stack.pop()};b.release=function(){this._matrixPool=this.top=this.stack=null};b._getFromPool=function(b){var d=this._matrixPool;if(0===d.length)return new a.math.Matrix4(b);d=d.pop();d.assignFrom(b);return d};b._putInPool=function(a){this._matrixPool.push(a)}})(cc);(function(a){a.KM_GL_MODELVIEW=5888;a.KM_GL_PROJECTION=5889;a.KM_GL_TEXTURE=5890;a.modelview_matrix_stack=new a.math.Matrix4Stack;a.projection_matrix_stack=new a.math.Matrix4Stack;a.texture_matrix_stack=new a.math.Matrix4Stack;a.current_stack=null;a.lazyInitialize=function(){var b=new a.math.Matrix4;a.modelview_matrix_stack.initialize();a.projection_matrix_stack.initialize();a.texture_matrix_stack.initialize();a.current_stack=a.modelview_matrix_stack;a.initialized=!0;b.identity();a.modelview_matrix_stack.push(b);
a.projection_matrix_stack.push(b);a.texture_matrix_stack.push(b)};a.lazyInitialize();a.kmGLFreeAll=function(){a.modelview_matrix_stack.release();a.modelview_matrix_stack=null;a.projection_matrix_stack.release();a.projection_matrix_stack=null;a.texture_matrix_stack.release();a.texture_matrix_stack=null;a.initialized=!1;a.current_stack=null};a.kmGLPushMatrix=function(){a.current_stack.push(a.current_stack.top)};a.kmGLPushMatrixWitMat4=function(b){a.current_stack.stack.push(a.current_stack.top);b.assignFrom(a.current_stack.top);
a.current_stack.top=b};a.kmGLPopMatrix=function(){a.current_stack.top=a.current_stack.stack.pop()};a.kmGLMatrixMode=function(b){switch(b){case a.KM_GL_MODELVIEW:a.current_stack=a.modelview_matrix_stack;break;case a.KM_GL_PROJECTION:a.current_stack=a.projection_matrix_stack;break;case a.KM_GL_TEXTURE:a.current_stack=a.texture_matrix_stack;break;default:throw Error("Invalid matrix mode specified");}a.current_stack.lastUpdated=a.director.getTotalFrames()};a.kmGLLoadIdentity=function(){a.current_stack.top.identity()};
a.kmGLLoadMatrix=function(b){a.current_stack.top.assignFrom(b)};a.kmGLMultMatrix=function(b){a.current_stack.top.multiply(b)};var b=new a.math.Matrix4;a.kmGLTranslatef=function(c,e,f){c=a.math.Matrix4.createByTranslation(c,e,f,b);a.current_stack.top.multiply(c)};var c=new a.math.Vec3;a.kmGLRotatef=function(d,e,f,h){c.fill(e,f,h);d=a.math.Matrix4.createByAxisAndAngle(c,a.degreesToRadians(d),b);a.current_stack.top.multiply(d)};a.kmGLScalef=function(c,e,f){c=a.math.Matrix4.createByScale(c,e,f,b);a.current_stack.top.multiply(c)};
a.kmGLGetMatrix=function(b,c){switch(b){case a.KM_GL_MODELVIEW:c.assignFrom(a.modelview_matrix_stack.top);break;case a.KM_GL_PROJECTION:c.assignFrom(a.projection_matrix_stack.top);break;case a.KM_GL_TEXTURE:c.assignFrom(a.texture_matrix_stack.top);break;default:throw Error("Invalid matrix mode specified");}}})(cc);cc.SHADER_POSITION_UCOLOR_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor;\nvoid main()                              \n{ \n    gl_FragColor \x3d v_fragmentColor;      \n}\n";cc.SHADER_POSITION_UCOLOR_VERT="attribute vec4 a_position;\nuniform    vec4 u_color;\nuniform float u_pointSize;\nvarying lowp vec4 v_fragmentColor; \nvoid main(void)   \n{\n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n    gl_PointSize \x3d u_pointSize;          \n    v_fragmentColor \x3d u_color;           \n}";
cc.SHADER_POSITION_COLOR_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvoid main() \n{ \n     gl_FragColor \x3d v_fragmentColor; \n} ";cc.SHADER_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying lowp vec4 v_fragmentColor;\nvoid main()\n{\n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n    v_fragmentColor \x3d a_color;             \n}";cc.SHADER_SPRITE_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying lowp vec4 v_fragmentColor;\nvoid main()\n{\n    gl_Position \x3d CC_PMatrix * a_position;  \n    v_fragmentColor \x3d a_color;             \n}";
cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG="// #extension GL_OES_standard_derivatives : enable\nvarying mediump vec4 v_color;\nvarying mediump vec2 v_texcoord;\nvoid main()\t\n{ \n// #if defined GL_OES_standard_derivatives\t\n// gl_FragColor \x3d v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord)); \n// #else\t\ngl_FragColor \x3d v_color * step(0.0, 1.0 - length(v_texcoord)); \n// #endif \n}";cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT="attribute mediump vec4 a_position; \nattribute mediump vec2 a_texcoord; \nattribute mediump vec4 a_color;\t\nvarying mediump vec4 v_color; \nvarying mediump vec2 v_texcoord;\t\nvoid main() \n{ \n     v_color \x3d a_color;//vec4(a_color.rgb * a_color.a, a_color.a); \n     v_texcoord \x3d a_texcoord; \n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n}";
cc.SHADER_POSITION_TEXTURE_FRAG="precision lowp float;   \nvarying vec2 v_texCoord;  \nvoid main() \n{  \n    gl_FragColor \x3d  texture2D(CC_Texture0, v_texCoord);   \n}";cc.SHADER_POSITION_TEXTURE_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n    v_texCoord \x3d a_texCoord;               \n}";cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG="precision lowp float;  \nuniform vec4 u_color; \nvarying vec2 v_texCoord; \nvoid main() \n{  \n    gl_FragColor \x3d  texture2D(CC_Texture0, v_texCoord) * u_color;    \n}";
cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT="attribute vec4 a_position;\nattribute vec2 a_texCoord; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n    v_texCoord \x3d a_texCoord;                 \n}";cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG="precision lowp float;  \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n    gl_FragColor \x3d vec4( v_fragmentColor.rgb,         \n        v_fragmentColor.a * texture2D(CC_Texture0, v_texCoord).a   \n    ); \n}";
cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color;  \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n    v_fragmentColor \x3d a_color; \n    v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n    gl_FragColor \x3d v_fragmentColor * texture2D(CC_Texture0, v_texCoord); \n}";
cc.SHADER_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color;  \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n    gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position;  \n    v_fragmentColor \x3d a_color; \n    v_texCoord \x3d a_texCoord; \n}";cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color;  \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n    gl_Position \x3d CC_PMatrix * a_position;  \n    v_fragmentColor \x3d a_color; \n    v_texCoord \x3d a_texCoord; \n}";
cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n    vec4 c \x3d texture2D(CC_Texture0, v_texCoord); \n    gl_FragColor.xyz \x3d vec3(0.2126*c.r + 0.7152*c.g + 0.0722*c.b); \n     gl_FragColor.w \x3d c.w ; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG="precision lowp float;   \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord;   \nuniform float CC_alpha_value; \nvoid main() \n{  \n    vec4 texColor \x3d texture2D(CC_Texture0, v_texCoord);  \n    if ( texColor.a \x3c\x3d CC_alpha_value )          \n        discard; \n    gl_FragColor \x3d texColor * v_fragmentColor;  \n}";
cc.SHADEREX_SWITCHMASK_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform sampler2D u_texture;  \nuniform sampler2D   u_mask;   \nvoid main()  \n{  \n    vec4 texColor   \x3d texture2D(u_texture, v_texCoord);  \n    vec4 maskColor  \x3d texture2D(u_mask, v_texCoord); \n    vec4 finalColor \x3d vec4(texColor.r, texColor.g, texColor.b, maskColor.a * texColor.a);        \n    gl_FragColor    \x3d v_fragmentColor * finalColor; \n}";cc.shaderCache={TYPE_POSITION_TEXTURECOLOR:0,TYPE_POSITION_TEXTURECOLOR_ALPHATEST:1,TYPE_POSITION_COLOR:2,TYPE_POSITION_TEXTURE:3,TYPE_POSITION_TEXTURE_UCOLOR:4,TYPE_POSITION_TEXTURE_A8COLOR:5,TYPE_POSITION_UCOLOR:6,TYPE_POSITION_LENGTH_TEXTURECOLOR:7,TYPE_SPRITE_POSITION_TEXTURECOLOR:8,TYPE_SPRITE_POSITION_TEXTURECOLOR_ALPHATEST:9,TYPE_SPRITE_POSITION_COLOR:10,TYPE_SPRITE_POSITION_TEXTURECOLOR_GRAY:11,TYPE_MAX:11,_keyMap:[cc.SHADER_POSITION_TEXTURECOLOR,cc.SHADER_POSITION_TEXTURECOLORALPHATEST,cc.SHADER_POSITION_COLOR,
cc.SHADER_POSITION_TEXTURE,cc.SHADER_POSITION_TEXTURE_UCOLOR,cc.SHADER_POSITION_TEXTUREA8COLOR,cc.SHADER_POSITION_UCOLOR,cc.SHADER_POSITION_LENGTHTEXTURECOLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST,cc.SHADER_SPRITE_POSITION_COLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY],_programs:{},_init:function(){this.loadDefaultShaders();return!0},_loadDefaultShader:function(a,b){switch(b){case cc.SHADER_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT,
cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,
cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT,
cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);
a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_VERT,cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_SPRITE_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_COLOR_VERT,
cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_POSITION_TEXTURE:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_VERT,cc.SHADER_POSITION_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURE_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT,
cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTUREA8COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT,cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,
cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_UCOLOR_VERT,cc.SHADER_POSITION_UCOLOR_FRAG);a.addAttribute("aVertex",cc.VERTEX_ATTRIB_POSITION);break;case cc.SHADER_POSITION_LENGTHTEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT,cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);
a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;default:cc.log("cocos2d: cc.shaderCache._loadDefaultShader, error shader type");return}a.link();a.updateUniforms()},loadDefaultShaders:function(){for(var a=0;a<this.TYPE_MAX;++a)this.programForKey(this._keyMap[a])},reloadDefaultShaders:function(){var a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLOR);a.reset();this._loadDefaultShader(a,cc.SHADER_POSITION_TEXTURECOLOR);a=this.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR);
a.reset();this._loadDefaultShader(a,cc.SHADER_SPRITE_POSITION_TEXTURECOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST);a.reset();this._loadDefaultShader(a,cc.SHADER_POSITION_TEXTURECOLORALPHATEST);a=this.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST);a.reset();this._loadDefaultShader(a,cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST);a=this.programForKey(cc.SHADER_POSITION_COLOR);a.reset();this._loadDefaultShader(a,cc.SHADER_POSITION_COLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURE);
a.reset();this._loadDefaultShader(a,cc.SHADER_POSITION_TEXTURE);a=this.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG);a.reset();this._loadDefaultShader(a,cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG);a=this.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);a.reset();this._loadDefaultShader(a,cc.SHADER_POSITION_TEXTURE_UCOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTUREA8COLOR);a.reset();this._loadDefaultShader(a,cc.SHADER_POSITION_TEXTUREA8COLOR);a=this.programForKey(cc.SHADER_POSITION_UCOLOR);
a.reset();this._loadDefaultShader(a,cc.SHADER_POSITION_UCOLOR)},programForKey:function(a){if(!this._programs[a]){var b=new cc.GLProgram;this._loadDefaultShader(b,a);this._programs[a]=b}return this._programs[a]},getProgram:function(a){return this.programForKey(a)},addProgram:function(a,b){this._programs[b]=a}};cc.GLProgram=cc.Class.extend({_glContext:null,_programObj:null,_vertShader:null,_fragShader:null,_uniforms:null,_hashForUniforms:null,_usesTime:!1,_projectionUpdated:-1,_updateUniform:function(a){if(!a)return!1;var b=!1,c=this._hashForUniforms[a],d;if(Array.isArray(arguments[1]))d=arguments[1];else{d=Array(arguments.length-1);for(var e=1;e<arguments.length;e+=1)d[e-1]=arguments[e]}if(c&&c.length===d.length)for(e=0;e<d.length;e+=1){if(d[e]!==c[e]||"object"===typeof d[e])c[e]=d[e],b=!0}else this._hashForUniforms[a]=
[].concat(d),b=!0;return b},_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,b,c){if(!c||!a)return!1;c=(cc.GLProgram._isHighpSupported()?"precision highp float;\n":"precision mediump float;\n")+"uniform 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;        \nuniform sampler2D CC_Texture0;   \n//CC INCLUDES END                \n"+
c;this._glContext.shaderSource(a,c);this._glContext.compileShader(a);c=this._glContext.getShaderParameter(a,this._glContext.COMPILE_STATUS);c||(cc.log("cocos2d: ERROR: Failed to compile shader:\n"+this._glContext.getShaderSource(a)),b===this._glContext.VERTEX_SHADER?cc.log("cocos2d: \n"+this.vertexShaderLog()):cc.log("cocos2d: \n"+this.fragmentShaderLog()));return!0===c},ctor:function(a,b,c){this._uniforms={};this._hashForUniforms={};this._glContext=c||cc._renderContext;a&&b&&this.init(a,b)},destroyProgram:function(){this._hashForUniforms=
this._uniforms=this._fragShader=this._vertShader=null;this._glContext.deleteProgram(this._programObj)},initWithVertexShaderByteArray:function(a,b){var c=this._glContext;this._programObj=c.createProgram();this._fragShader=this._vertShader=null;a&&(this._vertShader=c.createShader(c.VERTEX_SHADER),this._compileShader(this._vertShader,c.VERTEX_SHADER,a)||cc.log("cocos2d: ERROR: Failed to compile vertex shader"));b&&(this._fragShader=c.createShader(c.FRAGMENT_SHADER),this._compileShader(this._fragShader,
c.FRAGMENT_SHADER,b)||cc.log("cocos2d: ERROR: Failed to compile fragment shader"));this._vertShader&&c.attachShader(this._programObj,this._vertShader);cc.checkGLErrorDebug();this._fragShader&&c.attachShader(this._programObj,this._fragShader);0<Object.keys(this._hashForUniforms).length&&(this._hashForUniforms={});cc.checkGLErrorDebug();return!0},initWithString:function(a,b){return this.initWithVertexShaderByteArray(a,b)},initWithVertexShaderFilename:function(a,b){var c=cc.loader.getRes(a);if(!c)throw Error("Please load the resource firset : "+
a);var d=cc.loader.getRes(b);if(!d)throw Error("Please load the resource firset : "+b);return this.initWithVertexShaderByteArray(c,d)},init:function(a,b){return this.initWithVertexShaderFilename(a,b)},addAttribute:function(a,b){this._glContext.bindAttribLocation(this._programObj,b,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.game.config[cc.game.CONFIG_KEY.debugMode]&&!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._addUniformLocation(cc.UNIFORM_PMATRIX_S);
this._addUniformLocation(cc.UNIFORM_MVMATRIX_S);this._addUniformLocation(cc.UNIFORM_MVPMATRIX_S);this._addUniformLocation(cc.UNIFORM_TIME_S);this._addUniformLocation(cc.UNIFORM_SINTIME_S);this._addUniformLocation(cc.UNIFORM_COSTIME_S);this._addUniformLocation(cc.UNIFORM_RANDOM01_S);this._addUniformLocation(cc.UNIFORM_SAMPLER_S);this._usesTime=null!=this._uniforms[cc.UNIFORM_TIME_S]||null!=this._uniforms[cc.UNIFORM_SINTIME_S]||null!=this._uniforms[cc.UNIFORM_COSTIME_S];this.use();this.setUniformLocationWith1i(this._uniforms[cc.UNIFORM_SAMPLER_S],
0)},_addUniformLocation:function(a){var b=this._glContext.getUniformLocation(this._programObj,a);b&&(b._name=a);return this._uniforms[a]=b},getUniformLocationForName:function(a){if(!a)throw Error("cc.GLProgram.getUniformLocationForName(): uniform name should be non-null");if(!this._programObj)throw Error("cc.GLProgram.getUniformLocationForName(): Invalid operation. Cannot get uniform location when program is not initialized");return this._uniforms[a]||this._addUniformLocation(a)},getUniformMVPMatrix:function(){return this._uniforms[cc.UNIFORM_MVPMATRIX_S]},
getUniformSampler:function(){return this._uniforms[cc.UNIFORM_SAMPLER_S]},setUniformLocationWith1i:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform1i(a,b)):this._glContext.uniform1i(a,b)},setUniformLocationWith2i:function(a,b,c){var d="string"===typeof a,e=d?a:a&&a._name;e?this._updateUniform(e,b,c)&&(d&&(a=this.getUniformLocationForName(e)),this._glContext.uniform2i(a,b,c)):this._glContext.uniform2i(a,
b,c)},setUniformLocationWith3i:function(a,b,c,d){var e="string"===typeof a,f=e?a:a&&a._name;f?this._updateUniform(f,b,c,d)&&(e&&(a=this.getUniformLocationForName(f)),this._glContext.uniform3i(a,b,c,d)):this._glContext.uniform3i(a,b,c,d)},setUniformLocationWith4i:function(a,b,c,d,e){var f="string"===typeof a,h=f?a:a&&a._name;h?this._updateUniform(h,b,c,d,e)&&(f&&(a=this.getUniformLocationForName(h)),this._glContext.uniform4i(a,b,c,d,e)):this._glContext.uniform4i(a,b,c,d,e)},setUniformLocationWith2iv:function(a,
b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform2iv(a,b)):this._glContext.uniform2iv(a,b)},setUniformLocationWith3iv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform3iv(a,b)):this._glContext.uniform3iv(a,b)},setUniformLocationWith4iv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,
b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform4iv(a,b)):this._glContext.uniform4iv(a,b)},setUniformLocationI32:function(a,b){this.setUniformLocationWith1i(a,b)},setUniformLocationWith1f:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform1f(a,b)):this._glContext.uniform1f(a,b)},setUniformLocationWith2f:function(a,b,c){var d="string"===typeof a,e=d?a:a&&a._name;e?this._updateUniform(e,
b,c)&&(d&&(a=this.getUniformLocationForName(e)),this._glContext.uniform2f(a,b,c)):this._glContext.uniform2f(a,b,c)},setUniformLocationWith3f:function(a,b,c,d){var e="string"===typeof a,f=e?a:a&&a._name;f?this._updateUniform(f,b,c,d)&&(e&&(a=this.getUniformLocationForName(f)),this._glContext.uniform3f(a,b,c,d)):this._glContext.uniform3f(a,b,c,d)},setUniformLocationWith4f:function(a,b,c,d,e){var f="string"===typeof a,h=f?a:a&&a._name;h?this._updateUniform(h,b,c,d,e)&&(f&&(a=this.getUniformLocationForName(h)),
this._glContext.uniform4f(a,b,c,d,e)):(this._glContext.uniform4f(a,b,c,d,e),cc.log("uniform4f",b,c,d,e))},setUniformLocationWith2fv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform2fv(a,b)):this._glContext.uniform2fv(a,b)},setUniformLocationWith3fv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform3fv(a,
b)):this._glContext.uniform3fv(a,b)},setUniformLocationWith4fv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniform4fv(a,b)):(this._glContext.uniform4fv(a,b),cc.log("uniform4fv",b))},setUniformLocationWithMatrix2fv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniformMatrix2fv(a,!1,b)):this._glContext.uniformMatrix2fv(a,
!1,b)},setUniformLocationWithMatrix3fv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniformMatrix3fv(a,!1,b)):this._glContext.uniformMatrix3fv(a,!1,b)},setUniformLocationWithMatrix4fv:function(a,b){var c="string"===typeof a,d=c?a:a&&a._name;d?this._updateUniform(d,b)&&(c&&(a=this.getUniformLocationForName(d)),this._glContext.uniformMatrix4fv(a,!1,b)):this._glContext.uniformMatrix4fv(a,!1,b)},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.math.Matrix4,b=new cc.math.Matrix4,c=new cc.math.Matrix4;
cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,a);cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,b);cc.kmMat4Multiply(c,a,b);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],a.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10,
a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())},_setUniformsForBuiltinsForRenderer:function(a){if(a&&a._renderCmd){var b=new cc.math.Matrix4,c=new cc.math.Matrix4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,
b);cc.kmMat4Multiply(c,b,a._renderCmd._stackMatrix);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],a._renderCmd._stackMatrix.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S],
a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())}},setUniformForModelViewProjectionMatrix:function(){this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],cc.getMat4MultiplyValue(cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top))},
setUniformForModelViewProjectionMatrixWithMat4:function(a){cc.kmMat4Multiply(a,cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],a.mat)},setUniformForModelViewAndProjectionMatrixWithMat4:function(){this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],cc.modelview_matrix_stack.top.mat);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],cc.projection_matrix_stack.top.mat)},
_setUniformForMVPMatrixWithMat4:function(a){if(!a)throw Error("modelView matrix is undefined.");this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],a.mat);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],cc.projection_matrix_stack.top.mat)},_updateProjectionUniform:function(){var a=cc.projection_matrix_stack;a.lastUpdated!==this._projectionUpdated&&(this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],!1,a.top.mat),this._projectionUpdated=
a.lastUpdated)},vertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getVertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getFragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},fragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._fragShader)},programLog:function(){return this._glContext.getProgramInfoLog(this._programObj)},getProgramLog:function(){return this._glContext.getProgramInfoLog(this._programObj)},
reset:function(){this._fragShader=this._vertShader=null;0<Object.keys(this._uniforms).length&&(this._uniforms={});this._glContext.deleteProgram(this._programObj);this._programObj=null;0<Object.keys(this._hashForUniforms).length&&(this._hashForUniforms={})},getProgram:function(){return this._programObj},retain:function(){},release:function(){}});cc.GLProgram.create=function(a,b){return new cc.GLProgram(a,b)};cc.GLProgram._highpSupported=null;
cc.GLProgram._isHighpSupported=function(){var a=cc._renderContext;a.getShaderPrecisionFormat&&null==cc.GLProgram._highpSupported&&(a=a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT),cc.GLProgram._highpSupported=0!==a.precision);return cc.GLProgram._highpSupported};cc.setProgram=function(a,b){a.shaderProgram=b;var c=a.children;if(c)for(var d=0;d<c.length;d++)cc.setProgram(c[d],b)};var types={GL_FLOAT:0,GL_INT:1,GL_FLOAT_VEC2:2,GL_FLOAT_VEC3:3,GL_FLOAT_VEC4:4,GL_FLOAT_MAT4:5,GL_CALLBACK:6,GL_TEXTURE:7};cc.UniformValue=function(a,b){this._uniform=a;this._glprogram=b;this._value=null;this._type=-1};
cc.UniformValue.prototype={setFloat:function(a){this._value=a;this._type=types.GL_FLOAT},setInt:function(a){this._value=a;this._type=types.GL_INT},setVec2:function(a,b){this._value=[a,b];this._type=types.GL_FLOAT_VEC2},setVec2v:function(a){this._value=a.slice(0);this._type=types.GL_FLOAT_VEC2},setVec3:function(a,b,c){this._value=[a,b,c];this._type=types.GL_FLOAT_VEC3},setVec3v:function(a){this._value=a.slice(0);this._type=types.GL_FLOAT_VEC3},setVec4:function(a,b,c,d){this._value=[a,b,c,d];this._type=
types.GL_FLOAT_VEC4},setVec4v:function(a){this._value=a.slice(0);this._type=types.GL_FLOAT_VEC4},setMat4:function(a){this._value=a.slice(0);this._type=types.GL_FLOAT_MAT4},setCallback:function(a){this._value=a;this._type=types.GL_CALLBACK},setTexture:function(a,b){this._value=b;this._textureId=a;this._type=types.GL_TEXTURE},apply:function(){switch(this._type){case types.GL_INT:this._glprogram.setUniformLocationWith1i(this._uniform._location,this._value);break;case types.GL_FLOAT:this._glprogram.setUniformLocationWith1f(this._uniform._location,
this._value);break;case types.GL_FLOAT_VEC2:this._glprogram.setUniformLocationWith2fv(this._uniform._location,this._value);break;case types.GL_FLOAT_VEC3:this._glprogram.setUniformLocationWith3fv(this._uniform._location,this._value);break;case types.GL_FLOAT_VEC4:this._glprogram.setUniformLocationWith4fv(this._uniform._location,this._value);break;case types.GL_FLOAT_MAT4:this._glprogram.setUniformLocationWithMatrix4fv(this._uniform._location,this._value);break;case types.GL_CALLBACK:this._value(this._glprogram,
this._uniform);break;case types.GL_TEXTURE:this._glprogram.setUniformLocationWith1i(this._uniform._location,this._value),cc.glBindTexture2DN(this._value,this._textureId)}}};
cc.GLProgramState=function(a){this._glprogram=a;this._uniforms={};this._boundTextureUnits={};this._textureUnitIndex=1;for(var b=a._glContext.getProgramParameter(a._programObj,a._glContext.ACTIVE_UNIFORMS),c=0;c<b;c+=1){var d=a._glContext.getActiveUniform(a._programObj,c);if(0!==d.name.indexOf("CC_")){d._location=a._glContext.getUniformLocation(a._programObj,d.name);d._location._name=d.name;var e=new cc.UniformValue(d,a);this._uniforms[d.name]=e}}};
cc.GLProgramState.prototype={apply:function(a){this._glprogram.use();a&&this._glprogram._setUniformForMVPMatrixWithMat4(a);for(var b in this._uniforms)this._uniforms[b].apply()},setGLProgram:function(a){this._glprogram=a},getGLProgram:function(){return this._glprogram},getUniformCount:function(){return this._uniforms.length},getUniformValue:function(a){return this._uniforms[a]},setUniformInt:function(a,b){var c=this.getUniformValue(a);c?c.setInt(b):cc.log("cocos2d: warning: Uniform not found: "+a)},
setUniformFloat:function(a,b){var c=this.getUniformValue(a);c?c.setFloat(b):cc.log("cocos2d: warning: Uniform not found: "+a)},setUniformVec2:function(a,b,c){var d=this.getUniformValue(a);d?d.setVec2(b,c):cc.log("cocos2d: warning: Uniform not found: "+a)},setUniformVec2v:function(a,b){var c=this.getUniformValue(a);c?c.setVec2v(b):cc.log("cocos2d: warning: Uniform not found: "+a)},setUniformVec3:function(a,b,c,d){var e=this.getUniformValue(a);e?e.setVec3(b,c,d):cc.log("cocos2d: warning: Uniform not found: "+
a)},setUniformVec3v:function(a,b){var c=this.getUniformValue(a);c?c.setVec3v(b):cc.log("cocos2d: warning: Uniform not found: "+a)},setUniformVec4:function(a,b,c,d,e){var f=this.getUniformValue(a);f?f.setVec4(b,c,d,e):cc.log("cocos2d: warning: Uniform not found: "+a)},setUniformVec4v:function(a,b){var c=this.getUniformValue(a);c?c.setVec4v(b):cc.log("cocos2d: warning: Uniform not found: "+a)},setUniformMat4:function(a,b){var c=this.getUniformValue(a);c?c.setMat4(b):cc.log("cocos2d: warning: Uniform not found: "+
a)},setUniformCallback:function(a,b){var c=this.getUniformValue(a);c?c.setCallback(b):cc.log("cocos2d: warning: Uniform not found: "+a)},setUniformTexture:function(a,b){var c=this.getUniformValue(a);if(c){var d=this._boundTextureUnits[a];d?c.setTexture(b,d):(c.setTexture(b,this._textureUnitIndex),this._boundTextureUnits[a]=this._textureUnitIndex++)}}};cc.GLProgramState._cache={};
cc.GLProgramState.getOrCreateWithGLProgram=function(a){var b=cc.GLProgramState._cache[a.__instanceId];b||(b=new cc.GLProgramState(a),cc.GLProgramState._cache[a.__instanceId]=b);return b};cc._currentProjectionMatrix=-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;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=cc.ENABLE_GL_STATE_CACHE?function(a){a!==cc._currentShaderProgram&&(cc._currentShaderProgram=a,cc._renderContext.useProgram(a))}: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.setBlending=function(a,b){var c=cc._renderContext;a===c.ONE&&b===c.ZERO?c.disable(c.BLEND):(c.enable(c.BLEND),cc._renderContext.blendFunc(a,b))};cc.glBlendFunc=cc.ENABLE_GL_STATE_CACHE?function(a,b){if(a!==cc._blendingSource||b!==cc._blendingDest)cc._blendingSource=a,cc._blendingDest=b,cc.setBlending(a,b)}:cc.setBlending;
cc.glBlendFuncForParticle=function(a,b){if(a!==cc._blendingSource||b!==cc._blendingDest){cc._blendingSource=a;cc._blendingDest=b;var c=cc._renderContext;a===c.ONE&&b===c.ZERO?c.disable(c.BLEND):(c.enable(c.BLEND),c.blendFuncSeparate(c.SRC_ALPHA,b,a,b))}};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.glBindTexture2D=function(a){cc.glBindTexture2DN(0,a)};
cc.glBindTexture2DN=cc.ENABLE_GL_STATE_CACHE?function(a,b){if(cc._currentBoundTexture[a]!==b){cc._currentBoundTexture[a]=b;var c=cc._renderContext;c.activeTexture(c.TEXTURE0+a);b?c.bindTexture(c.TEXTURE_2D,b._webTextureObj):c.bindTexture(c.TEXTURE_2D,null)}}:function(a,b){var c=cc._renderContext;c.activeTexture(c.TEXTURE0+a);b?c.bindTexture(c.TEXTURE_2D,b._webTextureObj):c.bindTexture(c.TEXTURE_2D,null)};cc.glDeleteTexture=function(a){cc.glDeleteTextureN(0,a)};
cc.glDeleteTextureN=function(a,b){cc.ENABLE_GL_STATE_CACHE&&b===cc._currentBoundTexture[a]&&(cc._currentBoundTexture[a]=-1);cc._renderContext.deleteTexture(b._webTextureObj)};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=9;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({sprite:null,clearFlags:0,clearDepthVal:0,autoDraw:!1,_texture:null,_pixelFormat:0,clearStencilVal:0,_clearColor:null,_className:"RenderTexture",ctor:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888;this._clearColor=new cc.Color(0,0,0,255);void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.initWithWidthAndHeight(a,b,c,d||0));this.setAnchorPoint(0,
0)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.RenderTexture.CanvasRenderCmd(this):new cc.RenderTexture.WebGLRenderCmd(this)},visit:function(a){var b=this._renderCmd;a=a?a._renderCmd:null;if(this._visible){var c=cc.renderer;b.visit(a);c.pushRenderCommand(b);this.sprite.visit(this);b._dirtyFlag=0}else b._propagateFlagsDown(a)},cleanup:function(){cc.Node.prototype.onExit.call(this);this._renderCmd.cleanup()},getSprite:function(){return this.sprite},setSprite:function(a){this.sprite=
a},setVirtualViewport:function(a,b,c){this._renderCmd.setVirtualViewport(a,b,c)},initWithWidthAndHeight:function(a,b,c,d){return this._renderCmd.initWithWidthAndHeight(a,b,c,d)},begin:function(){cc.renderer._turnToCacheMode(this.__instanceId);this._renderCmd.begin()},beginWithClear:function(a,b,c,d,e,f){var h=cc._renderContext;e=e||h.COLOR_BUFFER_BIT;f=f||h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT;this._beginWithClear(a,b,c,d,e,f,h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)},_beginWithClear:function(a,
b,c,d,e,f,h){this.begin();this._renderCmd._beginWithClear(a,b,c,d,e,f,h)},end:function(){this._renderCmd.end()},clear:function(a,b,c,d){this.beginWithClear(a,b,c,d);this.end()},clearRect:function(a,b,c,d){this._renderCmd.clearRect(a,b,c,d)},clearDepth:function(a){this._renderCmd.clearDepth(a)},clearStencil:function(a){this._renderCmd.clearStencil(a)},getClearFlags:function(){return this.clearFlags},setClearFlags:function(a){this.clearFlags=a},getClearColor:function(){return this._clearColor},setClearColor:function(a){var b=
this._clearColor;b.r=a.r;b.g=a.g;b.b=a.b;b.a=a.a;this._renderCmd.updateClearColor(a)},getClearDepth:function(){return this.clearDepthVal},setClearDepth:function(a){this.clearDepthVal=a},getClearStencil:function(){return this.clearStencilVal},setClearStencil:function(a){this.clearStencilVal=a},isAutoDraw:function(){return this.autoDraw},setAutoDraw:function(a){this.autoDraw=a},saveToFile:function(a,b){cc.log("saveToFile isn't supported on Cocos2d-Html5")},newCCImage:function(a){cc.log("saveToFile isn't supported on cocos2d-html5");
return null},listenToBackground:function(a){},listenToForeground:function(a){}});_p=cc.RenderTexture.prototype;cc.defineGetterSetter(_p,"clearColorVal",_p.getClearColor,_p.setClearColor);cc.RenderTexture.create=function(a,b,c,d){return new cc.RenderTexture(a,b,c,d)};(function(){cc.RenderTexture.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._clearColorStr="rgba(255,255,255,1)";this._cacheCanvas=document.createElement("canvas");this._cacheContext=new cc.CanvasContextWrapper(this._cacheCanvas.getContext("2d"))};var a=cc.RenderTexture.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.RenderTexture.CanvasRenderCmd;a.cleanup=function(){this._cacheCanvas=this._cacheContext=null};a.clearStencil=function(a){};
a.setVirtualViewport=function(a,c,d){};a.updateClearColor=function(a){this._clearColorStr="rgba("+(0|a.r)+","+(0|a.g)+","+(0|a.b)+","+a.a/255+")"};a.initWithWidthAndHeight=function(a,c,d,e){d=this._node;e=this._cacheCanvas;var f=cc.contentScaleFactor();e.width=0|a*f;e.height=0|c*f;a=new cc.Texture2D;a.initWithElement(e);a.handleLoadedTexture();a=d.sprite=new cc.Sprite(a);a.setBlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA);d.autoDraw=!1;d.addChild(a);return!0};a.begin=function(){};a._beginWithClear=function(a,
c,d,e,f,h,k){a=a||0;c=c||0;d=d||0;e=isNaN(e)?255:e;f=this._cacheContext.getContext();h=this._cacheCanvas;f.setTransform(1,0,0,1,0,0);this._cacheContext.setFillStyle("rgba("+(0|a)+","+(0|c)+","+(0|d)+","+e/255+")");f.clearRect(0,0,h.width,h.height);f.fillRect(0,0,h.width,h.height)};a.end=function(){var a=this._node,c=cc.contentScaleFactor();cc.renderer._renderingToCacheCanvas(this._cacheContext,a.__instanceId,c,c);a=a.sprite._renderCmd;a._notifyRegionStatus&&a._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty)};
a.clearRect=function(a,c,d,e){this._cacheContext.clearRect(a,c,d,-e)};a.clearDepth=function(a){cc.log("clearDepth isn't supported on Cocos2d-Html5")}})();(function(){cc.RenderTexture.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._depthRenderBuffer=this._textureCopy=this._oldFBO=this._fBO=null;this._rtTextureRect=new cc.Rect;this._fullRect=new cc.Rect;this._fullViewport=new cc.Rect};var a=cc.RenderTexture.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.RenderTexture.WebGLRenderCmd;a.setVirtualViewport=function(a,c,d){this._rtTextureRect.x=a.x;this._rtTextureRect.y=a.y;this._fullRect=c;
this._fullViewport=d};a.needDraw=function(){return this._needDraw&&this._node.autoDraw};a.rendering=function(a){var c=a||cc._renderContext;a=this._node;if(a.autoDraw){a.begin();var d=a.clearFlags;if(d){var e=[0,0,0,0],f=0,h=0;d&c.COLOR_BUFFER_BIT&&(e=c.getParameter(c.COLOR_CLEAR_VALUE),c.clearColor(a._clearColor.r/255,a._clearColor.g/255,a._clearColor.b/255,a._clearColor.a/255));d&c.DEPTH_BUFFER_BIT&&(f=c.getParameter(c.DEPTH_CLEAR_VALUE),c.clearDepth(a.clearDepthVal));d&c.STENCIL_BUFFER_BIT&&(h=
c.getParameter(c.STENCIL_CLEAR_VALUE),c.clearStencil(a.clearStencilVal));c.clear(d);d&c.COLOR_BUFFER_BIT&&c.clearColor(e[0],e[1],e[2],e[3]);d&c.DEPTH_BUFFER_BIT&&c.clearDepth(f);d&c.STENCIL_BUFFER_BIT&&c.clearStencil(h)}a.sortAllChildren();c=a._children;for(d=0;d<c.length;d++)e=c[d],e!==a.sprite&&e.visit(a.sprite);a.end()}};a.clearStencil=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)};a.cleanup=function(){this._textureCopy=
null;var a=cc._renderContext;a.deleteFramebuffer(this._fBO);this._depthRenderBuffer&&a.deleteRenderbuffer(this._depthRenderBuffer)};a.updateClearColor=function(a){};a.initWithWidthAndHeight=function(a,c,d,e){var f=this._node;d===cc.Texture2D.PIXEL_FORMAT_A8&&cc.log("cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;");var h=cc._renderContext,k=cc.contentScaleFactor();this._fullRect=new cc.Rect(0,0,a,c);this._fullViewport=new cc.Rect(0,0,
a,c);a=0|a*k;c=0|c*k;this._oldFBO=h.getParameter(h.FRAMEBUFFER_BINDING);var m;cc.configuration.supportsNPOT()?(k=a,m=c):(k=cc.NextPOT(a),m=cc.NextPOT(c));for(var n=new Uint8Array(k*m*4),p=0;p<k*m*4;p++)n[p]=0;this._pixelFormat=d;p=f._texture=new cc.Texture2D;if(!f._texture)return!1;p.initWithData(n,f._pixelFormat,k,m,cc.size(a,c));d=h.getParameter(h.RENDERBUFFER_BINDING);if(cc.configuration.checkForGLExtension("GL_QCOM")){this._textureCopy=new cc.Texture2D;if(!this._textureCopy)return!1;this._textureCopy.initWithData(n,
f._pixelFormat,k,m,cc.size(a,c))}this._fBO=h.createFramebuffer();h.bindFramebuffer(h.FRAMEBUFFER,this._fBO);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,p._webTextureObj,0);0!==e&&(this._depthRenderBuffer=h.createRenderbuffer(),h.bindRenderbuffer(h.RENDERBUFFER,this._depthRenderBuffer),h.renderbufferStorage(h.RENDERBUFFER,e,k,m),e===h.DEPTH_STENCIL?h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,this._depthRenderBuffer):e===h.STENCIL_INDEX||
e===h.STENCIL_INDEX8?h.framebufferRenderbuffer(h.FRAMEBUFFER,h.STENCIL_ATTACHMENT,h.RENDERBUFFER,this._depthRenderBuffer):e===h.DEPTH_COMPONENT16&&h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,this._depthRenderBuffer));h.checkFramebufferStatus(h.FRAMEBUFFER)!==h.FRAMEBUFFER_COMPLETE&&cc.log("Could not attach texture to the framebuffer");p.setAliasTexParameters();a=f.sprite=new cc.Sprite(p);a.scaleY=-1;a.setBlendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.bindRenderbuffer(h.RENDERBUFFER,
d);h.bindFramebuffer(h.FRAMEBUFFER,this._oldFBO);f.autoDraw=!1;f.addChild(a);return!0};a.begin=function(){var a=this._node;cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPushMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLPushMatrix();var c=cc._renderContext,d=cc.director;d.setProjection(d.getProjection());var e=a._texture.getContentSizeInPixels(),f=cc.director.getWinSizeInPixels(),d=f.width/e.width,e=f.height/e.height,d=cc.math.Matrix4.createOrthographicProjection(-1/d,1/d,-1/e,1/e,-1,1);cc.kmGLMultMatrix(d);
d=new cc.Rect(0,0,0,0);d.width=this._fullViewport.width;d.height=this._fullViewport.height;e=d.height/this._fullRect.height;d.x=d.width/this._fullRect.width*(this._fullRect.x-this._rtTextureRect.x);d.y=(this._fullRect.y-this._rtTextureRect.y)*e;c.viewport(d.x,d.y,d.width,d.height);this._oldFBO=c.getParameter(c.FRAMEBUFFER_BINDING);c.bindFramebuffer(c.FRAMEBUFFER,this._fBO);cc.configuration.checkForGLExtension("GL_QCOM")&&(c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,this._textureCopy._webTextureObj,
0),c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,a._texture._webTextureObj,0))};a._beginWithClear=function(a,c,d,e,f,h,k){a/=255;c/=255;d/=255;e/=255;var m=cc._renderContext,n=[0,0,0,0],p=0,r=0;k&m.COLOR_BUFFER_BIT&&(n=m.getParameter(m.COLOR_CLEAR_VALUE),m.clearColor(a,c,d,e));k&m.DEPTH_BUFFER_BIT&&(p=m.getParameter(m.DEPTH_CLEAR_VALUE),m.clearDepth(f));k&m.STENCIL_BUFFER_BIT&&(r=m.getParameter(m.STENCIL_CLEAR_VALUE),m.clearStencil(h));
m.clear(k);k&m.COLOR_BUFFER_BIT&&m.clearColor(n[0],n[1],n[2],n[3]);k&m.DEPTH_BUFFER_BIT&&m.clearDepth(p);k&m.STENCIL_BUFFER_BIT&&m.clearStencil(r)};a.end=function(){cc.renderer._renderingToBuffer(this._node.__instanceId);var a=cc._renderContext,c=cc.director;a.bindFramebuffer(a.FRAMEBUFFER,this._oldFBO);c.setViewport();cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPopMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLPopMatrix()};a.clearRect=function(a,c,d,e){};a.clearDepth=function(a){var c=this._node;
c.begin();var d=cc._renderContext,e=d.getParameter(d.DEPTH_CLEAR_VALUE);d.clearDepth(a);d.clear(d.DEPTH_BUFFER_BIT);d.clearDepth(e);c.end()}})();cc.LabelBMFont=cc.SpriteBatchNode.extend({_opacityModifyRGB:!1,_string:"",_config:null,_fntFile:"",_initialString:"",_alignment:cc.TEXT_ALIGNMENT_CENTER,_width:-1,_lineBreakWithoutSpaces:!1,_imageOffset:null,_textureLoaded:!1,_className:"LabelBMFont",_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.LabelBMFont.WebGLRenderCmd(this):new cc.LabelBMFont.CanvasRenderCmd(this)},_setString:function(a,b){b?this._initialString=a:this._string=a;var c=this._children;if(c)for(var d=
0;d<c.length;d++){var e=c[d];e&&e.setVisible(!1)}this._textureLoaded&&(this._string&&0<this._string.length&&this.createFontChars(),b&&this.updateLabel())},ctor:function(a,b,c,d,e){cc.SpriteBatchNode.prototype.ctor.call(this);this._imageOffset=cc.p(0,0);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this.initWithString(a,b,c,d,e)},textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},isOpacityModifyRGB:function(){return this._opacityModifyRGB},
setOpacityModifyRGB:function(a){this._opacityModifyRGB=a;if(a=this._children)for(var b=0;b<a.length;b++){var c=a[b];c&&(c.opacityModifyRGB=this._opacityModifyRGB)}},_changeTextureColor:function(){this._renderCmd._changeTextureColor()},init:function(){return this.initWithString(null,null,null,null,null)},initWithString:function(a,b,c,d,e){a=a||"";this._config&&cc.log("cc.LabelBMFont.initWithString(): re-init is no longer supported");var f;if(b){f=cc.loader.getRes(b);if(!f&&(f=cc.FntFrameCache[b]||
cc.FntFrameCache[cc.path.basename(b)],!f))return cc.log("cc.LabelBMFont.initWithString(): Impossible to create font. Please check file"),!1;this._config=f;this._fntFile=b;b=f.atlasName;(b=cc.spriteFrameCache.getSpriteFrame(b)||cc.spriteFrameCache.getSpriteFrame(cc.path.basename(b)))?(f=b.getTexture(),this._spriteFrame=b):f=cc.textureCache.addImage(f.atlasName);(this._textureLoaded=b=f.isLoaded())||f.addEventListener("load",function(a){this._textureLoaded=!0;this.initWithTexture(a,this._initialString.length);
this.setString(this._initialString,!0);this.dispatchEvent("load")},this)}else f=new cc.Texture2D,b=new Image,f.initWithElement(b),this._textureLoaded=!1;return this.initWithTexture(f,a.length)?(this._alignment=d||cc.TEXT_ALIGNMENT_LEFT,this._imageOffset=e||cc.p(0,0),this._width=void 0===c?-1:c,this._realOpacity=255,this._realColor=cc.color(255,255,255,255),this._contentSize.width=0,this._contentSize.height=0,this.setAnchorPoint(0.5,0.5),this.setString(a,!0),!0):!1},createFontChars:function(){var a=
this._string,b=a?a.length:0,c=this._renderCmd,d=c._texture||this._texture,e=0,f=cc.size(0,0),h=0,k=1,m,n=this._config,p=n.kerningDict,r=n.commonHeight,s=n.fontDefDictionary;for(m=0;m<b-1;m++)10===a.charCodeAt(m)&&k++;var t=r*k,k=-(r-r*k),w=-1,v;for(m=0;m<b;m++)if(r=a.charCodeAt(m),0!==r)if(10===r)e=0,k-=n.commonHeight;else{w=p[w<<16|r&65535]||0;v=s[r];v||(cc.log("cocos2d: LabelBMFont: character not found "+a[m]),v={rect:{x:0,y:0,width:0,height:0},xOffset:0,yOffset:0,xAdvance:0});var y=cc.rect(v.rect.x,
v.rect.y,v.rect.width,v.rect.height),y=cc.rectPixelsToPoints(y);y.x+=this._imageOffset.x;y.y+=this._imageOffset.y;var x=!1;if(this._spriteFrame){var u=this._spriteFrame._rect;if(this._spriteFrame._rotated){var x=!0,z=y.x;y.x=y.y+u.x;y.y=z+u.y}else y.x+=u.x,y.y+=u.y}(u=this.getChildByTag(m))?c._updateCharTexture(u,y,r,x):(u=new cc.Sprite,u.initWithTexture(d,y,x),u._newTextureWhenChangeColor=!0,this.addChild(u,0,m));u.opacityModifyRGB=this._opacityModifyRGB;c._updateCharColorAndOpacity(u);y=cc.p(e+
v.xOffset+0.5*v.rect.width+w,k+(n.commonHeight-v.yOffset)-0.5*y.height*cc.contentScaleFactor());u.setPosition(cc.pointPixelsToPoints(y));e+=v.xAdvance+w;w=r;h<e&&(h=e)}f.width=v&&v.xAdvance<v.rect.width?h-v.xAdvance+v.rect.width:h;f.height=t;this.setContentSize(cc.sizePixelsToPoints(f))},updateString:function(a){var b=this._children;if(b)for(var c=0,d=b.length;c<d;c++){var e=b[c];e&&(e.visible=!1)}this._config&&this._string&&0<this._string.length&&this.createFontChars();a||this.updateLabel()},getString:function(){return this._initialString},
setString:function(a,b){a=String(a);void 0===b&&(b=!0);if(void 0===a||"string"!==typeof a)a+="";this._initialString=a;this._setString(a,b)},_setStringForSetter:function(a){this.setString(a,!1)},setCString:function(a){this.setString(a,!0)},_getCharsWidth:function(a,b){if(0>=b)return 0;var c=this.getChildByTag(a),d=this.getChildByTag(a+b);return this._getLetterPosXLeft(d)-this._getLetterPosXLeft(c)},_checkWarp:function(a,b,c,d){for(var e=a[b],f=0,h=0;h<b;h++)f+=a[h].length;var f=f+b-d,k=this._getCharsWidth(f,
a[b].length-1);if(k>c&&1<e.length){d=c/k*e.length|0;for(var h=e.substr(d),m=k-this._getCharsWidth(f+d,h.length-1),n,p=0,r=0;m>c&&100>r++;)d*=c/m,d|=0,h=e.substr(d),m=k-this._getCharsWidth(f+d,h.length-1);for(r=0;m<c&&100>r++;)h&&(p=(n=cc.LabelTTF._wordRex.exec(h))?n[0].length:1,n=h),this._lineBreakWithoutSpaces&&(p=0),d+=p,h=e.substr(d),m=k-this._getCharsWidth(f+d,h.length-1);d-=p;0===d&&(d=1,n=n.substr(1));c=e.substr(0,d);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(n||h)&&(p=(f=cc.LabelTTF._lastWordRex.exec(c))?
f[0].length:0,this._lineBreakWithoutSpaces&&(p=0),d-=p,n=e.substr(d),c=e.substr(0,d));cc.LabelTTF._firsrEnglish.test(n)&&(f=cc.LabelTTF._lastEnglish.exec(c))&&c!==f[0]&&(p=f[0].length,this._lineBreakWithoutSpaces&&(p=0),d-=p,n=e.substr(d),c=e.substr(0,d));a[b]=n||h;a.splice(b,0,c)}},updateLabel:function(){this.string=this._initialString;var a,b,c;if(0<this._width){var d=this.string.split("\n"),e="",f=0,h=0;for(a=0;a<d.length;a++)h=d.length,this._checkWarp(d,a,this._width*this._scaleX,f),h<d.length&&
f++,0<a&&(e+="\n"),e+=d[a];e+=String.fromCharCode(0);this._setString(e,!1)}if(this._alignment!==cc.TEXT_ALIGNMENT_LEFT)for(d=a=0,e=this._string.length,f=[],h=0;h<e;h++)if(10===this._string[h].charCodeAt(0)||0===this._string[h].charCodeAt(0)){b=0;var k=f.length;if(0===k)d++;else if(c=a+k-1+d,!(0>c)){var m=this.getChildByTag(c);if(null!=m){b=m.getPositionX()+m._getWidth()/2;m=0;switch(this._alignment){case cc.TEXT_ALIGNMENT_CENTER:m=this.width/2-b/2;break;case cc.TEXT_ALIGNMENT_RIGHT:m=this.width-b}if(0!==
m)for(b=0;b<k;b++)c=a+b+d,0>c||(c=this.getChildByTag(c))&&(c.x+=m);a+=k;d++;f.length=0}}}else f.push(this._string[a])},setAlignment:function(a){this._alignment=a;this.updateLabel()},_getAlignment:function(){return this._alignment},setBoundingWidth:function(a){this._width=a;this.updateLabel()},_getBoundingWidth:function(){return this._width},setLineBreakWithoutSpace:function(a){this._lineBreakWithoutSpaces=a;this.updateLabel()},setScale:function(a,b){cc.Node.prototype.setScale.call(this,a,b);this.updateLabel()},
setScaleX:function(a){cc.Node.prototype.setScaleX.call(this,a);this.updateLabel()},setScaleY:function(a){cc.Node.prototype.setScaleY.call(this,a);this.updateLabel()},setFntFile:function(a){if(null!=a&&a!==this._fntFile){var b=cc.loader.getRes(a);b?(this._fntFile=a,this._config=b,a=cc.textureCache.addImage(b.atlasName),(this._textureLoaded=b=a.isLoaded())?(this.setTexture(a),this._string&&0<this._string.length&&this.createFontChars()):a.addEventListener("load",function(a){this._textureLoaded=!0;this.setTexture(a);
this._string&&0<this._string.length&&this.createFontChars();this._changeTextureColor();this.updateLabel();this.dispatchEvent("load")},this)):cc.log("cc.LabelBMFont.setFntFile() : Impossible to create font. Please check file")}},getFntFile:function(){return this._fntFile},setTexture:function(a){this._texture=a;this._renderCmd.setTexture(a)},setAnchorPoint:function(a,b){cc.Node.prototype.setAnchorPoint.call(this,a,b);this.updateLabel()},_setAnchorX:function(a){cc.Node.prototype._setAnchorX.call(this,
a);this.updateLabel()},_setAnchorY:function(a){cc.Node.prototype._setAnchorY.call(this,a);this.updateLabel()},_atlasNameFromFntFile:function(a){},_kerningAmountForFirst:function(a,b){var c=0;if(this._configuration.kerningDictionary){var d=this._configuration.kerningDictionary[(a<<16|b&65535).toString()];d&&(c=d.amount)}return c},_getLetterPosXLeft:function(a){return a.getPositionX()*this._scaleX-a._getWidth()*this._scaleX*a._getAnchorX()},_getLetterPosXRight:function(a){return a.getPositionX()*this._scaleX+
a._getWidth()*this._scaleX*a._getAnchorX()},_isspace_unicode:function(a){a=a.charCodeAt(0);return 9<=a&&13>=a||32===a||133===a||160===a||5760===a||8192<=a&&8202>=a||8232===a||8233===a||8239===a||8287===a||12288===a},_utf8_trim_ws:function(a){var b=a.length;if(!(0>=b)&&(b-=1,this._isspace_unicode(a[b]))){for(var c=b-1;0<=c;--c)if(this._isspace_unicode(a[c]))b=c;else break;this._utf8_trim_from(a,b)}},_utf8_trim_from:function(a,b){var c=a.length;b>=c||0>b||a.splice(b,c)}});
(function(){var a=cc.LabelBMFont.prototype;cc.EventHelper.prototype.apply(a);cc.defineGetterSetter(a,"string",a.getString,a._setStringForSetter);cc.defineGetterSetter(a,"boundingWidth",a._getBoundingWidth,a.setBoundingWidth);cc.defineGetterSetter(a,"textAlign",a._getAlignment,a.setAlignment);cc.defineGetterSetter(a,"texture",a.getTexture,a.setTexture)})();cc.LabelBMFont.create=function(a,b,c,d,e){return new cc.LabelBMFont(a,b,c,d,e)};cc.FntFrameCache={};
var _fntLoader={FNT_HEAD:/fntframes [^\n]*(\n|$)/gi,FNT_FRAME_NAME:/fntframe [^\n]*(\n|$)/gi,INFO_EXP:/info [^\n]*(\n|$)/gi,COMMON_EXP:/common [^\n]*(\n|$)/gi,PAGE_EXP:/page [^\n]*(\n|$)/gi,CHAR_EXP:/char [^\n]*(\n|$)/gi,KERNING_EXP:/kerning [^\n]*(\n|$)/gi,ITEM_EXP:/\w+=[^ \r\n]+/gi,INT_EXP:/^[\-]?\d+$/,_parseStrToObj:function(a){a=a.match(this.ITEM_EXP);var b={};if(a)for(var c=0,d=a.length;c<d;c++){var e=a[c],f=e.indexOf("\x3d"),h=e.substring(0,f),e=e.substring(f+1);e.match(this.INT_EXP)?e=parseInt(e):
'"'===e[0]&&(e=e.substring(1,e.length-1));b[h]=e}return b},_parseFntContent:function(a,b,c,d){var e=this._parseStrToObj(b.match(this.COMMON_EXP)[0]);a.commonHeight=e.lineHeight;if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){var f=cc.configuration.getMaxTextureSize();(e.scaleW>f.width||e.scaleH>f.height)&&cc.log("cc.LabelBMFont._parseCommonArguments(): page can't be larger than supported")}1!==e.pages&&cc.log("cc.LabelBMFont._parseCommonArguments(): only supports 1 page");e=this._parseStrToObj(b.match(this.PAGE_EXP)[0]);
0!==e.id&&cc.log("cc.LabelBMFont._parseImageFileName() : file could not be found");a.atlasName=d?cc.path.join(cc.path.dirname(d.path)+e.file):cc.path.changeBasename(c,e.file);e=b.match(this.CHAR_EXP);f=a.fontDefDictionary={};c=0;for(d=e.length;c<d;c++){var h=this._parseStrToObj(e[c]);f[h.id]={rect:{x:h.x,y:h.y,width:h.width,height:h.height},xOffset:h.xoffset,yOffset:h.yoffset,xAdvance:h.xadvance}}e=a.kerningDict={};if(b=b.match(this.KERNING_EXP))for(c=0,d=b.length;c<d;c++)f=this._parseStrToObj(b[c]),
e[f.first<<16|f.second&65535]=f.amount;return a},parseFnt:function(a,b){var c={},d=a.match(this.FNT_HEAD);if(d){var e=this._parseStrToObj(d[0]);if(e&&e.count){a=a.substr(d[0].length);for(var d=a.split("----"),f=0;f<e.count;++f){var h=d[f],k=h.match(this.FNT_FRAME_NAME);if(k){var m=this._parseStrToObj(k[0]);if(m&&m.name){var c={},n=cc.path.join(cc.path.dirname(b),m.name);cc.FntFrameCache[n]=this._parseFntContent(c,h.substr(k[0].length),b,{path:m.name})}}}}}else c=this._parseFntContent(c,a,b);return c},
load:function(a,b,c,d){var e=this;cc.loader.loadTxt(a,function(a,c){if(a)return d(a);d(null,e.parseFnt(c,b))})}};cc.loader.register(["fnt"],_fntLoader);(function(){cc.LabelBMFont.CanvasRenderCmd=function(a){this._rootCtor(a)};var a=cc.LabelBMFont.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.LabelBMFont.CanvasRenderCmd;a._updateCharTexture=function(a,c,d){32===d?a.setTextureRect(c,!1,cc.size(0,0)):(a.setTextureRect(c,!1),a.visible=!0)};a._updateCharColorAndOpacity=function(a){a._displayedColor=this._displayedColor;a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty);a._displayedOpacity=this._displayedOpacity;
a._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)};a.setTexture=function(a){for(var c=this._node,d=c._children,e=this._displayedColor,f=0;f<d.length;f++){var h=d[f],k=h._renderCmd,m=k._displayedColor;if(c._texture===k._texture||m.r===e.r&&m.g===e.g&&m.b===e.b)h.texture=a}c._texture=a};a._changeTextureColor=function(){var a=this._node,c=a._texture,d=c.getContentSize(),e=a._texture,f=e.getHtmlElementObj(),h=this._displayedColor,k=cc.rect(0,0,f.width,f.height);c&&0<d.width&&f&&(c=e._generateColorTexture(h.r,
h.g,h.b,k),a.setTexture(c))};a._updateChildrenDisplayedOpacity=function(a){cc.Node.prototype.updateDisplayedOpacity.call(a,this._displayedOpacity)};a._updateChildrenDisplayedColor=function(a){cc.Node.prototype.updateDisplayedColor.call(a,this._displayedColor)}})();(function(){cc.LabelBMFont.WebGLRenderCmd=function(a){this._rootCtor(a)};var a=cc.LabelBMFont.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.LabelBMFont.WebGLRenderCmd;a.setTexture=function(a){this._node.setOpacityModifyRGB(this._node._texture.hasPremultipliedAlpha())};a._updateCharTexture=function(a,c,d,e){a.setTextureRect(c,e);a.visible=!0};a._changeTextureColor=function(){};a._updateCharColorAndOpacity=function(){}})();cc.LabelAtlas=cc.LabelBMFont.extend({_className:"LabelAtlas",ctor:function(a,b,c,d,e){cc.SpriteBatchNode.prototype.ctor.call(this);this._imageOffset=cc.p(0,0);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;b&&cc.LabelAtlas.prototype.initWithString.call(this,a,b,c,d,e)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.LabelBMFont.WebGLRenderCmd(this):new cc.LabelBMFont.CanvasRenderCmd(this)},_createFntConfig:function(a,b,c,d){var e={};e.commonHeight=c;
var f=e.fontDefDictionary={},h=a.pixelsWidth;a=a.pixelsHeight;d=d.charCodeAt(0);for(var k=0,m=c;m<=a;m+=c)for(var n=0;n<h;n+=b)f[d+k]={rect:{x:n,y:m-c,width:b,height:c},xOffset:0,yOffset:0,xAdvance:b},++k;e.kerningDict={};return e},initWithString:function(a,b,c,d,e){var f;this._string=this._initialString=a=a+""||"";if(void 0===c){e=cc.loader.getRes(b);if(1!==parseInt(e.version,10))return cc.log("cc.LabelAtlas.initWithString(): Unsupported version. Upgrade cocos2d version"),!1;f=cc.path.changeBasename(b,
e.textureFilename);d=cc.contentScaleFactor();c=parseInt(e.itemWidth,10)/d;d=parseInt(e.itemHeight,10)/d;e=String.fromCharCode(parseInt(e.firstChar,10))}else f=b,c=c||0,d=d||0,e=e||" ";if(b){this._fntFile="dummy_fnt_file:"+f;b=f;var h=cc.spriteFrameCache.getSpriteFrame(b)||cc.spriteFrameCache.getSpriteFrame(cc.path.basename(b));h?(b=h.getTexture(),this._spriteFrame=h):b=cc.textureCache.addImage(f);c=this._createFntConfig(b,c,d,e);c.atlasName=f;this._config=c;(this._textureLoaded=f=b.isLoaded())||b.addEventListener("load",
function(a){this._textureLoaded=!0;this.initWithTexture(a,this._initialString.length);this.setString(this._initialString,!0);this.dispatchEvent("load")},this)}else b=new cc.Texture2D,f=new Image,b.initWithElement(f),this._textureLoaded=!1;return this.initWithTexture(b,a.length)?(this._alignment=cc.TEXT_ALIGNMENT_LEFT,this._imageOffset=cc.p(0,0),this._width=-1,this._realOpacity=255,this._realColor=cc.color(255,255,255,255),this._contentSize.width=0,this._contentSize.height=0,this.setString(a,!0),!0):
!1},setFntFile:function(){cc.warn("setFntFile doesn't support with LabelAtlas.")}});cc.LabelAtlas.create=function(a,b,c,d,e){return new cc.LabelAtlas(a,b,c,d,e)};(function(){cc.LabelAtlas.CanvasRenderCmd=function(a){cc.AtlasNode.CanvasRenderCmd.call(this,a);this._needDraw=!1};var a=cc.LabelAtlas.CanvasRenderCmd.prototype=Object.create(cc.AtlasNode.CanvasRenderCmd.prototype);a.constructor=cc.LabelAtlas.CanvasRenderCmd;a.setCascade=function(){var a=this._node;a._cascadeOpacityEnabled=!0;a._cascadeColorEnabled=!1};a.updateAtlasValues=function(){for(var a=this._node,c=a._string||"",d=c.length,e=this._textureToRender,f=a._itemWidth,h=a._itemHeight,k=0,m=-1;k<d;k++){var n=
c.charCodeAt(k)-a._mapStartChar.charCodeAt(0),p=parseInt(n%a._itemsPerRow,10),n=parseInt(n/a._itemsPerRow,10);if(!(0>p||0>n||(p=cc.rect(p*f,n*h,f,h),n=e._contentSize,0>p.x||0>p.y||p.x+p.width>n.width||p.y+p.height>n.height))){m++;var n=c.charCodeAt(k),r=a.getChildByTag(k);r?32===n?(r.init(),r.setTextureRect(cc.rect(0,0,10,10),!1,cc.size(0,0))):(r.initWithTexture(e,p),r.visible=!0):(r=new cc.Sprite,32===n?(r.init(),r.setTextureRect(cc.rect(0,0,10,10),!1,cc.size(0,0))):r.initWithTexture(e,p),cc.Node.prototype.addChild.call(a,
r,0,k));r.setPosition(m*f+f/2,h/2)}}this.updateContentSize(k,m+1)};a.updateContentSize=function(a,c){var d=this._node,e=d._contentSize;a!==c&&a*d._itemWidth===e.width&&d._itemHeight===e.height&&d.setContentSize(c*d._itemWidth,d._itemHeight)};a.setString=function(a){a=this._node;if(a._children){a=a._children;for(var c=a.length,d=0;d<c;d++){var e=a[d];e&&!e._lateChild&&(e.visible=!1)}}};a._addChild=function(){child._lateChild=!0}})();(function(){cc.LabelAtlas.WebGLRenderCmd=function(a){cc.AtlasNode.WebGLRenderCmd.call(this,a);this._needDraw=!0};var a=cc.LabelAtlas.WebGLRenderCmd.prototype=Object.create(cc.AtlasNode.WebGLRenderCmd.prototype);a.constructor=cc.LabelAtlas.WebGLRenderCmd;a._updateColor=function(){if(this._colorF32Array){var a=this._displayedColor,c=this._displayedOpacity/255;this._node._opacityModifyRGB?(this._colorF32Array[0]=a.r*c/255,this._colorF32Array[1]=a.g*c/255,this._colorF32Array[2]=a.b*c/255):(this._colorF32Array[0]=
a.r/255,this._colorF32Array[1]=a.g/255,this._colorF32Array[2]=a.b/255);this._colorF32Array[3]=c}};a.setCascade=function(){var a=this._node;a._cascadeOpacityEnabled=!0;a._cascadeColorEnabled=!0};a.rendering=function(a){cc.AtlasNode.WebGLRenderCmd.prototype.rendering.call(this,a);if(cc.LABELATLAS_DEBUG_DRAW){var c=this._node;a=c.getContentSize();var c=c.getBoundingBoxToWorld(),d=c.x,e=c.y;a.width=c.width;a.height=c.height;a=[cc.p(d,e),cc.p(d+a.width,e),cc.p(a.width+d,a.height+e),cc.p(d,e+a.height)];
cc._drawingUtil.drawPoly(a,4,!0)}};a.updateAtlasValues=function(){var a=this._node,c=a._string,d=c.length,e=this._textureAtlas,f=e.texture,h=f.pixelsWidth,f=f.pixelsHeight,k=a._itemWidth,m=a._itemHeight;a._ignoreContentScaleFactor||(k=a._itemWidth*cc.contentScaleFactor(),m=a._itemHeight*cc.contentScaleFactor());d>e.getCapacity()&&cc.log("cc.LabelAtlas._updateAtlasValues(): Invalid String length");for(var n=e.quads,p=a._itemWidth,r=a._itemHeight,s=0,t=-1;s<d;s++){var w=c.charCodeAt(s)-a._mapStartChar.charCodeAt(0),
v=w%a._itemsPerRow,y=0|w/a._itemsPerRow;if(!(0>v||0>y||v*p+p>h||y*r+r>f)){t++;var x;cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(v=(2*v*k+1)/(2*h),w=v+(2*k-2)/(2*h),y=(2*y*m+1)/(2*f),x=y+(2*m-2)/(2*f)):(v=v*k/h,w=v+k/h,y=y*m/f,x=y+m/f);var u=n[s],z=u.tl,A=u.tr,B=u.bl,u=u.br;z.texCoords.u=v;z.texCoords.v=y;A.texCoords.u=w;A.texCoords.v=y;B.texCoords.u=v;B.texCoords.v=x;u.texCoords.u=w;u.texCoords.v=x;B.vertices.x=t*p;B.vertices.y=0;B.vertices.z=0;u.vertices.x=t*p+p;u.vertices.y=0;u.vertices.z=0;z.vertices.x=
t*p;z.vertices.y=a._itemHeight;z.vertices.z=0;A.vertices.x=t*p+p;A.vertices.y=a._itemHeight;A.vertices.z=0}}this._updateColor();this.updateContentSize(s,t+1);0<d&&(e.dirty=!0,a=e.totalQuads,d>a&&e.increaseTotalQuadsWith(d-a))};a.updateContentSize=function(a,c){var d=this._node,e=d._contentSize;a!==c&&a*d._itemWidth===e.width&&d._itemHeight===e.height&&d.setContentSize(c*d._itemWidth,d._itemHeight)};a.setString=function(a){a=a.length;a>this._textureAtlas.totalQuads&&this._textureAtlas.resizeCapacity(a)};
a._addChild=function(){}})();cc.MotionStreak=cc.Node.extend({texture:null,fastMode:!1,startingPositionInitialized:!1,_blendFunc:null,_stroke:0,_fadeDelta:0,_minSeg:0,_maxPoints:0,_nuPoints:0,_previousNuPoints:0,_pointVertexes:null,_pointState:null,_vertices:null,_colorPointer:null,_texCoords:null,_verticesBuffer:null,_colorPointerBuffer:null,_texCoordsBuffer:null,_className:"MotionStreak",ctor:function(a,b,c,d,e){cc.Node.prototype.ctor.call(this);this._positionR=cc.p(0,0);this._blendFunc=new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA);
this.startingPositionInitialized=this.fastMode=!1;this.texture=null;this._previousNuPoints=this._nuPoints=this._maxPoints=this._minSeg=this._fadeDelta=this._stroke=0;this._texCoordsBuffer=this._colorPointerBuffer=this._verticesBuffer=this._texCoords=this._colorPointer=this._vertices=this._pointState=this._pointVertexes=null;void 0!==e&&this.initWithFade(a,b,c,d,e)},getTexture:function(){return this.texture},setTexture:function(a){this.texture!==a&&(this.texture=a)},getBlendFunc:function(){return this._blendFunc},
setBlendFunc:function(a,b){void 0===b?this._blendFunc=a:(this._blendFunc.src=a,this._blendFunc.dst=b)},getOpacity:function(){cc.log("cc.MotionStreak.getOpacity has not been supported.");return 0},setOpacity:function(a){cc.log("cc.MotionStreak.setOpacity has not been supported.")},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isFastMode:function(){return this.fastMode},setFastMode:function(a){this.fastMode=a},isStartingPositionInitialized:function(){return this.startingPositionInitialized},
setStartingPositionInitialized:function(a){this.startingPositionInitialized=a},getStroke:function(){return this._stroke},setStroke:function(a){this._stroke=a},initWithFade:function(a,b,c,d,e){if(!e)throw Error("cc.MotionStreak.initWithFade(): Invalid filename or texture");cc.isString(e)&&(e=cc.textureCache.addImage(e));cc.Node.prototype.setPosition.call(this,cc.p(0,0));this.anchorY=this.anchorX=0;this.ignoreAnchor=!0;this.startingPositionInitialized=!1;this.fastMode=!0;this._minSeg=-1===b?c/5:b;this._minSeg*=
this._minSeg;this._stroke=c;this._fadeDelta=1/a;this._maxPoints=a=(0|60*a)+2;this._nuPoints=0;this._pointState=new Float32Array(a);this._pointVertexes=new Float32Array(2*a);this._vertices=new Float32Array(4*a);this._texCoords=new Float32Array(4*a);this._colorPointer=new Uint8Array(8*a);this._verticesBuffer=gl.createBuffer();this._texCoordsBuffer=gl.createBuffer();this._colorPointerBuffer=gl.createBuffer();this._blendFunc.src=gl.SRC_ALPHA;this._blendFunc.dst=gl.ONE_MINUS_SRC_ALPHA;this.texture=e;this.color=
d;this.scheduleUpdate();gl.bindBuffer(gl.ARRAY_BUFFER,this._verticesBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._vertices,gl.DYNAMIC_DRAW);gl.bindBuffer(gl.ARRAY_BUFFER,this._texCoordsBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._texCoords,gl.DYNAMIC_DRAW);gl.bindBuffer(gl.ARRAY_BUFFER,this._colorPointerBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._colorPointer,gl.DYNAMIC_DRAW);return!0},tintWithColor:function(a){this.color=a;for(var b=this._colorPointer,c=0,d=2*this._nuPoints;c<d;c++)b[4*c]=a.r,b[4*c+
1]=a.g,b[4*c+2]=a.b},reset:function(){this._nuPoints=0},setPosition:function(a,b){this.startingPositionInitialized=!0;void 0===b?(this._positionR.x=a.x,this._positionR.y=a.y):(this._positionR.x=a,this._positionR.y=b)},getPositionX:function(){return this._positionR.x},setPositionX:function(a){this._positionR.x=a;this.startingPositionInitialized||(this.startingPositionInitialized=!0)},getPositionY:function(){return this._positionR.y},setPositionY:function(a){this._positionR.y=a;this.startingPositionInitialized||
(this.startingPositionInitialized=!0)},update:function(a){if(this.startingPositionInitialized){this._renderCmd._updateDisplayColor();a*=this._fadeDelta;var b,c,d,e,f=0,h=this._nuPoints,k=this._pointState,m=this._pointVertexes,n=this._vertices,p=this._colorPointer;for(b=0;b<h;b++)k[b]-=a,0>=k[b]?f++:(c=b-f,0<f?(k[c]=k[b],m[2*c]=m[2*b],m[2*c+1]=m[2*b+1],e=2*b,d=2*c,n[2*d]=n[2*e],n[2*d+1]=n[2*e+1],n[2*(d+1)]=n[2*(e+1)],n[2*(d+1)+1]=n[2*(e+1)+1],e*=4,d*=4,p[d+0]=p[e+0],p[d+1]=p[e+1],p[d+2]=p[e+2],p[d+
4]=p[e+4],p[d+5]=p[e+5],p[d+6]=p[e+6]):d=8*c,c=255*k[c],p[d+3]=c,p[d+7]=c);h-=f;b=!0;h>=this._maxPoints?b=!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)&&(b=!1);b&&(m[2*h]=this._positionR.x,m[2*h+1]=this._positionR.y,k[h]=1,k=8*h,b=this.getDisplayedColor(),p[k]=b.r,p[k+1]=b.g,p[k+2]=b.b,p[k+4]=b.r,p[k+5]=b.g,p[k+6]=b.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(b=0;b<h;b++)p[4*b]=0,p[4*b+1]=m*b,p[2*(2*b+1)]=1,p[2*(2*b+1)+1]=m*b;this._previousNuPoints=h}this._nuPoints=h}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.MotionStreak.WebGLRenderCmd(this):null}});
cc.MotionStreak.create=function(a,b,c,d,e){return new cc.MotionStreak(a,b,c,d,e)};cc.MotionStreak.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity();this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)};cc.MotionStreak.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.MotionStreak.WebGLRenderCmd.prototype.constructor=cc.Sprite.WebGLRenderCmd;
cc.MotionStreak.WebGLRenderCmd.prototype.rendering=function(a){var b=this._node;if(!(1>=b._nuPoints)&&b.texture&&b.texture.isLoaded()){a=a||cc._renderContext;var c=this._worldTransform;this._matrix.mat[0]=c.a;this._matrix.mat[4]=c.c;this._matrix.mat[12]=c.tx;this._matrix.mat[1]=c.b;this._matrix.mat[5]=c.d;this._matrix.mat[13]=c.ty;this._glProgramState.apply(this._matrix);cc.glBlendFunc(b._blendFunc.src,b._blendFunc.dst);cc.glBindTexture2D(b.texture);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);
a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);a.bindBuffer(a.ARRAY_BUFFER,b._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,b._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,b._texCoordsBuffer);a.bufferData(a.ARRAY_BUFFER,b._texCoords,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,b._colorPointerBuffer);a.bufferData(a.ARRAY_BUFFER,
b._colorPointer,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,0,0);a.drawArrays(a.TRIANGLE_STRIP,0,2*b._nuPoints);cc.g_NumberOfDraws++}};cc.NodeGrid=cc.Node.extend({grid:null,_target:null,_gridRect:null,ctor:function(a){cc.Node.prototype.ctor.call(this);void 0===a&&(a=cc.rect());this._gridRect=a},getGrid:function(){return this.grid},setGrid:function(a){this.grid=a},setGridRect:function(a){this._gridRect=a},getGridRect:function(){return this._gridRect},setTarget:function(a){this._target=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.NodeGrid.WebGLRenderCmd(this):new cc.Node.CanvasRenderCmd(this)}});
_p=cc.NodeGrid.prototype;cc.defineGetterSetter(_p,"target",null,_p.setTarget);cc.NodeGrid.create=function(){return new cc.NodeGrid};(function(){cc.NodeGrid.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._gridBeginCommand=new cc.CustomRenderCmd(this,this.onGridBeginDraw);this._gridEndCommand=new cc.CustomRenderCmd(this,this.onGridEndDraw)};var a=cc.NodeGrid.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.NodeGrid.WebGLRenderCmd;a.visit=function(a){var c=this._node;if(c._visible){if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;var d=cc.current_stack;d.stack.push(d.top);
this._syncStatus(a);d.top=this._stackMatrix;cc.renderer.pushRenderCommand(this._gridBeginCommand);c._target&&c._target.visit();if((a=c._children)&&0<a.length){var e=a.length;c.sortAllChildren();for(c=0;c<e;c++){var f=a[c];f&&f.visit()}}cc.renderer.pushRenderCommand(this._gridEndCommand);this._dirtyFlag=0;d.top=d.stack.pop()}};a.onGridBeginDraw=function(){var a=this._node.grid;a&&a._active&&a.beforeDraw()};a.onGridEndDraw=function(){var a=this._node.grid;a&&a._active&&a.afterDraw(this._node)}})();cc.DrawNode=cc.Node.extend({_buffer:null,_blendFunc:null,_lineWidth:1,_drawColor:null,getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src,this._blendFunc.dst=a.dst):(this._blendFunc.src=a,this._blendFunc.dst=b)},setLineWidth:function(a){this._lineWidth=a},getLineWidth:function(){return this._lineWidth},setDrawColor:function(a){var b=this._drawColor;b.r=a.r;b.g=a.g;b.b=a.b;b.a=null==a.a?255:a.a},getDrawColor:function(){return cc.color(this._drawColor.r,
this._drawColor.g,this._drawColor.b,this._drawColor.a)}});cc.DrawNode.create=function(){return new cc.DrawNode};cc.DrawNode.TYPE_DOT=0;cc.DrawNode.TYPE_SEGMENT=1;cc.DrawNode.TYPE_POLY=2;
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS)cc._DrawNodeElement=function(a,b,c,d,e,f,h,k,m){this.type=a;this.verts=b||null;this.fillColor=c||null;this.lineWidth=d||0;this.lineColor=e||null;this.lineCap=f||"butt";this.isClosePolygon=h||!1;this.isFill=k||!1;this.isStroke=m||!1},cc.extend(cc.DrawNode.prototype,{_className:"DrawNodeCanvas",ctor:function(){cc.Node.prototype.ctor.call(this);var a=this._renderCmd;a._buffer=this._buffer=
[];a._drawColor=this._drawColor=cc.color(255,255,255,255);a._blendFunc=this._blendFunc=new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA);this.init();this._localBB=new cc.Rect},setLocalBB:function(a,b,c,d){var e=this._localBB;void 0===b?(e.x=a.x,e.y=a.y,e.width=a.width,e.height=a.height):(e.x=a,e.y=b,e.width=c,e.height=d)},drawRect:function(a,b,c,d,e){d=null==d?this._lineWidth:d;e=e||this.getDrawColor();null==e.a&&(e.a=255);a=[a,cc.p(b.x,a.y),b,cc.p(a.x,b.y)];b=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);
b.verts=a;b.lineWidth=d;b.lineColor=e;b.isClosePolygon=!0;b.isStroke=!0;b.lineCap="butt";if(b.fillColor=c)null==c.a&&(c.a=255),b.isFill=!0;this._buffer.push(b)},drawCircle:function(a,b,c,d,e,f,h){f=f||this._lineWidth;h=h||this.getDrawColor();null==h.a&&(h.a=255);for(var k=2*Math.PI/d,m=[],n=0;n<=d;n++){var A=n*k,B=b*Math.cos(A+c)+a.x,A=b*Math.sin(A+c)+a.y;m.push(cc.p(B,A))}e&&m.push(cc.p(a.x,a.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=m;a.lineWidth=f;a.lineColor=h;a.isClosePolygon=
!0;a.isStroke=!0;this._buffer.push(a)},drawQuadBezier:function(a,b,c,d,e,f){e=e||this._lineWidth;f=f||this.getDrawColor();null==f.a&&(f.a=255);for(var h=[],k=0,m=0;m<d;m++){var n=Math.pow(1-k,2)*a.x+2*(1-k)*k*b.x+k*k*c.x,A=Math.pow(1-k,2)*a.y+2*(1-k)*k*b.y+k*k*c.y;h.push(cc.p(n,A));k+=1/d}h.push(cc.p(c.x,c.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=h;a.lineWidth=e;a.lineColor=f;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawCubicBezier:function(a,b,c,d,e,f,h){f=f||this._lineWidth;
h=h||this.getDrawColor();null==h.a&&(h.a=255);for(var k=[],m=0,n=0;n<e;n++){var A=Math.pow(1-m,3)*a.x+3*Math.pow(1-m,2)*m*b.x+3*(1-m)*m*m*c.x+m*m*m*d.x,B=Math.pow(1-m,3)*a.y+3*Math.pow(1-m,2)*m*b.y+3*(1-m)*m*m*c.y+m*m*m*d.y;k.push(cc.p(A,B));m+=1/e}k.push(cc.p(d.x,d.y));a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=k;a.lineWidth=f;a.lineColor=h;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawCatmullRom:function(a,b,c,d){this.drawCardinalSpline(a,0.5,b,c,d)},drawCardinalSpline:function(a,
b,c,d,e){d=d||this._lineWidth;e=e||this.getDrawColor();null==e.a&&(e.a=255);for(var f=[],h,k,m=1/a.length,n=0;n<c+1;n++)k=n/c,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),b,k),f.push(h);a=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);a.verts=f;a.lineWidth=d;a.lineColor=e;a.isStroke=!0;a.lineCap="round";this._buffer.push(a)},drawDot:function(a,b,c){c=c||this.getDrawColor();
null==c.a&&(c.a=255);var d=new cc._DrawNodeElement(cc.DrawNode.TYPE_DOT);d.verts=[a];d.lineWidth=b;d.fillColor=c;this._buffer.push(d)},drawDots:function(a,b,c){if(a&&0!=a.length){c=c||this.getDrawColor();null==c.a&&(c.a=255);for(var d=0,e=a.length;d<e;d++)this.drawDot(a[d],b,c)}},drawSegment:function(a,b,c,d){c=c||this._lineWidth;d=d||this.getDrawColor();null==d.a&&(d.a=255);var e=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);e.verts=[a,b];e.lineWidth=2*c;e.lineColor=d;e.isStroke=!0;e.lineCap="round";
this._buffer.push(e)},drawPoly_:function(a,b,c,d){c=null==c?this._lineWidth:c;d=d||this.getDrawColor();null==d.a&&(d.a=255);var e=new cc._DrawNodeElement(cc.DrawNode.TYPE_POLY);e.verts=a;e.fillColor=b;e.lineWidth=c;e.lineColor=d;e.isClosePolygon=!0;e.isStroke=!0;e.lineCap="round";b&&(e.isFill=!0);this._buffer.push(e)},drawPoly:function(a,b,c,d){for(var e=[],f=0;f<a.length;f++)e.push(cc.p(a[f].x,a[f].y));return this.drawPoly_(e,b,c,d)},clear:function(){this._buffer.length=0},_createRenderCmd:function(){return new cc.DrawNode.CanvasRenderCmd(this)}});
else if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){var a=null,b=[],c=cc.p(),d=cc.p(),e=new Uint32Array(1),f=cc.p(),h=cc.p(),k=cc.p(),m=cc.p(),n=[];cc.extend(cc.DrawNode.prototype,{_bufferCapacity:0,_vertexCount:0,_offset:0,_occupiedSize:0,_f32Buffer:null,_ui32Buffer:null,_dirty:!1,_className:"DrawNodeWebGL",manualRelease:!1,ctor:function(b,c){cc.Node.prototype.ctor.call(this);a||(a=new GlobalVertexBuffer(cc._renderContext,20*cc.DRAWNODE_TOTAL_VERTICES));this._renderCmd._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_LENGTHTEXTURECOLOR);
this._blendFunc=new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA);this._drawColor=cc.color(255,255,255,255);this._bufferCapacity=b||64;this.manualRelease=c;this._dirty=!0},onEnter:function(){cc.Node.prototype.onEnter.call(this);this._occupiedSize<this._bufferCapacity&&this._ensureCapacity(this._bufferCapacity)},onExit:function(){this.manualRelease||this.release();cc.Node.prototype.onExit.call(this)},release:function(){0<this._occupiedSize&&(this._vertexCount=0,a.freeBuffer(this._offset,20*this._occupiedSize),
this._occupiedSize=0)},_ensureCapacity:function(b){var c=this._occupiedSize,d=this._offset;if(b>c||this._bufferCapacity>c){var e=Math.max(Math.min(c+c,200),b,this._bufferCapacity);0!==c&&(a.freeBuffer(d,20*c),this._occupiedSize=0);b=this._offset=a.requestBuffer(20*e);if(0<=b){this._occupiedSize=this._bufferCapacity=e;this._f32Buffer=new Float32Array(a.data,b,5*this._occupiedSize);this._ui32Buffer=new Uint32Array(a.data,b,5*this._occupiedSize);if(0!==c&&d!==b)for(c=d/4+5*c,b/=4,d/=4;d<c;b++,d++)a.dataArray[b]=
a.dataArray[d];return!0}cc.warn("Failed to allocate buffer for DrawNode: buffer for "+e+" vertices requested");return!1}return!0},drawRect:function(a,c,d,e,f){e=null==e?this._lineWidth:e;f=f||this._drawColor;b.length=0;b.push(a.x,a.y,c.x,a.y,c.x,c.y,a.x,c.y);null==d?this._drawSegments(b,e,f,!0):this.drawPoly(b,d,e,f);b.length=0},drawCircle:function(a,e,f,h,k,m,n){m=m||this._lineWidth;n=n||this._drawColor;var x=2*Math.PI/h,u;for(u=b.length=0;u<=h;u++){var z=u*x,A=e*Math.cos(z+f)+a.x,z=e*Math.sin(z+
f)+a.y;b.push(A,z)}k&&b.push(a.x,a.y);m*=0.5;u=0;for(a=b.length-2;u<a;u+=2)c.x=b[u],c.y=b[u+1],d.x=b[u+2],d.y=b[u+3],this.drawSegment(c,d,m,n);b.length=0},drawQuadBezier:function(a,c,d,e,f,h){f=f||this._lineWidth;h=h||this._drawColor;for(var k=0,m=b.length=0;m<e;m++){var n=Math.pow(1-k,2)*a.x+2*(1-k)*k*c.x+k*k*d.x,z=Math.pow(1-k,2)*a.y+2*(1-k)*k*c.y+k*k*d.y;b.push(n,z);k+=1/e}b.push(d.x,d.y);this._drawSegments(b,f,h,!1);b.length=0},drawCubicBezier:function(a,c,d,e,f,h,k){h=h||this._lineWidth;k=k||
this._drawColor;for(var m=0,n=b.length=0;n<f;n++){var z=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,A=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;b.push(z,A);m+=1/f}b.push(e.x,e.y);this._drawSegments(b,h,k,!1);b.length=0},drawCatmullRom:function(a,b,c,d){this.drawCardinalSpline(a,0.5,b,c,d)},drawCardinalSpline:function(a,e,f,h,k){h=h||this._lineWidth;k=k||this._drawColor;for(var m,n,x=1/a.length,u=b.length=0;u<f+1;u++)n=u/f,1===n?(m=a.length-1,n=
1):(m=0|n/x,n=(n-x*m)/x),cc.cardinalSplineAt(cc.getControlPointAt(a,m-1),cc.getControlPointAt(a,m-0),cc.getControlPointAt(a,m+1),cc.getControlPointAt(a,m+2),e,n,c),b.push(c.x,c.y);h*=0.5;a=0;for(e=b.length-2;a<e;a+=2)c.x=b[a],c.y=b[a+1],d.x=b[a+2],d.y=b[a+3],this.drawSegment(c,d,h,k);b.length=0},drawDots:function(a,b,c){if(a&&0!==a.length){c=c||this._drawColor;for(var d=0,e=a.length;d<e;d++)this.drawDot(a[d],b,c)}},_render:function(){var b=cc._renderContext;0>this._offset||0>=this._vertexCount||(this._dirty?
(a.updateSubData(this._offset,this._f32Buffer),this._dirty=!1):b.bindBuffer(b.ARRAY_BUFFER,a.vertexBuffer),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR),b.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS),b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,b.FLOAT,!1,20,0),b.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,b.UNSIGNED_BYTE,!0,20,8),b.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,b.FLOAT,!1,20,12),b.drawArrays(b.TRIANGLES,this._offset/
20,this._vertexCount),cc.incrementGLDraws(1))},appendVertexData:function(a,b,c,d,f){var h=this._f32Buffer,k=5*this._vertexCount;h[k]=a;h[k+1]=b;e[0]=c.a<<24|c.b<<16|c.g<<8|c.r;this._ui32Buffer[k+2]=e[0];h[k+3]=d;h[k+4]=f;this._vertexCount++},drawDot:function(a,b,c){c=c||this._drawColor;null==c.a&&(c.a=255);var d=a.x-b,e=a.y-b,f=a.x+b;a=a.y+b;this._ensureCapacity(this._vertexCount+6)&&(this.appendVertexData(d,e,c,-1,-1),this.appendVertexData(d,a,c,-1,1),this.appendVertexData(f,a,c,1,1),this.appendVertexData(d,
e,c,-1,-1),this.appendVertexData(f,a,c,1,1),this.appendVertexData(f,e,c,1,-1),this._dirty=!0)},drawSegment:function(a,b,c,d){d=d||this.getDrawColor();null==d.a&&(d.a=255);c=c||0.5*this._lineWidth;if(this._ensureCapacity(this._vertexCount+18)){f.x=a.y-b.y;f.y=b.x-a.x;cc.pNormalizeIn(f);h.x=-f.y;h.y=f.x;var e=c;k.x=f.x*e;k.y=f.y*e;m.x=h.x*c;m.y=h.y*c;c=b.x+k.x-m.x;var e=b.y+k.y-m.y,n=f.x-h.x,y=f.y-h.y,x=b.x-k.x,u=b.y-k.y,z=-f.x,A=-f.y,B=b.x+k.x,D=b.y+k.y,C=f.x,E=f.y,J=a.x-k.x,G=a.y-k.y,H=a.x+k.x,L=
a.y+k.y,I=f.x,M=f.y,F=a.x-k.x+m.x,N=a.y-k.y+m.y,O=h.x-f.x,P=h.y-f.y,Q=a.x+k.x+m.x;a=a.y+k.y+m.y;var S=f.x+h.x,R=f.y+h.y;this.appendVertexData(b.x-k.x-m.x,b.y-k.y-m.y,d,-(f.x+h.x),-(f.y+h.y));this.appendVertexData(c,e,d,n,y);this.appendVertexData(x,u,d,z,A);this.appendVertexData(B,D,d,C,E);this.appendVertexData(c,e,d,n,y);this.appendVertexData(x,u,d,z,A);this.appendVertexData(B,D,d,C,E);this.appendVertexData(J,G,d,z,A);this.appendVertexData(x,u,d,z,A);this.appendVertexData(B,D,d,C,E);this.appendVertexData(J,
G,d,z,A);this.appendVertexData(H,L,d,I,M);this.appendVertexData(F,N,d,O,P);this.appendVertexData(J,G,d,z,A);this.appendVertexData(H,L,d,I,M);this.appendVertexData(F,N,d,O,P);this.appendVertexData(Q,a,d,S,R);this.appendVertexData(H,L,d,I,M);this._dirty=!0}},drawPoly:function(a,c,d,e){if("object"===typeof a[0]){for(var h=b.length=0;h<a.length;h++)b.push(a[h].x,a[h].y);a=b}if(null==c)this._drawSegments(a,d,e,!0);else{null==c.a&&(c.a=255);null==e.a&&(e.a=255);d=null==d?this._lineWidth:d;d*=0.5;for(var m,
y,x,u,z,A,B,D=a.length,h=n.length=0;h<D;h+=2)m=a[(h-2+D)%D],y=a[(h-1+D)%D],x=a[h],u=a[h+1],z=a[(h+2)%D],A=a[(h+3)%D],f.x=y-u,f.y=x-m,k.x=u-A,k.y=z-x,cc.pNormalizeIn(f),cc.pNormalizeIn(k),u=f.x*k.x+f.y*k.y+1,B=(f.x+k.x)/u,u=(f.y+k.y)/u,n.push(B,u,k.x,k.y);D/=2;B=0<d;if(this._ensureCapacity(this._vertexCount+3*(3*D-2))){for(var C=!1==B?0.5:0,h=0;h<D-2;h++)m=a[0]-n[0]*C,y=a[1]-n[1]*C,x=a[2*h+2]-n[4*(h+1)]*C,u=a[2*h+3]-n[4*(h+1)+1]*C,z=a[2*h+4]-n[4*(h+2)]*C,A=a[2*h+5]-n[4*(h+2)+1]*C,this.appendVertexData(m,
y,c,0,0),this.appendVertexData(x,u,c,0,0),this.appendVertexData(z,A,c,0,0);var E,J,G,H;d=B?d:0.5;c=B?e:c;for(h=0;h<D;h++)e=(h+1)%D,m=a[2*h],y=a[2*h+1],x=a[2*e],u=a[2*e+1],f.x=n[4*h+2],f.y=n[4*h+3],k.x=B?-f.x:0,k.y=B?-f.y:0,E=n[4*h],J=n[4*h+1],G=n[4*e],H=n[4*e+1],e=m-E*d,z=y-J*d,A=x-G*d,C=u-H*d,m+=E*d,y+=J*d,x+=G*d,u+=H*d,this.appendVertexData(e,z,c,k.x,k.y),this.appendVertexData(A,C,c,k.x,k.y),this.appendVertexData(x,u,c,f.x,f.y),this.appendVertexData(e,z,c,k.x,k.y),this.appendVertexData(m,y,c,f.x,
f.y),this.appendVertexData(x,u,c,f.x,f.y);n.length=0;b.length=0;this._dirty=!0}}},_drawSegments:function(a,b,c,d){b=null==b?this._lineWidth:b;if(!(0>=b)){c=c||this._drawColor;null==c.a&&(c.a=255);b*=0.5;var e,h,m,x,u,z,A,B=a.length;for(A=n.length=0;A<B;A+=2)e=a[(A-2+B)%B],h=a[(A-1+B)%B],m=a[A],x=a[A+1],u=a[(A+2)%B],z=a[(A+3)%B],f.x=h-x,f.y=m-e,k.x=x-z,k.y=u-m,cc.pNormalizeIn(f),cc.pNormalizeIn(k),m=f.x*k.x+f.y*k.y+1,x=(f.x+k.x)/m,m=(f.y+k.y)/m,n.push(x,m,k.x,k.y);B/=2;if(this._ensureCapacity(this._vertexCount+
3*(3*B-2))){d=d?B:B-1;var D,C,E,J,G,H;for(A=0;A<d;A++)u=(A+1)%B,e=a[2*A],h=a[2*A+1],m=a[2*u],x=a[2*u+1],f.x=n[4*A+2],f.y=n[4*A+3],D=n[4*A],C=n[4*A+1],E=n[4*u],J=n[4*u+1],u=e-D*b,z=h-C*b,G=m-E*b,H=x-J*b,e+=D*b,h+=C*b,m+=E*b,x+=J*b,this.appendVertexData(u,z,c,-f.x,-f.y),this.appendVertexData(G,H,c,-f.x,-f.y),this.appendVertexData(m,x,c,f.x,f.y),this.appendVertexData(u,z,c,-f.x,-f.y),this.appendVertexData(e,h,c,f.x,f.y),this.appendVertexData(m,x,c,f.x,f.y);n.length=0;this._dirty=!0}}},clear:function(){this.release();
this._dirty=!0},_createRenderCmd:function(){return new cc.DrawNode.WebGLRenderCmd(this)}})}});(function(){cc.DrawNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._blendFunc=this._drawColor=this._buffer=null};cc.DrawNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.DrawNode.CanvasRenderCmd.prototype.constructor=cc.DrawNode.CanvasRenderCmd;cc.DrawNode.CanvasRenderCmd.prototype.getLocalBB=function(){return this._node._localBB};cc.extend(cc.DrawNode.CanvasRenderCmd.prototype,{rendering:function(a,b,c){a=a||cc._renderContext;a.getContext();
var d=this._displayedOpacity/255;if(0!==d){a.setTransform(this._worldTransform,b,c);a.setGlobalAlpha(d);this._blendFunc&&this._blendFunc.src===cc.SRC_ALPHA&&this._blendFunc.dst===cc.ONE&&a.setCompositeOperation("lighter");for(var d=this._buffer,e=0,f=d.length;e<f;e++){var h=d[e];switch(h.type){case cc.DrawNode.TYPE_DOT:this._drawDot(a,h,b,c);break;case cc.DrawNode.TYPE_SEGMENT:this._drawSegment(a,h,b,c);break;case cc.DrawNode.TYPE_POLY:this._drawPoly(a,h,b,c)}}}},_drawDot:function(a,b){var c=b.fillColor,
d=b.verts[0],e=b.lineWidth,f=a.getContext();a.setFillStyle("rgba("+(0|c.r)+","+(0|c.g)+","+(0|c.b)+","+c.a/255+")");f.beginPath();f.arc(d.x,-d.y,e,0,2*Math.PI,!1);f.closePath();f.fill()},_drawSegment:function(a,b,c){var d=b.lineColor,e=b.verts[0],f=b.verts[1],h=b.lineWidth;b=b.lineCap;var k=a.getContext();a.setStrokeStyle("rgba("+(0|d.r)+","+(0|d.g)+","+(0|d.b)+","+d.a/255+")");k.lineWidth=h*c;k.beginPath();k.lineCap=b;k.moveTo(e.x,-e.y);k.lineTo(f.x,-f.y);k.stroke()},_drawPoly:function(a,b,c){var d=
b.verts,e=b.lineCap;if(null!=d){var f=b.fillColor,h=b.lineWidth,k=b.lineColor,m=b.isClosePolygon,n=b.isFill;b=b.isStroke;var p=a.getContext(),r=d[0];p.lineCap=e;f&&a.setFillStyle("rgba("+(0|f.r)+","+(0|f.g)+","+(0|f.b)+","+f.a/255+")");h&&(p.lineWidth=h*c);k&&a.setStrokeStyle("rgba("+(0|k.r)+","+(0|k.g)+","+(0|k.b)+","+k.a/255+")");p.beginPath();p.moveTo(r.x,-r.y);a=1;for(c=d.length;a<c;a++)p.lineTo(d[a].x,-d[a].y);m&&p.closePath();n&&p.fill();b&&p.stroke()}}})})();(function(){cc.DrawNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity()};cc.DrawNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.DrawNode.WebGLRenderCmd.prototype.constructor=cc.DrawNode.WebGLRenderCmd;cc.DrawNode.WebGLRenderCmd.prototype.rendering=function(a){a=this._node;if(0<a._vertexCount){var b=this._worldTransform;this._matrix.mat[0]=b.a;this._matrix.mat[4]=b.c;this._matrix.mat[12]=b.tx;this._matrix.mat[1]=
b.b;this._matrix.mat[5]=b.d;this._matrix.mat[13]=b.ty;cc.glBlendFunc(a._blendFunc.src,a._blendFunc.dst);this._glProgramState.apply(this._matrix);a._render()}}})();cc.stencilBits=-1;
cc.ClippingNode=cc.Node.extend({inverted:!1,_alphaThreshold:0,_stencil:null,_className:"ClippingNode",_originStencilProgram:null,ctor:function(a){a=a||null;cc.Node.prototype.ctor.call(this);if(this._stencil=a)this._originStencilProgram=a.getShaderProgram();this.alphaThreshold=1;this.inverted=!1;this._renderCmd.initStencilBits()},onEnter:function(){cc.Node.prototype.onEnter.call(this);this._stencil&&this._stencil._performRecursive(cc.Node._stateCallbackType.onEnter)},onEnterTransitionDidFinish:function(){cc.Node.prototype.onEnterTransitionDidFinish.call(this);this._stencil&&
this._stencil._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)},onExitTransitionDidStart:function(){this._stencil._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart);cc.Node.prototype.onExitTransitionDidStart.call(this)},onExit:function(){this._stencil._performRecursive(cc.Node._stateCallbackType.onExit);cc.Node.prototype.onExit.call(this)},visit:function(a){this._renderCmd.clippingVisit(a&&a._renderCmd)},_visitChildren:function(){this._reorderChildDirty&&
this.sortAllChildren();for(var a=this._children,b,c=0,d=a.length;c<d;c++)(b=a[c])&&b._visible&&b.visit(this);this._renderCmd._dirtyFlag=0},getAlphaThreshold:function(){return this._alphaThreshold},setAlphaThreshold:function(a){1===a&&a!==this._alphaThreshold&&this._renderCmd.resetProgramByStencil();this._alphaThreshold=a},isInverted:function(){return this.inverted},setInverted:function(a){this.inverted=a},getStencil:function(){return this._stencil},setStencil:function(a){this._stencil!==a&&(a&&(this._originStencilProgram=
a.getShaderProgram()),this._renderCmd.setStencil(a))},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ClippingNode.CanvasRenderCmd(this):new cc.ClippingNode.WebGLRenderCmd(this)}});_p=cc.ClippingNode.prototype;cc.defineGetterSetter(_p,"stencil",_p.getStencil,_p.setStencil);cc.defineGetterSetter(_p,"alphaThreshold",_p.getAlphaThreshold,_p.setAlphaThreshold);cc.ClippingNode.create=function(a){return new cc.ClippingNode(a)};(function(){cc.ClippingNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._clipElemType=this._godhelpme=this._needDraw=!1;this._rendererSaveCmd=new cc.CustomRenderCmd(this,this._saveCmdCallback);this._rendererClipCmd=new cc.CustomRenderCmd(this,this._clipCmdCallback);this._rendererRestoreCmd=new cc.CustomRenderCmd(this,this._restoreCmdCallback)};var a=cc.ClippingNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ClippingNode.CanvasRenderCmd;a.resetProgramByStencil=
function(){};a.initStencilBits=function(){};a.setStencil=function(a){if(null!=a)if(this._node._stencil=a,a instanceof cc.DrawNode){if(a._buffer)for(var c=0;c<a._buffer.length;c++)a._buffer[c].isFill=!1,a._buffer[c].isStroke=!1;a._renderCmd.rendering=function(a,b,c){};a._renderCmd._canUseDirtyRegion=!0;this._rendererSaveCmd._canUseDirtyRegion=!0;this._rendererClipCmd._canUseDirtyRegion=!0;this._rendererRestoreCmd._canUseDirtyRegion=!0}else a._parent=this._node};a._saveCmdCallback=function(a,c,d){var e=
a||cc._renderContext;a=e.getContext();this._clipElemType?(c=cc.ClippingNode.CanvasRenderCmd._getSharedCache(),d=a.canvas,c.width=d.width,c.height=d.height,c.getContext("2d").drawImage(d,0,0)):(e.save(),e.setTransform(this._worldTransform,c,d),this._node.inverted&&(a.beginPath(),a.rect(0,0,a.canvas.width,-a.canvas.height),a.clip()))};a._setStencilCompositionOperation=function(a){if(a){var c=this._node;a._renderCmd&&a._renderCmd._blendFuncStr&&(a._renderCmd._blendFuncStr=c.inverted?"destination-out":
"destination-in");if(a._children){a=a._children;for(var c=0,d=a.length;c<d;c++)this._setStencilCompositionOperation(a[c])}}};a._clipCmdCallback=function(a){var c=this._node;a=(a||cc._renderContext).getContext();if(this._clipElemType)this._setStencilCompositionOperation(c._stencil);else{c=this._node._stencil;if(c instanceof cc.DrawNode){a.beginPath();var d=c._renderCmd._transform;a.transform(d.a,d.b,d.c,d.d,d.tx,-d.ty);for(d=0;d<c._buffer.length;d++){var e=c._buffer[d].verts,f=e[0];a.moveTo(f.x,-f.y);
for(f=e.length-1;0<f;f--)a.lineTo(e[f].x,-e[f].y)}}a.clip()}};a._restoreCmdCallback=function(a){var c=cc.ClippingNode.CanvasRenderCmd._getSharedCache();a=a||cc._renderContext;var d=a.getContext();this._clipElemType?(d.save(),d.setTransform(1,0,0,1,0,0),d.globalCompositeOperation="destination-over",d.drawImage(c,0,0),d.restore(),this._dirtyFlag=0):a.restore()};a.transform=function(a,c){this.originTransform(a,c);var d=this._node;d._stencil&&d._stencil._renderCmd&&(d._stencil._renderCmd.transform(this,
!0),d._stencil._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty)};a._cangodhelpme=function(a){if(!0===a||!1===a)cc.ClippingNode.CanvasRenderCmd.prototype._godhelpme=a;return cc.ClippingNode.CanvasRenderCmd.prototype._godhelpme};a.clippingVisit=function(a){var c=this._node;a=a||this.getParentRenderCmd();this.visit(a);this._clipElemType=!(!this._cangodhelpme()&&c._stencil instanceof cc.DrawNode);if(c._stencil&&c._stencil.visible){cc.renderer.pushRenderCommand(this._rendererSaveCmd);this._clipElemType?
c._visitChildren():c._stencil.visit(c);cc.renderer.pushRenderCommand(this._rendererClipCmd);if(this._clipElemType)c._stencil.visit(c);else{this._cangodhelpme(!0);a=c._children;var d,e=a.length;if(0<e)for(c.sortAllChildren(),d=0;d<e;d++)a[d].visit(c);this._cangodhelpme(!1)}cc.renderer.pushRenderCommand(this._rendererRestoreCmd);this._dirtyFlag=0}else this.inverted&&c._visitChildren()};cc.ClippingNode.CanvasRenderCmd._sharedCache=null;cc.ClippingNode.CanvasRenderCmd._getSharedCache=function(){return cc.ClippingNode.CanvasRenderCmd._sharedCache||
(cc.ClippingNode.CanvasRenderCmd._sharedCache=document.createElement("canvas"))}})();function setProgram(a,b){a.shaderProgram=b;var c=a.children;if(c)for(var d=0;d<c.length;d++)setProgram(c[d],b)}
(function(){cc.ClippingNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1;this._beforeVisitCmd=new cc.CustomRenderCmd(this,this._onBeforeVisit);this._afterDrawStencilCmd=new cc.CustomRenderCmd(this,this._onAfterDrawStencil);this._afterVisitCmd=new cc.CustomRenderCmd(this,this._onAfterVisit);this._mask_layer_le=this._currentStencilEnabled=null};var a=cc.ClippingNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ClippingNode.WebGLRenderCmd;
cc.ClippingNode.WebGLRenderCmd._init_once=null;cc.ClippingNode.WebGLRenderCmd._visit_once=null;cc.ClippingNode.WebGLRenderCmd._layer=-1;a.initStencilBits=function(){cc.ClippingNode.WebGLRenderCmd._init_once=!0;cc.ClippingNode.WebGLRenderCmd._init_once&&(cc.stencilBits=cc._renderContext.getParameter(cc._renderContext.STENCIL_BITS),0>=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),cc.ClippingNode.WebGLRenderCmd._init_once=!1)};a.transform=function(a,c){var d=this._node;this.originTransform(a,
c);d._stencil&&(d._stencil._renderCmd.transform(this,!0),d._stencil._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty)};a.clippingVisit=function(a){var c=this._node;a=a||this.getParentRenderCmd();this.visit(a);if(1>cc.stencilBits)c._visitChildren();else if(c._stencil&&c._stencil.visible)if(cc.ClippingNode.WebGLRenderCmd._layer+1===cc.stencilBits)cc.ClippingNode.WebGLRenderCmd._visit_once=!0,cc.ClippingNode.WebGLRenderCmd._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its children."),
cc.ClippingNode.WebGLRenderCmd._visit_once=!1),c._visitChildren();else{cc.renderer.pushRenderCommand(this._beforeVisitCmd);c._stencil.visit(c);cc.renderer.pushRenderCommand(this._afterDrawStencilCmd);if((a=c._children)&&0<a.length){var d=a.length;c.sortAllChildren();for(var e=0;e<d;e++)a[e].visit(c)}cc.renderer.pushRenderCommand(this._afterVisitCmd);this._dirtyFlag=0}else c.inverted&&c._visitChildren()};a.setStencil=function(a){var c=this._node;c._stencil&&(c._stencil._parent=null);c._stencil=a;c._stencil&&
(c._stencil._parent=c)};a.resetProgramByStencil=function(){var a=this._node;a._stencil&&setProgram(a._stencil,a._originStencilProgram)};a._onBeforeVisit=function(a){var c=a||cc._renderContext;a=this._node;cc.ClippingNode.WebGLRenderCmd._layer++;var d=1<<cc.ClippingNode.WebGLRenderCmd._layer;this._mask_layer_le=d|d-1;this._currentStencilEnabled=c.isEnabled(c.STENCIL_TEST);c.clear(c.DEPTH_BUFFER_BIT);c.enable(c.STENCIL_TEST);c.depthMask(!1);c.stencilFunc(c.NEVER,d,d);c.stencilOp(c.REPLACE,c.KEEP,c.KEEP);
c.stencilMask(d);c.clear(c.STENCIL_BUFFER_BIT);1>a.alphaThreshold&&(c=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),cc.glUseProgram(c.getProgram()),c.setUniformLocationWith1f(cc.UNIFORM_ALPHA_TEST_VALUE_S,a.alphaThreshold),c.setUniformLocationWithMatrix4fv(cc.UNIFORM_MVMATRIX_S,cc.renderer.mat4Identity.mat),cc.setProgram(a._stencil,c))};a._onAfterDrawStencil=function(a){a=a||cc._renderContext;a.depthMask(!0);a.stencilFunc(this._node.inverted?a.NOTEQUAL:a.EQUAL,this._mask_layer_le,
this._mask_layer_le);a.stencilOp(a.KEEP,a.KEEP,a.KEEP)};a._onAfterVisit=function(a){a=a||cc._renderContext;cc.ClippingNode.WebGLRenderCmd._layer--;if(this._currentStencilEnabled){var c=1<<cc.ClippingNode.WebGLRenderCmd._layer,d=c|c-1;a.stencilMask(c);a.stencilFunc(a.EQUAL,d,d)}else a.disable(a.STENCIL_TEST)}})();cc.GridBase=cc.Class.extend({_active:!1,_reuseGrid:0,_gridSize:null,_gridRect:null,_texture:null,_step:null,_grabber:null,_isTextureFlipped:!1,_glProgramState:null,_directorProjection:0,_dirty:!1,ctor:function(a,b,c,d){cc.sys._checkWebGLRenderMode();this._active=!1;this._reuseGrid=0;this._gridSize=null;this._gridRect=new cc.rect;this._texture=null;this._step=cc.p(0,0);this._grabber=null;this._isTextureFlipped=!1;this._glProgramState=null;this._directorProjection=0;this._dirty=!1;void 0!==a&&this.initWithSize(a,
b,c,d)},isActive:function(){return this._active},setActive:function(a){this._active=a;if(!a){a=cc.director;var b=a.getProjection();a.setProjection(b)}},getReuseGrid:function(){return this._reuseGrid},setReuseGrid:function(a){this._reuseGrid=a},getGridSize:function(){return cc.size(this._gridSize.width,this._gridSize.height)},setGridSize:function(a){this._gridSize.width=parseInt(a.width);this._gridSize.height=parseInt(a.height)},setGridRect:function(a){this._gridRect=a},getGridRect:function(){return this._gridRect},
getStep:function(){return cc.p(this._step.x,this._step.y)},setStep:function(a){this._step.x=a.x;this._step.y=a.y},isTextureFlipped:function(){return this._isTextureFlipped},setTextureFlipped:function(a){this._isTextureFlipped!==a&&(this._isTextureFlipped=a,this.calculateVertexPoints())},initWithSize:function(a,b,c,d){if(!b){var e=cc.director.getWinSizeInPixels(),f=cc.NextPOT(e.width),h=cc.NextPOT(e.height),k=new Uint8Array(f*h*4);if(!k)return cc.log("cocos2d: CCGrid: not enough memory."),!1;b=new cc.Texture2D;
b.initWithData(k,cc.Texture2D.PIXEL_FORMAT_RGBA8888,f,h,e);if(!b)return cc.log("cocos2d: CCGrid: error creating texture"),!1}this._active=!1;this._reuseGrid=0;this._gridSize=a;this._texture=b;this._isTextureFlipped=c||!1;if(void 0===d||cc._rectEqualToZero(d))b=this._texture.getContentSize(),d=new cc.rect(0,0,b.width,b.height);this._gridRect=d;this._step.x=this._gridRect.width/a.width;this._step.y=this._gridRect.height/a.height;this._grabber=new cc.Grabber;if(!this._grabber)return!1;this._grabber.grab(this._texture);
this._glProgramState=cc.GLProgramState.getOrCreateWithGLProgram(cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE));this.calculateVertexPoints();return!0},beforeDraw:function(){this._directorProjection=cc.director.getProjection();var a=cc.director.getWinSizeInPixels();gl.viewport(0,0,a.width,a.height);this._grabber.beforeRender(this._texture)},afterDraw:function(a){this._grabber.afterRender(this._texture);cc.director.setViewport();cc.glBindTexture2D(this._texture);this.beforeBlit();this.blit(a);
this.afterBlit()},beforeBlit:function(){},afterBlit:function(){},blit:function(){cc.log("cc.GridBase.blit(): Shall be overridden in subclass.")},reuse:function(){cc.log("cc.GridBase.reuse(): Shall be overridden in subclass.")},calculateVertexPoints:function(){cc.log("cc.GridBase.calculateVertexPoints(): Shall be overridden in subclass.")},set2DProjection:function(){var a=cc.director.getWinSizeInPixels();cc._renderContext.viewport(0,0,a.width,a.height);cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLLoadIdentity();
a=cc.math.Matrix4.createOrthographicProjection(0,a.width,0,a.height,-1,1);cc.kmGLMultMatrix(a);cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLLoadIdentity();cc.setProjectionMatrixDirty()}});cc.GridBase.create=function(a,b,c,d){return new cc.GridBase(a,b,c,d)};
cc.Grid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,_needDepthTestForBlit:!1,_oldDepthTestValue:!1,_oldDepthWriteValue:!1,ctor:function(a,b,c,d){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null;this._matrix=new cc.math.Matrix4;this._matrix.identity();
void 0!==a&&this.initWithSize(a,b,c,d)},vertex:function(a){return this.getVertex(a)},getVertex:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.vertex() : Numbers must be integers");a=0|3*(a.x*(this._gridSize.height+1)+a.y);var b=this._vertices;return new cc.Vertex3F(b[a],b[a+1],b[a+2])},originalVertex:function(a){return this.getOriginalVertex(a)},getOriginalVertex:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.originalVertex() : Numbers must be integers");a=0|3*(a.x*(this._gridSize.height+
1)+a.y);var b=this._originalVertices;return new cc.Vertex3F(b[a],b[a+1],b[a+2])},setVertex:function(a,b){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.Grid3D.setVertex() : Numbers must be integers");var c=0|3*(a.x*(this._gridSize.height+1)+a.y),d=this._vertices;d[c]=b.x;d[c+1]=b.y;d[c+2]=b.z;this._dirty=!0},beforeBlit:function(){if(this._needDepthTestForBlit){var a=cc._renderContext;this._oldDepthTestValue=a.isEnabled(a.DEPTH_TEST);this._oldDepthWriteValue=a.getParameter(a.DEPTH_WRITEMASK);a.enable(a.DEPTH_TEST);
a.depthMask(!0)}},afterBlit:function(){if(this._needDepthTestForBlit){var a=cc._renderContext;this._oldDepthTestValue?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST);a.depthMask(this._oldDepthWriteValue)}},blit:function(a){var b=this._gridSize.width*this._gridSize.height;a=a._renderCmd._worldTransform;this._matrix.mat[0]=a.a;this._matrix.mat[4]=a.c;this._matrix.mat[12]=a.tx;this._matrix.mat[1]=a.b;this._matrix.mat[5]=a.d;this._matrix.mat[13]=a.ty;this._glProgramState.apply(this._matrix);a=cc._renderContext;
var c=this._dirty;a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
this._indicesBuffer);c&&a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,a.STATIC_DRAW);a.drawElements(a.TRIANGLES,6*b,a.UNSIGNED_SHORT,0);c&&(this._dirty=!1);cc.incrementGLDraws(1)},reuse:function(){if(0<this._reuseGrid){for(var a=this._originalVertices,b=this._vertices,c=0,d=this._vertices.length;c<d;c++)a[c]=b[c];--this._reuseGrid}},calculateVertexPoints:function(){var a=cc._renderContext,b=this._texture.pixelsWidth,c=this._texture.pixelsHeight,d=this._texture.getContentSizeInPixels().height,
e=this._gridSize,f=(e.width+1)*(e.height+1);this._vertices=new Float32Array(3*f);this._texCoordinates=new Float32Array(2*f);this._indices=new Uint16Array(e.width*e.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,r=this._vertices,f=0;f<e.width;++f)for(h=0;h<e.height;++h){var s=h*e.width+f;k=f*this._step.x+this._gridRect.x;var t=k+this._step.x,w=h*this._step.y+this._gridRect.y,v=w+this._step.y,y=f*(e.height+1)+h,x=(f+1)*(e.height+1)+h,u=(f+1)*(e.height+1)+(h+1),z=f*(e.height+1)+(h+1);m[6*s]=y;m[6*s+1]=x;m[6*s+2]=z;m[6*s+3]=x;m[6*s+4]=u;m[6*s+5]=z;var s=[3*y,3*x,3*u,3*z],A=[{x:k,y:w,z:0},{x:t,y:w,z:0},{x:t,y:v,z:0},{x:k,y:v,z:0}],y=[2*y,2*x,2*u,2*z],t=[cc.p(k,
w),cc.p(t,w),cc.p(t,v),cc.p(k,v)];for(k=0;4>k;++k)r[s[k]]=A[k].x,r[s[k]+1]=A[k].y,r[s[k]+2]=A[k].z,n[y[k]]=t[k].x/b,n[y[k]+1]=p?(d-t[k].y)/c:t[k].y/c}this._originalVertices=new Float32Array(this._vertices);a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);a.bufferData(a.ELEMENT_ARRAY_BUFFER,
this._indices,a.STATIC_DRAW);this._dirty=!0},setNeedDepthTestForBlit:function(a){this._needDepthTestForBlit=a},getNeedDepthTestForBlit:function(){return this._needDepthTestForBlit}});cc.Grid3D.create=function(a,b,c){return new cc.Grid3D(a,b,c)};
cc.TiledGrid3D=cc.GridBase.extend({_texCoordinates:null,_vertices:null,_originalVertices:null,_indices:null,_texCoordinateBuffer:null,_verticesBuffer:null,_indicesBuffer:null,ctor:function(a,b,c,d){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null;this._matrix=new cc.math.Matrix4;this._matrix.identity();void 0!==a&&this.initWithSize(a,b,c,d)},tile:function(a){return this.getTile(a)},
getTile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.tile() : Numbers must be integers");a=12*(this._gridSize.height*a.x+a.y);var b=this._vertices;return new cc.Quad3(new cc.Vertex3F(b[a],b[a+1],b[a+2]),new cc.Vertex3F(b[a+3],b[a+4],b[a+5]),new cc.Vertex3F(b[a+6],b[a+7],b[a+8]),new cc.Vertex3F(b[a+9],b[a+10],b[a+11]))},getOriginalTile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.originalTile() : Numbers must be integers");a=12*(this._gridSize.height*a.x+a.y);
var b=this._originalVertices;return new cc.Quad3(new cc.Vertex3F(b[a],b[a+1],b[a+2]),new cc.Vertex3F(b[a+3],b[a+4],b[a+5]),new cc.Vertex3F(b[a+6],b[a+7],b[a+8]),new cc.Vertex3F(b[a+9],b[a+10],b[a+11]))},originalTile:function(a){return this.getOriginalTile(a)},setTile:function(a,b){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.setTile() : Numbers must be integers");var c=12*(this._gridSize.height*a.x+a.y),d=this._vertices;d[c]=b.bl.x;d[c+1]=b.bl.y;d[c+2]=b.bl.z;d[c+3]=b.br.x;d[c+4]=b.br.y;d[c+
5]=b.br.z;d[c+6]=b.tl.x;d[c+7]=b.tl.y;d[c+8]=b.tl.z;d[c+9]=b.tr.x;d[c+10]=b.tr.y;d[c+11]=b.tr.z;this._dirty=!0},blit:function(a){var b=this._gridSize.width*this._gridSize.height;a=a._renderCmd._worldTransform;this._matrix.mat[0]=a.a;this._matrix.mat[4]=a.c;this._matrix.mat[12]=a.tx;this._matrix.mat[1]=a.b;this._matrix.mat[5]=a.d;this._matrix.mat[13]=a.ty;this._glProgramState.apply(this._matrix);a=cc._renderContext;var c=this._dirty;a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);
a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,0,this._vertices);a.bindBuffer(a.ARRAY_BUFFER,this._texCoordinateBuffer);c&&a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0,this._texCoordinates);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);c&&a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,
a.STATIC_DRAW);a.drawElements(a.TRIANGLES,6*b,a.UNSIGNED_SHORT,0);c&&(this._dirty=!1);cc.incrementGLDraws(1)},reuse:function(){if(0<this._reuseGrid){for(var a=this._vertices,b=this._originalVertices,c=0;c<a.length;c++)b[c]=a[c];--this._reuseGrid}},calculateVertexPoints:function(){var a=this._texture.pixelsWidth,b=this._texture.pixelsHeight,c=this._texture.getContentSizeInPixels().height,d=this._gridSize,e=d.width*d.height;this._vertices=new Float32Array(12*e);this._texCoordinates=new Float32Array(8*
e);this._indices=new Uint16Array(6*e);var f=cc._renderContext;this._verticesBuffer&&f.deleteBuffer(this._verticesBuffer);this._verticesBuffer=f.createBuffer();this._texCoordinateBuffer&&f.deleteBuffer(this._texCoordinateBuffer);this._texCoordinateBuffer=f.createBuffer();this._indicesBuffer&&f.deleteBuffer(this._indicesBuffer);this._indicesBuffer=f.createBuffer();var h,k,m=0,n=this._step,p=this._vertices,r=this._texCoordinates,s=this._isTextureFlipped;for(h=0;h<d.width;h++)for(k=0;k<d.height;k++){var t=
h*n.x,w=t+n.x,v=k*n.y,y=v+n.y;p[12*m]=t;p[12*m+1]=v;p[12*m+2]=0;p[12*m+3]=w;p[12*m+4]=v;p[12*m+5]=0;p[12*m+6]=t;p[12*m+7]=y;p[12*m+8]=0;p[12*m+9]=w;p[12*m+10]=y;p[12*m+11]=0;var x=v,u=y;s&&(x=c-v,u=c-y);r[8*m]=t/a;r[8*m+1]=x/b;r[8*m+2]=w/a;r[8*m+3]=x/b;r[8*m+4]=t/a;r[8*m+5]=u/b;r[8*m+6]=w/a;r[8*m+7]=u/b;m++}a=this._indices;for(h=0;h<e;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);f.bindBuffer(f.ARRAY_BUFFER,
this._verticesBuffer);f.bufferData(f.ARRAY_BUFFER,this._vertices,f.DYNAMIC_DRAW);f.bindBuffer(f.ARRAY_BUFFER,this._texCoordinateBuffer);f.bufferData(f.ARRAY_BUFFER,this._texCoordinates,f.DYNAMIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,this._indices,f.DYNAMIC_DRAW);this._dirty=!0}});cc.TiledGrid3D.create=function(a,b,c){return new cc.TiledGrid3D(a,b,c)};cc.Grabber=cc.Class.extend({_FBO:null,_oldFBO:null,_oldClearColor:null,_gl:null,ctor:function(){cc.sys._checkWebGLRenderMode();this._gl=cc._renderContext;this._oldClearColor=[0,0,0,0];this._oldFBO=null;this._FBO=this._gl.createFramebuffer()},grab:function(a){var b=this._gl;this._oldFBO=b.getParameter(b.FRAMEBUFFER_BINDING);b.bindFramebuffer(b.FRAMEBUFFER,this._FBO);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,a._webTextureObj,0);b.checkFramebufferStatus(b.FRAMEBUFFER)!==b.FRAMEBUFFER_COMPLETE&&
cc.log("Frame Grabber: could not attach texture to frmaebuffer");b.bindFramebuffer(b.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.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},copy:function(){cc.log("copy is deprecated. Please use clone instead.");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=function(){return new cc.Action};cc.Action.create=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*(this._timesForRepeat||1)},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(a,b){cc.Action.prototype.ctor.call(this);this._speed=0;this._innerAction=null;a&&this.initWithAction(a,b)},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a},initWithAction:function(a,b){if(!a)throw Error("cc.Speed.initWithAction(): action must be non nil");this._innerAction=a;this._speed=b;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 new cc.Speed(this._innerAction.reverse(),this._speed)},setInnerAction:function(a){this._innerAction!==a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});cc.speed=function(a,b){return new cc.Speed(a,b)};
cc.Speed.create=cc.speed;
cc.Follow=cc.Action.extend({_followedNode:null,_boundarySet:!1,_boundaryFullyCovered:!1,_halfScreenSize:null,_fullScreenSize:null,_worldRect:null,leftBoundary:0,rightBoundary:0,topBoundary:0,bottomBoundary:0,ctor:function(a,b){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.rect(0,0,0,0);a&&(b?this.initWithTarget(a,
b):this.initWithTarget(a))},clone:function(){var a=new cc.Follow,b=this._worldRect,b=new cc.Rect(b.x,b.y,b.width,b.height);a.initWithTarget(this._followedNode,b);return a},isBoundarySet:function(){return this._boundarySet},setBoudarySet:function(a){this._boundarySet=a},initWithTarget:function(a,b){if(!a)throw Error("cc.Follow.initWithAction(): followedNode must be non nil");b=b||cc.rect(0,0,0,0);this._followedNode=a;this._worldRect=b;this._boundarySet=!cc._rectEqualToZero(b);this._boundaryFullyCovered=
!1;var c=cc.director.getWinSize();this._fullScreenSize=cc.p(c.width,c.height);this._halfScreenSize=cc.pMult(this._fullScreenSize,0.5);this._boundarySet&&(this.leftBoundary=-(b.x+b.width-this._fullScreenSize.x),this.rightBoundary=-b.x,this.topBoundary=-b.y,this.bottomBoundary=-(b.y+b.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.x;var b=this._followedNode.y;a=this._halfScreenSize.x-a;b=this._halfScreenSize.y-b;this.target._renderCmd._dirtyFlag=0;this._boundarySet?this._boundaryFullyCovered||this.target.setPosition(cc.clampf(a,this.leftBoundary,this.rightBoundary),cc.clampf(b,this.bottomBoundary,this.topBoundary)):this.target.setPosition(a,
b)},isDone:function(){return!this._followedNode.running},stop:function(){this.target=null;cc.Action.prototype.stop.call(this)}});cc.follow=function(a,b){return new cc.Follow(a,b)};cc.Follow.create=cc.follow;cc.ActionInterval=cc.FiniteTimeAction.extend({_elapsed:0,_firstTick:!1,_easeList:null,_timesForRepeat:1,_repeatForever:!1,_repeatMethod:!1,_speed:1,_speedMethod:!1,ctor:function(a){this._timesForRepeat=this._speed=1;this._repeatForever=!1;this.MAX_VALUE=2;this._speedMethod=this._repeatMethod=!1;cc.FiniteTimeAction.prototype.ctor.call(this);void 0!==a&&this.initWithDuration(a)},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},_cloneDecoration:function(a){a._repeatForever=this._repeatForever;a._speed=this._speed;a._timesForRepeat=this._timesForRepeat;a._easeList=this._easeList;a._speedMethod=this._speedMethod;a._repeatMethod=this._repeatMethod},_reverseEaseList:function(a){if(this._easeList){a._easeList=[];for(var b=0;b<this._easeList.length;b++)a._easeList.push(this._easeList[b].reverse())}},clone:function(){var a=new cc.ActionInterval(this._duration);
this._cloneDecoration(a);return a},easing:function(a){this._easeList?this._easeList.length=0:this._easeList=[];for(var b=0;b<arguments.length;b++)this._easeList.push(arguments[b]);return this},_computeEaseTime:function(a){var b=this._easeList;if(!b||0===b.length)return a;for(var c=0,d=b.length;c<d;c++)a=b[c].easing(a);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);this._repeatMethod&&1<this._timesForRepeat&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},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.");return 0},speed:function(a){if(0>=a)return cc.log("The speed parameter error"),this;this._speedMethod=!0;this._speed*=a;return this},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a;return this},repeat:function(a){a=Math.round(a);if(isNaN(a)||1>a)return cc.log("The repeat parameter error"),this;this._repeatMethod=!0;this._timesForRepeat*=a;return this},repeatForever:function(){this._repeatMethod=
!0;this._timesForRepeat=this.MAX_VALUE;this._repeatForever=!0;return this}});cc.actionInterval=function(a){return new cc.ActionInterval(a)};cc.ActionInterval.create=cc.actionInterval;
cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._actions=[];var b=a instanceof Array?a:arguments,c=b.length-1;0<=c&&null==b[c]&&cc.log("parameters should not be ending with null in Javascript");if(0<=c){for(var d=b[0],e=1;e<c;e++)b[e]&&(d=cc.Sequence._actionOneTwo(d,b[e]));this.initWithTwoActions(d,b[c])}},initWithTwoActions:function(a,b){if(!a||!b)throw Error("cc.Sequence.initWithTwoActions(): arguments must all be non nil");
this.initWithDuration(a._duration+b._duration);this._actions[0]=a;this._actions[1]=b;return!0},clone:function(){var a=new cc.Sequence;this._cloneDecoration(a);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]._duration/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 b=
0,c=this._split,d=this._actions,e=this._last;a=this._computeEaseTime(a);a<c?(a=0!==c?a/c:1,0===b&&1===e&&(d[1].update(0),d[1].stop())):(b=1,a=1===c?1:(a-c)/(1-c),-1===e&&(d[0].startWithTarget(this.target),d[0].update(1),d[0].stop()),e||(d[0].update(1),d[0].stop()));d=d[b];e===b&&d.isDone()||(e!==b&&d.startWithTarget(this.target),a*=d._timesForRepeat,d.update(1<a?a%1:a),this._last=b)},reverse:function(){var a=cc.Sequence._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());this._cloneDecoration(a);
this._reverseEaseList(a);return a}});cc.sequence=function(a){var b=a instanceof Array?a:arguments;0<b.length&&null==b[b.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var c,d,e,f;b&&0<b.length;)for(d=Array.prototype.shift.call(b),f=d._timesForRepeat||1,d._repeatMethod=!1,d._timesForRepeat=1,e=0,c||(c=d,e=1),e;e<f;e++)c=cc.Sequence._actionOneTwo(c,d);return c};cc.Sequence.create=cc.sequence;
cc.Sequence._actionOneTwo=function(a,b){var c=new cc.Sequence;c.initWithTwoActions(a,b);return c};
cc.Repeat=cc.ActionInterval.extend({_times:0,_total:0,_nextDt:0,_actionInstant:!1,_innerAction:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithAction(a,b)},initWithAction:function(a,b){return this.initWithDuration(a._duration*b)?(this._times=b,this._innerAction=a,a instanceof cc.ActionInstant&&(this._actionInstant=!0,this._times-=1),this._total=0,!0):!1},clone:function(){var a=new cc.Repeat;this._cloneDecoration(a);a.initWithAction(this._innerAction.clone(),
this._times);return a},startWithTarget:function(a){this._total=0;this._nextDt=this._innerAction._duration/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){a=this._computeEaseTime(a);var b=this._innerAction,c=this._duration,d=this._times,e=this._nextDt;if(a>=e){for(;a>e&&this._total<d;)b.update(1),this._total++,b.stop(),b.startWithTarget(this.target),
this._nextDt=e+=b._duration/c;1<=a&&this._total<d&&this._total++;this._actionInstant||(this._total===d?(b.update(1),b.stop()):b.update(a-(e-b._duration/c)))}else b.update(a*d%1)},isDone:function(){return this._total===this._times},reverse:function(){var a=new cc.Repeat(this._innerAction.reverse(),this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a},setInnerAction:function(a){this._innerAction!==a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});
cc.repeat=function(a,b){return new cc.Repeat(a,b)};cc.Repeat.create=cc.repeat;
cc.RepeatForever=cc.ActionInterval.extend({_innerAction:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._innerAction=null;a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.RepeatForever.initWithAction(): action must be non null");this._innerAction=a;return!0},clone:function(){var a=new cc.RepeatForever;this._cloneDecoration(a);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 b=this._innerAction;b.step(a);b.isDone()&&(b.startWithTarget(this.target),b.step(b.getElapsed()-b._duration))},isDone:function(){return!1},reverse:function(){var a=new cc.RepeatForever(this._innerAction.reverse());this._cloneDecoration(a);this._reverseEaseList(a);return a},setInnerAction:function(a){this._innerAction!==a&&(this._innerAction=a)},getInnerAction:function(){return this._innerAction}});cc.repeatForever=function(a){return new cc.RepeatForever(a)};
cc.RepeatForever.create=cc.repeatForever;
cc.Spawn=cc.ActionInterval.extend({_one:null,_two:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._two=this._one=null;var b,c,d;if(a instanceof Array)c=a;else for(c=Array(arguments.length),b=0;b<arguments.length;++b)c[b]=arguments[b];d=c.length-1;0<=d&&null==c[d]&&cc.log("parameters should not be ending with null in Javascript");if(0<=d){var e=c[0];for(b=1;b<d;b++)c[b]&&(e=cc.Spawn._actionOneTwo(e,c[b]));this.initWithTwoActions(e,c[d])}},initWithTwoActions:function(a,b){if(!a||
!b)throw Error("cc.Spawn.initWithTwoActions(): arguments must all be non null");var c=!1,d=a._duration,e=b._duration;this.initWithDuration(Math.max(d,e))&&(this._one=a,this._two=b,d>e?this._two=cc.Sequence._actionOneTwo(b,cc.delayTime(d-e)):d<e&&(this._one=cc.Sequence._actionOneTwo(a,cc.delayTime(e-d))),c=!0);return c},clone:function(){var a=new cc.Spawn;this._cloneDecoration(a);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){a=this._computeEaseTime(a);this._one&&this._one.update(a);this._two&&this._two.update(a)},reverse:function(){var a=cc.Spawn._actionOneTwo(this._one.reverse(),this._two.reverse());this._cloneDecoration(a);this._reverseEaseList(a);return a}});
cc.spawn=function(a){var b=a instanceof Array?a:arguments;0<b.length&&null==b[b.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var c=b[0],d=1;d<b.length;d++)null!=b[d]&&(c=cc.Spawn._actionOneTwo(c,b[d]));return c};cc.Spawn.create=cc.spawn;cc.Spawn._actionOneTwo=function(a,b){var c=new cc.Spawn;c.initWithTwoActions(a,b);return c};
cc.RotateTo=cc.ActionInterval.extend({_dstAngleX:0,_startAngleX:0,_diffAngleX:0,_dstAngleY:0,_startAngleY:0,_diffAngleY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._dstAngleX=b||0,this._dstAngleY=void 0!==c?c:this._dstAngleX,!0):!1},clone:function(){var a=new cc.RotateTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._dstAngleX,
this._dstAngleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.rotationX%360,c=this._dstAngleX-b;180<c&&(c-=360);-180>c&&(c+=360);this._startAngleX=b;this._diffAngleX=c;this._startAngleY=a.rotationY%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){a=this._computeEaseTime(a);this.target&&(this.target.rotationX=
this._startAngleX+this._diffAngleX*a,this.target.rotationY=this._startAngleY+this._diffAngleY*a)}});cc.rotateTo=function(a,b,c){return new cc.RotateTo(a,b,c)};cc.RotateTo.create=cc.rotateTo;
cc.RotateBy=cc.ActionInterval.extend({_angleX:0,_startAngleX:0,_angleY:0,_startAngleY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._angleX=b||0,this._angleY=c||this._angleX,!0):!1},clone:function(){var a=new cc.RotateBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._angleX,this._angleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,
a);this._startAngleX=a.rotationX;this._startAngleY=a.rotationY},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX=this._startAngleX+this._angleX*a,this.target.rotationY=this._startAngleY+this._angleY*a)},reverse:function(){var a=new cc.RotateBy(this._duration,-this._angleX,-this._angleY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.rotateBy=function(a,b,c){return new cc.RotateBy(a,b,c)};cc.RotateBy.create=cc.rotateBy;
cc.MoveBy=cc.ActionInterval.extend({_positionDelta:null,_startPosition:null,_previousPosition:null,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._positionDelta=cc.p(0,0);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0!==b.x&&(c=b.y,b=b.x),this._positionDelta.x=b,this._positionDelta.y=c,!0):!1},clone:function(){var a=
new cc.MoveBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._positionDelta);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=this._positionDelta.x*a;a*=this._positionDelta.y;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d=
this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;b+=c.x;a+=c.y;f.x=b;f.y=a;this.target.setPosition(b,a)}else this.target.setPosition(c.x+b,c.y+a)}},reverse:function(){var a=new cc.MoveBy(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y));this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.moveBy=function(a,b,c){return new cc.MoveBy(a,b,c)};cc.MoveBy.create=cc.moveBy;
cc.MoveTo=cc.MoveBy.extend({_endPosition:null,ctor:function(a,b,c){cc.MoveBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.MoveBy.prototype.initWithDuration.call(this,a,b,c)?(void 0!==b.x&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},clone:function(){var a=new cc.MoveTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition);return a},startWithTarget:function(a){cc.MoveBy.prototype.startWithTarget.call(this,
a);this._positionDelta.x=this._endPosition.x-a.getPositionX();this._positionDelta.y=this._endPosition.y-a.getPositionY()}});cc.moveTo=function(a,b,c){return new cc.MoveTo(a,b,c)};cc.MoveTo.create=cc.moveTo;
cc.SkewTo=cc.ActionInterval.extend({_skewX:0,_skewY:0,_startSkewX:0,_startSkewY:0,_endSkewX:0,_endSkewY:0,_deltaX:0,_deltaY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.ActionInterval.prototype.initWithDuration.call(this,a)&&(this._endSkewX=b,this._endSkewY=c,d=!0);return d},clone:function(){var a=new cc.SkewTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endSkewX,this._endSkewY);
return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startSkewX=a.skewX%180;this._deltaX=this._endSkewX-this._startSkewX;180<this._deltaX&&(this._deltaX-=360);-180>this._deltaX&&(this._deltaX+=360);this._startSkewY=a.skewY%360;this._deltaY=this._endSkewY-this._startSkewY;180<this._deltaY&&(this._deltaY-=360);-180>this._deltaY&&(this._deltaY+=360)},update:function(a){a=this._computeEaseTime(a);this.target.skewX=this._startSkewX+this._deltaX*a;this.target.skewY=
this._startSkewY+this._deltaY*a}});cc.skewTo=function(a,b,c){return new cc.SkewTo(a,b,c)};cc.SkewTo.create=cc.skewTo;
cc.SkewBy=cc.SkewTo.extend({ctor:function(a,b,c){cc.SkewTo.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.SkewTo.prototype.initWithDuration.call(this,a,b,c)&&(this._skewX=b,this._skewY=c,d=!0);return d},clone:function(){var a=new cc.SkewBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._skewX,this._skewY);return a},startWithTarget:function(a){cc.SkewTo.prototype.startWithTarget.call(this,a);this._deltaX=this._skewX;
this._deltaY=this._skewY;this._endSkewX=this._startSkewX+this._deltaX;this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var a=new cc.SkewBy(this._duration,-this._skewX,-this._skewY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.skewBy=function(a,b,c){return new cc.SkewBy(a,b,c)};cc.SkewBy.create=cc.skewBy;
cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(a,b,c,d,e){cc.ActionInterval.prototype.ctor.call(this);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);this._delta=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0===e&&(e=d,d=c,c=b.y,b=b.x),this._delta.x=b,this._delta.y=c,this._height=d,this._jumps=
e,!0):!1},clone:function(){var a=new cc.JumpBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._delta,this._height,this._jumps);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=a*this._jumps%1,b=4*this._height*b*(1-b),b=b+this._delta.y*
a;a*=this._delta.x;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;a+=c.x;b+=c.y;f.x=a;f.y=b;this.target.setPosition(a,b)}else this.target.setPosition(c.x+a,c.y+b)}},reverse:function(){var a=new cc.JumpBy(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);this._cloneDecoration(a);this._reverseEaseList(a);return a}});
cc.jumpBy=function(a,b,c,d,e){return new cc.JumpBy(a,b,c,d,e)};cc.JumpBy.create=cc.jumpBy;
cc.JumpTo=cc.JumpBy.extend({_endPosition:null,ctor:function(a,b,c,d,e){cc.JumpBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.JumpBy.prototype.initWithDuration.call(this,a,b,c,d,e)?(void 0===e&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},startWithTarget:function(a){cc.JumpBy.prototype.startWithTarget.call(this,a);this._delta.x=this._endPosition.x-this._startPosition.x;this._delta.y=
this._endPosition.y-this._startPosition.y},clone:function(){var a=new cc.JumpTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition,this._height,this._jumps);return a}});cc.jumpTo=function(a,b,c,d,e){return new cc.JumpTo(a,b,c,d,e)};cc.JumpTo.create=cc.jumpTo;cc.bezierAt=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d};
cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._config=[];this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._config=b,!0):!1},clone:function(){var a=new cc.BezierBy;this._cloneDecoration(a);for(var b=[],c=0;c<this._config.length;c++){var d=
this._config[c];b.push(cc.p(d.x,d.y))}a.initWithDuration(this._duration,b);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=this._config,c=b[0].y,d=b[1].y,e=b[2].y,b=cc.bezierAt(0,b[0].x,b[1].x,b[2].x,a);a=cc.bezierAt(0,c,d,e,a);c=this._startPosition;
if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;b+=c.x;a+=c.y;f.x=b;f.y=a;this.target.setPosition(b,a)}else this.target.setPosition(c.x+b,c.y+a)}},reverse:function(){var a=this._config,a=[cc.pAdd(a[1],cc.pNeg(a[2])),cc.pAdd(a[0],cc.pNeg(a[2])),cc.pNeg(a[2])],a=new cc.BezierBy(this._duration,a);this._cloneDecoration(a);this._reverseEaseList(a);return a}});
cc.bezierBy=function(a,b){return new cc.BezierBy(a,b)};cc.BezierBy.create=cc.bezierBy;
cc.BezierTo=cc.BezierBy.extend({_toConfig:null,ctor:function(a,b){cc.BezierBy.prototype.ctor.call(this);this._toConfig=[];b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toConfig=b,!0):!1},clone:function(){var a=new cc.BezierTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toConfig);return a},startWithTarget:function(a){cc.BezierBy.prototype.startWithTarget.call(this,a);a=this._startPosition;var b=
this._toConfig,c=this._config;c[0]=cc.pSub(b[0],a);c[1]=cc.pSub(b[1],a);c[2]=cc.pSub(b[2],a)}});cc.bezierTo=function(a,b){return new cc.BezierTo(a,b)};cc.BezierTo.create=cc.bezierTo;
cc.ScaleTo=cc.ActionInterval.extend({_scaleX:1,_scaleY:1,_startScaleX:1,_startScaleY:1,_endScaleX:0,_endScaleY:0,_deltaX:0,_deltaY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._endScaleX=b,this._endScaleY=null!=c?c:b,!0):!1},clone:function(){var a=new cc.ScaleTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endScaleX,
this._endScaleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startScaleX=a.scaleX;this._startScaleY=a.scaleY;this._deltaX=this._endScaleX-this._startScaleX;this._deltaY=this._endScaleY-this._startScaleY},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.scaleX=this._startScaleX+this._deltaX*a,this.target.scaleY=this._startScaleY+this._deltaY*a)}});cc.scaleTo=function(a,b,c){return new cc.ScaleTo(a,b,c)};
cc.ScaleTo.create=cc.scaleTo;
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(){var a=new cc.ScaleBy(this._duration,1/this._endScaleX,1/this._endScaleY);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.ScaleBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endScaleX,
this._endScaleY);return a}});cc.scaleBy=function(a,b,c){return new cc.ScaleBy(a,b,c)};cc.ScaleBy.create=cc.scaleBy;
cc.Blink=cc.ActionInterval.extend({_times:0,_originalState:!1,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._times=b,!0):!1},clone:function(){var a=new cc.Blink;this._cloneDecoration(a);a.initWithDuration(this._duration,this._times);return a},update:function(a){a=this._computeEaseTime(a);if(this.target&&!this.isDone()){var b=1/this._times;this.target.visible=
a%b>b/2}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._originalState=a.visible},stop:function(){this.target.visible=this._originalState;cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var a=new cc.Blink(this._duration,this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.blink=function(a,b){return new cc.Blink(a,b)};cc.Blink.create=cc.blink;
cc.FadeTo=cc.ActionInterval.extend({_toOpacity:0,_fromOpacity:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toOpacity=b,!0):!1},clone:function(){var a=new cc.FadeTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},update:function(a){a=this._computeEaseTime(a);var b=void 0!==this._fromOpacity?this._fromOpacity:
255;this.target.opacity=b+(this._toOpacity-b)*a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._fromOpacity=a.opacity}});cc.fadeTo=function(a,b){return new cc.FadeTo(a,b)};cc.FadeTo.create=cc.fadeTo;
cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,255)},reverse:function(){var a=new cc.FadeOut;a.initWithDuration(this._duration,0);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeIn;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},startWithTarget:function(a){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity);
cc.FadeTo.prototype.startWithTarget.call(this,a)}});cc.fadeIn=function(a){return new cc.FadeIn(a)};cc.FadeIn.create=cc.fadeIn;
cc.FadeOut=cc.FadeTo.extend({ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,0)},reverse:function(){var a=new cc.FadeIn;a._reverseAction=this;a.initWithDuration(this._duration,255);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeOut;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a}});cc.fadeOut=function(a){return new cc.FadeOut(a)};cc.FadeOut.create=cc.fadeOut;
cc.TintTo=cc.ActionInterval.extend({_to:null,_from:null,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);this._to=cc.color(0,0,0);this._from=cc.color(0,0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=cc.color(b,c,d),!0):!1},clone:function(){var a=new cc.TintTo;this._cloneDecoration(a);var b=this._to;a.initWithDuration(this._duration,b.r,b.g,b.b);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,
a);this._from=this.target.color},update:function(a){a=this._computeEaseTime(a);var b=this._from,c=this._to;b&&this.target.setColor(cc.color(b.r+(c.r-b.r)*a,b.g+(c.g-b.g)*a,b.b+(c.b-b.b)*a))}});cc.tintTo=function(a,b,c,d){return new cc.TintTo(a,b,c,d)};cc.TintTo.create=cc.tintTo;
cc.TintBy=cc.ActionInterval.extend({_deltaR:0,_deltaG:0,_deltaB:0,_fromR:0,_fromG:0,_fromB:0,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._deltaR=b,this._deltaG=c,this._deltaB=d,!0):!1},clone:function(){var a=new cc.TintBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB);return a},
startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);a=a.color;this._fromR=a.r;this._fromG=a.g;this._fromB=a.b},update:function(a){a=this._computeEaseTime(a);this.target.color=cc.color(this._fromR+this._deltaR*a,this._fromG+this._deltaG*a,this._fromB+this._deltaB*a)},reverse:function(){var a=new cc.TintBy(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);this._cloneDecoration(a);this._reverseEaseList(a);return a}});
cc.tintBy=function(a,b,c,d){return new cc.TintBy(a,b,c,d)};cc.TintBy.create=cc.tintBy;cc.DelayTime=cc.ActionInterval.extend({update:function(a){},reverse:function(){var a=new cc.DelayTime(this._duration);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.DelayTime;this._cloneDecoration(a);a.initWithDuration(this._duration);return a}});cc.delayTime=function(a){return new cc.DelayTime(a)};cc.DelayTime.create=cc.delayTime;
cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._other=null;a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.ReverseTime.initWithAction(): action must be non null");if(a===this._other)throw Error("cc.ReverseTime.initWithAction(): the action was already passed in.");return cc.ActionInterval.prototype.initWithDuration.call(this,a._duration)?(this._other=a,!0):!1},clone:function(){var a=new cc.ReverseTime;
this._cloneDecoration(a);a.initWithAction(this._other.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._other.startWithTarget(a)},update:function(a){a=this._computeEaseTime(a);this._other&&this._other.update(1-a)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop();cc.Action.prototype.stop.call(this)}});cc.reverseTime=function(a){return new cc.ReverseTime(a)};cc.ReverseTime.create=cc.reverseTime;
cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,_currFrameIndex:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._splitTimes=[];a&&this.initWithAnimation(a)},getAnimation:function(){return this._animation},setAnimation:function(a){this._animation=a},getCurrentFrameIndex:function(){return this._currFrameIndex},initWithAnimation:function(a){if(!a)throw Error("cc.Animate.initWithAnimation(): animation must be non-NULL");
var b=a.getDuration();if(this.initWithDuration(b*a.getLoops())){this._nextFrame=0;this.setAnimation(a);this._origFrame=null;this._executedLoops=0;var c=this._splitTimes,d=c.length=0,e=b/a.getTotalDelayUnits();a=a.getFrames();cc.arrayVerifyType(a,cc.AnimationFrame);for(var f=0;f<a.length;f++){var h=d*e/b,d=d+a[f].getDelayUnits();c.push(h)}return!0}return!1},clone:function(){var a=new cc.Animate;this._cloneDecoration(a);a.initWithAnimation(this._animation.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,
a);this._animation.getRestoreOriginalFrame()&&(this._origFrame=a.getSpriteFrame());this._executedLoops=this._nextFrame=0},update:function(a){a=this._computeEaseTime(a);1>a&&(a*=this._animation.getLoops(),(0|a)>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),a%=1);for(var b=this._animation.getFrames(),c=b.length,d=this._splitTimes,e=this._nextFrame;e<c;e++)if(d[e]<=a)_currFrameIndex=e,this.target.setSpriteFrame(b[_currFrameIndex].getSpriteFrame()),this._nextFrame=e+1;else break},reverse:function(){var a=
this._animation,b=a.getFrames(),c=[];cc.arrayVerifyType(b,cc.AnimationFrame);if(0<b.length)for(var d=b.length-1;0<=d;d--){var e=b[d];if(!e)break;c.push(e.clone())}b=new cc.Animation(c,a.getDelayPerUnit(),a.getLoops());b.setRestoreOriginalFrame(a.getRestoreOriginalFrame());a=new cc.Animate(b);this._cloneDecoration(a);this._reverseEaseList(a);return a},stop:function(){this._animation.getRestoreOriginalFrame()&&this.target&&this.target.setSpriteFrame(this._origFrame);cc.Action.prototype.stop.call(this)}});
cc.animate=function(a){return new cc.Animate(a)};cc.Animate.create=cc.animate;
cc.TargetedAction=cc.ActionInterval.extend({_action:null,_forcedTarget:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);b&&this.initWithTarget(a,b)},initWithTarget:function(a,b){return this.initWithDuration(b._duration)?(this._forcedTarget=a,this._action=b,!0):!1},clone:function(){var a=new cc.TargetedAction;this._cloneDecoration(a);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){a=this._computeEaseTime(a);this._action.update(a)},getForcedTarget:function(){return this._forcedTarget},setForcedTarget:function(a){this._forcedTarget!==a&&(this._forcedTarget=a)}});cc.targetedAction=function(a,b){return new cc.TargetedAction(a,b)};cc.TargetedAction.create=cc.targetedAction;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.visible=!0},reverse:function(){return new cc.Hide},clone:function(){return new cc.Show}});cc.show=function(){return new cc.Show};cc.Show.create=cc.show;
cc.Hide=cc.ActionInstant.extend({update:function(a){this.target.visible=!1},reverse:function(){return new cc.Show},clone:function(){return new cc.Hide}});cc.hide=function(){return new cc.Hide};cc.Hide.create=cc.hide;cc.ToggleVisibility=cc.ActionInstant.extend({update:function(a){this.target.visible=!this.target.visible},reverse:function(){return new cc.ToggleVisibility},clone:function(){return new cc.ToggleVisibility}});cc.toggleVisibility=function(){return new cc.ToggleVisibility};
cc.ToggleVisibility.create=cc.toggleVisibility;cc.RemoveSelf=cc.ActionInstant.extend({_isNeedCleanUp:!0,ctor:function(a){cc.FiniteTimeAction.prototype.ctor.call(this);void 0!==a&&this.init(a)},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=function(a){return new cc.RemoveSelf(a)};
cc.RemoveSelf.create=cc.removeSelf;cc.FlipX=cc.ActionInstant.extend({_flippedX:!1,ctor:function(a){cc.FiniteTimeAction.prototype.ctor.call(this);this._flippedX=!1;void 0!==a&&this.initWithFlipX(a)},initWithFlipX:function(a){this._flippedX=a;return!0},update:function(a){this.target.flippedX=this._flippedX},reverse:function(){return new cc.FlipX(!this._flippedX)},clone:function(){var a=new cc.FlipX;a.initWithFlipX(this._flippedX);return a}});cc.flipX=function(a){return new cc.FlipX(a)};
cc.FlipX.create=cc.flipX;cc.FlipY=cc.ActionInstant.extend({_flippedY:!1,ctor:function(a){cc.FiniteTimeAction.prototype.ctor.call(this);this._flippedY=!1;void 0!==a&&this.initWithFlipY(a)},initWithFlipY:function(a){this._flippedY=a;return!0},update:function(a){this.target.flippedY=this._flippedY},reverse:function(){return new cc.FlipY(!this._flippedY)},clone:function(){var a=new cc.FlipY;a.initWithFlipY(this._flippedY);return a}});cc.flipY=function(a){return new cc.FlipY(a)};cc.FlipY.create=cc.flipY;
cc.Place=cc.ActionInstant.extend({_x:0,_y:0,ctor:function(a,b){cc.FiniteTimeAction.prototype.ctor.call(this);this._y=this._x=0;void 0!==a&&(void 0!==a.x&&(b=a.y,a=a.x),this.initWithPosition(a,b))},initWithPosition:function(a,b){this._x=a;this._y=b;return!0},update:function(a){this.target.setPosition(this._x,this._y)},clone:function(){var a=new cc.Place;a.initWithPosition(this._x,this._y);return a}});cc.place=function(a,b){return new cc.Place(a,b)};cc.Place.create=cc.place;
cc.CallFunc=cc.ActionInstant.extend({_selectorTarget:null,_function:null,_data:null,ctor:function(a,b,c){cc.FiniteTimeAction.prototype.ctor.call(this);this.initWithFunction(a,b,c)},initWithFunction:function(a,b,c){a&&(this._function=a);b&&(this._selectorTarget=b);void 0!==c&&(this._data=c);return!0},execute:function(){this._function&&this._function.call(this._selectorTarget,this.target,this._data)},update:function(a){this.execute()},getTargetCallback:function(){return this._selectorTarget},setTargetCallback:function(a){a!==
this._selectorTarget&&(this._selectorTarget&&(this._selectorTarget=null),this._selectorTarget=a)},clone:function(){var a=new cc.CallFunc;a.initWithFunction(this._function,this._selectorTarget,this._data);return a}});cc.callFunc=function(a,b,c){return new cc.CallFunc(a,b,c)};cc.CallFunc.create=cc.callFunc;cc.ActionEase=cc.ActionInterval.extend({_inner:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.ActionEase.initWithAction(): action must be non nil");return this.initWithDuration(a.getDuration())?(this._inner=a,!0):!1},clone:function(){var a=new cc.ActionEase;a.initWithAction(this._inner.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._inner.startWithTarget(this.target)},
stop:function(){this._inner.stop();cc.ActionInterval.prototype.stop.call(this)},update:function(a){this._inner.update(a)},reverse:function(){return new cc.ActionEase(this._inner.reverse())},getInnerAction:function(){return this._inner}});cc.actionEase=function(a){return new cc.ActionEase(a)};cc.ActionEase.create=cc.actionEase;
cc.EaseRateAction=cc.ActionEase.extend({_rate:0,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);void 0!==b&&this.initWithAction(a,b)},setRate:function(a){this._rate=a},getRate:function(){return this._rate},initWithAction:function(a,b){return cc.ActionEase.prototype.initWithAction.call(this,a)?(this._rate=b,!0):!1},clone:function(){var a=new cc.EaseRateAction;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseRateAction(this._inner.reverse(),
1/this._rate)}});cc.easeRateAction=function(a,b){return new cc.EaseRateAction(a,b)};cc.EaseRateAction.create=cc.easeRateAction;cc.EaseIn=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,this._rate))},reverse:function(){return new cc.EaseIn(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseIn;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseIn.create=function(a,b){return new cc.EaseIn(a,b)};
cc.easeIn=function(a){return{_rate:a,easing:function(a){return Math.pow(a,this._rate)},reverse:function(){return cc.easeIn(1/this._rate)}}};cc.EaseOut=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,1/this._rate))},reverse:function(){return new cc.EaseOut(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseOut;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseOut.create=function(a,b){return new cc.EaseOut(a,b)};
cc.easeOut=function(a){return{_rate:a,easing:function(a){return Math.pow(a,1/this._rate)},reverse:function(){return cc.easeOut(1/this._rate)}}};cc.EaseInOut=cc.EaseRateAction.extend({update:function(a){a*=2;1>a?this._inner.update(0.5*Math.pow(a,this._rate)):this._inner.update(1-0.5*Math.pow(2-a,this._rate))},clone:function(){var a=new cc.EaseInOut;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseInOut(this._inner.reverse(),this._rate)}});
cc.EaseInOut.create=function(a,b){return new cc.EaseInOut(a,b)};cc.easeInOut=function(a){return{_rate:a,easing:function(a){a*=2;return 1>a?0.5*Math.pow(a,this._rate):1-0.5*Math.pow(2-a,this._rate)},reverse:function(){return cc.easeInOut(this._rate)}}};
cc.EaseExponentialIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a?0:Math.pow(2,10*(a-1)))},reverse:function(){return new cc.EaseExponentialOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialIn;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialIn.create=function(a){return new cc.EaseExponentialIn(a)};cc._easeExponentialInObj={easing:function(a){return 0===a?0:Math.pow(2,10*(a-1))},reverse:function(){return cc._easeExponentialOutObj}};
cc.easeExponentialIn=function(){return cc._easeExponentialInObj};cc.EaseExponentialOut=cc.ActionEase.extend({update:function(a){this._inner.update(1===a?1:-Math.pow(2,-10*a)+1)},reverse:function(){return new cc.EaseExponentialIn(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialOut.create=function(a){return new cc.EaseExponentialOut(a)};
cc._easeExponentialOutObj={easing:function(a){return 1===a?1:-Math.pow(2,-10*a)+1},reverse:function(){return cc._easeExponentialInObj}};cc.easeExponentialOut=function(){return cc._easeExponentialOutObj};
cc.EaseExponentialInOut=cc.ActionEase.extend({update:function(a){1!==a&&0!==a&&(a*=2,a=1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2));this._inner.update(a)},reverse:function(){return new cc.EaseExponentialInOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialInOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialInOut.create=function(a){return new cc.EaseExponentialInOut(a)};
cc._easeExponentialInOutObj={easing:function(a){return 1!==a&&0!==a?(a*=2,1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)):a},reverse:function(){return cc._easeExponentialInOutObj}};cc.easeExponentialInOut=function(){return cc._easeExponentialInOutObj};
cc.EaseSineIn=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1;this._inner.update(a)},reverse:function(){return new cc.EaseSineOut(this._inner.reverse())},clone:function(){var a=new cc.EaseSineIn;a.initWithAction(this._inner.clone());return a}});cc.EaseSineIn.create=function(a){return new cc.EaseSineIn(a)};cc._easeSineInObj={easing:function(a){return 0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1},reverse:function(){return cc._easeSineOutObj}};cc.easeSineIn=function(){return cc._easeSineInObj};
cc.EaseSineOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:Math.sin(a*Math.PI/2);this._inner.update(a)},reverse:function(){return new cc.EaseSineIn(this._inner.reverse())},clone:function(){var a=new cc.EaseSineOut;a.initWithAction(this._inner.clone());return a}});cc.EaseSineOut.create=function(a){return new cc.EaseSineOut(a)};cc._easeSineOutObj={easing:function(a){return 0===a||1===a?a:Math.sin(a*Math.PI/2)},reverse:function(){return cc._easeSineInObj}};cc.easeSineOut=function(){return cc._easeSineOutObj};
cc.EaseSineInOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1);this._inner.update(a)},clone:function(){var a=new cc.EaseSineInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseSineInOut(this._inner.reverse())}});cc.EaseSineInOut.create=function(a){return new cc.EaseSineInOut(a)};cc._easeSineInOutObj={easing:function(a){return 0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1)},reverse:function(){return cc._easeSineInOutObj}};
cc.easeSineInOut=function(){return cc._easeSineInOutObj};
cc.EaseElastic=cc.ActionEase.extend({_period:0.3,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);a&&this.initWithAction(a,b)},getPeriod:function(){return this._period},setPeriod:function(a){this._period=a},initWithAction:function(a,b){cc.ActionEase.prototype.initWithAction.call(this,a);this._period=null==b?0.3:b;return!0},reverse:function(){cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");return null},clone:function(){var a=new cc.EaseElastic;a.initWithAction(this._inner.clone(),
this._period);return a}});cc.EaseElastic.create=function(a,b){return new cc.EaseElastic(a,b)};cc.EaseElasticIn=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,a-=1,b=-Math.pow(2,10*a)*Math.sin((a-b)*Math.PI*2/this._period));this._inner.update(b)},reverse:function(){return new cc.EaseElasticOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticIn;a.initWithAction(this._inner.clone(),this._period);return a}});
cc.EaseElasticIn.create=function(a,b){return new cc.EaseElasticIn(a,b)};cc._easeElasticInObj={easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)},reverse:function(){return cc._easeElasticOutObj}};cc.easeElasticIn=function(a){return a&&0.3!==a?{_period:a,easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-this._period/4)*Math.PI*2/this._period)},reverse:function(){return cc.easeElasticOut(this._period)}}:cc._easeElasticInObj};
cc.EaseElasticOut=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,b=Math.pow(2,-10*a)*Math.sin((a-b)*Math.PI*2/this._period)+1);this._inner.update(b)},reverse:function(){return new cc.EaseElasticIn(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticOut;a.initWithAction(this._inner.clone(),this._period);return a}});cc.EaseElasticOut.create=function(a,b){return new cc.EaseElasticOut(a,b)};
cc._easeElasticOutObj={easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)+1},reverse:function(){return cc._easeElasticInObj}};cc.easeElasticOut=function(a){return a&&0.3!==a?{_period:a,easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-this._period/4)*Math.PI*2/this._period)+1},reverse:function(){return cc.easeElasticIn(this._period)}}:cc._easeElasticOutObj};
cc.EaseElasticInOut=cc.EaseElastic.extend({update:function(a){var b=0,b=this._period;if(0===a||1===a)b=a;else{b||(b=this._period=0.3*1.5);var c=b/4;a=2*a-1;b=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-c)*Math.PI*2/b):Math.pow(2,-10*a)*Math.sin((a-c)*Math.PI*2/b)*0.5+1}this._inner.update(b)},reverse:function(){return new cc.EaseElasticInOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticInOut;a.initWithAction(this._inner.clone(),this._period);return a}});
cc.EaseElasticInOut.create=function(a,b){return new cc.EaseElasticInOut(a,b)};cc.easeElasticInOut=function(a){return{_period:a||0.3,easing:function(a){var c=0,c=this._period;if(0===a||1===a)c=a;else{c||(c=this._period=0.3*1.5);var d=c/4;a=2*a-1;c=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-d)*Math.PI*2/c):Math.pow(2,-10*a)*Math.sin((a-d)*Math.PI*2/c)*0.5+1}return c},reverse:function(){return cc.easeElasticInOut(this._period)}}};
cc.EaseBounce=cc.ActionEase.extend({bounceTime:function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375},clone:function(){var a=new cc.EaseBounce;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounce(this._inner.reverse())}});cc.EaseBounce.create=function(a){return new cc.EaseBounce(a)};
cc.EaseBounceIn=cc.EaseBounce.extend({update:function(a){a=1-this.bounceTime(1-a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceIn;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceIn.create=function(a){return new cc.EaseBounceIn(a)};
cc._bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};cc._easeBounceInObj={easing:function(a){return 1-cc._bounceTime(1-a)},reverse:function(){return cc._easeBounceOutObj}};cc.easeBounceIn=function(){return cc._easeBounceInObj};
cc.EaseBounceOut=cc.EaseBounce.extend({update:function(a){a=this.bounceTime(a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceOut.create=function(a){return new cc.EaseBounceOut(a)};cc._easeBounceOutObj={easing:function(a){return cc._bounceTime(a)},reverse:function(){return cc._easeBounceInObj}};cc.easeBounceOut=function(){return cc._easeBounceOutObj};
cc.EaseBounceInOut=cc.EaseBounce.extend({update:function(a){var b=0,b=0.5>a?0.5*(1-this.bounceTime(1-2*a)):0.5*this.bounceTime(2*a-1)+0.5;this._inner.update(b)},clone:function(){var a=new cc.EaseBounceInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounceInOut(this._inner.reverse())}});cc.EaseBounceInOut.create=function(a){return new cc.EaseBounceInOut(a)};
cc._easeBounceInOutObj={easing:function(a){return a=0.5>a?0.5*(1-cc._bounceTime(1-2*a)):0.5*cc._bounceTime(2*a-1)+0.5},reverse:function(){return cc._easeBounceInOutObj}};cc.easeBounceInOut=function(){return cc._easeBounceInOutObj};cc.EaseBackIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a||1===a?a:a*a*(2.70158*a-1.70158))},reverse:function(){return new cc.EaseBackOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBackIn;a.initWithAction(this._inner.clone());return a}});
cc.EaseBackIn.create=function(a){return new cc.EaseBackIn(a)};cc._easeBackInObj={easing:function(a){return 0===a||1===a?a:a*a*(2.70158*a-1.70158)},reverse:function(){return cc._easeBackOutObj}};cc.easeBackIn=function(){return cc._easeBackInObj};
cc.EaseBackOut=cc.ActionEase.extend({update:function(a){a-=1;this._inner.update(a*a*(2.70158*a+1.70158)+1)},reverse:function(){return new cc.EaseBackIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBackOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBackOut.create=function(a){return new cc.EaseBackOut(a)};cc._easeBackOutObj={easing:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},reverse:function(){return cc._easeBackInObj}};cc.easeBackOut=function(){return cc._easeBackOutObj};
cc.EaseBackInOut=cc.ActionEase.extend({update:function(a){a*=2;1>a?this._inner.update(a*a*(3.5949095*a-2.5949095)/2):(a-=2,this._inner.update(a*a*(3.5949095*a+2.5949095)/2+1))},clone:function(){var a=new cc.EaseBackInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBackInOut(this._inner.reverse())}});cc.EaseBackInOut.create=function(a){return new cc.EaseBackInOut(a)};
cc._easeBackInOutObj={easing:function(a){a*=2;if(1>a)return a*a*(3.5949095*a-2.5949095)/2;a-=2;return a*a*(3.5949095*a+2.5949095)/2+1},reverse:function(){return cc._easeBackInOutObj}};cc.easeBackInOut=function(){return cc._easeBackInOutObj};
cc.EaseBezierAction=cc.ActionEase.extend({_p0:null,_p1:null,_p2:null,_p3:null,ctor:function(a){cc.ActionEase.prototype.ctor.call(this,a)},_updateTime:function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d},update:function(a){a=this._updateTime(this._p0,this._p1,this._p2,this._p3,a);this._inner.update(a)},clone:function(){var a=new cc.EaseBezierAction;a.initWithAction(this._inner.clone());a.setBezierParamer(this._p0,this._p1,this._p2,this._p3);return a},
reverse:function(){var a=new cc.EaseBezierAction(this._inner.reverse());a.setBezierParamer(this._p3,this._p2,this._p1,this._p0);return a},setBezierParamer:function(a,b,c,d){this._p0=a||0;this._p1=b||0;this._p2=c||0;this._p3=d||0}});cc.EaseBezierAction.create=function(a){return new cc.EaseBezierAction(a)};cc.easeBezierAction=function(a,b,c,d){return{easing:function(e){return cc.EaseBezierAction.prototype._updateTime(a,b,c,d,e)},reverse:function(){return cc.easeBezierAction(d,c,b,a)}}};
cc.EaseQuadraticActionIn=cc.ActionEase.extend({_updateTime:function(a){return Math.pow(a,2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionIn(this._inner.reverse())}});cc.EaseQuadraticActionIn.create=function(a){return new cc.EaseQuadraticActionIn(a)};cc._easeQuadraticActionIn={easing:cc.EaseQuadraticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionIn}};
cc.easeQuadraticActionIn=function(){return cc._easeQuadraticActionIn};cc.EaseQuadraticActionOut=cc.ActionEase.extend({_updateTime:function(a){return-a*(a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionOut;a.initWithAction();return a},reverse:function(){return new cc.EaseQuadraticActionOut(this._inner.reverse())}});cc.EaseQuadraticActionOut.create=function(a){return new cc.EaseQuadraticActionOut(a)};
cc._easeQuadraticActionOut={easing:cc.EaseQuadraticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionOut}};cc.easeQuadraticActionOut=function(){return cc._easeQuadraticActionOut};
cc.EaseQuadraticActionInOut=cc.ActionEase.extend({_updateTime:function(a){var b=a;a*=2;1>a?b=a*a*0.5:(--a,b=-0.5*(a*(a-2)-1));return b},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionInOut(this._inner.reverse())}});cc.EaseQuadraticActionInOut.create=function(a){return new cc.EaseQuadraticActionInOut(a)};
cc._easeQuadraticActionInOut={easing:cc.EaseQuadraticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionInOut}};cc.easeQuadraticActionInOut=function(){return cc._easeQuadraticActionInOut};cc.EaseQuarticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionIn(this._inner.reverse())}});
cc.EaseQuarticActionIn.create=function(a){return new cc.EaseQuarticActionIn(a)};cc._easeQuarticActionIn={easing:cc.EaseQuarticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuarticActionIn}};cc.easeQuarticActionIn=function(){return cc._easeQuarticActionIn};
cc.EaseQuarticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return-(a*a*a*a-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionOut(this._inner.reverse())}});cc.EaseQuarticActionOut.create=function(a){return new cc.EaseQuarticActionOut(a)};cc._easeQuarticActionOut={easing:cc.EaseQuarticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionOut}};
cc.easeQuarticActionOut=function(){return cc._easeQuarticActionOut};cc.EaseQuarticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a;a-=2;return-0.5*(a*a*a*a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionInOut(this._inner.reverse())}});cc.EaseQuarticActionInOut.create=function(a){return new cc.EaseQuarticActionInOut(a)};
cc._easeQuarticActionInOut={easing:cc.EaseQuarticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionInOut}};cc.easeQuarticActionInOut=function(){return cc._easeQuarticActionInOut};cc.EaseQuinticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionIn(this._inner.reverse())}});
cc.EaseQuinticActionIn.create=function(a){return new cc.EaseQuinticActionIn(a)};cc._easeQuinticActionIn={easing:cc.EaseQuinticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuinticActionIn}};cc.easeQuinticActionIn=function(){return cc._easeQuinticActionIn};
cc.EaseQuinticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionOut(this._inner.reverse())}});cc.EaseQuinticActionOut.create=function(a){return new cc.EaseQuinticActionOut(a)};cc._easeQuinticActionOut={easing:cc.EaseQuinticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionOut}};
cc.easeQuinticActionOut=function(){return cc._easeQuinticActionOut};cc.EaseQuinticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a*a;a-=2;return 0.5*(a*a*a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionInOut(this._inner.reverse())}});cc.EaseQuinticActionInOut.create=function(a){return new cc.EaseQuinticActionInOut(a)};
cc._easeQuinticActionInOut={easing:cc.EaseQuinticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionInOut}};cc.easeQuinticActionInOut=function(){return cc._easeQuinticActionInOut};cc.EaseCircleActionIn=cc.ActionEase.extend({_updateTime:function(a){return-1*(Math.sqrt(1-a*a)-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionIn(this._inner.reverse())}});
cc.EaseCircleActionIn.create=function(a){return new cc.EaseCircleActionIn(a)};cc._easeCircleActionIn={easing:cc.EaseCircleActionIn.prototype._updateTime,reverse:function(){return cc._easeCircleActionIn}};cc.easeCircleActionIn=function(){return cc._easeCircleActionIn};
cc.EaseCircleActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return Math.sqrt(1-a*a)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionOut(this._inner.reverse())}});cc.EaseCircleActionOut.create=function(a){return new cc.EaseCircleActionOut(a)};cc._easeCircleActionOut={easing:cc.EaseCircleActionOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionOut}};
cc.easeCircleActionOut=function(){return cc._easeCircleActionOut};cc.EaseCircleActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return-0.5*(Math.sqrt(1-a*a)-1);a-=2;return 0.5*(Math.sqrt(1-a*a)+1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionInOut(this._inner.reverse())}});cc.EaseCircleActionInOut.create=function(a){return new cc.EaseCircleActionInOut(a)};
cc._easeCircleActionInOut={easing:cc.EaseCircleActionInOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionInOut}};cc.easeCircleActionInOut=function(){return cc._easeCircleActionInOut};cc.EaseCubicActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionIn(this._inner.reverse())}});
cc.EaseCubicActionIn.create=function(a){return new cc.EaseCubicActionIn(a)};cc._easeCubicActionIn={easing:cc.EaseCubicActionIn.prototype._updateTime,reverse:function(){return cc._easeCubicActionIn}};cc.easeCubicActionIn=function(){return cc._easeCubicActionIn};
cc.EaseCubicActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionOut(this._inner.reverse())}});cc.EaseCubicActionOut.create=function(a){return new cc.EaseCubicActionOut(a)};cc._easeCubicActionOut={easing:cc.EaseCubicActionOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionOut}};
cc.easeCubicActionOut=function(){return cc._easeCubicActionOut};cc.EaseCubicActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a;a-=2;return 0.5*(a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionInOut(this._inner.reverse())}});cc.EaseCubicActionInOut.create=function(a){return new cc.EaseCubicActionInOut(a)};
cc._easeCubicActionInOut={easing:cc.EaseCubicActionInOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionInOut}};cc.easeCubicActionInOut=function(){return cc._easeCubicActionInOut};cc.cardinalSplineAt=function(a,b,c,d,e,f,h){var k=f*f,m=k*f,n=(1-e)/2;e=n*(-m+2*k-f);var p=n*(-m+k)+(2*m-3*k+1);f=n*(m-2*k+f)+(-2*m+3*k);m=n*(m-k);k=a.x*e+b.x*p+c.x*f+d.x*m;a=a.y*e+b.y*p+c.y*f+d.y*m;if(void 0!==h)h.x=k,h.y=a;else return cc.p(k,a)};cc.reverseControlPoints=function(a){for(var b=[],c=a.length-1;0<=c;c--)b.push(cc.p(a[c].x,a[c].y));return b};cc.cloneControlPoints=function(a){for(var b=[],c=0;c<a.length;c++)b.push(cc.p(a[c].x,a[c].y));return b};cc.copyControlPoints=cc.cloneControlPoints;
cc.getControlPointAt=function(a,b){var c=Math.min(a.length-1,Math.max(b,0));return a[c]};cc.reverseControlPointsInline=function(a){for(var b=a.length,c=0|b/2,d=0;d<c;++d){var e=a[d];a[d]=a[b-d-1];a[b-d-1]=e}};
cc.CardinalSplineTo=cc.ActionInterval.extend({_points:null,_deltaT:0,_tension:0,_previousPosition:null,_accumulatedDiff:null,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._points=[];void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){if(!b||0===b.length)throw Error("Invalid configuration. It must at least have one control point");return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this.setPoints(b),this._tension=c,!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);this._previousPosition=cc.p(this.target.getPositionX(),this.target.getPositionY());this._accumulatedDiff=cc.p(0,0)},update:function(a){a=this._computeEaseTime(a);var b,c=this._points;if(1===a)b=c.length-1,a=1;else{var d=this._deltaT;b=0|a/d;a=(a-d*b)/d}b=cc.cardinalSplineAt(cc.getControlPointAt(c,
b-1),cc.getControlPointAt(c,b-0),cc.getControlPointAt(c,b+1),cc.getControlPointAt(c,b+2),this._tension,a);cc.ENABLE_STACKABLE_ACTIONS&&(c=this.target.getPositionX()-this._previousPosition.x,a=this.target.getPositionY()-this._previousPosition.y,0!==c||0!==a)&&(d=this._accumulatedDiff,c=d.x+c,a=d.y+a,d.x=c,d.y=a,b.x+=c,b.y+=a);this.updatePosition(b)},reverse:function(){var a=cc.reverseControlPoints(this._points);return cc.cardinalSplineTo(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=function(a,b,c){return new cc.CardinalSplineTo(a,b,c)};cc.CardinalSplineTo.create=cc.cardinalSplineTo;
cc.CardinalSplineBy=cc.CardinalSplineTo.extend({_startPosition:null,ctor:function(a,b,c){cc.CardinalSplineTo.prototype.ctor.call(this);this._startPosition=cc.p(0,0);void 0!==c&&this.initWithDuration(a,b,c)},startWithTarget:function(a){cc.CardinalSplineTo.prototype.startWithTarget.call(this,a);this._startPosition.x=a.getPositionX();this._startPosition.y=a.getPositionY()},reverse:function(){for(var a=this._points.slice(),b,c=a[0],d=1;d<a.length;++d)b=a[d],a[d]=cc.pSub(b,c),c=b;a=cc.reverseControlPoints(a);
c=a[a.length-1];a.pop();c.x=-c.x;c.y=-c.y;a.unshift(c);for(d=1;d<a.length;++d)b=a[d],b.x=-b.x,b.y=-b.y,b.x+=c.x,b.y+=c.y,c=a[d]=b;return cc.cardinalSplineBy(this._duration,a,this._tension)},updatePosition:function(a){var b=this._startPosition,c=a.x+b.x;a=a.y+b.y;this._previousPosition.x=c;this._previousPosition.y=a;this.target.setPosition(c,a)},clone:function(){var a=new cc.CardinalSplineBy;a.initWithDuration(this._duration,cc.copyControlPoints(this._points),this._tension);return a}});
cc.cardinalSplineBy=function(a,b,c){return new cc.CardinalSplineBy(a,b,c)};cc.CardinalSplineBy.create=cc.cardinalSplineBy;cc.CatmullRomTo=cc.CardinalSplineTo.extend({ctor:function(a,b){b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,a,b,0.5)},clone:function(){var a=new cc.CatmullRomTo;a.initWithDuration(this._duration,cc.copyControlPoints(this._points));return a}});
cc.catmullRomTo=function(a,b){return new cc.CatmullRomTo(a,b)};cc.CatmullRomTo.create=cc.catmullRomTo;cc.CatmullRomBy=cc.CardinalSplineBy.extend({ctor:function(a,b){cc.CardinalSplineBy.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.CardinalSplineTo.prototype.initWithDuration.call(this,a,b,0.5)},clone:function(){var a=new cc.CatmullRomBy;a.initWithDuration(this._duration,cc.copyControlPoints(this._points));return a}});
cc.catmullRomBy=function(a,b){return new cc.CatmullRomBy(a,b)};cc.CatmullRomBy.create=cc.catmullRomBy;cc.ActionTweenDelegate=cc.Class.extend({updateTweenAction:function(a,b){}});
cc.ActionTween=cc.ActionInterval.extend({key:"",from:0,to:0,delta:0,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);this.key="";void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this.key=b,this.to=d,this.from=c,!0):!1},startWithTarget:function(a){if(!a||!a.updateTweenAction)throw Error("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 new cc.ActionTween(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=function(a,b,c,d){return new cc.ActionTween(a,b,c,d)};cc.ActionTween.create=cc.actionTween;cc.GridAction=cc.ActionInterval.extend({_gridSize:null,_gridNodeTarget:null,ctor:function(a,b){cc.sys._checkWebGLRenderMode();cc.ActionInterval.prototype.ctor.call(this);this._gridSize=cc.size(0,0);b&&this.initWithDuration(a,b)},_cacheTargetAsGridNode:function(a){this._gridNodeTarget=a},clone:function(){var a=new cc.GridAction,b=this._gridSize;a.initWithDuration(this._duration,cc.size(b.width,b.height));return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);
cc.renderer.childrenOrderDirty=!0;this._cacheTargetAsGridNode(a);var b=this.getGrid();(a=this._gridNodeTarget.getGrid())&&0<a.getReuseGrid()?(b=a.getGridSize(),a.isActive()&&b.width===this._gridSize.width&&b.height===this._gridSize.height&&a.reuse()):(a&&a.isActive()&&a.setActive(!1),this._gridNodeTarget.setGrid(b),this._gridNodeTarget.getGrid().setActive(!0))},reverse:function(){return new cc.ReverseTime(this)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,
a)?(this._gridSize.width=b.width,this._gridSize.height=b.height,!0):!1},getGrid:function(){cc.log("cc.GridAction.getGrid(): it should be overridden in subclass.")}});cc.gridAction=function(a,b){return new cc.GridAction(a,b)};cc.GridAction.create=cc.gridAction;
cc.Grid3DAction=cc.GridAction.extend({getGrid:function(){return new cc.Grid3D(this._gridSize,void 0,void 0,this._gridNodeTarget.getGridRect())},getGridRect:function(){return this._gridNodeTarget.getGridRect()},vertex:function(a){return this.getVertex(a)},getVertex:function(a){return this.target.grid.getVertex(a)},originalVertex:function(a){return this.getOriginalVertex(a)},getOriginalVertex:function(a){return this.target.grid.originalVertex(a)},setVertex:function(a,b){this.target.grid.setVertex(a,
b)}});cc.grid3DAction=function(a,b){return new cc.Grid3DAction(a,b)};cc.Grid3DAction.create=cc.grid3DAction;cc.TiledGrid3DAction=cc.GridAction.extend({tile:function(a){return this.getTile(a)},getTile:function(a){return this.target.grid.tile(a)},originalTile:function(a){return this.getOriginalTile(a)},getOriginalTile:function(a){return this.target.grid.originalTile(a)},setTile:function(a,b){this.target.grid.setTile(a,b)},getGrid:function(){return new cc.TiledGrid3D(this._gridSize,void 0,void 0,this._gridNodeTarget.getGridRect())}});
cc.tiledGrid3DAction=function(a,b){return new cc.TiledGrid3DAction(a,b)};cc.TiledGrid3DAction.create=cc.tiledGrid3DAction;cc.StopGrid=cc.ActionInstant.extend({startWithTarget:function(a){cc.ActionInstant.prototype.startWithTarget.call(this,a);cc.renderer.childrenOrderDirty=!0;(a=this.target.grid)&&a.isActive()&&a.setActive(!1)}});cc.stopGrid=function(){return new cc.StopGrid};cc.StopGrid.create=cc.stopGrid;
cc.ReuseGrid=cc.ActionInstant.extend({_times:null,ctor:function(a){cc.ActionInstant.prototype.ctor.call(this);void 0!==a&&this.initWithTimes(a)},initWithTimes:function(a){this._times=a;return!0},startWithTarget:function(a){cc.ActionInstant.prototype.startWithTarget.call(this,a);cc.renderer.childrenOrderDirty=!0;this.target.grid&&this.target.grid.isActive()&&this.target.grid.setReuseGrid(this.target.grid.getReuseGrid()+this._times)}});cc.reuseGrid=function(a){return new cc.ReuseGrid(a)};
cc.ReuseGrid.create=cc.reuseGrid;cc.Waves3D=cc.Grid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},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,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this._waves=c,this._amplitude=
d,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize,c=this._amplitude,d=cc.p(0,0),e=this._amplitudeRate,f=this._waves,h=0;h<b.width+1;++h)for(var k=0;k<b.height+1;++k){d.x=h;d.y=k;var m=this.originalVertex(d);m.z+=Math.sin(Math.PI*a*f*2+0.01*(m.y+m.x))*c*e;this.setVertex(d,m)}}});cc.waves3D=function(a,b,c,d){return new cc.Waves3D(a,b,c,d)};cc.Waves3D.create=cc.waves3D;
cc.FlipX3D=cc.Grid3DAction.extend({ctor:function(a){void 0!==a?cc.GridAction.prototype.ctor.call(this,a,cc.size(1,1)):cc.GridAction.prototype.ctor.call(this)},initWithDuration:function(a){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,cc.size(1,1))},initWithSize:function(a,b){return 1!==a.width||1!==a.height?(cc.log("Grid size must be (1,1)"),!1):cc.Grid3DAction.prototype.initWithDuration.call(this,b,a)},update:function(a){var b=Math.PI*a;a=Math.sin(b);var c=Math.cos(b/2),b=new cc.Vertex3F,
d=cc.p(0,0);d.x=d.y=1;var e=this.originalVertex(d);d.x=d.y=0;var d=this.originalVertex(d),f=e.x,h=d.x,k,m;f>h?(e=cc.p(0,0),d=cc.p(0,1),k=cc.p(1,0),m=cc.p(1,1)):(k=cc.p(0,0),m=cc.p(0,1),e=cc.p(1,0),d=cc.p(1,1),f=h);b.x=f-f*c;b.z=Math.abs(parseFloat(f*a/4));a=this.originalVertex(e);a.x=b.x;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.x=b.x;a.z+=b.z;this.setVertex(d,a);a=this.originalVertex(k);a.x-=b.x;a.z-=b.z;this.setVertex(k,a);a=this.originalVertex(m);a.x-=b.x;a.z-=b.z;this.setVertex(m,
a)}});cc.flipX3D=function(a){return new cc.FlipX3D(a)};cc.FlipX3D.create=cc.flipX3D;
cc.FlipY3D=cc.FlipX3D.extend({ctor:function(a){void 0!==a?cc.GridAction.prototype.ctor.call(this,a,cc.size(1,1)):cc.GridAction.prototype.ctor.call(this)},update:function(a){var b=Math.PI*a;a=Math.sin(b);var c=Math.cos(b/2),b=new cc.Vertex3F,d=cc.p(0,0);d.x=d.y=1;var e=this.originalVertex(d);d.x=d.y=0;var d=this.originalVertex(d),f=e.y,h=d.y,k,m;f>h?(e=cc.p(0,0),d=cc.p(0,1),k=cc.p(1,0),m=cc.p(1,1)):(d=cc.p(0,0),e=cc.p(0,1),m=cc.p(1,0),k=cc.p(1,1),f=h);b.y=f-f*c;b.z=Math.abs(parseFloat(f*a)/4);a=this.originalVertex(e);
a.y=b.y;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.y-=b.y;a.z-=b.z;this.setVertex(d,a);a=this.originalVertex(k);a.y=b.y;a.z+=b.z;this.setVertex(k,a);a=this.originalVertex(m);a.y-=b.y;a.z-=b.z;this.setVertex(m,a)}});cc.flipY3D=function(a){return new cc.FlipY3D(a)};cc.FlipY3D.create=cc.flipY3D;
cc.Lens3D=cc.Grid3DAction.extend({_position:null,_radius:0,_lensEffect:0,_concave:!1,_dirty:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},getLensEffect:function(){return this._lensEffect},setLensEffect:function(a){this._lensEffect=a},setConcave:function(a){this._concave=a},getPosition:function(){return this._position},setPosition:function(a){cc.pointEqualToPoint(a,this._position)||(this._position.x=a.x,this._position.y=
a.y,this._dirty=!0)},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._radius=d,this._lensEffect=0.7,this._dirty=!0):!1},update:function(a){if(this._dirty){a=this._gridSize.width;for(var b=this._gridSize.height,c=this._radius,d=this._lensEffect,e=cc.p(0,0),f=cc.p(0,0),h,k,m,n=0;n<a+1;++n)for(var p=0;p<b+1;++p)e.x=n,e.y=p,h=this.originalVertex(e),f.x=this._position.x-h.x,f.y=this._position.y-h.y,k=cc.pLength(f),k<c&&(k=c-
k,k/=c,0===k&&(k=0.001),k=Math.log(k)*d,m=Math.exp(k)*c,k=cc.pLength(f),0<k&&(f.x/=k,f.y/=k,f.x*=m,f.y*=m,h.z+=cc.pLength(f)*d)),this.setVertex(e,h);this._dirty=!1}}});cc.lens3D=function(a,b,c,d){return new cc.Lens3D(a,b,c,d)};cc.Lens3D.create=cc.lens3D;
cc.Ripple3D=cc.Grid3DAction.extend({_position:null,_radius:0,_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d,e,f){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==f&&this.initWithDuration(a,b,c,d,e,f)},getPosition:function(){return 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,b,c,d,e,f){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._radius=d,this._waves=e,this._amplitude=f,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize.width,c=this._gridSize.height,d=cc.p(0,0),e=this._radius,f=this._waves,h=this._amplitude,k=this._amplitudeRate,m,n,p=cc.p(0,0),r=0;r<b+1;++r)for(var s=0;s<c+1;++s){d.x=r;d.y=s;m=this.originalVertex(d);p.x=
this._position.x-m.x;p.y=this._position.y-m.y;n=cc.pLength(p);if(n<e){n=e-n;var t=Math.pow(n/e,2);m.z+=Math.sin(a*Math.PI*f*2+0.1*n)*h*k*t}this.setVertex(d,m)}}});cc.ripple3D=function(a,b,c,d,e,f){return new cc.Ripple3D(a,b,c,d,e,f)};cc.Ripple3D.create=cc.ripple3D;
cc.Shaky3D=cc.Grid3DAction.extend({_randRange:0,_shakeZ:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this._randRange=c,this._shakeZ=d,!0):!1},update:function(a){a=this._gridSize.width;for(var b=this._gridSize.height,c=this._randRange,d=this._shakeZ,e=cc.p(0,0),f,h=0;h<a+1;++h)for(var k=0;k<b+1;++k)e.x=h,e.y=k,f=this.originalVertex(e),
f.x+=cc.rand()%(2*c)-c,f.y+=cc.rand()%(2*c)-c,d&&(f.z+=cc.rand()%(2*c)-c),this.setVertex(e,f)}});cc.shaky3D=function(a,b,c,d){return new cc.Shaky3D(a,b,c,d)};cc.Shaky3D.create=cc.shaky3D;
cc.Liquid=cc.Grid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},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,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this._waves=c,this._amplitude=
d,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize.width,c=this._gridSize.height,d=cc.p(0,0),e=this._waves,f=this._amplitude,h=this._amplitudeRate,k,m=1;m<b;++m)for(var n=1;n<c;++n)d.x=m,d.y=n,k=this.originalVertex(d),k.x+=Math.sin(a*Math.PI*e*2+0.01*k.x)*f*h,k.y+=Math.sin(a*Math.PI*e*2+0.01*k.y)*f*h,this.setVertex(d,k)}});cc.liquid=function(a,b,c,d){return new cc.Liquid(a,b,c,d)};cc.Liquid.create=cc.liquid;
cc.Waves=cc.Grid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,_vertical:!1,_horizontal:!1,ctor:function(a,b,c,d,e,f){cc.GridAction.prototype.ctor.call(this);void 0!==f&&this.initWithDuration(a,b,c,d,e,f)},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,b,c,d,e,f){return cc.Grid3DAction.prototype.initWithDuration.call(this,
a,b)?(this._waves=c,this._amplitude=d,this._amplitudeRate=1,this._horizontal=e,this._vertical=f,!0):!1},update:function(a){for(var b=this._gridSize.width,c=this._gridSize.height,d=cc.p(0,0),e=this._vertical,f=this._horizontal,h=this._waves,k=this._amplitude,m=this._amplitudeRate,n,p=0;p<b+1;++p)for(var r=0;r<c+1;++r)d.x=p,d.y=r,n=this.originalVertex(d),e&&(n.x+=Math.sin(a*Math.PI*h*2+0.01*n.y)*k*m),f&&(n.y+=Math.sin(a*Math.PI*h*2+0.01*n.x)*k*m),this.setVertex(d,n)}});
cc.waves=function(a,b,c,d,e,f){return new cc.Waves(a,b,c,d,e,f)};cc.Waves.create=cc.waves;
cc.Twirl=cc.Grid3DAction.extend({_position:null,_twirls:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d,e){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==e&&this.initWithDuration(a,b,c,d,e)},getPosition:function(){return 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,b,c,d,e){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._twirls=d,this._amplitude=e,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._position,c=this._gridSize.width,d=this._gridSize.height,e=cc.p(0,0),f=0.1*this._amplitude*this._amplitudeRate,h=this._twirls,k,m,n,p=cc.p(0,0),r=0;r<c+1;++r)for(var s=0;s<d+1;++s)e.x=r,e.y=s,k=this.originalVertex(e),p.x=r-c/2,p.y=s-d/2,m=cc.pLength(p)*Math.cos(Math.PI/2+a*Math.PI*
h*2)*f,n=Math.sin(m)*(k.y-b.y)+Math.cos(m)*(k.x-b.x),m=Math.cos(m)*(k.y-b.y)-Math.sin(m)*(k.x-b.x),k.x=b.x+n,k.y=b.y+m,this.setVertex(e,k)}});cc.twirl=function(a,b,c,d,e){return new cc.Twirl(a,b,c,d,e)};cc.Twirl.create=cc.twirl;cc.ShakyTiles3D=cc.TiledGrid3DAction.extend({_randRange:0,_shakeZ:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._randRange=c,this._shakeZ=d,!0):!1},update:function(a){a=this._gridSize;for(var b=this._randRange,c=cc.p(0,0),d=0;d<a.width;++d)for(var e=0;e<a.height;++e){c.x=d;c.y=e;var f=this.originalTile(c);f.bl.x+=cc.rand()%(2*
b)-b;f.br.x+=cc.rand()%(2*b)-b;f.tl.x+=cc.rand()%(2*b)-b;f.tr.x+=cc.rand()%(2*b)-b;f.bl.y+=cc.rand()%(2*b)-b;f.br.y+=cc.rand()%(2*b)-b;f.tl.y+=cc.rand()%(2*b)-b;f.tr.y+=cc.rand()%(2*b)-b;this._shakeZ&&(f.bl.z+=cc.rand()%(2*b)-b,f.br.z+=cc.rand()%(2*b)-b,f.tl.z+=cc.rand()%(2*b)-b,f.tr.z+=cc.rand()%(2*b)-b);this.setTile(c,f)}}});cc.shakyTiles3D=function(a,b,c,d){return new cc.ShakyTiles3D(a,b,c,d)};cc.ShakyTiles3D.create=cc.shakyTiles3D;
cc.ShatteredTiles3D=cc.TiledGrid3DAction.extend({_randRange:0,_once:!1,_shatterZ:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._once=!1,this._randRange=c,this._shatterZ=d,!0):!1},update:function(a){if(!1===this._once){a=this._gridSize;for(var b=this._randRange,c,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,c=this.originalTile(d),c.bl.x+=cc.rand()%(2*b)-b,c.br.x+=cc.rand()%(2*b)-b,c.tl.x+=cc.rand()%(2*b)-b,c.tr.x+=cc.rand()%(2*b)-b,c.bl.y+=cc.rand()%(2*b)-b,c.br.y+=cc.rand()%(2*b)-b,c.tl.y+=cc.rand()%(2*b)-b,c.tr.y+=cc.rand()%(2*b)-b,this._shatterZ&&(c.bl.z+=cc.rand()%(2*b)-b,c.br.z+=cc.rand()%(2*b)-b,c.tl.z+=cc.rand()%(2*b)-b,c.tr.z+=cc.rand()%(2*b)-b),this.setTile(d,c);this._once=!0}}});cc.shatteredTiles3D=function(a,b,c,d){return new cc.ShatteredTiles3D(a,b,c,d)};
cc.ShatteredTiles3D.create=cc.shatteredTiles3D;cc.Tile=function(a,b,c){this.position=a||cc.p(0,0);this.startPosition=b||cc.p(0,0);this.delta=c||cc.p(0,0)};
cc.ShuffleTiles=cc.TiledGrid3DAction.extend({_seed:0,_tilesCount:0,_tilesOrder:null,_tiles:null,ctor:function(a,b,c){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];this._tiles=[];void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._seed=c,this._tilesOrder.length=0,this._tiles.length=0,!0):!1},shuffle:function(a,b){for(var c=b-1;0<=c;c--){var d=0|cc.rand()%(c+1),e=a[c];a[c]=a[d];a[d]=e}},
getDelta:function(a){var b=this._gridSize,c=a.width*b.height+a.height;return cc.size(this._tilesOrder[c]/b.height-a.width,this._tilesOrder[c]%b.height-a.height)},placeTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep(),e=b.position;c.bl.x+=e.x*d.x;c.bl.y+=e.y*d.y;c.br.x+=e.x*d.x;c.br.y+=e.y*d.y;c.tl.x+=e.x*d.x;c.tl.y+=e.y*d.y;c.tr.x+=e.x*d.x;c.tr.y+=e.y*d.y;this.setTile(a,c)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);a=this._gridSize;
this._tilesCount=a.width*a.height;for(var b=this._tilesOrder,c=b.length=0;c<this._tilesCount;++c)b[c]=c;this.shuffle(b,this._tilesCount);for(var b=this._tiles,c=b.length=0,d=cc.size(0,0),e=0;e<a.width;++e)for(var f=0;f<a.height;++f)b[c]=new cc.Tile,b[c].position=cc.p(e,f),b[c].startPosition=cc.p(e,f),d.width=e,d.height=f,b[c].delta=this.getDelta(d),++c},update:function(a){for(var b=0,c=this._gridSize,d=this._tiles,e,f=cc.p(0,0),h=0;h<c.width;++h)for(var k=0;k<c.height;++k)f.x=h,f.y=k,e=d[b],e.position.x=
e.delta.width*a,e.position.y=e.delta.height*a,this.placeTile(f,e),++b}});cc.shuffleTiles=function(a,b,c){return new cc.ShuffleTiles(a,b,c)};cc.ShuffleTiles.create=cc.shuffleTiles;
cc.FadeOutTRTiles=cc.TiledGrid3DAction.extend({testFunc:function(a,b){var c=this._gridSize.width*b,d=this._gridSize.height*b;return c===this._gridSize.width&&d===this._gridSize.height?0:0===c+d?1:Math.pow((a.x+a.y)/(c+d),6)},turnOnTile:function(a){this.setTile(a,this.originalTile(a))},turnOffTile:function(a){this.setTile(a,new cc.Quad3)},transformTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep();c.bl.x+=d.x/2*(1-b);c.bl.y+=d.y/2*(1-b);c.br.x-=d.x/2*(1-b);c.br.y+=d.y/2*(1-
b);c.tl.x+=d.x/2*(1-b);c.tl.y-=d.y/2*(1-b);c.tr.x-=d.x/2*(1-b);c.tr.y-=d.y/2*(1-b);this.setTile(a,c)},update:function(a){for(var b=this._gridSize,c=cc.p(0,0),d,e=0;e<b.width;++e)for(var f=0;f<b.height;++f)c.x=e,c.y=f,d=this.testFunc(c,a),0===d?this.turnOffTile(c):1>d?this.transformTile(c,d):this.turnOnTile(c)}});cc.fadeOutTRTiles=function(a,b){return new cc.FadeOutTRTiles(a,b)};cc.FadeOutTRTiles.create=cc.fadeOutTRTiles;
cc.FadeOutBLTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){var c=this._gridSize.width*(1-b),d=this._gridSize.height*(1-b);return 0===c+d?0:0===a.x+a.y?1:Math.pow((c+d)/(a.x+a.y),6)}});cc.fadeOutBLTiles=function(a,b){return new cc.FadeOutBLTiles(a,b)};cc.FadeOutBLTiles.create=cc.fadeOutBLTiles;
cc.FadeOutUpTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){var c=this._gridSize.height*b;return c===this._gridSize.height?0:0===c?1:Math.pow(a.y/c,6)},transformTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep();c.bl.y+=d.y/2*(1-b);c.br.y+=d.y/2*(1-b);c.tl.y-=d.y/2*(1-b);c.tr.y-=d.y/2*(1-b);this.setTile(a,c)}});cc.fadeOutUpTiles=function(a,b){return new cc.FadeOutUpTiles(a,b)};cc.FadeOutUpTiles.create=cc.fadeOutUpTiles;
cc.FadeOutDownTiles=cc.FadeOutUpTiles.extend({testFunc:function(a,b){var c=this._gridSize.height*(1-b);return 0===c?0:0===a.y?1:Math.pow(c/a.y,6)}});cc.fadeOutDownTiles=function(a,b){return new cc.FadeOutDownTiles(a,b)};cc.FadeOutDownTiles.create=cc.fadeOutDownTiles;
cc.TurnOffTiles=cc.TiledGrid3DAction.extend({_seed:null,_tilesCount:0,_tilesOrder:null,ctor:function(a,b,c){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._seed=c||0,this._tilesOrder.length=0,!0):!1},shuffle:function(a,b){for(var c=b-1;0<=c;c--){var d=0|cc.rand()%(c+1),e=a[c];a[c]=a[d];a[d]=e}},turnOnTile:function(a){this.setTile(a,this.originalTile(a))},
turnOffTile:function(a){this.setTile(a,new cc.Quad3)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._tilesCount=this._gridSize.width*this._gridSize.height;a=this._tilesOrder;for(var b=a.length=0;b<this._tilesCount;++b)a[b]=b;this.shuffle(a,this._tilesCount)},update:function(a){a=0|a*this._tilesCount;for(var b=this._gridSize,c,d=cc.p(0,0),e=this._tilesOrder,f=0;f<this._tilesCount;f++)c=e[f],d.x=0|c/b.height,d.y=c%(0|b.height),f<a?this.turnOffTile(d):this.turnOnTile(d)}});
cc.turnOffTiles=function(a,b,c){return new cc.TurnOffTiles(a,b,c)};cc.TurnOffTiles.create=cc.turnOffTiles;
cc.WavesTiles3D=cc.TiledGrid3DAction.extend({_waves:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},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,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._waves=
c,this._amplitude=d,this._amplitudeRate=1,!0):!1},update:function(a){for(var b=this._gridSize,c=this._waves,d=this._amplitude,e=this._amplitudeRate,f=cc.p(0,0),h,k=0;k<b.width;k++)for(var m=0;m<b.height;m++)f.x=k,f.y=m,h=this.originalTile(f),h.bl.z=Math.sin(a*Math.PI*c*2+0.01*(h.bl.y+h.bl.x))*d*e,h.br.z=h.bl.z,h.tl.z=h.bl.z,h.tr.z=h.bl.z,this.setTile(f,h)}});cc.wavesTiles3D=function(a,b,c,d){return new cc.WavesTiles3D(a,b,c,d)};cc.WavesTiles3D.create=cc.wavesTiles3D;
cc.JumpTiles3D=cc.TiledGrid3DAction.extend({_jumps:0,_amplitude:0,_amplitudeRate:0,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},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,b,c,d){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._jumps=
c,this._amplitude=d,this._amplitudeRate=1,!0):!1},update:function(a){var b=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 c=this._gridSize,d=this.target.grid,e,f=cc.p(0,0),h=0;h<c.width;h++)for(var k=0;k<c.height;k++)f.x=h,f.y=k,e=d.originalTile(f),0===(h+k)%2?(e.bl.z+=b,e.br.z+=b,e.tl.z+=b,e.tr.z+=b):(e.bl.z+=a,e.br.z+=a,e.tl.z+=a,e.tr.z+=a),d.setTile(f,e)}});
cc.jumpTiles3D=function(a,b,c,d){return new cc.JumpTiles3D(a,b,c,d)};cc.JumpTiles3D.create=cc.jumpTiles3D;
cc.SplitRows=cc.TiledGrid3DAction.extend({_rows:0,_winSize:null,ctor:function(a,b){cc.GridAction.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){this._rows=b;return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,cc.size(1,b))},update:function(a){for(var b=this._gridSize,c=this._winSize.width,d,e,f=cc.p(0,0),h=0;h<b.height;++h)f.y=h,d=this.originalTile(f),e=1,0===h%2&&(e=-1),d.bl.x+=e*c*a,d.br.x+=e*c*a,d.tl.x+=e*c*a,d.tr.x+=e*c*a,this.setTile(f,
d)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._winSize=cc.director.getWinSizeInPixels()}});cc.splitRows=function(a,b){return new cc.SplitRows(a,b)};cc.SplitRows.create=cc.splitRows;
cc.SplitCols=cc.TiledGrid3DAction.extend({_cols:0,_winSize:null,ctor:function(a,b){cc.GridAction.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){this._cols=b;return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,cc.size(b,1))},update:function(a){for(var b=this._gridSize.width,c=this._winSize.height,d,e,f=cc.p(0,0),h=0;h<b;++h)f.x=h,d=this.originalTile(f),e=1,0===h%2&&(e=-1),d.bl.y+=e*c*a,d.br.y+=e*c*a,d.tl.y+=e*c*a,d.tr.y+=e*c*a,this.setTile(f,
d);cc.renderer.childrenOrderDirty=!0},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._winSize=cc.director.getWinSizeInPixels()}});cc.splitCols=function(a,b){return new cc.SplitCols(a,b)};cc.SplitCols.create=cc.splitCols;cc.PageTurn3D=cc.Grid3DAction.extend({getGrid:function(){var a=new cc.Grid3D(this._gridSize,void 0,void 0,this._gridNodeTarget.getGridRect());a.setNeedDepthTestForBlit(!0);return a},clone:function(){var a=new cc.PageTurn3D;a.initWithDuration(this._duration,this._gridSize);return a},update:function(a){var b=Math.max(0,a-0.25),b=-100-b*b*500,c=Math.sqrt(a),d=0.5<c?Math.PI/2*c:Math.PI/2*(1-c);a=(2-a)*Math.PI;for(var c=Math.sin(d),d=Math.cos(d),e=this._gridSize,f=cc.p(0,0),h=0;h<=e.width;++h)for(var k=
0;k<=e.height;++k){f.x=h;f.y=k;var m=this.getOriginalVertex(f);m.x-=this.getGridRect().x;var n=Math.sqrt(m.x*m.x+(m.y-b)*(m.y-b)),p=n*c,r=Math.asin(m.x/n)/c,s=Math.cos(r);m.x=r<=Math.PI?p*Math.sin(r):0;m.y=n+b-p*(1-s)*c;m.z=p*(1-s)*d;m.x=m.z*Math.sin(a)+m.x*Math.cos(a);m.z=m.z*Math.cos(a)-m.x*Math.cos(a);m.z/=7;0.5>m.z&&(m.z=0.5);m.x+=this.getGridRect().x;this.setVertex(f,m)}}});cc.pageTurn3D=function(a,b){return new cc.PageTurn3D(a,b)};cc.PageTurn3D.create=cc.pageTurn3D;cc.ProgressTimer=cc.Node.extend({_type:null,_percentage:0,_sprite:null,_midPoint:null,_barChangeRate:null,_reverseDirection:!1,_className:"ProgressTimer",ctor:function(a){cc.Node.prototype.ctor.call(this);this._type=cc.ProgressTimer.TYPE_RADIAL;this._percentage=0;this._midPoint=cc.p(0,0);this._barChangeRate=cc.p(0,0);this._reverseDirection=!1;this._sprite=null;a&&this.initWithSprite(a)},onEnter:function(){this._super();cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._renderCmd.initCmd(),this._renderCmd._updateProgress())},
cleanup:function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&this._renderCmd.releaseData();this._super()},getMidpoint:function(){return cc.p(this._midPoint.x,this._midPoint.y)},setMidpoint:function(a){this._midPoint=cc.pClamp(a,cc.p(0,0),cc.p(1,1))},getBarChangeRate:function(){return cc.p(this._barChangeRate.x,this._barChangeRate.y)},setBarChangeRate:function(a){this._barChangeRate=cc.pClamp(a,cc.p(0,0),cc.p(1,1))},getType:function(){return this._type},getPercentage:function(){return this._percentage},
getSprite:function(){return this._sprite},setPercentage:function(a){this._percentage!==a&&(this._percentage=cc.clampf(a,0,100),this._renderCmd._updateProgress())},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isReverseDirection:function(){return this._reverseDirection},setColor:function(a){this._sprite.color=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.colorDirty)},setOpacity:function(a){this._sprite.opacity=a;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.opacityDirty)},
getColor:function(){return this._sprite.color},getOpacity:function(){return this._sprite.opacity},setReverseProgress:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._renderCmd.resetVertexData())},setSprite:function(a){this._sprite!==a&&((this._sprite=a)?(this.setContentSize(a.width,a.height),a.ignoreAnchorPointForPosition(!0)):this.setContentSize(0,0),this._renderCmd.resetVertexData())},setType:function(a){a!==this._type&&(this._type=a,this._renderCmd.resetVertexData())},setReverseDirection:function(a){this._reverseDirection!==
a&&(this._reverseDirection=a,this._renderCmd.resetVertexData())},initWithSprite:function(a){this.percentage=0;this.setAnchorPoint(0.5,0.5);this._type=cc.ProgressTimer.TYPE_RADIAL;this._reverseDirection=!1;this.midPoint=cc.p(0.5,0.5);this.barChangeRate=cc.p(1,1);this.setSprite(a);this._renderCmd.resetVertexData();return!0},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ProgressTimer.CanvasRenderCmd(this):new cc.ProgressTimer.WebGLRenderCmd(this)}});_p=cc.ProgressTimer.prototype;
cc.defineGetterSetter(_p,"midPoint",_p.getMidpoint,_p.setMidpoint);cc.defineGetterSetter(_p,"barChangeRate",_p.getBarChangeRate,_p.setBarChangeRate);cc.defineGetterSetter(_p,"type",_p.getType,_p.setType);cc.defineGetterSetter(_p,"percentage",_p.getPercentage,_p.setPercentage);cc.defineGetterSetter(_p,"sprite",_p.getSprite,_p.setSprite);cc.defineGetterSetter(_p,"reverseDir",_p.isReverseDirection,_p.setReverseDirection);cc.ProgressTimer.create=function(a){return new cc.ProgressTimer(a)};
cc.ProgressTimer.TEXTURE_COORDS_COUNT=4;cc.ProgressTimer.TEXTURE_COORDS=75;cc.ProgressTimer.TYPE_RADIAL=0;cc.ProgressTimer.TYPE_BAR=1;cc.ProgressTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0;void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=b,!0):!1},clone:function(){var a=new cc.ProgressTo;a.initWithDuration(this._duration,this._to);return a},reverse:function(){cc.log("cc.ProgressTo.reverse(): reverse hasn't been supported.");return null},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,
a);this._from=a.percentage},update:function(a){this.target instanceof cc.ProgressTimer&&(this.target.percentage=this._from+(this._to-this._from)*a)}});cc.progressTo=function(a,b){return new cc.ProgressTo(a,b)};cc.ProgressTo.create=cc.progressTo;
cc.ProgressFromTo=cc.ActionInterval.extend({_to:0,_from:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._from=this._to=0;void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=c,this._from=b,!0):!1},clone:function(){var a=new cc.ProgressFromTo;a.initWithDuration(this._duration,this._from,this._to);return a},reverse:function(){return cc.progressFromTo(this._duration,this._to,this._from)},
startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a)},update:function(a){this.target instanceof cc.ProgressTimer&&(this.target.percentage=this._from+(this._to-this._from)*a)}});cc.progressFromTo=function(a,b,c){return new cc.ProgressFromTo(a,b,c)};cc.ProgressFromTo.create=cc.progressFromTo;(function(){cc.ProgressTimer.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._PI180=Math.PI/180;this._barRect=cc.rect(0,0,0,0);this._origin=cc.p(0,0);this._radius=0;this._endAngle=this._startAngle=270;this._counterClockWise=!1;this._canUseDirtyRegion=!0};var a=cc.ProgressTimer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ProgressTimer.CanvasRenderCmd;a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),f=this._node,
h=f._sprite,k=h._renderCmd._textureCoord,m=h._renderCmd._displayedOpacity/255;if(0!==k.width&&0!==k.height&&h._texture&&k.validRect&&0!==m){a.setTransform(this._worldTransform,c,d);a.setCompositeOperation(h._blendFuncStr);a.setGlobalAlpha(m);var n=h._rect,p=h._offsetPosition;c=p.x;d=-p.y-n.height;m=n.width;n=n.height;a.save();h._flippedX&&(c=-c-m,e.scale(-1,1));h._flippedY&&(d=p.y,e.scale(1,-1));f._type===cc.ProgressTimer.TYPE_BAR?(f=this._barRect,e.beginPath(),e.rect(f.x,f.y,f.width,f.height),e.clip(),
e.closePath()):f._type===cc.ProgressTimer.TYPE_RADIAL&&(f=this._origin.x,p=this._origin.y,e.beginPath(),e.arc(f,p,this._radius,this._PI180*this._startAngle,this._PI180*this._endAngle,this._counterClockWise),e.lineTo(f,p),e.clip(),e.closePath());f=(h._renderCmd._textureToRender||h._texture).getHtmlElementObj();h._renderCmd._colorized?e.drawImage(f,0,0,k.width,k.height,c,d,m,n):e.drawImage(f,k.renderX,k.renderY,k.width,k.height,c,d,m,n);a.restore();cc.g_NumberOfDraws++}};a.releaseData=function(){};
a.resetVertexData=function(){};a._updateProgress=function(){this.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);var a=this._node,c=a._sprite,d=c.width,e=c.height,f=a._midPoint;if(a._type===cc.ProgressTimer.TYPE_RADIAL){this._radius=Math.round(Math.sqrt(d*d+e*e));var h,k=!1,m=this._origin;m.x=d*f.x;m.y=-e*f.y;a._reverseDirection?(h=270,f=270-3.6*a._percentage):(f=-90,h=-90+3.6*a._percentage);c._flippedX&&(m.x-=2*d*a._midPoint.x,f=-f-180,h=-h-180,k=!k);c._flippedY&&(m.y+=2*e*a._midPoint.y,k=!k,f=-f,
h=-h);this._startAngle=f;this._endAngle=h;this._counterClockWise=k}else k=a._barChangeRate,m=a._percentage/100,a=this._barRect,k=cc.size(d*(1-k.x),e*(1-k.y)),m=cc.size((d-k.width)*m,(e-k.height)*m),k=cc.size(k.width+m.width,k.height+m.height),h=cc.p(d*f.x,e*f.y),m=h.x-k.width/2,0.5<f.x&&k.width/2>=d-h.x&&(m=d-k.width),d=h.y-k.height/2,0.5<f.y&&k.height/2>=e-h.y&&(d=e-k.height),a.x=0,e=1,c._flippedX&&(a.x-=k.width,e=-1),0<m&&(a.x+=m*e),a.y=0,e=1,c._flippedY&&(a.y+=k.height,e=-1),0<d&&(a.y-=d*e),a.width=
k.width,a.height=-k.height};a._syncStatus=function(a){var c=this._node;if(c._sprite){var d=cc.Node._dirtyFlags,e=this._dirtyFlag,f=a?a._node:null;f&&f._cascadeColorEnabled&&a._dirtyFlag&d.colorDirty&&(e|=d.colorDirty);f&&f._cascadeOpacityEnabled&&a._dirtyFlag&d.opacityDirty&&(e|=d.opacityDirty);a&&a._dirtyFlag&d.transformDirty&&(e|=d.transformDirty);this._dirtyFlag=e;var c=c._sprite._renderCmd,h=c._dirtyFlag,f=h&d.colorDirty,h=h&d.opacityDirty;f&&(c._syncDisplayColor(),c._dirtyFlag&=~d.colorDirty,
this._dirtyFlag&=~d.colorDirty);h&&(c._syncDisplayOpacity(),c._dirtyFlag&=~d.opacityDirty,this._dirtyFlag&=~d.opacityDirty);(f||h)&&c._updateColor();e&d.transformDirty&&this.transform(a);e&d.orderDirty&&(this._dirtyFlag&=~d.orderDirty)}};a.updateStatus=function(){var a=this._node;if(a._sprite){var c=cc.Node._dirtyFlags,d=this._dirtyFlag,a=a._sprite._renderCmd,e=a._dirtyFlag,f=e&c.colorDirty,e=e&c.opacityDirty;f&&(a._updateDisplayColor(),a._dirtyFlag^=a._dirtyFlag&c.colorDirty,this._dirtyFlag^=this._dirtyFlag&
c.colorDirty);e&&(a._updateDisplayOpacity(),a._dirtyFlag^=a._dirtyFlag&c.opacityDirty,this._dirtyFlag^=this._dirtyFlag&c.opacityDirty);(f||e)&&a._updateColor();d&c.transformDirty&&this.transform(this.getParentRenderCmd(),!0);d&c.contentDirty&&this._notifyRegionStatus&&this._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty);this._dirtyFlag=0}}})();(function(){cc.ProgressTimer.WebGLRenderCmd=function(a){this._rootCtor(a);this._progressDirty=this._needDraw=!0;this._bl=cc.p();this._tr=cc.p();this._transformUpdating=!1;this.initCmd()};var a=cc.ProgressTimer.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ProgressTimer.WebGLRenderCmd;a.transform=function(a,c){this.originTransform(a,c);var d=this._node._sprite;d._renderCmd.transform(this,c);var e=d._offsetPosition.x,f=e+d._rect.width,h=d._offsetPosition.y,
d=h+d._rect.height,k=this._worldTransform;this._bl.x=e*k.a+h*k.c+k.tx;this._bl.y=e*k.b+h*k.d+k.ty;this._tr.x=f*k.a+d*k.c+k.tx;this._tr.y=f*k.b+d*k.d+k.ty;this._transformUpdating=!0;this._updateProgressData();this._transformUpdating=!1};a.rendering=function(a){var c=this._node;a=a||cc._renderContext;if(0!==this._vertexDataCount&&c._sprite){this._glProgramState.apply();this._shaderProgram._updateProjectionUniform();var d=c._sprite._blendFunc;cc.glBlendFunc(d.src,d.dst);cc.glBindTexture2D(c._sprite.texture);
a.bindBuffer(a.ARRAY_BUFFER,this._vertexWebGLBuffer);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);this._vertexDataDirty&&(a.bufferSubData(a.ARRAY_BUFFER,0,this._float32View),this._vertexDataDirty=!1);d=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,d,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,d,12);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,
2,a.FLOAT,!1,d,16);c._type===cc.ProgressTimer.TYPE_RADIAL?a.drawArrays(a.TRIANGLE_FAN,0,this._vertexDataCount):c._type===cc.ProgressTimer.TYPE_BAR&&(c._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++}};a._syncStatus=function(a){var c=this._node;if(c._sprite){var d=cc.Node._dirtyFlags,e=this._dirtyFlag,f=a?a._node:null;
f&&f._cascadeColorEnabled&&a._dirtyFlag&d.colorDirty&&(e|=d.colorDirty);f&&f._cascadeOpacityEnabled&&a._dirtyFlag&d.opacityDirty&&(e|=d.opacityDirty);a&&a._dirtyFlag&d.transformDirty&&(e|=d.transformDirty);this._dirtyFlag=e;var c=c._sprite._renderCmd,h=c._dirtyFlag,f=(e|h)&d.colorDirty,h=(e|h)&d.opacityDirty;f&&(c._syncDisplayColor(),c._dirtyFlag&=~d.colorDirty,this._dirtyFlag&=~d.colorDirty);h&&(c._syncDisplayOpacity(),c._dirtyFlag&=~d.opacityDirty,this._dirtyFlag&=~d.opacityDirty);(f||h)&&this._updateColor();
e&d.transformDirty&&this.transform(a);e&d.textureDirty&&(this._updateProgressData(),this._dirtyFlag&=~d.textureDirty);c._dirtyFlag=0}};a.updateStatus=function(){var a=this._node;if(a._sprite){var c=cc.Node._dirtyFlags,d=this._dirtyFlag,a=a._sprite._renderCmd,e=a._dirtyFlag,f=(d|e)&c.colorDirty,e=(d|e)&c.opacityDirty;f&&(a._updateDisplayColor(),a._dirtyFlag^=a._dirtyFlag&c.colorDirty,this._dirtyFlag^=this._dirtyFlag&c.colorDirty);e&&(a._updateDisplayOpacity(),a._dirtyFlag^=a._dirtyFlag&c.opacityDirty,
this._dirtyFlag^=this._dirtyFlag&c.opacityDirty);(f||e)&&this._updateColor();d&c.transformDirty&&this.transform(this.getParentRenderCmd(),!0);d&c.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&c.orderDirty);d&c.textureDirty&&(this._updateProgressData(),this._dirtyFlag^=this._dirtyFlag&c.textureDirty)}};a.releaseData=function(){if(this._vertexData){var a=this._vertexWebGLBuffer;setTimeout(function(){cc._renderContext.deleteBuffer(a)},0.1);this._vertexArrayBuffer=this._float32View=this._vertexData=this._vertexWebGLBuffer=
null;this._vertexDataCount=0}};a.initCmd=function(){if(!this._vertexData){this._vertexWebGLBuffer=cc._renderContext.createBuffer();var a=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._vertexArrayBuffer=new ArrayBuffer(8*a);this._float32View=new Float32Array(this._vertexArrayBuffer);this._vertexData=[];for(var c=0;8>c;c++)this._vertexData[c]=new cc.V3F_C4B_T2F(null,null,null,this._vertexArrayBuffer,c*a);gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexWebGLBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._float32View,
gl.DYNAMIC_DRAW);this._vertexDataCount=0;this._vertexDataDirty=!0;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)}};a.resetVertexData=function(){this._vertexDataCount=0};a._updateProgressData=function(){var a=this._node._type;a===cc.ProgressTimer.TYPE_RADIAL?this._updateRadial():a===cc.ProgressTimer.TYPE_BAR&&this._updateBar();this._vertexDataDirty=!0};a._updateProgress=function(){this.setDirtyFlag(cc.Node._dirtyFlags.textureDirty)};a._updateBar=function(){var a=
this._node;if(a._sprite){var c=a._percentage/100,d=a._barChangeRate,d=cc.pMult(cc.p(1-d.x+c*d.x,1-d.y+c*d.y),0.5),c=cc.pSub(a._midPoint,d),a=cc.pAdd(a._midPoint,d);0>c.x&&(a.x+=-c.x,c.x=0);1<a.x&&(c.x-=a.x-1,a.x=1);0>c.y&&(a.y+=-c.y,c.y=0);1<a.y&&(c.y-=a.y-1,a.y=1);this._reverseDirection?(d=this._vertexData,this._vertexDataCount||(this._vertexDataCount=8,this._textureCoordFromAlphaPoint(d[0].texCoords,0,1),this._vertexFromAlphaPoint(d[0].vertices,0,1),this._textureCoordFromAlphaPoint(d[1].texCoords,
0,0),this._vertexFromAlphaPoint(d[1].vertices,0,0),this._textureCoordFromAlphaPoint(d[6].texCoords,1,1),this._vertexFromAlphaPoint(d[6].vertices,1,1),this._textureCoordFromAlphaPoint(d[7].texCoords,1,0),this._vertexFromAlphaPoint(d[7].vertices,1,0)),this._textureCoordFromAlphaPoint(d[2].texCoords,c.x,a.y),this._vertexFromAlphaPoint(d[2].vertices,c.x,a.y),this._textureCoordFromAlphaPoint(d[3].texCoords,c.x,c.y),this._vertexFromAlphaPoint(d[3].vertices,c.x,c.y),this._textureCoordFromAlphaPoint(d[4].texCoords,
a.x,a.y),this._vertexFromAlphaPoint(d[4].vertices,a.x,a.y),this._textureCoordFromAlphaPoint(d[5].texCoords,a.x,c.y),this._vertexFromAlphaPoint(d[5].vertices,a.x,c.y)):(this._vertexDataCount||(this._vertexDataCount=4),d=this._vertexData,this._textureCoordFromAlphaPoint(d[0].texCoords,c.x,a.y),this._vertexFromAlphaPoint(d[0].vertices,c.x,a.y),this._textureCoordFromAlphaPoint(d[1].texCoords,c.x,c.y),this._vertexFromAlphaPoint(d[1].vertices,c.x,c.y),this._textureCoordFromAlphaPoint(d[2].texCoords,a.x,
a.y),this._vertexFromAlphaPoint(d[2].vertices,a.x,a.y),this._textureCoordFromAlphaPoint(d[3].texCoords,a.x,c.y),this._vertexFromAlphaPoint(d[3].vertices,a.x,c.y));this._updateColor()}};a._updateRadial=function(){var a=this._node;if(a._sprite){var c,d=a._midPoint;c=a._percentage/100;var e=2*cc.PI*(a._reverseDirection?c:1-c),a=cc.p(d.x,1),f=cc.pRotateByAngle(a,d,e),e=0;if(0===c)f=a,e=0;else if(1===c)f=a,e=4;else{var h=cc.FLT_MAX,k=cc.ProgressTimer.TEXTURE_COORDS_COUNT;for(c=0;c<=k;++c){var m=(c+(k-
1))%k,n=this._boundaryTexCoord(c%k),m=this._boundaryTexCoord(m);0===c?m=cc.pLerp(n,m,1-d.x):4===c&&(n=cc.pLerp(n,m,1-d.x));var p=cc.p(0,0);cc.pLineIntersect(n,m,d,f,p)&&(0!==c&&4!==c||0<=p.x&&1>=p.x)&&0<=p.y&&p.y<h&&(h=p.y,e=c)}f=cc.pAdd(d,cc.pMult(cc.pSub(f,d),h))}c=!0;this._vertexDataCount!==e+3&&(c=!1,this._vertexDataCount=e+3);this._updateColor();h=this._vertexData;if(this._transformUpdating||!c)for(this._textureCoordFromAlphaPoint(h[0].texCoords,d.x,d.y),this._vertexFromAlphaPoint(h[0].vertices,
d.x,d.y),this._textureCoordFromAlphaPoint(h[1].texCoords,a.x,a.y),this._vertexFromAlphaPoint(h[1].vertices,a.x,a.y),c=0;c<e;c++)d=this._boundaryTexCoord(c),this._textureCoordFromAlphaPoint(h[c+2].texCoords,d.x,d.y),this._vertexFromAlphaPoint(h[c+2].vertices,d.x,d.y);this._textureCoordFromAlphaPoint(h[this._vertexDataCount-1].texCoords,f.x,f.y);this._vertexFromAlphaPoint(h[this._vertexDataCount-1].vertices,f.x,f.y)}};a._boundaryTexCoord=function(a){if(a<cc.ProgressTimer.TEXTURE_COORDS_COUNT){var c=
cc.ProgressTimer.TEXTURE_COORDS;return this._node._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.p(0,0)};a._textureCoordFromAlphaPoint=function(a,c,d){var e=this._node._sprite;if(e){var f=e._renderCmd._vertices,h=f[1],f=f[2],h=cc.p(h.u,h.v),f=cc.p(f.u,f.v);e.textureRectRotated&&(e=c,c=d,d=e);a.u=h.x*(1-c)+f.x*c;a.v=h.y*(1-d)+f.y*d}else a.u=0,a.v=0};a._vertexFromAlphaPoint=function(a,c,d){a.x=this._bl.x*(1-c)+this._tr.x*c;a.y=this._bl.y*(1-d)+this._tr.y*
d;a.z=this._node._vertexZ};a._updateColor=function(){var a=this._node._sprite;if(this._vertexDataCount&&a){var c=this._displayedColor,d=a._renderCmd._displayedColor,e=d.r,f=d.g,d=d.b,h=a._renderCmd._displayedOpacity/255;a._opacityModifyRGB&&(e*=h,f*=h,d*=h);c.r=e;c.g=f;c.b=d;c.a=a._renderCmd._displayedOpacity;a=this._vertexData;e=0;for(f=this._vertexDataCount;e<f;++e)a[e].colors=c;this._vertexDataDirty=!0}}})();cc.SCENE_FADE=4208917214;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,_className:"TransitionScene",ctor:function(a,b){cc.Scene.prototype.ctor.call(this);void 0!==a&&void 0!==b&&this.initWithDuration(a,b)},_setNewScene:function(a){this.unschedule(this._setNewScene);a=cc.director;this._isSendCleanupToScene=a.isSendCleanupToScene();a.runScene(this._inScene);cc.eventManager.setEnabled(!0);this._outScene.visible=!0},_sceneOrder:function(){this._isInSceneOnTop=
!0},visit:function(){this._isInSceneOnTop?(this._outScene.visit(),this._inScene.visit()):(this._inScene.visit(),this._outScene.visit());cc.Node.prototype.visit.call(this)},onEnter:function(){cc.Node.prototype.onEnter.call(this);cc.eventManager.setEnabled(!1);this._outScene._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart);this._inScene._performRecursive(cc.Node._stateCallbackType.onEnter)},onExit:function(){cc.Node.prototype.onExit.call(this);cc.eventManager.setEnabled(!0);this._outScene._performRecursive(cc.Node._stateCallbackType.onExit);
this._inScene._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)},cleanup:function(){cc.Node.prototype.cleanup.call(this);this._isSendCleanupToScene&&this._outScene._performRecursive(cc.Node._stateCallbackType.cleanup)},initWithDuration:function(a,b){if(!b)throw Error("cc.TransitionScene.initWithDuration(): Argument scene must be non-nil");if(this.init()){this._duration=a;this.attr({x:0,y:0,anchorX:0,anchorY:0});this._inScene=b;this._outScene=cc.director.getRunningScene();this._outScene||
(this._outScene=new cc.Scene,this._outScene.init());if(this._inScene===this._outScene)throw Error("cc.TransitionScene.initWithDuration(): Incoming scene must be different from the outgoing scene");this._sceneOrder();return!0}return!1},finish:function(){this._inScene.attr({visible:!0,x:0,y:0,scale:1,rotation:0});this._outScene.attr({visible:!1,x:0,y:0,scale:1,rotation:0});this.schedule(this._setNewScene,0)},hideOutShowIn:function(){this._inScene.visible=!0;this._outScene.visible=!1}});
cc.TransitionScene.create=function(a,b){return new cc.TransitionScene(a,b)};cc.TransitionSceneOriented=cc.TransitionScene.extend({_orientation:0,ctor:function(a,b,c){cc.TransitionScene.prototype.ctor.call(this);void 0!=c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){cc.TransitionScene.prototype.initWithDuration.call(this,a,b)&&(this._orientation=c);return!0}});cc.TransitionSceneOriented.create=function(a,b,c){return new cc.TransitionSceneOriented(a,b,c)};
cc.TransitionRotoZoom=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._inScene.attr({scale:0.001,anchorX:0.5,anchorY:0.5});this._outScene.attr({scale:1,anchorX:0.5,anchorY:0.5});var a=cc.sequence(cc.spawn(cc.scaleBy(this._duration/2,0.001),cc.rotateBy(this._duration/2,720)),cc.delayTime(this._duration/2));this._outScene.runAction(a);this._inScene.runAction(cc.sequence(a.reverse(),
cc.callFunc(this.finish,this)))}});cc.TransitionRotoZoom.create=function(a,b){return new cc.TransitionRotoZoom(a,b)};
cc.TransitionJumpZoom=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.director.getWinSize();this._inScene.attr({scale:0.5,x:a.width,y:0,anchorX:0.5,anchorY:0.5});this._outScene.anchorX=0.5;this._outScene.anchorY=0.5;var b=cc.jumpBy(this._duration/4,cc.p(-a.width,0),a.width/4,2),c=cc.scaleTo(this._duration/4,1),a=cc.scaleTo(this._duration/4,0.5),a=cc.sequence(a,
b),b=cc.sequence(b,c),c=cc.delayTime(this._duration/2);this._outScene.runAction(a);this._inScene.runAction(cc.sequence(c,b,cc.callFunc(this.finish,this)))}});cc.TransitionJumpZoom.create=function(a,b){return new cc.TransitionJumpZoom(a,b)};
cc.TransitionMoveInL=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this.initScenes();var a=this.action();this._inScene.runAction(cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this)))},initScenes:function(){this._inScene.setPosition(-cc.director.getWinSize().width,0)},action:function(){return cc.moveTo(this._duration,cc.p(0,0))},easeActionWithAction:function(a){return new cc.EaseOut(a,
2)}});cc.TransitionMoveInL.create=function(a,b){return new cc.TransitionMoveInL(a,b)};cc.TransitionMoveInR=cc.TransitionMoveInL.extend({ctor:function(a,b){cc.TransitionMoveInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initScenes:function(){this._inScene.setPosition(cc.director.getWinSize().width,0)}});cc.TransitionMoveInR.create=function(a,b){return new cc.TransitionMoveInR(a,b)};
cc.TransitionMoveInT=cc.TransitionMoveInL.extend({ctor:function(a,b){cc.TransitionMoveInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initScenes:function(){this._inScene.setPosition(0,cc.director.getWinSize().height)}});cc.TransitionMoveInT.create=function(a,b){return new cc.TransitionMoveInT(a,b)};
cc.TransitionMoveInB=cc.TransitionMoveInL.extend({ctor:function(a,b){cc.TransitionMoveInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},initScenes:function(){this._inScene.setPosition(0,-cc.director.getWinSize().height)}});cc.TransitionMoveInB.create=function(a,b){return new cc.TransitionMoveInB(a,b)};cc.ADJUST_FACTOR=0.5;
cc.TransitionSlideInL=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this.initScenes();var a=this.action(),b=this.action(),a=cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this)),b=this.easeActionWithAction(b);this._inScene.runAction(a);this._outScene.runAction(b)},initScenes:function(){this._inScene.setPosition(-cc.director.getWinSize().width+
cc.ADJUST_FACTOR,0)},action:function(){return cc.moveBy(this._duration,cc.p(cc.director.getWinSize().width-cc.ADJUST_FACTOR,0))},easeActionWithAction:function(a){return new cc.EaseInOut(a,2)}});cc.TransitionSlideInL.create=function(a,b){return new cc.TransitionSlideInL(a,b)};
cc.TransitionSlideInR=cc.TransitionSlideInL.extend({ctor:function(a,b){cc.TransitionSlideInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!0},initScenes:function(){this._inScene.setPosition(cc.director.getWinSize().width-cc.ADJUST_FACTOR,0)},action:function(){return cc.moveBy(this._duration,cc.p(-(cc.director.getWinSize().width-cc.ADJUST_FACTOR),0))}});cc.TransitionSlideInR.create=function(a,b){return new cc.TransitionSlideInR(a,b)};
cc.TransitionSlideInB=cc.TransitionSlideInL.extend({ctor:function(a,b){cc.TransitionSlideInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},initScenes:function(){this._inScene.setPosition(0,-(cc.director.getWinSize().height-cc.ADJUST_FACTOR))},action:function(){return cc.moveBy(this._duration,cc.p(0,cc.director.getWinSize().height-cc.ADJUST_FACTOR))}});cc.TransitionSlideInB.create=function(a,b){return new cc.TransitionSlideInB(a,b)};
cc.TransitionSlideInT=cc.TransitionSlideInL.extend({ctor:function(a,b){cc.TransitionSlideInL.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!0},initScenes:function(){this._inScene.setPosition(0,cc.director.getWinSize().height-cc.ADJUST_FACTOR)},action:function(){return cc.moveBy(this._duration,cc.p(0,-(cc.director.getWinSize().height-cc.ADJUST_FACTOR)))}});cc.TransitionSlideInT.create=function(a,b){return new cc.TransitionSlideInT(a,b)};
cc.TransitionShrinkGrow=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._inScene.attr({scale:0.001,anchorX:2/3,anchorY:0.5});this._outScene.attr({scale:1,anchorX:1/3,anchorY:0.5});var a=cc.scaleTo(this._duration,0.01),b=cc.scaleTo(this._duration,1);this._inScene.runAction(cc.sequence(this.easeActionWithAction(b),cc.callFunc(this.finish,this)));this._outScene.runAction(this.easeActionWithAction(a))},
easeActionWithAction:function(a){return new cc.EaseOut(a,2)}});cc.TransitionShrinkGrow.create=function(a,b){return new cc.TransitionShrinkGrow(a,b)};
cc.TransitionFade=cc.TransitionScene.extend({_color:null,ctor:function(a,b,c){cc.TransitionScene.prototype.ctor.call(this);this._color=cc.color();b&&this.initWithDuration(a,b,c)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=new cc.LayerColor(this._color);this._inScene.visible=!1;this.addChild(a,2,cc.SCENE_FADE);var a=this.getChildByTag(cc.SCENE_FADE),b=cc.sequence(cc.fadeIn(this._duration/2),cc.callFunc(this.hideOutShowIn,this),cc.fadeOut(this._duration/2),cc.callFunc(this.finish,
this));a.runAction(b)},onExit:function(){cc.TransitionScene.prototype.onExit.call(this);this.removeChildByTag(cc.SCENE_FADE,!1)},initWithDuration:function(a,b,c){c=c||cc.color.BLACK;cc.TransitionScene.prototype.initWithDuration.call(this,a,b)&&(this._color.r=c.r,this._color.g=c.g,this._color.b=c.b,this._color.a=0);return!0}});cc.TransitionFade.create=function(a,b,c){return new cc.TransitionFade(a,b,c)};
cc.TransitionCrossFade=cc.TransitionScene.extend({ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);var a=cc.color(0,0,0,0),b=cc.director.getWinSize(),a=new cc.LayerColor(a),c=new cc.RenderTexture(b.width,b.height);c.sprite.anchorX=0.5;c.sprite.anchorY=0.5;c.attr({x:b.width/2,y:b.height/2,anchorX:0.5,anchorY:0.5});c.begin();this._inScene.visit();c.end();var d=new cc.RenderTexture(b.width,
b.height);d.setPosition(b.width/2,b.height/2);d.sprite.anchorX=d.anchorX=0.5;d.sprite.anchorY=d.anchorY=0.5;d.begin();this._outScene.visit();d.end();c.sprite.setBlendFunc(cc.ONE,cc.ONE);d.sprite.setBlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA);a.addChild(c);a.addChild(d);c.sprite.opacity=255;d.sprite.opacity=255;b=cc.sequence(cc.fadeTo(this._duration,0),cc.callFunc(this.hideOutShowIn,this),cc.callFunc(this.finish,this));d.sprite.runAction(b);this.addChild(a,2,cc.SCENE_FADE)},onExit:function(){this.removeChildByTag(cc.SCENE_FADE,
!1);cc.TransitionScene.prototype.onExit.call(this)}});cc.TransitionCrossFade.create=function(a,b){return new cc.TransitionCrossFade(a,b)};
cc.TransitionTurnOffTiles=cc.TransitionScene.extend({_gridProxy:null,ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._gridProxy.setTarget(this._outScene);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onEnter);var a=cc.director.getWinSize(),a=cc.turnOffTiles(this._duration,cc.size(0|a.width/
a.height*12,12)),a=this.easeActionWithAction(a);this._gridProxy.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid()))},visit:function(){this._inScene.visit();this._gridProxy.visit()},easeActionWithAction:function(a){return a}});cc.TransitionTurnOffTiles.create=function(a,b){return new cc.TransitionTurnOffTiles(a,b)};
cc.TransitionSplitCols=cc.TransitionScene.extend({_gridProxy:null,_switchTargetToInscene:function(){this._gridProxy.setTarget(this._inScene)},ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;b&&this.initWithDuration(a,b)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._gridProxy.setTarget(this._outScene);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onEnter);var a=this.action(),a=cc.sequence(a,cc.callFunc(this._switchTargetToInscene,
this),a.reverse());this._gridProxy.runAction(cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this),cc.stopGrid()))},onExit:function(){this._gridProxy.setTarget(null);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onExit);cc.TransitionScene.prototype.onExit.call(this)},visit:function(){this._gridProxy.visit()},easeActionWithAction:function(a){return new cc.EaseInOut(a,3)},action:function(){return cc.splitCols(this._duration/2,3)}});
cc.TransitionSplitCols.create=function(a,b){return new cc.TransitionSplitCols(a,b)};cc.TransitionSplitRows=cc.TransitionSplitCols.extend({ctor:function(a,b){cc.TransitionSplitCols.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},action:function(){return cc.splitRows(this._duration/2,3)}});cc.TransitionSplitRows.create=function(a,b){return new cc.TransitionSplitRows(a,b)};
cc.TransitionFadeTR=cc.TransitionScene.extend({_gridProxy:null,ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;b&&this.initWithDuration(a,b)},_sceneOrder:function(){this._isInSceneOnTop=!1},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._gridProxy.setTarget(this._outScene);this._gridProxy._performRecursive(cc.Node._stateCallbackType.onEnter);var a=cc.director.getWinSize(),a=this.actionWithSize(cc.size(0|a.width/a.height*12,12));
this._gridProxy.runAction(cc.sequence(this.easeActionWithAction(a),cc.callFunc(this.finish,this),cc.stopGrid()))},visit:function(){this._inScene.visit();this._gridProxy.visit()},easeActionWithAction:function(a){return a},actionWithSize:function(a){return cc.fadeOutTRTiles(this._duration,a)}});cc.TransitionFadeTR.create=function(a,b){return new cc.TransitionFadeTR(a,b)};
cc.TransitionFadeBL=cc.TransitionFadeTR.extend({ctor:function(a,b){cc.TransitionFadeTR.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},actionWithSize:function(a){return cc.fadeOutBLTiles(this._duration,a)}});cc.TransitionFadeBL.create=function(a,b){return new cc.TransitionFadeBL(a,b)};
cc.TransitionFadeUp=cc.TransitionFadeTR.extend({ctor:function(a,b){cc.TransitionFadeTR.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},actionWithSize:function(a){return new cc.FadeOutUpTiles(this._duration,a)}});cc.TransitionFadeUp.create=function(a,b){return new cc.TransitionFadeUp(a,b)};
cc.TransitionFadeDown=cc.TransitionFadeTR.extend({ctor:function(a,b){cc.TransitionFadeTR.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},actionWithSize:function(a){return cc.fadeOutDownTiles(this._duration,a)}});cc.TransitionFadeDown.create=function(a,b){return new cc.TransitionFadeDown(a,b)};cc.SCENE_RADIAL=49153;
cc.TransitionProgress=cc.TransitionScene.extend({_to:0,_from:0,_sceneToBeModified:null,_className:"TransitionProgress",ctor:function(a,b){cc.TransitionScene.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_setAttrs:function(a,b,c){a.attr({x:b,y:c,anchorX:0.5,anchorY:0.5})},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);this._setupTransition();var a=cc.director.getWinSize(),b=new cc.RenderTexture(a.width,a.height);b.sprite.anchorX=0.5;b.sprite.anchorY=0.5;this._setAttrs(b,
a.width/2,a.height/2);b.clear(0,0,0,1);b.begin();this._sceneToBeModified.visit();b.end();this._sceneToBeModified===this._outScene&&this.hideOutShowIn();a=this._progressTimerNodeWithRenderTexture(b);b=cc.sequence(cc.progressFromTo(this._duration,this._from,this._to),cc.callFunc(this.finish,this));a.runAction(b);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,b){return new cc.TransitionProgress(a,b)};
cc.TransitionProgressRadialCCW=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_RADIAL;a.reverseDir=!1;a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}});
cc.TransitionProgressRadialCCW.create=function(a,b){return new cc.TransitionProgressRadialCCW(a,b)};
cc.TransitionProgressRadialCW=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_RADIAL;a.reverseDir=!0;a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}});
cc.TransitionProgressRadialCW.create=function(a,b){var c=new cc.TransitionProgressRadialCW;return null!==c&&c.initWithDuration(a,b)?c:new cc.TransitionProgressRadialCW(a,b)};
cc.TransitionProgressHorizontal=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(1,0);a.barChangeRate=cc.p(1,0);a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}});
cc.TransitionProgressHorizontal.create=function(a,b){return new cc.TransitionProgressHorizontal(a,b)};
cc.TransitionProgressVertical=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(0,0);a.barChangeRate=cc.p(0,1);a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}});
cc.TransitionProgressVertical.create=function(a,b){return new cc.TransitionProgressVertical(a,b)};
cc.TransitionProgressInOut=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(0.5,0.5);a.barChangeRate=cc.p(1,1);a.percentage=0;this._setAttrs(a,b.width/2,b.height/2);return a},_sceneOrder:function(){this._isInSceneOnTop=
!1},_setupTransition:function(){this._sceneToBeModified=this._inScene;this._from=0;this._to=100}});cc.TransitionProgressInOut.create=function(a,b){return new cc.TransitionProgressInOut(a,b)};
cc.TransitionProgressOutIn=cc.TransitionProgress.extend({ctor:function(a,b){cc.TransitionProgress.prototype.ctor.call(this);b&&this.initWithDuration(a,b)},_progressTimerNodeWithRenderTexture:function(a){var b=cc.director.getWinSize();a=new cc.ProgressTimer(a.sprite);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(a.sprite.flippedY=!0);a.type=cc.ProgressTimer.TYPE_BAR;a.midPoint=cc.p(0.5,0.5);a.barChangeRate=cc.p(1,1);a.percentage=100;this._setAttrs(a,b.width/2,b.height/2);return a}});
cc.TransitionProgressOutIn.create=function(a,b){return new cc.TransitionProgressOutIn(a,b)};cc.TransitionPageTurn=cc.TransitionScene.extend({ctor:function(a,b,c){cc.TransitionScene.prototype.ctor.call(this);this._gridProxy=new cc.NodeGrid;this.initWithDuration(a,b,c)},_back:!0,_gridProxy:null,_className:"TransitionPageTurn",initWithDuration:function(a,b,c){this._back=c;cc.TransitionScene.prototype.initWithDuration.call(this,a,b);return!0},actionWithSize:function(a){return this._back?cc.reverseTime(cc.pageTurn3D(this._duration,a)):cc.pageTurn3D(this._duration,a)},onEnter:function(){cc.TransitionScene.prototype.onEnter.call(this);
var a=cc.director.getWinSize(),b;a.width>a.height?(a=16,b=12):(a=12,b=16);a=this.actionWithSize(cc.size(a,b));b=this._gridProxy;this._back?(b.setTarget(this._inScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),this._inScene.visible=!1,b.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid())),this._inScene.runAction(cc.show())):(b.setTarget(this._outScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),b.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid())))},
visit:function(){this._back?this._outScene.visit():this._inScene.visit();this._gridProxy.visit()},_sceneOrder:function(){this._isInSceneOnTop=this._back}});cc.TransitionPageTurn.create=function(a,b,c){return new cc.TransitionPageTurn(a,b,c)};cc.Codec={name:"Jacob__Codec"};cc.unzip=function(){return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,arguments)};cc.unzipBase64=function(){var a=cc.Codec.Base64.decode.apply(cc.Codec.Base64,arguments);return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,[a])};cc.unzipBase64AsArray=function(a,b){b=b||1;var c=this.unzipBase64(a),d=[],e,f,h;e=0;for(h=c.length/b;e<h;e++)for(d[e]=0,f=b-1;0<=f;--f)d[e]+=c.charCodeAt(e*b+f)<<8*f;return d};
cc.unzipAsArray=function(a,b){b=b||1;var c=this.unzip(a),d=[],e,f,h;e=0;for(h=c.length/b;e<h;e++)for(d[e]=0,f=b-1;0<=f;--f)d[e]+=c.charCodeAt(e*b+f)<<8*f;return d};cc.StringToArray=function(a){a=a.split(",");var b=[],c;for(c=0;c<a.length;c++)b.push(parseInt(a[c]));return b};cc.Codec.Base64={name:"Jacob__Codec__Base64"};cc.Codec.Base64._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d";
cc.Codec.Base64.decode=function(a){var b=[],c,d,e,f,h,k=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)c=this._keyStr.indexOf(a.charAt(k++)),d=this._keyStr.indexOf(a.charAt(k++)),f=this._keyStr.indexOf(a.charAt(k++)),h=this._keyStr.indexOf(a.charAt(k++)),c=c<<2|d>>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|h,b.push(String.fromCharCode(c)),64!==f&&b.push(String.fromCharCode(d)),64!==h&&b.push(String.fromCharCode(e));return b=b.join("")};
cc.Codec.Base64.decodeAsArray=function(a,b){var c=this.decode(a),d=[],e,f,h;e=0;for(h=c.length/b;e<h;e++)for(d[e]=0,f=b-1;0<=f;--f)d[e]+=c.charCodeAt(e*b+f)<<8*f;return d};cc.uint8ArrayToUint32Array=function(a){if(0!==a.length%4)return null;for(var b=a.length/4,c=window.Uint32Array?new Uint32Array(b):[],d=0;d<b;d++){var e=4*d;c[d]=a[e]+256*a[e+1]+65536*a[e+2]+16777216*a[e+3]}return c};cc.PNGReader=cc.Class.extend({ctor:function(a){var b,c,d,e;this.data=a;this.pos=8;this.palette=[];this.imgData=[];this.transparency={};this.animation=null;this.text={};for(d=null;;){b=this.readUInt32();e=a=void 0;e=[];for(a=0;4>a;++a)e.push(String.fromCharCode(this.data[this.pos++]));a=e.join("");switch(a){case "IHDR":this.width=this.readUInt32();this.height=this.readUInt32();this.bits=this.data[this.pos++];this.colorType=this.data[this.pos++];this.compressionMethod=this.data[this.pos++];this.filterMethod=
this.data[this.pos++];this.interlaceMethod=this.data[this.pos++];break;case "acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||Infinity,frames:[]};break;case "PLTE":this.palette=this.read(b);break;case "fcTL":d&&this.animation.frames.push(d);this.pos+=4;d={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};a=this.readUInt16();b=this.readUInt16()||100;d.delay=1E3*a/b;d.disposeOp=this.data[this.pos++];d.blendOp=this.data[this.pos++];
d.data=[];break;case "IDAT":case "fdAT":"fdAT"===a&&(this.pos+=4,b-=4);a=(null!=d?d.data:void 0)||this.imgData;for(e=0;0<=b?e<b:e>b;0<=b?++e:--e)a.push(this.data[this.pos++]);break;case "tRNS":this.transparency={};switch(this.colorType){case 3:this.transparency.indexed=this.read(b);b=255-this.transparency.indexed.length;if(0<b)for(a=0;0<=b?a<b:a>b;0<=b?++a:--a)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(b)[0];break;case 2:this.transparency.rgb=this.read(b)}break;
case "tEXt":e=this.read(b);b=e.indexOf(0);a=String.fromCharCode.apply(String,e.slice(0,b));this.text[a]=String.fromCharCode.apply(String,e.slice(b+1));break;case "IEND":d&&this.animation.frames.push(d);a:{switch(this.colorType){case 0:case 3:case 4:d=1;break a;case 2:case 6:d=3;break a}d=void 0}this.colors=d;this.hasAlphaChannel=4===(c=this.colorType)||6===c;c=this.colors+(this.hasAlphaChannel?1:0);this.pixelBitlength=this.bits*c;a:{switch(this.colors){case 1:c="DeviceGray";break a;case 3:c="DeviceRGB";
break a}c=void 0}this.colorSpace=c;Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData));return;default:this.pos+=b}this.pos+=4;if(this.pos>this.data.length)throw Error("Incomplete or corrupt PNG file");}},read:function(a){var b,c;c=[];for(b=0;0<=a?b<a:b>a;0<=a?++b:--b)c.push(this.data[this.pos++]);return c},readUInt32:function(){var a,b,c,d;a=this.data[this.pos++]<<24;b=this.data[this.pos++]<<16;c=this.data[this.pos++]<<8;d=this.data[this.pos++];return a|b|c|d},readUInt16:function(){var a,
b;a=this.data[this.pos++]<<8;b=this.data[this.pos++];return a|b},decodePixels:function(a){var b,c,d,e,f,h,k,m,n,p,r,s,t,w,v;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(c=p=r=0;p<h;){switch(a[p++]){case 0:for(b=0;b<s;b+=1)n[c++]=a[p++];break;case 1:for(e=t=0;t<s;e=t+=1)b=a[p++],f=e<m?0:n[c-m],n[c++]=(b+f)%256;break;case 2:for(e=f=0;f<
s;e=f+=1)b=a[p++],d=(e-e%m)/m,t=r&&n[(r-1)*s+d*m+e%m],n[c++]=(t+b)%256;break;case 3:for(e=v=0;v<s;e=v+=1)b=a[p++],d=(e-e%m)/m,f=e<m?0:n[c-m],t=r&&n[(r-1)*s+d*m+e%m],n[c++]=(b+Math.floor((f+t)/2))%256;break;case 4:for(e=v=0;v<s;e=v+=1)b=a[p++],d=(e-e%m)/m,f=e<m?0:n[c-m],0===r?t=w=0:(t=n[(r-1)*s+d*m+e%m],w=d&&n[(r-1)*s+(d-1)*m+e%m]),k=f+t-w,e=Math.abs(k-f),d=Math.abs(k-t),k=Math.abs(k-w),f=e<=d&&e<=k?f:d<=k?t:w,n[c++]=(b+f)%256;break;default:throw Error("Invalid filter algorithm: "+a[p-1]);}r++}return n},
copyToImageData:function(a,b){var c,d,e,f,h,k,m,n;d=this.colors;n=null;c=this.hasAlphaChannel;this.palette.length&&(n=null!=(e=this._decodedPalette)?e:this._decodedPalette=this.decodePalette(),d=4,c=!0);e=a.data||a;m=e.length;h=n||b;f=k=0;if(1===d)for(;f<m;)d=n?4*b[f/4]:k,k=h[d++],e[f++]=k,e[f++]=k,e[f++]=k,e[f++]=c?h[d++]:255,k=d;else for(;f<m;)d=n?4*b[f/4]:k,e[f++]=h[d++],e[f++]=h[d++],e[f++]=h[d++],e[f++]=c?h[d++]:255,k=d},decodePalette:function(){var a,b,c,d,e,f,h,k,m;c=this.palette;f=this.transparency.indexed||
[];e=new Uint8Array((f.length||0)+c.length);b=h=a=d=0;for(k=c.length;h<k;b=h+=3)e[d++]=c[b],e[d++]=c[b+1],e[d++]=c[b+2],e[d++]=null!=(m=f[a++])?m:255;return e},render:function(a){var b;a.width=this.width;a.height=this.height;a=a.getContext("2d");b=a.createImageData(this.width,this.height);this.copyToImageData(b,this.decodePixels());return a.putImageData(b,0,0)}});cc.tiffReader={_littleEndian:!1,_tiffData:null,_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 b=this._tiffData;return this._littleEndian?b[a+3]<<24|b[a+2]<<16|b[a+1]<<8|b[a]:b[a]<<24|b[a+1]<<16|b[a+2]<<8|b[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 b=this.fieldTypeNames;return a in b?b[a]:null},getFieldTagName:function(a){var b=this.fieldTagNames;if(a in b)return b[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,b,c,d){a=[];var e=this.getFieldTypeLength(b);if(4>=e*c)!1===this.littleEndian?a.push(d>>>8*(4-e)):a.push(d);else for(var f=0;f<c;f++){var h=e*f;8<=e?-1!==["RATIONAL","SRATIONAL"].indexOf(b)?(a.push(this.getUint32(d+h)),a.push(this.getUint32(d+h+4))):cc.log("Can't handle this field type or size"):a.push(this.getBytes(e,d+h))}"ASCII"===b&&a.forEach(function(a,
b,c){c[b]=String.fromCharCode(a)});return a},getBytes:function(a,b){if(0>=a)cc.log("No bytes requested");else{if(1>=a)return this.getUint8(b);if(2>=a)return this.getUint16(b);if(3>=a)return this.getUint32(b)>>>8;if(4>=a)return this.getUint32(b);cc.log("Too many bytes requested")}},getBits:function(a,b,c){c=c||0;b+=Math.floor(c/8);var d=c+a;a=32-a;var e,f;0>=d?console.log("No bits requested"):8>=d?(e=24+c,f=this.getUint8(b)):16>=d?(e=16+c,f=this.getUint16(b)):32>=d?(e=c,f=this.getUint32(b)):console.log("Too many bits requested");
return{bits:f<<e>>>a,byteOffset:b+Math.floor(d/8),bitOffset:d%8}},parseFileDirectory:function(a){var b=this.getUint16(a),c=[];a+=2;for(var d=0;d<b;a+=12,d++){var e=this.getUint16(a),f=this.getUint16(a+2),h=this.getUint32(a+4),k=this.getUint32(a+8),e=this.getFieldTagName(e),f=this.getFieldTypeName(f),h=this.getFieldValues(e,f,h,k);c[e]={type:f,values:h}}this._fileDirectories.push(c);b=this.getUint32(a);0!==b&&this.parseFileDirectory(b)},clampColorSample:function(a,b){var c=Math.pow(2,8-b);return Math.floor(a*
c+(c-1))},parseTIFF:function(a,b){b=b||document.createElement("canvas");this._tiffData=a;this.canvas=b;this.checkLittleEndian();if(this.hasTowel()){var c=this.getUint32(4);this._fileDirectories.length=0;this.parseFileDirectory(c);var d=this._fileDirectories[0],c=d.ImageWidth.values[0],e=d.ImageLength.values[0];this.canvas.width=c;this.canvas.height=e;var f=[],h=d.Compression?d.Compression.values[0]:1,k=d.SamplesPerPixel.values[0],m=[],n=0,p=!1;d.BitsPerSample.values.forEach(function(a,b,c){m[b]={bitsPerSample:a,
hasBytesPerSample:!1,bytesPerSample:void 0};0===a%8&&(m[b].hasBytesPerSample=!0,m[b].bytesPerSample=a/8);n+=a},this);if(0===n%8)var p=!0,r=n/8;var s=d.StripOffsets.values,t=s.length;if(d.StripByteCounts)var w=d.StripByteCounts.values;else if(cc.log("Missing StripByteCounts!"),1===t)w=[Math.ceil(c*e*n/8)];else throw Error("Cannot recover from missing StripByteCounts");for(var v=0;v<t;v++){var y=s[v];f[v]=[];for(var x=w[v],u=0,z=0,A=1,B=!0,D=[],C=0,E=0,J=0;u<x;u+=A)switch(h){case 1:A=0;for(D=[];A<k;A++)if(m[A].hasBytesPerSample)D.push(this.getBytes(m[A].bytesPerSample,
y+u+m[A].bytesPerSample*A));else{var G=this.getBits(m[A].bitsPerSample,y+u,z);D.push(G.bits);u=G.byteOffset-y;z=G.bitOffset;throw RangeError("Cannot handle sub-byte bits per sample");}f[v].push(D);if(p)A=r;else throw A=0,RangeError("Cannot handle sub-byte bits per pixel");break;case 32773:if(B){var B=!1,H=1,L=1,A=this.getInt8(y+u);0<=A&&127>=A?H=A+1:-127<=A&&-1>=A?L=-A+1:B=!0}else{for(var I=this.getUint8(y+u),A=0;A<L;A++){if(m[E].hasBytesPerSample)J=J<<8*C|I,C++,C===m[E].bytesPerSample&&(D.push(J),
J=C=0,E++);else throw RangeError("Cannot handle sub-byte bits per sample");E===k&&(f[v].push(D),D=[],E=0)}H--;0===H&&(B=!0)}A=1}}if(b.getContext){r=this.canvas.getContext("2d");r.fillStyle="rgba(255, 255, 255, 0)";v=d.RowsPerStrip?d.RowsPerStrip.values[0]:e;y=f.length;e%=v;e=0===e?v:e;u=v;h=0;D=d.PhotometricInterpretation.values[0];H=[];L=0;d.ExtraSamples&&(H=d.ExtraSamples.values,L=H.length);if(d.ColorMap)var G=d.ColorMap.values,M=Math.pow(2,m[0].bitsPerSample);for(v=0;v<y;v++){v+1===y&&(u=e);d=
f[v].length;h*=v;for(p=k=0;k<u,p<d;k++)for(s=0;s<c;s++,p++){w=f[v][p];B=z=x=0;t=1;if(0<L)for(x=0;x<L;x++)if(1===H[x]||2===H[x]){t=w[3+x]/256;break}switch(D){case 0:if(m[0].hasBytesPerSample)var F=Math.pow(16,2*m[0].bytesPerSample);w.forEach(function(a,b,c){c[b]=F-a});case 1:x=z=B=this.clampColorSample(w[0],m[0].bitsPerSample);break;case 2:x=this.clampColorSample(w[0],m[0].bitsPerSample);z=this.clampColorSample(w[1],m[1].bitsPerSample);B=this.clampColorSample(w[2],m[2].bitsPerSample);break;case 3:if(void 0===
G)throw Error("Palette image missing color map");w=w[0];x=this.clampColorSample(G[w],16);z=this.clampColorSample(G[M+w],16);B=this.clampColorSample(G[2*M+w],16);break;default:throw RangeError("Unknown Photometric Interpretation:",D);}r.fillStyle="rgba("+x+", "+z+", "+B+", "+t+")";r.fillRect(s,h+k,1,1)}h=u}}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.Particle=function(a,b,c,d,e,f,h,k,m,n,p,r){this.pos=a?a:cc.p(0,0);this.startPos=b?b:cc.p(0,0);this.color=c?c:{r:0,g:0,b:0,a:255};this.deltaColor=d?d:{r:0,g:0,b:0,a:255};this.size=e||0;this.deltaSize=f||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=r?r:new cc.Particle.ModeB;this.isChangeColor=!1;this.drawPos=cc.p(0,0)};
cc.Particle.ModeA=function(a,b,c){this.dir=a?a:cc.p(0,0);this.radialAccel=b||0;this.tangentialAccel=c||0};cc.Particle.ModeB=function(a,b,c,d){this.angle=a||0;this.degreesPerSecond=b||0;this.radius=c||0;this.deltaRadius=d||0};cc.Particle.TemporaryPoints=[cc.p(),cc.p(),cc.p(),cc.p()];
cc.ParticleSystem=cc.Node.extend({_className:"ParticleSystem",_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,_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:null,autoRemoveOnFinish:!1,emitterMode:0,_textureLoaded:null,ctor:function(a){cc.Node.prototype.ctor.call(this);this.emitterMode=cc.ParticleSystem.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=cc.p(0,0);this._posVar=cc.p(0,
0);this._startColor=cc.color(255,255,255,255);this._startColorVar=cc.color(255,255,255,255);this._endColor=cc.color(255,255,255,255);this._endColorVar=cc.color(255,255,255,255);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._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.ParticleSystem.TYPE_FREE;this.autoRemoveOnFinish=!1;this._textureLoaded=!0;!a||cc.isNumber(a)?(a=a||100,this.setDrawMode(cc.ParticleSystem.TEXTURE_MODE),this.initWithTotalParticles(a)):cc.isString(a)?this.initWithFile(a):cc.isObject(a)&&this.initWithDictionary(a,"")},_createRenderCmd:function(){return cc._renderType===
cc.game.RENDER_TYPE_CANVAS?new cc.ParticleSystem.CanvasRenderCmd(this):new cc.ParticleSystem.WebGLRenderCmd(this)},ignoreColor:function(a){this._dontTint=a},initTexCoordsWithRect:function(a){this._renderCmd.initTexCoordsWithRect(a)},getBatchNode:function(){return this._batchNode},setBatchNode:function(a){this._renderCmd.setBatchNode(a)},getAtlasIndex:function(){return this.atlasIndex},setAtlasIndex:function(a){this.atlasIndex=a},getDrawMode:function(){return this._renderCmd.getDrawMode()},setDrawMode:function(a){this._renderCmd.setDrawMode(a)},
getShapeType:function(){return this._renderCmd.getShapeType()},setShapeType:function(a){this._renderCmd.setShapeType(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.x=a.x;
this._sourcePosition.y=a.y},getPosVar:function(){return{x:this._posVar.x,y:this._posVar.y}},setPosVar:function(a){this._posVar.x=a.x;this._posVar.y=a.y},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.ParticleSystem.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.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setGravity() : Particle Mode should be Gravity");this.modeA.gravity=a},getSpeed:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getSpeed() : Particle Mode should be Gravity");return this.modeA.speed},
setSpeed:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setSpeed() : Particle Mode should be Gravity");this.modeA.speed=a},getSpeedVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getSpeedVar() : Particle Mode should be Gravity");return this.modeA.speedVar},setSpeedVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setSpeedVar() : Particle Mode should be Gravity");
this.modeA.speedVar=a},getTangentialAccel:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getTangentialAccel() : Particle Mode should be Gravity");return this.modeA.tangentialAccel},setTangentialAccel:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setTangentialAccel() : Particle Mode should be Gravity");this.modeA.tangentialAccel=a},getTangentialAccelVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&
cc.log("cc.ParticleBatchNode.getTangentialAccelVar() : Particle Mode should be Gravity");return this.modeA.tangentialAccelVar},setTangentialAccelVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setTangentialAccelVar() : Particle Mode should be Gravity");this.modeA.tangentialAccelVar=a},getRadialAccel:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRadialAccel() : Particle Mode should be Gravity");return this.modeA.radialAccel},
setRadialAccel:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRadialAccel() : Particle Mode should be Gravity");this.modeA.radialAccel=a},getRadialAccelVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRadialAccelVar() : Particle Mode should be Gravity");return this.modeA.radialAccelVar},setRadialAccelVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRadialAccelVar() : Particle Mode should be Gravity");
this.modeA.radialAccelVar=a},getRotationIsDir:function(){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.getRotationIsDir() : Particle Mode should be Gravity");return this.modeA.rotationIsDir},setRotationIsDir:function(a){this.emitterMode!==cc.ParticleSystem.MODE_GRAVITY&&cc.log("cc.ParticleBatchNode.setRotationIsDir() : Particle Mode should be Gravity");this.modeA.rotationIsDir=a},getStartRadius:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getStartRadius() : Particle Mode should be Radius");
return this.modeB.startRadius},setStartRadius:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setStartRadius() : Particle Mode should be Radius");this.modeB.startRadius=a},getStartRadiusVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getStartRadiusVar() : Particle Mode should be Radius");return this.modeB.startRadiusVar},setStartRadiusVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setStartRadiusVar() : Particle Mode should be Radius");
this.modeB.startRadiusVar=a},getEndRadius:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getEndRadius() : Particle Mode should be Radius");return this.modeB.endRadius},setEndRadius:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setEndRadius() : Particle Mode should be Radius");this.modeB.endRadius=a},getEndRadiusVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getEndRadiusVar() : Particle Mode should be Radius");
return this.modeB.endRadiusVar},setEndRadiusVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setEndRadiusVar() : Particle Mode should be Radius");this.modeB.endRadiusVar=a},getRotatePerSecond:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getRotatePerSecond() : Particle Mode should be Radius");return this.modeB.rotatePerSecond},setRotatePerSecond:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setRotatePerSecond() : Particle Mode should be Radius");
this.modeB.rotatePerSecond=a},getRotatePerSecondVar:function(){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.getRotatePerSecondVar() : Particle Mode should be Radius");return this.modeB.rotatePerSecondVar},setRotatePerSecondVar:function(a){this.emitterMode!==cc.ParticleSystem.MODE_RADIUS&&cc.log("cc.ParticleBatchNode.setRotatePerSecondVar() : Particle Mode should be Radius");this.modeB.rotatePerSecondVar=a},setScale:function(a,b){this._transformSystemDirty=!0;cc.Node.prototype.setScale.call(this,
a,b)},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 cc.color(this._startColor.r,this._startColor.g,this._startColor.b,this._startColor.a)},setStartColor:function(a){this._startColor.r=a.r;this._startColor.g=a.g;this._startColor.b=a.b;this._startColor.a=a.a},getStartColorVar:function(){return cc.color(this._startColorVar.r,this._startColorVar.g,this._startColorVar.b,this._startColorVar.a)},
setStartColorVar:function(a){this._startColorVar.r=a.r;this._startColorVar.g=a.g;this._startColorVar.b=a.b;this._startColorVar.a=a.a},getEndColor:function(){return cc.color(this._endColor.r,this._endColor.g,this._endColor.b,this._endColor.a)},setEndColor:function(a){this._endColor.r=a.r;this._endColor.g=a.g;this._endColor.b=a.b;this._endColor.a=a.a},getEndColorVar:function(){return cc.color(this._endColorVar.r,this._endColorVar.g,this._endColorVar.b,this._endColorVar.a)},setEndColorVar:function(a){this._endColorVar.r=
a.r;this._endColorVar.g=a.g;this._endColorVar.b=a.b;this._endColorVar.a=a.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){this._renderCmd.setTotalParticles(a)},getTexture:function(){return this._texture},setTexture:function(a){a&&(a.isLoaded()?this.setTextureWithRect(a,cc.rect(0,0,a.width,a.height)):(this._textureLoaded=!1,a.addEventListener("load",function(a){this._textureLoaded=!0;this.setTextureWithRect(a,cc.rect(0,0,a.width,a.height))},this)))},getBlendFunc:function(){return this._blendFunc},setBlendFunc:function(a,b){if(void 0===
b)this._blendFunc!==a&&(this._blendFunc=a,this._updateBlendFunc());else if(this._blendFunc.src!==a||this._blendFunc.dst!==b)this._blendFunc={src:a,dst:b},this._updateBlendFunc()},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setOpacityModifyRGB:function(a){this._opacityModifyRGB=a},isBlendAdditive:function(){return this._blendFunc.src===cc.SRC_ALPHA&&this._blendFunc.dst===cc.ONE||this._blendFunc.src===cc.ONE&&this._blendFunc.dst===cc.ONE},setBlendAdditive:function(a){var b=this._blendFunc;
a?(b.src=cc.SRC_ALPHA,b.dst=cc.ONE):this._renderCmd._setBlendAdditive()},getPositionType:function(){return this.positionType},setPositionType:function(a){this.positionType=a},isAutoRemoveOnFinish:function(){return this.autoRemoveOnFinish},setAutoRemoveOnFinish:function(a){this.autoRemoveOnFinish=a},getEmitterMode:function(){return this.emitterMode},setEmitterMode:function(a){this.emitterMode=a},init:function(){return this.initWithTotalParticles(150)},initWithFile:function(a){this._plistFile=a;a=cc.loader.getRes(a);
return a?this.initWithDictionary(a,""):(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,b){var c=!1,d=null,d=this._valueForKey,e=parseInt(d("maxParticles",a));if(this.initWithTotalParticles(e)){this.angle=parseFloat(d("angle",a));this.angleVar=parseFloat(d("angleVariance",a));this.duration=parseFloat(d("duration",a));this._blendFunc.src=parseInt(d("blendFuncSource",
a));this._blendFunc.dst=parseInt(d("blendFuncDestination",a));c=this._startColor;c.r=255*parseFloat(d("startColorRed",a));c.g=255*parseFloat(d("startColorGreen",a));c.b=255*parseFloat(d("startColorBlue",a));c.a=255*parseFloat(d("startColorAlpha",a));c=this._startColorVar;c.r=255*parseFloat(d("startColorVarianceRed",a));c.g=255*parseFloat(d("startColorVarianceGreen",a));c.b=255*parseFloat(d("startColorVarianceBlue",a));c.a=255*parseFloat(d("startColorVarianceAlpha",a));c=this._endColor;c.r=255*parseFloat(d("finishColorRed",
a));c.g=255*parseFloat(d("finishColorGreen",a));c.b=255*parseFloat(d("finishColorBlue",a));c.a=255*parseFloat(d("finishColorAlpha",a));c=this._endColorVar;c.r=255*parseFloat(d("finishColorVarianceRed",a));c.g=255*parseFloat(d("finishColorVarianceGreen",a));c.b=255*parseFloat(d("finishColorVarianceBlue",a));c.a=255*parseFloat(d("finishColorVarianceAlpha",a));this.startSize=parseFloat(d("startParticleSize",a));this.startSizeVar=parseFloat(d("startParticleSizeVariance",a));this.endSize=parseFloat(d("finishParticleSize",
a));this.endSizeVar=parseFloat(d("finishParticleSizeVariance",a));this.setPosition(parseFloat(d("sourcePositionx",a)),parseFloat(d("sourcePositiony",a)));this._posVar.x=parseFloat(d("sourcePositionVariancex",a));this._posVar.y=parseFloat(d("sourcePositionVariancey",a));this.startSpin=parseFloat(d("rotationStart",a));this.startSpinVar=parseFloat(d("rotationStartVariance",a));this.endSpin=parseFloat(d("rotationEnd",a));this.endSpinVar=parseFloat(d("rotationEndVariance",a));this.emitterMode=parseInt(d("emitterType",
a));if(this.emitterMode===cc.ParticleSystem.MODE_GRAVITY)c=this.modeA,c.gravity.x=parseFloat(d("gravityx",a)),c.gravity.y=parseFloat(d("gravityy",a)),c.speed=parseFloat(d("speed",a)),c.speedVar=parseFloat(d("speedVariance",a)),e=d("radialAcceleration",a),c.radialAccel=e?parseFloat(e):0,e=d("radialAccelVariance",a),c.radialAccelVar=e?parseFloat(e):0,e=d("tangentialAcceleration",a),c.tangentialAccel=e?parseFloat(e):0,e=d("tangentialAccelVariance",a),c.tangentialAccelVar=e?parseFloat(e):0,e=d("rotationIsDir",
a),null!==e?(e=e.toString().toLowerCase(),c.rotationIsDir="true"===e||"1"===e):c.rotationIsDir=!1;else if(this.emitterMode===cc.ParticleSystem.MODE_RADIUS)c=this.modeB,c.startRadius=parseFloat(d("maxRadius",a)),c.startRadiusVar=parseFloat(d("maxRadiusVariance",a)),c.endRadius=parseFloat(d("minRadius",a)),c.endRadiusVar=0,c.rotatePerSecond=parseFloat(d("rotatePerSecond",a)),c.rotatePerSecondVar=parseFloat(d("rotatePerSecondVariance",a));else return cc.log("cc.ParticleSystem.initWithDictionary(): Invalid emitterType in config file"),
!1;this.life=parseFloat(d("particleLifespan",a));this.lifeVar=parseFloat(d("particleLifespanVariance",a));this.emissionRate=this._totalParticles/this.life;if(!this._batchNode)if(this._opacityModifyRGB=!1,c=d("textureFileName",a),c=cc.path.changeBasename(this._plistFile,c),e=cc.textureCache.getTextureForKey(c))this.setTexture(e);else if((d=d("textureImageData",a))&&0!==d.length){d=cc.unzipBase64AsArray(d,1);if(!d)return cc.log("cc.ParticleSystem: error decoding or ungzipping textureImageData"),!1;
e=cc.getImageFormatByData(d);if(e!==cc.FMT_TIFF&&e!==cc.FMT_PNG)return cc.log("cc.ParticleSystem: unknown image format with Data"),!1;var f=document.createElement("canvas");e===cc.FMT_PNG?(new cc.PNGReader(d)).render(f):cc.tiffReader.parseTIFF(d,f);cc.textureCache.cacheImage(c,f);(d=cc.textureCache.getTextureForKey(c))||cc.log("cc.ParticleSystem.initWithDictionary() : error loading the texture");this.setTexture(d)}else{e=cc.textureCache.addImage(c);if(!e)return!1;this.setTexture(e)}c=!0}return c},
initWithTotalParticles:function(a){this._totalParticles=a;var b,c=this._particles;for(b=c.length=0;b<a;b++)c[b]=new cc.Particle;if(!c)return cc.log("Particle system: not enough memory"),!1;this._allocatedParticles=a;if(this._batchNode)for(b=0;b<this._totalParticles;b++)c[b].atlasIndex=b;this._isActive=!0;this._blendFunc.src=cc.BLEND_SRC;this._blendFunc.dst=cc.BLEND_DST;this.positionType=cc.ParticleSystem.TYPE_FREE;this.emitterMode=cc.ParticleSystem.MODE_GRAVITY;this._transformSystemDirty=this.autoRemoveOnFinish=
!1;this.scheduleUpdateWithPriority(1);this._renderCmd._initWithTotalParticles(a);return!0},destroyParticleSystem:function(){this.unscheduleUpdate()},addParticle:function(){if(this.isFull())return!1;var a=this._renderCmd.addParticle();this.initParticle(a);++this.particleCount;return!0},initParticle:function(a){var b=cc.randomMinus1To1;a.timeToLive=this.life+this.lifeVar*b();a.timeToLive=Math.max(0,a.timeToLive);a.pos.x=this._sourcePosition.x+this._posVar.x*b();a.pos.y=this._sourcePosition.y+this._posVar.y*
b();var c,d;c=this._startColor;var e=this._startColorVar,f=this._endColor;d=this._endColorVar;c={r:cc.clampf(c.r+e.r*b(),0,255),g:cc.clampf(c.g+e.g*b(),0,255),b:cc.clampf(c.b+e.b*b(),0,255),a:cc.clampf(c.a+e.a*b(),0,255)};d={r:cc.clampf(f.r+d.r*b(),0,255),g:cc.clampf(f.g+d.g*b(),0,255),b:cc.clampf(f.b+d.b*b(),0,255),a:cc.clampf(f.a+d.a*b(),0,255)};a.color=c;e=a.deltaColor;f=a.timeToLive;e.r=(d.r-c.r)/f;e.g=(d.g-c.g)/f;e.b=(d.b-c.b)/f;e.a=(d.a-c.a)/f;c=this.startSize+this.startSizeVar*b();c=Math.max(0,
c);a.size=c;this.endSize===cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE?a.deltaSize=0:(d=this.endSize+this.endSizeVar*b(),d=Math.max(0,d),a.deltaSize=(d-c)/f);c=this.startSpin+this.startSpinVar*b();d=this.endSpin+this.endSpinVar*b();a.rotation=c;a.deltaRotation=(d-c)/f;this.positionType===cc.ParticleSystem.TYPE_FREE?a.startPos=this.convertToWorldSpace(this._pointZeroForParticle):this.positionType===cc.ParticleSystem.TYPE_RELATIVE&&(a.startPos.x=this._position.x,a.startPos.y=this._position.y);c=
cc.degreesToRadians(this.angle+this.angleVar*b());if(this.emitterMode===cc.ParticleSystem.MODE_GRAVITY)f=this.modeA,d=a.modeA,e=f.speed+f.speedVar*b(),d.dir.x=Math.cos(c),d.dir.y=Math.sin(c),cc.pMultIn(d.dir,e),d.radialAccel=f.radialAccel+f.radialAccelVar*b(),d.tangentialAccel=f.tangentialAccel+f.tangentialAccelVar*b(),f.rotationIsDir&&(a.rotation=-cc.radiansToDegrees(cc.pToAngle(d.dir)));else{d=this.modeB;a=a.modeB;var e=d.startRadius+d.startRadiusVar*b(),h=d.endRadius+d.endRadiusVar*b();a.radius=
e;a.deltaRadius=d.endRadius===cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS?0:(h-e)/f;a.angle=c;a.degreesPerSecond=cc.degreesToRadians(d.rotatePerSecond+d.rotatePerSecondVar*b())}},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,b){this._renderCmd.updateQuadWithParticle(a,b)},postStep:function(){this._renderCmd.postStep()},update:function(a){if(this._isActive&&this.emissionRate){var b=1/this.emissionRate;this.particleCount<this._totalParticles&&(this._emitCounter+=a);for(;this.particleCount<this._totalParticles&&this._emitCounter>b;)this.addParticle(),this._emitCounter-=b;this._elapsed+=a;-1!==this.duration&&this.duration<this._elapsed&&this.stopSystem()}this._particleIdx=
0;b=cc.Particle.TemporaryPoints[0];this.positionType===cc.ParticleSystem.TYPE_FREE?cc.pIn(b,this.convertToWorldSpace(this._pointZeroForParticle)):this.positionType===cc.ParticleSystem.TYPE_RELATIVE&&(b.x=this._position.x,b.y=this._position.y);if(this._visible){for(var c=cc.Particle.TemporaryPoints[1],d=cc.Particle.TemporaryPoints[2],e=cc.Particle.TemporaryPoints[3],f=this._particles;this._particleIdx<this.particleCount;){cc.pZeroIn(c);cc.pZeroIn(d);cc.pZeroIn(e);var h=f[this._particleIdx];h.timeToLive-=
a;if(0<h.timeToLive){if(this.emitterMode===cc.ParticleSystem.MODE_GRAVITY){var k=e,m=c,n=d;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._renderCmd._updateDeltaColor(h,a);h.size+=h.deltaSize*a;h.size=Math.max(0,h.size);h.rotation+=h.deltaRotation*a;k=c;this.positionType===cc.ParticleSystem.TYPE_FREE||this.positionType===cc.ParticleSystem.TYPE_RELATIVE?(m=d,cc.pIn(m,b),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);this._renderCmd.updateParticlePosition(h,k);++this._particleIdx}else if(h=
h.atlasIndex,this._particleIdx!==this.particleCount-1&&(k=f[this._particleIdx],f[this._particleIdx]=f[this.particleCount-1],f[this.particleCount-1]=k),this._batchNode&&(this._batchNode.disableParticle(this.atlasIndex+h),f[this.particleCount-1].atlasIndex=h),--this.particleCount,0===this.particleCount&&this.autoRemoveOnFinish){this.unscheduleUpdate();this._parent.removeChild(this,!0);return}}this._transformSystemDirty=!1}this._batchNode||this.postStep()},updateWithNoTime:function(){this.update(0)},
_valueForKey:function(a,b){if(b){var c=b[a];return null!=c?c:""}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 b=this._blendFunc;b.src===cc.BLEND_SRC&&b.dst===cc.BLEND_DST&&(a.hasPremultipliedAlpha()?this._opacityModifyRGB=!0:(b.src=cc.SRC_ALPHA,b.dst=cc.ONE_MINUS_SRC_ALPHA))}}},clone:function(){var a=new cc.ParticleSystem;if(a.initWithTotalParticles(this.getTotalParticles())){a.setAngle(this.getAngle());
a.setAngleVar(this.getAngleVar());a.setDuration(this.getDuration());var b=this.getBlendFunc();a.setBlendFunc(b.src,b.dst);a.setStartColor(this.getStartColor());a.setStartColorVar(this.getStartColorVar());a.setEndColor(this.getEndColor());a.setEndColorVar(this.getEndColorVar());a.setStartSize(this.getStartSize());a.setStartSizeVar(this.getStartSizeVar());a.setEndSize(this.getEndSize());a.setEndSizeVar(this.getEndSizeVar());a.setPosition(cc.p(this.x,this.y));a.setPosVar(cc.p(this.getPosVar().x,this.getPosVar().y));
a.setPositionType(this.getPositionType());a.setStartSpin(this.getStartSpin()||0);a.setStartSpinVar(this.getStartSpinVar()||0);a.setEndSpin(this.getEndSpin()||0);a.setEndSpinVar(this.getEndSpinVar()||0);a.setEmitterMode(this.getEmitterMode());this.getEmitterMode()===cc.ParticleSystem.MODE_GRAVITY?(b=this.getGravity(),a.setGravity(cc.p(b.x,b.y)),a.setSpeed(this.getSpeed()),a.setSpeedVar(this.getSpeedVar()),a.setRadialAccel(this.getRadialAccel()),a.setRadialAccelVar(this.getRadialAccelVar()),a.setTangentialAccel(this.getTangentialAccel()),
a.setTangentialAccelVar(this.getTangentialAccelVar())):this.getEmitterMode()===cc.ParticleSystem.MODE_RADIUS&&(a.setStartRadius(this.getStartRadius()),a.setStartRadiusVar(this.getStartRadiusVar()),a.setEndRadius(this.getEndRadius()),a.setEndRadiusVar(this.getEndRadiusVar()),a.setRotatePerSecond(this.getRotatePerSecond()),a.setRotatePerSecondVar(this.getRotatePerSecondVar()));a.setLife(this.getLife());a.setLifeVar(this.getLifeVar());a.setEmissionRate(this.getEmissionRate());if(!this.getBatchNode()&&
(a.setOpacityModifyRGB(this.isOpacityModifyRGB()),b=this.getTexture())){var c=b.getContentSize();a.setTextureWithRect(b,cc.rect(0,0,c.width,c.height))}}return a},setDisplayFrame:function(a){if(a){var b=a.getOffsetInPixels();0===b.x&&0===b.y||cc.log("cc.ParticleSystem.setDisplayFrame(): QuadParticle only supports SpriteFrames with no offsets");a=a.getTexture();this._texture!==a&&this.setTexture(a)}},setTextureWithRect:function(a,b){this._texture!==a&&(this._texture=a,this._updateBlendFunc());this.initTexCoordsWithRect(b)},
listenBackToForeground:function(a){}});_p=cc.ParticleSystem.prototype;cc.defineGetterSetter(_p,"opacityModifyRGB",_p.isOpacityModifyRGB,_p.setOpacityModifyRGB);cc.defineGetterSetter(_p,"batchNode",_p.getBatchNode,_p.setBatchNode);cc.defineGetterSetter(_p,"drawMode",_p.getDrawMode,_p.setDrawMode);cc.defineGetterSetter(_p,"shapeType",_p.getShapeType,_p.setShapeType);cc.defineGetterSetter(_p,"active",_p.isActive);cc.defineGetterSetter(_p,"sourcePos",_p.getSourcePosition,_p.setSourcePosition);
cc.defineGetterSetter(_p,"posVar",_p.getPosVar,_p.setPosVar);cc.defineGetterSetter(_p,"gravity",_p.getGravity,_p.setGravity);cc.defineGetterSetter(_p,"speed",_p.getSpeed,_p.setSpeed);cc.defineGetterSetter(_p,"speedVar",_p.getSpeedVar,_p.setSpeedVar);cc.defineGetterSetter(_p,"tangentialAccel",_p.getTangentialAccel,_p.setTangentialAccel);cc.defineGetterSetter(_p,"tangentialAccelVar",_p.getTangentialAccelVar,_p.setTangentialAccelVar);cc.defineGetterSetter(_p,"radialAccel",_p.getRadialAccel,_p.setRadialAccel);
cc.defineGetterSetter(_p,"radialAccelVar",_p.getRadialAccelVar,_p.setRadialAccelVar);cc.defineGetterSetter(_p,"rotationIsDir",_p.getRotationIsDir,_p.setRotationIsDir);cc.defineGetterSetter(_p,"startRadius",_p.getStartRadius,_p.setStartRadius);cc.defineGetterSetter(_p,"startRadiusVar",_p.getStartRadiusVar,_p.setStartRadiusVar);cc.defineGetterSetter(_p,"endRadius",_p.getEndRadius,_p.setEndRadius);cc.defineGetterSetter(_p,"endRadiusVar",_p.getEndRadiusVar,_p.setEndRadiusVar);
cc.defineGetterSetter(_p,"rotatePerS",_p.getRotatePerSecond,_p.setRotatePerSecond);cc.defineGetterSetter(_p,"rotatePerSVar",_p.getRotatePerSecondVar,_p.setRotatePerSecondVar);cc.defineGetterSetter(_p,"startColor",_p.getStartColor,_p.setStartColor);cc.defineGetterSetter(_p,"startColorVar",_p.getStartColorVar,_p.setStartColorVar);cc.defineGetterSetter(_p,"endColor",_p.getEndColor,_p.setEndColor);cc.defineGetterSetter(_p,"endColorVar",_p.getEndColorVar,_p.setEndColorVar);
cc.defineGetterSetter(_p,"totalParticles",_p.getTotalParticles,_p.setTotalParticles);cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);cc.ParticleSystem.create=function(a){return new cc.ParticleSystem(a)};cc.ParticleSystem.createWithTotalParticles=cc.ParticleSystem.create;
cc.ParticleSystem.ModeA=function(a,b,c,d,e,f,h,k){this.gravity=a?a:cc.p(0,0);this.speed=b||0;this.speedVar=c||0;this.tangentialAccel=d||0;this.tangentialAccelVar=e||0;this.radialAccel=f||0;this.radialAccelVar=h||0;this.rotationIsDir=k||!1};cc.ParticleSystem.ModeB=function(a,b,c,d,e,f){this.startRadius=a||0;this.startRadiusVar=b||0;this.endRadius=c||0;this.endRadiusVar=d||0;this.rotatePerSecond=e||0;this.rotatePerSecondVar=f||0};cc.ParticleSystem.SHAPE_MODE=0;cc.ParticleSystem.TEXTURE_MODE=1;
cc.ParticleSystem.STAR_SHAPE=0;cc.ParticleSystem.BALL_SHAPE=1;cc.ParticleSystem.DURATION_INFINITY=-1;cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE=-1;cc.ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS=-1;cc.ParticleSystem.MODE_GRAVITY=0;cc.ParticleSystem.MODE_RADIUS=1;cc.ParticleSystem.TYPE_FREE=0;cc.ParticleSystem.TYPE_RELATIVE=1;cc.ParticleSystem.TYPE_GROUPED=2;(function(){cc.ParticleSystem.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._drawMode=cc.ParticleSystem.TEXTURE_MODE;this._shapeType=cc.ParticleSystem.BALL_SHAPE;this._pointRect=cc.rect(0,0,0,0);this._tintCache=null};var a=cc.ParticleSystem.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ParticleSystem.CanvasRenderCmd;a.getDrawMode=function(){return this._drawMode};a.setDrawMode=function(a){this._drawMode=a};a.getShapeType=function(){return this._shapeType};
a.setShapeType=function(a){this._shapeType=a};a.setBatchNode=function(a){this._batchNode!==a&&(this._node._batchNode=a)};a.updateQuadWithParticle=function(a,c){};a.updateParticlePosition=function(a,c){cc.pIn(a.drawPos,c)};a.rendering=function(a,c,d){a=a||cc._renderContext;var e=a.getContext(),f=this._node,h=this._pointRect;a.setTransform(this._worldTransform,c,d);a.save();f.isBlendAdditive()?e.globalCompositeOperation="lighter":e.globalCompositeOperation="source-over";var k,m;d=this._node.particleCount;
var n=this._node._particles;if(f.drawMode!==cc.ParticleSystem.SHAPE_MODE&&f._texture){if(!f._texture._textureLoaded){a.restore();return}var p=f._texture.getHtmlElementObj();if(!p.width||!p.height){a.restore();return}k=p;for(c=0;c<d;c++)if(k=n[c],m=k.color.a/255,0!==m){e.globalAlpha=m;e.save();e.translate(0|k.drawPos.x,-(0|k.drawPos.y));var r=4*Math.floor(k.size/4);m=h.width;var s=h.height;e.scale(Math.max(1/m*r,1E-6),Math.max(1/s*r,1E-6));k.rotation&&e.rotate(cc.degreesToRadians(k.rotation));k=k.isChangeColor?
this._changeTextureColor(f._texture,k.color,this._pointRect):p;e.drawImage(k,-(0|m/2),-(0|s/2));e.restore()}}else for(p=cc._drawingUtil,c=0;c<d;c++)k=n[c],h=0|0.5*k.size,m=k.color.a/255,0!==m&&(e.globalAlpha=m,e.save(),e.translate(0|k.drawPos.x,-(0|k.drawPos.y)),f.shapeType===cc.ParticleSystem.STAR_SHAPE?(k.rotation&&e.rotate(cc.degreesToRadians(k.rotation)),p.drawStar(a,h,k.color)):p.drawColorBall(a,h,k.color),e.restore());a.restore();cc.g_NumberOfDraws++};a._changeTextureColor=function(a,c,d){this._tintCache||
(this._tintCache=document.createElement("canvas"));var e=this._tintCache,f=a.getContentSize();e.width=f.width;e.height=f.height;return a._generateColorTexture(c.r,c.g,c.b,d,e)};a.initTexCoordsWithRect=function(a){this._pointRect=a};a.setTotalParticles=function(a){this._node._totalParticles=200>a?a:200};a.addParticle=function(){var a=this._node,c=a._particles;a.particleCount<c.length?a=c[a.particleCount]:(a=new cc.Particle,c.push(a));return a};a._setupVBO=function(){};a._allocMemory=function(){return!0};
a.postStep=function(){};a._setBlendAdditive=function(){var a=this._node._blendFunc;a.src=cc.BLEND_SRC;a.dst=cc.BLEND_DST};a._initWithTotalParticles=function(a){};a._updateDeltaColor=function(a,c){if(!this._node._dontTint){var d=a.deltaColor;a.color.r+=d.r*c;a.color.g+=d.g*c;a.color.b+=d.b*c;a.color.a+=d.a*c;a.isChangeColor=0!==d.r||0!==d.g||0!==d.b}}})();(function(){cc.ParticleSystem.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=null;this._buffersVBO=[0,0];this._quads=[];this._indices=[];this._quadsArrayBuffer=null};var a=cc.ParticleSystem.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParticleSystem.WebGLRenderCmd;a.getDrawMode=function(){};a.setDrawMode=function(a){};a.getShapeType=function(){};a.setShapeType=function(a){};a.setBatchNode=function(a){var c=this._node;if(c._batchNode!==
a){var d=c._batchNode;if(c._batchNode=a)for(var e=c._particles,f=0;f<c._totalParticles;f++)e[f].atlasIndex=f;a?d||(c._batchNode.textureAtlas._copyQuadsToTextureAtlas(this._quads,c.atlasIndex),cc._renderContext.deleteBuffer(this._buffersVBO[1])):(this._allocMemory(),this.initIndices(c._totalParticles),c.setTexture(d.getTexture()),this._setupVBO())}};a.initIndices=function(a){for(var c=this._indices,d=0;d<a;++d){var e=6*d,f=4*d;c[e+0]=f+0;c[e+1]=f+1;c[e+2]=f+2;c[e+5]=f+1;c[e+4]=f+2;c[e+3]=f+3}};a.isDifferentTexture=
function(a,c){return a===c};a.updateParticlePosition=function(a,c){this.updateQuadWithParticle(a,c)};a.updateQuadWithParticle=function(a,c){var d=null,e=this._node;e._batchNode?(d=e._batchNode.textureAtlas.quads[e.atlasIndex+a.atlasIndex],e._batchNode.textureAtlas.dirty=!0):d=this._quads[e._particleIdx];var f,h,k;e._opacityModifyRGB?(e=0|a.color.r*a.color.a/255,f=0|a.color.g*a.color.a/255,h=0|a.color.b*a.color.a/255):(e=0|a.color.r,f=0|a.color.g,h=0|a.color.b);k=0|a.color.a;var m=d.bl.colors,n=d.br.colors,
p=d.tl.colors,r=d.tr.colors;m.r=n.r=p.r=r.r=e;m.g=n.g=p.g=r.g=f;m.b=n.b=p.b=r.b=h;m.a=n.a=p.a=r.a=k;e=a.size/2;a.rotation?(f=-e,h=-e,k=c.x,m=c.y,p=-cc.degreesToRadians(a.rotation),n=Math.cos(p),p=Math.sin(p),d.bl.vertices.x=f*n-h*p+k,d.bl.vertices.y=f*p+h*n+m,d.br.vertices.x=e*n-h*p+k,d.br.vertices.y=e*p+h*n+m,d.tl.vertices.x=f*n-e*p+k,d.tl.vertices.y=f*p+e*n+m,d.tr.vertices.x=e*n-e*p+k,d.tr.vertices.y=e*p+e*n+m):(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)};a.rendering=function(a){var c=this._node;if(c._texture){a=a||cc._renderContext;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._glProgramState.apply(this._matrix);cc.glBindTexture2D(c._texture);cc.glBlendFuncForParticle(c._blendFunc.src,
c._blendFunc.dst);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);a.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);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*c._particleIdx,a.UNSIGNED_SHORT,0)}};a.initTexCoordsWithRect=function(a){var c=this._node,d=c.texture,e=cc.contentScaleFactor(),f=cc.rect(a.x*e,a.y*e,a.width*e,a.height*e),e=a.width,h=a.height;d&&(e=d.pixelsWidth,h=d.pixelsHeight);cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL?(d=(2*f.x+1)/(2*e),a=(2*f.y+1)/(2*h),e=d+(2*f.width-2)/(2*e),f=a+(2*f.height-2)/(2*h)):(d=f.x/e,a=f.y/h,e=d+f.width/e,f=a+f.height/h);h=f;f=a;a=h;var k=0,m=0;c._batchNode?(h=c._batchNode.textureAtlas.quads,k=c.atlasIndex,m=c.atlasIndex+
c._totalParticles):(h=this._quads,k=0,m=c._totalParticles);for(c=k;c<m;c++)h[c]||(h[c]=cc.V3F_C4B_T2F_QuadZero()),k=h[c],k.bl.texCoords.u=d,k.bl.texCoords.v=a,k.br.texCoords.u=e,k.br.texCoords.v=a,k.tl.texCoords.u=d,k.tl.texCoords.v=f,k.tr.texCoords.u=e,k.tr.texCoords.v=f};a.setTotalParticles=function(a){var c=this._node;if(a>c._allocatedParticles){var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._indices=new Uint16Array(6*a);var e=new ArrayBuffer(a*d),f=c._particles;f.length=0;for(var h=this._quads,
k=h.length=0;k<a;k++)f[k]=new cc.Particle,h[k]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,e,k*d);c._allocatedParticles=a;c._totalParticles=a;if(c._batchNode)for(d=0;d<a;d++)f[d].atlasIndex=d;this._quadsArrayBuffer=e;this.initIndices(a);this._setupVBO();c._texture&&this.initTexCoordsWithRect(cc.rect(0,0,c._texture.width,c._texture.height))}else c._totalParticles=a;c.resetSystem()};a.addParticle=function(){var a=this._node;return a._particles[a.particleCount]};a._setupVBO=function(){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)};a._allocMemory=function(){var a=this._node;if(a._batchNode)return cc.log("cc.ParticleSystem._allocMemory(): Memory should not be allocated when not using batchNode"),!1;var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,
a=a._totalParticles,d=this._quads;d.length=0;this._indices=new Uint16Array(6*a);for(var e=new ArrayBuffer(c*a),f=0;f<a;f++)d[f]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,e,f*c);if(!d||!this._indices)return cc.log("cocos2d: Particle system: not enough memory"),!1;this._quadsArrayBuffer=e;return!0};a.postStep=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]);a.bufferSubData(a.ARRAY_BUFFER,0,this._quadsArrayBuffer)};a._setBlendAdditive=function(){var a=this._node._blendFunc;
this._texture&&!this._texture.hasPremultipliedAlpha()?(a.src=cc.SRC_ALPHA,a.dst=cc.ONE_MINUS_SRC_ALPHA):(a.src=cc.BLEND_SRC,a.dst=cc.BLEND_DST)};a._initWithTotalParticles=function(a){if(!this._allocMemory())return!1;this.initIndices(a);this._setupVBO();this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)};a._updateDeltaColor=function(a,c){a.color.r+=a.deltaColor.r*c;a.color.g+=a.deltaColor.g*c;a.color.b+=a.deltaColor.b*c;a.color.a+=a.deltaColor.a*c;a.isChangeColor=!0}})();cc.ParticleFire=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?300:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.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.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(194,64,31,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,0,0,0)),this.setBlendAdditive(!0),!0):!1}});
cc.ParticleFire.create=function(){return new cc.ParticleFire};
cc.ParticleFireworks=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?1500:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY),this.setGravity(cc.p(0,-90)),this.setRadialAccel(0),this.setRadialAccelVar(0),this.setSpeed(180),this.setSpeedVar(50),a=cc.director.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.color(128,128,128,255)),this.setStartColorVar(cc.color(128,128,128,255)),this.setEndColor(cc.color(26,26,26,51)),this.setEndColorVar(cc.color(26,26,26,51)),this.setStartSize(8),this.setStartSizeVar(2),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setBlendAdditive(!1),!0):!1}});
cc.ParticleFireworks.create=function(){return new cc.ParticleFireworks};
cc.ParticleSun=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?350:150)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setBlendAdditive(!0),this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(1),this.setLifeVar(0.5),this.setStartSize(30),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(194,64,31,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,0,0,0)),
!0):!1}});cc.ParticleSun.create=function(){return new cc.ParticleSun};
cc.ParticleGalaxy=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?200:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(4),this.setLifeVar(1),this.setStartSize(37),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(31,64,194,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,
0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleGalaxy.create=function(){return new cc.ParticleGalaxy};
cc.ParticleFlower=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?250:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(4),this.setLifeVar(1),this.setStartSize(30),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(128,128,128,255)),this.setStartColorVar(cc.color(128,128,128,128)),this.setEndColor(cc.color(0,0,0,255)),
this.setEndColorVar(cc.color(0,0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleFlower.create=function(){return new cc.ParticleFlower};
cc.ParticleMeteor=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?150:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(2),this.setLifeVar(1),this.setStartSize(60),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(51,102,179)),this.setStartColorVar(cc.color(0,0,51,26)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,
0,0,0)),this.setBlendAdditive(!0),!0):!1}});cc.ParticleMeteor.create=function(){return new cc.ParticleMeteor};
cc.ParticleSpiral=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?500:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(12),this.setLifeVar(0),this.setStartSize(20),this.setStartSizeVar(0),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(128,128,128,255)),this.setStartColorVar(cc.color(128,128,128,0)),this.setEndColor(cc.color(128,128,128,255)),
this.setEndColorVar(cc.color(128,128,128,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleSpiral.create=function(){return new cc.ParticleSpiral};
cc.ParticleExplosion=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?700:300)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(0.1),this.setEmitterMode(cc.ParticleSystem.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.getWinSize(),this.setPosition(a.width/2,a.height/2),this.setPosVar(cc.p(0,0)),this.setLife(5),this.setLifeVar(2),this.setStartSize(15),this.setStartSizeVar(10),this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getDuration()),this.setStartColor(cc.color(179,26,51,255)),this.setStartColorVar(cc.color(128,128,128,0)),this.setEndColor(cc.color(128,128,128,0)),this.setEndColorVar(cc.color(128,
128,128,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleExplosion.create=function(){return new cc.ParticleExplosion};
cc.ParticleSmoke=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?200:100)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.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.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(this.getTotalParticles()/this.getLife()),this.setStartColor(cc.color(204,204,204,255)),this.setStartColorVar(cc.color(5,5,5,0)),this.setEndColor(cc.color(0,0,0,255)),this.setEndColorVar(cc.color(0,0,0,0)),this.setBlendAdditive(!1),
!0):!1}});cc.ParticleSmoke.create=function(){return new cc.ParticleSmoke};
cc.ParticleSnow=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?700:250)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.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.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(10),this.setStartColor(cc.color(255,255,255,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(255,255,255,0)),this.setEndColorVar(cc.color(0,
0,0,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleSnow.create=function(){return new cc.ParticleSnow};
cc.ParticleRain=cc.ParticleSystem.extend({ctor:function(){cc.ParticleSystem.prototype.ctor.call(this,cc._renderType===cc.game.RENDER_TYPE_WEBGL?1E3:300)},initWithTotalParticles:function(a){return cc.ParticleSystem.prototype.initWithTotalParticles.call(this,a)?(this.setDuration(cc.ParticleSystem.DURATION_INFINITY),this.setEmitterMode(cc.ParticleSystem.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.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.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE),this.setEmissionRate(20),this.setStartColor(cc.color(179,204,255,255)),this.setStartColorVar(cc.color(0,0,0,0)),this.setEndColor(cc.color(179,204,255,128)),this.setEndColorVar(cc.color(0,
0,0,0)),this.setBlendAdditive(!1),!0):!1}});cc.ParticleRain.create=function(){return new cc.ParticleRain};cc.PARTICLE_DEFAULT_CAPACITY=500;
cc.ParticleBatchNode=cc.Node.extend({textureAtlas:null,_blendFunc:null,_className:"ParticleBatchNode",ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};cc.isString(a)?this.init(a,b):a instanceof cc.Texture2D&&this.initWithTexture(a,b)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ParticleBatchNode.CanvasRenderCmd(this):new cc.ParticleBatchNode.WebGLRenderCmd(this)},initWithTexture:function(a,b){this.textureAtlas=
new cc.TextureAtlas;this.textureAtlas.initWithTexture(a,b);this._children.length=0;this._renderCmd._initWithTexture();return!0},initWithFile:function(a,b){var c=cc.textureCache.addImage(a);return this.initWithTexture(c,b)},init:function(a,b){var c=cc.textureCache.addImage(a);return this.initWithTexture(c,b)},visit:function(a){var b=this._renderCmd;a=a?a._renderCmd:null;this._visible?(b.visit(a),cc.renderer.pushRenderCommand(b),b._dirtyFlag=0):b._propagateFlagsDown(a)},addChild:function(a,b,c){if(!a)throw Error("cc.ParticleBatchNode.addChild() : child should be non-null");
if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.addChild() : only supports cc.ParticleSystem as children");b=null==b?a.zIndex:b;c=null==c?a.tag:c;if(a.getTexture()!==this.textureAtlas.texture)throw Error("cc.ParticleSystem.addChild() : the child is not using the same texture id");var d=a.getBlendFunc();if(0===this._children.length)this.setBlendFunc(d);else if(d.src!==this._blendFunc.src||d.dst!==this._blendFunc.dst){cc.log("cc.ParticleSystem.addChild() : Can't add a ParticleSystem that uses a different blending function");
return}b=this._addChildHelper(a,b,c);c=0;0!==b?(b=this._children[b-1],c=b.getAtlasIndex()+b.getTotalParticles()):c=0;this.insertChild(a,c);a.setBatchNode(this)},insertChild:function(a,b){var c=a.getTotalParticles(),d=this.textureAtlas,e=d.totalQuads;a.setAtlasIndex(b);e+c>d.getCapacity()&&(this._increaseAtlasCapacityTo(e+c),d.fillWithEmptyQuadsFromIndex(d.getCapacity()-c,c));a.getAtlasIndex()+c!==e&&d.moveQuadsFromIndex(b,b+c);d.increaseTotalQuadsWith(c);this._updateAllAtlasIndexes()},removeChild:function(a,
b){if(null!=a){if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.removeChild(): only supports cc.ParticleSystem as children");if(-1===this._children.indexOf(a))cc.log("cc.ParticleBatchNode.removeChild(): doesn't contain the sprite. Can't remove it");else{cc.Node.prototype.removeChild.call(this,a,b);var c=this.textureAtlas;c.removeQuadsAtIndex(a.getAtlasIndex(),a.getTotalParticles());c.fillWithEmptyQuadsFromIndex(c.totalQuads,a.getTotalParticles());a.setBatchNode(null);this._updateAllAtlasIndexes()}}},
reorderChild:function(a,b){if(!a)throw Error("cc.ParticleBatchNode.reorderChild(): child should be non-null");if(!(a instanceof cc.ParticleSystem))throw Error("cc.ParticleBatchNode.reorderChild(): only supports cc.QuadParticleSystems as children");if(-1===this._children.indexOf(a))cc.log("cc.ParticleBatchNode.reorderChild(): Child doesn't belong to batch");else{if(1<this._children.length){var c=this._getCurrentIndex(a,b);if(c.oldIndex!==c.newIndex){this._children.splice(c.oldIndex,1);this._children.splice(c.newIndex,
0,a);c=a.getAtlasIndex();this._updateAllAtlasIndexes();for(var d=0,e=this._children,f=0;f<e.length;f++)if(e[f]===a){d=a.getAtlasIndex();break}this.textureAtlas.moveQuadsFromIndex(c,a.getTotalParticles(),d);a.updateWithNoTime()}}a._setLocalZOrder(b)}},removeChildAtIndex:function(a,b){this.removeChild(this._children[i],b)},removeAllChildren:function(a){for(var b=this._children,c=0;c<b.length;c++)b[c].setBatchNode(null);cc.Node.prototype.removeAllChildren.call(this,a);this.textureAtlas.removeAllQuads()},
disableParticle:function(a){a=this.textureAtlas.quads[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)},getTexture:function(){return this.textureAtlas.texture},setTexture:function(a){this.textureAtlas.texture=a;var b=this._blendFunc;a&&!a.hasPremultipliedAlpha()&&b.src===cc.BLEND_SRC&&b.dst===cc.BLEND_DST&&(b.src=cc.SRC_ALPHA,b.dst=cc.ONE_MINUS_SRC_ALPHA)},setBlendFunc:function(a,b){void 0===
b?(this._blendFunc.src=a.src,this._blendFunc.dst=a.dst):(this._blendFunc.src=a,this._blendFunc.src=b)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},_updateAllAtlasIndexes:function(){for(var a=0,b=this._children,c=0;c<b.length;c++){var d=b[c];d.setAtlasIndex(a);a+=d.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 b=this._children,c=b.length,d=0;d<c;d++)if(b[d].zIndex>a)return d;return c},_getCurrentIndex:function(a,b){for(var c=!1,d=!1,e=0,f=0,h=0,k=this._children,m=k.length,n=0;n<m;n++){var p=k[n];if(p.zIndex>b&&!d&&(e=n,d=!0,c&&d))break;if(a===p&&(f=n,c=!0,d||(h=-1),c&&d))break}d||(e=m);return{newIndex:e+h,oldIndex:f}},_addChildHelper:function(a,
b,c){if(!a)throw Error("cc.ParticleBatchNode._addChildHelper(): child should be non-null");if(a.parent)return cc.log("cc.ParticleBatchNode._addChildHelper(): child already added. It can't be added again"),null;this._children||(this._children=[]);var d=this._searchNewPositionInChildrenForZ(b);this._children.splice(d,0,a);a.tag=c;a._setLocalZOrder(b);a.parent=this;this._running&&(a._performRecursive(cc.Node._stateCallbackType.onEnter),a._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish));
return d},_updateBlendFunc:function(){this.textureAtlas.texture.hasPremultipliedAlpha()||(this._blendFunc.src=cc.SRC_ALPHA,this._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA)},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){this.textureAtlas=a}});_p=cc.ParticleBatchNode.prototype;cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture);cc.ParticleBatchNode.create=function(a,b){return new cc.ParticleBatchNode(a,b)};(function(){cc.ParticleBatchNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=cc.ParticleBatchNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ParticleBatchNode.CanvasRenderCmd;a._initWithTexture=function(){}})();(function(){cc.ParticleBatchNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity()};var a=cc.ParticleBatchNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParticleBatchNode.WebGLRenderCmd;a.rendering=function(a){a=this._node;if(0!==a.textureAtlas.totalQuads){var c=this._worldTransform;this._matrix.mat[0]=c.a;this._matrix.mat[4]=c.c;this._matrix.mat[12]=c.tx;this._matrix.mat[1]=c.b;this._matrix.mat[5]=
c.d;this._matrix.mat[13]=c.ty;this._glProgramState.apply(this._matrix);cc.glBlendFuncForParticle(a._blendFunc.src,a._blendFunc.dst);a.textureAtlas.drawQuads()}};a._initWithTexture=function(){this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR)}})();cc.IMEKeyboardNotificationInfo=function(a,b,c){this.begin=a||cc.rect(0,0,0,0);this.end=b||cc.rect(0,0,0,0);this.duration=c||0};
cc.IMEDelegate=cc.Class.extend({ctor:function(){cc.imeDispatcher.addDelegate(this)},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},attachWithIME:function(){return cc.imeDispatcher.attachDelegateWithIME(this)},detachWithIME:function(){return cc.imeDispatcher.detachDelegateWithIME(this)},canAttachWithIME:function(){return!1},didAttachWithIME:function(){},canDetachWithIME:function(){return!1},didDetachWithIME:function(){},insertText:function(a,b){},deleteBackward:function(){},getContentText:function(){return""},
keyboardWillShow:function(a){},keyboardDidShow:function(a){},keyboardWillHide:function(a){},keyboardDidHide:function(a){}});
cc.IMEDispatcher=cc.Class.extend({_domInputControl:null,impl:null,_currentInputString:"",_lastClickPosition:null,ctor:function(){this.impl=new cc.IMEDispatcher.Impl;this._lastClickPosition=cc.p(0,0)},init:function(){if(!cc.sys.isMobile){this._domInputControl=cc.$("#imeDispatcherInput");this._domInputControl||(this._domInputControl=cc.$new("input"),this._domInputControl.setAttribute("type","text"),this._domInputControl.setAttribute("id","imeDispatcherInput"),this._domInputControl.resize(0,0),this._domInputControl.translates(0,
0),this._domInputControl.style.opacity="0",this._domInputControl.style.fontSize="1px",this._domInputControl.setAttribute("tabindex",2),this._domInputControl.style.position="absolute",this._domInputControl.style.top=0,this._domInputControl.style.left=0,document.body.appendChild(this._domInputControl));var a=this;this._domInputControl.addEventListener("input",function(){a._processDomInputString(a._domInputControl.value)},!1);this._domInputControl.addEventListener("keydown",function(b){b.keyCode===cc.KEY.tab?
(b.stopPropagation(),b.preventDefault()):b.keyCode===cc.KEY.enter&&(a.dispatchInsertText("\n",1),b.stopPropagation(),b.preventDefault())},!1);/msie/i.test(navigator.userAgent)&&this._domInputControl.addEventListener("keyup",function(b){b.keyCode===cc.KEY.backspace&&a._processDomInputString(a._domInputControl.value)},!1);window.addEventListener("mousedown",function(b){var c=b.pageY||0;a._lastClickPosition.x=b.pageX||0;a._lastClickPosition.y=c},!1)}},_processDomInputString:function(a){var b,c;b=this._currentInputString.length<
a.length?this._currentInputString.length:a.length;for(c=0;c<b&&a[c]===this._currentInputString[c];c++);var d=this._currentInputString.length-c,e=a.length-c;for(b=0;b<d;b++)this.dispatchDeleteBackward();for(b=0;b<e;b++)this.dispatchInsertText(a[c+b],1);this._currentInputString=a},dispatchInsertText:function(a,b){!this.impl||!a||0>=b||this.impl._delegateWithIme&&this.impl._delegateWithIme.insertText(a,b)},dispatchDeleteBackward:function(){this.impl&&this.impl._delegateWithIme&&this.impl._delegateWithIme.deleteBackward()},
getContentText:function(){if(this.impl&&this.impl._delegateWithIme){var a=this.impl._delegateWithIme.getContentText();return a?a:""}return""},dispatchKeyboardWillShow:function(a){if(this.impl)for(var b=0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardWillShow(a)}},dispatchKeyboardDidShow:function(a){if(this.impl)for(var b=0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardDidShow(a)}},dispatchKeyboardWillHide:function(a){if(this.impl)for(var b=
0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardWillHide(a)}},dispatchKeyboardDidHide:function(a){if(this.impl)for(var b=0;b<this.impl._delegateList.length;b++){var c=this.impl._delegateList[b];c&&c.keyboardDidHide(a)}},addDelegate:function(a){a&&this.impl&&(-1<this.impl._delegateList.indexOf(a)||this.impl._delegateList.splice(0,0,a))},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 b=this.impl._delegateWithIme;this.impl._delegateWithIme=null;b.didDetachWithIME();this._focusDomInput(a);return!0}if(!a.canAttachWithIME())return!1;this._focusDomInput(a);return!0},_focusDomInput:function(a){if(cc.sys.isMobile){this.impl._delegateWithIme=a;a.didAttachWithIME();this._currentInputString=a.string||"";a=a.getTipMessage?a.getTipMessage():"please enter your word:";var b=window.Window;a=b&&b.prototype.prompt&&b.prototype.prompt!=prompt?b.prototype.prompt.call(window,
a,this._currentInputString):prompt(a,this._currentInputString);null!=a&&this._processDomInputString(a);this.dispatchInsertText("\n",1)}else this.impl._delegateWithIme=a,this._currentInputString=a.string||"",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 b=0;b<this._delegateList.length;b++)if(this._delegateList[b]===a)return b;return null}});cc.imeDispatcher=new cc.IMEDispatcher;
document.body?cc.imeDispatcher.init():window.addEventListener("load",function(){cc.imeDispatcher.init()},!1);cc.TextFieldDelegate=cc.Class.extend({onTextFieldAttachWithIME:function(a){return!1},onTextFieldDetachWithIME:function(a){return!1},onTextFieldInsertText:function(a,b,c){return!1},onTextFieldDeleteBackward:function(a,b,c){return!1},onDraw:function(a){return!1}});
cc.TextFieldTTF=cc.LabelTTF.extend({delegate:null,colorSpaceHolder:null,_colorText:null,_lens:null,_inputText:"",_placeHolder:"",_charCount:0,_className:"TextFieldTTF",ctor:function(a,b,c,d,e){this.colorSpaceHolder=cc.color(127,127,127);this._colorText=cc.color(255,255,255,255);cc.LabelTTF.prototype.ctor.call(this);void 0!==e?(this.initWithPlaceHolder("",b,c,d,e),a&&this.setPlaceHolder(a)):void 0===d&&void 0!==c&&(this.initWithString("",b,c),a&&this.setPlaceHolder(a))},onEnter:function(){cc.LabelTTF.prototype.onEnter.call(this);
cc.imeDispatcher.addDelegate(this)},onExit:function(){cc.LabelTTF.prototype.onExit.call(this);cc.imeDispatcher.removeDelegate(this)},getDelegate:function(){return this.delegate},setDelegate:function(a){this.delegate=a},getCharCount:function(){return this._charCount},getColorSpaceHolder:function(){return cc.color(this.colorSpaceHolder)},setColorSpaceHolder:function(a){this.colorSpaceHolder.r=a.r;this.colorSpaceHolder.g=a.g;this.colorSpaceHolder.b=a.b;this.colorSpaceHolder.a=cc.isUndefined(a.a)?255:
a.a;this._inputText.length||this.setColor(this.colorSpaceHolder)},setTextColor:function(a){this._colorText.r=a.r;this._colorText.g=a.g;this._colorText.b=a.b;this._colorText.a=cc.isUndefined(a.a)?255:a.a;this._inputText.length&&this.setColor(this._colorText)},initWithPlaceHolder:function(a,b,c,d,e){switch(arguments.length){case 5:return a&&this.setPlaceHolder(a),this.initWithString(this._placeHolder,d,e,b,c);case 3:return a&&this.setPlaceHolder(a),this.initWithString(this._placeHolder,arguments[1],
arguments[2]);default:throw Error("Argument must be non-nil ");}},setString:function(a){this._inputText=(a=String(a))||"";this._inputText.length?(cc.LabelTTF.prototype.setString.call(this,this._inputText),this.setColor(this._colorText)):(cc.LabelTTF.prototype.setString.call(this,this._placeHolder),this.setColor(this.colorSpaceHolder));cc._renderType===cc.game.RENDER_TYPE_CANVAS&&this._renderCmd._updateTexture();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),this.setColor(this.colorSpaceHolder))},getPlaceHolder:function(){return this._placeHolder},draw:function(a){a=a||cc._renderContext;this.delegate&&this.delegate.onDraw(this)||cc.LabelTTF.prototype.draw.call(this,a)},attachWithIME:function(){return cc.imeDispatcher.attachDelegateWithIME(this)},detachWithIME:function(){return cc.imeDispatcher.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),this.setColor(this.colorSpaceHolder)):this.string=
this._inputText.substring(0,a-1))},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},_tipMessage:"please enter your word:",setTipMessage:function(a){null!=a&&(this._tipMessage=a)},getTipMessage:function(){return this._tipMessage},insertText:function(a,b){var c=a,d=c.indexOf("\n");-1<d&&(c=c.substring(0,d));if(0<c.length){if(this.delegate&&this.delegate.onTextFieldInsertText(this,c,c.length))return;c=this._inputText+c;this._charCount=c.length;this.string=c}-1!==d&&(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){}});_p=cc.TextFieldTTF.prototype;cc.defineGetterSetter(_p,"charCount",_p.getCharCount);cc.defineGetterSetter(_p,"placeHolder",_p.getPlaceHolder,_p.setPlaceHolder);cc.TextFieldTTF.create=function(a,b,c,d,e){return new cc.TextFieldTTF(a,b,c,d,e)};cc._globalFontSize=cc.ITEM_SIZE;cc._globalFontName="Arial";cc._globalFontNameRelease=!1;
cc.MenuItem=cc.Node.extend({_enabled:!1,_target:null,_callback:null,_isSelected:!1,_className:"MenuItem",ctor:function(a,b){var c=cc.Node.prototype;c.ctor.call(this);this._callback=this._target=null;this._enabled=this._isSelected=!1;c.setAnchorPoint.call(this,0.5,0.5);this._target=b||null;if(this._callback=a||null)this._enabled=!0},isSelected:function(){return this._isSelected},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},setTarget:function(a,b){this._target=b;this._callback=
a},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a},initWithCallback:function(a,b){this.anchorY=this.anchorX=0.5;this._target=b;this._callback=a;this._enabled=!0;this._isSelected=!1;return!0},rect:function(){var a=this._position,b=this._contentSize,c=this._anchorPoint;return cc.rect(a.x-b.width*c.x,a.y-b.height*c.y,b.width,b.height)},selected:function(){this._isSelected=!0},unselected:function(){this._isSelected=!1},setCallback:function(a,b){this._target=b;this._callback=
a},activate:function(){if(this._enabled){var a=this._target,b=this._callback;if(b)if(a&&cc.isString(b))a[b](this);else a&&cc.isFunction(b)?b.call(a,this):b(this)}}});_p=cc.MenuItem.prototype;cc.defineGetterSetter(_p,"enabled",_p.isEnabled,_p.setEnabled);cc.MenuItem.create=function(a,b){return new cc.MenuItem(a,b)};
cc.MenuItemLabel=cc.MenuItem.extend({_disabledColor:null,_label:null,_originalScale:0,_colorBackup:null,ctor:function(a,b,c){cc.MenuItem.prototype.ctor.call(this,b,c);this._colorBackup=this._label=this._disabledColor=null;a&&(this._originalScale=1,this._colorBackup=cc.color.WHITE,this._disabledColor=cc.color(126,126,126),this.setLabel(a),a.textureLoaded&&!a.textureLoaded()&&a.addEventListener("load",function(a){this.width=a.width;this.height=a.height;this.parent instanceof cc.Menu&&this.parent.updateAlign()},
this),this.setCascadeColorEnabled(!0),this.setCascadeOpacityEnabled(!0))},getDisabledColor:function(){return this._disabledColor},setDisabledColor:function(a){this._disabledColor=a},getLabel:function(){return this._label},setLabel:function(a){a&&(this.addChild(a),a.anchorX=0,a.anchorY=0,this.width=a.width,this.height=a.height,a.setCascadeColorEnabled(!0));this._label&&this.removeChild(this._label,!0);this._label=a},setEnabled:function(a){this._enabled!==a&&(a?this.setColor(this._colorBackup):(this._colorBackup=
this.color,this.setColor(this._disabledColor)));cc.MenuItem.prototype.setEnabled.call(this,a)},initWithLabel:function(a,b,c){this.initWithCallback(b,c);this._originalScale=1;this._colorBackup=cc.color.WHITE;this._disabledColor=cc.color(126,126,126);this.setLabel(a);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},setString:function(a){this._label.string=a;this.width=this._label.width;this.height=this._label.height},getString:function(){return this._label.string},activate:function(){this._enabled&&
(this.stopAllActions(),this.scale=this._originalScale,cc.MenuItem.prototype.activate.call(this))},selected:function(){if(this._enabled){cc.MenuItem.prototype.selected.call(this);var a=this.getActionByTag(cc.ZOOM_ACTION_TAG);a?this.stopAction(a):this._originalScale=this.scale;a=cc.scaleTo(0.1,1.2*this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}},unselected:function(){if(this._enabled){cc.MenuItem.prototype.unselected.call(this);this.stopActionByTag(cc.ZOOM_ACTION_TAG);var a=cc.scaleTo(0.1,
this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}}});_p=cc.MenuItemLabel.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"disabledColor",_p.getDisabledColor,_p.setDisabledColor);cc.defineGetterSetter(_p,"label",_p.getLabel,_p.setLabel);cc.MenuItemLabel.create=function(a,b,c){return new cc.MenuItemLabel(a,b,c)};
cc.MenuItemAtlasFont=cc.MenuItemLabel.extend({ctor:function(a,b,c,d,e,f,h){var k;a&&0<a.length&&(k=new cc.LabelAtlas(a,b,c,d,e));cc.MenuItemLabel.prototype.ctor.call(this,k,f,h)},initWithString:function(a,b,c,d,e,f,h){if(!a||0===a.length)throw Error("cc.MenuItemAtlasFont.initWithString(): value should be non-null and its length should be greater than 0");var k=new cc.LabelAtlas;k.initWithString(a,b,c,d,e);this.initWithLabel(k,f,h);return!0}});
cc.MenuItemAtlasFont.create=function(a,b,c,d,e,f,h){return new cc.MenuItemAtlasFont(a,b,c,d,e,f,h)};
cc.MenuItemFont=cc.MenuItemLabel.extend({_fontSize:null,_fontName:null,ctor:function(a,b,c){var d;a&&0<a.length?(this._fontName=cc._globalFontName,this._fontSize=cc._globalFontSize,d=new cc.LabelTTF(a,this._fontName,this._fontSize)):(this._fontSize=0,this._fontName="");cc.MenuItemLabel.prototype.ctor.call(this,d,b,c)},initWithString:function(a,b,c){if(!a||0===a.length)throw Error("Value should be non-null and its length should be greater than 0");this._fontName=cc._globalFontName;this._fontSize=cc._globalFontSize;
a=new cc.LabelTTF(a,this._fontName,this._fontSize);this.initWithLabel(a,b,c);return!0},setFontSize:function(a){this._fontSize=a;this._recreateLabel()},getFontSize:function(){return this._fontSize},setFontName:function(a){this._fontName=a;this._recreateLabel()},getFontName:function(){return this._fontName},_recreateLabel:function(){var a=new cc.LabelTTF(this._label.string,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};_p=cc.MenuItemFont.prototype;cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.MenuItemFont.fontName=function(){return cc._globalFontName};
cc.MenuItemFont.create=function(a,b,c){return new cc.MenuItemFont(a,b,c)};
cc.MenuItemSprite=cc.MenuItem.extend({_normalImage:null,_selectedImage:null,_disabledImage:null,ctor:function(a,b,c,d,e){cc.MenuItem.prototype.ctor.call(this);this._disabledImage=this._selectedImage=this._normalImage=null;this._loader=new cc.Sprite.LoadManager;if(void 0!==a){b=b||null;var f,h,k;void 0!==e?(f=c,k=d,h=e):void 0!==d&&cc.isFunction(d)?(f=c,k=d):void 0!==d&&cc.isFunction(c)?(h=d,k=c,f=null):void 0===c&&(f=null);this._loader.clear();if(a.textureLoaded&&!a.textureLoaded())return this._loader.once(a,
function(){this.initWithNormalSprite(a,b,f,k,h)},this),!1;this.initWithNormalSprite(a,b,f,k,h);return!0}},getNormalImage:function(){return this._normalImage},setNormalImage:function(a){this._normalImage!==a&&(a&&(this.addChild(a,0,cc.NORMAL_TAG),a.anchorX=0,a.anchorY=0),this._normalImage&&this.removeChild(this._normalImage,!0),this._normalImage=a)&&(this.width=this._normalImage.width,this.height=this._normalImage.height,this._updateImagesVisibility(),a.textureLoaded&&!a.textureLoaded()&&a.addEventListener("load",
function(a){this.width=a.width;this.height=a.height;this.parent instanceof cc.Menu&&this.parent.updateAlign()},this))},getSelectedImage:function(){return this._selectedImage},setSelectedImage:function(a){this._selectedImage!==a&&(a&&(this.addChild(a,0,cc.SELECTED_TAG),a.anchorX=0,a.anchorY=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.anchorX=0,a.anchorY=0),this._disabledImage&&this.removeChild(this._disabledImage,!0),this._disabledImage=a,this._updateImagesVisibility())},initWithNormalSprite:function(a,b,c,d,e){this._loader.clear();if(a.textureLoaded&&!a.textureLoaded())return this._loader.once(a,function(){this.initWithNormalSprite(a,b,c,d,e)},this),!1;this.initWithCallback(d,e);this.setNormalImage(a);this.setSelectedImage(b);this.setDisabledImage(c);var f=this._normalImage;f&&(this.width=
f.width,this.height=f.height);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},selected:function(){cc.MenuItem.prototype.selected.call(this);this._normalImage&&(this._disabledImage&&(this._disabledImage.visible=!1),this._selectedImage?(this._normalImage.visible=!1,this._selectedImage.visible=!0):this._normalImage.visible=!0)},unselected:function(){cc.MenuItem.prototype.unselected.call(this);this._normalImage&&(this._normalImage.visible=!0,this._selectedImage&&(this._selectedImage.visible=
!1),this._disabledImage&&(this._disabledImage.visible=!1))},setEnabled:function(a){this._enabled!==a&&(cc.MenuItem.prototype.setEnabled.call(this,a),this._updateImagesVisibility())},_updateImagesVisibility:function(){var a=this._normalImage,b=this._selectedImage,c=this._disabledImage;this._enabled?(a&&(a.visible=!0),b&&(b.visible=!1),c&&(c.visible=!1)):c?(a&&(a.visible=!1),b&&(b.visible=!1),c&&(c.visible=!0)):(a&&(a.visible=!0),b&&(b.visible=!1))}});_p=cc.MenuItemSprite.prototype;
cc.defineGetterSetter(_p,"normalImage",_p.getNormalImage,_p.setNormalImage);cc.defineGetterSetter(_p,"selectedImage",_p.getSelectedImage,_p.setSelectedImage);cc.defineGetterSetter(_p,"disabledImage",_p.getDisabledImage,_p.setDisabledImage);cc.MenuItemSprite.create=function(a,b,c,d,e){return new cc.MenuItemSprite(a,b,c,d,e||void 0)};
cc.MenuItemImage=cc.MenuItemSprite.extend({ctor:function(a,b,c,d,e){var f=null,h=null,k=null,m=null,n=null;void 0===a||null===a?cc.MenuItemSprite.prototype.ctor.call(this):(f=new cc.Sprite(a),b&&(h=new cc.Sprite(b)),void 0===d?m=c:void 0===e?(m=c,n=d):e&&(k=new cc.Sprite(c),m=d,n=e),cc.MenuItemSprite.prototype.ctor.call(this,f,h,k,m,n))},setNormalSpriteFrame:function(a){this.setNormalImage(new cc.Sprite(a))},setSelectedSpriteFrame:function(a){this.setSelectedImage(new cc.Sprite(a))},setDisabledSpriteFrame:function(a){this.setDisabledImage(new cc.Sprite(a))},
initWithNormalImage:function(a,b,c,d,e){var f=null,h=null,k=null;a&&(f=new cc.Sprite(a));b&&(h=new cc.Sprite(b));c&&(k=new cc.Sprite(c));return this.initWithNormalSprite(f,h,k,d,e)}});cc.MenuItemImage.create=function(a,b,c,d,e){return new cc.MenuItemImage(a,b,c,d,e)};
cc.MenuItemToggle=cc.MenuItem.extend({subItems:null,_selectedIndex:0,_opacity:null,_color:null,ctor:function(){cc.MenuItem.prototype.ctor.call(this);this._selectedIndex=0;this.subItems=[];this._opacity=0;this._color=cc.color.WHITE;0<arguments.length&&this.initWithItems(Array.prototype.slice.apply(arguments))},getOpacity:function(){return this._opacity},setOpacity:function(a){this._opacity=a;if(this.subItems&&0<this.subItems.length)for(var b=0;b<this.subItems.length;b++)this.subItems[b].opacity=a;
this._color.a=a},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b;if(this.subItems&&0<this.subItems.length)for(b=0;b<this.subItems.length;b++)this.subItems[b].setColor(a);void 0===a.a||a.a_undefined||this.setOpacity(a.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 b=a.width,c=a.height;this.width=b;this.height=c;a.setPosition(b/2,c/2)}},getSubItems:function(){return this.subItems},setSubItems:function(a){this.subItems=a},initWithItems:function(a){var b=a.length;cc.isFunction(a[a.length-2])?(this.initWithCallback(a[a.length-2],a[a.length-1]),b-=2):cc.isFunction(a[a.length-1])?(this.initWithCallback(a[a.length-1],null),b-=1):this.initWithCallback(null,null);for(var c=this.subItems,d=c.length=
0;d<b;d++)a[d]&&c.push(a[d]);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._enabled&&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._enabled!==a){cc.MenuItem.prototype.setEnabled.call(this,a);var b=this.subItems;if(b&&0<b.length)for(var c=0;c<b.length;c++)b[c].enabled=a}},selectedItem:function(){return this.subItems[this._selectedIndex]},getSelectedItem:function(){return this.subItems[this._selectedIndex]},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.setSelectedIndex(this._selectedIndex)}});_p=cc.MenuItemToggle.prototype;
cc.defineGetterSetter(_p,"selectedIndex",_p.getSelectedIndex,_p.setSelectedIndex);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(Array.prototype.slice.apply(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.Layer.extend({enabled:!1,_selectedItem:null,_state:-1,_touchListener:null,_className:"Menu",ctor:function(a){cc.Layer.prototype.ctor.call(this);this._color=cc.color.WHITE;this.enabled=!1;this._opacity=255;this._selectedItem=null;this._state=-1;this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0,onTouchBegan:this._onTouchBegan,onTouchMoved:this._onTouchMoved,onTouchEnded:this._onTouchEnded,onTouchCancelled:this._onTouchCancelled});var b=
arguments.length,c;if(a instanceof Array)c=a;else if(0===b)c=[];else if(0<b){c=[];for(var d=0;d<b;d++)arguments[d]&&c.push(arguments[d])}this.initWithArray(c)},onEnter:function(){var a=this._touchListener;a._isRegistered()||cc.eventManager.addListener(a,this);cc.Node.prototype.onEnter.call(this)},isEnabled:function(){return this.enabled},setEnabled:function(a){this.enabled=a},initWithItems:function(a){var b=[];if(a)for(var c=0;c<a.length;c++)a[c]&&b.push(a[c]);return this.initWithArray(b)},initWithArray:function(a){if(cc.Layer.prototype.init.call(this)){this.enabled=
!0;var b=cc.winSize;this.setPosition(b.width/2,b.height/2);this.setContentSize(b);this.setAnchorPoint(0.5,0.5);this.ignoreAnchorPointForPosition(!0);if(a)for(b=0;b<a.length;b++)this.addChild(a[b],b);this._selectedItem=null;this._state=cc.MENU_STATE_WAITING;return this.cascadeOpacity=this.cascadeColor=!0}return!1},addChild:function(a,b,c){if(!(a instanceof cc.MenuItem))throw Error("cc.Menu.addChild() : Menu only supports MenuItem objects as children");cc.Layer.prototype.addChild.call(this,a,b,c)},
updateAlign:function(){switch(this._align){case "vertically":this.alignItemsVertically();break;case "horizontally":this.alignItemsHorizontally()}},alignItemsVertically:function(){this.alignItemsVerticallyWithPadding(cc.DEFAULT_PADDING)},alignItemsVerticallyWithPadding:function(a){this._align="vertically";var b=-a,c=this._children,d,e,f,h;if(c&&0<c.length){e=0;for(d=c.length;e<d;e++)b+=c[e].height*c[e].scaleY+a;var k=b/2;e=0;for(d=c.length;e<d;e++)h=c[e],f=h.height,b=h.scaleY,h.setPosition(0,k-f*b/
2),k-=f*b+a}},alignItemsHorizontally:function(){this.alignItemsHorizontallyWithPadding(cc.DEFAULT_PADDING)},alignItemsHorizontallyWithPadding:function(a){this._align="horizontally";var b=-a,c=this._children,d,e,f,h;if(c&&0<c.length){d=0;for(e=c.length;d<e;d++)b+=c[d].width*c[d].scaleX+a;var k=-b/2;d=0;for(e=c.length;d<e;d++)h=c[d],b=h.scaleX,f=c[d].width,h.setPosition(k+f*b/2,0),k+=f*b+a}},alignItemsInColumns:function(){0<arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");
var a,b=[];for(a=0;a<arguments.length;a++)b.push(arguments[a]);var c=-5,d=0,e=0,f=0,h,k,m,n=this._children;if(n&&0<n.length)for(a=0,m=n.length;a<m;a++)d>=b.length||!(h=b[d])||(k=n[a].height,e=e>=k||isNaN(k)?e:k,++f,f>=h&&(c+=e+5,e=f=0,++d));var p=cc.director.getWinSize(),r=h=e=d=0,s=0,c=c/2;if(n&&0<n.length)for(a=0,m=n.length;a<m;a++){var t=n[a];0===h&&(h=b[d],s=r=p.width/(1+h));k=t._getHeight();e=e>=k||isNaN(k)?e:k;t.setPosition(s-p.width/2,c-k/2);s+=r;++f;f>=h&&(c-=e+5,e=h=f=0,++d)}},alignItemsInRows:function(){0<
arguments.length&&null==arguments[arguments.length-1]&&cc.log("parameters should not be ending with null in Javascript");var a,b=[];for(a=0;a<arguments.length;a++)b.push(arguments[a]);var c=[],d=[],e=-10,f=-5,h=0,k=0,m=0,n,p,r,s,t=this._children;if(t&&0<t.length)for(a=0,r=t.length;a<r;a++)(p=t[a],h>=b.length||!(n=b[h]))||(s=p.width,k=k>=s||isNaN(s)?k:s,f+=p.height+5,++m,m>=n&&(c.push(k),d.push(f),e+=k+10,k=m=0,f=-5,++h));f=cc.director.getWinSize();n=k=h=0;var e=-e/2,w=0;if(t&&0<t.length)for(a=0,r=
t.length;a<r;a++)p=t[a],0===n&&(n=b[h],w=d[h]),s=p._getWidth(),k=k>=s||isNaN(s)?k:s,p.setPosition(e+c[h]/2,w-f.height/2),w-=p.height+10,++m,m>=n&&(e+=k+5,k=n=m=0,++h)},removeChild:function(a,b){null!=a&&(a instanceof cc.MenuItem?(this._selectedItem===a&&(this._selectedItem=null),cc.Node.prototype.removeChild.call(this,a,b)):cc.log("cc.Menu.removeChild():Menu only supports MenuItem objects as children"))},_onTouchBegan:function(a,b){var c=b.getCurrentTarget();if(c._state!==cc.MENU_STATE_WAITING||!c._visible||
!c.enabled)return!1;for(var d=c.parent;null!=d;d=d.parent)if(!d.isVisible())return!1;c._selectedItem=c._itemForTouch(a);return c._selectedItem?(c._state=cc.MENU_STATE_TRACKING_TOUCH,c._selectedItem.selected(),c._selectedItem.setNodeDirty(),!0):!1},_onTouchEnded:function(a,b){var c=b.getCurrentTarget();c._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchEnded(): invalid state"):(c._selectedItem&&(c._selectedItem.unselected(),c._selectedItem.setNodeDirty(),c._selectedItem.activate()),c._state=
cc.MENU_STATE_WAITING)},_onTouchCancelled:function(a,b){var c=b.getCurrentTarget();c._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchCancelled(): invalid state"):(c._selectedItem&&(c._selectedItem.unselected(),c._selectedItem.setNodeDirty()),c._state=cc.MENU_STATE_WAITING)},_onTouchMoved:function(a,b){var c=b.getCurrentTarget();if(c._state!==cc.MENU_STATE_TRACKING_TOUCH)cc.log("cc.Menu.onTouchMoved(): invalid state");else{var d=c._itemForTouch(a);d!==c._selectedItem&&(c._selectedItem&&
(c._selectedItem.unselected(),c._selectedItem.setNodeDirty()),c._selectedItem=d,c._selectedItem&&(c._selectedItem.selected(),c._selectedItem.setNodeDirty()))}},onExit:function(){this._state===cc.MENU_STATE_TRACKING_TOUCH&&(this._selectedItem&&(this._selectedItem.unselected(),this._selectedItem=null),this._state=cc.MENU_STATE_WAITING);cc.Node.prototype.onExit.call(this)},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_itemForTouch:function(a){a=a.getLocation();var b=this._children,
c;if(b&&0<b.length)for(var d=b.length-1;0<=d;d--)if(c=b[d],c.isVisible()&&c.isEnabled()){var e=c.convertToNodeSpace(a),f=c.rect();f.x=0;f.y=0;if(cc.rectContainsPoint(f,e))return c}return null}});_p=cc.Menu.prototype;cc.Menu.create=function(a){var b=arguments.length;0<b&&null==arguments[b-1]&&cc.log("parameters should not be ending with null in Javascript");return 0===b?new cc.Menu:1===b?new cc.Menu(a):new cc.Menu(Array.prototype.slice.call(arguments,0))};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 b=0,c=a;c--;)b=b<<1|this.readBit();a&&(b=cc.Codec.GZip.bitReverse[b]>>8-a);return b};cc.Codec.GZip.prototype.flushBuffer=function(){this.bIdx=0};cc.Codec.GZip.prototype.addBuffer=function(a){this.buf32k[this.bIdx++]=a;this.outputArr.push(String.fromCharCode(a));32768===this.bIdx&&(this.bIdx=0)};
cc.Codec.GZip.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}};
cc.Codec.GZip.prototype.Rec=function(){var a=this.Places[this.treepos],b;if(17===this.len)return-1;this.treepos++;this.len++;b=this.IsPat();if(0<=b)a.b0=b;else if(a.b0=32768,this.Rec())return-1;b=this.IsPat();if(0<=b)a.b1=b,a.jump=null;else if(a.b1=32768,a.jump=this.Places[this.treepos],a.jumppos=this.treepos,this.Rec())return-1;this.len--;return 0};
cc.Codec.GZip.prototype.CreateTree=function(a,b,c,d){this.Places=a;this.treepos=0;this.flens=c;this.fmax=b;for(a=0;17>a;a++)this.fpos[a]=0;this.len=0;return this.Rec()?-1:0};cc.Codec.GZip.prototype.DecodeValue=function(a){for(var b,c,d=0,e=a[d];;)if(b=this.readBit()){if(!(e.b1&32768))return e.b1;e=e.jump;b=a.length;for(c=0;c<b;c++)if(a[c]===e){d=c;break}}else{if(!(e.b0&32768))return e.b0;d++;e=a[d]}return-1};
cc.Codec.GZip.prototype.DeflateLoop=function(){var a,b,c,d,e;do if(a=this.readBit(),c=this.readBits(2),0===c)for(this.byteAlign(),c=this.readByte(),c|=this.readByte()<<8,b=this.readByte(),b|=this.readByte()<<8,(c^~b)&65535&&document.write("BlockLen checksum mismatch\n");c--;)b=this.readByte(),this.addBuffer(b);else if(1===c)for(;;)if(c=cc.Codec.GZip.bitReverse[this.readBits(7)]>>1,23<c?(c=c<<1|this.readBit(),199<c?(c-=128,c=c<<1|this.readBit()):(c-=48,143<c&&(c+=136))):c+=256,256>c)this.addBuffer(c);
else if(256===c)break;else{var f;c-=257;e=this.readBits(cc.Codec.GZip.cplext[c])+cc.Codec.GZip.cplens[c];c=cc.Codec.GZip.bitReverse[this.readBits(5)]>>3;8<cc.Codec.GZip.cpdext[c]?(f=this.readBits(8),f|=this.readBits(cc.Codec.GZip.cpdext[c]-8)<<8):f=this.readBits(cc.Codec.GZip.cpdext[c]);f+=cc.Codec.GZip.cpdist[c];for(c=0;c<e;c++)b=this.buf32k[this.bIdx-f&32767],this.addBuffer(b)}else if(2===c){var h=Array(320);b=257+this.readBits(5);f=1+this.readBits(5);d=4+this.readBits(4);for(c=0;19>c;c++)h[c]=
0;for(c=0;c<d;c++)h[cc.Codec.GZip.border[c]]=this.readBits(3);e=this.distanceTree.length;for(d=0;d<e;d++)this.distanceTree[d]=new cc.Codec.GZip.HufNode;if(this.CreateTree(this.distanceTree,19,h,0))return this.flushBuffer(),1;e=b+f;d=0;for(var k=-1;d<e;)if(k++,c=this.DecodeValue(this.distanceTree),16>c)h[d++]=c;else if(16===c){var m;c=3+this.readBits(2);if(d+c>e)return this.flushBuffer(),1;for(m=d?h[d-1]:0;c--;)h[d++]=m}else{c=17===c?3+this.readBits(3):11+this.readBits(7);if(d+c>e)return this.flushBuffer(),
1;for(;c--;)h[d++]=0}e=this.literalTree.length;for(d=0;d<e;d++)this.literalTree[d]=new cc.Codec.GZip.HufNode;if(this.CreateTree(this.literalTree,b,h,0))return this.flushBuffer(),1;e=this.literalTree.length;for(d=0;d<e;d++)this.distanceTree[d]=new cc.Codec.GZip.HufNode;c=[];for(d=b;d<h.length;d++)c[d-b]=h[d];if(this.CreateTree(this.distanceTree,f,c,0))return this.flushBuffer(),1;for(;;)if(c=this.DecodeValue(this.literalTree),256<=c){c-=256;if(0===c)break;c--;e=this.readBits(cc.Codec.GZip.cplext[c])+
cc.Codec.GZip.cplens[c];c=this.DecodeValue(this.distanceTree);8<cc.Codec.GZip.cpdext[c]?(f=this.readBits(8),f|=this.readBits(cc.Codec.GZip.cpdext[c]-8)<<8):f=this.readBits(cc.Codec.GZip.cpdext[c]);for(f+=cc.Codec.GZip.cpdist[c];e--;)b=this.buf32k[this.bIdx-f&32767],this.addBuffer(b)}else this.addBuffer(c)}while(!a);this.flushBuffer();this.byteAlign();return 0};cc.Codec.GZip.prototype.unzipFile=function(a){var b;this.gunzip();for(b=0;b<this.unzipped.length;b++)if(this.unzipped[b][1]===a)return this.unzipped[b][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 b=this.readByte(),b=b|this.readByte()<<8,c=this.readByte(),c=c|this.readByte()<<8,d=0;for(this.nameBuf=[];b--;){var e=this.readByte();"/"===e|":"===e?d=0:d<cc.Codec.GZip.NAMEMAX-1&&(this.nameBuf[d++]=String.fromCharCode(e))}this.fileout||
(this.fileout=this.nameBuf);for(var d=0;d<c;)this.readByte(),d++;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=[],b;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=[];b=this.readByte();){if("7"===b||":"===b)a=0;a<cc.Codec.GZip.NAMEMAX-1&&(this.nameBuf[a++]=b)}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 b(a,b){var c=a.split("."),d=A;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||b===u?d=d[e]?d[e]:d[e]={}:d[e]=b}function c(a){if("string"===typeof a){a=a.split("");var b,c;b=0;for(c=a.length;b<c;b++)a[b]=(a[b].charCodeAt(0)&255)>>>0}b=1;c=0;for(var d=a.length,e,f=0;0<d;){e=1024<d?1024:d;d-=e;do b+=a[f++],c+=b;while(--e);b%=65521;c%=65521}return(c<<16|b)>>>0}function d(b,c){this.index="number"===typeof c?c:0;
this.i=0;this.buffer=b instanceof(B?Uint8Array:Array)?b:new (B?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&a(Error("invalid index"));this.buffer.length<=this.index&&this.f()}function e(a){this.buffer=new (B?Uint16Array:Array)(2*a);this.length=0}function f(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,e,f,h,k,m,n,p,r,t;for(r=0;r<b;++r)a[r]>c&&(c=a[r]),a[r]<d&&(d=a[r]);e=1<<c;f=new (B?Uint32Array:Array)(e);h=1;k=0;for(m=2;h<=c;){for(r=0;r<b;++r)if(a[r]===h){n=0;p=k;for(t=0;t<h;++t)n=
n<<1|p&1,p>>=1;for(t=n;t<e;t+=m)f[t]=h<<16|r;++k}++h;k<<=1;m<<=1}return[f,c,d]}function h(a,b){this.h=L;this.w=0;this.input=a;this.b=0;b&&(b.lazy&&(this.w=b.lazy),"number"===typeof b.compressionType&&(this.h=b.compressionType),b.outputBuffer&&(this.a=B&&b.outputBuffer instanceof Array?new Uint8Array(b.outputBuffer):b.outputBuffer),"number"===typeof b.outputIndex&&(this.b=b.outputIndex));this.a||(this.a=new (B?Uint8Array:Array)(32768))}function k(a,b){this.length=a;this.G=b}function m(){var b=M;switch(z){case 3===
b:return[257,b-3,0];case 4===b:return[258,b-4,0];case 5===b:return[259,b-5,0];case 6===b:return[260,b-6,0];case 7===b:return[261,b-7,0];case 8===b:return[262,b-8,0];case 9===b:return[263,b-9,0];case 10===b:return[264,b-10,0];case 12>=b:return[265,b-11,1];case 14>=b:return[266,b-13,1];case 16>=b:return[267,b-15,1];case 18>=b:return[268,b-17,1];case 22>=b:return[269,b-19,2];case 26>=b:return[270,b-23,2];case 30>=b:return[271,b-27,2];case 34>=b:return[272,b-31,2];case 42>=b:return[273,b-35,3];case 50>=
b:return[274,b-43,3];case 58>=b:return[275,b-51,3];case 66>=b:return[276,b-59,3];case 82>=b:return[277,b-67,4];case 98>=b:return[278,b-83,4];case 114>=b:return[279,b-99,4];case 130>=b:return[280,b-115,4];case 162>=b:return[281,b-131,5];case 194>=b:return[282,b-163,5];case 226>=b:return[283,b-195,5];case 257>=b:return[284,b-227,5];case 258===b:return[285,b-258,0];default:a("invalid length: "+b)}}function n(b,c){function d(b,c){var e=b.G,f=[],h=0,k;k=F[b.length];f[h++]=k&65535;f[h++]=k>>16&255;f[h++]=
k>>24;var m;switch(z){case 1===e:m=[0,e-1,0];break;case 2===e:m=[1,e-2,0];break;case 3===e:m=[2,e-3,0];break;case 4===e:m=[3,e-4,0];break;case 6>=e:m=[4,e-5,1];break;case 8>=e:m=[5,e-7,1];break;case 12>=e:m=[6,e-9,2];break;case 16>=e:m=[7,e-13,2];break;case 24>=e:m=[8,e-17,3];break;case 32>=e:m=[9,e-25,3];break;case 48>=e:m=[10,e-33,4];break;case 64>=e:m=[11,e-49,4];break;case 96>=e:m=[12,e-65,5];break;case 128>=e:m=[13,e-97,5];break;case 192>=e:m=[14,e-129,6];break;case 256>=e:m=[15,e-193,6];break;
case 384>=e:m=[16,e-257,7];break;case 512>=e:m=[17,e-385,7];break;case 768>=e:m=[18,e-513,8];break;case 1024>=e:m=[19,e-769,8];break;case 1536>=e:m=[20,e-1025,9];break;case 2048>=e:m=[21,e-1537,9];break;case 3072>=e:m=[22,e-2049,10];break;case 4096>=e:m=[23,e-3073,10];break;case 6144>=e:m=[24,e-4097,11];break;case 8192>=e:m=[25,e-6145,11];break;case 12288>=e:m=[26,e-8193,12];break;case 16384>=e:m=[27,e-12289,12];break;case 24576>=e:m=[28,e-16385,13];break;case 32768>=e:m=[29,e-24577,13];break;default:a("invalid distance")}k=
m;f[h++]=k[0];f[h++]=k[1];f[h++]=k[2];e=0;for(h=f.length;e<h;++e)t[s++]=f[e];w[f[0]]++;y[f[3]]++;v=b.length+c-1;r=null}var e,f,h,m,n,p={},r,t=B?new Uint16Array(2*c.length):[],s=0,v=0,w=new (B?Uint32Array:Array)(286),y=new (B?Uint32Array:Array)(30),x=b.w,A;if(!B){for(h=0;285>=h;)w[h++]=0;for(h=0;29>=h;)y[h++]=0}w[256]=1;e=0;for(f=c.length;e<f;++e){h=n=0;for(m=3;h<m&&e+h!==f;++h)n=n<<8|c[e+h];p[n]===u&&(p[n]=[]);h=p[n];if(!(0<v--)){for(;0<h.length&&32768<e-h[0];)h.shift();if(e+3>=f){r&&d(r,-1);h=0;
for(m=f-e;h<m;++h)A=c[e+h],t[s++]=A,++w[A];break}if(0<h.length){n=m=u;var C=0,D=u,E=u,G=D=u,H=c.length,E=0,G=h.length;a:for(;E<G;E++){m=h[G-E-1];D=3;if(3<C){for(D=C;3<D;D--)if(c[m+D-1]!==c[e+D-1])continue a;D=C}for(;258>D&&e+D<H&&c[m+D]===c[e+D];)++D;D>C&&(n=m,C=D);if(258===D)break}m=new k(C,e-n);r?r.length<m.length?(A=c[e-1],t[s++]=A,++w[A],d(m,0)):d(r,-1):m.length<x?r=m:d(m,0)}else r?d(r,-1):(A=c[e],t[s++]=A,++w[A])}h.push(e)}t[s++]=256;w[256]++;b.L=w;b.K=y;return B?t.subarray(0,s):t}function p(a,
b){function c(a){var b=t[a][s[a]];b===p?(c(a+1),c(a+1)):--r[b];++s[a]}var d=a.length,f=new e(572),h=new (B?Uint8Array:Array)(d),k,m,n;if(!B)for(m=0;m<d;m++)h[m]=0;for(m=0;m<d;++m)0<a[m]&&f.push(m,a[m]);d=Array(f.length/2);k=new (B?Uint32Array:Array)(f.length/2);if(1===d.length)return h[f.pop().index]=1,h;m=0;for(n=f.length/2;m<n;++m)d[m]=f.pop(),k[m]=d[m].value;var p=k.length;m=new (B?Uint16Array:Array)(b);var f=new (B?Uint8Array:Array)(b),r=new (B?Uint8Array:Array)(p);n=Array(b);var t=Array(b),s=
Array(b),v=(1<<b)-p,w=1<<b-1,y,x,u;m[b-1]=p;for(y=0;y<b;++y)v<w?f[y]=0:(f[y]=1,v-=w),v<<=1,m[b-2-y]=(m[b-1-y]/2|0)+p;m[0]=f[0];n[0]=Array(m[0]);t[0]=Array(m[0]);for(y=1;y<b;++y)m[y]>2*m[y-1]+f[y]&&(m[y]=2*m[y-1]+f[y]),n[y]=Array(m[y]),t[y]=Array(m[y]);for(v=0;v<p;++v)r[v]=b;for(w=0;w<m[b-1];++w)n[b-1][w]=k[w],t[b-1][w]=w;for(v=0;v<b;++v)s[v]=0;1===f[b-1]&&(--r[0],++s[b-1]);for(y=b-2;0<=y;--y){x=v=0;u=s[y+1];for(w=0;w<m[y];w++)x=n[y+1][u]+n[y+1][u+1],x>k[v]?(n[y][w]=x,t[y][w]=p,u+=2):(n[y][w]=k[v],
t[y][w]=v,++v);s[y]=0;1===f[y]&&c(y)}k=r;m=0;for(n=d.length;m<n;++m)h[d[m].index]=k[m];return h}function r(b){var c=new (B?Uint16Array:Array)(b.length),d=[],e=[],f=0,h,k,m;h=0;for(k=b.length;h<k;h++)d[b[h]]=(d[b[h]]|0)+1;h=1;for(k=16;h<=k;h++)e[h]=f,f+=d[h]|0,f>1<<h&&a("overcommitted"),f<<=1;65536>f&&a("undercommitted");h=0;for(k=b.length;h<k;h++)for(f=e[b[h]],e[b[h]]+=1,d=c[h]=0,m=b[h];d<m;d++)c[h]=c[h]<<1|f&1,f>>>=1;return c}function s(a,b){this.input=a;this.a=new (B?Uint8Array:Array)(32768);this.h=
N.j;var c={},d;!b&&(b={})||"number"!==typeof b.compressionType||(this.h=b.compressionType);for(d in b)c[d]=b[d];c.outputBuffer=this.a;this.z=new h(this.input,c)}function t(b,c){this.k=[];this.l=32768;this.e=this.g=this.c=this.q=0;this.input=B?new Uint8Array(b):b;this.s=!1;this.m=P;this.B=!1;if(c||!(c={}))c.index&&(this.c=c.index),c.bufferSize&&(this.l=c.bufferSize),c.bufferType&&(this.m=c.bufferType),c.resize&&(this.B=c.resize);switch(this.m){case O:this.b=32768;this.a=new (B?Uint8Array:Array)(32768+
this.l+258);break;case P:this.b=0;this.a=new (B?Uint8Array:Array)(this.l);this.f=this.J;this.t=this.H;this.o=this.I;break;default:a(Error("invalid inflate mode"))}}function w(b,c){for(var d=b.g,e=b.e,f=b.input,h=b.c,k;e<c;)k=f[h++],k===u&&a(Error("input buffer is broken")),d|=k<<e,e+=8;b.g=d>>>c;b.e=e-c;b.c=h;return d&(1<<c)-1}function v(b,c){for(var d=b.g,e=b.e,f=b.input,h=b.c,k=c[0],m=c[1],n;e<m;)n=f[h++],n===u&&a(Error("input buffer is broken")),d|=n<<e,e+=8;f=k[d&(1<<m)-1];k=f>>>16;b.g=d>>k;b.e=
e-k;b.c=h;return f&65535}function y(a){function b(a,c,d){var e,f,h,k;for(k=0;k<a;)switch(e=v(this,c),e){case 16:for(h=3+w(this,2);h--;)d[k++]=f;break;case 17:for(h=3+w(this,3);h--;)d[k++]=0;f=0;break;case 18:for(h=11+w(this,7);h--;)d[k++]=0;f=0;break;default:f=d[k++]=e}return d}var c=w(a,5)+257,d=w(a,5)+1,e=w(a,4)+4,h=new (B?Uint8Array:Array)(Q.length),k;for(k=0;k<e;++k)h[Q[k]]=w(a,3);e=f(h);h=new (B?Uint8Array:Array)(c);k=new (B?Uint8Array:Array)(d);a.o(f(b.call(a,c,e,h)),f(b.call(a,d,e,k)))}function x(b,
c){var d,e;this.input=b;this.c=0;if(c||!(c={}))c.index&&(this.c=c.index),c.verify&&(this.M=c.verify);d=b[this.c++];e=b[this.c++];switch(d&15){case X:this.method=X;break;default:a(Error("unsupported compression method"))}0!==((d<<8)+e)%31&&a(Error("invalid fcheck flag:"+((d<<8)+e)%31));e&32&&a(Error("fdict flag is not supported"));this.A=new t(b,{index:this.c,bufferSize:c.bufferSize,bufferType:c.bufferType,resize:c.resize})}var u=void 0,z=!0,A=this,B="undefined"!==typeof Uint8Array&&"undefined"!==
typeof Uint16Array&&"undefined"!==typeof Uint32Array;d.prototype.f=function(){var a=this.buffer,b,c=a.length,d=new (B?Uint8Array:Array)(c<<1);if(B)d.set(a);else for(b=0;b<c;++b)d[b]=a[b];return this.buffer=d};d.prototype.d=function(a,b,c){var d=this.buffer,e=this.index,f=this.i,h=d[e];c&&1<b&&(a=8<b?(H[a&255]<<24|H[a>>>8&255]<<16|H[a>>>16&255]<<8|H[a>>>24&255])>>32-b:H[a]>>8-b);if(8>b+f)h=h<<b|a,f+=b;else for(c=0;c<b;++c)h=h<<1|a>>b-c-1&1,8===++f&&(f=0,d[e++]=H[h],h=0,e===d.length&&(d=this.f()));
d[e]=h;this.buffer=d;this.i=f;this.index=e};d.prototype.finish=function(){var a=this.buffer,b=this.index,c;0<this.i&&(a[b]<<=8-this.i,a[b]=H[a[b]],b++);B?c=a.subarray(0,b):(a.length=b,c=a);return c};var D=new (B?Uint8Array:Array)(256),C;for(C=0;256>C;++C){for(var E=C,J=E,G=7,E=E>>>1;E;E>>>=1)J<<=1,J|=E&1,--G;D[C]=(J<<G&255)>>>0}var H=D,D=[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];B&&new Uint32Array(D);e.prototype.getParent=function(a){return 2*((a-2)/4|0)};e.prototype.push=function(a,b){var c,d,e=this.buffer,f;c=this.length;e[this.length++]=b;for(e[this.length++]=a;0<c;)if(d=this.getParent(c),e[c]>e[d])f=e[c],e[c]=e[d],e[d]=f,f=e[c+1],e[c+1]=e[d+1],e[d+1]=f,c=d;else break;return this.length};e.prototype.pop=function(){var a,b,c=this.buffer,d,e,f;b=c[0];a=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f=
0;;){e=2*f+2;if(e>=this.length)break;e+2<this.length&&c[e+2]>c[e]&&(e+=2);if(c[e]>c[f])d=c[f],c[f]=c[e],c[e]=d,d=c[f+1],c[f+1]=c[e+1],c[e+1]=d;else break;f=e}return{index:a,value:b,length:this.length}};var L=2,D={NONE:0,r:1,j:L,N:3},I=[];for(C=0;288>C;C++)switch(z){case 143>=C:I.push([C+48,8]);break;case 255>=C:I.push([C-144+400,9]);break;case 279>=C:I.push([C-256+0,7]);break;case 287>=C:I.push([C-280+192,8]);break;default:a("invalid literal: "+C)}h.prototype.n=function(){var b,c,e,f,h=this.input;
switch(this.h){case 0:e=0;for(f=h.length;e<f;){c=B?h.subarray(e,e+65535):h.slice(e,e+65535);e+=c.length;var k=e===f,m=u,t=m=u,t=m=u,s=this.a,v=this.b;if(B){for(s=new Uint8Array(this.a.buffer);s.length<=v+c.length+5;)s=new Uint8Array(s.length<<1);s.set(this.a)}m=k?1:0;s[v++]=m|0;m=c.length;t=~m+65536&65535;s[v++]=m&255;s[v++]=m>>>8&255;s[v++]=t&255;s[v++]=t>>>8&255;if(B)s.set(c,v),v+=c.length,s=s.subarray(0,v);else{m=0;for(t=c.length;m<t;++m)s[v++]=c[m];s.length=v}this.b=v;this.a=s}break;case 1:e=
new d(new Uint8Array(this.a.buffer),this.b);e.d(1,1,z);e.d(1,2,z);h=n(this,h);c=0;for(k=h.length;c<k;c++)if(f=h[c],d.prototype.d.apply(e,I[f]),256<f)e.d(h[++c],h[++c],z),e.d(h[++c],5),e.d(h[++c],h[++c],z);else if(256===f)break;this.a=e.finish();this.b=this.a.length;break;case L:f=new d(new Uint8Array(this.a),this.b);var w,y,x,A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],C,D,m=Array(19),E,s=L;f.d(1,1,z);f.d(s,2,z);h=n(this,h);t=p(this.L,15);C=r(t);s=p(this.K,7);v=r(s);for(w=286;257<w&&0===t[w-
1];w--);for(y=30;1<y&&0===s[y-1];y--);var F=w,G=y;b=new (B?Uint32Array:Array)(F+G);var H=new (B?Uint32Array:Array)(316),J,K;D=new (B?Uint8Array:Array)(19);for(E=x=0;E<F;E++)b[x++]=t[E];for(E=0;E<G;E++)b[x++]=s[E];if(!B)for(E=0,G=D.length;E<G;++E)D[E]=0;E=J=0;for(G=b.length;E<G;E+=x){for(x=1;E+x<G&&b[E+x]===b[E];++x);F=x;if(0===b[E])if(3>F)for(;0<F--;)H[J++]=0,D[0]++;else for(;0<F;)K=138>F?F:138,K>F-3&&K<F&&(K=F-3),10>=K?(H[J++]=17,H[J++]=K-3,D[17]++):(H[J++]=18,H[J++]=K-11,D[18]++),F-=K;else if(H[J++]=
b[E],D[b[E]]++,F--,3>F)for(;0<F--;)H[J++]=b[E],D[b[E]]++;else for(;0<F;)K=6>F?F:6,K>F-3&&K<F&&(K=F-3),H[J++]=16,H[J++]=K-3,D[16]++,F-=K}b=B?H.subarray(0,J):H.slice(0,J);D=p(D,7);for(E=0;19>E;E++)m[E]=D[A[E]];for(x=19;4<x&&0===m[x-1];x--);A=r(D);f.d(w-257,5,z);f.d(y-1,5,z);f.d(x-4,4,z);for(E=0;E<x;E++)f.d(m[E],3,z);E=0;for(m=b.length;E<m;E++)if(c=b[E],f.d(A[c],D[c],z),16<=c){E++;switch(c){case 16:k=2;break;case 17:k=3;break;case 18:k=7;break;default:a("invalid code: "+c)}f.d(b[E],k,z)}k=[C,t];v=[v,
s];c=k[0];k=k[1];s=v[0];C=v[1];v=0;for(m=h.length;v<m;++v)if(e=h[v],f.d(c[e],k[e],z),256<e)f.d(h[++v],h[++v],z),t=h[++v],f.d(s[t],C[t],z),f.d(h[++v],h[++v],z);else if(256===e)break;this.a=f.finish();this.b=this.a.length;break;default:a("invalid compression type")}return this.a};C=[];var M;for(M=3;258>=M;M++)E=m(),C[M]=E[2]<<24|E[1]<<16|E[0];var F=B?new Uint32Array(C):C,N=D;s.prototype.n=function(){var b,d,e,f,h=0;f=this.a;b=X;switch(b){case X:d=Math.LOG2E*Math.log(32768)-8;break;default:a(Error("invalid compression method"))}d=
d<<4|b;f[h++]=d;switch(b){case X:switch(this.h){case N.NONE:e=0;break;case N.r:e=1;break;case N.j:e=2;break;default:a(Error("unsupported compression type"))}break;default:a(Error("invalid compression method"))}b=e<<6|0;f[h++]=b|31-(256*d+b)%31;b=c(this.input);this.z.b=h;f=this.z.n();h=f.length;B&&(f=new Uint8Array(f.buffer),f.length<=h+4&&(this.a=new Uint8Array(f.length+4),this.a.set(f),f=this.a),f=f.subarray(0,h+4));f[h++]=b>>24&255;f[h++]=b>>16&255;f[h++]=b>>8&255;f[h++]=b&255;return f};b("Zlib.Deflate",
s);b("Zlib.Deflate.compress",function(a,b){return(new s(a,b)).n()});b("Zlib.Deflate.CompressionType",N);b("Zlib.Deflate.CompressionType.NONE",N.NONE);b("Zlib.Deflate.CompressionType.FIXED",N.r);b("Zlib.Deflate.CompressionType.DYNAMIC",N.j);var O=0,P=1,D={D:O,C:P};t.prototype.p=function(){for(;!this.s;){var b=w(this,3);b&1&&(this.s=z);b>>>=1;switch(b){case 0:var b=this.input,c=this.c,d=this.a,e=this.b,f=u,h=u,k=u,m=d.length,f=u;this.e=this.g=0;f=b[c++];f===u&&a(Error("invalid uncompressed block header: LEN (first byte)"));
h=f;f=b[c++];f===u&&a(Error("invalid uncompressed block header: LEN (second byte)"));h|=f<<8;f=b[c++];f===u&&a(Error("invalid uncompressed block header: NLEN (first byte)"));k=f;f=b[c++];f===u&&a(Error("invalid uncompressed block header: NLEN (second byte)"));k|=f<<8;h===~k&&a(Error("invalid uncompressed block header: length verify"));c+h>b.length&&a(Error("input buffer is broken"));switch(this.m){case O:for(;e+h>d.length;){f=m-e;h-=f;if(B)d.set(b.subarray(c,c+f),e),e+=f,c+=f;else for(;f--;)d[e++]=
b[c++];this.b=e;d=this.f();e=this.b}break;case P:for(;e+h>d.length;)d=this.f({v:2});break;default:a(Error("invalid inflate mode"))}if(B)d.set(b.subarray(c,c+h),e),e+=h,c+=h;else for(;h--;)d[e++]=b[c++];this.c=c;this.b=e;this.a=d;break;case 1:this.o(K,W);break;case 2:y(this);break;default:a(Error("unknown BTYPE: "+b))}}return this.t()};C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var Q=B?new Uint16Array(C):C;C=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,
258,258,258];var S=B?new Uint16Array(C):C;C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0];var R=B?new Uint8Array(C):C;C=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];var V=B?new Uint16Array(C):C;C=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var U=B?new Uint8Array(C):C;C=new (B?Uint8Array:Array)(288);E=0;for(J=C.length;E<J;++E)C[E]=143>=E?8:255>=E?9:279>=E?7:8;var K=f(C);C=new (B?Uint8Array:
Array)(30);E=0;for(J=C.length;E<J;++E)C[E]=5;var W=f(C);t.prototype.o=function(a,b){var c=this.a,d=this.b;this.u=a;for(var e=c.length-258,f,h,k;256!==(f=v(this,a));)if(256>f)d>=e&&(this.b=d,c=this.f(),d=this.b),c[d++]=f;else for(f-=257,k=S[f],0<R[f]&&(k+=w(this,R[f])),f=v(this,b),h=V[f],0<U[f]&&(h+=w(this,U[f])),d>=e&&(this.b=d,c=this.f(),d=this.b);k--;)c[d]=c[d++-h];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};t.prototype.I=function(a,b){var c=this.a,d=this.b;this.u=a;for(var e=c.length,f,h,k;256!==
(f=v(this,a));)if(256>f)d>=e&&(c=this.f(),e=c.length),c[d++]=f;else for(f-=257,k=S[f],0<R[f]&&(k+=w(this,R[f])),f=v(this,b),h=V[f],0<U[f]&&(h+=w(this,U[f])),d+k>e&&(c=this.f(),e=c.length);k--;)c[d]=c[d++-h];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};t.prototype.f=function(){var a=new (B?Uint8Array:Array)(this.b-32768),b=this.b-32768,c,d,e=this.a;if(B)a.set(e.subarray(32768,a.length));else for(c=0,d=a.length;c<d;++c)a[c]=e[c+32768];this.k.push(a);this.q+=a.length;if(B)e.set(e.subarray(b,b+32768));
else for(c=0;32768>c;++c)e[c]=e[b+c];this.b=32768;return e};t.prototype.J=function(a){var b,c=this.input.length/this.c+1|0,d,e,f,h=this.input,k=this.a;a&&("number"===typeof a.v&&(c=a.v),"number"===typeof a.F&&(c+=a.F));2>c?(d=(h.length-this.c)/this.u[2],f=d/2*258|0,e=f<k.length?k.length+f:k.length<<1):e=k.length*c;B?(b=new Uint8Array(e),b.set(k)):b=k;return this.a=b};t.prototype.t=function(){var a=0,b=this.a,c=this.k,d,e=new (B?Uint8Array:Array)(this.q+(this.b-32768)),f,h,k,m;if(0===c.length)return B?
this.a.subarray(32768,this.b):this.a.slice(32768,this.b);f=0;for(h=c.length;f<h;++f)for(d=c[f],k=0,m=d.length;k<m;++k)e[a++]=d[k];f=32768;for(h=this.b;f<h;++f)e[a++]=b[f];this.k=[];return this.buffer=e};t.prototype.H=function(){var a,b=this.b;B?this.B?(a=new Uint8Array(b),a.set(this.a.subarray(0,b))):a=this.a.subarray(0,b):(this.a.length>b&&(this.a.length=b),a=this.a);return this.buffer=a};x.prototype.p=function(){var b=this.input,d,e;d=this.A.p();this.c=this.A.c;this.M&&(e=(b[this.c++]<<24|b[this.c++]<<
16|b[this.c++]<<8|b[this.c++])>>>0,e!==c(d)&&a(Error("invalid adler-32 checksum")));return d};b("Zlib.Inflate",x);b("Zlib.Inflate.BufferType",D);D.ADAPTIVE=D.C;D.BLOCK=D.D;b("Zlib.Inflate.prototype.decompress",x.prototype.p);D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];B&&new Uint16Array(D);D=[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];B&&new Uint16Array(D);D=[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];B&&new Uint8Array(D);
D=[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];B&&new Uint16Array(D);D=[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];B&&new Uint8Array(D);D=new (B?Uint8Array:Array)(288);C=0;for(E=D.length;C<E;++C)D[C]=143>=C?8:255>=C?9:279>=C?7:8;f(D);D=new (B?Uint8Array:Array)(30);C=0;for(E=D.length;C<E;++C)D[C]=5;f(D);var X=8}).call(this);_p=window;_p=_p.Zlib=_p.Zlib;_p.Deflate=_p.Deflate;_p.Deflate.compress=_p.Deflate.compress;
_p.Inflate=_p.Inflate;_p.Inflate.BufferType=_p.Inflate.BufferType;_p.Inflate.prototype.decompress=_p.Inflate.prototype.decompress;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,b,c,d,e,f,h){this.status=a||0;this.type=b||0;this.pixelDepth=c||0;this.width=d||0;this.height=e||0;this.imageData=f||[];this.flipped=h||0};
cc.tgaLoadHeader=function(a,b,c){var d=2;if(d+1>b)return!1;a=new cc.BinaryStreamReader(a);a.setOffset(d);c.type=a.readByte();d+=10;if(d+4+1>b)return!1;a.setOffset(d);c.width=a.readUnsignedShort();c.height=a.readUnsignedInteger();c.pixelDepth=a.readByte();if(d+5+1>b)return!1;b=a.readByte();c.flipped=0;b&32&&(c.flipped=1);return!0};
cc.tgaLoadImageData=function(a,b,c){var d,e;d=0|c.pixelDepth/2;e=c.height*c.width*d;if(18+e>b)return!1;c.imageData=cc.__getSubArray(a,18,18+e);if(3<=d)for(a=0;a<e;a+=d)b=c.imageData[a],c.imageData[a]=c.imageData[a+2],c.imageData[a+2]=b;return!0};
cc.tgaRGBtogreyscale=function(a){var b,c;if(8!==a.pixelDepth){var d=a.pixelDepth/8,e=new Uint8Array(a.height*a.width);if(null!==e){for(c=b=0;c<a.width*a.height;b+=d,c++)e[c]=0.3*a.imageData[b]+0.59*a.imageData[b+1]+0.11*a.imageData[b+2];a.pixelDepth=8;a.type=3;a.imageData=e}}};cc.tgaDestroy=function(a){a&&(a.imageData=null)};
cc.tgaLoadRLEImageData=function(a,b,c){var d,e,f,h=0,k=0,m=0,n=[],p=0,r=18;d=c.pixelDepth/8;e=c.height*c.width;for(f=0;f<e;f++){if(0!==p)p--,k=0!==m;else{if(r+1>b)break;p=a[r];r+=1;(m=p&128)&&(p-=128);k=0}if(!k){if(r+d>b)break;n=cc.__getSubArray(a,r,r+d);r+=d;3<=d&&(k=n[0],n[0]=n[2],n[2]=k)}for(k=0;k<d;k++)c.imageData[h+k]=n[k];h+=d}return!0};
cc.tgaFlipImage=function(a){for(var b=a.pixelDepth/8*a.width,c=0;c<a.height/2;c++){var d=cc.__getSubArray(a.imageData,c*b,c*b+b);cc.__setDataToArray(cc.__getSubArray(a.imageData,(a.height-(c+1))*b,b),a.imageData,c*b);cc.__setDataToArray(d,a.imageData,(a.height-(c+1))*b)}a.flipped=0};cc.__getSubArray=function(a,b,c){return a instanceof Array?a.slice(b,c):a.subarray(b,c)};cc.__setDataToArray=function(a,b,c){for(var d=0;d<a.length;d++)b[c+d]=a[d]};
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,b){var c=a+b+1,d=c>>3;this._checkSize(c);var c=Math.pow(2,b-1)-1,e=this._readBits(a+b,1,d),f=this._readBits(a,b,d),h=0,k=2,m=0;do for(var n=this._readByte(++m,
d),p=a%8||8,r=1<<p;r>>=1;)n&r&&(h+=1/k),k*=2;while(a-=p);this._offset+=d;return f===(c<<1)+1?h?NaN:e?-Infinity:Infinity:(1+-2*e)*(f||h?f?Math.pow(2,f-c)*(1+h):Math.pow(2,-c+1)*h:0)},_readByte:function(a,b){return this._data[this._offset+b-a-1]},_decodeInt:function(a,b){var c=this._readBits(0,a,a/8),d=Math.pow(2,a);this._offset+=a/8;return b&&c>=d/2?c-d:c},_shl:function(a,b){for(++b;--b;a=1073741824===((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+2147483648);return a},_readBits:function(a,b,c){var d=
(a+b)%8,e=a%8,f=c-(a>>3)-1;a=c+(-(a+b)>>3);var h=f-a;b=this._readByte(f,c)>>e&(1<<(h?8-e:b))-1;for(h&&d&&(b+=(this._readByte(a++,c)&(1<<d)-1)<<(h--<<3)-e);h;)b+=this._shl(this._readByte(a++,c),(h--<<3)-e);return b},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,b){return this._binaryData instanceof Array?this._binaryData.slice(a,b):this._binaryData.subarray(a,b)},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.Node.extend({properties:null,mapOrientation:null,objectGroups:null,_mapSize:null,_tileSize:null,_tileProperties:null,_className:"TMXTiledMap",ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._mapSize=cc.size(0,0);this._tileSize=cc.size(0,0);void 0!==b?this.initWithXML(a,b):void 0!==a&&this.initWithTMXFile(a)},getMapSize:function(){return cc.size(this._mapSize.width,this._mapSize.height)},setMapSize:function(a){this._mapSize.width=a.width;this._mapSize.height=a.height},_getMapWidth:function(){return this._mapSize.width},
_setMapWidth:function(a){this._mapSize.width=a},_getMapHeight:function(){return this._mapSize.height},_setMapHeight:function(a){this._mapSize.height=a},getTileSize:function(){return cc.size(this._tileSize.width,this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},_getTileWidth:function(){return this._tileSize.width},_setTileWidth:function(a){this._tileSize.width=a},_getTileHeight:function(){return this._tileSize.height},_setTileHeight:function(a){this._tileSize.height=
a},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){if(!a||0===a.length)throw Error("cc.TMXTiledMap.initWithTMXFile(): tmxFile should be non-null or non-empty string.");this.height=this.width=0;a=new cc.TMXMapInfo(a);
if(!a)return!1;var b=a.getTilesets();b&&0!==b.length||cc.log("cc.TMXTiledMap.initWithTMXFile(): Map not found. Please check the filename.");this._buildWithMapInfo(a);return!0},initWithXML:function(a,b){this.height=this.width=0;var c=new cc.TMXMapInfo(a,b),d=c.getTilesets();d&&0!==d.length||cc.log("cc.TMXTiledMap.initWithXML(): Map not found. Please check the filename.");this._buildWithMapInfo(c);return!0},_buildWithMapInfo:function(a){this._mapSize=a.getMapSize();this._tileSize=a.getTileSize();this.mapOrientation=
a.orientation;this.objectGroups=a.getObjectGroups();this.properties=a.properties;this._tileProperties=a.getTileProperties();var b=0,c=a.getLayers();if(c)for(var d=null,e=0,f=c.length;e<f;e++)(d=c[e])&&d.visible&&(d=this._parseLayer(d,a),this.addChild(d,b,b),this.width=Math.max(this.width,d.width),this.height=Math.max(this.height,d.height),b++)},allLayers:function(){for(var a=[],b=this._children,c=0,d=b.length;c<d;c++){var e=b[c];e&&e instanceof cc.TMXLayer&&a.push(e)}return a},getLayer:function(a){if(!a||
0===a.length)throw Error("cc.TMXTiledMap.getLayer(): layerName should be non-null or non-empty string.");for(var b=this._children,c=0;c<b.length;c++){var d=b[c];if(d&&d.layerName===a)return d}return null},getObjectGroup:function(a){if(!a||0===a.length)throw Error("cc.TMXTiledMap.getObjectGroup(): groupName should be non-null or non-empty string.");if(this.objectGroups)for(var b=0;b<this.objectGroups.length;b++){var c=this.objectGroups[b];if(c&&c.groupName===a)return c}return null},getProperty:function(a){return this.properties[a.toString()]},
propertiesForGID:function(a){cc.log("propertiesForGID is deprecated. Please use getPropertiesForGID instead.");return this.getPropertiesForGID[a]},getPropertiesForGID:function(a){return this._tileProperties[a]},_parseLayer:function(a,b){var c=this._tilesetForLayer(a,b),c=new cc.TMXLayer(c,a,b);a.ownTiles=!1;return c},_tilesetForLayer:function(a,b){var c=a._layerSize,d=b.getTilesets();if(d)for(var e=d.length-1;0<=e;e--){var f=d[e];if(f)for(var h=0;h<c.height;h++)for(var k=0;k<c.width;k++){var m=a._tiles[k+
c.width*h];if(0!==m&&(m&cc.TMX_TILE_FLIPPED_MASK)>>>0>=f.firstGid)return f}}cc.log("cocos2d: Warning: TMX Layer "+a.name+" has no tiles");return null}});_p=cc.TMXTiledMap.prototype;cc.defineGetterSetter(_p,"mapWidth",_p._getMapWidth,_p._setMapWidth);cc.defineGetterSetter(_p,"mapHeight",_p._getMapHeight,_p._setMapHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight);
cc.TMXTiledMap.create=function(a,b){return new cc.TMXTiledMap(a,b)};cc.TMX_PROPERTY_NONE=0;cc.TMX_PROPERTY_MAP=1;cc.TMX_PROPERTY_LAYER=2;cc.TMX_PROPERTY_OBJECTGROUP=3;cc.TMX_PROPERTY_OBJECT=4;cc.TMX_PROPERTY_TILE=5;cc.TMX_TILE_HORIZONTAL_FLAG=2147483648;cc.TMX_TILE_VERTICAL_FLAG=1073741824;cc.TMX_TILE_DIAGONAL_FLAG=536870912;cc.TMX_TILE_FLIPPED_ALL=(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_DIAGONAL_FLAG)>>>0;cc.TMX_TILE_FLIPPED_MASK=~cc.TMX_TILE_FLIPPED_ALL>>>0;
cc.TMXLayerInfo=cc.Class.extend({properties:null,name:"",_layerSize:null,_tiles:null,visible:null,_opacity:null,ownTiles:!0,_minGID:1E5,_maxGID:0,offset:null,ctor:function(){this.properties=[];this.name="";this._tiles=this._layerSize=null;this.visible=!0;this._opacity=0;this.ownTiles=!0;this._minGID=1E5;this._maxGID=0;this.offset=cc.p(0,0)},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a}});
cc.TMXTilesetInfo=cc.Class.extend({name:"",firstGid:0,_tileSize:null,spacing:0,margin:0,sourceImage:"",imageSize:null,ctor:function(){this._tileSize=cc.size(0,0);this.imageSize=cc.size(0,0)},rectForGID:function(a,b){var c=b||cc.rect(0,0,0,0);c.width=this._tileSize.width;c.height=this._tileSize.height;a&=cc.TMX_TILE_FLIPPED_MASK;a-=parseInt(this.firstGid,10);var d=parseInt((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing),10);c.x=parseInt(a%d*(this._tileSize.width+
this.spacing)+this.margin,10);c.y=parseInt(parseInt(a/d,10)*(this._tileSize.height+this.spacing)+this.margin,10);return c}});
cc.TMXMapInfo=cc.SAXParser.extend({properties:null,orientation:null,parentElement:null,parentGID:null,layerAttrs:0,storingCharacters:!1,tmxFileName:null,currentString:null,_objectGroups:null,_mapSize:null,_tileSize:null,_layers:null,_tilesets:null,_tileProperties:null,_resources:"",_currentFirstGID:0,ctor:function(a,b){cc.SAXParser.prototype.ctor.apply(this);this._mapSize=cc.size(0,0);this._tileSize=cc.size(0,0);this._layers=[];this._tilesets=[];this._objectGroups=[];this.properties=[];this._tileProperties=
{};this._currentFirstGID=0;void 0!==b?this.initWithXML(a,b):void 0!==a&&this.initWithTMXFile(a)},getOrientation:function(){return this.orientation},setOrientation:function(a){this.orientation=a},getMapSize:function(){return cc.size(this._mapSize.width,this._mapSize.height)},setMapSize:function(a){this._mapSize.width=a.width;this._mapSize.height=a.height},_getMapWidth:function(){return this._mapSize.width},_setMapWidth:function(a){this._mapSize.width=a},_getMapHeight:function(){return this._mapSize.height},
_setMapHeight:function(a){this._mapSize.height=a},getTileSize:function(){return cc.size(this._tileSize.width,this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},_getTileWidth:function(){return this._tileSize.width},_setTileWidth:function(a){this._tileSize.width=a},_getTileHeight:function(){return this._tileSize.height},_setTileHeight:function(a){this._tileSize.height=a},getLayers:function(){return this._layers},setLayers:function(a){this._layers.push(a)},
getTilesets:function(){return this._tilesets},setTilesets:function(a){this._tilesets.push(a)},getObjectGroups:function(){return this._objectGroups},setObjectGroups:function(a){this._objectGroups.push(a)},getParentElement:function(){return this.parentElement},setParentElement:function(a){this.parentElement=a},getParentGID:function(){return this.parentGID},setParentGID:function(a){this.parentGID=a},getLayerAttribs:function(){return this.layerAttrs},setLayerAttribs:function(a){this.layerAttrs=a},getStoringCharacters:function(){return this.storingCharacters},
setStoringCharacters:function(a){this.storingCharacters=a},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a},initWithTMXFile:function(a){this._internalInit(a,null);return this.parseXMLFile(a)},initWithXML:function(a,b){this._internalInit(null,b);return this.parseXMLString(a)},parseXMLFile:function(a,b){var c=(b=b||!1)?a:cc.loader.getRes(a);if(!c)throw Error("Please load the resource first : "+a);var d,e,c=this._parseXML(c).documentElement;d=c.getAttribute("version");
e=c.getAttribute("orientation");if("map"===c.nodeName&&("1.0"!==d&&null!==d&&cc.log("cocos2d: TMXFormat: Unsupported TMX version:"+d),"orthogonal"===e?this.orientation=cc.TMX_ORIENTATION_ORTHO:"isometric"===e?this.orientation=cc.TMX_ORIENTATION_ISO:"hexagonal"===e?this.orientation=cc.TMX_ORIENTATION_HEX:null!==e&&cc.log("cocos2d: TMXFomat: Unsupported orientation:"+e),d=cc.size(0,0),d.width=parseFloat(c.getAttribute("width")),d.height=parseFloat(c.getAttribute("height")),this.setMapSize(d),d=cc.size(0,
0),d.width=parseFloat(c.getAttribute("tilewidth")),d.height=parseFloat(c.getAttribute("tileheight")),this.setTileSize(d),e=c.querySelectorAll("map \x3e properties \x3e  property"))){var f={};for(d=0;d<e.length;d++)f[e[d].getAttribute("name")]=e[d].getAttribute("value");this.properties=f}f=c.getElementsByTagName("tileset");"map"!==c.nodeName&&(f=[],f.push(c));for(d=0;d<f.length;d++){e=f[d];var h=e.getAttribute("source");if(h)e=b?cc.path.join(this._resources,h):cc.path.changeBasename(a,h),this.parseXMLFile(e);
else{h=new cc.TMXTilesetInfo;h.name=e.getAttribute("name")||"";h.firstGid=parseInt(e.getAttribute("firstgid"))||0;h.spacing=parseInt(e.getAttribute("spacing"))||0;h.margin=parseInt(e.getAttribute("margin"))||0;var k=cc.size(0,0);k.width=parseFloat(e.getAttribute("tilewidth"));k.height=parseFloat(e.getAttribute("tileheight"));h._tileSize=k;var k=e.getElementsByTagName("image")[0].getAttribute("source"),m=-1;this.tmxFileName&&(m=this.tmxFileName.lastIndexOf("/"));-1!==m?(m=this.tmxFileName.substr(0,
m+1),h.sourceImage=m+k):h.sourceImage=this._resources+(this._resources?"/":"")+k;this.setTilesets(h);if(k=e.getElementsByTagName("tile"))for(m=0;m<k.length;m++){e=k[m];this.parentGID=parseInt(h.firstGid)+parseInt(e.getAttribute("id")||0);var n=e.querySelectorAll("properties \x3e property");if(n){var p={};for(e=0;e<n.length;e++){var r=n[e].getAttribute("name");p[r]=n[e].getAttribute("value")}this._tileProperties[this.parentGID]=p}}}}if(f=c.getElementsByTagName("layer"))for(d=0;d<f.length;d++){m=f[d];
n=m.getElementsByTagName("data")[0];h=new cc.TMXLayerInfo;h.name=m.getAttribute("name");e=cc.size(0,0);e.width=parseFloat(m.getAttribute("width"));e.height=parseFloat(m.getAttribute("height"));h._layerSize=e;e=m.getAttribute("visible");h.visible="0"!=e;e=m.getAttribute("opacity")||1;h._opacity=e?parseInt(255*parseFloat(e)):255;h.offset=cc.p(parseFloat(m.getAttribute("x"))||0,parseFloat(m.getAttribute("y"))||0);p="";for(e=0;e<n.childNodes.length;e++)p+=n.childNodes[e].nodeValue;p=p.trim();e=n.getAttribute("compression");
r=n.getAttribute("encoding");if(e&&"gzip"!==e&&"zlib"!==e)return cc.log("cc.TMXMapInfo.parseXMLFile(): unsupported compression method"),null;switch(e){case "gzip":k=cc.unzipBase64AsArray(p,4);break;case "zlib":k=new Zlib.Inflate(cc.Codec.Base64.decodeAsArray(p,1));k=cc.uint8ArrayToUint32Array(k.decompress());break;case null:case "":if("base64"===r)k=cc.Codec.Base64.decodeAsArray(p,4);else if("csv"===r)for(k=[],e=p.split(","),n=0;n<e.length;n++)k.push(parseInt(e[n]));else for(e=n.getElementsByTagName("tile"),
k=[],n=0;n<e.length;n++)k.push(parseInt(e[n].getAttribute("gid")));break;default:this.layerAttrs===cc.TMXLayerInfo.ATTRIB_NONE&&cc.log("cc.TMXMapInfo.parseXMLFile(): Only base64 and/or gzip/zlib maps are supported")}k&&(h._tiles=new Uint32Array(k));if(m=m.querySelectorAll("properties \x3e property")){n={};for(e=0;e<m.length;e++)n[m[e].getAttribute("name")]=m[e].getAttribute("value");h.properties=n}this.setLayers(h)}if(k=c.getElementsByTagName("objectgroup"))for(d=0;d<k.length;d++){h=k[d];f=new cc.TMXObjectGroup;
f.groupName=h.getAttribute("name");f.setPositionOffset(cc.p(parseFloat(h.getAttribute("x"))*this.getTileSize().width||0,parseFloat(h.getAttribute("y"))*this.getTileSize().height||0));if(m=h.querySelectorAll("objectgroup \x3e properties \x3e property"))for(e=0;e<m.length;e++)n={},n[m[e].getAttribute("name")]=m[e].getAttribute("value"),f.properties=n;h=h.querySelectorAll("object");m=cc.director.getContentScaleFactor();if(h)for(e=0;e<h.length;e++){p=h[e];n={};n.name=p.getAttribute("name")||"";n.type=
p.getAttribute("type")||"";n.width=parseInt(p.getAttribute("width"))||0;n.height=parseInt(p.getAttribute("height"))||0;n.x=(((p.getAttribute("x")||0)|0)+f.getPositionOffset().x)/m;r=((p.getAttribute("y")||0)|0)+f.getPositionOffset().y/m;n.y=(parseInt(this.getMapSize().height*this.getTileSize().height)-r-n.height)/cc.director.getContentScaleFactor();n.rotation=parseInt(p.getAttribute("rotation"))||0;if(r=p.querySelectorAll("properties \x3e property"))for(var s=0;s<r.length;s++)n[r[s].getAttribute("name")]=
r[s].getAttribute("value");(r=p.querySelectorAll("polygon"))&&0<r.length&&(r=r[0].getAttribute("points"))&&(n.points=this._parsePointsString(r));(p=p.querySelectorAll("polyline"))&&0<p.length&&(p=p[0].getAttribute("points"))&&(n.polylinePoints=this._parsePointsString(p));f.setObjects(n)}this.setObjectGroups(f)}return c},_parsePointsString:function(a){if(!a)return null;var b=[];a=a.split(" ");for(var c=0;c<a.length;c++){var d=a[c].split(",");b.push({x:d[0],y:d[1]})}return b},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,b){this._tilesets.length=0;this._layers.length=0;this.tmxFileName=a;b&&(this._resources=b);this._objectGroups.length=0;this.properties.length=0;this._tileProperties.length=
0;this.currentString="";this.storingCharacters=!1;this.layerAttrs=cc.TMXLayerInfo.ATTRIB_NONE;this.parentElement=cc.TMX_PROPERTY_NONE;this._currentFirstGID=0}});_p=cc.TMXMapInfo.prototype;cc.defineGetterSetter(_p,"mapWidth",_p._getMapWidth,_p._setMapWidth);cc.defineGetterSetter(_p,"mapHeight",_p._getMapHeight,_p._setMapHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight);
cc.TMXMapInfo.create=function(a,b){return new cc.TMXMapInfo(a,b)};cc.loader.register(["tmx","tsx"],cc._txtLoader);cc.TMXLayerInfo.ATTRIB_NONE=1;cc.TMXLayerInfo.ATTRIB_BASE64=2;cc.TMXLayerInfo.ATTRIB_GZIP=4;cc.TMXLayerInfo.ATTRIB_ZLIB=8;cc.TMXObjectGroup=cc.Class.extend({properties:null,groupName:"",_positionOffset: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){return this.getObject(a)},getObject:function(a){if(this._objects&&0<this._objects.length)for(var b=this._objects,c=0,d=b.length;c<d;c++){var e=b[c].name;if(e&&e===a)return b[c]}return null},getObjects:function(){return this._objects},setObjects:function(a){this._objects.push(a)}});cc.TMXLayer=cc.SpriteBatchNode.extend({tiles:null,tileset:null,layerOrientation:null,properties:null,layerName:"",_textures:null,_texGrids:null,_spriteTiles:null,_layerSize:null,_mapTileSize:null,_opacity:255,_minGID:null,_maxGID:null,_vertexZvalue:null,_useAutomaticVertexZ:null,_reusedTile:null,_atlasIndexArray:null,_contentScaleFactor:null,_className:"TMXLayer",ctor:function(a,b,c){cc.SpriteBatchNode.prototype.ctor.call(this);this._descendants=[];this._layerSize=cc.size(0,0);this._mapTileSize=cc.size(0,
0);this._spriteTiles={};void 0!==c&&this.initWithTilesetInfo(a,b,c)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.TMXLayer.CanvasRenderCmd(this):new cc.TMXLayer.WebGLRenderCmd(this)},_fillTextureGrids:function(a,b){var c=this._textures[b];if(c.isLoaded()){a.imageSize.width&&a.imageSize.height||(a.imageSize.width=c.width,a.imageSize.height=c.height);for(var d=a._tileSize.width,e=a._tileSize.height,f=c._contentSize.width,c=c._contentSize.height,h=a.spacing,k=
a.margin,m=a.firstGid,h=a.firstGid+Math.floor((c-2*k+h)/(e+h))*Math.floor((f-2*k+h)/(d+h)),k=this._texGrids,n=null,p=k[m]?!0:!1;m<h;++m){p&&!k[m]&&(p=!1);if(!p&&k[m])break;n={texId:b,x:0,y:0,width:d,height:e,t:0,l:0,r:0,b:0};a.rectForGID(m,n);n.t=n.y/c;n.l=n.x/f;n.r=(n.x+n.width)/f;n.b=(n.y+n.height)/c;k[m]=n}}else c.addEventListener("load",function(){this._fillTextureGrids(a,b)},this)},initWithTilesetInfo:function(a,b,c){var d=b._layerSize;parseInt(d.width*d.height);this.layerName=b.name;this.tiles=
b._tiles;this.properties=b.properties;this._layerSize=d;this._minGID=b._minGID;this._maxGID=b._maxGID;this._opacity=b._opacity;this.tileset=a;this.layerOrientation=c.orientation;this._mapTileSize=c.getTileSize();if(c=c._tilesets){this._textures=[];this._texGrids=[];for(var e=c.length,f,h,d=0;d<e;++d)f=c[d],h=cc.textureCache.addImage(f.sourceImage),this._textures.push(h),this._fillTextureGrids(f,d),f===a&&(this._texture=h)}a=this._calculateLayerOffset(b.offset);this.setPosition(cc.pointPixelsToPoints(a));
this._parseInternalProperties();this.setContentSize(cc.sizePixelsToPoints(cc.size(this._layerSize.width*this._mapTileSize.width,this._layerSize.height*this._mapTileSize.height)));this._useAutomaticVertexZ=!1;this._vertexZvalue=0;return!0},getLayerSize:function(){return cc.size(this._layerSize.width,this._layerSize.height)},setLayerSize:function(a){this._layerSize.width=a.width;this._layerSize.height=a.height},_getLayerWidth:function(){return this._layerSize.width},_setLayerWidth:function(a){this._layerSize.width=
a},_getLayerHeight:function(){return this._layerSize.height},_setLayerHeight:function(a){this._layerSize.height=a},getMapTileSize:function(){return cc.size(this._mapTileSize.width,this._mapTileSize.height)},setMapTileSize:function(a){this._mapTileSize.width=a.width;this._mapTileSize.height=a.height},_getTileWidth:function(){return this._mapTileSize.width},_setTileWidth:function(a){this._mapTileSize.width=a},_getTileHeight:function(){return this._mapTileSize.height},_setTileHeight:function(a){this._mapTileSize.height=
a},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},getProperty:function(a){return this.properties[a]},getLayerName:function(){return this.layerName},setLayerName:function(a){this.layerName=
a},releaseMap:function(){this._spriteTiles={}},getTileAt:function(a,b){if(void 0===a)throw Error("cc.TMXLayer.getTileAt(): pos should be non-null");var c=a;void 0===b&&(c=a.x,b=a.y);if(c>=this._layerSize.width||b>=this._layerSize.height||0>c||0>b)throw Error("cc.TMXLayer.getTileAt(): invalid position");if(!this.tiles)return cc.log("cc.TMXLayer.getTileAt(): TMXLayer: the tiles map has been released"),null;var d=null,e=this.getTileGIDAt(c,b);if(0===e)return d;var f=0|c+b*this._layerSize.width,d=this._spriteTiles[f];
d||(d=this._texGrids[e],e=this._textures[d.texId],d=cc.rectPixelsToPoints(d),d=new cc.Sprite(e,d),d.setPosition(this.getPositionAt(c,b)),c=this._vertexZForPos(c,b),d.setVertexZ(c),d.setAnchorPoint(0,0),d.setOpacity(this._opacity),this.addChild(d,c,f));return d},getTileGIDAt:function(a,b){if(void 0===a)throw Error("cc.TMXLayer.getTileGIDAt(): pos should be non-null");var c=a;void 0===b&&(c=a.x,b=a.y);if(c>=this._layerSize.width||b>=this._layerSize.height||0>c||0>b)throw Error("cc.TMXLayer.getTileGIDAt(): invalid position");
return this.tiles?(this.tiles[0|c+b*this._layerSize.width]&cc.TMX_TILE_FLIPPED_MASK)>>>0:(cc.log("cc.TMXLayer.getTileGIDAt(): TMXLayer: the tiles map has been released"),null)},setTileGID:function(a,b,c,d){if(void 0===b)throw Error("cc.TMXLayer.setTileGID(): pos should be non-null");void 0!==d?b=cc.p(b,c):d=c;if(b.x>=this._layerSize.width||b.y>=this._layerSize.height||0>b.x||0>b.y)throw Error("cc.TMXLayer.setTileGID(): invalid position");if(this.tiles)if(0!==a&&a<this.tileset.firstGid)cc.log("cc.TMXLayer.setTileGID(): invalid gid:"+
a);else{d=d||0;c=this.getTileFlagsAt(b);var e=this.getTileGIDAt(b);if(e!==a||c!==d)if(c=(a|d)>>>0,0===a)this.removeTileAt(b);else if(0===e)this._updateTileForGID(c,b);else{var e=b.x+b.y*this._layerSize.width,f=this.getChildByTag(e);if(f){a=this._texGrids[a];var h=this._textures[a.texId];a=cc.rectPixelsToPoints(a);f.setTexture(h);f.setTextureRect(a,!1);null!=d&&this._setupTileSprite(f,b,c);this.tiles[e]=c}else this._updateTileForGID(c,b)}}else cc.log("cc.TMXLayer.setTileGID(): TMXLayer: the tiles map has been released")},
addChild:function(a,b,c){cc.Node.prototype.addChild.call(this,a,b,c);void 0!==c&&(this._spriteTiles[c]=a,a._vertexZ=this._vertexZ+cc.renderer.assignedZStep*c/this.tiles.length)},removeChild:function(a,b){this._spriteTiles[a.tag]&&(this._spriteTiles[a.tag]=null);cc.Node.prototype.removeChild.call(this,a,b)},getTileFlagsAt:function(a,b){if(!a)throw Error("cc.TMXLayer.getTileFlagsAt(): pos should be non-null");void 0!==b&&(a=cc.p(a,b));if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||
0>a.y)throw Error("cc.TMXLayer.getTileFlagsAt(): invalid position");return this.tiles?(this.tiles[0|a.x+a.y*this._layerSize.width]&cc.TMX_TILE_FLIPPED_ALL)>>>0:(cc.log("cc.TMXLayer.getTileFlagsAt(): TMXLayer: the tiles map has been released"),null)},removeTileAt:function(a,b){if(!a)throw Error("cc.TMXLayer.removeTileAt(): pos should be non-null");void 0!==b&&(a=cc.p(a,b));if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw Error("cc.TMXLayer.removeTileAt(): invalid position");
if(!this.tiles)cc.log("cc.TMXLayer.removeTileAt(): TMXLayer: the tiles map has been released");else if(0!==this.getTileGIDAt(a)){var c=0|a.x+a.y*this._layerSize.width;this.tiles[c]=0;(c=this._spriteTiles[c])&&this.removeChild(c,!0)}},getPositionAt:function(a,b){void 0!==b&&(a=cc.p(a,b));var c=cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:c=this._positionForOrthoAt(a);break;case cc.TMX_ORIENTATION_ISO:c=this._positionForIsoAt(a);break;case cc.TMX_ORIENTATION_HEX:c=this._positionForHexAt(a)}return cc.pointPixelsToPoints(c)},
_positionForIsoAt:function(a){return cc.p(this._mapTileSize.width/2*(this._layerSize.width+a.x-a.y-1),this._mapTileSize.height/2*(2*this._layerSize.height-a.x-a.y-2))},_positionForOrthoAt:function(a){return cc.p(a.x*this._mapTileSize.width,(this._layerSize.height-a.y-1)*this._mapTileSize.height)},_positionForHexAt:function(a){return cc.p(a.x*this._mapTileSize.width*3/4,(this._layerSize.height-a.y-1)*this._mapTileSize.height+(1===a.x%2?-this._mapTileSize.height/2:0))},_calculateLayerOffset:function(a){var b=
cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:b=cc.p(a.x*this._mapTileSize.width,-a.y*this._mapTileSize.height);break;case cc.TMX_ORIENTATION_ISO:b=cc.p(this._mapTileSize.width/2*(a.x-a.y),this._mapTileSize.height/2*(-a.x-a.y));break;case cc.TMX_ORIENTATION_HEX:0===a.x&&0===a.y||cc.log("offset for hexagonal map not implemented yet")}return b},_updateTileForGID:function(a,b){if(this._texGrids[a]){var c=0|b.x+b.y*this._layerSize.width;c<this.tiles.length&&(this.tiles[c]=a)}},
_parseInternalProperties:function(){var a=this.getProperty("cc_vertexz");if(a)if("automatic"===a){this._useAutomaticVertexZ=!0;var a=this.getProperty("cc_alpha_func"),b=0;a&&(b=parseFloat(a));cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST),this.shaderProgram.use(),this.shaderProgram.setUniformLocationWith1f(cc.UNIFORM_ALPHA_TEST_VALUE_S,b))}else this._vertexZvalue=parseInt(a,10)},_setupTileSprite:function(a,
b,c){var d=this.getPositionAt(b);a.setPosition(d);a.setVertexZ(this._vertexZForPos(b));a.setAnchorPoint(0,0);a.setOpacity(this._opacity);a.setFlippedX(!1);a.setFlippedY(!1);a.setRotation(0);(c&cc.TMX_TILE_DIAGONAL_FLAG)>>>0?(a.setAnchorPoint(0.5,0.5),a.setPosition(d.x+a.width/2,d.y+a.height/2),b=(c&(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG)>>>0)>>>0,b===cc.TMX_TILE_HORIZONTAL_FLAG?a.setRotation(90):b===cc.TMX_TILE_VERTICAL_FLAG?a.setRotation(270):(b===(cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_HORIZONTAL_FLAG)>>>
0?a.setRotation(90):a.setRotation(270),a.setFlippedX(!0))):((c&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0&&a.setFlippedX(!0),(c&cc.TMX_TILE_VERTICAL_FLAG)>>>0&&a.setFlippedY(!0))},_vertexZForPos:function(a,b){void 0===b&&(b=a.y,a=a.x);var c=0,d=0;if(this._useAutomaticVertexZ)switch(this.layerOrientation){case cc.TMX_ORIENTATION_ISO:d=this._layerSize.width+this._layerSize.height;c=-(d-(a+b));break;case cc.TMX_ORIENTATION_ORTHO:c=-(this._layerSize.height-b);break;case cc.TMX_ORIENTATION_HEX:cc.log("TMX Hexa zOrder not supported");
break;default:cc.log("TMX invalid value")}else c=this._vertexZvalue;return c}});_p=cc.TMXLayer.prototype;cc.defineGetterSetter(_p,"layerWidth",_p._getLayerWidth,_p._setLayerWidth);cc.defineGetterSetter(_p,"layerHeight",_p._getLayerHeight,_p._setLayerHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight);cc.TMXLayer.create=function(a,b,c){return new cc.TMXLayer(a,b,c)};(function(){cc.TMXLayer.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0};var a=cc.TMXLayer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.TMXLayer.CanvasRenderCmd;a.visit=function(a){var c=this._node,d=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;if(c._visible){isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=d.assignedZStep);this._syncStatus(a);a=c._children;var e=c._spriteTiles,f,h=a.length;if(0<h){c.sortAllChildren();
for(f=0;f<h;f++)if(c=a[f],0>c._localZOrder)c._renderCmd.visit(this);else break;for(d.pushRenderCommand(this);f<h;f++)c=a[f],0===c._localZOrder&&e[c.tag]?(isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=d.assignedZStep),c._renderCmd.updateStatus()):c._renderCmd.visit(this)}else d.pushRenderCommand(this);this._dirtyFlag=0}};a.rendering=function(a,c,d){var e=this._node,f=e._rotationX||e._rotationY,h=e.layerOrientation,k=e._opacity/255;if(e.tiles&&!(0>=k)){var m=e._mapTileSize.width,n=e._mapTileSize.height,
p=e.tileset._tileSize.width/cc.director._contentScaleFactor,r=e.tileset._tileSize.height/cc.director._contentScaleFactor,s=p-m,t=r-n,w=cc.winSize.width,v=cc.winSize.height,y=e._layerSize.height,x=e._layerSize.width,u=e._texGrids,z=e._spriteTiles,A=this._worldTransform,B=-e._contentSize.width*e._anchorPoint.x,D=-e._contentSize.height*e._anchorPoint.y,C=A.a,E=A.d,J=B*C+D*A.c+A.tx,B=B*A.b+D*E+A.ty,D=a||cc._renderContext,G=D.getContext(),H=0,L=0,I=x,M=y;f||h!==cc.TMX_ORIENTATION_ORTHO||(H=Math.floor(-(J-
s*C)/(m*C)),L=Math.floor((B-t*E+n*y*E-v)/(n*E)),I=Math.ceil((w-J+s*C)/(m*C)),M=y-Math.floor(-(B+t*E)/(n*E)),0>H&&(H=0),0>L&&(L=0),I>x&&(I=x),M>y&&(M=y));var F,N,s=L*x,O,P,Q,S=cc.TMX_TILE_FLIPPED_MASK,R,V,U,K,W=p*C,X=r*E,T,Y,$=!1,aa=!1,t=s+H;for(F in z)if(F<t&&z[F])O=z[F]._renderCmd,0===z[F]._localZOrder&&O.rendering&&O.rendering(a,c,d);else if(F>=t)break;D.setTransform(A,c,d);for(D.setGlobalAlpha(k);L<M;++L){for(N=H;N<I;++N)if(t=s+N,z[t])O=z[t]._renderCmd,0===z[t]._localZOrder&&O.rendering&&(O.rendering(a,
c,d),D.setTransform(A,c,d),D.setGlobalAlpha(k));else if(O=e.tiles[t],(P=u[(O&S)>>>0])&&(Q=e._textures[P.texId])&&Q._htmlElementObj){switch(h){case cc.TMX_ORIENTATION_ORTHO:V=N*m;U=-(y-L-1)*n;break;case cc.TMX_ORIENTATION_ISO:V=m/2*(x+N-L-1);U=-n/2*(2*y-N-L-2);break;case cc.TMX_ORIENTATION_HEX:V=N*m*3/4,U=-(y-L-1)*n+(1===N%2?-n/2:0)}K=V+p;R=U-r;if(!f&&h===cc.TMX_ORIENTATION_ISO){T=-B+U*E;if(T<-v-X){N+=Math.floor(2*(-v-T)/X)-1;continue}T=J+K*C;if(T<-W){N+=Math.floor(2*-T/W)-1;continue}Y=J+V*C;T=-B+
R*E;if(Y>w||0<T){N=I;continue}}O>cc.TMX_TILE_DIAGONAL_FLAG&&($=(O&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0,aa=(O&cc.TMX_TILE_VERTICAL_FLAG)>>>0);$&&(V=-K,G.scale(-1,1));aa&&(R=-U,G.scale(1,-1));G.drawImage(Q._htmlElementObj,P.x,P.y,P.width,P.height,V,R,p,r);$&&G.scale(-1,1);aa&&G.scale(1,-1);cc.g_NumberOfDraws++}s+=x}for(F in z)F>t&&z[F]&&(O=z[F]._renderCmd,0===z[F]._localZOrder&&O.rendering&&O.rendering(a,c,d))}}})();(function(){cc.TMXLayer.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._vertices=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];this._color=new Uint32Array(1);this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST);a=90*Math.PI/180;this._sin90=Math.sin(a);this._cos90=Math.cos(a);a*=3;this._sin270=Math.sin(a);this._cos270=Math.cos(a)};var a=cc.TMXLayer.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.TMXLayer.WebGLRenderCmd;
a.uploadData=function(a,c,d){var e=this._node,f=e._rotationX||e._rotationY,h=e.layerOrientation,k=e.tiles;if(!k)return 0;var m=e._mapTileSize.width,n=e._mapTileSize.height,p=e.tileset._tileSize.width/cc.director._contentScaleFactor,r=e.tileset._tileSize.height/cc.director._contentScaleFactor,s=p-m,t=r-n,w=cc.winSize.width,v=cc.winSize.height,y=e._layerSize.height,x=e._layerSize.width,u=e._texGrids,z=e._spriteTiles,A=this._worldTransform,B=A.a,D=A.b,C=A.c,E=A.d,J=A.tx,A=A.ty,G=-e._contentSize.width*
e._anchorPoint.x,H=-e._contentSize.height*e._anchorPoint.y,L=G*B+H*C+J,G=G*D+H*E+A,H=e._opacity,I=this._displayedColor.r,M=this._displayedColor.g,F=this._displayedColor.b;if(e._opacityModifyRGB)var N=H/255,I=I*N,M=M*N,F=F*N;this._color[0]=H<<24|F<<16|M<<8|I;var O=H=0,I=x,M=y;f||h!==cc.TMX_ORIENTATION_ORTHO||(H=Math.floor(-(L-s*B)/(m*B)),O=Math.floor((G-t*E+n*y*E-v)/(n*E)),I=Math.ceil((w-L+s*B)/(m*B)),M=y-Math.floor(-(G+t*E)/(n*E)),0>H&&(H=0),0>O&&(O=0),I>x&&(I=x),M>y&&(M=y));for(var P,s=d,t=O*x,Q,
S,R,F=cc.TMX_TILE_FLIPPED_MASK,V,U,K,W,N=p*B,X=r*E,T,Y,$=B,aa=D,da=C,ea=E,fa=J,ga=A,ha=!1,ba=!1,ca=!1,Z=this._vertices;O<M;++O){for(P=H;P<I;++P)if(s+24>a.length&&(cc.renderer._increaseBatchingSize((s-d)/6),cc.renderer._batchRendering(),s=d=0),Q=t+P,!z[Q]&&(S=e.tiles[Q],R=u[(S&F)>>>0])){switch(h){case cc.TMX_ORIENTATION_ORTHO:U=P*m;K=(y-O-1)*n;Q=e._vertexZ+cc.renderer.assignedZStep*Q/k.length;break;case cc.TMX_ORIENTATION_ISO:U=m/2*(x+P-O-1);K=n/2*(2*y-P-O-2);Q=e._vertexZ+cc.renderer.assignedZStep*
(e.height-K)/e.height;break;case cc.TMX_ORIENTATION_HEX:U=P*m*3/4,K=(y-O-1)*n+(1===P%2?-n/2:0),Q=e._vertexZ+cc.renderer.assignedZStep*(e.height-K)/e.height}W=U+p;V=K+r;if(!f&&h===cc.TMX_ORIENTATION_ISO){T=G+K*E;if(T>v+X){P+=Math.floor(2*(T-v)/X)-1;continue}T=L+W*B;if(T<-N){P+=Math.floor(2*-T/N)-1;continue}Y=L+U*B;T=G+V*E;if(Y>w||0>T){P=I;continue}}S>cc.TMX_TILE_DIAGONAL_FLAG&&(ha=!0,ba=(S&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0,ca=(S&cc.TMX_TILE_VERTICAL_FLAG)>>>0);Z[0].x=U*$+V*da+fa;Z[0].y=U*aa+V*ea+ga;
Z[1].x=U*$+K*da+fa;Z[1].y=U*aa+K*ea+ga;Z[2].x=W*$+V*da+fa;Z[2].y=W*aa+V*ea+ga;Z[3].x=W*$+K*da+fa;Z[3].y=W*aa+K*ea+ga;for(S=0;4>S;++S){a[s]=Z[S].x;a[s+1]=Z[S].y;a[s+2]=Q;c[s+3]=this._color[0];switch(S){case 0:a[s+4]=ba?R.r:R.l;a[s+5]=ca?R.b:R.t;break;case 1:a[s+4]=ba?R.r:R.l;a[s+5]=ca?R.t:R.b;break;case 2:a[s+4]=ba?R.l:R.r;a[s+5]=ca?R.b:R.t;break;case 3:a[s+4]=ba?R.l:R.r,a[s+5]=ca?R.t:R.b}s+=6}ha&&($=B,aa=D,da=C,ea=E,fa=J,ga=A,ha=ca=ba=!1)}t+=x}return(s-d)/6}})();cc.PointObject=cc.Class.extend({_ratio:null,_offset:null,_child:null,ctor:function(a,b){this.initWithCCPoint(a,b)},getRatio:function(){return this._ratio},setRatio:function(a){this._ratio=a},getOffset:function(){return this._offset},setOffset:function(a){this._offset=a},getChild:function(){return this._child},setChild:function(a){this._child=a},initWithCCPoint:function(a,b){this._ratio=a;this._offset=b;this._child=null;return!0}});cc.PointObject.create=function(a,b){return new cc.PointObject(a,b)};
cc.ParallaxNode=cc.Node.extend({parallaxArray:null,_lastPosition:null,_className:"ParallaxNode",getParallaxArray:function(){return this.parallaxArray},setParallaxArray:function(a){this.parallaxArray=a},ctor:function(){cc.Node.prototype.ctor.call(this);this.parallaxArray=[];this._lastPosition=cc.p(-100,-100)},addChild:function(a,b,c,d){if(3===arguments.length)cc.log("ParallaxNode: use addChild(child, z, ratio, offset) instead");else{if(!a)throw Error("cc.ParallaxNode.addChild(): child should be non-null");
var e=new cc.PointObject(c,d);e.setChild(a);this.parallaxArray.push(e);a.setPosition(this._position.x*c.x+d.x,this._position.y*c.y+d.y);cc.Node.prototype.addChild.call(this,a,b,a.tag)}},removeChild:function(a,b){for(var c=this.parallaxArray,d=0;d<c.length;d++)if(c[d].getChild()===a){c.splice(d,1);break}cc.Node.prototype.removeChild.call(this,a,b)},removeAllChildren:function(a){this.parallaxArray.length=0;cc.Node.prototype.removeAllChildren.call(this,a)},_updateParallaxPosition:function(){var a=this._absolutePosition();
if(!cc.pointEqualToPoint(a,this._lastPosition)){for(var b=this.parallaxArray,c=0,d=b.length;c<d;c++){var e=b[c];e.getChild().setPosition(-a.x+a.x*e.getRatio().x+e.getOffset().x,-a.y+a.y*e.getRatio().y+e.getOffset().y)}this._lastPosition=a}},_absolutePosition:function(){for(var a=this._position,b=this;null!==b.parent;)b=b.parent,a=cc.pAdd(a,b.getPosition());return a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ParallaxNode.CanvasRenderCmd(this):new cc.ParallaxNode.WebGLRenderCmd(this)}});
cc.ParallaxNode.create=function(){return new cc.ParallaxNode};(function(){cc.ParallaxNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=cc.ParallaxNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.ParallaxNode.CanvasRenderCmd;a.updateStatus=function(){this._node._updateParallaxPosition();this.originUpdateStatus()};a._syncStatus=function(a){this._node._updateParallaxPosition();this._originSyncStatus(a)}})();
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){cc.ParallaxNode.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=cc.ParallaxNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.ParallaxNode.WebGLRenderCmd;a.updateStatus=function(){this._node._updateParallaxPosition();this.originUpdateStatus()};a._syncStatus=function(a){this._node._updateParallaxPosition();this._originSyncStatus(a)}}});(function(){var a=cc.sys,b={ONLY_ONE:!1,WEB_AUDIO:!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),DELAY_CREATE_CTX:!1,ONE_SOURCE:!1};a.browserType===a.BROWSER_TYPE_FIREFOX&&(b.DELAY_CREATE_CTX=!0,b.USE_LOADER_EVENT="canplay");a.os===a.OS_IOS&&(b.USE_LOADER_EVENT="loadedmetadata");a.os===a.OS_ANDROID&&a.browserType===a.BROWSER_TYPE_UC&&(b.ONE_SOURCE=!0);window.__audioSupport=b})();
cc.Audio=cc.Class.extend({interruptPlay:!1,src:null,_element:null,_AUDIO_TYPE:"AUDIO",ctor:function(a){this.src=a},setBuffer:function(a){this._AUDIO_TYPE="WEBAUDIO";this._element=new cc.Audio.WebAudio(a)},setElement:function(a){this._AUDIO_TYPE="AUDIO";this._element=a;a.addEventListener("ended",function(){a.loop||(a.paused=!0)})},play:function(a,b){this._element?(this._element.loop=b,this._element.play(),"AUDIO"===this._AUDIO_TYPE&&this._element.paused&&(this.stop(),cc.Audio.touchPlayList.push({loop:b,
offset:a,audio:this._element})),!1===cc.Audio.bindTouch&&(cc.Audio.bindTouch=!0,cc.game.canvas.addEventListener("touchstart",cc.Audio.touchStart))):this.interruptPlay=!1},getPlaying:function(){return this._element?!this._element.paused:!0},stop:function(){if(this._element){this._element.pause();try{this._element.currentTime=0}catch(a){}}else this.interruptPlay=!0},pause:function(){this._element?this._element.pause():this.interruptPlay=!0},resume:function(){this._element?this._element.play():this.interruptPlay=
!1},setVolume:function(a){this._element&&(this._element.volume=a)},getVolume:function(){if(this._element)return this._element.volume},cloneNode:function(){var a=new cc.Audio(this.src);if("AUDIO"===this._AUDIO_TYPE){for(var b=document.createElement("audio"),c=b.getElementsByTagName("source"),d=0;d<c.length;d++)b.appendChild(c[d]);b.src=this.src;a.setElement(b)}else a.setBuffer(this._element.buffer);return a}});cc.Audio.touchPlayList=[];cc.Audio.bindTouch=!1;
cc.Audio.touchStart=function(){for(var a=cc.Audio.touchPlayList,b=null;b=a.pop();)b.audio.loop=!!b.loop,b.audio.play(b.offset)};cc.Audio.WebAudio=function(a){this.buffer=a;this.context=cc.Audio._context;a=this.context.createGain();a.gain.value=1;a.connect(this.context.destination);this._volume=a;this._loop=!1;this._startTime=-1;this._currentSource=null;this.playedLength=0;this._currextTimer=null};
cc.Audio.WebAudio.prototype={constructor:cc.Audio.WebAudio,get paused(){return this._currentSource&&this._currentSource.loop?!1:-1===this._startTime?!0:this.context.currentTime-this._startTime>this.buffer.duration},set paused(a){},get loop(){return this._loop},set loop(a){return this._loop=a},get volume(){return this._volume.gain.value},set volume(a){return this._volume.gain.value=a},get currentTime(){return this.playedLength},set currentTime(a){return this.playedLength=a},play:function(a){this._currentSource&&
!this.paused&&(this._currentSource.stop(0),this.playedLength=0);var b=this.context.createBufferSource();b.buffer=this.buffer;b.connect(this._volume);b.loop=this._loop;this._startTime=this.context.currentTime;a=a||this.playedLength;var c=this.buffer.duration;this._loop?b.start?b.start(0):b.notoGrainOn?b.noteGrainOn(0):b.noteOn(0):b.start?b.start(0,a,c-a):b.notoGrainOn?b.noteGrainOn(0,a,c-a):b.noteOn(0,a,c-a);this._currentSource=b;if(0===this.context.currentTime){var d=this;clearTimeout(this._currextTimer);
this._currextTimer=setTimeout(function(){0===d.context.currentTime&&cc.Audio.touchPlayList.push({offset:a,audio:d})},10)}},pause:function(){this.playedLength=this.context.currentTime-this._startTime;this.playedLength%=this.buffer.duration;var a=this._currentSource;this._currentSource=null;this._startTime=-1;a&&a.stop(0)}};
(function(a){var b=a.WEB_AUDIO,c=a.ONLY_ONE,d=[];(function(){var a=document.createElement("audio");if(a.canPlayType){var b=a.canPlayType('audio/ogg; codecs\x3d"vorbis"');b&&""!==b&&d.push(".ogg");(b=a.canPlayType("audio/mpeg"))&&""!==b&&d.push(".mp3");(b=a.canPlayType('audio/wav; codecs\x3d"1"'))&&""!==b&&d.push(".wav");(b=a.canPlayType("audio/mp4"))&&""!==b&&d.push(".mp4");(a=a.canPlayType("audio/x-m4a"))&&""!==a&&d.push(".m4a")}})();try{if(b){var e=new (window.AudioContext||window.webkitAudioContext||
window.mozAudioContext);cc.Audio._context=e;if(!(e.createBufferSource&&e.createGain&&e.destination&&e.decodeAudioData))throw"context is incomplete";a.DELAY_CREATE_CTX&&setTimeout(function(){e=new (window.AudioContext||window.webkitAudioContext||window.mozAudioContext);cc.Audio._context=e},0)}}catch(f){b=!1,cc.log("browser don't support web audio")}var h={cache:{},useWebAudio:!0,loadBuffer:function(a,c){if(b){var d=cc.loader.getXMLHttpRequest();d.open("GET",a,!0);d.responseType="arraybuffer";d.onload=
function(){0<=d._timeoutId&&clearTimeout(d._timeoutId);e.decodeAudioData(d.response,function(a){c(null,a)},function(){c("decode error - "+a)})};d.onerror=function(){c("request error - "+a)};void 0===d.ontimeout&&(d._timeoutId=setTimeout(function(){d.ontimeout()},d.timeout));d.ontimeout=function(){c("request timeout - "+a)};d.send()}},load:function(a,b,c,e){if(0===d.length)return e("can not support audio!");var f=cc.loader.getRes(b);if(f)return e(null,f);cc.loader.audioPath&&(a=cc.path.join(cc.loader.audioPath,
a));f=cc.path.extname(a);c=[f];for(var h=0;h<d.length;h++)f!==d[h]&&c.push(d[h]);f=new cc.Audio(a);cc.loader.cache[b]=f;this.loadAudioFromExtList(a,c,f,e);return f},loadAudioFromExtList:function(c,e,f,h){if(0===e.length){var r="can not found the resource of audio! Last match url is : ",r=r+c.replace(/\.(.*)?$/,"(");d.forEach(function(a){r+=a+"|"});r=r.replace(/\|$/,")");return h({status:520,errorMessage:r},null)}if(b&&this.useWebAudio)this.loadBuffer(c,function(a,b){a&&cc.log(a);b&&f.setBuffer(b);
h(null,f)});else{for(var s=a.ONE_SOURCE?1:e.length,t=document.createElement("audio"),w=0;w<s;w++){var v=document.createElement("source");v.src=cc.path.changeExtname(c,e[w]);t.appendChild(v)}f.setElement(t);var y=setTimeout(function(){0===t.readyState?u():x()},8E3),x=function(){t.removeEventListener("canplaythrough",x,!1);t.removeEventListener("error",u,!1);t.removeEventListener("emptied",x,!1);a.USE_LOADER_EVENT&&t.removeEventListener(a.USE_LOADER_EVENT,x,!1);clearTimeout(y);h(null,f)},u=function(){cc.log("load audio failure - "+
c);x()};t.addEventListener("canplaythrough",x,!1);t.addEventListener("error",u,!1);a.USE_LOADER_EVENT&&t.addEventListener(a.USE_LOADER_EVENT,x,!1)}}};cc.loader.register(["mp3","ogg","wav","mp4","m4a"],h);cc.audioEngine={_currMusic:null,_musicVolume:1,features:a,willPlayMusic:function(){return!1},playMusic:function(a,b){var c=this._currMusic;c&&c.getPlaying()&&c.stop();var d=this._musicVolume,e=cc.loader.getRes(a);e||(cc.loader.load(a,function(){e.getPlaying()||e.interruptPlay||(e.setVolume(d),e.play(0,
b||!1))}),e=cc.loader.getRes(a));e.setVolume(d);e.play(0,b||!1);this._currMusic=e},stopMusic:function(a){var b=this._currMusic;if(b){for(var c=cc.Audio.touchPlayList,d=c.length-1;0<=d;--d)this[d]&&this[d].audio===b._element&&c.splice(d,1);b.stop();this._currMusic=null;a&&cc.loader.release(b.src)}},pauseMusic:function(){var a=this._currMusic;a&&a.pause()},resumeMusic:function(){var a=this._currMusic;a&&a.resume()},rewindMusic:function(){var a=this._currMusic;a&&(a.stop(),a.play())},getMusicVolume:function(){return this._musicVolume},
setMusicVolume:function(a){a-=0;isNaN(a)&&(a=1);1<a&&(a=1);0>a&&(a=0);this._musicVolume=a;var b=this._currMusic;b&&b.setVolume(a)},isMusicPlaying:function(){var a=this._currMusic;return a?a.getPlaying():!1},_audioPool:{},_maxAudioInstance:10,_effectVolume:1,playEffect:function(a,d){if(c&&this._currMusic&&this._currMusic.getPlaying())return cc.log("Browser is only allowed to play one audio"),null;var e=this._audioPool[a];e||(e=this._audioPool[a]=[]);for(var f=0;f<e.length&&e[f].getPlaying();f++);!b&&
f>this._maxAudioInstance&&(f=e.shift(),f.stop(),e.push(f),f=e.length-1);var r;if(e[f])return r=e[f],r.setVolume(this._effectVolume),r.play(0,d||!1),r;(r=cc.loader.getRes(a))&&b&&"AUDIO"===r._AUDIO_TYPE&&(cc.loader.release(a),r=null);if(r)if(b&&"AUDIO"===r._AUDIO_TYPE)h.loadBuffer(a,function(a,b){r.setBuffer(b);r.setVolume(cc.audioEngine._effectVolume);r.getPlaying()||r.play(0,d||!1)});else return r=r.cloneNode(),r.setVolume(this._effectVolume),r.play(0,d||!1),e.push(r),r;f=h.useWebAudio;h.useWebAudio=
!0;cc.loader.load(a,function(b){b=cc.loader.getRes(a);b=b.cloneNode();b.setVolume(cc.audioEngine._effectVolume);b.play(0,d||!1);e.push(b)});h.useWebAudio=f;return r},setEffectsVolume:function(a){a-=0;isNaN(a)&&(a=1);1<a&&(a=1);0>a&&(a=0);this._effectVolume=a;var b=this._audioPool,c;for(c in b){var d=b[c];if(Array.isArray(d))for(var e=0;e<d.length;e++)d[e].setVolume(a)}},getEffectsVolume:function(){return this._effectVolume},pauseEffect:function(a){a&&a.pause()},pauseAllEffects:function(){var a=this._audioPool,
b;for(b in a)for(var c=a[b],d=0;d<a[b].length;d++)c[d].getPlaying()&&c[d].pause()},resumeEffect:function(a){a&&a.resume()},resumeAllEffects:function(){var a=this._audioPool,b;for(b in a)for(var c=a[b],d=0;d<a[b].length;d++)c[d].resume()},stopEffect:function(a){a&&a.stop()},stopAllEffects:function(){var a=this._audioPool,b;for(b in a){for(var c=a[b],d=0;d<c.length;d++)c[d].stop();c.length=0}a.length=0},unloadEffect:function(a){if(a){cc.loader.release(a);var b=this._audioPool[a];if(b){for(var c=0;c<
b.length;c++)b[c].stop();b.length=0}delete this._audioPool[a]}},end:function(){this.stopMusic();this.stopAllEffects()},_pauseCache:[],_pausePlaying:function(){var a=this._currMusic;a&&a.getPlaying()&&(a.pause(),this._pauseCache.push(a));var a=this._audioPool,b;for(b in a)for(var c=a[b],d=0;d<a[b].length;d++)c[d].getPlaying()&&(c[d].pause(),this._pauseCache.push(c[d]))},_resumePlaying:function(){for(var a=this._pauseCache,b=0;b<a.length;b++)a[b].resume();a.length=0}}})(window.__audioSupport);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.Layer.extend({_isOpacityModifyRGB:!1,_hasVisibleParents:!1,_touchListener:null,_className:"Control",isOpacityModifyRGB:function(){return this._isOpacityModifyRGB},setOpacityModifyRGB:function(a){this._isOpacityModifyRGB=a;for(var b=this.getChildren(),c=0,d=b.length;c<d;c++){var e=b[c];e&&e.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.Layer.prototype.ctor.call(this);
this._dispatchTable={};this._color=cc.color.WHITE},init:function(){this._state=cc.CONTROL_STATE_NORMAL;this._enabled=!0;this._highlighted=this._selected=!1;var a=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0});this.onTouchBegan&&(a.onTouchBegan=this.onTouchBegan.bind(this));this.onTouchMoved&&(a.onTouchMoved=this.onTouchMoved.bind(this));this.onTouchEnded&&(a.onTouchEnded=this.onTouchEnded.bind(this));this.onTouchCancelled&&(a.onTouchCancelled=this.onTouchCancelled.bind(this));
this._touchListener=a;return!0},onEnter:function(){var a=this._touchListener;a._isRegistered()||cc.eventManager.addListener(a,this);cc.Node.prototype.onEnter.call(this)},sendActionsForControlEvents:function(a){for(var b=0,c=cc.CONTROL_EVENT_TOTAL_NUMBER;b<c;b++)if(a&1<<b)for(var d=this._dispatchListforControlEvent(1<<b),e=0,f=d.length;e<f;e++)d[e].invoke(this)},addTargetWithActionForControlEvents:function(a,b,c){for(var d=0,e=cc.CONTROL_EVENT_TOTAL_NUMBER;d<e;d++)c&1<<d&&this._addTargetWithActionForControlEvent(a,
b,1<<d)},removeTargetWithActionForControlEvents:function(a,b,c){for(var d=0,e=cc.CONTROL_EVENT_TOTAL_NUMBER;d<e;d++)c&1<<d&&this._removeTargetWithActionForControlEvent(a,b,1<<d)},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,b,c){return null},_dispatchListforControlEvent:function(a){a=
a.toString();this._dispatchTable[a]||(this._dispatchTable[a]=[]);return this._dispatchTable[a]},_addTargetWithActionForControlEvent:function(a,b,c){a=new cc.Invocation(a,b,c);this._dispatchListforControlEvent(c).push(a)},_removeTargetWithActionForControlEvent:function(a,b,c){c=this._dispatchListforControlEvent(c);if(a||b)for(var d=0;d<c.length;){var e=c[d],f=!0;a&&(f=a===e.getTarget());b&&(f=f&&b===e.getAction());f?cc.arrayRemoveObject(c,e):d++}else c.length=0},needsLayout:function(){}});_p=cc.Control.prototype;
cc.defineGetterSetter(_p,"state",_p.getState);cc.defineGetterSetter(_p,"enabled",_p.isEnabled,_p.setEnabled);cc.defineGetterSetter(_p,"selected",_p.isSelected,_p.setSelected);cc.defineGetterSetter(_p,"highlighted",_p.isHighlighted,_p.setHighlighted);_p=null;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,_className:"ControlButton",ctor:function(a,b,c){cc.Control.prototype.ctor.call(this);this._preferredSize=cc.size(0,
0);this._labelAnchorPoint=cc.p(0,0);this._currentTitle="";this._currentTitleColor=cc.color.WHITE;this._titleDispatchTable={};this._titleColorDispatchTable={};this._titleLabelDispatchTable={};this._backgroundSpriteDispatchTable={};void 0!=c?this.initWithTitleAndFontNameAndFontSize(a,b,c):void 0!=b?this.initWithLabelAndBackgroundSprite(a,b):void 0!=a?this.initWithBackgroundSprite(a):this.init()},init:function(){return this.initWithLabelAndBackgroundSprite(new cc.LabelTTF("","Arial",12),new cc.Scale9Sprite)},
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 b=this._titleLabel=this.getTitleLabelForState(a);b&&b.setString&&b.setString(this._currentTitle);b&&b.setColor(this._currentTitleColor);var c=this.getContentSize();b&&b.setPosition(c.width/
2,c.height/2);(a=this._backgroundSprite=this.getBackgroundSpriteForState(a))&&a.setPosition(c.width/2,c.height/2);c=cc.size(0,0);if(b){var d=b.getBoundingBox();c.width=d.width;c.height=d.height}this._doesAdjustBackgroundImage?a&&a.setContentSize(c.width+2*this._marginH,c.height+2*this._marginV):a&&(d=a.getPreferredSize(),d=cc.size(d.width,d.height),0>=d.width&&(d.width=c.width),0>=d.height&&(d.height=c.height),a.setContentSize(d));c=b?b.getBoundingBox():cc.rect(0,0,0,0);d=a?a.getBoundingBox():cc.rect(0,
0,0,0);c=cc.rectUnion(c,d);this.setContentSize(c.width,c.height);c=this.getContentSize();b&&(b.setPosition(c.width/2,c.height/2),b.setVisible(!0));a&&(a.setPosition(c.width/2,c.height/2),a.setVisible(!0))}},initWithLabelAndBackgroundSprite:function(a,b){if(!a)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): label should be non-null");if(!b)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): backgroundSprite should be non-null");if(cc.Control.prototype.init.call(this,
!0)){this._parentInited=!0;this._titleDispatchTable={};this._titleColorDispatchTable={};this._titleLabelDispatchTable={};this._backgroundSpriteDispatchTable={};this._isPushed=!1;this.zoomOnTouchDown=!0;this._currentTitle=null;this.setAdjustBackgroundImage(!0);this.setPreferredSize(cc.size(0,0));this.zoomOnTouchDown=!0;this.ignoreAnchorPointForPosition(!1);this.setAnchorPoint(0.5,0.5);this._titleLabel=a;this._backgroundSprite=b;this.setOpacity(255);this.setOpacityModifyRGB(!0);var c=a.getString();
this.setTitleForState(c,cc.CONTROL_STATE_NORMAL);this.setTitleColorForState(a.getColor(),cc.CONTROL_STATE_NORMAL);this.setTitleLabelForState(a,cc.CONTROL_STATE_NORMAL);this.setBackgroundSpriteForState(b,cc.CONTROL_STATE_NORMAL);this._state=cc.CONTROL_STATE_NORMAL;this._marginH=24;this._marginV=12;this._labelAnchorPoint=cc.p(0.5,0.5);this.setPreferredSize(cc.size(0,0));this.needsLayout();return!0}return!1},initWithTitleAndFontNameAndFontSize:function(a,b,c){a=new cc.LabelTTF(a,b,c);return this.initWithLabelAndBackgroundSprite(a,
new cc.Scale9Sprite)},initWithBackgroundSprite:function(a){var b=new cc.LabelTTF("","Arial",30);return this.initWithLabelAndBackgroundSprite(b,a)},doesAdjustBackgroundImage:function(){return this._doesAdjustBackgroundImage},setAdjustBackgroundImage:function(a){this._doesAdjustBackgroundImage=a;this.needsLayout()},getZoomOnTouchDown:function(){return this.zoomOnTouchDown},setZoomOnTouchDown:function(a){return this.zoomOnTouchDown=a},getPreferredSize:function(){return this._preferredSize},setPreferredSize:function(a){if(0===
a.width&&0===a.height)this._doesAdjustBackgroundImage=!0;else{this._doesAdjustBackgroundImage=!1;var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setPreferredSize(a)}this._preferredSize=a;this.needsLayout()},getLabelAnchorPoint:function(){return this._labelAnchorPoint},setLabelAnchorPoint:function(a){this._labelAnchorPoint=a;this._titleLabel&&this._titleLabel.setAnchorPoint(a)},_getCurrentTitle:function(){return this._currentTitle},_getCurrentTitleColor:function(){return this._currentTitleColor},
getOpacity:function(){return this._opacity},setOpacity:function(a){cc.Control.prototype.setOpacity.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setOpacity(a)},setColor:function(a){cc.Control.prototype.setColor.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setColor(a)},getColor:function(){var a=this._realColor;return cc.color(a.r,a.g,a.b,a.a)},isPushed:function(){return this._isPushed},_getVerticalMargin:function(){return this._marginV},_getHorizontalOrigin:function(){return this._marginH},
setMargins:function(a,b){this._marginV=b;this._marginH=a;this.needsLayout()},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this.needsLayout()},setSelected:function(a){cc.Control.prototype.setSelected.call(this,a);this.needsLayout()},setHighlighted:function(a){this._state=a?cc.CONTROL_STATE_HIGHLIGHTED:cc.CONTROL_STATE_NORMAL;cc.Control.prototype.setHighlighted.call(this,a);(a=this.getActionByTag(cc.CONTROL_ZOOM_ACTION_TAG))&&this.stopAction(a);this.zoomOnTouchDown&&(a=this.isHighlighted()&&
this.isEnabled()&&!this.isSelected()?1.1:1,a=cc.scaleTo(0.05,a),a.setTag(cc.CONTROL_ZOOM_ACTION_TAG),this.runAction(a))},onTouchBegan:function(a,b){if(!(this.isTouchInside(a)&&this.isEnabled()&&this.isVisible()&&this.hasVisibleParents()))return!1;this._isPushed=!0;this.setHighlighted(!0);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DOWN);return!0},onTouchMoved:function(a,b){if(this._enabled&&this._isPushed&&!this._selected){var c=this.isTouchInside(a);c&&!this._highlighted?(this.setHighlighted(!0),
this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_ENTER)):c&&this._highlighted?this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE):!c&&this._highlighted?(this.setHighlighted(!1),this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_EXIT)):c||this._highlighted||this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE)}else this._highlighted&&this.setHighlighted(!1)},onTouchEnded:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.isTouchInside(a)?
this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_INSIDE):this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_OUTSIDE)},onTouchCancelled:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_CANCEL)},getTitleForState:function(a){var b=this._titleDispatchTable;return b?b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]:""},setTitleForState:function(a,b){this._titleDispatchTable[b]=a||"";this.getState()===b&&this.needsLayout()},getTitleColorForState:function(a){return(a=
this._titleColorDispatchTable[a])?a:(a=this._titleColorDispatchTable[cc.CONTROL_STATE_NORMAL])?a:cc.color.WHITE},setTitleColorForState:function(a,b){this._titleColorDispatchTable[b]=a;this.getState()===b&&this.needsLayout()},getTitleLabelForState:function(a){var b=this._titleLabelDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setTitleLabelForState:function(a,b){var c=this._titleLabelDispatchTable;if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(0.5,
0.5);this.addChild(a,1);this.getState()===b&&this.needsLayout()},setTitleTTFForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelTTF(c,a,12),b)},getTitleTTFForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelTTF?a.getFontName():""},setTitleTTFSizeForState:function(a,b){var c=this.getTitleLabelForState(b);null!=c&&c instanceof cc.LabelTTF&&c.setFontSize(a)},getTitleTTFSizeForState:function(a){a=this.getTitleLabelForState(a);
return null!=a&&a instanceof cc.LabelTTF?a.getFontSize():0},setTitleBMFontForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelBMFont(c,a),b)},getTitleBMFontForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelBMFont?a.getFntFile():""},getBackgroundSpriteForState:function(a){var b=this._backgroundSpriteDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setBackgroundSpriteForState:function(a,b){var c=this._backgroundSpriteDispatchTable;
if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(0.5,0.5);this.addChild(a);c=this._preferredSize;0===c.width&&0===c.height||a.setPreferredSize(c);this._state===b&&this.needsLayout()},setBackgroundSpriteFrameForState:function(a,b){var c=cc.Scale9Sprite.createWithSpriteFrame(a);this.setBackgroundSpriteForState(c,b)}});_p=cc.ControlButton.prototype;cc.defineGetterSetter(_p,"adjustBackground",_p.getAdjustBackgroundImage,_p.setAdjustBackgroundImage);
cc.defineGetterSetter(_p,"preferredSize",_p.getPreferredSize,_p.setPreferredSize);cc.defineGetterSetter(_p,"labelAnchor",_p.getLabelAnchorPoint,_p.setLabelAnchorPoint);_p=null;cc.ControlButton.create=function(a,b,c){return new cc.ControlButton(a,b,c)};cc.RGBA=function(a,b,c,d){this.r=a;this.g=b;this.b=c;this.a=d};cc.HSV=function(a,b,c){this.h=a;this.s=b;this.v=c};cc.ControlUtils={};cc.ControlUtils.addSpriteToTargetWithPosAndAnchor=function(a,b,c,d){a=new cc.Sprite("#"+a);if(!a)return null;a.setPosition(c);a.setAnchorPoint(d);b.addChild(a);return a};
cc.ControlUtils.HSVfromRGB=function(a){var b=new cc.HSV,c,d;c=a.r<a.g?a.r:a.g;c=c<a.b?c:a.b;d=a.r>a.g?a.r:a.g;d=d>a.b?d:a.b;b.v=d;c=d-c;if(0<d)b.s=c/d;else return b.s=0,b.h=-1,b;b.h=a.r>=d?(a.g-a.b)/c:a.g>=d?2+(a.b-a.r)/c:4+(a.r-a.g)/c;b.h*=60;0>b.h&&(b.h+=360);return b};
cc.ControlUtils.RGBfromHSV=function(a){var b,c,d,e,f=new cc.RGBA;f.a=1;if(0>=a.s){if(!a.h)return f.r=a.v,f.g=a.v,f.b=a.v,f;f.r=0;f.g=0;f.b=0;return f}b=a.h;360<=b&&(b=0);b/=60;e=0|b;d=b-e;b=a.v*(1-a.s);c=a.v*(1-a.s*d);d=a.v*(1-a.s*(1-d));switch(e){case 0:f.r=a.v;f.g=d;f.b=b;break;case 1:f.r=c;f.g=a.v;f.b=b;break;case 2:f.r=b;f.g=a.v;f.b=d;break;case 3:f.r=b;f.g=c;f.b=a.v;break;case 4:f.r=d;f.g=b;f.b=a.v;break;default:f.r=a.v,f.g=b,f.b=c}return f};
cc.ControlUtils.CCRectUnion=function(a,b){return cc.rectUnion(a,b)};cc.Invocation=cc.Class.extend({_action:null,_target:null,_controlEvent:null,ctor:function(a,b,c){this._target=a;this._action=b;this._controlEvent=c},getAction:function(){return this._action},getTarget:function(){return this._target},getControlEvent:function(){return this._controlEvent},invoke:function(a){if(this._target&&this._action)if(cc.isString(this._action))this._target[this._action](a,this._controlEvent);else this._action.call(this._target,a,this._controlEvent)}});cc.Spacer=cc.Layer.extend({});cc.Spacer.verticalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(0,a);return b};cc.Spacer.horizontalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(a,0);return b};
cc.MenuPassive=cc.Layer.extend({_color:null,_opacity:0,_className:"MenuPassive",ctor:function(){},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b;if(this._children&&0<this._children.length)for(b=0;b<this._children.length;b++)this._children[b]&&this._children[b].setColor(a);void 0===a.a||a.a_undefined||this.setOpacity(a.a)},getOpacity:function(){return this._opacity},setOpacity:function(a){this._opacity=a;if(this._children&&
0<this._children.length)for(var b=0;b<this._children.length;b++)this._children[b]&&this._children[b].setOpacity(a);this._color.a=a},initWithItems:function(a,b){if(this.init()){var c=cc.director.getWinSize();this.ignoreAnchorPointForPosition(!0);this.setAnchorPoint(0.5,0.5);this.setContentSize(c);this.setPosition(c.width/2,c.height/2);c=0;if(a){this.addChild(a,c);for(var d=0;d<b.length;d++)b[d]&&(c++,this.addChild(b[d],c))}return!0}return!1},alignItemsVertically:function(){this.alignItemsVerticallyWithPadding(cc.DEFAULT_PADDING)},
alignItemsVerticallyWithPadding:function(a){var b=-a,c;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(b+=this._children[c].getContentSize().height*this._children[c].getScaleY()+a);var d=0,e=b/2;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(d=Math.max(d,this._children[c].getContentSize().width),this._children[c].setPosition(0,e-this._children[c].getContentSize().height*this._children[c].getScaleY()/
2),e-=this._children[c].getContentSize().height*this._children[c].getScaleY()+a);this.setContentSize(d,b)},alignItemsHorizontally:function(){this.alignItemsHorizontallyWithPadding(cc.DEFAULT_PADDING)},alignItemsHorizontallyWithPadding:function(a){var b=-a,c;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(b+=this._children[c].getContentSize().width*this._children[c].getScaleX()+a);var d=0,e=-b/2;if(this._children&&0<this._children.length)for(c=0;c<
this._children.length;c++)this._children[c]&&(d=Math.max(d,this._children[c].getContentSize().height),this._children[c].setPosition(e+this._children[c].getContentSize().width*this._children[c].getScaleX()/2,0),e+=this._children[c].getContentSize().width*this._children[c].getScaleX()+a);this.setContentSize(b,d)},alignItemsInColumns:function(a){var b=[],c;for(c=1;c<arguments.length;c++)b.push(arguments[c]);var d=-5,e=0,f=0,h=0,k,m;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&
(e>=b.length?cc.log("cc.MenuPassive.alignItemsInColumns(): invalid row index"):(k=b[e])?(m=this._children[c].getContentSize().height,f=0|(f>=m||null==m?f:m),++h,h>=k&&(d+=f+5,f=h=0,++e)):cc.log("cc.MenuPassive.alignItemsInColumns(): can not have zero columns on a row"));var n=cc.director.getWinSize(),p=k=f=e=0,r=0,d=d/2;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(0===k&&(k=b[e],r=p=n.width/(1+k)),m=this._children[c].getContentSize().height,f=
0|(f>=m||null==m?f:m),this._children[c].setPosition(r-n.width/2,d-this._children[c].getContentSize().height/2),r+=p,++h,h>=k&&(d-=f+5,f=k=h=0,++e))},alignItemsInRows:function(a){var b=[],c;for(c=1;c<arguments.length;c++)b.push(arguments[c]);var d=[],e=[],f=-10,h=-5,k=0,m=0,n=0,p,r;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(k>=b.length?cc.log("cc.MenuPassive.alignItemsInRows(): invalid row index"):(p=b[k])?(r=this._children[c].getContentSize().width,
m=0|(m>=r||null==r?m:r),h+=0|this._children[c].getContentSize().height+5,++n,n>=p&&(d.push(m),e.push(h),f+=m+10,m=n=0,h=-5,++k)):cc.log("cc.MenuPassive.alignItemsInColumns(): can't have zero rows on a column"));h=cc.director.getWinSize();m=k=0;p=null;var f=-f/2,s=0;if(this._children&&0<this._children.length)for(c=0;c<this._children.length;c++)this._children[c]&&(null==p&&(p=b[k],s=e[k]),r=this._children[c].getContentSize().width,m=0|(m>=r||null==r?m:r),this._children[c].setPosition(f+d[k]/2,s-h.height/
2),s-=this._children[c].getContentSize().height+10,++n,n>=p&&(f+=m+5,m=p=n=0,++k))},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1}});cc.MenuPassive.create=function(a){a||(a=null);for(var b=[],c=1;c<arguments.length;c++)b.push(arguments[c]);return(c=new cc.MenuPassive)&&c.initWithItems(a,b)?c:null};cc.MenuPassive.createWithItem=function(a){return cc.MenuPassive.create(a,null)};cc.ControlSaturationBrightnessPicker=cc.Control.extend({_saturation:0,_brightness:0,_background:null,_overlay:null,_shadow:null,_slider:null,_startPos:null,_boxPos:0,_boxSize:0,_className:"ControlSaturationBrightnessPicker",ctor:function(a,b){cc.Control.prototype.ctor.call(this);b&&this.initWithTargetAndPos(a,b)},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,b){return cc.Control.prototype.init.call(this)?(this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerBackground.png",a,b,cc.p(0,0)),this._overlay=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerOverlay.png",a,b,cc.p(0,0)),this._shadow=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPickerShadow.png",
a,b,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",a,b,cc.p(0.5,0.5)),this._startPos=b,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 b=new cc.HSV;b.s=1;b.h=a.h;b.v=1;a=cc.ControlUtils.RGBfromHSV(b);this._background.setColor(cc.color(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 b=this._startPos.x+0.5*this._background.getBoundingBox().width,c=this._startPos.y+0.5*this._background.getBoundingBox().height,d=a.x-b,e=a.y-c,f=Math.sqrt(d*d+e*e),d=Math.atan2(e,d),e=0.5*this._background.getBoundingBox().width;f>e&&(a.x=b+e*Math.cos(d),a.y=c+e*Math.sin(d));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 b=this._startPos.x+
0.5*this._background.getBoundingBox().width,c=this._startPos.y+0.5*this._background.getBoundingBox().height,b=a.x-b,c=a.y-c;return Math.sqrt(b*b+c*c)<=0.5*this._background.getBoundingBox().width?(this._updateSliderPosition(a),this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED),!0):!1},onTouchBegan:function(a,b){if(!this.isEnabled()||!this.isVisible())return!1;var c=this.getTouchLocation(a);return this._checkSliderPosition(c)},onTouchMoved:function(a,b){var c=this.getTouchLocation(a);this._checkSliderPosition(c)}});
_p=cc.ControlSaturationBrightnessPicker.prototype;cc.defineGetterSetter(_p,"saturation",_p.getSaturation);cc.defineGetterSetter(_p,"brightness",_p.getBrightness);cc.defineGetterSetter(_p,"background",_p.getBackground);cc.defineGetterSetter(_p,"overlay",_p.getOverlay);cc.defineGetterSetter(_p,"shadow",_p.getShadow);cc.defineGetterSetter(_p,"slider",_p.getSlider);cc.defineGetterSetter(_p,"startPos",_p.getStartPos);_p=null;
cc.ControlSaturationBrightnessPicker.create=function(a,b){return new cc.ControlSaturationBrightnessPicker(a,b)};cc.ControlHuePicker=cc.Control.extend({_hue:0,_huePercentage:0,_background:null,_slider:null,_startPos:null,_className:"ControlHuePicker",ctor:function(a,b){cc.Control.prototype.ctor.call(this);b&&this.initWithTargetAndPos(a,b)},getHue:function(){return this._hue},setHue:function(a){this._hue=a;this.setHuePercentage(this._hue/360)},getHuePercentage:function(){return this._huePercentage},setHuePercentage:function(a){this._huePercentage=a;this._hue=360*this._huePercentage;var b=this._background.getBoundingBox(),
c=this._startPos.x+0.5*b.width;a=this._startPos.y+0.5*b.height;var b=0.5*b.width-15,d=cc.degreesToRadians(360*this._huePercentage-180),c=c+b*Math.cos(d);a+=b*Math.sin(d);this._slider.setPosition(c,a)},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._slider&&this._slider.setOpacity(a?255:128)},getBackground:function(){return this._background},getSlider:function(){return this._slider},getStartPos:function(){return this._startPos},initWithTargetAndPos:function(a,b){return cc.Control.prototype.init.call(this)?
(this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("huePickerBackground.png",a,b,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",a,b,cc.p(0.5,0.5)),this._slider.setPosition(b.x,b.y+0.5*this._background.getBoundingBox().height),this._startPos=b,this._huePercentage=this._hue=0,!0):!1},_updateSliderPosition:function(a){var b=this._background.getBoundingBox();a=Math.atan2(a.y-(this._startPos.y+0.5*b.height),a.x-(this._startPos.x+0.5*b.width));
a=cc.radiansToDegrees(a)+180;this.setHue(a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},_checkSliderPosition:function(a){var b=Math.sqrt(Math.pow(a.x+10,2)+Math.pow(a.y,2));return 80>b&&59<b?(this._updateSliderPosition(a),!0):!1},onTouchBegan:function(a,b){if(!this.isEnabled()||!this.isVisible())return!1;var c=this.getTouchLocation(a);return this._checkSliderPosition(c)},onTouchMoved:function(a,b){var c=this.getTouchLocation(a);this._checkSliderPosition(c)}});_p=cc.ControlHuePicker.prototype;
cc.defineGetterSetter(_p,"hue",_p.getHue,_p.setHue);cc.defineGetterSetter(_p,"huePercent",_p.getHuePercentage,_p.setHuePercentage);cc.defineGetterSetter(_p,"background",_p.getBackground);cc.defineGetterSetter(_p,"slider",_p.getSlider);cc.defineGetterSetter(_p,"startPos",_p.getStartPos);_p=null;cc.ControlHuePicker.create=function(a,b){return new cc.ControlHuePicker(a,b)};cc.ControlColourPicker=cc.Control.extend({_hsv:null,_colourPicker:null,_huePicker:null,_background:null,_className:"ControlColourPicker",ctor:function(){cc.Control.prototype.ctor.call(this);this.init()},hueSliderValueChanged:function(a,b){this._hsv.h=a.getHue();var c=cc.ControlUtils.RGBfromHSV(this._hsv);cc.Control.prototype.setColor.call(this,cc.color(0|255*c.r,0|255*c.g,0|255*c.b));this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED);this._updateControlPicker()},colourSliderValueChanged:function(a,
b){this._hsv.s=a.getSaturation();this._hsv.v=a.getBrightness();var c=cc.ControlUtils.RGBfromHSV(this._hsv);cc.Control.prototype.setColor.call(this,cc.color(0|255*c.r,0|255*c.g,0|255*c.b));this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},setColor:function(a){cc.Control.prototype.setColor.call(this,a);var b=new cc.RGBA;b.r=a.r/255;b.g=a.g/255;b.b=a.b/255;b.a=1;this._hsv=cc.ControlUtils.HSVfromRGB(b);this._updateHueAndControlPicker()},getBackground:function(){return this._background},
init:function(){if(cc.Control.prototype.init.call(this)){cc.spriteFrameCache.addSpriteFrames(res.CCControlColourPickerSpriteSheet_plist);var a=new cc.SpriteBatchNode(res.CCControlColourPickerSpriteSheet_png);this.addChild(a);this._hsv=new cc.HSV(0,0,0);this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("menuColourPanelBackground.png",a,cc.p(0,0),cc.p(0.5,0.5));var b=cc.pSub(this._background.getPosition(),cc.p(this._background.getContentSize().width/2,this._background.getContentSize().height/
2));this._huePicker=new cc.ControlHuePicker(a,cc.p(b.x+8,b.y+8));this._colourPicker=new cc.ControlSaturationBrightnessPicker(a,cc.p(b.x+28,b.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}});
_p=cc.ControlColourPicker.prototype;cc.defineGetterSetter(_p,"background",_p.getBackground);_p=null;cc.ControlColourPicker.create=function(){return new cc.ControlColourPicker};var res=res||{};res.CCControlColourPickerSpriteSheet_plist=res.CCControlColourPickerSpriteSheet_plist||"res/extensions/CCControlColourPickerSpriteSheet.plist";res.CCControlColourPickerSpriteSheet_png=res.CCControlColourPickerSpriteSheet_png||"res/extensions/CCControlColourPickerSpriteSheet.png";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,_className:"ControlSlider",ctor:function(a,b,c){cc.Control.prototype.ctor.call(this);void 0!=c&&(a=new cc.Sprite(a),b=new cc.Sprite(b),c=new cc.Sprite(c),this.initWithSprites(a,b,c))},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 b=this.getBoundingBox();b.width+=this._thumbSprite.getContentSize().width;b.x-=this._thumbSprite.getContentSize().width/2;return cc.rectContainsPoint(b,a)},locationFromTouch:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width&&(a.x=this._backgroundSprite.getContentSize().width);return a},getMinimumAllowedValue:function(){return this._minimumAllowedValue},
setMinimumAllowedValue:function(a){this._minimumAllowedValue=a},getMaximumAllowedValue:function(){return this._maximumAllowedValue},setMaximumAllowedValue:function(a){this._maximumAllowedValue=a},getThumbSprite:function(){return this._thumbSprite},getProgressSprite:function(){return this._progressSprite},getBackgroundSprite:function(){return this._backgroundSprite},initWithSprites:function(a,b,c){return cc.Control.prototype.init.call(this)?(this.ignoreAnchorPointForPosition(!1),this._backgroundSprite=
a,this._progressSprite=b,this._thumbSprite=c,a=cc.ControlUtils.CCRectUnion(a.getBoundingBox(),c.getBoundingBox()),this.setContentSize(a.width,a.height),this._backgroundSprite.setAnchorPoint(0.5,0.5),this._backgroundSprite.setPosition(a.width/2,a.height/2),this.addChild(this._backgroundSprite),this._progressSprite.setAnchorPoint(0,0.5),this._progressSprite.setPosition(0,a.height/2),this.addChild(this._progressSprite),this._thumbSprite.setPosition(0,a.height/2),this.addChild(this._thumbSprite),this._minimumValue=
0,this._maximumValue=1,this.setValue(this._minimumValue),!0):!1},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._thumbSprite&&this._thumbSprite.setOpacity(a?255:128)},sliderBegan:function(a){this.setSelected(!0);this._thumbSprite.setColor(cc.color.GRAY);this.setValue(this.valueForLocation(a))},sliderMoved:function(a){this.setValue(this.valueForLocation(a))},sliderEnded:function(a){this.isSelected()&&this.setValue(this.valueForLocation(this._thumbSprite.getPosition()));this._thumbSprite.setColor(cc.color.WHITE);
this.setSelected(!1)},getTouchLocationInControl:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H&&(a.x=this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H);return a},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;var c=this.locationFromTouch(a);this.sliderBegan(c);return!0},onTouchMoved:function(a,b){var c=this.locationFromTouch(a);this.sliderMoved(c)},
onTouchEnded:function(a,b){this.sliderEnded(cc.p(0,0))},needsLayout:function(){this._thumbSprite.setPositionX((this._value-this._minimumValue)/(this._maximumValue-this._minimumValue)*this._backgroundSprite.getContentSize().width);var a=this._progressSprite.getTextureRect(),a=cc.rect(a.x,a.y,this._thumbSprite.getPositionX(),a.height);this._progressSprite.setTextureRect(a,this._progressSprite.isTextureRectRotated());this._thumbSprite._renderCmd.transform(this._renderCmd)},valueForLocation:function(a){a=
a.x/this._backgroundSprite.getContentSize().width;return Math.max(Math.min(this._minimumValue+a*(this._maximumValue-this._minimumValue),this._maximumAllowedValue),this._minimumAllowedValue)}});_p=cc.ControlSlider.prototype;cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue);cc.defineGetterSetter(_p,"minAllowedValue",_p.getMinimumAllowedValue,_p.setMinimumAllowedValue);
cc.defineGetterSetter(_p,"maxAllowedValue",_p.getMaximumAllowedValue,_p.setMaximumAllowedValue);cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite);cc.defineGetterSetter(_p,"progressSprite",_p.getProgressSprite);cc.defineGetterSetter(_p,"backgroundSprite",_p.getBackgroundSprite);_p=null;cc.ControlSlider.create=function(a,b,c){return new cc.ControlSlider(a,b,c)};cc.ControlSwitch=cc.Control.extend({_switchSprite:null,_initialTouchXPosition:0,_moved:!1,_on:!1,_className:"ControlSwitch",ctor:function(a,b,c,d,e,f){cc.Control.prototype.ctor.call(this);f&&this.initWithMaskSprite(a,b,c,d,e,f)},initWithMaskSprite:function(a,b,c,d,e,f){if(!a)throw Error("cc.ControlSwitch.initWithMaskSprite(): maskSprite should be non-null.");if(!b)throw Error("cc.ControlSwitch.initWithMaskSprite(): onSprite should be non-null.");if(!c)throw Error("cc.ControlSwitch.initWithMaskSprite(): offSprite should be non-null.");
if(!d)throw Error("cc.ControlSwitch.initWithMaskSprite(): thumbSprite should be non-null.");return this.init()?(this._on=!0,this._switchSprite=new cc.ControlSwitchSprite,this._switchSprite.initWithMaskSprite(a,b,c,d,e,f),this._switchSprite.setPosition(this._switchSprite.getContentSize().width/2,this._switchSprite.getContentSize().height/2),this.addChild(this._switchSprite),this.ignoreAnchorPointForPosition(!1),this.setAnchorPoint(0.5,0.5),this.setContentSize(this._switchSprite.getContentSize()),!0):
!1},setOn:function(a,b){b=b||!1;var c=(this._on=a)?this._switchSprite.getOnPosition():this._switchSprite.getOffPosition();b?this._switchSprite.runAction(new cc.ActionTween(0.2,"sliderXPosition",this._switchSprite.getSliderXPosition(),c)):this._switchSprite.setSliderXPosition(c);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},isOn:function(){return this._on},hasMoved:function(){return this._moved},setEnabled:function(a){this._enabled=a;this._switchSprite.setOpacity(a?255:128)},locationFromTouch:function(a){a=
a.getLocation();return a=this.convertToNodeSpace(a)},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;this._moved=!1;this._initialTouchXPosition=this.locationFromTouch(a).x-this._switchSprite.getSliderXPosition();this._switchSprite.getThumbSprite().setColor(cc.color.GRAY);this._switchSprite.needsLayout();return!0},onTouchMoved:function(a,b){var c=this.locationFromTouch(a),c=cc.p(c.x-this._initialTouchXPosition,0);this._moved=!0;this._switchSprite.setSliderXPosition(c.x)},
onTouchEnded:function(a,b){var c=this.locationFromTouch(a);this._switchSprite.getThumbSprite().setColor(cc.color.WHITE);this.hasMoved()?this.setOn(!(c.x<this._switchSprite.getContentSize().width/2),!0):this.setOn(!this._on,!0)},onTouchCancelled:function(a,b){var c=this.locationFromTouch(a);this._switchSprite.getThumbSprite().setColor(cc.color.WHITE);this.hasMoved()?this.setOn(!(c.x<this._switchSprite.getContentSize().width/2),!0):this.setOn(!this._on,!0)}});
cc.ControlSwitch.create=function(a,b,c,d,e,f){return new cc.ControlSwitch(a,b,c,d,e,f)};
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,
b,c,d,e,f){return cc.Sprite.prototype.init.call(this)?(this.setSpriteFrame(a.displayFrame()),this._onPosition=0,this._offPosition=-b.getContentSize().width+d.getContentSize().width/2,this._sliderXPosition=this._onPosition,this.setOnSprite(b),this.setOffSprite(c),this.setThumbSprite(d),this.setOnLabel(e),this.setOffLabel(f),this._stencil=a,a=this._maskSize=this._stencil.getContentSize(),this._stencil.setPosition(0,0),this._clipper=new cc.ClippingNode,this._clipper.setAnchorPoint(0.5,0.5),this._clipper.setPosition(a.width/
2,a.height/2),this._clipper.setStencil(this._stencil),this.addChild(this._clipper),this._clipper.addChild(b),this._clipper.addChild(c),this._clipper.addChild(e),this._clipper.addChild(f),this.addChild(this._thumbSprite),this.needsLayout(),!0):!1},needsLayout:function(){var a=this._maskSize;this._onSprite.setPosition(this._onSprite.getContentSize().width/2+this._sliderXPosition-a.width/2,this._onSprite.getContentSize().height/2-a.height/2);this._offSprite.setPosition(this._onSprite.getContentSize().width+
this._offSprite.getContentSize().width/2+this._sliderXPosition-a.width/2,this._offSprite.getContentSize().height/2-a.height/2);this._onLabel&&this._onLabel.setPosition(this._onSprite.getPositionX()-this._thumbSprite.getContentSize().width/6,this._onSprite.getContentSize().height/2-a.height/2);this._offLabel&&this._offLabel.setPosition(this._offSprite.getPositionX()+this._thumbSprite.getContentSize().width/6,this._offSprite.getContentSize().height/2-a.height/2);this._thumbSprite.setPosition(this._onSprite.getContentSize().width+
this._sliderXPosition,this._maskSize.height/2)},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},_getOnSideWidth:function(){return this._onSprite.getContentSize().width},_getOffSideWidth:function(){return this._offSprite.getContentSize().height},updateTweenAction:function(a,b){"sliderXPosition"===b&&this.setSliderXPosition(a)},setOnPosition:function(a){this._onPosition=
a},getOnPosition:function(){return this._onPosition},setOffPosition:function(a){this._offPosition=a},getOffPosition:function(){return this._offPosition},setMaskTexture:function(a){this._stencil.setTexture(a)},getMaskTexture:function(){return this._stencil.getTexture()},setTextureLocation:function(a){this._textureLocation=a},getTextureLocation:function(){return this._textureLocation},setMaskLocation:function(a){this._maskLocation=a},getMaskLocation:function(){return this._maskLocation},setOnSprite:function(a){this._onSprite=
a},getOnSprite:function(){return this._onSprite},setOffSprite:function(a){this._offSprite=a},getOffSprite:function(){return this._offSprite},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite},setOnLabel:function(a){this._onLabel=a},getOnLabel:function(){return this._onLabel},setOffLabel:function(a){this._offLabel=a},getOffLabel:function(){return this._offLabel}});_p=cc.ControlSwitchSprite.prototype;
cc.defineGetterSetter(_p,"sliderX",_p.getSliderXPosition,_p.setSliderXPosition);cc.defineGetterSetter(_p,"onPos",_p.getOnPosition,_p.setOnPosition);cc.defineGetterSetter(_p,"offPos",_p.getOffPosition,_p.setOffPosition);cc.defineGetterSetter(_p,"maskTexture",_p.getMaskTexture,_p.setMaskTexture);cc.defineGetterSetter(_p,"maskPos",_p.getMaskLocation,_p.setMaskLocation);cc.defineGetterSetter(_p,"onSprite",_p.getOnSprite,_p.setOnSprite);cc.defineGetterSetter(_p,"offSprite",_p.getOffSprite,_p.setOffSprite);
cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite,_p.setThumbSprite);cc.defineGetterSetter(_p,"onLabel",_p.getOnLabel,_p.setOnLabel);cc.defineGetterSetter(_p,"offLabel",_p.getOffLabel,_p.setOffLabel);cc.defineGetterSetter(_p,"onSideWidth",_p._getOnSideWidth);cc.defineGetterSetter(_p,"offSideWidth",_p._getOffSideWidth);_p=null;cc.CONTROL_STEPPER_PARTMINUS=0;cc.CONTROL_STEPPER_PARTPLUS=1;cc.CONTROL_STEPPER_PARTNONE=2;cc.CONTROL_STEPPER_LABELCOLOR_ENABLED=cc.color(55,55,55);cc.CONTROL_STEPPER_LABELCOLOR_DISABLED=cc.color(147,147,147);cc.CONTROL_STEPPER_LABELFONT="CourierNewPSMT";cc.AUTOREPEAT_DELTATIME=0.15;cc.AUTOREPEAT_INCREASETIME_INCREMENT=12;
cc.ControlStepper=cc.Control.extend({_minusSprite:null,_plusSprite:null,_minusLabel:null,_plusLabel:null,_value:0,_continuous:!1,_autorepeat:!1,_wraps:!1,_minimumValue:0,_maximumValue:0,_stepValue:0,_touchInsideFlag:!1,_touchedPart:cc.CONTROL_STEPPER_PARTNONE,_autorepeatCount:0,_className:"ControlStepper",ctor:function(a,b){cc.Control.prototype.ctor.call(this);this._plusLabel=this._minusLabel=this._plusSprite=this._minusSprite=null;this._value=0;this._wraps=this._autorepeat=this._continuous=!1;this._stepValue=
this._maximumValue=this._minimumValue=0;this._touchInsideFlag=!1;this._touchedPart=cc.CONTROL_STEPPER_PARTNONE;this._autorepeatCount=0;b&&this.initWithMinusSpriteAndPlusSprite(a,b)},initWithMinusSpriteAndPlusSprite:function(a,b){if(!a)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Minus sprite should be non-null.");if(!b)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Plus sprite should be non-null.");if(this.init()){this._continuous=this._autorepeat=!0;this._minimumValue=
0;this._maximumValue=100;this._value=0;this._stepValue=1;this._wraps=!1;this.ignoreAnchorPointForPosition(!1);this.setMinusSprite(a);this._minusSprite.setPosition(a.getContentSize().width/2,a.getContentSize().height/2);this.addChild(this._minusSprite);this.setMinusLabel(new cc.LabelTTF("-",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER));this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_DISABLED);this._minusLabel.setPosition(this._minusSprite.getContentSize().width/
2,this._minusSprite.getContentSize().height/2);this._minusSprite.addChild(this._minusLabel);this.setPlusSprite(b);this._plusSprite.setPosition(a.getContentSize().width+b.getContentSize().width/2,a.getContentSize().height/2);this.addChild(this._plusSprite);this.setPlusLabel(new cc.LabelTTF("+",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER));this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED);this._plusLabel.setPosition(this._plusSprite.getContentSize().width/
2,this._plusSprite.getContentSize().height/2);this._plusSprite.addChild(this._plusLabel);var c=cc.ControlUtils.CCRectUnion(this._minusSprite.getBoundingBox(),this._plusSprite.getBoundingBox());this.setContentSize(this._minusSprite.getContentSize().width+this._plusSprite.getContentSize().height,c.height);return!0}return!1},setWraps:function(a){if(this._wraps=a)this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED);this.setValue(this._value)},
getWraps:function(){return this._wraps},setMinimumValue:function(a){if(a>=this._maximumValue)throw Error("cc.ControlStepper.setMinimumValue(): minimumValue should be numerically less than maximumValue.");this._minimumValue=a;this.setValue(this._value)},getMinimumValue:function(){return this._minimumValue},setMaximumValue:function(a){if(a<=this._minimumValue)throw Error("cc.ControlStepper.setMaximumValue(): maximumValue should be numerically less than maximumValue.");this._maximumValue=a;this.setValue(this._value)},
getMaximumValue:function(){return this._maximumValue},setValue:function(a){this.setValueWithSendingEvent(a,!0)},getValue:function(){return this._value},setStepValue:function(a){if(0>=a)throw Error("cc.ControlStepper.setMaximumValue(): stepValue should be numerically greater than 0.");this._stepValue=a},getStepValue:function(){return this._stepValue},isContinuous:function(){return this._continuous},setValueWithSendingEvent:function(a,b){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));b&&this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},startAutorepeat:function(){this._autorepeatCount=-1;this.schedule(this.update,
cc.AUTOREPEAT_DELTATIME,cc.REPEAT_FOREVER,3*cc.AUTOREPEAT_DELTATIME)},stopAutorepeat:function(){this.unschedule(this.update)},update:function(a){this._autorepeatCount++;this._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.color.GRAY),this._plusSprite.setColor(cc.color.WHITE)):a.x>=this._minusSprite.getContentSize().width&&this._value<this._maximumValue?(this._touchedPart=cc.CONTROL_STEPPER_PARTPLUS,this._minusSprite.setColor(cc.color.WHITE),this._plusSprite.setColor(cc.color.GRAY)):(this._touchedPart=cc.CONTROL_STEPPER_PARTNONE,
this._minusSprite.setColor(cc.color.WHITE),this._plusSprite.setColor(cc.color.WHITE))},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;var c=this.getTouchLocation(a);this.updateLayoutUsingTouchLocation(c);this._touchInsideFlag=!0;this._autorepeat&&this.startAutorepeat();return!0},onTouchMoved:function(a,b){if(this.isTouchInside(a)){var c=this.getTouchLocation(a);this.updateLayoutUsingTouchLocation(c);this._touchInsideFlag||(this._touchInsideFlag=
!0,this._autorepeat&&this.startAutorepeat())}else this._touchInsideFlag=!1,this._touchedPart=cc.CONTROL_STEPPER_PARTNONE,this._minusSprite.setColor(cc.color.WHITE),this._plusSprite.setColor(cc.color.WHITE),this._autorepeat&&this.stopAutorepeat()},onTouchEnded:function(a,b){this._minusSprite.setColor(cc.color.WHITE);this._plusSprite.setColor(cc.color.WHITE);this._autorepeat&&this.stopAutorepeat();if(this.isTouchInside(a)){var c=this.getTouchLocation(a);this.setValue(this._value+(c.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}});_p=cc.ControlStepper.prototype;cc.defineGetterSetter(_p,"wraps",_p.getWraps,_p.setWraps);
cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue);cc.defineGetterSetter(_p,"stepValue",_p.getStepValue,_p.setStepValue);cc.defineGetterSetter(_p,"continuous",_p.isContinuous);cc.defineGetterSetter(_p,"minusSprite",_p.getMinusSprite,_p.setMinusSprite);cc.defineGetterSetter(_p,"plusSprite",_p.getPlusSprite,_p.setPlusSprite);
cc.defineGetterSetter(_p,"minusLabel",_p.getMinusLabel,_p.setMinusLabel);cc.defineGetterSetter(_p,"plusLabel",_p.getPlusLabel,_p.setPlusLabel);_p=null;cc.ControlStepper.create=function(a,b){return new cc.ControlStepper(a,b)};cc.ControlPotentiometer=cc.Control.extend({_thumbSprite:null,_progressTimer:null,_previousLocation:null,_value:0,_minimumValue:0,_maximumValue:1,_className:"ControlPotentiometer",ctor:function(a,b,c){cc.Control.prototype.ctor.call(this);void 0!=c&&(a=new cc.Sprite(a),c=new cc.Sprite(c),b=new cc.ProgressTimer(new cc.Sprite(b)),this.initWithTrackSprite_ProgressTimer_ThumbSprite(a,b,c))},initWithTrackSprite_ProgressTimer_ThumbSprite:function(a,b,c){return this.init()?(this.setProgressTimer(b),this.setThumbSprite(c),
this._thumbSprite.setPosition(b.getPosition()),this.addChild(c,2),this.addChild(b,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);null!==this._thumbSprite&&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,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;this._previousLocation=this.getTouchLocation(a);this.potentiometerBegan(this._previousLocation);
return!0},onTouchMoved:function(a,b){var c=this.getTouchLocation(a);this.potentiometerMoved(c)},onTouchEnded:function(a,b){this.potentiometerEnded(cc.p(0,0))},distanceBetweenPointAndPoint:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)},angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint:function(a,b,c,d){var e=d.x-c.x;c=d.y-c.y;a=Math.atan2(b.x-a.x,b.y-a.y);e=Math.atan2(e,c);return 180*(a-e)/Math.PI},potentiometerBegan:function(a){this.setSelected(!0);this.getThumbSprite().setColor(cc.color.GRAY)},
potentiometerMoved:function(a){var b=this.angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint(this._progressTimer.getPosition(),a,this._progressTimer.getPosition(),this._previousLocation);180<b?b-=360:-180>b&&(b+=360);this.setValue(this._value+b/360*(this._maximumValue-this._minimumValue));this._previousLocation=a},potentiometerEnded:function(a){this.getThumbSprite().setColor(cc.color.WHITE);this.setSelected(!1)},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite},
setProgressTimer:function(a){this._progressTimer=a},getProgressTimer:function(){return this._progressTimer},setPreviousLocation:function(a){this._previousLocation=a},getPreviousLocation:function(){return this._previousLocation}});_p=cc.ControlPotentiometer.prototype;cc.defineGetterSetter(_p,"value",_p.getValue,_p.setValue);cc.defineGetterSetter(_p,"minValue",_p.getMinimumValue,_p.setMinimumValue);cc.defineGetterSetter(_p,"maxValue",_p.getMaximumValue,_p.setMaximumValue);
cc.defineGetterSetter(_p,"progressTimer",_p.getProgressTimer,_p.setProgressTimer);cc.defineGetterSetter(_p,"thumbSprite",_p.getThumbSprite,_p.setThumbSprite);cc.defineGetterSetter(_p,"prevLocation",_p.getPreviousLocation,_p.setPreviousLocation);_p=null;cc.ControlPotentiometer.create=function(a,b,c){return new cc.ControlPotentiometer(a,b,c)};cc.SCROLLVIEW_DIRECTION_NONE=-1;cc.SCROLLVIEW_DIRECTION_HORIZONTAL=0;cc.SCROLLVIEW_DIRECTION_VERTICAL=1;cc.SCROLLVIEW_DIRECTION_BOTH=2;var SCROLL_DEACCEL_RATE=0.95,SCROLL_DEACCEL_DIST=1,BOUNCE_DURATION=0.15,INSET_RATIO=0.2,MOVE_INCH=0.04375,BOUNCE_BACK_FACTOR=0.35;cc.convertDistanceFromPointToInch=function(a){var b=cc.view,b=(b.getScaleX()+b.getScaleY())/2;return a*b/160};cc.ScrollViewDelegate=cc.Class.extend({scrollViewDidScroll:function(a){},scrollViewDidZoom:function(a){}});
cc.ScrollView=cc.Layer.extend({_zoomScale:0,_minZoomScale:0,_maxZoomScale:0,_delegate:null,_direction:cc.SCROLLVIEW_DIRECTION_BOTH,_dragging:!1,_contentOffset:null,_container:null,_touchMoved:!1,_maxInset:null,_minInset:null,_bounceable:!1,_clippingToBounds:!1,_scrollDistance:null,_touchPoint:null,_touchLength:0,_touches:null,_viewSize:null,_minScale:0,_maxScale:0,_parentScissorRect:null,_scissorRestored:!1,_tmpViewRect:null,_touchListener:null,_className:"ScrollView",ctor:function(a,b){cc.Layer.prototype.ctor.call(this);
this._contentOffset=cc.p(0,0);this._maxInset=cc.p(0,0);this._minInset=cc.p(0,0);this._scrollDistance=cc.p(0,0);this._touchPoint=cc.p(0,0);this._touches=[];this._viewSize=cc.size(0,0);this._parentScissorRect=new cc.Rect(0,0,0,0);this._tmpViewRect=new cc.Rect(0,0,0,0);void 0!=b?this.initWithViewSize(a,b):this.initWithViewSize(cc.size(200,200),null)},init:function(){return this.initWithViewSize(cc.size(200,200),null)},initWithViewSize:function(a,b){var c=cc.p(0,0);return cc.Layer.prototype.init.call(this)?
(b||this._container||(b=new cc.Layer),b&&this.setContainer(b),this.setViewSize(a),this.setTouchEnabled(!0),this._touches.length=0,this._delegate=null,this._clippingToBounds=this._bounceable=!0,this._direction=cc.SCROLLVIEW_DIRECTION_BOTH,this._container.setPosition(c),this._touchLength=0,this._minScale=this._maxScale=1,!0):!1},visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){a=cc.renderer;b.visit(c);this._clippingToBounds&&a.pushRenderCommand(b.startCmd);var d=this._children,
e=d.length;if(0<e)for(this._reorderChildDirty&&this.sortAllChildren(),c=0;c<e;c++)d[c].visit(this);this._clippingToBounds&&a.pushRenderCommand(b.endCmd);b._dirtyFlag=0}else b._propagateFlagsDown(c)},setContentOffset:function(a,b){if(b)this.setContentOffsetInDuration(a,BOUNCE_DURATION);else{if(!this._bounceable){var c=this.minContainerOffset(),d=this.maxContainerOffset();a.x=Math.max(c.x,Math.min(d.x,a.x));a.y=Math.max(c.y,Math.min(d.y,a.y))}this._container.setPosition(a);c=this._delegate;null!=c&&
c.scrollViewDidScroll&&c.scrollViewDidScroll(this)}},getContentOffset:function(){var a=this._container.getPosition();return cc.p(a.x,a.y)},setContentOffsetInDuration:function(a,b){var c=cc.moveTo(b,a),d=cc.callFunc(this._stoppedAnimatedScroll,this);this._container.runAction(cc.sequence(c,d));this.schedule(this._performedAnimatedScroll)},setZoomScale:function(a,b){if(b)this.setZoomScaleInDuration(a,BOUNCE_DURATION);else{var c=this._container;if(c.getScale()!==a){var d,e;0===this._touchLength?(e=this._viewSize,
e=cc.p(0.5*e.width,0.5*e.height),e=this.convertToWorldSpace(e)):e=this._touchPoint;d=c.convertToNodeSpace(e);c.setScale(Math.max(this._minScale,Math.min(this._maxScale,a)));d=c.convertToWorldSpace(d);e=cc.pSub(e,d);this._delegate&&this._delegate.scrollViewDidZoom&&this._delegate.scrollViewDidZoom(this);this.setContentOffset(cc.pAdd(c.getPosition(),e))}}},getZoomScale:function(){return this._container.getScale()},setZoomScaleInDuration:function(a,b){if(0<b){var c=this._container.getScale();c!==a&&
(c=cc.actionTween(b,"zoomScale",c,a),this.runAction(c))}else this.setZoomScale(a)},minContainerOffset:function(){var a=this._container,b=a.getContentSize(),c=this._viewSize;return cc.p(c.width-b.width*a.getScaleX(),c.height-b.height*a.getScaleY())},maxContainerOffset:function(){return cc.p(0,0)},isNodeVisible:function(a){var b=this.getContentOffset(),c=this.getViewSize(),d=this.getZoomScale(),b=cc.rect(-b.x/d,-b.y/d,c.width/d,c.height/d);return cc.rectIntersectsRect(b,a.getBoundingBox())},pause:function(a){this._container.pause();
a=this._container.getChildren();for(var b=0;b<a.length;b++)a[b].pause();this._super()},resume:function(a){a=this._container.getChildren();for(var b=0,c=a.length;b<c;b++)a[b].resume();this._container.resume();this._super()},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,b){for(var c=this;null!=c;c=c.parent)if(!c.isVisible())return!1;
var c=this._getViewRect(),d=this._container,e=d.convertToWorldSpace(d.convertTouchToNodeSpace(a)),f=this._touches;if(2<f.length||this._touchMoved||!cc.rectContainsPoint(c,e))return!1;f.push(a);1===f.length?(this._touchPoint=this.convertTouchToNodeSpace(a),this._touchMoved=!1,this._dragging=!0,this._scrollDistance.x=0,this._touchLength=this._scrollDistance.y=0):2===f.length&&(this._touchPoint=cc.pMidpoint(this.convertTouchToNodeSpace(f[0]),this.convertTouchToNodeSpace(f[1])),this._touchLength=cc.pDistance(d.convertTouchToNodeSpace(f[0]),
d.convertTouchToNodeSpace(f[1])),this._dragging=!1);return!0},onTouchMoved:function(a,b){if(this.isVisible())if(this.setNodeDirty(),1===this._touches.length&&this._dragging){this._touchMoved=!0;this._getViewRect();var c=this.convertTouchToNodeSpace(a),d=cc.pSub(c,this._touchPoint),e=0,f=this._direction,h;if(f===cc.SCROLLVIEW_DIRECTION_VERTICAL)e=d.y,h=this._container.getPositionY(),this.minContainerOffset().y<=h&&h<=this.maxContainerOffset().y||(d.y*=BOUNCE_BACK_FACTOR);else if(f===cc.SCROLLVIEW_DIRECTION_HORIZONTAL)e=
d.x,h=this._container.getPositionX(),this.minContainerOffset().x<=h&&h<=this.maxContainerOffset().x||(d.x*=BOUNCE_BACK_FACTOR);else{e=Math.sqrt(d.x*d.x+d.y*d.y);h=this._container.getPositionY();var k=this.minContainerOffset(),m=this.maxContainerOffset();k.y<=h&&h<=m.y||(d.y*=BOUNCE_BACK_FACTOR);h=this._container.getPositionX();k.x<=h&&h<=m.x||(d.x*=BOUNCE_BACK_FACTOR)}if(this._touchMoved||!(Math.abs(cc.convertDistanceFromPointToInch(e))<MOVE_INCH))if(this._touchMoved||(d.x=0,d.y=0),this._touchPoint=
c,this._touchMoved=!0,this._dragging){switch(f){case cc.SCROLLVIEW_DIRECTION_VERTICAL:d.x=0;break;case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:d.y=0}e=this._container.getPosition();c=e.x+d.x;e=e.y+d.y;this._scrollDistance=d;this.setContentOffset(cc.p(c,e))}}else 2!==this._touches.length||this._dragging||(d=cc.pDistance(this._container.convertTouchToNodeSpace(this._touches[0]),this._container.convertTouchToNodeSpace(this._touches[1])),this.setZoomScale(this.getZoomScale()*d/this._touchLength))},onTouchEnded:function(a,
b){this.isVisible()&&(1===this._touches.length&&this._touchMoved&&this.schedule(this._deaccelerateScrolling),this._touches.length=0,this._touchMoved=this._dragging=!1)},onTouchCancelled:function(a,b){this.isVisible()&&(this._touches.length=0,this._touchMoved=this._dragging=!1)},setContentSize:function(a,b){null!==this.getContainer()&&(void 0===b?this.getContainer().setContentSize(a):this.getContainer().setContentSize(a,b),this.updateInset())},_setWidth:function(a){var b=this.getContainer();null!==
b&&(b._setWidth(a),this.updateInset())},_setHeight:function(a){var b=this.getContainer();null!==b&&(b._setHeight(a),this.updateInset())},getContentSize:function(){return this._container.getContentSize()},updateInset:function(){if(null!==this.getContainer()){var a=this._viewSize,b=this.maxContainerOffset();this._maxInset.x=b.x+a.width*INSET_RATIO;this._maxInset.y=b.y+a.height*INSET_RATIO;b=this.minContainerOffset();this._minInset.x=b.x-a.width*INSET_RATIO;this._minInset.y=b.y-a.height*INSET_RATIO}},
isClippingToBounds:function(){return this._clippingToBounds},setClippingToBounds:function(a){this._clippingToBounds=a},addChild:function(a,b,c){if(!a)throw Error("child must not nil!");b=b||a.getLocalZOrder();c=c||a.getTag();this._container!==a?this._container.addChild(a,b,c):cc.Layer.prototype.addChild.call(this,a,b,c)},isTouchEnabled:function(){return null!==this._touchListener},setTouchEnabled:function(a){this._touchListener&&cc.eventManager.removeListener(this._touchListener);this._touchListener=
null;a?(a=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE}),this.onTouchBegan&&(a.onTouchBegan=this.onTouchBegan.bind(this)),this.onTouchMoved&&(a.onTouchMoved=this.onTouchMoved.bind(this)),this.onTouchEnded&&(a.onTouchEnded=this.onTouchEnded.bind(this)),this.onTouchCancelled&&(a.onTouchCancelled=this.onTouchCancelled.bind(this)),this._touchListener=a,cc.eventManager.addListener(a,this)):(this._touchMoved=this._dragging=!1,this._touches.length=0)},_initWithViewSize:function(a){return null},
_relocateContainer:function(a){var b=this.minContainerOffset(),c=this.maxContainerOffset(),d=this._direction,e=this._container.getPosition(),f=e.x,h=e.y;if(d===cc.SCROLLVIEW_DIRECTION_BOTH||d===cc.SCROLLVIEW_DIRECTION_HORIZONTAL)f=Math.max(f,b.x),f=Math.min(f,c.x);if(d===cc.SCROLLVIEW_DIRECTION_BOTH||d===cc.SCROLLVIEW_DIRECTION_VERTICAL)h=Math.min(h,c.y),h=Math.max(h,b.y);h===e.y&&f===e.x||this.setContentOffset(cc.p(f,h),a)},_deaccelerateScrolling:function(a){if(this._dragging)this.unschedule(this._deaccelerateScrolling);
else{var b,c;b=this._container.getPosition();a=this._scrollDistance;this._container.setPosition(b.x+a.x,b.y+a.y);this._bounceable?(b=this._maxInset,c=this._minInset):(b=this.maxContainerOffset(),c=this.minContainerOffset());var d=this._container.getPositionX(),e=this._container.getPositionY();a.x*=SCROLL_DEACCEL_RATE;a.y*=SCROLL_DEACCEL_RATE;this.setContentOffset(cc.p(d,e));if(Math.abs(a.x)<=SCROLL_DEACCEL_DIST&&Math.abs(a.y)<=SCROLL_DEACCEL_DIST||e>b.y||e<c.y||d>b.x||d<c.x||d===b.x||d===c.x||e===
b.y||e===c.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)},_handleZoom:function(){},_getViewRect:function(){for(var a=
this.convertToWorldSpace(cc.p(0,0)),b=this._viewSize,c=this.getScaleX(),d=this.getScaleY(),e=this._parent;null!=e;e=e.getParent())c*=e.getScaleX(),d*=e.getScaleY();0>c&&(a.x+=b.width*c,c=-c);0>d&&(a.y+=b.height*d,d=-d);e=this._tmpViewRect;e.x=a.x;e.y=a.y;e.width=b.width*c;e.height=b.height*d;return e},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ScrollView.CanvasRenderCmd(this):new cc.ScrollView.WebGLRenderCmd(this)}});_p=cc.ScrollView.prototype;
cc.defineGetterSetter(_p,"minOffset",_p.minContainerOffset);cc.defineGetterSetter(_p,"maxOffset",_p.maxContainerOffset);cc.defineGetterSetter(_p,"bounceable",_p.isBounceable,_p.setBounceable);cc.defineGetterSetter(_p,"viewSize",_p.getViewSize,_p.setViewSize);cc.defineGetterSetter(_p,"container",_p.getContainer,_p.setContainer);cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"delegate",_p.getDelegate,_p.setDelegate);
cc.defineGetterSetter(_p,"clippingToBounds",_p.isClippingToBounds,_p.setClippingToBounds);_p=null;cc.ScrollView.create=function(a,b){return new cc.ScrollView(a,b)};(function(){cc.ScrollView.CanvasRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.startCmd._canUseDirtyRegion=!0;this.endCmd=new cc.CustomRenderCmd(this,this._endCmd);this.endCmd._canUseDirtyRegion=!0};var a=cc.ScrollView.CanvasRenderCmd.prototype=Object.create(cc.Layer.CanvasRenderCmd.prototype);a.constructor=cc.ScrollView.CanvasRenderCmd;a._startCmd=function(a,c,d){var e=this._node,f=a||cc._renderContext;a=f.getContext();
f.save();e._clippingToBounds&&(this._scissorRestored=!1,f.setTransform(this._worldTransform,c,d),d=e.getScaleX(),c=e.getScaleY(),d*=e._viewSize.width,e=e._viewSize.height*c,a.beginPath(),a.rect(0,0,d,-e),a.closePath(),a.clip())};a._endCmd=function(a){a=a||cc._renderContext;a.restore()}})();(function(){cc.ScrollView.WebGLRenderCmd=function(a){this._layerCmdCtor(a);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.endCmd=new cc.CustomRenderCmd(this,this._endCmd)};var a=cc.ScrollView.WebGLRenderCmd.prototype=Object.create(cc.Layer.WebGLRenderCmd.prototype);a.constructor=cc.ScrollView.WebGLRenderCmd;a._startCmd=function(){var a=this._node,c=cc.view,d=a._getViewRect();if(c.isScissorEnabled()){if(a._scissorRestored=!0,a._parentScissorRect=c.getScissorRect(),
cc.rectIntersection(d,a._parentScissorRect)){var e=a._parentScissorRect,a=Math.max(d.x,e.x),f=Math.max(d.y,e.y),h=Math.min(d.x+d.width,e.x+e.width),d=Math.min(d.y+d.height,e.y+e.height);c.setScissorInPoints(a,f,h-a,d-f)}}else a=cc._renderContext,a.enable(a.SCISSOR_TEST),c.setScissorInPoints(d.x,d.y,d.width,d.height)};a._endCmd=function(){var a=this._node;a._scissorRestored?(a=a._parentScissorRect,cc.view.setScissorInPoints(a.x,a.y,a.width,a.height)):(a=cc._renderContext,a.disable(a.SCISSOR_TEST))}})();cc.SortableObject=cc.Class.extend({setObjectID:function(a){},getObjectID:function(){return 0}});cc.SortedObject=cc.SortableObject.extend({_objectID:0,ctor:function(){this._objectID=0},setObjectID:function(a){this._objectID=a},getObjectID:function(){return this._objectID}});var _compareObject=function(a,b){return a.getObjectID()-b.getObjectID()};
cc.ArrayForObjectSorting=cc.Class.extend({_saveObjectArr:null,ctor:function(){this._saveObjectArr=[]},insertSortedObject:function(a){if(!a)throw Error("cc.ArrayForObjectSorting.insertSortedObject(): addObject should be non-null.");var b=this.indexOfSortedObject(a);this.insertObject(a,b)},removeSortedObject:function(a){if(0!==this.count()){var b=this.indexOfSortedObject(a);b<this.count()&&b!==cc.INVALID_INDEX&&this.objectAtIndex(b).getObjectID()===a.getObjectID()&&this.removeObjectAtIndex(b)}},setObjectID_ofSortedObject:function(a,
b){var c=this.indexOfSortedObject(b);if(c<this.count()&&c!==cc.INVALID_INDEX){var d=this.objectAtIndex(c);d.getObjectID()===b.getObjectID()&&(this.removeObjectAtIndex(c),d.setObjectID(a),this.insertSortedObject(d))}},objectWithObjectID:function(a){if(0===this.count())return null;var b=new cc.SortedObject;b.setObjectID(a);var c=this.indexOfSortedObject(b);c<this.count()&&c!==cc.INVALID_INDEX&&(b=this.objectAtIndex(c),b.getObjectID()!==a&&(b=null));return b},getObjectWithObjectID:function(a){return null},
indexOfSortedObject:function(a){var b=0;if(a){var c=0;a=a.getObjectID();for(var d=this._saveObjectArr,e=0;e<d.length;e++){var f=d[e].getObjectID();if(a===f||a>=c&&a<f)break;c=f;b++}}else b=cc.INVALID_INDEX;return b},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){this._saveObjectArr.splice(a,1);this._saveObjectArr.sort(_compareObject)},insertObject:function(a,b){this._saveObjectArr.splice(b,0,a);this._saveObjectArr.sort(_compareObject)}});cc.TABLEVIEW_FILL_TOPDOWN=0;cc.TABLEVIEW_FILL_BOTTOMUP=1;cc.TableViewCell=cc.Node.extend({_idx:0,_className:"TableViewCell",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}});_p=cc.TableViewCell.prototype;cc.defineGetterSetter(_p,"objectId",_p.getObjectID,_p.setObjectID);_p=null;
cc.TableViewDelegate=cc.ScrollViewDelegate.extend({tableCellTouched:function(a,b){},tableCellHighlight:function(a,b){},tableCellUnhighlight:function(a,b){},tableCellWillRecycle:function(a,b){}});cc.TableViewDataSource=cc.Class.extend({tableCellSizeForIndex:function(a,b){return this.cellSizeForTable(a)},cellSizeForTable:function(a){return cc.size(0,0)},tableCellAtIndex:function(a,b){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(a,b,c){cc.ScrollView.prototype.ctor.call(this);this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;this._cellsPositions=[];this.initWithViewSize(b,c);this.setDataSource(a);this._updateCellPositions();this._updateContentSize()},__indexFromOffset:function(a){var b=0,c=this._dataSource.numberOfCellsInTableView(this)-
1;switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=a.x;break;default:a=a.y}for(var d=this._cellsPositions;c>=b;){var e=0|b+(c-b)/2,f=d[e],h=d[e+1];if(a>=f&&a<=h)return e;a<f?c=e-1:b=e+1}return 0>=b?0:-1},_indexFromOffset:function(a){var b={x:a.x,y:a.y};a=this._dataSource.numberOfCellsInTableView(this)-1;this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y);b=this.__indexFromOffset(b);-1!==b&&(b=Math.max(0,b),b>a&&(b=cc.INVALID_INDEX));
return b},__offsetFromIndex:function(a){switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=cc.p(this._cellsPositions[a],0);break;default:a=cc.p(0,this._cellsPositions[a])}return a},_offsetFromIndex:function(a){var b=this.__offsetFromIndex(a);a=this._dataSource.tableCellSizeForIndex(this,a);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y-a.height);return b},_updateCellPositions:function(){var a=this._dataSource.numberOfCellsInTableView(this),
b=this._cellsPositions;if(0<a){for(var c=0,d,e=this._dataSource,f=0;f<a;f++)switch(b[f]=c,d=e.tableCellSizeForIndex(this,f),this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:c+=d.width;break;default:c+=d.height}this._cellsPositions[a]=c}},_updateContentSize:function(){var a=cc.size(0,0),b=this._dataSource.numberOfCellsInTableView(this);if(0<b)switch(a=this._cellsPositions[b],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,b){b.setAnchorPoint(0,0);b.setPosition(this._offsetFromIndex(a));b.setIdx(a)},_addCellIfNecessary:function(a){a.getParent()!==this.getContainer()&&this.getContainer().addChild(a);this._cellsUsed.insertSortedObject(a);var b=this._indices;a=a.getIdx();-1===b.indexOf(a)&&(b.push(a),b.sort(function(a,b){return a-b}))},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,b){return cc.ScrollView.prototype.initWithViewSize.call(this,a,b)?(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 b=this.cellAtIndex(a);b&&this._moveCellOutOfSight(b);b=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,b);this._addCellIfNecessary(b)}},insertCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-
1)){var b,c=this._cellsUsed;if(b=c.objectWithObjectID(a))for(var d=b=c.indexOfSortedObject(b);d<c.count();d++)b=c.objectAtIndex(d),this._setIndexForCell(b.getIdx()+1,b);b=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,b);this._addCellIfNecessary(b);this._updateCellPositions();this._updateContentSize()}},removeCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)-1)){var b=this.cellAtIndex(a);if(b){var c=this._cellsUsed,d=c.indexOfSortedObject(b);
this._moveCellOutOfSight(b);cc.arrayRemoveObject(this._indices,a);this._updateCellPositions();for(a=c.count()-1;a>d;a--)b=c.objectAtIndex(a),this._setIndexForCell(b.getIdx()-1,b)}}},reloadData:function(){this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;for(var a=this._cellsUsed,b=this._cellsFreed,c=this.getContainer(),d=0,e=a.count();d<e;d++){var f=a.objectAtIndex(d);this._tableViewDelegate&&this._tableViewDelegate.tableCellWillRecycle&&this._tableViewDelegate.tableCellWillRecycle(this,f);b.addObject(f);
f.reset();f.getParent()===c&&c.removeChild(f,!0)}this._indices=[];this._cellsUsed=new cc.ArrayForObjectSorting;this._updateCellPositions();this._updateContentSize();0<this._dataSource.numberOfCellsInTableView(this)&&this.scrollViewDidScroll(this);this.setNodeDirty()},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 b=this._dataSource.numberOfCellsInTableView(this);if(0!==b){null!==this._tableViewDelegate&&this._tableViewDelegate.scrollViewDidScroll&&this._tableViewDelegate.scrollViewDidScroll(this);var c=0,d=this._viewSize,c=this.getContainer(),e=this.getContentOffset();e.x*=-1;e.y*=-1;var f=Math.max(b-1,0);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(e.y+=d.height/c.getScaleY());a=this._indexFromOffset(e);a===cc.INVALID_INDEX&&(a=b-1);e.y=this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN?
e.y-d.height/c.getScaleY():e.y+d.height/c.getScaleY();e.x+=d.width/c.getScaleX();d=this._indexFromOffset(e);d===cc.INVALID_INDEX&&(d=b-1);e=this._cellsUsed;if(0<e.count())for(b=e.objectAtIndex(0),c=b.getIdx();c<a;)if(this._moveCellOutOfSight(b),0<e.count())b=e.objectAtIndex(0),c=b.getIdx();else break;if(0<e.count())for(b=e.lastObject(),c=b.getIdx();c<=f&&c>d;)if(this._moveCellOutOfSight(b),0<e.count())b=e.lastObject(),c=b.getIdx();else break;for(f=this._indices;a<=d;a++)-1===f.indexOf(a)&&this.updateCellAtIndex(a)}},
scrollViewDidZoom:function(a){},onTouchEnded:function(a,b){if(this.isVisible()){if(this._touchedCell){var c=this.getBoundingBox(),d=cc.p(c.x,c.y),d=this._parent.convertToWorldSpace(d);c.x=d.x;c.y=d.y;d=this._tableViewDelegate;cc.rectContainsPoint(c,a.getLocation())&&null!==d&&(d.tableCellUnhighlight&&d.tableCellUnhighlight(this,this._touchedCell),d.tableCellTouched&&d.tableCellTouched(this,this._touchedCell));this._touchedCell=null}cc.ScrollView.prototype.onTouchEnded.call(this,a,b)}},onTouchBegan:function(a,
b){for(var c=this;null!=c;c=c.parent)if(!c.isVisible())return!1;c=cc.ScrollView.prototype.onTouchBegan.call(this,a,b);if(1===this._touches.length){var d;d=this.getContainer().convertTouchToNodeSpace(a);d=this._indexFromOffset(d);(this._touchedCell=d===cc.INVALID_INDEX?null:this.cellAtIndex(d))&&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 c},onTouchMoved:function(a,b){cc.ScrollView.prototype.onTouchMoved.call(this,a,b);this._touchedCell&&this.isTouchMoved()&&(null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null)},onTouchCancelled:function(a,b){cc.ScrollView.prototype.onTouchCancelled.call(this,a,b);this._touchedCell&&
(null!==this._tableViewDelegate&&this._tableViewDelegate.tableCellUnhighlight&&this._tableViewDelegate.tableCellUnhighlight(this,this._touchedCell),this._touchedCell=null)}});_p=cc.TableView.prototype;cc.defineGetterSetter(_p,"dataSource",_p.getDataSource,_p.setDataSource);cc.defineGetterSetter(_p,"delegate",_p.getDelegate,_p.setDelegate);cc.defineGetterSetter(_p,"verticalFillOrder",_p.getVerticalFillOrder,_p.setVerticalFillOrder);_p=null;
cc.TableView.create=function(a,b,c){return new cc.TableView(a,b,c)};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,b){this.selMenuHander=a;this.target=b}function BlockCCControlData(a,b,c){this.selCCControlHandler=a;this.target=b;this.controlEvents=c}
cc.NodeLoader=cc.Class.extend({_customProperties:null,_pt:null,_size:null,_arr2:null,ctor:function(){this._customProperties=new cc._Dictionary;this._pt=cc.p();this._size=cc.size();this._arr2=Array(2);this._blockControlData={selCCControlHandler:null,target:null,controlEvents:null}},loadCCNode:function(a,b){return this._createCCNode(a,b)},parseProperties:function(a,b,c){for(var d=c.readInt(!1),e=c.readInt(!1),e=d+e,f=0;f<e;f++){var h=f>=d,k=c.readInt(!1),m=c.readCachedString(),n=!1,p=c._data[c._currentByte++];
if(p===CCB_PLATFORM_ALL||p===CCB_PLATFORM_IOS||p===CCB_PLATFORM_MAC)n=!0;h&&(a.ccbFileNode?(a=a.ccbFileNode,n=-1!==a.userObject.indexOf(m)):a===c._animationManager.getRootNode()&&(h=a.userObject,h||(h=[],a.userObject=h),h.push(m)));switch(k){case CCB_PROPTYPE_POSITION:k=this.parsePropTypePosition(a,b,c,m);if(n)this.onHandlePropTypePosition(a,b,m,k,c);break;case CCB_PROPTYPE_POINT:k=this.parsePropTypePoint(a,b,c);if(n)this.onHandlePropTypePoint(a,b,m,k,c);break;case CCB_PROPTYPE_POINTLOCK:k=this.parsePropTypePointLock(a,
b,c);if(n)this.onHandlePropTypePointLock(a,b,m,k,c);break;case CCB_PROPTYPE_SIZE:k=this.parsePropTypeSize(a,b,c);if(n)this.onHandlePropTypeSize(a,b,m,k,c);break;case CCB_PROPTYPE_SCALELOCK:k=this.parsePropTypeScaleLock(a,b,c,m);if(n)this.onHandlePropTypeScaleLock(a,b,m,k,c);break;case CCB_PROPTYPE_FLOATXY:k=this.parsePropTypeFloatXY(a,b,c);if(n)this.onHandlePropTypeFloatXY(a,b,m,k,c);break;case CCB_PROPTYPE_FLOAT:k=this.parsePropTypeFloat(a,b,c);if(n)this.onHandlePropTypeFloat(a,b,m,k,c);break;case CCB_PROPTYPE_DEGREES:k=
this.parsePropTypeDegrees(a,b,c,m);if(n)this.onHandlePropTypeDegrees(a,b,m,k,c);break;case CCB_PROPTYPE_FLOATSCALE:k=this.parsePropTypeFloatScale(a,b,c);if(n)this.onHandlePropTypeFloatScale(a,b,m,k,c);break;case CCB_PROPTYPE_INTEGER:k=this.parsePropTypeInteger(a,b,c);if(n)this.onHandlePropTypeInteger(a,b,m,k,c);break;case CCB_PROPTYPE_INTEGERLABELED:k=this.parsePropTypeIntegerLabeled(a,b,c);if(n)this.onHandlePropTypeIntegerLabeled(a,b,m,k,c);break;case CCB_PROPTYPE_FLOATVAR:k=this.parsePropTypeFloatVar(a,
b,c);if(n)this.onHandlePropTypeFloatVar(a,b,m,k,c);break;case CCB_PROPTYPE_CHECK:k=this.parsePropTypeCheck(a,b,c,m);if(n)this.onHandlePropTypeCheck(a,b,m,k,c);break;case CCB_PROPTYPE_SPRITEFRAME:k=this.parsePropTypeSpriteFrame(a,b,c,m);if(n)this.onHandlePropTypeSpriteFrame(a,b,m,k,c);break;case CCB_PROPTYPE_ANIMATION:k=this.parsePropTypeAnimation(a,b,c);if(n)this.onHandlePropTypeAnimation(a,b,m,k,c);break;case CCB_PROPTYPE_TEXTURE:k=this.parsePropTypeTexture(a,b,c);if(n)this.onHandlePropTypeTexture(a,
b,m,k,c);break;case CCB_PROPTYPE_BYTE:k=this.parsePropTypeByte(a,b,c,m);if(n)this.onHandlePropTypeByte(a,b,m,k,c);break;case CCB_PROPTYPE_COLOR3:k=this.parsePropTypeColor3(a,b,c,m);if(n)this.onHandlePropTypeColor3(a,b,m,k,c);break;case CCB_PROPTYPE_COLOR4VAR:k=this.parsePropTypeColor4FVar(a,b,c);if(n)this.onHandlePropTypeColor4FVar(a,b,m,k,c);break;case CCB_PROPTYPE_FLIP:k=this.parsePropTypeFlip(a,b,c);if(n)this.onHandlePropTypeFlip(a,b,m,k,c);break;case CCB_PROPTYPE_BLENDMODE:k=this.parsePropTypeBlendFunc(a,
b,c);if(n)this.onHandlePropTypeBlendFunc(a,b,m,k,c);break;case CCB_PROPTYPE_FNTFILE:k=c.getCCBRootPath()+this.parsePropTypeFntFile(a,b,c);if(n)this.onHandlePropTypeFntFile(a,b,m,k,c);break;case CCB_PROPTYPE_FONTTTF:k=this.parsePropTypeFontTTF(a,b,c);if(n)this.onHandlePropTypeFontTTF(a,b,m,k,c);break;case CCB_PROPTYPE_STRING:k=this.parsePropTypeString(a,b,c);if(n)this.onHandlePropTypeString(a,b,m,k,c);break;case CCB_PROPTYPE_TEXT:k=this.parsePropTypeText(a,b,c);if(n)this.onHandlePropTypeText(a,b,m,
k,c);break;case CCB_PROPTYPE_BLOCK:k=this.parsePropTypeBlock(a,b,c);if(n)this.onHandlePropTypeBlock(a,b,m,k,c);break;case CCB_PROPTYPE_BLOCKCCCONTROL:k=this.parsePropTypeBlockCCControl(a,b,c);if(n&&null!=k)this.onHandlePropTypeBlockCCControl(a,b,m,k,c);break;case CCB_PROPTYPE_CCBFILE:k=this.parsePropTypeCCBFile(a,b,c);if(n)this.onHandlePropTypeCCBFile(a,b,m,k,c);break;default:ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(k)}}},getCustomProperties:function(){return this._customProperties},_createCCNode:function(a,
b){return new cc.Node},parsePropTypePosition:function(a,b,c,d){var e=c.readFloat(),f=c.readFloat(),h=c.readInt(!1);cc.getAbsolutePosition(e,f,h,b?b._contentSize:c._animationManager._rootContainerSize,d,this._pt);a.setPosition(this._pt);-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue([e,f,h],a,d);return this._pt},parsePropTypePoint:function(a,b,c){this._pt.x=c.readFloat();this._pt.y=c.readFloat();return this._pt},parsePropTypePointLock:function(a,b,c){this._pt.x=c.readFloat();this._pt.y=
c.readFloat();return this._pt},parsePropTypeSize:function(a,b,c){a=c.readFloat();var d=c.readFloat(),e=c.readInt(!1);b=b?b._contentSize:c._animationManager._rootContainerSize;switch(e){case CCB_SIZETYPE_ABSOLUTE:break;case CCB_SIZETYPE_RELATIVE_CONTAINER:a=b.width-a;d=b.height-d;break;case CCB_SIZETYPE_PERCENT:a=b.width*a/100;d=b.height*d/100;break;case CCB_SIZETYPE_HORIZONTAL_PERCENT:a=b.width*a/100;break;case CCB_SIZETYPE_VERTICAL_PERCENT:d=b.height*d/100;break;case CCB_SIZETYPE_MULTIPLY_RESOLUTION:b=
cc.BuilderReader.getResolutionScale();a*=b;d*=b;break;default:cc.log("Unknown CCB type.")}this._size.width=a;this._size.height=d;return this._size},parsePropTypeScaleLock:function(a,b,c,d){b=c.readFloat();var e=c.readFloat(),f=c.readInt(!1);-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue([b,e,f],a,d);f===CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(a=cc.BuilderReader.getResolutionScale(),b*=a,e*=a);this._pt.x=b;this._pt.y=e;return this._pt},parsePropTypeFloat:function(a,b,c){return c.readFloat()},
parsePropTypeDegrees:function(a,b,c,d){b=c.readFloat();-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeFloatScale:function(a,b,c){a=c.readFloat();c.readInt(!1)===CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(a*=cc.BuilderReader.getResolutionScale());return a},parsePropTypeInteger:function(a,b,c){return c.readInt(!0)},parsePropTypeIntegerLabeled:function(a,b,c){return c.readInt(!0)},parsePropTypeFloatVar:function(a,b,c){this._arr2[0]=c.readFloat();this._arr2[1]=
c.readFloat();return this._arr2},parsePropTypeCheck:function(a,b,c,d){b=!!c._data[c._currentByte++];-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeSpriteFrame:function(a,b,c,d){b=c.readCachedString();var e=c.readCachedString(),f;e&&(0===b.length?(e=c._ccbRootPath+e,b=cc.textureCache.addImage(e),e=b.getContentSize(),e=cc.rect(0,0,e.width,e.height),f=new cc.SpriteFrame(b,e)):(f=cc.spriteFrameCache,b=c._ccbRootPath+b,-1===c._loadedSpriteSheets.indexOf(b)&&
(f.addSpriteFrames(b),c._loadedSpriteSheets.push(b)),f=f.getSpriteFrame(e)),-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(f,a,d));return f},parsePropTypeAnimation:function(a,b,c){a=c._ccbRootPath+c.readCachedString();c=c.readCachedString();b=null;c=cc.BuilderReader.lastPathComponent(c);a=cc.BuilderReader.lastPathComponent(a);c&&(b=cc.animationCache,b.addAnimations(a),b=b.getAnimation(c));return b},parsePropTypeTexture:function(a,b,c){return(a=c._ccbRootPath+c.readCachedString())?
cc.textureCache.addImage(a):null},parsePropTypeByte:function(a,b,c,d){b=c._data[c._currentByte++];-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeColor3:function(a,b,c,d){b=c._data[c._currentByte++];var e=c._data[c._currentByte++],f=c._data[c._currentByte++];b=cc.color(b,e,f);-1<c._animatedProps.indexOf(d)&&c._animationManager.setBaseValue(b,a,d);return b},parsePropTypeColor4FVar:function(a,b,c){a=0|255*c.readFloat();b=0|255*c.readFloat();var d=0|255*
c.readFloat(),e=c.readFloat(),e=1>=e?0|255*e:e,f=0|255*c.readFloat(),h=0|255*c.readFloat(),k=0|255*c.readFloat();c=c.readFloat();this._arr2[0]={r:a,g:b,b:d,a:e};this._arr2[1]={r:f,g:h,b:k,a:1>=c?0|255*c:c};return this._arr2},parsePropTypeFlip:function(a,b,c){this._arr2[0]=!!c._data[c._currentByte++];this._arr2[1]=!!c._data[c._currentByte++];return this._arr2},parsePropTypeBlendFunc:function(a,b,c){a=c.readInt(!1);c=c.readInt(!1);return new cc.BlendFunc(a,c)},parsePropTypeFntFile:function(a,b,c){return c.readCachedString()},
parsePropTypeString:function(a,b,c){return c.readCachedString()},parsePropTypeText:function(a,b,c){return c.readCachedString()},parsePropTypeFontTTF:function(a,b,c){return c.readCachedString()},parsePropTypeBlock:function(a,b,c){b=c.readCachedString();var d=c.readInt(!1);if(d!==CCB_TARGETTYPE_NONE){var e=null;if(c._jsControlled)d===CCB_TARGETTYPE_DOCUMENTROOT?(c.addDocumentCallbackNode(a),c.addDocumentCallbackName(b),c.addDocumentCallbackControlEvents(0)):(c.addOwnerCallbackNode(a),c.addOwnerCallbackName(b),
c.addOwnerCallbackControlEvents(0));else if(d===CCB_TARGETTYPE_DOCUMENTROOT?e=c._animationManager._rootNode:d===CCB_TARGETTYPE_OWNER&&(e=c._owner),null!==e)if(0<b.length)if(a=0,e.onResolveCCBCCMenuItemSelector&&(a=e.onResolveCCBCCMenuItemSelector(e,b)),0===a&&(c=c._ccbSelectorResolver)&&(a=c.onResolveCCBCCMenuItemSelector(e,b)),0===a)cc.log("Skipping selector '"+b+"' since no CCBSelectorResolver is present.");else return new BlockData(a,e);else cc.log("Unexpected empty selector.");else cc.log("Unexpected NULL target for selector.")}return null},
parsePropTypeBlockCCControl:function(a,b,c){b=c.readCachedString();var d=c.readInt(!1),e=c.readInt(!1);if(d!==CCB_TARGETTYPE_NONE)if(c._jsControlled)d===CCB_TARGETTYPE_DOCUMENTROOT?(c.addDocumentCallbackNode(a),c.addDocumentCallbackName(b),c.addDocumentCallbackControlEvents(e)):(c.addOwnerCallbackNode(a),c.addOwnerCallbackName(b),c.addOwnerCallbackControlEvents(e));else if(a=null,d===CCB_TARGETTYPE_DOCUMENTROOT?a=c._animationManager._rootNode:d===CCB_TARGETTYPE_OWNER&&(a=c._owner),null!==a)if(0<b.length)if(d=
0,a.onResolveCCBCCControlSelector&&(d=a.onResolveCCBCCControlSelector(a,b)),0===d&&(c=c._ccbSelectorResolver,null!=c&&(d=c.onResolveCCBCCControlSelector(a,b))),0===d)cc.log("Skipping selector '"+b+"' since no CCBSelectorResolver is present.");else return this._blockControlData.selCCControlHandler=d,this._blockControlData.target=a,this._blockControlData.controlEvents=e,this._blockControlData;else cc.log("Unexpected empty selector.");else cc.log("Unexpected NULL target for selector.");return null},
parsePropTypeCCBFile:function(a,b,c){var d=c._ccbRootPath+c.readCachedString(),d=cc.BuilderReader.deletePathExtension(d)+".ccbi";a=new cc.BuilderReader(c);var e=cc.loader.getRes(d);e||(e=cc.loader.getUrl(d),e=hlddz.convertToDownloadURL(e),e=cc.loader.loadBinarySync(e),cc.loader.cache[d]=e);a.initWithData(e,c._owner);a._animationManager.setRootContainerSize(b._contentSize);a.setAnimationManagers(c._animationManagers);a._animationManager.setOwner(c._owner);b=a.readFileWithCleanUp(!1);c.setAnimationManagers(a._animationManagers);
b&&-1!==a._animationManager._autoPlaySequenceId&&a._animationManager.runAnimations(a._animationManager._autoPlaySequenceId,0);return b},parsePropTypeFloatXY:function(a,b,c){this._pt.x=c.readFloat();this._pt.y=c.readFloat();return this._pt},onHandlePropTypePosition:function(a,b,c,d,e){c===PROPERTY_POSITION?a.setPosition(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypePoint:function(a,b,c,d,e){c===PROPERTY_ANCHORPOINT?a.setAnchorPoint(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypePointLock:function(a,
b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_CONTENTSIZE?a.setContentSize(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeScaleLock:function(a,b,c,d,e){c===PROPERTY_SCALE?a.setScale(d.x,d.y):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFloatXY:function(a,b,c,d,e){c===PROPERTY_SKEW?(a._skewX=d.x,a._skewY=d.y):(b=c+"X",e=c+"Y",a[b]&&a[e]||ASSERT_FAIL_UNEXPECTED_PROPERTY(c),a[b](d.x),a[e](d.y))},onHandlePropTypeFloat:function(a,b,c,
d,e){this._customProperties.setObject(d,c)},onHandlePropTypeDegrees:function(a,b,c,d,e){c===PROPERTY_ROTATION?a.setRotation(d):ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFloatScale:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeInteger:function(a,b,c,d,e){c===PROPERTY_TAG?a.tag=d:ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFloatVar:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},
onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_VISIBLE?a._visible=d:c===PROPERTY_IGNOREANCHORPOINTFORPOSITION?a._ignoreAnchorPointForPosition=d:ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeAnimation:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeTexture:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeByte:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},
onHandlePropTypeColor3:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeColor4FVar:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFlip:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFntFile:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeString:function(a,b,c,d,e){this._customProperties.setObject(d,c)},onHandlePropTypeText:function(a,
b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeFontTTF:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeBlock:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeBlockCCControl:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)},onHandlePropTypeCCBFile:function(a,b,c,d,e){ASSERT_FAIL_UNEXPECTED_PROPERTY(c)}});cc.NodeLoader.loader=function(){return new cc.NodeLoader};cc.NodeLoaderListener=cc.Class.extend({onNodeLoaded:function(a,b){}});cc.BuilderSelectorResolver=cc.Class.extend({onResolveCCBCCMenuItemSelector:function(a,b){},onResolveCCBCCCallFuncSelector:function(a,b){},onResolveCCBCCControlSelector:function(a,b){}});cc.BuilderScriptOwnerProtocol=cc.Class.extend({createNew:function(){}});cc.BuilderMemberVariableAssigner=cc.Class.extend({onAssignCCBMemberVariable:function(a,b,c){return!1},onAssignCCBCustomProperty:function(a,b,c){return!1}});var PROPERTY_CCBFILE="ccbFile";cc.BuilderFileLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){var c=new cc.Node;c.ccbFileNode=null;return c},onHandlePropTypeCCBFile:function(a,b,c,d,e){c===PROPERTY_CCBFILE?a.ccbFileNode=d:cc.NodeLoader.prototype.onHandlePropTypeCCBFile.call(this,a,b,c,d,e)}});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,b){},onHandlePropTypeBlockCCControl:function(a,b,c,d,e){c===PROPERTY_CCCONTROL?a.addTargetWithActionForControlEvents(d.target,d.selCCControlHandler,d.controlEvents):cc.NodeLoader.prototype.onHandlePropTypeBlockCCControl.call(this,a,b,c,d,e)},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_ENABLED?a.setEnabled(d):c===PROPERTY_SELECTED?a.setSelected(d):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)}});
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,b){return new cc.ControlButton},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_ZOOMONTOUCHDOWN?a.zoomOnTouchDown=d:cc.ControlLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)},onHandlePropTypeString:function(a,b,c,d,e){c===PROPERTY_TITLE_NORMAL?a.setTitleForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLE_HIGHLIGHTED?a.setTitleForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLE_DISABLED?a.setTitleForState(d,
cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeString.call(this,a,b,c,d,e)},onHandlePropTypeFontTTF:function(a,b,c,d,e){c===PROPERTY_TITLETTF_NORMAL?a.setTitleTTFForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLETTF_HIGHLIGHTED?a.setTitleTTFForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLETTF_DISABLED?a.setTitleTTFForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeFontTTF.call(this,a,b,c,d,e)},onHandlePropTypeFloatScale:function(a,
b,c,d,e){c===PROPERTY_TITLETTFSIZE_NORMAL?a.setTitleTTFSizeForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLETTFSIZE_HIGHLIGHTED?a.setTitleTTFSizeForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLETTFSIZE_DISABLED?a.setTitleTTFSizeForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeFloatScale.call(this,a,b,c,d,e)},onHandlePropTypePoint:function(a,b,c,d,e){c===PROPERTY_LABELANCHORPOINT?a.setLabelAnchorPoint(d):cc.ControlLoader.prototype.onHandlePropTypePoint.call(this,
a,b,c,d,e)},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_PREFEREDSIZE?a.setPreferredSize(d):cc.ControlLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL?null!=d&&a.setBackgroundSpriteFrameForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED?null!=d&&a.setBackgroundSpriteFrameForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED?null!=
d&&a.setBackgroundSpriteFrameForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_TITLECOLOR_NORMAL?a.setTitleColorForState(d,cc.CONTROL_STATE_NORMAL):c===PROPERTY_TITLECOLOR_HIGHLIGHTED?a.setTitleColorForState(d,cc.CONTROL_STATE_HIGHLIGHTED):c===PROPERTY_TITLECOLOR_DISABLED?a.setTitleColorForState(d,cc.CONTROL_STATE_DISABLED):cc.ControlLoader.prototype.onHandlePropTypeColor3.call(this,
a,b,c,d,e)}});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,b){return new cc.ScrollView},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_CONTENTSIZE?a.setViewSize(d):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e)},onHandlePropTypeCCBFile:function(a,b,c,d,e){c===PROPERTY_CONTAINER?(a.setContainer(d),a.updateInset()):cc.NodeLoader.prototype.onHandlePropTypeCCBFile.call(this,a,b,c,d,e)},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_CLIPSTOBOUNDS?a.setClippingToBounds(d):
c===PROPERTY_BOUNCES?a.setBounceable(d):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)},onHandlePropTypeFloat:function(a,b,c,d,e){c===PROPERTY_SCALE?a.setScale(d):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,b,c,d,e)},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){c===PROPERTY_DIRECTION?a.setDirection(d):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,b,c,d,e)}});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,b){var c=new cc.Scale9Sprite;c.setAnchorPoint(0,0);return c},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c!==
PROPERTY_BLENDFUNC&&cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_SPRITEFRAME?a.setSpriteFrame(d):cc.NodeLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)},onHandlePropTypeSize:function(a,b,c,d,e){c!==PROPERTY_CONTENTSIZE&&(c===PROPERTY_PREFEREDSIZE?a.setPreferredSize(d):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e))},onHandlePropTypeFloat:function(a,b,c,d,e){c===PROPERTY_INSETLEFT?
a.setInsetLeft(d):c===PROPERTY_INSETTOP?a.setInsetTop(d):c===PROPERTY_INSETRIGHT?a.setInsetRight(d):c===PROPERTY_INSETBOTTOM?a.setInsetBottom(d):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,b,c,d,e)}});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,b){return new cc.Sprite},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,
a,b,c,d,e)},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_DISPLAYFRAME?d?a.setSpriteFrame(d):cc.log("ERROR: SpriteFrame is null"):cc.NodeLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)},onHandlePropTypeFlip:function(a,b,c,d,e){c===PROPERTY_FLIP?(a.setFlippedX(d[0]),a.setFlippedY(d[1])):cc.NodeLoader.prototype.onHandlePropTypeFlip.call(this,a,b,c,d,e)}});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,b){var c=new cc.Layer;c.setContentSize(0,0);return c},onHandlePropTypeCheck:function(a,b,c,d,e){c!==PROPERTY_TOUCH_ENABLED&&c!==PROPERTY_IS_TOUCH_ENABLED&&c!==PROPERTY_ACCELEROMETER_ENABLED&&c!==PROPERTY_IS_ACCELEROMETER_ENABLED&&c!==PROPERTY_MOUSE_ENABLED&&c!==PROPERTY_IS_MOUSE_ENABLED&&(c===PROPERTY_KEYBOARD_ENABLED||c===PROPERTY_IS_KEYBOARD_ENABLED?a.setKeyboardEnabled&&!cc.sys.isNative?a.setKeyboardEnabled(d):cc.log("The property '"+
PROPERTY_IS_KEYBOARD_ENABLED+"' is not supported!"):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e))}});cc.LayerLoader.loader=function(){return new cc.LayerLoader};
cc.LayerColorLoader=cc.LayerLoader.extend({_createCCNode:function(a,b){return new cc.LayerColor},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?a.setColor(d):cc.LayerLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.LayerLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.LayerLoader.prototype.onHandlePropTypeBlendFunc.call(this,
a,b,c,d,e)}});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,b){return new cc.LayerGradient},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_STARTCOLOR?a.setStartColor(d):c===PROPERTY_ENDCOLOR?a.setEndColor(d):cc.LayerLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_STARTOPACITY?a.setStartOpacity(d):c===PROPERTY_ENDOPACITY?a.setEndOpacity(d):cc.LayerLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypePoint:function(a,
b,c,d,e){c===PROPERTY_VECTOR?a.setVector(d):cc.LayerLoader.prototype.onHandlePropTypePoint.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.LayerLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)}});cc.LayerGradientLoader.loader=function(){return new cc.LayerGradientLoader};cc.MenuLoader=cc.LayerLoader.extend({_createCCNode:function(a,b){var c=new cc.Menu;c.setContentSize(0,0);return c}});cc.MenuLoader.loader=function(){return new cc.MenuLoader};
var PROPERTY_BLOCK="block",PROPERTY_ISENABLED="isEnabled";cc.MenuItemLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return null},onHandlePropTypeBlock:function(a,b,c,d,e){c===PROPERTY_BLOCK?null!=d&&a.setTarget(d.selMenuHander,d.target):cc.NodeLoader.prototype.onHandlePropTypeBlock.call(this,a,b,c,d,e)},onHandlePropTypeCheck:function(a,b,c,d,e){c===PROPERTY_ISENABLED?a.setEnabled(d):cc.NodeLoader.prototype.onHandlePropTypeCheck.call(this,a,b,c,d,e)}});
var PROPERTY_NORMALDISPLAYFRAME="normalSpriteFrame",PROPERTY_SELECTEDDISPLAYFRAME="selectedSpriteFrame",PROPERTY_DISABLEDDISPLAYFRAME="disabledSpriteFrame";
cc.MenuItemImageLoader=cc.MenuItemLoader.extend({_createCCNode:function(a,b){return new cc.MenuItemImage},onHandlePropTypeSpriteFrame:function(a,b,c,d,e){c===PROPERTY_NORMALDISPLAYFRAME?null!=d&&a.setNormalSpriteFrame(d):c===PROPERTY_SELECTEDDISPLAYFRAME?null!=d&&a.setSelectedSpriteFrame(d):c===PROPERTY_DISABLEDDISPLAYFRAME?null!=d&&a.setDisabledSpriteFrame(d):cc.MenuItemLoader.prototype.onHandlePropTypeSpriteFrame.call(this,a,b,c,d,e)}});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,b){return new cc.LabelTTF},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):
cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeFontTTF:function(a,b,c,d,e){c===PROPERTY_FONTNAME?a.setFontName(d):cc.NodeLoader.prototype.onHandlePropTypeFontTTF.call(this,a,b,c,d,e)},onHandlePropTypeText:function(a,b,c,d,e){c===PROPERTY_STRING?a.setString(d):cc.NodeLoader.prototype.onHandlePropTypeText.call(this,a,b,c,d,e)},onHandlePropTypeFloatScale:function(a,b,c,d,e){c===PROPERTY_FONTSIZE?a.setFontSize(d):cc.NodeLoader.prototype.onHandlePropTypeFloatScale.call(this,
a,b,c,d,e)},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){c===PROPERTY_HORIZONTALALIGNMENT?a.setHorizontalAlignment(d):c===PROPERTY_VERTICALALIGNMENT?a.setVerticalAlignment(d):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,b,c,d,e)},onHandlePropTypeSize:function(a,b,c,d,e){c===PROPERTY_DIMENSIONS?a.setDimensions(d):cc.NodeLoader.prototype.onHandlePropTypeSize.call(this,a,b,c,d,e)}});cc.LabelTTFLoader.loader=function(){return new cc.LabelTTFLoader};var PROPERTY_FNTFILE="fntFile";
cc.LabelBMFontLoader=cc.NodeLoader.extend({_createCCNode:function(a,b){return new cc.LabelBMFont},onHandlePropTypeColor3:function(a,b,c,d,e){c===PROPERTY_COLOR?255===d.r&&255===d.g&&255===d.b||a.setColor(d):cc.NodeLoader.prototype.onHandlePropTypeColor3.call(this,a,b,c,d,e)},onHandlePropTypeByte:function(a,b,c,d,e){c===PROPERTY_OPACITY?a.setOpacity(d):cc.NodeLoader.prototype.onHandlePropTypeByte.call(this,a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):
cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeFntFile:function(a,b,c,d,e){c===PROPERTY_FNTFILE?a.setFntFile(d):cc.NodeLoader.prototype.onHandlePropTypeFntFile.call(this,a,b,c,d,e)},onHandlePropTypeText:function(a,b,c,d,e){c===PROPERTY_STRING?a.setString(d):cc.NodeLoader.prototype.onHandlePropTypeText.call(this,a,b,c,d,e)}});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,b){return new cc.ParticleSystem},onHandlePropTypeIntegerLabeled:function(a,b,c,d,e){c===PROPERTY_EMITERMODE?a.setEmitterMode(d):cc.NodeLoader.prototype.onHandlePropTypeIntegerLabeled.call(this,a,b,c,d,e)},onHandlePropTypePoint:function(a,b,c,d,e){c===PROPERTY_POSVAR?a.setPosVar(d):c===PROPERTY_GRAVITY?a.setGravity(d):cc.NodeLoader.prototype.onHandlePropTypePoint.call(this,a,b,c,d,e)},onHandlePropTypeFloat:function(a,b,c,d,e){c===
PROPERTY_EMISSIONRATE?a.setEmissionRate(d):c===PROPERTY_DURATION?a.setDuration(d):cc.NodeLoader.prototype.onHandlePropTypeFloat.call(this,a,b,c,d,e)},onHandlePropTypeInteger:function(a,b,c,d,e){c===PROPERTY_TOTALPARTICLES?a.setTotalParticles(d):cc.NodeLoader.prototype.onHandlePropTypeInteger.call(this,a,b,c,d,e)},onHandlePropTypeFloatVar:function(a,b,c,d,e){c===PROPERTY_LIFE?(a.setLife(d[0]),a.setLifeVar(d[1])):c===PROPERTY_STARTSIZE?(a.setStartSize(d[0]),a.setStartSizeVar(d[1])):c===PROPERTY_ENDSIZE?
(a.setEndSize(d[0]),a.setEndSizeVar(d[1])):c===PROPERTY_STARTSPIN?(a.setStartSpin(d[0]),a.setStartSpinVar(d[1])):c===PROPERTY_ENDSPIN?(a.setEndSpin(d[0]),a.setEndSpinVar(d[1])):c===PROPERTY_ANGLE?(a.setAngle(d[0]),a.setAngleVar(d[1])):c===PROPERTY_SPEED?(a.setSpeed(d[0]),a.setSpeedVar(d[1])):c===PROPERTY_TANGENTIALACCEL?(a.setTangentialAccel(d[0]),a.setTangentialAccelVar(d[1])):c===PROPERTY_RADIALACCEL?(a.setRadialAccel(d[0]),a.setRadialAccelVar(d[1])):c===PROPERTY_STARTRADIUS?(a.setStartRadius(d[0]),
a.setStartRadiusVar(d[1])):c===PROPERTY_ENDRADIUS?(a.setEndRadius(d[0]),a.setEndRadiusVar(d[1])):c===PROPERTY_ROTATEPERSECOND?(a.setRotatePerSecond(d[0]),a.setRotatePerSecondVar(d[1])):cc.NodeLoader.prototype.onHandlePropTypeFloatVar.call(this,a,b,c,d,e)},onHandlePropTypeColor4FVar:function(a,b,c,d,e){c===PROPERTY_STARTCOLOR?(a.setStartColor(d[0]),a.setStartColorVar(d[1])):c===PROPERTY_ENDCOLOR?(a.setEndColor(d[0]),a.setEndColorVar(d[1])):cc.NodeLoader.prototype.onHandlePropTypeColor4FVar.call(this,
a,b,c,d,e)},onHandlePropTypeBlendFunc:function(a,b,c,d,e){c===PROPERTY_BLENDFUNC?a.setBlendFunc(d):cc.NodeLoader.prototype.onHandlePropTypeBlendFunc.call(this,a,b,c,d,e)},onHandlePropTypeTexture:function(a,b,c,d,e){c===PROPERTY_TEXTURE?a.setTexture(d):cc.NodeLoader.prototype.onHandlePropTypeTexture.call(this,a,b,c,d,e)}});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,b){this._ccNodeLoaders[a]=b},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 b in this._ccNodeLoaders)delete this._ccNodeLoaders[b];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};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;
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,b,c,d){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=b,this._ccbSelectorResolver=c,this._ccNodeLoaderListener=d))},getCCBRootPath:function(){return this._ccbRootPath},setCCBRootPath:function(a){this._ccbRootPath=a},initWithData:function(a,b){this._animationManager=new cc.BuilderAnimationManager;
this._data=a;this._bytes=a.length;this._currentByte=this._currentBit=0;this._owner=b;this._animationManager.setRootContainerSize(cc.director.getWinSize());return!0},_loadBinarySync:function(a){var b=this.getXMLHttpRequest(),c="load "+a+" failed!";b.open("GET",a,!1);var d=null;if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){b.setRequestHeader("Accept-Charset","x-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;if(b=cc._convertResponseBodyToText(b.responseBody))d=
this._stringConvertToArray(b),this._fileDataCache[a]=d}else{b.overrideMimeType&&b.overrideMimeType("text/plain; charset\x3dx-user-defined");b.send(null);if(200!==b.status)return cc.log(c),null;d=this._stringConvertToArray(b.responseText);this._fileDataCache[a]=d}return d},readNodeGraphFromFile:function(a,b,c,d){null==c?c=cc.director.getWinSize():c instanceof cc.BuilderAnimationManager&&(d=c,c=cc.director.getWinSize());var e=cc.loader.getRes(a);e||(e=cc.loader.getUrl(a),e=cc.loader.loadBinarySync(e),
cc.loader.cache[a]=e);return this.readNodeGraphFromData(e,b,c,d)},readNodeGraphFromData:function(a,b,c){this.initWithData(a,b);a=this._animationManager;a.setRootContainerSize(c);a.setOwner(b);this._ownerOutletNames=[];this._ownerOutletNodes=[];this._ownerCallbackNames=[];this._ownerCallbackNodes=[];this._ownerCallbackEvents=[];this._animationManagers=new cc._Dictionary;(b=this.readFileWithCleanUp(!0))&&-1!==a.getAutoPlaySequenceId()&&a.runAnimations(a.getAutoPlaySequenceId(),0);if(this._jsControlled){c=
[];a=[];for(var d=this._animationManagers,e=d.allKeys(),f=0;f<e.length;f++)c.push(e[f]),a.push(d.objectForKey(e[f]));this._nodesWithAnimationManagers=c;this._animationManagerForNodes=a}return b},createSceneWithNodeGraphFromFile:function(a,b,c,d){a=this.readNodeGraphFromFile(a,b,c,d);b=new cc.Scene;b.addChild(a);return b},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 b=0,c=this._data[this._currentByte],d=!!(c&1<<this._currentBit++);!d;)if(b++,d=!!(c&1<<this._currentBit++),8<=this._currentBit&&(this._currentBit=0,this._currentByte++,c=this._data[this._currentByte],this._currentByte>this._data.length))throw Error("out of the data bound");
for(var e=0,f=b-1;0<=f;f--){d=!!(c&1<<this._currentBit++);if(8<=this._currentBit&&(this._currentBit=0,this._currentByte++,c=this._data[this._currentByte],this._currentByte>this._data.length))throw Error("out of the data bound");d&&(e|=1<<f)}e|=1<<b;this._currentBit&&(this._currentBit=0,this._currentByte++);return a?e%2?0|e/2:0|-e/2:e-1},readByte:function(){var a=this._data[this._currentByte];this._currentByte++;return a},readBool:function(){return!!this._data[this._currentByte++]},readFloat:function(){switch(this._data[this._currentByte++]){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,b){var c=a+b+1>>3;if(this._currentByte+c>=this._data.length)throw Error("Index out of bound");var d=Math.pow(2,b-1)-1,e=this._readBitsOnly(a+b,1,c),f=this._readBitsOnly(a,b,c),h=0,k=2,m=0;do for(var n=this._data[this._currentByte+c-++m-1],p=a%8||8,r=1<<p;r>>=1;)n&r&&(h+=1/k),k*=2;while(a-=p);this._currentByte+=
c;return f===(d<<1)+1?h?NaN:e?-Infinity:Infinity:(1+-2*e)*(f||h?f?Math.pow(2,f-d)*(1+h):Math.pow(2,-d+1)*h:0)},_readBitsOnly:function(a,b,c){var d=(a+b)%8,e=a%8,f=c-(a>>3)-1;a=c+(-(a+b)>>3);var h=f-a;b=this._data[this._currentByte+c-f-1]>>e&(1<<(h?8-e:b))-1;h&&d&&(b+=(this._data[this._currentByte+c-a-1]&(1<<d)-1)<<(h--<<3)-e,a++);for(;h;)b+=this._shl(this._data[this._currentByte+c-a-1],(h--<<3)-e),a++;return b},_shl:function(a,b){for(++b;--b;a=1073741824===((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+
2147483648);return a},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 b=this._readNodeGraph();this._animationManagers.setObject(this._animationManager,b);a&&this._cleanUpNodeGraph(b);return b},addOwnerOutletName:function(a){this._ownerOutletNames.push(a)},addOwnerOutletNode:function(a){null!=
a&&this._ownerOutletNodes.push(a)},_cleanUpNodeGraph:function(a){a.userObject=null;a=a.getChildren();for(var b=0,c=a.length;b<c;b++)this._cleanUpNodeGraph(a[b])},_readCallbackKeyframesForSeq:function(a){var b=this.readInt(!1);if(!b)return!0;for(var c=new cc.BuilderSequenceProperty,d=this._jsControlled,e=this._animationManager,f=c.getKeyframes(),h=0;h<b;h++){var k=this.readFloat(),m=this.readCachedString(),n=this.readInt(!1),p=[m,n],r=new cc.BuilderKeyframe;r.setTime(k);r.setValue(p);d&&e.getKeyframeCallbacks().push(n+
":"+m);f.push(r)}a.setCallbackChannel(c);return!0},_readSoundKeyframesForSeq:function(a){var b=this.readInt(!1);if(!b)return!0;for(var c=new cc.BuilderSequenceProperty,d=c.getKeyframes(),e=0;e<b;e++){var f=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(f);k.setValue(h);d.push(k)}a.setSoundChannel(c);return!0},_readSequences:function(){for(var a=this._animationManager.getSequences(),b=this.readInt(!1),
c=0;c<b;c++){var d=new cc.BuilderSequence;d.setDuration(this.readFloat());d.setName(this.readCachedString());d.setSequenceId(this.readInt(!1));d.setChainedSequenceId(this.readInt(!0));if(!this._readCallbackKeyframesForSeq(d)||!this._readSoundKeyframesForSeq(d))return!1;a.push(d)}this._animationManager.setAutoPlaySequenceId(this.readInt(!0));return!0},readKeyframe:function(a){var b=new cc.BuilderKeyframe;b.setTime(this.readFloat());var c=this.readInt(!1),d=0,e=null;if(c===CCB_KEYFRAME_EASING_CUBIC_IN||
c===CCB_KEYFRAME_EASING_CUBIC_OUT||c===CCB_KEYFRAME_EASING_CUBIC_INOUT||c===CCB_KEYFRAME_EASING_ELASTIC_IN||c===CCB_KEYFRAME_EASING_ELASTIC_OUT||c===CCB_KEYFRAME_EASING_ELASTIC_INOUT)d=this.readFloat();b.setEasingType(c);b.setEasingOpt(d);a===CCB_PROPTYPE_CHECK?e=!!this._data[this._currentByte++]:a===CCB_PROPTYPE_BYTE?e=this._data[this._currentByte++]:a===CCB_PROPTYPE_COLOR3?e=cc.color(this._data[this._currentByte++],this._data[this._currentByte++],this._data[this._currentByte++]):a===CCB_PROPTYPE_FLOATXY?
e=[this.readFloat(),this.readFloat()]:a===CCB_PROPTYPE_DEGREES?e=this.readFloat():a===CCB_PROPTYPE_SCALELOCK||a===CCB_PROPTYPE_POSITION||a===CCB_PROPTYPE_FLOATXY?e=[this.readFloat(),this.readFloat()]:a===CCB_PROPTYPE_SPRITEFRAME&&(a=this.readCachedString(),c=this.readCachedString(),""===a?(c=this._ccbRootPath+c,a=cc.textureCache.addImage(c),c=a.getContentSize(),c=cc.rect(0,0,c.width,c.height),e=new cc.SpriteFrame(a,c)):(a=this._ccbRootPath+a,d=cc.spriteFrameCache,-1===this._loadedSpriteSheets.indexOf(a)&&
(d.addSpriteFrames(a),this._loadedSpriteSheets.push(a)),e=d.getSpriteFrame(c)));b.setValue(e);return b},_readHeader:function(){if(!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._data[this._currentByte++];this._animationManager._jsControlled=this._jsControlled;return!0},
_readStringFromBytes:function(a,b,c){var d="",e=this._data;if(c)for(c=b-1;0<=c;c--)d+=String.fromCharCode(e[a+c]);else for(c=0;c<b;c++)d+=String.fromCharCode(e[a+c]);return d},_readStringCache:function(){for(var a=this.readInt(!1),b=0;b<a;b++)this._readStringCacheEntry();return!0},_readStringCacheEntry:function(){for(var a=this._data[this._currentByte++],b=this._data[this._currentByte++],a=a<<8|b,b="",c=this._data,d=this._currentByte,e=0;e<a;e++)var f=c[d+e].toString("16").toUpperCase(),f=1<f.length?
f:"0"+f,b=b+("%"+f);b=decodeURIComponent(b);this._currentByte+=a;this._stringCache.push(b)},_readNodeGraph:function(a){var b=this.readCachedString(),c,d=this._jsControlled,e=this._animationManager;d&&(c=this.readCachedString());var f=this.readInt(!1),h;f!==CCB_TARGETTYPE_NONE&&(h=this.readCachedString());(b=this._ccNodeLoaderLibrary.getCCNodeLoader(b))||(b=this._ccNodeLoaderLibrary.getCCNodeLoader("CCNode"));var k=b.loadCCNode(a,this);e.getRootNode()||e.setRootNode(k);d&&k===e.getRootNode()&&e.setDocumentControllerName(c);
var m=new cc._Dictionary,n=this._animatedProps=[],p=this.readInt(!1);for(c=0;c<p;++c){for(var r=this.readInt(!1),s=new cc._Dictionary,t=this.readInt(!1),w=0;w<t;++w){var v=new cc.BuilderSequenceProperty;v.setName(this.readCachedString());v.setType(this.readInt(!1));n.push(v.getName());for(var y=this.readInt(!1),x=v.getKeyframes(),u=0;u<y;++u){var z=this.readKeyframe(v.getType());x.push(z)}s.setObject(v,v.getName())}m.setObject(s,r)}0<m.count()&&e.addNode(k,m);b.parseProperties(k,a,this);if(a=!!k.ccbFileNode)c=
k.ccbFileNode,c.setPosition(k.getPosition()),c.setRotation(k.getRotation()),c.setScaleX(k.getScaleX()),c.setScaleY(k.getScaleY()),c.setTag(k.getTag()),c.setVisible(!0),e.moveAnimationsFromNode(k,c),k.ccbFileNode=null,k=c;n=m=null;if(f!==CCB_TARGETTYPE_NONE)if(d)f===CCB_TARGETTYPE_DOCUMENTROOT?(e.addDocumentOutletName(h),e.addDocumentOutletNode(k)):(this._ownerOutletNames.push(h),this._ownerOutletNodes.push(k));else if(f===CCB_TARGETTYPE_DOCUMENTROOT?m=e.getRootNode():f===CCB_TARGETTYPE_OWNER&&(m=
this._owner),!m&&(c=!1,m.onAssignCCBMemberVariable&&(c=m.onAssignCCBMemberVariable(m,h,k)),n=this._ccbMemberVariableAssigner,!c&&null!=n&&n.onAssignCCBMemberVariable))n.onAssignCCBMemberVariable(m,h,k);if(0<b.getCustomProperties().length&&(h=!1,!d&&(m=k,null!=m&&null!=m.onAssignCCBCustomProperty)))for(d=b.getCustomProperties(),e=d.allKeys(),c=0;c<e.length;c++)if(f=d.objectForKey(e[c]),h=m.onAssignCCBCustomProperty(m,e[c],f),n=this._ccbMemberVariableAssigner,!h&&null!=n&&null!=n.onAssignCCBCustomProperty)n.onAssignCCBCustomProperty(m,
e[c],f);this._animatedProps=null;d=this.readInt(!1);for(c=0;c<d;c++)h=this._readNodeGraph(k),k.addChild(h);if(!a)if(null!=k&&k.onNodeLoaded)k.onNodeLoaded(k,b);else if(null!=this._ccNodeLoaderListener)this._ccNodeLoaderListener.onNodeLoaded(k,b);return k},_readUTF8:function(){}});cc.BuilderReader._ccbResolutionScale=1;cc.BuilderReader.setResolutionScale=function(a){cc.BuilderReader._ccbResolutionScale=a};cc.BuilderReader.getResolutionScale=function(){return cc.BuilderReader._ccbResolutionScale};
cc.BuilderReader.loadAsScene=function(a,b,c,d){d=d||cc.BuilderReader.getResourcePath();a=cc.BuilderReader.load(a,b,c,d);b=new cc.Scene;b.addChild(a);return b};cc.BuilderReader._controllerClassCache={};cc.BuilderReader.registerController=function(a,b){cc.BuilderReader._controllerClassCache[a]=cc.Class.extend(b)};
cc.BuilderReader.load=function(a,b,c,d){d=d||cc.BuilderReader.getResourcePath();var e=new cc.BuilderReader(cc.NodeLoaderLibrary.newDefaultCCNodeLoaderLibrary());e.setCCBRootPath(d);if(5>a.length||a.toLowerCase().lastIndexOf(".ccbi")!==a.length-5)a+=".ccbi";a=e.readNodeGraphFromFile(a,b,c);var f,h,k;if(b){d=e.getOwnerCallbackNames();var m=e.getOwnerCallbackNodes(),n=e.getOwnerCallbackControlEvents();for(c=0;c<d.length;c++)f=d[c],h=m[c],k=n[c],h instanceof cc.ControlButton?h.addTargetWithActionForControlEvents(b,
b[f],k):h.setCallback(b[f],b);d=e.getOwnerOutletNames();m=e.getOwnerOutletNodes();for(c=0;c<d.length;c++)f=d[c],h=m[c],b[f]=h}d=e.getNodesWithAnimationManagers();e=e.getAnimationManagersForNodes();if(!d||!e)return a;m=cc.BuilderReader._controllerClassCache;for(c=0;c<d.length;c++){var p=d[c],r=e[c];p.animationManager=r;if(f=r.getDocumentControllerName()){n=m[f];if(!n)throw Error("Can not find controller : "+f);n=new n;n.controllerName=f;p.controller=n;n.rootNode=p;for(var s=r.getDocumentCallbackNames(),
t=r.getDocumentCallbackNodes(),w=r.getDocumentCallbackControlEvents(),p=0;p<s.length;p++)f=s[p],h=t[p],k=w[p],h instanceof cc.ControlButton?h.addTargetWithActionForControlEvents(n,n[f],k):h.setCallback(n[f],n);k=r.getDocumentOutletNames();s=r.getDocumentOutletNodes();for(p=0;p<k.length;p++)f=k[p],h=s[p],n[f]=h;if(n.onDidLoadFromCCB&&cc.isFunction(n.onDidLoadFromCCB))n.onDidLoadFromCCB();f=r.getKeyframeCallbacks();for(p=0;p<f.length;p++)k=f[p].split(":"),h=k[0],k=k[1],1==h?r.setCallFunc(cc.callFunc(n[k],
n),f[p]):2==h&&b&&r.setCallFunc(cc.callFunc(b[k],b),f[p])}}r.runAnimations(r.getAutoPlaySequenceId(),0);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 b=a.lastIndexOf("/");return-1!==b?a.substring(b+1,a.length-b):a};
cc.BuilderReader.deletePathExtension=function(a){var b=a.lastIndexOf(".");return-1!==b?a.substring(0,b):a};cc.BuilderReader.toLowerCase=function(a){return a.toLowerCase()};cc.BuilderReader.endsWith=function(a,b){return a.length>=b.length?0===a.lastIndexOf(b):!1};cc.BuilderReader.concat=function(a,b){return a+b};cc.loader.register(["ccbi"],cc._binaryLoader);cc.INT_VALUE=0;cc.FLOAT_VALUE=1;cc.POINTER_VALUE=2;cc.BOOL_VALUE=3;cc.UNSIGNEDCHAR_VALUE=4;cc.BuilderValue=cc.Class.extend({_value:null,_type:0,getIntValue:function(){},getFloatValue:function(){},getBoolValue:function(){},getByteValue:function(){},getPointer:function(){},getValue:function(){return this._value}});cc.BuilderValue.create=function(a){return new cc.BuilderValue};cc.BuilderKeyframe=cc.Class.extend({_value:null,_time:0,_easingType:0,_easingOpt:0,getValue:function(){return this._value},setValue:function(a){this._value=a},getTime:function(){return this._time},setTime:function(a){this._time=a},getEasingType:function(){return this._easingType},setEasingType:function(a){this._easingType=a},getEasingOpt:function(){return this._easingOpt},setEasingOpt:function(a){this._easingOpt=a}});cc.BuilderSequence=cc.Class.extend({_duration:0,_name:"",_sequenceId:0,_chainedSequenceId:0,_callbackChannel:null,_soundChannel:null,ctor:function(){this._name=""},getDuration:function(){return this._duration},setDuration:function(a){this._duration=a},getName:function(){return this._name},setName:function(a){this._name=a},getSequenceId:function(){return this._sequenceId},setSequenceId:function(a){this._sequenceId=a},getChainedSequenceId:function(){return this._chainedSequenceId},setChainedSequenceId:function(a){this._chainedSequenceId=
a},getCallbackChannel:function(){return this._callbackChannel},setCallbackChannel:function(a){this._callbackChannel=a},getSoundChannel:function(){return this._soundChannel},setSoundChannel:function(a){this._soundChannel=a}});
cc.BuilderSequenceProperty=cc.Class.extend({_name:null,_type:0,_keyFrames:null,ctor:function(){this.init()},init:function(){this._keyFrames=[];this._name=""},getName:function(){return this._name},setName:function(a){this._name=a},getType:function(){return this._type},setType:function(a){this._type=a},getKeyframes:function(){return this._keyFrames}});cc.getAbsolutePosition=function(a,b,c,d,e,f){e=f||cc.p(0,0);c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_LEFT?(e.x=a,e.y=b):c===CCB_POSITIONTYPE_RELATIVE_TOP_LEFT?(e.x=a,e.y=d.height-b):c===CCB_POSITIONTYPE_RELATIVE_TOP_RIGHT?(e.x=d.width-a,e.y=d.height-b):c===CCB_POSITIONTYPE_RELATIVE_BOTTOM_RIGHT?(e.x=d.width-a,e.y=b):c===CCB_POSITIONTYPE_PERCENT?(e.x=d.width*a/100,e.y=d.height*b/100):c===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(c=cc.BuilderReader.getResolutionScale(),e.x=a*c,e.y=b*c);return e};
cc.setRelativeScale=function(a,b,c,d,e){if(!a)throw Error("cc.setRelativeScale(): node should be non-null");d===CCB_POSITIONTYPE_MULTIPLY_RESOLUTION&&(d=cc.BuilderReader.getResolutionScale(),b*=d,c*=d);a.setScale(b,c)};(function(){var a=cc.p();cc.BuilderAnimationManagerDelegate=cc.Class.extend({completedAnimationSequenceNamed:function(a){}});cc.BuilderAnimationManager=cc.Class.extend({_sequences:null,_nodeSequences:null,_baseValues:null,_autoPlaySequenceId:0,_rootNode:null,_owner:null,_rootContainerSize:null,_delegate:null,_runningSequence:null,_documentOutletNames:null,_documentOutletNodes:null,_documentCallbackNames:null,_documentCallbackNodes:null,_documentCallbackControlEvents:null,_documentControllerName:"",
_lastCompletedSequenceName:"",_keyframeCallbacks:null,_keyframeCallFuncs:null,_animationCompleteCallbackFunc:null,_target:null,_jsControlled:!1,ctor:function(){this._rootContainerSize=cc.size(0,0);this.init()},init:function(){this._sequences=[];this._nodeSequences=new cc._Dictionary;this._baseValues=new cc._Dictionary;this._documentOutletNames=[];this._documentOutletNodes=[];this._documentCallbackNames=[];this._documentCallbackNodes=[];this._documentCallbackControlEvents=[];this._keyframeCallbacks=
[];this._keyframeCallFuncs={};return!0},getSequences:function(){return this._sequences},setSequences:function(a){this._sequences=a},getAutoPlaySequenceId:function(){return this._autoPlaySequenceId},setAutoPlaySequenceId:function(a){this._autoPlaySequenceId=a},getRootNode:function(){return this._rootNode},setRootNode:function(a){this._rootNode=a},getOwner:function(){return this._owner},setOwner:function(a){this._owner=a},addDocumentCallbackNode:function(a){this._documentCallbackNodes.push(a)},addDocumentCallbackName:function(a){this._documentCallbackNames.push(a)},
addDocumentCallbackControlEvents:function(a){this._documentCallbackControlEvents.push(a)},addDocumentOutletNode:function(a){this._documentOutletNodes.push(a)},addDocumentOutletName:function(a){this._documentOutletNames.push(a)},setDocumentControllerName:function(a){this._documentControllerName=a},getDocumentControllerName:function(){return this._documentControllerName},getDocumentCallbackNames:function(){return this._documentCallbackNames},getDocumentCallbackNodes:function(){return this._documentCallbackNodes},
getDocumentCallbackControlEvents:function(){return this._documentCallbackControlEvents},getDocumentOutletNames:function(){return this._documentOutletNames},getDocumentOutletNodes:function(){return this._documentOutletNodes},getLastCompletedSequenceName:function(){return this._lastCompletedSequenceName},getKeyframeCallbacks:function(){return this._keyframeCallbacks},getRootContainerSize:function(){return this._rootContainerSize},setRootContainerSize:function(a){this._rootContainerSize=cc.size(a.width,
a.height)},getDelegate:function(){return this._delegate},setDelegate:function(a){this._delegate=a},getRunningSequenceName:function(){return this._runningSequence?this._runningSequence.getName():null},getContainerSize:function(a){return a?a.getContentSize():this._rootContainerSize},addNode:function(a,c){this._nodeSequences.setObject(c,a)},setBaseValue:function(a,c,d){var e=this._baseValues.objectForKey(c);e||(e=new cc._Dictionary,this._baseValues.setObject(e,c));e.setObject(a,d)},moveAnimationsFromNode:function(a,
c){var d=this._baseValues,e=d.objectForKey(a);null!==e&&(d.setObject(e,c),d.removeObjectForKey(a));d=this._nodeSequences;e=d.objectForKey(a);null!=e&&(d.setObject(e,c),d.removeObjectForKey(a))},getActionForCallbackChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;f<e;++f){var h=a[f],k=h.getTime()-c,c=h.getTime();0<k&&d.push(cc.delayTime(k));k=h.getValue();h=k[0];k=k[1];if(this._jsControlled)h=this._keyframeCallFuncs[k+":"+h],null!=h&&d.push(h);else{var m;k===CCB_TARGETTYPE_DOCUMENTROOT?
m=this._rootNode:k===CCB_TARGETTYPE_OWNER&&(m=this._owner);null!=m&&(0<h.length?(k=0,null!=m.onResolveCCBCCCallFuncSelector&&(k=m.onResolveCCBCCCallFuncSelector(m,h)),0===k?cc.log("Skipping selector '"+h+"' since no CCBSelectorResolver is present."):d.push(cc.callFunc(k,m))):cc.log("Unexpected empty selector."))}}return 1>d.length?null:cc.sequence(d)},getActionForSoundChannel:function(a){var c=0,d=[];a=a.getKeyframes();for(var e=a.length,f=0;f<e;++f){var h=a[f],k=h.getTime()-c,c=h.getTime();0<k&&
d.push(cc.delayTime(k));var m=h.getValue(),h=cc.BuilderReader.getResourcePath()+m[0],k=parseFloat(m[1]),n=parseFloat(m[2]),m=parseFloat(m[3]);d.push(cc.BuilderSoundEffect.create(h,k,n,m))}return 1>d.length?null:cc.sequence(d)},runAnimationsForSequenceNamed:function(a){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),0)},runAnimationsForSequenceNamedTweenDuration:function(a,c){this.runAnimationsForSequenceIdTweenDuration(this._getSequenceId(a),c)},runAnimationsForSequenceIdTweenDuration:function(a,
c){if(-1===a)throw Error("cc.BuilderAnimationManager.runAnimationsForSequenceIdTweenDuration(): Sequence id should not be -1");c=c||0;this._rootNode.stopAllActions();for(var d=this._nodeSequences.allKeys(),e=0,f=d.length;e<f;e++){var h=d[e];h.stopAllActions();var k=this._nodeSequences.objectForKey(h).objectForKey(a),m,n=[];if(k){var p=k.allKeys();for(m=0;m<p.length;m++){var r=p[m],s=k.objectForKey(r);n.push(r);this._setFirstFrame(h,s,c);this._runAction(h,s,c)}}if(k=this._baseValues.objectForKey(h))for(p=
k.allKeys(),m=0;m<p.length;m++)r=p[m],-1===n.indexOf(r)&&(s=k.objectForKey(r),null!=s&&this._setAnimatedProperty(r,h,s,c))}d=this._getSequence(a);e=cc.sequence(cc.delayTime(d.getDuration()+c),cc.callFunc(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=cc.isString(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,h;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(a,c.getValue());if("color"===d)return d=c.getValue(),cc.tintTo(a,d.r,d.g,d.b);if("visible"===d)return c.getValue()?cc.sequence(cc.delayTime(a),cc.show()):cc.sequence(cc.delayTime(a),cc.hide());if("displayFrame"===d)return cc.sequence(cc.delayTime(a),cc.BuilderSetSpriteFrame.create(c.getValue()));if("position"===d)return f=this._getBaseValue(e,d),f=f[2],h=c.getValue(),c=h[0],h=h[1],e=this.getContainerSize(e.getParent()),
d=cc.getAbsolutePosition(c,h,f,e,d),cc.moveTo(a,d);if("scale"===d)return f=this._getBaseValue(e,d),f=f[2],h=c.getValue(),c=h[0],h=h[1],f===CCB_SCALETYPE_MULTIPLY_RESOLUTION&&(d=cc.BuilderReader.getResolutionScale(),c*=d,h*=d),cc.scaleTo(a,c,h);if("skew"===d)return h=c.getValue(),c=h[0],h=h[1],cc.skewTo(a,c,h);cc.log("BuilderReader: Failed to create animation for property: "+d);return null},_setAnimatedProperty:function(b,c,d,e){if(0<e){var f=new cc.BuilderKeyframe;f.setValue(d);f.setTime(e);f.setEasingType(CCB_KEYFRAME_EASING_LINEAR);
b=this._getAction(null,f,b,c);c.runAction(b)}else{if("position"===b)e=this._getBaseValue(c,b),e=e[2],f=d[0],d=d[1],cc.getAbsolutePosition(f,d,e,this.getContainerSize(c.getParent()),b,a),c._position.x=a.x,c._position.y=a.y;else if("scale"===b)e=this._getBaseValue(c,b),e=e[2],f=d[0],d=d[1],cc.setRelativeScale(c,f,d,e,b);else if("skew"===b)f=d[0],d=d[1],c._skewX=f,c._skewY=d;else if("rotation"===b)c.setRotation(d);else if("rotationX"===b)c._rotationX=d;else if("rotationY"===b)c._rotationY=d;else if("opacity"===
b)c._realOpacity=d;else if("displayFrame"===b)c.setSpriteFrame(d);else if("color"===b)255===d.r&&255===d.g&&255===d.b||c.setColor(d);else if("visible"===b)c.setVisible(d||!1);else{cc.log("unsupported property name is "+b);return}c.setNodeDirty()}},_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 a.easing(cc.easeIn(d));if(c===CCB_KEYFRAME_EASING_CUBIC_OUT)return a.easing(cc.easeOut(d));if(c===CCB_KEYFRAME_EASING_CUBIC_INOUT)return a.easing(cc.easeInOut(d));if(c===CCB_KEYFRAME_EASING_BACK_IN)return a.easing(cc.easeBackIn());if(c===CCB_KEYFRAME_EASING_BACK_OUT)return a.easing(cc.easeBackOut());if(c===CCB_KEYFRAME_EASING_BACK_INOUT)return a.easing(cc.easeBackInOut());
if(c===CCB_KEYFRAME_EASING_BOUNCE_IN)return a.easing(cc.easeBounceIn());if(c===CCB_KEYFRAME_EASING_BOUNCE_OUT)return a.easing(cc.easeBounceOut());if(c===CCB_KEYFRAME_EASING_BOUNCE_INOUT)return a.easing(cc.easeBounceInOut());if(c===CCB_KEYFRAME_EASING_ELASTIC_IN)return a.easing(cc.easeElasticIn(d));if(c===CCB_KEYFRAME_EASING_ELASTIC_OUT)return a.easing(cc.easeElasticOut(d));if(c===CCB_KEYFRAME_EASING_ELASTIC_INOUT)return a.easing(cc.easeElasticInOut(d));cc.log("BuilderReader: Unknown easing type "+
c);return a},_runAction:function(a,c,d){var e=c.getKeyframes(),f=e.length;if(1<f){var h=[];d=e[0].getTime()+d;0<d&&h.push(cc.delayTime(d));for(d=0;d<f-1;++d){var k=e[d],m=this._getAction(k,e[d+1],c.getName(),a);m&&(m=this._getEaseAction(m,k.getEasingType(),k.getEasingOpt()),h.push(m))}a.runAction(cc.sequence(h))}},_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.setSpriteFrame(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 Error("rotationX has not been implemented in cocos2d-html5");};cc.BuilderRotateYTo=cc.ActionInterval.extend({});cc.BuilderRotateYTo.create=function(a,c){throw Error("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.playEffect(this._file)}});cc.BuilderSoundEffect.create=function(a,c,d,e){return(c=new cc.BuilderSoundEffect)&&c.init(a)?c:null}})();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,b){},editBoxReturn:function(a){}});
cc.EditBox=cc.Node.extend({_backgroundSprite:null,_delegate:null,_editBoxInputMode:cc.EDITBOX_INPUT_MODE_ANY,_editBoxInputFlag:cc.EDITBOX_INPUT_FLAG_SENSITIVE,_keyboardReturnType:cc.KEYBOARD_RETURNTYPE_DEFAULT,_maxLength:50,_text:"",_textColor:null,_placeholderText:"",_placeholderFontName:"",_placeholderFontSize:14,_placeholderColor:null,_className:"EditBox",_touchListener:null,_touchEnabled:!0,ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._anchorPoint=cc.p(0.5,0.5);this._textColor=cc.color.WHITE;
this._placeholderColor=cc.color.GRAY;this._renderCmd._createLabels();this.createDomElementIfNeeded();this.initWithSizeAndBackgroundSprite(a,b);this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0,onTouchBegan:this._onTouchBegan.bind(this),onTouchEnded:this._onTouchEnded.bind(this)});cc.eventManager.addListener(this._touchListener,this);this.setInputFlag(this._editBoxInputFlag)},setTouchEnabled:function(a){this._touchEnabled!==a&&((this._touchEnabled=
a)?cc.eventManager.addListener(this._touchListener,this):cc.eventManager.removeListener(this._touchListener))},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.EditBox.CanvasRenderCmd(this):new cc.EditBox.WebGLRenderCmd(this)},setContentSize:function(a,b){void 0!==a.width&&void 0!==a.height&&(b=a.height,a=a.width);cc.Node.prototype.setContentSize.call(this,a,b);this._updateEditBoxSize(a,b)},setVisible:function(a){cc.Node.prototype.setVisible.call(this,a);this._renderCmd.updateVisibility()},
createDomElementIfNeeded:function(){this._renderCmd._edTxt||this._renderCmd._createDomTextArea()},setTabIndex:function(a){this._renderCmd._edTxt&&(this._renderCmd._edTxt.tabIndex=a)},getTabIndex:function(){if(this._renderCmd._edTxt)return this._renderCmd._edTxt.tabIndex;cc.warn("The dom control is not created!");return-1},setFocus:function(){this._renderCmd._edTxt&&this._renderCmd._edTxt.focus()},isFocused:function(){if(this._renderCmd._edTxt)return document.activeElement===this._renderCmd._edTxt;
cc.warn("The dom control is not created!");return!1},stayOnTop:function(a){this._alwaysOnTop!==a&&(this._alwaysOnTop=a,this._renderCmd.stayOnTop(this._alwaysOnTop))},cleanup:function(){this._super();this._renderCmd._removeDomFromGameContainer()},_isAncestorsVisible:function(a){return null==a?!0:(a=a.getParent())&&!a.isVisible()?!1:this._isAncestorsVisible(a)},_onTouchBegan:function(a){if(this.isVisible()&&this._isAncestorsVisible(this)){a=a.getLocation();var b=cc.rect(0,0,this._contentSize.width,
this._contentSize.height);if(cc.rectContainsPoint(b,this.convertToNodeSpace(a)))return!0;this._renderCmd._endEditing();return!1}},_onTouchEnded:function(){this.isVisible()&&this._isAncestorsVisible(this)&&this._renderCmd._beginEditing()},_updateBackgroundSpriteSize:function(a,b){this._backgroundSprite&&this._backgroundSprite.setContentSize(a,b)},_updateEditBoxSize:function(a,b){var c="number"===typeof a.width?a.width:a,d="number"===typeof a.height?a.height:b;this._updateBackgroundSpriteSize(c,d);
this._renderCmd.updateSize(c,d)},setLineHeight:function(a){this._renderCmd.setLineHeight(a)},setFont:function(a,b){this._renderCmd.setFont(a,b)},_setFont:function(a){this._renderCmd._setFont(a)},getBackgroundSprite:function(){return this._backgroundSprite},setFontName:function(a){this._renderCmd.setFontName(a)},setFontSize:function(a){this._renderCmd.setFontSize(a)},setString:function(a){a.length>=this._maxLength&&(a=a.slice(0,this._maxLength));this._text=a;this._renderCmd.setString(a)},setFontColor:function(a){this._textColor=
a;this._renderCmd.setFontColor(a)},setMaxLength:function(a){isNaN(a)||(0>a&&(a=65535),this._maxLength=a,this._renderCmd.setMaxLength(a))},getMaxLength:function(){return this._maxLength},setPlaceHolder:function(a){null!==a&&(this._renderCmd.setPlaceHolder(a),this._placeholderText=a)},setPlaceholderFont:function(a,b){this._placeholderFontName=a;this._placeholderFontSize=b;this._renderCmd._updateDOMPlaceholderFontStyle()},_setPlaceholderFont:function(a){if(a=cc.LabelTTF._fontStyleRE.exec(a))this._placeholderFontName=
a[2],this._placeholderFontSize=parseInt(a[1]),this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontName:function(a){this._placeholderFontName=a;this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontSize:function(a){this._placeholderFontSize=a;this._renderCmd._updateDOMPlaceholderFontStyle()},setPlaceholderFontColor:function(a){this._placeholderColor=a;this._renderCmd.setPlaceholderFontColor(a)},setInputFlag:function(a){this._editBoxInputFlag=a;this._renderCmd.setInputFlag(a)},
getString:function(){return this._text},initWithSizeAndBackgroundSprite:function(a,b){this._backgroundSprite&&this._backgroundSprite.removeFromParent();this._backgroundSprite=b;this.setContentSize(a);this._backgroundSprite&&!this._backgroundSprite.parent&&(this._backgroundSprite.setAnchorPoint(cc.p(0,0)),this.addChild(this._backgroundSprite),this._updateBackgroundSpriteSize(a.width,a.height));this.y=this.x=0;return!0},setDelegate:function(a){this._delegate=a},getPlaceHolder:function(){return this._placeholderText},
setInputMode:function(a){if(this._editBoxInputMode!==a){var b=this.getString();this._editBoxInputMode=a;this._renderCmd.setInputMode(a);this._renderCmd.transform();this.setString(b);this._renderCmd._updateLabelPosition(this.getContentSize())}},setReturnType:function(a){this._keyboardReturnType=a;this._renderCmd._updateDomInputType()},initWithBackgroundColor:function(a,b){this._edWidth=a.width;this.dom.style.width=this._edWidth.toString()+"px";this._edHeight=a.height;this.dom.style.height=this._edHeight.toString()+
"px";this.dom.style.backgroundColor=cc.colorToHex(b)}});_p=cc.EditBox.prototype;cc.defineGetterSetter(_p,"font",null,_p._setFont);cc.defineGetterSetter(_p,"fontName",null,_p.setFontName);cc.defineGetterSetter(_p,"fontSize",null,_p.setFontSize);cc.defineGetterSetter(_p,"fontColor",null,_p.setFontColor);cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"maxLength",_p.getMaxLength,_p.setMaxLength);cc.defineGetterSetter(_p,"placeholder",_p.getPlaceHolder,_p.setPlaceHolder);
cc.defineGetterSetter(_p,"placeholderFont",null,_p._setPlaceholderFont);cc.defineGetterSetter(_p,"placeholderFontName",null,_p.setPlaceholderFontName);cc.defineGetterSetter(_p,"placeholderFontSize",null,_p.setPlaceholderFontSize);cc.defineGetterSetter(_p,"placeholderFontColor",null,_p.setPlaceholderFontColor);cc.defineGetterSetter(_p,"inputFlag",null,_p.setInputFlag);cc.defineGetterSetter(_p,"delegate",null,_p.setDelegate);cc.defineGetterSetter(_p,"inputMode",null,_p.setInputMode);
cc.defineGetterSetter(_p,"returnType",null,_p.setReturnType);_p=null;cc.EditBox.create=function(a,b,c,d){return new cc.EditBox(a,b,c,d)};(function(a){a._polyfill={zoomInvalid:!1};cc.sys.OS_ANDROID!==cc.sys.os||cc.sys.browserType!==cc.sys.BROWSER_TYPE_SOUGOU&&cc.sys.browserType!==cc.sys.BROWSER_TYPE_360||(a._polyfill.zoomInvalid=!0)})(cc.EditBox);
(function(a){function b(a){var b=a.convertToWorldSpace(cc.p(0,0)),e=cc.visibleRect.height,f=0.5;cc.visibleRect.width>e&&(f=0.7);setTimeout(function(){if(window.scrollY<c&&b.y<e*f){var a=e*f-b.y-window.scrollY;35>a&&(a=35);320<a&&(a=320);window.scrollTo(a,a)}},d)}var c=40,d=400,e=function(a){return a.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()})},f=function(){}.prototype=Object.create(Object.prototype);f.updateMatrix=function(){if(this._edTxt){var b=this._node,c=cc.view._scaleX,d=cc.view._scaleY,
e=cc.view._devicePixelRatio,f=this._worldTransform,c=c/e,d=d/e,h=cc.game.container,e=f.a*c,t=f.b,w=f.c,v=f.d*d,y=h&&h.style.paddingLeft&&parseInt(h.style.paddingLeft),h=h&&h.style.paddingBottom&&parseInt(h.style.paddingBottom),c=f.tx*c+y,d=f.ty*d+h;a.zoomInvalid&&(this.updateSize(b._contentSize.width*e,b._contentSize.height*v),v=e=1);b="matrix("+e+","+-t+","+-w+","+v+","+c+","+-d+")";this._edTxt.style.transform=b;this._edTxt.style["-webkit-transform"]=b;this._edTxt.style["transform-origin"]="0px 100% 0px";
this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}};f.updateVisibility=function(){this._edTxt&&(this._edTxt.style.visibility=this._node.visible?"visible":"hidden")};f.stayOnTop=function(a){a?(this._removeLabels(),this._edTxt.style.display=""):(this._createLabels(),this._edTxt.style.display="none",this._showLabels())};f._beginEditingOnMobile=function(a){this.__orientationChanged=function(){b(a)};window.addEventListener("orientationchange",this.__orientationChanged);cc.view.isAutoFullScreenEnabled()?
(this.__fullscreen=!0,cc.view.enableAutoFullScreen(!1),cc.screen.exitFullScreen()):this.__fullscreen=!1;this.__autoResize=cc.view.__resizeWithBrowserSize;cc.view.resizeWithBrowserSize(!1)};f._endEditingOnMobile=function(){if(this.__rotateScreen){var a=cc.game.container.style;a["-webkit-transform"]="rotate(90deg)";a.transform="rotate(90deg)";var a=cc.view,b=a._originalDesignResolutionSize.width,c=a._originalDesignResolutionSize.height;0<b&&a.setDesignResolutionSize(b,c,a._resolutionPolicy);this.__rotateScreen=
!1}window.removeEventListener("orientationchange",this.__orientationChanged);window.scrollTo(0,0);this.__fullscreen&&cc.view.enableAutoFullScreen(!0);this.__autoResize&&cc.view.resizeWithBrowserSize(!0)};f._onFocusOnMobile=function(a){if(cc.view._isRotated){var c=cc.game.container.style;c["-webkit-transform"]="rotate(0deg)";c.transform="rotate(0deg)";c.margin="0px";window.scrollTo(35,35);this.__rotateScreen=!0}else this.__rotateScreen=!1;b(a)};f._createDomInput=function(){this._removeDomFromGameContainer();
var a=this,b=this._edTxt=document.createElement("input");b.type="text";b.style.fontFamily=this._edFontName;b.style.fontSize=this._edFontSize+"px";b.style.color="#000000";b.style.border=0;b.style.background="transparent";b.style.width="100%";b.style.height="100%";b.style.active=0;b.style.outline="medium";b.style.padding="0";b.style.textTransform="uppercase";b.style.display="none";b.style.position="absolute";b.style.bottom="0px";b.style.left="2px";b.style.className="cocosEditBox";this.setMaxLength(a._editBox._maxLength);
b.addEventListener("input",function(){var b=a._editBox;this.value.length>this.maxLength&&(this.value=this.value.slice(0,this.maxLength));b._delegate&&b._delegate.editBoxTextChanged&&b._text!==this.value&&(b._text=this.value,a._updateDomTextCases(),b._delegate.editBoxTextChanged(b,b._text))});b.addEventListener("keypress",function(b){var c=a._editBox;b.keyCode===cc.KEY.enter&&(b.stopPropagation(),b.preventDefault(),""===this.value&&(this.style.fontSize=c._placeholderFontSize+"px",this.style.color=
cc.colorToHex(c._placeholderColor)),c._text=this.value,a._updateDomTextCases(),a._endEditing(),c._delegate&&c._delegate.editBoxReturn&&c._delegate.editBoxReturn(c),cc._canvas.focus())});b.addEventListener("focus",function(){var b=a._editBox;this.style.fontSize=a._edFontSize+"px";this.style.color=cc.colorToHex(b._textColor);a._hiddenLabels();cc.sys.isMobile&&a._onFocusOnMobile(b);b._delegate&&b._delegate.editBoxEditingDidBegin&&b._delegate.editBoxEditingDidBegin(b)});b.addEventListener("blur",function(){var b=
a._editBox;b._text=this.value;a._updateDomTextCases();b._delegate&&b._delegate.editBoxEditingDidEnd&&b._delegate.editBoxEditingDidEnd(b);""===this.value&&(this.style.fontSize=b._placeholderFontSize+"px",this.style.color=cc.colorToHex(b._placeholderColor));a._endEditing()});this._addDomToGameContainer();return b};f._createDomTextArea=function(){this._removeDomFromGameContainer();var a=this,b=this._edTxt=document.createElement("textarea");b.type="text";b.style.fontFamily=this._edFontName;b.style.fontSize=
this._edFontSize+"px";b.style.color="#000000";b.style.border=0;b.style.background="transparent";b.style.width="100%";b.style.height="100%";b.style.active=0;b.style.outline="medium";b.style.padding="0";b.style.resize="none";b.style.textTransform="uppercase";b.style.overflow_y="scroll";b.style.display="none";b.style.position="absolute";b.style.bottom="0px";b.style.left="2px";b.style.className="cocosEditBox";this.setMaxLength(a._editBox._maxLength);b.addEventListener("input",function(){this.value.length>
this.maxLength&&(this.value=this.value.slice(0,this.maxLength));var b=a._editBox;b._delegate&&b._delegate.editBoxTextChanged&&b._text.toLowerCase()!==this.value.toLowerCase()&&(b._text=this.value,a._updateDomTextCases(),b._delegate.editBoxTextChanged(b,b._text))});b.addEventListener("focus",function(){var b=a._editBox;a._hiddenLabels();this.style.fontSize=a._edFontSize+"px";this.style.color=cc.colorToHex(b._textColor);cc.sys.isMobile&&a._onFocusOnMobile(b);b._delegate&&b._delegate.editBoxEditingDidBegin&&
b._delegate.editBoxEditingDidBegin(b)});b.addEventListener("keypress",function(b){var c=a._editBox;b.keyCode===cc.KEY.enter&&(b.stopPropagation(),c._delegate&&c._delegate.editBoxReturn&&c._delegate.editBoxReturn(c))});b.addEventListener("blur",function(){var b=a._editBox;b._text=this.value;a._updateDomTextCases();b._delegate&&b._delegate.editBoxEditingDidEnd&&b._delegate.editBoxEditingDidEnd(b);""===this.value&&(this.style.fontSize=b._placeholderFontSize+"px",this.style.color=cc.colorToHex(b._placeholderColor));
a._endEditing()});this._addDomToGameContainer();return b};f._createLabels=function(){var a=this._editBox.getContentSize();this._textLabel||(this._textLabel=new cc.LabelTTF,this._textLabel.setAnchorPoint(cc.p(0,1)),this._editBox.addChild(this._textLabel,100));this._placeholderLabel||(this._placeholderLabel=new cc.LabelTTF,this._placeholderLabel.setAnchorPoint(cc.p(0,1)),this._placeholderLabel.setColor(cc.color.GRAY),this._editBox.addChild(this._placeholderLabel,100));this._updateLabelPosition(a)};
f._removeLabels=function(){this._textLabel&&(this._editBox.removeChild(this._textLabel),this._textLabel=null)};f._updateLabelPosition=function(a){if(this._textLabel&&this._placeholderLabel){var b=cc.size(a.width-2,a.height);this._textLabel.setContentSize(b);this._textLabel.setDimensions(b);this._placeholderLabel.setLineHeight(a.height);b=this._placeholderLabel.getContentSize();this._editBox._editBoxInputMode===cc.EDITBOX_INPUT_MODE_ANY?(this._textLabel.setPosition(2,a.height),this._placeholderLabel.setPosition(2,
a.height),this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP),this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_TOP)):(this._textLabel.setPosition(2,a.height),this._placeholderLabel.setPosition(2,(a.height+b.height)/2),this._placeholderLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),this._textLabel.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER))}};f.setLineHeight=function(a){this._textLabel&&this._textLabel.setLineHeight(a)};f._hiddenLabels=
function(){this._textLabel&&this._textLabel.setVisible(!1);this._placeholderLabel&&this._placeholderLabel.setVisible(!1)};f._updateDomTextCases=function(){var a=this._editBox._editBoxInputFlag;if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS)this._editBox._text=this._editBox._text.toUpperCase();else if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD)this._editBox._text=e(this._editBox._text);else if(a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE){var a=this._editBox,b;b=this._editBox._text;b=
b.charAt(0).toUpperCase()+b.slice(1);a._text=b}};f._updateLabelStringStyle=function(){if("password"===this._edTxt.type){for(var a="",b=this._editBox._text.length,c=0;c<b;++c)a+="\u25cf";this._textLabel&&this._textLabel.setString(a)}else this._updateDomTextCases(),this._textLabel&&this._textLabel.setString(this._editBox._text)};f._showLabels=function(){this._hiddenLabels();""===this._edTxt.value?this._placeholderLabel&&(this._placeholderLabel.setVisible(!0),this._placeholderLabel.setString(this._editBox._placeholderText)):
this._textLabel&&(this._textLabel.setVisible(!0),this._textLabel.setString(this._editBox._text));this._updateLabelStringStyle()};f._beginEditing=function(){this._editBox._alwaysOnTop||"none"!==this._edTxt.style.display||(this._edTxt.style.display="",this._edTxt.focus());cc.sys.isMobile&&!this._editingMode&&this._beginEditingOnMobile(this._editBox);this._editingMode=!0};f._endEditing=function(){this._editBox._alwaysOnTop||(this._edTxt.style.display="none");this._showLabels();if(cc.sys.isMobile&&this._editingMode){var a=
this;setTimeout(function(){a._endEditingOnMobile()},d)}this._editingMode=!1};f._setFont=function(a){a=cc.LabelTTF._fontStyleRE.exec(a);var b=a[2],c=parseInt(a[1]);a&&this.setFont(b,c)};f.setFont=function(a,b){this._edFontName=a||this._edFontName;this._edFontSize=b||this._edFontSize;this._updateDOMFontStyle()};f.setFontName=function(a){this._edFontName=a||this._edFontName;this._updateDOMFontStyle()};f.setFontSize=function(a){this._edFontSize=a||this._edFontSize;this._updateDOMFontStyle()};f.setFontColor=
function(a){this._edTxt&&(this._edTxt.value!==this._editBox._placeholderText&&(this._edTxt.style.color=cc.colorToHex(a)),this._textLabel&&this._textLabel.setColor(a))};f.setPlaceHolder=function(a){this._placeholderLabel.setString(a)};f.setMaxLength=function(a){this._edTxt&&(this._edTxt.maxLength=a)};f._updateDOMPlaceholderFontStyle=function(){this._placeholderLabel.setFontName(this._editBox._placeholderFontName);this._placeholderLabel.setFontSize(this._editBox._placeholderFontSize)};f.setPlaceholderFontColor=
function(a){this._placeholderLabel.setColor(a)};f._updateDomInputType=function(){var a=this._editBox._editBoxInputMode;a===cc.EDITBOX_INPUT_MODE_EMAILADDR?this._edTxt.type="email":a===cc.EDITBOX_INPUT_MODE_DECIMAL||a===cc.EDITBOX_INPUT_MODE_NUMERIC?this._edTxt.type="number":a===cc.EDITBOX_INPUT_MODE_PHONENUMBER?(this._edTxt.type="number",this._edTxt.pattern="[0-9]*"):a===cc.EDITBOX_INPUT_MODE_URL?this._edTxt.type="url":(this._edTxt.type="text",this._editBox._keyboardReturnType===cc.KEYBOARD_RETURNTYPE_SEARCH&&
(this._edTxt.type="search"));this._editBox._editBoxInputFlag===cc.EDITBOX_INPUT_FLAG_PASSWORD&&(this._edTxt.type="password")};f.setInputFlag=function(a){this._edTxt&&(this._updateDomInputType(),this._edTxt.style.textTransform="none",a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS?this._edTxt.style.textTransform="uppercase":a===cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD&&(this._edTxt.style.textTransform="capitalize"),this._updateLabelStringStyle())};f.setInputMode=function(a){a===cc.EDITBOX_INPUT_MODE_ANY?
this._createDomTextArea():this._createDomInput();this._updateDomInputType();a=this._node.getContentSize();this.updateSize(a.width,a.height)};f.setString=function(a){this._edTxt&&null!==a&&(this._edTxt.value=a,""===a?(this._placeholderLabel&&(this._placeholderLabel.setString(this._editBox._placeholderText),this._placeholderLabel.setColor(this._editBox._placeholderColor)),this._editingMode||(this._placeholderLabel&&this._placeholderLabel.setVisible(!0),this._textLabel&&this._textLabel.setVisible(!1))):
(this._edTxt.style.color=cc.colorToHex(this._editBox._textColor),this._textLabel&&this._textLabel.setColor(this._editBox._textColor),this._editingMode||(this._placeholderLabel&&this._placeholderLabel.setVisible(!1),this._textLabel&&this._textLabel.setVisible(!0)),this._updateLabelStringStyle()))};f._updateDOMFontStyle=function(){this._edTxt&&(""!==this._edTxt.value&&(this._edTxt.style.fontFamily=this._edFontName,this._edTxt.style.fontSize=this._edFontSize+"px"),this._textLabel&&(this._textLabel.setFontSize(this._edFontSize),
this._textLabel.setFontName(this._edFontName)))};f.updateSize=function(a,b){var c=this._edTxt;c&&(c.style.width=a+"px",c.style.height=b+"px",this._updateLabelPosition(cc.size(a,b)))};f._addDomToGameContainer=function(){cc.game.container.appendChild(this._edTxt)};f._removeDomFromGameContainer=function(){var a=this._edTxt;if(a){var b=!1;(b="contains"in cc.game.container?cc.game.container.contains(a):cc.game.container.compareDocumentPosition(a)%16)&&cc.game.container.removeChild(a)}this._edTxt=null};
f.initializeRenderCmd=function(a){this._editBox=a;this._edFontSize=14;this._edFontName="Arial";this._placeholderLabel=this._textLabel=null;this.__rotateScreen=this.__autoResize=this.__fullscreen=this._editingMode=!1;this.__orientationChanged=null};cc.EditBox.CanvasRenderCmd=function(a){this._rootCtor(a);this.initializeRenderCmd(a)};var h=cc.EditBox.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.inject(f,h);h.constructor=cc.EditBox.CanvasRenderCmd;h.transform=function(a,
b){this.originTransform(a,b);this.updateMatrix()};cc.EditBox.WebGLRenderCmd=function(a){this._rootCtor(a);this.initializeRenderCmd(a)};h=cc.EditBox.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(f,h);h.constructor=cc.EditBox.WebGLRenderCmd;h.transform=function(a,b){this.originTransform(a,b);this.updateMatrix()}})(cc.EditBox._polyfill);cc.ProtectedNode=cc.Node.extend({_protectedChildren:null,_reorderProtectedChildDirty:!1,_insertProtectedChild:function(a,b){this._reorderProtectedChildDirty=!0;this._protectedChildren.push(a);a._setLocalZOrder(b)},ctor:function(){cc.Node.prototype.ctor.call(this);this._protectedChildren=[]},visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){a=cc.renderer;var d=this._children,e=d.length,f,h=this._protectedChildren,k=h.length,m;b.visit(c);var n=this.grid;n&&n._active&&n.beforeDraw();
this._reorderChildDirty&&this.sortAllChildren();this._reorderProtectedChildDirty&&this.sortAllProtectedChildren();for(c=0;c<e;c++)if(f=d[c],0>f._localZOrder)f.visit(this);else break;for(f=0;f<k;f++)if((m=h[f])&&0>m._localZOrder)b._changeProtectedChild(m),m.visit(this);else break;for(a.pushRenderCommand(b);c<e;c++)d[c].visit(this);for(;f<k;f++)if(m=h[f])b._changeProtectedChild(m),m.visit(this);n&&n._active&&n.afterDraw(this);b._dirtyFlag=0}else b._propagateFlagsDown(c)},addProtectedChild:function(a,
b,c){cc.assert(null!=a,"child must be non-nil");cc.assert(!a.parent,"child already added. It can't be added again");b=b||a.getLocalZOrder();c&&a.setTag(c);this._insertProtectedChild(a,b);a.setParent(this);a.setOrderOfArrival(cc.s_globalOrderOfArrival);this._running&&(a._performRecursive(cc.Node._stateCallbackType.onEnter),this._isTransitionFinished&&a._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish));this._cascadeColorEnabled&&this._renderCmd.setCascadeColorEnabledDirty();
this._cascadeOpacityEnabled&&this._renderCmd.setCascadeOpacityEnabledDirty()},getProtectedChildByTag:function(a){cc.assert(a!==cc.NODE_TAG_INVALID,"Invalid tag");for(var b=this._protectedChildren,c=0,d=b.length;c<d;c++)if(b.getTag()===a)return b[c];return null},removeProtectedChild:function(a,b){null==b&&(b=!0);var c=this._protectedChildren;if(0!==c.length){var d=c.indexOf(a);-1<d&&(this._running&&(a._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),a._performRecursive(cc.Node._stateCallbackType.onExit)),
b&&a._performRecursive(cc.Node._stateCallbackType.cleanup),a.setParent(null),c.splice(d,1))}},removeProtectedChildByTag:function(a,b){cc.assert(a!==cc.NODE_TAG_INVALID,"Invalid tag");null==b&&(b=!0);var c=this.getProtectedChildByTag(a);null==c?cc.log("cocos2d: removeChildByTag(tag \x3d %d): child not found!",a):this.removeProtectedChild(c,b)},removeAllProtectedChildren:function(){this.removeAllProtectedChildrenWithCleanup(!0)},removeAllProtectedChildrenWithCleanup:function(a){null==a&&(a=!0);for(var b=
this._protectedChildren,c=0,d=b.length;c<d;c++){var e=b[c];this._running&&(e._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),e._performRecursive(cc.Node._stateCallbackType.onExit));a&&e._performRecursive(cc.Node._stateCallbackType.cleanup);e.setParent(null)}b.length=0},reorderProtectedChild:function(a,b){cc.assert(null!=a,"Child must be non-nil");this._reorderProtectedChildDirty=!0;a.setOrderOfArrival(cc.s_globalOrderOfArrival++);a._setLocalZOrder(b)},sortAllProtectedChildren:function(){if(this._reorderProtectedChildDirty){var a=
this._protectedChildren,b,c,d=a.length,e;for(b=1;b<d;b++){e=a[b];for(c=b-1;0<=c;){if(e._localZOrder<a[c]._localZOrder)a[c+1]=a[c];else if(e._localZOrder===a[c]._localZOrder&&e.arrivalOrder<a[c].arrivalOrder)a[c+1]=a[c];else break;c--}a[c+1]=e}this._reorderProtectedChildDirty=!1}},_changePosition:function(){},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ProtectedNode.CanvasRenderCmd(this):new cc.ProtectedNode.WebGLRenderCmd(this)}});
cc.ProtectedNode.create=function(){return new cc.ProtectedNode};(function(){cc.ProtectedNode.RenderCmd={_updateDisplayColor:function(a){var c=this._node,d=this._displayedColor,e=c._realColor,f,h;if(this._cascadeColorEnabledDirty&&!c._cascadeColorEnabled){d.r=e.r;d.g=e.g;d.b=e.b;d=new cc.Color(255,255,255,255);f=c._children;e=0;for(a=f.length;e<a;e++)(h=f[e])&&h._renderCmd&&h._renderCmd._updateDisplayColor(d);this._cascadeColorEnabledDirty=!1}else{void 0===a&&(a=(a=c._parent)&&a._cascadeColorEnabled?a.getDisplayedColor():cc.color.WHITE);d.r=0|e.r*a.r/255;d.g=0|
e.g*a.g/255;d.b=0|e.b*a.b/255;if(c._cascadeColorEnabled)for(f=c._children,e=0,a=f.length;e<a;e++)(h=f[e])&&h._renderCmd&&(h._renderCmd._updateDisplayColor(d),h._renderCmd._updateColor());f=c._protectedChildren;e=0;for(a=f.length;e<a;e++)(h=f[e])&&h._renderCmd&&(h._renderCmd._updateDisplayColor(d),h._renderCmd._updateColor())}this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.colorDirty},_updateDisplayOpacity:function(a){var c=this._node,d,e,f;if(this._cascadeOpacityEnabledDirty&&!c._cascadeOpacityEnabled){this._displayedOpacity=
c._realOpacity;e=c._children;a=0;for(d=e.length;a<d;a++)(f=e[a])&&f._renderCmd&&f._renderCmd._updateDisplayOpacity(255);this._cascadeOpacityEnabledDirty=!1}else{void 0===a&&(d=c._parent,a=255,d&&d._cascadeOpacityEnabled&&(a=d.getDisplayedOpacity()));this._displayedOpacity=c._realOpacity*a/255;if(c._cascadeOpacityEnabled)for(e=c._children,a=0,d=e.length;a<d;a++)(f=e[a])&&f._renderCmd&&(f._renderCmd._updateDisplayOpacity(this._displayedOpacity),f._renderCmd._updateColor());e=c._protectedChildren;a=
0;for(d=e.length;a<d;a++)(f=e[a])&&f._renderCmd&&(f._renderCmd._updateDisplayOpacity(this._displayedOpacity),f._renderCmd._updateColor())}this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.opacityDirty},_changeProtectedChild:function(a){a=a._renderCmd;var c=a._dirtyFlag,d=cc.Node._dirtyFlags;this._dirtyFlag&d.colorDirty&&(c|=d.colorDirty);this._dirtyFlag&d.opacityDirty&&(c|=d.opacityDirty);var e=c&d.colorDirty,c=c&d.opacityDirty;e&&a._updateDisplayColor(this._displayedColor);c&&a._updateDisplayOpacity(this._displayedOpacity);
(e||c)&&a._updateColor()}};cc.ProtectedNode.CanvasRenderCmd=function(a){this._rootCtor(a);this._cachedParent=null;this._cacheDirty=!1};var a=cc.ProtectedNode.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.inject(cc.ProtectedNode.RenderCmd,a);a.constructor=cc.ProtectedNode.CanvasRenderCmd;a._pNodeCmdCtor=cc.ProtectedNode.CanvasRenderCmd;a.transform=function(a,c){var d=this._node;d._changePosition&&d._changePosition();this.originTransform(a,c);var e,f=d._protectedChildren;
if(c&&f&&0!==f.length)for(d=0,e=f.length;d<e;d++)f[d]._renderCmd.transform(this,c)};a.pNodeTransform=a.transform})();(function(){if(cc.Node.WebGLRenderCmd){cc.ProtectedNode.WebGLRenderCmd=function(a){this._rootCtor(a)};var a=cc.ProtectedNode.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(cc.ProtectedNode.RenderCmd,a);a.constructor=cc.ProtectedNode.WebGLRenderCmd;a._pNodeCmdCtor=cc.ProtectedNode.WebGLRenderCmd;a.transform=function(a,c){this.originTransform(a,c);var d,e,f=this._node._protectedChildren;if(c&&f&&0!==f.length)for(d=0,e=f.length;d<e;d++)f[d]._renderCmd.transform(this,
c)};a.pNodeTransform=a.transform}})();var ccui=ccui||{};ccui.Class=ccui.Class||cc.Class;ccui.Class.extend=ccui.Class.extend||cc.Class.extend;ccui.Node=ccui.Node||cc.Node;ccui.Node.extend=ccui.Node.extend||cc.Node.extend;ccui.ProtectedNode=ccui.ProtectedNode||cc.ProtectedNode;ccui.ProtectedNode.extend=ccui.ProtectedNode.extend||cc.ProtectedNode.extend;ccui.cocosGUIVersion="CocosGUI v1.0.0.0";ccui._FocusNavigationController=cc.Class.extend({_keyboardListener:null,_firstFocusedWidget:null,_enableFocusNavigation:!1,_keyboardEventPriority:1,enableFocusNavigation:function(a){this._enableFocusNavigation!==a&&((this._enableFocusNavigation=a)?this._addKeyboardEventListener():this._removeKeyboardEventListener())},_setFirstFocsuedWidget:function(a){this._firstFocusedWidget=a},_onKeyPressed:function(a,b){this._enableFocusNavigation&&this._firstFocusedWidget&&(a===cc.KEY.dpadDown&&(this._firstFocusedWidget=
this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.DOWN,this._firstFocusedWidget)),a===cc.KEY.dpadUp&&(this._firstFocusedWidget=this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.UP,this._firstFocusedWidget)),a===cc.KEY.dpadLeft&&(this._firstFocusedWidget=this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.LEFT,this._firstFocusedWidget)),a===cc.KEY.dpadRight&&(this._firstFocusedWidget=this._firstFocusedWidget.findNextFocusedWidget(ccui.Widget.RIGHT,this._firstFocusedWidget)))},
_addKeyboardEventListener:function(){this._keyboardListener||(this._keyboardListener=cc.EventListener.create({event:cc.EventListener.KEYBOARD,onKeyReleased:this._onKeyPressed.bind(this)}),cc.eventManager.addListener(this._keyboardListener,this._keyboardEventPriority))},_removeKeyboardEventListener:function(){this._keyboardListener&&(cc.eventManager.removeEventListener(this._keyboardListener),this._keyboardListener=null)}});ccui.__LAYOUT_COMPONENT_NAME="__ui_layout";
ccui.Widget=ccui.ProtectedNode.extend({_enabled:!0,_bright:!0,_touchEnabled:!1,_brightStyle:null,_touchBeganPosition:null,_touchMovePosition:null,_touchEndPosition:null,_touchEventListener:null,_touchEventSelector:null,_name:"default",_widgetType:null,_actionTag:0,_customSize:null,_layoutParameterDictionary:null,_layoutParameterType:0,_focused:!1,_focusEnabled:!0,_ignoreSize:!1,_affectByClipping:!1,_sizeType:null,_sizePercent:null,_positionType:null,_positionPercent:null,_hit:!1,_nodes:null,_touchListener:null,
_className:"Widget",_flippedX:!1,_flippedY:!1,_opacity:255,_highlight:!1,_touchEventCallback:null,_clickEventListener:null,_propagateTouchEvents:!0,_unifySize:!1,_callbackName:null,_callbackType:null,_usingLayoutComponent:!1,_inViewRect:!0,ctor:function(){cc.ProtectedNode.prototype.ctor.call(this);this._brightStyle=ccui.Widget.BRIGHT_STYLE_NONE;this._touchBeganPosition=cc.p(0,0);this._touchMovePosition=cc.p(0,0);this._touchEndPosition=cc.p(0,0);this._widgetType=ccui.Widget.TYPE_WIDGET;this._customSize=
cc.size(0,0);this._layoutParameterDictionary={};this._sizeType=ccui.Widget.SIZE_ABSOLUTE;this._sizePercent=cc.p(0,0);this._positionType=ccui.Widget.POSITION_ABSOLUTE;this._positionPercent=cc.p(0,0);this._nodes=[];this._layoutParameterType=ccui.LayoutParameter.NONE;ccui.Widget.prototype.init.call(this)},init:function(){this._layoutParameterDictionary={};this._initRenderer();this.setBright(!0);this.onFocusChanged=this.onFocusChange;this.onNextFocusedWidget=null;this.setAnchorPoint(cc.p(0.5,0.5));this.ignoreContentAdaptWithSize(!0);
return!0},onEnter:function(){var a=this._touchListener;a&&!a._isRegistered()&&this._touchEnabled&&cc.eventManager.addListener(a,this);this._usingLayoutComponent||this.updateSizeAndPosition();this._sizeDirty&&this._onSizeChanged();cc.ProtectedNode.prototype.onEnter.call(this)},onExit:function(){this.unscheduleUpdate();cc.ProtectedNode.prototype.onExit.call(this)},_getOrCreateLayoutComponent:function(){var a=this.getComponent(ccui.__LAYOUT_COMPONENT_NAME);null==a&&(a=new ccui.LayoutComponent,this.addComponent(a));
return a},getWidgetParent:function(){var a=this.getParent();return a instanceof ccui.Widget?a:null},_updateContentSizeWithTextureSize:function(a){this._unifySize?this.setContentSize(a):this.setContentSize(this._ignoreSize?a:this._customSize)},_isAncestorsEnabled:function(){var a=this._getAncensterWidget(this);return null==a?!0:a&&!a.isEnabled()?!1:a._isAncestorsEnabled()},setPropagateTouchEvents:function(a){this._propagateTouchEvents=a},isPropagateTouchEvents:function(){return this._propagateTouchEvents},
setSwallowTouches:function(a){this._touchListener&&this._touchListener.setSwallowTouches(a)},isSwallowTouches:function(){return this._touchListener?this._touchListener.isSwallowTouches():!1},_getAncensterWidget:function(a){if(null==a)return null;a=a.getParent();return null==a?null:a instanceof ccui.Widget?a:this._getAncensterWidget(a.getParent())},_isAncestorsVisible:function(a){return null==a?!0:(a=a.getParent())&&!a.isVisible()?!1:this._isAncestorsVisible(a)},setEnabled:function(a){this._enabled=
a;this.setBright(a)},_initRenderer:function(){},setContentSize:function(a,b){cc.Node.prototype.setContentSize.call(this,a,b);var c=this._contentSize.width,d=this._contentSize.height;this._customSize.width=c;this._customSize.height=d;!this._unifySize&&this._ignoreSize&&(this._contentSize=this.getVirtualRendererSize());if(!this._usingLayoutComponent&&this._running){var e=this.getWidgetParent(),e=e?e.getContentSize():this._parent.getContentSize();this._sizePercent.x=0<e.width?c/e.width:0;this._sizePercent.y=
0<e.height?d/e.height:0}this._running?this._onSizeChanged():this._sizeDirty=!0},_setWidth:function(a){a!==this._contentSize.width&&(cc.Node.prototype._setWidth.call(this,a),this._customSize.width=a,!this._unifySize&&this._ignoreSize&&(this._contentSize=this.getVirtualRendererSize()),!this._usingLayoutComponent&&this._running&&(a=(a=this.getWidgetParent())?a.width:this._parent.width,this._sizePercent.x=0<a?this._customSize.width/a:0),this._running?this._onSizeChanged():this._sizeDirty=!0)},_setHeight:function(a){a!==
this._contentSize.height&&(cc.Node.prototype._setHeight.call(this,a),this._customSize.height=a,!this._unifySize&&this._ignoreSize&&(this._contentSize=this.getVirtualRendererSize()),!this._usingLayoutComponent&&this._running&&(a=(a=this.getWidgetParent())?a.height:this._parent.height,this._sizePercent.y=0<a?this._customSize.height/a:0),this._running?this._onSizeChanged():this._sizeDirty=!0)},setSizePercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setUsingPercentContentSize(!0);
b.setPercentContentSize(a);b.refreshLayout()}else{this._sizePercent.x=a.x;this._sizePercent.y=a.y;var b=this._customSize.width,c=this._customSize.height;this._running&&((c=this.getWidgetParent())?(b=c.width*a.x,c=c.height*a.y):(b=this._parent.width*a.x,c=this._parent.height*a.y));this._ignoreSize?this.setContentSize(this.getVirtualRendererSize()):this.setContentSize(b,c);this._customSize.width=b;this._customSize.height=c}},_setWidthPercent:function(a){this._sizePercent.x=a;var b=this._customSize.width;
this._running&&(b=this.getWidgetParent(),b=(b?b.width:this._parent.width)*a);this._ignoreSize?this._setWidth(this.getVirtualRendererSize().width):this._setWidth(b);this._customSize.width=b},_setHeightPercent:function(a){this._sizePercent.y=a;var b=this._customSize.height;this._running&&(b=this.getWidgetParent(),b=(b?b.height:this._parent.height)*a);this._ignoreSize?this._setHeight(this.getVirtualRendererSize().height):this._setHeight(b);this._customSize.height=b},updateSizeAndPosition:function(a){a||
(a=(a=this.getWidgetParent())?a.getLayoutSize():this._parent.getContentSize());switch(this._sizeType){case ccui.Widget.SIZE_ABSOLUTE:this._ignoreSize?this.setContentSize(this.getVirtualRendererSize()):this.setContentSize(this._customSize);this._sizePercent.x=0<a.width?this._customSize.width/a.width:0;this._sizePercent.y=0<a.height?this._customSize.height/a.height:0;break;case ccui.Widget.SIZE_PERCENT:var b=cc.size(a.width*this._sizePercent.x,a.height*this._sizePercent.y);this._ignoreSize?this.setContentSize(this.getVirtualRendererSize()):
this.setContentSize(b);this._customSize.width=b.width;this._customSize.height=b.height}this._onSizeChanged();b=this.getPosition();switch(this._positionType){case ccui.Widget.POSITION_ABSOLUTE:0>=a.width||0>=a.height?this._positionPercent.x=this._positionPercent.y=0:(this._positionPercent.x=b.x/a.width,this._positionPercent.y=b.y/a.height);break;case ccui.Widget.POSITION_PERCENT:b=cc.p(a.width*this._positionPercent.x,a.height*this._positionPercent.y)}if(this._parent instanceof ccui.ImageView&&(a=this._parent._imageRenderer)&&
!a._textureLoaded)return;this.setPosition(b)},setSizeType:function(a){this._sizeType=a;this._usingLayoutComponent&&this._getOrCreateLayoutComponent().setUsingPercentContentSize(this._sizeType===ccui.SIZE_PERCENT)},getSizeType:function(){return this._sizeType},ignoreContentAdaptWithSize:function(a){this._unifySize?this.setContentSize(this._customSize):this._ignoreSize!==a&&(this._ignoreSize=a,this.setContentSize(a?this.getVirtualRendererSize():this._customSize))},isIgnoreContentAdaptWithSize:function(){return this._ignoreSize},
getCustomSize:function(){return cc.size(this._customSize)},getLayoutSize:function(){return cc.size(this._contentSize)},getSizePercent:function(){this._usingLayoutComponent&&(this._sizePercent=this._getOrCreateLayoutComponent().getPercentContentSize());return this._sizePercent},_getWidthPercent:function(){return this._sizePercent.x},_getHeightPercent:function(){return this._sizePercent.y},getWorldPosition:function(){return this.convertToWorldSpace(cc.p(this._anchorPoint.x*this._contentSize.width,this._anchorPoint.y*
this._contentSize.height))},getVirtualRenderer:function(){return this},getVirtualRendererSize:function(){return cc.size(this._contentSize)},_onSizeChanged:function(){if(!this._usingLayoutComponent){for(var a=this.getChildren(),b=0,c=a.length;b<c;b++){var d=a[b];d instanceof ccui.Widget&&d.updateSizeAndPosition()}this._sizeDirty=!1}},setTouchEnabled:function(a){this._touchEnabled!==a&&((this._touchEnabled=a)?(this._touchListener||(this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches:!0,onTouchBegan:this.onTouchBegan.bind(this),onTouchMoved:this.onTouchMoved.bind(this),onTouchEnded:this.onTouchEnded.bind(this)})),cc.eventManager.addListener(this._touchListener,this)):cc.eventManager.removeListener(this._touchListener))},isTouchEnabled:function(){return this._touchEnabled},isHighlighted:function(){return this._highlight},setHighlighted:function(a){a!==this._highlight&&(this._highlight=a,this._bright?this._highlight?this.setBrightStyle(ccui.Widget.BRIGHT_STYLE_HIGH_LIGHT):
this.setBrightStyle(ccui.Widget.BRIGHT_STYLE_NORMAL):this._onPressStateChangedToDisabled())},isFocused:function(){return this._focused},setFocused:function(a){if(this._focused=a)ccui.Widget._focusedWidget=this,ccui.Widget._focusNavigationController&&ccui.Widget._focusNavigationController._setFirstFocsuedWidget(this)},isFocusEnabled:function(){return this._focusEnabled},setFocusEnabled:function(a){this._focusEnabled=a},findNextFocusedWidget:function(a,b){if(null===this.onNextFocusedWidget||null==this.onNextFocusedWidget(a)){var c=
b instanceof ccui.Layout;if(this.isFocused()||c){var d=this.getParent();return null!==d&&d instanceof ccui.Layout?d.findNextFocusedWidget(a,b):c?b.findNextFocusedWidget(a,b):b}return b}c=this.onNextFocusedWidget(a);this.dispatchFocusEvent(this,c);return c},requestFocus:function(){this!==ccui.Widget._focusedWidget&&this.dispatchFocusEvent(ccui.Widget._focusedWidget,this)},getCurrentFocusedWidget:function(){return ccui.Widget._focusedWidget},onFocusChanged:null,onNextFocusedWidget:null,interceptTouchEvent:function(a,
b,c){var d=this.getWidgetParent();d&&d.interceptTouchEvent(a,b,c)},onFocusChange:function(a,b){a&&a.setFocused(!1);b&&b.setFocused(!0)},dispatchFocusEvent:function(a,b){a&&!a.isFocused()&&(a=ccui.Widget._focusedWidget);if(b!==a){if(b&&b.onFocusChanged)b.onFocusChanged(a,b);if(a&&b.onFocusChanged)a.onFocusChanged(a,b);cc.eventManager.dispatchEvent(new cc.EventFocus(a,b))}},setBright:function(a){(this._bright=a)?(this._brightStyle=ccui.Widget.BRIGHT_STYLE_NONE,this.setBrightStyle(ccui.Widget.BRIGHT_STYLE_NORMAL)):
this._onPressStateChangedToDisabled()},setBrightStyle:function(a){if(this._brightStyle!==a)switch(this._brightStyle=a=a||ccui.Widget.BRIGHT_STYLE_NORMAL,this._brightStyle){case ccui.Widget.BRIGHT_STYLE_NORMAL:this._onPressStateChangedToNormal();break;case ccui.Widget.BRIGHT_STYLE_HIGH_LIGHT:this._onPressStateChangedToPressed()}},_onPressStateChangedToNormal:function(){},_onPressStateChangedToPressed:function(){},_onPressStateChangedToDisabled:function(){},_updateChildrenDisplayedRGBA:function(){this.setColor(this.getColor());
this.setOpacity(this.getOpacity())},didNotSelectSelf:function(){},onTouchBegan:function(a,b){this._hit=!1;if(this.isVisible()&&this.isEnabled()&&this._isAncestorsEnabled()&&this._isAncestorsVisible(this)){var c=a.getLocation();this._touchBeganPosition.x=c.x;this._touchBeganPosition.y=c.y;this.hitTest(this._touchBeganPosition)&&this.isClippingParentContainsPoint(this._touchBeganPosition)&&(this._hit=!0)}if(!this._hit)return!1;this.setHighlighted(!0);this._propagateTouchEvents&&this.propagateTouchEvent(ccui.Widget.TOUCH_BEGAN,
this,a);this._pushDownEvent();return!0},propagateTouchEvent:function(a,b,c){var d=this.getWidgetParent();d&&d.interceptTouchEvent(a,b,c)},onTouchMoved:function(a,b){var c=a.getLocation();this._touchMovePosition.x=c.x;this._touchMovePosition.y=c.y;this.setHighlighted(this.hitTest(c));this._propagateTouchEvents&&this.propagateTouchEvent(ccui.Widget.TOUCH_MOVED,this,a);this._moveEvent()},onTouchEnded:function(a,b){var c=a.getLocation();this._touchEndPosition.x=c.x;this._touchEndPosition.y=c.y;this._propagateTouchEvents&&
this.propagateTouchEvent(ccui.Widget.TOUCH_ENDED,this,a);c=this._highlight;this.setHighlighted(!1);c?this._releaseUpEvent():this._cancelUpEvent()},onTouchCancelled:function(a){this.setHighlighted(!1);this._cancelUpEvent()},onTouchLongClicked:function(a){this.longClickEvent()},_pushDownEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_BEGAN);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_BEGAN)},
_moveEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_MOVED);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_MOVED)},_releaseUpEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_ENDED);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_ENDED);this._clickEventListener&&
this._clickEventListener(this)},_cancelUpEvent:function(){this._touchEventCallback&&this._touchEventCallback(this,ccui.Widget.TOUCH_CANCELED);this._touchEventListener&&this._touchEventSelector&&this._touchEventSelector.call(this._touchEventListener,this,ccui.Widget.TOUCH_CANCELED)},longClickEvent:function(){},addTouchEventListener:function(a,b){void 0===b?this._touchEventCallback=a:(this._touchEventSelector=a,this._touchEventListener=b)},addClickEventListener:function(a){this._clickEventListener=
a},hitTest:function(a){var b=cc.rect(0,0,this._contentSize.width,this._contentSize.height);return cc.rectContainsPoint(b,this.convertToNodeSpace(a))},isClippingParentContainsPoint:function(a){this._affectByClipping=!1;for(var b=this.getParent(),c=null;b;){if(b instanceof ccui.Layout&&b.isClippingEnabled()){this._affectByClipping=!0;c=b;break}b=b.getParent()}return this._affectByClipping?c?c.hitTest(a)?c.isClippingParentContainsPoint(a):!1:!0:!0},checkChildInfo:function(a,b,c){var d=this.getWidgetParent();
d&&d.checkChildInfo(a,b,c)},setPosition:function(a,b){if(!this._usingLayoutComponent&&this._running){var c=this.getWidgetParent();c&&(c=c.getContentSize(),0>=c.width||0>=c.height?(this._positionPercent.x=0,this._positionPercent.y=0):void 0===b?(this._positionPercent.x=a.x/c.width,this._positionPercent.y=a.y/c.height):(this._positionPercent.x=a/c.width,this._positionPercent.y=b/c.height))}cc.Node.prototype.setPosition.call(this,a,b)},setPositionX:function(a){if(this._running){var b=this.getWidgetParent();
b&&(b=b.width,this._positionPercent.x=0>=b?0:a/b)}cc.Node.prototype.setPositionX.call(this,a)},setPositionY:function(a){if(this._running){var b=this.getWidgetParent();b&&(b=b.height,this._positionPercent.y=0>=b?0:a/b)}cc.Node.prototype.setPositionY.call(this,a)},setPositionPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.setPositionPercentY(a.y);b.refreshLayout()}else this._setXPercent(a.x),this._setYPercent(a.y),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},
_setXPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.refreshLayout()}else this._positionPercent.x=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},_setYPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentY(a.x);b.refreshLayout()}else this._positionPercent.y=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionPercent:function(){if(this._usingLayoutComponent){var a=
this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return cc.p(this._positionPercent)},_getXPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.x},_getYPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x=
a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.y},setPositionType:function(a){this._positionType=a;if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();a===ccui.POSITION_ABSOLUTE?(b.setPositionPercentXEnabled(!1),b.setPositionPercentYEnabled(!1)):(b.setPositionPercentXEnabled(!0),b.setPositionPercentYEnabled(!0))}this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionType:function(){return this._positionType},
setFlippedX:function(a){var b=this.getScaleX();this._flippedX=a;this.setScaleX(b)},isFlippedX:function(){return this._flippedX},setFlippedY:function(a){var b=this.getScaleY();this._flippedY=a;this.setScaleY(b)},isFlippedY:function(){return this._flippedY},_adaptRenderers:function(){},isBright:function(){return this._bright},isEnabled:function(){return this._enabled},getLeftBoundary:function(){return this.getPositionX()-this._getAnchorX()*this._contentSize.width},getBottomBoundary:function(){return this.getPositionY()-
this._getAnchorY()*this._contentSize.height},getRightBoundary:function(){return this.getLeftBoundary()+this._contentSize.width},getTopBoundary:function(){return this.getBottomBoundary()+this._contentSize.height},getTouchBeganPosition:function(){return cc.p(this._touchBeganPosition)},getTouchMovePosition:function(){return cc.p(this._touchMovePosition)},getTouchEndPosition:function(){return cc.p(this._touchEndPosition)},getWidgetType:function(){return this._widgetType},setLayoutParameter:function(a){a&&
(this._layoutParameterDictionary[a.getLayoutType()]=a,this._layoutParameterType=a.getLayoutType())},getLayoutParameter:function(a){a=a||this._layoutParameterType;return this._layoutParameterDictionary[a]},getDescription:function(){return"Widget"},clone:function(){var a=this._createCloneInstance();a._copyProperties(this);a._copyClonedWidgetChildren(this);return a},_createCloneInstance:function(){return new ccui.Widget},_copyClonedWidgetChildren:function(a){a=a.getChildren();for(var b=0;b<a.length;b++){var c=
a[b];c instanceof ccui.Widget&&this.addChild(c.clone())}},_copySpecialProperties:function(a){},_copyProperties:function(a){this.setEnabled(a.isEnabled());this.setVisible(a.isVisible());this.setBright(a.isBright());this.setTouchEnabled(a.isTouchEnabled());this.setLocalZOrder(a.getLocalZOrder());this.setTag(a.getTag());this.setName(a.getName());this.setActionTag(a.getActionTag());this._ignoreSize=a._ignoreSize;this.setContentSize(a._contentSize);this._customSize.width=a._customSize.width;this._customSize.height=
a._customSize.height;this._copySpecialProperties(a);this._sizeType=a.getSizeType();this._sizePercent.x=a._sizePercent.x;this._sizePercent.y=a._sizePercent.y;this._positionType=a._positionType;this._positionPercent.x=a._positionPercent.x;this._positionPercent.y=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());this._touchEventCallback=a._touchEventCallback;this._touchEventListener=a._touchEventListener;this._touchEventSelector=a._touchEventSelector;this._clickEventListener=a._clickEventListener;this._focused=a._focused;this._focusEnabled=a._focusEnabled;this._propagateTouchEvents=a._propagateTouchEvents;for(var b in a._layoutParameterDictionary){var c=a._layoutParameterDictionary[b];
c&&this.setLayoutParameter(c.clone())}},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},getLeftInParent:function(){cc.log("getLeftInParent is deprecated. Please use getLeftBoundary instead.");return this.getLeftBoundary()},getBottomInParent:function(){cc.log("getBottomInParent is deprecated. Please use getBottomBoundary instead.");return this.getBottomBoundary()},getRightInParent:function(){cc.log("getRightInParent is deprecated. Please use getRightBoundary instead.");
return this.getRightBoundary()},getTopInParent:function(){cc.log("getTopInParent is deprecated. Please use getTopBoundary instead.");return this.getTopBoundary()},getTouchEndPos:function(){cc.log("getTouchEndPos is deprecated. Please use getTouchEndPosition instead.");return this.getTouchEndPosition()},getTouchMovePos:function(){cc.log("getTouchMovePos is deprecated. Please use getTouchMovePosition instead.");return this.getTouchMovePosition()},clippingParentAreaContainPoint:function(a){cc.log("clippingParentAreaContainPoint is deprecated. Please use isClippingParentContainsPoint instead.");
this.isClippingParentContainsPoint(a)},getTouchStartPos:function(){cc.log("getTouchStartPos is deprecated. Please use getTouchBeganPosition instead.");return this.getTouchBeganPosition()},setSize:function(a){this.setContentSize(a)},getSize:function(){return this.getContentSize()},addNode:function(a,b,c){a instanceof ccui.Widget?cc.log("Please use addChild to add a Widget."):(cc.Node.prototype.addChild.call(this,a,b,c),this._nodes.push(a))},getNodeByTag:function(a){for(var b=this._nodes,c=0;c<b.length;c++){var d=
b[c];if(d&&d.getTag()===a)return d}return null},getNodes:function(){return this._nodes},removeNode:function(a,b){cc.Node.prototype.removeChild.call(this,a,b);cc.arrayRemoveObject(this._nodes,a)},_getNormalGLProgram:function(){return cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)},_getGrayGLProgram:function(){return cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY)},removeNodeByTag:function(a,b){var c=this.getChildByTag(a);c?this.removeChild(c,b):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},_findLayout:function(){cc.renderer.childrenOrderDirty=!0;for(var a=this._parent;a;)if(a._doLayout){a._doLayoutDirty=!0;break}else a=a._parent},isUnifySizeEnabled:function(){return this._unifySize},setUnifySizeEnabled:function(a){this._unifySize=a},_ccEventCallback:null,addCCSEventListener:function(a){this._ccEventCallback=a},setScaleX:function(a){this._flippedX&&
(a*=-1);cc.Node.prototype.setScaleX.call(this,a)},setScaleY:function(a){this._flippedY&&(a*=-1);cc.Node.prototype.setScaleY.call(this,a)},setScale:function(a,b){void 0===b&&(b=a);this.setScaleX(a);this.setScaleY(b)},getScaleX:function(){var a=cc.Node.prototype.getScaleX.call(this);this._flippedX&&(a*=-1);return a},getScaleY:function(){var a=cc.Node.prototype.getScaleY.call(this);this._flippedY&&(a*=-1);return a},getScale:function(){this.getScaleX()!==this.getScaleY()&&cc.log("Widget#scale. ScaleX !\x3d ScaleY. Don't know which one to return");
return this.getScaleX()},setCallbackName:function(a){this._callbackName=a},getCallbackName:function(){return this._callbackName},setCallbackType:function(a){this._callbackType=a},getCallbackType:function(){return this._callbackType},setLayoutComponentEnabled:function(a){this._usingLayoutComponent=a},isLayoutComponentEnabled:function(){return this._usingLayoutComponent},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new ccui.Widget.WebGLRenderCmd(this):new ccui.Widget.CanvasRenderCmd(this)}});
_p=ccui.Widget.prototype;cc.defineGetterSetter(_p,"xPercent",_p._getXPercent,_p._setXPercent);cc.defineGetterSetter(_p,"yPercent",_p._getYPercent,_p._setYPercent);cc.defineGetterSetter(_p,"widthPercent",_p._getWidthPercent,_p._setWidthPercent);cc.defineGetterSetter(_p,"heightPercent",_p._getHeightPercent,_p._setHeightPercent);cc.defineGetterSetter(_p,"widgetParent",_p.getWidgetParent);cc.defineGetterSetter(_p,"enabled",_p.isEnabled,_p.setEnabled);cc.defineGetterSetter(_p,"focused",_p.isFocused,_p.setFocused);
cc.defineGetterSetter(_p,"sizeType",_p.getSizeType,_p.setSizeType);cc.defineGetterSetter(_p,"widgetType",_p.getWidgetType);cc.defineGetterSetter(_p,"touchEnabled",_p.isTouchEnabled,_p.setTouchEnabled);cc.defineGetterSetter(_p,"updateEnabled",_p.isUpdateEnabled,_p.setUpdateEnabled);cc.defineGetterSetter(_p,"bright",_p.isBright,_p.setBright);cc.defineGetterSetter(_p,"name",_p.getName,_p.setName);cc.defineGetterSetter(_p,"actionTag",_p.getActionTag,_p.setActionTag);
cc.defineGetterSetter(_p,"opacity",_p.getOpacity,_p.setOpacity);_p=null;ccui.Widget.create=function(){return new ccui.Widget};ccui.Widget._focusedWidget=null;ccui.Widget._focusNavigationController=null;
ccui.Widget.enableDpadNavigation=function(a){a?(null==ccui.Widget._focusNavigationController&&(ccui.Widget._focusNavigationController=new ccui._FocusNavigationController,ccui.Widget._focusedWidget&&ccui.Widget._focusNavigationController._setFirstFocsuedWidget(ccui.Widget._focusedWidget)),ccui.Widget._focusNavigationController.enableFocusNavigation(!0)):ccui.Widget._focusNavigationController&&(ccui.Widget._focusNavigationController.enableFocusNavigation(!1),ccui.Widget._focusNavigationController=null)};
ccui.Widget.getCurrentFocusedWidget=function(){return ccui.Widget._focusedWidget};ccui.Widget.BRIGHT_STYLE_NONE=-1;ccui.Widget.BRIGHT_STYLE_NORMAL=0;ccui.Widget.BRIGHT_STYLE_HIGH_LIGHT=1;ccui.Widget.TYPE_WIDGET=0;ccui.Widget.TYPE_CONTAINER=1;ccui.Widget.LEFT=0;ccui.Widget.RIGHT=1;ccui.Widget.UP=2;ccui.Widget.DOWN=3;ccui.Widget.LOCAL_TEXTURE=0;ccui.Widget.PLIST_TEXTURE=1;ccui.Widget.TOUCH_BEGAN=0;ccui.Widget.TOUCH_MOVED=1;ccui.Widget.TOUCH_ENDED=2;ccui.Widget.TOUCH_CANCELED=3;
ccui.Widget.SIZE_ABSOLUTE=0;ccui.Widget.SIZE_PERCENT=1;ccui.Widget.POSITION_ABSOLUTE=0;ccui.Widget.POSITION_PERCENT=1;cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){ccui.Widget.CanvasRenderCmd=function(a){this._pNodeCmdCtor(a);this._needDraw=!1};var a=ccui.Widget.CanvasRenderCmd.prototype=Object.create(cc.ProtectedNode.CanvasRenderCmd.prototype);a.constructor=ccui.Widget.CanvasRenderCmd;a.visit=function(a){var c=this._node,d=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=
d.assignedZStep);c._adaptRenderers();this._syncStatus(a)};a.transform=function(a,c){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._node;if(d._visible&&d._running){d._adaptRenderers();if(!this._usingLayoutComponent){var e=d.getWidgetParent();e&&(e=e.getContentSize(),0!==e.width&&0!==e.height&&(d._position.x=e.width*d._positionPercent.x,d._position.y=e.height*d._positionPercent.y))}this.pNodeTransform(a,c)}}}else ccui.Widget.WebGLRenderCmd=
function(a){this._pNodeCmdCtor(a);this._needDraw=!1},a=ccui.Widget.WebGLRenderCmd.prototype=Object.create(cc.ProtectedNode.WebGLRenderCmd.prototype),a.constructor=ccui.Widget.WebGLRenderCmd,a.visit=function(a){var c=this._node,d=cc.renderer;if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;isNaN(c._customZ)&&(c._vertexZ=d.assignedZ,d.assignedZ+=d.assignedZStep);c._adaptRenderers();this._syncStatus(a)},a.transform=function(a,c){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},
this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._node;if(d._visible&&d._running){d._adaptRenderers();if(!this._usingLayoutComponent){var e=d.getWidgetParent();e&&(e=e.getContentSize(),0!==e.width&&0!==e.height&&(d._position.x=e.width*d._positionPercent.x,d._position.y=e.height*d._positionPercent.y))}this.pNodeTransform(a,c)}};a.widgetTransform=a.transform});(function(){var a={_pool:{},_lengths:[],put:function(a){var b=a.length;this._pool[b]?this._pool[b].push(a):(this._pool[b]=[a],this._lengths.push(b),this._lengths.sort())},get:function(a){for(var b,c=0;c<this._lengths.length;c++)if(this._lengths[c]>=a){b=this._lengths[c];break}if(b)return this._pool[b].pop()}},b=cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL,c,d={_rebuildQuads_base:function(b,d,e,f){var h=b._vertices,s=b._renderCmd._worldTransform,t,w,v;if(f)w=t=0,v=e.width,e=e.height;else{t=d._originalSize;
var y=d._rect,x=d._offset;v=e.width/t.width;f=e.height/t.height;var u=x.x-(t.width-y.width)/2;w=x.y+(t.height-y.height)/2;var z=x.y-(t.height-y.height)/2;t=(x.x+(t.width-y.width)/2)*v;w*=f;v=e.width+u*v;e=e.height+z*f}8>h.length&&(a.put(h),h=a.get(8)||new Float32Array(8),b._vertices=h);c?(h[0]=t*s.a+w*s.c+s.tx,h[1]=t*s.b+w*s.d+s.ty,h[2]=v*s.a+w*s.c+s.tx,h[3]=v*s.b+w*s.d+s.ty,h[4]=t*s.a+e*s.c+s.tx,h[5]=t*s.b+e*s.d+s.ty,h[6]=v*s.a+e*s.c+s.tx,h[7]=v*s.b+e*s.d+s.ty):(h[0]=t,h[1]=w,h[2]=v,h[3]=w,h[4]=
t,h[5]=e,h[6]=v,h[7]=e);b._uvsDirty&&this._calculateUVs(b,d);b._vertCount=4},_calculateUVs:function(c,d){var e=c._uvs,f=d._texture._pixelsWide,h=d._texture._pixelsHigh,s=d._rect,s=cc.rectPointsToPixels(s);8>e.length&&(a.put(e),e=a.get(8)||new Float32Array(8),c._uvs=e);var t,w,v=b?0.5:0;d._rotated?(t=(s.x+v)/f,w=(s.y+s.width-v)/h,f=(s.x+s.height-v)/f,h=(s.y+v)/h,e[0]=t,e[1]=h,e[2]=t,e[3]=w,e[4]=f,e[5]=h,e[6]=f,e[7]=w):(t=(s.x+v)/f,w=(s.y+s.height-v)/h,f=(s.x+s.width-v)/f,h=(s.y+v)/h,e[0]=t,e[1]=w,
e[2]=f,e[3]=w,e[4]=t,e[5]=h,e[6]=f,e[7]=h)}},e={x:Array(4),y:Array(4),_rebuildQuads_base:function(b,d,e,f,h,s,t){var w=b._vertices,v=b._renderCmd._worldTransform,y=e.width-f-h,x=e.height-s-t,u=e.width/(f+h),z=e.height/(s+t),A=this.x,B=this.y;A[0]=0;A[1]=f*(1<u?1:u);A[2]=A[1]+(0>y?0:y);A[3]=e.width;B[0]=0;B[1]=t*(1<z?1:z);B[2]=B[1]+(0>x?0:x);B[3]=e.height;32>w.length&&(a.put(w),w=a.get(32)||new Float32Array(32),b._vertices=w);e=0;if(c)for(y=0;4>y;y++)for(x=0;4>x;x++)w[e]=A[x]*v.a+B[y]*v.c+v.tx,w[e+
1]=A[x]*v.b+B[y]*v.d+v.ty,e+=2;else for(y=0;4>y;y++)for(x=0;4>x;x++)w[e]=A[x],w[e+1]=B[y],e+=2;b._uvsDirty&&this._calculateUVs(b,d,f,h,s,t)},_calculateUVs:function(c,d,e,f,h,s){var t=c._uvs,w=d._rect,v=d._texture._pixelsWide,y=d._texture._pixelsHigh,x,u=d._rect,u=cc.rectPointsToPixels(u),w=cc.rectPointsToPixels(w),z=cc.contentScaleFactor();e*=z;f=w.width-e-f*z;h*=z;s*=z;x=w.height-h-s;32>t.length&&(a.put(t),t=a.get(32)||new Float32Array(32),c._uvs=t);c=this.x;var w=this.y,A=b?0.5:0,z=0;if(d._rotated)for(c[0]=
(u.x+A)/v,c[1]=(s+u.x)/v,c[2]=(s+x+u.x)/v,c[3]=(u.x+u.height-A)/v,w[3]=(u.y+A)/y,w[2]=(e+u.y)/y,w[1]=(e+f+u.y)/y,w[0]=(u.y+u.width-A)/y,d=0;4>d;d++)for(v=0;4>v;v++)t[z]=c[d],t[z+1]=w[3-v],z+=2;else for(c[0]=(u.x+A)/v,c[1]=(e+u.x)/v,c[2]=(e+f+u.x)/v,c[3]=(u.x+u.width-A)/v,w[3]=(u.y+A)/y,w[2]=(h+u.y)/y,w[1]=(h+x+u.y)/y,w[0]=(u.y+u.height-A)/y,d=0;4>d;d++)for(v=0;4>v;v++)t[z]=c[v],t[z+1]=w[d],z+=2}};ccui.Scale9Sprite=cc.Scale9Sprite=cc.Node.extend({_spriteFrame:null,_scale9Image:null,_insetLeft:0,_insetRight:0,
_insetTop:0,_insetBottom:0,_blendFunc:null,_renderingType:1,_brightState:0,_opacityModifyRGB:!1,_rawVerts:null,_rawUvs:null,_vertices:null,_uvs:null,_vertCount:0,_quadsDirty:!0,_uvsDirty:!0,_isTriangle:!1,_isTrimmedContentSize:!1,_textureLoaded:!1,_flippedX:!1,_flippedY:!1,_className:"Scale9Sprite",ctor:function(b,d,e){cc.Node.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;this._renderCmd.setState(this._brightState);this._blendFunc=cc.BlendFunc._alphaPremultiplied();this.setAnchorPoint(cc.p(0.5,
0.5));this._rawUvs=this._rawVerts=null;this._vertices=a.get(8)||new Float32Array(8);this._uvs=a.get(8)||new Float32Array(8);if(void 0!==b)if(b instanceof cc.SpriteFrame)this.initWithSpriteFrame(b,d);else{var f=cc.spriteFrameCache.getSpriteFrame(b);f?this.initWithSpriteFrame(f,d):this.initWithFile(b,d,e)}void 0===c&&(c=cc._renderType===cc.game.RENDER_TYPE_WEBGL)},textureLoaded:function(){return this._textureLoaded},getCapInsets:function(){return cc.rect(this._capInsetsInternal)},_asyncSetCapInsets:function(){this.removeEventListener("load",
this._asyncSetCapInsets,this);this.setCapInsets(this._cacheCapInsets);this._cacheCapInsets=null},setCapInsets:function(a){if(!this.loaded())return this._cacheCapInsets=a,this.removeEventListener("load",this._asyncSetCapInsets,this),this.addEventListener("load",this._asyncSetCapInsets,this),!1;this._capInsetsInternal=a;this._updateCapInsets(this._spriteFrame._rect,this._capInsetsInternal)},_updateCapInsets:function(a,b){b&&a&&!cc._rectEqualToZero(b)?this._capInsetsInternal=b:(a=a||{x:0,y:0,width:this._contentSize.width,
height:this._contentSize.height},this._capInsetsInternal=cc.rect(a.width/3,a.height/3,a.width/3,a.height/3));cc._rectEqualToZero(a)||(this._insetLeft=this._capInsetsInternal.x,this._insetTop=this._capInsetsInternal.y,this._insetRight=a.width-this._insetLeft-this._capInsetsInternal.width,this._insetBottom=a.height-this._insetTop-this._capInsetsInternal.height)},initWithFile:function(a,b,c){a instanceof cc.Rect?(c=a=b,b=cc.rect(0,0,0,0)):(b=b||cc.rect(0,0,0,0),c=c||cc.rect(0,0,0,0));if(!a)throw Error("ccui.Scale9Sprite.initWithFile(): file should be non-null");
var d=cc.textureCache.getTextureForKey(a);d||(d=cc.textureCache.addImage(a));var e=d.isLoaded();this._textureLoaded=e;this._loader.clear();if(!e)return this._loader.once(d,function(){this.initWithFile(a,b,c);this.dispatchEvent("load")},this),!1;cc._rectEqualToZero(b)&&(e=d.getContentSize(),b=cc.rect(0,0,e.width,e.height));this.setTexture(d,b);this._updateCapInsets(b,c);return!0},updateWithBatchNode:function(a,b,c,d){if(!a)return!1;var e=a.getTexture();this._loader.clear();if(!e.isLoaded())return this._loader.once(e,
function(){this.updateWithBatchNode(a,b,c,d);this.dispatchEvent("load")},this),!1;this.setTexture(e,b);this._updateCapInsets(b,d);return!0},initWithSpriteFrame:function(a,b){this.setSpriteFrame(a);b=b||cc.rect(0,0,0,0);this._updateCapInsets(a._rect,b)},initWithSpriteFrameName:function(a,b){if(!a)throw Error("ccui.Scale9Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null");b=b||cc.rect(0,0,0,0);var c=cc.spriteFrameCache.getSpriteFrame(a);if(null==c)return cc.log("ccui.Scale9Sprite.initWithSpriteFrameName(): can't find the sprite frame by spriteFrameName"),
!1;this.setSpriteFrame(c);b=b||cc.rect(0,0,0,0);this._updateCapInsets(c._rect,b)},loaded:function(){return null===this._spriteFrame?!1:this._spriteFrame.textureLoaded()},setTexture:function(a,b){var c=new cc.SpriteFrame(a,b);this.setSpriteFrame(c)},_updateBlendFunc:function(){var a=this._blendFunc;this._spriteFrame&&this._spriteFrame._texture.hasPremultipliedAlpha()?(a.src===cc.SRC_ALPHA&&a.dst===cc.BLEND_DST&&(a.src=cc.ONE),this._opacityModifyRGB=!0):(a.src===cc.ONE&&a.dst===cc.BLEND_DST&&(a.src=
cc.SRC_ALPHA),this._opacityModifyRGB=!1)},setOpacityModifyRGB:function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this._renderCmd._setColorDirty())},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setSpriteFrame:function(a){if(a){this._spriteFrame=a;this._uvsDirty=this._quadsDirty=!0;var b=this,c=function(){cc.sizeEqualToSize(b._contentSize,cc.size(0,0))&&b.setContentSize(b._spriteFrame._rect);b._textureLoaded=!0;b._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);
cc.renderer.childrenOrderDirty=!0};b._textureLoaded=a.textureLoaded();b._textureLoaded?c():(this._loader.clear(),this._loader.once(a,function(){c();this.dispatchEvent("load")},this))}},setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src||cc.BLEND_SRC,this._blendFunc.dst=a.dst||cc.BLEND_DST):(this._blendFunc.src=a||cc.BLEND_SRC,this._blendFunc.dst=b||cc.BLEND_DST);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,
this._blendFunc.dst)},setPreferredSize:function(a){a&&!cc.sizeEqualToSize(this._contentSize,a)&&this.setContentSize(a)},getPreferredSize:function(){return this.getContentSize()},setContentSize:function(a,b){void 0===b&&(b=a.height,a=a.width);if(a!==this._contentSize.width||b!==this._contentSize.height)cc.Node.prototype.setContentSize.call(this,a,b),this._quadsDirty=!0},getContentSize:function(){return this._renderingType===ccui.Scale9Sprite.RenderingType.SIMPLE?this._spriteFrame?this._spriteFrame._originalSize:
cc.size(this._contentSize):cc.size(this._contentSize)},_setWidth:function(a){cc.Node.prototype._setWidth.call(this,a);this._quadsDirty=!0},_setHeight:function(a){cc.Node.prototype._setHeight.call(this,a);this._quadsDirty=!0},setState:function(a){this._brightState=a;this._renderCmd.setState(a);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getState:function(){return this._brightState},setRenderingType:function(a){this._renderingType!==a&&(this._renderingType=a,this._uvsDirty=this._quadsDirty=
!0,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty))},getRenderingType:function(){return this._renderingType},setInsetLeft:function(a){this._insetLeft=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetLeft:function(){return this._insetLeft},setInsetTop:function(a){this._insetTop=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetTop:function(){return this._insetTop},setInsetRight:function(a){this._insetRight=
a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetRight:function(){return this._insetRight},setInsetBottom:function(a){this._insetBottom=a;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetBottom:function(){return this._insetBottom},_rebuildQuads:function(){if(this._spriteFrame&&this._spriteFrame._textureLoaded){this._updateBlendFunc();this._isTriangle=!1;switch(this._renderingType){case h.SIMPLE:d._rebuildQuads_base(this,
this._spriteFrame,this._contentSize,this._isTrimmedContentSize);break;case h.SLICED:e._rebuildQuads_base(this,this._spriteFrame,this._contentSize,this._insetLeft,this._insetRight,this._insetTop,this._insetBottom);break;default:this._uvsDirty=this._quadsDirty=!1;cc.error("Can not generate quad");return}this._uvsDirty=this._quadsDirty=!1}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccui.Scale9Sprite.CanvasRenderCmd(this):new ccui.Scale9Sprite.WebGLRenderCmd(this)}});
var f=ccui.Scale9Sprite.prototype;cc.EventHelper.prototype.apply(f);cc.defineGetterSetter(f,"preferredSize",f.getPreferredSize,f.setPreferredSize);cc.defineGetterSetter(f,"capInsets",f.getCapInsets,f.setCapInsets);cc.defineGetterSetter(f,"insetLeft",f.getInsetLeft,f.setInsetLeft);cc.defineGetterSetter(f,"insetTop",f.getInsetTop,f.setInsetTop);cc.defineGetterSetter(f,"insetRight",f.getInsetRight,f.setInsetRight);cc.defineGetterSetter(f,"insetBottom",f.getInsetBottom,f.setInsetBottom);f=null;ccui.Scale9Sprite.create=
function(a,b,c){return new ccui.Scale9Sprite(a,b,c)};ccui.Scale9Sprite.createWithSpriteFrame=function(a,b){return new ccui.Scale9Sprite(a,b)};ccui.Scale9Sprite.createWithSpriteFrameName=function(a,b){return new ccui.Scale9Sprite(a,b)};ccui.Scale9Sprite.POSITIONS_CENTRE=0;ccui.Scale9Sprite.POSITIONS_TOP=1;ccui.Scale9Sprite.POSITIONS_LEFT=2;ccui.Scale9Sprite.POSITIONS_RIGHT=3;ccui.Scale9Sprite.POSITIONS_BOTTOM=4;ccui.Scale9Sprite.POSITIONS_TOPRIGHT=5;ccui.Scale9Sprite.POSITIONS_TOPLEFT=6;ccui.Scale9Sprite.POSITIONS_BOTTOMRIGHT=
7;ccui.Scale9Sprite.state={NORMAL:0,GRAY:1};var h=ccui.Scale9Sprite.RenderingType={SIMPLE:0,SLICED:1}})();(function(){ccui.Scale9Sprite.CanvasRenderCmd=function(a){cc.Node.CanvasRenderCmd.call(this,a);this._needDraw=!0;this._state=ccui.Scale9Sprite.state.NORMAL;this._originalTexture=this._textureToRender=null};var a=ccui.Scale9Sprite.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=ccui.Scale9Sprite.CanvasRenderCmd;a.transform=function(a,c){this.originTransform(a,c);this._node._rebuildQuads()};a.needDraw=function(){return this._needDraw&&this._node.loaded()};a._updateDisplayColor=
function(a){cc.Node.RenderCmd.prototype._updateDisplayColor.call(this,a);this._originalTexture=this._textureToRender=null};a.setState=function(a){this._state!==a&&(this._state=a,this._originalTexture=this._textureToRender=null)};a._setColorDirty=function(){this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty)};a.rendering=function(a,c,d){var e=this._node,f=this._displayedOpacity,h=f/255,k=null;e._spriteFrame&&(k=e._spriteFrame._texture);if(e.loaded()&&0!==f){if(null===
this._textureToRender||this._originalTexture!==k)this._textureToRender=this._originalTexture=k,cc.Scale9Sprite.state.GRAY===this._state&&(this._textureToRender=this._textureToRender._generateGrayTexture()),f=e.getDisplayedColor(),!k||255===f.r&&255===f.g&&255===f.b||(this._textureToRender=this._textureToRender._generateColorTexture(f.r,f.g,f.b));k=a||cc._renderContext;a=k.getContext();k.setTransform(this._worldTransform,c,d);k.setCompositeOperation(cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(e._blendFunc));
k.setGlobalAlpha(h);if(this._textureToRender){e._quadsDirty&&e._rebuildQuads();var m,n,p,r,s,t,w;c=this._textureToRender._pixelsWide;d=this._textureToRender._pixelsHigh;var h=this._textureToRender._htmlElementObj,f=e._vertices,v=e._uvs,y=0,x=0;if(e._renderingType===cc.Scale9Sprite.RenderingType.SLICED){for(k=0;3>k;++k)for(y=0;3>y;++y)x=8*k+2*y,r=f[x],s=f[x+1],t=f[x+10]-r,w=f[x+11]-s,s=-s-w,e=v[x]*c,m=v[x+11]*d,n=(v[x+10]-v[x])*c,p=(v[x+1]-v[x+11])*d,0<n&&0<p&&0<t&&0<w&&a.drawImage(h,e,m,n,p,r,s,t,
w);cc.g_NumberOfDraws+=9}else{for(var u=Math.floor(e._vertCount/4),x=y=0;y<u;y++)r=f[x],s=f[x+1],t=f[x+6]-r,w=f[x+7]-s,s=-s-w,e=v[x]*c,m=v[x+7]*d,n=(v[x+6]-v[x])*c,p=(v[x+1]-v[x+7])*d,""!==this._textureToRender._pattern?(k.setFillStyle(a.createPattern(h,this._textureToRender._pattern)),a.fillRect(r,s,t,w)):0<n&&0<p&&0<t&&0<w&&a.drawImage(h,e,m,n,p,r,s,t,w),x+=8;cc.g_NumberOfDraws+=u}}}}})();(function(){if(cc.Node.WebGLRenderCmd){ccui.Scale9Sprite.WebGLRenderCmd=function(a){cc.Node.WebGLRenderCmd.call(this,a);this._needDraw=!0;this._color=new Uint32Array(1);this._dirty=!1;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};var a=ccui.Scale9Sprite,b=ccui.Scale9Sprite.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);b.constructor=ccui.Scale9Sprite.WebGLRenderCmd;b.needDraw=function(){return this._needDraw&&this._node.loaded()};
b._uploadSliced=function(a,b,e,f,h,k,m){for(var n,p=0;3>p;++p)for(var r=0;3>r;++r)n=8*p+2*r,h[m]=a[n],h[m+1]=a[n+1],h[m+2]=f,k[m+3]=e[0],h[m+4]=b[n],h[m+5]=b[n+1],m+=6,h[m]=a[n+2],h[m+1]=a[n+3],h[m+2]=f,k[m+3]=e[0],h[m+4]=b[n+2],h[m+5]=b[n+3],m+=6,h[m]=a[n+8],h[m+1]=a[n+9],h[m+2]=f,k[m+3]=e[0],h[m+4]=b[n+8],h[m+5]=b[n+9],m+=6,h[m]=a[n+10],h[m+1]=a[n+11],h[m+2]=f,k[m+3]=e[0],h[m+4]=b[n+10],h[m+5]=b[n+11],m+=6;return 36};b.transform=function(a,b){this.originTransform(a,b);this._node._rebuildQuads()};
b._setColorDirty=function(){};b.uploadData=function(b,d,e){var f=this._node;if(0===this._displayedOpacity)return 0;f._quadsDirty&&f._rebuildQuads();var h=this._displayedOpacity,k=this._displayedColor.r,m=this._displayedColor.g,n=this._displayedColor.b;if(f._opacityModifyRGB)var p=h/255,k=k*p,m=m*p,n=n*p;this._color[0]=h<<24|n<<16|m<<8|k;h=f._vertexZ;k=f._vertices;m=f._uvs;p=a.RenderingType;n=0;switch(f._renderingType){case p.SIMPLE:n=this._node._vertCount;for(p=f=0;f<n;f++,p+=2)b[e]=k[p],b[e+1]=k[p+
1],b[e+2]=h,d[e+3]=this._color[0],b[e+4]=m[p],b[e+5]=m[p+1],e+=6;break;case p.SLICED:n=this._uploadSliced(k,m,this._color,h,b,d,e)}return n};b.setState=function(b){b===a.state.NORMAL?this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR):b===a.state.GRAY&&(this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY))}}})();ccui.Layout=ccui.Widget.extend({_clippingEnabled:!1,_backGroundScale9Enabled:null,_backGroundImage:null,_backGroundImageFileName:null,_backGroundImageCapInsets:null,_colorType:null,_bgImageTexType:ccui.Widget.LOCAL_TEXTURE,_colorRender:null,_gradientRender:null,_color:null,_startColor:null,_endColor:null,_alongVector:null,_opacity:255,_backGroundImageTextureSize:null,_layoutType:null,_doLayoutDirty:!0,_clippingRectDirty:!0,_clippingType:null,_clippingStencil:null,_scissorRectDirty:!1,_clippingRect:null,
_clippingParent:null,_className:"Layout",_backGroundImageColor:null,_finalPositionX:0,_finalPositionY:0,_backGroundImageOpacity:0,_loopFocus:!1,__passFocusToChild:!0,_isFocusPassing:!1,_isInterceptTouch:!1,ctor:function(){this._layoutType=ccui.Layout.ABSOLUTE;this._widgetType=ccui.Widget.TYPE_CONTAINER;this._clippingType=ccui.Layout.CLIPPING_SCISSOR;this._colorType=ccui.Layout.BG_COLOR_NONE;ccui.Widget.prototype.ctor.call(this);this.ignoreContentAdaptWithSize(!1);this.setContentSize(cc.size(0,0));
this.setAnchorPoint(0,0);this.onPassFocusToChild=this._findNearestChildWidgetIndex.bind(this);this._backGroundImageCapInsets=cc.rect(0,0,0,0);this._color=cc.color(255,255,255,255);this._startColor=cc.color(255,255,255,255);this._endColor=cc.color(255,255,255,255);this._alongVector=cc.p(0,-1);this._backGroundImageTextureSize=cc.size(0,0);this._clippingRect=cc.rect(0,0,0,0);this._backGroundImageColor=cc.color(255,255,255,255)},onEnter:function(){ccui.Widget.prototype.onEnter.call(this);this._clippingStencil&&
this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onEnter);this._clippingRectDirty=this._doLayoutDirty=!0},onExit:function(){ccui.Widget.prototype.onExit.call(this);this._clippingStencil&&this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onExit)},visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){this._adaptRenderers();this._doLayout();b.visit(c);a=this._clippingEnabled&&this._clippingType===ccui.Layout.CLIPPING_STENCIL;var d=this._clippingEnabled&&
this._clippingType===ccui.Layout.CLIPPING_SCISSOR;a?b.stencilClippingVisit(c):d&&b.scissorClippingVisit(c);var e=this._children,f=e.length,h,k=this._protectedChildren,m=k.length,n;this._reorderChildDirty&&this.sortAllChildren();this._reorderProtectedChildDirty&&this.sortAllProtectedChildren();for(c=0;c<f;c++)if(h=e[c],0>h._localZOrder)h.visit(this);else break;for(h=0;h<m;h++)if(n=k[h],0>n._localZOrder)b._changeProtectedChild(n),n.visit(this);else break;for(;c<f;c++)e[c].visit(this);for(;h<m;h++)n=
k[h],b._changeProtectedChild(n),n.visit(this);a?b.postStencilVisit():d&&b.postScissorVisit();b._dirtyFlag=0}else b._propagateFlagsDown(c)},setLoopFocus:function(a){this._loopFocus=a},isLoopFocus:function(){return this._loopFocus},setPassFocusToChild:function(a){this.__passFocusToChild=a},isPassFocusToChild:function(){return this.__passFocusToChild},findNextFocusedWidget:function(a,b){if(this._isFocusPassing||this.isFocused()){var c=this.getParent();this._isFocusPassing=!1;if(this.__passFocusToChild){var d=
this._passFocusToChild(a,b);return d instanceof ccui.Layout&&c?(c._isFocusPassing=!0,c.findNextFocusedWidget(a,this)):d}if(null==c||!(c instanceof ccui.Layout))return this;c._isFocusPassing=!0;return c.findNextFocusedWidget(a,this)}if(b.isFocused()||b instanceof ccui.Layout)if(this._layoutType===ccui.Layout.LINEAR_HORIZONTAL)switch(a){case ccui.Widget.LEFT:return this._getPreviousFocusedWidget(a,b);case ccui.Widget.RIGHT:return this._getNextFocusedWidget(a,b);case ccui.Widget.DOWN:case ccui.Widget.UP:return this._isLastWidgetInContainer(this,
a)?this._isWidgetAncestorSupportLoopFocus(b,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b:ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this);default:return cc.assert(0,"Invalid Focus Direction"),b}else if(this._layoutType===ccui.Layout.LINEAR_VERTICAL)switch(a){case ccui.Widget.LEFT:case ccui.Widget.RIGHT:return this._isLastWidgetInContainer(this,a)?this._isWidgetAncestorSupportLoopFocus(b,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b:ccui.Widget.prototype.findNextFocusedWidget.call(this,
a,this);case ccui.Widget.DOWN:return this._getNextFocusedWidget(a,b);case ccui.Widget.UP:return this._getPreviousFocusedWidget(a,b);default:return cc.assert(0,"Invalid Focus Direction"),b}else return cc.assert(0,"Un Supported Layout type, please use VBox and HBox instead!!!"),b;else return b},onPassFocusToChild:null,addChild:function(a,b,c){a instanceof ccui.Widget&&this._supplyTheLayoutParameterLackToChild(a);ccui.Widget.prototype.addChild.call(this,a,b,c);this._doLayoutDirty=!0},removeChild:function(a,
b){ccui.Widget.prototype.removeChild.call(this,a,b);this._doLayoutDirty=!0},removeAllChildren:function(a){ccui.Widget.prototype.removeAllChildren.call(this,a);this._doLayoutDirty=!0},removeAllChildrenWithCleanup:function(a){ccui.Widget.prototype.removeAllChildrenWithCleanup.call(this,a);this._doLayoutDirty=!0},isClippingEnabled:function(){return this._clippingEnabled},setClippingEnabled:function(a){if(a!==this._clippingEnabled)switch(this._clippingEnabled=a,this._clippingType){case ccui.Layout.CLIPPING_SCISSOR:case ccui.Layout.CLIPPING_STENCIL:a?
(this._clippingStencil=new cc.DrawNode,this._renderCmd.rebindStencilRendering(this._clippingStencil),this._running&&this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onEnter),this._setStencilClippingSize(this._contentSize)):(this._running&&this._clippingStencil&&this._clippingStencil._performRecursive(cc.Node._stateCallbackType.onExit),this._clippingStencil=null)}},setClippingType:function(a){if(a!==this._clippingType){var b=this.isClippingEnabled();this.setClippingEnabled(!1);this._clippingType=
a;this.setClippingEnabled(b)}},getClippingType:function(){return this._clippingType},_setStencilClippingSize:function(a){if(this._clippingEnabled){var b=[];b[0]=cc.p(0,0);b[1]=cc.p(a.width,0);b[2]=cc.p(a.width,a.height);b[3]=cc.p(0,a.height);var c=cc.color.GREEN;this._clippingStencil.clear();this._clippingStencil.setLocalBB&&this._clippingStencil.setLocalBB(0,0,a.width,a.height);this._clippingStencil.drawPoly(b,4,c,0,c)}},_getClippingRect:function(){if(this._clippingRectDirty){var a=this.convertToWorldSpace(cc.p(0,
0)),b=this.getNodeToWorldTransform(),c=this._contentSize.width*b.a,b=this._contentSize.height*b.d,d;for(d=this;d;)if((d=d.getParent())&&d instanceof ccui.Layout&&d.isClippingEnabled()){this._clippingParent=d;break}this._clippingParent?(d=this._clippingParent._getClippingRect(),this._clippingRect.x=Math.max(a.x,d.x),this._clippingRect.y=Math.max(a.y,d.y),c=Math.min(a.x+c,d.x+d.width),a=Math.min(a.y+b,d.y+d.height),this._clippingRect.width=Math.max(0,c-this._clippingRect.x),this._clippingRect.height=
Math.max(0,a-this._clippingRect.y)):(this._clippingRect.x=a.x,this._clippingRect.y=a.y,this._clippingRect.width=c,this._clippingRect.height=b);this._clippingRectDirty=!1}return this._clippingRect},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);var a=this._contentSize;this._setStencilClippingSize(a);this._clippingRectDirty=this._doLayoutDirty=!0;this._backGroundImage&&(this._backGroundImage.setPosition(0.5*a.width,0.5*a.height),this._backGroundScale9Enabled&&this._backGroundImage instanceof
ccui.Scale9Sprite&&this._backGroundImage.setPreferredSize(a));this._colorRender&&this._colorRender.setContentSize(a);this._gradientRender&&this._gradientRender.setContentSize(a)},setBackGroundImageScale9Enabled:function(a){this._backGroundScale9Enabled!==a&&(this.removeProtectedChild(this._backGroundImage),this._backGroundImage=null,this._backGroundScale9Enabled=a,this._addBackGroundImage(),this.setBackGroundImage(this._backGroundImageFileName,this._bgImageTexType),this.setBackGroundImageCapInsets(this._backGroundImageCapInsets))},
isBackGroundImageScale9Enabled:function(){return this._backGroundScale9Enabled},setBackGroundImage:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;null===this._backGroundImage&&(this._addBackGroundImage(),this.setBackGroundImageScale9Enabled(this._backGroundScale9Enabled));this._backGroundImageFileName=a;this._bgImageTexType=b;var c=this._backGroundImage;switch(this._bgImageTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._backGroundScale9Enabled&&
c.setPreferredSize(this._contentSize);this._backGroundImageTextureSize=c.getContentSize();c.setPosition(0.5*this._contentSize.width,0.5*this._contentSize.height);this._updateBackGroundImageColor()}},setBackGroundImageCapInsets:function(a){if(a){var b=this._backGroundImageCapInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._backGroundScale9Enabled&&this._backGroundImage.setCapInsets(a)}},getBackGroundImageCapInsets:function(){return cc.rect(this._backGroundImageCapInsets)},_supplyTheLayoutParameterLackToChild:function(a){if(a)switch(this._layoutType){case ccui.Layout.LINEAR_HORIZONTAL:case ccui.Layout.LINEAR_VERTICAL:var b=
a.getLayoutParameter(ccui.LayoutParameter.LINEAR);b||a.setLayoutParameter(new ccui.LinearLayoutParameter);break;case ccui.Layout.RELATIVE:(b=a.getLayoutParameter(ccui.LayoutParameter.RELATIVE))||a.setLayoutParameter(new ccui.RelativeLayoutParameter)}},_addBackGroundImage:function(){var a=this._contentSize;this._backGroundScale9Enabled?(this._backGroundImage=new ccui.Scale9Sprite,this._backGroundImage.setPreferredSize(a)):this._backGroundImage=new cc.Sprite;this.addProtectedChild(this._backGroundImage,
ccui.Layout.BACKGROUND_IMAGE_ZORDER,-1);this._backGroundImage.setPosition(0.5*a.width,0.5*a.height)},removeBackGroundImage:function(){this._backGroundImage&&(this.removeProtectedChild(this._backGroundImage),this._backGroundImage=null,this._backGroundImageFileName="",this._backGroundImageTextureSize.width=0,this._backGroundImageTextureSize.height=0)},setBackGroundColorType:function(a){if(this._colorType!==a){switch(this._colorType){case ccui.Layout.BG_COLOR_NONE:this._colorRender&&(this.removeProtectedChild(this._colorRender),
this._colorRender=null);this._gradientRender&&(this.removeProtectedChild(this._gradientRender),this._gradientRender=null);break;case ccui.Layout.BG_COLOR_SOLID:this._colorRender&&(this.removeProtectedChild(this._colorRender),this._colorRender=null);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender&&(this.removeProtectedChild(this._gradientRender),this._gradientRender=null)}this._colorType=a;switch(this._colorType){case ccui.Layout.BG_COLOR_SOLID:this._colorRender=new cc.LayerColor;this._colorRender.setContentSize(this._contentSize);
this._colorRender.setOpacity(this._opacity);this._colorRender.setColor(this._color);this.addProtectedChild(this._colorRender,ccui.Layout.BACKGROUND_RENDERER_ZORDER,-1);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender=new cc.LayerGradient(cc.color(255,0,0,255),cc.color(0,255,0,255)),this._gradientRender.setContentSize(this._contentSize),this._gradientRender.setOpacity(this._opacity),this._gradientRender.setStartColor(this._startColor),this._gradientRender.setEndColor(this._endColor),this._gradientRender.setVector(this._alongVector),
this.addProtectedChild(this._gradientRender,ccui.Layout.BACKGROUND_RENDERER_ZORDER,-1)}}},getBackGroundColorType:function(){return this._colorType},setBackGroundColor:function(a,b){b?(this._startColor.r=a.r,this._startColor.g=a.g,this._startColor.b=a.b,this._gradientRender&&this._gradientRender.setStartColor(a),this._endColor.r=b.r,this._endColor.g=b.g,this._endColor.b=b.b,this._gradientRender&&this._gradientRender.setEndColor(b)):(this._color.r=a.r,this._color.g=a.g,this._color.b=a.b,this._colorRender&&
this._colorRender.setColor(a))},getBackGroundColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundStartColor:function(){var a=this._startColor;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundEndColor:function(){var a=this._endColor;return cc.color(a.r,a.g,a.b,a.a)},setBackGroundColorOpacity:function(a){this._opacity=a;switch(this._colorType){case ccui.Layout.BG_COLOR_SOLID:this._colorRender.setOpacity(a);break;case ccui.Layout.BG_COLOR_GRADIENT:this._gradientRender.setOpacity(a)}},
getBackGroundColorOpacity:function(){return this._opacity},setBackGroundColorVector:function(a){this._alongVector.x=a.x;this._alongVector.y=a.y;this._gradientRender&&this._gradientRender.setVector(a)},getBackGroundColorVector:function(){return this._alongVector},setBackGroundImageColor:function(a){this._backGroundImageColor.r=a.r;this._backGroundImageColor.g=a.g;this._backGroundImageColor.b=a.b;this._updateBackGroundImageColor()},setBackGroundImageOpacity:function(a){this._backGroundImageColor.a=
a;this.getBackGroundImageColor()},getBackGroundImageColor:function(){var a=this._backGroundImageColor;return cc.color(a.r,a.g,a.b,a.a)},getBackGroundImageOpacity:function(){return this._backGroundImageColor.a},_updateBackGroundImageColor:function(){this._backGroundImage&&this._backGroundImage.setColor(this._backGroundImageColor)},getBackGroundImageTextureSize:function(){return this._backGroundImageTextureSize},setLayoutType:function(a){this._layoutType=a;a=this._children;for(var b=null,c=0;c<a.length;c++)b=
a[c],b instanceof ccui.Widget&&this._supplyTheLayoutParameterLackToChild(b);this._doLayoutDirty=!0},getLayoutType:function(){return this._layoutType},requestDoLayout:function(){this._doLayoutDirty=!0},_doLayout:function(){if(this._doLayoutDirty){this.sortAllChildren();var a=ccui.getLayoutManager(this._layoutType);a&&a._doLayout(this);this._doLayoutDirty=!1}},_getLayoutContentSize:function(){return this.getContentSize()},_getLayoutElements:function(){return this.getChildren()},_updateBackGroundImageOpacity:function(){this._backGroundImage&&
this._backGroundImage.setOpacity(this._backGroundImageOpacity)},_updateBackGroundImageRGBA:function(){this._backGroundImage&&(this._backGroundImage.setColor(this._backGroundImageColor),this._backGroundImage.setOpacity(this._backGroundImageOpacity))},_getLayoutAccumulatedSize:function(){for(var a=this.getChildren(),b=cc.size(0,0),c=0,d,e=0,f=a.length;e<f;e++)if(d=a[e],null!==d&&d instanceof ccui.Layout)d=d._getLayoutAccumulatedSize(),b.width+=d.width,b.height+=d.height;else if(d instanceof ccui.Widget){c++;
var h=d.getLayoutParameter().getMargin();d=d.getContentSize();b.width+=d.width+0.5*(h.right+h.left);b.height+=d.height+0.5*(h.top+h.bottom)}a=this.getLayoutType();a===ccui.Layout.LINEAR_HORIZONTAL&&(b.height-=b.height/c*(c-1));a===ccui.Layout.LINEAR_VERTICAL&&(b.width-=b.width/c*(c-1));return b},_findNearestChildWidgetIndex:function(a,b){if(null==b||b===this)return this._findFirstFocusEnabledWidgetIndex();var c=0,d=this.getChildren(),e=d.length,f,h=cc.FLT_MAX,k=0;if(a===ccui.Widget.LEFT||a===ccui.Widget.RIGHT||
a===ccui.Widget.DOWN||a===ccui.Widget.UP){for(f=this._getWorldCenterPoint(b);c<e;){var m=d[c];m&&m instanceof ccui.Widget&&m.isFocusEnabled()&&(m=m instanceof ccui.Layout?m._calculateNearestDistance(b):cc.pLength(cc.pSub(this._getWorldCenterPoint(m),f)),m<h&&(k=c,h=m));c++}return k}cc.log("invalid focus direction!");return 0},_findFarthestChildWidgetIndex:function(a,b){if(null==b||b===this)return this._findFirstFocusEnabledWidgetIndex();var c=0,d=this.getChildren(),e=d.length,f=-cc.FLT_MAX,h=0;if(a===
ccui.Widget.LEFT||a===ccui.Widget.RIGHT||a===ccui.Widget.DOWN||a===ccui.Widget.UP){for(var k=this._getWorldCenterPoint(b);c<e;){var m=d[c];m&&m instanceof ccui.Widget&&m.isFocusEnabled()&&(m=m instanceof ccui.Layout?m._calculateFarthestDistance(b):cc.pLength(cc.pSub(this._getWorldCenterPoint(m),k)),m>f&&(h=c,f=m));c++}return h}cc.log("invalid focus direction!!!");return 0},_calculateNearestDistance:function(a){for(var b=cc.FLT_MAX,c=this._getWorldCenterPoint(a),d=this._children,e=0,f=d.length;e<f;e++){var h=
d[e];if(h instanceof ccui.Layout)h=h._calculateNearestDistance(a);else if(h instanceof ccui.Widget&&h.isFocusEnabled())h=cc.pLength(cc.pSub(this._getWorldCenterPoint(h),c));else continue;h<b&&(b=h)}return b},_calculateFarthestDistance:function(a){for(var b=-cc.FLT_MAX,c=this._getWorldCenterPoint(a),d=this._children,e=0,f=d.length;e<f;e++){var h=d[e];if(h instanceof ccui.Layout)h=h._calculateFarthestDistance(a);else if(h instanceof ccui.Widget&&h.isFocusEnabled())h=this._getWorldCenterPoint(h),h=cc.pLength(cc.pSub(h,
c));else continue;h>b&&(b=h)}return b},_findProperSearchingFunctor:function(a,b){if(void 0!==b){var c=this._getWorldCenterPoint(b),d=this._getWorldCenterPoint(this._findFirstNonLayoutWidget());a===ccui.Widget.LEFT?this.onPassFocusToChild=c.x>d.x?this._findNearestChildWidgetIndex:this._findFarthestChildWidgetIndex:a===ccui.Widget.RIGHT?this.onPassFocusToChild=c.x>d.x?this._findFarthestChildWidgetIndex:this._findNearestChildWidgetIndex:a===ccui.Widget.DOWN?this.onPassFocusToChild=c.y>d.y?this._findNearestChildWidgetIndex:
this._findFarthestChildWidgetIndex:a===ccui.Widget.UP?this.onPassFocusToChild=c.y<d.y?this._findNearestChildWidgetIndex:this._findFarthestChildWidgetIndex:cc.log("invalid direction!")}},_findFirstNonLayoutWidget:function(){for(var a=this._children,b=0,c=a.length;b<c;b++){var d=a[b];if(d instanceof ccui.Layout){if(d=d._findFirstNonLayoutWidget())return d}else if(d instanceof ccui.Widget)return d}return null},_findFirstFocusEnabledWidgetIndex:function(){for(var a=0,b=this.getChildren(),c=b.length;a<
c;){var d=b[a];if(d&&d instanceof ccui.Widget&&d.isFocusEnabled())return a;a++}return 0},_findFocusEnabledChildWidgetByIndex:function(a){var b=this._getChildWidgetByIndex(a);return b?b.isFocusEnabled()?b:this._findFocusEnabledChildWidgetByIndex(a+1):null},_getWorldCenterPoint:function(a){var b=a instanceof ccui.Layout?a._getLayoutAccumulatedSize():a.getContentSize();return a.convertToWorldSpace(cc.p(b.width/2,b.height/2))},_getNextFocusedWidget:function(a,b){var c=null,c=this._children,d=c.indexOf(b),
d=d+1;if(d<c.length){if(c=this._getChildWidgetByIndex(d)){if(c.isFocusEnabled()){if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getNextFocusedWidget(a,c)}return b}if(this._loopFocus){if(this._checkFocusEnabledChild()){c=this._getChildWidgetByIndex(0);if(c.isFocusEnabled()){if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getNextFocusedWidget(a,
c)}return b instanceof ccui.Layout?b:ccui.Widget._focusedWidget}return this._isLastWidgetInContainer(b,a)?this._isWidgetAncestorSupportLoopFocus(this,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b instanceof ccui.Layout?b:ccui.Widget._focusedWidget:ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this)},_getPreviousFocusedWidget:function(a,b){var c=null,c=this._children,d=c.indexOf(b),d=d-1;if(0<=d){c=this._getChildWidgetByIndex(d);if(c.isFocusEnabled()){if(c instanceof
ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getPreviousFocusedWidget(a,c)}if(this._loopFocus){if(this._checkFocusEnabledChild()){d=c.length-1;c=this._getChildWidgetByIndex(d);if(c.isFocusEnabled()){if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,c);this.dispatchFocusEvent(b,c);return c}return this._getPreviousFocusedWidget(a,c)}return b instanceof ccui.Layout?b:ccui.Widget._focusedWidget}return this._isLastWidgetInContainer(b,
a)?this._isWidgetAncestorSupportLoopFocus(this,a)?ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this):b instanceof ccui.Layout?b:ccui.Widget._focusedWidget:ccui.Widget.prototype.findNextFocusedWidget.call(this,a,this)},_getChildWidgetByIndex:function(a){for(var b=this._children,c=b.length,d=0,e=a;a<c;){var f=b[a];if(f&&f instanceof ccui.Widget)return f;d++;a++}for(a=0;a<e;){if((c=b[a])&&c instanceof ccui.Widget)return c;d++;a++}return null},_isLastWidgetInContainer:function(a,b){var c=a.getParent();
if(null==c||!(c instanceof ccui.Layout))return!0;var d=c.getChildren(),e=d.indexOf(a);if(c.getLayoutType()===ccui.Layout.LINEAR_HORIZONTAL){if(b===ccui.Widget.LEFT)return 0===e?this._isLastWidgetInContainer(c,b):!1;if(b===ccui.Widget.RIGHT)return e===d.length-1?this._isLastWidgetInContainer(c,b):!1;if(b===ccui.Widget.DOWN||b===ccui.Widget.UP)return this._isLastWidgetInContainer(c,b)}else if(c.getLayoutType()===ccui.Layout.LINEAR_VERTICAL){if(b===ccui.Widget.UP)return 0===e?this._isLastWidgetInContainer(c,
b):!1;if(b===ccui.Widget.DOWN)return e===d.length-1?this._isLastWidgetInContainer(c,b):!1;if(b===ccui.Widget.LEFT||b===ccui.Widget.RIGHT)return this._isLastWidgetInContainer(c,b)}else return cc.log("invalid layout Type"),!1},_isWidgetAncestorSupportLoopFocus:function(a,b){var c=a.getParent();if(null==c||!(c instanceof ccui.Layout))return!1;if(c.isLoopFocus()){var d=c.getLayoutType();if(d===ccui.Layout.LINEAR_HORIZONTAL)return b===ccui.Widget.LEFT||b===ccui.Widget.RIGHT?!0:this._isWidgetAncestorSupportLoopFocus(c,
b);if(d===ccui.Layout.LINEAR_VERTICAL)return b===ccui.Widget.DOWN||b===ccui.Widget.UP?!0:this._isWidgetAncestorSupportLoopFocus(c,b);cc.assert(0,"invalid layout type");return!1}return this._isWidgetAncestorSupportLoopFocus(c,b)},_passFocusToChild:function(a,b){if(this._checkFocusEnabledChild()){var c=ccui.Widget.getCurrentFocusedWidget();this._findProperSearchingFunctor(a,c);c=this.onPassFocusToChild(a,c);c=this._getChildWidgetByIndex(c);if(c instanceof ccui.Layout)return c._isFocusPassing=!0,c.findNextFocusedWidget(a,
c);this.dispatchFocusEvent(b,c);return c}return this},_checkFocusEnabledChild:function(){for(var a=this._children,b=0,c=a.length;b<c;b++){var d=a[b];if(d&&d instanceof ccui.Widget&&d.isFocusEnabled())return!0}return!1},getDescription:function(){return"Layout"},_createCloneInstance:function(){return new ccui.Layout},_copyClonedWidgetChildren:function(a){ccui.Widget.prototype._copyClonedWidgetChildren.call(this,a)},_copySpecialProperties:function(a){a instanceof ccui.Layout&&(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),this._loopFocus=a._loopFocus,this.__passFocusToChild=
a.__passFocusToChild,this._isInterceptTouch=a._isInterceptTouch)},forceDoLayout:function(){this.requestDoLayout();this._doLayout()},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new ccui.Layout.WebGLRenderCmd(this):new ccui.Layout.CanvasRenderCmd(this)}});_p=ccui.Layout.prototype;cc.defineGetterSetter(_p,"clippingEnabled",_p.isClippingEnabled,_p.setClippingEnabled);cc.defineGetterSetter(_p,"clippingType",null,_p.setClippingType);
cc.defineGetterSetter(_p,"layoutType",_p.getLayoutType,_p.setLayoutType);_p=null;ccui.Layout.create=function(){return new ccui.Layout};ccui.Layout.BG_COLOR_NONE=0;ccui.Layout.BG_COLOR_SOLID=1;ccui.Layout.BG_COLOR_GRADIENT=2;ccui.Layout.ABSOLUTE=0;ccui.Layout.LINEAR_VERTICAL=1;ccui.Layout.LINEAR_HORIZONTAL=2;ccui.Layout.RELATIVE=3;ccui.Layout.CLIPPING_STENCIL=0;ccui.Layout.CLIPPING_SCISSOR=1;ccui.Layout.BACKGROUND_IMAGE_ZORDER=-1;ccui.Layout.BACKGROUND_RENDERER_ZORDER=-2;(function(){ccui.Layout.CanvasRenderCmd=function(a){this._pNodeCmdCtor(a);this._needDraw=!1;this._rendererRestoreCmd=this._rendererClipCmd=this._rendererSaveCmd=null};var a=ccui.Layout.CanvasRenderCmd.prototype=Object.create(ccui.ProtectedNode.CanvasRenderCmd.prototype);a.constructor=ccui.Layout.CanvasRenderCmd;a._layoutCmdCtor=ccui.Layout.CanvasRenderCmd;a._onRenderSaveCmd=function(a,c,d){var e=a||cc._renderContext;a=e.getContext();e.save();e.save();e.setTransform(this._worldTransform,c,d);c=this._node._clippingStencil._renderCmd._buffer;
d=0;for(e=c.length;d<e;d++){var f=c[d].verts,h=f[0];a.beginPath();a.moveTo(h.x,-h.y);for(var h=1,k=f.length;h<k;h++)a.lineTo(f[h].x,-f[h].y);a.closePath()}};a._onRenderClipCmd=function(a){a=a||cc._renderContext;var c=a.getContext();a.restore();c.clip()};a._onRenderRestoreCmd=function(a){a=a||cc._renderContext;a.getContext();a.restore()};a.rebindStencilRendering=function(a){a._renderCmd.rendering=this.__stencilDraw;a._renderCmd._canUseDirtyRegion=!0};a.__stencilDraw=function(a,c,d){};a.stencilClippingVisit=
a.scissorClippingVisit=function(a){a=this._node;a._clippingStencil&&a._clippingStencil.isVisible()&&(this._rendererSaveCmd||(this._rendererSaveCmd=new cc.CustomRenderCmd(this,this._onRenderSaveCmd),this._rendererClipCmd=new cc.CustomRenderCmd(this,this._onRenderClipCmd),this._rendererRestoreCmd=new cc.CustomRenderCmd(this,this._onRenderRestoreCmd)),cc.renderer.pushRenderCommand(this._rendererSaveCmd),a._clippingStencil.visit(this),cc.renderer.pushRenderCommand(this._rendererClipCmd))};a.postStencilVisit=
a.postScissorVisit=function(){cc.renderer.pushRenderCommand(this._rendererRestoreCmd)};ccui.Layout.CanvasRenderCmd._getSharedCache=function(){return cc.ClippingNode._sharedCache||(cc.ClippingNode._sharedCache=document.createElement("canvas"))}})();(function(){if(ccui.ProtectedNode.WebGLRenderCmd){ccui.Layout.WebGLRenderCmd=function(a){this._pNodeCmdCtor(a);this._needDraw=!1;this._currentStencilEnabled=0;this._scissorOldState=!1;this._clippingOldRect=null;this._mask_layer_le=0;this._afterVisitCmdScissor=this._beforeVisitCmdScissor=this._afterVisitCmdStencil=this._afterDrawStencilCmd=this._beforeVisitCmdStencil=null};var a=ccui.Layout.WebGLRenderCmd.prototype=Object.create(ccui.ProtectedNode.WebGLRenderCmd.prototype);a.constructor=ccui.Layout.WebGLRenderCmd;
a._layoutCmdCtor=ccui.Layout.CanvasRenderCmd;a._syncStatus=function(a){this._originSyncStatus(a);a&&a._dirtyFlag&cc.Node._dirtyFlags.transformDirty&&(this._node._clippingRectDirty=!0)};a._onBeforeVisitStencil=function(a){a=a||cc._renderContext;ccui.Layout.WebGLRenderCmd._layer++;var c=1<<ccui.Layout.WebGLRenderCmd._layer;this._mask_layer_le=c|c-1;this._currentStencilEnabled=a.isEnabled(a.STENCIL_TEST);a.clear(a.DEPTH_BUFFER_BIT);a.enable(a.STENCIL_TEST);a.depthMask(!1);a.stencilFunc(a.NEVER,c,c);
a.stencilOp(a.REPLACE,a.KEEP,a.KEEP);a.stencilMask(c);a.clear(a.STENCIL_BUFFER_BIT)};a._onAfterDrawStencil=function(a){a=a||cc._renderContext;a.depthMask(!0);a.stencilFunc(a.EQUAL,this._mask_layer_le,this._mask_layer_le);a.stencilOp(a.KEEP,a.KEEP,a.KEEP)};a._onAfterVisitStencil=function(a){a=a||cc._renderContext;ccui.Layout.WebGLRenderCmd._layer--;if(this._currentStencilEnabled){var c=1<<ccui.Layout.WebGLRenderCmd._layer,d=c|c-1;a.stencilMask(c);a.stencilFunc(a.EQUAL,d,d)}else a.disable(a.STENCIL_TEST)};
a._onBeforeVisitScissor=function(a){this._node._clippingRectDirty=!0;var c=this._node._getClippingRect();a=a||cc._renderContext;(this._scissorOldState=a.isEnabled(a.SCISSOR_TEST))?(this._clippingOldRect=cc.view.getScissorRect(),cc.rectEqualToRect(this._clippingOldRect,c)||cc.view.setScissorInPoints(c.x,c.y,c.width,c.height)):(a.enable(a.SCISSOR_TEST),cc.view.setScissorInPoints(c.x,c.y,c.width,c.height))};a._onAfterVisitScissor=function(a){a=a||cc._renderContext;this._scissorOldState?cc.rectEqualToRect(this._clippingOldRect,
this._node._clippingRect)||cc.view.setScissorInPoints(this._clippingOldRect.x,this._clippingOldRect.y,this._clippingOldRect.width,this._clippingOldRect.height):a.disable(a.SCISSOR_TEST)};a.rebindStencilRendering=function(a){};a.transform=function(a,c){var d=this._node;this.pNodeTransform(a,c);d._clippingStencil&&d._clippingStencil._renderCmd.transform(this,c)};a.stencilClippingVisit=function(a){a=this._node;if(a._clippingStencil&&a._clippingStencil.isVisible())if(ccui.Layout.WebGLRenderCmd._layer+
1===cc.stencilBits)ccui.Layout.WebGLRenderCmd._visit_once=!0,ccui.Layout.WebGLRenderCmd._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its childs."),ccui.Layout.WebGLRenderCmd._visit_once=!1);else{this._beforeVisitCmdStencil||(this._beforeVisitCmdStencil=new cc.CustomRenderCmd(this,this._onBeforeVisitStencil),this._afterDrawStencilCmd=new cc.CustomRenderCmd(this,this._onAfterDrawStencil),this._afterVisitCmdStencil=
new cc.CustomRenderCmd(this,this._onAfterVisitStencil));cc.renderer.pushRenderCommand(this._beforeVisitCmdStencil);var c=cc.current_stack;c.stack.push(c.top);c.top=this._stackMatrix;a._clippingStencil.visit(this);cc.renderer.pushRenderCommand(this._afterDrawStencilCmd)}};a.postStencilVisit=function(){renderer.pushRenderCommand(cmd._afterVisitCmdStencil);cc.current_stack.top=cc.current_stack.stack.pop()};a.scissorClippingVisit=function(a){this._beforeVisitCmdScissor||(this._beforeVisitCmdScissor=new cc.CustomRenderCmd(this,
this._onBeforeVisitScissor),this._afterVisitCmdScissor=new cc.CustomRenderCmd(this,this._onAfterVisitScissor));cc.renderer.pushRenderCommand(this._beforeVisitCmdScissor)};a.postScissorVisit=function(){cc.renderer.pushRenderCommand(this._afterVisitCmdScissor)};ccui.Layout.WebGLRenderCmd._layer=-1;ccui.Layout.WebGLRenderCmd._visit_once=null}})();ccui.Margin=ccui.Class.extend({left:0,top:0,right:0,bottom:0,ctor:function(a,b,c,d){void 0!==a&&void 0===b&&(this.left=a.left,this.top=a.top,this.right=a.right,this.bottom=a.bottom);void 0!==d&&(this.left=a,this.top=b,this.right=c,this.bottom=d)},setMargin:function(a,b,c,d){this.left=a;this.top=b;this.right=c;this.bottom=d},equals:function(a){return this.left===a.left&&this.top===a.top&&this.right===a.right&&this.bottom===a.bottom}});ccui.MarginZero=function(){return new ccui.Margin(0,0,0,0)};
ccui.LayoutParameter=ccui.Class.extend({_margin:null,_layoutParameterType:null,ctor:function(){this._margin=new ccui.Margin;this._layoutParameterType=ccui.LayoutParameter.NONE},setMargin:function(a,b,c,d){cc.isObject(a)?(this._margin.left=a.left,this._margin.top=a.top,this._margin.right=a.right,this._margin.bottom=a.bottom):(this._margin.left=a,this._margin.top=b,this._margin.right=c,this._margin.bottom=d)},getMargin:function(){return this._margin},getLayoutType:function(){return this._layoutParameterType},
clone:function(){var a=this._createCloneInstance();a._copyProperties(this);return a},_createCloneInstance:function(){return new ccui.LayoutParameter},_copyProperties:function(a){this._margin.bottom=a._margin.bottom;this._margin.left=a._margin.left;this._margin.right=a._margin.right;this._margin.top=a._margin.top}});ccui.LayoutParameter.create=function(){return new ccui.LayoutParameter};ccui.LayoutParameter.NONE=0;ccui.LayoutParameter.LINEAR=1;ccui.LayoutParameter.RELATIVE=2;
ccui.LinearLayoutParameter=ccui.LayoutParameter.extend({_linearGravity:null,ctor:function(){ccui.LayoutParameter.prototype.ctor.call(this);this._linearGravity=ccui.LinearLayoutParameter.NONE;this._layoutParameterType=ccui.LayoutParameter.LINEAR},setGravity:function(a){this._linearGravity=a},getGravity:function(){return this._linearGravity},_createCloneInstance:function(){return new ccui.LinearLayoutParameter},_copyProperties:function(a){ccui.LayoutParameter.prototype._copyProperties.call(this,a);
a instanceof ccui.LinearLayoutParameter&&this.setGravity(a._linearGravity)}});ccui.LinearLayoutParameter.create=function(){return new ccui.LinearLayoutParameter};ccui.LinearLayoutParameter.NONE=0;ccui.LinearLayoutParameter.LEFT=1;ccui.LinearLayoutParameter.TOP=2;ccui.LinearLayoutParameter.RIGHT=3;ccui.LinearLayoutParameter.BOTTOM=4;ccui.LinearLayoutParameter.CENTER_VERTICAL=5;ccui.LinearLayoutParameter.CENTER_HORIZONTAL=6;
ccui.RelativeLayoutParameter=ccui.LayoutParameter.extend({_relativeAlign:null,_relativeWidgetName:"",_relativeLayoutName:"",_put:!1,ctor:function(){ccui.LayoutParameter.prototype.ctor.call(this);this._relativeAlign=ccui.RelativeLayoutParameter.NONE;this._relativeLayoutName=this._relativeWidgetName="";this._put=!1;this._layoutParameterType=ccui.LayoutParameter.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 new ccui.RelativeLayoutParameter},_copyProperties:function(a){ccui.LayoutParameter.prototype._copyProperties.call(this,a);a instanceof ccui.RelativeLayoutParameter&&(this.setAlign(a._relativeAlign),this.setRelativeToWidgetName(a._relativeWidgetName),this.setRelativeName(a._relativeLayoutName))}});
ccui.RelativeLayoutParameter.create=function(){return new ccui.RelativeLayoutParameter};ccui.RelativeLayoutParameter.NONE=0;ccui.RelativeLayoutParameter.PARENT_TOP_LEFT=1;ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL=2;ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT=3;ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL=4;ccui.RelativeLayoutParameter.CENTER_IN_PARENT=5;ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL=6;ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM=7;
ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL=8;ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM=9;ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN=10;ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER=11;ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN=12;ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN=13;ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER=14;ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN=15;
ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN=16;ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER=17;ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN=18;ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN=19;ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER=20;ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN=21;ccui.LINEAR_GRAVITY_NONE=0;ccui.LINEAR_GRAVITY_LEFT=1;ccui.LINEAR_GRAVITY_TOP=2;ccui.LINEAR_GRAVITY_RIGHT=3;ccui.LINEAR_GRAVITY_BOTTOM=4;
ccui.LINEAR_GRAVITY_CENTER_VERTICAL=5;ccui.LINEAR_GRAVITY_CENTER_HORIZONTAL=6;ccui.RELATIVE_ALIGN_NONE=0;ccui.RELATIVE_ALIGN_PARENT_TOP_LEFT=1;ccui.RELATIVE_ALIGN_PARENT_TOP_CENTER_HORIZONTAL=2;ccui.RELATIVE_ALIGN_PARENT_TOP_RIGHT=3;ccui.RELATIVE_ALIGN_PARENT_LEFT_CENTER_VERTICAL=4;ccui.RELATIVE_ALIGN_PARENT_CENTER=5;ccui.RELATIVE_ALIGN_PARENT_RIGHT_CENTER_VERTICAL=6;ccui.RELATIVE_ALIGN_PARENT_LEFT_BOTTOM=7;ccui.RELATIVE_ALIGN_PARENT_BOTTOM_CENTER_HORIZONTAL=8;
ccui.RELATIVE_ALIGN_PARENT_RIGHT_BOTTOM=9;ccui.RELATIVE_ALIGN_LOCATION_ABOVE_LEFT=10;ccui.RELATIVE_ALIGN_LOCATION_ABOVE_CENTER=11;ccui.RELATIVE_ALIGN_LOCATION_ABOVE_RIGHT=12;ccui.RELATIVE_ALIGN_LOCATION_LEFT_TOP=13;ccui.RELATIVE_ALIGN_LOCATION_LEFT_CENTER=14;ccui.RELATIVE_ALIGN_LOCATION_LEFT_BOTTOM=15;ccui.RELATIVE_ALIGN_LOCATION_RIGHT_TOP=16;ccui.RELATIVE_ALIGN_LOCATION_RIGHT_CENTER=17;ccui.RELATIVE_ALIGN_LOCATION_RIGHT_BOTTOM=18;ccui.RELATIVE_ALIGN_LOCATION_BELOW_TOP=19;
ccui.RELATIVE_ALIGN_LOCATION_BELOW_CENTER=20;ccui.RELATIVE_ALIGN_LOCATION_BELOW_BOTTOM=21;ccui.getLayoutManager=function(a){switch(a){case ccui.Layout.LINEAR_VERTICAL:return ccui.linearVerticalLayoutManager;case ccui.Layout.LINEAR_HORIZONTAL:return ccui.linearHorizontalLayoutManager;case ccui.Layout.RELATIVE:return ccui.relativeLayoutManager}return null};
ccui.linearVerticalLayoutManager={_doLayout:function(a){var b=a._getLayoutContentSize();a=a._getLayoutElements();for(var c=b.height,d=0,e=a.length;d<e;d++){var f=a[d];if(f){var h=f.getLayoutParameter();if(h){var k=h.getGravity(),m=f.getAnchorPoint(),n=f.getContentSize(),p=m.x*n.width,c=c-(1-m.y)*n.height;switch(k){case ccui.LinearLayoutParameter.RIGHT:p=b.width-(1-m.x)*n.width;break;case ccui.LinearLayoutParameter.CENTER_HORIZONTAL:p=b.width/2-n.width*(0.5-m.x)}h=h.getMargin();p+=h.left;c-=h.top;
f.setPosition(p,c);c=f.getPositionY()-m.y*n.height-h.bottom}}}}};
ccui.linearHorizontalLayoutManager={_doLayout:function(a){var b=a._getLayoutContentSize();a=a._getLayoutElements();for(var c=0,d=0,e=a.length;d<e;d++){var f=a[d];if(f){var h=f.getLayoutParameter();if(h){var k=h.getGravity(),m=f.getAnchorPoint(),n=f.getContentSize(),c=c+m.x*n.width,p=b.height-(1-m.y)*n.height;switch(k){case ccui.LinearLayoutParameter.BOTTOM:p=m.y*n.height;break;case ccui.LinearLayoutParameter.CENTER_VERTICAL:p=b.height/2-n.height*(0.5-m.y)}h=h.getMargin();c+=h.left;p-=h.top;f.setPosition(c,
p);c=f.getRightBoundary()+h.right}}}}};
ccui.relativeLayoutManager={_unlayoutChildCount:0,_widgetChildren:[],_widget:null,_finalPositionX:0,_finalPositionY:0,_relativeWidgetLP:null,_doLayout:function(a){for(var b=this._widgetChildren=this._getAllWidgets(a);0<this._unlayoutChildCount;){for(var c=0,d=b.length;c<d;c++){this._widget=b[c];var e=this._widget.getLayoutParameter();e&&!e._put&&this._calculateFinalPositionWithRelativeWidget(a)&&(this._calculateFinalPositionWithRelativeAlign(),this._widget.setPosition(this._finalPositionX,this._finalPositionY),
e._put=!0)}this._unlayoutChildCount--}this._widgetChildren.length=0},_getAllWidgets:function(a){a=a._getLayoutElements();for(var b=this._widgetChildren,c=b.length=0,d=a.length;c<d;c++){var e=a[c];e&&e instanceof ccui.Widget&&(e.getLayoutParameter()._put=!1,this._unlayoutChildCount++,b.push(e))}return b},_getRelativeWidget:function(a){var b=null;if((a=a.getLayoutParameter().getRelativeToWidgetName())&&0!==a.length)for(var c=this._widgetChildren,d=0,e=c.length;d<e;d++){var f=c[d];if(f){var h=f.getLayoutParameter();
if(h&&h.getRelativeName()===a){b=f;this._relativeWidgetLP=h;break}}}return b},_calculateFinalPositionWithRelativeWidget:function(a){var b=this._widget,c=b.getAnchorPoint(),d=b.getContentSize();this._finalPositionY=this._finalPositionX=0;var e=this._getRelativeWidget(b),b=b.getLayoutParameter().getAlign();a=a._getLayoutContentSize();switch(b){case ccui.RelativeLayoutParameter.NONE:case ccui.RelativeLayoutParameter.PARENT_TOP_LEFT:this._finalPositionX=c.x*d.width;this._finalPositionY=a.height-(1-c.y)*
d.height;break;case ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL:this._finalPositionX=0.5*a.width-d.width*(0.5-c.x);this._finalPositionY=a.height-(1-c.y)*d.height;break;case ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT:this._finalPositionX=a.width-(1-c.x)*d.width;this._finalPositionY=a.height-(1-c.y)*d.height;break;case ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL:this._finalPositionX=c.x*d.width;this._finalPositionY=0.5*a.height-d.height*(0.5-c.y);break;case ccui.RelativeLayoutParameter.CENTER_IN_PARENT:this._finalPositionX=
0.5*a.width-d.width*(0.5-c.x);this._finalPositionY=0.5*a.height-d.height*(0.5-c.y);break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL:this._finalPositionX=a.width-(1-c.x)*d.width;this._finalPositionY=0.5*a.height-d.height*(0.5-c.y);break;case ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM:this._finalPositionX=c.x*d.width;this._finalPositionY=c.y*d.height;break;case ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL:this._finalPositionX=0.5*a.width-d.width*(0.5-c.x);this._finalPositionY=
c.y*d.height;break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM:this._finalPositionX=a.width-(1-c.x)*d.width;this._finalPositionY=c.y*d.height;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getTopBoundary()+c.y*d.height;this._finalPositionX=e.getLeftBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;
a=e.getContentSize();this._finalPositionY=e.getTopBoundary()+c.y*d.height;this._finalPositionX=e.getLeftBoundary()+0.5*a.width+c.x*d.width-0.5*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getTopBoundary()+c.y*d.height;this._finalPositionX=e.getRightBoundary()-(1-c.x)*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;
this._finalPositionY=e.getTopBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getLeftBoundary()-(1-c.x)*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;a=e.getContentSize();this._finalPositionX=e.getLeftBoundary()-(1-c.x)*d.width;this._finalPositionY=e.getBottomBoundary()+0.5*a.height+c.y*d.height-0.5*d.height}break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN:if(e){if(this._relativeWidgetLP&&
!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()+c.y*d.height;this._finalPositionX=e.getLeftBoundary()-(1-c.x)*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getTopBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getRightBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;
a=e.getContentSize();this._finalPositionX=e.getRightBoundary()+c.x*d.width;this._finalPositionY=e.getBottomBoundary()+0.5*a.height+c.y*d.height-0.5*d.height}break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()+c.y*d.height;this._finalPositionX=e.getRightBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN:if(e){if(this._relativeWidgetLP&&
!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getLeftBoundary()+c.x*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER:if(e){if(this._relativeWidgetLP&&!this._relativeWidgetLP._put)return!1;a=e.getContentSize();this._finalPositionY=e.getBottomBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getLeftBoundary()+0.5*a.width+c.x*d.width-0.5*d.width}break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN:if(e){if(this._relativeWidgetLP&&
!this._relativeWidgetLP._put)return!1;this._finalPositionY=e.getBottomBoundary()-(1-c.y)*d.height;this._finalPositionX=e.getRightBoundary()-(1-c.x)*d.width}}return!0},_calculateFinalPositionWithRelativeAlign:function(){var a=this._widget.getLayoutParameter(),b=a.getMargin();switch(a.getAlign()){case ccui.RelativeLayoutParameter.NONE:case ccui.RelativeLayoutParameter.PARENT_TOP_LEFT:this._finalPositionX+=b.left;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL:this._finalPositionY-=
b.top;break;case ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT:this._finalPositionX-=b.right;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL:this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL:this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM:this._finalPositionX+=b.left;this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL:this._finalPositionY+=
b.bottom;break;case ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM:this._finalPositionX-=b.right;this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN:this._finalPositionY+=b.bottom;this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN:this._finalPositionY+=b.bottom;this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER:this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN:this._finalPositionX-=
b.right;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN:this._finalPositionX-=b.right;this._finalPositionY+=b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER:this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN:this._finalPositionX+=b.left;this._finalPositionY-=b.top;break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN:this._finalPositionX+=b.left;this._finalPositionY+=
b.bottom;break;case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER:this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN:this._finalPositionY-=b.top;this._finalPositionX+=b.left;break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN:this._finalPositionY-=b.top;this._finalPositionX-=b.right;break;case ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER:this._finalPositionY-=b.top}}};ccui.HBox=ccui.Layout.extend({ctor:function(a){ccui.Layout.prototype.ctor.call(this);this.setLayoutType(ccui.Layout.LINEAR_HORIZONTAL);a&&this.setContentSize(a)}});ccui.HBox.create=function(a){return new ccui.HBox(a)};ccui.RelativeBox=ccui.Layout.extend({ctor:function(a){ccui.Layout.prototype.ctor.call(this);this.setLayoutType(ccui.Layout.RELATIVE);a&&this.setContentSize(a)}});ccui.RelativeBox.create=function(a){return new ccui.RelativeBox(a)};ccui.VBox=ccui.Layout.extend({ctor:function(a){ccui.Layout.prototype.ctor.call(this);this.setLayoutType(ccui.Layout.LINEAR_VERTICAL);a&&this.setContentSize(a)},initWithSize:function(a){return this.init()?!0:!1}});ccui.VBox.create=function(a){return new ccui.VBox(a)};ccui.helper={seekWidgetByTag:function(a,b){if(!a)return null;if(a.getTag()===b)return a;for(var c=a.getChildren(),d=c.length,e=0;e<d;e++){var f=ccui.helper.seekWidgetByTag(c[e],b);if(null!==f)return f}return null},seekWidgetByName:function(a,b){if(!a)return null;if(a.getName()===b)return a;for(var c=a.getChildren(),d=c.length,e=0;e<d;e++){var f=ccui.helper.seekWidgetByName(c[e],b);if(null!==f)return f}return null},seekWidgetByRelativeName:function(a,b){if(!a)return null;for(var c=a.getChildren(),
d=c.length,e=0;e<d;e++){var f=c[e],h=f.getLayoutParameter(ccui.LayoutParameter.RELATIVE);if(h&&h.getRelativeName()===b)return f}return null},seekActionWidgetByActionTag:function(a,b){if(!a)return null;if(a.getActionTag()===b)return a;for(var c=a.getChildren(),d=0;d<c.length;d++){var e=ccui.helper.seekActionWidgetByActionTag(c[d],b);if(null!==e)return e}return null},_activeLayout:!0,doLayout:function(a){if(this._activeLayout){a=a.getChildren();for(var b,c=0,d=a.length;c<d;c++){b=a[c];var e=b.getComponent(ccui.LayoutComponent.NAME);
b=b.getParent();null!=e&&null!==b&&e.refreshLayout&&e.refreshLayout()}}},changeLayoutSystemActiveState:function(a){this._activeLayout=a},restrictCapInsetRect:function(a,b){var c=a.x,d=a.y,e=a.width,f=a.height;b.width<e&&(e=c=0);b.height<f&&(f=d=0);return cc.rect(c,d,e,f)},_createSpriteFromBase64:function(a,b){var c=cc.textureCache.getTextureForKey(b);c||(c=new Image,c.src=a,cc.textureCache.cacheImage(b,c),c=cc.textureCache.getTextureForKey(b));return new cc.Sprite(c)}};ccui.Button=ccui.Widget.extend({_buttonScale9Renderer:null,_buttonNormalSpriteFrame:null,_buttonClickedSpriteFrame:null,_buttonDisableSpriteFrame:null,_titleRenderer:null,_normalFileName:"",_clickedFileName:"",_disabledFileName:"",_prevIgnoreSize:!0,_scale9Enabled:!1,_capInsetsNormal:null,_normalTexType:ccui.Widget.LOCAL_TEXTURE,_pressedTexType:ccui.Widget.LOCAL_TEXTURE,_disabledTexType:ccui.Widget.LOCAL_TEXTURE,_normalTextureSize:null,pressedActionEnabled:!1,_titleColor:null,_zoomScale:0.1,_normalTextureLoaded:!1,
_pressedTextureLoaded:!1,_disabledTextureLoaded:!1,_className:"Button",_normalTextureAdaptDirty:!0,_fontName:"Thonburi",_fontSize:12,_type:0,ctor:function(a,b,c,d){this._capInsetsNormal=cc.rect(0,0,0,0);this._normalTextureSize=cc.size(0,0);ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0);this._normalLoader=new cc.Sprite.LoadManager;this._clickedLoader=new cc.Sprite.LoadManager;this._disabledLoader=new cc.Sprite.LoadManager;a&&this.loadTextures(a,b,c,d)},_createTitleRendererIfNeeded:function(){this._titleRenderer||
(this._titleRenderer=new cc.LabelTTF(""),this._titleRenderer.setAnchorPoint(0.5,0.5),this._titleColor=cc.color.WHITE,this._titleRenderer.setVerticalAlignment(cc.VERTICAL_TEXT_ALIGNMENT_CENTER),this.addProtectedChild(this._titleRenderer,ccui.Button.TITLE_RENDERER_ZORDER,-1))},_initRenderer:function(){this._buttonScale9Renderer=new ccui.Scale9Sprite;this._buttonScale9Renderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE);this.addProtectedChild(this._buttonScale9Renderer,ccui.Button.DISABLED_RENDERER_ZORDER,
-1)},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._brightStyle=ccui.Widget.BRIGHT_STYLE_NONE,(this._scale9Enabled=a)?this._buttonScale9Renderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SLICED):this._buttonScale9Renderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsetsNormal),this.setBright(this._bright),
this._normalTextureAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(this._unifySize)this._updateContentSize();else if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},getVirtualRendererSize:function(){return this._unifySize?this._getNormalSize():!this._normalTextureLoaded&&this._titleRenderer&&0<this._titleRenderer.getString().length?this._titleRenderer.getContentSize():
cc.size(this._normalTextureSize)},loadTextures:function(a,b,c,d){this.loadTextureNormal(a,d);this.loadTexturePressed(b,d);this.loadTextureDisabled(c,d)},_createSpriteFrameWithFile:function(a){var b=cc.textureCache.getTextureForKey(a);b||(b=cc.textureCache.addImage(a));if(!b._textureLoaded)return b;a=b.getContentSize();a=cc.rect(0,0,a.width,a.height);return new cc.SpriteFrame(b,a)},_createSpriteFrameWithName:function(a){a=cc.spriteFrameCache.getSpriteFrame(a);return null==a?(cc.log("ccui.Scale9Sprite.initWithSpriteFrameName(): can't find the sprite frame by spriteFrameName"),
null):a},loadTextureNormal:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._normalFileName=a;this._normalTexType=b;var c;switch(this._normalTexType){case ccui.Widget.LOCAL_TEXTURE:c=this._createSpriteFrameWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:"#"===a[0]&&(a=a.substr(1,a.length-1)),c=this._createSpriteFrameWithName(a)}c&&(c._textureLoaded?(this._normalTextureLoaded=c._textureLoaded,this._buttonNormalSpriteFrame=c,this._buttonScale9Renderer.setSpriteFrame(c),this._scale9Enabled&&
this._buttonScale9Renderer.setCapInsets(this._capInsetsNormal),!this._ignoreSize&&cc.sizeEqualToSize(this._customSize,cc.size(0,0))&&(this._customSize=this._buttonScale9Renderer.getContentSize()),this._normalTextureSize=this._buttonScale9Renderer.getContentSize(),this._updateChildrenDisplayedRGBA(),this._unifySize?this._scale9Enabled&&(this._buttonScale9Renderer.setCapInsets(this._capInsetsNormal),this._updateContentSizeWithTextureSize(this._getNormalSize())):this._updateContentSizeWithTextureSize(this._normalTextureSize),
this._normalTextureAdaptDirty=!0,this._findLayout()):(this._normalLoader.clear(),this._normalLoader.once(c,function(){this.loadTextureNormal(this._normalFileName,this._normalTexType)},this)))}},loadTexturePressed:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._clickedFileName=a;this._pressedTexType=b;var c;switch(this._pressedTexType){case ccui.Widget.LOCAL_TEXTURE:c=this._createSpriteFrameWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:"#"===a[0]&&(a=a.substr(1,a.length-1)),c=this._createSpriteFrameWithName(a)}c&&
(c._textureLoaded?(this._buttonClickedSpriteFrame=c,this._updateChildrenDisplayedRGBA(),this._pressedTextureLoaded=!0):(this._clickedLoader.clear(),this._clickedLoader.once(c,function(){this.loadTexturePressed(this._clickedFileName,this._pressedTexType)},this)))}},loadTextureDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._disabledFileName=a;this._disabledTexType=b;var c;switch(this._disabledTexType){case ccui.Widget.LOCAL_TEXTURE:c=this._createSpriteFrameWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:"#"===
a[0]&&(a=a.substr(1,a.length-1)),c=this._createSpriteFrameWithName(a)}c&&(c._textureLoaded?(this._buttonDisableSpriteFrame=c,this._updateChildrenDisplayedRGBA(),this._disabledTextureLoaded=!0,this._findLayout()):(this._disabledLoader.clear(),this._disabledLoader.once(c,function(){this.loadTextureDisabled(this._disabledFileName,this._disabledTexType)},this)))}},setCapInsets:function(a){this.setCapInsetsNormalRenderer(a)},setCapInsetsNormalRenderer:function(a){if(a&&this._scale9Enabled){var b=a.x,c=
a.y,d=a.width;a=a.height;this._normalTextureSize.width<d&&(d=b=0);this._normalTextureSize.height<a&&(a=c=0);var e=this._capInsetsNormal;e.x=b;e.y=c;e.width=d;e.height=a;this._capInsetsNormal=e;this._buttonScale9Renderer.setCapInsets(e)}},getCapInsetsNormalRenderer:function(){return cc.rect(this._capInsetsNormal)},setCapInsetsPressedRenderer:function(a){this.setCapInsetsNormalRenderer(a)},getCapInsetsPressedRenderer:function(){return cc.rect(this._capInsetsNormal)},setCapInsetsDisabledRenderer:function(a){this.setCapInsetsNormalRenderer(a)},
getCapInsetsDisabledRenderer:function(){return cc.rect(this._capInsetsNormal)},_onPressStateChangedToNormal:function(){this._buttonScale9Renderer.setSpriteFrame(this._buttonNormalSpriteFrame);this._buttonScale9Renderer.setState(ccui.Scale9Sprite.state.NORMAL);if(this._pressedTextureLoaded){if(this.pressedActionEnabled&&(this._buttonScale9Renderer.stopAllActions(),this._buttonScale9Renderer.setScale(1),this._titleRenderer))if(this._titleRenderer.stopAllActions(),this._unifySize){var a=cc.scaleTo(ccui.Button.ZOOM_ACTION_TIME_STEP,
1,1);this._titleRenderer.runAction(a)}else this._titleRenderer.setScaleX(1),this._titleRenderer.setScaleY(1)}else this._buttonScale9Renderer.stopAllActions(),this._buttonScale9Renderer.setScale(1),this._scale9Enabled&&this._buttonScale9Renderer.setColor(cc.color.WHITE),this._titleRenderer&&(this._titleRenderer.stopAllActions(),this._titleRenderer.setScaleX(1),this._titleRenderer.setScaleY(1))},_onPressStateChangedToPressed:function(){this._buttonScale9Renderer.setState(ccui.Scale9Sprite.state.NORMAL);
if(this._pressedTextureLoaded){if(this._buttonScale9Renderer.setSpriteFrame(this._buttonClickedSpriteFrame),this.pressedActionEnabled){this._buttonScale9Renderer.stopAllActions();var a=cc.scaleTo(ccui.Button.ZOOM_ACTION_TIME_STEP,1+this._zoomScale,1+this._zoomScale);this._buttonScale9Renderer.runAction(a);this._titleRenderer&&(this._titleRenderer.stopAllActions(),this._titleRenderer.runAction(cc.scaleTo(ccui.Button.ZOOM_ACTION_TIME_STEP,1+this._zoomScale,1+this._zoomScale)))}}else this._buttonScale9Renderer.setSpriteFrame(this._buttonClickedSpriteFrame),
this._buttonScale9Renderer.stopAllActions(),this._buttonScale9Renderer.setScale(1+this._zoomScale,1+this._zoomScale),this._titleRenderer&&(this._titleRenderer.stopAllActions(),this._titleRenderer.setScaleX(1+this._zoomScale),this._titleRenderer.setScaleY(1+this._zoomScale))},_onPressStateChangedToDisabled:function(){this._disabledTextureLoaded?this._buttonScale9Renderer.setSpriteFrame(this._buttonDisableSpriteFrame):this._normalTextureLoaded&&this._buttonScale9Renderer.setState(ccui.Scale9Sprite.state.GRAY);
this._buttonScale9Renderer.setScale(1)},_updateContentSize:function(){if(this._unifySize){if(this._scale9Enabled)ccui.ProtectedNode.setContentSize(this._customSize);else{var a=this._getNormalSize();ccui.ProtectedNode.setContentSize(a)}this._onSizeChanged()}else this._ignoreSize&&this.setContentSize(this.getVirtualRendererSize())},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._titleRenderer&&this._updateTitleLocation();this._normalTextureAdaptDirty=!0},getVirtualRenderer:function(){return this._buttonScale9Renderer},
_normalTextureScaleChangedWithSize:function(){this._buttonScale9Renderer.setContentSize(this._contentSize);this._buttonScale9Renderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},_adaptRenderers:function(){this._normalTextureAdaptDirty&&(this._normalTextureScaleChangedWithSize(),this._normalTextureAdaptDirty=!1)},_updateTitleLocation:function(){this._titleRenderer.setPosition(0.5*this._contentSize.width,0.5*this._contentSize.height)},setPressedActionEnabled:function(a){this.pressedActionEnabled=
a},setTitleText:function(a){a!==this.getTitleText()&&(this._createTitleRendererIfNeeded(),this._titleRenderer.setString(a),this._ignoreSize?(a=this.getVirtualRendererSize(),this.setContentSize(a)):this._titleRenderer._renderCmd._updateTTF())},getTitleText:function(){return this._titleRenderer?this._titleRenderer.getString():""},setTitleColor:function(a){this._createTitleRendererIfNeeded();this._titleRenderer.setFontFillColor(a)},getTitleColor:function(){return this._titleRenderer?this._titleRenderer._getFillStyle():
cc.color.WHITE},setTitleFontSize:function(a){this._createTitleRendererIfNeeded();this._titleRenderer.setFontSize(a);this._fontSize=a},getTitleFontSize:function(){return this._titleRenderer?this._titleRenderer.getFontSize():this._fontSize},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},getNormalTextureSize:function(){return this._normalTextureSize},setTitleFontName:function(a){this._createTitleRendererIfNeeded();this._titleRenderer.setFontName(a);this._fontName=
a},getTitleRenderer:function(){return this._titleRenderer},getTitleFontName:function(){return this._titleRenderer?this._titleRenderer.getFontName():this._fontName},_setTitleFont:function(a){this._titleRenderer.font=a},_getTitleFont:function(){return this._titleRenderer.font},getDescription:function(){return"Button"},_createCloneInstance:function(){return new ccui.Button},_copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this._capInsetsNormal=a._capInsetsNormal;this.setScale9Enabled(a._scale9Enabled);
this.loadTextureNormal(a._normalFileName,a._normalTexType);this.loadTexturePressed(a._clickedFileName,a._pressedTexType);this.loadTextureDisabled(a._disabledFileName,a._disabledTexType);a._titleRenderer&&a._titleRenderer._string&&(this.setTitleText(a.getTitleText()),this.setTitleFontName(a.getTitleFontName()),this.setTitleFontSize(a.getTitleFontSize()),this.setTitleColor(a.getTitleColor()));this.setPressedActionEnabled(a.pressedActionEnabled);this.setZoomScale(a._zoomScale)},_getNormalSize:function(){var a;
null!==this._titleRenderer&&(a=this._titleRenderer.getContentSize());var b=this._buttonScale9Renderer.getContentSize();return cc.size(a.width>b.width?a.width:b.width,a.height>b.height?a.height:b.height)}});_p=ccui.Button.prototype;cc.defineGetterSetter(_p,"titleText",_p.getTitleText,_p.setTitleText);cc.defineGetterSetter(_p,"titleFont",_p._getTitleFont,_p._setTitleFont);cc.defineGetterSetter(_p,"titleFontSize",_p.getTitleFontSize,_p.setTitleFontSize);
cc.defineGetterSetter(_p,"titleFontName",_p.getTitleFontName,_p.setTitleFontName);cc.defineGetterSetter(_p,"titleColor",_p.getTitleColor,_p.setTitleColor);_p=null;ccui.Button.create=function(a,b,c,d){return new ccui.Button(a,b,c,d)};ccui.Button.NORMAL_RENDERER_ZORDER=-2;ccui.Button.PRESSED_RENDERER_ZORDER=-2;ccui.Button.DISABLED_RENDERER_ZORDER=-2;ccui.Button.TITLE_RENDERER_ZORDER=-1;ccui.Button.ZOOM_ACTION_TIME_STEP=0.05;ccui.Button.SYSTEM=0;ccui.Button.TTF=1;ccui.CheckBox=ccui.Widget.extend({_backGroundBoxRenderer:null,_backGroundSelectedBoxRenderer:null,_frontCrossRenderer:null,_backGroundBoxDisabledRenderer:null,_frontCrossDisabledRenderer:null,_isSelected:!0,_checkBoxEventListener:null,_checkBoxEventSelector:null,_backGroundTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundSelectedTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundDisabledTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossDisabledTexType:ccui.Widget.LOCAL_TEXTURE,
_backGroundFileName:"",_backGroundSelectedFileName:"",_frontCrossFileName:"",_backGroundDisabledFileName:"",_frontCrossDisabledFileName:"",_className:"CheckBox",_zoomScale:0.1,_backgroundTextureScaleX:0.1,_backgroundTextureScaleY:0.1,_backGroundBoxRendererAdaptDirty:!0,_backGroundSelectedBoxRendererAdaptDirty:!0,_frontCrossRendererAdaptDirty:!0,_backGroundBoxDisabledRendererAdaptDirty:!0,_frontCrossDisabledRendererAdaptDirty:!0,ctor:function(a,b,c,d,e,f){ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0);
for(var h=0,k=0;k<arguments.length;k++){var m=typeof arguments[k];"string"===m?isNaN(arguments[k]-0)?h++:(f=arguments[k],arguments[k]=void 0):"number"===m&&h++}switch(h){case 2:f=c,c=b,b=void 0}f=void 0===f?0:f;this._isSelected=!0;this.setSelected(!1);this.loadTextures(a,b,c,d,e,f)},_initRenderer:function(){this._backGroundBoxRenderer=new cc.Sprite;this._backGroundSelectedBoxRenderer=new cc.Sprite;this._frontCrossRenderer=new cc.Sprite;this._backGroundBoxDisabledRenderer=new cc.Sprite;this._frontCrossDisabledRenderer=
new cc.Sprite;this.addProtectedChild(this._backGroundBoxRenderer,ccui.CheckBox.BOX_RENDERER_ZORDER,-1);this.addProtectedChild(this._backGroundSelectedBoxRenderer,ccui.CheckBox.BOX_SELECTED_RENDERER_ZORDER,-1);this.addProtectedChild(this._frontCrossRenderer,ccui.CheckBox.FRONT_CROSS_RENDERER_ZORDER,-1);this.addProtectedChild(this._backGroundBoxDisabledRenderer,ccui.CheckBox.BOX_DISABLED_RENDERER_ZORDER,-1);this.addProtectedChild(this._frontCrossDisabledRenderer,ccui.CheckBox.FRONT_CROSS_DISABLED_RENDERER_ZORDER,
-1)},loadTextures:function(a,b,c,d,e,f){a&&this.loadTextureBackGround(a,f);b&&this.loadTextureBackGroundSelected(b,f);c&&this.loadTextureFrontCross(c,f);d&&this.loadTextureBackGroundDisabled(d,f);e&&this.loadTextureFrontCrossDisabled(e,f)},loadTextureBackGround:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._backGroundFileName=a;this._backGroundTexType=b;var c=this._backGroundBoxRenderer;c._textureLoaded?this._backGroundBoxRenderer.setContentSize(this._customSize):c.addEventListener("load",
function(){this._updateContentSizeWithTextureSize(this._backGroundBoxRenderer.getContentSize());this.loadTextureBackGround(this._backGroundFileName,this._backGroundTexType)},this);switch(this._backGroundTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._updateContentSizeWithTextureSize(this._backGroundBoxRenderer.getContentSize());this._backGroundBoxRendererAdaptDirty=!0;this._findLayout()}},
loadTextureBackGroundSelected:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._backGroundSelectedFileName=a;this._backGroundSelectedTexType=b;var c=this._backGroundSelectedBoxRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureBackGroundSelected(this._backGroundSelectedFileName,this._backGroundSelectedTexType)},this);switch(this._backGroundSelectedTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();
this._backGroundSelectedBoxRendererAdaptDirty=!0;this._findLayout()}},loadTextureFrontCross:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._frontCrossFileName=a;this._frontCrossTexType=b;var c=this._frontCrossRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureFrontCross(this._frontCrossFileName,this._frontCrossTexType)},this);switch(this._frontCrossTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();
this._frontCrossRendererAdaptDirty=!0;this._findLayout()}},loadTextureBackGroundDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._backGroundDisabledFileName=a;this._backGroundDisabledTexType=b;var c=this._backGroundBoxDisabledRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureBackGroundDisabled(this._backGroundDisabledFileName,this._backGroundDisabledTexType)},this);switch(this._backGroundDisabledTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);
break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._backGroundBoxDisabledRendererAdaptDirty=!0;this._findLayout()}},loadTextureFrontCrossDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._frontCrossDisabledFileName=a;this._frontCrossDisabledTexType=b;var c=this._frontCrossDisabledRenderer;c._textureLoaded||c.addEventListener("load",function(){this.loadTextureFrontCrossDisabled(this._frontCrossDisabledFileName,this._frontCrossDisabledTexType)},
this);switch(this._frontCrossDisabledTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._frontCrossDisabledRendererAdaptDirty=!0;this._findLayout()}},_onPressStateChangedToNormal:function(){this._backGroundBoxRenderer.setVisible(!0);this._backGroundSelectedBoxRenderer.setVisible(!1);this._backGroundBoxDisabledRenderer.setVisible(!1);this._frontCrossDisabledRenderer.setVisible(!1);this._backGroundBoxRenderer.setScale(this._backgroundTextureScaleX,
this._backgroundTextureScaleY);this._frontCrossRenderer.setScale(this._backgroundTextureScaleX,this._backgroundTextureScaleY);this._isSelected&&(this._frontCrossRenderer.setVisible(!0),this._frontCrossRendererAdaptDirty=!0)},_onPressStateChangedToPressed:function(){this._backGroundSelectedFileName?(this._backGroundBoxRenderer.setVisible(!1),this._backGroundSelectedBoxRenderer.setVisible(!0),this._backGroundBoxDisabledRenderer.setVisible(!1),this._frontCrossDisabledRenderer.setVisible(!1)):(this._backGroundBoxRenderer.setScale(this._backgroundTextureScaleX+
this._zoomScale,this._backgroundTextureScaleY+this._zoomScale),this._frontCrossRenderer.setScale(this._backgroundTextureScaleX+this._zoomScale,this._backgroundTextureScaleY+this._zoomScale))},_onPressStateChangedToDisabled:function(){this._backGroundDisabledFileName&&this._frontCrossDisabledFileName&&(this._backGroundBoxRenderer.setVisible(!1),this._backGroundBoxDisabledRenderer.setVisible(!0));this._backGroundSelectedBoxRenderer.setVisible(!1);this._frontCrossRenderer.setVisible(!1);this._backGroundBoxRenderer.setScale(this._backgroundTextureScaleX,
this._backgroundTextureScaleY);this._frontCrossRenderer.setScale(this._backgroundTextureScaleX,this._backgroundTextureScaleY);this._isSelected&&(this._frontCrossDisabledRenderer.setVisible(!0),this._frontCrossDisabledRendererAdaptDirty=!0)},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},setSelectedState:function(a){this.setSelected(a)},setSelected:function(a){a!==this._isSelected&&(this._isSelected=a,this._frontCrossRenderer.setVisible(this._isSelected))},
getSelectedState:function(){return this.isSelected()},isSelected:function(){return this._isSelected},_selectedEvent:function(){this._checkBoxEventSelector&&(this._checkBoxEventListener?this._checkBoxEventSelector.call(this._checkBoxEventListener,this,ccui.CheckBox.EVENT_SELECTED):this._checkBoxEventSelector(this,ccui.CheckBox.EVENT_SELECTED))},_unSelectedEvent:function(){this._checkBoxEventSelector&&(this._checkBoxEventListener?this._checkBoxEventSelector.call(this._checkBoxEventListener,this,ccui.CheckBox.EVENT_UNSELECTED):
this._checkBoxEventSelector(this,ccui.CheckBox.EVENT_UNSELECTED))},_releaseUpEvent:function(){ccui.Widget.prototype._releaseUpEvent.call(this);this._isSelected?(this.setSelected(!1),this._unSelectedEvent()):(this.setSelected(!0),this._selectedEvent())},addEventListenerCheckBox:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._checkBoxEventSelector=a;this._checkBoxEventListener=b},getVirtualRendererSize:function(){return this._backGroundBoxRenderer.getContentSize()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);
this._frontCrossDisabledRendererAdaptDirty=this._backGroundBoxDisabledRendererAdaptDirty=this._frontCrossRendererAdaptDirty=this._backGroundSelectedBoxRendererAdaptDirty=this._backGroundBoxRendererAdaptDirty=!0},getVirtualRenderer:function(){return this._backGroundBoxRenderer},_backGroundTextureScaleChangedWithSize:function(){var a=this._backGroundBoxRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1),this._backgroundTextureScaleX=this._backgroundTextureScaleY=1;else{var c=a.getContentSize();
if(0>=c.width||0>=c.height){a.setScale(1);this._backgroundTextureScaleX=this._backgroundTextureScaleY=1;return}var d=b.width/c.width,c=b.height/c.height;this._backgroundTextureScaleX=d;this._backgroundTextureScaleY=c;a.setScaleX(d);a.setScaleY(c)}a.setPosition(0.5*b.width,0.5*b.height)},_backGroundSelectedTextureScaleChangedWithSize:function(){var a=this._backGroundSelectedBoxRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);
return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_frontCrossTextureScaleChangedWithSize:function(){var a=this._frontCrossRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_backGroundDisabledTextureScaleChangedWithSize:function(){var a=
this._backGroundBoxDisabledRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},_frontCrossDisabledTextureScaleChangedWithSize:function(){var a=this._frontCrossDisabledRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);
return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(0.5*b.width,0.5*b.height)},getDescription:function(){return"CheckBox"},_createCloneInstance:function(){return new ccui.CheckBox},_copySpecialProperties:function(a){a instanceof ccui.CheckBox&&(this.loadTextureBackGround(a._backGroundFileName,a._backGroundTexType),this.loadTextureBackGroundSelected(a._backGroundSelectedFileName,a._backGroundSelectedTexType),this.loadTextureFrontCross(a._frontCrossFileName,a._frontCrossTexType),
this.loadTextureBackGroundDisabled(a._backGroundDisabledFileName,a._backGroundDisabledTexType),this.loadTextureFrontCrossDisabled(a._frontCrossDisabledFileName,a._frontCrossDisabledTexType),this.setSelected(a._isSelected),this._checkBoxEventListener=a._checkBoxEventListener,this._checkBoxEventSelector=a._checkBoxEventSelector,this._ccEventCallback=a._ccEventCallback,this._zoomScale=a._zoomScale,this._backgroundTextureScaleX=a._backgroundTextureScaleX,this._backgroundTextureScaleY=a._backgroundTextureScaleY)},
_adaptRenderers:function(){this._backGroundBoxRendererAdaptDirty&&(this._backGroundTextureScaleChangedWithSize(),this._backGroundBoxRendererAdaptDirty=!1);this._backGroundSelectedBoxRendererAdaptDirty&&(this._backGroundSelectedTextureScaleChangedWithSize(),this._backGroundSelectedBoxRendererAdaptDirty=!1);this._frontCrossRendererAdaptDirty&&(this._frontCrossTextureScaleChangedWithSize(),this._frontCrossRendererAdaptDirty=!1);this._backGroundBoxDisabledRendererAdaptDirty&&(this._backGroundDisabledTextureScaleChangedWithSize(),
this._backGroundBoxDisabledRendererAdaptDirty=!1);this._frontCrossDisabledRendererAdaptDirty&&(this._frontCrossDisabledTextureScaleChangedWithSize(),this._frontCrossDisabledRendererAdaptDirty=!1)}});_p=ccui.CheckBox.prototype;cc.defineGetterSetter(_p,"selected",_p.isSelected,_p.setSelected);_p=null;ccui.CheckBox.create=function(a,b,c,d,e,f){return new ccui.CheckBox(a,b,c,d,e,f)};ccui.CheckBox.EVENT_SELECTED=0;ccui.CheckBox.EVENT_UNSELECTED=1;ccui.CheckBox.BOX_RENDERER_ZORDER=-1;
ccui.CheckBox.BOX_SELECTED_RENDERER_ZORDER=-1;ccui.CheckBox.BOX_DISABLED_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_DISABLED_RENDERER_ZORDER=-1;ccui.ImageView=ccui.Widget.extend({_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_imageRenderer:null,_textureFile:"",_imageTexType:ccui.Widget.LOCAL_TEXTURE,_imageTextureSize:null,_className:"ImageView",_imageRendererAdaptDirty:!0,ctor:function(a,b){this._capInsets=cc.rect(0,0,0,0);this._imageTextureSize=cc.size(this._capInsets.width,this._capInsets.height);ccui.Widget.prototype.ctor.call(this);a?this.loadTexture(a,void 0===b?0:b):this._imageTexType=ccui.Widget.LOCAL_TEXTURE},_initRenderer:function(){this._imageRenderer=
new ccui.Scale9Sprite;this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE);this.addProtectedChild(this._imageRenderer,ccui.ImageView.RENDERER_ZORDER,-1)},loadTexture:function(a,b){if(a&&(this._textureFile!=a||this._imageTexType!=b)){var c=this;b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._imageTexType=b;var d=c._imageRenderer;switch(c._imageTexType){case ccui.Widget.LOCAL_TEXTURE:c._scale9Enabled?(d.initWithFile(a),d.setCapInsets(c._capInsets)):d.initWithFile(a);
break;case ccui.Widget.PLIST_TEXTURE:c._scale9Enabled?(d.initWithSpriteFrameName(a),d.setCapInsets(c._capInsets)):d.initWithSpriteFrameName(a)}if(!d._textureLoaded){var e=function(){d.removeEventListener("load",e);!c._ignoreSize&&cc.sizeEqualToSize(c._customSize,cc.size(0,0))&&(c._customSize=c._imageRenderer.getContentSize());c._imageTextureSize=d.getContentSize();c._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize)};d.addEventListener("load",e)}!this._ignoreSize&&
cc.sizeEqualToSize(this._customSize,cc.size(0,0))&&(this._customSize=this._imageRenderer.getContentSize());c._imageTextureSize=d.getContentSize();this._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize);c._imageRendererAdaptDirty=!0;c._findLayout()}},setTextureRect:function(){cc.warn("ImageView.setTextureRect  is deprecated!")},setScale9Enabled:function(a){this._scale9Enabled!==a&&((this._scale9Enabled=a)?this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SLICED):
this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this._imageRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,
a),this._prevIgnoreSize=a},setCapInsets:function(a){if(a){var b=this._capInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._imageRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._imageRendererAdaptDirty=!0},_adaptRenderers:function(){this._imageRendererAdaptDirty&&(this._imageTextureScaleChangedWithSize(),this._imageRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return cc.size(this._imageTextureSize)},
getVirtualRenderer:function(){return this._imageRenderer},_imageTextureScaleChangedWithSize:function(){this._imageRenderer.setContentSize(this._contentSize);this._imageRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"ImageView"},_createCloneInstance:function(){return new ccui.ImageView},_copySpecialProperties:function(a){a instanceof ccui.ImageView&&(this._prevIgnoreSize=a._prevIgnoreSize,this._capInsets=a._capInsets,this.loadTexture(a._textureFile,
a._imageTexType),this.setScale9Enabled(a._scale9Enabled))},setContentSize:function(a,b){b&&(a=cc.size(a,b));ccui.Widget.prototype.setContentSize.call(this,a);this._imageRenderer.setContentSize(a)}});ccui.ImageView.create=function(a,b){return new ccui.ImageView(a,b)};ccui.ImageView.RENDERER_ZORDER=-1;ccui.LoadingBar=ccui.Widget.extend({_direction:null,_percent:100,_totalLength:0,_barRenderer:null,_renderBarTexType:ccui.Widget.LOCAL_TEXTURE,_barRendererTextureSize:null,_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_textureFile:"",_isTextureLoaded:!1,_className:"LoadingBar",_barRendererAdaptDirty:!0,ctor:function(a,b){this._direction=ccui.LoadingBar.TYPE_LEFT;this._barRendererTextureSize=cc.size(0,0);this._capInsets=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);void 0!==a&&this.loadTexture(a);
void 0!==b&&this.setPercent(b)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1);this._barRenderer.setAnchorPoint(0,0.5)},setDirection:function(a){if(this._direction!==a)switch(this._direction=a,this._direction){case ccui.LoadingBar.TYPE_LEFT:this._barRenderer.setAnchorPoint(0,0.5);this._barRenderer.setPosition(0,0.5*this._contentSize.height);this._scale9Enabled||this._barRenderer.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:this._barRenderer.setAnchorPoint(1,
0.5),this._barRenderer.setPosition(this._totalLength,0.5*this._contentSize.height),this._scale9Enabled||this._barRenderer.setFlippedX(!0)}},getDirection:function(){return this._direction},loadTexture:function(a,b){if(a){this._renderBarTexType=b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;var c=this._barRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadTexture(d._textureFile,d._renderBarTexType);d._setPercent(d._percent)});switch(this._renderBarTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);
break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}var e=c.getContentSize();this._barRendererTextureSize.width=e.width;this._barRendererTextureSize.height=e.height;switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:c.setAnchorPoint(0,0.5);this._scale9Enabled||c.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:c.setAnchorPoint(1,0.5),this._scale9Enabled||c.setFlippedX(!0)}this._scale9Enabled&&c.setCapInsets(this._capInsets);this._updateChildrenDisplayedRGBA();this._barRendererScaleChangedWithSize();
this._updateContentSizeWithTextureSize(this._barRendererTextureSize);this._barRendererAdaptDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer),this._barRenderer=this._scale9Enabled?new ccui.Scale9Sprite:new cc.Sprite,this.loadTexture(this._textureFile,this._renderBarTexType),this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),
this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this.setPercent(this._percent),this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},setCapInsets:function(a){if(a){var b=this._capInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},setPercent:function(a){100<a&&(a=100);0>a&&(a=0);a!==
this._percent&&(this._percent=a,this._setPercent(a))},_setPercent:function(){var a,b,c,d;0>=this._totalLength||(a=this._percent/100,this._scale9Enabled?this._setScale9Scale():(c=this._barRenderer,d=this._barRendererTextureSize,b=c.getTextureRect(),b.width=d.width*a,c.setTextureRect(cc.rect(b.x,b.y,d.width*a,d.height),c._rectRotated)))},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);this._totalLength=void 0===b?a.width:a},getPercent:function(){return this._percent},
_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1)},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},getVirtualRendererSize:function(){return cc.size(this._barRendererTextureSize)},getVirtualRenderer:function(){return this._barRenderer},
_barRendererScaleChangedWithSize:function(){var a=this._barRenderer,b=this._contentSize;if(this._unifySize)this._totalLength=this._contentSize.width,this.setPercent(this._percent);else if(this._ignoreSize)this._scale9Enabled||(this._totalLength=this._barRendererTextureSize.width,a.setScale(1));else if(this._totalLength=b.width,this._scale9Enabled)this._setScale9Scale(),a.setScale(1);else{var c=this._barRendererTextureSize;if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/
c.width);a.setScaleY(d)}switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:a.setPosition(0,0.5*b.height);break;case ccui.LoadingBar.TYPE_RIGHT:a.setPosition(this._totalLength,0.5*b.height)}},_setScale9Scale:function(){this._barRenderer.setPreferredSize(cc.size(this._percent/100*this._totalLength,this._contentSize.height))},getDescription:function(){return"LoadingBar"},_createCloneInstance:function(){return new ccui.LoadingBar},_copySpecialProperties:function(a){a instanceof ccui.LoadingBar&&(this._prevIgnoreSize=
a._prevIgnoreSize,this.setScale9Enabled(a._scale9Enabled),this.loadTexture(a._textureFile,a._renderBarTexType),this.setCapInsets(a._capInsets),this.setPercent(a._percent),this.setDirection(a._direction))}});_p=ccui.LoadingBar.prototype;cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"percent",_p.getPercent,_p.setPercent);_p=null;ccui.LoadingBar.create=function(a,b){return new ccui.LoadingBar(a,b)};ccui.LoadingBar.TYPE_LEFT=0;
ccui.LoadingBar.TYPE_RIGHT=1;ccui.LoadingBar.RENDERER_ZORDER=-1;ccui.Slider=ccui.Widget.extend({_barRenderer:null,_progressBarRenderer:null,_barTextureSize:null,_progressBarTextureSize:null,_slidBallNormalRenderer:null,_slidBallPressedRenderer:null,_slidBallDisabledRenderer:null,_slidBallRenderer:null,_barLength:0,_percent:0,_scale9Enabled:!1,_prevIgnoreSize:!0,_textureFile:"",_progressBarTextureFile:"",_slidBallNormalTextureFile:"",_slidBallPressedTextureFile:"",_slidBallDisabledTextureFile:"",_capInsetsBarRenderer:null,_capInsetsProgressBarRenderer:null,_sliderEventListener:null,
_sliderEventSelector:null,_barTexType:ccui.Widget.LOCAL_TEXTURE,_progressBarTexType:ccui.Widget.LOCAL_TEXTURE,_ballNTexType:ccui.Widget.LOCAL_TEXTURE,_ballPTexType:ccui.Widget.LOCAL_TEXTURE,_ballDTexType:ccui.Widget.LOCAL_TEXTURE,_isTextureLoaded:!1,_className:"Slider",_barRendererAdaptDirty:!0,_progressBarRendererDirty:!0,_unifySize:!1,_zoomScale:0.1,_sliderBallNormalTextureScaleX:1,_sliderBallNormalTextureScaleY:1,ctor:function(a,b,c){this._barTextureSize=cc.size(0,0);this._progressBarTextureSize=
cc.size(0,0);this._capInsetsBarRenderer=cc.rect(0,0,0,0);this._capInsetsProgressBarRenderer=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);c=c||0;this.setTouchEnabled(!0);a&&this.loadBarTexture(a,c);b&&this.loadSlidBallTextures(b,c)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this._progressBarRenderer=new cc.Sprite;this._progressBarRenderer.setAnchorPoint(0,0.5);this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER,-1);this.addProtectedChild(this._progressBarRenderer,
ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1);this._slidBallNormalRenderer=new cc.Sprite;this._slidBallPressedRenderer=new cc.Sprite;this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer=new cc.Sprite;this._slidBallDisabledRenderer.setVisible(!1);this._slidBallRenderer=new cc.Node;this._slidBallRenderer.addChild(this._slidBallNormalRenderer);this._slidBallRenderer.addChild(this._slidBallPressedRenderer);this._slidBallRenderer.addChild(this._slidBallDisabledRenderer);this._slidBallRenderer.setCascadeColorEnabled(!0);
this._slidBallRenderer.setCascadeOpacityEnabled(!0);this.addProtectedChild(this._slidBallRenderer,ccui.Slider.BALL_RENDERER_ZORDER,-1)},loadBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._barTexType=b;var c=this._barRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadBarTexture(d._textureFile,d._barTexType)});switch(this._barTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();
this._progressBarRendererDirty=this._barRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._barRenderer.getContentSize());this._findLayout();this._barTextureSize=this._barRenderer.getContentSize()}},loadProgressBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._progressBarTextureFile=a;this._progressBarTexType=b;var c=this._progressBarRenderer,d=this;c._textureLoaded||c.addEventListener("load",function(){d.loadProgressBarTexture(d._progressBarTextureFile,d._progressBarTexType)});
switch(this._progressBarTexType){case ccui.Widget.LOCAL_TEXTURE:c.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:c.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._progressBarRenderer.setAnchorPoint(cc.p(0,0.5));c=this._progressBarRenderer.getContentSize();this._progressBarTextureSize={width:c.width,height:c.height};this._progressBarRendererDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer,
!0),this.removeProtectedChild(this._progressBarRenderer,!0),this._progressBarRenderer=this._barRenderer=null,this._scale9Enabled?(this._barRenderer=new ccui.Scale9Sprite,this._progressBarRenderer=new ccui.Scale9Sprite):(this._barRenderer=new cc.Sprite,this._progressBarRenderer=new cc.Sprite),this.loadBarTexture(this._textureFile,this._barTexType),this.loadProgressBarTexture(this._progressBarTextureFile,this._progressBarTexType),this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER,
-1),this.addProtectedChild(this._progressBarRenderer,ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsetsBarRenderer(this._capInsetsBarRenderer),this.setCapInsetProgressBarRenderer(this._capInsetsProgressBarRenderer),this._progressBarRendererDirty=this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||
this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},setCapInsets:function(a){this.setCapInsetsBarRenderer(a);this.setCapInsetProgressBarRenderer(a)},setCapInsetsBarRenderer:function(a){if(a){var b=this._capInsetsBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsetsBarRenderer:function(){return cc.rect(this._capInsetsBarRenderer)},setCapInsetProgressBarRenderer:function(a){if(a){var b=
this._capInsetsProgressBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._progressBarRenderer.setCapInsets(a)}},getCapInsetsProgressBarRenderer:function(){return cc.rect(this._capInsetsProgressBarRenderer)},loadSlidBallTextures:function(a,b,c,d){this.loadSlidBallTextureNormal(a,d);this.loadSlidBallTexturePressed(b,d);this.loadSlidBallTextureDisabled(c,d)},loadSlidBallTextureNormal:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallNormalTextureFile=
a;this._ballNTexType=b;var c=this;this._slidBallNormalRenderer._textureLoaded||this._slidBallNormalRenderer.addEventListener("load",function(){c.loadSlidBallTextureNormal(c._slidBallNormalTextureFile,c._ballNTexType)});switch(this._ballNTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallNormalRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallNormalRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._findLayout()}},loadSlidBallTexturePressed:function(a,
b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallPressedTextureFile=a;this._ballPTexType=b;var c=this;this._slidBallPressedRenderer._textureLoaded||this._slidBallPressedRenderer.addEventListener("load",function(){c.loadSlidBallTexturePressed(c._slidBallPressedTextureFile,c._ballPTexType)});switch(this._ballPTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallPressedRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallPressedRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();
this._findLayout()}},loadSlidBallTextureDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallDisabledTextureFile=a;this._ballDTexType=b;var c=this;this._slidBallDisabledRenderer._textureLoaded||this._slidBallDisabledRenderer.addEventListener("load",function(){c.loadSlidBallTextureDisabled(c._slidBallDisabledTextureFile,c._ballDTexType)});switch(this._ballDTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallDisabledRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallDisabledRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();
this._findLayout()}},setPercent:function(a){100<a&&(a=100);0>a&&(a=0);this._percent=a;a=a/100*this._barLength;this._slidBallRenderer.setPosition(a,this._contentSize.height/2);if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(cc.size(a,this._contentSize.height));else{var b=this._progressBarRenderer,c=b.getTextureRect();b.setTextureRect(cc.rect(c.x,c.y,a/b._scaleX,c.height),b.isTextureRectRotated())}},hitTest:function(a){a=this._slidBallNormalRenderer.convertToNodeSpace(a);var b=this._slidBallNormalRenderer.getContentSize(),
b=cc.rect(0,0,b.width,b.height);return a.x>=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height},onTouchBegan:function(a,b){var c=ccui.Widget.prototype.onTouchBegan.call(this,a,b);if(this._hit){var d=this.convertToNodeSpace(this._touchBeganPosition);this.setPercent(this._getPercentWithBallPos(d.x));this._percentChangedEvent()}return c},onTouchMoved:function(a,b){var c=a.getLocation(),c=this.convertToNodeSpace(c);this.setPercent(this._getPercentWithBallPos(c.x));this._percentChangedEvent()},onTouchEnded:function(a,
b){ccui.Widget.prototype.onTouchEnded.call(this,a,b)},onTouchCancelled:function(a,b){ccui.Widget.prototype.onTouchCancelled.call(this,a,b)},_getPercentWithBallPos:function(a){return a/this._barLength*100},addEventListenerSlider:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._sliderEventSelector=a;this._sliderEventListener=b},_percentChangedEvent:function(){this._sliderEventSelector&&(this._sliderEventListener?this._sliderEventSelector.call(this._sliderEventListener,
this,ccui.Slider.EVENT_PERCENT_CHANGED):this._sliderEventSelector(this,ccui.Slider.EVENT_PERCENT_CHANGED));this._ccEventCallback&&this._ccEventCallback(this,ccui.Slider.EVENT_PERCENT_CHANGED)},getPercent:function(){return this._percent},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._progressBarRendererDirty=this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1);
this._progressBarRendererDirty&&(this._progressBarRendererScaleChangedWithSize(),this._progressBarRendererDirty=!1)},getVirtualRendererSize:function(){return this._barRenderer.getContentSize()},getVirtualRenderer:function(){return this._barRenderer},_barRendererScaleChangedWithSize:function(){if(this._unifySize)this._barLength=this._contentSize.width,this._barRenderer.setPreferredSize(this._contentSize);else if(this._ignoreSize)this._barRenderer.setScale(1),this._barLength=this._contentSize.width;
else if(this._barLength=this._contentSize.width,this._scale9Enabled)this._barRenderer.setPreferredSize(this._contentSize),this._barRenderer.setScale(1);else{var a=this._barTextureSize;if(0>=a.width||0>=a.height)this._barRenderer.setScale(1);else{var b=this._contentSize.height/a.height;this._barRenderer.setScaleX(this._contentSize.width/a.width);this._barRenderer.setScaleY(b)}}this._barRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2);this.setPercent(this._percent)},_progressBarRendererScaleChangedWithSize:function(){if(this._unifySize)this._progressBarRenderer.setPreferredSize(this._contentSize);
else if(this._ignoreSize){if(!this._scale9Enabled){var a=this._progressBarTextureSize,b=this._contentSize.width/a.width,a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}}else if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(this._contentSize),this._progressBarRenderer.setScale(1);else{a=this._progressBarTextureSize;if(0>=a.width||0>=a.height){this._progressBarRenderer.setScale(1);return}b=this._contentSize.width/a.width;
a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}this._progressBarRenderer.setPosition(0,this._contentSize.height/2);this.setPercent(this._percent)},_onPressStateChangedToNormal:function(){this._slidBallNormalRenderer.setVisible(!0);this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer.setVisible(!1);this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY);cc._renderType===
cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToPressed:function(){this._slidBallPressedTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallPressedRenderer.setVisible(!0),this._slidBallDisabledRenderer.setVisible(!1)):this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX+this._zoomScale,this._sliderBallNormalTextureScaleY+this._zoomScale);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&
(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToDisabled:function(){this._slidBallDisabledTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallDisabledRenderer.setVisible(!0)):(this._slidBallNormalRenderer.setVisible(!0),cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getGrayGLProgram()));this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY);
this._slidBallPressedRenderer.setVisible(!1)},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},getSlidBallNormalRenderer:function(){return this._slidBallNormalRenderer},getSlidBallPressedRenderer:function(){return this._slidBallPressedRenderer},getSlidBallDisabledRenderer:function(){return this._slidBallDisabledRenderer},getSlidBallRenderer:function(){return this._slidBallRenderer},getDescription:function(){return"Slider"},_createCloneInstance:function(){return new ccui.Slider},
_copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this.setScale9Enabled(a._scale9Enabled);this.loadBarTexture(a._textureFile,a._barTexType);this.loadProgressBarTexture(a._progressBarTextureFile,a._progressBarTexType);this.loadSlidBallTextureNormal(a._slidBallNormalTextureFile,a._ballNTexType);this.loadSlidBallTexturePressed(a._slidBallPressedTextureFile,a._ballPTexType);this.loadSlidBallTextureDisabled(a._slidBallDisabledTextureFile,a._ballDTexType);this.setPercent(a.getPercent());
this._sliderEventListener=a._sliderEventListener;this._sliderEventSelector=a._sliderEventSelector;this._zoomScale=a._zoomScale;this._ccEventCallback=a._ccEventCallback}});_p=ccui.Slider.prototype;cc.defineGetterSetter(_p,"percent",_p.getPercent,_p.setPercent);_p=null;ccui.Slider.create=function(a,b,c){return new ccui.Slider(a,b,c)};ccui.Slider.EVENT_PERCENT_CHANGED=0;ccui.Slider.BASEBAR_RENDERER_ZORDER=-3;ccui.Slider.PROGRESSBAR_RENDERER_ZORDER=-2;ccui.Slider.BALL_RENDERER_ZORDER=-1;ccui.Text=ccui.Widget.extend({_touchScaleChangeEnabled:!1,_normalScaleValueX:1,_normalScaleValueY:1,_fontName:"Arial",_fontSize:16,_onSelectedScaleOffset:0.5,_labelRenderer:null,_textAreaSize:null,_textVerticalAlignment:0,_textHorizontalAlignment:0,_className:"Text",_type:null,_labelRendererAdaptDirty:!0,ctor:function(a,b,c){this._type=ccui.Text.Type.SYSTEM;this._textAreaSize=cc.size(0,0);ccui.Widget.prototype.ctor.call(this);void 0!==c?(this.setFontName(b),this.setFontSize(c),this.setString(a)):
this.setFontName(this._fontName)},_initRenderer:function(){this._labelRenderer=new cc.LabelTTF;this.addProtectedChild(this._labelRenderer,ccui.Text.RENDERER_ZORDER,-1)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){a!==this._labelRenderer.getString()&&(this._setString(a),this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize()))},_setString:function(a){this._labelRenderer.setString(a);this._labelRendererAdaptDirty=!0},getStringValue:function(){cc.log("Please use the getString");
return this._labelRenderer.getString()},getString:function(){return this._labelRenderer.getString()},getStringLength:function(){return this._labelRenderer.getStringLength()},setFontSize:function(a){this._setFontSize(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setFontSize:function(a){this._labelRenderer.setFontSize(a);this._fontSize=a;this._labelRendererAdaptDirty=!0},getFontSize:function(){return this._fontSize},setFontName:function(a){this._setFontName(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},
_setFontName:function(a){this._fontName=a;this._labelRenderer.setFontName(a);this._labelRendererAdaptDirty=!0},_updateUITextContentSize:function(){this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},getFontName:function(){return this._fontName},_setFont:function(a){var b=cc.LabelTTF._fontStyleRE.exec(a);b&&(this._fontSize=parseInt(b[1]),this._fontName=b[2],this._labelRenderer._setFont(a),this._labelScaleChangedWithSize())},_getFont:function(){return this._labelRenderer._getFont()},
getType:function(){return this._type},setTextAreaSize:function(a){this._setTextAreaSize(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setTextAreaSize:function(a){this._labelRenderer.setDimensions(a);this._ignoreSize||(this._customSize=a);this._labelRendererAdaptDirty=!0},getTextAreaSize:function(){return this._labelRenderer.getDimensions()},setTextHorizontalAlignment:function(a){this._setTextHorizontalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},
_setTextHorizontalAlignment:function(a){this._labelRenderer.setHorizontalAlignment(a);this._labelRendererAdaptDirty=!0},getTextHorizontalAlignment:function(){return this._labelRenderer.getHorizontalAlignment()},setTextVerticalAlignment:function(a){this._setTextVerticalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setTextVerticalAlignment:function(a){this._labelRenderer.setVerticalAlignment(a);this._labelRendererAdaptDirty=!0},getTextVerticalAlignment:function(){return this._labelRenderer.getVerticalAlignment()},
setTouchScaleChangeEnabled:function(a){this._touchScaleChangeEnabled=a},isTouchScaleChangeEnabled:function(){return this._touchScaleChangeEnabled},_onPressStateChangedToNormal:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX),this._labelRenderer.setScaleY(this._normalScaleValueY))},_onPressStateChangedToPressed:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX+this._onSelectedScaleOffset),this._labelRenderer.setScaleY(this._normalScaleValueY+
this._onSelectedScaleOffset))},_onPressStateChangedToDisabled:function(){},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelRendererAdaptDirty&&(this._labelScaleChangedWithSize(),this._labelRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelRenderer},getAutoRenderSize:function(){var a=this._labelRenderer.getContentSize();
this._ignoreSize||(this._labelRenderer.setDimensions(0,0),a=this._labelRenderer.getContentSize(),this._labelRenderer.setDimensions(this._contentSize.width,this._contentSize.height));return a},_labelScaleChangedWithSize:function(){var a=this._contentSize;if(this._ignoreSize)this._labelRenderer.setScale(1),this._normalScaleValueX=this._normalScaleValueY=1;else{this._labelRenderer.setDimensions(cc.size(a.width,a.height));var b=this._labelRenderer.getContentSize();if(0>=b.width||0>=b.height){this._labelRenderer.setScale(1);
return}var c=a.width/b.width,b=a.height/b.height;this._labelRenderer.setScaleX(c);this._labelRenderer.setScaleY(b);this._normalScaleValueX=c;this._normalScaleValueY=b}this._labelRenderer.setPosition(a.width/2,a.height/2)},getDescription:function(){return"Label"},enableShadow:function(a,b,c){this._labelRenderer.enableShadow(a,b,c)},enableOutline:function(a,b){this._labelRenderer.enableStroke(a,b)},enableGlow:function(a){this._type===ccui.Text.Type.TTF&&this._labelRenderer.enableGlow(a)},disableEffect:function(){this._labelRenderer.disableEffect&&
this._labelRenderer.disableEffect()},_createCloneInstance:function(){return new ccui.Text},_copySpecialProperties:function(a){a instanceof ccui.Text&&(this.setFontName(a._fontName),this.setFontSize(a.getFontSize()),this.setString(a.getString()),this.setTouchScaleChangeEnabled(a.touchScaleEnabled),this.setTextAreaSize(a._textAreaSize),this.setTextHorizontalAlignment(a._labelRenderer.getHorizontalAlignment()),this.setTextVerticalAlignment(a._labelRenderer.getVerticalAlignment()),this.setContentSize(a.getContentSize()),
this.setTextColor(a.getTextColor()))},_setBoundingWidth:function(a){this._textAreaSize.width=a;this._labelRenderer._setBoundingWidth(a);this._labelScaleChangedWithSize()},_setBoundingHeight:function(a){this._textAreaSize.height=a;this._labelRenderer._setBoundingHeight(a);this._labelScaleChangedWithSize()},_getBoundingWidth:function(){return this._textAreaSize.width},_getBoundingHeight:function(){return this._textAreaSize.height},_changePosition:function(){this._adaptRenderers()},setColor:function(a){cc.ProtectedNode.prototype.setColor.call(this,
a);this._labelRenderer.setColor(a)},setTextColor:function(a){this._labelRenderer.setFontFillColor(a)},getTextColor:function(){return this._labelRenderer._getFillStyle()}});_p=ccui.Text.prototype;cc.defineGetterSetter(_p,"boundingWidth",_p._getBoundingWidth,_p._setBoundingWidth);cc.defineGetterSetter(_p,"boundingHeight",_p._getBoundingHeight,_p._setBoundingHeight);cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"stringLength",_p.getStringLength);
cc.defineGetterSetter(_p,"font",_p._getFont,_p._setFont);cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.defineGetterSetter(_p,"textAlign",_p.getTextHorizontalAlignment,_p.setTextHorizontalAlignment);cc.defineGetterSetter(_p,"verticalAlign",_p.getTextVerticalAlignment,_p.setTextVerticalAlignment);_p=null;ccui.Label=ccui.Text.create=function(a,b,c){return new ccui.Text(a,b,c)};ccui.Text.RENDERER_ZORDER=-1;
ccui.Text.Type={SYSTEM:0,TTF:1};ccui.TextAtlas=ccui.Widget.extend({_labelAtlasRenderer:null,_stringValue:"",_charMapFileName:"",_itemWidth:0,_itemHeight:0,_startCharMap:"",_className:"TextAtlas",_labelAtlasRendererAdaptDirty:null,ctor:function(a,b,c,d,e){ccui.Widget.prototype.ctor.call(this);void 0!==e&&this.setProperty(a,b,c,d,e)},_initRenderer:function(){this._labelAtlasRenderer=new cc.LabelAtlas;this._labelAtlasRenderer.setAnchorPoint(cc.p(0.5,0.5));this.addProtectedChild(this._labelAtlasRenderer,ccui.TextAtlas.RENDERER_ZORDER,
-1);this._labelAtlasRenderer.addEventListener("load",function(){this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize());this._findLayout()},this)},setProperty:function(a,b,c,d,e){this._stringValue=a;this._charMapFileName=b;this._itemWidth=c;this._itemHeight=d;this._startCharMap=e;this._labelAtlasRenderer.initWithString(a,this._charMapFileName,this._itemWidth,this._itemHeight,this._startCharMap[0]);this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize());
this._labelAtlasRendererAdaptDirty=!0},setString:function(a){a!==this._labelAtlasRenderer.getString()&&(this._stringValue=a,this._labelAtlasRenderer.setString(a),this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize()),this._labelAtlasRendererAdaptDirty=!0)},setStringValue:function(a){cc.log("Please use the setString");this.setString(a)},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._labelAtlasRenderer.getString()},
getStringLength:function(){return this._labelAtlasRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelAtlasRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelAtlasRendererAdaptDirty&&(this._labelAtlasScaleChangedWithSize(),this._labelAtlasRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelAtlasRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelAtlasRenderer},_labelAtlasScaleChangedWithSize:function(){var a=
this._labelAtlasRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"LabelAtlas"},_copySpecialProperties:function(a){a&&this.setProperty(a._stringValue,a._charMapFileName,a._itemWidth,a._itemHeight,a._startCharMap)},_createCloneInstance:function(){return new ccui.TextAtlas}});
_p=ccui.TextAtlas.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);_p=null;ccui.TextAtlas.create=function(a,b,c,d,e){return new ccui.TextAtlas(a,b,c,d,e)};ccui.TextAtlas.RENDERER_ZORDER=-1;ccui.LabelBMFont=ccui.TextBMFont=ccui.Widget.extend({_labelBMFontRenderer:null,_fntFileHasInit:!1,_fntFileName:"",_stringValue:"",_className:"TextBMFont",_labelBMFontRendererAdaptDirty:!0,ctor:function(a,b){ccui.Widget.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;void 0!==b&&(this.setFntFile(b),this.setString(a))},_initRenderer:function(){this._labelBMFontRenderer=new cc.LabelBMFont;this.addProtectedChild(this._labelBMFontRenderer,ccui.TextBMFont.RENDERER_ZORDER,-1)},setFntFile:function(a){if(a){this._fntFileName=
a;this._fntFileHasInit=!0;this._labelBMFontRenderer.initWithString(this._stringValue,a);this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize());this._labelBMFontRendererAdaptDirty=!0;var b=this;a=b._labelBMFontRenderer;a._textureLoaded||a.addEventListener("load",function(){b.setFntFile(b._fntFileName)})}},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){this._loader.clear();this._labelBMFontRenderer._textureLoaded?a!==this._labelBMFontRenderer.getString()&&
(this._stringValue=a,this._labelBMFontRenderer.setString(a),this._fntFileHasInit&&(this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize()),this._labelBMFontRendererAdaptDirty=!0)):this._loader.add(this._labelBMFontRenderer,function(){this.setString(a)},this)},getString:function(){return this._stringValue},getStringLength:function(){return this._labelBMFontRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelBMFontRendererAdaptDirty=
!0},_adaptRenderers:function(){this._labelBMFontRendererAdaptDirty&&(this._labelBMFontScaleChangedWithSize(),this._labelBMFontRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelBMFontRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelBMFontRenderer},_labelBMFontScaleChangedWithSize:function(){var a=this._labelBMFontRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/
b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"TextBMFont"},_createCloneInstance:function(){return new ccui.TextBMFont},_copySpecialProperties:function(a){this.setFntFile(a._fntFileName);this.setString(a._stringValue)}});_p=ccui.TextBMFont.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);_p=null;ccui.TextBMFont.create=function(a,b){return new ccui.TextBMFont(a,b)};
ccui.TextBMFont.RENDERER_ZORDER=-1;ccui._TextFieldRenderer=cc.TextFieldTTF.extend({_maxLengthEnabled:!1,_maxLength:0,_passwordEnabled:!1,_passwordStyleText:"",_attachWithIME:!1,_detachWithIME:!1,_insertText:!1,_deleteBackward:!1,_className:"_TextFieldRenderer",ctor:function(){cc.TextFieldTTF.prototype.ctor.call(this);this._maxLengthEnabled=!1;this._maxLength=0;this._passwordEnabled=!1;this._passwordStyleText="*";this._deleteBackward=this._insertText=this._detachWithIME=this._attachWithIME=!1},onEnter:function(){cc.TextFieldTTF.prototype.onEnter.call(this);
cc.TextFieldTTF.prototype.setDelegate.call(this,this)},onTextFieldAttachWithIME:function(a){this.setAttachWithIME(!0);return!1},onTextFieldInsertText:function(a,b,c){if(1===c&&"\n"===b)return!1;this.setInsertText(!0);return this._maxLengthEnabled&&cc.TextFieldTTF.prototype.getCharCount.call(this)>=this._maxLength},onTextFieldDeleteBackward:function(a,b,c){this.setDeleteBackward(!0);return!1},onTextFieldDetachWithIME:function(a){this.setDetachWithIME(!0);return!1},insertText:function(a,b){"\n"!==a&&
this._maxLengthEnabled&&this.getString().length>=this._maxLength?this._passwordEnabled&&this.setPasswordText(this.getString()):(cc.TextFieldTTF.prototype.insertText.call(this,a,b),this._passwordEnabled&&0<cc.TextFieldTTF.prototype.getCharCount.call(this)&&this.setPasswordText(this.getString()))},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)},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 b=a.charCodeAt(0);33>b||126<b||(this._passwordStyleText=a)}},setPasswordText:function(a){var b="",c=a.length;a=c;this._maxLengthEnabled&&c>this._maxLength&&(a=this._maxLength);for(c=0;c<a;++c)b+=this._passwordStyleText;cc.LabelTTF.prototype.setString.call(this,b)},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},onDraw:function(a){return!1}});ccui._TextFieldRenderer.create=function(a,b,c){var d=new ccui._TextFieldRenderer;return d&&d.initWithString("",b,c)?(a&&d.setPlaceHolder(a),d):null};
ccui.TextField=ccui.Widget.extend({_textFieldRenderer:null,_touchWidth:0,_touchHeight:0,_useTouchArea:!1,_textFieldEventListener:null,_textFieldEventSelector:null,_passwordStyleText:"",_textFieldRendererAdaptDirty:!0,_fontName:"",_fontSize:12,_ccEventCallback:null,ctor:function(a,b,c){ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0);b&&this.setFontName(b);c&&this.setFontSize(c);a&&this.setPlaceHolder(a)},onEnter:function(){ccui.Widget.prototype.onEnter.call(this);this.scheduleUpdate()},
_initRenderer:function(){this._textFieldRenderer=ccui._TextFieldRenderer.create("input words here","Thonburi",20);this.addProtectedChild(this._textFieldRenderer,ccui.TextField.RENDERER_ZORDER,-1)},setTouchSize:function(a){this._touchWidth=a.width;this._touchHeight=a.height},setTouchAreaEnabled:function(a){this._useTouchArea=a},hitTest:function(a){if(this._useTouchArea){a=this.convertToNodeSpace(a);var b=cc.rect(-this._touchWidth*this._anchorPoint.x,-this._touchHeight*this._anchorPoint.y,this._touchWidth,
this._touchHeight);return a.x>=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height}return ccui.Widget.prototype.hitTest.call(this,a)},getTouchSize:function(){return cc.size(this._touchWidth,this._touchHeight)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){null!=a&&(a=String(a),this.isMaxLengthEnabled()&&(a=a.substr(0,this.getMaxLength())),this.isPasswordEnabled()?(this._textFieldRenderer.setPasswordText(a),this._textFieldRenderer.setString(""),this._textFieldRenderer.insertText(a,
a.length)):this._textFieldRenderer.setString(a),this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()))},setPlaceHolder:function(a){this._textFieldRenderer.setPlaceHolder(a);this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getPlaceHolder:function(){return this._textFieldRenderer.getPlaceHolder()},getPlaceHolderColor:function(){return this._textFieldRenderer.getPlaceHolderColor()},
setPlaceHolderColor:function(a){this._textFieldRenderer.setColorSpaceHolder(a)},setTextColor:function(a){this._textFieldRenderer.setTextColor(a)},setFontSize:function(a){this._textFieldRenderer.setFontSize(a);this._fontSize=a;this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontSize:function(){return this._fontSize},setFontName:function(a){this._textFieldRenderer.setFontName(a);this._fontName=a;this._textFieldRendererAdaptDirty=
!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontName:function(){return this._fontName},didNotSelectSelf:function(){this._textFieldRenderer.detachWithIME()},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._textFieldRenderer.getString()},getStringLength:function(){return this._textFieldRenderer.getStringLength()},onTouchBegan:function(a,b){var c=this,d=ccui.Widget.prototype.onTouchBegan.call(c,
a,b);c._hit?setTimeout(function(){c._textFieldRenderer.attachWithIME()},0):setTimeout(function(){c._textFieldRenderer.detachWithIME()},0);return d},setMaxLengthEnabled:function(a){this._textFieldRenderer.setMaxLengthEnabled(a)},isMaxLengthEnabled:function(){return this._textFieldRenderer.isMaxLengthEnabled()},setMaxLength:function(a){this._textFieldRenderer.setMaxLength(a);this.setString(this.getString())},getMaxLength:function(){return this._textFieldRenderer.getMaxLength()},setPasswordEnabled:function(a){this._textFieldRenderer.setPasswordEnabled(a)},
isPasswordEnabled:function(){return this._textFieldRenderer.isPasswordEnabled()},setPasswordStyleText:function(a){this._textFieldRenderer.setPasswordStyleText(a);this._passwordStyleText=a;this.setString(this.getString())},getPasswordStyleText:function(){return this._passwordStyleText},update:function(a){this.getDetachWithIME()&&(this._detachWithIMEEvent(),this.setDetachWithIME(!1));this.getAttachWithIME()&&(this._attachWithIMEEvent(),this.setAttachWithIME(!1));this.getInsertText()&&(this._textFieldRendererAdaptDirty=
!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._insertTextEvent(),this.setInsertText(!1));this.getDeleteBackward()&&(this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._deleteBackwardEvent(),this.setDeleteBackward(!1))},getAttachWithIME:function(){return this._textFieldRenderer.getAttachWithIME()},setAttachWithIME:function(a){this._textFieldRenderer.setAttachWithIME(a)},getDetachWithIME:function(){return this._textFieldRenderer.getDetachWithIME()},
setDetachWithIME:function(a){this._textFieldRenderer.setDetachWithIME(a)},getInsertText:function(){return this._textFieldRenderer.getInsertText()},setInsertText:function(a){this._textFieldRenderer.setInsertText(a)},getDeleteBackward:function(){return this._textFieldRenderer.getDeleteBackward()},setDeleteBackward:function(a){this._textFieldRenderer.setDeleteBackward(a)},_attachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,
this,ccui.TextField.EVENT_ATTACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_ATTACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_ATTACH_WITH_IME)},_detachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_DETACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_DETACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this,
ccui.TextField.EVENT_DETACH_WITH_IME)},_insertTextEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_INSERT_TEXT):this._textFieldEventSelector(this,ccui.TextField.EVENT_INSERT_TEXT));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_INSERT_TEXT)},_deleteBackwardEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,
this,ccui.TextField.EVENT_DELETE_BACKWARD):this._textFieldEventSelector(this,ccui.TextField.EVENT_DELETE_BACKWARD));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_DELETE_BACKWARD)},addEventListenerTextField:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._textFieldEventSelector=a;this._textFieldEventListener=b},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._textFieldRendererAdaptDirty=!0},_adaptRenderers:function(){this._textFieldRendererAdaptDirty&&
(this._textfieldRendererScaleChangedWithSize(),this._textFieldRendererAdaptDirty=!1)},_textfieldRendererScaleChangedWithSize:function(){this._ignoreSize||this._textFieldRenderer.setDimensions(this._contentSize);this._textFieldRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getAutoRenderSize:function(){var a=this._textFieldRenderer.getContentSize();this._ignoreSize||(this._textFieldRenderer.setDimensions(0,0),a=this._textFieldRenderer.getContentSize(),this._textFieldRenderer.setDimensions(this._contentSize.width,
this._contentSize.height));return a},getVirtualRendererSize:function(){return this._textFieldRenderer.getContentSize()},getVirtualRenderer:function(){return this._textFieldRenderer},getDescription:function(){return"TextField"},attachWithIME:function(){this._textFieldRenderer.attachWithIME()},_createCloneInstance:function(){return new ccui.TextField},_copySpecialProperties:function(a){this.setString(a._textFieldRenderer.getString());this.setPlaceHolder(a.getString());this.setFontSize(a._textFieldRenderer.getFontSize());
this.setFontName(a._textFieldRenderer.getFontName());this.setMaxLengthEnabled(a.isMaxLengthEnabled());this.setMaxLength(a.getMaxLength());this.setPasswordEnabled(a.isPasswordEnabled());this.setPasswordStyleText(a._passwordStyleText);this.setAttachWithIME(a.getAttachWithIME());this.setDetachWithIME(a.getDetachWithIME());this.setInsertText(a.getInsertText());this.setDeleteBackward(a.getDeleteBackward());this._ccEventCallback=a._ccEventCallback;this._textFieldEventListener=a._textFieldEventListener;
this._textFieldEventSelector=a._textFieldEventSelector},setTextAreaSize:function(a){this.setContentSize(a)},setTextHorizontalAlignment:function(a){this._textFieldRenderer.setHorizontalAlignment(a)},setTextVerticalAlignment:function(a){this._textFieldRenderer.setVerticalAlignment(a)},_setFont:function(a){this._textFieldRenderer._setFont(a);this._textFieldRendererAdaptDirty=!0},_getFont:function(){return this._textFieldRenderer._getFont()},_changePosition:function(){this._adaptRenderers()}});
ccui.TextField.create=function(a,b,c){return new ccui.TextField(a,b,c)};_p=ccui.TextField.prototype;cc.defineGetterSetter(_p,"string",_p.getString,_p.setString);cc.defineGetterSetter(_p,"placeHolder",_p.getPlaceHolder,_p.setPlaceHolder);cc.defineGetterSetter(_p,"font",_p._getFont,_p._setFont);cc.defineGetterSetter(_p,"fontSize",_p.getFontSize,_p.setFontSize);cc.defineGetterSetter(_p,"fontName",_p.getFontName,_p.setFontName);cc.defineGetterSetter(_p,"maxLengthEnabled",_p.isMaxLengthEnabled,_p.setMaxLengthEnabled);
cc.defineGetterSetter(_p,"maxLength",_p.getMaxLength,_p.setMaxLength);cc.defineGetterSetter(_p,"passwordEnabled",_p.isPasswordEnabled,_p.setPasswordEnabled);_p=null;ccui.TextField.EVENT_ATTACH_WITH_IME=0;ccui.TextField.EVENT_DETACH_WITH_IME=1;ccui.TextField.EVENT_INSERT_TEXT=2;ccui.TextField.EVENT_DELETE_BACKWARD=3;ccui.TextField.RENDERER_ZORDER=-1;ccui.VideoPlayer=ccui.Widget.extend({_played:!1,_playing:!1,_stopped:!0,ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.setURL(a)},_createRenderCmd:function(){return new ccui.VideoPlayer.RenderCmd(this)},visit:function(){var a=this._renderCmd,b=cc.container,c=cc.eventManager;if(this._visible)b.appendChild(a._video),null===this._listener&&(this._listener=cc.eventManager.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var d=!1;(d="contains"in b?
b.contains(a._video):b.compareDocumentPosition(a._video)%16)&&b.removeChild(a._video);c.removeListener(a._listener);a._listener=null}a.updateStatus();a.resize()},setURL:function(a){this._renderCmd.updateURL(a)},getURL:function(){return this._renderCmd._url},play:function(){var a=this,b=this._renderCmd._video;if(b){this._played=!0;b.pause();if(!1!==this._stopped||!1!==this._playing||!0!==this._played)b.currentTime=0;ccui.VideoPlayer._polyfill.autoplayAfterOperation?setTimeout(function(){b.play();a._playing=
!0;a._stopped=!1},20):(b.play(),this._playing=!0,this._stopped=!1)}},pause:function(){var a=this._renderCmd._video;a&&!0===this._playing&&!1===this._stopped&&(a.pause(),this._playing=!1)},resume:function(){!1===this._stopped&&!1===this._playing&&!0===this._played&&this.play()},stop:function(){var a=this,b=this._renderCmd._video;b&&(b.pause(),b.currentTime=0,this._playing=!1,this._stopped=!0);setTimeout(function(){a._dispatchEvent(ccui.VideoPlayer.EventType.STOPPED)},0)},seekTo:function(a){var b=this._renderCmd._video;
b&&(b.currentTime=a,ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this.isPlaying()&&setTimeout(function(){b.play()},20))},isPlaying:function(){ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this._playing&&setTimeout(function(){video.play()},20);return this._playing},setKeepAspectRatioEnabled:function(a){cc.log("On the web is always keep the aspect ratio")},isKeepAspectRatioEnabled:function(){return!1},setFullScreenEnabled:function(a){var b=this._renderCmd._video;b&&(a?cc.screen.requestFullScreen(b):
cc.screen.exitFullScreen(b))},isFullScreenEnabled:function(){cc.log("Can't know status")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null},_dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._video.src)},onPlayEvent:function(){var a=this._EventList[ccui.VideoPlayer.EventType.PLAYING];if(a)for(var b=0;b<a.length;b++)a[b].call(this,this,this._renderCmd._video.src)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,
a,b);void 0===b&&(b=a.height,a=a.width);this._renderCmd.changeSize(a,b)},cleanup:function(){this._renderCmd.removeDom();this.stopAllActions();this.unscheduleAllCallbacks()},onEnter:function(){ccui.Widget.prototype.onEnter.call(this);var a=ccui.VideoPlayer.elements;-1===a.indexOf(this)&&a.push(this)},onExit:function(){ccui.Widget.prototype.onExit.call(this);var a=ccui.VideoPlayer.elements,b=a.indexOf(this);-1!==b&&a.splice(b,1)}});ccui.VideoPlayer.elements=[];ccui.VideoPlayer.pauseElements=[];
cc.eventManager.addCustomListener(cc.game.EVENT_HIDE,function(){for(var a=ccui.VideoPlayer.elements,b,c=0;c<a.length;c++)b=a[c],a[c]._playing&&(b.pause(),ccui.VideoPlayer.pauseElements.push(b))});cc.eventManager.addCustomListener(cc.game.EVENT_SHOW,function(){for(var a=ccui.VideoPlayer.pauseElements,b=a.pop();b;)b.play(),b=a.pop()});ccui.VideoPlayer.EventType={PLAYING:"play",PAUSED:"pause",STOPPED:"stop",COMPLETED:"complete"};
(function(a){a._polyfill={devicePixelRatio:!1,event:"canplay",canPlayType:[]};var b=document.createElement("video");b.canPlayType("video/ogg")&&(a._polyfill.canPlayType.push(".ogg"),a._polyfill.canPlayType.push(".ogv"));b.canPlayType("video/mp4")&&a._polyfill.canPlayType.push(".mp4");b.canPlayType("video/webm")&&a._polyfill.canPlayType.push(".webm");cc.sys.OS_IOS===cc.sys.os&&(a._polyfill.devicePixelRatio=!0,a._polyfill.event="progress");cc.sys.browserType===cc.sys.BROWSER_TYPE_FIREFOX&&(a._polyfill.autoplayAfterOperation=
!0);a=document.createElement("style");a.innerHTML=".cocosVideo:-moz-full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:full-screen{transform:matrix(1,0,0,1,0,0) !important;}.cocosVideo:-webkit-full-screen{transform:matrix(1,0,0,1,0,0) !important;}";document.head.appendChild(a)})(ccui.VideoPlayer);
(function(a){var b=null,b=cc._renderType===cc.game.RENDER_TYPE_WEBGL?cc.Node.WebGLRenderCmd:cc.Node.CanvasRenderCmd;ccui.VideoPlayer.RenderCmd=function(a){this._rootCtor(a);this._listener=null;this._url="";this.initStyle()};b=ccui.VideoPlayer.RenderCmd.prototype=Object.create(b.prototype);b.constructor=ccui.VideoPlayer.RenderCmd;b.transform=function(a,b){this.originTransform(a,b);this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY)};b.updateStatus=function(){a.devicePixelRatio=
cc.view.isRetinaEnabled();var b=cc.Node._dirtyFlags,d=this._dirtyFlag;d&b.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty);d&b.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&b.orderDirty)};b.resize=function(a){a=a||cc.view;var b=this._node,e=cc.eventManager;b._parent&&b._visible?this.updateMatrix(this._worldTransform,a._scaleX,a._scaleY):(e.removeListener(this._listener),
this._listener=null)};b.updateMatrix=function(b,d,e){var f=this._node;if(a.devicePixelRatio){var h=cc.view.getDevicePixelRatio();d/=h;e/=h}if(!1!==this._loaded){var k=cc.game.container.style,h=parseInt(k.paddingLeft),k=parseInt(k.paddingBottom),m=f._contentSize.width,n=f._contentSize.height;b="matrix("+b.a*d+","+b.b+","+b.c+","+b.d*e+","+(h+b.tx*d-m/2+m*f._scaleX/2*d)+","+-(k+b.ty*e-n/2+n*f._scaleY/2*e)+")";this._video.style.transform=b;this._video.style["-webkit-transform"]=b}};b.updateURL=function(b){var d,
e,f,h=this._node;if(this._url!=b){this._url=b;cc.loader.resPath&&!/^http/.test(b)&&(b=cc.path.join(cc.loader.resPath,b));d=!1;f=cc.container;(d="contains"in f?f.contains(this._video):f.compareDocumentPosition(this._video)%16)&&f.removeChild(this._video);e=this._video=document.createElement("video");this.bindEvent();var k=this,m=function(){!0!=k._loaded&&(k._loaded=!0,k.changeSize(),k.setDirtyFlag(cc.Node._dirtyFlags.transformDirty),e.removeEventListener(a.event,m),e.currentTime=0,e.style.visibility=
"visible",e.play(),h._played||(e.pause(),e.currentTime=0))};e.addEventListener(a.event,m);e.preload="metadata";e.style.visibility="hidden";this._loaded=!1;h._played=!1;h._playing=!1;h._stopped=!0;this.initStyle();this._node.visit();d=document.createElement("source");d.src=b;e.appendChild(d);f=cc.path.extname(b);for(var n=0;n<a.canPlayType.length;n++)f!==a.canPlayType[n]&&(d=document.createElement("source"),d.src=b.replace(f,a.canPlayType[n]),e.appendChild(d))}};b.bindEvent=function(){var a=this,b=
this._node,e=this._video;e.addEventListener("ended",function(){b._renderCmd.updateMatrix(a._worldTransform,cc.view._scaleX,cc.view._scaleY);b._playing=!1;b._dispatchEvent(ccui.VideoPlayer.EventType.COMPLETED)});e.addEventListener("play",function(){b._dispatchEvent(ccui.VideoPlayer.EventType.PLAYING)});e.addEventListener("pause",function(){b._dispatchEvent(ccui.VideoPlayer.EventType.PAUSED)})};b.initStyle=function(){if(this._video){var a=this._video;a.style.position="absolute";a.style.bottom="0px";
a.style.left="0px";a.className="cocosVideo"}};b.changeSize=function(a,b){var e=this._node._contentSize;a=a||e.width;b=b||e.height;if(e=this._video)0!==a&&(e.width=a),0!==b&&(e.height=b)};b.removeDom=function(){var a=this._video;if(a){var b=!1;(b="contains"in cc.container?cc.container.contains(a):cc.container.compareDocumentPosition(a)%16)&&cc.container.removeChild(a)}}})(ccui.VideoPlayer._polyfill);ccui.RichElement=ccui.Class.extend({_type:0,_tag:0,_color:null,_opacity:0,ctor:function(a,b,c){this._type=0;this._tag=a||0;this._color=cc.color(255,255,255,255);b&&(this._color.r=b.r,this._color.g=b.g,this._color.b=b.b);this._opacity=c||0;this._color.a=void 0===c?b.a:c}});
ccui.RichElementText=ccui.RichElement.extend({_text:"",_fontName:"",_fontSize:0,_fontDefinition:null,ctor:function(a,b,c,d,e,f){var h=b;b&&b instanceof cc.FontDefinition&&(h=b.fillStyle,e=b.fontName,f=b.fontSize,this._fontDefinition=b);ccui.RichElement.prototype.ctor.call(this,a,h,c);this._type=ccui.RichElement.TEXT;this._text=d;this._fontName=e;this._fontSize=f}});ccui.RichElementText.create=function(a,b,c,d,e,f){return new ccui.RichElementText(a,b,c,d,e,f)};
ccui.RichElementImage=ccui.RichElement.extend({_filePath:"",_textureRect:null,_textureType:0,ctor:function(a,b,c,d){ccui.RichElement.prototype.ctor.call(this,a,b,c);this._type=ccui.RichElement.IMAGE;this._filePath=d||"";this._textureRect=cc.rect(0,0,0,0);this._textureType=0}});ccui.RichElementImage.create=function(a,b,c,d){return new ccui.RichElementImage(a,b,c,d)};
ccui.RichElementCustomNode=ccui.RichElement.extend({_customNode:null,ctor:function(a,b,c,d){ccui.RichElement.prototype.ctor.call(this,a,b,c);this._type=ccui.RichElement.CUSTOM;this._customNode=d||null}});ccui.RichElementCustomNode.create=function(a,b,c,d){return new ccui.RichElementCustomNode(a,b,c,d)};
ccui.RichText=ccui.Widget.extend({_formatTextDirty:!1,_richElements:null,_elementRenders:null,_leftSpaceWidth:0,_verticalSpace:0,_elementRenderersContainer:null,_lineBreakOnSpace:!1,_textHorizontalAlignment:null,_textVerticalAlignment:null,ctor:function(){ccui.Widget.prototype.ctor.call(this);this._formatTextDirty=!1;this._richElements=[];this._elementRenders=[];this._verticalSpace=this._leftSpaceWidth=0;this._textHorizontalAlignment=cc.TEXT_ALIGNMENT_LEFT;this._textVerticalAlignment=cc.VERTICAL_TEXT_ALIGNMENT_TOP},
_initRenderer:function(){this._elementRenderersContainer=new cc.Node;this._elementRenderersContainer.setAnchorPoint(0.5,0.5);this.addProtectedChild(this._elementRenderersContainer,0,-1)},insertElement:function(a,b){this._richElements.splice(b,0,a);this._formatTextDirty=!0},pushBackElement:function(a){this._richElements.push(a);this._formatTextDirty=!0},removeElement:function(a){cc.isNumber(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;var a,b,c=this._richElements;if(this._ignoreSize)for(this._addNewLine(),a=0;a<c.length;a++){b=c[a];var d=null;switch(b._type){case ccui.RichElement.TEXT:d=b._fontDefinition?new cc.LabelTTF(b._text,b._fontDefinition):new cc.LabelTTF(b._text,b._fontName,b._fontSize);break;case ccui.RichElement.IMAGE:d=new cc.Sprite(b._filePath);break;case ccui.RichElement.CUSTOM:d=b._customNode}d.setColor(b._color);d.setOpacity(b._color.a);this._pushToContainer(d)}else for(this._addNewLine(),
a=0;a<c.length;a++)switch(b=c[a],b._type){case ccui.RichElement.TEXT:b._fontDefinition?this._handleTextRenderer(b._text,b._fontDefinition,b._fontDefinition.fontSize,b._fontDefinition.fillStyle):this._handleTextRenderer(b._text,b._fontName,b._fontSize,b._color);break;case ccui.RichElement.IMAGE:this._handleImageRenderer(b._filePath,b._color,b._color.a);break;case ccui.RichElement.CUSTOM:this._handleCustomRenderer(b._customNode)}this.formatRenderers();this._formatTextDirty=!1}},_handleTextRenderer:function(a,
b,c,d){if(""!==a)if("\n"===a)this._addNewLine();else{var e=b instanceof cc.FontDefinition?new cc.LabelTTF(a,b):new cc.LabelTTF(a,b,c),f=e.getContentSize().width;this._leftSpaceWidth-=f;if(0>this._leftSpaceWidth){var e=a.length*(1- -this._leftSpaceWidth/f),f=a.substr(0,e),h=a.substr(e,a.length-1),k=0<e;this._lineBreakOnSpace&&(h=f.lastIndexOf(" "),e=-1===h?e:h+1,h=a.substr(e,a.length-1),k=0<e&&" "!==h);k&&(a=null,b instanceof cc.FontDefinition?(a=new cc.LabelTTF(f.substr(0,e),b),a.setOpacity(b.fillStyle.a)):
(a=new cc.LabelTTF(f.substr(0,e),b,c),a.setColor(d),a.setOpacity(d.a)),this._pushToContainer(a));this._addNewLine();this._handleTextRenderer(h,b,c,d)}else b instanceof cc.FontDefinition?e.setOpacity(b.fillStyle.a):(e.setColor(d),e.setOpacity(d.a)),this._pushToContainer(e)}},_handleImageRenderer:function(a,b,c){a=new cc.Sprite(a);this._handleCustomRenderer(a)},_handleCustomRenderer:function(a){var b=a.getContentSize();this._leftSpaceWidth-=b.width;0>this._leftSpaceWidth?(this._addNewLine(),this._pushToContainer(a),
this._leftSpaceWidth-=b.width):this._pushToContainer(a)},_addNewLine:function(){this._leftSpaceWidth=this._customSize.width;this._elementRenders.push([])},formatRenderers:function(){var a=0,b=this._elementRenderersContainer,c=this._elementRenders,d,e,f,h,k,m;if(this._ignoreSize){d=0;f=c[0];for(e=h=0;e<f.length;e++)k=f[e],k.setAnchorPoint(cc.p(0,0)),k.setPosition(h,0),b.addChild(k,1,e),m=k.getLineHeight?k.getLineHeight():a,k=k.getContentSize(),d+=k.width,a=Math.max(Math.min(a,m),k.height),h+=k.width;
if(this._textHorizontalAlignment!==cc.TEXT_ALIGNMENT_LEFT)for(m=0,this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_RIGHT?m=this._contentSize.width-h:this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_CENTER&&(m=(this._contentSize.width-h)/2),e=0;e<f.length;e++)f[e].x+=m;b.setContentSize(d,a)}else{var n=[];for(d=0;d<c.length;d++){f=c[d];for(e=h=0;e<f.length;e++)k=f[e],m=k.getLineHeight?k.getLineHeight():k.getContentSize().height,h=Math.max(Math.min(k.getContentSize().height,m),h);n[d]=h;a+=n[d]}var p=
this._customSize.height;for(d=0;d<c.length;d++){f=c[d];h=0;p-=n[d]+this._verticalSpace;for(e=0;e<f.length;e++)k=f[e],k.setAnchorPoint(cc.p(0,0)),k.setPosition(cc.p(h,p)),b.addChild(k,1),h+=k.getContentSize().width;if(this._textHorizontalAlignment!==cc.TEXT_ALIGNMENT_LEFT||this._textVerticalAlignment!==cc.VERTICAL_TEXT_ALIGNMENT_TOP)for(m=0,this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_RIGHT?m=this._contentSize.width-h:this._textHorizontalAlignment===cc.TEXT_ALIGNMENT_CENTER&&(m=(this._contentSize.width-
h)/2),h=0,this._textVerticalAlignment===cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?h=this._customSize.height-a:this._textVerticalAlignment===cc.VERTICAL_TEXT_ALIGNMENT_CENTER&&(h=(this._customSize.height-a)/2),e=0;e<f.length;e++)k=f[e],k.x+=m,k.y-=h}b.setContentSize(this._contentSize)}a=c.length;for(d=0;d<a;d++)c[d].length=0;this._elementRenders.length=0;this.setContentSize(this._ignoreSize?this.getVirtualRendererSize():this._customSize);this._updateContentSizeWithTextureSize(this._contentSize);b.setPosition(0.5*
this._contentSize.width,0.5*this._contentSize.height)},_pushToContainer:function(a){0>=this._elementRenders.length||this._elementRenders[this._elementRenders.length-1].push(a)},_adaptRenderers:function(){this.formatText()},setVerticalSpace:function(a){this._verticalSpace=a},setAnchorPoint:function(a){ccui.Widget.prototype.setAnchorPoint.call(this,a);this._elementRenderersContainer.setAnchorPoint(a)},_setAnchorX:function(a){ccui.Widget.prototype._setAnchorX.call(this,a);this._elementRenderersContainer._setAnchorX(a)},
_setAnchorY:function(a){ccui.Widget.prototype._setAnchorY.call(this,a);this._elementRenderersContainer._setAnchorY(a)},getVirtualRendererSize:function(){return this._elementRenderersContainer.getContentSize()},ignoreContentAdaptWithSize:function(a){this._ignoreSize!==a&&(this._formatTextDirty=!0,ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a))},getContentSize:function(){this.formatText();return cc.Node.prototype.getContentSize.call(this)},_getWidth:function(){this.formatText();return cc.Node.prototype._getWidth.call(this)},
_getHeight:function(){this.formatText();return cc.Node.prototype._getHeight.call(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,void 0===b?a.width:a,void 0===b?a.height:b);this._formatTextDirty=!0},getDescription:function(){return"RichText"},setCascadeOpacityEnabled:function(a){ccui.Widget.prototype.setCascadeOpacityEnabled.call(this,a);this._elementRenderersContainer.setCascadeOpacityEnabled(a)},setLineBreakOnSpace:function(a){this._lineBreakOnSpace=a;this._formatTextDirty=
!0;this.formatText()},setTextHorizontalAlignment:function(a){a!==this._textHorizontalAlignment&&(this._textHorizontalAlignment=a,this.formatText())},setTextVerticalAlignment:function(a){a!==this._textVerticalAlignment&&(this._textVerticalAlignment=a,this.formatText())}});ccui.RichText.create=function(){return new ccui.RichText};ccui.RichElement.TEXT=0;ccui.RichElement.IMAGE=1;ccui.RichElement.CUSTOM=2;ccui.WebView=ccui.Widget.extend({ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.loadURL(a)},visit:function(){var a=this._renderCmd,b=a._div,c=cc.container,d=cc.eventManager;if(this._visible)c.appendChild(b),null===this._listener&&(this._listener=d.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var e=!1;(e="contains"in c?c.contains(b):c.compareDocumentPosition(b)%16)&&c.removeChild(b);b=d._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners();
d._removeListenerInVector(b,a._listener);a._listener=null}a.updateStatus();a.resize(cc.view)},setJavascriptInterfaceScheme:function(a){},loadData:function(a,b,c,d){},loadHTMLString:function(a,b){},loadURL:function(a){this._renderCmd.updateURL(a);this._dispatchEvent(ccui.WebView.EventType.LOADING)},stopLoading:function(){cc.log("Web does not support loading")},reload:function(){var a=this._renderCmd._iframe;a&&(a=a.contentWindow)&&a.location&&a.location.reload()},canGoBack:function(){cc.log("Web does not support query history");
return!0},canGoForward:function(){cc.log("Web does not support query history");return!0},goBack:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoBack");var a=this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.back.call(b)}catch(c){b.history.back()}}}catch(d){cc.log(d)}},goForward:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoForward");var a=
this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.forward.call(b)}catch(c){b.history.forward()}}}catch(d){cc.log(d)}},evaluateJS:function(a){var b=this._renderCmd._iframe;if(b){b=b.contentWindow;try{b.eval(a),this._dispatchEvent(ccui.WebView.EventType.JS_EVALUATED)}catch(c){console.error(c)}}},setScalesPageToFit:function(){cc.log("Web does not support zoom")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null},
_dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._iframe.src)},_createRenderCmd:function(){return new ccui.WebView.RenderCmd(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);void 0===b&&(b=a.height,a=a.width);this._renderCmd.changeSize(a,b)},cleanup:function(){this._renderCmd.removeDom();this.stopAllActions();this.unscheduleAllCallbacks()}});ccui.WebView.EventType={LOADING:"loading",LOADED:"load",ERROR:"error",JS_EVALUATED:"js"};
(function(){var a=ccui.WebView._polyfill={devicePixelRatio:!1,enableDiv:!1};cc.sys.os===cc.sys.OS_IOS&&(a.enableDiv=!0);cc.sys.isMobile?cc.sys.browserType===cc.sys.BROWSER_TYPE_FIREFOX&&(a.enableBG=!0):cc.sys.browserType===cc.sys.BROWSER_TYPE_IE&&(a.closeHistory=!0)})();
(function(a){var b=null,b=cc._renderType===cc.game.RENDER_TYPE_WEBGL?cc.Node.WebGLRenderCmd:cc.Node.CanvasRenderCmd;ccui.WebView.RenderCmd=function(b){this._rootCtor(b);this._iframe=this._div=null;a.enableDiv?(this._div=document.createElement("div"),this._div.style["-webkit-overflow"]="auto",this._div.style["-webkit-overflow-scrolling"]="touch",this._iframe=document.createElement("iframe"),this._iframe.style.width="100%",this._iframe.style.height="100%",this._div.appendChild(this._iframe)):this._div=
this._iframe=document.createElement("iframe");a.enableBG&&(this._div.style.background="#FFF");this._iframe.addEventListener("load",function(){b._dispatchEvent(ccui.WebView.EventType.LOADED)});this._iframe.addEventListener("error",function(){b._dispatchEvent(ccui.WebView.EventType.ERROR)});this._div.style.background="#FFF";this._div.style.height="200px";this._div.style.width="300px";this._div.style.overflow="scroll";this._div.style.border="none";this._listener=null;this.initStyle()};b=ccui.WebView.RenderCmd.prototype=
Object.create(b.prototype);b.constructor=ccui.WebView.RenderCmd;b.transform=function(a,b){this.originTransform(a,b);this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY)};b.updateStatus=function(){a.devicePixelRatio=cc.view.isRetinaEnabled();var b=cc.Node._dirtyFlags,d=this._dirtyFlag;d&b.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty);
d&b.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&b.orderDirty)};b.resize=function(a){a=a||cc.view;var b=this._node,e=cc.eventManager;b._parent&&b._visible?this.updateMatrix(this._worldTransform,a._scaleX,a._scaleY):(a=e._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners(),e._removeListenerInVector(a,this._listener),this._listener=null)};b.updateMatrix=function(b,d,e){var f=this._node;if(a.devicePixelRatio){var h=cc.view.getDevicePixelRatio();d/=h;e/=h}if(!1!==this._loaded){var k=cc.game.container.style,
h=parseInt(k.paddingLeft),k=parseInt(k.paddingBottom),m=f._contentSize.width,n=f._contentSize.height;b="matrix("+b.a*d+","+b.b+","+b.c+","+b.d*e+","+(h+b.tx*d-m/2+m*f._scaleX/2*d)+","+-(k+b.ty*e-n/2+n*f._scaleY/2*e)+")";this._div.style.transform=b;this._div.style["-webkit-transform"]=b}};b.initStyle=function(){if(this._div){var a=this._div;a.style.position="absolute";a.style.bottom="0px";a.style.left="0px"}};b.updateURL=function(a){var b=this._iframe;b.src=a;var e=this,f=function(){e._loaded=!0;b.removeEventListener("load",
f)};b.addEventListener("load",f)};b.changeSize=function(a,b){var e=this._div;e&&(e.style.width=a+"px",e.style.height=b+"px")};b.removeDom=function(){var a=this._div;if(a){var b=!1;(b="contains"in cc.container?cc.container.contains(a):cc.container.compareDocumentPosition(a)%16)&&cc.container.removeChild(a)}}})(ccui.WebView._polyfill);ccui.ScrollViewBar=ccui.ProtectedNode.extend({_parentScroll:null,_direction:null,_upperHalfCircle:null,_lowerHalfCircle:null,_body:null,_opacity:255,_marginFromBoundary:0,_marginForLength:0,_touching:!1,_autoHideEnabled:!0,autoHideTime:0,_autoHideRemainingTime:0,_className:"ScrollViewBar",ctor:function(a,b){cc.ProtectedNode.prototype.ctor.call(this);this._direction=b;this._parentScroll=a;this._marginForLength=this._marginFromBoundary=ccui.ScrollViewBar.DEFAULT_MARGIN;this.opacity=255*ccui.ScrollViewBar.DEFAULT_SCROLLBAR_OPACITY;
this.autoHideTime=ccui.ScrollViewBar.DEFAULT_AUTO_HIDE_TIME;this._autoHideEnabled=!0;ccui.ScrollViewBar.prototype.init.call(this);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0)},init:function(){this._upperHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY);this._upperHalfCircle.setAnchorPoint(cc.p(0.5,0));this._lowerHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY);
this._lowerHalfCircle.setAnchorPoint(cc.p(0.5,0));this._lowerHalfCircle.setScaleY(-1);this.addProtectedChild(this._upperHalfCircle);this.addProtectedChild(this._lowerHalfCircle);this._body=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT,ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT_KEY);this._body.setAnchorPoint(cc.p(0.5,0));this.addProtectedChild(this._body);this.setColor(ccui.ScrollViewBar.DEFAULT_COLOR);this.onScrolled(cc.p(0,0));cc.ProtectedNode.prototype.setOpacity.call(this,
0);this._autoHideRemainingTime=0;this._direction===ccui.ScrollView.DIR_HORIZONTAL&&this.setRotation(90)},setPositionFromCorner:function(a){this._direction===ccui.ScrollView.DIR_VERTICAL?(this._marginForLength=a.y,this._marginFromBoundary=a.x):(this._marginForLength=a.x,this._marginFromBoundary=a.y)},onEnter:function(){cc.ProtectedNode.prototype.onEnter.call(this);this.scheduleUpdate()},getPositionFromCorner:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?cc.p(this._marginFromBoundary,
this._marginForLength):cc.p(this._marginForLength,this._marginFromBoundary)},setWidth:function(a){a/=this._body.width;this._body.setScaleX(a);this._upperHalfCircle.setScale(a);this._lowerHalfCircle.setScale(-a)},getWidth:function(){return this._body.getBoundingBox().width},setAutoHideEnabled:function(a){this._autoHideEnabled=a;!this._autoHideEnabled&&!this._touching&&0>=this._autoHideRemainingTime?cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity):cc.ProtectedNode.prototype.setOpacity.call(this,
0)},isAutoHideEnabled:function(){return this._autoHideEnabled},setOpacity:function(a){this._opacity=a},getOpacity:function(){return this._opacity},_updateLength:function(a){var b=a/this._body.getTextureRect().height;this._body.setScaleY(b);this._upperHalfCircle.setPositionY(this._body.getPositionY()+a)},_processAutoHide:function(a){!this._autoHideEnabled||0>=this._autoHideRemainingTime||this._touching||(this._autoHideRemainingTime-=a,this._autoHideRemainingTime<=this.autoHideTime&&(this._autoHideRemainingTime=
Math.max(0,this._autoHideRemainingTime),cc.ProtectedNode.prototype.setOpacity.call(this,this._autoHideRemainingTime/this.autoHideTime*this._opacity)))},update:function(a){this._processAutoHide(a)},onTouchBegan:function(){this._autoHideEnabled&&(this._touching=!0)},onTouchEnded:function(){this._autoHideEnabled&&(this._touching=!1,0>=this._autoHideRemainingTime||(this._autoHideRemainingTime=this.autoHideTime))},onScrolled:function(a){this._autoHideEnabled&&(this._autoHideRemainingTime=this.autoHideTime,
cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity));var b=this._parentScroll.getInnerContainer(),c=0,d=0,e=0,f=0;this._direction===ccui.ScrollView.DIR_VERTICAL?(c=b.height,d=this._parentScroll.height,e=a.y,f=-b.getPositionY()):this._direction===ccui.ScrollView.DIR_HORIZONTAL&&(c=b.width,d=this._parentScroll.width,e=a.x,f=-b.getPositionX());a=this._calculateLength(c,d,e);c=this._calculatePosition(c,d,f,e,a);this._updateLength(a);this.setPosition(c)},_calculateLength:function(a,b,c){0!==
c&&(a+=20*(0<c?c:-c));c=b/a;return Math.abs(b-2*this._marginForLength)*c},_calculatePosition:function(a,b,c,d,e){a-=b;0!==d&&(a+=Math.abs(d));d=0;0!==a&&(d=Math.max(c/a,0),d=Math.min(d,1));b=(b-e-2*this._marginForLength)*d+this._marginForLength;return this._direction===ccui.ScrollView.DIR_VERTICAL?cc.p(this._parentScroll.width-this._marginFromBoundary,b):cc.p(b,this._marginFromBoundary)}});_p=ccui.ScrollViewBar.prototype;cc.defineGetterSetter(_p,"opacity",_p.getOpacity,_p.setOpacity);
cc.defineGetterSetter(_p,"autoHideEnabled",_p.isAutoHideEnabled,_p.setAutoHideEnabled);ccui.ScrollViewBar.DEFAULT_COLOR=cc.color(52,65,87);ccui.ScrollViewBar.DEFAULT_MARGIN=20;ccui.ScrollViewBar.DEFAULT_AUTO_HIDE_TIME=0.2;ccui.ScrollViewBar.DEFAULT_SCROLLBAR_OPACITY=0.4;ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY="/__half_circle_image";ccui.ScrollViewBar.HALF_CIRCLE_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAGCAMAAADAMI+zAAAAJ1BMVEX///////////////////////////////////////////////////9Ruv0SAAAADHRSTlMABgcbbW7Hz9Dz+PmlcJP5AAAAMElEQVR4AUXHwQ2AQAhFwYcLH1H6r1djzDK3ASxUpTBeK/uTCyz7dx54b44m4p5cD1MwAooEJyk3AAAAAElFTkSuQmCC";
ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT_KEY="/__body_image_height";ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAABCAMAAADdNb8LAAAAA1BMVEX///+nxBvIAAAACklEQVR4AWNABgAADQABYc2cpAAAAABJRU5ErkJggg\x3d\x3d";ccui.ScrollView=ccui.Layout.extend({_innerContainer:null,_direction:null,_topBoundary:0,_bottomBoundary:0,_leftBoundary:0,_rightBoundary:0,_touchMoveDisplacements:null,_touchMoveTimeDeltas:null,_touchMovePreviousTimestamp:0,_touchTotalTimeThreshold:0.5,_autoScrolling:!1,_autoScrollTargetDelta:null,_autoScrollAttenuate:!0,_autoScrollStartPosition:null,_autoScrollTotalTime:0,_autoScrollAccumulatedTime:0,_autoScrollCurrentlyOutOfBoundary:!1,_autoScrollBraking:!1,_autoScrollBrakingStartPosition:null,
_bePressed:!1,_childFocusCancelOffset:0,bounceEnabled:!1,_outOfBoundaryAmount:null,_outOfBoundaryAmountDirty:!0,inertiaScrollEnabled:!1,_scrollBarEnabled:!0,_verticalScrollBar:null,_horizontalScrollBar:null,_scrollViewEventListener:null,_scrollViewEventSelector:null,_className:"ScrollView",ctor:function(){ccui.Layout.prototype.ctor.call(this);this.setClippingEnabled(!0);this._innerContainer.setTouchEnabled(!1);this._direction=ccui.ScrollView.DIR_NONE;this._childFocusCancelOffset=5;this.inertiaScrollEnabled=
!0;this._outOfBoundaryAmount=cc.p(0,0);this._autoScrollTargetDelta=cc.p(0,0);this._autoScrollStartPosition=cc.p(0,0);this._autoScrollBrakingStartPosition=cc.p(0,0);this._touchMoveDisplacements=[];this._touchMoveTimeDeltas=[];this._touchMovePreviousTimestamp=0;this._scrollBarEnabled=!0;this._initScrollBar();this.setTouchEnabled(!0)},onEnter:function(){ccui.Layout.prototype.onEnter.call(this);this.scheduleUpdate()},onExit:function(){cc.renderer._removeCache(this.__instanceId);ccui.Layout.prototype.onExit.call(this)},
visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){this._adaptRenderers();this._doLayout();a=cc.renderer;b.visit(c);a.pushRenderCommand(b);b instanceof ccui.ScrollView.WebGLRenderCmd&&a._turnToCacheMode(this.__instanceId);var d=this._clippingEnabled&&this._clippingType===ccui.Layout.CLIPPING_STENCIL,e=this._clippingEnabled&&this._clippingType===ccui.Layout.CLIPPING_SCISSOR;d?b.stencilClippingVisit(c):e&&b.scissorClippingVisit(c);var f,h=this._children,k=h.length,m,c=this._protectedChildren,
n=c.length;this._reorderChildDirty&&this.sortAllChildren();this._reorderProtectedChildDirty&&this.sortAllProtectedChildren();for(f=0;f<k;f++)(m=h[f])&&m._visible&&m.visit(this);for(f=0;f<n;f++)(h=c[f])&&h._visible&&(b._changeProtectedChild(h),h.visit(this));d?b.postStencilVisit():e&&b.postScissorVisit();b instanceof ccui.ScrollView.WebGLRenderCmd&&a._turnToNormalMode();this.updateChildren();b._dirtyFlag=0}else b._propagateFlagsDown(c)},findNextFocusedWidget:function(a,b){return this.getLayoutType()===
ccui.Layout.LINEAR_VERTICAL||this.getLayoutType()===ccui.Layout.LINEAR_HORIZONTAL?this._innerContainer.findNextFocusedWidget(a,b):ccui.Widget.prototype.findNextFocusedWidget.call(this,a,b)},_initRenderer:function(){ccui.Layout.prototype._initRenderer.call(this);this._innerContainer=new ccui.Layout;this._innerContainer.setColor(cc.color(255,255,255));this._innerContainer.setOpacity(255);this._innerContainer.setCascadeColorEnabled(!0);this._innerContainer.setCascadeOpacityEnabled(!0);this.addProtectedChild(this._innerContainer,
1,1)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new ccui.ScrollView.WebGLRenderCmd(this):new ccui.ScrollView.CanvasRenderCmd(this)},_onSizeChanged:function(){ccui.Layout.prototype._onSizeChanged.call(this);var a=this._contentSize;this._topBoundary=a.height;this._rightBoundary=a.width;var b=this._innerContainer.getContentSize();this._innerContainer.setContentSize(cc.size(Math.max(b.width,a.width),Math.max(b.height,a.height)));this._innerContainer.setPosition(0,a.height-
this._innerContainer.getContentSize().height);if(this._verticalScrollBar)this._verticalScrollBar.onScrolled(this._getHowMuchOutOfBoundary());if(this._horizontalScrollBar)this._horizontalScrollBar.onScrolled(this._getHowMuchOutOfBoundary())},setInnerContainerSize:function(a){var b=this._innerContainer,c=this._contentSize,d=c.width,e=c.height;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;b.setContentSize(cc.size(d,e));a=this._innerContainer.getPosition();b=this._innerContainer.getAnchorPoint();0!=this._innerContainer.getLeftBoundary()&&(a.x=b.x*d);this._innerContainer.getTopBoundary()!=this._contentSize.height&&(a.y=this._contentSize.height-(1-b.y)*e);this.setInnerContainerPosition(a);this._updateScrollBar(cc.p(0,0))},_setInnerWidth:function(a){var b=this._contentSize.width,c=b,d=this._innerContainer,e=d.width;a<b?cc.log("Inner width \x3c\x3d scrollview width, it will be force sized!"):
c=a;d.width=c;switch(this._direction){case ccui.ScrollView.DIR_HORIZONTAL:case ccui.ScrollView.DIR_BOTH:d.getRightBoundary()<=b&&this._scrollChildren(e-d.width,0)}a=d.anchorX;0<d.getLeftBoundary()&&(d.x=a*c);d.getRightBoundary()<b&&(d.x=b-(1-a)*c)},_setInnerHeight:function(a){var b=this._contentSize.height,c=b,d=this._innerContainer,e=d.height;a<b?cc.log("Inner height \x3c\x3d scrollview height, it will be force sized!"):c=a;d.height=c;switch(this._direction){case ccui.ScrollView.DIR_VERTICAL:case ccui.ScrollView.DIR_BOTH:this._scrollChildren(0,
e-c)}a=d.anchorY;0<d.getLeftBoundary()&&(d.y=a*c);d.getRightBoundary()<b&&(d.y=b-(1-a)*c)},setInnerContainerPosition:function(a){if(a.x!==this._innerContainer.getPositionX()||a.y!==this._innerContainer.getPositionY()){this._innerContainer.setPosition(a);this._outOfBoundaryAmountDirty=!0;if(this.bounceEnabled)for(a=ccui.ScrollView.MOVEDIR_TOP;a<ccui.ScrollView.MOVEDIR_RIGHT;++a)this._isOutOfBoundary(a)&&this._processScrollEvent(a,!0);this._dispatchEvent(ccui.ScrollView.EVENT_CONTAINER_MOVED)}},getInnerContainerPosition:function(){return this._innerContainer.getPosition()},
getInnerContainerSize:function(){return this._innerContainer.getContentSize()},_getInnerWidth:function(){return this._innerContainer.width},_getInnerHeight:function(){return this._innerContainer.height},_isInContainer:function(a){if(!this._clippingEnabled)return!0;var b=a._position,c=a._contentSize;a=a._anchorPoint;var d=this._customSize,e=this._innerContainer._position,f=0,h=0;return(f=b.y-a.y*c.height)>=d.height-e.y||f+c.height<=-e.y||(h=b.x-a.x*c.width)>=d.width-e.x||h+c.width<=-e.x?!1:!0},updateChildren:function(){var a,
b,c,d=this._innerContainer._children;b=0;for(c=d.length;b<c;b++)a=d[b],!0===a._inViewRect&&!1===this._isInContainer(a)?a._inViewRect=!1:!1===a._inViewRect&&!0===this._isInContainer(a)&&(a._inViewRect=!0)},addChild:function(a,b,c){if(!a)return!1;!1===this._isInContainer(a)&&(a._inViewRect=!1);b=b||a.getLocalZOrder();c=c||a.getTag();return this._innerContainer.addChild(a,b,c)},removeAllChildren:function(){this.removeAllChildrenWithCleanup(!0)},removeAllChildrenWithCleanup:function(a){this._innerContainer.removeAllChildrenWithCleanup(a)},
removeChild:function(a,b){return this._innerContainer.removeChild(a,b)},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)},_flattenVectorByDirection:function(a){var b=cc.p(0,0);b.x=this._direction===ccui.ScrollView.DIR_VERTICAL?0:a.x;b.y=this._direction===ccui.ScrollView.DIR_HORIZONTAL?
0:a.y;return b},_getHowMuchOutOfBoundary:function(a){void 0===a&&(a=cc.p(0,0));if(0===a.x&&0===a.y&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var b=cc.p(0,0);this._innerContainer.getLeftBoundary()+a.x>this._leftBoundary?b.x=this._leftBoundary-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.x<this._rightBoundary&&(b.x=this._rightBoundary-(this._innerContainer.getRightBoundary()+a.x));this._innerContainer.getTopBoundary()+a.y<this._topBoundary?
b.y=this._topBoundary-(this._innerContainer.getTopBoundary()+a.y):this._innerContainer.getBottomBoundary()+a.y>this._bottomBoundary&&(b.y=this._bottomBoundary-(this._innerContainer.getBottomBoundary()+a.y));0===a.x&&0===a.y&&(this._outOfBoundaryAmount=b,this._outOfBoundaryAmountDirty=!1);return b},_isOutOfBoundary:function(a){var b=this._getHowMuchOutOfBoundary();if(void 0!==a)switch(a){case ccui.ScrollView.MOVEDIR_TOP:return 0<b.y;case ccui.ScrollView.MOVEDIR_BOTTOM:return 0>b.y;case ccui.ScrollView.MOVEDIR_LEFT:return 0>
b.x;case ccui.ScrollView.MOVEDIR_RIGHT:return 0<b.x}else return!this._fltEqualZero(b);return!1},_moveInnerContainer:function(a,b){var c=this._flattenVectorByDirection(a);this.setInnerContainerPosition(cc.pAdd(this.getInnerContainerPosition(),c));c=this._getHowMuchOutOfBoundary();this._updateScrollBar(c);this.bounceEnabled&&b&&this._startBounceBackIfNeeded()},_updateScrollBar:function(a){if(this._verticalScrollBar)this._verticalScrollBar.onScrolled(a);if(this._horizontalScrollBar)this._horizontalScrollBar.onScrolled(a)},
_calculateTouchMoveVelocity:function(){for(var a=0,b=0;b<this._touchMoveTimeDeltas.length;++b)a+=this._touchMoveTimeDeltas[b];if(0==a||a>=this._touchTotalTimeThreshold)return cc.p(0,0);for(var c=cc.p(0,0),b=0;b<this._touchMoveDisplacements.length;++b)c.x+=this._touchMoveDisplacements[b].x,c.y+=this._touchMoveDisplacements[b].y;return cc.pMult(c,1/a)},setTouchTotalTimeThreshold:function(a){this._touchTotalTimeThreshold=a},getTouchTotalTimeThreshold:function(){return this._touchTotalTimeThreshold},
_startInertiaScroll:function(a){var b=cc.pMult(a,0.7);this._startAttenuatingAutoScroll(b,a)},_startBounceBackIfNeeded:function(){if(!this.bounceEnabled)return!1;var a=this._getHowMuchOutOfBoundary();if(this._fltEqualZero(a))return!1;this._startAutoScroll(a,1,!0);return!0},_startAutoScrollToDestination:function(a,b,c){this._startAutoScroll(cc.pSub(a,this._innerContainer.getPosition()),b,c)},_calculateAutoScrollTimeByInitialSpeed:function(a){return Math.sqrt(Math.sqrt(a/5))},_startAttenuatingAutoScroll:function(a,
b){var c=this._calculateAutoScrollTimeByInitialSpeed(cc.pLength(b));this._startAutoScroll(a,c,!0)},_startAutoScroll:function(a,b,c){a=this._flattenVectorByDirection(a);this._autoScrolling=!0;this._autoScrollTargetDelta=a;this._autoScrollAttenuate=c;this._autoScrollStartPosition=this._innerContainer.getPosition();this._autoScrollTotalTime=b;this._autoScrollAccumulatedTime=0;this._autoScrollBraking=!1;this._autoScrollBrakingStartPosition=cc.p(0,0);b=this._getHowMuchOutOfBoundary();!this._fltEqualZero(b)&&
(this._autoScrollCurrentlyOutOfBoundary=!0,c=this._getHowMuchOutOfBoundary(a),0<b.x*c.x||0<b.y*c.y)&&(this._autoScrollBraking=!0)},stopAutoScroll:function(){this._autoScrolling=!1;this._autoScrollAttenuate=!0;this._autoScrollAccumulatedTime=this._autoScrollTotalTime=0},_isNecessaryAutoScrollBrake:function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollBraking=this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBrakingStartPosition=
this.getInnerContainerPosition(),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},_getAutoScrollStopEpsilon:function(){return 1E-4},_fltEqualZero:function(a){return 1E-4>=Math.abs(a.x)&&1E-4>=Math.abs(a.y)},_processAutoScrolling:function(a){var b=this._isNecessaryAutoScrollBrake()?0.05:1;this._autoScrollAccumulatedTime+=1/b*a;var c=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(c-=1,c=c*c*c*c*c+1);a=cc.pAdd(this._autoScrollStartPosition,
cc.pMult(this._autoScrollTargetDelta,c));c=Math.abs(c-1)<=this._getAutoScrollStopEpsilon();this.bounceEnabled?a=cc.pAdd(this._autoScrollBrakingStartPosition,cc.pMult(cc.pSub(a,this._autoScrollBrakingStartPosition),b)):(b=cc.pSub(a,this.getInnerContainerPosition()),b=this._getHowMuchOutOfBoundary(b),this._fltEqualZero(b)||(a.x+=b.x,a.y+=b.y,c=!0));c&&(this._autoScrolling=!1,this._dispatchEvent(ccui.ScrollView.EVENT_AUTOSCROLL_ENDED));this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()),
c)},_jumpToDestination:function(a,b){void 0===a.x&&(a=cc.p(a,b));this._autoScrolling=!1;this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()),!0)},_scrollChildren:function(a){if(this.bounceEnabled){var b=this._getHowMuchOutOfBoundary();a.x*=0==b.x?1:0.5;a.y*=0==b.y?1:0.5}this.bounceEnabled||(b=this._getHowMuchOutOfBoundary(a),a.x+=b.x,a.y+=b.y);var c=b=!1,d=!1,e=!1;0<a.y?this._innerContainer.getBottomBoundary()+a.y>=this._bottomBoundary&&(e=!0):0>a.y&&this._innerContainer.getTopBoundary()+
a.y<=this._topBoundary&&(d=!0);0>a.x?this._innerContainer.getRightBoundary()+a.x<=this._rightBoundary&&(c=!0):0<a.x&&this._innerContainer.getLeftBoundary()+a.x>=this._leftBoundary&&(b=!0);this._moveInnerContainer(a,!1);0==a.x&&0==a.y||this._processScrollingEvent();e&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_BOTTOM,!1);d&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_TOP,!1);b&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_LEFT,!1);c&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_RIGHT,
!1)},scrollToBottom:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),0),a,b)},scrollToTop:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToLeft:function(a,b){this._startAutoScrollToDestination(cc.p(0,this._innerContainer.getPositionY()),a,b)},scrollToRight:function(a,b){this._startAutoScrollToDestination(cc.p(this._contentSize.width-
this._innerContainer.getContentSize().width,this._innerContainer.getPositionY()),a,b)},scrollToTopLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToTopRight:function(a,b){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll direction is not both!");else{var c=this._innerContainer.getContentSize();this._startAutoScrollToDestination(cc.p(this._contentSize.width-
c.width,this._contentSize.height-c.height),a,b)}},scrollToBottomLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,0),a,b)},scrollToBottomRight:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(this._contentSize.width-this._innerContainer.getContentSize().width,0),a,b)},scrollToPercentVertical:function(a,b,c){var d=this._contentSize.height-
this._innerContainer.getContentSize().height,e=-d;this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),d+a*e/100),b,c)},scrollToPercentHorizontal:function(a,b,c){var d=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a*d/100),this._innerContainer.getPositionY()),b,c)},scrollToPercentBothDirection:function(a,b,c){if(this._direction===ccui.ScrollView.DIR_BOTH){var d=this._contentSize.height-this._innerContainer.getContentSize().height,
e=-d,f=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a.x*f/100),d+a.y*e/100),b,c)}},jumpToBottom:function(){this._jumpToDestination(this._innerContainer.getPositionX(),0)},jumpToTop:function(){this._jumpToDestination(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToLeft:function(){this._jumpToDestination(0,this._innerContainer.getPositionY())},jumpToRight:function(){this._jumpToDestination(this._contentSize.width-
this._innerContainer.getContentSize().width,this._innerContainer.getPositionY())},jumpToTopLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToTopRight:function(){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll _direction is not both!");else{var a=this._innerContainer.getContentSize();this._jumpToDestination(this._contentSize.width-a.width,
this._contentSize.height-a.height)}},jumpToBottomLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,0)},jumpToBottomRight:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(this._contentSize.width-this._innerContainer.getContentSize().width,0)},jumpToPercentVertical:function(a){var b=this._contentSize.height-this._innerContainer.getContentSize().height,c=-b;
this._jumpToDestination(this._innerContainer.getPositionX(),b+a*c/100)},jumpToPercentHorizontal:function(a){var b=this._innerContainer.getContentSize().width-this._contentSize.width;this._jumpToDestination(-(a*b/100),this._innerContainer.getPositionY())},jumpToPercentBothDirection:function(a){if(this._direction===ccui.ScrollView.DIR_BOTH){var b=this._innerContainer.getContentSize(),c=this._contentSize.height-b.height;this._jumpToDestination(-(a.x*(b.width-this._contentSize.width)/100),c+a.y*-c/100)}},
_gatherTouchMove:function(a){for(;5<=this._touchMoveDisplacements.length;)this._touchMoveDisplacements.splice(0,1),this._touchMoveTimeDeltas.splice(0,1);this._touchMoveDisplacements.push(a);a=(new Date).getTime();this._touchMoveTimeDeltas.push((a-this._touchMovePreviousTimestamp)/1E3);this._touchMovePreviousTimestamp=a},_handlePressLogic:function(a){this._bePressed=!0;this._autoScrolling=!1;this._touchMovePreviousTimestamp=(new Date).getTime();this._touchMoveDisplacements.length=0;this._touchMoveTimeDeltas.length=
0;if(this._verticalScrollBar)this._verticalScrollBar.onTouchBegan();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchBegan()},_handleMoveLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._scrollChildren(b);this._gatherTouchMove(b)},_handleReleaseLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._gatherTouchMove(b);
this._bePressed=!1;!this._startBounceBackIfNeeded()&&this.inertiaScrollEnabled&&(b=this._calculateTouchMoveVelocity(),0===b.x&&0===b.y||this._startInertiaScroll(b));if(this._verticalScrollBar)this._verticalScrollBar.onTouchEnded();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchEnded()},onTouchBegan:function(a,b){var c=ccui.Layout.prototype.onTouchBegan.call(this,a,b);this._isInterceptTouch||this._hit&&this._handlePressLogic(a);return c},onTouchMoved:function(a,b){ccui.Layout.prototype.onTouchMoved.call(this,
a,b);this._isInterceptTouch||this._handleMoveLogic(a)},onTouchEnded:function(a,b){ccui.Layout.prototype.onTouchEnded.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},onTouchCancelled:function(a,b){ccui.Layout.prototype.onTouchCancelled.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},update:function(a){this._autoScrolling&&this._processAutoScrolling(a)},interceptTouchEvent:function(a,b,c){if(!this._touchEnabled)ccui.Layout.prototype.interceptTouchEvent.call(this,
a,b,c);else if(this._direction!==ccui.ScrollView.DIR_NONE){var d=c.getLocation();switch(a){case ccui.Widget.TOUCH_BEGAN:this._isInterceptTouch=!0;this._touchBeganPosition.x=d.x;this._touchBeganPosition.y=d.y;this._handlePressLogic(c);break;case ccui.Widget.TOUCH_MOVED:a=cc.pLength(cc.pSub(b.getTouchBeganPosition(),d));this._touchMovePosition.x=d.x;this._touchMovePosition.y=d.y;a>this._childFocusCancelOffset&&(b.setHighlighted(!1),this._handleMoveLogic(c));break;case ccui.Widget.TOUCH_CANCELED:case ccui.Widget.TOUCH_ENDED:this._touchEndPosition.x=
d.x,this._touchEndPosition.y=d.y,this._handleReleaseLogic(c),b.isSwallowTouches()&&(this._isInterceptTouch=!1)}}},_processScrollEvent:function(a,b){var c=0;switch(a){case ccui.ScrollView.MOVEDIR_TOP:c=b?ccui.ScrollView.EVENT_BOUNCE_TOP:ccui.ScrollView.EVENT_SCROLL_TO_TOP;break;case ccui.ScrollView.MOVEDIR_BOTTOM:c=b?ccui.ScrollView.EVENT_BOUNCE_BOTTOM:ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM;break;case ccui.ScrollView.MOVEDIR_LEFT:c=b?ccui.ScrollView.EVENT_BOUNCE_LEFT:ccui.ScrollView.EVENT_SCROLL_TO_LEFT;
break;case ccui.ScrollView.MOVEDIR_RIGHT:c=b?ccui.ScrollView.EVENT_BOUNCE_RIGHT:ccui.ScrollView.EVENT_SCROLL_TO_RIGHT}this._dispatchEvent(c)},_processScrollingEvent:function(){this._dispatchEvent(ccui.ScrollView.EVENT_SCROLLING)},_dispatchEvent:function(a){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,a):this._scrollViewEventSelector(this,a));this._ccEventCallback&&this._ccEventCallback(this,a)},addEventListenerScrollView:function(a,
b){this._scrollViewEventSelector=a;this._scrollViewEventListener=b},addEventListener:function(a){this._ccEventCallback=a},setDirection:function(a){this._direction=a;this._scrollBarEnabled&&(this._removeScrollBar(),this._initScrollBar())},getDirection:function(){return this._direction},setBounceEnabled:function(a){this.bounceEnabled=a},isBounceEnabled:function(){return this.bounceEnabled},setInertiaScrollEnabled:function(a){this.inertiaScrollEnabled=a},isInertiaScrollEnabled:function(){return this.inertiaScrollEnabled},
setScrollBarEnabled:function(a){this._scrollBarEnabled!==a&&(this._scrollBarEnabled&&this._removeScrollBar(),(this._scrollBarEnabled=a)&&this._initScrollBar())},isScrollBarEnabled:function(){return this._scrollBarEnabled},setScrollBarPositionFromCorner:function(a){this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a);this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a)},setScrollBarPositionFromCornerForVertical:function(a){cc.assert(this._scrollBarEnabled,
"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");this._verticalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForVertical:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");return this._verticalScrollBar.getPositionFromCorner()},setScrollBarPositionFromCornerForHorizontal:function(a){cc.assert(this._scrollBarEnabled,
"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");this._horizontalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForHorizontal:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");return this._horizontalScrollBar.getPositionFromCorner()},setScrollBarWidth:function(a){cc.assert(this._scrollBarEnabled,
"Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.setWidth(a);this._horizontalScrollBar&&this._horizontalScrollBar.setWidth(a)},getScrollBarWidth:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.getWidth():this._horizontalScrollBar?this._horizontalScrollBar.getWidth():0},setScrollBarColor:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&
this._verticalScrollBar.setColor(a);this._horizontalScrollBar&&this._horizontalScrollBar.setColor(a)},getScrollBarColor:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.getColor();this._horizontalScrollBar&&this._horizontalScrollBar.getColor();return cc.color.WHITE},setScrollBarOpacity:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.opacity=a);
this._horizontalScrollBar&&(this._horizontalScrollBar.opacity=a)},getScrollBarOpacity:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.opacity:this._horizontalScrollBar?this._horizontalScrollBar.opacity:-1},setScrollBarAutoHideEnabled:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideEnabled=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideEnabled=
a)},isScrollBarAutoHideEnabled:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideEnabled:this._horizontalScrollBar?this._horizontalScrollBar.autoHideEnabled:!1},setScrollBarAutoHideTime:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideTime=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideTime=a)},getScrollBarAutoHideTime:function(){cc.assert(this._scrollBarEnabled,
"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideTime:this._horizontalScrollBar?this._horizontalScrollBar.autoHideTime:0},getInnerContainer:function(){return this._innerContainer},setLayoutType:function(a){this._innerContainer.setLayoutType(a)},getLayoutType:function(){return this._innerContainer.getLayoutType()},_doLayout:function(){this._doLayoutDirty&&(this._doLayoutDirty=!1)},getDescription:function(){return"ScrollView"},_createCloneInstance:function(){return new ccui.ScrollView},
_copyClonedWidgetChildren:function(a){ccui.Layout.prototype._copyClonedWidgetChildren.call(this,a)},_copySpecialProperties:function(a){a instanceof ccui.ScrollView&&(ccui.Layout.prototype._copySpecialProperties.call(this,a),this.setInnerContainerSize(a.getInnerContainerSize()),this.setInnerContainerPosition(a.getInnerContainerPosition()),this.setDirection(a._direction),this._topBoundary=a._topBoundary,this._bottomBoundary=a._bottomBoundary,this._leftBoundary=a._leftBoundary,this._rightBoundary=a._rightBoundary,
this._bePressed=a._bePressed,this._childFocusCancelOffset=a._childFocusCancelOffset,this._touchMoveDisplacements=a._touchMoveDisplacements,this._touchMoveTimeDeltas=a._touchMoveTimeDeltas,this._touchMovePreviousTimestamp=a._touchMovePreviousTimestamp,this._autoScrolling=a._autoScrolling,this._autoScrollAttenuate=a._autoScrollAttenuate,this._autoScrollStartPosition=a._autoScrollStartPosition,this._autoScrollTargetDelta=a._autoScrollTargetDelta,this._autoScrollTotalTime=a._autoScrollTotalTime,this._autoScrollAccumulatedTime=
a._autoScrollAccumulatedTime,this._autoScrollCurrentlyOutOfBoundary=a._autoScrollCurrentlyOutOfBoundary,this._autoScrollBraking=a._autoScrollBraking,this._autoScrollBrakingStartPosition=a._autoScrollBrakingStartPosition,this.setBounceEnabled(a.bounceEnabled),this.setInertiaScrollEnabled(a.inertiaScrollEnabled),this._scrollViewEventListener=a._scrollViewEventListener,this._scrollViewEventSelector=a._scrollViewEventSelector,this._ccEventCallback=a._ccEventCallback,this.setScrollBarEnabled(a.isScrollBarEnabled()),
this.isScrollBarEnabled()&&(this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a.getScrollBarPositionFromCornerForVertical()),this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a.getScrollBarPositionFromCornerForHorizontal()),this.setScrollBarWidth(a.getScrollBarWidth()),this.setScrollBarColor(a.getScrollBarColor()),this.setScrollBarAutoHideEnabled(a.isScrollBarAutoHideEnabled()),this.setScrollBarAutoHideTime(a.getScrollBarAutoHideTime())))},
_initScrollBar:function(){this._direction===ccui.ScrollView.DIR_HORIZONTAL||this._verticalScrollBar||(this._verticalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_VERTICAL),this.addProtectedChild(this._verticalScrollBar,2));this._direction===ccui.ScrollView.DIR_VERTICAL||this._horizontalScrollBar||(this._horizontalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_HORIZONTAL),this.addProtectedChild(this._horizontalScrollBar,2))},_removeScrollBar:function(){this._verticalScrollBar&&
(this.removeProtectedChild(this._verticalScrollBar),this._verticalScrollBar=null);this._horizontalScrollBar&&(this.removeProtectedChild(this._horizontalScrollBar),this._horizontalScrollBar=null)},getNodeByTag:function(a){return this._innerContainer.getNodeByTag(a)},getNodes:function(){return this._innerContainer.getNodes()},removeNode:function(a){this._innerContainer.removeNode(a)},removeNodeByTag:function(a){this._innerContainer.removeNodeByTag(a)},removeAllNodes:function(){this._innerContainer.removeAllNodes()},
addNode:function(a,b,c){this._innerContainer.addNode(a,b,c)}});_p=ccui.ScrollView.prototype;cc.defineGetterSetter(_p,"innerWidth",_p._getInnerWidth,_p._setInnerWidth);cc.defineGetterSetter(_p,"innerHeight",_p._getInnerHeight,_p._setInnerHeight);cc.defineGetterSetter(_p,"direction",_p.getDirection,_p.setDirection);cc.defineGetterSetter(_p,"touchTotalTimeThreshold",_p.getTouchTotalTimeThreshold,_p.setTouchTotalTimeThreshold);_p=null;ccui.ScrollView.create=function(){return new ccui.ScrollView};
ccui.ScrollView.DIR_NONE=0;ccui.ScrollView.DIR_VERTICAL=1;ccui.ScrollView.DIR_HORIZONTAL=2;ccui.ScrollView.DIR_BOTH=3;ccui.ScrollView.EVENT_SCROLL_TO_TOP=0;ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM=1;ccui.ScrollView.EVENT_SCROLL_TO_LEFT=2;ccui.ScrollView.EVENT_SCROLL_TO_RIGHT=3;ccui.ScrollView.EVENT_SCROLLING=4;ccui.ScrollView.EVENT_BOUNCE_TOP=5;ccui.ScrollView.EVENT_BOUNCE_BOTTOM=6;ccui.ScrollView.EVENT_BOUNCE_LEFT=7;ccui.ScrollView.EVENT_BOUNCE_RIGHT=8;ccui.ScrollView.EVENT_CONTAINER_MOVED=9;
ccui.ScrollView.EVENT_AUTOSCROLL_ENDED=10;ccui.ScrollView.MOVEDIR_TOP=0;ccui.ScrollView.MOVEDIR_BOTTOM=1;ccui.ScrollView.MOVEDIR_LEFT=2;ccui.ScrollView.MOVEDIR_RIGHT=3;ccui.ListView=ccui.ScrollView.extend({_model:null,_items:null,_gravity:null,_itemsMargin:0,_curSelectedIndex:0,_refreshViewDirty:!0,_listViewEventListener:null,_listViewEventSelector:null,_ccListViewEventCallback:null,_magneticAllowedOutOfBoundary:!0,_magneticType:0,_className:"ListView",ctor:function(){this._items=[];ccui.ScrollView.prototype.ctor.call(this);this._gravity=ccui.ListView.GRAVITY_CENTER_VERTICAL;this.setTouchEnabled(!0);this.setDirection(ccui.ScrollView.DIR_VERTICAL)},setItemModel:function(a){a?
this._model=a:cc.log("Can't set a null to item model!")},_handleReleaseLogic:function(a){ccui.ScrollView.prototype._handleReleaseLogic.call(this,a);this._autoScrolling||this._startMagneticScroll()},_onItemListChanged:function(){this._outOfBoundaryAmountDirty=!0},_updateInnerContainerSize:function(){var a,b=this._items,c;switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:c=b.length;var d=(c-1)*this._itemsMargin;for(a=0;a<c;a++)d+=b[a].getContentSize().height;this.setInnerContainerSize(cc.size(this._contentSize.width,
d));break;case ccui.ScrollView.DIR_HORIZONTAL:c=b.length;d=(c-1)*this._itemsMargin;for(a=0;a<c;a++)d+=b[a].getContentSize().width;this.setInnerContainerSize(cc.size(d,this._contentSize.height))}},_remedyLayoutParameter:function(a){cc.assert(null!=a,"ListView Item can't be nil!");var b=a.getLayoutParameter(ccui.LayoutParameter.LINEAR),c=!0;b||(b=new ccui.LinearLayoutParameter,c=!1);var d=this.getIndex(a);switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:this._remedyVerticalLayoutParameter(b,
d);break;case ccui.ScrollView.DIR_HORIZONTAL:this._remedyHorizontalLayoutParameter(b,d)}c||a.setLayoutParameter(b)},_remedyVerticalLayoutParameter:function(a,b){cc.assert(null!=a,"Layout parameter can't be nil!");switch(this._gravity){case ccui.ListView.GRAVITY_LEFT:a.setGravity(ccui.LinearLayoutParameter.LEFT);break;case ccui.ListView.GRAVITY_RIGHT:a.setGravity(ccui.LinearLayoutParameter.RIGHT);break;case ccui.ListView.GRAVITY_CENTER_HORIZONTAL:a.setGravity(ccui.LinearLayoutParameter.CENTER_HORIZONTAL)}0===
b?a.setMargin(ccui.MarginZero()):a.setMargin(new ccui.Margin(0,this._itemsMargin,0,0))},_remedyHorizontalLayoutParameter:function(a,b){cc.assert(null!=a,"Layout parameter can't be nil!");switch(this._gravity){case ccui.ListView.GRAVITY_TOP:a.setGravity(ccui.LinearLayoutParameter.TOP);break;case ccui.ListView.GRAVITY_BOTTOM:a.setGravity(ccui.LinearLayoutParameter.BOTTOM);break;case ccui.ListView.GRAVITY_CENTER_VERTICAL:a.setGravity(ccui.LinearLayoutParameter.CENTER_VERTICAL)}0===b?a.setMargin(ccui.MarginZero()):
a.setMargin(new ccui.Margin(this._itemsMargin,0,0,0))},pushBackDefaultItem:function(){if(null!=this._model){var a=this._model.clone();this._remedyLayoutParameter(a);this.addChild(a);this._refreshViewDirty=!0}},insertDefaultItem:function(a){if(null!=this._model){var b=this._model.clone();this._items.splice(a,0,b);ccui.ScrollView.prototype.addChild.call(this,b);this._remedyLayoutParameter(b);this._refreshViewDirty=!0}},pushBackCustomItem:function(a){this._remedyLayoutParameter(a);this.addChild(a);this._refreshViewDirty=
!0},addChild:function(a,b,c){a&&(b=b||a.getLocalZOrder(),c=c||a.getName(),ccui.ScrollView.prototype.addChild.call(this,a,b,c),a instanceof ccui.Widget&&(this._items.push(a),this._onItemListChanged()))},removeChild:function(a,b){if(a){var c=this._items.indexOf(a);-1<c&&this._items.splice(c,1);this._onItemListChanged();ccui.ScrollView.prototype.removeChild.call(this,a,b)}},removeAllChildren:function(){this.removeAllChildrenWithCleanup(!0)},removeAllChildrenWithCleanup:function(a){ccui.ScrollView.prototype.removeAllChildrenWithCleanup.call(this,
a);this._items=[];this._onItemListChanged()},insertCustomItem:function(a,b){this._items.splice(b,0,a);this._onItemListChanged();ccui.ScrollView.prototype.addChild.call(this,a);this._remedyLayoutParameter(a);this._refreshViewDirty=!0},removeItem:function(a){a=this.getItem(a);null!=a&&(this.removeChild(a,!0),this._refreshViewDirty=!0)},removeLastItem:function(){this.removeItem(this._items.length-1)},removeAllItems:function(){this.removeAllChildren()},getItem:function(a){return 0>a||a>=this._items.length?
null:this._items[a]},getItems:function(){return this._items},getIndex:function(a){return null==a?-1:this._items.indexOf(a)},setGravity:function(a){this._gravity!==a&&(this._gravity=a,this._refreshViewDirty=!0)},setMagneticType:function(a){this._magneticType=a;this._onItemListChanged();this._startMagneticScroll()},getMagneticType:function(){return this._magneticType},setMagneticAllowedOutOfBoundary:function(a){this._magneticAllowedOutOfBoundary=a},getMagneticAllowedOutOfBoundary:function(){return this._magneticAllowedOutOfBoundary},
setItemsMargin:function(a){this._itemsMargin!==a&&(this._itemsMargin=a,this._refreshViewDirty=!0)},getItemsMargin:function(){return this._itemsMargin},setDirection:function(a){switch(a){case ccui.ScrollView.DIR_VERTICAL:this.setLayoutType(ccui.Layout.LINEAR_VERTICAL);break;case ccui.ScrollView.DIR_HORIZONTAL:this.setLayoutType(ccui.Layout.LINEAR_HORIZONTAL);break;case ccui.ScrollView.DIR_BOTH:return;default:return}ccui.ScrollView.prototype.setDirection.call(this,a)},_getHowMuchOutOfBoundary:function(a){void 0===
a&&(a=cc.p(0,0));if(this._magneticAllowedOutOfBoundary&&0!==this._items.length){if(this._magneticType===ccui.ListView.MAGNETIC_NONE||this._magneticType===ccui.ListView.MAGNETIC_BOTH_END)return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);if(0===a.x&&0===a.y&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount}else return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);var b=this._leftBoundary,c=this._rightBoundary,d=this._topBoundary,e=this._bottomBoundary,
f=this._items.length-1,h=this.getContentSize(),k=cc.p(0,0),m=cc.p(0,0);switch(this._magneticType){case ccui.ListView.MAGNETIC_CENTER:k.x=(h.width-this._items[0].width)/2;k.y=(h.height-this._items[0].height)/2;m.x=(h.width-this._items[f].width)/2;m.y=(h.height-this._items[f].height)/2;break;case ccui.ListView.MAGNETIC_LEFT:case ccui.ListView.MAGNETIC_TOP:m.x=h.width-this._items[f].width;m.y=h.height-this._items[f].height;break;case ccui.ListView.MAGNETIC_RIGHT:case ccui.ListView.MAGNETIC_BOTTOM:k.x=
h.width-this._items[0].width,k.y=h.height-this._items[0].height}b+=k.x;c-=m.x;d-=k.y;e+=m.y;f=cc.p(0,0);this._innerContainer.getLeftBoundary()+a.x>b?f.x=b-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.x<c&&(f.x=c-(this._innerContainer.getRightBoundary()+a.x));this._innerContainer.getTopBoundary()+a.y<d?f.y=d-(this._innerContainer.getTopBoundary()+a.y):this._innerContainer.getBottomBoundary()+a.y>e&&(f.y=e-(this._innerContainer.getBottomBoundary()+a.y));0===
a.x&&0===a.y&&(this._outOfBoundaryAmount=f,this._outOfBoundaryAmountDirty=!1);return f},_calculateItemPositionWithAnchor:function(a,b){var c=cc.p(a.getLeftBoundary(),a.getBottomBoundary()),d=a.getContentSize();return cc.p(c.x+d.width*b.x,c.y+d.height*b.y)},_findClosestItem:function(a,b,c,d,e,f,h){cc.assert(0<=d&&f<b.length&&d<=f,"");if(d===f)return b[d];if(1===f-d)return e<=h?b[d]:b[f];var k=Math.floor((d+f)/2),m=this._calculateItemPositionWithAnchor(b[k],c),m=cc.pLength(cc.pSub(a,m));return e<=h?
this._findClosestItem(a,b,c,d,e,k,m):this._findClosestItem(a,b,c,k,m,f,h)},getClosestItemToPosition:function(a,b){if(0===this._items.length)return null;var c=this._calculateItemPositionWithAnchor(this._items[0],b),c=cc.pLength(cc.pSub(a,c)),d=this._items.length-1,e=this._calculateItemPositionWithAnchor(this._items[d],b),e=cc.pLength(cc.pSub(a,e));return this._findClosestItem(a,this._items,b,0,c,d,e)},getClosestItemToPositionInCurrentView:function(a,b){var c=this.getContentSize(),d=cc.pMult(this._innerContainer.getPosition(),
-1);d.x+=c.width*a.x;d.y+=c.height*a.y;return this.getClosestItemToPosition(d,b)},getCenterItemInCurrentView:function(){return this.getClosestItemToPositionInCurrentView(cc.p(0.5,0.5),cc.p(0.5,0.5))},getLeftmostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_HORIZONTAL?this.getClosestItemToPositionInCurrentView(cc.p(0,0.5),cc.p(0.5,0.5)):null},getRightmostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_HORIZONTAL?this.getClosestItemToPositionInCurrentView(cc.p(1,
0.5),cc.p(0.5,0.5)):null},getTopmostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?this.getClosestItemToPositionInCurrentView(cc.p(0.5,1),cc.p(0.5,0.5)):null},getBottommostItemInCurrentView:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?this.getClosestItemToPositionInCurrentView(cc.p(0.5,0),cc.p(0.5,0.5)):null},_calculateItemDestination:function(a,b,c){var d=this.getContentSize(),e=cc.p(0,0);e.x+=d.width*a.x;e.y+=d.height*a.y;a=this._calculateItemPositionWithAnchor(b,
c);return cc.pMult(cc.pSub(a,e),-1)},jumpToBottom:function(){this.doLayout();ccui.ScrollView.prototype.jumpToBottom.call(this)},jumpToTop:function(){this.doLayout();ccui.ScrollView.prototype.jumpToTop.call(this)},jumpToLeft:function(){this.doLayout();ccui.ScrollView.prototype.jumpToLeft.call(this)},jumpToRight:function(){this.doLayout();ccui.ScrollView.prototype.jumpToRight.call(this)},jumpToTopLeft:function(){this.doLayout();ccui.ScrollView.prototype.jumpToTopLeft.call(this)},jumpToTopRight:function(){this.doLayout();
ccui.ScrollView.prototype.jumpToTopRight.call(this)},jumpToBottomLeft:function(){this.doLayout();ccui.ScrollView.prototype.jumpToBottomLeft.call(this)},jumpToBottomRight:function(){this.doLayout();ccui.ScrollView.prototype.jumpToBottomRight.call(this)},jumpToPercentVertical:function(a){this.doLayout();ccui.ScrollView.prototype.jumpToPercentVertical.call(this,a)},jumpToPercentHorizontal:function(a){this.doLayout();ccui.ScrollView.prototype.jumpToPercentHorizontal.call(this,a)},jumpToPercentBothDirection:function(a){this.doLayout();
ccui.ScrollView.prototype.jumpToPercentBothDirection.call(this,a)},jumpToItem:function(a,b,c){if(a=this.getItem(a))this.doLayout(),b=this._calculateItemDestination(b,a,c),this.bounceEnabled||(c=cc.pSub(b,this._innerContainer.getPosition()),c=this._getHowMuchOutOfBoundary(c),b.x+=c.x,b.y+=c.y),this._jumpToDestination(b)},scrollToItem:function(a,b,c,d){void 0===d&&(d=1);if(a=this.getItem(a))b=this._calculateItemDestination(b,a,c),this._startAutoScrollToDestination(b,d,!0)},requestRefreshView:function(){this._refreshViewDirty=
!0},refreshView:function(){this.forceDoLayout()},doLayout:function(){this._doLayout()},requestDoLayout:function(){this._refreshViewDirty=!0},_doLayout:function(){if(this._refreshViewDirty){for(var a=this._items,b=0;b<a.length;b++){var c=a[b];c.setLocalZOrder(b);this._remedyLayoutParameter(c)}this._updateInnerContainerSize();this._innerContainer.forceDoLayout();this._refreshViewDirty=!1}},addEventListenerListView:function(a,b){this._listViewEventListener=b;this._listViewEventSelector=a},addEventListener:function(a){this._ccListViewEventCallback=
a},_selectedItemEvent:function(a){a=a===ccui.Widget.TOUCH_BEGAN?ccui.ListView.ON_SELECTED_ITEM_START:ccui.ListView.ON_SELECTED_ITEM_END;this._listViewEventSelector&&(this._listViewEventListener?this._listViewEventSelector.call(this._listViewEventListener,this,a):this._listViewEventSelector(this,a));this._ccListViewEventCallback&&this._ccListViewEventCallback(this,a)},interceptTouchEvent:function(a,b,c){ccui.ScrollView.prototype.interceptTouchEvent.call(this,a,b,c);if(this._touchEnabled&&a!==ccui.Widget.TOUCH_MOVED){for(c=
b;c;){if(c&&c.getParent()===this._innerContainer){this._curSelectedIndex=this.getIndex(c);break}c=c.getParent()}b.isHighlighted()&&this._selectedItemEvent(a)}},getCurSelectedIndex:function(){return this._curSelectedIndex},_onSizeChanged:function(){ccui.ScrollView.prototype._onSizeChanged.call(this);this._refreshViewDirty=!0},getDescription:function(){return"ListView"},_createCloneInstance:function(){return new ccui.ListView},_copyClonedWidgetChildren:function(a){a=a.getItems();for(var b=0;b<a.length;b++)this.pushBackCustomItem(a[b].clone())},
_copySpecialProperties:function(a){a instanceof ccui.ListView&&(ccui.ScrollView.prototype._copySpecialProperties.call(this,a),this.setItemModel(a._model),this.setItemsMargin(a._itemsMargin),this.setGravity(a._gravity),this._listViewEventListener=a._listViewEventListener,this._listViewEventSelector=a._listViewEventSelector)},_startAttenuatingAutoScroll:function(a,b){var c=a;if(0!==this._items.length&&this._magneticType!==ccui.ListView.MAGNETIC_NONE){var c=this._flattenVectorByDirection(c),d=this._getHowMuchOutOfBoundary(c);
if(0===d.x&&0===d.y){d=this._magneticType;d===ccui.ListView.MAGNETIC_BOTH_END&&(this._direction===ccui.ScrollView.DIR_HORIZONTAL?d=0<c.x?ccui.ListView.MAGNETIC_LEFT:ccui.ListView.MAGNETIC_RIGHT:this._direction===ccui.ScrollView.DIR_VERTICAL&&(d=0<c.y?ccui.ListView.MAGNETIC_BOTTOM:ccui.ListView.MAGNETIC_TOP));var e=this._getAnchorPointByMagneticType(d),d=cc.pMult(this._innerContainer.getPosition(),-1);d.x+=this.width*e.x;d.y+=this.height*e.y;c=this.getClosestItemToPosition(cc.pSub(d,c),e);c=this._calculateItemPositionWithAnchor(c,
e);c=cc.pSub(d,c)}}ccui.ScrollView.prototype._startAttenuatingAutoScroll.call(this,c,b)},_getAnchorPointByMagneticType:function(a){switch(a){case ccui.ListView.MAGNETIC_BOTH_END:return cc.p(0,1);case ccui.ListView.MAGNETIC_CENTER:return cc.p(0.5,0.5);case ccui.ListView.MAGNETIC_LEFT:return cc.p(0,0.5);case ccui.ListView.MAGNETIC_RIGHT:return cc.p(1,0.5);case ccui.ListView.MAGNETIC_TOP:return cc.p(0.5,1);case ccui.ListView.MAGNETIC_BOTTOM:return cc.p(0.5,0)}return cc.p(0,0)},_startMagneticScroll:function(){if(0!==
this._items.length&&this._magneticType!==ccui.ListView.MAGNETIC_NONE){var a=this._getAnchorPointByMagneticType(this._magneticType),b=cc.pMult(this._innerContainer.getPosition(),-1);b.x+=this.width*a.x;b.y+=this.height*a.y;b=this.getClosestItemToPosition(b,a);this.scrollToItem(this.getIndex(b),a,a)}}});ccui.ListView.create=function(){return new ccui.ListView};ccui.ListView.EVENT_SELECTED_ITEM=0;ccui.ListView.ON_SELECTED_ITEM_START=0;ccui.ListView.ON_SELECTED_ITEM_END=1;ccui.ListView.GRAVITY_LEFT=0;
ccui.ListView.GRAVITY_RIGHT=1;ccui.ListView.GRAVITY_CENTER_HORIZONTAL=2;ccui.ListView.GRAVITY_TOP=3;ccui.ListView.GRAVITY_BOTTOM=4;ccui.ListView.GRAVITY_CENTER_VERTICAL=5;ccui.ListView.MAGNETIC_NONE=0;ccui.ListView.MAGNETIC_CENTER=1;ccui.ListView.MAGNETIC_BOTH_END=2;ccui.ListView.MAGNETIC_LEFT=3;ccui.ListView.MAGNETIC_RIGHT=4;ccui.ListView.MAGNETIC_TOP=5;ccui.ListView.MAGNETIC_BOTTOM=6;ccui.PageView=ccui.ListView.extend({_curPageIdx:0,_childFocusCancelOffset:0,_pageViewEventListener:null,_pageViewEventSelector:null,_className:"PageView",_indicator:null,_indicatorPositionAsAnchorPoint:null,ctor:function(){ccui.ListView.prototype.ctor.call(this);this._childFocusCancelOffset=5;this._indicatorPositionAsAnchorPoint=cc.p(0.5,0.1);this._pageViewEventSelector=this._pageViewEventListener=null;this.setDirection(ccui.ScrollView.DIR_HORIZONTAL);this.setMagneticType(ccui.ListView.MAGNETIC_CENTER);
this.setScrollBarEnabled(!1)},addWidgetToPage:function(a,b,c){this.insertCustomItem(a,b)},addPage:function(a){this.pushBackCustomItem(a)},insertPage:function(a,b){this.insertCustomItem(a,b)},removePage:function(a){this.removeItem(this.getIndex(a))},removePageAtIndex:function(a){this.removeItem(a)},removeAllPages:function(){this.removeAllItems()},scrollToItem:function(a){ccui.ListView.prototype.scrollToItem.call(this,a,cc.p(0.5,0.5),cc.p(0.5,0.5))},scrollToPage:function(a){this.scrollToItem(a)},_doLayout:function(){if(this._refreshViewDirty){ccui.ListView.prototype._doLayout.call(this);
if(this._indicator){var a=this.getIndex(this.getCenterItemInCurrentView());this._indicator.indicate(a)}this._refreshViewDirty=!1}},setDirection:function(a){ccui.ListView.prototype.setDirection.call(this,a);a===ccui.ScrollView.DIR_HORIZONTAL?this._indicatorPositionAsAnchorPoint=cc.p(0.5,0.1):a===ccui.ScrollView.DIR_VERTICAL&&(this._indicatorPositionAsAnchorPoint=cc.p(0.1,0.5));this._indicator&&(this._indicator.setDirection(a),this._refreshIndicatorPosition())},setCustomScrollThreshold:function(a){},
getCustomScrollThreshold:function(){return 0},setUsingCustomScrollThreshold:function(a){},isUsingCustomScrollThreshold:function(){return!1},_moveInnerContainer:function(a,b){ccui.ListView.prototype._moveInnerContainer.call(this,a,b);this._curPageIdx=this.getIndex(this.getCenterItemInCurrentView());this._indicator&&this._indicator.indicate(this._curPageIdx)},_onItemListChanged:function(){ccui.ListView.prototype._onItemListChanged.call(this);this._indicator&&this._indicator.reset(this._items.length)},
_onSizeChanged:function(){ccui.ListView.prototype._onSizeChanged.call(this);this._refreshIndicatorPosition()},_remedyLayoutParameter:function(a){a.setContentSize(this.getContentSize());ccui.ListView.prototype._remedyLayoutParameter.call(this,a)},_refreshIndicatorPosition:function(){if(this._indicator){var a=this.getContentSize();this._indicator.setPosition(cc.p(a.width*this._indicatorPositionAsAnchorPoint.x,a.height*this._indicatorPositionAsAnchorPoint.y))}},_handleReleaseLogic:function(a){ccui.ScrollView.prototype._handleReleaseLogic.call(this,
a);if(!(0>=this._items.length))if(a=this._flattenVectorByDirection(this._calculateTouchMoveVelocity()),500>cc.pLength(a))this._startMagneticScroll();else{var b=this.getItem(this._curPageIdx),b=this._calculateItemDestination(cc.p(0.5,0.5),b,cc.p(0.5,0.5)),b=cc.pSub(b,this.getInnerContainerPosition()),b=this._flattenVectorByDirection(b);0<a.x*b.x||0<a.y*b.y?this._startMagneticScroll():(0>a.x||0<a.y?++this._curPageIdx:--this._curPageIdx,this._curPageIdx=Math.min(this._curPageIdx,this._items.length),
this._curPageIdx=Math.max(this._curPageIdx,0),this.scrollToItem(this._curPageIdx))}},_getAutoScrollStopEpsilon:function(){return 0.001},_pageTurningEvent:function(){this._pageViewEventSelector&&(this._pageViewEventListener?this._pageViewEventSelector.call(this._pageViewEventListener,this,ccui.PageView.EVENT_TURNING):this._pageViewEventSelector(this,ccui.PageView.EVENT_TURNING));this._ccEventCallback&&this._ccEventCallback(this,ccui.PageView.EVENT_TURNING)},addEventListenerPageView:function(a,b){this._pageViewEventSelector=
a;this._pageViewEventListener=b},addEventListener:function(a){this._ccEventCallback=function(b,c){c==ccui.ScrollView.EVENT_AUTOSCROLL_ENDED&&a(this,c)}},setCurrentPageIndex:function(a){this.jumpToItem(a,cc.p(0.5,0.5),cc.p(0.5,0.5))},setCurPageIndex:function(a){this.setCurrentPageIndex(a)},getCurrentPageIndex:function(){return this._curPageIdx},getCurPageIndex:function(){var a=this.getCenterItemInCurrentView();return this.getIndex(a)},getPages:function(){return this.getItems()},getPage:function(a){return this.getItem(a)},
getDescription:function(){return"PageView"},_createCloneInstance:function(){return new ccui.PageView},_copyClonedWidgetChildren:function(a){a=a.getPages();for(var b=0;b<a.length;b++)this.addPage(a[b].clone())},_copySpecialProperties:function(a){ccui.ListView.prototype._copySpecialProperties.call(this,a);this._ccEventCallback=a._ccEventCallback;this._pageViewEventListener=a._pageViewEventListener;this._pageViewEventSelector=a._pageViewEventSelector;this._customScrollThreshold=a._customScrollThreshold},
setIndicatorEnabled:function(a){a!=(null!==this._indicator)&&(a?(this._indicator=new ccui.PageViewIndicator,this._indicator.setDirection(this.getDirection()),this.addProtectedChild(this._indicator,1E4),this.setIndicatorSelectedIndexColor(cc.color(100,100,255)),this._refreshIndicatorPosition()):(this.removeProtectedChild(this._indicator),this._indicator=null))},getIndicatorEnabled:function(){return null!==this._indicator},setIndicatorPositionAsAnchorPoint:function(a){this._indicatorPositionAsAnchorPoint=
a;this._refreshIndicatorPosition()},getIndicatorPositionAsAnchorPoint:function(){return this._indicatorPositionAsAnchorPoint},setIndicatorPosition:function(a){if(this._indicator){var b=this.getContentSize();this._indicatorPositionAsAnchorPoint.x=a.x/b.width;this._indicatorPositionAsAnchorPoint.y=a.y/b.height;this._indicator.setPosition(a)}},getIndicatorPosition:function(){cc.assert(null!==this._indicator,"");return this._indicator.getPosition()},setIndicatorSpaceBetweenIndexNodes:function(a){this._indicator&&
this._indicator.setSpaceBetweenIndexNodes(a)},getIndicatorSpaceBetweenIndexNodes:function(){cc.assert(null!==this._indicator,"");return this._indicator.getSpaceBetweenIndexNodes()},setIndicatorSelectedIndexColor:function(a){this._indicator&&this._indicator.setSelectedIndexColor(a)},getIndicatorSelectedIndexColor:function(){cc.assert(null!==this._indicator,"");return this._indicator.getSelectedIndexColor()},setIndicatorIndexNodesColor:function(a){this._indicator&&this._indicator.setIndexNodesColor(a)},
getIndicatorIndexNodesColor:function(){cc.assert(null!==this._indicator,"");return this._indicator.getIndexNodesColor()},setIndicatorIndexNodesScale:function(a){this._indicator&&(this._indicator.setIndexNodesScale(a),this._indicator.indicate(this._curPageIdx))},getIndicatorIndexNodesScale:function(){cc.assert(null!==this._indicator,"");return this._indicator.getIndexNodesScale()},setIndicatorIndexNodesTexture:function(a,b){this._indicator&&(this._indicator.setIndexNodesTexture(a,b),this._indicator.indicate(this._curPageIdx))}});
ccui.PageView.create=function(){return new ccui.PageView};ccui.PageView.EVENT_TURNING=0;ccui.PageView.TOUCH_DIR_LEFT=0;ccui.PageView.TOUCH_DIR_RIGHT=1;ccui.PageView.DIRECTION_LEFT=0;ccui.PageView.DIRECTION_RIGHT=1;ccui.PageViewIndicator=ccui.ProtectedNode.extend({_direction:null,_indexNodes:null,_currentIndexNode:null,_spaceBetweenIndexNodes:0,_indexNodesScale:1,_indexNodesColor:null,_useDefaultTexture:!0,_indexNodesTextureFile:"",_indexNodesTexType:ccui.Widget.LOCAL_TEXTURE,_className:"PageViewIndicator",ctor:function(){cc.ProtectedNode.prototype.ctor.call(this);this._direction=ccui.ScrollView.DIR_HORIZONTAL;this._indexNodes=[];this._spaceBetweenIndexNodes=ccui.PageViewIndicator.SPACE_BETWEEN_INDEX_NODES_DEFAULT;
this._indexNodesColor=cc.color.WHITE;this._currentIndexNode=ccui.helper._createSpriteFromBase64(ccui.PageViewIndicator.CIRCLE_IMAGE,ccui.PageViewIndicator.CIRCLE_IMAGE_KEY);this._currentIndexNode.setVisible(!1);this.addProtectedChild(this._currentIndexNode,1)},setDirection:function(a){this._direction=a;this._rearrange()},reset:function(a){for(;this._indexNodes.length<a;)this._increaseNumberOfPages();for(;this._indexNodes.length>a;)this._decreaseNumberOfPages();this._rearrange();this._currentIndexNode.setVisible(0<
this._indexNodes.length)},indicate:function(a){0>a||a>=this._indexNodes.length||this._currentIndexNode.setPosition(this._indexNodes[a].getPosition())},_rearrange:function(){if(0!==this._indexNodes.length)for(var a=this._direction===ccui.ScrollView.DIR_HORIZONTAL,b=this._indexNodes[0].getContentSize(),c=a?b.width:b.height,d=this._indexNodes.length,d=-((c*d+this._spaceBetweenIndexNodes*(d-1))/2)+c/2,e=0;e<this._indexNodes.length;++e){var f;f=a?cc.p(d,b.height/2):cc.p(b.width/2,-d);this._indexNodes[e].setPosition(f);
d+=c+this._spaceBetweenIndexNodes}},setSpaceBetweenIndexNodes:function(a){this._spaceBetweenIndexNodes!==a&&(this._spaceBetweenIndexNodes=a,this._rearrange())},getSpaceBetweenIndexNodes:function(){return this._spaceBetweenIndexNodes},setSelectedIndexColor:function(a){this._currentIndexNode.setColor(a)},getSelectedIndexColor:function(){return this._currentIndexNode.getColor()},setIndexNodesColor:function(a){this._indexNodesColor=a;for(var b=0;b<this._indexNodes.length;++b)this._indexNodes[b].setColor(a)},
getIndexNodesColor:function(){var a=this._indexNodesColor;return cc.color(a.r,a.g,a.b,a.a)},setIndexNodesScale:function(a){if(this._indexNodesScale!==a){this._indexNodesScale=a;this._currentIndexNode.setScale(a);for(a=0;a<this._indexNodes.length;++a)this._indexNodes[a].setScale(this,_indexNodesScale);this._rearrange()}},getIndexNodesScale:function(){return this._indexNodesScale},setIndexNodesTexture:function(a,b){void 0===b&&(b=ccui.Widget.LOCAL_TEXTURE);this._useDefaultTexture=!1;this._indexNodesTextureFile=
a;this._indexNodesTexType=b;switch(b){case ccui.Widget.LOCAL_TEXTURE:this._currentIndexNode.setTexture(a);for(var c=0;c<this._indexNodes.length;++c)this._indexNodes[c].setTexture(a);break;case ccui.Widget.PLIST_TEXTURE:for(this._currentIndexNode.setSpriteFrame(a),c=0;c<this._indexNodes.length;++c)this._indexNodes[c].setSpriteFrame(a)}this._rearrange()},_increaseNumberOfPages:function(){var a;if(this._useDefaultTexture)a=ccui.helper._createSpriteFromBase64(ccui.PageViewIndicator.CIRCLE_IMAGE,ccui.PageViewIndicator.CIRCLE_IMAGE_KEY);
else switch(a=new cc.Sprite,this._indexNodesTexType){case ccui.Widget.LOCAL_TEXTURE:a.initWithFile(this._indexNodesTextureFile);break;case ccui.Widget.PLIST_TEXTURE:a.initWithSpriteFrameName(this._indexNodesTextureFile)}a.setColor(this._indexNodesColor);a.setScale(this._indexNodesScale);this.addProtectedChild(a);this._indexNodes.push(a)},_decreaseNumberOfPages:function(){0!==this._indexNodes.length&&(this.removeProtectedChild(this._indexNodes[0]),this._indexNodes.splice(0,1))},clear:function(){for(var a=
0;a<this._indexNodes.length;++a)this.removeProtectedChild(this._indexNodes[a]);this._indexNodes.length=0;this._currentIndexNode.setVisible(!1)}});_p=ccui.PageViewIndicator.prototype;cc.defineGetterSetter(_p,"spaceBetweenIndexNodes",_p.getSpaceBetweenIndexNodes,_p.setSpaceBetweenIndexNodes);ccui.PageViewIndicator.SPACE_BETWEEN_INDEX_NODES_DEFAULT=23;ccui.PageViewIndicator.CIRCLE_IMAGE_KEY="/__circle_image";ccui.PageViewIndicator.CIRCLE_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAA8ElEQVRIx62VyRGCQBBF+6gWRCEmYDIQkhiBCgHhSclC8YqWzOV5oVzKAYZp3r1/9fpbxAIBMTsKrjx5cqVgR0wgLhCRUWOjJiPqD56xoaGPhpRZV/iSEy6crHmw5oIrF9b/lVeMofrJgjlnxlIy/wik+JB+mme8BExbBhm+5CJC2LE2LtSEQoyGWDioBA5CoRIohJtK4CYDxzNEM4GAugR1E9VjVC+SZpXvhCJCrjomESLvc17pDGX7bWmlh6UtpjPVCWy9zaJ0TD7qfm3pwERMz2trRVZk3K3BD/L34AY+dEDCniMVBkPFkT2J/b2/AIV+dRpFLOYoAAAAAElFTkSuQmCC";(function(){if(ccui.ProtectedNode.CanvasRenderCmd){ccui.ScrollView.CanvasRenderCmd=function(a){this._layoutCmdCtor(a);this._dirty=!1};var a=ccui.ScrollView.CanvasRenderCmd.prototype=Object.create(ccui.Layout.CanvasRenderCmd.prototype);a.constructor=ccui.ScrollView.CanvasRenderCmd;a.rendering=function(a){var c=cc.renderer._cacheToCanvasCmds[this._node.__instanceId],d,e=cc.view.getScaleX(),f=cc.view.getScaleY(),h=a||cc._renderContext;h.computeRealOffsetY();this._node.updateChildren();a=0;for(d=c.length;a<
d;a++){var k=c[a]._node;k instanceof ccui.ScrollView||k&&k._parent&&!1===k._parent._inViewRect||c[a].rendering(h,e,f)}}}})();(function(){if(ccui.ProtectedNode.WebGLRenderCmd){ccui.ScrollView.WebGLRenderCmd=function(a){this._layoutCmdCtor(a);this._needDraw=!0;this._dirty=!1};var a=ccui.ScrollView.WebGLRenderCmd.prototype=Object.create(ccui.Layout.WebGLRenderCmd.prototype);a.constructor=ccui.ScrollView.WebGLRenderCmd;a.rendering=function(a){var c=cc.renderer._cacheToBufferCmds[this._node.__instanceId],d,e,f,h=a||cc._renderContext;if(c)for(this._node.updateChildren(),h.bindBuffer(gl.ARRAY_BUFFER,null),a=0,d=c.length;a<d;a++)f=
c[a],e=f._node,e&&e._parent&&!1===e._parent._inViewRect||(f.uploadData?cc.renderer._uploadBufferData(f):(0<f._batchingSize&&cc.renderer._batchRendering(),f.rendering(h)),cc.renderer._batchRendering())}}})();cc.Component=cc.Class.extend({_owner:null,_name:"",_enabled:!0,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 Error("cc.ComponentContainer.getComponent(): name should be non-null");a=a.trim();this._components||(this._components={});return this._components[a]},add:function(a){if(!a)throw Error("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 Error("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,b;for(b in a){var c=a[b];c.onExit();c.setOwner(null);delete a[b]}this._owner.unscheduleUpdate();this._components=null}},_alloc:function(){this._components={}},visit:function(a){if(this._components){var b=this._components,c;for(c in b)b[c].update(a)}},isEmpty:function(){return this._components?0===this._components.length:
!0}});ccui.LayoutComponent_ReferencePoint={BOTTOM_LEFT:0,TOP_LEFT:1,BOTTOM_RIGHT:2,TOP_RIGHT:3};ccui.LayoutComponent_PositionType={Position:0,RelativePosition:1,PreRelativePosition:2,PreRelativePositionEnable:3};ccui.LayoutComponent_SizeType={Size:0,PreSize:1,PreSizeEnable:2};
ccui.LayoutComponent=cc.Component.extend({_horizontalEdge:0,_verticalEdge:0,_leftMargin:0,_rightMargin:0,_bottomMargin:0,_topMargin:0,_usingPositionPercentX:!1,_positionPercentX:0,_usingPositionPercentY:!1,_positionPercentY:0,_usingStretchWidth:!1,_usingStretchHeight:!1,_percentWidth:0,_usingPercentWidth:!1,_percentHeight:0,_usingPercentHeight:!1,_actived:!0,_isPercentOnly:!1,ctor:function(){this._name=ccui.LayoutComponent.NAME},init:function(){return cc.Component.prototype.init.call(this)?!0:!1},
getPercentContentSize:function(){return cc.p(this._percentWidth,this._percentHeight)},setPercentContentSize:function(a){this.setPercentWidth(a.x);this.setPercentHeight(a.y)},setUsingPercentContentSize:function(a){this._usingPercentWidth=this._usingPercentHeight=a},SetActiveEnable:function(a){this._actived=a},getUsingPercentContentSize:function(){return this._usingPercentWidth&&this._usingPercentHeight},getAnchorPosition:function(){return this._owner.getAnchorPoint()},setAnchorPosition:function(a,
b){var c=this._owner.getBoundingBox();this._owner.setAnchorPoint(a,b);var d=this._owner.getBoundingBox(),e=c.x-d.x,c=c.y-d.y,d=this._owner.getPosition();d.x+=e;d.y+=c;this.setPosition(d)},getPosition:function(){return this._owner.getPosition()},setPosition:function(a,b){var c=this._getOwnerParent(),d;null!=c?(void 0===b?(d=a.x,b=a.y):d=a,c=c.getContentSize(),0!==c.width?this._positionPercentX=d/c.width:(this._positionPercentX=0,this._usingPositionPercentX&&(d=0)),0!==c.height?this._positionPercentY=
b/c.height:(this._positionPercentY=0,this._usingPositionPercentY&&(b=0)),this._owner.setPosition(d,b),this._refreshHorizontalMargin(),this._refreshVerticalMargin()):this._owner.setPosition(a,b)},isPositionPercentXEnabled:function(){return this._usingPositionPercentX},setPositionPercentXEnabled:function(a){if(this._usingPositionPercentX=a)this._horizontalEdge=ccui.LayoutComponent.horizontalEdge.NONE},getPositionPercentX:function(){return this._positionPercentX},setPositionPercentX:function(a){this._positionPercentX=
a;a=this._getOwnerParent();null!==a&&(this._owner.setPositionX(a.width*this._positionPercentX),this._refreshHorizontalMargin())},isPositionPercentYEnabled:function(){return this._usingPositionPercentY},setPositionPercentYEnabled:function(a){if(this._usingPositionPercentY=a)this._verticalEdge=ccui.LayoutComponent.verticalEdge.NONE},getPositionPercentY:function(){return this._positionPercentY},setPositionPercentY:function(a){this._positionPercentY=a;a=this._getOwnerParent();null!==a&&(this._owner.setPositionY(a.height*
this._positionPercentY),this._refreshVerticalMargin())},getHorizontalEdge:function(){return this._horizontalEdge},setHorizontalEdge:function(a){this._horizontalEdge=a;this._horizontalEdge!==ccui.LayoutComponent.horizontalEdge.NONE&&(this._usingPositionPercentX=!1);var b=this._getOwnerParent();null!==b&&(a=this._owner.getPosition(),b=b.getContentSize(),0!==b.width?this._positionPercentX=a.x/b.width:(this._positionPercentX=0,a.x=0,this._usingPositionPercentX&&this._owner.setPosition(a)),this._refreshHorizontalMargin())},
getVerticalEdge:function(){return this._verticalEdge},setVerticalEdge:function(a){this._verticalEdge=a;this._verticalEdge!==ccui.LayoutComponent.verticalEdge.NONE&&(this._usingPositionPercentY=!1);var b=this._getOwnerParent();null!==b&&(a=this._owner.getPosition(),b=b.getContentSize(),0!==b.height?this._positionPercentY=a.y/b.height:(this._positionPercentY=0,a.y=0,this._usingPositionPercentY&&this._owner.setPosition(a)),this._refreshVerticalMargin())},getLeftMargin:function(){return this._leftMargin},
setLeftMargin:function(a){this._leftMargin=a},getRightMargin:function(){return this._rightMargin},setRightMargin:function(a){this._rightMargin=a},getTopMargin:function(){return this._topMargin},setTopMargin:function(a){this._topMargin=a},getBottomMargin:function(){return this._bottomMargin},setBottomMargin:function(a){this._bottomMargin=a},getSize:function(){return this.getOwner().getContentSize()},setSize:function(a){var b=this._getOwnerParent();null!==b?(b=b.getContentSize(),0!==b.width?this._percentWidth=
a.width/b.width:(this._percentWidth=0,this._usingPercentWidth&&(a.width=0)),0!==b.height?this._percentHeight=a.height/b.height:(this._percentHeight=0,this._usingPercentHeight&&(a.height=0)),this._owner.setContentSize(a),this._refreshHorizontalMargin(),this._refreshVerticalMargin()):this._owner.setContentSize(a)},isPercentWidthEnabled:function(){return this._usingPercentWidth},setPercentWidthEnabled:function(a){if(this._usingPercentWidth=a)this._usingStretchWidth=!1},getSizeWidth:function(){return this._owner.width},
setSizeWidth:function(a){var b=this._owner.getContentSize();b.width=a;a=this._getOwnerParent();null!==a?(a=a.getContentSize(),0!==a.width?this._percentWidth=b.width/a.width:(this._percentWidth=0,this._usingPercentWidth&&(b.width=0)),this._owner.setContentSize(b),this._refreshHorizontalMargin()):this._owner.setContentSize(b)},getPercentWidth:function(){return this._percentWidth},setPercentWidth:function(a){this._percentWidth=a;a=this._getOwnerParent();if(null!==a){var b=this._owner.getContentSize();
b.width=a.width*this._percentWidth;this._owner.setContentSize(b);this._refreshHorizontalMargin()}},isPercentHeightEnabled:function(){return this._usingPercentHeight},setPercentHeightEnabled:function(a){if(this._usingPercentHeight=a)this._usingStretchHeight=!1},getSizeHeight:function(){return this._owner.height},setSizeHeight:function(a){var b=this._owner.getContentSize();b.height=a;a=this._getOwnerParent();null!==a?(a=a.getContentSize(),0!==a.height?this._percentHeight=b.height/a.height:(this._percentHeight=
0,this._usingPercentHeight&&(b.height=0)),this._owner.setContentSize(b),this._refreshVerticalMargin()):this._owner.setContentSize(b)},getPercentHeight:function(){return this._percentHeight},setPercentHeight:function(a){this._percentHeight=a;a=this._getOwnerParent();if(null!==a){var b=this._owner.getContentSize();b.height=a.height*this._percentHeight;this._owner.setContentSize(b);this._refreshVerticalMargin()}},isStretchWidthEnabled:function(){return this._usingStretchWidth},setStretchWidthEnabled:function(a){if(this._usingStretchWidth=
a)this._usingPercentWidth=!1},isStretchHeightEnabled:function(){return this._usingStretchHeight},setStretchHeightEnabled:function(a){if(this._usingStretchHeight=a)this._usingPercentHeight=!1},setPercentOnlyEnabled:function(a){this._isPercentOnly=a},setActiveEnabled:function(a){this._actived=a},refreshLayout:function(){if(this._actived){var a=this._getOwnerParent();if(null!==a){var a=a.getContentSize(),b=this._owner,c=b.getAnchorPoint(),d=b.getContentSize(),e=b.getPosition();switch(this._horizontalEdge){case ccui.LayoutComponent.horizontalEdge.NONE:this._usingStretchWidth&&
!this._isPercentOnly?(d.width=a.width*this._percentWidth,e.x=this._leftMargin+c.x*d.width):(this._usingPositionPercentX&&(e.x=a.width*this._positionPercentX),this._usingPercentWidth&&(d.width=a.width*this._percentWidth));break;case ccui.LayoutComponent.horizontalEdge.LEFT:if(this._isPercentOnly)break;if(this._usingPercentWidth||this._usingStretchWidth)d.width=a.width*this._percentWidth;e.x=this._leftMargin+c.x*d.width;break;case ccui.LayoutComponent.horizontalEdge.RIGHT:if(this._isPercentOnly)break;
if(this._usingPercentWidth||this._usingStretchWidth)d.width=a.width*this._percentWidth;e.x=a.width-(this._rightMargin+(1-c.x)*d.width);break;case ccui.LayoutComponent.horizontalEdge.CENTER:if(this._isPercentOnly)break;this._usingStretchWidth?(d.width=a.width-this._leftMargin-this._rightMargin,0>d.width&&(d.width=0),e.x=this._leftMargin+c.x*d.width):(this._usingPercentWidth&&(d.width=a.width*this._percentWidth),e.x=a.width*this._positionPercentX)}switch(this._verticalEdge){case ccui.LayoutComponent.verticalEdge.NONE:this._usingStretchHeight&&
!this._isPercentOnly?(d.height=a.height*this._percentHeight,e.y=this._bottomMargin+c.y*d.height):(this._usingPositionPercentY&&(e.y=a.height*this._positionPercentY),this._usingPercentHeight&&(d.height=a.height*this._percentHeight));break;case ccui.LayoutComponent.verticalEdge.BOTTOM:if(this._isPercentOnly)break;if(this._usingPercentHeight||this._usingStretchHeight)d.height=a.height*this._percentHeight;e.y=this._bottomMargin+c.y*d.height;break;case ccui.LayoutComponent.verticalEdge.TOP:if(this._isPercentOnly)break;
if(this._usingPercentHeight||this._usingStretchHeight)d.height=a.height*this._percentHeight;e.y=a.height-(this._topMargin+(1-c.y)*d.height);break;case ccui.LayoutComponent.verticalEdge.CENTER:if(this._isPercentOnly)break;this._usingStretchHeight?(d.height=a.height-this._topMargin-this._bottomMargin,0>d.height&&(d.height=0),e.y=this._bottomMargin+c.y*d.height):(this._usingPercentHeight&&(d.height=a.height*this._percentHeight),e.y=a.height*this._positionPercentY)}b.setPosition(e);b.setContentSize(d);
if(b instanceof ccui.PageView)for(b.forceDoLayout(),a=b.getPages(),b=0;b<a.length;b++)ccui.helper.doLayout(a[b]);else ccui.helper.doLayout(b)}}},_getOwnerParent:function(){return this._owner?this._owner.getParent():null},_refreshHorizontalMargin:function(){var a=this._getOwnerParent();if(null!==a){var b=this._owner.getPosition(),c=this._owner.getAnchorPoint(),d=this._owner.getContentSize(),a=a.getContentSize();this._leftMargin=b.x-c.x*d.width;this._rightMargin=a.width-(b.x+(1-c.x)*d.width)}},_refreshVerticalMargin:function(){var a=
this._getOwnerParent();if(null!==a){var b=this._owner.getPosition(),c=this._owner.getAnchorPoint(),d=this._owner.getContentSize(),a=a.getContentSize();this._bottomMargin=b.y-c.y*d.height;this._topMargin=a.height-(b.y+(1-c.y)*d.height)}}});ccui.LayoutComponent.horizontalEdge={NONE:0,LEFT:1,RIGHT:2,CENTER:3};ccui.LayoutComponent.verticalEdge={NONE:0,BOTTOM:1,TOP:2,CENTER:3};ccui.LayoutComponent.NAME="__ui_layout";
ccui.LayoutComponent.bindLayoutComponent=function(a){var b=a.getComponent(ccui.LayoutComponent.NAME);if(void 0!==b)return b;b=new ccui.LayoutComponent;b.init();a.addComponent(b);a instanceof ccui.Widget||a.addEventListener&&a.addEventListener("load",function(){b.refreshLayout()},this);return b};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.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="v1.3.0.0";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_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_SKELETON="skeleton";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_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_EASING_PARAM="twEP";
ccs.CONST_A_TWEEN_ROTATE="twR";ccs.CONST_A_IS_ARMATURE="isArmature";ccs.CONST_A_DISPLAY_TYPE="displayType";ccs.CONST_A_MOVEMENT="mov";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_BLEND_TYPE="bd";ccs.CONST_A_BLEND_SRC="bd_src";
ccs.CONST_A_BLEND_DST="bd_dst";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_CONTOUR="con";ccs.CONST_CONTOUR_VERTEX="con_vt";ccs.CONST_FL_NAN="NaN";ccs.CONST_FRAME_DATA="frame_data";ccs.CONST_MOVEMENT_BONE_DATA="mov_bone_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.DataInfo=function(){this.asyncStruct=null;this.configFileQueue=[];this.contentScale=1;this.baseFilePath=this.filename="";this.cocoStudioVersion=this.flashToolVersion=0};
ccs.dataReaderHelper={ConfigType:{DragonBone_XML:0,CocoStudio_JSON:1,CocoStudio_Binary:2},_configFileList:[],_flashToolVersion:ccs.CONST_VERSION_2_0,_positionReadScale:1,_asyncRefCount:0,_asyncRefTotalCount:0,_dataQueue:null,setPositionReadScale:function(a){this._positionReadScale=a},getPositionReadScale:function(){return this._positionReadScale},addDataFromFile:function(a){if(-1===this._configFileList.indexOf(a)){this._configFileList.push(a);var b=this._initBaseFilePath(a),c=cc.path.extname(a).toLowerCase(),
d=new ccs.DataInfo;d.filename=a;d.basefilePath=b;".xml"===c?ccs.dataReaderHelper.addDataFromXML(a,d):".json"===c||".exportjson"===c?ccs.dataReaderHelper.addDataFromJson(a,d):".csb"===c&&ccs.dataReaderHelper.addDataFromBinaryCache(a,d)}},addDataFromFileAsync:function(a,b,c,d,e){if(-1!==this._configFileList.indexOf(c))e&&d&&(0===this._asyncRefTotalCount&&0===this._asyncRefCount?this._asyncCallBack(d,e,1):this._asyncCallBack(d,e,(this._asyncRefTotalCount-this._asyncRefCount)/this._asyncRefTotalCount));
else{this._asyncRefTotalCount++;this._asyncRefCount++;var f=this;cc.director.getScheduler().schedule(function(){f.addDataFromFile(c);f._asyncRefCount--;f._asyncCallBack(d,e,(f._asyncRefTotalCount-f._asyncRefCount)/f._asyncRefTotalCount)},this,0.1,!1,0,!1,"armatrueDataHelper")}},removeConfigFile:function(a){for(var b=this._configFileList,c=b.length,d=b[c],e=0;e<c;e++)b[e]===a&&(d=e);d!==b[c]&&cc.arrayRemoveObject(b,a)},addDataFromCache:function(a,b){if(a){b.flashToolVersion=parseFloat(a.getAttribute(ccs.CONST_VERSION));
var c=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_ARMATURES+" \x3e  "+ccs.CONST_ARMATURE+""),d=ccs.armatureDataManager,e;for(e=0;e<c.length;e++){var f=this.decodeArmature(c[e],b);d.addArmatureData(f.name,f,b.filename)}c=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_ANIMATIONS+" \x3e  "+ccs.CONST_ANIMATION+"");for(e=0;e<c.length;e++)f=this.decodeAnimation(c[e],b),d.addAnimationData(f.name,f,b.filename);c=a.querySelectorAll(ccs.CONST_SKELETON+" \x3e "+ccs.CONST_TEXTURE_ATLAS+
" \x3e  "+ccs.CONST_SUB_TEXTURE+"");for(e=0;e<c.length;e++)f=this.decodeTexture(c[e],b),d.addTextureData(f.name,f,b.filename)}else cc.log("XML error  or  XML is empty.")},decodeArmature:function(a,b){var c=new ccs.ArmatureData;c.init();c.name=a.getAttribute(ccs.CONST_A_NAME);for(var d=a.querySelectorAll(ccs.CONST_ARMATURE+" \x3e "+ccs.CONST_BONE),e=0;e<d.length;e++){var f=d[e],h=f.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++);
f=this.decodeBone(f,k,b);c.addBoneData(f)}return c},decodeArmatureFromJSON:function(a,b){var c=new ccs.ArmatureData;c.init();var d=a[ccs.CONST_A_NAME];d&&(c.name=d);b.cocoStudioVersion=c.dataVersion=a[ccs.CONST_VERSION]||0.1;for(var d=a[ccs.CONST_BONE_DATA],e=0;e<d.length;e++){var f=this.decodeBoneFromJson(d[e],b);c.addBoneData(f)}return c},decodeBone:function(a,b,c){b=new ccs.BoneData;b.init();b.name=a.getAttribute(ccs.CONST_A_NAME);b.parentName=a.getAttribute(ccs.CONST_A_PARENT)||"";b.zOrder=parseInt(a.getAttribute(ccs.CONST_A_Z))||
0;a=a.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_DISPLAY);for(var d=0;d<a.length;d++){var e=this.decodeBoneDisplay(a[d],c);b.addDisplayData(e)}return b},decodeBoneFromJson:function(a,b){var c=new ccs.BoneData;c.init();this.decodeNodeFromJson(c,a,b);c.name=a[ccs.CONST_A_NAME]||"";c.parentName=a[ccs.CONST_A_PARENT]||"";for(var d=a[ccs.CONST_DISPLAY_DATA]||[],e=0;e<d.length;e++){var f=this.decodeBoneDisplayFromJson(d[e],b);c.addDisplayData(f)}return c},decodeBoneDisplay:function(a,b){var c=null;
1===(parseFloat(a.getAttribute(ccs.CONST_A_IS_ARMATURE))||0)?(c=new ccs.ArmatureDisplayData,c.displayType=ccs.DISPLAY_TYPE_ARMATURE):(c=new ccs.SpriteDisplayData,c.displayType=ccs.DISPLAY_TYPE_SPRITE);var d=a.getAttribute(ccs.CONST_A_NAME)||"";d&&(c.displayName=d);return c},decodeBoneDisplayFromJson:function(a,b){var c=a[ccs.CONST_A_DISPLAY_TYPE]||ccs.DISPLAY_TYPE_SPRITE,d=null;switch(c){case ccs.DISPLAY_TYPE_SPRITE:var d=new ccs.SpriteDisplayData,e=a[ccs.CONST_A_NAME];null!=e&&(d.displayName=e);
if(e=(a[ccs.CONST_SKIN_DATA]||[])[0]){var f=d.skinData;f.x=e[ccs.CONST_A_X]*this._positionReadScale;f.y=e[ccs.CONST_A_Y]*this._positionReadScale;f.scaleX=null==e[ccs.CONST_A_SCALE_X]?1:e[ccs.CONST_A_SCALE_X];f.scaleY=null==e[ccs.CONST_A_SCALE_Y]?1:e[ccs.CONST_A_SCALE_Y];f.skewX=null==e[ccs.CONST_A_SKEW_X]?1:e[ccs.CONST_A_SKEW_X];f.skewY=null==e[ccs.CONST_A_SKEW_Y]?1:e[ccs.CONST_A_SKEW_Y];f.x*=b.contentScale;f.y*=b.contentScale}break;case ccs.DISPLAY_TYPE_ARMATURE:d=new ccs.ArmatureDisplayData;e=a[ccs.CONST_A_NAME];
null!=e&&(d.displayName=a[ccs.CONST_A_NAME]);break;case ccs.DISPLAY_TYPE_PARTICLE:d=new ccs.ParticleDisplayData;e=a[ccs.CONST_A_PLIST];null!=e&&(d.displayName=b.asyncStruct?b.asyncStruct.basefilePath+e:b.basefilePath+e);break;default:d=new ccs.SpriteDisplayData}d.displayType=c;return d},decodeAnimation:function(a,b){var c=new ccs.AnimationData,d=a.getAttribute(ccs.CONST_A_NAME),e=ccs.armatureDataManager.getArmatureData(d);c.name=d;for(var d=a.querySelectorAll(ccs.CONST_ANIMATION+" \x3e "+ccs.CONST_MOVEMENT),
f=null,h=0;h<d.length;h++)f=d[h],f=this.decodeMovement(f,e,b),c.addMovement(f);return c},decodeAnimationFromJson:function(a,b){var c=new ccs.AnimationData;a[ccs.CONST_A_NAME]&&(c.name=a[ccs.CONST_A_NAME]);for(var d=a[ccs.CONST_MOVEMENT_DATA]||[],e=0;e<d.length;e++){var f=this.decodeMovementFromJson(d[e],b);c.addMovement(f)}return c},decodeMovement:function(a,b,c){var d=new ccs.MovementData;d.name=a.getAttribute(ccs.CONST_A_NAME);var e;e=0;e=a.getAttribute(ccs.CONST_A_DURATION);d.duration=null==e?
0:parseFloat(e);e=a.getAttribute(ccs.CONST_A_DURATION_TO);d.durationTo=null==e?0:parseFloat(e);e=a.getAttribute(ccs.CONST_A_DURATION_TWEEN);d.durationTween=null==e?0:parseFloat(e);e=a.getAttribute(ccs.CONST_A_LOOP);d.loop=e?Boolean(parseFloat(e)):!0;if(e=a.getAttribute(ccs.CONST_A_TWEEN_EASING))e!=ccs.CONST_FL_NAN?(e=null==e?0:parseFloat(e),d.tweenEasing=2===e?ccs.TweenType.SINE_EASEINOUT:e):d.tweenEasing=ccs.TweenType.LINEAR;a=a.querySelectorAll(ccs.CONST_MOVEMENT+" \x3e "+ccs.CONST_BONE);var f=
null;for(e=0;e<a.length;e++){var f=a[e],h=f.getAttribute(ccs.CONST_A_NAME);if(!d.getMovementBoneData(h)){var h=b.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++);f=this.decodeMovementBone(f,m,h,c);d.addMovementBoneData(f)}}return d},decodeMovementFromJson:function(a,b){var c=new ccs.MovementData;c.loop=null==a[ccs.CONST_A_LOOP]?!1:a[ccs.CONST_A_LOOP];c.durationTween=a[ccs.CONST_A_DURATION_TWEEN]||0;c.durationTo=a[ccs.CONST_A_DURATION_TO]||
0;c.duration=a[ccs.CONST_A_DURATION]||0;c.scale=null==a[ccs.CONST_A_DURATION]?1:null==a[ccs.CONST_A_MOVEMENT_SCALE]?1:a[ccs.CONST_A_MOVEMENT_SCALE];c.tweenEasing=null==a[ccs.CONST_A_TWEEN_EASING]?ccs.TweenType.LINEAR:a[ccs.CONST_A_TWEEN_EASING];var d=a[ccs.CONST_A_NAME];d&&(c.name=d);for(var d=a[ccs.CONST_MOVEMENT_BONE_DATA]||[],e=0;e<d.length;e++){var f=this.decodeMovementBoneFromJson(d[e],b);c.addMovementBoneData(f)}return c},decodeMovementBone:function(a,b,c,d){var e=new ccs.MovementBoneData;e.init();
var f;a&&(f=parseFloat(a.getAttribute(ccs.CONST_A_MOVEMENT_SCALE))||0,e.scale=f,f=parseFloat(a.getAttribute(ccs.CONST_A_MOVEMENT_DELAY))||0,0<f&&(f-=1),e.delay=f);var h=0,k=f=0,m=null,n=[];if(null!=b){for(var p=b.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_FRAME),h=0;h<p.length;h++)n.push(p[h]);h=n.length}e.name=a.getAttribute(ccs.CONST_A_NAME);a=a.querySelectorAll(ccs.CONST_BONE+" \x3e "+ccs.CONST_FRAME);for(var r=p=0,s=0;s<a.length;s++){var t=a[s];if(b)for(;p<h&&(m?r<f||r>=f+k:1);)m=n[p],
f+=k,k=parseFloat(m.getAttribute(ccs.CONST_A_DURATION)),p++;t=this.decodeFrame(t,m,c,d);e.addFrameData(t);t.frameID=r;r+=t.duration;e.duration=r}b=e.frameList;c=Math.PI;for(h=b.length-1;0<=h;h--)if(0<h){d=b[h].skewX-b[h-1].skewX;f=b[h].skewY-b[h-1].skewY;if(d<-c||d>c)b[h-1].skewX=0>d?b[h-1].skewX-2*c:b[h-1].skewX+2*c;if(f<-c||f>c)b[h-1].skewY=0>f?b[h-1].skewY-2*c:b[h-1].skewY+2*c}b=new ccs.FrameData;b.copy(e.frameList[e.frameList.length-1]);b.frameID=e.duration;e.addFrameData(b);return e},decodeMovementBoneFromJson:function(a,
b){var c=new ccs.MovementBoneData;c.init();c.delay=a[ccs.CONST_A_MOVEMENT_DELAY]||0;var d=a[ccs.CONST_A_NAME];d&&(c.name=d);for(var e=(a[ccs.CONST_FRAME_DATA]||[]).length,d=0;d<e;d++){var f=this.decodeFrameFromJson(a[ccs.CONST_FRAME_DATA][d],b);c.addFrameData(f);b.cocoStudioVersion<ccs.CONST_VERSION_COMBINED&&(f.frameID=c.duration,c.duration+=f.duration)}if(b.cocoStudioVersion<ccs.VERSION_CHANGE_ROTATION_RANGE)for(e=c.frameList,f=Math.PI,d=e.length-1;0<=d;d--)if(0<d){var h=e[d].skewX-e[d-1].skewX,
k=e[d].skewY-e[d-1].skewY;if(h<-f||h>f)e[d-1].skewX=0>h?e[d-1].skewX-2*f:e[d-1].skewX+2*f;if(k<-f||k>f)e[d-1].skewY=0>k?e[d-1].skewY-2*f:e[d-1].skewY+2*f}b.cocoStudioVersion<ccs.CONST_VERSION_COMBINED&&0<c.frameList.length&&(f=new ccs.FrameData,f.copy(c.frameList[c.frameList.length-1]),c.addFrameData(f),f.frameID=c.duration);return c},decodeFrame:function(a,b,c,d){var e=0,e=e=e=e=e=e=e=e=e=e=e=0;c=new ccs.FrameData;c.strMovement=a.getAttribute(ccs.CONST_A_MOVEMENT)||"";c.movement=c.strMovement;c.strEvent=
a.getAttribute(ccs.CONST_A_EVENT)||"";c.event=c.strEvent;c.strSound=a.getAttribute(ccs.CONST_A_SOUND)||"";c.sound=c.strSound;c.strSoundEffect=a.getAttribute(ccs.CONST_A_SOUND_EFFECT)||"";c.soundEffect=c.strSoundEffect;e=a.getAttribute(ccs.CONST_A_TWEEN_FRAME);c.isTween=!(void 0!==e&&("false"===e||"0"===e));if(d.flashToolVersion>=ccs.CONST_VERSION_2_0){if(e=a.getAttribute(ccs.CONST_A_COCOS2DX_X))c.x=parseFloat(e),c.x*=this._positionReadScale;e=a.getAttribute(ccs.CONST_A_COCOS2DX_Y)}else{if(e=a.getAttribute(ccs.CONST_A_X))c.x=
parseFloat(e),c.x*=this._positionReadScale;e=a.getAttribute(ccs.CONST_A_Y)}e&&(c.y=-parseFloat(e),c.y*=this._positionReadScale);e=a.getAttribute(ccs.CONST_A_SCALE_X);null!=e&&(c.scaleX=parseFloat(e));e=a.getAttribute(ccs.CONST_A_SCALE_Y);null!=e&&(c.scaleY=parseFloat(e));e=a.getAttribute(ccs.CONST_A_SKEW_X);null!=e&&(c.skewX=cc.degreesToRadians(parseFloat(e)));e=a.getAttribute(ccs.CONST_A_SKEW_Y);null!=e&&(c.skewY=cc.degreesToRadians(-parseFloat(e)));e=a.getAttribute(ccs.CONST_A_DURATION);null!=e&&
(c.duration=parseFloat(e));e=a.getAttribute(ccs.CONST_A_DISPLAY_INDEX);null!=e&&(c.displayIndex=parseFloat(e));e=a.getAttribute(ccs.CONST_A_Z);null!=e&&(c.zOrder=parseInt(e));e=a.getAttribute(ccs.CONST_A_TWEEN_ROTATE);null!=e&&(c.tweenRotate=parseFloat(e));e=a.getAttribute(ccs.CONST_A_BLEND_TYPE);if(null!=e){var f=c.blendFunc;switch(e){case ccs.BLEND_TYPE_NORMAL:f.src=cc.BLEND_SRC;f.dst=cc.BLEND_DST;break;case ccs.BLEND_TYPE_ADD:f.src=cc.SRC_ALPHA;f.dst=cc.ONE;break;case ccs.BLEND_TYPE_MULTIPLY:f.src=
cc.DST_COLOR;f.dst=cc.ONE_MINUS_SRC_ALPHA;break;case ccs.BLEND_TYPE_SCREEN:f.src=cc.ONE;f.dst=cc.ONE_MINUS_DST_COLOR;break;default:c.blendFunc.src=cc.BLEND_SRC,c.blendFunc.dst=cc.BLEND_DST}}var h=a.querySelectorAll(ccs.CONST_FRAME+" \x3e "+ccs.CONST_A_COLOR_TRANSFORM);if(h&&0<h.length){var h=h[0],k,m,n,p,r,e=parseFloat(h.getAttribute(ccs.CONST_A_ALPHA))||0,f=parseFloat(h.getAttribute(ccs.CONST_A_RED))||0;k=parseFloat(h.getAttribute(ccs.CONST_A_GREEN))||0;m=parseFloat(h.getAttribute(ccs.CONST_A_BLUE))||
0;n=parseFloat(h.getAttribute(ccs.CONST_A_ALPHA_OFFSET))||0;p=parseFloat(h.getAttribute(ccs.CONST_A_RED_OFFSET))||0;r=parseFloat(h.getAttribute(ccs.CONST_A_GREEN_OFFSET))||0;h=parseFloat(h.getAttribute(ccs.CONST_A_BLUE_OFFSET))||0;c.a=2.55*n+e;c.r=2.55*p+f;c.g=2.55*r+k;c.b=2.55*h+m;c.isUseColorInfo=!0}e=a.getAttribute(ccs.CONST_A_TWEEN_EASING);null!=e&&(e!=ccs.CONST_FL_NAN?(e=a.getAttribute(ccs.CONST_A_TWEEN_EASING))&&(c.tweenEasing=2===e?ccs.TweenType.SINE_EASEINOUT:e):c.tweenEasing=ccs.TweenType.LINEAR);
b&&(a=new ccs.BaseData,d.flashToolVersion>=ccs.CONST_VERSION_2_0?(a.x=parseFloat(b.getAttribute(ccs.CONST_A_COCOS2DX_X)),a.y=parseFloat(b.getAttribute(ccs.CONST_A_COCOS2DX_Y))):(a.x=parseFloat(b.getAttribute(ccs.CONST_A_X)),a.y=parseFloat(b.getAttribute(ccs.CONST_A_Y))),a.skewX=parseFloat(b.getAttribute(ccs.CONST_A_SKEW_X)),a.skewY=parseFloat(b.getAttribute(ccs.CONST_A_SKEW_Y)),a.y=-a.y,a.skewX=cc.degreesToRadians(a.skewX),a.skewY=cc.degreesToRadians(-a.skewY),ccs.TransformHelp.transformFromParent(c,
a));return c},decodeFrameFromJson:function(a,b){var c=new ccs.FrameData;this.decodeNodeFromJson(c,a,b);c.tweenEasing=a[ccs.CONST_A_TWEEN_EASING]||ccs.TweenType.LINEAR;c.displayIndex=a[ccs.CONST_A_DISPLAY_INDEX];var d=null==a[ccs.CONST_A_BLEND_DST]?cc.BLEND_DST:a[ccs.CONST_A_BLEND_DST];c.blendFunc.src=null==a[ccs.CONST_A_BLEND_SRC]?cc.BLEND_SRC:a[ccs.CONST_A_BLEND_SRC];c.blendFunc.dst=d;c.isTween=null==a[ccs.CONST_A_TWEEN_FRAME]?!0:a[ccs.CONST_A_TWEEN_FRAME];d=a[ccs.CONST_A_EVENT];null!=d&&(c.strEvent=
d,c.event=d);b.cocoStudioVersion<ccs.CONST_VERSION_COMBINED?c.duration=null==a[ccs.CONST_A_DURATION]?1:a[ccs.CONST_A_DURATION]:c.frameID=a[ccs.CONST_A_FRAME_INDEX];for(var d=a[ccs.CONST_A_EASING_PARAM]||[],e=0;e<d.length;e++)c.easingParams[e]=d[e];return c},decodeTexture:function(a,b){var c=new ccs.TextureData;c.init();a.getAttribute(ccs.CONST_A_NAME)&&(c.name=a.getAttribute(ccs.CONST_A_NAME));var d,e;b.flashToolVersion>=ccs.CONST_VERSION_2_0?(d=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_X))||
0,e=parseFloat(a.getAttribute(ccs.CONST_A_COCOS2D_PIVOT_Y))||0):(d=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_X))||0,e=parseFloat(a.getAttribute(ccs.CONST_A_PIVOT_Y))||0);var f=parseFloat(a.getAttribute(ccs.CONST_A_WIDTH))||0,h=parseFloat(a.getAttribute(ccs.CONST_A_HEIGHT))||0;c.pivotX=d/f;c.pivotY=(h-e)/h;d=a.querySelectorAll(ccs.CONST_SUB_TEXTURE+" \x3e "+ccs.CONST_CONTOUR);for(e=0;e<d.length;e++)c.addContourData(this.decodeContour(d[e],b));return c},decodeTextureFromJson:function(a){var b=new ccs.TextureData;
b.init();var c=a[ccs.CONST_A_NAME];null!=c&&(b.name=c);b.width=a[ccs.CONST_A_WIDTH]||0;b.height=a[ccs.CONST_A_HEIGHT]||0;b.pivotX=a[ccs.CONST_A_PIVOT_X]||0;b.pivotY=a[ccs.CONST_A_PIVOT_Y]||0;a=a[ccs.CONST_CONTOUR_DATA]||[];for(c=0;c<a.length;c++)b.contourDataList.push(this.decodeContourFromJson(a[c]));return b},decodeContour:function(a,b){var c=new ccs.ContourData;c.init();for(var d=a.querySelectorAll(ccs.CONST_CONTOUR+" \x3e "+ccs.CONST_CONTOUR_VERTEX),e,f=0;f<d.length;f++){e=d[f];var h=cc.p(0,0);
h.x=parseFloat(e.getAttribute(ccs.CONST_A_X))||0;h.y=parseFloat(e.getAttribute(ccs.CONST_A_Y))||0;h.y=-h.y;c.vertexList.push(h)}return c},decodeContourFromJson:function(a){var b=new ccs.ContourData;b.init();a=a[ccs.CONST_VERTEX_POINT]||[];for(var c=a.length,d=0;d<c;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;b.vertexList.push(f)}return b},addDataFromJsonCache:function(a,b){b.contentScale=null==a[ccs.CONST_CONTENT_SCALE]?1:a[ccs.CONST_CONTENT_SCALE];var c=a[ccs.CONST_ARMATURE_DATA]||
[],d,e;for(d=0;d<c.length;d++)e=this.decodeArmatureFromJSON(c[d],b),ccs.armatureDataManager.addArmatureData(e.name,e,b.filename);c=a[ccs.CONST_ANIMATION_DATA]||[];for(d=0;d<c.length;d++)e=this.decodeAnimationFromJson(c[d],b),ccs.armatureDataManager.addAnimationData(e.name,e,b.filename);c=a[ccs.CONST_TEXTURE_DATA]||[];for(d=0;d<c.length;d++)e=this.decodeTextureFromJson(c[d],b),ccs.armatureDataManager.addTextureData(e.name,e,b.filename);if(null==b.asyncStruct?ccs.armatureDataManager.isAutoLoadSpriteFile():
b.asyncStruct.autoLoadSpriteFile){var c=a[ccs.CONST_CONFIG_FILE_PATH]||[],f;for(d=0;d<c.length;d++)e=c[d],f=e.lastIndexOf("."),e=e.substring(0,f),f=b.basefilePath+e+".plist",e=b.basefilePath+e+".png",ccs.armatureDataManager.addSpriteFrameFromFile(f,e,b.filename)}},decodeNodeFromJson:function(a,b,c){a.x=b[ccs.CONST_A_X]*this._positionReadScale;a.y=b[ccs.CONST_A_Y]*this._positionReadScale;a.x*=c.contentScale;a.y*=c.contentScale;a.zOrder=b[ccs.CONST_A_Z];a.skewX=b[ccs.CONST_A_SKEW_X]||0;a.skewY=b[ccs.CONST_A_SKEW_Y]||
0;a.scaleX=null==b[ccs.CONST_A_SCALE_X]?1:b[ccs.CONST_A_SCALE_X];a.scaleY=null==b[ccs.CONST_A_SCALE_Y]?1:b[ccs.CONST_A_SCALE_Y];if(b=c.cocoStudioVersion<ccs.VERSION_COLOR_READING?b[0]:b[ccs.CONST_COLOR_INFO]||null)a.a=null==b[ccs.CONST_A_ALPHA]?255:b[ccs.CONST_A_ALPHA],a.r=null==b[ccs.CONST_A_RED]?255:b[ccs.CONST_A_RED],a.g=null==b[ccs.CONST_A_GREEN]?255:b[ccs.CONST_A_GREEN],a.b=null==b[ccs.CONST_A_BLUE]?255:b[ccs.CONST_A_BLUE],a.isUseColorInfo=!0},clear:function(){this._configFileList=[];this._asyncRefTotalCount=
this._asyncRefCount=0},_asyncCallBack:function(a,b,c){a&&cc.isFunction(a)&&a.call(b,c);if(b&&a&&"string"===typeof a)b[a](c)},_initBaseFilePath:function(a){var b=a.lastIndexOf("/");return a=-1<b?a.substr(0,b+1):""},addDataFromXML:function(a,b){var c=cc.loader.getRes(a);if(!c)throw Error("Please load the resource first : "+a);(c=cc.saxParser.parse(c).documentElement)&&this.addDataFromCache(c,b)},addDataFromJson:function(a,b){var c=cc.loader.getRes(a);this.addDataFromJsonCache(c,b)}};ccs.spriteFrameCacheHelper={_textureAtlasDic:{},_imagePaths:[],addSpriteFrameFromFile:function(a,b){cc.spriteFrameCache.addSpriteFrames(a,b)},getTextureAtlasWithTexture:function(a){return null},clear:function(){this._textureAtlasDic={};this._imagePaths=[]}};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.helpParentNode={};
ccs.TransformHelp.transformFromParent=function(a,b){this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(b,this.helpMatrix2);this.helpMatrix2=cc.affineTransformInvert(this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)};
ccs.TransformHelp.transformToParent=function(a,b){this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(b,this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)};
ccs.TransformHelp.transformFromParentWithoutScale=function(a,b){for(var c in b)this.helpParentNode[c]=b[c];this.helpParentNode.scaleX=1;this.helpParentNode.scaleY=1;this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(this.helpParentNode,this.helpMatrix2);this.helpMatrix2=cc.affineTransformInvert(this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)};
ccs.TransformHelp.transformToParentWithoutScale=function(a,b){for(var c in b)this.helpParentNode[c]=b[c];this.helpParentNode.scaleX=1;this.helpParentNode.scaleY=1;this.nodeToMatrix(a,this.helpMatrix1);this.nodeToMatrix(this.helpParentNode,this.helpMatrix2);this.helpMatrix1=cc.affineTransformConcat(this.helpMatrix1,this.helpMatrix2);this.matrixToNode(this.helpMatrix1,a)};
ccs.TransformHelp.nodeToMatrix=function(a,b){if(a.skewX===-a.skewY){var c=Math.sin(a.skewX),d=Math.cos(a.skewX);b.a=a.scaleX*d;b.b=a.scaleX*-c;b.c=a.scaleY*c;b.d=a.scaleY*d}else b.a=a.scaleX*Math.cos(a.skewY),b.b=a.scaleX*Math.sin(a.skewY),b.c=a.scaleY*Math.sin(a.skewX),b.d=a.scaleY*Math.cos(a.skewX);b.tx=a.x;b.ty=a.y};
ccs.TransformHelp.matrixToNode=function(a,b){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;b.skewX=-(Math.atan2(this.helpPoint1.y,this.helpPoint1.x)-1.5707964);b.skewY=Math.atan2(this.helpPoint2.y,this.helpPoint2.x);b.scaleX=Math.sqrt(a.a*a.a+
a.b*a.b);b.scaleY=Math.sqrt(a.c*a.c+a.d*a.d);b.x=a.tx;b.y=a.ty};ccs.TransformHelp.nodeConcat=function(a,b){a.x+=b.x;a.y+=b.y;a.skewX+=b.skewX;a.skewY+=b.skewY;a.scaleX+=b.scaleX;a.scaleY+=b.scaleY};ccs.TransformHelp.nodeSub=function(a,b){a.x-=b.x;a.y-=b.y;a.skewX-=b.skewX;a.skewY-=b.skewY;a.scaleX-=b.scaleX;a.scaleY-=b.scaleY};ccs.TweenType={CUSTOM_EASING:-1,LINEAR:0,SINE_EASEIN:1,SINE_EASEOUT:2,SINE_EASEINOUT:3,QUAD_EASEIN:4,QUAD_EASEOUT:5,QUAD_EASEINOUT:6,CUBIC_EASEIN:7,CUBIC_EASEOUT:8,CUBIC_EASEINOUT:9,QUART_EASEIN:10,QUART_EASEOUT:11,QUART_EASEINOUT:12,QUINT_EASEIN:13,QUINT_EASEOUT:14,QUINT_EASEINOUT:15,EXPO_EASEIN:16,EXPO_EASEOUT:17,EXPO_EASEINOUT:18,CIRC_EASEIN:19,CIRC_EASEOUT:20,CIRC_EASEINOUT:21,ELASTIC_EASEIN:22,ELASTIC_EASEOUT:23,ELASTIC_EASEINOUT:24,BACK_EASEIN:25,BACK_EASEOUT:26,BACK_EASEINOUT:27,BOUNCE_EASEIN:28,
BOUNCE_EASEOUT:29,BOUNCE_EASEINOUT:30,TWEEN_EASING_MAX:1E4};ccs.TweenFunction=ccs.TweenFunction||ccs.Class.extend({});ccs.DOUBLE_PI=ccs.M_PI_X_2=2*Math.PI;ccs.HALF_PI=ccs.M_PI_2=Math.PI/2;ccs.M_PI=Math.PI;
ccs.TweenFunction.tweenTo=function(a,b,c){var d=0;switch(b){case ccs.TweenType.CUSTOM_EASING:d=this.customEase(a,c);break;case ccs.TweenType.LINEAR:d=this.linear(a);break;case ccs.TweenType.SINE_EASEIN:d=this.sineEaseIn(a);break;case ccs.TweenType.SINE_EASEOUT:d=this.sineEaseOut(a);break;case ccs.TweenType.SINE_EASEINOUT:d=this.sineEaseInOut(a);break;case ccs.TweenType.QUAD_EASEIN:d=this.quadEaseIn(a);break;case ccs.TweenType.QUAD_EASEOUT:d=this.quadEaseOut(a);break;case ccs.TweenType.QUAD_EASEINOUT:d=
this.quadEaseInOut(a);break;case ccs.TweenType.CUBIC_EASEIN:d=this.cubicEaseIn(a);break;case ccs.TweenType.CUBIC_EASEOUT:d=this.cubicEaseOut(a);break;case ccs.TweenType.CUBIC_EASEINOUT:d=this.cubicEaseInOut(a);break;case ccs.TweenType.QUART_EASEIN:d=this.quartEaseIn(a);break;case ccs.TweenType.QUART_EASEOUT:d=this.quartEaseOut(a);break;case ccs.TweenType.QUART_EASEINOUT:d=this.quartEaseInOut(a);break;case ccs.TweenType.QUINT_EASEIN:d=this.quintEaseIn(a);break;case ccs.TweenType.QUINT_EASEOUT:d=this.quintEaseOut(a);
break;case ccs.TweenType.QUINT_EASEINOUT:d=this.quintEaseInOut(a);break;case ccs.TweenType.EXPO_EASEIN:d=this.expoEaseIn(a);break;case ccs.TweenType.EXPO_EASEOUT:d=this.expoEaseOut(a);break;case ccs.TweenType.EXPO_EASEINOUT:d=this.expoEaseInOut(a);break;case ccs.TweenType.CIRC_EASEIN:d=this.circEaseIn(a);break;case ccs.TweenType.CIRC_EASEOUT:d=this.circEaseOut(a);break;case ccs.TweenType.CIRC_EASEINOUT:d=this.circEaseInOut(a);break;case ccs.TweenType.ELASTIC_EASEIN:b=0.3;null!=c&&0<c.length&&(b=c[0]);
d=this.elasticEaseIn(a,b);break;case ccs.TweenType.ELASTIC_EASEOUT:b=0.3;null!=c&&0<c.length&&(b=c[0]);d=this.elasticEaseOut(a,b);break;case ccs.TweenType.ELASTIC_EASEINOUT:b=0.3;null!=c&&0<c.length&&(b=c[0]);d=this.elasticEaseInOut(a,b);break;case ccs.TweenType.BACK_EASEIN:d=this.backEaseIn(a);break;case ccs.TweenType.BACK_EASEOUT:d=this.backEaseOut(a);break;case ccs.TweenType.BACK_EASEINOUT:d=this.backEaseInOut(a);break;case ccs.TweenType.BOUNCE_EASEIN:d=this.bounceEaseIn(a);break;case ccs.TweenType.BOUNCE_EASEOUT:d=
this.bounceEaseOut(a);break;case ccs.TweenType.BOUNCE_EASEINOUT:d=this.bounceEaseInOut(a);break;default:d=this.sineEaseInOut(a)}return d};ccs.TweenFunction.linear=function(a){return a};ccs.TweenFunction.sineEaseIn=function(a){return-1*Math.cos(a*ccs.HALF_PI)+1};ccs.TweenFunction.sineEaseOut=function(a){return Math.sin(a*ccs.HALF_PI)};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,b){var c=0.3;0<b.length&&(c=b[0]);var d=0;0===a||1===a?d=a:(d=c/4,a-=1,d=-Math.pow(2,10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c));return d};ccs.TweenFunction.elasticEaseOut=function(a,b){var c=0.3;0<b.length&&(c=b[0]);var d=0;0===a||1===a?d=a:(d=c/4,d=Math.pow(2,-10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c)+1);return d};
ccs.TweenFunction.elasticEaseInOut=function(a,b){var c=0.3;0<b.length&&(c=b[0]);var d=0;0===a||1===a?d=a:(c||(c=0.3*1.5),d=c/4,a=2*a-1,d=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c):Math.pow(2,-10*a)*Math.sin((a-d)*ccs.DOUBLE_PI/c)*0.5+1);return d};ccs.TweenFunction.backEaseIn=function(a){return a*a*(2.70158*a-1.70158)};ccs.TweenFunction.backEaseOut=function(a){a-=1;return a*a*(2.70158*a+1.70158)+1};
ccs.TweenFunction.backEaseInOut=function(a){a*=2;if(1>a)return a*a*(3.5949095*a-2.5949095)/2;a-=2;return a*a*(3.5949095*a+2.5949095)/2+1};ccs.bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};ccs.TweenFunction.bounceEaseIn=function(a){return 1-ccs.bounceTime(1-a)};ccs.TweenFunction.bounceEaseOut=function(a){return ccs.bounceTime(a)};
ccs.TweenFunction.bounceEaseInOut=function(a){var b=0;return b=0.5>a?0.5*(1-ccs.bounceTime(1-2*a)):0.5*ccs.bounceTime(2*a-1)+0.5};ccs.TweenFunction.customEase=function(a,b){if(0<b.length){var c=1-a;return b[1]*c*c*c+3*b[3]*a*c*c+3*b[5]*a*a*c+b[7]*a*a*a}return a};ccs.TweenFunction.easeIn=function(a,b){return Math.pow(a,b)};ccs.TweenFunction.easeOut=function(a,b){return Math.pow(a,1/b)};ccs.TweenFunction.easeInOut=function(a,b){a*=2;return 1>a?0.5*Math.pow(a,b):1-0.5*Math.pow(2-a,b)};
ccs.TweenFunction.quadraticIn=function(a){return Math.pow(a,2)};ccs.TweenFunction.quadraticOut=function(a){return-a*(a-2)};ccs.TweenFunction.bezieratFunction=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d};var ENABLE_PHYSICS_DETECT=!1;ccs.fmodf=function(a,b){for(;a>b;)a-=b;return a};var CC_SAFE_RELEASE=function(a){a&&a.release&&a.release()};ccs.isSpriteContainPoint=function(a,b,c){b=a.convertToNodeSpace(b);c&&(c.x=b.x,c.y=b.y);a=a.getContentSize();return cc.rectContainsPoint(cc.rect(0,0,a.width,a.height),b)};ccs.SPRITE_CONTAIN_POINT=ccs.isSpriteContainPoint;ccs.SPRITE_CONTAIN_POINT_WITH_RETURN=ccs.isSpriteContainPoint;
ccs.extBezierTo=function(a,b,c,d,e){var f=cc.p(0,0);d&&!e&&(f.x=Math.pow(1-a,2)*b.x+2*a*(1-a)*c.x+Math.pow(a,2)*d.x,f.y=Math.pow(1-a,2)*b.y+2*a*(1-a)*c.y+Math.pow(a,2)*d.y);e&&(f.x=b.x*Math.pow(1-a,3)+3*a*c.x*Math.pow(1-a,2)+3*d.x*Math.pow(a,2)*(1-a)+e.x*Math.pow(a,3),f.y=b.y*Math.pow(1-a,3)+3*a*c.y*Math.pow(1-a,2)+3*d.y*Math.pow(a,2)*(1-a)+e.y*Math.pow(a,3));return f};ccs.extCircleTo=function(a,b,c,d,e){var f=cc.p(0,0);f.x=b.x+c*Math.cos(d+e*a);f.y=b.y+c*Math.sin(d+e*a);return f};ccs.RelativeData=function(){this.plistFiles=[];this.armatures=[];this.animations=[];this.textures=[]};
ccs.armatureDataManager={_animationDatas:{},_armatureDatas:{},_textureDatas:{},_autoLoadSpriteFile:!1,_relativeDatas:{},s_sharedArmatureDataManager:null,removeArmatureFileInfo:function(a){var b=this.getRelativeData(a);if(b){var c,d;for(c=0;c<b.armatures.length;c++)d=b.armatures[c],this.removeArmatureData(d);for(c=0;c<b.animations.length;c++)d=b.animations[c],this.removeAnimationData(d);for(c=0;c<b.textures.length;c++)d=b.textures[c],this.removeTextureData(d);for(c=0;c<b.plistFiles.length;c++)d=b.plistFiles[c],
cc.spriteFrameCache.removeSpriteFramesFromFile(d);delete this._relativeDatas[a];ccs.dataReaderHelper.removeConfigFile(a)}},addArmatureData:function(a,b,c){(c=this.getRelativeData(c))&&c.armatures.push(a);this._armatureDatas[a]=b},getArmatureData:function(a){var b=null;this._armatureDatas&&(b=this._armatureDatas[a]);return b},removeArmatureData:function(a){this._armatureDatas[a]&&delete this._armatureDatas[a]},addAnimationData:function(a,b,c){(c=this.getRelativeData(c))&&c.animations.push(a);this._animationDatas[a]=
b},getAnimationData:function(a){var b=null;this._animationDatas[a]&&(b=this._animationDatas[a]);return b},removeAnimationData:function(a){this._animationDatas[a]&&delete this._animationDatas[a]},addTextureData:function(a,b,c){(c=this.getRelativeData(c))&&c.textures.push(a);this._textureDatas[a]=b},getTextureData:function(a){var b=null;this._textureDatas&&(b=this._textureDatas[a]);return b},removeTextureData:function(a){this._textureDatas[a]&&delete this._textureDatas[a]},addArmatureFileInfo:function(){var a,
b,c;switch(arguments.length){case 1:c=arguments[0];this.addRelativeData(c);this._autoLoadSpriteFile=!0;ccs.dataReaderHelper.addDataFromFile(c);break;case 3:a=arguments[0],b=arguments[1],c=arguments[2],this.addRelativeData(c),this._autoLoadSpriteFile=!1,ccs.dataReaderHelper.addDataFromFile(c),this.addSpriteFrameFromFile(b,a)}},addArmatureFileInfoAsync:function(){var a,b,c,d,e;switch(arguments.length){case 3:c=arguments[0];d=arguments[2];e=arguments[1];this.addRelativeData(c);this._autoLoadSpriteFile=
!0;ccs.dataReaderHelper.addDataFromFileAsync("","",c,e,d);break;case 5:a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[4],e=arguments[3],this.addRelativeData(c),this._autoLoadSpriteFile=!1,ccs.dataReaderHelper.addDataFromFileAsync(a,b,c,e,d),this.addSpriteFrameFromFile(b,a)}},addSpriteFrameFromFile:function(a,b,c){(c=this.getRelativeData(c))&&c.plistFiles.push(a);ccs.spriteFrameCacheHelper.addSpriteFrameFromFile(a,b)},isAutoLoadSpriteFile:function(){return this._autoLoadSpriteFile},getArmatureDatas:function(){return this._armatureDatas},
getAnimationDatas:function(){return this._animationDatas},getTextureDatas:function(){return this._textureDatas},addRelativeData:function(a){this._relativeDatas[a]||(this._relativeDatas[a]=new ccs.RelativeData)},getRelativeData:function(a){return this._relativeDatas[a]},clear:function(){for(var a in this._relativeDatas)this.removeArmatureFileInfo(a);this._animationDatas={};this._armatureDatas={};this._textureDatas={};this._relativeDatas={};ccs.spriteFrameCacheHelper.clear();ccs.dataReaderHelper.clear()}};ccs.BLEND_TYPE_NORMAL=0;ccs.BLEND_TYPE_LAYER=1;ccs.BLEND_TYPE_DARKEN=2;ccs.BLEND_TYPE_MULTIPLY=3;ccs.BLEND_TYPE_LIGHTEN=4;ccs.BLEND_TYPE_SCREEN=5;ccs.BLEND_TYPE_OVERLAY=6;ccs.BLEND_TYPE_HIGHLIGHT=7;ccs.BLEND_TYPE_ADD=8;ccs.BLEND_TYPE_SUBTRACT=9;ccs.BLEND_TYPE_DIFFERENCE=10;ccs.BLEND_TYPE_INVERT=11;ccs.BLEND_TYPE_ALPHA=12;ccs.BLEND_TYPE_ERASE=13;ccs.DISPLAY_TYPE_SPRITE=0;ccs.DISPLAY_TYPE_ARMATURE=1;ccs.DISPLAY_TYPE_PARTICLE=2;ccs.DISPLAY_TYPE_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.a=this.b=this.g=this.r=255},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.color(this.r,this.g,this.b,this.a)},subtract:function(a,b,c){this.x=b.x-a.x;this.y=b.y-a.y;this.scaleX=b.scaleX-a.scaleX;this.scaleY=b.scaleY-a.scaleY;this.skewX=b.skewX-a.skewX;this.skewY=b.skewY-a.skewY;this.isUseColorInfo||a.isUseColorInfo||b.isUseColorInfo?(this.a=b.a-a.a,this.r=b.r-a.r,this.g=b.g-a.g,this.b=b.b-a.b,this.isUseColorInfo=!0):(this.a=this.r=
this.g=this.b=0,this.isUseColorInfo=!1);c&&(this.skewX>ccs.M_PI&&(this.skewX-=ccs.DOUBLE_PI),this.skewX<-ccs.M_PI&&(this.skewX+=ccs.DOUBLE_PI),this.skewY>ccs.M_PI&&(this.skewY-=ccs.DOUBLE_PI),this.skewY<-ccs.M_PI&&(this.skewY+=ccs.DOUBLE_PI));b.tweenRotate&&(this.skewX+=b.tweenRotate*ccs.PI*2,this.skewY-=b.tweenRotate*ccs.PI*2)}});
ccs.DisplayData=ccs.Class.extend({displayType:ccs.DISPLAY_TYPE_MAX,displayName:"",ctor:function(){this.displayType=ccs.DISPLAY_TYPE_MAX},changeDisplayToTexture:function(a){var b=a.lastIndexOf(".");-1!==b&&(a=a.substring(0,b));return a},copy:function(a){this.displayName=a.displayName;this.displayType=a.displayType}});
ccs.SpriteDisplayData=ccs.DisplayData.extend({skinData:null,ctor:function(){this.skinData=new ccs.BaseData;this.displayType=ccs.DISPLAY_TYPE_SPRITE},copy:function(a){ccs.DisplayData.prototype.copy.call(this,a);this.skinData=a.skinData}});ccs.ArmatureDisplayData=ccs.DisplayData.extend({ctor:function(){this.displayName="";this.displayType=ccs.DISPLAY_TYPE_ARMATURE}});ccs.ParticleDisplayData=ccs.DisplayData.extend({ctor:function(){this.displayType=ccs.DISPLAY_TYPE_PARTICLE}});
ccs.BoneData=ccs.BaseData.extend({displayDataList:null,name:"",parentName:"",boneDataTransform:null,ctor:function(){this.displayDataList=[];this.parentName=this.name="";this.boneDataTransform=null},init:function(){this.displayDataList.length=0;return!0},addDisplayData:function(a){this.displayDataList.push(a)},getDisplayData:function(a){return this.displayDataList[a]}});
ccs.ArmatureData=ccs.Class.extend({boneDataDic:null,name:"",dataVersion:0.1,ctor:function(){this.boneDataDic={};this.name="";this.dataVersion=0.1},init:function(){return!0},addBoneData:function(a){this.boneDataDic[a.name]=a},getBoneDataDic:function(){return this.boneDataDic},getBoneData:function(a){return this.boneDataDic[a]}});
ccs.FrameData=ccs.BaseData.extend({duration:0,tweenEasing:0,easingParamNumber:0,easingParams:null,displayIndex:-1,movement:"",event:"",sound:"",soundEffect:"",blendFunc:null,frameID:0,isTween:!0,ctor:function(){ccs.BaseData.prototype.ctor.call(this);this.duration=1;this.tweenEasing=ccs.TweenType.LINEAR;this.easingParamNumber=0;this.easingParams=[];this.displayIndex=0;this.soundEffect=this.sound=this.event=this.movement="";this.blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this.frameID=0;this.isTween=
!0},copy:function(a){ccs.BaseData.prototype.copy.call(this,a);this.duration=a.duration;this.displayIndex=a.displayIndex;this.tweenEasing=a.tweenEasing;this.easingParamNumber=a.easingParamNumber;if(0!==this.easingParamNumber)for(var b=this.easingParams.length=0;b<this.easingParamNumber;b++)this.easingParams[b]=a.easingParams[b];this.blendFunc=a.blendFunc;this.isTween=a.isTween}});
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(){return!0},addFrameData:function(a){this.frameList.push(a)},getFrameData:function(a){return this.frameList[a]}});ccs.MovementData=function(){this.name="";this.duration=0;this.scale=1;this.durationTween=this.durationTo=0;this.loop=!0;this.tweenEasing=ccs.TweenType.LINEAR;this.movBoneDataDic={}};
ccs.MovementData.prototype.addMovementBoneData=function(a){this.movBoneDataDic[a.name]=a};ccs.MovementData.prototype.getMovementBoneData=function(a){return this.movBoneDataDic[a]};ccs.AnimationData=function(){this.movementDataDic={};this.movementNames=[];this.name=""};ccs.AnimationData.prototype.addMovement=function(a){this.movementDataDic[a.name]=a;this.movementNames.push(a.name)};ccs.AnimationData.prototype.getMovement=function(a){return this.movementDataDic[a]};
ccs.AnimationData.prototype.getMovementCount=function(){return Object.keys(this.movementDataDic).length};ccs.ContourVertex2=function(a,b){this.x=a||0;this.y=b||0};ccs.ContourData=function(){this.vertexList=[]};ccs.ContourData.prototype.init=function(){this.vertexList.length=0;return!0};ccs.ContourData.prototype.addVertex=function(a){this.vertexList.push(a)};ccs.TextureData=function(){this.width=this.height=0;this.pivotY=this.pivotX=0.5;this.name="";this.contourDataList=[]};
ccs.TextureData.prototype.init=function(){this.contourDataList.length=0};ccs.TextureData.prototype.addContourData=function(a){this.contourDataList.push(a)};ccs.TextureData.prototype.getContourData=function(a){return this.contourDataList[a]};ccs.DecorativeDisplay=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){a._parent&&(a._parent.removeChild(a),delete a._parent);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(){this._colliderDetector=this._displayData=this._display=null}});ccs.DecorativeDisplay.create=function(){return new ccs.DecorativeDisplay};ccs.displayFactory={addDisplay:function(a,b,c){switch(c.displayType){case ccs.DISPLAY_TYPE_SPRITE:this.addSpriteDisplay(a,b,c);break;case ccs.DISPLAY_TYPE_PARTICLE:this.addParticleDisplay(a,b,c);break;case ccs.DISPLAY_TYPE_ARMATURE:this.addArmatureDisplay(a,b,c)}},createDisplay:function(a,b){switch(b.getDisplayData().displayType){case ccs.DISPLAY_TYPE_SPRITE:this.createSpriteDisplay(a,b);break;case ccs.DISPLAY_TYPE_PARTICLE:this.createParticleDisplay(a,b);break;case ccs.DISPLAY_TYPE_ARMATURE:this.createArmatureDisplay(a,
b)}},_helpTransform:{a:1,b:0,c:0,d:1,tx:0,ty:0},updateDisplay:function(a,b,c){var d=a.getDisplayRenderNode();if(d){switch(a.getDisplayRenderNodeType()){case ccs.DISPLAY_TYPE_SPRITE:c&&(d._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty),d.updateArmatureTransform());break;case ccs.DISPLAY_TYPE_PARTICLE:this.updateParticleDisplay(a,d,b);break;case ccs.DISPLAY_TYPE_ARMATURE:this.updateArmatureDisplay(a,d,b);break;default:b=a.getNodeToArmatureTransform(),d.setAdditionalTransform(b)}if((ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||
ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&c&&(d=a.getDisplayManager().getCurrentDecorativeDisplay(),c=d.getColliderDetector())){b=d.getDisplay();var e=b.getNodeToParentTransform(),d=this._helpTransform;d.a=e.a;d.b=e.b;d.c=e.c;d.d=e.d;d.tx=e.tx;d.ty=e.ty;b=cc.pointApplyAffineTransform(b.getAnchorPointInPoints(),d);d.tx=b.x;d.ty=b.y;a=cc.affineTransformConcat(d,a.getArmature().getNodeToParentTransform());c.updateTransform(a)}}},addSpriteDisplay:function(a,b,c){var d=new ccs.SpriteDisplayData;d.copy(c);
b.setDisplayData(d);this.createSpriteDisplay(a,b)},createSpriteDisplay:function(a,b){var c=null,d=b.getDisplayData(),c=d.displayName,e=c.lastIndexOf(".");-1!==e&&(c=c.substring(0,e));c=""===c?new ccs.Skin:new ccs.Skin("#"+c+".png");b.setDisplay(c);c.setBone(a);this.initSpriteDisplay(a,b,d.displayName,c);(e=a.getArmature())&&(e.getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED?c.setSkinData(d.skinData):c.setSkinData(a.boneData))},initSpriteDisplay:function(a,b,c,d){var e=c.lastIndexOf(".");
-1!==e&&(c=c.substring(0,e));(c=ccs.armatureDataManager.getTextureData(c))&&d.setAnchorPoint(cc.p(c.pivotX,c.pivotY));(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&c&&0<c.contourDataList.length&&(a=new ccs.ColliderDetector(a),a.addContourDataList(c.contourDataList),b.setColliderDetector(a))},addArmatureDisplay:function(a,b,c){var d=new ccs.ArmatureDisplayData;d.copy(c);b.setDisplayData(d);this.createArmatureDisplay(a,b)},createArmatureDisplay:function(a,b){var c=
b.getDisplayData(),c=new ccs.Armature(c.displayName,a);b.setDisplay(c)},updateArmatureDisplay:function(a,b,c){b&&(b.sortAllChildren(),b.update(c))},addParticleDisplay:function(a,b,c){var d=new ccs.ParticleDisplayData;d.copy(c);b.setDisplayData(d);this.createParticleDisplay(a,b)},createParticleDisplay:function(a,b){var c=b.getDisplayData(),c=new cc.ParticleSystem(c.displayName);c.removeFromParent();c.cleanup();a.getArmature()&&c.setParent(a.getArmature());b.setDisplay(c)},updateParticleDisplay:function(a,
b,c){var d=new ccs.BaseData;ccs.TransformHelp.matrixToNode(a.nodeToArmatureTransform(),d);b.setPosition(d.x,d.y);b.setScaleX(d.scaleX);b.setScaleY(d.scaleY);b.update(c)}};ccs.DisplayManager=ccs.Class.extend({_decoDisplayList:null,_currentDecoDisplay:null,_displayRenderNode:null,_displayIndex:null,_forceChangeDisplay:!1,_bone:null,_visible:!0,_displayType:null,ctor:function(a){this._decoDisplayList=[];this._displayIndex=this._displayRenderNode=this._currentDecoDisplay=null;this._forceChangeDisplay=!1;this._bone=null;this._visible=!0;this._displayType=ccs.DISPLAY_TYPE_MAX;a&&ccs.DisplayManager.prototype.init.call(this,a)},init:function(a){this._bone=a;this.initDisplayList(a.getBoneData());
return!0},addDisplay:function(a,b){var c,d=this._decoDisplayList;0<=b&&b<d.length?c=d[b]:(c=new ccs.DecorativeDisplay,d.push(c));if(a instanceof ccs.DisplayData)ccs.displayFactory.addDisplay(this._bone,c,a);else{var e=null;if(a instanceof ccs.Skin){a.setBone(this._bone);e=new ccs.SpriteDisplayData;ccs.displayFactory.initSpriteDisplay(this._bone,c,a.getDisplayName(),a);var f=c.getDisplayData();if(f instanceof ccs.SpriteDisplayData)a.setSkinData(f.skinData),e.skinData=f.skinData;else{for(var f=!1,h=
d.length-2;0<=h;h--){var k=d[h].getDisplayData();if(k instanceof ccs.SpriteDisplayData){f=!0;a.setSkinData(k.skinData);e.skinData=k.skinData;break}}f||a.setSkinData(new ccs.BaseData)}}else a instanceof cc.ParticleSystem?(e=new ccs.ParticleDisplayData,a.removeFromParent(),a._performRecursive(cc.Node._stateCallbackType.cleanup),(d=this._bone.getArmature())&&a.setParent(d)):a instanceof ccs.Armature?(e=new ccs.ArmatureDisplayData,e.displayName=a.getName(),a.setParentBone(this._bone)):e=new ccs.DisplayData;
c.setDisplay(a);c.setDisplayData(e)}b===this._displayIndex&&(this._displayIndex=-1,this.changeDisplayWithIndex(b,!1))},_addDisplayOther:function(a,b){var c=null;if(b instanceof ccs.Skin){b.setBone(this._bone);c=new ccs.SpriteDisplayData;c.displayName=b.getDisplayName();ccs.displayFactory.initSpriteDisplay(this._bone,a,b.getDisplayName(),b);var d=a.getDisplayData();if(d instanceof ccs.SpriteDisplayData)b.setSkinData(d.skinData);else{for(var d=!1,e=this._decoDisplayList.length-2;0<=e;e--){var f=this._decoDisplayList[e].getDisplayData();
if(f){d=!0;b.setSkinData(f.skinData);c.skinData=f.skinData;break}}d||b.setSkinData(new ccs.BaseData);b.setSkinData(new ccs.BaseData)}}else b instanceof cc.ParticleSystem?(c=new ccs.ParticleDisplayData,c.displayName=b._plistFile):b instanceof ccs.Armature?(c=new ccs.ArmatureDisplayData,c.displayName=b.getName(),b.setParentBone(this._bone)):c=new ccs.DisplayData;a.setDisplay(b);a.setDisplayData(c)},removeDisplay:function(a){this._decoDisplayList.splice(a,1);a===this._displayIndex&&(this.setCurrentDecorativeDisplay(null),
this._displayIndex=-1)},getDecorativeDisplayList:function(){return this._decoDisplayList},changeDisplayWithIndex:function(a,b){a>=this._decoDisplayList.length?cc.log("the index value is out of range"):(this._forceChangeDisplay=b,this._displayIndex!==a&&(this._displayIndex=a,0>a?this._displayRenderNode&&(this._displayRenderNode.removeFromParent(!0),this.setCurrentDecorativeDisplay(null)):this.setCurrentDecorativeDisplay(this._decoDisplayList[a])))},changeDisplayWithName:function(a,b){for(var c=this._decoDisplayList,
d=0;d<c.length;d++)if(c[d].getDisplayData().displayName===a){this.changeDisplayWithIndex(d,b);break}},setCurrentDecorativeDisplay:function(a){var b=this._currentDecoDisplay;(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&b&&b.getColliderDetector()&&b.getColliderDetector().setActive(!1);b=this._currentDecoDisplay=a;(ccs.ENABLE_PHYSICS_CHIPMUNK_DETECT||ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX)&&b&&b.getColliderDetector()&&b.getColliderDetector().setActive(!0);a=b?b.getDisplay():
null;var b=this._displayRenderNode,c=this._bone;b&&(b instanceof ccs.Armature&&c.setChildArmature(null),b.removeFromParent(!0));(this._displayRenderNode=a)?(a instanceof ccs.Armature?(this._bone.setChildArmature(a),a.setParentBone(this._bone)):a instanceof cc.ParticleSystem&&(a instanceof ccs.Armature?(c.setChildArmature(a),a.setParentBone(c)):a instanceof cc.ParticleSystem&&a.resetSystem()),a.setColor(c.getDisplayedColor()),a.setOpacity(c.getDisplayedOpacity()),this._displayRenderNode.setVisible(this._visible),
this._displayType=this._currentDecoDisplay.getDisplayData().displayType):this._displayType=ccs.DISPLAY_TYPE_MAX;cc.renderer.childrenOrderDirty=!0},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.length=
0;if(a){a=a.displayDataList;for(var b=this._decoDisplayList,c=this._bone,d=0;d<a.length;d++){var e=a[d],f=new ccs.DecorativeDisplay;f.setDisplayData(e);ccs.displayFactory.createDisplay(c,f);b.push(f)}}},containPoint:function(a,b){if(!this._visible||0>this._displayIndex)return!1;void 0!==b&&(a=cc.p(a,b));if(this._currentDecoDisplay.getDisplayData().displayType===ccs.DISPLAY_TYPE_SPRITE){var c=this._currentDecoDisplay.getDisplay(),c=c.getChildByTag(0);return ccs.SPRITE_CONTAIN_POINT_WITH_RETURN(c,a)}return!1},
setVisible:function(a){this._displayRenderNode&&(this._visible=a,this._displayRenderNode.setVisible(a))},isVisible:function(){return this._visible},getContentSize:function(){return this._displayRenderNode?this._displayRenderNode.getContentSize():cc.size(0,0)},getBoundingBox:function(){return this._displayRenderNode?this._displayRenderNode.getBoundingBox():cc.rect(0,0,0,0)},getAnchorPoint:function(){return this._displayRenderNode?this._displayRenderNode.getAnchorPoint():cc.p(0,0)},getAnchorPointInPoints:function(){return this._displayRenderNode?
this._displayRenderNode.getAnchorPointInPoints():cc.p(0,0)},getForceChangeDisplay:function(){return this._forceChangeDisplay},release:function(){this._decoDisplayList=null;this._displayRenderNode&&(this._displayRenderNode.removeFromParent(!0),this._displayRenderNode=null)}});ccs.DisplayManager.create=function(a){return new ccs.DisplayManager(a)};ccs.Skin=ccs.Sprite.extend({_skinData:null,bone:null,_skinTransform:null,_displayName:"",_armature:null,_className:"Skin",ctor:function(a,b){cc.Sprite.prototype.ctor.call(this);this.bone=this._skinData=null;this._displayName="";this._skinTransform=cc.affineTransformIdentity();this._armature=null;null==a||""===a?ccs.Skin.prototype.init.call(this):"#"===a[0]?ccs.Skin.prototype.initWithSpriteFrameName.call(this,a.substr(1)):ccs.Skin.prototype.initWithFile.call(this,a,b)},initWithSpriteFrameName:function(a){if(""===
a)return!1;var b=cc.spriteFrameCache.getSpriteFrame(a),c=!0;b?this.initWithSpriteFrame(b):(cc.log("Can't find CCSpriteFrame with %s. Please check your .plist file",a),c=!1);this._displayName=a;return c},initWithFile:function(a,b){var c=b?cc.Sprite.prototype.initWithFile.call(this,a,b):cc.Sprite.prototype.initWithFile.call(this,a);this._displayName=a;return c},setSkinData:function(a){this._skinData=a;this.setScaleX(a.scaleX);this.setScaleY(a.scaleY);this.setRotationX(cc.radiansToDegrees(a.skewX));
this.setRotationY(cc.radiansToDegrees(-a.skewY));this.setPosition(a.x,a.y);this._renderCmd.transform()},getSkinData:function(){return this._skinData},updateArmatureTransform:function(){this._renderCmd.transform()},getNodeToWorldTransform:function(){return this._renderCmd.getNodeToWorldTransform()},getNodeToWorldTransformAR:function(){return this._renderCmd.getNodeToWorldTransformAR()},setBone:function(a){this.bone=a;if(a=this.bone.getArmature())this._armature=a},getBone:function(){return this.bone},
getDisplayName:function(){return this._displayName},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccs.Skin.CanvasRenderCmd(this):new ccs.Skin.WebGLRenderCmd(this)}});_p=ccs.Skin.prototype;cc.defineGetterSetter(_p,"skinData",_p.getSkinData,_p.setSkinData);cc.defineGetterSetter(_p,"displayName",_p.getDisplayName);_p=null;ccs.Skin.create=function(a,b){return new ccs.Skin(a,b)};ccs.Skin.createWithSpriteFrameName=function(a){return new ccs.Skin("#"+a)};(function(){ccs.Skin.RenderCmd={_realWorldTM:null,transform:function(a,c){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._node,e=a?a._worldTransform:null,f=this._transform,h=this._worldTransform;if(this._dirtyFlag&cc.Node._dirtyFlags.transformDirty||e)this.originTransform(),cc.affineTransformConcatIn(this._transform,d.bone.getNodeToArmatureTransform()),this._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty;if(e){if(h.a=f.a*
e.a+f.b*e.c,h.b=f.a*e.b+f.b*e.d,h.c=f.c*e.a+f.d*e.c,h.d=f.c*e.b+f.d*e.d,h.tx=f.tx*e.a+f.ty*e.c+e.tx,h.ty=f.tx*e.b+f.ty*e.d+e.ty,e=this._vertices){var k=d._offsetPosition.x,m=k+d._rect.width,n=d._offsetPosition.y,d=n+d._rect.height;e[0].x=k*h.a+d*h.c+h.tx;e[0].y=k*h.b+d*h.d+h.ty;e[1].x=k*h.a+n*h.c+h.tx;e[1].y=k*h.b+n*h.d+h.ty;e[2].x=m*h.a+d*h.c+h.tx;e[2].y=m*h.b+d*h.d+h.ty;e[3].x=m*h.a+n*h.c+h.tx;e[3].y=m*h.b+n*h.d+h.ty}}else h.a=f.a,h.b=f.b,h.c=f.c,h.d=f.d,h.tx=f.tx,h.ty=f.ty;if(h=this._realWorldTM)h.a=
f.a,h.b=f.b,h.c=f.c,h.d=f.d,h.tx=f.tx,h.ty=f.ty,cc.affineTransformConcatIn(h,this._node.bone.getArmature()._renderCmd._worldTransform)},getNodeToWorldTransform:function(){return cc.affineTransformConcat(this._transform,this._node.bone.getArmature().getNodeToWorldTransform())},getNodeToWorldTransformAR:function(){var a=this._transform,c=this._node;this._anchorPointInPoints=cc.pointApplyAffineTransform(this._anchorPointInPoints,a);a.tx=this._anchorPointInPoints.x;a.ty=this._anchorPointInPoints.y;return cc.affineTransformConcat(a,
c.bone.getArmature().getNodeToWorldTransform())}};ccs.Skin.CanvasRenderCmd=function(a){this._spriteCmdCtor(a);this._realWorldTM={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a=ccs.Skin.CanvasRenderCmd.prototype=Object.create(cc.Sprite.CanvasRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.CanvasRenderCmd;a._updateCurrentRegions=function(){var a=this._currentRegion;this._currentRegion=this._oldRegion;this._oldRegion=a;cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble!==this._regionFlag||
this._currentRegion.isEmpty()||this._oldRegion.union(this._currentRegion);this._currentRegion.updateRegion(this.getLocalBB(),this._realWorldTM)};ccs.Skin.WebGLRenderCmd=function(a){this._spriteCmdCtor(a)};a=ccs.Skin.WebGLRenderCmd.prototype=Object.create(cc.Sprite.WebGLRenderCmd.prototype);cc.inject(ccs.Skin.RenderCmd,a);a.constructor=ccs.Skin.WebGLRenderCmd})();ccs.ANIMATION_TYPE_SINGLE_FRAME=-4;ccs.ANIMATION_TYPE_NO_LOOP=-3;ccs.ANIMATION_TYPE_TO_LOOP_FRONT=-2;ccs.ANIMATION_TYPE_TO_LOOP_BACK=-1;ccs.ANIMATION_TYPE_LOOP_FRONT=0;ccs.ANIMATION_TYPE_LOOP_BACK=1;ccs.ANIMATION_TYPE_MAX=2;
ccs.ProcessBase=ccs.Class.extend({_processScale:1,_isComplete:!0,_isPause:!0,_isPlaying:!1,_currentPercent:0,_rawDuration:0,_loopType:0,_tweenEasing:0,animationInternal:null,_currentFrame:0,_durationTween:0,_nextFrameIndex:0,_curFrameIndex:null,_isLoopBack:!1,ctor:function(){this._processScale=1;this._isPause=this._isComplete=!0;this._isPlaying=!1;this._rawDuration=this._durationTween=this._currentPercent=this._currentFrame=0;this._loopType=ccs.ANIMATION_TYPE_LOOP_BACK;this._tweenEasing=ccs.TweenType.LINEAR;
this.animationInternal=1/60;this._durationTween=this._curFrameIndex=0;this._isLoopBack=!1},pause:function(){this._isPause=!0;this._isPlaying=!1},resume:function(){this._isPause=!1;this._isPlaying=!0},stop:function(){this._isComplete=!0;this._isPlaying=!1},play:function(a,b,c,d){this._isPause=this._isComplete=!1;this._isPlaying=!0;this._currentFrame=0;this._nextFrameIndex=a;this._tweenEasing=d},update:function(a){if(!(this._isComplete||this._isPause||0>=this._rawDuration||1<a)){var b=void 0===this._nextFrameIndex?
0:this._nextFrameIndex,c=this._currentFrame;0>=b?(this._currentPercent=1,c=0):(c+=a/this.animationInternal*this._processScale,this._currentPercent=c/b,c=ccs.fmodf(c,b));this._currentFrame=c;this.updateHandler()}},gotoFrame:function(a){var b=this._loopType;b===ccs.ANIMATION_TYPE_NO_LOOP?b=ccs.ANIMATION_TYPE_MAX:b===ccs.ANIMATION_TYPE_TO_LOOP_FRONT&&(b=ccs.ANIMATION_TYPE_LOOP_FRONT);this._loopType=b;this._curFrameIndex=a;this._nextFrameIndex=this._durationTween},getCurrentFrameIndex:function(){return this._curFrameIndex=
(this._rawDuration-1)*this._currentPercent},updateHandler:function(){},isPause:function(){return this._isPause},isComplete:function(){return this._isComplete},getCurrentPercent:function(){return this._currentPercent},getRawDuration:function(){return this._rawDuration},getLoop:function(){return this._loopType},getTweenEasing:function(){return this._tweenEasing},getAnimationInternal:function(){return this.animationInternal},setAnimationInternal:function(a){this.animationInternal=a},getProcessScale:function(){return this._processScale},
setProcessScale:function(a){this._processScale=a},isPlaying:function(){return this._isPlaying}});_p=ccs.ProcessBase.prototype;cc.defineGetterSetter(_p,"currentFrameIndex",_p.getCurrentFrameIndex);cc.defineGetterSetter(_p,"paused",_p.isPause);cc.defineGetterSetter(_p,"completed",_p.isComplete);cc.defineGetterSetter(_p,"currentPercent",_p.getCurrentPercent);cc.defineGetterSetter(_p,"rawDuration",_p.getRawDuration);cc.defineGetterSetter(_p,"loop",_p.getLoop);cc.defineGetterSetter(_p,"tweenEasing",_p.getTweenEasing);
cc.defineGetterSetter(_p,"playing",_p.isPlaying);_p=null;ccs.MovementEventType={start:0,complete:1,loopComplete:2};ccs.AnimationEvent=ccs.Class.extend({_arguments:null,_callFunc:null,_selectorTarget:null,ctor:function(a,b,c){this._data=c;this._callFunc=a;this._selectorTarget=b},call:function(){this._callFunc&&this._callFunc.apply(this._selectorTarget,this._arguments)},setArguments:function(a){this._arguments=a}});ccs.MovementEvent=function(){this.armature=null;this.movementType=ccs.MovementEventType.start;this.movementID=""};
ccs.FrameEvent=function(){this.bone=null;this.frameEventName="";this.currentFrameIndex=this.originFrameIndex=0};
ccs.ArmatureAnimation=ccs.ProcessBase.extend({_animationData:null,_movementData:null,_armature:null,_movementID:"",_toIndex:0,_tweenList:null,_speedScale:1,_ignoreFrameEvent:!1,_frameEventQueue:null,_movementEventQueue:null,_movementList:null,_onMovementList:!1,_movementListLoop:!1,_movementIndex:0,_movementListDurationTo:-1,_movementEventCallFunc:null,_frameEventCallFunc:null,_movementEventTarget:null,_frameEventTarget:null,_movementEventListener:null,_frameEventListener:null,ctor:function(a){ccs.ProcessBase.prototype.ctor.call(this);
this._tweenList=[];this._movementList=[];this._frameEventQueue=[];this._movementEventQueue=[];this._armature=null;a&&ccs.ArmatureAnimation.prototype.init.call(this,a)},init:function(a){this._armature=a;this._tweenList.length=0;return!0},pause:function(){for(var a=this._tweenList,b=0;b<a.length;b++)a[b].pause();ccs.ProcessBase.prototype.pause.call(this)},resume:function(){for(var a=this._tweenList,b=0;b<a.length;b++)a[b].resume();ccs.ProcessBase.prototype.resume.call(this)},stop:function(){for(var a=
this._tweenList,b=0;b<a.length;b++)a[b].stop();a.length=0;ccs.ProcessBase.prototype.stop.call(this)},setAnimationScale:function(a){this.setSpeedScale(a)},getAnimationScale:function(){return this.getSpeedScale()},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 b in a){var c=a[b];c.getTween().setProcessScale(this._processScale);c.getChildArmature()&&
c.getChildArmature().getAnimation().setSpeedScale(this._processScale)}}},getSpeedScale:function(){return this._speedScale},play:function(a,b,c){cc.assert(this._animationData,"this.animationData can not be null");this._movementData=this._animationData.getMovement(a);cc.assert(this._movementData,"this._movementData can not be null");b=void 0===b?-1:b;c=void 0===c?-1:c;this._rawDuration=this._movementData.duration;this._movementID=a;this._processScale=this._speedScale*this._movementData.scale;b=-1===
b?this._movementData.durationTo:b;a=0===this._movementData.durationTween?this._rawDuration:this._movementData.durationTween;var d=this._movementData.tweenEasing;c=0>c?this._movementData.loop:c;this._onMovementList=!1;ccs.ProcessBase.prototype.play.call(this,b,a,c,d);0===this._rawDuration?this._loopType=ccs.ANIMATION_TYPE_SINGLE_FRAME:(this._loopType=c?ccs.ANIMATION_TYPE_TO_LOOP_FRONT:ccs.ANIMATION_TYPE_NO_LOOP,this._durationTween=a);this._tweenList.length=0;var e,f=this._armature.getBoneDic(),h;for(h in f){var k=
f[h];e=this._movementData.movBoneDataDic[k.getName()];var m=k.getTween();e&&0<e.frameList.length?(this._tweenList.push(m),e.duration=this._movementData.duration,m.play(e,b,a,c,d),m.setProcessScale(this._processScale),k.getChildArmature()&&(k.getChildArmature().getAnimation().setSpeedScale(this._processScale),k.getChildArmature().getAnimation().isPlaying()||k.getChildArmature().getAnimation().playWithIndex(0))):k.isIgnoreMovementBoneData()||(k.getDisplayManager().changeDisplayWithIndex(-1,!1),m.stop())}this._armature.update(0)},
playByIndex:function(a,b,c,d,e){cc.log("playByIndex is deprecated. Use playWithIndex instead.");this.playWithIndex(a,b,d)},playWithIndex:function(a,b,c){var d=this._animationData.movementNames;cc.assert(-1<a&&a<d.length);this.play(d[a],b,c)},playWithNames:function(a,b,c){this._movementListLoop=void 0===c?!0:c;this._movementListDurationTo=void 0===b?-1:b;this._onMovementList=!0;this._movementIndex=0;a instanceof Array?this._movementList=a:this._movementList.length=0;this.updateMovementList()},playWithIndexes:function(a,
b,c){this._movementList.length=0;this._movementListLoop=void 0===c?!0:c;this._movementListDurationTo=void 0===b?-1:b;this._onMovementList=!0;this._movementIndex=0;b=this._animationData.movementNames;for(c=0;c<a.length;c++)this._movementList.push(b[a[c]]);this.updateMovementList()},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 b=this._ignoreFrameEvent;this._isPlaying=
this._ignoreFrameEvent=!0;this._isComplete=this._isPause=!1;ccs.ProcessBase.prototype.gotoFrame.call(this,a);this._currentPercent=this._curFrameIndex/(this._movementData.duration-1);this._currentFrame=this._nextFrameIndex*this._currentPercent;for(var c=this._tweenList,d=0;d<c.length;d++)c[d].gotoAndPlay(a);this._armature.update(0);this._ignoreFrameEvent=b}},gotoAndPause:function(a){this.gotoAndPlay(a);this.pause()},getMovementCount:function(){return this._animationData.getMovementCount()},update:function(a){ccs.ProcessBase.prototype.update.call(this,
a);for(var b=this._tweenList,c=0;c<b.length;c++)b[c].update(a);for(b=this._frameEventQueue;0<b.length;)a=b.shift(),this._ignoreFrameEvent=!0,this._frameEventCallFunc&&this._frameEventCallFunc.call(this._frameEventTarget,a.bone,a.frameEventName,a.originFrameIndex,a.currentFrameIndex),this._frameEventListener&&this._frameEventListener(a.bone,a.frameEventName,a.originFrameIndex,a.currentFrameIndex),this._ignoreFrameEvent=!1;for(b=this._movementEventQueue;0<b.length;)a=b.shift(),this._movementEventCallFunc&&
this._movementEventCallFunc.call(this._movementEventTarget,a.armature,a.movementType,a.movementID),this._movementEventListener&&this._movementEventListener(a.armature,a.movementType,a.movementID)},updateHandler:function(){var a=this._currentPercent;if(1<=a){switch(this._loopType){case ccs.ANIMATION_TYPE_NO_LOOP:this._loopType=ccs.ANIMATION_TYPE_MAX;this._currentFrame=(a-1)*this._nextFrameIndex;a=this._currentFrame/this._durationTween;if(1>a){this._nextFrameIndex=this._durationTween;this.movementEvent(this._armature,
ccs.MovementEventType.start,this._movementID);break}break;case ccs.ANIMATION_TYPE_MAX:case ccs.ANIMATION_TYPE_SINGLE_FRAME:a=1;this._isComplete=!0;this._isPlaying=!1;this.movementEvent(this._armature,ccs.MovementEventType.complete,this._movementID);this.updateMovementList();break;case ccs.ANIMATION_TYPE_TO_LOOP_FRONT:this._loopType=ccs.ANIMATION_TYPE_LOOP_FRONT;a=ccs.fmodf(a,1);this._currentFrame=0===this._nextFrameIndex?0:ccs.fmodf(this._currentFrame,this._nextFrameIndex);this._nextFrameIndex=0<
this._durationTween?this._durationTween:1;this.movementEvent(this,ccs.MovementEventType.start,this._movementID);break;default:this._currentFrame=ccs.fmodf(this._currentFrame,this._nextFrameIndex),this._toIndex=0,this.movementEvent(this._armature,ccs.MovementEventType.loopComplete,this._movementID)}this._currentPercent=a}},getCurrentMovementID:function(){return this._isComplete?"":this._movementID},setMovementEventCallFunc:function(a,b){1===arguments.length?this._movementEventListener=a:2===arguments.length&&
(this._movementEventTarget=b,this._movementEventCallFunc=a)},setFrameEventCallFunc:function(a,b){1===arguments.length?this._frameEventListener=a:2===arguments.length&&(this._frameEventTarget=b,this._frameEventCallFunc=a)},setUserObject:function(a){this._userObject=a},frameEvent:function(a,b,c,d){if(this._frameEventTarget&&this._frameEventCallFunc||this._frameEventListener){var e=new ccs.FrameEvent;e.bone=a;e.frameEventName=b;e.originFrameIndex=c;e.currentFrameIndex=d;this._frameEventQueue.push(e)}},
movementEvent:function(a,b,c){if(this._movementEventTarget&&this._movementEventCallFunc||this._movementEventListener){var d=new ccs.MovementEvent;d.armature=a;d.movementType=b;d.movementID=c;this._movementEventQueue.push(d)}},updateMovementList:function(){if(this._onMovementList){var a,b=this._movementList;this._movementListLoop?(a=b[this._movementIndex],this.play(a,a.durationTo,0),this._movementIndex++,this._movementIndex>=b.length&&(this._movementIndex=0)):this._movementIndex<b.length?(a=b[this._movementIndex],
this.play(a,a.durationTo,0),this._movementIndex++):this._onMovementList=!1;this._onMovementList=!0}},setAnimationData:function(a){this._animationData!==a&&(this._animationData=a)},getAnimationData:function(){return this._animationData},getUserObject:function(){return this._userObject},isIgnoreFrameEvent:function(){return this._ignoreFrameEvent}});_p=ccs.ArmatureAnimation.prototype;cc.defineGetterSetter(_p,"speedScale",_p.getSpeedScale,_p.setSpeedScale);
cc.defineGetterSetter(_p,"animationScale",_p.getAnimationScale,_p.setAnimationScale);_p=null;ccs.ArmatureAnimation.create=function(a){return new ccs.ArmatureAnimation(a)};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(a){ccs.ProcessBase.prototype.ctor.call(this);this._frameTweenEasing=ccs.TweenType.LINEAR;ccs.Tween.prototype.init.call(this,a)},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;this._animation=null!==this._bone&&null!==this._bone.getArmature()?this._bone.getArmature().getAnimation():null;return!0},play:function(a,b,c,d,e){ccs.ProcessBase.prototype.play.call(this,b,c,d,e);this._loopType=d?ccs.ANIMATION_TYPE_TO_LOOP_FRONT:ccs.ANIMATION_TYPE_NO_LOOP;this._fromIndex=this._toIndex=this._betweenDuration=this._totalDuration=0;e=a!==this._movementBoneData;this.setMovementBoneData(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?(this._loopType=ccs.ANIMATION_TYPE_SINGLE_FRAME,0===b?this.setBetween(a,a):this.setBetween(this._tweenData,a),this._frameTweenEasing=ccs.TweenType.LINEAR):1<this._movementBoneData.frameList.length&&(this._durationTween=c*this._movementBoneData.scale,
d&&0!==this._movementBoneData.delay?this.setBetween(this._tweenData,this.tweenNodeTo(this.updateFrameData(1-this._movementBoneData.delay),this._between)):e&&0!==b?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=null==this._currentPercent?1:this._currentPercent,b=this._loopType;if(1<=a)switch(b){case ccs.ANIMATION_TYPE_SINGLE_FRAME:a=1;this._isComplete=!0;this._isPlaying=!1;break;case ccs.ANIMATION_TYPE_NO_LOOP:b=ccs.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 ccs.ANIMATION_TYPE_TO_LOOP_FRONT:b=ccs.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 ccs.ANIMATION_TYPE_MAX:a=1;this._isComplete=!0;this._isPlaying=!1;break;default:this._currentFrame=ccs.fmodf(this._currentFrame,this._nextFrameIndex)}1>a&&b<ccs.ANIMATION_TYPE_TO_LOOP_BACK&&(a=Math.sin(a*cc.PI/2));this._currentPercent=a;this._loopType=b;b>ccs.ANIMATION_TYPE_TO_LOOP_BACK&&(a=this.updateFrameData(a));this._frameTweenEasing!==ccs.TweenType.TWEEN_EASING_MAX&&this.tweenNodeTo(a)},setBetween:function(a,b,c){void 0===c&&(c=!0);0>a.displayIndex&&
0<=b.displayIndex?(this._from.copy(b),this._between.subtract(b,b,c)):0>b.displayIndex&&0<=a.displayIndex?(this._from.copy(a),this._between.subtract(b,b,c)):(this._from.copy(a),this._between.subtract(a,b,c));a.isTween||(this._tweenData.copy(a),this._tweenData.isTween=!0);this.arriveKeyFrame(a)},arriveKeyFrame:function(a){if(a){var b=this._bone,c=b.getDisplayManager(),d=a.displayIndex;c.getForceChangeDisplay()||c.changeDisplayWithIndex(d,!1);this._tweenData.zOrder=a.zOrder;b.updateZOrder();this._bone.setBlendFunc(a.blendFunc);
(b=b.getChildArmature())&&""!==a.movement&&b.getAnimation().play(a.movement)}},tweenNodeTo:function(a,b){b||(b=this._tweenData);var c=this._from,d=this._between;c.isTween||(a=0);b.x=c.x+a*d.x;b.y=c.y+a*d.y;b.scaleX=c.scaleX+a*d.scaleX;b.scaleY=c.scaleY+a*d.scaleY;b.skewX=c.skewX+a*d.skewX;b.skewY=c.skewY+a*d.skewY;this._bone.setTransformDirty(!0);b&&d.isUseColorInfo&&this.tweenColorTo(a,b);return b},tweenColorTo:function(a,b){var c=this._from,d=this._between;b.a=c.a+a*d.a;b.r=c.r+a*d.r;b.g=c.g+a*
d.g;b.b=c.b+a*d.b;this._bone.updateColor()},updateFrameData:function(a){1<a&&0!==this._movementBoneData.delay&&(a=ccs.fmodf(a,1));a*=this._rawDuration-1;var b,c,d=this._totalDuration,e=this._betweenDuration,f=this._toIndex;if(a<d||a>=d+e){var e=this._movementBoneData.frameList,h=e.length;if(a<e[0].frameID)return b=c=e[0],this.setBetween(b,c),this._currentPercent;if(a>=e[h-1].frameID){if(this._passLastFrame)return b=c=e[h-1],this.setBetween(b,c),this._currentPercent;this._passLastFrame=!0}else this._passLastFrame=
!1;do if(this._fromIndex=f,b=e[this._fromIndex],d=b.frameID,f=this._fromIndex+1,f>=h&&(f=0),c=e[f],b.strEvent&&!this._animation.isIgnoreFrameEvent()&&this._animation.frameEvent(this._bone,b.strEvent,b.frameID,a),a===b.frameID||this._passLastFrame&&this._fromIndex===h-1)break;while(a<b.frameID||a>=c.frameID);e=c.frameID-b.frameID;this._frameTweenEasing=b.tweenEasing;this.setBetween(b,c,!1);this._totalDuration=d;this._betweenDuration=e;this._toIndex=f}a=0===e?0:(a-this._totalDuration)/this._betweenDuration;
b=this._frameTweenEasing!==ccs.TweenType.LINEAR?this._frameTweenEasing:this._tweenEasing;b===ccs.TweenType.TWEEN_EASING_MAX||b===ccs.TweenType.LINEAR||this._passLastFrame||(a=ccs.TweenFunction.tweenTo(a,b,this._from.easingParams));return a},setAnimation:function(a){this._animation=a},getAnimation:function(){return this._animation},setMovementBoneData:function(a){this._movementBoneData=a}});_p=ccs.Tween.prototype;cc.defineGetterSetter(_p,"animation",_p.getAnimation,_p.setAnimation);_p=null;
ccs.Tween.create=function(a){return new ccs.Tween(a)};ccs.PT_RATIO=32;ccs.ColliderFilter=ccs.Class.extend({_collisionType:0,_group:0,_categoryBits:0,_groupIndex:0,_maskBits:0,ctor:function(a,b){this._collisionType=a||0;this._group=b||0},updateShape:function(a){if(a instanceof cp.Shape)a.collision_type=this._collisionType,a.group=this._group;else if(a instanceof Box2D.b2FilterData){var b=new Box2D.b2FilterData;b.categoryBits=this._categoryBits;b.groupIndex=this._groupIndex;b.maskBits=this._maskBits;a.SetFilterData(b)}}});
ccs.ColliderBody=ccs.Class.extend({shape:null,coutourData:null,colliderFilter:null,_calculatedVertexList:null,ctor:function(a){this.shape=null;this.coutourData=a;this.colliderFilter=new ccs.ColliderFilter;ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX&&(this._calculatedVertexList=[])},getContourData:function(){return this.coutourData},setColliderFilter:function(a){this.colliderFilter=a},getCalculatedVertexList:function(){return this._calculatedVertexList},setB2Fixture:function(a){this._fixture=a},getB2Fixture:function(){return this._fixture},
setShape:function(a){this.shape=a},getShape:function(){return this.shape},setContourData:function(a){this.coutourData=a},getColliderFilter:function(){return this.colliderFilter}});
ccs.ColliderDetector=ccs.Class.extend({_colliderBodyList:null,_bone:null,_body:null,_active:!1,_filter:null,helpPoint:cc.p(0,0),ctor:function(a){this._colliderBodyList=[];this._body=this._bone=null;this._active=!1;this._filter=null;ccs.ColliderDetector.prototype.init.call(this,a)},init:function(a){this._colliderBodyList.length=0;a&&(this._bone=a);this._filter=new ccs.ColliderFilter;return!0},addContourData:function(a){var b=new ccs.ColliderBody(a);this._colliderBodyList.push(b);if(ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX){b=
b.getCalculatedVertexList();a=a.vertexList;for(var c=0;c<a.length;c++){var d=new ccs.ContourVertex2(0,0);b.push(d)}}},addContourDataList:function(a){for(var b=0;b<a.length;b++)this.addContourData(a[b])},removeContourData:function(a){var b=[],c,d=this._colliderBodyList;for(c=0;c<d.length;c++){var e=d[c];e&&e.getContourData()===a&&b.push(e)}for(c=0;c<b.length;c++)cc.arrayRemoveObject(d,b[c])},removeAll:function(){this._colliderBodyList.length=0},setActive:function(a){if(this._active!==a){this._active=
a;a=this._body;var b;if(a)if(b=null,this._active)for(var c=0;c<this._colliderBodyList.length;c++)b=this._colliderBodyList[c],b=b.getShape(),a.space.addShape(b);else for(c=0;c<this._colliderBodyList.length;c++)b=this._colliderBodyList[c],b=b.getShape(),a.space.removeShape(b)}},getActive:function(){return this._active},getColliderBodyList:function(){return this._colliderBodyList},setColliderFilter:function(a){this._filter=a;for(var b=this._colliderBodyList,c=0;c<b.length;c++){var d=b[c];d.setColliderFilter(a);
d.getShape()&&d.getColliderFilter().updateShape(d.getShape())}},getColliderFilter:function(){return this._filter},updateTransform:function(a){if(this._active)for(var b=null,c=this._body,d=this.helpPoint,e=0;e<this._colliderBodyList.length;e++){var b=this._colliderBodyList[e],f=b.getContourData(),h=null;c&&(h=b.getShape());for(var f=f.vertexList,k=b.getCalculatedVertexList(),b=0;b<f.length;b++){d.x=f[b].x;d.y=f[b].y;d=cc.pointApplyAffineTransform(d,a);if(ccs.ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX){var m=
cc.p(0,0);m.x=d.x;m.y=d.y;k[b]=m}h&&(h.verts[2*b]=d.x,h.verts[2*b+1]=d.y)}if(h)for(b=0;b<f.length;b++)k=cp.v.normalize(cp.v.perp(cp.v.sub(h.verts[(b+1)%h.verts.length],h.verts[b]))),h.planes&&(h.planes[b].n=k,h.planes[b].d=cp.v.dot(k,h.verts[b]))}},setBody:function(a){this._body=a;for(var b=this._colliderBodyList,c=0;c<b.length;c++){a=b[c];for(var d=[],e=a.getContourData().vertexList,f=0;f<e.length;f++){var h=e[f];d.push(h.x);d.push(h.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)}},getBody:function(){return this._body}});_p=ccs.ColliderDetector.prototype;cc.defineGetterSetter(_p,"colliderFilter",_p.getColliderFilter,_p.setColliderFilter);cc.defineGetterSetter(_p,"active",_p.getActive,_p.setActive);cc.defineGetterSetter(_p,"body",_p.getBody,_p.setBody);_p=null;ccs.ColliderDetector.create=function(a){return new ccs.ColliderDetector(a)};ccs.Armature=ccs.Node.extend({animation:null,armatureData:null,batchNode:null,_parentBone:null,_boneDic:null,_topBoneList:null,_armatureIndexDic:null,_offsetPoint:null,version:0,_armatureTransformDirty:!0,_body:null,_blendFunc:null,_className:"Armature",ctor:function(a,b){cc.Node.prototype.ctor.call(this);this._name="";this._topBoneList=[];this._armatureIndexDic={};this._offsetPoint=cc.p(0,0);this._armatureTransformDirty=!0;this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};a&&ccs.Armature.prototype.init.call(this,
a,b);this._texture={}},init:function(a,b){b&&(this._parentBone=b);this.removeAllChildren();this.animation=new ccs.ArmatureAnimation;this.animation.init(this);this._boneDic={};this._topBoneList.length=0;var c=ccs.armatureDataManager,d;if(""!==a){d=c.getAnimationData(a);cc.assert(d,"AnimationData not exist!");this.animation.setAnimationData(d);c=c.getArmatureData(a);cc.assert(c,"ArmatureData not exist!");this.armatureData=c;var c=c.getBoneDataDic(),e;for(e in c){var c=this.createBone(String(e)),f=d.getMovement(d.movementNames[0]);
f&&(f=f.getMovementBoneData(c.getName()))&&!(0>=f.frameList.length)&&(f=f.getFrameData(0))&&(c.getTweenData().copy(f),c.changeDisplayWithIndex(f.displayIndex,!1))}this.update(0);this.updateOffsetPoint()}else a="new_armature",this.armatureData=new ccs.ArmatureData,this.armatureData.name=a,d=new ccs.AnimationData,d.name=a,c.addArmatureData(a,this.armatureData),c.addAnimationData(a,d),this.animation.setAnimationData(d);this._renderCmd.initShaderCache();this.setCascadeOpacityEnabled(!0);this.setCascadeColorEnabled(!0);
return!0},visit:function(a){var b=this._renderCmd;a=a?a._renderCmd:null;this._visible?(b.visit(a),b._dirtyFlag=0):b._propagateFlagsDown(a)},addChild:function(a,b,c){a instanceof ccui.Widget?cc.log("Armature doesn't support to add Widget as its child, it will be fix soon."):cc.Node.prototype.addChild.call(this,a,b,c)},createBone:function(a){var b=this.getBone(a);if(b)return b;var b=this.armatureData.getBoneData(a),c=b.parentName,d=null;c?(this.createBone(c),d=new ccs.Bone(a),this.addBone(d,c)):(d=
new ccs.Bone(a),this.addBone(d,""));d.setBoneData(b);d.getDisplayManager().changeDisplayWithIndex(-1,!1);return d},addBone:function(a,b){cc.assert(a,"Argument must be non-nil");var c=this._boneDic;a.getName()&&cc.assert(!c[a.getName()],"bone already added. It can't be added again");if(b){var d=c[b];d?d.addChildBone(a):this._topBoneList.push(a)}else this._topBoneList.push(a);a.setArmature(this);c[a.getName()]=a;this.addChild(a)},removeBone:function(a,b){cc.assert(a,"bone must be added to the bone dictionary!");
a.setArmature(null);a.removeFromParent(b);cc.arrayRemoveObject(this._topBoneList,a);delete this._boneDic[a.getName()];this.removeChild(a,!0)},getBone:function(a){return this._boneDic[a]},changeBoneParent:function(a,b){cc.assert(a,"bone must be added to the bone dictionary!");var c=a.getParentBone();c&&(cc.arrayRemoveObject(c.getChildren(),a),a.setParentBone(null));b&&((c=this._boneDic[b])?(c.addChildBone(a),cc.arrayRemoveObject(this._topBoneList,a)):this._topBoneList.push(a))},getBoneDic:function(){return this._boneDic},
updateOffsetPoint:function(){var a=this.getBoundingBox();this.setContentSize(a);var b=this._offsetPoint;b.x=-a.x;b.y=-a.y;0!==a.width&&0!==a.height&&this.setAnchorPoint(b.x/a.width,b.y/a.height)},getOffsetPoints:function(){return{x:this._offsetPoint.x,y:this._offsetPoint.y}},setAnimation:function(a){this.animation=a},getAnimation:function(){return this.animation},getArmatureTransformDirty:function(){return this._armatureTransformDirty},update:function(a){this.animation.update(a);for(var b=this._topBoneList,
c=0;c<b.length;c++)b[c].update(a);this._armatureTransformDirty=!1},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.scheduleUpdate()},onExit:function(){cc.Node.prototype.onExit.call(this);this.unscheduleUpdate()},getBoundingBox:function(){for(var a,b,c,d=0,e=!0,f=cc.rect(0,0,0,0),h=this._children,k=h.length,m=0;m<k;m++)if(a=h[m])if(d=a.getDisplayManager().getBoundingBox(),0!==d.x||0!==d.y||0!==d.width||0!==d.height)e?(a=d.x,b=d.y,c=d.x+d.width,d=d.y+d.height,e=!1):(a=d.x<f.x?d.x:f.x,b=
d.y<f.y?d.y:f.y,c=d.x+d.width>f.x+f.width?d.x+d.width:f.x+f.width,d=d.y+d.height>f.y+f.height?d.y+d.height:f.y+f.height),f.x=a,f.y=b,f.width=c-a,f.height=d-b;return cc.rectApplyAffineTransform(f,this.getNodeToParentTransform())},getBoneAtPoint:function(a,b){for(var c=this._children,d=c.length-1;0<=d;d--){var e=c[d];if(e instanceof ccs.Bone&&e.getDisplayManager().containPoint(a,b))return e}return null},setParentBone:function(a){this._parentBone=a;a=this._boneDic;for(var b in a)a[b].setArmature(this)},
getParentBone:function(){return this._parentBone},drawContour:function(){cc._drawingUtil.setDrawColor(255,255,255,255);cc._drawingUtil.setLineWidth(1);var a=this._boneDic,b;for(b in a){var c=a[b].getColliderDetector();if(c)for(var c=c.getColliderBodyList(),d=0;d<c.length;d++){var e=c[d].getCalculatedVertexList();cc._drawingUtil.drawPoly(e,e.length,!0)}}},setBody:function(a){if(this._body!==a){this._body=a;this._body.data=this;var b,c;a=this._children;for(var d=0;d<a.length;d++)if(b=a[d],b instanceof
ccs.Bone){b=b.getDisplayManager().getDecorativeDisplayList();for(var e=0;e<b.length;e++)c=b[e],(c=c.getColliderDetector())&&c.setBody(this._body)}}},getShapeList:function(){return this._body?this._body.shapeList:null},getBody:function(){return this._body},setBlendFunc:function(a,b){void 0===b?(this._blendFunc.src=a.src,this._blendFunc.dst=a.dst):(this._blendFunc.src=a,this._blendFunc.dst=b)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},setColliderFilter:function(a){var b=
this._boneDic,c;for(c in b)b[c].setColliderFilter(a)},getArmatureData:function(){return this.armatureData},setArmatureData:function(a){this.armatureData=a},getBatchNode:function(){return this.batchNode},setBatchNode:function(a){this.batchNode=a},getVersion:function(){return this.version},setVersion:function(a){this.version=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccs.Armature.CanvasRenderCmd(this):new ccs.Armature.WebGLRenderCmd(this)}});_p=ccs.Armature.prototype;
cc.defineGetterSetter(_p,"parentBone",_p.getParentBone,_p.setParentBone);cc.defineGetterSetter(_p,"body",_p.getBody,_p.setBody);cc.defineGetterSetter(_p,"colliderFilter",null,_p.setColliderFilter);_p=null;ccs.Armature.create=function(a,b){return new ccs.Armature(a,b)};(function(){ccs.Armature.RenderCmd={_updateAnchorPointInPoint:function(){var a=this._node,b=a._contentSize,c=a._anchorPoint,a=a._offsetPoint;this._anchorPointInPoints.x=b.width*c.x-a.x;this._anchorPointInPoints.y=b.height*c.y-a.y;this._realAnchorPointInPoints.x=b.width*c.x;this._realAnchorPointInPoints.y=b.height*c.y;this.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getAnchorPointInPoints:function(){return cc.p(this._realAnchorPointInPoints)}}})();
(function(){ccs.Armature.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._realAnchorPointInPoints=new cc.Point(0,0);this._canUseDirtyRegion=!0;this._startRenderCmd=new cc.CustomRenderCmd(this,this._startCmdCallback);this._RestoreRenderCmd=new cc.CustomRenderCmd(this,this._RestoreCmdCallback);this._startRenderCmd._canUseDirtyRegion=!0;this._RestoreRenderCmd._canUseDirtyRegion=!0;this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0};this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a=
ccs.Armature.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.inject(ccs.Armature.RenderCmd,a);a.constructor=ccs.Armature.CanvasRenderCmd;a._startCmdCallback=function(a,c,d){var e=this._node._parent;this.transform(e?e._renderCmd:null);a=a||cc._renderContext;a.save();a._switchToArmatureMode(!0,this._worldTransform,c,d)};a.transform=function(a,c){this.originTransform(a,c);for(var d=this._node._children,e=0,f=d.length;e<f;e++){var h=d[e],k=h._renderCmd;if(h&&h.getDisplayRenderNode){var m=
h.getDisplayRenderNodeType(),n=h.getDisplayRenderNode();if(n&&n._renderCmd){n=n._renderCmd;n.transform(null);m!==ccs.DISPLAY_TYPE_ARMATURE&&m!==ccs.DISPLAY_TYPE_SPRITE&&cc.affineTransformConcatIn(n._worldTransform,h._worldTransform);var m=cc.Node._dirtyFlags,p=n._dirtyFlag,r=k._dirtyFlag,s=r&m.colorDirty,r=r&m.opacityDirty;s&&k._updateDisplayColor(this._displayedColor);r&&k._updateDisplayOpacity(this._displayedOpacity);(s||r)&&k._updateColor();k=h._renderCmd._displayedColor;h=h._renderCmd._displayedOpacity;
s=p&m.colorDirty;r=p&m.opacityDirty;s&&n._updateDisplayColor(k);r&&n._updateDisplayOpacity(h);(s||r)&&n._updateColor()}}}};a._RestoreCmdCallback=function(a){this._cacheDirty=!1;a._switchToArmatureMode(!1);a.restore()};a.initShaderCache=function(){};a.setShaderProgram=function(){};a.updateChildPosition=function(a,c){a.visit()};a.rendering=function(a,c,d){for(var e=this._node._children,f=0,h=e.length;f<h;f++){var k=e[f];if(k&&k.getDisplayRenderNode){var m=k.getDisplayRenderNode();if(null!==m)switch(k._renderCmd._syncStatus(this),
k.getDisplayRenderNodeType()){case ccs.DISPLAY_TYPE_SPRITE:m.visit(k);break;case ccs.DISPLAY_TYPE_ARMATURE:m._renderCmd.rendering(a,c,d);break;default:m.visit(k)}}else k instanceof cc.Node&&this._visitNormalChild(k)}};a._visitNormalChild=function(a){if(a){var c=a._renderCmd;if(a._visible){c._curLevel=this._curLevel+1;var d,e=a._children,f;c._syncStatus(this);c.transform(null);var h=e.length;if(0<h){a.sortAllChildren();for(d=0;d<h;d++)if(f=e[d],0>f._localZOrder)f.visit(a);else break;for(cc.renderer.pushRenderCommand(c);d<
h;d++)e[d].visit(a)}else cc.renderer.pushRenderCommand(c);this._dirtyFlag=0}}};a.visit=function(a){var c=this._node;c._visible&&(this._syncStatus(a),c.sortAllChildren(),cc.renderer.pushRenderCommand(this._startRenderCmd),this.rendering(),cc.renderer.pushRenderCommand(this._RestoreRenderCmd),this._cacheDirty=!1)}})();(function(){ccs.Armature.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._parentCmd=null;this._realAnchorPointInPoints=new cc.Point(0,0);this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0};this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0}};var a=ccs.Armature.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(ccs.Armature.RenderCmd,a);a.constructor=ccs.Armature.WebGLRenderCmd;a.uploadData=function(a,c,d){a=this._node;d=this._parentCmd||this;for(var e=a._children,
f=cc.BlendFunc.ALPHA_PREMULTIPLIED,h=cc.BlendFunc.ALPHA_NON_PREMULTIPLIED,k=0,m=e.length;k<m;k++){var n=e[k],p=n._renderCmd;if(n&&n.getDisplayRenderNode){var r=n.getDisplayRenderNode();if(null!==r)switch(c=r._renderCmd,n.getDisplayRenderNodeType()){case ccs.DISPLAY_TYPE_SPRITE:r instanceof ccs.Skin&&(r.setShaderProgram(this._shaderProgram),this._updateColorAndOpacity(c,n),c.transform(d),p=n.getBlendFunc(),p.src!==f.src||p.dst!==f.dst?r.setBlendFunc(n.getBlendFunc()):(n=r.getTexture(),a._blendFunc.src===
f.src&&a._blendFunc.dst===f.dst&&n&&!n.hasPremultipliedAlpha()?r.setBlendFunc(h):r.setBlendFunc(a._blendFunc)),cc.renderer._uploadBufferData(c));break;case ccs.DISPLAY_TYPE_ARMATURE:r.setShaderProgram(this._shaderProgram),this._updateColorAndOpacity(c,n),c._parentCmd=this;default:p._syncStatus(d),c._syncStatus(p),c.uploadData?cc.renderer._uploadBufferData(c):c.rendering&&(cc.renderer._batchRendering(),c.rendering(cc._renderContext))}}else n instanceof cc.Node&&(n.setShaderProgram(this._shaderProgram),
p._syncStatus(d),p.uploadData?cc.renderer._uploadBufferData(p):p.rendering&&(cc.renderer._batchRendering(),p.rendering(cc._renderContext)))}this._parentCmd=null;return 0};a.initShaderCache=function(){this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};a.setShaderProgram=function(a){this._glProgramState=cc.GLProgramState.getOrCreateWithGLProgram(a)};a._updateColorAndOpacity=function(a,c){var d=c._renderCmd._displayedColor,e=c._renderCmd._displayedOpacity,f=cc.Node._dirtyFlags,
h=a._dirtyFlag,k=h&f.colorDirty,f=h&f.opacityDirty;k&&a._updateDisplayColor(d);f&&a._updateDisplayOpacity(e);(k||f)&&a._updateColor()};a.visit=function(a){var c=this._node;if(c._visible){if(a=a||this.getParentRenderCmd())this._curLevel=a._curLevel+1;this._syncStatus(a);c.sortAllChildren();a=cc.renderer;var d=c._children,e,f=d.length;isNaN(c._customZ)&&(c._vertexZ=a.assignedZ,a.assignedZ+=a.assignedZStep);for(e=0;e<f;e++)if(c=d[e],0>c._localZOrder)isNaN(c._customZ)&&(c._vertexZ=a.assignedZ,a.assignedZ+=
a.assignedZStep);else break;for(a.pushRenderCommand(this);e<f;e++)c=d[e],isNaN(c._customZ)&&(c._vertexZ=a.assignedZ,a.assignedZ+=a.assignedZStep);this._dirtyFlag=0}}})();ccs.Bone=ccs.Node.extend({_boneData:null,_armature:null,_childArmature:null,_displayManager:null,ignoreMovementBoneData:!1,_tween:null,_tweenData:null,_parentBone:null,_boneTransformDirty:!1,_worldTransform:null,_blendFunc:null,blendDirty:!1,_worldInfo:null,_armatureParentBone:null,_dataVersion:0,_className:"Bone",ctor:function(a){cc.Node.prototype.ctor.call(this);this._displayManager=this._tween=this._boneData=this._childArmature=this._armature=this._parentBone=this._tweenData=null;this.ignoreMovementBoneData=
!1;this._worldTransform=cc.affineTransformMake(1,0,0,1,0,0);this._boneTransformDirty=!0;this._blendFunc=new cc.BlendFunc(cc.BLEND_SRC,cc.BLEND_DST);this.blendDirty=!1;this._armatureParentBone=this._worldInfo=null;this._dataVersion=0;ccs.Bone.prototype.init.call(this,a)},init:function(a){a&&(this._name=a);this._tweenData=new ccs.FrameData;this._tween=new ccs.Tween(this);this._displayManager=new ccs.DisplayManager(this);this._worldInfo=new ccs.BaseData;this._boneData=new ccs.BaseData;return!0},setBoneData:function(a){cc.assert(a,
"_boneData must not be null");this._boneData!==a&&(this._boneData=a);this.setName(this._boneData.name);this._localZOrder=this._boneData.zOrder;this._displayManager.initDisplayList(a)},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){this._parentBone&&(this._boneTransformDirty=this._boneTransformDirty||this._parentBone.isTransformDirty());this._armatureParentBone&&!this._boneTransformDirty&&(this._boneTransformDirty=this._armatureParentBone.isTransformDirty());if(this._boneTransformDirty){var b=this._tweenData;this._dataVersion>=ccs.CONST_VERSION_COMBINED&&(ccs.TransformHelp.nodeConcat(b,this._boneData),b.scaleX-=1,b.scaleY-=1);var c=this._worldInfo;c.copy(b);c.x=b.x+this._position.x;c.y=b.y+this._position.y;
c.scaleX=b.scaleX*this._scaleX;c.scaleY=b.scaleY*this._scaleY;c.skewX=b.skewX+this._skewX+cc.degreesToRadians(this._rotationX);c.skewY=b.skewY+this._skewY-cc.degreesToRadians(this._rotationY);this._parentBone?this._applyParentTransform(this._parentBone):this._armatureParentBone&&this._applyParentTransform(this._armatureParentBone);ccs.TransformHelp.nodeToMatrix(c,this._worldTransform);this._armatureParentBone&&cc.affineTransformConcatIn(this._worldTransform,this._armature.getNodeToParentTransform())}ccs.displayFactory.updateDisplay(this,
a,this._boneTransformDirty||this._armature.getArmatureTransformDirty());for(b=0;b<this._children.length;b++)this._children[b].update(a);this._boneTransformDirty=!1},_applyParentTransform:function(a){var b=this._worldInfo,c=a._worldTransform;a=a._worldInfo;var d=b.x,e=b.y;b.x=d*c.a+e*c.c+a.x;b.y=d*c.b+e*c.d+a.y;b.scaleX*=a.scaleX;b.scaleY*=a.scaleY;b.skewX+=a.skewX;b.skewY+=a.skewY},setBlendFunc:function(a,b){var c=this._blendFunc,d,e;void 0===b?(d=a.src,e=a.dst):(d=a,e=b);if(c.src!==d||c.dst!==e)c.src=
d,c.dst=e,this.blendDirty=!0},updateColor:function(){var a=this._displayManager.getDisplayRenderNode();if(null!==a){var b=this._renderCmd;a.setColor(cc.color(b._displayedColor.r*this._tweenData.r/255,b._displayedColor.g*this._tweenData.g/255,b._displayedColor.b*this._tweenData.b/255));a.setOpacity(b._displayedOpacity*this._tweenData.a/255)}},updateZOrder:function(){this._armature.getArmatureData().dataVersion>=ccs.CONST_VERSION_COMBINED?this.setLocalZOrder(this._tweenData.zOrder+this._boneData.zOrder):
this.setLocalZOrder(this._tweenData.zOrder)},addChildBone:function(a){cc.assert(a,"Argument must be non-nil");cc.assert(!a.parentBone,"child already added. It can't be added again");0>this._children.indexOf(a)&&(this._children.push(a),a.setParentBone(this))},removeChildBone:function(a,b){if(0<this._children.length&&-1!==this._children.getIndex(a)){if(b)for(var c=a._children,d=0;d<c.length;d++)a.removeChildBone(c[d],b);a.setParentBone(null);a.getDisplayManager().setCurrentDecorativeDisplay(null);cc.arrayRemoveObject(this._children,
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},getTween:function(){return this._tween},setLocalZOrder:function(a){this._localZOrder!==a&&cc.Node.prototype.setLocalZOrder.call(this,
a)},getNodeToArmatureTransform:function(){return this._worldTransform},getNodeToWorldTransform:function(){return cc.affineTransformConcat(this._worldTransform,this._armature.getNodeToWorldTransform())},getDisplayRenderNode:function(){return this._displayManager.getDisplayRenderNode()},getDisplayRenderNodeType:function(){return this._displayManager.getDisplayRenderNodeType()},addDisplay:function(a,b){return this._displayManager.addDisplay(a,b||0)},removeDisplay:function(a){this._displayManager.removeDisplay(a)},
changeDisplayByIndex:function(a,b){cc.log("changeDisplayByIndex is deprecated. Use changeDisplayWithIndex instead.");this.changeDisplayWithIndex(a,b)},changeDisplayByName:function(a,b){cc.log("changeDisplayByName is deprecated. Use changeDisplayWithName instead.");this.changeDisplayWithName(a,b)},changeDisplayWithIndex:function(a,b){this._displayManager.changeDisplayWithIndex(a,b)},changeDisplayWithName:function(a,b){this._displayManager.changeDisplayWithName(a,b)},getColliderDetector:function(){var a=
this._displayManager.getCurrentDecorativeDisplay();return a&&(a=a.getColliderDetector())?a:null},setColliderFilter:function(a){for(var b=this._displayManager.getDecorativeDisplayList(),c=0;c<b.length;c++){var d=b[c].getColliderDetector();d&&d.setColliderFilter(a)}},getColliderFilter:function(){var a=this.displayManager.getCurrentDecorativeDisplay();return a&&(a=a.getColliderDetector())?a.getColliderFilter():null},setTransformDirty:function(a){this._boneTransformDirty=a},isTransformDirty:function(){return this._boneTransformDirty},
getDisplayManager:function(){return this._displayManager},setIgnoreMovementBoneData:function(a){this._ignoreMovementBoneData=a},isIgnoreMovementBoneData:function(){return this._ignoreMovementBoneData},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src,this._blendFunc.dst)},setBlendDirty:function(a){this._blendDirty=a},isBlendDirty:function(){return this._blendDirty},getTweenData:function(){return this._tweenData},getWorldInfo:function(){return this._worldInfo},getChildrenBone:function(){return this._children},
nodeToArmatureTransform:function(){return this.getNodeToArmatureTransform()},nodeToWorldTransform:function(){return this.getNodeToWorldTransform()},getColliderBodyList:function(){var a=this.getColliderDetector();return a?a.getColliderBodyList():null},getIgnoreMovementBoneData:function(){return this.isIgnoreMovementBoneData()},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccs.Bone.CanvasRenderCmd(this):new ccs.Bone.WebGLRenderCmd(this)}});_p=ccs.Bone.prototype;
cc.defineGetterSetter(_p,"boneData",_p.getBoneData,_p.setBoneData);cc.defineGetterSetter(_p,"armature",_p.getArmature,_p.setArmature);cc.defineGetterSetter(_p,"childArmature",_p.getChildArmature,_p.setChildArmature);cc.defineGetterSetter(_p,"childrenBone",_p.getChildrenBone);cc.defineGetterSetter(_p,"tween",_p.getTween);cc.defineGetterSetter(_p,"tweenData",_p.getTweenData);cc.defineGetterSetter(_p,"colliderFilter",_p.getColliderFilter,_p.setColliderFilter);_p=null;ccs.Bone.create=function(a){return new ccs.Bone(a)};
ccs.Bone.RenderCmd={_updateColor:function(){var a=this._node,b=a._displayManager.getDisplayRenderNode();if(null!==b){var c=b._renderCmd;b.setColor(this._displayedColor);b.setOpacity(this._displayedOpacity);c._syncDisplayColor(a._tweenData);c._syncDisplayOpacity(a._tweenData.a);c._updateColor()}},transform:function(a,b){this._transform||(this._transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var c=this._node,d=this._transform,e=this._worldTransform,f=a?a._worldTransform:
null;f&&(this.originTransform(),cc.affineTransformConcatIn(d,c._worldTransform));f?(e.a=d.a*f.a+d.b*f.c,e.b=d.a*f.b+d.b*f.d,e.c=d.c*f.a+d.d*f.c,e.d=d.c*f.b+d.d*f.d,e.tx=d.tx*f.a+d.ty*f.c+f.tx,e.ty=d.tx*f.b+d.ty*f.d+f.ty):(e.a=d.a,e.b=d.b,e.c=d.c,e.d=d.d,e.tx=d.tx,e.ty=d.ty)}};(function(){ccs.Bone.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=ccs.Bone.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);cc.inject(ccs.Bone.RenderCmd,a);a.constructor=ccs.Bone.CanvasRenderCmd})();
(function(){if(cc.Node.WebGLRenderCmd){ccs.Bone.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!1};var a=ccs.Bone.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);cc.inject(ccs.Bone.RenderCmd,a);a.constructor=ccs.Bone.WebGLRenderCmd}})();ccs.FRAME_TYPE_MOVE=0;ccs.FRAME_TYPE_SCALE=1;ccs.FRAME_TYPE_ROTATE=2;ccs.FRAME_TYPE_TINT=3;ccs.FRAME_TYPE_FADE=4;ccs.FRAME_TYPE_MAX=5;
ccs.FrameEaseType={CUSTOM:-1,LINEAR:0,SINE_EASEIN:1,SINE_EASEOUT:2,SINE_EASEINOUT:3,QUAD_EASEIN:4,QUAD_EASEOUT:5,QUAD_EASEINOUT:6,CUBIC_EASEIN:7,CUBIC_EASEOUT:8,CUBIC_EASEINOUT:9,QUART_EASEIN:10,QUART_EASEOUT:11,QUART_EASEINOUT:12,QUINT_EASEIN:13,QUINT_EASEOUT:14,QUINT_EASEINOUT:15,EXPO_EASEIN:16,EXPO_EASEOUT:17,EXPO_EASEINOUT:18,CIRC_EASEIN:19,CIRC_EASEOUT:20,CIRC_EASEINOUT:21,ELASTIC_EASEIN:22,ELASTIC_EASEOUT:23,ELASTIC_EASEINOUT:24,BACK_EASEIN:25,BACK_EASEOUT:26,BACK_EASEINOUT:27,BOUNCE_EASEIN:28,
BOUNCE_EASEOUT:29,BOUNCE_EASEINOUT:30,TWEEN_EASING_MAX:1E3};
ccs.ActionFrame=ccs.Class.extend({frameType:0,easingType:0,frameIndex:0,_Parameter:null,time:0,ctor:function(){this.frameType=0;this.easingType=ccs.FrameEaseType.LINEAR;this.time=this.frameIndex=0},getAction:function(a,b){cc.log("Need a definition of \x3cgetAction\x3e for ActionFrame");return null},_getEasingAction:function(a){if(null===a)return console.error("Action cannot be null!"),null;var b;switch(this.easingType){case ccs.FrameEaseType.LINEAR:b=a;break;case ccs.FrameEaseType.SINE_EASEIN:b=a.easing(cc.easeSineIn());
break;case ccs.FrameEaseType.SINE_EASEOUT:b=a.easing(cc.easeSineOut());break;case ccs.FrameEaseType.SINE_EASEINOUT:b=a.easing(cc.easeSineInOut());break;case ccs.FrameEaseType.QUAD_EASEIN:b=a.easing(cc.easeQuadraticActionIn());break;case ccs.FrameEaseType.QUAD_EASEOUT:b=a.easing(cc.easeQuadraticActionOut());break;case ccs.FrameEaseType.QUAD_EASEINOUT:b=a.easing(cc.easeQuadraticActionInOut());break;case ccs.FrameEaseType.CUBIC_EASEIN:b=a.easing(cc.easeCubicActionIn());break;case ccs.FrameEaseType.CUBIC_EASEOUT:b=
a.easing(cc.easeCubicActionOut());break;case ccs.FrameEaseType.CUBIC_EASEINOUT:b=a.easing(cc.easeCubicActionInOut());break;case ccs.FrameEaseType.QUART_EASEIN:b=a.easing(cc.easeQuarticActionIn());break;case ccs.FrameEaseType.QUART_EASEOUT:b=a.easing(cc.easeQuarticActionOut());break;case ccs.FrameEaseType.QUART_EASEINOUT:b=a.easing(cc.easeQuarticActionInOut());break;case ccs.FrameEaseType.QUINT_EASEIN:b=a.easing(cc.easeQuinticActionIn());break;case ccs.FrameEaseType.QUINT_EASEOUT:b=a.easing(cc.easeQuinticActionOut());
break;case ccs.FrameEaseType.QUINT_EASEINOUT:b=a.easing(cc.easeQuinticActionInOut());break;case ccs.FrameEaseType.EXPO_EASEIN:b=a.easing(cc.easeExponentialIn());break;case ccs.FrameEaseType.EXPO_EASEOUT:b=a.easing(cc.easeExponentialOut());break;case ccs.FrameEaseType.EXPO_EASEINOUT:b=a.easing(cc.easeExponentialInOut());break;case ccs.FrameEaseType.CIRC_EASEIN:b=a.easing(cc.easeCircleActionIn());break;case ccs.FrameEaseType.CIRC_EASEOUT:b=a.easing(cc.easeCircleActionOut());break;case ccs.FrameEaseType.CIRC_EASEINOUT:b=
a.easing(cc.easeCircleActionInOut());break;case ccs.FrameEaseType.ELASTIC_EASEIN:b=a.easing(cc.easeElasticIn());break;case ccs.FrameEaseType.ELASTIC_EASEOUT:b=a.easing(cc.easeElasticOut());break;case ccs.FrameEaseType.ELASTIC_EASEINOUT:b=a.easing(cc.easeElasticInOut());break;case ccs.FrameEaseType.BACK_EASEIN:b=a.easing(cc.easeBackIn());break;case ccs.FrameEaseType.BACK_EASEOUT:b=a.easing(cc.easeBackOut());break;case ccs.FrameEaseType.BACK_EASEINOUT:b=a.easing(cc.easeBackInOut());break;case ccs.FrameEaseType.BOUNCE_EASEIN:b=
a.easing(cc.easeBounceIn());break;case ccs.FrameEaseType.BOUNCE_EASEOUT:b=a.easing(cc.easeBounceOut());break;case ccs.FrameEaseType.BOUNCE_EASEINOUT:b=a.easing(cc.easeBounceInOut())}return b},setEasingParameter:function(a){this._Parameter=[];for(var b=0;b<a.length;b++)this._Parameter.push(a[b])},setEasingType:function(a){this.easingType=a}});
ccs.ActionMoveFrame=ccs.ActionFrame.extend({_position:null,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._position=cc.p(0,0);this.frameType=ccs.FRAME_TYPE_MOVE},setPosition:function(a,b){void 0===b?(this._position.x=a.x,this._position.y=a.y):(this._position.x=a,this._position.y=b)},getPosition:function(){return this._position},getAction:function(a){return this._getEasingAction(cc.moveTo(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.FRAME_TYPE_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 this._getEasingAction(cc.scaleTo(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.FRAME_TYPE_ROTATE},setRotation:function(a){this._rotation=a},getRotation:function(){return this._rotation},getAction:function(a,b){return void 0===b?this._getEasingAction(cc.rotateTo(a,this._rotation)):b instanceof cc.ActionRotationFrame?this._getEasingAction(cc.rotateBy(a,this._rotation-b._rotation)):this.getAction(a)}});
ccs.ActionFadeFrame=ccs.ActionFrame.extend({_opacity:255,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._opacity=255;this.frameType=ccs.FRAME_TYPE_FADE},setOpacity:function(a){this._opacity=a},getOpacity:function(){return this._opacity},getAction:function(a){return this._getEasingAction(cc.fadeTo(a,this._opacity))}});
ccs.ActionTintFrame=ccs.ActionFrame.extend({_color:null,ctor:function(){ccs.ActionFrame.prototype.ctor.call(this);this._color=cc.color(255,255,255,255);this.frameType=ccs.FRAME_TYPE_TINT},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},getAction:function(a){return this._getEasingAction(cc.tintTo(a,this._color.r,this._color.g,this._color.b))}});ccs.actionManager={_actionDic:{},initWithDictionary:function(a,b,c){var d=a.lastIndexOf("/");a=a.substr(d+1,a.length);b=b.actionlist;for(var d=[],e=0;e<b.length;e++){var f=new ccs.ActionObject;f.initWithDictionary(b[e],c);d.push(f)}this._actionDic[a]=d},getActionByName:function(a,b){var c=a.lastIndexOf("/"),c=a.substr(c+1,a.length),c=this._actionDic[c];if(!c)return null;for(var d=0;d<c.length;d++){var e=c[d];if(b===e.getName())return e}return null},playActionByName:function(a,b,c){(a=this.getActionByName(a,
b))&&a.play(c)},stopActionByName:function(a,b){var c=this.getActionByName(a,b);c&&c.stop()},releaseActions:function(){this._actionDic={}},clear:function(){this._actionDic={}}};ccs.ActionNode=ccs.Class.extend({_currentFrameIndex:0,_destFrameIndex:0,_unitTime:0,_actionTag:0,_object: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._object=null;this._frameArray=[];this._frameArrayNum=ccs.FRAME_TYPE_MAX;for(var a=0;a<this._frameArrayNum;a++)this._frameArray.push([])},initWithDictionary:function(a,b){this.setActionTag(a.ActionTag);
for(var c=a.actionframelist,d=ccui.helper.seekActionWidgetByActionTag(b,a.ActionTag),e=d instanceof ccui.Widget&&!(d instanceof ccui.Layout),f=0;f<c.length;f++){var h=c[f],k=h.frameid,m=h.tweenType;null==m&&(m=0);for(var n=h.tweenParameter,p=[],r=0;r<n;r++)p.push(h.tweenParameter[r]);if(void 0!==h.positionx){var r=h.positionx,s=h.positiony;e&&d.parent&&(n=d.parent.getAnchorPointInPoints(),r+=n.x,s+=n.y);n=new ccs.ActionMoveFrame;n.frameIndex=k;n.setEasingType(m);n.setEasingParameter(p);n.setPosition(r,
s);r=this._frameArray[ccs.FRAME_TYPE_MOVE];r.push(n)}void 0!==h.scalex&&(r=h.scalex,s=h.scaley,n=new ccs.ActionScaleFrame,n.frameIndex=k,n.setEasingType(m),n.setEasingParameter(p),n.setScaleX(r),n.setScaleY(s),r=this._frameArray[ccs.FRAME_TYPE_SCALE],r.push(n));void 0!==h.rotation&&(r=h.rotation,n=new ccs.ActionRotationFrame,n.frameIndex=k,n.setEasingType(m),n.setEasingParameter(p),n.setRotation(r),r=this._frameArray[ccs.FRAME_TYPE_ROTATE],r.push(n));void 0!==h.opacity&&(r=h.opacity,n=new ccs.ActionFadeFrame,
n.frameIndex=k,n.setEasingType(m),n.setEasingParameter(p),n.setOpacity(r),r=this._frameArray[ccs.FRAME_TYPE_FADE],r.push(n));void 0!==h.colorr&&(r=h.colorr,s=h.colorg,h=h.colorb,n=new ccs.ActionTintFrame,n.frameIndex=k,n.setEasingType(m),n.setEasingParameter(p),n.setColor(cc.color(r,s,h)),r=this._frameArray[ccs.FRAME_TYPE_TINT],r.push(n))}this._initActionNodeFromRoot(b)},_initActionNodeFromRoot:function(a){a instanceof ccui.Widget&&(a=ccui.helper.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:null},insertFrame:function(a,b){null!=b&&this._frameArray[b.frameType].splice(a,0,b)},addFrame:function(a){a&&this._frameArray[a.frameType].push(a)},
deleteFrame:function(a){void 0!==a&&cc.arrayRemoveObject(this._frameArray[a.frameType],a)},clearAllFrame:function(){for(var a=0;a<this._frameArrayNum;a++)this._frameArray[a].length=0},_refreshActionProperty:function(){if(!this._object)return null;for(var a=[],b=0;b<this._frameArrayNum;b++){var c=this._frameArray[b];if(!(0>=c.length)){for(var d=[],e=0;e<c.length;e++){var f=c[e],h=null;0!==e?(h=(f.frameIndex-c[e-1].frameIndex)*this.getUnitTime(),h=f.getAction(h)):h=f.getAction(0);h&&d.push(h)}d&&(c=
cc.sequence(d),null!==c&&a.push(c))}}this._action=null;return this._actionSpawn=cc.spawn(a)},playAction:function(a){this._object&&this._actionSpawn&&(this._action=a?cc.sequence(this._actionSpawn,a):cc.sequence(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,b=!1,c=this._frameArray,d=0,e=this._frameArrayNum;d<e;d++){var f=c[d];0>=f.length||(b=!0,f=f[0].frameIndex,a=a>f?f:a)}b||(a=0);return a},getLastFrameIndex:function(){for(var a=-1,b=!1,c=this._frameArray,d=0,e=this._frameArrayNum;d<e;d++){var f=c[d];0>=f.length||(b=!0,f=f[f.length-1].frameIndex,a=a<f?f:a)}b||(a=0);return a},updateActionToTimeLine:function(a){for(var b=!1,c=this.getUnitTime(),d=0;d<this._frameArrayNum;d++){var e=this._frameArray[d];if(e)for(var f=0;f<e.length;f++){var h=e[f];
if(h.frameIndex*c===a){this._easingToFrame(1,1,h);b=!0;break}else if(h.frameIndex*c>a){0===f?(this._easingToFrame(1,1,h),b=!1):(b=e[f-1],e=(h.frameIndex-b.frameIndex)*c,f=a-b.frameIndex*c,this._easingToFrame(e,1,b),this._easingToFrame(e,f/e,h),b=!0);break}}}return b},_easingToFrame:function(a,b,c){a=c.getAction(a);c=this.getActionNode();null!=a&&null!=c&&(a.startWithTarget(c),a.update(b))},isActionDoneOnce:function(){return this._action?this._action.isDone():!0}});ccs.ActionObject=ccs.Class.extend({_actionNodeList:null,_name:"",_loop:!1,_pause:!1,_playing:!1,_unitTime:0,_currentTime:0,_scheduler:null,_callback:null,_fTotalTime:0,ctor:function(){this._actionNodeList=[];this._name="";this._playing=this._pause=this._loop=!1;this._unitTime=0.1;this._fTotalTime=this._currentTime=0;this._scheduler=cc.director.getScheduler()},setName:function(a){this._name=a},getName:function(){return this._name},setLoop:function(a){this._loop=a},getLoop:function(){return this._loop},
setUnitTime:function(a){this._unitTime=a;a=this._actionNodeList.length;for(var b=0;b<a;b++)this._actionNodeList[b].setUnitTime(this._unitTime)},getUnitTime:function(){return this._unitTime},getCurrentTime:function(){return this._currentTime},setCurrentTime:function(a){this._currentTime=a},getTotalTime:function(){return this._fTotalTime},isPlaying:function(){return this._playing},initWithDictionary:function(a,b){this.setName(a.name);this.setLoop(a.loop);this.setUnitTime(a.unittime);for(var c=a.actionnodelist,
d=0,e=0;e<c.length;e++){var f=new ccs.ActionNode;f.initWithDictionary(c[e],b);f.setUnitTime(this.getUnitTime());this._actionNodeList.push(f);f=f.getLastFrameIndex()-f.getFirstFrameIndex();f>d&&(d=f)}this._fTotalTime=d*this._unitTime},addActionNode:function(a){a&&(this._actionNodeList.push(a),a.setUnitTime(this._unitTime))},removeActionNode:function(a){null!=a&&cc.arrayRemoveObject(this._actionNodeList,a)},play:function(a){this.stop();this.updateToFrameByTime(0);for(var b=this._actionNodeList,c=b.length,
d=0;d<c;d++)b[d].playAction(a);this._loop&&this._scheduler.schedule(this.simulationActionUpdate,this,0,cc.REPEAT_FOREVER,0,!1,this.__instanceId+"");void 0!==a&&(this._callback=a)},pause:function(){this._pause=!0;this._playing=!1},stop:function(){for(var a=this._actionNodeList,b=0;b<a.length;b++)a[b].stopAction();this._scheduler.unschedule(this.simulationActionUpdate,this);this._playing=this._pause=!1},updateToFrameByTime:function(a){this._currentTime=a;for(var b=0;b<this._actionNodeList.length;b++)this._actionNodeList[b].updateActionToTimeLine(a)},
simulationActionUpdate:function(a){a=!0;for(var b=this._actionNodeList,c=0,d=b.length;c<d;c++)if(!b[c].isActionDoneOnce()){a=!1;break}a&&(null!==this._callback&&this._callback.execute(),this._loop?this.play():(this._playing=!1,this._scheduler.unschedule(this.simulationActionUpdate,this)))}});ccs.ComAttribute=ccs.Component.extend({_jsonDict:null,_filePath:"",ctor:function(){cc.Component.prototype.ctor.call(this);this._jsonDict={};this._filePath="";this._name="CCComAttribute";ccs.ComAttribute.prototype.init.call(this)},init:function(){this._jsonDict={};return!0},setInt:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setDouble:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setFloat:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},
setBool:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setString:function(a,b){a?this._jsonDict[a]=b:cc.log("Argument must be non-nil")},setObject:function(a,b){a?this._jsonDict[a]=b: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)},getString:function(a){return this._jsonDict[a]||
""},getObject:function(a){return this._jsonDict[a]},parse:function(a){this._jsonDict=cc.loader.getRes(a)}});ccs.ComAttribute.create=function(){return new ccs.ComAttribute};ccs.ComAudio=ccs.Component.extend({_filePath:"",_loop:!1,ctor:function(){cc.Component.prototype.ctor.call(this);this._name="Audio";ccs.ComAudio.prototype.init.call(this)},init:function(){return!0},onExit:function(){this.stopBackgroundMusic(!0);this.stopAllEffects()},end:function(){cc.audioEngine.end()},preloadBackgroundMusic:function(a){cc.loader.load(a)},playBackgroundMusic:function(a,b){a?cc.audioEngine.playMusic(a,b):cc.audioEngine.playMusic(this._filePath,this._loop)},stopBackgroundMusic:function(a){cc.audioEngine.stopMusic(a)},
pauseBackgroundMusic:function(){cc.audioEngine.pauseMusic()},resumeBackgroundMusic:function(){cc.audioEngine.resumeMusic()},rewindBackgroundMusic:function(){cc.audioEngine.rewindMusic()},willPlayBackgroundMusic:function(){return cc.audioEngine.willPlayMusic()},isBackgroundMusicPlaying:function(){return cc.audioEngine.isMusicPlaying()},getBackgroundMusicVolume:function(){return cc.audioEngine.getMusicVolume()},setBackgroundMusicVolume:function(a){cc.audioEngine.setMusicVolume(a)},getEffectsVolume:function(){return cc.audioEngine.getEffectsVolume()},
setEffectsVolume:function(a){cc.audioEngine.setEffectsVolume(a)},playEffect:function(a,b){return a?cc.audioEngine.playEffect(a,b):cc.audioEngine.playEffect(this._filePath,this._loop)},pauseEffect:function(a){cc.audioEngine.pauseEffect(a)},pauseAllEffects:function(){cc.audioEngine.pauseAllEffects()},resumeEffect:function(a){cc.audioEngine.resumeEffect(a)},resumeAllEffects:function(){cc.audioEngine.resumeAllEffects()},stopEffect:function(a){cc.audioEngine.stopEffect(a)},stopAllEffects:function(){cc.audioEngine.stopAllEffects()},
preloadEffect:function(a){cc.loader.getRes(a);this.setFile(a);this.setLoop(!1)},unloadEffect:function(a){cc.audioEngine.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(){return new ccs.ComAudio};ccs.ComController=ccs.Component.extend({ctor:function(){cc.Component.prototype.ctor.call(this);this._name="ComController";ccs.ComController.prototype.init.call(this)},onEnter:function(){null!==this._owner&&this._owner.scheduleUpdate()},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a}});ccs.ComController.create=function(){return new ccs.ComController};ccs.ComRender=ccs.Component.extend({_render:null,ctor:function(a,b){cc.Component.prototype.ctor.call(this);this._render=a;this._name=b;this.isRenderer=!0;ccs.ComRender.prototype.init.call(this)},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,b){return new ccs.ComRender(a,b)};ccs.objectFactory={_typeMap:{},createObject:function(a){var b=null;(a=this._typeMap[a])&&(b=cc.isFunction(a._fun)?new a._fun:a._fun);return b},registerType:function(a){this._typeMap[a._className]=a},createGUI:function(a){var b=null;"Panel"===a?a="Layout":"TextArea"===a?a="Label":"TextButton"===a&&(a="Button");(a=this._typeMap[a])&&a._fun&&(b=a._fun);return b},removeAll:function(){this._typeMap={}}};
ccs.TInfo=ccs.Class.extend({_className:"",_fun:null,ctor:function(a,b){b?(this._className=a,this._fun=b):(this._className=a._className,this._fun=a._fun);ccs.objectFactory.registerType(this)}});ccs.sendEvent=function(a){a=ccs.triggerManager.get(a);if(null!=a)for(var b=0;b<a.length;b++){var c=a[b];null!=c&&c.detect()&&c.done()}};ccs.registerTriggerClass=function(a,b){new ccs.TInfo(a,b)};ccs.triggerManager={_eventTriggers:{},_triggerObjs:{},_movementDispatches:[],parse:function(a){for(var b=0;b<a.length;++b){var c=a[b],d=new ccs.TriggerObj;d.serialize(c);for(var c=d.getEvents(),e=0;e<c.length;e++)this.add(c[e],d);this._triggerObjs[d.getId()]=d}},get:function(a){return this._eventTriggers[a]},getTriggerObj:function(a){return this._triggerObjs[a]},add:function(a,b){var c=this._eventTriggers[a];c||(c=[]);-1===c.indexOf(b)&&(c.push(b),this._eventTriggers[a]=c)},removeAll:function(){for(var a in this._eventTriggers)for(var b=
this._eventTriggers[a],c=0;c<b.length;c++)b[c].removeAll();this._eventTriggers={}},remove:function(a,b){if(b)return this._removeObj(a,b);var c=!1,d=this._eventTriggers[a];if(d){for(c=0;c<d.length;c++){var e=d[c];e&&e.removeAll()}delete this._eventTriggers[a];c=!0}return c},_removeObj:function(a,b){var c=!1;do{var d=this._eventTriggers[a];if(d){for(c=0;c<d.length;c++){var e=d[c];if(e&&e==b){e.removeAll();d.splice(c,1);break}}c=!0}}while(0);return c},removeTriggerObj:function(a){a=this.getTriggerObj(a);
if(!a)return!1;for(var b=a.getEvents(),c=0;c<b.length;c++)this.remove(b[c],a);return!0},isEmpty:function(){return!this._eventTriggers||0>=this._eventTriggers.length},addArmatureMovementCallBack:function(a,b,c){if(null!=a&&null!=c&&null!=b){for(var d,e=!1,f=0;f<this._movementDispatches.length;f++)(d=this._movementDispatches[f])&&d[0]===a&&(d.addAnimationEventCallBack(b,c),e=!0);e||(d=new ccs.ArmatureMovementDispatcher,a.getAnimation().setMovementEventCallFunc(d.animationEvent,d),d.addAnimationEventCallBack(b,
c),this._movementDispatches.push([a,d]))}},removeArmatureMovementCallBack:function(a,b,c){if(null!=a&&null!=b&&null!=c)for(var d,e=0;e<this._movementDispatches.length;e++)(d=this._movementDispatches[e])&&d[0]===a&&d.removeAnimationEventCallBack(c,b)},removeArmatureAllMovementCallBack:function(a){if(null!=a)for(var b,c=0;c<this._movementDispatches.length;c++)if((b=this._movementDispatches[c])&&b[0]===a){this._movementDispatches.splice(c,1);break}},removeAllArmatureMovementCallBack:function(){this._movementDispatches.length=
0},version:function(){return"1.2.0.0"}};
ccs.ArmatureMovementDispatcher=ccs.Class.extend({_mapEventAnimation:null,ctor:function(){this._mapEventAnimation=[]},animationEvent:function(a,b,c){for(var d,e,f=0;f<this._mapEventAnimation.length;f++)d=this._mapEventAnimation[f],e=d[0],(d=d[1])&&d.call(e,a,b,c)},addAnimationEventCallBack:function(a,b){this._mapEventAnimation.push([b,a])},removeAnimationEventCallBack:function(a,b){for(var c,d=0;d<this._mapEventAnimation.length;d++)c=this._mapEventAnimation[d],c[0]===b&&this._mapEventAnimation.splice(d,
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;ccs.TriggerObj.prototype.init.call(this)},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,b=null,c=0;c<this._cons.length;c++)(b=this._cons[c])&&b.detect&&(a=a&&b.detect());return a},done:function(){if(this._enable&&0!==this._acts.length)for(var a,b=0;b<this._acts.length;b++)(a=
this._acts[b])&&a.done&&a.done()},removeAll:function(){for(var a=null,b=0;b<this._cons.length;b++)(a=this._cons[b])&&a.removeAll();this._cons=[];for(b=0;b<this._acts.length;b++)(a=this._acts[b])&&a.removeAll();this._acts=[]},serialize:function(a){this._id=a.id||0;for(var b=a.conditions||[],c=0;c<b.length;c++){var d=b[c],e=d.classname,f=ccs.objectFactory.createObject(e);f?(f.serialize(d),f.init(),this._cons.push(f)):cc.log("class named classname("+e+") can not implement!")}b=a.actions||[];for(c=0;c<
b.length;c++)d=b[c],e=d.classname,(f=ccs.objectFactory.createObject(e))?(f.serialize(d),f.init(),this._acts.push(f)):cc.log("class named classname("+e+") can not implement!");a=a.events||[];for(c=0;c<a.length;c++)d=a[c],d=d.id,0>d||this._vInt.push(d)},getId:function(){return this._id},setEnable:function(a){this._enable=a},getEvents:function(){return this._vInt}});ccs.TriggerObj.create=function(){return new ccs.TriggerObj};ccs.ActionTimelineData=ccs.Class.extend({_actionTag:0,ctor:function(a){this._init(a)},_init:function(a){this._actionTag=a;return!0},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag}});ccs.AnimationInfo=function(a,b,c){this.name=a;this.startIndex=b;this.endIndex=c};
ccs.ComExtensionData=ccs.Component.extend({_customProperty:null,_timelineData:null,_name:"ComExtensionData",ctor:function(){this._customProperty="";this._timelineData=new ccs.ActionTimelineData(0);return!0},setActionTag:function(a){this._timelineData.setActionTag(a)},getActionTag:function(){return this._timelineData.getActionTag()},setCustomProperty:function(a){this._customProperty=a},getCustomProperty:function(){return this._customProperty}});ccs.ComExtensionData.create=function(){return new ccs.ComExtensionData};
ccs.ActionTimelineData.create=function(a){return new ccs.ActionTimelineData(a)};
ccs.ActionTimeline=cc.Action.extend({_timelineMap:null,_timelineList:null,_duration:0,_time:null,_timeSpeed:1,_frameInternal:1/60,_playing:!1,_currentFrame:0,_startFrame:0,_endFrame:0,_loop:null,_frameEventListener:null,_animationInfos:null,_lastFrameListener:null,ctor:function(){cc.Action.prototype.ctor.call(this);this._timelineMap={};this._timelineList=[];this._animationInfos={};this.init()},_gotoFrame:function(a){for(var b=this._timelineList.length,c=0;c<b;c++)this._timelineList[c]._gotoFrame(a)},
_stepToFrame:function(a){for(var b=this._timelineList.length,c=0;c<b;c++)this._timelineList[c]._stepToFrame(a)},_emitFrameEvent:function(a){this._frameEventListener&&this._frameEventListener(a)},init:function(){return!0},gotoFrameAndPlay:function(a,b,c,d){var e=0,f=arguments.length,h=[],k;for(e;e<f;e++)"boolean"===typeof arguments[e]?k=arguments[e]:h.push(arguments[e]);a=h[0];b=void 0!==h[1]?h[1]:this._duration;c=h[2]||a;this._startFrame=a;this._endFrame=b;this._currentFrame=c;this._loop=null!=k?
k:!0;this._time=this._currentFrame*this._frameInternal;this.resume();this._gotoFrame(this._currentFrame)},gotoFrameAndPause:function(a){this._startFrame=this._currentFrame=a;this._time=this._currentFrame*this._frameInternal;this.pause();this._gotoFrame(this._currentFrame)},pause:function(){this._playing=!1},resume:function(){this._playing=!0},isPlaying:function(){return this._playing},setTimeSpeed:function(a){this._timeSpeed=a},getTimeSpeed:function(){return this._timeSpeed},setDuration:function(a){this._duration=
a},getDuration:function(){return this._duration},getStartFrame:function(){return this._startFrame},getEndFrame:function(){return this._endFrame},setCurrentFrame:function(a){a>=this._startFrame&&a<=this._endFrame?(this._currentFrame=a,this._time=this._currentFrame*this._frameInternal):cc.log("frame index is not between start frame and end frame")},getCurrentFrame:function(){return this._currentFrame},addTimeline:function(a){var b=a.getActionTag();this._timelineMap[b]||(this._timelineMap[b]=[]);-1===
this._timelineMap[b].indexOf(a)&&(this._timelineList.push(a),this._timelineMap[b].push(a),a.setActionTimeline(this))},removeTimeline:function(a){var b=a.getActionTag();this._timelineMap[b]&&this._timelineMap[b].some(function(b){if(b===a)return!0})&&(cc.arrayRemoveObject(this._timelineMap[b],a),cc.arrayRemoveObject(this._timelineList,a),a.setActionTimeline(null))},getTimelines:function(){return this._timelineList},setFrameEventCallFunc:function(a){this._frameEventListener=a},clearFrameEventCallFunc:function(){this._frameEventListener=
null},clone:function(){var a=new ccs.ActionTimeline;a.setDuration(this._duration);a.setTimeSpeed(this._timeSpeed);for(var b in this._timelineMap){var c=this._timelineMap[b],d;for(d in c){var e=c[d].clone();a.addTimeline(e)}}return a},reverse:function(){return null},step:function(a){this._playing&&0!==this._timelineMap.length&&0!==this._duration&&(this._time+=a*this._timeSpeed,a=this._time-this._endFrame*this._frameInternal,a<this._frameInternal?(this._currentFrame=Math.floor(this._time/this._frameInternal),
this._stepToFrame(this._currentFrame),0<=a&&this._lastFrameListener&&this._lastFrameListener()):(this._playing=this._loop)?this.gotoFrameAndPlay(this._startFrame,this._endFrame,this._loop):(this._time=this._endFrame*this._frameInternal,this._currentFrame!=this._endFrame&&(this._currentFrame=this._endFrame,this._stepToFrame(this._currentFrame),this._lastFrameListener&&this._lastFrameListener())))},_foreachNodeDescendant:function(a,b){b(a);for(var c=a.getChildren(),d=0;d<c.length;d++)this._foreachNodeDescendant(c[d],
b)},startWithTarget:function(a){cc.Action.prototype.startWithTarget.call(this,a);var b=this;this._foreachNodeDescendant(a,function(a){var d=a.getComponent("ComExtensionData");if(d&&(d=d.getActionTag(),b._timelineMap[d]))for(var d=b._timelineMap[d],e=0;e<d.length;e++)d[e].setNode(a)})},isDone:function(){return!1},play:function(a,b){var c=this._animationInfos[a];if(!c)return cc.log("Can't find animation info for %s",a);this.gotoFrameAndPlay(c.startIndex,c.endIndex,b)},addAnimationInfo:function(a){this._animationInfos[a.name]=
a},removeAnimationInfo:function(a){delete this._animationInfos[a]},isAnimationInfoExists:function(a){return this._animationInfos[a]},getAnimationInfo:function(a){return this._animationInfos[a]},setLastFrameCallFunc:function(a){this._lastFrameListener=a},clearLastFrameCallFunc:function(){this._lastFrameListener=null}});ccs.ActionTimeline.create=function(){return new ccs.ActionTimeline};ccs.Frame=ccs.Class.extend({_frameIndex:null,_tween:null,_timeline:null,_node:null,_tweenType:null,_easingParam:null,_enterWhenPassed:null,ctor:function(){this._frameIndex=0;this._tween=!0;this._node=this._timeline=null;this._enterWhenPassed=!1;this._easingParam=[]},_emitEvent:function(){this._timeline&&this._timeline.getActionTimeline()._emitFrameEvent(this)},_cloneProperty:function(a){this._frameIndex=a.getFrameIndex();this._tween=a.isTween();this._tweenType=a.getTweenType();this.setEasingParams(a.getEasingParams())},
setFrameIndex:function(a){this._frameIndex=a},getFrameIndex:function(){return this._frameIndex},setTimeline:function(a){this._timeline=a},getTimeline:function(a){return this._timeline},setNode:function(a){this._node=a},getNode:function(){return this._node},setTween:function(a){this._tween=a},isTween:function(){return this._tween},onEnter:function(a){},apply:function(a){this._tween&&(this._tweenType!==ccs.FrameEaseType.TWEEN_EASING_MAX&&this._tweenType!==ccs.FrameEaseType.LINEAR&&(a=this.tweenPercent(a)),
this._onApply(a))},_onApply:function(a){},clone:function(){},tweenPercent:function(a){var b=ccs.Frame.tweenToMap[this._tweenType];return b?b(a,this._easingParam):a},setEasingParams:function(a){if(a)for(var b=this._easingParam.length=0;b<a.length;b++)this._easingParam[b]=a[b]},getEasingParams:function(){return this._easingParam},setTweenType:function(a){this._tweenType=a},getTweenType:function(){return this._tweenType},isEnterWhenPassed:function(){return this._enterWhenPassed}});
ccs.Frame.tweenToMap={"-1":function(a,b){if(b){var c=1-a;return b[1]*c*c*c+3*b[3]*a*c*c+3*b[5]*a*a*c+b[7]*a*a*a}return a},1:cc._easeSineInObj.easing,2:cc._easeSineOutObj.easing,3:cc._easeSineInOutObj.easing,4:cc._easeQuadraticActionIn.easing,5:cc._easeQuadraticActionOut.easing,6:cc._easeQuadraticActionInOut.easing,7:cc._easeCubicActionIn.easing,8:cc._easeCubicActionOut.easing,9:cc._easeCubicActionInOut.easing,10:cc._easeCubicActionIn.easing,11:cc._easeCubicActionOut.easing,12:cc._easeCubicActionInOut.easing,
13:cc._easeQuinticActionIn.easing,14:cc._easeQuinticActionOut.easing,15:cc._easeQuinticActionInOut.easing,16:cc._easeExponentialInObj.easing,17:cc._easeExponentialOutObj.easing,18:cc._easeExponentialInOutObj.easing,19:cc._easeCircleActionIn.easing,20:cc._easeCircleActionOut.easing,21:cc._easeCircleActionInOut.easing,22:function(a,b){var c=0.3;null!=b&&(c=b[0]);return cc.easeElasticIn(c).easing(a)},23:function(a,b){var c=0.3;null!=b&&(c=b[0]);return cc.easeElasticOut(c).easing(a)},24:function(a,b){var c=
0.3;null!=b&&(c=b[0]);return cc.easeElasticInOut(c).easing(a)},25:cc._easeBackInObj.easing,26:cc._easeBackOutObj.easing,27:cc._easeBackInOutObj.easing,28:cc._easeBounceInObj.easing,29:cc._easeBounceOutObj.easing,30:cc._easeBounceInOutObj.easing};
ccs.VisibleFrame=ccs.Frame.extend({_visible:!0,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._visible=!0},onEnter:function(a){this._node&&this._node.setVisible(this._visible)},clone:function(){var a=new ccs.VisibleFrame;a.setVisible(this._visible);a._cloneProperty(this);return a},setVisible:function(a){this._visible=a},isVisible:function(){return this._visible}});ccs.VisibleFrame.create=function(){return new ccs.VisibleFrame};
ccs.TextureFrame=ccs.Frame.extend({_sprite:null,_textureName:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._textureName=""},setNode:function(a){ccs.Frame.prototype.setNode.call(this,a);this._sprite=a},onEnter:function(a){if(this._sprite){a=this._sprite.getBlendFunc();var b=cc.spriteFrameCache._spriteFrames[this._textureName];null!=b?this._sprite.setSpriteFrame(b):this._sprite.setTexture(this._textureName);this._sprite.getBlendFunc()!==a&&this._sprite.setBlendFunc(a)}},clone:function(){var a=
new ccs.TextureFrame;a.setTextureName(this._textureName);a._cloneProperty(this);return a},setTextureName:function(a){this._textureName=a},getTextureName:function(){return this._textureName}});ccs.TextureFrame.create=function(){return new ccs.TextureFrame};
ccs.RotationFrame=ccs.Frame.extend({_rotation:null,_betwennRotation:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._rotation=0},onEnter:function(a){this._node&&(this._node.setRotation(this._rotation),this._tween&&(this._betwennRotation=a._rotation-this._rotation))},_onApply:function(a){0!==this._betwennRotation&&this._node.setRotation(this._rotation+a*this._betwennRotation)},clone:function(){var a=new ccs.RotationFrame;a.setRotation(this._rotation);a._cloneProperty(this);return a},
setRotation:function(a){this._rotation=a},getRotation:function(){return this._rotation}});ccs.RotationFrame.create=function(){return new ccs.RotationFrame};
ccs.SkewFrame=ccs.Frame.extend({_skewX:null,_skewY:null,_betweenSkewX:null,_betweenSkewY:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._skewY=this._skewX=0},onEnter:function(a){this._node&&(this._node.setSkewX(this._skewX),this._node.setSkewY(this._skewY),this._tween&&(this._betweenSkewX=a._skewX-this._skewX,this._betweenSkewY=a._skewY-this._skewY))},_onApply:function(a){if(0!==this._betweenSkewX||0!==this._betweenSkewY){var b=this._skewY+a*this._betweenSkewY;this._node.setSkewX(this._skewX+
a*this._betweenSkewX);this._node.setSkewY(b)}},clone:function(){var a=new ccs.SkewFrame;a.setSkewX(this._skewX);a.setSkewY(this._skewY);a._cloneProperty(this);return a},setSkewX:function(a){this._skewX=a},getSkewX:function(){return this._skewX},setSkewY:function(a){this._skewY=a},getSkewY:function(){return this._skewY}});ccs.SkewFrame.create=function(){return new ccs.SkewFrame};
ccs.RotationSkewFrame=ccs.SkewFrame.extend({onEnter:function(a){this._node&&(this._node.setRotationX(this._skewX),this._node.setRotationY(this._skewY),this._tween&&(this._betweenSkewX=a._skewX-this._skewX,this._betweenSkewY=a._skewY-this._skewY))},_onApply:function(a){if(this._node&&(0!==this._betweenSkewX||0!==this._betweenSkewY)){var b=this._skewY+a*this._betweenSkewY;this._node.setRotationX(this._skewX+a*this._betweenSkewX);this._node.setRotationY(b)}},clone:function(){var a=new ccs.RotationSkewFrame;
a.setSkewX(this._skewX);a.setSkewY(this._skewY);a._cloneProperty(this);return a}});ccs.RotationSkewFrame.create=function(){return new ccs.RotationSkewFrame};
ccs.PositionFrame=ccs.Frame.extend({_position:null,_betweenX:null,_betweenY:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._position=cc.p(0,0)},onEnter:function(a){this._node&&(this._node.setPosition(this._position),this._tween&&(this._betweenX=a._position.x-this._position.x,this._betweenY=a._position.y-this._position.y))},_onApply:function(a){if(this._node&&(0!==this._betweenX||0!==this._betweenY)){var b=cc.p(0,0);b.x=this._position.x+this._betweenX*a;b.y=this._position.y+this._betweenY*
a;this._node.setPosition(b)}},clone:function(){var a=new ccs.PositionFrame;a.setPosition(this._position);a._cloneProperty(this);return a},setPosition:function(a){this._position=a},getPosition:function(){return this._position},setX:function(a){this._position.x=a},getX:function(){return this._position.x},setY:function(a){this._position.y=a},getY:function(){return this._position.y}});ccs.PositionFrame.create=function(){return new ccs.PositionFrame};
ccs.ScaleFrame=ccs.Frame.extend({_scaleX:null,_scaleY:null,_betweenScaleX:null,_betweenScaleY:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._scaleY=this._scaleX=1},onEnter:function(a){this._node&&(this._node.setScaleX(this._scaleX),this._node.setScaleY(this._scaleY),this._tween&&(this._betweenScaleX=a._scaleX-this._scaleX,this._betweenScaleY=a._scaleY-this._scaleY))},_onApply:function(a){if(this._node&&(0!==this._betweenScaleX||0!==this._betweenScaleY)){var b=this._scaleY+this._betweenScaleY*
a;this._node.setScaleX(this._scaleX+this._betweenScaleX*a);this._node.setScaleY(b)}},clone:function(){var a=new ccs.ScaleFrame;a.setScaleX(this._scaleX);a.setScaleY(this._scaleY);a._cloneProperty(this);return a},setScale:function(a){this._scaleY=this._scaleX=a},setScaleX:function(a){this._scaleX=a},getScaleX:function(){return this._scaleX},setScaleY:function(a){this._scaleY=a},getScaleY:function(){return this._scaleY}});ccs.ScaleFrame.create=function(){return new ccs.ScaleFrame};
ccs.AnchorPointFrame=ccs.Frame.extend({_anchorPoint:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._anchorPoint=cc.p(0,0)},onEnter:function(a){this._node&&this._node.setAnchorPoint(this._anchorPoint)},clone:function(){var a=new ccs.AnchorPointFrame;a.setAnchorPoint(this._anchorPoint);a._cloneProperty(this);return a},setAnchorPoint:function(a){this._anchorPoint=a},getAnchorPoint:function(){return this._anchorPoint}});ccs.AnchorPointFrame.create=function(){return new ccs.AnchorPointFrame};
ccs.InnerActionType={LoopAction:0,NoLoopAction:1,SingleFrame:2};
ccs.InnerActionFrame=ccs.Frame.extend({_innerActionType:null,_startFrameIndex:null,_endFrameIndex:0,_singleFrameIndex:0,_enterWithName:null,_animationName:"",ctor:function(){ccs.Frame.prototype.ctor.call(this);this._enterWithName=!1;this._innerActionType=ccs.InnerActionType.LoopAction;this._startFrameIndex=0},onEnter:function(a){if(this._node&&(a=this._node.getActionByTag(this._node.getTag())))if(ccs.InnerActionType.SingleFrame===this._innerActionType)a.gotoFrameAndPause(this._singleFrameIndex);else{var b=
this._startFrameIndex,c=this._endFrameIndex;this._enterWithName&&("-- ALL --"===this._animationName?(b=0,c=a.getDuration()):a.isAnimationInfoExists(this._animationName)?(c=a.getAnimationInfo(this._animationName),b=c.startIndex,c=c.endIndex):cc.log("Animation %s not exists!",this._animationName));var d=this._timeline.getActionTimeline().getDuration()-this._frameIndex-c+b;0>d&&(c+=d);ccs.InnerActionType.NoLoopAction===this._innerActionType?a.gotoFrameAndPlay(b,c,!1):ccs.InnerActionType.LoopAction===
this._innerActionType&&a.gotoFrameAndPlay(b,c,!0)}},setAnimationName:function(a){this._animationName=a},setSingleFrameIndex:function(a){this._singleFrameIndex=a},getSingleFrameIndex:function(){return this._startFrameIndex},setEnterWithName:function(a){this._enterWithName=a},getEnterWithName:function(){return this._enterWithName},clone:function(){var a=new ccs.InnerActionFrame;a.setInnerActionType(this._innerActionType);a.setStartFrameIndex(this._startFrameIndex);a.setEnterWithName(this._enterWithName);
a.setAnimationName(this._animationName);a.setSingleFrameIndex(this._singleFrameIndex);a._cloneProperty(this);return a},setInnerActionType:function(a){this._innerActionType=a},getInnerActionType:function(){return this._innerActionType},setStartFrameIndex:function(a){this._startFrameIndex=a},getStartFrameIndex:function(){return this._startFrameIndex}});ccs.InnerActionFrame.create=function(){return new ccs.InnerActionFrame};
ccs.ColorFrame=ccs.Frame.extend({_alpha:null,_color:null,_betweenAlpha:null,_betweenRed:null,_betweenGreen:null,_betweenBlue:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._color=cc.color(255,255,255)},onEnter:function(a){this._node&&(this._node.setColor(this._color),this._tween&&(a=a._color,this._betweenRed=a.r-this._color.r,this._betweenGreen=a.g-this._color.g,this._betweenBlue=a.b-this._color.b))},_onApply:function(a){if(this._node&&this._tween&&(0!==this._betweenAlpha||0!==this._betweenRed||
0!==this._betweenGreen||0!==this._betweenBlue)){var b=cc.color(255,255,255);b.r=this._color.r+this._betweenRed*a;b.g=this._color.g+this._betweenGreen*a;b.b=this._color.b+this._betweenBlue*a;this._node.setColor(b);null!==this._alpha&&this._node.setOpacity(this._alpha+this._betweenAlpha*a)}},clone:function(){var a=new ccs.ColorFrame;a.setColor(this._color);a._cloneProperty(this);return a},setColor:function(a){this._color=a},getColor:function(){return this._color}});ccs.ColorFrame.create=function(){return new ccs.ColorFrame};
ccs.AlphaFrame=ccs.Frame.extend({_alpha:null,_betweenAlpha:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._alpha=255},onEnter:function(a){this._node&&(this._node.setOpacity(this._alpha),this._tween&&(this._betweenAlpha=a._alpha-this._alpha))},_onApply:function(a){this._node&&this._node.setOpacity(this._alpha+this._betweenAlpha*a)},setAlpha:function(a){this._alpha=a},getAlpha:function(){return this._alpha},clone:function(){var a=new ccs.AlphaFrame;a.setAlpha(this._alpha);a._cloneProperty(this);
return a}});ccs.EventFrame=ccs.Frame.extend({_event:null,ctor:function(){ccs.Frame.prototype.ctor.call(this);this._event="";this._enterWhenPassed=!0},onEnter:function(a){this._emitEvent()},clone:function(){var a=new ccs.EventFrame;a.setEvent(this._event);a._cloneProperty(this);return a},setEvent:function(a){this._event=a},getEvent:function(){return this._event}});ccs.EventFrame.create=function(){return new ccs.EventFrame};
ccs.ZOrderFrame=ccs.Frame.extend({_zorder:0,onEnter:function(a){this._node&&this._node.setLocalZOrder(this._zorder)},clone:function(){var a=new ccs.ZOrderFrame;a.setZOrder(this._zorder);a._cloneProperty(this);return a},setZOrder:function(a){this._zorder=a},getZOrder:function(){return this._zorder}});ccs.ZOrderFrame.create=function(){return new ccs.ZOrderFrame};
ccs.BlendFuncFrame=ccs.Frame.extend({ctor:function(){this._super();this._blendFunc=null},onEnter:function(a,b){this._node&&this._blendFunc&&this._node.setBlendFunc(this._blendFunc)},clone:function(){var a=new ccs.BlendFuncFrame;a.setBlendFunc(this._blendFunc);a._cloneProperty(this);return a},setBlendFunc:function(a){a&&a.src&&a.dst&&(this._blendFunc=a)},getBlendFunc:function(){return this._blendFunc}});ccs.BlendFuncFrame.create=function(){return new ccs.BlendFuncFrame};ccs.Timeline=ccs.Class.extend({_frames:null,_currentKeyFrame:null,_currentKeyFrameIndex:null,_fromIndex:null,_toIndex:null,_betweenDuration:null,_actionTag:null,_ActionTimeline:null,_node:null,ctor:function(){this._frames=[];this._currentKeyFrame=null;this._actionTag=this._betweenDuration=this._toIndex=this._fromIndex=this._currentKeyFrameIndex=0;this._node=this._ActionTimeline=null},_gotoFrame:function(a){0!==this._frames.length&&(this._binarySearchKeyFrame(a),this._apply(a))},_stepToFrame:function(a){0!==
this._frames.length&&(this._updateCurrentKeyFrame(a),this._apply(a))},getFrames:function(){return this._frames},addFrame:function(a){this._frames.push(a);a.setTimeline(this)},insertFrame:function(a,b){this._frames.splice(b,0,a);a.setTimeline(this)},removeFrame:function(a){cc.arrayRemoveObject(this._frames,a);a.setTimeline(null)},setActionTag:function(a){this._actionTag=a},getActionTag:function(){return this._actionTag},setNode:function(a){for(var b=0;b<this._frames.length;b++)this._frames[b].setNode(a)},
getNode:function(){return this._node},setActionTimeline:function(a){this._ActionTimeline=a},getActionTimeline:function(){return this._ActionTimeline},clone:function(){var a=new ccs.Timeline;a._actionTag=this._actionTag;for(var b=0;b<this._frames.length;b++){var c=this._frames[b].clone();a.addFrame(c)}return a},_apply:function(a){this._currentKeyFrame&&this._currentKeyFrame.apply(0>=this._betweenDuration?0:(a-this._currentKeyFrameIndex)/this._betweenDuration)},_binarySearchKeyFrame:function(a){var b=
null,c=null,d=this._frames.length,e=!1;do if(a<this._frames[0].getFrameIndex())this._currentKeyFrameIndex>=this._frames[0].getFrameIndex()&&(e=!0),this._toIndex=this._fromIndex=0,b=c=this._frames[0],this._currentKeyFrameIndex=0,this._betweenDuration=this._frames[0].getFrameIndex();else if(a>=this._frames[d-1].getFrameIndex())this._fromIndex=d-1,this._toIndex=0,b=c=this._frames[d-1],this._currentKeyFrameIndex=this._frames[d-1].getFrameIndex(),this._betweenDuration=0;else{for(var f=-1,b=0,c=d-1,h=0;b<=
c;){h=Math.ceil((b+c)/2);if(a>=this._frames[h].getFrameIndex()&&a<this._frames[h+1].getFrameIndex()){f=h;break}this._frames[h].getFrameIndex()>a?c=h-1:b=h+1}this._fromIndex=f;this._toIndex=1<d?f+1|0:f|0;b=this._frames[f];c=this._frames[f+1];0===f&&this._currentKeyFrameIndex<b.getFrameIndex()&&(e=!0);this._currentKeyFrameIndex=b.getFrameIndex();this._betweenDuration=c.getFrameIndex()-b.getFrameIndex()}while(0);if(e||this._currentKeyFrame!=b)this._currentKeyFrame=b,this._currentKeyFrame.onEnter(c)},
_updateCurrentKeyFrame:function(a){if(a<this._currentKeyFrameIndex||a>=this._currentKeyFrameIndex+this._betweenDuration){var b=null,c=null;do{var d=this._frames.length;if(a<this._frames[0].getFrameIndex())b=c=this._frames[0],this._currentKeyFrameIndex=0,this._betweenDuration=this._frames[0].getFrameIndex();else{if(a>=this._frames[d-1].getFrameIndex()&&(a=this._frames[d-1].getFrameIndex(),this._currentKeyFrameIndex>=a))return;do{this._fromIndex=this._toIndex;b=this._frames[this._fromIndex];this._currentKeyFrameIndex=
b.getFrameIndex();this._toIndex=this._fromIndex+1;this._toIndex>=d&&(this._toIndex=0);c=this._frames[this._toIndex];if(a===b.getFrameIndex())break;if(a>b.getFrameIndex()&&a<c.getFrameIndex())break;if(b.isEnterWhenPassed())b.onEnter(c)}while(1);this._betweenDuration=c.getFrameIndex()-b.getFrameIndex()}}while(0);this._currentKeyFrame=b;this._currentKeyFrame.onEnter(c)}}});ccs.Timeline.create=function(){return new ccs.Timeline};ccs.SkinNode=function(){var a=cc.Node.extend({});a.create=function(){};return a}();ccs.BoneNode=function(){var a=cc.Node,b=ccs.SkinNode,c=cc.BlendFunc,d={p:cc.p,size:cc.size,rect:cc.rect},e={log:cc.log,assert:cc.assert},f=a.extend({_customCommand:null,_blendFunc:null,_rackColor:null,_rackLength:null,_rackWidth:null,_childBones:null,_boneSkins:null,_rootSkeleton:null,_squareVertices:null,_squareColors:null,_noMVPVertices:null,ctor:function(b){a.prototype.ctor.call(this);null===this._squareVertices&&(this._squareVertices=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}]);this._rackColor=
cc.color.WHITE;this._blendFunc=c.ALPHA_NON_PREMULTIPLIED;this._childBones=[];this._boneSkins=[];this._rackLength=void 0===b?50:b;this._rackWidth=20;this._updateVertices()},visit:function(a){this._visit&&this._visit(a&&a._renderCmd)},addSkin:function(b,c,d){var f=this._boneSkins;e.assert(null!=b,"Argument must be non-nil");if(d)for(d=0;d<f.length;d++)f[d].setVisible(!1);a.prototype.addChild.call(this,b);this._boneSkins.push(b);b.setVisible(c)},getChildBones:function(){return this._childBones},getSkins:function(){return this._boneSkins},
displaySkin:function(a,b){var c=this._boneSkins,d,e;if("string"===typeof a)for(e=0;e<c.length;e++)d=c[e],a==d.getName()?d.setVisible(!0):b&&d.setVisible(!1);else for(e=0;e<c.length;e++)d=c[e],d==a?d.setVisible(!0):b&&d.setVisible(!1)},getVisibleSkins:function(){for(var a=[],b=this._boneSkins,c,d=0;d<b.length;d++)c=b[d],c.isVisible()&&a.push(c);return a},getRootSkeletonNode:function(){return this._rootSkeleton},getAllSubBones:function(){for(var a=[],b=[],c=this._childBones,d=0;d<c.length;d++)b.push(c[d]);
for(;0<b.length;)for(c=b.pop(),a.push(c),c=c.getChildBones(),d=0;d<c;d++)b.push(c[d]);return a},getAllSubSkins:function(){for(var a=this.getAllSubBones(),b=[],c=0;c<a.length;c++)for(var d=a[c].getSkins(),e=0;e<d.length;e++)b.push(d[c]);return b},addChild:function(b,c,d){a.prototype.addChild.call(this,b,c,d);this._addToChildrenListHelper(b)},removeChild:function(b,c){-1!==this._children.indexOf(b)&&(a.prototype.removeChild.call(this,b,c),this._removeFromChildrenListHelper(b))},setBlendFunc:function(a){var b=
this._blendFunc;if(a&&b.src!==a.src&&b.dst!==a.dst){this._blendFunc=a;for(var b=this._boneSkins,c,d=0;d<b.length;d++)c=b[d],c.setBlendFunc(a)}},getBlendFunc:function(){return this._blendFunc},setDebugDrawLength:function(a){this._rackLength=a;this._updateVertices()},getDebugDrawLength:function(){return this._rackLength},setDebugDrawWidth:function(a){this._rackWidth=a;this._updateVertices()},getDebugDrawWidth:function(){return this._rackWidth},setDebugDrawEnabled:function(a){var b=this._renderCmd;b._debug!==
a&&(b._debug=a,cc.renderer.childrenOrderDirty=!0,this._visible&&null!=this._rootSkeleton&&(this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0))},isDebugDrawEnabled:function(){return this._renderCmd._debug},setDebugDrawColor:function(a){this._rackColor=a},getDebugDrawColor:function(){return this._rackColor},getVisibleSkinsRect:function(){var a,b,c,e=0;a=b=c=e;var f=!0,h=d.rect(0,0,0,0);this._renderCmd._debug&&null!=this._rootSkeleton&&this._rootSkeleton._renderCmd._debug&&
(c=this._rackWidth,e=this._rackLength,f=!1);for(var k=this._boneSkins,v,y=0;y<k.length;y++){v=k[y];var x=v.getBoundingBox();!v.isVisible()||0===x.x&&0===x.y&&0===x.width&&0===x.height||(f?(a=cc.rectGetMinX(x),b=cc.rectGetMinY(x),c=cc.rectGetMaxX(x),e=cc.rectGetMaxY(x),f=!1):(a=Math.min(cc.rectGetMinX(x),a),b=Math.min(cc.rectGetMinY(x),b),c=Math.max(cc.rectGetMaxX(x),c),e=Math.max(cc.rectGetMaxY(x),e)),h.setRect(a,b,c-a,e-b))}return h},getBoundingBox:function(){var a=this.getVisibleSkinsRect();return cc.rectApplyAffineTransform(a,
this.getNodeToParentAffineTransform())},batchBoneDrawToSkeleton:function(a){},setLocalZOrder:function(b){a.prototype.setLocalZOrder.call(this,b);null!=this._rootSkeleton&&(this._rootSkeleton._subBonesOrderDirty=!0)},setName:function(b){var c=this._rootSkeleton,d=this.getName();a.prototype.setName.call(this,b);if(null!=c){var d=c._subBonesMap[d],e=c._subBonesMap[b];d&&!e&&(delete c._subBonesMap[d],c._subBonesMap[b]=d)}},setContentSize:function(b){a.prototype.setContentSize.call(this,b);this._updateVertices()},
setAnchorPoint:function(b){a.prototype.setAnchorPoint.call(this,b);this._updateVertices()},setVisible:function(b){this._visible!=b&&(a.prototype.setVisible.call(this,b),null!=this._rootSkeleton&&(this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0))},_addToChildrenListHelper:function(a){a instanceof f?this._addToBoneList(a):this._addToSkinList(a)},_removeFromChildrenListHelper:function(a){a instanceof f?this._removeFromBoneList(a):a instanceof b&&this._removeFromSkinList(skin)},
_removeFromBoneList:function(a){if(null!=this._rootSkeleton&&a instanceof ccs.SkeletonNode&&a._rootSkeleton===this._rootSkeleton){a._rootSkeleton=null;var b=a.getAllSubBones();b.push(a);for(var c,d=0;d<b.length;d++)c=b[d],c._rootSkeleton=null,delete this._rootSkeleton._subBonesMap[c.getName()],this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0}else this._rootSkeleton._subBonesDirty=!0,this._rootSkeleton._subBonesOrderDirty=!0;cc.arrayRemoveObject(this._childBones,a)},_setRootSkeleton:function(a){this._rootSkeleton=
a;a=this.getAllSubBones();for(var b=0;b<a.length;b++)this._addToBoneList(a[b])},_addToBoneList:function(a){-1===this._childBones.indexOf(a)&&this._childBones.push(a);if(null!=this._rootSkeleton&&!(a instanceof b||a._rootSkeleton)){var c=a.getAllSubBones();c.push(a);for(var d=0;d<c.length;d++){a=c[d];a._setRootSkeleton(this._rootSkeleton);var e=a.getName();this._rootSkeleton._subBonesMap[e]?cc.log("already has a bone named %s in skeleton %s",e,this._rootSkeleton.getName()):this._rootSkeleton._subBonesMap[a.getName()]=
a;this._rootSkeleton._subBonesDirty=!0;this._rootSkeleton._subBonesOrderDirty=!0}}},_visitSkins:function(){var a=this._renderCmd;if(this._visible){var b=a.getParentRenderCmd();b&&(a._curLevel=b._curLevel+1);var c=this._boneSkins,d;a._syncStatus(b);var e=c.length;if(0<e){this.sortAllChildren();for(b=0;b<e;b++)if(d=c[b],0>d._localZOrder)d.visit(this);else break;for(;b<e;b++)c[b].visit(this)}a._dirtyFlag=0}},_addToSkinList:function(a){this._boneSkins.push(a);if(a.getBlendFunc){var b=a.getBlendFunc();
this._blendFunc.src!==b.src&&this._blendFunc.dst!==b.dst&&a.setBlendFunc(this._blendFunc)}},_removeFromSkinList:function(a){cc.arrayRemoveObject(this._boneSkins,a)},sortAllChildren:function(){this._sortArray(this._childBones);this._sortArray(this._boneSkins);a.prototype.sortAllChildren.call(this)},_sortArray:function(a){if(a){var b=a.length,c,d,e;for(c=1;c<b;c++){e=a[c];for(d=c-1;0<=d;){if(e._localZOrder<a[d]._localZOrder)a[d+1]=a[d];else if(e._localZOrder===a[d]._localZOrder&&e.arrivalOrder<a[d].arrivalOrder)a[d+
1]=a[d];else break;d--}a[d+1]=e}}},_updateVertices:function(){var a=this._squareVertices,b=this._renderCmd._anchorPointInPoints;if(this._rackLength!=a[2].x-b.x||a[3].y!=this._rackWidth/2-b.y){a[1].x=a[1].y=a[3].y=0;a[0].x=a[2].x=0.1*this._rackLength;a[2].y=0.5*this._rackWidth;a[0].y=-a[2].y;a[3].x=this._rackLength;for(var c=0;c<a.length;c++)a[c].x+=b.x,a[c].y+=b.y;this._renderCmd.updateDebugPoint(a)}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new h(this):new k(this)}});
f.create=function(a,b){return new ccui.BoneNode(a,b)};var h=function(){var b=function(a){this._rootCtor(a);this._debug=!1;this._color=cc.color.WHITE;this._drawNode=new cc.DrawNode},c=b.prototype=Object.create(a.CanvasRenderCmd.prototype);c.constructor=b;c.updateDebugPoint=function(a){this._drawNode.clear();this._drawNode.drawPoly(a,this._color,0,this._color)};c.transform=function(a,b){var c=this._node._rootSkeleton;this.originTransform(a,b);c&&c._renderCmd._debug&&this._drawNode._renderCmd.transform(this)};
return b}(),k=function(){var b=function(a){this._rootCtor(a);this._debug=!1;this._color=cc.color.WHITE;this._drawNode=new cc.DrawNode},c=b.prototype=Object.create(a.WebGLRenderCmd.prototype);c.constructor=b;c.updateDebugPoint=function(a){this._drawNode.clear();this._drawNode.drawPoly(a,this._color,0,this._color)};c.transform=function(a,b){var c=this._node._rootSkeleton;this.originTransform(a,b);c&&c._renderCmd._debug&&this._drawNode._renderCmd.transform(this)};return b}();return f}();ccs.SkeletonNode=function(){var a=ccs.BoneNode,b=a.extend({_subBonesMap:null,_squareVertices:null,_squareColors:null,_noMVPVertices:null,_skinGroupMap:null,_sortedAllBonesDirty:!1,_sortedAllBones:null,_batchedBoneVetices:null,_batchedBoneColors:null,_batchedVeticesCount:null,_batchBoneCommand:null,_subOrderedAllBones:null,ctor:function(){this._squareVertices=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];this._rootSkeleton=this;a.prototype.ctor.call(this);this._subBonesMap=
{};this._subOrderedAllBones=[];this._skinGroupMap={};this._rackLength=this._rackWidth=20;this._updateVertices()},getBoneNode:function(a){return(a=this._subBonesMap[a])?a:null},getAllSubBonesMap:function(){return this._subBonesMap},changeSkins:function(a){if("object"===typeof a){var b,e;for(e in a){b=a[e];var f=this.getBoneNode(e);null!==f&&f.displaySkin(b,!0)}}else(a=this._suitMap[a])&&this.changeSkins(a,!0)},addSkinGroup:function(a,b){this._skinGroupMap[a]=b},getBoundingBox:function(){var a,b,e,
f=0;a=b=e=f;var h=this.getVisibleSkinsRect(),k=!0;if(0!==h.x||0!==h.y||0!==h.width||0!==h.height)a=cc.rectGetMinX(h),b=cc.rectGetMinY(h),e=cc.rectGetMaxX(h),f=cc.rectGetMaxY(h),k=!1;for(var m=this.getAllSubBones(),n,p=0;p<m.length;p++)if(n=m[p],n=cc.rectApplyAffineTransform(n.getVisibleSkinsRect(),n.getNodeToParentTransform(n.getRootSkeletonNode())),0!==n.x||0!==n.y||0!==n.width||0!==n.height)k?(a=cc.rectGetMinX(n),b=cc.rectGetMinY(n),e=cc.rectGetMaxX(n),f=cc.rectGetMaxY(n),k=!1):(a=Math.min(cc.rectGetMinX(n),
a),b=Math.min(cc.rectGetMinY(n),b),e=Math.max(cc.rectGetMaxX(n),e),f=Math.max(cc.rectGetMaxY(n),f));h.x=a;h.y=b;h.width=e-a;h.height=f-b;return cc.rectApplyAffineTransform(h,this.getNodeToParentTransform())},_visit:function(a){var b=this._renderCmd;a=a||b.getParentRenderCmd();if(this._visible){b._syncStatus(a);var e;if(0!==this._children.length)for(a=0;a<this._children.length;a++)e=this._children[a],e.visit(this);this._checkSubBonesDirty();e=this._subOrderedAllBones;var f;for(a=0;a<e.length;a++)f=
e[a],f._visitSkins();if(b._debug)for(a=0;a<e.length;a++)f=e[a]._renderCmd,cc.renderer.pushRenderCommand(f._drawNode._renderCmd);b._dirtyFlag=0}else b._propagateFlagsDown(a)},_checkSubBonesDirty:function(){this._subBonesDirty&&(this._updateOrderedAllbones(),this._subBonesDirty=!1);this._subBonesOrderDirty&&(this._sortOrderedAllBones(),this._subBonesOrderDirty=!1)},_updateOrderedAllbones:function(){this._subOrderedAllBones.length=0;for(var a=[],b=this._childBones,e,f=0;f<b.length;f++)e=b[f],e.isVisible()&&
a.push(e);for(;0<a.length;)for(f=a.pop(),b=f._renderCmd,b._syncStatus(b.getParentRenderCmd()),this._subOrderedAllBones.push(f),b=f.getChildBones(),f=0;f<b.length;f++)e=b[f],e.isVisible()&&a.push(e)},_sortOrderedAllBones:function(){this._sortArray(this._subOrderedAllBones)},_updateVertices:function(){var a=this._squareVertices,b=this._renderCmd._anchorPointInPoints;if(this._rackLength!=a[6].x-b.x||this._rackWidth!=a[3].y-b.y){var e=0.5*this._rackLength,f=0.5*this._rackWidth,h=0.25*e,k=0.25*f;a[5].y=
a[2].y=a[1].y=a[6].y=a[0].x=a[4].x=a[7].x=a[3].x=0;a[5].x=-e;a[0].y=-f;a[6].x=e;a[3].y=f;a[1].x=h;a[7].y=k;a[2].x=-h;a[4].y=-k;for(e=0;e<a.length;e++)a[e].x+=b.x,a[e].y+=b.y}},_updateAllDrawBones:function(){this._subDrawBones={};for(var a in this._subBonesMap){var b=this._subBonesMap[a];b.isVisible()&&b.isDebugDrawEnabled()&&this._subDrawBones.push(b)}this._sortArray(this._sortedAllBones);this._subDrawBones=!1}});b.create=function(){return new b};return b}();ccs._load=function(){var a=function(a,d,k){var m=cc.loader.getRes(a);if(!m)return cc.log("%s does not exist",a);var n=a.match(c),n=(n&&n[1]?n[1]:null).toLocaleLowerCase();if("json"!==n&&"exportjson"!==n)return cc.log("%s load error, must be json file",a);var p;d?p=b[d]:m.widgetTree?p=b.ccui:m.nodeTree?p=b.timeline:m.Content&&m.Content.Content?p=b.timeline:m.gameobjects&&(p=b.scene);if(!p)return cc.log("Can't find the parser : %s",a),new cc.Node;d=m.version||m.Version;if(!d&&m.armature_data)return cc.warn("%s is armature. please use:",
a),cc.warn("    ccs.armatureDataManager.addArmatureFileInfoAsync(%s);",a),cc.warn("    var armature \x3d new ccs.Armature('name');"),new cc.Node;p=e(p,d);return p?p.parse(a,m,k)||null:(cc.log("Can't find the parser : %s",a),new cc.Node)},b={ccui:{},timeline:{},action:{},scene:{}};a.registerParser=function(a,c,d){if(!a||!c||!d)return cc.log("register parser error");b[a]||(b[a]={});b[a][c]=d};a.getParser=function(a,c){return a&&c?b[a]?b[a][c]:void 0:a?b[a]:b};var c=/\.([^\.]+)$/,d=/([^\.](\.\*)?)*$/,
e=function(a,b){return a[b]?a[b]:"*"===b?null:e(a,b.replace(d,"*"))};return a}();
ccs._parser=cc.Class.extend({ctor:function(){this.parsers={}},_dirnameReg:/\S*\//,_dirname:function(a){return(a=a.match(this._dirnameReg))&&a[0]?a[0]:""},getClass:function(a){return a.classname},getNodeJson:function(a){return a.widgetTree},parse:function(a,b,c){c=c||this._dirname(a);this.pretreatment(b,c);var d=this.parseNode(this.getNodeJson(b),c,a);d&&this.deferred(b,c,d,a);return d},pretreatment:function(a,b,c){},deferred:function(a,b,c,d){},parseNode:function(a,b){var c=this.parsers[this.getClass(a)],
d=null;c?d=c.call(this,a,b):cc.log("Can't find the parser : %s",this.getClass(a));return d},registerParser:function(a,b){this.parsers[a]=b}});ccs.load=function(a,b){var c={node:null,action:null};c.node=ccs._load(a,null,b);c.action=ccs._load(a,"action",b);c.action&&-1===c.action.tag&&c.node&&(c.action.tag=c.node.tag);return c};ccs.load.validate={};ccs.load.preload=!0;
ccs.loadWithVisibleSize=function(a,b){var c=ccs.load(a,b),d=cc.director.getVisibleSize();c.node&&d&&(c.node.setContentSize(d.width,d.height),ccui.helper.doLayout(c.node));return c};ccs.actionTimelineCache={createAction:function(a){return ccs._load(a,"action")}};ccs.csLoader={createNode:function(a){return ccs._load(a)}};
cc.loader.register(["json"],{load:function(a,b,c,d){cc.loader.loadJson(a,function(a,c){var h=cc.path;if(c&&c.Content&&c.Content.Content.UsedResources){for(var k=c.Content.Content.UsedResources,m=h.dirname(b),n=[],p,r=0;r<k.length;r++)if(ccs.load.preload||!/\.(png|jpg$)/.test(k[r]))p=h.join(m,k[r]),p=h._normalize(p),ccs.load.validate[p]||(ccs.load.validate[p]=!0,n.push(p));cc.loader.load(n,function(){d(a,c)})}else d(a,c)})}});(function(a,b){var c=new (b.extend({getNodeJson:function(a){return a},parseNode:function(a,b){var c=this.parsers[this.getClass(a)],d=null;c?d=c.call(this,a,b):cc.log("Can't find the parser : %s",this.getClass(a));return d},deferred:function(a,b,c,d){ccs.triggerManager.parse(a.Triggers||[]);ccs.sceneReader&&(ccs.sceneReader._node=c)},setPropertyFromJsonDict:function(a,b){var c=cc.isUndefined(b.x)?0:b.x,d=cc.isUndefined(b.y)?0:b.y;a.setPosition(c,d);c=Boolean(cc.isUndefined(b.visible)?1:b.visible);
a.setVisible(c);c=cc.isUndefined(b.objecttag)?-1:b.objecttag;a.setTag(c);c=cc.isUndefined(b.zorder)?0:b.zorder;a.setLocalZOrder(c);c=cc.isUndefined(b.scalex)?1:b.scalex;d=cc.isUndefined(b.scaley)?1:b.scaley;a.setScaleX(c);a.setScaleY(d);c=cc.isUndefined(b.rotation)?0:b.rotation;a.setRotation(c);a.setName(b.name||"")}}));c.parseChild=function(a,b,c){for(var d=0;d<b.length;d++){var e,f=b[d];f&&(e=this.parseNode(f,c));e&&a.addChild(e)}};var d={CCSprite:function(a,b,c){var d=new cc.Sprite;f(b.fileData,
c,function(a,b){if(0===b)d.setTexture(a);else if(1===b){var c=cc.spriteFrameCache.getSpriteFrame(a);d.setSpriteFrame(c)}});b=new ccs.ComRender(d,"CCSprite");a.addComponent(b);return b},CCTMXTiledMap:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){0===b&&(d=new cc.TMXTiledMap(a))});b=new ccs.ComRender(d,"CCTMXTiledMap");a.addComponent(b);return b},CCParticleSystemQuad:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){0===b?d=new cc.ParticleSystem(a):cc.log("unknown resourcetype on CCParticleSystemQuad!");
d.setPosition(0,0)});b=new ccs.ComRender(d,"CCParticleSystemQuad");a.addComponent(b);return b},CCArmature:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){if(0===b){var c=cc.loader.getRes(a);c||cc.log("Please load the resource [%s] first!",a);c=c.armature_data[0].name;ccs.armatureDataManager.addArmatureFileInfo(a);d=new ccs.Armature(c)}});if(d)return c=new ccs.ComRender(d,"CCArmature"),a.addComponent(c),(a=b.selectedactionname)&&d.getAnimation()&&d.getAnimation().play(a),c},CCComAudio:function(a,
b,c){var d=null;f(b.fileData,c,function(c,e){if(0===e){d=new ccs.ComAudio;d.preloadEffect(c);var f=b.name;f&&d.setName(f);a.addComponent(d)}})},CCComAttribute:function(a,b,c){var d=null;f(b.fileData,c,function(b,c){0===c?(d=new ccs.ComAttribute,""!==b&&d.parse(b),a.addComponent(d)):cc.log("unknown resourcetype on CCComAttribute!")});return d},CCBackgroundAudio:function(a,b,c){var d=null;f(b.fileData,c,function(c,e){if(0===e){d=new ccs.ComAudio;d.preloadBackgroundMusic(c);d.setFile(c);var f=Boolean(b.loop||
0);d.setLoop(f);var m=b.name;m&&d.setName(m);a.addComponent(d);d.playBackgroundMusic(c,f)}})},GUIComponent:function(a,b,c){var d=null;f(b.fileData,c,function(a,b){d=ccs._load(a,"ccui")});b=new ccs.ComRender(d,"GUIComponent");a.addComponent(b);return b},CCScene:function(){}},e={},f=function(a,b,c){if(null!=a){var d=a.path,f=a.resourceType;a=a.plist;d&&(a&&(cc.loader.getRes(b+a)?(e[b+a]=!0,cc.spriteFrameCache.addSpriteFrames(b+a)):e[b+a]||cc.log("%s need to be preloaded",b+a)),0!==f?c(d,f):c(b+d,f))}};
c.parseComponents=function(a,b,c){a&&b&&b.forEach(function(b){var e=d[b.classname],f=null;e?f=e(a,b,c):cc.log("Can't find the component parser : %s",b.classname);b=b.name;f&&b&&f.setName(b)})};c.registerParser("CCNode",function(a,b){var c=new cc.Node;this.setPropertyFromJsonDict(c,a);this.parseChild.call(this,c,a.gameobjects,b);this.parseComponents(c,a.components,b);var d=a.CanvasSize;d&&c.setContentSize(cc.size(d._width,d._height));return c});a.registerParser("scene","*",c)})(ccs._load,ccs._parser);(function(a,b){var c=Array(50),d=new (b.extend({addSpriteFrame:function(a,b){if(a)for(var c=0;c<a.length;c++)cc.spriteFrameCache.addSpriteFrames(b+a[c])},pretreatment:function(a,b){this.addSpriteFrame(a.textures,b)},parseRecursive:function(a,b){var d=1,e=null,f,r,s,t,w;for(c[0]=a;0<d;)if(d--,r=c[d],c[d]=null,r)if(s=r.classname,f=this.parsers[s]){if(s=new f.object)if(e||(e=s),t=r.options,this.generalAttributes(s,t),f.handle(s,t,b),this.colorAttributes(s,t),f=r.parent,r.parent=null,f instanceof ccui.PageView?
f.addPage(s):f instanceof ccui.ListView?f.pushBackCustomItem(s):f&&(f instanceof ccui.Layout||(s.getPositionType()===ccui.Widget.POSITION_PERCENT&&(t=s._positionPercent,w=f._anchorPoint,s._positionPercent.x=t.x+w.x,s._positionPercent.y=t.y+w.y),t=f._renderCmd._anchorPointInPoints,s._position.x+=t.x,s._position.y+=t.y,s.setNodeDirty()),f.addChild(s)),(r=r.children)&&0<r.length)for(f=r.length-1;0<=f;f--)c[d]=r[f],c[d].parent=s,d++}else cc.log("Can't find the parser : %s",s);return e},parse:function(a,
b,c){c=c||this._dirname(a);this.pretreatment(b,c);var d=this.parseRecursive(b.widgetTree,c);d&&this.deferred(b,c,d,a);return d},deferred:function(a,b,c,d){c&&(ccs.actionManager.initWithDictionary(d,a.animation,c),c.setContentSize(a.designWidth,a.designHeight))}}));d.generalAttributes=function(a,b){a._ignoreSize=b.ignoreSize||!0;a._sizeType=b.sizeType||0;a._positionType=b.positionType||0;a._sizePercent.x=b.sizePercentX||0;a._sizePercent.y=b.sizePercentY||0;a._positionPercent.x=b.positionPercentX||
0;a._positionPercent.y=b.positionPercentY||0;var c=0,d=0;b.adaptScreen?(d=cc.director.getWinSize(),c=d.width,d=d.height):(c=b.width||0,d=b.height||0);var e=b.anchorPointX,f=b.anchorPointY;a._anchorPoint.x=isNaN(e)?0.5:e;a._anchorPoint.y=isNaN(f)?0.5:f;a.setContentSize(c,d);a.setTag(b.tag);a.setActionTag(b.actiontag);a.setTouchEnabled(b.touchAble);a._name=b.name||"default";a._position.x=b.x||0;a._position.y=b.y||0;a._scaleX=b.scaleX||1;a._scaleY=b.scaleY||1;a._rotationX=a._rotationY=b.rotation||0;
a._visible=b.visible||!1;a._localZOrder=b.ZOrder||0;if(null!=b.layoutParameter){c=b.layoutParameter;d=null;switch(isNaN(c.type)?2:c.type){case 1:d=new ccui.LinearLayoutParameter;d._linearGravity=c.gravity||0;break;case 2:d=new ccui.RelativeLayoutParameter,d._relativeLayoutName=c.relativeName,d._relativeWidgetName=c.relativeToName,d._relativeAlign=c.align||0}null!=d&&(e=d._margin,e.left=c.marginLeft||0,e.top=c.marginTop||0,e.right=c.marginRight||0,e.bottom=c.marginDown||0,a.setLayoutParameter(d))}};
d.colorAttributes=function(a,b){var c=null!==b.opacity?b.opacity:255;null!=c&&a.setOpacity(c);var c=b.colorR,d=b.colorG,e=b.colorB;a.setColor(cc.color(null==c?255:c,null==d?255:d,null==e?255:e));a.setFlippedX(b.flipX);a.setFlippedY(b.flipY)};var e=function(a,b,c,d){c&&(0===b?d(a+c,b):d(c,b))};d.LayoutAttributes=function(a,b,c){var d=0,f=0;b.adaptScreen?(f=cc.director.getWinSize(),d=f.width,f=f.height):(d=b.width||0,f=b.height||0);a.setSize(cc.size(d,f));a.setClippingEnabled(b.clipAble);d=b.backGroundScale9Enable;
a.setBackGroundImageScale9Enabled(d);var f=b.bgColorR||0,r=b.bgColorG||0,s=b.bgColorB||0,t=isNaN(b.bgStartColorR)?255:b.bgStartColorR,w=isNaN(b.bgStartColorG)?255:b.bgStartColorG,v=isNaN(b.bgStartColorB)?255:b.bgStartColorB,y=isNaN(b.bgEndColorR)?255:b.bgEndColorR,x=isNaN(b.bgEndColorG)?255:b.bgEndColorG,u=isNaN(b.bgEndColorB)?255:b.bgEndColorB;a.setBackGroundColorVector(cc.p(b.vectorX||0,b.vectorY||0));var z=b.bgColorOpacity||0;a.setBackGroundColorType(b.colorType||0);a.setBackGroundColor(cc.color(t,
w,v),cc.color(y,x,u));a.setBackGroundColor(cc.color(f,r,s));a.setBackGroundColorOpacity(z);(f=b.backGroundImageData)&&e(c,f.resourceType||0,f.path,function(b,c){a.setBackGroundImage(b,c)});d&&(c=b.capInsetsX||0,d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth,r=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight,a.setBackGroundImageCapInsets(cc.rect(c,d,f,r)));b.layoutType&&a.setLayoutType(b.layoutType)};d.ButtonAttributes=function(a,b,c){var d=b.scale9Enable;a.setScale9Enabled(d);var f=b.normalData;
e(c,f.resourceType||0,f.path,function(b,c){a.loadTextureNormal(b,c)});f=b.pressedData;e(c,f.resourceType||0,f.path,function(b,c){a.loadTexturePressed(b,c)});f=b.disabledData;e(c,f.resourceType||0,f.path,function(b,c){a.loadTextureDisabled(b,c)});if(d){c=b.capInsetsX||0;var d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth,r=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight;a.setCapInsets(cc.rect(c,d,f,r));c=b.scale9Width||0;d=b.scale9Height||0;null!=c&&null!=d&&a.setSize(cc.size(c,d))}if(c=
b.text||"")a.setTitleText(c),a.setTitleColor(cc.color(null!==b.textColorR?b.textColorR:255,null!==b.textColorG?b.textColorG:255,null!==b.textColorB?b.textColorB:255)),null!=b.fontSize&&a.setTitleFontSize(b.fontSize),b.fontName&&a.setTitleFontName(b.fontName)};d.CheckBoxAttributes=function(a,b,c){var d=b.backGroundBoxData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTextureBackGround(b,c)});var f=b.backGroundBoxSelectedData;e(c,f.resourceType||d.resourceType,f.path||d.path,function(b,c){a.loadTextureBackGroundSelected(b,
c)});d=b.frontCrossData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTextureFrontCross(b,c)});f=b.backGroundBoxDisabledData;e(c,f.resourceType||d.resourceType,f.path||d.path,function(b,c){a.loadTextureBackGroundDisabled(b,c)});d=b.frontCrossDisabledData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTextureFrontCrossDisabled(b,c)});b.selectedState&&a.setSelected(b.selectedState)};d.ImageViewAttributes=function(a,b,c){var d=b.fileNameData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTexture(b,
c)});c=!1;b.scale9Enable&&(c=b.scale9Enable);a.setScale9Enabled(c);if(c){c=b.scale9Height||0;b.scale9Width&&c&&a.setSize(cc.size(b.scale9Width||0,b.scale9Height||0));c=b.capInsetsX||0;var d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth;b=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight;a.setCapInsets(cc.rect(c,d,f,b))}};d.TextAtlasAttributes=function(a,b,c){var d=b.stringValue,e=b.charMapFileData,f=b.itemWidth,s=b.itemHeight,t=b.startCharMap;if(null!=d&&e&&null!=f&&null!=s&&null!=t)switch(b=
b.charMapFileData,b.resourceType||0){case 0:a.setProperty(d,c+b.path,f,s,t);break;case 1:cc.log("Wrong res type of LabelAtlas!")}};d.TextBMFontAttributes=function(a,b,c){var d=b.fileNameData;switch(d.resourceType||0){case 0:a.setFntFile(c+d.path);break;case 1:cc.log("Wrong res type of LabelAtlas!")}a.setString(b.text||"")};var f=/\.ttf$/;d.TextAttributes=function(a,b,c){a.setTouchScaleChangeEnabled(b.touchScaleEnable);var d=b.text||"";d&&a._setString(d);null!=b.fontSize&&a._setFontSize(b.fontSize);
d=b.fontName;null!=d&&(cc.sys.isNative?f.test(d)?a.setFontName(cc.path.join(cc.loader.resPath,c,d)):a.setFontName(d):a._setFontName(d.replace(f,"")));c=b.areaHeight||0;b.areaWidth&&c&&(c=cc.size(b.areaWidth,b.areaHeight),a._setTextAreaSize(c));c=b.hAlignment||0;null!=c&&a._setTextHorizontalAlignment(c);b=b.vAlignment||0;null!=b&&a._setTextVerticalAlignment(b);a._updateUITextContentSize()};d.ListViewAttributes=function(a,b,c){d.ScrollViewAttributes(a,b,c);a.setDirection(b.direction||1);a.setGravity(b.gravity||
0);a.setItemsMargin(b.itemMargin||0)};d.LoadingBarAttributes=function(a,b,c){var d=b.textureData;e(c,d.resourceType||0,d.path,function(b,c){a.loadTexture(b,c)});c=b.scale9Enable;a.setScale9Enabled(c);if(c){c=b.capInsetsX||0;var d=b.capInsetsY||0,f=isNaN(b.capInsetsWidth)?1:b.capInsetsWidth,r=isNaN(b.capInsetsHeight)?1:b.capInsetsHeight;a.setCapInsets(cc.rect(c,d,f,r));a.setSize(cc.size(b.width||0,b.height||0))}a.setDirection(b.direction||0);a.setPercent(b.percent||0)};d.PageViewAttributes=d.LayoutAttributes;
d.ScrollViewAttributes=function(a,b,c){d.LayoutAttributes(a,b,c);a.setInnerContainerSize(cc.size(null!=b.innerWidth?b.innerWidth:200,null!=b.innerHeight?b.innerHeight:200));a.setDirection(null!=b.direction?b.direction:1);a.setBounceEnabled(b.bounceEnable)};d.SliderAttributes=function(a,b,c){var d=b.scale9Enable;a.setScale9Enabled(d);var f=b.length,r=b.barFileNameData,s=r.resourceType||0,r=r.path;null!=b.barFileName?d&&(e(c,s,r,function(b,c){a.loadBarTexture(b,c)}),a.setSize(cc.size(f,a.getContentSize().height))):
e(c,s,r,function(b,c){a.loadBarTexture(b,c)});d=b.ballNormalData;e(c,d.resourceType||0,d.path,function(b,c){a.loadSlidBallTextureNormal(b,c)});f=b.ballPressedData;e(c,f.resourceType||d.resourceType,f.path||d.path,function(b,c){a.loadSlidBallTexturePressed(b,c)});d=b.ballDisabledData;e(c,d.resourceType||0,d.path,function(b,c){a.loadSlidBallTextureDisabled(b,c)});b=b.progressBarData;e(c,b.resourceType||0,b.path,function(b,c){a.loadProgressBarTexture(b,c)})};d.TextFieldAttributes=function(a,b,c){var d=
b.placeHolder||"";d&&a.setPlaceHolder(d);a.setString(b.text||"");(d=b.fontSize)&&a.setFontSize(d);d=b.fontName;null!=d&&(cc.sys.isNative?f.test(d)?a.setFontName(cc.path.join(cc.loader.resPath,c,d)):a.setFontName(d):a.setFontName(d.replace(f,"")));c=b.touchSizeWidth||0;d=b.touchSizeHeight||0;null!=c&&null!=d&&a.setTouchSize(c,d);c=b.maxLengthEnable;a.setMaxLengthEnabled(c);c&&a.setMaxLength(b.maxLength);c=b.passwordEnable;a.setPasswordEnabled(c);c&&a.setPasswordStyleText(b.passwordStyleText);c=b.areaWidth||
0;d=b.areaHeight||0;c&&d&&(c=cc.size(c,d),a.setTextAreaSize(c));(c=b.hAlignment||0)&&a.setTextHorizontalAlignment(c);(c=b.vAlignment||0)&&a.setTextVerticalAlignment(c);c=isNaN(b.colorR)?255:b.colorR;d=isNaN(b.colorG)?255:b.colorG;b=isNaN(b.colorB)?255:b.colorB;a.setTextColor(cc.color(c,d,b))};d.parsers={Panel:{object:ccui.Layout,handle:d.LayoutAttributes},Button:{object:ccui.Button,handle:d.ButtonAttributes},CheckBox:{object:ccui.CheckBox,handle:d.CheckBoxAttributes},ImageView:{object:ccui.ImageView,
handle:d.ImageViewAttributes},LabelAtlas:{object:ccui.TextAtlas,handle:d.TextAtlasAttributes},LabelBMFont:{object:ccui.TextBMFont,handle:d.TextBMFontAttributes},Label:{object:ccui.Text,handle:d.TextAttributes},ListView:{object:ccui.ListView,handle:d.ListViewAttributes},LoadingBar:{object:ccui.LoadingBar,handle:d.LoadingBarAttributes},PageView:{object:ccui.PageView,handle:d.PageViewAttributes},ScrollView:{object:ccui.ScrollView,handle:d.ScrollViewAttributes},Slider:{object:ccui.Slider,handle:d.SliderAttributes},
TextField:{object:ccui.TextField,handle:d.TextFieldAttributes}};a.registerParser("ccui","*",d)})(ccs._load,ccs._parser);(function(a,b){var c=new (b.extend({getNodeJson:function(a){return a.action},parseNode:function(a,b,c){if(!a)return null;var h=this,k=new ccs.ActionTimeline;k.setDuration(a.duration);k.setTimeSpeed(a.speed||1);a.timelines.forEach(function(a){var c=h.parsers[a.frameType],d;c?d=c.call(h,a,b):cc.log("parser does not exist : %s",a.frameType);d&&k.addTimeline(d);"ColorFrame"===a.frameType&&k.addTimeline(h.parsers.AlphaFrame.call(h,a,b))});return k}}));[{name:"PositionFrame",handle:function(a){var b=new ccs.PositionFrame;
b.setPosition(cc.p(a.x,a.y));return b}},{name:"VisibleFrame",handle:function(a){var b=new ccs.VisibleFrame;b.setVisible(a.value);return b}},{name:"ScaleFrame",handle:function(a){var b=new ccs.ScaleFrame,c=a.y;b.setScaleX(a.x);b.setScaleY(c);return b}},{name:"RotationFrame",handle:function(a){var b=new ccs.RotationFrame;b.setRotation(a.rotation);return b}},{name:"SkewFrame",handle:function(a){var b=new ccs.SkewFrame,c=a.y;b.setSkewX(a.x);b.setSkewY(c);return b}},{name:"RotationSkewFrame",handle:function(a){var b=
new ccs.RotationSkewFrame,c=a.y;b.setSkewX(a.x);b.setSkewY(c);return b}},{name:"AnchorFrame",handle:function(a){var b=new ccs.AnchorPointFrame;b.setAnchorPoint(cc.p(a.x,a.y));return b}},{name:"InnerActionFrame",handle:function(a){var b=new ccs.InnerActionFrame,c=a.startFrame;b.setInnerActionType(a.innerActionType);b.setStartFrameIndex(c);return b}},{name:"ColorFrame",handle:function(a){var b=new ccs.ColorFrame;b.setColor(cc.color(a.red,a.green,a.blue));(new ccs.AlphaFrame).setAlpha(a.alpha);return b}},
{name:"AlphaFrame",handle:function(a){var b=new ccs.AlphaFrame;b.setAlpha(a.alpha);return b}},{name:"TextureFrame",handle:function(a){var b=new ccs.TextureFrame;a=a.value;if(null!=a){var c=a;null==cc.spriteFrameCache.getSpriteFrame(c)&&(c=ccs.csLoader.getJsonPath()+a);b.setTextureName(c)}return b}},{name:"EventFrame",handle:function(a){var b=new ccs.EventFrame;a=a.value;null!=a&&b.setEvent(a);return b}},{name:"ZOrderFrame",handle:function(a){var b=new ccs.ZOrderFrame;b.setZOrder(a.value);return b}}].forEach(function(a){c.registerParser(a.name,
function(b,c){var h=new ccs.Timeline;h.setActionTag(b.actionTag);var k=b.frames;k&&k.length&&k.forEach(function(b){var c=a.handle(b);c.setFrameIndex(b.frameIndex);c.setTween(b.tween);h.addFrame(c)});return h})});a.registerParser("action","0.*",c);a.registerParser("action","1.*",c)})(ccs._load,ccs._parser);(function(a,b){var c=new (b.extend({getNodeJson:function(a){return a.Content.Content.Animation},parseNode:function(a,b,c){if(!a)return null;var d=this,m=new ccs.ActionTimeline;m.setDuration(a.Duration);m.setTimeSpeed(a.Speed||1);a.Timelines.forEach(function(a){var c=d.parsers[a.Property],e;c?e=c.call(d,a,b):cc.log("parser does not exist : %s",a.Property);e&&m.addTimeline(e)});return m},deferred:function(a,b,c,d){b=(a=a.Content.Content.AnimationList)?a.length:0;for(d=0;d<b;d++){var m=a[d],n={name:null,
startIndex:null,endIndex:null};n.name=m.Name;n.startIndex=m.StartIndex;n.endIndex=m.EndIndex;c.addAnimationInfo(n)}}})),d=function(a,b){a.setTweenType(b.Type);var c=b.Points,d=[];c&&(c.forEach(function(a){d.push(a.X);d.push(a.Y)}),a.setEasingParams(d))};[{name:"Position",handle:function(a){var b=new ccs.PositionFrame;b.setPosition(cc.p(a.X,a.Y));return b}},{name:"VisibleForFrame",handle:function(a){var b=new ccs.VisibleFrame;b.setVisible(a.Value);return b}},{name:"Scale",handle:function(a){var b=
new ccs.ScaleFrame,c=a.Y;b.setScaleX(a.X);b.setScaleY(c);return b}},{name:"Rotation",handle:function(a){var b=new ccs.RotationFrame;b.setRotation(a.Rotation||a.Value||0);return b}},{name:"Skew",handle:function(a){var b=new ccs.SkewFrame,c=a.Y;b.setSkewX(a.X);b.setSkewY(c);return b}},{name:"RotationSkew",handle:function(a){var b=new ccs.RotationSkewFrame,c=a.Y;b.setSkewX(a.X);b.setSkewY(c);return b}},{name:"Anchor",handle:function(a){var b=new ccs.AnchorPointFrame;b.setAnchorPoint(cc.p(a.X,a.Y));return b}},
{name:"AnchorPoint",handle:function(a){var b=new ccs.AnchorPointFrame;b.setAnchorPoint(cc.p(a.X,a.Y));return b}},{name:"InnerAction",handle:function(a){var b=new ccs.InnerActionFrame,c=a.StartFrame;b.setInnerActionType(a.InnerActionType);b.setStartFrameIndex(c);return b}},{name:"CColor",handle:function(a){var b=new ccs.ColorFrame;(a=a.Color)||(a={});a.R=void 0===a.R?255:a.R;a.G=void 0===a.G?255:a.G;a.B=void 0===a.B?255:a.B;b.setColor(cc.color(a.R,a.G,a.B));return b}},{name:"Alpha",handle:function(a){var b=
new ccs.AlphaFrame;b.setAlpha(a.Value);return b}},{name:"FileData",handle:function(a,b){var c,d,m,n;c=new ccs.TextureFrame;d=a.TextureFile;null!=d&&(m=d.Plist,d=d.Path,n=cc.spriteFrameCache.getSpriteFrame(d),!n&&m&&(cc.loader.getRes(b+m)?(cc.spriteFrameCache.addSpriteFrames(b+m),n=cc.spriteFrameCache.getSpriteFrame(d)):cc.log("%s need to be preloaded",b+m)),null==n&&(d=b+d),c.setTextureName(d));return c}},{name:"FrameEvent",handle:function(a){var b=new ccs.EventFrame;a=a.Value;null!=a&&b.setEvent(a);
return b}},{name:"ZOrder",handle:function(a){var b=new ccs.ZOrderFrame;b.setZOrder(a.Value);return b}},{name:"ActionValue",handle:function(a){var b=new ccs.InnerActionFrame,c=a.InnerActionType,d=a.CurrentAniamtionName,m=a.SingleFrameIndex;a=a.FrameIndex;void 0!==a&&b.setFrameIndex(a);b.setInnerActionType(ccs.InnerActionType[c]);b.setSingleFrameIndex(m);b.setEnterWithName(!0);d&&b.setAnimationName(d);return b}},{name:"BlendFunc",handle:function(a){var b=new ccs.BlendFuncFrame;(a=a.BlendFunc)&&void 0!==
a.Src&&void 0!==a.Dst&&b.setBlendFunc(new cc.BlendFunc(a.Src,a.Dst));return b}}].forEach(function(a){c.registerParser(a.name,function(b,c){var k=new ccs.Timeline;k.setActionTag(b.ActionTag);var m=b.Frames;m&&m.length&&m.forEach(function(b){var f=a.handle(b,c);f.setFrameIndex(b.FrameIndex);f.setTween(null!=b.Tween?b.Tween:!0);(b=b.EasingData)&&d(f,b);k.addFrame(f)});return k})});a.registerParser("action","2.*",c);a.registerParser("action","*",c)})(ccs._load,ccs._parser);(function(a,b){var c={},d=new (b.extend({getNodeJson:function(a){return a.nodeTree},addSpriteFrame:function(a,b,d){if(a&&b&&a.length===b.length)for(var e=0;e<a.length;e++){var n=d+a[e];cc.loader.getRes(n)||c[n]?c[n]=!0:cc.log("%s need to be preloaded",n);cc.spriteFrameCache.addSpriteFrames(n,d+b[e])}},pretreatment:function(a,b,c){this.addSpriteFrame(a.textures,a.texturesPng,b)}}));d.generalAttributes=function(a,b){var c=null!=b.width?b.width:0,d=null!=b.height?b.height:0,e=null!=b.x?b.x:0,p=null!=
b.y?b.y:0,r=null!=b.scaleX?b.scaleX:1,s=null!=b.scaleY?b.scaleY:1,t=null!=b.rotation?b.rotation:0,w=null!=b.rotationSkewX?b.rotationSkewX:0,v=null!=b.rotationSkewY?b.rotationSkewY:0,y=null!=b.skewX?b.skewX:0,x=null!=b.skewY?b.skewY:0,u=null!=b.anchorPointX?b.anchorPointX:0.5,z=null!=b.anchorPointY?b.anchorPointY:0.5,A=null!=b.opacity?b.opacity:255,B=null!=b.colorR?b.colorR:255,D=null!=b.colorG?b.colorG:255,C=null!=b.colorB?b.colorB:255,E=null!=b.colorR?b.colorR:0,J=null!=b.tag?b.tag:0,G=null!=b.actionTag?
b.actionTag:0,H=null!=b.visible?b.visible:!0;0==e&&0==p||a.setPosition(cc.p(e,p));1!=r&&a.setScaleX(r);1!=s&&a.setScaleY(s);0!=t&&a.setRotation(t);0!=w&&a.setRotationX(w);0!=v&&a.setRotationY(v);0!=y&&a.setSkewX(y);0!=x&&a.setSkewY(x);0.5==u&&0.5==z||a.setAnchorPoint(cc.p(u,z));0==c&&0==d||a.setContentSize(cc.size(c,d));0!=E&&a.setLocalZOrder(E);!0!=H&&a.setVisible(H);255!=A&&a.setOpacity(A);255==B&&255==D&&255==C||a.setColor(cc.color(B,D,C));a.setTag(J);a.setUserObject(new ccs.ActionTimelineData(G))};
d.parseComponent=function(a,b){if(b)for(var c=0;c<b.length;++c){var d=this.loadComponent(b[c]);d&&a.addComponent(d)}};d.parseChild=function(a,b,c,d){a=c.children;for(c=0;c<a.length;c++){var e=this.parseNode(a[c],d);if(e)if(b instanceof ccui.PageView)e instanceof ccui.Layout&&b.addPage(e);else if(b instanceof ccui.ListView)e instanceof ccui.Widget&&b.pushBackCustomItem(e);else{if(!(b instanceof ccui.Layout)&&e instanceof ccui.Widget){if(e.getPositionType()===ccui.Widget.POSITION_PERCENT){var p=e.getPositionPercent(),
r=b.getAnchorPoint();e.setPositionPercent(cc.p(p.x+r.x,p.y+r.y))}p=b.getAnchorPointInPoints();e.setPosition(cc.p(e.getPositionX()+p.x,e.getPositionY()+p.y))}b.addChild(e)}}};d.initNode=function(a){var b=new cc.Node;this.generalAttributes(b,a);return b};d.initSubGraph=function(a){var b=a.fileName,b=b&&""!==b?this.createNode(b):new ccs.Node;this.generalAttributes(b,a);return b};d.initSprite=function(a,b){var c=a.fileName;if(null!=c){var d=cc.spriteFrameCache.getSpriteFrame(c),c=d?ccs.Sprite.createWithSpriteFrame(d):
new ccs.Sprite(b+c);c||(c=new cc.Sprite,cc.log("filePath is empty. Create a sprite with no texture"))}else c=new ccs.Sprite;this.generalAttributes(c,a);var d=a.flipX,e=a.flipY;!1!=d&&c.setFlippedX(d);!1!=e&&c.setFlippedY(e);return c};d.initParticle=function(a,b){var c=a.tmxFile,d=new cc.ParticleSystemQuad(a.plistFile);d.setTotalParticles(c);this.generalAttributes(d,a);return d};d.initTMXTiledMap=function(a,b){var c=a.tmxFile,d=a.tmxString,e=a.resourcePath,p=null;c&&""!==c?p=new cc.TMXTiledMap(c):
d&&""!==d&&e&&""!==e&&(p=new cc.TMXTiledMap(d,e));return p};var e=a.getParser("ccui")["*"];d.initWidget=function(a,b){var c=a.classname,d=e.parsers[c];if(!d)return cc.log("%s parser is not found",c);if(c=d.call(e,a,b)){var d=a.rotationSkewX,n=a.rotationSkewY,p=a.skewX,r=a.skewY;0!=d&&c.setRotationX(d);0!=n&&c.setRotationY(n);0!=p&&c.setSkewX(p);0!=r&&c.setSkewY(r);c.setUserObject(new ccs.ActionTimelineData(a.actionTag))}return c};[{name:"Node",handle:d.initNode},{name:"SubGraph",handle:d.initSubGraph},
{name:"Sprite",handle:d.initSprite},{name:"Particle",handle:d.initParticle},{name:"TMXTiledMap",handle:d.initTMXTiledMap},{name:"Widget",handle:d.initWidget},{name:"Panel",handle:d.initWidget},{name:"Button",handle:d.initWidget},{name:"CheckBox",handle:d.initWidget},{name:"ImageView",handle:d.initWidget},{name:"LabelAtlas",handle:d.initWidget},{name:"LabelBMFont",handle:d.initWidget},{name:"Label",handle:d.initWidget},{name:"ListView",handle:d.initWidget},{name:"LoadingBar",handle:d.initWidget},{name:"PageView",
handle:d.initWidget},{name:"ScrollView",handle:d.initWidget},{name:"Slider",handle:d.initWidget},{name:"TextField",handle:d.initWidget}].forEach(function(a){d.registerParser(a.name,function(b,c,d){var e=a.handle.call(this,b.options);this.parseComponent(e,b.components);this.parseChild(c,e,b,d);return e})});a.registerParser("timeline","0.*",d);a.registerParser("timeline","1.*",d)})(ccs._load,ccs._parser);(function(a,b){var c=new (b.extend({parse:function(a,b,c){c=void 0!==c?c:this._dirname(a);this.pretreatment(b,c,a);var d=this.parseNode(this.getNodeJson(b),c);this.deferred(b,c,d,a);return d},getNodeJson:function(a){a=a.Content;return a.ObjectData?a.ObjectData:a.Content.ObjectData},getClass:function(a){return a.ctype}})),d=function(a,b){return void 0===a?b:a};c.generalAttributes=function(a,b){null!=b.Name&&a.setName(b.Name);var c=b.Position;null==c||null==c.X&&null==c.Y||a.setPosition(cc.p(c.X||0,
c.Y||0));c=b.Scale;null!=c&&(null!=c.ScaleX&&a.setScaleX(c.ScaleX),null!=c.ScaleY&&a.setScaleY(c.ScaleY));c=b.RotationSkewX;null!=c&&a.setRotationX(c);c=b.RotationSkewY;null!=b.RotationSkewY&&a.setRotationY(c);c=b.AnchorPoint;null!=c&&(null==c.ScaleX&&(c.ScaleX=0),null==c.ScaleY&&(c.ScaleY=0),0.5==c.ScaleX&&0.5==c.ScaleY||a.setAnchorPoint(cc.p(c.ScaleX,c.ScaleY)));null!=b.ZOrder&&a.setLocalZOrder(b.ZOrder);c=d(b.VisibleForFrame,!0);a.setVisible(c);(c=b.Size)&&s(a,c);null!=b.Alpha&&a.setOpacity(b.Alpha);
a.setTag(b.Tag||0);var c=b.ActionTag||0,e=new ccs.ComExtensionData,h=b.UserData;void 0!==h&&e.setCustomProperty(h);e.setActionTag(c);a.getComponent("ComExtensionData")&&a.removeComponent("ComExtensionData");a.addComponent(e);a.setCascadeColorEnabled(!0);a.setCascadeOpacityEnabled(!0);f(a,b)};c.parseChild=function(a,b,c){if(a&&b)for(var d=0;d<b.length;d++){var e=this.parseNode(b[d],c);if(e)if(a instanceof ccui.PageView)e instanceof ccui.Layout&&a.addPage(e);else if(a instanceof ccui.ListView)e instanceof
ccui.Widget&&a.pushBackCustomItem(e);else{if(!(a instanceof ccui.Layout)&&e instanceof ccui.Widget&&e.getPositionType()===ccui.Widget.POSITION_PERCENT){var f=e.getPositionPercent(),h=a.getAnchorPoint();e.setPositionPercent(cc.p(f.x+h.x,f.y+h.y))}a.addChild(e)}}};c.initSingleNode=function(a){var b=new cc.Node;this.generalAttributes(b,a);a=a.CColor;null!=a&&b.setColor(r(a));return b};c.initSprite=function(a,b){var c=new cc.Sprite;p(a.FileData,b,function(a,b){if(0===b)c.setTexture(a);else if(1===b){var d=
cc.spriteFrameCache.getSpriteFrame(a);d&&c.setSpriteFrame(d)}});var d=a.BlendFunc;if(a.BlendFunc){var e=cc.BlendFunc.ALPHA_PREMULTIPLIED;void 0!==d.Src&&(e.src=d.Src);void 0!==d.Dst&&(e.dst=d.Dst);c.setBlendFunc(e)}a.FlipX&&c.setFlippedX(!0);a.FlipY&&c.setFlippedY(!0);this.generalAttributes(c,a);d=a.CColor;null!=d&&c.setColor(r(d));return c};c.initParticle=function(a,b){var c,d=this;p(a.FileData,b,function(b,e){cc.loader.getRes(b)||cc.log("%s need to be preloaded",b);c=new cc.ParticleSystem(b);d.generalAttributes(c,
a);c.setPositionType(cc.ParticleSystem.TYPE_GROUPED);!cc.sys.isNative&&c.setDrawMode(cc.ParticleSystem.TEXTURE_MODE);var f=a.BlendFunc;if(a.BlendFunc){var h=cc.BlendFunc.ALPHA_PREMULTIPLIED;void 0!==f.Src&&(h.src=f.Src);void 0!==f.Dst&&(h.dst=f.Dst);c.setBlendFunc(h)}});return c};c.widgetAttributes=function(a,b,c){a.setCascadeColorEnabled(!0);a.setCascadeOpacityEnabled(!0);a.setUnifySizeEnabled(!1);a.ignoreContentAdaptWithSize(!1);!c&&s(a,b.Size);(c=b.Name)&&a.setName(c);c=b.ActionTag||0;a.setActionTag(c);
var h=new ccs.ComExtensionData,k=b.UserData;void 0!==k&&h.setCustomProperty(k);h.setActionTag(c);a.getComponent("ComExtensionData")&&a.removeComponent("ComExtensionData");a.addComponent(h);(c=b.RotationSkewX)&&a.setRotationX(c);(c=b.RotationSkewY)&&a.setRotationY(c);b.FlipX&&a.setFlippedX(!0);b.FlipY&&a.setFlippedY(!0);c=b.zOrder;null!=c&&a.setLocalZOrder(c);c=d(b.VisibleForFrame,!0);a.setVisible(c);c=b.Alpha;null!=c&&a.setOpacity(c);a.setTag(b.Tag||0);a.setTouchEnabled(b.TouchEnable||!1);c=b.CallBackType;
null!=c&&a.setCallbackType(c);(c=b.CallBackName)&&a.setCallbackName(c);c=b.Position;null!=c&&a.setPosition(c.X||0,c.Y||0);h=b.Scale;null!=h&&(c=d(h.ScaleX,1),h=d(h.ScaleY,1),a.setScaleX(c),a.setScaleY(h));c=b.AnchorPoint;null!=c&&a.setAnchorPoint(c.ScaleX||0,c.ScaleY||0);c=b.CColor;null!=c&&a.setColor(r(c));f(a,b);e(a,b)};var e=function(a,b){var c=b.CallBackType,d=b.CallBackName,e=function(b){if("function"===typeof a[d])a[d](b)};"Click"===c?a.addClickEventListener(e):"Touch"===c?a.addTouchEventListener(e):
"Event"===c&&a.addCCSEventListener(e)},f=function(a,b){var c=ccui.LayoutComponent.bindLayoutComponent(a);if(c){var d=b.PositionPercentXEnable||b.PositionPercentXEnabled||!1,e=b.PositionPercentYEnable||b.PositionPercentYEnabled||!1,f=0,h=0,k=b.PrePosition;null!=k&&(f=k.X||0,h=k.Y||0);var m=b.PercentWidthEnable||b.PercentWidthEnabled||!1,n=b.PercentHeightEnable||b.PercentHeightEnabled||!1,p=0,r=0,s=b.PreSize;null!=k&&(p=s.X||0,r=s.Y||0);var G=b.StretchWidthEnable||!1,H=b.StretchHeightEnable||!1,L=b.HorizontalEdge,
k=b.VerticalEdge,s=b.LeftMargin||0,I=b.RightMargin||0,M=b.TopMargin||0,F=b.BottomMargin||0;c.setPositionPercentXEnabled(d);c.setPositionPercentYEnabled(e);c.setPositionPercentX(f);c.setPositionPercentY(h);c.setPercentWidthEnabled(m);c.setPercentHeightEnabled(n);c.setPercentWidth(p);c.setPercentHeight(r);c.setPercentWidthEnabled(m||n);c.setStretchWidthEnabled(G);c.setStretchHeightEnabled(H);d=ccui.LayoutComponent.horizontalEdge.NONE;"LeftEdge"===L?d=ccui.LayoutComponent.horizontalEdge.LEFT:"RightEdge"===
L?d=ccui.LayoutComponent.horizontalEdge.RIGHT:"BothEdge"===L&&(d=ccui.LayoutComponent.horizontalEdge.CENTER);c.setHorizontalEdge(d);d=ccui.LayoutComponent.verticalEdge.NONE;"TopEdge"===k?d=ccui.LayoutComponent.verticalEdge.TOP:"BottomEdge"===k?d=ccui.LayoutComponent.verticalEdge.BOTTOM:"BothEdge"===k&&(d=ccui.LayoutComponent.verticalEdge.CENTER);c.setVerticalEdge(d);c.setTopMargin(M);c.setBottomMargin(F);c.setLeftMargin(s);c.setRightMargin(I);c.setVerticalEdge(d);c.setTopMargin(M);c.setBottomMargin(F);
c.setLeftMargin(s);c.setRightMargin(I)}},h=function(a,b,c,d){2===a.getBackGroundColorType()?(c=c||{},d=d||{},a.setBackGroundColor(r(c),r(d))):(b=b||{},a.setBackGroundColor(r(b)))},k=function(a,b){a.setBackGroundColorVector(cc.p(b.ScaleX||0,b.ScaleY||0))};c.initPanel=function(a,b){var c=new ccui.Layout;this.widgetAttributes(c,a);var e=a.ClipAble||!1;null!=e&&c.setClippingEnabled(e);e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);e=d(a.BackColorAlpha,255);null!=e&&c.setBackGroundColorOpacity(e);
e=a.Scale9Enable;null!=e&&c.setBackGroundImageScale9Enabled(e);var f=d(a.Alpha,255);c.setOpacity(f);p(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});e?(c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)),s(c,a.Size)):c.isIgnoreContentAdaptWithSize()||s(c,a.Size);h(c,a.SingleColor,a.FirstColor,a.EndColor);k(c,a.ColorVector);return c};c.initText=function(a,b){var c=new ccui.Text,e=a.TouchScaleChangeAble;null!=e&&c.setTouchScaleChangeEnabled(e);
e=a.LabelText;null!=e&&c.setString(e);e=a.FontSize;null!=e&&c.setFontSize(e);e=a.FontName;null!=e&&c.setFontName(e);var e=a.AreaWidth,f=a.areaHeight;e&&f&&c.setTextAreaSize(cc.size(e,f));e=a.HorizontalAlignmentType||"HT_Left";switch(e){case "HT_Right":e=2;break;case "HT_Center":e=1;break;default:e=0}c.setTextHorizontalAlignment(e);e=a.VerticalAlignmentType||"VT_Top";switch(e){case "VT_Bottom":e=2;break;case "VT_Center":e=1;break;default:e=0}c.setTextVerticalAlignment(e);e=a.FontResource;null!=e&&
(e=e.Path,null!=e&&(e=cc.sys.isNative?cc.path.join(cc.loader.resPath,b,e):(e=e.match(/([^\/]+)\.(\S+)/))?e[1]:"",c.setFontName(e)));a.OutlineEnabled&&a.OutlineColor&&c.enableOutline&&c.enableOutline(r(a.OutlineColor),d(a.OutlineSize,1));a.ShadowEnabled&&a.ShadowColor&&c.enableShadow&&c.enableShadow(r(a.ShadowColor),cc.size(d(a.ShadowOffsetX,2),d(a.ShadowOffsetY,-2)),a.ShadowBlurRadius||0);e=a.IsCustomSize;null!=e&&c.ignoreContentAdaptWithSize(!e);c.setUnifySizeEnabled(!1);e=a.CColor;a.CColor=null;
c.setTextColor(r(e));this.widgetAttributes(c,a,c.isIgnoreContentAdaptWithSize());a.CColor=e;return c};c.initButton=function(a,b){var c=new ccui.Button;p(a.NormalFileData,b,function(a,b){c.loadTextureNormal(a,b)});p(a.PressedFileData,b,function(a,b){c.loadTexturePressed(a,b)});p(a.DisabledFileData,b,function(a,b){c.loadTextureDisabled(a,b)});var e=d(a.Scale9Enable,!1);e&&c.setScale9Enabled(e);var f=a.ButtonText;null!=f&&c.setTitleText(f);f=a.FontSize;null!=f&&c.setTitleFontSize(f);f=a.FontName;null!=
f&&c.setTitleFontName(f);f=a.TextColor;null!=f&&c.setTitleColor(r(f));f=d(a.DisplayState,!0);c.setBright(f);c.setEnabled(f);f=a.FontResource;null!=f&&(f=f.Path,null!=f&&(f=cc.sys.isNative?cc.path.join(cc.loader.resPath,b,f):(f=f.match(/([^\/]+)\.(\S+)/))?f[1]:"",c.setTitleFontName(f)));(f=c.getTitleRenderer())&&a.ShadowEnabled&&a.ShadowColor&&f.enableShadow&&f.enableShadow(r(a.ShadowColor),cc.size(d(a.ShadowOffsetX,2),d(a.ShadowOffsetY,-2)),a.ShadowBlurRadius||0);f&&a.OutlineEnabled&&a.OutlineColor&&
f.enableStroke&&f.enableStroke(r(a.OutlineColor),d(a.OutlineSize,1));this.widgetAttributes(c,a);e&&(c.setUnifySizeEnabled(!1),c.ignoreContentAdaptWithSize(!1),e=cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0),c.setCapInsets(e));s(c,a.Size);return c};c.initCheckBox=function(a,b){var c=new ccui.CheckBox;this.widgetAttributes(c,a);[{name:"NormalBackFileData",handle:c.loadTextureBackGround},{name:"PressedBackFileData",handle:c.loadTextureBackGroundSelected},{name:"NodeNormalFileData",
handle:c.loadTextureFrontCross},{name:"DisableBackFileData",handle:c.loadTextureBackGroundDisabled},{name:"NodeDisableFileData",handle:c.loadTextureFrontCrossDisabled}].forEach(function(d){p(a[d.name],b,function(a,b){d.handle.call(c,a,b)})});var e=d(a.CheckedState,!1);c.setSelected(e);e=d(a.DisplayState,!0);c.setBright(e);c.setEnabled(e);return c};c.initScrollView=function(a,b){var c=new ccui.ScrollView;this.widgetAttributes(c,a);p(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});c.setClippingEnabled(a.ClipAble||
!1);var e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);e=a.BackColorAlpha;null!=e&&c.setBackGroundColorOpacity(e);a.Scale9Enable?(c.setBackGroundImageScale9Enabled(!0),c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)),s(c,a.Size)):c.isIgnoreContentAdaptWithSize()||s(c,a.Size);h(c,a.SingleColor,a.FirstColor,a.EndColor);k(c,a.ColorVector);e=a.InnerNodeSize;e=cc.size(e.Width||0,e.Height||0);c.setInnerContainerSize(e);e=0;"Vertical"===
a.ScrollDirectionType&&(e=1);"Horizontal"===a.ScrollDirectionType&&(e=2);"Vertical_Horizontal"===a.ScrollDirectionType&&(e=3);c.setDirection(e);e=d(a.IsBounceEnabled,!1);c.setBounceEnabled(e);return c};c.initImageView=function(a,b){var c=new ccui.ImageView;p(a.FileData,b,function(a,b){c.loadTexture(a,b)});p(a.ImageFileData,b,function(a,b){c.loadTexture(a,b)});a.Scale9Enable?(c.setScale9Enabled(!0),c.setUnifySizeEnabled(!1),c.ignoreContentAdaptWithSize(!1),c.setCapInsets(cc.rect(a.Scale9OriginX||0,
a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0))):s(c,a.Size);this.widgetAttributes(c,a);return c};c.initLoadingBar=function(a,b){var c=new ccui.LoadingBar;this.widgetAttributes(c,a);p(a.ImageFileData,b,function(a,b){c.loadTexture(a,b)});c.setDirection("Right_To_Left"===a.ProgressType?1:0);var e=d(a.ProgressInfo,80);null!=e&&c.setPercent(e);return c};c.initSlider=function(a,b){var c=new ccui.Slider,e=cc.loader;this.widgetAttributes(c,a);[{name:"BackGroundData",handle:c.loadBarTexture},{name:"BallNormalData",
handle:c.loadSlidBallTextureNormal},{name:"BallPressedData",handle:c.loadSlidBallTexturePressed},{name:"BallDisabledData",handle:c.loadSlidBallTextureDisabled},{name:"ProgressBarData",handle:c.loadProgressBarTexture}].forEach(function(d){p(a[d.name],b,function(a,b){0!==b||e.getRes(a)||cc.log("%s need to be preloaded",a);d.handle.call(c,a,b)})});c.setPercent(a.PercentInfo||0);var f=d(a.DisplayState,!0);c.setBright(f);c.setEnabled(f);return c};c.initPageView=function(a,b){var c=new ccui.PageView;this.widgetAttributes(c,
a);p(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});c.setClippingEnabled(a.ClipAble||!1);a.Scale9Enable&&(c.setBackGroundImageScale9Enabled(!0),c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)));var e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);h(c,a.SingleColor,a.FirstColor,a.EndColor);k(c,a.ColorVector);e=a.BackColorAlpha;null!=e&&c.setBackGroundColorOpacity(e);s(c,a.Size);return c};c.initListView=function(a,b){var c=new ccui.ListView;
this.widgetAttributes(c,a);p(a.FileData,b,function(a,b){c.setBackGroundImage(a,b)});c.setClippingEnabled(a.ClipAble||!1);var e=d(a.ComboBoxIndex,0);c.setBackGroundColorType(e);e=d(a.BackColorAlpha,255);a.Scale9Enable&&(c.setBackGroundImageScale9Enabled(!0),c.setBackGroundImageCapInsets(cc.rect(a.Scale9OriginX||0,a.Scale9OriginY||0,a.Scale9Width||0,a.Scale9Height||0)));var f=d(a.DirectionType,ccui.ListView.DIR_HORIZONTAL),m=d(a.VerticalType,"Align_Left"),n=d(a.HorizontalType,"Align_Top");f?"Vertical"===
f&&(c.setDirection(ccui.ScrollView.DIR_VERTICAL),""===n?c.setGravity(ccui.ListView.GRAVITY_LEFT):"Align_Right"===n?c.setGravity(ccui.ListView.GRAVITY_RIGHT):"Align_HorizontalCenter"===n&&c.setGravity(ccui.ListView.GRAVITY_CENTER_HORIZONTAL)):(c.setDirection(ccui.ScrollView.DIR_HORIZONTAL),"Align_Bottom"===m?c.setGravity(ccui.ListView.GRAVITY_BOTTOM):"Align_VerticalCenter"===m?c.setGravity(ccui.ListView.GRAVITY_CENTER_VERTICAL):c.setGravity(ccui.ListView.GRAVITY_TOP));f=d(a.IsBounceEnabled,!1);c.setBounceEnabled(f);
c.setItemsMargin(a.ItemMargin||0);f=a.InnerNodeSize;null!=f&&c.setInnerContainerSize(cc.size(f.Widget||0,f.Height||0));h(c,a.SingleColor,a.FirstColor,a.EndColor);k(c,a.ColorVector);null!=e&&c.setBackGroundColorOpacity(e);s(c,a.Size);return c};c.initTextAtlas=function(a,b){var c=new ccui.TextAtlas,d=a.LabelText,e=a.CharWidth,f=a.CharHeight,h=a.StartChar;p(a.LabelAtlasFileImage_CNB,b,function(a,b){cc.loader.getRes(a)||cc.log("%s need to be preloaded",a);0===b&&c.setProperty(d,a,e,f,h)});this.widgetAttributes(c,
a);c.ignoreContentAdaptWithSize(!0);return c};c.initTextBMFont=function(a,b){var c=new ccui.TextBMFont;this.widgetAttributes(c,a);p(a.LabelBMFontFile_CNB,b,function(a,b){cc.loader.getRes(a)||cc.log("%s need to be pre loaded",a);c.setFntFile(a)});c.setString(a.LabelText);c.ignoreContentAdaptWithSize(!0);return c};c.initTextField=function(a,b){var c=new ccui.TextField;a.PasswordEnable&&(c.setPasswordEnabled(!0),c.setPasswordStyleText(a.PasswordStyleText||"*"));var d=a.PlaceHolderText;null!=d&&c.setPlaceHolder(d);
d=a.FontSize;null!=d&&c.setFontSize(d);d=a.FontName;null!=d&&c.setFontName(d);a.MaxLengthEnable&&(c.setMaxLengthEnabled(!0),c.setMaxLength(a.MaxLengthText||0));this.widgetAttributes(c,a);d=a.LabelText;null!=d&&c.setString(d);d=a.FontResource;null!=d&&(d=d.Path,null!=d&&(d=cc.sys.isNative?cc.path.join(cc.loader.resPath,b,d):(d=d.match(/([^\/]+)\.(\S+)/))?d[1]:"",c.setFontName(d)));c.setUnifySizeEnabled(!1);c.ignoreContentAdaptWithSize(!1);d=a.CColor;null!=d&&c.setTextColor(r(d));c.isIgnoreContentAdaptWithSize()||
(s(c,a.Size),cc.sys.isNative&&c.getVirtualRenderer().setLineBreakWithoutSpace(!0));return c};c.initSimpleAudio=function(a,b){var c=new ccs.ComAudio;c.setLoop(a.Loop||!1);p(a.FileData,b,function(a,b){c.setFile(a)})};c.initGameMap=function(a,b){var d=null;p(a.FileData,b,function(b,e){0===e&&(d=new cc.TMXTiledMap(b));c.generalAttributes(d,a)});return d};c.initProjectNode=function(a,b){var d=a.FileData;if(null!=d&&d.Path){d=b+d.Path;if(cc.loader.getRes(d)){d=ccs.load(d,b);c.generalAttributes(d.node,a);
if(d.action&&d.node){d.action.tag=d.node.tag;var e=a.InnerActionSpeed;void 0!==e&&d.action.setTimeSpeed(e);d.node.runAction(d.action);d.action.gotoFrameAndPause(0)}return d.node}cc.log("%s need to be preloaded",d)}};var m=function(a){return a?(a=a.match(/([^\/]+)\.[^\/]+$/))&&a[1]?a[1]:"":""};c.initArmature=function(a,b){var d=new ccs.Armature,e=a.IsLoop,f=a.IsAutoPlay,h=a.CurrentAnimationName;p(a.FileData,b,function(a,b){var c,k,n=cc.loader.getRes(a);n?(c=n.config_file_path,k=n.config_png_path,c.forEach(function(a,
b){k[b]&&cc.spriteFrameCache.addSpriteFrames(a,k[b])})):cc.log("%s need to be preloaded",a);ccs.armatureDataManager.addArmatureFileInfo(a);d.init(m(a));f?d.getAnimation().play(h,-1,e):(d.getAnimation().play(h),d.getAnimation().gotoAndPause(0))});delete a.AnchorPoint;delete a.Size;c.generalAttributes(d,a);d.setColor(r(a.CColor));return d};c.initBoneNode=function(a,b){var d=new ccs.BoneNode,e=a.Length;void 0!==e&&d.setDebugDrawLength(e);(e=a.BlendFunc)&&void 0!==e.Src&&void 0!==e.Dst&&d.setBlendFunc(new cc.BlendFunc(e.Src,
e.Dst));c.generalAttributes(d,a);e=a.CColor;!e||void 0===e.R&&void 0===e.G&&void 0===e.B||d.setColor(r(e));return d};c.initSkeletonNode=function(a){var b=new ccs.SkeletonNode;c.generalAttributes(b,a);a=a.CColor;!a||void 0===a.R&&void 0===a.G&&void 0===a.B||b.setColor(r(a));return b};var n={},p=function(a,b,c){if(null!=a){var d=a.Path,e;e="Default"===a.Type||"Normal"===a.Type?0:1;if(a=a.Plist)cc.loader.getRes(b+a)?(n[b+a]=!0,cc.spriteFrameCache.addSpriteFrames(b+a)):n[b+a]||cc.spriteFrameCache.getSpriteFrame(d)||
cc.log("%s need to be preloaded",b+a);0!==e?cc.spriteFrameCache.getSpriteFrame(d)?c(d,e):cc.log("failed to get spriteFrame: %s",d):c(b+d,e)}},r=function(a){if(a)return cc.color(null!=a.R?a.R:255,null!=a.G?a.G:255,null!=a.B?a.B:255,null!=a.A?a.A:255)},s=function(a,b){var c=b.X||0,d=b.Y||0;b&&a.setContentSize(cc.size(c,d))};[{name:"SingleNodeObjectData",handle:c.initSingleNode},{name:"NodeObjectData",handle:c.initSingleNode},{name:"LayerObjectData",handle:c.initSingleNode},{name:"GameNodeObjectData",
handle:c.initSingleNode},{name:"GameLayerObjectData",handle:c.initSingleNode},{name:"SpriteObjectData",handle:c.initSprite},{name:"ParticleObjectData",handle:c.initParticle},{name:"PanelObjectData",handle:c.initPanel},{name:"TextObjectData",handle:c.initText},{name:"ButtonObjectData",handle:c.initButton},{name:"CheckBoxObjectData",handle:c.initCheckBox},{name:"ScrollViewObjectData",handle:c.initScrollView},{name:"ImageViewObjectData",handle:c.initImageView},{name:"LoadingBarObjectData",handle:c.initLoadingBar},
{name:"SliderObjectData",handle:c.initSlider},{name:"PageViewObjectData",handle:c.initPageView},{name:"ListViewObjectData",handle:c.initListView},{name:"TextAtlasObjectData",handle:c.initTextAtlas},{name:"TextBMFontObjectData",handle:c.initTextBMFont},{name:"TextFieldObjectData",handle:c.initTextField},{name:"SimpleAudioObjectData",handle:c.initSimpleAudio},{name:"GameMapObjectData",handle:c.initGameMap},{name:"ProjectNodeObjectData",handle:c.initProjectNode},{name:"ArmatureNodeObjectData",handle:c.initArmature},
{name:"BoneNodeObjectData",handle:c.initBoneNode},{name:"SkeletonNodeObjectData",handle:c.initSkeletonNode}].forEach(function(a){c.registerParser(a.name,function(b,c){var d=a.handle.call(this,b,c);this.parseChild(d,b.Children,c);return d})});a.registerParser("timeline","2.*",c);a.registerParser("timeline","*",c)})(ccs._load,ccs._parser);(function(){ccs.uiReader={_fileDesignSizes:{},widgetFromJsonFile:function(a){var c=cc.loader.getRes(a);c&&(this._fileDesignSizes[a]=cc.size(c.designWidth||0,c.designHeight||0));var c=c.Version||c.version,d=ccs.uiReader.getVersionInteger(c);return!c||1700<=d?(cc.warn("Not supported file types, Please try use the ccs.load"),null):ccs._load(a,"ccui")},registerTypeAndCallBack:function(a,c,d,e){var f=ccs._load.getParser("ccui")["*"],h=e.bind(d);f.registerParser(a,function(e,f){var n=new c,p=e.options;
d.setPropsFromJsonDictionary&&d.setPropsFromJsonDictionary(n,p);this.generalAttributes(n,p);var r=p.customProperty,r=r?JSON.parse(r):{};h(a,n,r);this.colorAttributes(n,p);this.anchorPointAttributes(n,p);this.parseChild.call(this,n,e,f);return n})},getVersionInteger:function(a){if(!a||"string"!==typeof a)return 0;a=a.split(".");if(4!==a.length)return 0;var c=0;a.forEach(function(a,b){c+=a*Math.pow(10,3-b)});return c},storeFileDesignSize:function(a,c){this._fileDesignSizes[a]=c},getFileDesignSize:function(a){return this._fileDesignSizes[a]},
getFilePath:function(){return this._filePath},setFilePath:function(a){this._filePath=a},getParseObjectMap:function(){return ccs._load.getParser("ccui")["*"].parsers},getParseCallBackMap:function(){return ccs._load.getParser("ccui")["*"].parsers},clear:function(){}};var a=ccs._load.getParser("ccui")["*"];ccs.imageViewReader={setPropsFromJsonDictionary:a.ImageViewAttributes};ccs.buttonReader={setPropsFromJsonDictionary:a.ButtonAttributes};ccs.checkBoxReader={setPropsFromJsonDictionary:a.CheckBoxAttributes};
ccs.labelAtlasReader={setPropsFromJsonDictionary:a.TextAtlasAttributes};ccs.labelBMFontReader={setPropsFromJsonDictionary:a.TextBMFontAttributes};ccs.labelReader={setPropsFromJsonDictionary:a.TextAttributes};ccs.layoutReader={setPropsFromJsonDictionary:a.LayoutAttributes};ccs.listViewReader={setPropsFromJsonDictionary:a.ListViewAttributes};ccs.loadingBarReader={setPropsFromJsonDictionary:a.LoadingBarAttributes};ccs.pageViewReader={setPropsFromJsonDictionary:a.PageViewAttributes};ccs.scrollViewReader=
{setPropsFromJsonDictionary:a.ScrollViewAttributes};ccs.sliderReader={setPropsFromJsonDictionary:a.SliderAttributes};ccs.textFieldReader={setPropsFromJsonDictionary:a.TextFieldAttributes}})();
(function(){ccs.sceneReader={_node:null,createNodeWithSceneFile:function(a){return this._node=a=ccs._load(a,"scene")},getNodeByTag:function(a){return null==this._node?null:this._node.getTag()===a?this._node:this._nodeByTag(this._node,a)},_nodeByTag:function(a,b){if(null==a)return null;for(var c=null,d=a.getChildren(),e=0;e<d.length&&(!(c=d[e])||c.getTag()!==b)&&!(c=this._nodeByTag(c,b));e++);return c},version:function(){return"*"},setTarget:function(){},clear:function(){ccs.triggerManager.removeAll();
cc.audioEngine.end()}}})();var __extends=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,c){for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])};return function(b,c){function d(){this.constructor=b}a(b,c);b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),spine;
(function(a){var b=function(){function a(b,c,d){if(null==b)throw Error("name cannot be null.");if(null==c)throw Error("timelines cannot be null.");this.name=b;this.timelines=c;this.duration=d}a.prototype.apply=function(a,b,c,d,e,f,h,k){if(null==a)throw Error("skeleton cannot be null.");d&&0!=this.duration&&(c%=this.duration,0<b&&(b%=this.duration));d=this.timelines;for(var m=0,n=d.length;m<n;m++)d[m].apply(a,b,c,e,f,h,k)};a.binarySearch=function(a,b,c){void 0===c&&(c=1);var d=0,e=a.length/c-2;if(0==
e)return c;for(var f=e>>>1;;){a[(f+1)*c]<=b?d=f+1:e=f;if(d==e)return(d+1)*c;f=d+e>>>1}};a.linearSearch=function(a,b,c){for(var d=0,e=a.length-c;d<=e;d+=c)if(a[d]>b)return d;return-1};return a}();a.Animation=b;var c;(function(a){a[a.setup=0]="setup";a[a.current=1]="current";a[a.currentLayered=2]="currentLayered"})(c=a.MixPose||(a.MixPose={}));var d;(function(a){a[a["in"]=0]="in";a[a.out=1]="out"})(d=a.MixDirection||(a.MixDirection={}));var e;(function(a){a[a.rotate=0]="rotate";a[a.translate=1]="translate";
a[a.scale=2]="scale";a[a.shear=3]="shear";a[a.attachment=4]="attachment";a[a.color=5]="color";a[a.deform=6]="deform";a[a.event=7]="event";a[a.drawOrder=8]="drawOrder";a[a.ikConstraint=9]="ikConstraint";a[a.transformConstraint=10]="transformConstraint";a[a.pathConstraintPosition=11]="pathConstraintPosition";a[a.pathConstraintSpacing=12]="pathConstraintSpacing";a[a.pathConstraintMix=13]="pathConstraintMix";a[a.twoColor=14]="twoColor"})(e=a.TimelineType||(a.TimelineType={}));var f=function(){function b(c){if(0>=
c)throw Error("frameCount must be \x3e 0: "+c);this.curves=a.Utils.newFloatArray((c-1)*b.BEZIER_SIZE)}b.prototype.getFrameCount=function(){return this.curves.length/b.BEZIER_SIZE+1};b.prototype.setLinear=function(a){this.curves[a*b.BEZIER_SIZE]=b.LINEAR};b.prototype.setStepped=function(a){this.curves[a*b.BEZIER_SIZE]=b.STEPPED};b.prototype.getCurveType=function(a){a*=b.BEZIER_SIZE;if(a==this.curves.length)return b.LINEAR;a=this.curves[a];return a==b.LINEAR?b.LINEAR:a==b.STEPPED?b.STEPPED:b.BEZIER};
b.prototype.setCurve=function(a,c,d,e,f){var h=0.03*(2*-c+e),k=0.03*(2*-d+f);e=0.006*(3*(c-e)+1);f=0.006*(3*(d-f)+1);var m=2*h+e,u=2*k+f;c=0.3*c+h+0.16666667*e;d=0.3*d+k+0.16666667*f;a*=b.BEZIER_SIZE;k=this.curves;k[a++]=b.BEZIER;for(var h=c,z=d,A=a+b.BEZIER_SIZE-1;a<A;a+=2)k[a]=h,k[a+1]=z,c+=m,d+=u,m+=e,u+=f,h+=c,z+=d};b.prototype.getCurvePercent=function(c,d){d=a.MathUtils.clamp(d,0,1);var e=this.curves,f=c*b.BEZIER_SIZE,h=e[f];if(h==b.LINEAR)return d;if(h==b.STEPPED)return 0;f++;for(var h=0,k=
f,m=f+b.BEZIER_SIZE-1;f<m;f+=2)if(h=e[f],h>=d){var x=m=void 0;f==k?x=m=0:(m=e[f-2],x=e[f-1]);return x+(e[f+1]-x)*(d-m)/(h-m)}e=e[f-1];return e+(1-e)*(d-h)/(1-h)};return b}();f.LINEAR=0;f.STEPPED=1;f.BEZIER=2;f.BEZIER_SIZE=19;a.CurveTimeline=f;var h=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b<<1);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.rotate<<24)+this.boneIndex};f.prototype.setFrame=function(a,b,c){a<<=1;this.frames[a]=b;this.frames[a+
f.ROTATION]=c};f.prototype.apply=function(a,d,e,h,k,m,n){d=this.frames;a=a.bones[this.boneIndex];if(e<d[0])switch(m){case c.setup:a.rotation=a.data.rotation;break;case c.current:m=a.data.rotation-a.rotation,a.rotation+=(m-360*(16384-(16384.499999999996-m/360|0)))*k}else if(e>=d[d.length-f.ENTRIES])m==c.setup?a.rotation=a.data.rotation+d[d.length+f.PREV_ROTATION]*k:(m=a.data.rotation+d[d.length+f.PREV_ROTATION]-a.rotation,a.rotation+=(m-360*(16384-(16384.499999999996-m/360|0)))*k);else{n=b.binarySearch(d,
e,f.ENTRIES);h=d[n+f.PREV_ROTATION];var u=d[n];e=this.getCurvePercent((n>>1)-1,1-(e-u)/(d[n+f.PREV_TIME]-u));d=d[n+f.ROTATION]-h;d=h+(d-360*(16384-(16384.499999999996-d/360|0)))*e;m==c.setup?(d-=360*(16384-(16384.499999999996-d/360|0)),a.rotation=a.data.rotation+d*k):(d=a.data.rotation+d-a.rotation,d-=360*(16384-(16384.499999999996-d/360|0)),a.rotation+=d*k)}};return f}(f);h.ENTRIES=2;h.PREV_TIME=-2;h.PREV_ROTATION=-1;h.ROTATION=1;a.RotateTimeline=h;h=function(d){function f(b){var c=d.call(this,b)||
this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.translate<<24)+this.boneIndex};f.prototype.setFrame=function(a,b,c,d){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.X]=c;this.frames[a+f.Y]=d};f.prototype.apply=function(a,d,e,h,k,m,n){d=this.frames;a=a.bones[this.boneIndex];if(e<d[0])switch(m){case c.setup:a.x=a.data.x;a.y=a.data.y;break;case c.current:a.x+=(a.data.x-a.x)*k,a.y+=(a.data.y-a.y)*k}else{n=h=0;if(e>=d[d.length-f.ENTRIES])h=
d[d.length+f.PREV_X],n=d[d.length+f.PREV_Y];else{var u=b.binarySearch(d,e,f.ENTRIES);h=d[u+f.PREV_X];n=d[u+f.PREV_Y];var z=d[u];e=this.getCurvePercent(u/f.ENTRIES-1,1-(e-z)/(d[u+f.PREV_TIME]-z));h+=(d[u+f.X]-h)*e;n+=(d[u+f.Y]-n)*e}m==c.setup?(a.x=a.data.x+h*k,a.y=a.data.y+n*k):(a.x+=(a.data.x+h-a.x)*k,a.y+=(a.data.y+n-a.y)*k)}};return f}(f);h.ENTRIES=3;h.PREV_TIME=-3;h.PREV_X=-2;h.PREV_Y=-1;h.X=1;h.Y=2;a.TranslateTimeline=h;var k=function(f){function h(a){return f.call(this,a)||this}__extends(h,f);
h.prototype.getPropertyId=function(){return(e.scale<<24)+this.boneIndex};h.prototype.apply=function(e,f,k,m,n,y,x){var u=this.frames;e=e.bones[this.boneIndex];if(k<u[0])switch(y){case c.setup:e.scaleX=e.data.scaleX;e.scaleY=e.data.scaleY;break;case c.current:e.scaleX+=(e.data.scaleX-e.scaleX)*n,e.scaleY+=(e.data.scaleY-e.scaleY)*n}else{m=f=0;if(k>=u[u.length-h.ENTRIES])f=u[u.length+h.PREV_X]*e.data.scaleX,m=u[u.length+h.PREV_Y]*e.data.scaleY;else{var z=b.binarySearch(u,k,h.ENTRIES);f=u[z+h.PREV_X];
m=u[z+h.PREV_Y];var A=u[z];k=this.getCurvePercent(z/h.ENTRIES-1,1-(k-A)/(u[z+h.PREV_TIME]-A));f=(f+(u[z+h.X]-f)*k)*e.data.scaleX;m=(m+(u[z+h.Y]-m)*k)*e.data.scaleY}1==n?(e.scaleX=f,e.scaleY=m):(u=k=0,y==c.setup?(k=e.data.scaleX,u=e.data.scaleY):(k=e.scaleX,u=e.scaleY),x==d.out?(f=Math.abs(f)*a.MathUtils.signum(k),m=Math.abs(m)*a.MathUtils.signum(u)):(k=Math.abs(k)*a.MathUtils.signum(f),u=Math.abs(u)*a.MathUtils.signum(m)),e.scaleX=k+(f-k)*n,e.scaleY=u+(m-u)*n)}};return h}(h);a.ScaleTimeline=k;h=function(a){function d(b){return a.call(this,
b)||this}__extends(d,a);d.prototype.getPropertyId=function(){return(e.shear<<24)+this.boneIndex};d.prototype.apply=function(a,e,f,h,k,m,n){e=this.frames;a=a.bones[this.boneIndex];if(f<e[0])switch(m){case c.setup:a.shearX=a.data.shearX;a.shearY=a.data.shearY;break;case c.current:a.shearX+=(a.data.shearX-a.shearX)*k,a.shearY+=(a.data.shearY-a.shearY)*k}else{n=h=0;if(f>=e[e.length-d.ENTRIES])h=e[e.length+d.PREV_X],n=e[e.length+d.PREV_Y];else{var u=b.binarySearch(e,f,d.ENTRIES);h=e[u+d.PREV_X];n=e[u+
d.PREV_Y];var z=e[u];f=this.getCurvePercent(u/d.ENTRIES-1,1-(f-z)/(e[u+d.PREV_TIME]-z));h+=(e[u+d.X]-h)*f;n+=(e[u+d.Y]-n)*f}m==c.setup?(a.shearX=a.data.shearX+h*k,a.shearY=a.data.shearY+n*k):(a.shearX+=(a.data.shearX+h-a.shearX)*k,a.shearY+=(a.data.shearY+n-a.shearY)*k)}};return d}(h);a.ShearTimeline=h;h=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.color<<24)+this.slotIndex};f.prototype.setFrame=
function(a,b,c,d,e,h){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.R]=c;this.frames[a+f.G]=d;this.frames[a+f.B]=e;this.frames[a+f.A]=h};f.prototype.apply=function(a,d,e,h,k,m,n){a=a.slots[this.slotIndex];var u=this.frames;if(e<u[0])switch(m){case c.setup:a.color.setFromColor(a.data.color);break;case c.current:e=a.color,m=a.data.color,e.add((m.r-e.r)*k,(m.g-e.g)*k,(m.b-e.b)*k,(m.a-e.a)*k)}else{var z=n=h=d=0;if(e>=u[u.length-f.ENTRIES])e=u.length,d=u[e+f.PREV_R],h=u[e+f.PREV_G],n=u[e+f.PREV_B],z=u[e+
f.PREV_A];else{var A=b.binarySearch(u,e,f.ENTRIES);d=u[A+f.PREV_R];h=u[A+f.PREV_G];n=u[A+f.PREV_B];var z=u[A+f.PREV_A],B=u[A];e=this.getCurvePercent(A/f.ENTRIES-1,1-(e-B)/(u[A+f.PREV_TIME]-B));d+=(u[A+f.R]-d)*e;h+=(u[A+f.G]-h)*e;n+=(u[A+f.B]-n)*e;z+=(u[A+f.A]-z)*e}1==k?a.color.set(d,h,n,z):(e=a.color,m==c.setup&&e.setFromColor(a.data.color),e.add((d-e.r)*k,(h-e.g)*k,(n-e.b)*k,(z-e.a)*k))}};return f}(f);h.ENTRIES=5;h.PREV_TIME=-5;h.PREV_R=-4;h.PREV_G=-3;h.PREV_B=-2;h.PREV_A=-1;h.R=1;h.G=2;h.B=3;h.A=
4;a.ColorTimeline=h;h=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.twoColor<<24)+this.slotIndex};f.prototype.setFrame=function(a,b,c,d,e,h,k,m,n){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.R]=c;this.frames[a+f.G]=d;this.frames[a+f.B]=e;this.frames[a+f.A]=h;this.frames[a+f.R2]=k;this.frames[a+f.G2]=m;this.frames[a+f.B2]=n};f.prototype.apply=function(a,d,e,h,k,m,n){a=a.slots[this.slotIndex];
var u=this.frames;if(e<u[0])switch(m){case c.setup:a.color.setFromColor(a.data.color);a.darkColor.setFromColor(a.data.darkColor);break;case c.current:e=a.color,u=a.darkColor,m=a.data.color,a=a.data.darkColor,e.add((m.r-e.r)*k,(m.g-e.g)*k,(m.b-e.b)*k,(m.a-e.a)*k),u.add((a.r-u.r)*k,(a.g-u.g)*k,(a.b-u.b)*k,0)}else{var z=n=h=d=0,A=0,B=0,D=0;if(e>=u[u.length-f.ENTRIES])e=u.length,d=u[e+f.PREV_R],h=u[e+f.PREV_G],n=u[e+f.PREV_B],z=u[e+f.PREV_A],A=u[e+f.PREV_R2],B=u[e+f.PREV_G2],D=u[e+f.PREV_B2];else{var C=
b.binarySearch(u,e,f.ENTRIES);d=u[C+f.PREV_R];h=u[C+f.PREV_G];n=u[C+f.PREV_B];var z=u[C+f.PREV_A],A=u[C+f.PREV_R2],B=u[C+f.PREV_G2],D=u[C+f.PREV_B2],E=u[C];e=this.getCurvePercent(C/f.ENTRIES-1,1-(e-E)/(u[C+f.PREV_TIME]-E));d+=(u[C+f.R]-d)*e;h+=(u[C+f.G]-h)*e;n+=(u[C+f.B]-n)*e;z+=(u[C+f.A]-z)*e;A+=(u[C+f.R2]-A)*e;B+=(u[C+f.G2]-B)*e;D+=(u[C+f.B2]-D)*e}1==k?(a.color.set(d,h,n,z),a.darkColor.set(A,B,D,1)):(e=a.color,u=a.darkColor,m==c.setup&&(e.setFromColor(a.data.color),u.setFromColor(a.data.darkColor)),
e.add((d-e.r)*k,(h-e.g)*k,(n-e.b)*k,(z-e.a)*k),u.add((A-u.r)*k,(B-u.g)*k,(D-u.b)*k,0))}};return f}(f);h.ENTRIES=8;h.PREV_TIME=-8;h.PREV_R=-7;h.PREV_G=-6;h.PREV_B=-5;h.PREV_A=-4;h.PREV_R2=-3;h.PREV_G2=-2;h.PREV_B2=-1;h.R=1;h.G=2;h.B=3;h.A=4;h.R2=5;h.G2=6;h.B2=7;a.TwoColorTimeline=h;h=function(){function f(b){this.frames=a.Utils.newFloatArray(b);this.attachmentNames=Array(b)}f.prototype.getPropertyId=function(){return(e.attachment<<24)+this.slotIndex};f.prototype.getFrameCount=function(){return this.frames.length};
f.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.attachmentNames[a]=c};f.prototype.apply=function(a,e,f,h,k,m,n){e=a.slots[this.slotIndex];n==d.out&&m==c.setup?(f=e.data.attachmentName,e.setAttachment(null==f?null:a.getAttachment(this.slotIndex,f))):(n=this.frames,f<n[0]?m==c.setup&&(f=e.data.attachmentName,e.setAttachment(null==f?null:a.getAttachment(this.slotIndex,f))):(m=0,m=f>=n[n.length-1]?n.length-1:b.binarySearch(n,f,1)-1,f=this.attachmentNames[m],a.slots[this.slotIndex].setAttachment(null==
f?null:a.getAttachment(this.slotIndex,f))))};return f}();a.AttachmentTimeline=h;var m=null,h=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b);c.frameVertices=Array(b);null==m&&(m=a.Utils.newFloatArray(64));return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.deform<<27)+ +this.attachment.id+this.slotIndex};f.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.frameVertices[a]=c};f.prototype.apply=function(d,e,f,h,k,n,p){e=d.slots[this.slotIndex];
var u=e.getAttachment();if(u instanceof a.VertexAttachment&&u.applyDeform(this.attachment)){p=this.frameVertices;d=p[0].length;e=a.Utils.setArraySize(e.attachmentVertices,d);var z=this.frames;if(f<z[0])switch(n){case c.setup:null==u.bones?k=u.vertices:(k=m,k.length<d&&(m=k=a.Utils.newFloatArray(d)));a.Utils.arrayCopy(k,0,e,0,d);break;case c.current:if(1==k)break;if(null==u.bones)for(h=u.vertices,n=0;n<d;n++)e[n]+=(h[n]-e[n])*k;else for(k=1-k,n=0;n<d;n++)e[n]*=k}else if(f>=z[z.length-1])if(h=p[z.length-
1],1==k)a.Utils.arrayCopy(h,0,e,0,d);else if(n==c.setup)if(null==u.bones)for(p=u.vertices,f=0;f<d;f++)n=p[f],e[f]=n+(h[f]-n)*k;else for(n=0;n<d;n++)e[n]=h[n]*k;else for(n=0;n<d;n++)e[n]+=(h[n]-e[n])*k;else{var A=b.binarySearch(z,f);h=p[A-1];p=p[A];var B=z[A];f=this.getCurvePercent(A-1,1-(f-B)/(z[A-1]-B));if(1==k)for(k=0;k<d;k++)u=h[k],e[k]=u+(p[k]-u)*f;else if(n==c.setup)if(null==u.bones)for(z=u.vertices,A=0;A<d;A++)u=h[A],n=z[A],e[A]=n+(u+(p[A]-u)*f-n)*k;else for(n=0;n<d;n++)u=h[n],e[n]=(u+(p[n]-
u)*f)*k;else for(n=0;n<d;n++)u=h[n],e[n]+=(u+(p[n]-u)*f-e[n])*k}}};return f}(f);a.DeformTimeline=h;h=function(){function c(b){this.frames=a.Utils.newFloatArray(b);this.events=Array(b)}c.prototype.getPropertyId=function(){return e.event<<24};c.prototype.getFrameCount=function(){return this.frames.length};c.prototype.setFrame=function(a,b){this.frames[a]=b.time;this.events[a]=b};c.prototype.apply=function(a,c,d,e,f,h,k){if(null!=e){var m=this.frames,n=this.frames.length;if(c>d)this.apply(a,c,Number.MAX_VALUE,
e,f,h,k),c=-1;else if(c>=m[n-1])return;if(!(d<m[0])){a=0;if(c<m[0])a=0;else for(a=b.binarySearch(m,c),c=m[a];0<a&&m[a-1]==c;)a--;for(;a<n&&d>=m[a];a++)e.push(this.events[a])}}};return c}();a.EventTimeline=h;h=function(){function f(b){this.frames=a.Utils.newFloatArray(b);this.drawOrders=Array(b)}f.prototype.getPropertyId=function(){return e.drawOrder<<24};f.prototype.getFrameCount=function(){return this.frames.length};f.prototype.setFrame=function(a,b,c){this.frames[a]=b;this.drawOrders[a]=c};f.prototype.apply=
function(e,f,h,k,m,n,y){f=e.drawOrder;k=e.slots;if(y==d.out&&n==c.setup)a.Utils.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else if(y=this.frames,h<y[0])n==c.setup&&a.Utils.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else if(e=0,e=h>=y[y.length-1]?y.length-1:b.binarySearch(y,h)-1,h=this.drawOrders[e],null==h)a.Utils.arrayCopy(k,0,f,0,k.length);else for(e=0,n=h.length;e<n;e++)f[e]=k[h[e]]};return f}();a.DrawOrderTimeline=h;h=function(f){function h(b){var c=f.call(this,b)||this;c.frames=
a.Utils.newFloatArray(b*h.ENTRIES);return c}__extends(h,f);h.prototype.getPropertyId=function(){return(e.ikConstraint<<24)+this.ikConstraintIndex};h.prototype.setFrame=function(a,b,c,d){a*=h.ENTRIES;this.frames[a]=b;this.frames[a+h.MIX]=c;this.frames[a+h.BEND_DIRECTION]=d};h.prototype.apply=function(a,e,f,k,m,n,x){e=this.frames;a=a.ikConstraints[this.ikConstraintIndex];if(f<e[0])switch(n){case c.setup:a.mix=a.data.mix;a.bendDirection=a.data.bendDirection;break;case c.current:a.mix+=(a.data.mix-a.mix)*
m,a.bendDirection=a.data.bendDirection}else if(f>=e[e.length-h.ENTRIES])n==c.setup?(a.mix=a.data.mix+(e[e.length+h.PREV_MIX]-a.data.mix)*m,a.bendDirection=x==d.out?a.data.bendDirection:e[e.length+h.PREV_BEND_DIRECTION]):(a.mix+=(e[e.length+h.PREV_MIX]-a.mix)*m,x==d["in"]&&(a.bendDirection=e[e.length+h.PREV_BEND_DIRECTION]));else{k=b.binarySearch(e,f,h.ENTRIES);var u=e[k+h.PREV_MIX],z=e[k];f=this.getCurvePercent(k/h.ENTRIES-1,1-(f-z)/(e[k+h.PREV_TIME]-z));n==c.setup?(a.mix=a.data.mix+(u+(e[k+h.MIX]-
u)*f-a.data.mix)*m,a.bendDirection=x==d.out?a.data.bendDirection:e[k+h.PREV_BEND_DIRECTION]):(a.mix+=(u+(e[k+h.MIX]-u)*f-a.mix)*m,x==d["in"]&&(a.bendDirection=e[k+h.PREV_BEND_DIRECTION]))}};return h}(f);h.ENTRIES=3;h.PREV_TIME=-3;h.PREV_MIX=-2;h.PREV_BEND_DIRECTION=-1;h.MIX=1;h.BEND_DIRECTION=2;a.IkConstraintTimeline=h;h=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.transformConstraint<<
24)+this.transformConstraintIndex};f.prototype.setFrame=function(a,b,c,d,e,h){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.ROTATE]=c;this.frames[a+f.TRANSLATE]=d;this.frames[a+f.SCALE]=e;this.frames[a+f.SHEAR]=h};f.prototype.apply=function(a,d,e,h,k,m,n){d=this.frames;a=a.transformConstraints[this.transformConstraintIndex];if(e<d[0])switch(e=a.data,m){case c.setup:a.rotateMix=e.rotateMix;a.translateMix=e.translateMix;a.scaleMix=e.scaleMix;a.shearMix=e.shearMix;break;case c.current:a.rotateMix+=(e.rotateMix-
a.rotateMix)*k,a.translateMix+=(e.translateMix-a.translateMix)*k,a.scaleMix+=(e.scaleMix-a.scaleMix)*k,a.shearMix+=(e.shearMix-a.shearMix)*k}else{var u=n=h=0,z=0;if(e>=d[d.length-f.ENTRIES])e=d.length,h=d[e+f.PREV_ROTATE],n=d[e+f.PREV_TRANSLATE],u=d[e+f.PREV_SCALE],z=d[e+f.PREV_SHEAR];else{var A=b.binarySearch(d,e,f.ENTRIES);h=d[A+f.PREV_ROTATE];n=d[A+f.PREV_TRANSLATE];var u=d[A+f.PREV_SCALE],z=d[A+f.PREV_SHEAR],B=d[A];e=this.getCurvePercent(A/f.ENTRIES-1,1-(e-B)/(d[A+f.PREV_TIME]-B));h+=(d[A+f.ROTATE]-
h)*e;n+=(d[A+f.TRANSLATE]-n)*e;u+=(d[A+f.SCALE]-u)*e;z+=(d[A+f.SHEAR]-z)*e}m==c.setup?(e=a.data,a.rotateMix=e.rotateMix+(h-e.rotateMix)*k,a.translateMix=e.translateMix+(n-e.translateMix)*k,a.scaleMix=e.scaleMix+(u-e.scaleMix)*k,a.shearMix=e.shearMix+(z-e.shearMix)*k):(a.rotateMix+=(h-a.rotateMix)*k,a.translateMix+=(n-a.translateMix)*k,a.scaleMix+=(u-a.scaleMix)*k,a.shearMix+=(z-a.shearMix)*k)}};return f}(f);h.ENTRIES=5;h.PREV_TIME=-5;h.PREV_ROTATE=-4;h.PREV_TRANSLATE=-3;h.PREV_SCALE=-2;h.PREV_SHEAR=
-1;h.ROTATE=1;h.TRANSLATE=2;h.SCALE=3;h.SHEAR=4;a.TransformConstraintTimeline=h;h=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.pathConstraintPosition<<24)+this.pathConstraintIndex};f.prototype.setFrame=function(a,b,c){a*=f.ENTRIES;this.frames[a]=b;this.frames[a+f.VALUE]=c};f.prototype.apply=function(a,d,e,h,k,m,n){d=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(e<
d[0])switch(m){case c.setup:a.position=a.data.position;break;case c.current:a.position+=(a.data.position-a.position)*k}else{h=0;if(e>=d[d.length-f.ENTRIES])h=d[d.length+f.PREV_VALUE];else{n=b.binarySearch(d,e,f.ENTRIES);h=d[n+f.PREV_VALUE];var u=d[n];e=this.getCurvePercent(n/f.ENTRIES-1,1-(e-u)/(d[n+f.PREV_TIME]-u));h+=(d[n+f.VALUE]-h)*e}a.position=m==c.setup?a.data.position+(h-a.data.position)*k:a.position+(h-a.position)*k}};return f}(f);h.ENTRIES=2;h.PREV_TIME=-2;h.PREV_VALUE=-1;h.VALUE=1;a.PathConstraintPositionTimeline=
h;h=function(a){function d(b){return a.call(this,b)||this}__extends(d,a);d.prototype.getPropertyId=function(){return(e.pathConstraintSpacing<<24)+this.pathConstraintIndex};d.prototype.apply=function(a,e,f,h,k,m,n){e=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(f<e[0])switch(m){case c.setup:a.spacing=a.data.spacing;break;case c.current:a.spacing+=(a.data.spacing-a.spacing)*k}else{h=0;if(f>=e[e.length-d.ENTRIES])h=e[e.length+d.PREV_VALUE];else{n=b.binarySearch(e,f,d.ENTRIES);h=e[n+d.PREV_VALUE];
var u=e[n];f=this.getCurvePercent(n/d.ENTRIES-1,1-(f-u)/(e[n+d.PREV_TIME]-u));h+=(e[n+d.VALUE]-h)*f}a.spacing=m==c.setup?a.data.spacing+(h-a.data.spacing)*k:a.spacing+(h-a.spacing)*k}};return d}(h);a.PathConstraintSpacingTimeline=h;f=function(d){function f(b){var c=d.call(this,b)||this;c.frames=a.Utils.newFloatArray(b*f.ENTRIES);return c}__extends(f,d);f.prototype.getPropertyId=function(){return(e.pathConstraintMix<<24)+this.pathConstraintIndex};f.prototype.setFrame=function(a,b,c,d){a*=f.ENTRIES;
this.frames[a]=b;this.frames[a+f.ROTATE]=c;this.frames[a+f.TRANSLATE]=d};f.prototype.apply=function(a,d,e,h,k,m,n){d=this.frames;a=a.pathConstraints[this.pathConstraintIndex];if(e<d[0])switch(m){case c.setup:a.rotateMix=a.data.rotateMix;a.translateMix=a.data.translateMix;break;case c.current:a.rotateMix+=(a.data.rotateMix-a.rotateMix)*k,a.translateMix+=(a.data.translateMix-a.translateMix)*k}else{n=h=0;if(e>=d[d.length-f.ENTRIES])h=d[d.length+f.PREV_ROTATE],n=d[d.length+f.PREV_TRANSLATE];else{var u=
b.binarySearch(d,e,f.ENTRIES);h=d[u+f.PREV_ROTATE];n=d[u+f.PREV_TRANSLATE];var z=d[u];e=this.getCurvePercent(u/f.ENTRIES-1,1-(e-z)/(d[u+f.PREV_TIME]-z));h+=(d[u+f.ROTATE]-h)*e;n+=(d[u+f.TRANSLATE]-n)*e}m==c.setup?(a.rotateMix=a.data.rotateMix+(h-a.data.rotateMix)*k,a.translateMix=a.data.translateMix+(n-a.data.translateMix)*k):(a.rotateMix+=(h-a.rotateMix)*k,a.translateMix+=(n-a.translateMix)*k)}};return f}(f);f.ENTRIES=3;f.PREV_TIME=-3;f.PREV_ROTATE=-2;f.PREV_TRANSLATE=-1;f.ROTATE=1;f.TRANSLATE=2;
a.PathConstraintMixTimeline=f})(spine||(spine={}));
(function(a){var b=function(){function b(e){this.tracks=[];this.events=[];this.listeners=[];this.queue=new d(this);this.propertyIDs=new a.IntSet;this.mixingTo=[];this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new c});this.data=e}b.prototype.update=function(a){a*=this.timeScale;for(var b=this.tracks,c=0,d=b.length;c<d;c++){var e=b[c];if(null!=e){e.animationLast=e.nextAnimationLast;e.trackLast=e.nextTrackLast;var f=a*e.timeScale;if(0<e.delay){e.delay-=f;
if(0<e.delay)continue;f=-e.delay;e.delay=0}var h=e.next;if(null!=h){var w=e.trackLast-h.delay;if(0<=w){h.delay=0;h.trackTime=w+a*h.timeScale;e.trackTime+=f;for(this.setCurrent(c,h,!0);null!=h.mixingFrom;)h.mixTime+=f,h=h.mixingFrom;continue}}else if(e.trackLast>=e.trackEnd&&null==e.mixingFrom){b[c]=null;this.queue.end(e);this.disposeNext(e);continue}if(null!=e.mixingFrom&&this.updateMixingFrom(e,a))for(h=e.mixingFrom,e.mixingFrom=null;null!=h;)this.queue.end(h),h=h.mixingFrom;e.trackTime+=f}}this.queue.drain()};
b.prototype.updateMixingFrom=function(a,b){var c=a.mixingFrom;if(null==c)return!0;var d=this.updateMixingFrom(c,b);if(0<a.mixTime&&(a.mixTime>=a.mixDuration||0==a.timeScale)){if(0==c.totalAlpha||0==a.mixDuration)a.mixingFrom=c.mixingFrom,a.interruptAlpha=c.interruptAlpha,this.queue.end(c);return d}c.animationLast=c.nextAnimationLast;c.trackLast=c.nextTrackLast;c.trackTime+=b*c.timeScale;a.mixTime+=b*a.timeScale;return!1};b.prototype.apply=function(c){if(null==c)throw Error("skeleton cannot be null.");
this.animationsChanged&&this._animationsChanged();for(var d=this.events,e=this.tracks,f=!1,r=0,s=e.length;r<s;r++){var t=e[r];if(!(null==t||0<t.delay)){var f=!0,w=0==r?a.MixPose.current:a.MixPose.currentLayered,v=t.alpha;null!=t.mixingFrom?v*=this.applyMixingFrom(t,c,w):t.trackTime>=t.trackEnd&&null==t.next&&(v=0);var y=t.animationLast,x=t.getAnimationTime(),u=t.animation.timelines.length,z=t.animation.timelines;if(1==v)for(var A=0;A<u;A++)z[A].apply(c,y,x,d,1,a.MixPose.setup,a.MixDirection["in"]);
else{var B=t.timelineData,D=0==t.timelinesRotation.length;D&&a.Utils.setArraySize(t.timelinesRotation,u<<1,null);for(var C=t.timelinesRotation,A=0;A<u;A++){var E=z[A],J=B[A]>=b.FIRST?a.MixPose.setup:w;E instanceof a.RotateTimeline?this.applyRotateTimeline(E,c,x,v,J,C,A<<1,D):E.apply(c,y,x,d,v,J,a.MixDirection["in"])}}this.queueEvents(t,x);d.length=0;t.nextAnimationLast=x;t.nextTrackLast=t.trackTime}}this.queue.drain();return f};b.prototype.applyMixingFrom=function(c,d,e){var f=c.mixingFrom;null!=
f.mixingFrom&&this.applyMixingFrom(f,d,e);var r=0;0==c.mixDuration?r=1:(r=c.mixTime/c.mixDuration,1<r&&(r=1));var s=r<f.eventThreshold?this.events:null,t=r<f.attachmentThreshold,w=r<f.drawOrderThreshold,v=f.animationLast,y=f.getAnimationTime(),x=f.animation.timelines.length,u=f.animation.timelines,z=f.timelineData,A=f.timelineDipMix,B=0==f.timelinesRotation.length;B&&a.Utils.setArraySize(f.timelinesRotation,x<<1,null);for(var D=f.timelinesRotation,C,E=f.alpha*c.interruptAlpha,J=E*(1-r),G=0,H=f.totalAlpha=
0;H<x;H++){var L=u[H];switch(z[H]){case b.SUBSEQUENT:if(!t&&L instanceof a.AttachmentTimeline)continue;if(!w&&L instanceof a.DrawOrderTimeline)continue;C=e;G=J;break;case b.FIRST:C=a.MixPose.setup;G=J;break;case b.DIP:C=a.MixPose.setup;G=E;break;default:C=a.MixPose.setup;var G=E,I=A[H],G=G*Math.max(0,1-I.mixTime/I.mixDuration)}f.totalAlpha+=G;L instanceof a.RotateTimeline?this.applyRotateTimeline(L,d,y,G,C,D,H<<1,B):L.apply(d,v,y,s,G,C,a.MixDirection.out)}0<c.mixDuration&&this.queueEvents(f,y);this.events.length=
0;f.nextAnimationLast=y;f.nextTrackLast=f.trackTime;return r};b.prototype.applyRotateTimeline=function(b,c,d,e,f,h,t,w){w&&(h[t]=0);if(1==e)b.apply(c,0,d,null,1,f,a.MixDirection["in"]);else{var v=b.frames;c=c.bones[b.boneIndex];if(d<v[0])f==a.MixPose.setup&&(c.rotation=c.data.rotation);else{var y=0;if(d>=v[v.length-a.RotateTimeline.ENTRIES])y=c.data.rotation+v[v.length+a.RotateTimeline.PREV_ROTATION];else{var y=a.Animation.binarySearch(v,d,a.RotateTimeline.ENTRIES),x=v[y+a.RotateTimeline.PREV_ROTATION],
u=v[y];b=b.getCurvePercent((y>>1)-1,1-(d-u)/(v[y+a.RotateTimeline.PREV_TIME]-u));y=v[y+a.RotateTimeline.ROTATION]-x;y=x+(y-360*(16384-(16384.499999999996-y/360|0)))*b+c.data.rotation;y-=360*(16384-(16384.499999999996-y/360|0))}f=f==a.MixPose.setup?c.data.rotation:c.rotation;v=0;b=y-f;0==b?v=h[t]:(b-=360*(16384-(16384.499999999996-b/360|0)),v=d=0,w?(d=0,v=b):(d=h[t],v=h[t+1]),w=0<b,y=0<=d,a.MathUtils.signum(v)!=a.MathUtils.signum(b)&&90>=Math.abs(v)&&(180<Math.abs(d)&&(d+=360*a.MathUtils.signum(d)),
y=w),v=b+d-d%360,y!=w&&(v+=360*a.MathUtils.signum(d)),h[t]=v);h[t+1]=b;f+=v*e;c.rotation=f-360*(16384-(16384.499999999996-f/360|0))}}};b.prototype.queueEvents=function(a,b){for(var c=a.animationStart,d=a.animationEnd,e=d-c,f=a.trackLast%e,h=this.events,w=0,v=h.length;w<v;w++){var y=h[w];if(y.time<f)break;y.time>d||this.queue.event(a,y)}for((a.loop?f>a.trackTime%e:b>=d&&a.animationLast<d)&&this.queue.complete(a);w<v;w++)h[w].time<c||this.queue.event(a,h[w])};b.prototype.clearTracks=function(){var a=
this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var b=0,c=this.tracks.length;b<c;b++)this.clearTrack(b);this.tracks.length=0;this.queue.drainDisabled=a;this.queue.drain()};b.prototype.clearTrack=function(a){if(!(a>=this.tracks.length)&&(a=this.tracks[a],null!=a)){this.queue.end(a);this.disposeNext(a);for(var b=a;;){var c=b.mixingFrom;if(null==c)break;this.queue.end(c);b.mixingFrom=null;b=c}this.tracks[a.trackIndex]=null;this.queue.drain()}};b.prototype.setCurrent=function(a,b,c){var d=this.expandToIndex(a);
this.tracks[a]=b;null!=d&&(c&&this.queue.interrupt(d),b.mixingFrom=d,b.mixTime=0,null!=d.mixingFrom&&0<d.mixDuration&&(b.interruptAlpha*=Math.min(1,d.mixTime/d.mixDuration)),d.timelinesRotation.length=0);this.queue.start(b)};b.prototype.setAnimation=function(a,b,c){var d=this.data.skeletonData.findAnimation(b);if(null==d)throw Error("Animation not found: "+b);return this.setAnimationWith(a,d,c)};b.prototype.setAnimationWith=function(a,b,c){if(null==b)throw Error("animation cannot be null.");var d=
!0,e=this.expandToIndex(a);null!=e&&(-1==e.nextTrackLast?(this.tracks[a]=e.mixingFrom,this.queue.interrupt(e),this.queue.end(e),this.disposeNext(e),e=e.mixingFrom,d=!1):this.disposeNext(e));b=this.trackEntry(a,b,c,e);this.setCurrent(a,b,d);this.queue.drain();return b};b.prototype.addAnimation=function(a,b,c,d){var e=this.data.skeletonData.findAnimation(b);if(null==e)throw Error("Animation not found: "+b);return this.addAnimationWith(a,e,c,d)};b.prototype.addAnimationWith=function(a,b,c,d){if(null==
b)throw Error("animation cannot be null.");var e=this.expandToIndex(a);if(null!=e)for(;null!=e.next;)e=e.next;c=this.trackEntry(a,b,c,e);null==e?(this.setCurrent(a,c,!0),this.queue.drain()):(e.next=c,0>=d&&(a=e.animationEnd-e.animationStart,d=0!=a?d+(a*(1+(e.trackTime/a|0))-this.data.getMix(e.animation,b)):0));c.delay=d;return c};b.prototype.setEmptyAnimation=function(a,c){var d=this.setAnimationWith(a,b.emptyAnimation,!1);d.mixDuration=c;d.trackEnd=c;return d};b.prototype.addEmptyAnimation=function(a,
c,d){0>=d&&(d-=c);a=this.addAnimationWith(a,b.emptyAnimation,!1,d);a.mixDuration=c;a.trackEnd=c;return a};b.prototype.setEmptyAnimations=function(a){var b=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var c=0,d=this.tracks.length;c<d;c++){var e=this.tracks[c];null!=e&&this.setEmptyAnimation(e.trackIndex,a)}this.queue.drainDisabled=b;this.queue.drain()};b.prototype.expandToIndex=function(b){if(b<this.tracks.length)return this.tracks[b];a.Utils.ensureArrayCapacity(this.tracks,b-this.tracks.length+
1,null);this.tracks.length=b+1;return null};b.prototype.trackEntry=function(a,b,c,d){var e=this.trackEntryPool.obtain();e.trackIndex=a;e.animation=b;e.loop=c;e.eventThreshold=0;e.attachmentThreshold=0;e.drawOrderThreshold=0;e.animationStart=0;e.animationEnd=b.duration;e.animationLast=-1;e.nextAnimationLast=-1;e.delay=0;e.trackTime=0;e.trackLast=-1;e.nextTrackLast=-1;e.trackEnd=Number.MAX_VALUE;e.timeScale=1;e.alpha=1;e.interruptAlpha=1;e.mixTime=0;e.mixDuration=null==d?0:this.data.getMix(d.animation,
b);return e};b.prototype.disposeNext=function(a){for(var b=a.next;null!=b;)this.queue.dispose(b),b=b.next;a.next=null};b.prototype._animationsChanged=function(){this.animationsChanged=!1;var a=this.propertyIDs;a.clear();for(var b=this.mixingTo,c=0,d=this.tracks.length;c<d;c++){var e=this.tracks[c];null!=e&&e.setTimelineData(null,b,a)}};b.prototype.getCurrent=function(a){return a>=this.tracks.length?null:this.tracks[a]};b.prototype.addListener=function(a){if(null==a)throw Error("listener cannot be null.");
this.listeners.push(a)};b.prototype.removeListener=function(a){a=this.listeners.indexOf(a);0<=a&&this.listeners.splice(a,1)};b.prototype.clearListeners=function(){this.listeners.length=0};b.prototype.clearListenerNotifications=function(){this.queue.clear()};return b}();b.emptyAnimation=new a.Animation("\x3cempty\x3e",[],0);b.SUBSEQUENT=0;b.FIRST=1;b.DIP=2;b.DIP_MIX=3;a.AnimationState=b;var c=function(){function c(){this.timelineData=[];this.timelineDipMix=[];this.timelinesRotation=[]}c.prototype.reset=
function(){this.listener=this.animation=this.mixingFrom=this.next=null;this.timelineData.length=0;this.timelineDipMix.length=0;this.timelinesRotation.length=0};c.prototype.setTimelineData=function(c,d,e){null!=c&&d.push(c);var f=null!=this.mixingFrom?this.mixingFrom.setTimelineData(this,d,e):this;null!=c&&d.pop();var h=d.length-1,s=this.animation.timelines,t=this.animation.timelines.length,w=a.Utils.setArraySize(this.timelineData,t);this.timelineDipMix.length=0;var v=a.Utils.setArraySize(this.timelineDipMix,
t),y=0;a:for(;y<t;y++){var x=s[y].getPropertyId();if(e.add(x))if(null!=c&&c.hasTimeline(x)){for(var u=h;0<=u;u--){var z=d[u];if(!z.hasTimeline(x)&&0<z.mixDuration){w[y]=b.DIP_MIX;v[y]=z;continue a}}w[y]=b.DIP}else w[y]=b.FIRST;else w[y]=b.SUBSEQUENT}return f};c.prototype.hasTimeline=function(a){for(var b=this.animation.timelines,c=0,d=b.length;c<d;c++)if(b[c].getPropertyId()==a)return!0;return!1};c.prototype.getAnimationTime=function(){if(this.loop){var a=this.animationEnd-this.animationStart;return 0==
a?this.animationStart:this.trackTime%a+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)};c.prototype.setAnimationLast=function(a){this.nextAnimationLast=this.animationLast=a};c.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart};c.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0};return c}();a.TrackEntry=c;var d=function(){function a(b){this.objects=[];this.drainDisabled=!1;this.animState=
b}a.prototype.start=function(a){this.objects.push(e.start);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.interrupt=function(a){this.objects.push(e.interrupt);this.objects.push(a)};a.prototype.end=function(a){this.objects.push(e.end);this.objects.push(a);this.animState.animationsChanged=!0};a.prototype.dispose=function(a){this.objects.push(e.dispose);this.objects.push(a)};a.prototype.complete=function(a){this.objects.push(e.complete);this.objects.push(a)};a.prototype.event=
function(a,b){this.objects.push(e.event);this.objects.push(a);this.objects.push(b)};a.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var a=this.objects,b=this.animState.listeners,c=0;c<a.length;c+=2){var d=a[c+1];switch(a[c]){case e.start:null!=d.listener&&d.listener.start&&d.listener.start(d);for(var f=0;f<b.length;f++)b[f].start&&b[f].start(d);break;case e.interrupt:null!=d.listener&&d.listener.interrupt&&d.listener.interrupt(d);for(f=0;f<b.length;f++)b[f].interrupt&&
b[f].interrupt(d);break;case e.end:for(null!=d.listener&&d.listener.end&&d.listener.end(d),f=0;f<b.length;f++)b[f].end&&b[f].end(d);case e.dispose:null!=d.listener&&d.listener.dispose&&d.listener.dispose(d);for(f=0;f<b.length;f++)b[f].dispose&&b[f].dispose(d);this.animState.trackEntryPool.free(d);break;case e.complete:null!=d.listener&&d.listener.complete&&d.listener.complete(d);for(f=0;f<b.length;f++)b[f].complete&&b[f].complete(d);break;case e.event:var h=a[c++ +2];null!=d.listener&&d.listener.event&&
d.listener.event(d,h);for(f=0;f<b.length;f++)b[f].event&&b[f].event(d,h)}}this.clear();this.drainDisabled=!1}};a.prototype.clear=function(){this.objects.length=0};return a}();a.EventQueue=d;var e;(function(a){a[a.start=0]="start";a[a.interrupt=1]="interrupt";a[a.end=2]="end";a[a.dispose=3]="dispose";a[a.complete=4]="complete";a[a.event=5]="event"})(e=a.EventType||(a.EventType={}));var f=function(){function a(){}a.prototype.start=function(a){};a.prototype.interrupt=function(a){};a.prototype.end=function(a){};
a.prototype.dispose=function(a){};a.prototype.complete=function(a){};a.prototype.event=function(a,b){};return a}();a.AnimationStateAdapter2=f})(spine||(spine={}));
(function(a){var b=function(){function a(b){this.animationToMixTime={};this.defaultMix=0;if(null==b)throw Error("skeletonData cannot be null.");this.skeletonData=b}a.prototype.setMix=function(a,b,c){var h=this.skeletonData.findAnimation(a);if(null==h)throw Error("Animation not found: "+a);a=this.skeletonData.findAnimation(b);if(null==a)throw Error("Animation not found: "+b);this.setMixWith(h,a,c)};a.prototype.setMixWith=function(a,b,c){if(null==a)throw Error("from cannot be null.");if(null==b)throw Error("to cannot be null.");
this.animationToMixTime[a.name+b.name]=c};a.prototype.getMix=function(a,b){var c=this.animationToMixTime[a.name+b.name];return void 0===c?this.defaultMix:c};return a}();a.AnimationStateData=b})(spine||(spine={}));
(function(a){var b=function(){function a(b,c){void 0===c&&(c="");this.assets={};this.errors={};this.loaded=this.toLoad=0;this.textureLoader=b;this.pathPrefix=c}a.prototype.loadText=function(a,b,c){var h=this;void 0===b&&(b=null);void 0===c&&(c=null);a=this.pathPrefix+a;this.toLoad++;var k=new XMLHttpRequest;k.onreadystatechange=function(){k.readyState==XMLHttpRequest.DONE&&(200<=k.status&&300>k.status?(h.assets[a]=k.responseText,b&&b(a,k.responseText)):(h.errors[a]="Couldn't load text "+a+": status "+
k.status+", "+k.responseText,c&&c(a,"Couldn't load text "+a+": status "+k.status+", "+k.responseText)),h.toLoad--,h.loaded++)};k.open("GET",a,!0);k.send()};a.prototype.loadTexture=function(a,b,c){var h=this;void 0===b&&(b=null);void 0===c&&(c=null);a=this.pathPrefix+a;this.toLoad++;var k=new Image;k.crossOrigin="anonymous";k.onload=function(c){c=h.textureLoader(k);h.assets[a]=c;h.toLoad--;h.loaded++;b&&b(a,k)};k.onerror=function(b){h.errors[a]="Couldn't load image "+a;h.toLoad--;h.loaded++;c&&c(a,
"Couldn't load image "+a)};k.src=a};a.prototype.loadTextureData=function(a,b,c,h){var k=this;void 0===c&&(c=null);void 0===h&&(h=null);a=this.pathPrefix+a;this.toLoad++;var m=new Image;m.onload=function(b){b=k.textureLoader(m);k.assets[a]=b;k.toLoad--;k.loaded++;c&&c(a,m)};m.onerror=function(b){k.errors[a]="Couldn't load image "+a;k.toLoad--;k.loaded++;h&&h(a,"Couldn't load image "+a)};m.src=b};a.prototype.get=function(a){a=this.pathPrefix+a;return this.assets[a]};a.prototype.remove=function(a){a=
this.pathPrefix+a;var b=this.assets[a];b.dispose&&b.dispose();this.assets[a]=null};a.prototype.removeAll=function(){for(var a in this.assets){var b=this.assets[a];b.dispose&&b.dispose()}this.assets={}};a.prototype.isLoadingComplete=function(){return 0==this.toLoad};a.prototype.getToLoad=function(){return this.toLoad};a.prototype.getLoaded=function(){return this.loaded};a.prototype.dispose=function(){this.removeAll()};a.prototype.hasErrors=function(){return 0<Object.keys(this.errors).length};a.prototype.getErrors=
function(){return this.errors};return a}();a.AssetManager=b})(spine||(spine={}));
(function(a){var b=function(){function b(a){this.atlas=a}b.prototype.newRegionAttachment=function(b,c,f){b=this.atlas.findRegion(f);if(null==b)throw Error("Region not found in atlas: "+f+" (region attachment: "+c+")");b.renderObject=b;c=new a.RegionAttachment(c);c.setRegion(b);return c};b.prototype.newMeshAttachment=function(b,c,f){b=this.atlas.findRegion(f);if(null==b)throw Error("Region not found in atlas: "+f+" (mesh attachment: "+c+")");b.renderObject=b;c=new a.MeshAttachment(c);c.region=b;return c};
b.prototype.newBoundingBoxAttachment=function(b,c){return new a.BoundingBoxAttachment(c)};b.prototype.newPathAttachment=function(b,c){return new a.PathAttachment(c)};b.prototype.newPointAttachment=function(b,c){return new a.PointAttachment(c)};b.prototype.newClippingAttachment=function(b,c){return new a.ClippingAttachment(c)};return b}();a.AtlasAttachmentLoader=b})(spine||(spine={}));
(function(a){a=a.BlendMode||(a.BlendMode={});a[a.Normal=0]="Normal";a[a.Additive=1]="Additive";a[a.Multiply=2]="Multiply";a[a.Screen=3]="Screen"})(spine||(spine={}));
(function(a){var b=function(){function b(a,c,f){this.children=[];this.ashearY=this.ashearX=this.ascaleY=this.ascaleX=this.arotation=this.ay=this.ax=this.shearY=this.shearX=this.scaleY=this.scaleX=this.rotation=this.y=this.x=0;this.appliedValid=!1;this.worldY=this.d=this.c=this.worldX=this.b=this.a=0;this.sorted=!1;if(null==a)throw Error("data cannot be null.");if(null==c)throw Error("skeleton cannot be null.");this.data=a;this.skeleton=c;this.parent=f;this.setToSetupPose()}b.prototype.update=function(){this.updateWorldTransformWith(this.x,
this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)};b.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)};b.prototype.updateWorldTransformWith=function(b,c,f,h,k,m,n){this.ax=b;this.ay=c;this.arotation=f;this.ascaleX=h;this.ascaleY=k;this.ashearX=m;this.ashearY=n;this.appliedValid=!0;var p=this.parent;if(null==p){n=f+90+n;var p=a.MathUtils.cosDeg(f+m)*h,r=a.MathUtils.cosDeg(n)*k;h*=
a.MathUtils.sinDeg(f+m);k*=a.MathUtils.sinDeg(n);var s=this.skeleton;s.flipX&&(b=-b,p=-p,r=-r);s.flipY&&(c=-c,h=-h,k=-k);this.a=p;this.b=r;this.c=h;this.d=k;this.worldX=b+s.x;this.worldY=c+s.y}else{var s=p.a,t=p.b,w=p.c,v=p.d;this.worldX=s*b+t*c+p.worldX;this.worldY=w*b+v*c+p.worldY;switch(this.data.transformMode){case a.TransformMode.Normal:n=f+90+n;p=a.MathUtils.cosDeg(f+m)*h;r=a.MathUtils.cosDeg(n)*k;h*=a.MathUtils.sinDeg(f+m);k*=a.MathUtils.sinDeg(n);this.a=s*p+t*h;this.b=s*r+t*k;this.c=w*p+v*
h;this.d=w*r+v*k;return;case a.TransformMode.OnlyTranslation:n=f+90+n;this.a=a.MathUtils.cosDeg(f+m)*h;this.b=a.MathUtils.cosDeg(n)*k;this.c=a.MathUtils.sinDeg(f+m)*h;this.d=a.MathUtils.sinDeg(n)*k;break;case a.TransformMode.NoRotationOrReflection:p=s*s+w*w;r=0;1E-4<p?(p=Math.abs(s*v-t*w)/p,t=w*p,v=s*p,r=Math.atan2(w,s)*a.MathUtils.radDeg):(w=s=0,r=90-Math.atan2(v,t)*a.MathUtils.radDeg);m=f+m-r;n=f+n-r+90;p=a.MathUtils.cosDeg(m)*h;r=a.MathUtils.cosDeg(n)*k;h*=a.MathUtils.sinDeg(m);k*=a.MathUtils.sinDeg(n);
this.a=s*p-t*h;this.b=s*r-t*k;this.c=w*p+v*h;this.d=w*r+v*k;break;case a.TransformMode.NoScale:case a.TransformMode.NoScaleOrReflection:p=a.MathUtils.cosDeg(f);r=a.MathUtils.sinDeg(f);f=s*p+t*r;b=w*p+v*r;p=Math.sqrt(f*f+b*b);1E-5<p&&(p=1/p);f*=p;b*=p;p=Math.sqrt(f*f+b*b);r=Math.PI/2+Math.atan2(b,f);c=Math.cos(r)*p;var y=Math.sin(r)*p,p=a.MathUtils.cosDeg(m)*h,r=a.MathUtils.cosDeg(90+n)*k;h*=a.MathUtils.sinDeg(m);k*=a.MathUtils.sinDeg(90+n);if(this.data.transformMode!=a.TransformMode.NoScaleOrReflection?
0>s*v-t*w:this.skeleton.flipX!=this.skeleton.flipY)c=-c,y=-y;this.a=f*p+c*h;this.b=f*r+c*k;this.c=b*p+y*h;this.d=b*r+y*k;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};b.prototype.setToSetupPose=function(){var a=this.data;this.x=a.x;this.y=a.y;this.rotation=a.rotation;this.scaleX=a.scaleX;this.scaleY=a.scaleY;this.shearX=a.shearX;this.shearY=a.shearY};b.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*a.MathUtils.radDeg};
b.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};b.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};b.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};b.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var b=this.parent;if(null==b)this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*
this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var c=b.a,f=b.b,h=b.c,k=b.d,m=1/(c*k-f*h),n=this.worldX-b.worldX,b=this.worldY-b.worldY;this.ax=n*k*m-b*f*m;this.ay=b*c*m-n*h*m;k*=m;c*=m;f*=m;m*=h;h=k*this.a-f*this.c;f=k*this.b-f*this.d;k=c*this.c-m*this.a;m=c*this.d-m*this.b;this.ashearX=0;this.ascaleX=Math.sqrt(h*h+k*k);1E-4<this.ascaleX?(c=h*m-f*k,this.ascaleY=c/this.ascaleX,
this.ashearY=Math.atan2(h*f+k*m,c)*a.MathUtils.radDeg,this.arotation=Math.atan2(k,h)*a.MathUtils.radDeg):(this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,f)*a.MathUtils.radDeg)}};b.prototype.worldToLocal=function(a){var b=this.a,c=this.b,h=this.c,k=this.d,m=1/(b*k-c*h),n=a.x-this.worldX,p=a.y-this.worldY;a.x=n*k*m-p*c*m;a.y=p*b*m-n*h*m;return a};b.prototype.localToWorld=function(a){var b=a.x,c=a.y;a.x=b*this.a+c*this.b+this.worldX;a.y=b*this.c+c*this.d+
this.worldY;return a};b.prototype.worldToLocalRotation=function(b){var c=a.MathUtils.sinDeg(b);b=a.MathUtils.cosDeg(b);return Math.atan2(this.a*c-this.c*b,this.d*b-this.b*c)*a.MathUtils.radDeg};b.prototype.localToWorldRotation=function(b){var c=a.MathUtils.sinDeg(b);b=a.MathUtils.cosDeg(b);return Math.atan2(b*this.c+c*this.d,b*this.a+c*this.b)*a.MathUtils.radDeg};b.prototype.rotateWorld=function(b){var c=this.a,f=this.b,h=this.c,k=this.d,m=a.MathUtils.cosDeg(b);b=a.MathUtils.sinDeg(b);this.a=m*c-
b*h;this.b=m*f-b*k;this.c=b*c+m*h;this.d=b*f+m*k;this.appliedValid=!1};return b}();a.Bone=b})(spine||(spine={}));
(function(a){var b=function(){return function(a,b,f){this.rotation=this.y=this.x=0;this.scaleY=this.scaleX=1;this.shearY=this.shearX=0;this.transformMode=c.Normal;if(0>a)throw Error("index must be \x3e\x3d 0.");if(null==b)throw Error("name cannot be null.");this.index=a;this.name=b;this.parent=f}}();a.BoneData=b;var c;(function(a){a[a.Normal=0]="Normal";a[a.OnlyTranslation=1]="OnlyTranslation";a[a.NoRotationOrReflection=2]="NoRotationOrReflection";a[a.NoScale=3]="NoScale";a[a.NoScaleOrReflection=
4]="NoScaleOrReflection"})(c=a.TransformMode||(a.TransformMode={}))})(spine||(spine={}));(function(a){var b=function(){return function(a,b){if(null==b)throw Error("data cannot be null.");this.time=a;this.data=b}}();a.Event=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.name=a}}();a.EventData=b})(spine||(spine={}));
(function(a){var b=function(){function b(a,c){this.mix=1;this.bendDirection=0;if(null==a)throw Error("data cannot be null.");if(null==c)throw Error("skeleton cannot be null.");this.data=a;this.mix=a.mix;this.bendDirection=a.bendDirection;this.bones=[];for(var f=0;f<a.bones.length;f++)this.bones.push(c.findBone(a.bones[f].name));this.target=c.findBone(a.target.name)}b.prototype.getOrder=function(){return this.data.order};b.prototype.apply=function(){this.update()};b.prototype.update=function(){var a=
this.target,b=this.bones;switch(b.length){case 1:this.apply1(b[0],a.worldX,a.worldY,this.mix);break;case 2:this.apply2(b[0],b[1],a.worldX,a.worldY,this.bendDirection,this.mix)}};b.prototype.apply1=function(b,c,f,h){b.appliedValid||b.updateAppliedTransform();var k=b.parent,m=1/(k.a*k.d-k.b*k.c);c-=k.worldX;f-=k.worldY;k=Math.atan2((f*k.a-c*k.c)*m-b.ay,(c*k.d-f*k.b)*m-b.ax)*a.MathUtils.radDeg-b.ashearX-b.arotation;0>b.ascaleX&&(k+=180);180<k?k-=360:-180>k&&(k+=360);b.updateWorldTransformWith(b.ax,b.ay,
b.arotation+k*h,b.ascaleX,b.ascaleY,b.ashearX,b.ashearY)};b.prototype.apply2=function(b,c,f,h,k,m){if(0==m)c.updateWorldTransform();else{b.appliedValid||b.updateAppliedTransform();c.appliedValid||c.updateAppliedTransform();var n=b.ax,p=b.ay,r=b.ascaleX,s=b.ascaleY,t=c.ascaleX,w=0,v=0,y=0;0>r?(r=-r,w=180,y=-1):(w=0,y=1);0>s&&(s=-s,y=-y);0>t?(t=-t,v=180):v=0;var x=c.ax,u=0,z=0,A=0,B=b.a,D=b.b,C=b.c,E=b.d,J=1E-4>=Math.abs(r-s);J?(u=c.ay,z=B*x+D*u+b.worldX,A=C*x+E*u+b.worldY):(u=0,z=B*x+b.worldX,A=C*
x+b.worldY);var G=b.parent,B=G.a,D=G.b,C=G.c,E=G.d,H=1/(B*E-D*C);f-=G.worldX;h-=G.worldY;var L=(f*E-h*D)*H-n,I=(h*B-f*C)*H-p;f=z-G.worldX;h=A-G.worldY;D=(f*E-h*D)*H-n;B=(h*B-f*C)*H-p;f=Math.sqrt(D*D+B*B);D=c.data.length*t;C=B=0;a:if(J)D*=r,B=(L*L+I*I-f*f-D*D)/(2*f*D),-1>B?B=-1:1<B&&(B=1),C=Math.acos(B)*k,B=f+D*B,D*=Math.sin(C),B=Math.atan2(I*B-L*D,L*B+I*D);else{B=r*D;D*=s;h=B*B;t=D*D;J=L*L+I*I;L=Math.atan2(I,L);C=t*f*f+h*J-h*t;I=-2*t*f;H=t-h;E=I*I-4*H*C;if(0<=E&&(E=Math.sqrt(E),0>I&&(E=-E),E=-(I+
E)/2,I=E/H,C/=E,C=Math.abs(I)<Math.abs(C)?I:C,C*C<=J)){h=Math.sqrt(J-C*C)*k;B=L-Math.atan2(h,C);C=Math.atan2(h/s,(C-f)/r);break a}var r=a.MathUtils.PI,I=f-B,H=I*I,s=z=0,A=f+B,G=A*A,M=0,C=-B*f/(h-t);-1<=C&&1>=C&&(C=Math.acos(C),f=B*Math.cos(C)+f,h=D*Math.sin(C),E=f*f+h*h,E<H&&(r=C,H=E,I=f,z=h),E>G&&(s=C,G=E,A=f,M=h));J<=(H+G)/2?(B=L-Math.atan2(z*k,I),C=r*k):(B=L-Math.atan2(M*k,A),C=s*k)}k=Math.atan2(u,x)*y;D=b.arotation;B=(B-k)*a.MathUtils.radDeg+w-D;180<B?B-=360:-180>B&&(B+=360);b.updateWorldTransformWith(n,
p,D+B*m,b.ascaleX,b.ascaleY,0,0);D=c.arotation;C=((C+k)*a.MathUtils.radDeg-c.ashearX)*y+v-D;180<C?C-=360:-180>C&&(C+=360);c.updateWorldTransformWith(x,u,D+C*m,c.ascaleX,c.ascaleY,c.ashearX,c.ashearY)}};return b}();a.IkConstraint=b})(spine||(spine={}));(function(a){var b=function(){return function(a){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=a}}();a.IkConstraintData=b})(spine||(spine={}));
(function(a){var b=function(){function b(a,c){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==a)throw Error("data cannot be null.");if(null==c)throw Error("skeleton cannot be null.");this.data=a;this.bones=[];for(var f=0,h=a.bones.length;f<h;f++)this.bones.push(c.findBone(a.bones[f].name));this.target=c.findSlot(a.target.name);this.position=a.position;this.spacing=a.spacing;this.rotateMix=
a.rotateMix;this.translateMix=a.translateMix}b.prototype.apply=function(){this.update()};b.prototype.update=function(){var b=this.target.getAttachment();if(b instanceof a.PathAttachment){var c=this.rotateMix,f=this.translateMix,h=0<c;if(0<f||h){var k=this.data,m=k.spacingMode,n=m==a.SpacingMode.Length,p=k.rotateMode,r=p==a.RotateMode.Tangent,s=p==a.RotateMode.ChainScale,t=this.bones.length,w=r?t:t+1,v=this.bones,y=a.Utils.setArraySize(this.spaces,w),x=null,u=this.spacing;if(s||n){s&&(x=a.Utils.setArraySize(this.lengths,
t));for(var z=0,A=w-1;z<A;){var B=v[z],D=B.data.length;0==D&&(D=1E-7);var C=D*B.a,E=D*B.c,B=Math.sqrt(C*C+E*E);s&&(x[z]=B);y[++z]=(n?D+u:u)*B/D}}else for(z=1;z<w;z++)y[z]=u;b=this.computeWorldPositions(b,w,r,k.positionMode==a.PositionMode.Percent,m==a.SpacingMode.Percent);n=b[0];w=b[1];k=k.offsetRotation;m=!1;0==k?m=p==a.RotateMode.Chain:(m=!1,p=this.target.bone,k*=0<p.a*p.d-p.b*p.c?a.MathUtils.degRad:-a.MathUtils.degRad);z=0;for(p=3;z<t;z++,p+=3){B=v[z];B.worldX+=(n-B.worldX)*f;B.worldY+=(w-B.worldY)*
f;C=b[p];E=b[p+1];u=C-n;A=E-w;s&&(n=x[z],0!=n&&(n=(Math.sqrt(u*u+A*A)/n-1)*c+1,B.a*=n,B.c*=n));n=C;w=E;if(h){var C=B.a,E=B.b,D=B.c,J=B.d,G=0,H=0,L=0,G=r?b[p-1]:0==y[z+1]?b[p+2]:Math.atan2(A,u),G=G-Math.atan2(D,C);if(m)var H=Math.cos(G),L=Math.sin(G),I=B.data.length,n=n+(I*(H*C-L*D)-u)*c,w=w+(I*(L*C+H*D)-A)*c;else G+=k;G>a.MathUtils.PI?G-=a.MathUtils.PI2:G<-a.MathUtils.PI&&(G+=a.MathUtils.PI2);G*=c;H=Math.cos(G);L=Math.sin(G);B.a=H*C-L*D;B.b=H*E-L*J;B.c=L*C+H*D;B.d=L*E+H*J}B.appliedValid=!1}}}};b.prototype.computeWorldPositions=
function(d,e,f,h,k){var m=this.target,n=this.position,p=this.spaces,r=a.Utils.setArraySize(this.positions,3*e+2),s=null,t=d.closed,w=d.worldVerticesLength,v=w/6,y=b.NONE;if(!d.constantSpeed){var x=d.lengths,v=v-(t?1:2),u=x[v];h&&(n*=u);if(k)for(var z=0;z<e;z++)p[z]*=u;s=a.Utils.setArraySize(this.world,8);for(k=h=z=0;z<e;z++,h+=3){var A=p[z],B=n+=A;if(t)B%=u,0>B&&(B+=u),k=0;else if(0>B){y!=b.BEFORE&&(y=b.BEFORE,d.computeWorldVertices(m,2,4,s,0,2));this.addBeforePosition(B,s,0,r,h);continue}else if(B>
u){y!=b.AFTER&&(y=b.AFTER,d.computeWorldVertices(m,w-6,4,s,0,2));this.addAfterPosition(B-u,s,0,r,h);continue}for(;;k++){var D=x[k];if(!(B>D)){if(0==k)B/=D;else var C=x[k-1],B=(B-C)/(D-C);break}}k!=y&&(y=k,t&&k==v?(d.computeWorldVertices(m,w-4,4,s,0,2),d.computeWorldVertices(m,0,4,s,4,2)):d.computeWorldVertices(m,6*k+2,8,s,0,2));this.addCurvePosition(B,s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],r,h,f||0<z&&0==A)}return r}t?(w+=2,s=a.Utils.setArraySize(this.world,w),d.computeWorldVertices(m,2,w-4,s,0,
2),d.computeWorldVertices(m,0,2,s,w-4,2),s[w-2]=s[0],s[w-1]=s[1]):(v--,w-=4,s=a.Utils.setArraySize(this.world,w),d.computeWorldVertices(m,2,w,s,0,2));d=a.Utils.setArraySize(this.curves,v);for(var m=0,x=s[0],u=s[1],E=D=0,J=0,G=0,H=0,L=0,I=0,M=0,F=C=0,N=0,O=0,z=M=I=0,A=2;z<v;z++,A+=6)D=s[A],E=s[A+1],J=s[A+2],G=s[A+3],H=s[A+4],L=s[A+5],I=0.1875*(x-2*D+J),M=0.1875*(u-2*E+G),C=0.09375*(3*(D-J)-x+H),F=0.09375*(3*(E-G)-u+L),N=2*I+C,O=2*M+F,I=0.75*(D-x)+I+0.16666667*C,M=0.75*(E-u)+M+0.16666667*F,m+=Math.sqrt(I*
I+M*M),I+=N,M+=O,N+=C,O+=F,m+=Math.sqrt(I*I+M*M),I+=N,M+=O,m+=Math.sqrt(I*I+M*M),I+=N+C,M+=O+F,m+=Math.sqrt(I*I+M*M),d[z]=m,x=H,u=L;h&&(n*=m);if(k)for(z=0;z<e;z++)p[z]*=m;for(var v=this.segments,P=0,F=k=h=z=0;z<e;z++,h+=3){A=p[z];B=n+=A;if(t)B%=m,0>B&&(B+=m),k=0;else if(0>B){this.addBeforePosition(B,s,0,r,h);continue}else if(B>m){this.addAfterPosition(B-m,s,w-4,r,h);continue}for(;;k++)if(N=d[k],!(B>N)){0==k?B/=N:(C=d[k-1],B=(B-C)/(N-C));break}if(k!=y){var y=k,Q=6*k,x=s[Q],u=s[Q+1],D=s[Q+2],E=s[Q+
3],J=s[Q+4],G=s[Q+5],H=s[Q+6],L=s[Q+7],I=0.03*(x-2*D+J),M=0.03*(u-2*E+G),C=0.006*(3*(D-J)-x+H),F=0.006*(3*(E-G)-u+L),N=2*I+C,O=2*M+F,I=0.3*(D-x)+I+0.16666667*C,M=0.3*(E-u)+M+0.16666667*F,P=Math.sqrt(I*I+M*M);v[0]=P;for(Q=1;8>Q;Q++)I+=N,M+=O,N+=C,O+=F,P+=Math.sqrt(I*I+M*M),v[Q]=P;I+=N;M+=O;P+=Math.sqrt(I*I+M*M);v[8]=P;I+=N+C;M+=O+F;P+=Math.sqrt(I*I+M*M);v[9]=P;F=0}for(B*=P;;F++)if(N=v[F],!(B>N)){0==F?B/=N:(C=v[F-1],B=F+(B-C)/(N-C));break}this.addCurvePosition(0.1*B,x,u,D,E,J,G,H,L,r,h,f||0<z&&0==A)}return r};
b.prototype.addBeforePosition=function(a,b,c,h,k){var m=b[c],n=b[c+1];b=Math.atan2(b[c+3]-n,b[c+2]-m);h[k]=m+a*Math.cos(b);h[k+1]=n+a*Math.sin(b);h[k+2]=b};b.prototype.addAfterPosition=function(a,b,c,h,k){var m=b[c+2],n=b[c+3];b=Math.atan2(n-b[c+1],m-b[c]);h[k]=m+a*Math.cos(b);h[k+1]=n+a*Math.sin(b);h[k+2]=b};b.prototype.addCurvePosition=function(a,b,c,h,k,m,n,p,r,s,t,w){if(0==a||isNaN(a))a=1E-4;var v=a*a,y=v*a,x=1-a,u=x*x,z=u*x,A=x*a,B=3*A,x=x*B;a*=B;p=b*z+h*x+m*a+p*y;r=c*z+k*x+n*a+r*y;s[t]=p;s[t+
1]=r;w&&(s[t+2]=Math.atan2(r-(c*u+k*A*2+n*v),p-(b*u+h*A*2+m*v)))};b.prototype.getOrder=function(){return this.data.order};return b}();b.NONE=-1;b.BEFORE=-2;b.AFTER=-3;a.PathConstraint=b})(spine||(spine={}));
(function(a){var b=function(){return function(a){this.order=0;this.bones=[];this.name=a}}();a.PathConstraintData=b;(function(a){a[a.Fixed=0]="Fixed";a[a.Percent=1]="Percent"})(a.PositionMode||(a.PositionMode={}));(function(a){a[a.Length=0]="Length";a[a.Fixed=1]="Fixed";a[a.Percent=2]="Percent"})(a.SpacingMode||(a.SpacingMode={}));(function(a){a[a.Tangent=0]="Tangent";a[a.Chain=1]="Chain";a[a.ChainScale=2]="ChainScale"})(a.RotateMode||(a.RotateMode={}))})(spine||(spine={}));
(function(){Math.fround||(Math.fround=function(a){return function(b){return a[0]=b,a[0]}}(new Float32Array(1)))})();
(function(a){var b=function(){function a(b){this.toLoad=[];this.assets={};this.clientId=b}a.prototype.loaded=function(){var a=0,b;for(b in this.assets)a++;return a};return a}(),c=function(){function a(b){void 0===b&&(b="");this.clientAssets={};this.queuedAssets={};this.rawAssets={};this.errors={};this.pathPrefix=b}a.prototype.queueAsset=function(a,c,d){var k=this.clientAssets[a];if(null===k||void 0===k)k=new b(a),this.clientAssets[a]=k;null!==c&&(k.textureLoader=c);k.toLoad.push(d);if(this.queuedAssets[d]===
d)return!1;this.queuedAssets[d]=d;return!0};a.prototype.loadText=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var d=new XMLHttpRequest;d.onreadystatechange=function(){d.readyState==XMLHttpRequest.DONE&&(200<=d.status&&300>d.status?c.rawAssets[b]=d.responseText:c.errors[b]="Couldn't load text "+b+": status "+d.status+", "+d.responseText)};d.open("GET",b,!0);d.send()}};a.prototype.loadJson=function(a,b){var c=this;b=this.pathPrefix+b;if(this.queueAsset(a,null,b)){var d=
new XMLHttpRequest;d.onreadystatechange=function(){d.readyState==XMLHttpRequest.DONE&&(200<=d.status&&300>d.status?c.rawAssets[b]=JSON.parse(d.responseText):c.errors[b]="Couldn't load text "+b+": status "+d.status+", "+d.responseText)};d.open("GET",b,!0);d.send()}};a.prototype.loadTexture=function(a,b,c){var d=this;c=this.pathPrefix+c;if(this.queueAsset(a,b,c)){var m=new Image;m.src=c;m.crossOrigin="anonymous";m.onload=function(a){d.rawAssets[c]=m};m.onerror=function(a){d.errors[c]="Couldn't load image "+
c}}};a.prototype.get=function(a,b){b=this.pathPrefix+b;var c=this.clientAssets[a];return null===c||void 0===c?!0:c.assets[b]};a.prototype.updateClientAssets=function(a){for(var b=0;b<a.toLoad.length;b++){var c=a.toLoad[b],d=a.assets[c];if(null===d||void 0===d)d=this.rawAssets[c],null!==d&&void 0!==d&&(a.assets[c]=d instanceof HTMLImageElement?a.textureLoader(d):d)}};a.prototype.isLoadingComplete=function(a){a=this.clientAssets[a];if(null===a||void 0===a)return!0;this.updateClientAssets(a);return a.toLoad.length==
a.loaded()};a.prototype.dispose=function(){};a.prototype.hasErrors=function(){return 0<Object.keys(this.errors).length};a.prototype.getErrors=function(){return this.errors};return a}();a.SharedAssetManager=c})(spine||(spine={}));
(function(a){var b=function(){function b(c){this._updateCache=[];this.updateCacheReset=[];this.time=0;this.flipY=this.flipX=!1;this.y=this.x=0;if(null==c)throw Error("data cannot be null.");this.data=c;this.bones=[];for(var e=0;e<c.bones.length;e++){var f=c.bones[e],h=void 0;if(null==f.parent)h=new a.Bone(f,this,null);else{var k=this.bones[f.parent.index],h=new a.Bone(f,this,k);k.children.push(h)}this.bones.push(h)}this.slots=[];this.drawOrder=[];for(e=0;e<c.slots.length;e++)f=c.slots[e],h=this.bones[f.boneData.index],
h=new a.Slot(f,h),this.slots.push(h),this.drawOrder.push(h);this.ikConstraints=[];for(e=0;e<c.ikConstraints.length;e++)this.ikConstraints.push(new a.IkConstraint(c.ikConstraints[e],this));this.transformConstraints=[];for(e=0;e<c.transformConstraints.length;e++)this.transformConstraints.push(new a.TransformConstraint(c.transformConstraints[e],this));this.pathConstraints=[];for(e=0;e<c.pathConstraints.length;e++)this.pathConstraints.push(new a.PathConstraint(c.pathConstraints[e],this));this.color=new a.Color(1,
1,1,1);this.updateCache()}b.prototype.updateCache=function(){this._updateCache.length=0;this.updateCacheReset.length=0;for(var a=this.bones,b=0,c=a.length;b<c;b++)a[b].sorted=!1;var c=this.ikConstraints,h=this.transformConstraints,k=this.pathConstraints,m=c.length,n=h.length,p=k.length,r=m+n+p,b=0;a:for(;b<r;b++){for(var s=0;s<m;s++){var t=c[s];if(t.data.order==b){this.sortIkConstraint(t);continue a}}for(s=0;s<n;s++)if(t=h[s],t.data.order==b){this.sortTransformConstraint(t);continue a}for(s=0;s<p;s++)if(t=
k[s],t.data.order==b){this.sortPathConstraint(t);continue a}}b=0;for(c=a.length;b<c;b++)this.sortBone(a[b])};b.prototype.sortIkConstraint=function(a){this.sortBone(a.target);var b=a.bones,c=b[0];this.sortBone(c);if(1<b.length){var h=b[b.length-1];-1<this._updateCache.indexOf(h)||this.updateCacheReset.push(h)}this._updateCache.push(a);this.sortReset(c.children);b[b.length-1].sorted=!0};b.prototype.sortPathConstraint=function(b){var c=b.target,f=c.data.index,h=c.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,
f,h);null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,f,h);for(var k=0,m=this.data.skins.length;k<m;k++)this.sortPathConstraintAttachment(this.data.skins[k],f,h);k=c.getAttachment();k instanceof a.PathAttachment&&this.sortPathConstraintAttachmentWith(k,h);h=b.bones;c=h.length;for(k=0;k<c;k++)this.sortBone(h[k]);this._updateCache.push(b);for(k=0;k<c;k++)this.sortReset(h[k].children);for(k=0;k<c;k++)h[k].sorted=!0};b.prototype.sortTransformConstraint=
function(a){this.sortBone(a.target);var b=a.bones,c=b.length;if(a.data.local)for(var h=0;h<c;h++){var k=b[h];this.sortBone(k.parent);-1<this._updateCache.indexOf(k)||this.updateCacheReset.push(k)}else for(h=0;h<c;h++)this.sortBone(b[h]);this._updateCache.push(a);for(a=0;a<c;a++)this.sortReset(b[a].children);for(a=0;a<c;a++)b[a].sorted=!0};b.prototype.sortPathConstraintAttachment=function(a,b,c){if(a=a.attachments[b])for(var h in a)this.sortPathConstraintAttachmentWith(a[h],c)};b.prototype.sortPathConstraintAttachmentWith=
function(b,c){if(b instanceof a.PathAttachment){var f=b.bones;if(null==f)this.sortBone(c);else for(var h=this.bones,k=0;k<f.length;)for(var m=f[k++],m=k+m;k<m;k++)this.sortBone(h[f[k]])}};b.prototype.sortBone=function(a){if(!a.sorted){var b=a.parent;null!=b&&this.sortBone(b);a.sorted=!0;this._updateCache.push(a)}};b.prototype.sortReset=function(a){for(var b=0,c=a.length;b<c;b++){var h=a[b];h.sorted&&this.sortReset(h.children);h.sorted=!1}};b.prototype.updateWorldTransform=function(){for(var a=this.updateCacheReset,
b=0,c=a.length;b<c;b++){var h=a[b];h.ax=h.x;h.ay=h.y;h.arotation=h.rotation;h.ascaleX=h.scaleX;h.ascaleY=h.scaleY;h.ashearX=h.shearX;h.ashearY=h.shearY;h.appliedValid=!0}a=this._updateCache;b=0;for(c=a.length;b<c;b++)a[b].update()};b.prototype.setToSetupPose=function(){this.setBonesToSetupPose();this.setSlotsToSetupPose()};b.prototype.setBonesToSetupPose=function(){for(var a=this.bones,b=0,c=a.length;b<c;b++)a[b].setToSetupPose();for(var h=this.ikConstraints,b=0,c=h.length;b<c;b++)a=h[b],a.bendDirection=
a.data.bendDirection,a.mix=a.data.mix;for(var k=this.transformConstraints,b=0,c=k.length;b<c;b++)a=k[b],h=a.data,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix;k=this.pathConstraints;b=0;for(c=k.length;b<c;b++)a=k[b],h=a.data,a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix};b.prototype.setSlotsToSetupPose=function(){var b=this.slots;a.Utils.arrayCopy(b,0,this.drawOrder,0,b.length);for(var c=0,f=b.length;c<
f;c++)b[c].setToSetupPose()};b.prototype.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]};b.prototype.findBone=function(a){if(null==a)throw Error("boneName cannot be null.");for(var b=this.bones,c=0,h=b.length;c<h;c++){var k=b[c];if(k.data.name==a)return k}return null};b.prototype.findBoneIndex=function(a){if(null==a)throw Error("boneName cannot be null.");for(var b=this.bones,c=0,h=b.length;c<h;c++)if(b[c].data.name==a)return c;return-1};b.prototype.findSlot=function(a){if(null==
a)throw Error("slotName cannot be null.");for(var b=this.slots,c=0,h=b.length;c<h;c++){var k=b[c];if(k.data.name==a)return k}return null};b.prototype.findSlotIndex=function(a){if(null==a)throw Error("slotName cannot be null.");for(var b=this.slots,c=0,h=b.length;c<h;c++)if(b[c].data.name==a)return c;return-1};b.prototype.setSkinByName=function(a){var b=this.data.findSkin(a);if(null==b)throw Error("Skin not found: "+a);this.setSkin(b)};b.prototype.setSkin=function(a){if(null!=a)if(null!=this.skin)a.attachAll(this,
this.skin);else for(var b=this.slots,c=0,h=b.length;c<h;c++){var k=b[c],m=k.data.attachmentName;null!=m&&(m=a.getAttachment(c,m),null!=m&&k.setAttachment(m))}this.skin=a};b.prototype.getAttachmentByName=function(a,b){return this.getAttachment(this.data.findSlotIndex(a),b)};b.prototype.getAttachment=function(a,b){if(null==b)throw Error("attachmentName cannot be null.");if(null!=this.skin){var c=this.skin.getAttachment(a,b);if(null!=c)return c}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(a,
b):null};b.prototype.setAttachment=function(a,b){if(null==a)throw Error("slotName cannot be null.");for(var c=this.slots,h=0,k=c.length;h<k;h++){var m=c[h];if(m.data.name==a){c=null;if(null!=b&&(c=this.getAttachment(h,b),null==c))throw Error("Attachment not found: "+b+", for slot: "+a);m.setAttachment(c);return}}throw Error("Slot not found: "+a);};b.prototype.findIkConstraint=function(a){if(null==a)throw Error("constraintName cannot be null.");for(var b=this.ikConstraints,c=0,h=b.length;c<h;c++){var k=
b[c];if(k.data.name==a)return k}return null};b.prototype.findTransformConstraint=function(a){if(null==a)throw Error("constraintName cannot be null.");for(var b=this.transformConstraints,c=0,h=b.length;c<h;c++){var k=b[c];if(k.data.name==a)return k}return null};b.prototype.findPathConstraint=function(a){if(null==a)throw Error("constraintName cannot be null.");for(var b=this.pathConstraints,c=0,h=b.length;c<h;c++){var k=b[c];if(k.data.name==a)return k}return null};b.prototype.getBounds=function(b,c,
f){if(null==b)throw Error("offset cannot be null.");if(null==c)throw Error("size cannot be null.");for(var h=this.drawOrder,k=Number.POSITIVE_INFINITY,m=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,p=Number.NEGATIVE_INFINITY,r=0,s=h.length;r<s;r++){var t=h[r],w=0,v=null,y=t.getAttachment();y instanceof a.RegionAttachment?(w=8,v=a.Utils.setArraySize(f,w,0),y.computeWorldVertices(t.bone,v,0,2)):y instanceof a.MeshAttachment&&(w=y.worldVerticesLength,v=a.Utils.setArraySize(f,w,0),y.computeWorldVertices(t,
0,w,v,0,2));if(null!=v)for(t=0,w=v.length;t<w;t+=2)var y=v[t],x=v[t+1],k=Math.min(k,y),m=Math.min(m,x),n=Math.max(n,y),p=Math.max(p,x)}b.set(k,m);c.set(n-k,p-m)};b.prototype.update=function(a){this.time+=a};return b}();a.Skeleton=b})(spine||(spine={}));
(function(a){var b=function(){function b(){this.maxY=this.maxX=this.minY=this.minX=0;this.boundingBoxes=[];this.polygons=[];this.polygonPool=new a.Pool(function(){return a.Utils.newFloatArray(16)})}b.prototype.update=function(b,c){if(null==b)throw Error("skeleton cannot be null.");var f=this.boundingBoxes,h=this.polygons,k=this.polygonPool,m=b.slots,n=m.length;f.length=0;k.freeAll(h);for(var p=h.length=0;p<n;p++){var r=m[p],s=r.getAttachment();if(s instanceof a.BoundingBoxAttachment){f.push(s);var t=
k.obtain();t.length!=s.worldVerticesLength&&(t=a.Utils.newFloatArray(s.worldVerticesLength));h.push(t);s.computeWorldVertices(r,0,s.worldVerticesLength,t,0,2)}}c?this.aabbCompute():(this.minY=this.minX=Number.POSITIVE_INFINITY,this.maxY=this.maxX=Number.NEGATIVE_INFINITY)};b.prototype.aabbCompute=function(){for(var a=Number.POSITIVE_INFINITY,b=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY,k=this.polygons,m=0,n=k.length;m<n;m++)for(var p=k[m],r=p,s=0,p=p.length;s<p;s+=
2)var t=r[s],w=r[s+1],a=Math.min(a,t),b=Math.min(b,w),c=Math.max(c,t),h=Math.max(h,w);this.minX=a;this.minY=b;this.maxX=c;this.maxY=h};b.prototype.aabbContainsPoint=function(a,b){return a>=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY};b.prototype.aabbIntersectsSegment=function(a,b,c,h){var k=this.minX,m=this.minY,n=this.maxX,p=this.maxY;if(a<=k&&c<=k||b<=m&&h<=m||a>=n&&c>=n||b>=p&&h>=p)return!1;c=(h-b)/(c-a);h=c*(k-a)+b;if(h>m&&h<p)return!0;h=c*(n-a)+b;if(h>m&&h<p)return!0;m=(m-b)/c+a;if(m>
k&&m<n)return!0;m=(p-b)/c+a;return m>k&&m<n?!0:!1};b.prototype.aabbIntersectsSkeleton=function(a){return this.minX<a.maxX&&this.maxX>a.minX&&this.minY<a.maxY&&this.maxY>a.minY};b.prototype.containsPoint=function(a,b){for(var c=this.polygons,h=0,k=c.length;h<k;h++)if(this.containsPointPolygon(c[h],a,b))return this.boundingBoxes[h];return null};b.prototype.containsPointPolygon=function(a,b,c){for(var h=a.length,k=h-2,m=!1,n=0;n<h;n+=2){var p=a[n+1],r=a[k+1];if(p<c&&r>=c||r<c&&p>=c){var s=a[n];s+(c-
p)/(r-p)*(a[k]-s)<b&&(m=!m)}k=n}return m};b.prototype.intersectsSegment=function(a,b,c,h){for(var k=this.polygons,m=0,n=k.length;m<n;m++)if(this.intersectsSegmentPolygon(k[m],a,b,c,h))return this.boundingBoxes[m];return null};b.prototype.intersectsSegmentPolygon=function(a,b,c,h,k){for(var m=a.length,n=b-h,p=c-k,r=b*k-c*h,s=a[m-2],t=a[m-1],w=0;w<m;w+=2){var v=a[w],y=a[w+1],x=s*y-t*v,u=s-v,z=t-y,A=n*z-p*u,u=(r*u-n*x)/A;if((u>=s&&u<=v||u>=v&&u<=s)&&(u>=b&&u<=h||u>=h&&u<=b)&&(s=(r*z-p*x)/A,(s>=t&&s<=
y||s>=y&&s<=t)&&(s>=c&&s<=k||s>=k&&s<=c)))return!0;s=v;t=y}return!1};b.prototype.getPolygon=function(a){if(null==a)throw Error("boundingBox cannot be null.");a=this.boundingBoxes.indexOf(a);return-1==a?null:this.polygons[a]};b.prototype.getWidth=function(){return this.maxX-this.minX};b.prototype.getHeight=function(){return this.maxY-this.minY};return b}();a.SkeletonBounds=b})(spine||(spine={}));
(function(a){var b=function(){function b(){this.triangulator=new a.Triangulator;this.clippingPolygon=[];this.clipOutput=[];this.clippedVertices=[];this.clippedTriangles=[];this.scratch=[]}b.prototype.clipStart=function(d,e){if(null!=this.clipAttachment)return 0;this.clipAttachment=e;var f=e.worldVerticesLength,h=a.Utils.setArraySize(this.clippingPolygon,f);e.computeWorldVertices(d,0,f,h,0,2);f=this.clippingPolygon;b.makeClockwise(f);for(var f=this.clippingPolygons=this.triangulator.decompose(f,this.triangulator.triangulate(f)),
h=0,k=f.length;h<k;h++){var m=f[h];b.makeClockwise(m);m.push(m[0]);m.push(m[1])}return f.length};b.prototype.clipEndWithSlot=function(a){null!=this.clipAttachment&&this.clipAttachment.endSlot==a.data&&this.clipEnd()};b.prototype.clipEnd=function(){null!=this.clipAttachment&&(this.clippingPolygons=this.clipAttachment=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)};b.prototype.isClipping=function(){return null!=this.clipAttachment};b.prototype.clipTriangles=
function(b,c,f,h,k,m,n,p){c=this.clipOutput;var r=this.clippedVertices,s=this.clippedTriangles,t=this.clippingPolygons,w=this.clippingPolygons.length,v=p?12:8,y=0;r.length=0;var x=s.length=0;a:for(;x<h;x+=3)for(var u=f[x]<<1,z=b[u],A=b[u+1],B=k[u],D=k[u+1],u=f[x+1]<<1,C=b[u],E=b[u+1],J=k[u],G=k[u+1],u=f[x+2]<<1,H=b[u],L=b[u+1],I=k[u],u=k[u+1],M=0;M<w;M++){var F=r.length;if(this.clip(z,A,C,E,H,L,t[M],c)){var N=c.length;if(0!=N){for(var O=E-L,P=H-C,Q=z-H,S=L-A,R=1/(O*Q+P*(A-L)),V=N>>1,U=this.clipOutput,
K=a.Utils.setArraySize(r,F+V*v),W=0;W<N;W+=2){var X=U[W],T=U[W+1];K[F]=X;K[F+1]=T;K[F+2]=m.r;K[F+3]=m.g;K[F+4]=m.b;K[F+5]=m.a;var X=X-H,Y=T-L,T=(O*X+P*Y)*R,X=(S*X+Q*Y)*R,Y=1-T-X;K[F+6]=B*T+J*X+I*Y;K[F+7]=D*T+G*X+u*Y;p&&(K[F+8]=n.r,K[F+9]=n.g,K[F+10]=n.b,K[F+11]=n.a);F+=v}F=s.length;N=a.Utils.setArraySize(s,F+3*(V-2));V--;for(W=1;W<V;W++)N[F]=y,N[F+1]=y+W,N[F+2]=y+W+1,F+=3;y+=V+1}}else{K=a.Utils.setArraySize(r,F+3*v);K[F]=z;K[F+1]=A;K[F+2]=m.r;K[F+3]=m.g;K[F+4]=m.b;K[F+5]=m.a;p?(K[F+6]=B,K[F+7]=D,
K[F+8]=n.r,K[F+9]=n.g,K[F+10]=n.b,K[F+11]=n.a,K[F+12]=C,K[F+13]=E,K[F+14]=m.r,K[F+15]=m.g,K[F+16]=m.b,K[F+17]=m.a,K[F+18]=J,K[F+19]=G,K[F+20]=n.r,K[F+21]=n.g,K[F+22]=n.b,K[F+23]=n.a,K[F+24]=H,K[F+25]=L,K[F+26]=m.r,K[F+27]=m.g,K[F+28]=m.b,K[F+29]=m.a,K[F+30]=I,K[F+31]=u,K[F+32]=n.r,K[F+33]=n.g,K[F+34]=n.b,K[F+35]=n.a):(K[F+6]=B,K[F+7]=D,K[F+8]=C,K[F+9]=E,K[F+10]=m.r,K[F+11]=m.g,K[F+12]=m.b,K[F+13]=m.a,K[F+14]=J,K[F+15]=G,K[F+16]=H,K[F+17]=L,K[F+18]=m.r,K[F+19]=m.g,K[F+20]=m.b,K[F+21]=m.a,K[F+22]=I,
K[F+23]=u);F=s.length;N=a.Utils.setArraySize(s,F+3);N[F]=y;N[F+1]=y+1;N[F+2]=y+2;y+=3;continue a}}};b.prototype.clip=function(a,b,c,h,k,m,n,p){var r=p,s=!1,t=null;2<=n.length%4?(t=p,p=this.scratch):t=this.scratch;t.length=0;t.push(a);t.push(b);t.push(c);t.push(h);t.push(k);t.push(m);t.push(a);t.push(b);p.length=0;b=n.length-4;for(a=0;;a+=2){c=n[a];h=n[a+1];k=n[a+2];m=n[a+3];for(var w=c-k,v=h-m,y=t,x=t.length-2,u=p.length,z=0;z<x;z+=2){var A=y[z],B=y[z+1],D=y[z+2],C=y[z+3],E=0<w*(C-m)-v*(D-k);if(0<
w*(B-m)-v*(A-k)){if(E){p.push(D);p.push(C);continue}s=C-B;E=D-A;s=(E*(h-B)-s*(c-A))/(s*(k-c)-E*(m-h));p.push(c+(k-c)*s);p.push(h+(m-h)*s)}else E&&(s=C-B,E=D-A,s=(E*(h-B)-s*(c-A))/(s*(k-c)-E*(m-h)),p.push(c+(k-c)*s),p.push(h+(m-h)*s),p.push(D),p.push(C));s=!0}if(u==p.length)return r.length=0,!0;p.push(p[0]);p.push(p[1]);if(a==b)break;c=p;p=t;p.length=0;t=c}if(r!=p)for(a=r.length=0,n=p.length-2;a<n;a++)r[a]=p[a];else r.length-=2;return s};b.makeClockwise=function(a){for(var b=a.length,c=a[b-2]*a[1]-
a[0]*a[b-1],h=0,k=0,m=0,n=0,p=0,r=b-3;p<r;p+=2)h=a[p],k=a[p+1],m=a[p+2],n=a[p+3],c+=h*n-m*k;if(!(0>c))for(p=0,c=b-2,r=b>>1;p<r;p+=2)b=a[p],h=a[p+1],k=c-p,a[p]=a[k],a[p+1]=a[k+1],a[k]=b,a[k+1]=h};return b}();a.SkeletonClipping=b})(spine||(spine={}));
(function(a){var b=function(){function a(){this.bones=[];this.slots=[];this.skins=[];this.events=[];this.animations=[];this.ikConstraints=[];this.transformConstraints=[];this.pathConstraints=[];this.fps=0}a.prototype.findBone=function(a){if(null==a)throw Error("boneName cannot be null.");for(var b=this.bones,c=0,h=b.length;c<h;c++){var k=b[c];if(k.name==a)return k}return null};a.prototype.findBoneIndex=function(a){if(null==a)throw Error("boneName cannot be null.");for(var b=this.bones,c=0,h=b.length;c<
h;c++)if(b[c].name==a)return c;return-1};a.prototype.findSlot=function(a){if(null==a)throw Error("slotName cannot be null.");for(var b=this.slots,c=0,h=b.length;c<h;c++){var k=b[c];if(k.name==a)return k}return null};a.prototype.findSlotIndex=function(a){if(null==a)throw Error("slotName cannot be null.");for(var b=this.slots,c=0,h=b.length;c<h;c++)if(b[c].name==a)return c;return-1};a.prototype.findSkin=function(a){if(null==a)throw Error("skinName cannot be null.");for(var b=this.skins,c=0,h=b.length;c<
h;c++){var k=b[c];if(k.name==a)return k}return null};a.prototype.findEvent=function(a){if(null==a)throw Error("eventDataName cannot be null.");for(var b=this.events,c=0,h=b.length;c<h;c++){var k=b[c];if(k.name==a)return k}return null};a.prototype.findAnimation=function(a){if(null==a)throw Error("animationName cannot be null.");for(var b=this.animations,c=0,h=b.length;c<h;c++){var k=b[c];if(k.name==a)return k}return null};a.prototype.findIkConstraint=function(a){if(null==a)throw Error("constraintName cannot be null.");
for(var b=this.ikConstraints,c=0,h=b.length;c<h;c++){var k=b[c];if(k.name==a)return k}return null};a.prototype.findTransformConstraint=function(a){if(null==a)throw Error("constraintName cannot be null.");for(var b=this.transformConstraints,c=0,h=b.length;c<h;c++){var k=b[c];if(k.name==a)return k}return null};a.prototype.findPathConstraint=function(a){if(null==a)throw Error("constraintName cannot be null.");for(var b=this.pathConstraints,c=0,h=b.length;c<h;c++){var k=b[c];if(k.name==a)return k}return null};
a.prototype.findPathConstraintIndex=function(a){if(null==a)throw Error("pathConstraintName cannot be null.");for(var b=this.pathConstraints,c=0,h=b.length;c<h;c++)if(b[c].name==a)return c;return-1};return a}();a.SkeletonData=b})(spine||(spine={}));
(function(a){var b=function(){function b(a){this.scale=1;this.linkedMeshes=[];this.attachmentLoader=a}b.prototype.readSkeletonData=function(c){var f=this.scale,h=new a.SkeletonData;c="string"===typeof c?JSON.parse(c):c;var k=c.skeleton;null!=k&&(h.hash=k.hash,h.version=k.spine,h.width=k.width,h.height=k.height,h.fps=k.fps,h.imagesPath=k.images);if(c.bones)for(k=0;k<c.bones.length;k++){var m=c.bones[k],n=null,p=this.getValue(m,"parent",null);if(null!=p&&(n=h.findBone(p),null==n))throw Error("Parent bone not found: "+
p);n=new a.BoneData(h.bones.length,m.name,n);n.length=this.getValue(m,"length",0)*f;n.x=this.getValue(m,"x",0)*f;n.y=this.getValue(m,"y",0)*f;n.rotation=this.getValue(m,"rotation",0);n.scaleX=this.getValue(m,"scaleX",1);n.scaleY=this.getValue(m,"scaleY",1);n.shearX=this.getValue(m,"shearX",0);n.shearY=this.getValue(m,"shearY",0);n.transformMode=b.transformModeFromString(this.getValue(m,"transform","normal"));h.bones.push(n)}if(c.slots)for(k=0;k<c.slots.length;k++){var m=c.slots[k],r=m.name,p=m.bone,
n=h.findBone(p);if(null==n)throw Error("Slot bone not found: "+p);n=new a.SlotData(h.slots.length,r,n);p=this.getValue(m,"color",null);null!=p&&n.color.setFromString(p);p=this.getValue(m,"dark",null);null!=p&&(n.darkColor=new a.Color(1,1,1,1),n.darkColor.setFromString(p));n.attachmentName=this.getValue(m,"attachment",null);n.blendMode=b.blendModeFromString(this.getValue(m,"blend","normal"));h.slots.push(n)}if(c.ik)for(k=0;k<c.ik.length;k++){m=c.ik[k];n=new a.IkConstraintData(m.name);n.order=this.getValue(m,
"order",0);for(var s=0;s<m.bones.length;s++){var p=m.bones[s],t=h.findBone(p);if(null==t)throw Error("IK bone not found: "+p);n.bones.push(t)}p=m.target;n.target=h.findBone(p);if(null==n.target)throw Error("IK target bone not found: "+p);n.bendDirection=this.getValue(m,"bendPositive",!0)?1:-1;n.mix=this.getValue(m,"mix",1);h.ikConstraints.push(n)}if(c.transform)for(k=0;k<c.transform.length;k++){m=c.transform[k];n=new a.TransformConstraintData(m.name);n.order=this.getValue(m,"order",0);for(s=0;s<m.bones.length;s++){p=
m.bones[s];t=h.findBone(p);if(null==t)throw Error("Transform constraint bone not found: "+p);n.bones.push(t)}p=m.target;n.target=h.findBone(p);if(null==n.target)throw Error("Transform constraint target bone not found: "+p);n.local=this.getValue(m,"local",!1);n.relative=this.getValue(m,"relative",!1);n.offsetRotation=this.getValue(m,"rotation",0);n.offsetX=this.getValue(m,"x",0)*f;n.offsetY=this.getValue(m,"y",0)*f;n.offsetScaleX=this.getValue(m,"scaleX",0);n.offsetScaleY=this.getValue(m,"scaleY",
0);n.offsetShearY=this.getValue(m,"shearY",0);n.rotateMix=this.getValue(m,"rotateMix",1);n.translateMix=this.getValue(m,"translateMix",1);n.scaleMix=this.getValue(m,"scaleMix",1);n.shearMix=this.getValue(m,"shearMix",1);h.transformConstraints.push(n)}if(c.path)for(k=0;k<c.path.length;k++){m=c.path[k];n=new a.PathConstraintData(m.name);n.order=this.getValue(m,"order",0);for(s=0;s<m.bones.length;s++){p=m.bones[s];t=h.findBone(p);if(null==t)throw Error("Transform constraint bone not found: "+p);n.bones.push(t)}p=
m.target;n.target=h.findSlot(p);if(null==n.target)throw Error("Path target slot not found: "+p);n.positionMode=b.positionModeFromString(this.getValue(m,"positionMode","percent"));n.spacingMode=b.spacingModeFromString(this.getValue(m,"spacingMode","length"));n.rotateMode=b.rotateModeFromString(this.getValue(m,"rotateMode","tangent"));n.offsetRotation=this.getValue(m,"rotation",0);n.position=this.getValue(m,"position",0);n.positionMode==a.PositionMode.Fixed&&(n.position*=f);n.spacing=this.getValue(m,
"spacing",0);if(n.spacingMode==a.SpacingMode.Length||n.spacingMode==a.SpacingMode.Fixed)n.spacing*=f;n.rotateMix=this.getValue(m,"rotateMix",1);n.translateMix=this.getValue(m,"translateMix",1);h.pathConstraints.push(n)}if(c.skins)for(var w in c.skins){k=c.skins[w];f=new a.Skin(w);for(r in k){n=h.findSlotIndex(r);if(-1==n)throw Error("Slot not found: "+r);var m=k[r],v;for(v in m)p=this.readAttachment(m[v],f,n,v,h),null!=p&&f.addAttachment(n,v,p)}h.skins.push(f);"default"==f.name&&(h.defaultSkin=f)}k=
0;for(r=this.linkedMeshes.length;k<r;k++){w=this.linkedMeshes[k];f=null==w.skin?h.defaultSkin:h.findSkin(w.skin);if(null==f)throw Error("Skin not found: "+w.skin);v=f.getAttachment(w.slotIndex,w.parent);if(null==v)throw Error("Parent mesh not found: "+w.parent);w.mesh.setParentMesh(v);w.mesh.updateUVs()}this.linkedMeshes.length=0;if(c.events)for(var y in c.events)r=c.events[y],n=new a.EventData(y),n.intValue=this.getValue(r,"int",0),n.floatValue=this.getValue(r,"float",0),n.stringValue=this.getValue(r,
"string",""),h.events.push(n);if(c.animations)for(var x in c.animations)this.readAnimation(c.animations[x],x,h);return h};b.prototype.readAttachment=function(b,d,h,k,m){var n=this.scale;k=this.getValue(b,"name",k);switch(this.getValue(b,"type","region")){case "region":m=this.getValue(b,"path",k);h=this.attachmentLoader.newRegionAttachment(d,k,m);if(null==h)break;h.path=m;h.x=this.getValue(b,"x",0)*n;h.y=this.getValue(b,"y",0)*n;h.scaleX=this.getValue(b,"scaleX",1);h.scaleY=this.getValue(b,"scaleY",
1);h.rotation=this.getValue(b,"rotation",0);h.width=b.width*n;h.height=b.height*n;n=this.getValue(b,"color",null);null!=n&&h.color.setFromString(n);h.updateOffset();return h;case "boundingbox":m=this.attachmentLoader.newBoundingBoxAttachment(d,k);if(null==m)break;this.readVertices(b,m,b.vertexCount<<1);n=this.getValue(b,"color",null);null!=n&&m.color.setFromString(n);return m;case "mesh":case "linkedmesh":m=this.getValue(b,"path",k);d=this.attachmentLoader.newMeshAttachment(d,k,m);if(null==d)break;
d.path=m;n=this.getValue(b,"color",null);null!=n&&d.color.setFromString(n);n=this.getValue(b,"parent",null);if(null!=n)return d.inheritDeform=this.getValue(b,"deform",!0),this.linkedMeshes.push(new c(d,this.getValue(b,"skin",null),h,n)),d;n=b.uvs;this.readVertices(b,d,n.length);d.triangles=b.triangles;d.regionUVs=n;d.updateUVs();d.hullLength=2*this.getValue(b,"hull",0);return d;case "path":m=this.attachmentLoader.newPathAttachment(d,k);if(null==m)break;m.closed=this.getValue(b,"closed",!1);m.constantSpeed=
this.getValue(b,"constantSpeed",!0);d=b.vertexCount;this.readVertices(b,m,d<<1);h=a.Utils.newArray(d/3,0);for(d=0;d<b.lengths.length;d++)h[d]=b.lengths[d]*n;m.lengths=h;n=this.getValue(b,"color",null);null!=n&&m.color.setFromString(n);return m;case "point":m=this.attachmentLoader.newPointAttachment(d,k);if(null==m)break;m.x=this.getValue(b,"x",0)*n;m.y=this.getValue(b,"y",0)*n;m.rotation=this.getValue(b,"rotation",0);n=this.getValue(b,"color",null);null!=n&&m.color.setFromString(n);return m;case "clipping":h=
this.attachmentLoader.newClippingAttachment(d,k);if(null==h)break;n=this.getValue(b,"end",null);if(null!=n){m=m.findSlot(n);if(null==m)throw Error("Clipping end slot not found: "+n);h.endSlot=m}d=b.vertexCount;this.readVertices(b,h,d<<1);n=this.getValue(b,"color",null);null!=n&&h.color.setFromString(n);return h}return null};b.prototype.readVertices=function(b,c,d){var k=this.scale;c.worldVerticesLength=d;b=b.vertices;if(d==b.length){var m=a.Utils.toFloatArray(b);if(1!=k){d=0;for(var n=b.length;d<
n;d++)m[d]*=k}c.vertices=m}else{var m=[],p=[];d=0;for(n=b.length;d<n;){var r=b[d++];p.push(r);for(r=d+4*r;d<r;d+=4)p.push(b[d]),m.push(b[d+1]*k),m.push(b[d+2]*k),m.push(b[d+3])}c.bones=p;c.vertices=a.Utils.toFloatArray(m)}};b.prototype.readAnimation=function(b,c,d){var k=this.scale,m=[],n=0;if(b.slots)for(var p in b.slots){var r=b.slots[p],s=d.findSlotIndex(p);if(-1==s)throw Error("Slot not found: "+p);for(var t in r){var w=r[t];if("attachment"==t){var v=new a.AttachmentTimeline(w.length);v.slotIndex=
s;for(var y=0,x=0;x<w.length;x++){var u=w[x];v.setFrame(y++,u.time,u.name)}m.push(v);n=Math.max(n,v.frames[v.getFrameCount()-1])}else if("color"==t){v=new a.ColorTimeline(w.length);v.slotIndex=s;for(x=y=0;x<w.length;x++){var u=w[x],z=new a.Color;z.setFromString(u.color);v.setFrame(y,u.time,z.r,z.g,z.b,z.a);this.readCurve(u,v,y);y++}m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-1)*a.ColorTimeline.ENTRIES])}else if("twoColor"==t){v=new a.TwoColorTimeline(w.length);v.slotIndex=s;for(x=y=0;x<w.length;x++){var u=
w[x],z=new a.Color,A=new a.Color;z.setFromString(u.light);A.setFromString(u.dark);v.setFrame(y,u.time,z.r,z.g,z.b,z.a,A.r,A.g,A.b);this.readCurve(u,v,y);y++}m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-1)*a.TwoColorTimeline.ENTRIES])}else throw Error("Invalid timeline type for a slot: "+t+" ("+p+")");}}if(b.bones)for(var B in b.bones){r=b.bones[B];z=d.findBoneIndex(B);if(-1==z)throw Error("Bone not found: "+B);for(t in r)if(w=r[t],"rotate"===t){v=new a.RotateTimeline(w.length);v.boneIndex=z;
for(x=y=0;x<w.length;x++)u=w[x],v.setFrame(y,u.time,u.angle),this.readCurve(u,v,y),y++;m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-1)*a.RotateTimeline.ENTRIES])}else if("translate"===t||"scale"===t||"shear"===t){s=1;"scale"===t?v=new a.ScaleTimeline(w.length):"shear"===t?v=new a.ShearTimeline(w.length):(v=new a.TranslateTimeline(w.length),s=k);v.boneIndex=z;for(x=y=0;x<w.length;x++){var u=w[x],A=this.getValue(u,"x",0),D=this.getValue(u,"y",0);v.setFrame(y,u.time,A*s,D*s);this.readCurve(u,v,
y);y++}m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-1)*a.TranslateTimeline.ENTRIES])}else throw Error("Invalid timeline type for a bone: "+t+" ("+B+")");}if(b.ik)for(var C in b.ik){r=b.ik[C];y=d.findIkConstraint(C);v=new a.IkConstraintTimeline(r.length);v.ikConstraintIndex=d.ikConstraints.indexOf(y);for(x=y=0;x<r.length;x++)u=r[x],v.setFrame(y,u.time,this.getValue(u,"mix",1),this.getValue(u,"bendPositive",!0)?1:-1),this.readCurve(u,v,y),y++;m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-
1)*a.IkConstraintTimeline.ENTRIES])}if(b.transform)for(C in b.transform){r=b.transform[C];y=d.findTransformConstraint(C);v=new a.TransformConstraintTimeline(r.length);v.transformConstraintIndex=d.transformConstraints.indexOf(y);for(x=y=0;x<r.length;x++)u=r[x],v.setFrame(y,u.time,this.getValue(u,"rotateMix",1),this.getValue(u,"translateMix",1),this.getValue(u,"scaleMix",1),this.getValue(u,"shearMix",1)),this.readCurve(u,v,y),y++;m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-1)*a.TransformConstraintTimeline.ENTRIES])}if(b.paths)for(C in b.paths){r=
b.paths[C];B=d.findPathConstraintIndex(C);if(-1==B)throw Error("Path constraint not found: "+C);z=d.pathConstraints[B];for(t in r)if(w=r[t],"position"===t||"spacing"===t){s=1;if("spacing"===t){if(v=new a.PathConstraintSpacingTimeline(w.length),z.spacingMode==a.SpacingMode.Length||z.spacingMode==a.SpacingMode.Fixed)s=k}else v=new a.PathConstraintPositionTimeline(w.length),z.positionMode==a.PositionMode.Fixed&&(s=k);v.pathConstraintIndex=B;for(x=y=0;x<w.length;x++)u=w[x],v.setFrame(y,u.time,this.getValue(u,
t,0)*s),this.readCurve(u,v,y),y++;m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-1)*a.PathConstraintPositionTimeline.ENTRIES])}else if("mix"===t){v=new a.PathConstraintMixTimeline(w.length);v.pathConstraintIndex=B;for(x=y=0;x<w.length;x++)u=w[x],v.setFrame(y,u.time,this.getValue(u,"rotateMix",1),this.getValue(u,"translateMix",1)),this.readCurve(u,v,y),y++;m.push(v);n=Math.max(n,v.frames[(v.getFrameCount()-1)*a.PathConstraintMixTimeline.ENTRIES])}}if(b.deform)for(var E in b.deform){B=b.deform[E];
z=d.findSkin(E);if(null==z)throw Error("Skin not found: "+E);for(p in B){r=B[p];s=d.findSlotIndex(p);if(-1==s)throw Error("Slot not found: "+r.name);for(t in r){w=r[t];y=z.getAttachment(s,t);if(null==y)throw Error("Deform attachment not found: "+w.name);var A=null!=y.bones,D=y.vertices,J=A?D.length/3*2:D.length,v=new a.DeformTimeline(w.length);v.slotIndex=s;v.attachment=y;for(C=y=0;C<w.length;C++){var u=w[C],G=void 0,H=this.getValue(u,"vertices",null);if(null==H)G=A?a.Utils.newFloatArray(J):D;else{G=
a.Utils.newFloatArray(J);x=this.getValue(u,"offset",0);a.Utils.arrayCopy(H,0,G,x,H.length);if(1!=k)for(H=x+H.length;x<H;x++)G[x]*=k;if(!A)for(x=0;x<J;x++)G[x]+=D[x]}v.setFrame(y,u.time,G);this.readCurve(u,v,y);y++}m.push(v);n=Math.max(n,v.frames[v.getFrameCount()-1])}}}k=b.drawOrder;null==k&&(k=b.draworder);if(null!=k){v=new a.DrawOrderTimeline(k.length);p=d.slots.length;for(C=y=0;C<k.length;C++){t=k[C];E=null;w=this.getValue(t,"offsets",null);if(null!=w){E=a.Utils.newArray(p,-1);u=a.Utils.newArray(p-
w.length,0);for(x=B=r=0;x<w.length;x++){z=w[x];s=d.findSlotIndex(z.slot);if(-1==s)throw Error("Slot not found: "+z.slot);for(;r!=s;)u[B++]=r++;E[r+z.offset]=r++}for(;r<p;)u[B++]=r++;for(x=p-1;0<=x;x--)-1==E[x]&&(E[x]=u[--B])}v.setFrame(y++,t.time,E)}m.push(v);n=Math.max(n,v.frames[v.getFrameCount()-1])}if(b.events){v=new a.EventTimeline(b.events.length);for(x=y=0;x<b.events.length;x++){k=b.events[x];p=d.findEvent(k.name);if(null==p)throw Error("Event not found: "+k.name);s=new a.Event(a.Utils.toSinglePrecision(k.time),
p);s.intValue=this.getValue(k,"int",p.intValue);s.floatValue=this.getValue(k,"float",p.floatValue);s.stringValue=this.getValue(k,"string",p.stringValue);v.setFrame(y++,s)}m.push(v);n=Math.max(n,v.frames[v.getFrameCount()-1])}if(isNaN(n))throw Error("Error while parsing animation, duration is NaN");d.animations.push(new a.Animation(c,m,n))};b.prototype.readCurve=function(a,b,c){a.curve&&("stepped"===a.curve?b.setStepped(c):"[object Array]"===Object.prototype.toString.call(a.curve)&&(a=a.curve,b.setCurve(c,
a[0],a[1],a[2],a[3])))};b.prototype.getValue=function(a,b,c){return void 0!==a[b]?a[b]:c};b.blendModeFromString=function(b){b=b.toLowerCase();if("normal"==b)return a.BlendMode.Normal;if("additive"==b)return a.BlendMode.Additive;if("multiply"==b)return a.BlendMode.Multiply;if("screen"==b)return a.BlendMode.Screen;throw Error("Unknown blend mode: "+b);};b.positionModeFromString=function(b){b=b.toLowerCase();if("fixed"==b)return a.PositionMode.Fixed;if("percent"==b)return a.PositionMode.Percent;throw Error("Unknown position mode: "+
b);};b.spacingModeFromString=function(b){b=b.toLowerCase();if("length"==b)return a.SpacingMode.Length;if("fixed"==b)return a.SpacingMode.Fixed;if("percent"==b)return a.SpacingMode.Percent;throw Error("Unknown position mode: "+b);};b.rotateModeFromString=function(b){b=b.toLowerCase();if("tangent"==b)return a.RotateMode.Tangent;if("chain"==b)return a.RotateMode.Chain;if("chainscale"==b)return a.RotateMode.ChainScale;throw Error("Unknown rotate mode: "+b);};b.transformModeFromString=function(b){b=b.toLowerCase();
if("normal"==b)return a.TransformMode.Normal;if("onlytranslation"==b)return a.TransformMode.OnlyTranslation;if("norotationorreflection"==b)return a.TransformMode.NoRotationOrReflection;if("noscale"==b)return a.TransformMode.NoScale;if("noscaleorreflection"==b)return a.TransformMode.NoScaleOrReflection;throw Error("Unknown transform mode: "+b);};return b}();a.SkeletonJson=b;var c=function(){return function(a,b,c,h){this.mesh=a;this.skin=b;this.slotIndex=c;this.parent=h}}()})(spine||(spine={}));
(function(a){var b=function(){function a(b){this.attachments=[];if(null==b)throw Error("name cannot be null.");this.name=b}a.prototype.addAttachment=function(a,b,c){if(null==c)throw Error("attachment cannot be null.");var h=this.attachments;a>=h.length&&(h.length=a+1);h[a]||(h[a]={});h[a][b]=c};a.prototype.getAttachment=function(a,b){var c=this.attachments[a];return c?c[b]:null};a.prototype.attachAll=function(a,b){for(var c=0,h=0;h<a.slots.length;h++){var k=a.slots[h],m=k.getAttachment();if(m&&c<
b.attachments.length){var n=b.attachments[c],p;for(p in n)if(m==n[p]){m=this.getAttachment(c,p);null!=m&&k.setAttachment(m);break}}c++}};return a}();a.Skin=b})(spine||(spine={}));
(function(a){var b=function(){function b(c,e){this.attachmentVertices=[];if(null==c)throw Error("data cannot be null.");if(null==e)throw Error("bone cannot be null.");this.data=c;this.bone=e;this.color=new a.Color;this.darkColor=null==c.darkColor?null:new a.Color;this.setToSetupPose()}b.prototype.getAttachment=function(){return this.attachment};b.prototype.setAttachment=function(a){this.attachment!=a&&(this.attachment=a,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)};
b.prototype.setAttachmentTime=function(a){this.attachmentTime=this.bone.skeleton.time-a};b.prototype.getAttachmentTime=function(){return this.bone.skeleton.time-this.attachmentTime};b.prototype.setToSetupPose=function(){this.color.setFromColor(this.data.color);null!=this.darkColor&&this.darkColor.setFromColor(this.data.darkColor);null==this.data.attachmentName?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))};
return b}();a.Slot=b})(spine||(spine={}));(function(a){var b=function(){return function(b,d,e){this.color=new a.Color(1,1,1,1);if(0>b)throw Error("index must be \x3e\x3d 0.");if(null==d)throw Error("name cannot be null.");if(null==e)throw Error("boneData cannot be null.");this.index=b;this.name=d;this.boneData=e}}();a.SlotData=b})(spine||(spine={}));
(function(a){var b=function(){function a(b){this._image=b}a.prototype.getImage=function(){return this._image};a.filterFromString=function(a){switch(a.toLowerCase()){case "nearest":return c.Nearest;case "linear":return c.Linear;case "mipmap":return c.MipMap;case "mipmapnearestnearest":return c.MipMapNearestNearest;case "mipmaplinearnearest":return c.MipMapLinearNearest;case "mipmapnearestlinear":return c.MipMapNearestLinear;case "mipmaplinearlinear":return c.MipMapLinearLinear;default:throw Error("Unknown texture filter "+
a);}};a.wrapFromString=function(a){switch(a.toLowerCase()){case "mirroredtepeat":return d.MirroredRepeat;case "clamptoedge":return d.ClampToEdge;case "repeat":return d.Repeat;default:throw Error("Unknown texture wrap "+a);}};return a}();a.Texture=b;var c;(function(a){a[a.Nearest=9728]="Nearest";a[a.Linear=9729]="Linear";a[a.MipMap=9987]="MipMap";a[a.MipMapNearestNearest=9984]="MipMapNearestNearest";a[a.MipMapLinearNearest=9985]="MipMapLinearNearest";a[a.MipMapNearestLinear=9986]="MipMapNearestLinear";
a[a.MipMapLinearLinear=9987]="MipMapLinearLinear"})(c=a.TextureFilter||(a.TextureFilter={}));var d;(function(a){a[a.MirroredRepeat=33648]="MirroredRepeat";a[a.ClampToEdge=33071]="ClampToEdge";a[a.Repeat=10497]="Repeat"})(d=a.TextureWrap||(a.TextureWrap={}));b=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=b})(spine||(spine={}));
(function(a){var b=function(){function b(a,c){this.pages=[];this.regions=[];this.load(a,c)}b.prototype.load=function(b,f){if(null==f)throw Error("textureLoader cannot be null.");for(var m=new c(b),n=Array(4),p=null;;){var r=m.readLine();if(null==r)break;r=r.trim();if(0==r.length)p=null;else if(p){var s=new e;s.name=r;s.page=p;s.rotate="true"==m.readValue();m.readTuple(n);var r=parseInt(n[0]),t=parseInt(n[1]);m.readTuple(n);var w=parseInt(n[0]),v=parseInt(n[1]);s.u=r/p.width;s.v=t/p.height;s.rotate?
(s.u2=(r+v)/p.width,s.v2=(t+w)/p.height):(s.u2=(r+w)/p.width,s.v2=(t+v)/p.height);s.x=r;s.y=t;s.width=Math.abs(w);s.height=Math.abs(v);4==m.readTuple(n)&&4==m.readTuple(n)&&m.readTuple(n);s.originalWidth=parseInt(n[0]);s.originalHeight=parseInt(n[1]);m.readTuple(n);s.offsetX=parseInt(n[0]);s.offsetY=parseInt(n[1]);s.index=parseInt(m.readValue());s.texture=p.texture;this.regions.push(s)}else p=new d,p.name=r,2==m.readTuple(n)&&(p.width=parseInt(n[0]),p.height=parseInt(n[1]),m.readTuple(n)),m.readTuple(n),
p.minFilter=a.Texture.filterFromString(n[0]),p.magFilter=a.Texture.filterFromString(n[1]),s=m.readValue(),p.uWrap=a.TextureWrap.ClampToEdge,p.vWrap=a.TextureWrap.ClampToEdge,"x"==s?p.uWrap=a.TextureWrap.Repeat:"y"==s?p.vWrap=a.TextureWrap.Repeat:"xy"==s&&(p.uWrap=p.vWrap=a.TextureWrap.Repeat),p.texture=f(r),p.texture.setFilters(p.minFilter,p.magFilter),p.texture.setWraps(p.uWrap,p.vWrap),p.width=p.texture.getImage().width,p.height=p.texture.getImage().height,this.pages.push(p)}};b.prototype.findRegion=
function(a){for(var b=0;b<this.regions.length;b++)if(this.regions[b].name==a)return this.regions[b];return null};b.prototype.dispose=function(){for(var a=0;a<this.pages.length;a++)this.pages[a].texture.dispose()};return b}();a.TextureAtlas=b;var c=function(){function a(b){this.index=0;this.lines=b.split(/\r\n|\r|\n/)}a.prototype.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]};a.prototype.readValue=function(){var a=this.readLine(),b=a.indexOf(":");if(-1==b)throw Error("Invalid line: "+
a);return a.substring(b+1).trim()};a.prototype.readTuple=function(a){var b=this.readLine(),c=b.indexOf(":");if(-1==c)throw Error("Invalid line: "+b);for(var d=0,c=c+1;3>d;d++){var e=b.indexOf(",",c);if(-1==e)break;a[d]=b.substr(c,e-c).trim();c=e+1}a[d]=b.substring(c).trim();return d+1};return a}(),d=function(){return function(){}}();a.TextureAtlasPage=d;var e=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}__extends(b,a);return b}(a.TextureRegion);a.TextureAtlasRegion=e})(spine||
(spine={}));
(function(a){var b=function(){function b(c,e){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==c)throw Error("data cannot be null.");if(null==e)throw Error("skeleton cannot be null.");this.data=c;this.rotateMix=c.rotateMix;this.translateMix=c.translateMix;this.scaleMix=c.scaleMix;this.shearMix=c.shearMix;this.bones=[];for(var f=0;f<c.bones.length;f++)this.bones.push(e.findBone(c.bones[f].name));this.target=e.findBone(c.target.name)}b.prototype.apply=function(){this.update()};
b.prototype.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()};b.prototype.applyAbsoluteWorld=function(){for(var b=this.rotateMix,c=this.translateMix,f=this.scaleMix,h=this.shearMix,k=this.target,m=k.a,n=k.b,p=k.c,r=k.d,s=0<m*r-n*p?a.MathUtils.degRad:-a.MathUtils.degRad,t=this.data.offsetRotation*s,s=this.data.offsetShearY*s,w=this.bones,v=0,y=w.length;v<y;v++){var x=w[v],
u=!1;if(0!=b){var z=x.a,u=x.b,A=x.c,B=x.d,D=Math.atan2(p,m)-Math.atan2(A,z)+t;D>a.MathUtils.PI?D-=a.MathUtils.PI2:D<-a.MathUtils.PI&&(D+=a.MathUtils.PI2);var D=D*b,C=Math.cos(D),D=Math.sin(D);x.a=C*z-D*A;x.b=C*u-D*B;x.c=D*z+C*A;x.d=D*u+C*B;u=!0}0!=c&&(u=this.temp,k.localToWorld(u.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(u.x-x.worldX)*c,x.worldY+=(u.y-x.worldY)*c,u=!0);0<f&&(u=Math.sqrt(x.a*x.a+x.c*x.c),B=Math.sqrt(m*m+p*p),1E-5<u&&(u=(u+(B-u+this.data.offsetScaleX)*f)/u),x.a*=u,x.c*=u,
u=Math.sqrt(x.b*x.b+x.d*x.d),B=Math.sqrt(n*n+r*r),1E-5<u&&(u=(u+(B-u+this.data.offsetScaleY)*f)/u),x.b*=u,x.d*=u,u=!0);0<h&&(u=x.b,B=x.d,z=Math.atan2(B,u),D=Math.atan2(r,n)-Math.atan2(p,m)-(z-Math.atan2(x.c,x.a)),D>a.MathUtils.PI?D-=a.MathUtils.PI2:D<-a.MathUtils.PI&&(D+=a.MathUtils.PI2),D=z+(D+s)*h,u=Math.sqrt(u*u+B*B),x.b=Math.cos(D)*u,x.d=Math.sin(D)*u,u=!0);u&&(x.appliedValid=!1)}};b.prototype.applyRelativeWorld=function(){for(var b=this.rotateMix,c=this.translateMix,f=this.scaleMix,h=this.shearMix,
k=this.target,m=k.a,n=k.b,p=k.c,r=k.d,s=0<m*r-n*p?a.MathUtils.degRad:-a.MathUtils.degRad,t=this.data.offsetRotation*s,s=this.data.offsetShearY*s,w=this.bones,v=0,y=w.length;v<y;v++){var x=w[v],u=!1;if(0!=b){var u=x.a,z=x.b,A=x.c,B=x.d,D=Math.atan2(p,m)+t;D>a.MathUtils.PI?D-=a.MathUtils.PI2:D<-a.MathUtils.PI&&(D+=a.MathUtils.PI2);var D=D*b,C=Math.cos(D),D=Math.sin(D);x.a=C*u-D*A;x.b=C*z-D*B;x.c=D*u+C*A;x.d=D*z+C*B;u=!0}0!=c&&(u=this.temp,k.localToWorld(u.set(this.data.offsetX,this.data.offsetY)),x.worldX+=
u.x*c,x.worldY+=u.y*c,u=!0);0<f&&(u=(Math.sqrt(m*m+p*p)-1+this.data.offsetScaleX)*f+1,x.a*=u,x.c*=u,u=(Math.sqrt(n*n+r*r)-1+this.data.offsetScaleY)*f+1,x.b*=u,x.d*=u,u=!0);0<h&&(D=Math.atan2(r,n)-Math.atan2(p,m),D>a.MathUtils.PI?D-=a.MathUtils.PI2:D<-a.MathUtils.PI&&(D+=a.MathUtils.PI2),z=x.b,B=x.d,D=Math.atan2(B,z)+(D-a.MathUtils.PI/2+s)*h,u=Math.sqrt(z*z+B*B),x.b=Math.cos(D)*u,x.d=Math.sin(D)*u,u=!0);u&&(x.appliedValid=!1)}};b.prototype.applyAbsoluteLocal=function(){var a=this.rotateMix,b=this.translateMix,
c=this.scaleMix,h=this.shearMix,k=this.target;k.appliedValid||k.updateAppliedTransform();for(var m=this.bones,n=0,p=m.length;n<p;n++){var r=m[n];r.appliedValid||r.updateAppliedTransform();var s=r.arotation;if(0!=a)var t=k.arotation-s+this.data.offsetRotation,t=t-360*(16384-(16384.499999999996-t/360|0)),s=s+t*a;var w=r.ax,v=r.ay;0!=b&&(w+=(k.ax-w+this.data.offsetX)*b,v+=(k.ay-v+this.data.offsetY)*b);var y=r.ascaleX,x=r.ascaleY;0<c&&(1E-5<y&&(y=(y+(k.ascaleX-y+this.data.offsetScaleX)*c)/y),1E-5<x&&
(x=(x+(k.ascaleY-x+this.data.offsetScaleY)*c)/x));var u=r.ashearY;0<h&&(t=k.ashearY-u+this.data.offsetShearY,t-=360*(16384-(16384.499999999996-t/360|0)),r.shearY+=t*h);r.updateWorldTransformWith(w,v,s,y,x,r.ashearX,u)}};b.prototype.applyRelativeLocal=function(){var a=this.rotateMix,b=this.translateMix,c=this.scaleMix,h=this.shearMix,k=this.target;k.appliedValid||k.updateAppliedTransform();for(var m=this.bones,n=0,p=m.length;n<p;n++){var r=m[n];r.appliedValid||r.updateAppliedTransform();var s=r.arotation;
0!=a&&(s+=(k.arotation+this.data.offsetRotation)*a);var t=r.ax,w=r.ay;0!=b&&(t+=(k.ax+this.data.offsetX)*b,w+=(k.ay+this.data.offsetY)*b);var v=r.ascaleX,y=r.ascaleY;0<c&&(1E-5<v&&(v*=(k.ascaleX-1+this.data.offsetScaleX)*c+1),1E-5<y&&(y*=(k.ascaleY-1+this.data.offsetScaleY)*c+1));var x=r.ashearY;0<h&&(x+=(k.ashearY+this.data.offsetShearY)*h);r.updateWorldTransformWith(t,w,s,v,y,r.ashearX,x)}};b.prototype.getOrder=function(){return this.data.order};return b}();a.TransformConstraint=b})(spine||(spine=
{}));(function(a){var b=function(){return function(a){this.order=0;this.bones=[];this.offsetShearY=this.offsetScaleY=this.offsetScaleX=this.offsetY=this.offsetX=this.offsetRotation=this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.local=this.relative=!1;if(null==a)throw Error("name cannot be null.");this.name=a}}();a.TransformConstraintData=b})(spine||(spine={}));
(function(a){var b=function(){function b(){this.convexPolygons=[];this.convexPolygonsIndices=[];this.indicesArray=[];this.isConcaveArray=[];this.triangles=[];this.polygonPool=new a.Pool(function(){return[]});this.polygonIndicesPool=new a.Pool(function(){return[]})}b.prototype.triangulate=function(a){for(var e=a.length>>1,f=this.indicesArray,h=f.length=0;h<e;h++)f[h]=h;for(var k=this.isConcaveArray,h=k.length=0,m=e;h<m;++h)k[h]=b.isConcave(h,e,a,f);m=this.triangles;for(m.length=0;3<e;){for(var n=e-
1,h=0,p=1;;){a:if(!k[h]){for(var r=f[n]<<1,s=f[h]<<1,t=f[p]<<1,w=a[r],r=a[r+1],v=a[s],s=a[s+1],y=a[t],t=a[t+1],x=(p+1)%e;x!=n;x=(x+1)%e)if(k[x]){var u=f[x]<<1,z=a[u],u=a[u+1];if(b.positiveArea(y,t,w,r,z,u)&&b.positiveArea(w,r,v,s,z,u)&&b.positiveArea(v,s,y,t,z,u))break a}break}if(0==p){do{if(!k[h])break;h--}while(0<h);break}n=h;h=p;p=(p+1)%e}m.push(f[(e+h-1)%e]);m.push(f[h]);m.push(f[(h+1)%e]);f.splice(h,1);k.splice(h,1);e--;n=(e+h-1)%e;h=h==e?0:h;k[n]=b.isConcave(n,e,a,f);k[h]=b.isConcave(h,e,a,
f)}3==e&&(m.push(f[2]),m.push(f[0]),m.push(f[1]));return m};b.prototype.decompose=function(a,e){var f=this.convexPolygons;this.polygonPool.freeAll(f);f.length=0;var h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h);h.length=0;var k=this.polygonIndicesPool.obtain();k.length=0;var m=this.polygonPool.obtain();m.length=0;for(var n=-1,p=0,r=0,s=e.length;r<s;r+=3){var t=e[r]<<1,w=e[r+1]<<1,v=e[r+2]<<1,y=a[t],x=a[t+1],u=a[w],z=a[w+1],A=a[v],B=a[v+1],D=!1;if(n==t){var C=m.length-4,C=b.winding(m[C],
m[C+1],m[C+2],m[C+3],A,B),E=b.winding(A,B,m[0],m[1],m[2],m[3]);C==p&&E==p&&(m.push(A),m.push(B),k.push(v),D=!0)}D||(0<m.length?(f.push(m),h.push(k)):(this.polygonPool.free(m),this.polygonIndicesPool.free(k)),m=this.polygonPool.obtain(),m.length=0,m.push(y),m.push(x),m.push(u),m.push(z),m.push(A),m.push(B),k=this.polygonIndicesPool.obtain(),k.length=0,k.push(t),k.push(w),k.push(v),p=b.winding(y,x,u,z,A,B),n=t)}0<m.length&&(f.push(m),h.push(k));r=0;for(s=f.length;r<s;r++)if(k=h[r],0!=k.length)for(var n=
k[0],p=k[k.length-1],m=f[r],C=m.length-4,t=m[C],w=m[C+1],v=m[C+2],y=m[C+3],x=m[0],u=m[1],z=m[2],D=m[3],J=b.winding(t,w,v,y,x,u),G=0;G<s;G++)if(G!=r){var H=h[G];if(3==H.length){var C=H[0],E=H[1],L=H[2],I=f[G],A=I[I.length-2],B=I[I.length-1];C==n&&E==p&&(C=b.winding(t,w,v,y,A,B),E=b.winding(A,B,x,u,z,D),C==J&&E==J&&(I.length=0,H.length=0,m.push(A),m.push(B),k.push(L),t=v,w=y,v=A,y=B,G=0))}}for(r=f.length-1;0<=r;r--)m=f[r],0==m.length&&(f.splice(r,1),this.polygonPool.free(m),k=h[r],h.splice(r,1),this.polygonIndicesPool.free(k));
return f};b.isConcave=function(a,b,c,h){var k=h[(b+a-1)%b]<<1,m=h[a]<<1;a=h[(a+1)%b]<<1;return!this.positiveArea(c[k],c[k+1],c[m],c[m+1],c[a],c[a+1])};b.positiveArea=function(a,b,c,h,k,m){return 0<=a*(m-h)+c*(b-m)+k*(h-b)};b.winding=function(a,b,c,h,k,m){c-=a;h-=b;return 0<=k*h-m*c+c*b-a*h?1:-1};return b}();a.Triangulator=b})(spine||(spine={}));
(function(a){var b=function(){function a(){this.array=[]}a.prototype.add=function(a){var b=this.contains(a);this.array[a|0]=a|0;return!b};a.prototype.contains=function(a){return void 0!=this.array[a|0]};a.prototype.remove=function(a){this.array[a|0]=void 0};a.prototype.clear=function(){this.array.length=0};return a}();a.IntSet=b;b=function(){function a(b,c,f,h){void 0===b&&(b=0);void 0===c&&(c=0);void 0===f&&(f=0);void 0===h&&(h=0);this.r=b;this.g=c;this.b=f;this.a=h}a.prototype.set=function(a,b,
c,h){this.r=a;this.g=b;this.b=c;this.a=h;this.clamp();return this};a.prototype.setFromColor=function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.a=a.a;return this};a.prototype.setFromString=function(a){a="#"==a.charAt(0)?a.substr(1):a;this.r=parseInt(a.substr(0,2),16)/255;this.g=parseInt(a.substr(2,2),16)/255;this.b=parseInt(a.substr(4,2),16)/255;this.a=(8!=a.length?255:parseInt(a.substr(6,2),16))/255;return this};a.prototype.add=function(a,b,c,h){this.r+=a;this.g+=b;this.b+=c;this.a+=h;this.clamp();
return this};a.prototype.clamp=function(){0>this.r?this.r=0:1<this.r&&(this.r=1);0>this.g?this.g=0:1<this.g&&(this.g=1);0>this.b?this.b=0:1<this.b&&(this.b=1);0>this.a?this.a=0:1<this.a&&(this.a=1);return this};return a}();b.WHITE=new b(1,1,1,1);b.RED=new b(1,0,0,1);b.GREEN=new b(0,1,0,1);b.BLUE=new b(0,0,1,1);b.MAGENTA=new b(1,0,1,1);a.Color=b;b=function(){function a(){}a.clamp=function(a,b,c){return a<b?b:a>c?c:a};a.cosDeg=function(b){return Math.cos(b*a.degRad)};a.sinDeg=function(b){return Math.sin(b*
a.degRad)};a.signum=function(a){return 0<a?1:0>a?-1:0};a.toInt=function(a){return 0<a?Math.floor(a):Math.ceil(a)};a.cbrt=function(a){var b=Math.pow(Math.abs(a),1/3);return 0>a?-b:b};a.randomTriangular=function(b,e){return a.randomTriangularWith(b,e,0.5*(b+e))};a.randomTriangularWith=function(a,b,c){var h=Math.random(),k=b-a;return h<=(c-a)/k?a+Math.sqrt(h*k*(c-a)):b-Math.sqrt((1-h)*k*(b-c))};return a}();b.PI=3.1415927;b.PI2=2*b.PI;b.radiansToDegrees=180/b.PI;b.radDeg=b.radiansToDegrees;b.degreesToRadians=
b.PI/180;b.degRad=b.degreesToRadians;a.MathUtils=b;b=function(){function a(){}a.prototype.apply=function(a,b,c){return a+(b-a)*this.applyInternal(c)};return a}();a.Interpolation=b;b=function(a){function b(d){var f=a.call(this)||this;f.power=2;f.power=d;return f}__extends(b,a);b.prototype.applyInternal=function(a){return 0.5>=a?Math.pow(2*a,this.power)/2:Math.pow(2*(a-1),this.power)/(0==this.power%2?-2:2)+1};return b}(b);a.Pow=b;b=function(a){function b(d){return a.call(this,d)||this}__extends(b,a);
b.prototype.applyInternal=function(a){return Math.pow(a-1,this.power)*(0==this.power%2?-1:1)+1};return b}(b);a.PowOut=b;b=function(){function a(){}a.arrayCopy=function(a,b,c,h,k){for(var m=b;m<b+k;m++,h++)c[h]=a[m]};a.setArraySize=function(a,b,c){void 0===c&&(c=0);var h=a.length;if(h==b)return a;a.length=b;if(h<b)for(;h<b;h++)a[h]=c;return a};a.ensureArrayCapacity=function(b,e,f){void 0===f&&(f=0);return b.length>=e?b:a.setArraySize(b,e,f)};a.newArray=function(a,b){for(var c=Array(a),h=0;h<a;h++)c[h]=
b;return c};a.newFloatArray=function(b){if(a.SUPPORTS_TYPED_ARRAYS)return new Float32Array(b);b=Array(b);for(var e=0;e<b.length;e++)b[e]=0;return b};a.newShortArray=function(b){if(a.SUPPORTS_TYPED_ARRAYS)return new Int16Array(b);b=Array(b);for(var e=0;e<b.length;e++)b[e]=0;return b};a.toFloatArray=function(b){return a.SUPPORTS_TYPED_ARRAYS?new Float32Array(b):b};a.toSinglePrecision=function(b){return a.SUPPORTS_TYPED_ARRAYS?Math.fround(b):b};return a}();b.SUPPORTS_TYPED_ARRAYS="undefined"!==typeof Float32Array;
a.Utils=b;b=function(){function a(){}a.logBones=function(a){for(var b=0;b<a.bones.length;b++){var c=a.bones[b];console.log(c.data.name+", "+c.a+", "+c.b+", "+c.c+", "+c.d+", "+c.worldX+", "+c.worldY)}};return a}();a.DebugUtils=b;b=function(){function a(b){this.items=[];this.instantiator=b}a.prototype.obtain=function(){return 0<this.items.length?this.items.pop():this.instantiator()};a.prototype.free=function(a){a.reset&&a.reset();this.items.push(a)};a.prototype.freeAll=function(a){for(var b=0;b<a.length;b++)a[b].reset&&
a[b].reset(),this.items[b]=a[b]};a.prototype.clear=function(){this.items.length=0};return a}();a.Pool=b;b=function(){function a(b,c){void 0===b&&(b=0);void 0===c&&(c=0);this.x=b;this.y=c}a.prototype.set=function(a,b){this.x=a;this.y=b;return this};a.prototype.length=function(){var a=this.x,b=this.y;return Math.sqrt(a*a+b*b)};a.prototype.normalize=function(){var a=this.length();0!=a&&(this.x/=a,this.y/=a);return this};return a}();a.Vector2=b;b=function(){function a(){this.maxDelta=0.064;this.totalTime=
this.delta=this.framesPerSecond=0;this.lastTime=Date.now()/1E3;this.frameTime=this.frameCount=0}a.prototype.update=function(){var a=Date.now()/1E3;this.delta=a-this.lastTime;this.frameTime+=this.delta;this.totalTime+=this.delta;this.delta>this.maxDelta&&(this.delta=this.maxDelta);this.lastTime=a;this.frameCount++;1<this.frameTime&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameCount=this.frameTime=0)};return a}();a.TimeKeeper=b;b=function(){function a(b){void 0===b&&(b=32);this.mean=
this.lastValue=this.addedValues=0;this.dirty=!0;this.values=Array(b)}a.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length};a.prototype.addValue=function(a){this.addedValues<this.values.length&&this.addedValues++;this.values[this.lastValue++]=a;this.lastValue>this.values.length-1&&(this.lastValue=0);this.dirty=!0};a.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var a=0,b=0;b<this.values.length;b++)a+=this.values[b];this.mean=a/this.values.length;
this.dirty=!1}return this.mean}return 0};return a}();a.WindowedMean=b})(spine||(spine={}));
(function(a){var b=function(){return function(a){if(null==a)throw Error("name cannot be null.");this.name=a}}();a.Attachment=b;b=function(a){function b(e){e=a.call(this,e)||this;e.id=(b.nextID++&65535)<<11;e.worldVerticesLength=0;return e}__extends(b,a);b.prototype.computeWorldVertices=function(a,b,c,d,m,n){c=m+(c>>1)*n;var p=a.bone.skeleton,r=a.attachmentVertices,s=this.vertices,t=this.bones;if(null==t){0<r.length&&(s=r);a=a.bone;var r=a.worldX,t=a.worldY,w=a.a,p=a.b,v=a.c;a=a.d;for(var y=b;m<c;y+=
2,m+=n){b=s[y];var x=s[y+1];d[m]=b*w+x*p+r;d[m+1]=b*v+x*a+t}}else{for(x=a=w=0;x<b;x+=2)v=t[w],w+=v+1,a+=v;y=p.bones;if(0==r.length)for(p=3*a;m<c;m+=n){for(var u=0,z=0,v=t[w++],v=v+w;w<v;w++,p+=3){a=y[t[w]];b=s[p];var x=s[p+1],A=s[p+2],u=u+(b*a.a+x*a.b+a.worldX)*A,z=z+(b*a.c+x*a.d+a.worldY)*A}d[m]=u;d[m+1]=z}else for(var p=3*a,B=a<<1;m<c;m+=n){z=u=0;v=t[w++];for(v+=w;w<v;w++,p+=3,B+=2)a=y[t[w]],b=s[p]+r[B],x=s[p+1]+r[B+1],A=s[p+2],u+=(b*a.a+x*a.b+a.worldX)*A,z+=(b*a.c+x*a.d+a.worldY)*A;d[m]=u;d[m+
1]=z}}};b.prototype.applyDeform=function(a){return this==a};return b}(b);b.nextID=0;a.VertexAttachment=b})(spine||(spine={}));(function(a){a=a.AttachmentType||(a.AttachmentType={});a[a.Region=0]="Region";a[a.BoundingBox=1]="BoundingBox";a[a.Mesh=2]="Mesh";a[a.LinkedMesh=3]="LinkedMesh";a[a.Path=4]="Path";a[a.Point=5]="Point"})(spine||(spine={}));
(function(a){var b=function(b){function d(d){d=b.call(this,d)||this;d.color=new a.Color(1,1,1,1);return d}__extends(d,b);return d}(a.VertexAttachment);a.BoundingBoxAttachment=b})(spine||(spine={}));(function(a){var b=function(b){function d(d){d=b.call(this,d)||this;d.color=new a.Color(0.2275,0.2275,0.8078,1);return d}__extends(d,b);return d}(a.VertexAttachment);a.ClippingAttachment=b})(spine||(spine={}));
(function(a){var b=function(b){function d(d){d=b.call(this,d)||this;d.color=new a.Color(1,1,1,1);d.inheritDeform=!1;d.tempColor=new a.Color(0,0,0,0);return d}__extends(d,b);d.prototype.updateUVs=function(){var b=0,c=0,d=0,k=0;null==this.region?(b=c=0,d=k=1):(b=this.region.u,c=this.region.v,d=this.region.u2-b,k=this.region.v2-c);var m=this.regionUVs;if(null==this.uvs||this.uvs.length!=m.length)this.uvs=a.Utils.newFloatArray(m.length);var n=this.uvs;if(this.region.rotate)for(var p=0,r=n.length;p<r;p+=
2)n[p]=b+m[p+1]*d,n[p+1]=c+k-m[p]*k;else for(p=0,r=n.length;p<r;p+=2)n[p]=b+m[p]*d,n[p+1]=c+m[p+1]*k};d.prototype.applyDeform=function(a){return this==a||this.inheritDeform&&this.parentMesh==a};d.prototype.getParentMesh=function(){return this.parentMesh};d.prototype.setParentMesh=function(a){this.parentMesh=a;null!=a&&(this.bones=a.bones,this.vertices=a.vertices,this.worldVerticesLength=a.worldVerticesLength,this.regionUVs=a.regionUVs,this.triangles=a.triangles,this.hullLength=a.hullLength,this.worldVerticesLength=
a.worldVerticesLength)};return d}(a.VertexAttachment);a.MeshAttachment=b})(spine||(spine={}));(function(a){var b=function(b){function d(d){d=b.call(this,d)||this;d.closed=!1;d.constantSpeed=!1;d.color=new a.Color(1,1,1,1);return d}__extends(d,b);return d}(a.VertexAttachment);a.PathAttachment=b})(spine||(spine={}));
(function(a){var b=function(b){function d(d){d=b.call(this,d)||this;d.color=new a.Color(0.38,0.94,0,1);return d}__extends(d,b);d.prototype.computeWorldPosition=function(a,b){b.x=this.x*a.a+this.y*a.b+a.worldX;b.y=this.x*a.c+this.y*a.d+a.worldY;return b};d.prototype.computeWorldRotation=function(b){var c=a.MathUtils.cosDeg(this.rotation),d=a.MathUtils.sinDeg(this.rotation);return Math.atan2(c*b.c+d*b.d,c*b.a+d*b.b)*a.MathUtils.radDeg};return d}(a.VertexAttachment);a.PointAttachment=b})(spine||(spine=
{}));
(function(a){var b=function(b){function d(d){d=b.call(this,d)||this;d.x=0;d.y=0;d.scaleX=1;d.scaleY=1;d.rotation=0;d.width=0;d.height=0;d.color=new a.Color(1,1,1,1);d.offset=a.Utils.newFloatArray(8);d.uvs=a.Utils.newFloatArray(8);d.tempColor=new a.Color(1,1,1,1);return d}__extends(d,b);d.prototype.updateOffset=function(){var a=this.width/this.region.originalWidth*this.scaleX,b=this.height/this.region.originalHeight*this.scaleY,c=-this.width/2*this.scaleX+this.region.offsetX*a,k=-this.height/2*this.scaleY+
this.region.offsetY*b,m=c+this.region.width*a,a=k+this.region.height*b,b=this.rotation*Math.PI/180,n=Math.cos(b),p=Math.sin(b),b=c*n+this.x,c=c*p,r=k*n+this.y,k=k*p,s=m*n+this.x,m=m*p,n=a*n+this.y,a=a*p,p=this.offset;p[d.OX1]=b-k;p[d.OY1]=r+c;p[d.OX2]=b-a;p[d.OY2]=n+c;p[d.OX3]=s-a;p[d.OY3]=n+m;p[d.OX4]=s-k;p[d.OY4]=r+m};d.prototype.setRegion=function(a){this.region=a;var b=this.uvs;a.rotate?(b[2]=a.u,b[3]=a.v2,b[4]=a.u,b[5]=a.v,b[6]=a.u2,b[7]=a.v,b[0]=a.u2,b[1]=a.v2):(b[0]=a.u,b[1]=a.v2,b[2]=a.u,
b[3]=a.v,b[4]=a.u2,b[5]=a.v,b[6]=a.u2,b[7]=a.v2)};d.prototype.computeWorldVertices=function(a,b,c,k){var m=this.offset,n=a.worldX,p=a.worldY,r=a.a,s=a.b,t=a.c;a=a.d;var w=0,v=0,w=m[d.OX1],v=m[d.OY1];b[c]=w*r+v*s+n;b[c+1]=w*t+v*a+p;c+=k;w=m[d.OX2];v=m[d.OY2];b[c]=w*r+v*s+n;b[c+1]=w*t+v*a+p;c+=k;w=m[d.OX3];v=m[d.OY3];b[c]=w*r+v*s+n;b[c+1]=w*t+v*a+p;c+=k;w=m[d.OX4];v=m[d.OY4];b[c]=w*r+v*s+n;b[c+1]=w*t+v*a+p};return d}(a.Attachment);b.OX1=0;b.OY1=1;b.OX2=2;b.OY2=3;b.OX3=4;b.OY3=5;b.OX4=6;b.OY4=7;b.X1=
0;b.Y1=1;b.C1R=2;b.C1G=3;b.C1B=4;b.C1A=5;b.U1=6;b.V1=7;b.X2=8;b.Y2=9;b.C2R=10;b.C2G=11;b.C2B=12;b.C2A=13;b.U2=14;b.V2=15;b.X3=16;b.Y3=17;b.C3R=18;b.C3G=19;b.C3B=20;b.C3A=21;b.U3=22;b.V3=23;b.X4=24;b.Y4=25;b.C4R=26;b.C4G=27;b.C4B=28;b.C4A=29;b.U4=30;b.V4=31;a.RegionAttachment=b})(spine||(spine={}));
(function(a){var b=function(){function b(a,c){this.jitterY=this.jitterX=0;this.jitterX=a;this.jitterY=c}b.prototype.begin=function(a){};b.prototype.transform=function(b,c,f,h){b.x+=a.MathUtils.randomTriangular(-this.jitterX,this.jitterY);b.y+=a.MathUtils.randomTriangular(-this.jitterX,this.jitterY)};b.prototype.end=function(){};return b}();a.JitterEffect=b})(spine||(spine={}));
(function(a){var b=function(){function b(a){this.worldY=this.worldX=this.angle=this.radius=this.centerY=this.centerX=0;this.radius=a}b.prototype.begin=function(a){this.worldX=a.x+this.centerX;this.worldY=a.y+this.centerY};b.prototype.transform=function(d,e,f,h){h=this.angle*a.MathUtils.degreesToRadians;e=d.x-this.worldX;f=d.y-this.worldY;var k=Math.sqrt(e*e+f*f);k<this.radius&&(k=b.interpolation.apply(0,h,(this.radius-k)/this.radius),h=Math.cos(k),k=Math.sin(k),d.x=h*e-k*f+this.worldX,d.y=k*e+h*f+
this.worldY)};b.prototype.end=function(){};return b}();b.interpolation=new a.PowOut(2);a.SwirlEffect=b})(spine||(spine={}));var sp=sp||{};sp.spine=spine;sp=sp||{};spine=sp.spine;
sp.Skeleton=cc.Node.extend({_skeleton:null,_rootBone:null,_timeScale:1,_debugSlots:!1,_debugBones:!1,_premultipliedAlpha:!1,_ownsSkeletonData:null,_atlas:null,ctor:function(a,b,c){cc.Node.prototype.ctor.call(this);0===arguments.length?this.init():this.initWithArgs(a,b,c)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new sp.Skeleton.CanvasRenderCmd(this):new sp.Skeleton.WebGLRenderCmd(this)},init:function(){cc.Node.prototype.init.call(this);this._premultipliedAlpha=
cc._renderType===cc.game.RENDER_TYPE_WEBGL&&cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA},onEnter:function(){cc.Node.prototype.onEnter.call(this);this.scheduleUpdate()},onExit:function(){this.unscheduleUpdate();cc.Node.prototype.onExit.call(this)},setDebugSolots:function(a){this._debugSlots=a},setDebugBones:function(a){this._debugBones=a},setDebugSlotsEnabled:function(a){this._debugSlots=a},getDebugSlotsEnabled:function(){return this._debugSlots},setDebugBonesEnabled:function(a){this._debugBones=
a},getDebugBonesEnabled:function(){return this._debugBones},setTimeScale:function(a){this._timeScale=a},getTimeScale:function(){return this._timeScale},initWithArgs:function(a,b,c){if(cc.isString(a)){if(cc.isString(b)){var d=cc.loader.getRes(b);sp._atlasLoader.setAtlasFile(b);b=new spine.TextureAtlas(d,sp._atlasLoader.load.bind(sp._atlasLoader))}c=c||1/cc.director.getContentScaleFactor();d=new spine.AtlasAttachmentLoader(b);d=new spine.SkeletonJson(d);d.scale=c;a=cc.loader.getRes(a);a=d.readSkeletonData(a);
b.dispose(d);c=!0}else c=b;this.setSkeletonData(a,c);this.init()},getBoundingBox:function(){for(var a=cc.FLT_MAX,b=cc.FLT_MAX,c=cc.FLT_MIN,d=cc.FLT_MIN,e=this.getScaleX(),f=this.getScaleY(),h,k=this._skeleton.slots,m=spine.RegionAttachment,n=0,p=k.length;n<p;++n){var r=k[n],s=r.attachment;s&&s instanceof spine.RegionAttachment&&(h=spine.Utils.setArraySize([],8,0),s.computeWorldVertices(r.bone,h,0,2),a=Math.min(a,h[m.OX1]*e,h[m.OX4]*e,h[m.OX2]*e,h[m.OX3]*e),b=Math.min(b,h[m.OY1]*f,h[m.OY4]*f,h[m.OY2]*
f,h[m.OY3]*f),c=Math.max(c,h[m.OX1]*e,h[m.OX4]*e,h[m.OX2]*e,h[m.OX3]*e),d=Math.max(d,h[m.OY1]*f,h[m.OY4]*f,h[m.OY2]*f,h[m.OY3]*f))}e=this.getPosition();return cc.rect(e.x+a,e.y+b,c-a,d-b)},updateWorldTransform:function(){this._skeleton.updateWorldTransform()},setToSetupPose:function(){this._skeleton.setToSetupPose()},setBonesToSetupPose:function(){this._skeleton.setBonesToSetupPose()},setSlotsToSetupPose:function(){this._skeleton.setSlotsToSetupPose()},findBone:function(a){return this._skeleton.findBone(a)},
findSlot:function(a){return this._skeleton.findSlot(a)},setSkin:function(a){return this._skeleton.setSkinByName(a)},getAttachment:function(a,b){return this._skeleton.getAttachmentByName(a,b)},setAttachment:function(a,b){this._skeleton.setAttachment(a,b)},setPremultipliedAlpha:function(a){this._premultipliedAlpha=a},isPremultipliedAlpha:function(){return this._premultipliedAlpha},setSkeletonData:function(a,b){null!=a.width&&null!=a.height&&this.setContentSize(a.width/cc.director.getContentScaleFactor(),
a.height/cc.director.getContentScaleFactor());this._skeleton=new spine.Skeleton(a);this._skeleton.updateWorldTransform();this._rootBone=this._skeleton.getRootBone();this._ownsSkeletonData=b;this._renderCmd._createChildFormSkeletonData()},getTextureAtlas:function(a){return a.region},getBlendFunc:function(){var a=this._skeleton.drawOrder[0];return a?this._renderCmd._getBlendFunc(a.data.blendMode,this._premultipliedAlpha):{}},setBlendFunc:function(a,b){},update:function(a){this._skeleton.update(a)}});
cc.defineGetterSetter(sp.Skeleton.prototype,"opacityModifyRGB",sp.Skeleton.prototype.isOpacityModifyRGB);cc.defineGetterSetter(sp.Skeleton.prototype,"_blendFunc",sp.Skeleton.prototype.getBlendFunc);cc.defineGetterSetter(sp.Skeleton.prototype,"_texture",function(){return this._renderCmd._currTexture});sp.Skeleton.create=function(a,b,c){return new sp.Skeleton(a,b,c)};sp._atlasLoader={spAtlasFile:null,setAtlasFile:function(a){this.spAtlasFile=a},load:function(a){a=cc.path.join(cc.path.dirname(this.spAtlasFile),a);a=cc.textureCache.addImage(a);var b=new sp.SkeletonTexture({width:a.getPixelsWide(),height:a.getPixelsHigh()});b.setRealTexture(a);return b},unload:function(a){}};sp.ANIMATION_EVENT_TYPE={START:0,INTERRUPT:1,END:2,DISPOSE:3,COMPLETE:4,EVENT:5};
sp.TrackEntryListeners=function(a,b,c,d,e,f){this.startListener=a||null;this.endListener=b||null;this.completeListener=c||null;this.eventListener=d||null;this.interruptListener=e||null;this.disposeListener=f||null;this.skeletonNode=this.callbackTarget=this.callback=null};var proto=sp.TrackEntryListeners.prototype;proto.start=function(a){this.startListener&&this.startListener(a);this.callback&&this.callback.call(this.callbackTarget,this.skeletonNode,a,sp.ANIMATION_EVENT_TYPE.START,null,0)};
proto.interrupt=function(a){this.interruptListener&&this.interruptListener(a);this.callback&&this.callback.call(this.callbackTarget,this.skeletonNode,a,sp.ANIMATION_EVENT_TYPE.INTERRUPT,null,0)};proto.end=function(a){this.endListener&&this.endListener(a);this.callback&&this.callback.call(this.callbackTarget,this.skeletonNode,a,sp.ANIMATION_EVENT_TYPE.END,null,0)};
proto.dispose=function(a){this.disposeListener&&this.disposeListener(a);this.callback&&this.callback.call(this.callbackTarget,this.skeletonNode,a,sp.ANIMATION_EVENT_TYPE.DISPOSE,null,0)};proto.complete=function(a){var b=Math.floor(a.trackTime/a.animationEnd);this.completeListener&&this.completeListener(a,b);this.callback&&this.callback.call(this.callbackTarget,this.skeletonNode,a,sp.ANIMATION_EVENT_TYPE.COMPLETE,null,b)};
proto.event=function(a,b){this.eventListener&&this.eventListener(a,b);this.callback&&this.callback.call(this.callbackTarget,this.skeletonNode,a,sp.ANIMATION_EVENT_TYPE.EVENT,b,0)};sp.TrackEntryListeners.getListeners=function(a){a.listener||(a.listener=new sp.TrackEntryListeners);return a.listener};
sp.SkeletonAnimation=sp.Skeleton.extend({_state:null,_ownsAnimationStateData:!1,_listener:null,init:function(){sp.Skeleton.prototype.init.call(this);this._ownsAnimationStateData=!0;this.setAnimationStateData(new spine.AnimationStateData(this._skeleton.data))},setAnimationStateData:function(a){a=new spine.AnimationState(a);this._listener=new sp.TrackEntryListeners;a.rendererObject=this;a.addListener(this._listener);this._state=a},setMix:function(a,b,c){this._state.data.setMixWith(a,b,c)},setAnimationListener:function(a,
b){this._listener.callbackTarget=a;this._listener.callback=b;this._listener.skeletonNode=this},setAnimation:function(a,b,c){var d=this._skeleton.data.findAnimation(b);return d?this._state.setAnimationWith(a,d,c):(cc.log("Spine: Animation not found: "+b),null)},addAnimation:function(a,b,c,d){d=null==d?0:d;var e=this._skeleton.data.findAnimation(b);return e?this._state.addAnimationWith(a,e,c,d):(cc.log("Spine: Animation not found:"+b),null)},findAnimation:function(a){return this._skeleton.data.findAnimation(a)},
getCurrent:function(a){return this._state.getCurrent(a)},clearTracks:function(){this._state.clearTracks()},clearTrack:function(a){this._state.clearTrack(a)},update:function(a){this._super(a);a*=this._timeScale;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);this._state.update(a);this._state.apply(this._skeleton);this._skeleton.updateWorldTransform();this._renderCmd._updateChild()},setStartListener:function(a){this._listener.startListener=a},setInterruptListener:function(a){this._listener.interruptListener=
a},setEndListener:function(a){this._listener.endListener=a},setDisposeListener:function(a){this._listener.disposeListener=a},setCompleteListener:function(a){this._listener.completeListener=a},setEventListener:function(a){this._listener.eventListener=a},setTrackStartListener:function(a,b){sp.TrackEntryListeners.getListeners(a).startListener=b},setTrackInterruptListener:function(a,b){sp.TrackEntryListeners.getListeners(a).interruptListener=b},setTrackEndListener:function(a,b){sp.TrackEntryListeners.getListeners(a).endListener=
b},setTrackDisposeListener:function(a,b){sp.TrackEntryListeners.getListeners(a).disposeListener=b},setTrackCompleteListener:function(a,b){sp.TrackEntryListeners.getListeners(a).completeListener=b},setTrackEventListener:function(a,b){sp.TrackEntryListeners.getListeners(a).eventListener=b},getState:function(){return this._state}});sp.SkeletonAnimation.createWithJsonFile=sp.SkeletonAnimation.create=function(a,b,c){return new sp.SkeletonAnimation(a,b,c)};sp.SkeletonTexture=function(a){sp.spine.Texture.call(this,a)};cc.inherits(sp.SkeletonTexture,sp.spine.Texture);
cc.extend(sp.SkeletonTexture.prototype,{name:"sp.SkeletonTexture",_texture:null,setRealTexture:function(a){this._texture=a},getRealTexture:function(){return this._texture},setFilters:function(a,b){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){var c=cc._renderContext;this.bind();c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,b)}},setWraps:function(a,b){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){var c=cc._renderContext;this.bind();c.texParameteri(c.TEXTURE_2D,
c.TEXTURE_WRAP_S,a);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,b)}},dispose:function(){},bind:function(){cc._renderType===cc.game.RENDER_TYPE_WEBGL&&cc.glBindTexture2D(this._texture)}});(function(){var a=sp.spine;sp.Skeleton.CanvasRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0};var b=sp.Skeleton.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);b.constructor=sp.Skeleton.CanvasRenderCmd;b.rendering=function(b,c,f){var h=this._node,k,m,n,p;b=b||cc._renderContext;var r=h._skeleton,s=r.drawOrder;k=0;for(m=s.length;k<m;k++)n=s[k],p=n._slotNode,p._visible&&p._renderCmd&&n.currentSprite&&(p._renderCmd.transform(this,!0),n.currentSprite._renderCmd.rendering(b,
c,f),p._renderCmd._dirtyFlag=n.currentSprite._renderCmd._dirtyFlag=0);if(h._debugSlots||h._debugBones){b.setTransform(this._worldTransform,c,f);b.setGlobalAlpha(1);b=cc._drawingUtil;if(h._debugSlots)for(b.setDrawColor(0,0,255,255),b.setLineWidth(1),f=[],k=0,m=r.slots.length;k<m;k++)n=r.drawOrder[k],n.attachment&&n.attachment instanceof a.RegionAttachment&&(c=n.attachment,this._updateRegionAttachmentSlot(c,n,f),b.drawPoly(f,4,!0));if(h._debugBones){b.setLineWidth(2);b.setDrawColor(255,0,0,255);k=0;
for(m=r.bones.length;k<m;k++)h=r.bones[k],b.drawLine({x:h.worldX,y:h.worldY},{x:h.data.length*h.a+h.worldX,y:h.data.length*h.c+h.worldY});b.setDrawColor(0,0,255,255);k=0;for(m=r.bones.length;k<m;k++)h=r.bones[k],b.drawPoint({x:h.worldX,y:h.worldY},4),0===k&&b.setDrawColor(0,255,0,255)}}};b.updateStatus=function(){this.originUpdateStatus();this._updateCurrentRegions();this._regionFlag=cc.Node.CanvasRenderCmd.RegionStatus.DirtyDouble;this._dirtyFlag&=~cc.Node._dirtyFlags.contentDirty};b.getLocalBB=
function(){return this._node.getBoundingBox()};b._updateRegionAttachmentSlot=function(b,c,f){if(f){var h=a.Utils.setArraySize([],8,0);b.computeWorldVertices(c.bone,h,0,2);b=a.RegionAttachment;f.length=0;f.push(cc.p(h[b.OX1],h[b.OY1]));f.push(cc.p(h[b.OX4],h[b.OY4]));f.push(cc.p(h[b.OX3],h[b.OY3]));f.push(cc.p(h[b.OX2],h[b.OY2]))}};b._createChildFormSkeletonData=function(){for(var b=this._node._skeleton,c,f,h=0,k=b.slots.length;h<k;h++){var m=b.slots[h];f=m.attachment;var n=new cc.Node;m._slotNode=
n;f instanceof a.RegionAttachment&&(c=f.region.name,f=this._createSprite(m,f),m.currentSprite=f,m.currentSpriteName=c,n.addChild(f))}};var c=function(a,b,c){var h=c.region,k=new cc.Rect(h.x,h.y,h.width,h.height);a.initWithTexture(b,k,h.rotate,!1);a._rect.width=c.width;a._rect.height=c.height;a.setContentSize(c.width,c.height);a.setRotation(-c.rotation);a.setScale(h.width/h.originalWidth*c.scaleX,h.height/h.originalHeight*c.scaleY)};b._createSprite=function(a,b){var f=b.region,h=f.texture.getRealTexture(),
k=new cc.Sprite;h.isLoaded()?c(k,h,b):h.addEventListener("load",function(){c(k,h,b)},this);a.sprites=a.sprites||{};return a.sprites[f.name]=k};b._updateChild=function(){var b=this._node._skeleton.slots,c=this._displayedColor,f=this._displayedOpacity,h,k,m,n,p,r,s;h=0;for(k=b.length;h<k;h++)if(p=b[h],r=p.attachment,s=p._slotNode,r){if(r instanceof a.RegionAttachment){if(r.region&&(!p.currentSpriteName||p.currentSpriteName!==r.name)){var t=r.region.name;void 0!==p.currentSprite&&p.currentSprite.setVisible(!1);
p.sprites=p.sprites||{};void 0!==p.sprites[t]?p.sprites[t].setVisible(!0):(m=this._createSprite(p,r),s.addChild(m));p.currentSprite=p.sprites[t];p.currentSpriteName=t}t=p.bone;0===r.region.offsetX&&0===r.region.offsetY?(m=r.x,n=r.y):(m=0.5*(r.offset[0]+r.offset[4]),n=0.5*(r.offset[1]+r.offset[5]));s.setPosition(t.worldX+m*t.a+n*t.b,t.worldY+m*t.c+n*t.d);s.setScale(t.getWorldScaleX(),t.getWorldScaleY());m=p.currentSprite;m._flippedX=t.skeleton.flipX;m._flippedY=t.skeleton.flipY;m._flippedY||m._flippedX?
(s.setRotation(t.getWorldRotationX()),m.setRotation(r.rotation)):(s.setRotation(-t.getWorldRotationX()),m.setRotation(-r.rotation));m._renderCmd._displayedOpacity=0|f*p.color.a;m.setColor(cc.color(0|c.r*p.color.r,0|c.g*p.color.g,0|c.b*p.color.b));m._renderCmd._updateColor()}else if(!(r instanceof a.MeshAttachment)){s.setVisible(!1);continue}s.setVisible(!0)}else s.setVisible(!1)}})();(function(){var a=sp.spine;sp.Skeleton.WebGLRenderCmd=function(a){this._rootCtor(a);this._needDraw=!0;this._matrix=new cc.math.Matrix4;this._matrix.identity();this._currTexture=null;this._currBlendFunc={};this.vertexType=cc.renderer.VertexType.CUSTOM;this.setShaderProgram(cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR))};var b=sp.Skeleton.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);b.constructor=sp.Skeleton.WebGLRenderCmd;b.uploadData=function(b,d,
e){var f=this._node,h=this._displayedColor,k=f._skeleton,m,n,p,r=f._premultipliedAlpha;k.r=h.r/255;k.g=h.g/255;k.b=h.b/255;k.a=this._displayedOpacity/255;r&&(k.r*=k.a,k.g*=k.a,k.b*=k.a);var s=null;this._node._debugSlots&&(s=[]);h=0;for(p=k.drawOrder.length;h<p;h++)if(n=k.drawOrder[h],n.attachment){m=n.attachment;var t=0;if(m instanceof a.RegionAttachment)t=6;else if(m instanceof a.MeshAttachment)t=m.regionUVs.length/2;else continue;if(0!==t){this._currTexture=f.getTextureAtlas(m).texture.getRealTexture();
var w=cc.renderer._updateBatchedInfo(this._currTexture,this._getBlendFunc(n.data.blendMode,r),this._glProgramState),v=e/6+t>0.5*(cc.BATCH_VERTEX_COUNT-200);!w&&v&&(cc.renderer._batchRendering(),w=!0);w&&(e=0);w=null;if(m instanceof a.RegionAttachment)w=this._uploadRegionAttachmentData(m,n,r,b,d,e);else if(m instanceof a.MeshAttachment)this._uploadMeshAttachmentData(m,n,r,b,d,e);else continue;this._node._debugSlots&&(s[h]=w);m instanceof a.RegionAttachment?cc.renderer._increaseBatchingSize(t,cc.renderer.VertexType.TRIANGLE):
cc.renderer._increaseBatchingSize(t,cc.renderer.VertexType.CUSTOM,m.triangles);e+=6*t}}if(f._debugBones||f._debugSlots){cc.renderer._batchRendering();h=this._worldTransform;p=this._matrix.mat;p[0]=h.a;p[4]=h.c;p[12]=h.tx;p[1]=h.b;p[5]=h.d;p[13]=h.ty;cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.current_stack.stack.push(cc.current_stack.top);cc.current_stack.top=this._matrix;b=cc._drawingUtil;if(f._debugSlots&&s&&0<s.length)for(b.setDrawColor(0,0,255,255),b.setLineWidth(1),h=0,p=k.slots.length;h<p;h++)(d=
s[h])&&b.drawPoly(d,4,!0);if(f._debugBones){b.setLineWidth(2);b.setDrawColor(255,0,0,255);h=0;for(p=k.bones.length;h<p;h++)f=k.bones[h],s=f.data.length*f.a+f.worldX,d=f.data.length*f.c+f.worldY,b.drawLine(cc.p(f.worldX,f.worldY),cc.p(s,d));b.setPointSize(4);b.setDrawColor(0,0,255,255);h=0;for(p=k.bones.length;h<p;h++)f=k.bones[h],b.drawPoint(cc.p(f.worldX,f.worldY)),0==h&&b.setDrawColor(0,255,0,255)}cc.kmGLPopMatrix()}return 0};b._getBlendFunc=function(b,d){var e=this._currBlendFunc;switch(b){case a.BlendMode.Normal:e.src=
d?cc.ONE:cc.SRC_ALPHA;e.dst=cc.ONE_MINUS_SRC_ALPHA;break;case a.BlendMode.Additive:e.src=d?cc.ONE:cc.SRC_ALPHA;e.dst=cc.ONE;break;case a.BlendMode.Multiply:e.src=cc.DST_COLOR;e.dst=cc.ONE_MINUS_SRC_ALPHA;break;case a.BlendMode.Screen:e.src=cc.ONE;e.dst=cc.ONE_MINUS_SRC_COLOR;break;default:e=this._node._blendFunc}return e};b._createChildFormSkeletonData=function(){};b._updateChild=function(){};b._uploadRegionAttachmentData=function(b,d,e,f,h,k){var m=this._displayedColor,n=m.r,p=m.g,r=m.b,s=this._displayedOpacity,
m=a.Utils.setArraySize([],8,0);b.computeWorldVertices(d.bone,m,0,2);var t=b.uvs,w=d.bone.skeleton.color;d=d.color;var v=b.color,y=w.a*d.a*v.a;e=e?y:1;b=b.tempColor;b.set(w.r*d.r*v.r*e,w.g*d.g*v.g*e,w.b*d.b*v.b*e,y);var x=this._worldTransform,w=x.a;e=x.b;d=x.c;for(var v=x.d,y=x.tx,x=x.ty,u=this._node.vertexZ,z=0;6>z;z++){var A=4>z?z%3:z-2,B=m[2*A],D=m[2*A+1],C=B*e+D*v+x,E=b.a*s<<24|b.b*r<<16|b.g*p<<8|b.r*n;f[k]=B*w+D*d+y;f[k+1]=C;f[k+2]=u;h[k+3]=E;f[k+4]=t[2*A];f[k+5]=t[2*A+1];k+=6}if(this._node._debugSlots)return f=
a.RegionAttachment,[cc.p(m[f.OX1],m[f.OY1]),cc.p(m[f.OX2],m[f.OY2]),cc.p(m[f.OX3],m[f.OY3]),cc.p(m[f.OX4],m[f.OY4])]};b._uploadMeshAttachmentData=function(b,d,e,f,h,k){var m=this._worldTransform,n=m.a,p=m.b,r=m.c,s=m.d,t=m.tx,m=m.ty,w=this._node.vertexZ,v=b.worldVerticesLength,y=a.Utils.setArraySize([],v,0);b.computeWorldVertices(d,0,v,y,0,2);var v=b.uvs,x=d.bone.skeleton.color;d=d.color;var u=b.color,z=x.a*d.a*u.a;e=e?z:1;b=b.tempColor;b.set(x.r*d.r*u.r*e,x.g*d.g*u.g*e,x.b*d.b*u.b*e,z);d=this._displayedColor;
e=d.r;x=d.g;d=d.b;for(var u=this._displayedOpacity,z=0,A=y.length;z<A;z+=2){var B=y[z],D=y[z+1],C=B*r+D*s+m,E=b.a*u<<24|b.b*d<<16|b.g*x<<8|b.r*e;f[k]=B*n+D*p+t;f[k+1]=C;f[k+2]=w;h[k+3]=E;f[k+4]=v[z];f[k+5]=v[z+1];k+=6}}})();cc.pool={_pool:{},_releaseCB:function(){this.release()},_autoRelease:function(a){var b=void 0===a._running?!1:!a._running;cc.director.getScheduler().schedule(this._releaseCB,a,0,0,0,b)},putInPool:function(a){var b=a.constructor.prototype.__pid;if(!b){var c={writable:!0,enumerable:!1,configurable:!0};c.value=ClassManager.getNewID();Object.defineProperty(a.constructor.prototype,"__pid",c)}this._pool[b]||(this._pool[b]=[]);a.retain&&a.retain();a.unuse&&a.unuse();this._pool[b].push(a)},hasObject:function(a){return(a=
this._pool[a.prototype.__pid])&&0!==a.length?!0:!1},removeObject:function(a){var b=a.constructor.prototype.__pid;if(b&&(b=this._pool[b]))for(var c=0;c<b.length;c++)a===b[c]&&(a.release&&a.release(),b.splice(c,1))},getFromPool:function(a){if(this.hasObject(a)){var b=this._pool[a.prototype.__pid],c=Array.prototype.slice.call(arguments);c.shift();b=b.pop();b.reuse&&b.reuse.apply(b,c);cc.sys.isNative&&b.release&&this._autoRelease(b);return b}},drainAllPools:function(){for(var a in this._pool)for(var b=
0;b<this._pool[a].length;b++){var c=this._pool[a][b];c.release&&c.release()}this._pool={}}};var res={chr0Plist:"res/chrs/chr0.plist",chr0:"res/chrs/chr0.png",chr1Plist:"res/chrs/chr1.plist",chr1:"res/chrs/chr1.png",ene0Plist:"res/chrs/enes.plist",ene0:"res/chrs/enes.png",ene1Plist:"res/chrs/enes2.plist",ene1:"res/chrs/enes2.png",tipUnderPlist:"res/tips/tipUnder.plist",tipUnder0:"res/tips/tipUnder.png",tipOverMiniPlist:"res/tips/tipOverMini.plist",tipOverMini0:"res/tips/tipOverMini.png",healPlist:"res/effect/heal.plist",heal:"res/effect/heal.png",swordPlist:"res/effect/sword.plist",sword:"res/effect/sword.png",
spearPlist:"res/effect/spear.plist",spear:"res/effect/spear.png",firePlist:"res/effect/fire.plist",fire:"res/effect/fire.png",icePlist:"res/effect/ice.plist",ice:"res/effect/ice.png",thunderPlist:"res/effect/thunder.plist",thunder:"res/effect/thunder.png",meteoPlist:"res/effect/meteo.plist",meteo:"res/effect/meteo.png",monsPlist:"res/effect/mons.plist",mons:"res/effect/dark2.png",mons2Plist:"res/effect/mons2.plist",mons2:"res/effect/dageki2.png",fistPlist:"res/effect/fist.plist",fist:"res/effect/dageki0.png",
crowPlist:"res/effect/crow.plist",crow:"res/effect/crow.png",arrowPlist:"res/effect/arrow.plist",arrow:"res/effect/arrow.png",wind:"res/effect/wind.png",windPlist:"res/effect/wind.plist",water:"res/effect/water.png",waterPlist:"res/effect/water.plist",effectPlist:"res/effect/effect.plist",effect:"res/effect/effect.png",mas:"res/mas.png",cursolPlist:"res/cursol.plist",cursol:"res/cursol.png",cursol_minimap:"res/cursol_minimap.png",black:"res/black.png",waku:"res/ui/waku.png",editBox:"res/mas.png",
btn:"res/ui/button02_02.png",btn_p:"res/ui/button02_06.png",btn_base:"res/ui/button01_02.png",btn_base_p:"res/ui/button01_03.png",btn_close:"res/ui/btn_close.png",btn_close_p:"res/ui/btn_close_p.png",btn_sound_on:"res/ui/btn_sound_on.png",btn_sound_on_p:"res/ui/btn_sound_on_p.png",btn_sound_off:"res/ui/btn_sound_off.png",btn_sound_off_p:"res/ui/btn_sound_off_p.png",btn_menu:"res/ui/btn_menu.png",btn_menu_p:"res/ui/btn_menu_p.png",btn_map:"res/ui/btn_map.png",btn_map_p:"res/ui/btn_map_p.png",btn_auto:"res/ui/btn_auto.png",
btn_auto_p:"res/ui/btn_auto_p.png",btn_help:"res/ui/btn_help.png",btn_help_p:"res/ui/btn_help_p.png",slider_bar:"res/ui/slider_bar.png",slider_btn:"res/ui/slider_btn.png",ckb_off:"res/ui/ckb0.png",ckb_on:"res/ui/ckb1.png",rdo_off:"res/ui/rdo0.png",rdo_on:"res/ui/rdo1.png",loading_bar:"res/ui/loading_bar.png",grd:"res/ui/grd.png",win:"res/ui/win.png",win0:"res/ui/win0.png",win1:"res/ui/win1.png",win2:"res/ui/win2.png",gage:"res/ui/gage.png",gage0:"res/ui/gage0.png",gage1:"res/ui/gage1.png",gage2:"res/ui/gage2.png",
pos0:"res/ui/pos0.png",pos1:"res/ui/pos1.png",posCover:"res/ui/posCover.png",sub0:"res/ui/sub0.png",sub1:"res/ui/sub1.png",tt_arrow:"res/ui/arrow.png",ic_dev:"res/ui/ic_dev.png",ic_ck:"res/ui/ic_ck.png",ic_rock:"res/ui/ic_rock.png",ic_caution:"res/ui/ic_caution.png",ic_tap:"res/ui/ic_tap.png",ic_arrow:"res/ui/ic_arrow.png",crown:"res/ui/crown.png",itm_ken:"res/ui/icon/weapon01.png",itm_yari:"res/ui/icon/weapon06.png",itm_yumi:"res/ui/icon/weapon22.png",itm_tume:"res/ui/icon/weapon23.png",itm_tsue:"res/ui/icon/weapon17.png",
itm_tsue2:"res/ui/icon/weapon20.png",itm_ono:"res/ui/icon/weapon12.png",itm_book:"res/ui/icon/item04.png",itm_sts:"res/ui/icon/accessory02.png",itm_mon:"res/ui/icon/item30.png",itm_mon2:"res/ui/icon/item36.png",face0:"res/face/kiiro/1/1-8.png",face0_niko:"res/face/kiiro/1/2.png",face0_wara:"res/face/kiiro/1/3.png",face0_komari:"res/face/kiiro/1/7.png",face0_tere:"res/face/kiiro/1/9.png",face1:"res/face/kiiro/2/1-8.png",face1_niko:"res/face/kiiro/2/2.png",face1_wara:"res/face/kiiro/2/2.png",face1_oko:"res/face/kiiro/2/5.png",
face1_niga:"res/face/kiiro/2/6.png",face1_ase:"res/face/kiiro/2/10.png",face2:"res/face/kiiro/3/1.png",face2_niko:"res/face/kiiro/3/2.png",face2_niga:"res/face/kiiro/3/3.png",face2_komari:"res/face/kiiro/3/4.png",face2_oko:"res/face/kiiro/3/5.png",face2_toho:"res/face/kiiro/3/7.png",face2_ase:"res/face/kiiro/3/14.png",face2_naki:"res/face/kiiro/3/16.png",face3:"res/face/kiiro/4/1.png",face3_e:"res/face/kiiro/4/2.png",face3_a:"res/face/kiiro/4/3.png",face3_niko:"res/face/kiiro/4/4.png",face3_naki:"res/face/kiiro/4/8.png",
face3_tere:"res/face/kiiro/4/9.png",face3_shock:"res/face/kiiro/4/11.png",face3_ase:"res/face/kiiro/4/12.png",face3_masaka:"res/face/kiiro/4/13.png",face3_wara:"res/face/kiiro/4/16.png",face4:"res/face/kiiro/6/1.png",face4_niko:"res/face/kiiro/6/2.png",face4_wara:"res/face/kiiro/6/3.png",face4_naki:"res/face/kiiro/6/6.png",face4_niga:"res/face/kiiro/6/7.png",face4_oko:"res/face/kiiro/6/8.png",face4_zun:"res/face/kiiro/6/12.png",face5:"res/face/kiiro/5/1.png",face5_niko:"res/face/kiiro/5/3.png",face5_wara:"res/face/kiiro/5/4.png",
face5_komari:"res/face/kiiro/5/6.png",face5_biku:"res/face/kiiro/5/7.png",face5_oko:"res/face/kiiro/5/8.png",face5_ase:"res/face/kiiro/5/10.png",face6:"res/face/kiiro/9/1.png",face6_niko:"res/face/kiiro/9/2.png",face6_niya:"res/face/kiiro/9/7.png",face6_ase:"res/face/kiiro/9/12.png",face6_yabe:"res/face/kiiro/9/14.png",face7:"res/face/kiiro/10/1.png",face7_niko:"res/face/kiiro/10/2.png",face7_muka:"res/face/kiiro/10/6.png",face7_ase:"res/face/kiiro/10/7.png",face7_oko:"res/face/kiiro/10/11.png",face8:"res/face/kiiro/8tink/1.png",
face8_niko:"res/face/kiiro/8tink/2.png",face8_komari:"res/face/kiiro/8tink/4.png",face8_naki:"res/face/kiiro/8tink/7.png",face8_pero:"res/face/kiiro/8tink/8.png",face9:"res/face/kiiro/7/16.png",face9_komari:"res/face/kiiro/7/4.png",face9_nemu:"res/face/kiiro/7/6.png",face9_niko:"res/face/kiiro/7/8.png",face9_emi:"res/face/kiiro/7/10.png",face9_ase:"res/face/kiiro/7/12.png",face9_yami:"res/face/kiiro/7/13.png"},g_resources=[],i;for(i in res)g_resources.push(res[i]);var g={DBG:!1,DBG_MAP:!1,DBG_FIRST:NaN,VER_DT:116,VER_VIEW:"1.1.3",URL_ROOT:"http://cosmo.deci.jp/shiftup/cocos/tenmilli0/php/",URL_HKTG_ADD:"hktgAdd.php",URL_HKTG_GET:"hktgGet.php",URL_STORE:"https://play.google.com/store/apps/details?id\x3dnet.shiftup.tenmilli0",URL_STORE_IOS:"https://itunes.apple.com/app/id1440983660",URL_HELP:"http://game.shiftup.net/cocos/tenmilli0/app/",MAX_VAL:999999999,UP_LV_CLR:3,LEN_NM:12,DIRS:[{x:0,y:-1},{x:1,y:0},{x:0,y:1},{x:-1,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,
y:1}],SZ_MAS:64,NX:24,NY:32,BAI_CHR:1.3,TEAM_COLS:[cc.color(0,0,255),cc.color(255,0,0),cc.color(0,255,0)],TM_START:0.5,FONT_SZ_BIG:40,FONT_SZ_MIDIUM:35,FONT_SZ_SMALL:30,fontNormal:"Arial",W_MENU:360,WARI_POS:10,SUU_WIN_HYOUKA:3,NO_ITM_HALF_MGC:58,NO_ITM_RESIST_FIRE:59,isApp:function(){return g.DBG?!0:cc.sys.isNative},getAngle:function(a,b,c,d){a=Math.atan2(-d- -b,c-a);return a=180*a/Math.PI},makePswd:function(a){for(var b="",c=0;c<a;c++)b+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[Math.floor(62*
Math.random())];return b},checkName:function(a){return 0>=a.length?!1:!0},encode:function(a){a=base64.encodeStringAsUTF8(a);var b=a.indexOf("\x3d");0<b&&(a=a.substring(0,b));return a},decode:function(a){var b=a.length%4;0<b&&(a+="\x3d\x3d\x3d\x3d".substring(b));cc.log("g#decode "+a);try{return base64.decodeStringAsUTF8(a)}catch(c){return cc.log("g#decode "+a+" "+c),null}},addLimit:function(a,b,c){c||(c=g.MAX_VAL);return Math.min(a+b,c)},subLimit:function(a,b,c){c||(c=0);return Math.max(a-b,c)},csv2ary:function(a,
b,c){var d=[];a=a.split(/\r\n|\r|\n/);if(2>a.length)return d;var e=a[0].split(","),f=a[1].split(",");for(b=2+b;b<a.length;b++){var h=a[b].split(",");if(h.length<f.length)break;for(var k={},m=0;m<f.length;m++)switch(f[m]){case "num":""==h[m]&&(h[m]=NaN);k[e[m]]=Number(h[m]);break;case "nums":for(var n=h[m].split(" "),p=0;p<n.length;p++)n[p]=Number(n[p]);k[e[m]]=n;break;case "strs":n=h[m].split(" ");k[e[m]]=n;break;default:k[e[m]]=h[m]}c?isNaN(k.no)||(d[k.no]=k):d.push(k)}return d},csv2obj:function(a,
b){var c={},d=a.split(/\r\n|\r|\n/);if(1>d.length)return c;for(var e=b;e<d.length;e++){var f=d[e].split(",");if(2>f.length)break;if(g.DBG){var h=c[f[0]];h&&cc.log("g#csv2obj ERROR! "+f[0]+":"+h+"|"+f[1])}c[f[0]]=f[1]}return c},loadCsvs:function(a,b){g.loadCsv(0,a,{},b)},loadCsv:function(a,b,c,d){if(a>=b.length)d(null,c);else{var e=b[a++],f="";g.isApp()||(f+="?"+g.VER_DT);e.isBin?cc.loader.loadBinary(e.src+f,function(f,k){null!=f?(cc.log("g#loadCsv loaded status\x3d"+f.status+" err\x3d"+f.errorMessage),
d(f.errorMessage)):(c[e.id]=k,g.loadCsv(a,b,c,d))}):cc.loader.loadTxt(e.src+f,function(f,k){null!=f?(cc.log("g#loadCsv loaded status\x3d"+f.status+" err\x3d"+f.errorMessage),d(f.errorMessage)):(c[e.id]=k,g.loadCsv(a,b,c,d))})}},imgsNeedHaki:[],loadImgs:function(a,b){this.imgsNeedHaki=a;this.loadImgNext(a,0,b)},loadImgNext:function(a,b,c){if(b>=a.length)c();else{var d=a[b++];this.loadImg1(d,function(d,f){g.loadImgNext(a,b,c)})}},loadImg1:function(a,b){var c=cc.textureCache.getTextureForKey(a);c?b&&
b(c,a):cc.textureCache.addImageAsync(a,function(c){b&&b(c,a)})},hakiImgs:function(a){a||(a=this.imgsNeedHaki);for(var b in a)this.hakiImg(a[b]);this.imgsNeedHaki=[]},hakiImg:function(a){cc.textureCache.removeTextureForKey(a)},shuffle:function(a){var b=a.length,c;for(c=0;c<b;c++){var d=Math.floor(Math.random()*b),e=a[d];a[d]=a[c];a[c]=e}},umekomi:function(a,b){for(var c=0;c<a.length;){c=a.indexOf("\\",c);if(0>c)break;var d=a.substr(c+1,1),e=null,f=2;if(a.length>c+2&&"["==a.substr(c+2,1)){var h=a.indexOf("]",
c+4);0<=h&&(e=a.substring(c+3,h),f=h+1-c)}d=b(d,e);null!=d?(e=a.substring(0,c),f=a.substring(c+f),a=e+d+f,c+=d.length):c++}return a},kaisekiSrt:function(a){a=a.split(/\r\n|\r|\n/);for(var b=0;b<a.length;b++){var c=a[b].indexOf(";");0<=c&&(a[b]=a[b].substring(0,c));c=a[b].replace(/^\t+|\t+$/g,"");a[b]=c.split(" ")}return a},getStrDt:function(a){var b=new Date(a);a=b.getFullYear();var c=b.getMonth()+1,d=b.getDate(),e=b.getHours(),b=b.getMinutes();return a+"/"+(10>c?"0":"")+c+"/"+(10>d?"0":"")+d+" "+
(10>e?"0":"")+e+":"+(10>b?"0":"")+b},DateGetStringJp:function(a){var b=a.getFullYear(),c=a.getMonth()+1,d=a.getDate(),e=a.getDay(),f=a.getHours(),h=a.getMinutes(),k=a.getSeconds();a=a.getMilliseconds();return b+"/"+(10>c?"0":"")+c+"/"+(10>d?"0":"")+d+" ("+"\u65e5\u6708\u706b\u6c34\u6728\u91d1\u571f".split("")[e]+") "+(10>f?"0":"")+f+":"+(10>h?"0":"")+h+":"+(10>k?"0":"")+k+"."+(100>a?"0":"")+(10>a?"0":"")+a},fontFamilyGothic:function(){var a=navigator.userAgent.toLowerCase();return-1<a.indexOf("opera/")?
"'\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af','MS PGothic','\u30e1\u30a4\u30ea\u30aa','Mayryo','\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro W3','Hiragino Kaku Gothic Pro',sans-serif;":-1<a.indexOf("safari/")?"'\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro W3','Hiragino Kaku Gothic Pro','\u30e1\u30a4\u30ea\u30aa','Mayryo','\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af','MS PGothic',sans-serif;":-1<a.indexOf("gecko/")?"'\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af','MS PGothic','\u30e1\u30a4\u30ea\u30aa','Mayryo','\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro W3','Hiragino Kaku Gothic Pro',sans-serif;":
"'\u30e1\u30a4\u30ea\u30aa','Mayryo','\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af','MS PGothic','\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro W3','Hiragino Kaku Gothic Pro',sans-serif;"},fontFamilyMincho:function(){var a=navigator.userAgent.toLowerCase();if(-1<a.indexOf("opera/"))return"'\uff2d\uff33 \uff30\u660e\u671d','MS PMincho','\u30d2\u30e9\u30ae\u30ce\u660e\u671d Pro W3','Hiragino Mincho Pro',serif;";if(-1<a.indexOf("safari/"))return"'\u30d2\u30e9\u30ae\u30ce\u660e\u671d Pro W3','Hiragino Mincho Pro','\uff2d\uff33 \uff30\u660e\u671d','MS PMincho',serif;";
a.indexOf("gecko/");return"'\uff2d\uff33 \uff30\u660e\u671d','MS PMincho','\u30d2\u30e9\u30ae\u30ce\u660e\u671d Pro W3','Hiragino Mincho Pro',serif;"},getLang:function(){var a="ja";if(cc.sys.platform==cc.sys.ANDROID)a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"getLang","(Ljava/lang/String;)Ljava/lang/String;","en");else if(cc.sys.os==cc.sys.OS_IOS){var b=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"getLang"),a="en";if(2<=b.length){var c=b.substr(0,2);"ja"==c?a=c:"zh"==c&&(a="zh-TW"==b||"zh-HK"==
b?"zh2":7>b.length?c:"Hans"==b.substr(3,4)?c:"zh2")}}"ja"!=a&&(a="en");return a},str:function(a){var b=dt.txts[a];b||(cc.log("g#str ERROR! key\x3d"+a),b=a);b=b.replace(/\\n/g,"\n");if(1<arguments.length)for(var c=1;c<arguments.length;c++){var d="%"+c,e=b.indexOf(d);0<=e&&(b=b.substring(0,e)+arguments[c]+b.substring(e+d.length))}return b},strs:function(a){a=g.str(a).split(",");for(var b in a)a[b]=a[b].trim(),a[b]=a[b].replace("_"," ");return a},logRange:function(a,b,c,d,e){"number"===typeof b?cc.log(a+
" ("+b+", "+c+") ("+d+" - "+e+")"):cc.log(a+" ("+b.x+", "+b.y+") ("+b.width+" - "+b.height+")")},logObj:function(a,b){b&&cc.log(b);for(var c in a)cc.log(" "+c+":"+a[c])},getKyori:function(a,b,c,d){a=JGUtil.getDistance({x:a,y:b},{x:c,y:d});return a.x+a.y},getRange:function(a,b,c,d){return{x:a,y:b,width:c,height:d}},getLabel:function(a,b,c,d,e,f,h){e||(e=g.FONT_SZ_MIDIUM);a=new cc.LabelTTF(a,this.fontNormal,e,cc.size(0,0));b&&a.setFontFillColor(b);c&&a.enableStroke(c,g.isApp()?4:2);d&&a.enableShadow(d,
cc.size(2,-2),2);a.setAnchorPoint(f==cc.TEXT_ALIGNMENT_LEFT?0:f==cc.TEXT_ALIGNMENT_RIGHT?1:0.5,h==cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM?0:h==cc.VERTICAL_TEXT_ALIGNMENT_TOP?1:0.5);return a},setLbl:function(a,b,c,d,e,f,h){b=g.getLabel(b,c,null,cc.color("#000000"),h);f&&b.setName(f);b.setPosition(d,e);a.addChild(b);return b},getLblNum:function(a,b,c,d,e,f,h){f||(f=g.FONT_SZ_MIDIUM);d||(d=cc.color("#00ffff"));e||(e=cc.color("#ffffff"));var k=new cc.Node;a=g.getLabel(a,d,null,h,f,cc.TEXT_ALIGNMENT_LEFT);k.addChild(a);
a=g.getLabel(b,e,null,h,f,cc.TEXT_ALIGNMENT_RIGHT);a.setPosition(c,0);k.addChild(a);return k},getBmpLabel:function(a,b){return cc.LabelBMFont.create(a,b)},setBmpLbl:function(a,b,c,d,e){b=g.getBmpLabel(b,res.bmfntNum0Fnt);e&&b.setName(e);b.setPosition(c,d);a.addChild(b);return b},addLblToBg:function(a,b,c,d,e,f,h){f||(f=cc.color("#000000"));b=g.getLabel(b,f,null,null,e,cc.TEXT_ALIGNMENT_LEFT,cc.VERTICAL_TEXT_ALIGNMENT_TOP);h&&b.width>h&&b.setScaleX(h/b.width);b.setPosition(c,d);a.addChild(b);return b},
addLblNumToBg:function(a,b,c,d,e,f,h,k,m,n){k||(k=cc.color("#ffffff"));m||n||(n=cc.color("#000000"));var p=cc.Sprite.create(res.grd);p.setScale(f/p.width,h/p.height);p.setPosition(d+f/2,e-h/2);a.addChild(p);this.addLblToBg(a,b,d,e,0.75*h);b=g.getLabel(""+c,k,m,n,h,cc.TEXT_ALIGNMENT_RIGHT,cc.VERTICAL_TEXT_ALIGNMENT_TOP);b.width>f&&b.setScaleX(f/b.width);b.setPosition(d+f,e);a.addChild(b);return b},stopBlink:function(a,b){a&&(cc.log("LayerGame#stopBlink win\x3d"+a),a.stopAllActions(),a.setOpacity(255*
b))},getImgBtn:function(a,b,c,d,e){b=new ccui.Button(b,c);d&&b.addTouchEventListener(function(a,b){b==ccui.Widget.TOUCH_ENDED&&(e||g.playSe("ok"),d(a))},a);return b},W_BTN:320,H_BTN:80,getBtn:function(a,b){var c=new cc.Scale9Sprite(res.btn),d=new cc.Scale9Sprite(res.btn_p);a=cc.sys.os==cc.sys.OS_IOS?" "+a+"\u3000":"\u3000"+a+"\u3000";var e=this.getLabel(a,cc.color.WHITE,cc.color("#000000")),f=cc.ControlButton.create(e,c);f.preferredSize=cc.size(0,g.H_BTN);f.setTitleLabelForState(e,cc.CONTROL_STATE_NORMAL);
f.setBackgroundSpriteForState(c,cc.CONTROL_STATE_NORMAL);f.setBackgroundSpriteForState(d,cc.CONTROL_STATE_HIGHLIGHTED);f.setTitleColorForState(cc.color("#ffff00"),cc.CONTROL_STATE_HIGHLIGHTED);f.zoomOnTouchDown=!1;f.addTargetWithActionForControlEvents(this,function(){g.playSe("ok");b&&b()},cc.CONTROL_EVENT_TOUCH_UP_INSIDE);return f},setBtn:function(a,b,c,d,e){a=g.getBtn(a,b);c&&c.addChild(a);d&&a.setPosition(d,e);return a},startLoading:function(a,b){var c=(new LayerMsg).addMsg(b).addLoading();c.start(a);
return c},stopLoading:function(a){a.finishLoading();a.close()},clearMenu:function(){var a;(a=cc.director.getRunningScene().getChildByName("menu"))&&a.removeFromParent()},readyMenu:function(a,b){this.clearMenu();var c=cc.director.getRunningScene(),d=new LayerMenu(a,b);d.setName("menu");c.addChild(d)},addMenuItem:function(a,b,c,d){return cc.director.getRunningScene().getChildByName("menu").addMenuItem(a,b,c,d)},startMenu:function(){cc.director.getRunningScene().getChildByName("menu").animMenu()},getSelectedMenu:function(){return cc.director.getRunningScene().getChildByName("menu").tagSelectedBtn},
stopMenu:function(){var a=cc.director.getRunningScene().getChildByName("menu");if(a)return a.stopMenu()},stopMenuSe:function(){g.stopSe("ok")},removeByNm:function(a,b){b||(b=cc.director.getRunningScene());var c=b.getChildByName(a);c&&c.removeFromParent()},getCover:function(a,b,c,d){a||(a=cc.director.getRunningScene());b||(b="cov");c||(c="black");d||(d=0<a.width?cc.size(a.width,a.height):cc.winSize);var e=a.getChildByName(b);if(!e){var f;f=d.width;d=d.height;e=cc.Sprite.create(res[c]);e.setScale(f/
e.width,d/e.height);e.setPosition(f/2,d/2);e.setName(b);a.addChild(e)}return e},removeCover:function(a){g.removeByNm("cov",a)},blockTapUnder:function(a){var b=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,onTouchBegan:function(a,b){return!0},onTouchMoved:function(a,b){},onTouchEnded:function(a,b){},onTouchCancelled:function(a,b){}});b.setSwallowTouches(!0);cc.eventManager.addListener(b,a)},startFade:function(a,b,c,d,e){e||(e=cc.director.getRunningScene());var f=this.getCover(e);
f.stopAllActions();if("out"==a){if(0==b&&c){f.setOpacity(255);return}f.setOpacity(0);a=cc.fadeIn(b/1E3)}else f.setOpacity(255),a=cc.fadeOut(b/1E3);f.runAction(cc.sequence(a,cc.callFunc(function(){c||g.removeCover(e);d&&d()})));return f},getSizeMsg:function(){return cc.size(cc.winSize.width/2+16,6*g.FONT_SZ_MIDIUM+16)},getPosMsg:function(a){switch(a){case "left":return cc.p(g.getSizeMsg().width/2,g.getSizeMsg().height/2);case "right":return cc.p(cc.winSize.width-g.getSizeMsg().width/2,g.getSizeMsg().height/
2);default:return cc.p(cc.winSize.width/2,g.getSizeMsg().height/2)}},viewMsg:function(a,b,c,d,e,f,h){d||(d=cc.director.getRunningScene());f||(f=g.getSizeMsg());c=new cc.Scale9Sprite(res[c]);c.setContentSize(f.width,f.height);c.setPosition(g.getPosMsg(h));c.setName("msg");d.addChild(c,9999);var k;k=new Msg(a,b,c.width-16,c.height-16,cc.color("#ffffff"),null,cc.color("#000000"),g.FONT_SZ_MIDIUM);k.setPosition(8,8);c.addChild(k);c.setScale(0.1,0.1);Game.getTm(0.2);c.runAction(cc.sequence(cc.scaleTo(0.2,
1,1),cc.callFunc(function(){k.startLbl()})));return c},anmClrMsg:function(a,b){a||(a="msg");b||(b=cc.director.getRunningScene());var c=b.getChildByName(a);c&&c.runAction(cc.sequence(cc.scaleTo(0.2,0.1,0.1),cc.callFunc(function(){c.removeFromParent()})))},makeAnimation:function(a,b,c){var d=0;c&&(d+=c);for(c=new cc.Animation;;){var e=cc.spriteFrameCache.getSpriteFrame(a+d);if(!e)break;c.addSpriteFrame(e);d++}c.setDelayPerUnit(b);c.setRestoreOriginalFrame(!0);c.retain();return c},releaseAnimation:function(a){a.release()},
getListPos:function(a){var b=a.getInnerContainerSize().height-a.height;a=a.getInnerContainerPosition().y;return(b+a)/b*100},setListPos:function(a,b){a.jumpToPercentVertical(b)},getCommonEffect:function(a,b,c,d,e){a.anm||(a.anm={});if(void 0==a.anm[b]){d=0;e&&(d+=e);for(e=new cc.Animation;;){var f=cc.spriteFrameCache.getSpriteFrame(b+"_"+d);if(!f)break;e.addSpriteFrame(f);d++}e.setDelayPerUnit(c);e.setRestoreOriginalFrame(!0);e.retain();a.anm[b]=e}a=cc.animate(a.anm[b]);b=cc.Sprite.create();b.runAction(cc.repeatForever(a));
return b},FNM_SOUNDS:{camp:"B16_128.mp3",humanPhase:"A16_102.mp3",comPhase:"B16_001.mp3",record:"B16_020.mp3",dmg:"SE_H047.mp3",dead:"A5_04131.mp3",ken:"A5_04102.mp3",fist:"A5_04105.mp3",yari:"A5_04120.mp3",yumi:"A5_04111.mp3",care:"SE_H026.mp3",fire:"A5_03066.mp3",ice:"A5_03069.mp3",thunder:"A5_03072.mp3",meteo:"SE_H042.mp3",mon:"SE_H053.mp3",mon2:"SE_H056.mp3",lvup:"A5_06171.mp3",noroi:"A5_06171.mp3",move:"A5_01013.mp3",ok:"SE_H037.mp3",select:"SE_H009.mp3",win:"A5_06176.mp3",lose:"A5_06175.mp3",
soubi:"A5_01027.mp3",shoukan:"A5_03090.mp3"},getFnmSound:function(a){return(a=g.FNM_SOUNDS[a])?"res/sound/"+a:null},toggleSound:function(){var a=!SP.isSound();SP.setSound(a);a?g.restartBgm():g.pauseBgm()},playMusic:function(a,b,c){if(SP.isSound()&&(void 0==c&&(c=SP.getVolBgm()),!(0>=c))){var d=cc.audioEngine;g.setVolBgm(c,d);(c=g.getFnmSound(a))?d.playMusic(c,b):(cc.log("playMusic "+a+" ERROR!"),cc.log(c))}},setVolBgm:function(a,b){b||(b=cc.audioEngine);b.setMusicVolume(a)},nowBgm:null,playBgm:function(a,
b){a==g.nowBgm&&cc.audioEngine.isMusicPlaying()||(g.stopBgm(),1!=b?(g.nowBgm=a,g.restartBgm(!0)):(g.playMusic(a,!1),g.nowBgm=a))},restartBgm:function(a){g.nowBgm&&g.playMusic(g.nowBgm,!0)},pauseBgm:function(){cc.audioEngine.stopMusic()},stopBgm:function(){g.pauseBgm();g.nowBgm=null},playSe:function(a,b){if(SP.isSound()&&(void 0==b&&(b=SP.getVolSe()),!(0>=b))){var c=cc.audioEngine;c.setEffectsVolume(b);var d=g.getFnmSound(a);d?c.playEffect(d,!1):(cc.log("playSe "+a+" ERROR!"),cc.log(d))}},stopSe:function(a){var b=
cc.audioEngine;b.stopAllEffects();a&&cc.sys.os!=cc.sys.OS_IOS&&b.unloadEffect(g.getFnmSound(a))},unloadSounds:function(){for(var a in this.FNM_SOUNDS)this.stopSe(this.FNM_SOUNDS[a])},readySounds:function(a){a()},showBtnSound:function(a,b){b||(b=cc.director.getRunningScene());a||(a=8);g.hideBtnSound(b);var c;c=function(){g.toggleSound();g.showBtnSound(a,b);g.playSe("ok")};c=SP.isSound()?g.getImgBtn(this,res.btn_sound_on,res.btn_sound_on_p,c,!0):g.getImgBtn(this,res.btn_sound_off,res.btn_sound_off_p,
c);c.setName("btnSound");c.setAnchorPoint(0,1);c.setPosition(a,cc.winSize.height-a);b.addChild(c)},hideBtnSound:function(a){g.removeByNm("btnSound",a)},showBtnHelp:function(a,b){if(g.isApp()){b||(b=cc.director.getRunningScene());a||(a=8);var c;c=g.getImgBtn(this,res.btn_help,res.btn_help_p,function(){g.playSe("ok");var a="?";cc.sys.os==cc.sys.OS_IOS&&(a+="\x26pf\x3d1");a+="\x26l\x3d"+g.getLang();g.openURL(g.URL_HELP+a);var c=g.startLoading(b,"Loading...");b.scheduleOnce(function(){g.stopLoading(c)},
1.5)},!0);c.setName("btnHelp");c.setAnchorPoint(0,1);c.setPosition(a,cc.winSize.height-a-c.height-2*a);b.addChild(c)}},hideBtnHelp:function(a){g.removeByNm("btnHelp",a)},showSettei:function(a){var b=cc.director.getRunningScene(),c=g.getCover(b);g.blockTapUnder(c);c.setOpacity(128);var d=new LayerSettei(a);d.setPosition(0,d.height);var e=new ccui.ScrollView;e.setDirection(ccui.ScrollView.DIR_VERTICAL);e.setBounceEnabled(!0);e.setContentSize(d.width,cc.winSize.height);e.setInnerContainerSize(d.getContentSize());
e.addChild(d);b.addChild(e);e.setName("reki");e.setPosition(cc.winSize.width-g.W_MENU-e.width,-cc.winSize.height);e.runAction(cc.moveBy(0.3,0,cc.winSize.height).easing(cc.easeQuadraticActionOut()));g.readyMenu();g.addMenuItem(g.str("cancel"),0,function(){g.clearMenu();g.removeCover(b);e.removeFromParent();a()});g.addMenuItem("OK",0,function(){g.clearMenu();d.hanei();g.removeCover(b);e.removeFromParent();a()});g.addMenuItem(g.str("skcnmds"),0,function(){d.setDefault(function(){g.clearMenu();g.removeCover(b);
e.removeFromParent();g.showSettei(a)})});g.startMenu()},ANDR_CLS_NM:"org/cocos2dx/javascript/AppActivity",IOS_CLS_NM:"AppController",isTermDebug:function(){if(cc.sys.platform==cc.sys.ANDROID){var a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"isDebug","(Z)Z",!1);return a}return cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"isDebug"):g.DBG},getTermInfoVerMani:function(){if(cc.sys.platform==cc.sys.ANDROID){var a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"getVerMani",
"(Ljava/lang/String;)Ljava/lang/String;","0");return a}return cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"getVer"):"0"},getTermInfoOS:function(){if(cc.sys.platform==cc.sys.ANDROID){var a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"getOS","(Ljava/lang/String;)Ljava/lang/String;","");return a}return cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"getOS"):"debug"},getTermInfoTerm:function(){if(cc.sys.platform==cc.sys.ANDROID){var a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,
"getTerm","(Ljava/lang/String;)Ljava/lang/String;","andr");return a}return cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"getTerm"):"pc"},pressedKeyBack:function(){cc.sys.platform==cc.sys.ANDROID&&jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"pressedKeyBack","()V");cc.sys.os==cc.sys.OS_IOS&&jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"pressedKeyBack")},textFromApp:function(a){cc.log("g#testFromApp "+a)},onResume:function(){cc.log("g#onResume")},onPause:function(){cc.log("g#onPause")},
pauseGame:function(){g.pauseBgm();cc.game.pause()},resumeGame:function(){g.restartBgm();cc.game.resume()},finishGame:function(){cc.game.end()},setBackKey:function(a){var b=cc.EventListener.create({event:cc.EventListener.KEYBOARD,onKeyReleased:function(a,b){cc.log("g#startTitle onKeyReleased keyCode\x3d"+a);6==a&&g.pressedKeyBack()}});cc.eventManager.addListener(b,a)},openURL:function(a){cc.log("app#openURL strUrl\x3d"+a);return cc.sys.platform==cc.sys.ANDROID?(cc.log("app#openURL methodName\x3dopenURL"),
a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"openURL","(Ljava/lang/String;)Z",a),cc.log("app#openURL ret\x3d"+a),a):cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"openURL:",a):!0},openShare:function(a,b){cc.log("app#openShare subj\x3d"+a+" body\x3d"+b);if(cc.sys.platform==cc.sys.ANDROID){var c=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"openShare","(Ljava/lang/String;Ljava/lang/String;)Z",a,b);return c}return cc.sys.os==cc.sys.OS_IOS?c=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,
"openMailSubj:Body:",a,b):!0},startAlertWeb:function(a,b,c){return cc.sys.platform==cc.sys.ANDROID?a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"startAlertWeb","(Ljava/lang/String;Ljava/lang/String;)Z",a,b):cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"showWebUrl:Posts:Subj:",a,b,c):!1},waitAd:2,listenerInters:null,showInters:function(a){this.listenerInters=a;cc.log("app#showInters");return cc.sys.platform==cc.sys.ANDROID?(a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,
"showInters","(F)Z",SP.getVolSe()),cc.log("app#showInters ret\x3d"+a),a):cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"showInters"):!1},callbackInters:function(a){null!=this.listenerInters&&this.listenerInters(a)},listenerReward:null,showReward:function(a){this.listenerReward=a;cc.log("app#showReward");return cc.sys.platform==cc.sys.ANDROID?(a=jsb.reflection.callStaticMethod(g.ANDR_CLS_NM,"showReward","(F)Ljava/lang/String;",SP.getVolSe()),cc.log("app#showReward ret\x3d"+
a),a):cc.sys.os==cc.sys.OS_IOS?a=jsb.reflection.callStaticMethod(g.IOS_CLS_NM,"showReward"):!1},callbackReward:function(a){null!=this.listenerReward&&this.listenerReward(a)},goReward:function(a,b,c){var d=cc.director.getRunningScene(),e=g.startLoading(d,a),f=0;d.scheduleOnce(function(){"ok"!=g.showReward(function(a){cc.log("SceneGetCard#goReward","REWARD callback res\x3d"+a);"err2"==a?(g.stopLoading(e),e=null,g.errorReward(d,c,g.str("rewerr0"))):"err4"==a?(g.stopLoading(e),e=null,g.errorReward(d,
c,g.str("rewerr1"))):"opend"==a?g.pauseGame():"closed"==a?(g.resumeGame(),g.stopLoading(e),e=null,0==f&&g.errorReward(d,c,g.str("rewerr2"))):(f=Number(a),isNaN(f)?g.errorReward(d,c,g.str("cmnerr0",a)):c(f))})&&(g.stopLoading(e),g.errorReward(null,c,g.str("rewerr3")))},b)},errorReward:function(a,b,c){null!=a?a.scheduleOnce(function(){g.startDlg(a,c,function(){b(0)})},0.1):g.startDlg(a,c,function(){b(0)})},startDlg:function(a,b,c,d){b=(new LayerMsg).addMsg(b).addBtn("OK",c,!1,!0).addClose(c);d&&b.addCaption(d);
b.start(a);return b},startDlgMsgs:function(a,b,c,d){b=(new LayerMsg).addMsgs(b).addBtn("OK",c,!1,!0).addClose(c);d&&b.addCaption(d);b.start(a);return b},hktgAdd:function(a,b){var c=cc.director.getRunningScene(),d=g.startLoading(c,g.str("ssnc")),e=SP.getNetsvData(a);null==e?(g.stopLoading(d),b(-998,g.str("errntsv"))):cc.loader.loadPost(g.URL_ROOT+g.URL_HKTG_ADD,{ver:SP.VER_SV,id:e.id,dtSv:0,bin:e.val},function(a,c){g.stopLoading(d);if(a)cc.log("app#hktgAdd err "+a.errorMessage),b(-999,g.str("errdnp"));
else{var k=c.split(","),k=Number(k[0]),m="";switch(k){case 0:m=g.encode(e.id);break;default:m=g.str("errsvr",""+-k)}b(k,m)}})},hktgGet:function(a,b,c){var d=cc.director.getRunningScene(),e=g.startLoading(d,g.str("jsnc")),d=g.decode(b);null==d||""==b?(g.stopLoading(e),c(-997,g.str("errpw"))):cc.loader.loadPost(g.URL_ROOT+g.URL_HKTG_GET,{ver:SP.VER_SV,id:d},function(b,d){g.stopLoading(e);if(b)cc.log("app#hktgGet err "+b.errorMessage),c(-999,g.str("errdnp"));else{var k=d.split(","),m=Number(k[0]),n=
"";switch(m){case 0:if(!SP.setDataFromNet(a,k[1],k[2])){m=-996;n=g.str("errntld0",""+-m);break}break;case -5:n=g.str("errntld1",""+-m);break;case -6:n=g.str("errntld2",""+-m);break;default:n=g.str("errsvr",""+-m)}c(m,n)}})},netLoad:function(a,b,c,d){var e=(new LayerMsg).addMsg(g.str("pwpst")).addInput("","",50,g.FONT_SZ_MIDIUM).addBtn("OK",function(){var f=e.getInputText();e.close();g.hktgGet(b,f,function(b,e){var f=0==b?(new LayerMsg).addMsg(g.str("okntld")).addTap(function(){f.close();c()}):(new LayerMsg).addMsg(e).addTap(function(){f.close();
d&&d()});f.start(a)})}).addBtn(g.str("mdr"),function(){e.close();d&&d()});e.start(a)}},dt,main,TitleLayer=cc.Layer.extend({sprite:null,ctor:function(){this._super();return!0}}),TitleScene=cc.Scene.extend({onEnter:function(){this._super();var a=new TitleLayer;this.addChild(a);if(dt)this.startTitle();else{var b=this,a=g.getLang(),c=g.startLoading(this,"Now Loading...");dt=new Data;g.loadCsvs([{id:"jobs",src:"res/data/job.csv"},{id:"itms",src:"res/data/item.csv"},{id:"stginf",src:"res/data/stginf.csv"},
{id:"txts",src:"res/data/text_"+a+".csv"}],function(a,e){cc.log("app "+a);null==a&&(dt.jobs=g.csv2ary(e.jobs,0,!0),delete e.jobs,dt.itms=g.csv2ary(e.itms,1,!0),delete e.itms,dt.stginf=g.csv2ary(e.stginf,1,!0),delete e.stginf,dt.txts=g.csv2obj(e.txts,0,!1),delete e.txts,NM_STSS[0]=g.str("nmsts0"),NM_STSS[1]=g.str("nmsts1"),NM_STSS[2]=g.str("nmsts2"),NM_STSS[3]=g.str("nmsts3"),NM_STSS[4]=g.str("nmsts4"),NM_STSS[5]=g.str("nmsts5"),NM_STSS[6]=g.str("nmsts6"),SP.isSound()?g.readySounds(function(){g.stopLoading(c);
b.startTitle()}):(g.stopLoading(c),b.startTitle()))})}},startTitle:function(){var a=this,b=(new LayerMsg).addMsgs(["Since 2002"," ","Tenmillion","ZERO"," ","Ver."+g.VER_VIEW," ","Copyright 2018-2019 shiftup.net"],null,null),c=!1,d=function(){if(!c)if(c=!0,g.playBgm("record"),b.close(),0<=SP.getLastNo())cc.director.runScene(new SceneRecord);else{var d=(new LayerMsg).addBtn(g.str("gmstt"),function(){d.close();g.hideBtnSound(d);g.hideBtnHelp();a.loadAndGo(0)}).addBtn(g.str("ntld"),function(){g.netLoad(a,
0,function(){d.close();g.hideBtnSound(d);g.hideBtnHelp();cc.director.runScene(new SceneRecord)})});d.start(a);g.showBtnSound(0,d)}};b.addTap(function(){a.unscheduleAllCallbacks();d()});b.start(this);this.scheduleOnce(function(){g.startFade("out",900,!1,d)},1.5)},loadAndGo:function(a){main=new Main;SP.loadData(a);main.init();0==SP.getData().posNow?Game.newGame(this,null):""!=SP.getData().noStg?cc.director.runScene(new SceneGame(SP.getData().noStg)):g.DBG&&!isNaN(g.DBG_FIRST)?cc.director.runScene(new SceneGame(g.DBG_FIRST)):
cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneWorld))}});var Base64=function(){this.initialize()};
Base64.prototype.initialize=function(){this.symbols=[];for(var a=65,b=0;26>b;b++)this.symbols.push(String.fromCharCode(a+b));a=97;for(b=0;26>b;b++)this.symbols.push(String.fromCharCode(a+b));a=48;for(b=0;10>b;b++)this.symbols.push(String.fromCharCode(a+b));this.symbols.push("+","/");this.encodeMap=[];for(b=0;b<this.symbols.length;b++)this.encodeMap[b]=this.symbols[b];this.decodeMap=[];for(b=0;b<this.symbols.length;b++)this.decodeMap[this.symbols[b]]=b;this.decodeMap["\x3d"]=null};
Base64.prototype.encode=function(a){var b,c=this.encodeMap,d=[];b=0;for(len=3*Math.floor(a.length/3);b<len;b+=3){var e=a[b],f=a[b+1],h=a[b+2],e=c[e>>2&63]+c[(e<<4)+(f>>4)&63]+c[(f<<2)+(h>>6)&63]+c[h&63];d.push(e)}switch(a.length%3){case 1:e=a[b];e=c[e>>2&63]+c[e<<4&63]+"\x3d\x3d";d.push(e);break;case 2:e=a[b],f=a[b+1],e=c[e>>2&63]+c[(e<<4)+(f>>4)&63]+c[f<<2&63]+"\x3d",d.push(e)}return d.join("")};
Base64.prototype.decode=function(a){if(0!=a.length%4)throw"encoded.length must be a multiple of 4.";for(var b=[],c=this.decodeMap,d=0,e=a.length;d<e;d+=4){var f=c[a[d+1]],h=c[a[d+2]],k=c[a[d+3]];b.push((c[a[d]]<<2)+(f>>4)&255);if(null==h)break;b.push((f<<4)+(h>>2)&255);if(null==k)break;b.push((h<<6)+k&255)}return b};Base64.prototype.uriEncodedToOctets=function(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a.charAt(c);"%"==e?(e=a.charAt(++c)+a.charAt(++c),e=parseInt(e,16)):e=e.charCodeAt(0);b.push(e)}return b};
Base64.prototype.encodeStringAsUTF8=function(a){a=encodeURIComponent(a);a=this.uriEncodedToOctets(a);return this.encode(a)};Base64.prototype.octetsToUriEncoded=function(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c].toString(16),e=("0"+e).substr(e.length-1,2);b.push("%"+e)}return b.join("")};Base64.prototype.decodeStringAsUTF8=function(a){a=this.decode(a);a=this.octetsToUriEncoded(a);return decodeURIComponent(a)};var base64=new Base64;var JGUtil={VER:123,getCenterPoint:function(a){return a.width&&a.height?{x:a.x+a.width/2,y:a.y+a.height/2}:a},getMargin:function(a){return a.width&&a.height?{x:a.width/2,y:a.height/2}:{x:0,y:0}},intersect:function(a,b){return a.width&&a.height?b.width&&b.height?a.x<b.x+b.width&&b.x<a.x+a.width&&a.y<b.y+b.height&&b.y<a.y+a.height:b.x>=a.x&&b.x<a.x+a.width&&b.y>=a.y&&b.y<a.y+a.height:b.width&&b.height?a.x>=b.x&&a.x<b.x+b.width&&a.y>=b.y&&a.y<b.y+b.height:a.x==b.x&&a.y==b.y},getDistance:function(a,b){var c=
JGUtil.getCenterPoint(a),d=JGUtil.getCenterPoint(b);return{x:Math.abs(c.x-d.x),y:Math.abs(c.y-d.y)}},getMovePoint:function(a,b,c,d){a=JGUtil.getCenterPoint(a);b=JGUtil.getCenterPoint(b);c||(c=1);c={x:(a.x-b.x)*c,y:(a.y-b.y)*c};b=Math.abs(c.x);a=Math.abs(c.y);var e=Math.max(b,a),f=b/e,e=a/e;d&&(b>d||a>d)&&(c.x=0>c.x?-d*f:d*f,c.y=0>c.y?-d*e:d*e);return c},getDirectionAngle:function(a,b,c){a=JGUtil.getCenterPoint(a);b=JGUtil.getCenterPoint(b);var d=Math.abs(a.x-b.x),e=Math.abs(a.y-b.y);return c&&Math.max(d,
e)<c?null:d>e?a.x>b.x?3:1:a.y>b.y?0:2},homingX:function(a,b,c,d){var e=JGUtil.getMargin(a),f=JGUtil.getMargin(b);b=b.x+f.x-e.x;return a.x>b?(a.x-=c*d,a.x<b?(a.x=b,!0):!1):a.x<b?(a.x+=c*d,a.x>b?(a.x=b,!0):!1):!0},homingY:function(a,b,c,d){var e=JGUtil.getMargin(a),f=JGUtil.getMargin(b);b=b.y+f.y-e.y;return a.y>b?(a.y-=c*d,a.y<b?(a.y=b,!0):!1):a.y<b?(a.y+=c*d,a.y>b?(a.y=b,!0):!1):!0},homing:function(a,b,c,d){var e=JGUtil.getMargin(a),f=JGUtil.getMargin(b);b={x:b.x+f.x-e.x,y:b.y+f.y-e.y};var h,k;a.x>
b.x?(a.x-=c*d,a.x<b.x?a.x=b.x:h=!0):a.x<b.x&&(a.x+=c*d,a.x>b.x?a.x=b.x:h=!0);a.y>b.y?(a.y-=c*d,a.y<b.y?a.y=b.y:k=!0):a.y<b.y&&(a.y+=c*d,a.y>b.y?a.y=b.y:k=!0);return h||k?!1:!0}};var LZString=function(){function a(a,b){if(!c[a]){c[a]={};for(var d=0;d<a.length;d++)c[a][a.charAt(d)]=d}return c[a][b]}var b=String.fromCharCode,c={},d={compressToBase64:function(a){if(null==a)return"";a=d._compress(a,6,function(a){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(a)});switch(a.length%4){default:case 0:return a;case 1:return a+"\x3d\x3d\x3d";case 2:return a+"\x3d\x3d";case 3:return a+"\x3d"}},decompressFromBase64:function(b){return null==b?"":""==
b?null:d._decompress(b.length,32,function(c){return a("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d",b.charAt(c))})},compressToUTF16:function(a){return null==a?"":d._compress(a,15,function(a){return b(a+32)})+" "},decompressFromUTF16:function(a){return null==a?"":""==a?null:d._decompress(a.length,16384,function(b){return a.charCodeAt(b)-32})},compressToUint8Array:function(a){a=d.compress(a);for(var b=new Uint8Array(2*a.length),c=0,k=a.length;k>c;c++){var m=a.charCodeAt(c);
b[2*c]=m>>>8;b[2*c+1]=m%256}return b},decompressFromUint8Array:function(a){if(null===a||void 0===a)return d.decompress(a);for(var c=Array(a.length/2),h=0,k=c.length;k>h;h++)c[h]=256*a[2*h]+a[2*h+1];var m=[];return c.forEach(function(a){m.push(b(a))}),d.decompress(m.join(""))},compressToEncodedURIComponent:function(a){return null==a?"":d._compress(a,6,function(a){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$".charAt(a)})},decompressFromEncodedURIComponent:function(b){return null==
b?"":""==b?null:(b=b.replace(/ /g,"+"),d._decompress(b.length,32,function(c){return a("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",b.charAt(c))}))},compress:function(a){return d._compress(a,16,function(a){return b(a)})},_compress:function(a,b,c){if(null==a)return"";var d,m,n,p={},r={},s="",t="",w="",v=2,y=3,x=2,u=[],z=0,A=0;for(n=0;n<a.length;n+=1)if(s=a.charAt(n),Object.prototype.hasOwnProperty.call(p,s)||(p[s]=y++,r[s]=!0),t=w+s,Object.prototype.hasOwnProperty.call(p,t))w=
t;else{if(Object.prototype.hasOwnProperty.call(r,w)){if(256>w.charCodeAt(0)){for(d=0;x>d;d++)z<<=1,A==b-1?(A=0,u.push(c(z)),z=0):A++;m=w.charCodeAt(0);for(d=0;8>d;d++)z=z<<1|1&m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m>>=1}else{m=1;for(d=0;x>d;d++)z=z<<1|m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m=0;m=w.charCodeAt(0);for(d=0;16>d;d++)z=z<<1|1&m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m>>=1}v--;0==v&&(v=Math.pow(2,x),x++);delete r[w]}else for(m=p[w],d=0;x>d;d++)z=z<<1|1&m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m>>=1;v--;
0==v&&(v=Math.pow(2,x),x++);p[t]=y++;w=String(s)}if(""!==w){if(Object.prototype.hasOwnProperty.call(r,w)){if(256>w.charCodeAt(0)){for(d=0;x>d;d++)z<<=1,A==b-1?(A=0,u.push(c(z)),z=0):A++;m=w.charCodeAt(0);for(d=0;8>d;d++)z=z<<1|1&m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m>>=1}else{m=1;for(d=0;x>d;d++)z=z<<1|m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m=0;m=w.charCodeAt(0);for(d=0;16>d;d++)z=z<<1|1&m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m>>=1}v--;0==v&&(v=Math.pow(2,x),x++);delete r[w]}else for(m=p[w],d=0;x>d;d++)z=
z<<1|1&m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m>>=1;v--;0==v&&(Math.pow(2,x),x++)}m=2;for(d=0;x>d;d++)z=z<<1|1&m,A==b-1?(A=0,u.push(c(z)),z=0):A++,m>>=1;for(;;){if(z<<=1,A==b-1){u.push(c(z));break}A++}return u.join("")},decompress:function(a){return null==a?"":""==a?null:d._decompress(a.length,32768,function(b){return a.charCodeAt(b)})},_decompress:function(a,c,d){var k,m,n,p,r,s,t=[],w=4,v=4,y=3;m="";var x=[],u=d(0),z=c,A=1;for(k=0;3>k;k+=1)t[k]=k;m=0;p=Math.pow(2,2);for(r=1;r!=p;)n=u&z,z>>=1,0==z&&
(z=c,u=d(A++)),m|=(0<n?1:0)*r,r<<=1;switch(m){case 0:m=0;p=Math.pow(2,8);for(r=1;r!=p;)n=u&z,z>>=1,0==z&&(z=c,u=d(A++)),m|=(0<n?1:0)*r,r<<=1;s=b(m);break;case 1:m=0;p=Math.pow(2,16);for(r=1;r!=p;)n=u&z,z>>=1,0==z&&(z=c,u=d(A++)),m|=(0<n?1:0)*r,r<<=1;s=b(m);break;case 2:return""}k=t[3]=s;for(x.push(s);;){if(A>a)return"";m=0;p=Math.pow(2,y);for(r=1;r!=p;)n=u&z,z>>=1,0==z&&(z=c,u=d(A++)),m|=(0<n?1:0)*r,r<<=1;switch(s=m){case 0:m=0;p=Math.pow(2,8);for(r=1;r!=p;)n=u&z,z>>=1,0==z&&(z=c,u=d(A++)),m|=(0<
n?1:0)*r,r<<=1;t[v++]=b(m);s=v-1;w--;break;case 1:m=0;p=Math.pow(2,16);for(r=1;r!=p;)n=u&z,z>>=1,0==z&&(z=c,u=d(A++)),m|=(0<n?1:0)*r,r<<=1;t[v++]=b(m);s=v-1;w--;break;case 2:return x.join("")}if(0==w&&(w=Math.pow(2,y),y++),t[s])m=t[s];else{if(s!==v)return null;m=k+k.charAt(0)}x.push(m);t[v++]=k+m.charAt(0);w--;k=m;0==w&&(w=Math.pow(2,y),y++)}}};return d}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module&&(module.exports=LZString);var DataInputStream=function(a){this.data=a;this.ix=0};DataInputStream.prototype.seek=function(a){this.ix=a};DataInputStream.prototype.readUnsignedByte=function(){return this.data[this.ix++]};DataInputStream.prototype.readUnsignedShort=function(){return(this.data[this.ix++]<<8)+this.data[this.ix++]};DataInputStream.prototype.readUnsignedInt=function(){return(this.data[this.ix++]<<24)+(this.data[this.ix++]<<16)+(this.data[this.ix++]<<8)+this.data[this.ix++]};
DataInputStream.prototype.readUTF=function(){for(var a=this.readUnsignedShort(),b="",c=0;c<a;c++)var d=this.readUnsignedShort(),b=b+String.fromCharCode(d);return b};var DataOutputStream=function(a){this.data=a;this.ix=0};DataOutputStream.prototype.writeUnsignedByte=function(a){this.data[this.ix++]=a};DataOutputStream.prototype.writeUnsignedShort=function(a){this.data[this.ix++]=a>>8&255;this.data[this.ix++]=a&255};
DataOutputStream.prototype.writeUnsignedInt=function(a){this.data[this.ix++]=a>>24&255;this.data[this.ix++]=a>>16&255;this.data[this.ix++]=a>>8&255;this.data[this.ix++]=a&255};DataOutputStream.prototype.writeUTF=function(a){var b=a.length;65535<b&&(cc.log("DataOutputStream#writeUTF ERROR! len\x3d"+b),b=0);this.writeUnsignedShort(b);for(var c=0;c<b;c++)this.writeUnsignedShort(a.charCodeAt(c))};cc.loader.getPostParam=function(a){if(!window.FormData)return cc.log("LoaderR.js cc.loader#getPostParam !(window.FormData)"),null;var b=new FormData,c=!1,d;for(d in a)b.append(d,a[d]),c=!0;return c?b:a};cc.loader.getPostParamPhone=function(a){var b="",c;for(c in a)cc.log("LoaderR#getPostParamPhone "+c+"\x3d"+a[c]),b+="\x26"+c+"\x3d"+a[c];cc.log("LoaderR#getPostParamPhone ret\x3d"+b);return""==b?a:"?"+b};
cc.loader.loadPost=function(a,b,c){if(cc._isNodeJs)require("fs").readFile(a,function(a,b){a?c(a):c(null,b.toString())});else{var d=cc.loader.getXMLHttpRequest(),e="load "+a+" failed!";d.open("POST",a,!0);if(cc.sys.platform==cc.sys.ANDROID||cc.sys.os==cc.sys.OS_IOS)d.onload=function(a){4===d.readyState&&(200===d.status||0===d.status?c(null,d.responseText):c({status:d.status,errorMessage:e},null))},d.onerror=function(a){c({status:d.status,errorMessage:e},null)},d.ontimeout=function(a){c({status:d.status,
errorMessage:"Request timeout: "+e},null)};else if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent))d.setRequestHeader("Accept-Charset","utf-8"),d.onreadystatechange=function(){4===d.readyState&&(200===d.status||0===d.status?c(null,d.responseText):c({status:d.status,errorMessage:e},null))};else{d.overrideMimeType&&d.overrideMimeType("text/plain; charset\x3dutf-8");var f=function(){d.removeEventListener("load",f);d.removeEventListener("error",h);0<=d._timeoutId?clearTimeout(d._timeoutId):
d.removeEventListener("timeout",k);4===d.readyState&&(200===d.status||0===d.status?c(null,d.responseText):c({status:d.status,errorMessage:e},null))},h=function(){d.removeEventListener("load",f);d.removeEventListener("error",h);0<=d._timeoutId?clearTimeout(d._timeoutId):d.removeEventListener("timeout",k);c({status:d.status,errorMessage:e},null)},k=function(){d.removeEventListener("load",f);d.removeEventListener("error",h);0<=d._timeoutId?clearTimeout(d._timeoutId):d.removeEventListener("timeout",k);
c({status:d.status,errorMessage:"Request timeout: "+e},null)};d.addEventListener("load",f);d.addEventListener("error",h);void 0===d.ontimeout?d._timeoutId=setTimeout(function(){k()},d.timeout):d.addEventListener("timeout",k)}cc.sys.platform==cc.sys.ANDROID?a=cc.loader.getPostParamPhone(b):cc.sys.os==cc.sys.OS_IOS?a=cc.loader.getPostParamPhone(b):(a=cc.loader.getPostParam(b),null==a&&(a=cc.loader.getPostParamPhone(b)));d.send(a)}};var LayoutR=ccui.Layout.extend({H_ALIGN_LEFT:0,H_ALIGN_CENTER:1,H_ALIGN_RIGHT:2,V_ALIGN_TOP:0,V_ALIGN_MIDDLE:1,V_ALIGN_BOTTOM:2,MAX_SUU_COLUMN:100,ctor:function(a,b){ccui.Layout.prototype.ctor.call(this);this.width=a;this.height=b;this.setLayoutType(ccui.Layout.ABSOLUTE);this.margin={left:0,top:0,right:0,bottom:0};this.suuRow=1;this.rowPadding=0},setMargin:function(a,b,c,d){this.margin={left:a,top:b,right:c,bottom:d}},setSuuRow:function(a,b){this.suuRow=a;this.rowPadding=b},addColumn:function(a,b,
c,d,e,f,h){void 0==d&&(d=0);void 0==e&&(e=0);void 0==f&&(f=this.H_ALIGN_LEFT);void 0==h&&(h=this.V_ALIGN_MIDDLE);this.addChild(a);var k=this.width-this.margin.left-this.margin.right,m=this.margin.left+k*c+d,n=0;if(0<e)n=k*e-d;else switch(f){case this.H_ALIGN_LEFT:n=k-this.margin.left-m;break;case this.H_ALIGN_RIGHT:n=m-this.margin.left;break;default:n=Math.min(c,1-c)*k*2}a.width>n&&a.setScaleX(n/a.width);switch(f){case this.H_ALIGN_LEFT:m+=a.width*a.getScaleX()/2;break;case this.H_ALIGN_RIGHT:m-=
a.width*a.getScaleX()/2+d}c=(this.height-this.margin.top-this.margin.bottom-(this.suuRow-1)*this.rowPadding)/this.suuRow;b=this.height-this.margin.top-(c+this.rowPadding)*b;switch(h){case this.V_ALIGN_TOP:b-=a.height*a.getScaleY()/2;break;case this.V_ALIGN_BOTTOM:b=b-c+a.height*a.getScaleY()/2;break;default:b-=c/2}a.setPosition(m,b)}});var LayerMsg=cc.Layer.extend({ctor:function(a,b,c){this._super();a||(a=cc.winSize.width);b||(b=cc.winSize.height);c?(this.wMsg=c,this.wBtn=a-c,this.xMsg=c/2,this.xBtn=c+this.wBtn/2):(this.wBtn=this.wMsg=a,this.xMsg=a/2,this.xBtn=a/2);this.hBtn=this.hMsg=0;this.isBtnSayuu=this.isBright=!1;this.suuSlider=this.suuMsg=this.suuBtn=this.yBtn=0;var d=this;c=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,onTouchBegan:function(a,b){d.funcTap&&(g.playSe("ok"),d.funcTap(),delete d.funcTap);
return!0},onTouchMoved:function(a,b){},onTouchEnded:function(a,b){},onTouchCancelled:function(a,b){}});c.setSwallowTouches(!0);cc.eventManager.addListener(c,this);c=new cc.Sprite(res.black);c.setScale(a/c.width,b/c.height);c.setPosition(a/2,b/2);c.setName("bg");this.addChild(c);c.opacity=0;this.fadein();MngLayerMsg.push(this);return!0},fadein:function(){if(!this.isBright){var a=this.getChildByName("bg"),b=cc.FadeTo.create(0.5,128),b=cc.EaseOut.create(b,3);a.runAction(b)}},fadeout:function(a){if(this.isBright)a&&
a();else{var b=this.getChildByName("bg"),c=cc.FadeOut.create(0.5),c=cc.EaseOut.create(c,3);a?(a=new cc.CallFunc(a,this),b.runAction(new cc.Sequence(c,a))):b.runAction(c)}},bright:function(){this.isBright=!0;this.getChildByName("bg").cleanup();return this},sayuu:function(){this.isBtnSayuu=!0;return this},setBtnY:function(a){this.yBtn=a;return this},close:function(a){this.menu&&this.menu.setEnabled(!1);MngLayerMsg.pop();var b=["bg"],c=[],d;for(d in b){var e=this.getChildByName(b[d]);e&&(e.retain(),
c.push(e))}this.removeAllChildren();for(d in c)if(e=c[d])this.addChild(e),e.release();var f=this;this.fadeout(function(){f.removeFromParent();a&&a()})},addTap:function(a){this.funcTap=a;return this},addClose:function(a,b){var c=this,d=g.getImgBtn(this,res.btn_close,res.btn_close_p,function(){b||c.close();a&&a()});d.setName("btnClose");d.setPosition(this.width-d.width,this.height-d.height);this.addChild(d);return this},addMsg:function(a,b,c,d,e){b||(b=g.fontNormal);c||(c=g.FONT_SZ_BIG);d||(d=cc.color("#ffffff"));
e||(e=cc.color("#0000ff"));var f=a.indexOf("@");if(0<=f){var h=a.substring(f+1);a=a.substring(0,f);f=new ccui.Text(h,b,c);e&&f.enableOutline(e,2);f.color=d;f.setName("msg"+this.suuMsg+"_2");this.addChild(f,9)}a=new ccui.Text(a,b,c);e&&a.enableOutline(e,2);a.color=d;a.width>this.width&&a.setScaleX(this.width/a.width);a.setName("msg"+this.suuMsg);this.hMsg+=a.height;this.addChild(a,9);this.suuMsg++;return this},addMsgs:function(a,b,c,d,e){for(var f in a)this.addMsg(a[f],b,c,d,e);return this},addLblOnBtn:function(a,
b,c,d){b=g.getLabel(b,c,d);b.setPosition(a.width/2,a.height/2);a.addChild(b)},addBtn:function(a,b,c,d){var e=new cc.Scale9Sprite(res.btn);e.width=g.W_MENU;e.height=g.H_BTN;this.addLblOnBtn(e,a,c?cc.color.GRAY:cc.color.WHITE,cc.color.BLACK);var f=new cc.Scale9Sprite(res.btn_p);f.width=g.W_MENU;f.height=g.H_BTN;this.addLblOnBtn(f,a,cc.color.WHITE,cc.color.BLACK);a=new cc.MenuItemSprite(e,f);var h=this;a.initWithCallback(function(a){d&&h.close();b(h,a);g.playSe("ok")});this.menu||(this.menu=new cc.Menu,
this.menu.setPosition(0,0),this.addChild(this.menu,9));a.setTag(this.suuBtn);this.menu.addChild(a);a.setName("btn"+this.suuBtn);c&&a.setEnabled(!1);this.isBtnSayuu?0==this.suuBtn%2&&(this.hBtn+=a.height):this.hBtn+a.height+this.hMsg>this.height?(this.isBtnSayuu=!0,this.hBtn=Math.floor((this.suuBtn+2)/2)*a.height):this.hBtn+=a.height;this.suuBtn++;return this},addInput:function(a,b,c,d){var e=new cc.Scale9Sprite(res.editBox),e=cc.EditBox.create(cc.size(this.width/2,80),e);e.setName("eb");e.setString(b);
e.placeholder=a;e.placeholderFontName=g.fontNormal;e.placeholderFontSize=d;e.placeholderFontColor=cc.color("#666666");e.fontName=g.fontNormal;e.fontSize=d;e.fontColor=cc.color.BLACK;e.setMaxLength(c);e.setPosition(this.width/2,this.height/2+e.height);this.isBtnSayuu=!0;this.addChild(e);return this},getInputText:function(){var a=this.getChildByName("eb");return a?a.getString().trim():""},addSlider:function(a,b,c,d){var e=ccui.Slider.create(res.slider_bar,res.slider_btn);e.setPercent(100*c/(b-a));e.addEventListener(function(c,
h){var k=e.getPercent();d((b-a)*k/100)});e.setScale9Enabled(!0);e.setCapInsets(cc.rect(0,0,0,0));e.setContentSize(this.width/2,e.height);e.setPosition(this.width/2,this.height/2);this.isBtnSayuu=!0;this.addChild(e);this.suuSlider++;return this},addLoading:function(){var a=this,b=ccui.LoadingBar.create(res.loading_bar,5);b.setName("loading");b.setScale9Enabled(!0);b.setCapInsets(cc.rect(0,0,0,0));b.setContentSize(a.width/2,b.height);b.setPosition(a.width/2,a.height/2);this.funcUpdate=function(){var c=
b.getPercent();if(100<=c)a.unscheduleAllCallbacks();else{var d=95-c,d=Math.min(Math.floor(Math.random()*d),3);b.setPercent(c+d)}};a.schedule(this.funcUpdate,0.05);this.isBtnSayuu=!0;this.addChild(b);return this},finishLoading:function(){this.unschedule(this.funcUpdate);var a=this.getChildByName("loading");a&&a.setPercent(100)},anmLbl:function(a,b){a.cleanup();a.opacity=0;var c=cc.delayTime(b),d=cc.fadeIn(0.5).easing(cc.easeOut(3)),c=cc.sequence(c,d);a.runAction(c)},anmBtn:function(a,b){a.cleanup();
var c=cc.delayTime(b);a.setScale(0,0);var d=cc.scaleTo(1,1).easing(cc.easeElasticOut(0.5)),c=cc.sequence(c,d);a.runAction(c)},positioning:function(){var a=0;if(this.wMsg==this.width){var b=this.hMsg+this.hBtn;if(0<b){for(var c=this.hMsg/b,d=(c*this.height-this.hMsg)/2,e=this.height-d,d=0;d<this.suuMsg;d++){var f=this.getChildByName("msg"+d),h=this.getChildByName("msg"+d+"_2");if(h){var k=new cc.Sprite(res.ic_menu);this.addChild(k);var m=(this.width-f.width-k.width-h.width)/2;f.setPosition(m+f.width/
2,e-f.height/2);m+=f.width;k.setPosition(m+k.width/2,e-f.height/2);m+=k.width;h.setPosition(m+h.width/2,e-h.height/2)}else f.setPosition(this.xMsg,e-f.height/2);this.anmLbl(f,a);a+=Math.min(0.1,0.1*f.getString().length);e-=f.height}a=0;if(0<this.suuBtn)if(d=this.hBtn/b,this.isBtnSayuu)for(b=this.width/6,1==this.suuBtn&&(b=0),e=d*this.height/Math.ceil(this.suuBtn/2),e=Math.min(e,200),d=(d*this.height-e*Math.ceil(this.suuBtn/2))/2,c=0<this.yBtn?this.yBtn:this.height-c*this.height-d,f=!0,d=0;d<this.suuBtn;d++)h=
this.menu.getChildByTag(d),h.setPosition(this.xBtn+(f?-b:b),c),this.anmBtn(h,a),a+=0.1,f||(c-=e),f=!f;else for(e=d*this.height/this.suuBtn,e=Math.min(e,200),d=(d*this.height-e*(this.suuBtn-1))/2,c=0<this.yBtn?this.yBtn:this.height-c*this.height-d,d=0;d<this.suuBtn;d++)h=this.menu.getChildByTag(d),h.setPosition(this.xBtn,c),this.anmBtn(h,a),a+=0.1,c-=e}}else{if(0<this.suuMsg)for(d=(this.height-this.hMsg)/2,e=this.height-d,d=0;d<this.suuMsg;d++)f=this.getChildByName("msg"+d),f.setPosition(this.xMsg,
e-f.height/2),this.anmLbl(f,a),a+=Math.min(0.1,0.1*f.getString().length),e-=f.height;a=0;if(0<this.suuBtn)if(this.isBtnSayuu)for(b=this.wBtn/4,1==this.suuBtn&&(b=0),e=this.height/Math.ceil(this.suuBtn/2),e=Math.min(e,200),c=0<this.yBtn?this.yBtn:this.height-e/2,c-=e/2,f=!0,d=0;d<this.suuBtn;d++)h=this.menu.getChildByTag(d),h.setPosition(this.xBtn+(f?-b:b),c),this.anmBtn(h,a),a+=0.1,f||(c-=e),f=!f;else for(e=this.height/this.suuBtn,e=Math.min(e,200),c=0<this.yBtn?this.yBtn:this.height-e/2,d=0;d<this.suuBtn;d++)h=
this.menu.getChildByTag(d),h.setPosition(this.xBtn,c),this.anmBtn(h,a),a+=0.1,c-=e}},repaint:function(){this.positioning()},start:function(a){this.repaint();a||(a=cc.director.getRunningScene());a.addChild(this)},confYesNo:function(a,b,c,d,e,f,h,k){a&&this.addMsg(a);d||(d=g.str("nmok"));b||(b=function(a,b){a.close()});this.addBtn(d,b,!1,f);e||(e=g.str("iie"));c||(c=function(a,b){a.close()});this.addBtn(e,c,!1,h);k&&this.addClose();a=cc.director.getRunningScene();this.start(a)}}),MngLayerMsg={objs:[],
getLast:function(){for(var a=this.objs.length-1;0<=a;a--){var b=this.objs[a];if(b.parent&&b.isVisible())return b;this.objs.pop()}return null},push:function(a){var b=this.getLast();b&&b.setVisible(!1);a.retain();this.objs.push(a)},pop:function(){var a=this.objs.pop();if(0>=this.objs.length)return a;this.objs[this.objs.length-1].setVisible(!0);a.release();return a},clearAll:function(){for(;0<this.objs.length;)this.pop().removeFromParent()}};var Msg=ccui.ScrollView.extend({ctor:function(a,b,c,d,e,f,h,k){this._super();this.setDirection(ccui.ScrollView.DIR_VERTICAL);this.setContentSize(c,d);this.setInnerContainerSize(cc.size(c,999));this.lbl=a=new MsgLabel(a,c,d,e,f,h,k);a.setPosition(8,this.getInnerContainerSize().height);this.addChild(a);this.nyScr=0;this.func=b;this.setEnabled(!1)},startLbl:function(){var a=this.lbl,b=this;a.setCbRepage(function(a){b.nyScr=a;b.startWait()});a.setCbComp(function(){b.nyScr=-1;b.startWait()});var c=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan:function(a,b){return!0},onTouchMoved:function(a,b){},onTouchEnded:function(a,e){if(0>b.nyScr)cc.eventManager.removeListener(c),b.stopWait(),b.func();else if(0<b.nyScr){b.stopWait();var f=(b.nyScr-8)/(b.getInnerContainerSize().height-b.height);b.scrollToPercentVertical(100*f,0.5,!0);b.nyScr=0;b.lbl.repage()}else b.lbl.skip()},onTouchCancelled:function(a,b){}});c.setSwallowTouches(!0);cc.eventManager.addListener(c,a);this.setScrollBarEnabled(!1);this.addEventListener(function(a,c){c!=ccui.ScrollView.EVENT_AUTOSCROLL_ENDED&&
12!=c||b.lbl.clean()},this);this.lbl.start()},startWait:function(){var a=this.parent;if(a){this.stopWait();var b=new cc.Sprite(res.ic_tap);b.setName("ic");b.setPosition(a.width-b.width/2,b.height/2);b.runAction(cc.repeatForever(cc.rotateBy(0.5,-180)));a.addChild(b)}},stopWait:function(){g.removeByNm("ic",this.parent)}});var MsgLabel=cc.LayerColor.extend({CHOUSEI:4,ctor:function(a,b,c,d,e,f,h){this._super();this.setContentSize(b,c);this.txt=a;this.str="";this.col=d;this.colWaku=e;this.colShadow=f;this.szfnt=h;this.svSpd=this.spd=0.02*SP.getSpdMsg();this.noPg=this.suuRow=0;this.getLbl(c).setPosition(0,-this.CHOUSEI);this.rowNow=1},start:function(){var a=this;0<this.spd?(this.runAction(cc.repeatForever(cc.sequence(cc.delayTime(this.spd),cc.callFunc(function(){a.update1()})))),this.updateNext()):this.update1()},getLbl:function(a){var b=
new cc.LabelTTF(" ",g.fontNormal,this.szfnt,cc.size(0,0));this.colWaku&&b.enableStroke(this.colWaku,cc.sys.os==cc.sys.OS_ANDROID||cc.sys.os==cc.sys.OS_IOS?4:2);this.colShadow&&b.enableShadow(this.colShadow,cc.size(2,-2),2);this.col&&b.setColor(this.col);b.setAnchorPoint(0,1);a&&(this.rowOfPg=Math.floor(a/b.height));b.setString("");this.addChild(b,0,this.suuRow);this.suuRow++;return this.lbl=b},setCbComp:function(a){this.cbComp=a},setCbRepage:function(a){this.cbRepage=a},repage:function(){this.noPg++;
this.rowNow=1;this.spd=this.svSpd;this.updateNext()},clean:function(){for(var a=(this.noPg-1)*this.rowOfPg,b=0;b<this.rowOfPg;b++){var c=this.getChildByTag(a++);c&&c.removeFromParent()}},skip:function(){this.spd=0},getNext:function(){if(0>=this.txt.length)return null;var a=this.txt.substr(0,1);this.txt=this.txt.substring(1);return a},showNext:function(){var a=this.getNext();if(null==a)return this.haneiLabel(),this.cbComp&&this.cbComp(),!1;var b=this.getCmnd(a);if(null!=b){switch(b.id){case "C":switch(b.val){case "red":this.colText=
cc.color("#ff0000");break;case "green":this.colText=cc.color("#00ff00")}break;case "W":0==this.spd&&this.haneiLabel();var c=this;this.scheduleOnce(function(){c.waiting=!1;0==c.spd&&c.showNext()},b.val/1E3,"wait");return!1;case "R":a=new cc.Sprite(res[b.val]);this.lbl.addChild(a);a.setAnchorPoint(0.5,0.5);a.setScale(this.lbl.fontSize/a.width);a.setPosition((this.getString().length+0.5)*this.lbl.fontSize,this.lbl.fontSize/1.5);this.setString(this.getString()+"\u3000");break;default:cc.log("MsgLabel#showNext cmnd ERROR!"),
cc.log(b)}return this.showNext()}var b=this.lbl,d=this.getString();this.setString(d+a);if("\n"==a&&(this.rowNow++,this.setString(d),this.haneiLabel(),this.str="",a=this.getLbl(),a.setPosition(b.x,b.y-b.height),this.rowNow>this.rowOfPg))return this.cbRepage&&this.cbRepage(-a.y+this.CHOUSEI),!1;this.colText&&(b.setFontFillColor(this.colText),delete this.colText);if(0==this.spd)return this.showNext();this.haneiLabel();return!0},updateNext:function(){0==this.spd&&(this.waiting=!0,this.showNext());this.waiting=
!1},update1:function(){this.waiting||this.showNext()||(this.waiting=!0)},setString:function(a){this.str=a},getString:function(){return this.str},haneiLabel:function(){if(""!=this.str){this.lbl.setString(this.str);var a=this.width-8;this.lbl.width>a&&this.lbl.setScaleX(a/this.lbl.width)}},getCmnd:function(a){if("\\"!=a)return null;a={};a.id=this.getNext();if(0<this.txt.length&&"["==this.txt.substr(0,1)){var b=this.txt.indexOf("]",2);0<=b&&(a.val=this.txt.substring(1,b));this.txt=this.txt.substring(b+
1)}return a}});var LayerMenu=cc.Layer.extend({suuMenuItem:0,ctor:function(a,b){this._super();this.isKaihei=a;b||(b=g.W_MENU);var c;c=new cc.LayerColor(cc.color("#000000"),b,100);c.setOpacity(128);c.setName("bg");this.addChild(c);this.setContentSize(c.getContentSize());this.menu=new cc.Menu;this.menu.setPosition(0,0);c.addChild(this.menu)},onEnter:function(){this._super()},clearMenuItems:function(){for(var a=0;a<this.suuMenuItem;a++){var b=this.menu.getChildByTag(a);b&&b.setEnabled(!1)}},getBaseAnm:function(){return this},
stopMenu:function(){this.clearMenuItems();this.stopBtnMenuOpen();this.stopBtnMenuClose();var a=this,b=this.getBaseAnm();b.runAction(cc.sequence(cc.moveBy(0.2,b.width,-b.height),cc.callFunc(function(){a.removeFromParent()})))},animMenu:function(){var a=this.getBaseAnm(),b=cc.winSize,c=b.width-a.width;a.setPosition(b.width,-a.height);if(this.isKaihei&&!SP.getMenuOpen())this.startBtnMenuOpen();else{var d=this;a.runAction(cc.sequence(cc.moveTo(0.2,c,0).easing(cc.easeSineOut()),cc.callFunc(function(){d.startBtnMenuClose()})))}},
startBtnMenuOpen:function(){if(this.isKaihei){var a;a=8;var b=this,c=g.getImgBtn(this,res.btn_menu,res.btn_menu_p,function(){SP.setMenuOpen(!0);b.animMenu();b.stopBtnMenuOpen()});c.setPosition(cc.winSize.width-c.width/2-a,c.height/2+a);c.setName("btnMenuOpen");this.getParent().addChild(c)}},startBtnMenuClose:function(){if(this.isKaihei){var a;a=8;var b=this,c=this.getBaseAnm(),d=g.getImgBtn(this,res.ic_arrow,null,function(){SP.setMenuOpen(!1);c.runAction(cc.sequence(cc.moveBy(0.2,b.width,-b.height),
cc.callFunc(function(){b.startBtnMenuOpen()})));b.stopBtnMenuClose()});d.setPosition(cc.winSize.width-this.width-d.width/2,d.height/2+a);d.setName("btnMenuClose");this.getParent().addChild(d)}},stopBtnMenuOpen:function(){this.isKaihei&&g.removeByNm("btnMenuOpen",this.getParent())},stopBtnMenuClose:function(){this.isKaihei&&g.removeByNm("btnMenuClose",this.getParent())},addMenuItem:function(a,b,c,d){if(a){var e=this,f=this.width/2,h=4+(g.H_BTN+4)*this.suuMenuItem+g.H_BTN/2,k=this.width-8,m=new cc.Scale9Sprite(res.btn);
m.width=k;m.height=g.H_BTN;this.addLblOnBtn(m,a,cc.color.WHITE,cc.color.BLACK);var n=new cc.Scale9Sprite(res.btn_p);n.width=k;n.height=g.H_BTN;this.addLblOnBtn(n,a,cc.color.WHITE,cc.color.BLACK);k=new cc.MenuItemSprite(m,n);k.initWithCallback(function(a){e.tagSelectedBtn=b;g.playSe("ok");c&&c()});k.setPosition(f,h);this.menu.addChild(k);d&&k.runAction(cc.repeatForever(cc.sequence(cc.tintTo(0.9,255,255,0),cc.tintTo(0.9,255,255,255))));k.setTag(this.suuMenuItem)}this.suuMenuItem++;this.getChildByName("bg").setContentSize(this.width,
4+(g.H_BTN+4)*this.suuMenuItem);return k},addLblOnBtn:function(a,b,c,d){b=g.getLabel(b,c,d);b.setPosition(a.width/2,a.height/2);a.addChild(b)}});var SP={VER_SV:108,get:function(a,b){var c=cc.sys.localStorage.getItem(a);if(null==c||void 0==c)c=b;return c},getNum:function(a,b){return Number(this.get(a,b))},getBool:function(a,b){var c=this.getNum(a,-1);return 0>c?b:0!=c},set:function(a,b){cc.sys.localStorage.setItem(a,b)},setBool:function(a,b){this.set(a,b?1:0)},flgs2str:function(a){for(var b="",c=a.length,d=0;d<c;d++)b+=a[d]?"1":"0";return b},str2flgs:function(a){for(var b=[],c=a.length,d=0;d<c;d++)b.push("1"==a.substr(d,1));return b},aryStr:function(a,
b){b||(b="|");for(var c="",d=a.length,e=0;e<d;e++){var f=Number(a[e]);isNaN(f)&&(f=-1);0<e&&(c+=b);c+=f}return c},strAry:function(a,b){b||(b="|");for(var c=a.split(b),d=c.length,e=0;e<d;e++)c[e]=parseInt(c[e],10),isNaN(c[e])&&(c[e]=-1);return c},isSound:function(){return 0==this.getNum("mute",0)},setSound:function(a){this.set("mute",a?0:1)},DEFO_VOL_BGM:0.5,getVolBgm:function(){return this.getNum("volBgm",SP.DEFO_VOL_BGM)},setVolBgm:function(a){this.set("volBgm",a)},DEFO_VOL_SE:0.5,getVolSe:function(){return this.getNum("volSe",
SP.DEFO_VOL_SE)},setVolSe:function(a){this.set("volSe",a)},DEFO_SPD_BTL:1,getSpdBtl:function(){return this.getNum("spdBtl",SP.DEFO_SPD_BTL)},setSpdBtl:function(a){this.set("spdBtl",a)},DEFO_MSG_START:!0,isMsgStart:function(){return 0==this.getNum("msgStart",0)},setMsgStart:function(a){this.set("msgStart",a?0:1)},DEFO_MSG_TURN:!0,isMsgTurn:function(){return 0==this.getNum("msgTurn",0)},setMsgTurn:function(a){this.set("msgTurn",a?0:1)},DEFO_SHOW_LVUP:2,getShowLvup:function(){return this.getNum("ShowLvup",
SP.DEFO_SHOW_LVUP)},setShowLvup:function(a){this.set("ShowLvup",a)},DEFO_SPD_MSG:1,getSpdMsg:function(){return this.getNum("spdMsg",SP.DEFO_SPD_MSG)},setSpdMsg:function(a){this.set("spdMsg",a)},DEFO_TYPE_AUTO:0,getTypeAuto:function(){return this.getNum("autoBuki",SP.DEFO_TYPE_AUTO)},setTypeAuto:function(a){this.set("autoBuki",a)},DEFO_TYPE_PAUSE:1,getTypePause:function(){return this.getNum("pause",SP.DEFO_TYPE_PAUSE)},setTypePause:function(a){this.set("pause",a)},getMiniMap:function(){return 1==this.getNum("minimap",
1)},setMiniMap:function(a){this.set("minimap",a?1:0)},getMenuOpen:function(){return 1==this.getNum("menu",1)},setMenuOpen:function(a){this.set("menu",a?1:0)},getSortItm:function(){return this.getNum("SortItm",1)},setSortItm:function(a){this.set("SortItm",a)},sumiTuto:function(a){return 1==this.getNum("tuto"+a,0)},setSumiTuto:function(a,b){this.set("tuto"+a,b?1:0)},isSumiHyouka:function(){return this.getBool("sumiHyouka",!1)},setSumiHyouka:function(a){this.setBool("sumiHyouka",a)},isFullAuto:function(){return this.getBool("fullauto",
!1)},setFullAuto:function(a){this.setBool("fullauto",a)},addValLimit:function(a,b,c){var d=SP.getData().vals[a];if(void 0==d||0>d)d=0;d=g.addLimit(d,b,c);SP.getData().vals[a]=d},ENE_TBT:[2,16,7,18,8,9,19,17,12,15,26,32,27,28,31,30,29,24,22,25,23,21,20,10,11,0,1,3,4,5,6,14],getDefeat:function(a){a=SP.ENE_TBT.indexOf(a);return 0>a?(cc.log("SP#getDefeat ENE_TBT ERROR!!!"),-2):this.getDefeatByIx(a)},getDefeatByIx:function(a){a=SP.getData().vals[10+a];isNaN(a)&&(a=-1);return a},incDefeat:function(a){var b=
SP.ENE_TBT.indexOf(a);0>b||(a=SP.getDefeat(a),0>a&&(a=0),a=g.addLimit(a,1),SP.getData().vals[10+b]=a)},hakkenItm:function(a){var b=SP.getData().itms[a];if(isNaN(b)||0>b)SP.getData().itms[a]=0},SUU_SV:3,getLastNo:function(){var a=this.getNum("noLast",-1);if(0>a)for(var b=0;b<SP.SUU_SV;b++)if(0<SP.getInf(b).dtSv){SP.setLastNo(b);a=b;break}return a},setLastNo:function(a){this.set("noLast",a)},getInf:function(a){void 0==a&&(a=this.no);return{dtSv:this.getNum("dtSv"+a,0)}},removeData:function(a){cc.sys.localStorage.removeItem("data"+
a)},DEFO_DATA:{nm:null,pw:null,dtStart:0,dtSv:0,ver:0,verStart:-1,mode:0,posNow:0,posLast:0,vals:[],flgs:[],sumiPoss:[],sumiSubs:[],encs:[],chrs:[],rests:[],leader:0,itms:[],turn:-1,exps:0,teams:[],btls:[]},data:null,no:-1,getData:function(){null==this.data&&(this.data=JSON.parse(JSON.stringify(this.DEFO_DATA)));return this.data},loadData:function(a){void 0==a?a=this.no:this.no=a;var b=null;a=this.get("data"+a,null);null!=a&&(a=LZString.decompressFromUTF16(a),b=this.getDataFromStr(a));if(null==b){this.data=
JSON.parse(JSON.stringify(this.DEFO_DATA));this.data.dtStart=Math.floor((new Date).getTime()/1E3);this.data.pw=g.makePswd(10);b=dt.stginf.length;for(a=0;a<b;a++){var c=dt.stginf[a].no;0<=c&&(this.data.encs[c]=c!=this.data.posNow)}this.data.encs[2]=!1}else this.data=b},setDataFromNet:function(a,b,c){b=LZString.decompressFromEncodedURIComponent(b);if(null==this.getDataFromStr(b))return!1;b=LZString.compressToUTF16(b);this.set("data"+a,b);0<c&&(SP.getData().dtSv=c);this.setLastNo(a);0==a&&(SP.setSumiTuto(0,
!0),SP.setSumiTuto(1,!0));return!0},getDataFromStr:function(a){a=a.split(",");var b,c,d,e=JSON.parse(JSON.stringify(this.DEFO_DATA)),f=0;e.nm=a[f++];"SP#getData"==a[f]?(e.pw=g.makePswd(10),f++):e.pw=a[f++];e.dtStart=Number(a[f++]);e.dtSv=Number(a[f++]);e.dtSv||(e.dtSv=this.getInf().dtSv);e.ver=Number(a[f++]);var h=e.ver;if(101>h)return null;e.verStart=107<=h?Number(a[f++]):0;108<=h&&(e.mode=Number(a[f++]));e.posNow=Number(a[f++]);0==e.posNow&&(e.posNow=2);106<=h&&(e.posLast=Number(a[f++]));e.vals=
this.strAry(a[f++]);e.flgs=this.str2flgs(a[f++]);e.sumiPoss=this.str2flgs(a[f++]);e.sumiSubs=this.str2flgs(a[f++]);e.encs=this.str2flgs(a[f++]);var k=[];b=Number(a[f++]);for(c=0;c<b;c++){var m=a[f++].split("|"),n=parseInt(m[0],10),p=this.strAry(m[4],"_");if(103>h)for(d=0;d<p.length;d++)main.isJobEquippable(n,p[d])||(k.push(p[d]),p[d]=-1);e.chrs.push(new Chara(n,m[1],parseInt(m[2],10),parseInt(m[3],10),p,108<=h?parseInt(m[5],10):-1));e.rests[c]=!1}102<=h&&(e.rests=this.str2flgs(a[f++]),e.leader=Number(a[f++]));
e.itms=this.strAry(a[f++]);for(d=0;d<k.length;d++)e.itms[k[d]]++;e.noStg=a[f++];104>h&&0>Number(e.noStg)&&(e.noStg="");if(""!=e.noStg){e.noStg=Number(e.noStg);e.turn=Number(a[f++]);e.phase=Number(a[f++]);e.exps=Number(a[f++]);b=Number(a[f++]);e.teams=[];for(c=0;c<b;c++)d=this.strAry(a[f++],"|"),h={},h.isLose=1==Number(d[0]),e.teams[c]=h;e.btls=[];for(c=0;c<b;c++)for(k=Number(a[f++]),e.btls[c]=[],d=0;d<k;d++)m=this.strAry(a[f++],"|"),h={},n=0,h.no=Number(m[n++]),h.x=Number(m[n++]),h.y=Number(m[n++]),
h.hp=Number(m[n++]),h.sumi=1==Number(m[n++]),h.lv=Number(m[n++]),h.exp=Number(m[n++]),e.btls[c][d]=h}return e},saveData:function(a,b){void 0==a&&(a=this.no);void 0==b&&(b="");var c=this.getData(),c=this.getStrFromData(c,b),c=LZString.compressToUTF16(c);this.set("data"+a,c);this.setLastNo(a)},getNetsvData:function(a){a=this.get("data"+a,null);if(null==a)return null;a=LZString.decompressFromUTF16(a);var b=this.getDataFromStr(a);if(null==b)return null;a=LZString.compressToEncodedURIComponent(a);return{id:b.pw+
b.dtStart,val:a}},getStrFromData:function(a,b){var c,d,e=a.nm,e=e+(","+a.pw),e=e+(","+a.dtStart);a.dtSv=Math.floor((new Date).getTime()/1E3);e+=","+a.dtSv;a.ver=this.VER_SV;e+=","+a.ver;0>a.verStart&&(a.verStart=this.VER_SV);e+=","+a.verStart;e+=","+a.mode;e+=","+a.posNow;0<a.posNow&&(a.posLast=a.posNow);e+=","+a.posLast;e+=","+this.aryStr(a.vals);e+=","+this.flgs2str(a.flgs);e+=","+this.flgs2str(a.sumiPoss);e+=","+this.flgs2str(a.sumiSubs);e+=","+this.flgs2str(a.encs);c=a.chrs.length;e+=","+c;for(d=
0;d<c;d++)var f=a.chrs[d],h=""+f.job,h=h+("|"+f.nm),h=h+("|"+f.lv),h=h+("|"+f.exp),k=this.aryStr(f.itms,"_"),h=h+("|"+k),h=h+("|"+f.hp),e=e+(","+h);e+=","+this.flgs2str(a.rests);e+=","+a.leader;e+=","+this.aryStr(a.itms);e+=","+b;if(""!=b){e+=","+main.btl.turn;e+=","+main.btl.phase;e+=","+main.btl.getPlayerTeam().exps;f=main.getSuuTeam();e+=","+f;for(d=0;d<f;d++)h=main.getTeam(d),e+=","+(h.isLose()?1:0);for(d=0;d<f;d++){var h=main.getTeam(d),k=h.getSuuMember(),m=h.dies.length,e=e+(","+(k+m));for(c=
0;c<k;c++)var n=h.getMember(c),e=e+(","+n.no),e=e+("|"+n.x),e=e+("|"+n.y),e=e+("|"+n.hp),e=e+("|"+(n.isEnd()?1:0)),e=e+("|"+n.chr.lv),e=e+("|"+n.chr.exp);for(c=0;c<m;c++)n=h.dies[c],e+=","+n.no,e+="|"+n.x,e+="|"+n.y,e+="|0",e+="|1",e+="|"+n.chr.lv,e+="|"+n.chr.exp}}return e},updateEncs:function(){var a=this.getData();0<=a.posNow&&(a.encs[a.posNow]=!1);!a.sumiPoss[2]&&2<a.posNow&&(a.encs[2]=!0);var b=dt.stginf.length;if(a.flgs[24])if(11==a.posNow)for(c=0;c<b;c++)d=dt.stginf[c].no,0<=d&&d!=a.posNow&&
(a.encs[d]=!0);else{for(c=0;c<b;c++)if(d=dt.stginf[c].no,3<=d&&a.encs[d])return!1;return a.encs[11]=!0}else for(var c=0;c<b;c++){var d=dt.stginf[c].no;if(0<=d&&d!=a.posNow)for(var e=dt.stginf[c].zans,f=0;f<e.length;f++){var h=e[f];if(0<h&&!a.flgs[h]){a.encs[d]=!0;break}}}return!1}};var Data=cc.Class.extend({ctor:function(){cc.log("Data")}});var LIMIT=21E8,CHR_AUTO_STAY=1,CHR_AUTO2=2,CHR_AUTO=3,CHR_ESCAPE=4,CHR_MANUAL=CHR_AUTO,CHR_TYPES=["","stay","auto2","auto","esc"],Game={getStgOfNo:function(a){-12345==a&&(a=-1);return dt.stginf[a]},isYorimichi:function(a){return 0>a},getCnctsOfNo:function(a){if(16==a){a=[];for(var b=dt.stginf.length,c=0;c<b;c++)this.isYorimichi(c)||16!=c&&a.push(c);return a}c=this.getStgOfNo(a);if(null==c)return null;a=c.cncts.slice();if(this.isRock(c))return null;for(var b=!1,d=a.length-1;0<=d;d--)0>a[d]?b&&a.splice(d,
1):(b=!1,c=this.getStgOfNo(a[d]),this.isRock(c)&&(a.splice(d,1),b=!0));b=[];for(c=0;c<b.length;c++)d=a.indexOf(b[c]),0<=d&&a.splice(d,1);return a},isRock:function(a){if(!a)return!1;a=a.flgs;for(var b=0;b<a.length;b++){var c=a[b];if(0<c&&!SP.getData().flgs[c])return!0}return!1},isDev:function(a){return a?""==a.id:!0},isEnc:function(a){return!a||0>a.no?!0:SP.getData().encs[a.no]},isSumi:function(a){if(!a)return!1;a=a.no;return 0<=a?SP.getData().sumiPoss[a]:SP.getData().sumiSubs[-a]},getIkeruPoss:function(a){var b=
[];if(0<=a){var c=this.getCnctsOfNo(a);if(null!=c)for(var d=0;d<c.length;d++)0<=c[d]&&b.push(c[d])}else for(var e=dt.stginf.length,d=0;d<e;d++)for(var c=dt.stginf[d].cncts,f=!1,h=0;h<c.length;h++){var k=c[h];k==a&&(f=!0);if(f&&0<=k){b.push(dt.stginf[d].no);b.push(k);d=e;break}}return b},getIkeruSubs:function(a){var b=[];if(0<=a&&(a=this.getCnctsOfNo(a),null!=a))for(var c=0;c<a.length;c++)0>a[c]&&b.push(-a[c]);return b},getSubs:function(a,b){var c=this.getCnctsOfNo(a),d=[];if(null!=c)for(var e=0;e<
c.length;e++){var f=c[e];if(f==b)break;0>f?d.push(-f):d=[]}return d},getSuuClrStg:function(){for(var a=SP.getData().sumiPoss,b=0,c=0;c<a.length;c++)a[c]&&b++;return b},getSuuStg:function(){for(var a=dt.stginf,b=0,c=0;c<a.length;c++)0<=a[c].no&&""!=a[c].nm&&b++;return b},getSuuClrSub:function(){for(var a=SP.getData().sumiSubs,b=0,c=0;c<a.length;c++)a[c]&&b++;return b},getSuuSub:function(){var a=dt.stginf,b=0,c;for(c in a)0>a[c].no&&b++;return b},getTurnWin:function(a){return 0<=dt.stginf[a].win.indexOf(9)?
dt.stginf[a].turn:0},getTurnLose:function(a){return 0<=dt.stginf[a].lose.indexOf(9)?dt.stginf[a].turn:0},getInfWin:function(a,b,c,d,e){var f=(cc.winSize.width-cc.winSize.height)/2,h=cc.winSize.height-f/1.5;a*=2;b*=2;e=Math.floor(Math.min((f-2*a)/c,(h/e-2*a)/d-b));c*=e;return{merginH:a,merginV:b,sizeFont:e,wInner:c,wWin:c+2*a,hWin:(e+b)*d-b+2*a}},getNmTeam:function(){var a=SP.getData().nm;if(null==a||"null"==a)a=g.str("pnm");return a},getTm:function(a){var b=SP.getSpdBtl();return 1==b?a:a*b},getGage:function(a,
b,c){var d=new cc.Scale9Sprite(res.gage);d.setAnchorPoint(0,0);d.setScale(b/d.width,c/d.height);a=new cc.Scale9Sprite(res["gage"+a]);a.setAnchorPoint(0,0);a.setName("zan");d.addChild(a);return d},repaintGage:function(a,b,c,d){b/=c;Math.ceil(a.width*b);a=a.getChildByName("zan");d?a.runAction(cc.scaleTo(Game.getTm(d/1E3),b,1)):a.setScale(b,1)},getItmIconAndEx:function(a){var b=0==a.asrt.indexOf("other"),c;c=b?"itm_sts":"itm_"+a.asrt;var d=null;b&&(b={},b[g.NO_ITM_HALF_MGC]=[g.str("itmkk0"),""],b[g.NO_ITM_RESIST_FIRE]=
[g.str("itmkk1"),""],d=b[a.no]);return{icon:c,exs:d}},newGame:function(a,b){var c=(new LayerMsg).sayuu().addMsgs([g.str("gmmdsntk"),"\nEASY "+g.str("exgmmd0")+"\nNORMAL "+g.str("exgmmd1")]).addBtn("EASY",function(){c.close();Game.goFirst()}).addBtn("NORMAL",function(){(new LayerMsg).confYesNo(g.str("cnfgmmd1"),function(){c.close();SP.getData().mode=1;Game.goFirst()},function(){},"OK",g.str("mdr"),!0,!0)});b&&c.addClose(function(){b()});c.start(a)},goFirst:function(){cc.spriteFrameCache.removeSpriteFrames();
cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneGame(1)))}},Main=function(){};Main.prototype.umekomi=function(a){return g.umekomi(a,function(a,c){switch(a){case "N":return 99==c&&(c=main.btl.getPlayerTeam().getMemberOfMaxLv().no),SP.getData().chrs[c].nm;case "I":return main.nmItm(c);case "M":return main.nmStg(c);case "V":return""+main.getVal(c);default:return null}})};Main.prototype.addVal=function(a,b){var c=this.getVal(a);SP.getData().vals[a]=g.addLimit(c,b)};
Main.prototype.getVal=function(a){a=SP.getData().vals[a];if(!a||0>a)a=0;return a};Main.prototype.hakkenItms=function(a){a=SP.getData().chrs[a].itms;for(var b=0;b<a.length;b++)SP.hakkenItm(a[b])};Main.prototype.getHpType=function(a,b){var c=a.getSts(STS_MHP),d;d=b?b.hp:0<SP.getData().mode?a.hp:c;var e=0;d<=c/2?e=2:d<c&&(e=1);var f,h;switch(e){case 1:f=cc.color("#cccccc");break;case 2:f=cc.color("#ff0000");h=cc.color("#000000");break;default:f=cc.color("#ffffff")}return{hp:d,mhp:c,type:e,col:f,colFuchi:h}};
Main.prototype.init=function(){var a=SP.getData();0==a.chrs.length&&(a.chrs[0]=new Chara(0,g.str("nm0"),1,0,[0,8]),a.chrs[1]=new Chara(1,g.str("nm1"),1,0,[4,5]),a.chrs[2]=new Chara(3,g.str("nm2"),1,0,[2]),a.chrs[3]=new Chara(4,g.str("nm3"),1,0,[3,7]),a.chrs[4]=new Chara(5,g.str("nm4"),1,0,[10,3,11]),a.chrs[5]=new Chara(6,g.str("nm5"),1,0,[1]),a.chrs[6]=new Chara(10,g.str("nm6"),13,0,[4,22,33]),a.chrs[7]=new Chara(11,g.str("nm7"),13,0,[20,8,32]),a.chrs[8]=new Chara(20,g.str("nm8"),2,0,[3]),a.chrs[9]=
new Chara(14,g.str("nm9"),5,0,[17,28]),this.hakkenItms(0),this.hakkenItms(1),this.hakkenItms(2),this.hakkenItms(3),this.hakkenItms(5),cc.log("Main itms"),cc.log(SP.getData().itms))};Main.prototype.getSuuPlayersItm=function(){for(var a=dt.itms.length,b=0,c=0;c<a;c++)this.isItmEquip(dt.itms[c].no)&&b++;return b};
Main.prototype.getItms=function(a,b){var c=SP.getData(),d=[];if(b){for(var e=dt.itms.length,f=0;f<e;f++){var h=dt.itms[f];d[h.no]={no:h.no,suu:-1}}for(f=0;f<c.itms.length;f++)void 0==c.itms[f]||0>c.itms[f]||(d[f]={no:f,suu:c.itms[f]})}else for(f=0;f<c.itms.length;f++)void 0==c.itms[f]||0>c.itms[f]||d.push({no:f,suu:c.itms[f]});return d=this.sortItms(d,a)};
Main.prototype.sortItms=function(a,b){var c=function(a,b){var c="ken yari ono yumi sude tume book book2 tsue tsue2 sts other0 other1 mon mon2".split(" "),h=dt.itms[a].asrt,k=dt.itms[b].asrt;if(h==k)return dt.itms[a].no-dt.itms[b].no;h=c.indexOf(h);c=c.indexOf(k);return h-c};switch(b){case 0:a.sort(function(a,b){return c(a.no,b.no)});break;case 1:a.sort(function(a,b){var f=SP.getData().itms[a.no],h=SP.getData().itms[b.no];void 0==f&&(f=0);void 0==h&&(h=0);return f==h?c(a.no,b.no):h-f})}return a};
Main.prototype.isItmEquip=function(a,b){var c=dt.itms[a];if(!c||b&&!main.isJobEquippable(b.job,a))return!1;var d=["mon","mon2","sude"];if(0<=d.indexOf(c.asrt))return!1;d=[14,16,53];return 0<=d.indexOf(c.no)?!1:!0};Main.prototype.isItmToEnemy=function(a){return 0<="ken yari yumi tume sude ono book mon mon2".split(" ").indexOf(dt.itms[a].asrt)};Main.prototype.isItmToPal=function(a){a=dt.itms[a].asrt;return"tsue"==a||"tsue2"==a};Main.prototype.isItmHazuseru=function(a){return 0>["sude","mon","mon2"].indexOf(dt.itms[a].asrt)};
Main.prototype.isItmSumi=function(a){var b=SP.getData().itms;return void 0!=b[a]&&0<=b[a]};Main.prototype.getSuuItmSumi=function(){for(var a=SP.getData().itms,b=0,c=0;c<a.length;c++)main.isItmEquip(c)&&void 0!=a[c]&&0<=a[c]&&b++;return b};var C_ITM_SBT_ATK=0,C_ITM_SBT_MATK=1,C_ITM_SBT_CARE=2,C_ITM_SBT_STS=5;Main.prototype.getItmSbt=function(a){a=dt.itms[a].asrt;return"tsue"==a||"tsue2"==a?C_ITM_SBT_CARE:"sts"==a?C_ITM_SBT_STS:0<=["book","mon2"].indexOf(a)?C_ITM_SBT_MATK:C_ITM_SBT_ATK};
Main.prototype.isPaled=function(a){var b=SP.getData().flgs;return 4==a&&!b[3]||6==a&&!b[6]||7==a&&!b[7]||8==a&&!b[1]||9==a&&!b[8]?!1:!0};Main.prototype.sortChrs=function(a,b){switch(b){default:var c=[0,1,2,3,5,4,7,8,6,9];a.sort(function(a,b){return c[a.no]<c[b.no]?-1:1})}};Main.prototype.getChrs=function(a,b,c){b=SP.getData();for(var d=[],e=0;e<b.chrs.length;e++)(this.isPaled(e)||c)&&b.chrs[e]&&d.push({no:e,chr:b.chrs[e],type:CHR_MANUAL,leader:e==b.leader,rest:b.rests[e]});a&&this.sortChrs(d,0);return d};
Main.prototype.getChrsByBattlers=function(a,b){this.sortChrs(a,b);return a};Main.prototype.getItemOfChr=function(a,b){return SP.getData().chrs[a].getItem(b)};Main.prototype.setItemToChr=function(a,b,c){SP.getData().chrs[a].setItem(b,c)};Main.prototype.isEquippable=function(a,b){var c=SP.getData().chrs[a];return this.isJobEquippable(c.job,b)};Main.prototype.isJobEquippable=function(a,b){if(0>b)return!1;var c=dt.itms[b].asrt;return 11==a&&"yumi"==c&&SP.getData().flgs[43]?!0:0<=dt.jobs[a].equip.indexOf(c)};
Main.prototype.mojiLang=function(){var a=g.getLang();return"ja"==a?"":"_"+a};Main.prototype.nmJob=function(a){return dt.jobs[a]["nm"+this.mojiLang()]};Main.prototype.nmItm=function(a){return dt.itms[a]["nm"+this.mojiLang()]};Main.prototype.nmStg=function(a){return dt.stginf[a]["nm"+this.mojiLang()]};Main.prototype.getNmTeam=function(a){switch(g.getLang()){case "ja":return a.nm;default:return 1==a.no%2?"Red":"Green"}};
Main.prototype.initBtl=function(a,b,c,d){this.btl=new Battle;this.map=b;var e=this.getChrs();b=!1;this.addTeam(0,Game.getNmTeam(),e,0,-1,!1);this.getChrsByBattlers(main.btl.getPlayerTeam().members,0);var f="ja"==g.getLang();f||this.initNmChr(a.no);for(var h=0;h<a.teams.length&&!(3<=this.getSuuTeam());h++){var k=a.teams[h];if(0<k){if(3==k&&2<=this.getSuuTeam())break;var m=d[k];if(m.flgs){for(var e=!1,n=0;n<m.flgs.length;n++){var p=m.flgs[n];if(0==p){e=!0;break}if(0<=p){if(SP.getData().flgs[p]){e=!0;
break}}else if(!SP.getData().flgs[-p]){e=!0;break}}if(!e)continue}2<k&&(b=!0);for(var e=c[k],r=[],s=0;s<e.length;s++){var t=e[s];if(t){for(var w=!1,n=0;n<t.flgs.length;n++)if(p=t.flgs[n],0!=p)if(0<=p){if(!SP.getData().flgs[p]){w=!0;break}}else if(SP.getData().flgs[-p]){w=!0;break}if(!w){var p=null,w=t.lv,v=t.job;0==w?w=main.btl.getPlayerTeam().getMemberOfMaxLv().chr.lv:-1==w?(n=SP.getData().chrs[v],v=n.job,p=g.str("bnsn",n.nm),w=n.lv,t.exp=n.exp,t.itms=n.itms):0<SP.getData().vals[0]&&-25!=a.no&&(w=
g.addLimit(w,SP.getData().vals[0]*g.UP_LV_CLR,Chara.MAX_LV));null==p&&(p=isNaN(t.nm)?f?t.nm:this.getNmChr(v):g.str("nm"+t.nm));n=new Chara(v,p,w,t.exp,t.itms);p=CHR_TYPES.indexOf(t.type);r.push({no:t.no%16,chr:n,type:p,leader:1==t.leader})}}}this.addTeam(k,main.getNmTeam(m),r,m.lose,m.mikata,!0)}}return b};Main.prototype.nmChrs=[];Main.prototype.ixNmChrs=[];Main.prototype.initNmChr=function(a){a=g.getLang();for(var b in dt.jobs)this.nmChrs[b]=dt.jobs[b]["nms_"+a].slice(),this.ixNmChrs[b]=0};
Main.prototype.getNmChr=function(a){var b=this.ixNmChrs[a]++,c=this.nmChrs[a].length,d=b%c;return this.nmChrs[a][d]+(b==d?"":""+(Math.floor(b/c)+1))};
Main.prototype.resumeBtl=function(){var a=SP.getData();if(""!=a.noStg&&void 0!=a.noStg){this.btl.turn=a.turn-1;this.btl.phase=a.phase;this.btl.getPlayerTeam().exps=a.exps;var b=a.teams.length;if(b!=this.getSuuTeam())return cc.log("Main#resumeBtl ERROR!! suuTeam\x3d"+b+"\x3c\x3e"+this.getSuuTeam()),!0;for(var c=0;c<b;c++){var d=this.getTeam(c);d.setLose(a.teams[c].isLose);var e=a.btls[c],f=e.length;f!=d.getSuuMember()&&cc.log("Main#resumeBtl ERROR!! team"+c+" suuMember\x3d"+f+"\x3c\x3e"+d.getSuuMember());
for(var h=0;h<f;h++){var k=e[h],m=d.getMemberOfNo(k.no);null==m?cc.log("Main#resumeBtl ERROR!! team"+c+" member\x3d"+h+" no\x3d"+k.no):(m.hp=k.hp,m.setPos(k.x,k.y),k.sumi&&m.end(),d.isCom&&(m.chr.setLv(k.lv),m.exp=k.exp))}}return!0}return!1};Main.prototype.addTeam=function(a,b,c,d,e,f){this.btl.addTeam(a,b,c,d,e,f)};Main.prototype.startBtl=function(){this.btl.start(this.btl.turn,this.btl.phase,""!=SP.getData().noStg)};Main.prototype.getSuuTeam=function(){return this.btl.teams.length};
Main.prototype.getNowTeam=function(){return this.getTeam(this.btl.phase)};Main.prototype.getTeam=function(a){return this.btl.teams[a]};Main.prototype.nextPhase=function(){for(var a=this.btl.phase;;){a++;a>=this.btl.teams.length&&(a=0);if(a==this.btl.phase)return!1;if(0<this.getTeam(a).getSuuAliveMember())break}this.btl.startPhase(a);return!0};
Main.prototype.getNextChr=function(){for(var a=this.getNowTeam(),b=a.getPosNextChr(),c=a.getSuuMember(),d=0;d<c;d++){b++;b>=c&&(b=0);var e=a.getMember(b);if("start"==e.mode)return a.setPosNextChr(b),e}return null};Main.prototype.isMikata=function(a,b){return a.no==b.mikata||b.no==a.mikata};
Main.prototype.isOkTarget=function(a,b){var c=g.getKyori(b.x,b.y,a.x,a.y),c=a.chr.getWeapons(c),d;for(d in c){var e=c[d];if(this.isItmToEnemy(e)&&b.team.no!=a.team.no&&!this.isMikata(b.team,a.team)||this.isItmToPal(e)&&(b.team.no==a.team.no||this.isMikata(b.team,a.team)))return!0}return!1};
Main.prototype.getItmsToTarget=function(a,b){var c=[],d=g.getKyori(b.x,b.y,a.x,a.y),d=a.chr.getWeapons(d),e;for(e in d){var f=d[e];this.isItmToEnemy(f)&&(b.team.no==a.team.no||this.isMikata(b.team,a.team)||c.push(f));this.isItmToPal(f)&&(b.team.no==a.team.no||this.isMikata(b.team,a.team))&&c.push(f)}return c};
Main.prototype.getItmAtkToTarget=function(a,b){var c=a.team.no==b.team.no||this.isMikata(a.team,b.team),d=null,e=g.getKyori(b.x,b.y,a.x,a.y),e=a.chr.getWeapons(e),f;for(f in e){var h=e[f];if(!c&&this.isItmToEnemy(h)||c&&this.isItmToPal(h))if(h=a.chr.getDamageAndBai(b.chr,h),null==d||h.val>d.val)d=h}return d};Main.prototype.getMaxOfItms=function(a,b,c){var d={val:0,suu:0,itm:-1},e;for(e in a){var f=a[e],h=b.chr.getDamageAndBai(c.chr,f);h.val>d.val&&(d.val=h.val,d.suu=h.suu,d.itm=f)}return d};
Main.prototype.haneiHps=function(){var a=SP.getData();if(0!=a.mode)for(var b=this.btl.getPlayerTeam(),c=a.chrs.length,d=0;d<c;d++){var e=b.getMemberOfNo(d);e&&(a.chrs[d].hp=e.hp)}};var Battle=function(){this.init()};Battle.prototype.getViewTurn=function(){return this.turn};Battle.prototype.init=function(){this.phase=this.turn=0;this.teams=[]};Battle.prototype.addTeam=function(a,b,c,d,e,f){a=new Team(this.teams.length,a,b,c,d,e,f);this.teams.push(a)};
Battle.prototype.start=function(a,b,c){this.turn=a;this.startPhase(b,c)};Battle.prototype.startPhase=function(a,b){this.turn++;this.phase=a;this.teams[a].start(b)};Battle.prototype.getZanTeam=function(){var a=!1,b=null,c;for(c in this.teams)if(!this.teams[c].isLose()){if(a)return null;b=this.teams[c];a=!0}return b};Battle.prototype.getPlayerTeam=function(){for(var a in this.teams)if(!this.teams[a].isCom)return this.teams[a];return null};
var Team=function(a,b,c,d,e,f,h){this.no=a;this.tmSrt=b;this.nm=c;this.members=[];this.dies=[];for(a=0;a<d.length;a++)this.addMember(d[a].no,d[a].chr,d[a].leader,d[a].type);this.lose=e;this.mikata=f;this.isCom=h;this.exps=0;this.flgLose=!1};Team.prototype.setLose=function(a){this.flgLose=a};Team.prototype.isLose=function(){return this.flgLose};Team.prototype.addMember=function(a,b,c,d){this.members.push(new Battler(this,a,b,c,d))};Team.prototype.isManual=function(){return!this.isCom&&!SP.isFullAuto()};
Team.prototype.getSuuMember=function(){return this.members.length};Team.prototype.getSuuAliveMember=function(){for(var a=0,b=0;b<this.members.length;b++)0<this.members[b].hp&&a++;return a};Team.prototype.getMember=function(a){return this.members[a]};Team.prototype.getMemberOfNo=function(a){for(var b=this.members.length,c=0;c<b;c++){var d=this.members[c];if(d.no==a)return d}return null};Team.prototype.getDie=function(a){return this.dies[a]};
Team.prototype.getDieOfNo=function(a){for(var b=this.dies.length,c=0;c<b;c++){var d=this.dies[c];if(d.no==a)return d}return null};Team.prototype.getLeader=function(){for(var a=this.members.length,b=0;b<a;b++){var c=this.members[b];if(c.leader)return c}return this.members[0]};Team.prototype.getMemberOfMaxLv=function(){for(var a=null,b=0,c=this.members.length,d=0;d<c;d++){var e=this.members[d];!SP.getData().rests[e.no]&&e.chr.lv>b&&(a=e,b=e.chr.lv)}return a};
Team.prototype.delMember=function(a){a=this.members.indexOf(a);0<=a&&(a=this.members.splice(a,1),this.dies.push(a[0]),0>=this.getSuuAliveMember()&&this.setLose(!0))};Team.prototype.recovMember=function(a){for(var b=this.dies.length,c=0;c<b;c++){var d=this.dies[c];if(d.no==a)return this.dies.splice(c,1),this.members.push(d),this.setLose(!1),d}return null};Team.prototype.start=function(a){for(var b=0;b<this.members.length;b++){var c=this.members[b];a&&c.isEnd()||c.start()}this.setPosNextChr(-1)};
Team.prototype.setPosNextChr=function(a){this.posNextChr=a};Team.prototype.getPosNextChr=function(){return this.posNextChr};var Battler=function(a,b,c,d,e){var f=0!=a.no;this.team=a;this.no=b;this.chr=c;this.leader=d;this.type=e;this.flgSkipAnm=!1;!f&&0<SP.getData().mode&&0<=c.hp?this.hp=c.hp:this.hp=c.getSts(STS_MHP);this.setMuki(2);this.rest()};Battler.prototype.setMuki=function(a){this.muki=a};Battler.prototype.getMuki=function(){return this.muki};
Battler.prototype.decHp=function(a){this.hp-=a;0>this.hp&&(this.hp=0)};Battler.prototype.incHp=function(a){var b=this.hp;this.hp+=a;this.hp>this.chr.getSts(STS_MHP)&&(this.hp=this.chr.getSts(STS_MHP));return this.hp-b};Battler.prototype.rest=function(){this.mode="rest"};Battler.prototype.start=function(){this.mode="start"};Battler.prototype.isAct=function(){return"start"==this.mode};Battler.prototype.end=function(){this.mode="end"};Battler.prototype.isEnd=function(){return"end"==this.mode};
Battler.prototype.setPos=function(a,b){this.x=Number(a);this.y=Number(b)};var MAX_DUMMY=999999999;Battle.prototype.autoInit=function(){this.runCom1={rank:MAX_DUMMY,val:0,chara:null,mas:null,aite:null,itemNo:-1}};Battle.prototype.autoTeam=function(a){this.autoInit();for(var b=main.getTeam(a).getSuuMember(),c=0;c<b;c++){var d=main.getTeam(a).getMember(c);d.type!=CHR_ESCAPE&&(d.isEnd()||this.autoChr(d))}return this.runCom1.rank==MAX_DUMMY?this.autoTeamIdouOnly(a):!0};
Battle.prototype.autoChr1=function(a,b){this.autoInit();this.autoChr(a,b);if(this.runCom1.rank<MAX_DUMMY)return!0;this.autoChrIdouOnly(a);this.runCom1.rank<MAX_DUMMY&&this.autoChrIdouOnlyMas(this.runCom1.chara,this.runCom1.aite);return this.runCom1.rank!=MAX_DUMMY};
Battle.prototype.autoChr=function(a,b){var c=a.team.no,d=a.chr,e;e=b?0:a.type==CHR_AUTO_STAY?0:d.getSts(STS_MOVE);e=main.map.getMovables(a.x,a.y,a,e);for(var f in e){var h=e[f];if(!h.chr||h.chr==a)for(var k=0;k<d.itms.length;k++){var m=d.itms[k];if(!(void 0==m||0>m)){var n=main.isItmToPal(m),p=dt.itms[m].range;if(2==p.length)for(var r=p[0];r<=p[1];r++){var s=-r,t=0,w=s,v=1,y=1,x=1;0<r&&(x=r<<2);for(var u=0;u<x;u++){if(main.map.isRange(h.x+t,h.y+w)){var z=main.map.getMas(h.x+t,h.y+w).chr;if(z&&(-1!=
z.team.no&&z.team.no!=c&&!n&&!main.isMikata(a.team,z.team)||-1!=z.team.no&&(z.team.no==c||main.isMikata(a.team,z.team))&&n)&&!(n&&z==a&&0<r)){var A=d.getDamageAndBai(z.chr,m),B=A.val,D=A.suu,C=A=0;if(!n)for(var E in z.chr.itms){var J=z.chr.itms[E];if(!(void 0==J||0>J)){var G=main.isItmToPal(J),H=dt.itms[J].range;2==H.length&&!G&&H[0]<=r&&r<=H[1]&&(G=z.chr.getDamageAndBai(d,J),J=G.val,G=G.suu,J>A&&(A=J,C=G))}}J=z.hp;if(n)5<=this.runCom1.rank&&(B=z.chr.getSts(STS_MHP),B=J/B,1>B&&(0==this.runCom1.val||
B<this.runCom1.val)&&this.setPriority(5,a,h,z,k,B));else{if(J<=B)return this.setPriority(1,a,h,z,k),!0;2<=this.runCom1.rank&&(G=d.hp,C*=A,B*=D,C<G&&B>=J&&(2<this.runCom1.rank||this.runCom1.val>C)&&this.setPriority(2,a,h,z,k,C),3<=this.runCom1.rank&&(0==A&&(3<this.runCom1.rank||this.runCom1.val<B)&&this.setPriority(3,a,h,z,k,B),4<=this.runCom1.rank&&(C<G&&(4<this.runCom1.rank||this.runCom1.val<B)&&this.setPriority(4,a,h,z,k,B),6<=this.runCom1.rank&&this.runCom1.val<B&&this.setPriority(6,a,h,z,k,B))))}}}t+=
v;t>r?(t=r-1,v=-1):t<s&&(t=s+1,v=1);w+=y;w>r?(w=r-1,y=-1):w<s&&(w=s+1,y=1)}}}}}};
Battle.prototype.autoTeamIdouOnly=function(a){this.autoInit();for(var b=main.getTeam(a).getSuuMember(),c=0;c<b;c++){var d=main.getTeam(a).getMember(c);d.isEnd()||(d.type==CHR_ESCAPE?this.autoChrEscape(d):d.type==CHR_AUTO&&this.autoChrIdouOnly(d))}this.runCom1.rank<MAX_DUMMY&&(this.runCom1.chara.type==CHR_ESCAPE?this.escapeAtack(this.runCom1.chara,this.runCom1.mas):this.autoChrIdouOnlyMas(this.runCom1.chara,this.runCom1.aite));return this.runCom1.rank!=MAX_DUMMY};
Battle.prototype.autoChrEscape=function(a){var b=a.chr.getSts(STS_MOVE),b=main.map.getMovables(a.x,a.y,a,b),c=-1,d=null,e;for(e in b){var f=b[e];if(!f.chr||f.chr==a){for(var h=MAX_DUMMY,k=main.getSuuTeam(),m=0;m<k;m++)if(m!=a.team.no&&!main.isMikata(a.team,main.getTeam(m)))for(var n=main.getTeam(m).getSuuMember(),p=0;p<n;p++){var r=main.getTeam(m).getMember(p),s=r.x-f.x,r=r.y-f.y,s=s*s+r*r;s<h&&(h=s)}h>c&&(c=h,d=f)}}-1<c&&this.setPriority(0,a,d,null,-1)};
Battle.prototype.escapeAtack=function(a,b){for(var c=a.team.no,d=a.chr,e=0;e<d.itms.length;e++){var f=d.itms[e];if(!(void 0==f||0>f)){var h=main.isItmToPal(f),k=dt.itms[f].range;if(2==k.length)for(var m=k[0];m<=k[1];m++){var n=-m,p=0,r=n,s=1,t=1,w=1;0<m&&(w=m<<2);for(var v=0;v<w;v++){if(main.map.isRange(b.x+p,b.y+r)){var y=main.map.getMas(b.x+p,b.y+r).chr;0==m&&(y=a);if(y&&(-1!=y.team.no&&y.team.no!=c&&!h&&!main.isMikata(a.team,y.team)||-1!=y.team.no&&(y.team.no==c||main.isMikata(a.team,y.team))&&
h)&&!(h&&y==a&&0<m)){var x=d.getDamageAndBai(y.chr,f).val,u=0;if(!h)for(var z in y.chr.itms){var A=y.chr.itms[z];if(!(void 0==A||0>A)){var B=main.isItmToPal(A),D=dt.itms[A].range;2==D.length&&!B&&D[0]<=m&&m<=D[1]&&(A=y.chr.getDamageAndBai(d,A).val,A>u&&(u=A))}}A=y.hp;h?(x=y.chr.getSts(STS_MHP),A<x&&this.setPriority(1,a,b,y,e,x-A)):(A<=x||0==u)&&this.setPriority(3,a,b,y,e)}}p+=s;p>m?(p=m-1,s=-1):p<n&&(p=n+1,s=1);r+=t;r>m?(r=m-1,t=-1):r<n&&(r=n+1,t=1)}}}}};
Battle.prototype.autoChrIdouOnly=function(a){var b=!1,c=!1,d;for(d in a.chr.itms){var e=a.chr.itms[d];void 0==e||0>e||(c|=main.isItmToPal(e),b|=main.isItmToEnemy(e))}e=main.getSuuTeam();if(c)for(c=0;c<e;c++)if(c==a.team.no||main.isMikata(a.team,main.getTeam(c))){var f=main.getTeam(c).getSuuMember();for(d=0;d<f;d++){var h=main.getTeam(c).getMember(d);0<h.hp&&h.hp<h.chr.getSts(STS_MHP)&&this.setPrioIfNear(a,h)}}if(b)for(c=0;c<e;c++)if(c!=a.team.no&&!main.isMikata(a.team,main.getTeam(c)))for(f=main.getTeam(c).getSuuMember(),
d=0;d<f;d++)h=main.getTeam(c).getMember(d),0<h.hp&&this.setPrioIfNear(a,h)};Battle.prototype.setPrioIfNear=function(a,b){var c=b.x-a.x,d=b.y-a.y,c=c*c+d*d;c<this.runCom1.rank&&this.setPriority(c,a,null,b,-1)};
Battle.prototype.autoChrIdouOnlyMas=function(a,b){var c=main.map.getMas(a.x,a.y),d=a.type==CHR_AUTO_STAY?0:a.chr.getSts(STS_MOVE),d=main.map.getMovables(a.x,a.y,a,d);this.runCom1.rank=MAX_DUMMY;for(var e in d){var f=d[e];if(!f.chr||f.chr==a){var h=b.x-f.x,k=b.y-f.y,h=h*h+k*k;h<this.runCom1.rank&&f!=c&&this.setPriority(h,a,f,b,-1)}}};
Battle.prototype.setPriority=function(a,b,c,d,e,f){this.runCom1.rank=a;this.runCom1.chara=b;this.runCom1.mas=c;this.runCom1.aite=d;this.runCom1.itemNo=e;this.runCom1.val=f};var Map=function(a,b,c,d){this.suuMasYoko=a[0].length;this.suuMasTate=a.length;this.moveCosts=c;this.tipInfs=d;this.mass=[];for(d=0;d<this.suuMasTate;d++){this.mass.push([]);for(var e=0;e<this.suuMasYoko;e++)this.mass[d][e]=new Mas(a[d][e],b[d][e],c,e,d)}};Map.prototype.isRange=function(a,b){return 0<=a&&a<this.suuMasYoko&&0<=b&&b<this.suuMasTate};Map.prototype.getMas=function(a,b){return this.mass[b][a]};Map.prototype.getMovables=function(a,b,c,d){var e=[];this.makeMovables(e,a,b,c,d,!0);return e};
Map.prototype.makeMovables=function(a,b,c,d,e,f){if(this.isRange(b,c)){var h=this.getMas(b,c);e=h.setIdou(d,e,f);if(!(0>e))for(0>a.indexOf(h)&&a.push(h),f=0;4>f;f++)this.makeMovables(a,b+g.DIRS[f].x,c+g.DIRS[f].y,d,e,!1)}};Map.prototype.setMoveMas=function(a,b,c,d){var e=[];this.clearMoveMas();this.makeMoveMas(e,a,b,c,d,!0);return e};
Map.prototype.makeMoveMas=function(a,b,c,d,e,f){if(this.isRange(b,c)){var h=this.getMas(b,c);e=h.setIdou(d,e,f);if(!(0>e||h.amount>=e))for(h.amount=e,0>a.indexOf(h)&&a.push(h),f=0;4>f;f++)this.makeMoveMas(a,b+g.DIRS[f].x,c+g.DIRS[f].y,d,e,!1)}};
Map.prototype.getRootMukis=function(a,b){if(!this.isRange(a,b))return null;var c=this.getMas(a,b);if(0>c.amount)return null;for(var d=[];;){for(var e=c.amount,f=-1,h=0;4>h;h++){var k=c.x+g.DIRS[h].x,m=c.y+g.DIRS[h].y;this.isRange(k,m)&&(k=this.getMas(k,m),k.amount>e&&(e=k.amount,f=h))}if(0>f)break;d.push((f+2)%4);c=this.getMas(c.x+g.DIRS[f].x,c.y+g.DIRS[f].y)}return d};
Map.prototype.clearMoveMas=function(){for(var a=0;a<this.suuMasTate;a++)for(var b=0;b<this.suuMasYoko;b++)this.getMas(b,a).amount=-1};Map.prototype.chrOn=function(a){this.isRange(a.x,a.y)&&this.getMas(a.x,a.y).chrOn(a)};Map.prototype.chrOff=function(a){this.isRange(a.x,a.y)&&this.getMas(a.x,a.y).chrOff(a)};
Map.prototype.setTargetMas=function(a,b,c){var d=[],e=[];c=c.chr.itms;for(var f=0;f<c.length;f++){var h=c[f];if(!(void 0==h||0>h)){var k=dt.itms[h].range;if(2==k.length)for(var m=Number(k[0]),k=Number(k[1]),h=main.getItmSbt(h)==C_ITM_SBT_CARE?1:0;m<=k;m++)this.setTargetMasSub(d,e,h,a,b,m)}}return{mass:d,cols:e}};
Map.prototype.setTargetMasSub=function(a,b,c,d,e,f){var h=-f,k=0,m=h,n=1,p=1,r=4*f;if(0==r){var s=this.getMas(d,e),t=a.indexOf(s);0>t?(a.push(s),b.push(c)):2!=b[t]&&b[t]!=c&&(b[t]=2)}else for(var w=0;w<r;w++)s=d+k,t=e+m,this.isRange(s,t)&&(s=this.getMas(s,t),t=a.indexOf(s),0>t?(a.push(s),b.push(c)):2!=b[t]&&b[t]!=c&&(b[t]=2)),k+=n,k>f?(k=f-1,n=-1):k<h&&(k=h+1,n=1),m+=p,m>f?(m=f-1,p=-1):m<h&&(m=h+1,p=1)};
Map.prototype.getMasUnder=function(a,b,c){c||(c=this);return c.isRange(a,b)?c.getMas(a,b).kindUnder:-1};Map.prototype.getMasOver=function(a,b,c){c||(c=this);return c.isRange(a,b)?c.getMas(a,b).kindOver:-1};Map.prototype.getChrLayer=function(a,b){var c=a.getChildByName("layChr");null==c&&(c=cc.Layer.create(),c.setName("layChr"),a.addChild(c,100));return c};
Map.prototype.setLayer=function(a,b,c){var d=cc.SpriteBatchNode.create(res.tipUnder0);d.setName("layUnder");a.addChild(d);d=cc.SpriteBatchNode.create(res.tipOverMini0);d.setName("layOver");a.addChild(d,1E3);d=cc.Layer.create();d.setName("layWork");a.addChild(d,1500);d=cc.Layer.create();d.setName("layUi");a.addChild(d,2E3);var e;e=Math.floor(cc.winSize.width/g.SZ_MAS);d=Math.ceil((this.suuMasYoko+2*b-e)/2);d=Math.min(d,b);d=Math.abs(d);e=Math.floor(cc.winSize.height/g.SZ_MAS);b=Math.ceil((this.suuMasYoko+
2*c-e)/2);b=Math.min(b,c);b=Math.abs(b);this.infLayer={x:d,y:b,width:this.suuMasYoko+2*d,height:this.suuMasTate+2*b};a.setContentSize(cc.size(this.suuMasYoko*g.SZ_MAS,this.suuMasTate*g.SZ_MAS));a.setPosition(this.infLayer.x*g.SZ_MAS,this.infLayer.y*g.SZ_MAS);this.repaint(a);cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,onTouchBegan:function(a,b){return!0},onTouchEnded:function(a,b){}}).setSwallowTouches(!0)};Map.prototype.getLayUnder=function(a){return a.getChildByName("layUnder")};
Map.prototype.getLayWork=function(a){return a.getChildByName("layWork")};Map.prototype.getLayOver=function(a){return a.getChildByName("layOver")};Map.prototype.getLayUi=function(a){return a.getChildByName("layUi")};
Map.prototype.repaint=function(a){var b=this.getLayUnder(a);a=this.getLayOver(a);var c,d=0,e=0;this.szMas=g.SZ_MAS;for(var f=this.suuMasTate*this.szMas-this.szMas/2,h=0;h<this.suuMasTate;h++){for(var k=this.szMas/2,m=0;m<this.suuMasYoko;m++){c=this.getMasUnder(m,h);0<=c&&255>c&&(d=this.addMasSprs(b,"",0==this.tipInfs[0][c],c,d,k,f,m,h,this.getMasUnder));c=this.getMasOver(m,h);if(0<=c&&255>c)switch(this.tipInfs[1][c]){case 0:e=this.addMasSprs(a,"b",!0,c,e,k,f,m,h,this.getMasOver);break;case 1:e=this.addMasSprs(a,
"b",!1,c,e,k,f);break;default:d=this.addMasSprs(b,"b",!1,c,d,k,f)}k+=this.szMas}f-=this.szMas}this.hideSprOver(b,d);this.hideSprOver(a,e)};Map.prototype.getSprOfNode=function(a,b,c){var d=!1;c?d=!0:c=a.getName();var e;b>=a.getChildrenCount()?(e=cc.Sprite.create(cc.spriteFrameCache.getSpriteFrame(c)),e.setTag(b),a.addChild(e)):(e=a.getChildByTag(b),e.setVisible(!0),d&&(a=cc.spriteFrameCache.getSpriteFrame(c),e.getSpriteFrame()!=a&&e.setSpriteFrame(a)));return e};
Map.prototype.hideSprOver=function(a,b){for(var c,d=a.getChildrenCount(),e=b;e<d;e++)c=a.getChildByTag(e),c.setVisible(!1)};Map.prototype.setSprMasDir=function(a,b,c,d,e,f,h,k){134!=f&&(b+=f,void 0!=h&&(b+="_"+h),void 0!=k&&(b+="_"+k,d+=g.DIRS[k].x*this.szMas/4,e-=g.DIRS[k].y*this.szMas/4),a=this.getSprOfNode(a,c),c=cc.spriteFrameCache.getSpriteFrame(b),a.getSpriteFrame()!=c&&a.setSpriteFrame(c),a.x==d&&a.y==e||a.setScale(1.02),a.setPosition(d,e))};
Map.prototype.addMasSprs=function(a,b,c,d,e,f,h,k,m,n){if(c){c=[0,0,0,0];for(var p=[[0,3,4],[0,1,5],[2,1,6],[2,3,7]],r=0;4>r;r++){var s=p[r],t=n(k+g.DIRS[s[0]].x,m+g.DIRS[s[0]].y,this);if(0>t||t==d)c[r]+=1;t=n(k+g.DIRS[s[1]].x,m+g.DIRS[s[1]].y,this);if(0>t||t==d)c[r]+=2;3==c[r]&&(t=n(k+g.DIRS[s[2]].x,m+g.DIRS[s[2]].y,this),0>t||t==d)&&(c[r]=4)}if(c[0]==c[1])c[2]==c[3]?c[0]==c[3]?this.setSprMasDir(a,b,e++,f,h,d,c[0]):(this.setSprMasDir(a,b,e++,f,h,d,c[0],0),this.setSprMasDir(a,b,e++,f,h,d,c[2],2)):
(this.setSprMasDir(a,b,e++,f,h,d,c[0],0),this.setSprMasDir(a,b,e++,f,h,d,c[2],6),this.setSprMasDir(a,b,e++,f,h,d,c[3],7));else if(c[1]==c[2])c[0]==c[3]?(this.setSprMasDir(a,b,e++,f,h,d,c[1],1),this.setSprMasDir(a,b,e++,f,h,d,c[3],3)):(this.setSprMasDir(a,b,e++,f,h,d,c[1],1),this.setSprMasDir(a,b,e++,f,h,d,c[3],7),this.setSprMasDir(a,b,e++,f,h,d,c[0],4));else if(c[2]==c[3])this.setSprMasDir(a,b,e++,f,h,d,c[0],4),this.setSprMasDir(a,b,e++,f,h,d,c[1],5),this.setSprMasDir(a,b,e++,f,h,d,c[2],2);else if(c[3]==
c[0])this.setSprMasDir(a,b,e++,f,h,d,c[1],5),this.setSprMasDir(a,b,e++,f,h,d,c[2],6),this.setSprMasDir(a,b,e++,f,h,d,c[3],3);else for(r=0;4>r;r++)this.setSprMasDir(a,b,e++,f,h,d,c[r],4+r)}else this.setSprMasDir(a,b,e++,f,h,d);return e};var Mas=function(a,b,c,d,e){this.kindUnder=a;this.kindOver=b;this.moveCosts=c;this.x=d;this.y=e;this.amount=-1};Mas.prototype.getMoveCost=function(a){a=this.moveCosts[1][this.kindOver];if(255>a)return a;a=this.moveCosts[0][this.kindUnder];return 255>a?a:0};Mas.prototype.setIdou=function(a,b,c){if(this.chr&&this.chr.team.no!=a.team.no&&!main.isMikata(this.chr.team,a.team))return-1;if(!c){a=this.getMoveCost(null);if(0==a)return-1;b-=a}return 0>b?-1:b};Mas.prototype.chrOn=function(a){this.chr=a};
Mas.prototype.chrOff=function(a){this.chr&&a==this.chr&&(delete this.chr,this.chr&&cc.log("Mas#chrOff NG "+this.chr))};var STS_MHP=0,STS_ATK=1,STS_DEF=2,STS_SPD=3,STS_MATK=4,STS_MDEF=5,STS_MOVE=6,NM_STSS=[""],MAX_LV=9999,EXP_BASE=20,EXP_BASE_MINI=5,NEED_EXP=100,LIMIT_EXP=10*NEED_EXP,Chara=function(a,b,c,d,e,f){this.job=a;this.nm=b;this.setLv(c);this.exp=d;this.itms=e?e:[];this.hp=void 0==f||0>=f?this.getSts(STS_MHP):f};Chara.prototype.setLv=function(a){this.lv=a;this.stss=this.getStssOfLv(this.job,this.lv)};
Chara.prototype.getStssOfLv=function(a,b){for(var c=[],d=STS_MHP;d<=STS_MOVE;d++){var e=dt.jobs[a].lv1sts[d];c.push(e+Math.floor((dt.jobs[a].lv20sts[d]-e)*b/20))}return c};Chara.prototype.getSts0=function(a){return this.stss[a]};Chara.prototype.getSts=function(a){var b=this.getSts0(a),b=b+this.getStsOfItems(a);0>b&&(b=0);return b};
Chara.prototype.getStsOfItems=function(a){if(a<STS_MHP||a>STS_MOVE)return 0;for(var b=0,c=0;c<this.itms.length;c++){var d=this.itms[c];!d||0>d||(d=dt.itms[d].sts,d[a]&&(b+=d[a]))}return b};Chara.prototype.getItem=function(a){return this.itms[a]};Chara.prototype.setItem=function(a,b){this.itms[a]=b;this.hp>this.getSts(STS_MHP)&&(this.hp=this.getSts(STS_MHP))};Chara.prototype.getEmptyItemPos=function(){for(var a=0;4>a;a++)if(a>=this.itms.length||void 0==this.itms[a]||0>this.itms[a])return a;return-1};
Chara.prototype.getItemPos=function(a){for(var b=0;4>b&&!(b>=this.itms.length);b++)if(this.itms[b]==a)return b;return-1};Chara.prototype.getWeapons=function(a){var b=[],c;for(c in this.itms){var d=this.itms[c];if(!(void 0==d||0>d)){var e=dt.itms[d].range;if(2==e.length){var f=Number(e[1]);Number(e[0])<=a&&a<=f&&b.push(d)}}}return b};
Chara.prototype.ariWeapon=function(a){for(var b in this.itms){var c=this.itms[b];if(!(void 0==c||0>c)&&(c=dt.itms[c].range,2==c.length)){var d=Number(c[1]);if(Number(c[0])<=a&&a<=d)return!0}}return!1};
Chara.prototype.getDamageAndBai=function(a,b){var c=dt.itms[b].val,d=1,e=main.getItmSbt(b),f=!1;e==C_ITM_SBT_ATK?(c+=this.getSts(STS_ATK),c-=a.getSts(STS_DEF)):e==C_ITM_SBT_MATK?(c+=this.getSts(STS_MATK),c-=a.getSts(STS_MDEF),0<=a.getItemPos(g.NO_ITM_HALF_MGC)&&(c>>=1,cc.log("Chara#getDamageAndBai NO_ITM_HALF_MGC dmg\x3d"+c)),"fire"==dt.itms[b].zoku&&0<=a.getItemPos(g.NO_ITM_RESIST_FIRE)&&(c=0,f=!0,cc.log("Chara#getDamageAndBai NO_ITM_RESIST_FIRE dmg\x3d"+c))):e==C_ITM_SBT_CARE&&(c+=this.getSts(STS_MATK));
0>=c&&!f&&(c=1);e!=C_ITM_SBT_CARE&&this.getSts(STS_SPD)>=a.getSts(STS_SPD)<<1&&(d=2);return{val:c,suu:d,itm:b,care:e==C_ITM_SBT_CARE}};Chara.prototype.getExp=function(a){1>a&&(a=1);this.lv==MAX_LV&&(a=0);this.exp+a>LIMIT_EXP&&(a=LIMIT_EXP-this.exp);return a};Chara.prototype.getExpAtk=function(a){return this.getExp((a.lv-this.lv+1)*EXP_BASE_MINI)};Chara.prototype.getExpDefeat=function(a){return this.getExp((a.lv-this.lv+3)*EXP_BASE)};
Chara.prototype.getExpCare=function(a,b,c){var d=(a.lv-this.lv+1)*EXP_BASE;cc.log("Chara#getExpCare valCare\x3d"+b+" valMgc\x3d"+c+" lv\x3d"+this.lv+" aite\x3d"+a.lv+" val\x3d"+d);a=b/c;cc.log("Chara#getExpCare perVal\x3d"+a);return this.getExp(Math.floor(d*a))};
Chara.prototype.checkLvup=function(){var a=Math.floor(this.exp/NEED_EXP);this.lv+a>MAX_LV&&(a=MAX_LV-this.lv);if(1>a)return null;var b=this.stss.slice();this.setLv(this.lv+a);this.exp%=NEED_EXP;for(a=0;a<b.length;a++)b[a]=this.stss[a]-b[a];return b};var Script=function(a,b,c,d,e){this.scr=a;this.sngame=b;this.base=c;this.layWorld=d;this.aiteBattler=e;this.lbls=[];this.lblSteps=[];for(b=0;b<a.length;b++)"*"==a[b][0].substring(0,1)&&(this.lbls.push(a[b][0].substring(1)),this.lblSteps.push(b));this.sngame&&this.startCover();this.svSpd=SP.getSpdBtl();SP.setSpdBtl(SP.DEFO_SPD_BTL);this.step=0;this.waiting=!1;this.doStep()};Script.prototype.startCover=function(){this.sngame&&this.sngame.viewScr.setTouchEnabled(!1)};
Script.prototype.stopCover=function(){this.sngame&&this.sngame.viewScr.setTouchEnabled(!0)};Script.prototype.startWait=function(a){var b=this;this.base.scheduleOnce(function(){b.doStep()},a/1E3,"wait");this.waiting=!0};Script.prototype.goStep=function(a){a=this.lbls.indexOf(a);0<=a&&(this.step=this.lblSteps[a])};
Script.prototype.doStep=function(){this.waiting=!1;if(this.step>=this.scr.length)SP.setSpdBtl(this.svSpd),this.clearFace(),g.anmClrMsg(),this.base.completeScript&&this.base.completeScript(),this.stopCover();else{var a=this,b,c=this.scr[this.step];switch(c[0].trim()){case "end":this.step=this.scr.length;break;case "goto":this.goStep(c[1]);break;case "wait":this.startWait(c[1]);break;case "if":switch(c[1]){case "flg":SP.getData().flgs[c[2]]&&this.goStep(c[3]);break;case "die":b=this.getChr(c[2],c[3]);
(!b||0>=b.hp)&&this.goStep(c[4]);break;case "leader":b=this.getChr(c[2],c[3]);b.leader&&this.goStep(c[4]);break;case "equip":0<=SP.getData().chrs[c[2]].getItemPos(c[3])&&this.goStep(c[4]);break;case "phase":main.btl.phase==c[2]&&this.goStep(c[3]);break;case "aite":if(!this.aiteBattler)break;"team"==c[2]&&this.aiteBattler.team.no==c[3]&&this.goStep(c[4]);break;case "conf":(new LayerMsg).confYesNo("",function(){a.goStep(c[2]);a.doStep()},function(){a.doStep()},null,null,!0,!0);this.waiting=!0;break;
default:cc.log("Script#doStep if ERROR! "+c[1])}break;case "system":"maxlv"==c[1]?SP.getData().vals[c[2]]=main.btl.getPlayerTeam().getMemberOfMaxLv().chr.lv:cc.log("Script#doStep system ERROR! "+c[1]);break;case "flg":"on"==c[1]?SP.getData().flgs[c[2]]=!0:"off"==c[1]?SP.getData().flgs[c[2]]=!1:cc.log("Script#doStep flg ERROR! "+c[1]);break;case "val":"inc"==c[1]?SP.addValLimit(c[2],1):"add"==c[1]?SP.addValLimit(c[2],c[3]):cc.log("Script#doStep flg ERROR! "+c[1]);break;case "itm":"inc"==c[1]?(SP.hakkenItm(c[2]),
SP.getData().itms[c[2]]=g.addLimit(SP.getData().itms[c[2]],1)):"dec"==c[1]?SP.getData().itms[c[2]]=g.subLimit(SP.getData().itms[c[2]],1):cc.log("Script#doStep itm ERROR! "+c[1]);break;case "equip":b=this.getChr(c[1],c[2]);var d=b.chr.getEmptyItemPos();if(0>d||1>SP.getData().itms[c[3]]){SP.getData().flgs[c[4]]=!0;break}b.chr.setItem(d,c[3]);SP.getData().itms[c[3]]--;SP.getData().flgs[c[4]]=!1;break;case "eqoff":b=this.getChr(c[1],c[2]);d=SP.getData().chrs[c[2]].getItemPos(c[3]);if(0>d)break;b.chr.setItem(d,
-1);SP.getData().itms[c[3]]++;break;case "pal":main.hakkenItms(c[1]);3<c.length&&(b=this.getChr(c[2],c[3]),d=SP.getData().chrs[c[1]],d.lv=b.chr.lv,d.exp=b.chr.exp);break;case "bgm":if("stop"==c[1]){g.pauseBgm();break}if("start"==c[1]){g.restartBgm();break}g.playBgm(c[1]);break;case "sound":g.playSe(c[1]);break;case "setpos":if(!this.sngame)break;if("clear"==c[1]){this.sngame.scrollCenter(this.sngame.getMposScreenCenterX(),this.sngame.getMposScreenCenterY(),0,!0);break}this.sngame.scrollCenter(Number(c[1]),
Number(c[2]),0,!1);break;case "fade":if("clear"==c[1]){g.removeCover();break}g.startFade(c[1],c[2],"out"==c[1],null,this.base);break;case "scroll":if(!this.sngame)break;switch(c[1]){case "dir":this.sngame.scrollCenter(this.sngame.getMposScreenCenterX()+g.DIRS[c[2]].x*c[3],this.sngame.getMposScreenCenterY()+g.DIRS[c[2]].y*c[3],c[4]/1E3,!0)}break;case "delchr":if(!this.sngame)break;if(3>c.length){this.delChrIfRest(0);this.delChrIfRest(1);this.delChrIfRest(2);this.delChrIfRest(3);this.delChrIfRest(5);
break}if(0<c[3]){var e=function(){a.delChr(c[1],c[2])};b=this.getChr(c[1],c[2]);b.c.runAction(cc.sequence(cc.fadeOut(c[3]/1E3),cc.callFunc(e)));break}this.delChr(c[1],c[2]);break;case "recovchr":if(!this.sngame)break;if(3>c.length){this.sngame.recovBattler(0,0);this.sngame.recovBattler(0,1);this.sngame.recovBattler(0,2);this.sngame.recovBattler(0,3);this.sngame.recovBattler(0,5);break}b=this.sngame.recovBattler(c[1],c[2]);e=function(){"type1"!=c[4]&&"topal"!=c[4]||!b||(a.sngame.repaintMiniMapChr(b),
a.sngame.layGame.repaintHpBar(b),a.sngame.layGame.showHpBar(b))};if(0<c[3])switch(d=c[3]/1E3,c[4]){case "type1":b.c.setOpacity(0);b.c.setScale(9,0.5);b.c.runAction(cc.sequence(cc.spawn(cc.fadeIn(d),cc.scaleTo(d,g.BAI_CHR,g.BAI_CHR)),cc.callFunc(e)));break;default:b.c.setOpacity(0),b.c.runAction(cc.sequence(cc.fadeIn(d),cc.callFunc(e)))}else e();break;case "makechr":if(!this.sngame)break;d=new Chara(c[3],"",1,0,null);main.getTeam(c[1]).addMember(c[2],d,!1,0);b=this.getChr(c[1],c[2]);this.sngame.setCharacter(this.sngame.layMap,
b);break;case "chrpos":if(!this.sngame)break;(b=this.getChrOrDie(c[1],c[2]))&&this.sngame.setChrPos(b,c[3],c[4]);break;case "chrposof":if(!this.sngame)break;d=this.getChrOrDie(c[3],c[4]);(b=this.getChrOrDie(c[1],c[2]))&&d&&this.sngame.setChrPos(b,d.x,d.y);break;case "chrpalof":if(!this.sngame)break;d=this.getChrOrDie(c[3],c[4]);(b=this.getChrOrDie(c[1],c[2]))&&d&&(this.sngame.setChrPos(b,d.x,d.y),b.chr.setLv(d.chr.lv),b.chr.exp=d.chr.exp,b.setMuki(d.muki),this.sngame.setMuki(b),d.flgSkipAnm=!0);break;
case "muki":if(!this.sngame)break;b=this.getChr(c[1],c[2]);if(!b)break;switch(c[3]){case "dir":this.sngame.stopChrStep(b),this.sngame.mukiToPos(b,b.x+g.DIRS[c[4]].x,b.y+g.DIRS[c[4]].y)}break;case "move":if(!this.sngame)break;b=this.getChr(Number(c[1]),Number(c[2]));if(!b)break;d=0;5<c.length&&(d=Number(c[6])/1E3/Number(c[5]));this.sngame.startChrStep(b);switch(c[3]){case "dir":this.sngame.moveChrStep(b,Number(c[4]),Number(c[5]),d)}break;case "btlanm":if(!this.sngame)break;b=this.getChr(c[1],c[2]);
d=this.sngame.layGame.setEffect(b.c,c[3]);this.startWait(d);break;case "effect":b=this.getChr(c[1],c[2]);this.clearEffect(b.c);if("clear"==c[3])break;d=0;e=null;4<c.length&&(d=Number(c[4])/1E3);6<c.length&&(e=cc.p(Number(c[5]),Number(c[6])));this.setEffect(b.c,c[3],d,e);break;case "arrow":this.layWorld&&(2<c.length?"clear"==c[2]&&this.layWorld.hideMarkTo(Number(c[1])):this.layWorld.showMarkTo(Number(c[1])));break;case "serif":this.str="";this.sngame?(b=this.getChr(c[1],c[2]),this.sngame.startChrStep(b),
this.chrStep=b,this.str=b.chr.nm):0==c[1]&&(this.str=SP.getData().chrs[c[2]].nm);0==c[1]&&(this.showFace(c[2],c[3]),1==c[2]||3==c[2]||4==c[2]||8==c[2]||7==c[2]?g.playSe("select"):g.playSe("ok"));this.grpWin=""+c[1];this.posText=c[4]?c[4]:"center";break;case "chrstep":if(!this.sngame)break;b=this.getChr(c[1],c[2]);if(3<c.length&&"clear"==c[3]){this.sngame.stopChrStep(b);break}this.sngame.startChrStep(b);break;case "face":this.showFace(c[1],c[2],c[3],c[4]);break;case "clear":this.clearFace();g.anmClrMsg();
break;case "text":this.grpWin=this.str="";1<c.length&&(this.grpWin+=c[1]);this.posText="center";break;case ".":g.removeByNm("msg");this.str=main.umekomi(this.str);g.viewMsg(this.str,function(){a.chrStep&&(a.sngame.stopChrStep(a.chrStep),delete a.chrStep);a.doStep()},"win"+this.grpWin,null,null,null,this.posText);this.waiting=!0;break;case "staff":if(1==c.length){this.str="";break}this.startStaff(this.str,function(){a.doStep()});this.waiting=!0;break;default:if(""==c[0])break;var d=g.getLang(),e=c[0].split(":"),
f=0;if("ja"==d){if(1<e.length)break}else{if(e[0]!=d)break;f=1}""!=this.str&&(this.str+="\n");this.str+=e[f];for(d=1;d<c.length;d++)this.str+=" "+c[d]}this.step++;this.waiting||this.doStep()}};Script.prototype.delChr=function(a,b){var c=this.getChr(a,b);c&&(c.team.delMember(c),main.map.chrOff(c),this.sngame.repaintMiniMapChr(c),c.c.removeFromParent())};Script.prototype.delChrIfRest=function(a){SP.getData().rests[a]&&this.delChr(0,a)};
Script.prototype.showFace=function(a,b,c,d){b&&"normal"!=b&&(a+="_"+b);c||(c="left");this.clearFace();b=cc.director.getRunningScene();a=new cc.Sprite(res["face"+a]);a.setScale(1.5,1.5);var e=g.getSizeMsg(),f=g.getPosMsg();a.setAnchorPoint(0,1);switch(c){case "right":a.setPosition(f.x+(e.width>>1),f.y+(e.height>>1));break;default:a.setPosition(f.x-(e.width>>1),f.y+(e.height>>1))}switch(d){case "rev":a.setScaleX(-1.5)}a.setOpacity(0);a.runAction(cc.spawn(cc.fadeIn(0.2),cc.moveBy(0.1,0,1.5*a.height)));
a.setName("face");b.addChild(a)};Script.prototype.clearFace=function(){g.removeByNm("face")};Script.prototype.getChr=function(a,b){return main.getTeam(Number(a)).getMemberOfNo(Number(b))};Script.prototype.getChrOrDie=function(a,b){var c=main.getTeam(Number(a)).getMemberOfNo(Number(b));c||(c=main.getTeam(Number(a)).getDieOfNo(Number(b)));return c};
Script.prototype.setEffect=function(a,b,c,d){c||(c=0.5);b=g.getCommonEffect(this,"ef_"+b,c);b.setName("effect");d?b.setPosition(d.x+a.width/2,d.y+a.width/2):b.setPosition(a.width,a.height);a.addChild(b);return b};Script.prototype.clearEffect=function(a){g.removeByNm("effect",a)};
Script.prototype.startStaff=function(a,b){var c=cc.director.getRunningScene(),d=new ccui.Layout,e=new ccui.Text(a,g.fontNormal,g.FONT_SZ_MIDIUM);e.setTextHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER);e.color=cc.color("#ffffff");d.setContentSize(cc.winSize);d.addChild(e);e.setAnchorPoint(0.5,1);e.setPosition(d.width>>1,0);var f=e.height+(d.height>>1);e.setOpacity(0);e.runAction(cc.sequence(cc.spawn(cc.fadeIn(1),cc.moveBy(9,0,f)),cc.delayTime(1),cc.fadeOut(1),cc.callFunc(function(){d.removeFromParent();
b()})));c.addChild(d)};var LayerWorld=cc.Layer.extend({ctor:function(a,b,c,d){this._super();this.width=c*g.SZ_MAS;this.height=d*g.SZ_MAS;var e=this,f,h=new cc.DrawNode;this.addChild(h,99,0);d=SP.getData().posNow;c=Game.getIkeruPoss(d);for(var k=0;k<a.length;k++)if(f=a[k]){var m=Game.getStgOfNo(k),n=g.getImgBtn(this,res.pos0,res.pos1,function(a){e.tapPoint(a.getTag())});n.setPosition(f.x*g.SZ_MAS,this.height-f.y*g.SZ_MAS);f=0<=c.indexOf(k);n.setEnabled(f);this.addChild(n,999,m.no);if(f){var p=cc.Sprite.create(res.posCover);
p.setPosition(n.width/2,n.height/2);n.addChild(p);p.runAction(cc.repeatForever(cc.sequence(cc.fadeOut(0.9),cc.fadeIn(0.9))))}this.setIcon(n,m);f=m.no==d||f||SP.getData().sumiPoss[m.no]||2==m.no?main.nmStg(k):g.str("htn5");f=g.getLabel(f,cc.color("#ffffff"),cc.color("#000000"));f.setPosition(n.x,n.y+n.height/2+f.height/2);this.addChild(f,1E3,0);m.no==d&&(n.setEnabled(!0),n.setColor(cc.color("#ff0000")),f=g.getLabel(g.str("gnzic"),cc.color("#ff0000"),cc.color("#ffffff")),f.setPosition(n.x,n.y-n.height/
2-f.height/2),this.addChild(f,1E3,0));m=Game.getIkeruPoss(k);for(f=0;f<m.length;f++)if(!(m[f]<k)){var r=a[m[f]],p=Game.getSubs(k,m[f]),r=cc.p(r.x*g.SZ_MAS,this.height-r.y*g.SZ_MAS),s;s=cc.color("#0000ff");var t=cc.color("#888888");s=0<=d?k==d||m[f]==d?s:t:0<=c.indexOf(k)&&0<=c.indexOf(m[f])?s:t;0==p.length?h.drawSegment(n.getPosition(),r,2,s):1==p.length?(t=b[p[0]],h.drawQuadBezier(n.getPosition(),cc.p(t.x*g.SZ_MAS,this.height-t.y*g.SZ_MAS),r,20,4,s)):(t=b[p[0]],p=b[p[p.length-1]],h.drawCubicBezier(n.getPosition(),
cc.p(t.x*g.SZ_MAS,this.height-t.y*g.SZ_MAS),cc.p(p.x*g.SZ_MAS,this.height-p.y*g.SZ_MAS),r,20,4,s))}}c=0>d?Game.getSubs(c[0],c[1]):Game.getIkeruSubs(d);for(k=0;k<b.length;k++)!(f=b[k])||0>c.indexOf(k)||(m=Game.getStgOfNo(-k),Game.isDev(m)||(n=g.getImgBtn(this,res.sub0,res.sub1,function(a){e.tapPoint(a.getTag())}),n.setPosition(f.x*g.SZ_MAS,this.height-f.y*g.SZ_MAS),this.setIcon(n,m),a=m?m.no:-k,-1==a&&(a=-12345),this.addChild(n,999,a),k==-d&&(n.setEnabled(!0),n.setColor(cc.color("#ff0000")),f=g.getLabel(g.str("gnzic"),
cc.color("#ff0000"),cc.color("#ffffff")),f.setPosition(n.x,n.y-n.height/2-f.height/2),this.addChild(f,1E3,0))))},setIcon:function(a,b){var c=0.7;b&&0>b.no&&(c*=0.8);var d;Game.isRock(b)?(d=cc.Sprite.create(res.ic_rock),d.setScale(c),d.setPosition(a.width/2,a.height/2),a.addChild(d)):Game.isDev(b)||(Game.isSumi(b)&&(d=cc.Sprite.create(res.ic_ck),d.setScale(c),d.setPosition(a.width/2,a.height/2),a.addChild(d)),Game.isEnc(b)&&(d=cc.Sprite.create(res.ic_caution),b&&0>b.no&&d.setScale(0.8),d.setPosition(a.width,
a.height),a.addChild(d)))},tapPoint:function(a){-12345==a&&(a=-1);if(SP.getData().posNow!=a){var b=Game.getStgOfNo(a);if(!Game.isRock(b))if(Game.isEnc(b))if(Game.isDev(b)){var c=(new LayerMsg).addMsg("\u203b\u307e\u3060\u305d\u3053\u306f\u958b\u767a\u4e2d\u3067\u3059\n\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u307e\u3067\u304a\u5f85\u3061\u304f\u3060\u3055\u3044").addTap(function(){c.close()});c.start()}else g.isApp()&&SP.getData().flgs[24]&&0<=a&&SP.getData().sumiPoss[a]?(new LayerMsg).confYesNo(g.str("rewbtl"),
function(){g.goReward("Loading...",0.1,function(b){0<b&&(SP.getData().posNow=a,SP.saveData(),cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneWorld)))}.bind(this))}.bind(this),function(){g.hakiImgs();cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneGame(a)))},g.str("rewbtlYes"),g.str("rewbtlNo"),!0,!0,!0):(g.hakiImgs(),cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneGame(a))));else SP.getData().posNow=a,SP.saveData(),cc.director.runScene(cc.TransitionFade.create(g.TM_START,
new SceneWorld))}},getTagOfPos:function(a){-1==a&&(a=-12345);return a},getPos:function(a){-1==a&&(a=-12345);cc.log("SceneWorld#getPos "+a);a=this.getChildByTag(this.getTagOfPos(a)).getPosition();a.y=this.height-a.y;return a},showMarkTo:function(a,b){var c=SP.getData().posNow;b||(b=Game.getIkeruPoss(c));if(0>b.indexOf(a))return!1;cc.log("SceneWorld#showMarkTo "+c);c=this.getChildByTag(this.getTagOfPos(c));cc.log("SceneWorld#showMarkTo "+a);var d=this.getChildByTag(this.getTagOfPos(a)),e=cc.Sprite.create(res.tt_arrow);
e.setAnchorPoint(0,0);e.setPosition(d.width/2,d.height/2);e.setRotation(g.getAngle(c.x,c.y,d.x,d.y)-135);e.setName("arw");d.addChild(e);var f=e.x,h=e.y,k=f+c.x-d.x,m=h+c.y-d.y;e.runAction(cc.repeatForever(cc.sequence(cc.callFunc(function(){e.setPosition(k,m);e.setOpacity(0)}),cc.spawn(cc.sequence(cc.delayTime(0.4),cc.fadeIn(0.5)),cc.moveTo(0.9,f,h).easing(cc.easeBounceOut(0.25))),cc.delayTime(0.5))));return!0},hideMarkTo:function(a){cc.log("SceneWorld#hideMarkTo "+a);a=this.getChildByTag(this.getTagOfPos(a));
g.removeByNm("arw",a)}}),SceneWorld=cc.Scene.extend({ctor:function(){this._super()},transitioning:!0,onEnterTransitionDidFinish:function(){this._super();this.transitioning=!1;g.setBackKey(this)},onEnter:function(){this._super();var a=this,b=new cc.LayerColor(cc.color("#ff9900"));this.addChild(b);var c=g.startLoading(this,"Loading..."),b=[{id:"map",src:"res/maps/world.fmf",isBin:!0}];SP.getData().flgs[12]||b.push({id:"srt0",src:"res/tuto/world.txt"});g.loadCsvs(b,function(b,e){if(null==b){var f,h,
k=[],m=[],n=new DataInputStream(e.map);n.readUnsignedInt();n.readUnsignedShort();n.readUnsignedByte();f=n.readUnsignedShort();n.readUnsignedShort();h=n.readUnsignedShort();cc.log("SceneWorld loaded w\x3d"+f+" h\x3d"+h);n.readUnsignedInt();n.readUnsignedShort();n.readUnsignedByte();for(var p=0;p<h;p++)for(var r=0;r<f;r++){var s=n.readUnsignedByte();255>s&&(k[s]=cc.p(r,p))}for(p=0;p<h;p++)for(r=0;r<f;r++)s=n.readUnsignedByte(),255>s&&(m[s]=cc.p(r,p));delete e.map;var t;e.srt0&&(t=g.kaisekiSrt(e.srt0),
delete e.srt0);var w=["res/map9.png"];g.loadImgs(w,function(){var b=new LayerWorld(k,m,f,h),d=cc.Sprite.create(cc.textureCache.getTextureForKey(w[0]));d.setOpacity(128);var e=new ccui.ScrollView;e.setDirection(ccui.ScrollView.DIR_BOTH);e.setScrollBarEnabled(!1);e.setContentSize(cc.winSize);var n=b.width-(b.width-e.width)/2,p=b.height-(b.height-e.height)/2;cc.log("SceneWorld bg("+n+", "+p+")");d.setScale(n/d.width,p/d.height);d.setPosition(n/2,p/2);e.setInnerContainerSize(cc.size(n,p));e.addChild(d);
a.addChild(e);e.setEnabled(!1);var r=new ccui.ScrollView;r.setDirection(ccui.ScrollView.DIR_BOTH);r.setContentSize(cc.winSize);r.setInnerContainerSize(cc.size(b.width,b.height));r.setInnerContainerPosition(cc.p(0,0));r.addChild(b);a.addChild(r);a.viewScr=r;r.setName("scrview");r.addEventListener(function(a,b){if(b==ccui.ScrollView.EVENT_CONTAINER_MOVED){var c=r.getInnerContainerSize(),d=r.getContentSize(),f=r.getInnerContainerPosition();e.jumpToPercentBothDirection(cc.p(-f.x/(c.width-d.width)*100,
100+f.y/(c.height-d.height)*100))}},this);var n=b.getPos(SP.getData().posNow),p=r.getInnerContainerSize(),s=r.getContentSize(),d=(n.x-s.width/2)/(p.width-s.width)*100,n=(n.y-s.height/2)/(p.height-s.height)*100;0>d&&(d=0);0>n&&(n=0);100<d&&(d=100);100<n&&(n=100);r.jumpToPercentBothDirection(cc.p(d,n));g.playBgm("camp");a.funcUpdate=function(){a.unscheduleUpdate();g.stopLoading(c);t?new Script(t,null,a,b):a.startMenuBtn()};a.scheduleUpdate()},a)}});cc.log("SceneWorld#onEnter OK tm\x3d"+(new Date).getTime()/
1E3)},setScrollEnabled:function(a){var b=this.getChildByName("scrview");b&&b.setEnabled(a)},update:function(){this.transitioning||(this.funcUpdate(),delete this.funcUpdate)},startMenuBtn:function(){var a=this;g.readyMenu(!0);g.addMenuItem(g.str("menu"),0,function(){g.hideBtnSound();g.stopMenu();a.startMainMenu()});g.startMenu();g.showBtnSound()},startMainMenu:function(){var a=this,b=(new LayerMsg).addBtn(g.str("chrlst"),function(){g.hakiImgs();cc.director.runScene(new SceneChara)},!1,!0).addBtn(g.str("itmlst"),
function(){g.hakiImgs();cc.director.runScene(new SceneItem)}).addBtn(g.str("snrk"),function(){b.close();a.showRecord()}).addBtn(g.str("cnfg"),function(){b.close();a.setScrollEnabled(!1);g.showSettei(function(){a.setScrollEnabled(!0);a.startMainMenu()})}).addBtn(g.str("ttl"),function(){b.close();g.stopBgm();g.hakiImgs();cc.director.runScene(new TitleScene)}).addClose(function(){a.startMenuBtn()});b.start(this.sn)},completeScript:function(){cc.log("SceneWorld#completeScrip");this.startMenuBtn()},showRecord:function(){this.setScrollEnabled(!1);
g.getCover().setOpacity(128);var a=new LayerRecord;a.setPosition(0,a.height);var b=new ccui.ScrollView;b.setDirection(ccui.ScrollView.DIR_VERTICAL);b.setBounceEnabled(!0);b.setContentSize(a.width,cc.winSize.height);b.setInnerContainerSize(a.getContentSize());var c=g.W_MENU;b.addChild(a);b.setName("layRecord");this.addChild(b);b.setPosition(cc.winSize.width-c-b.width,-cc.winSize.height);b.runAction(cc.moveBy(0.3,0,cc.winSize.height).easing(cc.easeQuadraticActionOut()));var d=this;g.readyMenu();g.addMenuItem(g.str("mdr"),
0,function(){d.hideRecord();d.startMainMenu()});g.addMenuItem(g.str("tmnm"),1,function(){d.chgNm()});g.startMenu()},hideRecord:function(){g.clearMenu();g.removeCover();g.removeByNm("layRecord");this.setScrollEnabled(!0)},chgNm:function(){var a=this,b=(new LayerMsg).addMsg(g.str("tmnmchg")).addInput("",Game.getNmTeam(),12,g.FONT_SZ_MIDIUM).addBtn("OK",function(){var c=b.getInputText();if(!(0>=c.length)){var d=a.ckNm(c);if(null!=d){var e=(new LayerMsg).addMsg(d);e.addTap(function(){e.close()});e.start()}else(new LayerMsg).confYesNo(g.str("cnfnm",
c),function(){SP.getData().nm=c;SP.saveData();b.close();a.hideRecord();a.showRecord()},function(){},g.str("nmok"),g.str("nmng"),!0,!0)}}).addBtn(g.str("mdr"),function(){b.close()});b.start(this)},ckNm:function(a){return"null"==a?g.str("nmerr"):null}});var SceneGame=cc.Scene.extend({noStg:-1,layGame:null,layMap:null,anm:{},dt:{},ctor:function(a){this._super();this.noStg=a},transitioning:!0,onEnterTransitionDidFinish:function(){this._super();this.transitioning=!1;g.setBackKey(this)},update:function(){this.transitioning||(this.funcUpdate(),delete this.funcUpdate)},onEnter:function(){this._super();var a=this,b=new LayerGame(this,cc.winSize.width,cc.winSize.height);this.addChild(b);this.layGame=b;cc.spriteFrameCache.addSpriteFrames(res.cursolPlist,
res.cursol);cc.spriteFrameCache.addSpriteFrames(res.chr0Plist,res.chr0);cc.spriteFrameCache.addSpriteFrames(res.chr1Plist,res.chr1);cc.spriteFrameCache.addSpriteFrames(res.ene0Plist,res.ene0);cc.spriteFrameCache.addSpriteFrames(res.ene1Plist,res.ene1);cc.spriteFrameCache.addSpriteFrames(res.tipUnderPlist,res.tipUnder0);cc.spriteFrameCache.addSpriteFrames(res.tipOverMiniPlist,res.tipOverMini0);cc.spriteFrameCache.addSpriteFrames(res.healPlist,res.heal);cc.spriteFrameCache.addSpriteFrames(res.swordPlist,
res.sword);cc.spriteFrameCache.addSpriteFrames(res.spearPlist,res.spear);cc.spriteFrameCache.addSpriteFrames(res.firePlist,res.fire);cc.spriteFrameCache.addSpriteFrames(res.icePlist,res.ice);cc.spriteFrameCache.addSpriteFrames(res.thunderPlist,res.thunder);cc.spriteFrameCache.addSpriteFrames(res.meteoPlist,res.meteo);cc.spriteFrameCache.addSpriteFrames(res.monsPlist,res.mons);cc.spriteFrameCache.addSpriteFrames(res.mons2Plist,res.mons2);cc.spriteFrameCache.addSpriteFrames(res.fistPlist,res.fist);
cc.spriteFrameCache.addSpriteFrames(res.crowPlist,res.crow);cc.spriteFrameCache.addSpriteFrames(res.arrowPlist,res.arrow);cc.spriteFrameCache.addSpriteFrames(res.windPlist,res.wind);cc.spriteFrameCache.addSpriteFrames(res.waterPlist,res.water);cc.spriteFrameCache.addSpriteFrames(res.effectPlist,res.effect);var c=dt.stginf[this.noStg],d=g.startLoading(this,"Loading..."),e="res/maps/";g.DBG&&g.DBG_MAP&&(e="res/maps_dbg/");b=e;0>this.noStg&&(b+="yorimichi/");for(var f=[{id:"map",src:b+c.map+".fmf",isBin:!0},
{id:"tipset",src:"res/tips/tipset0.fmf",isBin:!0},{id:"teaminf",src:b+c.id+"_tm.csv"}],h=0;h<c.teams.length;h++){var k=c.teams[h];0<k&&f.push({id:"tm"+k,src:b+c.id+"_"+k+".csv"})}for(var m=[],h=0;10>h;h++)k="tm0_"+h,f.push({id:k,src:e+k+".txt"}),m.push(k);for(h=0;h<c.scripts.length;h++)if(e=c.scripts[h])f.push({id:e,src:b+c.id+"_"+e+".txt"}),m.push(e);g.loadCsvs(f,function(b,e){cc.log("SceneGame "+b);if(null==b){a.setMoveCosts(e.tipset);delete e.tipset;var f,h,k=[],w=[],v=[],y=[],x=new DataInputStream(e.map);
x.readUnsignedInt();x.readUnsignedShort();x.readUnsignedByte();f=x.readUnsignedShort();x.readUnsignedShort();h=x.readUnsignedShort();x.readUnsignedInt();x.readUnsignedByte();var u=x.readUnsignedByte();x.readUnsignedByte();for(var z=0;z<h;z++){k.push([]);for(var A=0;A<f;A++)k[z][A]=x.readUnsignedByte()}for(z=0;z<h;z++)for(A=0;A<f;A++){var B=x.readUnsignedByte();255>B&&(v[B]={x:A,y:z})}for(z=0;z<h;z++)for(w.push([]),A=0;A<f;A++)w[z][A]=x.readUnsignedByte();if(3<u)for(z=0;z<h;z++)for(A=0;A<f;A++)B=x.readUnsignedByte(),
255>B&&(y[B]={x:A,y:z});delete e.map;a.dt.teaminf=g.csv2ary(e.teaminf,1,!0);delete e.teaminf;a.dt.teams=[];for(A=1;A<a.dt.teaminf.length;A++)a.dt.teaminf[A]&&(f=a.dt.teaminf[A].no,a.dt.teams[f]=g.csv2ary(e["tm"+f],1,!0),delete e["tm"+f]);a.dt.scripts=[];for(A=0;A<m.length;A++)f=m[A],a.dt.scripts[f]=g.kaisekiSrt(e[f]),delete e[f];k=new Map(k,w,a.dt.moveCosts,a.dt.tipInfs);w=main.initBtl(c,k,a.dt.teams,a.dt.teaminf);0>=y.length&&(w=!1);var D=main.resumeBtl();switch(dt.stginf[a.noStg].bg){case 1:case 2:case 3:A=
cc.color("#ffffff");break;default:A=cc.color(144,180,32)}a.layMap=cc.LayerColor.create(A);k.setLayer(a.layMap,a.YOHAKU_W,a.YOHAKU_H);a.initChrs(a.layMap,w,v,y,D);a.jogaiChrs();var C=new ccui.ScrollView;C.setDirection(ccui.ScrollView.DIR_BOTH);C.setContentSize(cc.winSize);C.setInnerContainerSize(cc.size(k.infLayer.width*g.SZ_MAS,k.infLayer.height*g.SZ_MAS));C.setInnerContainerPosition(cc.p(0,0));C.addChild(a.layMap);a.addChild(C);a.viewScr=C;a.initScr();C.setName("scrview");C.addEventListener(function(b,
c){c==ccui.ScrollView.EVENT_CONTAINER_MOVED&&a.setMposByView()},this);C.setVisible(!1);a.readyMiniMap();a.showAuto();a.setVisibleAuto(!1);main.startBtl();C.jumpToPercentBothDirection(cc.p(50,50));a.funcUpdate=function(){a.unscheduleUpdate();g.stopLoading(d);C.setVisible(!0);!D&&a.dt.scripts.opening?a.startScript(a.dt.scripts.opening,a.startGame):a.startGame()};a.scheduleUpdate()}})},setScrollEnabled:function(a){var b=this.getChildByName("scrview");b&&b.setEnabled(a)},isScrollEnabled:function(){var a=
this.getChildByName("scrview");return a?a.isEnabled():!1},startGame:function(){var a=main.nmStg(this.noStg),b=this;this.scrollCenter(main.map.suuMasYoko/2,main.map.suuMasTate/2,0.5,!0,function(){SP.isMsgStart()?b.layGame.showJouken(a,function(){b.startPhase()}):b.startPhase()});g.stopBgm()},finishGame:function(){},endByListChara:function(a){this.getChildByName("listChr").removeFromParent(!0);g.removeCover();this.layGame.startDownCursol();this.layGame.startClickMas();a?(this.scrollChrCenter(a,0.5),
this.layGame.startClickMove(a),this.layGame.paintCursol({x:a.x,y:a.y})):this.layGame.startClickChr()},setMoveCosts:function(a){var b=[],c=[];a=new DataInputStream(a);b.push([]);b.push([]);c.push([]);c.push([]);a.seek(276);for(var d=0;256>d;d++)c[0][d]=a.readUnsignedByte();for(d=0;256>d;d++)b[0][d]=a.readUnsignedByte();a.seek(1044);for(d=0;256>d;d++)c[1][d]=a.readUnsignedByte();for(d=0;256>d;d++)b[1][d]=a.readUnsignedByte();this.dt.moveCosts=b;this.dt.tipInfs=c},startPhase:function(){main.addVal(1,
1);g.unloadSounds();!main.getNowTeam().isCom||main.isMikata(main.btl.getPlayerTeam(),main.getNowTeam())?g.playBgm("humanPhase"):g.playBgm("comPhase");this.saveGame(2);for(var a=main.getNowTeam().getSuuMember(),b=0;b<a;b++){var c=main.getNowTeam().getMember(b);c.isEnd()?this.endChr(c):this.startChr(c)}var d=this;this.scrollChrCenter(main.getNowTeam().getLeader(),0.5,function(){var a=function(){d.showMiniMap();d.setVisibleAuto(!0);d.layGame.showHpBars();d.saveGame(1);main.getNowTeam().isManual()?(d.layGame.startClickMas(),
d.layGame.startDownCursol(),d.layGame.startClickChr()):d.autoTeam()};if(SP.isMsgTurn()){var b=[null,cc.color("#ff0000"),cc.color("#00aa00")][main.btl.phase],c=(new LayerMsg).addMsg(g.str("tn")+main.btl.getViewTurn(),null,null,null,cc.color("#000000")).addMsg(g.str("team",main.getNowTeam().nm),null,null,null,b).addMsg(g.str("stt"),null,null,null,cc.color("#000000")).addTap(function(){c.close();a()});c.start()}else a()})},termPhase:function(){cc.log("SceneGame#endPhase");for(var a=main.getNowTeam().getSuuMember(),
b=0;b<a;b++){var c=main.getNowTeam().getMember(b);c.end();this.restChr(c)}main.getNowTeam().isManual()&&(this.layGame.stopClickMas(),this.layGame.stopDownCursol(),this.layGame.stopClickChr());this.hideMiniMap();this.layGame.hideHpBars()},endPhase:function(){this.termPhase();var a=Game.getTurnLose(this.noStg);if(0<a&&main.btl.turn>=a){var b=main.btl.getPlayerTeam();this.funcLose(g.str("losetn2",a,b.nm),b.no)}else a=Game.getTurnWin(this.noStg),0<a&&main.btl.turn>=a?(main.btl.getPlayerTeam(),this.funcWin(g.str("winbcs2",
a))):main.nextPhase()&&this.startPhase()},initChrs:function(a,b,c,d,e){for(var f=main.getSuuTeam(),h=0,k=0;k<f;k++){for(var m=main.getTeam(k).getSuuMember(),n=0;n<m;n++){var p=main.getTeam(k).getMember(n);this.setCharacter(a,p);this.restChr(p);if(e)0<p.hp?this.setChrPos(p,p.x,p.y):this.setSprPos(p);else{var r;r=0<k&&b?d[h+p.no]:c[h+p.no];this.setChrPos(p,r.x,r.y)}}h+=16}},jogaiChrs:function(){for(var a=main.getSuuTeam(),b=0;b<a;b++)for(var c=main.getTeam(b).getSuuMember(),d=0;d<c;d++){var e=main.getTeam(b).getMember(d),
f=e.no;16<=f&&(f-=16);if(0>=e.hp||0==b&&SP.getData().rests[f])e.team.delMember(e),main.map.chrOff(e),e.c.removeFromParent(),d--,c--}},releaseChrs:function(){for(var a=main.getSuuTeam(),b=0;b<a;b++)for(var c=main.getTeam(b).getSuuMember(),d=0;d<c;d++){var e=main.getTeam(b).getMember(d);e.c&&e.c.release()}},setCharacter:function(a,b){var c,d=dt.jobs[b.chr.job].img;c=Number(d[1]);var e;e=d[0];d=main.map.getChrLayer(a,e);e=e+"_"+c;c=cc.Sprite.create(cc.spriteFrameCache.getSpriteFrame(e+"20"));c.setScale(g.BAI_CHR);
d.addChild(c);if(void 0==this.anm[e])for(this.anm[e]=[],d=0;4>d;d++){var f=new cc.Animation;f.addSpriteFrame(cc.spriteFrameCache.getSpriteFrame(e+d+"0"));f.addSpriteFrame(cc.spriteFrameCache.getSpriteFrame(e+d+"1"));f.addSpriteFrame(cc.spriteFrameCache.getSpriteFrame(e+d+"0"));f.addSpriteFrame(cc.spriteFrameCache.getSpriteFrame(e+d+"2"));f.setDelayPerUnit(0.5);f.setRestoreOriginalFrame(!0);f.retain();this.anm[e][d]=f}b.nm=e;b.c=c;b.c.retain();this.layGame.addHpBar(b)},setChrPos:function(a,b,c){main.map.chrOff(a);
a.setPos(b,c);main.map.chrOn(a);this.repaintMiniMapChr(a);this.setSprPos(a)},setSprPos:function(a){var b=a.c;b.getScaleX()!=g.BAI_CHR&&b.setScale(g.BAI_CHR);var c=b.height*b.getScaleY();b.setPosition(g.SZ_MAS*a.x+(g.SZ_MAS>>1),g.SZ_MAS*(main.map.suuMasTate-1-a.y)+(c>>1));this.orderZ(a)},orderZ:function(a){a.c.setLocalZOrder(10+a.y)},mukiToPos:function(a,b,c){b=JGUtil.getDirectionAngle({x:a.x,y:a.y},{x:b,y:c});a.setMuki(b);this.setMuki(a)},setMuki:function(a){var b=cc.spriteFrameCache.getSpriteFrame(a.nm+
a.getMuki()+"0");a.c.setSpriteFrame(b)},stopChrStep:function(a){a.c.stopAllActions();this.setMuki(a)},startChrStep:function(a){if(a){this.stopChrStep(a);var b;b=a.getMuki();b=cc.animate(this.anm[a.nm][b]);b=cc.repeatForever(b);b.setTag(123);a.c.runAction(b)}},endChr:function(a){this.startChrStep(a);a.c.opacity=128},startChr:function(a){this.startChrStep(a);a.c.opacity=255},restChr:function(a){this.stopChrStep(a);a.c.opacity=255},YOHAKU_W:6,YOHAKU_H:1,initScr:function(){var a=this.viewScr.getContentSize(),
b=Math.floor(a.height/g.SZ_MAS);this.wMasScr=Math.floor(a.width/g.SZ_MAS);this.hMasScr=b;this.wMasScrHalf=this.wMasScr>>1;this.hMasScrHalf=this.hMasScr>>1;this.xMasScr=main.map.infLayer.x;this.yMasScr=main.map.infLayer.y;this.topScr=this.leftScr=0},getMasPos:function(a){return{x:Math.floor(a.x/g.SZ_MAS),y:Math.floor(a.y/g.SZ_MAS)}},getMas:function(a){a=this.getMasPos(a);return main.map.isRange(a.x,a.y)?main.map.getMas(a.x,a.y):null},setMposByView:function(){var a=this.viewScr.getInnerContainerPosition(),
b=this.getMasPos(a);this.leftScr=-b.x-main.map.infLayer.x;this.topScr=-b.y-(main.map.suuMasTate+2*main.map.infLayer.y-this.hMasScr-1);this.repaintMiniMapRange(-a.x,-a.y,this.viewScr.getContentSize().width,this.viewScr.getContentSize().height)},getMposScreenLeft:function(){return this.leftScr},getMposScreenRight:function(){return this.getMposScreenLeft()+this.wMasScr-1},getMposScreenTop:function(){return this.topScr},getMposScreenBottom:function(){return this.getMposScreenTop()+this.hMasScr-1},getMposScreenCenterX:function(){return this.getMposScreenLeft()+
this.wMasScrHalf},getMposScreenCenterY:function(){return this.getMposScreenTop()+this.hMasScrHalf},scrollMapCenter:function(a,b,c,d,e,f){this.viewScr.getInnerContainerPosition();var h=this.viewScr.getInnerContainerSize(),k=this.viewScr.getContentSize();a=(a-k.width/2)/(h.width-k.width)*100;b=(b-k.height/2)/(h.height-k.height)*100;f&&(0>a&&(a=0),0>b&&(b=0),100<a&&(a=100),100<b&&(b=100));0>=c?(this.viewScr.jumpToPercentBothDirection(cc.p(a,b)),this.setMposByView()):(this.viewScr.scrollToPercentBothDirection(cc.p(a,
b),c,e),c=Game.getTm(c),this.viewScr.runAction(cc.sequence(cc.delayTime(c+0.1),cc.callFunc(function(){d&&d()}))))},stopScrollMap:function(){},isMapScrolling:function(){return!1},scrollCenter:function(a,b,c,d,e){a+=main.map.infLayer.x;b+=main.map.infLayer.y;this.scrollMapCenter(a*g.SZ_MAS,b*g.SZ_MAS,c,e,!0,d)},scrollChrCenter:function(a,b,c){this.scrollCenter(a.x,a.y,b,!0,c)},moveChr:function(a,b,c,d,e){var f=a.c,h=g.DIRS[b].x,k=g.DIRS[b].y;a.getMuki()!=b&&(a.setMuki(b),this.startChrStep(a));e||(e=
this.getMoveTime(a));e=Game.getTm(e);f.runAction(cc.sequence(cc.moveBy(e,g.SZ_MAS*h,-g.SZ_MAS*k),cc.callFunc(d)));a.x+=h;a.y+=k;this.orderZ(a);c||g.playSe("move")},getMoveTime:function(a){var b=0.1;a=a.chr.getSts(STS_MOVE);5>a&&(b+=0.1*(5-a));return b},moveChrStep:function(a,b,c,d){d||(d=this.getMoveTime(a));main.map.chrOff(a);this.moveChrStepNext(a,b,c,d)},moveChrStepNext:function(a,b,c,d){var e=a.c;if(0>=c)e.moved=null,main.map.chrOn(a),this.repaintMiniMapChr(a),this.stopChrStep(a);else{var f=this;
this.moveChr(a,b,!0,function(){f.moveChrStepNext(a,b,c-1,d)},d)}},moveChrTo:function(a,b,c,d,e){this.funcEndMove=e;var f=main.map.getRootMukis(b,c);null==f||0==f.length?e&&e():(main.map.chrOff(a),d&&this.scrollCenter(b,c,this.getMoveTime(a)*f.length+0.7,!0),this.moveChrToNext(a,f,f.length-1))},moveChrToNext:function(a,b,c){var d=this,e=c-1;this.moveChr(a,b[c],!1,function(){0>e?(main.map.chrOn(a),d.repaintMiniMapChr(a),d.funcEndMove&&d.funcEndMove()):d.moveChrToNext(a,b,e)})},isStsLeft:function(a,
b){return a.team.isCom&&!b.team.isCom},startBehave:function(a,b,c){this.layGame.pauseDownCursol();this.isStsLeft(a,b)?this.layGame.showSts(a,b):this.layGame.showSts(b,a);var d=this.layGame.winVas(this.layGame.winSts(0)),e=this.layGame.winVas(this.layGame.winSts(1)),f=this.layGame.winCov(0),h=this.layGame.winCov(1);d&&this.layGame.stopBlink(d,1);e&&this.layGame.stopBlink(e,1);f&&this.layGame.stopBlink(f,0.5);h&&this.layGame.stopBlink(h,0.5);this.mukiToPos(a,b.x,b.y);this.mukiToPos(b,a.x,a.y);this.stopChrStep(a);
main.getItmSbt(c)==C_ITM_SBT_CARE?this.startBehaveCare(a,b,c):this.startBehaveAtk(a,b,c)},animAtkAndDmg:function(a,b,c,d,e,f,h){this.scrollChrCenter(a,0.2);d=-d;var k=a.c,m=b.c,n=this;this.startChrStep(a);var p=cc.sequence(cc.moveBy(0.05,c,d),cc.moveBy(0.05,-c,-d),cc.callFunc(function(){n.stopChrStep(a);var k;k=n.layGame.startEffect(e,m);k=Game.getTm(k/1E3);k=0==f?cc.sequence(cc.delayTime(k),cc.callFunc(function(){n.layGame.startNumEffect(main.map.getLayUi(n.layMap),0,m.x,m.y)},this),cc.callFunc(h,
this)):0>=f?cc.sequence(cc.delayTime(k),cc.callFunc(h,this)):cc.sequence(cc.delayTime(k),cc.callFunc(function(){g.playSe("dmg");b.decHp(f);n.layGame.repaintHpBar(b,500);n.layGame.repaintStsHps();n.layGame.startNumEffect(main.map.getLayUi(n.layMap),-f,m.x,m.y);var a=m.getPosition();m.setPosition(cc.p(a.x+c,a.y+d))},this),cc.moveBy(0.5,-c,-d).easing(cc.easeElasticOut(3)),cc.callFunc(h,this));m.runAction(k)},this));k.runAction(p)},startBehaveAtk:function(a,b,c){var d=a.chr.getDamageAndBai(b.chr,c);this.layGame.setVisibleDownCursol(!1);
var e=this,f=function(f){1<d.suu?e.animAtkAndDmg(a,b,h.x,h.y,c,d.val,function(){0<d.val&&e.addExpAfterAtk(a,b);0>=b.hp?e.dead(b,function(){e.afterBehave(a,b)},a):e.waitAfterBehave(a,b,0.3)}):null!=f&&1<f.suu?e.animAtkAndDmg(b,a,-h.x,-h.y,f.itm,f.val,function(){0<f.val&&e.addExpAfterAtk(b,a);0>=a.hp?e.dead(a,function(){e.afterBehave(a,b)},b):e.waitAfterBehave(a,b,0.3)}):e.waitAfterBehave(a,b,0.3)},h=JGUtil.getMovePoint({x:b.x*g.SZ_MAS,y:b.y*g.SZ_MAS},{x:a.x*g.SZ_MAS,y:a.y*g.SZ_MAS},1,g.SZ_MAS>>1);
this.animAtkAndDmg(a,b,h.x,h.y,c,d.val,function(){0<d.val&&e.addExpAfterAtk(a,b);if(0>=b.hp)e.dead(b,function(){e.afterBehave(a,b)},a);else{var c=function(c){e.layGame.repaintYosou(e.layGame,a,c,null,e.isStsLeft(a,b));e.animAtkAndDmg(b,a,-h.x,-h.y,c.itm,c.val,function(){0<c.val&&e.addExpAfterAtk(b,a);0>=a.hp?e.dead(a,function(){e.afterBehave(a,b)},b):f(c)})},m=function(){var e=main.getItmAtkToTarget(b,a);null!=e&&0<=e.itm?c(e):f(d)};if(b.team.isManual()){var n=main.getItmsToTarget(b,a);if(0<n.length){var p=
SP.getTypeAuto();if(0==p||1<n.length&&1==p){this.layGame.setVisibleDownCursol(!0);e.layGame.startSelItm0(b,a,n,function(d){e.layGame.setVisibleDownCursol(!1);d=b.chr.getDamageAndBai(a.chr,n[d]);c(d)},function(){e.layGame.setVisibleDownCursol(!1);f(d)},function(){e.layGame.setVisibleDownCursol(!1);m()});return}}}this.scheduleOnce(function(){m()},0.3)}})},startBehaveCare:function(a,b,c){this.scrollChrCenter(a,0.2);var d=a.chr.getDamageAndBai(b.chr,c),e=this;this.stopChrStep(b);this.layGame.setVisibleDownCursol(!1);
var f=function(){var b=a.getMuki()+1;4<=b&&(b=0);a.setMuki(b);e.setMuki(a)},h=0.1,h=Game.getTm(h),f=cc.sequence(cc.delayTime(h),cc.callFunc(f,this),cc.delayTime(h),cc.callFunc(f,this),cc.delayTime(h),cc.callFunc(f,this),cc.delayTime(h),cc.callFunc(f,this),cc.callFunc(function(){h=e.layGame.startEffect(c,b.c)/1E3;h=Game.getTm(h);var f=cc.sequence(cc.delayTime(h),cc.callFunc(function(){var c=b.incHp(d.val);e.layGame.repaintHpBar(b,500);e.layGame.repaintStsHps();e.addExpAfterCare(a,b,c,d.val);e.layGame.startNumEffect(main.map.getLayUi(e.layMap),
d.val,b.c.x,b.c.y);h=Game.getTm(0.1);c=cc.sequence(cc.moveBy(h,0,8).easing(cc.easeSineOut()),cc.moveBy(h,0,-8).easing(cc.easeSineIn()),cc.moveBy(h,0,8).easing(cc.easeSineOut()),cc.moveBy(h,0,-8).easing(cc.easeSineIn()),cc.callFunc(function(){e.startChrStep(b);e.afterBehave(a,b)},this));b.c.runAction(c)}));b.c.runAction(f)},this));a.c.runAction(f)},afterBehave:function(a,b){this.layGame.hideWinSts();cc.log("SceneGame#afterBehave","manual\x3d"+main.getNowTeam().isManual());var c=this;this.checkLvup(a,
b,function(){c.checkDieLeader(a);c.checkDieLeader(b);c.compChr()})},waitAfterBehave:function(a,b,c){var d=this;this.scheduleOnce(function(){d.afterBehave(a,b)},0.5)},checkDieLeader:function(a){var b=a.team.lose;cc.log("SceneGame#checkDieLeader team\x3d"+a.team.no+" jknLose\x3d"+b);switch(b){case 0:if(!a.leader||0<a.hp)return!1;break;case 1:if(0<a.team.getSuuMember())return!1;break;case 2:if(!a.team.isLose())return!1;break;default:return!1}for(b=a.team.getSuuMember()-1;0<=b;b--){var c=a.team.getMember(b);
0>=c.hp||this.delBattler(c)}a.team.setLose(!0);return!0},dead:function(a,b,c){var d=this,e=!1,f=function(){a.team.isCom&&c&&!c.team.isCom&&(main.addVal(2,a.chr.lv),SP.incDefeat(a.chr.job));a.flgSkipAnm||g.playSe("dead");e?d.delBattler(a,function(){g.viewMsg(g.str("lvhalf"),function(){g.anmClrMsg();b()},"win")}):d.delBattler(a,b);2==a.team.lose&&a.team.setLose(!0)};if(0<SP.getData().mode&&!a.team.isCom){if(1<a.chr.lv){var h=Math.ceil(a.chr.lv/2);a.chr.setLv(h);e=!0}SP.getData().chrs[a.no].hp=a.chr.getSts(STS_MHP)}h=
"tm"+a.team.tmSrt+"_"+a.no;this.dt.scripts[h]?this.startScript(this.dt.scripts[h],f,c):f()},delBattler:function(a,b){a.team.delMember(a);main.map.chrOff(a);this.repaintMiniMapChr(a);this.layGame.hideHpBar(a);if(a.flgSkipAnm)a.c.removeFromParent(),b&&b();else{var c=Game.getTm(0.3);a.c.runAction(cc.sequence(cc.spawn(cc.fadeOut(c),cc.scaleTo(c,0,9),cc.moveBy(c,0,100)),cc.callFunc(function(){a.c.removeFromParent();b&&b()},this)))}},recovBattler:function(a,b){var c=main.getTeam(a).recovMember(b);if(!c)return!1;
c.hp=c.chr.getSts(STS_MHP);main.map.chrOn(c);c.c.setScale(g.BAI_CHR);c.c.setPosition(c.c.x,c.c.y);c.c.setOpacity(255);main.map.getChrLayer(this.layMap,dt.jobs[c.chr.job].img[0]).addChild(c.c);return c},term:function(){main.getNowTeam().isManual()&&(this.layGame.stopClickMas(),this.layGame.stopDownCursol(),this.layGame.stopClickChr());this.hideMiniMap();this.setVisibleAuto(!1);this.layGame.hideHpBars()},funcLose:function(a,b){var c=this;this.term();g.pauseBgm();g.playSe("lose");this.viewMsg(a,function(){c.backToCamp()},
"win"+b)},funcWin:function(a){this.term();var b=this,c="";g.pauseBgm();g.playSe("win");var d=main.btl.getPlayerTeam(),c=c+("\n"+g.str("expget")+d.exps),e=function(){0<=b.noStg&&2>b.noStg?SP.getData().posNow=2:(SP.getData().posNow=b.noStg,0<=b.noStg?SP.getData().sumiPoss[b.noStg]=!0:SP.getData().sumiSubs[-b.noStg]=!0);SP.updateEncs();b.needAd=!0;b.backToCamp()},f=(new LayerMsg).addMsg(g.str("winbcs",a,d.nm)).addMsg(c).addTap(function(){f.close();b.readyEvent();b.dt.scripts.ending?(main.haneiHps(),
b.startScript(b.dt.scripts.ending,e)):e()});f.start()},compChr:function(){this.chrNow.end();this.endChr(this.chrNow);for(var a,b=main.btl.getPlayerTeam(),c=!1,d=dt.stginf[this.noStg].lose,e=0;!c&&e<d.length;e++)switch(d[e]){case 0:b.isLose()&&(c=!0);break;case 1:for(var f=main.getSuuTeam(),h=0;h<f;h++)if(a=main.getTeam(h),main.isMikata(b,a)&&a.isLose()){c=!0;break}}if(c)this.funcLose(g.str("losetn",main.btl.turn,b.nm),b.no);else{b=!1;c=dt.stginf[this.noStg].win;for(e=0;!b&&e<c.length;e++)switch(c[e]){case 0:f=
main.getSuuTeam();d=main.btl.getPlayerTeam();for(h=0;h<f&&(a=main.getTeam(h),a.no==d.no||main.isMikata(d,a)||a.isLose());h++);h>=f&&(b=!0);break;case 1:f=main.getSuuTeam();d=main.btl.getPlayerTeam();for(h=0;h<f;h++)if(a=main.getTeam(h),a.no!=d.no&&!main.isMikata(d,a)&&a.isLose()){b=!0;break}break;case 2:a=main.getTeam(1);a.isLose()&&(b=!0);break;case 3:a=main.getTeam(2),a.isLose()&&(b=!0)}b?this.funcWin(g.str("winbcs1",main.btl.turn)):null==main.getNextChr()?this.endPhase():(this.saveGame(1),main.getNowTeam().isManual()?
(this.layGame.startClickMas(),this.layGame.startDownCursol(),this.layGame.startClickChr()):this.autoTeam())}},autoTeam:function(){main.btl.autoTeam(main.btl.phase)?this.autoChr(main.btl.runCom1):this.endPhase()},autoChr:function(a){var b=this;this.chrNow=a.chara;var c;c=Game.getTm(1);var d=Game.getTm(0.5);a.chara.c.runAction(cc.sequence(cc.delayTime(c),cc.callFunc(function(){b.scrollChrCenter(a.chara,0.5);b.layGame.viewMoveRange(a.chara)}),cc.delayTime(d),cc.callFunc(function(){b.autoChrMove(a)})))},
autoChrMove:function(a){var b=this;b.moveChrTo(a.chara,a.mas.x,a.mas.y,!0,function(){b.layGame.viewTargetRange(a.chara);var c;c=Game.getTm(0.5);a.chara.c.runAction(cc.sequence(cc.delayTime(c),cc.callFunc(function(){b.behaveOrComp(a)})))})},behaveOrComp:function(a){this.layGame.clearMass();0>a.itemNo?this.compChr():this.startBehave(a.chara,a.aite,a.chara.chr.itms[a.itemNo])},backToCamp:function(){0<=SP.getData().posNow&&2>SP.getData().posNow&&(SP.getData().posNow=2);SP.getData().noStg="";main.haneiHps();
SP.saveData();this.releaseMinimap();this.showAdOrHyouka()||this.runSceneWorld()},runSceneWorld:function(){cc.spriteFrameCache.removeSpriteFrames();for(var a in this.anm){for(var b in this.anm[a])this.anm[a][b].release();delete this.anm[a]}this.layGame.releaseAnms();this.releaseChrs();g.unloadSounds();cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneWorld))},showAdOrHyouka:function(){if(!g.DBG&&!g.isApp()||Game.getSuuClrStg()<g.SUU_WIN_HYOUKA)return!1;var a=this;if(!SP.isSumiHyouka()){var b=
(new LayerMsg).addMsg(g.str("hyouka_title")).addBtn(g.str("hyouka0"),function(){b.close();SP.setSumiHyouka(!0);g.openURL(cc.sys.os==cc.sys.OS_IOS?g.URL_STORE_IOS:g.URL_STORE);var c=g.startLoading(a,"Loading...");a.scheduleOnce(function(){g.stopLoading(c);(new LayerMsg).addMsg(g.str("thank_hyouka")).addTap(function(){a.runSceneWorld()}).start(a)},1.5)}).addBtn(g.str("hyouka1"),function(){b.close();SP.setSumiHyouka(!0);a.runSceneWorld()});b.start(this);return!0}cc.log("SceneGame#showAdOrHyouka","waitAd\x3d"+
g.waitAd);g.waitAd--;if(0<g.waitAd)return!1;var c=g.startLoading(this,"Loading...");a.scheduleOnce(function(){g.showInters(function(b){cc.log("SceneGame#showAdOrHyouka","callback inters\x3d"+b);g.stopLoading(c);"error"!=b&&(g.waitAd=3);g.restartBgm();a.runSceneWorld()})?g.pauseBgm():(g.stopLoading(c),a.runSceneWorld())},1);return!0},saveGame:function(a){SP.getTypePause()==a&&SP.saveData(SP.no,this.noStg)},addExp:function(a,b){a.chr.exp+=b;a.team.exps+=b;a.team.isCom||main.addVal(3,b);this.layGame.repaintStsExps()},
addExpAfterAtk:function(a,b){var c=a.chr.getExpAtk(b.chr);0>=b.hp&&(c+=a.chr.getExpDefeat(b.chr));this.addExp(a,c)},addExpAfterCare:function(a,b,c,d){b=a.chr.getExpCare(b.chr,c,d);this.addExp(a,b)},checkLvup:function(a,b,c){var d=this;this.viewLvup(a,function(){d.viewLvup(b,c)})},viewLvup:function(a,b){var c=a.chr.checkLvup();a.team.isCom&&0>=a.hp&&(c=null);if(c){var d=SP.getShowLvup();g.playSe("lvup");var e="";if(2==d&&0==a.team.no)for(var f=0;f<c.length;f++)0>=c[f]||(e+="\n"+g.str("stsup",NM_STSS[f],
c[f]));0==d?b():g.viewMsg(g.str("lvup",a.chr.nm,a.chr.lv)+e,function(){g.anmClrMsg();b()},"win"+a.team.no)}else b&&b()},viewMsg:function(a,b,c,d,e,f){d=null;"win1"==c&&(d=cc.color("#ff0000"));"win2"==c&&(d=cc.color("#00aa00"));var h=(new LayerMsg).addMsg(a,null,null,null,d).addTap(function(){h.close();b()});h.start()},showAuto:function(){var a;a=this.getChildByName("btnAuto");if(!a){var b=this;a=g.getImgBtn(this,res.btn_auto,res.btn_auto_p,function(){SP.setFullAuto(!SP.isFullAuto());b.showAuto()});
a.setAnchorPoint(1,1);a.setPosition(cc.winSize.width-8,cc.winSize.height-8);a.setName("btnAuto");this.addChild(a,9999)}if(SP.isFullAuto()){var c;c=this.getChildByName("lblAuto");c||(c=g.getLabel("Full auto",cc.color("#ffffff"),cc.color("#000000"),cc.color("#000000"),null,cc.TEXT_ALIGNMENT_RIGHT),c.setPosition(a.x-a.width-8,a.y-a.height/2),c.setName("lblAuto"),this.addChild(c,0))}else g.removeByNm("lblAuto",this)},setVisibleAuto:function(a){var b=this.getChildByName("btnAuto");b&&b.setVisible(a);(b=
this.getChildByName("lblAuto"))&&b.setVisible(a)},TAG_MINI_MAP:123,TAG_MINI_MAP_OPEN:124,TAG_MINI_MAP_CLOSE:125,readyMiniMap:function(){var a=new LayerMinimap(main.map,8);a.setVisible(!1);this.addChild(a,0,this.TAG_MINI_MAP);var b=this,a=g.getImgBtn(this,res.btn_map,res.btn_map_p,function(){b.showMiniMap(!0)});a.setAnchorPoint(0,0);a.setVisible(!1);this.addChild(a,0,this.TAG_MINI_MAP_OPEN);a=g.getImgBtn(this,res.ic_arrow,null,function(){b.hideMiniMap(!0)});a.setRotation(180);a.setVisible(!1);this.addChild(a,
0,this.TAG_MINI_MAP_CLOSE)},releaseMinimap:function(){var a=this.getChildByTag(this.TAG_MINI_MAP);a&&a.removeFromParent()},showMiniMap:function(a){var b=this.getChildByTag(this.TAG_MINI_MAP);b.setVisible(!0);this.hideMiniMapOpen();if(a){var c=this;b.setPosition(-b.width,-b.height);b.runAction(cc.sequence(cc.moveTo(0.2,4,4).easing(cc.easeSineOut()),cc.callFunc(function(){c.showMiniMapClose(b,4)})));SP.setMiniMap(!0)}else SP.getMiniMap()?(b.setPosition(4,4),this.showMiniMapClose(b,4)):(this.hideMiniMap(),
this.showMiniMapOpen(8))},hideMiniMap:function(a){this.hideMiniMapClose();var b=this.getChildByTag(this.TAG_MINI_MAP);if(a){var c=this;b.runAction(cc.sequence(cc.moveTo(0.2,-b.width,-b.height),cc.callFunc(function(){b.setVisible(!1);c.showMiniMapOpen(8)})));SP.setMiniMap(!1)}else b.setVisible(!1),this.hideMiniMapOpen()},showMiniMapOpen:function(a){var b=this.getChildByTag(this.TAG_MINI_MAP_OPEN);b.setPosition(a,a);b.setVisible(!0)},hideMiniMapOpen:function(){this.getChildByTag(this.TAG_MINI_MAP_OPEN).setVisible(!1)},
showMiniMapClose:function(a,b){var c=this.getChildByTag(this.TAG_MINI_MAP_CLOSE);c.setPosition(a.x+a.width+c.width/2,a.y+c.height/2+b);c.setVisible(!0)},hideMiniMapClose:function(){this.getChildByTag(this.TAG_MINI_MAP_CLOSE).setVisible(!1)},repaintMiniMapChr:function(a){var b=this.getChildByTag(this.TAG_MINI_MAP);b&&b.repaintChr(a)},repaintMiniMapRange:function(a,b,c,d){var e=this.getChildByTag(this.TAG_MINI_MAP);e&&e.repaintRange(a,b,c,d)},repaintMiniMapCur:function(a,b){var c=this.getChildByTag(this.TAG_MINI_MAP);
c&&c.repaintCur(a,b)},startScript:function(a,b,c){this.funcAfterScript=b;this.script=new Script(a,this,this,null,c)},completeScript:function(){this.funcAfterScript()},readyEvent:function(){for(var a=0;a<main.getSuuTeam();a++)for(var b=0;b<main.getTeam(a).getSuuMember(a);b++){var c=main.getTeam(a).getMember(b);c.c.setOpacity(255);this.stopChrStep(c)}}});var LayerGame=cc.Layer.extend({anm:{},updates:[],ctor:function(a,b,c){this._super();this.sn=a;this.width=b;this.height=c;this.schedule(this.updateClick,1/60)},updateClick:function(a){g.DBG&&(0.016>a||0.1<a)&&cc.log("LayerGame#updateClick delta\x3d"+a);this.updateDownCursol();this.updateClickChr();this.updateClickMove();this.updateClickTarget();this.doUpdates()},doUpdates:function(){for(var a=0;a<this.updates.length;a++)this.updates[a].func()},addUpdates:function(a,b){this.delUpdates(a);this.updates.push({tag:a,
func:b});cc.log("LayerGame#addUpdates tag\x3d"+a+" suu\x3d"+this.updates.length)},delUpdates:function(a){for(var b in this.updates)if(this.updates[b].tag==a){this.updates.splice(b,1);break}},paintMas:function(a,b,c){var d=cc.Sprite.create(res.mas);d.setColor(b);d.setOpacity(128);d.setPosition(g.SZ_MAS*a.x+g.SZ_MAS/2,g.SZ_MAS*(main.map.suuMasTate-1-a.y)+g.SZ_MAS/2);d.setName("mas"+c);main.map.getLayWork(this.sn.layMap).addChild(d)},paintMass:function(a,b){for(var c in a)this.paintMas(a[c],b,c)},paintMasCols:function(a,
b){var c=[cc.color(255,0,0),cc.color(0,0,255),cc.color(200,0,200)],d;for(d in a)this.paintMas(a[d],c[b[d]],d)},clearMass:function(){for(var a=main.map.getLayWork(this.sn.layMap),b=0;999>b;b++){var c=a.getChildByName("mas"+b);if(!c)break;c.removeFromParent()}},initClickMas:function(){this.masClicked=this.masDown=null;delete this.tapPos},startClickMas:function(){this.stopClickMas();main.map.getLayUnder(this.sn.layMap);var a=this,b=function(b){b.y=main.map.suuMasTate*g.SZ_MAS-b.y;b=a.sn.getMas(b);b!=
a.masDown&&(a.masClicked=null,a.masDown=b)};this.lisClickMas=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,onTouchBegan:function(c,d){var e=d.getCurrentTarget().convertToNodeSpace(c.getLocation());b(e);a.isClickMove&&null!=a.masDown&&0<=a.masDown.amount&&a.sn.setScrollEnabled(!1);a.isClickTarget&&null!=a.masDown&&(e=g.getKyori(a.sn.chrNow.x,a.sn.chrNow.y,a.masDown.x,a.masDown.y),a.sn.chrNow.chr.ariWeapon(e)&&a.sn.setScrollEnabled(!1));a.isClickChr&&null!=a.masDown&&a.masDown.chr&&
a.sn.setScrollEnabled(!1);return!0},onTouchMoved:function(c,d){if(!a.sn.isScrollEnabled()&&(a.isClickMove||a.isClickTarget||a.isClickChr)){var e=d.getCurrentTarget().convertToNodeSpace(c.getLocation());b(e)}},onTouchEnded:function(b,d){void 0==a.xCur||0>a.xCur||0>a.yCur||(a.masClicked=main.map.getMas(a.xCur,a.yCur),a.masDown=null,delete a.tapPos);a.sn.setScrollEnabled(!0)},onTouchCancelled:function(b,d){a.sn.setScrollEnabled(!0)}});cc.eventManager.addListener(this.lisClickMas,this.sn.layMap)},stopClickMas:function(){this.lisClickMas&&
(cc.eventManager.removeListener(this.lisClickMas),delete this.lisClickMas)},showOrHideSts:function(){this.masDown&&this.masDown.chr?this.showSts(this.masDown.chr,null,!0):this.hideWinSts()},showOrHideStsBtl:function(){this.masDown&&this.masDown.chr?this.showSts(this.masDown.chr,this.sn.chrNow,!0):this.hideWinSts()},startDownCursol:function(){cc.log("LayerGame#startDownCursol");this.stopDownCursol();this.isDownCursol=!0;this.yCur=this.xCur=-1;this.readyCursol();this.paintCursol()},stopDownCursol:function(){cc.log("LayerGame#stopDownCursol");
this.isDownCursol=!1;this.eraseCursol()},pauseDownCursol:function(){this.isDownCursol=!1},resumeDownCursol:function(){this.isDownCursol=!0},setVisibleDownCursol:function(a){if(this.isCursol){var b=this.getSprCur();b&&b.setVisible(a)}},updateDownCursol:function(){if(this.isDownCursol)if(this.masClicked&&(this.masClicked.chr||this.hideWinSts(),this.hideGeo()),!this.masDown)this.yCur=this.xCur=-1;else if(this.xCur!=this.masDown.x||this.yCur!=this.masDown.y)this.xCur=this.masDown.x,this.yCur=this.masDown.y,
this.paintCursol(),this.showGeo(this.xCur,this.yCur)},readyCursol:function(){this.curAnm||(this.curAnm=g.makeAnimation("curs",0.1),cc.log("LayerGame#readyCursol curAnm\x3d"+this.curAnm));this.isCursol=!0;var a=main.map.getLayUi(this.sn.layMap),b=a.getChildByName("cursol");b?this.setVisibleDownCursol(!0):(b=cc.Sprite.create(),b.runAction(cc.repeatForever(cc.animate(this.curAnm))),b.setName("cursol"),a.addChild(b))},getSprCur:function(){return main.map.getLayUi(this.sn.layMap).getChildByName("cursol")},
paintCursol:function(a){a&&(this.xCur=a.x,this.yCur=a.y);if(a=this.getSprCur())a.setVisible(main.map.isRange(this.xCur,this.yCur)),a.setPosition(g.SZ_MAS*this.xCur+g.SZ_MAS/2,g.SZ_MAS*(main.map.suuMasTate-1-this.yCur)+g.SZ_MAS/2);this.sn.repaintMiniMapCur(this.xCur,this.yCur)},eraseCursol:function(){this.setVisibleDownCursol(!1);this.isCursol=!1;this.sn.repaintMiniMapCur(-1)},startClickChr:function(){this.initClickMas();var a=this,b=function(){a.isClickChr=!0;g.readyMenu(!0);g.addMenuItem(g.str("menu"),
"btnMenu");g.addMenuItem(g.str("tnend"),"btnComp");g.addMenuItem(g.str("nxtchr"),"btnNext");delete a.tagSelectedBtn;g.startMenu()};SP.sumiTuto(0)?b():g.viewMsg("\\C[green]"+g.str("ttrl")+"\\C\n"+g.str("ttrl1"),function(){g.anmClrMsg();b()},"win")},stopClickChr:function(){this.isClickChr=!1;this.sn.setScrollEnabled(!0);g.stopMenu()},selectChrNext:function(){var a=main.getNextChr();this.sn.scrollChrCenter(a,0.5);this.startClickMove(a);this.paintCursol({x:a.x,y:a.y})},updateClickChr:function(){if(this.isClickChr)if(void 0==
this.tagSelectedBtn&&(this.tagSelectedBtn=g.getSelectedMenu()),"btnNext"==this.tagSelectedBtn)this.stopClickChr(),g.stopMenu(),this.selectChrNext();else if("btnComp"==this.tagSelectedBtn){this.stopClickChr();g.stopMenu();var a=this;(new LayerMsg).confYesNo(g.str("cnftnend"),function(){a.sn.endPhase()},function(){a.startClickChr()},"OK",g.str("cancel"),!0,!0)}else"btnMenu"==this.tagSelectedBtn?(this.stopClickChr(),g.stopMenu(),this.startMainMenu()):SP.isFullAuto()?(this.stopClickMas(),this.stopDownCursol(),
this.stopClickChr(),g.stopMenu(),this.sn.autoTeam()):(this.showOrHideSts(),this.masClicked&&this.masClicked.chr&&(this.stopClickChr(),g.stopMenu(),this.startClickMove(this.masClicked.chr)))},startClickMove:function(a){this.sn.chrNow=a;this.svChrNowX=a.x;this.svChrNowY=a.y;this.initClickMas();this.viewMoveRange(a);var b=this,c=function(){b.isClickMove=!0;g.readyMenu(!0);g.addMenuItem(g.str("cancel"),"btnCancel");b.sn.chrNow.isAct()&&(g.addMenuItem(g.str("auto"),"btnAuto"),g.addMenuItem(g.str("nxtchr"),
"btnNext"));delete b.tagSelectedBtn;g.startMenu()};a.team.isManual()&&!SP.sumiTuto(0)?g.viewMsg("\\C[green]"+g.str("ttrl")+"\\C\n"+g.str("ttrl2"),function(){g.anmClrMsg();c()},"win"):c()},viewMoveRange:function(a){this.clearMass();a=main.map.setMoveMas(a.x,a.y,a,a.chr.getSts(STS_MOVE));this.paintMass(a,cc.color(0,255,255))},stopClickMove:function(){this.isClickMove=!1;this.sn.setScrollEnabled(!0)},updateClickMove:function(){if(this.isClickMove)if(void 0==this.tagSelectedBtn&&(this.tagSelectedBtn=
g.getSelectedMenu()),"btnNext"==this.tagSelectedBtn)this.stopClickMove(),g.stopMenu(),this.clearMass(),this.hideWinSts(),this.selectChrNext();else if("btnAuto"==this.tagSelectedBtn)this.stopClickMove(),g.stopMenu(),this.hideWinSts(),main.btl.autoChr1(this.sn.chrNow)?this.sn.autoChrMove(main.btl.runCom1):(this.clearMass(),this.sn.compChr());else if("btnCancel"==this.tagSelectedBtn)this.stopClickMove(),g.stopMenu(),this.clearMass(),this.hideWinSts(),this.startClickChr();else if(SP.isFullAuto())this.stopClickMove(),
g.stopMenu(),this.clearMass(),this.hideWinSts(),this.sn.autoTeam();else if(this.showOrHideSts(),this.masClicked)if(this.stopClickMove(),g.stopMenu(),this.clearMass(),this.masClicked.chr&&this.masClicked.chr!=this.sn.chrNow)this.startClickMove(this.masClicked.chr);else if(0>this.masClicked.amount||!this.sn.chrNow.isAct())this.startClickChr();else{var a=this;this.sn.moveChrTo(this.sn.chrNow,this.masClicked.x,this.masClicked.y,!0,function(){a.startClickTarget(a.sn.chrNow)})}},startClickTarget:function(a){this.initClickMas();
this.viewTargetRange(a);var b=this,c=function(){b.isClickTarget=!0;g.readyMenu(!0);g.addMenuItem(g.str("cancel"),"moveCancel");g.addMenuItem(g.str("cmpact"),"moveEnd");g.addMenuItem(g.str("auto"),"moveAuto");delete b.tagSelectedBtn;g.startMenu()};a.team.isManual()&&!SP.sumiTuto(0)?g.viewMsg("\\C[green]"+g.str("ttrl")+"\\C\n"+g.str("ttrl3"),function(){g.anmClrMsg();c()},"win"):c()},viewTargetRange:function(a){this.clearMass();a=main.map.setTargetMas(a.x,a.y,a);this.paintMasCols(a.mass,a.cols)},stopClickTarget:function(){this.isClickTarget=
!1;this.sn.setScrollEnabled(!0);this.clearMass()},updateClickTarget:function(){if(this.isClickTarget)if(void 0==this.tagSelectedBtn&&(this.tagSelectedBtn=g.getSelectedMenu()),"moveAuto"==this.tagSelectedBtn)this.stopClickTarget(),g.stopMenu(),main.btl.autoChr1(this.sn.chrNow,!0)?this.sn.behaveOrComp(main.btl.runCom1):this.sn.compChr();else if("moveEnd"==this.tagSelectedBtn)SP.setSumiTuto(0,!0),this.stopClickTarget(),g.stopMenu(),this.sn.compChr();else if("moveCancel"==this.tagSelectedBtn)this.stopClickTarget(),
g.stopMenu(),this.sn.setChrPos(this.sn.chrNow,this.svChrNowX,this.svChrNowY),this.startClickMove(this.sn.chrNow),this.sn.scrollChrCenter(this.sn.chrNow,0.5),this.paintCursol({x:this.sn.chrNow.x,y:this.sn.chrNow.y});else if(SP.isFullAuto())this.stopClickTarget(),g.stopMenu(),this.sn.setChrPos(this.sn.chrNow,this.svChrNowX,this.svChrNowY),this.sn.autoTeam();else if(this.masDown&&this.masDown.chr&&this.masDown.chr!=this.shownChr&&main.isOkTarget(this.sn.chrNow,this.masDown.chr)&&this.showOrHideStsBtl(),
this.masClicked)if(this.masClicked.chr&&main.isOkTarget(this.sn.chrNow,this.masClicked.chr)){g.stopMenu();SP.setSumiTuto(0,!0);var a=main.getItmsToTarget(this.sn.chrNow,this.masClicked.chr);1==a.length&&0<SP.getTypeAuto()?(this.stopClickTarget(),this.pauseDownCursol(),this.sn.startBehave(this.sn.chrNow,this.masClicked.chr,a[0])):2==SP.getTypeAuto()?(this.stopClickTarget(),this.pauseDownCursol(),this.goAuto(this.sn.chrNow,this.masClicked.chr)):(this.startSelItm(this.sn.chrNow,this.masClicked.chr,a),
this.initClickMas())}else this.stopSelItm(),this.stopClickTarget(),this.startClickTarget(this.sn.chrNow),this.showOrHideSts()},startSelItm:function(a,b,c){this.stopSelItm();var d=this,e=function(){d.startSelItm0(a,b,c,function(e){d.stopClickTarget();d.pauseDownCursol();d.sn.startBehave(a,b,c[e])},function(){d.stopClickTarget();d.showOrHideStsBtl();d.startDownCursol();d.startClickTarget(a)},function(){d.stopClickTarget();d.pauseDownCursol();d.goAuto(a,b)})};a.team.isManual()&&!SP.sumiTuto(1)?(this.isClickTarget=
!1,g.viewMsg("\\C[green]"+g.str("ttrl")+"\\C\n"+g.str("ttrl4"),function(){g.anmClrMsg();d.isClickTarget=!0;e()},"win")):e()},goAuto:function(a,b){var c=main.getItmAtkToTarget(a,b);this.repaintYosou(this,b,c,null,!0);this.sn.startBehave(a,b,c.itm)},startSelItm0:function(a,b,c,d,e,f){var h=a==b,k=this;g.stopMenu();this.winItms(1).startSelect(function(d){k.needRepaintYosou={battler:a,aite:b,itm:c[d],pos:d}},function(a){k.tagSelectedBtn=a},function(a){});if(!h){var m=this.winVas(this.winSts(1));this.stopBlink(m,
1);m=this.winCov(0);this.stopBlink(m,0.5)}(m=this.winCov(1))&&m.parent&&m.removeFromParent();(m=this.winVas(this.winSts(0)))&&m.parent&&m.removeFromParent();h||this.winSts(1).setOpacity(128);(h=this.winItms(0))&&h.setOpacity(128);if(f||e)g.readyMenu(!0),e&&g.addMenuItem(g.str("cancel"),"cancel"),f&&g.addMenuItem(g.str("auto"),"auto"),delete this.tagSelectedBtn,g.startMenu();this.addUpdates("startSelItm0",function(){if(k.needRepaintYosou){var a=k.needRepaintYosou.aite;k.repaintYosou(k,a,k.needRepaintYosou.battler.chr.getDamageAndBai(a.chr,
k.needRepaintYosou.itm),k.needRepaintYosou.pos,!0);delete k.needRepaintYosou}void 0==k.tagSelectedBtn&&(k.tagSelectedBtn=g.getSelectedMenu());void 0!=k.tagSelectedBtn&&(a=k.tagSelectedBtn,k.stopSelItm(),"auto"==a?(SP.setSumiTuto(1,!0),f()):"cancel"==a?e():(a=Number(a),SP.setSumiTuto(1,!0),d(a)))})},stopSelItm:function(){this.delUpdates("startSelItm0");g.stopMenu();this.winItms(1)&&this.winItms(1).endSelect();var a=this.winSts(1);a&&a.setOpacity(255);(a=this.winItms(0))&&a.setOpacity(255)},repaintYosou:function(a,
b,c,d,e){var f,h,k,m;e?(f=a.winSts(0),h=a.winItms(1)):(f=a.winSts(1),h=a.winItms(0));k=h.getChildren();m=h.winCov();var n;if(null==d&&c)for(d=0;d<k.length;d++){if(k[d].itm==c.itm){n=k[d];break}}else n=k[d];f.removeFromParent();a.showStsVertical(b,c,e?"left":"right");m&&m.getParent()&&m.removeFromParent();h.setWinItmCov(n)},startNumEffect:function(a,b,c,d){var e=""+b;0<b&&(e="+"+e);b=0<b?cc.color(0,255,255):cc.color(255,0,0);var f=g.getLabel(e,b,cc.color(0,0,0),null,48);f.setPosition(c,d);f.runAction(cc.sequence(cc.moveBy(Game.getTm(0.5),
0,g.NY).easing(cc.easeSineOut()),cc.delayTime(Game.getTm(0.4)),cc.callFunc(function(){f.removeFromParent()})));a.addChild(f,1E4)},startEffect:function(a,b){var c=dt.itms[a].asrt,d=dt.itms[a].zoku,e=0;if("book"==c||"mon2"==c)c=d;return e=this.setEffect(b,c)},setEffect:function(a,b){return tm="ken"==b?this.startEffectSword(a,0,0):"yari"==b||"ono"==b?this.startEffectSpear(a,0,0):"yumi"==b?this.startEffectArrow(a,0,0):"tsue"==b||"tsue2"==b?this.startEffectCure(a,0,0):"sude"==b?this.startEffectFist(a,
0,0):"tume"==b?this.startEffectCrow(a,0,0):"mon"==b?this.startEffectMons(a,0,0):"fire"==b?this.startEffectFire(a,0,0):"ice"==b?this.startEffectIce(a,0,0):"thunder"==b?this.startEffectThunder(a,0,0):"earth"==b?this.startEffectMeteo(a,0,0):"wind"==b?this.startEffectWind(a,0,0):"water"==b?this.startEffectWater(a,0,0):this.startEffectMons2(a,0,0)},releaseAnms:function(){for(var a in this.anm)cc.log("LayerGame#releaseAnms","anm["+a+"]\x3d"+this.anm[a]),this.anm[a].release(),delete this.anm[a];this.curAnm&&
g.releaseAnimation(this.curAnm);delete this.curAnm;(a=this.getSprCur())&&a.removeFromParent()},getCommonEffect:function(a,b,c,d){if(void 0==this.anm[a]){var e=0;d&&(e+=d);for(d=new cc.Animation;;){var f=cc.spriteFrameCache.getSpriteFrame(a+"_"+e);if(!f)break;d.addSpriteFrame(f);e++}d.setDelayPerUnit(b);d.setRestoreOriginalFrame(!0);d.retain();this.anm[a]=d}a=cc.animate(this.anm[a]);var h=cc.Sprite.create();c=Game.getTm(c);h.runAction(cc.sequence(cc.delayTime(c),a,cc.callFunc(function(){cc.log("LayerGame#getCommonEffect remove "+
h);h.removeFromParent()})));return h},startEffectCure:function(a,b,c){g.playSe("care");b=this.getCommonEffect("heal",0.05,0.1);b.setScale(2);b.setPosition(g.NX,g.NY);a.addChild(b);return 1E3},startEffectSword:function(a,b,c){g.playSe("ken");this.startEffectSwordSub(a,b,c,0,0);this.startEffectSwordSub(a,b,c,90,200);return 700},startEffectSwordSub:function(a,b,c,d,e){b=this.getCommonEffect("sword",0.05,e/1E3);b.setScale(2);b.setRotation(d);b.setPosition(g.NX,g.NY);a.addChild(b)},startEffectSpear:function(a,
b,c){g.playSe("yari");b=this.getCommonEffect("spear",0.05,0.1);b.setScale(2);b.setPosition(g.NX,g.NY);a.addChild(b);return 900},startEffectFire:function(a,b,c){g.playSe("fire");b=this.getCommonEffect("fire",0.06,0.1);b.setScale(2);b.setPosition(g.NX,2*g.NY);a.addChild(b);return 900},startEffectIce:function(a,b,c){g.playSe("ice");b=this.getCommonEffect("ice",0.05,0.1);b.setScale(2);b.setPosition(g.NX,g.NY);a.addChild(b);return 900},startEffectThunder:function(a,b,c){g.playSe("thunder");b=this.getCommonEffect("thunder",
0.03,0.1);b.setScale(2);b.setPosition(g.NX,2*g.NY);a.addChild(b);return 700},startEffectMeteo:function(a,b,c){g.playSe("meteo");var d=cc.Sprite.create(cc.spriteFrameCache.getSpriteFrame("meteo_0"));d.setScale(2);d.setPosition(g.NX,3*g.NY);var e=this;b=Game.getTm(0.7);d.runAction(cc.sequence(cc.spawn(cc.moveTo(b,g.NX,g.NY),cc.rotateBy(b,360),cc.scaleTo(b,1)),cc.callFunc(function(){d.removeFromParent();d=e.getCommonEffect("meteo",0.05,0);d.setScale(1);d.setPosition(g.NX,g.NY);a.addChild(d)})));a.addChild(d);
return 1100},startEffectWind:function(a,b,c){g.playSe("ken");b=this.getCommonEffect("wind",0.05,0.1);b.setScale(2);b.setPosition(g.NX,g.NY);a.addChild(b);return 700},startEffectWater:function(a,b,c){g.playSe("ken");b=this.getCommonEffect("water",0.05,0.1);b.setScale(2);b.setPosition(g.NX,g.NY);a.addChild(b);return 700},startEffectMons:function(a,b,c){g.playSe("mon");b=this.getCommonEffect("mons",0.05,0.1);b.setScale(2);b.setPosition(g.NX,g.NY);a.addChild(b);return 700},startEffectMons2:function(a,
b,c){g.playSe("mon2");var d=cc.Sprite.create(cc.spriteFrameCache.getSpriteFrame("mons2_0"));d.setPosition(g.NX,2*g.NY);d.setOpacity(0);var e=this;b=Game.getTm(0.7);d.runAction(cc.sequence(cc.spawn(cc.moveTo(b,g.NX,g.NY),cc.rotateBy(b,360),cc.fadeIn(b)),cc.callFunc(function(){d.removeFromParent();d=e.getCommonEffect("mons2",0.06,0);d.setScale(2);d.setPosition(g.NX,g.NY);a.addChild(d)})));a.addChild(d);return 1100},startEffectFist:function(a,b,c){this.startEffectFistSub(a,0-g.NX/3,0-g.NY/2,0);this.startEffectFistSub(a,
0+g.NX/3,0,100);this.startEffectFistSub(a,0-g.NX/2,0+g.NY/3,200);this.startEffectFistSub(a,0+g.NX/2,0-g.NY/3,300);return 800},startEffectFistSub:function(a,b,c,d){g.playSe("fist");d=this.getCommonEffect("fist",0.05,d/1E3);d.setScale(2);d.setPosition(g.NX+b,g.NY+c);a.addChild(d)},startEffectCrow:function(a,b,c){this.startEffectCrowSub(a,b,c,0,0);this.startEffectCrowSub(a,b,c,90,300);return 800},startEffectCrowSub:function(a,b,c,d,e){g.playSe("fist");b=this.getCommonEffect("crow",0.05,e/1E3);b.setScale(2);
b.setRotation(d);b.setPosition(g.NX,g.NY);a.addChild(b)},startEffectArrow:function(a,b,c){c=b=0;this.startEffectArrowSub(a,b,c,0,0);this.startEffectArrowSub(a,b-g.NX/4,c-g.NY/2,0,100);this.startEffectArrowSub(a,b+g.NX/4,c-g.NY/2,0,200);return 1E3},startEffectArrowSub:function(a,b,c,d,e){g.playSe("yumi");var f,h,k;f=c+g.NY;h=b;k=c-8+g.NY/2;-45==d?(b-=g.NX,h-=g.NX/4):45==d&&(b+=g.NX,h+=g.NX/4);b*=2;f*=2;h*=2;k*=2;var m=cc.Sprite.create(cc.spriteFrameCache.getSpriteFrame("arrow_0"));m.setScale(2);m.setRotation(-135+
d);m.setPosition(g.NX+b,g.NY+f);e/=1E3;var n=this;m.setVisible(!1);e=Game.getTm(e);m.runAction(cc.sequence(cc.delayTime(e),cc.callFunc(function(){m.setVisible(!0)}),cc.moveTo(0.2,g.NX+h,g.NY+k).easing(cc.easeQuadraticActionIn()),cc.callFunc(function(){m.removeFromParent();var b=cc.Sprite.create(cc.spriteFrameCache.getSpriteFrame("arrow_1"));b.setScale(2);b.setRotation(-135+d);b.setPosition(g.NX+h,g.NY+k);b.runAction(cc.sequence(cc.delayTime(Game.getTm(0.2)),cc.callFunc(function(){b.removeFromParent();
m=n.getCommonEffect("arrow",0.1,0,2);m.setScale(2);m.setPosition(g.NX+h,g.NY+k);a.addChild(m)})));a.addChild(b)})));a.addChild(m)},addHpBar:function(a){var b=g.NX-4,b=Game.getGage(a.team.no,2*b,6);b.setName("hpBar");a.leader&&(img=cc.Sprite.create(res.crown),img.setScale(0.4),img.setAnchorPoint(0.5,1),a.crown=img);b.setScale(1/a.c.getScaleY());var c=a.c.height-a.c.height/8;b.setPosition(4,c);a.crown&&(a.crown.setPosition(4,c),a.c.addChild(a.crown));a.c.addChild(b);this.repaintHpBar(a);this.hideHpBar(a)},
repaintHpBar:function(a,b){var c=a.c.getChildByName("hpBar");Game.repaintGage(c,a.hp,a.chr.getSts(STS_MHP),b)},showHpBar:function(a){a.c.getChildByName("hpBar").setVisible(!0);a.crown&&a.crown.setVisible(!0)},hideHpBar:function(a){a.c.getChildByName("hpBar").setVisible(!1);a.crown&&a.crown.setVisible(!1)},showHpBars:function(){for(var a=main.getSuuTeam(),b=0;b<a;b++)for(var c=main.getTeam(b),d=c.getSuuMember(),e=0;e<d;e++)this.showHpBar(c.getMember(e))},hideHpBars:function(){for(var a=main.getSuuTeam(),
b=0;b<a;b++)for(var c=main.getTeam(b),d=c.getSuuMember(),e=0;e<d;e++)this.hideHpBar(c.getMember(e))},startMainMenu:function(){var a=this,b=(new LayerMsg).addBtn(g.str("chrlst"),function(){g.hideBtnSound();b.close();var c=g.getCover();g.blockTapUnder(c);c=new LayerListChara(860,cc.winSize.height,main.btl.getPlayerTeam().members);c.setName("listChr");a.sn.addChild(c)});b.addBtn(g.str("swjknwin"),function(){a.showJouken()});(0>this.sn.noStg||2<=this.sn.noStg)&&b.addBtn(g.str("btlesc"),function(b){(new LayerMsg).confYesNo(g.str("cnfesc"),
function(){a.sn.backToCamp()},function(){a.startMainMenu()},"OK",g.str("cancel"),!0,!0)},!1,!0);b.addBtn(g.str("cnfg"),function(){b.close();g.hideBtnSound();g.showSettei(function(){a.startMainMenu()})}).addClose(function(){g.hideBtnSound();a.startDownCursol();a.startClickMas();a.startClickChr();a.sn.setVisibleAuto(!0)});this.sn.setVisibleAuto(!1);b.start(this.sn);g.showBtnSound(40)},stopBlink:function(a,b){a&&(a.stopAllActions(),a.setOpacity(255*b))},shownChr:null,showSts:function(a,b,c){a!=this.stsBattler0&&
a!=this.shownChr&&(this.hideWinSts(),this.sn.setVisibleAuto(!1),this.shownChr=a,a==b?(this.showStsVertical(a,main.getItmAtkToTarget(b,a),"left",!0),this.showWinItmsVertical(a,null,b)):b?(c=a.team.no==b.team.no||main.isMikata(a.team,b.team),this.showStsVertical(a,main.getItmAtkToTarget(b,a),"left",!0),c||this.showWinItmsVertical(a,"left",b),this.showStsVertical(b,c?null:main.getItmAtkToTarget(a,b),"right",!0),this.showWinItmsVertical(b,"right",a)):(this.showStsVertical(a,null,"left",!0),this.showWinItmsVertical(a)))},
showStsVertical:function(a,b,c,d){b=new LayerWinSts(a.chr,null,a,b);b.winVas();var e,f,h,k;h=b.width/2;e=-h;k=this.height-b.height/2;f=k+(h-e);"left"==c?(b.setName("winSts0"),this.stsBattler0=a):(h=this.width-h,e=this.width-e,b.setName("winSts1"),this.stsBattler1=a);d?(b.setPosition(e,f),b.runAction(cc.moveTo(0.1,h,k))):b.setPosition(h,k);cc.director.getRunningScene().addChild(b)},winSts:function(a){return cc.director.getRunningScene().getChildByName("winSts"+a)},winVas:function(a){return a?a.winVas():
null},hideWinSts:function(){this.shownChr=null;var a=this.winSts(0),b=this.winSts(1);a&&(a.removeFromParent(),delete this.stsBattler0);b&&(b.removeFromParent(),delete this.stsBattler1);this.hideWinItms();this.sn.setVisibleAuto(!0)},repaintStsHps:function(){var a=this.winSts(0),b=this.winSts(1);a&&a.repaintStsHp();b&&b.repaintStsHp()},repaintStsExps:function(){var a=null,b=this.winSts(0);b&&(a=b.repaintStsExp());null==a&&(b=this.winSts(1))&&(a=b.repaintStsExp());null!=a&&(this.startNumEffect(a.base,
a.val,0,g.FONT_SZ_MIDIUM),this.removeYosous())},removeYosous:function(){var a=this.winSts(0),b=this.winSts(1);a&&a.removeYosou();b&&b.removeYosou()},showWinItmsVertical:function(a,b,c){if(a=new LayerWinItms(a.chr,a,c))"left"==b?(b=this.winSts(0),a.setPosition(b.width+a.width/2,this.height-a.height/2),a.setName("winItms0")):("right"==b?(b=this.winSts(1),a.setPosition(this.width-b.width-a.width/2,this.height-a.height/2)):a.setPosition(this.width-a.width/2,this.height-a.height/2),a.setName("winItms1")),
this.sn.addChild(a)},winItms:function(a){return this.sn.getChildByName("winItms"+a)},winCov:function(a){return(a=this.winItms(a))?a.winCov():null},hideWinItms:function(){var a=this.winItms(0),b=this.winItms(1);a&&a.removeFromParent();b&&b.removeFromParent()},showJouken:function(a,b){var c=new LayerMsg;a&&c.addMsg("-- "+a+" --",null,null,cc.color("#00ffff"));c.addMsg(g.str("jknwin")).addTap(function(){c.close();b&&b()});var d=main.getSuuTeam(),e=dt.stginf[this.sn.noStg].win,f=Game.getTurnLose(this.sn.noStg);
0<f&&c.addMsg(g.str("tnlmt",f),null,g.FONT_SZ_MIDIUM,cc.color("#ffff00"));for(var f=dt.stginf[this.sn.noStg].lose,h=0;h<f.length;h++)switch(f[h]){case 1:for(var k=main.btl.getPlayerTeam(),m=1;m<d;m++){var n=main.getTeam(m);main.isMikata(k,n)&&this.setMsgJoukenWin(c,m)}}for(h=0;h<e.length;h++)switch(e[h]){case 0:this.setMsgJoukenLoses(c,d,!1);break;case 1:this.setMsgJoukenLoses(c,d,!0);break;case 2:this.setMsgJoukenLose(c,1);break;case 3:this.setMsgJoukenLose(c,2)}d=Game.getTurnWin(this.sn.noStg);
0<d&&c.addMsg(g.str("wintn",d),null,g.FONT_SZ_MIDIUM,cc.color("#ffff00"));c.start(this.sn)},setMsgJoukenLoses:function(a,b,c){for(var d=main.btl.getPlayerTeam(),e=!1,f=1;f<b;f++){var h=main.getTeam(f);!h.isLose()&&0>=h.getSuuMember()||0>=h.getSuuMember()||main.isMikata(d,h)||(e&&a.addMsg(c?g.str("or"):g.str("and"),null,g.FONT_SZ_MIDIUM),this.setMsgJoukenLose(a,f),e=!0)}},setMsgJoukenLose:function(a,b){a.addMsg(this.getStrJoukenLose(b),null,null,g.TEAM_COLS[b])},getStrJoukenLose:function(a){a=main.getTeam(a);
var b="";switch(a.lose){case 0:b=g.str("jknwin1",a.nm);break;case 1:b=g.str("jknwin2",a.nm);break;case 2:b=g.str("jknwin3",a.nm)}return b},setMsgJoukenWin:function(a,b){a.addMsg(this.getStrJoukenWin(b),null,null,g.TEAM_COLS[b])},getStrJoukenWin:function(a){a=main.getTeam(a);var b="";switch(a.lose){case 2:b=g.str("jknsub",a.nm)}return b},showGeo:function(a,b){this.hideGeo();if(!this.isClickTarget&&main.map.isRange(a,b)){var c=g.FONT_SZ_MIDIUM,d=main.map.getMas(a,b).getMoveCost(a,b),d=0==d?g.str("mvng"):
g.str("mvcst")+d,e=6*c+8,f=c+8,h=this.sn.getChildByName("geo");h?(c=h.getChildByName("txt"),c.setString(d),h.setVisible(!0)):(h=new cc.LayerColor(cc.color("#000000"),e,f),h.setOpacity(128),c=g.setLbl(h,d,cc.color("#ffffff"),4,-4,"txt",c),c.setAnchorPoint(0,0),h.setPosition(this.width/2-h.width/2,this.height-4-h.height),h.setName("geo"),this.sn.addChild(h))}},hideGeo:function(){var a=this.sn.getChildByName("geo");a&&a.setVisible(!1)}});var LayerMinimap=cc.Layer.extend({ctor:function(a,b){this._super();this.map=a;this.sizeMas=b;this.setContentSize(a.suuMasYoko*b,a.suuMasTate*b);this.repaint()},repaint:function(){var a=new cc.DrawNode,b=this.getColOfCost(1);a.drawRect(cc.p(0,0),cc.p(this.width-1,this.height-1),b,0);for(b=0;b<this.map.suuMasTate;b++)for(var c=0;c<this.map.suuMasYoko;c++){var d=this.paintMasMiniMap(a,c,b);null!=d&&d.chr&&this.repaintChr(d.chr,a)}this.addChild(a)},getColOfCost:function(a){a=0==a?96:255-32*a;return cc.color(a,
a,a)},getCurColOfCost:function(a){a=128+32*a;return cc.color(a,a,0)},paintMasMiniMap:function(a,b,c,d){d=b*this.sizeMas;var e=(this.map.suuMasTate-c)*this.sizeMas-1;b=this.map.isRange(b,c)?this.map.getMas(b,c):null;if(null!=b){c=b.getMoveCost();if(1==c)return b;c=this.getColOfCost(c)}else c=cc.color("#000000");g.isApp()?a.drawRect(cc.p(d,e),cc.p(d+this.sizeMas-1,e-(this.sizeMas-1)),c,0,c):a.drawRect(cc.p(d,e),cc.p(d+this.sizeMas-1,e-(this.sizeMas-1)),c,0);return b},getPx:function(a){a*=this.sizeMas;
return a+1},getPy:function(a){a=(this.map.suuMasTate-1-a)*this.sizeMas;return a+1},repaintChr:function(a,b){var c=this.getPx(a.x),d=this.getPy(a.y),e=a.team.no+"_"+a.no,f=this.getChildByName(e);f||(f=this.getSpr(g.TEAM_COLS[a.team.no]),f.setName(e),this.addChild(f,1E3));f.setPosition(c,d);(0>=a.hp||this.map.getMas(a.x,a.y).chr!=a)&&f.removeFromParent()},repaintRange:function(a,b,c,d){a=(a/g.SZ_MAS+this.map.infLayer.x-1)*this.sizeMas;b=(b/g.SZ_MAS+this.map.infLayer.y-1)*this.sizeMas;b-=this.sizeMas/
2;c=c/g.SZ_MAS*this.sizeMas;d=d/g.SZ_MAS*this.sizeMas;var e=this.width+this.sizeMas,f=this.height+this.sizeMas/2,h,k,m;k=b+d;this.rangeSpr(0,k<f,e/2,k,e,f-k);h=a+c/2;m=e-h;this.rangeSpr(1,h<e,e-m/2,0,m,Math.min(k,f));h>e&&(h=e);this.rangeSpr(2,0<b,h/2,0,h,b);m=a-c/2;this.rangeSpr(3,0<h,m/2,b,m,Math.min(d,f-b))},rangeSpr:function(a,b,c,d,e,f){a="rng"+a;spr=this.getChildByName(a);spr||(spr=cc.Sprite.create(res.mas),spr.setColor(cc.color("#000000")),spr.setOpacity(128),spr.setAnchorPoint(0.5,0),spr.setName(a),
this.addChild(spr,2E3));e/=spr.width;f/=spr.height;e!=spr.getScaleX()&&spr.setScaleX(e);f!=spr.getScaleY()&&spr.setScaleY(f);c==spr.x&&d==spr.y||spr.setPosition(c,d);spr.setVisible(b)},repaintCur:function(a,b){0>a&&(b=a);var c=this.getPx(a),d=this.getPy(b);spr=this.getChildByName("cur");spr||(spr=this.getSpr(cc.color("#ffff00")),spr.setName("cur"),this.addChild(spr,2E3),spr.runAction(cc.repeatForever(cc.sequence(cc.fadeOut(0.2),cc.fadeIn(0.2)))));0>a?spr.setVisible(!1):(spr.setVisible(!0),c==spr.x&&
d==spr.y||spr.setPosition(c,d))},getSpr:function(a,b){b||(b=res.mas);var c=cc.Sprite.create(b);a&&c.setColor(a);c.setScale((this.sizeMas-2)/c.width,(this.sizeMas-2)/c.height);c.setAnchorPoint(-0.5,-0.5);return c}});var SceneChara=cc.Scene.extend({ctor:function(){this._super()},onEnter:function(){this._super();var a=new cc.LayerColor(cc.color("#000000"));this.addChild(a);a=new LayerListChara(860,cc.winSize.height);this.addChild(a);g.setBackKey(this)},endByListChara:function(){cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneWorld))}});var SceneItem=cc.Scene.extend({ctor:function(){this._super()},onEnter:function(){this._super();var a=new cc.LayerColor(cc.color("#000000"));this.addChild(a);this.showList();g.setBackKey(this)},showList:function(a){var b=this,c=new LayerListItm(860,cc.winSize.height,!0,null,null,null,function(a){b.showChrs(a)});c.setName("layList");this.addChild(c);void 0!=a&&c.setPos(a);this.showMenu()},showMenu:function(){var a=this;g.readyMenu();g.addMenuItem(g.str("mdr"),0,function(){g.clearMenu();a.needSave&&
SP.saveData();a.endByListChara()});var b=0==SP.getSortItm()?1:0,c=[g.str("itmsrt0"),g.str("itmsrt1")][b];g.addMenuItem(c,1,function(){g.clearMenu();SP.setSortItm(b);g.removeByNm("layChr",a);g.removeByNm("layList");a.showList()});g.startMenu()},endByListChara:function(){cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneWorld))},showChrs:function(a){g.removeByNm("layChr",this);if(main.isItmSumi(a)&&!(0>=SP.getData().itms[a])){var b=this;Game.getInfWin(8,4,6,3,5);for(var c=main.getChrs(!0),
d=0;d<c.length;d++)main.isPaled(c[d].no)&&main.isJobEquippable(c[d].chr.job,a)||(c[d]=null);var d=new LayerWinChrs(c),e=cc.winSize.width-(cc.winSize.width-this.getChildByName("layList").width)/2;d.setPosition(e,cc.winSize.height);d.setName("layChr");this.addChild(d);d.startSelect(null,function(d){cc.log("SceneItem#showChrs selected\x3d"+d);c[d]&&(g.removeByNm("layChr",b),b.showDetail(c[d].no,a))},null)}},clearDetail:function(){g.removeByNm("winSts",this)},repaintDetail:function(a,b){this.clearDetail();
var c=this,d=cc.winSize,e=new LayerWinSts(SP.getData().chrs[a],a==SP.getData().leader);e.setName("winSts");e.setPosition(d.width+e.width/2,d.height-e.height/2+e.width);e.runAction(cc.moveBy(0.1,-e.width,-e.width));this.addChild(e);this.showItms(a,!0).startSelect(null,function(d){c.equip(a,d,b)},null)},showDetail:function(a,b){this.repaintDetail(a,b);var c=this;this.getChildByName("layList").setEnabled(!1);g.readyMenu();g.addMenuItem(g.str("mdr"),2,function(){g.clearMenu();c.clearDetail();c.clearItms();
c.getChildByName("layList").setEnabled(!0);c.showMenu();c.showChrs(b)});g.startMenu()},clearItms:function(){var a=this.getChildByName("winItms");a&&(a.endSelect(),a.removeFromParent())},showItms:function(a,b){this.clearItms();var c=cc.director.getRunningScene(),d=cc.winSize,e=new LayerWinItms(SP.getData().chrs[a],null,null,b);e.setName("winItms");var f=c.getChildByName("winSts");e.setPosition(d.width-f.width-e.width/2,d.height-e.height/2);c.addChild(e);return e},equip:function(a,b,c){cc.log("SceneItem#equip posItm\x3d"+
b+" noItm\x3d"+c);var d=SP.getData(),e=d.chrs[a].getItem(b);if(0<=e&&!main.isItmHazuseru(e)){var f=(new LayerMsg).addMsg(g.str("eqper0")).addTap(function(){f.close()});f.start()}else main.isEquippable(a,c)?0>=d.itms[c]?(f=(new LayerMsg).addMsg(g.str("eqper2")).addTap(function(){f.close()}),f.start()):(0<=e&&(d.chrs[a].setItem(b,-1),d.itms[e]++),g.playSe("soubi"),d.chrs[a].setItem(b,c),d.itms[c]--,this.needSave=!0,this.clearDetail(),this.clearItms(),a=this.getChildByName("layList").getPos(),g.removeByNm("layList"),
this.showList(a)):(f=(new LayerMsg).addMsg(g.str("eqper1")).addTap(function(){f.close()}),f.start())}});var LayerListChara=cc.Layer.extend({H_ROW:120,noChr:-1,FACES:[["wara","niko","komari"],["niko","","ase"],["niko","","ase"],["wara","","naki"],["wara","","zun"],["wara","niko","ase"],["niko","","yabe"],["niko","","ase"],["niko","","naki"],["niko","","ase"]],needSave:!1,ctor:function(a,b,c){this._super();this.setContentSize(a,b);this.battlers=c;this.repaintList()},repaintList:function(a){var b=this.getChildByName("list"),c=0;b&&(c=g.getListPos(b),b.removeFromParent());b=new ccui.ListView;b.setDirection(ccui.ScrollView.DIR_VERTICAL);
b.setBounceEnabled(!0);b.setAnchorPoint(cc.p(0,0));b.setItemsMargin(4);b.setContentSize(this.width,this.height);for(var d=this.getChrs(),e=null,f=0;f<d.length;f++){var h=this.battlers?this.battlers[f]:null,k=d[f].chr,m=new LayoutR(b.width,this.H_ROW);m.setTouchEnabled(!0);m.setBackGroundImage(res.win0);m.setBackGroundImageScale9Enabled(!0);m.setMargin(9,12,9,3);m.setSuuRow(3,2);m.setTag(d[f].no);void 0==a&&(a=d[f].no,this.selectRow(m,a));d[f].no==a&&(e=m);var n=main.getHpType(k,h),p;p=d[f].no;var r=
this.FACES[p][this.battlers?n.type:1];""!=r&&(p+="_"+r);p=cc.Sprite.create(res["face"+p]);m.addColumn(p,1,0,4);h&&h.isEnd()&&p.setOpacity(128);!h&&d[f].rest&&p.setOpacity(128);p=this.getLbl(k.nm,cc.color("#ffffff"));m.addColumn(p,0,0.15,4);d[f].leader&&(p=cc.Sprite.create(res.crown),p.setScale(g.FONT_SZ_MIDIUM/p.width,g.FONT_SZ_MIDIUM/p.height),m.addColumn(p,0,0.35,4));p=this.getLbl(main.nmJob(k.job),cc.color("#cccccc"));m.addColumn(p,1,0.15,4);p=this.getLblNum("LV",k.lv,0.12*this.width);m.addColumn(p,
0,0.45,4);p=this.getLblNum("EXP",k.exp,0.1*this.width);m.addColumn(p,0,0.65,4);h=0.12*this.width;p=this.getLblNum("HP",n.hp,h,null,n.col);m.addColumn(p,1,0.45,4);p=this.getLblNum("/",n.mhp,h);m.addColumn(p,1,0.6,4);h=0.15*this.width;p=Game.getGage(0,h,g.FONT_SZ_MIDIUM/2);Game.repaintGage(p,n.hp,n.mhp);m.addColumn(p,1,0.72,4);k=k.itms;for(n=0;n<k.length;n++)void 0==k[n]||0>k[n]||(p=cc.Sprite.create(res["itm_"+dt.itms[k[n]].asrt]),p.setScale(g.FONT_SZ_MIDIUM/p.width,g.FONT_SZ_MIDIUM/p.height),h=0.15+
0.2*n,m.addColumn(p,2,h,4),p=this.getLbl(main.nmItm(k[n]),cc.color("#88ff88")),m.addColumn(p,2,h+0.05,4,0.2-0.05));b.pushBackCustomItem(m)}b.addEventListener(this.selectedItemEvent,this);b.setName("list");this.addChild(b);0<c&&g.setListPos(b,c);e&&this.strongRow(e);return b},getChrs:function(){return this.battlers?main.getChrsByBattlers(this.battlers,0):main.getChrs(!0)},getBattlerOfNo:function(a){if(!this.battlers)return null;for(var b=0;b<this.battlers.length;b++)if(this.battlers[b].no==a)return this.battlers[b];
return null},getLbl:function(a,b,c){c||(c=g.FONT_SZ_MIDIUM);return g.getLabel(a,b,null,null,c,cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER)},getLblNum:function(a,b,c,d,e){d||(d=g.FONT_SZ_MIDIUM);e||(e=cc.color("#ffffff"));var f=new cc.Node;a=g.getLabel(a,cc.color("#0000ff"),null,null,0.75*d);f.addChild(a);a=g.getLabel(""+b,e,null,cc.color("#000000"),d,cc.TEXT_ALIGNMENT_RIGHT);a.setPosition(c,0);f.addChild(a);return f},selectedItemEvent:function(a,b){var c=a.getItem(a.getCurSelectedIndex()),
d=c.getTag();switch(b){case ccui.ListView.EVENT_SELECTED_ITEM:c.opacity=128;c.runAction(cc.fadeIn(0.5).easing(cc.easeIn(3)));break;case ccui.ListView.ON_SELECTED_ITEM_END:a.getParent().clearRows(a),a.getParent().selectRow(c,d),g.playSe("ok")}},strongRow:function(a){a.stopAllActions();a.opacity=255;a=g.getCover(a,null,"mas");a.setColor(cc.color("#ffffff"));a.setOpacity(128)},selectRow:function(a,b){this.strongRow(a);this.showDetail(b);this.noChr=b},clearDetail:function(){var a=cc.director.getRunningScene().getChildByName("winSts");
a&&a.removeFromParent()},repaintDetail:function(a,b){this.clearDetail();var c=this,d=cc.director.getRunningScene(),e=cc.winSize,f=new LayerWinSts(SP.getData().chrs[a],a==SP.getData().leader,this.getBattlerOfNo(a));f.setName("winSts");f.setPosition(e.width+f.width/2,e.height-f.height/2+f.width);f.runAction(cc.moveBy(0.1,-f.width,-f.width));d.addChild(f);d=this.showItms(a,!0,b);this.battlers||(d.startSelect(null,function(a){c.clickedItm(a)},function(a){c.offSelItm()}),f.startSelectName(function(){this.chgNm(a)}.bind(this)))},
showDetail:function(a){this.repaintDetail(a);var b=this;g.readyMenu();g.addMenuItem(g.str("mdr"),2,function(){g.clearMenu();b.clearDetail();b.clearItms();b.needSave&&SP.saveData();cc.director.getRunningScene().endByListChara()});if(this.battlers){var c=this.getBattlerOfNo(a),d;d=c.isEnd()?g.str("actsm"):g.str("act");g.addMenuItem(d,0,function(){g.clearMenu();b.clearDetail();b.clearItms();cc.director.getRunningScene().endByListChara(c)})}else SP.getData().rests[a]?g.addMenuItem(g.str("snsn"),0,function(){g.stopMenuSe();
g.playSe("soubi");SP.getData().rests[a]=!1;cc.log("LayerListChara#showDetail rests\x3d"+SP.getData().rests);b.needSave=!0;b.repaintList(a);b.showDetail(a)}):g.addMenuItem(g.str("qkei"),0,function(){for(var c=-1,d=b.getChrs(),h=0;h<d.length;h++){var k=d[h];if(k.no!=a&&!k.rest){c=k.no;break}}if(0>c){var m=(new LayerMsg).addMsg(g.str("qkeier")).addTap(function(){m.close()});m.start()}else a==SP.getData().leader&&(SP.getData().leader=c),g.stopMenuSe(),g.playSe("soubi"),SP.getData().rests[a]=!0,b.needSave=
!0,b.repaintList(a),b.showDetail(a)});g.startMenu()},clearItms:function(){var a=cc.director.getRunningScene().getChildByName("winItms");a&&(a.endSelect(),a.removeFromParent())},showItms:function(a,b,c){this.clearItms();var d=cc.director.getRunningScene(),e=cc.winSize;a=new LayerWinItms(SP.getData().chrs[a],null,null,b,c);a.setName("winItms");b=d.getChildByName("winSts");a.setPosition(e.width-b.width-a.width/2,e.height-a.height/2);d.addChild(a);return a},clearRows:function(a){a||(a=this.getChildByName("list"));
if(a){a=a.getItems();for(var b=0;b<a.length;b++){var c=a[b].getChildByName("cov");c&&c.removeFromParent()}}},clickedItm:function(a){var b=this;this.getChildByName("list").setVisible(!1);this.repaintListItm(a);g.readyMenu();g.addMenuItem(g.str("mdr"),2,function(){b.offSelItm()});var c=SP.getData().chrs[this.noChr].itms[a];void 0==c||0>c||!main.isItmHazuseru(c)||g.addMenuItem(g.str("hzs"),1,function(){g.stopMenuSe();g.playSe("soubi");var d=SP.getData();d.chrs[b.noChr].setItem(a,-1);d.itms[c]++;b.repaintList(b.noChr);
b.repaintDetail(b.noChr,a);b.clickedItm(a);b.needSave=!0});g.startMenu()},repaintListItm:function(a){var b=this,c=cc.director.getRunningScene(),d;d=c.getChildByName("listItm");var e=0;d&&(e=d.getPos(),d.removeFromParent());d=SP.getData().chrs[this.noChr];d=new LayerListItm(this.width,this.height,!1,d,a,null,function(c){b.equip(a,c);b.needSave=!0});d.setName("listItm");c.addChild(d);0<e&&d.setPos(e)},offSelItm:function(){var a;(a=cc.director.getRunningScene().getChildByName("listItm"))&&a.removeFromParent();
this.getChildByName("list").setVisible(!0);this.showDetail(this.noChr)},equip:function(a,b){var c=SP.getData(),d=c.chrs[this.noChr].getItem(a);if(0<=d&&!main.isItmHazuseru(d)){var e=(new LayerMsg).addMsg(g.str("eqper0")).addTap(function(){e.close()});e.start()}else main.isEquippable(this.noChr,b)?0>=c.itms[b]?(e=(new LayerMsg).addMsg(g.str("eqper2")).addTap(function(){e.close()}),e.start()):(0<=d&&(c.chrs[this.noChr].setItem(a,-1),c.itms[d]++),g.stopMenuSe(),g.playSe("soubi"),c.chrs[this.noChr].setItem(a,
b),c.itms[b]--,this.repaintList(this.noChr),this.repaintDetail(this.noChr,a),this.clickedItm(a)):(e=(new LayerMsg).addMsg(g.str("eqper1")).addTap(function(){e.close()}),e.start())},update:function(a){},chgNm:function(a){var b=this,c=(new LayerMsg).addMsg(g.str("chrnmchg")).addInput("",SP.getData().chrs[a].nm,5,g.FONT_SZ_MIDIUM).addBtn("OK",function(){var d=c.getInputText();if(!(0>=d.length)){var e=b.ckNm(d);if(null!=e){var f=(new LayerMsg).addMsg(e);f.addTap(function(){f.close()});f.start()}else(new LayerMsg).confYesNo(g.str("cnfnm",
d),function(){SP.getData().chrs[a].nm=d;c.close();b.needSave=!0;b.repaintList(a);b.showDetail(a)},function(){},g.str("nmok"),g.str("nmng"),!0,!0)}}).addBtn(g.str("mdr"),function(){c.close()});c.start()},ckNm:function(a){return"null"==a?g.str("nmerr"):null}});var LayerWinSts=cc.Layer.extend({ctor:function(a,b,c,d){this._super();this.battler=c;a=this.getWinSts(a,b,c,d);this.addChild(a);this.setContentSize(a.getContentSize())},getInfWinSts:function(){this.infWinSts||(this.infWinSts=Game.getInfWin(8,4,5,11,1));return this.infWinSts},getValAndSuu:function(a,b){var c=b/2,d=(0==a.val?1:Math.ceil(Math.LOG10E*Math.log(a.val)+1))*c,d=d+c+8,e=0;1<a.suu&&(e=d,d+=3*c+4);c=cc.Sprite.create(res.mas);c.setAnchorPoint(0,1);var d=d/c.width,f=b/c.height;c.setScale(d,f);
c.setColor(cc.color("#440044"));c.runAction(cc.repeatForever(cc.sequence(cc.delayTime(0.9),cc.fadeOut(0.3),cc.fadeIn(0.3))));var h=c.height-4,k;k=a.care?g.addLblToBg(c,"+"+a.val,4,h,b,cc.color("#00ffff")):g.addLblToBg(c,"-"+a.val,4,h,b,cc.color("#ff0000"));k.setScale(1/d,1/f);0<e&&(k=g.addLblToBg(c,"x 2",e/d,h,b,cc.color("#ffff00")),k.setScale(1/d,1/f));return c},getWinSts:function(a,b,c,d){a||(a=c.chr);var e=c?c.team.no:0;c&&(b=c.leader);c=main.getHpType(a,c);e=new cc.Scale9Sprite(res["win"+e]);
e.setContentSize(this.getInfWinSts().wWin,this.getInfWinSts().hWin);var f=this.getInfWinSts().merginH,h=this.getInfWinSts().hWin-this.getInfWinSts().merginH;if(b){var k=cc.Sprite.create(res.crown);k.setScale(this.getInfWinSts().sizeFont/k.width,this.getInfWinSts().sizeFont/k.height);k.setPosition(this.getInfWinSts().wWin-this.getInfWinSts().sizeFont-this.getInfWinSts().merginH+k.width/2,h-k.height/2);e.addChild(k)}g.addLblToBg(e,a.nm,f,h,this.getInfWinSts().sizeFont,cc.color("#ffffff"),this.getInfWinSts().wInner-
(b?this.getInfWinSts().sizeFont:0)).setName("lblNm");h-=this.getInfWinSts().sizeFont+this.getInfWinSts().merginV;g.addLblToBg(e,main.nmJob(a.job),f,h,0.75*this.getInfWinSts().sizeFont,cc.color("#cccccc"),this.getInfWinSts().wInner);h-=this.getInfWinSts().sizeFont+this.getInfWinSts().merginV;g.addLblNumToBg(e,"LV",a.lv,f,h,this.getInfWinSts().wInner,this.getInfWinSts().sizeFont);h-=this.getInfWinSts().sizeFont+this.getInfWinSts().merginV;b=g.addLblNumToBg(e,"EXP",a.exp,f,h,this.getInfWinSts().wInner,
this.getInfWinSts().sizeFont);b.setName("exp");h-=this.getInfWinSts().sizeFont+this.getInfWinSts().merginV;b=g.addLblNumToBg(e,"HP",c.hp,f,h,this.getInfWinSts().wInner/2,this.getInfWinSts().sizeFont,c.col,c.colFuchi);b.setName("hp");b=this.getStsCol(a,STS_MHP,c.mhp);g.addLblNumToBg(e,"/",c.mhp,f+this.getInfWinSts().wInner/2+this.getInfWinSts().merginH,h,this.getInfWinSts().wInner/2-this.getInfWinSts().merginH,this.getInfWinSts().sizeFont,b.col,b.colWaku);c=null;d&&0<=d.val&&(c=this.getValAndSuu(d,
this.getInfWinSts().sizeFont),c.setPosition(f+(this.getInfWinSts().wInner-c.width*c.getScaleX())/2,h+this.getInfWinSts().sizeFont),e.addChild(c),c.setName("vas"));h=this.stsLbl(e,a,STS_ATK,f,h);h=this.stsLbl(e,a,STS_DEF,f,h);h=this.stsLbl(e,a,STS_MATK,f,h);h=this.stsLbl(e,a,STS_MDEF,f,h);h=this.stsLbl(e,a,STS_SPD,f,h);this.stsLbl(e,a,STS_MOVE,f,h);e.setName("win");return e},getStsCol:function(a,b,c){var d=null,e=null;a=a.getSts0(b);c>a?d=cc.color("#ffff00"):c<a&&(d=cc.color("#ff0000"),e=cc.color("#000000"));
return{col:d,colWaku:e}},stsLbl:function(a,b,c,d,e){e-=this.getInfWinSts().sizeFont+this.getInfWinSts().merginV;var f=b.getSts(c);b=this.getStsCol(b,c,f);g.addLblNumToBg(a,NM_STSS[c],f,d,e,this.getInfWinSts().wInner,this.getInfWinSts().sizeFont,b.col,b.colWaku);return e},winSts:function(){return this.getChildByName("win")},winVas:function(){return this.winSts().getChildByName("vas")},removeYosou:function(){var a=this.winVas();a&&a.removeFromParent()},repaintStsHp:function(){var a=this.winSts().getChildByName("hp");
if(a){var b=main.getHpType(this.battler.chr,this.battler);a.setString(""+b.hp);b.col&&a.setFontFillColor(b.col);b.colFuchi&&a.enableStroke(b.colFuchi,g.isApp()?4:2)}},repaintStsExp:function(a){if(a=this.winSts().getChildByName("exp")){var b=this.battler.chr.exp-Number(a.getString());if(0<b)return a.setString(""+this.battler.chr.exp),{base:a,val:b}}return null},startSelectName:function(a){var b=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,onTouchBegan:function(a,b){var c=b.getCurrentTarget(),
d=c.convertToNodeSpace(a.getLocation()),c=c.getContentSize(),c=cc.rect(0,0,c.width,c.height);return cc.rectContainsPoint(c,d)?!0:!1}.bind(this),onTouchMoved:function(a,b){},onTouchEnded:function(b,c){a&&a()},onTouchCancelled:function(a,b){cc.eventManager.removeListener(this)}}),c=new cc.Scale9Sprite(res.waku),d=this.getChildByName("win"),e=d.getChildByName("lblNm");c.setContentSize(d.width,d.height-e.y+e.height);c.setAnchorPoint(0,0);c.setPosition(0,d.height-c.height);c.runAction(cc.repeatForever(cc.sequence(cc.fadeOut(0.5),
cc.fadeIn(0.5))));c.setName("waku");d.addChild(c);b.setSwallowTouches(!0);cc.eventManager.addListener(b,c)}});var LayerWinItms=cc.Layer.extend({posNow:-1,ctor:function(a,b,c,d,e){this._super();b&&(a=b.chr);var f=0,h=0,k=0.1,m=-1;c?(a=main.getItmsToTarget(b,c),m=main.getMaxOfItms(a,b,c).itm):a=a.itms;var n,p;p=d?4:a.length;for(var r=0;r<p;r++){var s=r>=a.length?-1:a[r];if(d||!(isNaN(s)||0>s))n=this.getWinItm(dt.itms[s],void 0!=b,b?b.team.no:0),(c&&s==m||r==e)&&this.setWinItmCov(n,!0),n.itm=s,n.setPosition(0,n.height/2),n.runAction(cc.sequence(cc.delayTime(0.05),cc.moveTo(k,n.x,h))),this.addChild(n),h-=n.height,
0==f&&(f=n.height),k+=0.05}this.setContentSize(this.getInfWinItm().wWin,f)},getInfWinItm:function(){this.infWinItm||(this.infWinItm=Game.getInfWin(8,4,6,3,4));return this.infWinItm},getWinItm:function(a,b,c){b=new cc.Scale9Sprite(res["win"+c]);b.setContentSize(this.getInfWinItm().wWin,this.getInfWinItm().hWin);c=this.getInfWinItm().merginH;var d=b.height-this.getInfWinItm().merginH,e=this.getInfWinItm().sizeFont;if(!a)return g.addLblToBg(b,g.str("aki"),c,d,e,cc.color("#ffff00"),this.getInfWinItm().wInner-
e),b;var f=Game.getItmIconAndEx(a),h=cc.Sprite.create(res[f.icon]);h.setScale(e/h.width,e/h.height);h.setPosition(this.getInfWinItm().wWin-e-this.getInfWinItm().merginH+e/2,d-e/2);b.addChild(h);g.addLblToBg(b,a["nm"+main.mojiLang()],c,d,e,cc.color("#ffffff"),this.getInfWinItm().wInner-e);if(2<=a.range.length)d-=e+this.getInfWinItm().merginV,g.addLblNumToBg(b,g.str("pow"),a.val,c,d,this.getInfWinItm().wInner,e),d-=e+this.getInfWinItm().merginV,g.addLblNumToBg(b,g.str("rng"),a.range[0]+"\uff5e"+a.range[1],
c,d,this.getInfWinItm().wInner,e);else if(f.exs)for(a=0;a<f.exs.length;a++)h=f.exs[a],d-=e+this.getInfWinItm().merginV,g.addLblToBg(b,h,c,d,e,cc.color("#dddddd"),this.getInfWinItm().wInner);else if(a.sts){f=a.sts;for(a=h=0;a<f.length;a++)0<f[a]&&(2>h&&(d-=e+this.getInfWinItm().merginV,g.addLblNumToBg(b,NM_STSS[a],"+"+f[a],c,d,this.getInfWinItm().wInner,e)),h++);for(a=0;a<f.length;a++)0>f[a]&&(2>h&&(d-=e+this.getInfWinItm().merginV,g.addLblNumToBg(b,NM_STSS[a],f[a],c,d,this.getInfWinItm().wInner,e,
cc.color("#ff0000"))),h++);2<h&&g.addLblNumToBg(b,"...","...",c,d-e/2,this.getInfWinItm().wInner,e)}return b},setWinItmCov:function(a,b){var c=a.getChildByName("cov");if(c)return c;c=cc.Sprite.create(res.mas);c.setAnchorPoint(0,0);c.setScale(a.width/c.width,a.height/c.height);c.setOpacity(128);b&&c.runAction(cc.repeatForever(cc.sequence(cc.delayTime(0.9),cc.fadeOut(0.3),cc.fadeTo(0.3,128))));c.setName("cov");a.addChild(c);return c},removeWinCov:function(){var a=this.winCov();a&&a.getParent()&&a.removeFromParent()},
winCov:function(){var a=this.getChildren();if(!a)return null;for(var b=0;b<a.length;b++){var c=a[b].getChildByName("cov");if(c)return c}return null},getBtnTapped:function(a,b){for(var c=a.length,d=this.convertToNodeSpace(b),e=0;e<c;e++){var f=a[e];if(void 0!=f.pos){var h=f.getContentSize(),k=f.getPosition(),h=cc.rect(k.x-h.width/2,k.y-h.height/2,h.width,h.height);if(cc.rectContainsPoint(h,d))return f}}return null},startSelect:function(a,b,c){for(var d=this.getChildren(),e=0;e<d.length;e++)d[e].pos=
e;var f=this,h=function(b){b=f.getBtnTapped(d,b.getLocation());if(null==b)return!1;b.opacity=128;b.runAction(cc.fadeIn(0.5).easing(cc.easeIn(3)));if(!a)return!0;a(b.pos);return!0},e=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,onTouchBegan:function(a,b){return h(a)},onTouchMoved:function(a,b){h(a)},onTouchEnded:function(a,e){var h=f.getBtnTapped(d,a.getLocation());null!=h&&(g.playSe("ok"),f.removeWinCov(),f.posNow==h.pos?c&&c(h.pos):(f.setWinItmCov(h),b&&(b(h.pos),f.posNow=h.pos)))},
onTouchCancelled:function(a,b){cc.log("LayerWinItms#startSelect onTouchCancelled");cc.eventManager.removeListener(this)}}),k=new cc.Scale9Sprite(res.waku);k.setContentSize(this.width,this.height*d.length);k.setPosition(0,this.height*(d.length-1)/-2);k.runAction(cc.repeatForever(cc.sequence(cc.fadeOut(0.5),cc.fadeIn(0.5))));k.setName("waku");this.addChild(k);e.setSwallowTouches(!0);cc.eventManager.addListener(e,k)},endSelect:function(){g.removeByNm("waku",this)}});var LayerWinChrs=cc.Layer.extend({ctor:function(a,b){this._super();var c=0,d=0,e=0,f,h;h=a.length;5<h&&(d-=this.getInfWinChr().wWin/2);for(var k=0;k<h;k++)f=this.getWinChr(a[k]),k==b&&this.setWinChrCov(f,!0),f.setPosition(d,e-f.height/2),this.addChild(f),e-=f.height,4==k&&(e=0,d+=f.width),0==c&&(c=f.height);this.setContentSize(this.getInfWinChr().wWin*(5<h?2:1),this.getInfWinChr().hWin*(5<h?5:h))},getInfWinChr:function(){this.infWinChr||(this.infWinChr=Game.getInfWin(8,4,6,3,5));return this.infWinChr},
getWinChr:function(a){var b="";a&&(b="0");b=new cc.Scale9Sprite(res["win"+b]);b.setContentSize(this.getInfWinChr().wWin,this.getInfWinChr().hWin);this.getInfWinChr();this.getInfWinChr();this.getInfWinChr();if(!a)return b;a=new cc.Sprite(res["face"+a.no]);a.setScale((b.height-8)/a.height);a.setPosition(b.width/2,b.height/2);b.addChild(a);return b},setWinChrCov:function(a,b){var c=a.getChildByName("cov");if(c)return c;c=new cc.Sprite(res.mas);c.setAnchorPoint(0,0);c.setScale(a.width/c.width,a.height/
c.height);c.setOpacity(128);b&&c.runAction(cc.repeatForever(cc.sequence(cc.delayTime(0.9),cc.fadeOut(0.3),cc.fadeTo(0.3,128))));c.setName("cov");a.addChild(c);return c},removeWinCov:function(){var a=this.winCov();a&&a.getParent()&&a.removeFromParent()},winCov:function(){var a=this.getChildren();if(!a)return null;for(var b=0;b<a.length;b++){var c=a[b].getChildByName("cov");if(c)return c}return null},startSelect:function(a,b,c){for(var d=this.getChildren(),e=this,f=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan:function(b,c){var d=c.getCurrentTarget(),e=d.convertToNodeSpace(b.getLocation()),f=d.getContentSize(),f=cc.rect(0,0,f.width,f.height);if(!cc.rectContainsPoint(f,e))return!1;d.opacity=128;d.runAction(cc.fadeIn(0.5).easing(cc.easeIn(3)));if(!a)return!0;a(d.pos);return!0},onTouchMoved:function(a,b){},onTouchEnded:function(a,d){var f=d.getCurrentTarget(),h=f.convertToNodeSpace(a.getLocation()),k=f.getContentSize(),k=cc.rect(0,0,k.width,k.height);cc.rectContainsPoint(k,h)&&(g.playSe("ok"),
e.removeWinCov(),e.posNow==f.pos?c&&c(f.pos):(e.setWinChrCov(f),b&&(b(f.pos),e.posNow=f.pos)))},onTouchCancelled:function(a,b){cc.log("LayerWinChrs#startSelect onTouchCancelled");cc.eventManager.removeListener(this);delete target.listener}}),h=0;h<d.length;h++){var k=d[h];k.pos=h;var m=0<h?f.clone():f;m.setSwallowTouches(!0);cc.eventManager.addListener(m,k);k.listener=m}d=new cc.Scale9Sprite(res.waku);d.setContentSize(this.width,this.height);d.setPosition(0,-this.height/2);d.runAction(cc.repeatForever(cc.sequence(cc.fadeOut(0.5),
cc.fadeIn(0.5))));this.addChild(d)},endSelect:function(){for(var a=this.getChildren(),b=0;b<a.length;b++){var c=a[b];c&&c.listener&&cc.eventManager.removeListener(c.listener)}}});var LayerListItm=cc.Layer.extend({H_ROW:80,ctor:function(a,b,c,d,e,f,h){this._super();this.setContentSize(a,b);a=main.getChrs(!0);b=[];for(var k=0;k<a.length;k++)for(var m=a[k].chr.itms,n=0;n<m.length;n++){var p=m[n];0<=p&&(b[p]||(b[p]=0),b[p]++)}if(d&&!isNaN(e)&&(n=d.itms[e],0<=n)){var r=dt.itms[n];if("sts"==r.asrt)for(r=r.sts,k=0;k<r.length;k++);}e=new ccui.ListView;e.setDirection(ccui.ScrollView.DIR_VERTICAL);e.setBounceEnabled(!0);e.setAnchorPoint(cc.p(0,0));e.setItemsMargin(2);e.setContentSize(this.width,
this.height);m=main.getItms(SP.getSortItm(),c);p=m.length;for(k=0;k<p;k++)if(n=m[k].no,r=dt.itms[n],main.isItmEquip(n,d)){var s=m[k].suu,t=!1;if(void 0==s||isNaN(s)||0>s){if(!c)continue;t=!0}var w=new LayoutR(e.width,this.H_ROW);w.setTouchEnabled(!0);0>=s?w.setBackGroundImage(res.win):w.setBackGroundImage(res.win0);w.setBackGroundImageScale9Enabled(!0);w.setMargin(9,6,9,1);w.setSuuRow(2,4);w.setTag(n);var v=0.2,y=0;if(t)lbl=this.getLbl(g.str("htn5"),cc.color("#88cc88")),w.addColumn(lbl,0,y+0.05,4,
v-0.05),lbl=this.getLbl(g.str("mihkn"),cc.color("#888888")),w.addColumn(lbl,0,0.25,4);else{var t=Game.getItmIconAndEx(r),x;x=new cc.Sprite(res[t.icon]);x.setScale(g.FONT_SZ_MIDIUM/x.width,g.FONT_SZ_MIDIUM/x.height);w.addColumn(x,0,y,4);lbl=this.getLbl(main.nmItm(n),cc.color("#88ff88"));w.addColumn(lbl,0,y+0.05,4,v-0.05);lbl=this.getLblNum(g.str("znsu"),s,80,null,null,0<s?null:cc.color("#ff0000"));w.addColumn(lbl,0,0.25,4);lbl=this.getLblNum(g.str("sbsu"),b[n]?b[n]:0,80);w.addColumn(lbl,0,0.45,4);
v=e.width-10*g.FONT_SZ_MIDIUM;for(n=0;n<a.length;n++)main.isJobEquippable(a[n].chr.job,r.no)&&(x=new cc.Sprite(res["face"+a[n].no]),x.setScale(g.FONT_SZ_MIDIUM/x.width),y=v/e.width,w.addColumn(x,0,y,4,100),0<=a[n].chr.getItemPos(r.no)&&(lbl=g.getLabel("E",cc.color("#ffff00"),cc.color("#000000")),lbl.setPosition(x.x,x.y-this.H_ROW/2),w.addChild(lbl))),v+=g.FONT_SZ_MIDIUM;if(2<=r.range.length)lbl=this.getLblNum(g.str("pow"),r.val,80),w.addColumn(lbl,1,0.1,4),lbl=this.getLblNum(g.str("rng"),r.range[0]+
"\uff5e"+r.range[1],110),w.addColumn(lbl,1,0.3,4);else if(t.exs){y="";for(n=0;n<t.exs.length;n++)y+=t.exs[n];lbl=this.getLbl(y,cc.color("#dddddd"),g.FONT_SZ_SMALL);w.addColumn(lbl,1,0.05,4)}else if(r.sts){r=r.sts;v=0.2;y=0.1;for(n=t=0;n<r.length;n++)0<r[n]&&(2>t&&(lbl=this.getLblNum(NM_STSS[n],"+"+r[n],80),w.addColumn(lbl,1,y,4,v),y+=v),t++);for(n=0;n<r.length;n++)0>r[n]&&(2>t&&(lbl=this.getLblNum(NM_STSS[n],r[n],80,null,null,cc.color("#ff0000")),w.addColumn(lbl,1,y,4,v),y+=v),t++);2<t&&(lbl=g.getLabel("..."),
w.addColumn(lbl,1,y,4,v))}}e.pushBackCustomItem(w)}var u=!1;e.addEventListener(function(a,b){var c=a.getItem(a.getCurSelectedIndex()),d=c.getTag();switch(b){case ccui.ListView.EVENT_SELECTED_ITEM:if(u)break;c.opacity=128;c.runAction(cc.fadeIn(0.5).easing(cc.easeIn(3)));f&&f(d);break;case ccui.ListView.ON_SELECTED_ITEM_END:u=!0,a.getParent().clearRows(a),a.getParent().strongRow(c),g.playSe("ok"),cc.director.getRunningScene().scheduleOnce(function(a){h&&h(d)},0.1)}},this);e.setName("list");this.addChild(e)},
getLbl:function(a,b,c){c||(c=g.FONT_SZ_MIDIUM);return g.getLabel(a,b,null,null,c,cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER)},getLblNum:function(a,b,c,d,e,f){d||(d=g.FONT_SZ_MIDIUM);e||(e=cc.color("#000000"));f||(f=cc.color("#ffffff"));var h=new cc.Node;a=g.getLabel(a,e,null,null,0.75*d);h.addChild(a);a=g.getLabel(""+b,f,null,cc.color("#000000"),d,cc.TEXT_ALIGNMENT_RIGHT);a.setPosition(c,0);h.addChild(a);return h},strongRow:function(a){a.stopAllActions();a.opacity=255;a=g.getCover(a,
null,"mas");a.setColor(cc.color("#ffffff"));a.setOpacity(128)},clearRows:function(a){a||(a=this.getChildByName("list"));if(a){a=a.getItems();for(var b=0;b<a.length;b++){var c=a[b].getChildByName("cov");c&&c.removeFromParent()}}},setEnabled:function(a){var b=this.getChildByName("list");b&&b.setEnabled(a)},setPos:function(a){var b=this.getChildByName("list");b&&g.setListPos(b,a)},getPos:function(){var a=this.getChildByName("list");return a?g.getListPos(a):0}});var LayerRecord=cc.Layer.extend({ctor:function(){this._super();var a=cc.winSize.width/2;this.colShadow=cc.color("#000000");var b,c,d,e,f=0;b=this.setLayoutWinRow(3,a,60,8,f);var f=f+b.height,h=Game.getNmTeam();this.setLbl2(b,0,g.str("gmmd"),["EASY","NORMAL"][SP.getData().mode]);this.setLbl2(b,1,g.str("tmnm"),g.str("_gun",h));this.setLbl2(b,2,g.str("clrks"),""+main.getVal(0));b=this.setLayoutWinRow(3,a,60,8,f);f+=b.height;this.setLbl2(b,0,g.str("stns"),""+main.getVal(1));this.setLbl2(b,1,g.str("tsttklv"),
""+main.getVal(2));this.setLbl2(b,2,g.str("kktkexpgk"),""+main.getVal(3));b=this.setLayoutWinRow(3,a,60,8,f);f+=b.height;c=this.getLbl(g.str("kkchrlv"),cc.color("#00ffff"));b.addColumn(c,0,0);d=main.getChrs(!0,null,!0);for(e=0;e<d.length;e++){var k=d[e].no;if(main.isPaled(k)){c=new cc.Sprite(res["face"+k]);c.setScale(60/c.height);var h=5>e?1:2,m=e%5/5;b.addColumn(c,h,m,4,100);c=g.getLabel(""+SP.getData().chrs[k].lv,cc.color("#ffff00"),cc.color("#000000"));b.addColumn(c,h,m+0.1,0,0.1)}}b=this.setLayoutWinRow(6,
a,60,8,f);f+=b.height;c=this.getLbl(g.str("itmhknsr"),cc.color("#00ffff"));b.addColumn(c,0,0);this.setLblPer(b,1,main.getSuuItmSumi(),main.getSuuPlayersItm());c=this.getLbl(g.str("ktnclr"),cc.color("#00ffff"));b.addColumn(c,2,0);this.setLblPer(b,3,Game.getSuuClrStg(),Game.getSuuStg());c=this.getLbl(g.str("yrmclr"),cc.color("#00ffff"));b.addColumn(c,4,0);this.setLblPer(b,5,Game.getSuuClrSub(),Game.getSuuSub());cc.spriteFrameCache.addSpriteFrames(res.chr0Plist,res.chr0);cc.spriteFrameCache.addSpriteFrames(res.chr1Plist,
res.chr1);cc.spriteFrameCache.addSpriteFrames(res.ene0Plist,res.ene0);cc.spriteFrameCache.addSpriteFrames(res.ene1Plist,res.ene1);d=SP.ENE_TBT.length;b=this.setLayoutWinRow(1+d,a,60,8,f);f+=b.height;c=this.getLbl(g.str("tbts"),cc.color("#00ffff"));b.addColumn(c,0,0);for(e=0;e<d;e++)c=SP.ENE_TBT[e],m=SP.getDefeatByIx(e),0>m?(h=g.str("htn5"),m="-----"):(h=main.nmJob(c),m=""+m,c=dt.jobs[c].img,c=cc.Sprite.create("#"+(c[0]+"_"+c[1])+"20"),b.addColumn(c,1+e,0.05)),c=g.getLblNum(h,m,0.7*a,cc.color("#ffff00"),
null,null,this.colShadow),b.addColumn(c,1+e,0.2);this.setContentSize(a,f)},setLblPer:function(a,b,c,d){var e;e=g.getLabel(""+c,cc.color("#ffffff"),null,this.colShadow);a.addColumn(e,b,0.2,void 0,void 0,a.H_ALIGN_RIGHT);e=g.getLabel(" /",cc.color("#00ffff"),null,this.colShadow);a.addColumn(e,b,0.2);e=g.getLabel(""+d,cc.color("#00ffff"),null,this.colShadow);a.addColumn(e,b,0.4,void 0,void 0,a.H_ALIGN_RIGHT);c=Math.round(c/d*1E4)/100;e=g.getLabel(c+" %",cc.color("#ffff00"),null,this.colShadow,g.FONT_SZ_BIG);
a.addColumn(e,b,0.5)},setLbl2:function(a,b,c,d,e){void 0==e&&(e=cc.color("#00ffff"));c=this.getLbl(c,e);a.addColumn(c,b,0);c=this.getLbl(d,cc.color("#ffffff"));a.addColumn(c,b,0.5)},getLbl:function(a,b,c){c||(c=g.FONT_SZ_MIDIUM);return g.getLabel(a,b,null,this.colShadow,c,cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER)},setLayoutWin:function(a,b){var c=new LayoutR(a,b);c.setBackGroundImage(res.win0);c.setBackGroundImageScale9Enabled(!0);this.addChild(c);return c},setLayoutWinRow:function(a,
b,c,d,e){b=this.setLayoutWin(b,c*a+2*d);b.setMargin(d,d,d,d);b.setSuuRow(a,d);b.setPosition(0,-e-b.height);return b}}),SceneRecord=cc.Scene.extend({noData:0,ctor:function(){this._super()},transitioning:!0,onEnterTransitionDidFinish:function(){this._super();this.transitioning=!1;g.setBackKey(this)},update:function(){this.transitioning||(this.unscheduleUpdate(),this.showData(),g.showBtnSound(),g.showBtnHelp())},onEnter:function(){this._super();this.colShadow=cc.color("#000000");this.noData=SP.getLastNo();
var a=this;this.loadData(function(){a.scheduleUpdate()})},showData:function(a){this.hideData();var b=g.W_MENU,c=new LayoutR(cc.winSize.width/2,196);c.setBackGroundImage(res.win);c.setBackGroundImageScale9Enabled(!0);c.setMargin(8,8,8,8);c.setSuuRow(3,8);var d=g.getLabel(g.str("svdtno"," "+(this.noData+1)),cc.color("#ffff00"),null,this.colShadow);c.addColumn(d,0,0.5,0,0,c.H_ALIGN_CENTER);this.ariData()?(d=g.getLabel(g.str("svdate"),cc.color("#00ffff"),null,this.colShadow),c.addColumn(d,1,0),d=0<SP.getData().dtSv?
g.getStrDt(1E3*SP.getData().dtSv):g.str("fmi"),d=g.getLabel(d,cc.color("#ffffff"),null,this.colShadow),c.addColumn(d,1,0.5),d=g.getLabel(g.str("gnzic"),cc.color("#00ffff"),null,this.colShadow),c.addColumn(d,2,0),d=""!=SP.getData().noStg?Number(SP.getData().noStg):SP.getData().posNow,d=0<d?main.nmStg(d):0<SP.getData().posLast?g.str("fkn",main.nmStg(SP.getData().posLast)):g.str("fmi"),d=g.getLabel(d,cc.color("#ffffff"),null,this.colShadow),c.addColumn(d,2,0.5)):(d=g.getLabel("New Game",cc.color("#00ffff"),
null,this.colShadow),c.addColumn(d,1,0.5,0,0,c.H_ALIGN_CENTER));c.setName("head");this.addChild(c);c.setPosition(cc.winSize.width-b-c.width,cc.winSize.height-c.height);switch(a){case 1:c.setPosition(c.x+c.width,c.y);c.runAction(cc.moveBy(0.3,-c.width,0).easing(cc.easeQuadraticActionOut()));break;case -1:c.setPosition(c.x-c.width,c.y),c.runAction(cc.moveBy(0.3,c.width,0).easing(cc.easeQuadraticActionOut()))}a=c.height;this.ariData()?(c=new LayerRecord,c.setPosition(0,c.height),d=new ccui.ScrollView,
d.setDirection(ccui.ScrollView.DIR_VERTICAL),d.setBounceEnabled(!0),d.setContentSize(c.width,cc.winSize.height-a),d.setInnerContainerSize(c.getContentSize()),d.addChild(c),this.addChild(d),d.setName("reki"),d.setPosition(cc.winSize.width-b-d.width,-cc.winSize.height),d.runAction(cc.moveBy(0.3,0,cc.winSize.height).easing(cc.easeQuadraticActionOut())),this.startMenuContinue()):this.startMenuNewgame()},hideData:function(){g.removeByNm("head",this);g.removeByNm("reki",this)},startMenuContinue:function(){g.readyMenu();
this.addMenuContinue();this.addMenuCommon();g.startMenu()},startMenuNewgame:function(){g.readyMenu();this.addMenuNewgame();this.addMenuCommon();g.startMenu()},addMenuCommon:function(){var a=this;g.addMenuItem(g.str("prv"),0,function(){g.clearMenu();a.noData--;0>a.noData&&(a.noData=SP.SUU_SV-1);a.loadData(function(){a.showData(-1)})});g.addMenuItem(g.str("nxt"),0,function(){g.clearMenu();a.noData++;a.noData>=SP.SUU_SV&&(a.noData=0);a.loadData(function(){a.showData(1)})})},addMenuContinue:function(){var a=
this;g.addMenuItem(g.str("dlt"),0,function(){g.clearMenu();a.delData()});g.addMenuItem(g.str("ntsv"),0,function(){g.clearMenu();a.saveNet()});g.addMenuItem(g.str("cntn"),0,function(){g.clearMenu();a.startGame()},!0)},addMenuNewgame:function(){var a=this;g.addMenuItem();g.addMenuItem(g.str("ntld"),0,function(){g.clearMenu();a.loadNet()});g.addMenuItem(g.str("nwgm"),0,function(){g.clearMenu();a.newGame()},!0)},loadData:function(a){this.hideData();var b=g.startLoading(this,"Loading..."),c=this;this.scheduleOnce(function(){main=
new Main;SP.loadData(c.noData);main.init();g.stopLoading(b);a()},0.1)},ariData:function(){return 0!=SP.getData().posNow},startGame:function(){g.hideBtnSound();g.hideBtnHelp();cc.spriteFrameCache.removeSpriteFrames();0==SP.getData().posNow?cc.director.runScene(cc.TransitionFade.create(g.TM_START,new SceneGame(1))):""!=SP.getData().noStg?cc.director.runScene(new SceneGame(SP.getData().noStg)):g.DBG&&!isNaN(g.DBG_FIRST)?cc.director.runScene(new SceneGame(g.DBG_FIRST)):cc.director.runScene(cc.TransitionFade.create(g.TM_START,
new SceneWorld))},saveNet:function(){var a=this;(new LayerMsg).confYesNo(g.str("exntsv"+(g.isApp()?"":"pc")),function(){g.hktgAdd(a.noData,function(b,c){var d=0==b?(new LayerMsg).addMsg(g.str("okntsv")).addTap(function(){d.close();var b=(new LayerMsg).addMsg(g.str("okntsvmsg")).addInput("",c,50,g.FONT_SZ_MIDIUM).addBtn("OK",function(){b.close();a.startMenuContinue()});b.start(a)}):(new LayerMsg).addMsg(c).addTap(function(){d.close();a.startMenuContinue()});d.start(a)})},function(){a.startMenuContinue()},
g.str("gontsv"),g.str("ymr"),!0,!0)},delData:function(){var a=this;(new LayerMsg).confYesNo(g.str("cnfdel"),function(){SP.removeData(a.noData);var b=(new LayerMsg).addMsg(g.str("cmpdel")).addTap(function(){b.close();a.loadData(function(){a.showData()})});b.start(a)},function(){a.startMenuContinue()},g.str("godel"),g.str("ymr"),!0,!0)},newGame:function(){var a=this;Game.newGame(this,function(){a.startMenuNewgame()})},loadNet:function(){var a=this;g.netLoad(this,this.noData,function(){a.loadData(function(){a.showData()})},
function(){a.startMenuNewgame()})}});var LayerSettei=cc.Layer.extend({H_ROW:60,ctor:function(){this._super();this.colShadow=cc.color("#000000");this.width=cc.winSize.width/2;this.repaint()},repaint:function(){var a,b;this.data={volBgm:SP.getVolBgm(),volSe:SP.getVolSe(),spdBtl:SP.getSpdBtl(),msgStart:SP.isMsgStart(),msgTurn:SP.isMsgTurn(),autoBuki:SP.getTypeAuto(),autoSv:SP.getTypePause(),ShowLvup:SP.getShowLvup(),spdMsg:SP.getSpdMsg()};var c=this,d=0;a=this.setLayoutWinRow(4,this.width,this.H_ROW,8,d);d+=a.height;b=this.getLbl(g.str("volbgm"),
cc.color("#00ffff"));a.addColumn(b,0,0);this.setSlider(a,1,g.str("shou"),g.str("dai"),0,1,this.data.volBgm,function(a){a!=c.data.volBgm&&(c.data.volBgm=a,g.setVolBgm(a))});b=this.getLbl(g.str("volse"),cc.color("#00ffff"));a.addColumn(b,2,0);this.setSlider(a,3,g.str("shou"),g.str("dai"),0,1,this.data.volSe,function(a){a==c.data.volSe?g.playSe("ok",a):c.data.volSe=a});a=this.setLayoutWinRow(5,this.width,this.H_ROW,8,d);d+=a.height;b=this.getLbl(g.str("sntuspd"),cc.color("#00ffff"));a.addColumn(b,0,
0);this.setSlider(a,1,g.str("oso"),g.str("haya"),2,0.1,this.data.spdBtl,function(a){c.data.spdBtl=a});this.setCkb(a,3,g.str("btlsttmsg"),this.data.msgStart,function(a){c.data.msgStart=a});this.setCkb(a,4,g.str("tnsttmsg"),this.data.msgTurn,function(a){c.data.msgTurn=a});a=this.setLayoutWinRow(4,this.width,this.H_ROW,8,d);d+=a.height;b=this.getLbl(g.str("autoselbk"),cc.color("#00ffff"));a.addColumn(b,0,0);this.setRadio(a,1,[g.str("sinai"),g.str("suru1"),g.str("suru")],this.data.autoBuki,function(a){c.data.autoBuki=
a});a=this.setLayoutWinRow(4,this.width,this.H_ROW,8,d);d+=a.height;b=this.getLbl(g.str("autosv"),cc.color("#00ffff"));a.addColumn(b,0,0);this.setRadio(a,1,[g.str("noatsv"),g.str("bfract"),g.str("tnstt")],this.data.autoSv,function(a){c.data.autoSv=a});a=this.setLayoutWinRow(4,this.width,this.H_ROW,8,d);d+=a.height;b=this.getLbl(g.str("swlvup"),cc.color("#00ffff"));a.addColumn(b,0,0);this.setRadio(a,1,[g.str("nolvup"),g.str("lvupmsg"),g.str("lvupdtl")],this.data.ShowLvup,function(a){c.data.ShowLvup=
a});a=this.setLayoutWinRow(2,this.width,this.H_ROW,8,d);d+=a.height;b=this.getLbl(g.str("msgspd"),cc.color("#00ffff"));a.addColumn(b,0,0);this.setSlider(a,1,g.str("oso"),g.str("haya"),2,0,this.data.spdMsg,function(a){c.data.spdMsg=a});this.height=d},hanei:function(){SP.setVolBgm(this.data.volBgm);SP.setVolSe(this.data.volSe);SP.setSpdBtl(this.data.spdBtl);SP.setMsgStart(this.data.msgStart);SP.setMsgTurn(this.data.msgTurn);SP.setTypeAuto(this.data.autoBuki);SP.setTypePause(this.data.autoSv);SP.setShowLvup(this.data.ShowLvup);
SP.setSpdMsg(this.data.spdMsg)},setDefault:function(a){(new LayerMsg).confYesNo(g.str("cnfdflt"),function(){SP.setVolBgm(SP.DEFO_VOL_BGM);g.setVolBgm(SP.DEFO_VOL_BGM);SP.setVolSe(SP.DEFO_VOL_SE);SP.setSpdBtl(SP.DEFO_SPD_BTL);SP.setMsgStart(SP.DEFO_MSG_START);SP.setMsgTurn(SP.DEFO_MSG_TURN);SP.setTypeAuto(SP.DEFO_TYPE_AUTO);SP.setTypePause(SP.DEFO_TYPE_PAUSE);SP.setShowLvup(SP.DEFO_SHOW_LVUP);SP.setSpdMsg(SP.DEFO_SPD_MSG);a()},function(){},"OK",g.str("cancel"),!0,!0)},setCkb:function(a,b,c,d,e){var f=
ccui.CheckBox.create(res.ckb_off,res.ckb_on);f.addEventListener(function(a,b){g.playSe("ok");e(a.isSelected())});f.setSelected(d);a.addColumn(f,b,0.1,0,0,a.H_ALIGN_CENTER);a.addColumn(this.getLbl(c,cc.color("#ffff00")),b,0.2)},setRadio:function(a,b,c,d,e){var f=new cc.Menu;f.width=this.width;for(var h=this,k=c.length,m=0;m<k;m++){var n=new cc.Sprite(res.rdo_off),p=new cc.Sprite(res.rdo_on),n=new cc.MenuItemSprite(n,p);n.setTag(m);n.initWithCallback(function(a){g.playSe("ok");a=a.getTag();h.repaintRadio(f,
k,a);e&&e(a)});n.setPosition(n.width-f.width/2,m*-this.H_ROW);f.addChild(n);n=this.getLbl(c[m],cc.color("#ffff00"));a.addColumn(n,b+m,0.2)}this.repaintRadio(f,k,d);f.setAnchorPoint(0,0);a.addColumn(f,b,0)},repaintRadio:function(a,b,c){for(var d=0;d<b;d++){var e=a.getChildByTag(d),f;f=d==c?new cc.Sprite(res.rdo_on):new cc.Sprite(res.rdo_off);e.normalImage=f}},getSlider:function(a,b,c,d,e){var f=ccui.Slider.create(res.slider_bar,res.slider_btn);b>a?(f.setPercent(100*c/(b-a)),f.addEventListener(function(c,
e){var m=f.getPercent();d((b-a)*m/100)})):(f.setPercent(100*(a+b-c)/(a-b)),f.addEventListener(function(c,e){var m=f.getPercent();d(a+b-(a-b)*m/100)}));f.setScale9Enabled(!0);f.setCapInsets(cc.rect(0,0,0,0));f.setContentSize(e,f.height);return f},setSlider:function(a,b,c,d,e,f,h,k){a.addColumn(this.getLbl(c,cc.color("#ffff00")),b,0.1,0,0,a.H_ALIGN_CENTER);a.addColumn(this.getLbl(d,cc.color("#ffff00")),b,0.9,0,0,a.H_ALIGN_CENTER);c=this.getSlider(e,f,h,k,0.6*this.width);a.addColumn(c,b,0.5,0,0,a.H_ALIGN_CENTER)},
getLbl:function(a,b,c){c||(c=g.FONT_SZ_MIDIUM);return g.getLabel(a,b,null,this.colShadow,c,cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER)},setLayoutWin:function(a,b){var c=new LayoutR(a,b);c.setBackGroundImage(res.win0);c.setBackGroundImageScale9Enabled(!0);this.addChild(c);return c},setLayoutWinRow:function(a,b,c,d,e){b=this.setLayoutWin(b,c*a+2*d);b.setMargin(d,d,d,d);b.setSuuRow(a,d);b.setPosition(0,-e-b.height);return b}});cc.game.onStart=function(){var a=cc.sys;!a.isNative&&document.getElementById("cocosLoading")&&document.body.removeChild(document.getElementById("cocosLoading"));cc.view.enableRetina(a.os===a.OS_IOS?!0:!1);a.isMobile&&a.browserType!==a.BROWSER_TYPE_BAIDU&&a.browserType!==a.BROWSER_TYPE_WECHAT&&cc.view.enableAutoFullScreen(!0);cc.view.adjustViewPort(!0);cc.view.setDesignResolutionSize(1280,720,cc.ResolutionPolicy.SHOW_ALL);cc.view.resizeWithBrowserSize(!0);cc.LoaderScene.preload(g_resources,function(){cc.director.runScene(new TitleScene)},
this)};cc.game.run();