var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};_p=window;_p=Object.prototype;delete window._p;cc.newElement=function(a){return document.createElement(a)};cc._addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)};cc._isNodeJs="undefined"!==typeof require&&require("fs");cc.each=function(a,b,c){if(a)if(a instanceof Array)for(var d=0,e=a.length;de)throw"arguments error!"; "function"==typeof b&&(b={iterator:b});if(void 0!==c)b.cb=c||b.cb;else if(void 0===a)throw"arguments error!";var f=(e=a instanceof Array)?a.length:Object.keys(a).length;if(0===f)b.cb&&b.cb.call(b.cbTarget,null);else{var g={length:f,count:f,option:b,results:e?[]:{}};cc.each(a,function(a,c){if(g.err)return!1;var e=!b.cb?d._emptyFunc:d._counterFunc.bind({counter:g,index:c});b.iterator.call(b.iteratorTarget,a,c,e)})}}}; cc.path={join:function(){for(var a=arguments.length,b="",c=0;cc?a+b+d:a.substring(0,c)+b+d},changeBasename:function(a,b,c){if(0==b.indexOf("."))return this.changeExtname(a,b);var d=a.indexOf("?"),e="";c=c?this.extname(a):"";0=d?0:d+1)+b+c+e}}; cc.loader={_jsCache:{},_register:{},_langPathCache:{},_aliases:{},resPath:"",audioPath:"",cache:{},getXMLHttpRequest:function(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP")},_getArgs4Js:function(a){var b=a[0],c=a[1],d=a[2],e=["",null,null];if(1===a.length)e[1]=b instanceof Array?b:[b];else if(2===a.length)"function"==typeof c?(e[1]=b instanceof Array?b:[b],e[2]=c):(e[0]=b||"",e[1]=c instanceof Array?c:[c]);else if(3===a.length)e[0]=b||"",e[1]=c instanceof Array?c:[c],e[2]=d;else throw"arguments error to load js!";return e},loadJs:function(a,b,c){var d=this,e=d._jsCache,f=d._getArgs4Js(arguments);-1=b.length)d&&d();else{var e=this;e._createScript(cc.path.join(a,b[c]),!1,function(f){if(f)return d(f);e._loadJs4Dependency(a,b,c+1,d)})}},_loadJsImg:function(){var a= document,b=a.getElementById("cocos2d_loadJsImg");if(!b){b=cc.newElement("img");cc._loadingImage&&(b.src=cc._loadingImage);a=a.getElementById(cc.game.config.id);a.style.backgroundColor="black";a.parentNode.appendChild(b);var c=getComputedStyle?getComputedStyle(a):a.currentStyle;c||(c={width:a.width,height:a.height});b.style.left=a.offsetLeft+(parseFloat(c.width)-b.width)/2+"px";b.style.top=a.offsetTop+(parseFloat(c.height)-b.height)/2+"px";b.style.position="absolute"}return b},loadTxt:function(a,b){if(cc._isNodeJs)require("fs").readFile(a, function(a,c){a?b(a):b(null,c.toString())});else{var c=this.getXMLHttpRequest(),d="load "+a+" failed!";c.open("GET",a,!0);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?(c.setRequestHeader("Accept-Charset","utf-8"),c.onreadystatechange=function(){4==c.readyState&&200==c.status?b(null,c.responseText):b(d)}):(c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8"),c.onload=function(){4==c.readyState&&200==c.status?b(null,c.responseText):b(d)});c.send(null)}},_loadTxtSync:function(a){if(cc._isNodeJs)return require("fs").readFileSync(a).toString(); var b=this.getXMLHttpRequest();b.open("GET",a,!1);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?b.setRequestHeader("Accept-Charset","utf-8"):b.overrideMimeType&&b.overrideMimeType("text/plain; charset\x3dutf-8");b.send(null);return 4==!b.readyState||200!=b.status?null:b.responseText},loadJson:function(a,b){this.loadTxt(a,function(c,d){try{c?b(c):b(null,JSON.parse(d))}catch(e){throw"load json ["+a+"] failed : "+e;}})},_checkIsImageURL:function(a){return null!=/(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(a)}, loadImg:function(a,b,c){var d=!0;void 0!==c?d=null==b.isCrossOrigin?d:b.isCrossOrigin:void 0!==b&&(c=b);var e=new Image;d&&"file://"!=location.origin&&(e.crossOrigin="Anonymous");cc._addEventListener(e,"load",function(){this.removeEventListener("load",arguments.callee,!1);this.removeEventListener("error",arguments.callee,!1);c&&c(null,e)});cc._addEventListener(e,"error",function(){this.removeEventListener("error",arguments.callee,!1);c&&c("load image failed")});e.src=a;return e},_loadResIterator:function(a, b,c){var d=this,e=null,f=a.type;f?(f="."+f.toLowerCase(),e=a.src?a.src:a.name+f):(e=a,f=cc.path.extname(e));if(b=d.cache[e])return c(null,b);b=d._register[f.toLowerCase()];if(!b)return cc.error("loader for ["+f+"] not exists!"),c();f=b.getBasePath?b.getBasePath():d.resPath;f=d.getUrl(f,e);b.load(f,e,a,function(a,b){a?(cc.log(a),d.cache[e]=null,delete d.cache[e],c()):(d.cache[e]=b,c(null,b))})},getUrl:function(a,b){var c=this._langPathCache,d=cc.path;if(void 0!==a&&void 0===b){b=a;var e=d.extname(b), e=e?e.toLowerCase():"";a=(e=this._register[e])?e.getBasePath?e.getBasePath():this.resPath:this.resPath}b=cc.path.join(a||"",b);if(b.match(/[\/(\\\\)]lang[\/(\\\\)]/i)){if(c[b])return c[b];d=d.extname(b)||"";b=c[b]=b.substring(0,b.length-d.length)+"_"+cc.sys.language+d}return b},load:function(a,b,c){if(void 0!==c)"function"==typeof b&&(b={trigger:b});else if(void 0!==b)"function"==typeof b&&(c=b,b={});else if(void 0!==a)b={};else throw"arguments error!";b.cb=function(a,b){a&&cc.log(a);c&&c(b)};a instanceof Array||(a=[a]);b.iterator=this._loadResIterator;b.iteratorTarget=this;cc.async.map(a,b)},_handleAliases:function(a,b){var c=this._aliases,d=[],e;for(e in a){var f=a[e];c[e]=f;d.push(f)}this.load(d,b)},loadAliases:function(a,b){var c=this,d=c.getRes(a);d?c._handleAliases(d.filenames,b):c.load(a,function(a){c._handleAliases(a[0].filenames,b)})},register:function(a,b){if(a&&b){if("string"==typeof a)return this._register[a.trim().toLowerCase()]=b;for(var c=0,d=a.length;cm.indexOf("core")&&m.splice(0,0,"core");for(var s=0,r=m.length;sc;c++)for(var d=0;256>d;d++)b[String.fromCharCode(c+256*d)]=String.fromCharCode(c)+String.fromCharCode(d);c=IEBinaryToArray_ByteStr(a);a=IEBinaryToArray_ByteStr_Last(a);return c.replace(/[\s\S]/g,function(a){return b[a]})+a}};var cc=cc||{},ClassManager={id:0|998*Math.random(),instanceId:0|998*Math.random(),compileSuper:function(a,b,c){a=a.toString();var d=a.indexOf("("),e=a.indexOf(")"),d=a.substring(d+1,e),d=d.trim(),e=a.indexOf("{"),f=a.lastIndexOf("}");for(a=a.substring(e+1,f);-1!=a.indexOf("this._super");){var e=a.indexOf("this._super"),f=a.indexOf("(",e),g=a.indexOf(")",f),g=a.substring(f+1,g),g=(g=g.trim())?",":"";a=a.substring(0,e)+"ClassManager["+c+"]."+b+".call(this"+g+a.substring(f+1)}return Function(d,a)},getNewID:function(){return this.id++}, getNewInstanceId:function(){return this.instanceId++}};ClassManager.compileSuper.ClassManager=ClassManager; (function(){var a=/\b_super\b/,b=cc.game.config[cc.game.CONFIG_KEY.classReleaseMode];b&&console.log("release Mode");cc.Class=function(){};cc.Class.extend=function(c){function d(){this.__instanceId=ClassManager.getNewInstanceId();this.ctor&&this.ctor.apply(this,arguments)}var e=this.prototype,f=Object.create(e),g=ClassManager.getNewID();ClassManager[g]=e;var h={writable:!0,enumerable:!1,configurable:!0};f.__instanceId=null;d.id=g;h.value=g;Object.defineProperty(f,"__pid",h);d.prototype=f;h.value=d; Object.defineProperty(d.prototype,"constructor",h);this.__getters__&&(d.__getters__=cc.clone(this.__getters__));this.__setters__&&(d.__setters__=cc.clone(this.__setters__));for(var k=0,m=arguments.length;k=b.x||a.y>=b.y||a.x+a.width<=b.x+b.width||a.y+a.height<=b.y+b.height)};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>16,(a>>8)%256,a%256)}; cc.colorToHex=function(a){var b=a.r.toString(16),c=a.g.toString(16),d=a.b.toString(16);return"#"+(16>a.r?"0"+b:b)+(16>a.g?"0"+c:c)+(16>a.b?"0"+d:d)};cc.TEXT_ALIGNMENT_LEFT=0;cc.TEXT_ALIGNMENT_CENTER=1;cc.TEXT_ALIGNMENT_RIGHT=2;cc.VERTICAL_TEXT_ALIGNMENT_TOP=0;cc.VERTICAL_TEXT_ALIGNMENT_CENTER=1;cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM=2; cc._Dictionary=cc.Class.extend({_keyMapTb:null,_valueMapTb:null,__currId:0,ctor:function(){this._keyMapTb={};this._valueMapTb={};this.__currId=2<<(0|10*Math.random())},__getKey:function(){this.__currId++;return"key_"+this.__currId},setObject:function(a,b){if(null!=b){var c=this.__getKey();this._keyMapTb[c]=b;this._valueMapTb[c]=a}},objectForKey:function(a){if(null==a)return null;var b=this._keyMapTb,c;for(c in b)if(b[c]===a)return this._valueMapTb[c];return null},valueForKey:function(a){return this.objectForKey(a)}, removeObjectForKey:function(a){if(null!=a){var b=this._keyMapTb,c;for(c in b)if(b[c]===a){delete this._valueMapTb[c];delete b[c];break}}},removeObjectsForKeys:function(a){if(null!=a)for(var b=0;bMath.abs(a-c)&&(c=a);2>Math.abs(b-d)&&(d=b);a=cc.rect(Math.round((a-c)/2),Math.round((b-d)/2),c,d);cc._renderType==cc._RENDER_TYPE_CANVAS&&cc._renderContext.translate(a.x,a.y+d);this._result.scale=[e,f];this._result.viewport=a;return this._result},preApply:function(a){},apply:function(a,b){return{scale:[1,1]}},postApply:function(a){}}); (function(){var a=cc.ContainerStrategy.extend({apply:function(a){this._setupContainer(a,a._frameSize.width,a._frameSize.height)}}),b=cc.ContainerStrategy.extend({apply:function(a,b){var c=a._frameSize.width,d=a._frameSize.height,e=cc.container.style,n=b.width,q=b.height,s=c/n,r=d/q,u,t;s>=1}return-1},_removeUsedIndexBit:function(a){0>a|| a>=this._maxTouches||(a=~(1<=c.length?c.push(a):(c[this._preTouchPoolPointer]=a,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(a,b,c){var d=this._preTouchPoint;a=this._glView.convertToLocationInView(a,b,c);b=new cc.Touch(a.x,a.y);b._setPrevPoint(d.x,d.y);d.x=a.x;d.y=a.y; return b},getMouseEvent:function(a,b,c){var d=this._prevMousePoint;this._glView._convertMouseToLocationInView(a,b);b=new cc.EventMouse(c);b.setLocation(a.x,a.y);b._setPrevCursor(d.x,d.y);d.x=a.x;d.y=a.y;return b},getPointByEvent:function(a,b){if(null!=a.pageX)return{x:a.pageX,y:a.pageY};b.left-=document.body.scrollLeft;b.top-=document.body.scrollTop;return{x:a.clientX,y:a.clientY}},getTouchesByEvent:function(a,b){for(var c=[],d=this._glView,e,f,g=this._preTouchPoint,h=a.changedTouches.length,k=0;k< h;k++)if(e=a.changedTouches[k]){var m;m=cc.sys.BROWSER_TYPE_FIREFOX===cc.sys.browserType?d.convertToLocationInView(e.pageX,e.pageY,b):d.convertToLocationInView(e.clientX,e.clientY,b);null!=e.identifier?(e=new cc.Touch(m.x,m.y,e.identifier),f=this.getPreTouch(e).getLocation(),e._setPrevPoint(f.x,f.y),this.setPreTouch(e)):(e=new cc.Touch(m.x,m.y),e._setPrevPoint(g.x,g.y));g.x=m.x;g.y=m.y;c.push(e)}return c},registerSystemEvent:function(a){if(!this._isRegisterEvent){var b=this._glView=cc.view,c=this, d="touches"in cc.sys.capabilities;"mouse"in cc.sys.capabilities&&(cc._addEventListener(window,"mousedown",function(){c._mousePressed=!0},!1),cc._addEventListener(window,"mouseup",function(b){var e=c._mousePressed;c._mousePressed=!1;if(e){var e=c.getHTMLElementPosition(a),f=c.getPointByEvent(b,e);cc.rectContainsPoint(new cc.Rect(e.left,e.top,e.width,e.height),f)||(d||c.handleTouchesEnd([c.getTouchByXY(f.x,f.y,e)]),e=c.getMouseEvent(f,e,cc.EventMouse.UP),e.setButton(b.button),cc.eventManager.dispatchEvent(e))}}, !1),cc._addEventListener(a,"mousedown",function(b){c._mousePressed=!0;var e=c.getHTMLElementPosition(a),f=c.getPointByEvent(b,e);d||c.handleTouchesBegin([c.getTouchByXY(f.x,f.y,e)]);e=c.getMouseEvent(f,e,cc.EventMouse.DOWN);e.setButton(b.button);cc.eventManager.dispatchEvent(e);b.stopPropagation();b.preventDefault();a.focus()},!1),cc._addEventListener(a,"mouseup",function(b){c._mousePressed=!1;var e=c.getHTMLElementPosition(a),f=c.getPointByEvent(b,e);d||c.handleTouchesEnd([c.getTouchByXY(f.x,f.y, e)]);e=c.getMouseEvent(f,e,cc.EventMouse.UP);e.setButton(b.button);cc.eventManager.dispatchEvent(e);b.stopPropagation();b.preventDefault()},!1),cc._addEventListener(a,"mousemove",function(b){var e=c.getHTMLElementPosition(a),f=c.getPointByEvent(b,e);d||c.handleTouchesMove([c.getTouchByXY(f.x,f.y,e)]);e=c.getMouseEvent(f,e,cc.EventMouse.MOVE);c._mousePressed?e.setButton(b.button):e.setButton(null);cc.eventManager.dispatchEvent(e);b.stopPropagation();b.preventDefault()},!1),cc._addEventListener(a,"mousewheel", function(b){var d=c.getHTMLElementPosition(a),e=c.getPointByEvent(b,d),d=c.getMouseEvent(e,d,cc.EventMouse.SCROLL);d.setButton(b.button);d.setScrollData(0,b.wheelDelta);cc.eventManager.dispatchEvent(d);b.stopPropagation();b.preventDefault()},!1),cc._addEventListener(a,"DOMMouseScroll",function(b){var d=c.getHTMLElementPosition(a),e=c.getPointByEvent(b,d),d=c.getMouseEvent(e,d,cc.EventMouse.SCROLL);d.setButton(b.button);d.setScrollData(0,-120*b.detail);cc.eventManager.dispatchEvent(d);b.stopPropagation(); b.preventDefault()},!1));if(window.navigator.msPointerEnabled){var e={MSPointerDown:c.handleTouchesBegin,MSPointerMove:c.handleTouchesMove,MSPointerUp:c.handleTouchesEnd,MSPointerCancel:c.handleTouchesCancel},f;for(f in e)(function(b,d){cc._addEventListener(a,b,function(b){var e=c.getHTMLElementPosition(a);e.left-=document.documentElement.scrollLeft;e.top-=document.documentElement.scrollTop;d.call(c,[c.getTouchByXY(b.clientX,b.clientY,e)]);b.stopPropagation();b.preventDefault()},!1)})(f,e[f])}d&& (cc._addEventListener(a,"touchstart",function(b){if(b.changedTouches){var d=c.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;c.handleTouchesBegin(c.getTouchesByEvent(b,d));b.stopPropagation();b.preventDefault();a.focus()}},!1),cc._addEventListener(a,"touchmove",function(b){if(b.changedTouches){var d=c.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;c.handleTouchesMove(c.getTouchesByEvent(b,d));b.stopPropagation(); b.preventDefault()}},!1),cc._addEventListener(a,"touchend",function(b){if(b.changedTouches){var d=c.getHTMLElementPosition(a);d.left-=document.body.scrollLeft;d.top-=document.body.scrollTop;c.handleTouchesEnd(c.getTouchesByEvent(b,d));b.stopPropagation();b.preventDefault()}},!1),cc._addEventListener(a,"touchcancel",function(d){if(d.changedTouches){var e=c.getHTMLElementPosition(a);e.left-=document.body.scrollLeft;e.top-=document.body.scrollTop;b.handleTouchesCancel(c.getTouchesByEvent(d,e));d.stopPropagation(); d.preventDefault()}},!1));this._registerKeyboardEvent();this._registerAccelerometerEvent();this._isRegisterEvent=!0}},_registerKeyboardEvent:function(){},_registerAccelerometerEvent:function(){},update:function(a){this._accelCurTime>this._accelInterval&&(this._accelCurTime-=this._accelInterval,cc.eventManager.dispatchEvent(new cc.EventAcceleration(this._acceleration)));this._accelCurTime+=a}};var _p=cc.inputManager;_p.setAccelerometerEnabled=function(a){this._accelEnabled!==a&&(this._accelEnabled=a,a=cc.director.getScheduler(),this._accelEnabled?(this._accelCurTime=0,a.scheduleUpdateForTarget(this)):(this._accelCurTime=0,a.unscheduleUpdateForTarget(this)))};_p.setAccelerometerInterval=function(a){this._accelInterval!==a&&(this._accelInterval=a)}; _p._registerKeyboardEvent=function(){cc._addEventListener(cc._canvas,"keydown",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!0));a.stopPropagation();a.preventDefault()},!1);cc._addEventListener(cc._canvas,"keyup",function(a){cc.eventManager.dispatchEvent(new cc.EventKeyboard(a.keyCode,!1));a.stopPropagation();a.preventDefault()},!1)}; _p._registerAccelerometerEvent=function(){var a=window;this._acceleration=new cc.Acceleration;this._accelDeviceEvent=a.DeviceMotionEvent||a.DeviceOrientationEvent;cc.sys.browserType==cc.sys.BROWSER_TYPE_MOBILE_QQ&&(this._accelDeviceEvent=window.DeviceOrientationEvent);var b=this._accelDeviceEvent==a.DeviceMotionEvent?"devicemotion":"deviceorientation",c=navigator.userAgent;if(/Android/.test(c)||/Adr/.test(c)&&cc.sys.browserType==cc.BROWSER_TYPE_UC)this._minus=-1;cc._addEventListener(a,b,this.didAccelerate.bind(this), !1)}; _p.didAccelerate=function(a){var b=window;if(this._accelEnabled){var c=this._acceleration;if(this._accelDeviceEvent==window.DeviceMotionEvent){var d=a.accelerationIncludingGravity;c.x=0.1*this._accelMinus*d.x;c.y=0.1*this._accelMinus*d.y;c.z=0.1*d.z}else c.x=0.981*(a.gamma/90),c.y=0.981*-(a.beta/90),c.z=0.981*(a.alpha/90);c.timestamp=a.timeStamp||Date.now();a=c.x;b.orientation===cc.UIInterfaceOrientationLandscapeRight?(c.x=-c.y,c.y=a):b.orientation===cc.UIInterfaceOrientationLandscapeLeft?(c.x=c.y, c.y=-a):b.orientation===cc.UIInterfaceOrientationPortraitUpsideDown&&(c.x=-c.x,c.y=-c.y)}};delete _p;cc.AffineTransform=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.tx=e;this.ty=f};cc.AffineTransformMake=function(a,b,c,d,e,f){return{a:a,b:b,c:c,d:d,tx:e,ty:f}};cc.PointApplyAffineTransform=function(a,b){return{x:b.a*a.x+b.c*a.y+b.tx,y:b.b*a.x+b.d*a.y+b.ty}};cc._PointApplyAffineTransform=function(a,b,c){return{x:c.a*a+c.c*b+c.tx,y:c.b*a+c.d*b+c.ty}};cc.SizeApplyAffineTransform=function(a,b){return{width:b.a*a.width+b.c*a.height,height:b.b*a.width+b.d*a.height}}; cc.AffineTransformMakeIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}};cc.AffineTransformIdentity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}; cc.RectApplyAffineTransform=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc._PointApplyAffineTransform(d,c,b),c=cc._PointApplyAffineTransform(e,c,b),d=cc._PointApplyAffineTransform(d,f,b),h=cc._PointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);return cc.rect(e,k,f-e,g-k)}; cc._RectApplyAffineTransformIn=function(a,b){var c=cc.rectGetMinY(a),d=cc.rectGetMinX(a),e=cc.rectGetMaxX(a),f=cc.rectGetMaxY(a),g=cc._PointApplyAffineTransform(d,c,b),c=cc._PointApplyAffineTransform(e,c,b),d=cc._PointApplyAffineTransform(d,f,b),h=cc._PointApplyAffineTransform(e,f,b),e=Math.min(g.x,c.x,d.x,h.x),f=Math.max(g.x,c.x,d.x,h.x),k=Math.min(g.y,c.y,d.y,h.y),g=Math.max(g.y,c.y,d.y,h.y);a.x=e;a.y=k;a.width=f-e;a.height=g-k;return a}; cc.AffineTransformTranslate=function(a,b,c){return{a:a.a,b:a.b,c:a.c,d:a.d,tx:a.tx+a.a*b+a.c*c,ty:a.ty+a.b*b+a.d*c}};cc.AffineTransformScale=function(a,b,c){return{a:a.a*b,b:a.b*b,c:a.c*c,d:a.d*c,tx:a.tx,ty:a.ty}};cc.AffineTransformRotate=function(a,b){var c=Math.sin(b),d=Math.cos(b);return{a:a.a*d+a.c*c,b:a.b*d+a.d*c,c:a.c*d-a.a*c,d:a.d*d-a.b*c,tx:a.tx,ty:a.ty}}; cc.AffineTransformConcat=function(a,b){return{a:a.a*b.a+a.b*b.c,b:a.a*b.b+a.b*b.d,c:a.c*b.a+a.d*b.c,d:a.c*b.b+a.d*b.d,tx:a.tx*b.a+a.ty*b.c+b.tx,ty:a.tx*b.b+a.ty*b.d+b.ty}};cc.AffineTransformEqualToTransform=function(a,b){return a.a===b.a&&a.b===b.b&&a.c===b.c&&a.d===b.d&&a.tx===b.tx&&a.ty===b.ty};cc.AffineTransformInvert=function(a){var b=1/(a.a*a.d-a.b*a.c);return{a:b*a.d,b:-b*a.b,c:-b*a.c,d:b*a.a,tx:b*(a.c*a.ty-a.d*a.tx),ty:b*(a.b*a.tx-a.a*a.ty)}};cc.POINT_EPSILON=parseFloat("1.192092896e-07F");cc.pNeg=function(a){return cc.p(-a.x,-a.y)};cc.pAdd=function(a,b){return cc.p(a.x+b.x,a.y+b.y)};cc.pSub=function(a,b){return cc.p(a.x-b.x,a.y-b.y)};cc.pMult=function(a,b){return cc.p(a.x*b,a.y*b)};cc.pMidpoint=function(a,b){return cc.pMult(cc.pAdd(a,b),0.5)};cc.pDot=function(a,b){return a.x*b.x+a.y*b.y};cc.pCross=function(a,b){return a.x*b.y-a.y*b.x};cc.pPerp=function(a){return cc.p(-a.y,a.x)};cc.pRPerp=function(a){return cc.p(a.y,-a.x)}; cc.pProject=function(a,b){return cc.pMult(b,cc.pDot(a,b)/cc.pDot(b,b))};cc.pRotate=function(a,b){return cc.p(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x)};cc.pUnrotate=function(a,b){return cc.p(a.x*b.x+a.y*b.y,a.y*b.x-a.x*b.y)};cc.pLengthSQ=function(a){return cc.pDot(a,a)};cc.pDistanceSQ=function(a,b){return cc.pLengthSQ(cc.pSub(a,b))};cc.pLength=function(a){return Math.sqrt(cc.pLengthSQ(a))};cc.pDistance=function(a,b){return cc.pLength(cc.pSub(a,b))};cc.pNormalize=function(a){return cc.pMult(a,1/cc.pLength(a))}; cc.pForAngle=function(a){return cc.p(Math.cos(a),Math.sin(a))};cc.pToAngle=function(a){return Math.atan2(a.y,a.x)};cc.clampf=function(a,b,c){if(b>c){var d=b;b=c;c=d}return a=e.x&&0<=e.y&&1>=e.y?!0:!1};cc.pIntersectPoint=function(a,b,c,d){var e=cc.p(0,0);return cc.pLineIntersect(a,b,c,d,e)?(c=cc.p(0,0),c.x=a.x+e.x*(b.x-a.x),c.y=a.y+e.x*(b.y-a.y),c):cc.p(0,0)};cc.pSameAs=function(a,b){return null!=a&&null!=b?a.x==b.x&&a.y==b.y:!1};cc.pZeroIn=function(a){a.x=0;a.y=0};cc.pIn=function(a,b){a.x=b.x;a.y=b.y};cc.pMultIn=function(a,b){a.x*=b;a.y*=b}; cc.pSubIn=function(a,b){a.x-=b.x;a.y-=b.y};cc.pAddIn=function(a,b){a.x+=b.x;a.y+=b.y};cc.pNormalizeIn=function(a){cc.pMultIn(a,1/Math.sqrt(a.x*a.x+a.y*a.y))};cc.vertexLineToPolygon=function(a,b,c,d,e){e+=d;if(!(1>=e)){b*=0.5;for(var f,g=e-1,h=d;hb.value||1h.getLocalZOrder())this._visitTarget(h,!1);else break;null!=g[a.__instanceId]&&(f[a.getGlobalZOrder()]||(f[a.getGlobalZOrder()]=[]),f[a.getGlobalZOrder()].push(a.__instanceId));for(;dd._localZOrder)d.visit(a);else break;for(this.draw(a);bd&&-1E-6e&&-1E-6this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var c=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT,d=b*c,e=(this._totalQuads- 1-b)*c;this._quads[this._totalQuads-1]=new cc.V3F_C4B_T2F_Quad(null,null,null,null,this._quadsArrayBuffer,(this._totalQuads-1)*c);this._quadsReader.set(this._quadsReader.subarray(d,d+e),d+c);this._setQuadToArray(a,b);this.dirty=!0}},insertQuads:function(a,b,c){c=c||a.length;cc.assert(b+c<=this._capacity,cc._LogInfos.TextureAtlas_insertQuads);var d=cc.V3F_C4B_T2F_Quad.BYTES_PER_ELEMENT;this._totalQuads+=c;if(this._totalQuads>this._capacity)cc.log(cc._LogInfos.TextureAtlas_insertQuad);else{var e=b* d,f=(this._totalQuads-1-b-c)*d,g=this._totalQuads-1-c,h;for(h=0;hb?(f=b*c,d.set(d.subarray(f,f+(a-b)*c),f+c),d.set(e,f)):(f=(a+1)*c,d.set(d.subarray(f,f+(b-a)*c),f-c),d.set(e,b*c));this.dirty=!0}},removeQuadAtIndex:function(a){cc.assert(ac){f=[];g=new ArrayBuffer(b*d);for(a=0;ac?(b=new Uint16Array(6*d),b.set(this._indices,0),this._indices=b):this._indices=this._indices.subarray(0,6*d);this._setupIndices();this._mapBuffers(); return this.dirty=!0},increaseTotalQuadsWith:function(a){this._totalQuads+=a},moveQuadsFromIndex:function(a,b,c){if(void 0===c){if(c=b,b=this._totalQuads-a,cc.assert(c+(this._totalQuads-a)<=this._capacity,cc._LogInfos.TextureAtlas_moveQuadsFromIndex),0===b)return}else if(cc.assert(c+b<=this._totalQuads,cc._LogInfos.TextureAtlas_moveQuadsFromIndex_2),cc.assert(a=b&&this.unschedule(this._updatePercent)}}); cc.LoaderScene.preload=function(a,b){var c=cc;c.loaderScene||(c.loaderScene=new cc.LoaderScene,c.loaderScene.init());c.loaderScene.initWithResources(a,b);cc.director.runScene(c.loaderScene);return c.loaderScene};cc._tmp.PrototypeLayerRGBA=function(){var a=cc.LayerRGBA.prototype;cc.defineGetterSetter(a,"opacityModifyRGB",a.isOpacityModifyRGB,a.setOpacityModifyRGB);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"cascadeOpacity",a.isCascadeOpacityEnabled,a.setCascadeOpacityEnabled);cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"cascadeColor",a.isCascadeColorEnabled,a.setCascadeColorEnabled)}; cc._tmp.PrototypeLayerColor=function(){var a=cc.LayerColor.prototype;cc.defineGetterSetter(a,"width",a._getWidth,a._setWidth);cc.defineGetterSetter(a,"height",a._getHeight,a._setHeight)}; cc._tmp.PrototypeLayerGradient=function(){var a=cc.LayerGradient.prototype;cc.defineGetterSetter(a,"startColor",a.getStartColor,a.setStartColor);cc.defineGetterSetter(a,"endColor",a.getEndColor,a.setEndColor);cc.defineGetterSetter(a,"startOpacity",a.getStartOpacity,a.setStartOpacity);cc.defineGetterSetter(a,"endOpacity",a.getEndOpacity,a.setEndOpacity);cc.defineGetterSetter(a,"vector",a.getVector,a.setVector)};cc.Layer=cc.Node.extend({_isBaked:!1,_bakeSprite:null,_className:"Layer",ctor:function(){var a=cc.Node.prototype;a.ctor.call(this);this._ignoreAnchorPointForPosition=!0;a.setAnchorPoint.call(this,0.5,0.5);a.setContentSize.call(this,cc.winSize)},bake:null,unbake:null,isBaked:function(){return this._isBaked},visit:null});cc.Layer.create=function(){return new cc.Layer}; if(cc._renderType===cc._RENDER_TYPE_CANVAS){var p=cc.Layer.prototype;p.bake=function(){if(!this._isBaked){this._isBaked=this._cacheDirty=!0;this._cachedParent=this;for(var a=this._children,b=0,c=a.length;bg._localZOrder)g.visit(f);else break;for(this.draw(f);b=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchTo):(this.removeChild(this._layers[this._enabledLayer], !0),this._enabledLayer=a,this.addChild(this._layers[a]))},switchToAndReleaseMe:function(a){a>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchToAndReleaseMe):(this.removeChild(this._layers[this._enabledLayer],!0),this._layers[this._enabledLayer]=null,this._enabledLayer=a,this.addChild(this._layers[a]))},addLayer:function(a){a?this._layers.push(a):cc.log(cc._LogInfos.LayerMultiplex_addLayer)}});cc.LayerMultiplex.create=function(){return new cc.LayerMultiplex(arguments)};cc._tmp.PrototypeSprite=function(){var a=cc.Sprite.prototype;cc.defineGetterSetter(a,"opacityModifyRGB",a.isOpacityModifyRGB,a.setOpacityModifyRGB);cc.defineGetterSetter(a,"opacity",a.getOpacity,a.setOpacity);cc.defineGetterSetter(a,"color",a.getColor,a.setColor);cc.defineGetterSetter(a,"flippedX",a.isFlippedX,a.setFlippedX);cc.defineGetterSetter(a,"flippedY",a.isFlippedY,a.setFlippedY);cc.defineGetterSetter(a,"offsetX",a._getOffsetX);cc.defineGetterSetter(a,"offsetY",a._getOffsetY);cc.defineGetterSetter(a, "texture",a.getTexture,a.setTexture);cc.defineGetterSetter(a,"textureRectRotated",a.isTextureRectRotated);cc.defineGetterSetter(a,"batchNode",a.getBatchNode,a.setBatchNode);cc.defineGetterSetter(a,"quad",a.getQuad)};cc.generateTextureCacheForColor=function(a){function b(){var b=cc.generateTextureCacheForColor,d=a.width,g=a.height;c[0].width=d;c[0].height=g;c[1].width=d;c[1].height=g;c[2].width=d;c[2].height=g;c[3].width=d;c[3].height=g;b.canvas.width=d;b.canvas.height=g;var h=b.canvas.getContext("2d");h.drawImage(a,0,0);b.tempCanvas.width=d;b.tempCanvas.height=g;for(var h=h.getImageData(0,0,d,g).data,k=0;4>k;k++){var m=c[k].getContext("2d");m.getImageData(0,0,d,g).data;b.tempCtx.drawImage(a,0,0);for(var n=b.tempCtx.getImageData(0, 0,d,g),q=n.data,s=0;sa+f+c&&(k.globalAlpha=m,k.drawImage(b[3],d.x,d.y,g,h,0,0,g,h));k.restore();return e};cc.cutRotateImageToCanvas=function(a,b){if(!a)return null;if(!b)return a;var c=cc.newElement("canvas");c.width=b.width;c.height=b.height;var d=c.getContext("2d");d.translate(c.width/2,c.height/2);d.rotate(-1.5707963267948966);d.drawImage(a,b.x,b.y,b.height,b.width,-b.height/2,-b.width/2,b.height,b.width);return c}; cc.Sprite=cc.NodeRGBA.extend({RGBAProtocol:!0,dirty:!1,atlasIndex:0,textureAtlas:null,_batchNode:null,_recursiveDirty:null,_hasChildren:null,_shouldBeHidden:!1,_transformToBatch:null,_blendFunc:null,_texture:null,_rect:null,_rectRotated:!1,_offsetPosition:null,_unflippedOffsetPositionFromCenter:null,_opacityModifyRGB:!1,_flippedX:!1,_flippedY:!1,_textureLoaded:!1,_loadedEventListeners:null,_newTextureWhenChangeColor:null,_className:"Sprite",textureLoaded:function(){return this._textureLoaded},addLoadedEventListener:function(a, b){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:a,eventTarget:b})},_callLoadedEventCallbacks:function(){if(this._loadedEventListeners){for(var a=this._loadedEventListeners,b=0,c=a.length;ba.width&&cc.error(cc._LogInfos.RectWidth,a.url),d>a.height&&cc.error(cc._LogInfos.RectHeight,a.url));this.texture=this._originalTexture=a;this.setTextureRect(b,c);this.batchNode=null;return!0},_p._textureLoadedCallback=function(a){if(!this._textureLoaded){this._textureLoaded=!0;var b=this._rect;b?cc._rectEqualToZero(b)&&(b.width=a.width,b.height=a.height):b=cc.rect(0,0,a.width,a.height);this.texture=this._originalTexture=a;this.setTextureRect(b, this._rectRotated);this.batchNode=this._batchNode;this._callLoadedEventCallbacks()}},_p.setTextureRect=function(a,b,c){this._rectRotated=b||!1;this.setContentSize(c||a);this.setVertexRect(a);b=this._textureRect_Canvas;c=cc.contentScaleFactor();b.x=0|a.x*c;b.y=0|a.y*c;b.width=0|a.width*c;b.height=0|a.height*c;b.validRect=!(0===b.width||0===b.height||0>b.x||0>b.y);a=this._unflippedOffsetPositionFromCenter;this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);this._offsetPosition.x=a.x+(this._contentSize.width- this._rect.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-this._rect.height)/2;this._batchNode&&(this.dirty=!0)},_p.updateTransform=function(){if(this.dirty){var a=this._parent;!this._visible||a&&a!=this._batchNode&&a._shouldBeHidden?this._shouldBeHidden=!0:(this._shouldBeHidden=!1,this._transformToBatch=!a||a==this._batchNode?this.nodeToParentTransform():cc.AffineTransformConcat(this.nodeToParentTransform(),a._transformToBatch));this.dirty=this._recursiveDirty=!1}this._hasChildren&& this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.updateTransform)},_p.addChild=function(a,b,c){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_addChild_2);null==b&&(b=a._localZOrder);null==c&&(c=a.tag);cc.NodeRGBA.prototype.addChild.call(this,a,b,c);this._hasChildren=!0},_p.setOpacity=function(a){cc.NodeRGBA.prototype.setOpacity.call(this,a);this._setNodeDirtyForCache()},_p.setColor=function(a){var b=this.color;b.r===a.r&&b.g===a.g&&b.b===a.b||(cc.NodeRGBA.prototype.setColor.call(this, a),this._changeTextureColor(),this._setNodeDirtyForCache())},_p.updateDisplayedColor=function(a){var b=this.color;cc.NodeRGBA.prototype.updateDisplayedColor.call(this,a);a=this._displayedColor;b.r===a.r&&b.g===a.g&&b.b===a.b||(this._changeTextureColor(),this._setNodeDirtyForCache())},_p.setSpriteFrame=function(a){var b=this;"string"==typeof a&&(a=cc.spriteFrameCache.getSpriteFrame(a),cc.assert(a,cc._LogInfos.CCSpriteBatchNode_setSpriteFrame));b.setNodeDirty(!0);var c=a.getOffset();b._unflippedOffsetPositionFromCenter.x= c.x;b._unflippedOffsetPositionFromCenter.y=c.y;b._rectRotated=a.isRotated();var c=a.getTexture(),d=a.textureLoaded();d||(b._textureLoaded=!1,a.addLoadedEventListener(function(a){b._textureLoaded=!0;var c=a.getTexture();c!=b._texture&&(b.texture=c);b.setTextureRect(a.getRect(),a.isRotated(),a.getOriginalSize());b._callLoadedEventCallbacks()},b));c!=b._texture&&(b.texture=c);b._rectRotated&&(b._originalTexture=c);b.setTextureRect(a.getRect(),b._rectRotated,a.getOriginalSize());b._colorized=!1;d&&(a= b.color,(255!==a.r||255!==a.g||255!==a.b)&&b._changeTextureColor())},_p.isFrameDisplayed=function(a){return a.getTexture()!=this._texture?!1:cc.rectEqualToRect(a.getRect(),this._rect)},_p.setBatchNode=function(a){(this._batchNode=a)?(this._transformToBatch=cc.AffineTransformIdentity(),this.textureAtlas=this._batchNode.textureAtlas):(this.atlasIndex=cc.Sprite.INDEX_NOT_INITIALIZED,this.textureAtlas=null,this.dirty=this._recursiveDirty=!1)},_p.setTexture=function(a){a&&"string"===typeof a?(a=cc.textureCache.addImage(a), this.setTexture(a),a=a.getContentSize(),this.setTextureRect(cc.rect(0,0,a.width,a.height))):(cc.assert(!a||a instanceof cc.Texture2D,cc._LogInfos.CCSpriteBatchNode_setTexture),this._texture!=a&&(a&&a.getHtmlElementObj()instanceof HTMLImageElement&&(this._originalTexture=a),this._texture=a))},_p.draw=function(a){if(this._textureLoaded){a=a||cc._renderContext;this._isLighterMode&&(a.globalCompositeOperation="lighter");var b=cc.view.getScaleX(),c=cc.view.getScaleY();a.globalAlpha=this._displayedOpacity/ 255;var d=this._rect,e=this._contentSize,f=this._offsetPosition,g=this._drawSize_Canvas,h=0|f.x,k=-f.y-d.height,m=this._textureRect_Canvas;g.width=d.width*b;g.height=d.height*c;if(this._flippedX||this._flippedY)a.save(),this._flippedX&&(h=-f.x-d.width,a.scale(-1,1)),this._flippedY&&(k=f.y,a.scale(1,-1));h*=b;k*=c;this._texture&&m.validRect?(e=this._texture.getHtmlElementObj(),this._colorized?a.drawImage(e,0,0,m.width,m.height,h,k,g.width,g.height):a.drawImage(e,m.x,m.y,m.width,m.height,h,k,g.width, g.height)):!this._texture&&m.validRect&&(g=this.color,a.fillStyle="rgba("+g.r+","+g.g+","+g.b+",1)",a.fillRect(h,k,e.width*b,e.height*c));1===cc.SPRITE_DEBUG_DRAW||this._showNode?(a.strokeStyle="rgba(0,255,0,1)",h/=b,k=-(k/c),h=[cc.p(h,k),cc.p(h+d.width,k),cc.p(h+d.width,k-d.height),cc.p(h,k-d.height)],cc._drawingUtil.drawPoly(h,4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(a.strokeStyle="rgba(0,255,0,1)",b=this._rect,k=-k,h=[cc.p(h,k),cc.p(h+b.width,k),cc.p(h+b.width,k-b.height),cc.p(h,k-b.height)],cc._drawingUtil.drawPoly(h, 4,!0));(this._flippedX||this._flippedY)&&a.restore();cc.g_NumberOfDraws++}},delete _p):(cc.assert("function"===typeof cc._tmp.WebGLSprite,cc._LogInfos.MissingFile,"SpritesWebGL.js"),cc._tmp.WebGLSprite(),delete cc._tmp.WebGLSprite);cc.assert("function"===typeof cc._tmp.PrototypeSprite,cc._LogInfos.MissingFile,"SpritesPropertyDefine.js");cc._tmp.PrototypeSprite();delete cc._tmp.PrototypeSprite;cc.AnimationFrame=cc.Class.extend({_spriteFrame:null,_delayPerUnit:0,_userInfo:null,ctor:function(a,b,c){this._spriteFrame=a||null;this._delayPerUnit=b||0;this._userInfo=c||null},clone:function(){var a=new cc.AnimationFrame;a.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return a},copyWithZone:function(a){return cc.clone(this)},copy:function(a){a=new cc.AnimationFrame;a.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return a},initWithSpriteFrame:function(a, b,c){this._spriteFrame=a;this._delayPerUnit=b;this._userInfo=c;return!0},getSpriteFrame:function(){return this._spriteFrame},setSpriteFrame:function(a){this._spriteFrame=a},getDelayUnits:function(){return this._delayPerUnit},setDelayUnits:function(a){this._delayPerUnit=a},getUserInfo:function(){return this._userInfo},setUserInfo:function(a){this._userInfo=a}});cc.AnimationFrame.create=function(a,b,c){return new cc.AnimationFrame(a,b,c)}; cc.Animation=cc.Class.extend({_frames:null,_loops:0,_restoreOriginalFrame:!1,_duration:0,_delayPerUnit:0,_totalDelayUnits:0,ctor:function(a,b,c){this._frames=[];if(void 0===a)this.initWithSpriteFrames(null,0);else{var d=a[0];d&&(d instanceof cc.SpriteFrame?this.initWithSpriteFrames(a,b,c):d instanceof cc.AnimationFrame&&this.initWithAnimationFrames(a,b,c))}},getFrames:function(){return this._frames},setFrames:function(a){this._frames=a},addSpriteFrame:function(a){var b=new cc.AnimationFrame;b.initWithSpriteFrame(a, 1,null);this._frames.push(b);this._totalDelayUnits++},addSpriteFrameWithFile:function(a){a=cc.textureCache.addImage(a);var b=cc.rect(0,0,0,0);b.width=a.width;b.height=a.height;a=cc.SpriteFrame.create(a,b);this.addSpriteFrame(a)},addSpriteFrameWithTexture:function(a,b){var c=cc.SpriteFrame.create(a,b);this.addSpriteFrame(c)},initWithAnimationFrames:function(a,b,c){cc.arrayVerifyType(a,cc.AnimationFrame);this._delayPerUnit=b;this._loops=void 0===c?1:c;this._totalDelayUnits=0;b=this._frames;for(c=b.length= 0;ca.width&&cc.error(cc._LogInfos.RectWidth, a.url);g>a.height&&cc.error(cc._LogInfos.RectHeight,a.url)}this._rectInPixels=b;this._rect=cc.rectPixelsToPoints(b);this._offsetInPixels.x=d.x;this._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(d,this._offset);this._originalSizeInPixels.width=e.width;this._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(e,this._originalSize);this._rotated=c;return!0}});cc.SpriteFrame.create=function(a,b,c,d,e){return new cc.SpriteFrame(a,b,c,d,e)}; cc.SpriteFrame._frameWithTextureForCanvas=function(a,b,c,d,e){var f=new cc.SpriteFrame;f._texture=a;f._rectInPixels=b;f._rect=cc.rectPixelsToPoints(b);f._offsetInPixels.x=d.x;f._offsetInPixels.y=d.y;cc._pointPixelsToPointsOut(f._offsetInPixels,f._offset);f._originalSizeInPixels.width=e.width;f._originalSizeInPixels.height=e.height;cc._sizePixelsToPointsOut(f._originalSizeInPixels,f._originalSize);f._rotated=c;return f};cc.spriteFrameCache={_CCNS_REG1:/^\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*$/,_CCNS_REG2:/^\s*\{\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*,\s*\{\s*([\-]?\d+[.]?\d*)\s*,\s*([\-]?\d+[.]?\d*)\s*\}\s*\}\s*$/,_spriteFrames:{},_spriteFramesAliases:{},_frameConfigCache:{},_rectFromString:function(a){a=this._CCNS_REG2.exec(a);return!a?cc.rect(0,0,0,0):cc.rect(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]),parseFloat(a[4]))},_pointFromString:function(a){a=this._CCNS_REG1.exec(a); return!a?cc.p(0,0):cc.p(parseFloat(a[1]),parseFloat(a[2]))},_sizeFromString:function(a){a=this._CCNS_REG1.exec(a);return!a?cc.size(0,0):cc.size(parseFloat(a[1]),parseFloat(a[2]))},_getFrameConfig:function(a){var b=cc.loader.getRes(a);cc.assert(b,cc._LogInfos.spriteFrameCache__getFrameConfig_2,a);cc.loader.release(a);if(b._inited)return this._frameConfigCache[a]=b;var c=b.frames,d=b.metadata||b.meta,b={},e={},f=0;d&&(f=d.format,f=1>=f.length?parseInt(f):f,e.image=d.textureFileName||d.textureFileName|| d.image);for(var g in c){var h=c[g];if(h){d={};if(0==f){d.rect=cc.rect(h.x,h.y,h.width,h.height);d.rotated=!1;d.offset=cc.p(h.offsetX,h.offsetY);var k=h.originalWidth,h=h.originalHeight;(!k||!h)&&cc.log(cc._LogInfos.spriteFrameCache__getFrameConfig);k=Math.abs(k);h=Math.abs(h);d.size=cc.size(k,h)}else if(1==f||2==f)d.rect=this._rectFromString(h.frame),d.rotated=h.rotated||!1,d.offset=this._pointFromString(h.offset),d.size=this._sizeFromString(h.sourceSize);else if(3==f){var k=this._sizeFromString(h.spriteSize), m=this._rectFromString(h.textureRect);k&&(m=cc.rect(m.x,m.y,k.width,k.height));d.rect=m;d.rotated=h.textureRotated||!1;d.offset=this._pointFromString(h.spriteOffset);d.size=this._sizeFromString(h.spriteSourceSize);d.aliases=h.aliases}else k=h.frame,m=h.sourceSize,g=h.filename||g,d.rect=cc.rect(k.x,k.y,k.w,k.h),d.rotated=h.rotated||!1,d.offset=cc.p(0,0),d.size=cc.size(m.w,m.h);b[g]=d}}return this._frameConfigCache[a]={_inited:!0,frames:b,meta:e}},addSpriteFrames:function(a,b){cc.assert(a,cc._LogInfos.spriteFrameCache_addSpriteFrames_2); var c=this._frameConfigCache[a]||cc.loader.getRes(a);if(c&&c.frames){var d=this._frameConfigCache[a]||this._getFrameConfig(a),c=d.frames,d=d.meta;b?b instanceof cc.Texture2D||("string"==typeof b?b=cc.textureCache.addImage(b):cc.assert(0,cc._LogInfos.spriteFrameCache_addSpriteFrames_3)):(d=cc.path.changeBasename(a,d.image||".png"),b=cc.textureCache.addImage(d));var d=this._spriteFramesAliases,e=this._spriteFrames,f;for(f in c){var g=c[f],h=e[f];if(!h){h=cc.SpriteFrame.create(b,g.rect,g.rotated,g.offset, g.size);if(g=g.aliases)for(var k=0,m=g.length;k=b&&++d}e.splice(d,0,a);cc.Node.prototype.addChild.call(this,a,b,c);this.reorderBatch(!1); return this},getTextureAtlas:function(){return this.textureAtlas},setTextureAtlas:function(a){a!=this.textureAtlas&&(this.textureAtlas=a)},getDescendants:function(){return this._descendants},initWithFile:function(a,b){var c=cc.textureCache.textureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c,b)},_setNodeDirtyForCache:function(){this._cacheDirty=!0},init:function(a,b){var c=cc.textureCache.textureForKey(a);c||(c=cc.textureCache.addImage(a));return this.initWithTexture(c, b)},increaseAtlasCapacity:function(){var a=this.textureAtlas.capacity,b=Math.floor(4*(a+1)/3);cc.log(cc._LogInfos.SpriteBatchNode_increaseAtlasCapacity,a,b);this.textureAtlas.resizeCapacity(b)||cc.log(cc._LogInfos.SpriteBatchNode_increaseAtlasCapacity_2)},removeChildAtIndex:function(a,b){this.removeChild(this._children[a],b)},rebuildIndexInOrder:function(a,b){var c=a.children;if(c&&0e.zIndex&&(b=this.rebuildIndexInOrder(e,b))}!a==this&&(a.atlasIndex= b,b++);if(c&&0b?c.atlasIndex:c.atlasIndex+1:0>f.zIndex&&0>b||0<=f.zIndex&&0<=b?this.highestAtlasIndexInChild(f)+1:c.atlasIndex+1},reorderBatch:function(a){this._reorderChildDirty=a},setBlendFunc:function(a,b){this._blendFunc=void 0===b?a:{src:a,dst:b}},getBlendFunc:function(){return this._blendFunc},reorderChild:function(a,b){cc.assert(a,cc._LogInfos.SpriteBatchNode_reorderChild_2);-1===this._children.indexOf(a)?cc.log(cc._LogInfos.SpriteBatchNode_reorderChild): b!==a.zIndex&&(cc.Node.prototype.reorderChild.call(this,a,b),this.setNodeDirty())},removeChild:function(a,b){null!=a&&(-1===this._children.indexOf(a)?cc.log(cc._LogInfos.SpriteBatchNode_removeChild):(this.removeSpriteFromAtlas(a),cc.Node.prototype.removeChild.call(this,a,b)))},_mvpMatrix:null,_textureForCanvas:null,_useCache:!1,_originalTexture:null,ctor:null,_ctorForCanvas:function(a,b){cc.Node.prototype.ctor.call(this);var c;b=b||cc.DEFAULT_SPRITE_BATCH_CAPACITY;"string"==typeof a?(c=cc.textureCache.textureForKey(a))|| (c=cc.textureCache.addImage(a)):a instanceof cc.Texture2D&&(c=a);c&&this.initWithTexture(c,b)},_ctorForWebGL:function(a,b){cc.Node.prototype.ctor.call(this);this._mvpMatrix=new cc.kmMat4;var c;b=b||cc.DEFAULT_SPRITE_BATCH_CAPACITY;"string"==typeof a?(c=cc.textureCache.textureForKey(a))||(c=cc.textureCache.addImage(a)):a instanceof cc.Texture2D&&(c=a);c&&this.initWithTexture(c,b)},updateQuadFromSprite:null,_updateQuadFromSpriteForCanvas:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite_2); a instanceof cc.Sprite?(a.batchNode=this,a.atlasIndex=b,a.dirty=!0,a.updateTransform()):cc.log(cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite)},_updateQuadFromSpriteForWebGL:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite);if(a instanceof cc.Sprite){for(var c=this.textureAtlas.capacity;b>=c||c==this.textureAtlas.totalQuads;)this.increaseAtlasCapacity();a.batchNode=this;a.atlasIndex=b;a.dirty=!0;a.updateTransform()}else cc.log(cc._LogInfos.CCSpriteBatchNode_updateQuadFromSprite)}, _swap:function(a,b){var c=this._descendants,d=this.textureAtlas,e=d.quads,f=c[a],g=cc.V3F_C4B_T2F_QuadCopy(e[a]);c[b].atlasIndex=a;c[a]=c[b];d.updateQuad(e[b],a);c[b]=f;d.updateQuad(g,b)},insertQuadFromSprite:null,_insertQuadFromSpriteForCanvas:function(a,b){cc.assert(a,cc._LogInfos.CCSpriteBatchNode_insertQuadFromSprite_2);a instanceof cc.Sprite?(a.batchNode=this,a.atlasIndex=b,a.dirty=!0,a.updateTransform(),this._children.splice(b,0,a)):cc.log(cc._LogInfos.CCSpriteBatchNode_insertQuadFromSprite)}, _insertQuadFromSpriteForWebGL:function(a,b){cc.assert(a,cc._LogInfos.Sprite_insertQuadFromSprite_2);if(a instanceof cc.Sprite){for(var c=this.textureAtlas;b>=c.capacity||c.capacity===c.totalQuads;)this.increaseAtlasCapacity();a.batchNode=this;a.atlasIndex=b;c.insertQuad(a.quad,b);a.dirty=!0;a.updateTransform()}else cc.log(cc._LogInfos.Sprite_insertQuadFromSprite)},_updateAtlasIndex:function(a,b){var c=0,d=a.children;d&&(c=d.length);var e=0;if(0===c)e=a.atlasIndex,a.atlasIndex=b,a.arrivalOrder=0,e!= b&&this._swap(e,b),b++;else{e=!0;0<=d[0].zIndex&&(e=a.atlasIndex,a.atlasIndex=b,a.arrivalOrder=0,e!=b&&this._swap(e,b),b++,e=!1);for(c=0;c=c.capacity&&this.increaseAtlasCapacity();c.insertQuad(a.quad,b);this._descendants.splice(b,0,a);var c=b+1,d=this._descendants;if(d&&0cc.DIRECTOR_FPS_INTERVAL&&(this._SPFLabel.string=this._secondsPerFrame.toFixed(3),this._frameRate=this._frames/this._accumDt,this._accumDt=this._frames=0,this._FPSLabel.string=this._frameRate.toFixed(1),this._drawsLabel.string=(0|cc.g_NumberOfDraws).toString()),this._FPSLabel.visit(),this._SPFLabel.visit(),this._drawsLabel.visit()):this._createStatsLabel();cc.g_NumberOfDraws=0},isSendCleanupToScene:function(){return this._sendCleanupToScene},getRunningScene:function(){return this._runningScene}, getAnimationInterval:function(){return this._animationInterval},isDisplayStats:function(){return this._displayStats},setDisplayStats:function(a){this._displayStats=a},getSecondsPerFrame:function(){return this._secondsPerFrame},isNextDeltaTimeZero:function(){return this._nextDeltaTimeZero},isPaused:function(){return this._paused},getTotalFrames:function(){return this._totalFrames},popToRootScene:function(){this.popToSceneStackLevel(1)},popToSceneStackLevel:function(a){cc.assert(this._runningScene, cc._LogInfos.Director_popToSceneStackLevel_2);var b=this._scenesStack,c=b.length;if(0==c)this.end();else if(!(a>c)){for(;c>a;){var d=b.pop();d.running&&(d.onExitTransitionDidStart(),d.onExit());d.cleanup();c--}this._nextScene=b[b.length-1];this._sendCleanupToScene=!1}},getScheduler:function(){return this._scheduler},setScheduler:function(a){this._scheduler!=a&&(this._scheduler=a)},getActionManager:function(){return this._actionManager},setActionManager:function(a){this._actionManager!=a&&(this._actionManager= a)},getDeltaTime:function(){return this._deltaTime},_createStatsLabel:null,_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1E3}});cc.Director.EVENT_PROJECTION_CHANGED="director_projection_changed";cc.Director.EVENT_AFTER_DRAW="director_after_draw";cc.Director.EVENT_AFTER_VISIT="director_after_visit";cc.Director.EVENT_AFTER_UPDATE="director_after_update"; cc.DisplayLinkDirector=cc.Director.extend({invalid:!1,startAnimation:function(){this._nextDeltaTimeZero=!0;this.invalid=!1},mainLoop:function(){this._purgeDirectorInNextLoop?(this._purgeDirectorInNextLoop=!1,this.purgeDirector()):this.invalid||this.drawScene()},stopAnimation:function(){this.invalid=!0},setAnimationInterval:function(a){this._animationInterval=a;this.invalid||(this.stopAnimation(),this.startAnimation())}});cc.Director.sharedDirector=null;cc.Director.firstUseDirector=!0; cc.Director._getInstance=function(){cc.Director.firstUseDirector&&(cc.Director.firstUseDirector=!1,cc.Director.sharedDirector=new cc.DisplayLinkDirector,cc.Director.sharedDirector.init());return cc.Director.sharedDirector};cc.defaultFPS=60;cc.Director.PROJECTION_2D=0;cc.Director.PROJECTION_3D=1;cc.Director.PROJECTION_CUSTOM=3;cc.Director.PROJECTION_DEFAULT=cc.Director.PROJECTION_3D; cc._renderType===cc._RENDER_TYPE_CANVAS?(_p=cc.Director.prototype,_p.setProjection=function(a){this._projection=a;cc.eventManager.dispatchEvent(this._eventProjectionChanged)},_p.setDepthTest=function(){},_p.setOpenGLView=function(a){this._winSizeInPoints.width=cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=a||cc.view;cc.eventManager&&cc.eventManager.setEnabled(!0)},_p._clear=function(){var a=this._openGLView.getViewPortRect();cc._renderContext.clearRect(-a.x,a.y, a.width,-a.height)},_p._createStatsLabel=function(){var a=0,a=this._winSizeInPoints.width>this._winSizeInPoints.height?0|24*(this._winSizeInPoints.height/320):0|24*(this._winSizeInPoints.width/320);this._FPSLabel=cc.LabelTTF.create("000.0","Arial",a);this._SPFLabel=cc.LabelTTF.create("0.000","Arial",a);this._drawsLabel=cc.LabelTTF.create("0000","Arial",a);a=cc.DIRECTOR_STATS_POSITION;this._drawsLabel.setPosition(this._drawsLabel.width/2+a.x,5*this._drawsLabel.height/2+a.y);this._SPFLabel.setPosition(this._SPFLabel.width/ 2+a.x,3*this._SPFLabel.height/2+a.y);this._FPSLabel.setPosition(this._FPSLabel.width/2+a.x,this._FPSLabel.height/2+a.y)},_p.getVisibleSize=function(){return this.getWinSize()},_p.getVisibleOrigin=function(){return cc.p(0,0)}):(cc.Director._fpsImage=new Image,cc._addEventListener(cc.Director._fpsImage,"load",function(){cc.Director._fpsImageLoaded=!0}),cc._fpsImage&&(cc.Director._fpsImage.src=cc._fpsImage),cc.assert("function"===typeof cc._tmp.DirectorWebGL,cc._LogInfos.MissingFile,"CCDirectorWebGL.js"), cc._tmp.DirectorWebGL(),delete cc._tmp.DirectorWebGL);cc.Camera=cc.Class.extend({_eyeX:null,_eyeY:null,_eyeZ:null,_centerX:null,_centerY:null,_centerZ:null,_upX:null,_upY:null,_upZ:null,_dirty:null,_lookupMatrix:null,ctor:function(){this._lookupMatrix=new cc.kmMat4;this.restore()},description:function(){return"\x3cCCCamera | center \x3d("+this._centerX+","+this._centerY+","+this._centerZ+")\x3e"},setDirty:function(a){this._dirty=a},isDirty:function(){return this._dirty},restore:function(){this._eyeX=this._eyeY=0;this._eyeZ=cc.Camera.getZEye();this._upX= this._centerX=this._centerY=this._centerZ=0;this._upY=1;this._upZ=0;cc.kmMat4Identity(this._lookupMatrix);this._dirty=!1},locate:function(){if(this._dirty){var a=new cc.kmVec3,b=new cc.kmVec3,c=new cc.kmVec3;cc.kmVec3Fill(a,this._eyeX,this._eyeY,this._eyeZ);cc.kmVec3Fill(b,this._centerX,this._centerY,this._centerZ);cc.kmVec3Fill(c,this._upX,this._upY,this._upZ);cc.kmMat4LookAt(this._lookupMatrix,a,b,c);this._dirty=!1}cc.kmGLMultMatrix(this._lookupMatrix)},setEyeXYZ:function(a,b,c){this.setEye(a,b, c)},setEye:function(a,b,c){this._eyeX=a;this._eyeY=b;this._eyeZ=c;this._dirty=!0},setCenterXYZ:function(a,b,c){this.setCenter(a,b,c)},setCenter:function(a,b,c){this._centerX=a;this._centerY=b;this._centerZ=c;this._dirty=!0},setUpXYZ:function(a,b,c){this.setUp(a,b,c)},setUp:function(a,b,c){this._upX=a;this._upY=b;this._upZ=c;this._dirty=!0},getEyeXYZ:function(a,b,c){return{x:this._eyeX,y:this._eyeY,z:this._eyeZ}},getEye:function(){return{x:this._eyeX,y:this._eyeY,z:this._eyeZ}},getCenterXYZ:function(a, b,c){return{x:this._centerX,y:this._centerY,z:this._centerZ}},getCenter:function(){return{x:this._centerX,y:this._centerY,z:this._centerZ}},getUpXYZ:function(a,b,c){return{x:this._upX,y:this._upY,z:this._upZ}},getUp:function(){return{x:this._upX,y:this._upY,z:this._upZ}},_DISALLOW_COPY_AND_ASSIGN:function(a){}});cc.Camera.getZEye=function(){return cc.FLT_EPSILON};cc.PRIORITY_NON_SYSTEM=cc.PRIORITY_SYSTEM+1;cc.arrayVerifyType=function(a,b){if(a&&0=this._interval&&(b&&c&&this._doCallback(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(b&&c&&this._doCallback(),this._elapsed-=this._delay,this._timesExecuted+= 1,this._useDelay=!1):this._elapsed>=this._interval&&(b&&c&&this._doCallback(),this._elapsed=0,this._timesExecuted+=1),this._timesExecuted>this._repeat&&cc.director.getScheduler().unscheduleCallbackForTarget(b,c))}}}); cc.Scheduler=cc.Class.extend({_timeScale:1,_updates:null,_hashForUpdates:null,_arrayForUpdates:null,_hashForTimers:null,_arrayForTimes:null,_currentTarget:null,_currentTargetSalvaged:!1,_updateHashLocked:!1,ctor:function(){this._timeScale=1;this._updates=[[],[],[]];this._hashForUpdates={};this._arrayForUpdates=[];this._hashForTimers={};this._arrayForTimers=[];this._currentTarget=null;this._updateHashLocked=this._currentTargetSalvaged=!1},_removeHashElement:function(a){delete this._hashForTimers[a.target.__instanceId]; cc.arrayRemoveObject(this._arrayForTimers,a);a.Timer=null;a.target=null},_removeUpdateFromHash:function(a){if(a=this._hashForUpdates[a.target.__instanceId])cc.arrayRemoveObject(a.list,a.entry),delete this._hashForUpdates[a.target.__instanceId],cc.arrayRemoveObject(this._arrayForUpdates,a),a.entry=null,a.target=null},_priorityIn:function(a,b,c,d){d=new cc.ListEntry(null,null,b,c,d,!1);if(a){for(var e=a.length-1,f=0;f<=e&&!(cb?d[0]=this._priorityIn(d[0],a,b,c):d[2]=this._priorityIn(d[2],a,b,c)}},unscheduleCallbackForTarget:function(a,b){if(!(null==a||null==b)){var c=this._hashForTimers[a.__instanceId];if(c)for(var d=c.timers,e=0,f=d.length;e=e&&c.timerIndex--;0==d.length&&(this._currentTarget==c?this._currentTargetSalvaged=!0:this._removeHashElement(c));break}}}},unscheduleUpdateForTarget:function(a){null!= a&&(a=this._hashForUpdates[a.__instanceId],null!=a&&(this._updateHashLocked?a.entry.markedForDeletion=!0:this._removeUpdateFromHash(a.entry)))},unscheduleAllCallbacksForTarget:function(a){if(null!=a){var b=this._hashForTimers[a.__instanceId];if(b){var c=b.timers;!b.currentTimerSalvaged&&0<=c.indexOf(b.currentTimer)&&(b.currentTimerSalvaged=!0);c.length=0;this._currentTarget==b?this._currentTargetSalvaged=!0:this._removeHashElement(b)}this.unscheduleUpdateForTarget(a)}},unscheduleAllCallbacks:function(){this.unscheduleAllCallbacksWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)}, unscheduleAllCallbacksWithMinPriority:function(a){for(var b=this._arrayForTimers,c=this._updates,d=0,e=b.length;d=e&&0b){-1!=e&&(c=!0);break}e= g;q=a.substr(g)}if(c)return e;q=a.substr(0,d);for(e=d;h=m.exec(q);)if(e=h[1].length,q=h[1],f=this._measure(q),fb.x||0>b.y);a=this._unflippedOffsetPositionFromCenter; this._flippedX&&(a.x=-a.x);this._flippedY&&(a.y=-a.y);this._offsetPosition.x=a.x+(this._contentSize.width-this._rect.width)/2;this._offsetPosition.y=a.y+(this._contentSize.height-this._rect.height)/2;this._batchNode&&(this.dirty=!0)},_p=null):(cc.assert("function"===typeof cc._tmp.WebGLLabelTTF,cc._LogInfos.MissingFile,"LabelTTFWebGL.js"),cc._tmp.WebGLLabelTTF(),delete cc._tmp.WebGLLabelTTF);cc.assert("function"===typeof cc._tmp.PrototypeLabelTTF,cc._LogInfos.MissingFile,"LabelTTFPropertyDefine.js"); cc._tmp.PrototypeLabelTTF();delete cc._tmp.PrototypeLabelTTF;cc.LabelTTF._textAlign=["left","center","right"];cc.LabelTTF._textBaseline=["top","middle","bottom"];cc.LabelTTF._checkRegEx=/(.+?)([\s\n\r\-\/\\\:]|[\u4E00-\u9FA5]|[\uFE30-\uFFA0])/;cc.LabelTTF._reverseCheckRegEx=/(.*)([\s\n\r\-\/\\\:]|[\u4E00-\u9FA5]|[\uFE30-\uFFA0])/;cc.LabelTTF._checkEnRegEx=/[\s\-\/\\\:]/;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._SHADER_PROGRAM=cc.USE_LA88_LABELS?cc.SHADER_POSITION_TEXTURECOLOR:cc.SHADER_POSITION_TEXTUREA8COLOR;cc.LabelTTF.__labelHeightDiv=cc.newElement("div");cc.LabelTTF.__labelHeightDiv.style.fontFamily="Arial";cc.LabelTTF.__labelHeightDiv.style.position="absolute";cc.LabelTTF.__labelHeightDiv.style.left="-100px";cc.LabelTTF.__labelHeightDiv.style.top="-100px";cc.LabelTTF.__labelHeightDiv.style.lineHeight="normal"; document.body?document.body.appendChild(cc.LabelTTF.__labelHeightDiv):cc._addEventListener(window,"load",function(){this.removeEventListener("load",arguments.callee,!1);document.body.appendChild(cc.LabelTTF.__labelHeightDiv)},!1); cc.LabelTTF.__getFontHeightByDiv=function(a,b){var c=cc.LabelTTF.__fontHeightCache[a+"."+b];if(0=a&&b.actionIndex--;0==b.actions.length&&(this._currentTarget==b?this._currentTargetSalvaged=!0:this._deleteHashElement(b))},_deleteHashElement:function(a){a&&(delete this._hashTargets[a.target.__instanceId],cc.arrayRemoveObject(this._arrayTargets,a),a.actions= null,a.target=null)},_actionAllocWithHashElement:function(a){null==a.actions&&(a.actions=[])},update:function(a){for(var b=this._arrayTargets,c,d=0;d>1;a|=a>>2;a|=a>>4;a|=a>>8;return(a|a>>16)+1}; cc.RenderTexture=cc.Node.extend({sprite:null,clearFlags:0,clearDepthVal:0,autoDraw:!1,_cacheCanvas:null,_cacheContext:null,_fBO:0,_depthRenderBuffer:0,_oldFBO:0,_texture:null,_textureCopy:null,_uITextureImage:null,_pixelFormat:cc.Texture2D.PIXEL_FORMAT_RGBA8888,_clearColor:null,clearStencilVal:0,_clearColorStr:null,_className:"RenderTexture",ctor:null,_ctorForCanvas:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._clearColor=cc.color(255,255,255,255);this._clearColorStr="rgba(255,255,255,1)"; this._cacheCanvas=cc.newElement("canvas");this._cacheContext=this._cacheCanvas.getContext("2d");this.anchorY=this.anchorX=0;void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.initWithWidthAndHeight(a,b,c,d||0))},_ctorForWebGL:function(a,b,c,d){cc.Node.prototype.ctor.call(this);this._clearColor=cc.color(0,0,0,0);void 0!==a&&void 0!==b&&(c=c||cc.Texture2D.PIXEL_FORMAT_RGBA8888,this.initWithWidthAndHeight(a,b,c,d||0))},cleanup:null,_cleanupForCanvas:function(){cc.Node.prototype.onExit.call(this); this._cacheCanvas=this._cacheContext=null},_cleanupForWebGL:function(){cc.Node.prototype.onExit.call(this);this._textureCopy=null;var a=cc._renderContext;a.deleteFramebuffer(this._fBO);this._depthRenderBuffer&&a.deleteRenderbuffer(this._depthRenderBuffer);this._uITextureImage=null},getSprite:function(){return this.sprite},setSprite:function(a){this.sprite=a},initWithWidthAndHeight:null,_initWithWidthAndHeightForCanvas:function(a,b,c,d){c=this._cacheCanvas;d=cc.contentScaleFactor();c.width=0|a*d;c.height= 0|b*d;this._cacheContext.translate(0,c.height);a=new cc.Texture2D;a.initWithElement(c);a.handleLoadedTexture();this.sprite=cc.Sprite.create(a);return!0},_initWithWidthAndHeightForWebGL:function(a,b,c,d){c==cc.Texture2D.PIXEL_FORMAT_A8&&cc.log("cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;");var e=cc._renderContext,f=cc.contentScaleFactor();a=0|a*f;b=0|b*f;this._oldFBO=e.getParameter(e.FRAMEBUFFER_BINDING);var g;cc.configuration.supportsNPOT()? (f=a,g=b):(f=cc.NextPOT(a),g=cc.NextPOT(b));for(var h=new Uint8Array(4*f*g),k=0;k<4*f*g;k++)h[k]=0;this._pixelFormat=c;this._texture=new cc.Texture2D;if(!this._texture)return!1;k=this._texture;k.initWithData(h,this._pixelFormat,f,g,cc.size(a,b));c=e.getParameter(e.RENDERBUFFER_BINDING);if(cc.configuration.checkForGLExtension("GL_QCOM")){this._textureCopy=new cc.Texture2D;if(!this._textureCopy)return!1;this._textureCopy.initWithData(h,this._pixelFormat,f,g,cc.size(a,b))}this._fBO=e.createFramebuffer(); e.bindFramebuffer(e.FRAMEBUFFER,this._fBO);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,k._webTextureObj,0);0!=d&&(this._depthRenderBuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this._depthRenderBuffer),e.renderbufferStorage(e.RENDERBUFFER,d,f,g),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this._depthRenderBuffer));e.checkFramebufferStatus(e.FRAMEBUFFER)!==e.FRAMEBUFFER_COMPLETE&&cc.log("Could not attach texture to the framebuffer"); k.setAliasTexParameters();a=this.sprite=cc.Sprite.create(k);a.scaleY=-1;a.setBlendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.bindRenderbuffer(e.RENDERBUFFER,c);e.bindFramebuffer(e.FRAMEBUFFER,this._oldFBO);this.autoDraw=!1;this.addChild(a);return!0},begin:null,_beginForCanvas:function(){cc._renderContext=this._cacheContext;cc.view._setScaleXYForRenderTexture()},_beginForWebGL:function(){cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPushMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW);cc.kmGLPushMatrix();var a= cc.director;a.setProjection(a.getProjection());var b=this._texture.getContentSizeInPixels(),c=cc.director.getWinSizeInPixels(),a=c.width/b.width,c=c.height/b.height,d=cc._renderContext;d.viewport(0,0,b.width,b.height);b=new cc.kmMat4;cc.kmMat4OrthographicProjection(b,-1/a,1/a,-1/c,1/c,-1,1);cc.kmGLMultMatrix(b);this._oldFBO=d.getParameter(d.FRAMEBUFFER_BINDING);d.bindFramebuffer(d.FRAMEBUFFER,this._fBO);cc.configuration.checkForGLExtension("GL_QCOM")&&(d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0, d.TEXTURE_2D,this._textureCopy._webTextureObj,0),d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,this._texture._webTextureObj,0))},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:null,_beginWithClearForCanvas:function(a,b,c,d,e,f,g){this.begin(); a=a||0;b=b||0;c=c||0;d=isNaN(d)?1:d;e=this._cacheContext;f=this._cacheCanvas;e.save();e.fillStyle="rgba("+(0|a)+","+(0|b)+","+(0|c)+","+d/255+")";e.clearRect(0,0,f.width,-f.height);e.fillRect(0,0,f.width,-f.height);e.restore()},_beginWithClearForWebGL:function(a,b,c,d,e,f,g){this.begin();var h=cc._renderContext,k=[0,0,0,0],m=0,n=0;g&h.COLOR_BUFFER_BIT&&(k=h.getParameter(h.COLOR_CLEAR_VALUE),h.clearColor(a,b,c,d));g&h.DEPTH_BUFFER_BIT&&(m=h.getParameter(h.DEPTH_CLEAR_VALUE),h.clearDepth(e));g&h.STENCIL_BUFFER_BIT&& (n=h.getParameter(h.STENCIL_CLEAR_VALUE),h.clearStencil(f));h.clear(g);g&h.COLOR_BUFFER_BIT&&h.clearColor(k[0],k[1],k[2],k[3]);g&h.DEPTH_BUFFER_BIT&&h.clearDepth(m);g&h.STENCIL_BUFFER_BIT&&h.clearStencil(n)},end:null,_endForCanvas:function(){cc._renderContext=cc._mainRenderContextBackup;cc.view._resetScale()},_endForWebGL:function(){var a=cc._renderContext,b=cc.director;a.bindFramebuffer(a.FRAMEBUFFER,this._oldFBO);b.setViewport();cc.kmGLMatrixMode(cc.KM_GL_PROJECTION);cc.kmGLPopMatrix();cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW); cc.kmGLPopMatrix()},clear:function(a,b,c,d){this.beginWithClear(a,b,c,d);this.end()},clearRect:null,_clearRectForCanvas:function(a,b,c,d){this._cacheContext.clearRect(a,b,c,-d)},_clearRectForWebGL:function(a,b,c,d){},clearDepth:null,_clearDepthForCanvas:function(a){cc.log("clearDepth isn't supported on Cocos2d-Html5")},_clearDepthForWebGL:function(a){this.begin();var b=cc._renderContext,c=b.getParameter(b.DEPTH_CLEAR_VALUE);b.clearDepth(a);b.clear(b.DEPTH_BUFFER_BIT);b.clearDepth(c);this.end()},clearStencil:null, _clearStencilForCanvas:function(a){cc.log("clearDepth isn't supported on Cocos2d-Html5")},_clearStencilForWebGL:function(a){var b=cc._renderContext,c=b.getParameter(b.STENCIL_CLEAR_VALUE);b.clearStencil(a);b.clear(b.STENCIL_BUFFER_BIT);b.clearStencil(c)},visit:null,_visitForCanvas:function(a){this._visible&&(a=a||cc._renderContext,a.save(),this.draw(a),this.transform(a),this.sprite.visit(),a.restore(),this.arrivalOrder=0)},_visitForWebGL:function(a){if(this._visible){cc.kmGLPushMatrix();var b=this.grid; b&&b.isActive()&&(b.beforeDraw(),this.transformAncestors());this.transform(a);this.sprite.visit();this.draw(a);b&&b.isActive()&&b.afterDraw(this);cc.kmGLPopMatrix();this.arrivalOrder=0}},draw:null,_drawForCanvas:function(a){a=a||cc._renderContext;if(this.autoDraw){this.begin();if(this.clearFlags){var b=this._cacheCanvas;a.save();a.fillStyle=this._clearColorStr;a.clearRect(0,0,b.width,-b.height);a.fillRect(0,0,b.width,-b.height);a.restore()}this.sortAllChildren();a=this._children;for(var b=a.length, c=this.sprite,d=0;dc.getCapacity()&&cc.log("cc.LabelAtlas._updateAtlasValues(): Invalid String length");for(var h=c.quads,k=this._displayedColor,k={r:k.r,g:k.g,b:k.b,a:this._displayedOpacity},m=this._itemWidth,n=0;na&&c.increaseTotalQuadsWith(b-a))},setString:null,_setStringForCanvas:function(a){a=String(a);var b=a.length;this._string=a;this.width=b*this._itemWidth;this.height=this._itemHeight;if(this._children){a=this._children;for(var b=a.length,c=0;cthis.textureAtlas.totalQuads&&this.textureAtlas.resizeCapacity(b);this._string=a;this.width=b*this._itemWidth;this.height=this._itemHeight;this.updateAtlasValues();this.quadsToDraw=b},setOpacity:null,_setOpacityForCanvas:function(a){if(this._displayedOpacity!==a){cc.AtlasNode.prototype.setOpacity.call(this,a);for(var b=this._children,c=0,d=b.length;cthis._bufferCapacity){var c=cc.V2F_C4B_T2F_Triangle.BYTES_PER_ELEMENT;this._bufferCapacity+=Math.max(this._bufferCapacity,a);if(null==b||0===b.length)this._buffer=[],this._trianglesArrayBuffer=new ArrayBuffer(c* this._bufferCapacity),this._trianglesReader=new Uint8Array(this._trianglesArrayBuffer);else{a=[];for(var d=new ArrayBuffer(c*this._bufferCapacity),e=0;e=b)){c={r:0|c.r,g:0|c.g,b:0|c.b,a:0|c.a};var e=[],f,g,h,k,m=a.length;for(f=0;f=this._duration},_cloneDecoration:function(a){a._repeatForever=this._repeatForever;a._speed=this._speed;a._times=this._times;a._easeList=this._easeList;a._speedMethod=this._speedMethod;a._repeatMethod=this._repeatMethod},_reverseEaseList:function(a){if(this._easeList){a._easeList=[];for(var b=0;ba?a:1;this.update(0=a)return cc.log("The speed parameter error"),this;this._speedMethod=!0;this._speed*=a;return this},getSpeed:function(){return this._speed},setSpeed:function(a){this._speed=a;return this},repeat:function(a){a=Math.round(a);if(isNaN(a)||1>a)return cc.log("The repeat parameter error"),this;this._repeatMethod=!0;this._times*=a;return this},repeatForever:function(){this._repeatMethod=!0;this._times=this.MAX_VALUE;this._repeatForever=!0;return this}}); cc.ActionInterval.create=function(a){return new cc.ActionInterval(a)}; cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._actions=[];var b=a instanceof Array?a:arguments,c=b.length-1;0<=c&&null==b[c]&&cc.log("parameters should not be ending with null in Javascript");if(0<=c){for(var d=b[0],e,f=1;f=e){for(;a>e&&this._totale?this._two=cc.Sequence._actionOneTwo(b,cc.DelayTime.create(d-e)):dc&&(c+=360);this._startAngleX=b;this._diffAngleX=c;this._startAngleY=a.rotationY%360;a=this._dstAngleY-this._startAngleY;180a&&(a+=360);this._diffAngleY=a},reverse:function(){cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.")},update:function(a){a=this._computeEaseTime(a);this.target&&(this.target.rotationX= this._startAngleX+this._diffAngleX*a,this.target.rotationY=this._startAngleY+this._diffAngleY*a)}});cc.RotateTo.create=function(a,b,c){return new cc.RotateTo(a,b,c)}; 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=cc.RotateBy.create(this._duration,-this._angleX,-this._angleY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.RotateBy.create=function(a,b,c){var d=new cc.RotateBy;d.initWithDuration(a,b,c);return d}; 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=cc.MoveBy.create(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y));this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.MoveBy.create=function(a,b,c){return new cc.MoveBy(a,b,c)}; 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.create=function(a,b,c){return new cc.MoveTo(a,b,c)}; 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.create=function(a,b,c){return new cc.SkewTo(a,b,c)}; 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=cc.SkewBy.create(this._duration,-this._skewX,-this._skewY);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.SkewBy.create=function(a,b,c){var d=new cc.SkewBy;d&&d.initWithDuration(a,b,c);return d}; cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(a,b,c,d,e){cc.ActionInterval.prototype.ctor.call(this);this._startPosition=cc.p(0,0);this._previousPosition=cc.p(0,0);this._delta=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d,e)},initWithDuration:function(a,b,c,d,e){return cc.ActionInterval.prototype.initWithDuration.call(this,a)?(void 0===e&&(e=d,d=c,c=b.y,b=b.x),this._delta.x=b,this._delta.y=c,this._height=d,this._jumps= e,!0):!1},clone:function(){var a=new cc.JumpBy;this._cloneDecoration(a);a.initWithDuration(this._duration,this._delta,this._height,this._jumps);return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);var b=a.getPositionX();a=a.getPositionY();this._previousPosition.x=b;this._previousPosition.y=a;this._startPosition.x=b;this._startPosition.y=a},update:function(a){a=this._computeEaseTime(a);if(this.target){var b=a*this._jumps%1,b=4*this._height*b*(1-b),b=b+this._delta.y* a;a*=this._delta.x;var c=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var d=this.target.getPositionX(),e=this.target.getPositionY(),f=this._previousPosition;c.x=c.x+d-f.x;c.y=c.y+e-f.y;a+=c.x;b+=c.y;f.x=a;f.y=b;this.target.setPosition(a,b)}else this.target.setPosition(c.x+a,c.y+b)}},reverse:function(){var a=cc.JumpBy.create(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.JumpBy.create=function(a,b,c,d,e){return new cc.JumpBy(a,b,c,d,e)}; 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.create=function(a,b,c,d,e){return new cc.JumpTo(a,b,c,d,e)};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=cc.Blink.create(this._duration,this._times);this._cloneDecoration(a);this._reverseEaseList(a);return a}});cc.Blink.create=function(a,b){var c=new cc.Blink;c.initWithDuration(a,b);return c}; 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);if(this.target.RGBAProtocol){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.target.RGBAProtocol&&(this._fromOpacity=a.opacity)}});cc.FadeTo.create=function(a,b){return new cc.FadeTo(a,b)}; cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,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.create=function(a){return new cc.FadeIn(a,255)};cc.FadeOut=cc.FadeTo.extend({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.create=function(a){var b=new cc.FadeOut;b.initWithDuration(a,0);return b}; 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.target.RGBAProtocol&&(this._from=this.target.color)},update:function(a){a=this._computeEaseTime(a);var b=this._from,c=this._to;b&&this.target.RGBAProtocol&&(this.target.color=cc.color(b.r+(c.r-b.r)*a,b.g+(c.g-b.g)*a,b.b+(c.b-b.b)*a))}});cc.TintTo.create=function(a,b,c,d){return new cc.TintTo(a,b,c,d)}; 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.RGBAProtocol&&(a=a.color,this._fromR=a.r,this._fromG=a.g,this._fromB=a.b)},update:function(a){a=this._computeEaseTime(a);this.target.RGBAProtocol&&(this.target.color=cc.color(this._fromR+this._deltaR*a,this._fromG+this._deltaG*a,this._fromB+this._deltaB*a))},reverse:function(){var a=cc.TintBy.create(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);this._cloneDecoration(a);this._reverseEaseList(a);return a}}); cc.TintBy.create=function(a,b,c,d){return new cc.TintBy(a,b,c,d)};cc.DelayTime=cc.ActionInterval.extend({update:function(a){},reverse:function(){var a=cc.DelayTime.create(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.create=function(a){return new cc.DelayTime(a)}; cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._other=null;a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw"cc.ReverseTime.initWithAction(): action must be non null";if(a==this._other)throw"cc.ReverseTime.initWithAction(): the action was already passed in.";return cc.ActionInterval.prototype.initWithDuration.call(this,a._duration)?(this._other=a,!0):!1},clone:function(){var a=new cc.ReverseTime;this._cloneDecoration(a); a.initWithAction(this._other.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._other.startWithTarget(a)},update:function(a){a=this._computeEaseTime(a);this._other&&this._other.update(1-a)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop();cc.Action.prototype.stop.call(this)}});cc.ReverseTime.create=function(a){return new cc.ReverseTime(a)}; cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);this._splitTimes=[];a&&this.initWithAnimation(a)},getAnimation:function(){return this._animation},setAnimation:function(a){this._animation=a},initWithAnimation:function(a){if(!a)throw"cc.Animate.initWithAnimation(): animation must be non-NULL";var b=a.getDuration();if(this.initWithDuration(b*a.getLoops())){this._nextFrame= 0;this.setAnimation(a);this._origFrame=null;this._executedLoops=0;var c=this._splitTimes,d=c.length=0,e=b/a.getTotalDelayUnits();a=a.getFrames();cc.arrayVerifyType(a,cc.AnimationFrame);for(var f=0;fa&&(a*=this._animation.getLoops(),(0|a)>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),a%=1);for(var b=this._animation.getFrames(),c=b.length,d=this._splitTimes,e=this._nextFrame;eb?Math.PI-Math.asin(d/e):Math.asin(d/e);return{newRadius:c/cc.Camera.getZEye(),zenith:a,azimuth:b}},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this, a);a=this.sphericalRadius();isNaN(this._radius)&&(this._radius=a.newRadius);isNaN(this._angleZ)&&(this._angleZ=cc.radiansToDegrees(a.zenith));isNaN(this._angleX)&&(this._angleX=cc.radiansToDegrees(a.azimuth));this._radZ=cc.degreesToRadians(this._angleZ);this._radX=cc.degreesToRadians(this._angleX)},clone:function(){var a=new cc.OrbitCamera;a.initWithDuration(this._duration,this._radius,this._deltaRadius,this._angleZ,this._deltaAngleZ,this._angleX,this._deltaAngleX);return a},update:function(a){a= this._computeEaseTime(a);var b=(this._radius+this._deltaRadius*a)*cc.Camera.getZEye(),c=this._radZ+this._radDeltaZ*a,d=this._radX+this._radDeltaX*a;a=Math.sin(c)*Math.cos(d)*b+this._centerXOrig;d=Math.sin(c)*Math.sin(d)*b+this._centerYOrig;b=Math.cos(c)*b+this._centerZOrig;this.target.getCamera().setEye(a,d,b)}});cc.OrbitCamera.create=function(a,b,c,d,e,f,g){return new cc.OrbitCamera(a,b,c,d,e,f,g)};cc.ActionEase=cc.ActionInterval.extend({_inner:null,ctor:function(a){cc.ActionInterval.prototype.ctor.call(this);a&&this.initWithAction(a)},initWithAction:function(a){if(!a)throw"cc.ActionEase.initWithAction(): action must be non nil";return this.initWithDuration(a.getDuration())?(this._inner=a,!0):!1},clone:function(){var a=new cc.ActionEase;a.initWithAction(this._inner.clone());return a},startWithTarget:function(a){cc.ActionInterval.prototype.startWithTarget.call(this,a);this._inner.startWithTarget(this.target)}, stop:function(){this._inner.stop();cc.ActionInterval.prototype.stop.call(this)},update:function(a){this._inner.update(a)},reverse:function(){return cc.ActionEase.create(this._inner.reverse())},getInnerAction:function(){return this._inner}});cc.ActionEase.create=function(a){return new cc.ActionEase(a)}; cc.EaseRateAction=cc.ActionEase.extend({_rate:0,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);void 0!==b&&this.initWithAction(a,b)},setRate:function(a){this._rate=a},getRate:function(){return this._rate},initWithAction:function(a,b){return cc.ActionEase.prototype.initWithAction.call(this,a)?(this._rate=b,!0):!1},clone:function(){var a=new cc.EaseRateAction;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return cc.EaseRateAction.create(this._inner.reverse(), 1/this._rate)}});cc.EaseRateAction.create=function(a,b){return new cc.EaseRateAction(a,b)};cc.EaseIn=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,this._rate))},reverse:function(){return cc.EaseIn.create(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseIn;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseIn.create=function(a,b){return new cc.EaseIn(a,b)}; cc.easeIn=function(a){return{_rate:a,easing:function(a){return Math.pow(a,this._rate)},reverse:function(){return cc.easeIn(1/this._rate)}}};cc.EaseOut=cc.EaseRateAction.extend({update:function(a){this._inner.update(Math.pow(a,1/this._rate))},reverse:function(){return cc.EaseOut.create(this._inner.reverse(),1/this._rate)},clone:function(){var a=new cc.EaseOut;a.initWithAction(this._inner.clone(),this._rate);return a}});cc.EaseOut.create=function(a,b){return new cc.EaseOut(a,b)}; cc.easeOut=function(a){return{_rate:a,easing:function(a){return Math.pow(a,1/this._rate)},reverse:function(){return cc.easeOut(1/this._rate)}}};cc.EaseInOut=cc.EaseRateAction.extend({update:function(a){a*=2;1>a?this._inner.update(0.5*Math.pow(a,this._rate)):this._inner.update(1-0.5*Math.pow(2-a,this._rate))},clone:function(){var a=new cc.EaseInOut;a.initWithAction(this._inner.clone(),this._rate);return a},reverse:function(){return cc.EaseInOut.create(this._inner.reverse(),this._rate)}}); cc.EaseInOut.create=function(a,b){return new cc.EaseInOut(a,b)};cc.easeInOut=function(a){return{_rate:a,easing:function(a){a*=2;return 1>a?0.5*Math.pow(a,this._rate):1-0.5*Math.pow(2-a,this._rate)},reverse:function(){return cc.easeInOut(this._rate)}}}; cc.EaseExponentialIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a?0:Math.pow(2,10*(a-1)))},reverse:function(){return cc.EaseExponentialOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialIn;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialIn.create=function(a){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 cc.EaseExponentialIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialOut.create=function(a){return new cc.EaseExponentialOut(a)}; cc._easeExponentialOutObj={easing:function(a){return 1==a?1:-Math.pow(2,-10*a)+1},reverse:function(){return cc._easeExponentialInObj}};cc.easeExponentialOut=function(){return cc._easeExponentialOutObj}; cc.EaseExponentialInOut=cc.ActionEase.extend({update:function(a){1!=a&&0!==a&&(a*=2,a=1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2));this._inner.update(a)},reverse:function(){return cc.EaseExponentialInOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseExponentialInOut;a.initWithAction(this._inner.clone());return a}});cc.EaseExponentialInOut.create=function(a){return new cc.EaseExponentialInOut(a)}; cc._easeExponentialInOutObj={easing:function(a){return 1!==a&&0!==a?(a*=2,1>a?0.5*Math.pow(2,10*(a-1)):0.5*(-Math.pow(2,-10*(a-1))+2)):a},reverse:function(){return cc._easeExponentialInOutObj}};cc.easeExponentialInOut=function(){return cc._easeExponentialInOutObj}; cc.EaseSineIn=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-1*Math.cos(a*Math.PI/2)+1;this._inner.update(a)},reverse:function(){return cc.EaseSineOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseSineIn;a.initWithAction(this._inner.clone());return a}});cc.EaseSineIn.create=function(a){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 cc.EaseSineIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseSineOut;a.initWithAction(this._inner.clone());return a}});cc.EaseSineOut.create=function(a){return new cc.EaseSineOut(a)};cc._easeSineOutObj={easing:function(a){return 0===a||1==a?a:Math.sin(a*Math.PI/2)},reverse:function(){return cc._easeSineInObj}};cc.easeSineOut=function(){return cc._easeSineOutObj}; cc.EaseSineInOut=cc.ActionEase.extend({update:function(a){a=0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1);this._inner.update(a)},clone:function(){var a=new cc.EaseSineInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseSineInOut.create(this._inner.reverse())}});cc.EaseSineInOut.create=function(a){return new cc.EaseSineInOut(a)};cc._easeSineInOutObj={easing:function(a){return 0===a||1===a?a:-0.5*(Math.cos(Math.PI*a)-1)},reverse:function(){return cc._easeSineInOutObj}}; cc.easeSineInOut=function(){return cc._easeSineInOutObj}; cc.EaseElastic=cc.ActionEase.extend({_period:0.3,ctor:function(a,b){cc.ActionEase.prototype.ctor.call(this);a&&this.initWithAction(a,b)},getPeriod:function(){return this._period},setPeriod:function(a){this._period=a},initWithAction:function(a,b){cc.ActionEase.prototype.initWithAction.call(this,a);this._period=null==b?0.3:b;return!0},reverse:function(){cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");return null},clone:function(){var a=new cc.EaseElastic;a.initWithAction(this._inner.clone(), this._period);return a}});cc.EaseElastic.create=function(a,b){return new cc.EaseElastic(a,b)};cc.EaseElasticIn=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1===a?b=a:(b=this._period/4,a-=1,b=-Math.pow(2,10*a)*Math.sin(2*(a-b)*Math.PI/this._period));this._inner.update(b)},reverse:function(){return cc.EaseElasticOut.create(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticIn;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticIn.create=function(a,b){return new cc.EaseElasticIn(a,b)};cc._easeElasticInObj={easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin(2*(a-0.075)*Math.PI/0.3)},reverse:function(){return cc._easeElasticOutObj}};cc.easeElasticIn=function(a){return a&&0.3!==a?{_period:a,easing:function(a){if(0===a||1===a)return a;a-=1;return-Math.pow(2,10*a)*Math.sin(2*(a-this._period/4)*Math.PI/this._period)},reverse:function(){return cc.easeElasticOut(this._period)}}:cc._easeElasticInObj}; cc.EaseElasticOut=cc.EaseElastic.extend({update:function(a){var b=0;0===a||1==a?b=a:(b=this._period/4,b=Math.pow(2,-10*a)*Math.sin(2*(a-b)*Math.PI/this._period)+1);this._inner.update(b)},reverse:function(){return cc.EaseElasticIn.create(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticOut;a.initWithAction(this._inner.clone(),this._period);return a}});cc.EaseElasticOut.create=function(a,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(2*(a-0.075)*Math.PI/0.3)+1},reverse:function(){return cc._easeElasticInObj}};cc.easeElasticOut=function(a){return a&&0.3!==a?{_period:a,easing:function(a){return 0===a||1===a?a:Math.pow(2,-10*a)*Math.sin(2*(a-this._period/4)*Math.PI/this._period)+1},reverse:function(){return cc.easeElasticIn(this._period)}}:cc._easeElasticOutObj}; cc.EaseElasticInOut=cc.EaseElastic.extend({update:function(a){var b=0,b=this._period;if(0===a||1==a)b=a;else{b||(b=this._period=0.3*1.5);var c=b/4;a=2*a-1;b=0>a?-0.5*Math.pow(2,10*a)*Math.sin(2*(a-c)*Math.PI/b):0.5*Math.pow(2,-10*a)*Math.sin(2*(a-c)*Math.PI/b)+1}this._inner.update(b)},reverse:function(){return cc.EaseElasticInOut.create(this._inner.reverse(),this._period)},clone:function(){var a=new cc.EaseElasticInOut;a.initWithAction(this._inner.clone(),this._period);return a}}); cc.EaseElasticInOut.create=function(a,b){return new cc.EaseElasticInOut(a,b)};cc.easeElasticInOut=function(a){return{_period:a||0.3,easing:function(a){var c=0,c=this._period;if(0===a||1===a)c=a;else{c||(c=this._period=0.3*1.5);var d=c/4;a=2*a-1;c=0>a?-0.5*Math.pow(2,10*a)*Math.sin(2*(a-d)*Math.PI/c):0.5*Math.pow(2,-10*a)*Math.sin(2*(a-d)*Math.PI/c)+1}return c},reverse:function(){return cc.easeElasticInOut(this._period)}}}; cc.EaseBounce=cc.ActionEase.extend({bounceTime:function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375},clone:function(){var a=new cc.EaseBounce;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseBounce.create(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 cc.EaseBounceOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceIn;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceIn.create=function(a){return new cc.EaseBounceIn(a)}; cc._bounceTime=function(a){if(a<1/2.75)return 7.5625*a*a;if(a<2/2.75)return a-=1.5/2.75,7.5625*a*a+0.75;if(a<2.5/2.75)return a-=2.25/2.75,7.5625*a*a+0.9375;a-=2.625/2.75;return 7.5625*a*a+0.984375};cc._easeBounceInObj={easing:function(a){return 1-cc._bounceTime(1-a)},reverse:function(){return cc._easeBounceOutObj}};cc.easeBounceIn=function(){return cc._easeBounceInObj}; cc.EaseBounceOut=cc.EaseBounce.extend({update:function(a){a=this.bounceTime(a);this._inner.update(a)},reverse:function(){return cc.EaseBounceIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBounceOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBounceOut.create=function(a){return new cc.EaseBounceOut(a)};cc._easeBounceOutObj={easing:function(a){return cc._bounceTime(a)},reverse:function(){return cc._easeBounceInObj}};cc.easeBounceOut=function(){return cc._easeBounceOutObj}; cc.EaseBounceInOut=cc.EaseBounce.extend({update:function(a){var b=0,b=0.5>a?0.5*(1-this.bounceTime(1-2*a)):0.5*this.bounceTime(2*a-1)+0.5;this._inner.update(b)},clone:function(){var a=new cc.EaseBounceInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseBounceInOut.create(this._inner.reverse())}});cc.EaseBounceInOut.create=function(a){return new cc.EaseBounceInOut(a)}; cc._easeBounceInOutObj={easing:function(a){return a=0.5>a?0.5*(1-cc._bounceTime(1-2*a)):0.5*cc._bounceTime(2*a-1)+0.5},reverse:function(){return cc._easeBounceInOutObj}};cc.easeBounceInOut=function(){return cc._easeBounceInOutObj};cc.EaseBackIn=cc.ActionEase.extend({update:function(a){this._inner.update(0===a||1==a?a:a*a*(2.70158*a-1.70158))},reverse:function(){return cc.EaseBackOut.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBackIn;a.initWithAction(this._inner.clone());return a}}); cc.EaseBackIn.create=function(a){return new cc.EaseBackIn(a)};cc._easeBackInObj={easing:function(a){return 0===a||1===a?a:a*a*(2.70158*a-1.70158)},reverse:function(){return cc._easeBackOutObj}};cc.easeBackIn=function(){return cc._easeBackInObj}; cc.EaseBackOut=cc.ActionEase.extend({update:function(a){a-=1;this._inner.update(a*a*(2.70158*a+1.70158)+1)},reverse:function(){return cc.EaseBackIn.create(this._inner.reverse())},clone:function(){var a=new cc.EaseBackOut;a.initWithAction(this._inner.clone());return a}});cc.EaseBackOut.create=function(a){return new cc.EaseBackOut(a)};cc._easeBackOutObj={easing:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},reverse:function(){return cc._easeBackInObj}};cc.easeBackOut=function(){return cc._easeBackOutObj}; cc.EaseBackInOut=cc.ActionEase.extend({update:function(a){a*=2;1>a?this._inner.update(a*a*(3.5949095*a-2.5949095)/2):(a-=2,this._inner.update(a*a*(3.5949095*a+2.5949095)/2+1))},clone:function(){var a=new cc.EaseBackInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseBackInOut.create(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=cc.EaseBezierAction.create(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 cc.EaseQuadraticActionIn.create(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 cc.EaseQuadraticActionOut.create(this._inner.reverse())}}); cc.EaseQuadraticActionOut.create=function(a){return new cc.EaseQuadraticActionOut(a)};cc._easeQuadraticActionOut={easing:cc.EaseQuadraticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuadraticActionOut}};cc.easeQuadraticActionOut=function(){return cc._easeQuadraticActionOut}; cc.EaseQuadraticActionInOut=cc.ActionEase.extend({_updateTime:function(a){var b=a;a*=2;1>a?b=0.5*a*a:(--a,b=-0.5*(a*(a-2)-1));return b},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuadraticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseQuadraticActionInOut.create(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 cc.EaseQuarticActionIn.create(this._inner.reverse())}}); cc.EaseQuarticActionIn.create=function(a){return new cc.EaseQuarticActionIn(a)};cc._easeQuarticActionIn={easing:cc.EaseQuarticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuarticActionIn}};cc.easeQuarticActionIn=function(){return cc._easeQuarticActionIn}; cc.EaseQuarticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return-(a*a*a*a-1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseQuarticActionOut.create(this._inner.reverse())}});cc.EaseQuarticActionOut.create=function(a){return new cc.EaseQuarticActionOut(a)};cc._easeQuarticActionOut={easing:cc.EaseQuarticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuarticActionOut}}; cc.easeQuarticActionOut=function(){return cc._easeQuarticActionOut};cc.EaseQuarticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a;a-=2;return-0.5*(a*a*a*a-2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuarticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseQuarticActionInOut.create(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 cc.EaseQuinticActionIn.create(this._inner.reverse())}}); cc.EaseQuinticActionIn.create=function(a){return new cc.EaseQuinticActionIn(a)};cc._easeQuinticActionIn={easing:cc.EaseQuinticActionIn.prototype._updateTime,reverse:function(){return cc._easeQuinticActionIn}};cc.easeQuinticActionIn=function(){return cc._easeQuinticActionIn}; cc.EaseQuinticActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseQuinticActionOut.create(this._inner.reverse())}});cc.EaseQuinticActionOut.create=function(a){return new cc.EaseQuinticActionOut(a)};cc._easeQuinticActionOut={easing:cc.EaseQuinticActionOut.prototype._updateTime,reverse:function(){return cc._easeQuinticActionOut}}; cc.easeQuinticActionOut=function(){return cc._easeQuinticActionOut};cc.EaseQuinticActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a*a*a;a-=2;return 0.5*(a*a*a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseQuinticActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseQuinticActionInOut.create(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 cc.EaseCircleActionIn.create(this._inner.reverse())}}); cc.EaseCircleActionIn.create=function(a){return new cc.EaseCircleActionIn(a)};cc._easeCircleActionIn={easing:cc.EaseCircleActionIn.prototype._updateTime,reverse:function(){return cc._easeCircleActionIn}};cc.easeCircleActionIn=function(){return cc._easeCircleActionIn}; cc.EaseCircleActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return Math.sqrt(1-a*a)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseCircleActionOut.create(this._inner.reverse())}});cc.EaseCircleActionOut.create=function(a){return new cc.EaseCircleActionOut(a)};cc._easeCircleActionOut={easing:cc.EaseCircleActionOut.prototype._updateTime,reverse:function(){return cc._easeCircleActionOut}}; cc.easeCircleActionOut=function(){return cc._easeCircleActionOut};cc.EaseCircleActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return-0.5*(Math.sqrt(1-a*a)-1);a-=2;return 0.5*(Math.sqrt(1-a*a)+1)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCircleActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseCircleActionInOut.create(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 cc.EaseCubicActionIn.create(this._inner.reverse())}}); cc.EaseCubicActionIn.create=function(a){return new cc.EaseCubicActionIn(a)};cc._easeCubicActionIn={easing:cc.EaseCubicActionIn.prototype._updateTime,reverse:function(){return cc._easeCubicActionIn}};cc.easeCubicActionIn=function(){return cc._easeCubicActionIn}; cc.EaseCubicActionOut=cc.ActionEase.extend({_updateTime:function(a){a-=1;return a*a*a+1},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseCubicActionOut.create(this._inner.reverse())}});cc.EaseCubicActionOut.create=function(a){return new cc.EaseCubicActionOut(a)};cc._easeCubicActionOut={easing:cc.EaseCubicActionOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionOut}}; cc.easeCubicActionOut=function(){return cc._easeCubicActionOut};cc.EaseCubicActionInOut=cc.ActionEase.extend({_updateTime:function(a){a*=2;if(1>a)return 0.5*a*a*a;a-=2;return 0.5*(a*a*a+2)},update:function(a){this._inner.update(this._updateTime(a))},clone:function(){var a=new cc.EaseCubicActionInOut;a.initWithAction(this._inner.clone());return a},reverse:function(){return cc.EaseCubicActionInOut.create(this._inner.reverse())}});cc.EaseCubicActionInOut.create=function(a){return new cc.EaseCubicActionInOut(a)}; cc._easeCubicActionInOut={easing:cc.EaseCubicActionInOut.prototype._updateTime,reverse:function(){return cc._easeCubicActionInOut}};cc.easeCubicActionInOut=function(){return cc._easeCubicActionInOut};cc.cardinalSplineAt=function(a,b,c,d,e,f){var g=f*f,h=g*f,k=(1-e)/2;e=k*(-h+2*g-f);var m=k*(-h+g)+(2*h-3*g+1);f=k*(h-2*g+f)+(-2*h+3*g);g=k*(h-g);return cc.p(a.x*e+b.x*m+c.x*f+d.x*g,a.y*e+b.y*m+c.y*f+d.y*g)};cc.reverseControlPoints=function(a){for(var b=[],c=a.length-1;0<=c;c--)b.push(cc.p(a[c].x,a[c].y));return b};cc.copyControlPoints=function(a){for(var b=[],c=0;cg?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(h=cc.p(0,0),k=cc.p(0,1),e=cc.p(1,0),d=cc.p(1,1),f=g);b.x=f-f*c;b.z=Math.abs(parseFloat(f*a/4));a=this.originalVertex(e);a.x=b.x;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.x=b.x;a.z+=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.x-=b.x;a.z-=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.x-=b.x;a.z-=b.z;this.setVertex(k, a)}});cc.FlipX3D.create=function(a){return new cc.FlipX3D(a)}; cc.FlipY3D=cc.FlipX3D.extend({ctor:function(a){void 0!==a?cc.GridAction.prototype.ctor.call(this,a,cc.size(1,1)):cc.GridAction.prototype.ctor.call(this)},update:function(a){var b=Math.PI*a;a=Math.sin(b);var c=Math.cos(b/2),b=new cc.Vertex3F,d=cc.p(0,0);d.x=d.y=1;var e=this.originalVertex(d);d.x=d.y=0;var d=this.originalVertex(d),f=e.y,g=d.y,h,k;f>g?(e=cc.p(0,0),d=cc.p(0,1),h=cc.p(1,0),k=cc.p(1,1)):(d=cc.p(0,0),e=cc.p(0,1),k=cc.p(1,0),h=cc.p(1,1),f=g);b.y=f-f*c;b.z=Math.abs(parseFloat(f*a)/4);a=this.originalVertex(e); a.y=b.y;a.z+=b.z;this.setVertex(e,a);a=this.originalVertex(d);a.y-=b.y;a.z-=b.z;this.setVertex(d,a);a=this.originalVertex(h);a.y=b.y;a.z+=b.z;this.setVertex(h,a);a=this.originalVertex(k);a.y-=b.y;a.z-=b.z;this.setVertex(k,a)}});cc.FlipY3D.create=function(a){return new cc.FlipY3D(a)}; cc.Lens3D=cc.Grid3DAction.extend({_position:null,_radius:0,_lensEffect:0,_concave:!1,_dirty:!1,ctor:function(a,b,c,d){cc.GridAction.prototype.ctor.call(this);this._position=cc.p(0,0);void 0!==d&&this.initWithDuration(a,b,c,d)},getLensEffect:function(){return this._lensEffect},setLensEffect:function(a){this._lensEffect=a},setConcave:function(a){this._concave=a},getPosition:function(){return this._position},setPosition:function(a){cc.pointEqualToPoint(a,this._position)||(this._position.x=a.x,this._position.y= a.y,this._dirty=!0)},initWithDuration:function(a,b,c,d){return cc.Grid3DAction.prototype.initWithDuration.call(this,a,b)?(this.setPosition(c),this._radius=d,this._lensEffect=0.7,this._dirty=!0):!1},update:function(a){if(this._dirty){a=this._gridSize.width;for(var b=this._gridSize.height,c=this._radius,d=this._lensEffect,e=cc.p(0,0),f=cc.p(0,0),g,h,k,m=0;me?this.transformTile(c,e):this.turnOnTile(c)}});cc.FadeOutTRTiles.create=function(a,b){return new cc.FadeOutTRTiles(a,b)}; cc.FadeOutBLTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){return 0==a.width+a.height?1:Math.pow((this._gridSize.width*(1-b)+this._gridSize.height*(1-b))/(a.width+a.height),6)}});cc.FadeOutBLTiles.create=function(a,b){return new cc.FadeOutBLTiles(a,b)}; cc.FadeOutUpTiles=cc.FadeOutTRTiles.extend({testFunc:function(a,b){var c=this._gridSize.height*b;return 0==c?1:Math.pow(a.height/c,6)},transformTile:function(a,b){var c=this.originalTile(a),d=this.target.grid.getStep();c.bl.y+=d.y/2*(1-b);c.br.y+=d.y/2*(1-b);c.tl.y-=d.y/2*(1-b);c.tr.y-=d.y/2*(1-b);this.setTile(a,c)}});cc.FadeOutUpTiles.create=function(a,b){return new cc.FadeOutUpTiles(a,b)}; cc.FadeOutDownTiles=cc.FadeOutUpTiles.extend({testFunc:function(a,b){return 0==a.height?1:Math.pow(this._gridSize.height*(1-b)/a.height,6)}});cc.FadeOutDownTiles.create=function(a,b){return new cc.FadeOutDownTiles(a,b)}; cc.TurnOffTiles=cc.TiledGrid3DAction.extend({_seed:null,_tilesCount:0,_tilesOrder:null,ctor:function(a,b,c){cc.GridAction.prototype.ctor.call(this);this._tilesOrder=[];void 0!==b&&this.initWithDuration(a,b,c)},initWithDuration:function(a,b,c){return cc.TiledGrid3DAction.prototype.initWithDuration.call(this,a,b)?(this._seed=c||0,this._tilesOrder.length=0,!0):!1},shuffle:function(a,b){for(var c=b-1;0<=c;c--){var d=0|cc.rand()%(c+1),e=a[c];a[c]=a[d];a[d]=e}},turnOnTile:function(a){this.setTile(a,this.originalTile(a))}, turnOffTile:function(a){this.setTile(a,new cc.Quad3)},startWithTarget:function(a){cc.TiledGrid3DAction.prototype.startWithTarget.call(this,a);this._tilesCount=this._gridSize.width*this._gridSize.height;a=this._tilesOrder;for(var b=a.length=0;b>7-(a<<1)&1,b>>7- ((a<<1)+1)&1):cc.p(b>>(a<<1)+1&1,b>>(a<<1)&1)}return cc.p(0,0)},_origin:null,_startAngle:270,_endAngle:270,_radius:0,_counterClockWise:!1,_barRect:null,_vertexDataCount:0,_vertexData:null,_vertexArrayBuffer:null,_vertexWebGLBuffer:null,_vertexDataDirty:!1,ctor:null,_ctorForCanvas:function(){cc.NodeRGBA.prototype.ctor.call(this);this._type=cc.ProgressTimer.TYPE_RADIAL;this._percentage=0;this._midPoint=cc.p(0,0);this._barChangeRate=cc.p(0,0);this._reverseDirection=!1;this._sprite=null;this._origin= cc.p(0,0);this._endAngle=this._startAngle=270;this._radius=0;this._counterClockWise=!1;this._barRect=cc.rect(0,0,0,0)},_ctorForWebGL:function(){cc.NodeRGBA.prototype.ctor.call(this);this._type=cc.ProgressTimer.TYPE_RADIAL;this._percentage=0;this._midPoint=cc.p(0,0);this._barChangeRate=cc.p(0,0);this._reverseDirection=!1;this._sprite=null;this._vertexWebGLBuffer=cc._renderContext.createBuffer();this._vertexDataCount=0;this._vertexArrayBuffer=this._vertexData=null;this._vertexDataDirty=!1},setColor:function(a){this._sprite.color= a;this._updateColor()},setOpacity:function(a){this._sprite.opacity=a;this._updateColor()},getColor:function(){return this._sprite.color},getOpacity:function(){return this._sprite.opacity},setReverseProgress:null,_setReverseProgressForCanvas:function(a){this._reverseDirection!==a&&(this._reverseDirection=a)},_setReverseProgressForWebGL:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0)},setSprite:null,_setSpriteForCanvas:function(a){this._sprite!= a&&(this._sprite=a,this.width=this._sprite.width,this.height=this._sprite.height)},_setSpriteForWebGL:function(a){a&&this._sprite!=a&&(this._sprite=a,this.width=a.width,this.height=a.height,this._vertexData&&(this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0))},setType:null,_setTypeForCanvas:function(a){a!==this._type&&(this._type=a)},_setTypeForWebGL:function(a){a!==this._type&&(this._vertexData&&(this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0),this._type= a)},setReverseDirection:null,_setReverseDirectionForCanvas:function(a){this._reverseDirection!==a&&(this._reverseDirection=a)},_setReverseDirectionForWebGL:function(a){this._reverseDirection!==a&&(this._reverseDirection=a,this._vertexArrayBuffer=this._vertexData=null,this._vertexDataCount=0)},_textureCoordFromAlphaPoint:function(a){var b=this._sprite;if(!b)return{u:0,v:0};var c=b.quad,d=cc.p(c.bl.texCoords.u,c.bl.texCoords.v),c=cc.p(c.tr.texCoords.u,c.tr.texCoords.v);b.textureRectRotated&&(b=a.x, a.x=a.y,a.y=b);return{u:d.x*(1-a.x)+c.x*a.x,v:d.y*(1-a.y)+c.y*a.y}},_vertexFromAlphaPoint:function(a){if(!this._sprite)return{x:0,y:0};var b=this._sprite.quad,c=cc.p(b.bl.vertices.x,b.bl.vertices.y),b=cc.p(b.tr.vertices.x,b.tr.vertices.y);return{x:c.x*(1-a.x)+b.x*a.x,y:c.y*(1-a.y)+b.y*a.y}},initWithSprite:null,_initWithSpriteForCanvas:function(a){this.percentage=0;this.anchorY=this.anchorX=0.5;this._type=cc.ProgressTimer.TYPE_RADIAL;this._reverseDirection=!1;this.midPoint=cc.p(0.5,0.5);this.barChangeRate= cc.p(1,1);this.sprite=a;return!0},_initWithSpriteForWebGL:function(a){this.percentage=0;this._vertexArrayBuffer=this._vertexData=null;this._vertexDataCount=0;this.anchorY=this.anchorX=0.5;this._type=cc.ProgressTimer.TYPE_RADIAL;this._reverseDirection=!1;this.midPoint=cc.p(0.5,0.5);this.barChangeRate=cc.p(1,1);this.sprite=a;this.shaderProgram=cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR);return!0},draw:null,_drawForCanvas:function(a){a=a||cc._renderContext;var b=this._sprite;b._isLighterMode&& (a.globalCompositeOperation="lighter");var c=cc.view.getScaleX(),d=cc.view.getScaleY();a.globalAlpha=b._displayedOpacity/255;var e=b._rect,f=b._contentSize,g=b._offsetPosition,h=b._drawSize_Canvas,k=0|g.x,m=-g.y-e.height,n=b._textureRect_Canvas;h.width=e.width*c;h.height=e.height*d;a.save();b._flippedX&&(k=-g.x-e.width,a.scale(-1,1));b._flippedY&&(m=g.y,a.scale(1,-1));k*=c;m*=d;this._type==cc.ProgressTimer.TYPE_BAR?(e=this._barRect,a.beginPath(),a.rect(e.x*c,e.y*d,e.width*c,e.height*d),a.clip(),a.closePath()): this._type==cc.ProgressTimer.TYPE_RADIAL&&(e=this._origin.x*c,g=this._origin.y*d,a.beginPath(),a.arc(e,g,this._radius*d,Math.PI/180*this._startAngle,Math.PI/180*this._endAngle,this._counterClockWise),a.lineTo(e,g),a.clip(),a.closePath());b._texture&&n.validRect?(c=b._texture.getHtmlElementObj(),this._colorized?a.drawImage(c,0,0,n.width,n.height,k,m,h.width,h.height):a.drawImage(c,n.x,n.y,n.width,n.height,k,m,h.width,h.height)):0!==f.width&&(h=this.color,a.fillStyle="rgba("+h.r+","+h.g+","+h.b+",1)", a.fillRect(k,m,f.width*c,f.height*d));a.restore();cc.incrementGLDraws(1)},_drawForWebGL:function(a){a=a||cc._renderContext;if(this._vertexData&&this._sprite){cc.nodeDrawSetup(this);var b=this._sprite.getBlendFunc();cc.glBlendFunc(b.src,b.dst);cc.glEnableVertexAttribs(cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);cc.glBindTexture2D(this._sprite.texture);a.bindBuffer(a.ARRAY_BUFFER,this._vertexWebGLBuffer);this._vertexDataDirty&&(a.bufferData(a.ARRAY_BUFFER,this._vertexArrayBuffer,a.DYNAMIC_DRAW),this._vertexDataDirty= !1);b=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;a.vertexAttribPointer(cc.VERTEX_ATTRIB_POSITION,2,a.FLOAT,!1,b,0);a.vertexAttribPointer(cc.VERTEX_ATTRIB_COLOR,4,a.UNSIGNED_BYTE,!0,b,8);a.vertexAttribPointer(cc.VERTEX_ATTRIB_TEX_COORDS,2,a.FLOAT,!1,b,12);this._type===cc.ProgressTimer.TYPE_RADIAL?a.drawArrays(a.TRIANGLE_FAN,0,this._vertexDataCount):this._type==cc.ProgressTimer.TYPE_BAR&&(this._reverseDirection?(a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount/2),a.drawArrays(a.TRIANGLE_STRIP,4,this._vertexDataCount/ 2),cc.g_NumberOfDraws++):a.drawArrays(a.TRIANGLE_STRIP,0,this._vertexDataCount));cc.g_NumberOfDraws++}},_updateRadial:function(){if(this._sprite){var a,b=this._midPoint;a=this._percentage/100;var c=2*cc.PI*(this._reverseDirection?a:1-a),d=cc.p(b.x,1),e=cc.pRotateByAngle(d,b,c),c=0;if(0==a)e=d,c=0;else if(1==a)e=d,c=4;else{var f=cc.FLT_MAX,g=cc.ProgressTimer.TEXTURE_COORDS_COUNT;for(a=0;a<=g;++a){var h=(a+(g-1))%g,k=this._boundaryTexCoord(a%g),h=this._boundaryTexCoord(h);0==a?h=cc.pLerp(k,h,1-b.x): 4==a&&(k=cc.pLerp(k,h,1-b.x));var m=cc.p(0,0);if(cc.pLineIntersect(k,h,b,e,m)&&(!(0==a||4==a)||0<=m.x&&1>=m.x)&&0<=m.y&&m.yb.x&&(c.x+=-b.x,b.x=0);1b.y&&(c.y+=-b.y,b.y=0);1a;a++)e[a]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,a*d);e[0].texCoords=this._textureCoordFromAlphaPoint(cc.p(0,1));e[0].vertices=this._vertexFromAlphaPoint(cc.p(0,1));e[1].texCoords=this._textureCoordFromAlphaPoint(cc.p(0,0));e[1].vertices=this._vertexFromAlphaPoint(cc.p(0,0));e[6].texCoords=this._textureCoordFromAlphaPoint(cc.p(1,1));e[6].vertices=this._vertexFromAlphaPoint(cc.p(1,1));e[7].texCoords=this._textureCoordFromAlphaPoint(cc.p(1, 0));e[7].vertices=this._vertexFromAlphaPoint(cc.p(1,0));this._vertexData=e}a=this._vertexData;a[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x,c.y));a[2].vertices=this._vertexFromAlphaPoint(cc.p(b.x,c.y));a[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x,b.y));a[3].vertices=this._vertexFromAlphaPoint(cc.p(b.x,b.y));a[4].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,c.y));a[4].vertices=this._vertexFromAlphaPoint(cc.p(c.x,c.y));a[5].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x, b.y));a[5].vertices=this._vertexFromAlphaPoint(cc.p(c.x,b.y))}else{if(!this._vertexData){this._vertexDataCount=4;d=cc.V2F_C4B_T2F.BYTES_PER_ELEMENT;this._vertexArrayBuffer=new ArrayBuffer(4*d);this._vertexData=[];for(a=0;4>a;a++)this._vertexData[a]=new cc.V2F_C4B_T2F(null,null,null,this._vertexArrayBuffer,a*d)}a=this._vertexData;a[0].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x,c.y));a[0].vertices=this._vertexFromAlphaPoint(cc.p(b.x,c.y));a[1].texCoords=this._textureCoordFromAlphaPoint(cc.p(b.x, b.y));a[1].vertices=this._vertexFromAlphaPoint(cc.p(b.x,b.y));a[2].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,c.y));a[2].vertices=this._vertexFromAlphaPoint(cc.p(c.x,c.y));a[3].texCoords=this._textureCoordFromAlphaPoint(cc.p(c.x,b.y));a[3].vertices=this._vertexFromAlphaPoint(cc.p(c.x,b.y))}this._updateColor()}},_updateColor:function(){if(this._sprite&&this._vertexData){for(var a=this._sprite.quad.tl.colors,b=this._vertexData,c=0,d=this._vertexDataCount;c=b-h.x&&(e=b-g.width);b=h.y-g.height/2;0.5=c-h.y&&(b=c-g.height);f.x=0;c=1;a._flippedX&&(f.x-=g.width,c=-1);0a.height?(a=16,b=12):(a=12,b=16);a=this.actionWithSize(cc.size(a, b));this._back?(this._inScene.visible=!1,this._inScene.runAction(cc.Sequence.create(cc.Show.create(),a,cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))):this._outScene.runAction(cc.Sequence.create(a,cc.CallFunc.create(this.finish,this),cc.StopGrid.create()))},_sceneOrder:function(){this._isInSceneOnTop=this._back}});cc.TransitionPageTurn.create=function(a,b,c){var d=new cc.TransitionPageTurn;d.initWithDuration(a,b,c);return d};cc.TextFieldDelegate=cc.Class.extend({onTextFieldAttachWithIME:function(a){return!1},onTextFieldDetachWithIME:function(a){return!1},onTextFieldInsertText:function(a,b,c){return!1},onTextFieldDeleteBackward:function(a,b,c){return!1},onDraw:function(a){return!1}}); cc.TextFieldTTF=cc.LabelTTF.extend({delegate:null,colorSpaceHolder:null,_lens:null,_inputText:"",_placeHolder:"",_charCount:0,_className:"TextFieldTTF",ctor:function(a,b,c,d,e){this.colorSpaceHolder=cc.color(127,127,127);cc.imeDispatcher.addDelegate(this);cc.LabelTTF.prototype.ctor.call(this);void 0!==e?(this.initWithPlaceHolder("",b,c,d,e),a&&this.setPlaceHolder(a)):void 0===d&&void 0!==c&&(this.initWithString("",b,c),a&&this.setPlaceHolder(a))},getDelegate:function(){return this.delegate},setDelegate:function(a){this.delegate= a},getCharCount:function(){return this._charCount},getColorSpaceHolder:function(){return this.colorSpaceHolder},setColorSpaceHolder:function(a){this.colorSpaceHolder=a},initWithPlaceHolder:function(a,b,c,d,e){switch(arguments.length){case 5:return a&&this.setPlaceHolder(a),this.initWithString(this._placeHolder,d,e,b,c);case 3:return a&&this.setPlaceHolder(a),this.initWithString(this._placeHolder,arguments[1],arguments[2]);default:throw"Argument must be non-nil ";}},setString:function(a){this._inputText= (a=String(a))||"";this._inputText.length?cc.LabelTTF.prototype.setString.call(this,this._inputText):cc.LabelTTF.prototype.setString.call(this,this._placeHolder);this._charCount=this._inputText.length},getString:function(){return this._inputText},setPlaceHolder:function(a){this._placeHolder=a||"";this._inputText.length||cc.LabelTTF.prototype.setString.call(this,this._placeHolder)},getPlaceHolder:function(){return this._placeHolder},draw:function(a){a=a||cc._renderContext;if(!this.delegate||!this.delegate.onDraw(this))if(this._inputText&& 0=a?(this._inputText="",this._charCount=0,cc.LabelTTF.prototype.setString.call(this,this._placeHolder)):this.string=this._inputText.substring(0,a-1)},removeDelegate:function(){cc.imeDispatcher.removeDelegate(this)}, insertText:function(a,b){var c=a,d=c.indexOf("\n");-1=this._maxAudioInstance)return cc.log("Error: "+a+" greater than "+this._maxAudioInstance),null;b=this._getAudioByUrl(a);if(!b)return null;b=b.cloneNode(!0);this._effectPauseCb&&cc._addEventListener(b,"pause",this._effectPauseCb);b.volume=this._effectsVolume;c.push(b)}return b},playEffect:function(a,b){var c=this._getEffect(a);if(!c)return null;c.loop=b||!1;c.play();var d=this._audioID++; this._effects[d]=c;return d},setEffectsVolume:function(a){a=this._effectsVolume=Math.min(Math.max(a,0),1);var b=this._effects,c;for(c in b)b[c].volume=a},pauseEffect:function(a){(a=this._effects[a])&&!a.ended&&a.pause()},pauseAllEffects:function(){var a=this._effects,b;for(b in a){var c=a[b];c.ended||c.pause()}},resumeEffect:function(a){this._resumeAudio(this._effects[a])},resumeAllEffects:function(){var a=this._effects,b;for(b in a)this._resumeAudio(a[b])},stopEffect:function(a){this._stopAudio(this._effects[a]); delete this._effects[a]},stopAllEffects:function(){var a=this._effects,b;for(b in a)this._stopAudio(a[b]),delete a[b]},unloadEffect:function(a){var b=cc.loader,c=this._effects,d=this._getEffectList(a);b.release(a);if(0!=d.length){b=d[0].src;delete this._audioPool[a];for(var e in c)c[e].src==b&&(this._stopAudio(c[e]),delete c[e])}},end:function(){this.stopMusic();this.stopAllEffects()},_pausePlaying:function(){var a=this._effects,b,c;for(c in a)if((b=a[c])&&!b.ended&&!b.paused)this._playings.push(b), b.pause();this.isMusicPlaying()&&(this._playings.push(this._currMusic),this._currMusic.pause())},_resumePlaying:function(){for(var a=this._playings,b=0,c=a.length;bcc.sys._supportMultipleAudio&&(cc.AudioEngineForSingle=cc.AudioEngine.extend({_waitingEffIds:[],_pausedEffIds:[],_currEffect:null,_maxAudioInstance:2,_effectCache4Single:{},_needToResumeMusic:!1,_expendTime4Music:0,_isHiddenMode:!1,_playMusic:function(a){this._stopAllEffects();this._super(a)},resumeMusic:function(){1==this._musicPlayState&&(this._stopAllEffects(),this._needToResumeMusic=!1,this._expendTime4Music=0,this._super())},playEffect:function(a,b){var c=this._currEffect, d=b?this._getEffect(a):this._getSingleEffect(a);if(!d)return null;d.loop=b||!1;var e=this._audioID++;this._effects[e]=d;this.isMusicPlaying()&&(this.pauseMusic(),this._needToResumeMusic=!0);c?(c!=d&&this._waitingEffIds.push(this._currEffectId),this._waitingEffIds.push(e),c.pause()):(this._currEffect=d,this._currEffectId=e,d.play());return e},pauseEffect:function(a){cc.log("pauseEffect not supported in single audio mode!")},pauseAllEffects:function(){var a=this._waitingEffIds,b=this._pausedEffIds, c=this._currEffect;if(c){for(var d=0,e=a.length;d