var cc=cc||{};cc._tmp=cc._tmp||{};cc._LogInfos={};_p=window;_p=Object.prototype;delete window._p;cc.newElement=function(b){return document.createElement(b)};cc._addEventListener=function(f,e,h,g){f.addEventListener(e,h,g)};cc._isNodeJs="undefined"!==typeof require&&require("fs");cc.each=function(g,f,j){if(g){if(g instanceof Array){for(var i=0,h=g.length;im){throw"arguments error!"}}"function"==typeof h&&(h={iterator:h});if(void 0!==o){h.cb=o||h.cb}else{if(void 0===i){throw"arguments error!"}}var k=(m=i instanceof Array)?i.length:Object.keys(i).length;if(0===k){h.cb&&h.cb.call(h.cbTarget,null)}else{var j={length:k,count:k,option:h,results:m?[]:{}};cc.each(i,function(b,f){if(j.err){return !1}var d=!h.cb?n._emptyFunc:n._counterFunc.bind({counter:j,index:f});h.iterator.call(h.iteratorTarget,b,f,d)})}}};cc.path={join:function(){for(var e=arguments.length,d="",f=0;fh?f+e+g:f.substring(0,h)+e+g},changeBasename:function(g,f,j){if(0==f.indexOf(".")){return this.changeExtname(g,f)}var i=g.indexOf("?"),h="";j=j?this.extname(g):"";0=i?0:i+1)+f+j+h}};cc.loader={_jsCache:{},_register:{},_langPathCache:{},_aliases:{},resPath:res_path,audioPath:res_path,cache:{},getXMLHttpRequest:function(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP")},_getArgs4Js:function(g){var f=g[0],j=g[1],i=g[2],h=["",null,null];if(1===g.length){h[1]=f instanceof Array?f:[f]}else{if(2===g.length){"function"==typeof j?(h[1]=f instanceof Array?f:[f],h[2]=j):(h[0]=f||"",h[1]=j instanceof Array?j:[j])}else{if(3===g.length){h[0]=f||"",h[1]=j instanceof Array?j:[j],h[2]=i}else{throw"arguments error to load js!"}}}return h},loadJs:function(h,g,m){var k=this,j=k._jsCache,i=k._getArgs4Js(arguments);-1=f.length){i&&i()}else{var h=this;h._createScript(cc.path.join(g,f[j]),!1,function(a){if(a){return i(a)}h._loadJs4Dependency(g,f,j+1,i)})}},_loadJsImg:function(){var e=document,d=e.getElementById("cocos2d_loadJsImg");if(!d){d=cc.newElement("img");cc._loadingImage&&(d.src=cc._loadingImage);cc.game.config.id="gameCanvas";e=e.getElementById(cc.game.config.id);e.style.backgroundColor="black";e.parentNode.appendChild(d);var f=getComputedStyle?getComputedStyle(e):e.currentStyle; f||(f={width:e.width,height:e.height});d.style.left=e.offsetLeft+(parseFloat(f.width)-d.width)/2+"px";d.style.top=e.offsetTop+(parseFloat(f.height)-d.height)/2+"px";d.style.position="absolute"}return d},loadTxt:function(f,e){if(cc._isNodeJs){require("fs").readFile(f,function(b,d){b?e(b):e(null,d.toString())})}else{var h=this.getXMLHttpRequest(),g="load "+f+" failed!";h.open("GET",f,!0);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?(h.setRequestHeader("Accept-Charset","utf-8"),h.onreadystatechange=function(){4==h.readyState&&200==h.status?e(null,h.responseText):e(g)}):(h.overrideMimeType&&h.overrideMimeType("text/plain; charset\x3dutf-8"),h.onload=function(){4==h.readyState&&200==h.status?e(null,h.responseText):e(g)});h.send(null)}},_loadTxtSync:function(d){if(cc._isNodeJs){return require("fs").readFileSync(d).toString()}var c=this.getXMLHttpRequest();c.open("GET",d,!1);/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?c.setRequestHeader("Accept-Charset","utf-8"):c.overrideMimeType&&c.overrideMimeType("text/plain; charset\x3dutf-8");c.send(null);return 4==!c.readyState||200!=c.status?null:c.responseText},loadJson:function(d,c){this.loadTxt(d,function(f,b){try{f?c(f):c(null,JSON.parse(b))}catch(a){throw"load json ["+d+"] failed : "+a}})},_checkIsImageURL:function(b){return null!=/(\.png)|(\.jpg)|(\.bmp)|(\.jpeg)|(\.gif)/.exec(b)},loadImg:function(g,f,j){var i=!0;void 0!==j?i=null==f.isCrossOrigin?i:f.isCrossOrigin:void 0!==f&&(j=f);var h=new Image;i&&"file://"!=location.origin&&(h.crossOrigin="Anonymous");cc._addEventListener(h,"load",function(){this.removeEventListener("load",arguments.callee,!1);this.removeEventListener("error",arguments.callee,!1);j&&j(null,h)});cc._addEventListener(h,"error",function(){this.removeEventListener("error",arguments.callee,!1);j&&j("load image failed")});h.src=g;return h},_loadResIterator:function(h,g,m){var k=this,j=null,i=h.type;i?(i="."+i.toLowerCase(),j=h.src?h.src:h.name+i):(j=h,i=cc.path.extname(j));if(g=k.cache[j]){return m(null,g)}g=k._register[i.toLowerCase()];if(!g){return cc.error("loader for ["+i+"] not exists!"),m()}i=g.getBasePath?g.getBasePath():k.resPath;i=k.getUrl(i,j);g.load(i,j,h,function(d,c){d?(cc.log(d),k.cache[j]=null,delete k.cache[j],m()):(k.cache[j]=c,m(null,c))})},getUrl:function(g,f){var j=this._langPathCache,i=cc.path;if(void 0!==g&&void 0===f){f=g;var h=i.extname(f),h=h?h.toLowerCase():"";g=(h=this._register[h])?h.getBasePath?h.getBasePath():this.resPath:this.resPath}f=cc.path.join(g||"",f);if(f.match(/[\/(\\\\)]lang[\/(\\\\)]/i)){if(j[f]){return j[f]}i=i.extname(f)||"";f=j[f]=f.substring(0,f.length-i.length)+"_"+cc.sys.language+i}return f},load:function(e,d,f){if(void 0!==f){"function"==typeof d&&(d={trigger:d})}else{if(void 0!==d){"function"==typeof d&&(f=d,d={})}else{if(void 0!==e){d={}}else{throw"arguments error!"}}}d.cb=function(g,c){g&&cc.log(g);f&&f(c)};e instanceof Array||(e=[e]);d.iterator=this._loadResIterator;d.iteratorTarget=this;cc.async.map(e,d)},_handleAliases:function(h,g){var m=this._aliases,k=[],j;for(j in h){var i=h[j];m[j]=i;k.push(i)}this.load(k,g)},loadAliases:function(f,e){var h=this,g=h.getRes(f);g?h._handleAliases(g.filenames,e):h.load(f,function(b){h._handleAliases(b[0].filenames,e)})},register:function(f,e){if(f&&e){if("string"==typeof f){return this._register[f.trim().toLowerCase()]=e}for(var h=0,g=f.length;hb.indexOf("core")&&b.splice(0,0,"core");for(var g=0,e=b.length;g=c.x||d.y>=c.y||d.x+d.width<=c.x+c.width||d.y+d.height<=c.y+c.height)};cc.rectGetMaxX=function(b){return b.x+b.width};cc.rectGetMidX=function(b){return b.x+b.width/2};cc.rectGetMinX=function(b){return b.x};cc.rectGetMaxY=function(b){return b.y+b.height};cc.rectGetMidY=function(b){return b.y+b.height/2};cc.rectGetMinY=function(b){return b.y};cc.rectContainsPoint=function(d,c){return c.x>=cc.rectGetMinX(d)&&c.x<=cc.rectGetMaxX(d)&&c.y>=cc.rectGetMinY(d)&&c.y<=cc.rectGetMaxY(d)};cc.rectIntersectsRect=function(g,f){var j=g.y+g.height,i=f.x+f.width,h=f.y+f.height;return !(g.x+g.width>16,(b>>8)%256,b%256)};cc.colorToHex=function(f){var e=f.r.toString(16),h=f.g.toString(16),g=f.b.toString(16);return"#"+(16>f.r?"0"+e:e)+(16>f.g?"0"+h:h)+(16>f.b?"0"+g:g)};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(e,d){if(null!=d){var f=this.__getKey();this._keyMapTb[f]=d;this._valueMapTb[f]=e}},objectForKey:function(e){if(null==e){return null}var d=this._keyMapTb,f;for(f in d){if(d[f]===e){return this._valueMapTb[f]}}return null},valueForKey:function(b){return this.objectForKey(b)},removeObjectForKey:function(e){if(null!=e){var d=this._keyMapTb,f;for(f in d){if(d[f]===e){delete this._valueMapTb[f];delete d[f];break}}}},removeObjectsForKeys:function(d){if(null!=d){for(var c=0;cMath.abs(h-m)&&(m=h);2>Math.abs(g-k)&&(k=g);h=cc.rect(Math.round((h-m)/2),Math.round((g-k)/2),m,k);cc._renderType==cc._RENDER_TYPE_CANVAS&&cc._renderContext.translate(h.x,h.y+k);this._result.scale=[j,i];this._result.viewport=h;return this._result},preApply:function(b){},apply:function(d,c){return{scale:[1,1]}},postApply:function(b){}});(function(){var g=cc.ContainerStrategy.extend({apply:function(b){this._setupContainer(b,b._frameSize.width,b._frameSize.height)}}),f=cc.ContainerStrategy.extend({apply:function(A,z){var y=A._frameSize.width,x=A._frameSize.height,w=cc.container.style,v=z.width,u=z.height,o=y/v,k=x/u,B,C;o>=1}return -1},_removeUsedIndexBit:function(b){0>b||b>=this._maxTouches||(b=~(1<=j.length?j.push(g):(j[this._preTouchPoolPointer]=g,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(f,e,h){var g=this._preTouchPoint;f=this._glView.convertToLocationInView(f,e,h);e=new cc.Touch(f.x,f.y);e._setPrevPoint(g.x,g.y);g.x=f.x;g.y=f.y;return e},getMouseEvent:function(f,e,h){var g=this._prevMousePoint;this._glView._convertMouseToLocationInView(f,e);e=new cc.EventMouse(h);e.setLocation(f.x,f.y);e._setPrevCursor(g.x,g.y);g.x=f.x;g.y=f.y;return e},getPointByEvent:function(d,c){if(null!=d.pageX){return{x:d.pageX,y:d.pageY}}c.left-=document.body.scrollLeft;c.top-=document.body.scrollTop;return{x:d.clientX,y:d.clientY}},getTouchesByEvent:function(u,t){for(var s=[],r=this._glView,q,o,n=this._preTouchPoint,m=u.changedTouches.length,j=0;jthis._accelInterval&&(this._accelCurTime-=this._accelInterval,cc.eventManager.dispatchEvent(new cc.EventAcceleration(this._acceleration)));this._accelCurTime+=b}};cc.AffineTransform=function(h,g,m,k,j,i){this.a=h;this.b=g;this.c=m;this.d=k;this.tx=j;this.ty=i};cc.AffineTransformMake=function(h,g,m,k,j,i){return{a:h,b:g,c:m,d:k,tx:j,ty:i}};cc.PointApplyAffineTransform=function(d,c){return{x:c.a*d.x+c.c*d.y+c.tx,y:c.b*d.x+c.d*d.y+c.ty}};cc._PointApplyAffineTransform=function(e,d,f){return{x:f.a*e+f.c*d+f.tx,y:f.b*e+f.d*d+f.ty}};cc.SizeApplyAffineTransform=function(d,c){return{width:c.a*d.width+c.c*d.height,height:c.b*d.width+c.d*d.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(t,s){var r=cc.rectGetMinY(t),q=cc.rectGetMinX(t),o=cc.rectGetMaxX(t),n=cc.rectGetMaxY(t),m=cc._PointApplyAffineTransform(q,r,s),r=cc._PointApplyAffineTransform(o,r,s),q=cc._PointApplyAffineTransform(q,n,s),j=cc._PointApplyAffineTransform(o,n,s),o=Math.min(m.x,r.x,q.x,j.x),n=Math.max(m.x,r.x,q.x,j.x),i=Math.min(m.y,r.y,q.y,j.y),m=Math.max(m.y,r.y,q.y,j.y);return cc.rect(o,i,n-o,m-i)};cc._RectApplyAffineTransformIn=function(t,s){var r=cc.rectGetMinY(t),q=cc.rectGetMinX(t),o=cc.rectGetMaxX(t),n=cc.rectGetMaxY(t),m=cc._PointApplyAffineTransform(q,r,s),r=cc._PointApplyAffineTransform(o,r,s),q=cc._PointApplyAffineTransform(q,n,s),j=cc._PointApplyAffineTransform(o,n,s),o=Math.min(m.x,r.x,q.x,j.x),n=Math.max(m.x,r.x,q.x,j.x),i=Math.min(m.y,r.y,q.y,j.y),m=Math.max(m.y,r.y,q.y,j.y);t.x=o;t.y=i;t.width=n-o;t.height=m-i;return t};cc.AffineTransformTranslate=function(e,d,f){return{a:e.a,b:e.b,c:e.c,d:e.d,tx:e.tx+e.a*d+e.c*f,ty:e.ty+e.b*d+e.d*f}};cc.AffineTransformScale=function(e,d,f){return{a:e.a*d,b:e.b*d,c:e.c*f,d:e.d*f,tx:e.tx,ty:e.ty}};cc.AffineTransformRotate=function(f,e){var h=Math.sin(e),g=Math.cos(e);return{a:f.a*g+f.c*h,b:f.b*g+f.d*h,c:f.c*g-f.a*h,d:f.d*g-f.b*h,tx:f.tx,ty:f.ty}};cc.AffineTransformConcat=function(d,c){return{a:d.a*c.a+d.b*c.c,b:d.a*c.b+d.b*c.d,c:d.c*c.a+d.d*c.c,d:d.c*c.b+d.d*c.d,tx:d.tx*c.a+d.ty*c.c+c.tx,ty:d.tx*c.b+d.ty*c.d+c.ty}};cc.AffineTransformEqualToTransform=function(d,c){return d.a===c.a&&d.b===c.b&&d.c===c.c&&d.d===c.d&&d.tx===c.tx&&d.ty===c.ty};cc.AffineTransformInvert=function(d){var c=1/(d.a*d.d-d.b*d.c);return{a:c*d.d,b:-c*d.b,c:-c*d.c,d:c*d.a,tx:c*(d.c*d.ty-d.d*d.tx),ty:c*(d.b*d.tx-d.a*d.ty)}};cc.POINT_EPSILON=parseFloat("1.192092896e-07F");cc.pNeg=function(b){return cc.p(-b.x,-b.y) };cc.pAdd=function(d,c){return cc.p(d.x+c.x,d.y+c.y)};cc.pSub=function(d,c){return cc.p(d.x-c.x,d.y-c.y)};cc.pMult=function(d,c){return cc.p(d.x*c,d.y*c)};cc.pMidpoint=function(d,c){return cc.pMult(cc.pAdd(d,c),0.5)};cc.pDot=function(d,c){return d.x*c.x+d.y*c.y};cc.pCross=function(d,c){return d.x*c.y-d.y*c.x};cc.pPerp=function(b){return cc.p(-b.y,b.x)};cc.pRPerp=function(b){return cc.p(b.y,-b.x)};cc.pProject=function(d,c){return cc.pMult(c,cc.pDot(d,c)/cc.pDot(c,c))};cc.pRotate=function(d,c){return cc.p(d.x*c.x-d.y*c.y,d.x*c.y+d.y*c.x)};cc.pUnrotate=function(d,c){return cc.p(d.x*c.x+d.y*c.y,d.y*c.x-d.x*c.y)};cc.pLengthSQ=function(b){return cc.pDot(b,b)};cc.pDistanceSQ=function(d,c){return cc.pLengthSQ(cc.pSub(d,c))};cc.pLength=function(b){return Math.sqrt(cc.pLengthSQ(b))};cc.pDistance=function(d,c){return cc.pLength(cc.pSub(d,c))};cc.pNormalize=function(b){return cc.pMult(b,1/cc.pLength(b))};cc.pForAngle=function(b){return cc.p(Math.cos(b),Math.sin(b))};cc.pToAngle=function(b){return Math.atan2(b.y,b.x)};cc.clampf=function(f,e,h){if(e>h){var g=e;e=h;h=g}return f=h.x&&0<=h.y&&1>=h.y?!0:!1};cc.pIntersectPoint=function(g,f,j,i){var h=cc.p(0,0);return cc.pLineIntersect(g,f,j,i,h)?(j=cc.p(0,0),j.x=g.x+h.x*(f.x-g.x),j.y=g.y+h.x*(f.y-g.y),j):cc.p(0,0)};cc.pSameAs=function(d,c){return null!=d&&null!=c?d.x==c.x&&d.y==c.y:!1};cc.pZeroIn=function(b){b.x=0;b.y=0};cc.pIn=function(d,c){d.x=c.x;d.y=c.y};cc.pMultIn=function(d,c){d.x*=c;d.y*=c};cc.pSubIn=function(d,c){d.x-=c.x;d.y-=c.y};cc.pAddIn=function(d,c){d.x+=c.x;d.y+=c.y};cc.pNormalizeIn=function(b){cc.pMultIn(b,1/Math.sqrt(b.x*b.x+b.y*b.y))};cc.Touch=cc.Class.extend({_point:null,_prevPoint:null,_id:0,_startPointCaptured:!1,_startPoint:null,ctor:function(e,d,f){this._point=cc.p(e||0,d||0);this._id=f||0},getLocation:function(){return{x:this._point.x,y:this._point.y}},getLocationX:function(){return this._point.x},getLocationY:function(){return this._point.y},getPreviousLocation:function(){return{x:this._prevPoint.x,y:this._prevPoint.y}},getStartLocation:function(){return{x:this._startPoint.x,y:this._startPoint.y}},getDelta:function(){return cc.pSub(this._point,this._prevPoint)},getLocationInView:function(){return{x:this._point.x,y:this._point.y}},getPreviousLocationInView:function(){return{x:this._prevPoint.x,y:this._prevPoint.y}},getStartLocationInView:function(){return{x:this._startPoint.x,y:this._startPoint.y}},getID:function(){return this._id},getId:function(){return this._id},setTouchInfo:function(e,d,f){this._prevPoint=this._point;this._point=cc.p(d||0,f||0);this._id=e;this._startPointCaptured||(this._startPoint=cc.p(this._point),this._startPointCaptured=!0)},_setPoint:function(d,c){void 0===c?(this._point.x=d.x,this._point.y=d.y):(this._point.x=d,this._point.y=c)},_setPrevPoint:function(d,c){this._prevPoint=void 0===c?cc.p(d.x,d.y):cc.p(d||0,c||0)}});cc.Event=cc.Class.extend({_type:0,_isStopped:!1,_currentTarget:null,_setCurrentTarget:function(b){this._currentTarget=b},ctor:function(b){this._type=b},getType:function(){return this._type},stopPropagation:function(){this._isStopped=!0},isStopped:function(){return this._isStopped},getCurrentTarget:function(){return this._currentTarget}});cc.Event.TOUCH=0;cc.Event.KEYBOARD=1;cc.Event.ACCELERATION=2;cc.Event.MOUSE=3;cc.Event.CUSTOM=4;cc.EventCustom=cc.Event.extend({_eventName:null,_userData:null,ctor:function(b){cc.Event.prototype.ctor.call(this,cc.Event.CUSTOM);this._eventName=b},setUserData:function(b){this._userData=b},getUserData:function(){return this._userData},getEventName:function(){return this._eventName}});cc.EventMouse=cc.Event.extend({_eventType:0,_button:0,_x:0,_y:0,_prevX:0,_prevY:0,_scrollX:0,_scrollY:0,ctor:function(b){cc.Event.prototype.ctor.call(this,cc.Event.MOUSE);this._eventType=b},setScrollData:function(d,c){this._scrollX=d; this._scrollY=c},getScrollX:function(){return this._scrollX},getScrollY:function(){return this._scrollY},setLocation:function(d,c){this._x=d;this._y=c},getLocation:function(){return{x:this._x,y:this._y}},getLocationInView:function(){return{x:this._x,y:cc.view._designResolutionSize.height-this._y}},_setPrevCursor:function(d,c){this._prevX=d;this._prevY=c},getDelta:function(){return{x:this._x-this._prevX,y:this._y-this._prevY}},getDeltaX:function(){return this._x-this._prevX},getDeltaY:function(){return this._y-this._prevY},setButton:function(b){this._button=b},getButton:function(){return this._button},getLocationX:function(){return this._x},getLocationY:function(){return this._y}});cc.EventMouse.NONE=0;cc.EventMouse.DOWN=1;cc.EventMouse.UP=2;cc.EventMouse.MOVE=3;cc.EventMouse.SCROLL=4;cc.EventMouse.BUTTON_LEFT=0;cc.EventMouse.BUTTON_RIGHT=2;cc.EventMouse.BUTTON_MIDDLE=1;cc.EventMouse.BUTTON_4=3;cc.EventMouse.BUTTON_5=4;cc.EventMouse.BUTTON_6=5;cc.EventMouse.BUTTON_7=6;cc.EventMouse.BUTTON_8=7;cc.EventTouch=cc.Event.extend({_eventCode:0,_touches:null,ctor:function(b){cc.Event.prototype.ctor.call(this,cc.Event.TOUCH);this._touches=b||[]},getEventCode:function(){return this._eventCode},getTouches:function(){return this._touches},_setEventCode:function(b){this._eventCode=b},_setTouches:function(b){this._touches=b}});cc.EventTouch.MAX_TOUCHES=5;cc.EventTouch.EventCode={BEGAN:0,MOVED:1,ENDED:2,CANCELLED:3};cc.EventListener=cc.Class.extend({_onEvent:null,_type:0,_listenerID:null,_registered:!1,_fixedPriority:0,_node:null,_paused:!1,_isEnabled:!0,ctor:function(e,d,f){this._onEvent=f;this._type=e||0;this._listenerID=d||""},_setPaused:function(b){this._paused=b},_isPaused:function(){return this._paused},_setRegistered:function(b){this._registered=b},_isRegistered:function(){return this._registered},_getType:function(){return this._type},_getListenerID:function(){return this._listenerID},_setFixedPriority:function(b){this._fixedPriority=b},_getFixedPriority:function(){return this._fixedPriority},_setSceneGraphPriority:function(b){this._node=b},_getSceneGraphPriority:function(){return this._node},checkAvailable:function(){return null!=this._onEvent},clone:function(){return null},setEnabled:function(b){this._isEnabled=b},isEnabled:function(){return this._isEnabled},retain:function(){},release:function(){}});cc.EventListener.UNKNOWN=0;cc.EventListener.TOUCH_ONE_BY_ONE=1;cc.EventListener.TOUCH_ALL_AT_ONCE=2;cc.EventListener.KEYBOARD=3;cc.EventListener.MOUSE=4;cc.EventListener.ACCELERATION=5;cc.EventListener.CUSTOM=6;cc._EventListenerCustom=cc.EventListener.extend({_onCustomEvent:null,ctor:function(e,d){this._onCustomEvent=d;var f=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.CUSTOM,e,function(b){null!=f._onCustomEvent&&f._onCustomEvent(b)})},checkAvailable:function(){return cc.EventListener.prototype.checkAvailable.call(this)&&null!=this._onCustomEvent},clone:function(){return new cc._EventListenerCustom(this._listenerID,this._onCustomEvent)}});cc._EventListenerCustom.create=function(d,c){return new cc._EventListenerCustom(d,c)};cc._EventListenerMouse=cc.EventListener.extend({onMouseDown:null,onMouseUp:null,onMouseMove:null,onMouseScroll:null,ctor:function(){var b=this;cc.EventListener.prototype.ctor.call(this,cc.EventListener.MOUSE,cc._EventListenerMouse.LISTENER_ID,function(a){var d=cc.EventMouse;switch(a._eventType){case d.DOWN:if(b.onMouseDown){b.onMouseDown(a)}break;case d.UP:if(b.onMouseUp){b.onMouseUp(a)}break;case d.MOVE:if(b.onMouseMove){b.onMouseMove(a)}break;case d.SCROLL:if(b.onMouseScroll){b.onMouseScroll(a)}}})},clone:function(){var b=new cc._EventListenerMouse;b.onMouseDown=this.onMouseDown;b.onMouseUp=this.onMouseUp;b.onMouseMove=this.onMouseMove;b.onMouseScroll=this.onMouseScroll;return b},checkAvailable:function(){return !0}});cc._EventListenerMouse.LISTENER_ID="__cc_mouse";cc._EventListenerMouse.create=function(){return new cc._EventListenerMouse};cc._EventListenerTouchOneByOne=cc.EventListener.extend({_claimedTouches:null,swallowTouches:!1,onTouchBegan:null,onTouchMoved:null,onTouchEnded:null,onTouchCancelled:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.TOUCH_ONE_BY_ONE,cc._EventListenerTouchOneByOne.LISTENER_ID,null);this._claimedTouches=[]},setSwallowTouches:function(b){this.swallowTouches=b},clone:function(){var b=new cc._EventListenerTouchOneByOne;b.onTouchBegan=this.onTouchBegan;b.onTouchMoved=this.onTouchMoved;b.onTouchEnded=this.onTouchEnded;b.onTouchCancelled=this.onTouchCancelled;b.swallowTouches=this.swallowTouches;return b},checkAvailable:function(){return !this.onTouchBegan?(cc.log(cc._LogInfos._EventListenerTouchOneByOne_checkAvailable),!1):!0}});cc._EventListenerTouchOneByOne.LISTENER_ID="__cc_touch_one_by_one";cc._EventListenerTouchOneByOne.create=function(){return new cc._EventListenerTouchOneByOne};cc._EventListenerTouchAllAtOnce=cc.EventListener.extend({onTouchesBegan:null,onTouchesMoved:null,onTouchesEnded:null,onTouchesCancelled:null,ctor:function(){cc.EventListener.prototype.ctor.call(this,cc.EventListener.TOUCH_ALL_AT_ONCE,cc._EventListenerTouchAllAtOnce.LISTENER_ID,null) },clone:function(){var b=new cc._EventListenerTouchAllAtOnce;b.onTouchesBegan=this.onTouchesBegan;b.onTouchesMoved=this.onTouchesMoved;b.onTouchesEnded=this.onTouchesEnded;b.onTouchesCancelled=this.onTouchesCancelled;return b},checkAvailable:function(){return null==this.onTouchesBegan&&null==this.onTouchesMoved&&null==this.onTouchesEnded&&null==this.onTouchesCancelled?(cc.log(cc._LogInfos._EventListenerTouchAllAtOnce_checkAvailable),!1):!0}});cc._EventListenerTouchAllAtOnce.LISTENER_ID="__cc_touch_all_at_once";cc._EventListenerTouchAllAtOnce.create=function(){return new cc._EventListenerTouchAllAtOnce};cc.EventListener.create=function(f){cc.assert(f&&f.event,cc._LogInfos.EventListener_create);var e=f.event;delete f.event;var h=null;e===cc.EventListener.TOUCH_ONE_BY_ONE?h=new cc._EventListenerTouchOneByOne:e===cc.EventListener.TOUCH_ALL_AT_ONCE?h=new cc._EventListenerTouchAllAtOnce:e===cc.EventListener.MOUSE?h=new cc._EventListenerMouse:e===cc.EventListener.CUSTOM?(h=new cc._EventListenerCustom(f.eventName,f.callback),delete f.eventName,delete f.callback):e===cc.EventListener.KEYBOARD?h=new cc._EventListenerKeyboard:e===cc.EventListener.ACCELERATION&&(h=new cc._EventListenerAcceleration(f.callback),delete f.callback);for(var g in f){h[g]=f[g]}return h};cc.copyArray=function(f){var e,h=f.length,g=Array(h);for(e=0;ej.getLocalZOrder()){this._visitTarget(j,!1)}else{break}}null!=m[t.__instanceId]&&(n[t.getGlobalZOrder()]||(n[t.getGlobalZOrder()]=[]),n[t.getGlobalZOrder()].push(t.__instanceId));for(;qi._localZOrder){i.visit(g)}else{break}}for(this.draw(g);fx&&-0.000001w&&-0.000001=d&&this.unschedule(this._updatePercent)}});cc.LoaderScene.preload=function(e,d){var f=cc;f.loaderScene||(f.loaderScene=new cc.LoaderScene,f.loaderScene.init());f.loaderScene.initWithResources(e,d);cc.director.runScene(f.loaderScene);return f.loaderScene};cc._tmp.PrototypeLayerRGBA=function(){var b=cc.LayerRGBA.prototype;cc.defineGetterSetter(b,"opacityModifyRGB",b.isOpacityModifyRGB,b.setOpacityModifyRGB);cc.defineGetterSetter(b,"opacity",b.getOpacity,b.setOpacity);cc.defineGetterSetter(b,"cascadeOpacity",b.isCascadeOpacityEnabled,b.setCascadeOpacityEnabled);cc.defineGetterSetter(b,"color",b.getColor,b.setColor);cc.defineGetterSetter(b,"cascadeColor",b.isCascadeColorEnabled,b.setCascadeColorEnabled)};cc._tmp.PrototypeLayerColor=function(){var b=cc.LayerColor.prototype;cc.defineGetterSetter(b,"width",b._getWidth,b._setWidth);cc.defineGetterSetter(b,"height",b._getHeight,b._setHeight)};cc._tmp.PrototypeLayerGradient=function(){var b=cc.LayerGradient.prototype;cc.defineGetterSetter(b,"startColor",b.getStartColor,b.setStartColor);cc.defineGetterSetter(b,"endColor",b.getEndColor,b.setEndColor);cc.defineGetterSetter(b,"startOpacity",b.getStartOpacity,b.setStartOpacity);cc.defineGetterSetter(b,"endOpacity",b.getEndOpacity,b.setEndOpacity);cc.defineGetterSetter(b,"vector",b.getVector,b.setVector)};cc.Layer=cc.Node.extend({_isBaked:!1,_bakeSprite:null,_className:"Layer",ctor:function(){var b=cc.Node.prototype;b.ctor.call(this);this._ignoreAnchorPointForPosition=!0;b.setAnchorPoint.call(this,0.5,0.5);b.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 e=this._children,d=0,f=e.length;dn._localZOrder){n.visit(o)}else{break}}for(this.draw(o);t=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchTo):(this.removeChild(this._layers[this._enabledLayer],!0),this._enabledLayer=b,this.addChild(this._layers[b])) },switchToAndReleaseMe:function(b){b>=this._layers.length?cc.log(cc._LogInfos.LayerMultiplex_switchToAndReleaseMe):(this.removeChild(this._layers[this._enabledLayer],!0),this._layers[this._enabledLayer]=null,this._enabledLayer=b,this.addChild(this._layers[b]))},addLayer:function(b){b?this._layers.push(b):cc.log(cc._LogInfos.LayerMultiplex_addLayer)}});cc.LayerMultiplex.create=function(){return new cc.LayerMultiplex(arguments)};cc._tmp.PrototypeSprite=function(){var b=cc.Sprite.prototype;cc.defineGetterSetter(b,"opacityModifyRGB",b.isOpacityModifyRGB,b.setOpacityModifyRGB);cc.defineGetterSetter(b,"opacity",b.getOpacity,b.setOpacity);cc.defineGetterSetter(b,"color",b.getColor,b.setColor);cc.defineGetterSetter(b,"flippedX",b.isFlippedX,b.setFlippedX);cc.defineGetterSetter(b,"flippedY",b.isFlippedY,b.setFlippedY);cc.defineGetterSetter(b,"offsetX",b._getOffsetX);cc.defineGetterSetter(b,"offsetY",b._getOffsetY);cc.defineGetterSetter(b,"texture",b.getTexture,b.setTexture);cc.defineGetterSetter(b,"textureRectRotated",b.isTextureRectRotated);cc.defineGetterSetter(b,"batchNode",b.getBatchNode,b.setBatchNode);cc.defineGetterSetter(b,"quad",b.getQuad)};cc.generateTextureCacheForColor=function(f){function e(){var u=cc.generateTextureCacheForColor,t=f.width,s=f.height;h[0].width=t;h[0].height=s;h[1].width=t;h[1].height=s;h[2].width=t;h[2].height=s;h[3].width=t;h[3].height=s;u.canvas.width=t;u.canvas.height=s;var r=u.canvas.getContext("2d");r.drawImage(f,0,0);u.tempCanvas.width=t;u.tempCanvas.height=s;for(var r=r.getImageData(0,0,t,s).data,o=0;4>o;o++){var j=h[o].getContext("2d");j.getImageData(0,0,t,s).data;u.tempCtx.drawImage(f,0,0);for(var i=u.tempCtx.getImageData(0,0,t,s),c=i.data,a=0;au+o+s&&(j.globalAlpha=i,j.drawImage(t[3],r.x,r.y,n,m,0,0,n,m));j.restore();return q};cc.cutRotateImageToCanvas=function(f,e){if(!f){return null}if(!e){return f}var h=cc.newElement("canvas");h.width=e.width;h.height=e.height;var g=h.getContext("2d");g.translate(h.width/2,h.height/2);g.rotate(-1.5707963267948966);g.drawImage(f,e.x,e.y,e.height,e.width,-e.height/2,-e.width/2,e.height,e.width);return h};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(d,c){this._loadedEventListeners||(this._loadedEventListeners=[]);this._loadedEventListeners.push({eventCallback:d,eventTarget:c})},_callLoadedEventCallbacks:function(){if(this._loadedEventListeners){for(var f=this._loadedEventListeners,e=0,h=f.length;eg.width&&cc.error(cc._LogInfos.RectWidth,g.url),i>g.height&&cc.error(cc._LogInfos.RectHeight,g.url));this.texture=this._originalTexture=g;this.setTextureRect(f,j);this.batchNode=null;return !0},_p._textureLoadedCallback=function(d){if(!this._textureLoaded){this._textureLoaded=!0;var c=this._rect;c?cc._rectEqualToZero(c)&&(c.width=d.width,c.height=d.height):c=cc.rect(0,0,d.width,d.height);this.texture=this._originalTexture=d;this.setTextureRect(c,this._rectRotated);this.batchNode=this._batchNode;this._callLoadedEventCallbacks()}},_p.setTextureRect=function(e,d,f){this._rectRotated=d||!1;this.setContentSize(f||e);this.setVertexRect(e);d=this._textureRect_Canvas;f=cc.contentScaleFactor();d.x=0|e.x*f;d.y=0|e.y*f;d.width=0|e.width*f;d.height=0|e.height*f;d.validRect=!(0===d.width||0===d.height||0>d.x||0>d.y);e=this._unflippedOffsetPositionFromCenter;this._flippedX&&(e.x=-e.x);this._flippedY&&(e.y=-e.y);this._offsetPosition.x=e.x+(this._contentSize.width-this._rect.width)/2;this._offsetPosition.y=e.y+(this._contentSize.height-this._rect.height)/2;this._batchNode&&(this.dirty=!0)},_p.updateTransform=function(){if(this.dirty){var b=this._parent;!this._visible||b&&b!=this._batchNode&&b._shouldBeHidden?this._shouldBeHidden=!0:(this._shouldBeHidden=!1,this._transformToBatch=!b||b==this._batchNode?this.nodeToParentTransform():cc.AffineTransformConcat(this.nodeToParentTransform(),b._transformToBatch));this.dirty=this._recursiveDirty=!1}this._hasChildren&&this._arrayMakeObjectsPerformSelector(this._children,cc.Node.StateCallbackType.updateTransform)},_p.addChild=function(e,d,f){cc.assert(e,cc._LogInfos.CCSpriteBatchNode_addChild_2);null==d&&(d=e._localZOrder);null==f&&(f=e.tag);cc.NodeRGBA.prototype.addChild.call(this,e,d,f);this._hasChildren=!0},_p.setOpacity=function(b){cc.NodeRGBA.prototype.setOpacity.call(this,b);this._setNodeDirtyForCache()},_p.setColor=function(d){var c=this.color;c.r===d.r&&c.g===d.g&&c.b===d.b||(cc.NodeRGBA.prototype.setColor.call(this,d),this._changeTextureColor(),this._setNodeDirtyForCache())},_p.updateDisplayedColor=function(d){var c=this.color;cc.NodeRGBA.prototype.updateDisplayedColor.call(this,d);d=this._displayedColor;c.r===d.r&&c.g===d.g&&c.b===d.b||(this._changeTextureColor(),this._setNodeDirtyForCache())},_p.setSpriteFrame=function(f){var e=this;"string"==typeof f&&(f=cc.spriteFrameCache.getSpriteFrame(f),cc.assert(f,cc._LogInfos.CCSpriteBatchNode_setSpriteFrame));e.setNodeDirty(!0);var h=f.getOffset();e._unflippedOffsetPositionFromCenter.x=h.x;e._unflippedOffsetPositionFromCenter.y=h.y;e._rectRotated=f.isRotated();var h=f.getTexture(),g=f.textureLoaded();g||(e._textureLoaded=!1,f.addLoadedEventListener(function(b){e._textureLoaded=!0;var d=b.getTexture();d!=e._texture&&(e.texture=d);e.setTextureRect(b.getRect(),b.isRotated(),b.getOriginalSize());e._callLoadedEventCallbacks()},e));h!=e._texture&&(e.texture=h);e._rectRotated&&(e._originalTexture=h);e.setTextureRect(f.getRect(),e._rectRotated,f.getOriginalSize());e._colorized=!1;g&&(f=e.color,(255!==f.r||255!==f.g||255!==f.b)&&e._changeTextureColor())},_p.isFrameDisplayed=function(b){return b.getTexture()!=this._texture?!1:cc.rectEqualToRect(b.getRect(),this._rect)},_p.setBatchNode=function(b){(this._batchNode=b)?(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(b){b&&"string"===typeof b?(b=cc.textureCache.addImage(b),this.setTexture(b),b=b.getContentSize(),this.setTextureRect(cc.rect(0,0,b.width,b.height))):(cc.assert(!b||b instanceof cc.Texture2D,cc._LogInfos.CCSpriteBatchNode_setTexture),this._texture!=b&&(b&&b.getHtmlElementObj() instanceof HTMLImageElement&&(this._originalTexture=b),this._texture=b))},_p.draw=function(u){if(this._textureLoaded){u=u||cc._renderContext;this._isLighterMode&&(u.globalCompositeOperation="lighter");var t=cc.view.getScaleX(),s=cc.view.getScaleY();u.globalAlpha=this._displayedOpacity/255;var r=this._rect,q=this._contentSize,o=this._offsetPosition,n=this._drawSize_Canvas,m=0|o.x,j=-o.y-r.height,i=this._textureRect_Canvas;n.width=r.width*t;n.height=r.height*s;if(this._flippedX||this._flippedY){u.save(),this._flippedX&&(m=-o.x-r.width,u.scale(-1,1)),this._flippedY&&(j=o.y,u.scale(1,-1))}m*=t;j*=s;this._texture&&i.validRect?(q=this._texture.getHtmlElementObj(),this._colorized?u.drawImage(q,0,0,i.width,i.height,m,j,n.width,n.height):u.drawImage(q,i.x,i.y,i.width,i.height,m,j,n.width,n.height)):!this._texture&&i.validRect&&(n=this.color,u.fillStyle="rgba("+n.r+","+n.g+","+n.b+",1)",u.fillRect(m,j,q.width*t,q.height*s));1===cc.SPRITE_DEBUG_DRAW||this._showNode?(u.strokeStyle="rgba(0,255,0,1)",m/=t,j=-(j/s),m=[cc.p(m,j),cc.p(m+r.width,j),cc.p(m+r.width,j-r.height),cc.p(m,j-r.height)],cc._drawingUtil.drawPoly(m,4,!0)):2===cc.SPRITE_DEBUG_DRAW&&(u.strokeStyle="rgba(0,255,0,1)",t=this._rect,j=-j,m=[cc.p(m,j),cc.p(m+t.width,j),cc.p(m+t.width,j-t.height),cc.p(m,j-t.height)],cc._drawingUtil.drawPoly(m,4,!0)); (this._flippedX||this._flippedY)&&u.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(e,d,f){this._spriteFrame=e||null;this._delayPerUnit=d||0;this._userInfo=f||null},clone:function(){var b=new cc.AnimationFrame;b.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return b},copyWithZone:function(b){return cc.clone(this)},copy:function(b){b=new cc.AnimationFrame;b.initWithSpriteFrame(this._spriteFrame.clone(),this._delayPerUnit,this._userInfo);return b},initWithSpriteFrame:function(e,d,f){this._spriteFrame=e;this._delayPerUnit=d;this._userInfo=f;return !0},getSpriteFrame:function(){return this._spriteFrame},setSpriteFrame:function(b){this._spriteFrame=b},getDelayUnits:function(){return this._delayPerUnit},setDelayUnits:function(b){this._delayPerUnit=b},getUserInfo:function(){return this._userInfo},setUserInfo:function(b){this._userInfo=b}});cc.AnimationFrame.create=function(e,d,f){return new cc.AnimationFrame(e,d,f)};cc.Animation=cc.Class.extend({_frames:null,_loops:0,_restoreOriginalFrame:!1,_duration:0,_delayPerUnit:0,_totalDelayUnits:0,ctor:function(f,e,h){this._frames=[];if(void 0===f){this.initWithSpriteFrames(null,0)}else{var g=f[0];g&&(g instanceof cc.SpriteFrame?this.initWithSpriteFrames(f,e,h):g instanceof cc.AnimationFrame&&this.initWithAnimationFrames(f,e,h))}},getFrames:function(){return this._frames},setFrames:function(b){this._frames=b},addSpriteFrame:function(d){var c=new cc.AnimationFrame;c.initWithSpriteFrame(d,1,null);this._frames.push(c);this._totalDelayUnits++},addSpriteFrameWithFile:function(d){d=cc.textureCache.addImage(d);var c=cc.rect(0,0,0,0);c.width=d.width;c.height=d.height;d=cc.SpriteFrame.create(d,c);this.addSpriteFrame(d)},addSpriteFrameWithTexture:function(e,d){var f=cc.SpriteFrame.create(e,d);this.addSpriteFrame(f)},initWithAnimationFrames:function(f,e,h){cc.arrayVerifyType(f,cc.AnimationFrame);this._delayPerUnit=e;this._loops=void 0===h?1:h;this._totalDelayUnits=0;e=this._frames;for(h=e.length=0;hi.width&&cc.error(cc._LogInfos.RectWidth,i.url);j>i.height&&cc.error(cc._LogInfos.RectHeight,i.url)}this._rectInPixels=h;this._rect=cc.rectPixelsToPoints(h);this._offsetInPixels.x=n.x;this._offsetInPixels.y=n.y;cc._pointPixelsToPointsOut(n,this._offset);this._originalSizeInPixels.width=m.width;this._originalSizeInPixels.height=m.height;cc._sizePixelsToPointsOut(m,this._originalSize);this._rotated=o;return !0}});cc.SpriteFrame.create=function(g,f,j,i,h){return new cc.SpriteFrame(g,f,j,i,h)};cc.SpriteFrame._frameWithTextureForCanvas=function(h,g,m,k,j){var i=new cc.SpriteFrame;i._texture=h;i._rectInPixels=g;i._rect=cc.rectPixelsToPoints(g);i._offsetInPixels.x=k.x;i._offsetInPixels.y=k.y;cc._pointPixelsToPointsOut(i._offsetInPixels,i._offset);i._originalSizeInPixels.width=j.width;i._originalSizeInPixels.height=j.height;cc._sizePixelsToPointsOut(i._originalSizeInPixels,i._originalSize);i._rotated=m;return i};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(b){b=this._CCNS_REG2.exec(b);return !b?cc.rect(0,0,0,0):cc.rect(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3]),parseFloat(b[4]))},_pointFromString:function(b){b=this._CCNS_REG1.exec(b);return !b?cc.p(0,0):cc.p(parseFloat(b[1]),parseFloat(b[2]))},_sizeFromString:function(b){b=this._CCNS_REG1.exec(b);return !b?cc.size(0,0):cc.size(parseFloat(b[1]),parseFloat(b[2]))},_getFrameConfig:function(u){var t=cc.loader.getRes(u);cc.assert(t,cc._LogInfos.spriteFrameCache__getFrameConfig_2,u);cc.loader.release(u);if(t._inited){return this._frameConfigCache[u]=t}var s=t.frames,r=t.metadata||t.meta,t={},q={},o=0;r&&(o=r.format,o=1>=o.length?parseInt(o):o,q.image=r.textureFileName||r.textureFileName||r.image);for(var n in s){var m=s[n];if(m){r={};if(0==o){r.rect=cc.rect(m.x,m.y,m.width,m.height);r.rotated=!1;r.offset=cc.p(m.offsetX,m.offsetY);var j=m.originalWidth,m=m.originalHeight;(!j||!m)&&cc.log(cc._LogInfos.spriteFrameCache__getFrameConfig);j=Math.abs(j);m=Math.abs(m);r.size=cc.size(j,m)}else{if(1==o||2==o){r.rect=this._rectFromString(m.frame),r.rotated=m.rotated||!1,r.offset=this._pointFromString(m.offset),r.size=this._sizeFromString(m.sourceSize)}else{if(3==o){var j=this._sizeFromString(m.spriteSize),i=this._rectFromString(m.textureRect);j&&(i=cc.rect(i.x,i.y,j.width,j.height));r.rect=i;r.rotated=m.textureRotated||!1;r.offset=this._pointFromString(m.spriteOffset);r.size=this._sizeFromString(m.spriteSourceSize);r.aliases=m.aliases}else{j=m.frame,i=m.sourceSize,n=m.filename||n,r.rect=cc.rect(j.x,j.y,j.w,j.h),r.rotated=m.rotated||!1,r.offset=cc.p(0,0),r.size=cc.size(i.w,i.h)}}}t[n]=r}}return this._frameConfigCache[u]={_inited:!0,frames:t,meta:q}},addSpriteFrames:function(w,v){cc.assert(w,cc._LogInfos.spriteFrameCache_addSpriteFrames_2);var u=this._frameConfigCache[w]||cc.loader.getRes(w);if(u&&u.frames){var t=this._frameConfigCache[w]||this._getFrameConfig(w),u=t.frames,t=t.meta;v?v instanceof cc.Texture2D||("string"==typeof v?v=cc.textureCache.addImage(v):cc.assert(0,cc._LogInfos.spriteFrameCache_addSpriteFrames_3)):(t=cc.path.changeBasename(w,t.image||".png"),v=cc.textureCache.addImage(t));var t=this._spriteFramesAliases,s=this._spriteFrames,r;for(r in u){var q=u[r],o=s[r];if(!o){o=cc.SpriteFrame.create(v,q.rect,q.rotated,q.offset,q.size);if(q=q.aliases){for(var n=0,j=q.length;ncc.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(b){this._displayStats=b},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(f){cc.assert(this._runningScene,cc._LogInfos.Director_popToSceneStackLevel_2);var e=this._scenesStack,h=e.length;if(0==h){this.end()}else{if(!(f>h)){for(;h>f;){var g=e.pop();g.running&&(g.onExitTransitionDidStart(),g.onExit());g.cleanup();h--}this._nextScene=e[e.length-1];this._sendCleanupToScene=!1}}},getScheduler:function(){return this._scheduler},setScheduler:function(b){this._scheduler!=b&&(this._scheduler=b)},getActionManager:function(){return this._actionManager},setActionManager:function(b){this._actionManager!=b&&(this._actionManager=b)},getDeltaTime:function(){return this._deltaTime},_createStatsLabel:null,_calculateMPF:function(){this._secondsPerFrame=(Date.now()-this._lastUpdate)/1000}});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(b){this._animationInterval=b;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(b){this._projection=b;cc.eventManager.dispatchEvent(this._eventProjectionChanged)},_p.setDepthTest=function(){},_p.setOpenGLView=function(b){this._winSizeInPoints.width=cc._canvas.width;this._winSizeInPoints.height=cc._canvas.height;this._openGLView=b||cc.view;cc.eventManager&&cc.eventManager.setEnabled(!0)},_p._clear=function(){var b=this._openGLView.getViewPortRect();cc._renderContext.clearRect(-b.x,b.y,b.width,-b.height)},_p._createStatsLabel=function(){var b=0,b=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",b);this._SPFLabel=cc.LabelTTF.create("0.000","Arial",b);this._drawsLabel=cc.LabelTTF.create("0000","Arial",b);b=cc.DIRECTOR_STATS_POSITION;this._drawsLabel.setPosition(this._drawsLabel.width/2+b.x,5*this._drawsLabel.height/2+b.y);this._SPFLabel.setPosition(this._SPFLabel.width/2+b.x,3*this._SPFLabel.height/2+b.y); this._FPSLabel.setPosition(this._FPSLabel.width/2+b.x,this._FPSLabel.height/2+b.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.PRIORITY_NON_SYSTEM=cc.PRIORITY_SYSTEM+1;cc.arrayVerifyType=function(e,d){if(e&&0=this._interval&&(d&&f&&this._doCallback(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(d&&f&&this._doCallback(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(d&&f&&this._doCallback(),this._elapsed=0,this._timesExecuted+=1),this._timesExecuted>this._repeat&&cc.director.getScheduler().unscheduleCallbackForTarget(d,f))}}});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(b){delete this._hashForTimers[b.target.__instanceId];cc.arrayRemoveObject(this._arrayForTimers,b);b.Timer=null;b.target=null},_removeUpdateFromHash:function(b){if(b=this._hashForUpdates[b.target.__instanceId]){cc.arrayRemoveObject(b.list,b.entry),delete this._hashForUpdates[b.target.__instanceId],cc.arrayRemoveObject(this._arrayForUpdates,b),b.entry=null,b.target=null}},_priorityIn:function(h,g,m,k){k=new cc.ListEntry(null,null,g,m,k,!1);if(h){for(var j=h.length-1,i=0;i<=j&&!(mf?i[0]=this._priorityIn(i[0],g,f,j):i[2]=this._priorityIn(i[2],g,f,j)}},unscheduleCallbackForTarget:function(i,h){if(!(null==i||null==h)){var o=this._hashForTimers[i.__instanceId];if(o){for(var n=o.timers,m=0,k=n.length;m=m&&o.timerIndex--;0==n.length&&(this._currentTarget==o?this._currentTargetSalvaged=!0:this._removeHashElement(o));break}}}}},unscheduleUpdateForTarget:function(b){null!=b&&(b=this._hashForUpdates[b.__instanceId],null!=b&&(this._updateHashLocked?b.entry.markedForDeletion=!0:this._removeUpdateFromHash(b.entry)))},unscheduleAllCallbacksForTarget:function(e){if(null!=e){var d=this._hashForTimers[e.__instanceId];if(d){var f=d.timers;!d.currentTimerSalvaged&&0<=f.indexOf(d.currentTimer)&&(d.currentTimerSalvaged=!0);f.length=0;this._currentTarget==d?this._currentTargetSalvaged=!0:this._removeHashElement(d)}this.unscheduleUpdateForTarget(e)}},unscheduleAllCallbacks:function(){this.unscheduleAllCallbacksWithMinPriority(cc.Scheduler.PRIORITY_SYSTEM)},unscheduleAllCallbacksWithMinPriority:function(h){for(var g=this._arrayForTimers,m=this._updates,k=0,j=g.length;k=u&&0x){-1!=u&&(w=!0);break}u=s;i=y.substr(s)}if(w){return u}i=y.substr(0,v);for(u=v;r=o.exec(i);){if(u=r[1].length,i=r[1],t=this._measure(i),td.x||0>d.y);e=this._unflippedOffsetPositionFromCenter;this._flippedX&&(e.x=-e.x);this._flippedY&&(e.y=-e.y);this._offsetPosition.x=e.x+(this._contentSize.width-this._rect.width)/2;this._offsetPosition.y=e.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(h,g,m,k,j,i){return new cc.LabelTTF(h,g,m,k,j,i)};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(f,e){var h=cc.LabelTTF.__fontHeightCache[f+"."+e];if(0f;f++){if(e=h[f],e&&e[1] in document){for(f=0,g=e.length;g>f;f++){this._fn[h[0][f]]=e[f]}break}}this._supportsFullScreen=void 0!=this._fn.requestFullscreen,this._touchEvent="ontouchstart" in window?"touchstart":"mousedown"},fullScreen:function(){return this._supportsFullScreen&&document[this._fn.fullscreenEnabled]},requestFullScreen:function(e,d){if(this._supportsFullScreen){if(e=e||document.documentElement,e[this._fn.requestFullscreen](),d){var f=this._fn.fullscreenchange;this._preOnFullScreenChange&&document.removeEventListener(f,this._preOnFullScreenChange),this._preOnFullScreenChange=d,cc._addEventListener(document,f,d,!1)}return e[this._fn.requestFullscreen]()}},exitFullScreen:function(){return this._supportsFullScreen?document[this._fn.exitFullscreen]():!0},autoFullScreen:function(g,f){function h(){i.requestFullScreen(g,f),j.removeEventListener(i._touchEvent,h)}g=g||document.body;var j=cc._canvas||g,i=this;this.requestFullScreen(g,f),cc._addEventListener(j,this._touchEvent,h)}},cc.screen.init();cc.ACTION_TAG_INVALID=-1,cc.Action=cc.Class.extend({originalTarget:null,target:null,tag:cc.ACTION_TAG_INVALID,ctor:function(){this.originalTarget=null,this.target=null,this.tag=cc.ACTION_TAG_INVALID},copy:function(){return cc.log("copy is deprecated. Please use clone instead."),this.clone()},clone:function(){var b=new cc.Action;return b.originalTarget=null,b.target=null,b.tag=this.tag,b},isDone:function(){return !0},startWithTarget:function(b){this.originalTarget=b,this.target=b},stop:function(){this.target=null},step:function(){cc.log("[Action step]. override me")},update:function(){cc.log("[Action update]. override me")},getTarget:function(){return this.target},setTarget:function(b){this.target=b},getOriginalTarget:function(){return this.originalTarget},setOriginalTarget:function(b){this.originalTarget=b},getTag:function(){return this.tag},setTag:function(b){this.tag=b},retain:function(){},release:function(){}}),cc.Action.create=function(){return new cc.Action},cc.FiniteTimeAction=cc.Action.extend({_duration:0,ctor:function(){cc.Action.prototype.ctor.call(this),this._duration=0},getDuration:function(){return this._duration*(this._times||1)},setDuration:function(b){this._duration=b},reverse:function(){return cc.log("cocos2d: FiniteTimeAction#reverse: Implement me"),null},clone:function(){return new cc.FiniteTimeAction}}),cc.Speed=cc.Action.extend({_speed:0,_innerAction:null,ctor:function(d,c){cc.Action.prototype.ctor.call(this),this._speed=0,this._innerAction=null,d&&this.initWithAction(d,c) },getSpeed:function(){return this._speed},setSpeed:function(b){this._speed=b},initWithAction:function(d,c){if(!d){throw"cc.Speed.initWithAction(): action must be non nil"}return this._innerAction=d,this._speed=c,!0},clone:function(){var b=new cc.Speed;return b.initWithAction(this._innerAction.clone(),this._speed),b},startWithTarget:function(b){cc.Action.prototype.startWithTarget.call(this,b),this._innerAction.startWithTarget(b)},stop:function(){this._innerAction.stop(),cc.Action.prototype.stop.call(this)},step:function(b){this._innerAction.step(b*this._speed)},isDone:function(){return this._innerAction.isDone()},reverse:function(){return cc.Speed.create(this._innerAction.reverse(),this._speed)},setInnerAction:function(b){this._innerAction!=b&&(this._innerAction=b)},getInnerAction:function(){return this._innerAction}}),cc.Speed.create=function(d,c){return new cc.Speed(d,c)},cc.Follow=cc.Action.extend({_followedNode:null,_boundarySet:!1,_boundaryFullyCovered:!1,_halfScreenSize:null,_fullScreenSize:null,leftBoundary:0,rightBoundary:0,topBoundary:0,bottomBoundary:0,_worldRect:null,ctor:function(d,c){cc.Action.prototype.ctor.call(this),this._followedNode=null,this._boundarySet=!1,this._boundaryFullyCovered=!1,this._halfScreenSize=null,this._fullScreenSize=null,this.leftBoundary=0,this.rightBoundary=0,this.topBoundary=0,this.bottomBoundary=0,this._worldRect=cc.rect(0,0,0,0),d&&(c?this.initWithTarget(d,c):this.initWithTarget(d))},clone:function(){var e=new cc.Follow,d=this._worldRect,f=new cc.Rect(d.x,d.y,d.width,d.height);return e.initWithTarget(this._followedNode,f),e},isBoundarySet:function(){return this._boundarySet},setBoudarySet:function(b){this._boundarySet=b},initWithTarget:function(f,e){if(!f){throw"cc.Follow.initWithAction(): followedNode must be non nil"}var h=this;e=e||cc.rect(0,0,0,0),h._followedNode=f,h._worldRect=e,h._boundarySet=!cc._rectEqualToZero(e),h._boundaryFullyCovered=!1;var g=cc.director.getWinSize();return h._fullScreenSize=cc.p(g.width,g.height),h._halfScreenSize=cc.pMult(h._fullScreenSize,0.5),h._boundarySet&&(h.leftBoundary=-(e.x+e.width-h._fullScreenSize.x),h.rightBoundary=-e.x,h.topBoundary=-e.y,h.bottomBoundary=-(e.y+e.height-h._fullScreenSize.y),h.rightBoundary=this._duration},_cloneDecoration:function(b){b._repeatForever=this._repeatForever,b._speed=this._speed,b._times=this._times,b._easeList=this._easeList,b._speedMethod=this._speedMethod,b._repeatMethod=this._repeatMethod},_reverseEaseList:function(d){if(this._easeList){d._easeList=[];for(var c=0;ch;h++){f=e[h].easing(f)}return f},step:function(d){this._firstTick?(this._firstTick=!1,this._elapsed=0):this._elapsed+=d;var c=this._elapsed/(this._duration>1.192092896e-7?this._duration:1.192092896e-7);c=1>c?c:1,this.update(c>0?c:0),this._repeatMethod&&this._times>1&&this.isDone()&&(this._repeatForever||this._times--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},startWithTarget:function(b){cc.Action.prototype.startWithTarget.call(this,b),this._elapsed=0,this._firstTick=!0},reverse:function(){return cc.log("cc.IntervalAction: reverse not implemented."),null},setAmplitudeRate:function(){cc.log("cc.ActionInterval.setAmplitudeRate(): it should be overridden in subclass.")},getAmplitudeRate:function(){return cc.log("cc.ActionInterval.getAmplitudeRate(): it should be overridden in subclass."),0},speed:function(b){return 0>=b?(cc.log("The speed parameter error"),this):(this._speedMethod=!0,this._speed*=b,this)},getSpeed:function(){return this._speed},setSpeed:function(b){return this._speed=b,this},repeat:function(b){return b=Math.round(b),isNaN(b)||1>b?(cc.log("The repeat parameter error"),this):(this._repeatMethod=!0,this._times*=b,this)},repeatForever:function(){return this._repeatMethod=!0,this._times=this.MAX_VALUE,this._repeatForever=!0,this}}),cc.ActionInterval.create=function(b){return new cc.ActionInterval(b)},cc.Sequence=cc.ActionInterval.extend({_actions:null,_split:null,_last:0,ctor:function(h){cc.ActionInterval.prototype.ctor.call(this),this._actions=[];var g=h instanceof Array?h:arguments,m=g.length-1;if(m>=0&&null==g[m]&&cc.log("parameters should not be ending with null in Javascript"),m>=0){for(var j,k=g[0],i=1;m>i;i++){g[i]&&(j=k,k=cc.Sequence.create(),k.initWithTwoActions(j,g[i]))}this.initWithTwoActions(k,g[m])}},initWithTwoActions:function(e,d){if(!e||!d){throw"cc.Sequence.initWithTwoActions(): arguments must all be non nil"}var f=e._duration+d._duration;return this.initWithDuration(f),this._actions[0]=e,this._actions[1]=d,!0 },clone:function(){var b=new cc.Sequence;return this._cloneDecoration(b),b.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone()),b},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this._split=this._actions[0]._duration/this._duration,this._last=-1},stop:function(){-1!==this._last&&this._actions[this._last].stop(),cc.Action.prototype.stop.call(this)},update:function(h){h=this._computeEaseTime(h);var g,m=0,k=this._split,j=this._actions,i=this._last;k>h?(g=0!==k?h/k:1,0===m&&1===i&&(j[1].update(0),j[1].stop())):(m=1,g=1===k?1:(h-k)/(1-k),-1===i&&(j[0].startWithTarget(this.target),j[0].update(1),j[0].stop()),i||(j[0].update(1),j[0].stop())),i===m&&j[m].isDone()||(i!==m&&j[m].startWithTarget(this.target),j[m].update(g),this._last=m)},reverse:function(){var b=cc.Sequence._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.Sequence.create=function(f){var e=f instanceof Array?f:arguments;e.length>0&&null==e[e.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var h=e[0],g=1;g=h){for(;g>h&&this._total=1&&this._total=0&&null==g[m]&&cc.log("parameters should not be ending with null in Javascript"),m>=0){for(var j,k=g[0],i=1;m>i;i++){g[i]&&(j=k,k=cc.Spwan.create(),k.initWithTwoActions(j,g[i]))}this.initWithTwoActions(k,g[m])}},initWithTwoActions:function(g,f){if(!g||!f){throw"cc.Spawn.initWithTwoActions(): arguments must all be non null"}var j=!1,i=g._duration,h=f._duration;return this.initWithDuration(Math.max(i,h))&&(this._one=g,this._two=f,i>h?this._two=cc.Sequence._actionOneTwo(f,cc.DelayTime.create(i-h)):h>i&&(this._one=cc.Sequence._actionOneTwo(g,cc.DelayTime.create(h-i))),j=!0),j},clone:function(){var b=new cc.Spawn;return this._cloneDecoration(b),b.initWithTwoActions(this._one.clone(),this._two.clone()),b},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this._one.startWithTarget(b),this._two.startWithTarget(b)},stop:function(){this._one.stop(),this._two.stop(),cc.Action.prototype.stop.call(this) },update:function(b){b=this._computeEaseTime(b),this._one&&this._one.update(b),this._two&&this._two.update(b)},reverse:function(){var b=cc.Spawn._actionOneTwo(this._one.reverse(),this._two.reverse());return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.Spawn.create=function(f){var e=f instanceof Array?f:arguments;e.length>0&&null==e[e.length-1]&&cc.log("parameters should not be ending with null in Javascript");for(var h=e[0],g=1;g180&&(h-=360),-180>h&&(h+=360),this._startAngleX=e,this._diffAngleX=h,this._startAngleY=f.rotationY%360;var g=this._dstAngleY-this._startAngleY;g>180&&(g-=360),-180>g&&(g+=360),this._diffAngleY=g},reverse:function(){cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.")},update:function(b){b=this._computeEaseTime(b),this.target&&(this.target.rotationX=this._startAngleX+this._diffAngleX*b,this.target.rotationY=this._startAngleY+this._diffAngleY*b)}}),cc.RotateTo.create=function(e,d,f){return new cc.RotateTo(e,d,f)},cc.RotateBy=cc.ActionInterval.extend({_angleX:0,_startAngleX:0,_angleY:0,_startAngleY:0,ctor:function(e,d,f){cc.ActionInterval.prototype.ctor.call(this),void 0!==d&&this.initWithDuration(e,d,f)},initWithDuration:function(e,d,f){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(this._angleX=d||0,this._angleY=f||this._angleX,!0):!1},clone:function(){var b=new cc.RotateBy;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._angleX,this._angleY),b},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this._startAngleX=b.rotationX,this._startAngleY=b.rotationY},update:function(b){b=this._computeEaseTime(b),this.target&&(this.target.rotationX=this._startAngleX+this._angleX*b,this.target.rotationY=this._startAngleY+this._angleY*b)},reverse:function(){var b=cc.RotateBy.create(this._duration,-this._angleX,-this._angleY);return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.RotateBy.create=function(f,e,h){var g=new cc.RotateBy;return g.initWithDuration(f,e,h),g},cc.MoveBy=cc.ActionInterval.extend({_positionDelta:null,_startPosition:null,_previousPosition:null,ctor:function(e,d,f){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!==d&&this.initWithDuration(e,d,f)},initWithDuration:function(e,d,f){return cc.ActionInterval.prototype.initWithDuration.call(this,e)?(void 0!==d.x&&(f=d.y,d=d.x),this._positionDelta.x=d,this._positionDelta.y=f,!0):!1},clone:function(){var b=new cc.MoveBy;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._positionDelta),b},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e);var d=e.getPositionX(),f=e.getPositionY();this._previousPosition.x=d,this._previousPosition.y=f,this._startPosition.x=d,this._startPosition.y=f},update:function(i){if(i=this._computeEaseTime(i),this.target){var h=this._positionDelta.x*i,o=this._positionDelta.y*i,n=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var m=this.target.getPositionX(),k=this.target.getPositionY(),j=this._previousPosition;n.x=n.x+m-j.x,n.y=n.y+k-j.y,h+=n.x,o+=n.y,j.x=h,j.y=o,this.target.setPosition(h,o)}else{this.target.setPosition(n.x+h,n.y+o)}}},reverse:function(){var b=cc.MoveBy.create(this._duration,cc.p(-this._positionDelta.x,-this._positionDelta.y));return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.MoveBy.create=function(e,d,f){return new cc.MoveBy(e,d,f)},cc.MoveTo=cc.MoveBy.extend({_endPosition:null,ctor:function(e,d,f){cc.MoveBy.prototype.ctor.call(this),this._endPosition=cc.p(0,0),void 0!==d&&this.initWithDuration(e,d,f)},initWithDuration:function(e,d,f){return cc.MoveBy.prototype.initWithDuration.call(this,e,d,f)?(void 0!==d.x&&(f=d.y,d=d.x),this._endPosition.x=d,this._endPosition.y=f,!0):!1},clone:function(){var b=new cc.MoveTo;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._endPosition),b},startWithTarget:function(b){cc.MoveBy.prototype.startWithTarget.call(this,b),this._positionDelta.x=this._endPosition.x-b.getPositionX(),this._positionDelta.y=this._endPosition.y-b.getPositionY()}}),cc.MoveTo.create=function(e,d,f){return new cc.MoveTo(e,d,f) },cc.SkewTo=cc.ActionInterval.extend({_skewX:0,_skewY:0,_startSkewX:0,_startSkewY:0,_endSkewX:0,_endSkewY:0,_deltaX:0,_deltaY:0,ctor:function(e,d,f){cc.ActionInterval.prototype.ctor.call(this),void 0!==f&&this.initWithDuration(e,d,f)},initWithDuration:function(f,e,h){var g=!1;return cc.ActionInterval.prototype.initWithDuration.call(this,f)&&(this._endSkewX=e,this._endSkewY=h,g=!0),g},clone:function(){var b=new cc.SkewTo;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._endSkewX,this._endSkewY),b},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this._startSkewX=b.skewX%180,this._deltaX=this._endSkewX-this._startSkewX,this._deltaX>180&&(this._deltaX-=360),this._deltaX<-180&&(this._deltaX+=360),this._startSkewY=b.skewY%360,this._deltaY=this._endSkewY-this._startSkewY,this._deltaY>180&&(this._deltaY-=360),this._deltaY<-180&&(this._deltaY+=360)},update:function(b){b=this._computeEaseTime(b),this.target.skewX=this._startSkewX+this._deltaX*b,this.target.skewY=this._startSkewY+this._deltaY*b}}),cc.SkewTo.create=function(e,d,f){return new cc.SkewTo(e,d,f)},cc.SkewBy=cc.SkewTo.extend({ctor:function(e,d,f){cc.SkewTo.prototype.ctor.call(this),void 0!==f&&this.initWithDuration(e,d,f)},initWithDuration:function(f,e,h){var g=!1;return cc.SkewTo.prototype.initWithDuration.call(this,f,e,h)&&(this._skewX=e,this._skewY=h,g=!0),g},clone:function(){var b=new cc.SkewBy;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._skewX,this._skewY),b},startWithTarget:function(b){cc.SkewTo.prototype.startWithTarget.call(this,b),this._deltaX=this._skewX,this._deltaY=this._skewY,this._endSkewX=this._startSkewX+this._deltaX,this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var b=cc.SkewBy.create(this._duration,-this._skewX,-this._skewY);return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.SkewBy.create=function(f,e,h){var g=new cc.SkewBy;return g&&g.initWithDuration(f,e,h),g},cc.JumpBy=cc.ActionInterval.extend({_startPosition:null,_delta:null,_height:0,_jumps:0,_previousPosition:null,ctor:function(g,f,j,i,h){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!==i&&this.initWithDuration(g,f,j,i,h)},initWithDuration:function(g,f,j,i,h){return cc.ActionInterval.prototype.initWithDuration.call(this,g)?(void 0===h&&(h=i,i=j,j=f.y,f=f.x),this._delta.x=f,this._delta.y=j,this._height=i,this._jumps=h,!0):!1},clone:function(){var b=new cc.JumpBy;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._delta,this._height,this._jumps),b},startWithTarget:function(e){cc.ActionInterval.prototype.startWithTarget.call(this,e);var d=e.getPositionX(),f=e.getPositionY();this._previousPosition.x=d,this._previousPosition.y=f,this._startPosition.x=d,this._startPosition.y=f},update:function(j){if(j=this._computeEaseTime(j),this.target){var i=j*this._jumps%1,r=4*this._height*i*(1-i);r+=this._delta.y*j;var q=this._delta.x*j,o=this._startPosition;if(cc.ENABLE_STACKABLE_ACTIONS){var n=this.target.getPositionX(),m=this.target.getPositionY(),k=this._previousPosition;o.x=o.x+n-k.x,o.y=o.y+m-k.y,q+=o.x,r+=o.y,k.x=q,k.y=r,this.target.setPosition(q,r)}else{this.target.setPosition(o.x+q,o.y+r)}}},reverse:function(){var b=cc.JumpBy.create(this._duration,cc.p(-this._delta.x,-this._delta.y),this._height,this._jumps);return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.JumpBy.create=function(g,f,j,i,h){return new cc.JumpBy(g,f,j,i,h)},cc.JumpTo=cc.JumpBy.extend({startWithTarget:function(b){cc.JumpBy.prototype.startWithTarget.call(this,b),this._delta.x=this._delta.x-this._startPosition.x,this._delta.y=this._delta.y-this._startPosition.y},clone:function(){var b=new cc.JumpTo;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._delta,this._height,this._jumps),b}}),cc.JumpTo.create=function(g,f,j,i,h){return new cc.JumpTo(g,f,j,i,h)},cc.bezierAt=function(g,f,j,i,h){return Math.pow(1-h,3)*g+3*h*Math.pow(1-h,2)*f+3*Math.pow(h,2)*(1-h)*j+Math.pow(h,3)*i},cc.BezierBy=cc.ActionInterval.extend({_config:null,_startPosition:null,_previousPosition:null,ctor:function(d,c){cc.ActionInterval.prototype.ctor.call(this),this._config=[],this._startPosition=cc.p(0,0),this._previousPosition=cc.p(0,0),c&&this.initWithDuration(d,c)},initWithDuration:function(d,c){return cc.ActionInterval.prototype.initWithDuration.call(this,d)?(this._config=c,!0):!1},clone:function(){var f=new cc.BezierBy;this._cloneDecoration(f);for(var e=[],h=0;hd/2}},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this._originalState=b.visible},stop:function(){this.target.visible=this._originalState,cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var b=cc.Blink.create(this._duration,this._times);return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.Blink.create=function(e,d){var f=new cc.Blink;return f.initWithDuration(e,d),f},cc.FadeTo=cc.ActionInterval.extend({_toOpacity:0,_fromOpacity:0,ctor:function(d,c){cc.ActionInterval.prototype.ctor.call(this),void 0!==c&&this.initWithDuration(d,c)},initWithDuration:function(d,c){return cc.ActionInterval.prototype.initWithDuration.call(this,d)?(this._toOpacity=c,!0):!1},clone:function(){var b=new cc.FadeTo;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._toOpacity),b},update:function(d){if(d=this._computeEaseTime(d),this.target.RGBAProtocol){var c=void 0!==this._fromOpacity?this._fromOpacity:255;this.target.opacity=c+(this._toOpacity-c)*d}},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this.target.RGBAProtocol&&(this._fromOpacity=b.opacity)}}),cc.FadeTo.create=function(d,c){return new cc.FadeTo(d,c)},cc.FadeIn=cc.FadeTo.extend({_reverseAction:null,reverse:function(){var b=new cc.FadeOut;return b.initWithDuration(this._duration,0),this._cloneDecoration(b),this._reverseEaseList(b),b},clone:function(){var b=new cc.FadeIn;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._toOpacity),b},startWithTarget:function(b){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity),cc.FadeTo.prototype.startWithTarget.call(this,b) }}),cc.FadeIn.create=function(d,c){return null==c&&(c=255),new cc.FadeIn(d,c)},cc.FadeOut=cc.FadeTo.extend({reverse:function(){var b=new cc.FadeIn;return b._reverseAction=this,b.initWithDuration(this._duration,255),this._cloneDecoration(b),this._reverseEaseList(b),b},clone:function(){var b=new cc.FadeOut;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._toOpacity),b}}),cc.FadeOut.create=function(d){var c=new cc.FadeOut;return c.initWithDuration(d,0),c},cc.TintTo=cc.ActionInterval.extend({_to:null,_from:null,ctor:function(f,e,h,g){cc.ActionInterval.prototype.ctor.call(this),this._to=cc.color(0,0,0),this._from=cc.color(0,0,0),void 0!==g&&this.initWithDuration(f,e,h,g)},initWithDuration:function(f,e,h,g){return cc.ActionInterval.prototype.initWithDuration.call(this,f)?(this._to=cc.color(e,h,g),!0):!1},clone:function(){var d=new cc.TintTo;this._cloneDecoration(d);var c=this._to;return d.initWithDuration(this._duration,c.r,c.g,c.b),d},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this.target.RGBAProtocol&&(this._from=this.target.color)},update:function(e){e=this._computeEaseTime(e);var d=this._from,f=this._to;d&&this.target.RGBAProtocol&&(this.target.color=cc.color(d.r+(f.r-d.r)*e,d.g+(f.g-d.g)*e,d.b+(f.b-d.b)*e))}}),cc.TintTo.create=function(f,e,h,g){return new cc.TintTo(f,e,h,g)},cc.TintBy=cc.ActionInterval.extend({_deltaR:0,_deltaG:0,_deltaB:0,_fromR:0,_fromG:0,_fromB:0,ctor:function(f,e,h,g){cc.ActionInterval.prototype.ctor.call(this),void 0!==g&&this.initWithDuration(f,e,h,g)},initWithDuration:function(f,e,h,g){return cc.ActionInterval.prototype.initWithDuration.call(this,f)?(this._deltaR=e,this._deltaG=h,this._deltaB=g,!0):!1},clone:function(){var b=new cc.TintBy;return this._cloneDecoration(b),b.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB),b},startWithTarget:function(d){if(cc.ActionInterval.prototype.startWithTarget.call(this,d),d.RGBAProtocol){var c=d.color;this._fromR=c.r,this._fromG=c.g,this._fromB=c.b}},update:function(b){b=this._computeEaseTime(b),this.target.RGBAProtocol&&(this.target.color=cc.color(this._fromR+this._deltaR*b,this._fromG+this._deltaG*b,this._fromB+this._deltaB*b))},reverse:function(){var b=cc.TintBy.create(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);return this._cloneDecoration(b),this._reverseEaseList(b),b}}),cc.TintBy.create=function(f,e,h,g){return new cc.TintBy(f,e,h,g)},cc.DelayTime=cc.ActionInterval.extend({update:function(){},reverse:function(){var b=cc.DelayTime.create(this._duration);return this._cloneDecoration(b),this._reverseEaseList(b),b},clone:function(){var b=new cc.DelayTime;return this._cloneDecoration(b),b.initWithDuration(this._duration),b}}),cc.DelayTime.create=function(b){return new cc.DelayTime(b)},cc.ReverseTime=cc.ActionInterval.extend({_other:null,ctor:function(b){cc.ActionInterval.prototype.ctor.call(this),this._other=null,b&&this.initWithAction(b)},initWithAction:function(b){if(!b){throw"cc.ReverseTime.initWithAction(): action must be non null"}if(b==this._other){throw"cc.ReverseTime.initWithAction(): the action was already passed in."}return cc.ActionInterval.prototype.initWithDuration.call(this,b._duration)?(this._other=b,!0):!1},clone:function(){var b=new cc.ReverseTime;return this._cloneDecoration(b),b.initWithAction(this._other.clone()),b},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this._other.startWithTarget(b)},update:function(b){b=this._computeEaseTime(b),this._other&&this._other.update(1-b)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop(),cc.Action.prototype.stop.call(this)}}),cc.ReverseTime.create=function(b){return new cc.ReverseTime(b)},cc.Animate=cc.ActionInterval.extend({_animation:null,_nextFrame:0,_origFrame:null,_executedLoops:0,_splitTimes:null,ctor:function(b){cc.ActionInterval.prototype.ctor.call(this),this._splitTimes=[],b&&this.initWithAnimation(b)},getAnimation:function(){return this._animation},setAnimation:function(b){this._animation=b},initWithAnimation:function(t){if(!t){throw"cc.Animate.initWithAnimation(): animation must be non-NULL"}var s=t.getDuration();if(this.initWithDuration(s*t.getLoops())){this._nextFrame=0,this.setAnimation(t),this._origFrame=null,this._executedLoops=0;var r=this._splitTimes;r.length=0;var q=0,o=s/t.getTotalDelayUnits(),n=t.getFrames();cc.arrayVerifyType(n,cc.AnimationFrame);for(var m=0;mh){h*=this._animation.getLoops();var g=0|h;g>this._executedLoops&&(this._nextFrame=0,this._executedLoops++),h%=1 }for(var m=this._animation.getFrames(),k=m.length,j=this._splitTimes,i=this._nextFrame;k>i&&j[i]<=h;i++){this.target.setSpriteFrame(m[i].getSpriteFrame()),this._nextFrame=i+1}},reverse:function(){var i=this._animation,h=i.getFrames(),o=[];if(cc.arrayVerifyType(h,cc.AnimationFrame),h.length>0){for(var n=h.length-1;n>=0;n--){var m=h[n];if(!m){break}o.push(m.clone())}}var k=cc.Animation.create(o,i.getDelayPerUnit(),i.getLoops());k.setRestoreOriginalFrame(i.getRestoreOriginalFrame());var j=cc.Animate.create(k);return this._cloneDecoration(j),this._reverseEaseList(j),j},stop:function(){this._animation.getRestoreOriginalFrame()&&this.target&&this.target.setSpriteFrame(this._origFrame),cc.Action.prototype.stop.call(this)}}),cc.Animate.create=function(b){return new cc.Animate(b)},cc.TargetedAction=cc.ActionInterval.extend({_action:null,_forcedTarget:null,ctor:function(d,c){cc.ActionInterval.prototype.ctor.call(this),c&&this.initWithTarget(d,c)},initWithTarget:function(d,c){return this.initWithDuration(c._duration)?(this._forcedTarget=d,this._action=c,!0):!1},clone:function(){var b=new cc.TargetedAction;return this._cloneDecoration(b),b.initWithTarget(this._forcedTarget,this._action.clone()),b},startWithTarget:function(b){cc.ActionInterval.prototype.startWithTarget.call(this,b),this._action.startWithTarget(this._forcedTarget)},stop:function(){this._action.stop()},update:function(b){b=this._computeEaseTime(b),this._action.update(b)},getForcedTarget:function(){return this._forcedTarget},setForcedTarget:function(b){this._forcedTarget!=b&&(this._forcedTarget=b)}}),cc.TargetedAction.create=function(d,c){return new cc.TargetedAction(d,c)};cc.HashElement=cc.Class.extend({actions:null,target:null,actionIndex:0,currentAction:null,currentActionSalvaged:!1,paused:!1,hh:null,ctor:function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.currentActionSalvaged=!1,this.paused=!1,this.hh=null}}),cc.ActionManager=cc.Class.extend({_hashTargets:null,_arrayTargets:null,_currentTarget:null,_currentTargetSalvaged:!1,_searchElementByTarget:function(e,d){for(var f=0;fj;++j){var i=m.actions[j];if(i&&i.getTag()===h&&i.getOriginalTarget()==g){this._removeActionAtIndex(j,m);break}}}},getActionByTag:function(g,f){g==cc.ACTION_TAG_INVALID&&cc.log(cc._LogInfos.ActionManager_getActionByTag);var j=this._hashTargets[f.__instanceId];if(j){if(null!=j.actions){for(var i=0;i=e&&d.actionIndex--,0==d.actions.length&&(this._currentTarget==d?this._currentTargetSalvaged=!0:this._deleteHashElement(d))},_deleteHashElement:function(b){b&&(delete this._hashTargets[b.target.__instanceId],cc.arrayRemoveObject(this._arrayTargets,b),b.actions=null,b.target=null) },_actionAllocWithHashElement:function(b){null==b.actions&&(b.actions=[])},update:function(g){for(var j,f=this._arrayTargets,i=0;i