var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};_p=window;_p=Object.prototype;delete window._p;cc.newElement=function(a){return document.createElement(a)};cc._addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)};cc._isNodeJs="undefined"!==typeof require&&require("fs");cc.each=function(a,b,c){if(a)if(a instanceof Array)for(var d=0,e=a.length;d= a._limit)){var b=a._pool.shift(),c=b.value,d=b.index;a._workingSize++;a._iterator.call(a._iteratorTarget,c,d,function(b){if(!a._isErr)if(a.finishedSize++,a._workingSize--,b)a._isErr=!0,a._onEnd&&a._onEnd.call(a._onEndTarget,b);else{var c=Array.prototype.slice.call(arguments,1);a._results[this.index]=c[0];a.finishedSize==a.size?a._onEnd&&a._onEnd.call(a._onEndTarget,null,a._results):a._handleItem()}}.bind(b),a)}};f.flow=function(){if(0==this._pool.length)this._onEnd&&this._onEnd.call(this._onEndTarget, null,[]);else for(var a=0;ac?a+b+d:a.substring(0,c)+b+d},changeBasename:function(a,b,c){if(0==b.indexOf("."))return this.changeExtname(a,b);var d=a.indexOf("?"),e="";c=c?this.extname(a):"";0=d?0:d+1)+b+c+e}}; cc.loader={_jsCache:{},_register:{},_langPathCache:{},_aliases:{},resPath:"",audioPath:"",cache:{},getXMLHttpRequest:function(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP")},_getArgs4Js:function(a){var b=a[0],c=a[1],d=a[2],e=["",null,null];if(1===a.length)e[1]=b instanceof Array?b:[b];else if(2===a.length)"function"==typeof c?(e[1]=b instanceof Array?b:[b],e[2]=c):(e[0]=b||"",e[1]=c instanceof Array?c:[c]);else if(3===a.length)e[0]=b||"",e[1]=c instanceof Array?c:[c],e[2]=d;else throw"arguments error to load js!";return e},loadJs:function(a,b,c){var d=this,e=d._jsCache,f=d._getArgs4Js(arguments),g=f[0],h=f[1],f=f[2];-1=b.length)d&&d();else{var e=this;e._createScript(cc.path.join(a,b[c]),!1,function(f){if(f)return d(f); e._loadJs4Dependency(a,b,c+1,d)})}},_loadJsImg:function(){var a=document,b=a.getElementById("cocos2d_loadJsImg");if(!b){b=cc.newElement("img");cc._loadingImage&&(b.src=cc._loadingImage);a=a.getElementById(cc.game.config.id);a.style.backgroundColor="black";a.parentNode.appendChild(b);var c=getComputedStyle?getComputedStyle(a):a.currentStyle;c||(c={width:a.width,height:a.height});b.style.left=a.offsetLeft+(parseFloat(c.width)-b.width)/2+"px";b.style.top=a.offsetTop+(parseFloat(c.height)-b.height)/2+ "px";b.style.position="absolute"}return b},loadTxt:function(a,b){if(cc._isNodeJs)require("fs").readFile(a,function(a,c){a?b(a):b(null,c.toString())});else{var c=this.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET",a,!0);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?(c.setRequestHeader("Accept-Charset","utf-8"),c.onreadystatechange=function(){4==c.readyState&&(200==c.status?b(null,c.responseText):b(d))}):(c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8"), c.onload=function(){4==c.readyState&&(200==c.status?b(null,c.responseText):b(d))});c.send(null)}},_loadTxtSync:function(a){if(cc._isNodeJs)return require("fs").readFileSync(a).toString();var b=this.getXMLHttpRequest();b.open("GET",a,!1);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?b.setRequestHeader("Accept-Charset","utf-8"):b.overrideMimeType&&b.overrideMimeType("text/plain; charset\x3dutf-8");b.send(null);return 4==!b.readyState||200!=b.status?null:b.responseText},loadJson:function(a, b){this.loadTxt(a,function(c,d){try{c?b(c):b(null,JSON.parse(d))}catch(e){throw"load json ["+a+"] failed : "+e;}})},_checkIsImageURL:function(a){return null!=/(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(a)},loadImg:function(a,b,c){var d={isCrossOrigin:!0};void 0!==c?d.isCrossOrigin=null==b.isCrossOrigin?d.isCrossOrigin:b.isCrossOrigin:void 0!==b&&(c=b);var e=new Image;d.isCrossOrigin&&"file://"!=location.origin&&(e.crossOrigin="Anonymous");var f=function(){this.removeEventListener("load",f,!1); this.removeEventListener("error",g,!1);c&&c(null,e)},g=function(){this.removeEventListener("error",g,!1);"anonymous"==e.crossOrigin.toLowerCase()?(d.isCrossOrigin=!1,cc.loader.loadImg(a,d,c)):"function"==typeof c&&c("load image failed")};cc._addEventListener(e,"load",f);cc._addEventListener(e,"error",g);e.src=a;return e},_loadResIterator:function(a,b,c){var d=this,e=null,f=a.type;f?(f="."+f.toLowerCase(),e=a.src?a.src:a.name+f):(e=a,f=cc.path.extname(e));if(b=d.cache[e])return c(null,b);b=d._register[f.toLowerCase()]; if(!b)return cc.error("loader for ["+f+"] not exists!"),c();f=b.getBasePath?b.getBasePath():d.resPath;f=d.getUrl(f,e);b.load(f,e,a,function(a,b){a?(cc.log(a),d.cache[e]=null,delete d.cache[e],c()):(d.cache[e]=b,c(null,b))})},getUrl:function(a,b){var c=this._langPathCache,d=cc.path;if(void 0!==a&&void 0===b){b=a;var e=d.extname(b),e=e?e.toLowerCase():"";a=(e=this._register[e])?e.getBasePath?e.getBasePath():this.resPath:this.resPath}b=cc.path.join(a||"",b);if(b.match(/[\/(\\\\)]lang[\/(\\\\)]/i)){if(c[b])return c[b]; d=d.extname(b)||"";b=c[b]=b.substring(0,b.length-d.length)+"_"+cc.sys.language+d}return b},load:function(a,b,c){var d=this,e=arguments.length;if(0==e)throw"arguments error!";3==e?"function"==typeof b&&(b="function"==typeof c?{trigger:b,cb:c}:{cb:b,cbTarget:c}):2==e?"function"==typeof b&&(b={cb:b}):1==e&&(b={});a instanceof Array||(a=[a]);e=new cc.AsyncPool(a,0,function(a,c,e,k){d._loadResIterator(a,c,function(a){if(a)return e(a);var c=Array.prototype.slice.call(arguments,1);b.trigger&&b.trigger.call(b.triggerTarget, c[0],k.size,k.finishedSize);e(null,c[0])})},b.cb,b.cbTarget);e.flow();return e},_handleAliases:function(a,b){var c=this._aliases,d=[],e;for(e in a){var f=a[e];c[e]=f;d.push(f)}this.load(d,b)},loadAliases:function(a,b){var c=this,d=c.getRes(a);d?c._handleAliases(d.filenames,b):c.load(a,function(a,d){c._handleAliases(d[0].filenames,b)})},register:function(a,b){if(a&&b){if("string"==typeof a)return this._register[a.trim().toLowerCase()]=b;for(var c=0,d=a.length;cb)return"";var c=a[0],d=!0;"object"==typeof c&&(d=!1);for(var e=1;em.indexOf("core")&&m.splice(0,0,"core");for(var s=0,r=m.length;sb.DEBUG_MODE_ERROR?(c=cc._logToWebPage.bind(cc),cc.error=function(){c("ERROR : "+cc.formatStr.apply(cc,arguments))},cc.assert=function(a,b){if(!a&&b){for(var f=2;fc;c++)for(var d=0;256>d;d++)b[String.fromCharCode(c+256*d)]=String.fromCharCode(c)+String.fromCharCode(d);c=IEBinaryToArray_ByteStr(a);a=IEBinaryToArray_ByteStr_Last(a);return c.replace(/[\s\S]/g,function(a){return b[a]})+a}};cc=cc||{};cc._loadingImage="data:image/gif;base64,R0lGODlhEAAQALMNAD8/P7+/vyoqKlVVVX9/fxUVFUBAQGBgYMDAwC8vL5CQkP///wAAAP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAANACwAAAAAEAAQAAAEO5DJSau9OOvNex0IMnDIsiCkiW6g6BmKYlBFkhSUEgQKlQCARG6nEBwOgl+QApMdCIRD7YZ5RjlGpCUCACH5BAUAAA0ALAAAAgAOAA4AAAQ6kLGB0JA4M7QW0hrngRllkYyhKAYqKUGguAws0ypLS8JxCLQDgXAIDg+FRKIA6v0SAECCBpXSkstMBAAh+QQFAAANACwAAAAACgAQAAAEOJDJORAac6K1kDSKYmydpASBUl0mqmRfaGTCcQgwcxDEke+9XO2WkxQSiUIuAQAkls0n7JgsWq8RACH5BAUAAA0ALAAAAAAOAA4AAAQ6kMlplDIzTxWC0oxwHALnDQgySAdBHNWFLAvCukc215JIZihVIZEogDIJACBxnCSXTcmwGK1ar1hrBAAh+QQFAAANACwAAAAAEAAKAAAEN5DJKc4RM+tDyNFTkSQF5xmKYmQJACTVpQ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bm3eKO5QuzjrBqZji3x17PvNcyT288VvDBJbMWUovS2hslW7mFQ9nsPQPrGl2ew9A+saCod/WNxtbYsrfb17WBxx5ddD2281xC88klvDcSXEnWuzrqOGGC9zRUPZ7D0G9Y0uzWHoH1jQVCLreq6ntZbaO3it1mGy7RjTs1X2mYy20ZiCq8ZOODcdEdmsPQb1jS7PYegfWNdJuLqnQiSUlRqpFLmryxtH1Ma7Qw2gNNPOdSt0oI27p007s9h6B9Y0uz2HoH1jXX3Z+I4+1b8IJdX89xLHKQFMXQUahpxoiPN5P+onfU+A0/s9h6DesaXZ7D0D6xpG7OLbUtu0StW5JJx2bBsmbtiSiEk+cxoCWWSaVpZOk2vDVo0VYdnsPQb1jSNvZcCH1jSd2c+p1XAmFqEOmOPEfaH+BQd1ueo211IzrgFUYKNAAqI1WztCpUqVCRUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoD/9k\x3d";var cc=cc||{},ClassManager={id:0|998*Math.random(),instanceId:0|998*Math.random(),compileSuper:function(a,b,c){a=a.toString();var d=a.indexOf("("),e=a.indexOf(")"),d=a.substring(d+1,e),d=d.trim(),e=a.indexOf("{"),f=a.lastIndexOf("}");for(a=a.substring(e+1,f);-1!=a.indexOf("this._super");){var e=a.indexOf("this._super"),f=a.indexOf("(",e),g=a.indexOf(")",f),g=a.substring(f+1,g),g=(g=g.trim())?",":"";a=a.substring(0,e)+"ClassManager["+c+"]."+b+".call(this"+g+a.substring(f+1)}return Function(d,a)},getNewID:function(){return this.id++}, getNewInstanceId:function(){return this.instanceId++}};ClassManager.compileSuper.ClassManager=ClassManager; (function(){var a=/\b_super\b/,b=cc.game.config[cc.game.CONFIG_KEY.classReleaseMode];b&&console.log("release Mode");cc.Class=function(){};cc.Class.extend=function(c){function d(){this.__instanceId=ClassManager.getNewInstanceId();this.ctor&&this.ctor.apply(this,arguments)}var e=this.prototype,f=Object.create(e),g=ClassManager.getNewID();ClassManager[g]=e;var h={writable:!0,enumerable:!1,configurable:!0};f.__instanceId=null;d.id=g;h.value=g;Object.defineProperty(f,"__pid",h);d.prototype=f;h.value=d; Object.defineProperty(d.prototype,"constructor",h);this.__getters__&&(d.__getters__=cc.clone(this.__getters__));this.__setters__&&(d.__setters__=cc.clone(this.__setters__));for(var k=0,m=arguments.length;k=b.x||a.y>=b.y||a.x+a.width<=b.x+b.width||a.y+a.height<=b.y+b.height):!1};cc.rectGetMaxX=function(a){return a.x+a.width};cc.rectGetMidX=function(a){return a.x+a.width/2};cc.rectGetMinX=function(a){return a.x};cc.rectGetMaxY=function(a){return a.y+a.height};cc.rectGetMidY=function(a){return a.y+a.height/2};cc.rectGetMinY=function(a){return a.y}; cc.rectContainsPoint=function(a,b){return b.x>=cc.rectGetMinX(a)&&b.x<=cc.rectGetMaxX(a)&&b.y>=cc.rectGetMinY(a)&&b.y<=cc.rectGetMaxY(a)};cc.rectIntersectsRect=function(a,b){var c=a.y+a.height,d=b.x+b.width,e=b.y+b.height;return!(a.x+a.widtha?0:a};a._getG=function(){return this._gU8[0]};a._setG=function(a){this._gU8[0]=0>a?0:a};a._getB=function(){return this._bU8[0]};a._setB=function(a){this._bU8[0]=0>a?0:a};a._getA= function(){return this._aU8[0]};a._setA=function(a){this._aU8[0]=0>a?0:a};cc.defineGetterSetter(a,"r",a._getR,a._setR);cc.defineGetterSetter(a,"g",a._getG,a._setG);cc.defineGetterSetter(a,"b",a._getB,a._setB);cc.defineGetterSetter(a,"a",a._getA,a._setA);cc.Vertex2F=function(a,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Vertex2F.BYTES_PER_ELEMENT);this._offset=e||0;this._xF32=new Float32Array(this._arrayBuffer,this._offset,1);this._yF32=new Float32Array(this._arrayBuffer,this._offset+4,1);this._xF32[0]= a||0;this._yF32[0]=c||0};cc.Vertex2F.BYTES_PER_ELEMENT=8;Object.defineProperties(cc.Vertex2F.prototype,{x:{get:function(){return this._xF32[0]},set:function(a){this._xF32[0]=a},enumerable:!0},y:{get:function(){return this._yF32[0]},set:function(a){this._yF32[0]=a},enumerable:!0}});cc.Vertex3F=function(a,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Vertex3F.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;this._xF32=new Float32Array(e,f,1);this._xF32[0]=a||0;this._yF32=new Float32Array(e, f+Float32Array.BYTES_PER_ELEMENT,1);this._yF32[0]=c||0;this._zF32=new Float32Array(e,f+2*Float32Array.BYTES_PER_ELEMENT,1);this._zF32[0]=d||0};cc.Vertex3F.BYTES_PER_ELEMENT=12;Object.defineProperties(cc.Vertex3F.prototype,{x:{get:function(){return this._xF32[0]},set:function(a){this._xF32[0]=a},enumerable:!0},y:{get:function(){return this._yF32[0]},set:function(a){this._yF32[0]=a},enumerable:!0},z:{get:function(){return this._zF32[0]},set:function(a){this._zF32[0]=a},enumerable:!0}});cc.Tex2F=function(a, c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Tex2F.BYTES_PER_ELEMENT);this._offset=e||0;this._uF32=new Float32Array(this._arrayBuffer,this._offset,1);this._vF32=new Float32Array(this._arrayBuffer,this._offset+4,1);this._uF32[0]=a||0;this._vF32[0]=c||0};cc.Tex2F.BYTES_PER_ELEMENT=8;Object.defineProperties(cc.Tex2F.prototype,{u:{get:function(){return this._uF32[0]},set:function(a){this._uF32[0]=a},enumerable:!0},v:{get:function(){return this._vF32[0]},set:function(a){this._vF32[0]=a},enumerable:!0}}); cc.Quad2=function(a,c,d,e,f,g){this._arrayBuffer=f||new ArrayBuffer(cc.Quad2.BYTES_PER_ELEMENT);this._offset=g||0;f=this._arrayBuffer;g=cc.Vertex2F.BYTES_PER_ELEMENT;this._tl=a?new cc.Vertex2F(a.x,a.y,f,0):new cc.Vertex2F(0,0,f,0);this._tr=c?new cc.Vertex2F(c.x,c.y,f,g):new cc.Vertex2F(0,0,f,g);this._bl=d?new cc.Vertex2F(d.x,d.y,f,2*g):new cc.Vertex2F(0,0,f,2*g);this._br=e?new cc.Vertex2F(e.x,e.y,f,3*g):new cc.Vertex2F(0,0,f,3*g)};cc.Quad2.BYTES_PER_ELEMENT=32;cc.Quad3=function(a,c,d,e){this.bl=a|| new cc.Vertex3F(0,0,0);this.br=c||new cc.Vertex3F(0,0,0);this.tl=d||new cc.Vertex3F(0,0,0);this.tr=e||new cc.Vertex3F(0,0,0)};Object.defineProperties(cc.Quad2.prototype,{tl:{get:function(){return this._tl},set:function(a){this._tl.x=a.x;this._tl.y=a.y},enumerable:!0},tr:{get:function(){return this._tr},set:function(a){this._tr.x=a.x;this._tr.y=a.y},enumerable:!0},bl:{get:function(){return this._bl},set:function(a){this._bl.x=a.x;this._bl.y=a.y},enumerable:!0},br:{get:function(){return this._br},set:function(a){this._br.x= a.x;this._br.y=a.y},enumerable:!0}});cc.V3F_C4B_T2F=function(a,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V3F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex3F.BYTES_PER_ELEMENT;this._vertices=a?new cc.Vertex3F(a.x,a.y,a.z,e,f):new cc.Vertex3F(0,0,0,e,f);this._colors=c?cc.color(c.r,c.g,c.b,c.a,e,f+g):cc.color(0,0,0,0,e,f+g);this._texCoords=d?new cc.Tex2F(d.u,d.v,e,f+g+cc.Color.BYTES_PER_ELEMENT):new cc.Tex2F(0,0,e,f+g+cc.Color.BYTES_PER_ELEMENT)}; cc.V3F_C4B_T2F.BYTES_PER_ELEMENT=24;Object.defineProperties(cc.V3F_C4B_T2F.prototype,{vertices:{get:function(){return this._vertices},set:function(a){var c=this._vertices;c.x=a.x;c.y=a.y;c.z=a.z},enumerable:!0},colors:{get:function(){return this._colors},set:function(a){var c=this._colors;c.r=a.r;c.g=a.g;c.b=a.b;c.a=a.a},enumerable:!0},texCoords:{get:function(){return this._texCoords},set:function(a){this._texCoords.u=a.u;this._texCoords.v=a.v},enumerable:!0}});cc.V3F_C4B_T2F_Quad=function(a,c,d, e,f,g){this._arrayBuffer=f||new ArrayBuffer(cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT);this._offset=g||0;f=this._arrayBuffer;g=this._offset;var h=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._tl=a?new cc.V3F_C4B_T2F(a.vertices,a.colors,a.texCoords,f,g):new cc.V3F_C4B_T2F(null,null,null,f,g);this._bl=c?new cc.V3F_C4B_T2F(c.vertices,c.colors,c.texCoords,f,g+h):new cc.V3F_C4B_T2F(null,null,null,f,g+h);this._tr=d?new cc.V3F_C4B_T2F(d.vertices,d.colors,d.texCoords,f,g+2*h):new cc.V3F_C4B_T2F(null,null,null,f,g+2* h);this._br=e?new cc.V3F_C4B_T2F(e.vertices,e.colors,e.texCoords,f,g+3*h):new cc.V3F_C4B_T2F(null,null,null,f,g+3*h)};cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT=96;Object.defineProperties(cc.V3F_C4B_T2F_Quad.prototype,{tl:{get:function(){return this._tl},set:function(a){var c=this._tl;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},bl:{get:function(){return this._bl},set:function(a){var c=this._bl;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0}, tr:{get:function(){return this._tr},set:function(a){var c=this._tr;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},br:{get:function(){return this._br},set:function(a){var c=this._br;c.vertices=a.vertices;c.colors=a.colors;c.texCoords=a.texCoords},enumerable:!0},arrayBuffer:{get:function(){return this._arrayBuffer},enumerable:!0}});cc.V3F_C4B_T2F_QuadZero=function(){return new cc.V3F_C4B_T2F_Quad};cc.V3F_C4B_T2F_QuadCopy=function(a){if(!a)return cc.V3F_C4B_T2F_QuadZero(); var c=a.tl,d=a.bl,e=a.tr;a=a.br;return{tl:{vertices:{x:c.vertices.x,y:c.vertices.y,z:c.vertices.z},colors:{r:c.colors.r,g:c.colors.g,b:c.colors.b,a:c.colors.a},texCoords:{u:c.texCoords.u,v:c.texCoords.v}},bl:{vertices:{x:d.vertices.x,y:d.vertices.y,z:d.vertices.z},colors:{r:d.colors.r,g:d.colors.g,b:d.colors.b,a:d.colors.a},texCoords:{u:d.texCoords.u,v:d.texCoords.v}},tr:{vertices:{x:e.vertices.x,y:e.vertices.y,z:e.vertices.z},colors:{r:e.colors.r,g:e.colors.g,b:e.colors.b,a:e.colors.a},texCoords:{u:e.texCoords.u, v:e.texCoords.v}},br:{vertices:{x:a.vertices.x,y:a.vertices.y,z:a.vertices.z},colors:{r:a.colors.r,g:a.colors.g,b:a.colors.b,a:a.colors.a},texCoords:{u:a.texCoords.u,v:a.texCoords.v}}}};cc.V3F_C4B_T2F_QuadsCopy=function(a){if(!a)return[];for(var c=[],d=0;d>16,(a>>8)%256,a%256)}; cc.colorToHex=function(a){var b=a.r.toString(16),c=a.g.toString(16),d=a.b.toString(16);return"#"+(16>a.r?"0"+b:b)+(16>a.g?"0"+c:c)+(16>a.b?"0"+d:d)};cc.TEXT_ALIGNMENT_LEFT=0;cc.TEXT_ALIGNMENT_CENTER=1;cc.TEXT_ALIGNMENT_RIGHT=2;cc.VERTICAL_TEXT_ALIGNMENT_TOP=0;cc.VERTICAL_TEXT_ALIGNMENT_CENTER=1;cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM=2; cc._Dictionary=cc.Class.extend({_keyMapTb:null,_valueMapTb:null,__currId:0,ctor:function(){this._keyMapTb={};this._valueMapTb={};this.__currId=2<<(0|10*Math.random())},__getKey:function(){this.__currId++;return"key_"+this.__currId},setObject:function(a,b){if(null!=b){var c=this.__getKey();this._keyMapTb[c]=b;this._valueMapTb[c]=a}},objectForKey:function(a){if(null==a)return null;var b=this._keyMapTb,c;for(c in b)if(b[c]===a)return this._valueMapTb[c];return null},valueForKey:function(a){return this.objectForKey(a)}, removeObjectForKey:function(a){if(null!=a){var b=this._keyMapTb,c;for(c in b)if(b[c]===a){delete this._valueMapTb[c];delete b[c];break}}},removeObjectsForKeys:function(a){if(null!=a)for(var b=0;b=0.8*b?b/window.devicePixelRatio:this._frame.clientWidth;a.height=cc.sys.isMobile&&this._frame.clientWidth>=0.8*c?c/window.devicePixelRatio:this._frame.clientHeight},_adjustSizeKeepCanvasSize:function(){var a=this._originalDesignResolutionSize.width,b=this._originalDesignResolutionSize.height; 0Math.abs(a-c)&&(c=a);2>Math.abs(b-d)&&(d=b);a=cc.rect(Math.round((a-c)/2),Math.round((b-d)/2),c,d);cc._renderType==cc._RENDER_TYPE_CANVAS&&cc._renderContext.translate(a.x,a.y+d);this._result.scale=[e,f];this._result.viewport=a;return this._result},preApply:function(a){},apply:function(a,b){return{scale:[1,1]}},postApply:function(a){}}); (function(){var a=cc.ContainerStrategy.extend({apply:function(a){this._setupContainer(a,a._frameSize.width,a._frameSize.height)}}),b=cc.ContainerStrategy.extend({apply:function(a,b){var c=a._frameSize.width,d=a._frameSize.height,e=cc.container.style,n=b.width,q=b.height,s=c/n,r=d/q,t,u;s>=1}return-1},_removeUsedIndexBit:function(a){0>a|| a>=this._maxTouches||(a=~(1<=c.length?c.push(a):(c[this._preTouchPoolPointer]=a,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(a, b,c){var d=this._preTouchPoint;a=this._glView.convertToLocationInView(a,b,c);b=new cc.Touch(a.x,a.y);b._setPrevPoint(d.x,d.y);d.x=a.x;d.y=a.y;return b},getMouseEvent:function(a,b,c){var d=this._prevMousePoint;this._glView._convertMouseToLocationInView(a,b);b=new cc.EventMouse(c);b.setLocation(a.x,a.y);b._setPrevCursor(d.x,d.y);d.x=a.x;d.y=a.y;return b},getPointByEvent:function(a,b){if(null!=a.pageX)return{x:a.pageX,y:a.pageY};b.left-=document.body.scrollLeft;b.top-=document.body.scrollTop;return{x:a.clientX, y:a.clientY}},getTouchesByEvent:function(a,b){for(var c=[],d=this._glView,e,f,g=this._preTouchPoint,h=a.changedTouches.length,k=0;kthis._accelInterval&&(this._accelCurTime-=this._accelInterval,cc.eventManager.dispatchEvent(new cc.EventAcceleration(this._acceleration)));this._accelCurTime+=a}};var _p=cc.inputManager;_p.setAccelerometerEnabled=function(a){this._accelEnabled!==a&&(this._accelEnabled=a,a=cc.director.getScheduler(),this._accelEnabled?(this._accelCurTime=0,a.scheduleUpdateForTarget(this)):(this._accelCurTime=0,a.unscheduleUpdateForTarget(this)))};_p.setAccelerometerInterval=function(a){this._accelInterval!==a&&(this._accelInterval=a)}; _p._registerKeyboardEvent=function(){cc._addEventListener(cc._canvas,"keydown",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!0));a.stopPropagation();a.preventDefault()},!1);cc._addEventListener(cc._canvas,"keyup",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!1));a.stopPropagation();a.preventDefault()},!1)}; _p._registerAccelerometerEvent=function(){var a=window;this._acceleration=new cc.Acceleration;this._accelDeviceEvent=a.DeviceMotionEvent||a.DeviceOrientationEvent;cc.sys.browserType==cc.sys.BROWSER_TYPE_MOBILE_QQ&&(this._accelDeviceEvent=window.DeviceOrientationEvent);var b=this._accelDeviceEvent==a.DeviceMotionEvent?"devicemotion":"deviceorientation",c=navigator.userAgent;if(/Android/.test(c)||/Adr/.test(c)&&cc.sys.browserType==cc.BROWSER_TYPE_UC)this._minus=-1;cc._addEventListener(a,b,this.didAccelerate.bind(this), !1)}; _p.didAccelerate=function(a){var b=window;if(this._accelEnabled){var c=this._acceleration,d,e,f;this._accelDeviceEvent==window.DeviceMotionEvent?(f=a.accelerationIncludingGravity,d=this._accelMinus*f.x*0.1,e=this._accelMinus*f.y*0.1,f=0.1*f.z):(d=a.gamma/90*0.981,e=0.981*-(a.beta/90),f=a.alpha/90*0.981);cc.sys.os===cc.sys.OS_ANDROID?(c.x=-d,c.y=-e):(c.x=d,c.y=e);c.z=f;c.timestamp=a.timeStamp||Date.now();a=c.x;b.orientation===cc.UIInterfaceOrientationLandscapeRight?(c.x=-c.y,c.y=a):b.orientation===cc.UIInterfaceOrientationLandscapeLeft? (c.x=c.y,c.y=-a):b.orientation===cc.UIInterfaceOrientationPortraitUpsideDown&&(c.x=-c.x,c.y=-c.y)}};delete _p;cc.AffineTransform=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.tx=e;this.ty=f};cc.affineTransformMake=function(a,b,c,d,e,f){return{a:a,b:b,c:c,d:d,tx:e,ty:f}};cc.pointApplyAffineTransform=function(a,b){return{x:b.a*a.x+b.c*a.y+b.tx,y:b.b*a.x+b.d*a.y+b.ty}};cc._pointApplyAffineTransform=function(a,b,c){return{x:c.a*a+c.c*b+c.tx,y:c.b*a+c.d*b+c.ty}};cc.sizeApplyAffineTransform=function(a,b){return{width:b.a*a.width+b.c*a.height,height:b.b*a.width+b.d*a.height}}; cc.affineTransformMakeIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}};cc.affineTransformIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}; cc.rectApplyAffineTransform=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc._pointApplyAffineTransform(d,c,b),c=cc._pointApplyAffineTransform(e,c,b),d=cc._pointApplyAffineTransform(d,f,b),h=cc._pointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);return cc.rect(e,k,f-e,g-k)}; cc._rectApplyAffineTransformIn=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc._pointApplyAffineTransform(d,c,b),c=cc._pointApplyAffineTransform(e,c,b),d=cc._pointApplyAffineTransform(d,f,b),h=cc._pointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);a.x=e;a.y=k;a.width=f-e;a.height=g-k;return a}; cc.affineTransformTranslate=function(a,b,c){return{a:a.a,b:a.b,c:a.c,d:a.d,tx:a.tx+a.a*b+a.c*c,ty:a.ty+a.b*b+a.d*c}};cc.affineTransformScale=function(a,b,c){return{a:a.a*b,b:a.b*b,c:a.c*c,d:a.d*c,tx:a.tx,ty:a.ty}};cc.affineTransformRotate=function(a,b){var c=Math.sin(b),d=Math.cos(b);return{a:a.a*d+a.c*c,b:a.b*d+a.d*c,c:a.c*d-a.a*c,d:a.d*d-a.b*c,tx:a.tx,ty:a.ty}}; cc.affineTransformConcat=function(a,b){return{a:a.a*b.a+a.b*b.c,b:a.a*b.b+a.b*b.d,c:a.c*b.a+a.d*b.c,d:a.c*b.b+a.d*b.d,tx:a.tx*b.a+a.ty*b.c+b.tx,ty:a.tx*b.b+a.ty*b.d+b.ty}};cc.affineTransformEqualToTransform=function(a,b){return a.a===b.a&&a.b===b.b&&a.c===b.c&&a.d===b.d&&a.tx===b.tx&&a.ty===b.ty};cc.affineTransformInvert=function(a){var b=1/(a.a*a.d-a.b*a.c);return{a:b*a.d,b:-b*a.b,c:-b*a.c,d:b*a.a,tx:b*(a.c*a.ty-a.d*a.tx),ty:b*(a.b*a.tx-a.a*a.ty)}};cc.POINT_EPSILON=parseFloat("1.192092896e-07F");cc.pNeg=function(a){return cc.p(-a.x,-a.y)};cc.pAdd=function(a,b){return cc.p(a.x+b.x,a.y+b.y)};cc.pSub=function(a,b){return cc.p(a.x-b.x,a.y-b.y)};cc.pMult=function(a,b){return cc.p(a.x*b,a.y*b)};cc.pMidpoint=function(a,b){return cc.pMult(cc.pAdd(a,b),0.5)};cc.pDot=function(a,b){return a.x*b.x+a.y*b.y};cc.pCross=function(a,b){return a.x*b.y-a.y*b.x};cc.pPerp=function(a){return cc.p(-a.y,a.x)};cc.pRPerp=function(a){return cc.p(a.y,-a.x)}; cc.pProject=function(a,b){return cc.pMult(b,cc.pDot(a,b)/cc.pDot(b,b))};cc.pRotate=function(a,b){return cc.p(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x)};cc.pUnrotate=function(a,b){return cc.p(a.x*b.x+a.y*b.y,a.y*b.x-a.x*b.y)};cc.pLengthSQ=function(a){return cc.pDot(a,a)};cc.pDistanceSQ=function(a,b){return cc.pLengthSQ(cc.pSub(a,b))};cc.pLength=function(a){return Math.sqrt(cc.pLengthSQ(a))};cc.pDistance=function(a,b){return cc.pLength(cc.pSub(a,b))};cc.pNormalize=function(a){return cc.pMult(a,1/cc.pLength(a))}; cc.pForAngle=function(a){return cc.p(Math.cos(a),Math.sin(a))};cc.pToAngle=function(a){return Math.atan2(a.y,a.x)};cc.clampf=function(a,b,c){if(b>c){var d=b;b=c;c=d}return a=e.x&&0<=e.y&&1>=e.y?!0:!1};cc.pIntersectPoint=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)?(c=cc.p(0,0),c.x=a.x+e.x*(b.x-a.x),c.y=a.y+e.x*(b.y-a.y),c):cc.p(0,0)};cc.pSameAs=function(a,b){return null!=a&&null!=b?a.x==b.x&&a.y==b.y:!1};cc.pZeroIn=function(a){a.x=0;a.y=0};cc.pIn=function(a,b){a.x=b.x;a.y=b.y};cc.pMultIn=function(a,b){a.x*=b;a.y*=b}; cc.pSubIn=function(a,b){a.x-=b.x;a.y-=b.y};cc.pAddIn=function(a,b){a.x+=b.x;a.y+=b.y};cc.pNormalizeIn=function(a){cc.pMultIn(a,1/Math.sqrt(a.x*a.x+a.y*a.y))};cc.vertexLineToPolygon=function(a,b,c,d,e){e+=d;if(!(1>=e)){b*=0.5;for(var f,g=e-1,h=d;hb.value||1h.getLocalZOrder())this._visitTarget(h,!1);else break;null!=g[a.__instanceId]&&(f[a.getGlobalZOrder()]||(f[a.getGlobalZOrder()]=[]),f[a.getGlobalZOrder()].push(a.__instanceId));for(;df[c]._localZOrder)f[c].visit();else break;for(this.draw(a);cd._localZOrder)d.visit(a);else break;for(this.draw(a);bd&&-1E-6e&&-1E-6d||c>d)return cc.log(cc._LogInfos.Texture2D_initWithImage_2,b,c,d,d),!1;this._isLoaded=!0;return this._initPremultipliedATextureWithImage(a,b,c)},initWithElement:function(a){a&&(this._webTextureObj=cc._renderContext.createTexture(),this._htmlElementObj=a)},getHtmlElementObj:function(){return this._htmlElementObj}, isLoaded:function(){return this._isLoaded},handleLoadedTexture:function(){if(cc._rendererInitialized){if(!this._htmlElementObj){var a=cc.loader.getRes(this.url);if(!a)return;this.initWithElement(a)}this._htmlElementObj.width&&this._htmlElementObj.height&&(this._isLoaded=!0,a=cc._renderContext,cc.glBindTexture2D(this),a.pixelStorei(a.UNPACK_ALIGNMENT,4),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,this._htmlElementObj),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE),cc.glBindTexture2D(null),a=this._htmlElementObj.height,this._pixelsWide=this._contentSize.width=this._htmlElementObj.width,this._pixelsHigh=this._contentSize.height=a,this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.maxT=this.maxS=1,this._hasMipmaps=this._hasPremultipliedAlpha= !1,this._callLoadedEventCallbacks())}},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.NEAREST)},setAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)},generateMipmap:function(){cc.assert(this._pixelsWide==cc.NextPOT(this._pixelsWide)&&this._pixelsHigh==cc.NextPOT(this._pixelsHigh),"Mimpap texture only works in POT textures");cc.glBindTexture2D(this);cc._renderContext.generateMipmap(cc._renderContext.TEXTURE_2D);this._hasMipmaps=!0},stringForFormat:function(){return cc.Texture2D._M[this._pixelFormat]},bitsPerPixelForFormat:function(a){a=a||this._pixelFormat; var b=cc.Texture2D._B[a];if(null!=b)return b;cc.log(cc._LogInfos.Texture2D_bitsPerPixelForFormat,a);return-1},_initPremultipliedATextureWithImage:function(a,b,c){var d=cc.Texture2D,e=a.getData(),f=null,f=null,g=a.hasAlpha(),h=cc.size(a.getWidth(),a.getHeight()),k=d.defaultPixelFormat,m=a.getBitsPerComponent();g||(8<=m?k=d.PIXEL_FORMAT_RGB888:(cc.log(cc._LogInfos.Texture2D__initPremultipliedATextureWithImage),k=d.PIXEL_FORMAT_RGB565));var n=b*c;if(k==d.PIXEL_FORMAT_RGB565)if(g)for(e=new Uint16Array(b* c),f=a.getData(),m=0;m>0&255)>>3<<11|(f[m]>>8&255)>>2<<5|(f[m]>>16&255)>>3<<0;else for(e=new Uint16Array(b*c),f=a.getData(),m=0;m>3<<11|(f[m]&255)>>2<<5|(f[m]&255)>>3<<0;else if(k==d.PIXEL_FORMAT_RGBA4444)for(e=new Uint16Array(b*c),f=a.getData(),m=0;m>0&255)>>4<<12|(f[m]>>8&255)>>4<<8|(f[m]>>16&255)>>4<<4|(f[m]>>24&255)>>4<<0;else if(k==d.PIXEL_FORMAT_RGB5A1)for(e=new Uint16Array(b*c),f=a.getData(),m=0;m>0&255)>>3<<11|(f[m]>> 8&255)>>3<<6|(f[m]>>16&255)>>3<<1|(f[m]>>24&255)>>7<<0;else if(k==d.PIXEL_FORMAT_A8)for(e=new Uint8Array(b*c),f=a.getData(),m=0;m>24&255;if(g&&k==d.PIXEL_FORMAT_RGB888)for(f=a.getData(),e=new Uint8Array(b*c*3),m=0;m>0&255,e[3*m+1]=f>>8&255,e[3*m+2]=f>>16&255;this.initWithData(e,k,b,c,h);a.getData();this._hasPremultipliedAlpha=a.isPremultipliedAlpha();return!0},addLoadedEventListener:function(a,b){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:a, eventTarget:b})},removeLoadedEventListener:function(a){if(this._loadedEventListeners)for(var b=this._loadedEventListeners,c=0;cthis._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=b*c,e=(this._totalQuads- 1-b)*c;this._quads[this._totalQuads-1]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*c);this._quadsReader.set(this._quadsReader.subarray(d,d+e),d+c);this._setQuadToArray(a,b);this.dirty=!0}},insertQuads:function(a,b,c){c=c||a.length;cc.assert(b+c<=this._capacity,cc._LogInfos.TextureAtlas_insertQuads);var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads+=c;if(this._totalQuads>this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var e=b* d,f=(this._totalQuads-1-b-c)*d,g=this._totalQuads-1-c,h;for(h=0;hb?(f=b*c,d.set(d.subarray(f,f+(a-b)*c),f+c),d.set(e,f)):(f=(a+1)*c,d.set(d.subarray(f,f+(b-a)*c),f-c),d.set(e,b*c));this.dirty=!0}},removeQuadAtIndex:function(a){cc.assert(ac){f=[];g=new ArrayBuffer(b*d);for(a=0;ac?(b=new Uint16Array(6*d),b.set(this._indices,0),this._indices=b):this._indices=this._indices.subarray(0,6*d);this._setupIndices();this._mapBuffers(); return this.dirty=!0},increaseTotalQuadsWith:function(a){this._totalQuads+=a},moveQuadsFromIndex:function(a,b,c){if(void 0===c){if(c=b,b=this._totalQuads-a,cc.assert(c+(this._totalQuads-a)<=this._capacity,cc._LogInfos.TextureAtlas_moveQuadsFromIndex),0===b)return}else if(cc.assert(c+b<=this._totalQuads,cc._LogInfos.TextureAtlas_moveQuadsFromIndex_2),cc.assert(ae;e++)d[e].r=a.r,d[e].g=a.g,d[e].b=a.b,d[e].a=c;this._bindLayerColorsBufferData()};a.draw=function(a){a=a||cc._renderContext;cc.nodeDrawSetup(this);cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_COLOR);a.bindBuffer(a.ARRAY_BUFFER,this._verticesFloat32Buffer);a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,this._colorsUint8Buffer); a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,0,0);cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst);a.drawArrays(a.TRIANGLE_STRIP,0,4)};a._bindLayerVerticesBufferData=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._verticesFloat32Buffer);a.bufferData(a.ARRAY_BUFFER,this._squareVerticesAB,a.STATIC_DRAW)};a._bindLayerColorsBufferData=function(){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._colorsUint8Buffer);a.bufferData(a.ARRAY_BUFFER,this._squareColorsAB, a.STATIC_DRAW)}}; cc._tmp.WebGLLayerGradient=function(){var a=cc.LayerGradient.prototype;a.draw=cc.LayerColor.prototype.draw;a._updateColor=function(){var a=this._alongVector,c=cc.pLength(a);if(0!==c){var d=Math.sqrt(2),a=cc.p(a.x/c,a.y/c);this._compressedInterpolation&&(c=1/(Math.abs(a.x)+Math.abs(a.y)),a=cc.pMult(a,c*d));var e=this._displayedOpacity/255,c=this._displayedColor,f=this._endColor,c={r:c.r,g:c.g,b:c.b,a:this._startOpacity*e},e={r:f.r,g:f.g,b:f.b,a:this._endOpacity*e},g=this._squareColors,f=g[0],h=g[1], k=g[2],g=g[3];f.r=e.r+(d+a.x+a.y)/(2*d)*(c.r-e.r);f.g=e.g+(d+a.x+a.y)/(2*d)*(c.g-e.g);f.b=e.b+(d+a.x+a.y)/(2*d)*(c.b-e.b);f.a=e.a+(d+a.x+a.y)/(2*d)*(c.a-e.a);h.r=e.r+(d-a.x+a.y)/(2*d)*(c.r-e.r);h.g=e.g+(d-a.x+a.y)/(2*d)*(c.g-e.g);h.b=e.b+(d-a.x+a.y)/(2*d)*(c.b-e.b);h.a=e.a+(d-a.x+a.y)/(2*d)*(c.a-e.a);k.r=e.r+(d+a.x-a.y)/(2*d)*(c.r-e.r);k.g=e.g+(d+a.x-a.y)/(2*d)*(c.g-e.g);k.b=e.b+(d+a.x-a.y)/(2*d)*(c.b-e.b);k.a=e.a+(d+a.x-a.y)/(2*d)*(c.a-e.a);g.r=e.r+(d-a.x-a.y)/(2*d)*(c.r-e.r);g.g=e.g+(d-a.x-a.y)/ (2*d)*(c.g-e.g);g.b=e.b+(d-a.x-a.y)/(2*d)*(c.b-e.b);g.a=e.a+(d-a.x-a.y)/(2*d)*(c.a-e.a);this._bindLayerColorsBufferData()}}};cc._tmp.PrototypeLayerColor=function(){var a=cc.LayerColor.prototype;cc.defineGetterSetter(a,"width",a._getWidth,a._setWidth);cc.defineGetterSetter(a,"height",a._getHeight,a._setHeight)}; cc._tmp.PrototypeLayerGradient=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.Layer=cc.Node.extend({_isBaked:!1,_bakeSprite:null,_className:"Layer",ctor:function(){var a=cc.Node.prototype;a.ctor.call(this);this._ignoreAnchorPointForPosition=!0;a.setAnchorPoint.call(this,0.5,0.5);a.setContentSize.call(this,cc.winSize)},init:function(){this._ignoreAnchorPointForPosition=!0;this.setAnchorPoint(0.5,0.5);this.setContentSize(cc.winSize);this.cascadeColor=this.cascadeOpacity=!1;return!0},bake:null,unbake:null,isBaked:function(){return this._isBaked},visit:null}); cc.Layer.create=function(){return new cc.Layer}; if(cc._renderType===cc._RENDER_TYPE_CANVAS){var p=cc.Layer.prototype;p.bake=function(){if(!this._isBaked){this._isBaked=this._cacheDirty=!0;this._cachedParent=this;for(var a=this._children,b=0,c=a.length;bg._localZOrder)g.visit(f);else break;for(this.draw(f);b=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))};cc._tmp.WebGLSprite=function(){var a=cc.Sprite.prototype;a._spriteFrameLoadedCallback=function(a){this.setNodeDirty(!0);this.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize());this._callLoadedEventCallbacks()};a.setOpacityModifyRGB=function(a){this._opacityModifyRGB!==a&&(this._opacityModifyRGB=a,this.updateColor())};a.updateDisplayedOpacity=function(a){cc.Node.prototype.updateDisplayedOpacity.call(this,a);this.updateColor()};a.ctor=function(a,c,d){cc.Node.prototype.ctor.call(this);this._shouldBeHidden= !1;this._offsetPosition=cc.p(0,0);this._unflippedOffsetPositionFromCenter=cc.p(0,0);this._blendFunc={src:cc.BLEND_SRC,dst:cc.BLEND_DST};this._rect=cc.rect(0,0,0,0);this._quad=new cc.V3F_C4B_T2F_Quad;this._quadWebBuffer=cc._renderContext.createBuffer();this._textureLoaded=this._quadDirty=!0;this._softInit(a,c,d)};a.setBlendFunc=function(a,c){var d=this._blendFunc;void 0===c?(d.src=a.src,d.dst=a.dst):(d.src=a,d.dst=c)};a.init=function(){if(0a.width&&cc.error(cc._LogInfos.RectWidth,a.url),f>a.height&&cc.error(cc._LogInfos.RectHeight,a.url));this.texture=a; this.setTextureRect(c,d);this.batchNode=null;return this._quadDirty=!0};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.batchNode=this._batchNode;this._quadDirty=!0;this._callLoadedEventCallbacks()}};a.setTextureRect=function(a,c,d){this._rectRotated=c||!1;this.setContentSize(d||a);this.setVertexRect(a); this._setTextureCoords(a);a=this._unflippedOffsetPositionFromCenter;this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);var e=this._rect;this._offsetPosition.x=a.x+(this._contentSize.width-e.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-e.height)/2;if(this._batchNode)this.dirty=!0;else{a=0+this._offsetPosition.x;c=0+this._offsetPosition.y;d=a+e.width;var e=c+e.height,f=this._quad;f.bl.vertices={x:a,y:c,z:0};f.br.vertices={x:d,y:c,z:0};f.tl.vertices={x:a,y:e,z:0};f.tr.vertices={x:d, y:e,z:0};this._quadDirty=!0}};a.updateTransform=function(){if(this.dirty){var a=this._quad,c=this._parent;if(!this._visible||c&&c!=this._batchNode&&c._shouldBeHidden)a.br.vertices=a.tl.vertices=a.tr.vertices=a.bl.vertices={x:0,y:0,z:0},this._shouldBeHidden=!0;else{this._shouldBeHidden=!1;var d=this._transformToBatch=c&&c!=this._batchNode?cc.affineTransformConcat(this.nodeToParentTransform(),c._transformToBatch):this.nodeToParentTransform(),e=this._rect,c=this._offsetPosition.x,f=this._offsetPosition.y, g=c+e.width,h=f+e.height,k=d.tx,m=d.ty,n=d.a,q=d.b,s=d.d,r=-d.c,d=c*n-f*r+k,e=c*q+f*s+m,t=g*n-f*r+k,f=g*q+f*s+m,u=g*n-h*r+k,g=g*q+h*s+m,k=c*n-h*r+k,c=c*q+h*s+m,h=this._vertexZ;cc.SPRITEBATCHNODE_RENDER_SUBPIXEL||(d|=0,e|=0,t|=0,f|=0,u|=0,g|=0,k|=0,c|=0);a.bl.vertices={x:d,y:e,z:h};a.br.vertices={x:t,y:f,z:h};a.tl.vertices={x:k,y:c,z:h};a.tr.vertices={x:u,y:g,z:h}}this.textureAtlas.updateQuad(a,this.atlasIndex);this.dirty=this._recursiveDirty=!1}this._hasChildren&&this._arrayMakeObjectsPerformSelector(this._children, cc.Node._StateCallbackType.updateTransform);cc.SPRITE_DEBUG_DRAW&&(a=[cc.p(this._quad.bl.vertices.x,this._quad.bl.vertices.y),cc.p(this._quad.br.vertices.x,this._quad.br.vertices.y),cc.p(this._quad.tr.vertices.x,this._quad.tr.vertices.y),cc.p(this._quad.tl.vertices.x,this._quad.tl.vertices.y)],cc._drawingUtil.drawPoly(a,4,!0))};a.addChild=function(a,c,d){cc.assert(a,cc._LogInfos.Sprite_addChild_3);null==c&&(c=a._localZOrder);null==d&&(d=a.tag);if(this._batchNode){if(!(a instanceof cc.Sprite)){cc.log(cc._LogInfos.Sprite_addChild); return}a.texture._webTextureObj!==this.textureAtlas.texture._webTextureObj&&cc.log(cc._LogInfos.Sprite_addChild_2);this._batchNode.appendChild(a);this._reorderChildDirty||this._setReorderChildDirtyRecursively()}cc.Node.prototype.addChild.call(this,a,c,d);this._hasChildren=!0};a.setOpacity=function(a){cc.Node.prototype.setOpacity.call(this,a);this.updateColor()};a.setColor=function(a){cc.Node.prototype.setColor.call(this,a);this.updateColor()};a.updateDisplayedColor=function(a){cc.Node.prototype.updateDisplayedColor.call(this, a);this.updateColor()};a.setSpriteFrame=function(a){var c=this;cc.isString(a)&&(a=cc.spriteFrameCache.getSpriteFrame(a),cc.assert(a,cc._LogInfos.Sprite_setSpriteFrame));c.setNodeDirty(!0);var d=a.getOffset();c._unflippedOffsetPositionFromCenter.x=d.x;c._unflippedOffsetPositionFromCenter.y=d.y;d=a.getTexture();a.textureLoaded()||(c._textureLoaded=!1,a.addLoadedEventListener(function(a){c._textureLoaded=!0;var b=a.getTexture();b!=c._texture&&(c.texture=b);c.setTextureRect(a.getRect(),a.isRotated(), a.getOriginalSize());c._callLoadedEventCallbacks()},c));d!=c._texture&&(c.texture=d);c._rectRotated=a.isRotated();c.setTextureRect(a.getRect(),c._rectRotated,a.getOriginalSize())};a.isFrameDisplayed=function(a){return cc.rectEqualToRect(a.getRect(),this._rect)&&a.getTexture().getName()==this._texture.getName()&&cc.pointEqualToPoint(a.getOffset(),this._unflippedOffsetPositionFromCenter)};a.setBatchNode=function(a){if(this._batchNode=a)this._transformToBatch=cc.affineTransformIdentity(),this.textureAtlas= this._batchNode.textureAtlas;else{this.atlasIndex=cc.Sprite.INDEX_NOT_INITIALIZED;this.textureAtlas=null;this.dirty=this._recursiveDirty=!1;a=this._offsetPosition.x;var c=this._offsetPosition.y,d=a+this._rect.width,e=c+this._rect.height,f=this._quad;f.bl.vertices={x:a,y:c,z:0};f.br.vertices={x:d,y:c,z:0};f.tl.vertices={x:a,y:e,z:0};f.tr.vertices={x:d,y:e,z:0};this._quadDirty=!0}};a.setTexture=function(a){a&&cc.isString(a)?(a=cc.textureCache.addImage(a),this.setTexture(a),a=a.getContentSize(),this.setTextureRect(cc.rect(0, 0,a.width,a.height))):(cc.assert(!a||a instanceof cc.Texture2D,cc._LogInfos.Sprite_setTexture_2),this._batchNode&&this._batchNode.texture!=a?cc.log(cc._LogInfos.Sprite_setTexture):(this.shaderProgram=a?cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR):cc.shaderCache.programForKey(cc.SHADER_POSITION_COLOR),this._batchNode||this._texture==a||(this._texture=a,this._updateBlendFunc())))};a.draw=function(){if(this._textureLoaded){var a=cc._renderContext,c=this._texture;c?c._isLoaded&&(this._shaderProgram.use(), this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4(),cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst),cc.glBindTexture2DN(0,c),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX),a.bindBuffer(a.ARRAY_BUFFER,this._quadWebBuffer),this._quadDirty&&(a.bufferData(a.ARRAY_BUFFER,this._quad.arrayBuffer,a.DYNAMIC_DRAW),this._quadDirty=!1),a.vertexAttribPointer(0,3,a.FLOAT,!1,24,0),a.vertexAttribPointer(1,4,a.UNSIGNED_BYTE,!0,24,12),a.vertexAttribPointer(2,2,a.FLOAT,!1, 24,16),a.drawArrays(a.TRIANGLE_STRIP,0,4)):(this._shaderProgram.use(),this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4(),cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst),cc.glBindTexture2D(null),cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_COLOR),a.bindBuffer(a.ARRAY_BUFFER,this._quadWebBuffer),this._quadDirty&&(cc._renderContext.bufferData(cc._renderContext.ARRAY_BUFFER,this._quad.arrayBuffer,cc._renderContext.STATIC_DRAW),this._quadDirty= !1),a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,a.FLOAT,!1,24,0),a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,24,12),a.drawArrays(a.TRIANGLE_STRIP,0,4));cc.g_NumberOfDraws++;if(0!==cc.SPRITE_DEBUG_DRAW||this._showNode)1===cc.SPRITE_DEBUG_DRAW||this._showNode?(a=this._quad,a=[cc.p(a.tl.vertices.x,a.tl.vertices.y),cc.p(a.bl.vertices.x,a.bl.vertices.y),cc.p(a.br.vertices.x,a.br.vertices.y),cc.p(a.tr.vertices.x,a.tr.vertices.y)],cc._drawingUtil.drawPoly(a,4,!0)):2===cc.SPRITE_DEBUG_DRAW&& (a=this.getTextureRect(),c=this.getOffsetPosition(),a=[cc.p(c.x,c.y),cc.p(c.x+a.width,c.y),cc.p(c.x+a.width,c.y+a.height),cc.p(c.x,c.y+a.height)],cc._drawingUtil.drawPoly(a,4,!0))}};delete a};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.generateTintImageWithMultiply=function(a,b,c,d){d=d||cc.newElement("canvas");c=c||cc.rect(0,0,a.width,a.height);var e=d.getContext("2d");d.width!=c.width||d.height!=c.height?(d.width=c.width,d.height=c.height):e.globalCompositeOperation="source-over";e.fillStyle="rgb("+(0|b.r)+","+(0|b.g)+","+(0|b.b)+")";e.fillRect(0,0,c.width,c.height);e.globalCompositeOperation="multiply";e.drawImage(a,c.x,c.y,c.width,c.height,0,0,c.width,c.height);e.globalCompositeOperation="destination-atop";e.drawImage(a, c.x,c.y,c.width,c.height,0,0,c.width,c.height);return d}; cc.generateTintImage=function(a,b,c,d,e){d||(d=cc.rect(0,0,a.width,a.height));a=c.r/255;var f=c.g/255;c=c.b/255;var g=Math.min(d.width,b[0].width),h=Math.min(d.height,b[0].height),k;e?(k=e.getContext("2d"),k.clearRect(0,0,g,h)):(e=cc.newElement("canvas"),e.width=g,e.height=h,k=e.getContext("2d"));k.save();k.globalCompositeOperation="lighter";var m=k.globalAlpha;0a+f+c&&(k.globalAlpha=m,k.drawImage(b[3],d.x,d.y,g,h,0,0,g,h));k.restore();return e}; cc.generateTextureCacheForColor=function(a){function b(){var b=cc.generateTextureCacheForColor,d=a.width,g=a.height;c[0].width=d;c[0].height=g;c[1].width=d;c[1].height=g;c[2].width=d;c[2].height=g;c[3].width=d;c[3].height=g;b.canvas.width=d;b.canvas.height=g;var h=b.canvas.getContext("2d");h.drawImage(a,0,0);b.tempCanvas.width=d;b.tempCanvas.height=g;for(var h=h.getImageData(0,0,d,g).data,k=0;4>k;k++){var m=c[k].getContext("2d");m.getImageData(0,0,d,g).data;b.tempCtx.drawImage(a,0,0);for(var n=b.tempCtx.getImageData(0, 0,d,g),q=n.data,s=0;sa.width&&cc.error(cc._LogInfos.RectWidth,a.url),d>a.height&&cc.error(cc._LogInfos.RectHeight,a.url));this.texture=this._originalTexture=a;this.setTextureRect(b,c);this.batchNode=null;return!0},_p._textureLoadedCallback=function(a){if(!this._textureLoaded){this._textureLoaded=!0;var b=this._rect;b?cc._rectEqualToZero(b)&&(b.width=a.width,b.height=a.height):b=cc.rect(0,0,a.width,a.height);this.texture= this._originalTexture=a;this.setTextureRect(b,this._rectRotated);a=this._displayedColor;255==a.r&&255==a.g&&255==a.b||this._changeTextureColor();this.batchNode=this._batchNode;this._callLoadedEventCallbacks()}},_p.setTextureRect=function(a,b,c){this._rectRotated=b||!1;this.setContentSize(c||a);this.setVertexRect(a);b=this._textureRect_Canvas;c=cc.contentScaleFactor();b.x=0|a.x*c;b.y=0|a.y*c;b.width=0|a.width*c;b.height=0|a.height*c;b.validRect=!(0===b.width||0===b.height||0>b.x||0>b.y);a=this._unflippedOffsetPositionFromCenter; this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);this._offsetPosition.x=a.x+(this._contentSize.width-this._rect.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-this._rect.height)/2;this._batchNode&&(this.dirty=!0)},_p.updateTransform=function(){if(this.dirty){var a=this._parent;!this._visible||a&&a!=this._batchNode&&a._shouldBeHidden?this._shouldBeHidden=!0:(this._shouldBeHidden=!1,this._transformToBatch=a&&a!=this._batchNode?cc.affineTransformConcat(this.nodeToParentTransform(), a._transformToBatch):this.nodeToParentTransform());this.dirty=this._recursiveDirty=!1}this._hasChildren&&this._arrayMakeObjectsPerformSelector(this._children,cc.Node._StateCallbackType.updateTransform)},_p.addChild=function(a,b,c){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_addChild_2);null==b&&(b=a._localZOrder);null==c&&(c=a.tag);cc.Node.prototype.addChild.call(this,a,b,c);this._hasChildren=!0},_p.setOpacity=function(a){cc.Node.prototype.setOpacity.call(this,a);this._setNodeDirtyForCache()},_p.setColor= function(a){var b=this.color;this._oldDisplayColor=b;b.r===a.r&&b.g===a.g&&b.b===a.b||cc.Node.prototype.setColor.call(this,a)},_p.updateDisplayedColor=function(a){cc.Node.prototype.updateDisplayedColor.call(this,a);a=this._oldDisplayColor;var b=this._displayedColor;if(a.r!==b.r||a.g!==b.g||a.b!==b.b)this._changeTextureColor(),this._setNodeDirtyForCache()},_p.setSpriteFrame=function(a){var b=this;cc.isString(a)&&(a=cc.spriteFrameCache.getSpriteFrame(a),cc.assert(a,cc._LogInfos.CCSpriteBatchNode_setSpriteFrame)); b.setNodeDirty(!0);var c=a.getOffset();b._unflippedOffsetPositionFromCenter.x=c.x;b._unflippedOffsetPositionFromCenter.y=c.y;b._rectRotated=a.isRotated();var c=a.getTexture(),d=a.textureLoaded();d||(b._textureLoaded=!1,a.addLoadedEventListener(function(a){b._textureLoaded=!0;var c=a.getTexture();c!=b._texture&&(b.texture=c);b.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize());b._callLoadedEventCallbacks()},b));c!=b._texture&&(b.texture=c);b._rectRotated&&(b._originalTexture=c);b.setTextureRect(a.getRect(), b._rectRotated,a.getOriginalSize());b._colorized=!1;d&&(a=b.color,255===a.r&&255===a.g&&255===a.b||b._changeTextureColor())},_p.isFrameDisplayed=function(a){return a.getTexture()!=this._texture?!1:cc.rectEqualToRect(a.getRect(),this._rect)},_p.setBatchNode=function(a){(this._batchNode=a)?(this._transformToBatch=cc.affineTransformIdentity(),this.textureAtlas=this._batchNode.textureAtlas):(this.atlasIndex=cc.Sprite.INDEX_NOT_INITIALIZED,this.textureAtlas=null,this.dirty=this._recursiveDirty=!1)},_p.setTexture= function(a){a&&cc.isString(a)?(a=cc.textureCache.addImage(a),this.setTexture(a),a=a.getContentSize(),this.setTextureRect(cc.rect(0,0,a.width,a.height))):(cc.assert(!a||a instanceof cc.Texture2D,cc._LogInfos.CCSpriteBatchNode_setTexture),this._texture!=a&&(a&&a.getHtmlElementObj()instanceof HTMLImageElement&&(this._originalTexture=a),this._texture=a))},_p.draw=function(a){if(this._textureLoaded){a=a||cc._renderContext;"source"!=this._blendFuncStr&&(a.globalCompositeOperation=this._blendFuncStr);var b= cc.view.getScaleX(),c=cc.view.getScaleY();a.globalAlpha=this._displayedOpacity/255;var d=this._rect,e=this._contentSize,f=this._offsetPosition,g=this._drawSize_Canvas,h=0|f.x,k=-f.y-d.height,m=this._textureRect_Canvas;g.width=d.width*b;g.height=d.height*c;if(this._flippedX||this._flippedY)a.save(),this._flippedX&&(h=-f.x-d.width,a.scale(-1,1)),this._flippedY&&(k=f.y,a.scale(1,-1));h*=b;k*=c;this._texture&&m.validRect?(e=this._texture.getHtmlElementObj(),this._colorized?a.drawImage(e,0,0,m.width,m.height, h,k,g.width,g.height):a.drawImage(e,m.x,m.y,m.width,m.height,h,k,g.width,g.height)):!this._texture&&m.validRect&&(g=this.color,a.fillStyle="rgba("+g.r+","+g.g+","+g.b+",1)",a.fillRect(h,k,e.width*b,e.height*c));1===cc.SPRITE_DEBUG_DRAW||this._showNode?(a.strokeStyle="rgba(0,255,0,1)",h/=b,k=-(k/c),h=[cc.p(h,k),cc.p(h+d.width,k),cc.p(h+d.width,k-d.height),cc.p(h,k-d.height)],cc._drawingUtil.drawPoly(h,4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(a.strokeStyle="rgba(0,255,0,1)",b=this._rect,k=-k,h=[cc.p(h,k), cc.p(h+b.width,k),cc.p(h+b.width,k-b.height),cc.p(h,k-b.height)],cc._drawingUtil.drawPoly(h,4,!0));(this._flippedX||this._flippedY)&&a.restore();cc.g_NumberOfDraws++}},cc.sys._supportCanvasNewBlendModes||(_p._changeTextureColor=function(){var a,b=this._texture,c=this._textureRect_Canvas;b&&c.validRect&&this._originalTexture&&(a=b.getHtmlElementObj())&&(b=cc.textureCache.getTextureColors(this._originalTexture.getHtmlElementObj()))&&(this._colorized=!0,a instanceof HTMLCanvasElement&&!this._rectRotated&& !this._newTextureWhenChangeColor?cc.generateTintImage(a,b,this._displayedColor,c,a):(a=cc.generateTintImage(a,b,this._displayedColor,c),b=new cc.Texture2D,b.initWithElement(a),b.handleLoadedTexture(),this.texture=b))}),delete _p):(cc.assert(cc.isFunction(cc._tmp.WebGLSprite),cc._LogInfos.MissingFile,"SpritesWebGL.js"),cc._tmp.WebGLSprite(),delete cc._tmp.WebGLSprite);cc.assert(cc.isFunction(cc._tmp.PrototypeSprite),cc._LogInfos.MissingFile,"SpritesPropertyDefine.js");cc._tmp.PrototypeSprite();delete cc._tmp.PrototypeSprite;cc.DEFAULT_SPRITE_BATCH_CAPACITY=29; cc.SpriteBatchNode=cc.Node.extend({textureAtlas:null,_blendFunc:null,_descendants:null,_className:"SpriteBatchNode",addSpriteWithoutQuad:function(a,b,c){cc.assert(a,cc._LogInfos.SpriteBatchNode_addSpriteWithoutQuad_2);if(!(a instanceof cc.Sprite))return cc.log(cc._LogInfos.SpriteBatchNode_addSpriteWithoutQuad),null;a.atlasIndex=b;var d=0,e=this._descendants;if(e&&0=b&&++d}e.splice(d,0,a);cc.Node.prototype.addChild.call(this,a,b,c);this.reorderBatch(!1); return this},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){a!=this.textureAtlas&&(this.textureAtlas=a)},getDescendants:function(){return this._descendants},initWithFile:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},_setNodeDirtyForCache:function(){this._cacheDirty=!0},init:function(a,b){var c=cc.textureCache.getTextureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c, b)},increaseAtlasCapacity:function(){var a=this.textureAtlas.capacity,b=Math.floor(4*(a+1)/3);cc.log(cc._LogInfos.SpriteBatchNode_increaseAtlasCapacity,a,b);this.textureAtlas.resizeCapacity(b)||cc.log(cc._LogInfos.SpriteBatchNode_increaseAtlasCapacity_2)},removeChildAtIndex:function(a,b){this.removeChild(this._children[a],b)},rebuildIndexInOrder:function(a,b){var c=a.children;if(c&&0e.zIndex&&(b=this.rebuildIndexInOrder(e,b))}!a==this&&(a.atlasIndex= b,b++);if(c&&0b?c.atlasIndex:c.atlasIndex+1:0>f.zIndex&&0>b||0<=f.zIndex&&0<=b?this.highestAtlasIndexInChild(f)+1:c.atlasIndex+1},reorderBatch:function(a){this._reorderChildDirty=a},setBlendFunc:function(a,b){this._blendFunc=void 0===b?a:{src:a,dst:b}},getBlendFunc:function(){return this._blendFunc},reorderChild:function(a,b){cc.assert(a,cc._LogInfos.SpriteBatchNode_reorderChild_2);-1===this._children.indexOf(a)?cc.log(cc._LogInfos.SpriteBatchNode_reorderChild): b!==a.zIndex&&(cc.Node.prototype.reorderChild.call(this,a,b),this.setNodeDirty())},removeChild:function(a,b){null!=a&&(-1===this._children.indexOf(a)?cc.log(cc._LogInfos.SpriteBatchNode_removeChild):(this.removeSpriteFromAtlas(a),cc.Node.prototype.removeChild.call(this,a,b)))},_mvpMatrix:null,_textureForCanvas:null,_useCache:!1,_originalTexture:null,ctor:null,_ctorForCanvas:function(a,b){cc.Node.prototype.ctor.call(this);var c;b=b||cc.DEFAULT_SPRITE_BATCH_CAPACITY;cc.isString(a)?(c=cc.textureCache.getTextureForKey(a))|| (c=cc.textureCache.addImage(a)):a instanceof cc.Texture2D&&(c=a);c&&this.initWithTexture(c,b)},_ctorForWebGL:function(a,b){cc.Node.prototype.ctor.call(this);this._mvpMatrix=new cc.kmMat4;var c;b=b||cc.DEFAULT_SPRITE_BATCH_CAPACITY;cc.isString(a)?(c=cc.textureCache.getTextureForKey(a))||(c=cc.textureCache.addImage(a)):a instanceof cc.Texture2D&&(c=a);c&&this.initWithTexture(c,b)},updateQuadFromSprite:null,_updateQuadFromSpriteForCanvas:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite_2); a instanceof cc.Sprite?(a.batchNode=this,a.atlasIndex=b,a.dirty=!0,a.updateTransform()):cc.log(cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite)},_updateQuadFromSpriteForWebGL:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite);if(a instanceof cc.Sprite){for(var c=this.textureAtlas.capacity;b>=c||c==this.textureAtlas.totalQuads;)this.increaseAtlasCapacity();a.batchNode=this;a.atlasIndex=b;a.dirty=!0;a.updateTransform()}else cc.log(cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite)}, _swap:function(a,b){var c=this._descendants,d=this.textureAtlas,e=d.quads,f=c[a],g=cc.V3F_C4B_T2F_QuadCopy(e[a]);c[b].atlasIndex=a;c[a]=c[b];d.updateQuad(e[b],a);c[b]=f;d.updateQuad(g,b)},insertQuadFromSprite:null,_insertQuadFromSpriteForCanvas:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_insertQuadFromSprite_2);a instanceof cc.Sprite?(a.batchNode=this,a.atlasIndex=b,a.dirty=!0,a.updateTransform(),a._setCachedParent(this),this._children.splice(b,0,a)):cc.log(cc._LogInfos.CCSpriteBatchNode_insertQuadFromSprite)}, _insertQuadFromSpriteForWebGL:function(a,b){cc.assert(a,cc._LogInfos.Sprite_insertQuadFromSprite_2);if(a instanceof cc.Sprite){for(var c=this.textureAtlas;b>=c.capacity||c.capacity===c.totalQuads;)this.increaseAtlasCapacity();a.batchNode=this;a.atlasIndex=b;c.insertQuad(a.quad,b);a.dirty=!0;a.updateTransform()}else cc.log(cc._LogInfos.Sprite_insertQuadFromSprite)},_updateAtlasIndex:function(a,b){var c=0,d=a.children;d&&(c=d.length);var e=0;if(0===c)e=a.atlasIndex,a.atlasIndex=b,a.arrivalOrder=0,e!= b&&this._swap(e,b),b++;else{e=!0;0<=d[0].zIndex&&(e=a.atlasIndex,a.atlasIndex=b,a.arrivalOrder=0,e!=b&&this._swap(e,b),b++,e=!1);for(c=0;c=c.capacity&&this.increaseAtlasCapacity();c.insertQuad(a.quad,b);this._descendants.splice(b,0,a);var c=b+1,d=this._descendants;if(d&&0a.getPixelsWide()&&cc.error(cc._LogInfos.RectWidth,a.url);g>a.getPixelsHigh()&&cc.error(cc._LogInfos.RectHeight,a.url)}this._offsetInPixels.x=d.x;this._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(d,this._offset);this._originalSizeInPixels.width=e.width;this._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(e,this._originalSize);this._rotated=c;return!0}}); cc.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;var c=b.frames,d=b.metadata||b.meta,b={},e={},f=0;d&&(f=d.format,f=1>=f.length?parseInt(f):f,e.image=d.textureFileName||d.textureFileName||d.image); for(var g in c){var h=c[g];if(h){d={};if(0==f){d.rect=cc.rect(h.x,h.y,h.width,h.height);d.rotated=!1;d.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);d.size=cc.size(k,h)}else if(1==f||2==f)d.rect=this._rectFromString(h.frame),d.rotated=h.rotated||!1,d.offset=this._pointFromString(h.offset),d.size=this._sizeFromString(h.sourceSize);else if(3==f){var k=this._sizeFromString(h.spriteSize), m=this._rectFromString(h.textureRect);k&&(m=cc.rect(m.x,m.y,k.width,k.height));d.rect=m;d.rotated=h.textureRotated||!1;d.offset=this._pointFromString(h.spriteOffset);d.size=this._sizeFromString(h.spriteSourceSize);d.aliases=h.aliases}else k=h.frame,m=h.sourceSize,g=h.filename||g,d.rect=cc.rect(k.x,k.y,k.w,k.h),d.rotated=h.rotated||!1,d.offset=cc.p(0,0),d.size=cc.size(m.w,m.h);b[g]=d}}return this._frameConfigCache[a]={_inited:!0,frames:b,meta:e}},addSpriteFrames:function(a,b){cc.assert(a,cc._LogInfos.spriteFrameCache_addSpriteFrames_2); var c=this._frameConfigCache[a]||cc.loader.getRes(a);if(c&&c.frames){var d=this._frameConfigCache[a]||this._getFrameConfig(a),c=d.frames,d=d.meta;b?b instanceof cc.Texture2D||(cc.isString(b)?b=cc.textureCache.addImage(b):cc.assert(0,cc._LogInfos.spriteFrameCache_addSpriteFrames_3)):(d=cc.path.changeBasename(a,d.image||".png"),b=cc.textureCache.addImage(d));var d=this._spriteFramesAliases,e=this._spriteFrames,f;for(f in c){var g=c[f],h=e[f];if(!h){h=cc.SpriteFrame.create(b,g.rect,g.rotated,g.offset, g.size);if(g=g.aliases)for(var k=0,m=g.length;kthis._winSizeInPoints.height?0|this._winSizeInPoints.height/320*24:0|this._winSizeInPoints.width/320*24;this._FPSLabel=cc.LabelTTF.create("000.0","Arial",a);this._SPFLabel=cc.LabelTTF.create("0.000","Arial",a);this._drawsLabel=cc.LabelTTF.create("0000", "Arial",a);a=cc.DIRECTOR_STATS_POSITION;this._drawsLabel.setPosition(this._drawsLabel.width/2+a.x,5*this._drawsLabel.height/2+a.y);this._SPFLabel.setPosition(this._SPFLabel.width/2+a.x,3*this._SPFLabel.height/2+a.y);this._FPSLabel.setPosition(this._FPSLabel.width/2+a.x,this._FPSLabel.height/2+a.y)};a.convertToGL=function(a){var c=new cc.kmMat4;cc.GLToClipTransform(c);var d=new cc.kmMat4;cc.kmMat4Inverse(d,c);var c=c.mat[14]/c.mat[15],e=this._openGLView.getDesignResolutionSize();a=new cc.kmVec3(2* a.x/e.width-1,1-2*a.y/e.height,c);c=new cc.kmVec3;cc.kmVec3TransformCoord(c,a,d);return cc.p(c.x,c.y)};a.convertToUI=function(a){var c=new cc.kmMat4;cc.GLToClipTransform(c);var d=new cc.kmVec3;a=new cc.kmVec3(a.x,a.y,0);cc.kmVec3TransformCoord(d,a,c);c=this._openGLView.getDesignResolutionSize();return cc.p(c.width*(0.5*d.x+0.5),c.height*(0.5*-d.y+0.5))};a.getVisibleSize=function(){return this._openGLView.getVisibleSize()};a.getVisibleOrigin=function(){return this._openGLView.getVisibleOrigin()};a.getZEye= function(){return this._winSizeInPoints.height/1.1566};a.setViewport=function(){var a=this._openGLView;if(a){var c=this._winSizeInPoints;a.setViewPortInPoints(-a._viewPortRect.x/a._scaleX,-a._viewPortRect.y/a._scaleY,c.width,c.height)}};a.getOpenGLView=function(){return this._openGLView};a.getProjection=function(){return this._projection};a.setAlphaBlending=function(a){a?cc.glBlendFunc(cc.BLEND_SRC,cc.BLEND_DST):cc.glBlendFunc(cc._renderContext.ONE,cc._renderContext.ZERO)};a.setGLDefaultValues=function(){this.setAlphaBlending(!0); this.setDepthTest(!1);this.setProjection(this._projection);cc._renderContext.clearColor(0,0,0,1)}};cc.g_NumberOfDraws=0;cc.GLToClipTransform=function(a){var b=new cc.kmMat4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,b);var c=new cc.kmMat4;cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,c);cc.kmMat4Multiply(a,b,c)}; cc.Director=cc.Class.extend({_landscape:!1,_nextDeltaTimeZero:!1,_paused:!1,_purgeDirectorInNextLoop:!1,_sendCleanupToScene:!1,_animationInterval:0,_oldAnimationInterval:0,_projection:0,_accumDt:0,_contentScaleFactor:1,_displayStats:!1,_deltaTime:0,_frameRate:0,_FPSLabel:null,_SPFLabel:null,_drawsLabel:null,_winSizeInPoints:null,_lastUpdate:null,_nextScene:null,_notificationNode:null,_openGLView:null,_scenesStack:null,_projectionDelegate:null,_runningScene:null,_frames:0,_totalFrames:0,_secondsPerFrame:0, _dirtyRegion:null,_scheduler:null,_actionManager:null,_eventProjectionChanged:null,_eventAfterDraw:null,_eventAfterVisit:null,_eventAfterUpdate: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._frameRate=this._accumDt= 0;this._displayStats=!1;this._totalFrames=this._frames=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;this._actionManager=cc.ActionManager?new cc.ActionManager:null;this._scheduler.scheduleUpdateForTarget(this._actionManager,cc.Scheduler.PRIORITY_SYSTEM,!1);this._eventAfterDraw=new cc.EventCustom(cc.Director.EVENT_AFTER_DRAW);this._eventAfterDraw.setUserData(this); this._eventAfterVisit=new cc.EventCustom(cc.Director.EVENT_AFTER_VISIT);this._eventAfterVisit.setUserData(this);this._eventAfterUpdate=new cc.EventCustom(cc.Director.EVENT_AFTER_UPDATE);this._eventAfterUpdate.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;0cc.DIRECTOR_FPS_INTERVAL&&(this._SPFLabel.string=this._secondsPerFrame.toFixed(3),this._frameRate=this._frames/this._accumDt,this._accumDt=this._frames=0,this._FPSLabel.string=this._frameRate.toFixed(1),this._drawsLabel.string=(0|cc.g_NumberOfDraws).toString()),this._FPSLabel.visit(),this._SPFLabel.visit(), this._drawsLabel.visit()):this._createStatsLabel();cc.g_NumberOfDraws=0},isSendCleanupToScene:function(){return this._sendCleanupToScene},getRunningScene:function(){return this._runningScene},getAnimationInterval:function(){return this._animationInterval},isDisplayStats:function(){return this._displayStats},setDisplayStats:function(a){this._displayStats=a},getSecondsPerFrame:function(){return this._secondsPerFrame},isNextDeltaTimeZero:function(){return this._nextDeltaTimeZero},isPaused:function(){return this._paused}, getTotalFrames:function(){return this._totalFrames},popToRootScene:function(){this.popToSceneStackLevel(1)},popToSceneStackLevel:function(a){cc.assert(this._runningScene,cc._LogInfos.Director_popToSceneStackLevel_2);var b=this._scenesStack,c=b.length;if(0==c)this.end();else if(!(a>c)){for(;c>a;){var d=b.pop();d.running&&(d.onExitTransitionDidStart(),d.onExit());d.cleanup();c--}this._nextScene=b[b.length-1];this._sendCleanupToScene=!1}},getScheduler:function(){return this._scheduler},setScheduler:function(a){this._scheduler!= a&&(this._scheduler=a)},getActionManager:function(){return this._actionManager},setActionManager:function(a){this._actionManager!=a&&(this._actionManager=a)},getDeltaTime:function(){return this._deltaTime},_createStatsLabel:null,_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3}});cc.Director.EVENT_PROJECTION_CHANGED="director_projection_changed";cc.Director.EVENT_AFTER_DRAW="director_after_draw";cc.Director.EVENT_AFTER_VISIT="director_after_visit"; cc.Director.EVENT_AFTER_UPDATE="director_after_update";cc.DisplayLinkDirector=cc.Director.extend({invalid:!1,startAnimation:function(){this._nextDeltaTimeZero=!0;this.invalid=!1},mainLoop:function(){this._purgeDirectorInNextLoop?(this._purgeDirectorInNextLoop=!1,this.purgeDirector()):this.invalid||this.drawScene()},stopAnimation:function(){this.invalid=!0},setAnimationInterval:function(a){this._animationInterval=a;this.invalid||(this.stopAnimation(),this.startAnimation())}}); cc.Director.sharedDirector=null;cc.Director.firstUseDirector=!0;cc.Director._getInstance=function(){cc.Director.firstUseDirector&&(cc.Director.firstUseDirector=!1,cc.Director.sharedDirector=new cc.DisplayLinkDirector,cc.Director.sharedDirector.init());return cc.Director.sharedDirector};cc.defaultFPS=60;cc.Director.PROJECTION_2D=0;cc.Director.PROJECTION_3D=1;cc.Director.PROJECTION_CUSTOM=3;cc.Director.PROJECTION_DEFAULT=cc.Director.PROJECTION_3D; cc._renderType===cc._RENDER_TYPE_CANVAS?(_p=cc.Director.prototype,_p.setProjection=function(a){this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged)},_p.setDepthTest=function(){},_p.setOpenGLView=function(a){this._winSizeInPoints.width=cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;cc.eventManager&&cc.eventManager.setEnabled(!0)},_p._clear=function(){var a=this._openGLView.getViewPortRect();cc._renderContext.clearRect(-a.x,a.y, a.width,-a.height)},_p._createStatsLabel=function(){var a=0,a=this._winSizeInPoints.width>this._winSizeInPoints.height?0|this._winSizeInPoints.height/320*24:0|this._winSizeInPoints.width/320*24;this._FPSLabel=cc.LabelTTF.create("000.0","Arial",a);this._SPFLabel=cc.LabelTTF.create("0.000","Arial",a);this._drawsLabel=cc.LabelTTF.create("0000","Arial",a);a=cc.DIRECTOR_STATS_POSITION;this._drawsLabel.setPosition(this._drawsLabel.width/2+a.x,5*this._drawsLabel.height/2+a.y);this._SPFLabel.setPosition(this._SPFLabel.width/ 2+a.x,3*this._SPFLabel.height/2+a.y);this._FPSLabel.setPosition(this._FPSLabel.width/2+a.x,this._FPSLabel.height/2+a.y)},_p.getVisibleSize=function(){return this.getWinSize()},_p.getVisibleOrigin=function(){return cc.p(0,0)}):(cc.Director._fpsImage=new Image,cc._addEventListener(cc.Director._fpsImage,"load",function(){cc.Director._fpsImageLoaded=!0}),cc._fpsImage&&(cc.Director._fpsImage.src=cc._fpsImage),cc.assert(cc.isFunction(cc._tmp.DirectorWebGL),cc._LogInfos.MissingFile,"CCDirectorWebGL.js"), cc._tmp.DirectorWebGL(),delete cc._tmp.DirectorWebGL);cc.Camera=cc.Class.extend({_eyeX:null,_eyeY:null,_eyeZ:null,_centerX:null,_centerY:null,_centerZ:null,_upX:null,_upY:null,_upZ:null,_dirty:null,_lookupMatrix:null,ctor:function(){this._lookupMatrix=new cc.kmMat4;this.restore()},description:function(){return"\x3cCCCamera | center \x3d("+this._centerX+","+this._centerY+","+this._centerZ+")\x3e"},setDirty:function(a){this._dirty=a},isDirty:function(){return this._dirty},restore:function(){this._eyeX=this._eyeY=0;this._eyeZ=cc.Camera.getZEye();this._upX= this._centerX=this._centerY=this._centerZ=0;this._upY=1;this._upZ=0;cc.kmMat4Identity(this._lookupMatrix);this._dirty=!1},locate:function(){if(this._dirty){var a=new cc.kmVec3,b=new cc.kmVec3,c=new cc.kmVec3;cc.kmVec3Fill(a,this._eyeX,this._eyeY,this._eyeZ);cc.kmVec3Fill(b,this._centerX,this._centerY,this._centerZ);cc.kmVec3Fill(c,this._upX,this._upY,this._upZ);cc.kmMat4LookAt(this._lookupMatrix,a,b,c);this._dirty=!1}cc.kmGLMultMatrix(this._lookupMatrix)},setEyeXYZ:function(a,b,c){this.setEye(a,b, c)},setEye:function(a,b,c){this._eyeX=a;this._eyeY=b;this._eyeZ=c;this._dirty=!0},setCenterXYZ:function(a,b,c){this.setCenter(a,b,c)},setCenter:function(a,b,c){this._centerX=a;this._centerY=b;this._centerZ=c;this._dirty=!0},setUpXYZ:function(a,b,c){this.setUp(a,b,c)},setUp:function(a,b,c){this._upX=a;this._upY=b;this._upZ=c;this._dirty=!0},getEyeXYZ:function(a,b,c){return{x:this._eyeX,y:this._eyeY,z:this._eyeZ}},getEye:function(){return{x:this._eyeX,y:this._eyeY,z:this._eyeZ}},getCenterXYZ:function(a, b,c){return{x:this._centerX,y:this._centerY,z:this._centerZ}},getCenter:function(){return{x:this._centerX,y:this._centerY,z:this._centerZ}},getUpXYZ:function(a,b,c){return{x:this._upX,y:this._upY,z:this._upZ}},getUp:function(){return{x:this._upX,y:this._upY,z:this._upZ}},_DISALLOW_COPY_AND_ASSIGN:function(a){}});cc.Camera.getZEye=function(){return cc.FLT_EPSILON};cc.PRIORITY_NON_SYSTEM=cc.PRIORITY_SYSTEM+1;cc.ListEntry=function(a,b,c,d,e,f){this.prev=a;this.next=b;this.target=c;this.priority=d;this.paused=e;this.markedForDeletion=f};cc.HashUpdateEntry=function(a,b,c,d){this.list=a;this.entry=b;this.target=c;this.hh=d};cc.HashTimerEntry=function(a,b,c,d,e,f,g){this.timers=a;this.target=b;this.timerIndex=c;this.currentTimer=d;this.currentTimerSalvaged=e;this.paused=f;this.hh=g}; cc.Timer=cc.Class.extend({_interval:0,_callback:null,_target:null,_elapsed:0,_runForever:!1,_useDelay:!1,_timesExecuted:0,_repeat:0,_delay:0,getInterval:function(){return this._interval},setInterval:function(a){this._interval=a},getCallback:function(){return this._callback},ctor:function(a,b,c,d,e){this._target=a;this._callback=b;this._elapsed=-1;this._interval=c||0;this._delay=e||0;this._useDelay=0=this._interval&&(b&&c&&this._doCallback(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(b&&c&&this._doCallback(),this._elapsed-=this._delay,this._timesExecuted+= 1,this._useDelay=!1):this._elapsed>=this._interval&&(b&&c&&this._doCallback(),this._elapsed=0,this._timesExecuted+=1),this._timesExecuted>this._repeat&&cc.director.getScheduler().unscheduleCallbackForTarget(b,c))}}}); cc.Scheduler=cc.Class.extend({_timeScale:1,_updates:null,_hashForUpdates:null,_arrayForUpdates:null,_hashForTimers:null,_arrayForTimes:null,_currentTarget:null,_currentTargetSalvaged:!1,_updateHashLocked:!1,ctor:function(){this._timeScale=1;this._updates=[[],[],[]];this._hashForUpdates={};this._arrayForUpdates=[];this._hashForTimers={};this._arrayForTimers=[];this._currentTarget=null;this._updateHashLocked=this._currentTargetSalvaged=!1},_removeHashElement:function(a){delete this._hashForTimers[a.target.__instanceId]; cc.arrayRemoveObject(this._arrayForTimers,a);a.Timer=null;a.target=null},_removeUpdateFromHash:function(a){if(a=this._hashForUpdates[a.target.__instanceId])cc.arrayRemoveObject(a.list,a.entry),delete this._hashForUpdates[a.target.__instanceId],cc.arrayRemoveObject(this._arrayForUpdates,a),a.entry=null,a.target=null},_priorityIn:function(a,b,c,d){d=new cc.ListEntry(null,null,b,c,d,!1);if(a){for(var e=a.length-1,f=0;f<=e&&!(cb?d[0]=this._priorityIn(d[0],a,b,c):d[2]=this._priorityIn(d[2],a,b,c)}},unscheduleCallbackForTarget:function(a,b){if(null!=a&&null!=b){var c=this._hashForTimers[a.__instanceId];if(c)for(var d=c.timers,e=0,f=d.length;e=e&&c.timerIndex--;0==d.length&&(this._currentTarget==c?this._currentTargetSalvaged=!0:this._removeHashElement(c));break}}}},unscheduleUpdateForTarget:function(a){null!= a&&(a=this._hashForUpdates[a.__instanceId],null!=a&&(this._updateHashLocked?a.entry.markedForDeletion=!0:this._removeUpdateFromHash(a.entry)))},unscheduleAllCallbacksForTarget:function(a){if(null!=a){var b=this._hashForTimers[a.__instanceId];if(b){var c=b.timers;!b.currentTimerSalvaged&&0<=c.indexOf(b.currentTimer)&&(b.currentTimerSalvaged=!0);c.length=0;this._currentTarget==b?this._currentTargetSalvaged=!0:this._removeHashElement(b)}this.unscheduleUpdateForTarget(a)}},unscheduleAllCallbacks:function(){this.unscheduleAllCallbacksWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)}, unscheduleAllCallbacksWithMinPriority:function(a){for(var b=this._arrayForTimers,c=this._updates,d=0,e=b.length;da.length)throw Error("Polygon's point must greater than 2");var e=a[0];b=this._renderContext;var f=cc.view.getScaleX(),g=cc.view.getScaleY();b.beginPath();b.moveTo(e.x*f,-e.y*g);for(var e=1,h=a.length;ec&&1c&&100>n++;)f*=c/h,f|=0,g=d.substr(f),h=e-this._measure(g);for(n=0;hn++;)g&&(m=(k=cc.LabelTTF._wordRex.exec(g))?k[0].length:1,k=g),f+=m,g=d.substr(f),h=e-this._measure(g);f-=m;c=d.substr(0,f);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(k||g)&&(e=cc.LabelTTF._lastWordRex.exec(c),f-=e?e[0].length:0,k=d.substr(f),c=d.substr(0,f));cc.LabelTTF._firsrEnglish.test(k)&&(e=cc.LabelTTF._lastEnglish.exec(c))&& c!==e[0]&&(f-=e[0].length,k=d.substr(f),c=d.substr(0,f));a[b]=k||g;a.splice(b,0,c)}},_updateTTF:function(){var a=this._dimensions.width,b,c,d=this._lineWidths;d.length=0;this._isMultiLine=!1;this._measureConfig();if(0!==a)for(this._strings=this._string.split("\n"),b=0;bb.x||0>b.y);a=this._unflippedOffsetPositionFromCenter; this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);this._offsetPosition.x=a.x+(this._contentSize.width-this._rect.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-this._rect.height)/2;this._batchNode&&(this.dirty=!0)},_p=null):(cc.assert(cc.isFunction(cc._tmp.WebGLLabelTTF),cc._LogInfos.MissingFile,"LabelTTFWebGL.js"),cc._tmp.WebGLLabelTTF(),delete cc._tmp.WebGLLabelTTF);cc.assert(cc.isFunction(cc._tmp.PrototypeLabelTTF),cc._LogInfos.MissingFile,"LabelTTFPropertyDefine.js");cc._tmp.PrototypeLabelTTF(); delete cc._tmp.PrototypeLabelTTF;cc.LabelTTF._textAlign=["left","center","right"];cc.LabelTTF._textBaseline=["top","middle","bottom"];cc.LabelTTF.wrapInspection=!0;cc.LabelTTF._wordRex=/([a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+|\S)/;cc.LabelTTF._symbolRex=/^[!,.:;}\]%\?>\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/;cc.LabelTTF._lastWordRex=/([a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+|\S)$/; cc.LabelTTF._lastEnglish=/[a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]+$/;cc.LabelTTF._firsrEnglish=/^[a-zA-Z0-9\u00c4\u00d6\u00dc\u00e4\u00f6\u00fc\u00df\u00e9\u00e8\u00e7\u00e0\u00f9\u00ea\u00e2\u00ee\u00f4\u00fb]/;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._SHADER_PROGRAM=cc.USE_LA88_LABELS?cc.SHADER_POSITION_TEXTURECOLOR:cc.SHADER_POSITION_TEXTUREA8COLOR;cc.LabelTTF.__labelHeightDiv=cc.newElement("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):cc._addEventListener(window,"load",function(){this.removeEventListener("load",arguments.callee,!1);document.body.appendChild(cc.LabelTTF.__labelHeightDiv)},!1); cc.LabelTTF.__getFontHeightByDiv=function(a,b){var c=cc.LabelTTF.__fontHeightCache[a+"."+b];if(0=a&&b.actionIndex--;0==b.actions.length&&(this._currentTarget==b?this._currentTargetSalvaged=!0:this._deleteHashElement(b))},_deleteHashElement:function(a){a&&(delete this._hashTargets[a.target.__instanceId],cc.arrayRemoveObject(this._arrayTargets,a),a.actions= null,a.target=null)},_actionAllocWithHashElement:function(a){null==a.actions&&(a.actions=[])},update:function(a){for(var b=this._arrayTargets,c,d=0;db?a:b};cc.kmAlmostEqual=function(a,b){return a+cc.kmEpsilon>b&&a-cc.kmEpsilonb.x-cc.kmEpsilon&&a.yb.y-cc.kmEpsilon};cc.kmVec3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};cc.kmVec3Fill=function(a,b,c,d){if(!a)return new cc.kmVec3(b,c,d);a.x=b;a.y=c;a.z=d;return a};cc.kmVec3Length=function(a){return Math.sqrt(cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z))};cc.kmVec3LengthSq=function(a){return cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z)};cc.kmVec3Normalize=function(a,b){var c=1/cc.kmVec3Length(b);a.x=b.x*c;a.y=b.y*c;a.z=b.z*c;return a}; cc.kmVec3Cross=function(a,b,c){a.x=b.y*c.z-b.z*c.y;a.y=b.z*c.x-b.x*c.z;a.z=b.x*c.y-b.y*c.x;return a};cc.kmVec3Dot=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z};cc.kmVec3Add=function(a,b,c){a.x=b.x+c.x;a.y=b.y+c.y;a.z=b.z+c.z;return a};cc.kmVec3Subtract=function(a,b,c){a.x=b.x-c.x;a.y=b.y-c.y;a.z=b.z-c.z;return a}; cc.kmVec3Transform=function(a,b,c){a.x=b.x*c.mat[0]+b.y*c.mat[4]+b.z*c.mat[8]+c.mat[12];a.y=b.x*c.mat[1]+b.y*c.mat[5]+b.z*c.mat[9]+c.mat[13];a.z=b.x*c.mat[2]+b.y*c.mat[6]+b.z*c.mat[10]+c.mat[14];return a};cc.kmVec3TransformNormal=function(a,b,c){a.x=b.x*c.mat[0]+b.y*c.mat[4]+b.z*c.mat[8];a.y=b.x*c.mat[1]+b.y*c.mat[5]+b.z*c.mat[9];a.z=b.x*c.mat[2]+b.y*c.mat[6]+b.z*c.mat[10];return a}; cc.kmVec3TransformCoord=function(a,b,c){var d=new cc.kmVec4,e=new cc.kmVec4;cc.kmVec4Fill(e,b.x,b.y,b.z,1);cc.kmVec4Transform(d,e,c);a.x=d.x/d.w;a.y=d.y/d.w;a.z=d.z/d.w;return a};cc.kmVec3Scale=function(a,b,c){a.x=b.x*c;a.y=b.y*c;a.z=b.z*c;return a};cc.kmVec3AreEqual=function(a,b){return a.xb.x-cc.kmEpsilon&&a.yb.y-cc.kmEpsilon&&a.zb.z-cc.kmEpsilon?1:0}; cc.kmVec3InverseTransform=function(a,b,c){b=new cc.kmVec3(b.x-c.mat[12],b.y-c.mat[13],b.z-c.mat[14]);a.x=b.x*c.mat[0]+b.y*c.mat[1]+b.z*c.mat[2];a.y=b.x*c.mat[4]+b.y*c.mat[5]+b.z*c.mat[6];a.z=b.x*c.mat[8]+b.y*c.mat[9]+b.z*c.mat[10];return a};cc.kmVec3InverseTransformNormal=function(a,b,c){a.x=b.x*c.mat[0]+b.y*c.mat[1]+b.z*c.mat[2];a.y=b.x*c.mat[4]+b.y*c.mat[5]+b.z*c.mat[6];a.z=b.x*c.mat[8]+b.y*c.mat[9]+b.z*c.mat[10];return a};cc.kmVec3Assign=function(a,b){if(a==b)return a;a.x=b.x;a.y=b.y;a.z=b.z;return a}; cc.kmVec3Zero=function(a){a.x=0;a.y=0;a.z=0;return a};cc.kmVec3ToTypeArray=function(a){if(!a)return null;var b=new Float32Array(3);b[0]=a.x;b[1]=a.y;b[2]=a.z;return b};cc.kmVec4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||0};cc.kmVec4Fill=function(a,b,c,d,e){a.x=b;a.y=c;a.z=d;a.w=e;return a};cc.kmVec4Add=function(a,b,c){a.x=b.x+c.x;a.y=b.y+c.y;a.z=b.z+c.z;a.w=b.w+c.w;return a};cc.kmVec4Dot=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z+a.w*b.w};cc.kmVec4Length=function(a){return Math.sqrt(cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z)+cc.kmSQR(a.w))};cc.kmVec4LengthSq=function(a){return cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z)+cc.kmSQR(a.w)}; cc.kmVec4Lerp=function(a,b,c,d){return a};cc.kmVec4Normalize=function(a,b){var c=1/cc.kmVec4Length(b);a.x*=c;a.y*=c;a.z*=c;a.w*=c;return a};cc.kmVec4Scale=function(a,b,c){cc.kmVec4Normalize(a,b);a.x*=c;a.y*=c;a.z*=c;a.w*=c;return a};cc.kmVec4Subtract=function(a,b,c){a.x=b.x-c.x;a.y=b.y-c.y;a.z=b.z-c.z;a.w=b.w-c.w;return a}; cc.kmVec4Transform=function(a,b,c){a.x=b.x*c.mat[0]+b.y*c.mat[4]+b.z*c.mat[8]+b.w*c.mat[12];a.y=b.x*c.mat[1]+b.y*c.mat[5]+b.z*c.mat[9]+b.w*c.mat[13];a.z=b.x*c.mat[2]+b.y*c.mat[6]+b.z*c.mat[10]+b.w*c.mat[14];a.w=b.x*c.mat[3]+b.y*c.mat[7]+b.z*c.mat[11]+b.w*c.mat[15];return a};cc.kmVec4TransformArray=function(a,b,c,d,e,f){for(var g=0;gb.x-cc.kmEpsilon&&a.yb.y-cc.kmEpsilon&&a.zb.z-cc.kmEpsilon&&a.wb.w-cc.kmEpsilon};cc.kmVec4Assign=function(a,b){if(a==b)return cc.log("destVec and srcVec are same object"),a;a.x=b.x;a.y=b.y;a.z=b.z;a.w=b.w;return a};cc.kmVec4ToTypeArray=function(a){if(!a)return null;var b=new Float32Array(4);b[0]=a.x;b[1]=a.y;b[2]=a.z;b[3]=a.w;return b};cc.kmRay2=function(a,b){this.start=a||new cc.kmVec2;this.start=a||new cc.kmVec2};cc.kmRay2Fill=function(a,b,c,d,e){a.start.x=b;a.start.y=c;a.dir.x=d;a.dir.y=e}; cc.kmRay2IntersectLineSegment=function(a,b,c,d){var e=a.start.x,f=a.start.y,g=a.start.x+a.dir.x;a=a.start.y+a.dir.y;var h=b.x,k=b.y,m=c.x,n=c.y,q=(n-k)*(g-e)-(m-h)*(a-f);if(q>-cc.kmEpsilon&&qcc.kmMax(b.x,c.x)+cc.kmEpsilon||kcc.kmMax(b.y,c.y)+cc.kmEpsilon||hcc.kmMax(e,g)+cc.kmEpsilon||kcc.kmMax(f,a)+cc.kmEpsilon)return cc.KM_FALSE;d.x=h;d.y=k;return cc.KM_TRUE};cc.calculate_line_normal=function(a,b,c){var d=new cc.kmVec2;cc.kmVec2Subtract(d,b,a);c.x=-d.y;c.y=d.x;cc.kmVec2Normalize(c,c)}; cc.kmRay2IntersectTriangle=function(a,b,c,d,e,f){var g=new cc.kmVec2,h=new cc.kmVec2,k=new cc.kmVec2,m=1E4,n=cc.KM_FALSE,q;cc.kmRay2IntersectLineSegment(a,b,c,g)&&(q=new cc.kmVec2,n=cc.KM_TRUE,q=cc.kmVec2Length(cc.kmVec2Subtract(q,g,a.start)),qc;c++)a.mat[c]=b;return a}; cc.kmMat3Adjugate=function(a,b){a.mat[0]=b.mat[4]*b.mat[8]-b.mat[5]*b.mat[7];a.mat[1]=b.mat[2]*b.mat[7]-b.mat[1]*b.mat[8];a.mat[2]=b.mat[1]*b.mat[5]-b.mat[2]*b.mat[4];a.mat[3]=b.mat[5]*b.mat[6]-b.mat[3]*b.mat[8];a.mat[4]=b.mat[0]*b.mat[8]-b.mat[2]*b.mat[6];a.mat[5]=b.mat[2]*b.mat[3]-b.mat[0]*b.mat[5];a.mat[6]=b.mat[3]*b.mat[7]-b.mat[4]*b.mat[6];a.mat[8]=b.mat[0]*b.mat[4]-b.mat[1]*b.mat[3];return a}; cc.kmMat3Identity=function(a){a.mat[1]=a.mat[2]=a.mat[3]=a.mat[5]=a.mat[6]=a.mat[7]=0;a.mat[0]=a.mat[4]=a.mat[8]=1;return a};cc.kmMat3Inverse=function(a,b,c){var d=new cc.kmMat3;if(0===b)return null;b=1/b;cc.kmMat3Adjugate(d,c);cc.kmMat3ScalarMultiply(a,d,b);return a};cc.kmMat3._identity=new Float32Array([1,0,0,0,1,0,0,0,1]);cc.kmMat3IsIdentity=function(a){for(var b=0;9>b;b++)if(cc.kmMat3._identity[b]!==a.mat[b])return!1;return!0}; cc.kmMat3Transpose=function(a,b){var c,d;for(c=0;3>c;++c)for(d=0;3>d;++d)a.mat[3*c+d]=b.mat[3*d+c];return a};cc.kmMat3Determinant=function(a){var b;b=a.mat[0]*a.mat[4]*a.mat[8]+a.mat[1]*a.mat[5]*a.mat[6]+a.mat[2]*a.mat[3]*a.mat[7];return b-=a.mat[2]*a.mat[4]*a.mat[6]+a.mat[0]*a.mat[5]*a.mat[7]+a.mat[1]*a.mat[3]*a.mat[8]}; cc.kmMat3Multiply=function(a,b,c){b=b.mat;c=c.mat;a.mat[0]=b[0]*c[0]+b[3]*c[1]+b[6]*c[2];a.mat[1]=b[1]*c[0]+b[4]*c[1]+b[7]*c[2];a.mat[2]=b[2]*c[0]+b[5]*c[1]+b[8]*c[2];a.mat[3]=b[0]*c[3]+b[3]*c[4]+b[6]*c[5];a.mat[4]=b[1]*c[3]+b[4]*c[4]+b[7]*c[5];a.mat[5]=b[2]*c[3]+b[5]*c[4]+b[8]*c[5];a.mat[6]=b[0]*c[6]+b[3]*c[7]+b[6]*c[8];a.mat[7]=b[1]*c[6]+b[4]*c[7]+b[7]*c[8];a.mat[8]=b[2]*c[6]+b[5]*c[7]+b[8]*c[8];return a};cc.kmMat3ScalarMultiply=function(a,b,c){for(var d=0;9>d;d++)a.mat[d]=b.mat[d]*c;return a}; cc.kmMat3RotationAxisAngle=function(a,b,c){var d=Math.cos(c);c=Math.sin(c);a.mat[0]=d+b.x*b.x*(1-d);a.mat[1]=b.z*c+b.y*b.x*(1-d);a.mat[2]=-b.y*c+b.z*b.x*(1-d);a.mat[3]=-b.z*c+b.x*b.y*(1-d);a.mat[4]=d+b.y*b.y*(1-d);a.mat[5]=b.x*c+b.z*b.y*(1-d);a.mat[6]=b.y*c+b.x*b.z*(1-d);a.mat[7]=-b.x*c+b.y*b.z*(1-d);a.mat[8]=d+b.z*b.z*(1-d);return a};cc.kmMat3Assign=function(a,b){if(a==b)return cc.log("cc.kmMat3Assign(): pOut equals pIn"),a;for(var c=0;9>c;c++)a.mat[c]=b.mat[c];return a}; cc.kmMat3AreEqual=function(a,b){if(a==b)return!0;for(var c=0;9>c;++c)if(!(a.mat[c]+cc.kmEpsilon>b.mat[c]&&a.mat[c]-cc.kmEpsilonc;c++){for(f=h=0;4>f;f++)if(1!=n[f])for(g=0;4>g;g++)0==n[g]&&Math.abs(cc.kmMat4._get(a,f,g))>=h&&(h=Math.abs(cc.kmMat4._get(a,f,g)),e=f,d=g);++n[d];if(e!=d){for(f=0;4>f;f++)cc.kmMat4._swap(a,e,f,d,f);for(f=0;4>f;f++)cc.kmMat4._swap(b,e,f,d,f)}m[c]=e;k[c]=d;if(0==cc.kmMat4._get(a,d,d))return cc.KM_FALSE;g=1/cc.kmMat4._get(a,d,d);cc.kmMat4._set(a,d,d,1);for(f=0;4>f;f++)cc.kmMat4._set(a,d,f,cc.kmMat4._get(a, d,f)*g);for(f=0;4>f;f++)cc.kmMat4._set(b,d,f,cc.kmMat4._get(b,d,f)*g);for(g=0;4>g;g++)if(g!=d){h=cc.kmMat4._get(a,g,d);cc.kmMat4._set(a,g,d,0);for(f=0;4>f;f++)cc.kmMat4._set(a,g,f,cc.kmMat4._get(a,g,f)-cc.kmMat4._get(a,d,f)*h);for(f=0;4>f;f++)cc.kmMat4._set(b,g,f,cc.kmMat4._get(a,g,f)-cc.kmMat4._get(b,d,f)*h)}}for(f=3;0<=f;f--)if(m[f]!=k[f])for(g=0;4>g;g++)cc.kmMat4._swap(a,g,m[f],g,k[f]);return cc.KM_TRUE};cc.kmMat4._identity=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]); cc.kmMat4Inverse=function(a,b){var c=new cc.kmMat4,d=new cc.kmMat4;cc.kmMat4Assign(c,b);cc.kmMat4Identity(d);if(cc.kmMat4._gaussj(c,d)==cc.KM_FALSE)return null;cc.kmMat4Assign(a,c);return a};cc.kmMat4IsIdentity=function(a){for(var b=0;16>b;b++)if(cc.kmMat4._identity[b]!=a.mat[b])return!1;return!0};cc.kmMat4Transpose=function(a,b){var c,d,e=a.mat,f=b.mat;for(d=0;4>d;++d)for(c=0;4>c;++c)e[4*d+c]=f[4*c+d];return a}; cc.kmMat4Multiply=function(a,b,c){var d=a.mat,e=b.mat[0],f=b.mat[1],g=b.mat[2],h=b.mat[3],k=b.mat[4],m=b.mat[5],n=b.mat[6],q=b.mat[7],s=b.mat[8],r=b.mat[9],t=b.mat[10],u=b.mat[11],y=b.mat[12],v=b.mat[13],C=b.mat[14];b=b.mat[15];var E=c.mat[0],A=c.mat[1],x=c.mat[2],z=c.mat[3],w=c.mat[4],B=c.mat[5],G=c.mat[6],H=c.mat[7],F=c.mat[8],J=c.mat[9],L=c.mat[10],K=c.mat[11],M=c.mat[12],I=c.mat[13],N=c.mat[14];c=c.mat[15];d[0]=E*e+A*k+x*s+z*y;d[1]=E*f+A*m+x*r+z*v;d[2]=E*g+A*n+x*t+z*C;d[3]=E*h+A*q+x*u+z*b;d[4]= w*e+B*k+G*s+H*y;d[5]=w*f+B*m+G*r+H*v;d[6]=w*g+B*n+G*t+H*C;d[7]=w*h+B*q+G*u+H*b;d[8]=F*e+J*k+L*s+K*y;d[9]=F*f+J*m+L*r+K*v;d[10]=F*g+J*n+L*t+K*C;d[11]=F*h+J*q+L*u+K*b;d[12]=M*e+I*k+N*s+c*y;d[13]=M*f+I*m+N*r+c*v;d[14]=M*g+I*n+N*t+c*C;d[15]=M*h+I*q+N*u+c*b;return a}; cc.getMat4MultiplyValue=function(a,b){var c=a.mat,d=b.mat,e=new Float32Array(16);e[0]=c[0]*d[0]+c[4]*d[1]+c[8]*d[2]+c[12]*d[3];e[1]=c[1]*d[0]+c[5]*d[1]+c[9]*d[2]+c[13]*d[3];e[2]=c[2]*d[0]+c[6]*d[1]+c[10]*d[2]+c[14]*d[3];e[3]=c[3]*d[0]+c[7]*d[1]+c[11]*d[2]+c[15]*d[3];e[4]=c[0]*d[4]+c[4]*d[5]+c[8]*d[6]+c[12]*d[7];e[5]=c[1]*d[4]+c[5]*d[5]+c[9]*d[6]+c[13]*d[7];e[6]=c[2]*d[4]+c[6]*d[5]+c[10]*d[6]+c[14]*d[7];e[7]=c[3]*d[4]+c[7]*d[5]+c[11]*d[6]+c[15]*d[7];e[8]=c[0]*d[8]+c[4]*d[9]+c[8]*d[10]+c[12]*d[11]; e[9]=c[1]*d[8]+c[5]*d[9]+c[9]*d[10]+c[13]*d[11];e[10]=c[2]*d[8]+c[6]*d[9]+c[10]*d[10]+c[14]*d[11];e[11]=c[3]*d[8]+c[7]*d[9]+c[11]*d[10]+c[15]*d[11];e[12]=c[0]*d[12]+c[4]*d[13]+c[8]*d[14]+c[12]*d[15];e[13]=c[1]*d[12]+c[5]*d[13]+c[9]*d[14]+c[13]*d[15];e[14]=c[2]*d[12]+c[6]*d[13]+c[10]*d[14]+c[14]*d[15];e[15]=c[3]*d[12]+c[7]*d[13]+c[11]*d[14]+c[15]*d[15];return e}; cc.getMat4MultiplyWithMat4=function(a,b,c){a=a.mat;b=b.mat;var d=c.mat;d[0]=a[0]*b[0]+a[4]*b[1]+a[8]*b[2]+a[12]*b[3];d[1]=a[1]*b[0]+a[5]*b[1]+a[9]*b[2]+a[13]*b[3];d[2]=a[2]*b[0]+a[6]*b[1]+a[10]*b[2]+a[14]*b[3];d[3]=a[3]*b[0]+a[7]*b[1]+a[11]*b[2]+a[15]*b[3];d[4]=a[0]*b[4]+a[4]*b[5]+a[8]*b[6]+a[12]*b[7];d[5]=a[1]*b[4]+a[5]*b[5]+a[9]*b[6]+a[13]*b[7];d[6]=a[2]*b[4]+a[6]*b[5]+a[10]*b[6]+a[14]*b[7];d[7]=a[3]*b[4]+a[7]*b[5]+a[11]*b[6]+a[15]*b[7];d[8]=a[0]*b[8]+a[4]*b[9]+a[8]*b[10]+a[12]*b[11];d[9]=a[1]* b[8]+a[5]*b[9]+a[9]*b[10]+a[13]*b[11];d[10]=a[2]*b[8]+a[6]*b[9]+a[10]*b[10]+a[14]*b[11];d[11]=a[3]*b[8]+a[7]*b[9]+a[11]*b[10]+a[15]*b[11];d[12]=a[0]*b[12]+a[4]*b[13]+a[8]*b[14]+a[12]*b[15];d[13]=a[1]*b[12]+a[5]*b[13]+a[9]*b[14]+a[13]*b[15];d[14]=a[2]*b[12]+a[6]*b[13]+a[10]*b[14]+a[14]*b[15];d[15]=a[3]*b[12]+a[7]*b[13]+a[11]*b[14]+a[15]*b[15];return c.mat}; cc.kmMat4Assign=function(a,b){if(a==b)return cc.log("cc.kmMat4Assign(): pOut equals pIn"),a;var c=a.mat,d=b.mat;c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return a}; cc.kmMat4AreEqual=function(a,b){if(a==b)return cc.log("cc.kmMat4AreEqual(): pMat1 and pMat2 are same object."),!0;for(var c=0;16>c;c++)if(!(a.mat[c]+cc.kmEpsilon>b.mat[c]&&a.mat[c]-cc.kmEpsilonc?cc.POINT_BEHIND_PLANE:cc.POINT_ON_PLANE};cc.kmQuaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||0};cc.kmQuaternionConjugate=function(a,b){a.x=-b.x;a.y=-b.y;a.z=-b.z;a.w=b.w;return a};cc.kmQuaternionDot=function(a,b){return a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z};cc.kmQuaternionExp=function(a,b){return a};cc.kmQuaternionIdentity=function(a){a.x=0;a.y=0;a.z=0;a.w=1;return a}; cc.kmQuaternionInverse=function(a,b){var c=cc.kmQuaternionLength(b),d=new cc.kmQuaternion;if(Math.abs(c)>cc.kmEpsilon)return a.x=0,a.y=0,a.z=0,a.w=0,a;cc.kmQuaternionScale(a,cc.kmQuaternionConjugate(d,b),1/c);return a};cc.kmQuaternionIsIdentity=function(a){return 0==a.x&&0==a.y&&0==a.z&&1==a.w};cc.kmQuaternionLength=function(a){return Math.sqrt(cc.kmQuaternionLengthSq(a))};cc.kmQuaternionLengthSq=function(a){return a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w};cc.kmQuaternionLn=function(a,b){return a}; cc.kmQuaternionMultiply=function(a,b,c){a.w=b.w*c.w-b.x*c.x-b.y*c.y-b.z*c.z;a.x=b.w*c.x+b.x*c.w+b.y*c.z-b.z*c.y;a.y=b.w*c.y+b.y*c.w+b.z*c.x-b.x*c.z;a.z=b.w*c.z+b.z*c.w+b.x*c.y-b.y*c.x;return a};cc.kmQuaternionNormalize=function(a,b){var c=cc.kmQuaternionLength(b);if(Math.abs(c)<=cc.kmEpsilon)throw"cc.kmQuaternionNormalize(): pIn is an invalid value";cc.kmQuaternionScale(a,b,1/c);return a}; cc.kmQuaternionRotationAxis=function(a,b,c){c*=0.5;var d=Math.sin(c);a.w=Math.cos(c);a.x=b.x*d;a.y=b.y*d;a.z=b.z*d;return a}; cc.kmQuaternionRotationMatrix=function(a,b){var c,d,e,f;c=[];d=f=0;if(!b)return null;c[0]=b.mat[0];c[1]=b.mat[3];c[2]=b.mat[6];c[4]=b.mat[1];c[5]=b.mat[4];c[6]=b.mat[7];c[8]=b.mat[2];c[9]=b.mat[5];c[10]=b.mat[8];c[15]=1;var g=c[0];d=g[0]+g[5]+g[10]+1;d>cc.kmEpsilon?(f=2*Math.sqrt(d),c=(g[9]-g[6])/f,d=(g[2]-g[8])/f,e=(g[4]-g[1])/f,f*=0.25):g[0]>g[5]&&g[0]>g[10]?(f=2*Math.sqrt(1+g[0]-g[5]-g[10]),c=0.25*f,d=(g[4]+g[1])/f,e=(g[2]+g[8])/f,f=(g[9]-g[6])/f):g[5]>g[10]?(f=2*Math.sqrt(1+g[5]-g[0]-g[10]),c= (g[4]+g[1])/f,d=0.25*f,e=(g[9]+g[6])/f,f=(g[2]-g[8])/f):(f=2*Math.sqrt(1+g[10]-g[0]-g[5]),c=(g[2]+g[8])/f,d=(g[9]+g[6])/f,e=0.25*f,f=(g[4]-g[1])/f);a.x=c;a.y=d;a.z=e;a.w=f;return a}; cc.kmQuaternionRotationYawPitchRoll=function(a,b,c,d){var e,f,g,h,k;e=cc.kmDegreesToRadians(c)/2;f=cc.kmDegreesToRadians(b)/2;g=cc.kmDegreesToRadians(d)/2;d=Math.cos(e);b=Math.cos(f);c=Math.cos(g);e=Math.sin(e);f=Math.sin(f);g=Math.sin(g);h=b*c;k=f*g;a.w=d*h+e*k;a.x=e*h-d*k;a.y=d*f*c+e*b*g;a.z=d*b*g-e*f*c;cc.kmQuaternionNormalize(a,a);return a}; cc.kmQuaternionSlerp=function(a,b,c,d){if(b.x==c.x&&b.y==c.y&&b.z==c.z&&b.w==c.w)return a.x=b.x,a.y=b.y,a.z=b.z,a.w=b.w,a;var e=cc.kmQuaternionDot(b,c),f=Math.acos(e),g=Math.sqrt(1-cc.kmSQR(e)),e=Math.sin(d*f)/g;d=Math.sin((1-d)*f)/g;f=new cc.kmQuaternion;g=new cc.kmQuaternion;cc.kmQuaternionScale(f,b,d);cc.kmQuaternionScale(g,c,e);cc.kmQuaternionAdd(a,f,g);return a}; cc.kmQuaternionToAxisAngle=function(a,b,c){Math.acos(a.w);c=Math.sqrt(cc.kmSQR(a.x)+cc.kmSQR(a.y)+cc.kmSQR(a.z));c>-cc.kmEpsilon&&c2*cc.kmPI-cc.kmEpsilon?(b.x=0,b.y=0,b.z=1):(b.x=a.x/c,b.y=a.y/c,b.z=a.z/c,cc.kmVec3Normalize(b,b))};cc.kmQuaternionScale=function(a,b,c){a.x=b.x*c;a.y=b.y*c;a.z=b.z*c;a.w=b.w*c;return a};cc.kmQuaternionAssign=function(a,b){a.x=b.x;a.y=b.y;a.z=b.z;a.w=b.w;return a}; cc.kmQuaternionAdd=function(a,b,c){a.x=b.x+c.x;a.y=b.y+c.y;a.z=b.z+c.z;a.w=b.w+c.w;return a}; cc.kmQuaternionRotationBetweenVec3=function(a,b,c,d){var e=new cc.kmVec3,f=new cc.kmVec3;cc.kmVec3Assign(e,b);cc.kmVec3Assign(f,c);cc.kmVec3Normalize(e,e);cc.kmVec3Normalize(f,f);c=cc.kmVec3Dot(e,f);if(1<=c)return cc.kmQuaternionIdentity(a),a;-0.999999>c?Math.abs(cc.kmVec3LengthSq(d))=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.KM_TRUE:cc.KM_FALSE};cc.kmAABBAssign=function(a,b){cc.kmVec3Assign(a.min,b.min);cc.kmVec3Assign(a.max,b.max);return a};cc.kmAABBScale=function(a,b,c){cc.log("cc.kmAABBScale hasn't been supported.")};cc.km_mat4_stack=function(a,b,c,d){this.top=c;this.stack=d};cc.km_mat4_stack.INITIAL_SIZE=30;cc.km_mat4_stack_initialize=function(a){a.stack=[];a.top=null};cc.km_mat4_stack_push=function(a,b){a.stack.push(a.top);a.top=new cc.kmMat4;cc.kmMat4Assign(a.top,b)};cc.km_mat4_stack_pop=function(a,b){a.top=a.stack.pop()};cc.km_mat4_stack_release=function(a){a.stack=null;a.top=null};cc.KM_GL_MODELVIEW=5888;cc.KM_GL_PROJECTION=5889;cc.KM_GL_TEXTURE=5890;cc.modelview_matrix_stack=new cc.km_mat4_stack;cc.projection_matrix_stack=new cc.km_mat4_stack;cc.texture_matrix_stack=new cc.km_mat4_stack;cc.current_stack=null;cc.initialized=!1; cc.lazyInitialize=function(){if(!cc.initialized){var a=new cc.kmMat4;cc.km_mat4_stack_initialize(cc.modelview_matrix_stack);cc.km_mat4_stack_initialize(cc.projection_matrix_stack);cc.km_mat4_stack_initialize(cc.texture_matrix_stack);cc.current_stack=cc.modelview_matrix_stack;cc.initialized=!0;cc.kmMat4Identity(a);cc.km_mat4_stack_push(cc.modelview_matrix_stack,a);cc.km_mat4_stack_push(cc.projection_matrix_stack,a);cc.km_mat4_stack_push(cc.texture_matrix_stack,a)}};cc.lazyInitialize(); cc.kmGLFreeAll=function(){cc.km_mat4_stack_release(cc.modelview_matrix_stack);cc.km_mat4_stack_release(cc.projection_matrix_stack);cc.km_mat4_stack_release(cc.texture_matrix_stack);cc.initialized=!1;cc.current_stack=null};cc.kmGLPushMatrix=function(){cc.km_mat4_stack_push(cc.current_stack,cc.current_stack.top)};cc.kmGLPushMatrixWitMat4=function(a){cc.current_stack.stack.push(cc.current_stack.top);cc.kmMat4Assign(a,cc.current_stack.top);cc.current_stack.top=a}; cc.kmGLPopMatrix=function(){cc.current_stack.top=cc.current_stack.stack.pop()};cc.kmGLMatrixMode=function(a){switch(a){case cc.KM_GL_MODELVIEW:cc.current_stack=cc.modelview_matrix_stack;break;case cc.KM_GL_PROJECTION:cc.current_stack=cc.projection_matrix_stack;break;case cc.KM_GL_TEXTURE:cc.current_stack=cc.texture_matrix_stack;break;default:throw"Invalid matrix mode specified";}};cc.kmGLLoadIdentity=function(){cc.kmMat4Identity(cc.current_stack.top)}; cc.kmGLLoadMatrix=function(a){cc.kmMat4Assign(cc.current_stack.top,a)};cc.kmGLMultMatrix=function(a){cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,a)};cc.kmGLTranslatef=function(a,b,c){var d=new cc.kmMat4;cc.kmMat4Translation(d,a,b,c);cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,d)}; cc.kmGLRotatef=function(a,b,c,d){b=new cc.kmVec3(b,c,d);c=new cc.kmMat4;cc.kmMat4RotationAxisAngle(c,b,cc.kmDegreesToRadians(a));cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,c)};cc.kmGLScalef=function(a,b,c){var d=new cc.kmMat4;cc.kmMat4Scaling(d,a,b,c);cc.kmMat4Multiply(cc.current_stack.top,cc.current_stack.top,d)}; cc.kmGLGetMatrix=function(a,b){switch(a){case cc.KM_GL_MODELVIEW:cc.kmMat4Assign(b,cc.modelview_matrix_stack.top);break;case cc.KM_GL_PROJECTION:cc.kmMat4Assign(b,cc.projection_matrix_stack.top);break;case cc.KM_GL_TEXTURE:cc.kmMat4Assign(b,cc.texture_matrix_stack.top);break;default:throw"Invalid matrix mode specified";}};cc.SHADER_POSITION_UCOLOR_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor;\nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor; \n}\n";cc.SHADER_POSITION_UCOLOR_VERT="attribute vec4 a_position;\nuniform vec4 u_color;\nuniform float u_pointSize;\nvarying lowp vec4 v_fragmentColor; \nvoid main(void) \n{\n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n gl_PointSize \x3d u_pointSize; \n v_fragmentColor \x3d u_color; \n}"; cc.SHADER_POSITION_COLOR_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor; \n} ";cc.SHADER_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying lowp vec4 v_fragmentColor;\nvoid main()\n{\n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n}";cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG="// #extension GL_OES_standard_derivatives : enable\nvarying mediump vec4 v_color;\nvarying mediump vec2 v_texcoord;\nvoid main()\t\n{ \n// #if defined GL_OES_standard_derivatives\t\n// gl_FragColor \x3d v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord)); \n// #else\t\ngl_FragColor \x3d v_color * step(0.0, 1.0 - length(v_texcoord)); \n// #endif \n}"; cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT="attribute mediump vec4 a_position; \nattribute mediump vec2 a_texcoord; \nattribute mediump vec4 a_color;\t\nvarying mediump vec4 v_color; \nvarying mediump vec2 v_texcoord;\t\nvoid main() \n{ \n v_color \x3d a_color;//vec4(a_color.rgb * a_color.a, a_color.a); \n v_texcoord \x3d a_texcoord; \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n}";cc.SHADER_POSITION_TEXTURE_FRAG="precision lowp float; \nvarying vec2 v_texCoord; \nuniform sampler2D CC_Texture0; \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; \nuniform sampler2D CC_Texture0; \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; \nuniform sampler2D CC_Texture0; \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; \nuniform sampler2D CC_Texture0; \nvoid main() \n{ \n gl_FragColor \x3d v_fragmentColor * texture2D(CC_Texture0, v_texCoord); \n}"; cc.SHADER_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position \x3d (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor \x3d a_color; \n v_texCoord \x3d a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform sampler2D CC_Texture0; \nuniform float CC_alpha_value; \nvoid main() \n{ \n vec4 texColor \x3d texture2D(CC_Texture0, v_texCoord); \n if ( texColor.a \x3c\x3d CC_alpha_value ) \n discard; \n gl_FragColor \x3d texColor * v_fragmentColor; \n}"; cc.SHADEREX_SWITCHMASK_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform sampler2D u_texture; \nuniform sampler2D u_mask; \nvoid main() \n{ \n vec4 texColor \x3d texture2D(u_texture, v_texCoord); \n vec4 maskColor \x3d texture2D(u_mask, v_texCoord); \n vec4 finalColor \x3d vec4(texColor.r, texColor.g, texColor.b, maskColor.a * texColor.a); \n gl_FragColor \x3d v_fragmentColor * finalColor; \n}";cc.shaderCache={TYPE_POSITION_TEXTURECOLOR:0,TYPE_POSITION_TEXTURECOLOR_ALPHATEST:1,TYPE_POSITION_COLOR:2,TYPE_POSITION_TEXTURE:3,TYPE_POSITION_TEXTURE_UCOLOR:4,TYPE_POSITION_TEXTURE_A8COLOR:5,TYPE_POSITION_UCOLOR:6,TYPE_POSITION_LENGTH_TEXTURECOLOR:7,TYPE_MAX:8,_programs:{},_init:function(){this.loadDefaultShaders();return!0},_loadDefaultShader:function(a,b){switch(b){case this.TYPE_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_FRAG); a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case this.TYPE_POSITION_TEXTURECOLOR_ALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR); a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case this.TYPE_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_VERT,cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case this.TYPE_POSITION_TEXTURE:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_VERT,cc.SHADER_POSITION_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION, cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case this.TYPE_POSITION_TEXTURE_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT,cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case this.TYPE_POSITION_TEXTURE_A8COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT, cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case this.TYPE_POSITION_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_UCOLOR_VERT,cc.SHADER_POSITION_UCOLOR_FRAG);a.addAttribute("aVertex",cc.VERTEX_ATTRIB_POSITION);break;case this.TYPE_POSITION_LENGTH_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT, cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;default:cc.log("cocos2d: cc.shaderCache._loadDefaultShader, error shader type");return}a.link();a.updateUniforms()},loadDefaultShaders:function(){var a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR);this._programs[cc.SHADER_POSITION_TEXTURECOLOR]= a;this._programs.ShaderPositionTextureColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR_ALPHATEST);this._programs[cc.SHADER_POSITION_TEXTURECOLORALPHATEST]=a;this._programs.ShaderPositionTextureColorAlphaTest=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_COLOR);this._programs[cc.SHADER_POSITION_COLOR]=a;this._programs.ShaderPositionColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE);this._programs[cc.SHADER_POSITION_TEXTURE]= a;this._programs.ShaderPositionTexture=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_UCOLOR);this._programs[cc.SHADER_POSITION_TEXTURE_UCOLOR]=a;this._programs.ShaderPositionTextureUColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_A8COLOR);this._programs[cc.SHADER_POSITION_TEXTUREA8COLOR]=a;this._programs.ShaderPositionTextureA8Color=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_UCOLOR);this._programs[cc.SHADER_POSITION_UCOLOR]= a;this._programs.ShaderPositionUColor=a;a=new cc.GLProgram;this._loadDefaultShader(a,this.TYPE_POSITION_LENGTH_TEXTURECOLOR);this._programs[cc.SHADER_POSITION_LENGTHTEXTURECOLOR]=a;this._programs.ShaderPositionLengthTextureColor=a},reloadDefaultShaders:function(){var a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURECOLOR_ALPHATEST); a=this.programForKey(cc.SHADER_POSITION_COLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_COLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTURE);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE);a=this.programForKey(cc.SHADER_POSITION_TEXTURE_UCOLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_UCOLOR);a=this.programForKey(cc.SHADER_POSITION_TEXTUREA8COLOR);a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_TEXTURE_A8COLOR);a=this.programForKey(cc.SHADER_POSITION_UCOLOR); a.reset();this._loadDefaultShader(a,this.TYPE_POSITION_UCOLOR)},programForKey:function(a){return this._programs[a]},getProgram:function(a){return this._programs[a]},addProgram:function(a,b){this._programs[b]=a}};cc.HashUniformEntry=function(a,b,c){this.value=a;this.location=b;this.hh=c||{}}; cc.GLProgram=cc.Class.extend({_glContext:null,_programObj:null,_vertShader:null,_fragShader:null,_uniforms:null,_hashForUniforms:null,_usesTime:!1,_updateUniformLocation:function(a,b,c){if(null==a)return!1;c=!0;for(var d=null,e=0;earguments.length))switch(arguments.length){case 2:this.setUniformLocationWith1f(arguments[0],arguments[1]);break;case 3:this.setUniformLocationWith2f(arguments[0],arguments[1],arguments[2]);break;case 4:this.setUniformLocationWith3f(arguments[0], arguments[1],arguments[2],arguments[3]);break;case 5:this.setUniformLocationWith4f(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4])}},setUniformsForBuiltins:function(){var a=new cc.kmMat4,b=new cc.kmMat4,c=new cc.kmMat4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,a);cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,b);cc.kmMat4Multiply(c,a,b);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX],a.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX],b.mat, 1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME],a/8,a/4,a/2,Math.cos(a)));-1!=this._uniforms[cc.UNIFORM_RANDOM01]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01], Math.random(),Math.random(),Math.random(),Math.random())},setUniformForModelViewProjectionMatrix:function(){this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX],!1,cc.getMat4MultiplyValue(cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top))},setUniformForModelViewProjectionMatrixWithMat4:function(a){cc.kmMat4Multiply(a,cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top);this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX],!1,a.mat)},setUniformForModelViewAndProjectionMatrixWithMat4:function(){this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX], !1,cc.modelview_matrix_stack.top.mat);this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX],!1,cc.projection_matrix_stack.top.mat)},vertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getVertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getFragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},fragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._fragShader)},programLog:function(){return this._glContext.getProgramInfoLog(this._programObj)}, getProgramLog:function(){return this._glContext.getProgramInfoLog(this._programObj)},reset:function(){this._fragShader=this._vertShader=null;this._uniforms.length=0;this._glContext.deleteProgram(this._programObj);this._programObj=null;for(var a=0;a>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,_cacheCanvas:null,_cacheContext:null,_fBO:0,_depthRenderBuffer:0,_oldFBO:0,_texture:null,_textureCopy:null,_uITextureImage:null,_pixelFormat:cc.Texture2D.PIXEL_FORMAT_RGBA8888,_clearColor:null,clearStencilVal:0,_clearColorStr:null,_className:"RenderTexture",ctor:null,_ctorForCanvas:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this._clearColor=cc.color(255, 255,255,255);this._clearColorStr="rgba(255,255,255,1)";this._cacheCanvas=cc.newElement("canvas");this._cacheContext=this._cacheCanvas.getContext("2d");this.anchorY=this.anchorX=0;void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.initWithWidthAndHeight(a,b,c,d||0))},_ctorForWebGL:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this._clearColor=cc.color(0,0,0,0);void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888, this.initWithWidthAndHeight(a,b,c,d||0))},cleanup:null,_cleanupForCanvas:function(){cc.Node.prototype.onExit.call(this);this._cacheCanvas=this._cacheContext=null},_cleanupForWebGL:function(){cc.Node.prototype.onExit.call(this);this._textureCopy=null;var a=cc._renderContext;a.deleteFramebuffer(this._fBO);this._depthRenderBuffer&&a.deleteRenderbuffer(this._depthRenderBuffer);this._uITextureImage=null},getSprite:function(){return this.sprite},setSprite:function(a){this.sprite=a},initWithWidthAndHeight:null, _initWithWidthAndHeightForCanvas:function(a,b,c,d){c=this._cacheCanvas;d=cc.contentScaleFactor();c.width=0|a*d;c.height=0|b*d;this._cacheContext.translate(0,c.height);a=new cc.Texture2D;a.initWithElement(c);a.handleLoadedTexture();a=this.sprite=cc.Sprite.create(a);a.setBlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA);this.autoDraw=!1;this.addChild(a);return!0},_initWithWidthAndHeightForWebGL:function(a,b,c,d){c==cc.Texture2D.PIXEL_FORMAT_A8&&cc.log("cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;"); var e=cc._renderContext,f=cc.contentScaleFactor();a=0|a*f;b=0|b*f;this._oldFBO=e.getParameter(e.FRAMEBUFFER_BINDING);var g;cc.configuration.supportsNPOT()?(f=a,g=b):(f=cc.NextPOT(a),g=cc.NextPOT(b));for(var h=new Uint8Array(f*g*4),k=0;kc.getCapacity()&&cc.log("cc.LabelAtlas._updateAtlasValues(): Invalid String length");for(var h=c.quads,k=this._displayedColor,k={r:k.r,g:k.g,b:k.b,a:this._displayedOpacity},m=this._itemWidth,n=0;na&&c.increaseTotalQuadsWith(b-a))},setString:null,_setStringForCanvas:function(a){a=String(a);var b=a.length;this._string=a;this.width=b*this._itemWidth;this.height=this._itemHeight;if(this._children){a=this._children;for(var b=a.length,c=0;cthis.textureAtlas.totalQuads&&this.textureAtlas.resizeCapacity(b);this._string=a;this.width=b*this._itemWidth;this.height=this._itemHeight;this.updateAtlasValues();this.quadsToDraw=b},setOpacity:null,_setOpacityForCanvas:function(a){if(this._displayedOpacity!==a){cc.AtlasNode.prototype.setOpacity.call(this,a);for(var b=this._children,c=0,d=b.length;c=a)break;var t=this._string[e];g||(k=this._getLetterPosXLeft(n),g=!0);f||(h=k,f=!0);if(10==t.charCodeAt(0)){c.push("\n");b=b.concat(c);c.length=0;f=g=!1;h=k=-1;q--;m-=r;d++;if(e>=a)break;k||(k=this._getLetterPosXLeft(n),g=!0);h||(h=k,f=!0);e++}else if(this._isspace_unicode(t))c.push(t),b=b.concat(c),c.length=0,g=!1,k=-1,e++;else if(this._getLetterPosXRight(n)-h>this._width)if(this._lineBreakWithoutSpaces){this._utf8_trim_ws(c); c.push("\n");b=b.concat(c);c.length=0;f=g=!1;h=k=-1;d++;if(e>=a)break;k||(k=this._getLetterPosXLeft(n),g=!0);h||(h=k,f=!0);q--}else c.push(t),-1!=b.lastIndexOf(" ")?this._utf8_trim_ws(b):b=[],0n)&&(q=this.getChildByTag(n),null!=q)){q=q.getPositionX()+q._getWidth()/2;g=0;switch(this._alignment){case cc.TEXT_ALIGNMENT_CENTER:g=this.width/2-q/2;break;case cc.TEXT_ALIGNMENT_RIGHT:g=this.width-q}if(0!=g)for(q=0;qn||!(n=this.getChildByTag(n)))||(n.x+=g);e+=f;b++;c.length=0}}else c.push(this._string[e])},setAlignment:function(a){this._alignment=a;this.updateLabel()},_getAlignment:function(){return this._alignment},setBoundingWidth:function(a){this._width= a;this.updateLabel()},_getBoundingWidth:function(){return this._width},setLineBreakWithoutSpace:function(a){this._lineBreakWithoutSpaces=a;this.updateLabel()},setScale:function(a,b){cc.Node.prototype.setScale.call(this,a,b);this.updateLabel()},setScaleX:function(a){cc.Node.prototype.setScaleX.call(this,a);this.updateLabel()},setScaleY:function(a){cc.Node.prototype.setScaleY.call(this,a);this.updateLabel()},setFntFile:function(a){if(null!=a&&a!=this._fntFile){var b=cc.loader.getRes(a);b?(this._fntFile= a,this._config=b,a=cc.textureCache.addImage(b.atlasName),this._textureLoaded=b=a.isLoaded(),this.texture=a,cc._renderType===cc._RENDER_TYPE_CANVAS&&(this._originalTexture=this.texture),b?this.createFontChars():a.addLoadedEventListener(function(a){this._textureLoaded=!0;this.texture=a;this.createFontChars();this._changeTextureColor();this.updateLabel();this._callLoadedEventCallbacks()},this)):cc.log("cc.LabelBMFont.setFntFile() : Impossible to create font. Please check file")}},getFntFile:function(){return this._fntFile}, setAnchorPoint:function(a,b){cc.Node.prototype.setAnchorPoint.call(this,a,b);this.updateLabel()},_setAnchor:function(a){cc.Node.prototype._setAnchor.call(this,a);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)}});_p=cc.LabelBMFont.prototype; cc._renderType===cc._RENDER_TYPE_CANVAS&&(cc.sys._supportCanvasNewBlendModes||(_p._changeTextureColor=function(){if(cc._renderType!=cc._RENDER_TYPE_WEBGL){var a,b=this.getTexture();if(b&&0e.width||d.scaleH>e.height)&&cc.log("cc.LabelBMFont._parseCommonArguments(): page can't be larger than supported")}1!==d.pages&&cc.log("cc.LabelBMFont._parseCommonArguments(): only supports 1 page"); d=this._parseStrToObj(a.match(this.PAGE_EXP)[0]);0!==d.id&&cc.log("cc.LabelBMFont._parseImageFileName() : file could not be found");c.atlasName=cc.path.changeBasename(b,d.file);for(var f=a.match(this.CHAR_EXP),g=c.fontDefDictionary={},d=0,e=f.length;d=this._nuPoints||!this.texture||!this.texture.isLoaded()||(a=a||cc._renderContext,cc.nodeDrawSetup(this), cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX),cc.glBlendFunc(this._blendFunc.src,this._blendFunc.dst),cc.glBindTexture2D(this.texture),a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer),a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW),a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,this._texCoordsBuffer),a.bufferData(a.ARRAY_BUFFER,this._texCoords,a.DYNAMIC_DRAW),a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,0, 0),a.bindBuffer(a.ARRAY_BUFFER,this._colorPointerBuffer),a.bufferData(a.ARRAY_BUFFER,this._colorPointer,a.DYNAMIC_DRAW),a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,0,0),a.drawArrays(a.TRIANGLE_STRIP,0,2*this._nuPoints),cc.g_NumberOfDraws++)},update:function(a){if(this.startingPositionInitialized){a*=this._fadeDelta;var b,c,d,e,f=0,g=this._nuPoints,h=this._pointState,k=this._pointVertexes,m=this._vertices,n=this._colorPointer;for(d=0;d=h[d]?f++:(b=d-f,0=this._maxPoints?d=!1:0this._bufferCapacity){var c=cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT;this._bufferCapacity+=Math.max(this._bufferCapacity,a);if(null==b||0===b.length)this._buffer=[],this._trianglesArrayBuffer=new ArrayBuffer(c* this._bufferCapacity),this._trianglesReader=new Uint8Array(this._trianglesArrayBuffer);else{a=[];for(var d=new ArrayBuffer(c*this._bufferCapacity),e=0;e=b)){c={r:0|c.r,g:0|c.g,b:0|c.b,a:0|c.a};var e=[],f,g,h,k,m=a.length;for(f=0;f=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),cc.ClippingNode._init_once=!1);return!0},_initForCanvas:function(a){this._stencil=a;this.alphaThreshold=1;this.inverted=!1},onEnter:function(){cc.Node.prototype.onEnter.call(this);this._stencil.onEnter()},onEnterTransitionDidFinish:function(){cc.Node.prototype.onEnterTransitionDidFinish.call(this);this._stencil.onEnterTransitionDidFinish()},onExitTransitionDidStart:function(){this._stencil.onExitTransitionDidStart();cc.Node.prototype.onExitTransitionDidStart.call(this)}, onExit:function(){this._stencil.onExit();cc.Node.prototype.onExit.call(this)},visit:null,_visitForWebGL:function(a){var b=a||cc._renderContext;if(1>cc.stencilBits)cc.Node.prototype.visit.call(this,a);else if(this._stencil&&this._stencil.visible)if(cc.ClippingNode._layer+1==cc.stencilBits)cc.ClippingNode._visit_once=!0,cc.ClippingNode._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its childs."),cc.ClippingNode._visit_once= !1),cc.Node.prototype.visit.call(this,a);else{cc.ClippingNode._layer++;var c=1<this.alphaThreshold){var c=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),r=b.getUniformLocation(c.getProgram(),cc.UNIFORM_ALPHA_TEST_VALUE_S);cc.glUseProgram(c.getProgram());c.setUniformLocationWith1f(r,this.alphaThreshold);cc.setProgram(this._stencil,c)}cc.kmGLPushMatrix();this.transform();this._stencil.visit();cc.kmGLPopMatrix();b.depthMask(s);b.stencilFunc(b.EQUAL,d,d);b.stencilOp(b.KEEP,b.KEEP,b.KEEP);cc.Node.prototype.visit.call(this,a);b.stencilFunc(g, h,k);b.stencilOp(m,n,q);b.stencilMask(f);e||b.disable(b.STENCIL_TEST);cc.ClippingNode._layer--}else this.inverted&&cc.Node.prototype.visit.call(this,a)},_visitForCanvas:function(a){if(this._stencil&&this._stencil.visible){a=a||cc._renderContext;var b=a.canvas;if(this._cangodhelpme()||this._stencil instanceof cc.Sprite){var c=cc.ClippingNode._getSharedCache();c.width=b.width;c.height=b.height;c.getContext("2d").drawImage(b,0,0);a.save();cc.Node.prototype.visit.call(this,a);a.globalCompositeOperation= this.inverted?"destination-out":"destination-in";this.transform(a);this._stencil.visit();a.restore();a.save();a.setTransform(1,0,0,1,0,0);a.globalCompositeOperation="destination-over";a.drawImage(c,0,0)}else{var c=this._children,d;a.save();this.transform(a);this._stencil.visit(a);this.inverted&&(a.save(),a.setTransform(1,0,0,1,0,0),a.moveTo(0,0),a.lineTo(0,b.height),a.lineTo(b.width,b.height),a.lineTo(b.width,0),a.lineTo(0,0),a.restore());a.clip();this._cangodhelpme(!0);var e=c.length;if(0d._localZOrder)d.visit(a);else break;for(this.draw(a);bh;++h)q[s[h]]=A[h].x,q[s[h]+1]=A[h].y,q[s[h]+2]=A[h].z,m[y[h]]=r[h].x/b,m[y[h]+1]=n?(d-r[h].y)/c:r[h].y/c}this._originalVertices=new Float32Array(this._vertices);a.bindBuffer(a.ARRAY_BUFFER,this._verticesBuffer);a.bufferData(a.ARRAY_BUFFER,this._vertices,a.DYNAMIC_DRAW);a.bindBuffer(a.ARRAY_BUFFER, this._texCoordinateBuffer);a.bufferData(a.ARRAY_BUFFER,this._texCoordinates,a.DYNAMIC_DRAW);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);a.bufferData(a.ELEMENT_ARRAY_BUFFER,this._indices,a.STATIC_DRAW);this._dirty=!0}});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){cc.GridBase.prototype.ctor.call(this);this._indicesBuffer=this._verticesBuffer=this._texCoordinateBuffer=this._indices=this._originalVertices=this._vertices=this._texCoordinates=null;void 0!==a&&this.initWithSize(a,b,c)},tile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.tile() : Numbers must be integers"); a=12*(this._gridSize.height*a.x+a.y);var 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]))},originalTile:function(a){a.x===(0|a.x)&&a.y===(0|a.y)||cc.log("cc.TiledGrid3D.originalTile() : Numbers must be integers");a=12*(this._gridSize.height*a.x+a.y);var 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]))},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(){var a=this._gridSize.width*this._gridSize.height; this._shaderProgram.use();this._shaderProgram.setUniformsForBuiltins();var b=cc._renderContext,c=this._dirty;cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POSITION|cc.VERTEX_ATTRIB_FLAG_TEX_COORDS);b.bindBuffer(b.ARRAY_BUFFER,this._verticesBuffer);c&&b.bufferData(b.ARRAY_BUFFER,this._vertices,b.DYNAMIC_DRAW);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,b.FLOAT,!1,0,this._vertices);b.bindBuffer(b.ARRAY_BUFFER,this._texCoordinateBuffer);c&&b.bufferData(b.ARRAY_BUFFER,this._texCoordinates,b.DYNAMIC_DRAW); b.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,b.FLOAT,!1,0,this._texCoordinates);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this._indicesBuffer);c&&b.bufferData(b.ELEMENT_ARRAY_BUFFER,this._indices,b.STATIC_DRAW);b.drawElements(b.TRIANGLES,6*a,b.UNSIGNED_SHORT,0);c&&(this._dirty=!1);cc.incrementGLDraws(1)},reuse:function(){if(0=this._duration},_cloneDecoration:function(a){a._repeatForever=this._repeatForever;a._speed=this._speed;a._times=this._times;a._easeList=this._easeList;a._speedMethod=this._speedMethod;a._repeatMethod=this._repeatMethod},_reverseEaseList:function(a){if(this._easeList){a._easeList=[];for(var b=0;ba?a:1;this.update(0=a)return cc.log("The speed parameter error"),this;this._speedMethod=!0;this._speed*=a;return this},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a;return this},repeat:function(a){a=Math.round(a);if(isNaN(a)||1>a)return cc.log("The repeat parameter error"),this;this._repeatMethod=!0;this._times*=a;return this},repeatForever:function(){this._repeatMethod=!0;this._times=this.MAX_VALUE;this._repeatForever=!0;return this}}); cc.actionInterval=function(a){return new cc.ActionInterval(a)};cc.ActionInterval.create=cc.actionInterval; cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._actions=[];var b=a instanceof Array?a:arguments,c=b.length-1;0<=c&&null==b[c]&&cc.log("parameters should not be ending with null in Javascript");if(0<=c){for(var d=b[0],e=1;e=e){for(;a>e&&this._totale?this._two=cc.Sequence._actionOneTwo(b,cc.delayTime(d-e)):dc&&(c+=360);this._startAngleX=b;this._diffAngleX=c;this._startAngleY=a.rotationY%360;a=this._dstAngleY-this._startAngleY;180a&&(a+=360);this._diffAngleY=a},reverse:function(){cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.")},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX= this._startAngleX+this._diffAngleX*a,this.target.rotationY=this._startAngleY+this._diffAngleY*a)}});cc.rotateTo=function(a,b,c){return new cc.RotateTo(a,b,c)};cc.RotateTo.create=cc.rotateTo; cc.RotateBy=cc.ActionInterval.extend({_angleX:0,_startAngleX:0,_angleY:0,_startAngleY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._angleX=b||0,this._angleY=c||this._angleX,!0):!1},clone:function(){var a=new cc.RotateBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._angleX,this._angleY);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._startAngleX=a.rotationX;this._startAngleY=a.rotationY},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX=this._startAngleX+this._angleX*a,this.target.rotationY=this._startAngleY+this._angleY*a)},reverse:function(){var a=new cc.RotateBy(this._duration,-this._angleX,-this._angleY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.rotateBy=function(a,b,c){return new cc.RotateBy(a,b,c)};cc.RotateBy.create=cc.rotateBy; cc.MoveBy=cc.ActionInterval.extend({_positionDelta:null,_startPosition:null,_previousPosition:null,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);this._positionDelta=cc.p(0,0);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0!==b.x&&(c=b.y,b=b.x),this._positionDelta.x=b,this._positionDelta.y=c,!0):!1},clone:function(){var a= new cc.MoveBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._positionDelta);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=this._positionDelta.x*a;a*=this._positionDelta.y;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d= this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;b+=c.x;a+=c.y;f.x=b;f.y=a;this.target.setPosition(b,a)}else this.target.setPosition(c.x+b,c.y+a)}},reverse:function(){var a=new cc.MoveBy(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y));this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.moveBy=function(a,b,c){return new cc.MoveBy(a,b,c)};cc.MoveBy.create=cc.moveBy; cc.MoveTo=cc.MoveBy.extend({_endPosition:null,ctor:function(a,b,c){cc.MoveBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.MoveBy.prototype.initWithDuration.call(this,a,b,c)?(void 0!==b.x&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},clone:function(){var a=new cc.MoveTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition);return a},startWithTarget:function(a){cc.MoveBy.prototype.startWithTarget.call(this, a);this._positionDelta.x=this._endPosition.x-a.getPositionX();this._positionDelta.y=this._endPosition.y-a.getPositionY()}});cc.moveTo=function(a,b,c){return new cc.MoveTo(a,b,c)};cc.MoveTo.create=cc.moveTo; cc.SkewTo=cc.ActionInterval.extend({_skewX:0,_skewY:0,_startSkewX:0,_startSkewY:0,_endSkewX:0,_endSkewY:0,_deltaX:0,_deltaY:0,ctor:function(a,b,c){cc.ActionInterval.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.ActionInterval.prototype.initWithDuration.call(this,a)&&(this._endSkewX=b,this._endSkewY=c,d=!0);return d},clone:function(){var a=new cc.SkewTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endSkewX,this._endSkewY); return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._startSkewX=a.skewX%180;this._deltaX=this._endSkewX-this._startSkewX;180this._deltaX&&(this._deltaX+=360);this._startSkewY=a.skewY%360;this._deltaY=this._endSkewY-this._startSkewY;180this._deltaY&&(this._deltaY+=360)},update:function(a){a=this._computeEaseTime(a);this.target.skewX=this._startSkewX+this._deltaX*a;this.target.skewY= this._startSkewY+this._deltaY*a}});cc.skewTo=function(a,b,c){return new cc.SkewTo(a,b,c)};cc.SkewTo.create=cc.skewTo; cc.SkewBy=cc.SkewTo.extend({ctor:function(a,b,c){cc.SkewTo.prototype.ctor.call(this);void 0!==c&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){var d=!1;cc.SkewTo.prototype.initWithDuration.call(this,a,b,c)&&(this._skewX=b,this._skewY=c,d=!0);return d},clone:function(){var a=new cc.SkewBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._skewX,this._skewY);return a},startWithTarget:function(a){cc.SkewTo.prototype.startWithTarget.call(this,a);this._deltaX=this._skewX; this._deltaY=this._skewY;this._endSkewX=this._startSkewX+this._deltaX;this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var a=new cc.SkewBy(this._duration,-this._skewX,-this._skewY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.skewBy=function(a,b,c){return new cc.SkewBy(a,b,c)};cc.SkewBy.create=cc.skewBy; cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(a,b,c,d,e){cc.ActionInterval.prototype.ctor.call(this);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);this._delta=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0===e&&(e=d,d=c,c=b.y,b=b.x),this._delta.x=b,this._delta.y=c,this._height=d,this._jumps= e,!0):!1},clone:function(){var a=new cc.JumpBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._delta,this._height,this._jumps);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=a*this._jumps%1,b=4*this._height*b*(1-b),b=b+this._delta.y* a;a*=this._delta.x;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;a+=c.x;b+=c.y;f.x=a;f.y=b;this.target.setPosition(a,b)}else this.target.setPosition(c.x+a,c.y+b)}},reverse:function(){var a=new cc.JumpBy(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.jumpBy=function(a,b,c,d,e){return new cc.JumpBy(a,b,c,d,e)};cc.JumpBy.create=cc.jumpBy; cc.JumpTo=cc.JumpBy.extend({_endPosition:null,ctor:function(a,b,c,d,e){cc.JumpBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.JumpBy.prototype.initWithDuration.call(this,a,b,c,d,e)?(void 0===e&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},startWithTarget:function(a){cc.JumpBy.prototype.startWithTarget.call(this,a);this._delta.x=this._endPosition.x-this._startPosition.x;this._delta.y= this._endPosition.y-this._startPosition.y},clone:function(){var a=new cc.JumpTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition,this._height,this._jumps);return a}});cc.jumpTo=function(a,b,c,d,e){return new cc.JumpTo(a,b,c,d,e)};cc.JumpTo.create=cc.jumpTo;cc.bezierAt=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d}; cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._config=[];this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._config=b,!0):!1},clone:function(){var a=new cc.BezierBy;this._cloneDecoration(a);for(var b=[],c=0;cb/2}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._originalState=a.visible},stop:function(){this.target.visible=this._originalState;cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var a=new cc.Blink(this._duration,this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.blink=function(a,b){return new cc.Blink(a,b)};cc.Blink.create=cc.blink; cc.FadeTo=cc.ActionInterval.extend({_toOpacity:0,_fromOpacity:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toOpacity=b,!0):!1},clone:function(){var a=new cc.FadeTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},update:function(a){a=this._computeEaseTime(a);var b=void 0!==this._fromOpacity?this._fromOpacity: 255;this.target.opacity=b+(this._toOpacity-b)*a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._fromOpacity=a.opacity}});cc.fadeTo=function(a,b){return new cc.FadeTo(a,b)};cc.FadeTo.create=cc.fadeTo; cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,ctor:function(a){cc.FadeTo.prototype.ctor.call(this);a&&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);a&&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.color=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"cc.ReverseTime.initWithAction(): action must be non null";if(a==this._other)throw"cc.ReverseTime.initWithAction(): the action was already passed in.";return cc.ActionInterval.prototype.initWithDuration.call(this,a._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,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},initWithAnimation:function(a){if(!a)throw"cc.Animate.initWithAnimation(): animation must be non-NULL";var b=a.getDuration();if(this.initWithDuration(b*a.getLoops())){this._nextFrame= 0;this.setAnimation(a);this._origFrame=null;this._executedLoops=0;var c=this._splitTimes,d=c.length=0,e=b/a.getTotalDelayUnits();a=a.getFrames();cc.arrayVerifyType(a,cc.AnimationFrame);for(var f=0;fa&&(a*=this._animation.getLoops(),(0|a)>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),a%=1);for(var b=this._animation.getFrames(),c=b.length,d=this._splitTimes,e=this._nextFrame;eb?Math.PI-Math.asin(d/e):Math.asin(d/e);return{newRadius:c/cc.Camera.getZEye(),zenith:a,azimuth:b}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);a=this.sphericalRadius();isNaN(this._radius)&&(this._radius=a.newRadius);isNaN(this._angleZ)&&(this._angleZ=cc.radiansToDegrees(a.zenith));isNaN(this._angleX)&&(this._angleX=cc.radiansToDegrees(a.azimuth));this._radZ=cc.degreesToRadians(this._angleZ);this._radX=cc.degreesToRadians(this._angleX)},clone:function(){var a=new cc.OrbitCamera;a.initWithDuration(this._duration,this._radius,this._deltaRadius,this._angleZ,this._deltaAngleZ,this._angleX,this._deltaAngleX);return a},update:function(a){a= this._computeEaseTime(a);var b=(this._radius+this._deltaRadius*a)*cc.Camera.getZEye(),c=this._radZ+this._radDeltaZ*a,d=this._radX+this._radDeltaX*a;a=Math.sin(c)*Math.cos(d)*b+this._centerXOrig;d=Math.sin(c)*Math.sin(d)*b+this._centerYOrig;b=Math.cos(c)*b+this._centerZOrig;this.target.getCamera().setEye(a,d,b)}});cc.orbitCamera=function(a,b,c,d,e,f,g){return new cc.OrbitCamera(a,b,c,d,e,f,g)};cc.OrbitCamera.create=cc.orbitCamera;cc.ActionEase=cc.ActionInterval.extend({_inner:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw"cc.ActionEase.initWithAction(): action must be non nil";return this.initWithDuration(a.getDuration())?(this._inner=a,!0):!1},clone:function(){var a=new cc.ActionEase;a.initWithAction(this._inner.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._inner.startWithTarget(this.target)}, stop:function(){this._inner.stop();cc.ActionInterval.prototype.stop.call(this)},update:function(a){this._inner.update(a)},reverse:function(){return new cc.ActionEase(this._inner.reverse())},getInnerAction:function(){return this._inner}});cc.actionEase=function(a){return new cc.ActionEase(a)};cc.ActionEase.create=cc.actionEase; cc.EaseRateAction=cc.ActionEase.extend({_rate:0,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);void 0!==b&&this.initWithAction(a,b)},setRate:function(a){this._rate=a},getRate:function(){return this._rate},initWithAction:function(a,b){return cc.ActionEase.prototype.initWithAction.call(this,a)?(this._rate=b,!0):!1},clone:function(){var a=new cc.EaseRateAction;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseRateAction(this._inner.reverse(), 1/this._rate)}});cc.easeRateAction=function(a,b){return new cc.EaseRateAction(a,b)};cc.EaseRateAction.create=cc.easeRateAction;cc.EaseIn=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,this._rate))},reverse:function(){return new cc.EaseIn(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseIn;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseIn.create=function(a,b){return new cc.EaseIn(a,b)}; cc.easeIn=function(a){return{_rate:a,easing:function(a){return Math.pow(a,this._rate)},reverse:function(){return cc.easeIn(1/this._rate)}}};cc.EaseOut=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,1/this._rate))},reverse:function(){return new cc.EaseOut(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseOut;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseOut.create=function(a,b){return new cc.EaseOut(a,b)}; cc.easeOut=function(a){return{_rate:a,easing:function(a){return Math.pow(a,1/this._rate)},reverse:function(){return cc.easeOut(1/this._rate)}}};cc.EaseInOut=cc.EaseRateAction.extend({update:function(a){a*=2;1>a?this._inner.update(0.5*Math.pow(a,this._rate)):this._inner.update(1-0.5*Math.pow(2-a,this._rate))},clone:function(){var a=new cc.EaseInOut;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return new cc.EaseInOut(this._inner.reverse(),this._rate)}}); cc.EaseInOut.create=function(a,b){return new cc.EaseInOut(a,b)};cc.easeInOut=function(a){return{_rate:a,easing:function(a){a*=2;return 1>a?0.5*Math.pow(a,this._rate):1-0.5*Math.pow(2-a,this._rate)},reverse:function(){return cc.easeInOut(this._rate)}}}; cc.EaseExponentialIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a?0:Math.pow(2,10*(a-1)))},reverse:function(){return new cc.EaseExponentialOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialIn;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialIn.create=function(a){return new cc.EaseExponentialIn(a)};cc._easeExponentialInObj={easing:function(a){return 0===a?0:Math.pow(2,10*(a-1))},reverse:function(){return cc._easeExponentialOutObj}}; cc.easeExponentialIn=function(){return cc._easeExponentialInObj};cc.EaseExponentialOut=cc.ActionEase.extend({update:function(a){this._inner.update(1==a?1:-Math.pow(2,-10*a)+1)},reverse:function(){return new cc.EaseExponentialIn(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialOut.create=function(a){return new cc.EaseExponentialOut(a)}; cc._easeExponentialOutObj={easing:function(a){return 1==a?1:-Math.pow(2,-10*a)+1},reverse:function(){return cc._easeExponentialInObj}};cc.easeExponentialOut=function(){return cc._easeExponentialOutObj}; cc.EaseExponentialInOut=cc.ActionEase.extend({update:function(a){1!=a&&0!==a&&(a*=2,a=1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2));this._inner.update(a)},reverse:function(){return new cc.EaseExponentialInOut(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialInOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialInOut.create=function(a){return new cc.EaseExponentialInOut(a)}; cc._easeExponentialInOutObj={easing:function(a){return 1!==a&&0!==a?(a*=2,1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)):a},reverse:function(){return cc._easeExponentialInOutObj}};cc.easeExponentialInOut=function(){return cc._easeExponentialInOutObj}; cc.EaseSineIn=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1;this._inner.update(a)},reverse:function(){return new cc.EaseSineOut(this._inner.reverse())},clone:function(){var a=new cc.EaseSineIn;a.initWithAction(this._inner.clone());return a}});cc.EaseSineIn.create=function(a){return new cc.EaseSineIn(a)};cc._easeSineInObj={easing:function(a){return 0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1},reverse:function(){return cc._easeSineOutObj}};cc.easeSineIn=function(){return cc._easeSineInObj}; cc.EaseSineOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:Math.sin(a*Math.PI/2);this._inner.update(a)},reverse:function(){return new cc.EaseSineIn(this._inner.reverse())},clone:function(){var a=new cc.EaseSineOut;a.initWithAction(this._inner.clone());return a}});cc.EaseSineOut.create=function(a){return new cc.EaseSineOut(a)};cc._easeSineOutObj={easing:function(a){return 0===a||1==a?a:Math.sin(a*Math.PI/2)},reverse:function(){return cc._easeSineInObj}};cc.easeSineOut=function(){return cc._easeSineOutObj}; cc.EaseSineInOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1);this._inner.update(a)},clone:function(){var a=new cc.EaseSineInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseSineInOut(this._inner.reverse())}});cc.EaseSineInOut.create=function(a){return new cc.EaseSineInOut(a)};cc._easeSineInOutObj={easing:function(a){return 0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1)},reverse:function(){return cc._easeSineInOutObj}}; cc.easeSineInOut=function(){return cc._easeSineInOutObj}; cc.EaseElastic=cc.ActionEase.extend({_period:0.3,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);a&&this.initWithAction(a,b)},getPeriod:function(){return this._period},setPeriod:function(a){this._period=a},initWithAction:function(a,b){cc.ActionEase.prototype.initWithAction.call(this,a);this._period=null==b?0.3:b;return!0},reverse:function(){cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");return null},clone:function(){var a=new cc.EaseElastic;a.initWithAction(this._inner.clone(), this._period);return a}});cc.EaseElastic.create=function(a,b){return new cc.EaseElastic(a,b)};cc.EaseElasticIn=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,a-=1,b=-Math.pow(2,10*a)*Math.sin((a-b)*Math.PI*2/this._period));this._inner.update(b)},reverse:function(){return new cc.EaseElasticOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticIn;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticIn.create=function(a,b){return new cc.EaseElasticIn(a,b)};cc._easeElasticInObj={easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)},reverse:function(){return cc._easeElasticOutObj}};cc.easeElasticIn=function(a){return a&&0.3!==a?{_period:a,easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin((a-this._period/4)*Math.PI*2/this._period)},reverse:function(){return cc.easeElasticOut(this._period)}}:cc._easeElasticInObj}; cc.EaseElasticOut=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1==a?b=a:(b=this._period/4,b=Math.pow(2,-10*a)*Math.sin((a-b)*Math.PI*2/this._period)+1);this._inner.update(b)},reverse:function(){return new cc.EaseElasticIn(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticOut;a.initWithAction(this._inner.clone(),this._period);return a}});cc.EaseElasticOut.create=function(a,b){return new cc.EaseElasticOut(a,b)}; cc._easeElasticOutObj={easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-0.075)*Math.PI*2/0.3)+1},reverse:function(){return cc._easeElasticInObj}};cc.easeElasticOut=function(a){return a&&0.3!==a?{_period:a,easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin((a-this._period/4)*Math.PI*2/this._period)+1},reverse:function(){return cc.easeElasticIn(this._period)}}:cc._easeElasticOutObj}; cc.EaseElasticInOut=cc.EaseElastic.extend({update:function(a){var b=0,b=this._period;if(0===a||1==a)b=a;else{b||(b=this._period=0.3*1.5);var c=b/4;a=2*a-1;b=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-c)*Math.PI*2/b):Math.pow(2,-10*a)*Math.sin((a-c)*Math.PI*2/b)*0.5+1}this._inner.update(b)},reverse:function(){return new cc.EaseElasticInOut(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticInOut;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticInOut.create=function(a,b){return new cc.EaseElasticInOut(a,b)};cc.easeElasticInOut=function(a){return{_period:a||0.3,easing:function(a){var c=0,c=this._period;if(0===a||1===a)c=a;else{c||(c=this._period=0.3*1.5);var d=c/4;a=2*a-1;c=0>a?-0.5*Math.pow(2,10*a)*Math.sin((a-d)*Math.PI*2/c):Math.pow(2,-10*a)*Math.sin((a-d)*Math.PI*2/c)*0.5+1}return c},reverse:function(){return cc.easeElasticInOut(this._period)}}}; cc.EaseBounce=cc.ActionEase.extend({bounceTime:function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375},clone:function(){var a=new cc.EaseBounce;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounce(this._inner.reverse())}});cc.EaseBounce.create=function(a){return new cc.EaseBounce(a)}; cc.EaseBounceIn=cc.EaseBounce.extend({update:function(a){a=1-this.bounceTime(1-a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceIn;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceIn.create=function(a){return new cc.EaseBounceIn(a)}; cc._bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};cc._easeBounceInObj={easing:function(a){return 1-cc._bounceTime(1-a)},reverse:function(){return cc._easeBounceOutObj}};cc.easeBounceIn=function(){return cc._easeBounceInObj}; cc.EaseBounceOut=cc.EaseBounce.extend({update:function(a){a=this.bounceTime(a);this._inner.update(a)},reverse:function(){return new cc.EaseBounceIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceOut.create=function(a){return new cc.EaseBounceOut(a)};cc._easeBounceOutObj={easing:function(a){return cc._bounceTime(a)},reverse:function(){return cc._easeBounceInObj}};cc.easeBounceOut=function(){return cc._easeBounceOutObj}; cc.EaseBounceInOut=cc.EaseBounce.extend({update:function(a){var b=0,b=0.5>a?0.5*(1-this.bounceTime(1-2*a)):0.5*this.bounceTime(2*a-1)+0.5;this._inner.update(b)},clone:function(){var a=new cc.EaseBounceInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBounceInOut(this._inner.reverse())}});cc.EaseBounceInOut.create=function(a){return new cc.EaseBounceInOut(a)}; cc._easeBounceInOutObj={easing:function(a){return a=0.5>a?0.5*(1-cc._bounceTime(1-2*a)):0.5*cc._bounceTime(2*a-1)+0.5},reverse:function(){return cc._easeBounceInOutObj}};cc.easeBounceInOut=function(){return cc._easeBounceInOutObj};cc.EaseBackIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a||1==a?a:a*a*(2.70158*a-1.70158))},reverse:function(){return new cc.EaseBackOut(this._inner.reverse())},clone:function(){var a=new cc.EaseBackIn;a.initWithAction(this._inner.clone());return a}}); cc.EaseBackIn.create=function(a){return new cc.EaseBackIn(a)};cc._easeBackInObj={easing:function(a){return 0===a||1===a?a:a*a*(2.70158*a-1.70158)},reverse:function(){return cc._easeBackOutObj}};cc.easeBackIn=function(){return cc._easeBackInObj}; cc.EaseBackOut=cc.ActionEase.extend({update:function(a){a-=1;this._inner.update(a*a*(2.70158*a+1.70158)+1)},reverse:function(){return new cc.EaseBackIn(this._inner.reverse())},clone:function(){var a=new cc.EaseBackOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBackOut.create=function(a){return new cc.EaseBackOut(a)};cc._easeBackOutObj={easing:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},reverse:function(){return cc._easeBackInObj}};cc.easeBackOut=function(){return cc._easeBackOutObj}; cc.EaseBackInOut=cc.ActionEase.extend({update:function(a){a*=2;1>a?this._inner.update(a*a*(3.5949095*a-2.5949095)/2):(a-=2,this._inner.update(a*a*(3.5949095*a+2.5949095)/2+1))},clone:function(){var a=new cc.EaseBackInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseBackInOut(this._inner.reverse())}});cc.EaseBackInOut.create=function(a){return new cc.EaseBackInOut(a)}; cc._easeBackInOutObj={easing:function(a){a*=2;if(1>a)return a*a*(3.5949095*a-2.5949095)/2;a-=2;return a*a*(3.5949095*a+2.5949095)/2+1},reverse:function(){return cc._easeBackInOutObj}};cc.easeBackInOut=function(){return cc._easeBackInOutObj}; cc.EaseBezierAction=cc.ActionEase.extend({_p0:null,_p1:null,_p2:null,_p3:null,ctor:function(a){cc.ActionEase.prototype.ctor.call(this,a)},_updateTime:function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d},update:function(a){a=this._updateTime(this._p0,this._p1,this._p2,this._p3,a);this._inner.update(a)},clone:function(){var a=new cc.EaseBezierAction;a.initWithAction(this._inner.clone());a.setBezierParamer(this._p0,this._p1,this._p2,this._p3);return a}, reverse:function(){var a=new cc.EaseBezierAction(this._inner.reverse());a.setBezierParamer(this._p3,this._p2,this._p1,this._p0);return a},setBezierParamer:function(a,b,c,d){this._p0=a||0;this._p1=b||0;this._p2=c||0;this._p3=d||0}});cc.EaseBezierAction.create=function(a){return new cc.EaseBezierAction(a)};cc.easeBezierAction=function(a,b,c,d){return{easing:function(e){return cc.EaseBezierAction.prototype._updateTime(a,b,c,d,e)},reverse:function(){return cc.easeBezierAction(d,c,b,a)}}}; cc.EaseQuadraticActionIn=cc.ActionEase.extend({_updateTime:function(a){return Math.pow(a,2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionIn(this._inner.reverse())}});cc.EaseQuadraticActionIn.create=function(a){return new cc.EaseQuadraticActionIn(a)};cc._easeQuadraticActionIn={easing:cc.EaseQuadraticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionIn}}; cc.easeQuadraticActionIn=function(){return cc._easeQuadraticActionIn};cc.EaseQuadraticActionOut=cc.ActionEase.extend({_updateTime:function(a){return-a*(a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionOut;a.initWithAction();return a},reverse:function(){return new cc.EaseQuadraticActionOut(this._inner.reverse())}});cc.EaseQuadraticActionOut.create=function(a){return new cc.EaseQuadraticActionOut(a)}; cc._easeQuadraticActionOut={easing:cc.EaseQuadraticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionOut}};cc.easeQuadraticActionOut=function(){return cc._easeQuadraticActionOut}; cc.EaseQuadraticActionInOut=cc.ActionEase.extend({_updateTime:function(a){var b=a;a*=2;1>a?b=a*a*0.5:(--a,b=-0.5*(a*(a-2)-1));return b},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuadraticActionInOut(this._inner.reverse())}});cc.EaseQuadraticActionInOut.create=function(a){return new cc.EaseQuadraticActionInOut(a)}; cc._easeQuadraticActionInOut={easing:cc.EaseQuadraticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionInOut}};cc.easeQuadraticActionInOut=function(){return cc._easeQuadraticActionInOut};cc.EaseQuarticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionIn(this._inner.reverse())}}); cc.EaseQuarticActionIn.create=function(a){return new cc.EaseQuarticActionIn(a)};cc._easeQuarticActionIn={easing:cc.EaseQuarticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuarticActionIn}};cc.easeQuarticActionIn=function(){return cc._easeQuarticActionIn}; cc.EaseQuarticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return-(a*a*a*a-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionOut(this._inner.reverse())}});cc.EaseQuarticActionOut.create=function(a){return new cc.EaseQuarticActionOut(a)};cc._easeQuarticActionOut={easing:cc.EaseQuarticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionOut}}; cc.easeQuarticActionOut=function(){return cc._easeQuarticActionOut};cc.EaseQuarticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a;a-=2;return-0.5*(a*a*a*a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuarticActionInOut(this._inner.reverse())}});cc.EaseQuarticActionInOut.create=function(a){return new cc.EaseQuarticActionInOut(a)}; cc._easeQuarticActionInOut={easing:cc.EaseQuarticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionInOut}};cc.easeQuarticActionInOut=function(){return cc._easeQuarticActionInOut};cc.EaseQuinticActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionIn(this._inner.reverse())}}); cc.EaseQuinticActionIn.create=function(a){return new cc.EaseQuinticActionIn(a)};cc._easeQuinticActionIn={easing:cc.EaseQuinticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuinticActionIn}};cc.easeQuinticActionIn=function(){return cc._easeQuinticActionIn}; cc.EaseQuinticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionOut(this._inner.reverse())}});cc.EaseQuinticActionOut.create=function(a){return new cc.EaseQuinticActionOut(a)};cc._easeQuinticActionOut={easing:cc.EaseQuinticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionOut}}; cc.easeQuinticActionOut=function(){return cc._easeQuinticActionOut};cc.EaseQuinticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a*a;a-=2;return 0.5*(a*a*a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseQuinticActionInOut(this._inner.reverse())}});cc.EaseQuinticActionInOut.create=function(a){return new cc.EaseQuinticActionInOut(a)}; cc._easeQuinticActionInOut={easing:cc.EaseQuinticActionInOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionInOut}};cc.easeQuinticActionInOut=function(){return cc._easeQuinticActionInOut};cc.EaseCircleActionIn=cc.ActionEase.extend({_updateTime:function(a){return-1*(Math.sqrt(1-a*a)-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionIn(this._inner.reverse())}}); cc.EaseCircleActionIn.create=function(a){return new cc.EaseCircleActionIn(a)};cc._easeCircleActionIn={easing:cc.EaseCircleActionIn.prototype._updateTime,reverse:function(){return cc._easeCircleActionIn}};cc.easeCircleActionIn=function(){return cc._easeCircleActionIn}; cc.EaseCircleActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return Math.sqrt(1-a*a)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionOut(this._inner.reverse())}});cc.EaseCircleActionOut.create=function(a){return new cc.EaseCircleActionOut(a)};cc._easeCircleActionOut={easing:cc.EaseCircleActionOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionOut}}; cc.easeCircleActionOut=function(){return cc._easeCircleActionOut};cc.EaseCircleActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return-0.5*(Math.sqrt(1-a*a)-1);a-=2;return 0.5*(Math.sqrt(1-a*a)+1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCircleActionInOut(this._inner.reverse())}});cc.EaseCircleActionInOut.create=function(a){return new cc.EaseCircleActionInOut(a)}; cc._easeCircleActionInOut={easing:cc.EaseCircleActionInOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionInOut}};cc.easeCircleActionInOut=function(){return cc._easeCircleActionInOut};cc.EaseCubicActionIn=cc.ActionEase.extend({_updateTime:function(a){return a*a*a},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionIn;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionIn(this._inner.reverse())}}); cc.EaseCubicActionIn.create=function(a){return new cc.EaseCubicActionIn(a)};cc._easeCubicActionIn={easing:cc.EaseCubicActionIn.prototype._updateTime,reverse:function(){return cc._easeCubicActionIn}};cc.easeCubicActionIn=function(){return cc._easeCubicActionIn}; cc.EaseCubicActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionOut(this._inner.reverse())}});cc.EaseCubicActionOut.create=function(a){return new cc.EaseCubicActionOut(a)};cc._easeCubicActionOut={easing:cc.EaseCubicActionOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionOut}}; cc.easeCubicActionOut=function(){return cc._easeCubicActionOut};cc.EaseCubicActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a;a-=2;return 0.5*(a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionInOut(this._inner.reverse())}});cc.EaseCubicActionInOut.create=function(a){return new cc.EaseCubicActionInOut(a)}; cc._easeCubicActionInOut={easing:cc.EaseCubicActionInOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionInOut}};cc.easeCubicActionInOut=function(){return cc._easeCubicActionInOut};cc.cardinalSplineAt=function(a,b,c,d,e,f){var g=f*f,h=g*f,k=(1-e)/2;e=k*(-h+2*g-f);var m=k*(-h+g)+(2*h-3*g+1);f=k*(h-2*g+f)+(-2*h+3*g);g=k*(h-g);return cc.p(a.x*e+b.x*m+c.x*f+d.x*g,a.y*e+b.y*m+c.y*f+d.y*g)};cc.reverseControlPoints=function(a){for(var b=[],c=a.length-1;0<=c;c--)b.push(cc.p(a[c].x,a[c].y));return b};cc.cloneControlPoints=function(a){for(var b=[],c=0;cg?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(h=cc.p(0,0),k=cc.p(0,1),e=cc.p(1,0),d=cc.p(1,1),f=g);b.x=f-f*c;b.z=Math.abs(parseFloat(f*a/4));a=this.originalVertex(e);a.x=b.x;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.x=b.x;a.z+=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.x-=b.x;a.z-=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.x-=b.x;a.z-=b.z;this.setVertex(k, a)}});cc.flipX3D=function(a){return new cc.FlipX3D(a)};cc.FlipX3D.create=cc.flipX3D; cc.FlipY3D=cc.FlipX3D.extend({ctor:function(a){void 0!==a?cc.GridAction.prototype.ctor.call(this,a,cc.size(1,1)):cc.GridAction.prototype.ctor.call(this)},update:function(a){var b=Math.PI*a;a=Math.sin(b);var c=Math.cos(b/2),b=new cc.Vertex3F,d=cc.p(0,0);d.x=d.y=1;var e=this.originalVertex(d);d.x=d.y=0;var d=this.originalVertex(d),f=e.y,g=d.y,h,k;f>g?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(d=cc.p(0,0),e=cc.p(0,1),k=cc.p(1,0),h=cc.p(1,1),f=g);b.y=f-f*c;b.z=Math.abs(parseFloat(f*a)/4);a=this.originalVertex(e); a.y=b.y;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.y-=b.y;a.z-=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.y=b.y;a.z+=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.y-=b.y;a.z-=b.z;this.setVertex(k,a)}});cc.flipY3D=function(a){return new cc.FlipY3D(a)};cc.FlipY3D.create=cc.flipY3D; cc.Lens3D=cc.Grid3DAction.extend({_position:null,_radius:0,_lensEffect:0,_concave:!1,_dirty:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},getLensEffect:function(){return this._lensEffect},setLensEffect:function(a){this._lensEffect=a},setConcave:function(a){this._concave=a},getPosition:function(){return this._position},setPosition:function(a){cc.pointEqualToPoint(a,this._position)||(this._position.x=a.x,this._position.y= a.y,this._dirty=!0)},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._radius=d,this._lensEffect=0.7,this._dirty=!0):!1},update:function(a){if(this._dirty){a=this._gridSize.width;for(var b=this._gridSize.height,c=this._radius,d=this._lensEffect,e=cc.p(0,0),f=cc.p(0,0),g,h,k,m=0;me?this.transformTile(c,e):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){return 0==a.width+a.height?1:Math.pow((this._gridSize.width*(1-b)+this._gridSize.height*(1-b))/(a.width+a.height),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 0==c?1:Math.pow(a.height/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){return 0==a.height?1:Math.pow(this._gridSize.height*(1-b)/a.height,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;bh.z&&(h.z=0.5);this.setVertex(e,h)}}}); 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",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._updateProgress())},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},isReverseDirection:function(){return this._reverseDirection},_boundaryTexCoord:function(a){if(a>7-(a<<1)&1,b>>7- ((a<<1)+1)&1):cc.p(b>>(a<<1)+1&1,b>>(a<<1)&1)}return cc.p(0,0)},_origin:null,_startAngle:270,_endAngle:270,_radius:0,_counterClockWise:!1,_barRect:null,_vertexDataCount:0,_vertexData:null,_vertexArrayBuffer:null,_vertexWebGLBuffer:null,_vertexDataDirty:!1,ctor:null,_ctorForCanvas:function(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;this._origin=cc.p(0, 0);this._endAngle=this._startAngle=270;this._radius=0;this._counterClockWise=!1;this._barRect=cc.rect(0,0,0,0);a&&this._initWithSpriteForCanvas(a)},_ctorForWebGL: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;this._vertexWebGLBuffer=cc._renderContext.createBuffer();this._vertexDataCount=0;this._vertexArrayBuffer=this._vertexData=null;this._vertexDataDirty= !1;a&&this._initWithSpriteForWebGL(a)},setColor:function(a){this._sprite.color=a;this._updateColor()},setOpacity:function(a){this._sprite.opacity=a;this._updateColor()},getColor:function(){return this._sprite.color},getOpacity:function(){return this._sprite.opacity},setReverseProgress:null,_setReverseProgressForCanvas:function(a){this._reverseDirection!==a&&(this._reverseDirection=a)},_setReverseProgressForWebGL:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._vertexArrayBuffer= this._vertexData=null,this._vertexDataCount=0)},setSprite:null,_setSpriteForCanvas:function(a){this._sprite!=a&&(this._sprite=a,this.width=this._sprite.width,this.height=this._sprite.height)},_setSpriteForWebGL:function(a){a&&this._sprite!=a&&(this._sprite=a,this.width=a.width,this.height=a.height,this._vertexData&&(this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0))},setType:null,_setTypeForCanvas:function(a){a!==this._type&&(this._type=a)},_setTypeForWebGL:function(a){a!==this._type&& (this._vertexData&&(this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0),this._type=a)},setReverseDirection:null,_setReverseDirectionForCanvas:function(a){this._reverseDirection!==a&&(this._reverseDirection=a)},_setReverseDirectionForWebGL:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0)},_textureCoordFromAlphaPoint:function(a){var b=this._sprite;if(!b)return{u:0,v:0};var c=b.quad,d=cc.p(c.bl.texCoords.u, c.bl.texCoords.v),c=cc.p(c.tr.texCoords.u,c.tr.texCoords.v);b.textureRectRotated&&(b=a.x,a.x=a.y,a.y=b);return{u:d.x*(1-a.x)+c.x*a.x,v:d.y*(1-a.y)+c.y*a.y}},_vertexFromAlphaPoint:function(a){if(!this._sprite)return{x:0,y:0};var b=this._sprite.quad,c=cc.p(b.bl.vertices.x,b.bl.vertices.y),b=cc.p(b.tr.vertices.x,b.tr.vertices.y);return{x:c.x*(1-a.x)+b.x*a.x,y:c.y*(1-a.y)+b.y*a.y}},initWithSprite:null,_initWithSpriteForCanvas:function(a){this.percentage=0;this.anchorY=this.anchorX=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.sprite=a;return!0},_initWithSpriteForWebGL:function(a){this.percentage=0;this._vertexArrayBuffer=this._vertexData=null;this._vertexDataCount=0;this.anchorY=this.anchorX=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.sprite=a;this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR);return!0},draw:null,_drawForCanvas:function(a){a= a||cc._renderContext;var b=this._sprite;"source"!=b._blendFuncStr&&(a.globalCompositeOperation=b._blendFuncStr);var c=cc.view.getScaleX(),d=cc.view.getScaleY();a.globalAlpha=b._displayedOpacity/255;var e=b._rect,f=b._contentSize,g=b._offsetPosition,h=b._drawSize_Canvas,k=0|g.x,m=-g.y-e.height,n=b._textureRect_Canvas;h.width=e.width*c;h.height=e.height*d;a.save();b._flippedX&&(k=-g.x-e.width,a.scale(-1,1));b._flippedY&&(m=g.y,a.scale(1,-1));k*=c;m*=d;this._type==cc.ProgressTimer.TYPE_BAR?(e=this._barRect, a.beginPath(),a.rect(e.x*c,e.y*d,e.width*c,e.height*d),a.clip(),a.closePath()):this._type==cc.ProgressTimer.TYPE_RADIAL&&(e=this._origin.x*c,g=this._origin.y*d,a.beginPath(),a.arc(e,g,this._radius*d,Math.PI/180*this._startAngle,Math.PI/180*this._endAngle,this._counterClockWise),a.lineTo(e,g),a.clip(),a.closePath());b._texture&&n.validRect?(c=b._texture.getHtmlElementObj(),b._colorized?a.drawImage(c,0,0,n.width,n.height,k,m,h.width,h.height):a.drawImage(c,n.x,n.y,n.width,n.height,k,m,h.width,h.height)): 0!==f.width&&(b=this.color,a.fillStyle="rgba("+b.r+","+b.g+","+b.b+",1)",a.fillRect(k,m,f.width*c,f.height*d));a.restore();cc.incrementGLDraws(1)},_drawForWebGL:function(a){a=a||cc._renderContext;if(this._vertexData&&this._sprite){cc.nodeDrawSetup(this);var b=this._sprite.getBlendFunc();cc.glBlendFunc(b.src,b.dst);cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);cc.glBindTexture2D(this._sprite.texture);a.bindBuffer(a.ARRAY_BUFFER,this._vertexWebGLBuffer);this._vertexDataDirty&&(a.bufferData(a.ARRAY_BUFFER, this._vertexArrayBuffer,a.DYNAMIC_DRAW),this._vertexDataDirty=!1);b=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,b,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,b,8);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,b,12);this._type===cc.ProgressTimer.TYPE_RADIAL?a.drawArrays(a.TRIANGLE_FAN,0,this._vertexDataCount):this._type==cc.ProgressTimer.TYPE_BAR&&(this._reverseDirection?(a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount/ 2),a.drawArrays(a.TRIANGLE_STRIP,4,this._vertexDataCount/2),cc.g_NumberOfDraws++):a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount));cc.g_NumberOfDraws++}},_updateRadial:function(){if(this._sprite){var a,b=this._midPoint;a=this._percentage/100;var c=2*cc.PI*(this._reverseDirection?a:1-a),d=cc.p(b.x,1),e=cc.pRotateByAngle(d,b,c),c=0;if(0==a)e=d,c=0;else if(1==a)e=d,c=4;else{var f=cc.FLT_MAX,g=cc.ProgressTimer.TEXTURE_COORDS_COUNT;for(a=0;a<=g;++a){var h=(a+(g-1))%g,k=this._boundaryTexCoord(a% g),h=this._boundaryTexCoord(h);0==a?h=cc.pLerp(k,h,1-b.x):4==a&&(k=cc.pLerp(k,h,1-b.x));var m=cc.p(0,0);cc.pLineIntersect(k,h,b,e,m)&&(0!=a&&4!=a||0<=m.x&&1>=m.x)&&0<=m.y&&m.yb.x&&(c.x+=-b.x,b.x=0);1b.y&&(c.y+=-b.y,b.y=0);1a;a++)e[a]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,a*d);e[0].texCoords=this._textureCoordFromAlphaPoint(cc.p(0,1));e[0].vertices=this._vertexFromAlphaPoint(cc.p(0,1));e[1].texCoords=this._textureCoordFromAlphaPoint(cc.p(0,0));e[1].vertices=this._vertexFromAlphaPoint(cc.p(0,0));e[6].texCoords=this._textureCoordFromAlphaPoint(cc.p(1,1));e[6].vertices=this._vertexFromAlphaPoint(cc.p(1, 1));e[7].texCoords=this._textureCoordFromAlphaPoint(cc.p(1,0));e[7].vertices=this._vertexFromAlphaPoint(cc.p(1,0));this._vertexData=e}a=this._vertexData;a[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x,c.y));a[2].vertices=this._vertexFromAlphaPoint(cc.p(b.x,c.y));a[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x,b.y));a[3].vertices=this._vertexFromAlphaPoint(cc.p(b.x,b.y));a[4].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,c.y));a[4].vertices=this._vertexFromAlphaPoint(cc.p(c.x, c.y));a[5].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,b.y));a[5].vertices=this._vertexFromAlphaPoint(cc.p(c.x,b.y))}else{if(!this._vertexData)for(this._vertexDataCount=4,d=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT,this._vertexArrayBuffer=new ArrayBuffer(4*d),this._vertexData=[],a=0;4>a;a++)this._vertexData[a]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,a*d);a=this._vertexData;a[0].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x,c.y));a[0].vertices=this._vertexFromAlphaPoint(cc.p(b.x, c.y));a[1].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x,b.y));a[1].vertices=this._vertexFromAlphaPoint(cc.p(b.x,b.y));a[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,c.y));a[2].vertices=this._vertexFromAlphaPoint(cc.p(c.x,c.y));a[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,b.y));a[3].vertices=this._vertexFromAlphaPoint(cc.p(c.x,b.y))}this._updateColor()}},_updateColor:function(){if(this._sprite&&this._vertexData){for(var a=this._sprite.quad.tl.colors,b=this._vertexData, c=0,d=this._vertexDataCount;c=b-h.x&&(e=b-g.width);b=h.y-g.height/2;0.5=c-h.y&&(b=c-g.height);f.x=0;c=1;a._flippedX&&(f.x-=g.width,c=-1);0a.height?(a=16,b=12):(a=12,b=16);a=this.actionWithSize(cc.size(a,b));this._back?(this._inScene.visible=!1,this._inScene.runAction(cc.sequence(cc.show(),a,cc.callFunc(this.finish,this),cc.stopGrid()))):this._outScene.runAction(cc.sequence(a,cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))},_sceneOrder:function(){this._isInSceneOnTop=this._back}});cc.TransitionPageTurn.create=function(a,b,c){return new cc.TransitionPageTurn(a,b,c)};cc.Codec={name:"Jacob__Codec"};cc.unzip=function(){return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,arguments)};cc.unzipBase64=function(){var a=cc.Codec.Base64.decode.apply(cc.Codec.Base64,arguments);return cc.Codec.GZip.gunzip.apply(cc.Codec.GZip,[a])};cc.unzipBase64AsArray=function(a,b){b=b||1;var c=this.unzipBase64(a),d=[],e,f,g;e=0;for(g=c.length/b;e>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,b.push(String.fromCharCode(c)),64!=f&&b.push(String.fromCharCode(d)),64!=g&&b.push(String.fromCharCode(e));return b=b.join("")}; cc.Codec.Base64.decodeAsArray=function(a,b){var c=this.decode(a),d=[],e,f,g;e=0;for(g=c.length/b;e>=1;0==this.bb&&(this.bb=this.readByte(),a=this.bb&1,this.bb=this.bb>>1|128);return a}; cc.Codec.GZip.prototype.readBits=function(a){for(var b=0,c=a;c--;)b=b<<1|this.readBit();a&&(b=cc.Codec.GZip.bitReverse[b]>>8-a);return b};cc.Codec.GZip.prototype.flushBuffer=function(){this.bIdx=0};cc.Codec.GZip.prototype.addBuffer=function(a){this.buf32k[this.bIdx++]=a;this.outputArr.push(String.fromCharCode(a));32768==this.bIdx&&(this.bIdx=0)}; cc.Codec.GZip.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]==this.len)return this.fpos[this.len]++;this.fpos[this.len]++}}; cc.Codec.GZip.prototype.Rec=function(){var a=this.Places[this.treepos],b;if(17==this.len)return-1;this.treepos++;this.len++;b=this.IsPat();if(0<=b)a.b0=b;else if(a.b0=32768,this.Rec())return-1;b=this.IsPat();if(0<=b)a.b1=b,a.jump=null;else if(a.b1=32768,a.jump=this.Places[this.treepos],a.jumppos=this.treepos,this.Rec())return-1;this.len--;return 0}; cc.Codec.GZip.prototype.CreateTree=function(a,b,c,d){this.Places=a;this.treepos=0;this.flens=c;this.fmax=b;for(a=0;17>a;a++)this.fpos[a]=0;this.len=0;return this.Rec()?-1:0};cc.Codec.GZip.prototype.DecodeValue=function(a){for(var b,c,d=0,e=a[d];;)if(b=this.readBit()){if(!(e.b1&32768))return e.b1;e=e.jump;b=a.length;for(c=0;c>1,23c)this.addBuffer(c); else if(256==c)break;else{var f;c-=257;e=this.readBits(cc.Codec.GZip.cplext[c])+cc.Codec.GZip.cplens[c];c=cc.Codec.GZip.bitReverse[this.readBits(5)]>>3;8c;c++)g[c]=0; for(c=0;cc)g[d++]=c;else if(16==c){var k;c=3+this.readBits(2);if(d+c>e)return this.flushBuffer(),1;for(k=d?g[d-1]:0;c--;)g[d++]=k}else{c=17==c?3+this.readBits(3):11+this.readBits(7);if(d+c>e)return this.flushBuffer(), 1;for(;c--;)g[d++]=0}e=this.literalTree.length;for(d=0;d>>0}b=1;c=0;for(var d=a.length,e,f=0;0>>0}function d(b,c){this.index="number"===typeof c?c:0; this.i=0;this.buffer=b instanceof(x?Uint8Array:Array)?b:new (x?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 (x?Uint16Array:Array)(2*a);this.length=0}function f(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,h,k,m,n,q,r;for(q=0;qc&&(c=a[q]),a[q]>=1;for(r=m;r=b:return[265,b-11,1];case 14>=b:return[266,b-13,1];case 16>=b:return[267,b-15,1];case 18>=b:return[268,b-17,1];case 22>=b:return[269,b-19,2];case 26>=b:return[270,b-23,2];case 30>=b:return[271,b-27,2];case 34>=b:return[272,b-31,2];case 42>=b:return[273,b-35,3];case 50>= b:return[274,b-43,3];case 58>=b:return[275,b-51,3];case 66>=b:return[276,b-59,3];case 82>=b:return[277,b-67,4];case 98>=b:return[278,b-83,4];case 114>=b:return[279,b-99,4];case 130>=b:return[280,b-115,4];case 162>=b:return[281,b-131,5];case 194>=b:return[282,b-163,5];case 226>=b:return[283,b-195,5];case 257>=b:return[284,b-227,5];case 258===b:return[285,b-258,0];default:a("invalid length: "+b)}}function m(b,c){function d(b,c){var e=b.G,f=[],g=0,h;h=M[b.length];f[g++]=h&65535;f[g++]=h>>16&255;f[g++]= h>>24;var k;switch(E){case 1===e:k=[0,e-1,0];break;case 2===e:k=[1,e-2,0];break;case 3===e:k=[2,e-3,0];break;case 4===e:k=[3,e-4,0];break;case 6>=e:k=[4,e-5,1];break;case 8>=e:k=[5,e-7,1];break;case 12>=e:k=[6,e-9,2];break;case 16>=e:k=[7,e-13,2];break;case 24>=e:k=[8,e-17,3];break;case 32>=e:k=[9,e-25,3];break;case 48>=e:k=[10,e-33,4];break;case 64>=e:k=[11,e-49,4];break;case 96>=e:k=[12,e-65,5];break;case 128>=e:k=[13,e-97,5];break;case 192>=e:k=[14,e-129,6];break;case 256>=e:k=[15,e-193,6];break; case 384>=e:k=[16,e-257,7];break;case 512>=e:k=[17,e-385,7];break;case 768>=e:k=[18,e-513,8];break;case 1024>=e:k=[19,e-769,8];break;case 1536>=e:k=[20,e-1025,9];break;case 2048>=e:k=[21,e-1537,9];break;case 3072>=e:k=[22,e-2049,10];break;case 4096>=e:k=[23,e-3073,10];break;case 6144>=e:k=[24,e-4097,11];break;case 8192>=e:k=[25,e-6145,11];break;case 12288>=e:k=[26,e-8193,12];break;case 16384>=e:k=[27,e-12289,12];break;case 24576>=e:k=[28,e-16385,13];break;case 32768>=e:k=[29,e-24577,13];break;default:a("invalid distance")}h= k;f[g++]=h[0];f[g++]=h[1];f[g++]=h[2];e=0;for(g=f.length;e=g;)u[g++]=0;for(g=0;29>=g;)w[g++]=0}u[256]=1;e=0;for(f=c.length;e=f){q&&d(q,-1);g=0; for(k=f-e;gB&&e+Bz&&(m=k,z=B);if(258===B)break}k=new h(z,e-m);q?q.length2*k[v-1]+f[v]&&(k[v]=2*k[v-1]+f[v]),m[v]=Array(k[v]),r[v]=Array(k[v]);for(t=0;th[t]?(m[v][u]=w,r[v][u]=n,y+=2):(m[v][u]=h[t], r[v][u]=t,++t);s[v]=0;1===f[v]&&c(v)}h=q;k=0;for(m=d.length;k1<f&&a("undercommitted");g=0;for(h=b.length;g>>=1;return c}function s(a,b){this.input=a;this.a=new (x?Uint8Array:Array)(32768);this.h= I.j;var c={},d;!b&&(b={})||"number"!==typeof b.compressionType||(this.h=b.compressionType);for(d in b)c[d]=b[d];c.outputBuffer=this.a;this.z=new g(this.input,c)}function r(b,c){this.k=[];this.l=32768;this.e=this.g=this.c=this.q=0;this.input=x?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 N:this.b=32768;this.a=new (x?Uint8Array:Array)(32768+ this.l+258);break;case P:this.b=0;this.a=new (x?Uint8Array:Array)(this.l);this.f=this.J;this.t=this.H;this.o=this.I;break;default:a(Error("invalid inflate mode"))}}function t(b,c){for(var d=b.g,e=b.e,f=b.input,g=b.c,h;e>>c;b.e=e-c;b.c=g;return d&(1<>>16;b.g=d>>h;b.e= e-h;b.c=g;return f&65535}function y(a){function b(a,c,d){var e,f,g,h;for(h=0;h>>8&255]<<16|F[a>>>16&255]<<8|F[a>>>24&255])>>32-b:F[a]>>8-b);if(8>b+f)g=g<>b-c-1&1,8===++f&&(f=0,d[e++]=F[g],g=0,e===d.length&&(d=this.f())); d[e]=g;this.buffer=d;this.i=f;this.index=e};d.prototype.finish=function(){var a=this.buffer,b=this.index,c;0w;++w){for(var B=w,G=B,H=7,B=B>>>1;B;B>>>=1)G<<=1,G|=B&1,--H;z[w]=(G<>>0}var F=z,z=[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];x&&new Uint32Array(z);e.prototype.getParent=function(a){return 2*((a-2)/4|0)};e.prototype.push=function(a,b){var c,d,e=this.buffer,f;c=this.length;e[this.length++]=b;for(e[this.length++]=a;0e[d])f=e[c],e[c]=e[d],e[d]=f,f=e[c+1],e[c+1]=e[d+1],e[d+1]=f,c=d;else break;return this.length};e.prototype.pop=function(){var a,b,c=this.buffer,d,e,f;b=c[0];a=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f= 0;;){e=2*f+2;if(e>=this.length)break;e+2c[e]&&(e+=2);if(c[e]>c[f])d=c[f],c[f]=c[e],c[e]=d,d=c[f+1],c[f+1]=c[e+1],c[e+1]=d;else break;f=e}return{index:a,value:b,length:this.length}};var J=2,z={NONE:0,r:1,j:J,N:3},L=[];for(w=0;288>w;w++)switch(E){case 143>=w:L.push([w+48,8]);break;case 255>=w:L.push([w-144+400,9]);break;case 279>=w:L.push([w-256+0,7]);break;case 287>=w:L.push([w-280+192,8]);break;default:a("invalid literal: "+w)}g.prototype.n=function(){var b,c,e,f,g=this.input; switch(this.h){case 0:e=0;for(f=g.length;e>>8&255;s[t++]=r&255;s[t++]=r>>>8&255;if(x)s.set(c,t),t+=c.length,s=s.subarray(0,t);else{k=0;for(r=c.length;kA)for(;0A?A:138,H>A-3&&H=H?(I[G++]=17,I[G++]=H-3,z[17]++):(I[G++]=18,I[G++]=H-11,z[18]++),A-=H;else if(I[G++]= b[D],z[b[D]]++,A--,3>A)for(;0A?A:6,H>A-3&&HD;D++)k[D]=z[y[D]];for(w=19;4=K;K++)B=k(),w[K]=B[2]<<24|B[1]<<16|B[0];var M=x?new Uint32Array(w):w,I=z;s.prototype.n=function(){var b,d,e,f,g=0;f=this.a;b=O;switch(b){case O:d=Math.LOG2E*Math.log(32768)-8;break;default:a(Error("invalid compression method"))}d= d<<4|b;f[g++]=d;switch(b){case O:switch(this.h){case I.NONE:e=0;break;case I.r:e=1;break;case I.j:e=2;break;default:a(Error("unsupported compression type"))}break;default:a(Error("invalid compression method"))}b=e<<6|0;f[g++]=b|31-(256*d+b)%31;b=c(this.input);this.z.b=g;f=this.z.n();g=f.length;x&&(f=new Uint8Array(f.buffer),f.length<=g+4&&(this.a=new Uint8Array(f.length+4),this.a.set(f),f=this.a),f=f.subarray(0,g+4));f[g++]=b>>24&255;f[g++]=b>>16&255;f[g++]=b>>8&255;f[g++]=b&255;return f};b("Zlib.Deflate", s);b("Zlib.Deflate.compress",function(a,b){return(new s(a,b)).n()});b("Zlib.Deflate.CompressionType",I);b("Zlib.Deflate.CompressionType.NONE",I.NONE);b("Zlib.Deflate.CompressionType.FIXED",I.r);b("Zlib.Deflate.CompressionType.DYNAMIC",I.j);var N=0,P=1,z={D:N,C:P};r.prototype.p=function(){for(;!this.s;){var b=t(this,3);b&1&&(this.s=E);b>>>=1;switch(b){case 0:var b=this.input,c=this.c,d=this.a,e=this.b,f=C,g=C,h=C,k=d.length,f=C;this.e=this.g=0;f=b[c++];f===C&&a(Error("invalid uncompressed block header: LEN (first byte)")); g=f;f=b[c++];f===C&&a(Error("invalid uncompressed block header: LEN (second byte)"));g|=f<<8;f=b[c++];f===C&&a(Error("invalid uncompressed block header: NLEN (first byte)"));h=f;f=b[c++];f===C&&a(Error("invalid uncompressed block header: NLEN (second byte)"));h|=f<<8;g===~h&&a(Error("invalid uncompressed block header: length verify"));c+g>b.length&&a(Error("input buffer is broken"));switch(this.m){case N:for(;e+g>d.length;){f=k-e;g-=f;if(x)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+g>d.length;)d=this.f({v:2});break;default:a(Error("invalid inflate mode"))}if(x)d.set(b.subarray(c,c+g),e),e+=g,c+=g;else for(;g--;)d[e++]=b[c++];this.c=c;this.b=e;this.a=d;break;case 1:this.o(V,W);break;case 2:y(this);break;default:a(Error("unknown BTYPE: "+b))}}return this.t()};w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var S=x?new Uint16Array(w):w;w=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227, 258,258,258];var T=x?new Uint16Array(w):w;w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0];var Q=x?new Uint8Array(w):w;w=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];var U=x?new Uint16Array(w):w;w=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var R=x?new Uint8Array(w):w;w=new (x?Uint8Array:Array)(288);B=0;for(G=w.length;B=B?8:255>=B?9:279>=B?7:8;var V=f(w);w=new (x?Uint8Array: Array)(30);B=0;for(G=w.length;Bf)d>=e&&(this.b=d,c=this.f(),d=this.b),c[d++]=f;else for(f-=257,h=T[f],0=e&&(this.b=d,c=this.f(),d=this.b);h--;)c[d]=c[d++-g];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};r.prototype.I=function(a,b){var c=this.a,d=this.b;this.u=a;for(var e=c.length,f,g,h;256!== (f=u(this,a));)if(256>f)d>=e&&(c=this.f(),e=c.length),c[d++]=f;else for(f-=257,h=T[f],0e&&(c=this.f(),e=c.length);h--;)c[d]=c[d++-g];for(;8<=this.e;)this.e-=8,this.c--;this.b=d};r.prototype.f=function(){var a=new (x?Uint8Array:Array)(this.b-32768),b=this.b-32768,c,d,e=this.a;if(x)a.set(e.subarray(32768,a.length));else for(c=0,d=a.length;cc;++c)e[c]=e[b+c];this.b=32768;return e};r.prototype.J=function(a){var b,c=this.input.length/this.c+1|0,d,e,f,g=this.input,h=this.a;a&&("number"===typeof a.v&&(c=a.v),"number"===typeof a.F&&(c+=a.F));2>c?(d=(g.length-this.c)/this.u[2],f=d/2*258|0,e=fb&&(this.a.length=b),a=this.a);return this.buffer=a};v.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",v);b("Zlib.Inflate.BufferType",z);z.ADAPTIVE=z.C;z.BLOCK=z.D;b("Zlib.Inflate.prototype.decompress",v.prototype.p);z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];x&&new Uint16Array(z);z=[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];x&&new Uint16Array(z);z=[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];x&&new Uint8Array(z); z=[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];x&&new Uint16Array(z);z=[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];x&&new Uint8Array(z);z=new (x?Uint8Array:Array)(288);w=0;for(B=z.length;w=w?8:255>=w?9:279>=w?7:8;f(z);z=new (x?Uint8Array:Array)(30);w=0;for(B=z.length;wa;++a)e.push(String.fromCharCode(this.data[this.pos++]));a=e.join("");switch(a){case "IHDR":this.width=this.readUInt32();this.height=this.readUInt32();this.bits=this.data[this.pos++];this.colorType=this.data[this.pos++];this.compressionMethod=this.data[this.pos++];this.filterMethod= this.data[this.pos++];this.interlaceMethod=this.data[this.pos++];break;case "acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||Infinity,frames:[]};break;case "PLTE":this.palette=this.read(b);break;case "fcTL":d&&this.animation.frames.push(d);this.pos+=4;d={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};a=this.readUInt16();b=this.readUInt16()||100;d.delay=1E3*a/b;d.disposeOp=this.data[this.pos++];d.blendOp=this.data[this.pos++]; d.data=[];break;case "IDAT":case "fdAT":"fdAT"===a&&(this.pos+=4,b-=4);a=(null!=d?d.data:void 0)||this.imgData;for(e=0;0<=b?eb;0<=b?++e:--e)a.push(this.data[this.pos++]);break;case "tRNS":this.transparency={};switch(this.colorType){case 3:this.transparency.indexed=this.read(b);b=255-this.transparency.indexed.length;if(0b;0<=b?++a:--a)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(b)[0];break;case 2:this.transparency.rgb=this.read(b)}break; case "tEXt":e=this.read(b);b=e.indexOf(0);a=String.fromCharCode.apply(String,e.slice(0,b));this.text[a]=String.fromCharCode.apply(String,e.slice(b+1));break;case "IEND":d&&this.animation.frames.push(d);a:{switch(this.colorType){case 0:case 3:case 4:d=1;break a;case 2:case 6:d=3;break a}d=void 0}this.colors=d;this.hasAlphaChannel=4===(c=this.colorType)||6===c;c=this.colors+(this.hasAlphaChannel?1:0);this.pixelBitlength=this.bits*c;a:{switch(this.colors){case 1:c="DeviceGray";break a;case 3:c="DeviceRGB"; break a}c=void 0}this.colorSpace=c;Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData));return;default:this.pos+=b}this.pos+=4;if(this.pos>this.data.length)throw Error("Incomplete or corrupt PNG file");}},read:function(a){var b,c;c=[];for(b=0;0<=a?ba;0<=a?++b:--b)c.push(this.data[this.pos++]);return c},readUInt32:function(){var a,b,c,d;a=this.data[this.pos++]<<24;b=this.data[this.pos++]<<16;c=this.data[this.pos++]<<8;d=this.data[this.pos++];return a|b|c|d},readUInt16:function(){var a, b;a=this.data[this.pos++]<<8;b=this.data[this.pos++];return a|b},decodePixels:function(a){var b,c,d,e,f,g,h,k,m,n,q,s,r,t,u;null==a&&(a=this.imgData);if(0===a.length)return new Uint8Array(0);a=(new Zlib.Inflate(a,{index:0,verify:!1})).decompress();k=this.pixelBitlength/8;s=k*this.width;m=new Uint8Array(s*this.height);g=a.length;for(c=n=q=0;n=e*c)!1===this.littleEndian?a.push(d>>>8*(4-e)):a.push(d);else for(var f=0;f=a)cc.log("No bytes requested");else{if(1>=a)return this.getUint8(b);if(2>=a)return this.getUint16(b);if(3>=a)return this.getUint32(b)>>>8;if(4>=a)return this.getUint32(b);cc.log("Too many bytes requested")}},getBits:function(a,b,c){c=c||0;b+=Math.floor(c/8);var d=c+a;a=32-a;var e,f;0>=d?console.log("No bits requested"):8>=d?(e=24+c,f=this.getUint8(b)):16>=d?(e=16+c,f=this.getUint16(b)):32>=d?(e=c,f=this.getUint32(b)):console.log("Too many bits requested"); return{bits:f<>>a,byteOffset:b+Math.floor(d/8),bitOffset:d%8}},parseFileDirectory:function(a){var b=this.getUint16(a),c=[];a+=2;for(var d=0;d=A?F=A+1:-127<=A&&-1>=A?J=-A+1:x=!0}else{for(var L=this.getUint8(y+C),A=0;Aa?a:200;else{if(a>this._allocatedParticles){var b=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._indices=new Uint16Array(6*a);var c=new ArrayBuffer(a*b),d=this._particles;d.length=0;for(var e=this._quads,f=e.length=0;f=this._totalParticles},updateQuadWithParticle:function(a,b){var c=null;this._batchNode?(c=this._batchNode.textureAtlas.quads[this.atlasIndex+a.atlasIndex],this._batchNode.textureAtlas.dirty=!0):c=this._quads[this._particleIdx]; var d,e,f,g;this._opacityModifyRGB?(d=0|a.color.r*a.color.a/255,e=0|a.color.g*a.color.a/255,f=0|a.color.b*a.color.a/255):(d=0|a.color.r,e=0|a.color.g,f=0|a.color.b);g=0|a.color.a;var h=c.bl.colors;h.r=d;h.g=e;h.b=f;h.a=g;h=c.br.colors;h.r=d;h.g=e;h.b=f;h.a=g;h=c.tl.colors;h.r=d;h.g=e;h.b=f;h.a=g;h=c.tr.colors;h.r=d;h.g=e;h.b=f;h.a=g;d=a.size/2;if(a.rotation){e=-d;f=-d;g=b.x;var h=b.y,k=-cc.degreesToRadians(a.rotation),m=Math.cos(k),k=Math.sin(k);c.bl.vertices.x=e*m-f*k+g;c.bl.vertices.y=e*k+f*m+h; c.br.vertices.x=d*m-f*k+g;c.br.vertices.y=d*k+f*m+h;c.tl.vertices.x=e*m-d*k+g;c.tl.vertices.y=e*k+d*m+h;c.tr.vertices.x=d*m-d*k+g;c.tr.vertices.y=d*k+d*m+h}else c.bl.vertices.x=b.x-d,c.bl.vertices.y=b.y-d,c.br.vertices.x=b.x+d,c.br.vertices.y=b.y-d,c.tl.vertices.x=b.x-d,c.tl.vertices.y=b.y+d,c.tr.vertices.x=b.x+d,c.tr.vertices.y=b.y+d},postStep:function(){if(cc._renderType===cc._RENDER_TYPE_WEBGL){var a=cc._renderContext;a.bindBuffer(a.ARRAY_BUFFER,this._buffersVBO[0]);a.bufferData(a.ARRAY_BUFFER, this._quadsArrayBuffer,a.DYNAMIC_DRAW)}},update:function(a){if(this._isActive&&this.emissionRate){var b=1/this.emissionRate;this.particleCountb;)this.addParticle(),this._emitCounter-=b;this._elapsed+=a;-1!=this.duration&&this.durationd.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"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"cc.ParticleBatchNode.reorderChild(): child should be non-null";if(!(a instanceof cc.ParticleSystem))throw"cc.ParticleBatchNode.reorderChild(): only supports cc.QuadParticleSystems as children"; if(-1===this._children.indexOf(a))cc.log("cc.ParticleBatchNode.reorderChild(): Child doesn't belong to batch");else if(b!=a.zIndex){if(1a)return d;return c},_getCurrentIndex:function(a, b){for(var c=!1,d=!1,e=0,f=0,g=0,h=this._children,k=h.length,m=0;mb&&!d&&(e=m,d=!0,c&&d))break;if(a==n&&(f=m,c=!0,d||(g=-1),c&&d))break}d||(e=k);return{newIndex:e+g,oldIndex:f}},_addChildHelper:function(a,b,c){if(!a)throw"cc.ParticleBatchNode._addChildHelper(): child should be non-null";if(a.parent)return cc.log("cc.ParticleBatchNode._addChildHelper(): child already added. It can't be added again"),null;this._children||(this._children=[]);var d=this._searchNewPositionInChildrenForZ(b); this._children.splice(d,0,a);a.tag=c;a._setLocalZOrder(b);a.parent=this;this._running&&(a.onEnter(),a.onEnterTransitionDidFinish());return d},_updateBlendFunc:function(){this.textureAtlas.texture.hasPremultipliedAlpha()||(this._blendFunc.src=cc.SRC_ALPHA,this._blendFunc.dst=cc.ONE_MINUS_SRC_ALPHA)},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){this.textureAtlas=a}});_p=cc.ParticleBatchNode.prototype;cc.defineGetterSetter(_p,"texture",_p.getTexture,_p.setTexture); cc.ParticleBatchNode.create=function(a,b){return new cc.ParticleBatchNode(a,b)};cc.IMEKeyboardNotificationInfo=function(a,b,c){this.begin=a||cc.rect(0,0,0,0);this.end=b||cc.rect(0,0,0,0);this.duration=c||0}; cc.IMEDelegate=cc.Class.extend({ctor:function(){cc.imeDispatcher.addDelegate(this)},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},attachWithIME:function(){return cc.imeDispatcher.attachDelegateWithIME(this)},detachWithIME:function(){return cc.imeDispatcher.detachDelegateWithIME(this)},canAttachWithIME:function(){return!1},didAttachWithIME:function(){},canDetachWithIME:function(){return!1},didDetachWithIME:function(){},insertText:function(a,b){},deleteBackward:function(){},getContentText:function(){return""}, keyboardWillShow:function(a){},keyboardDidShow:function(a){},keyboardWillHide:function(a){},keyboardDidHide:function(a){}}); cc.IMEDispatcher=cc.Class.extend({_domInputControl:null,impl:null,_currentInputString:"",_lastClickPosition:null,ctor:function(){this.impl=new cc.IMEDispatcher.Impl;this._lastClickPosition=cc.p(0,0)},init:function(){if(!cc.sys.isMobile){this._domInputControl=cc.$("#imeDispatcherInput");this._domInputControl||(this._domInputControl=cc.$new("input"),this._domInputControl.setAttribute("type","text"),this._domInputControl.setAttribute("id","imeDispatcherInput"),this._domInputControl.resize(0,0),this._domInputControl.translates(0, 0),this._domInputControl.style.opacity="0",this._domInputControl.style.fontSize="1px",this._domInputControl.setAttribute("tabindex",2),this._domInputControl.style.position="absolute",this._domInputControl.style.top=0,this._domInputControl.style.left=0,document.body.appendChild(this._domInputControl));var a=this;cc._addEventListener(this._domInputControl,"input",function(){a._processDomInputString(a._domInputControl.value)},!1);cc._addEventListener(this._domInputControl,"keydown",function(b){b.keyCode=== cc.KEY.tab?(b.stopPropagation(),b.preventDefault()):b.keyCode==cc.KEY.enter&&(a.dispatchInsertText("\n",1),b.stopPropagation(),b.preventDefault())},!1);/msie/i.test(navigator.userAgent)&&cc._addEventListener(this._domInputControl,"keyup",function(b){b.keyCode==cc.KEY.backspace&&a._processDomInputString(a._domInputControl.value)},!1);cc._addEventListener(window,"mousedown",function(b){var c=b.pageY||0;a._lastClickPosition.x=b.pageX||0;a._lastClickPosition.y=c},!1)}},_processDomInputString:function(a){var b, c;b=this._currentInputString.length=b||this.impl._delegateWithIme&&this.impl._delegateWithIme.insertText(a,b)},dispatchDeleteBackward:function(){this.impl&&this.impl._delegateWithIme&& this.impl._delegateWithIme.deleteBackward()},getContentText:function(){if(this.impl&&this.impl._delegateWithIme){var a=this.impl._delegateWithIme.getContentText();return a?a:""}return""},dispatchKeyboardWillShow:function(a){if(this.impl)for(var b=0;ba?a==cc.KEY.backspace?this.dispatchDeleteBackward(): a==cc.KEY.enter&&this.dispatchInsertText("\n",1):255>a&&this.dispatchInsertText(String.fromCharCode(a),1)}});cc.IMEDispatcher.Impl=cc.Class.extend({_delegateWithIme:null,_delegateList:null,ctor:function(){this._delegateList=[]},findDelegate:function(a){for(var b=0;b=a?(this._inputText="",this._charCount=0,cc.LabelTTF.prototype.setString.call(this,this._placeHolder),this.setColor(this.colorSpaceHolder)):this.string=this._inputText.substring(0,a-1))},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},insertText:function(a,b){var c=a,d=c.indexOf("\n");-1=a.length||!(g=a[d])||(h=m[b].height,e=e>=h||isNaN(h)?e:h,++f,f>=g&&(c+=e+5,e=f=0,++d));var n=cc.director.getWinSize(),q=g=e=d=0,s=0,c=c/2;if(m&&0=h||isNaN(h)?e:h;r.setPosition(s-n.width/2,c-h/2);s+=q;++f;f>=g&&(c-=e+5,e=g=f=0,++d)}},alignItemsInRows:function(){0=a.length||!(m=a[g]))||(s=n.width,h=h>=s||isNaN(s)?h:s,f+=n.height+5,++k,k>=m&&(c.push(h),d.push(f),e+=h+10,h=k=0,f=-5,++g));f=cc.director.getWinSize();m=h=g=0;var e=-e/2,t=0;if(r&&0=s||isNaN(s)?h:s,n.setPosition(e+c[g]/2,t-f.height/2), t-=n.height+10,++k,k>=m&&(e+=h+5,h=m=k=0,++g)},removeChild:function(a,b){null!=a&&(a instanceof cc.MenuItem?(this._selectedItem==a&&(this._selectedItem=null),cc.Node.prototype.removeChild.call(this,a,b)):cc.log("cc.Menu.removeChild():Menu only supports MenuItem objects as children"))},_onTouchBegan:function(a,b){var c=b.getCurrentTarget();if(c._state!=cc.MENU_STATE_WAITING||!c._visible||!c.enabled)return!1;for(var d=c.parent;null!=d;d=d.parent)if(!d.isVisible())return!1;c._selectedItem=c._itemForTouch(a); return c._selectedItem?(c._state=cc.MENU_STATE_TRACKING_TOUCH,c._selectedItem.selected(),!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.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"):(this._selectedItem&& c._selectedItem.unselected(),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=d,c._selectedItem&&c._selectedItem.selected())}},onExit:function(){this._state==cc.MENU_STATE_TRACKING_TOUCH&&(this._selectedItem&&(this._selectedItem.unselected(),this._selectedItem= null),this._state=cc.MENU_STATE_WAITING);cc.Node.prototype.onExit.call(this)},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_itemForTouch:function(a){a=a.getLocation();var b=this._children,c;if(b&&0b)return!1;a=new cc.BinaryStreamReader(a);a.setOffset(d);c.type=a.readByte();d+=10;if(d+4+1>b)return!1;a.setOffset(d);c.width=a.readUnsignedShort();c.height=a.readUnsignedInteger();c.pixelDepth=a.readByte();if(d+5+1>b)return!1;b=a.readByte();c.flipped=0;b&32&&(c.flipped=1);return!0}; cc.tgaLoadImageData=function(a,b,c){var d,e;d=0|c.pixelDepth/2;e=c.height*c.width*d;if(18+e>b)return!1;c.imageData=cc.__getSubArray(a,18,18+e);if(3<=d)for(a=0;ab)break;n=a[q];q+=1;(k=n&128)&&(n-=128);h=0}if(!h){if(q+d>b)break;m=cc.__getSubArray(a,q,q+d);q+=d;3<=d&&(h=m[0],m[0]=m[2],m[2]=h)}for(h=0;h>3;this._checkSize(c);var c=Math.pow(2,b-1)-1,e=this._readBits(a+b,1,d),f=this._readBits(a,b,d),g=0,h=2,k=0;do for(var m=this._readByte(++k, d),n=a%8||8,q=1<>=1;)m&q&&(g+=1/h),h*=2;while(a-=n);this._offset+=d;return f==(c<<1)+1?g?NaN:e?-Infinity:Infinity:(1+-2*e)*(f||g?f?Math.pow(2,f-c)*(1+g):Math.pow(2,-c+1)*g:0)},_readByte:function(a,b){return this._data[this._offset+b-a-1]},_decodeInt:function(a,b){var c=this._readBits(0,a,a/8),d=Math.pow(2,a);this._offset+=a/8;return b&&c>=d/2?c-d:c},_shl:function(a,b){for(++b;--b;a=1073741824==((a%=2147483648)&1073741824)?2*a:2*(a-1073741824)+2147483648);return a},_readBits:function(a,b,c){var d= (a+b)%8,e=a%8,f=c-(a>>3)-1;a=c+(-(a+b)>>3);var g=f-a;b=this._readByte(f,c)>>e&(1<<(g?8-e:b))-1;for(g&&d&&(b+=(this._readByte(a++,c)&(1<>>0>=f.firstGid)return f}}cc.log("cocos2d: Warning: TMX Layer "+a.name+" has no tiles");return null}});_p=cc.TMXTiledMap.prototype;cc.defineGetterSetter(_p,"mapWidth",_p._getMapWidth,_p._setMapWidth);cc.defineGetterSetter(_p,"mapHeight",_p._getMapHeight,_p._setMapHeight);cc.defineGetterSetter(_p,"tileWidth",_p._getTileWidth,_p._setTileWidth);cc.defineGetterSetter(_p,"tileHeight",_p._getTileHeight,_p._setTileHeight); cc.TMXTiledMap.create=function(a,b){return new cc.TMXTiledMap(a,b)};cc.TMX_PROPERTY_NONE=0;cc.TMX_PROPERTY_MAP=1;cc.TMX_PROPERTY_LAYER=2;cc.TMX_PROPERTY_OBJECTGROUP=3;cc.TMX_PROPERTY_OBJECT=4;cc.TMX_PROPERTY_TILE=5;cc.TMX_TILE_HORIZONTAL_FLAG=2147483648;cc.TMX_TILE_VERTICAL_FLAG=1073741824;cc.TMX_TILE_DIAGONAL_FLAG=536870912;cc.TMX_TILE_FLIPPED_ALL=(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_DIAGONAL_FLAG)>>>0;cc.TMX_TILE_FLIPPED_MASK=~cc.TMX_TILE_FLIPPED_ALL>>>0; cc.TMXLayerInfo=cc.Class.extend({properties:null,name:"",_layerSize:null,_tiles:null,visible:null,_opacity:null,ownTiles:!0,_minGID:1E5,_maxGID:0,offset:null,ctor:function(){this.properties=[];this.name="";this._layerSize=null;this._tiles=[];this.visible=!0;this._opacity=0;this.ownTiles=!0;this._minGID=1E5;this._maxGID=0;this.offset=cc.p(0,0)},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a}}); cc.TMXTilesetInfo=cc.Class.extend({name:"",firstGid:0,_tileSize:null,spacing:0,margin:0,sourceImage:"",imageSize:null,ctor:function(){this._tileSize=cc.size(0,0);this.imageSize=cc.size(0,0)},rectForGID:function(a){var b=cc.rect(0,0,0,0);b.width=this._tileSize.width;b.height=this._tileSize.height;a&=cc.TMX_TILE_FLIPPED_MASK;a-=parseInt(this.firstGid,10);var c=parseInt((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing),10);b.x=parseInt(a%c*(this._tileSize.width+this.spacing)+ this.margin,10);b.y=parseInt(parseInt(a/c,10)*(this._tileSize.height+this.spacing)+this.margin,10);return b}}); cc.TMXMapInfo=cc.SAXParser.extend({properties:null,orientation:null,parentElement:null,parentGID:null,layerAttrs:0,storingCharacters:!1,tmxFileName:null,currentString:null,_objectGroups:null,_mapSize:null,_tileSize:null,_layers:null,_tilesets:null,_tileProperties:null,_resources:"",_currentFirstGID:0,ctor:function(a,b){cc.SAXParser.prototype.ctor.apply(this);this._mapSize=cc.size(0,0);this._tileSize=cc.size(0,0);this._layers=[];this._tilesets=[];this._objectGroups=[];this.properties=[];this._tileProperties= {};this._currentFirstGID=0;void 0!==b?this.initWithXML(a,b):void 0!==a&&this.initWithTMXFile(a)},getOrientation:function(){return this.orientation},setOrientation:function(a){this.orientation=a},getMapSize:function(){return cc.size(this._mapSize.width,this._mapSize.height)},setMapSize:function(a){this._mapSize.width=a.width;this._mapSize.height=a.height},_getMapWidth:function(){return this._mapSize.width},_setMapWidth:function(a){this._mapSize.width=a},_getMapHeight:function(){return this._mapSize.height}, _setMapHeight:function(a){this._mapSize.height=a},getTileSize:function(){return cc.size(this._tileSize.width,this._tileSize.height)},setTileSize:function(a){this._tileSize.width=a.width;this._tileSize.height=a.height},_getTileWidth:function(){return this._tileSize.width},_setTileWidth:function(a){this._tileSize.width=a},_getTileHeight:function(){return this._tileSize.height},_setTileHeight:function(a){this._tileSize.height=a},getLayers:function(){return this._layers},setLayers:function(a){this._layers.push(a)}, getTilesets:function(){return this._tilesets},setTilesets:function(a){this._tilesets.push(a)},getObjectGroups:function(){return this._objectGroups},setObjectGroups:function(a){this._objectGroups.push(a)},getParentElement:function(){return this.parentElement},setParentElement:function(a){this.parentElement=a},getParentGID:function(){return this.parentGID},setParentGID:function(a){this.parentGID=a},getLayerAttribs:function(){return this.layerAttrs},setLayerAttribs:function(a){this.layerAttrs=a},getStoringCharacters:function(){return this.storingCharacters}, setStoringCharacters:function(a){this.storingCharacters=a},getProperties:function(){return this.properties},setProperties:function(a){this.properties=a},initWithTMXFile:function(a){this._internalInit(a,null);return this.parseXMLFile(a)},initWithXML:function(a,b){this._internalInit(null,b);return this.parseXMLString(a)},parseXMLFile:function(a,b){var c=(b=b||!1)?a:cc.loader.getRes(a);if(!c)throw"Please load the resource first : "+a;var d,e,c=this._parseXML(c).documentElement;d=c.getAttribute("version"); e=c.getAttribute("orientation");if("map"==c.nodeName&&("1.0"!=d&&null!==d&&cc.log("cocos2d: TMXFormat: Unsupported TMX version:"+d),"orthogonal"==e?this.orientation=cc.TMX_ORIENTATION_ORTHO:"isometric"==e?this.orientation=cc.TMX_ORIENTATION_ISO:"hexagonal"==e?this.orientation=cc.TMX_ORIENTATION_HEX:null!==e&&cc.log("cocos2d: TMXFomat: Unsupported orientation:"+e),d=cc.size(0,0),d.width=parseFloat(c.getAttribute("width")),d.height=parseFloat(c.getAttribute("height")),this.setMapSize(d),d=cc.size(0, 0),d.width=parseFloat(c.getAttribute("tilewidth")),d.height=parseFloat(c.getAttribute("tileheight")),this.setTileSize(d),e=c.querySelectorAll("map \x3e properties \x3e property"))){var f={};for(d=0;d this._maxCachePixel){this._subCacheCanvas||(this._subCacheCanvas=[]);this._subCacheContext||(this._subCacheContext=[]);this._subCacheCount=Math.ceil(c/this._maxCachePixel);c=this._subCacheCanvas;for(e=0;e=this._layerSize.width|| a.y>=this._layerSize.height||0>a.x||0>a.y)throw"cc.TMXLayer.getTileAt(): invalid position";if(!this.tiles||!this._atlasIndexArray)return cc.log("cc.TMXLayer.getTileAt(): TMXLayer: the tiles map has been released"),null;var c=null,d=this.getTileGIDAt(a);if(0===d)return c;var e=0|a.x+a.y*this._layerSize.width,c=this.getChildByTag(e);c||(d=this.tileset.rectForGID(d),d=cc.rectPixelsToPoints(d),c=new cc.Sprite,c.initWithTexture(this.texture,d),c.batchNode=this,c.setPosition(this.getPositionAt(a)),c.vertexZ= this._vertexZForPos(a),c.anchorX=0,c.anchorY=0,c.opacity=this._opacity,d=this._atlasIndexForExistantZ(e),this.addSpriteWithoutQuad(c,d,e));return c},getTileGIDAt:function(a,b){if(!a)throw"cc.TMXLayer.getTileGIDAt(): pos should be non-null";void 0!==b&&(a=cc.p(a,b));if(a.x>=this._layerSize.width||a.y>=this._layerSize.height||0>a.x||0>a.y)throw"cc.TMXLayer.getTileGIDAt(): invalid position";return this.tiles&&this._atlasIndexArray?(this.tiles[0|a.x+a.y*this._layerSize.width]&cc.TMX_TILE_FLIPPED_MASK)>>> 0:(cc.log("cc.TMXLayer.getTileGIDAt(): TMXLayer: the tiles map has been released"),null)},getTileFlagsAt:function(a,b){if(!a)throw"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"cc.TMXLayer.getTileFlagsAt(): invalid position";return this.tiles&&this._atlasIndexArray?(this.tiles[0|a.x+a.y*this._layerSize.width]&cc.TMX_TILE_FLIPPED_ALL)>>>0:(cc.log("cc.TMXLayer.getTileFlagsAt(): TMXLayer: the tiles map has been released"), null)},setTileGID:function(a,b,c,d){if(!b)throw"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"cc.TMXLayer.setTileGID(): invalid position";if(this.tiles&&this._atlasIndexArray)if(0!==a&&a>>0,0===a)this.removeTileAt(b); else if(0===e)this._insertTileForGID(c,b);else{var e=b.x+b.y*this._layerSize.width,f=this.getChildByTag(e);f?(a=this.tileset.rectForGID(a),a=cc.rectPixelsToPoints(a),f.setTextureRect(a,!1),null!=d&&this._setupTileSprite(f,b,c),this.tiles[e]=c):this._updateTileForGID(c,b)}}else cc.log("cc.TMXLayer.setTileGID(): TMXLayer: the tiles map has been released")},removeTileAt:function(a,b){if(!a)throw"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"cc.TMXLayer.removeTileAt(): invalid position";if(!this.tiles||!this._atlasIndexArray)cc.log("cc.TMXLayer.removeTileAt(): TMXLayer: the tiles map has been released");else if(0!==this.getTileGIDAt(a)){cc._renderType===cc._RENDER_TYPE_CANVAS&&this._setNodeDirtyForCache();var c=0|a.x+a.y*this._layerSize.width,d=this._atlasIndexForExistantZ(c);this.tiles[c]=0;this._atlasIndexArray.splice(d,1);if(c=this.getChildByTag(c))cc.SpriteBatchNode.prototype.removeChild.call(this, c,!0);else if(cc._renderType===cc._RENDER_TYPE_WEBGL&&this.textureAtlas.removeQuadAtIndex(d),this._children)for(var c=this._children,e=0,f=c.length;e=d&&(g.atlasIndex=h-1)}}}},getPositionAt:function(a,b){void 0!==b&&(a=cc.p(a,b));var c=cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:c=this._positionForOrthoAt(a);break;case cc.TMX_ORIENTATION_ISO:c=this._positionForIsoAt(a);break;case cc.TMX_ORIENTATION_HEX:c=this._positionForHexAt(a)}return cc.pointPixelsToPoints(c)}, getProperty:function(a){return this.properties[a]},setupTiles:function(){cc._renderType===cc._RENDER_TYPE_CANVAS?this.tileset.imageSize=this._originalTexture.getContentSizeInPixels():(this.tileset.imageSize=this.textureAtlas.texture.getContentSizeInPixels(),this.textureAtlas.texture.setAliasTexParameters());this._parseInternalProperties();cc._renderType===cc._RENDER_TYPE_CANVAS&&this._setNodeDirtyForCache();for(var a=this._layerSize.height,b=this._layerSize.width,c=0;c=this.tileset.firstGid&&this._minGID>=this.tileset.firstGid||cc.log("cocos2d:TMX: Only 1 tileset per layer is supported")},addChild:function(a,b,c){cc.log("addChild: is not supported on cc.TMXLayer. Instead use setTileGID or tileAt.")},removeChild:function(a,b){if(a)if(-1===this._children.indexOf(a))cc.log("cc.TMXLayer.removeChild(): Tile does not belong to TMXLayer"); else{cc._renderType===cc._RENDER_TYPE_CANVAS&&this._setNodeDirtyForCache();var c=a.atlasIndex;this.tiles[this._atlasIndexArray[c]]=0;this._atlasIndexArray.splice(c,1);cc.SpriteBatchNode.prototype.removeChild.call(this,a,b)}},getLayerName:function(){return this.layerName},setLayerName:function(a){this.layerName=a},_positionForIsoAt:function(a){return cc.p(this._mapTileSize.width/2*(this._layerSize.width+a.x-a.y-1),this._mapTileSize.height/2*(2*this._layerSize.height-a.x-a.y-2))},_positionForOrthoAt:function(a){return cc.p(a.x* this._mapTileSize.width,(this._layerSize.height-a.y-1)*this._mapTileSize.height)},_positionForHexAt:function(a){return cc.p(a.x*this._mapTileSize.width*3/4,(this._layerSize.height-a.y-1)*this._mapTileSize.height+(1==a.x%2?-this._mapTileSize.height/2:0))},_calculateLayerOffset:function(a){var b=cc.p(0,0);switch(this.layerOrientation){case cc.TMX_ORIENTATION_ORTHO:b=cc.p(a.x*this._mapTileSize.width,-a.y*this._mapTileSize.height);break;case cc.TMX_ORIENTATION_ISO:b=cc.p(this._mapTileSize.width/2*(a.x- a.y),this._mapTileSize.height/2*(-a.x-a.y));break;case cc.TMX_ORIENTATION_HEX:0===a.x&&0===a.y||cc.log("offset for hexagonal map not implemented yet")}return b},_appendTileForGID:function(a,b){var c=this.tileset.rectForGID(a),c=cc.rectPixelsToPoints(c),d=0|b.x+b.y*this._layerSize.width,c=this._reusedTileWithRect(c);this._setupTileSprite(c,b,a);var e=this._atlasIndexArray.length;this.insertQuadFromSprite(c,e);this._atlasIndexArray.splice(e,0,d);return c},_insertTileForGID:function(a,b){var c=this.tileset.rectForGID(a), c=cc.rectPixelsToPoints(c),d=0|b.x+b.y*this._layerSize.width,c=this._reusedTileWithRect(c);this._setupTileSprite(c,b,a);var e=this._atlasIndexForNewZ(d);this.insertQuadFromSprite(c,e);this._atlasIndexArray.splice(e,0,d);if(this._children)for(var f=this._children,g=0,h=f.length;g=e&&(k.atlasIndex=m+1)}}this.tiles[d]=a;return c},_updateTileForGID:function(a,b){var c=this.tileset.rectForGID(a),d=this._contentScaleFactor,c=cc.rect(c.x/d,c.y/d,c.width/d,c.height/ d),d=b.x+b.y*this._layerSize.width,c=this._reusedTileWithRect(c);this._setupTileSprite(c,b,a);c.atlasIndex=this._atlasIndexForExistantZ(d);c.dirty=!0;c.updateTransform();this.tiles[d]=a;return c},_parseInternalProperties:function(){var a=this.getProperty("cc_vertexz");if(a)if("automatic"==a){this._useAutomaticVertexZ=!0;var b=this.getProperty("cc_alpha_func"),a=0;b&&(a=parseFloat(b));cc._renderType===cc._RENDER_TYPE_WEBGL&&(this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST), b=cc._renderContext.getUniformLocation(this.shaderProgram.getProgram(),cc.UNIFORM_ALPHA_TEST_VALUE_S),this.shaderProgram.use(),this.shaderProgram.setUniformLocationWith1f(b,a))}else this._vertexZvalue=parseInt(a,10)},_setupTileSprite:function(a,b,c){var d=b.x+b.y*this._layerSize.width;a.setPosition(this.getPositionAt(b));cc._renderType===cc._RENDER_TYPE_WEBGL?a.vertexZ=this._vertexZForPos(b):a.tag=d;a.anchorX=0;a.anchorY=0;a.opacity=this._opacity;cc._renderType===cc._RENDER_TYPE_WEBGL&&(a.rotation= 0);a.setFlippedX(!1);a.setFlippedY(!1);(c&cc.TMX_TILE_DIAGONAL_FLAG)>>>0?(a.anchorX=0.5,a.anchorY=0.5,a.x=this.getPositionAt(b).x+a.width/2,a.y=this.getPositionAt(b).y+a.height/2,b=(c&(cc.TMX_TILE_HORIZONTAL_FLAG|cc.TMX_TILE_VERTICAL_FLAG)>>>0)>>>0,b==cc.TMX_TILE_HORIZONTAL_FLAG?a.rotation=90:b==cc.TMX_TILE_VERTICAL_FLAG?a.rotation=270:(a.rotation=b==(cc.TMX_TILE_VERTICAL_FLAG|cc.TMX_TILE_HORIZONTAL_FLAG)>>>0?90:270,a.setFlippedX(!0))):((c&cc.TMX_TILE_HORIZONTAL_FLAG)>>>0&&a.setFlippedX(!0),(c&cc.TMX_TILE_VERTICAL_FLAG)>>> 0&&a.setFlippedY(!0))},_reusedTileWithRect:function(a){cc._renderType===cc._RENDER_TYPE_WEBGL?(this._reusedTile?(this._reusedTile.batchNode=null,this._reusedTile.setTextureRect(a,!1)):(this._reusedTile=new cc.Sprite,this._reusedTile.initWithTexture(this.texture,a,!1)),this._reusedTile.batchNode=this):(this._reusedTile=new cc.Sprite,this._reusedTile.initWithTexture(this._textureForCanvas,a,!1),this._reusedTile.batchNode=this,this._reusedTile.parent=this);return this._reusedTile},_vertexZForPos:function(a){var b= 0,c=0;if(this._useAutomaticVertexZ)switch(this.layerOrientation){case cc.TMX_ORIENTATION_ISO:c=this._layerSize.width+this._layerSize.height;b=-(c-(a.x+a.y));break;case cc.TMX_ORIENTATION_ORTHO:b=-(this._layerSize.height-a.y);break;case cc.TMX_ORIENTATION_HEX:cc.log("TMX Hexa zOrder not supported");break;default:cc.log("TMX invalid value")}else b=this._vertexZvalue;return b},_atlasIndexForExistantZ:function(a){var b;if(this._atlasIndexArray)for(var c=this._atlasIndexArray,d=0,e=c.length;d=this._maxAudioInstance)return cc.log("Error: "+b+" greater than "+this._maxAudioInstance),null;c=this._getAudioByUrl(b);if(!c)return null;c=c.cloneNode(!0);this._effectPauseCb&&cc._addEventListener(c,"pause",this._effectPauseCb);c.volume=this._effectsVolume;return c},playEffect:function(a,b){var c=this._getEffect(a);if(!c)return null;c.loop=b||!1;c.play();var d=this._audioID++;this._effects[d]=c;return d},setEffectsVolume:function(a){a=this._effectsVolume=Math.min(Math.max(a, 0),1);var b=this._effects,c;for(c in b)b[c].volume=a},pauseEffect:function(a){(a=this._effects[a])&&!a.ended&&a.pause()},pauseAllEffects:function(){var a=this._effects,b;for(b in a){var c=a[b];c.ended||c.pause()}},resumeEffect:function(a){this._resumeAudio(this._effects[a])},resumeAllEffects:function(){var a=this._effects,b;for(b in a)this._resumeAudio(a[b])},stopEffect:function(a){this._stopAudio(this._effects[a]);delete this._effects[a]},stopAllEffects:function(){var a=this._effects,b;for(b in a)this._stopAudio(a[b]), delete a[b]},unloadEffect:function(a){var b=cc.loader,c=this._effects,d=this._getEffectList(a);b.release(a);if(0!=d.length){b=d[0].src;delete this._audioPool[a];for(var e in c)c[e].src==b&&(this._stopAudio(c[e]),delete c[e])}},end:function(){this.stopMusic();this.stopAllEffects()},_pausePlaying:function(){var a=this._effects,b,c;for(c in a)!(b=a[c])||b.ended||b.paused||(this._playings.push(b),b.pause());this.isMusicPlaying()&&(this._playings.push(this._currMusic),this._currMusic.pause())},_resumePlaying:function(){for(var a= this._playings,b=0,c=a.length;bb;b++){var c=cc.spriteFrameCache.getSpriteFrame("mosquito_a"+b+".png");a.push(c)}a=new cc.Animation(a,0.05);this._actionFly=cc.animate(a);this.runAction(cc.repeatForever(this._actionFly))}, doMove:function(){var a=cc.p(Math.floor(200*Math.random())+50,Math.floor(960*Math.random())),b=cc.p(Math.floor(200*Math.random())+200,Math.floor(960*Math.random())),c=cc.p(640+this.width,Math.floor(960*Math.random())),a=cc.bezierTo(game.speed,[a,b,c]);this._actionMove=cc.sequence(a,cc.callFunc(function(){this.setState(GameConstants.SPRITE_STATE_RELEASE)},this));this.runAction(this._actionMove)},isOut:function(a,b){return 0>=this.x+this.width/2||this.x-this.width/2>=a||0>=this.y+this.height/2||this.y- this.height/2>=b?!0:!1},getState:function(){return this._state},setState:function(a){this._state=a},stopFly:function(){this.stopAction(this._actionFly)},stopMove:function(){this.stopAction(this._actionMove)}});LoadingScene=cc.Scene.extend({_interval:null,_label:null,_className:"LoaderScene",init:function(){var a=this._bgLayer=new cc.LayerColor(cc.color(32,32,32,255));a.setPosition(cc.visibleRect.bottomLeft);this.addChild(a,0);var b=new cc.Sprite("http://dudulugameimg.qiniudn.com/wzzz_bg_loading.png");b.x=cc.winSize.width/2;b.y=cc.winSize.height/2;a.addChild(b);b=this._label=cc.LabelTTF.create("Loading... 0%","Arial",14);b.setPosition(cc.visibleRect.center);b.setColor(cc.color(255,255,255));a.addChild(this._label,10);return!0},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){cc.isString(a)&&(a=[a]);this.resources=a||[];this.cb=b},_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()})}}); LoadingScene.preload=function(a,b){var c=cc;c.loaderScene||(c.loaderScene=new LoadingScene,c.loaderScene.init());c.loaderScene.initWithResources(a,b);cc.director.runScene(c.loaderScene);return c.loaderScene};var menuScene={}; (function(){menuScene.MenuScene=cc.Scene.extend({ctor:function(){this._super();this.init();var a=new menuScene.MenuLayer;this.addChild(a)}});menuScene.MenuLayer=cc.Layer.extend({ctor:function(){this._super();this.init();return!0},init:function(){var a=new cc.Sprite(res.bg_menu_png);a.attr({x:cc.winSize.width/2,y:cc.winSize.height/2});this.addChild(a);a=new cc.Sprite(res.icon_game_png);a.x=cc.winSize.width/2+45;a.y=cc.winSize.height-230;this.addChild(a);a=new cc.Sprite(res.icon_mosquito_png);a.x=cc.winSize.width/ 2;a.y=cc.winSize.height/2;this.addChild(a);var a=new cc.MenuItemImage(res.btn_start_a_png,res.btn_start_b_png,res.btn_start_b_png,function(){cc.director.pushScene(new gameScene.GameScene)},this),b=new cc.MenuItemImage(res.btn_about_a_png,res.btn_about_a_png,res.btn_about_a_png,function(){clickMore();},this),c=new cc.MenuItemImage(res.btn_voice_open_png),d=new cc.MenuItemImage(res.btn_voice_close_png),c=new cc.MenuItemToggle(c,d,function(a){0==a.selectedIndex?(cc.log("\u5f00\u542f\u97f3\u4e50"), game.isMusic=!0,localStorage.setItem("favbeatmosquito_config_isMusic",!0),cc.audioEngine.isMusicPlaying()||cc.audioEngine.playMusic(res.voice_menu_mp3,!0)):1==a.selectedIndex&&(cc.log("\u5173\u95ed\u97f3\u4e50"),game.isMusic=!1,localStorage.setItem("favbeatmosquito_config_isMusic",!1),cc.audioEngine.isMusicPlaying()&&cc.audioEngine.stopMusic())},this);c.anchorY=1;c.x=60;c.y=cc.winSize.height-25;a.attr({x:cc.winSize.width/2,y:170,anchorX:0.5,anchorY:0});b.attr({x:cc.winSize.width/2,y:50,anchorX:0.5, anchorY:0});a=new cc.Menu(a,b,c);a.x=0;a.y=0;this.addChild(a,1);cc.spriteFrameCache.addSpriteFrames(res.mosquito_a_plist);cc.spriteFrameCache.addSpriteFrames(res.mosquito_dead_a_plist);game.isMusic?(cc.log("game is music true"),c.setSelectedIndex(0),cc.audioEngine.playMusic(res.voice_menu_mp3,!0)):(cc.log("game is music false"),c.setSelectedIndex(1))}})})();var aboutScene={}; (function(){aboutScene.AboutScene=cc.Scene.extend({ctor:function(){this._super();this.init();this.addChild(new aboutScene.AboutLayer)}});aboutScene.AboutLayer=cc.Layer.extend({ctor:function(a){this._super();this.init()},init:function(){this._super();var a=new cc.Sprite(res.bg_about_png);a.x=cc.winSize.width/2;a.y=cc.winSize.height/2;this.addChild(a);a=new cc.MenuItemImage(res.btn_back_a_png,res.btn_back_a_png,res.btn_back_a_png,function(){cc.director.popScene()},this);a.x=cc.winSize.width/2;a.y=200; a=new cc.Menu(a);a.x=0;a.y=0;this.addChild(a)}})})();var gameScene={}; (function(){gameScene.GameScene=cc.Scene.extend({_gameLayer:null,ctor:function(){this._super();this.init();this._gameLayer=new gameScene.GameLayer(this);this.addChild(this._gameLayer)},getGameLayer:function(){return this._gameLayer}});gameScene.GameLayer=cc.Layer.extend({_context:null,_progressTime:null,_progressTimeScheduler:null,_startupMosquitoScheduler:null,_updateScheduler:null,_score:null,ctor:function(a){this._super();this._context=a;this.init();this.startGame()},init:function(){this._super();var a= new cc.Sprite(res.bg_game_list[0]);a.x=cc.winSize.width/2;a.y=cc.winSize.height/2;this.addChild(a);var b=new cc.Sprite(res.pg_game_b_png);b.anchorX=1;b.anchorY=1;b.x=cc.winSize.width-10;b.y=cc.winSize.height-20;this.addChild(b);this._progressTime=new cc.ProgressTimer(new cc.Sprite(res.pg_game_a_png));this._progressTime.type=cc.ProgressTimer.TYPE_BAR;this._progressTime.midPoint=cc.p(0,0);this._progressTime.barChangeRate=cc.p(1,0);this._progressTime.percentage=100;this._progressTime.anchorX=1;this._progressTime.anchorY= 1;this._progressTime.x=cc.winSize.width-19;this._progressTime.y=cc.winSize.height-25;this.addChild(this._progressTime);a=new cc.Sprite(res.lb_time_png);a.anchorX=1;a.anchorY=1;a.x=cc.winSize.width-10-b.width-10;a.y=b.y-2;this.addChild(a);b=new cc.Sprite(res.lb_score_png);b.anchorY=1;b.x=50;b.y=a.y;this.addChild(b);this._score=new cc.LabelBMFont(game.score,res.numbers_fnt,-1,cc.TEXT_ALIGNMENT_LEFT);this._score.anchorY=1;this._score.anchorX=0;this._score.x=b.width+15;this._score.y=b.y+5;this.addChild(this._score)}, startGame:function(){for(game.init();game.mosquitoList.length=this._progressTime.percentage&&(cc.log("\u65f6\u95f4\u5230\uff0c\u6e38\u620f\u7ed3\u675f"),this.gameover())},startupMosquito:function(){game.speed!=GameConstants.SPEED_FAST[0]&&50>this._progressTime.percentage&&(game.speed=GameConstants.SPEED_FAST[0],game.mosquitoInterval=GameConstants.SPEED_FAST[1],this.unschedule(this.startupMosquito),this.schedule(this.startupMosquito,game.mosquitoInterval,cc.REPEAT_FOREVER,1));for(var a= 0,b=game.mosquitoList.length;a