var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};var gl;window.gl;window.WebGLRenderingContext;window.DeviceOrientationEvent;window.DeviceMotionEvent;window.AudioContext;window.AudioContext||window.webkitAudioContext;window.mozAudioContext;window=Object.prototype;window._super;window.ctor;cc._drawingUtil=null;cc._renderContext=null;cc._supportRender=!1;cc._canvas=null;cc.container=null;cc._gameDiv=null;window.ENABLE_IMAEG_POOL=!0; cc.each=function(a,b,c){if(a)if(a instanceof Array)for(var d=0,e=a.length;d=g._limit)){var h=g._pool.shift(),k=h.value,m=h.index;g._workingSize++;g._iterator.call(g._iteratorTarget,k,m,function(l,n){if(!g._finished)if(l?g._errors[this.index]=l:g._results[this.index]=n,g.finishedSize++,g._workingSize--,g.finishedSize===g.size)g.onEnd(0===g._errors.length?null:g._errors,g._results);else g._handleItem()}.bind(h),g)}};f.flow=function(){if(0===this._pool.length)this._onEnd&&this._onEnd.call(this._onEndTarget,null,[]);else for(var g= 0;gc?a+b+d:a.substring(0,c)+b+d},changeBasename:function(a,b,c){if(0===b.indexOf("."))return this.changeExtname(a,b);var d=a.indexOf("?"),e="";c=c?this.extname(a):"";0=d?0:d+1)+b+c+e},_normalize:function(a){a=String(a);do{var b=a;a=a.replace(this.normalizeRE,"")}while(b.length!==a.length);return a}}; var imagePool={_pool:Array(10),_MAX:10,_smallImg:"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",count:0,get:function(){if(0=h.length)m&&m();else{var l=this;l._createScript(cc.path.join(g,h[k]),!1,function(n){if(n)return m(n);l._loadJs4Dependency(g,h,k+1,m)})}},_loadJsImg:function(){var g=document,h=g.getElementById("cocos2d_loadJsImg");if(!h){h=document.createElement("img");cc._loadingImage&&(h.src=cc._loadingImage);g=g.getElementById(cc.game.config.id);g.style.backgroundColor="transparent"; g.parentNode.appendChild(h);var k=getComputedStyle?getComputedStyle(g):g.currentStyle;k||(k={width:g.width,height:g.height});h.style.left=g.offsetLeft+(parseFloat(k.width)-h.width)/2+"px";h.style.top=g.offsetTop+(parseFloat(k.height)-h.height)/2+"px";h.style.position="absolute"}return h},loadTxt:function(g,h){if(cc._isNodeJs)require("fs").readFile(g,function(q,r){q?h(q):h(null,r.toString())});else{var k=this.getXMLHttpRequest(),m="load "+g+" failed!";k.open("GET",g,!0);k.timeout=1E4;if(/msie/i.test(navigator.userAgent)&& !/opera/i.test(navigator.userAgent))k.setRequestHeader("Accept-Charset","utf-8"),k.onreadystatechange=function(){4===k.readyState&&(200===k.status||0===k.status?h(null,k.responseText):h({status:k.status,errorMessage:m},null))};else{k.overrideMimeType&&k.overrideMimeType("text/plain; charset=utf-8");var l=function(){k.removeEventListener("load",l);k.removeEventListener("error",n);0<=k._timeoutId?clearTimeout(k._timeoutId):k.removeEventListener("timeout",p);4===k.readyState&&(200===k.status||0===k.status? h(null,k.responseText):h({status:k.status,errorMessage:m},null))},n=function(){k.removeEventListener("load",l);k.removeEventListener("error",n);0<=k._timeoutId?clearTimeout(k._timeoutId):k.removeEventListener("timeout",p);h({status:k.status,errorMessage:m},null)},p=function(){k.removeEventListener("load",l);k.removeEventListener("error",n);0<=k._timeoutId?clearTimeout(k._timeoutId):k.removeEventListener("timeout",p);h({status:k.status,errorMessage:"Request timeout: "+m},null)};k.addEventListener("load", l);k.addEventListener("error",n);void 0===k.ontimeout?k._timeoutId=setTimeout(function(){p()},k.timeout):k.addEventListener("timeout",p)}k.send(null)}},loadCsb:function(g,h){var k=cc.loader.getXMLHttpRequest(),m="load "+g+" failed!";k.open("GET",g,!0);k.timeout=1E4;k.responseType="arraybuffer";var l=function(){k.removeEventListener("load",l);k.removeEventListener("error",n);0<=k._timeoutId?clearTimeout(k._timeoutId):k.removeEventListener("timeout",p);var q=k.response;q&&(window.msg=q);4===k.readyState&& (200===k.status||0===k.status?h(null,k.response):h({status:k.status,errorMessage:m},null))},n=function(){k.removeEventListener("load",l);k.removeEventListener("error",n);0<=k._timeoutId?clearTimeout(k._timeoutId):k.removeEventListener("timeout",p);h({status:k.status,errorMessage:m},null)},p=function(){k.removeEventListener("load",l);k.removeEventListener("error",n);0<=k._timeoutId?clearTimeout(k._timeoutId):k.removeEventListener("timeout",p);h({status:k.status,errorMessage:"Request timeout: "+m}, null)};k.addEventListener("load",l);k.addEventListener("error",n);void 0===k.ontimeout?k._timeoutId=setTimeout(function(){p()},k.timeout):k.addEventListener("timeout",p);k.send(null)},loadJson:function(g,h){this.loadTxt(g,function(k,m){if(k)h(k);else{try{var l=JSON.parse(m)}catch(n){throw Error("parse json ["+g+"] failed : "+n);}h(null,l)}})},_checkIsImageURL:function(g){return null!=/(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(g)},loadImg:function(g,h,k,m){var l={isCrossOrigin:!0};void 0!==k? l.isCrossOrigin=void 0===h.isCrossOrigin?l.isCrossOrigin:h.isCrossOrigin:void 0!==h&&(k=h);if(h=this.getRes(g))return k&&k(null,h),null;if(h=e[g])return h.callbacks.push(k),h.img;m=m||imagePool.get();l.isCrossOrigin&&(cc.sys.isNative&&0===g.indexOf("https:")||"file://"!==location.origin)?m.crossOrigin="Anonymous":m.crossOrigin=null;var n=setTimeout(function(){r("load image timeout")},6E4),p=function(){this.removeEventListener("load",p,!1);this.removeEventListener("error",r,!1);clearTimeout(n);var u= e[g];if(u){for(var w=u.callbacks,v=0;vb)return"";var c=a[0],d=!0;"object"===typeof c&&(d=!1);for(var e=1;ep)l[n.renderMode]=0;cc._renderType=cc.game.RENDER_TYPE_CANVAS;cc._supportRender=!1;0===p?cc.sys.capabilities.opengl?(cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0):cc.sys.capabilities.canvas&&(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender=!0):1===p&&cc.sys.capabilities.canvas?(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc._supportRender=!0):2===p&&cc.sys.capabilities.opengl&& (cc._renderType=cc.game.RENDER_TYPE_WEBGL,cc._supportRender=!0)}function b(l,n,p){if(h[n])return null;p=p||"";var q=[],r=l[n];if(!r)throw Error("can not find module ["+n+"]");n=cc.path;for(var u=0,w=r.length;ur.indexOf("base4webgl")?r.splice(0,0,"base4webgl"):0>r.indexOf("core")&&r.splice(0,0,"core");for(var v=0,t=r.length;vparseInt(C.substring(G+5,C.indexOf(".",G)))?(cc.sys.isMultiplyAllowed=!1,!0):A}();cc.sys.isMobile&&(w=document.createElement("style"),w.type="text/css",document.body.appendChild(w),w.textContent="body,canvas,div{ -moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;-khtml-user-select: none;-webkit-tap-highlight-color:rgba(0,0,0,0);}"); try{var z=l.localStorage=n.localStorage;z.setItem("storage","");z.removeItem("storage");z=null}catch(A){z=function(){cc.warn("Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option")},l.localStorage={getItem:z,setItem:z,removeItem:z,clear:z}}z=!!f.getContext("2d");w=!1;if(n.WebGLRenderingContext){t=document.createElement("CANVAS");try{if(cc.create3DContext(t)&&(w=!0),w&&l.os===l.OS_IOS&&9===l.osMainVersion&&(window.indexedDB||(w=!1)),w&&l.os===l.OS_ANDROID){var B=parseFloat(l.browserVersion); switch(l.browserType){case l.BROWSER_TYPE_MOBILE_QQ:case l.BROWSER_TYPE_BAIDU:case l.BROWSER_TYPE_BAIDU_APP:w=6.2<=B?!0:!1;break;case l.BROWSER_TYPE_CHROME:w=30<=B?!0:!1;break;case l.BROWSER_TYPE_ANDROID:l.osMainVersion&&5<=l.osMainVersion&&(w=!0);break;case l.BROWSER_TYPE_UNKNOWN:case l.BROWSER_TYPE_360:case l.BROWSER_TYPE_MIUI:case l.BROWSER_TYPE_UC:w=!1}}}catch(A){}t=null}B=l.capabilities={canvas:z,opengl:w};if(void 0!==r.ontouchstart||void 0!==q.ontouchstart||p.msPointerEnabled||0c.indexOf("core")&&c.splice(0,0,"core");c&&(a[b.modules]=c);this.config=a;this._configLoaded=!0},_initRenderer:function(a,b){if(!this._rendererInitialized){if(!cc._supportRender)throw Error("The renderer doesn't support the renderMode "+this.config[this.CONFIG_KEY.renderMode]);var c=this.config[cc.game.CONFIG_KEY.id],d=window;c=cc.$(c)||cc.$("#"+c);var e,f;"CANVAS"===c.tagName?(a=a||c.width, b=b||c.height,this.canvas=cc._canvas=e=c,this.container=cc.container=f=document.createElement("DIV"),e.parentNode&&e.parentNode.insertBefore(f,e)):("DIV"!==c.tagName&&cc.log("Warning: target element is not a DIV or CANVAS"),a=a||c.clientWidth,b=b||c.clientHeight,this.canvas=cc._canvas=e=cc.$(document.createElement("CANVAS")),this.container=cc.container=f=document.createElement("DIV"),c.appendChild(f));f.setAttribute("id","Cocos2dGameContainer");f.appendChild(e);this.frame=f.parentNode===document.body? document.documentElement:f.parentNode;e.addClass("gameCanvas");e.setAttribute("width",a||480);e.setAttribute("height",b||320);e.setAttribute("tabindex",99);cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._renderContext=cc._renderContext=cc.webglContext=cc.create3DContext(e,{stencil:!0,alpha:"undefined"!==typeof allowTransparentBackground,preserveDrawingBuffer:"undefined"!==typeof preserveDrawingBuffer}));this._renderContext?(cc.renderer=cc.rendererWebGL,d.gl=this._renderContext,cc.renderer.init(), cc._drawingUtil=new cc.DrawingPrimitiveWebGL(this._renderContext),cc.textureCache._initializingRenderer(),cc.glExt={},cc.glExt.instanced_arrays=d.gl.getExtension("ANGLE_instanced_arrays"),cc.glExt.element_uint=d.gl.getExtension("OES_element_index_uint")):(cc._renderType=cc.game.RENDER_TYPE_CANVAS,cc.renderer=cc.rendererCanvas,this._renderContext=cc._renderContext=new cc.CanvasContextWrapper(e.getContext("2d")),cc._drawingUtil=cc.DrawingPrimitiveCanvas?new cc.DrawingPrimitiveCanvas(this._renderContext): null);cc._gameDiv=f;cc.game.canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1};this.dispatchEvent(this.EVENT_RENDERER_INITED,!0);this._rendererInitialized=!0}},_initEvents:function(){this.config[this.CONFIG_KEY.registerSystemEvent]&&cc.inputManager.registerSystemEvent(this.canvas)}}; Function.prototype.bind=Function.prototype.bind||function(a){if(!cc.isFunction(this))throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};d.prototype=this.prototype;e.prototype=new d;return e};cc.EventHelper=function(){}; cc.EventHelper.prototype={constructor:cc.EventHelper,apply:function(a){a.addEventListener=cc.EventHelper.prototype.addEventListener;a.hasEventListener=cc.EventHelper.prototype.hasEventListener;a.removeEventListener=cc.EventHelper.prototype.removeEventListener;a.dispatchEvent=cc.EventHelper.prototype.dispatchEvent},addEventListener:function(a,b,c){if("load"===a&&this._textureLoaded)setTimeout(function(){b.call(c)},0);else{void 0===this._listeners&&(this._listeners={});var d=this._listeners;void 0=== d[a]&&(d[a]=[]);this.hasEventListener(a,b,c)||d[a].push({callback:b,eventTarget:c})}},hasEventListener:function(a,b,c){if(void 0===this._listeners)return!1;var d=this._listeners;if(void 0!==d[a]){a=0;for(var e=d.length;ab.DEBUG_MODE_ERROR){var c=cc._logToWebPage.bind(cc);cc.error=function(){c("ERROR : "+cc.formatStr.apply(cc,arguments))};cc.assert=function(d,e){if(!d&&e){for(var f=2;f=b.x||a.y>=b.y||a.x+a.width<=b.x+b.width||a.y+a.height<=b.y+b.height):!1};cc.rectGetMaxX=function(a){return a.x+a.width};cc.rectGetMidX=function(a){return a.x+a.width/2};cc.rectGetMinX=function(a){return a.x};cc.rectGetMaxY=function(a){return a.y+a.height};cc.rectGetMidY=function(a){return a.y+a.height/2};cc.rectGetMinY=function(a){return a.y}; cc.rectContainsPoint=function(a,b){return b.x>=cc.rectGetMinX(a)&&b.x<=cc.rectGetMaxX(a)&&b.y>=cc.rectGetMinY(a)&&b.y<=cc.rectGetMaxY(a)};cc.rectIntersectsRect=function(a,b){var c=a.y+a.height,d=b.x+b.width,e=b.y+b.height;return!(a.x+a.width>>0)+((b||0)<<16)+((c||0)<<8)+("number"===typeof d?d:255)};cc.Color.prototype._getR=function(){return(this._val&4278190080)>>>24};cc.Color.prototype._setR=function(a){this._val=this._val&16777215|a<<24>>>0};cc.Color.prototype._getG=function(){return(this._val&16711680)>>16};cc.Color.prototype._setG=function(a){this._val=this._val&4278255615|a<<16};cc.Color.prototype._getB=function(){return(this._val&65280)>>8}; cc.Color.prototype._setB=function(a){this._val=this._val&4294902015|a<<8};cc.Color.prototype._getA=function(){return this._val&255};cc.Color.prototype._setA=function(a){this._val=this._val&4294967040|a};cc.Color.prototype.r;cc.defineGetterSetter(cc.Color.prototype,"r",cc.Color.prototype._getR,cc.Color.prototype._setR);cc.Color.prototype.g;cc.defineGetterSetter(cc.Color.prototype,"g",cc.Color.prototype._getG,cc.Color.prototype._setG);cc.Color.prototype.b; cc.defineGetterSetter(cc.Color.prototype,"b",cc.Color.prototype._getB,cc.Color.prototype._setB);cc.Color.prototype.a;cc.defineGetterSetter(cc.Color.prototype,"a",cc.Color.prototype._getA,cc.Color.prototype._setA);cc.color=function(a,b,c,d){return void 0===a?new cc.Color(0,0,0,255):"object"===typeof a?new cc.Color(a.r,a.g,a.b,null==a.a?255:a.a):"string"===typeof a?cc.hexToColor(a):new cc.Color(a,b,c,null==d?255:d)};cc.colorEqual=function(a,b){return a.r===b.r&&a.g===b.g&&a.b===b.b}; cc.Acceleration=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.timestamp=d||0};cc.Vertex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Vertex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Vertex2F.BYTES_PER_ELEMENT=8;cc.Vertex2F.prototype._getX=function(){return this._view[0]};cc.Vertex2F.prototype._setX=function(a){this._view[0]=a};cc.Vertex2F.prototype._getY=function(){return this._view[1]}; cc.Vertex2F.prototype._setY=function(a){this._view[1]=a};cc.Vertex2F.prototype.x;cc.defineGetterSetter(cc.Vertex2F.prototype,"x",cc.Vertex2F.prototype._getX,cc.Vertex2F.prototype._setX);cc.Vertex2F.prototype.y;cc.defineGetterSetter(cc.Vertex2F.prototype,"y",cc.Vertex2F.prototype._getY,cc.Vertex2F.prototype._setY); cc.Vertex3F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.Vertex3F.BYTES_PER_ELEMENT);this._offset=e||0;this._view=new Float32Array(this._arrayBuffer,this._offset,3);this._view[0]=a||0;this._view[1]=b||0;this._view[2]=c||0};cc.Vertex3F.BYTES_PER_ELEMENT=12;cc.Vertex3F.prototype._getX=function(){return this._view[0]};cc.Vertex3F.prototype._setX=function(a){this._view[0]=a};cc.Vertex3F.prototype._getY=function(){return this._view[1]}; cc.Vertex3F.prototype._setY=function(a){this._view[1]=a};cc.Vertex3F.prototype._getZ=function(){return this._view[2]};cc.Vertex3F.prototype._setZ=function(a){this._view[2]=a};cc.Vertex3F.prototype.x;cc.defineGetterSetter(cc.Vertex3F.prototype,"x",cc.Vertex3F.prototype._getX,cc.Vertex3F.prototype._setX);cc.Vertex3F.prototype.y;cc.defineGetterSetter(cc.Vertex3F.prototype,"y",cc.Vertex3F.prototype._getY,cc.Vertex3F.prototype._setY);cc.Vertex3F.prototype.z; cc.defineGetterSetter(cc.Vertex3F.prototype,"z",cc.Vertex3F.prototype._getZ,cc.Vertex3F.prototype._setZ);cc.Tex2F=function(a,b,c,d){this._arrayBuffer=c||new ArrayBuffer(cc.Tex2F.BYTES_PER_ELEMENT);this._offset=d||0;this._view=new Float32Array(this._arrayBuffer,this._offset,2);this._view[0]=a||0;this._view[1]=b||0};cc.Tex2F.BYTES_PER_ELEMENT=8;cc.Tex2F.prototype._getU=function(){return this._view[0]};cc.Tex2F.prototype._setU=function(a){this._view[0]=a};cc.Tex2F.prototype._getV=function(){return this._view[1]}; cc.Tex2F.prototype._setV=function(a){this._view[1]=a};cc.Tex2F.prototype.u;cc.defineGetterSetter(cc.Tex2F.prototype,"u",cc.Tex2F.prototype._getU,cc.Tex2F.prototype._setU);cc.Tex2F.prototype.v;cc.defineGetterSetter(cc.Tex2F.prototype,"v",cc.Tex2F.prototype._getV,cc.Tex2F.prototype._setV); cc.Quad2=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad2.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex2F.BYTES_PER_ELEMENT;this._tl=a?new cc.Vertex2F(a.x,a.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._tr=b?new cc.Vertex2F(b.x,b.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._bl=c?new cc.Vertex2F(c.x,c.y,e,f):new cc.Vertex2F(0,0,e,f);f+=g;this._br=d?new cc.Vertex2F(d.x,d.y,e,f):new cc.Vertex2F(0,0,e,f)};cc.Quad2.BYTES_PER_ELEMENT=32; cc.Quad2.prototype._getTL=function(){return this._tl};cc.Quad2.prototype._setTL=function(a){this._tl._view[0]=a.x;this._tl._view[1]=a.y};cc.Quad2.prototype._getTR=function(){return this._tr};cc.Quad2.prototype._setTR=function(a){this._tr._view[0]=a.x;this._tr._view[1]=a.y};cc.Quad2.prototype._getBL=function(){return this._bl};cc.Quad2.prototype._setBL=function(a){this._bl._view[0]=a.x;this._bl._view[1]=a.y};cc.Quad2.prototype._getBR=function(){return this._br}; cc.Quad2.prototype._setBR=function(a){this._br._view[0]=a.x;this._br._view[1]=a.y};cc.Quad2.prototype.tl;cc.defineGetterSetter(cc.Quad2.prototype,"tl",cc.Quad2.prototype._getTL,cc.Quad2.prototype._setTL);cc.Quad2.prototype.tr;cc.defineGetterSetter(cc.Quad2.prototype,"tr",cc.Quad2.prototype._getTR,cc.Quad2.prototype._setTR);cc.Quad2.prototype.bl;cc.defineGetterSetter(cc.Quad2.prototype,"bl",cc.Quad2.prototype._getBL,cc.Quad2.prototype._setBL);cc.Quad2.prototype.br; cc.defineGetterSetter(cc.Quad2.prototype,"br",cc.Quad2.prototype._getBR,cc.Quad2.prototype._setBR); cc.Quad3=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.Quad3.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.Vertex3F.BYTES_PER_ELEMENT;this.bl=a?new cc.Vertex3F(a.x,a.y,a.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.br=b?new cc.Vertex3F(b.x,b.y,b.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.tl=c?new cc.Vertex3F(c.x,c.y,c.z,e,f):new cc.Vertex3F(0,0,0,e,f);f+=g;this.tr=d?new cc.Vertex3F(d.x,d.y,d.z,e,f):new cc.Vertex3F(0,0,0,e,f)}; cc.Quad3.BYTES_PER_ELEMENT=48;cc.V3F_C4B_T2F=function(a,b,c,d,e){this._arrayBuffer=d||new ArrayBuffer(cc.V3F_C4B_T2F.BYTES_PER_ELEMENT);this._offset=e||0;d=this._arrayBuffer;e=this._offset;this._vertices=a?new cc.Vertex3F(a.x,a.y,a.z,d,e):new cc.Vertex3F(0,0,0,d,e);e+=cc.Vertex3F.BYTES_PER_ELEMENT;this._colors=b?new cc._WebGLColor(b.r,b.g,b.b,b.a,d,e):new cc._WebGLColor(0,0,0,0,d,e);e+=cc._WebGLColor.BYTES_PER_ELEMENT;this._texCoords=c?new cc.Tex2F(c.u,c.v,d,e):new cc.Tex2F(0,0,d,e)}; cc.V3F_C4B_T2F.BYTES_PER_ELEMENT=24;cc.V3F_C4B_T2F.prototype._getVertices=function(){return this._vertices};cc.V3F_C4B_T2F.prototype._setVertices=function(a){var b=this._vertices;b._view[0]=a.x;b._view[1]=a.y;b._view[2]=a.z};cc.V3F_C4B_T2F.prototype._getColor=function(){return this._colors};cc.V3F_C4B_T2F.prototype._setColor=function(a){var b=this._colors;b._view[0]=a.r;b._view[1]=a.g;b._view[2]=a.b;b._view[3]=a.a};cc.V3F_C4B_T2F.prototype._getTexCoords=function(){return this._texCoords}; cc.V3F_C4B_T2F.prototype._setTexCoords=function(a){this._texCoords._view[0]=a.u;this._texCoords._view[1]=a.v};cc.V3F_C4B_T2F.prototype.vertices;cc.defineGetterSetter(cc.V3F_C4B_T2F.prototype,"vertices",cc.V3F_C4B_T2F.prototype._getVertices,cc.V3F_C4B_T2F.prototype._setVertices);cc.V3F_C4B_T2F.prototype.colors;cc.defineGetterSetter(cc.V3F_C4B_T2F.prototype,"colors",cc.V3F_C4B_T2F.prototype._getColor,cc.V3F_C4B_T2F.prototype._setColor);cc.V3F_C4B_T2F.prototype.texCoords; cc.defineGetterSetter(cc.V3F_C4B_T2F.prototype,"texCoords",cc.V3F_C4B_T2F.prototype._getTexCoords,cc.V3F_C4B_T2F.prototype._setTexCoords); cc.V3F_C4B_T2F_Quad=function(a,b,c,d,e,f){this._arrayBuffer=e||new ArrayBuffer(cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT);this._offset=f||0;e=this._arrayBuffer;f=this._offset;var g=cc.V3F_C4B_T2F.BYTES_PER_ELEMENT;this._tl=a?new cc.V3F_C4B_T2F(a.vertices,a.colors,a.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=g;this._bl=b?new cc.V3F_C4B_T2F(b.vertices,b.colors,b.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f);f+=g;this._tr=c?new cc.V3F_C4B_T2F(c.vertices,c.colors,c.texCoords,e,f):new cc.V3F_C4B_T2F(null, null,null,e,f);f+=g;this._br=d?new cc.V3F_C4B_T2F(d.vertices,d.colors,d.texCoords,e,f):new cc.V3F_C4B_T2F(null,null,null,e,f)};cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT=96;cc.V3F_C4B_T2F_Quad.prototype._getTL=function(){return this._tl};cc.V3F_C4B_T2F_Quad.prototype._setTL=function(a){var b=this._tl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};cc.V3F_C4B_T2F_Quad.prototype._getBL=function(){return this._bl}; cc.V3F_C4B_T2F_Quad.prototype._setBL=function(a){var b=this._bl;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};cc.V3F_C4B_T2F_Quad.prototype._getTR=function(){return this._tr};cc.V3F_C4B_T2F_Quad.prototype._setTR=function(a){var b=this._tr;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};cc.V3F_C4B_T2F_Quad.prototype._getBR=function(){return this._br}; cc.V3F_C4B_T2F_Quad.prototype._setBR=function(a){var b=this._br;b.vertices=a.vertices;b.colors=a.colors;b.texCoords=a.texCoords};cc.V3F_C4B_T2F_Quad.prototype._getArrayBuffer=function(){return this._arrayBuffer};cc.V3F_C4B_T2F_Quad.prototype.tl;cc.defineGetterSetter(cc.V3F_C4B_T2F_Quad.prototype,"tl",cc.V3F_C4B_T2F_Quad.prototype._getTL,cc.V3F_C4B_T2F_Quad.prototype._setTL);cc.V3F_C4B_T2F_Quad.prototype.tr; cc.defineGetterSetter(cc.V3F_C4B_T2F_Quad.prototype,"tr",cc.V3F_C4B_T2F_Quad.prototype._getTR,cc.V3F_C4B_T2F_Quad.prototype._setTR);cc.V3F_C4B_T2F_Quad.prototype.bl;cc.defineGetterSetter(cc.V3F_C4B_T2F_Quad.prototype,"bl",cc.V3F_C4B_T2F_Quad.prototype._getBL,cc.V3F_C4B_T2F_Quad.prototype._setBL);cc.V3F_C4B_T2F_Quad.prototype.br;cc.defineGetterSetter(cc.V3F_C4B_T2F_Quad.prototype,"br",cc.V3F_C4B_T2F_Quad.prototype._getBR,cc.V3F_C4B_T2F_Quad.prototype._setBR);cc.V3F_C4B_T2F_Quad.prototype.arrayBuffer; cc.defineGetterSetter(cc.V3F_C4B_T2F_Quad.prototype,"arrayBuffer",cc.V3F_C4B_T2F_Quad.prototype._getArrayBuffer,null);cc.V3F_C4B_T2F_QuadZero=function(){return new cc.V3F_C4B_T2F_Quad}; cc.V3F_C4B_T2F_QuadCopy=function(a){if(!a)return cc.V3F_C4B_T2F_QuadZero();var b=a.tl,c=a.bl,d=a.tr;a=a.br;return{tl:{vertices:{x:b.vertices.x,y:b.vertices.y,z:b.vertices.z},colors:{r:b.colors.r,g:b.colors.g,b:b.colors.b,a:b.colors.a},texCoords:{u:b.texCoords.u,v:b.texCoords.v}},bl:{vertices:{x:c.vertices.x,y:c.vertices.y,z:c.vertices.z},colors:{r:c.colors.r,g:c.colors.g,b:c.colors.b,a:c.colors.a},texCoords:{u:c.texCoords.u,v:c.texCoords.v}},tr:{vertices:{x:d.vertices.x,y:d.vertices.y,z:d.vertices.z}, colors:{r:d.colors.r,g:d.colors.g,b:d.colors.b,a:d.colors.a},texCoords:{u:d.texCoords.u,v:d.texCoords.v}},br:{vertices:{x:a.vertices.x,y:a.vertices.y,z:a.vertices.z},colors:{r:a.colors.r,g:a.colors.g,b:a.colors.b,a:a.colors.a},texCoords:{u:a.texCoords.u,v:a.texCoords.v}}}};cc.V3F_C4B_T2F_QuadsCopy=function(a){if(!a)return[];for(var b=[],c=0;c>16,(a>>8)%256,a%256)};cc.colorToHex=function(a){var b=a.r.toString(16),c=a.g.toString(16),d=a.b.toString(16);return"#"+(16>a.r?"0"+b:b)+(16>a.g?"0"+c:c)+(16>a.b?"0"+d:d)};cc.TEXT_ALIGNMENT_LEFT=0;cc.TEXT_ALIGNMENT_CENTER=1;cc.TEXT_ALIGNMENT_RIGHT=2;cc.VERTICAL_TEXT_ALIGNMENT_TOP=0; cc.VERTICAL_TEXT_ALIGNMENT_CENTER=1;cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM=2; cc._Dictionary=cc.Class.extend({_keyMapTb:null,_valueMapTb:null,__currId:0,ctor:function(){this._keyMapTb={};this._valueMapTb={};this.__currId=2<<(0|10*Math.random())},__getKey:function(){this.__currId++;return"key_"+this.__currId},setObject:function(a,b){if(null!=b){var c=this.__getKey();this._keyMapTb[c]=b;this._valueMapTb[c]=a}},objectForKey:function(a){if(null==a)return null;var b=this._keyMapTb,c;for(c in b)if(b[c]===a)return this._valueMapTb[c];return null},valueForKey:function(a){return this.objectForKey(a)}, removeObjectForKey:function(a){if(null!=a){var b=this._keyMapTb,c;for(c in b)if(b[c]===a){delete this._valueMapTb[c];delete b[c];break}}},removeObjectsForKeys:function(a){if(null!=a)for(var b=0;ba?0:a},cc._WebGLColor.prototype._getG=function(){return this._view[1]},cc._WebGLColor.prototype._setG=function(a){this._view[1]=0>a?0:a},cc._WebGLColor.prototype._getB=function(){return this._view[2]},cc._WebGLColor.prototype._setB=function(a){this._view[2]=0>a?0:a},cc._WebGLColor.prototype._getA=function(){return this._view[3]},cc._WebGLColor.prototype._setA=function(a){this._view[3]=0>a?0:a},cc.defineGetterSetter(cc._WebGLColor.prototype, "r",cc._WebGLColor.prototype._getR,cc._WebGLColor.prototype._setR),cc.defineGetterSetter(cc._WebGLColor.prototype,"g",cc._WebGLColor.prototype._getG,cc._WebGLColor.prototype._setG),cc.defineGetterSetter(cc._WebGLColor.prototype,"b",cc._WebGLColor.prototype._getB,cc._WebGLColor.prototype._setB),cc.defineGetterSetter(cc._WebGLColor.prototype,"a",cc._WebGLColor.prototype._getA,cc._WebGLColor.prototype._setA))});cc.color._getWhite=function(){return cc.color(255,255,255)}; cc.color._getYellow=function(){return cc.color(255,255,0)};cc.color._getBlue=function(){return cc.color(0,0,255)};cc.color._getGreen=function(){return cc.color(0,255,0)};cc.color._getRed=function(){return cc.color(255,0,0)};cc.color._getMagenta=function(){return cc.color(255,0,255)};cc.color._getBlack=function(){return cc.color(0,0,0)};cc.color._getOrange=function(){return cc.color(255,127,0)};cc.color._getGray=function(){return cc.color(166,166,166)};cc.color.WHITE; cc.defineGetterSetter(cc.color,"WHITE",cc.color._getWhite);cc.color.YELLOW;cc.defineGetterSetter(cc.color,"YELLOW",cc.color._getYellow);cc.color.BLUE;cc.defineGetterSetter(cc.color,"BLUE",cc.color._getBlue);cc.color.GREEN;cc.defineGetterSetter(cc.color,"GREEN",cc.color._getGreen);cc.color.RED;cc.defineGetterSetter(cc.color,"RED",cc.color._getRed);cc.color.MAGENTA;cc.defineGetterSetter(cc.color,"MAGENTA",cc.color._getMagenta);cc.color.BLACK;cc.defineGetterSetter(cc.color,"BLACK",cc.color._getBlack); cc.color.ORANGE;cc.defineGetterSetter(cc.color,"ORANGE",cc.color._getOrange);cc.color.GRAY;cc.defineGetterSetter(cc.color,"GRAY",cc.color._getGray);cc.BlendFunc._disable=function(){return new cc.BlendFunc(cc.ONE,cc.ZERO)};cc.BlendFunc._alphaPremultiplied=function(){return new cc.BlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA)};cc.BlendFunc._alphaNonPremultiplied=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE_MINUS_SRC_ALPHA)}; cc.BlendFunc._additive=function(){return new cc.BlendFunc(cc.SRC_ALPHA,cc.ONE)};cc.BlendFunc.DISABLE;cc.defineGetterSetter(cc.BlendFunc,"DISABLE",cc.BlendFunc._disable);cc.BlendFunc.ALPHA_PREMULTIPLIED;cc.defineGetterSetter(cc.BlendFunc,"ALPHA_PREMULTIPLIED",cc.BlendFunc._alphaPremultiplied);cc.BlendFunc.ALPHA_NON_PREMULTIPLIED;cc.defineGetterSetter(cc.BlendFunc,"ALPHA_NON_PREMULTIPLIED",cc.BlendFunc._alphaNonPremultiplied);cc.BlendFunc.ADDITIVE;cc.defineGetterSetter(cc.BlendFunc,"ADDITIVE",cc.BlendFunc._additive);cc.Touches=[];cc.TouchesIntergerDict={};cc.DENSITYDPI_DEVICE="device-dpi";cc.DENSITYDPI_HIGH="high-dpi";cc.DENSITYDPI_MEDIUM="medium-dpi";cc.DENSITYDPI_LOW="low-dpi";var __BrowserGetter={init:function(){this.html=document.documentElement},availWidth:function(a){return a&&a!==this.html?a.clientWidth:window.innerWidth},availHeight:function(a){return a&&a!==this.html?a.clientHeight:window.innerHeight},meta:{width:"device-width"},adaptationType:cc.sys.browserType}; -1Math.abs(a-c)&&(c=a);2>Math.abs(b-d)&&(d=b);a=cc.rect(Math.round((a-c)/2),Math.round((b-d)/2),c,d);this._result.scale=[e,f];this._result.viewport=a;return this._result},preApply:function(a){},apply:function(a,b){return{scale:[1,1]}},postApply:function(a){}}); (function(){var a=cc.ContainerStrategy.extend({apply:function(f){var g=f._frameSize.height,h=cc.container.style;this._setupContainer(f,f._frameSize.width,f._frameSize.height);h.margin=f._isRotated?"0 0 0 "+g+"px":"0px"}}),b=cc.ContainerStrategy.extend({apply:function(f,g){var h=f._frameSize.width,k=f._frameSize.height,m=cc.container.style,l=g.width;g=g.height;var n=h/l,p=k/g,q,r;nthis.TOUCH_TIMEOUT)return this._removeUsedIndexBit(c), delete this._touchesIntegerDict[d.getID()],c}else return this._indexBitsUsed|=1<>=1}return-1},_removeUsedIndexBit:function(a){0>a||a>=this._maxTouches||(this._indexBitsUsed&=~(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}};cc.inputManager.setAccelerometerEnabled=function(a){this._accelEnabled!==a&&(this._accelEnabled=a,a=cc.director.getScheduler(),this._accelEnabled?(this._accelCurTime=0,this._registerAccelerometerEvent(),a.scheduleUpdate(this)):(this._accelCurTime=0,this._unregisterAccelerometerEvent(),a.unscheduleUpdate(this)))};cc.inputManager.setAccelerometerInterval=function(a){this._accelInterval!==a&&(this._accelInterval=a)}; cc.inputManager._registerKeyboardEvent=function(){cc._canvas.addEventListener("keydown",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!0))},!1);cc._canvas.addEventListener("keyup",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!1))},!1)}; cc.inputManager._registerAccelerometerEvent=function(){var a=window;this._acceleration=new cc.Acceleration;this._accelDeviceEvent=a.DeviceMotionEvent||a.DeviceOrientationEvent;cc.sys.browserType===cc.sys.BROWSER_TYPE_MOBILE_QQ&&(this._accelDeviceEvent=window.DeviceOrientationEvent);var b=this._accelDeviceEvent===a.DeviceMotionEvent?"devicemotion":"deviceorientation",c=navigator.userAgent;if(/Android/.test(c)||/Adr/.test(c)&&cc.sys.browserType===cc.BROWSER_TYPE_UC)this._minus=-1;this.didAccelerateCallback= this.didAccelerate.bind(this);a.addEventListener(b,this.didAccelerateCallback,!1)};cc.inputManager._unregisterAccelerometerEvent=function(){this._acceleration=null;window.removeEventListener(this._accelDeviceEvent===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this.didAccelerateCallback,!1)}; cc.inputManager.didAccelerate=function(a){var b=window;if(this._accelEnabled){var c=this._acceleration;if(this._accelDeviceEvent===window.DeviceMotionEvent){var d=a.accelerationIncludingGravity;var e=this._accelMinus*d.x*.1;var f=this._accelMinus*d.y*.1;d=.1*d.z}else e=a.gamma/90*.981,f=.981*-(a.beta/90),d=a.alpha/90*.981;c.x=e;c.y=f;c.z=d;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)}};cc.AffineTransform=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.tx=e;this.ty=f};cc.affineTransformMake=function(a,b,c,d,e,f){return{a:a,b:b,c:c,d:d,tx:e,ty:f}};cc.pointApplyAffineTransform=function(a,b,c){if(void 0===c){c=b;var d=a.x;a=a.y}else d=a,a=b;return{x:c.a*d+c.c*a+c.tx,y:c.b*d+c.d*a+c.ty}};cc._pointApplyAffineTransform=function(a,b,c){return cc.pointApplyAffineTransform(a,b,c)}; cc.sizeApplyAffineTransform=function(a,b){return{width:b.a*a.width+b.c*a.height,height:b.b*a.width+b.d*a.height}};cc.affineTransformMakeIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}};cc.affineTransformIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}; cc.rectApplyAffineTransform=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a);a=cc.pointApplyAffineTransform(d,c,b);c=cc.pointApplyAffineTransform(e,c,b);d=cc.pointApplyAffineTransform(d,f,b);b=cc.pointApplyAffineTransform(e,f,b);e=Math.min(a.x,c.x,d.x,b.x);f=Math.min(a.y,c.y,d.y,b.y);return cc.rect(e,f,Math.max(a.x,c.x,d.x,b.x)-e,Math.max(a.y,c.y,d.y,b.y)-f)}; 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);var h=cc.pointApplyAffineTransform(e,f,b);b=Math.min(g.x,c.x,d.x,h.x);e=Math.max(g.x,c.x,d.x,h.x);f=Math.min(g.y,c.y,d.y,h.y);g=Math.max(g.y,c.y,d.y,h.y);a.x=b;a.y=f;a.width=e-b;a.height=g-f;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);b=Math.cos(b);return{a:a.a*b+a.c*c,b:a.b*b+a.d*c,c:a.c*b-a.a*c,d:a.d*b-a.b*c,tx:a.tx,ty:a.ty}}; cc.affineTransformConcat=function(a,b){return{a:a.a*b.a+a.b*b.c,b:a.a*b.b+a.b*b.d,c:a.c*b.a+a.d*b.c,d:a.c*b.b+a.d*b.d,tx:a.tx*b.a+a.ty*b.c+b.tx,ty:a.tx*b.b+a.ty*b.d+b.ty}};cc.affineTransformConcatIn=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,g=a.tx,h=a.ty;a.a=c*b.a+d*b.c;a.b=c*b.b+d*b.d;a.c=e*b.a+f*b.c;a.d=e*b.b+f*b.d;a.tx=g*b.a+h*b.c+b.tx;a.ty=g*b.b+h*b.d+b.ty;return a};cc.affineTransformEqualToTransform=function(a,b){return a.a===b.a&&a.b===b.b&&a.c===b.c&&a.d===b.d&&a.tx===b.tx&&a.ty===b.ty}; cc.affineTransformInvert=function(a){var b=1/(a.a*a.d-a.b*a.c);return{a:b*a.d,b:-b*a.b,c:-b*a.c,d:b*a.a,tx:b*(a.c*a.ty-a.d*a.tx),ty:b*(a.b*a.tx-a.a*a.ty)}};cc.affineTransformInvertOut=function(a,b){var c=a.a,d=a.b,e=a.c,f=a.d,g=1/(c*f-d*e);b.a=g*f;b.b=-g*d;b.c=-g*e;b.d=g*c;b.tx=g*(e*a.ty-f*a.tx);b.ty=g*(d*a.tx-c*a.ty)};cc.POINT_EPSILON=parseFloat("1.192092896e-07F");cc.pNeg=function(a){return cc.p(-a.x,-a.y)};cc.pAdd=function(a,b){return cc.p(a.x+b.x,a.y+b.y)};cc.pSub=function(a,b){return cc.p(a.x-b.x,a.y-b.y)};cc.pMult=function(a,b){return cc.p(a.x*b,a.y*b)};cc.pMidpoint=function(a,b){return cc.pMult(cc.pAdd(a,b),.5)};cc.pDot=function(a,b){return a.x*b.x+a.y*b.y};cc.pCross=function(a,b){return a.x*b.y-a.y*b.x};cc.pPerp=function(a){return cc.p(-a.y,a.x)};cc.pRPerp=function(a){return cc.p(a.y,-a.x)}; cc.pProject=function(a,b){return cc.pMult(b,cc.pDot(a,b)/cc.pDot(b,b))};cc.pRotate=function(a,b){return cc.p(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x)};cc.pUnrotate=function(a,b){return cc.p(a.x*b.x+a.y*b.y,a.y*b.x-a.x*b.y)};cc.pLengthSQ=function(a){return cc.pDot(a,a)};cc.pDistanceSQ=function(a,b){return cc.pLengthSQ(cc.pSub(a,b))};cc.pLength=function(a){return Math.sqrt(cc.pLengthSQ(a))};cc.pDistance=function(a,b){return cc.pLength(cc.pSub(a,b))}; cc.pNormalize=function(a){var b=cc.pLength(a);return 0===b?cc.p(a):cc.pMult(a,1/b)};cc.pForAngle=function(a){return cc.p(Math.cos(a),Math.sin(a))};cc.pToAngle=function(a){return Math.atan2(a.y,a.x)};cc.clampf=function(a,b,c){if(b>c){var d=b;b=c;c=d}return a=e.x&&0<=e.y&&1>=e.y?!0:!1};cc.pIntersectPoint=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)?(c=cc.p(0,0),c.x=a.x+e.x*(b.x-a.x),c.y=a.y+e.x*(b.y-a.y),c):cc.p(0,0)};cc.pSameAs=function(a,b){return null!=a&&null!=b?a.x===b.x&&a.y===b.y:!1};cc.pZeroIn=function(a){a.x=0;a.y=0};cc.pIn=function(a,b){a.x=b.x;a.y=b.y};cc.pMultIn=function(a,b){a.x*=b;a.y*=b}; cc.pSubIn=function(a,b){a.x-=b.x;a.y-=b.y};cc.pAddIn=function(a,b){a.x+=b.x;a.y+=b.y};cc.pNormalizeIn=function(a){var b=Math.sqrt(a.x*a.x+a.y*a.y);0!==b&&cc.pMultIn(a,1/b)};cc.vertexLineToPolygon=function(a,b,c,d,e){e+=d;if(!(1>=e)){b*=.5;for(var f,g=e-1,h=d;hb.value||1k.getLocalZOrder())this._visitTarget(k,!1,d);else break;for(this._visitCurrent(b,d);f=c?(delete this._spaces[b],d>c&&(this._spaces[b+c]=d-c),!0):!1},requestBuffer:function(b){var c;for(c in this._spaces){var d=parseInt(c);var e=this._spaces[c];if(e>=b&&this.allocBuffer(d,b))return d}return-1},freeBuffer:function(b,c){var d=this._spaces,e;for(e in d){var f=parseInt(e);if(f>b)break;if(f+d[e]>=b){c=c+b-f;b=f;break}}d=b+c;this._spaces[d]&&(c+=this._spaces[d],delete this._spaces[d]);this._spaces[b]=c},setDirty:function(){this._dirty=!0},update:function(){if(this._dirty){var b=cc._renderContext; this.gl.bindBuffer(b.ARRAY_BUFFER,this.vertexBuffer);this.gl.bufferSubData(b.ARRAY_BUFFER,0,this.dataArray);this._dirty=!1}},updateSubData:function(b,c){var d=cc._renderContext;this.gl.bindBuffer(d.ARRAY_BUFFER,this.vertexBuffer);this.gl.bufferSubData(d.ARRAY_BUFFER,b,c)},destroy:function(){this.gl.deleteBuffer(this.vertexBuffer);this.vertexBuffer=this.texCoords=this.colors=this.positions=this.data=null}};return a}();cc.rendererCanvas={childrenOrderDirty:!0,assignedZ:0,assignedZStep:1E-4,_transformNodePool:[],_renderCmds:[],_isCacheToCanvasOn:!1,_cacheToCanvasCmds:{},_cacheInstanceIds:[],_currentID:0,_clearColor:cc.color(),_clearFillStyle:"rgb(0, 0, 0)",_dirtyRegion:null,_allNeedDraw:!0,_enableDirtyRegion:!1,_debugDirtyRegion:!1,_canUseDirtyRegion:!1,_dirtyRegionCountThreshold:10,getRenderCmd:function(a){return a._createRenderCmd()},enableDirtyRegion:function(a){this._enableDirtyRegion=a},isDirtyRegionEnabled:function(){return this._enableDirtyRegion}, setDirtyRegionCountThreshold:function(a){this._dirtyRegionCountThreshold=a},_collectDirtyRegion:function(){var a=this._renderCmds,b,c=this._dirtyRegion,d=0,e=!0,f=cc.Node.CanvasRenderCmd.RegionStatus;var g=0;for(b=a.length;gf.NotDirty&&(++d,d>this._dirtyRegionCountThreshold&&(e=!1),e&&(!m.isEmpty()&&c.addRegion(m),h._regionFlag>f.Dirty&&!k.isEmpty()&&c.addRegion(k)),h._regionFlag=f.NotDirty)}return e},_beginDrawDirtyRegion:function(a){var b= a.getContext(),c=this._dirtyRegion.getDirtyRegions();b.save();a.setTransform({a:1,b:0,c:0,d:1,tx:0,ty:0},a._scaleX,a._scaleY);b.beginPath();a=0;for(var d=c.length;a=h&&(this._batchRendering(),t._target&&t._target._node&& t._target._node.showDrawCall&&t._target._node.showDrawCall());var x=t._node,y=x._texture||x._spriteFrame&&x._spriteFrame._texture,z=x._blendFunc.src;x=x._blendFunc.dst;var B=t._glProgramState;if(e||a!==y||b!==z||c!==x||d!==B)this._batchRendering(),t._node&&t._node.showDrawCall&&t._node.showDrawCall(),a=y,b=z,c=x,d=B,e=!1;y=t.uploadData(p,q,6*k);0.5*h;y&&(y.apply(),y.getGLProgram()._updateProjectionUniform()); cc.glBlendFunc(b,c);cc.glBindTexture2DN(0,x);t.bindBuffer(t.ARRAY_BUFFER,g);z?t.bufferData(t.ARRAY_BUFFER,p,t.DYNAMIC_DRAW):(x=p.subarray(0,6*k),t.bufferData(t.ARRAY_BUFFER,x,t.DYNAMIC_DRAW));t.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);t.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);t.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);t.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,t.FLOAT,!1,24,0);t.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,t.UNSIGNED_BYTE,!0,24,12);t.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS, 2,t.FLOAT,!1,24,16);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,f);if(!u||!w||m>u)z?t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.DYNAMIC_DRAW):t.bufferData(t.ELEMENT_ARRAY_BUFFER,r.subarray(0,m),t.DYNAMIC_DRAW);t.drawElements(t.TRIANGLES,m,t.UNSIGNED_SHORT,0);cc.g_NumberOfDraws++;w?u=m:(u=0,w=!0);cc.g_NumberOfVertexes+=k;m=k=0}},rendering:function(t,x){x=x||this._renderCmds;var y,z=t||cc._renderContext;z.bindBuffer(cc._renderContext.ARRAY_BUFFER,null);t=0;for(y=x.length;t=this._width||0>=this._height?this.setTo(a._minX,a._minY,a._maxX,a._maxY):(this._minX>a._minX&&(this._minX=a._minX),this._minY>a._minY&&(this._minY=a._minY),this._maxX=this._width||0>=this._height}; regionProto.intersects=function(a){if(0>=this._width||0>=this._height||0>=a._width||0>=a._height)return!1;var b=this._minX>a._minX?this._minX:a._minX,c=this._maxXc)return!1;b=this._minY>a._minY?this._minY:a._minY;c=this._maxYp&&(l=n,n=p,p=l);q>g&&(l=q,q=g,g=l);d=(ng?p:g)+1;a>k&&(l=a,a=k,k=l);m>b&&(l=m,m=b,b=l);a=(ab?k:b)+1}this._minX=d;this._minY=a;this._maxX= g;this._maxY=b;this._width=g-d;this._height=b-a;this._area=this._width*this._height}};function unionArea(a,b){return((a._maxX>b._maxX?a._maxX:b._maxX)-(a._minXb._maxY?a._maxY:b._maxY)-(a._minYb&&(b=0),0>c&&(c=0),d>this.clipWidth&&(d=this.clipWidth),a>this.clipHeight&&(a=this.clipHeight));if(b>=d||c>=a)return!1;if(this.clipRectChanged)return!0;var e=this.dirtyList,f=regionCreate();e.push(f.setTo(b,c,d,a));this.mergeDirtyList(e);return!0};dirtyRegionProto.clear=function(){for(var a=this.dirtyList,b=a.length,c=0;cb)return!1;for(var c=this.hasClipRect,d=3l&&(e=h,f=m,d=l)}}c&&.95=cc.Node._stateCallbackType.max)){var b= 0,c,d,e,f=cc.Node._performStacks[cc.Node._performing];f||(f=[],cc.Node._performStacks.push(f));f.length=0;cc.Node._performing++;for(d=f[0]=this;d;){if((c=d._children)&&0e._localZOrder)e.visit(this);else break}for(this.visitCurrent();a"},releaseData:function(a){},keepData:function(a,b){return a},initWithData:function(a,b,c,d,e){var f=cc.Texture2D,g=cc._renderContext,h=g.RGBA,k=g.UNSIGNED_BYTE,m=c*cc.Texture2D._B[b]/8;0===m%8?g.pixelStorei(g.UNPACK_ALIGNMENT,8):0===m%4?g.pixelStorei(g.UNPACK_ALIGNMENT,4):0===m%2?g.pixelStorei(g.UNPACK_ALIGNMENT,2):g.pixelStorei(g.UNPACK_ALIGNMENT,1);this._webTextureObj=g.createTexture(); cc.glBindTexture2D(this);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE);g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);switch(b){case f.PIXEL_FORMAT_RGBA8888:h=g.RGBA;break;case f.PIXEL_FORMAT_RGB888:h=g.RGB;break;case f.PIXEL_FORMAT_RGBA4444:k=g.UNSIGNED_SHORT_4_4_4_4;break;case f.PIXEL_FORMAT_RGB5A1:k=g.UNSIGNED_SHORT_5_5_5_1;break;case f.PIXEL_FORMAT_RGB565:k= g.UNSIGNED_SHORT_5_6_5;break;case f.PIXEL_FORMAT_AI88:h=g.LUMINANCE_ALPHA;break;case f.PIXEL_FORMAT_A8:h=g.ALPHA;break;case f.PIXEL_FORMAT_I8:h=g.LUMINANCE;break;default:cc.assert(0,cc._LogInfos.Texture2D_initWithData)}g.texImage2D(g.TEXTURE_2D,0,h,c,d,0,h,k,a);this._contentSize.width=e.width;this._contentSize.height=e.height;this._pixelsWide=c;this._pixelsHigh=d;this._pixelFormat=b;this.maxS=e.width/c;this.maxT=e.height/d;this._hasMipmaps=this._hasPremultipliedAlpha=!1;this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE); return this._textureLoaded=!0},drawAtPoint:function(a){var b=[0,this.maxT,this.maxS,this.maxT,0,0,this.maxS,0],c=cc._renderContext,d=this._pixelsWide*this.maxS,e=this._pixelsHigh*this.maxT;a=[a.x,a.y,0,d+a.x,a.y,0,a.x,e+a.y,0,d+a.x,e+a.y,0];this._glProgramState.apply();this._glProgramState._glprogram.setUniformsForBuiltins();cc.glBindTexture2D(this);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 2,c.FLOAT,!1,0,a);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,c.FLOAT,!1,0,b);c.drawArrays(c.TRIANGLE_STRIP,0,4)},drawInRect:function(a){var b=[0,this.maxT,this.maxS,this.maxT,0,0,this.maxS,0];a=[a.x,a.y,a.x+a.width,a.y,a.x,a.y+a.height,a.x+a.width,a.y+a.height];this._glProgramState.apply();this._glProgramState._glprogram.setUniformsForBuiltins();cc.glBindTexture2D(this);var c=cc._renderContext;c.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);c.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS); c.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,c.FLOAT,!1,0,a);c.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,c.FLOAT,!1,0,b);c.drawArrays(c.TRIANGLE_STRIP,0,4)},initWithImage:function(a){if(null==a)return cc.log(cc._LogInfos.Texture2D_initWithImage),!1;var b=a.getWidth(),c=a.getHeight(),d=cc.configuration.getMaxTextureSize();if(b>d||c>d)return cc.log(cc._LogInfos.Texture2D_initWithImage_2,b,c,d,d),!1;this._textureLoaded=!0;return this._initPremultipliedATextureWithImage(a,b,c)},initWithElement:function(a){a&& (this._webTextureObj=cc._renderContext.createTexture(),this._htmlElementObj=a,this._hasPremultipliedAlpha=this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj},isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(a){a=void 0!==a?a:this._hasPremultipliedAlpha;if(cc.game._rendererInitialized&&this._htmlElementObj&&this._htmlElementObj.width&&this._htmlElementObj.height){var b=cc._renderContext;cc.glBindTexture2D(this);b.pixelStorei(b.UNPACK_ALIGNMENT, 4);a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,this._htmlElementObj);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURE);cc.glBindTexture2D(null);a&&b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);b=this._htmlElementObj.height;this._pixelsWide=this._contentSize.width=this._htmlElementObj.width;this._pixelsHigh=this._contentSize.height=b;this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888;this.maxT=this.maxS=1;this._hasPremultipliedAlpha=a;this._hasMipmaps=!1;window.ENABLE_IMAEG_POOL&&(this._htmlElementObj=null);this.dispatchEvent("load")}},initWithString:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithString);return null},initWithETCFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithETCFile_2); return!1},initWithPVRFile:function(a){cc.log(cc._LogInfos.Texture2D_initWithPVRFile_2);return!1},initWithPVRTCData:function(a,b,c,d,e,f){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData_2);return!1},setTexParameters:function(a,b,c,d){var e=cc._renderContext;void 0!==b&&(a={minFilter:a,magFilter:b,wrapS:c,wrapT:d});cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh)||a.wrapS===e.CLAMP_TO_EDGE&&a.wrapT===e.CLAMP_TO_EDGE,"WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures"); cc.glBindTexture2D(this);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a.minFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,a.magFilter);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,a.wrapS);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,a.wrapT)},setAntiAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER,a.LINEAR)},setAliasTexParameters:function(){var a=cc._renderContext;cc.glBindTexture2D(this);this._hasMipmaps?a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST_MIPMAP_NEAREST):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST)},generateMipmap:function(){cc.assert(this._pixelsWide===cc.NextPOT(this._pixelsWide)&&this._pixelsHigh===cc.NextPOT(this._pixelsHigh),"Mimpap texture only works in POT textures"); cc.glBindTexture2D(this);cc._renderContext.generateMipmap(cc._renderContext.TEXTURE_2D);this._hasMipmaps=!0},stringForFormat:function(){return cc.Texture2D._M[this._pixelFormat]},bitsPerPixelForFormat:function(a){a=a||this._pixelFormat;var b=cc.Texture2D._B[a];if(null!=b)return b;cc.log(cc._LogInfos.Texture2D_bitsPerPixelForFormat,a);return-1},_initPremultipliedATextureWithImage:function(a,b,c){var d=cc.Texture2D,e=a.getData(),f=a.hasAlpha(),g=cc.size(a.getWidth(),a.getHeight()),h=d.defaultPixelFormat, k=a.getBitsPerComponent();f||(8<=k?h=d.PIXEL_FORMAT_RGB888:(cc.log(cc._LogInfos.Texture2D__initPremultipliedATextureWithImage),h=d.PIXEL_FORMAT_RGB565));var m=b*c;if(h===d.PIXEL_FORMAT_RGB565)if(f){e=new Uint16Array(b*c);var l=a.getData();for(k=0;k>0&255)>>3<<11|(l[k]>>8&255)>>2<<5|(l[k]>>16&255)>>3<<0}else for(e=new Uint16Array(b*c),l=a.getData(),k=0;k>3<<11|(l[k]&255)>>2<<5|(l[k]&255)>>3<<0;else if(h===d.PIXEL_FORMAT_RGBA4444)for(e=new Uint16Array(b*c),l= a.getData(),k=0;k>0&255)>>4<<12|(l[k]>>8&255)>>4<<8|(l[k]>>16&255)>>4<<4|(l[k]>>24&255)>>4<<0;else if(h===d.PIXEL_FORMAT_RGB5A1)for(e=new Uint16Array(b*c),l=a.getData(),k=0;k>0&255)>>3<<11|(l[k]>>8&255)>>3<<6|(l[k]>>16&255)>>3<<1|(l[k]>>24&255)>>7<<0;else if(h===d.PIXEL_FORMAT_A8)for(e=new Uint8Array(b*c),l=a.getData(),k=0;k>24&255;if(f&&h===d.PIXEL_FORMAT_RGB888)for(l=a.getData(),e=new Uint8Array(b*c*3),k=0;k>0&255,e[3*k+1]=l>>8&255, e[3*k+2]=l>>16&255;this.initWithData(e,h,b,c,g);a.getData();this._hasPremultipliedAlpha=a.isPremultipliedAlpha();return!0},addLoadedEventListener:function(a,b){this.addEventListener("load",a,b)},removeLoadedEventListener:function(a){this.removeEventTarget("load",a)}})}; cc._tmp.WebGLTextureAtlas=function(){var a=cc.TextureAtlas.prototype;a._setupVBO=function(){var b=cc._renderContext;this._buffersVBO[0]=b.createBuffer();this._buffersVBO[1]=b.createBuffer();this._quadsWebBuffer=b.createBuffer();this._mapBuffers()};a._mapBuffers=function(){var b=cc._renderContext;b.bindBuffer(b.ARRAY_BUFFER,this._quadsWebBuffer);b.bufferData(b.ARRAY_BUFFER,this._quadsArrayBuffer,b.DYNAMIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);b.bufferData(b.ELEMENT_ARRAY_BUFFER, this._indices,b.STATIC_DRAW)};a.drawNumberOfQuads=function(b,c){c=c||0;if(0!==b&&this.texture&&this.texture.isLoaded()){var d=cc._renderContext;cc.glBindTexture2D(this.texture);d.bindBuffer(d.ARRAY_BUFFER,this._quadsWebBuffer);this.dirty&&(d.bufferData(d.ARRAY_BUFFER,this._quadsArrayBuffer,d.DYNAMIC_DRAW),this.dirty=!1);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);d.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS);d.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION, 3,d.FLOAT,!1,24,0);d.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,d.UNSIGNED_BYTE,!0,24,12);d.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,d.FLOAT,!1,24,16);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,this._buffersVBO[1]);cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP?d.drawElements(d.TRIANGLE_STRIP,6*b,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT):d.drawElements(d.TRIANGLES,6*b,d.UNSIGNED_SHORT,6*c*this._indices.BYTES_PER_ELEMENT);cc.g_NumberOfDraws++}}}; cc._tmp.WebGLTextureCache=function(){var a=cc.textureCache;a.handleLoadedTexture=function(b,c){var d=this._textures;cc.game._rendererInitialized||(d=this._loadedTexturesBefore);var e=d[b];e||(e=d[b]=new cc.Texture2D,e.url=b);e.initWithElement(c);".png"===cc.path.extname(b)?e.handleLoadedTexture(!0):e.handleLoadedTexture();return e};a.addImage=function(b,c,d){cc.assert(b,cc._LogInfos.Texture2D_addImage_2);var e=this._textures;cc.game._rendererInitialized||(e=this._loadedTexturesBefore);var f=e[b]|| e[cc.loader._getAliase(b)];if(f)return f.isLoaded()?c&&c.call(d,f):f.addEventListener("load",function(){c&&c.call(d,f)},d),f;f=e[b]=new cc.Texture2D;f.url=b;e=cc.loader.getBasePath?cc.loader.getBasePath():cc.loader.resPath;cc.loader.loadImg(cc.path.join(e||"",b),function(g,h){if(g)return c&&c.call(d,g);g=cc.textureCache.handleLoadedTexture(b,h);c&&c.call(d,g)});return f};a.addImageAsync=a.addImage;a=null};cc._tmp.PrototypeTexture2D=function(){var a=cc.Texture2D;a.PVRImagesHavePremultipliedAlpha=function(c){cc.PVRHaveAlphaPremultiplied_=c};a.PIXEL_FORMAT_RGBA8888=2;a.PIXEL_FORMAT_RGB888=3;a.PIXEL_FORMAT_RGB565=4;a.PIXEL_FORMAT_A8=5;a.PIXEL_FORMAT_I8=6;a.PIXEL_FORMAT_AI88=7;a.PIXEL_FORMAT_RGBA4444=8;a.PIXEL_FORMAT_RGB5A1=7;a.PIXEL_FORMAT_PVRTC4=9;a.PIXEL_FORMAT_PVRTC2=10;a.PIXEL_FORMAT_DEFAULT=a.PIXEL_FORMAT_RGBA8888;a.defaultPixelFormat=a.PIXEL_FORMAT_DEFAULT;var b=cc.Texture2D._M={};b[a.PIXEL_FORMAT_RGBA8888]= "RGBA8888";b[a.PIXEL_FORMAT_RGB888]="RGB888";b[a.PIXEL_FORMAT_RGB565]="RGB565";b[a.PIXEL_FORMAT_A8]="A8";b[a.PIXEL_FORMAT_I8]="I8";b[a.PIXEL_FORMAT_AI88]="AI88";b[a.PIXEL_FORMAT_RGBA4444]="RGBA4444";b[a.PIXEL_FORMAT_RGB5A1]="RGB5A1";b[a.PIXEL_FORMAT_PVRTC4]="PVRTC4";b[a.PIXEL_FORMAT_PVRTC2]="PVRTC2";b=cc.Texture2D._B={};b[a.PIXEL_FORMAT_RGBA8888]=32;b[a.PIXEL_FORMAT_RGB888]=24;b[a.PIXEL_FORMAT_RGB565]=16;b[a.PIXEL_FORMAT_A8]=8;b[a.PIXEL_FORMAT_I8]=8;b[a.PIXEL_FORMAT_AI88]=16;b[a.PIXEL_FORMAT_RGBA4444]= 16;b[a.PIXEL_FORMAT_RGB5A1]=16;b[a.PIXEL_FORMAT_PVRTC4]=4;b[a.PIXEL_FORMAT_PVRTC2]=3;a=cc.Texture2D.prototype;a.name;cc.defineGetterSetter(a,"name",a.getName);a.pixelFormat;cc.defineGetterSetter(a,"pixelFormat",a.getPixelFormat);a.pixelsWidth;cc.defineGetterSetter(a,"pixelsWidth",a.getPixelsWide);a.pixelsHeight;cc.defineGetterSetter(a,"pixelsHeight",a.getPixelsHigh);a.width;cc.defineGetterSetter(a,"width",a._getWidth);a.height;cc.defineGetterSetter(a,"height",a._getHeight)}; cc._tmp.PrototypeTextureAtlas=function(){var a=cc.TextureAtlas.prototype;a.totalQuads;cc.defineGetterSetter(a,"totalQuads",a.getTotalQuads);a.capacity;cc.defineGetterSetter(a,"capacity",a.getCapacity);a.quads;cc.defineGetterSetter(a,"quads",a.getQuads,a.setQuads)};cc.ALIGN_CENTER=51;cc.ALIGN_TOP=19;cc.ALIGN_TOP_RIGHT=18;cc.ALIGN_RIGHT=50;cc.ALIGN_BOTTOM_RIGHT=34;cc.ALIGN_BOTTOM=35;cc.ALIGN_BOTTOM_LEFT=33;cc.ALIGN_LEFT=49;cc.ALIGN_TOP_LEFT=17;cc.PVRHaveAlphaPremultiplied_=!1; cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a={_contentSize:null,_textureLoaded:!1,_htmlElementObj:null,url:null,_pattern:null,ctor:function(){this._contentSize=cc.size(0,0);this._textureLoaded=!1;this._htmlElementObj=null;this._pattern="";this._pixelsHigh=this._pixelsWide=0},getPixelsWide:function(){return this._pixelsWide},getPixelsHigh:function(){return this._pixelsHigh},getContentSize:function(){var b=cc.contentScaleFactor(); return cc.size(this._contentSize.width/b,this._contentSize.height/b)},_getWidth:function(){return this._contentSize.width/cc.contentScaleFactor()},_getHeight:function(){return this._contentSize.height/cc.contentScaleFactor()},getContentSizeInPixels:function(){return this._contentSize},initWithElement:function(b){b&&(this._htmlElementObj=b,this._pixelsWide=this._contentSize.width=b.width,this._pixelsHigh=this._contentSize.height=b.height,this._textureLoaded=!0)},getHtmlElementObj:function(){return this._htmlElementObj}, isLoaded:function(){return this._textureLoaded},handleLoadedTexture:function(){if(this._htmlElementObj){var b=this._htmlElementObj;this._pixelsWide=this._contentSize.width=b.width;this._pixelsHigh=this._contentSize.height=b.height;this.dispatchEvent("load")}},description:function(){return""},initWithData:function(b,c,d,e,f){return!1},initWithImage:function(b){return!1},initWithString:function(b,c,d,e,f,g){return!1}, releaseTexture:function(){this._htmlElementObj=null;cc.loader.release(this.url)},getName:function(){return null},getMaxS:function(){return 1},setMaxS:function(b){},getMaxT:function(){return 1},setMaxT:function(b){},getPixelFormat:function(){return null},getShaderProgram:function(){return null},setShaderProgram:function(b){},hasPremultipliedAlpha:function(){return!1},hasMipmaps:function(){return!1},releaseData:function(b){},keepData:function(b,c){return b},drawAtPoint:function(b){},drawInRect:function(b){}, initWithETCFile:function(b){cc.log(cc._LogInfos.Texture2D_initWithETCFile);return!1},initWithPVRFile:function(b){cc.log(cc._LogInfos.Texture2D_initWithPVRFile);return!1},initWithPVRTCData:function(b,c,d,e,f,g){cc.log(cc._LogInfos.Texture2D_initWithPVRTCData);return!1},setTexParameters:function(b,c,d,e){void 0!==c&&(b={minFilter:b,magFilter:c,wrapS:d,wrapT:e});this._pattern=b.wrapS===cc.REPEAT&&b.wrapT===cc.REPEAT?"repeat":b.wrapS===cc.REPEAT?"repeat-x":b.wrapT===cc.REPEAT?"repeat-y":""},setAntiAliasTexParameters:function(){}, setAliasTexParameters:function(){},generateMipmap:function(){},stringForFormat:function(){return""},bitsPerPixelForFormat:function(b){return-1},addLoadedEventListener:function(b,c){this.addEventListener("load",b,c)},removeLoadedEventListener:function(b){this.removeEventTarget("load",b)},_generateColorTexture:function(){},_generateTextureCacheForColor:function(){if(this.channelCache)return this.channelCache;var b=[document.createElement("canvas"),document.createElement("canvas"),document.createElement("canvas"), document.createElement("canvas")],c=this._htmlElementObj,d=c.width,e=c.height;b[0].width=d;b[0].height=e;b[1].width=d;b[1].height=e;b[2].width=d;b[2].height=e;b[3].width=d;b[3].height=e;var f=b[3].getContext("2d");f.drawImage(c,0,0);f=f.getImageData(0,0,d,e).data;for(var g,h=0;4>h;h++){g=b[h].getContext("2d");for(var k=g.getImageData(0,0,d,e),m=k.data,l=0;l"},textureForKey:function(a){cc.log(cc._LogInfos.textureCache_textureForKey);return this.getTextureForKey(a)},getTextureForKey:function(a){a instanceof cc.VirtualUrl&&(a=a.resolve().getUrl());return this._textures[a]||this._textures[cc.loader._getAliase(a)]},getKeyByTexture:function(a){for(var b in this._textures)if(this._textures[b]===a)return b;return null},_generalTextureKey:function(a){return"_textureKey_"+a},getTextureColors:function(a){var b=a._htmlElementObj,c=this.getKeyByTexture(b);c|| (c=b instanceof HTMLImageElement?b.src:this._generalTextureKey(a.__instanceId));this._textureColorsCache[c]||(this._textureColorsCache[c]=a._generateTextureCacheForColor());return this._textureColorsCache[c]},addPVRImage:function(a){cc.log(cc._LogInfos.textureCache_addPVRImage)},removeAllTextures:function(){var a=this._textures,b;for(b in a)a[b]&&a[b].releaseTexture();this._textures={}},removeTexture:function(a){if(a){var b=this._textures,c;for(c in b)b[c]===a&&(b[c].releaseTexture(),delete b[c])}}, removeTextureForKey:function(a){if(null!=a){a instanceof cc.VirtualUrl&&(a=a.resolve().getUrl());var b=this._textures[a];b&&(b.releaseTexture(),delete this._textures[a])}},cacheImage:function(a,b){if(b instanceof cc.Texture2D)this._textures[a]=b;else{var c=new cc.Texture2D;c.initWithElement(b);c.handleLoadedTexture();this._textures[a]=c}},addUIImage:function(a,b){cc.assert(a,cc._LogInfos.textureCache_addUIImage_2);if(b&&this._textures[b])return this._textures[b];var c=new cc.Texture2D;c.initWithImage(a); null!=b?this._textures[b]=c:cc.log(cc._LogInfos.textureCache_addUIImage);return c},dumpCachedTextureInfo:function(){var a=0,b=0,c=this._textures,d;for(d in c){var e=c[d];a++;e.getHtmlElementObj()instanceof HTMLImageElement?cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo,d,e.getHtmlElementObj().src,e.getPixelsWide(),e.getPixelsHigh()):cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_2,d,e.getPixelsWide(),e.getPixelsHigh());b+=e.getPixelsWide()*e.getPixelsHigh()*4}c=this._textureColorsCache; for(d in c){e=c[d];for(var f in e){var g=e[f];a++;cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_2,d,g.width,g.height);b+=g.width*g.height*4}}cc.log(cc._LogInfos.textureCache_dumpCachedTextureInfo_3,a,b/1024,(b/1048576).toFixed(2))},_clear:function(){this._textures={};this._textureColorsCache={};this._textureKeySeq=0|1E3*Math.random();this._loadedTexturesBefore={}}}; cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.textureCache;a.handleLoadedTexture=function(b,c){var d=this._textures,e=d[b];e||(e=d[b]=new cc.Texture2D,e.url=b);e.initWithElement(c);e.handleLoadedTexture();return e};a.addImage=function(b,c,d){cc.assert(b,cc._LogInfos.Texture2D_addImage);var e=this._textures,f=e[b]||e[cc.loader._getAliase(b)];if(f)return f.isLoaded()?c&&c.call(d,f):f.addEventListener("load",function(){c&&c.call(d, f)},d),f;f=e[b]=new cc.Texture2D;f.url=b;e=cc.loader.getBasePath?cc.loader.getBasePath():cc.loader.resPath;cc.loader.loadImg(cc.path.join(e||"",b),function(g,h){if(g)return c&&c.call(d,g);g=cc.textureCache.handleLoadedTexture(b,h);c&&c.call(d,g)});return f};a.addImageAsync=a.addImage;a=null}else cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(cc.assert(cc.isFunction(cc._tmp.WebGLTextureCache),cc._LogInfos.MissingFile,"TexturesWebGL.js"),cc._tmp.WebGLTextureCache(),delete cc._tmp.WebGLTextureCache)});cc.Scene=cc.Node.extend({_className:"Scene",ctor:function(){cc.Node.prototype.ctor.call(this);this._ignoreAnchorPointForPosition=!0;this.setAnchorPoint(.5,.5);this.setContentSize(cc.director.getWinSize());this._globalNodes=[]},addGlobalNode:function(a){this._globalNodes.push(a)},destructor:function(){},visit:function(a){cc.renderer.childrenOrderDirty&&(this._globalNodes=[]);this._super(a);cc.renderer._visitGlobalNodes=!0;for(a=0;af._localZOrder)f.visit(this);else break}for(a.pushRenderCommand(b);cf._localZOrder)f.visit(this);else break}for(a.pushRenderCommand(b);c=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchTo):(this.removeChild(this._layers[this._enabledLayer],!0),this._enabledLayer=a,this.addChild(this._layers[a]))},switchToAndReleaseMe:function(a){a>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchToAndReleaseMe):(this.removeChild(this._layers[this._enabledLayer],!0),this._layers[this._enabledLayer]=null,this._enabledLayer=a,this.addChild(this._layers[a]))},addLayer:function(a){a?this._layers.push(a): cc.log(cc._LogInfos.LayerMultiplex_addLayer)}});cc.LayerMultiplex.create=function(){return new cc.LayerMultiplex(Array.prototype.slice.call(arguments))};(function(){cc.Layer.CanvasRenderCmd=function(b){this._rootCtor(b);this._isBaked=!1;this._bakeSprite=null;this._canUseDirtyRegion=!0;this._updateCache=2};var a=cc.Layer.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.Layer.CanvasRenderCmd;a._layerCmdCtor=cc.Layer.CanvasRenderCmd;a._setCacheDirty=function(b){b&&0===this._updateCache&&(this._updateCache=2);!1===this._cacheDirty&&(this._cacheDirty=!0,(b=this._cachedParent)&&b!==this&&b._setNodeDirtyForCache&& b._setNodeDirtyForCache())};a.updateStatus=function(){var b=cc.Node._dirtyFlags;this._dirtyFlag&b.orderDirty&&(this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~b.orderDirty);this.originUpdateStatus()};a._syncStatus=function(b){var c=cc.Node._dirtyFlags,d=this._dirtyFlag;if(this._isBaked||d&c.orderDirty)this._cacheDirty=!0,0===this._updateCache&&(this._updateCache=2),this._dirtyFlag&=~c.orderDirty;this._originSyncStatus(b)};a.transform=function(b,c){this._worldTransform|| (this._worldTransform={a:1,b:0,c:0,d:1,tx:0,ty:0});var d=this._worldTransform,e=d.a,f=d.b,g=d.c,h=d.d;this.originTransform(b,c);d.a===e&&d.b===f&&d.c===g&&d.d===h||0!==this._updateCache||(this._updateCache=2)};a.bake=function(){if(!this._isBaked){this._needDraw=!0;this._isBaked=this._cacheDirty=cc.renderer.childrenOrderDirty=!0;0===this._updateCache&&(this._updateCache=2);for(var b=this._node._children,c=0,d=b.length;ch._localZOrder)h.visit(b);else break;for(cc.renderer.pushRenderCommand(this);fc;c++)b[4*c+3]=this._color[0];this._dataDirty=!0};a.rendering=function(b){b=b||cc._renderContext; var c=this._node;this._matrix||(this._matrix=new cc.math.Matrix4,this._matrix.identity());var d=this._worldTransform;this._matrix.mat[0]=d.a;this._matrix.mat[4]=d.c;this._matrix.mat[12]=d.tx;this._matrix.mat[1]=d.b;this._matrix.mat[5]=d.d;this._matrix.mat[13]=d.ty;this._dataDirty&&(this._vertexBuffer||(this._vertexBuffer=b.createBuffer()),b.bindBuffer(b.ARRAY_BUFFER,this._vertexBuffer),b.bufferData(b.ARRAY_BUFFER,this._data,b.DYNAMIC_DRAW),this._dataDirty=!1);this._glProgramState.apply(this._matrix); cc.glBlendFunc(c._blendFunc.src,c._blendFunc.dst);b.bindBuffer(b.ARRAY_BUFFER,this._vertexBuffer);b.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION);b.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR);b.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,3,b.FLOAT,!1,16,0);b.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,b.UNSIGNED_BYTE,!0,16,12);b.drawArrays(b.TRIANGLE_STRIP,0,4)};a.updateBlendFunc=function(b){}})(); (function(){cc.LayerGradient.WebGLRenderCmd=function(b){cc.LayerColor.WebGLRenderCmd.call(this,b);this._needDraw=!0;this._clipRect=new cc.Rect;this._clippingRectDirty=!1};var a=cc.LayerGradient.WebGLRenderCmd.prototype=Object.create(cc.LayerColor.WebGLRenderCmd.prototype);a.constructor=cc.LayerGradient.WebGLRenderCmd;a.updateStatus=function(){var b=cc.Node._dirtyFlags;this._dirtyFlag&b.gradientDirty&&(this._dirtyFlag|=b.colorDirty,this._updateVertex(),this._dirtyFlag&=~b.gradientDirty);this.originUpdateStatus()}; a._syncStatus=function(b){var c=cc.Node._dirtyFlags;this._dirtyFlag&c.gradientDirty&&(this._dirtyFlag|=c.colorDirty,this._updateVertex(),this._dirtyFlag&=~c.gradientDirty);this._originSyncStatus(b)};a.transform=function(b,c){this.originTransform(b,c);this._updateVertex()};a._updateVertex=function(){var b=this._node,c=b._colorStops;if(c&&!(2>c.length)){this._clippingRectDirty=!0;var d=c.length,e=2*d,f=b._contentSize;this._positionView.length/4h){h=cc.p(-e.x,e.y);var m=cc.p(e.x,e.y)}else 180>h?(h=cc.p(e.x,e.y),m=cc.p(e.x,-e.y)):270>h?(h=cc.p(e.x,-e.y),m=cc.p(-e.x,-e.y)):(h=cc.p(-e.x,-e.y),m=cc.p(-e.x,e.y));var l=Math.sin(g);g=Math.cos(g);k=cc.affineTransformScale(k,Math.abs((h.x*g-h.y*l)/e.x),Math.abs((m.x*l+m.y*g)/e.y));h=this._positionView;for(g=0;gb.length)){for(var c=b.length,d,e=this._colorView,f=this._displayedOpacity/255,g=0;gb.width&&cc.error(cc._LogInfos.RectWidth,b.url),d>b.height&&cc.error(cc._LogInfos.RectHeight, b.url))};a.rendering=function(b,c,d){var e=this._node,f=this._textureCoord,g=this._displayedOpacity/255,h=this._textureToRender||e._texture;if((!h||0!==f.width&&0!==f.height&&h._textureLoaded)&&0!==g){b=b||cc._renderContext;var k=b.getContext(),m=e._offsetPosition.x,l=e._rect.height,n=e._rect.width,p=-e._offsetPosition.y-l;b.setTransform(this._worldTransform,c,d);b.setCompositeOperation(this._blendFuncStr);b.setGlobalAlpha(g);(e._flippedX||e._flippedY)&&b.save();e._flippedX&&(m=-m-n,k.scale(-1,1)); e._flippedY&&(p=e._offsetPosition.y,k.scale(1,-1));if(this._colorized)var q=g=0;else g=f.renderX,q=f.renderY;var r=f.width;var u=f.height;h&&h._htmlElementObj?(c=h._htmlElementObj,""!==h._pattern?(b.setFillStyle(k.createPattern(c,h._pattern)),k.fillRect(m,p,n,l)):k.drawImage(c,g,q,r,u,m,p,n,l)):(h=e._contentSize,f.validRect&&(f=this._displayedColor,b.setFillStyle("rgba("+f.r+","+f.g+","+f.b+",1)"),k.fillRect(m,p,h.width*c,h.height*d)));(e._flippedX||e._flippedY)&&b.restore();cc.g_NumberOfDraws++}}; a._updateColor=function(){var b=this._node._texture,c=this._textureCoord,d=this._displayedColor;b&&(255!==d.r||255!==d.g||255!==d.b?(this._textureToRender=b._generateColorTexture(d.r,d.g,d.b,c),this._colorized=!0):b&&(this._textureToRender=b,this._colorized=!1))};a._textureLoadedCallback=function(b){if(!this._textureLoaded){this._textureLoaded=!0;var c=this._rect,d=this._renderCmd;c?cc._rectEqualToZero(c)&&(c.width=b.width,c.height=b.height):c=cc.rect(0,0,b.width,b.height);this.texture=b;this.setTextureRect(c, this._rectRotated);b=d._displayedColor;255===b.r&&255===b.g&&255===b.b||d._updateColor();this.setBatchNode(this._batchNode);this.dispatchEvent("load")}};a._setTextureCoords=function(b,c){void 0===c&&(c=!0);var d=this._textureCoord;c=c?cc.contentScaleFactor():1;d.renderX=d.x=0|b.x*c;d.renderY=d.y=0|b.y*c;d.width=0|b.width*c;d.height=0|b.height*c;d.validRect=!(0===d.width||0===d.height||0>d.x||0>d.y)};cc.Sprite.CanvasRenderCmd._cutRotateImageToCanvas=function(b,c,d){if(!b)return null;if(!c)return b; d=null==d?!0:d;var e=document.createElement("canvas");e.width=c.width;e.height=c.height;var f=e.getContext("2d");f.translate(e.width/2,e.height/2);d?f.rotate(-1.5707963267948966):f.rotate(1.5707963267948966);f.drawImage(b,c.x,c.y,c.height,c.width,-c.height/2,-c.width/2,c.height,c.width);return e}})();(function(){cc.Sprite.WebGLRenderCmd=function(b){this._rootCtor(b);this._needDraw=!0;this._vertices=[{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0},{x:0,y:0,u:0,v:0}];this._color=new Uint32Array(1);this._recursiveDirty=this._dirty=!1;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)};var a=cc.Sprite.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.Sprite.WebGLRenderCmd;a._spriteCmdCtor=cc.Sprite.WebGLRenderCmd; a.updateBlendFunc=function(b){};a.setDirtyFlag=function(b){cc.Node.WebGLRenderCmd.prototype.setDirtyFlag.call(this,b);this._dirty=!0};a.setDirtyRecursively=function(b){this._dirty=this._recursiveDirty=b;for(var c=this._node._children,d,e=c?c.length:0,f=0;fb.width&&cc.error(cc._LogInfos.RectWidth,b.url),c>b.height&&cc.error(cc._LogInfos.RectHeight,b.url))};a.transform=function(b,c){this.originTransform(b,c);b=this._node;var d=b._offsetPosition.x, e=d+b._rect.width,f=b._offsetPosition.y,g=f+b._rect.height,h=this._worldTransform;b=h.tx;c=h.ty;var k=d*h.a;d*=h.b;var m=e*h.a;e*=h.b;var l=g*h.c;g*=h.d;var n=f*h.c;f*=h.d;h=this._vertices;h[0].x=k+l+b;h[0].y=d+g+c;h[1].x=k+n+b;h[1].y=d+f+c;h[2].x=m+l+b;h[2].y=e+g+c;h[3].x=m+n+b;h[3].y=e+f+c};a.needDraw=function(){var b=this._node._texture;return this._needDraw&&b};a.uploadData=function(b,c,d){var e=this._node,f=e._texture;if(!(f&&f._textureLoaded&&e._rect.width&&e._rect.height&&this._displayedOpacity))return 0; f=this._displayedOpacity;var g=this._displayedColor.r,h=this._displayedColor.g,k=this._displayedColor.b;if(e._opacityModifyRGB){var m=f/255;g*=m;h*=m;k*=m}this._color[0]=f<<24|k<<16|h<<8|g;e=e._vertexZ;f=this._vertices;g=f.length;k=d;for(d=0;da.getPixelsWide()&&cc.error(cc._LogInfos.RectWidth,a.url);g>a.getPixelsHigh()&&cc.error(cc._LogInfos.RectHeight,a.url)}this._offsetInPixels.x=d.x;this._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(d,this._offset);this._originalSizeInPixels.width=e.width;this._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(e, this._originalSize);this._rotated=c;return!0}});cc.EventHelper.prototype.apply(cc.SpriteFrame.prototype);cc.SpriteFrame.create=function(a,b,c,d,e){return new cc.SpriteFrame(a,b,c,d,e)};cc.SpriteFrame.createWithTexture=cc.SpriteFrame.create; cc.SpriteFrame._frameWithTextureForCanvas=function(a,b,c,d,e){var f=new cc.SpriteFrame;f._texture=a;f._rectInPixels=b;f._rect=cc.rectPixelsToPoints(b);f._offsetInPixels.x=d.x;f._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(f._offsetInPixels,f._offset);f._originalSizeInPixels.width=e.width;f._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(f._originalSizeInPixels,f._originalSize);f._rotated=c;return f};cc.configuration={ERROR:0,STRING:1,INT:2,DOUBLE:3,BOOLEAN:4,_maxTextureSize:0,_maxModelviewStackDepth:0,_supportsPVRTC:!1,_supportsNPOT:!1,_supportsBGRA8888:!1,_supportsDiscardFramebuffer:!1,_supportsShareableVAO:!1,_maxSamplesAllowed:0,_maxTextureUnits:0,_GlExtensions:"",_valueDict:{},_inited:!1,_init:function(){var a=this._valueDict;a["cocos2d.x.version"]=cc.ENGINE_VERSION;a["cocos2d.x.compiled_with_profiler"]=!1;a["cocos2d.x.compiled_with_gl_state_cache"]=cc.ENABLE_GL_STATE_CACHE;this._inited= !0},getMaxTextureSize:function(){return this._maxTextureSize},getMaxModelviewStackDepth:function(){return this._maxModelviewStackDepth},getMaxTextureUnits:function(){return this._maxTextureUnits},supportsNPOT:function(){return this._supportsNPOT},supportsPVRTC:function(){return this._supportsPVRTC},supportsETC:function(){return!1},supportsS3TC:function(){return!1},supportsATITC:function(){return!1},supportsBGRA8888:function(){return this._supportsBGRA8888},supportsDiscardFramebuffer:function(){return this._supportsDiscardFramebuffer}, supportsShareableVAO:function(){return this._supportsShareableVAO},checkForGLExtension:function(a){return-1this._deltaTime&&(this._deltaTime=0);this._lastUpdate=a},convertToGL:function(a){var b=document.documentElement,c=cc.view,d=b.getBoundingClientRect();d.left+= window.pageXOffset-b.clientLeft;d.top+=window.pageYOffset-b.clientTop;b=c._devicePixelRatio*(a.x-d.left);a=c._devicePixelRatio*(d.top+d.height-a.y);return c._isRotated?{x:c._viewPortRect.width-a,y:b}:{x:b,y:a}},convertToUI:function(a){var b=document.documentElement,c=cc.view,d=b.getBoundingClientRect();d.left+=window.pageXOffset-b.clientLeft;d.top+=window.pageYOffset-b.clientTop;b={x:0,y:0};c._isRotated?(b.x=d.left+a.y/c._devicePixelRatio,b.y=d.top+d.height-(c._viewPortRect.width-a.x)/c._devicePixelRatio): (b.x=d.left+a.x/c._devicePixelRatio,b.y=d.top+d.height-a.y/c._devicePixelRatio);return b},drawScene:function(){var a=cc.renderer;this.calculateDeltaTime();this._paused||(this._scheduler.update(this._deltaTime),cc.eventManager.dispatchEvent(this._eventAfterUpdate));this._nextScene&&this.setNextScene();this._runningScene&&(a.childrenOrderDirty?(cc.renderer.clearRenderCommands(),cc.renderer.assignedZ=0,this._runningScene._renderCmd._curLevel=0,this._runningScene.visit(),a.resetFlag(),cc.rendererBundle= void 0):a.transformDirty()&&a.transform());a.clear();this._notificationNode&&this._notificationNode.visit();cc.eventManager.dispatchEvent(this._eventAfterVisit);cc.g_NumberOfDraws=0;cc.g_NumberOfVertexes=0;cc.g_NumberOfSlots=0;a.rendering(cc._renderContext);this._totalFrames++;cc.eventManager.dispatchEvent(this._eventAfterDraw);cc.eventManager.frameUpdateListeners();this._calculateMPF()},end:function(){this._purgeDirectorInNextLoop=!0},getContentScaleFactor:function(){return this._contentScaleFactor}, getNotificationNode:function(){return this._notificationNode},getWinSize:function(){return cc.size(this._winSizeInPoints)},getWinSizeInPixels:function(){return cc.size(this._winSizeInPoints.width*this._contentScaleFactor,this._winSizeInPoints.height*this._contentScaleFactor)},getVisibleSize:null,getVisibleOrigin:null,getZEye:null,pause:function(){this._paused||(this._oldAnimationInterval=this._animationInterval,this.setAnimationInterval(.25),this._paused=!0)},popScene:function(){cc.assert(this._runningScene, cc._LogInfos.Director_popScene);this._scenesStack.pop();var a=this._scenesStack.length;0===a?this.end():(this._sendCleanupToScene=!0,this._nextScene=this._scenesStack[a-1])},purgeCachedData:function(){cc.animationCache._clear();cc.spriteFrameCache._clear();cc.textureCache._clear()},purgeDirector:function(){this.getScheduler().unscheduleAll();cc.eventManager&&cc.eventManager.setEnabled(!1);this._runningScene&&(this._runningScene._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart), this._runningScene._performRecursive(cc.Node._stateCallbackType.onExit),this._runningScene._performRecursive(cc.Node._stateCallbackType.cleanup));this._nextScene=this._runningScene=null;this._scenesStack.length=0;this.stopAnimation();this.purgeCachedData();cc.checkGLErrorDebug()},pushScene:function(a){cc.assert(a,cc._LogInfos.Director_pushScene);this._sendCleanupToScene=!1;this._scenesStack.push(a);this._nextScene=a},runScene:function(a){cc.assert(a,cc._LogInfos.Director_pushScene);if(this._runningScene){var b= this._scenesStack.length;0===b?(this._sendCleanupToScene=!0,this._scenesStack[b]=a):(this._sendCleanupToScene=!0,this._scenesStack[b-1]=a);this._nextScene=a}else this.pushScene(a),this.startAnimation()},resume:function(){this._paused&&(this.setAnimationInterval(this._oldAnimationInterval),(this._lastUpdate=Date.now())||cc.log(cc._LogInfos.Director_resume),this._paused=!1,this._deltaTime=0)},setContentScaleFactor:function(a){a!==this._contentScaleFactor&&(this._contentScaleFactor=a)},setDepthTest:null, setClearColor:null,setDefaultValues:function(){},setNextDeltaTimeZero:function(a){this._nextDeltaTimeZero=a},setNextScene:function(){var a=!1,b=!1;cc.TransitionScene&&(a=this._runningScene?this._runningScene instanceof cc.TransitionScene:!1,b=this._nextScene?this._nextScene instanceof cc.TransitionScene:!1);if(!b){if(b=this._runningScene)b._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),b._performRecursive(cc.Node._stateCallbackType.onExit);this._sendCleanupToScene&&b&&b._performRecursive(cc.Node._stateCallbackType.cleanup)}this._runningScene= this._nextScene;cc.renderer.childrenOrderDirty=!0;this._nextScene=null;a||null===this._runningScene||(this._runningScene._performRecursive(cc.Node._stateCallbackType.onEnter),this._runningScene._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish))},setNotificationNode:function(a){cc.renderer.childrenOrderDirty=!0;this._notificationNode&&(this._notificationNode._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),this._notificationNode._performRecursive(cc.Node._stateCallbackType.onExit), this._notificationNode._performRecursive(cc.Node._stateCallbackType.cleanup));if(this._notificationNode=a)this._notificationNode._performRecursive(cc.Node._stateCallbackType.onEnter),this._notificationNode._performRecursive(cc.Node._stateCallbackType.onEnterTransitionDidFinish)},getDelegate:function(){return this._projectionDelegate},setDelegate:function(a){this._projectionDelegate=a},setOpenGLView:null,setProjection:null,setViewport:null,getOpenGLView:null,getProjection:null,setAlphaBlending:null, isSendCleanupToScene:function(){return this._sendCleanupToScene},getRunningScene:function(){return this._runningScene},getAnimationInterval:function(){return this._animationInterval},isDisplayStats:function(){return cc.profiler?cc.profiler.isShowingStats():!1},setDisplayStats:function(a){cc.profiler&&(a?cc.profiler.showStats():cc.profiler.hideStats())},getSecondsPerFrame:function(){return this._secondsPerFrame},isNextDeltaTimeZero:function(){return this._nextDeltaTimeZero},isPaused:function(){return this._paused}, getTotalFrames:function(){return this._totalFrames},popToRootScene:function(){this.popToSceneStackLevel(1)},popToSceneStackLevel:function(a){cc.assert(this._runningScene,cc._LogInfos.Director_popToSceneStackLevel_2);var b=this._scenesStack,c=b.length;if(0===a)this.end();else if(!(a>=c)){for(;c>a;){var d=b.pop();d.running&&(d._performRecursive(cc.Node._stateCallbackType.onExitTransitionDidStart),d._performRecursive(cc.Node._stateCallbackType.onExit));d._performRecursive(cc.Node._stateCallbackType.cleanup); c--}this._nextScene=b[b.length-1];this._sendCleanupToScene=!0}},getScheduler:function(){return this._scheduler},setScheduler:function(a){this._scheduler!==a&&(this._scheduler=a)},getActionManager:function(){return this._actionManager},setActionManager:function(a){this._actionManager!==a&&(this._actionManager=a)},getDeltaTime:function(){return this._deltaTime},_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3}});cc.Director.EVENT_PROJECTION_CHANGED="director_projection_changed"; cc.Director.EVENT_AFTER_UPDATE="director_after_update";cc.Director.EVENT_AFTER_VISIT="director_after_visit";cc.Director.EVENT_AFTER_DRAW="director_after_draw"; cc.DisplayLinkDirector=cc.Director.extend({invalid:!1,startAnimation:function(){this._nextDeltaTimeZero=!0;this.invalid=!1},mainLoop:function(){this._purgeDirectorInNextLoop?(this._purgeDirectorInNextLoop=!1,this.purgeDirector()):this.invalid||this.drawScene()},stopAnimation:function(){this.invalid=!0},setAnimationInterval:function(a){this._animationInterval=a;this.invalid||(this.stopAnimation(),this.startAnimation())}});cc.Director.sharedDirector=null;cc.Director.firstUseDirector=!0; cc.Director._getInstance=function(){cc.Director.firstUseDirector&&(cc.Director.firstUseDirector=!1,cc.Director.sharedDirector=new cc.DisplayLinkDirector,cc.Director.sharedDirector.init());return cc.Director.sharedDirector};cc.defaultFPS=60;cc.Director.PROJECTION_2D=0;cc.Director.PROJECTION_3D=1;cc.Director.PROJECTION_CUSTOM=3;cc.Director.PROJECTION_DEFAULT=cc.Director.PROJECTION_3D;cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_CANVAS){var a=cc.Director.prototype;a.getProjection=function(b){return this._projection};a.setProjection=function(b){this._projection=b;cc.eventManager.dispatchEvent(this._eventProjectionChanged)};a.setDepthTest=function(){};a.setClearColor=function(b){cc.renderer._clearColor=b;cc.renderer._clearFillStyle="rgb("+b.r+","+b.g+","+b.b+")"};a.setOpenGLView=function(b){this._winSizeInPoints.width= cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=b||cc.view;cc.eventManager&&cc.eventManager.setEnabled(!0)};a.getVisibleSize=function(){return this.getWinSize()};a.getVisibleOrigin=function(){return cc.p(0,0)}}else cc.Director._fpsImage=new Image,cc.Director._fpsImage.addEventListener("load",function(){cc.Director._fpsImageLoaded=!0}),cc._fpsImage&&(cc.Director._fpsImage.src=cc._fpsImage)});cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED,function(){if(cc._renderType===cc.game.RENDER_TYPE_WEBGL){cc.DirectorDelegate=cc.Class.extend({updateProjection:function(){}});var a=cc.Director.prototype,b=function(c){if(c&&c._renderCmd){c._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty);var d=c._children;for(c=0;cb.length&&b.push(k)};var c=function(k,m,l,n){this.list= k;this.entry=m;this.target=l;this.callback=n},d=[];c.get=function(k,m,l,n){var p=d.pop();p?(p.list=k,p.entry=m,p.target=l,p.callback=n):p=new c(k,m,l,n);return p};c.put=function(k){k.list=null;k.entry=null;k.target=null;k.callback=null;20>d.length&&d.push(k)};var e=function(k,m,l,n,p,q){this.timers=k;this.target=m;this.timerIndex=l;this.currentTimer=n;this.currentTimerSalvaged=p;this.paused=q},f=[];e.get=function(k,m,l,n,p,q){var r=f.pop();r?(r.timers=k,r.target=m,r.timerIndex=l,r.currentTimer=n, r.currentTimerSalvaged=p,r.paused=q):r=new e(k,m,l,n,p,q);return r};e.put=function(k){k.timers=null;k.target=null;k.timerIndex=0;k.currentTimer=null;k.currentTimerSalvaged=!1;k.paused=!1;20>f.length&&f.push(k)};var g=function(){this._scheduler=null;this._elapsed=-1;this._useDelay=this._runForever=!1;this._interval=this._delay=this._repeat=this._timesExecuted=0;this._key=this._callback=this._target=null};cc.inject({initWithCallback:function(k,m,l,n,p,q,r){this._scheduler=k;this._target=l;this._callback= m;r&&(this._key=r);this._elapsed=-1;this._interval=n;this._delay=q;this._useDelay=0=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(), this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},getCallback:function(){return this._callback},getKey:function(){return this._key},trigger:function(){this._target&&this._callback&&this._callback.call(this._target,this._elapsed)},cancel:function(){this._scheduler.unschedule(this._callback,this._target)}},g.prototype); var h=[];g.get=function(){return h.pop()||new g};g.put=function(k){k._scheduler=null;k._elapsed=-1;k._runForever=!1;k._useDelay=!1;k._timesExecuted=0;k._repeat=0;k._delay=0;k._interval=0;k._target=null;k._callback=null;k._key=null;20>h.length&&h.push(k)};cc.Scheduler=cc.Class.extend({_timeScale:1,_updatesNegList:null,_updates0List:null,_updatesPosList:null,_hashForTimers:null,_arrayForTimers:null,_hashForUpdates:null,_currentTarget:null,_currentTargetSalvaged:!1,_updateHashLocked:!1,ctor:function(){this._timeScale= 1;this._updatesNegList=[];this._updates0List=[];this._updatesPosList=[];this._hashForUpdates={};this._hashForTimers={};this._currentTarget=null;this._updateHashLocked=this._currentTargetSalvaged=!1;this._arrayForTimers=[]},_schedulePerFrame:function(k,m,l,n){var p=this._hashForUpdates[m.__instanceId];if(p&&p.entry)if(p.entry.priority!==l){if(this._updateHashLocked){cc.log("warning: you CANNOT change update priority in scheduled function");p.entry.markedForDeletion=!1;p.entry.paused=n;return}this.unscheduleUpdate(m)}else{p.entry.markedForDeletion= !1;p.entry.paused=n;return}0===l?this._appendIn(this._updates0List,k,m,n):0>l?this._priorityIn(this._updatesNegList,k,m,l,n):this._priorityIn(this._updatesPosList,k,m,l,n)},_removeHashElement:function(k){delete this._hashForTimers[k.target.__instanceId];for(var m=this._arrayForTimers,l=0,n=m.length;l=n&&m.timerIndex--;0===l.length&&(this._currentTarget===m?this._currentTargetSalvaged=!0: this._removeHashElement(m));break}}},unscheduleUpdate:function(k){k&&(k=this._hashForUpdates[k.__instanceId])&&(this._updateHashLocked?k.entry.markedForDeletion=!0:this._removeUpdateFromHash(k.entry))},unscheduleAllForTarget:function(k){if(k){var m=this._hashForTimers[k.__instanceId];if(m){var l=m.timers;-1k)for(m=0;m=k&&this.unscheduleUpdate(n.target),l==this._updatesNegList.length&&m++;if(0>=k)for(m=0;m=k&&this.unscheduleUpdate(n.target),l==this._updatesPosList.length&&m++},isScheduled:function(k,m){cc.assert(k,"Argument callback must not be empty");cc.assert(m,"Argument target must be non-nullptr");m=this._hashForTimers[m.__instanceId];if(!m)return!1;if(null!=m.timers){m=m.timers;for(var l=0;lk)for(q=0;q=k&&(l.paused=!0,m.push(l.target));if(0>=k)for(q=0;q=k&&(l.paused=!0,m.push(l.target));return m},resumeTargets:function(k){if(k)for(var m=0;ma.length)throw Error("Polygon's point must greater than 2");var e=a[0];b=this._renderContext.getContext(); b.beginPath();b.moveTo(e.x,-e.y);e=1;for(var f=a.length;e"},getLineHeight:function(){return!this._lineHeight||this._lineHeight.charAt?this._renderCmd._getFontClientHeight():this._lineHeight||this._renderCmd._getFontClientHeight()},setLineHeight:function(a){this._lineHeight=a},getString:function(){return this._string},getHorizontalAlignment:function(){return this._hAlignment},getVerticalAlignment:function(){return this._vAlignment},getDimensions:function(){return cc.size(this._dimensions)}, getFontSize:function(){return this._fontSize},getFontName:function(){return this._fontName},initWithStringAndTextDefinition:function(a,b){this._updateWithTextDefinition(b,!1);this.string=a;return!0},setTextDefinition:function(a){a&&this._updateWithTextDefinition(a,!0)},getTextDefinition:function(){return this._prepareTextDefinition(!1)},enableShadow:function(a,b,c,d){null!=a.r&&null!=a.g&&null!=a.b&&null!=a.a?this._enableShadow(a,b,c):this._enableShadowNoneColor(a,b,c,d)},_enableShadowNoneColor:function(a, b,c,d){c=c||.5;!1===this._shadowEnabled&&(this._shadowEnabled=!0);var e=this._shadowOffset;if(e&&e.x!==a||e._y!==b)e.x=a,e.y=b;this._shadowOpacity!==c&&(this._shadowOpacity=c);this._renderCmd._setColorsString();this._shadowBlur!==d&&(this._shadowBlur=d);this._setUpdateTextureDirty()},_enableShadow:function(a,b,c){this._shadowColor||(this._shadowColor=cc.color(255,255,255,128));this._shadowColor.r=a.r;this._shadowColor.g=a.g;this._shadowColor.b=a.b;this._enableShadowNoneColor(b.width||b.x||0,b.height|| b.y||0,null!=a.a?a.a/255:.5,c)},_getShadowOffsetX:function(){return this._shadowOffset.x},_setShadowOffsetX:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOffset.x!==a&&(this._shadowOffset.x=a,this._setUpdateTextureDirty())},_getShadowOffsetY:function(){return this._shadowOffset._y},_setShadowOffsetY:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOffset._y!==a&&(this._shadowOffset._y=a,this._setUpdateTextureDirty())},_getShadowOffset:function(){return cc.p(this._shadowOffset.x, this._shadowOffset.y)},_setShadowOffset:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);if(this._shadowOffset.x!==a.x||this._shadowOffset.y!==a.y)this._shadowOffset.x=a.x,this._shadowOffset.y=a.y,this._setUpdateTextureDirty()},_getShadowOpacity:function(){return this._shadowOpacity},_setShadowOpacity:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowOpacity!==a&&(this._shadowOpacity=a,this._renderCmd._setColorsString(),this._setUpdateTextureDirty())},_getShadowBlur:function(){return this._shadowBlur}, _setShadowBlur:function(a){!1===this._shadowEnabled&&(this._shadowEnabled=!0);this._shadowBlur!==a&&(this._shadowBlur=a,this._setUpdateTextureDirty())},disableShadow:function(){this._shadowEnabled&&(this._shadowEnabled=!1,this._setUpdateTextureDirty())},enableStroke:function(a,b){!1===this._strokeEnabled&&(this._strokeEnabled=!0);var c=this._strokeColor;if(c.r!==a.r||c.g!==a.g||c.b!==a.b)c.r=a.r,c.g=a.g,c.b=a.b,this._renderCmd._setColorsString();this._strokeSize!==b&&(this._strokeSize=b||0);this._setUpdateTextureDirty()}, _getStrokeStyle:function(){return this._strokeColor},_setStrokeStyle:function(a){!1===this._strokeEnabled&&(this._strokeEnabled=!0);var b=this._strokeColor;if(b.r!==a.r||b.g!==a.g||b.b!==a.b)b.r=a.r,b.g=a.g,b.b=a.b,this._renderCmd._setColorsString(),this._setUpdateTextureDirty()},_getLineWidth:function(){return this._strokeSize},_setLineWidth:function(a){!1===this._strokeEnabled&&(this._strokeEnabled=!0);this._strokeSize!==a&&(this._strokeSize=a||0,this._setUpdateTextureDirty())},disableStroke:function(){this._strokeEnabled&& (this._strokeEnabled=!1,this._setUpdateTextureDirty())},setFontFillColor:function(a){var b=this._textFillColor;if(b.r!==a.r||b.g!==a.g||b.b!==a.b)b.r=a.r,b.g=a.g,b.b=a.b,this._renderCmd._setColorsString(),this._needUpdateTexture=!0},_getFillStyle:function(){return this._textFillColor},_updateWithTextDefinition:function(a,b){a.fontDimensions?(this._dimensions.width=a.boundingWidth,this._dimensions.height=a.boundingHeight):(this._dimensions.width=0,this._dimensions.height=0);this._hAlignment=a.textAlign; this._vAlignment=a.verticalAlign;this._fontName=a.fontName;this._fontSize=a.fontSize||12;this._lineHeight=a.lineHeight?a.lineHeight:this._fontSize;this._renderCmd._setFontStyle(a);a.shadowEnabled&&this.enableShadow(a.shadowOffsetX,a.shadowOffsetY,a.shadowOpacity,a.shadowBlur);a.strokeEnabled&&this.enableStroke(a.strokeStyle,a.lineWidth);this.setFontFillColor(a.fillStyle);b&&this._renderCmd._updateTexture();a=cc.Node._dirtyFlags;this._renderCmd.setDirtyFlag(a.colorDirty|a.opacityDirty|a.textDirty)}, _prepareTextDefinition:function(a){var b=new cc.FontDefinition;a?(b.fontSize=this._fontSize,b.boundingWidth=cc.contentScaleFactor()*this._dimensions.width,b.boundingHeight=cc.contentScaleFactor()*this._dimensions.height):(b.fontSize=this._fontSize,b.boundingWidth=this._dimensions.width,b.boundingHeight=this._dimensions.height);b.fontName=this._fontName;b.textAlign=this._hAlignment;b.verticalAlign=this._vAlignment;if(this._strokeEnabled){b.strokeEnabled=!0;var c=this._strokeColor;b.strokeStyle=cc.color(c.r, c.g,c.b);b.lineWidth=this._strokeSize}else b.strokeEnabled=!1;this._shadowEnabled?(b.shadowEnabled=!0,b.shadowBlur=this._shadowBlur,b.shadowOpacity=this._shadowOpacity,b.shadowOffsetX=(a?cc.contentScaleFactor():1)*this._shadowOffset.x,b.shadowOffsetY=(a?cc.contentScaleFactor():1)*this._shadowOffset.y):b._shadowEnabled=!1;a=this._textFillColor;b.fillStyle=cc.color(a.r,a.g,a.b);return b},getScale:function(){this._scaleX!==this._scaleY&&cc.log(cc._LogInfos.Node_getScale);return this._scaleX*cc.view.getDevicePixelRatio()}, setScale:function(a,b){var c=cc.view.getDevicePixelRatio();this._scaleX=a/c;this._scaleY=(b||0===b?b:a)/c;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleX:function(){return this._scaleX*cc.view.getDevicePixelRatio()},setScaleX:function(a){this._scaleX=a/cc.view.getDevicePixelRatio();this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getScaleY:function(){return this._scaleY*cc.view.getDevicePixelRatio()},setScaleY:function(a){this._scaleY=a/cc.view.getDevicePixelRatio(); this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},setString:function(a){a=String(a);this._originalText!==a&&(this._originalText=a+"",this._updateString(),this._setUpdateTextureDirty(),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty))},_updateString:function(){this._string&&""!==this._string||this._string===this._originalText||(cc.renderer.childrenOrderDirty=!0);this._string=this._originalText},setHorizontalAlignment:function(a){a!==this._hAlignment&&(this._hAlignment= a,this._setUpdateTextureDirty())},setVerticalAlignment:function(a){a!==this._vAlignment&&(this._vAlignment=a,this._setUpdateTextureDirty())},setDimensions:function(a,b){if(void 0===b){var c=a.width;b=a.height}else c=a;if(c!==this._dimensions.width||b!==this._dimensions.height)this._dimensions.width=c,this._dimensions.height=b,this._updateString(),this._setUpdateTextureDirty()},_getBoundingWidth:function(){return this._dimensions.width},_setBoundingWidth:function(a){a!==this._dimensions.width&&(this._dimensions.width= a,this._updateString(),this._setUpdateTextureDirty())},_getBoundingHeight:function(){return this._dimensions.height},_setBoundingHeight:function(a){a!==this._dimensions.height&&(this._dimensions.height=a,this._updateString(),this._setUpdateTextureDirty())},setFontSize:function(a){this._fontSize!==a&&(this._fontSize=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},setFontName:function(a){this._fontName&&this._fontName!== a&&(this._fontName=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFont:function(){return this._renderCmd._getFontStyle()},_setFont:function(a){if(a=cc.LabelTTF._fontStyleRE.exec(a))this._fontSize=parseInt(a[1]),this._fontName=a[2],this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty()},getContentSize:function(){this._needUpdateTexture&&this._renderCmd._updateTTF(); var a=cc.view.getDevicePixelRatio();return cc.size(this._contentSize.width/a,this._contentSize.height/a)},_getWidth:function(){this._needUpdateTexture&&this._renderCmd._updateTTF();return this._contentSize.width/cc.view.getDevicePixelRatio()},_getHeight:function(){this._needUpdateTexture&&this._renderCmd._updateTTF();return this._contentSize.height/cc.view.getDevicePixelRatio()},setTextureRect:function(a,b,c){this._rectRotated=b||!1;this.setContentSize(c||a);b=this._rect;b.x=a.x;b.y=a.y;b.width=a.width; b.height=a.height;this._renderCmd._setTextureCoords(a,!1);c=this._unflippedOffsetPositionFromCenter.x;var d=this._unflippedOffsetPositionFromCenter.y;this._flippedX&&(c=-c);this._flippedY&&(d=-d);this._offsetPosition.x=c+(a.width-b.width)/2;this._offsetPosition.y=d+(a.height-b.height)/2},setDrawMode:function(a){this._onCacheCanvasMode=a},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_WEBGL?new cc.LabelTTF.WebGLRenderCmd(this):this._onCacheCanvasMode?new cc.LabelTTF.CacheCanvasRenderCmd(this): new cc.LabelTTF.CanvasRenderCmd(this)},_setFontStyle:function(a){this._fontStyle!==a&&(this._fontStyle=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFontStyle:function(){return this._fontStyle},_setFontWeight:function(a){this._fontWeight!==a&&(this._fontWeight=a,this._renderCmd._setFontStyle(this._fontName,this._fontSize,this._fontStyle,this._fontWeight),this._setUpdateTextureDirty())},_getFontWeight:function(){return this._fontWeight}}); cc.assert(cc.isFunction(cc._tmp.PrototypeLabelTTF),cc._LogInfos.MissingFile,"LabelTTFPropertyDefine.js");cc._tmp.PrototypeLabelTTF();delete cc._tmp.PrototypeLabelTTF;cc.LabelTTF._fontStyleRE=/^(\d+)px\s+['"]?([\w\s\d]+)['"]?$/;cc.LabelTTF.create=function(a,b,c,d,e,f){return new cc.LabelTTF(a,b,c,d,e,f)};cc.LabelTTF.createWithFontDefinition=cc.LabelTTF.create;cc.LabelTTF.__labelHeightDiv=document.createElement("div");cc.LabelTTF.__labelHeightDiv.style.fontFamily="Arial"; cc.LabelTTF.__labelHeightDiv.style.position="absolute";cc.LabelTTF.__labelHeightDiv.style.left="-100px";cc.LabelTTF.__labelHeightDiv.style.top="-100px";cc.LabelTTF.__labelHeightDiv.style.lineHeight="normal";var loadListener=function(){this.removeEventListener("load",loadListener,!1);document.body.appendChild(cc.LabelTTF.__labelHeightDiv)};document.body?document.body.appendChild(cc.LabelTTF.__labelHeightDiv):window.addEventListener("load",loadListener,!1); cc.LabelTTF.__getFontHeightByDiv=function(a,b){var c=cc.LabelTTF.__labelHeightDiv;if(a instanceof cc.FontDefinition){var d=cc.LabelTTF.__fontHeightCache[a._getCanvasFontStr()];if(0\u3001\u2018\u201c\u300b\u00bb\uff1f\u3002\uff0c\uff01\u2010\u2032-\u2034\u203a\u203c\u2046\u2047-\u2049]/;cc.LabelTTF._lastWordRex=/([a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045!,.'\u2019?]+|\S)$/; cc.LabelTTF._lastEnglish=/[a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045!,.'\u2019?]+$/;cc.LabelTTF._firsrEnglish=/^[a-zA-Z0-9\-\u00bf\u00a1\u00ab\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u0300-\u034e\u0350-\u036F\u0370-\u052f\u2011\u2035-\u2037\u2039\u2045!,.'\u2019?]/; (function(){cc.LabelTTF.RenderCmd=function(){this._fontClientHeight=18;this._fontStyleStr="";this._shadowColorStr="rgba(128, 128, 128, 0.5)";this._strokeColorStr="";this._fillColorStr="rgba(255,255,255,1)";this._labelContext=this._labelCanvas=null;this._lineWidths=[];this._strings=[];this._isMultiLine=!1;this._status=[];this._renderingIndex=0;this._canUseDirtyRegion=!0};var a=cc.LabelTTF.RenderCmd.prototype;a.constructor=cc.LabelTTF.RenderCmd;a._labelCmdCtor=cc.LabelTTF.RenderCmd;a._setFontStyle= function(c,d,e,f){if(c instanceof cc.FontDefinition)this._fontStyleStr=c._getCanvasFontStr(),this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(c);else{var g=d*cc.view.getDevicePixelRatio();this._fontStyleStr=e+" "+f+" "+g+"px '"+c+"'";this._fontClientHeight=cc.LabelTTF.__getFontHeightByDiv(c,d)}};a._getFontStyle=function(){return this._fontStyleStr};a._getFontClientHeight=function(){return this._fontClientHeight};a._updateColor=function(){this._setColorsString();this._updateTexture()};a._setColorsString= function(){var c=this._displayedColor,d=this._node,e=d._shadowColor||this._displayedColor,f=d._strokeColor,g=d._textFillColor,h=c.r/255,k=c.g/255;c=c.b/255;this._shadowColorStr="rgba("+(0|h*e.r)+","+(0|k*e.g)+","+(0|c*e.b)+","+d._shadowOpacity+")";this._fillColorStr="rgba("+(0|h*g.r)+","+(0|k*g.g)+","+(0|c*g.b)+", 1)";this._strokeColorStr="rgba("+(0|h*f.r)+","+(0|k*f.g)+","+(0|c*f.b)+", 1)"};var b=new cc.Rect;a.getLocalBB=function(){var c=this._node;b.x=b.y=0;var d=cc.view.getDevicePixelRatio();b.width= c._getWidth()*d;b.height=c._getHeight()*d;return b};a._updateTTF=function(){var c=this._node,d=cc.view.getDevicePixelRatio(),e=c._dimensions.width*d,f,g,h=this._lineWidths;h.length=0;this._isMultiLine=!1;this._measureConfig();var k={};if(0!==e)for(this._strings=c._string.split("\n"),f=0;fe&&1e&&100>p++;)h*=e/m,h|=0,k=f.substr(h), m=g-this._measure(k);for(p=0;mp++;)k&&(n=(l=cc.LabelTTF._wordRex.exec(k))?l[0].length:1,l=k),h+=n,k=f.substr(h),m=g-this._measure(k);h-=n;0===h&&(h=1,l=l.substr(1));e=f.substr(0,h);cc.LabelTTF.wrapInspection&&cc.LabelTTF._symbolRex.test(l||k)&&(g=cc.LabelTTF._lastWordRex.exec(e),h-=g?g[0].length:0,0===h&&(h=1),l=f.substr(h),e=f.substr(0,h));cc.LabelTTF._firsrEnglish.test(l)&&(g=cc.LabelTTF._lastEnglish.exec(e))&&e!==g[0]&&(h-=g[0].length,l=f.substr(h),e=f.substr(0,h));c[d]=l||k;c.splice(d, 0,e)}};a.updateStatus=function(){this._dirtyFlag&cc.Node._dirtyFlags.textDirty&&this._updateTexture();this.originUpdateStatus()};a._syncStatus=function(c){var d=cc.Node._dirtyFlags,e=this._dirtyFlag;e&d.textDirty&&this._updateTexture();this._originSyncStatus(c);(cc._renderType===cc.game.RENDER_TYPE_WEBGL||e&d.transformDirty)&&this.transform(c)};a.drawLabels=function(c,d,e){var f=this._node;if(f._shadowEnabled){var g=f._shadowOffset;c.shadowColor=this._shadowColorStr;c.shadowOffsetX=g.x;c.shadowOffsetY= -g.y;c.shadowBlur=f._shadowBlur}g=f._hAlignment;var h=f._vAlignment,k=f._strokeSize;c.font!==this._fontStyleStr&&(c.font=this._fontStyleStr);c.fillStyle=this._fillColorStr;if(f=f._strokeEnabled)c.lineWidth=2*k,c.strokeStyle=this._strokeColorStr;c.textBaseline=cc.LabelTTF._textBaseline[h];c.textAlign=cc.LabelTTF._textAlign[g];g=this._strings.length;for(h=0;h=this._status.length)){var g= this._renderingIndex>=this._status.length?this._renderingIndex-this._status.length:this._renderingIndex,h=this._status[g];this._renderingIndex=g+1;var k=f._offsetPosition.x;g=-f._offsetPosition.y-f._rect.height;var m=this._displayedOpacity/255;b.setTransform(this._worldTransform,c,d);b.setCompositeOperation(this._blendFuncStr);b.setGlobalAlpha(m);b.save();f._flippedX&&(k=-k-f._rect.width,e.scale(-1,1));f._flippedY&&(g=f._offsetPosition.y,e.scale(1,-1));c=h.xOffset+h.contextTransform.x+k*c;f=[];k= this._strings.length;for(m=0;m=c&&b.actionIndex--;a.finalize();break}}else cc.log(cc._LogInfos.ActionManager_removeAction)}},removeActionByTag:function(a, b){a===cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_addAction);cc.assert(b,cc._LogInfos.ActionManager_addAction);var c=this._hashTargets[b.__instanceId];if(c)for(var d=c.actions.length,e=0;e=a&&b.actionIndex--;0===b.actions.length&&this._deleteHashElement(b);c&&c[0]&&c[0].finalize()},_deleteHashElement:function(a){var b=!1;if(a&&!a.lock&&this._hashTargets[a.target.__instanceId]){delete this._hashTargets[a.target.__instanceId]; b=this._arrayTargets;for(var c=0,d=b.length;ct;++t){var x=v[t].style;x.color="rgb(0, 255, 255)";x.font="bold 12px Helvetica, Arial";x.lineHeight="20px";x.width="100%";l.appendChild(v[t])}var y=function(){e=cc.director.getSecondsPerFrame();c++;f+=cc.director.getDeltaTime();if(f>cc.DIRECTOR_FPS_INTERVAL){d=c/f;f=c=0;if(z.onFrameRateChange){var B=d,A=p.length-1,C=A;u++;for(w+=B;0<=C;C--)if(B>=p[C]){q[C]++;break}if(u>=n){var G=w/n;for(C=A;0=p[C]){C!=r&&(r=C,z.onFrameRateChange&&z.onFrameRateChange(G.toFixed(2))); break}w=u=0;for(C=A;0b&&a-cc.math.EPSILONc.x-a.math.EPSILON&&this.yc.y-a.math.EPSILON}})(cc);(function(a){a.math.Vec3=a.kmVec3=function(c,d,e){c&&void 0===d?(this.x=c.x,this.y=c.y,this.z=c.z):(this.x=c||0,this.y=d||0,this.z=e||0)};a.math.vec3=function(c,d,e){return new a.math.Vec3(c,d,e)};var b=a.math.Vec3.prototype;b.fill=function(c,d,e){c&&void 0===d?(this.x=c.x,this.y=c.y,this.z=c.z):(this.x=c,this.y=d,this.z=e);return this};b.length=function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+ a.math.square(this.z)};b.normalize=function(){var c=1/this.length();this.x*=c;this.y*=c;this.z*=c;return this};b.cross=function(c){var d=this.x,e=this.y,f=this.z;this.x=e*c.z-f*c.y;this.y=f*c.x-d*c.z;this.z=d*c.y-e*c.x;return this};b.dot=function(c){return this.x*c.x+this.y*c.y+this.z*c.z};b.add=function(c){this.x+=c.x;this.y+=c.y;this.z+=c.z;return this};b.subtract=function(c){this.x-=c.x;this.y-=c.y;this.z-=c.z;return this};b.transform=function(c){var d=this.x,e=this.y,f=this.z;c=c.mat;this.x=d* c[0]+e*c[4]+f*c[8]+c[12];this.y=d*c[1]+e*c[5]+f*c[9]+c[13];this.z=d*c[2]+e*c[6]+f*c[10]+c[14];return this};b.transformNormal=function(c){var d=this.x,e=this.y,f=this.z;c=c.mat;this.x=d*c[0]+e*c[4]+f*c[8];this.y=d*c[1]+e*c[5]+f*c[9];this.z=d*c[2]+e*c[6]+f*c[10];return this};b.transformCoord=function(c){var d=new a.math.Vec4(this.x,this.y,this.z,1);d.transform(c);this.x=d.x/d.w;this.y=d.y/d.w;this.z=d.z/d.w;return this};b.scale=function(c){this.x*=c;this.y*=c;this.z*=c;return this};b.equals=function(c){var d= a.math.EPSILON;return this.xc.x-d&&this.yc.y-d&&this.zc.z-d};b.inverseTransform=function(c){c=c.mat;var d=new a.math.Vec3(this.x-c[12],this.y-c[13],this.z-c[14]);this.x=d.x*c[0]+d.y*c[1]+d.z*c[2];this.y=d.x*c[4]+d.y*c[5]+d.z*c[6];this.z=d.x*c[8]+d.y*c[9]+d.z*c[10];return this};b.inverseTransformNormal=function(c){var d=this.x,e=this.y,f=this.z;c=c.mat;this.x=d*c[0]+e*c[1]+f*c[2];this.y=d*c[4]+e*c[5]+f*c[6];this.z=d*c[8]+e*c[9]+f*c[10];return this};b.assignFrom= function(c){if(!c)return this;this.x=c.x;this.y=c.y;this.z=c.z;return this};a.math.Vec3.zero=function(c){c.x=c.y=c.z=0;return c};b.toTypeArray=function(){var c=new Float32Array(3);c[0]=this.x;c[1]=this.y;c[2]=this.z;return c}})(cc);(function(a){a.math.Vec4=function(c,d,e,f){c&&void 0===d?(this.x=c.x,this.y=c.y,this.z=c.z,this.w=c.w):(this.x=c||0,this.y=d||0,this.z=e||0,this.w=f||0)};a.kmVec4=a.math.Vec4;var b=a.math.Vec4.prototype;b.fill=function(c,d,e,f){c&&void 0===d?(this.x=c.x,this.y=c.y,this.z=c.z,this.w=c.w):(this.x=c,this.y=d,this.z=e,this.w=f)};b.add=function(c){if(!c)return this;this.x+=c.x;this.y+=c.y;this.z+=c.z;this.w+=c.w;return this};b.dot=function(c){return this.x*c.x+this.y*c.y+this.z*c.z+this.w*c.w};b.length= function(){return Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w))};b.lengthSq=function(){return a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z)+a.math.square(this.w)};b.lerp=function(c,d){return this};b.normalize=function(){var c=1/this.length();this.x*=c;this.y*=c;this.z*=c;this.w*=c;return this};b.scale=function(c){this.normalize();this.x*=c;this.y*=c;this.z*=c;this.w*=c;return this};b.subtract=function(c){this.x-=c.x;this.y-= c.y;this.z-=c.z;this.w-=c.w};b.transform=function(c){var d=this.x,e=this.y,f=this.z,g=this.w;c=c.mat;this.x=d*c[0]+e*c[4]+f*c[8]+g*c[12];this.y=d*c[1]+e*c[5]+f*c[9]+g*c[13];this.z=d*c[2]+e*c[6]+f*c[10]+g*c[14];this.w=d*c[3]+e*c[7]+f*c[11]+g*c[15];return this};a.math.Vec4.transformArray=function(c,d){for(var e=[],f=0;fc.x-d&&this.yc.y-d&& this.zc.z-d&&this.wc.w-d};b.assignFrom=function(c){this.x=c.x;this.y=c.y;this.z=c.z;this.w=c.w;return this};b.toTypeArray=function(){var c=new Float32Array(4);c[0]=this.x;c[1]=this.y;c[2]=this.z;c[3]=this.w;return c}})(cc);(function(a){function b(c,d,e){d=new a.math.Vec2(d);d.subtract(c);e.x=-d.y;e.y=d.x;e.normalize()}a.math.Ray2=function(c,d){this.start=c||new a.math.Vec2;this.dir=d||new a.math.Vec2};a.math.Ray2.prototype.fill=function(c,d,e,f){this.start.x=c;this.start.y=d;this.dir.x=e;this.dir.y=f};a.math.Ray2.prototype.intersectLineSegment=function(c,d,e){var f=this.start.x,g=this.start.y,h=this.start.x+this.dir.x,k=this.start.y+this.dir.y,m=c.x,l=c.y,n=d.x,p=d.y,q=(p-l)*(h-f)-(n-m)*(k-g);if(q>-a.math.EPSILON&& qMath.max(c.x,d.x)+a.math.EPSILON||lMath.max(c.y,d.y)+a.math.EPSILON||mMath.max(f,h)+a.math.EPSILON||lMath.max(g,k)+a.math.EPSILON)return!1;e.x=m;e.y=l;return!0};a.math.Ray2.prototype.intersectTriangle=function(c,d,e,f,g){var h=new a.math.Vec2,k=new a.math.Vec2,m=new a.math.Vec2, l=1E4,n=!1;if(this.intersectLineSegment(c,d,h)){n=!0;var p=h.subtract(this.start).length();pg;++g)if(!(f[g]+e>d[g]&&f[g]-eg;g++)f[g]=e[g];return this};a.kmMat4Identity=function(e){var f=e.mat;f[1]=f[2]=f[3]=f[4]=f[6]=f[7]=f[8]=f[9]=f[11]=f[12]=f[13]=f[14]=0;f[0]=f[5]=f[10]=f[15]=1;return e};b.identity=function(){var e=this.mat;e[1]=e[2]=e[3]=e[4]=e[6]=e[7]=e[8]=e[9]=e[11]=e[12]=e[13]=e[14]=0;e[0]=e[5]=e[10]=e[15]=1; return this};b.get=function(e,f){return this.mat[e+4*f]};b.set=function(e,f,g){this.mat[e+4*f]=g};b.swap=function(e,f,g,h){var k=this.mat,m=k[e+4*f];k[e+4*f]=k[g+4*h];k[g+4*h]=m};a.math.Matrix4._gaussj=function(e,f){var g,h=0,k=0,m,l,n,p=[0,0,0,0],q=[0,0,0,0],r=[0,0,0,0];for(g=0;4>g;g++){for(m=n=0;4>m;m++)if(1!==r[m])for(l=0;4>l;l++)if(0===r[l]){var u=Math.abs(e.get(m,l));u>=n&&(n=u,k=m,h=l)}++r[h];if(k!==h){for(m=0;4>m;m++)e.swap(k,m,h,m);for(m=0;4>m;m++)f.swap(k,m,h,m)}q[g]=k;p[g]=h;if(0===e.get(h, h))return!1;l=1/e.get(h,h);e.set(h,h,1);for(m=0;4>m;m++)e.set(h,m,e.get(h,m)*l);for(m=0;4>m;m++)f.set(h,m,f.get(h,m)*l);for(l=0;4>l;l++)if(l!==h){u=e.get(l,h);e.set(l,h,0);for(m=0;4>m;m++)e.set(l,m,e.get(l,m)-e.get(h,m)*u);for(m=0;4>m;m++)f.set(l,m,e.get(l,m)-f.get(h,m)*u)}}for(m=3;0<=m;m--)if(q[m]!==p[m])for(l=0;4>l;l++)e.swap(l,q[m],l,p[m]);return!0};var c=(new a.math.Matrix4).identity();a.kmMat4Inverse=function(e,f){f=new a.math.Matrix4(f);var g=new a.math.Matrix4(c);if(!1===a.math.Matrix4._gaussj(f, g))return null;e.assignFrom(f);return e};b.inverse=function(){var e=new a.math.Matrix4(this),f=new a.math.Matrix4(c);return!1===a.math.Matrix4._gaussj(e,f)?null:e};b.isIdentity=function(){var e=this.mat;return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]};b.transpose=function(){var e=this.mat,f=e[1],g=e[2],h=e[3],k=e[6],m=e[7],l=e[8],n=e[9],p=e[11],q=e[12],r=e[13],u=e[14];e[1]=e[4]; e[2]=l;e[3]=q;e[4]=f;e[6]=n;e[7]=r;e[8]=g;e[9]=k;e[11]=u;e[12]=h;e[13]=m;e[14]=p;return this};a.kmMat4Multiply=function(e,f,g){var h=e.mat,k=f.mat,m=g.mat;g=k[0];f=k[1];var l=k[2],n=k[3],p=k[4],q=k[5],r=k[6],u=k[7],w=k[8],v=k[9],t=k[10],x=k[11],y=k[12],z=k[13],B=k[14];k=k[15];var A=m[0],C=m[1],G=m[2],E=m[3],F=m[4],K=m[5],H=m[6],L=m[7],D=m[8],M=m[9],O=m[10],Q=m[11],P=m[12],U=m[13],Z=m[14];m=m[15];h[0]=A*g+C*p+G*w+E*y;h[1]=A*f+C*q+G*v+E*z;h[2]=A*l+C*r+G*t+E*B;h[3]=A*n+C*u+G*x+E*k;h[4]=F*g+K*p+H*w+L* y;h[5]=F*f+K*q+H*v+L*z;h[6]=F*l+K*r+H*t+L*B;h[7]=F*n+K*u+H*x+L*k;h[8]=D*g+M*p+O*w+Q*y;h[9]=D*f+M*q+O*v+Q*z;h[10]=D*l+M*r+O*t+Q*B;h[11]=D*n+M*u+O*x+Q*k;h[12]=P*g+U*p+Z*w+m*y;h[13]=P*f+U*q+Z*v+m*z;h[14]=P*l+U*r+Z*t+m*B;h[15]=P*n+U*u+Z*x+m*k;return e};b.multiply=function(e){var f=this.mat,g=e.mat;e=f[0];var h=f[1],k=f[2],m=f[3],l=f[4],n=f[5],p=f[6],q=f[7],r=f[8],u=f[9],w=f[10],v=f[11],t=f[12],x=f[13],y=f[14],z=f[15],B=g[0],A=g[1],C=g[2],G=g[3],E=g[4],F=g[5],K=g[6],H=g[7],L=g[8],D=g[9],M=g[10],O=g[11], Q=g[12],P=g[13],U=g[14];g=g[15];f[0]=B*e+A*l+C*r+G*t;f[1]=B*h+A*n+C*u+G*x;f[2]=B*k+A*p+C*w+G*y;f[3]=B*m+A*q+C*v+G*z;f[4]=E*e+F*l+K*r+H*t;f[5]=E*h+F*n+K*u+H*x;f[6]=E*k+F*p+K*w+H*y;f[7]=E*m+F*q+K*v+H*z;f[8]=L*e+D*l+M*r+O*t;f[9]=L*h+D*n+M*u+O*x;f[10]=L*k+D*p+M*w+O*y;f[11]=L*m+D*q+M*v+O*z;f[12]=Q*e+P*l+U*r+g*t;f[13]=Q*h+P*n+U*u+g*x;f[14]=Q*k+P*p+U*w+g*y;f[15]=Q*m+P*q+U*v+g*z;return this};a.getMat4MultiplyValue=function(e,f){e=e.mat;f=f.mat;var g=new Float32Array(16);g[0]=e[0]*f[0]+e[4]*f[1]+e[8]*f[2]+ e[12]*f[3];g[1]=e[1]*f[0]+e[5]*f[1]+e[9]*f[2]+e[13]*f[3];g[2]=e[2]*f[0]+e[6]*f[1]+e[10]*f[2]+e[14]*f[3];g[3]=e[3]*f[0]+e[7]*f[1]+e[11]*f[2]+e[15]*f[3];g[4]=e[0]*f[4]+e[4]*f[5]+e[8]*f[6]+e[12]*f[7];g[5]=e[1]*f[4]+e[5]*f[5]+e[9]*f[6]+e[13]*f[7];g[6]=e[2]*f[4]+e[6]*f[5]+e[10]*f[6]+e[14]*f[7];g[7]=e[3]*f[4]+e[7]*f[5]+e[11]*f[6]+e[15]*f[7];g[8]=e[0]*f[8]+e[4]*f[9]+e[8]*f[10]+e[12]*f[11];g[9]=e[1]*f[8]+e[5]*f[9]+e[9]*f[10]+e[13]*f[11];g[10]=e[2]*f[8]+e[6]*f[9]+e[10]*f[10]+e[14]*f[11];g[11]=e[3]*f[8]+e[7]* f[9]+e[11]*f[10]+e[15]*f[11];g[12]=e[0]*f[12]+e[4]*f[13]+e[8]*f[14]+e[12]*f[15];g[13]=e[1]*f[12]+e[5]*f[13]+e[9]*f[14]+e[13]*f[15];g[14]=e[2]*f[12]+e[6]*f[13]+e[10]*f[14]+e[14]*f[15];g[15]=e[3]*f[12]+e[7]*f[13]+e[11]*f[14]+e[15]*f[15];return g};a.kmMat4Assign=function(e,f){if(e===f)return a.log("cc.kmMat4Assign(): pOut equals pIn"),e;var g=e.mat;f=f.mat;g[0]=f[0];g[1]=f[1];g[2]=f[2];g[3]=f[3];g[4]=f[4];g[5]=f[5];g[6]=f[6];g[7]=f[7];g[8]=f[8];g[9]=f[9];g[10]=f[10];g[11]=f[11];g[12]=f[12];g[13]=f[13]; g[14]=f[14];g[15]=f[15];return e};b.assignFrom=function(e){if(this===e)return a.log("cc.mat.Matrix4.assignFrom(): mat4 equals current matrix"),this;var f=this.mat;e=e.mat;f[0]=e[0];f[1]=e[1];f[2]=e[2];f[3]=e[3];f[4]=e[4];f[5]=e[5];f[6]=e[6];f[7]=e[7];f[8]=e[8];f[9]=e[9];f[10]=e[10];f[11]=e[11];f[12]=e[12];f[13]=e[13];f[14]=e[14];f[15]=e[15];return this};b.equals=function(e){if(this===e)return a.log("cc.kmMat4AreEqual(): pMat1 and pMat2 are same object."),!0;var f=this.mat;e=e.mat;for(var g=a.math.EPSILON, h=0;16>h;h++)if(!(f[h]+g>e[h]&&f[h]-gc?a.math.Plane.POINT_BEHIND_PLANE:a.math.Plane.POINT_ON_PLANE}})(cc);(function(a){a.math.Quaternion=function(c,d,e,f){c&&void 0===d?(this.x=c.x,this.y=c.y,this.z=c.z,this.w=c.w):(this.x=c||0,this.y=d||0,this.z=e||0,this.w=f||0)};a.kmQuaternion=a.math.Quaternion;var b=a.math.Quaternion.prototype;b.conjugate=function(c){this.x=-c.x;this.y=-c.y;this.z=-c.z;this.w=c.w;return this};b.dot=function(c){return this.w*c.w+this.x*c.x+this.y*c.y+this.z*c.z};b.exponential=function(){return this};b.identity=function(){this.z=this.y=this.x=0;this.w=1;return this};b.inverse=function(){var c= this.length();if(Math.abs(c)>a.math.EPSILON)return this.w=this.z=this.y=this.x=0,this;this.conjugate(this).scale(1/c);return this};b.isIdentity=function(){return 0===this.x&&0===this.y&&0===this.z&&1===this.w};b.length=function(){return Math.sqrt(this.lengthSq())};b.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w};b.multiply=function(c){var d=this.x,e=this.y,f=this.z,g=this.w;this.w=g*c.w-d*c.x-e*c.y-f*c.z;this.x=g*c.x+d*c.w+e*c.z-f*c.y;this.y=g*c.y+e*c.w+f*c.x- d*c.z;this.z=g*c.z+f*c.w+d*c.y-e*c.x;return this};b.normalize=function(){var c=this.length();if(Math.abs(c)<=a.math.EPSILON)throw Error("current quaternion is an invalid value");this.scale(1/c);return this};b.rotationAxis=function(c,d){d*=.5;var e=Math.sin(d);this.w=Math.cos(d);this.x=c.x*e;this.y=c.y*e;this.z=c.z*e;return this};a.math.Quaternion.rotationMatrix=function(c){if(!c)return null;var d=[];c=c.mat;d[0]=c[0];d[1]=c[3];d[2]=c[6];d[4]=c[1];d[5]=c[4];d[6]=c[7];d[8]=c[2];d[9]=c[5];d[10]=c[8]; d[15]=1;var e=d[0];d=e[0]+e[5]+e[10]+1;if(d>a.math.EPSILON){var f=2*Math.sqrt(d);d=(e[9]-e[6])/f;c=(e[2]-e[8])/f;var g=(e[4]-e[1])/f;e=.25*f}else e[0]>e[5]&&e[0]>e[10]?(f=2*Math.sqrt(1+e[0]-e[5]-e[10]),d=.25*f,c=(e[4]+e[1])/f,g=(e[2]+e[8])/f,e=(e[9]-e[6])/f):e[5]>e[10]?(f=2*Math.sqrt(1+e[5]-e[0]-e[10]),d=(e[4]+e[1])/f,c=.25*f,g=(e[9]+e[6])/f,e=(e[2]-e[8])/f):(f=2*Math.sqrt(1+e[10]-e[0]-e[5]),d=(e[2]+e[8])/f,c=(e[9]+e[6])/f,g=.25*f,e=(e[4]-e[1])/f);return new a.math.Quaternion(d,c,g,e)};a.math.Quaternion.rotationYawPitchRoll= function(c,d,e){var f=a.degreesToRadians(d)/2;var g=a.degreesToRadians(c)/2;var h=a.degreesToRadians(e)/2;e=Math.cos(f);c=Math.cos(g);d=Math.cos(h);f=Math.sin(f);g=Math.sin(g);h=Math.sin(h);var k=c*d;var m=g*h;var l=new a.math.Quaternion;l.w=e*k+f*m;l.x=f*k-e*m;l.y=e*g*d+f*c*h;l.z=e*c*h-f*g*d;l.normalize();return l};b.slerp=function(c,d){if(this.x===c.x&&this.y===c.y&&this.z===c.z&&this.w===c.w)return this;var e=this.dot(c),f=Math.acos(e),g=Math.sqrt(1-a.math.square(e));e=Math.sin(d*f)/g;d=Math.sin((1- d)*f)/g;c=new a.math.Quaternion(c);this.scale(d);c.scale(e);this.add(c);return this};b.toAxisAndAngle=function(){var c=new a.math.Vec3;var d=Math.acos(this.w);var e=Math.sqrt(a.math.square(this.x)+a.math.square(this.y)+a.math.square(this.z));e>-a.math.EPSILON&&e2*Math.PI-a.math.EPSILON?(d=0,c.x=0,c.y=0,c.z=1):(d*=2,c.x=this.x/e,c.y=this.y/e,c.z=this.z/e,c.normalize());return{axis:c,angle:d}};b.scale=function(c){this.x*=c;this.y*=c;this.z*=c;this.w*=c; return this};b.assignFrom=function(c){this.x=c.x;this.y=c.y;this.z=c.z;this.w=c.w;return this};b.add=function(c){this.x+=c.x;this.y+=c.y;this.z+=c.z;this.w+=c.w;return this};a.math.Quaternion.rotationBetweenVec3=function(c,d,e){var f=new a.math.Vec3(c),g=new a.math.Vec3(d);f.normalize();g.normalize();var h=f.dot(g);d=new a.math.Quaternion;if(1<=h)return d.identity(),d;-.999999>h?Math.abs(e.lengthSq())=this.min.x&&a.x<=this.max.x&&a.y>=this.min.y&&a.y<=this.max.y&&a.z>=this.min.z&&a.z<=this.max.z};cc.math.AABB.containsPoint=function(a,b){return a.x>=b.min.x&&a.x<=b.max.x&&a.y>=b.min.y&&a.y<=b.max.y&&a.z>=b.min.z&&a.z<=b.max.z};cc.math.AABB.prototype.assignFrom=function(a){this.min.assignFrom(a.min);this.max.assignFrom(a.max)}; cc.math.AABB.assign=function(a,b){a.min.assignFrom(b.min);a.max.assignFrom(b.max);return a};(function(a){a.math.Matrix4Stack=function(c,d){this.top=c;this.stack=d||[];this.lastUpdated=0};a.km_mat4_stack=a.math.Matrix4Stack;var b=a.math.Matrix4Stack.prototype;b.initialize=function(){this.stack.length=0;this.top=null};a.km_mat4_stack_push=function(c,d){c.stack.push(c.top);c.top=new a.math.Matrix4(d)};a.km_mat4_stack_pop=function(c,d){c.top=c.stack.pop()};a.km_mat4_stack_release=function(c){c.stack=null;c.top=null};b.push=function(c){c=c||this.top;this.stack.push(this.top);this.top=new a.math.Matrix4(c)}; b.pop=function(){this.top=this.stack.pop()};b.release=function(){this._matrixPool=this.top=this.stack=null};b._getFromPool=function(c){var d=this._matrixPool;if(0===d.length)return new a.math.Matrix4(c);d=d.pop();d.assignFrom(c);return d};b._putInPool=function(c){this._matrixPool.push(c)}})(cc);(function(a){a.KM_GL_MODELVIEW=5888;a.KM_GL_PROJECTION=5889;a.KM_GL_TEXTURE=5890;a.modelview_matrix_stack=new a.math.Matrix4Stack;a.projection_matrix_stack=new a.math.Matrix4Stack;a.texture_matrix_stack=new a.math.Matrix4Stack;a.current_stack=null;a.lazyInitialize=function(){var d=new a.math.Matrix4;a.modelview_matrix_stack.initialize();a.projection_matrix_stack.initialize();a.texture_matrix_stack.initialize();a.current_stack=a.modelview_matrix_stack;a.initialized=!0;d.identity();a.modelview_matrix_stack.push(d); a.projection_matrix_stack.push(d);a.texture_matrix_stack.push(d)};a.lazyInitialize();a.kmGLFreeAll=function(){a.modelview_matrix_stack.release();a.modelview_matrix_stack=null;a.projection_matrix_stack.release();a.projection_matrix_stack=null;a.texture_matrix_stack.release();a.texture_matrix_stack=null;a.initialized=!1;a.current_stack=null};a.kmGLPushMatrix=function(){a.current_stack.push(a.current_stack.top)};a.kmGLPushMatrixWitMat4=function(d){a.current_stack.stack.push(a.current_stack.top);d.assignFrom(a.current_stack.top); a.current_stack.top=d};a.kmGLPopMatrix=function(){a.current_stack.top=a.current_stack.stack.pop()};a.kmGLMatrixMode=function(d){switch(d){case a.KM_GL_MODELVIEW:a.current_stack=a.modelview_matrix_stack;break;case a.KM_GL_PROJECTION:a.current_stack=a.projection_matrix_stack;break;case a.KM_GL_TEXTURE:a.current_stack=a.texture_matrix_stack;break;default:throw Error("Invalid matrix mode specified");}a.current_stack.lastUpdated=a.director.getTotalFrames()};a.kmGLLoadIdentity=function(){a.current_stack.top.identity()}; a.kmGLLoadMatrix=function(d){a.current_stack.top.assignFrom(d)};a.kmGLMultMatrix=function(d){a.current_stack.top.multiply(d)};var b=new a.math.Matrix4;a.kmGLTranslatef=function(d,e,f){d=a.math.Matrix4.createByTranslation(d,e,f,b);a.current_stack.top.multiply(d)};var c=new a.math.Vec3;a.kmGLRotatef=function(d,e,f,g){c.fill(e,f,g);d=a.math.Matrix4.createByAxisAndAngle(c,a.degreesToRadians(d),b);a.current_stack.top.multiply(d)};a.kmGLScalef=function(d,e,f){d=a.math.Matrix4.createByScale(d,e,f,b);a.current_stack.top.multiply(d)}; a.kmGLGetMatrix=function(d,e){switch(d){case a.KM_GL_MODELVIEW:e.assignFrom(a.modelview_matrix_stack.top);break;case a.KM_GL_PROJECTION:e.assignFrom(a.projection_matrix_stack.top);break;case a.KM_GL_TEXTURE:e.assignFrom(a.texture_matrix_stack.top);break;default:throw Error("Invalid matrix mode specified");}}})(cc);cc.SHADER_POSITION_UCOLOR_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor;\nvoid main() \n{ \n gl_FragColor = 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 = (CC_PMatrix * CC_MVMatrix) * a_position; \n gl_PointSize = u_pointSize; \n v_fragmentColor = u_color; \n}"; cc.SHADER_POSITION_COLOR_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvoid main() \n{ \n gl_FragColor = 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 = (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor = a_color; \n}";cc.SHADER_SPRITE_POSITION_COLOR_VERT="attribute vec4 a_position;\nattribute vec4 a_color;\nvarying lowp vec4 v_fragmentColor;\nvoid main()\n{\n gl_Position = CC_PMatrix * a_position; \n v_fragmentColor = 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 = v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord)); \n// #else\t\ngl_FragColor = 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 = a_color;//vec4(a_color.rgb * a_color.a, a_color.a); \n v_texcoord = a_texcoord; \n gl_Position = (CC_PMatrix * CC_MVMatrix) * a_position; \n}"; cc.SHADER_POSITION_TEXTURE_FRAG="precision lowp float; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor = 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 = (CC_PMatrix * CC_MVMatrix) * a_position; \n v_texCoord = a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG="precision lowp float; \nuniform vec4 u_color; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor = 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 = (CC_PMatrix * CC_MVMatrix) * a_position; \n v_texCoord = a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor = 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 = (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor = a_color; \n v_texCoord = a_texCoord; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_FragColor = 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 = (CC_PMatrix * CC_MVMatrix) * a_position; \n v_fragmentColor = a_color; \n v_texCoord = a_texCoord; \n}";cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT="attribute vec4 a_position; \nattribute vec2 a_texCoord; \nattribute vec4 a_color; \nvarying lowp vec4 v_fragmentColor; \nvarying mediump vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = CC_PMatrix * a_position; \n v_fragmentColor = a_color; \n v_texCoord = a_texCoord; \n}"; cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG="precision lowp float;\nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n vec4 c = texture2D(CC_Texture0, v_texCoord); \n gl_FragColor.xyz = vec3(0.2126*c.r + 0.7152*c.g + 0.0722*c.b); \n gl_FragColor.w = c.w ; \n}";cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG="precision lowp float; \nvarying vec4 v_fragmentColor; \nvarying vec2 v_texCoord; \nuniform float CC_alpha_value; \nvoid main() \n{ \n vec4 texColor = texture2D(CC_Texture0, v_texCoord); \n if ( texColor.a <= CC_alpha_value ) \n discard; \n gl_FragColor = 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 = texture2D(u_texture, v_texCoord); \n vec4 maskColor = texture2D(u_mask, v_texCoord); \n vec4 finalColor = vec4(texColor.r, texColor.g, texColor.b, maskColor.a * texColor.a); \n gl_FragColor = v_fragmentColor * finalColor; \n}";cc.shaderCache={TYPE_POSITION_TEXTURECOLOR:0,TYPE_POSITION_TEXTURECOLOR_ALPHATEST:1,TYPE_POSITION_COLOR:2,TYPE_POSITION_TEXTURE:3,TYPE_POSITION_TEXTURE_UCOLOR:4,TYPE_POSITION_TEXTURE_A8COLOR:5,TYPE_POSITION_UCOLOR:6,TYPE_POSITION_LENGTH_TEXTURECOLOR:7,TYPE_SPRITE_POSITION_TEXTURECOLOR:8,TYPE_SPRITE_POSITION_TEXTURECOLOR_ALPHATEST:9,TYPE_SPRITE_POSITION_COLOR:10,TYPE_SPRITE_POSITION_TEXTURECOLOR_GRAY:11,TYPE_MAX:11,_keyMap:[cc.SHADER_POSITION_TEXTURECOLOR,cc.SHADER_POSITION_TEXTURECOLORALPHATEST,cc.SHADER_POSITION_COLOR, cc.SHADER_POSITION_TEXTURE,cc.SHADER_POSITION_TEXTURE_UCOLOR,cc.SHADER_POSITION_TEXTUREA8COLOR,cc.SHADER_POSITION_UCOLOR,cc.SHADER_POSITION_LENGTHTEXTURECOLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST,cc.SHADER_SPRITE_POSITION_COLOR,cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY],_programs:{},_init:function(){this.loadDefaultShaders();return!0},_loadDefaultShader:function(a,b){switch(b){case cc.SHADER_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT, cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR, cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLOR_GRAY:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_GRAY_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_COLOR_VERT, cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_SPRITE_POSITION_TEXTURECOLORALPHATEST:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_TEXTURE_COLOR_VERT,cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION); a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_VERT,cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_SPRITE_POSITION_COLOR:a.initWithVertexShaderByteArray(cc.SHADER_SPRITE_POSITION_COLOR_VERT, cc.SHADER_POSITION_COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;case cc.SHADER_POSITION_TEXTURE:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_VERT,cc.SHADER_POSITION_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTURE_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT, cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_TEXTUREA8COLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT,cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD, cc.VERTEX_ATTRIB_TEX_COORDS);break;case cc.SHADER_POSITION_UCOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_UCOLOR_VERT,cc.SHADER_POSITION_UCOLOR_FRAG);a.addAttribute("aVertex",cc.VERTEX_ATTRIB_POSITION);break;case cc.SHADER_POSITION_LENGTHTEXTURECOLOR:a.initWithVertexShaderByteArray(cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT,cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG);a.addAttribute(cc.ATTRIBUTE_NAME_POSITION,cc.VERTEX_ATTRIB_POSITION);a.addAttribute(cc.ATTRIBUTE_NAME_TEX_COORD,cc.VERTEX_ATTRIB_TEX_COORDS); a.addAttribute(cc.ATTRIBUTE_NAME_COLOR,cc.VERTEX_ATTRIB_COLOR);break;default:cc.log("cocos2d: cc.shaderCache._loadDefaultShader, error shader type");return}a.link();a.updateUniforms()},loadDefaultShaders:function(){for(var a=0;a"},_compileShader:function(a,b,c){if(!c||!a)return!1;c=(cc.GLProgram._isHighpSupported()?"precision highp float;\n":"precision mediump float;\n")+"uniform mat4 CC_PMatrix; \nuniform mat4 CC_MVMatrix; \nuniform mat4 CC_MVPMatrix; \nuniform vec4 CC_Time; \nuniform vec4 CC_SinTime; \nuniform vec4 CC_CosTime; \nuniform vec4 CC_Random01; \nuniform sampler2D CC_Texture0; \n//CC INCLUDES END \n"+ c;this._glContext.shaderSource(a,c);this._glContext.compileShader(a);c=this._glContext.getShaderParameter(a,this._glContext.COMPILE_STATUS);c||(cc.log("cocos2d: ERROR: Failed to compile shader:\n"+this._glContext.getShaderSource(a)),b===this._glContext.VERTEX_SHADER?cc.log("cocos2d: \n"+this.vertexShaderLog()):cc.log("cocos2d: \n"+this.fragmentShaderLog()));return!0===c},ctor:function(a,b,c){this._uniforms={};this._hashForUniforms={};this._glContext=c||cc._renderContext;a&&b&&this.init(a,b)},destroyProgram:function(){this._hashForUniforms= this._uniforms=this._fragShader=this._vertShader=null;this._glContext.deleteProgram(this._programObj)},initWithVertexShaderByteArray:function(a,b){var c=this._glContext;this._programObj=c.createProgram();cc.checkGLErrorDebug(this,"afterCreateProgramObj");this._fragShader=this._vertShader=null;a&&(this._vertShader=c.createShader(c.VERTEX_SHADER),this._compileShader(this._vertShader,c.VERTEX_SHADER,a)||cc.log("cocos2d: ERROR: Failed to compile vertex shader"));b&&(this._fragShader=c.createShader(c.FRAGMENT_SHADER), this._compileShader(this._fragShader,c.FRAGMENT_SHADER,b)||cc.log("cocos2d: ERROR: Failed to compile fragment shader"));this._vertShader&&c.attachShader(this._programObj,this._vertShader);cc.checkGLErrorDebug();this._fragShader&&c.attachShader(this._programObj,this._fragShader);0arguments.length))switch(arguments.length){case 2:this.setUniformLocationWith1f(arguments[0],arguments[1]);break;case 3:this.setUniformLocationWith2f(arguments[0],arguments[1],arguments[2]);break;case 4:this.setUniformLocationWith3f(arguments[0],arguments[1],arguments[2],arguments[3]);break;case 5:this.setUniformLocationWith4f(arguments[0],arguments[1],arguments[2],arguments[3], arguments[4])}},setUniformsForBuiltins:function(){var a=new cc.math.Matrix4,b=new cc.math.Matrix4,c=new cc.math.Matrix4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,a);cc.kmGLGetMatrix(cc.KM_GL_MODELVIEW,b);cc.kmMat4Multiply(c,a,b);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],a.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director, a=a.getTotalFrames()*a.getAnimationInterval(),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())},_setUniformsForBuiltinsForRenderer:function(a){if(a&& a._renderCmd){var b=new cc.math.Matrix4,c=new cc.math.Matrix4;cc.kmGLGetMatrix(cc.KM_GL_PROJECTION,b);cc.kmMat4Multiply(c,b,a._renderCmd._stackMatrix);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],b.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],a._renderCmd._stackMatrix.mat,1);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],c.mat,1);this._usesTime&&(a=cc.director,a=a.getTotalFrames()*a.getAnimationInterval(), this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_TIME_S],a/10,a,2*a,4*a),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_SINTIME_S],a/8,a/4,a/2,Math.sin(a)),this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_COSTIME_S],a/8,a/4,a/2,Math.cos(a)));-1!==this._uniforms[cc.UNIFORM_RANDOM01_S]&&this.setUniformLocationWith4f(this._uniforms[cc.UNIFORM_RANDOM01_S],Math.random(),Math.random(),Math.random(),Math.random())}},setUniformForModelViewProjectionMatrix:function(){this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S], cc.getMat4MultiplyValue(cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top))},setUniformForModelViewProjectionMatrixWithMat4:function(a){cc.kmMat4Multiply(a,cc.projection_matrix_stack.top,cc.modelview_matrix_stack.top);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVPMATRIX_S],a.mat)},setUniformForModelViewAndProjectionMatrixWithMat4:function(){this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],cc.modelview_matrix_stack.top.mat);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S], cc.projection_matrix_stack.top.mat)},_setUniformForMVPMatrixWithMat4:function(a){if(!a)throw Error("modelView matrix is undefined.");this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_MVMATRIX_S],a.mat);this.setUniformLocationWithMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S],cc.projection_matrix_stack.top.mat)},_updateProjectionUniform:function(){var a=cc.projection_matrix_stack;a.lastUpdated!==this._projectionUpdated&&(this._glContext.uniformMatrix4fv(this._uniforms[cc.UNIFORM_PMATRIX_S], !1,a.top.mat),this._projectionUpdated=a.lastUpdated)},vertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getVertexShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},getFragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._vertShader)},fragmentShaderLog:function(){return this._glContext.getShaderInfoLog(this._fragShader)},programLog:function(){return this._glContext.getProgramInfoLog(this._programObj)},getProgramLog:function(){return this._glContext.getProgramInfoLog(this._programObj)}, reset:function(){this._fragShader=this._vertShader=null;0=this._duration},_cloneDecoration:function(a){a._repeatForever=this._repeatForever;a._speed=this._speed;a._timesForRepeat=this._timesForRepeat;a._easeList=this._easeList;a._speedMethod=this._speedMethod;a._repeatMethod=this._repeatMethod},_reverseEaseList:function(a){if(this._easeList){a._easeList=[];for(var b=0;ba? a:1;this.update(0=a)return cc.log("The speed parameter error"),this;this._speedMethod=!0;this._speed*=a;return this},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a;return this},repeat:function(a){a=Math.round(a);if(isNaN(a)||1>a)return cc.log("The repeat parameter error"),this;this._repeatMethod=!0;this._timesForRepeat*=a;return this},repeatForever:function(){this._repeatMethod= !0;this._timesForRepeat=this.MAX_VALUE;this._repeatForever=!0;return this}});cc.actionInterval=function(a){return new cc.ActionInterval(a)};cc.ActionInterval.create=cc.actionInterval; cc.Sequence=cc.ActionInterval.extend({_actions:[],_split:null,_last:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);var b=a instanceof Array?a:Array.prototype.slice.call(arguments),c=[];0=e){for(;a>e&&this._totalb?this._actions[1]=cc.Sequence.fromArray([this._actions[1],cc.delayTime(a-b)]):ac&&(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+=this._delta.y* a;a*=this._delta.x;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;a+=c.x;b+=c.y;f.x=a;f.y=b;this.target.setPosition(a,b)}else this.target.setPosition(c.x+a,c.y+b)}},reverse:function(){var a=new cc.JumpBy(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.jumpBy=function(a,b,c,d,e){return new cc.JumpBy(a,b,c,d,e)};cc.JumpBy.create=cc.jumpBy; cc.JumpTo=cc.JumpBy.extend({_endPosition:null,ctor:function(a,b,c,d,e){cc.JumpBy.prototype.ctor.call(this);this._endPosition=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.JumpBy.prototype.initWithDuration.call(this,a,b,c,d,e)?(void 0===e&&(c=b.y,b=b.x),this._endPosition.x=b,this._endPosition.y=c,!0):!1},startWithTarget:function(a){cc.JumpBy.prototype.startWithTarget.call(this,a);this._delta.x=this._endPosition.x-this._startPosition.x;this._delta.y= this._endPosition.y-this._startPosition.y},clone:function(){var a=new cc.JumpTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._endPosition,this._height,this._jumps);return a}});cc.jumpTo=function(a,b,c,d,e){return new cc.JumpTo(a,b,c,d,e)};cc.JumpTo.create=cc.jumpTo;cc.bezierAt=function(a,b,c,d,e){return Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*b+3*Math.pow(e,2)*(1-e)*c+Math.pow(e,3)*d}; cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);this._config=[];this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._config=b,!0):!1},clone:function(){var a=new cc.BezierBy;this._cloneDecoration(a);for(var b=[],c=0;cb/2}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._originalState=a.visible},stop:function(){this.target.visible=this._originalState;cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var a=new cc.Blink(this._duration,this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.blink=function(a,b){return new cc.Blink(a,b)};cc.Blink.create=cc.blink; cc.FadeTo=cc.ActionInterval.extend({_toOpacity:0,_fromOpacity:0,ctor:function(a,b){cc.ActionInterval.prototype.ctor.call(this);void 0!==b&&this.initWithDuration(a,b)},initWithDuration:function(a,b){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._toOpacity=b,!0):!1},clone:function(){var a=new cc.FadeTo;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},update:function(a){a=this._computeEaseTime(a);var b=void 0!==this._fromOpacity?this._fromOpacity: 255;this.target.opacity=b+(this._toOpacity-b)*a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._fromOpacity=a.opacity}});cc.fadeTo=function(a,b){return new cc.FadeTo(a,b)};cc.FadeTo.create=cc.fadeTo; cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,255)},reverse:function(){var a=new cc.FadeOut;a.initWithDuration(this._duration,0);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeIn;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a},startWithTarget:function(a){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity); cc.FadeTo.prototype.startWithTarget.call(this,a)}});cc.fadeIn=function(a){return new cc.FadeIn(a)};cc.FadeIn.create=cc.fadeIn; cc.FadeOut=cc.FadeTo.extend({ctor:function(a){cc.FadeTo.prototype.ctor.call(this);null==a&&(a=0);this.initWithDuration(a,0)},reverse:function(){var a=new cc.FadeIn;a._reverseAction=this;a.initWithDuration(this._duration,255);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.FadeOut;this._cloneDecoration(a);a.initWithDuration(this._duration,this._toOpacity);return a}});cc.fadeOut=function(a){return new cc.FadeOut(a)};cc.FadeOut.create=cc.fadeOut; cc.TintTo=cc.ActionInterval.extend({_to:null,_from:null,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);this._to=cc.color(0,0,0);this._from=cc.color(0,0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._to=cc.color(b,c,d),!0):!1},clone:function(){var a=new cc.TintTo;this._cloneDecoration(a);var b=this._to;a.initWithDuration(this._duration,b.r,b.g,b.b);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);this._from=this.target.color},update:function(a){a=this._computeEaseTime(a);var b=this._from,c=this._to;b&&this.target.setColor(cc.color(b.r+(c.r-b.r)*a,b.g+(c.g-b.g)*a,b.b+(c.b-b.b)*a))}});cc.tintTo=function(a,b,c,d){return new cc.TintTo(a,b,c,d)};cc.TintTo.create=cc.tintTo; cc.TintBy=cc.ActionInterval.extend({_deltaR:0,_deltaG:0,_deltaB:0,_fromR:0,_fromG:0,_fromB:0,ctor:function(a,b,c,d){cc.ActionInterval.prototype.ctor.call(this);void 0!==d&&this.initWithDuration(a,b,c,d)},initWithDuration:function(a,b,c,d){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(this._deltaR=b,this._deltaG=c,this._deltaB=d,!0):!1},clone:function(){var a=new cc.TintBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB);return a}, startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);a=a.color;this._fromR=a.r;this._fromG=a.g;this._fromB=a.b},update:function(a){a=this._computeEaseTime(a);this.target.color=cc.color(this._fromR+this._deltaR*a,this._fromG+this._deltaG*a,this._fromB+this._deltaB*a)},reverse:function(){var a=new cc.TintBy(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.tintBy=function(a,b,c,d){return new cc.TintBy(a,b,c,d)};cc.TintBy.create=cc.tintBy;cc.DelayTime=cc.ActionInterval.extend({update:function(a){},reverse:function(){var a=new cc.DelayTime(this._duration);this._cloneDecoration(a);this._reverseEaseList(a);return a},clone:function(){var a=new cc.DelayTime;this._cloneDecoration(a);a.initWithDuration(this._duration);return a}});cc.delayTime=function(a){return new cc.DelayTime(a)};cc.DelayTime.create=cc.delayTime; cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._other=null;a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw Error("cc.ReverseTime.initWithAction(): action must be non null");if(a===this._other)throw Error("cc.ReverseTime.initWithAction(): the action was already passed in.");return cc.ActionInterval.prototype.initWithDuration.call(this,a._duration)?(this._other=a,!0):!1},clone:function(){var a=new cc.ReverseTime; this._cloneDecoration(a);a.initWithAction(this._other.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._other.startWithTarget(a)},update:function(a){a=this._computeEaseTime(a);this._other&&this._other.update(1-a)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop();cc.Action.prototype.stop.call(this)}});cc.reverseTime=function(a){return new cc.ReverseTime(a)};cc.ReverseTime.create=cc.reverseTime; cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,_currFrameIndex:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._splitTimes=[];a&&this.initWithAnimation(a)},getAnimation:function(){return this._animation},setAnimation:function(a){this._animation=a},getCurrentFrameIndex:function(){return this._currFrameIndex},initWithAnimation:function(a){if(!a)throw Error("cc.Animate.initWithAnimation(): animation must be non-NULL"); var b=a.getDuration();if(this.initWithDuration(b*a.getLoops())){this._nextFrame=0;this.setAnimation(a);this._origFrame=null;this._executedLoops=0;var c=this._splitTimes,d=c.length=0,e=b/a.getTotalDelayUnits();a=a.getFrames();cc.arrayVerifyType(a,cc.AnimationFrame);for(var f=0;fa&&(a*=this._animation.getLoops(),(0|a)>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),a%=1);for(var b=this._animation.getFrames(),c=b.length,d=this._splitTimes,e=this._nextFrame;ea?this._inner.update(.5*Math.pow(a,this._rate)):this._inner.update(1-.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(b){b*=2;return 1>b?.5*Math.pow(b,this._rate):1-.5*Math.pow(2-b,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?.5*Math.pow(2,10*(a-1)):.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?.5*Math.pow(2,10*(a-1)):.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:-.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:-.5*(Math.cos(Math.PI*a)-1)},reverse:function(){return cc._easeSineInOutObj}}; cc.easeSineInOut=function(){return cc._easeSineInOutObj}; cc.EaseElastic=cc.ActionEase.extend({_period:.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?.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){if(0!==a&&1!==a){var b=this._period/4;--a;a=-Math.pow(2,10*a)*Math.sin((a-b)*Math.PI*2/this._period)}this._inner.update(a)},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;return-Math.pow(2,10*a)*Math.sin((a-.075)*Math.PI*2/.3)},reverse:function(){return cc._easeElasticOutObj}};cc.easeElasticIn=function(a){return a&&.3!==a?{_period:a,easing:function(b){if(0===b||1===b)return b;--b;return-Math.pow(2,10*b)*Math.sin((b-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){this._inner.update(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 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-.075)*Math.PI*2/.3)+1},reverse:function(){return cc._easeElasticInObj}};cc.easeElasticOut=function(a){return a&&.3!==a?{_period:a,easing:function(b){return 0===b||1===b?b:Math.pow(2,-10*b)*Math.sin((b-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=this._period;if(0!==a&&1!==a){b||(b=this._period=.3*1.5);var c=b/4;a=2*a-1;a=0>a?-.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)*.5+1}this._inner.update(a)},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||.3,easing:function(b){var c=this._period;if(0!==b&&1!==b){c||(c=this._period=.3*1.5);var d=c/4;b=2*b-1;b=0>b?-.5*Math.pow(2,10*b)*Math.sin((b-d)*Math.PI*2/c):Math.pow(2,-10*b)*Math.sin((b-d)*Math.PI*2/c)*.5+1}return b},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+.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+.9375;a-=2.625/2.75;return 7.5625*a*a+.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+.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+.9375;a-=2.625/2.75;return 7.5625*a*a+.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){a=.5>a?.5*(1-this.bounceTime(1-2*a)):.5*this.bounceTime(2*a-1)+.5;this._inner.update(a)},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.5>a?.5*(1-cc._bounceTime(1-2*a)):.5*cc._bounceTime(2*a-1)+.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;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;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){a*=2;1>a?a=a*a*.5:(--a,a=-.5*(a*(a-2)-1));return a},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;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.5*a*a*a*a;a-=2;return-.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;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.5*a*a*a*a*a;a-=2;return.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;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-.5*(Math.sqrt(1-a*a)-1);a-=2;return.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;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.5*a*a*a;a-=2;return.5*(a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return new cc.EaseCubicActionInOut(this._inner.reverse())}});cc.EaseCubicActionInOut.create=function(a){return new cc.EaseCubicActionInOut(a)}; cc._easeCubicActionInOut={easing:cc.EaseCubicActionInOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionInOut}};cc.easeCubicActionInOut=function(){return cc._easeCubicActionInOut};cc.cardinalSplineAt=function(a,b,c,d,e,f,g){var h=f*f,k=h*f,m=(1-e)/2;e=m*(-k+2*h-f);var l=m*(-k+h)+(2*k-3*h+1);f=m*(k-2*h+f)+(-2*k+3*h);k=m*(k-h);h=a.x*e+b.x*l+c.x*f+d.x*k;a=a.y*e+b.y*l+c.y*f+d.y*k;if(void 0!==g)g.x=h,g.y=a;else return cc.p(h,a)};cc.reverseControlPoints=function(a){for(var b=[],c=a.length-1;0<=c;c--)b.push(cc.p(a[c].x,a[c].y));return b};cc.cloneControlPoints=function(a){for(var b=[],c=0;cthis.buffer.duration},set paused(a){},get loop(){return this._loop},set loop(a){return this._loop=a},get volume(){return this._volume.gain.value},set volume(a){return this._volume.gain.value=a},get currentTime(){return this.playedLength},set currentTime(a){return this.playedLength=a},play:function(a){this._currentSource&& !this.paused&&(this._currentSource.stop(0),this.playedLength=0);var b=this.context.createBufferSource();b.buffer=this.buffer;b.connect(this._volume);b.loop=this._loop;this._startTime=this.context.currentTime;a=a||this.playedLength;var c=this.buffer.duration;this._loop?b.start?b.start(0):b.notoGrainOn?b.noteGrainOn(0):b.noteOn(0):b.start?b.start(0,a,c-a):b.notoGrainOn?b.noteGrainOn(0,a,c-a):b.noteOn(0,a,c-a);this._currentSource=b},pause:function(){this.playedLength=this.context.currentTime-this._startTime; this.playedLength%=this.buffer.duration;0>this.playedLength&&(this.playedLength=0);var a=this._currentSource;this._currentSource=null;this._startTime=-1;a&&a.stop()}}; (function(a){var b=a.WEB_AUDIO,c=a.ONLY_ONE,d=[];(function(){var g=document.createElement("audio");if("function"===typeof g.canPlayType){var h=g.canPlayType('audio/ogg; codecs="vorbis"');h&&""!==h&&d.push(".ogg");(h=g.canPlayType("audio/mpeg"))&&""!==h&&d.push(".mp3");(h=g.canPlayType('audio/wav; codecs="1"'))&&""!==h&&d.push(".wav");(h=g.canPlayType("audio/mp4"))&&""!==h&&d.push(".mp4");(g=g.canPlayType("audio/x-m4a"))&&""!==g&&d.push(".m4a")}})();try{if(b){var e=new (window.AudioContext||window.webkitAudioContext|| window.mozAudioContext);cc.Audio._context=e;if(!(e.createBufferSource&&e.createGain&&e.destination&&e.decodeAudioData))throw"context is incomplete";}}catch(g){b=!1,cc.log("browser don't support web audio")}var f={cache:{},useWebAudio:!0,loadBuffer:function(g,h){if(b){var k=cc.loader.getXMLHttpRequest();k.open("GET",g,!0);k.responseType="arraybuffer";k.onload=function(){0<=k._timeoutId&&clearTimeout(k._timeoutId);e.decodeAudioData(k.response,function(m){h(null,m)},function(){h("decode error - "+g)})}; k.onerror=function(){h("request error - "+g)};void 0===k.ontimeout&&(k._timeoutId=setTimeout(function(){k.ontimeout()},k.timeout));k.ontimeout=function(){h("request timeout - "+g)};k.send()}},load:function(g,h,k,m){if(0===d.length)return m("can not support audio!");var l=cc.loader.getRes(h);if(l)return m(null,l);cc.loader.audioPath&&(g=cc.path.join(cc.loader.audioPath,g));l=cc.path.extname(g);k=[l];for(var n=0;ng&&(g=0);this._musicVolume=g;var h=this._currMusic;h&&h.setVolume(g)},isMusicPlaying:function(){var g= this._currMusic;return g?g.getPlaying():!1},_audioPool:{},_maxAudioInstance:10,_effectVolume:1,playEffect:function(g,h){if(c&&this._currMusic&&this._currMusic.getPlaying())return cc.log("Browser is only allowed to play one audio"),null;var k=this._audioPool[g];k||(k=this._audioPool[g]=[]);for(var m=0;mthis._maxAudioInstance&&(m=k.shift(),m.stop(),k.push(m),m=k.length-1);if(k[m]){var l=k[m];l.setVolume(this._effectVolume);l.play(0,h||!1);return l}(l=cc.loader.getRes(g))&& b&&"AUDIO"===l._AUDIO_TYPE&&(cc.loader.release(g),l=null);if(l)if(b&&"AUDIO"===l._AUDIO_TYPE)f.loadBuffer(g,function(n,p){l.setBuffer(p);l.setVolume(cc.audioEngine._effectVolume);l.getPlaying()||l.play(0,h||!1)});else return l=l.cloneNode(),l.setVolume(this._effectVolume),l.play(0,h||!1),k.push(l),l;m=f.useWebAudio;f.useWebAudio=!0;cc.loader.load(g,function(n){n=cc.loader.getRes(g);n=n.cloneNode();n.setVolume(cc.audioEngine._effectVolume);n.play(0,h||!1);k.push(n)});f.useWebAudio=m;return l},setEffectsVolume:function(g){g-= 0;isNaN(g)&&(g=1);1g&&(g=0);this._effectVolume=g;var h=this._audioPool,k;for(k in h){var m=h[k];if(Array.isArray(m))for(var l=0;l=b||this.impl._delegateWithIme&&this.impl._delegateWithIme.insertText(a,b)},dispatchDeleteBackward:function(){this.impl&&this.impl._delegateWithIme&&this.impl._delegateWithIme.deleteBackward()}, getContentText:function(){if(this.impl&&this.impl._delegateWithIme){var a=this.impl._delegateWithIme.getContentText();return a?a:""}return""},dispatchKeyboardWillShow:function(a){if(this.impl)for(var b=0;ba?a===cc.KEY.backspace?this.dispatchDeleteBackward():a===cc.KEY.enter&&this.dispatchInsertText("\n",1):255>a&&this.dispatchInsertText(String.fromCharCode(a),1)}});cc.IMEDispatcher.Impl=cc.Class.extend({_delegateWithIme:null,_delegateList:null,ctor:function(){this._delegateList=[]},findDelegate:function(a){for(var b=0;b=a?(this._inputText="",this._charCount=0,cc.LabelTTF.prototype.setString.call(this,this._placeHolder),this.setColor(this.colorSpaceHolder)):this.string= this._inputText.substring(0,a-1))},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)},_tipMessage:"please enter your word:",setTipMessage:function(a){null!=a&&(this._tipMessage=a)},getTipMessage:function(){return this._tipMessage},insertText:function(a,b){b=a;a=b.indexOf("\n");-1n||this._bufferCapacity>n){var q=Math.max(Math.min(n+n,200),l,this._bufferCapacity);0!==n&&(a.freeBuffer(p,20*n),this._occupiedSize=0);l=this._offset=a.requestBuffer(20*q);if(0<=l){this._occupiedSize=this._bufferCapacity=q;this._f32Buffer=new Float32Array(a.data,l,5*this._occupiedSize);this._ui32Buffer=new Uint32Array(a.data,l,5*this._occupiedSize);if(0!==n&&p!==l)for(n=p/4+5*n,l/=4,p/=4;pthis._offset||0>=this._vertexCount||(this._dirty?(a.updateSubData(this._offset,this._f32Buffer),this._dirty= !1):l.bindBuffer(l.ARRAY_BUFFER,a.vertexBuffer),l.enableVertexAttribArray(cc.VERTEX_ATTRIB_POSITION),l.enableVertexAttribArray(cc.VERTEX_ATTRIB_COLOR),l.enableVertexAttribArray(cc.VERTEX_ATTRIB_TEX_COORDS),l.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,l.FLOAT,!1,20,0),l.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,l.UNSIGNED_BYTE,!0,20,8),l.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,l.FLOAT,!1,20,12),l.drawArrays(l.TRIANGLES,this._offset/20,this._vertexCount),cc.incrementGLDraws(1))},appendVertexData:function(l, n,p,q,r){var u=this._f32Buffer,w=5*this._vertexCount;u[w]=l;u[w+1]=n;e[0]=p.a<<24|p.b<<16|p.g<<8|p.r;this._ui32Buffer[w+2]=e[0];u[w+3]=q;u[w+4]=r;this._vertexCount++},drawDot:function(l,n,p){p=p||this._drawColor;null==p.a&&(p.a=255);var q=l.x-n,r=l.y-n,u=l.x+n;l=l.y+n;this._ensureCapacity(this._vertexCount+6)&&(this.appendVertexData(q,r,p,-1,-1),this.appendVertexData(q,l,p,-1,1),this.appendVertexData(u,l,p,1,1),this.appendVertexData(q,r,p,-1,-1),this.appendVertexData(u,l,p,1,1),this.appendVertexData(u, r,p,1,-1),this._dirty=!0)},drawSegment:function(l,n,p,q){q=q||this.getDrawColor();null==q.a&&(q.a=255);p=p||.5*this._lineWidth;if(this._ensureCapacity(this._vertexCount+18)){f.x=l.y-n.y;f.y=n.x-l.x;cc.pNormalizeIn(f);g.x=-f.y;g.y=f.x;var r=p;h.x=f.x*r;h.y=f.y*r;k.x=g.x*p;k.y=g.y*p;p=n.x+h.x-k.x;r=n.y+h.y-k.y;var u=f.x-g.x,w=f.y-g.y,v=n.x-h.x,t=n.y-h.y,x=-f.x,y=-f.y,z=n.x+h.x,B=n.y+h.y,A=f.x,C=f.y,G=l.x-h.x,E=l.y-h.y,F=l.x+h.x,K=l.y+h.y,H=f.x,L=f.y,D=l.x-h.x+k.x,M=l.y-h.y+k.y,O=g.x-f.x,Q=g.y-f.y,P= l.x+h.x+k.x;l=l.y+h.y+k.y;var U=f.x+g.x,Z=f.y+g.y;this.appendVertexData(n.x-h.x-k.x,n.y-h.y-k.y,q,-(f.x+g.x),-(f.y+g.y));this.appendVertexData(p,r,q,u,w);this.appendVertexData(v,t,q,x,y);this.appendVertexData(z,B,q,A,C);this.appendVertexData(p,r,q,u,w);this.appendVertexData(v,t,q,x,y);this.appendVertexData(z,B,q,A,C);this.appendVertexData(G,E,q,x,y);this.appendVertexData(v,t,q,x,y);this.appendVertexData(z,B,q,A,C);this.appendVertexData(G,E,q,x,y);this.appendVertexData(F,K,q,H,L);this.appendVertexData(D, M,q,O,Q);this.appendVertexData(G,E,q,x,y);this.appendVertexData(F,K,q,H,L);this.appendVertexData(D,M,q,O,Q);this.appendVertexData(P,l,q,U,Z);this.appendVertexData(F,K,q,H,L);this._dirty=!0}},drawPoly:function(l,n,p,q){if("object"===typeof l[0]){for(var r=b.length=0;r=n)){p=p||this._drawColor;null==p.a&&(p.a=255);n*=.5;var r,u=l.length;for(r=m.length=0;r=cc.stencilBits&&cc.log("Stencil buffer is not enabled."),cc.ClippingNode.WebGLRenderCmd._init_once=!1)};a.transform=function(b,c){var d=this._node;this.originTransform(b, c);d._stencil&&(d._stencil._renderCmd.transform(this,!0),d._stencil._dirtyFlag&=~cc.Node._dirtyFlags.transformDirty)};a.clippingVisit=function(b){var c=this._node;b=b||this.getParentRenderCmd();this.visit(b);if(1>cc.stencilBits)c._visitChildren();else if(c._stencil&&c._stencil.visible)if(cc.ClippingNode.WebGLRenderCmd._layer+1===cc.stencilBits)cc.ClippingNode.WebGLRenderCmd._visit_once=!0,cc.ClippingNode.WebGLRenderCmd._visit_once&&(cc.log("Nesting more than "+cc.stencilBits+"stencils is not supported. Everything will be drawn without stencil for this node and its children."), cc.ClippingNode.WebGLRenderCmd._visit_once=!1),c._visitChildren();else{cc.renderer.pushRenderCommand(this._beforeVisitCmd);c._stencil.visit(c);cc.renderer.pushRenderCommand(this._afterDrawStencilCmd);if((b=c._children)&&0b.alphaThreshold&&(c=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST),cc.glUseProgram(c.getProgram()),c.setUniformLocationWith1f(cc.UNIFORM_ALPHA_TEST_VALUE_S,b.alphaThreshold),c.setUniformLocationWithMatrix4fv(cc.UNIFORM_MVMATRIX_S,cc.renderer.mat4Identity.mat),cc.setProgram(b._stencil,c))};a._onAfterDrawStencil=function(b){b=b||cc._renderContext;b.depthMask(!0);b.stencilFunc(this._node.inverted?b.NOTEQUAL:b.EQUAL,this._mask_layer_le, this._mask_layer_le);b.stencilOp(b.KEEP,b.KEEP,b.KEEP)};a._onAfterVisit=function(b){b=b||cc._renderContext;cc.ClippingNode.WebGLRenderCmd._layer--;if(this._currentStencilEnabled){var c=1<m._localZOrder)m.visit(this);else break}for(m=0;mh._localZOrder)b._changeProtectedChild(h),h.visit(this);else break;for(a.pushRenderCommand(b);c=a.width||0>=a.height?this._positionPercent.x=this._positionPercent.y=0:(this._positionPercent.x=b.x/a.width,this._positionPercent.y=b.y/a.height);break;case ccui.Widget.POSITION_PERCENT:b=cc.p(a.width*this._positionPercent.x,a.height*this._positionPercent.y)}if(this._parent instanceof ccui.ImageView&&(a=this._parent._imageRenderer)&& !a._textureLoaded)return;this.setPosition(b)},setSizeType:function(a){this._sizeType=a;this._usingLayoutComponent&&this._getOrCreateLayoutComponent().setUsingPercentContentSize(this._sizeType===ccui.SIZE_PERCENT)},getSizeType:function(){return this._sizeType},ignoreContentAdaptWithSize:function(a){this._unifySize?this.setContentSize(this._customSize):this._ignoreSize!==a&&(this._ignoreSize=a,this.setContentSize(a?this.getVirtualRendererSize():this._customSize))},isIgnoreContentAdaptWithSize:function(){return this._ignoreSize}, getCustomSize:function(){return cc.size(this._customSize)},getLayoutSize:function(){return cc.size(this._contentSize)},getSizePercent:function(){this._usingLayoutComponent&&(this._sizePercent=this._getOrCreateLayoutComponent().getPercentContentSize());return this._sizePercent},_getWidthPercent:function(){return this._sizePercent.x},_getHeightPercent:function(){return this._sizePercent.y},getWorldPosition:function(){return this.convertToWorldSpace(cc.p(this._anchorPoint.x*this._contentSize.width,this._anchorPoint.y* this._contentSize.height))},getVirtualRenderer:function(){return this},getVirtualRendererSize:function(){return cc.size(this._contentSize)},_onSizeChanged:function(){if(!this._usingLayoutComponent){for(var a=this.getChildren(),b=0,c=a.length;b=c.width||0>=c.height?(this._positionPercent.x=0,this._positionPercent.y=0):void 0===b?(this._positionPercent.x=a.x/c.width,this._positionPercent.y=a.y/c.height):(this._positionPercent.x=a/c.width,this._positionPercent.y=b/c.height))}cc.Node.prototype.setPosition.call(this,a,b)},setPositionX:function(a){if(this._running){var b=this.getWidgetParent(); b&&(b=b.width,this._positionPercent.x=0>=b?0:a/b)}cc.Node.prototype.setPositionX.call(this,a)},setPositionY:function(a){if(this._running){var b=this.getWidgetParent();b&&(b=b.height,this._positionPercent.y=0>=b?0:a/b)}cc.Node.prototype.setPositionY.call(this,a)},setPositionPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.setPositionPercentY(a.y);b.refreshLayout()}else this._setXPercent(a.x),this._setYPercent(a.y),this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)}, _setXPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentX(a.x);b.refreshLayout()}else this._positionPercent.x=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},_setYPercent:function(a){if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();b.setPositionPercentY(a.x);b.refreshLayout()}else this._positionPercent.y=a,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionPercent:function(){if(this._usingLayoutComponent){var a= this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return cc.p(this._positionPercent)},_getXPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x=a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.x},_getYPercent:function(){if(this._usingLayoutComponent){var a=this._getOrCreateLayoutComponent();this._positionPercent.x= a.getPositionPercentX();this._positionPercent.y=a.getPositionPercentY()}return this._positionPercent.y},setPositionType:function(a){this._positionType=a;if(this._usingLayoutComponent){var b=this._getOrCreateLayoutComponent();a===ccui.POSITION_ABSOLUTE?(b.setPositionPercentXEnabled(!1),b.setPositionPercentYEnabled(!1)):(b.setPositionPercentXEnabled(!0),b.setPositionPercentYEnabled(!0))}this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.transformDirty)},getPositionType:function(){return this._positionType}, setFlippedX:function(a){var b=this.getScaleX();this._flippedX=a;this.setScaleX(b)},isFlippedX:function(){return this._flippedX},setFlippedY:function(a){var b=this.getScaleY();this._flippedY=a;this.setScaleY(b)},isFlippedY:function(){return this._flippedY},_adaptRenderers:function(){},isBright:function(){return this._bright},isEnabled:function(){return this._enabled},getLeftBoundary:function(){return this.getPositionX()-this._getAnchorX()*this._contentSize.width},getBottomBoundary:function(){return this.getPositionY()- this._getAnchorY()*this._contentSize.height},getRightBoundary:function(){return this.getLeftBoundary()+this._contentSize.width},getTopBoundary:function(){return this.getBottomBoundary()+this._contentSize.height},getTouchBeganPosition:function(){return cc.p(this._touchBeganPosition)},getTouchMovePosition:function(){return cc.p(this._touchMovePosition)},getTouchEndPosition:function(){return cc.p(this._touchEndPosition)},getWidgetType:function(){return this._widgetType},setLayoutParameter:function(a){a&& (this._layoutParameterDictionary[a.getLayoutType()]=a,this._layoutParameterType=a.getLayoutType())},getLayoutParameter:function(a){a=a||this._layoutParameterType;return this._layoutParameterDictionary[a]},getDescription:function(){return"Widget"},clone:function(){var a=this._createCloneInstance();a._copyProperties(this);a._copyClonedWidgetChildren(this);return a},_createCloneInstance:function(){return new ccui.Widget},_copyClonedWidgetChildren:function(a){a=a.getChildren();for(var b=0;b=h){k=this._lengths[m];break}if(k)return this._pool[k].pop()}},b=cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL,c,d={_rebuildQuads_base:function(h,k,m,l){var n=h._vertices,p=h._renderCmd._worldTransform,q;if(l){var r=q=0;var u=m.width;m=m.height}else{q=k._originalSize; var w=k._rect,v=k._offset;u=m.width/q.width;l=m.height/q.height;var t=v.x-(q.width-w.width)/2;r=v.y+(q.height-w.height)/2;var x=v.y-(q.height-w.height)/2;q=(v.x+(q.width-w.width)/2)*u;r*=l;u=m.width+t*u;m=m.height+x*l}8>n.length&&(a.put(n),n=a.get(8)||new Float32Array(8),h._vertices=n);c?(n[0]=q*p.a+r*p.c+p.tx,n[1]=q*p.b+r*p.d+p.ty,n[2]=u*p.a+r*p.c+p.tx,n[3]=u*p.b+r*p.d+p.ty,n[4]=q*p.a+m*p.c+p.tx,n[5]=q*p.b+m*p.d+p.ty,n[6]=u*p.a+m*p.c+p.tx,n[7]=u*p.b+m*p.d+p.ty):(n[0]=q,n[1]=r,n[2]=u,n[3]=r,n[4]= q,n[5]=m,n[6]=u,n[7]=m);h._uvsDirty&&this._calculateUVs(h,k);h._vertCount=4},_calculateUVs:function(h,k){var m=h._uvs,l=k._texture._pixelsWide,n=k._texture._pixelsHigh,p=k._rect;p=cc.rectPointsToPixels(p);8>m.length&&(a.put(m),m=a.get(8)||new Float32Array(8),h._uvs=m);var q=b?.5:0;k._rotated?(k=(p.x+q)/l,h=(p.y+p.width-q)/n,l=(p.x+p.height-q)/l,n=(p.y+q)/n,m[0]=k,m[1]=n,m[2]=k,m[3]=h,m[4]=l,m[5]=n,m[6]=l,m[7]=h):(k=(p.x+q)/l,h=(p.y+p.height-q)/n,l=(p.x+p.width-q)/l,n=(p.y+q)/n,m[0]=k,m[1]=h,m[2]= l,m[3]=h,m[4]=k,m[5]=n,m[6]=l,m[7]=n)}},e={x:Array(4),y:Array(4),_rebuildQuads_base:function(h,k,m,l,n,p,q){var r=h._vertices,u=h._renderCmd._worldTransform,w=m.width-l-n,v=m.height-p-q,t=m.width/(l+n),x=m.height/(p+q),y=this.x,z=this.y;y[0]=0;y[1]=l*(1w?0:w);y[3]=m.width;z[0]=0;z[1]=q*(1v?0:v);z[3]=m.height;32>r.length&&(a.put(r),r=a.get(32)||new Float32Array(32),h._vertices=r);m=0;if(c)for(w=0;4>w;w++)for(v=0;4>v;v++)r[m]=y[v]*u.a+z[w]*u.c+u.tx,r[m+1]=y[v]* u.b+z[w]*u.d+u.ty,m+=2;else for(w=0;4>w;w++)for(v=0;4>v;v++)r[m]=y[v],r[m+1]=z[w],m+=2;h._uvsDirty&&this._calculateUVs(h,k,l,n,p,q)},_calculateUVs:function(h,k,m,l,n,p){var q=h._uvs,r=k._rect,u=k._texture._pixelsWide,w=k._texture._pixelsHigh,v=k._rect;v=cc.rectPointsToPixels(v);r=cc.rectPointsToPixels(r);var t=cc.contentScaleFactor();m*=t;var x=l*t;l=r.width-m-x;n*=t;t=r.height-n-p*t;32>q.length&&(a.put(q),q=a.get(32)||new Float32Array(32),h._uvs=q);h=this.x;p=this.y;var y=b?.5:0;r=0;if(k._rotated)for(h[3]= (v.x+y)/u,h[2]=(n+v.x)/u,h[1]=(n+t+v.x)/u,h[0]=(v.x+v.height-y)/u,p[0]=(v.y+y)/w,p[1]=(x+v.y)/w,p[2]=(x+l+v.y)/w,p[3]=(v.y+v.width-y)/w,k=0;4>k;k++)for(u=0;4>u;u++)q[r]=h[k],q[r+1]=p[3-u],r+=2;else for(h[0]=(v.x+y)/u,h[1]=(m+v.x)/u,h[2]=(m+l+v.x)/u,h[3]=(v.x+v.width-y)/u,p[3]=(v.y+y)/w,p[2]=(n+v.y)/w,p[1]=(n+t+v.y)/w,p[0]=(v.y+v.height-y)/w,k=0;4>k;k++)for(u=0;4>u;u++)q[r]=h[u],q[r+1]=p[k],r+=2}};ccui.Scale9Sprite=cc.Scale9Sprite=cc.Node.extend({_spriteFrame:null,_scale9Image:null,_insetLeft:0,_insetRight:0, _insetTop:0,_insetBottom:0,_blendFunc:null,_renderingType:1,_brightState:0,_opacityModifyRGB:!1,_rawVerts:null,_rawUvs:null,_vertices:null,_uvs:null,_vertCount:0,_quadsDirty:!0,_uvsDirty:!0,_isTriangle:!1,_isTrimmedContentSize:!1,_textureLoaded:!1,_flippedX:!1,_flippedY:!1,_className:"Scale9Sprite",ctor:function(h,k,m){cc.Node.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;this._renderCmd.setState(this._brightState);this._blendFunc=cc.BlendFunc._alphaPremultiplied();this.setAnchorPoint(cc.p(.5, .5));this._rawUvs=this._rawVerts=null;this._vertices=a.get(8)||new Float32Array(8);this._uvs=a.get(8)||new Float32Array(8);if(void 0!==h)if(h instanceof cc.SpriteFrame||h instanceof cc.VirtualResource)this.initWithSpriteFrame(h,k);else{var l=cc.spriteFrameCache.getSpriteFrame(h);l?this.initWithSpriteFrame(l,k):this.initWithFile(h,k,m)}void 0===c&&(c=cc._renderType===cc.game.RENDER_TYPE_WEBGL)},textureLoaded:function(){return this._textureLoaded},getCapInsets:function(){return cc.rect(this._capInsetsInternal)}, _asyncSetCapInsets:function(){this.removeEventListener("load",this._asyncSetCapInsets,this);this.setCapInsets(this._cacheCapInsets);this._cacheCapInsets=null},setCapInsets:function(h){if(!this.loaded())return this._cacheCapInsets=h,this.removeEventListener("load",this._asyncSetCapInsets,this),this.addEventListener("load",this._asyncSetCapInsets,this),!1;this._capInsetsInternal=h;this._updateCapInsets(this._spriteFrame._rect,this._capInsetsInternal)},_updateCapInsets:function(h,k){k&&h&&!cc._rectEqualToZero(k)? this._capInsetsInternal=k:(h=h||{x:0,y:0,width:this._contentSize.width,height:this._contentSize.height},this._capInsetsInternal=cc.rect(h.width/3,h.height/3,h.width/3,h.height/3));cc._rectEqualToZero(h)||(this._insetLeft=this._capInsetsInternal.x,this._insetTop=this._capInsetsInternal.y,this._insetRight=h.width-this._insetLeft-this._capInsetsInternal.width,this._insetBottom=h.height-this._insetTop-this._capInsetsInternal.height);this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)}, initWithFile:function(h,k,m){h instanceof cc.Rect?(m=h=k,k=cc.rect(0,0,0,0)):(k=k||cc.rect(0,0,0,0),m=m||cc.rect(0,0,0,0));if(!h)throw Error("ccui.Scale9Sprite.initWithFile(): file should be non-null");var l=cc.textureCache.getTextureForKey(h);l||(l=cc.textureCache.addImage(h));var n=l.isLoaded();this._textureLoaded=n;this._loader.clear();if(!n)return this._loader.once(l,function(){this.initWithFile(h,k,m);this.dispatchEvent("load")},this),!1;cc._rectEqualToZero(k)&&(n=l.getContentSize(),k=cc.rect(0, 0,n.width,n.height));this.setTexture(l,k);this._updateCapInsets(k,m);return!0},updateWithBatchNode:function(h,k,m,l){if(!h)return!1;var n=h.getTexture();this._loader.clear();if(!n.isLoaded())return this._loader.once(n,function(){this.updateWithBatchNode(h,k,m,l);this.dispatchEvent("load")},this),!1;this.setTexture(n,k);this._updateCapInsets(k,l);return!0},initWithSpriteFrame:function(h,k){this.setSpriteFrame(h);k=k||cc.rect(0,0,0,0);this._updateCapInsets(this._spriteFrame._rect,k)},initWithSpriteFrameName:function(h, k){if(!h)throw Error("ccui.Scale9Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null");this.setSpriteFrame(h);if(this._spriteFrame)k=k||cc.rect(0,0,0,0),this._updateCapInsets(this._spriteFrame._rect,k);else return cc.log("ccui.Scale9Sprite.initWithSpriteFrameName(): can't find the sprite frame by spriteFrameName"),!1},loaded:function(){return null===this._spriteFrame?!1:this._spriteFrame.textureLoaded()},setTexture:function(h,k){h=new cc.SpriteFrame(h,k);this.setSpriteFrame(h)},_updateBlendFunc:function(){var h= this._blendFunc;this._spriteFrame&&this._spriteFrame._texture.hasPremultipliedAlpha()?(h.src===cc.SRC_ALPHA&&h.dst===cc.BLEND_DST&&(h.src=cc.ONE),this._opacityModifyRGB=!0):(h.src===cc.ONE&&h.dst===cc.BLEND_DST&&(h.src=cc.SRC_ALPHA),this._opacityModifyRGB=!1)},setOpacityModifyRGB:function(h){this._opacityModifyRGB!==h&&(this._opacityModifyRGB=h,this._renderCmd._setColorDirty())},isOpacityModifyRGB:function(){return this._opacityModifyRGB},setSpriteFrame:function(h){this.virtualResource=void 0;h instanceof cc.VirtualResource&&(this.virtualResource=h,h=(h=h.resolve(this.getPreferredBundles()))&&h.getSpriteFrame());if(h){this._spriteFrame=h;this._uvsDirty=this._quadsDirty=!0;var k=this,m=function(){cc.sizeEqualToSize(k._contentSize,cc.size(0,0))&&k.setContentSize(k._spriteFrame._rect);k._textureLoaded=!0;k._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty);cc.renderer.childrenOrderDirty=!0};k._textureLoaded=h.textureLoaded();k._textureLoaded?m():(this._loader.clear(),this._loader.once(h,function(){m(); this.dispatchEvent("load")},this))}},getSpriteFrame:function(){return this._spriteFrame},getTextureBundle:function(){return this._spriteFrame&&this._spriteFrame._texture&&this._spriteFrame._texture.bundleName},setBlendFunc:function(h,k){void 0===k?(this._blendFunc.src=h.src||cc.BLEND_SRC,this._blendFunc.dst=h.dst||cc.BLEND_DST):(this._blendFunc.src=h||cc.BLEND_SRC,this._blendFunc.dst=k||cc.BLEND_DST);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getBlendFunc:function(){return new cc.BlendFunc(this._blendFunc.src, this._blendFunc.dst)},setPreferredSize:function(h){h&&!cc.sizeEqualToSize(this._contentSize,h)&&this.setContentSize(h)},getPreferredSize:function(){return this.getContentSize()},setContentSize:function(h,k){void 0===k&&(k=h.height,h=h.width);if(h!==this._contentSize.width||k!==this._contentSize.height)cc.Node.prototype.setContentSize.call(this,h,k),this._quadsDirty=!0},getContentSize:function(){return this._renderingType===ccui.Scale9Sprite.RenderingType.SIMPLE?this._spriteFrame?this._spriteFrame._originalSize: cc.size(this._contentSize):cc.size(this._contentSize)},_setWidth:function(h){cc.Node.prototype._setWidth.call(this,h);this._quadsDirty=!0},_setHeight:function(h){cc.Node.prototype._setHeight.call(this,h);this._quadsDirty=!0},setState:function(h){this._brightState=h;this._renderCmd.setState(h);this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getState:function(){return this._brightState},setRenderingType:function(h){this._renderingType!==h&&(this._renderingType=h,this._uvsDirty=this._quadsDirty= !0,this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty))},getRenderingType:function(){return this._renderingType},setInsetLeft:function(h){this._insetLeft=h;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetLeft:function(){return this._insetLeft},setInsetTop:function(h){this._insetTop=h;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetTop:function(){return this._insetTop},setInsetRight:function(h){this._insetRight= h;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetRight:function(){return this._insetRight},setInsetBottom:function(h){this._insetBottom=h;this._uvsDirty=this._quadsDirty=!0;this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.contentDirty)},getInsetBottom:function(){return this._insetBottom},_rebuildQuads:function(){if(this._spriteFrame&&this._spriteFrame._textureLoaded){this._updateBlendFunc();this._isTriangle=!1;switch(this._renderingType){case g.SIMPLE:d._rebuildQuads_base(this, this._spriteFrame,this._contentSize,this._isTrimmedContentSize);break;case g.SLICED:e._rebuildQuads_base(this,this._spriteFrame,this._contentSize,this._insetLeft,this._insetRight,this._insetTop,this._insetBottom);break;default:this._uvsDirty=this._quadsDirty=!1;cc.error("Can not generate quad");return}this._uvsDirty=this._quadsDirty=!1}},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new ccui.Scale9Sprite.CanvasRenderCmd(this):new ccui.Scale9Sprite.WebGLRenderCmd(this)}}); var f=ccui.Scale9Sprite.prototype;cc.EventHelper.prototype.apply(f);f.preferredSize;cc.defineGetterSetter(f,"preferredSize",f.getPreferredSize,f.setPreferredSize);f.capInsets;cc.defineGetterSetter(f,"capInsets",f.getCapInsets,f.setCapInsets);f.insetLeft;cc.defineGetterSetter(f,"insetLeft",f.getInsetLeft,f.setInsetLeft);f.insetTop;cc.defineGetterSetter(f,"insetTop",f.getInsetTop,f.setInsetTop);f.insetRight;cc.defineGetterSetter(f,"insetRight",f.getInsetRight,f.setInsetRight);f.insetBottom;cc.defineGetterSetter(f, "insetBottom",f.getInsetBottom,f.setInsetBottom);f=null;ccui.Scale9Sprite.create=function(h,k,m){return new ccui.Scale9Sprite(h,k,m)};ccui.Scale9Sprite.createWithSpriteFrame=function(h,k){return new ccui.Scale9Sprite(h,k)};ccui.Scale9Sprite.createWithSpriteFrameName=function(h,k){return new ccui.Scale9Sprite(h,k)};ccui.Scale9Sprite.POSITIONS_CENTRE=0;ccui.Scale9Sprite.POSITIONS_TOP=1;ccui.Scale9Sprite.POSITIONS_LEFT=2;ccui.Scale9Sprite.POSITIONS_RIGHT=3;ccui.Scale9Sprite.POSITIONS_BOTTOM=4;ccui.Scale9Sprite.POSITIONS_TOPRIGHT= 5;ccui.Scale9Sprite.POSITIONS_TOPLEFT=6;ccui.Scale9Sprite.POSITIONS_BOTTOMRIGHT=7;ccui.Scale9Sprite.state={NORMAL:0,GRAY:1};var g=ccui.Scale9Sprite.RenderingType={SIMPLE:0,SLICED:1}})();(function(){ccui.Scale9Sprite.CanvasRenderCmd=function(b){cc.Node.CanvasRenderCmd.call(this,b);this._needDraw=!0;this._state=ccui.Scale9Sprite.state.NORMAL;this._originalTexture=this._textureToRender=null};var a=ccui.Scale9Sprite.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=ccui.Scale9Sprite.CanvasRenderCmd;a.transform=function(b,c){this.originTransform(b,c);this._node._rebuildQuads()};a.needDraw=function(){return this._needDraw&&this._node.loaded()};a._updateDisplayColor= function(b){cc.Node.RenderCmd.prototype._updateDisplayColor.call(this,b);this._originalTexture=this._textureToRender=null};a.setState=function(b){this._state!==b&&(this._state=b,this._originalTexture=this._textureToRender=null)};a._setColorDirty=function(){this.setDirtyFlag(cc.Node._dirtyFlags.colorDirty|cc.Node._dirtyFlags.opacityDirty)};a.rendering=function(b,c,d){var e=this._node,f=this._displayedOpacity,g=f/255,h=null;e._spriteFrame&&(h=e._spriteFrame._texture);if(e.loaded()&&0!==f){if(null=== this._textureToRender||this._originalTexture!==h)this._textureToRender=this._originalTexture=h,cc.Scale9Sprite.state.GRAY===this._state&&(this._textureToRender=this._textureToRender._generateGrayTexture()),f=e.getDisplayedColor(),!h||255===f.r&&255===f.g&&255===f.b||(this._textureToRender=this._textureToRender._generateColorTexture(f.r,f.g,f.b));h=b||cc._renderContext;b=h.getContext();h.setTransform(this._worldTransform,c,d);h.setCompositeOperation(cc.Node.CanvasRenderCmd._getCompositeOperationByBlendFunc(e._blendFunc)); h.setGlobalAlpha(g);if(this._textureToRender){e._quadsDirty&&e._rebuildQuads();c=this._textureToRender._pixelsWide;d=this._textureToRender._pixelsHigh;g=this._textureToRender._htmlElementObj;f=e._vertices;var k=e._uvs,m;if(e._renderingType===cc.Scale9Sprite.RenderingType.SLICED){for(h=0;3>h;++h)for(m=0;3>m;++m){var l=8*h+2*m;var n=f[l];var p=f[l+1];var q=f[l+10]-n;var r=f[l+11]-p;p=-p-r;e=k[l]*c;var u=k[l+11]*d;var w=(k[l+10]-k[l])*c;var v=(k[l+1]-k[l+11])*d;if(0l;++l)for(var n=0;3>n;++n)m=8*l+2*n,g[k]=c[m],g[k+1]=c[m+1],g[k+2]=f,h[k+3]=e[0],g[k+4]=d[m],g[k+5]=d[m+1],k+=6,g[k]=c[m+2],g[k+1]=c[m+3],g[k+2]=f,h[k+3]=e[0],g[k+4]=d[m+2],g[k+5]=d[m+3],k+=6,g[k]=c[m+8],g[k+1]=c[m+9],g[k+2]=f,h[k+3]=e[0],g[k+4]=d[m+8],g[k+5]=d[m+9],k+=6,g[k]=c[m+10],g[k+1]=c[m+11],g[k+2]=f,h[k+3]=e[0],g[k+4]=d[m+10],g[k+5]=d[m+11],k+=6;return 36};b.transform=function(c,d){this.originTransform(c,d);this._node._rebuildQuads()}; b._setColorDirty=function(){};b.uploadData=function(c,d,e){var f=this._node;if(0===this._displayedOpacity)return 0;f._quadsDirty&&f._rebuildQuads();var g=this._displayedOpacity,h=this._displayedColor.r,k=this._displayedColor.g,m=this._displayedColor.b;if(f._opacityModifyRGB){var l=g/255;h*=l;k*=l;m*=l}this._color[0]=g<<24|m<<16|k<<8|h;g=f._vertexZ;h=f._vertices;k=f._uvs;l=a.RenderingType;m=0;switch(f._renderingType){case l.SIMPLE:m=this._node._vertCount;for(l=f=0;fk._localZOrder)k.visit(this);else break}for(k=0;km._localZOrder)b._changeProtectedChild(m),m.visit(this);else break}for(;cf&&(g=c,f=h));c++}return g}cc.log("invalid focus direction!!!");return 0},_calculateNearestDistance:function(a){for(var b=cc.FLT_MAX,c=this._getWorldCenterPoint(a),d=this._children,e=0,f=d.length;eb&&(b=g)}return b},_findProperSearchingFunctor:function(a,b){if(void 0!==b){b=this._getWorldCenterPoint(b);var c=this._getWorldCenterPoint(this._findFirstNonLayoutWidget());a===ccui.Widget.LEFT?this.onPassFocusToChild=b.x>c.x?this._findNearestChildWidgetIndex:this._findFarthestChildWidgetIndex:a===ccui.Widget.RIGHT?this.onPassFocusToChild=b.x>c.x?this._findFarthestChildWidgetIndex:this._findNearestChildWidgetIndex:a===ccui.Widget.DOWN?this.onPassFocusToChild=b.y>c.y?this._findNearestChildWidgetIndex: this._findFarthestChildWidgetIndex:a===ccui.Widget.UP?this.onPassFocusToChild=b.yb.width?a.width:b.width,a.height>b.height?a.height: b.height)}});ccui.Button.prototype.titleText;cc.defineGetterSetter(ccui.Button.prototype,"titleText",ccui.Button.prototype.getTitleText,ccui.Button.prototype.setTitleText);ccui.Button.prototype.titleFont;cc.defineGetterSetter(ccui.Button.prototype,"titleFont",ccui.Button.prototype._getTitleFont,ccui.Button.prototype._setTitleFont);ccui.Button.prototype.titleFontSize;cc.defineGetterSetter(ccui.Button.prototype,"titleFontSize",ccui.Button.prototype.getTitleFontSize,ccui.Button.prototype.setTitleFontSize); ccui.Button.prototype.titleFontName;cc.defineGetterSetter(ccui.Button.prototype,"titleFontName",ccui.Button.prototype.getTitleFontName,ccui.Button.prototype.setTitleFontName);ccui.Button.prototype.titleColor;cc.defineGetterSetter(ccui.Button.prototype,"titleColor",ccui.Button.prototype.getTitleColor,ccui.Button.prototype.setTitleColor);ccui.Button.create=function(a,b,c,d){return new ccui.Button(a,b,c,d)};ccui.Button.NORMAL_RENDERER_ZORDER=-2;ccui.Button.PRESSED_RENDERER_ZORDER=-2; ccui.Button.DISABLED_RENDERER_ZORDER=-2;ccui.Button.TITLE_RENDERER_ZORDER=-1;ccui.Button.ZOOM_ACTION_TIME_STEP=.05;ccui.Button.SYSTEM=0;ccui.Button.TTF=1;ccui.CheckBox=ccui.Widget.extend({_backGroundBoxRenderer:null,_backGroundSelectedBoxRenderer:null,_frontCrossRenderer:null,_backGroundBoxDisabledRenderer:null,_frontCrossDisabledRenderer:null,_isSelected:!0,_checkBoxEventListener:null,_checkBoxEventSelector:null,_backGroundTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundSelectedTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossTexType:ccui.Widget.LOCAL_TEXTURE,_backGroundDisabledTexType:ccui.Widget.LOCAL_TEXTURE,_frontCrossDisabledTexType:ccui.Widget.LOCAL_TEXTURE, _backGroundFileName:"",_backGroundSelectedFileName:"",_frontCrossFileName:"",_backGroundDisabledFileName:"",_frontCrossDisabledFileName:"",_className:"CheckBox",_zoomScale:.1,_backgroundTextureScaleX:.1,_backgroundTextureScaleY:.1,_backGroundBoxRendererAdaptDirty:!0,_backGroundSelectedBoxRendererAdaptDirty:!0,_frontCrossRendererAdaptDirty:!0,_backGroundBoxDisabledRendererAdaptDirty:!0,_frontCrossDisabledRendererAdaptDirty:!0,ctor:function(a,b,c,d,e,f){ccui.Widget.prototype.ctor.call(this);this.setTouchEnabled(!0); for(var g=0,h=0;h=c.width||0>=c.height){a.setScale(1);this._backgroundTextureScaleX=this._backgroundTextureScaleY=1;return}var d=b.width/c.width;c=b.height/c.height;this._backgroundTextureScaleX=d;this._backgroundTextureScaleY=c;a.setScaleX(d);a.setScaleY(c)}a.setPosition(.5*b.width,.5*b.height)},_backGroundSelectedTextureScaleChangedWithSize:function(){var a=this._backGroundSelectedBoxRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1); return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(.5*b.width,.5*b.height)},_frontCrossTextureScaleChangedWithSize:function(){var a=this._frontCrossRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(.5*b.width,.5*b.height)},_backGroundDisabledTextureScaleChangedWithSize:function(){var a=this._backGroundBoxDisabledRenderer, b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/c.width);a.setScaleY(d)}a.setPosition(.5*b.width,.5*b.height)},_frontCrossDisabledTextureScaleChangedWithSize:function(){var a=this._frontCrossDisabledRenderer,b=this._contentSize;if(this._ignoreSize)a.setScale(1);else{var c=a.getContentSize();if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/ c.width);a.setScaleY(d)}a.setPosition(.5*b.width,.5*b.height)},getDescription:function(){return"CheckBox"},_createCloneInstance:function(){return new ccui.CheckBox},_copySpecialProperties:function(a){a instanceof ccui.CheckBox&&(this.loadTextureBackGround(a._backGroundFileName,a._backGroundTexType),this.loadTextureBackGroundSelected(a._backGroundSelectedFileName,a._backGroundSelectedTexType),this.loadTextureFrontCross(a._frontCrossFileName,a._frontCrossTexType),this.loadTextureBackGroundDisabled(a._backGroundDisabledFileName, a._backGroundDisabledTexType),this.loadTextureFrontCrossDisabled(a._frontCrossDisabledFileName,a._frontCrossDisabledTexType),this.setSelected(a._isSelected),this._checkBoxEventListener=a._checkBoxEventListener,this._checkBoxEventSelector=a._checkBoxEventSelector,this._ccEventCallback=a._ccEventCallback,this._zoomScale=a._zoomScale,this._backgroundTextureScaleX=a._backgroundTextureScaleX,this._backgroundTextureScaleY=a._backgroundTextureScaleY)},_adaptRenderers:function(){this._backGroundBoxRendererAdaptDirty&& (this._backGroundTextureScaleChangedWithSize(),this._backGroundBoxRendererAdaptDirty=!1);this._backGroundSelectedBoxRendererAdaptDirty&&(this._backGroundSelectedTextureScaleChangedWithSize(),this._backGroundSelectedBoxRendererAdaptDirty=!1);this._frontCrossRendererAdaptDirty&&(this._frontCrossTextureScaleChangedWithSize(),this._frontCrossRendererAdaptDirty=!1);this._backGroundBoxDisabledRendererAdaptDirty&&(this._backGroundDisabledTextureScaleChangedWithSize(),this._backGroundBoxDisabledRendererAdaptDirty= !1);this._frontCrossDisabledRendererAdaptDirty&&(this._frontCrossDisabledTextureScaleChangedWithSize(),this._frontCrossDisabledRendererAdaptDirty=!1)}});ccui.CheckBox.prototype.selected;cc.defineGetterSetter(ccui.CheckBox.prototype,"selected",ccui.CheckBox.prototype.isSelected,ccui.CheckBox.prototype.setSelected);ccui.CheckBox.create=function(a,b,c,d,e,f){return new ccui.CheckBox(a,b,c,d,e,f)};ccui.CheckBox.EVENT_SELECTED=0;ccui.CheckBox.EVENT_UNSELECTED=1;ccui.CheckBox.BOX_RENDERER_ZORDER=-1; ccui.CheckBox.BOX_SELECTED_RENDERER_ZORDER=-1;ccui.CheckBox.BOX_DISABLED_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_RENDERER_ZORDER=-1;ccui.CheckBox.FRONT_CROSS_DISABLED_RENDERER_ZORDER=-1;ccui.ImageView=ccui.Widget.extend({_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_imageRenderer:null,_textureFile:"",_imageTexType:ccui.Widget.LOCAL_TEXTURE,_imageTextureSize:null,_className:"ImageView",_imageRendererAdaptDirty:!0,ctor:function(a,b){this._capInsets=cc.rect(0,0,0,0);this._imageTextureSize=cc.size(this._capInsets.width,this._capInsets.height);ccui.Widget.prototype.ctor.call(this);a?this.loadTexture(a,void 0===b?0:b):this._imageTexType=ccui.Widget.LOCAL_TEXTURE},_initRenderer:function(){this._imageRenderer= new ccui.Scale9Sprite;this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE);this.addProtectedChild(this._imageRenderer,ccui.ImageView.RENDERER_ZORDER,-1)},loadTexture:function(a,b){if(a&&(this._textureFile!=a||this._imageTexType!=b)){var c=this;b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._imageTexType=b;var d=c._imageRenderer;switch(c._imageTexType){case ccui.Widget.LOCAL_TEXTURE:c._scale9Enabled?(d.initWithFile(a),d.setCapInsets(c._capInsets)):d.initWithFile(a); break;case ccui.Widget.PLIST_TEXTURE:c._scale9Enabled?(d.initWithSpriteFrameName(a),d.setCapInsets(c._capInsets)):d.initWithSpriteFrameName(a)}if(!d._textureLoaded){var e=function(){d.removeEventListener("load",e);!c._ignoreSize&&cc.sizeEqualToSize(c._customSize,cc.size(0,0))&&(c._customSize=c._imageRenderer.getContentSize());c._imageTextureSize=d.getContentSize();c._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize)};d.addEventListener("load",e)}!this._ignoreSize&& cc.sizeEqualToSize(this._customSize,cc.size(0,0))&&(this._customSize=this._imageRenderer.getContentSize());c._imageTextureSize=d.getContentSize();this._updateChildrenDisplayedRGBA();c._updateContentSizeWithTextureSize(c._imageTextureSize);c._imageRendererAdaptDirty=!0;c._findLayout()}},setTextureRect:function(){cc.warn("ImageView.setTextureRect is deprecated!")},setScale9Enabled:function(a){this._scale9Enabled!==a&&((this._scale9Enabled=a)?this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SLICED): this._imageRenderer.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this._imageRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this, a),this._prevIgnoreSize=a},setCapInsets:function(a){if(a){var b=this._capInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._imageRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._imageRendererAdaptDirty=!0},_adaptRenderers:function(){this._imageRendererAdaptDirty&&(this._imageTextureScaleChangedWithSize(),this._imageRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return cc.size(this._imageTextureSize)}, getVirtualRenderer:function(){return this._imageRenderer},_imageTextureScaleChangedWithSize:function(){this._imageRenderer.setContentSize(this._contentSize);this._imageRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"ImageView"},_createCloneInstance:function(){return new ccui.ImageView},_copySpecialProperties:function(a){a instanceof ccui.ImageView&&(this._prevIgnoreSize=a._prevIgnoreSize,this._capInsets=a._capInsets,this.loadTexture(a._textureFile, a._imageTexType),this.setScale9Enabled(a._scale9Enabled))},setContentSize:function(a,b){b&&(a=cc.size(a,b));ccui.Widget.prototype.setContentSize.call(this,a);this._imageRenderer.setContentSize(a)}});ccui.ImageView.create=function(a,b){return new ccui.ImageView(a,b)};ccui.ImageView.RENDERER_ZORDER=-1;ccui.LoadingBar=ccui.Widget.extend({_direction:null,_percent:100,_totalLength:0,_barRenderer:null,_renderBarTexType:ccui.Widget.LOCAL_TEXTURE,_barRendererTextureSize:null,_scale9Enabled:!1,_prevIgnoreSize:!0,_capInsets:null,_textureFile:"",_isTextureLoaded:!1,_className:"LoadingBar",_barRendererAdaptDirty:!0,ctor:function(a,b){this._direction=ccui.LoadingBar.TYPE_LEFT;this._barRendererTextureSize=cc.size(0,0);this._capInsets=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);void 0!==a&&this.loadTexture(a); void 0!==b&&this.setPercent(b)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1);this._barRenderer.setAnchorPoint(0,.5)},setDirection:function(a){if(this._direction!==a)switch(this._direction=a,this._direction){case ccui.LoadingBar.TYPE_LEFT:this._barRenderer.setAnchorPoint(0,.5);this._barRenderer.setPosition(0,.5*this._contentSize.height);this._scale9Enabled||this._barRenderer.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:this._barRenderer.setAnchorPoint(1, .5),this._barRenderer.setPosition(this._totalLength,.5*this._contentSize.height),this._scale9Enabled||this._barRenderer.setFlippedX(!0)}},getDirection:function(){return this._direction},loadTexture:function(a,b){if(a){this._renderBarTexType=b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;b=this._barRenderer;var c=this;b._textureLoaded||b.addEventListener("load",function(){c.loadTexture(c._textureFile,c._renderBarTexType);c._setPercent(c._percent)});switch(this._renderBarTexType){case ccui.Widget.LOCAL_TEXTURE:b.initWithFile(a); break;case ccui.Widget.PLIST_TEXTURE:b.initWithSpriteFrameName(a)}a=b.getContentSize();this._barRendererTextureSize.width=a.width;this._barRendererTextureSize.height=a.height;switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:b.setAnchorPoint(0,.5);this._scale9Enabled||b.setFlippedX(!1);break;case ccui.LoadingBar.TYPE_RIGHT:b.setAnchorPoint(1,.5),this._scale9Enabled||b.setFlippedX(!0)}this._scale9Enabled&&b.setCapInsets(this._capInsets);this._updateChildrenDisplayedRGBA();this._barRendererScaleChangedWithSize(); this._updateContentSizeWithTextureSize(this._barRendererTextureSize);this._barRendererAdaptDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer),this._barRenderer=this._scale9Enabled?new ccui.Scale9Sprite:new cc.Sprite,this.loadTexture(this._textureFile,this._renderBarTexType),this.addProtectedChild(this._barRenderer,ccui.LoadingBar.RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1), this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsets(this._capInsets),this.setPercent(this._percent),this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},setCapInsets:function(a){if(a){var b=this._capInsets;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsets:function(){return cc.rect(this._capInsets)},setPercent:function(a){100a&&(a=0);a!== this._percent&&(this._percent=a,this._setPercent(a))},_setPercent:function(){if(!(0>=this._totalLength)){var a=this._percent/100;if(this._scale9Enabled)this._setScale9Scale();else{var b=this._barRenderer;var c=this._barRendererTextureSize;var d=b.getTextureRect();d.width=c.width*a;b.setTextureRect(cc.rect(d.x,d.y,c.width*a,c.height),b._rectRotated)}}},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);this._totalLength=void 0===b?a.width:a},getPercent:function(){return this._percent}, _onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1)},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled||this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},getVirtualRendererSize:function(){return cc.size(this._barRendererTextureSize)},getVirtualRenderer:function(){return this._barRenderer}, _barRendererScaleChangedWithSize:function(){var a=this._barRenderer,b=this._contentSize;if(this._unifySize)this._totalLength=this._contentSize.width,this.setPercent(this._percent);else if(this._ignoreSize)this._scale9Enabled||(this._totalLength=this._barRendererTextureSize.width,a.setScale(1));else if(this._totalLength=b.width,this._scale9Enabled)this._setScale9Scale(),a.setScale(1);else{var c=this._barRendererTextureSize;if(0>=c.width||0>=c.height){a.setScale(1);return}var d=b.height/c.height;a.setScaleX(b.width/ c.width);a.setScaleY(d)}switch(this._direction){case ccui.LoadingBar.TYPE_LEFT:a.setPosition(0,.5*b.height);break;case ccui.LoadingBar.TYPE_RIGHT:a.setPosition(this._totalLength,.5*b.height)}},_setScale9Scale:function(){this._barRenderer.setPreferredSize(cc.size(this._percent/100*this._totalLength,this._contentSize.height))},getDescription:function(){return"LoadingBar"},_createCloneInstance:function(){return new ccui.LoadingBar},_copySpecialProperties:function(a){a instanceof ccui.LoadingBar&&(this._prevIgnoreSize= a._prevIgnoreSize,this.setScale9Enabled(a._scale9Enabled),this.loadTexture(a._textureFile,a._renderBarTexType),this.setCapInsets(a._capInsets),this.setPercent(a._percent),this.setDirection(a._direction))}});ccui.LoadingBar.prototype.direction;cc.defineGetterSetter(ccui.LoadingBar.prototype,"direction",ccui.LoadingBar.prototype.getDirection,ccui.LoadingBar.prototype.setDirection);ccui.LoadingBar.prototype.percent; cc.defineGetterSetter(ccui.LoadingBar.prototype,"percent",ccui.LoadingBar.prototype.getPercent,ccui.LoadingBar.prototype.setPercent);ccui.LoadingBar.create=function(a,b){return new ccui.LoadingBar(a,b)};ccui.LoadingBar.TYPE_LEFT=0;ccui.LoadingBar.TYPE_RIGHT=1;ccui.LoadingBar.RENDERER_ZORDER=-1;ccui.Slider=ccui.Widget.extend({_barRenderer:null,_progressBarRenderer:null,_barTextureSize:null,_progressBarTextureSize:null,_slidBallNormalRenderer:null,_slidBallPressedRenderer:null,_slidBallDisabledRenderer:null,_slidBallRenderer:null,_barLength:0,_percent:0,_scale9Enabled:!1,_prevIgnoreSize:!0,_textureFile:"",_progressBarTextureFile:"",_slidBallNormalTextureFile:"",_slidBallPressedTextureFile:"",_slidBallDisabledTextureFile:"",_capInsetsBarRenderer:null,_capInsetsProgressBarRenderer:null,_sliderEventListener:null, _sliderEventSelector:null,_barTexType:ccui.Widget.LOCAL_TEXTURE,_progressBarTexType:ccui.Widget.LOCAL_TEXTURE,_ballNTexType:ccui.Widget.LOCAL_TEXTURE,_ballPTexType:ccui.Widget.LOCAL_TEXTURE,_ballDTexType:ccui.Widget.LOCAL_TEXTURE,_isTextureLoaded:!1,_className:"Slider",_barRendererAdaptDirty:!0,_progressBarRendererDirty:!0,_unifySize:!1,_zoomScale:.1,_sliderBallNormalTextureScaleX:1,_sliderBallNormalTextureScaleY:1,ctor:function(a,b,c){this._barTextureSize=cc.size(0,0);this._progressBarTextureSize= cc.size(0,0);this._capInsetsBarRenderer=cc.rect(0,0,0,0);this._capInsetsProgressBarRenderer=cc.rect(0,0,0,0);ccui.Widget.prototype.ctor.call(this);c=c||0;this.setTouchEnabled(!0);a&&this.loadBarTexture(a,c);b&&this.loadSlidBallTextures(b,c)},_initRenderer:function(){this._barRenderer=new cc.Sprite;this._progressBarRenderer=new cc.Sprite;this._progressBarRenderer.setAnchorPoint(0,.5);this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER,-1);this.addProtectedChild(this._progressBarRenderer, ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1);this._slidBallNormalRenderer=new cc.Sprite;this._slidBallPressedRenderer=new cc.Sprite;this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer=new cc.Sprite;this._slidBallDisabledRenderer.setVisible(!1);this._slidBallRenderer=new cc.Node;this._slidBallRenderer.addChild(this._slidBallNormalRenderer);this._slidBallRenderer.addChild(this._slidBallPressedRenderer);this._slidBallRenderer.addChild(this._slidBallDisabledRenderer);this._slidBallRenderer.setCascadeColorEnabled(!0); this._slidBallRenderer.setCascadeOpacityEnabled(!0);this.addProtectedChild(this._slidBallRenderer,ccui.Slider.BALL_RENDERER_ZORDER,-1)},loadBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._textureFile=a;this._barTexType=b;b=this._barRenderer;var c=this;b._textureLoaded||b.addEventListener("load",function(){c.loadBarTexture(c._textureFile,c._barTexType)});switch(this._barTexType){case ccui.Widget.LOCAL_TEXTURE:b.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:b.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._progressBarRendererDirty=this._barRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._barRenderer.getContentSize());this._findLayout();this._barTextureSize=this._barRenderer.getContentSize()}},loadProgressBarTexture:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._progressBarTextureFile=a;this._progressBarTexType=b;b=this._progressBarRenderer;var c=this;b._textureLoaded||b.addEventListener("load",function(){c.loadProgressBarTexture(c._progressBarTextureFile,c._progressBarTexType)}); switch(this._progressBarTexType){case ccui.Widget.LOCAL_TEXTURE:b.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:b.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._progressBarRenderer.setAnchorPoint(cc.p(0,.5));a=this._progressBarRenderer.getContentSize();this._progressBarTextureSize={width:a.width,height:a.height};this._progressBarRendererDirty=!0;this._findLayout()}},setScale9Enabled:function(a){this._scale9Enabled!==a&&(this._scale9Enabled=a,this.removeProtectedChild(this._barRenderer, !0),this.removeProtectedChild(this._progressBarRenderer,!0),this._progressBarRenderer=this._barRenderer=null,this._scale9Enabled?(this._barRenderer=new ccui.Scale9Sprite,this._progressBarRenderer=new ccui.Scale9Sprite):(this._barRenderer=new cc.Sprite,this._progressBarRenderer=new cc.Sprite),this.loadBarTexture(this._textureFile,this._barTexType),this.loadProgressBarTexture(this._progressBarTextureFile,this._progressBarTexType),this.addProtectedChild(this._barRenderer,ccui.Slider.BASEBAR_RENDERER_ZORDER, -1),this.addProtectedChild(this._progressBarRenderer,ccui.Slider.PROGRESSBAR_RENDERER_ZORDER,-1),this._scale9Enabled?(a=this._ignoreSize,this.ignoreContentAdaptWithSize(!1),this._prevIgnoreSize=a):this.ignoreContentAdaptWithSize(this._prevIgnoreSize),this.setCapInsetsBarRenderer(this._capInsetsBarRenderer),this.setCapInsetProgressBarRenderer(this._capInsetsProgressBarRenderer),this._progressBarRendererDirty=this._barRendererAdaptDirty=!0)},isScale9Enabled:function(){return this._scale9Enabled},ignoreContentAdaptWithSize:function(a){if(!this._scale9Enabled|| this._scale9Enabled&&!a)ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a),this._prevIgnoreSize=a},setCapInsets:function(a){this.setCapInsetsBarRenderer(a);this.setCapInsetProgressBarRenderer(a)},setCapInsetsBarRenderer:function(a){if(a){var b=this._capInsetsBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._barRenderer.setCapInsets(a)}},getCapInsetsBarRenderer:function(){return cc.rect(this._capInsetsBarRenderer)},setCapInsetProgressBarRenderer:function(a){if(a){var b= this._capInsetsProgressBarRenderer;b.x=a.x;b.y=a.y;b.width=a.width;b.height=a.height;this._scale9Enabled&&this._progressBarRenderer.setCapInsets(a)}},getCapInsetsProgressBarRenderer:function(){return cc.rect(this._capInsetsProgressBarRenderer)},loadSlidBallTextures:function(a,b,c,d){this.loadSlidBallTextureNormal(a,d);this.loadSlidBallTexturePressed(b,d);this.loadSlidBallTextureDisabled(c,d)},loadSlidBallTextureNormal:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallNormalTextureFile= a;this._ballNTexType=b;var c=this;this._slidBallNormalRenderer._textureLoaded||this._slidBallNormalRenderer.addEventListener("load",function(){c.loadSlidBallTextureNormal(c._slidBallNormalTextureFile,c._ballNTexType)});switch(this._ballNTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallNormalRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallNormalRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA();this._findLayout()}},loadSlidBallTexturePressed:function(a, b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallPressedTextureFile=a;this._ballPTexType=b;var c=this;this._slidBallPressedRenderer._textureLoaded||this._slidBallPressedRenderer.addEventListener("load",function(){c.loadSlidBallTexturePressed(c._slidBallPressedTextureFile,c._ballPTexType)});switch(this._ballPTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallPressedRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallPressedRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._findLayout()}},loadSlidBallTextureDisabled:function(a,b){if(a){b=b||ccui.Widget.LOCAL_TEXTURE;this._slidBallDisabledTextureFile=a;this._ballDTexType=b;var c=this;this._slidBallDisabledRenderer._textureLoaded||this._slidBallDisabledRenderer.addEventListener("load",function(){c.loadSlidBallTextureDisabled(c._slidBallDisabledTextureFile,c._ballDTexType)});switch(this._ballDTexType){case ccui.Widget.LOCAL_TEXTURE:this._slidBallDisabledRenderer.initWithFile(a);break;case ccui.Widget.PLIST_TEXTURE:this._slidBallDisabledRenderer.initWithSpriteFrameName(a)}this._updateChildrenDisplayedRGBA(); this._findLayout()}},setPercent:function(a){100a&&(a=0);this._percent=a;a=a/100*this._barLength;this._slidBallRenderer.setPosition(a,this._contentSize.height/2);if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(cc.size(a,this._contentSize.height));else{var b=this._progressBarRenderer,c=b.getTextureRect();b.setTextureRect(cc.rect(c.x,c.y,a/b._scaleX,c.height),b.isTextureRectRotated())}},hitTest:function(a){a=this._slidBallNormalRenderer.convertToNodeSpace(a);var b=this._slidBallNormalRenderer.getContentSize(); b=cc.rect(0,0,b.width,b.height);return a.x>=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height},onTouchBegan:function(a,b){a=ccui.Widget.prototype.onTouchBegan.call(this,a,b);this._hit&&(b=this.convertToNodeSpace(this._touchBeganPosition),this.setPercent(this._getPercentWithBallPos(b.x)),this._percentChangedEvent());return a},onTouchMoved:function(a,b){a=a.getLocation();a=this.convertToNodeSpace(a);this.setPercent(this._getPercentWithBallPos(a.x));this._percentChangedEvent()},onTouchEnded:function(a, b){ccui.Widget.prototype.onTouchEnded.call(this,a,b)},onTouchCancelled:function(a,b){ccui.Widget.prototype.onTouchCancelled.call(this,a,b)},_getPercentWithBallPos:function(a){return a/this._barLength*100},addEventListenerSlider:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._sliderEventSelector=a;this._sliderEventListener=b},_percentChangedEvent:function(){this._sliderEventSelector&&(this._sliderEventListener?this._sliderEventSelector.call(this._sliderEventListener, this,ccui.Slider.EVENT_PERCENT_CHANGED):this._sliderEventSelector(this,ccui.Slider.EVENT_PERCENT_CHANGED));this._ccEventCallback&&this._ccEventCallback(this,ccui.Slider.EVENT_PERCENT_CHANGED)},getPercent:function(){return this._percent},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._progressBarRendererDirty=this._barRendererAdaptDirty=!0},_adaptRenderers:function(){this._barRendererAdaptDirty&&(this._barRendererScaleChangedWithSize(),this._barRendererAdaptDirty=!1); this._progressBarRendererDirty&&(this._progressBarRendererScaleChangedWithSize(),this._progressBarRendererDirty=!1)},getVirtualRendererSize:function(){return this._barRenderer.getContentSize()},getVirtualRenderer:function(){return this._barRenderer},_barRendererScaleChangedWithSize:function(){if(this._unifySize)this._barLength=this._contentSize.width,this._barRenderer.setPreferredSize(this._contentSize);else if(this._ignoreSize)this._barRenderer.setScale(1),this._barLength=this._contentSize.width; else if(this._barLength=this._contentSize.width,this._scale9Enabled)this._barRenderer.setPreferredSize(this._contentSize),this._barRenderer.setScale(1);else{var a=this._barTextureSize;if(0>=a.width||0>=a.height)this._barRenderer.setScale(1);else{var b=this._contentSize.height/a.height;this._barRenderer.setScaleX(this._contentSize.width/a.width);this._barRenderer.setScaleY(b)}}this._barRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2);this.setPercent(this._percent)},_progressBarRendererScaleChangedWithSize:function(){if(this._unifySize)this._progressBarRenderer.setPreferredSize(this._contentSize); else if(this._ignoreSize){if(!this._scale9Enabled){var a=this._progressBarTextureSize,b=this._contentSize.width/a.width;a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}}else if(this._scale9Enabled)this._progressBarRenderer.setPreferredSize(this._contentSize),this._progressBarRenderer.setScale(1);else{a=this._progressBarTextureSize;if(0>=a.width||0>=a.height){this._progressBarRenderer.setScale(1);return}b=this._contentSize.width/a.width; a=this._contentSize.height/a.height;this._progressBarRenderer.setScaleX(b);this._progressBarRenderer.setScaleY(a)}this._progressBarRenderer.setPosition(0,this._contentSize.height/2);this.setPercent(this._percent)},_onPressStateChangedToNormal:function(){this._slidBallNormalRenderer.setVisible(!0);this._slidBallPressedRenderer.setVisible(!1);this._slidBallDisabledRenderer.setVisible(!1);this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY);cc._renderType=== cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToPressed:function(){this._slidBallPressedTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallPressedRenderer.setVisible(!0),this._slidBallDisabledRenderer.setVisible(!1)):this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX+this._zoomScale,this._sliderBallNormalTextureScaleY+this._zoomScale);cc._renderType===cc.game.RENDER_TYPE_WEBGL&& (this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getNormalGLProgram())},_onPressStateChangedToDisabled:function(){this._slidBallDisabledTextureFile?(this._slidBallNormalRenderer.setVisible(!1),this._slidBallDisabledRenderer.setVisible(!0)):(this._slidBallNormalRenderer.setVisible(!0),cc._renderType===cc.game.RENDER_TYPE_WEBGL&&(this._slidBallNormalRenderer._renderCmd._shaderProgram=this._getGrayGLProgram()));this._slidBallNormalRenderer.setScale(this._sliderBallNormalTextureScaleX,this._sliderBallNormalTextureScaleY); this._slidBallPressedRenderer.setVisible(!1)},setZoomScale:function(a){this._zoomScale=a},getZoomScale:function(){return this._zoomScale},getSlidBallNormalRenderer:function(){return this._slidBallNormalRenderer},getSlidBallPressedRenderer:function(){return this._slidBallPressedRenderer},getSlidBallDisabledRenderer:function(){return this._slidBallDisabledRenderer},getSlidBallRenderer:function(){return this._slidBallRenderer},getDescription:function(){return"Slider"},_createCloneInstance:function(){return new ccui.Slider}, _copySpecialProperties:function(a){this._prevIgnoreSize=a._prevIgnoreSize;this.setScale9Enabled(a._scale9Enabled);this.loadBarTexture(a._textureFile,a._barTexType);this.loadProgressBarTexture(a._progressBarTextureFile,a._progressBarTexType);this.loadSlidBallTextureNormal(a._slidBallNormalTextureFile,a._ballNTexType);this.loadSlidBallTexturePressed(a._slidBallPressedTextureFile,a._ballPTexType);this.loadSlidBallTextureDisabled(a._slidBallDisabledTextureFile,a._ballDTexType);this.setPercent(a.getPercent()); this._sliderEventListener=a._sliderEventListener;this._sliderEventSelector=a._sliderEventSelector;this._zoomScale=a._zoomScale;this._ccEventCallback=a._ccEventCallback}});ccui.Slider.prototype.percent;cc.defineGetterSetter(ccui.Slider.prototype,"percent",ccui.Slider.prototype.getPercent,ccui.Slider.prototype.setPercent);ccui.Slider.create=function(a,b,c){return new ccui.Slider(a,b,c)};ccui.Slider.EVENT_PERCENT_CHANGED=0;ccui.Slider.BASEBAR_RENDERER_ZORDER=-3; ccui.Slider.PROGRESSBAR_RENDERER_ZORDER=-2;ccui.Slider.BALL_RENDERER_ZORDER=-1;ccui.Text=ccui.Widget.extend({_touchScaleChangeEnabled:!1,_normalScaleValueX:1,_normalScaleValueY:1,_fontName:"Arial",_fontSize:16,_onSelectedScaleOffset:.5,_labelRenderer:null,_textAreaSize:null,_textVerticalAlignment:0,_textHorizontalAlignment:0,_className:"Text",_type:null,_labelRendererAdaptDirty:!0,ctor:function(a,b,c){this._type=ccui.Text.Type.SYSTEM;this._textAreaSize=cc.size(0,0);ccui.Widget.prototype.ctor.call(this);void 0!==c?(this.setFontName(b),this.setFontSize(c),this.setString(a)):this.setFontName(this._fontName)}, _initRenderer:function(){this._labelRenderer=new cc.LabelTTF;this.addProtectedChild(this._labelRenderer,ccui.Text.RENDERER_ZORDER,-1)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){a!==this._labelRenderer.getString()&&(this._setString(a),this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize()))},_setString:function(a){this._labelRenderer.setString(a);this._labelRendererAdaptDirty=!0},getStringValue:function(){cc.log("Please use the getString"); return this._labelRenderer.getString()},getString:function(){return this._labelRenderer.getString()},getStringLength:function(){return this._labelRenderer.getStringLength()},setFontSize:function(a){this._setFontSize(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setFontSize:function(a){this._labelRenderer.setFontSize(a);this._fontSize=a;this._labelRendererAdaptDirty=!0},getFontSize:function(){return this._fontSize},setFontName:function(a){this._setFontName(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())}, _setFontName:function(a){this._fontName=a;this._labelRenderer.setFontName(a);this._labelRendererAdaptDirty=!0},_updateUITextContentSize:function(){this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},getFontName:function(){return this._fontName},_setFont:function(a){var b=cc.LabelTTF._fontStyleRE.exec(a);b&&(this._fontSize=parseInt(b[1]),this._fontName=b[2],this._labelRenderer._setFont(a),this._labelScaleChangedWithSize())},_getFont:function(){return this._labelRenderer._getFont()}, getType:function(){return this._type},setTextAreaSize:function(a){this._setTextAreaSize(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setTextAreaSize:function(a){this._labelRenderer.setDimensions(a);this._ignoreSize||(this._customSize=a);this._labelRendererAdaptDirty=!0},getTextAreaSize:function(){return this._labelRenderer.getDimensions()},setTextHorizontalAlignment:function(a){this._setTextHorizontalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())}, _setTextHorizontalAlignment:function(a){this._labelRenderer.setHorizontalAlignment(a);this._labelRendererAdaptDirty=!0},getTextHorizontalAlignment:function(){return this._labelRenderer.getHorizontalAlignment()},setTextVerticalAlignment:function(a){this._setTextVerticalAlignment(a);this._updateContentSizeWithTextureSize(this._labelRenderer.getContentSize())},_setTextVerticalAlignment:function(a){this._labelRenderer.setVerticalAlignment(a);this._labelRendererAdaptDirty=!0},getTextVerticalAlignment:function(){return this._labelRenderer.getVerticalAlignment()}, setTouchScaleChangeEnabled:function(a){this._touchScaleChangeEnabled=a},isTouchScaleChangeEnabled:function(){return this._touchScaleChangeEnabled},_onPressStateChangedToNormal:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX),this._labelRenderer.setScaleY(this._normalScaleValueY))},_onPressStateChangedToPressed:function(){this._touchScaleChangeEnabled&&(this._labelRenderer.setScaleX(this._normalScaleValueX+this._onSelectedScaleOffset),this._labelRenderer.setScaleY(this._normalScaleValueY+ this._onSelectedScaleOffset))},_onPressStateChangedToDisabled:function(){},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelRendererAdaptDirty&&(this._labelScaleChangedWithSize(),this._labelRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelRenderer},getAutoRenderSize:function(){var a=this._labelRenderer.getContentSize(); this._ignoreSize||(this._labelRenderer.setDimensions(0,0),a=this._labelRenderer.getContentSize(),this._labelRenderer.setDimensions(this._contentSize.width,this._contentSize.height));return a},_labelScaleChangedWithSize:function(){var a=this._contentSize;if(this._ignoreSize)this._labelRenderer.setScale(1),this._normalScaleValueX=this._normalScaleValueY=1;else{this._labelRenderer.setDimensions(cc.size(a.width,a.height));var b=this._labelRenderer.getContentSize();if(0>=b.width||0>=b.height){this._labelRenderer.setScale(1); return}var c=a.width/b.width;b=a.height/b.height;this._labelRenderer.setScaleX(c);this._labelRenderer.setScaleY(b);this._normalScaleValueX=c;this._normalScaleValueY=b}this._labelRenderer.setPosition(a.width/2,a.height/2)},getDescription:function(){return"Label"},enableShadow:function(a,b,c){this._labelRenderer.enableShadow(a,b,c)},enableOutline:function(a,b){this._labelRenderer.enableStroke(a,b)},enableGlow:function(a){this._type===ccui.Text.Type.TTF&&this._labelRenderer.enableGlow(a)},disableEffect:function(){this._labelRenderer.disableEffect&& this._labelRenderer.disableEffect()},_createCloneInstance:function(){return new ccui.Text},_copySpecialProperties:function(a){a instanceof ccui.Text&&(this.setFontName(a._fontName),this.setFontSize(a.getFontSize()),this.setString(a.getString()),this.setTouchScaleChangeEnabled(a.touchScaleEnabled),this.setTextAreaSize(a._textAreaSize),this.setTextHorizontalAlignment(a._labelRenderer.getHorizontalAlignment()),this.setTextVerticalAlignment(a._labelRenderer.getVerticalAlignment()),this.setContentSize(a.getContentSize()), this.setTextColor(a.getTextColor()))},_setBoundingWidth:function(a){this._textAreaSize.width=a;this._labelRenderer._setBoundingWidth(a);this._labelScaleChangedWithSize()},_setBoundingHeight:function(a){this._textAreaSize.height=a;this._labelRenderer._setBoundingHeight(a);this._labelScaleChangedWithSize()},_getBoundingWidth:function(){return this._textAreaSize.width},_getBoundingHeight:function(){return this._textAreaSize.height},_changePosition:function(){this._adaptRenderers()},setColor:function(a){cc.ProtectedNode.prototype.setColor.call(this, a);this._labelRenderer.setColor(a)},setTextColor:function(a){this._labelRenderer.setFontFillColor(a)},getTextColor:function(){return this._labelRenderer._getFillStyle()}});ccui.Text.prototype.boundingWidth;cc.defineGetterSetter(ccui.Text.prototype,"boundingWidth",ccui.Text.prototype._getBoundingWidth,ccui.Text.prototype._setBoundingWidth);ccui.Text.prototype.boundingHeight;cc.defineGetterSetter(ccui.Text.prototype,"boundingHeight",ccui.Text.prototype._getBoundingHeight,ccui.Text.prototype._setBoundingHeight); ccui.Text.prototype.string;cc.defineGetterSetter(ccui.Text.prototype,"string",ccui.Text.prototype.getString,ccui.Text.prototype.setString);ccui.Text.prototype.stringLength;cc.defineGetterSetter(ccui.Text.prototype,"stringLength",ccui.Text.prototype.getStringLength);ccui.Text.prototype.font;cc.defineGetterSetter(ccui.Text.prototype,"font",ccui.Text.prototype._getFont,ccui.Text.prototype._setFont);ccui.Text.prototype.fontSize; cc.defineGetterSetter(ccui.Text.prototype,"fontSize",ccui.Text.prototype.getFontSize,ccui.Text.prototype.setFontSize);ccui.Text.prototype.fontName;cc.defineGetterSetter(ccui.Text.prototype,"fontName",ccui.Text.prototype.getFontName,ccui.Text.prototype.setFontName);ccui.Text.prototype.textAlign;cc.defineGetterSetter(ccui.Text.prototype,"textAlign",ccui.Text.prototype.getTextHorizontalAlignment,ccui.Text.prototype.setTextHorizontalAlignment);ccui.Text.prototype.verticalAlign; cc.defineGetterSetter(ccui.Text.prototype,"verticalAlign",ccui.Text.prototype.getTextVerticalAlignment,ccui.Text.prototype.setTextVerticalAlignment);ccui.Label=ccui.Text.create=function(a,b,c){return new ccui.Text(a,b,c)};ccui.Text.RENDERER_ZORDER=-1;ccui.Text.Type={SYSTEM:0,TTF:1};ccui.TextAtlas=ccui.Widget.extend({_labelAtlasRenderer:null,_stringValue:"",_charMapFileName:"",_itemWidth:0,_itemHeight:0,_startCharMap:"",_className:"TextAtlas",_labelAtlasRendererAdaptDirty:null,ctor:function(a,b,c,d,e){ccui.Widget.prototype.ctor.call(this);void 0!==e&&this.setProperty(a,b,c,d,e)},_initRenderer:function(){this._labelAtlasRenderer=new cc.LabelAtlas;this._labelAtlasRenderer.setAnchorPoint(cc.p(.5,.5));this.addProtectedChild(this._labelAtlasRenderer,ccui.TextAtlas.RENDERER_ZORDER, -1);this._labelAtlasRenderer.addEventListener("load",function(){this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize());this._findLayout()},this)},setProperty:function(a,b,c,d,e){this._stringValue=a;this._charMapFileName=b;this._itemWidth=c;this._itemHeight=d;this._startCharMap=e;this._labelAtlasRenderer.initWithString(a,this._charMapFileName,this._itemWidth,this._itemHeight,this._startCharMap[0]);this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize()); this._labelAtlasRendererAdaptDirty=!0},setString:function(a){a!==this._labelAtlasRenderer.getString()&&(this._stringValue=a,this._labelAtlasRenderer.setString(a),this._updateContentSizeWithTextureSize(this._labelAtlasRenderer.getContentSize()),this._labelAtlasRendererAdaptDirty=!0)},setStringValue:function(a){cc.log("Please use the setString");this.setString(a)},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._labelAtlasRenderer.getString()}, getStringLength:function(){return this._labelAtlasRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelAtlasRendererAdaptDirty=!0},_adaptRenderers:function(){this._labelAtlasRendererAdaptDirty&&(this._labelAtlasScaleChangedWithSize(),this._labelAtlasRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelAtlasRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelAtlasRenderer},_labelAtlasScaleChangedWithSize:function(){var a= this._labelAtlasRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"LabelAtlas"},_copySpecialProperties:function(a){a&&this.setProperty(a._stringValue,a._charMapFileName,a._itemWidth,a._itemHeight,a._startCharMap)},_createCloneInstance:function(){return new ccui.TextAtlas}}); ccui.TextAtlas.prototype.string;cc.defineGetterSetter(ccui.TextAtlas.prototype,"string",ccui.TextAtlas.prototype.getString,ccui.TextAtlas.prototype.setString);ccui.TextAtlas.create=function(a,b,c,d,e){return new ccui.TextAtlas(a,b,c,d,e)};ccui.TextAtlas.RENDERER_ZORDER=-1;ccui.LabelBMFont=ccui.TextBMFont=ccui.Widget.extend({_labelBMFontRenderer:null,_fntFileHasInit:!1,_fntFileName:"",_stringValue:"",_className:"TextBMFont",_labelBMFontRendererAdaptDirty:!0,ctor:function(a,b){ccui.Widget.prototype.ctor.call(this);this._loader=new cc.Sprite.LoadManager;void 0!==b&&(this.setFntFile(b),this.setString(a))},_initRenderer:function(){this._labelBMFontRenderer=new cc.LabelBMFont;this.addProtectedChild(this._labelBMFontRenderer,ccui.TextBMFont.RENDERER_ZORDER,-1)},setFntFile:function(a){if(a){this._fntFileName= a;this._fntFileHasInit=!0;this._labelBMFontRenderer.initWithString(this._stringValue,a);this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize());this._labelBMFontRendererAdaptDirty=!0;var b=this;a=b._labelBMFontRenderer;a._textureLoaded||a.addEventListener("load",function(){b.setFntFile(b._fntFileName)})}},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){this._loader.clear();this._labelBMFontRenderer._textureLoaded?a!==this._labelBMFontRenderer.getString()&& (this._stringValue=a,this._labelBMFontRenderer.setString(a),this._fntFileHasInit&&(this._updateContentSizeWithTextureSize(this._labelBMFontRenderer.getContentSize()),this._labelBMFontRendererAdaptDirty=!0)):this._loader.add(this._labelBMFontRenderer,function(){this.setString(a)},this)},getString:function(){return this._stringValue},getStringLength:function(){return this._labelBMFontRenderer.getStringLength()},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._labelBMFontRendererAdaptDirty= !0},_adaptRenderers:function(){this._labelBMFontRendererAdaptDirty&&(this._labelBMFontScaleChangedWithSize(),this._labelBMFontRendererAdaptDirty=!1)},getVirtualRendererSize:function(){return this._labelBMFontRenderer.getContentSize()},getVirtualRenderer:function(){return this._labelBMFontRenderer},_labelBMFontScaleChangedWithSize:function(){var a=this._labelBMFontRenderer;if(this._ignoreSize)a.setScale(1);else{var b=a.getContentSize();if(0>=b.width||0>=b.height){a.setScale(1);return}a.setScaleX(this._contentSize.width/ b.width);a.setScaleY(this._contentSize.height/b.height)}a.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getDescription:function(){return"TextBMFont"},_createCloneInstance:function(){return new ccui.TextBMFont},_copySpecialProperties:function(a){this.setFntFile(a._fntFileName);this.setString(a._stringValue)}});ccui.TextBMFont.prototype.string;cc.defineGetterSetter(ccui.TextBMFont.prototype,"string",ccui.TextBMFont.prototype.getString,ccui.TextBMFont.prototype.setString); ccui.TextBMFont.create=function(a,b){return new ccui.TextBMFont(a,b)};ccui.TextBMFont.RENDERER_ZORDER=-1;ccui._TextFieldRenderer=cc.TextFieldTTF.extend({_maxLengthEnabled:!1,_maxLength:0,_passwordEnabled:!1,_passwordStyleText:"",_attachWithIME:!1,_detachWithIME:!1,_insertText:!1,_deleteBackward:!1,_className:"_TextFieldRenderer",ctor:function(){cc.TextFieldTTF.prototype.ctor.call(this);this._maxLengthEnabled=!1;this._maxLength=0;this._passwordEnabled=!1;this._passwordStyleText="*";this._deleteBackward=this._insertText=this._detachWithIME=this._attachWithIME=!1},onEnter:function(){cc.TextFieldTTF.prototype.onEnter.call(this); cc.TextFieldTTF.prototype.setDelegate.call(this,this)},onTextFieldAttachWithIME:function(a){this.setAttachWithIME(!0);return!1},onTextFieldInsertText:function(a,b,c){if(1===c&&"\n"===b)return!1;this.setInsertText(!0);return this._maxLengthEnabled&&cc.TextFieldTTF.prototype.getCharCount.call(this)>=this._maxLength},onTextFieldDeleteBackward:function(a,b,c){this.setDeleteBackward(!0);return!1},onTextFieldDetachWithIME:function(a){this.setDetachWithIME(!0);return!1},insertText:function(a,b){"\n"!==a&& this._maxLengthEnabled&&this.getString().length>=this._maxLength?this._passwordEnabled&&this.setPasswordText(this.getString()):(cc.TextFieldTTF.prototype.insertText.call(this,a,b),this._passwordEnabled&&0b||126this._maxLength&&(a=this._maxLength);for(c=0;c=b.x&&a.x<=b.x+b.width&&a.y>=b.y&&a.y<=b.y+b.height}return ccui.Widget.prototype.hitTest.call(this,a)},getTouchSize:function(){return cc.size(this._touchWidth,this._touchHeight)},setText:function(a){cc.log("Please use the setString");this.setString(a)},setString:function(a){null!=a&&(a=String(a),this.isMaxLengthEnabled()&&(a=a.substr(0,this.getMaxLength())),this.isPasswordEnabled()?(this._textFieldRenderer.setPasswordText(a),this._textFieldRenderer.setString(""),this._textFieldRenderer.insertText(a, a.length)):this._textFieldRenderer.setString(a),this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()))},setPlaceHolder:function(a){this._textFieldRenderer.setPlaceHolder(a);this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getPlaceHolder:function(){return this._textFieldRenderer.getPlaceHolder()},getPlaceHolderColor:function(){return this._textFieldRenderer.getPlaceHolderColor()}, setPlaceHolderColor:function(a){this._textFieldRenderer.setColorSpaceHolder(a)},setTextColor:function(a){this._textFieldRenderer.setTextColor(a)},setFontSize:function(a){this._textFieldRenderer.setFontSize(a);this._fontSize=a;this._textFieldRendererAdaptDirty=!0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontSize:function(){return this._fontSize},setFontName:function(a){this._textFieldRenderer.setFontName(a);this._fontName=a;this._textFieldRendererAdaptDirty= !0;this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize())},getFontName:function(){return this._fontName},didNotSelectSelf:function(){this._textFieldRenderer.detachWithIME()},getStringValue:function(){cc.log("Please use the getString");return this.getString()},getString:function(){return this._textFieldRenderer.getString()},getStringLength:function(){return this._textFieldRenderer.getStringLength()},onTouchBegan:function(a,b){var c=this;a=ccui.Widget.prototype.onTouchBegan.call(c, a,b);c._hit?setTimeout(function(){c._textFieldRenderer.attachWithIME()},0):setTimeout(function(){c._textFieldRenderer.detachWithIME()},0);return a},setMaxLengthEnabled:function(a){this._textFieldRenderer.setMaxLengthEnabled(a)},isMaxLengthEnabled:function(){return this._textFieldRenderer.isMaxLengthEnabled()},setMaxLength:function(a){this._textFieldRenderer.setMaxLength(a);this.setString(this.getString())},getMaxLength:function(){return this._textFieldRenderer.getMaxLength()},setPasswordEnabled:function(a){this._textFieldRenderer.setPasswordEnabled(a)}, isPasswordEnabled:function(){return this._textFieldRenderer.isPasswordEnabled()},setPasswordStyleText:function(a){this._textFieldRenderer.setPasswordStyleText(a);this._passwordStyleText=a;this.setString(this.getString())},getPasswordStyleText:function(){return this._passwordStyleText},update:function(a){this.getDetachWithIME()&&(this._detachWithIMEEvent(),this.setDetachWithIME(!1));this.getAttachWithIME()&&(this._attachWithIMEEvent(),this.setAttachWithIME(!1));this.getInsertText()&&(this._textFieldRendererAdaptDirty= !0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._insertTextEvent(),this.setInsertText(!1));this.getDeleteBackward()&&(this._textFieldRendererAdaptDirty=!0,this._updateContentSizeWithTextureSize(this._textFieldRenderer.getContentSize()),this._deleteBackwardEvent(),this.setDeleteBackward(!1))},getAttachWithIME:function(){return this._textFieldRenderer.getAttachWithIME()},setAttachWithIME:function(a){this._textFieldRenderer.setAttachWithIME(a)},getDetachWithIME:function(){return this._textFieldRenderer.getDetachWithIME()}, setDetachWithIME:function(a){this._textFieldRenderer.setDetachWithIME(a)},getInsertText:function(){return this._textFieldRenderer.getInsertText()},setInsertText:function(a){this._textFieldRenderer.setInsertText(a)},getDeleteBackward:function(){return this._textFieldRenderer.getDeleteBackward()},setDeleteBackward:function(a){this._textFieldRenderer.setDeleteBackward(a)},_attachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener, this,ccui.TextField.EVENT_ATTACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_ATTACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_ATTACH_WITH_IME)},_detachWithIMEEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_DETACH_WITH_IME):this._textFieldEventSelector(this,ccui.TextField.EVENT_DETACH_WITH_IME));this._ccEventCallback&&this._ccEventCallback(this, ccui.TextField.EVENT_DETACH_WITH_IME)},_insertTextEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener,this,ccui.TextField.EVENT_INSERT_TEXT):this._textFieldEventSelector(this,ccui.TextField.EVENT_INSERT_TEXT));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_INSERT_TEXT)},_deleteBackwardEvent:function(){this._textFieldEventSelector&&(this._textFieldEventListener?this._textFieldEventSelector.call(this._textFieldEventListener, this,ccui.TextField.EVENT_DELETE_BACKWARD):this._textFieldEventSelector(this,ccui.TextField.EVENT_DELETE_BACKWARD));this._ccEventCallback&&this._ccEventCallback(this,ccui.TextField.EVENT_DELETE_BACKWARD)},addEventListenerTextField:function(a,b){this.addEventListener(a,b)},addEventListener:function(a,b){this._textFieldEventSelector=a;this._textFieldEventListener=b},_onSizeChanged:function(){ccui.Widget.prototype._onSizeChanged.call(this);this._textFieldRendererAdaptDirty=!0},_adaptRenderers:function(){this._textFieldRendererAdaptDirty&& (this._textfieldRendererScaleChangedWithSize(),this._textFieldRendererAdaptDirty=!1)},_textfieldRendererScaleChangedWithSize:function(){this._ignoreSize||this._textFieldRenderer.setDimensions(this._contentSize);this._textFieldRenderer.setPosition(this._contentSize.width/2,this._contentSize.height/2)},getAutoRenderSize:function(){var a=this._textFieldRenderer.getContentSize();this._ignoreSize||(this._textFieldRenderer.setDimensions(0,0),a=this._textFieldRenderer.getContentSize(),this._textFieldRenderer.setDimensions(this._contentSize.width, this._contentSize.height));return a},getVirtualRendererSize:function(){return this._textFieldRenderer.getContentSize()},getVirtualRenderer:function(){return this._textFieldRenderer},getDescription:function(){return"TextField"},attachWithIME:function(){this._textFieldRenderer.attachWithIME()},_createCloneInstance:function(){return new ccui.TextField},_copySpecialProperties:function(a){this.setString(a._textFieldRenderer.getString());this.setPlaceHolder(a.getString());this.setFontSize(a._textFieldRenderer.getFontSize()); this.setFontName(a._textFieldRenderer.getFontName());this.setMaxLengthEnabled(a.isMaxLengthEnabled());this.setMaxLength(a.getMaxLength());this.setPasswordEnabled(a.isPasswordEnabled());this.setPasswordStyleText(a._passwordStyleText);this.setAttachWithIME(a.getAttachWithIME());this.setDetachWithIME(a.getDetachWithIME());this.setInsertText(a.getInsertText());this.setDeleteBackward(a.getDeleteBackward());this._ccEventCallback=a._ccEventCallback;this._textFieldEventListener=a._textFieldEventListener; this._textFieldEventSelector=a._textFieldEventSelector},setTextAreaSize:function(a){this.setContentSize(a)},setTextHorizontalAlignment:function(a){this._textFieldRenderer.setHorizontalAlignment(a)},setTextVerticalAlignment:function(a){this._textFieldRenderer.setVerticalAlignment(a)},_setFont:function(a){this._textFieldRenderer._setFont(a);this._textFieldRendererAdaptDirty=!0},_getFont:function(){return this._textFieldRenderer._getFont()},_changePosition:function(){this._adaptRenderers()}}); ccui.TextField.create=function(a,b,c){return new ccui.TextField(a,b,c)};ccui.TextField.prototype.string;cc.defineGetterSetter(ccui.TextField.prototype,"string",ccui.TextField.prototype.getString,ccui.TextField.prototype.setString);ccui.TextField.prototype.placeHolder;cc.defineGetterSetter(ccui.TextField.prototype,"placeHolder",ccui.TextField.prototype.getPlaceHolder,ccui.TextField.prototype.setPlaceHolder);ccui.TextField.prototype.font; cc.defineGetterSetter(ccui.TextField.prototype,"font",ccui.TextField.prototype._getFont,ccui.TextField.prototype._setFont);ccui.TextField.prototype.fontSize;cc.defineGetterSetter(ccui.TextField.prototype,"fontSize",ccui.TextField.prototype.getFontSize,ccui.TextField.prototype.setFontSize);ccui.TextField.prototype.fontName;cc.defineGetterSetter(ccui.TextField.prototype,"fontName",ccui.TextField.prototype.getFontName,ccui.TextField.prototype.setFontName);ccui.TextField.prototype.maxLengthEnabled; cc.defineGetterSetter(ccui.TextField.prototype,"maxLengthEnabled",ccui.TextField.prototype.isMaxLengthEnabled,ccui.TextField.prototype.setMaxLengthEnabled);ccui.TextField.prototype.maxLength;cc.defineGetterSetter(ccui.TextField.prototype,"maxLength",ccui.TextField.prototype.getMaxLength,ccui.TextField.prototype.setMaxLength);ccui.TextField.prototype.passwordEnabled;cc.defineGetterSetter(ccui.TextField.prototype,"passwordEnabled",ccui.TextField.prototype.isPasswordEnabled,ccui.TextField.prototype.setPasswordEnabled); ccui.TextField.EVENT_ATTACH_WITH_IME=0;ccui.TextField.EVENT_DETACH_WITH_IME=1;ccui.TextField.EVENT_INSERT_TEXT=2;ccui.TextField.EVENT_DELETE_BACKWARD=3;ccui.TextField.RENDERER_ZORDER=-1;ccui.VideoPlayer=ccui.Widget.extend({_played:!1,_playing:!1,_stopped:!0,ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.setURL(a)},_createRenderCmd:function(){return new ccui.VideoPlayer.RenderCmd(this)},visit:function(){var a=this._renderCmd,b=cc.container,c=cc.eventManager;if(this._visible)b.appendChild(a._video),null===this._listener&&(this._listener=cc.eventManager.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var d=!1;(d="contains"in b? b.contains(a._video):b.compareDocumentPosition(a._video)%16)&&b.removeChild(a._video);c.removeListener(a._listener);a._listener=null}a.updateStatus();a.resize()},setURL:function(a){this._renderCmd.updateURL(a)},getURL:function(){return this._renderCmd._url},play:function(){var a=this,b=this._renderCmd._video;if(b){this._played=!0;b.pause();if(!1!==this._stopped||!1!==this._playing||!0!==this._played)b.currentTime=0;ccui.VideoPlayer._polyfill.autoplayAfterOperation?setTimeout(function(){b.play();a._playing= !0;a._stopped=!1},20):(b.play(),this._playing=!0,this._stopped=!1)}},pause:function(){var a=this._renderCmd._video;a&&!0===this._playing&&!1===this._stopped&&(a.pause(),this._playing=!1)},resume:function(){!1===this._stopped&&!1===this._playing&&!0===this._played&&this.play()},stop:function(){var a=this,b=this._renderCmd._video;b&&(b.pause(),b.currentTime=0,this._playing=!1,this._stopped=!0);setTimeout(function(){a._dispatchEvent(ccui.VideoPlayer.EventType.STOPPED)},0)},seekTo:function(a){var b=this._renderCmd._video; b&&(b.currentTime=a,ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this.isPlaying()&&setTimeout(function(){b.play()},20))},isPlaying:function(){if(ccui.VideoPlayer._polyfill.autoplayAfterOperation&&this._playing){var a=this._renderCmd._video;setTimeout(function(){a.play()},20)}return this._playing},setKeepAspectRatioEnabled:function(a){cc.log("On the web is always keep the aspect ratio")},isKeepAspectRatioEnabled:function(){return!1},setFullScreenEnabled:function(a){var b=this._renderCmd._video; b&&(a?cc.screen.requestFullScreen(b):cc.screen.exitFullScreen(b))},isFullScreenEnabled:function(){cc.log("Can't know status")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null},_dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._video.src)},onPlayEvent:function(){var a=this._EventList[ccui.VideoPlayer.EventType.PLAYING];if(a)for(var b=0;bthis._leftSpaceWidth){e=a.length*(1- -this._leftSpaceWidth/f);f=a.substr(0,e);var g=a.substr(e,a.length-1),h=0this._leftSpaceWidth?(this._addNewLine(),this._pushToContainer(a), this._leftSpaceWidth-=b.width):this._pushToContainer(a)},_addNewLine:function(){this._leftSpaceWidth=this._customSize.width;this._elementRenders.push([])},formatRenderers:function(){var a=0,b=this._elementRenderersContainer,c=this._elementRenders,d,e;if(this._ignoreSize){var f=0;var g=c[0];for(d=e=0;d=this._elementRenders.length||this._elementRenders[this._elementRenders.length-1].push(a)},_adaptRenderers:function(){this.formatText()},setVerticalSpace:function(a){this._verticalSpace=a},setAnchorPoint:function(a){ccui.Widget.prototype.setAnchorPoint.call(this,a);this._elementRenderersContainer.setAnchorPoint(a)},_setAnchorX:function(a){ccui.Widget.prototype._setAnchorX.call(this,a);this._elementRenderersContainer._setAnchorX(a)}, _setAnchorY:function(a){ccui.Widget.prototype._setAnchorY.call(this,a);this._elementRenderersContainer._setAnchorY(a)},getVirtualRendererSize:function(){return this._elementRenderersContainer.getContentSize()},ignoreContentAdaptWithSize:function(a){this._ignoreSize!==a&&(this._formatTextDirty=!0,ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this,a))},getContentSize:function(){this.formatText();return cc.Node.prototype.getContentSize.call(this)},_getWidth:function(){this.formatText();return cc.Node.prototype._getWidth.call(this)}, _getHeight:function(){this.formatText();return cc.Node.prototype._getHeight.call(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,void 0===b?a.width:a,void 0===b?a.height:b);this._formatTextDirty=!0},getDescription:function(){return"RichText"},setCascadeOpacityEnabled:function(a){ccui.Widget.prototype.setCascadeOpacityEnabled.call(this,a);this._elementRenderersContainer.setCascadeOpacityEnabled(a)},setLineBreakOnSpace:function(a){this._lineBreakOnSpace=a;this._formatTextDirty= !0;this.formatText()},setTextHorizontalAlignment:function(a){a!==this._textHorizontalAlignment&&(this._textHorizontalAlignment=a,this.formatText())},setTextVerticalAlignment:function(a){a!==this._textVerticalAlignment&&(this._textVerticalAlignment=a,this.formatText())}});ccui.RichText.create=function(){return new ccui.RichText};ccui.RichElement.TEXT=0;ccui.RichElement.IMAGE=1;ccui.RichElement.CUSTOM=2;ccui.WebView=ccui.Widget.extend({ctor:function(a){ccui.Widget.prototype.ctor.call(this);this._EventList={};a&&this.loadURL(a)},visit:function(){var a=this._renderCmd,b=a._div,c=cc.container,d=cc.eventManager;if(this._visible)c.appendChild(b),null===this._listener&&(this._listener=d.addCustomListener(cc.game.EVENT_RESIZE,function(){a.resize()}));else{var e=!1;(e="contains"in c?c.contains(b):c.compareDocumentPosition(b)%16)&&c.removeChild(b);b=d._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners(); d._removeListenerInVector(b,a._listener);a._listener=null}a.updateStatus();a.resize(cc.view)},setJavascriptInterfaceScheme:function(a){},loadData:function(a,b,c,d){},loadHTMLString:function(a,b){},loadURL:function(a){this._renderCmd.updateURL(a);this._dispatchEvent(ccui.WebView.EventType.LOADING)},stopLoading:function(){cc.log("Web does not support loading")},reload:function(){var a=this._renderCmd._iframe;a&&(a=a.contentWindow)&&a.location&&a.location.reload()},canGoBack:function(){cc.log("Web does not support query history"); return!0},canGoForward:function(){cc.log("Web does not support query history");return!0},goBack:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoBack");var a=this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.back.call(b)}catch(c){b.history.back()}}}catch(c){cc.log(c)}},goForward:function(){try{if(ccui.WebView._polyfill.closeHistory)return cc.log("The current browser does not support the GoForward");var a= this._renderCmd._iframe;if(a){var b=a.contentWindow;if(b&&b.location)try{b.history.forward.call(b)}catch(c){b.history.forward()}}}catch(c){cc.log(c)}},evaluateJS:function(a){var b=this._renderCmd._iframe;if(b){b=b.contentWindow;try{b.eval(a),this._dispatchEvent(ccui.WebView.EventType.JS_EVALUATED)}catch(c){console.error(c)}}},setScalesPageToFit:function(){cc.log("Web does not support zoom")},setEventListener:function(a,b){this._EventList[a]=b},removeEventListener:function(a){this._EventList[a]=null}, _dispatchEvent:function(a){(a=this._EventList[a])&&a.call(this,this,this._renderCmd._iframe.src)},_createRenderCmd:function(){return new ccui.WebView.RenderCmd(this)},setContentSize:function(a,b){ccui.Widget.prototype.setContentSize.call(this,a,b);void 0===b&&(b=a.height,a=a.width);this._renderCmd.changeSize(a,b)},cleanup:function(){this._renderCmd.removeDom();this.stopAllActions();this.unscheduleAllCallbacks()}});ccui.WebView.EventType={LOADING:"loading",LOADED:"load",ERROR:"error",JS_EVALUATED:"js"}; (function(){var a=ccui.WebView._polyfill={devicePixelRatio:!1,enableDiv:!1};cc.sys.os===cc.sys.OS_IOS&&(a.enableDiv=!0);cc.sys.isMobile?cc.sys.browserType===cc.sys.BROWSER_TYPE_FIREFOX&&(a.enableBG=!0):cc.sys.browserType===cc.sys.BROWSER_TYPE_IE&&(a.closeHistory=!0)})(); (function(a){var b=null;b=cc._renderType===cc.game.RENDER_TYPE_WEBGL?cc.Node.WebGLRenderCmd:cc.Node.CanvasRenderCmd;ccui.WebView.RenderCmd=function(c){this._rootCtor(c);this._iframe=this._div=null;a.enableDiv?(this._div=document.createElement("div"),this._div.style["-webkit-overflow"]="auto",this._div.style["-webkit-overflow-scrolling"]="touch",this._iframe=document.createElement("iframe"),this._iframe.style.width="100%",this._iframe.style.height="100%",this._div.appendChild(this._iframe)):this._div= this._iframe=document.createElement("iframe");a.enableBG&&(this._div.style.background="#FFF");this._iframe.addEventListener("load",function(){c._dispatchEvent(ccui.WebView.EventType.LOADED)});this._iframe.addEventListener("error",function(){c._dispatchEvent(ccui.WebView.EventType.ERROR)});this._div.style.background="#FFF";this._div.style.height="200px";this._div.style.width="300px";this._div.style.overflow="scroll";this._div.style.border="none";this._listener=null;this.initStyle()};b=ccui.WebView.RenderCmd.prototype= Object.create(b.prototype);b.constructor=ccui.WebView.RenderCmd;b.transform=function(c,d){this.originTransform(c,d);this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY)};b.updateStatus=function(){a.devicePixelRatio=cc.view.isRetinaEnabled();var c=cc.Node._dirtyFlags,d=this._dirtyFlag;d&c.transformDirty&&(this.transform(this.getParentRenderCmd(),!0),this.updateMatrix(this._worldTransform,cc.view._scaleX,cc.view._scaleY),this._dirtyFlag^=this._dirtyFlag&cc.Node._dirtyFlags.transformDirty); d&c.orderDirty&&(this._dirtyFlag^=this._dirtyFlag&c.orderDirty)};b.resize=function(c){c=c||cc.view;var d=this._node,e=cc.eventManager;d._parent&&d._visible?this.updateMatrix(this._worldTransform,c._scaleX,c._scaleY):(c=e._listenersMap[cc.game.EVENT_RESIZE].getFixedPriorityListeners(),e._removeListenerInVector(c,this._listener),this._listener=null)};b.updateMatrix=function(c,d,e){var f=this._node;if(a.devicePixelRatio){var g=cc.view.getDevicePixelRatio();d/=g;e/=g}if(!1!==this._loaded){var h=cc.game.container.style; g=parseInt(h.paddingLeft);h=parseInt(h.paddingBottom);var k=f._contentSize.width,m=f._contentSize.height;c="matrix("+c.a*d+","+c.b+","+c.c+","+c.d*e+","+(g+c.tx*d-k/2+k*f._scaleX/2*d)+","+-(h+c.ty*e-m/2+m*f._scaleY/2*e)+")";this._div.style.transform=c;this._div.style["-webkit-transform"]=c}};b.initStyle=function(){if(this._div){var c=this._div;c.style.position="absolute";c.style.bottom="0px";c.style.left="0px"}};b.updateURL=function(c){var d=this._iframe;d.src=c;var e=this,f=function(){e._loaded= !0;d.removeEventListener("load",f)};d.addEventListener("load",f)};b.changeSize=function(c,d){var e=this._div;e&&(e.style.width=c+"px",e.style.height=d+"px")};b.removeDom=function(){var c=this._div;c&&("contains"in cc.container?cc.container.contains(c):cc.container.compareDocumentPosition(c)%16)&&cc.container.removeChild(c)}})(ccui.WebView._polyfill);ccui.ScrollViewBar=ccui.ProtectedNode.extend({_parentScroll:null,_direction:null,_upperHalfCircle:null,_lowerHalfCircle:null,_body:null,_opacity:255,_marginFromBoundary:0,_marginForLength:0,_touching:!1,_autoHideEnabled:!0,autoHideTime:0,_autoHideRemainingTime:0,_className:"ScrollViewBar",ctor:function(a,b){cc.ProtectedNode.prototype.ctor.call(this);this._direction=b;this._parentScroll=a;this._marginForLength=this._marginFromBoundary=ccui.ScrollViewBar.DEFAULT_MARGIN;this.opacity=255*ccui.ScrollViewBar.DEFAULT_SCROLLBAR_OPACITY; this.autoHideTime=ccui.ScrollViewBar.DEFAULT_AUTO_HIDE_TIME;this._autoHideEnabled=!0;ccui.ScrollViewBar.prototype.init.call(this);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0)},init:function(){this._upperHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY);this._upperHalfCircle.setAnchorPoint(cc.p(.5,0));this._lowerHalfCircle=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.HALF_CIRCLE_IMAGE,ccui.ScrollViewBar.HALF_CIRCLE_IMAGE_KEY); this._lowerHalfCircle.setAnchorPoint(cc.p(.5,0));this._lowerHalfCircle.setScaleY(-1);this.addProtectedChild(this._upperHalfCircle);this.addProtectedChild(this._lowerHalfCircle);this._body=ccui.helper._createSpriteFromBase64(ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT,ccui.ScrollViewBar.BODY_IMAGE_1_PIXEL_HEIGHT_KEY);this._body.setAnchorPoint(cc.p(.5,0));this.addProtectedChild(this._body);this.setColor(ccui.ScrollViewBar.DEFAULT_COLOR);this.onScrolled(cc.p(0,0));cc.ProtectedNode.prototype.setOpacity.call(this, 0);this._autoHideRemainingTime=0;this._direction===ccui.ScrollView.DIR_HORIZONTAL&&this.setRotation(90)},setPositionFromCorner:function(a){this._direction===ccui.ScrollView.DIR_VERTICAL?(this._marginForLength=a.y,this._marginFromBoundary=a.x):(this._marginForLength=a.x,this._marginFromBoundary=a.y)},onEnter:function(){cc.ProtectedNode.prototype.onEnter.call(this);this.scheduleUpdate()},getPositionFromCorner:function(){return this._direction===ccui.ScrollView.DIR_VERTICAL?cc.p(this._marginFromBoundary, this._marginForLength):cc.p(this._marginForLength,this._marginFromBoundary)},setWidth:function(a){a/=this._body.width;this._body.setScaleX(a);this._upperHalfCircle.setScale(a);this._lowerHalfCircle.setScale(-a)},getWidth:function(){return this._body.getBoundingBox().width},setAutoHideEnabled:function(a){this._autoHideEnabled=a;!this._autoHideEnabled&&!this._touching&&0>=this._autoHideRemainingTime?cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity):cc.ProtectedNode.prototype.setOpacity.call(this, 0)},isAutoHideEnabled:function(){return this._autoHideEnabled},setOpacity:function(a){this._opacity=a},getOpacity:function(){return this._opacity},_updateLength:function(a){var b=a/this._body.getTextureRect().height;this._body.setScaleY(b);this._upperHalfCircle.setPositionY(this._body.getPositionY()+a)},_processAutoHide:function(a){!this._autoHideEnabled||0>=this._autoHideRemainingTime||this._touching||(this._autoHideRemainingTime-=a,this._autoHideRemainingTime<=this.autoHideTime&&(this._autoHideRemainingTime= Math.max(0,this._autoHideRemainingTime),cc.ProtectedNode.prototype.setOpacity.call(this,this._autoHideRemainingTime/this.autoHideTime*this._opacity)))},update:function(a){this._processAutoHide(a)},onTouchBegan:function(){this._autoHideEnabled&&(this._touching=!0)},onTouchEnded:function(){this._autoHideEnabled&&(this._touching=!1,0>=this._autoHideRemainingTime||(this._autoHideRemainingTime=this.autoHideTime))},onScrolled:function(a){this._autoHideEnabled&&(this._autoHideRemainingTime=this.autoHideTime, cc.ProtectedNode.prototype.setOpacity.call(this,this.opacity));var b=this._parentScroll.getInnerContainer(),c=0,d=0,e=0,f=0;this._direction===ccui.ScrollView.DIR_VERTICAL?(c=b.height,d=this._parentScroll.height,e=a.y,f=-b.getPositionY()):this._direction===ccui.ScrollView.DIR_HORIZONTAL&&(c=b.width,d=this._parentScroll.width,e=a.x,f=-b.getPositionX());a=this._calculateLength(c,d,e);c=this._calculatePosition(c,d,f,e,a);this._updateLength(a);this.setPosition(c)},_calculateLength:function(a,b,c){0!== c&&(a+=20*(0=d.height-e.y||f+c.height<=-e.y||(g=b.x-a.x*c.width)>=d.width-e.x||g+c.width<=-e.x?!1:!0},updateChildren:function(){var a, b=this._innerContainer._children;var c=0;for(a=b.length;cthis._leftBoundary?b.x=this._leftBoundary-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.xthis._bottomBoundary&&(b.y=this._bottomBoundary-(this._innerContainer.getBottomBoundary()+a.y));0===a.x&&0===a.y&&(this._outOfBoundaryAmount=b,this._outOfBoundaryAmountDirty=!1);return b},_isOutOfBoundary:function(a){var b=this._getHowMuchOutOfBoundary();if(void 0!==a)switch(a){case ccui.ScrollView.MOVEDIR_TOP:return 0b.y;case ccui.ScrollView.MOVEDIR_LEFT:return 0> b.x;case ccui.ScrollView.MOVEDIR_RIGHT:return 0=this._touchTotalTimeThreshold)return cc.p(0,0);var c=cc.p(0,0);for(b=0;b=Math.abs(a.x)&&1E-4>=Math.abs(a.y)},_processAutoScrolling:function(a){var b=this._isNecessaryAutoScrollBrake()?.05:1;this._autoScrollAccumulatedTime+=1/b*a;var c=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(--c,c=c*c*c*c*c+1);a=cc.pAdd(this._autoScrollStartPosition, cc.pMult(this._autoScrollTargetDelta,c));c=Math.abs(c-1)<=this._getAutoScrollStopEpsilon();this.bounceEnabled?a=cc.pAdd(this._autoScrollBrakingStartPosition,cc.pMult(cc.pSub(a,this._autoScrollBrakingStartPosition),b)):(b=cc.pSub(a,this.getInnerContainerPosition()),b=this._getHowMuchOutOfBoundary(b),this._fltEqualZero(b)||(a.x+=b.x,a.y+=b.y,c=!0));c&&(this._autoScrolling=!1,this._dispatchEvent(ccui.ScrollView.EVENT_AUTOSCROLL_ENDED));this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()), c)},_jumpToDestination:function(a,b){void 0===a.x&&(a=cc.p(a,b));this._autoScrolling=!1;this._moveInnerContainer(cc.pSub(a,this.getInnerContainerPosition()),!0)},_scrollChildren:function(a){if(this.bounceEnabled){var b=this._getHowMuchOutOfBoundary();a.x*=0==b.x?1:.5;a.y*=0==b.y?1:.5}this.bounceEnabled||(b=this._getHowMuchOutOfBoundary(a),a.x+=b.x,a.y+=b.y);var c=b=!1,d=!1,e=!1;0=this._bottomBoundary&&(e=!0):0>a.y&&this._innerContainer.getTopBoundary()+ a.y<=this._topBoundary&&(d=!0);0>a.x?this._innerContainer.getRightBoundary()+a.x<=this._rightBoundary&&(c=!0):0=this._leftBoundary&&(b=!0);this._moveInnerContainer(a,!1);0==a.x&&0==a.y||this._processScrollingEvent();e&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_BOTTOM,!1);d&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_TOP,!1);b&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_LEFT,!1);c&&this._processScrollEvent(ccui.ScrollView.MOVEDIR_RIGHT, !1)},scrollToBottom:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),0),a,b)},scrollToTop:function(a,b){this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToLeft:function(a,b){this._startAutoScrollToDestination(cc.p(0,this._innerContainer.getPositionY()),a,b)},scrollToRight:function(a,b){this._startAutoScrollToDestination(cc.p(this._contentSize.width- this._innerContainer.getContentSize().width,this._innerContainer.getPositionY()),a,b)},scrollToTopLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,this._contentSize.height-this._innerContainer.getContentSize().height),a,b)},scrollToTopRight:function(a,b){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll direction is not both!");else{var c=this._innerContainer.getContentSize();this._startAutoScrollToDestination(cc.p(this._contentSize.width- c.width,this._contentSize.height-c.height),a,b)}},scrollToBottomLeft:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(0,0),a,b)},scrollToBottomRight:function(a,b){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll direction is not both!"):this._startAutoScrollToDestination(cc.p(this._contentSize.width-this._innerContainer.getContentSize().width,0),a,b)},scrollToPercentVertical:function(a,b,c){var d=this._contentSize.height- this._innerContainer.getContentSize().height,e=-d;this._startAutoScrollToDestination(cc.p(this._innerContainer.getPositionX(),d+a*e/100),b,c)},scrollToPercentHorizontal:function(a,b,c){var d=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a*d/100),this._innerContainer.getPositionY()),b,c)},scrollToPercentBothDirection:function(a,b,c){if(this._direction===ccui.ScrollView.DIR_BOTH){var d=this._contentSize.height-this._innerContainer.getContentSize().height, e=-d,f=this._innerContainer.getContentSize().width-this._contentSize.width;this._startAutoScrollToDestination(cc.p(-(a.x*f/100),d+a.y*e/100),b,c)}},jumpToBottom:function(){this._jumpToDestination(this._innerContainer.getPositionX(),0)},jumpToTop:function(){this._jumpToDestination(this._innerContainer.getPositionX(),this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToLeft:function(){this._jumpToDestination(0,this._innerContainer.getPositionY())},jumpToRight:function(){this._jumpToDestination(this._contentSize.width- this._innerContainer.getContentSize().width,this._innerContainer.getPositionY())},jumpToTopLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,this._contentSize.height-this._innerContainer.getContentSize().height)},jumpToTopRight:function(){if(this._direction!==ccui.ScrollView.DIR_BOTH)cc.log("Scroll _direction is not both!");else{var a=this._innerContainer.getContentSize();this._jumpToDestination(this._contentSize.width-a.width, this._contentSize.height-a.height)}},jumpToBottomLeft:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(0,0)},jumpToBottomRight:function(){this._direction!==ccui.ScrollView.DIR_BOTH?cc.log("Scroll _direction is not both!"):this._jumpToDestination(this._contentSize.width-this._innerContainer.getContentSize().width,0)},jumpToPercentVertical:function(a){var b=this._contentSize.height-this._innerContainer.getContentSize().height,c=-b; this._jumpToDestination(this._innerContainer.getPositionX(),b+a*c/100)},jumpToPercentHorizontal:function(a){var b=this._innerContainer.getContentSize().width-this._contentSize.width;this._jumpToDestination(-(a*b/100),this._innerContainer.getPositionY())},jumpToPercentBothDirection:function(a){if(this._direction===ccui.ScrollView.DIR_BOTH){var b=this._innerContainer.getContentSize(),c=this._contentSize.height-b.height;this._jumpToDestination(-(a.x*(b.width-this._contentSize.width)/100),c+a.y*-c/100)}}, _gatherTouchMove:function(a){for(;5<=this._touchMoveDisplacements.length;)this._touchMoveDisplacements.splice(0,1),this._touchMoveTimeDeltas.splice(0,1);this._touchMoveDisplacements.push(a);a=(new Date).getTime();this._touchMoveTimeDeltas.push((a-this._touchMovePreviousTimestamp)/1E3);this._touchMovePreviousTimestamp=a},_handlePressLogic:function(a){this._bePressed=!0;this._autoScrolling=!1;this._touchMovePreviousTimestamp=(new Date).getTime();this._touchMoveDisplacements.length=0;this._touchMoveTimeDeltas.length= 0;if(this._verticalScrollBar)this._verticalScrollBar.onTouchBegan();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchBegan()},_handleMoveLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._scrollChildren(b);this._gatherTouchMove(b)},_handleReleaseLogic:function(a){var b=this.convertToNodeSpace(a.getLocation());a=this.convertToNodeSpace(a.getPreviousLocation());b=cc.pSub(b,a);this._gatherTouchMove(b); this._bePressed=!1;!this._startBounceBackIfNeeded()&&this.inertiaScrollEnabled&&(b=this._calculateTouchMoveVelocity(),0===b.x&&0===b.y||this._startInertiaScroll(b));if(this._verticalScrollBar)this._verticalScrollBar.onTouchEnded();if(this._horizontalScrollBar)this._horizontalScrollBar.onTouchEnded()},onTouchBegan:function(a,b){b=ccui.Layout.prototype.onTouchBegan.call(this,a,b);this._isInterceptTouch||this._hit&&this._handlePressLogic(a);return b},onTouchMoved:function(a,b){ccui.Layout.prototype.onTouchMoved.call(this, a,b);this._isInterceptTouch||this._handleMoveLogic(a)},onTouchEnded:function(a,b){ccui.Layout.prototype.onTouchEnded.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},onTouchCancelled:function(a,b){ccui.Layout.prototype.onTouchCancelled.call(this,a,b);this._isInterceptTouch||this._handleReleaseLogic(a);this._isInterceptTouch=!1},update:function(a){this._autoScrolling&&this._processAutoScrolling(a)},interceptTouchEvent:function(a,b,c){if(!this._touchEnabled)ccui.Layout.prototype.interceptTouchEvent.call(this, a,b,c);else if(this._direction!==ccui.ScrollView.DIR_NONE){var d=c.getLocation();switch(a){case ccui.Widget.TOUCH_BEGAN:this._isInterceptTouch=!0;this._touchBeganPosition.x=d.x;this._touchBeganPosition.y=d.y;this._handlePressLogic(c);break;case ccui.Widget.TOUCH_MOVED:a=cc.pLength(cc.pSub(b.getTouchBeganPosition(),d));this._touchMovePosition.x=d.x;this._touchMovePosition.y=d.y;a>this._childFocusCancelOffset&&(b.setHighlighted(!1),this._handleMoveLogic(c));break;case ccui.Widget.TOUCH_CANCELED:case ccui.Widget.TOUCH_ENDED:this._touchEndPosition.x= d.x,this._touchEndPosition.y=d.y,this._handleReleaseLogic(c),b.isSwallowTouches()&&(this._isInterceptTouch=!1)}}},_processScrollEvent:function(a,b){var c=0;switch(a){case ccui.ScrollView.MOVEDIR_TOP:c=b?ccui.ScrollView.EVENT_BOUNCE_TOP:ccui.ScrollView.EVENT_SCROLL_TO_TOP;break;case ccui.ScrollView.MOVEDIR_BOTTOM:c=b?ccui.ScrollView.EVENT_BOUNCE_BOTTOM:ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM;break;case ccui.ScrollView.MOVEDIR_LEFT:c=b?ccui.ScrollView.EVENT_BOUNCE_LEFT:ccui.ScrollView.EVENT_SCROLL_TO_LEFT; break;case ccui.ScrollView.MOVEDIR_RIGHT:c=b?ccui.ScrollView.EVENT_BOUNCE_RIGHT:ccui.ScrollView.EVENT_SCROLL_TO_RIGHT}this._dispatchEvent(c)},_processScrollingEvent:function(){this._dispatchEvent(ccui.ScrollView.EVENT_SCROLLING)},_dispatchEvent:function(a){this._scrollViewEventSelector&&(this._scrollViewEventListener?this._scrollViewEventSelector.call(this._scrollViewEventListener,this,a):this._scrollViewEventSelector(this,a));this._ccEventCallback&&this._ccEventCallback(this,a)},addEventListenerScrollView:function(a, b){this._scrollViewEventSelector=a;this._scrollViewEventListener=b},addEventListener:function(a){this._ccEventCallback=a},setDirection:function(a){this._direction=a;this._scrollBarEnabled&&(this._removeScrollBar(),this._initScrollBar())},getDirection:function(){return this._direction},setBounceEnabled:function(a){this.bounceEnabled=a},isBounceEnabled:function(){return this.bounceEnabled},setInertiaScrollEnabled:function(a){this.inertiaScrollEnabled=a},isInertiaScrollEnabled:function(){return this.inertiaScrollEnabled}, setScrollBarEnabled:function(a){this._scrollBarEnabled!==a&&(this._scrollBarEnabled&&this._removeScrollBar(),(this._scrollBarEnabled=a)&&this._initScrollBar())},isScrollBarEnabled:function(){return this._scrollBarEnabled},setScrollBarPositionFromCorner:function(a){this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a);this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a)},setScrollBarPositionFromCornerForVertical:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");this._verticalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForVertical:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_HORIZONTAL,"Scroll view doesn't have a vertical scroll bar!");return this._verticalScrollBar.getPositionFromCorner()},setScrollBarPositionFromCornerForHorizontal:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");this._horizontalScrollBar.setPositionFromCorner(a)},getScrollBarPositionFromCornerForHorizontal:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");cc.assert(this._direction!==ccui.ScrollView.DIR_VERTICAL,"Scroll view doesn't have a horizontal scroll bar!");return this._horizontalScrollBar.getPositionFromCorner()},setScrollBarWidth:function(a){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.setWidth(a);this._horizontalScrollBar&&this._horizontalScrollBar.setWidth(a)},getScrollBarWidth:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.getWidth():this._horizontalScrollBar?this._horizontalScrollBar.getWidth():0},setScrollBarColor:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&& this._verticalScrollBar.setColor(a);this._horizontalScrollBar&&this._horizontalScrollBar.setColor(a)},getScrollBarColor:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&this._verticalScrollBar.getColor();this._horizontalScrollBar&&this._horizontalScrollBar.getColor();return cc.color.WHITE},setScrollBarOpacity:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.opacity=a); this._horizontalScrollBar&&(this._horizontalScrollBar.opacity=a)},getScrollBarOpacity:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.opacity:this._horizontalScrollBar?this._horizontalScrollBar.opacity:-1},setScrollBarAutoHideEnabled:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideEnabled=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideEnabled= a)},isScrollBarAutoHideEnabled:function(){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideEnabled:this._horizontalScrollBar?this._horizontalScrollBar.autoHideEnabled:!1},setScrollBarAutoHideTime:function(a){cc.assert(this._scrollBarEnabled,"Scroll bar should be enabled!");this._verticalScrollBar&&(this._verticalScrollBar.autoHideTime=a);this._horizontalScrollBar&&(this._horizontalScrollBar.autoHideTime=a)},getScrollBarAutoHideTime:function(){cc.assert(this._scrollBarEnabled, "Scroll bar should be enabled!");return this._verticalScrollBar?this._verticalScrollBar.autoHideTime:this._horizontalScrollBar?this._horizontalScrollBar.autoHideTime:0},getInnerContainer:function(){return this._innerContainer},setLayoutType:function(a){this._innerContainer.setLayoutType(a)},getLayoutType:function(){return this._innerContainer.getLayoutType()},_doLayout:function(){this._doLayoutDirty&&(this._doLayoutDirty=!1)},getDescription:function(){return"ScrollView"},_createCloneInstance:function(){return new ccui.ScrollView}, _copyClonedWidgetChildren:function(a){ccui.Layout.prototype._copyClonedWidgetChildren.call(this,a)},_copySpecialProperties:function(a){a instanceof ccui.ScrollView&&(ccui.Layout.prototype._copySpecialProperties.call(this,a),this.setInnerContainerSize(a.getInnerContainerSize()),this.setInnerContainerPosition(a.getInnerContainerPosition()),this.setDirection(a._direction),this._topBoundary=a._topBoundary,this._bottomBoundary=a._bottomBoundary,this._leftBoundary=a._leftBoundary,this._rightBoundary=a._rightBoundary, this._bePressed=a._bePressed,this._childFocusCancelOffset=a._childFocusCancelOffset,this._touchMoveDisplacements=a._touchMoveDisplacements,this._touchMoveTimeDeltas=a._touchMoveTimeDeltas,this._touchMovePreviousTimestamp=a._touchMovePreviousTimestamp,this._autoScrolling=a._autoScrolling,this._autoScrollAttenuate=a._autoScrollAttenuate,this._autoScrollStartPosition=a._autoScrollStartPosition,this._autoScrollTargetDelta=a._autoScrollTargetDelta,this._autoScrollTotalTime=a._autoScrollTotalTime,this._autoScrollAccumulatedTime= a._autoScrollAccumulatedTime,this._autoScrollCurrentlyOutOfBoundary=a._autoScrollCurrentlyOutOfBoundary,this._autoScrollBraking=a._autoScrollBraking,this._autoScrollBrakingStartPosition=a._autoScrollBrakingStartPosition,this.setBounceEnabled(a.bounceEnabled),this.setInertiaScrollEnabled(a.inertiaScrollEnabled),this._scrollViewEventListener=a._scrollViewEventListener,this._scrollViewEventSelector=a._scrollViewEventSelector,this._ccEventCallback=a._ccEventCallback,this.setScrollBarEnabled(a.isScrollBarEnabled()), this.isScrollBarEnabled()&&(this._direction!==ccui.ScrollView.DIR_HORIZONTAL&&this.setScrollBarPositionFromCornerForVertical(a.getScrollBarPositionFromCornerForVertical()),this._direction!==ccui.ScrollView.DIR_VERTICAL&&this.setScrollBarPositionFromCornerForHorizontal(a.getScrollBarPositionFromCornerForHorizontal()),this.setScrollBarWidth(a.getScrollBarWidth()),this.setScrollBarColor(a.getScrollBarColor()),this.setScrollBarAutoHideEnabled(a.isScrollBarAutoHideEnabled()),this.setScrollBarAutoHideTime(a.getScrollBarAutoHideTime())))}, _initScrollBar:function(){this._direction===ccui.ScrollView.DIR_HORIZONTAL||this._verticalScrollBar||(this._verticalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_VERTICAL),this.addProtectedChild(this._verticalScrollBar,2));this._direction===ccui.ScrollView.DIR_VERTICAL||this._horizontalScrollBar||(this._horizontalScrollBar=new ccui.ScrollViewBar(this,ccui.ScrollView.DIR_HORIZONTAL),this.addProtectedChild(this._horizontalScrollBar,2))},_removeScrollBar:function(){this._verticalScrollBar&& (this.removeProtectedChild(this._verticalScrollBar),this._verticalScrollBar=null);this._horizontalScrollBar&&(this.removeProtectedChild(this._horizontalScrollBar),this._horizontalScrollBar=null)},getNodeByTag:function(a){return this._innerContainer.getNodeByTag(a)},getNodes:function(){return this._innerContainer.getNodes()},removeNode:function(a){this._innerContainer.removeNode(a)},removeNodeByTag:function(a){this._innerContainer.removeNodeByTag(a)},removeAllNodes:function(){this._innerContainer.removeAllNodes()}, addNode:function(a,b,c){this._innerContainer.addNode(a,b,c)}});ccui.ScrollView.prototype.innerWidth;cc.defineGetterSetter(ccui.ScrollView.prototype,"innerWidth",ccui.ScrollView.prototype._getInnerWidth,ccui.ScrollView.prototype._setInnerWidth);ccui.ScrollView.prototype.innerHeight;cc.defineGetterSetter(ccui.ScrollView.prototype,"innerHeight",ccui.ScrollView.prototype._getInnerHeight,ccui.ScrollView.prototype._setInnerHeight);ccui.ScrollView.prototype.direction; cc.defineGetterSetter(ccui.ScrollView.prototype,"direction",ccui.ScrollView.prototype.getDirection,ccui.ScrollView.prototype.setDirection);ccui.ScrollView.prototype.touchTotalTimeThreshold;cc.defineGetterSetter(ccui.ScrollView.prototype,"touchTotalTimeThreshold",ccui.ScrollView.prototype.getTouchTotalTimeThreshold,ccui.ScrollView.prototype.setTouchTotalTimeThreshold);ccui.ScrollView.create=function(){return new ccui.ScrollView};ccui.ScrollView.DIR_NONE=0;ccui.ScrollView.DIR_VERTICAL=1; ccui.ScrollView.DIR_HORIZONTAL=2;ccui.ScrollView.DIR_BOTH=3;ccui.ScrollView.EVENT_SCROLL_TO_TOP=0;ccui.ScrollView.EVENT_SCROLL_TO_BOTTOM=1;ccui.ScrollView.EVENT_SCROLL_TO_LEFT=2;ccui.ScrollView.EVENT_SCROLL_TO_RIGHT=3;ccui.ScrollView.EVENT_SCROLLING=4;ccui.ScrollView.EVENT_BOUNCE_TOP=5;ccui.ScrollView.EVENT_BOUNCE_BOTTOM=6;ccui.ScrollView.EVENT_BOUNCE_LEFT=7;ccui.ScrollView.EVENT_BOUNCE_RIGHT=8;ccui.ScrollView.EVENT_CONTAINER_MOVED=9;ccui.ScrollView.EVENT_AUTOSCROLL_ENDED=10; ccui.ScrollView.MOVEDIR_TOP=0;ccui.ScrollView.MOVEDIR_BOTTOM=1;ccui.ScrollView.MOVEDIR_LEFT=2;ccui.ScrollView.MOVEDIR_RIGHT=3;ccui.ListView=ccui.ScrollView.extend({_model:null,_items:null,_gravity:null,_itemsMargin:0,_curSelectedIndex:0,_refreshViewDirty:!0,_listViewEventListener:null,_listViewEventSelector:null,_ccListViewEventCallback:null,_magneticAllowedOutOfBoundary:!0,_magneticType:0,_className:"ListView",ctor:function(){this._items=[];ccui.ScrollView.prototype.ctor.call(this);this._gravity=ccui.ListView.GRAVITY_CENTER_VERTICAL;this.setTouchEnabled(!0);this.setDirection(ccui.ScrollView.DIR_VERTICAL)},setItemModel:function(a){a? this._model=a:cc.log("Can't set a null to item model!")},_handleReleaseLogic:function(a){ccui.ScrollView.prototype._handleReleaseLogic.call(this,a);this._autoScrolling||this._startMagneticScroll()},_onItemListChanged:function(){this._outOfBoundaryAmountDirty=!0},_updateInnerContainerSize:function(){var a,b=this._items;switch(this.direction){case ccui.ScrollView.DIR_VERTICAL:var c=b.length;var d=(c-1)*this._itemsMargin;for(a=0;aa||a>=this._items.length? null:this._items[a]},getItems:function(){return this._items},getIndex:function(a){return null==a?-1:this._items.indexOf(a)},setGravity:function(a){this._gravity!==a&&(this._gravity=a,this._refreshViewDirty=!0)},setMagneticType:function(a){this._magneticType=a;this._onItemListChanged();this._startMagneticScroll()},getMagneticType:function(){return this._magneticType},setMagneticAllowedOutOfBoundary:function(a){this._magneticAllowedOutOfBoundary=a},getMagneticAllowedOutOfBoundary:function(){return this._magneticAllowedOutOfBoundary}, setItemsMargin:function(a){this._itemsMargin!==a&&(this._itemsMargin=a,this._refreshViewDirty=!0)},getItemsMargin:function(){return this._itemsMargin},setDirection:function(a){switch(a){case ccui.ScrollView.DIR_VERTICAL:this.setLayoutType(ccui.Layout.LINEAR_VERTICAL);break;case ccui.ScrollView.DIR_HORIZONTAL:this.setLayoutType(ccui.Layout.LINEAR_HORIZONTAL);break;case ccui.ScrollView.DIR_BOTH:return;default:return}ccui.ScrollView.prototype.setDirection.call(this,a)},_getHowMuchOutOfBoundary:function(a){void 0=== a&&(a=cc.p(0,0));if(this._magneticAllowedOutOfBoundary&&0!==this._items.length){if(this._magneticType===ccui.ListView.MAGNETIC_NONE||this._magneticType===ccui.ListView.MAGNETIC_BOTH_END)return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);if(0===a.x&&0===a.y&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount}else return ccui.ScrollView.prototype._getHowMuchOutOfBoundary.call(this,a);var b=this._leftBoundary,c=this._rightBoundary,d=this._topBoundary,e=this._bottomBoundary, f=this._items.length-1,g=this.getContentSize(),h=cc.p(0,0),k=cc.p(0,0);switch(this._magneticType){case ccui.ListView.MAGNETIC_CENTER:h.x=(g.width-this._items[0].width)/2;h.y=(g.height-this._items[0].height)/2;k.x=(g.width-this._items[f].width)/2;k.y=(g.height-this._items[f].height)/2;break;case ccui.ListView.MAGNETIC_LEFT:case ccui.ListView.MAGNETIC_TOP:k.x=g.width-this._items[f].width;k.y=g.height-this._items[f].height;break;case ccui.ListView.MAGNETIC_RIGHT:case ccui.ListView.MAGNETIC_BOTTOM:h.x= g.width-this._items[0].width,h.y=g.height-this._items[0].height}b+=h.x;c-=k.x;d-=h.y;e+=k.y;f=cc.p(0,0);this._innerContainer.getLeftBoundary()+a.x>b?f.x=b-(this._innerContainer.getLeftBoundary()+a.x):this._innerContainer.getRightBoundary()+a.xe&&(f.y=e-(this._innerContainer.getBottomBoundary()+a.y));0=== a.x&&0===a.y&&(this._outOfBoundaryAmount=f,this._outOfBoundaryAmountDirty=!1);return f},_calculateItemPositionWithAnchor:function(a,b){var c=cc.p(a.getLeftBoundary(),a.getBottomBoundary());a=a.getContentSize();return cc.p(c.x+a.width*b.x,c.y+a.height*b.y)},_findClosestItem:function(a,b,c,d,e,f,g){cc.assert(0<=d&&f=this._items.length))if(a= this._flattenVectorByDirection(this._calculateTouchMoveVelocity()),500>cc.pLength(a))this._startMagneticScroll();else{var b=this.getItem(this._curPageIdx);b=this._calculateItemDestination(cc.p(.5,.5),b,cc.p(.5,.5));b=cc.pSub(b,this.getInnerContainerPosition());b=this._flattenVectorByDirection(b);0a.x||0a;)this._decreaseNumberOfPages();this._rearrange();this._currentIndexNode.setVisible(0< this._indexNodes.length)},indicate:function(a){0>a||a>=this._indexNodes.length||this._currentIndexNode.setPosition(this._indexNodes[a].getPosition())},_rearrange:function(){if(0!==this._indexNodes.length){var a=this._direction===ccui.ScrollView.DIR_HORIZONTAL,b=this._indexNodes[0].getContentSize(),c=a?b.width:b.height,d=this._indexNodes.length;d=-((c*d+this._spaceBetweenIndexNodes*(d-1))/2)+c/2;for(var e=0;e>1;a|=a>>2;a|=a>>4;a|=a>>8;return(a|a>>16)+1}; cc.RenderTexture=cc.Node.extend({sprite:null,clearFlags:0,clearDepthVal:0,autoDraw:!1,_texture:null,_pixelFormat:0,clearStencilVal:0,_clearColor:null,_className:"RenderTexture",ctor:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._cascadeOpacityEnabled=this._cascadeColorEnabled=!0;this._pixelFormat=cc.Texture2D.PIXEL_FORMAT_RGBA8888;this._clearColor=new cc.Color(0,0,0,255);void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.initWithWidthAndHeight(a,b,c,d||0));this.setAnchorPoint(0, 0)},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.RenderTexture.CanvasRenderCmd(this):new cc.RenderTexture.WebGLRenderCmd(this)},visit:function(a){var b=this._renderCmd;a=a?a._renderCmd:null;if(this._visible){var c=cc.renderer;b.visit(a);c.pushRenderCommand(b);this.sprite.visit(this);b._dirtyFlag=0}else b._propagateFlagsDown(a)},cleanup:function(){cc.Node.prototype.onExit.call(this);this._renderCmd.cleanup()},getSprite:function(){return this.sprite},setSprite:function(a){this.sprite= a},setVirtualViewport:function(a,b,c){this._renderCmd.setVirtualViewport(a,b,c)},initWithWidthAndHeight:function(a,b,c,d){return this._renderCmd.initWithWidthAndHeight(a,b,c,d)},begin:function(){cc.renderer._turnToCacheMode(this.__instanceId);this._renderCmd.begin()},beginWithClear:function(a,b,c,d,e,f){var g=cc._renderContext;e=e||g.COLOR_BUFFER_BIT;f=f||g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT;this._beginWithClear(a,b,c,d,e,f,g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT|g.STENCIL_BUFFER_BIT)},_beginWithClear:function(a, b,c,d,e,f,g){this.begin();this._renderCmd._beginWithClear(a,b,c,d,e,f,g)},end:function(){this._renderCmd.end()},clear:function(a,b,c,d){this.beginWithClear(a,b,c,d);this.end()},clearRect:function(a,b,c,d){this._renderCmd.clearRect(a,b,c,d)},clearDepth:function(a){this._renderCmd.clearDepth(a)},clearStencil:function(a){this._renderCmd.clearStencil(a)},getClearFlags:function(){return this.clearFlags},setClearFlags:function(a){this.clearFlags=a},getClearColor:function(){return this._clearColor},setClearColor:function(a){var b= this._clearColor;b.r=a.r;b.g=a.g;b.b=a.b;b.a=a.a;this._renderCmd.updateClearColor(a)},getClearDepth:function(){return this.clearDepthVal},setClearDepth:function(a){this.clearDepthVal=a},getClearStencil:function(){return this.clearStencilVal},setClearStencil:function(a){this.clearStencilVal=a},isAutoDraw:function(){return this.autoDraw},setAutoDraw:function(a){this.autoDraw=a},saveToFile:function(a,b){cc.log("saveToFile isn't supported on Cocos2d-Html5")},newCCImage:function(a){cc.log("saveToFile isn't supported on cocos2d-html5"); return null},listenToBackground:function(a){},listenToForeground:function(a){}});cc.RenderTexture.prototype.clearColorVal;cc.defineGetterSetter(cc.RenderTexture.prototype,"clearColorVal",cc.RenderTexture.prototype.getClearColor,cc.RenderTexture.prototype.setClearColor);cc.RenderTexture.create=function(a,b,c,d){return new cc.RenderTexture(a,b,c,d)};(function(){cc.RenderTexture.CanvasRenderCmd=function(b){this._rootCtor(b);this._needDraw=!1;this._clearColorStr="rgba(255,255,255,1)";this._cacheCanvas=document.createElement("canvas");this._cacheContext=new cc.CanvasContextWrapper(this._cacheCanvas.getContext("2d"))};var a=cc.RenderTexture.CanvasRenderCmd.prototype=Object.create(cc.Node.CanvasRenderCmd.prototype);a.constructor=cc.RenderTexture.CanvasRenderCmd;a.cleanup=function(){this._cacheCanvas=this._cacheContext=null};a.clearStencil=function(b){}; a.setVirtualViewport=function(b,c,d){};a.updateClearColor=function(b){this._clearColorStr="rgba("+(0|b.r)+","+(0|b.g)+","+(0|b.b)+","+b.a/255+")"};a.initWithWidthAndHeight=function(b,c,d,e){d=this._node;e=this._cacheCanvas;var f=cc.contentScaleFactor();e.width=0|b*f;e.height=0|c*f;b=new cc.Texture2D;b.initWithElement(e);b.handleLoadedTexture();b=d.sprite=new cc.Sprite(b);b.setBlendFunc(cc.ONE,cc.ONE_MINUS_SRC_ALPHA);d.autoDraw=!1;d.addChild(b);return!0};a.begin=function(){};a._beginWithClear=function(b, c,d,e,f,g,h){b=b||0;c=c||0;d=d||0;e=isNaN(e)?255:e;f=this._cacheContext.getContext();g=this._cacheCanvas;f.setTransform(1,0,0,1,0,0);this._cacheContext.setFillStyle("rgba("+(0|b)+","+(0|c)+","+(0|d)+","+e/255+")");f.clearRect(0,0,g.width,g.height);f.fillRect(0,0,g.width,g.height)};a.end=function(){var b=this._node,c=cc.contentScaleFactor();cc.renderer._renderingToCacheCanvas(this._cacheContext,b.__instanceId,c,c);b=b.sprite._renderCmd;b._notifyRegionStatus&&b._notifyRegionStatus(cc.Node.CanvasRenderCmd.RegionStatus.Dirty)}; a.clearRect=function(b,c,d,e){this._cacheContext.clearRect(b,c,d,-e)};a.clearDepth=function(b){cc.log("clearDepth isn't supported on Cocos2d-Html5")}})();(function(){cc.RenderTexture.WebGLRenderCmd=function(b){this._rootCtor(b);this._needDraw=!0;this._depthRenderBuffer=this._textureCopy=this._oldFBO=this._fBO=null;this._rtTextureRect=new cc.Rect;this._fullRect=new cc.Rect;this._fullViewport=new cc.Rect};var a=cc.RenderTexture.WebGLRenderCmd.prototype=Object.create(cc.Node.WebGLRenderCmd.prototype);a.constructor=cc.RenderTexture.WebGLRenderCmd;a.setVirtualViewport=function(b,c,d){this._rtTextureRect.x=b.x;this._rtTextureRect.y=b.y;this._fullRect=c; this._fullViewport=d};a.needDraw=function(){return this._needDraw&&this._node.autoDraw};a.rendering=function(b){var c=b||cc._renderContext;b=this._node;if(b.autoDraw){b.begin();var d=b.clearFlags;if(d){var e=[0,0,0,0],f=0,g=0;d&c.COLOR_BUFFER_BIT&&(e=c.getParameter(c.COLOR_CLEAR_VALUE),c.clearColor(b._clearColor.r/255,b._clearColor.g/255,b._clearColor.b/255,b._clearColor.a/255));d&c.DEPTH_BUFFER_BIT&&(f=c.getParameter(c.DEPTH_CLEAR_VALUE),c.clearDepth(b.clearDepthVal));d&c.STENCIL_BUFFER_BIT&&(g= c.getParameter(c.STENCIL_CLEAR_VALUE),c.clearStencil(b.clearStencilVal));c.clear(d);d&c.COLOR_BUFFER_BIT&&c.clearColor(e[0],e[1],e[2],e[3]);d&c.DEPTH_BUFFER_BIT&&c.clearDepth(f);d&c.STENCIL_BUFFER_BIT&&c.clearStencil(g)}b.sortAllChildren();c=b._children;for(d=0;d=d-k.x&&(h=d-g.width),d=k.y-g.height/2,.5=e-k.y&&(d=e-g.height),b.x=0,e=1,c._flippedX&&(b.x-=g.width,e=-1),0c;c++)this._vertexData[c]=new cc.V3F_C4B_T2F(null,null,null,this._vertexArrayBuffer,c*b);gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexWebGLBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._float32View, gl.DYNAMIC_DRAW);this._vertexDataCount=0;this._vertexDataDirty=!0;this._shaderProgram=cc.shaderCache.programForKey(cc.SHADER_SPRITE_POSITION_TEXTURECOLOR)}};a.resetVertexData=function(){this._vertexDataCount=0};a._updateProgressData=function(){var b=this._node._type;b===cc.ProgressTimer.TYPE_RADIAL?this._updateRadial():b===cc.ProgressTimer.TYPE_BAR&&this._updateBar();this._vertexDataDirty=!0};a._updateProgress=function(){this.setDirtyFlag(cc.Node._dirtyFlags.textureDirty)};a._updateBar=function(){var b= this._node;if(b._sprite){var c=b._percentage/100,d=b._barChangeRate;d=cc.pMult(cc.p(1-d.x+c*d.x,1-d.y+c*d.y),.5);c=cc.pSub(b._midPoint,d);b=cc.pAdd(b._midPoint,d);0>c.x&&(b.x+=-c.x,c.x=0);1c.y&&(b.y+=-c.y,c.y=0);1=l.x)&&0<=l.y&&l.y>7-(b<<1)&1,c>>7-((b<<1)+1)&1):cc.p(c>>(b<<1)+1&1,c>>(b<<1)&1)}return cc.p(0,0)};a._textureCoordFromAlphaPoint=function(b,c,d){var e=this._node._sprite;if(e){var f=e._renderCmd._vertices,g=f[1];f=f[2];g=cc.p(g.u,g.v);f=cc.p(f.u,f.v);e.textureRectRotated&&(e=c,c=d,d=e);b.u=g.x*(1-c)+f.x*c;b.v=g.y*(1-d)+f.y*d}else b.u=0,b.v=0};a._vertexFromAlphaPoint=function(b,c,d){b.x=this._bl.x*(1-c)+this._tr.x*c;b.y=this._bl.y*(1-d)+this._tr.y* d;b.z=this._node._vertexZ};a._updateColor=function(){var b=this._node._sprite;if(this._vertexDataCount&&b){var c=this._displayedColor,d=b._renderCmd._displayedColor,e=d.r,f=d.g;d=d.b;var g=b._renderCmd._displayedOpacity/255;b._opacityModifyRGB&&(e*=g,f*=g,d*=g);c.r=e;c.g=f;c.b=d;c.a=b._renderCmd._displayedOpacity;b=this._vertexData;e=0;for(f=this._vertexDataCount;e=d.width&&(d.width=c.width),0>=d.height&&(d.height=c.height),a.setContentSize(d));c=b?b.getBoundingBox():cc.rect(0,0,0,0);d=a?a.getBoundingBox():cc.rect(0, 0,0,0);c=cc.rectUnion(c,d);this.setContentSize(c.width,c.height);c=this.getContentSize();b&&(b.setPosition(c.width/2,c.height/2),b.setVisible(!0));a&&(a.setPosition(c.width/2,c.height/2),a.setVisible(!0))}},initWithLabelAndBackgroundSprite:function(a,b){if(!a)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): label should be non-null");if(!b)throw Error("cc.ControlButton.initWithLabelAndBackgroundSprite(): backgroundSprite should be non-null");if(cc.Control.prototype.init.call(this, !0)){this._parentInited=!0;this._titleDispatchTable={};this._titleColorDispatchTable={};this._titleLabelDispatchTable={};this._backgroundSpriteDispatchTable={};this._isPushed=!1;this.zoomOnTouchDown=!0;this._currentTitle=null;this.setAdjustBackgroundImage(!0);this.setPreferredSize(cc.size(0,0));this.zoomOnTouchDown=!0;this.ignoreAnchorPointForPosition(!1);this.setAnchorPoint(.5,.5);this._titleLabel=a;this._backgroundSprite=b;this.setOpacity(255);this.setOpacityModifyRGB(!0);var c=a.getString();this.setTitleForState(c, cc.CONTROL_STATE_NORMAL);this.setTitleColorForState(a.getColor(),cc.CONTROL_STATE_NORMAL);this.setTitleLabelForState(a,cc.CONTROL_STATE_NORMAL);this.setBackgroundSpriteForState(b,cc.CONTROL_STATE_NORMAL);this._state=cc.CONTROL_STATE_NORMAL;this._marginH=24;this._marginV=12;this._labelAnchorPoint=cc.p(.5,.5);this.setPreferredSize(cc.size(0,0));this.needsLayout();return!0}return!1},initWithTitleAndFontNameAndFontSize:function(a,b,c){a=new cc.LabelTTF(a,b,c);return this.initWithLabelAndBackgroundSprite(a, new cc.Scale9Sprite)},initWithBackgroundSprite:function(a){var b=new cc.LabelTTF("","Arial",30);return this.initWithLabelAndBackgroundSprite(b,a)},doesAdjustBackgroundImage:function(){return this._doesAdjustBackgroundImage},setAdjustBackgroundImage:function(a){this._doesAdjustBackgroundImage=a;this.needsLayout()},getZoomOnTouchDown:function(){return this.zoomOnTouchDown},setZoomOnTouchDown:function(a){return this.zoomOnTouchDown=a},getPreferredSize:function(){return this._preferredSize},setPreferredSize:function(a){if(0=== a.width&&0===a.height)this._doesAdjustBackgroundImage=!0;else{this._doesAdjustBackgroundImage=!1;var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setPreferredSize(a)}this._preferredSize=a;this.needsLayout()},getLabelAnchorPoint:function(){return this._labelAnchorPoint},setLabelAnchorPoint:function(a){this._labelAnchorPoint=a;this._titleLabel&&this._titleLabel.setAnchorPoint(a)},_getCurrentTitle:function(){return this._currentTitle},_getCurrentTitleColor:function(){return this._currentTitleColor}, getOpacity:function(){return this._opacity},setOpacity:function(a){cc.Control.prototype.setOpacity.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setOpacity(a)},setColor:function(a){cc.Control.prototype.setColor.call(this,a);var b=this._backgroundSpriteDispatchTable,c;for(c in b)b[c].setColor(a)},getColor:function(){var a=this._realColor;return cc.color(a.r,a.g,a.b,a.a)},isPushed:function(){return this._isPushed},_getVerticalMargin:function(){return this._marginV},_getHorizontalOrigin:function(){return this._marginH}, setMargins:function(a,b){this._marginV=b;this._marginH=a;this.needsLayout()},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this.needsLayout()},setSelected:function(a){cc.Control.prototype.setSelected.call(this,a);this.needsLayout()},setHighlighted:function(a){this._state=a?cc.CONTROL_STATE_HIGHLIGHTED:cc.CONTROL_STATE_NORMAL;cc.Control.prototype.setHighlighted.call(this,a);(a=this.getActionByTag(cc.CONTROL_ZOOM_ACTION_TAG))&&this.stopAction(a);this.zoomOnTouchDown&&(a=this.isHighlighted()&& this.isEnabled()&&!this.isSelected()?1.1:1,a=cc.scaleTo(.05,a),a.setTag(cc.CONTROL_ZOOM_ACTION_TAG),this.runAction(a))},onTouchBegan:function(a,b){if(!(this.isTouchInside(a)&&this.isEnabled()&&this.isVisible()&&this.hasVisibleParents()))return!1;this._isPushed=!0;this.setHighlighted(!0);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DOWN);return!0},onTouchMoved:function(a,b){this._enabled&&this._isPushed&&!this._selected?(a=this.isTouchInside(a))&&!this._highlighted?(this.setHighlighted(!0), this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_ENTER)):a&&this._highlighted?this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_INSIDE):!a&&this._highlighted?(this.setHighlighted(!1),this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_EXIT)):a||this._highlighted||this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_DRAG_OUTSIDE):this._highlighted&&this.setHighlighted(!1)},onTouchEnded:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.isTouchInside(a)? this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_INSIDE):this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_UP_OUTSIDE)},onTouchCancelled:function(a,b){this._isPushed=!1;this.setHighlighted(!1);this.sendActionsForControlEvents(cc.CONTROL_EVENT_TOUCH_CANCEL)},getTitleForState:function(a){var b=this._titleDispatchTable;return b?b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]:""},setTitleForState:function(a,b){this._titleDispatchTable[b]=a||"";this.getState()===b&&this.needsLayout()},getTitleColorForState:function(a){return(a= this._titleColorDispatchTable[a])?a:(a=this._titleColorDispatchTable[cc.CONTROL_STATE_NORMAL])?a:cc.color.WHITE},setTitleColorForState:function(a,b){this._titleColorDispatchTable[b]=a;this.getState()===b&&this.needsLayout()},getTitleLabelForState:function(a){var b=this._titleLabelDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setTitleLabelForState:function(a,b){var c=this._titleLabelDispatchTable;if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(.5, .5);this.addChild(a,1);this.getState()===b&&this.needsLayout()},setTitleTTFForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelTTF(c,a,12),b)},getTitleTTFForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelTTF?a.getFontName():""},setTitleTTFSizeForState:function(a,b){b=this.getTitleLabelForState(b);null!=b&&b instanceof cc.LabelTTF&&b.setFontSize(a)},getTitleTTFSizeForState:function(a){a=this.getTitleLabelForState(a); return null!=a&&a instanceof cc.LabelTTF?a.getFontSize():0},setTitleBMFontForState:function(a,b){var c=this.getTitleForState(b);c||(c="");this.setTitleLabelForState(new cc.LabelBMFont(c,a),b)},getTitleBMFontForState:function(a){a=this.getTitleLabelForState(a);return null!=a&&a instanceof cc.LabelBMFont?a.getFntFile():""},getBackgroundSpriteForState:function(a){var b=this._backgroundSpriteDispatchTable;return b[a]?b[a]:b[cc.CONTROL_STATE_NORMAL]},setBackgroundSpriteForState:function(a,b){var c=this._backgroundSpriteDispatchTable; if(c[b]){var d=c[b];d&&this.removeChild(d,!0)}c[b]=a;a.setVisible(!1);a.setAnchorPoint(.5,.5);this.addChild(a);c=this._preferredSize;0===c.width&&0===c.height||a.setPreferredSize(c);this._state===b&&this.needsLayout()},setBackgroundSpriteFrameForState:function(a,b){a=cc.Scale9Sprite.createWithSpriteFrame(a);this.setBackgroundSpriteForState(a,b)}});cc.ControlButton.prototype.adjustBackground; cc.defineGetterSetter(cc.ControlButton.prototype,"adjustBackground",cc.ControlButton.prototype.getAdjustBackgroundImage,cc.ControlButton.prototype.setAdjustBackgroundImage);cc.ControlButton.prototype.preferredSize;cc.defineGetterSetter(cc.ControlButton.prototype,"preferredSize",cc.ControlButton.prototype.getPreferredSize,cc.ControlButton.prototype.setPreferredSize);cc.ControlButton.prototype.labelAnchor; cc.defineGetterSetter(cc.ControlButton.prototype,"labelAnchor",cc.ControlButton.prototype.getLabelAnchorPoint,cc.ControlButton.prototype.setLabelAnchorPoint);cc.ControlButton.create=function(a,b,c){return new cc.ControlButton(a,b,c)};cc.RGBA=function(a,b,c,d){this.r=a;this.g=b;this.b=c;this.a=d};cc.HSV=function(a,b,c){this.h=a;this.s=b;this.v=c};cc.ControlUtils={};cc.ControlUtils.addSpriteToTargetWithPosAndAnchor=function(a,b,c,d){a=new cc.Sprite("#"+a);if(!a)return null;a.setPosition(c);a.setAnchorPoint(d);b.addChild(a);return a}; cc.ControlUtils.HSVfromRGB=function(a){var b=new cc.HSV;var c=a.ra.g?a.r:a.g;d=d>a.b?d:a.b;b.v=d;c=d-c;if(0=d?(a.g-a.b)/c:a.g>=d?2+(a.b-a.r)/c:4+(a.r-a.g)/c;b.h*=60;0>b.h&&(b.h+=360);return b}; cc.ControlUtils.RGBfromHSV=function(a){var b=new cc.RGBA;b.a=1;if(0>=a.s){if(!a.h)return b.r=a.v,b.g=a.v,b.b=a.v,b;b.r=0;b.g=0;b.b=0;return b}var c=a.h;360<=c&&(c=0);c/=60;var d=0|c;var e=c-d;c=a.v*(1-a.s);var f=a.v*(1-a.s*e);e=a.v*(1-a.s*(1-e));switch(d){case 0:b.r=a.v;b.g=e;b.b=c;break;case 1:b.r=f;b.g=a.v;b.b=c;break;case 2:b.r=c;b.g=a.v;b.b=e;break;case 3:b.r=c;b.g=f;b.b=a.v;break;case 4:b.r=e;b.g=c;b.b=a.v;break;default:b.r=a.v,b.g=c,b.b=f}return b}; cc.ControlUtils.CCRectUnion=function(a,b){return cc.rectUnion(a,b)};cc.Invocation=cc.Class.extend({_action:null,_target:null,_controlEvent:null,ctor:function(a,b,c){this._target=a;this._action=b;this._controlEvent=c},getAction:function(){return this._action},getTarget:function(){return this._target},getControlEvent:function(){return this._controlEvent},invoke:function(a){if(this._target&&this._action)if(cc.isString(this._action))this._target[this._action](a,this._controlEvent);else this._action.call(this._target,a,this._controlEvent)}});cc.Spacer=cc.Layer.extend({});cc.Spacer.verticalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(0,a);return b};cc.Spacer.horizontalSpacer=function(a){var b=new cc.Spacer;b.init();b.setContentSize(a,0);return b}; cc.MenuPassive=cc.Layer.extend({_color:null,_opacity:0,_className:"MenuPassive",ctor:function(){},getColor:function(){var a=this._color;return cc.color(a.r,a.g,a.b,a.a)},setColor:function(a){var b=this._color;b.r=a.r;b.g=a.g;b.b=a.b;if(this._children&&0= b.length)cc.log("cc.MenuPassive.alignItemsInColumns(): invalid row index");else if(h=b[e]){var k=this._children[c].getContentSize().height;f=0|(f>=k||null==k?f:k);++g;g>=h&&(d+=f+5,f=g=0,++e)}else cc.log("cc.MenuPassive.alignItemsInColumns(): can not have zero columns on a row");var m=cc.director.getWinSize(),l=h=f=e=0,n=0;d/=2;if(this._children&&0=k||null==k?f:k),this._children[c].setPosition(n-m.width/2,d-this._children[c].getContentSize().height/2),n+=l,++g,g>=h&&(d-=f+5,f=h=g=0,++e))},alignItemsInRows:function(a){var b=[],c;for(c=1;c=b.length)cc.log("cc.MenuPassive.alignItemsInRows(): invalid row index");else if(l=b[h]){var n=this._children[c].getContentSize().width; k=0|(k>=n||null==n?k:n);g+=0|this._children[c].getContentSize().height+5;++m;m>=l&&(d.push(k),e.push(g),f+=k+10,k=m=0,g=-5,++h)}else cc.log("cc.MenuPassive.alignItemsInColumns(): can't have zero rows on a column");g=cc.director.getWinSize();k=h=0;l=null;f=-f/2;var p=0;if(this._children&&0=n||null==n?k:n),this._children[c].setPosition(f+d[h]/2,p- g.height/2),p-=this._children[c].getContentSize().height+10,++m,m>=l&&(f+=k+5,k=l=m=0,++h))},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1}});cc.MenuPassive.create=function(a){a||(a=null);for(var b=[],c=1;ce&&(a.x=b+e*Math.cos(d),a.y=c+e*Math.sin(d));this._slider.setPosition(a);a.xthis._startPos.x+this._boxPos+this._boxSize-1&&(a.x=this._startPos.x+this._boxPos+this._boxSize-1);a.ythis._startPos.y+this._boxPos+this._boxSize&&(a.y=this._startPos.y+this._boxPos+this._boxSize);this._saturation=1-Math.abs((this._startPos.x+this._boxPos-a.x)/this._boxSize);this._brightness=Math.abs((this._startPos.y+this._boxPos-a.y)/this._boxSize)},_checkSliderPosition:function(a){var b=this._startPos.x+ .5*this._background.getBoundingBox().width,c=this._startPos.y+.5*this._background.getBoundingBox().height;b=a.x-b;c=a.y-c;return Math.sqrt(b*b+c*c)<=.5*this._background.getBoundingBox().width?(this._updateSliderPosition(a),this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED),!0):!1},onTouchBegan:function(a,b){if(!this.isEnabled()||!this.isVisible())return!1;a=this.getTouchLocation(a);return this._checkSliderPosition(a)},onTouchMoved:function(a,b){a=this.getTouchLocation(a);this._checkSliderPosition(a)}}); cc.ControlSaturationBrightnessPicker.prototype.saturation;cc.defineGetterSetter(cc.ControlSaturationBrightnessPicker.prototype,"saturation",cc.ControlSaturationBrightnessPicker.prototype.getSaturation);cc.ControlSaturationBrightnessPicker.prototype.brightness;cc.defineGetterSetter(cc.ControlSaturationBrightnessPicker.prototype,"brightness",cc.ControlSaturationBrightnessPicker.prototype.getBrightness);cc.ControlSaturationBrightnessPicker.prototype.background; cc.defineGetterSetter(cc.ControlSaturationBrightnessPicker.prototype,"background",cc.ControlSaturationBrightnessPicker.prototype.getBackground);cc.ControlSaturationBrightnessPicker.prototype.overlay;cc.defineGetterSetter(cc.ControlSaturationBrightnessPicker.prototype,"overlay",cc.ControlSaturationBrightnessPicker.prototype.getOverlay);cc.ControlSaturationBrightnessPicker.prototype.shadow;cc.defineGetterSetter(cc.ControlSaturationBrightnessPicker.prototype,"shadow",cc.ControlSaturationBrightnessPicker.prototype.getShadow); cc.ControlSaturationBrightnessPicker.prototype.slider;cc.defineGetterSetter(cc.ControlSaturationBrightnessPicker.prototype,"slider",cc.ControlSaturationBrightnessPicker.prototype.getSlider);cc.ControlSaturationBrightnessPicker.prototype.startPos;cc.defineGetterSetter(cc.ControlSaturationBrightnessPicker.prototype,"startPos",cc.ControlSaturationBrightnessPicker.prototype.getStartPos);cc.ControlSaturationBrightnessPicker.create=function(a,b){return new cc.ControlSaturationBrightnessPicker(a,b)};cc.ControlHuePicker=cc.Control.extend({_hue:0,_huePercentage:0,_background:null,_slider:null,_startPos:null,_className:"ControlHuePicker",ctor:function(a,b){cc.Control.prototype.ctor.call(this);b&&this.initWithTargetAndPos(a,b)},getHue:function(){return this._hue},setHue:function(a){this._hue=a;this.setHuePercentage(this._hue/360)},getHuePercentage:function(){return this._huePercentage},setHuePercentage:function(a){this._huePercentage=a;this._hue=360*this._huePercentage;var b=this._background.getBoundingBox(); a=this._startPos.x+.5*b.width;var c=this._startPos.y+.5*b.height;b=.5*b.width-15;var d=cc.degreesToRadians(360*this._huePercentage-180);this._slider.setPosition(a+b*Math.cos(d),c+b*Math.sin(d))},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._slider&&this._slider.setOpacity(a?255:128)},getBackground:function(){return this._background},getSlider:function(){return this._slider},getStartPos:function(){return this._startPos},initWithTargetAndPos:function(a,b){return cc.Control.prototype.init.call(this)? (this._background=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("huePickerBackground.png",a,b,cc.p(0,0)),this._slider=cc.ControlUtils.addSpriteToTargetWithPosAndAnchor("colourPicker.png",a,b,cc.p(.5,.5)),this._slider.setPosition(b.x,b.y+.5*this._background.getBoundingBox().height),this._startPos=b,this._huePercentage=this._hue=0,!0):!1},_updateSliderPosition:function(a){var b=this._background.getBoundingBox();a=cc.radiansToDegrees(Math.atan2(a.y-(this._startPos.y+.5*b.height),a.x-(this._startPos.x+ .5*b.width)))+180;this.setHue(a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},_checkSliderPosition:function(a){var b=Math.sqrt(Math.pow(a.x+10,2)+Math.pow(a.y,2));return 80>b&&59=this._maximumValue&&(this._maximumValue=this._minimumValue+1);this.setValue(this._value)},getMaximumValue:function(){return this._maximumValue},setMaximumValue:function(a){this._maximumAllowedValue=this._maximumValue=a;this._maximumValue<=this._minimumValue&&(this._minimumValue= this._maximumValue-1);this.setValue(this._value)},isTouchInside:function(a){a=a.getLocation();a=this.getParent().convertToNodeSpace(a);var b=this.getBoundingBox();b.width+=this._thumbSprite.getContentSize().width;b.x-=this._thumbSprite.getContentSize().width/2;return cc.rectContainsPoint(b,a)},locationFromTouch:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width&&(a.x=this._backgroundSprite.getContentSize().width);return a},getMinimumAllowedValue:function(){return this._minimumAllowedValue}, setMinimumAllowedValue:function(a){this._minimumAllowedValue=a},getMaximumAllowedValue:function(){return this._maximumAllowedValue},setMaximumAllowedValue:function(a){this._maximumAllowedValue=a},getThumbSprite:function(){return this._thumbSprite},getProgressSprite:function(){return this._progressSprite},getBackgroundSprite:function(){return this._backgroundSprite},initWithSprites:function(a,b,c){return cc.Control.prototype.init.call(this)?(this.ignoreAnchorPointForPosition(!1),this._backgroundSprite= a,this._progressSprite=b,this._thumbSprite=c,a=cc.ControlUtils.CCRectUnion(a.getBoundingBox(),c.getBoundingBox()),this.setContentSize(a.width,a.height),this._backgroundSprite.setAnchorPoint(.5,.5),this._backgroundSprite.setPosition(a.width/2,a.height/2),this.addChild(this._backgroundSprite),this._progressSprite.setAnchorPoint(0,.5),this._progressSprite.setPosition(0,a.height/2),this.addChild(this._progressSprite),this._thumbSprite.setPosition(0,a.height/2),this.addChild(this._thumbSprite),this._minimumValue= 0,this._maximumValue=1,this.setValue(this._minimumValue),!0):!1},setEnabled:function(a){cc.Control.prototype.setEnabled.call(this,a);this._thumbSprite&&this._thumbSprite.setOpacity(a?255:128)},sliderBegan:function(a){this.setSelected(!0);this._thumbSprite.setColor(cc.color.GRAY);this.setValue(this.valueForLocation(a))},sliderMoved:function(a){this.setValue(this.valueForLocation(a))},sliderEnded:function(a){this.isSelected()&&this.setValue(this.valueForLocation(this._thumbSprite.getPosition()));this._thumbSprite.setColor(cc.color.WHITE); this.setSelected(!1)},getTouchLocationInControl:function(a){a=a.getLocation();a=this.convertToNodeSpace(a);0>a.x?a.x=0:a.x>this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H&&(a.x=this._backgroundSprite.getContentSize().width+cc.SLIDER_MARGIN_H);return a},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;a=this.locationFromTouch(a);this.sliderBegan(a);return!0},onTouchMoved:function(a,b){a=this.locationFromTouch(a);this.sliderMoved(a)}, onTouchEnded:function(a,b){this.sliderEnded(cc.p(0,0))},needsLayout:function(){this._thumbSprite.setPositionX((this._value-this._minimumValue)/(this._maximumValue-this._minimumValue)*this._backgroundSprite.getContentSize().width);var a=this._progressSprite.getTextureRect();a=cc.rect(a.x,a.y,this._thumbSprite.getPositionX(),a.height);this._progressSprite.setTextureRect(a,this._progressSprite.isTextureRectRotated());this._thumbSprite._renderCmd.transform(this._renderCmd)},valueForLocation:function(a){a= a.x/this._backgroundSprite.getContentSize().width;return Math.max(Math.min(this._minimumValue+a*(this._maximumValue-this._minimumValue),this._maximumAllowedValue),this._minimumAllowedValue)}});cc.ControlSlider.prototype.value;cc.defineGetterSetter(cc.ControlSlider.prototype,"value",cc.ControlSlider.prototype.getValue,cc.ControlSlider.prototype.setValue);cc.ControlSlider.prototype.minValue;cc.defineGetterSetter(cc.ControlSlider.prototype,"minValue",cc.ControlSlider.prototype.getMinimumValue,cc.ControlSlider.prototype.setMinimumValue); cc.ControlSlider.prototype.maxValue;cc.defineGetterSetter(cc.ControlSlider.prototype,"maxValue",cc.ControlSlider.prototype.getMaximumValue,cc.ControlSlider.prototype.setMaximumValue);cc.ControlSlider.prototype.minAllowedValue;cc.defineGetterSetter(cc.ControlSlider.prototype,"minAllowedValue",cc.ControlSlider.prototype.getMinimumAllowedValue,cc.ControlSlider.prototype.setMinimumAllowedValue);cc.ControlSlider.prototype.maxAllowedValue; cc.defineGetterSetter(cc.ControlSlider.prototype,"maxAllowedValue",cc.ControlSlider.prototype.getMaximumAllowedValue,cc.ControlSlider.prototype.setMaximumAllowedValue);cc.ControlSlider.prototype.thumbSprite;cc.defineGetterSetter(cc.ControlSlider.prototype,"thumbSprite",cc.ControlSlider.prototype.getThumbSprite);cc.ControlSlider.prototype.progressSprite;cc.defineGetterSetter(cc.ControlSlider.prototype,"progressSprite",cc.ControlSlider.prototype.getProgressSprite);cc.ControlSlider.prototype.backgroundSprite; cc.defineGetterSetter(cc.ControlSlider.prototype,"backgroundSprite",cc.ControlSlider.prototype.getBackgroundSprite);cc.ControlSlider.create=function(a,b,c){return new cc.ControlSlider(a,b,c)};cc.ControlSwitch=cc.Control.extend({_switchSprite:null,_initialTouchXPosition:0,_moved:!1,_on:!1,_className:"ControlSwitch",ctor:function(a,b,c,d,e,f){cc.Control.prototype.ctor.call(this);f&&this.initWithMaskSprite(a,b,c,d,e,f)},initWithMaskSprite:function(a,b,c,d,e,f){if(!a)throw Error("cc.ControlSwitch.initWithMaskSprite(): maskSprite should be non-null.");if(!b)throw Error("cc.ControlSwitch.initWithMaskSprite(): onSprite should be non-null.");if(!c)throw Error("cc.ControlSwitch.initWithMaskSprite(): offSprite should be non-null."); if(!d)throw Error("cc.ControlSwitch.initWithMaskSprite(): thumbSprite should be non-null.");return this.init()?(this._on=!0,this._switchSprite=new cc.ControlSwitchSprite,this._switchSprite.initWithMaskSprite(a,b,c,d,e,f),this._switchSprite.setPosition(this._switchSprite.getContentSize().width/2,this._switchSprite.getContentSize().height/2),this.addChild(this._switchSprite),this.ignoreAnchorPointForPosition(!1),this.setAnchorPoint(.5,.5),this.setContentSize(this._switchSprite.getContentSize()),!0): !1},setOn:function(a,b){b=b||!1;a=(this._on=a)?this._switchSprite.getOnPosition():this._switchSprite.getOffPosition();b?this._switchSprite.runAction(new cc.ActionTween(.2,"sliderXPosition",this._switchSprite.getSliderXPosition(),a)):this._switchSprite.setSliderXPosition(a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},isOn:function(){return this._on},hasMoved:function(){return this._moved},setEnabled:function(a){this._enabled=a;this._switchSprite.setOpacity(a?255:128)},locationFromTouch:function(a){a= a.getLocation();return a=this.convertToNodeSpace(a)},onTouchBegan:function(a,b){if(!this.isTouchInside(a)||!this.isEnabled()||!this.isVisible())return!1;this._moved=!1;this._initialTouchXPosition=this.locationFromTouch(a).x-this._switchSprite.getSliderXPosition();this._switchSprite.getThumbSprite().setColor(cc.color.GRAY);this._switchSprite.needsLayout();return!0},onTouchMoved:function(a,b){a=this.locationFromTouch(a);a=cc.p(a.x-this._initialTouchXPosition,0);this._moved=!0;this._switchSprite.setSliderXPosition(a.x)}, onTouchEnded:function(a,b){a=this.locationFromTouch(a);this._switchSprite.getThumbSprite().setColor(cc.color.WHITE);this.hasMoved()?this.setOn(!(a.x=this._onPosition&&(a=this._onPosition);this._sliderXPosition=a;this.needsLayout()},getSliderXPosition:function(){return this._sliderXPosition},_getOnSideWidth:function(){return this._onSprite.getContentSize().width},_getOffSideWidth:function(){return this._offSprite.getContentSize().height},updateTweenAction:function(a,b){"sliderXPosition"===b&&this.setSliderXPosition(a)},setOnPosition:function(a){this._onPosition= a},getOnPosition:function(){return this._onPosition},setOffPosition:function(a){this._offPosition=a},getOffPosition:function(){return this._offPosition},setMaskTexture:function(a){this._stencil.setTexture(a)},getMaskTexture:function(){return this._stencil.getTexture()},setTextureLocation:function(a){this._textureLocation=a},getTextureLocation:function(){return this._textureLocation},setMaskLocation:function(a){this._maskLocation=a},getMaskLocation:function(){return this._maskLocation},setOnSprite:function(a){this._onSprite= a},getOnSprite:function(){return this._onSprite},setOffSprite:function(a){this._offSprite=a},getOffSprite:function(){return this._offSprite},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite},setOnLabel:function(a){this._onLabel=a},getOnLabel:function(){return this._onLabel},setOffLabel:function(a){this._offLabel=a},getOffLabel:function(){return this._offLabel}});cc.ControlSwitchSprite.prototype.sliderX; cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"sliderX",cc.ControlSwitchSprite.prototype.getSliderXPosition,cc.ControlSwitchSprite.prototype.setSliderXPosition);cc.ControlSwitchSprite.prototype.onPos;cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"onPos",cc.ControlSwitchSprite.prototype.getOnPosition,cc.ControlSwitchSprite.prototype.setOnPosition);cc.ControlSwitchSprite.prototype.offPos; cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"offPos",cc.ControlSwitchSprite.prototype.getOffPosition,cc.ControlSwitchSprite.prototype.setOffPosition);cc.ControlSwitchSprite.prototype.maskTexture;cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"maskTexture",cc.ControlSwitchSprite.prototype.getMaskTexture,cc.ControlSwitchSprite.prototype.setMaskTexture);cc.ControlSwitchSprite.prototype.maskPos; cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"maskPos",cc.ControlSwitchSprite.prototype.getMaskLocation,cc.ControlSwitchSprite.prototype.setMaskLocation);cc.ControlSwitchSprite.prototype.onSprite;cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"onSprite",cc.ControlSwitchSprite.prototype.getOnSprite,cc.ControlSwitchSprite.prototype.setOnSprite);cc.ControlSwitchSprite.prototype.offSprite; cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"offSprite",cc.ControlSwitchSprite.prototype.getOffSprite,cc.ControlSwitchSprite.prototype.setOffSprite);cc.ControlSwitchSprite.prototype.thumbSprite;cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"thumbSprite",cc.ControlSwitchSprite.prototype.getThumbSprite,cc.ControlSwitchSprite.prototype.setThumbSprite);cc.ControlSwitchSprite.prototype.onLabel; cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"onLabel",cc.ControlSwitchSprite.prototype.getOnLabel,cc.ControlSwitchSprite.prototype.setOnLabel);cc.ControlSwitchSprite.prototype.offLabel;cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"offLabel",cc.ControlSwitchSprite.prototype.getOffLabel,cc.ControlSwitchSprite.prototype.setOffLabel);cc.ControlSwitchSprite.prototype.onSideWidth;cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"onSideWidth",cc.ControlSwitchSprite.prototype._getOnSideWidth); cc.ControlSwitchSprite.prototype.offSideWidth;cc.defineGetterSetter(cc.ControlSwitchSprite.prototype,"offSideWidth",cc.ControlSwitchSprite.prototype._getOffSideWidth);cc.CONTROL_STEPPER_PARTMINUS=0;cc.CONTROL_STEPPER_PARTPLUS=1;cc.CONTROL_STEPPER_PARTNONE=2;cc.CONTROL_STEPPER_LABELCOLOR_ENABLED=cc.color(55,55,55);cc.CONTROL_STEPPER_LABELCOLOR_DISABLED=cc.color(147,147,147);cc.CONTROL_STEPPER_LABELFONT="CourierNewPSMT";cc.AUTOREPEAT_DELTATIME=.15;cc.AUTOREPEAT_INCREASETIME_INCREMENT=12; cc.ControlStepper=cc.Control.extend({_minusSprite:null,_plusSprite:null,_minusLabel:null,_plusLabel:null,_value:0,_continuous:!1,_autorepeat:!1,_wraps:!1,_minimumValue:0,_maximumValue:0,_stepValue:0,_touchInsideFlag:!1,_touchedPart:cc.CONTROL_STEPPER_PARTNONE,_autorepeatCount:0,_className:"ControlStepper",ctor:function(a,b){cc.Control.prototype.ctor.call(this);this._plusLabel=this._minusLabel=this._plusSprite=this._minusSprite=null;this._value=0;this._wraps=this._autorepeat=this._continuous=!1;this._stepValue= this._maximumValue=this._minimumValue=0;this._touchInsideFlag=!1;this._touchedPart=cc.CONTROL_STEPPER_PARTNONE;this._autorepeatCount=0;b&&this.initWithMinusSpriteAndPlusSprite(a,b)},initWithMinusSpriteAndPlusSprite:function(a,b){if(!a)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Minus sprite should be non-null.");if(!b)throw Error("cc.ControlStepper.initWithMinusSpriteAndPlusSprite(): Plus sprite should be non-null.");return this.init()?(this._continuous=this._autorepeat=!0, this._minimumValue=0,this._maximumValue=100,this._value=0,this._stepValue=1,this._wraps=!1,this.ignoreAnchorPointForPosition(!1),this.setMinusSprite(a),this._minusSprite.setPosition(a.getContentSize().width/2,a.getContentSize().height/2),this.addChild(this._minusSprite),this.setMinusLabel(new cc.LabelTTF("-",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER)),this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_DISABLED),this._minusLabel.setPosition(this._minusSprite.getContentSize().width/ 2,this._minusSprite.getContentSize().height/2),this._minusSprite.addChild(this._minusLabel),this.setPlusSprite(b),this._plusSprite.setPosition(a.getContentSize().width+b.getContentSize().width/2,a.getContentSize().height/2),this.addChild(this._plusSprite),this.setPlusLabel(new cc.LabelTTF("+",cc.CONTROL_STEPPER_LABELFONT,40,cc.size(40,40),cc.TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_CENTER)),this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setPosition(this._plusSprite.getContentSize().width/ 2,this._plusSprite.getContentSize().height/2),this._plusSprite.addChild(this._plusLabel),a=cc.ControlUtils.CCRectUnion(this._minusSprite.getBoundingBox(),this._plusSprite.getBoundingBox()),this.setContentSize(this._minusSprite.getContentSize().width+this._plusSprite.getContentSize().height,a.height),!0):!1},setWraps:function(a){if(this._wraps=a)this._minusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setColor(cc.CONTROL_STEPPER_LABELCOLOR_ENABLED);this.setValue(this._value)}, getWraps:function(){return this._wraps},setMinimumValue:function(a){if(a>=this._maximumValue)throw Error("cc.ControlStepper.setMinimumValue(): minimumValue should be numerically less than maximumValue.");this._minimumValue=a;this.setValue(this._value)},getMinimumValue:function(){return this._minimumValue},setMaximumValue:function(a){if(a<=this._minimumValue)throw Error("cc.ControlStepper.setMaximumValue(): maximumValue should be numerically less than maximumValue.");this._maximumValue=a;this.setValue(this._value)}, getMaximumValue:function(){return this._maximumValue},setValue:function(a){this.setValueWithSendingEvent(a,!0)},getValue:function(){return this._value},setStepValue:function(a){if(0>=a)throw Error("cc.ControlStepper.setMaximumValue(): stepValue should be numerically greater than 0.");this._stepValue=a},getStepValue:function(){return this._stepValue},isContinuous:function(){return this._continuous},setValueWithSendingEvent:function(a,b){athis._maximumValue&&(a=this._wraps?this._minimumValue:this._maximumValue);this._value=a;this._wraps||(this._minusLabel.setColor(a===this._minimumValue?cc.CONTROL_STEPPER_LABELCOLOR_DISABLED:cc.CONTROL_STEPPER_LABELCOLOR_ENABLED),this._plusLabel.setColor(a===this._maximumValue?cc.CONTROL_STEPPER_LABELCOLOR_DISABLED:cc.CONTROL_STEPPER_LABELCOLOR_ENABLED));b&&this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},startAutorepeat:function(){this._autorepeatCount=-1;this.schedule(this.update, cc.AUTOREPEAT_DELTATIME,cc.REPEAT_FOREVER,3*cc.AUTOREPEAT_DELTATIME)},stopAutorepeat:function(){this.unschedule(this.update)},update:function(a){this._autorepeatCount++;this._autorepeatCountthis._minimumValue?(this._touchedPart=cc.CONTROL_STEPPER_PARTMINUS,this._minusSprite.setColor(cc.color.GRAY),this._plusSprite.setColor(cc.color.WHITE)):a.x>=this._minusSprite.getContentSize().width&&this._valuethis._maximumValue&&(a=this._maximumValue);this._value=a;a=(a-this._minimumValue)/(this._maximumValue- this._minimumValue);this._progressTimer.setPercentage(100*a);this._thumbSprite.setRotation(360*a);this.sendActionsForControlEvents(cc.CONTROL_EVENT_VALUECHANGED)},getValue:function(){return this._value},setMinimumValue:function(a){this._minimumValue=a;this._minimumValue>=this._maximumValue&&(this._maximumValue=this._minimumValue+1);this.setValue(this._maximumValue)},getMinimumValue:function(){return this._minimumValue},setMaximumValue:function(a){this._maximumValue=a;this._maximumValue<=this._minimumValue&& (this._minimumValue=this._maximumValue-1);this.setValue(this._minimumValue)},getMaximumValue:function(){return this._maximumValue},isTouchInside:function(a){a=this.getTouchLocation(a);return this.distanceBetweenPointAndPoint(this._progressTimer.getPosition(),a)b&&(b+=360);this.setValue(this._value+b/360*(this._maximumValue-this._minimumValue));this._previousLocation=a},potentiometerEnded:function(a){this.getThumbSprite().setColor(cc.color.WHITE);this.setSelected(!1)},setThumbSprite:function(a){this._thumbSprite=a},getThumbSprite:function(){return this._thumbSprite}, setProgressTimer:function(a){this._progressTimer=a},getProgressTimer:function(){return this._progressTimer},setPreviousLocation:function(a){this._previousLocation=a},getPreviousLocation:function(){return this._previousLocation}});cc.ControlPotentiometer.prototype.value;cc.defineGetterSetter(cc.ControlPotentiometer.prototype,"value",cc.ControlPotentiometer.prototype.getValue,cc.ControlPotentiometer.prototype.setValue);cc.ControlPotentiometer.prototype.minValue; cc.defineGetterSetter(cc.ControlPotentiometer.prototype,"minValue",cc.ControlPotentiometer.prototype.getMinimumValue,cc.ControlPotentiometer.prototype.setMinimumValue);cc.ControlPotentiometer.prototype.maxValue;cc.defineGetterSetter(cc.ControlPotentiometer.prototype,"maxValue",cc.ControlPotentiometer.prototype.getMaximumValue,cc.ControlPotentiometer.prototype.setMaximumValue);cc.ControlPotentiometer.prototype.progressTimer; cc.defineGetterSetter(cc.ControlPotentiometer.prototype,"progressTimer",cc.ControlPotentiometer.prototype.getProgressTimer,cc.ControlPotentiometer.prototype.setProgressTimer);cc.ControlPotentiometer.prototype.thumbSprite;cc.defineGetterSetter(cc.ControlPotentiometer.prototype,"thumbSprite",cc.ControlPotentiometer.prototype.getThumbSprite,cc.ControlPotentiometer.prototype.setThumbSprite);cc.ControlPotentiometer.prototype.prevLocation; cc.defineGetterSetter(cc.ControlPotentiometer.prototype,"prevLocation",cc.ControlPotentiometer.prototype.getPreviousLocation,cc.ControlPotentiometer.prototype.setPreviousLocation);cc.ControlPotentiometer.create=function(a,b,c){return new cc.ControlPotentiometer(a,b,c)};cc.SCROLLVIEW_DIRECTION_NONE=-1;cc.SCROLLVIEW_DIRECTION_HORIZONTAL=0;cc.SCROLLVIEW_DIRECTION_VERTICAL=1;cc.SCROLLVIEW_DIRECTION_BOTH=2;var SCROLL_DEACCEL_RATE=.95,SCROLL_DEACCEL_DIST=1,BOUNCE_DURATION=.15,INSET_RATIO=.2,MOVE_INCH=.04375,BOUNCE_BACK_FACTOR=.35;cc.convertDistanceFromPointToInch=function(a){var b=cc.view;b=(b.getScaleX()+b.getScaleY())/2;return a*b/160};cc.ScrollViewDelegate=cc.Class.extend({scrollViewDidScroll:function(a){},scrollViewDidZoom:function(a){}}); cc.ScrollView=cc.Layer.extend({_zoomScale:0,_minZoomScale:0,_maxZoomScale:0,_delegate:null,_direction:cc.SCROLLVIEW_DIRECTION_BOTH,_dragging:!1,_contentOffset:null,_container:null,_touchMoved:!1,_maxInset:null,_minInset:null,_bounceable:!1,_clippingToBounds:!1,_scrollDistance:null,_touchPoint:null,_touchLength:0,_touches:null,_viewSize:null,_minScale:0,_maxScale:0,_parentScissorRect:null,_scissorRestored:!1,_tmpViewRect:null,_touchListener:null,_className:"ScrollView",ctor:function(a,b){cc.Layer.prototype.ctor.call(this); this._contentOffset=cc.p(0,0);this._maxInset=cc.p(0,0);this._minInset=cc.p(0,0);this._scrollDistance=cc.p(0,0);this._touchPoint=cc.p(0,0);this._touches=[];this._viewSize=cc.size(0,0);this._parentScissorRect=new cc.Rect(0,0,0,0);this._tmpViewRect=new cc.Rect(0,0,0,0);void 0!=b?this.initWithViewSize(a,b):this.initWithViewSize(cc.size(200,200),null)},init:function(){return this.initWithViewSize(cc.size(200,200),null)},initWithViewSize:function(a,b){var c=cc.p(0,0);return cc.Layer.prototype.init.call(this)? (b||this._container||(b=new cc.Layer),b&&this.setContainer(b),this.setViewSize(a),this.setTouchEnabled(!0),this._touches.length=0,this._delegate=null,this._clippingToBounds=this._bounceable=!0,this._direction=cc.SCROLLVIEW_DIRECTION_BOTH,this._container.setPosition(c),this._touchLength=0,this._minScale=this._maxScale=1,!0):!1},visit:function(a){var b=this._renderCmd,c=a?a._renderCmd:null;if(this._visible){a=cc.renderer;b.visit(c);this._clippingToBounds&&a.pushRenderCommand(b.startCmd);var d=this._children, e=d.length;if(0b.y||eb.x||dc&&(a.x+=b.width*c,c=-c);0>d&&(a.y+=b.height*d,d=-d);e=this._tmpViewRect;e.x=a.x;e.y=a.y;e.width=b.width*c;e.height=b.height*d;return e},_createRenderCmd:function(){return cc._renderType===cc.game.RENDER_TYPE_CANVAS?new cc.ScrollView.CanvasRenderCmd(this):new cc.ScrollView.WebGLRenderCmd(this)}});cc.ScrollView.prototype.minOffset; cc.defineGetterSetter(cc.ScrollView.prototype,"minOffset",cc.ScrollView.prototype.minContainerOffset);cc.ScrollView.prototype.maxOffset;cc.defineGetterSetter(cc.ScrollView.prototype,"maxOffset",cc.ScrollView.prototype.maxContainerOffset);cc.ScrollView.prototype.bounceable;cc.defineGetterSetter(cc.ScrollView.prototype,"bounceable",cc.ScrollView.prototype.isBounceable,cc.ScrollView.prototype.setBounceable);cc.ScrollView.prototype.viewSize; cc.defineGetterSetter(cc.ScrollView.prototype,"viewSize",cc.ScrollView.prototype.getViewSize,cc.ScrollView.prototype.setViewSize);cc.ScrollView.prototype.container;cc.defineGetterSetter(cc.ScrollView.prototype,"container",cc.ScrollView.prototype.getContainer,cc.ScrollView.prototype.setContainer);cc.ScrollView.prototype.direction;cc.defineGetterSetter(cc.ScrollView.prototype,"direction",cc.ScrollView.prototype.getDirection,cc.ScrollView.prototype.setDirection);cc.ScrollView.prototype.delegate; cc.defineGetterSetter(cc.ScrollView.prototype,"delegate",cc.ScrollView.prototype.getDelegate,cc.ScrollView.prototype.setDelegate);cc.ScrollView.prototype.clippingToBounds;cc.defineGetterSetter(cc.ScrollView.prototype,"clippingToBounds",cc.ScrollView.prototype.isClippingToBounds,cc.ScrollView.prototype.setClippingToBounds);cc.ScrollView.create=function(a,b){return new cc.ScrollView(a,b)};(function(){cc.ScrollView.CanvasRenderCmd=function(b){this._layerCmdCtor(b);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.startCmd._canUseDirtyRegion=!0;this.endCmd=new cc.CustomRenderCmd(this,this._endCmd);this.endCmd._canUseDirtyRegion=!0};var a=cc.ScrollView.CanvasRenderCmd.prototype=Object.create(cc.Layer.CanvasRenderCmd.prototype);a.constructor=cc.ScrollView.CanvasRenderCmd;a._startCmd=function(b,c,d){var e=this._node,f=b||cc._renderContext;b=f.getContext(); f.save();e._clippingToBounds&&(this._scissorRestored=!1,f.setTransform(this._worldTransform,c,d),d=e.getScaleX(),c=e.getScaleY(),d*=e._viewSize.width,e=e._viewSize.height*c,b.beginPath(),b.rect(0,0,d,-e),b.closePath(),b.clip())};a._endCmd=function(b){b=b||cc._renderContext;b.restore()}})();(function(){cc.ScrollView.WebGLRenderCmd=function(b){this._layerCmdCtor(b);this._needDraw=!1;this.startCmd=new cc.CustomRenderCmd(this,this._startCmd);this.endCmd=new cc.CustomRenderCmd(this,this._endCmd)};var a=cc.ScrollView.WebGLRenderCmd.prototype=Object.create(cc.Layer.WebGLRenderCmd.prototype);a.constructor=cc.ScrollView.WebGLRenderCmd;a._startCmd=function(){var b=this._node,c=cc.view,d=b._getViewRect();if(c.isScissorEnabled()){if(b._scissorRestored=!0,b._parentScissorRect=c.getScissorRect(), cc.rectIntersection(d,b._parentScissorRect)){b=b._parentScissorRect;var e=Math.max(d.x,b.x),f=Math.max(d.y,b.y);c.setScissorInPoints(e,f,Math.min(d.x+d.width,b.x+b.width)-e,Math.min(d.y+d.height,b.y+b.height)-f)}}else b=cc._renderContext,b.enable(b.SCISSOR_TEST),c.setScissorInPoints(d.x,d.y,d.width,d.height)};a._endCmd=function(){var b=this._node;b._scissorRestored?(b=b._parentScissorRect,cc.view.setScissorInPoints(b.x,b.y,b.width,b.height)):(b=cc._renderContext,b.disable(b.SCISSOR_TEST))}})();/* Removes an object in array. Removes an object with given key and value. If no object is found in array with the key and value, no action is taken. @function @param {Object} delObject Object to remove Sets a new value of the key for the given object. In case where sorting value must be changed, this message must be sent to keep consistency of being sorted. If it is changed externally, it must be sorted completely again. @function @param {Number} tag Tag to set @param {Object} setObject The object which would be set Returns an object with given key and value. Returns an object with given key and value. If no object is found, it returns nil. @function @param {Number} tag Tag to locate object @return {Object|null} Returns an index of the object with given key and value. Returns the index of an object with given key and value. If no object is found, it returns an index at which the given object value would have been located. If object must be located at the end of array, it returns the length of the array, which is out of bound. @function @param {Number} idxObj Id to locate object @return {Number} index of an object found */ cc.SortableObject=cc.Class.extend({setObjectID:function(a){},getObjectID:function(){return 0}});cc.SortedObject=cc.SortableObject.extend({_objectID:0,ctor:function(){this._objectID=0},setObjectID:function(a){this._objectID=a},getObjectID:function(){return this._objectID}});var _compareObject=function(a,b){return a.getObjectID()-b.getObjectID()}; cc.ArrayForObjectSorting=cc.Class.extend({_saveObjectArr:null,ctor:function(){this._saveObjectArr=[]},insertSortedObject:function(a){if(!a)throw Error("cc.ArrayForObjectSorting.insertSortedObject(): addObject should be non-null.");var b=this.indexOfSortedObject(a);this.insertObject(a,b)},removeSortedObject:function(a){if(0!==this.count()){var b=this.indexOfSortedObject(a);b=c&&a=b;){var e=0|b+(c-b)/2,f=d[e],g=d[e+1];if(a>=f&&a<=g)return e;a=b?0:-1},_indexFromOffset:function(a){var b={x:a.x,y:a.y};a=this._dataSource.numberOfCellsInTableView(this)-1;this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y);b=this.__indexFromOffset(b);-1!==b&&(b=Math.max(0,b),b>a&&(b=cc.INVALID_INDEX)); return b},__offsetFromIndex:function(a){switch(this.getDirection()){case cc.SCROLLVIEW_DIRECTION_HORIZONTAL:a=cc.p(this._cellsPositions[a],0);break;default:a=cc.p(0,this._cellsPositions[a])}return a},_offsetFromIndex:function(a){var b=this.__offsetFromIndex(a);a=this._dataSource.tableCellSizeForIndex(this,a);this._vOrdering===cc.TABLEVIEW_FILL_TOPDOWN&&(b.y=this.getContainer().getContentSize().height-b.y-a.height);return b},_updateCellPositions:function(){var a=this._dataSource.numberOfCellsInTableView(this), b=this._cellsPositions;if(0this._dataSource.numberOfCellsInTableView(this)-1)){var b=this.cellAtIndex(a);b&&this._moveCellOutOfSight(b);b=this._dataSource.tableCellAtIndex(this,a);this._setIndexForCell(a,b);this._addCellIfNecessary(b)}},insertCellAtIndex:function(a){if(!(a===cc.INVALID_INDEX||a>this._dataSource.numberOfCellsInTableView(this)- 1)){var b,c=this._cellsUsed;if(b=c.objectWithObjectID(a))for(var d=b=c.indexOfSortedObject(b);dthis._dataSource.numberOfCellsInTableView(this)-1)){var b=this.cellAtIndex(a);if(b){var c=this._cellsUsed,d=c.indexOfSortedObject(b); this._moveCellOutOfSight(b);cc.arrayRemoveObject(this._indices,a);this._updateCellPositions();for(a=c.count()-1;a>d;a--)b=c.objectAtIndex(a),this._setIndexForCell(b.getIdx()-1,b)}}},reloadData:function(){this._oldDirection=cc.SCROLLVIEW_DIRECTION_NONE;for(var a=this._cellsUsed,b=this._cellsFreed,c=this.getContainer(),d=0,e=a.count();dc;)if(this._moveCellOutOfSight(d),0>>1;;){l[(u+1)*p]<=n?q=u+1:r=u;if(q==r)return(q+1)*p;u=q+r>>>1}};m.linearSearch=function(l,n,p){for(var q=0,r=l.length-p;q<=r;q+=p)if(l[q]>n)return q;return-1};return m}();a.Animation=b;var c;(function(m){m[m.setup=0]="setup";m[m.current=1]="current";m[m.currentLayered=2]="currentLayered"})(c=a.MixPose||(a.MixPose={}));var d;(function(m){m[m["in"]=0]="in";m[m.out=1]="out"})(d=a.MixDirection||(a.MixDirection={}));var e;(function(m){m[m.rotate=0]="rotate";m[m.translate=1]="translate"; m[m.scale=2]="scale";m[m.shear=3]="shear";m[m.attachment=4]="attachment";m[m.color=5]="color";m[m.deform=6]="deform";m[m.event=7]="event";m[m.drawOrder=8]="drawOrder";m[m.ikConstraint=9]="ikConstraint";m[m.transformConstraint=10]="transformConstraint";m[m.pathConstraintPosition=11]="pathConstraintPosition";m[m.pathConstraintSpacing=12]="pathConstraintSpacing";m[m.pathConstraintMix=13]="pathConstraintMix";m[m.twoColor=14]="twoColor"})(e=a.TimelineType||(a.TimelineType={}));var f=function(){function m(l){if(0>= l)throw Error("frameCount must be > 0: "+l);this.curves=a.Utils.newFloatArray((l-1)*m.BEZIER_SIZE)}m.prototype.getFrameCount=function(){return this.curves.length/m.BEZIER_SIZE+1};m.prototype.setLinear=function(l){this.curves[l*m.BEZIER_SIZE]=m.LINEAR};m.prototype.setStepped=function(l){this.curves[l*m.BEZIER_SIZE]=m.STEPPED};m.prototype.getCurveType=function(l){l*=m.BEZIER_SIZE;if(l==this.curves.length)return m.LINEAR;l=this.curves[l];return l==m.LINEAR?m.LINEAR:l==m.STEPPED?m.STEPPED:m.BEZIER};m.prototype.setCurve= function(l,n,p,q,r){var u=.03*(2*-n+q),w=.03*(2*-p+r);q=.006*(3*(n-q)+1);r=.006*(3*(p-r)+1);var v=2*u+q,t=2*w+r;n=.3*n+u+.16666667*q;p=.3*p+w+.16666667*r;l*=m.BEZIER_SIZE;w=this.curves;w[l++]=m.BEZIER;u=n;for(var x=p,y=l+m.BEZIER_SIZE-1;l=n)return l==r?u=r=0:(r=p[l-2],u=p[l-1]),u+(p[l+1]-u)*(n-r)/(q-r);p=p[l-1];return p+(1-p)*(n-q)/(1-q)};return m}();f.LINEAR=0;f.STEPPED=1;f.BEZIER=2;f.BEZIER_SIZE=19;a.CurveTimeline=f;var g=function(m){function l(n){var p=m.call(this,n)||this;p.frames=a.Utils.newFloatArray(n<<1);return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.rotate<<24)+this.boneIndex};l.prototype.setFrame=function(n,p,q){n<<=1;this.frames[n]=p;this.frames[n+l.ROTATION]=q};l.prototype.apply=function(n, p,q,r,u,w,v){p=this.frames;n=n.bones[this.boneIndex];if(q=p[p.length-l.ENTRIES])w==c.setup?n.rotation=n.data.rotation+p[p.length+l.PREV_ROTATION]*u:(w=n.data.rotation+p[p.length+l.PREV_ROTATION]-n.rotation,n.rotation+=(w-360*(16384-(16384.499999999996-w/360|0)))*u);else{v=b.binarySearch(p,q,l.ENTRIES);r=p[v+l.PREV_ROTATION]; var t=p[v];q=this.getCurvePercent((v>>1)-1,1-(q-t)/(p[v+l.PREV_TIME]-t));p=p[v+l.ROTATION]-r;p=r+(p-360*(16384-(16384.499999999996-p/360|0)))*q;w==c.setup?n.rotation=n.data.rotation+(p-360*(16384-(16384.499999999996-p/360|0)))*u:(p=n.data.rotation+p-n.rotation,n.rotation+=(p-360*(16384-(16384.499999999996-p/360|0)))*u)}};return l}(f);g.ENTRIES=2;g.PREV_TIME=-2;g.PREV_ROTATION=-1;g.ROTATION=1;a.RotateTimeline=g;g=function(m){function l(n){var p=m.call(this,n)||this;p.frames=a.Utils.newFloatArray(n* l.ENTRIES);return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.translate<<24)+this.boneIndex};l.prototype.setFrame=function(n,p,q,r){n*=l.ENTRIES;this.frames[n]=p;this.frames[n+l.X]=q;this.frames[n+l.Y]=r};l.prototype.apply=function(n,p,q,r,u,w,v){p=this.frames;n=n.bones[this.boneIndex];if(q=p[p.length-l.ENTRIES])r=p[p.length+l.PREV_X],v=p[p.length+l.PREV_Y]; else{var t=b.binarySearch(p,q,l.ENTRIES);r=p[t+l.PREV_X];v=p[t+l.PREV_Y];var x=p[t];q=this.getCurvePercent(t/l.ENTRIES-1,1-(q-x)/(p[t+l.PREV_TIME]-x));r+=(p[t+l.X]-r)*q;v+=(p[t+l.Y]-v)*q}w==c.setup?(n.x=n.data.x+r*u,n.y=n.data.y+v*u):(n.x+=(n.data.x+r-n.x)*u,n.y+=(n.data.y+v-n.y)*u)}};return l}(f);g.ENTRIES=3;g.PREV_TIME=-3;g.PREV_X=-2;g.PREV_Y=-1;g.X=1;g.Y=2;a.TranslateTimeline=g;var h=function(m){function l(n){return m.call(this,n)||this}__extends(l,m);l.prototype.getPropertyId=function(){return(e.scale<< 24)+this.boneIndex};l.prototype.apply=function(n,p,q,r,u,w,v){var t=this.frames;n=n.bones[this.boneIndex];if(q=t[t.length-l.ENTRIES])p=t[t.length+l.PREV_X]*n.data.scaleX,r=t[t.length+l.PREV_Y]*n.data.scaleY;else{var x=b.binarySearch(t,q,l.ENTRIES);p=t[x+l.PREV_X];r=t[x+l.PREV_Y];var y=t[x];q=this.getCurvePercent(x/l.ENTRIES- 1,1-(q-y)/(t[x+l.PREV_TIME]-y));p=(p+(t[x+l.X]-p)*q)*n.data.scaleX;r=(r+(t[x+l.Y]-r)*q)*n.data.scaleY}1==u?(n.scaleX=p,n.scaleY=r):(w==c.setup?(w=n.data.scaleX,q=n.data.scaleY):(w=n.scaleX,q=n.scaleY),v==d.out?(p=Math.abs(p)*a.MathUtils.signum(w),r=Math.abs(r)*a.MathUtils.signum(q)):(w=Math.abs(w)*a.MathUtils.signum(p),q=Math.abs(q)*a.MathUtils.signum(r)),n.scaleX=w+(p-w)*u,n.scaleY=q+(r-q)*u)}};return l}(g);a.ScaleTimeline=h;g=function(m){function l(n){return m.call(this,n)||this}__extends(l,m); l.prototype.getPropertyId=function(){return(e.shear<<24)+this.boneIndex};l.prototype.apply=function(n,p,q,r,u,w,v){p=this.frames;n=n.bones[this.boneIndex];if(q=p[p.length-l.ENTRIES])r=p[p.length+l.PREV_X],v=p[p.length+l.PREV_Y];else{var t=b.binarySearch(p,q,l.ENTRIES);r=p[t+l.PREV_X];v=p[t+l.PREV_Y];var x=p[t];q=this.getCurvePercent(t/ l.ENTRIES-1,1-(q-x)/(p[t+l.PREV_TIME]-x));r+=(p[t+l.X]-r)*q;v+=(p[t+l.Y]-v)*q}w==c.setup?(n.shearX=n.data.shearX+r*u,n.shearY=n.data.shearY+v*u):(n.shearX+=(n.data.shearX+r-n.shearX)*u,n.shearY+=(n.data.shearY+v-n.shearY)*u)}};return l}(g);a.ShearTimeline=g;g=function(m){function l(n){var p=m.call(this,n)||this;p.frames=a.Utils.newFloatArray(n*l.ENTRIES);return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.color<<24)+this.slotIndex};l.prototype.setFrame=function(n,p,q,r,u,w){n*=l.ENTRIES; this.frames[n]=p;this.frames[n+l.R]=q;this.frames[n+l.G]=r;this.frames[n+l.B]=u;this.frames[n+l.A]=w};l.prototype.apply=function(n,p,q,r,u,w,v){n=n.slots[this.slotIndex];var t=this.frames;if(q=t[t.length-l.ENTRIES]){q=t.length;p=t[q+l.PREV_R];r=t[q+l.PREV_G];v=t[q+l.PREV_B];var x=t[q+l.PREV_A]}else{var y=b.binarySearch(t,q,l.ENTRIES); p=t[y+l.PREV_R];r=t[y+l.PREV_G];v=t[y+l.PREV_B];x=t[y+l.PREV_A];var z=t[y];q=this.getCurvePercent(y/l.ENTRIES-1,1-(q-z)/(t[y+l.PREV_TIME]-z));p+=(t[y+l.R]-p)*q;r+=(t[y+l.G]-r)*q;v+=(t[y+l.B]-v)*q;x+=(t[y+l.A]-x)*q}1==u?n.color.set(p,r,v,x):(q=n.color,w==c.setup&&q.setFromColor(n.data.color),q.add((p-q.r)*u,(r-q.g)*u,(v-q.b)*u,(x-q.a)*u))}};return l}(f);g.ENTRIES=5;g.PREV_TIME=-5;g.PREV_R=-4;g.PREV_G=-3;g.PREV_B=-2;g.PREV_A=-1;g.R=1;g.G=2;g.B=3;g.A=4;a.ColorTimeline=g;g=function(m){function l(n){var p= m.call(this,n)||this;p.frames=a.Utils.newFloatArray(n*l.ENTRIES);return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.twoColor<<24)+this.slotIndex};l.prototype.setFrame=function(n,p,q,r,u,w,v,t,x){n*=l.ENTRIES;this.frames[n]=p;this.frames[n+l.R]=q;this.frames[n+l.G]=r;this.frames[n+l.B]=u;this.frames[n+l.A]=w;this.frames[n+l.R2]=v;this.frames[n+l.G2]=t;this.frames[n+l.B2]=x};l.prototype.apply=function(n,p,q,r,u,w,v){n=n.slots[this.slotIndex];var t=this.frames;if(q=t[t.length-l.ENTRIES]){q=t.length;p=t[q+l.PREV_R];r=t[q+l.PREV_G];v=t[q+l.PREV_B];var x=t[q+l.PREV_A];var y=t[q+l.PREV_R2];var z=t[q+l.PREV_G2];var B=t[q+l.PREV_B2]}else{var A=b.binarySearch(t,q,l.ENTRIES);p=t[A+l.PREV_R];r=t[A+l.PREV_G];v=t[A+l.PREV_B];x=t[A+l.PREV_A]; y=t[A+l.PREV_R2];z=t[A+l.PREV_G2];B=t[A+l.PREV_B2];var C=t[A];q=this.getCurvePercent(A/l.ENTRIES-1,1-(q-C)/(t[A+l.PREV_TIME]-C));p+=(t[A+l.R]-p)*q;r+=(t[A+l.G]-r)*q;v+=(t[A+l.B]-v)*q;x+=(t[A+l.A]-x)*q;y+=(t[A+l.R2]-y)*q;z+=(t[A+l.G2]-z)*q;B+=(t[A+l.B2]-B)*q}1==u?(n.color.set(p,r,v,x),n.darkColor.set(y,z,B,1)):(q=n.color,t=n.darkColor,w==c.setup&&(q.setFromColor(n.data.color),t.setFromColor(n.data.darkColor)),q.add((p-q.r)*u,(r-q.g)*u,(v-q.b)*u,(x-q.a)*u),t.add((y-t.r)*u,(z-t.g)*u,(B-t.b)*u,0))}}; return l}(f);g.ENTRIES=8;g.PREV_TIME=-8;g.PREV_R=-7;g.PREV_G=-6;g.PREV_B=-5;g.PREV_A=-4;g.PREV_R2=-3;g.PREV_G2=-2;g.PREV_B2=-1;g.R=1;g.G=2;g.B=3;g.A=4;g.R2=5;g.G2=6;g.B2=7;a.TwoColorTimeline=g;g=function(){function m(l){this.frames=a.Utils.newFloatArray(l);this.attachmentNames=Array(l)}m.prototype.getPropertyId=function(){return(e.attachment<<24)+this.slotIndex};m.prototype.getFrameCount=function(){return this.frames.length};m.prototype.setFrame=function(l,n,p){this.frames[l]=n;this.attachmentNames[l]= p};m.prototype.apply=function(l,n,p,q,r,u,w){n=l.slots[this.slotIndex];w==d.out&&u==c.setup?(p=n.data.attachmentName,n.setAttachment(null==p?null:l.getAttachment(this.slotIndex,p))):(w=this.frames,p=w[w.length-1]?w.length-1:b.binarySearch(w,p,1)-1,p=this.attachmentNames[p],l.slots[this.slotIndex].setAttachment(null==p?null:l.getAttachment(this.slotIndex,p))))};return m}();a.AttachmentTimeline= g;var k=null;g=function(m){function l(n){var p=m.call(this,n)||this;p.frames=a.Utils.newFloatArray(n);p.frameVertices=Array(n);null==k&&(k=a.Utils.newFloatArray(64));return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.deform<<27)+ +this.attachment.id+this.slotIndex};l.prototype.setFrame=function(n,p,q){this.frames[n]=p;this.frameVertices[n]=q};l.prototype.apply=function(n,p,q,r,u,w,v){p=n.slots[this.slotIndex];var t=p.getAttachment();if(t instanceof a.VertexAttachment&&t.applyDeform(this.attachment)){v= this.frameVertices;n=v[0].length;p=a.Utils.setArraySize(p.attachmentVertices,n);var x=this.frames;if(q=x[x.length-1])if(r=v[x.length-1],1==u)a.Utils.arrayCopy(r,0,p,0,n);else if(w==c.setup)if(null==t.bones)for(v=t.vertices,q=0;q< n;q++)w=v[q],p[q]=w+(r[q]-w)*u;else for(w=0;wp)this.apply(l,n,Number.MAX_VALUE,q,r,u,w),n=-1;else if(n>=v[t-1])return;if(!(p=v[l];l++)q.push(this.events[l])}}};return m}();a.EventTimeline=g;g=function(){function m(l){this.frames=a.Utils.newFloatArray(l);this.drawOrders=Array(l)}m.prototype.getPropertyId=function(){return e.drawOrder<<24};m.prototype.getFrameCount=function(){return this.frames.length};m.prototype.setFrame=function(l,n,p){this.frames[l]=n;this.drawOrders[l]=p};m.prototype.apply=function(l,n,p,q,r,u,w){n=l.drawOrder;q=l.slots;if(w==d.out&&u==c.setup)a.Utils.arrayCopy(l.slots, 0,l.drawOrder,0,l.slots.length);else if(w=this.frames,p=w[w.length-1]?w.length-1:b.binarySearch(w,p)-1,l=this.drawOrders[l],null==l)a.Utils.arrayCopy(q,0,n,0,q.length);else for(p=0,u=l.length;p=p[p.length-l.ENTRIES])w==c.setup?(n.mix=n.data.mix+(p[p.length+l.PREV_MIX]- n.data.mix)*u,n.bendDirection=v==d.out?n.data.bendDirection:p[p.length+l.PREV_BEND_DIRECTION]):(n.mix+=(p[p.length+l.PREV_MIX]-n.mix)*u,v==d["in"]&&(n.bendDirection=p[p.length+l.PREV_BEND_DIRECTION]));else{r=b.binarySearch(p,q,l.ENTRIES);var t=p[r+l.PREV_MIX],x=p[r];q=this.getCurvePercent(r/l.ENTRIES-1,1-(q-x)/(p[r+l.PREV_TIME]-x));w==c.setup?(n.mix=n.data.mix+(t+(p[r+l.MIX]-t)*q-n.data.mix)*u,n.bendDirection=v==d.out?n.data.bendDirection:p[r+l.PREV_BEND_DIRECTION]):(n.mix+=(t+(p[r+l.MIX]-t)*q-n.mix)* u,v==d["in"]&&(n.bendDirection=p[r+l.PREV_BEND_DIRECTION]))}};return l}(f);g.ENTRIES=3;g.PREV_TIME=-3;g.PREV_MIX=-2;g.PREV_BEND_DIRECTION=-1;g.MIX=1;g.BEND_DIRECTION=2;a.IkConstraintTimeline=g;g=function(m){function l(n){var p=m.call(this,n)||this;p.frames=a.Utils.newFloatArray(n*l.ENTRIES);return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.transformConstraint<<24)+this.transformConstraintIndex};l.prototype.setFrame=function(n,p,q,r,u,w){n*=l.ENTRIES;this.frames[n]=p;this.frames[n+ l.ROTATE]=q;this.frames[n+l.TRANSLATE]=r;this.frames[n+l.SCALE]=u;this.frames[n+l.SHEAR]=w};l.prototype.apply=function(n,p,q,r,u,w,v){p=this.frames;n=n.transformConstraints[this.transformConstraintIndex];if(q=p[p.length-l.ENTRIES]){q=p.length;r=p[q+l.PREV_ROTATE];v=p[q+l.PREV_TRANSLATE];var t=p[q+l.PREV_SCALE];var x=p[q+l.PREV_SHEAR]}else{var y=b.binarySearch(p,q,l.ENTRIES);r=p[y+l.PREV_ROTATE];v=p[y+l.PREV_TRANSLATE];t=p[y+l.PREV_SCALE];x=p[y+l.PREV_SHEAR];var z=p[y];q=this.getCurvePercent(y/l.ENTRIES-1,1-(q-z)/(p[y+l.PREV_TIME]-z));r+=(p[y+l.ROTATE]-r)*q;v+=(p[y+l.TRANSLATE]-v)*q;t+=(p[y+l.SCALE]-t)*q;x+=(p[y+l.SHEAR]-x)*q}w==c.setup?(q=n.data,n.rotateMix=q.rotateMix+ (r-q.rotateMix)*u,n.translateMix=q.translateMix+(v-q.translateMix)*u,n.scaleMix=q.scaleMix+(t-q.scaleMix)*u,n.shearMix=q.shearMix+(x-q.shearMix)*u):(n.rotateMix+=(r-n.rotateMix)*u,n.translateMix+=(v-n.translateMix)*u,n.scaleMix+=(t-n.scaleMix)*u,n.shearMix+=(x-n.shearMix)*u)}};return l}(f);g.ENTRIES=5;g.PREV_TIME=-5;g.PREV_ROTATE=-4;g.PREV_TRANSLATE=-3;g.PREV_SCALE=-2;g.PREV_SHEAR=-1;g.ROTATE=1;g.TRANSLATE=2;g.SCALE=3;g.SHEAR=4;a.TransformConstraintTimeline=g;g=function(m){function l(n){var p=m.call(this, n)||this;p.frames=a.Utils.newFloatArray(n*l.ENTRIES);return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.pathConstraintPosition<<24)+this.pathConstraintIndex};l.prototype.setFrame=function(n,p,q){n*=l.ENTRIES;this.frames[n]=p;this.frames[n+l.VALUE]=q};l.prototype.apply=function(n,p,q,r,u,w,v){p=this.frames;n=n.pathConstraints[this.pathConstraintIndex];if(q= p[p.length-l.ENTRIES])r=p[p.length+l.PREV_VALUE];else{v=b.binarySearch(p,q,l.ENTRIES);r=p[v+l.PREV_VALUE];var t=p[v];q=this.getCurvePercent(v/l.ENTRIES-1,1-(q-t)/(p[v+l.PREV_TIME]-t));r+=(p[v+l.VALUE]-r)*q}n.position=w==c.setup?n.data.position+(r-n.data.position)*u:n.position+(r-n.position)*u}};return l}(f);g.ENTRIES=2;g.PREV_TIME=-2;g.PREV_VALUE=-1;g.VALUE=1;a.PathConstraintPositionTimeline=g;g=function(m){function l(n){return m.call(this,n)||this}__extends(l,m);l.prototype.getPropertyId=function(){return(e.pathConstraintSpacing<< 24)+this.pathConstraintIndex};l.prototype.apply=function(n,p,q,r,u,w,v){p=this.frames;n=n.pathConstraints[this.pathConstraintIndex];if(q=p[p.length-l.ENTRIES])r=p[p.length+l.PREV_VALUE];else{v=b.binarySearch(p,q,l.ENTRIES);r=p[v+l.PREV_VALUE];var t=p[v];q=this.getCurvePercent(v/l.ENTRIES-1,1-(q-t)/(p[v+l.PREV_TIME]-t));r+=(p[v+l.VALUE]-r)*q}n.spacing=w==c.setup?n.data.spacing+ (r-n.data.spacing)*u:n.spacing+(r-n.spacing)*u}};return l}(g);a.PathConstraintSpacingTimeline=g;f=function(m){function l(n){var p=m.call(this,n)||this;p.frames=a.Utils.newFloatArray(n*l.ENTRIES);return p}__extends(l,m);l.prototype.getPropertyId=function(){return(e.pathConstraintMix<<24)+this.pathConstraintIndex};l.prototype.setFrame=function(n,p,q,r){n*=l.ENTRIES;this.frames[n]=p;this.frames[n+l.ROTATE]=q;this.frames[n+l.TRANSLATE]=r};l.prototype.apply=function(n,p,q,r,u,w,v){p=this.frames;n=n.pathConstraints[this.pathConstraintIndex]; if(q=p[p.length-l.ENTRIES])r=p[p.length+l.PREV_ROTATE],v=p[p.length+l.PREV_TRANSLATE];else{var t=b.binarySearch(p,q,l.ENTRIES);r=p[t+l.PREV_ROTATE];v=p[t+l.PREV_TRANSLATE];var x=p[t];q=this.getCurvePercent(t/l.ENTRIES-1,1-(q-x)/(p[t+l.PREV_TIME]-x));r+=(p[t+l.ROTATE]-r)*q;v+= (p[t+l.TRANSLATE]-v)*q}w==c.setup?(n.rotateMix=n.data.rotateMix+(r-n.data.rotateMix)*u,n.translateMix=n.data.translateMix+(v-n.data.translateMix)*u):(n.rotateMix+=(r-n.rotateMix)*u,n.translateMix+=(v-n.translateMix)*u)}};return l}(f);f.ENTRIES=3;f.PREV_TIME=-3;f.PREV_ROTATE=-2;f.PREV_TRANSLATE=-1;f.ROTATE=1;f.TRANSLATE=2;a.PathConstraintMixTimeline=f})(spine||(spine={})); (function(a){var b=function(){function g(h){this.tracks=[];this.events=[];this.listeners=[];this.queue=new d(this);this.propertyIDs=new a.IntSet;this.mixingTo=[];this.animationsChanged=!1;this.timeScale=1;this.trackEntryPool=new a.Pool(function(){return new c});this.data=h}g.prototype.update=function(h){h*=this.timeScale;for(var k=this.tracks,m=0,l=k.length;m=n.trackEnd&&null==n.mixingFrom){k[m]=null;this.queue.end(n);this.disposeNext(n);continue}if(null!=n.mixingFrom&&this.updateMixingFrom(n,h))for(q=n.mixingFrom,n.mixingFrom=null;null!=q;)this.queue.end(q),q=q.mixingFrom;n.trackTime+=p}}this.queue.drain()}; g.prototype.updateMixingFrom=function(h,k){var m=h.mixingFrom;if(null==m)return!0;var l=this.updateMixingFrom(m,k);if(0=h.mixDuration||0==h.timeScale)){if(0==m.totalAlpha||0==h.mixDuration)h.mixingFrom=m.mixingFrom,h.interruptAlpha=m.interruptAlpha,this.queue.end(m);return l}m.animationLast=m.nextAnimationLast;m.trackLast=m.nextTrackLast;m.trackTime+=k*m.timeScale;h.mixTime+=k*h.timeScale;return!1};g.prototype.apply=function(h){if(null==h)throw Error("skeleton cannot be null."); this.animationsChanged&&this._animationsChanged();for(var k=this.events,m=this.tracks,l=!1,n=0,p=m.length;n=q.trackEnd&&null==q.next&&(u=0);var w=q.animationLast,v=q.getAnimationTime(),t=q.animation.timelines.length,x=q.animation.timelines;if(1==u)for(var y=0;y=g.FIRST?a.MixPose.setup:r;C instanceof a.RotateTimeline?this.applyRotateTimeline(C,h,v,u,G,A,y<<1,B):C.apply(h,w,v,k,u,G,a.MixDirection["in"])}}this.queueEvents(q,v);k.length=0;q.nextAnimationLast=v;q.nextTrackLast=q.trackTime}}this.queue.drain();return l};g.prototype.applyMixingFrom=function(h,k,m){var l=h.mixingFrom;null!= l.mixingFrom&&this.applyMixingFrom(l,k,m);if(0==h.mixDuration)var n=1;else n=h.mixTime/h.mixDuration,1=u[u.length-a.RotateTimeline.ENTRIES])u=k.data.rotation+u[u.length+a.RotateTimeline.PREV_ROTATION];else{var w=a.Animation.binarySearch(u,m,a.RotateTimeline.ENTRIES),v=u[w+a.RotateTimeline.PREV_ROTATION],t= u[w];h=h.getCurvePercent((w>>1)-1,1-(m-t)/(u[w+a.RotateTimeline.PREV_TIME]-t));u=u[w+a.RotateTimeline.ROTATION]-v;u=v+(u-360*(16384-(16384.499999999996-u/360|0)))*h+k.data.rotation;u-=360*(16384-(16384.499999999996-u/360|0))}n=n==a.MixPose.setup?k.data.rotation:k.rotation;u-=n;0==u?m=p[q]:(u-=360*(16384-(16384.499999999996-u/360|0)),r?(r=0,m=u):(r=p[q],m=p[q+1]),v=0=Math.abs(m)&&(180l||this.queue.event(h,w)}for((h.loop?p>h.trackTime%n:k>=l&&h.animationLast=this.tracks.length)&&(h=this.tracks[h],null!=h)){this.queue.end(h);this.disposeNext(h);for(var k=h;;){var m=k.mixingFrom;if(null==m)break;this.queue.end(m);k.mixingFrom=null;k=m}this.tracks[h.trackIndex]=null;this.queue.drain()}};g.prototype.setCurrent=function(h,k,m){var l=this.expandToIndex(h);this.tracks[h]= k;null!=l&&(m&&this.queue.interrupt(l),k.mixingFrom=l,k.mixTime=0,null!=l.mixingFrom&&0=l&&(h=n.animationEnd-n.animationStart,l=0!=h?l+(h*(1+(n.trackTime/h|0))-this.data.getMix(n.animation,k)):0));m.delay=l;return m};g.prototype.setEmptyAnimation=function(h,k){h=this.setAnimationWith(h,g.emptyAnimation,!1);h.mixDuration=k;h.trackEnd=k;return h};g.prototype.addEmptyAnimation=function(h,k,m){0>=m&&(m-=k);h=this.addAnimationWith(h, g.emptyAnimation,!1,m);h.mixDuration=k;h.trackEnd=k;return h};g.prototype.setEmptyAnimations=function(h){var k=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var m=0,l=this.tracks.length;m=this.tracks.length?null:this.tracks[h]};g.prototype.addListener=function(h){if(null==h)throw Error("listener cannot be null.");this.listeners.push(h)};g.prototype.removeListener= function(h){h=this.listeners.indexOf(h);0<=h&&this.listeners.splice(h,1)};g.prototype.clearListeners=function(){this.listeners.length=0};g.prototype.clearListenerNotifications=function(){this.queue.clear()};return g}();b.emptyAnimation=new a.Animation("",[],0);b.SUBSEQUENT=0;b.FIRST=1;b.DIP=2;b.DIP_MIX=3;a.AnimationState=b;var c=function(){function g(){this.timelineData=[];this.timelineDipMix=[];this.timelinesRotation=[]}g.prototype.reset=function(){this.listener=this.animation=this.mixingFrom= this.next=null;this.timelineData.length=0;this.timelineDipMix.length=0;this.timelinesRotation.length=0};g.prototype.setTimelineData=function(h,k,m){null!=h&&k.push(h);var l=null!=this.mixingFrom?this.mixingFrom.setTimelineData(this,k,m):this;null!=h&&k.pop();var n=k.length-1,p=this.animation.timelines,q=this.animation.timelines.length,r=a.Utils.setArraySize(this.timelineData,q);this.timelineDipMix.length=0;var u=a.Utils.setArraySize(this.timelineDipMix,q),w=0;a:for(;w=this.animationEnd-this.animationStart};g.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0};return g}();a.TrackEntry=c;var d=function(){function g(h){this.objects=[];this.drainDisabled=!1;this.animState=h}g.prototype.start=function(h){this.objects.push(e.start);this.objects.push(h);this.animState.animationsChanged= !0};g.prototype.interrupt=function(h){this.objects.push(e.interrupt);this.objects.push(h)};g.prototype.end=function(h){this.objects.push(e.end);this.objects.push(h);this.animState.animationsChanged=!0};g.prototype.dispose=function(h){this.objects.push(e.dispose);this.objects.push(h)};g.prototype.complete=function(h){this.objects.push(e.complete);this.objects.push(h)};g.prototype.event=function(h,k){this.objects.push(e.event);this.objects.push(h);this.objects.push(k)};g.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled= !0;for(var h=this.objects,k=this.animState.listeners,m=0;mh.status?(g.assets[d]=h.responseText,e&&e(d,h.responseText)):(g.errors[d]="Couldn't load text "+d+": status "+ h.status+", "+h.responseText,f&&f(d,"Couldn't load text "+d+": status "+h.status+", "+h.responseText)),g.toLoad--,g.loaded++)};h.open("GET",d,!0);h.send()};c.prototype.loadTexture=function(d,e,f){var g=this;void 0===e&&(e=null);void 0===f&&(f=null);d=this.pathPrefix+d;this.toLoad++;var h=new Image;h.crossOrigin="anonymous";h.onload=function(k){k=g.textureLoader(h);g.assets[d]=k;g.toLoad--;g.loaded++;e&&e(d,h)};h.onerror=function(k){g.errors[d]="Couldn't load image "+d;g.toLoad--;g.loaded++;f&&f(d, "Couldn't load image "+d)};h.src=d};c.prototype.loadTextureData=function(d,e,f,g){var h=this;void 0===f&&(f=null);void 0===g&&(g=null);d=this.pathPrefix+d;this.toLoad++;var k=new Image;k.onload=function(m){m=h.textureLoader(k);h.assets[d]=m;h.toLoad--;h.loaded++;f&&f(d,k)};k.onerror=function(m){h.errors[d]="Couldn't load image "+d;h.toLoad--;h.loaded++;g&&g(d,"Couldn't load image "+d)};k.src=e};c.prototype.get=function(d){d=this.pathPrefix+d;return this.assets[d]};c.prototype.remove=function(d){d= this.pathPrefix+d;var e=this.assets[d];e.dispose&&e.dispose();this.assets[d]=null};c.prototype.removeAll=function(){for(var d in this.assets){var e=this.assets[d];e.dispose&&e.dispose()}this.assets={}};c.prototype.isLoadingComplete=function(){return 0==this.toLoad};c.prototype.getToLoad=function(){return this.toLoad};c.prototype.getLoaded=function(){return this.loaded};c.prototype.dispose=function(){this.removeAll()};c.prototype.hasErrors=function(){return 0p*u-q*r:this.skeleton.flipX!=this.skeleton.flipY)e=-e,w=-w;this.a=f*l+e*g;this.b=f*n+e*h;this.c=d*l+w*g;this.d=d*n+w*h;return}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b);this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)}};c.prototype.setToSetupPose=function(){var d=this.data;this.x=d.x;this.y=d.y;this.rotation=d.rotation;this.scaleX=d.scaleX;this.scaleY=d.scaleY;this.shearX=d.shearX;this.shearY=d.shearY};c.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*a.MathUtils.radDeg}; c.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*a.MathUtils.radDeg};c.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)};c.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)};c.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var d=this.parent;if(null==d)this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*a.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c* this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*a.MathUtils.radDeg;else{var e=d.a,f=d.b,g=d.c,h=d.d,k=1/(e*h-f*g),m=this.worldX-d.worldX;d=this.worldY-d.worldY;this.ax=m*h*k-d*f*k;this.ay=d*e*k-m*g*k;h*=k;e*=k;f*=k;k*=g;g=h*this.a-f*this.c;f=h*this.b-f*this.d;h=e*this.c-k*this.a;k=e*this.d-k*this.b;this.ashearX=0;this.ascaleX=Math.sqrt(g*g+h*h);1E-4d)throw Error("index must be >= 0.");if(null==e)throw Error("name cannot be null.");this.index=d;this.name=e;this.parent=f}}();a.BoneData=b;var c;(function(d){d[d.Normal=0]="Normal";d[d.OnlyTranslation=1]="OnlyTranslation";d[d.NoRotationOrReflection=2]="NoRotationOrReflection";d[d.NoScale=3]="NoScale";d[d.NoScaleOrReflection=4]="NoScaleOrReflection"})(c= a.TransformMode||(a.TransformMode={}))})(spine||(spine={}));(function(a){var b=function(){return function(c,d){if(null==d)throw Error("data cannot be null.");this.time=c;this.data=d}}();a.Event=b})(spine||(spine={}));(function(a){var b=function(){return function(c){this.name=c}}();a.EventData=b})(spine||(spine={})); (function(a){var b=function(){function c(d,e){this.mix=1;this.bendDirection=0;if(null==d)throw Error("data cannot be null.");if(null==e)throw Error("skeleton cannot be null.");this.data=d;this.mix=d.mix;this.bendDirection=d.bendDirection;this.bones=[];for(var f=0;fd.ascaleX&&(h+=180);180h&&(h+=360);d.updateWorldTransformWith(d.ax,d.ay, d.arotation+h*g,d.ascaleX,d.ascaleY,d.ashearX,d.ashearY)};c.prototype.apply2=function(d,e,f,g,h,k){if(0==k)e.updateWorldTransform();else{d.appliedValid||d.updateAppliedTransform();e.appliedValid||e.updateAppliedTransform();var m=d.ax,l=d.ay,n=d.ascaleX,p=d.ascaleY,q=e.ascaleX;if(0>n){n=-n;var r=180;var u=-1}else r=0,u=1;0>p&&(p=-p,u=-u);if(0>q){q=-q;var w=180}else w=0;var v=e.ax,t=d.a,x=d.b,y=d.c,z=d.d,B=1E-4>=Math.abs(n-p);if(B){var A=e.ay;var C=t*v+x*A+d.worldX;var G=y*v+z*A+d.worldY}else A=0,C= t*v+d.worldX,G=y*v+d.worldY;var E=d.parent;t=E.a;x=E.b;y=E.c;z=E.d;var F=1/(t*z-x*y);f-=E.worldX;g-=E.worldY;var K=(f*z-g*x)*F-m,H=(g*t-f*y)*F-l;f=C-E.worldX;g=G-E.worldY;x=(f*z-g*x)*F-m;t=(g*t-f*y)*F-l;f=Math.sqrt(x*x+t*t);x=e.data.length*q;a:if(B)x*=n,t=(K*K+H*H-f*f-x*x)/(2*f*x),-1>t?t=-1:1H&& (z=-z),z=-(H+z)/2,H=z/F,y/=z,y=Math.abs(H)=y&&(y=Math.acos(y),f=t*Math.cos(y)+f,g=x*Math.sin(y),z=f*f+g*g,zE&&(p=y,E=z,G=f,L=g));B<=(F+E)/2?(t=K-Math.atan2(C*h,H),h*=n):(t=K-Math.atan2(L*h,G),h*=p)}x=Math.atan2(A,v)*u;y=d.arotation;t=(t-x)*a.MathUtils.radDeg+r-y;180t&&(t+=360);d.updateWorldTransformWith(m, l,y+t*k,d.ascaleX,d.ascaleY,0,0);y=e.arotation;h=((h+x)*a.MathUtils.radDeg-e.ashearX)*u+w-y;180h&&(h+=360);e.updateWorldTransformWith(v,A,y+h*k,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}};return c}();a.IkConstraint=b})(spine||(spine={}));(function(a){var b=function(){return function(c){this.order=0;this.bones=[];this.mix=this.bendDirection=1;this.name=c}}();a.IkConstraintData=b})(spine||(spine={})); (function(a){var b=function(){function c(d,e){this.translateMix=this.rotateMix=this.spacing=this.position=0;this.spaces=[];this.positions=[];this.world=[];this.curves=[];this.lengths=[];this.segments=[];if(null==d)throw Error("data cannot be null.");if(null==e)throw Error("skeleton cannot be null.");this.data=d;this.bones=[];for(var f=0,g=d.bones.length;fa.MathUtils.PI?E-=a.MathUtils.PI2:E<-a.MathUtils.PI&&(E+=a.MathUtils.PI2);E*=e;F=Math.cos(E);K=Math.sin(E);z.a=F*A-K*B;z.b=F*C-K*G;z.c=K*A+F*B;z.d=K*C+F*G}z.appliedValid=!1}}}};c.prototype.computeWorldPositions= function(d,e,f,g,h){var k=this.target,m=this.position,l=this.spaces,n=a.Utils.setArraySize(this.positions,3*e+2),p=d.closed,q=d.worldVerticesLength,r=q/6,u=c.NONE;if(!d.constantSpeed){var w=d.lengths;r-=p?1:2;var v=w[r];g&&(m*=v);if(h)for(var t=0;tz&&(z+=v),h=0;else if(0>z){u!=c.BEFORE&&(u=c.BEFORE,d.computeWorldVertices(k,2,4,x,0,2));this.addBeforePosition(z,x,0,n,g);continue}else if(z> v){u!=c.AFTER&&(u=c.AFTER,d.computeWorldVertices(k,q-6,4,x,0,2));this.addAfterPosition(z-v,x,0,n,g);continue}for(;;h++){var B=w[h];if(!(z>B)){if(0==h)z/=B;else{var A=w[h-1];z=(z-A)/(B-A)}break}}h!=u&&(u=h,p&&h==r?(d.computeWorldVertices(k,q-4,4,x,0,2),d.computeWorldVertices(k,0,4,x,4,2)):d.computeWorldVertices(k,6*h+2,8,x,0,2));this.addCurvePosition(z,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],n,g,f||0z&&(z+=k),h=0;else if(0>z){this.addBeforePosition(z,x,0,n,g);continue}else if(z>k){this.addAfterPosition(z-k,x,q-4,n,g);continue}for(;;h++)if(M=d[h],!(z>M)){0==h?z/=M:(A=d[h-1],z=(z-A)/(M-A));break}if(h!=u){u=h;var P=6*h;w=x[P];v=x[P+1];B=x[P+2];C=x[P+3];G=x[P+ 4];E=x[P+5];F=x[P+6];K=x[P+7];H=.03*(w-2*B+G);L=.03*(v-2*C+E);A=.006*(3*(B-G)-w+F);D=.006*(3*(C-E)-v+K);M=2*H+A;O=2*L+D;H=.3*(B-w)+H+.16666667*A;L=.3*(C-v)+L+.16666667*D;Q=Math.sqrt(H*H+L*L);r[0]=Q;for(P=1;8>P;P++)H+=M,L+=O,M+=A,O+=D,Q+=Math.sqrt(H*H+L*L),r[P]=Q;H+=M;L+=O;Q+=Math.sqrt(H*H+L*L);r[8]=Q;H+=M+A;L+=O+D;Q+=Math.sqrt(H*H+L*L);r[9]=Q;D=0}for(z*=Q;;D++)if(M=r[D],!(z>M)){0==D?z/=M:(A=r[D-1],z=D+(z-A)/(M-A));break}this.addCurvePosition(.1*z,w,v,B,C,G,E,F,K,n,g,f||0h.status?g.rawAssets[f]=h.responseText:g.errors[f]="Couldn't load text "+f+": status "+h.status+", "+h.responseText)};h.open("GET",f,!0);h.send()}};d.prototype.loadJson=function(e,f){var g=this;f=this.pathPrefix+f;if(this.queueAsset(e,null,f)){var h= new XMLHttpRequest;h.onreadystatechange=function(){h.readyState==XMLHttpRequest.DONE&&(200<=h.status&&300>h.status?g.rawAssets[f]=JSON.parse(h.responseText):g.errors[f]="Couldn't load text "+f+": status "+h.status+", "+h.responseText)};h.open("GET",f,!0);h.send()}};d.prototype.loadTexture=function(e,f,g){var h=this;g=this.pathPrefix+g;if(this.queueAsset(e,f,g)){var k=new Image;k.src=g;k.crossOrigin="anonymous";k.onload=function(m){h.rawAssets[g]=k};k.onerror=function(m){h.errors[g]="Couldn't load image "+ g}}};d.prototype.get=function(e,f){f=this.pathPrefix+f;e=this.clientAssets[e];return null===e||void 0===e?!0:e.assets[f]};d.prototype.updateClientAssets=function(e){for(var f=0;f=this.minX&&d<=this.maxX&&e>=this.minY&&e<=this.maxY};c.prototype.aabbIntersectsSegment=function(d,e,f,g){var h=this.minX,k=this.minY,m=this.maxX,l=this.maxY;if(d<=h&&f<=h||e<=k&&g<=k||d>=m&&f>=m||e>=l&&g>=l)return!1;f=(g-e)/(f-d);g=f*(h-d)+e;if(g>k&&gk&&gh&&kh&&kd.minX&&this.minYd.minY};c.prototype.containsPoint=function(d,e){for(var f=this.polygons,g=0,h=f.length;g=f||n=f){var p=d[m]; p+(f-l)/(n-l)*(d[h]-p)=p&&t<=u||t>=u&&t<=p)&&(t>=e&&t<=g||t>=g&&t<=e)&&(p=(n*x-l*v)/y,(p>= q&&p<=w||p>=w&&p<=q)&&(p>=f&&p<=h||p>=h&&p<=f)))return!0;p=u;q=w}return!1};c.prototype.getPolygon=function(d){if(null==d)throw Error("boundingBox cannot be null.");d=this.boundingBoxes.indexOf(d);return-1==d?null:this.polygons[d]};c.prototype.getWidth=function(){return this.maxX-this.minX};c.prototype.getHeight=function(){return this.maxY-this.minY};return c}();a.SkeletonBounds=b})(spine||(spine={})); (function(a){var b=function(){function c(){this.triangulator=new a.Triangulator;this.clippingPolygon=[];this.clipOutput=[];this.clippedVertices=[];this.clippedTriangles=[];this.scratch=[]}c.prototype.clipStart=function(d,e){if(null!=this.clipAttachment)return 0;this.clipAttachment=e;var f=e.worldVerticesLength,g=a.Utils.setArraySize(this.clippingPolygon,f);e.computeWorldVertices(d,0,f,g,0,2);d=this.clippingPolygon;c.makeClockwise(d);d=this.clippingPolygons=this.triangulator.decompose(d,this.triangulator.triangulate(d)); e=0;for(f=d.length;e>1, ca=this.clipOutput,J=a.Utils.setArraySize(n,D+X*u),aa=0;aaf))for(l=0,f=e-2,n=e>>1;l=g.length&&(g.length=d+1);g[d]||(g[d]={});g[d][e]=f};c.prototype.getAttachment=function(d,e){return(d=this.attachments[d])?d[e]:null};c.prototype.attachAll=function(d,e){for(var f=0,g=0;gc)throw Error("index must be >= 0.");if(null==d)throw Error("name cannot be null.");if(null==e)throw Error("boneData cannot be null.");this.index=c;this.name=d;this.boneData=e}}();a.SlotData=b})(spine||(spine={})); (function(a){var b=function(){function e(f){this._image=f}e.prototype.getImage=function(){return this._image};e.filterFromString=function(f){switch(f.toLowerCase()){case "nearest":return c.Nearest;case "linear":return c.Linear;case "mipmap":return c.MipMap;case "mipmapnearestnearest":return c.MipMapNearestNearest;case "mipmaplinearnearest":return c.MipMapLinearNearest;case "mipmapnearestlinear":return c.MipMapNearestLinear;case "mipmaplinearlinear":return c.MipMapLinearLinear;default:throw Error("Unknown texture filter "+ f);}};e.wrapFromString=function(f){switch(f.toLowerCase()){case "mirroredtepeat":return d.MirroredRepeat;case "clamptoedge":return d.ClampToEdge;case "repeat":return d.Repeat;default:throw Error("Unknown texture wrap "+f);}};return e}();a.Texture=b;var c;(function(e){e[e.Nearest=9728]="Nearest";e[e.Linear=9729]="Linear";e[e.MipMap=9987]="MipMap";e[e.MipMapNearestNearest=9984]="MipMapNearestNearest";e[e.MipMapLinearNearest=9985]="MipMapLinearNearest";e[e.MipMapNearestLinear=9986]="MipMapNearestLinear"; e[e.MipMapLinearLinear=9987]="MipMapLinearLinear"})(c=a.TextureFilter||(a.TextureFilter={}));var d;(function(e){e[e.MirroredRepeat=33648]="MirroredRepeat";e[e.ClampToEdge=33071]="ClampToEdge";e[e.Repeat=10497]="Repeat"})(d=a.TextureWrap||(a.TextureWrap={}));b=function(){return function(){this.height=this.width=this.v2=this.u2=this.v=this.u=0;this.rotate=!1;this.originalHeight=this.originalWidth=this.offsetY=this.offsetX=0}}();a.TextureRegion=b})(spine||(spine={})); (function(a){var b=function(){function f(g,h){this.pages=[];this.regions=[];this.load(g,h)}f.prototype.load=function(g,h){if(null==h)throw Error("textureLoader cannot be null.");g=new c(g);for(var k=Array(4),m=null;;){var l=g.readLine();if(null==l)break;l=l.trim();if(0==l.length)m=null;else if(m){var n=new e;n.name=l;n.page=m;n.rotate="true"==g.readValue();g.readTuple(k);l=parseInt(k[0]);var p=parseInt(k[1]);g.readTuple(k);var q=parseInt(k[0]),r=parseInt(k[1]);n.u=l/m.width;n.v=p/m.height;n.rotate? (n.u2=(l+r)/m.width,n.v2=(p+q)/m.height):(n.u2=(l+q)/m.width,n.v2=(p+r)/m.height);n.x=l;n.y=p;n.width=Math.abs(q);n.height=Math.abs(r);4==g.readTuple(k)&&4==g.readTuple(k)&&g.readTuple(k);n.originalWidth=parseInt(k[0]);n.originalHeight=parseInt(k[1]);g.readTuple(k);n.offsetX=parseInt(k[0]);n.offsetY=parseInt(k[1]);n.index=parseInt(g.readValue());n.texture=m.texture;this.regions.push(n)}else m=new d,m.name=l,2==g.readTuple(k)&&(m.width=parseInt(k[0]),m.height=parseInt(k[1]),g.readTuple(k)),g.readTuple(k), m.minFilter=a.Texture.filterFromString(k[0]),m.magFilter=a.Texture.filterFromString(k[1]),n=g.readValue(),m.uWrap=a.TextureWrap.ClampToEdge,m.vWrap=a.TextureWrap.ClampToEdge,"x"==n?m.uWrap=a.TextureWrap.Repeat:"y"==n?m.vWrap=a.TextureWrap.Repeat:"xy"==n&&(m.uWrap=m.vWrap=a.TextureWrap.Repeat),m.texture=h(l),m.texture.setFilters(m.minFilter,m.magFilter),m.texture.setWraps(m.uWrap,m.vWrap),m.width=m.texture.getImage().width,m.height=m.texture.getImage().height,this.pages.push(m)}};f.prototype.findRegion= function(g){for(var h=0;h=this.lines.length?null:this.lines[this.index++]};f.prototype.readValue=function(){var g=this.readLine(), h=g.indexOf(":");if(-1==h)throw Error("Invalid line: "+g);return g.substring(h+1).trim()};f.prototype.readTuple=function(g){var h=this.readLine(),k=h.indexOf(":");if(-1==k)throw Error("Invalid line: "+h);var m=0;for(k+=1;3>m;m++){var l=h.indexOf(",",k);if(-1==l)break;g[m]=h.substr(k,l-k).trim();k=l+1}g[m]=h.substring(k).trim();return m+1};return f}(),d=function(){return function(){}}();a.TextureAtlasPage=d;var e=function(f){function g(){return null!==f&&f.apply(this,arguments)||this}__extends(g,f); return g}(a.TextureRegion);a.TextureAtlasRegion=e})(spine||(spine={})); (function(a){var b=function(){function c(d,e){this.shearMix=this.scaleMix=this.translateMix=this.rotateMix=0;this.temp=new a.Vector2;if(null==d)throw Error("data cannot be null.");if(null==e)throw Error("skeleton cannot be null.");this.data=d;this.rotateMix=d.rotateMix;this.translateMix=d.translateMix;this.scaleMix=d.scaleMix;this.shearMix=d.shearMix;this.bones=[];for(var f=0;fa.MathUtils.PI?B-=a.MathUtils.PI2:B<-a.MathUtils.PI&&(B+=a.MathUtils.PI2);B*=d;var A=Math.cos(B);B=Math.sin(B);v.a=A*x-B*y;v.b=A*t-B*z;v.c=B*x+A*y;v.d=B*t+A*z;t=!0}0!=e&&(t=this.temp,h.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(t.x-v.worldX)*e,v.worldY+=(t.y-v.worldY)*e,t=!0);0a.MathUtils.PI?B-=a.MathUtils.PI2:B<-a.MathUtils.PI&&(B+=a.MathUtils.PI2),B=x+(B+p)*g,t=Math.sqrt(t*t+z*z),v.b=Math.cos(B)*t,v.d=Math.sin(B)*t,t=!0);t&&(v.appliedValid=!1)}};c.prototype.applyRelativeWorld=function(){var d=this.rotateMix,e=this.translateMix,f=this.scaleMix, g=this.shearMix,h=this.target,k=h.a,m=h.b,l=h.c,n=h.d,p=0a.MathUtils.PI?B-=a.MathUtils.PI2:B<-a.MathUtils.PI&&(B+=a.MathUtils.PI2);B*=d;var A=Math.cos(B);B=Math.sin(B);v.a=A*t-B*y;v.b=A*x-B*z;v.c=B*t+A*y;v.d=B*x+A*z;t=!0}0!=e&&(t=this.temp,h.localToWorld(t.set(this.data.offsetX, this.data.offsetY)),v.worldX+=t.x*e,v.worldY+=t.y*e,t=!0);0a.MathUtils.PI?B-=a.MathUtils.PI2:B<-a.MathUtils.PI&&(B+=a.MathUtils.PI2),x=v.b,z=v.d,B=Math.atan2(z,x)+(B-a.MathUtils.PI/2+p)*g,t=Math.sqrt(x*x+z*z),v.b=Math.cos(B)*t,v.d=Math.sin(B)*t,t=!0);t&&(v.appliedValid=!1)}};c.prototype.applyAbsoluteLocal=function(){var d= this.rotateMix,e=this.translateMix,f=this.scaleMix,g=this.shearMix,h=this.target;h.appliedValid||h.updateAppliedTransform();for(var k=this.bones,m=0,l=k.length;m>1,f=this.indicesArray,g=f.length=0;gthis.r?this.r=0:1this.g?this.g=0:1this.b?this.b=0:1this.a?this.a=0:1f?f:d};c.cosDeg=function(d){return Math.cos(d*c.degRad)};c.sinDeg=function(d){return Math.sin(d* c.degRad)};c.signum=function(d){return 0d?-1:0};c.toInt=function(d){return 0d?-e:e};c.randomTriangular=function(d,e){return c.randomTriangularWith(d,e,.5*(d+e))};c.randomTriangularWith=function(d,e,f){var g=Math.random(),h=e-d;return g<=(f-d)/h?d+Math.sqrt(g*h*(f-d)):e-Math.sqrt((1-g)*h*(e-f))};return c}();b.PI=3.1415927;b.PI2=2*b.PI;b.radiansToDegrees=180/b.PI;b.radDeg=b.radiansToDegrees;b.degreesToRadians= b.PI/180;b.degRad=b.degreesToRadians;a.MathUtils=b;b=function(){function c(){}c.prototype.apply=function(d,e,f){return d+(e-d)*this.applyInternal(f)};return c}();a.Interpolation=b;b=function(c){function d(e){var f=c.call(this)||this;f.power=2;f.power=e;return f}__extends(d,c);d.prototype.applyInternal=function(e){return.5>=e?Math.pow(2*e,this.power)/2:Math.pow(2*(e-1),this.power)/(0==this.power%2?-2:2)+1};return d}(b);a.Pow=b;b=function(c){function d(e){return c.call(this,e)||this}__extends(d,c); d.prototype.applyInternal=function(e){return Math.pow(e-1,this.power)*(0==this.power%2?-1:1)+1};return d}(b);a.PowOut=b;b=function(){function c(){}c.arrayCopy=function(d,e,f,g,h){for(var k=e;k=e?d:c.setArraySize(d,e,f)};c.newArray=function(d,e){for(var f=Array(d),g=0;gthis.maxDelta&&(this.delta=this.maxDelta);this.lastTime=d;this.frameCount++;1=this.values.length};c.prototype.addValue=function(d){this.addedValuesthis.values.length-1&&(this.lastValue=0);this.dirty=!0};c.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var d=0,e=0;e>1)*m;var l=e.bone.skeleton,n=e.attachmentVertices,p=this.vertices,q=this.bones;if(null==q){0.5*(cc.BATCH_VERTEX_COUNT-200);!r&&u&&(cc.renderer._batchRendering(),f.showDrawCall&&f.showDrawCall({batchBroken:r,uploadAll:u,vertexDataOffset:e,vertCount:q}),r=!0);r&&(e=0);r=null;if(p instanceof a.RegionAttachment)r=this._uploadRegionAttachmentData(p,n,m,c,d,e);else if(p instanceof a.MeshAttachment)this._uploadMeshAttachmentData(p, n,m,c,d,e);else continue;this._node._debugSlots&&(l[g]=r);p instanceof a.RegionAttachment?cc.renderer._increaseBatchingSize(q,cc.renderer.VertexType.TRIANGLE):cc.renderer._increaseBatchingSize(q,cc.renderer.VertexType.CUSTOM,p.triangles);e+=6*q}}}if(f._debugBones||f._debugSlots){cc.renderer._batchRendering();g=this._worldTransform;k=this._matrix.mat;k[0]=g.a;k[4]=g.c;k[12]=g.tx;k[1]=g.b;k[5]=g.d;k[13]=g.ty;cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.current_stack.stack.push(cc.current_stack.top);cc.current_stack.top= this._matrix;c=cc._drawingUtil;if(f._debugSlots&&l&&0x;x++){var y=4>x?x%3:x- 2,z=k[2*y],B=k[2*y+1],A=z*e+B*u+v,C=c.a*p<<24|c.b*n<<16|c.g*l<<8|c.r*m;f[h]=z*r+B*d+w;f[h+1]=A;f[h+2]=t;g[h+3]=C;f[h+4]=q[2*y];f[h+5]=q[2*y+1];h+=6}if(this._node._debugSlots)return f=a.RegionAttachment,[cc.p(k[f.OX1],k[f.OY1]),cc.p(k[f.OX2],k[f.OY2]),cc.p(k[f.OX3],k[f.OY3]),cc.p(k[f.OX4],k[f.OY4])]};b._uploadMeshAttachmentData=function(c,d,e,f,g,h){var k=this._worldTransform,m=k.a,l=k.b,n=k.c,p=k.d,q=k.tx;k=k.ty;var r=this._node.vertexZ,u=c.worldVerticesLength,w=a.Utils.setArraySize([],u,0);c.computeWorldVertices(d, 0,u,w,0,2);u=c.uvs;var v=d.bone.skeleton.color;d=d.color;var t=c.color,x=v.a*d.a*t.a;e=e?x:1;c=c.tempColor;c.set(v.r*d.r*t.r*e,v.g*d.g*t.g*e,v.b*d.b*t.b*e,x);d=this._displayedColor;e=d.r;v=d.g;d=d.b;t=this._displayedOpacity;x=0;for(var y=w.length;xd;++d)a.push(String.fromCharCode(this.data[this.pos++]));a=a.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(e);break;case "fcTL":c&&this.animation.frames.push(c);this.pos+=4;c={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};a=this.readUInt16();e=this.readUInt16()||100;c.delay=1E3*a/e;c.disposeOp=this.data[this.pos++];c.blendOp=this.data[this.pos++]; c.data=[];break;case "IDAT":case "fdAT":"fdAT"===a&&(this.pos+=4,e-=4);a=(null!=c?c.data:void 0)||this.imgData;for(d=0;0<=e?de;0<=e?++d:--d)a.push(this.data[this.pos++]);break;case "tRNS":this.transparency={};switch(this.colorType){case 3:this.transparency.indexed=this.read(e);e=255-this.transparency.indexed.length;if(0e;0<=e?++a:--a)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break; case "tEXt":d=this.read(e);e=d.indexOf(0);a=String.fromCharCode.apply(String,d.slice(0,e));this.text[a]=String.fromCharCode.apply(String,d.slice(e+1));break;case "IEND":c&&this.animation.frames.push(c);a:{switch(this.colorType){case 0:case 3:case 4:c=1;break a;case 2:case 6:c=3;break a}c=void 0}this.colors=c;this.hasAlphaChannel=4===(b=this.colorType)||6===b;b=this.colors+(this.hasAlphaChannel?1:0);this.pixelBitlength=this.bits*b;a:{switch(this.colors){case 1:b="DeviceGray";break a;case 3:b="DeviceRGB"; break a}b=void 0}this.colorSpace=b;Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData));return;default:this.pos+=e}this.pos+=4;if(this.pos>this.data.length)throw Error("Incomplete or corrupt PNG file");}},read:function(a){var b;var c=[];for(b=0;0<=a?ba;0<=a?++b:--b)c.push(this.data[this.pos++]);return c},readUInt32:function(){var a=this.data[this.pos++]<<24;var b=this.data[this.pos++]<<16;var c=this.data[this.pos++]<<8;var d=this.data[this.pos++];return a|b|c|d},readUInt16:function(){var a= this.data[this.pos++]<<8;var b=this.data[this.pos++];return a|b},decodePixels:function(a){var b,c,d,e,f,g,h,k;null==a&&(a=this.imgData);if(0===a.length)return new Uint8Array(0);a=(new Zlib.Inflate(a,{index:0,verify:!1})).decompress();var m=this.pixelBitlength/8;var l=m*this.width;var n=new Uint8Array(l*this.height);var p=a.length;for(c=e=f=0;e=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;if(0>=d)console.log("No bits requested");else if(8>=d){var e=24+c;var f=this.getUint8(b)}else 16>=d?(e=16+c,f=this.getUint16(b)):32>=d?(e=c,f=this.getUint32(b)): console.log("Too many bits requested");return{bits:f<>>a,byteOffset:b+Math.floor(d/8),bitOffset:d%8}},parseFileDirectory:function(a){var b=this.getUint16(a),c=[];a+=2;for(var d=0;d=x?E=x+1:-127<=x&&-1>=x?F=-x+1:y=!0}else{var K=this.getUint8(u+v);for(x= 0;x=this._totalParticles}, updateQuadWithParticle:function(a,b){this._renderCmd.updateQuadWithParticle(a,b)},postStep:function(){this._renderCmd.postStep()},update:function(a){if(this._isActive&&this.emissionRate){var b=1/this.emissionRate;this.particleCountb;)this.addParticle(),this._emitCounter-=b;this._elapsed+=a;-1!==this.duration&&this.durationb?b:200};a.addParticle=function(){var b=this._node,c=b._particles;b.particleCountc._allocatedParticles){var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._indices=new Uint16Array(6*b);var e=new ArrayBuffer(b*d),f=c._particles;f.length=0;for(var g=this._quads, h=g.length=0;ha.height){a=16;var b=12}else a=12,b=16;a=this.actionWithSize(cc.size(a,b));b=this._gridProxy;this._back?(b.setTarget(this._inScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),this._inScene.visible=!1,b.runAction(cc.sequence(a,cc.callFunc(this.finish,this),cc.stopGrid())),this._inScene.runAction(cc.show())):(b.setTarget(this._outScene),b._performRecursive(cc.Node._stateCallbackType.onEnter),b.runAction(cc.sequence(a,cc.callFunc(this.finish,this), cc.stopGrid())))},visit:function(){this._back?this._outScene.visit():this._inScene.visit();this._gridProxy.visit()},_sceneOrder:function(){this._isInSceneOnTop=this._back}});cc.TransitionPageTurn.create=function(a,b,c){return new cc.TransitionPageTurn(a,b,c)};cc._globalFontSize=cc.ITEM_SIZE;cc._globalFontName="Arial";cc._globalFontNameRelease=!1; cc.MenuItem=cc.Node.extend({_enabled:!1,_target:null,_callback:null,_isSelected:!1,_className:"MenuItem",ctor:function(a,b){var c=cc.Node.prototype;c.ctor.call(this);this._callback=this._target=null;this._enabled=this._isSelected=!1;c.setAnchorPoint.call(this,.5,.5);this._target=b||null;if(this._callback=a||null)this._enabled=!0},isSelected:function(){return this._isSelected},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},setTarget:function(a,b){this._target=b;this._callback= a},isEnabled:function(){return this._enabled},setEnabled:function(a){this._enabled=a},initWithCallback:function(a,b){this.anchorY=this.anchorX=.5;this._target=b;this._callback=a;this._enabled=!0;this._isSelected=!1;return!0},rect:function(){var a=this._position,b=this._contentSize,c=this._anchorPoint;return cc.rect(a.x-b.width*c.x,a.y-b.height*c.y,b.width,b.height)},selected:function(){this._isSelected=!0},unselected:function(){this._isSelected=!1},setCallback:function(a,b){this._target=b;this._callback= a},activate:function(){if(this._enabled){var a=this._target,b=this._callback;if(b)if(a&&cc.isString(b))a[b](this);else a&&cc.isFunction(b)?b.call(a,this):b(this)}}});cc.MenuItem.prototype.enabled;cc.defineGetterSetter(cc.MenuItem.prototype,"enabled",cc.MenuItem.prototype.isEnabled,cc.MenuItem.prototype.setEnabled);cc.MenuItem.create=function(a,b){return new cc.MenuItem(a,b)}; cc.MenuItemLabel=cc.MenuItem.extend({_disabledColor:null,_label:null,_originalScale:0,_colorBackup:null,ctor:function(a,b,c){cc.MenuItem.prototype.ctor.call(this,b,c);this._colorBackup=this._label=this._disabledColor=null;a&&(this._originalScale=1,this._colorBackup=cc.color.WHITE,this._disabledColor=cc.color(126,126,126),this.setLabel(a),a.textureLoaded&&!a.textureLoaded()&&a.addEventListener("load",function(d){this.width=d.width;this.height=d.height;this.parent instanceof cc.Menu&&this.parent.updateAlign()}, this),this.setCascadeColorEnabled(!0),this.setCascadeOpacityEnabled(!0))},getDisabledColor:function(){return this._disabledColor},setDisabledColor:function(a){this._disabledColor=a},getLabel:function(){return this._label},setLabel:function(a){a&&(this.addChild(a),a.anchorX=0,a.anchorY=0,this.width=a.width,this.height=a.height,a.setCascadeColorEnabled(!0));this._label&&this.removeChild(this._label,!0);this._label=a},setEnabled:function(a){this._enabled!==a&&(a?this.setColor(this._colorBackup):(this._colorBackup= this.color,this.setColor(this._disabledColor)));cc.MenuItem.prototype.setEnabled.call(this,a)},initWithLabel:function(a,b,c){this.initWithCallback(b,c);this._originalScale=1;this._colorBackup=cc.color.WHITE;this._disabledColor=cc.color(126,126,126);this.setLabel(a);this.setCascadeColorEnabled(!0);this.setCascadeOpacityEnabled(!0);return!0},setString:function(a){this._label.string=a;this.width=this._label.width;this.height=this._label.height},getString:function(){return this._label.string},activate:function(){this._enabled&& (this.stopAllActions(),this.scale=this._originalScale,cc.MenuItem.prototype.activate.call(this))},selected:function(){if(this._enabled){cc.MenuItem.prototype.selected.call(this);var a=this.getActionByTag(cc.ZOOM_ACTION_TAG);a?this.stopAction(a):this._originalScale=this.scale;a=cc.scaleTo(.1,1.2*this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}},unselected:function(){if(this._enabled){cc.MenuItem.prototype.unselected.call(this);this.stopActionByTag(cc.ZOOM_ACTION_TAG);var a=cc.scaleTo(.1, this._originalScale);a.setTag(cc.ZOOM_ACTION_TAG);this.runAction(a)}}});cc.MenuItemLabel.prototype.string;cc.defineGetterSetter(cc.MenuItemLabel.prototype,"string",cc.MenuItemLabel.prototype.getString,cc.MenuItemLabel.prototype.setString);cc.MenuItemLabel.prototype.disabledColor;cc.defineGetterSetter(cc.MenuItemLabel.prototype,"disabledColor",cc.MenuItemLabel.prototype.getDisabledColor,cc.MenuItemLabel.prototype.setDisabledColor);cc.MenuItemLabel.prototype.label; cc.defineGetterSetter(cc.MenuItemLabel.prototype,"label",cc.MenuItemLabel.prototype.getLabel,cc.MenuItemLabel.prototype.setLabel);cc.MenuItemLabel.create=function(a,b,c){return new cc.MenuItemLabel(a,b,c)}; cc.MenuItemAtlasFont=cc.MenuItemLabel.extend({ctor:function(a,b,c,d,e,f,g){var h;a&&0=b.length)&&(g=b[d])){var m=k[a].height;e=e>=m||isNaN(m)?e:m;++f;f>=g&&(c+=e+5,e=f=0,++d)}var l=cc.director.getWinSize(),n=g=e=d=0,p=0;c/=2;if(k&&0=m||isNaN(m)?e:m;q.setPosition(p-l.width/2,c-m/2);p+=n;++f;f>=g&&(c-=e+5,e=g=f=0,++d)}},alignItemsInRows:function(){0=b.length)&&(m=b[g])){var q=p.width;h=h>=q||isNaN(q)?h:q;f+=p.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;e=-e/2;var r=0;if(n&&0=q||isNaN(q)?h:q,p.setPosition(e+c[g]/2,r-f.height/2),r-=p.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){b=b.getCurrentTarget();if(b._state!==cc.MENU_STATE_WAITING||!b._visible||!b.enabled)return!1;for(var c=b.parent;null!= c;c=c.parent)if(!c.isVisible())return!1;b._selectedItem=b._itemForTouch(a);return b._selectedItem?(b._state=cc.MENU_STATE_TRACKING_TOUCH,b._selectedItem.selected(),b._selectedItem.setNodeDirty(),!0):!1},_onTouchEnded:function(a,b){a=b.getCurrentTarget();a._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchEnded(): invalid state"):(a._selectedItem&&(a._selectedItem.unselected(),a._selectedItem.setNodeDirty(),a._selectedItem.activate()),a._state=cc.MENU_STATE_WAITING)},_onTouchCancelled:function(a, b){a=b.getCurrentTarget();a._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchCancelled(): invalid state"):(a._selectedItem&&(a._selectedItem.unselected(),a._selectedItem.setNodeDirty()),a._state=cc.MENU_STATE_WAITING)},_onTouchMoved:function(a,b){b=b.getCurrentTarget();b._state!==cc.MENU_STATE_TRACKING_TOUCH?cc.log("cc.Menu.onTouchMoved(): invalid state"):(a=b._itemForTouch(a),a!==b._selectedItem&&(b._selectedItem&&(b._selectedItem.unselected(),b._selectedItem.setNodeDirty()),b._selectedItem= a,b._selectedItem&&(b._selectedItem.selected(),b._selectedItem.setNodeDirty())))},onExit:function(){this._state===cc.MENU_STATE_TRACKING_TOUCH&&(this._selectedItem&&(this._selectedItem.unselected(),this._selectedItem=null),this._state=cc.MENU_STATE_WAITING);cc.Node.prototype.onExit.call(this)},setOpacityModifyRGB:function(a){},isOpacityModifyRGB:function(){return!1},_itemForTouch:function(a){a=a.getLocation();var b=this._children;if(b&&0